{"version":3,"file":"kendo.ui.core.min.js","sources":["kendo.ui.core.js"],"sourcesContent":["(function(f, define) {\n define('kendo.core',['jquery'], f);\n})(function() {\n\nvar __meta__ = {\n id: \"core\",\n name: \"Core\",\n category: \"framework\",\n description: \"The core of the Kendo framework.\"\n};\n\nvar packageMetadata = {\n name: '@progress/kendo-ui',\n productName: 'Kendo UI',\n productCodes: ['KENDOUICOMPLETE', 'KENDOUI', 'KENDOUI', 'KENDOUICOMPLETE'],\n publishDate: 0,\n version: '',\n licensingDocsUrl: 'https://docs.telerik.com/kendo-ui/intro/installation/using-license-code'\n};\n\n\n(function($, window, undefined) {\n var kendo = window.kendo = window.kendo || { cultures: {} },\n extend = $.extend,\n each = $.each,\n isArray = Array.isArray,\n noop = $.noop,\n math = Math,\n Template,\n JSON = window.JSON || {},\n support = {},\n percentRegExp = /%/,\n formatRegExp = /\\{(\\d+)(:[^\\}]+)?\\}/g,\n boxShadowRegExp = /(\\d+(?:\\.?)\\d*)px\\s*(\\d+(?:\\.?)\\d*)px\\s*(\\d+(?:\\.?)\\d*)px\\s*(\\d+)?/i,\n numberRegExp = /^(\\+|-?)\\d+(\\.?)\\d*$/,\n FUNCTION = \"function\",\n STRING = \"string\",\n NUMBER = \"number\",\n OBJECT = \"object\",\n NULL = \"null\",\n BOOLEAN = \"boolean\",\n UNDEFINED = \"undefined\",\n PREFIX = \"prefix\",\n ARIA_LABELLEDBY = \"aria-labelledby\",\n ARIA_LABEL = \"aria-label\",\n LABELIDPART = \"_label\",\n getterCache = {},\n setterCache = {},\n slice = [].slice,\n cssPropertiesNames = [ \"themeColor\", \"fillMode\", \"shape\", \"size\", \"rounded\", \"positionMode\" ],\n // avoid extending the depricated properties in latest verions of jQuery\n noDepricateExtend = function() {\n var src, copyIsArray, copy, name, options, clone,\n target = arguments[ 0 ] || {},\n i = 1,\n length = arguments.length,\n deep = false;\n\n // Handle a deep copy situation\n if ( typeof target === \"boolean\" ) {\n deep = target;\n\n // skip the boolean and the target\n target = arguments[ i ] || {};\n i++;\n }\n\n // Handle case when target is a string or something (possible in deep copy)\n if ( typeof target !== \"object\" && typeof target !== \"function\") {\n target = {};\n }\n\n // extend jQuery itself if only one argument is passed\n if ( i === length ) {\n target = this;\n i--;\n }\n\n for ( ; i < length; i++ ) {\n\n // Only deal with non-null/undefined values\n if ( ( options = arguments[ i ] ) != null ) {\n\n // Extend the base object\n for ( name in options ) {\n // filters, concat and : properties are depricated in the jQuery 3.3.0\n // accessing these properties throw a warning when jQuery migrate is included\n if (name == \"filters\" || name == \"concat\" || name == \":\") {\n continue;\n }\n src = target[ name ];\n copy = options[ name ];\n\n // Prevent never-ending loop\n if ( target === copy ) {\n continue;\n }\n\n // Recurse if we're merging plain objects or arrays\n if ( deep && copy && ( jQuery.isPlainObject( copy ) ||\n ( copyIsArray = Array.isArray( copy ) ) ) ) {\n\n if ( copyIsArray ) {\n copyIsArray = false;\n clone = src && Array.isArray( src ) ? src : [];\n\n } else {\n clone = src && jQuery.isPlainObject( src ) ? src : {};\n }\n\n // Never move original objects, clone them\n target[ name ] = noDepricateExtend( deep, clone, copy );\n\n // Don't bring in undefined values\n } else if ( copy !== undefined ) {\n target[ name ] = copy;\n }\n }\n }\n }\n\n // Return the modified object\n return target;\n };\n\n kendo.version = \"2022.3.913\".replace(/^\\s+|\\s+$/g, '');\n\n function Class() {}\n\n Class.extend = function(proto) {\n var base = function() {},\n member,\n that = this,\n subclass = proto && proto.init ? proto.init : function() {\n that.apply(this, arguments);\n },\n fn;\n\n base.prototype = that.prototype;\n fn = subclass.fn = subclass.prototype = new base();\n\n for (member in proto) {\n if (proto[member] != null && proto[member].constructor === Object) {\n // Merge object members\n fn[member] = extend(true, {}, base.prototype[member], proto[member]);\n } else {\n fn[member] = proto[member];\n }\n }\n\n fn.constructor = subclass;\n subclass.extend = that.extend;\n\n return subclass;\n };\n\n Class.prototype._initOptions = function(options) {\n this.options = deepExtend({}, this.options, options);\n };\n\n var isFunction = kendo.isFunction = function(fn) {\n return typeof fn === \"function\";\n };\n\n var preventDefault = function() {\n this._defaultPrevented = true;\n };\n\n var isDefaultPrevented = function() {\n return this._defaultPrevented === true;\n };\n\n var Observable = Class.extend({\n init: function() {\n this._events = {};\n },\n\n bind: function(eventName, handlers, one) {\n var that = this,\n idx,\n eventNames = typeof eventName === STRING ? [eventName] : eventName,\n length,\n original,\n handler,\n handlersIsFunction = typeof handlers === FUNCTION,\n events;\n\n if (handlers === undefined) {\n for (idx in eventName) {\n that.bind(idx, eventName[idx]);\n }\n return that;\n }\n\n for (idx = 0, length = eventNames.length; idx < length; idx++) {\n eventName = eventNames[idx];\n\n handler = handlersIsFunction ? handlers : handlers[eventName];\n\n if (handler) {\n if (one) {\n original = handler;\n handler = function() {\n that.unbind(eventName, handler);\n original.apply(that, arguments);\n };\n handler.original = original;\n }\n events = that._events[eventName] = that._events[eventName] || [];\n events.push(handler);\n }\n }\n\n return that;\n },\n\n one: function(eventNames, handlers) {\n return this.bind(eventNames, handlers, true);\n },\n\n first: function(eventName, handlers) {\n var that = this,\n idx,\n eventNames = typeof eventName === STRING ? [eventName] : eventName,\n length,\n handler,\n handlersIsFunction = typeof handlers === FUNCTION,\n events;\n\n for (idx = 0, length = eventNames.length; idx < length; idx++) {\n eventName = eventNames[idx];\n\n handler = handlersIsFunction ? handlers : handlers[eventName];\n\n if (handler) {\n events = that._events[eventName] = that._events[eventName] || [];\n events.unshift(handler);\n }\n }\n\n return that;\n },\n\n trigger: function(eventName, e) {\n var that = this,\n events = that._events[eventName],\n idx,\n length;\n\n if (events) {\n e = e || {};\n\n e.sender = that;\n\n e._defaultPrevented = false;\n\n e.preventDefault = preventDefault;\n\n e.isDefaultPrevented = isDefaultPrevented;\n\n events = events.slice();\n\n for (idx = 0, length = events.length; idx < length; idx++) {\n events[idx].call(that, e);\n }\n\n return e._defaultPrevented === true;\n }\n\n return false;\n },\n\n unbind: function(eventName, handler) {\n var that = this,\n events = that._events[eventName],\n idx;\n\n if (eventName === undefined) {\n that._events = {};\n } else if (events) {\n if (handler) {\n for (idx = events.length - 1; idx >= 0; idx--) {\n if (events[idx] === handler || events[idx].original === handler) {\n events.splice(idx, 1);\n }\n }\n } else {\n that._events[eventName] = [];\n }\n }\n\n return that;\n }\n });\n\n\n function compilePart(part, stringPart) {\n if (stringPart) {\n return \"'\" +\n part.split(\"'\").join(\"\\\\'\")\n .split('\\\\\"').join('\\\\\\\\\\\\\"')\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/\\t/g, \"\\\\t\") + \"'\";\n } else {\n var first = part.charAt(0),\n rest = part.substring(1);\n\n if (first === \"=\") {\n return \"+(\" + rest + \")+\";\n } else if (first === \":\") {\n return \"+$kendoHtmlEncode(\" + rest + \")+\";\n } else {\n return \";\" + part + \";$kendoOutput+=\";\n }\n }\n }\n\n var argumentNameRegExp = /^\\w+/,\n encodeRegExp = /\\$\\{([^}]*)\\}/g,\n escapedCurlyRegExp = /\\\\\\}/g,\n curlyRegExp = /__CURLY__/g,\n escapedSharpRegExp = /\\\\#/g,\n sharpRegExp = /__SHARP__/g,\n zeros = [\"\", \"0\", \"00\", \"000\", \"0000\"];\n\n Template = {\n paramName: \"data\", // name of the parameter of the generated template\n useWithBlock: true, // whether to wrap the template in a with() block\n render: function(template, data) {\n var idx,\n length,\n html = \"\";\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n html += template(data[idx]);\n }\n\n return html;\n },\n compile: function(template, options) {\n var settings = extend({}, this, options),\n paramName = settings.paramName,\n argumentName = paramName.match(argumentNameRegExp)[0],\n useWithBlock = settings.useWithBlock,\n functionBody = \"var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;\",\n fn,\n parts,\n idx;\n\n if (isFunction(template)) {\n return template;\n }\n\n functionBody += useWithBlock ? \"with(\" + paramName + \"){\" : \"\";\n\n functionBody += \"$kendoOutput=\";\n\n parts = template\n .replace(escapedCurlyRegExp, \"__CURLY__\")\n .replace(encodeRegExp, \"#=$kendoHtmlEncode($1)#\")\n .replace(curlyRegExp, \"}\")\n .replace(escapedSharpRegExp, \"__SHARP__\")\n .split(\"#\");\n\n for (idx = 0; idx < parts.length; idx ++) {\n functionBody += compilePart(parts[idx], idx % 2 === 0);\n }\n\n functionBody += useWithBlock ? \";}\" : \";\";\n\n functionBody += \"return $kendoOutput;\";\n\n functionBody = functionBody.replace(sharpRegExp, \"#\");\n\n try {\n fn = new Function(argumentName, functionBody);\n fn._slotCount = Math.floor(parts.length / 2);\n return fn;\n } catch (e) {\n throw new Error(kendo.format(\"Invalid template:'{0}' Generated code:'{1}'\", template, functionBody));\n }\n }\n };\n\nfunction pad(number, digits, end) {\n number = number + \"\";\n digits = digits || 2;\n end = digits - number.length;\n\n if (end) {\n return zeros[digits].substring(0, end) + number;\n }\n\n return number;\n}\n\n //JSON stringify\n(function() {\n var escapable = /[\\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,\n gap,\n indent,\n meta = {\n \"\\b\": \"\\\\b\",\n \"\\t\": \"\\\\t\",\n \"\\n\": \"\\\\n\",\n \"\\f\": \"\\\\f\",\n \"\\r\": \"\\\\r\",\n \"\\\"\": '\\\\\"',\n \"\\\\\": \"\\\\\\\\\"\n },\n rep,\n toString = {}.toString;\n\n\n if (typeof Date.prototype.toJSON !== FUNCTION) {\n\n Date.prototype.toJSON = function() {\n var that = this;\n\n return isFinite(that.valueOf()) ?\n pad(that.getUTCFullYear(), 4) + \"-\" +\n pad(that.getUTCMonth() + 1) + \"-\" +\n pad(that.getUTCDate()) + \"T\" +\n pad(that.getUTCHours()) + \":\" +\n pad(that.getUTCMinutes()) + \":\" +\n pad(that.getUTCSeconds()) + \"Z\" : null;\n };\n\n String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function() {\n return this.valueOf();\n };\n }\n\n function quote(string) {\n escapable.lastIndex = 0;\n return escapable.test(string) ? \"\\\"\" + string.replace(escapable, function(a) {\n var c = meta[a];\n return typeof c === STRING ? c :\n \"\\\\u\" + (\"0000\" + a.charCodeAt(0).toString(16)).slice(-4);\n }) + \"\\\"\" : \"\\\"\" + string + \"\\\"\";\n }\n\n function str(key, holder) {\n var i,\n k,\n v,\n length,\n mind = gap,\n partial,\n value = holder[key],\n type;\n\n if (value && typeof value === OBJECT && typeof value.toJSON === FUNCTION) {\n value = value.toJSON(key);\n }\n\n if (typeof rep === FUNCTION) {\n value = rep.call(holder, key, value);\n }\n\n type = typeof value;\n if (type === STRING) {\n return quote(value);\n } else if (type === NUMBER) {\n return isFinite(value) ? String(value) : NULL;\n } else if (type === BOOLEAN || type === NULL) {\n return String(value);\n } else if (type === OBJECT) {\n if (!value) {\n return NULL;\n }\n gap += indent;\n partial = [];\n if (toString.apply(value) === \"[object Array]\") {\n length = value.length;\n for (i = 0; i < length; i++) {\n partial[i] = str(i, value) || NULL;\n }\n v = partial.length === 0 ? \"[]\" : gap ?\n \"[\\n\" + gap + partial.join(\",\\n\" + gap) + \"\\n\" + mind + \"]\" :\n \"[\" + partial.join(\",\") + \"]\";\n gap = mind;\n return v;\n }\n if (rep && typeof rep === OBJECT) {\n length = rep.length;\n for (i = 0; i < length; i++) {\n if (typeof rep[i] === STRING) {\n k = rep[i];\n v = str(k, value);\n if (v) {\n partial.push(quote(k) + (gap ? \": \" : \":\") + v);\n }\n }\n }\n } else {\n for (k in value) {\n if (Object.hasOwnProperty.call(value, k)) {\n v = str(k, value);\n if (v) {\n partial.push(quote(k) + (gap ? \": \" : \":\") + v);\n }\n }\n }\n }\n\n v = partial.length === 0 ? \"{}\" : gap ?\n \"{\\n\" + gap + partial.join(\",\\n\" + gap) + \"\\n\" + mind + \"}\" :\n \"{\" + partial.join(\",\") + \"}\";\n gap = mind;\n return v;\n }\n }\n\n if (typeof JSON.stringify !== FUNCTION) {\n JSON.stringify = function(value, replacer, space) {\n var i;\n gap = \"\";\n indent = \"\";\n\n if (typeof space === NUMBER) {\n for (i = 0; i < space; i += 1) {\n indent += \" \";\n }\n\n } else if (typeof space === STRING) {\n indent = space;\n }\n\n rep = replacer;\n if (replacer && typeof replacer !== FUNCTION && (typeof replacer !== OBJECT || typeof replacer.length !== NUMBER)) {\n throw new Error(\"JSON.stringify\");\n }\n\n return str(\"\", { \"\": value });\n };\n }\n})();\n\n// Date and Number formatting\n(function() {\n var dateFormatRegExp = /dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|\"[^\"]*\"|'[^']*'/g,\n standardFormatRegExp = /^(n|c|p|e)(\\d*)$/i,\n literalRegExp = /(\\\\.)|(['][^']*[']?)|([\"][^\"]*[\"]?)/g,\n commaRegExp = /\\,/g,\n EMPTY = \"\",\n POINT = \".\",\n COMMA = \",\",\n SHARP = \"#\",\n ZERO = \"0\",\n PLACEHOLDER = \"??\",\n EN = \"en-US\",\n objectToString = {}.toString;\n\n //cultures\n kendo.cultures[\"en-US\"] = {\n name: EN,\n numberFormat: {\n pattern: [\"-n\"],\n decimals: 2,\n \",\": \",\",\n \".\": \".\",\n groupSize: [3],\n percent: {\n pattern: [\"-n %\", \"n %\"],\n decimals: 2,\n \",\": \",\",\n \".\": \".\",\n groupSize: [3],\n symbol: \"%\"\n },\n currency: {\n name: \"US Dollar\",\n abbr: \"USD\",\n pattern: [\"($n)\", \"$n\"],\n decimals: 2,\n \",\": \",\",\n \".\": \".\",\n groupSize: [3],\n symbol: \"$\"\n }\n },\n calendars: {\n standard: {\n days: {\n names: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n namesAbbr: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n namesShort: [ \"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\" ]\n },\n months: {\n names: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n namesAbbr: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n },\n AM: [ \"AM\", \"am\", \"AM\" ],\n PM: [ \"PM\", \"pm\", \"PM\" ],\n patterns: {\n d: \"M/d/yyyy\",\n D: \"dddd, MMMM dd, yyyy\",\n F: \"dddd, MMMM dd, yyyy h:mm:ss tt\",\n g: \"M/d/yyyy h:mm tt\",\n G: \"M/d/yyyy h:mm:ss tt\",\n m: \"MMMM dd\",\n M: \"MMMM dd\",\n s: \"yyyy'-'MM'-'ddTHH':'mm':'ss\",\n t: \"h:mm tt\",\n T: \"h:mm:ss tt\",\n u: \"yyyy'-'MM'-'dd HH':'mm':'ss'Z'\",\n y: \"MMMM, yyyy\",\n Y: \"MMMM, yyyy\"\n },\n \"/\": \"/\",\n \":\": \":\",\n firstDay: 0,\n twoDigitYearMax: 2029\n }\n }\n };\n\n\n function findCulture(culture) {\n if (culture) {\n if (culture.numberFormat) {\n return culture;\n }\n\n if (typeof culture === STRING) {\n var cultures = kendo.cultures;\n return cultures[culture] || cultures[culture.split(\"-\")[0]] || null;\n }\n\n return null;\n }\n\n return null;\n }\n\n function getCulture(culture) {\n if (culture) {\n culture = findCulture(culture);\n }\n\n return culture || kendo.cultures.current;\n }\n\n kendo.culture = function(cultureName) {\n var cultures = kendo.cultures, culture;\n\n if (cultureName !== undefined) {\n culture = findCulture(cultureName) || cultures[EN];\n culture.calendar = culture.calendars.standard;\n cultures.current = culture;\n } else {\n return cultures.current;\n }\n };\n\n kendo.findCulture = findCulture;\n kendo.getCulture = getCulture;\n\n //set current culture to en-US.\n kendo.culture(EN);\n\n function formatDate(date, format, culture) {\n culture = getCulture(culture);\n\n var calendar = culture.calendars.standard,\n days = calendar.days,\n months = calendar.months;\n\n format = calendar.patterns[format] || format;\n\n return format.replace(dateFormatRegExp, function(match) {\n var minutes;\n var result;\n var sign;\n\n if (match === \"d\") {\n result = date.getDate();\n } else if (match === \"dd\") {\n result = pad(date.getDate());\n } else if (match === \"ddd\") {\n result = days.namesAbbr[date.getDay()];\n } else if (match === \"dddd\") {\n result = days.names[date.getDay()];\n } else if (match === \"M\") {\n result = date.getMonth() + 1;\n } else if (match === \"MM\") {\n result = pad(date.getMonth() + 1);\n } else if (match === \"MMM\") {\n result = months.namesAbbr[date.getMonth()];\n } else if (match === \"MMMM\") {\n result = months.names[date.getMonth()];\n } else if (match === \"yy\") {\n result = pad(date.getFullYear() % 100);\n } else if (match === \"yyyy\") {\n result = pad(date.getFullYear(), 4);\n } else if (match === \"h\" ) {\n result = date.getHours() % 12 || 12;\n } else if (match === \"hh\") {\n result = pad(date.getHours() % 12 || 12);\n } else if (match === \"H\") {\n result = date.getHours();\n } else if (match === \"HH\") {\n result = pad(date.getHours());\n } else if (match === \"m\") {\n result = date.getMinutes();\n } else if (match === \"mm\") {\n result = pad(date.getMinutes());\n } else if (match === \"s\") {\n result = date.getSeconds();\n } else if (match === \"ss\") {\n result = pad(date.getSeconds());\n } else if (match === \"f\") {\n result = math.floor(date.getMilliseconds() / 100);\n } else if (match === \"ff\") {\n result = date.getMilliseconds();\n if (result > 99) {\n result = math.floor(result / 10);\n }\n result = pad(result);\n } else if (match === \"fff\") {\n result = pad(date.getMilliseconds(), 3);\n } else if (match === \"tt\") {\n result = date.getHours() < 12 ? calendar.AM[0] : calendar.PM[0];\n } else if (match === \"zzz\") {\n minutes = date.getTimezoneOffset();\n sign = minutes < 0;\n\n result = math.abs(minutes / 60).toString().split(\".\")[0];\n minutes = math.abs(minutes) - (result * 60);\n\n result = (sign ? \"+\" : \"-\") + pad(result);\n result += \":\" + pad(minutes);\n } else if (match === \"zz\" || match === \"z\") {\n result = date.getTimezoneOffset() / 60;\n sign = result < 0;\n\n result = math.abs(result).toString().split(\".\")[0];\n result = (sign ? \"+\" : \"-\") + (match === \"zz\" ? pad(result) : result);\n }\n\n return result !== undefined ? result : match.slice(1, match.length - 1);\n });\n }\n\n //number formatting\n function formatNumber(number, format, culture) {\n culture = getCulture(culture);\n\n var numberFormat = culture.numberFormat,\n decimal = numberFormat[POINT],\n precision = numberFormat.decimals,\n pattern = numberFormat.pattern[0],\n literals = [],\n symbol,\n isCurrency, isPercent,\n customPrecision,\n formatAndPrecision,\n negative = number < 0,\n integer,\n fraction,\n integerLength,\n fractionLength,\n replacement = EMPTY,\n value = EMPTY,\n idx,\n length,\n ch,\n hasGroup,\n hasNegativeFormat,\n decimalIndex,\n sharpIndex,\n zeroIndex,\n hasZero, hasSharp,\n percentIndex,\n currencyIndex,\n startZeroIndex,\n start = -1,\n end;\n\n //return empty string if no number\n if (number === undefined) {\n return EMPTY;\n }\n\n if (!isFinite(number)) {\n return number;\n }\n\n //if no format then return number.toString() or number.toLocaleString() if culture.name is not defined\n if (!format) {\n return culture.name.length ? number.toLocaleString() : number.toString();\n }\n\n formatAndPrecision = standardFormatRegExp.exec(format);\n\n // standard formatting\n if (formatAndPrecision) {\n format = formatAndPrecision[1].toLowerCase();\n\n isCurrency = format === \"c\";\n isPercent = format === \"p\";\n\n if (isCurrency || isPercent) {\n //get specific number format information if format is currency or percent\n numberFormat = isCurrency ? numberFormat.currency : numberFormat.percent;\n decimal = numberFormat[POINT];\n precision = numberFormat.decimals;\n symbol = numberFormat.symbol;\n pattern = numberFormat.pattern[negative ? 0 : 1];\n }\n\n customPrecision = formatAndPrecision[2];\n\n if (customPrecision) {\n precision = +customPrecision;\n }\n\n //return number in exponential format\n if (format === \"e\") {\n var exp = customPrecision ? number.toExponential(precision) : number.toExponential(); // toExponential() and toExponential(undefined) differ in FF #653438.\n\n return exp.replace(POINT, numberFormat[POINT]);\n }\n\n // multiply if format is percent\n if (isPercent) {\n number *= 100;\n }\n\n number = round(number, precision);\n negative = number < 0;\n number = number.split(POINT);\n\n integer = number[0];\n fraction = number[1];\n\n //exclude \"-\" if number is negative.\n if (negative) {\n integer = integer.substring(1);\n }\n\n value = groupInteger(integer, 0, integer.length, numberFormat);\n\n if (fraction) {\n value += decimal + fraction;\n }\n\n if (format === \"n\" && !negative) {\n return value;\n }\n\n number = EMPTY;\n\n for (idx = 0, length = pattern.length; idx < length; idx++) {\n ch = pattern.charAt(idx);\n\n if (ch === \"n\") {\n number += value;\n } else if (ch === \"$\" || ch === \"%\") {\n number += symbol;\n } else {\n number += ch;\n }\n }\n\n return number;\n }\n\n //custom formatting\n //\n //separate format by sections.\n\n if (format.indexOf(\"'\") > -1 || format.indexOf(\"\\\"\") > -1 || format.indexOf(\"\\\\\") > -1) {\n format = format.replace(literalRegExp, function(match) {\n var quoteChar = match.charAt(0).replace(\"\\\\\", \"\"),\n literal = match.slice(1).replace(quoteChar, \"\");\n\n literals.push(literal);\n\n return PLACEHOLDER;\n });\n }\n\n format = format.split(\";\");\n if (negative && format[1]) {\n //get negative format\n format = format[1];\n hasNegativeFormat = true;\n } else if (number === 0 && format[2]) {\n //format for zeros\n format = format[2];\n if (format.indexOf(SHARP) == -1 && format.indexOf(ZERO) == -1) {\n //return format if it is string constant.\n return format;\n }\n } else {\n format = format[0];\n }\n\n percentIndex = format.indexOf(\"%\");\n currencyIndex = format.indexOf(\"$\");\n\n isPercent = percentIndex != -1;\n isCurrency = currencyIndex != -1;\n\n //multiply number if the format has percent\n if (isPercent) {\n number *= 100;\n }\n\n if (isCurrency && format[currencyIndex - 1] === \"\\\\\") {\n format = format.split(\"\\\\\").join(\"\");\n isCurrency = false;\n }\n\n if (isCurrency || isPercent) {\n //get specific number format information if format is currency or percent\n numberFormat = isCurrency ? numberFormat.currency : numberFormat.percent;\n decimal = numberFormat[POINT];\n precision = numberFormat.decimals;\n symbol = numberFormat.symbol;\n }\n\n hasGroup = format.indexOf(COMMA) > -1;\n if (hasGroup) {\n format = format.replace(commaRegExp, EMPTY);\n }\n\n decimalIndex = format.indexOf(POINT);\n length = format.length;\n\n if (decimalIndex != -1) {\n fraction = number.toString().split(\"e\");\n if (fraction[1]) {\n fraction = round(number, Math.abs(fraction[1]));\n } else {\n fraction = fraction[0];\n }\n fraction = fraction.split(POINT)[1] || EMPTY;\n zeroIndex = format.lastIndexOf(ZERO) - decimalIndex;\n sharpIndex = format.lastIndexOf(SHARP) - decimalIndex;\n hasZero = zeroIndex > -1;\n hasSharp = sharpIndex > -1;\n idx = fraction.length;\n\n if (!hasZero && !hasSharp) {\n format = format.substring(0, decimalIndex) + format.substring(decimalIndex + 1);\n length = format.length;\n decimalIndex = -1;\n idx = 0;\n }\n\n if (hasZero && zeroIndex > sharpIndex) {\n idx = zeroIndex;\n } else if (sharpIndex > zeroIndex) {\n if (hasSharp && idx > sharpIndex) {\n var rounded = round(number, sharpIndex, negative);\n\n while (rounded.charAt(rounded.length - 1) === ZERO && sharpIndex > 0 && sharpIndex > zeroIndex) {\n sharpIndex--;\n\n rounded = round(number, sharpIndex, negative);\n }\n\n idx = sharpIndex;\n } else if (hasZero && idx < zeroIndex) {\n idx = zeroIndex;\n }\n }\n }\n\n number = round(number, idx, negative);\n\n sharpIndex = format.indexOf(SHARP);\n startZeroIndex = zeroIndex = format.indexOf(ZERO);\n\n //define the index of the first digit placeholder\n if (sharpIndex == -1 && zeroIndex != -1) {\n start = zeroIndex;\n } else if (sharpIndex != -1 && zeroIndex == -1) {\n start = sharpIndex;\n } else {\n start = sharpIndex > zeroIndex ? zeroIndex : sharpIndex;\n }\n\n sharpIndex = format.lastIndexOf(SHARP);\n zeroIndex = format.lastIndexOf(ZERO);\n\n //define the index of the last digit placeholder\n if (sharpIndex == -1 && zeroIndex != -1) {\n end = zeroIndex;\n } else if (sharpIndex != -1 && zeroIndex == -1) {\n end = sharpIndex;\n } else {\n end = sharpIndex > zeroIndex ? sharpIndex : zeroIndex;\n }\n\n if (start == length) {\n end = start;\n }\n\n if (start != -1) {\n value = number.toString().split(POINT);\n integer = value[0];\n fraction = value[1] || EMPTY;\n\n integerLength = integer.length;\n fractionLength = fraction.length;\n\n if (negative && (number * -1) >= 0) {\n negative = false;\n }\n\n number = format.substring(0, start);\n\n if (negative && !hasNegativeFormat) {\n number += \"-\";\n }\n\n for (idx = start; idx < length; idx++) {\n ch = format.charAt(idx);\n\n if (decimalIndex == -1) {\n if (end - idx < integerLength) {\n number += integer;\n break;\n }\n } else {\n if (zeroIndex != -1 && zeroIndex < idx) {\n replacement = EMPTY;\n }\n\n if ((decimalIndex - idx) <= integerLength && decimalIndex - idx > -1) {\n number += integer;\n idx = decimalIndex;\n }\n\n if (decimalIndex === idx) {\n number += (fraction ? decimal : EMPTY) + fraction;\n idx += end - decimalIndex + 1;\n continue;\n }\n }\n\n if (ch === ZERO) {\n number += ch;\n replacement = ch;\n } else if (ch === SHARP) {\n number += replacement;\n }\n }\n\n if (hasGroup) {\n number = groupInteger(number, start + (negative && !hasNegativeFormat ? 1 : 0), Math.max(end, (integerLength + start)), numberFormat);\n }\n\n if (end >= start) {\n number += format.substring(end + 1);\n }\n\n //replace symbol placeholders\n if (isCurrency || isPercent) {\n value = EMPTY;\n for (idx = 0, length = number.length; idx < length; idx++) {\n ch = number.charAt(idx);\n value += (ch === \"$\" || ch === \"%\") ? symbol : ch;\n }\n number = value;\n }\n\n length = literals.length;\n\n if (length) {\n for (idx = 0; idx < length; idx++) {\n number = number.replace(PLACEHOLDER, literals[idx]);\n }\n }\n }\n\n return number;\n }\n\n var groupInteger = function(number, start, end, numberFormat) {\n var decimalIndex = number.indexOf(numberFormat[POINT]);\n var groupSizes = numberFormat.groupSize.slice();\n var groupSize = groupSizes.shift();\n var integer, integerLength;\n var idx, parts, value;\n var newGroupSize;\n\n end = decimalIndex !== -1 ? decimalIndex : end + 1;\n\n integer = number.substring(start, end);\n integerLength = integer.length;\n\n if (integerLength >= groupSize) {\n idx = integerLength;\n parts = [];\n\n while (idx > -1) {\n value = integer.substring(idx - groupSize, idx);\n if (value) {\n parts.push(value);\n }\n idx -= groupSize;\n newGroupSize = groupSizes.shift();\n groupSize = newGroupSize !== undefined ? newGroupSize : groupSize;\n\n if (groupSize === 0) {\n if (idx > 0) {\n parts.push(integer.substring(0, idx));\n }\n break;\n }\n }\n\n integer = parts.reverse().join(numberFormat[COMMA]);\n number = number.substring(0, start) + integer + number.substring(end);\n }\n\n return number;\n };\n\n var round = function(value, precision, negative) {\n precision = precision || 0;\n\n value = value.toString().split('e');\n value = Math.round(+(value[0] + 'e' + (value[1] ? (+value[1] + precision) : precision)));\n\n if (negative) {\n value = -value;\n }\n\n value = value.toString().split('e');\n value = +(value[0] + 'e' + (value[1] ? (+value[1] - precision) : -precision));\n\n return value.toFixed(Math.min(precision, 20));\n };\n\n var toString = function(value, fmt, culture) {\n if (fmt) {\n if (objectToString.call(value) === \"[object Date]\") {\n return formatDate(value, fmt, culture);\n } else if (typeof value === NUMBER) {\n return formatNumber(value, fmt, culture);\n }\n }\n\n return value !== undefined ? value : \"\";\n };\n\n kendo.format = function(fmt) {\n var values = arguments;\n\n return fmt.replace(formatRegExp, function(match, index, placeholderFormat) {\n var value = values[parseInt(index, 10) + 1];\n\n return toString(value, placeholderFormat ? placeholderFormat.substring(1) : \"\");\n });\n };\n\n kendo._extractFormat = function(format) {\n if (format.slice(0,3) === \"{0:\") {\n format = format.slice(3, format.length - 1);\n }\n\n return format;\n };\n\n kendo._activeElement = function() {\n try {\n return document.activeElement;\n } catch (e) {\n return document.documentElement.activeElement;\n }\n };\n\n kendo._round = round;\n kendo._outerWidth = function(element, includeMargin) { return $(element).outerWidth(includeMargin || false) || 0; };\n kendo._outerHeight = function(element, includeMargin) { return $(element).outerHeight(includeMargin || false) || 0; };\n kendo.toString = toString;\n})();\n\n\n(function() {\n var nonBreakingSpaceRegExp = /\\u00A0/g,\n spaceRegExp = /\\s/g,\n exponentRegExp = /[eE][\\-+]?[0-9]+/,\n shortTimeZoneRegExp = /[+|\\-]\\d{1,2}/,\n longTimeZoneRegExp = /[+|\\-]\\d{1,2}:?\\d{2}/,\n dateRegExp = /^\\/Date\\((.*?)\\)\\/$/,\n offsetRegExp = /[+-]\\d*/,\n FORMATS_SEQUENCE = [ [], [ \"G\", \"g\", \"F\" ], [ \"D\", \"d\", \"y\", \"m\", \"T\", \"t\" ] ],\n STANDARD_FORMATS = [\n [\n \"yyyy-MM-ddTHH:mm:ss.fffffffzzz\",\n \"yyyy-MM-ddTHH:mm:ss.fffffff\",\n \"yyyy-MM-ddTHH:mm:ss.fffzzz\",\n \"yyyy-MM-ddTHH:mm:ss.fff\",\n \"ddd MMM dd yyyy HH:mm:ss\",\n \"yyyy-MM-ddTHH:mm:sszzz\",\n \"yyyy-MM-ddTHH:mmzzz\",\n \"yyyy-MM-ddTHH:mmzz\",\n \"yyyy-MM-ddTHH:mm:ss\",\n \"yyyy-MM-dd HH:mm:ss\",\n \"yyyy/MM/dd HH:mm:ss\"\n ], [\n \"yyyy-MM-ddTHH:mm\",\n \"yyyy-MM-dd HH:mm\",\n \"yyyy/MM/dd HH:mm\"\n ], [\n \"yyyy/MM/dd\",\n \"yyyy-MM-dd\",\n \"HH:mm:ss\",\n \"HH:mm\"\n ]\n ],\n numberRegExp = {\n 2: /^\\d{1,2}/,\n 3: /^\\d{1,3}/,\n 4: /^\\d{4}/\n },\n objectToString = {}.toString;\n\n function outOfRange(value, start, end) {\n return !(value >= start && value <= end);\n }\n\n function designatorPredicate(designator) {\n return designator.charAt(0);\n }\n\n function mapDesignators(designators) {\n return $.map(designators, designatorPredicate);\n }\n\n //if date's day is different than the typed one - adjust\n function adjustDST(date, hours) {\n if (!hours && date.getHours() === 23) {\n date.setHours(date.getHours() + 2);\n }\n }\n\n function lowerArray(data) {\n var idx = 0,\n length = data.length,\n array = [];\n\n for (; idx < length; idx++) {\n array[idx] = (data[idx] + \"\").toLowerCase();\n }\n\n return array;\n }\n\n function lowerLocalInfo(localInfo) {\n var newLocalInfo = {}, property;\n\n for (property in localInfo) {\n newLocalInfo[property] = lowerArray(localInfo[property]);\n }\n\n return newLocalInfo;\n }\n\n function parseExact(value, format, culture, strict) {\n if (!value) {\n return null;\n }\n\n var lookAhead = function(match) {\n var i = 0;\n while (format[idx] === match) {\n i++;\n idx++;\n }\n if (i > 0) {\n idx -= 1;\n }\n return i;\n },\n getNumber = function(size) {\n var rg = numberRegExp[size] || new RegExp('^\\\\d{1,' + size + '}'),\n match = value.substr(valueIdx, size).match(rg);\n\n if (match) {\n match = match[0];\n valueIdx += match.length;\n return parseInt(match, 10);\n }\n return null;\n },\n getIndexByName = function(names, lower) {\n var i = 0,\n length = names.length,\n name, nameLength,\n matchLength = 0,\n matchIdx = 0,\n subValue;\n\n for (; i < length; i++) {\n name = names[i];\n nameLength = name.length;\n subValue = value.substr(valueIdx, nameLength);\n\n if (lower) {\n subValue = subValue.toLowerCase();\n }\n\n if (subValue == name && nameLength > matchLength) {\n matchLength = nameLength;\n matchIdx = i;\n }\n }\n\n if (matchLength) {\n valueIdx += matchLength;\n return matchIdx + 1;\n }\n\n return null;\n },\n checkLiteral = function() {\n var result = false;\n if (value.charAt(valueIdx) === format[idx]) {\n valueIdx++;\n result = true;\n }\n return result;\n },\n calendar = culture.calendars.standard,\n year = null,\n month = null,\n day = null,\n hours = null,\n minutes = null,\n seconds = null,\n milliseconds = null,\n idx = 0,\n valueIdx = 0,\n literal = false,\n date = new Date(),\n twoDigitYearMax = calendar.twoDigitYearMax || 2029,\n defaultYear = date.getFullYear(),\n ch, count, length, pattern,\n pmHour, UTC, matches,\n amDesignators, pmDesignators,\n hoursOffset, minutesOffset,\n hasTime, match;\n\n if (!format) {\n format = \"d\"; //shord date format\n }\n\n //if format is part of the patterns get real format\n pattern = calendar.patterns[format];\n if (pattern) {\n format = pattern;\n }\n\n format = format.split(\"\");\n length = format.length;\n\n for (; idx < length; idx++) {\n ch = format[idx];\n\n if (literal) {\n if (ch === \"'\") {\n literal = false;\n } else {\n checkLiteral();\n }\n } else {\n if (ch === \"d\") {\n count = lookAhead(\"d\");\n if (!calendar._lowerDays) {\n calendar._lowerDays = lowerLocalInfo(calendar.days);\n }\n\n if (day !== null && count > 2) {\n continue;\n }\n\n day = count < 3 ? getNumber(2) : getIndexByName(calendar._lowerDays[count == 3 ? \"namesAbbr\" : \"names\"], true);\n\n if (day === null || outOfRange(day, 1, 31)) {\n return null;\n }\n } else if (ch === \"M\") {\n count = lookAhead(\"M\");\n if (!calendar._lowerMonths) {\n calendar._lowerMonths = lowerLocalInfo(calendar.months);\n }\n month = count < 3 ? getNumber(2) : getIndexByName(calendar._lowerMonths[count == 3 ? 'namesAbbr' : 'names'], true);\n\n if (month === null || outOfRange(month, 1, 12)) {\n return null;\n }\n month -= 1; //because month is zero based\n } else if (ch === \"y\") {\n count = lookAhead(\"y\");\n year = getNumber(count);\n\n if (year === null) {\n return null;\n }\n\n if (count == 2) {\n if (typeof twoDigitYearMax === \"string\") {\n twoDigitYearMax = defaultYear + parseInt(twoDigitYearMax, 10);\n }\n\n year = (defaultYear - defaultYear % 100) + year;\n if (year > twoDigitYearMax) {\n year -= 100;\n }\n }\n } else if (ch === \"h\" ) {\n lookAhead(\"h\");\n hours = getNumber(2);\n if (hours == 12) {\n hours = 0;\n }\n if (hours === null || outOfRange(hours, 0, 11)) {\n return null;\n }\n } else if (ch === \"H\") {\n lookAhead(\"H\");\n hours = getNumber(2);\n if (hours === null || outOfRange(hours, 0, 23)) {\n return null;\n }\n } else if (ch === \"m\") {\n lookAhead(\"m\");\n minutes = getNumber(2);\n if (minutes === null || outOfRange(minutes, 0, 59)) {\n return null;\n }\n } else if (ch === \"s\") {\n lookAhead(\"s\");\n seconds = getNumber(2);\n if (seconds === null || outOfRange(seconds, 0, 59)) {\n return null;\n }\n } else if (ch === \"f\") {\n count = lookAhead(\"f\");\n\n match = value.substr(valueIdx, count).match(numberRegExp[3]);\n milliseconds = getNumber(count); //move value index position\n\n if (milliseconds !== null) {\n milliseconds = parseFloat(\"0.\" + match[0], 10);\n milliseconds = kendo._round(milliseconds, 3);\n milliseconds *= 1000;\n }\n\n if (milliseconds === null || outOfRange(milliseconds, 0, 999)) {\n return null;\n }\n\n } else if (ch === \"t\") {\n count = lookAhead(\"t\");\n amDesignators = calendar.AM;\n pmDesignators = calendar.PM;\n\n if (count === 1) {\n amDesignators = mapDesignators(amDesignators);\n pmDesignators = mapDesignators(pmDesignators);\n }\n\n pmHour = getIndexByName(pmDesignators);\n if (!pmHour && !getIndexByName(amDesignators)) {\n return null;\n }\n }\n else if (ch === \"z\") {\n UTC = true;\n count = lookAhead(\"z\");\n\n if (value.substr(valueIdx, 1) === \"Z\") {\n checkLiteral();\n continue;\n }\n\n matches = value.substr(valueIdx, 6)\n .match(count > 2 ? longTimeZoneRegExp : shortTimeZoneRegExp);\n\n if (!matches) {\n return null;\n }\n\n matches = matches[0].split(\":\");\n\n hoursOffset = matches[0];\n minutesOffset = matches[1];\n\n if (!minutesOffset && hoursOffset.length > 3) { //(+|-)[hh][mm] format is used\n valueIdx = hoursOffset.length - 2;\n minutesOffset = hoursOffset.substring(valueIdx);\n hoursOffset = hoursOffset.substring(0, valueIdx);\n }\n\n hoursOffset = parseInt(hoursOffset, 10);\n if (outOfRange(hoursOffset, -12, 13)) {\n return null;\n }\n\n if (count > 2) {\n minutesOffset = matches[0][0] + minutesOffset;\n minutesOffset = parseInt(minutesOffset, 10);\n if (isNaN(minutesOffset) || outOfRange(minutesOffset, -59, 59)) {\n return null;\n }\n }\n } else if (ch === \"'\") {\n literal = true;\n checkLiteral();\n } else if (!checkLiteral()) {\n return null;\n }\n }\n }\n\n // if more characters follow, assume wrong format\n // https://github.com/telerik/kendo-ui-core/issues/3476\n if (strict && !/^\\s*$/.test(value.substr(valueIdx))) {\n return null;\n }\n\n hasTime = hours !== null || minutes !== null || seconds || null;\n\n if (year === null && month === null && day === null && hasTime) {\n year = defaultYear;\n month = date.getMonth();\n day = date.getDate();\n } else {\n if (year === null) {\n year = defaultYear;\n }\n\n if (day === null) {\n day = 1;\n }\n }\n\n if (pmHour && hours < 12) {\n hours += 12;\n }\n\n if (UTC) {\n if (hoursOffset) {\n hours += -hoursOffset;\n }\n\n if (minutesOffset) {\n minutes += -minutesOffset;\n }\n\n value = new Date(Date.UTC(year, month, day, hours, minutes, seconds, milliseconds));\n } else {\n value = new Date(year, month, day, hours, minutes, seconds, milliseconds);\n adjustDST(value, hours);\n }\n\n if (year < 100) {\n value.setFullYear(year);\n }\n\n if (value.getDate() !== day && UTC === undefined) {\n return null;\n }\n\n return value;\n }\n\n function parseMicrosoftFormatOffset(offset) {\n var sign = offset.substr(0, 1) === \"-\" ? -1 : 1;\n\n offset = offset.substring(1);\n offset = (parseInt(offset.substr(0, 2), 10) * 60) + parseInt(offset.substring(2), 10);\n\n return sign * offset;\n }\n\n function getDefaultFormats(culture) {\n var length = math.max(FORMATS_SEQUENCE.length, STANDARD_FORMATS.length);\n var calendar = culture.calendar || culture.calendars.standard;\n var patterns = calendar.patterns;\n var cultureFormats, formatIdx, idx;\n var formats = [];\n\n for (idx = 0; idx < length; idx++) {\n cultureFormats = FORMATS_SEQUENCE[idx];\n for (formatIdx = 0; formatIdx < cultureFormats.length; formatIdx++) {\n formats.push(patterns[cultureFormats[formatIdx]]);\n }\n formats = formats.concat(STANDARD_FORMATS[idx]);\n }\n\n return formats;\n }\n\n function internalParseDate(value, formats, culture, strict) {\n if (objectToString.call(value) === \"[object Date]\") {\n return value;\n }\n\n var idx = 0;\n var date = null;\n var length;\n var tzoffset;\n\n if (value && value.indexOf(\"/D\") === 0) {\n date = dateRegExp.exec(value);\n if (date) {\n date = date[1];\n tzoffset = offsetRegExp.exec(date.substring(1));\n\n date = new Date(parseInt(date, 10));\n\n if (tzoffset) {\n tzoffset = parseMicrosoftFormatOffset(tzoffset[0]);\n date = kendo.timezone.apply(date, 0);\n date = kendo.timezone.convert(date, 0, -1 * tzoffset);\n }\n\n return date;\n }\n }\n\n culture = kendo.getCulture(culture);\n\n if (!formats) {\n formats = getDefaultFormats(culture);\n }\n\n formats = isArray(formats) ? formats : [formats];\n length = formats.length;\n\n for (; idx < length; idx++) {\n date = parseExact(value, formats[idx], culture, strict);\n if (date) {\n return date;\n }\n }\n\n return date;\n }\n\n kendo.parseDate = function(value, formats, culture) {\n return internalParseDate(value, formats, culture, false);\n };\n\n kendo.parseExactDate = function(value, formats, culture) {\n return internalParseDate(value, formats, culture, true);\n };\n\n kendo.parseInt = function(value, culture) {\n var result = kendo.parseFloat(value, culture);\n if (result) {\n result = result | 0;\n }\n return result;\n };\n\n kendo.parseFloat = function(value, culture, format) {\n if (!value && value !== 0) {\n return null;\n }\n\n if (typeof value === NUMBER) {\n return value;\n }\n\n value = value.toString();\n culture = kendo.getCulture(culture);\n\n var number = culture.numberFormat,\n percent = number.percent,\n currency = number.currency,\n symbol = currency.symbol,\n percentSymbol = percent.symbol,\n negative = value.indexOf(\"-\"),\n parts, isPercent;\n\n //handle exponential number\n if (exponentRegExp.test(value)) {\n value = parseFloat(value.replace(number[\".\"], \".\"));\n if (isNaN(value)) {\n value = null;\n }\n return value;\n }\n\n if (negative > 0) {\n return null;\n } else {\n negative = negative > -1;\n }\n\n if (value.indexOf(symbol) > -1 || (format && format.toLowerCase().indexOf(\"c\") > -1)) {\n number = currency;\n parts = number.pattern[0].replace(\"$\", symbol).split(\"n\");\n if (value.indexOf(parts[0]) > -1 && value.indexOf(parts[1]) > -1) {\n value = value.replace(parts[0], \"\").replace(parts[1], \"\");\n negative = true;\n }\n } else if (value.indexOf(percentSymbol) > -1) {\n isPercent = true;\n number = percent;\n symbol = percentSymbol;\n }\n\n value = value.replace(\"-\", \"\")\n .replace(symbol, \"\")\n .replace(nonBreakingSpaceRegExp, \" \")\n .split(number[\",\"].replace(nonBreakingSpaceRegExp, \" \")).join(\"\")\n .replace(spaceRegExp, \"\")\n .replace(number[\".\"], \".\");\n\n value = parseFloat(value);\n\n if (isNaN(value)) {\n value = null;\n } else if (negative) {\n value *= -1;\n }\n\n if (value && isPercent) {\n value /= 100;\n }\n\n return value;\n };\n})();\n\n function getShadows(element) {\n var shadow = element.css(kendo.support.transitions.css + \"box-shadow\") || element.css(\"box-shadow\"),\n radius = shadow ? shadow.match(boxShadowRegExp) || [ 0, 0, 0, 0, 0 ] : [ 0, 0, 0, 0, 0 ],\n blur = math.max((+radius[3]), +(radius[4] || 0));\n\n return {\n left: (-radius[1]) + blur,\n right: (+radius[1]) + blur,\n bottom: (+radius[2]) + blur\n };\n }\n\n function wrap(element, autosize) {\n var percentage,\n outerWidth = kendo._outerWidth,\n outerHeight = kendo._outerHeight,\n parent = element.parent(),\n windowOuterWidth = outerWidth(window);\n\n parent.removeClass(\"k-animation-container-sm\");\n\n if (!parent.hasClass(\"k-animation-container\")) {\n var width = element[0].style.width,\n height = element[0].style.height,\n percentWidth = percentRegExp.test(width),\n percentHeight = percentRegExp.test(height),\n forceWidth = element.hasClass(\"k-tooltip\") || element.is(\".k-menu-horizontal.k-context-menu\");\n\n percentage = percentWidth || percentHeight;\n\n if (!percentWidth && (!autosize || (autosize && width) || forceWidth)) { width = autosize ? outerWidth(element) + 1 : outerWidth(element); }\n if (!percentHeight && (!autosize || (autosize && height)) || element.is(\".k-menu-horizontal.k-context-menu\")) { height = outerHeight(element); }\n\n element.wrap(\n $(\"
\")\n .addClass(\"k-animation-container\")\n .attr(\"role\", \"region\")\n .css({\n width: width,\n height: height\n }));\n parent = element.parent();\n\n if (percentage) {\n element.css({\n width: \"100%\",\n height: \"100%\",\n boxSizing: \"border-box\",\n mozBoxSizing: \"border-box\",\n webkitBoxSizing: \"border-box\"\n });\n }\n } else {\n wrapResize(element, autosize);\n }\n\n if (windowOuterWidth < outerWidth(parent)) {\n parent.addClass(\"k-animation-container-sm\");\n\n wrapResize(element, autosize);\n }\n\n return parent;\n }\n\n function wrapResize(element, autosize) {\n var percentage,\n outerWidth = kendo._outerWidth,\n outerHeight = kendo._outerHeight,\n wrapper = element.parent(\".k-animation-container\"),\n wrapperStyle = wrapper[0].style;\n\n if (wrapper.is(\":hidden\")) {\n wrapper.css({\n display: \"\",\n position: \"\"\n });\n }\n\n percentage = percentRegExp.test(wrapperStyle.width) || percentRegExp.test(wrapperStyle.height);\n\n if (!percentage) {\n wrapper.css({\n width: autosize ? outerWidth(element) + 1 : outerWidth(element),\n height: outerHeight(element),\n boxSizing: \"content-box\",\n mozBoxSizing: \"content-box\",\n webkitBoxSizing: \"content-box\"\n });\n }\n }\n\n function deepExtend(destination) {\n var i = 1,\n length = arguments.length;\n\n for (i = 1; i < length; i++) {\n deepExtendOne(destination, arguments[i]);\n }\n\n return destination;\n }\n\n function deepExtendOne(destination, source) {\n var ObservableArray = kendo.data.ObservableArray,\n LazyObservableArray = kendo.data.LazyObservableArray,\n DataSource = kendo.data.DataSource,\n HierarchicalDataSource = kendo.data.HierarchicalDataSource,\n property,\n propValue,\n propType,\n propInit,\n destProp;\n\n for (property in source) {\n propValue = source[property];\n propType = typeof propValue;\n\n if (propType === OBJECT && propValue !== null) {\n propInit = propValue.constructor;\n } else {\n propInit = null;\n }\n\n if (propInit &&\n propInit !== Array && propInit !== ObservableArray && propInit !== LazyObservableArray &&\n propInit !== DataSource && propInit !== HierarchicalDataSource && propInit !== RegExp &&\n (!kendo.isFunction(window.ArrayBuffer) || propInit !== ArrayBuffer) && !(propValue instanceof HTMLElement)) {\n\n if (propValue instanceof Date) {\n destination[property] = new Date(propValue.getTime());\n } else if (isFunction(propValue.clone)) {\n destination[property] = propValue.clone();\n } else {\n destProp = destination[property];\n if (typeof (destProp) === OBJECT) {\n destination[property] = destProp || {};\n } else {\n destination[property] = {};\n }\n deepExtendOne(destination[property], propValue);\n }\n } else if (propType !== UNDEFINED) {\n destination[property] = propValue;\n }\n }\n\n return destination;\n }\n\n function testRx(agent, rxs, dflt) {\n for (var rx in rxs) {\n if (rxs.hasOwnProperty(rx) && rxs[rx].test(agent)) {\n return rx;\n }\n }\n return dflt !== undefined ? dflt : agent;\n }\n\n function toHyphens(str) {\n return str.replace(/([a-z][A-Z])/g, function(g) {\n return g.charAt(0) + '-' + g.charAt(1).toLowerCase();\n });\n }\n\n function toCamelCase(str) {\n return str.replace(/\\-(\\w)/g, function(strMatch, g1) {\n return g1.toUpperCase();\n });\n }\n\n function getComputedStyles(element, properties) {\n var styles = {}, computedStyle;\n\n if (document.defaultView && document.defaultView.getComputedStyle) {\n computedStyle = document.defaultView.getComputedStyle(element, \"\");\n\n if (properties) {\n $.each(properties, function(idx, value) {\n styles[value] = computedStyle.getPropertyValue(value);\n });\n }\n } else {\n computedStyle = element.currentStyle;\n\n if (properties) {\n $.each(properties, function(idx, value) {\n styles[value] = computedStyle[toCamelCase(value)];\n });\n }\n }\n\n if (!kendo.size(styles)) {\n styles = computedStyle;\n }\n\n return styles;\n }\n\n function isScrollable(element) {\n if (element && element.className && typeof(element.className) === \"string\" && element.className.indexOf(\"k-auto-scrollable\") > -1) {\n return true;\n }\n\n var overflow = getComputedStyles(element, [\"overflow\"]).overflow;\n return overflow.indexOf(\"auto\") > -1 || overflow.indexOf(\"scroll\") > -1;\n }\n\n function scrollLeft(element, value) {\n var webkit = support.browser.webkit;\n var mozila = support.browser.mozilla;\n var browserVersion = support.browser.version;\n var el, isRtl;\n\n if (element instanceof $ && value !== undefined) {\n element.each(function(i, e) {\n scrollLeft(e, value);\n });\n\n return;\n } else {\n el = element instanceof $ ? element[0] : element;\n }\n\n if (!el) {\n return;\n }\n\n isRtl = support.isRtl(element);\n\n // After updating browser detection,\n // Test in which if should the Safari browsers go\n if (value !== undefined) {\n if (isRtl && webkit && (browserVersion < 85 || support.browser.safari)) {\n el.scrollLeft = el.scrollWidth - el.clientWidth - value;\n } else if (isRtl && (mozila || webkit) && value > 0) {\n el.scrollLeft = -value;\n } else {\n el.scrollLeft = value;\n }\n } else {\n if (isRtl && webkit && (browserVersion < 85 || support.browser.safari)) {\n return el.scrollWidth - el.clientWidth - el.scrollLeft;\n } else {\n return Math.abs(el.scrollLeft);\n }\n }\n }\n\n (function() {\n support._scrollbar = undefined;\n\n support.scrollbar = function(refresh) {\n if (!isNaN(support._scrollbar) && !refresh) {\n return support._scrollbar;\n } else {\n var div = document.createElement(\"div\"),\n result;\n\n div.style.cssText = \"overflow:scroll;overflow-x:hidden;zoom:1;clear:both;display:block\";\n div.innerHTML = \" \";\n document.body.appendChild(div);\n\n support._scrollbar = result = div.offsetWidth - div.scrollWidth;\n\n document.body.removeChild(div);\n\n return result;\n }\n };\n\n support.isRtl = function(element) {\n return $(element).closest(\".k-rtl\").length > 0;\n };\n\n var table = document.createElement(\"table\");\n\n // Internet Explorer does not support setting the innerHTML of TBODY and TABLE elements\n try {\n table.innerHTML = \"\";\n\n support.tbodyInnerHtml = true;\n } catch (e) {\n support.tbodyInnerHtml = false;\n }\n\n support.touch = \"ontouchstart\" in window;\n\n var docStyle = document.documentElement.style;\n var transitions = support.transitions = false,\n transforms = support.transforms = false,\n elementProto = \"HTMLElement\" in window ? HTMLElement.prototype : [];\n\n support.hasHW3D = (\"WebKitCSSMatrix\" in window && \"m11\" in new window.WebKitCSSMatrix()) || \"MozPerspective\" in docStyle || \"msPerspective\" in docStyle;\n support.cssFlexbox = (\"flexWrap\" in docStyle) || (\"WebkitFlexWrap\" in docStyle) || (\"msFlexWrap\" in docStyle);\n\n each([ \"Moz\", \"webkit\", \"O\", \"ms\" ], function() {\n var prefix = this.toString(),\n hasTransitions = typeof table.style[prefix + \"Transition\"] === STRING;\n\n if (hasTransitions || typeof table.style[prefix + \"Transform\"] === STRING) {\n var lowPrefix = prefix.toLowerCase();\n\n transforms = {\n css: (lowPrefix != \"ms\") ? \"-\" + lowPrefix + \"-\" : \"\",\n prefix: prefix,\n event: (lowPrefix === \"o\" || lowPrefix === \"webkit\") ? lowPrefix : \"\"\n };\n\n if (hasTransitions) {\n transitions = transforms;\n transitions.event = transitions.event ? transitions.event + \"TransitionEnd\" : \"transitionend\";\n }\n\n return false;\n }\n });\n\n table = null;\n\n support.transforms = transforms;\n support.transitions = transitions;\n\n support.devicePixelRatio = window.devicePixelRatio === undefined ? 1 : window.devicePixelRatio;\n\n try {\n support.screenWidth = window.outerWidth || window.screen ? window.screen.availWidth : window.innerWidth;\n support.screenHeight = window.outerHeight || window.screen ? window.screen.availHeight : window.innerHeight;\n } catch (e) {\n //window.outerWidth throws error when in IE showModalDialog.\n support.screenWidth = window.screen.availWidth;\n support.screenHeight = window.screen.availHeight;\n }\n\n support.detectOS = function(ua) {\n var os = false, minorVersion, match = [],\n notAndroidPhone = !/mobile safari/i.test(ua),\n agentRxs = {\n wp: /(Windows Phone(?: OS)?)\\s(\\d+)\\.(\\d+(\\.\\d+)?)/,\n fire: /(Silk)\\/(\\d+)\\.(\\d+(\\.\\d+)?)/,\n android: /(Android|Android.*(?:Opera|Firefox).*?\\/)\\s*(\\d+)\\.?(\\d+(\\.\\d+)?)?/,\n iphone: /(iPhone|iPod).*OS\\s+(\\d+)[\\._]([\\d\\._]+)/,\n ipad: /(iPad).*OS\\s+(\\d+)[\\._]([\\d_]+)/,\n meego: /(MeeGo).+NokiaBrowser\\/(\\d+)\\.([\\d\\._]+)/,\n webos: /(webOS)\\/(\\d+)\\.(\\d+(\\.\\d+)?)/,\n blackberry: /(BlackBerry|BB10).*?Version\\/(\\d+)\\.(\\d+(\\.\\d+)?)/,\n playbook: /(PlayBook).*?Tablet\\s*OS\\s*(\\d+)\\.(\\d+(\\.\\d+)?)/,\n windows: /(MSIE)\\s+(\\d+)\\.(\\d+(\\.\\d+)?)/,\n tizen: /(tizen).*?Version\\/(\\d+)\\.(\\d+(\\.\\d+)?)/i,\n sailfish: /(sailfish).*rv:(\\d+)\\.(\\d+(\\.\\d+)?).*firefox/i,\n ffos: /(Mobile).*rv:(\\d+)\\.(\\d+(\\.\\d+)?).*Firefox/\n },\n osRxs = {\n ios: /^i(phone|pad|pod)$/i,\n android: /^android|fire$/i,\n blackberry: /^blackberry|playbook/i,\n windows: /windows/,\n wp: /wp/,\n flat: /sailfish|ffos|tizen/i,\n meego: /meego/\n },\n formFactorRxs = {\n tablet: /playbook|ipad|fire/i\n },\n browserRxs = {\n omini: /Opera\\sMini/i,\n omobile: /Opera\\sMobi/i,\n firefox: /Firefox|Fennec/i,\n mobilesafari: /version\\/.*safari/i,\n ie: /MSIE|Windows\\sPhone/i,\n chrome: /chrome|crios/i,\n webkit: /webkit/i\n };\n\n for (var agent in agentRxs) {\n if (agentRxs.hasOwnProperty(agent)) {\n match = ua.match(agentRxs[agent]);\n if (match) {\n if (agent == \"windows\" && \"plugins\" in navigator) { return false; } // Break if not Metro/Mobile Windows\n\n os = {};\n os.device = agent;\n os.tablet = testRx(agent, formFactorRxs, false);\n os.browser = testRx(ua, browserRxs, \"default\");\n os.name = testRx(agent, osRxs);\n os[os.name] = true;\n os.majorVersion = match[2];\n os.minorVersion = (match[3] || \"0\").replace(\"_\", \".\");\n minorVersion = os.minorVersion.replace(\".\", \"\").substr(0, 2);\n os.flatVersion = os.majorVersion + minorVersion + (new Array(3 - (minorVersion.length < 3 ? minorVersion.length : 2)).join(\"0\"));\n os.cordova = typeof window.PhoneGap !== UNDEFINED || typeof window.cordova !== UNDEFINED; // Use file protocol to detect appModes.\n os.appMode = window.navigator.standalone || (/file|local|wmapp/).test(window.location.protocol) || os.cordova; // Use file protocol to detect appModes.\n\n if (os.android && (support.devicePixelRatio < 1.5 && os.flatVersion < 400 || notAndroidPhone) && (support.screenWidth > 800 || support.screenHeight > 800)) {\n os.tablet = agent;\n }\n\n break;\n }\n }\n }\n return os;\n };\n\n var mobileOS = support.mobileOS = support.detectOS(navigator.userAgent);\n\n support.wpDevicePixelRatio = mobileOS.wp ? screen.width / 320 : 0;\n\n support.hasNativeScrolling = false;\n\n if (mobileOS.ios || (mobileOS.android && mobileOS.majorVersion > 2) || mobileOS.wp) {\n support.hasNativeScrolling = mobileOS;\n }\n\n support.delayedClick = function() {\n\n // only the mobile devices with touch events do this.\n if (support.touch) {\n // All iOS devices so far (by the time I am writing this, iOS 9.0.2 is the latest),\n // delay their click events.\n if (mobileOS.ios) {\n return true;\n }\n\n if (mobileOS.android) {\n\n if (!support.browser.chrome) { // older webkits and webviews delay the click\n return true;\n }\n\n // from here on, we deal with Chrome on Android.\n if (support.browser.version < 32) {\n return false;\n }\n\n // Chrome 32+ does conditional fast clicks if the view port is not user scalable.\n return !($(\"meta[name=viewport]\").attr(\"content\") || \"\").match(/user-scalable=no/i);\n }\n }\n\n return false;\n };\n\n support.mouseAndTouchPresent = support.touch && !(support.mobileOS.ios || support.mobileOS.android);\n\n support.detectBrowser = function(ua) {\n var browser = false,\n match = [],\n chromiumEdgeMatch = [],\n browserRxs = {\n edge: /(edge)[ \\/]([\\w.]+)/i,\n webkit: /(chrome|crios)[ \\/]([\\w.]+)/i,\n safari: /(webkit)[ \\/]([\\w.]+)/i,\n opera: /(opera)(?:.*version|)[ \\/]([\\w.]+)/i,\n msie: /(msie\\s|trident.*? rv:)([\\w.]+)/i,\n mozilla: /(mozilla)(?:.*? rv:([\\w.]+)|)/i\n };\n\n for (var agent in browserRxs) {\n if (browserRxs.hasOwnProperty(agent)) {\n match = ua.match(browserRxs[agent]);\n if (match) {\n browser = {};\n browser[agent] = true;\n browser[match[1].toLowerCase().split(\" \")[0].split(\"/\")[0]] = true;\n browser.version = parseInt(document.documentMode || match[2], 10);\n\n if (browser.chrome) {\n chromiumEdgeMatch = ua.match(/(edg)[ \\/]([\\w.]+)/i);\n\n if (chromiumEdgeMatch) {\n browser.chromiumEdge = true;\n }\n }\n\n break;\n }\n }\n }\n\n return browser;\n };\n\n support.browser = support.detectBrowser(navigator.userAgent);\n\n if (!mobileOS && support.touch && support.browser.safari) {\n mobileOS = support.mobileOS = {\n ios: true,\n tablet: \"tablet\",\n device: \"ipad\"\n };\n }\n\n support.detectClipboardAccess = function() {\n var commands = {\n copy: document.queryCommandSupported ? document.queryCommandSupported(\"copy\") : false,\n cut: document.queryCommandSupported ? document.queryCommandSupported(\"cut\") : false,\n paste: document.queryCommandSupported ? document.queryCommandSupported(\"paste\") : false\n };\n\n if (support.browser.chrome) {\n //not using queryCommandSupported due to chromium issues 476508 and 542948\n commands.paste = false;\n if (support.browser.version >= 43) {\n commands.copy = true;\n commands.cut = true;\n }\n }\n\n return commands;\n };\n\n support.clipboard = support.detectClipboardAccess();\n\n support.zoomLevel = function() {\n try {\n var browser = support.browser;\n var ie11WidthCorrection = 0;\n var docEl = document.documentElement;\n\n if (browser.msie && browser.version == 11 && docEl.scrollHeight > docEl.clientHeight && !support.touch) {\n ie11WidthCorrection = support.scrollbar();\n }\n\n return support.touch ? (docEl.clientWidth / window.innerWidth) :\n browser.msie && browser.version >= 10 ? (((top || window).document.documentElement.offsetWidth + ie11WidthCorrection) / (top || window).innerWidth) : 1;\n } catch (e) {\n return 1;\n }\n };\n\n (function(browser) {\n // add browser-specific CSS class\n var cssClass = \"\",\n docElement = $(document.documentElement),\n majorVersion = parseInt(browser.version, 10);\n\n if (browser.msie) {\n cssClass = \"ie\";\n } else if (browser.mozilla) {\n cssClass = \"ff\";\n } else if (browser.safari) {\n cssClass = \"safari\";\n } else if (browser.webkit) {\n cssClass = \"webkit\";\n } else if (browser.opera) {\n cssClass = \"opera\";\n } else if (browser.edge) {\n cssClass = \"edge\";\n }\n\n if (cssClass) {\n cssClass = \"k-\" + cssClass + \" k-\" + cssClass + majorVersion;\n }\n if (support.mobileOS) {\n cssClass += \" k-mobile\";\n }\n\n if (!support.cssFlexbox) {\n cssClass += \" k-no-flexbox\";\n }\n\n docElement.addClass(cssClass);\n })(support.browser);\n\n support.eventCapture = document.documentElement.addEventListener;\n\n var input = document.createElement(\"input\");\n\n support.placeholder = \"placeholder\" in input;\n support.propertyChangeEvent = \"onpropertychange\" in input;\n\n support.input = (function() {\n var types = [\"number\", \"date\", \"time\", \"month\", \"week\", \"datetime\", \"datetime-local\"];\n var length = types.length;\n var value = \"test\";\n var result = {};\n var idx = 0;\n var type;\n\n for (;idx < length; idx++) {\n type = types[idx];\n input.setAttribute(\"type\", type);\n input.value = value;\n\n result[type.replace(\"-\", \"\")] = input.type !== \"text\" && input.value !== value;\n }\n\n return result;\n })();\n\n input.style.cssText = \"float:left;\";\n\n support.cssFloat = !!input.style.cssFloat;\n\n input = null;\n\n support.stableSort = (function() {\n // Chrome sort is not stable for more than *10* items\n // IE9+ sort is not stable for than *512* items\n var threshold = 513;\n\n var sorted = [{\n index: 0,\n field: \"b\"\n }];\n\n for (var i = 1; i < threshold; i++) {\n sorted.push({\n index: i,\n field: \"a\"\n });\n }\n\n sorted.sort(function(a, b) {\n return a.field > b.field ? 1 : (a.field < b.field ? -1 : 0);\n });\n\n return sorted[0].index === 1;\n })();\n\n support.matchesSelector = elementProto.webkitMatchesSelector || elementProto.mozMatchesSelector ||\n elementProto.msMatchesSelector || elementProto.oMatchesSelector ||\n elementProto.matchesSelector || elementProto.matches ||\n function( selector ) {\n var nodeList = document.querySelectorAll ? ( this.parentNode || document ).querySelectorAll( selector ) || [] : $(selector),\n i = nodeList.length;\n\n while (i--) {\n if (nodeList[i] == this) {\n return true;\n }\n }\n\n return false;\n };\n\n support.matchMedia = \"matchMedia\" in window;\n\n support.pushState = window.history && window.history.pushState;\n\n support.hashChange = \"onhashchange\" in window;\n\n support.customElements = \"registerElement\" in window.document;\n\n var chrome = support.browser.chrome,\n mobileChrome = support.browser.crios,\n mozilla = support.browser.mozilla,\n safari = support.browser.safari;\n support.msPointers = !chrome && window.MSPointerEvent;\n support.pointers = !chrome && !mobileChrome && !mozilla && !safari && window.PointerEvent;\n support.kineticScrollNeeded = mobileOS && (support.touch || support.msPointers || support.pointers);\n })();\n\n\n function size(obj) {\n var result = 0, key;\n for (key in obj) {\n if (obj.hasOwnProperty(key) && key != \"toJSON\") { // Ignore fake IE7 toJSON.\n result++;\n }\n }\n\n return result;\n }\n\n function getOffset(element, type, positioned) {\n if (!type) {\n type = \"offset\";\n }\n\n var offset = element[type]();\n // clone ClientRect object to JS object (jQuery3)\n var result = {\n top: offset.top,\n right: offset.right,\n bottom: offset.bottom,\n left: offset.left\n };\n\n // IE10 touch zoom is living in a separate viewport\n if (support.browser.msie && (support.pointers || support.msPointers) && !positioned) {\n var sign = support.isRtl(element) ? 1 : -1;\n\n result.top -= (window.pageYOffset - (document.documentElement.scrollTop));\n result.left -= (window.pageXOffset + (sign * document.documentElement.scrollLeft));\n }\n\n return result;\n }\n\n var directions = {\n left: { reverse: \"right\" },\n right: { reverse: \"left\" },\n down: { reverse: \"up\" },\n up: { reverse: \"down\" },\n top: { reverse: \"bottom\" },\n bottom: { reverse: \"top\" },\n \"in\": { reverse: \"out\" },\n out: { reverse: \"in\" }\n };\n\n function parseEffects(input) {\n var effects = {};\n\n each((typeof input === \"string\" ? input.split(\" \") : input), function(idx) {\n effects[idx] = this;\n });\n\n return effects;\n }\n\n function fx(element) {\n return new kendo.effects.Element(element);\n }\n\n var effects = {};\n\n $.extend(effects, {\n enabled: true,\n Element: function(element) {\n this.element = $(element);\n },\n\n promise: function(element, options) {\n if (!element.is(\":visible\")) {\n element.css({ display: element.data(\"olddisplay\") || \"block\" }).css(\"display\");\n }\n\n if (options.hide) {\n element.data(\"olddisplay\", element.css(\"display\")).hide();\n }\n\n if (options.init) {\n options.init();\n }\n\n if (options.completeCallback) {\n options.completeCallback(element); // call the external complete callback with the element\n }\n\n element.dequeue();\n },\n\n disable: function() {\n this.enabled = false;\n this.promise = this.promiseShim;\n },\n\n enable: function() {\n this.enabled = true;\n this.promise = this.animatedPromise;\n }\n });\n\n effects.promiseShim = effects.promise;\n\n function prepareAnimationOptions(options, duration, reverse, complete) {\n if (typeof options === STRING) {\n // options is the list of effect names separated by space e.g. animate(element, \"fadeIn slideDown\")\n\n // only callback is provided e.g. animate(element, options, function() {});\n if (isFunction(duration)) {\n complete = duration;\n duration = 400;\n reverse = false;\n }\n\n if (isFunction(reverse)) {\n complete = reverse;\n reverse = false;\n }\n\n if (typeof duration === BOOLEAN) {\n reverse = duration;\n duration = 400;\n }\n\n options = {\n effects: options,\n duration: duration,\n reverse: reverse,\n complete: complete\n };\n }\n\n return extend({\n //default options\n effects: {},\n duration: 400, //jQuery default duration\n reverse: false,\n init: noop,\n teardown: noop,\n hide: false\n }, options, { completeCallback: options.complete, complete: noop }); // Move external complete callback, so deferred.resolve can be always executed.\n\n }\n\n function animate(element, options, duration, reverse, complete) {\n var idx = 0,\n length = element.length,\n instance;\n\n for (; idx < length; idx ++) {\n instance = $(element[idx]);\n instance.queue(function() {\n effects.promise(instance, prepareAnimationOptions(options, duration, reverse, complete));\n });\n }\n\n return element;\n }\n\n function toggleClass(element, classes, options, add) {\n if (classes) {\n classes = classes.split(\" \");\n\n each(classes, function(idx, value) {\n element.toggleClass(value, add);\n });\n }\n\n return element;\n }\n\n if (!(\"kendoAnimate\" in $.fn)) {\n extend($.fn, {\n kendoStop: function(clearQueue, gotoEnd) {\n return this.stop(clearQueue, gotoEnd);\n },\n\n kendoAnimate: function(options, duration, reverse, complete) {\n return animate(this, options, duration, reverse, complete);\n },\n\n kendoAddClass: function(classes, options) {\n return kendo.toggleClass(this, classes, options, true);\n },\n\n kendoRemoveClass: function(classes, options) {\n return kendo.toggleClass(this, classes, options, false);\n },\n kendoToggleClass: function(classes, options, toggle) {\n return kendo.toggleClass(this, classes, options, toggle);\n }\n });\n }\n\n var ampRegExp = /&/g,\n ltRegExp = //g;\n function htmlEncode(value) {\n return (\"\" + value).replace(ampRegExp, \"&\").replace(ltRegExp, \"<\").replace(gtRegExp, \">\").replace(quoteRegExp, \""\").replace(aposRegExp, \"'\");\n }\n\n function unescape(value) {\n var template;\n\n try {\n template = window.decodeURIComponent(value);\n } catch (error) {\n // If the string contains Unicode characters\n // the decodeURIComponent() will throw an error.\n // Therefore: convert to UTF-8 character\n template = value.replace(/%u([\\dA-F]{4})|%([\\dA-F]{2})/gi, function(_, m1, m2) {\n return String.fromCharCode(parseInt(\"0x\" + (m1 || m2), 16));\n });\n }\n\n return template;\n }\n\n var eventTarget = function(e) {\n return e.target;\n };\n\n if (support.touch) {\n\n eventTarget = function(e) {\n var touches = \"originalEvent\" in e ? e.originalEvent.changedTouches : \"changedTouches\" in e ? e.changedTouches : null;\n\n return touches ? document.elementFromPoint(touches[0].clientX, touches[0].clientY) : e.target;\n };\n\n each([\"swipe\", \"swipeLeft\", \"swipeRight\", \"swipeUp\", \"swipeDown\", \"doubleTap\", \"tap\"], function(m, value) {\n $.fn[value] = function(callback) {\n return this.on(value, callback);\n };\n });\n }\n\n if (support.touch) {\n if (!support.mobileOS) {\n support.mousedown = \"mousedown touchstart\";\n support.mouseup = \"mouseup touchend\";\n support.mousemove = \"mousemove touchmove\";\n support.mousecancel = \"mouseleave touchcancel\";\n support.click = \"click\";\n support.resize = \"resize\";\n } else {\n support.mousedown = \"touchstart\";\n support.mouseup = \"touchend\";\n support.mousemove = \"touchmove\";\n support.mousecancel = \"touchcancel\";\n support.click = \"touchend\";\n support.resize = \"orientationchange\";\n }\n } else if (support.pointers) {\n support.mousemove = \"pointermove\";\n support.mousedown = \"pointerdown\";\n support.mouseup = \"pointerup\";\n support.mousecancel = \"pointercancel\";\n support.click = \"pointerup\";\n support.resize = \"orientationchange resize\";\n } else if (support.msPointers) {\n support.mousemove = \"MSPointerMove\";\n support.mousedown = \"MSPointerDown\";\n support.mouseup = \"MSPointerUp\";\n support.mousecancel = \"MSPointerCancel\";\n support.click = \"MSPointerUp\";\n support.resize = \"orientationchange resize\";\n } else {\n support.mousemove = \"mousemove\";\n support.mousedown = \"mousedown\";\n support.mouseup = \"mouseup\";\n support.mousecancel = \"mouseleave\";\n support.click = \"click\";\n support.resize = \"resize\";\n }\n\n var wrapExpression = function(members, paramName) {\n var result = paramName || \"d\",\n index,\n idx,\n length,\n member,\n count = 1;\n\n for (idx = 0, length = members.length; idx < length; idx++) {\n member = members[idx];\n if (member !== \"\") {\n index = member.indexOf(\"[\");\n\n if (index !== 0) {\n if (index == -1) {\n member = \".\" + member;\n } else {\n count++;\n member = \".\" + member.substring(0, index) + \" || {})\" + member.substring(index);\n }\n }\n\n count++;\n result += member + ((idx < length - 1) ? \" || {})\" : \")\");\n }\n }\n return new Array(count).join(\"(\") + result;\n },\n localUrlRe = /^([a-z]+:)?\\/\\//i;\n\n extend(kendo, {\n widgets: [],\n _widgetRegisteredCallbacks: [],\n ui: kendo.ui || {},\n fx: kendo.fx || fx,\n effects: kendo.effects || effects,\n mobile: kendo.mobile || { },\n data: kendo.data || {},\n dataviz: kendo.dataviz || {},\n drawing: kendo.drawing || {},\n spreadsheet: { messages: {} },\n keys: {\n INSERT: 45,\n DELETE: 46,\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n ESC: 27,\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n END: 35,\n HOME: 36,\n SPACEBAR: 32,\n PAGEUP: 33,\n PAGEDOWN: 34,\n F2: 113,\n F10: 121,\n F12: 123,\n NUMPAD_PLUS: 107,\n NUMPAD_MINUS: 109,\n NUMPAD_DOT: 110\n },\n support: kendo.support || support,\n animate: kendo.animate || animate,\n ns: \"\",\n attr: function(value) {\n return \"data-\" + kendo.ns + value;\n },\n getShadows: getShadows,\n wrap: wrap,\n deepExtend: deepExtend,\n getComputedStyles: getComputedStyles,\n isScrollable: isScrollable,\n scrollLeft: scrollLeft,\n size: size,\n toCamelCase: toCamelCase,\n toHyphens: toHyphens,\n getOffset: kendo.getOffset || getOffset,\n parseEffects: kendo.parseEffects || parseEffects,\n toggleClass: kendo.toggleClass || toggleClass,\n directions: kendo.directions || directions,\n Observable: Observable,\n Class: Class,\n Template: Template,\n template: Template.compile.bind(Template),\n render: Template.render.bind(Template),\n stringify: JSON.stringify.bind(JSON),\n eventTarget: eventTarget,\n htmlEncode: htmlEncode,\n unescape: unescape,\n isLocalUrl: function(url) {\n return url && !localUrlRe.test(url);\n },\n\n expr: function(expression, safe, paramName) {\n expression = expression || \"\";\n\n if (typeof safe == STRING) {\n paramName = safe;\n safe = false;\n }\n\n paramName = paramName || \"d\";\n\n if (expression && expression.charAt(0) !== \"[\") {\n expression = \".\" + expression;\n }\n\n if (safe) {\n expression = expression.replace(/\"([^.]*)\\.([^\"]*)\"/g,'\"$1_$DOT$_$2\"');\n expression = expression.replace(/'([^.]*)\\.([^']*)'/g,\"'$1_$DOT$_$2'\");\n expression = wrapExpression(expression.split(\".\"), paramName);\n expression = expression.replace(/_\\$DOT\\$_/g, \".\");\n } else {\n expression = paramName + expression;\n }\n\n return expression;\n },\n\n getter: function(expression, safe) {\n var key = expression + safe;\n return getterCache[key] = getterCache[key] || new Function(\"d\", \"return \" + kendo.expr(expression, safe));\n },\n\n setter: function(expression) {\n return setterCache[expression] = setterCache[expression] || new Function(\"d,value\", kendo.expr(expression) + \"=value\");\n },\n\n accessor: function(expression) {\n return {\n get: kendo.getter(expression),\n set: kendo.setter(expression)\n };\n },\n\n guid: function() {\n var id = \"\", i, random, chars = \"abcdef\";\n\n id += chars[Math.floor(Math.random() * Math.floor(chars.length))];\n\n for (i = 1; i < 32; i++) {\n random = math.random() * 16 | 0;\n\n if (i == 8 || i == 12 || i == 16 || i == 20) {\n id += \"-\";\n }\n id += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);\n }\n\n return id;\n },\n\n roleSelector: function(role) {\n return role.replace(/(\\S+)/g, \"[\" + kendo.attr(\"role\") + \"=$1],\").slice(0, -1);\n },\n\n directiveSelector: function(directives) {\n var selectors = directives.split(\" \");\n\n if (selectors) {\n for (var i = 0; i < selectors.length; i++) {\n if (selectors[i] != \"view\") {\n selectors[i] = selectors[i].replace(/(\\w*)(view|bar|strip|over)$/, \"$1-$2\");\n }\n }\n }\n\n return selectors.join(\" \").replace(/(\\S+)/g, \"kendo-mobile-$1,\").slice(0, -1);\n },\n\n triggeredByInput: function(e) {\n return (/^(label|input|textarea|select)$/i).test(e.target.tagName);\n },\n\n onWidgetRegistered: function(callback) {\n for (var i = 0, len = kendo.widgets.length; i < len; i++) {\n callback(kendo.widgets[i]);\n }\n\n kendo._widgetRegisteredCallbacks.push(callback);\n },\n\n logToConsole: function(message, type) {\n var console = window.console;\n\n if (!kendo.suppressLog && typeof(console) != \"undefined\" && console.log) {\n console[type || \"log\"](message);\n }\n }\n });\n\n var Widget = Observable.extend( {\n init: function(element, options) {\n var that = this;\n\n validatePackage();\n\n that.element = kendo.jQuery(element).handler(that);\n\n that.angular(\"init\", options);\n\n Observable.fn.init.call(that);\n\n var dataSource = options ? options.dataSource : null;\n var props;\n\n if (options) {\n props = (that.componentTypes || {})[(options || {}).componentType];\n }\n\n if (dataSource) {\n // avoid deep cloning the data source\n options = extend({}, options, { dataSource: {} });\n }\n\n options = that.options = extend(true, {}, that.options, that.defaults, props || {}, options);\n\n if (dataSource) {\n options.dataSource = dataSource;\n }\n\n if (!that.element.attr(kendo.attr(\"role\"))) {\n that.element.attr(kendo.attr(\"role\"), (options.name || \"\").toLowerCase());\n }\n\n that.element.data(\"kendo\" + options.prefix + options.name, that);\n\n that.bind(that.events, options);\n },\n\n events: [],\n\n options: {\n prefix: \"\"\n },\n\n _hasBindingTarget: function() {\n return !!this.element[0].kendoBindingTarget;\n },\n\n _tabindex: function(target) {\n target = target || this.wrapper;\n\n var element = this.element,\n TABINDEX = \"tabindex\",\n tabindex = target.attr(TABINDEX) || element.attr(TABINDEX);\n\n element.removeAttr(TABINDEX);\n\n target.attr(TABINDEX, !isNaN(tabindex) ? tabindex : 0);\n },\n\n setOptions: function(options) {\n this._clearCssClasses(options);\n this._setEvents(options);\n $.extend(this.options, options);\n this._applyCssClasses();\n },\n\n _setEvents: function(options) {\n var that = this,\n idx = 0,\n length = that.events.length,\n e;\n\n for (; idx < length; idx ++) {\n e = that.events[idx];\n if (that.options[e] && options[e]) {\n that.unbind(e, that.options[e]);\n if (that._events && that._events[e]) {\n delete that._events[e];\n }\n }\n }\n\n that.bind(that.events, options);\n },\n\n resize: function(force) {\n var size = this.getSize(),\n currentSize = this._size;\n\n if (force || (size.width > 0 || size.height > 0) && (!currentSize || size.width !== currentSize.width || size.height !== currentSize.height)) {\n this._size = size;\n this._resize(size, force);\n this.trigger(\"resize\", size);\n }\n },\n\n getSize: function() {\n return kendo.dimensions(this.element);\n },\n\n size: function(size) {\n if (!size) {\n return this.getSize();\n } else {\n this.setSize(size);\n }\n },\n\n setSize: $.noop,\n _resize: $.noop,\n\n destroy: function() {\n var that = this;\n\n that.element.removeData(\"kendo\" + that.options.prefix + that.options.name);\n that.element.removeData(\"handler\");\n that.unbind();\n },\n _destroy: function() {\n this.destroy();\n },\n angular: function() {},\n\n _muteAngularRebind: function(callback) {\n this._muteRebind = true;\n\n callback.call(this);\n\n this._muteRebind = false;\n },\n\n _applyCssClasses: function(element) {\n var protoOptions = this.__proto__.options,\n options = this.options,\n el = element || this.wrapper || this.element,\n classes = [],\n i, prop, validFill, widgetName;\n\n if (!kendo.cssProperties.propertyDictionary[protoOptions.name]) {\n return;\n }\n\n for (i = 0; i < cssPropertiesNames.length; i++) {\n prop = cssPropertiesNames[i];\n widgetName = this.options._altname || protoOptions.name;\n\n if (protoOptions.hasOwnProperty(prop)) {\n if (prop === \"themeColor\") {\n validFill = kendo.cssProperties.getValidClass({\n widget: widgetName,\n propName: \"fillMode\",\n value: options.fillMode\n });\n\n if (validFill && validFill.length) {\n classes.push(kendo.cssProperties.getValidClass({\n widget: widgetName,\n propName: prop,\n value: options[prop],\n fill: options.fillMode\n }));\n }\n } else {\n classes.push(kendo.cssProperties.getValidClass({\n widget: widgetName,\n propName: prop,\n value: options[prop]\n }));\n }\n }\n }\n\n el.addClass(classes.join(\" \"));\n },\n\n _ariaLabel: function(target) {\n var that = this,\n inputElm = that.element,\n inputId = inputElm.attr(\"id\"),\n labelElm = $(\"label[for=\\\"\" + inputId + \"\\\"]\"),\n ariaLabel = inputElm.attr(ARIA_LABEL),\n ariaLabelledBy = inputElm.attr(ARIA_LABELLEDBY),\n labelId;\n\n if (target[0] === inputElm[0]) {\n return;\n }\n\n if (ariaLabel) {\n target.attr(ARIA_LABEL, ariaLabel);\n } else if (ariaLabelledBy) {\n target.attr(ARIA_LABELLEDBY, ariaLabelledBy);\n } else if (labelElm.length) {\n labelId = labelElm.attr(\"id\") || that._generateLabelId(labelElm, inputId || kendo.guid());\n target.attr(ARIA_LABELLEDBY, labelId);\n }\n },\n\n _clearCssClasses: function(newOptions, element) {\n var protoOptions = this.__proto__.options,\n currentOptions = this.options,\n el = element || this.wrapper || this.element,\n i, prop, widgetName;\n\n if (!kendo.cssProperties.propertyDictionary[protoOptions.name]) {\n return;\n }\n\n for (i = 0; i < cssPropertiesNames.length; i++) {\n prop = cssPropertiesNames[i];\n widgetName = this.options._altname || protoOptions.name;\n\n if (protoOptions.hasOwnProperty(prop) && newOptions.hasOwnProperty(prop)) {\n if (prop === \"themeColor\") {\n el.removeClass(kendo.cssProperties.getValidClass({\n widget: widgetName,\n propName: prop,\n value: currentOptions[prop],\n fill: currentOptions.fillMode\n }));\n } else {\n if (prop === \"fillMode\") {\n el.removeClass(kendo.cssProperties.getValidClass({\n widget: widgetName,\n propName: \"themeColor\",\n value: currentOptions.themeColor,\n fill: currentOptions.fillMode\n }));\n }\n\n el.removeClass(kendo.cssProperties.getValidClass({\n widget: widgetName,\n propName: prop,\n value: currentOptions[prop]\n }));\n }\n }\n }\n },\n\n _generateLabelId: function(label, inputId) {\n var labelId = inputId + LABELIDPART;\n\n label.attr(\"id\", labelId);\n\n return labelId;\n },\n });\n\n var DataBoundWidget = Widget.extend({\n // Angular consumes these.\n dataItems: function() {\n return this.dataSource.flatView();\n },\n\n _angularItems: function(cmd) {\n var that = this;\n that.angular(cmd, function() {\n return {\n elements: that.items(),\n data: $.map(that.dataItems(), function(dataItem) {\n return { dataItem: dataItem };\n })\n };\n });\n }\n });\n\n kendo.dimensions = function(element, dimensions) {\n var domElement = element[0];\n\n if (dimensions) {\n element.css(dimensions);\n }\n\n return { width: domElement.offsetWidth, height: domElement.offsetHeight };\n };\n\n kendo.notify = noop;\n\n var templateRegExp = /template$/i,\n jsonRegExp = /^\\s*(?:\\{(?:.|\\r\\n|\\n)*\\}|\\[(?:.|\\r\\n|\\n)*\\])\\s*$/,\n jsonFormatRegExp = /^\\{(\\d+)(:[^\\}]+)?\\}|^\\[[A-Za-z_]+\\]$/,\n dashRegExp = /([A-Z])/g;\n\n function parseOption(element, option) {\n var value;\n\n if (option.indexOf(\"data\") === 0) {\n option = option.substring(4);\n option = option.charAt(0).toLowerCase() + option.substring(1);\n }\n\n option = option.replace(dashRegExp, \"-$1\");\n value = element.getAttribute(\"data-\" + kendo.ns + option);\n\n if (value === null) {\n value = undefined;\n } else if (value === \"null\") {\n value = null;\n } else if (value === \"true\") {\n value = true;\n } else if (value === \"false\") {\n value = false;\n } else if (numberRegExp.test(value) && option != \"mask\" && option != \"format\") {\n value = parseFloat(value);\n } else if (jsonRegExp.test(value) && !jsonFormatRegExp.test(value)) {\n value = new Function(\"return (\" + value + \")\")();\n }\n\n return value;\n }\n\n function parseOptions(element, options, source) {\n var result = {},\n option,\n value,\n role = element.getAttribute(\"data-\" + kendo.ns + \"role\");\n\n for (option in options) {\n value = parseOption(element, option);\n\n if (value !== undefined) {\n\n if (templateRegExp.test(option) && role != \"drawer\") {\n if (typeof value === \"string\") {\n if ($(\"#\" + value).length) {\n value = kendo.template($(\"#\" + value).html());\n } else if (source) {\n value = kendo.template(source[value]);\n }\n } else {\n value = element.getAttribute(option);\n }\n }\n\n result[option] = value;\n }\n }\n\n return result;\n }\n\n kendo.initWidget = function(element, options, roles) {\n var result,\n option,\n widget,\n idx,\n length,\n role,\n value,\n dataSource,\n fullPath,\n widgetKeyRegExp;\n\n // Preserve backwards compatibility with (element, options, namespace) signature, where namespace was kendo.ui\n if (!roles) {\n roles = kendo.ui.roles;\n } else if (roles.roles) {\n roles = roles.roles;\n }\n\n element = element.nodeType ? element : element[0];\n\n role = element.getAttribute(\"data-\" + kendo.ns + \"role\");\n\n if (!role) {\n return;\n }\n\n fullPath = role.indexOf(\".\") === -1;\n\n // look for any widget that may be already instantiated based on this role.\n // The prefix used is unknown, hence the regexp\n //\n\n if (fullPath) {\n widget = roles[role];\n } else { // full namespace path - like kendo.ui.Widget\n widget = kendo.getter(role)(window);\n }\n\n var data = $(element).data(),\n widgetKey = widget ? \"kendo\" + widget.fn.options.prefix + widget.fn.options.name : \"\";\n\n if (fullPath) {\n widgetKeyRegExp = new RegExp(\"^kendo.*\" + role + \"$\", \"i\");\n } else { // full namespace path - like kendo.ui.Widget\n widgetKeyRegExp = new RegExp(\"^\" + widgetKey + \"$\", \"i\");\n }\n\n for (var key in data) {\n if (key.match(widgetKeyRegExp)) {\n // we have detected a widget of the same kind - save its reference, we will set its options\n if (key === widgetKey) {\n result = data[key];\n } else {\n return data[key];\n }\n }\n }\n\n if (!widget) {\n return;\n }\n\n dataSource = parseOption(element, \"dataSource\");\n\n options = $.extend({}, parseOptions(element, $.extend({}, widget.fn.options, widget.fn.defaults) ), options);\n\n if (dataSource) {\n if (typeof dataSource === STRING) {\n options.dataSource = kendo.getter(dataSource)(window);\n } else {\n options.dataSource = dataSource;\n }\n }\n\n for (idx = 0, length = widget.fn.events.length; idx < length; idx++) {\n option = widget.fn.events[idx];\n\n value = parseOption(element, option);\n\n if (value !== undefined) {\n options[option] = kendo.getter(value)(window);\n }\n }\n\n if (!result) {\n result = new widget(element, options);\n } else if (!$.isEmptyObject(options)) {\n result.setOptions(options);\n }\n\n return result;\n };\n\n kendo.rolesFromNamespaces = function(namespaces) {\n var roles = [],\n idx,\n length;\n\n if (!namespaces[0]) {\n namespaces = [kendo.ui, kendo.dataviz.ui];\n }\n\n for (idx = 0, length = namespaces.length; idx < length; idx ++) {\n roles[idx] = namespaces[idx].roles;\n }\n\n return extend.apply(null, [{}].concat(roles.reverse()));\n };\n\n kendo.init = function(element) {\n var roles = kendo.rolesFromNamespaces(slice.call(arguments, 1));\n\n $(element).find(\"[data-\" + kendo.ns + \"role]\").addBack().each(function() {\n kendo.initWidget(this, {}, roles);\n });\n };\n\n kendo.destroy = function(element) {\n $(element).find(\"[data-\" + kendo.ns + \"role]\").addBack().each(function() {\n var data = $(this).data();\n\n for (var key in data) {\n if (key.indexOf(\"kendo\") === 0 && typeof data[key].destroy === FUNCTION) {\n data[key].destroy();\n }\n }\n });\n };\n\n function containmentComparer(a, b) {\n return $.contains(a, b) ? -1 : 1;\n }\n\n function resizableWidget() {\n var widget = $(this);\n return ($.inArray(widget.attr(\"data-\" + kendo.ns + \"role\"), [\"slider\", \"rangeslider\", \"breadcrumb\"]) > -1) || widget.is(\":visible\");\n }\n\n kendo.resize = function(element, force) {\n var widgets = $(element).find(\"[data-\" + kendo.ns + \"role]\").addBack().filter(resizableWidget);\n\n if (!widgets.length) {\n return;\n }\n\n // sort widgets based on their parent-child relation\n var widgetsArray = $.makeArray(widgets);\n widgetsArray.sort(containmentComparer);\n\n // resize widgets\n $.each(widgetsArray, function() {\n var widget = kendo.widgetInstance($(this));\n if (widget) {\n widget.resize(force);\n }\n });\n };\n\n kendo.parseOptions = parseOptions;\n\n extend(kendo.ui, {\n Widget: Widget,\n DataBoundWidget: DataBoundWidget,\n roles: {},\n progress: function(container, toggle, options) {\n var mask = container.find(\".k-loading-mask\"),\n support = kendo.support,\n browser = support.browser,\n isRtl, leftRight, webkitCorrection, containerScrollLeft, cssClass;\n\n options = $.extend({}, {\n width: \"100%\",\n height: \"100%\",\n top: container.scrollTop(),\n opacity: false\n }, options);\n\n cssClass = options.opacity ? 'k-loading-mask k-opaque' : 'k-loading-mask';\n\n if (toggle) {\n if (!mask.length) {\n isRtl = support.isRtl(container);\n leftRight = isRtl ? \"right\" : \"left\";\n containerScrollLeft = kendo.scrollLeft(container);\n webkitCorrection = browser.webkit ? (!isRtl ? 0 : container[0].scrollWidth - container.width() - 2 * containerScrollLeft) : 0;\n\n mask = $(kendo.format(\"
{1}
\", cssClass, kendo.ui.progress.messages.loading))\n .width(options.width).height(options.height)\n .css(\"top\", options.top)\n .css(leftRight, Math.abs(containerScrollLeft) + webkitCorrection)\n .prependTo(container);\n }\n } else if (mask) {\n mask.remove();\n }\n },\n plugin: function(widget, register, prefix) {\n var name = widget.fn.options.name,\n getter;\n\n register = register || kendo.ui;\n prefix = prefix || \"\";\n\n register[name] = widget;\n\n register.roles[name.toLowerCase()] = widget;\n\n getter = \"getKendo\" + prefix + name;\n name = \"kendo\" + prefix + name;\n\n var widgetEntry = { name: name, widget: widget, prefix: prefix || \"\" };\n kendo.widgets.push(widgetEntry);\n\n for (var i = 0, len = kendo._widgetRegisteredCallbacks.length; i < len; i++) {\n kendo._widgetRegisteredCallbacks[i](widgetEntry);\n }\n\n $.fn[name] = function(options) {\n var value = this,\n args;\n\n if (typeof options === STRING) {\n args = slice.call(arguments, 1);\n\n this.each(function() {\n var widget = $.data(this, name),\n method,\n result;\n\n if (!widget) {\n throw new Error(kendo.format(\"Cannot call method '{0}' of {1} before it is initialized\", options, name));\n }\n\n method = widget[options];\n\n if (typeof method !== FUNCTION) {\n throw new Error(kendo.format(\"Cannot find method '{0}' of {1}\", options, name));\n }\n\n result = method.apply(widget, args);\n\n if (result !== undefined) {\n value = result;\n return false;\n }\n });\n } else {\n this.each(function() {\n return new widget(this, options);\n });\n }\n\n return value;\n };\n\n $.fn[name].widget = widget;\n\n $.fn[getter] = function() {\n return this.data(name);\n };\n }\n });\n\n kendo.ui.progress.messages = {\n loading: \"Loading...\"\n };\n\n var ContainerNullObject = { bind: function() { return this; }, nullObject: true, options: {} };\n\n var MobileWidget = Widget.extend({\n init: function(element, options) {\n Widget.fn.init.call(this, element, options);\n this.element.autoApplyNS();\n this.wrapper = this.element;\n this.element.addClass(\"km-widget\");\n },\n\n destroy: function() {\n Widget.fn.destroy.call(this);\n this.element.kendoDestroy();\n },\n\n options: {\n prefix: \"Mobile\"\n },\n\n events: [],\n\n view: function() {\n var viewElement = this.element.closest(kendo.roleSelector(\"view splitview modalview drawer\"));\n return kendo.widgetInstance(viewElement, kendo.mobile.ui) || ContainerNullObject;\n },\n\n viewHasNativeScrolling: function() {\n var view = this.view();\n return view && view.options.useNativeScrolling;\n },\n\n container: function() {\n var element = this.element.closest(kendo.roleSelector(\"view layout modalview drawer splitview\"));\n return kendo.widgetInstance(element.eq(0), kendo.mobile.ui) || ContainerNullObject;\n }\n });\n\n extend(kendo.mobile, {\n init: function(element) {\n kendo.init(element, kendo.mobile.ui, kendo.ui, kendo.dataviz.ui);\n },\n\n appLevelNativeScrolling: function() {\n return kendo.mobile.application && kendo.mobile.application.options && kendo.mobile.application.options.useNativeScrolling;\n },\n\n roles: {},\n\n ui: {\n Widget: MobileWidget,\n DataBoundWidget: DataBoundWidget.extend(MobileWidget.prototype),\n roles: {},\n plugin: function(widget) {\n kendo.ui.plugin(widget, kendo.mobile.ui, \"Mobile\");\n }\n }\n });\n\n deepExtend(kendo.dataviz, {\n init: function(element) {\n kendo.init(element, kendo.dataviz.ui);\n },\n ui: {\n roles: {},\n themes: {},\n views: [],\n plugin: function(widget) {\n kendo.ui.plugin(widget, kendo.dataviz.ui);\n }\n },\n roles: {}\n });\n\n kendo.touchScroller = function(elements, options) {\n // return the first touch scroller\n if (!options) { options = {}; }\n\n options.useNative = true;\n\n return $(elements).map(function(idx, element) {\n element = $(element);\n if (support.kineticScrollNeeded && kendo.mobile.ui.Scroller && !element.data(\"kendoMobileScroller\")) {\n element.kendoMobileScroller(options);\n return element.data(\"kendoMobileScroller\");\n } else {\n return false;\n }\n })[0];\n };\n\n kendo.preventDefault = function(e) {\n e.preventDefault();\n };\n\n kendo.widgetInstance = function(element, suites) {\n var role = element.data(kendo.ns + \"role\"),\n widgets = [], i, length,\n elementData = element.data(\"kendoView\");\n\n if (role) {\n // HACK!!! mobile view scroller widgets are instantiated on data-role=\"content\" elements. We need to discover them when resizing.\n if (role === \"content\") {\n role = \"scroller\";\n }\n\n // kendoEditorToolbar is not a public plugin, thus it does not exist in kendo.ui.roles.\n // Therefore, this is needed in order to be resized when placed in Kendo Window.\n if (role === \"editortoolbar\") {\n var editorToolbar = element.data(\"kendoEditorToolbar\");\n if (editorToolbar) {\n return editorToolbar;\n }\n }\n\n // kendo.View is not a ui plugin\n\n if (role === \"view\" && elementData) {\n return elementData;\n }\n\n if (suites) {\n if (suites[0]) {\n for (i = 0, length = suites.length; i < length; i ++) {\n widgets.push(suites[i].roles[role]);\n }\n } else {\n widgets.push(suites.roles[role]);\n }\n }\n else {\n widgets = [ kendo.ui.roles[role], kendo.dataviz.ui.roles[role], kendo.mobile.ui.roles[role] ];\n }\n\n if (role.indexOf(\".\") >= 0) {\n widgets = [ kendo.getter(role)(window) ];\n }\n\n for (i = 0, length = widgets.length; i < length; i ++) {\n var widget = widgets[i];\n if (widget) {\n var instance = element.data(\"kendo\" + widget.fn.options.prefix + widget.fn.options.name);\n if (instance) {\n return instance;\n }\n }\n }\n }\n };\n\n kendo.onResize = function(callback) {\n var handler = callback;\n if (support.mobileOS.android) {\n handler = function() { setTimeout(callback, 600); };\n }\n\n $(window).on(support.resize, handler);\n return handler;\n };\n\n kendo.unbindResize = function(callback) {\n $(window).off(support.resize, callback);\n };\n\n kendo.attrValue = function(element, key) {\n return element.data(kendo.ns + key);\n };\n\n kendo.days = {\n Sunday: 0,\n Monday: 1,\n Tuesday: 2,\n Wednesday: 3,\n Thursday: 4,\n Friday: 5,\n Saturday: 6\n };\n\n function focusable(element, isTabIndexNotNaN) {\n var nodeName = element.nodeName.toLowerCase();\n\n return (/input|select|textarea|button|object/.test(nodeName) ?\n !element.disabled :\n nodeName === \"a\" ?\n element.href || isTabIndexNotNaN :\n isTabIndexNotNaN\n ) &&\n visible(element);\n }\n\n function visible(element) {\n return $.expr.pseudos.visible(element) &&\n !$(element).parents().addBack().filter(function() {\n return $.css(this,\"visibility\") === \"hidden\";\n }).length;\n }\n\n $.extend($.expr.pseudos, {\n kendoFocusable: function(element) {\n var idx = $.attr(element, \"tabindex\");\n return focusable(element, !isNaN(idx) && idx > -1);\n }\n });\n\n var MOUSE_EVENTS = [\"mousedown\", \"mousemove\", \"mouseenter\", \"mouseleave\", \"mouseover\", \"mouseout\", \"mouseup\", \"click\"];\n var EXCLUDE_BUST_CLICK_SELECTOR = \"label, input, [data-rel=external]\";\n\n var MouseEventNormalizer = {\n setupMouseMute: function() {\n var idx = 0,\n length = MOUSE_EVENTS.length,\n element = document.documentElement;\n\n if (MouseEventNormalizer.mouseTrap || !support.eventCapture) {\n return;\n }\n\n MouseEventNormalizer.mouseTrap = true;\n\n MouseEventNormalizer.bustClick = false;\n MouseEventNormalizer.captureMouse = false;\n\n var handler = function(e) {\n if (MouseEventNormalizer.captureMouse) {\n if (e.type === \"click\") {\n if (MouseEventNormalizer.bustClick && !$(e.target).is(EXCLUDE_BUST_CLICK_SELECTOR)) {\n e.preventDefault();\n e.stopPropagation();\n }\n } else {\n e.stopPropagation();\n }\n }\n };\n\n for (; idx < length; idx++) {\n element.addEventListener(MOUSE_EVENTS[idx], handler, true);\n }\n },\n\n muteMouse: function(e) {\n MouseEventNormalizer.captureMouse = true;\n if (e.data.bustClick) {\n MouseEventNormalizer.bustClick = true;\n }\n clearTimeout(MouseEventNormalizer.mouseTrapTimeoutID);\n },\n\n unMuteMouse: function() {\n clearTimeout(MouseEventNormalizer.mouseTrapTimeoutID);\n MouseEventNormalizer.mouseTrapTimeoutID = setTimeout(function() {\n MouseEventNormalizer.captureMouse = false;\n MouseEventNormalizer.bustClick = false;\n }, 400);\n }\n };\n\n var eventMap = {\n down: \"touchstart mousedown\",\n move: \"mousemove touchmove\",\n up: \"mouseup touchend touchcancel\",\n cancel: \"mouseleave touchcancel\"\n };\n\n if (support.touch && (support.mobileOS.ios || support.mobileOS.android)) {\n eventMap = {\n down: \"touchstart\",\n move: \"touchmove\",\n up: \"touchend touchcancel\",\n cancel: \"touchcancel\"\n };\n } else if (support.pointers) {\n eventMap = {\n down: \"pointerdown\",\n move: \"pointermove\",\n up: \"pointerup\",\n cancel: \"pointercancel pointerleave\"\n };\n } else if (support.msPointers) {\n eventMap = {\n down: \"MSPointerDown\",\n move: \"MSPointerMove\",\n up: \"MSPointerUp\",\n cancel: \"MSPointerCancel MSPointerLeave\"\n };\n }\n\n if (support.msPointers && !(\"onmspointerenter\" in window)) { // IE10\n // Create MSPointerEnter/MSPointerLeave events using mouseover/out and event-time checks\n $.each({\n MSPointerEnter: \"MSPointerOver\",\n MSPointerLeave: \"MSPointerOut\"\n }, function( orig, fix ) {\n $.event.special[ orig ] = {\n delegateType: fix,\n bindType: fix,\n\n handle: function( event ) {\n var ret,\n target = this,\n related = event.relatedTarget,\n handleObj = event.handleObj;\n\n // For mousenter/leave call the handler if related is outside the target.\n // NB: No relatedTarget if the mouse left/entered the browser window\n if ( !related || (related !== target && !$.contains( target, related )) ) {\n event.type = handleObj.origType;\n ret = handleObj.handler.apply( this, arguments );\n event.type = fix;\n }\n return ret;\n }\n };\n });\n }\n\n\n var getEventMap = function(e) { return (eventMap[e] || e); },\n eventRegEx = /([^ ]+)/g;\n\n kendo.applyEventMap = function(events, ns) {\n events = events.replace(eventRegEx, getEventMap);\n\n if (ns) {\n events = events.replace(eventRegEx, \"$1.\" + ns);\n }\n\n return events;\n };\n\n kendo.keyDownHandler = function(e, widget) {\n var events = widget._events.kendoKeydown;\n\n if (!events) {\n return true;\n }\n\n events = events.slice();\n e.sender = widget;\n e.preventKendoKeydown = false;\n for (var idx = 0, length = events.length; idx < length; idx++) {\n events[idx].call(widget, e);\n }\n\n return !e.preventKendoKeydown;\n };\n\n var on = $.fn.on;\n\n function kendoJQuery(selector, context) {\n return new kendoJQuery.fn.init(selector, context);\n }\n\n noDepricateExtend(true, kendoJQuery, $);\n\n kendoJQuery.fn = kendoJQuery.prototype = new $();\n\n kendoJQuery.fn.constructor = kendoJQuery;\n\n kendoJQuery.fn.init = function(selector, context) {\n if (context && context instanceof $ && !(context instanceof kendoJQuery)) {\n context = kendoJQuery(context);\n }\n\n return $.fn.init.call(this, selector, context, rootjQuery);\n };\n\n kendoJQuery.fn.init.prototype = kendoJQuery.fn;\n\n var rootjQuery = kendoJQuery(document);\n\n extend(kendoJQuery.fn, {\n handler: function(handler) {\n this.data(\"handler\", handler);\n return this;\n },\n\n autoApplyNS: function(ns) {\n this.data(\"kendoNS\", ns || kendo.guid());\n return this;\n },\n\n on: function() {\n var that = this,\n ns = that.data(\"kendoNS\");\n\n // support for event map signature\n if (arguments.length === 1) {\n return on.call(that, arguments[0]);\n }\n\n var context = that,\n args = slice.call(arguments);\n\n if (typeof args[args.length - 1] === UNDEFINED) {\n args.pop();\n }\n\n var callback = args[args.length - 1],\n events = kendo.applyEventMap(args[0], ns);\n\n // setup mouse trap\n if (support.mouseAndTouchPresent && events.search(/mouse|click/) > -1 && this[0] !== document.documentElement) {\n MouseEventNormalizer.setupMouseMute();\n\n var selector = args.length === 2 ? null : args[1],\n bustClick = events.indexOf(\"click\") > -1 && events.indexOf(\"touchend\") > -1;\n\n on.call(this,\n {\n touchstart: MouseEventNormalizer.muteMouse,\n touchend: MouseEventNormalizer.unMuteMouse\n },\n selector,\n {\n bustClick: bustClick\n });\n }\n\n if (arguments[0].indexOf(\"keydown\") !== -1 && args[1] && args[1].options) {\n args[0] = events;\n var widget = args[1];\n var keyDownCallBack = args[args.length - 1];\n args[args.length - 1] = function(e) {\n if (kendo.keyDownHandler(e, widget)) {\n return keyDownCallBack.apply(this, [e]);\n }\n };\n on.apply(that, args);\n return that;\n }\n\n if (typeof callback === STRING) {\n context = that.data(\"handler\");\n callback = context[callback];\n\n args[args.length - 1] = function(e) {\n callback.call(context, e);\n };\n }\n\n args[0] = events;\n\n on.apply(that, args);\n\n return that;\n },\n\n kendoDestroy: function(ns) {\n ns = ns || this.data(\"kendoNS\");\n\n if (ns) {\n this.off(\".\" + ns);\n }\n\n return this;\n }\n });\n\n kendo.jQuery = kendoJQuery;\n kendo.eventMap = eventMap;\n\n kendo.timezone = (function() {\n var months = { Jan: 0, Feb: 1, Mar: 2, Apr: 3, May: 4, Jun: 5, Jul: 6, Aug: 7, Sep: 8, Oct: 9, Nov: 10, Dec: 11 };\n var days = { Sun: 0, Mon: 1, Tue: 2, Wed: 3, Thu: 4, Fri: 5, Sat: 6 };\n\n function ruleToDate(year, rule) {\n var date;\n var targetDay;\n var ourDay;\n var month = rule[3];\n var on = rule[4];\n var time = rule[5];\n var cache = rule[8];\n\n if (!cache) {\n rule[8] = cache = {};\n }\n\n if (cache[year]) {\n return cache[year];\n }\n\n if (!isNaN(on)) {\n date = new Date(Date.UTC(year, months[month], on, time[0], time[1], time[2], 0));\n } else if (on.indexOf(\"last\") === 0) {\n date = new Date(Date.UTC(year, months[month] + 1, 1, time[0] - 24, time[1], time[2], 0));\n\n targetDay = days[on.substr(4, 3)];\n ourDay = date.getUTCDay();\n\n date.setUTCDate(date.getUTCDate() + targetDay - ourDay - (targetDay > ourDay ? 7 : 0));\n } else if (on.indexOf(\">=\") >= 0) {\n date = new Date(Date.UTC(year, months[month], on.substr(5), time[0], time[1], time[2], 0));\n\n targetDay = days[on.substr(0, 3)];\n ourDay = date.getUTCDay();\n\n date.setUTCDate(date.getUTCDate() + targetDay - ourDay + (targetDay < ourDay ? 7 : 0));\n } else if (on.indexOf(\"<=\") >= 0) {\n date = new Date(Date.UTC(year, months[month], on.substr(5), time[0], time[1], time[2], 0));\n\n targetDay = days[on.substr(0, 3)];\n ourDay = date.getUTCDay();\n\n date.setUTCDate(date.getUTCDate() + targetDay - ourDay - (targetDay > ourDay ? 7 : 0));\n }\n\n return cache[year] = date;\n }\n\n function findRule(utcTime, rules, zone) {\n rules = rules[zone];\n\n if (!rules) {\n var time = zone.split(\":\");\n var offset = 0;\n\n if (time.length > 1) {\n offset = time[0] * 60 + Number(time[1]);\n }\n\n return [-1000000, 'max', '-', 'Jan', 1, [0, 0, 0], offset, '-'];\n }\n\n var year = new Date(utcTime).getUTCFullYear();\n\n rules = jQuery.grep(rules, function(rule) {\n var from = rule[0];\n var to = rule[1];\n\n return from <= year && (to >= year || (from == year && to == \"only\") || to == \"max\");\n });\n\n rules.push(utcTime);\n\n rules.sort(function(a, b) {\n if (typeof a != \"number\") {\n a = Number(ruleToDate(year, a));\n }\n\n if (typeof b != \"number\") {\n b = Number(ruleToDate(year, b));\n }\n\n return a - b;\n });\n\n var rule = rules[jQuery.inArray(utcTime, rules) - 1] || rules[rules.length - 1];\n\n return isNaN(rule) ? rule : null;\n }\n\n function findZone(utcTime, zones, timezone) {\n var zoneRules = zones[timezone];\n\n if (typeof zoneRules === \"string\") {\n zoneRules = zones[zoneRules];\n }\n\n if (!zoneRules) {\n throw new Error('Timezone \"' + timezone + '\" is either incorrect, or kendo.timezones.min.js is not included.');\n }\n\n for (var idx = zoneRules.length - 1; idx >= 0; idx--) {\n var until = zoneRules[idx][3];\n\n if (until && utcTime > until) {\n break;\n }\n }\n\n var zone = zoneRules[idx + 1];\n\n if (!zone) {\n throw new Error('Timezone \"' + timezone + '\" not found on ' + utcTime + \".\");\n }\n\n return zone;\n }\n\n function zoneAndRule(utcTime, zones, rules, timezone) {\n if (typeof utcTime != NUMBER) {\n utcTime = Date.UTC(utcTime.getFullYear(), utcTime.getMonth(),\n utcTime.getDate(), utcTime.getHours(), utcTime.getMinutes(),\n utcTime.getSeconds(), utcTime.getMilliseconds());\n }\n\n var zone = findZone(utcTime, zones, timezone);\n\n return {\n zone: zone,\n rule: findRule(utcTime, rules, zone[1])\n };\n }\n\n function offset(utcTime, timezone) {\n if (timezone == \"Etc/UTC\" || timezone == \"Etc/GMT\") {\n return 0;\n }\n\n var info = zoneAndRule(utcTime, this.zones, this.rules, timezone);\n var zone = info.zone;\n var rule = info.rule;\n\n return kendo.parseFloat(rule ? zone[0] - rule[6] : zone[0]);\n }\n\n function abbr(utcTime, timezone) {\n var info = zoneAndRule(utcTime, this.zones, this.rules, timezone);\n var zone = info.zone;\n var rule = info.rule;\n\n var base = zone[2];\n\n if (base.indexOf(\"/\") >= 0) {\n return base.split(\"/\")[rule && +rule[6] ? 1 : 0];\n } else if (base.indexOf(\"%s\") >= 0) {\n return base.replace(\"%s\", (!rule || rule[7] == \"-\") ? '' : rule[7]);\n }\n\n return base;\n }\n\n function convert(date, fromOffset, toOffset) {\n var tempToOffset = toOffset;\n var diff;\n\n if (typeof fromOffset == STRING) {\n fromOffset = this.offset(date, fromOffset);\n }\n\n if (typeof toOffset == STRING) {\n toOffset = this.offset(date, toOffset);\n }\n\n var fromLocalOffset = date.getTimezoneOffset();\n\n date = new Date(date.getTime() + (fromOffset - toOffset) * 60000);\n\n var toLocalOffset = date.getTimezoneOffset();\n\n if (typeof tempToOffset == STRING) {\n tempToOffset = this.offset(date, tempToOffset);\n }\n\n diff = (toLocalOffset - fromLocalOffset) + (toOffset - tempToOffset);\n\n return new Date(date.getTime() + diff * 60000);\n }\n\n function apply(date, timezone) {\n return this.convert(date, date.getTimezoneOffset(), timezone);\n }\n\n function remove(date, timezone) {\n return this.convert(date, timezone, date.getTimezoneOffset());\n }\n\n function toLocalDate(time) {\n return this.apply(new Date(time), \"Etc/UTC\");\n }\n\n return {\n zones: {},\n rules: {},\n offset: offset,\n convert: convert,\n apply: apply,\n remove: remove,\n abbr: abbr,\n toLocalDate: toLocalDate\n };\n })();\n\n kendo.date = (function() {\n var MS_PER_MINUTE = 60000,\n MS_PER_DAY = 86400000;\n\n function adjustDST(date, hours) {\n if (hours === 0 && date.getHours() === 23) {\n date.setHours(date.getHours() + 2);\n return true;\n }\n\n return false;\n }\n\n function setDayOfWeek(date, day, dir) {\n var hours = date.getHours();\n\n dir = dir || 1;\n day = ((day - date.getDay()) + (7 * dir)) % 7;\n\n date.setDate(date.getDate() + day);\n adjustDST(date, hours);\n }\n\n function dayOfWeek(date, day, dir) {\n date = new Date(date);\n setDayOfWeek(date, day, dir);\n return date;\n }\n\n function firstDayOfMonth(date) {\n return new Date(\n date.getFullYear(),\n date.getMonth(),\n 1\n );\n }\n\n function lastDayOfMonth(date) {\n var last = new Date(date.getFullYear(), date.getMonth() + 1, 0),\n first = firstDayOfMonth(date),\n timeOffset = Math.abs(last.getTimezoneOffset() - first.getTimezoneOffset());\n\n if (timeOffset) {\n last.setHours(first.getHours() + (timeOffset / 60));\n }\n\n return last;\n }\n\n function firstDayOfYear(date) {\n return new Date(date.getFullYear(), 0, 1);\n }\n\n function lastDayOfYear(date) {\n return new Date(date.getFullYear(), 11, 31);\n }\n\n function moveDateToWeekStart(date, weekStartDay) {\n if (weekStartDay !== 1) {\n return addDays(dayOfWeek(date, weekStartDay, -1), 4);\n }\n\n return addDays(date, (4 - (date.getDay() || 7)));\n }\n\n function calcWeekInYear(date, weekStartDay) {\n var firstWeekInYear = new Date(date.getFullYear(), 0, 1, -6);\n\n var newDate = moveDateToWeekStart(date, weekStartDay);\n\n var diffInMS = newDate.getTime() - firstWeekInYear.getTime();\n\n var days = Math.floor(diffInMS / MS_PER_DAY);\n\n return 1 + Math.floor(days / 7);\n }\n\n function weekInYear(date, weekStartDay) {\n if (weekStartDay === undefined) {\n weekStartDay = kendo.culture().calendar.firstDay;\n }\n\n var prevWeekDate = addDays(date, -7);\n var nextWeekDate = addDays(date, 7);\n\n var weekNumber = calcWeekInYear(date, weekStartDay);\n\n if (weekNumber === 0) {\n return calcWeekInYear(prevWeekDate, weekStartDay) + 1;\n }\n\n if (weekNumber === 53 && calcWeekInYear(nextWeekDate, weekStartDay) > 1) {\n return 1;\n }\n\n return weekNumber;\n }\n\n function getDate(date) {\n date = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);\n adjustDST(date, 0);\n return date;\n }\n\n function toUtcTime(date) {\n return Date.UTC(date.getFullYear(), date.getMonth(),\n date.getDate(), date.getHours(), date.getMinutes(),\n date.getSeconds(), date.getMilliseconds());\n }\n\n function getMilliseconds(date) {\n return toInvariantTime(date).getTime() - getDate(toInvariantTime(date));\n }\n\n function isInTimeRange(value, min, max) {\n var msMin = getMilliseconds(min),\n msMax = getMilliseconds(max),\n msValue;\n\n if (!value || msMin == msMax) {\n return true;\n }\n\n if (min >= max) {\n max += MS_PER_DAY;\n }\n\n msValue = getMilliseconds(value);\n\n if (msMin > msValue) {\n msValue += MS_PER_DAY;\n }\n\n if (msMax < msMin) {\n msMax += MS_PER_DAY;\n }\n\n return msValue >= msMin && msValue <= msMax;\n }\n\n function isInDateRange(value, min, max) {\n var msMin = min.getTime(),\n msMax = max.getTime(),\n msValue;\n\n if (msMin >= msMax) {\n msMax += MS_PER_DAY;\n }\n\n msValue = value.getTime();\n\n return msValue >= msMin && msValue <= msMax;\n }\n\n function addDays(date, offset) {\n var hours = date.getHours();\n date = new Date(date);\n\n setTime(date, offset * MS_PER_DAY);\n adjustDST(date, hours);\n return date;\n }\n\n function setTime(date, milliseconds, ignoreDST) {\n var offset = date.getTimezoneOffset();\n var difference;\n\n date.setTime(date.getTime() + milliseconds);\n\n if (!ignoreDST) {\n difference = date.getTimezoneOffset() - offset;\n date.setTime(date.getTime() + difference * MS_PER_MINUTE);\n }\n }\n\n function setHours(date, time) {\n date = new Date(date.getFullYear(), date.getMonth(), date.getDate(), time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds());\n adjustDST(date, time.getHours());\n return date;\n }\n\n function today() {\n return getDate(new Date());\n }\n\n function isToday(date) {\n return getDate(date).getTime() == today().getTime();\n }\n\n function toInvariantTime(date) {\n var staticDate = new Date(1980, 1, 1, 0, 0, 0);\n\n if (date) {\n staticDate.setHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n }\n\n return staticDate;\n }\n\n function addYear(date, offset) {\n var currentDate = new Date(date);\n\n return new Date(currentDate.setFullYear(currentDate.getFullYear() + offset));\n }\n\n return {\n adjustDST: adjustDST,\n dayOfWeek: dayOfWeek,\n setDayOfWeek: setDayOfWeek,\n getDate: getDate,\n isInDateRange: isInDateRange,\n isInTimeRange: isInTimeRange,\n isToday: isToday,\n nextDay: function(date) {\n return addDays(date, 1);\n },\n previousDay: function(date) {\n return addDays(date, -1);\n },\n toUtcTime: toUtcTime,\n MS_PER_DAY: MS_PER_DAY,\n MS_PER_HOUR: 60 * MS_PER_MINUTE,\n MS_PER_MINUTE: MS_PER_MINUTE,\n setTime: setTime,\n setHours: setHours,\n addDays: addDays,\n today: today,\n toInvariantTime: toInvariantTime,\n firstDayOfMonth: firstDayOfMonth,\n lastDayOfMonth: lastDayOfMonth,\n weekInYear: weekInYear,\n getMilliseconds: getMilliseconds,\n firstDayOfYear: firstDayOfYear,\n lastDayOfYear: lastDayOfYear,\n nextYear: function(date) {\n return addYear(date, 1);\n },\n previousYear: function(date) {\n return addYear(date, -1);\n }\n };\n })();\n\n\n kendo.stripWhitespace = function(element) {\n if (document.createNodeIterator) {\n var iterator = document.createNodeIterator(element, NodeFilter.SHOW_TEXT, function(node) {\n return node.parentNode == element ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;\n }, false);\n\n while (iterator.nextNode()) {\n if (iterator.referenceNode && !iterator.referenceNode.textContent.trim()) {\n iterator.referenceNode.parentNode.removeChild(iterator.referenceNode);\n }\n }\n } else { // IE7/8 support\n for (var i = 0; i < element.childNodes.length; i++) {\n var child = element.childNodes[i];\n\n if (child.nodeType == 3 && !/\\S/.test(child.nodeValue)) {\n element.removeChild(child);\n i--;\n }\n\n if (child.nodeType == 1) {\n kendo.stripWhitespace(child);\n }\n }\n }\n };\n\n var animationFrame = window.requestAnimationFrame ||\n window.webkitRequestAnimationFrame ||\n window.mozRequestAnimationFrame ||\n window.oRequestAnimationFrame ||\n window.msRequestAnimationFrame ||\n function(callback) { setTimeout(callback, 1000 / 60); };\n\n kendo.animationFrame = function(callback) {\n animationFrame.call(window, callback);\n };\n\n var animationQueue = [];\n\n kendo.queueAnimation = function(callback) {\n animationQueue[animationQueue.length] = callback;\n if (animationQueue.length === 1) {\n kendo.runNextAnimation();\n }\n };\n\n kendo.runNextAnimation = function() {\n kendo.animationFrame(function() {\n if (animationQueue[0]) {\n animationQueue.shift()();\n if (animationQueue[0]) {\n kendo.runNextAnimation();\n }\n }\n });\n };\n\n kendo.parseQueryStringParams = function(url) {\n var queryString = url.split('?')[1] || \"\",\n params = {},\n paramParts = queryString.split(/&|=/),\n length = paramParts.length,\n idx = 0;\n\n for (; idx < length; idx += 2) {\n if (paramParts[idx] !== \"\") {\n params[decodeURIComponent(paramParts[idx])] = decodeURIComponent(paramParts[idx + 1]);\n }\n }\n\n return params;\n };\n\n kendo.elementUnderCursor = function(e) {\n if (typeof e.x.client != \"undefined\") {\n return document.elementFromPoint(e.x.client, e.y.client);\n }\n };\n\n kendo.wheelDeltaY = function(jQueryEvent) {\n var e = jQueryEvent.originalEvent,\n deltaY = e.wheelDeltaY,\n delta;\n\n if (e.wheelDelta) { // Webkit and IE\n if (deltaY === undefined || deltaY) { // IE does not have deltaY, thus always scroll (horizontal scrolling is treated as vertical)\n delta = e.wheelDelta;\n }\n } else if (e.detail && e.axis === e.VERTICAL_AXIS) { // Firefox and Opera\n delta = (-e.detail) * 10;\n }\n\n return delta;\n };\n\n kendo.throttle = function(fn, delay) {\n var timeout;\n var lastExecTime = 0;\n\n if (!delay || delay <= 0) {\n return fn;\n }\n\n var throttled = function() {\n var that = this;\n var elapsed = +new Date() - lastExecTime;\n var args = arguments;\n\n function exec() {\n fn.apply(that, args);\n lastExecTime = +new Date();\n }\n\n // first execution\n if (!lastExecTime) {\n return exec();\n }\n\n if (timeout) {\n clearTimeout(timeout);\n }\n\n if (elapsed > delay) {\n exec();\n } else {\n timeout = setTimeout(exec, delay - elapsed);\n }\n };\n\n throttled.cancel = function() {\n clearTimeout(timeout);\n };\n\n return throttled;\n };\n\n\n kendo.caret = function(element, start, end) {\n var rangeElement;\n var isPosition = start !== undefined;\n\n if (end === undefined) {\n end = start;\n }\n\n if (element[0]) {\n element = element[0];\n }\n\n if (isPosition && element.disabled) {\n return;\n }\n\n try {\n if (element.selectionStart !== undefined) {\n if (isPosition) {\n element.focus();\n var mobile = support.mobileOS;\n if (mobile.wp || mobile.android) {// without the timeout the caret is at the end of the input\n setTimeout(function() { element.setSelectionRange(start, end); }, 0);\n }\n else {\n element.setSelectionRange(start, end);\n }\n } else {\n start = [element.selectionStart, element.selectionEnd];\n }\n } else if (document.selection) {\n if ($(element).is(\":visible\")) {\n element.focus();\n }\n\n rangeElement = element.createTextRange();\n\n if (isPosition) {\n rangeElement.collapse(true);\n rangeElement.moveStart(\"character\", start);\n rangeElement.moveEnd(\"character\", end - start);\n rangeElement.select();\n } else {\n var rangeDuplicated = rangeElement.duplicate(),\n selectionStart, selectionEnd;\n\n rangeElement.moveToBookmark(document.selection.createRange().getBookmark());\n rangeDuplicated.setEndPoint('EndToStart', rangeElement);\n selectionStart = rangeDuplicated.text.length;\n selectionEnd = selectionStart + rangeElement.text.length;\n\n start = [selectionStart, selectionEnd];\n }\n }\n } catch (e) {\n /* element is not focused or it is not in the DOM */\n start = [];\n }\n\n return start;\n };\n\n kendo.compileMobileDirective = function(element, scope) {\n var angular = window.angular;\n\n element.attr(\"data-\" + kendo.ns + \"role\", element[0].tagName.toLowerCase().replace('kendo-mobile-', '').replace('-', ''));\n\n angular.element(element).injector().invoke([\"$compile\", function($compile) {\n $compile(element)(scope);\n\n if (!/^\\$(digest|apply)$/.test(scope.$$phase)) {\n scope.$digest();\n }\n }]);\n\n return kendo.widgetInstance(element, kendo.mobile.ui);\n };\n\n kendo.antiForgeryTokens = function() {\n var tokens = { },\n csrf_token = $(\"meta[name=csrf-token],meta[name=_csrf]\").attr(\"content\"),\n csrf_param = $(\"meta[name=csrf-param],meta[name=_csrf_header]\").attr(\"content\");\n\n $(\"input[name^='__RequestVerificationToken']\").each(function() {\n tokens[this.name] = this.value;\n });\n\n if (csrf_param !== undefined && csrf_token !== undefined) {\n tokens[csrf_param] = csrf_token;\n }\n\n return tokens;\n };\n\n kendo.cycleForm = function(form) {\n var firstElement = form.find(\"input, .k-widget, .k-dropdownlist, .k-combobox\").first();\n var lastElement = form.find(\"button, .k-button\").last();\n\n function focus(el) {\n var widget = kendo.widgetInstance(el);\n\n if (widget && widget.focus) {\n widget.focus();\n } else {\n el.trigger(\"focus\");\n }\n }\n\n lastElement.on(\"keydown\", function(e) {\n if (e.keyCode == kendo.keys.TAB && !e.shiftKey) {\n e.preventDefault();\n focus(firstElement);\n }\n });\n\n firstElement.on(\"keydown\", function(e) {\n if (e.keyCode == kendo.keys.TAB && e.shiftKey) {\n e.preventDefault();\n focus(lastElement);\n }\n });\n };\n\n kendo.focusElement = function(element) {\n var scrollTopPositions = [];\n var scrollableParents = element.parentsUntil(\"body\")\n .filter(function(index, element) {\n var computedStyle = kendo.getComputedStyles(element, [\"overflow\"]);\n return computedStyle.overflow !== \"visible\";\n })\n .add(window);\n\n scrollableParents.each(function(index, parent) {\n scrollTopPositions[index] = $(parent).scrollTop();\n });\n\n try {\n //The setActive method does not cause the document to scroll to the active object in the current page\n element[0].setActive();\n } catch (e) {\n element[0].focus();\n }\n\n scrollableParents.each(function(index, parent) {\n $(parent).scrollTop(scrollTopPositions[index]);\n });\n };\n\n kendo.focusNextElement = function() {\n if (document.activeElement) {\n var focussable = $(\":kendoFocusable\");\n var index = focussable.index(document.activeElement);\n\n if (index > -1) {\n var nextElement = focussable[index + 1] || focussable[0];\n nextElement.focus();\n }\n }\n };\n\n kendo.trim = function(value) {\n if (!!value) {\n return value.toString().trim();\n } else {\n return \"\";\n }\n };\n\n kendo.getWidgetFocusableElement = function(element) {\n var nextFocusable = element.closest(\":kendoFocusable\"),\n widgetInstance = kendo.widgetInstance(element),\n target;\n\n if (nextFocusable.length) {\n target = nextFocusable;\n } else if (widgetInstance) {\n target = widgetInstance.options.name === 'Editor' ?\n $(widgetInstance.body) :\n widgetInstance.wrapper.find(\":kendoFocusable\").first();\n } else {\n target = element;\n }\n\n return target;\n };\n\n kendo.addAttribute = function(element, attribute, value) {\n var current = element.attr(attribute) || \"\";\n\n if (current.indexOf(value) < 0) {\n element.attr(attribute, (current + \" \" + value).trim());\n }\n };\n\n kendo.removeAttribute = function(element, attribute, value) {\n var current = element.attr(attribute) || \"\";\n\n element.attr(attribute, current.replace(value, \"\").trim());\n };\n\n kendo.toggleAttribute = function(element, attribute, value) {\n var current = element.attr(attribute) || \"\";\n\n if (current.indexOf(value) < 0) {\n kendo.addAttribute(element, attribute, value);\n } else {\n kendo.removeAttribute(element, attribute, value);\n }\n };\n\n kendo.matchesMedia = function(mediaQuery) {\n var media = kendo._bootstrapToMedia(mediaQuery) || mediaQuery;\n return support.matchMedia && window.matchMedia(media).matches;\n };\n\n kendo._bootstrapToMedia = function(bootstrapMedia) {\n return {\n \"xs\": \"(max-width: 576px)\",\n \"sm\": \"(min-width: 576px)\",\n \"md\": \"(min-width: 768px)\",\n \"lg\": \"(min-width: 992px)\",\n \"xl\": \"(min-width: 1200px)\"\n }[bootstrapMedia];\n };\n\n kendo.fileGroupMap = {\n audio: [\".aif\", \".iff\", \".m3u\", \".m4a\", \".mid\", \".mp3\", \".mpa\", \".wav\", \".wma\", \".ogg\", \".wav\", \".wma\", \".wpl\"],\n video: [\".3g2\", \".3gp\", \".avi\", \".asf\", \".flv\", \".m4u\", \".rm\", \".h264\", \".m4v\", \".mkv\", \".mov\", \".mp4\", \".mpg\",\n \".rm\", \".swf\", \".vob\", \".wmv\"],\n image: [\".ai\", \".dds\", \".heic\", \".jpe\", \"jfif\", \".jif\", \".jp2\", \".jps\", \".eps\", \".bmp\", \".gif\", \".jpeg\",\n \".jpg\", \".png\", \".ps\", \".psd\", \".svg\", \".svgz\", \".tif\", \".tiff\"],\n txt: [\".doc\", \".docx\", \".log\", \".pages\", \".tex\", \".wpd\", \".wps\", \".odt\", \".rtf\", \".text\", \".txt\", \".wks\"],\n presentation: [\".key\", \".odp\", \".pps\", \".ppt\", \".pptx\"],\n data: [\".xlr\", \".xls\", \".xlsx\"],\n programming: [\".tmp\", \".bak\", \".msi\", \".cab\", \".cpl\", \".cur\", \".dll\", \".dmp\", \".drv\", \".icns\", \".ico\", \".link\",\n \".sys\", \".cfg\", \".ini\", \".asp\", \".aspx\", \".cer\", \".csr\", \".css\", \".dcr\", \".htm\", \".html\", \".js\",\n \".php\", \".rss\", \".xhtml\"],\n pdf: [\".pdf\"],\n config: [\".apk\", \".app\", \".bat\", \".cgi\", \".com\", \".exe\", \".gadget\", \".jar\", \".wsf\"],\n zip: [\".7z\", \".cbr\", \".gz\", \".sitx\", \".arj\", \".deb\", \".pkg\", \".rar\", \".rpm\", \".tar.gz\", \".z\", \".zip\", \".zipx\"],\n \"disc-image\": [\".dmg\", \".iso\", \".toast\", \".vcd\", \".bin\", \".cue\", \".mdf\"]\n };\n\n kendo.getFileGroup = function(extension, withPrefix) {\n var fileTypeMap = kendo.fileGroupMap;\n var groups = Object.keys(fileTypeMap);\n var type = \"file\";\n\n if (extension === undefined || !extension.length) {\n return type;\n }\n\n for (var i = 0; i < groups.length; i += 1) {\n var extensions = fileTypeMap[groups[i]];\n\n if (extensions.indexOf(extension.toLowerCase()) > -1) {\n return withPrefix ? \"file-\" + groups[i] : groups[i];\n }\n }\n\n return type;\n };\n\n kendo.getFileSizeMessage = function(size) {\n var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];\n\n if (size === 0) {\n return '0 Byte';\n }\n\n var i = parseInt(Math.floor(Math.log(size) / Math.log(1024)), 10);\n return Math.round(size / Math.pow(1024, i), 2) + ' ' + sizes[i];\n };\n\n kendo.selectorFromClasses = function(classes) {\n return \".\" + classes.split(\" \").join(\".\");\n };\n\n // Standardized Properties and CSS classes\n\n var themeColorValues = ['base', 'primary', 'secondary', 'tertiary', 'inherit', 'info', 'success', 'warning', 'error', 'dark', 'light', 'inverse'];\n var fillValues = ['solid', 'outline', 'flat'];\n //var postitionValues = ['edge', 'outside', 'inside'];\n var shapeValues = ['rectangle', 'square'];\n var sizeValues = [ ['small', 'sm'], ['medium', 'md'], ['large', 'lg'] ];\n var roundedValues = [ ['small', 'sm'], ['medium', 'md'], ['large', 'lg'] ];\n //var alignValues = [ ['top start', 'top-start'], ['top end', 'top-end'], ['bottom start', 'bottom-start'], ['bottom end', 'bottom-end'] ];\n var positionModeValues = [ 'fixed', 'static', 'sticky', 'absolute' ];\n var resizeValues = [ 'both', 'horizontal', 'vertical' ];\n var overflowValues = [ 'auto', 'hidden', 'visible', 'scroll', 'clip' ];\n\n kendo.cssProperties = (function() {\n var defaultValues = {},\n propertyDictionary = {};\n\n function registerPrefix(widget, prefix) {\n var dict = kendo.cssProperties.propertyDictionary;\n\n if (!dict[widget]) {\n dict[widget] = {};\n }\n\n dict[widget][PREFIX] = prefix;\n }\n\n function registerValues(widget, args) {\n var dict = kendo.cssProperties.propertyDictionary,\n i, j, prop, values, newValues, currentValue;\n\n for (i = 0; i < args.length; i++) {\n prop = args[i].prop;\n newValues = args[i].values;\n\n if (!dict[widget][prop]) {\n dict[widget][prop] = {};\n }\n\n values = dict[widget][prop];\n\n for (j = 0; j < newValues.length; j++) {\n currentValue = newValues[j];\n\n if (isArray(newValues[j])) {\n values[currentValue[0]] = currentValue[1];\n } else {\n values[currentValue] = currentValue;\n }\n }\n }\n }\n\n function registerCssClass(propName, value, shorthand) {\n if (!defaultValues[propName]) {\n defaultValues[propName] = {};\n }\n\n defaultValues[propName][value] = shorthand || value;\n }\n\n function registerCssClasses(propName, arr) {\n for (var i = 0; i < arr.length; i++) {\n if (isArray(arr[i])) {\n registerCssClass(propName, arr[i][0], arr[i][1]);\n } else {\n registerCssClass(propName, arr[i]);\n }\n }\n }\n\n function getValidClass(args) {\n var widget = args.widget,\n propName = args.propName,\n value = args.value,\n fill = args.fill,\n cssProperties = kendo.cssProperties,\n defaultValues = cssProperties.defaultValues[propName],\n widgetProperties = cssProperties.propertyDictionary[widget],\n widgetValues, validValue, prefix;\n\n if (!widgetProperties) {\n return \"\";\n }\n\n widgetValues = widgetProperties[propName];\n validValue = widgetValues ? widgetValues[value] || defaultValues[value] : defaultValues[value];\n\n if (validValue) {\n if (propName === \"themeColor\") {\n prefix = widgetProperties[PREFIX] + fill + \"-\";\n } else if (propName === \"positionMode\") {\n prefix = \"k-pos-\";\n } else if (propName === \"rounded\") {\n prefix = \"k-rounded-\";\n } else if (propName === \"resize\") {\n prefix = \"k-resize-\";\n } else if (propName === \"overflow\") {\n prefix = \"k-overflow-\";\n } else {\n prefix = widgetProperties[PREFIX];\n }\n\n return prefix + validValue;\n } else {\n return \"\";\n }\n }\n\n registerCssClasses(\"themeColor\", themeColorValues);\n registerCssClasses(\"fillMode\", fillValues);\n registerCssClasses(\"shape\", shapeValues);\n registerCssClasses(\"size\", sizeValues);\n registerCssClasses(\"positionMode\", positionModeValues);\n registerCssClasses(\"rounded\", roundedValues);\n registerCssClasses(\"resize\", resizeValues);\n registerCssClasses(\"overflow\", overflowValues);\n\n return {\n positionModeValues: positionModeValues,\n roundedValues: roundedValues,\n sizeValues: sizeValues,\n shapeValues: shapeValues,\n fillModeValues: fillValues,\n themeColorValues: themeColorValues,\n\n defaultValues: defaultValues,\n propertyDictionary: propertyDictionary,\n\n registerValues: registerValues,\n getValidClass: getValidClass,\n registerPrefix: registerPrefix\n };\n }());\n\n //To do: delete below after implementing new styles and classes for BottomNavigation\n kendo.registerCssClass = function(propName, value, shorthand) {\n if (!kendo.propertyToCssClassMap[propName]) {\n kendo.propertyToCssClassMap[propName] = {};\n }\n\n kendo.propertyToCssClassMap[propName][value] = shorthand || value;\n };\n\n kendo.registerCssClasses = function(propName, arr) {\n for (var i = 0; i < arr.length; i++) {\n if (isArray(arr[i])) {\n kendo.registerCssClass(propName, arr[i][0], arr[i][1]);\n } else {\n kendo.registerCssClass(propName, arr[i]);\n }\n }\n };\n\n kendo.getValidCssClass = function(prefix, propName, value) {\n var validValue = kendo.propertyToCssClassMap[propName][value];\n\n if (validValue) {\n return prefix + validValue;\n }\n };\n\n kendo.propertyToCssClassMap = {};\n\n kendo.registerCssClasses(\"themeColor\", themeColorValues);\n kendo.registerCssClasses(\"fill\", fillValues);\n //kendo.registerCssClasses(\"postition\", postitionValues);\n kendo.registerCssClasses(\"shape\", shapeValues);\n kendo.registerCssClasses(\"size\", sizeValues);\n //kendo.registerCssClasses(\"align\", alignValues);\n kendo.registerCssClasses(\"positionMode\", positionModeValues);\n\n // jQuery deferred helpers\n\n // influenced from: https://gist.github.com/fearphage/4341799\n kendo.whenAll = function(array) {\n var resolveValues = arguments.length == 1 && Array.isArray(array) ? array : Array.prototype.slice.call(arguments),\n length = resolveValues.length,\n remaining = length,\n deferred = $.Deferred(),\n i = 0,\n failed = 0,\n rejectContexts = Array(length),\n rejectValues = Array(length),\n resolveContexts = Array(length),\n value;\n\n function updateFunc(index, contexts, values) {\n return function() {\n if (values != resolveValues) {\n failed++;\n }\n\n deferred.notifyWith(\n contexts[index] = this,\n values[index] = Array.prototype.slice.call(arguments)\n );\n\n if (!(--remaining)) {\n deferred[(!failed ? 'resolve' : 'reject') + 'With'](contexts, values);\n }\n };\n }\n\n for (; i < length; i++) {\n if ((value = resolveValues[i]) && kendo.isFunction(value.promise)) {\n value.promise()\n .done(updateFunc(i, resolveContexts, resolveValues))\n .fail(updateFunc(i, rejectContexts, rejectValues));\n }\n\n else {\n deferred.notifyWith(this, value);\n --remaining;\n }\n }\n\n if (!remaining) {\n deferred.resolveWith(resolveContexts, resolveValues);\n }\n\n return deferred.promise();\n };\n\n // kendo.saveAs -----------------------------------------------\n (function() {\n function postToProxy(dataURI, fileName, proxyURL, proxyTarget) {\n var form = $(\"
\").attr({\n action: proxyURL,\n method: \"POST\",\n target: proxyTarget\n });\n\n var data = kendo.antiForgeryTokens();\n data.fileName = fileName;\n\n var parts = dataURI.split(\";base64,\");\n data.contentType = parts[0].replace(\"data:\", \"\");\n data.base64 = parts[1];\n\n for (var name in data) {\n if (data.hasOwnProperty(name)) {\n $('').attr({\n value: data[name],\n name: name,\n type: \"hidden\"\n }).appendTo(form);\n }\n }\n\n form.appendTo(\"body\").submit().remove();\n }\n\n var fileSaver = document.createElement(\"a\");\n var downloadAttribute = \"download\" in fileSaver && !kendo.support.browser.edge;\n\n function saveAsBlob(dataURI, fileName) {\n var blob = dataURI; // could be a Blob object\n\n if (typeof dataURI == \"string\") {\n var parts = dataURI.split(\";base64,\");\n var contentType = parts[0];\n var base64 = atob(parts[1]);\n var array = new Uint8Array(base64.length);\n\n for (var idx = 0; idx < base64.length; idx++) {\n array[idx] = base64.charCodeAt(idx);\n }\n blob = new Blob([array.buffer], { type: contentType });\n }\n\n navigator.msSaveBlob(blob, fileName);\n }\n\n function saveAsDataURI(dataURI, fileName) {\n if (window.Blob && dataURI instanceof Blob) {\n dataURI = URL.createObjectURL(dataURI);\n }\n\n fileSaver.download = fileName;\n fileSaver.href = dataURI;\n\n var e = document.createEvent(\"MouseEvents\");\n e.initMouseEvent(\"click\", true, false, window,\n 0, 0, 0, 0, 0, false, false, false, false, 0, null);\n\n fileSaver.dispatchEvent(e);\n setTimeout(function() {\n URL.revokeObjectURL(dataURI);\n });\n }\n\n kendo.saveAs = function(options) {\n var save = postToProxy;\n\n if (!options.forceProxy) {\n if (downloadAttribute) {\n save = saveAsDataURI;\n } else if (navigator.msSaveBlob) {\n save = saveAsBlob;\n }\n }\n\n save(options.dataURI, options.fileName, options.proxyURL, options.proxyTarget);\n };\n })();\n\n // kendo proxySetters\n kendo.proxyModelSetters = function proxyModelSetters(data) {\n var observable = {};\n\n Object.keys(data || {}).forEach(function(property) {\n Object.defineProperty(observable, property, {\n get: function() {\n return data[property];\n },\n set: function(value) {\n data[property] = value;\n data.dirty = true;\n }\n });\n });\n\n return observable;\n };\n\n kendo.getSeriesColors = function() {\n var seriesColorsTemplate = '
' +\n '
' +\n '
' +\n '
' +\n '
' +\n '
',\n series = $(seriesColorsTemplate),\n colors = [];\n\n series.appendTo($('body'));\n\n series.each(function(i, item) {\n colors.push($(item).css(\"background-color\"));\n });\n\n series.remove();\n\n return colors;\n };\n\n kendo.isElement = function(element) {\n return element instanceof Element || element instanceof HTMLDocument;\n };\n\n // Kendo defaults\n (function() {\n\n kendo.defaults = kendo.defaults || {};\n kendo.setDefaults = function(key, value) {\n var path = key.split(\".\");\n var curr = kendo.defaults;\n\n key = path.pop();\n\n path.forEach(function(part) {\n if (curr[part] === undefined) {\n curr[part] = {};\n }\n\n curr = curr[part];\n });\n\n if (value.constructor === Object) {\n curr[key] = deepExtend({}, curr[key], value);\n } else {\n curr[key] = value;\n }\n };\n\n })();\n\n // Implement type() as it has been depricated in jQuery\n (function() {\n kendo.class2type = {};\n\n jQuery.each( \"Boolean Number String Function Array Date RegExp Object Error Symbol\".split( \" \" ),\n function( _i, name ) {\n kendo.class2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n } );\n\n kendo.type = function(obj) {\n if ( obj == null ) {\n return obj + \"\";\n }\n\n // Support: Android <=2.3 only (functionish RegExp)\n return typeof obj === \"object\" || typeof obj === \"function\" ?\n kendo.class2type[Object.prototype.toString.call(obj)] || \"object\" :\n typeof obj;\n };\n }());\n\n var KendoLicensing = { validatePackage: function() {},setScriptKey: function() {} };\n\n window.KendoLicensing = {\n setScriptKey: KendoLicensing.setScriptKey\n };\n\n function validatePackage() {\n KendoLicensing.validatePackage(packageMetadata);\n }\n\n})(jQuery, window);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.router',[ \"kendo.core\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"router\",\n name: \"Router\",\n category: \"framework\",\n description: \"The Router class is responsible for tracking the application state and navigating between the application states.\",\n depends: [ \"core\" ],\n hidden: false\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n CHANGE = \"change\",\n BACK = \"back\",\n SAME = \"same\",\n support = kendo.support,\n location = window.location,\n history = window.history,\n CHECK_URL_INTERVAL = 50,\n BROKEN_BACK_NAV = kendo.support.browser.msie,\n hashStrip = /^#*/,\n document = window.document;\n\n function absoluteURL(path, pathPrefix) {\n if (!pathPrefix) {\n return path;\n }\n\n if (path + \"/\" === pathPrefix) {\n path = pathPrefix;\n }\n\n var regEx = new RegExp(\"^\" + pathPrefix, \"i\");\n\n if (!regEx.test(path)) {\n path = pathPrefix + \"/\" + path;\n }\n\n return location.protocol + '//' + (location.host + \"/\" + path).replace(/\\/\\/+/g, '/');\n }\n\n function hashDelimiter(bang) {\n return bang ? \"#!\" : \"#\";\n }\n\n function locationHash(hashDelimiter) {\n var href = location.href;\n\n // ignore normal anchors if in hashbang mode - however, still return \"\" if no hash present\n if (hashDelimiter === \"#!\" && href.indexOf(\"#\") > -1 && href.indexOf(\"#!\") < 0) {\n return null;\n }\n\n return href.split(hashDelimiter)[1] || \"\";\n }\n\n function stripRoot(root, url) {\n if (url.indexOf(root) === 0) {\n return (url.substr(root.length)).replace(/\\/\\//g, '/');\n } else {\n return url;\n }\n }\n\n var HistoryAdapter = kendo.Class.extend({\n back: function() {\n if (BROKEN_BACK_NAV) {\n setTimeout(function() { history.back(); });\n } else {\n history.back();\n }\n },\n\n forward: function() {\n if (BROKEN_BACK_NAV) {\n setTimeout(function() { history.forward(); });\n } else {\n history.forward();\n }\n },\n\n length: function() {\n return history.length;\n },\n\n replaceLocation: function(url) {\n location.replace(url);\n }\n });\n\n var PushStateAdapter = HistoryAdapter.extend({\n init: function(root) {\n this.root = root;\n },\n\n navigate: function(to) {\n history.pushState({}, document.title, absoluteURL(to, this.root));\n },\n\n replace: function(to) {\n history.replaceState({}, document.title, absoluteURL(to, this.root));\n },\n\n normalize: function(url) {\n return stripRoot(this.root, url);\n },\n\n current: function() {\n var current = location.pathname;\n\n if (location.search) {\n current += location.search;\n }\n\n return stripRoot(this.root, current);\n },\n\n change: function(callback) {\n $(window).bind(\"popstate.kendo\", callback);\n },\n\n stop: function() {\n $(window).unbind(\"popstate.kendo\");\n },\n\n normalizeCurrent: function(options) {\n var fixedUrl,\n root = options.root,\n pathname = location.pathname,\n hash = locationHash(hashDelimiter(options.hashBang));\n\n if (root === pathname + \"/\") {\n fixedUrl = root;\n }\n\n if (root === pathname && hash) {\n fixedUrl = absoluteURL(hash.replace(hashStrip, ''), root);\n }\n\n if (fixedUrl) {\n history.pushState({}, document.title, fixedUrl);\n }\n }\n });\n\n function fixHash(url) {\n return url.replace(/^(#)?/, \"#\");\n }\n\n function fixBang(url) {\n return url.replace(/^(#(!)?)?/, \"#!\");\n }\n\n var HashAdapter = HistoryAdapter.extend({\n init: function(bang) {\n this._id = kendo.guid();\n this.prefix = hashDelimiter(bang);\n this.fix = bang ? fixBang : fixHash;\n },\n\n navigate: function(to) {\n location.hash = this.fix(to);\n },\n\n replace: function(to) {\n this.replaceLocation(this.fix(to));\n },\n\n normalize: function(url) {\n if (url.indexOf(this.prefix) < 0) {\n return url;\n } else {\n return url.split(this.prefix)[1];\n }\n },\n\n change: function(callback) {\n if (support.hashChange) {\n $(window).on(\"hashchange.\" + this._id, callback);\n } else {\n this._interval = setInterval(callback, CHECK_URL_INTERVAL);\n }\n },\n\n stop: function() {\n $(window).off(\"hashchange.\" + this._id);\n clearInterval(this._interval);\n },\n\n current: function() {\n return locationHash(this.prefix);\n },\n\n normalizeCurrent: function(options) {\n var pathname = location.pathname,\n root = options.root;\n\n if (options.pushState && root !== pathname) {\n this.replaceLocation(root + this.prefix + stripRoot(root, pathname));\n return true; // browser will reload at this point.\n }\n\n return false;\n }\n });\n\n var History = kendo.Observable.extend({\n start: function(options) {\n options = options || {};\n\n this.bind([CHANGE, BACK, SAME], options);\n\n if (this._started) {\n return;\n }\n\n this._started = true;\n\n options.root = options.root || \"/\";\n\n var adapter = this.createAdapter(options),\n current;\n\n // adapter may reload the document\n if (adapter.normalizeCurrent(options)) {\n return;\n }\n\n current = adapter.current();\n\n $.extend(this, {\n adapter: adapter,\n root: options.root,\n historyLength: adapter.length(),\n current: current,\n locations: [current]\n });\n\n adapter.change(this._checkUrl.bind(this));\n },\n\n createAdapter: function(options) {\n return support.pushState && options.pushState ? new PushStateAdapter(options.root) : new HashAdapter(options.hashBang);\n },\n\n stop: function() {\n if (!this._started) {\n return;\n }\n this.adapter.stop();\n this.unbind(CHANGE);\n this._started = false;\n },\n\n change: function(callback) {\n this.bind(CHANGE, callback);\n },\n\n replace: function(to, silent) {\n\n this._navigate(to, silent, function(adapter) {\n adapter.replace(to);\n this.locations[this.locations.length - 1] = this.current;\n });\n },\n\n navigate: function(to, silent) {\n if (to === \"#:back\") {\n this.backCalled = true;\n this.adapter.back();\n return;\n }\n\n this._navigate(to, silent, function(adapter) {\n adapter.navigate(to);\n this.locations.push(this.current);\n });\n },\n\n _navigate: function(to, silent, callback) {\n var adapter = this.adapter;\n\n to = adapter.normalize(to);\n\n if (this.current === to || this.current === decodeURIComponent(to)) {\n this.trigger(SAME);\n return;\n }\n\n if (!silent) {\n if (this.trigger(CHANGE, { url: to, decode: false })) {\n return;\n }\n }\n\n this.current = to;\n\n callback.call(this, adapter);\n\n this.historyLength = adapter.length();\n },\n\n _checkUrl: function() {\n var adapter = this.adapter,\n current = adapter.current(),\n newLength = adapter.length(),\n navigatingInExisting = this.historyLength === newLength,\n back = current === this.locations[this.locations.length - 2] && navigatingInExisting,\n backCalled = this.backCalled,\n prev = this.current;\n\n if (current === null || this.current === current || this.current === decodeURIComponent(current)) {\n return true;\n }\n\n this.historyLength = newLength;\n this.backCalled = false;\n\n this.current = current;\n\n if (back && this.trigger(\"back\", { url: prev, to: current })) {\n adapter.forward();\n this.current = prev;\n return;\n }\n\n if (this.trigger(CHANGE, { url: current, backButtonPressed: !backCalled })) {\n if (back) {\n adapter.forward();\n } else {\n adapter.back();\n this.historyLength --;\n }\n this.current = prev;\n return;\n }\n\n if (back) {\n this.locations.pop();\n } else {\n this.locations.push(current);\n }\n }\n });\n\n kendo.History = History;\n kendo.History.HistoryAdapter = HistoryAdapter;\n kendo.History.HashAdapter = HashAdapter;\n kendo.History.PushStateAdapter = PushStateAdapter;\n kendo.absoluteURL = absoluteURL;\n kendo.history = new History();\n})(window.kendo.jQuery);\n\n(function() {\n var kendo = window.kendo,\n history = kendo.history,\n Observable = kendo.Observable,\n INIT = \"init\",\n ROUTE_MISSING = \"routeMissing\",\n CHANGE = \"change\",\n BACK = \"back\",\n SAME = \"same\",\n optionalParam = /\\((.*?)\\)/g,\n namedParam = /(\\(\\?)?:\\w+/g,\n splatParam = /\\*\\w+/g,\n escapeRegExp = /[\\-{}\\[\\]+?.,\\\\\\^$|#\\s]/g;\n\n function namedParamReplace(match, optional) {\n return optional ? match : '([^\\/]+)';\n }\n\n function routeToRegExp(route, ignoreCase) {\n return new RegExp('^' + route\n .replace(escapeRegExp, '\\\\$&')\n .replace(optionalParam, '(?:$1)?')\n .replace(namedParam, namedParamReplace)\n .replace(splatParam, '(.*?)') + '$', ignoreCase ? \"i\" : \"\");\n }\n\n function stripUrl(url) {\n return url.replace(/(\\?.*)|(#.*)/g, \"\");\n }\n\n var Route = kendo.Class.extend({\n init: function(route, callback, ignoreCase) {\n if (!(route instanceof RegExp)) {\n route = routeToRegExp(route, ignoreCase);\n }\n\n this.route = route;\n this._callback = callback;\n },\n\n callback: function(url, back, decode) {\n var params,\n idx = 0,\n length,\n queryStringParams = kendo.parseQueryStringParams(url);\n queryStringParams._back = back;\n\n url = stripUrl(url);\n params = this.route.exec(url).slice(1);\n length = params.length;\n\n if (decode) {\n for (; idx < length; idx ++) {\n if (typeof params[idx] !== 'undefined') {\n params[idx] = decodeURIComponent(params[idx]);\n }\n }\n }\n\n params.push(queryStringParams);\n\n this._callback.apply(null, params);\n },\n\n worksWith: function(url, back, decode) {\n if (this.route.test(stripUrl(url))) {\n this.callback(url, back, decode);\n return true;\n } else {\n return false;\n }\n }\n });\n\n var Router = Observable.extend({\n init: function(options) {\n if (!options) {\n options = {};\n }\n\n Observable.fn.init.call(this);\n\n this.routes = [];\n this.pushState = options.pushState;\n this.hashBang = options.hashBang;\n this.root = options.root;\n this.ignoreCase = options.ignoreCase !== false;\n\n this.bind([INIT, ROUTE_MISSING, CHANGE, SAME, BACK], options);\n },\n\n destroy: function() {\n history.unbind(CHANGE, this._urlChangedProxy);\n history.unbind(SAME, this._sameProxy);\n history.unbind(BACK, this._backProxy);\n this.unbind();\n },\n\n start: function() {\n var that = this,\n sameProxy = function() { that._same(); },\n backProxy = function(e) { that._back(e); },\n urlChangedProxy = function(e) { that._urlChanged(e); };\n\n history.start({\n same: sameProxy,\n change: urlChangedProxy,\n back: backProxy,\n pushState: that.pushState,\n hashBang: that.hashBang,\n root: that.root\n });\n\n // eslint-disable-next-line no-undef\n var initEventObject = { url: history.current || \"/\", preventDefault: $.noop };\n\n if (!that.trigger(INIT, initEventObject)) {\n that._urlChanged(initEventObject);\n }\n\n this._urlChangedProxy = urlChangedProxy;\n this._backProxy = backProxy;\n },\n\n route: function(route, callback) {\n this.routes.push(new Route(route, callback, this.ignoreCase));\n },\n\n navigate: function(url, silent) {\n kendo.history.navigate(url, silent);\n },\n\n replace: function(url, silent) {\n kendo.history.replace(url, silent);\n },\n\n _back: function(e) {\n if (this.trigger(BACK, { url: e.url, to: e.to })) {\n e.preventDefault();\n }\n },\n\n _same: function() {\n this.trigger(SAME);\n },\n\n _urlChanged: function(e) {\n var url = e.url;\n var decode = !!e.decode;\n var back = e.backButtonPressed;\n\n if (!url) {\n url = \"/\";\n }\n\n if (this.trigger(CHANGE, { url: e.url, params: kendo.parseQueryStringParams(e.url), backButtonPressed: back })) {\n e.preventDefault();\n return;\n }\n\n var idx = 0,\n routes = this.routes,\n route,\n length = routes.length;\n\n for (; idx < length; idx ++) {\n route = routes[idx];\n\n if (route.worksWith(url, back, decode)) {\n return;\n }\n }\n\n if (this.trigger(ROUTE_MISSING, { url: url, params: kendo.parseQueryStringParams(url), backButtonPressed: back })) {\n e.preventDefault();\n }\n }\n });\n\n kendo.Router = Router;\n})();\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.userevents',[ \"kendo.core\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"userevents\",\n name: \"User Events\",\n category: \"framework\",\n depends: [ \"core\" ],\n hidden: true\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n support = kendo.support,\n Class = kendo.Class,\n Observable = kendo.Observable,\n now = Date.now,\n extend = $.extend,\n OS = support.mobileOS,\n invalidZeroEvents = OS && OS.android,\n DEFAULT_MIN_HOLD = 800,\n CLICK_DELAY = 300,\n DEFAULT_THRESHOLD = support.browser.msie ? 5 : 0, // WP8 and W8 are very sensitive and always report move.\n\n // UserEvents events\n PRESS = \"press\",\n HOLD = \"hold\",\n SELECT = \"select\",\n START = \"start\",\n MOVE = \"move\",\n END = \"end\",\n CANCEL = \"cancel\",\n TAP = \"tap\",\n DOUBLETAP = \"doubleTap\",\n RELEASE = \"release\",\n GESTURESTART = \"gesturestart\",\n GESTURECHANGE = \"gesturechange\",\n GESTUREEND = \"gestureend\",\n GESTURETAP = \"gesturetap\";\n\n var THRESHOLD = {\n \"api\": 0,\n \"touch\": 0,\n \"mouse\": 9,\n \"pointer\": 9\n };\n\n var ENABLE_GLOBAL_SURFACE = (!support.touch || support.mouseAndTouchPresent);\n\n function touchDelta(touch1, touch2) {\n var x1 = touch1.x.location,\n y1 = touch1.y.location,\n x2 = touch2.x.location,\n y2 = touch2.y.location,\n dx = x1 - x2,\n dy = y1 - y2;\n\n return {\n center: {\n x: (x1 + x2) / 2,\n y: (y1 + y2) / 2\n },\n\n distance: Math.sqrt(dx * dx + dy * dy)\n };\n }\n\n function getTouches(e) {\n var touches = [],\n originalEvent = e.originalEvent,\n currentTarget = e.currentTarget,\n idx = 0, length,\n changedTouches,\n touch;\n\n if (e.api) {\n touches.push({\n id: 2, // hardcoded ID for API call;\n event: e,\n target: e.target,\n currentTarget: e.target,\n location: e,\n type: \"api\"\n });\n }\n else if (e.type.match(/touch/)) {\n changedTouches = originalEvent ? originalEvent.changedTouches : [];\n for (length = changedTouches.length; idx < length; idx ++) {\n touch = changedTouches[idx];\n touches.push({\n location: touch,\n event: e,\n target: touch.target,\n currentTarget: currentTarget,\n id: touch.identifier,\n type: \"touch\"\n });\n }\n }\n else if (support.pointers || support.msPointers) {\n touches.push({\n location: originalEvent,\n event: e,\n target: e.target,\n currentTarget: currentTarget,\n id: originalEvent.pointerId,\n type: \"pointer\"\n });\n } else {\n touches.push({\n id: 1, // hardcoded ID for mouse event;\n event: e,\n target: e.target,\n currentTarget: currentTarget,\n location: e,\n type: \"mouse\"\n });\n }\n\n return touches;\n }\n\n var TouchAxis = Class.extend({\n init: function(axis, location) {\n var that = this;\n\n that.axis = axis;\n\n that._updateLocationData(location);\n\n that.startLocation = that.location;\n that.velocity = that.delta = 0;\n that.timeStamp = now();\n },\n\n move: function(location) {\n var that = this,\n offset = location[\"page\" + that.axis],\n timeStamp = now(),\n timeDelta = (timeStamp - that.timeStamp) || 1; // Firing manually events in tests can make this 0;\n\n if (!offset && invalidZeroEvents) {\n return;\n }\n\n that.delta = offset - that.location;\n\n that._updateLocationData(location);\n\n that.initialDelta = offset - that.startLocation;\n that.velocity = that.delta / timeDelta;\n that.timeStamp = timeStamp;\n },\n\n _updateLocationData: function(location) {\n var that = this, axis = that.axis;\n\n that.location = location[\"page\" + axis];\n that.client = location[\"client\" + axis];\n that.screen = location[\"screen\" + axis];\n }\n });\n\n var Touch = Class.extend({\n init: function(userEvents, target, touchInfo) {\n extend(this, {\n x: new TouchAxis(\"X\", touchInfo.location),\n y: new TouchAxis(\"Y\", touchInfo.location),\n type: touchInfo.type,\n useClickAsTap: userEvents.useClickAsTap,\n threshold: userEvents.threshold || THRESHOLD[touchInfo.type],\n userEvents: userEvents,\n target: target,\n currentTarget: touchInfo.currentTarget,\n initialTouch: touchInfo.target,\n id: touchInfo.id,\n pressEvent: touchInfo,\n _clicks: userEvents._clicks,\n supportDoubleTap: userEvents.supportDoubleTap,\n _moved: false,\n _finished: false\n });\n },\n\n press: function() {\n this._holdTimeout = setTimeout(this._hold.bind(this), this.userEvents.minHold);\n this._trigger(PRESS, this.pressEvent);\n },\n\n _tap: function(touchInfo) {\n var that = this;\n that.userEvents._clicks++;\n if (that.userEvents._clicks == 1) {\n that._clickTimeout = setTimeout(function() {\n if (that.userEvents._clicks == 1) {\n that._trigger(TAP, touchInfo);\n }\n else {\n that._trigger(DOUBLETAP, touchInfo);\n }\n that.userEvents._clicks = 0;\n }, CLICK_DELAY);\n }\n },\n\n _hold: function() {\n this._trigger(HOLD, this.pressEvent);\n },\n\n move: function(touchInfo) {\n var that = this;\n var preventMove = touchInfo.type !== \"api\" && that.userEvents._shouldNotMove;\n\n if (that._finished || preventMove) { return; }\n\n that.x.move(touchInfo.location);\n that.y.move(touchInfo.location);\n\n if (!that._moved) {\n if (that._withinIgnoreThreshold()) {\n return;\n }\n\n if (!UserEvents.current || UserEvents.current === that.userEvents) {\n that._start(touchInfo);\n } else {\n return that.dispose();\n }\n }\n\n // Event handlers may cancel the drag in the START event handler, hence the double check for pressed.\n if (!that._finished) {\n that._trigger(MOVE, touchInfo);\n }\n },\n\n end: function(touchInfo) {\n this.endTime = now();\n\n if (this._finished) { return; }\n\n // Mark the object as finished if there are blocking operations in the event handlers (alert/confirm)\n this._finished = true;\n\n this._trigger(RELEASE, touchInfo); // Release should be fired before TAP (as click is after mouseup/touchend)\n\n if (this._moved) {\n this._trigger(END, touchInfo);\n } else {\n if (!this.useClickAsTap) {\n if (this.supportDoubleTap) {\n this._tap(touchInfo);\n }\n else {\n this._trigger(TAP, touchInfo);\n }\n }\n }\n\n clearTimeout(this._holdTimeout);\n\n this.dispose();\n },\n\n dispose: function() {\n var userEvents = this.userEvents,\n activeTouches = userEvents.touches;\n\n this._finished = true;\n this.pressEvent = null;\n clearTimeout(this._holdTimeout);\n\n activeTouches.splice($.inArray(this, activeTouches), 1);\n },\n\n skip: function() {\n this.dispose();\n },\n\n cancel: function() {\n this.dispose();\n },\n\n isMoved: function() {\n return this._moved;\n },\n\n _start: function(touchInfo) {\n clearTimeout(this._holdTimeout);\n\n this.startTime = now();\n this._moved = true;\n this._trigger(START, touchInfo);\n },\n\n _trigger: function(name, touchInfo) {\n var that = this,\n jQueryEvent = touchInfo.event,\n data = {\n touch: that,\n x: that.x,\n y: that.y,\n target: that.target,\n event: jQueryEvent\n };\n\n if (that.userEvents.notify(name, data)) {\n jQueryEvent.preventDefault();\n }\n },\n\n _withinIgnoreThreshold: function() {\n var xDelta = this.x.initialDelta,\n yDelta = this.y.initialDelta;\n\n return Math.sqrt(xDelta * xDelta + yDelta * yDelta) <= this.threshold;\n }\n });\n\n function withEachUpEvent(callback) {\n var downEvents = kendo.eventMap.up.split(\" \"),\n idx = 0,\n length = downEvents.length;\n\n for (; idx < length; idx ++) {\n callback(downEvents[idx]);\n }\n }\n\n var UserEvents = Observable.extend({\n init: function(element, options) {\n var that = this,\n filter,\n ns = kendo.guid();\n\n options = options || {};\n filter = that.filter = options.filter;\n that.threshold = options.threshold || DEFAULT_THRESHOLD;\n that.minHold = options.minHold || DEFAULT_MIN_HOLD;\n that.touches = [];\n that._maxTouches = options.multiTouch ? 2 : 1;\n that.allowSelection = options.allowSelection;\n that.captureUpIfMoved = options.captureUpIfMoved;\n that.useClickAsTap = !options.fastTap && !support.delayedClick();\n that.eventNS = ns;\n that._clicks = 0;\n that.supportDoubleTap = options.supportDoubleTap;\n\n element = $(element).handler(that);\n Observable.fn.init.call(that);\n\n extend(that, {\n element: element,\n // the touch events lock to the element anyway, so no need for the global setting\n surface: options.global && ENABLE_GLOBAL_SURFACE ? $(element[0].ownerDocument.documentElement) : $(options.surface || element),\n stopPropagation: options.stopPropagation,\n pressed: false\n });\n\n that.surface.handler(that)\n .on(kendo.applyEventMap(\"move\", ns), \"_move\")\n .on(kendo.applyEventMap(\"up cancel\", ns), \"_end\");\n\n element.on(kendo.applyEventMap(\"down\", ns), filter, \"_start\");\n\n if (that.useClickAsTap) {\n element.on(kendo.applyEventMap(\"click\", ns), filter, \"_click\");\n }\n\n if (support.pointers || support.msPointers) {\n //touch-action:none will not work for IE10\n if (support.browser.version < 11) {\n var defaultAction = \"pinch-zoom double-tap-zoom\";\n element.css(\"-ms-touch-action\", options.touchAction && options.touchAction != \"none\" ? defaultAction + \" \" + options.touchAction : defaultAction);\n } else {\n element.css(\"touch-action\", options.touchAction || \"none\");\n }\n }\n\n if (options.preventDragEvent) {\n element.on(kendo.applyEventMap(\"dragstart\", ns), kendo.preventDefault);\n }\n\n element.on(kendo.applyEventMap(\"mousedown\", ns), filter, { root: element }, \"_select\");\n\n if (that.captureUpIfMoved && support.eventCapture) {\n var surfaceElement = that.surface[0],\n preventIfMovingProxy = that.preventIfMoving.bind(that);\n\n withEachUpEvent(function(eventName) {\n surfaceElement.addEventListener(eventName, preventIfMovingProxy, true);\n });\n }\n\n that.bind([\n PRESS,\n HOLD,\n TAP,\n DOUBLETAP,\n START,\n MOVE,\n END,\n RELEASE,\n CANCEL,\n GESTURESTART,\n GESTURECHANGE,\n GESTUREEND,\n GESTURETAP,\n SELECT\n ], options);\n },\n\n preventIfMoving: function(e) {\n if (this._isMoved()) {\n e.preventDefault();\n }\n },\n\n destroy: function() {\n var that = this;\n\n if (that._destroyed) {\n return;\n }\n\n that._destroyed = true;\n\n if (that.captureUpIfMoved && support.eventCapture) {\n var surfaceElement = that.surface[0];\n withEachUpEvent(function(eventName) {\n surfaceElement.removeEventListener(eventName, that.preventIfMoving);\n });\n }\n\n that.element.kendoDestroy(that.eventNS);\n that.surface.kendoDestroy(that.eventNS);\n that.element.removeData(\"handler\");\n that.surface.removeData(\"handler\");\n that._disposeAll();\n\n that.unbind();\n delete that.surface;\n delete that.element;\n delete that.currentTarget;\n },\n\n capture: function() {\n UserEvents.current = this;\n },\n\n cancel: function() {\n this._disposeAll();\n this.trigger(CANCEL);\n },\n\n notify: function(eventName, data) {\n var that = this,\n touches = that.touches;\n\n if (this._isMultiTouch()) {\n switch (eventName) {\n case MOVE:\n eventName = GESTURECHANGE;\n break;\n case END:\n eventName = GESTUREEND;\n break;\n case TAP:\n eventName = GESTURETAP;\n break;\n }\n\n extend(data, { touches: touches }, touchDelta(touches[0], touches[1]));\n }\n\n return this.trigger(eventName, extend(data, { type: eventName }));\n },\n\n // API\n press: function(x, y, target) {\n this._apiCall(\"_start\", x, y, target);\n },\n\n move: function(x, y) {\n this._apiCall(\"_move\", x, y);\n },\n\n end: function(x, y) {\n this._apiCall(\"_end\", x, y);\n },\n\n _isMultiTouch: function() {\n return this.touches.length > 1;\n },\n\n _maxTouchesReached: function() {\n return this.touches.length >= this._maxTouches;\n },\n\n _disposeAll: function() {\n var touches = this.touches;\n while (touches.length > 0) {\n touches.pop().dispose();\n }\n },\n\n _isMoved: function() {\n return $.grep(this.touches, function(touch) {\n return touch.isMoved();\n }).length;\n },\n\n _select: function(e) {\n if (!this.allowSelection || this.trigger(SELECT, { event: e })) {\n e.preventDefault();\n }\n },\n\n _start: function(e) {\n var that = this,\n idx = 0,\n filter = that.filter,\n target,\n touches = getTouches(e),\n length = touches.length,\n touch,\n which = e.which;\n\n if ((which && which > 1) || (that._maxTouchesReached())) {\n return;\n }\n\n UserEvents.current = null;\n\n that.currentTarget = e.currentTarget;\n\n if (that.stopPropagation) {\n e.stopPropagation();\n }\n\n for (; idx < length; idx ++) {\n if (that._maxTouchesReached()) {\n break;\n }\n\n touch = touches[idx];\n\n if (filter) {\n target = $(touch.currentTarget); // target.is(filter) ? target : target.closest(filter, that.element);\n } else {\n target = that.element;\n }\n\n if (!target.length) {\n continue;\n }\n\n touch = new Touch(that, target, touch);\n that.touches.push(touch);\n touch.press();\n\n if (that._isMultiTouch()) {\n that.notify(\"gesturestart\", {});\n }\n }\n },\n\n _move: function(e) {\n this._eachTouch(\"move\", e);\n },\n\n _end: function(e) {\n this._eachTouch(\"end\", e);\n },\n\n _click: function(e) {\n var data = {\n touch: {\n initialTouch: e.target,\n target: $(e.currentTarget),\n endTime: now(),\n x: {\n location: e.pageX,\n client: e.clientX\n },\n y: {\n location: e.pageY,\n client: e.clientY\n }\n },\n x: e.pageX,\n y: e.pageY,\n target: $(e.currentTarget),\n event: e,\n type: \"tap\"\n };\n\n if (this.trigger(\"tap\", data)) {\n e.preventDefault();\n }\n },\n\n _eachTouch: function(methodName, e) {\n var that = this,\n dict = {},\n touches = getTouches(e),\n activeTouches = that.touches,\n idx,\n touch,\n touchInfo,\n matchingTouch;\n\n for (idx = 0; idx < activeTouches.length; idx ++) {\n touch = activeTouches[idx];\n dict[touch.id] = touch;\n }\n\n for (idx = 0; idx < touches.length; idx ++) {\n touchInfo = touches[idx];\n matchingTouch = dict[touchInfo.id];\n\n if (matchingTouch) {\n matchingTouch[methodName](touchInfo);\n }\n }\n },\n\n _apiCall: function(type, x, y, target) {\n this[type]({\n api: true,\n pageX: x,\n pageY: y,\n clientX: x,\n clientY: y,\n target: $(target || this.element)[0],\n stopPropagation: $.noop,\n preventDefault: $.noop\n });\n }\n });\n\n UserEvents.defaultThreshold = function(value) {\n DEFAULT_THRESHOLD = value;\n };\n\n UserEvents.minHold = function(value) {\n DEFAULT_MIN_HOLD = value;\n };\n\n kendo.getTouches = getTouches;\n kendo.touchDelta = touchDelta;\n kendo.UserEvents = UserEvents;\n })(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.touch',[ \"kendo.core\", \"kendo.userevents\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"touch\",\n name: \"Touch\",\n category: \"mobile\",\n description: \"The kendo Touch widget provides a cross-platform compatible API for handling user-initiated touch events, multi-touch gestures and event sequences (drag, swipe, etc.). \",\n depends: [ \"core\", \"userevents\" ]\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n Widget = kendo.ui.Widget,\n abs = Math.abs,\n MAX_DOUBLE_TAP_DISTANCE = 20;\n\n var Touch = Widget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n options = that.options;\n\n element = that.element;\n that.wrapper = element;\n\n function eventProxy(name) {\n return function(e) {\n that._triggerTouch(name, e);\n };\n }\n\n function gestureEventProxy(name) {\n return function(e) {\n that.trigger(name, { touches: e.touches, distance: e.distance, center: e.center, event: e.event });\n };\n }\n\n that.events = new kendo.UserEvents(element, {\n filter: options.filter,\n surface: options.surface,\n minHold: options.minHold,\n multiTouch: options.multiTouch,\n allowSelection: true,\n fastTap: options.fastTap,\n press: eventProxy(\"touchstart\"),\n hold: eventProxy(\"hold\"),\n tap: that._tap.bind(that),\n gesturestart: gestureEventProxy(\"gesturestart\"),\n gesturechange: gestureEventProxy(\"gesturechange\"),\n gestureend: gestureEventProxy(\"gestureend\")\n });\n\n if (options.enableSwipe) {\n that.events.bind(\"start\", that._swipestart.bind(that));\n that.events.bind(\"move\", that._swipemove.bind(that));\n } else {\n that.events.bind(\"start\", that._dragstart.bind(that));\n that.events.bind(\"move\", eventProxy(\"drag\"));\n that.events.bind(\"end\", eventProxy(\"dragend\"));\n }\n\n kendo.notify(that);\n },\n\n events: [\n \"touchstart\",\n \"dragstart\",\n \"drag\",\n \"dragend\",\n \"tap\",\n \"doubletap\",\n \"hold\",\n \"swipe\",\n \"gesturestart\",\n \"gesturechange\",\n \"gestureend\"\n ],\n\n options: {\n name: \"Touch\",\n surface: null,\n global: false,\n fastTap: false,\n filter: null,\n multiTouch: false,\n enableSwipe: false,\n minXDelta: 30,\n maxYDelta: 20,\n maxDuration: 1000,\n minHold: 800,\n doubleTapTimeout: 800\n },\n\n cancel: function() {\n this.events.cancel();\n },\n\n destroy: function() {\n Widget.fn.destroy.call(this);\n\n this.events.destroy();\n },\n\n _triggerTouch: function(type, e) {\n if (this.trigger(type, { touch: e.touch, event: e.event })) {\n e.preventDefault();\n }\n },\n\n _tap: function(e) {\n var that = this,\n lastTap = that.lastTap,\n touch = e.touch;\n\n if (lastTap &&\n (touch.endTime - lastTap.endTime < that.options.doubleTapTimeout) &&\n kendo.touchDelta(touch, lastTap).distance < MAX_DOUBLE_TAP_DISTANCE\n ) {\n\n that._triggerTouch(\"doubletap\", e);\n that.lastTap = null;\n } else {\n that._triggerTouch(\"tap\", e);\n that.lastTap = touch;\n }\n },\n\n _dragstart: function(e) {\n this._triggerTouch(\"dragstart\", e);\n },\n\n _swipestart: function(e) {\n if (abs(e.x.velocity) * 2 >= abs(e.y.velocity)) {\n e.sender.capture();\n }\n },\n\n _swipemove: function(e) {\n var that = this,\n options = that.options,\n touch = e.touch,\n duration = e.event.timeStamp - touch.startTime,\n direction = touch.x.initialDelta > 0 ? \"right\" : \"left\";\n\n if (\n abs(touch.x.initialDelta) >= options.minXDelta &&\n abs(touch.y.initialDelta) < options.maxYDelta &&\n duration < options.maxDuration\n )\n {\n that.trigger(\"swipe\", {\n direction: direction,\n touch: e.touch\n });\n\n touch.cancel();\n }\n }\n });\n\n kendo.ui.plugin(Touch);\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.data.odata',[ \"kendo.core\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"data.odata\",\n name: \"OData\",\n category: \"framework\",\n depends: [ \"core\" ],\n hidden: true\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n extend = $.extend,\n NEWLINE = \"\\r\\n\",\n DOUBLELINE = \"\\r\\n\\r\\n\",\n isFunction = kendo.isFunction,\n odataFilters = {\n eq: \"eq\",\n neq: \"ne\",\n gt: \"gt\",\n gte: \"ge\",\n lt: \"lt\",\n lte: \"le\",\n contains: \"substringof\",\n doesnotcontain: \"substringof\",\n endswith: \"endswith\",\n startswith: \"startswith\",\n isnull: \"eq\",\n isnotnull: \"ne\",\n isnullorempty: \"eq\",\n isnotnullorempty: \"ne\",\n isempty: \"eq\",\n isnotempty: \"ne\"\n },\n odataFiltersVersionFour = extend({}, odataFilters, {\n contains: \"contains\"\n }),\n mappers = {\n pageSize: $.noop,\n page: $.noop,\n filter: function(params, filter, useVersionFour) {\n if (filter) {\n filter = toOdataFilter(filter, useVersionFour);\n if (filter) {\n params.$filter = filter;\n }\n }\n },\n sort: function(params, orderby) {\n var expr = $.map(orderby, function(value) {\n var order = value.field.replace(/\\./g, \"/\");\n\n if (value.dir === \"desc\") {\n order += \" desc\";\n }\n\n return order;\n }).join(\",\");\n\n if (expr) {\n params.$orderby = expr;\n }\n },\n skip: function(params, skip) {\n if (skip) {\n params.$skip = skip;\n }\n },\n take: function(params, take) {\n if (take) {\n params.$top = take;\n }\n }\n },\n defaultDataType = {\n read: {\n dataType: \"jsonp\"\n }\n };\n\n function toOdataFilter(filter, useOdataFour) {\n var result = [],\n logic = filter.logic || \"and\",\n idx,\n length,\n field,\n type,\n format,\n operator,\n value,\n ignoreCase,\n filters = filter.filters;\n\n for (idx = 0, length = filters.length; idx < length; idx++) {\n filter = filters[idx];\n field = filter.field;\n value = filter.value;\n operator = filter.operator;\n\n if (filter.filters) {\n filter = toOdataFilter(filter, useOdataFour);\n } else {\n ignoreCase = filter.ignoreCase;\n field = field.replace(/\\./g, \"/\");\n filter = odataFilters[operator];\n if (useOdataFour) {\n filter = odataFiltersVersionFour[operator];\n }\n\n if (operator === \"isnullorempty\") {\n filter = kendo.format(\"{0} {1} null or {0} {1} ''\", field, filter);\n } else if (operator === \"isnotnullorempty\") {\n filter = kendo.format(\"{0} {1} null and {0} {1} ''\", field, filter);\n } else if (operator === \"isnull\" || operator === \"isnotnull\") {\n filter = kendo.format(\"{0} {1} null\", field, filter);\n } else if (operator === \"isempty\" || operator === \"isnotempty\") {\n filter = kendo.format(\"{0} {1} ''\", field, filter);\n } else if (filter && value !== undefined) {\n type = kendo.type(value);\n if (type === \"string\") {\n format = \"'{1}'\";\n value = value.replace(/'/g, \"''\");\n\n if (ignoreCase === true) {\n field = \"tolower(\" + field + \")\";\n }\n\n } else if (type === \"date\") {\n if (useOdataFour) {\n format = \"{1:yyyy-MM-ddTHH:mm:ss+00:00}\";\n value = kendo.timezone.apply(value, 'Etc/UTC');\n } else {\n format = \"datetime'{1:yyyy-MM-ddTHH:mm:ss}'\";\n }\n } else {\n format = \"{1}\";\n }\n\n if (filter.length > 3) {\n if (filter !== \"substringof\") {\n format = \"{0}({2},\" + format + \")\";\n } else {\n format = \"{0}(\" + format + \",{2})\";\n if (operator === \"doesnotcontain\") {\n if (useOdataFour) {\n format = \"{0}({2},'{1}') eq -1\";\n filter = \"indexof\";\n } else {\n format += \" eq false\";\n }\n }\n }\n } else {\n format = \"{2} {0} \" + format;\n }\n\n filter = kendo.format(format, filter, value, field);\n }\n }\n\n result.push(filter);\n }\n\n filter = result.join(\" \" + logic + \" \");\n\n if (result.length > 1) {\n filter = \"(\" + filter + \")\";\n }\n\n return filter;\n }\n\n function stripMetadata(obj) {\n for (var name in obj) {\n if (name.indexOf(\"@odata\") === 0) {\n delete obj[name];\n }\n }\n }\n\n function hex16() {\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substr(1);\n }\n\n function createBoundary(prefix) {\n return prefix + hex16() + '-' + hex16() + '-' + hex16();\n }\n\n function createDelimeter(boundary, close) {\n var result = NEWLINE + \"--\" + boundary;\n\n if (close) {\n result += \"--\";\n }\n\n return result;\n }\n\n function createCommand(transport, item, httpVerb, command) {\n var transportUrl = transport.options[command].url;\n var commandPrefix = kendo.format(\"{0} \", httpVerb);\n\n if (isFunction(transportUrl)) {\n return commandPrefix + transportUrl(item);\n } else {\n return commandPrefix + transportUrl;\n }\n }\n\n function getOperationHeader(changeset, changeId) {\n var header = \"\";\n\n header += createDelimeter(changeset, false);\n header += NEWLINE + 'Content-Type: application/http';\n header += NEWLINE + 'Content-Transfer-Encoding: binary';\n header += NEWLINE + 'Content-ID: ' + changeId;\n\n return header;\n }\n\n function getOperationContent(item) {\n var content = \"\";\n\n content += NEWLINE + \"Content-Type: application/json;odata=minimalmetadata\";\n content += NEWLINE + \"Prefer: return=representation\";\n content += DOUBLELINE + kendo.stringify(item);\n\n return content;\n }\n\n function getOperations(collection, changeset, changeId, command, transport, skipContent) {\n var requestBody = \"\";\n\n for (var i = 0; i < collection.length; i++) {\n requestBody += getOperationHeader(changeset, changeId);\n requestBody += DOUBLELINE + createCommand(transport, collection[i], transport.options[command].type, command) + ' HTTP/1.1';\n if (!skipContent) {\n requestBody += getOperationContent(collection[i]);\n }\n requestBody += NEWLINE;\n changeId++;\n }\n\n return requestBody;\n }\n\n function processCollection(colection, boundary, changeset, changeId, transport, command, skipContent) {\n var requestBody = \"\";\n\n requestBody += getBoundary(boundary, changeset);\n requestBody += getOperations(colection, changeset, changeId, command, transport, skipContent);\n requestBody += createDelimeter(changeset, true);\n requestBody += NEWLINE;\n\n return requestBody;\n }\n\n function getBoundary(boundary,changeset) {\n var requestBody = \"\";\n\n requestBody += \"--\" + boundary + NEWLINE;\n requestBody += \"Content-Type: multipart/mixed; boundary=\" + changeset + NEWLINE;\n\n return requestBody;\n }\n\n function createBatchRequest(transport, colections) {\n\t\tvar options = extend({}, transport.options.batch);\n var boundary = createBoundary(\"sf_batch_\");\n var requestBody = \"\";\n var changeId = 0;\n var batchURL = transport.options.batch.url;\n var changeset = createBoundary(\"sf_changeset_\");\n\n options.type = transport.options.batch.type;\n options.url = isFunction(batchURL) ? batchURL() : batchURL;\n\t\toptions.headers = extend(options.headers || {}, {\n\t\t\t\"Content-Type\": \"multipart/mixed; boundary=\" + boundary\n\t\t});\n\n if (colections.updated.length) {\n requestBody += processCollection(colections.updated, boundary, changeset, changeId, transport, \"update\", false);\n changeId += colections.updated.length;\n changeset = createBoundary(\"sf_changeset_\");\n }\n\n if (colections.destroyed.length) {\n requestBody += processCollection(colections.destroyed, boundary, changeset, changeId, transport, \"destroy\", true);\n changeId += colections.destroyed.length;\n changeset = createBoundary(\"sf_changeset_\");\n }\n\n if (colections.created.length) {\n requestBody += processCollection(colections.created, boundary, changeset, changeId, transport, \"create\", false);\n }\n\n requestBody += createDelimeter(boundary, true);\n\n options.data = requestBody;\n\n return options;\n }\n\n function parseBatchResponse(responseText) {\n var responseMarkers = responseText.match(/--changesetresponse_[a-z0-9-]+$/gm);\n var markerIndex = 0;\n var collections = [];\n var changeBody;\n var status;\n var code;\n var marker;\n var jsonModel;\n\n collections.push({ models: [], passed: true });\n\n for (var i = 0; i < responseMarkers.length; i++) {\n marker = responseMarkers[i];\n if (marker.lastIndexOf('--', marker.length - 1)) {\n if (i < responseMarkers.length - 1) {\n collections.push({ models: [], passed: true });\n }\n continue;\n }\n\n if (!markerIndex) {\n markerIndex = responseText.indexOf(marker);\n } else {\n markerIndex = responseText.indexOf(marker, markerIndex + marker.length);\n }\n\n changeBody = responseText.substring(markerIndex, responseText.indexOf(\"--\", markerIndex + 1));\n status = changeBody.match(/^HTTP\\/1\\.\\d (\\d{3}) (.*)$/gm).pop();\n code = kendo.parseFloat(status.match(/\\d{3}/g).pop());\n\n if (code >= 200 && code <= 299) {\n jsonModel = changeBody.match(/\\{.*\\}/gm);\n if (jsonModel) {\n collections[collections.length - 1].models.push(JSON.parse(jsonModel[0]));\n }\n } else {\n collections[collections.length - 1].passed = false;\n }\n\n }\n\n return collections;\n }\n\n extend(true, kendo.data, {\n schemas: {\n odata: {\n type: \"json\",\n data: function(data) {\n return data.d.results || [data.d];\n },\n total: \"d.__count\"\n }\n },\n transports: {\n odata: {\n read: {\n cache: true, // to prevent jQuery from adding cache buster\n dataType: \"jsonp\",\n jsonp: \"$callback\"\n },\n update: {\n cache: true,\n dataType: \"json\",\n contentType: \"application/json\", // to inform the server the the request body is JSON encoded\n type: \"PUT\" // can be PUT or MERGE\n },\n create: {\n cache: true,\n dataType: \"json\",\n contentType: \"application/json\",\n type: \"POST\" // must be POST to create new entity\n },\n destroy: {\n cache: true,\n dataType: \"json\",\n type: \"DELETE\"\n },\n parameterMap: function(options, type, useVersionFour) {\n var params,\n value,\n option,\n dataType;\n\n options = options || {};\n type = type || \"read\";\n dataType = (this.options || defaultDataType)[type];\n dataType = dataType ? dataType.dataType : \"json\";\n\n if (type === \"read\") {\n params = {\n $inlinecount: \"allpages\"\n };\n\n if (dataType != \"json\") {\n params.$format = \"json\";\n }\n\n for (option in options) {\n if (mappers[option]) {\n mappers[option](params, options[option], useVersionFour);\n } else {\n params[option] = options[option];\n }\n }\n } else {\n if (dataType !== \"json\") {\n throw new Error(\"Only json dataType can be used for \" + type + \" operation.\");\n }\n\n if (type !== \"destroy\") {\n for (option in options) {\n value = options[option];\n if (typeof value === \"number\") {\n options[option] = value + \"\";\n }\n }\n\n params = kendo.stringify(options);\n }\n }\n\n return params;\n }\n }\n }\n });\n\n extend(true, kendo.data, {\n schemas: {\n \"odata-v4\": {\n type: \"json\",\n data: function(data) {\n if (Array.isArray(data)) {\n for (var i = 0; i < data.length; i++) {\n stripMetadata(data[i]);\n }\n return data;\n } else {\n data = $.extend({}, data);\n stripMetadata(data);\n\n if (data.value) {\n return data.value;\n }\n return [data];\n }\n },\n total: function(data) {\n return data[\"@odata.count\"];\n }\n }\n },\n transports: {\n \"odata-v4\": {\n batch: {\n type: \"POST\"\n },\n read: {\n cache: true, // to prevent jQuery from adding cache buster\n dataType: \"json\"\n },\n update: {\n cache: true,\n dataType: \"json\",\n contentType: \"application/json;IEEE754Compatible=true\", // to inform the server the the request body is JSON encoded\n type: \"PUT\" // can be PUT or MERGE\n },\n create: {\n cache: true,\n dataType: \"json\",\n contentType: \"application/json;IEEE754Compatible=true\",\n type: \"POST\" // must be POST to create new entity\n },\n destroy: {\n cache: true,\n dataType: \"json\",\n type: \"DELETE\"\n },\n parameterMap: function(options, type) {\n var result = kendo.data.transports.odata.parameterMap(options, type, true);\n if (type == \"read\") {\n result.$count = true;\n delete result.$inlinecount;\n }\n\n\t\t\t\t\tif (result && result.$filter) {\n\t\t\t\t\t\t// Remove the single quotation marks around the GUID (OData v4).\n\t\t\t\t\t\tresult.$filter = result.$filter.replace(/('[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')/ig, function(x) {\n\t\t\t\t\t\t\treturn x.substring(1, x.length - 1);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n return result;\n },\n submit: function(e) {\n var that = this;\n var options = createBatchRequest(that, e.data);\n var collections = e.data;\n\n if (!collections.updated.length && !collections.destroyed.length && !collections.created.length) {\n return;\n }\n\n $.ajax(extend(true, {}, {\n success: function(response) {\n var responses = parseBatchResponse(response);\n var index = 0;\n var current;\n\n if (collections.updated.length) {\n current = responses[index];\n if (current.passed) {\n // Pass either the obtained models or an empty array if only status codes are returned.\n e.success(current.models.length ? current.models : [], \"update\");\n }\n index++;\n }\n if (collections.destroyed.length) {\n current = responses[index];\n if (current.passed) {\n // For delete operations OData returns only status codes.\n // Passing empty array to datasource will force it to correctly remove the deleted items from the pristine collection.\n e.success([], \"destroy\");\n }\n index++;\n }\n if (collections.created.length) {\n current = responses[index];\n if (current.passed) {\n e.success(current.models, \"create\");\n }\n }\n },\n error: function(response, status, error) {\n e.error(response, status, error);\n }\n }, options));\n }\n }\n }\n });\n\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.data.xml',[ \"kendo.core\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"data.xml\",\n name: \"XML\",\n category: \"framework\",\n depends: [ \"core\" ],\n hidden: true\n};\n\n\n(function($, undefined) {\n var kendo = window.kendo,\n isArray = Array.isArray,\n isPlainObject = $.isPlainObject,\n map = $.map,\n each = $.each,\n extend = $.extend,\n getter = kendo.getter,\n Class = kendo.Class;\n\n var XmlDataReader = Class.extend({\n init: function(options) {\n var that = this,\n total = options.total,\n model = options.model,\n parse = options.parse,\n errors = options.errors,\n serialize = options.serialize,\n data = options.data;\n\n if (model) {\n if (isPlainObject(model)) {\n var base = options.modelBase || kendo.data.Model;\n\n if (model.fields) {\n each(model.fields, function(field, value) {\n if (isPlainObject(value) && value.field) {\n if (!kendo.isFunction(value.field)) {\n value = extend(value, { field: that.getter(value.field) });\n }\n } else {\n value = { field: that.getter(value) };\n }\n model.fields[field] = value;\n });\n }\n\n var id = model.id;\n if (id) {\n var idField = {};\n\n idField[that.xpathToMember(id, true)] = { field: that.getter(id) };\n model.fields = extend(idField, model.fields);\n model.id = that.xpathToMember(id);\n }\n model = base.define(model);\n }\n\n that.model = model;\n }\n\n if (total) {\n if (typeof total == \"string\") {\n total = that.getter(total);\n that.total = function(data) {\n return parseInt(total(data), 10);\n };\n } else if (typeof total == \"function\") {\n that.total = total;\n }\n }\n\n if (errors) {\n if (typeof errors == \"string\") {\n errors = that.getter(errors);\n that.errors = function(data) {\n return errors(data) || null;\n };\n } else if (typeof errors == \"function\") {\n that.errors = errors;\n }\n }\n\n if (data) {\n if (typeof data == \"string\") {\n data = that.xpathToMember(data);\n that.data = function(value) {\n var result = that.evaluate(value, data),\n modelInstance;\n\n result = isArray(result) ? result : [result];\n\n if (that.model && model.fields) {\n modelInstance = new that.model();\n\n return map(result, function(value) {\n if (value) {\n var record = {}, field;\n\n for (field in model.fields) {\n record[field] = modelInstance._parse(field, model.fields[field].field(value));\n }\n\n return record;\n }\n });\n }\n\n return result;\n };\n } else if (typeof data == \"function\") {\n that.data = data;\n }\n }\n\n if (typeof parse == \"function\") {\n var xmlParse = that.parse;\n\n that.parse = function(data) {\n var xml = parse.call(that, data);\n return xmlParse.call(that, xml);\n };\n }\n\n if (typeof serialize == \"function\") {\n that.serialize = serialize;\n }\n },\n total: function(result) {\n return this.data(result).length;\n },\n errors: function(data) {\n return data ? data.errors : null;\n },\n serialize: function(data) {\n return data;\n },\n parseDOM: function(element) {\n var result = {},\n parsedNode,\n node,\n nodeType,\n nodeName,\n member,\n attribute,\n attributes = element.attributes,\n attributeCount = attributes.length,\n idx;\n\n for (idx = 0; idx < attributeCount; idx++) {\n attribute = attributes[idx];\n result[\"@\" + attribute.nodeName] = attribute.nodeValue;\n }\n\n for (node = element.firstChild; node; node = node.nextSibling) {\n nodeType = node.nodeType;\n\n if (nodeType === 3 || nodeType === 4) {\n // text nodes or CDATA are stored as #text field\n result[\"#text\"] = node.nodeValue;\n } else if (nodeType === 1) {\n // elements are stored as fields\n parsedNode = this.parseDOM(node);\n\n nodeName = node.nodeName;\n\n member = result[nodeName];\n\n if (isArray(member)) {\n // elements of same nodeName are stored as array\n member.push(parsedNode);\n } else if (member !== undefined) {\n member = [member, parsedNode];\n } else {\n member = parsedNode;\n }\n\n result[nodeName] = member;\n }\n }\n return result;\n },\n\n evaluate: function(value, expression) {\n var members = expression.split(\".\"),\n member,\n result,\n length,\n intermediateResult,\n idx;\n\n while (member = members.shift()) {\n value = value[member];\n\n if (isArray(value)) {\n result = [];\n expression = members.join(\".\");\n\n for (idx = 0, length = value.length; idx < length; idx++) {\n intermediateResult = this.evaluate(value[idx], expression);\n\n intermediateResult = isArray(intermediateResult) ? intermediateResult : [intermediateResult];\n\n result.push.apply(result, intermediateResult);\n }\n\n return result;\n }\n }\n\n return value;\n },\n\n parse: function(xml) {\n var documentElement,\n tree,\n result = {};\n\n documentElement = xml.documentElement || $.parseXML(xml).documentElement;\n\n tree = this.parseDOM(documentElement);\n\n result[documentElement.nodeName] = tree;\n\n return result;\n },\n\n xpathToMember: function(member, raw) {\n if (!member) {\n return \"\";\n }\n\n member = member.replace(/^\\//, \"\") // remove the first \"/\"\n .replace(/\\//g, \".\"); // replace all \"/\" with \".\"\n\n if (member.indexOf(\"@\") >= 0) {\n // replace @attribute with '[\"@attribute\"]'\n return member.replace(/\\.?(@.*)/, raw ? '$1' : '[\"$1\"]');\n }\n\n if (member.indexOf(\"text()\") >= 0) {\n // replace \".text()\" with '[\"#text\"]'\n return member.replace(/(\\.?text\\(\\))/, raw ? '#text' : '[\"#text\"]');\n }\n\n return member;\n },\n getter: function(member) {\n return getter(this.xpathToMember(member), true);\n }\n });\n\n $.extend(true, kendo.data, {\n XmlDataReader: XmlDataReader,\n readers: {\n xml: XmlDataReader\n }\n });\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.data',[ \"kendo.core\", \"kendo.data.odata\", \"kendo.data.xml\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"data\",\n name: \"Data source\",\n category: \"framework\",\n description: \"Powerful component for using local and remote data.Fully supports CRUD, Sorting, Paging, Filtering, Grouping, and Aggregates.\",\n depends: [ \"core\" ],\n features: [ {\n id: \"data-odata\",\n name: \"OData\",\n description: \"Support for accessing Open Data Protocol (OData) services.\",\n depends: [ \"data.odata\" ]\n }, {\n id: \"data-signalr\",\n name: \"SignalR\",\n description: \"Support for binding to SignalR hubs.\",\n depends: [ \"data.signalr\" ]\n }, {\n id: \"data-XML\",\n name: \"XML\",\n description: \"Support for binding to XML.\",\n depends: [ \"data.xml\" ]\n }]\n};\n\n\n(function($, undefined) {\n var extend = $.extend,\n isPlainObject = $.isPlainObject,\n isEmptyObject = $.isEmptyObject,\n isArray = Array.isArray,\n grep = $.grep,\n ajax = $.ajax,\n map,\n each = $.each,\n noop = $.noop,\n kendo = window.kendo,\n isFunction = kendo.isFunction,\n Observable = kendo.Observable,\n Class = kendo.Class,\n STRING = \"string\",\n FUNCTION = \"function\",\n ASCENDING = \"asc\",\n CREATE = \"create\",\n READ = \"read\",\n UPDATE = \"update\",\n DESTROY = \"destroy\",\n CHANGE = \"change\",\n SYNC = \"sync\",\n GET = \"get\",\n ERROR = \"error\",\n REQUESTSTART = \"requestStart\",\n PROGRESS = \"progress\",\n REQUESTEND = \"requestEnd\",\n ITEMSLOADED = \"itemsLoaded\",\n ITEMLOAD = \"itemLoad\",\n crud = [CREATE, READ, UPDATE, DESTROY],\n identity = function(o) { return o; },\n getter = kendo.getter,\n stringify = kendo.stringify,\n math = Math,\n push = [].push,\n join = [].join,\n pop = [].pop,\n splice = [].splice,\n shift = [].shift,\n slice = [].slice,\n unshift = [].unshift,\n toString = {}.toString,\n stableSort = kendo.support.stableSort,\n dateRegExp = /^\\/Date\\((.*?)\\)\\/$/,\n objectKeys = [];\n\n var ObservableArray = Observable.extend({\n init: function(array, type) {\n var that = this;\n\n that.type = type || ObservableObject;\n\n Observable.fn.init.call(that);\n\n that.length = array.length;\n\n that.wrapAll(array, that);\n that._loadPromises = [];\n that._loadedNodes = [];\n },\n\n at: function(index) {\n return this[index];\n },\n\n toJSON: function(serializeFunctions) {\n var idx, length = this.length, value, json = new Array(length);\n\n for (idx = 0; idx < length; idx++) {\n value = this[idx];\n\n if (value instanceof ObservableObject) {\n value = value.toJSON(serializeFunctions);\n }\n\n json[idx] = value;\n }\n\n return json;\n },\n\n parent: noop,\n\n wrapAll: function(source, target) {\n var that = this,\n idx,\n length,\n parent = function() {\n return that;\n };\n\n target = target || [];\n\n for (idx = 0, length = source.length; idx < length; idx++) {\n target[idx] = that.wrap(source[idx], parent);\n }\n\n return target;\n },\n\n wrap: function(object, parent) {\n var that = this,\n observable;\n\n if (object !== null && toString.call(object) === \"[object Object]\") {\n observable = object instanceof that.type || object instanceof Model;\n\n if (!observable) {\n object = object instanceof ObservableObject ? object.toJSON() : object;\n object = new that.type(object);\n }\n\n object.parent = parent;\n\n object.bind(CHANGE, function(e) {\n var isGroup = object.hasOwnProperty(\"hasSubgroups\");\n that.trigger(CHANGE, {\n field: e.field,\n node: e.node,\n index: e.index,\n items: e.items || [this],\n action: e.node || isGroup ? (e.action || \"itemloaded\") : \"itemchange\"\n });\n });\n\n object.bind(ITEMLOAD, function(e) {\n that._loadPromises.push(e.promise);\n that._loading = true;\n\n e.promise.done(function() {\n that._loadedNodes.push(e.node);\n var index = that._loadPromises.indexOf(e.promise);\n that._loadPromises.splice(index, 1);\n\n if (!that._loadPromises.length) {\n that._loading = false;\n that.trigger(ITEMSLOADED, { collection: that, nodes: that._loadedNodes });\n that._loadedNodes = [];\n }\n });\n });\n }\n\n return object;\n },\n\n loading: function() {\n return this._loading;\n },\n\n push: function() {\n var index = this.length,\n items = this.wrapAll(arguments),\n result;\n\n result = push.apply(this, items);\n\n if (!this.omitChangeEvent) {\n this.trigger(CHANGE, {\n action: \"add\",\n index: index,\n items: items\n });\n }\n\n return result;\n },\n\n slice: slice,\n\n sort: [].sort,\n\n join: join,\n\n pop: function() {\n var length = this.length, result = pop.apply(this);\n\n if (length) {\n this.trigger(CHANGE, {\n action: \"remove\",\n index: length - 1,\n items: [result]\n });\n }\n\n return result;\n },\n\n splice: function(index, howMany, item) {\n var items = this.wrapAll(slice.call(arguments, 2)),\n result, i, len;\n\n result = splice.apply(this, [index, howMany].concat(items));\n\n if (result.length) {\n if (!this.omitChangeEvent) {\n this.trigger(CHANGE, {\n action: \"remove\",\n index: index,\n items: result\n });\n }\n\n for (i = 0, len = result.length; i < len; i++) {\n if (result[i] && result[i].children) {\n result[i].unbind(CHANGE);\n }\n }\n }\n\n if (item) {\n if (!this.omitChangeEvent) {\n this.trigger(CHANGE, {\n action: \"add\",\n index: index,\n items: items\n });\n }\n }\n return result;\n },\n\n shift: function() {\n var length = this.length, result = shift.apply(this);\n\n if (length) {\n this.trigger(CHANGE, {\n action: \"remove\",\n index: 0,\n items: [result]\n });\n }\n\n return result;\n },\n\n unshift: function() {\n var items = this.wrapAll(arguments),\n result;\n\n result = unshift.apply(this, items);\n\n this.trigger(CHANGE, {\n action: \"add\",\n index: 0,\n items: items\n });\n\n return result;\n },\n\n indexOf: function(item) {\n var that = this,\n idx,\n length;\n\n for (idx = 0, length = that.length; idx < length; idx++) {\n if (that[idx] === item) {\n return idx;\n }\n }\n return -1;\n },\n\n forEach: function(callback, thisArg) {\n var idx = 0;\n var length = this.length;\n var context = thisArg || window;\n\n for (; idx < length; idx++) {\n callback.call(context, this[idx], idx, this);\n }\n },\n\n map: function(callback, thisArg) {\n var idx = 0;\n var result = [];\n var length = this.length;\n var context = thisArg || window;\n\n for (; idx < length; idx++) {\n result[idx] = callback.call(context, this[idx], idx, this);\n }\n\n return result;\n },\n\n reduce: function(callback) {\n var idx = 0,\n result,\n length = this.length;\n\n if (arguments.length == 2) {\n result = arguments[1];\n } else if (idx < length) {\n result = this[idx++];\n }\n\n for (; idx < length; idx++) {\n result = callback(result, this[idx], idx, this);\n }\n\n return result;\n },\n\n reduceRight: function(callback) {\n var idx = this.length - 1,\n result;\n\n if (arguments.length == 2) {\n result = arguments[1];\n } else if (idx > 0) {\n result = this[idx--];\n }\n\n for (; idx >= 0; idx--) {\n result = callback(result, this[idx], idx, this);\n }\n\n return result;\n },\n\n filter: function(callback, thisArg) {\n var idx = 0;\n var result = [];\n var item;\n var length = this.length;\n var context = thisArg || window;\n\n for (; idx < length; idx++) {\n item = this[idx];\n if (callback.call(context, item, idx, this)) {\n result[result.length] = item;\n }\n }\n\n return result;\n },\n\n find: function(callback, thisArg) {\n var idx = 0;\n var item;\n var length = this.length;\n var context = thisArg || window;\n\n for (; idx < length; idx++) {\n item = this[idx];\n if (callback.call(context, item, idx, this)) {\n return item;\n }\n }\n },\n\n every: function(callback, thisArg) {\n var idx = 0;\n var item;\n var length = this.length;\n var context = thisArg || window;\n\n for (; idx < length; idx++) {\n item = this[idx];\n if (!callback.call(context, item, idx, this)) {\n return false;\n }\n }\n\n return true;\n },\n\n some: function(callback, thisArg) {\n var idx = 0;\n var item;\n var length = this.length;\n var context = thisArg || window;\n\n for (; idx < length; idx++) {\n item = this[idx];\n if (callback.call(context, item, idx, this)) {\n return true;\n }\n }\n\n return false;\n },\n\n // non-standard collection methods\n remove: function(item) {\n var idx = this.indexOf(item);\n\n if (idx !== -1) {\n this.splice(idx, 1);\n }\n },\n\n empty: function() {\n this.splice(0, this.length);\n }\n });\n\n // Polyfill for Symbol.iterator\n if (typeof Symbol !== \"undefined\" && Symbol.iterator && !ObservableArray.prototype[Symbol.iterator]) {\n ObservableArray.prototype[Symbol.iterator] = [][Symbol.iterator];\n }\n\n var LazyObservableArray = ObservableArray.extend({\n init: function(data, type, events) {\n var parentFn = function() { return this; };\n\n Observable.fn.init.call(this);\n\n this.type = type || ObservableObject;\n\n if (events) {\n this._events = events;\n }\n\n for (var idx = 0; idx < data.length; idx++) {\n this[idx] = data[idx];\n }\n\n this.length = idx;\n this._parent = parentFn.bind(this);\n },\n at: function(index) {\n var item = this[index];\n\n if (!(item instanceof this.type)) {\n item = this[index] = this.wrap(item, this._parent);\n } else {\n item.parent = this._parent;\n }\n\n return item;\n }\n });\n\n function eventHandler(context, type, field, prefix) {\n return function(e) {\n var event = {}, key;\n\n for (key in e) {\n event[key] = e[key];\n }\n\n if (prefix) {\n event.field = field + \".\" + e.field;\n } else {\n event.field = field;\n }\n\n if (type == CHANGE && context._notifyChange) {\n context._notifyChange(event);\n }\n\n context.trigger(type, event);\n };\n }\n\n function isPrimitiveType(value) {\n return (typeof value === \"object\" && Object.getPrototypeOf(value) === Object.getPrototypeOf({}))\n || Object.getPrototypeOf(value) === Object.getPrototypeOf(new Date())\n || typeof value !== \"object\";\n }\n\n function ownKeys(value, ignoreObjectKeys) {\n var props = [];\n var protoKeys = [];\n var keys, filteredObjectKeys;\n\n value = value || {};\n\n if (!isPrimitiveType(value)) {\n protoKeys = Object.getOwnPropertyNames(Object.getPrototypeOf(value));\n }\n\n keys = Object.getOwnPropertyNames(value).concat(protoKeys);\n\n filteredObjectKeys = objectKeys.filter(function(key) {\n return keys.indexOf(key) < 0;\n });\n\n while (value) {\n Object.getOwnPropertyNames(value).forEach(function(prop) {\n if (props.indexOf(prop) === -1 && (!ignoreObjectKeys || filteredObjectKeys.indexOf(prop) < 0)) {\n props.push(prop);\n }\n });\n value = Object.getPrototypeOf(value);\n }\n\n return props;\n }\n\n objectKeys = ownKeys({}, false);\n\n var ObservableObject = Observable.extend({\n init: function(value) {\n var that = this,\n member,\n keys = ownKeys(value, true),\n parent = function() {\n return that;\n };\n\n Observable.fn.init.call(this);\n\n this._handlers = {};\n\n keys.forEach(function(field) {\n member = value[field];\n\n if (typeof member === \"object\" && member && !member.getTime && field.charAt(0) != \"_\") {\n member = that.wrap(member, field, parent);\n }\n\n that[field] = member;\n });\n\n that.uid = kendo.guid();\n },\n\n shouldSerialize: function(field, serializeFunctions) {\n return this.hasOwnProperty(field) && field !== \"_handlers\" && field !== \"_events\" && ((serializeFunctions && serializeFunctions[field]) || typeof this[field] !== FUNCTION) && field !== \"uid\";\n },\n\n forEach: function(f) {\n for (var i in this) {\n if (this.shouldSerialize(i)) {\n f(this[i], i);\n }\n }\n },\n\n toJSON: function(serializeFunctions) {\n var result = {}, value, field;\n\n for (field in this) {\n if (this.shouldSerialize(field, serializeFunctions)) {\n value = this[field];\n\n if (value instanceof ObservableObject || value instanceof ObservableArray) {\n value = value.toJSON(serializeFunctions);\n }\n\n result[field] = value;\n }\n }\n\n return result;\n },\n\n get: function(field) {\n var that = this, result;\n\n that.trigger(GET, { field: field });\n\n if (field === \"this\") {\n result = that;\n } else {\n result = kendo.getter(field, true)(that);\n }\n\n return result;\n },\n\n _set: function(field, value) {\n var that = this;\n var composite = field.indexOf(\".\") >= 0;\n\n if (composite) {\n var paths = field.split(\".\"),\n path = \"\";\n\n while (paths.length > 1) {\n path += paths.shift();\n var obj = kendo.getter(path, true)(that);\n if (obj instanceof ObservableObject) {\n obj.set(paths.join(\".\"), value);\n return composite;\n }\n path += \".\";\n }\n }\n\n kendo.setter(field)(that, value);\n\n return composite;\n },\n\n set: function(field, value) {\n var that = this,\n isSetPrevented = false,\n composite = field.indexOf(\".\") >= 0,\n current = kendo.getter(field, true)(that);\n\n if (current !== value) {\n if (current instanceof Observable && this._handlers[field]) {\n if (this._handlers[field].get) {\n current.unbind(GET, this._handlers[field].get);\n }\n current.unbind(CHANGE, this._handlers[field].change);\n }\n\n isSetPrevented = that.trigger(\"set\", { field: field, value: value });\n\n if (!isSetPrevented) {\n if (!composite) {\n value = that.wrap(value, field, function() { return that; });\n }\n if (!that._set(field, value) || field.indexOf(\"(\") >= 0 || field.indexOf(\"[\") >= 0) {\n that.trigger(CHANGE, { field: field });\n }\n }\n }\n\n return isSetPrevented;\n },\n\n parent: noop,\n\n wrap: function(object, field, parent) {\n var that = this;\n var get;\n var change;\n var type = toString.call(object);\n\n if (object != null && (type === \"[object Object]\" || type === \"[object Array]\")) {\n var isObservableArray = object instanceof ObservableArray;\n var isDataSource = object instanceof DataSource;\n\n if (type === \"[object Object]\" && !isDataSource && !isObservableArray) {\n if (!(object instanceof ObservableObject)) {\n object = new ObservableObject(object);\n }\n\n get = eventHandler(that, GET, field, true);\n object.bind(GET, get);\n change = eventHandler(that, CHANGE, field, true);\n object.bind(CHANGE, change);\n\n that._handlers[field] = { get: get, change: change };\n } else if (type === \"[object Array]\" || isObservableArray || isDataSource) {\n if (!isObservableArray && !isDataSource) {\n object = new ObservableArray(object);\n }\n\n change = eventHandler(that, CHANGE, field, false);\n\n object.bind(CHANGE, change);\n\n that._handlers[field] = { change: change };\n }\n\n object.parent = parent;\n }\n\n return object;\n }\n });\n\n function equal(x, y) {\n if (x === y) {\n return true;\n }\n\n var xtype = kendo.type(x), ytype = kendo.type(y), field;\n\n if (xtype !== ytype) {\n return false;\n }\n\n if (xtype === \"date\") {\n return x.getTime() === y.getTime();\n }\n\n if (xtype !== \"object\" && xtype !== \"array\") {\n return false;\n }\n\n for (field in x) {\n if (!equal(x[field], y[field])) {\n return false;\n }\n }\n\n return true;\n }\n\n var parsers = {\n \"number\": function(value) {\n if (typeof value === STRING && value.toLowerCase() === \"null\") {\n return null;\n }\n return kendo.parseFloat(value);\n },\n\n \"date\": function(value) {\n if (typeof value === STRING && value.toLowerCase() === \"null\") {\n return null;\n }\n return kendo.parseDate(value);\n },\n\n \"boolean\": function(value) {\n if (typeof value === STRING) {\n if (value.toLowerCase() === \"null\") {\n return null;\n } else {\n return value.toLowerCase() === \"true\";\n }\n }\n return value != null ? !!value : value;\n },\n\n \"string\": function(value) {\n if (typeof value === STRING && value.toLowerCase() === \"null\") {\n return null;\n }\n return value != null ? (value + \"\") : value;\n },\n\n \"default\": function(value) {\n return value;\n }\n };\n\n var defaultValues = {\n \"string\": \"\",\n \"number\": 0,\n \"date\": new Date(),\n \"boolean\": false,\n \"default\": \"\"\n };\n\n function getFieldByName(obj, name) {\n var field,\n fieldName;\n\n for (fieldName in obj) {\n field = obj[fieldName];\n if (isPlainObject(field) && field.field && field.field === name) {\n return field;\n } else if (field === name) {\n return field;\n }\n }\n return null;\n }\n\n var Model = ObservableObject.extend({\n init: function(data) {\n var that = this;\n\n if (!data || $.isEmptyObject(data)) {\n data = $.extend({}, that.defaults, data);\n\n if (that._initializers) {\n for (var idx = 0; idx < that._initializers.length; idx++) {\n var name = that._initializers[idx];\n data[name] = that.defaults[name]();\n }\n }\n }\n\n ObservableObject.fn.init.call(that, data);\n\n that.dirty = false;\n that.dirtyFields = {};\n\n if (that.idField) {\n that.id = that.get(that.idField);\n\n if (that.id === undefined) {\n that.id = that._defaultId;\n }\n }\n },\n\n shouldSerialize: function(field) {\n return ObservableObject.fn.shouldSerialize.call(this, field) &&\n field !== \"uid\" && !(this.idField !== \"id\" && field === \"id\") &&\n field !== \"dirty\" && field !== \"dirtyFields\" && field !== \"_accessors\";\n },\n\n _parse: function(field, value) {\n var that = this,\n fieldName = field,\n fields = (that.fields || {}),\n parse;\n\n field = fields[field];\n if (!field) {\n field = getFieldByName(fields, fieldName);\n }\n if (field) {\n parse = field.parse;\n if (!parse && field.type) {\n parse = parsers[field.type.toLowerCase()];\n }\n }\n\n return parse ? parse(value) : value;\n },\n\n _notifyChange: function(e) {\n var action = e.action;\n\n if (action == \"add\" || action == \"remove\") {\n this.dirty = true;\n this.dirtyFields[e.field] = true;\n }\n },\n\n editable: function(field) {\n field = (this.fields || {})[field];\n return field ? field.editable !== false : true;\n },\n\n set: function(field, value) {\n var that = this;\n var dirty = that.dirty;\n\n if (that.editable(field)) {\n value = that._parse(field, value);\n\n if (!equal(value, that.get(field))) {\n that.dirty = true;\n that.dirtyFields[field] = true;\n\n if (ObservableObject.fn.set.call(that, field, value) && !dirty) {\n that.dirty = dirty;\n\n if (!that.dirty) {\n that.dirtyFields[field] = false;\n }\n }\n } else {\n that.trigger(\"equalSet\", { field: field, value: value });\n }\n }\n },\n\n accept: function(data) {\n var that = this,\n parent = function() { return that; },\n field;\n\n for (field in data) {\n var value = data[field];\n\n if (field.charAt(0) != \"_\") {\n value = that.wrap(data[field], field, parent);\n }\n\n that._set(field, value);\n }\n\n if (that.idField) {\n that.id = that.get(that.idField);\n }\n\n that.dirty = false;\n that.dirtyFields = {};\n },\n\n isNew: function() {\n return this.id === this._defaultId;\n }\n });\n\n Model.define = function(base, options) {\n if (options === undefined) {\n options = base;\n base = Model;\n }\n\n var model,\n proto = extend({ defaults: {} }, options),\n name,\n field,\n type,\n value,\n idx,\n length,\n fields = {},\n originalName,\n id = proto.id,\n functionFields = [];\n\n if (id) {\n proto.idField = id;\n }\n\n if (proto.id) {\n delete proto.id;\n }\n\n if (id) {\n proto.defaults[id] = proto._defaultId = \"\";\n }\n\n if (toString.call(proto.fields) === \"[object Array]\") {\n for (idx = 0, length = proto.fields.length; idx < length; idx++) {\n field = proto.fields[idx];\n if (typeof field === STRING) {\n fields[field] = {};\n } else if (field.field) {\n fields[field.field] = field;\n }\n }\n proto.fields = fields;\n }\n\n for (name in proto.fields) {\n field = proto.fields[name];\n type = field.type || \"default\";\n value = null;\n originalName = name;\n\n name = typeof (field.field) === STRING ? field.field : name;\n\n if (!field.nullable) {\n value = proto.defaults[originalName !== name ? originalName : name] = field.defaultValue !== undefined ? field.defaultValue : defaultValues[type.toLowerCase()];\n\n if (typeof value === \"function\") {\n functionFields.push(name);\n }\n }\n\n if (options.id === name) {\n proto._defaultId = value;\n }\n\n proto.defaults[originalName !== name ? originalName : name] = value;\n\n field.parse = field.parse || parsers[type];\n }\n\n if (functionFields.length > 0) {\n proto._initializers = functionFields;\n }\n\n model = base.extend(proto);\n model.define = function(options) {\n return Model.define(model, options);\n };\n\n if (proto.fields) {\n model.fields = proto.fields;\n model.idField = proto.idField;\n }\n\n return model;\n };\n\n var Comparer = {\n selector: function(field) {\n return isFunction(field) ? field : getter(field);\n },\n\n compare: function(field) {\n var selector = this.selector(field);\n return function(a, b) {\n a = selector(a);\n b = selector(b);\n\n if (a == null && b == null) {\n return 0;\n }\n\n if (a == null) {\n return -1;\n }\n\n if (b == null) {\n return 1;\n }\n\n if (a.localeCompare) {\n return a.localeCompare(b);\n }\n\n return a > b ? 1 : (a < b ? -1 : 0);\n };\n },\n\n create: function(sort) {\n var compare = sort.compare || this.compare(sort.field);\n\n if (sort.dir == \"desc\") {\n return function(a, b) {\n return compare(b, a, true);\n };\n }\n\n return compare;\n },\n\n combine: function(comparers) {\n return function(a, b) {\n var result = comparers[0](a, b),\n idx,\n length;\n\n for (idx = 1, length = comparers.length; idx < length; idx ++) {\n result = result || comparers[idx](a, b);\n }\n\n return result;\n };\n }\n };\n\n var StableComparer = extend({}, Comparer, {\n asc: function(field) {\n var selector = this.selector(field);\n return function(a, b) {\n var valueA = selector(a);\n var valueB = selector(b);\n\n if (valueA && valueA.getTime && valueB && valueB.getTime) {\n valueA = valueA.getTime();\n valueB = valueB.getTime();\n }\n\n if (valueA === valueB) {\n return a.__position - b.__position;\n }\n\n if (valueA == null) {\n return -1;\n }\n\n if (valueB == null) {\n return 1;\n }\n\n if (valueA.localeCompare) {\n return valueA.localeCompare(valueB);\n }\n\n return valueA > valueB ? 1 : -1;\n };\n },\n\n desc: function(field) {\n var selector = this.selector(field);\n return function(a, b) {\n var valueA = selector(a);\n var valueB = selector(b);\n\n if (valueA && valueA.getTime && valueB && valueB.getTime) {\n valueA = valueA.getTime();\n valueB = valueB.getTime();\n }\n\n if (valueA === valueB) {\n return a.__position - b.__position;\n }\n\n if (valueA == null) {\n return 1;\n }\n\n if (valueB == null) {\n return -1;\n }\n\n if (valueB.localeCompare) {\n return valueB.localeCompare(valueA);\n }\n\n return valueA < valueB ? 1 : -1;\n };\n },\n create: function(sort) {\n return this[sort.dir](sort.field);\n }\n });\n\n map = function(array, callback) {\n var idx, length = array.length, result = new Array(length);\n\n for (idx = 0; idx < length; idx++) {\n result[idx] = callback(array[idx], idx, array);\n }\n\n return result;\n };\n\n var operators = (function() {\n\n function quote(str) {\n if (typeof str == \"string\") {\n str = str.replace(/[\\r\\n]+/g, \"\");\n }\n return JSON.stringify(str);\n }\n\n function textOp(impl) {\n return function(a, b, ignore, accentFoldingFiltering) {\n b += \"\";\n if (ignore) {\n a = \"(\" + a + \" + '').toString()\" + ((accentFoldingFiltering) ? \".toLocaleLowerCase('\" + accentFoldingFiltering + \"')\" : \".toLowerCase()\");\n b = ((accentFoldingFiltering) ? b.toLocaleLowerCase(accentFoldingFiltering) : b.toLowerCase());\n }\n return impl(a, quote(b), ignore);\n };\n }\n\n function operator(op, a, b, ignore, accentFoldingFiltering) {\n if (b != null) {\n if (typeof b === STRING) {\n var date = dateRegExp.exec(b);\n if (date) {\n b = new Date(+date[1]);\n } else if (ignore) {\n b = quote(((accentFoldingFiltering) ? b.toLocaleLowerCase(accentFoldingFiltering) : b.toLowerCase()));\n a = \"((\" + a + \" || '')+'')\" + ((accentFoldingFiltering) ? \".toLocaleLowerCase('\" + accentFoldingFiltering + \"')\" : \".toLowerCase()\");\n } else {\n b = quote(b);\n }\n }\n\n if (b.getTime) {\n //b looks like a Date\n a = \"(\" + a + \"&&\" + a + \".getTime?\" + a + \".getTime():\" + a + \")\";\n b = b.getTime();\n }\n }\n\n return a + \" \" + op + \" \" + b;\n }\n\n function getMatchRegexp(pattern) {\n // take a pattern, as supported by Excel match filter, and\n // convert it to the equivalent JS regular expression.\n // Excel patterns support:\n //\n // * - match any sequence of characters\n // ? - match a single character\n //\n // to match a literal * or ?, they must be prefixed by a tilde (~)\n for (var rx = \"/^\", esc = false, i = 0; i < pattern.length; ++i) {\n var ch = pattern.charAt(i);\n if (esc) {\n rx += \"\\\\\" + ch;\n } else if (ch == \"~\") {\n esc = true;\n continue;\n } else if (ch == \"*\") {\n rx += \".*\";\n } else if (ch == \"?\") {\n rx += \".\";\n } else if (\".+^$()[]{}|\\\\/\\n\\r\\u2028\\u2029\\xA0\".indexOf(ch) >= 0) {\n rx += \"\\\\\" + ch;\n } else {\n rx += ch;\n }\n esc = false;\n }\n return rx + \"$/\";\n }\n\n return {\n quote: function(value) {\n if (value && value.getTime) {\n return \"new Date(\" + value.getTime() + \")\";\n }\n return quote(value);\n },\n eq: function(a, b, ignore, accentFoldingFiltering) {\n return operator(\"==\", a, b, ignore, accentFoldingFiltering);\n },\n neq: function(a, b, ignore, accentFoldingFiltering) {\n return operator(\"!=\", a, b, ignore, accentFoldingFiltering);\n },\n gt: function(a, b, ignore) {\n return operator(\">\", a, b, ignore);\n },\n gte: function(a, b, ignore) {\n return operator(\">=\", a, b, ignore);\n },\n lt: function(a, b, ignore) {\n return operator(\"<\", a, b, ignore);\n },\n lte: function(a, b, ignore) {\n return operator(\"<=\", a, b, ignore);\n },\n startswith: textOp(function(a, b) {\n return a + \".lastIndexOf(\" + b + \", 0) == 0\";\n }),\n doesnotstartwith: textOp(function(a, b) {\n return a + \".lastIndexOf(\" + b + \", 0) == -1\";\n }),\n endswith: textOp(function(a, b) {\n var n = b ? b.length - 2 : 0;\n return a + \".indexOf(\" + b + \", \" + a + \".length - \" + n + \") >= 0\";\n }),\n doesnotendwith: textOp(function(a, b) {\n var n = b ? b.length - 2 : 0;\n return a + \".indexOf(\" + b + \", \" + a + \".length - \" + n + \") < 0\";\n }),\n contains: textOp(function(a, b) {\n return a + \".indexOf(\" + b + \") >= 0\";\n }),\n doesnotcontain: textOp(function(a, b) {\n return a + \".indexOf(\" + b + \") == -1\";\n }),\n matches: textOp(function(a, b) {\n b = b.substring(1, b.length - 1);\n return getMatchRegexp(b) + \".test(\" + a + \")\";\n }),\n doesnotmatch: textOp(function(a, b) {\n b = b.substring(1, b.length - 1);\n return \"!\" + getMatchRegexp(b) + \".test(\" + a + \")\";\n }),\n isempty: function(a) {\n return a + \" === ''\";\n },\n isnotempty: function(a) {\n return a + \" !== ''\";\n },\n isnull: function(a) {\n return \"(\" + a + \" == null)\";\n },\n isnotnull: function(a) {\n return \"(\" + a + \" != null)\";\n },\n isnullorempty: function(a) {\n return \"(\" + a + \" === null) || (\" + a + \" === '')\";\n },\n isnotnullorempty: function(a) {\n return \"(\" + a + \" !== null) && (\" + a + \" !== '')\";\n }\n };\n })();\n\n function Query(data) {\n this.data = data || [];\n }\n\n Query.filterExpr = function(expression) {\n var expressions = [],\n logic = { and: \" && \", or: \" || \" },\n idx,\n length,\n filter,\n expr,\n fieldFunctions = [],\n operatorFunctions = [],\n field,\n operator,\n filters = expression.filters;\n\n for (idx = 0, length = filters.length; idx < length; idx++) {\n filter = filters[idx];\n field = filter.field;\n operator = filter.operator;\n\n if (filter.filters) {\n expr = Query.filterExpr(filter);\n //Nested function fields or operators - update their index e.g. __o[0] -> __o[1]\n filter = expr.expression\n .replace(/__o\\[(\\d+)\\]/g, function(match, index) {\n index = +index;\n return \"__o[\" + (operatorFunctions.length + index) + \"]\";\n })\n .replace(/__f\\[(\\d+)\\]/g, function(match, index) {\n index = +index;\n return \"__f[\" + (fieldFunctions.length + index) + \"]\";\n });\n\n operatorFunctions.push.apply(operatorFunctions, expr.operators);\n fieldFunctions.push.apply(fieldFunctions, expr.fields);\n } else {\n if (typeof field === FUNCTION) {\n expr = \"__f[\" + fieldFunctions.length + \"](d)\";\n fieldFunctions.push(field);\n } else {\n expr = kendo.expr(field);\n }\n\n if (typeof operator === FUNCTION) {\n filter = \"__o[\" + operatorFunctions.length + \"](\" + expr + \", \" + operators.quote(filter.value) + \")\";\n operatorFunctions.push(operator);\n } else {\n filter = operators[(operator || \"eq\").toLowerCase()](expr, filter.value, filter.ignoreCase !== undefined ? filter.ignoreCase : true, expression.accentFoldingFiltering);\n }\n }\n\n expressions.push(filter);\n }\n\n return { expression: \"(\" + expressions.join(logic[expression.logic]) + \")\", fields: fieldFunctions, operators: operatorFunctions };\n };\n\n function normalizeSort(field, dir) {\n if (field) {\n var descriptor = typeof field === STRING ? { field: field, dir: dir } : field,\n descriptors = isArray(descriptor) ? descriptor : (descriptor !== undefined ? [descriptor] : []);\n\n return grep(descriptors, function(d) { return !!d.dir; });\n }\n }\n\n function sortFields(sorts, dir) {\n var sortObject = {};\n\n if (sorts) {\n var descriptor = typeof sorts === STRING ? { field: sorts, dir: dir } : sorts,\n descriptors = isArray(descriptor) ? descriptor : (descriptor !== undefined ? [descriptor] : []);\n\n for (var i = 0; i < descriptors.length; i++) {\n sortObject[descriptors[i].field] = { dir: descriptors[i].dir, index: i + 1 };\n }\n }\n\n return sortObject;\n }\n\n var operatorMap = {\n \"==\": \"eq\",\n equals: \"eq\",\n isequalto: \"eq\",\n equalto: \"eq\",\n equal: \"eq\",\n \"!=\": \"neq\",\n ne: \"neq\",\n notequals: \"neq\",\n isnotequalto: \"neq\",\n notequalto: \"neq\",\n notequal: \"neq\",\n \"<\": \"lt\",\n islessthan: \"lt\",\n lessthan: \"lt\",\n less: \"lt\",\n \"<=\": \"lte\",\n le: \"lte\",\n islessthanorequalto: \"lte\",\n lessthanequal: \"lte\",\n \">\": \"gt\",\n isgreaterthan: \"gt\",\n greaterthan: \"gt\",\n greater: \"gt\",\n \">=\": \"gte\",\n isgreaterthanorequalto: \"gte\",\n greaterthanequal: \"gte\",\n ge: \"gte\",\n notsubstringof: \"doesnotcontain\",\n isnull: \"isnull\",\n isempty: \"isempty\",\n isnotempty: \"isnotempty\"\n };\n\n function normalizeOperator(expression) {\n var idx,\n length,\n filter,\n operator,\n filters = expression.filters;\n\n if (filters) {\n for (idx = 0, length = filters.length; idx < length; idx++) {\n filter = filters[idx];\n operator = filter.operator;\n\n if (operator && typeof operator === STRING) {\n filter.operator = operatorMap[operator.toLowerCase()] || operator;\n }\n\n normalizeOperator(filter);\n }\n }\n }\n\n function normalizeFilter(expression) {\n if (expression && !isEmptyObject(expression)) {\n if (isArray(expression) || !expression.filters) {\n expression = {\n logic: \"and\",\n filters: isArray(expression) ? expression : [expression]\n };\n }\n\n normalizeOperator(expression);\n\n return expression;\n }\n }\n\n Query.normalizeFilter = normalizeFilter;\n\n function compareDescriptor(f1, f2) {\n if (f1.logic || f2.logic) {\n return false;\n }\n\n return f1.field === f2.field && f1.value === f2.value && f1.operator === f2.operator;\n }\n\n function normalizeDescriptor(filter) {\n filter = filter || {};\n\n if (isEmptyObject(filter)) {\n return { logic: \"and\", filters: [] };\n }\n\n return normalizeFilter(filter);\n }\n\n function fieldComparer(a, b) {\n if (b.logic || (a.field > b.field)) {\n return 1;\n } else if (a.field < b.field) {\n return -1;\n } else {\n return 0;\n }\n }\n\n function compareFilters(expr1, expr2) {\n expr1 = normalizeDescriptor(expr1);\n expr2 = normalizeDescriptor(expr2);\n\n if (expr1.logic !== expr2.logic) {\n return false;\n }\n\n var f1, f2;\n var filters1 = (expr1.filters || []).slice();\n var filters2 = (expr2.filters || []).slice();\n\n if (filters1.length !== filters2.length) {\n return false;\n }\n\n filters1 = filters1.sort(fieldComparer);\n filters2 = filters2.sort(fieldComparer);\n\n for (var idx = 0; idx < filters1.length; idx++) {\n f1 = filters1[idx];\n f2 = filters2[idx];\n\n if (f1.logic && f2.logic) {\n if (!compareFilters(f1, f2)) {\n return false;\n }\n } else if (!compareDescriptor(f1, f2)) {\n return false;\n }\n }\n\n return true;\n }\n\n Query.compareFilters = compareFilters;\n\n function normalizeAggregate(expressions) {\n return isArray(expressions) ? expressions : [expressions];\n }\n\n function normalizeGroup(field, dir, compare, skipItemSorting) {\n var descriptor = typeof field === STRING ? { field: field, dir: dir, compare: compare, skipItemSorting: skipItemSorting } : field,\n descriptors = isArray(descriptor) ? descriptor : (descriptor !== undefined ? [descriptor] : []);\n\n return map(descriptors, function(d) {\n return {\n field: d.field,\n dir: d.dir || \"asc\",\n aggregates: d.aggregates,\n compare: d.compare,\n skipItemSorting: d.skipItemSorting\n };\n });\n }\n\n function normalizeGroupWithoutCompare(field, dir, compare) {\n var descriptors = normalizeGroup(field, dir, compare);\n\n for (var i = 0; i < descriptors.length; i++) {\n delete descriptors[i].compare;\n }\n\n return descriptors;\n }\n\n function anyGroupDescriptorHasCompare(groupDescriptors) {\n var descriptors = isArray(groupDescriptors) ? groupDescriptors : [groupDescriptors];\n\n for (var i = 0; i < descriptors.length; i++) {\n if (descriptors[i] && isFunction(descriptors[i].compare)) {\n return true;\n }\n }\n\n return false;\n }\n\n Query.prototype = {\n toArray: function() {\n return this.data;\n },\n range: function(index, count) {\n return new Query(this.data.slice(index, index + count));\n },\n skip: function(count) {\n return new Query(this.data.slice(count));\n },\n take: function(count) {\n return new Query(this.data.slice(0, count));\n },\n select: function(selector) {\n return new Query(map(this.data, selector));\n },\n order: function(selector, dir, inPlace) {\n var sort = { dir: dir };\n\n if (selector) {\n if (selector.compare) {\n sort.compare = selector.compare;\n } else {\n sort.field = selector;\n }\n }\n\n if (inPlace) {\n return new Query(this.data.sort(Comparer.create(sort)));\n }\n\n return new Query(this.data.slice(0).sort(Comparer.create(sort)));\n },\n orderBy: function(selector, inPlace) {\n return this.order(selector, \"asc\", inPlace);\n },\n orderByDescending: function(selector, inPlace) {\n return this.order(selector, \"desc\", inPlace);\n },\n sort: function(field, dir, comparer, inPlace) {\n var idx,\n length,\n descriptors = normalizeSort(field, dir),\n comparers = [];\n\n comparer = comparer || Comparer;\n\n if (descriptors.length) {\n for (idx = 0, length = descriptors.length; idx < length; idx++) {\n comparers.push(comparer.create(descriptors[idx]));\n }\n\n return this.orderBy({ compare: comparer.combine(comparers) }, inPlace);\n }\n\n return this;\n },\n\n filter: function(expressions) {\n var idx,\n current,\n length,\n compiled,\n predicate,\n data = this.data,\n fields,\n operators,\n result = [],\n filter;\n\n expressions = normalizeFilter(expressions);\n\n if (!expressions || expressions.filters.length === 0) {\n return this;\n }\n\n compiled = Query.filterExpr(expressions);\n fields = compiled.fields;\n operators = compiled.operators;\n\n predicate = filter = new Function(\"d, __f, __o\", \"return \" + compiled.expression);\n\n if (fields.length || operators.length) {\n filter = function(d) {\n return predicate(d, fields, operators);\n };\n }\n\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n current = data[idx];\n\n if (filter(current)) {\n result.push(current);\n }\n }\n\n return new Query(result);\n },\n\n group: function(descriptors, allData, options) {\n descriptors = normalizeGroup(descriptors || []);\n allData = allData || this.data;\n\n var that = this,\n result = new Query(that.data),\n descriptor;\n\n if (descriptors.length > 0) {\n descriptor = descriptors[0];\n\n if (options && options.groupPaging) {\n result = new Query(allData).groupAllData(descriptor, allData).select(function(group) {\n var data = new Query(allData).filter([{\n field: group.field,\n operator: \"eq\",\n value: group.value,\n ignoreCase: false\n }]);\n var items = descriptors.length > 1 ? new Query(group.items).group(descriptors.slice(1), data.toArray(), options).toArray() : group.items;\n return {\n field: group.field,\n value: group.value,\n hasSubgroups: descriptors.length > 1,\n items: items,\n aggregates: data.aggregate(descriptor.aggregates),\n uid: kendo.guid(),\n itemCount: items.length,\n subgroupCount: items.length\n };\n });\n\n } else {\n result = result.groupBy(descriptor).select(function(group) {\n var data = new Query(allData).filter([ { field: group.field, operator: \"eq\", value: group.value, ignoreCase: false } ]);\n return {\n field: group.field,\n value: group.value,\n items: descriptors.length > 1 ? new Query(group.items).group(descriptors.slice(1), data.toArray()).toArray() : group.items,\n hasSubgroups: descriptors.length > 1,\n aggregates: data.aggregate(descriptor.aggregates)\n };\n });\n }\n }\n return result;\n },\n\n groupBy: function(descriptor) {\n var that = this;\n\n if (isEmptyObject(descriptor) || !this.data.length) {\n return new Query([]);\n }\n\n var field = descriptor.field,\n sorted = descriptor.skipItemSorting ? this.data : this._sortForGrouping(field, descriptor.dir || \"asc\"),\n accessor = kendo.accessor(field),\n item,\n groupValue = accessor.get(sorted[0], field),\n group = {\n field: field,\n value: groupValue,\n items: []\n },\n currentValue,\n idx,\n len,\n result = [group];\n\n for (idx = 0, len = sorted.length; idx < len; idx++) {\n item = sorted[idx];\n currentValue = accessor.get(item, field);\n if (!groupValueComparer(groupValue, currentValue)) {\n groupValue = currentValue;\n group = {\n field: field,\n value: groupValue,\n items: []\n };\n result.push(group);\n }\n group.items.push(item);\n }\n\n result = that._sortGroups(result, descriptor);\n\n return new Query(result);\n },\n\n groupAllData: function(descriptor, allData) {\n if (isEmptyObject(descriptor) || this.data && !this.data.length) {\n return new Query([]);\n }\n\n var field = descriptor.field,\n sorted = descriptor.skipItemSorting ? allData : new Query(allData).sort(field, descriptor.dir || \"asc\", StableComparer).toArray(),\n accessor = kendo.accessor(field),\n item,\n groupValue = accessor.get(sorted[0], field),\n group = {\n field: field,\n value: groupValue,\n items: []\n },\n currentValue,\n idx,\n len,\n result = [group];\n\n for (idx = 0, len = sorted.length; idx < len; idx++) {\n item = sorted[idx];\n currentValue = accessor.get(item, field);\n if (!groupValueComparer(groupValue, currentValue)) {\n groupValue = currentValue;\n group = {\n field: field,\n value: groupValue,\n items: []\n };\n result.push(group);\n }\n group.items.push(item);\n }\n\n result = this._sortGroups(result, descriptor);\n\n return new Query(result);\n },\n\n _sortForGrouping: function(field, dir) {\n var idx, length,\n data = this.data;\n\n if (!stableSort) {\n for (idx = 0, length = data.length; idx < length; idx++) {\n data[idx].__position = idx;\n }\n\n data = new Query(data).sort(field, dir, StableComparer).toArray();\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n delete data[idx].__position;\n }\n return data;\n }\n\n return this.sort(field, dir).toArray();\n },\n\n _sortGroups: function(groups, descriptor) {\n var result = groups;\n\n if (descriptor && isFunction(descriptor.compare)) {\n result = new Query(result).order({ compare: descriptor.compare }, descriptor.dir || ASCENDING).toArray();\n }\n\n return result;\n },\n\n aggregate: function(aggregates) {\n var idx,\n len,\n result = {},\n state = {};\n\n if (aggregates && aggregates.length) {\n for (idx = 0, len = this.data.length; idx < len; idx++) {\n calculateAggregate(result, aggregates, this.data[idx], idx, len, state);\n }\n }\n return result;\n }\n };\n\n function groupValueComparer(a, b) {\n if (a && a.getTime && b && b.getTime) {\n return a.getTime() === b.getTime();\n }\n return a === b;\n }\n\n function calculateAggregate(accumulator, aggregates, item, index, length, state) {\n aggregates = aggregates || [];\n var idx,\n aggr,\n functionName,\n len = aggregates.length;\n\n for (idx = 0; idx < len; idx++) {\n aggr = aggregates[idx];\n functionName = aggr.aggregate;\n var field = aggr.field;\n accumulator[field] = accumulator[field] || {};\n state[field] = state[field] || {};\n state[field][functionName] = state[field][functionName] || {};\n accumulator[field][functionName] = functions[functionName.toLowerCase()](accumulator[field][functionName], item, kendo.accessor(field), index, length, state[field][functionName]);\n }\n }\n\n var functions = {\n sum: function(accumulator, item, accessor) {\n var value = accessor.get(item);\n\n if (!isNumber(accumulator)) {\n accumulator = value;\n } else if (isNumber(value)) {\n accumulator += value;\n }\n\n return accumulator;\n },\n count: function(accumulator) {\n return (accumulator || 0) + 1;\n },\n average: function(accumulator, item, accessor, index, length, state) {\n var value = accessor.get(item);\n\n if (state.count === undefined) {\n state.count = 0;\n }\n\n if (!isNumber(accumulator)) {\n accumulator = value;\n } else if (isNumber(value)) {\n accumulator += value;\n }\n\n if (isNumber(value)) {\n state.count++;\n }\n\n if (index == length - 1 && isNumber(accumulator)) {\n accumulator = accumulator / state.count;\n }\n return accumulator;\n },\n max: function(accumulator, item, accessor) {\n var value = accessor.get(item);\n\n if (!isNumber(accumulator) && !isDate(accumulator)) {\n accumulator = value;\n }\n\n if (accumulator < value && (isNumber(value) || isDate(value))) {\n accumulator = value;\n }\n return accumulator;\n },\n min: function(accumulator, item, accessor) {\n var value = accessor.get(item);\n\n if (!isNumber(accumulator) && !isDate(accumulator)) {\n accumulator = value;\n }\n\n if (accumulator > value && (isNumber(value) || isDate(value))) {\n accumulator = value;\n }\n return accumulator;\n }\n };\n\n function isNumber(val) {\n return typeof val === \"number\" && !isNaN(val);\n }\n\n function isDate(val) {\n return val && val.getTime;\n }\n\n function toJSON(array) {\n var idx, length = array.length, result = new Array(length);\n\n for (idx = 0; idx < length; idx++) {\n result[idx] = array[idx].toJSON();\n }\n\n return result;\n }\n\n Query.normalizeGroup = normalizeGroup;\n Query.normalizeSort = normalizeSort;\n\n Query.process = function(data, options, inPlace) {\n options = options || {};\n\n var group = options.group;\n var customGroupSort = anyGroupDescriptorHasCompare(normalizeGroup(group || []));\n var query = new Query(data),\n groupDescriptorsWithoutCompare = normalizeGroupWithoutCompare(group || []),\n normalizedSort = normalizeSort(options.sort || []),\n sort = customGroupSort ? normalizedSort : groupDescriptorsWithoutCompare.concat(normalizedSort),\n groupDescriptorsWithoutSort,\n total,\n filterCallback = options.filterCallback,\n filter = options.filter,\n skip = options.skip,\n take = options.take;\n\n if (sort && inPlace) {\n query = query.sort(sort, undefined, undefined, inPlace);\n }\n\n if (filter) {\n query = query.filter(filter);\n\n if (filterCallback) {\n query = filterCallback(query);\n }\n\n total = query.toArray().length;\n }\n\n if (sort) {\n if (!inPlace) {\n query = query.sort(sort);\n }\n\n if (group) {\n data = query.toArray();\n }\n }\n\n if (customGroupSort) {\n query = query.group(group, data, options);\n\n if (skip !== undefined && take !== undefined && !options.groupPaging) {\n query = new Query(flatGroups(query.toArray())).range(skip, take);\n\n groupDescriptorsWithoutSort = map(groupDescriptorsWithoutCompare, function(groupDescriptor) {\n return extend({}, groupDescriptor, {\n skipItemSorting: true\n });\n });\n\n query = query.group(groupDescriptorsWithoutSort, data, options);\n }\n } else {\n if (skip !== undefined && take !== undefined) {\n total = query.data.length;\n\n if (skip + take > total && options.virtual) {\n skip -= skip + take - total;\n skip = skip < 0 ? 0 : skip;\n }\n query = query.range(skip, take);\n }\n\n if (group && (!isEmptyObject(group) || group.length !== 0)) {\n query = query.group(group, data, options);\n }\n }\n\n return {\n total: total,\n data: query.toArray()\n };\n };\n\n var LocalTransport = Class.extend({\n init: function(options) {\n this.data = options.data;\n },\n\n read: function(options) {\n options.success(this.data);\n },\n update: function(options) {\n options.success(options.data);\n },\n create: function(options) {\n options.success(options.data);\n },\n destroy: function(options) {\n options.success(options.data);\n }\n });\n\n var RemoteTransport = Class.extend( {\n init: function(options) {\n var that = this, parameterMap;\n\n options = that.options = extend({}, that.options, options);\n\n each(crud, function(index, type) {\n if (typeof options[type] === STRING) {\n options[type] = {\n url: options[type]\n };\n }\n });\n\n that.cache = options.cache ? Cache.create(options.cache) : {\n find: noop,\n add: noop\n };\n\n parameterMap = options.parameterMap;\n\n if (options.submit) {\n that.submit = options.submit;\n }\n\n if (isFunction(options.push)) {\n that.push = options.push;\n }\n\n if (!that.push) {\n that.push = identity;\n }\n\n that.parameterMap = isFunction(parameterMap) ? parameterMap : function(options) {\n var result = {};\n\n each(options, function(option, value) {\n if (option in parameterMap) {\n option = parameterMap[option];\n if (isPlainObject(option)) {\n value = option.value(value);\n option = option.key;\n }\n }\n\n result[option] = value;\n });\n\n return result;\n };\n },\n\n options: {\n parameterMap: identity\n },\n\n create: function(options) {\n return ajax(this.setup(options, CREATE));\n },\n\n read: function(options) {\n var that = this,\n success,\n error,\n result,\n cache = that.cache;\n\n options = that.setup(options, READ);\n\n success = options.success || noop;\n error = options.error || noop;\n\n result = cache.find(options.data);\n\n if (result !== undefined) {\n success(result);\n } else {\n options.success = function(result) {\n cache.add(options.data, result);\n\n success(result);\n };\n\n $.ajax(options);\n }\n },\n\n update: function(options) {\n return ajax(this.setup(options, UPDATE));\n },\n\n destroy: function(options) {\n return ajax(this.setup(options, DESTROY));\n },\n\n setup: function(options, type) {\n options = options || {};\n\n var that = this,\n parameters,\n operation = that.options[type],\n data = isFunction(operation.data) ? operation.data(options.data) : operation.data;\n\n options = extend(true, {}, operation, options);\n parameters = extend(true, {}, data, options.data);\n\n options.data = that.parameterMap(parameters, type);\n\n if (isFunction(options.url)) {\n options.url = options.url(parameters);\n }\n\n return options;\n }\n });\n\n var Cache = Class.extend({\n init: function() {\n this._store = {};\n },\n add: function(key, data) {\n if (key !== undefined) {\n this._store[stringify(key)] = data;\n }\n },\n find: function(key) {\n return this._store[stringify(key)];\n },\n clear: function() {\n this._store = {};\n },\n remove: function(key) {\n delete this._store[stringify(key)];\n }\n });\n\n Cache.create = function(options) {\n var store = {\n \"inmemory\": function() { return new Cache(); }\n };\n\n if (isPlainObject(options) && isFunction(options.find)) {\n return options;\n }\n\n if (options === true) {\n return new Cache();\n }\n\n return store[options]();\n };\n\n function serializeRecords(data, getters, modelInstance, originalFieldNames, fieldNames) {\n var record,\n getter,\n originalName,\n idx,\n setters = {},\n length;\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n record = data[idx];\n for (getter in getters) {\n originalName = fieldNames[getter];\n\n if (originalName && originalName !== getter) {\n if (!setters[originalName]) {\n setters[originalName] = kendo.setter(originalName);\n }\n setters[originalName](record, getters[getter](record));\n delete record[getter];\n }\n }\n }\n }\n\n function convertRecords(data, getters, modelInstance, originalFieldNames, fieldNames) {\n var record,\n getter,\n originalName,\n idx,\n length;\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n record = data[idx];\n for (getter in getters) {\n record[getter] = modelInstance._parse(getter, getters[getter](record));\n\n originalName = fieldNames[getter];\n if (originalName && originalName !== getter) {\n delete record[originalName];\n }\n }\n }\n }\n\n function convertGroup(data, getters, modelInstance, originalFieldNames, fieldNames) {\n var record,\n idx,\n fieldName,\n length;\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n record = data[idx];\n\n fieldName = originalFieldNames[record.field];\n if (fieldName && fieldName != record.field) {\n record.field = fieldName;\n }\n\n record.value = modelInstance._parse(record.field, record.value);\n\n if (record.items) {\n if (record.hasSubgroups) {\n convertGroup(record.items, getters, modelInstance, originalFieldNames, fieldNames);\n } else {\n convertRecords(record.items, getters, modelInstance, originalFieldNames, fieldNames);\n }\n }\n }\n }\n\n function wrapDataAccess(originalFunction, model, converter, getters, originalFieldNames, fieldNames) {\n return function(data) {\n data = originalFunction(data);\n\n return wrapDataAccessBase(model, converter, getters, originalFieldNames, fieldNames)(data);\n };\n }\n\n function wrapDataAccessBase(model, converter, getters, originalFieldNames, fieldNames) {\n return function(data) {\n\n if (data && !isEmptyObject(getters)) {\n if (toString.call(data) !== \"[object Array]\" && !(data instanceof ObservableArray)) {\n data = [data];\n }\n\n converter(data, getters, new model(), originalFieldNames, fieldNames);\n }\n\n return data || [];\n };\n }\n\n var DataReader = Class.extend({\n init: function(schema) {\n var that = this, member, get, model, base;\n\n schema = schema || {};\n\n for (member in schema) {\n get = schema[member];\n\n that[member] = typeof get === STRING ? getter(get) : get;\n }\n\n base = schema.modelBase || Model;\n\n if (isPlainObject(that.model)) {\n that.model = model = base.define(that.model);\n }\n\n var dataFunction = that.data.bind(that);\n\n that._dataAccessFunction = dataFunction;\n\n if (that.model) {\n var groupsFunction = that.groups.bind(that),\n serializeFunction = that.serialize.bind(that),\n originalFieldNames = {},\n getters = {},\n serializeGetters = {},\n fieldNames = {},\n shouldSerialize = false,\n fieldName,\n name;\n\n model = that.model;\n\n if (model.fields) {\n each(model.fields, function(field, value) {\n var fromName;\n\n fieldName = field;\n\n if (isPlainObject(value) && value.field) {\n fieldName = value.field;\n } else if (typeof value === STRING) {\n fieldName = value;\n }\n\n if (isPlainObject(value) && value.from) {\n fromName = value.from;\n }\n\n shouldSerialize = shouldSerialize || (fromName && fromName !== field) || fieldName !== field;\n name = fromName || fieldName;\n getters[field] = name.indexOf(\".\") !== -1 ? getter(name, true) : getter(name);\n serializeGetters[field] = getter(field);\n originalFieldNames[fromName || fieldName] = field;\n fieldNames[field] = fromName || fieldName;\n });\n\n if (!schema.serialize && shouldSerialize) {\n that.serialize = wrapDataAccess(serializeFunction, model, serializeRecords, serializeGetters, originalFieldNames, fieldNames);\n }\n }\n\n that._dataAccessFunction = dataFunction;\n that._wrapDataAccessBase = wrapDataAccessBase(model, convertRecords, getters, originalFieldNames, fieldNames);\n that.data = wrapDataAccess(dataFunction, model, convertRecords, getters, originalFieldNames, fieldNames);\n that.groups = wrapDataAccess(groupsFunction, model, convertGroup, getters, originalFieldNames, fieldNames);\n }\n },\n errors: function(data) {\n return data ? data.errors : null;\n },\n parse: identity,\n data: identity,\n total: function(data) {\n return data.length;\n },\n groups: identity,\n aggregates: function() {\n return {};\n },\n serialize: function(data) {\n return data;\n }\n });\n\n function fillLastGroup(originalGroup, newGroup) {\n var currOriginal;\n var currentNew;\n\n if (newGroup.items && newGroup.items.length) {\n for (var i = 0; i < newGroup.items.length; i++) {\n currOriginal = originalGroup.items[originalGroup.items.length - 1];\n currentNew = newGroup.items[i];\n if (currOriginal && currentNew) {\n if (currOriginal.hasSubgroups && currOriginal.value == currentNew.value) {\n fillLastGroup(currOriginal, currentNew);\n } else if (currOriginal.field && currOriginal.value == currentNew.value) {\n currOriginal.items.omitChangeEvent = true;\n currOriginal.items.push.apply(currOriginal.items, currentNew.items);\n currOriginal.items.omitChangeEvent = false;\n } else {\n originalGroup.items.omitChangeEvent = true;\n originalGroup.items.push.apply(originalGroup.items, [currentNew]);\n originalGroup.items.omitChangeEvent = false;\n }\n } else if (currentNew) {\n originalGroup.items.omitChangeEvent = true;\n originalGroup.items.push.apply(originalGroup.items, [currentNew]);\n originalGroup.items.omitChangeEvent = false;\n }\n }\n }\n }\n function mergeGroups(target, dest, skip, take) {\n var group,\n idx = 0,\n items;\n\n while (dest.length && take) {\n group = dest[idx];\n items = group.items;\n\n var length = items.length;\n\n if (target && target.field === group.field && target.value === group.value) {\n if (target.hasSubgroups && target.items.length) {\n mergeGroups(target.items[target.items.length - 1], group.items, skip, take);\n } else {\n items = items.slice(skip, skip + take);\n target.items = target.items.concat(items);\n }\n dest.splice(idx--, 1);\n } else if (group.hasSubgroups && items.length) {\n mergeGroups(group, items, skip, take);\n if (!group.items.length) {\n dest.splice(idx--, 1);\n }\n } else {\n items = items.slice(skip, skip + take);\n group.items = items;\n\n if (!group.items.length) {\n dest.splice(idx--, 1);\n }\n }\n\n if (items.length === 0) {\n skip -= length;\n } else {\n skip = 0;\n take -= items.length;\n }\n\n if (++idx >= dest.length) {\n break;\n }\n }\n\n if (idx < dest.length) {\n dest.splice(idx, dest.length - idx);\n }\n }\n\n function flatGroups(groups, indexFunction) {\n var result = [];\n var groupsLength = (groups || []).length;\n var group;\n var items;\n var indexFn = isFunction(indexFunction) ? indexFunction : function(array, index) {\n return array[index];\n };\n\n for (var groupIndex = 0; groupIndex < groupsLength; groupIndex++) {\n group = indexFn(groups, groupIndex);\n\n if (group.hasSubgroups) {\n result = result.concat(flatGroups(group.items));\n } else {\n items = group.items;\n\n for (var itemIndex = 0; itemIndex < items.length; itemIndex++) {\n result.push(indexFn(items, itemIndex));\n }\n }\n }\n return result;\n }\n\n function flattenGroups(data) {\n var idx,\n result = [],\n length,\n items,\n itemIndex;\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n var group = data.at(idx);\n if (group.items) {\n if (group.hasSubgroups) {\n result = result.concat(flattenGroups(group.items));\n } else {\n items = group.items;\n for (itemIndex = 0; itemIndex < items.length; itemIndex++) {\n result.push(items.at(itemIndex));\n }\n }\n }\n }\n return result;\n }\n\n function wrapGroupItems(data, model) {\n var idx, length, group;\n if (model) {\n for (idx = 0, length = data.length; idx < length; idx++) {\n group = data.at(idx);\n if (group.items) {\n if (group.hasSubgroups) {\n wrapGroupItems(group.items, model);\n } else {\n group.items = new LazyObservableArray(group.items, model, group.items._events);\n }\n }\n }\n }\n }\n\n function eachGroupItems(data, func) {\n for (var idx = 0; idx < data.length; idx++) {\n if (data[idx].hasSubgroups) {\n if (eachGroupItems(data[idx].items, func)) {\n return true;\n }\n } else if (func(data[idx].items, data[idx])) {\n return true;\n }\n }\n }\n\n function replaceInRanges(ranges, data, item, observable) {\n for (var idx = 0; idx < ranges.length; idx++) {\n if (ranges[idx].data === data) {\n break;\n }\n if (replaceInRange(ranges[idx].data, item, observable)) {\n break;\n }\n }\n }\n\n function replaceInRange(items, item, observable) {\n for (var idx = 0, length = items.length; idx < length; idx++) {\n if (items[idx] && items[idx].hasSubgroups) {\n return replaceInRange(items[idx].items, item, observable);\n } else if (items[idx] === item || items[idx] === observable) {\n items[idx] = observable;\n return true;\n }\n }\n }\n\n function replaceWithObservable(view, data, ranges, type, serverGrouping) {\n for (var viewIndex = 0, length = view.length; viewIndex < length; viewIndex++) {\n var item = view[viewIndex];\n\n if (!item || item instanceof type) {\n continue;\n }\n\n if (item.hasSubgroups !== undefined && !serverGrouping) {\n replaceWithObservable(item.items, data, ranges, type, serverGrouping);\n } else {\n for (var idx = 0; idx < data.length; idx++) {\n if (data[idx] === item) {\n view[viewIndex] = data.at(idx);\n replaceInRanges(ranges, data, item, view[viewIndex]);\n break;\n }\n }\n }\n }\n }\n\n function removeModel(data, model) {\n if (!data) {\n return;\n }\n var length = data.length;\n var dataItem;\n var idx;\n\n for (idx = 0; idx < length; idx++) {\n dataItem = data[idx];\n\n if (dataItem.uid && dataItem.uid == model.uid) {\n data.splice(idx, 1);\n return dataItem;\n }\n }\n }\n\n function indexOfPristineModel(data, model) {\n if (model) {\n return indexOf(data, function(item) {\n return (item.uid && item.uid == model.uid) || (item[model.idField] === model.id && model.id !== model._defaultId);\n });\n }\n return -1;\n }\n\n function indexOfModel(data, model) {\n if (model) {\n return indexOf(data, function(item) {\n return item.uid == model.uid;\n });\n }\n return -1;\n }\n\n function indexOf(data, comparer) {\n var idx, length;\n if (!data) {\n return;\n }\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n if (comparer(data[idx])) {\n return idx;\n }\n }\n\n return -1;\n }\n\n function fieldNameFromModel(fields, name) {\n if (fields && !isEmptyObject(fields)) {\n var descriptor = fields[name];\n var fieldName;\n if (isPlainObject(descriptor)) {\n fieldName = descriptor.from || descriptor.field || name;\n } else {\n fieldName = fields[name] || name;\n }\n\n if (isFunction(fieldName)) {\n return name;\n }\n\n return fieldName;\n }\n return name;\n }\n\n function convertFilterDescriptorsField(descriptor, model) {\n var idx,\n length,\n target = {};\n\n for (var field in descriptor) {\n if (field !== \"filters\") {\n target[field] = descriptor[field];\n }\n }\n\n if (descriptor.filters) {\n target.filters = [];\n for (idx = 0, length = descriptor.filters.length; idx < length; idx++) {\n target.filters[idx] = convertFilterDescriptorsField(descriptor.filters[idx], model);\n }\n } else {\n target.field = fieldNameFromModel(model.fields, target.field);\n }\n return target;\n }\n\n function convertDescriptorsField(descriptors, model) {\n var idx,\n length,\n result = [],\n target,\n descriptor;\n\n for (idx = 0, length = descriptors.length; idx < length; idx ++) {\n target = {};\n\n descriptor = descriptors[idx];\n\n for (var field in descriptor) {\n target[field] = descriptor[field];\n }\n\n target.field = fieldNameFromModel(model.fields, target.field);\n\n if (target.aggregates && isArray(target.aggregates)) {\n target.aggregates = convertDescriptorsField(target.aggregates, model);\n }\n result.push(target);\n }\n return result;\n }\n\n var DataSource = Observable.extend({\n init: function(options) {\n var that = this, model, data;\n\n if (options) {\n data = options.data;\n }\n\n options = that.options = extend({}, that.options, options);\n\n that._map = {};\n that._prefetch = {};\n that._data = [];\n that._pristineData = [];\n that._ranges = [];\n that._view = [];\n that._pristineTotal = 0;\n that._destroyed = [];\n that._pageSize = options.pageSize;\n that._page = options.page || (options.pageSize ? 1 : undefined);\n that._sort = normalizeSort(options.sort);\n that._sortFields = sortFields(options.sort);\n that._filter = normalizeFilter(options.filter);\n that._group = normalizeGroup(options.group);\n that._aggregate = options.aggregate;\n that._total = options.total;\n that._groupPaging = options.groupPaging;\n\n if (that._groupPaging) {\n that._groupsState = {};\n }\n that._shouldDetachObservableParents = true;\n\n Observable.fn.init.call(that);\n\n that.transport = Transport.create(options, data, that);\n\n if (isFunction(that.transport.push)) {\n that.transport.push({\n pushCreate: that._pushCreate.bind(that),\n pushUpdate: that._pushUpdate.bind(that),\n pushDestroy: that._pushDestroy.bind(that)\n });\n }\n\n if (options.offlineStorage != null) {\n if (typeof options.offlineStorage == \"string\") {\n var key = options.offlineStorage;\n\n that._storage = {\n getItem: function() {\n return JSON.parse(localStorage.getItem(key));\n },\n setItem: function(item) {\n localStorage.setItem(key, stringify(that.reader.serialize(item)));\n }\n };\n } else {\n that._storage = options.offlineStorage;\n }\n }\n\n that.reader = new kendo.data.readers[options.schema.type || \"json\" ](options.schema);\n\n model = that.reader.model || {};\n\n that._detachObservableParents();\n\n that._data = that._observe(that._data);\n that._online = true;\n\n that.bind([\"push\", ERROR, CHANGE, REQUESTSTART, SYNC, REQUESTEND, PROGRESS], options);\n },\n\n options: {\n data: null,\n schema: {\n modelBase: Model\n },\n offlineStorage: null,\n serverSorting: false,\n serverPaging: false,\n serverFiltering: false,\n serverGrouping: false,\n serverAggregates: false,\n batch: false,\n inPlaceSort: false\n },\n\n clone: function() {\n return this;\n },\n\n online: function(value) {\n if (value !== undefined) {\n if (this._online != value) {\n this._online = value;\n\n if (value) {\n return this.sync();\n }\n }\n\n return $.Deferred().resolve().promise();\n } else {\n return this._online;\n }\n },\n\n offlineData: function(state) {\n if (this.options.offlineStorage == null) {\n return null;\n }\n\n if (state !== undefined) {\n return this._storage.setItem(state);\n }\n\n return this._storage.getItem() || [];\n },\n\n _isServerGrouped: function() {\n var group = this.group() || [];\n\n return this.options.serverGrouping && group.length;\n },\n\n _isServerGroupPaged: function() {\n return this._isServerGrouped() && this._groupPaging;\n },\n\n _isGroupPaged: function() {\n var group = this._group || [];\n\n return this._groupPaging && group.length;\n },\n\n _pushCreate: function(result) {\n this._push(result, \"pushCreate\");\n },\n\n _pushUpdate: function(result) {\n this._push(result, \"pushUpdate\");\n },\n\n _pushDestroy: function(result) {\n this._push(result, \"pushDestroy\");\n },\n\n _push: function(result, operation) {\n var data = this._readData(result);\n\n if (!data) {\n data = result;\n }\n\n this[operation](data);\n },\n\n _flatData: function(data, skip) {\n if (data) {\n if (this._isServerGrouped()) {\n return flattenGroups(data);\n }\n\n if (!skip) {\n for (var idx = 0; idx < data.length; idx++) {\n data.at(idx);\n }\n }\n }\n\n return data;\n },\n\n parent: noop,\n\n get: function(id) {\n var idx, length, data = this._flatData(this._data, this.options.useRanges);\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n if (data[idx].id == id) {\n return data[idx];\n }\n }\n },\n\n getByUid: function(id) {\n return this._getByUid(id, this._data);\n },\n\n _getByUid: function(id, dataItems) {\n var idx, length, data = this._flatData(dataItems, this.options.useRanges);\n\n if (!data) {\n return;\n }\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n if (data[idx].uid == id) {\n return data[idx];\n }\n }\n },\n\n indexOf: function(model) {\n return indexOfModel(this._data, model);\n },\n\n at: function(index) {\n return this._data.at(index);\n },\n\n data: function(value) {\n var that = this;\n if (value !== undefined) {\n that._detachObservableParents();\n that._data = this._observe(value);\n\n that._pristineData = value.slice(0);\n\n that._storeData();\n\n that._ranges = [];\n that.trigger(\"reset\");\n that._addRange(that._data);\n\n that._total = that._data.length;\n that._pristineTotal = that._total;\n\n that._process(that._data);\n } else {\n if (that._data) {\n for (var idx = 0; idx < that._data.length; idx++) {\n that._data.at(idx);\n }\n }\n\n return that._data;\n }\n },\n\n view: function(value) {\n if (value === undefined) {\n return this._view;\n } else {\n this._view = this._observeView(value);\n }\n },\n\n _observeView: function(data) {\n var that = this;\n replaceWithObservable(data, that._data, that._ranges, that.reader.model || ObservableObject, that._isServerGrouped());\n\n var view = new LazyObservableArray(data, that.reader.model);\n view.parent = function() { return that.parent(); };\n return view;\n },\n\n flatView: function() {\n var groups = this.group() || [];\n\n if (groups.length) {\n return flattenGroups(this._view);\n } else {\n return this._view;\n }\n },\n\n add: function(model) {\n return this.insert(this._data.length, model);\n },\n\n _createNewModel: function(model) {\n if (this.reader.model) {\n return new this.reader.model(model);\n }\n\n if (model instanceof ObservableObject) {\n return model;\n }\n\n return new ObservableObject(model);\n },\n\n insert: function(index, model) {\n if (!model) {\n model = index;\n index = 0;\n }\n\n if (!(model instanceof Model)) {\n model = this._createNewModel(model);\n }\n\n if (this._isServerGrouped()) {\n this._data.splice(index, 0, this._wrapInEmptyGroup(model));\n } else {\n this._data.splice(index, 0, model);\n }\n\n this._insertModelInRange(index, model);\n\n return model;\n },\n\n pushInsert: function(index, items) {\n var that = this;\n var rangeSpan = that._getCurrentRangeSpan();\n\n if (!items) {\n items = index;\n index = 0;\n }\n\n if (!isArray(items)) {\n items = [items];\n }\n\n var pushed = [];\n var autoSync = this.options.autoSync;\n this.options.autoSync = false;\n\n try {\n for (var idx = 0; idx < items.length; idx ++) {\n var item = items[idx];\n\n var result = this.insert(index, item);\n\n pushed.push(result);\n\n var pristine = result.toJSON();\n\n if (this._isServerGrouped()) {\n pristine = this._wrapInEmptyGroup(pristine);\n }\n\n this._pristineData.push(pristine);\n\n if (rangeSpan && rangeSpan.length) {\n $(rangeSpan).last()[0].pristineData.push(pristine);\n }\n\n index++;\n }\n } finally {\n this.options.autoSync = autoSync;\n }\n\n if (pushed.length) {\n this.trigger(\"push\", {\n type: \"create\",\n items: pushed\n });\n }\n },\n\n pushCreate: function(items) {\n this.pushInsert(this._data.length, items);\n },\n\n pushUpdate: function(items) {\n if (!isArray(items)) {\n items = [items];\n }\n\n var pushed = [];\n\n for (var idx = 0; idx < items.length; idx ++) {\n var item = items[idx];\n var model = this._createNewModel(item);\n\n var target = this.get(model.id);\n\n if (target) {\n pushed.push(target);\n\n target.accept(item);\n\n target.trigger(CHANGE);\n\n this._updatePristineForModel(target, item);\n } else {\n this.pushCreate(item);\n }\n }\n\n if (pushed.length) {\n this.trigger(\"push\", {\n type: \"update\",\n items: pushed\n });\n }\n },\n\n pushDestroy: function(items) {\n var pushed = this._removeItems(items);\n\n if (pushed.length) {\n this.trigger(\"push\", {\n type: \"destroy\",\n items: pushed\n });\n }\n },\n\n _removeItems: function(items, removePristine) {\n if (!isArray(items)) {\n items = [items];\n }\n\n var shouldRemovePristine = typeof removePristine !== \"undefined\" ? removePristine : true;\n\n var destroyed = [];\n var autoSync = this.options.autoSync;\n this.options.autoSync = false;\n try {\n for (var idx = 0; idx < items.length; idx ++) {\n var item = items[idx];\n var model = this._createNewModel(item);\n var found = false;\n\n this._eachItem(this._data, function(items) {\n for (var idx = 0; idx < items.length; idx++) {\n var item = items.at(idx);\n if (item.id === model.id) {\n destroyed.push(item);\n items.splice(idx, 1);\n found = true;\n break;\n }\n }\n });\n\n if (found && shouldRemovePristine) {\n this._removePristineForModel(model);\n this._destroyed.pop();\n }\n }\n } finally {\n this.options.autoSync = autoSync;\n }\n\n return destroyed;\n },\n\n pushMove: function(index, items) {\n var pushed = this._moveItems(index, items);\n\n if (pushed.length) {\n this.trigger(\"push\", {\n type: \"update\",\n items: pushed\n });\n }\n },\n\n _moveItems: function(index, items) {\n if (!isArray(items)) {\n items = [items];\n }\n\n var moved = [];\n var autoSync = this.options.autoSync;\n this.options.autoSync = false;\n\n try {\n for (var i = 0; i < items.length; i ++) {\n var item = items[i];\n var model = this._createNewModel(item);\n\n this._eachItem(this._data, function(dataItems) {\n for (var idx = 0; idx < dataItems.length; idx++) {\n var dataItem = dataItems.at(idx);\n if (dataItem.id === model.id) {\n moved.push(dataItem);\n dataItems.splice(index >= idx ? --index : index, 0, dataItems.splice(idx, 1)[0]);\n index++;\n break;\n }\n }\n });\n }\n } finally {\n this.options.autoSync = autoSync;\n }\n\n return moved;\n },\n\n remove: function(model) {\n var result,\n that = this,\n hasGroups = that._isServerGrouped();\n\n if (hasGroups && model.uid && (!model.isNew || !model.isNew())) {\n that._pushInDestroyed(model);\n }\n\n this._eachItem(that._data, function(items) {\n result = removeModel(items, model);\n\n if (result && hasGroups) {\n return true;\n }\n });\n\n this._removeModelFromRanges(model);\n\n return model;\n },\n\n destroyed: function() {\n return this._destroyed;\n },\n\n created: function() {\n var idx,\n length,\n result = [],\n data = this._flatData(this._data, this.options.useRanges);\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n if (data[idx].isNew && data[idx].isNew()) {\n result.push(data[idx]);\n }\n }\n return result;\n },\n\n updated: function() {\n var idx,\n length,\n result = [],\n data = this._flatData(this._data, this.options.useRanges);\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n if ((data[idx].isNew && !data[idx].isNew()) && data[idx].dirty) {\n result.push(data[idx]);\n }\n }\n return result;\n },\n\n sync: function() {\n var that = this,\n created = [],\n updated = [],\n destroyed = that._destroyed;\n\n var promise = $.Deferred().resolve().promise();\n\n if (that.online()) {\n\n if (!that.reader.model) {\n return promise;\n }\n\n created = that.created();\n updated = that.updated();\n\n var promises = [];\n\n if (that.options.batch && that.transport.submit) {\n promises = that._sendSubmit(created, updated, destroyed);\n } else {\n promises.push.apply(promises, that._send(\"create\", created));\n promises.push.apply(promises, that._send(\"update\", updated));\n promises.push.apply(promises, that._send(\"destroy\", destroyed));\n }\n\n promise = $.when\n .apply(null, promises)\n .then(function() {\n var idx, length;\n\n for (idx = 0, length = arguments.length; idx < length; idx++) {\n if (arguments[idx]) {\n that._accept(arguments[idx]);\n }\n }\n\n that._storeData(true);\n\n that._syncEnd();\n\n that._change({ action: \"sync\" });\n\n that.trigger(SYNC);\n\n if (that._isServerGroupPaged()) {\n that.read();\n }\n });\n } else {\n that._storeData(true);\n\n that._syncEnd();\n\n that._change({ action: \"sync\" });\n }\n\n return promise;\n },\n\n _syncEnd: noop,\n\n cancelChanges: function(model) {\n var that = this;\n\n if (model instanceof kendo.data.Model) {\n that._cancelModel(model);\n } else {\n that._destroyed = [];\n that._detachObservableParents();\n that._data = that._observe(that._pristineData);\n if (that.options.serverPaging) {\n that._total = that._pristineTotal;\n }\n\n that._ranges = [];\n that._addRange(that._data, 0);\n\n that._changesCanceled();\n\n that._change();\n\n that._markOfflineUpdatesAsDirty();\n\n if (that._isServerGrouped()) {\n that.read();\n }\n }\n },\n\n _changesCanceled: noop,\n\n _markOfflineUpdatesAsDirty: function() {\n var that = this;\n\n if (that.options.offlineStorage != null) {\n that._eachItem(that._data, function(items) {\n for (var idx = 0; idx < items.length; idx++) {\n var item = items.at(idx);\n if (item.__state__ == \"update\" || item.__state__ == \"create\") {\n item.dirty = true;\n }\n }\n });\n }\n },\n\n hasChanges: function() {\n var idx,\n length,\n data = this._flatData(this._data, this.options.useRanges);\n\n if (this._destroyed.length) {\n return true;\n }\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n if ((data[idx].isNew && data[idx].isNew()) || data[idx].dirty) {\n return true;\n }\n }\n\n return false;\n },\n\n _accept: function(result) {\n var that = this,\n models = result.models,\n response = result.response,\n idx = 0,\n serverGroup = that._isServerGrouped(),\n pristine = that._pristineData,\n type = result.type,\n length;\n\n that.trigger(REQUESTEND, { response: response, type: type });\n\n if (response && !isEmptyObject(response)) {\n response = that.reader.parse(response);\n\n if (that._handleCustomErrors(response)) {\n return;\n }\n\n response = that.reader.data(response);\n\n if (!isArray(response)) {\n response = [response];\n }\n } else {\n response = $.map(models, function(model) { return model.toJSON(); } );\n }\n\n if (type === \"destroy\") {\n that._destroyed = [];\n }\n\n for (idx = 0, length = models.length; idx < length; idx++) {\n if (type !== \"destroy\") {\n models[idx].accept(response[idx]);\n\n if (type === \"create\") {\n pristine.push(serverGroup ? that._wrapInEmptyGroup(models[idx].toJSON()) : response[idx]);\n } else if (type === \"update\") {\n that._updatePristineForModel(models[idx], response[idx]);\n }\n } else {\n that._removePristineForModel(models[idx]);\n }\n }\n },\n\n _updatePristineForModel: function(model, values) {\n this._executeOnPristineForModel(model, function(index, items) {\n kendo.deepExtend(items[index], values);\n });\n },\n\n _executeOnPristineForModel: function(model, callback) {\n this._eachPristineItem(\n function(items) {\n var index = indexOfPristineModel(items, model);\n if (index > -1) {\n callback(index, items);\n return true;\n }\n });\n },\n\n _removePristineForModel: function(model) {\n this._executeOnPristineForModel(model, function(index, items) {\n items.splice(index, 1);\n });\n },\n\n _readData: function(data) {\n var read = !this._isServerGrouped() ? this.reader.data : this.reader.groups;\n return read.call(this.reader, data);\n },\n\n _eachPristineItem: function(callback) {\n var that = this;\n var options = that.options;\n var rangeSpan = that._getCurrentRangeSpan();\n\n that._eachItem(that._pristineData, callback);\n\n if (options.serverPaging && options.useRanges) {\n each(rangeSpan, function(i, range) {\n that._eachItem(range.pristineData, callback);\n });\n }\n },\n\n _eachItem: function(data, callback) {\n if (data && data.length) {\n if (this._isServerGrouped()) {\n eachGroupItems(data, callback);\n } else {\n callback(data);\n }\n }\n },\n\n _pristineForModel: function(model) {\n var pristine,\n idx,\n callback = function(items) {\n idx = indexOfPristineModel(items, model);\n if (idx > -1) {\n pristine = items[idx];\n return true;\n }\n };\n\n this._eachPristineItem(callback);\n\n return pristine;\n },\n\n _cancelModel: function(model) {\n var that = this;\n var pristine = this._pristineForModel(model);\n\n this._eachItem(this._data, function(items) {\n var idx = indexOfModel(items, model);\n if (idx >= 0) {\n if (pristine && (!model.isNew() || pristine.__state__)) {\n items[idx].accept(pristine);\n\n if (pristine.__state__ == \"update\") {\n items[idx].dirty = true;\n }\n\n } else {\n that._modelCanceled(model);\n\n items.splice(idx, 1);\n\n that._removeModelFromRanges(model);\n }\n }\n });\n },\n\n _modelCanceled: noop,\n\n _submit: function(promises, data) {\n var that = this;\n\n that.trigger(REQUESTSTART, { type: \"submit\" });\n\n that.trigger(PROGRESS);\n\n that.transport.submit(extend({\n success: function(response, type) {\n var promise = $.grep(promises, function(x) {\n return x.type == type;\n })[0];\n\n if (promise) {\n promise.resolve({\n response: response,\n models: promise.models,\n type: type\n });\n }\n },\n error: function(response, status, error) {\n for (var idx = 0; idx < promises.length; idx++) {\n promises[idx].reject(response);\n }\n\n that.error(response, status, error);\n }\n }, data));\n },\n\n _sendSubmit: function(created, updated, destroyed) {\n var that = this,\n promises = [];\n\n if (that.options.batch) {\n if (created.length) {\n promises.push($.Deferred(function(deferred) {\n deferred.type = \"create\";\n deferred.models = created;\n }));\n }\n\n if (updated.length) {\n promises.push($.Deferred(function(deferred) {\n deferred.type = \"update\";\n deferred.models = updated;\n }));\n }\n\n if (destroyed.length) {\n promises.push($.Deferred(function(deferred) {\n deferred.type = \"destroy\";\n deferred.models = destroyed;\n }));\n }\n\n that._submit(promises, {\n data: {\n created: that.reader.serialize(toJSON(created)),\n updated: that.reader.serialize(toJSON(updated)),\n destroyed: that.reader.serialize(toJSON(destroyed))\n }\n });\n }\n\n return promises;\n },\n\n _promise: function(data, models, type) {\n var that = this;\n\n return $.Deferred(function(deferred) {\n that.trigger(REQUESTSTART, { type: type });\n\n that.trigger(PROGRESS);\n\n that.transport[type].call(that.transport, extend({\n success: function(response) {\n deferred.resolve({\n response: response,\n models: models,\n type: type\n });\n },\n error: function(response, status, error) {\n deferred.reject(response);\n that.error(response, status, error);\n }\n }, data));\n }).promise();\n },\n\n _send: function(method, data) {\n var that = this,\n idx,\n length,\n promises = [],\n converted = that.reader.serialize(toJSON(data));\n\n if (that.options.batch) {\n if (data.length) {\n promises.push(that._promise( { data: { models: converted } }, data , method));\n }\n } else {\n for (idx = 0, length = data.length; idx < length; idx++) {\n promises.push(that._promise( { data: converted[idx] }, [ data[idx] ], method));\n }\n }\n\n return promises;\n },\n\n read: function(data) {\n var that = this, params = that._params(data);\n var deferred = $.Deferred();\n\n that._queueRequest(params, function() {\n var isPrevented = that.trigger(REQUESTSTART, { type: \"read\" });\n if (!isPrevented) {\n that.trigger(PROGRESS);\n\n that._ranges = [];\n that.trigger(\"reset\");\n if (that.online()) {\n that.transport.read({\n data: params,\n success: function(data) {\n that._ranges = [];\n that.success(data, params);\n\n deferred.resolve();\n },\n error: function() {\n var args = slice.call(arguments);\n\n that.error.apply(that, args);\n\n deferred.reject.apply(deferred, args);\n }\n });\n } else if (that.options.offlineStorage != null) {\n that.success(that.offlineData(), params);\n\n deferred.resolve();\n }\n } else {\n that._dequeueRequest();\n\n deferred.resolve(isPrevented);\n }\n });\n\n return deferred.promise();\n },\n\n _readAggregates: function(data) {\n return this.reader.aggregates(data);\n },\n\n success: function(data) {\n var that = this,\n options = that.options,\n items,\n replaceSubset;\n\n that.trigger(REQUESTEND, { response: data, type: \"read\" });\n\n if (that.online()) {\n data = that.reader.parse(data);\n\n if (that._handleCustomErrors(data)) {\n that._dequeueRequest();\n return;\n }\n\n that._total = that.reader.total(data);\n\n if (that._isServerGroupPaged()) {\n that._serverGroupsTotal = that._total;\n }\n\n if (that._pageSize > that._total) {\n that._pageSize = that._total;\n if (that.options.pageSize && that.options.pageSize > that._pageSize) {\n that._pageSize = that.options.pageSize;\n }\n }\n\n if (that._aggregate && options.serverAggregates) {\n that._aggregateResult = that._readAggregates(data);\n }\n\n data = that._readData(data);\n\n that._destroyed = [];\n } else {\n data = that._readData(data);\n\n items = [];\n var itemIds = {};\n var model = that.reader.model;\n var idField = model ? model.idField : \"id\";\n var idx;\n\n for (idx = 0; idx < this._destroyed.length; idx++) {\n var id = this._destroyed[idx][idField];\n itemIds[id] = id;\n }\n\n for (idx = 0; idx < data.length; idx++) {\n var item = data[idx];\n var state = item.__state__;\n if (state == \"destroy\") {\n if (!itemIds[item[idField]]) {\n this._pushInDestroyed(this._createNewModel(item));\n }\n } else {\n items.push(item);\n }\n }\n\n data = items;\n\n that._total = data.length;\n }\n\n that._pristineTotal = that._total;\n replaceSubset = that._skip && that._data.length && that._skip < that._data.length;\n\n if (that.options.endless) {\n if (replaceSubset) {\n that._pristineData.splice(that._skip, that._pristineData.length);\n }\n items = data.slice(0);\n for (var j = 0; j < items.length; j++) {\n that._pristineData.push(items[j]);\n }\n } else {\n that._pristineData = data.slice(0);\n }\n\n that._detachObservableParents();\n\n if (that.options.endless) {\n that._data.unbind(CHANGE, that._changeHandler);\n\n if (that._isServerGrouped() && that._data[that._data.length - 1].value === data[0].value) {\n fillLastGroup(that._data[that._data.length - 1], data[0]);\n data.shift();\n }\n\n data = that._observe(data);\n if (replaceSubset) {\n that._data.splice(that._skip, that._data.length);\n }\n for (var i = 0; i < data.length; i++) {\n that._data.push(data[i]);\n }\n that._data.bind(CHANGE, that._changeHandler);\n } else {\n that._data = that._observe(data);\n }\n\n that._markOfflineUpdatesAsDirty();\n\n that._storeData();\n\n that._addRange(that._data);\n\n that._process(that._data);\n\n that._dequeueRequest();\n },\n\n _detachObservableParents: function() {\n if (this._data && this._shouldDetachObservableParents) {\n for (var idx = 0; idx < this._data.length; idx++) {\n if (this._data[idx].parent) {\n this._data[idx].parent = noop;\n }\n }\n }\n },\n\n _storeData: function(updatePristine) {\n var serverGrouping = this._isServerGrouped();\n var model = this.reader.model;\n\n function items(data) {\n var state = [];\n\n for (var idx = 0; idx < data.length; idx++) {\n var dataItem = data.at(idx);\n var item = dataItem.toJSON();\n\n if (serverGrouping && dataItem.items) {\n item.items = items(dataItem.items);\n } else {\n item.uid = dataItem.uid;\n\n if (model) {\n if (dataItem.isNew()) {\n item.__state__ = \"create\";\n } else if (dataItem.dirty) {\n item.__state__ = \"update\";\n }\n }\n }\n state.push(item);\n }\n\n return state;\n }\n\n if (this.options.offlineStorage != null) {\n var state = items(this._data);\n\n var destroyed = [];\n\n for (var idx = 0; idx < this._destroyed.length; idx++) {\n var item = this._destroyed[idx].toJSON();\n item.__state__ = \"destroy\";\n destroyed.push(item);\n }\n\n this.offlineData(state.concat(destroyed));\n\n if (updatePristine) {\n this._pristineData = this.reader.reader ? this.reader.reader._wrapDataAccessBase(state) : this.reader._wrapDataAccessBase(state);\n }\n }\n },\n\n _addRange: function(data, skip) {\n var that = this,\n start = typeof (skip) !== \"undefined\" ? skip : (that._skip || 0),\n end,\n range = {\n data: data,\n pristineData: data.toJSON(),\n timestamp: that._timeStamp()\n };\n\n if (this._isGroupPaged()) {\n end = start + data.length;\n range.outerStart = start;\n range.outerEnd = end;\n } else {\n end = start + that._flatData(data, true).length;\n }\n\n range.start = start;\n range.end = end;\n that._ranges.push(range);\n that._sortRanges();\n\n if (that._isGroupPaged()) {\n if (!that._groupsFlat) {\n that._groupsFlat = [];\n }\n that._appendToGroupsFlat(range.data);\n that._updateOuterRangesLength();\n }\n },\n\n _appendToGroupsFlat: function(data) {\n var length = data.length;\n\n for (var i = 0; i < length; i++) {\n this._groupsFlat.push(data[i]);\n }\n },\n\n _getGroupByUid: function(uid) {\n var length = this._groupsFlat.length;\n var group;\n\n for (var i = 0; i < length; i++) {\n group = this._groupsFlat[i];\n if (group.uid === uid) {\n return group;\n }\n }\n },\n\n _sortRanges: function() {\n this._ranges.sort(function(x, y) {\n return x.start - y.start;\n });\n },\n\n error: function(xhr, status, errorThrown) {\n this._dequeueRequest();\n this.trigger(REQUESTEND, { });\n this.trigger(ERROR, { xhr: xhr, status: status, errorThrown: errorThrown });\n },\n\n _params: function(data) {\n var that = this,\n options = extend({\n take: that.take(),\n skip: that.skip(),\n page: that.page(),\n pageSize: that.pageSize(),\n sort: that._sort,\n filter: that._filter,\n group: that._group,\n aggregate: that._aggregate,\n groupPaging: !!that._groupPaging\n }, data);\n\n if (!that.options.serverPaging) {\n delete options.take;\n delete options.skip;\n delete options.page;\n delete options.pageSize;\n }\n\n if (!that.options.serverGrouping) {\n delete options.group;\n } else if (that.reader.model && options.group) {\n options.group = convertDescriptorsField(options.group, that.reader.model);\n }\n\n if (!that.options.serverFiltering) {\n delete options.filter;\n } else if (that.reader.model && options.filter) {\n options.filter = convertFilterDescriptorsField(options.filter, that.reader.model);\n }\n\n if (!that.options.serverSorting) {\n delete options.sort;\n } else if (that.reader.model && options.sort) {\n options.sort = convertDescriptorsField(options.sort, that.reader.model);\n }\n\n if (!that.options.serverAggregates) {\n delete options.aggregate;\n } else if (that.reader.model && options.aggregate) {\n options.aggregate = convertDescriptorsField(options.aggregate, that.reader.model);\n }\n\n if (!that.options.groupPaging) {\n delete options.groupPaging;\n }\n\n return options;\n },\n\n _queueRequest: function(options, callback) {\n var that = this;\n if (!that._requestInProgress) {\n that._requestInProgress = true;\n that._pending = undefined;\n callback();\n } else {\n that._pending = { callback: callback.bind(that), options: options };\n }\n },\n\n _dequeueRequest: function() {\n var that = this;\n that._requestInProgress = false;\n if (that._pending) {\n that._queueRequest(that._pending.options, that._pending.callback);\n }\n },\n\n _handleCustomErrors: function(response) {\n if (this.reader.errors) {\n var errors = this.reader.errors(response);\n if (errors) {\n this.trigger(ERROR, { xhr: null, status: \"customerror\", errorThrown: \"custom error\", errors: errors });\n return true;\n }\n }\n return false;\n },\n\n _shouldWrap: function(data) {\n var model = this.reader.model;\n\n if (model && data.length) {\n return !(data[0] instanceof model);\n }\n\n return false;\n },\n\n _observe: function(data) {\n var that = this,\n model = that.reader.model;\n\n that._shouldDetachObservableParents = true;\n\n if (data instanceof ObservableArray) {\n that._shouldDetachObservableParents = false;\n if (that._shouldWrap(data)) {\n data.type = that.reader.model;\n data.wrapAll(data, data);\n }\n } else {\n var arrayType = that.pageSize() && !that.options.serverPaging ? LazyObservableArray : ObservableArray;\n data = new arrayType(data, that.reader.model);\n data.parent = function() { return that.parent(); };\n }\n\n if (that._isServerGrouped()) {\n wrapGroupItems(data, model);\n }\n\n if (that._changeHandler && that._data && that._data instanceof ObservableArray &&\n !(that.options.useRanges && that.options.serverPaging)) {\n that._data.unbind(CHANGE, that._changeHandler);\n } else {\n that._changeHandler = that._change.bind(that);\n }\n\n return data.bind(CHANGE, that._changeHandler);\n },\n\n _updateTotalForAction: function(action, items) {\n var that = this;\n\n var total = parseInt(that._total, 10);\n\n if (!isNumber(that._total)) {\n total = parseInt(that._pristineTotal, 10);\n }\n if (action === \"add\") {\n total += items.length;\n } else if (action === \"remove\") {\n total -= items.length;\n } else if (action !== \"itemchange\" && action !== \"sync\" && !that.options.serverPaging) {\n total = that._pristineTotal;\n } else if (action === \"sync\") {\n total = that._pristineTotal = parseInt(that._total, 10);\n }\n\n that._total = total;\n },\n\n _pushInDestroyed: function(model) {\n var isPushed = this._destroyed.find(function(item) {\n return item.uid === model.uid;\n });\n if (!isPushed) {\n this._destroyed.push(model);\n }\n },\n\n _change: function(e) {\n var that = this, idx, length, action = e ? e.action : \"\";\n\n if (action === \"remove\") {\n for (idx = 0, length = e.items.length; idx < length; idx++) {\n if (!e.items[idx].isNew || !e.items[idx].isNew()) {\n that._pushInDestroyed(e.items[idx]);\n }\n }\n }\n\n if (that.options.autoSync && (action === \"add\" || action === \"remove\" || action === \"itemchange\")) {\n\n var handler = function(args) {\n if (args.action === \"sync\") {\n that.unbind(\"change\", handler);\n that._updateTotalForAction(action, e.items);\n }\n };\n\n that.first(\"change\", handler);\n\n that.sync();\n\n } else {\n that._updateTotalForAction(action, e ? e.items : []);\n\n that._process(that._data, e);\n }\n },\n\n _calculateAggregates: function(data, options) {\n options = options || {};\n\n var query = new Query(data),\n aggregates = options.aggregate,\n filter = options.filter;\n\n if (filter) {\n query = query.filter(filter);\n }\n\n return query.aggregate(aggregates);\n },\n\n _process: function(data, e) {\n var that = this,\n options = {},\n result;\n\n if (that.options.serverPaging !== true) {\n options.skip = that._skip;\n options.take = that._take || that._pageSize;\n\n if (options.skip === undefined && that._page !== undefined && that._pageSize !== undefined) {\n options.skip = (that._page - 1) * that._pageSize;\n }\n\n if (that.options.useRanges) {\n options.skip = that.currentRangeStart();\n }\n }\n\n if (that.options.serverSorting !== true) {\n options.sort = that._sort;\n }\n\n if (that.options.serverFiltering !== true) {\n options.filter = that._filter;\n }\n\n if (that.options.serverGrouping !== true) {\n options.group = that._group;\n }\n\n if (that.options.serverAggregates !== true) {\n options.aggregate = that._aggregate;\n }\n\n if (that.options.serverGrouping) {\n that._clearEmptyGroups(data);\n }\n\n options.groupPaging = that._groupPaging;\n\n if (that._isGroupPaged() && e && (e.action === \"page\" || e.action === \"expandGroup\" || e.action === \"collapseGroup\")) {\n result = that._queryProcess(data, {\n aggregate: that._aggregate\n });\n } else {\n result = that._queryProcess(data, options);\n }\n\n if (that._filter && e && e.action === \"add\") {\n var model = e.items[0],\n resultData = result.data;\n\n var modelIsInView = resultData.find(function(item) {\n return item.uid === model.uid;\n });\n\n if (!modelIsInView) {\n result.data.splice(model.index, 0, model);\n result.total++;\n }\n }\n\n if (that.options.serverAggregates !== true) {\n // for performance reasons, calculate aggregates for part of the data only after query process\n // this is necessary in the TreeList when paging\n that._aggregateResult = that._calculateAggregates(result.dataToAggregate || data, options);\n }\n\n that._setView(result, options, e);\n\n that._setFilterTotal(result.total, false);\n\n e = e || {};\n\n e.items = e.items || that._view;\n\n that.trigger(CHANGE, e);\n },\n\n _setView: function(result, options, e) {\n var that = this;\n\n if (that._isGroupPaged() && !that._isServerGrouped()) {\n if (e && (e.action === \"page\" || e.action === \"expandGroup\" || e.action === \"collapseGroup\")) {\n that.view(result.data);\n that._updateOuterRangesLength();\n } else {\n that._ranges = [];\n var query = new Query(result.data);\n that._addRange(that._observe(result.data));\n\n if (options.skip + options.take > result.data.length) {\n options.skip = result.data.length - options.take;\n }\n\n that.view(query.range(options.skip, options.take).toArray());\n }\n\n } else {\n that.view(result.data);\n }\n },\n\n _clearEmptyGroups: function(data) {\n for (var idx = data.length - 1; idx >= 0; idx--) {\n var group = data[idx];\n if (group.hasSubgroups) {\n this._clearEmptyGroups(group.items);\n }\n\n if (group.items && !group.items.length && !group.itemCount) {\n splice.apply(group.parent(), [idx, 1]);\n }\n }\n },\n\n _queryProcess: function(data, options) {\n if (this.options.inPlaceSort) {\n return Query.process(data, options, this.options.inPlaceSort);\n }\n else {\n return Query.process(data, options);\n }\n },\n\n _mergeState: function(options) {\n var that = this;\n\n if (options !== undefined) {\n that._pageSize = options.pageSize;\n that._page = options.page;\n that._sort = options.sort;\n that._filter = options.filter;\n that._group = options.group;\n that._aggregate = options.aggregate;\n that._skip = that._currentRangeStart = options.skip;\n that._take = options.take;\n\n if (that._skip === undefined) {\n that._skip = that._currentRangeStart = that.skip();\n options.skip = that.skip();\n }\n\n if (that._take === undefined && that._pageSize !== undefined) {\n that._take = that._pageSize;\n options.take = that._take;\n }\n\n if (that.options.virtual) {\n options.virtual = that.options.virtual;\n }\n\n if (options.sort) {\n that._sort = options.sort = normalizeSort(options.sort);\n that._sortFields = sortFields(options.sort);\n }\n\n if (options.filter) {\n that._filter = options.filter = (that.options.accentFoldingFiltering && !$.isEmptyObject(options.filter)) ? $.extend({}, normalizeFilter(options.filter), { accentFoldingFiltering: that.options.accentFoldingFiltering }) : normalizeFilter(options.filter);\n }\n\n if (options.group) {\n that._group = options.group = normalizeGroup(options.group);\n }\n if (options.aggregate) {\n that._aggregate = options.aggregate = normalizeAggregate(options.aggregate);\n }\n }\n return options;\n },\n\n query: function(options) {\n var result;\n var remote = this.options.serverSorting || this.options.serverPaging || this.options.serverFiltering || this.options.serverGrouping || this.options.serverAggregates;\n\n if (remote || ((this._data === undefined || this._data.length === 0) && !this._destroyed.length)) {\n if (this.options.endless) {\n var moreItemsCount = options.pageSize - this.pageSize();\n if (moreItemsCount > 0) {\n moreItemsCount = this.pageSize();\n options.page = options.pageSize / moreItemsCount;\n options.pageSize = moreItemsCount;\n } else {\n options.page = 1;\n this.options.endless = false;\n }\n }\n return this.read(this._mergeState(options));\n }\n\n var isPrevented = this.trigger(REQUESTSTART, { type: \"read\" });\n if (!isPrevented) {\n this.trigger(PROGRESS);\n if (options) {\n options.groupPaging = this._groupPaging;\n }\n result = this._queryProcess(this._data, this._mergeState(options));\n\n this._setFilterTotal(result.total, true);\n\n this._aggregateResult = this._calculateAggregates(result.dataToAggregate || this._data, options);\n this._setView(result, options);\n this.trigger(REQUESTEND, { type: \"read\" });\n this.trigger(CHANGE, { items: result.data, action: options ? options.action : \"\" });\n }\n\n return $.Deferred().resolve(isPrevented).promise();\n },\n\n _hasExpandedSubGroups: function(group) {\n var result = false;\n var length = group.items ? group.items.length : 0;\n\n if (!group.hasSubgroups) {\n return false;\n }\n\n for (var i = 0; i < length; i++) {\n if (this._groupsState[group.items[i].uid]) {\n result = true;\n break;\n }\n }\n return result;\n },\n\n _findGroupedRange: function(data, result, options, parents, callback) {\n var that = this;\n var length = data.length;\n var group;\n var current;\n var itemsLength;\n var groupCount;\n var itemsToSkip;\n\n for (var i = 0; i < length; i++) {\n group = data[i];\n\n if (options.taken >= options.take) {\n break;\n }\n\n if (!that._getGroupByUid(group.uid)) {\n that._groupsFlat.push(group);\n }\n\n if (that._groupsState[group.uid]) {\n if (that._isServerGroupPaged()) {\n if (that._fetchGroupItems(group, options, parents, callback)) {\n that._fetchingGroupItems = true;\n return;\n }\n groupCount = (group.subgroupCount || group.itemCount) + 1;\n itemsToSkip = options.skip - options.skipped;\n if (!that._hasExpandedSubGroups(group) && itemsToSkip > groupCount) {\n options.skipped += groupCount;\n continue;\n }\n }\n\n if (options.includeParents && options.skipped < options.skip) {\n options.skipped++;\n group.excludeHeader = true;\n } else if (options.includeParents) {\n options.taken++;\n group.excludeHeader = false;\n }\n\n if (group.hasSubgroups && group.items && group.items.length) {\n group.currentItems = [];\n\n if (!parents) {\n parents = [];\n }\n parents.push(group);\n\n that._findGroupedRange(group.items, group.currentItems, options, parents, callback);\n parents.pop();\n\n if (group.currentItems.length || options.taken > 0) {\n result.push(group);\n } else {\n group.excludeHeader = false;\n }\n } else {\n current = [];\n itemsLength = group.items.length;\n\n for (var j = 0; j < itemsLength; j++) {\n if (options.skipped < options.skip) {\n options.skipped++;\n continue;\n }\n\n if (options.taken >= options.take) {\n break;\n }\n current.push(group.items[j]);\n options.taken++;\n }\n\n if (current.length || options.taken > 0) {\n group.currentItems = current;\n result.push(group);\n } else {\n group.excludeHeader = false;\n }\n }\n } else {\n if (options.skipped < options.skip) {\n options.skipped++;\n continue;\n }\n result.push(group);\n options.taken++;\n }\n }\n },\n\n _expandedSubGroupItemsCount: function(group, end, includeCurrentItems) {\n var that = this;\n var result = 0;\n var subGroup;\n var endSpecified = typeof end === \"number\";\n var length = endSpecified ? end : group.subgroupCount;\n var temp;\n\n if (!group.hasSubgroups) {\n return result;\n }\n\n for (var i = 0; i < length; i++) {\n subGroup = group.items[i];\n\n if (!subGroup) {\n break;\n }\n\n if (subGroup.hasSubgroups && that._groupsState[group.uid]) {\n temp = that._expandedSubGroupItemsCount(subGroup, length, true);\n result += temp;\n\n if (endSpecified) {\n length -= temp;\n }\n } else if (!subGroup.hasSubgroups && that._groupsState[subGroup.uid]) {\n temp = subGroup.items ? subGroup.items.length : 0;\n result += temp;\n if (endSpecified) {\n length -= temp;\n }\n }\n\n if (includeCurrentItems) {\n result += 1;\n if (endSpecified) {\n length -= 1;\n }\n }\n\n if (endSpecified && result > length) {\n return result;\n }\n }\n\n return result;\n },\n\n _fetchGroupItems: function(group, options, parents, callback) {\n var that = this;\n var groupItemsSkip;\n var firstItem;\n var lastItem;\n var groupItemCount = group.hasSubgroups ? group.subgroupCount : group.itemCount;\n var take = options.take;\n var skipped = options.skipped;\n var pageSize = that.take();\n var expandedSubGroupItemsCount;\n\n if (options.includeParents) {\n if (skipped < options.skip) {\n skipped += 1;\n } else {\n take -= 1;\n }\n }\n\n if (!group.items || (group.items && !group.items.length)) {\n that.getGroupItems(group, options, parents, callback, 0);\n return true;\n } else {\n expandedSubGroupItemsCount = this._expandedSubGroupItemsCount(group, options.skip - skipped);\n groupItemsSkip = Math.max(options.skip - (skipped + expandedSubGroupItemsCount), 0);\n\n if (groupItemsSkip >= groupItemCount) {\n return false;\n }\n\n firstItem = group.items[groupItemsSkip];\n lastItem = group.items[Math.min(groupItemsSkip + take, groupItemCount - 1)];\n\n if (firstItem.notFetched) {\n that.getGroupItems(group, options, parents, callback, math.max(math.floor(groupItemsSkip / pageSize), 0) * pageSize, math.round((groupItemsSkip + pageSize) / pageSize));\n return true;\n }\n\n if (lastItem.notFetched) {\n that.getGroupItems(group, options, parents, callback, math.max(math.floor((groupItemsSkip + pageSize) / pageSize), 0) * pageSize, math.round((groupItemsSkip + pageSize) / pageSize));\n return true;\n }\n }\n },\n\n getGroupItems: function(group, options, parents, callback, groupItemsSkip, page) {\n var that = this;\n var take;\n var filter;\n var data;\n var subgroups;\n\n if (!group.items) {\n group.items = [];\n }\n\n take = that.take();\n filter = this._composeItemsFilter(group, parents);\n data = {\n page: page || 1,\n pageSize: take,\n skip: groupItemsSkip,\n take: take,\n filter: filter,\n aggregate: that._aggregate,\n sort: that._sort\n };\n subgroups = that.findSubgroups(group);\n\n if (subgroups && subgroups.length) {\n data.group = subgroups;\n data.groupPaging = true;\n }\n\n clearTimeout(that._timeout);\n that._timeout = setTimeout(function() {\n that._queueRequest(data, function() {\n if (!that.trigger(REQUESTSTART, {\n type: \"read\"\n })) {\n that.transport.read({\n data: data,\n success: that._groupItemsSuccessHandler(group, options.skip, that.take(), callback, groupItemsSkip),\n error: function() {\n var args = slice.call(arguments);\n that.error.apply(that, args);\n }\n });\n } else {\n that._dequeueRequest();\n }\n });\n }, 100);\n },\n\n _groupItemsSuccessHandler: function(group, skip, take, callback, groupItemsSkip) {\n var that = this;\n var timestamp = that._timeStamp();\n callback = isFunction(callback) ? callback : noop;\n var totalField = that.options.schema && that.options.schema.total ? that.options.schema.total : \"Total\";\n\n return function(data) {\n var temp;\n var model = Model.define(that.options.schema.model);\n var totalCount;\n\n that._dequeueRequest();\n\n that.trigger(REQUESTEND, {\n response: data,\n type: \"read\"\n });\n\n if (isFunction(totalField)) {\n totalCount = totalField(data);\n } else {\n totalCount = data[totalField];\n }\n\n data = that.reader.parse(data);\n\n if (group.hasSubgroups) {\n temp = that.reader.groups(data);\n group.subgroupCount = totalCount;\n } else {\n temp = that.reader.data(data);\n temp = temp.map(function(item) {\n return new model(item);\n });\n }\n\n group.items.omitChangeEvent = true;\n for (var i = 0; i < totalCount; i++) {\n if (i >= groupItemsSkip && i < (groupItemsSkip + take) ) {\n group.items.splice(i, 1, temp[i - groupItemsSkip]);\n } else {\n if (!group.items[i]) {\n group.items.splice(i, 0, { notFetched: true });\n }\n }\n }\n group.items.omitChangeEvent = false;\n\n that._updateRangePristineData(group);\n that._fetchingGroupItems = false;\n\n if (!group.countAdded) {\n that._serverGroupsTotal += totalCount;\n group.countAdded = true;\n }\n\n that.range(skip, take, callback, \"expandGroup\");\n\n if (timestamp >= that._currentRequestTimeStamp || !that._skipRequestsInProgress) {\n that.trigger(CHANGE, {});\n }\n };\n },\n\n findSubgroups: function(group) {\n var indexOfCurrentGroup = this._group.map(function(g) {\n return g.field;\n }).indexOf(group.field);\n\n return this._group.slice(indexOfCurrentGroup + 1, this._group.length);\n },\n\n _composeItemsFilter: function(group, parents) {\n var filter = this.filter() || {\n logic: \"and\",\n filters: []\n };\n\n filter.logic = 'and';\n filter = extend(true, {}, filter);\n filter.filters.push({\n field: group.field,\n operator: \"eq\",\n value: group.value\n });\n\n if (parents) {\n for (var i = 0; i < parents.length; i++) {\n filter.filters.push({\n field: parents[i].field,\n operator: \"eq\",\n value: parents[i].value\n });\n }\n }\n\n return filter;\n },\n\n _updateRangePristineData: function(group) {\n var that = this;\n var ranges = that._ranges;\n var rangesLength = ranges.length;\n var temp;\n var currentGroup;\n var range;\n var dataLength;\n var indexes;\n var currIdx;\n\n for (var i = 0; i < rangesLength; i++) {\n range = ranges[i];\n dataLength = range.data.length;\n indexes = [];\n temp = null;\n\n for (var j = 0; j < dataLength; j++) {\n currentGroup = range.data[j];\n indexes.push(j);\n\n if ((currentGroup.uid === group.uid) || (currentGroup.hasSubgroups && currentGroup.items.length && that._containsSubGroup(currentGroup, group, indexes))) {\n break;\n }\n indexes.pop();\n }\n\n if (indexes.length) {\n temp = ranges[i].pristineData;\n\n while (indexes.length > 1) {\n currIdx = indexes.splice(0, 1)[0];\n temp = temp[currIdx].items;\n }\n temp[indexes[0]] = that._cloneGroup(group);\n break;\n }\n }\n },\n\n _containsSubGroup: function(group, subgroup, indexes) {\n var that = this;\n var length = group.items.length;\n var currentSubGroup;\n\n if (group.hasSubgroups && length) {\n for (var i = 0; i < length; i++) {\n currentSubGroup = group.items[i];\n indexes.push(i);\n if (currentSubGroup.uid === subgroup.uid ||\n (currentSubGroup.hasSubgroups &&\n currentSubGroup.items.length &&\n that._containsSubGroup(currentSubGroup, subgroup, indexes))) {\n return true;\n }\n indexes.pop();\n }\n }\n\n },\n\n _cloneGroup: function(group) {\n var that = this;\n group = typeof group.toJSON == \"function\" ? group.toJSON() : group;\n\n if (group.items && group.items.length) {\n group.items = group.items.map(function(item) {\n return that._cloneGroup(item);\n });\n }\n\n return group;\n },\n\n _setFilterTotal: function(filterTotal, setDefaultValue) {\n var that = this;\n\n if (!that.options.serverFiltering) {\n if (filterTotal !== undefined) {\n that._total = filterTotal;\n } else if (setDefaultValue) {\n that._total = that._data.length;\n }\n }\n },\n\n fetch: function(callback) {\n var that = this;\n var fn = function(isPrevented) {\n if (isPrevented !== true && isFunction(callback)) {\n callback.call(that);\n }\n };\n\n return this._query().done(fn);\n },\n\n _query: function(options) {\n var that = this;\n\n return that.query(extend({}, {\n page: that.page(),\n pageSize: that.pageSize(),\n sort: that.sort(),\n filter: that.filter(),\n group: that.group(),\n aggregate: that.aggregate()\n }, options));\n },\n\n next: function(options) {\n var that = this,\n page = that.page(),\n total = that.total();\n\n options = options || {};\n\n if (!page || (total && page + 1 > that.totalPages())) {\n return;\n }\n\n that._skip = that._currentRangeStart = page * that.take();\n\n page += 1;\n options.page = page;\n\n that._query(options);\n\n return page;\n },\n\n prev: function(options) {\n var that = this,\n page = that.page();\n\n options = options || {};\n\n if (!page || page === 1) {\n return;\n }\n\n that._skip = that._currentRangeStart = that._skip - that.take();\n\n page -= 1;\n options.page = page;\n\n that._query(options);\n\n return page;\n },\n\n page: function(val) {\n var that = this,\n skip;\n\n if (val !== undefined) {\n val = math.max(math.min(math.max(val, 1), that.totalPages()), 1);\n var take = that.take();\n\n if (that._isGroupPaged()) {\n val -= 1;\n that.range(val * take, take, null, \"page\");\n return;\n }\n that._query(that._pageableQueryOptions({ page: val }));\n return;\n }\n skip = that.skip();\n\n return skip !== undefined ? math.round((skip || 0) / (that.take() || 1)) + 1 : undefined;\n },\n\n pageSize: function(val) {\n var that = this;\n\n if (val !== undefined) {\n that._query(that._pageableQueryOptions({ pageSize: val, page: 1 }));\n return;\n }\n\n return that.take();\n },\n\n sort: function(val) {\n var that = this;\n\n if (val !== undefined) {\n that.trigger(\"sort\");\n that._query({ sort: val });\n return;\n }\n\n return that._sort;\n },\n\n filter: function(val) {\n var that = this;\n\n if (val === undefined) {\n return that._filter;\n }\n\n that.trigger(\"reset\");\n that._query({ filter: val, page: 1 });\n },\n\n group: function(val) {\n var that = this;\n var options = { group: val };\n\n if (that._groupPaging) {\n // clear ranges if ungrouping is performed\n if (val !== undefined && (!val || !val.length) ) {\n that._ranges = [];\n }\n options.page = 1;\n }\n\n if (val !== undefined) {\n that._query(options);\n return;\n }\n\n return that._group;\n },\n\n getGroupsFlat: function(data) {\n var idx,\n result = [],\n length;\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n var group = data[idx];\n if (group.hasSubgroups) {\n result = result.concat(this.getGroupsFlat(group.items));\n }\n\n result.push(group);\n }\n\n return result;\n },\n\n total: function() {\n return parseInt(this._total || 0, 10);\n },\n\n groupsTotal: function(includeExpanded) {\n var that = this;\n\n if (!that._group.length) {\n return that.total();\n }\n\n if (that._isServerGrouped()) {\n if (that._serverGroupsTotal) {\n return that._serverGroupsTotal;\n }\n that._serverGroupsTotal = that.total();\n\n return that._serverGroupsTotal;\n }\n\n return that._calculateGroupsTotal(that._ranges.length ? that._ranges[0].data : [], includeExpanded);\n },\n\n _calculateGroupsTotal: function(groups, includeExpanded, itemsField, ignoreState) {\n var that = this;\n itemsField = itemsField || \"items\";\n var total;\n var length;\n\n if (that._group.length && groups) {\n total = 0;\n length = groups.length;\n\n for (var i = 0; i < length; i++) {\n total += that.groupCount(groups[i], includeExpanded, itemsField, ignoreState);\n }\n that._groupsTotal = total;\n return total;\n }\n\n that._groupsTotal = that._data.length;\n return that._groupsTotal;\n },\n\n groupCount: function(group, includeExpanded, itemsField, ignoreState) {\n var that = this;\n var total = 0;\n\n if (group.hasSubgroups && that._groupsState[group.uid]) {\n if (includeExpanded && !group.excludeHeader || ignoreState) {\n total += 1;\n }\n\n group[itemsField].forEach(function(subgroup) {\n total += that.groupCount(subgroup, includeExpanded, itemsField, ignoreState);\n });\n } else {\n if (that._groupsState[group.uid]) {\n if (includeExpanded && !group.excludeHeader || ignoreState) {\n total++;\n }\n total += group[itemsField] ? group[itemsField].length : 0;\n } else {\n total++;\n }\n }\n return total;\n },\n\n countGroupRange: function(range) {\n var total = 0;\n var length = range.length;\n\n for (var i = 0; i < length; i++) {\n total += this.groupCount(range[i], true);\n }\n\n return total;\n },\n\n aggregate: function(val) {\n var that = this;\n\n if (val !== undefined) {\n that._query({ aggregate: val });\n return;\n }\n\n return that._aggregate;\n },\n\n aggregates: function() {\n var result = this._aggregateResult;\n\n if (isEmptyObject(result)) {\n result = this._emptyAggregates(this.aggregate());\n }\n\n return result;\n },\n\n _emptyAggregates: function(aggregates) {\n var result = {};\n\n if (!isEmptyObject(aggregates)) {\n var aggregate = {};\n\n if (!isArray(aggregates)) {\n aggregates = [aggregates];\n }\n\n for (var idx = 0; idx < aggregates.length; idx++) {\n aggregate[aggregates[idx].aggregate] = 0;\n result[aggregates[idx].field] = aggregate;\n }\n }\n\n return result;\n },\n\n _pageableQueryOptions: function(options) {\n return options;\n },\n\n _wrapInEmptyGroup: function(model) {\n var groups = this.group(),\n parent,\n group,\n idx,\n length;\n\n for (idx = groups.length - 1, length = 0; idx >= length; idx--) {\n group = groups[idx];\n parent = {\n value: model.get ? model.get(group.field) : model[group.field],\n field: group.field,\n items: parent ? [parent] : [model],\n hasSubgroups: !!parent,\n aggregates: this._emptyAggregates(group.aggregates)\n };\n }\n\n return parent;\n },\n\n totalPages: function() {\n var that = this,\n pageSize = that.pageSize() || that.total(),\n total = that._isGroupPaged() ? that.groupsTotal(true) : that.total();\n\n return math.ceil((total || 0) / pageSize);\n },\n\n inRange: function(skip, take) {\n var that = this,\n end = math.min(skip + take, that.total());\n\n if (!that.options.serverPaging && that._data.length > 0) {\n return true;\n }\n\n return that._findRange(skip, end).length > 0;\n },\n\n lastRange: function() {\n var ranges = this._ranges;\n return ranges[ranges.length - 1] || { start: 0, end: 0, data: [] };\n },\n\n firstItemUid: function() {\n var ranges = this._ranges;\n return ranges.length && ranges[0].data.length && ranges[0].data[0].uid;\n },\n\n enableRequestsInProgress: function() {\n this._skipRequestsInProgress = false;\n },\n\n _timeStamp: function() {\n return new Date().getTime();\n },\n\n range: function(skip, take, callback, action) {\n this._currentRequestTimeStamp = this._timeStamp();\n this._skipRequestsInProgress = true;\n var total = this._isGroupPaged() ? this.groupsTotal(true) : this.total();\n\n if (action === \"expandGroup\" || action === \"collapseGroup\") {\n this._updateOuterRangesLength();\n }\n\n skip = math.min(skip || 0, total);\n callback = isFunction(callback) ? callback : noop;\n\n var that = this,\n pageSkip = math.max(math.floor(skip / take), 0) * take,\n size = math.min(pageSkip + take, total),\n data;\n\n data = that._findRange(skip, math.min(skip + take, total), callback);\n\n if ((data.length || total === 0) && !that._fetchingGroupItems) {\n that._processRangeData(data, skip, take, that._originalPageSkip || pageSkip, that._originalSize || size, {\n action: action\n });\n that._originalPageSkip = null;\n that._originalSize = null;\n callback();\n return;\n }\n\n if (that._isGroupPaged()) {\n that._originalPageSkip = pageSkip;\n that._originalSize = size;\n\n pageSkip = math.max(math.floor(that._adjustPageSkip(skip, take) / take), 0) * take;\n size = math.min(pageSkip + take, total);\n }\n\n if (take !== undefined && !that._fetchingGroupItems) {\n if ((that._isGroupPaged() && !that._groupRangeExists(pageSkip, take)) || !that._rangeExists(pageSkip, size)) {\n that.prefetch(pageSkip, take, function() {\n if (skip > pageSkip && size < that.total() && !that._rangeExists(size, math.min(size + take, that.total()))) {\n that.prefetch(size, take, function() {\n that.range(skip, take, callback );\n });\n } else {\n that.range(skip, take, callback);\n }\n });\n } else if (pageSkip < skip) {\n that.prefetch(size, take, function() {\n that.range(skip, take, callback );\n });\n }\n }\n },\n\n _findRange: function(start, end, callback) {\n var that = this,\n ranges = that._ranges,\n range,\n data = [],\n skipIdx,\n takeIdx,\n startIndex,\n endIndex,\n rangeData,\n rangeEnd,\n processed,\n options = that.options,\n remote = options.serverSorting || options.serverPaging || options.serverFiltering || options.serverGrouping || options.serverAggregates,\n flatData,\n count,\n length,\n groupMapOptions = {\n take: end - start,\n skip: start,\n skipped: 0,\n taken: 0,\n includeParents: true\n },\n prevRangeEnd,\n isGroupPaged = that._isGroupPaged(),\n startField = isGroupPaged ? \"outerStart\" : \"start\",\n endField = isGroupPaged ? \"outerEnd\" : \"end\",\n currentDataLength;\n\n for (skipIdx = 0, length = ranges.length; skipIdx < length; skipIdx++) {\n range = ranges[skipIdx];\n\n if (isGroupPaged) {\n if (range.outerStart >= end) {\n return [];\n }\n\n if (start > range.outerEnd) {\n groupMapOptions.skipped += range.outerEnd - (prevRangeEnd || 0);\n prevRangeEnd = range.outerEnd;\n continue;\n }\n\n if (typeof prevRangeEnd !== \"undefined\" && prevRangeEnd != range.outerStart) {\n groupMapOptions.skipped += range.outerStart - prevRangeEnd;\n }\n\n if (groupMapOptions.skipped > groupMapOptions.skip) {\n return [];\n }\n\n if (typeof prevRangeEnd === \"undefined\" && start > 0 && range.start > 0) {\n groupMapOptions.skipped = range.outerStart;\n }\n\n takeIdx = skipIdx;\n while (true) {\n this._findGroupedRange(range.data, data, groupMapOptions, null, callback);\n currentDataLength = that._calculateGroupsTotal(data, true, \"currentItems\");\n\n if (currentDataLength >= groupMapOptions.take) {\n return data;\n }\n\n if (that._fetchingGroupItems) {\n return [];\n }\n takeIdx++;\n\n if (ranges[takeIdx] && ranges[takeIdx].outerStart === range.outerEnd) {\n range = ranges[takeIdx];\n } else {\n break;\n }\n }\n } else if (start >= range[startField] && start <= range[endField]) {\n count = 0;\n\n for (takeIdx = skipIdx; takeIdx < length; takeIdx++) {\n range = ranges[takeIdx];\n flatData = that._flatData(range.data, true);\n\n if (flatData.length && start + count >= range.start) {\n rangeData = range.data;\n rangeEnd = range.end;\n\n if (!remote) {\n if (options.inPlaceSort) {\n processed = that._queryProcess(range.data, { filter: that.filter() });\n } else {\n var sort = normalizeGroupWithoutCompare(that.group() || []).concat(normalizeSort(that.sort() || []));\n processed = that._queryProcess(range.data, { sort: sort, filter: that.filter() });\n }\n flatData = rangeData = processed.data;\n\n if (processed.total !== undefined) {\n rangeEnd = processed.total;\n }\n }\n\n startIndex = 0;\n if (start + count > range.start) {\n startIndex = (start + count) - range.start;\n }\n endIndex = flatData.length;\n if (rangeEnd > end) {\n endIndex = endIndex - (rangeEnd - end);\n }\n count += endIndex - startIndex;\n data = that._mergeGroups(data, rangeData, startIndex, endIndex);\n\n if (end <= range.end && count == end - start) {\n return data;\n }\n }\n }\n break;\n }\n prevRangeEnd = range.outerEnd;\n }\n return [];\n },\n\n _getRangesMismatch: function(pageSkip) {\n var that = this;\n var ranges = that._ranges;\n var mismatch = 0;\n var i = 0;\n\n while (true) {\n var range = ranges[i];\n if (!range || range.outerStart > pageSkip) {\n break;\n }\n\n if (range.outerEnd != range.end) {\n mismatch = range.outerEnd - range.end;\n }\n i++;\n }\n\n return mismatch;\n },\n\n _mergeGroups: function(data, range, skip, take) {\n if (this._isServerGrouped()) {\n var temp = range.toJSON(),\n prevGroup;\n\n if (data.length) {\n prevGroup = data[data.length - 1];\n }\n\n mergeGroups(prevGroup, temp, skip, take);\n\n return data.concat(temp);\n }\n return data.concat(range.slice(skip, take));\n },\n\n _processRangeData: function(data, skip, take, pageSkip, size, eventData) {\n var that = this;\n\n that._pending = undefined;\n\n that._skip = skip > that.skip() && !that._omitPrefetch ? math.min(size, (that.totalPages() - 1) * that.take()) : pageSkip;\n\n that._currentRangeStart = skip;\n\n that._take = take;\n\n var paging = that.options.serverPaging;\n var sorting = that.options.serverSorting;\n var filtering = that.options.serverFiltering;\n var aggregates = that.options.serverAggregates;\n try {\n that.options.serverPaging = true;\n if (!that._isServerGrouped() && !(that.group() && that.group().length)) {\n that.options.serverSorting = true;\n }\n that.options.serverFiltering = true;\n that.options.serverPaging = true;\n that.options.serverAggregates = true;\n\n if (paging) {\n that._detachObservableParents();\n that._data = data = that._observe(data);\n }\n that._process(data, eventData);\n } finally {\n that.options.serverPaging = paging;\n that.options.serverSorting = sorting;\n that.options.serverFiltering = filtering;\n that.options.serverAggregates = aggregates;\n }\n },\n\n skip: function() {\n var that = this;\n\n if (that._skip === undefined) {\n return (that._page !== undefined ? (that._page - 1) * (that.take() || 1) : undefined);\n }\n return that._skip;\n },\n\n currentRangeStart: function() {\n return this._currentRangeStart || 0;\n },\n\n take: function() {\n return this._take || this._pageSize;\n },\n\n _prefetchSuccessHandler: function(skip, size, callback, force) {\n var that = this;\n var timestamp = that._timeStamp();\n\n return function(data) {\n var found = false,\n range = { start: skip, end: size, data: [], timestamp: that._timeStamp() },\n idx,\n length,\n temp;\n\n that._dequeueRequest();\n\n that.trigger(REQUESTEND, { response: data, type: \"read\" });\n\n data = that.reader.parse(data);\n\n temp = that._readData(data);\n\n if (temp.length) {\n for (idx = 0, length = that._ranges.length; idx < length; idx++) {\n if (that._ranges[idx].start === skip) {\n found = true;\n range = that._ranges[idx];\n\n if (!that._isGroupPaged()) {\n range.pristineData = temp;\n range.data = that._observe(temp);\n range.end = range.start + that._flatData(range.data, true).length;\n that._sortRanges();\n }\n\n break;\n }\n }\n\n if (!found) {\n that._addRange(that._observe(temp), skip);\n }\n }\n\n that._total = that.reader.total(data);\n\n if (force || (timestamp >= that._currentRequestTimeStamp || !that._skipRequestsInProgress)) {\n if (callback && temp.length) {\n callback();\n } else {\n that.trigger(CHANGE, {});\n }\n }\n };\n },\n\n prefetch: function(skip, take, callback) {\n var that = this,\n size = math.min(skip + take, that.total()),\n options = {\n take: take,\n skip: skip,\n page: skip / take + 1,\n pageSize: take,\n sort: that._sort,\n filter: that._filter,\n group: that._group,\n aggregate: that._aggregate\n };\n\n\n if ((that._isGroupPaged() && !that._isServerGrouped() && that._groupRangeExists(skip, size))) {\n if (callback) {\n callback();\n }\n return;\n }\n\n if ((that._isServerGroupPaged() && !that._groupRangeExists(skip, size)) || !that._rangeExists(skip, size)) {\n clearTimeout(that._timeout);\n\n that._timeout = setTimeout(function() {\n that._queueRequest(options, function() {\n if (!that.trigger(REQUESTSTART, { type: \"read\" })) {\n if (that._omitPrefetch) {\n that.trigger(PROGRESS);\n }\n that.transport.read({\n data: that._params(options),\n success: that._prefetchSuccessHandler(skip, size, callback),\n error: function() {\n var args = slice.call(arguments);\n that.error.apply(that, args);\n }\n });\n } else {\n that._dequeueRequest();\n }\n });\n }, 100);\n } else if (callback) {\n callback();\n }\n },\n\n _multiplePrefetch: function(skip, take, callback) {\n var that = this,\n size = math.min(skip + take, that.total()),\n options = {\n take: take,\n skip: skip,\n page: skip / take + 1,\n pageSize: take,\n sort: that._sort,\n filter: that._filter,\n group: that._group,\n aggregate: that._aggregate\n };\n\n if (!that._rangeExists(skip, size)) {\n if (!that.trigger(REQUESTSTART, { type: \"read\" })) {\n that.transport.read({\n data: that._params(options),\n success: that._prefetchSuccessHandler(skip, size, callback, true)\n });\n }\n } else if (callback) {\n callback();\n }\n },\n\n _adjustPageSkip: function(start, take) {\n var that = this;\n var prevRange = that._getPrevRange(start);\n var result;\n var total = that.total();\n var mismatch;\n\n if (prevRange) {\n mismatch = that._getRangesMismatch(start);\n\n if (!mismatch) {\n return start;\n }\n start -= mismatch;\n }\n result = math.max(math.floor(start / take), 0) * take;\n\n if (result > total) {\n while (true) {\n result -= take;\n if (result < total) {\n break;\n }\n }\n }\n return result;\n },\n\n _getNextRange: function(end) {\n var that = this,\n ranges = that._ranges,\n idx,\n length;\n\n for (idx = 0, length = ranges.length; idx < length; idx++) {\n if (ranges[idx].start <= end && ranges[idx].end >= end) {\n return ranges[idx];\n }\n }\n },\n\n _getPrevRange: function(start) {\n var that = this,\n ranges = that._ranges,\n idx,\n range,\n length = ranges.length;\n\n for (idx = length - 1; idx >= 0; idx--) {\n if (ranges[idx].outerStart <= start) {\n range = ranges[idx];\n break;\n }\n\n }\n\n return range;\n },\n\n _rangeExists: function(start, end) {\n var that = this,\n ranges = that._ranges,\n idx,\n length;\n\n for (idx = 0, length = ranges.length; idx < length; idx++) {\n if (ranges[idx].start <= start && ranges[idx].end >= end) {\n return true;\n }\n }\n\n return false;\n },\n\n _groupRangeExists: function(start, end) {\n var that = this,\n ranges = that._ranges,\n idx,\n length,\n availableItemsCount = 0,\n total = that.groupsTotal(true);\n\n if (end > total && !that._isServerGrouped()) {\n end = total;\n }\n\n for (idx = 0, length = ranges.length; idx < length; idx++) {\n var range = ranges[idx];\n if (range.outerStart <= start && range.outerEnd >= start) {\n availableItemsCount += range.outerEnd - start;\n } else if (range.outerStart <= end && range.outerEnd >= end) {\n availableItemsCount += end - range.outerStart;\n }\n }\n\n return availableItemsCount >= end - start;\n },\n\n _getCurrentRangeSpan: function() {\n var that = this;\n var ranges = that._ranges;\n var start = that.currentRangeStart();\n var end = start + (that.take() || 0);\n var rangeSpan = [];\n var range;\n var idx;\n var length = ranges.length;\n\n for (idx = 0; idx < length; idx++) {\n range = ranges[idx];\n\n if ((range.start <= start && range.end >= start) || (range.start >= start && range.start <= end)) {\n rangeSpan.push(range);\n }\n }\n\n return rangeSpan;\n },\n\n _removeModelFromRanges: function(model) {\n var that = this;\n var range;\n\n for (var idx = 0, length = this._ranges.length; idx < length; idx++) {\n range = this._ranges[idx];\n\n that._removeModelFromRange(range, model);\n }\n\n that._updateRangesLength();\n },\n\n _removeModelFromRange: function(range, model) {\n this._eachItem(range.data, function(data) {\n if (!data) {\n return;\n }\n for (var idx = 0; idx < data.length; idx++) {\n var dataItem = data[idx];\n\n if (dataItem.uid && dataItem.uid == model.uid) {\n [].splice.call(data, idx, 1);\n break;\n }\n }\n });\n },\n\n _insertModelInRange: function(index, model) {\n var that = this;\n var ranges = that._ranges || [];\n var rangesLength = ranges.length;\n var range;\n var i;\n\n for (i = 0; i < rangesLength; i++) {\n range = ranges[i];\n\n if (range.start <= index && range.end >= index) {\n if (!that._getByUid(model.uid, range.data)) {\n if (that._isServerGrouped()) {\n range.data.splice(index, 0, that._wrapInEmptyGroup(model));\n } else {\n range.data.splice(index, 0, model);\n }\n }\n\n break;\n }\n }\n\n that._updateRangesLength();\n },\n\n _updateRangesLength: function() {\n var that = this;\n var ranges = that._ranges || [];\n var rangesLength = ranges.length;\n var mismatchFound = false;\n var mismatchLength = 0;\n var lengthDifference = 0;\n var rangeLength;\n var range;\n var i;\n\n for (i = 0; i < rangesLength; i++) {\n range = ranges[i];\n rangeLength = that._isGroupPaged() ? range.data.length : that._flatData(range.data, true).length;\n lengthDifference = rangeLength - math.abs(range.end - range.start);\n\n if (!mismatchFound && lengthDifference !== 0) {\n mismatchFound = true;\n mismatchLength = lengthDifference;\n range.end += mismatchLength;\n continue;\n }\n\n if (mismatchFound) {\n range.start += mismatchLength;\n range.end += mismatchLength;\n }\n }\n },\n\n _updateOuterRangesLength: function() {\n var that = this;\n var ranges = that._ranges || [];\n var rangesLength = ranges.length;\n var mismatchLength = 0;\n var range;\n var i;\n var prevRange;\n var rangeLength;\n\n for (i = 0; i < rangesLength; i++) {\n range = ranges[i];\n rangeLength = that._isGroupPaged() ? that._calculateGroupsTotal(range.data, true, \"items\", true) : that._flatData(range.data, true).length;\n\n if (prevRange) {\n if (prevRange.end != range.start) {\n mismatchLength = range.start - prevRange.end;\n }\n range.outerStart = prevRange.outerEnd + mismatchLength;\n mismatchLength = 0;\n } else {\n range.outerStart = range.start;\n }\n\n range.outerEnd = range.outerStart + rangeLength;\n prevRange = range;\n }\n }\n });\n\n var Transport = {};\n\n Transport.create = function(options, data, dataSource) {\n var transport,\n transportOptions = options.transport ? $.extend({}, options.transport) : null;\n\n if (transportOptions) {\n transportOptions.read = typeof transportOptions.read === STRING ? { url: transportOptions.read } : transportOptions.read;\n\n if (options.type === \"jsdo\") {\n transportOptions.dataSource = dataSource;\n }\n\n if (options.type) {\n kendo.data.transports = kendo.data.transports || {};\n kendo.data.schemas = kendo.data.schemas || {};\n\n if (!kendo.data.transports[options.type]) {\n kendo.logToConsole(\"Unknown DataSource transport type '\" + options.type + \"'.\\nVerify that registration scripts for this type are included after Kendo UI on the page.\", \"warn\");\n } else if (!isPlainObject(kendo.data.transports[options.type])) {\n transport = new kendo.data.transports[options.type](extend(transportOptions, { data: data }));\n } else {\n transportOptions = extend(true, {}, kendo.data.transports[options.type], transportOptions);\n }\n\n options.schema = extend(true, {}, kendo.data.schemas[options.type], options.schema);\n }\n\n if (!transport) {\n transport = isFunction(transportOptions.read) ? transportOptions : new RemoteTransport(transportOptions);\n }\n } else {\n transport = new LocalTransport({ data: options.data || [] });\n }\n return transport;\n };\n\n DataSource.create = function(options) {\n if (isArray(options) || options instanceof ObservableArray) {\n options = { data: options };\n }\n\n var dataSource = options || {},\n data = dataSource.data,\n fields = dataSource.fields,\n table = dataSource.table,\n select = dataSource.select,\n idx,\n length,\n model = {},\n field;\n\n if (!data && fields && !dataSource.transport) {\n if (table) {\n data = inferTable(table, fields);\n } else if (select) {\n data = inferSelect(select, fields);\n\n if (dataSource.group === undefined && data[0] && data[0].optgroup !== undefined) {\n dataSource.group = \"optgroup\";\n }\n }\n }\n\n if (kendo.data.Model && fields && (!dataSource.schema || !dataSource.schema.model)) {\n for (idx = 0, length = fields.length; idx < length; idx++) {\n field = fields[idx];\n if (field.type) {\n model[field.field] = field;\n }\n }\n\n if (!isEmptyObject(model)) {\n dataSource.schema = extend(true, dataSource.schema, { model: { fields: model } });\n }\n }\n\n dataSource.data = data;\n\n select = null;\n dataSource.select = null;\n table = null;\n dataSource.table = null;\n\n return dataSource instanceof DataSource ? dataSource : new DataSource(dataSource);\n };\n\n function inferSelect(select, fields) {\n select = $(select)[0];\n var options = select.options;\n var firstField = fields[0];\n var secondField = fields[1];\n\n var data = [];\n var idx, length;\n var optgroup;\n var option;\n var record;\n var value;\n\n for (idx = 0, length = options.length; idx < length; idx++) {\n record = {};\n option = options[idx];\n optgroup = option.parentNode;\n\n if (optgroup === select) {\n optgroup = null;\n }\n\n if (option.disabled || (optgroup && optgroup.disabled)) {\n continue;\n }\n\n if (optgroup) {\n record.optgroup = optgroup.label;\n }\n\n record[firstField.field] = option.text;\n\n value = option.attributes.value;\n\n if (value && value.specified) {\n value = option.value;\n } else {\n value = option.text;\n }\n\n record[secondField.field] = value;\n\n data.push(record);\n }\n\n return data;\n }\n\n function inferTable(table, fields) {\n var tbody = $(table)[0].tBodies[0],\n rows = tbody ? tbody.rows : [],\n idx,\n length,\n fieldIndex,\n fieldCount = fields.length,\n data = [],\n cells,\n record,\n cell,\n empty;\n\n for (idx = 0, length = rows.length; idx < length; idx++) {\n record = {};\n empty = true;\n cells = rows[idx].cells;\n\n for (fieldIndex = 0; fieldIndex < fieldCount; fieldIndex++) {\n cell = cells[fieldIndex];\n if (cell.nodeName.toLowerCase() !== \"th\") {\n empty = false;\n record[fields[fieldIndex].field] = cell.innerHTML;\n }\n }\n if (!empty) {\n data.push(record);\n }\n }\n\n return data;\n }\n\n var Node = Model.define({\n idField: \"id\",\n\n init: function(value) {\n var that = this,\n hasChildren = that.hasChildren || value && value.hasChildren,\n childrenField = \"items\",\n childrenOptions = {};\n\n kendo.data.Model.fn.init.call(that, value);\n\n if (typeof that.children === STRING) {\n childrenField = that.children;\n }\n\n childrenOptions = {\n schema: {\n data: childrenField,\n model: {\n hasChildren: hasChildren,\n id: that.idField,\n fields: that.fields\n }\n }\n };\n\n if (typeof that.children !== STRING) {\n extend(childrenOptions, that.children);\n }\n\n childrenOptions.data = value;\n\n if (!hasChildren) {\n hasChildren = childrenOptions.schema.data;\n }\n\n if (typeof hasChildren === STRING) {\n hasChildren = kendo.getter(hasChildren);\n }\n\n if (isFunction(hasChildren)) {\n var hasChildrenObject = hasChildren.call(that, that);\n\n if (hasChildrenObject && hasChildrenObject.length === 0) {\n that.hasChildren = false;\n } else {\n that.hasChildren = !!hasChildrenObject;\n }\n }\n\n that._childrenOptions = childrenOptions;\n\n if (that.hasChildren) {\n that._initChildren();\n }\n\n that._loaded = !!(value && value._loaded);\n },\n\n _initChildren: function() {\n var that = this;\n var children, transport, parameterMap;\n\n if (!(that.children instanceof HierarchicalDataSource)) {\n children = that.children = new HierarchicalDataSource(that._childrenOptions);\n\n transport = children.transport;\n parameterMap = transport.parameterMap;\n\n transport.parameterMap = function(data, type) {\n data[that.idField || \"id\"] = that.id;\n\n if (parameterMap) {\n data = parameterMap.call(that, data, type);\n }\n\n return data;\n };\n\n children.parent = function() {\n return that;\n };\n\n children.bind(CHANGE, function(e) {\n e.node = e.node || that;\n that.trigger(CHANGE, e);\n });\n\n children.bind(ERROR, function(e) {\n var collection = that.parent();\n\n if (collection) {\n e.node = e.node || that;\n collection.trigger(ERROR, e);\n }\n });\n\n children.bind(ITEMSLOADED, function(e) {\n var collection = that.parent();\n\n if (collection) {\n collection.trigger(ITEMSLOADED, e);\n }\n });\n\n that._updateChildrenField();\n }\n },\n\n append: function(model) {\n this._initChildren();\n this.loaded(true);\n this.children.add(model);\n },\n\n hasChildren: false,\n\n level: function() {\n var parentNode = this.parentNode(),\n level = 0;\n\n while (parentNode && parentNode.parentNode) {\n level++;\n parentNode = parentNode.parentNode ? parentNode.parentNode() : null;\n }\n\n return level;\n },\n\n _updateChildrenField: function() {\n var fieldName = this._childrenOptions.schema.data;\n\n this[fieldName || \"items\"] = this.children.data();\n },\n\n _childrenLoaded: function() {\n this._loaded = true;\n\n this._updateChildrenField();\n },\n\n load: function() {\n var options = {};\n var method = \"_query\";\n var children, promise;\n\n if (this.hasChildren) {\n this._initChildren();\n\n children = this.children;\n\n options[this.idField || \"id\"] = this.id;\n\n if (!this._loaded) {\n children._data = undefined;\n method = \"read\";\n }\n\n children.one(CHANGE, this._childrenLoaded.bind(this));\n\n if (this._matchFilter) {\n options.filter = { field: '_matchFilter', operator: 'eq', value: true };\n }\n\n promise = children[method](options);\n if (!this._loaded) {\n this.trigger(ITEMLOAD, { promise: promise, node: this });\n }\n } else {\n this.loaded(true);\n }\n\n return promise || $.Deferred().resolve().promise();\n },\n\n parentNode: function() {\n var array = this.parent();\n\n return array.parent();\n },\n\n loaded: function(value) {\n if (value !== undefined) {\n this._loaded = value;\n } else {\n return this._loaded;\n }\n },\n\n shouldSerialize: function(field) {\n return Model.fn.shouldSerialize.call(this, field) &&\n field !== \"children\" &&\n field !== \"_loaded\" &&\n field !== \"hasChildren\" &&\n field !== \"_childrenOptions\";\n }\n });\n\n function dataMethod(name) {\n return function() {\n var data = this._data,\n result = DataSource.fn[name].apply(this, slice.call(arguments));\n\n if (this._data != data) {\n this._attachBubbleHandlers();\n }\n\n return result;\n };\n }\n\n var HierarchicalDataSource = DataSource.extend({\n init: function(options) {\n var node = Node.define({\n children: options\n });\n\n if (options.filter && !options.serverFiltering) {\n this._hierarchicalFilter = options.filter;\n options.filter = null;\n }\n\n DataSource.fn.init.call(this, extend(true, {}, { schema: { modelBase: node, model: node } }, options));\n\n this._attachBubbleHandlers();\n },\n\n _attachBubbleHandlers: function() {\n var that = this;\n\n that._data.bind(ERROR, function(e) {\n that.trigger(ERROR, e);\n });\n\n that._data.bind(ITEMSLOADED, function(e) {\n that.trigger(ITEMSLOADED, e);\n });\n },\n\n loading: function() {\n if (this._data) {\n return this._data.loading() || this._childrenLoading();\n }\n return false;\n },\n\n _childrenLoading: function() {\n var isLoading = false;\n this._data.forEach(function(node) {\n if (node.hasChildren && node.children.loading()) {\n isLoading = true;\n }\n });\n return isLoading;\n },\n\n read: function(data) {\n var result = DataSource.fn.read.call(this, data);\n\n if (this._hierarchicalFilter) {\n if (this._data && this._data.length > 0) {\n this.filter(this._hierarchicalFilter);\n } else {\n this.options.filter = this._hierarchicalFilter;\n this._filter = normalizeFilter(this.options.filter);\n this._hierarchicalFilter = null;\n }\n }\n\n return result;\n },\n\n remove: function(node) {\n var parentNode = node.parentNode(),\n dataSource = this,\n result;\n\n if (parentNode && parentNode._initChildren) {\n dataSource = parentNode.children;\n }\n\n result = DataSource.fn.remove.call(dataSource, node);\n\n if (parentNode && !dataSource.data().length) {\n parentNode.hasChildren = false;\n }\n\n return result;\n },\n\n success: dataMethod(\"success\"),\n\n data: dataMethod(\"data\"),\n\n insert: function(index, model) {\n var parentNode = this.parent();\n\n if (parentNode && parentNode._initChildren) {\n parentNode.hasChildren = true;\n parentNode._initChildren();\n }\n\n return DataSource.fn.insert.call(this, index, model);\n },\n\n filter: function(val) {\n if (val === undefined) {\n return this._filter;\n }\n\n if (!this.options.serverFiltering && this._markHierarchicalQuery(val)) {\n val = { logic: \"or\", filters: [val, { field: '_matchFilter', operator: 'equals', value: true }] };\n }\n\n this.trigger(\"reset\");\n this._query({ filter: val, page: 1 });\n },\n\n _markHierarchicalQuery: function(expressions) {\n var compiled;\n var predicate;\n var fields;\n var operators;\n var filter;\n var accentFoldingFiltering = this.options.accentFoldingFiltering;\n\n expressions = accentFoldingFiltering ? $.extend({}, normalizeFilter(expressions), { accentFoldingFiltering: accentFoldingFiltering }) : normalizeFilter(expressions);\n\n if (!expressions || expressions.filters.length === 0) {\n this._updateHierarchicalFilter(function() {return true;});\n return false;\n }\n\n compiled = Query.filterExpr(expressions);\n fields = compiled.fields;\n operators = compiled.operators;\n\n predicate = filter = new Function(\"d, __f, __o\", \"return \" + compiled.expression);\n\n if (fields.length || operators.length) {\n filter = function(d) {\n return predicate(d, fields, operators);\n };\n }\n\n this._updateHierarchicalFilter(filter);\n return true;\n },\n\n _updateHierarchicalFilter: function(filter) {\n var current;\n var data = this._data;\n var result = false;\n\n for (var idx = 0; idx < data.length; idx++) {\n current = data[idx];\n\n if (current.hasChildren) {\n current._matchFilter = current.children._updateHierarchicalFilter(filter);\n if (!current._matchFilter) {\n current._matchFilter = filter(current);\n }\n } else {\n current._matchFilter = filter(current);\n }\n\n if (current._matchFilter) {\n result = true;\n }\n }\n return result;\n },\n\n _find: function(method, value) {\n var idx, length, node, children;\n var data = this._data;\n\n if (!data) {\n return;\n }\n\n node = DataSource.fn[method].call(this, value);\n\n if (node) {\n return node;\n }\n\n data = this._flatData(this._data);\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n children = data[idx].children;\n\n if (!(children instanceof HierarchicalDataSource)) {\n continue;\n }\n\n node = children[method](value);\n\n if (node) {\n return node;\n }\n }\n },\n\n get: function(id) {\n return this._find(\"get\", id);\n },\n\n getByUid: function(uid) {\n return this._find(\"getByUid\", uid);\n }\n });\n\n function inferList(list, fields) {\n var items = $(list).children(),\n idx,\n length,\n data = [],\n record,\n textField = fields[0].field,\n urlField = fields[1] && fields[1].field,\n spriteCssClassField = fields[2] && fields[2].field,\n imageUrlField = fields[3] && fields[3].field,\n item,\n id,\n textChild,\n className,\n children;\n\n function elements(collection, tagName) {\n return collection.filter(tagName).add(collection.find(tagName));\n }\n\n for (idx = 0, length = items.length; idx < length; idx++) {\n record = { _loaded: true };\n item = items.eq(idx);\n\n textChild = item[0].firstChild;\n children = item.children();\n list = children.filter(\"ul\");\n children = children.filter(\":not(ul)\");\n\n id = item.attr(\"data-id\");\n\n if (id) {\n record.id = id;\n }\n\n if (textChild) {\n record[textField] = textChild.nodeType == 3 ? textChild.nodeValue : children.text();\n }\n\n if (urlField) {\n record[urlField] = elements(children, \"a\").attr(\"href\");\n }\n\n if (imageUrlField) {\n record[imageUrlField] = elements(children, \"img\").attr(\"src\");\n }\n\n if (spriteCssClassField) {\n className = elements(children, \".k-sprite\").prop(\"className\");\n record[spriteCssClassField] = className && kendo.trim(className.replace(\"k-sprite\", \"\"));\n }\n\n if (list.length) {\n record.items = inferList(list.eq(0), fields);\n }\n\n if (item.attr(\"data-hasChildren\") == \"true\") {\n record.hasChildren = true;\n }\n\n data.push(record);\n }\n\n return data;\n }\n\n HierarchicalDataSource.create = function(options) {\n options = options && options.push ? { data: options } : options;\n\n var dataSource = options || {},\n data = dataSource.data,\n fields = dataSource.fields,\n list = dataSource.list;\n\n if (data && data._dataSource) {\n return data._dataSource;\n }\n\n if (!data && fields && !dataSource.transport) {\n if (list) {\n data = inferList(list, fields);\n }\n }\n\n dataSource.data = data;\n\n return dataSource instanceof HierarchicalDataSource ? dataSource : new HierarchicalDataSource(dataSource);\n };\n\n var Buffer = kendo.Observable.extend({\n init: function(dataSource, viewSize, disablePrefetch) {\n kendo.Observable.fn.init.call(this);\n\n this._prefetching = false;\n this.dataSource = dataSource;\n this.prefetch = !disablePrefetch;\n\n var buffer = this;\n\n dataSource.bind(\"change\", function() {\n buffer._change();\n });\n\n dataSource.bind(\"reset\", function() {\n buffer._reset();\n });\n\n this._syncWithDataSource();\n\n this.setViewSize(viewSize);\n },\n\n setViewSize: function(viewSize) {\n this.viewSize = viewSize;\n this._recalculate();\n },\n\n at: function(index) {\n var pageSize = this.pageSize,\n itemPresent = true;\n\n if (index >= this.total()) {\n this.trigger(\"endreached\", { index: index });\n return null;\n }\n\n if (!this.useRanges) {\n return this.dataSource.view()[index];\n }\n if (this.useRanges) {\n // out of range request\n if (index < this.dataOffset || index >= this.skip + pageSize) {\n itemPresent = this.range(Math.floor(index / pageSize) * pageSize);\n }\n\n // prefetch\n if (index === this.prefetchThreshold) {\n this._prefetch();\n }\n\n // mid-range jump - prefetchThreshold and nextPageThreshold may be equal, do not change to else if\n if (index === this.midPageThreshold) {\n this.range(this.nextMidRange, true);\n }\n // next range jump\n else if (index === this.nextPageThreshold) {\n this.range(this.nextFullRange);\n }\n // pull-back\n else if (index === this.pullBackThreshold) {\n if (this.offset === this.skip) { // from full range to mid range\n this.range(this.previousMidRange);\n } else { // from mid range to full range\n this.range(this.previousFullRange);\n }\n }\n\n if (itemPresent) {\n return this.dataSource.at(index - this.dataOffset);\n } else {\n this.trigger(\"endreached\", { index: index });\n return null;\n }\n }\n },\n\n indexOf: function(item) {\n return this.dataSource.data().indexOf(item) + this.dataOffset;\n },\n\n total: function() {\n return parseInt(this.dataSource.total(), 10);\n },\n\n next: function() {\n var buffer = this,\n pageSize = buffer.pageSize,\n offset = buffer.skip - buffer.viewSize + pageSize,\n pageSkip = math.max(math.floor(offset / pageSize), 0) * pageSize;\n\n this.offset = offset;\n this.dataSource.prefetch(pageSkip, pageSize, function() {\n buffer._goToRange(offset, true);\n });\n },\n\n range: function(offset, nextRange) {\n if (this.offset === offset) {\n return true;\n }\n\n var buffer = this,\n pageSize = this.pageSize,\n pageSkip = math.max(math.floor(offset / pageSize), 0) * pageSize,\n dataSource = this.dataSource;\n\n if (nextRange) {\n pageSkip += pageSize;\n }\n\n if (dataSource.inRange(offset, pageSize)) {\n this.offset = offset;\n this._recalculate();\n this._goToRange(offset);\n return true;\n } else if (this.prefetch) {\n dataSource.prefetch(pageSkip, pageSize, function() {\n buffer.offset = offset;\n buffer._recalculate();\n buffer._goToRange(offset, true);\n });\n return false;\n }\n\n return true;\n },\n\n syncDataSource: function() {\n var offset = this.offset;\n this.offset = null;\n this.range(offset);\n },\n\n destroy: function() {\n this.unbind();\n },\n\n _prefetch: function() {\n var buffer = this,\n pageSize = this.pageSize,\n prefetchOffset = this.skip + pageSize,\n dataSource = this.dataSource;\n\n if (!dataSource.inRange(prefetchOffset, pageSize) && !this._prefetching && this.prefetch) {\n this._prefetching = true;\n this.trigger(\"prefetching\", { skip: prefetchOffset, take: pageSize });\n\n dataSource.prefetch(prefetchOffset, pageSize, function() {\n buffer._prefetching = false;\n buffer.trigger(\"prefetched\", { skip: prefetchOffset, take: pageSize });\n });\n }\n },\n\n _goToRange: function(offset, expanding) {\n if (this.offset !== offset) {\n return;\n }\n\n this.dataOffset = offset;\n this._expanding = expanding;\n this.dataSource.range(offset, this.pageSize);\n this.dataSource.enableRequestsInProgress();\n },\n\n _reset: function() {\n this._syncPending = true;\n },\n\n _change: function() {\n var dataSource = this.dataSource;\n\n this.length = this.useRanges ? dataSource.lastRange().end : dataSource.view().length;\n\n if (this._syncPending) {\n this._syncWithDataSource();\n this._recalculate();\n this._syncPending = false;\n this.trigger(\"reset\", { offset: this.offset });\n }\n\n this.trigger(\"resize\");\n\n if (this._expanding) {\n this.trigger(\"expand\");\n }\n\n delete this._expanding;\n },\n\n _syncWithDataSource: function() {\n var dataSource = this.dataSource;\n\n this._firstItemUid = dataSource.firstItemUid();\n this.dataOffset = this.offset = dataSource.skip() || 0;\n this.pageSize = dataSource.pageSize();\n this.useRanges = dataSource.options.serverPaging;\n },\n\n _recalculate: function() {\n var pageSize = this.pageSize,\n offset = this.offset,\n viewSize = this.viewSize,\n skip = Math.ceil(offset / pageSize) * pageSize;\n\n this.skip = skip;\n this.midPageThreshold = skip + pageSize - 1;\n this.nextPageThreshold = skip + viewSize - 1;\n this.prefetchThreshold = skip + Math.floor(pageSize / 3 * 2);\n this.pullBackThreshold = this.offset - 1;\n\n this.nextMidRange = skip + pageSize - viewSize;\n this.nextFullRange = skip;\n this.previousMidRange = offset - viewSize;\n this.previousFullRange = skip - pageSize;\n }\n });\n\n var BatchBuffer = kendo.Observable.extend({\n init: function(dataSource, batchSize) {\n var batchBuffer = this;\n\n kendo.Observable.fn.init.call(batchBuffer);\n\n this.dataSource = dataSource;\n this.batchSize = batchSize;\n this._total = 0;\n\n this.buffer = new Buffer(dataSource, batchSize * 3);\n\n this.buffer.bind({\n \"endreached\": function(e) {\n batchBuffer.trigger(\"endreached\", { index: e.index });\n },\n \"prefetching\": function(e) {\n batchBuffer.trigger(\"prefetching\", { skip: e.skip, take: e.take });\n },\n \"prefetched\": function(e) {\n batchBuffer.trigger(\"prefetched\", { skip: e.skip, take: e.take });\n },\n \"reset\": function() {\n batchBuffer._total = 0;\n batchBuffer.trigger(\"reset\");\n },\n \"resize\": function() {\n batchBuffer._total = Math.ceil(this.length / batchBuffer.batchSize);\n batchBuffer.trigger(\"resize\", { total: batchBuffer.total(), offset: this.offset });\n }\n });\n },\n\n syncDataSource: function() {\n this.buffer.syncDataSource();\n },\n\n at: function(index) {\n var buffer = this.buffer,\n skip = index * this.batchSize,\n take = this.batchSize,\n view = [],\n item;\n\n if (buffer.offset > skip) {\n buffer.at(buffer.offset - 1);\n }\n\n for (var i = 0; i < take; i++) {\n item = buffer.at(skip + i);\n\n if (item === null) {\n break;\n }\n\n view.push(item);\n }\n\n return view;\n },\n\n total: function() {\n return this._total;\n },\n\n destroy: function() {\n this.buffer.destroy();\n this.unbind();\n }\n });\n\n extend(true, kendo.data, {\n readers: {\n json: DataReader\n },\n Query: Query,\n DataSource: DataSource,\n HierarchicalDataSource: HierarchicalDataSource,\n Node: Node,\n Comparer: Comparer,\n ObservableObject: ObservableObject,\n ObservableArray: ObservableArray,\n LazyObservableArray: LazyObservableArray,\n LocalTransport: LocalTransport,\n RemoteTransport: RemoteTransport,\n Cache: Cache,\n DataReader: DataReader,\n Model: Model,\n Buffer: Buffer,\n BatchBuffer: BatchBuffer\n });\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.binder',[ \"kendo.core\", \"kendo.data\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"binder\",\n name: \"MVVM\",\n category: \"framework\",\n description: \"Model View ViewModel (MVVM) is a design pattern which helps developers separate the Model (the data) from the View (the UI).\",\n depends: [ \"core\", \"data\" ]\n};\n\n\n(function($, undefined) {\n var kendo = window.kendo,\n Observable = kendo.Observable,\n ObservableObject = kendo.data.ObservableObject,\n ObservableArray = kendo.data.ObservableArray,\n toString = {}.toString,\n binders = {},\n Class = kendo.Class,\n VALUE = \"value\",\n SOURCE = \"source\",\n EVENTS = \"events\",\n CHECKED = \"checked\",\n CSS = \"css\",\n deleteExpando = true,\n FUNCTION = \"function\",\n CHANGE = \"change\";\n\n (function() {\n var a = document.createElement(\"a\");\n\n try {\n delete a.test;\n } catch (e) {\n deleteExpando = false;\n }\n })();\n\n var Binding = Observable.extend( {\n init: function(parents, path) {\n var that = this;\n\n Observable.fn.init.call(that);\n\n that.source = parents[0];\n that.parents = parents;\n that.path = path;\n that.dependencies = {};\n that.dependencies[path] = true;\n that.observable = that.source instanceof Observable;\n\n that._access = function(e) {\n that.dependencies[e.field] = true;\n };\n\n if (that.observable) {\n that._change = function(e) {\n that.change(e);\n };\n\n that.source.bind(CHANGE, that._change);\n }\n },\n\n _parents: function() {\n var parents = this.parents;\n var value = this.get();\n\n if (value && typeof value.parent == \"function\") {\n var parent = value.parent();\n\n if ($.inArray(parent, parents) < 0) {\n parents = [parent].concat(parents);\n }\n }\n\n return parents;\n },\n\n change: function(e) {\n var dependency,\n ch,\n field = e.field,\n that = this;\n\n if (that.path === \"this\") {\n that.trigger(CHANGE, e);\n } else {\n for (dependency in that.dependencies) {\n if (dependency.indexOf(field) === 0) {\n ch = dependency.charAt(field.length);\n\n if (!ch || ch === \".\" || ch === \"[\") {\n that.trigger(CHANGE, e);\n break;\n }\n }\n }\n }\n },\n\n start: function(source) {\n source.bind(\"get\", this._access);\n },\n\n stop: function(source) {\n source.unbind(\"get\", this._access);\n },\n\n get: function() {\n\n var that = this,\n source = that.source,\n index = 0,\n path = that.path,\n result = source;\n\n if (!that.observable) {\n return result;\n }\n\n that.start(that.source);\n\n result = source.get(path);\n\n // Traverse the observable hierarchy if the binding is not resolved at the current level.\n while (result === undefined && source) {\n\n source = that.parents[++index];\n\n if (source instanceof ObservableObject) {\n result = source.get(path);\n }\n }\n\n // second pass try to get the parent from the object hierarchy\n if (result === undefined) {\n source = that.source; //get the initial source\n\n while (result === undefined && source) {\n source = source.parent();\n\n if (source instanceof ObservableObject) {\n result = source.get(path);\n }\n }\n }\n\n // If the result is a function - invoke it\n if (typeof result === \"function\") {\n index = path.lastIndexOf(\".\");\n\n // If the function is a member of a nested observable object make that nested observable the context (this) of the function\n if (index > 0) {\n source = source.get(path.substring(0, index));\n }\n\n // Invoke the function\n that.start(source);\n\n if (source !== that.source) {\n result = result.call(source, that.source);\n } else {\n result = result.call(source);\n }\n\n that.stop(source);\n }\n\n // If the binding is resolved by a parent object\n if (source && source !== that.source) {\n\n that.currentSource = source; // save parent object\n\n // Listen for changes in the parent object\n source.unbind(CHANGE, that._change)\n .bind(CHANGE, that._change);\n }\n\n that.stop(that.source);\n\n return result;\n },\n\n set: function(value) {\n var source = this.currentSource || this.source;\n\n var field = kendo.getter(this.path)(source);\n\n if (typeof field === \"function\") {\n if (source !== this.source) {\n field.call(source, this.source, value);\n } else {\n field.call(source, value);\n }\n } else {\n source.set(this.path, value);\n }\n },\n\n destroy: function() {\n if (this.observable) {\n this.source.unbind(CHANGE, this._change);\n if (this.currentSource) {\n this.currentSource.unbind(CHANGE, this._change);\n }\n }\n\n this.unbind();\n }\n });\n\n var EventBinding = Binding.extend( {\n get: function() {\n var source = this.source,\n path = this.path,\n index = 0,\n handler;\n\n handler = source.get(path);\n\n while (!handler && source) {\n source = this.parents[++index];\n\n if (source instanceof ObservableObject) {\n handler = source.get(path);\n }\n }\n\n if (!handler) {\n return;\n }\n\n return handler.bind(source);\n }\n });\n\n var TemplateBinding = Binding.extend( {\n init: function(source, path, template) {\n var that = this;\n\n Binding.fn.init.call(that, source, path);\n\n that.template = template;\n },\n\n render: function(value) {\n var html;\n\n this.start(this.source);\n\n html = kendo.render(this.template, value);\n\n this.stop(this.source);\n\n return html;\n }\n });\n\n var Binder = Class.extend({\n init: function(element, bindings, options) {\n this.element = element;\n this.bindings = bindings;\n this.options = options;\n },\n\n bind: function(binding, attribute) {\n var that = this;\n\n binding = attribute ? binding[attribute] : binding;\n\n binding.bind(CHANGE, function(e) {\n that.refresh(attribute || e);\n });\n\n that.refresh(attribute);\n },\n\n destroy: function() {\n }\n });\n\n var TypedBinder = Binder.extend({\n dataType: function() {\n var dataType = this.element.getAttribute(\"data-\" + kendo.ns + \"type\") || this.element.type || \"text\";\n return dataType.toLowerCase();\n },\n\n parsedValue: function() {\n return this._parseValue(this.element.value, this.dataType());\n },\n\n _parseValue: function(value, dataType) {\n if (dataType == \"date\") {\n value = kendo.parseDate(value, \"yyyy-MM-dd\");\n } else if (dataType == \"datetime-local\") {\n value = kendo.parseDate(value, [\"yyyy-MM-ddTHH:mm:ss\", \"yyyy-MM-ddTHH:mm\"] );\n } else if (dataType == \"number\") {\n value = kendo.parseFloat(value);\n } else if (dataType == \"boolean\") {\n value = value.toLowerCase();\n if (kendo.parseFloat(value) !== null) {\n value = Boolean(kendo.parseFloat(value));\n } else {\n value = (value.toLowerCase() === \"true\");\n }\n }\n return value;\n }\n });\n\n binders.attr = Binder.extend({\n refresh: function(key) {\n this.element.setAttribute(key, this.bindings.attr[key].get());\n }\n });\n\n binders.css = Binder.extend({\n init: function(element, bindings, options) {\n Binder.fn.init.call(this, element, bindings, options);\n this.classes = {};\n },\n refresh: function(className) {\n var element = $(this.element),\n binding = this.bindings.css[className],\n hasClass = this.classes[className] = binding.get();\n if (hasClass) {\n element.addClass(className);\n } else {\n element.removeClass(className);\n }\n }\n });\n\n binders.style = Binder.extend({\n refresh: function(key) {\n this.element.style[key] = this.bindings.style[key].get() || \"\";\n }\n });\n\n binders.enabled = Binder.extend({\n refresh: function() {\n if (this.bindings.enabled.get()) {\n this.element.removeAttribute(\"disabled\");\n } else {\n this.element.setAttribute(\"disabled\", \"disabled\");\n }\n }\n });\n\n binders.readonly = Binder.extend({\n refresh: function() {\n if (this.bindings.readonly.get()) {\n this.element.setAttribute(\"readonly\", \"readonly\");\n } else {\n this.element.removeAttribute(\"readonly\");\n }\n }\n });\n\n binders.disabled = Binder.extend({\n refresh: function() {\n if (this.bindings.disabled.get()) {\n this.element.setAttribute(\"disabled\", \"disabled\");\n } else {\n this.element.removeAttribute(\"disabled\");\n }\n }\n });\n\n binders.events = Binder.extend({\n init: function(element, bindings, options) {\n Binder.fn.init.call(this, element, bindings, options);\n this.handlers = {};\n },\n\n refresh: function(key) {\n var element = $(this.element),\n binding = this.bindings.events[key],\n handler = this.handlers[key];\n\n if (handler) {\n element.off(key, handler);\n }\n\n handler = this.handlers[key] = binding.get();\n\n element.on(key, binding.source, handler);\n },\n\n destroy: function() {\n var element = $(this.element),\n handler;\n\n for (handler in this.handlers) {\n element.off(handler, this.handlers[handler]);\n }\n }\n });\n\n binders.text = Binder.extend({\n refresh: function() {\n var text = this.bindings.text.get();\n var dataFormat = this.element.getAttribute(\"data-\" + kendo.ns + \"format\") || \"\";\n if (text == null) {\n text = \"\";\n }\n\n $(this.element).text(kendo.toString(text, dataFormat));\n }\n });\n\n binders.visible = Binder.extend({\n refresh: function() {\n if (this.bindings.visible.get()) {\n this.element.style.display = \"\";\n } else {\n this.element.style.display = \"none\";\n }\n }\n });\n\n binders.invisible = Binder.extend({\n refresh: function() {\n if (!this.bindings.invisible.get()) {\n this.element.style.display = \"\";\n } else {\n this.element.style.display = \"none\";\n }\n }\n });\n\n binders.html = Binder.extend({\n refresh: function() {\n this.element.innerHTML = this.bindings.html.get();\n }\n });\n\n binders.value = TypedBinder.extend({\n init: function(element, bindings, options) {\n TypedBinder.fn.init.call(this, element, bindings, options);\n\n this._change = this.change.bind(this);\n this.eventName = options.valueUpdate || CHANGE;\n\n $(this.element).on(this.eventName, this._change);\n\n this._initChange = false;\n },\n\n change: function() {\n this._initChange = this.eventName != CHANGE;\n\n this.bindings[VALUE].set(this.parsedValue());\n\n this._initChange = false;\n },\n\n refresh: function() {\n if (!this._initChange) {\n var value = this.bindings[VALUE].get();\n\n if (value == null) {\n value = \"\";\n }\n\n var type = this.dataType();\n\n if (type == \"date\") {\n value = kendo.toString(value, \"yyyy-MM-dd\");\n } else if (type == \"datetime-local\") {\n value = kendo.toString(value, \"yyyy-MM-ddTHH:mm:ss\");\n }\n\n this.element.value = value;\n }\n\n this._initChange = false;\n },\n\n destroy: function() {\n $(this.element).off(this.eventName, this._change);\n }\n });\n\n binders.source = Binder.extend({\n init: function(element, bindings, options) {\n Binder.fn.init.call(this, element, bindings, options);\n\n var source = this.bindings.source.get();\n\n if (source instanceof kendo.data.DataSource && options.autoBind !== false) {\n source.fetch();\n }\n },\n\n refresh: function(e) {\n var that = this,\n source = that.bindings.source.get();\n\n if (source instanceof ObservableArray || source instanceof kendo.data.DataSource) {\n e = e || {};\n\n if (e.action == \"add\") {\n that.add(e.index, e.items);\n } else if (e.action == \"remove\") {\n that.remove(e.index, e.items);\n } else if (e.action != \"itemchange\") {\n that.render();\n }\n } else {\n that.render();\n }\n },\n\n container: function() {\n var element = this.element;\n\n if (element.nodeName.toLowerCase() == \"table\") {\n if (!element.tBodies[0]) {\n element.appendChild(document.createElement(\"tbody\"));\n }\n element = element.tBodies[0];\n }\n\n return element;\n },\n\n template: function() {\n var options = this.options,\n template = options.template,\n nodeName = this.container().nodeName.toLowerCase();\n\n if (!template) {\n if (nodeName == \"select\") {\n if (options.valueField || options.textField) {\n template = kendo.format('',\n options.valueField || options.textField, options.textField || options.valueField);\n } else {\n template = \"\";\n }\n } else if (nodeName == \"tbody\") {\n template = \"#:data#\";\n } else if (nodeName == \"ul\" || nodeName == \"ol\") {\n template = \"
  • #:data#
  • \";\n } else {\n template = \"#:data#\";\n }\n template = kendo.template(template);\n }\n\n return template;\n },\n\n add: function(index, items) {\n var element = this.container(),\n parents,\n idx,\n length,\n child,\n clone = element.cloneNode(false),\n reference = element.children[index];\n\n $(clone).html(kendo.render(this.template(), items));\n\n if (clone.children.length) {\n parents = this.bindings.source._parents();\n\n for (idx = 0, length = items.length; idx < length; idx++) {\n child = clone.children[0];\n element.insertBefore(child, reference || null);\n bindElement(child, items[idx], this.options.roles, [items[idx]].concat(parents));\n }\n }\n },\n\n remove: function(index, items) {\n var idx, element = this.container();\n\n for (idx = 0; idx < items.length; idx++) {\n var child = element.children[index];\n unbindElementTree(child, true);\n if (child.parentNode == element) {\n element.removeChild(child);\n }\n }\n },\n\n render: function() {\n var source = this.bindings.source.get(),\n parents,\n idx,\n length,\n element = this.container(),\n template = this.template();\n\n if (source == null) {\n return;\n }\n\n if (source instanceof kendo.data.DataSource) {\n source = source.view();\n }\n\n if (!(source instanceof ObservableArray) && toString.call(source) !== \"[object Array]\") {\n source = [source];\n }\n\n if (this.bindings.template) {\n unbindElementChildren(element, true);\n\n $(element).html(this.bindings.template.render(source));\n\n if (element.children.length) {\n parents = this.bindings.source._parents();\n\n for (idx = 0, length = source.length; idx < length; idx++) {\n bindElement(element.children[idx], source[idx], this.options.roles, [source[idx]].concat(parents));\n }\n }\n } else {\n $(element).html(kendo.render(template, source));\n }\n }\n });\n\n binders.input = {\n checked: TypedBinder.extend({\n init: function(element, bindings, options) {\n TypedBinder.fn.init.call(this, element, bindings, options);\n this._change = this.change.bind(this);\n\n $(this.element).change(this._change);\n },\n\n change: function() {\n var element = this.element;\n var value = this.value();\n\n if (element.type == \"radio\") {\n value = this.parsedValue();\n this.bindings[CHECKED].set(value);\n } else if (element.type == \"checkbox\") {\n var source = this.bindings[CHECKED].get();\n var index;\n\n if (source instanceof ObservableArray) {\n value = this.parsedValue();\n if (value instanceof Date) {\n for (var i = 0; i < source.length; i++) {\n if (source[i] instanceof Date && +source[i] === +value) {\n index = i;\n break;\n }\n }\n } else {\n index = source.indexOf(value);\n }\n if (index > -1) {\n source.splice(index, 1);\n } else {\n source.push(value);\n }\n } else {\n this.bindings[CHECKED].set(value);\n }\n }\n },\n\n refresh: function() {\n var value = this.bindings[CHECKED].get(),\n source = value,\n type = this.dataType(),\n element = this.element;\n\n if (element.type == \"checkbox\") {\n if (source instanceof ObservableArray) {\n var index = -1;\n value = this.parsedValue();\n if (value instanceof Date) {\n for (var i = 0; i < source.length; i++) {\n if (source[i] instanceof Date && +source[i] === +value) {\n index = i;\n break;\n }\n }\n } else {\n index = source.indexOf(value);\n }\n element.checked = (index >= 0);\n } else {\n element.checked = source;\n }\n } else if (element.type == \"radio\") {\n if (type == \"date\") {\n value = kendo.toString(value, \"yyyy-MM-dd\");\n } else if (type == \"datetime-local\") {\n value = kendo.toString(value, \"yyyy-MM-ddTHH:mm:ss\");\n }\n\n if (value !== null && typeof(value) !== \"undefined\" && element.value === value.toString()) {\n element.checked = true;\n } else {\n element.checked = false;\n }\n }\n },\n\n value: function() {\n var element = this.element,\n value = element.value;\n\n if (element.type == \"checkbox\") {\n value = element.checked;\n }\n\n return value;\n },\n destroy: function() {\n $(this.element).off(CHANGE, this._change);\n }\n })\n };\n\n binders.select = {\n source: binders.source.extend({\n refresh: function(e) {\n var that = this,\n source = that.bindings.source.get();\n\n if (source instanceof ObservableArray || source instanceof kendo.data.DataSource) {\n e = e || {};\n if (e.action == \"add\") {\n that.add(e.index, e.items);\n } else if (e.action == \"remove\") {\n that.remove(e.index, e.items);\n } else if (e.action == \"itemchange\" || e.action === undefined) {\n that.render();\n if (that.bindings.value) {\n if (that.bindings.value) {\n var val = retrievePrimitiveValues(that.bindings.value.get(), $(that.element).data(\"valueField\"));\n if (val === null) {\n that.element.selectedIndex = -1;\n } else {\n that.element.value = val;\n }\n }\n }\n }\n } else {\n that.render();\n }\n }\n }),\n value: TypedBinder.extend({\n init: function(target, bindings, options) {\n TypedBinder.fn.init.call(this, target, bindings, options);\n\n this._change = this.change.bind(this);\n $(this.element).change(this._change);\n },\n\n parsedValue: function() {\n var dataType = this.dataType();\n var values = [];\n var value, option, idx, length;\n for (idx = 0, length = this.element.options.length; idx < length; idx++) {\n option = this.element.options[idx];\n\n if (option.selected) {\n value = option.attributes.value;\n\n if (value && value.specified) {\n value = option.value;\n } else {\n value = option.text;\n }\n\n values.push(this._parseValue(value, dataType));\n }\n }\n return values;\n },\n\n change: function() {\n var values = [],\n element = this.element,\n source,\n field = this.options.valueField || this.options.textField,\n valuePrimitive = this.options.valuePrimitive,\n option,\n valueIndex,\n value,\n idx,\n length;\n\n for (idx = 0, length = element.options.length; idx < length; idx++) {\n option = element.options[idx];\n\n if (option.selected) {\n value = option.attributes.value;\n\n if (value && value.specified) {\n value = option.value;\n } else {\n value = option.text;\n }\n\n if (field) {\n values.push(value);\n } else {\n values.push(this._parseValue(value, this.dataType()));\n }\n\n }\n }\n\n if (field) {\n source = this.bindings.source.get();\n if (source instanceof kendo.data.DataSource) {\n source = source.view();\n }\n\n for (valueIndex = 0; valueIndex < values.length; valueIndex++) {\n for (idx = 0, length = source.length; idx < length; idx++) {\n var sourceValue = source[idx].get(field);\n var match = (String(sourceValue) === values[valueIndex]);\n if (match) {\n values[valueIndex] = source[idx];\n break;\n }\n }\n }\n }\n\n value = this.bindings[VALUE].get();\n if (value instanceof ObservableArray) {\n value.splice.apply(value, [0, value.length].concat(values));\n } else if (!valuePrimitive && (value instanceof ObservableObject || value === null || value === undefined || !field)) {\n this.bindings[VALUE].set(values[0]);\n } else {\n this.bindings[VALUE].set(values[0].get(field));\n }\n },\n refresh: function() {\n var optionIndex,\n element = this.element,\n options = element.options,\n value = this.bindings[VALUE].get(),\n values = value,\n field = this.options.valueField || this.options.textField,\n found = false,\n type = this.dataType(),\n optionValue;\n\n if (!(values instanceof ObservableArray)) {\n values = new ObservableArray([value]);\n }\n\n element.selectedIndex = -1;\n\n for (var valueIndex = 0; valueIndex < values.length; valueIndex++) {\n value = values[valueIndex];\n\n\n if (field && value instanceof ObservableObject) {\n value = value.get(field);\n }\n\n if (type == \"date\") {\n value = kendo.toString(values[valueIndex], \"yyyy-MM-dd\");\n } else if (type == \"datetime-local\") {\n value = kendo.toString(values[valueIndex], \"yyyy-MM-ddTHH:mm:ss\");\n }\n\n for (optionIndex = 0; optionIndex < options.length; optionIndex++) {\n optionValue = options[optionIndex].value;\n\n if (optionValue === \"\" && value !== \"\") {\n optionValue = options[optionIndex].text;\n }\n\n if (value != null && optionValue == value.toString()) {\n options[optionIndex].selected = true;\n found = true;\n }\n }\n }\n },\n destroy: function() {\n $(this.element).off(CHANGE, this._change);\n }\n })\n };\n\n function dataSourceBinding(bindingName, fieldName, setter) {\n return Binder.extend({\n init: function(widget, bindings, options) {\n var that = this;\n\n Binder.fn.init.call(that, widget.element[0], bindings, options);\n\n that.widget = widget;\n that._dataBinding = that.dataBinding.bind(that);\n that._dataBound = that.dataBound.bind(that);\n that._itemChange = that.itemChange.bind(that);\n },\n\n itemChange: function(e) {\n bindElement(e.item[0], e.data, this._ns(e.ns), [e.data].concat(this.bindings[bindingName]._parents()));\n },\n\n dataBinding: function(e) {\n var idx,\n length,\n widget = this.widget,\n items = e.removedItems || widget.items();\n\n for (idx = 0, length = items.length; idx < length; idx++) {\n unbindElementTree(items[idx], false);\n }\n },\n\n _ns: function(ns) {\n ns = ns || kendo.ui;\n var all = [ kendo.ui, kendo.dataviz.ui, kendo.mobile.ui ];\n all.splice($.inArray(ns, all), 1);\n all.unshift(ns);\n\n return kendo.rolesFromNamespaces(all);\n },\n\n dataBound: function(e) {\n var idx,\n length,\n widget = this.widget,\n items = e.addedItems || widget.items(),\n dataSource = widget[fieldName],\n view,\n parents,\n hds = kendo.data.HierarchicalDataSource;\n\n if (hds && dataSource instanceof hds) {\n // suppress binding of HDS items, because calling view() on root\n // will return only root items, and widget.items() returns all items\n return;\n }\n\n if (items.length) {\n view = e.addedDataItems || dataSource.flatView();\n parents = this.bindings[bindingName]._parents();\n\n for (idx = 0, length = view.length; idx < length; idx++) {\n if (items[idx]) {\n bindElement(items[idx], view[idx], this._ns(e.ns), [view[idx]].concat(parents));\n }\n }\n }\n },\n\n refresh: function(e) {\n var that = this,\n source,\n widget = that.widget,\n select, multiselect, dropdowntree;\n\n e = e || {};\n\n if (!e.action) {\n that.destroy();\n\n widget.bind(\"dataBinding\", that._dataBinding);\n widget.bind(\"dataBound\", that._dataBound);\n widget.bind(\"itemChange\", that._itemChange);\n\n source = that.bindings[bindingName].get();\n\n if (widget[fieldName] instanceof kendo.data.DataSource && widget[fieldName] != source) {\n if (source instanceof kendo.data.DataSource) {\n widget[setter](source);\n } else if (source && source._dataSource) {\n widget[setter](source._dataSource);\n } else {\n select = kendo.ui.Select && widget instanceof kendo.ui.Select;\n multiselect = kendo.ui.MultiSelect && widget instanceof kendo.ui.MultiSelect;\n dropdowntree = kendo.ui.DropDownTree && widget instanceof kendo.ui.DropDownTree;\n\n if (!dropdowntree) {\n widget[fieldName].data(source);\n } else {\n widget.treeview[fieldName].data(source);\n }\n\n if (that.bindings.value && (select || multiselect)) {\n widget.value(retrievePrimitiveValues(that.bindings.value.get(), widget.options.dataValueField));\n }\n }\n }\n }\n },\n\n destroy: function() {\n var widget = this.widget;\n\n widget.unbind(\"dataBinding\", this._dataBinding);\n widget.unbind(\"dataBound\", this._dataBound);\n widget.unbind(\"itemChange\", this._itemChange);\n }\n });\n }\n\n binders.widget = {\n events: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n this.widget = widget;\n this.handlers = {};\n },\n\n refresh: function(key) {\n var binding = this.bindings.events[key],\n handler = this.handlers[key];\n\n if (handler) {\n this.widget.unbind(key, handler);\n }\n\n handler = binding.get();\n\n this.handlers[key] = function(e) {\n e.data = binding.source;\n\n handler(e);\n\n if (e.data === binding.source) {\n delete e.data;\n }\n };\n\n this.widget.bind(key, this.handlers[key]);\n },\n\n destroy: function() {\n var handler;\n\n for (handler in this.handlers) {\n this.widget.unbind(handler, this.handlers[handler]);\n }\n }\n }),\n\n checked: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n\n this.widget = widget;\n this._change = this.change.bind(this);\n this.widget.bind(CHANGE, this._change);\n },\n change: function() {\n this.bindings[CHECKED].set(this.value());\n },\n\n refresh: function() {\n if (this.element.type === \"radio\") {\n this.widget.check(this.bindings[CHECKED].get().toString() === this.value());\n } else {\n this.widget.check(this.bindings[CHECKED].get() === true);\n }\n },\n\n value: function() {\n var element = this.element,\n value = element.value;\n\n if (value == \"on\" || value == \"off\" || this.element.type == \"checkbox\") {\n value = element.checked;\n }\n\n return value;\n },\n\n destroy: function() {\n this.widget.unbind(CHANGE, this._change);\n }\n }),\n\n start: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n this._change = this.change.bind(this);\n this.widget = widget;\n this.widget.bind(CHANGE, this._change);\n },\n\n change: function() {\n this.bindings.start.set(this.widget.range().start);\n },\n\n refresh: function() {\n var that = this;\n var start = this.bindings.start.get();\n var end = that.widget._range ? that.widget._range.end : null;\n this.widget.range({ start: start, end: end });\n },\n\n destroy: function() {\n this.widget.unbind(CHANGE, this._change);\n }\n }),\n\n end: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n this._change = this.change.bind(this);\n this.widget = widget;\n this.widget.bind(CHANGE, this._change);\n },\n\n change: function() {\n this.bindings.end.set(this.widget.range().end);\n },\n\n refresh: function() {\n var that = this;\n var end = this.bindings.end.get();\n var start = that.widget._range ? that.widget._range.start : null;\n this.widget.range({ start: start, end: end });\n },\n\n destroy: function() {\n this.widget.unbind(CHANGE, this._change);\n }\n }),\n\n visible: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n\n this.widget = widget;\n },\n\n refresh: function() {\n var visible = this.bindings.visible.get();\n this.widget.wrapper[0].style.display = visible ? \"\" : \"none\";\n }\n }),\n\n invisible: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n\n this.widget = widget;\n },\n\n refresh: function() {\n var invisible = this.bindings.invisible.get();\n this.widget.wrapper[0].style.display = invisible ? \"none\" : \"\";\n }\n }),\n\n floatingLabel: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n\n if (!widget.floatingLabel) {\n return;\n }\n\n widget.floatingLabel.refresh();\n }\n }),\n\n enabled: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n\n this.widget = widget;\n },\n\n refresh: function() {\n if (this.widget.enable) {\n this.widget.enable(this.bindings.enabled.get());\n }\n }\n }),\n\n disabled: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n\n this.widget = widget;\n },\n\n refresh: function() {\n if (this.widget.enable) {\n this.widget.enable(!this.bindings.disabled.get());\n }\n }\n }),\n\n source: dataSourceBinding(\"source\", \"dataSource\", \"setDataSource\"),\n\n value: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n\n this.widget = widget;\n this._change = this.change.bind(this);\n this.widget.first(CHANGE, this._change);\n\n var value = this.bindings.value.get();\n\n this._valueIsObservableObject = !options.valuePrimitive && (value == null || value instanceof ObservableObject);\n this._valueIsObservableArray = value instanceof ObservableArray;\n this._initChange = false;\n },\n\n _source: function() {\n var source;\n\n if (this.widget.dataItem) {\n source = this.widget.dataItem();\n if (source && source instanceof ObservableObject) {\n return [source];\n }\n }\n\n if (this.bindings.source) {\n source = this.bindings.source.get();\n }\n\n if (!source || source instanceof kendo.data.DataSource) {\n source = this.widget.dataSource.flatView();\n }\n\n return source;\n },\n\n change: function() {\n var value = this.widget.value(),\n field = this.options.dataValueField || this.options.dataTextField,\n isArray = toString.call(value) === \"[object Array]\",\n isObservableObject = this._valueIsObservableObject,\n valueIndex, valueLength, values = [],\n sourceItem, sourceValue,\n idx, length, source;\n\n this._initChange = true;\n\n if (field) {\n\n if (value === \"\" && (isObservableObject || this.options.valuePrimitive)) {\n value = null;\n } else {\n source = this._source();\n\n if (isArray) {\n valueLength = value.length;\n values = value.slice(0);\n }\n\n for (idx = 0, length = source.length; idx < length; idx++) {\n sourceItem = source[idx];\n sourceValue = sourceItem.get(field);\n\n if (isArray) {\n for (valueIndex = 0; valueIndex < valueLength; valueIndex++) {\n if (sourceValue == values[valueIndex]) {\n values[valueIndex] = sourceItem;\n break;\n }\n }\n } else if (sourceValue == value) {\n value = isObservableObject ? sourceItem : sourceValue;\n break;\n }\n }\n\n if (values[0]) {\n if (this._valueIsObservableArray) {\n value = values;\n } else if (isObservableObject || !field) {\n value = values[0];\n } else {\n value = values[0].get(field);\n }\n }\n }\n }\n\n this.bindings.value.set(value);\n this._initChange = false;\n },\n\n refresh: function() {\n if (!this._initChange) {\n var widget = this.widget;\n var options = widget.options;\n var textField = options.dataTextField;\n var valueField = options.dataValueField || textField;\n var value = this.bindings.value.get();\n var text = options.text || \"\";\n var idx = 0, length;\n var values = [];\n\n if (value === undefined) {\n value = null;\n }\n\n if (valueField) {\n if (value instanceof ObservableArray) {\n for (length = value.length; idx < length; idx++) {\n values[idx] = value[idx].get(valueField);\n }\n value = values;\n } else if (value instanceof ObservableObject) {\n text = value.get(textField);\n value = value.get(valueField);\n }\n }\n\n if (options.autoBind === false && !options.cascadeFrom && widget.listView && !widget.listView.bound()) {\n if (textField === valueField && !text) {\n text = value;\n }\n\n if (!text && (value || value === 0) && options.valuePrimitive) {\n widget.value(value);\n } else {\n widget._preselect(value, text);\n }\n } else {\n widget.value(value);\n }\n }\n\n this._initChange = false;\n },\n\n destroy: function() {\n this.widget.unbind(CHANGE, this._change);\n }\n }),\n dropdowntree: {\n value: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n\n this.widget = widget;\n this._change = this.change.bind(this);\n this.widget.first(CHANGE, this._change);\n this._initChange = false;\n },\n\n change: function() {\n var that = this,\n oldValues = that.bindings[VALUE].get(),\n valuePrimitive = that.options.valuePrimitive,\n selectedNode = that.widget.treeview.select(),\n nonPrimitiveValues = that.widget._isMultipleSelection() ? that.widget._getAllChecked() : (that.widget.treeview.dataItem(selectedNode) || that.widget.value()),\n newValues = (valuePrimitive || that.widget.options.autoBind === false) ? that.widget.value() : nonPrimitiveValues;\n\n var field = this.options.dataValueField || this.options.dataTextField;\n\n newValues = newValues.slice ? newValues.slice(0) : newValues;\n\n that._initChange = true;\n\n if (oldValues instanceof ObservableArray) {\n var remove = [];\n var newLength = newValues.length;\n var i = 0, j = 0;\n var old = oldValues[i];\n var same = false;\n var removeIndex;\n var newValue;\n var found;\n\n while (old !== undefined) {\n found = false;\n for (j = 0; j < newLength; j++) {\n if (valuePrimitive) {\n same = newValues[j] == old;\n } else {\n newValue = newValues[j];\n\n newValue = newValue.get ? newValue.get(field) : newValue;\n same = newValue == (old.get ? old.get(field) : old);\n }\n\n if (same) {\n newValues.splice(j, 1);\n newLength -= 1;\n found = true;\n break;\n }\n }\n\n if (!found) {\n remove.push(old);\n arraySplice(oldValues, i, 1);\n removeIndex = i;\n } else {\n i += 1;\n }\n\n old = oldValues[i];\n }\n\n arraySplice(oldValues, oldValues.length, 0, newValues);\n\n if (remove.length) {\n oldValues.trigger(\"change\", {\n action: \"remove\",\n items: remove,\n index: removeIndex\n });\n }\n\n if (newValues.length) {\n oldValues.trigger(\"change\", {\n action: \"add\",\n items: newValues,\n index: oldValues.length - 1\n });\n }\n } else {\n that.bindings[VALUE].set(newValues);\n }\n\n that._initChange = false;\n },\n\n refresh: function() {\n if (!this._initChange) {\n var options = this.options,\n widget = this.widget,\n field = options.dataValueField || options.dataTextField,\n value = this.bindings.value.get(),\n data = value,\n idx = 0, length,\n values = [],\n selectedValue;\n\n if (field) {\n if (value instanceof ObservableArray) {\n for (length = value.length; idx < length; idx++) {\n selectedValue = value[idx];\n values[idx] = selectedValue.get ? selectedValue.get(field) : selectedValue;\n }\n value = values;\n } else if (value instanceof ObservableObject) {\n value = value.get(field);\n }\n }\n if (options.autoBind === false && options.valuePrimitive !== true) {\n widget._preselect(data, value);\n } else {\n widget.value(value);\n }\n }\n },\n\n destroy: function() {\n this.widget.unbind(CHANGE, this._change);\n }\n })\n },\n gantt: {\n dependencies: dataSourceBinding(\"dependencies\", \"dependencies\", \"setDependenciesDataSource\")\n },\n\n multiselect: {\n value: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n\n this.widget = widget;\n this._change = this.change.bind(this);\n this.widget.first(CHANGE, this._change);\n this._initChange = false;\n },\n\n change: function() {\n var that = this,\n oldValues = that.bindings[VALUE].get(),\n valuePrimitive = that.options.valuePrimitive,\n newValues = valuePrimitive ? that.widget.value() : that.widget.dataItems();\n\n var field = this.options.dataValueField || this.options.dataTextField;\n\n newValues = newValues.slice(0);\n\n that._initChange = true;\n\n if (oldValues instanceof ObservableArray) {\n var remove = [];\n\n var newLength = newValues.length;\n\n var i = 0, j = 0;\n var old = oldValues[i];\n var same = false;\n var removeIndex;\n var newValue;\n var found;\n\n while (old !== undefined) {\n found = false;\n for (j = 0; j < newLength; j++) {\n if (valuePrimitive) {\n same = newValues[j] == old;\n } else {\n newValue = newValues[j];\n\n newValue = newValue.get ? newValue.get(field) : newValue;\n same = newValue == (old.get ? old.get(field) : old);\n }\n\n if (same) {\n newValues.splice(j, 1);\n newLength -= 1;\n found = true;\n break;\n }\n }\n\n if (!found) {\n remove.push(old);\n arraySplice(oldValues, i, 1);\n removeIndex = i;\n } else {\n i += 1;\n }\n\n old = oldValues[i];\n }\n\n arraySplice(oldValues, oldValues.length, 0, newValues);\n\n if (remove.length) {\n oldValues.trigger(\"change\", {\n action: \"remove\",\n items: remove,\n index: removeIndex\n });\n }\n\n if (newValues.length) {\n oldValues.trigger(\"change\", {\n action: \"add\",\n items: newValues,\n index: oldValues.length - 1\n });\n }\n } else {\n that.bindings[VALUE].set(newValues);\n }\n\n that._initChange = false;\n },\n\n refresh: function() {\n if (!this._initChange) {\n var options = this.options,\n widget = this.widget,\n field = options.dataValueField || options.dataTextField,\n value = this.bindings.value.get(),\n data = value,\n idx = 0, length,\n values = [],\n selectedValue;\n\n if (value === undefined) {\n value = null;\n }\n\n if (field) {\n if (value instanceof ObservableArray) {\n for (length = value.length; idx < length; idx++) {\n selectedValue = value[idx];\n values[idx] = selectedValue.get ? selectedValue.get(field) : selectedValue;\n }\n value = values;\n } else if (value instanceof ObservableObject) {\n value = value.get(field);\n }\n }\n\n if (options.autoBind === false && options.valuePrimitive !== true && !widget._isBound()) {\n widget._preselect(data, value);\n } else {\n widget.value(value);\n }\n }\n },\n\n destroy: function() {\n this.widget.unbind(CHANGE, this._change);\n }\n\n })\n },\n scheduler: {\n source: dataSourceBinding(\"source\", \"dataSource\", \"setDataSource\").extend({\n dataBound: function(e) {\n var idx;\n var length;\n var widget = this.widget;\n var elements = e.addedItems || widget.items();\n var data, parents;\n\n if (elements.length) {\n data = e.addedDataItems || widget.dataItems();\n parents = this.bindings.source._parents();\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n bindElement(elements[idx], data[idx], this._ns(e.ns), [data[idx]].concat(parents));\n }\n }\n }\n })\n },\n\n grid: {\n source: dataSourceBinding(\"source\", \"dataSource\", \"setDataSource\").extend({\n dataBound: function(e) {\n var idx,\n length,\n widget = this.widget,\n elements = e.addedItems || widget.items(),\n parents,\n data;\n\n if (elements.length) {\n data = e.addedDataItems || widget.dataItems();\n parents = this.bindings.source._parents();\n\n for (idx = 0, length = data.length; idx < length; idx++) {\n bindElement(elements[idx], data[idx], this._ns(e.ns), [data[idx]].concat(parents));\n }\n }\n }\n })\n },\n\n badge: {\n text: Binder.extend({\n init: function(widget, bindings, options) {\n Binder.fn.init.call(this, widget.element[0], bindings, options);\n\n this.widget = widget;\n },\n refresh: function() {\n var text = this.bindings.text.get();\n\n if (text == null) {\n text = \"\";\n }\n this.widget.text(text);\n }\n })\n }\n };\n\n var arraySplice = function(arr, idx, remove, add) {\n add = add || [];\n remove = remove || 0;\n\n var addLength = add.length;\n var oldLength = arr.length;\n\n var shifted = [].slice.call(arr, idx + remove);\n var shiftedLength = shifted.length;\n var index;\n\n if (addLength) {\n addLength = idx + addLength;\n index = 0;\n\n for (; idx < addLength; idx++) {\n arr[idx] = add[index];\n index++;\n }\n\n arr.length = addLength;\n } else if (remove) {\n arr.length = idx;\n\n remove += idx;\n while (idx < remove) {\n delete arr[--remove];\n }\n }\n\n if (shiftedLength) {\n shiftedLength = idx + shiftedLength;\n index = 0;\n\n for (; idx < shiftedLength; idx++) {\n arr[idx] = shifted[index];\n index++;\n }\n\n arr.length = shiftedLength;\n }\n\n idx = arr.length;\n\n while (idx < oldLength) {\n delete arr[idx];\n idx++;\n }\n };\n\n var BindingTarget = Class.extend( {\n init: function(target, options) {\n this.target = target;\n this.options = options;\n this.toDestroy = [];\n },\n\n bind: function(bindings) {\n var key,\n hasValue,\n hasSource,\n hasEvents,\n hasChecked,\n hasCss,\n widgetBinding = this instanceof WidgetBindingTarget,\n specificBinders = this.binders();\n\n for (key in bindings) {\n if (key == VALUE) {\n hasValue = true;\n } else if (key == SOURCE) {\n hasSource = true;\n } else if (key == EVENTS && !widgetBinding) {\n hasEvents = true;\n } else if (key == CHECKED) {\n hasChecked = true;\n } else if (key == CSS) {\n hasCss = true;\n } else {\n this.applyBinding(key, bindings, specificBinders);\n }\n }\n if (hasSource) {\n this.applyBinding(SOURCE, bindings, specificBinders);\n }\n\n if (hasValue) {\n this.applyBinding(VALUE, bindings, specificBinders);\n }\n\n if (hasChecked) {\n this.applyBinding(CHECKED, bindings, specificBinders);\n }\n\n if (hasEvents && !widgetBinding) {\n this.applyBinding(EVENTS, bindings, specificBinders);\n }\n\n if (hasCss && !widgetBinding) {\n this.applyBinding(CSS, bindings, specificBinders);\n }\n\n if (widgetBinding && this.target && this.target.floatingLabel) {\n this.applyBinding(\"floatingLabel\", bindings, specificBinders);\n }\n },\n\n binders: function() {\n return binders[this.target.nodeName.toLowerCase()] || {};\n },\n\n applyBinding: function(name, bindings, specificBinders) {\n var binder = specificBinders[name] || binders[name],\n toDestroy = this.toDestroy,\n attribute,\n binding = bindings[name];\n\n if (binder) {\n binder = new binder(this.target, bindings, this.options);\n\n toDestroy.push(binder);\n\n if (binding instanceof Binding) {\n binder.bind(binding);\n toDestroy.push(binding);\n } else {\n for (attribute in binding) {\n binder.bind(binding, attribute);\n toDestroy.push(binding[attribute]);\n }\n }\n } else if (name !== \"template\") {\n throw new Error(\"The \" + name + \" binding is not supported by the \" + this.target.nodeName.toLowerCase() + \" element\");\n }\n },\n\n destroy: function() {\n var idx,\n length,\n toDestroy = this.toDestroy;\n\n for (idx = 0, length = toDestroy.length; idx < length; idx++) {\n toDestroy[idx].destroy();\n }\n }\n });\n\n var WidgetBindingTarget = BindingTarget.extend( {\n binders: function() {\n return binders.widget[this.target.options.name.toLowerCase()] || {};\n },\n\n applyBinding: function(name, bindings, specificBinders) {\n var binder = specificBinders[name] || binders.widget[name],\n toDestroy = this.toDestroy,\n attribute,\n binding = bindings[name];\n\n if (binder) {\n binder = new binder(this.target, bindings, this.target.options);\n\n toDestroy.push(binder);\n\n\n if (binding instanceof Binding) {\n binder.bind(binding);\n toDestroy.push(binding);\n } else {\n for (attribute in binding) {\n binder.bind(binding, attribute);\n toDestroy.push(binding[attribute]);\n }\n }\n } else {\n throw new Error(\"The \" + name + \" binding is not supported by the \" + this.target.options.name + \" widget\");\n }\n }\n });\n\n function bindingTargetForRole(element, roles) {\n var widget = kendo.initWidget(element, {}, roles);\n\n if (widget) {\n return new WidgetBindingTarget(widget);\n }\n }\n\n var keyValueRegExp = /[A-Za-z0-9_\\-]+:(\\{([^}]*)\\}|[^,}]+)/g,\n whiteSpaceRegExp = /\\s/g;\n\n function parseBindings(bind) {\n var result = {},\n idx,\n length,\n token,\n colonIndex,\n key,\n value,\n tokens;\n\n tokens = bind.match(keyValueRegExp);\n\n for (idx = 0, length = tokens.length; idx < length; idx++) {\n token = tokens[idx];\n colonIndex = token.indexOf(\":\");\n\n key = token.substring(0, colonIndex);\n value = token.substring(colonIndex + 1);\n\n if (value.charAt(0) == \"{\") {\n value = parseBindings(value);\n }\n\n result[key] = value;\n }\n\n return result;\n }\n\n function createBindings(bindings, source, type) {\n var binding,\n result = {};\n\n for (binding in bindings) {\n result[binding] = new type(source, bindings[binding]);\n }\n\n return result;\n }\n\n function bindElement(element, source, roles, parents) {\n\n if (!element || element.getAttribute(\"data-\" + kendo.ns + \"stop\")) {\n return;\n }\n\n var role = element.getAttribute(\"data-\" + kendo.ns + \"role\"),\n idx,\n bind = element.getAttribute(\"data-\" + kendo.ns + \"bind\"),\n childrenCopy = [],\n deep = true,\n bindings,\n options = {},\n target;\n\n parents = parents || [source];\n\n if (role || bind) {\n unbindElement(element, false);\n }\n\n if (role) {\n target = bindingTargetForRole(element, roles);\n }\n\n if (bind) {\n bind = parseBindings(bind.replace(whiteSpaceRegExp, \"\"));\n\n if (!target) {\n options = kendo.parseOptions(element, { textField: \"\", valueField: \"\", template: \"\", valueUpdate: CHANGE, valuePrimitive: false, autoBind: true }, source);\n options.roles = roles;\n target = new BindingTarget(element, options);\n }\n\n target.source = source;\n\n bindings = createBindings(bind, parents, Binding);\n\n if (options.template) {\n bindings.template = new TemplateBinding(parents, \"\", options.template);\n }\n\n if (bindings.click) {\n bind.events = bind.events || {};\n bind.events.click = bind.click;\n bindings.click.destroy();\n delete bindings.click;\n }\n\n if (bindings.source) {\n deep = false;\n }\n\n if (bind.attr) {\n bindings.attr = createBindings(bind.attr, parents, Binding);\n }\n\n if (bind.style) {\n bindings.style = createBindings(bind.style, parents, Binding);\n }\n\n if (bind.events) {\n bindings.events = createBindings(bind.events, parents, EventBinding);\n }\n\n if (bind.css) {\n bindings.css = createBindings(bind.css, parents, Binding);\n }\n\n target.bind(bindings);\n }\n\n if (target) {\n element.kendoBindingTarget = target;\n }\n\n var children = element.children;\n if (deep && children && !element.getAttribute(\"data-\" + kendo.ns + \"stop\")) {\n // https://github.com/telerik/kendo/issues/1240 for the weirdness.\n for (idx = 0; idx < children.length; idx++) {\n childrenCopy[idx] = children[idx];\n }\n\n for (idx = 0; idx < childrenCopy.length; idx++) {\n bindElement(childrenCopy[idx], source, roles, parents);\n }\n }\n }\n\n function bind(dom, object) {\n var idx,\n length,\n node,\n roles = kendo.rolesFromNamespaces([].slice.call(arguments, 2));\n\n object = kendo.observable(object);\n dom = $(dom);\n\n for (idx = 0, length = dom.length; idx < length; idx++) {\n node = dom[idx];\n if (node.nodeType === 1) {\n bindElement(node, object, roles);\n }\n }\n }\n\n function unbindElement(element, destroyWidget) {\n var bindingTarget = element.kendoBindingTarget;\n\n if (bindingTarget) {\n bindingTarget.destroy();\n\n if (deleteExpando) {\n delete element.kendoBindingTarget;\n } else if (element.removeAttribute) {\n element.removeAttribute(\"kendoBindingTarget\");\n } else {\n element.kendoBindingTarget = null;\n }\n }\n\n if (destroyWidget) {\n var widget = kendo.widgetInstance($(element));\n if (widget && typeof widget.destroy === FUNCTION) {\n widget.destroy();\n }\n }\n }\n\n function unbindElementTree(element, destroyWidgets) {\n unbindElement(element, destroyWidgets);\n\n unbindElementChildren(element, destroyWidgets);\n }\n\n function unbindElementChildren(element, destroyWidgets) {\n var children = element.children;\n\n if (children) {\n for (var idx = 0, length = children.length; idx < length; idx++) {\n unbindElementTree(children[idx], destroyWidgets);\n }\n }\n }\n\n function unbind(dom) {\n var idx, length;\n\n dom = $(dom);\n\n for (idx = 0, length = dom.length; idx < length; idx++ ) {\n unbindElementTree(dom[idx], false);\n }\n }\n\n function notify(widget, namespace) {\n var element = widget.element,\n bindingTarget = element[0].kendoBindingTarget;\n\n if (bindingTarget) {\n bind(element, bindingTarget.source, namespace);\n }\n }\n\n function retrievePrimitiveValues(value, valueField) {\n var values = [];\n var idx = 0;\n var length;\n var item;\n\n if (!valueField) {\n return value;\n }\n\n if (value instanceof ObservableArray) {\n for (length = value.length; idx < length; idx++) {\n item = value[idx];\n values[idx] = item.get ? item.get(valueField) : item[valueField];\n }\n value = values;\n } else if (value instanceof ObservableObject) {\n value = value.get(valueField);\n }\n\n return value;\n }\n\n kendo.unbind = unbind;\n kendo.bind = bind;\n kendo.data.binders = binders;\n kendo.data.Binder = Binder;\n kendo.notify = notify;\n\n kendo.observable = function(object) {\n if (!(object instanceof ObservableObject)) {\n object = new ObservableObject(object);\n }\n\n return object;\n };\n\n kendo.observableHierarchy = function(array) {\n var dataSource = kendo.data.HierarchicalDataSource.create(array);\n\n function recursiveRead(data) {\n var i, children;\n\n for (i = 0; i < data.length; i++) {\n data[i]._initChildren();\n\n children = data[i].children;\n\n children.fetch();\n\n data[i].items = children.data();\n\n recursiveRead(data[i].items);\n }\n }\n\n dataSource.fetch();\n\n recursiveRead(dataSource.data());\n\n dataSource._data._dataSource = dataSource;\n\n return dataSource._data;\n };\n\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.fx',[ \"kendo.core\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"fx\",\n name: \"Effects\",\n category: \"framework\",\n description: \"Required for animation effects in all Kendo UI widgets.\",\n depends: [ \"core\" ]\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n fx = kendo.effects,\n each = $.each,\n extend = $.extend,\n support = kendo.support,\n browser = support.browser,\n transforms = support.transforms,\n transitions = support.transitions,\n scaleProperties = { scale: 0, scalex: 0, scaley: 0, scale3d: 0 },\n translateProperties = { translate: 0, translatex: 0, translatey: 0, translate3d: 0 },\n hasZoom = (typeof document.documentElement.style.zoom !== \"undefined\") && !transforms,\n matrix3dRegExp = /matrix3?d?\\s*\\(.*,\\s*([\\d\\.\\-]+)\\w*?,\\s*([\\d\\.\\-]+)\\w*?,\\s*([\\d\\.\\-]+)\\w*?,\\s*([\\d\\.\\-]+)\\w*?/i,\n cssParamsRegExp = /^(-?[\\d\\.\\-]+)?[\\w\\s]*,?\\s*(-?[\\d\\.\\-]+)?[\\w\\s]*/i,\n translateXRegExp = /translatex?$/i,\n oldEffectsRegExp = /(zoom|fade|expand)(\\w+)/,\n singleEffectRegExp = /(zoom|fade|expand)/,\n unitRegExp = /[xy]$/i,\n transformProps = [\"perspective\", \"rotate\", \"rotatex\", \"rotatey\", \"rotatez\", \"rotate3d\", \"scale\", \"scalex\", \"scaley\", \"scalez\", \"scale3d\", \"skew\", \"skewx\", \"skewy\", \"translate\", \"translatex\", \"translatey\", \"translatez\", \"translate3d\", \"matrix\", \"matrix3d\"],\n transform2d = [\"rotate\", \"scale\", \"scalex\", \"scaley\", \"skew\", \"skewx\", \"skewy\", \"translate\", \"translatex\", \"translatey\", \"matrix\"],\n transform2units = { \"rotate\": \"deg\", scale: \"\", skew: \"px\", translate: \"px\" },\n cssPrefix = transforms.css,\n round = Math.round,\n BLANK = \"\",\n PX = \"px\",\n NONE = \"none\",\n AUTO = \"auto\",\n WIDTH = \"width\",\n HEIGHT = \"height\",\n HIDDEN = \"hidden\",\n ORIGIN = \"origin\",\n ABORT_ID = \"abortId\",\n OVERFLOW = \"overflow\",\n TRANSLATE = \"translate\",\n POSITION = \"position\",\n COMPLETE_CALLBACK = \"completeCallback\",\n TRANSITION = cssPrefix + \"transition\",\n TRANSFORM = cssPrefix + \"transform\",\n BACKFACE = cssPrefix + \"backface-visibility\",\n PERSPECTIVE = cssPrefix + \"perspective\",\n DEFAULT_PERSPECTIVE = \"1500px\",\n TRANSFORM_PERSPECTIVE = \"perspective(\" + DEFAULT_PERSPECTIVE + \")\",\n directions = {\n left: {\n reverse: \"right\",\n property: \"left\",\n transition: \"translatex\",\n vertical: false,\n modifier: -1\n },\n right: {\n reverse: \"left\",\n property: \"left\",\n transition: \"translatex\",\n vertical: false,\n modifier: 1\n },\n down: {\n reverse: \"up\",\n property: \"top\",\n transition: \"translatey\",\n vertical: true,\n modifier: 1\n },\n up: {\n reverse: \"down\",\n property: \"top\",\n transition: \"translatey\",\n vertical: true,\n modifier: -1\n },\n top: {\n reverse: \"bottom\"\n },\n bottom: {\n reverse: \"top\"\n },\n \"in\": {\n reverse: \"out\",\n modifier: -1\n },\n out: {\n reverse: \"in\",\n modifier: 1\n },\n\n vertical: {\n reverse: \"vertical\"\n },\n\n horizontal: {\n reverse: \"horizontal\"\n }\n };\n\n kendo.directions = directions;\n\n extend($.fn, {\n kendoStop: function(clearQueue, gotoEnd) {\n if (transitions) {\n return fx.stopQueue(this, clearQueue || false, gotoEnd || false);\n } else {\n return this.stop(clearQueue, gotoEnd);\n }\n }\n });\n\n /* jQuery support for all transform animations (FF 3.5/3.6, Opera 10.x, IE9 */\n\n if (transforms && !transitions) {\n each(transform2d, function(idx, value) {\n $.fn[value] = function(val) {\n if (typeof val == \"undefined\") {\n return animationProperty(this, value);\n } else {\n var that = $(this)[0],\n transformValue = value + \"(\" + val + transform2units[value.replace(unitRegExp, \"\")] + \")\";\n\n if (that.style.cssText.indexOf(TRANSFORM) == -1) {\n $(this).css(TRANSFORM, transformValue);\n } else {\n that.style.cssText = that.style.cssText.replace(new RegExp(value + \"\\\\(.*?\\\\)\", \"i\"), transformValue);\n }\n }\n return this;\n };\n\n $.fx.step[value] = function(fx) {\n $(fx.elem)[value](fx.now);\n };\n });\n\n var curProxy = $.fx.prototype.cur;\n $.fx.prototype.cur = function() {\n if (transform2d.indexOf(this.prop) != -1) {\n return parseFloat($(this.elem)[this.prop]());\n }\n\n return curProxy.apply(this, arguments);\n };\n }\n\n kendo.toggleClass = function(element, classes, options, add) {\n if (classes) {\n classes = classes.split(\" \");\n\n if (transitions) {\n options = extend({\n exclusive: \"all\",\n duration: 400,\n ease: \"ease-out\"\n }, options);\n\n element.css(TRANSITION, options.exclusive + \" \" + options.duration + \"ms \" + options.ease);\n setTimeout(function() {\n element.css(TRANSITION, \"\").css(HEIGHT);\n }, options.duration); // TODO: this should fire a kendoAnimate session instead.\n }\n\n each(classes, function(idx, value) {\n element.toggleClass(value, add);\n });\n }\n\n return element;\n };\n\n kendo.parseEffects = function(input, mirror) {\n var effects = {};\n\n if (typeof input === \"string\") {\n each(input.split(\" \"), function(idx, value) {\n var redirectedEffect = !singleEffectRegExp.test(value),\n resolved = value.replace(oldEffectsRegExp, function(match, $1, $2) {\n return $1 + \":\" + $2.toLowerCase();\n }), // Support for old zoomIn/fadeOut style, now deprecated.\n effect = resolved.split(\":\"),\n direction = effect[1],\n effectBody = {};\n\n if (effect.length > 1) {\n effectBody.direction = (mirror && redirectedEffect ? directions[direction].reverse : direction);\n }\n\n effects[effect[0]] = effectBody;\n });\n } else {\n each(input, function(idx) {\n var direction = this.direction;\n\n if (direction && mirror && !singleEffectRegExp.test(idx)) {\n this.direction = directions[direction].reverse;\n }\n\n effects[idx] = this;\n });\n }\n\n return effects;\n };\n\n function parseInteger(value) {\n return parseInt(value, 10);\n }\n\n function parseCSS(element, property) {\n return parseInteger(element.css(property));\n }\n\n function keys(obj) {\n var acc = [];\n for (var propertyName in obj) {\n acc.push(propertyName);\n }\n return acc;\n }\n\n function strip3DTransforms(properties) {\n for (var key in properties) {\n if (transformProps.indexOf(key) != -1 && transform2d.indexOf(key) == -1) {\n delete properties[key];\n }\n }\n\n return properties;\n }\n\n function normalizeCSS(element, properties) {\n var transformation = [], cssValues = {}, lowerKey, key, value, isTransformed;\n\n for (key in properties) {\n lowerKey = key.toLowerCase();\n isTransformed = transforms && transformProps.indexOf(lowerKey) != -1;\n\n if (!support.hasHW3D && isTransformed && transform2d.indexOf(lowerKey) == -1) {\n delete properties[key];\n } else {\n value = properties[key];\n\n if (isTransformed) {\n transformation.push(key + \"(\" + value + \")\");\n } else {\n cssValues[key] = value;\n }\n }\n }\n\n if (transformation.length) {\n cssValues[TRANSFORM] = transformation.join(\" \");\n }\n\n return cssValues;\n }\n\n if (transitions) {\n extend(fx, {\n transition: function(element, properties, options) {\n var css,\n delay = 0,\n oldKeys = element.data(\"keys\") || [],\n timeoutID;\n\n options = extend({\n duration: 200,\n ease: \"ease-out\",\n complete: null,\n exclusive: \"all\"\n },\n options\n );\n\n var stopTransitionCalled = false;\n\n var stopTransition = function() {\n if (!stopTransitionCalled) {\n stopTransitionCalled = true;\n\n if (timeoutID) {\n clearTimeout(timeoutID);\n timeoutID = null;\n }\n\n element\n .removeData(ABORT_ID)\n .dequeue()\n .css(TRANSITION, \"\")\n .css(TRANSITION);\n\n options.complete.call(element);\n }\n };\n\n options.duration = $.fx ? $.fx.speeds[options.duration] || options.duration : options.duration;\n\n css = normalizeCSS(element, properties);\n\n $.merge(oldKeys, keys(css));\n\n if ($.hasOwnProperty(\"uniqueSort\")) {\n element\n .data(\"keys\", $.uniqueSort(oldKeys))\n .height();\n } else {\n element\n .data(\"keys\", $.unique(oldKeys))\n .height();\n }\n\n element.css(TRANSITION, options.exclusive + \" \" + options.duration + \"ms \" + options.ease).css(TRANSITION);\n element.css(css).css(TRANSFORM);\n\n /**\n * Use transitionEnd event for browsers who support it - but duplicate it with setTimeout, as the transitionEnd event will not be triggered if no CSS properties change.\n * This should be cleaned up at some point (widget by widget), and refactored to widgets not relying on the complete callback if no transition occurs.\n *\n * For IE9 and below, resort to setTimeout.\n */\n if (transitions.event) {\n element.one(transitions.event, stopTransition);\n if (options.duration !== 0) {\n delay = 500;\n }\n }\n\n timeoutID = setTimeout(stopTransition, options.duration + delay);\n element.data(ABORT_ID, timeoutID);\n element.data(COMPLETE_CALLBACK, stopTransition);\n },\n\n stopQueue: function(element, clearQueue, gotoEnd) {\n var cssValues,\n taskKeys = element.data(\"keys\"),\n retainPosition = (!gotoEnd && taskKeys),\n completeCallback = element.data(COMPLETE_CALLBACK);\n\n if (retainPosition) {\n cssValues = kendo.getComputedStyles(element[0], taskKeys);\n }\n\n if (completeCallback) {\n completeCallback();\n }\n\n if (retainPosition) {\n element.css(cssValues);\n }\n\n return element\n .removeData(\"keys\")\n .stop(clearQueue);\n }\n });\n }\n\n function animationProperty(element, property) {\n if (transforms) {\n var transform = element.css(TRANSFORM);\n if (transform == NONE) {\n return property == \"scale\" ? 1 : 0;\n }\n\n var match = transform.match(new RegExp(property + \"\\\\s*\\\\(([\\\\d\\\\w\\\\.]+)\")),\n computed = 0;\n\n if (match) {\n computed = parseInteger(match[1]);\n } else {\n match = transform.match(matrix3dRegExp) || [0, 0, 0, 0, 0];\n property = property.toLowerCase();\n\n if (translateXRegExp.test(property)) {\n computed = parseFloat(match[3] / match[2]);\n } else if (property == \"translatey\") {\n computed = parseFloat(match[4] / match[2]);\n } else if (property == \"scale\") {\n computed = parseFloat(match[2]);\n } else if (property == \"rotate\") {\n computed = parseFloat(Math.atan2(match[2], match[1]));\n }\n }\n\n return computed;\n } else {\n return parseFloat(element.css(property));\n }\n }\n\n var EffectSet = kendo.Class.extend({\n init: function(element, options) {\n var that = this;\n\n that.element = element;\n that.effects = [];\n that.options = options;\n that.restore = [];\n },\n\n run: function(effects) {\n var that = this,\n effect,\n idx, jdx,\n length = effects.length,\n element = that.element,\n options = that.options,\n deferred = $.Deferred(),\n start = {},\n end = {},\n target,\n children,\n childrenLength;\n\n that.effects = effects;\n\n deferred.done(that.complete.bind(that));\n\n element.data(\"animating\", true);\n\n for (idx = 0; idx < length; idx ++) {\n effect = effects[idx];\n\n effect.setReverse(options.reverse);\n effect.setOptions(options);\n\n that.addRestoreProperties(effect.restore);\n\n effect.prepare(start, end);\n\n children = effect.children();\n\n for (jdx = 0, childrenLength = children.length; jdx < childrenLength; jdx ++) {\n children[jdx].duration(options.duration).run();\n }\n }\n\n // legacy support for options.properties\n for (var effectName in options.effects) {\n extend(end, options.effects[effectName].properties);\n }\n\n // Show the element initially\n if (!element.is(\":visible\")) {\n extend(start, { display: element.data(\"olddisplay\") || \"block\" });\n }\n\n if (transforms && !options.reset) {\n target = element.data(\"targetTransform\");\n\n if (target) {\n start = extend(target, start);\n }\n }\n\n start = normalizeCSS(element, start);\n\n if (transforms && !transitions) {\n start = strip3DTransforms(start);\n }\n\n element.css(start)\n .css(TRANSFORM); // Nudge\n\n for (idx = 0; idx < length; idx ++) {\n effects[idx].setup();\n }\n\n if (options.init) {\n options.init();\n }\n\n element.data(\"targetTransform\", end);\n fx.animate(element, end, extend({}, options, { complete: deferred.resolve }));\n\n return deferred.promise();\n },\n\n stop: function() {\n $(this.element).kendoStop(true, true);\n },\n\n addRestoreProperties: function(restore) {\n var element = this.element,\n value,\n i = 0,\n length = restore.length;\n\n for (; i < length; i ++) {\n value = restore[i];\n\n this.restore.push(value);\n\n if (!element.data(value)) {\n element.data(value, element.css(value));\n }\n }\n },\n\n restoreCallback: function() {\n var element = this.element;\n\n for (var i = 0, length = this.restore.length; i < length; i ++) {\n var value = this.restore[i];\n element.css(value, element.data(value));\n }\n },\n\n complete: function() {\n var that = this,\n idx = 0,\n element = that.element,\n options = that.options,\n effects = that.effects,\n length = effects.length;\n\n element\n .removeData(\"animating\")\n .dequeue(); // call next animation from the queue\n\n if (options.hide) {\n element.data(\"olddisplay\", element.css(\"display\")).hide();\n }\n\n this.restoreCallback();\n\n if (hasZoom && !transforms) {\n setTimeout(this.restoreCallback.bind(this), 0); // Again jQuery callback in IE8-\n }\n\n for (; idx < length; idx ++) {\n effects[idx].teardown();\n }\n\n if (options.completeCallback) {\n options.completeCallback(element);\n }\n }\n });\n\n fx.promise = function(element, options) {\n var effects = [],\n effectClass,\n effectSet = new EffectSet(element, options),\n parsedEffects = kendo.parseEffects(options.effects),\n effect;\n\n options.effects = parsedEffects;\n\n for (var effectName in parsedEffects) {\n effectClass = fx[capitalize(effectName)];\n\n if (effectClass) {\n effect = new effectClass(element, parsedEffects[effectName].direction);\n effects.push(effect);\n }\n }\n\n if (effects[0]) {\n effectSet.run(effects);\n } else { // Not sure how would an fx promise reach this state - means that you call kendoAnimate with no valid effects? Why?\n if (!element.is(\":visible\")) {\n element.css({ display: element.data(\"olddisplay\") || \"block\" }).css(\"display\");\n }\n\n if (options.init) {\n options.init();\n }\n\n element.dequeue();\n effectSet.complete();\n }\n };\n\n extend(fx, {\n animate: function(elements, properties, options) {\n var useTransition = options.transition !== false;\n delete options.transition;\n\n if (transitions && \"transition\" in fx && useTransition) {\n fx.transition(elements, properties, options);\n } else {\n if (transforms) {\n elements.animate(strip3DTransforms(properties), { queue: false, show: false, hide: false, duration: options.duration, complete: options.complete }); // Stop animate from showing/hiding the element to be able to hide it later on.\n } else {\n elements.each(function() {\n var element = $(this),\n multiple = {};\n\n each(transformProps, function(idx, value) { // remove transforms to avoid IE and older browsers confusion\n var params,\n currentValue = properties ? properties[value] + \" \" : null; // We need to match\n\n if (currentValue) {\n var single = properties;\n\n if (value in scaleProperties && properties[value] !== undefined) {\n params = currentValue.match(cssParamsRegExp);\n if (transforms) {\n extend(single, { scale: +params[0] });\n }\n } else {\n if (value in translateProperties && properties[value] !== undefined) {\n var position = element.css(POSITION),\n isFixed = (position == \"absolute\" || position == \"fixed\");\n\n if (!element.data(TRANSLATE)) {\n if (isFixed) {\n element.data(TRANSLATE, {\n top: parseCSS(element, \"top\") || 0,\n left: parseCSS(element, \"left\") || 0,\n bottom: parseCSS(element, \"bottom\"),\n right: parseCSS(element, \"right\")\n });\n } else {\n element.data(TRANSLATE, {\n top: parseCSS(element, \"marginTop\") || 0,\n left: parseCSS(element, \"marginLeft\") || 0\n });\n }\n }\n\n var originalPosition = element.data(TRANSLATE);\n\n params = currentValue.match(cssParamsRegExp);\n if (params) {\n\n var dX = value == TRANSLATE + \"y\" ? +null : +params[1],\n dY = value == TRANSLATE + \"y\" ? +params[1] : +params[2];\n\n if (isFixed) {\n if (!isNaN(originalPosition.right)) {\n if (!isNaN(dX)) { extend(single, { right: originalPosition.right - dX }); }\n } else {\n if (!isNaN(dX)) { extend(single, { left: originalPosition.left + dX }); }\n }\n\n if (!isNaN(originalPosition.bottom)) {\n if (!isNaN(dY)) { extend(single, { bottom: originalPosition.bottom - dY }); }\n } else {\n if (!isNaN(dY)) { extend(single, { top: originalPosition.top + dY }); }\n }\n } else {\n if (!isNaN(dX)) { extend(single, { marginLeft: originalPosition.left + dX }); }\n if (!isNaN(dY)) { extend(single, { marginTop: originalPosition.top + dY }); }\n }\n }\n }\n }\n\n if (!transforms && value != \"scale\" && value in single) {\n delete single[value];\n }\n\n if (single) {\n extend(multiple, single);\n }\n }\n });\n\n if (browser.msie) {\n delete multiple.scale;\n }\n\n element.animate(multiple, { queue: false, show: false, hide: false, duration: options.duration, complete: options.complete }); // Stop animate from showing/hiding the element to be able to hide it later on.\n });\n }\n }\n }\n });\n\n fx.animatedPromise = fx.promise;\n\n var Effect = kendo.Class.extend({\n init: function(element, direction) {\n var that = this;\n that.element = element;\n that._direction = direction;\n that.options = {};\n that._additionalEffects = [];\n\n if (!that.restore) {\n that.restore = [];\n }\n },\n\n// Public API\n reverse: function() {\n this._reverse = true;\n return this.run();\n },\n\n play: function() {\n this._reverse = false;\n return this.run();\n },\n\n add: function(additional) {\n this._additionalEffects.push(additional);\n return this;\n },\n\n direction: function(value) {\n this._direction = value;\n return this;\n },\n\n duration: function(duration) {\n this._duration = duration;\n return this;\n },\n\n compositeRun: function() {\n var that = this,\n effectSet = new EffectSet(that.element, { reverse: that._reverse, duration: that._duration }),\n effects = that._additionalEffects.concat([ that ]);\n\n return effectSet.run(effects);\n },\n\n run: function() {\n if (this._additionalEffects && this._additionalEffects[0]) {\n return this.compositeRun();\n }\n\n var that = this,\n element = that.element,\n idx = 0,\n restore = that.restore,\n length = restore.length,\n value,\n deferred = $.Deferred(),\n start = {},\n end = {},\n target,\n children = that.children(),\n childrenLength = children.length;\n\n deferred.done(that._complete.bind(that));\n\n element.data(\"animating\", true);\n\n for (idx = 0; idx < length; idx ++) {\n value = restore[idx];\n\n if (!element.data(value)) {\n element.data(value, element.css(value));\n }\n }\n\n for (idx = 0; idx < childrenLength; idx ++) {\n children[idx].duration(that._duration).run();\n }\n\n that.prepare(start, end);\n\n if (!element.is(\":visible\")) {\n extend(start, { display: element.data(\"olddisplay\") || \"block\" });\n }\n\n if (transforms) {\n target = element.data(\"targetTransform\");\n\n if (target) {\n start = extend(target, start);\n }\n }\n\n start = normalizeCSS(element, start);\n\n if (transforms && !transitions) {\n start = strip3DTransforms(start);\n }\n\n element.css(start).css(TRANSFORM); // Trick webkit into re-rendering\n\n that.setup();\n\n element.data(\"targetTransform\", end);\n fx.animate(element, end, { duration: that._duration, complete: deferred.resolve });\n\n return deferred.promise();\n },\n\n stop: function() {\n var idx = 0,\n children = this.children(),\n childrenLength = children.length;\n\n for (idx = 0; idx < childrenLength; idx ++) {\n children[idx].stop();\n }\n\n $(this.element).kendoStop(true, true);\n return this;\n },\n\n restoreCallback: function() {\n var element = this.element;\n\n for (var i = 0, length = this.restore.length; i < length; i ++) {\n var value = this.restore[i];\n element.css(value, element.data(value));\n }\n },\n\n _complete: function() {\n var that = this,\n element = that.element;\n\n element\n .removeData(\"animating\")\n .dequeue(); // call next animation from the queue\n\n that.restoreCallback();\n\n if (that.shouldHide()) {\n element.data(\"olddisplay\", element.css(\"display\")).hide();\n }\n\n if (hasZoom && !transforms) {\n setTimeout(that.restoreCallback.bind(that), 0); // Again jQuery callback in IE8-\n }\n\n that.teardown();\n },\n\n /////////////////////////// Support for kendo.animate;\n setOptions: function(options) {\n extend(true, this.options, options);\n },\n\n children: function() {\n return [];\n },\n\n shouldHide: $.noop,\n\n setup: $.noop,\n prepare: $.noop,\n teardown: $.noop,\n directions: [],\n\n setReverse: function(reverse) {\n this._reverse = reverse;\n return this;\n }\n });\n\n function capitalize(word) {\n return word.charAt(0).toUpperCase() + word.substring(1);\n }\n\n function createEffect(name, definition) {\n var effectClass = Effect.extend(definition),\n directions = effectClass.prototype.directions;\n\n fx[capitalize(name)] = effectClass;\n\n fx.Element.prototype[name] = function(direction, opt1, opt2, opt3) {\n return new effectClass(this.element, direction, opt1, opt2, opt3);\n };\n\n each(directions, function(idx, theDirection) {\n fx.Element.prototype[name + capitalize(theDirection)] = function(opt1, opt2, opt3) {\n return new effectClass(this.element, theDirection, opt1, opt2, opt3);\n };\n });\n }\n\n var FOUR_DIRECTIONS = [\"left\", \"right\", \"up\", \"down\"],\n IN_OUT = [\"in\", \"out\"];\n\n createEffect(\"slideIn\", {\n directions: FOUR_DIRECTIONS,\n\n divisor: function(value) {\n this.options.divisor = value;\n return this;\n },\n\n prepare: function(start, end) {\n var that = this,\n tmp,\n element = that.element,\n outerWidth = kendo._outerWidth,\n outerHeight = kendo._outerHeight,\n direction = directions[that._direction],\n offset = -direction.modifier * (direction.vertical ? outerHeight(element) : outerWidth(element)),\n startValue = offset / (that.options && that.options.divisor || 1) + PX,\n endValue = \"0px\";\n\n if (that._reverse) {\n tmp = start;\n start = end;\n end = tmp;\n }\n\n if (transforms) {\n start[direction.transition] = startValue;\n end[direction.transition] = endValue;\n } else {\n start[direction.property] = startValue;\n end[direction.property] = endValue;\n }\n }\n });\n\n createEffect(\"tile\", {\n directions: FOUR_DIRECTIONS,\n\n init: function(element, direction, previous) {\n Effect.prototype.init.call(this, element, direction);\n this.options = { previous: previous };\n },\n\n previousDivisor: function(value) {\n this.options.previousDivisor = value;\n return this;\n },\n\n children: function() {\n var that = this,\n reverse = that._reverse,\n previous = that.options.previous,\n divisor = that.options.previousDivisor || 1,\n dir = that._direction;\n\n var children = [ kendo.fx(that.element).slideIn(dir).setReverse(reverse) ];\n\n if (previous) {\n children.push( kendo.fx(previous).slideIn(directions[dir].reverse).divisor(divisor).setReverse(!reverse) );\n }\n\n return children;\n }\n });\n\n function createToggleEffect(name, property, defaultStart, defaultEnd) {\n createEffect(name, {\n directions: IN_OUT,\n\n startValue: function(value) {\n this._startValue = value;\n return this;\n },\n\n endValue: function(value) {\n this._endValue = value;\n return this;\n },\n\n shouldHide: function() {\n return this._shouldHide;\n },\n\n prepare: function(start, end) {\n var that = this,\n startValue,\n endValue,\n out = this._direction === \"out\",\n startDataValue = that.element.data(property),\n startDataValueIsSet = !(isNaN(startDataValue) || startDataValue == defaultStart);\n\n if (startDataValueIsSet) {\n startValue = startDataValue;\n } else if (typeof this._startValue !== \"undefined\") {\n startValue = this._startValue;\n } else {\n startValue = out ? defaultStart : defaultEnd;\n }\n\n if (typeof this._endValue !== \"undefined\") {\n endValue = this._endValue;\n } else {\n endValue = out ? defaultEnd : defaultStart;\n }\n\n if (this._reverse) {\n start[property] = endValue;\n end[property] = startValue;\n } else {\n start[property] = startValue;\n end[property] = endValue;\n }\n\n that._shouldHide = end[property] === defaultEnd;\n }\n });\n }\n\n createToggleEffect(\"fade\", \"opacity\", 1, 0);\n createToggleEffect(\"zoom\", \"scale\", 1, 0.01);\n\n createEffect(\"slideMargin\", {\n prepare: function(start, end) {\n var that = this,\n element = that.element,\n options = that.options,\n origin = element.data(ORIGIN),\n offset = options.offset,\n margin,\n reverse = that._reverse;\n\n if (!reverse && origin === null) {\n element.data(ORIGIN, parseFloat(element.css(\"margin-\" + options.axis)));\n }\n\n margin = (element.data(ORIGIN) || 0);\n end[\"margin-\" + options.axis] = !reverse ? margin + offset : margin;\n }\n });\n\n createEffect(\"slideTo\", {\n prepare: function(start, end) {\n var that = this,\n element = that.element,\n options = that.options,\n offset = options.offset.split(\",\"),\n reverse = that._reverse;\n\n if (transforms) {\n end.translatex = !reverse ? offset[0] : 0;\n end.translatey = !reverse ? offset[1] : 0;\n } else {\n end.left = !reverse ? offset[0] : 0;\n end.top = !reverse ? offset[1] : 0;\n }\n element.css(\"left\");\n }\n });\n\n createEffect(\"expand\", {\n directions: [\"horizontal\", \"vertical\"],\n\n restore: [ OVERFLOW ],\n\n prepare: function(start, end) {\n var that = this,\n element = that.element,\n options = that.options,\n reverse = that._reverse,\n property = that._direction === \"vertical\" ? HEIGHT : WIDTH,\n setLength = element[0].style[property],\n oldLength = element.data(property),\n length = parseFloat(oldLength || setLength),\n realLength = round(element.css(property, AUTO)[property]());\n\n start.overflow = HIDDEN;\n\n length = (options && options.reset) ? realLength || length : length || realLength;\n\n end[property] = (reverse ? 0 : length) + PX;\n start[property] = (reverse ? length : 0) + PX;\n\n if (oldLength === undefined) {\n element.data(property, setLength);\n }\n },\n\n shouldHide: function() {\n return this._reverse;\n },\n\n teardown: function() {\n var that = this,\n element = that.element,\n property = that._direction === \"vertical\" ? HEIGHT : WIDTH,\n length = element.data(property);\n\n if (length == AUTO || length === BLANK) {\n setTimeout(function() { element.css(property, AUTO).css(property); }, 0); // jQuery animate complete callback in IE is called before the last animation step!\n }\n }\n });\n\n var TRANSFER_START_STATE = { position: \"absolute\", marginLeft: 0, marginTop: 0, scale: 1 };\n /**\n * Intersection point formulas are taken from here - http://zonalandeducation.com/mmts/intersections/intersectionOfTwoLines1/intersectionOfTwoLines1.html\n * Formula for a linear function from two points from here - http://demo.activemath.org/ActiveMath2/search/show.cmd?id=mbase://AC_UK_calculus/functions/ex_linear_equation_two_points\n * The transform origin point is the intersection point of the two lines from the top left corners/top right corners of the element and target.\n * The math and variables below MAY BE SIMPLIFIED (zeroes removed), but this would make the formula too cryptic.\n */\n createEffect(\"transfer\", {\n init: function(element, target) {\n this.element = element;\n this.options = { target: target };\n this.restore = [];\n },\n\n setup: function() {\n this.element.appendTo(document.body);\n },\n\n prepare: function(start, end) {\n var that = this,\n element = that.element,\n outerBox = fx.box(element),\n innerBox = fx.box(that.options.target),\n currentScale = animationProperty(element, \"scale\"),\n scale = fx.fillScale(innerBox, outerBox),\n transformOrigin = fx.transformOrigin(innerBox, outerBox);\n\n extend(start, TRANSFER_START_STATE);\n end.scale = 1;\n\n element.css(TRANSFORM, \"scale(1)\").css(TRANSFORM);\n element.css(TRANSFORM, \"scale(\" + currentScale + \")\");\n\n start.top = outerBox.top;\n start.left = outerBox.left;\n start.transformOrigin = transformOrigin.x + PX + \" \" + transformOrigin.y + PX;\n\n if (that._reverse) {\n start.scale = scale;\n } else {\n end.scale = scale;\n }\n }\n });\n\n\n var CLIPS = {\n top: \"rect(auto auto $size auto)\",\n bottom: \"rect($size auto auto auto)\",\n left: \"rect(auto $size auto auto)\",\n right: \"rect(auto auto auto $size)\"\n };\n\n var ROTATIONS = {\n top: { start: \"rotatex(0deg)\", end: \"rotatex(180deg)\" },\n bottom: { start: \"rotatex(-180deg)\", end: \"rotatex(0deg)\" },\n left: { start: \"rotatey(0deg)\", end: \"rotatey(-180deg)\" },\n right: { start: \"rotatey(180deg)\", end: \"rotatey(0deg)\" }\n };\n\n function clipInHalf(container, direction) {\n var vertical = kendo.directions[direction].vertical,\n size = (container[vertical ? HEIGHT : WIDTH]() / 2) + \"px\";\n\n return CLIPS[direction].replace(\"$size\", size);\n }\n\n createEffect(\"turningPage\", {\n directions: FOUR_DIRECTIONS,\n\n init: function(element, direction, container) {\n Effect.prototype.init.call(this, element, direction);\n this._container = container;\n },\n\n prepare: function(start, end) {\n var that = this,\n reverse = that._reverse,\n direction = reverse ? directions[that._direction].reverse : that._direction,\n rotation = ROTATIONS[direction];\n\n start.zIndex = 1;\n\n if (that._clipInHalf) {\n start.clip = clipInHalf(that._container, kendo.directions[direction].reverse);\n }\n\n start[BACKFACE] = HIDDEN;\n\n end[TRANSFORM] = TRANSFORM_PERSPECTIVE + (reverse ? rotation.start : rotation.end);\n start[TRANSFORM] = TRANSFORM_PERSPECTIVE + (reverse ? rotation.end : rotation.start);\n },\n\n setup: function() {\n this._container.append(this.element);\n },\n\n face: function(value) {\n this._face = value;\n return this;\n },\n\n shouldHide: function() {\n var that = this,\n reverse = that._reverse,\n face = that._face;\n\n return (reverse && !face) || (!reverse && face);\n },\n\n clipInHalf: function(value) {\n this._clipInHalf = value;\n return this;\n },\n\n temporary: function() {\n this.element.addClass('temp-page');\n return this;\n }\n });\n\n createEffect(\"staticPage\", {\n directions: FOUR_DIRECTIONS,\n\n init: function(element, direction, container) {\n Effect.prototype.init.call(this, element, direction);\n this._container = container;\n },\n\n restore: [\"clip\"],\n\n prepare: function(start, end) {\n var that = this,\n direction = that._reverse ? directions[that._direction].reverse : that._direction;\n\n start.clip = clipInHalf(that._container, direction);\n start.opacity = 0.999;\n end.opacity = 1;\n },\n\n shouldHide: function() {\n var that = this,\n reverse = that._reverse,\n face = that._face;\n\n return (reverse && !face) || (!reverse && face);\n },\n\n face: function(value) {\n this._face = value;\n return this;\n }\n });\n\n createEffect(\"pageturn\", {\n directions: [\"horizontal\", \"vertical\"],\n\n init: function(element, direction, face, back) {\n Effect.prototype.init.call(this, element, direction);\n this.options = {};\n this.options.face = face;\n this.options.back = back;\n },\n\n children: function() {\n var that = this,\n options = that.options,\n direction = that._direction === \"horizontal\" ? \"left\" : \"top\",\n reverseDirection = kendo.directions[direction].reverse,\n reverse = that._reverse,\n temp,\n faceClone = options.face.clone(true).removeAttr(\"id\"),\n backClone = options.back.clone(true).removeAttr(\"id\"),\n element = that.element;\n\n if (reverse) {\n temp = direction;\n direction = reverseDirection;\n reverseDirection = temp;\n }\n\n return [\n kendo.fx(options.face).staticPage(direction, element).face(true).setReverse(reverse),\n kendo.fx(options.back).staticPage(reverseDirection, element).setReverse(reverse),\n kendo.fx(faceClone).turningPage(direction, element).face(true).clipInHalf(true).temporary().setReverse(reverse),\n kendo.fx(backClone).turningPage(reverseDirection, element).clipInHalf(true).temporary().setReverse(reverse)\n ];\n },\n\n prepare: function(start, end) {\n start[PERSPECTIVE] = DEFAULT_PERSPECTIVE;\n start.transformStyle = \"preserve-3d\";\n // hack to trigger transition end.\n start.opacity = 0.999;\n end.opacity = 1;\n },\n\n teardown: function() {\n this.element.find(\".temp-page\").remove();\n }\n });\n\n createEffect(\"flip\", {\n directions: [\"horizontal\", \"vertical\"],\n\n init: function(element, direction, face, back) {\n Effect.prototype.init.call(this, element, direction);\n this.options = {};\n this.options.face = face;\n this.options.back = back;\n },\n\n children: function() {\n var that = this,\n options = that.options,\n direction = that._direction === \"horizontal\" ? \"left\" : \"top\",\n reverseDirection = kendo.directions[direction].reverse,\n reverse = that._reverse,\n temp,\n element = that.element;\n\n if (reverse) {\n temp = direction;\n direction = reverseDirection;\n reverseDirection = temp;\n }\n\n return [\n kendo.fx(options.face).turningPage(direction, element).face(true).setReverse(reverse),\n kendo.fx(options.back).turningPage(reverseDirection, element).setReverse(reverse)\n ];\n },\n\n prepare: function(start) {\n start[PERSPECTIVE] = DEFAULT_PERSPECTIVE;\n start.transformStyle = \"preserve-3d\";\n }\n });\n\n var RESTORE_OVERFLOW = !support.mobileOS.android;\n var IGNORE_TRANSITION_EVENT_SELECTOR = \".km-touch-scrollbar, .km-actionsheet-wrapper\";\n\n createEffect(\"replace\", {\n _before: $.noop,\n _after: $.noop,\n init: function(element, previous, transitionClass) {\n Effect.prototype.init.call(this, element);\n this._previous = $(previous);\n this._transitionClass = transitionClass;\n },\n\n duration: function() {\n throw new Error(\"The replace effect does not support duration setting; the effect duration may be customized through the transition class rule\");\n },\n\n beforeTransition: function(callback) {\n this._before = callback;\n return this;\n },\n\n afterTransition: function(callback) {\n this._after = callback;\n return this;\n },\n\n _both: function() {\n return $().add(this._element).add(this._previous);\n },\n\n _containerClass: function() {\n var direction = this._direction,\n containerClass = \"k-fx k-fx-start k-fx-\" + this._transitionClass;\n\n if (direction) {\n containerClass += \" k-fx-\" + direction;\n }\n\n if (this._reverse) {\n containerClass += \" k-fx-reverse\";\n }\n\n return containerClass;\n },\n\n complete: function(e) {\n if (!this.deferred || (e && $(e.target).is(IGNORE_TRANSITION_EVENT_SELECTOR))) {\n return;\n }\n\n var container = this.container;\n\n container\n .removeClass(\"k-fx-end\")\n .removeClass(this._containerClass())\n .off(transitions.event, this.completeProxy);\n\n this._previous.hide().removeClass(\"k-fx-current\");\n this.element.removeClass(\"k-fx-next\");\n\n if (RESTORE_OVERFLOW) {\n container.css(OVERFLOW, \"\");\n }\n\n if (!this.isAbsolute) {\n this._both().css(POSITION, \"\");\n }\n\n this.deferred.resolve();\n delete this.deferred;\n },\n\n run: function() {\n if (this._additionalEffects && this._additionalEffects[0]) {\n return this.compositeRun();\n }\n\n var that = this,\n element = that.element,\n previous = that._previous,\n container = element.parents().filter(previous.parents()).first(),\n both = that._both(),\n deferred = $.Deferred(),\n originalPosition = element.css(POSITION),\n originalOverflow;\n\n // edge case for grid/scheduler, where the previous is already destroyed.\n if (!container.length) {\n container = element.parent();\n }\n\n this.container = container;\n this.deferred = deferred;\n this.isAbsolute = originalPosition == \"absolute\";\n\n if (!this.isAbsolute) {\n both.css(POSITION, \"absolute\");\n }\n\n if (RESTORE_OVERFLOW) {\n originalOverflow = container.css(OVERFLOW);\n container.css(OVERFLOW, \"hidden\");\n }\n\n if (!transitions) {\n this.complete();\n } else {\n element.addClass(\"k-fx-hidden\");\n\n container.addClass(this._containerClass());\n\n this.completeProxy = this.complete.bind(this);\n container.on(transitions.event, this.completeProxy);\n\n kendo.animationFrame(function() {\n element.removeClass(\"k-fx-hidden\").addClass(\"k-fx-next\");\n previous.css(\"display\", \"\").addClass(\"k-fx-current\");\n that._before(previous, element);\n kendo.animationFrame(function() {\n container.removeClass(\"k-fx-start\").addClass(\"k-fx-end\");\n that._after(previous, element);\n });\n });\n }\n\n return deferred.promise();\n },\n\n stop: function() {\n this.complete();\n }\n });\n\n var Animation = kendo.Class.extend({\n init: function() {\n var that = this;\n that._tickProxy = that._tick.bind(that);\n that._started = false;\n },\n\n tick: $.noop,\n done: $.noop,\n onEnd: $.noop,\n onCancel: $.noop,\n\n start: function() {\n if (!this.enabled()) {\n return;\n }\n\n if (!this.done()) {\n this._started = true;\n kendo.animationFrame(this._tickProxy);\n } else {\n this.onEnd();\n }\n },\n\n enabled: function() {\n return true;\n },\n\n cancel: function() {\n this._started = false;\n this.onCancel();\n },\n\n _tick: function() {\n var that = this;\n if (!that._started) { return; }\n\n that.tick();\n\n if (!that.done()) {\n kendo.animationFrame(that._tickProxy);\n } else {\n that._started = false;\n that.onEnd();\n }\n }\n });\n\n var Transition = Animation.extend({\n init: function(options) {\n var that = this;\n extend(that, options);\n Animation.fn.init.call(that);\n },\n\n done: function() {\n return this.timePassed() >= this.duration;\n },\n\n timePassed: function() {\n return Math.min(this.duration, (new Date()) - this.startDate);\n },\n\n moveTo: function(options) {\n var that = this,\n movable = that.movable;\n\n that.initial = movable[that.axis];\n that.delta = options.location - that.initial;\n\n that.duration = typeof options.duration == \"number\" ? options.duration : 300;\n\n that.tick = that._easeProxy(options.ease);\n\n that.startDate = new Date();\n that.start();\n },\n\n _easeProxy: function(ease) {\n var that = this;\n\n return function() {\n that.movable.moveAxis(that.axis, ease(that.timePassed(), that.initial, that.delta, that.duration));\n };\n }\n });\n\n extend(Transition, {\n easeOutExpo: function(t, b, c, d) {\n return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;\n },\n\n easeOutBack: function(t, b, c, d, s) {\n s = 1.70158;\n return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;\n }\n });\n\n fx.Animation = Animation;\n fx.Transition = Transition;\n fx.createEffect = createEffect;\n\n fx.box = function(element) {\n element = $(element);\n var result = element.offset();\n result.width = kendo._outerWidth(element);\n result.height = kendo._outerHeight(element);\n return result;\n };\n\n fx.transformOrigin = function(inner, outer) {\n var x = (inner.left - outer.left) * outer.width / (outer.width - inner.width),\n y = (inner.top - outer.top) * outer.height / (outer.height - inner.height);\n\n return {\n x: isNaN(x) ? 0 : x,\n y: isNaN(y) ? 0 : y\n };\n };\n\n fx.fillScale = function(inner, outer) {\n return Math.min(inner.width / outer.width, inner.height / outer.height);\n };\n\n fx.fitScale = function(inner, outer) {\n return Math.max(inner.width / outer.width, inner.height / outer.height);\n };\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.view',[\n \"kendo.core\",\n \"kendo.binder\",\n \"kendo.fx\"\n ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"view\",\n name: \"View\",\n category: \"framework\",\n description: \"The View class instantiates and handles the events of a certain screen from the application.\",\n depends: [ \"core\", \"binder\", \"fx\" ],\n hidden: false\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n attr = kendo.attr,\n ui = kendo.ui,\n attrValue = kendo.attrValue,\n directiveSelector = kendo.directiveSelector,\n Observable = kendo.Observable,\n Widget = kendo.ui.Widget,\n roleSelector = kendo.roleSelector,\n\n SCRIPT = \"SCRIPT\",\n INIT = \"init\",\n TRANSITION_START = \"transitionStart\",\n TRANSITION_END = \"transitionEnd\",\n SHOW = \"show\",\n HIDE = \"hide\",\n ATTACH = \"attach\",\n DETACH = \"detach\",\n sizzleErrorRegExp = /unrecognized expression/;\n\n var bodyRegExp = /]*>(([\\u000a\\u000d\\u2028\\u2029]|.)*)<\\/body>/i;\n var LOAD_START = \"loadStart\";\n var LOAD_COMPLETE = \"loadComplete\";\n var SHOW_START = \"showStart\";\n var SAME_VIEW_REQUESTED = \"sameViewRequested\";\n var VIEW_SHOW = \"viewShow\";\n var VIEW_TYPE_DETERMINED = \"viewTypeDetermined\";\n var AFTER = \"after\";\n var classNames = {\n content: \"k-content\",\n view: \"k-view\",\n stretchedView: \"k-stretched-view\",\n widget: \"k-widget\",\n header: \"k-header\",\n footer: \"k-footer\"\n };\n\n var View = kendo.ui.Widget.extend({\n init: function(content, options) {\n var that = this;\n options = options || {};\n that.id = kendo.guid();\n\n Observable.fn.init.call(that);\n this.options = $.extend({}, this.options, options);\n\n that.content = content;\n\n if (that.options.renderOnInit) {\n Widget.fn.init.call(that, that._createElement(), options);\n }\n\n if (that.options.wrapInSections) {\n that._renderSections();\n }\n\n that.tagName = options.tagName || \"div\";\n that.model = options.model;\n that._wrap = options.wrap !== false;\n this._evalTemplate = options.evalTemplate || false;\n this._useWithBlock = options.useWithBlock;\n that._fragments = {};\n\n that.bind([ INIT, SHOW, HIDE, TRANSITION_START, TRANSITION_END ], options);\n },\n\n options: {\n name: \"View\",\n renderOnInit: false,\n wrapInSections: false,\n detachOnHide: true,\n detachOnDestroy: true\n },\n\n render: function(container) {\n var that = this,\n notInitialized = !that.element;\n\n // The order below matters - kendo.bind should happen when the element is in the DOM, and show should be triggered after init.\n\n if (notInitialized) {\n that.element = that._createElement();\n }\n\n if (container) {\n $(container).append(that.element);\n }\n\n if (notInitialized) {\n kendo.bind(that.element, that.model);\n that.trigger(INIT);\n }\n\n if (container) {\n that._eachFragment(ATTACH);\n that.trigger(SHOW);\n }\n\n return that.element;\n },\n\n clone: function() {\n return new ViewClone(this);\n },\n\n triggerBeforeShow: function() {\n return true;\n },\n\n triggerBeforeHide: function() {\n return true;\n },\n\n showStart: function() {\n var that = this;\n var element = that.render();\n\n if (element) {\n element.css(\"display\", \"\");\n }\n\n this.trigger(SHOW_START, { view: this });\n },\n\n showEnd: function() {\n },\n\n hideEnd: function() {\n this.hide();\n },\n\n beforeTransition: function(type) {\n this.trigger(TRANSITION_START, { type: type });\n },\n\n afterTransition: function(type) {\n this.trigger(TRANSITION_END, { type: type });\n },\n\n hide: function() {\n if (this.options.detachOnHide) {\n this._eachFragment(DETACH);\n $(this.element).detach();\n }\n\n this.trigger(HIDE);\n },\n\n destroy: function() {\n var that = this;\n var element = that.element;\n\n if (element) {\n Widget.fn.destroy.call(that);\n\n kendo.unbind(element);\n kendo.destroy(element);\n\n if (that.options.detachOnDestroy) {\n element.remove();\n }\n }\n },\n\n // ported from mobile view\n purge: function() {\n var that = this;\n\n that.destroy();\n $(that.element).add(that.content).add(that.wrapper).off().remove();\n },\n\n fragments: function(fragments) {\n $.extend(this._fragments, fragments);\n },\n\n _eachFragment: function(methodName) {\n for (var placeholder in this._fragments) {\n this._fragments[placeholder][methodName](this, placeholder);\n }\n },\n\n _createElement: function() {\n var that = this,\n wrapper = \"<\" + that.tagName + \">\",\n element,\n content;\n\n try {\n content = $(document.getElementById(that.content) || that.content); // support passing id without #\n\n if (content[0].tagName === SCRIPT) {\n content = content.html();\n }\n } catch (e) {\n if (sizzleErrorRegExp.test(e.message)) {\n content = that.content;\n }\n }\n\n if (typeof content === \"string\") {\n content = content.replace(/^\\s+|\\s+$/g, '');\n if (that._evalTemplate) {\n content = kendo.template(content, { useWithBlock: that._useWithBlock })(that.model || {});\n }\n\n element = $(wrapper).append(content);\n // drop the wrapper if asked - this seems like the easiest (although not very intuitive) way to avoid messing up templates with questionable content, like this one for instance:\n // \n if (!that._wrap) {\n element = element.contents();\n }\n } else {\n element = content;\n if (that._evalTemplate) {\n var result = $(kendo.template($(\"
    \").append(element.clone(true)).html(), { useWithBlock: that._useWithBlock })(that.model || {}));\n\n // template uses DOM\n if ($.contains(document, element[0])) {\n element.replaceWith(result);\n }\n\n element = result;\n }\n if (that._wrap) {\n element = element.wrapAll(wrapper).parent();\n }\n }\n\n return element;\n },\n\n _renderSections: function() {\n var that = this;\n\n if (that.options.wrapInSections) {\n that._wrapper();\n that._createContent();\n that._createHeader();\n that._createFooter();\n }\n },\n\n _wrapper: function() {\n var that = this;\n var content = that.content;\n\n if (content.is(roleSelector(\"view\"))) {\n that.wrapper = that.content;\n } else {\n that.wrapper = content\n .wrap('
    ')\n .parent();\n }\n\n var wrapper = that.wrapper;\n\n wrapper.attr(\"id\", that.id);\n\n wrapper.addClass(classNames.view);\n wrapper.addClass(classNames.widget);\n wrapper.attr(\"role\", \"view\");\n },\n\n _createContent: function() {\n var that = this;\n var wrapper = $(that.wrapper);\n var contentSelector = roleSelector(\"content\");\n\n if (!wrapper.children(contentSelector)[0]) {\n var ccontentElements = wrapper.children().filter(function() {\n var child = $(this);\n if (!child.is(roleSelector(\"header\")) && !child.is(roleSelector(\"footer\"))) {\n return child;\n }\n });\n\n ccontentElements.wrap(\"
    ');\n }\n\n // use contentElement instead of content as view.content can be a string\n this.contentElement = wrapper.children(roleSelector(\"content\"));\n\n this.contentElement\n .addClass(classNames.stretchedView)\n .addClass(classNames.content);\n },\n\n _createHeader: function() {\n var that = this;\n var wrapper = that.wrapper;\n\n this.header = wrapper.children(roleSelector(\"header\")).addClass(classNames.header);\n },\n\n _createFooter: function() {\n var that = this;\n var wrapper = that.wrapper;\n\n this.footer = wrapper.children(roleSelector(\"footer\")).addClass(classNames.footer);\n }\n });\n\n var ViewClone = kendo.Class.extend({\n init: function(view) {\n $.extend(this, {\n element: view.element.clone(true),\n transition: view.transition,\n id: view.id\n });\n\n view.element.parent().append(this.element);\n },\n\n hideEnd: function() {\n this.element.remove();\n },\n\n beforeTransition: $.noop,\n afterTransition: $.noop\n });\n\n var Layout = View.extend({\n init: function(content, options) {\n View.fn.init.call(this, content, options);\n this.containers = {};\n },\n\n container: function(selector) {\n var container = this.containers[selector];\n\n if (!container) {\n container = this._createContainer(selector);\n this.containers[selector] = container;\n }\n\n return container;\n },\n\n showIn: function(selector, view, transition) {\n this.container(selector).show(view, transition);\n },\n\n _createContainer: function(selector) {\n var root = this.render(),\n element = root.find(selector),\n container;\n\n if (!element.length && root.is(selector)) {\n if (root.is(selector)) {\n element = root;\n } else {\n\n throw new Error(\"can't find a container with the specified \" + selector + \" selector\");\n }\n }\n\n container = new ViewContainer(element);\n\n container.bind(\"accepted\", function(e) {\n e.view.render(element);\n });\n\n return container;\n }\n });\n\n var Fragment = View.extend({\n attach: function(view, placeholder) {\n view.element.find(placeholder).replaceWith(this.render());\n },\n\n detach: function() {\n }\n });\n\n var transitionRegExp = /^(\\w+)(:(\\w+))?( (\\w+))?$/;\n\n function parseTransition(transition) {\n if (!transition) {\n return {};\n }\n\n var matches = transition.match(transitionRegExp) || [];\n\n return {\n type: matches[1],\n direction: matches[3],\n reverse: matches[5] === \"reverse\"\n };\n }\n\n var ViewContainer = Observable.extend({\n init: function(container) {\n Observable.fn.init.call(this);\n this.container = container;\n this.history = [];\n this.view = null;\n this.running = false;\n },\n\n after: function() {\n this.running = false;\n this.trigger(\"complete\", { view: this.view });\n this.trigger(\"after\");\n },\n\n end: function() {\n this.view.showEnd();\n this.previous.hideEnd();\n this.after();\n },\n\n show: function(view, transition, locationID) {\n if (!view.triggerBeforeShow() || (this.view && !this.view.triggerBeforeHide())) {\n this.trigger(\"after\");\n return false;\n }\n\n locationID = locationID || view.id;\n\n var that = this,\n current = (view === that.view) ? view.clone() : that.view,\n history = that.history,\n previousEntry = history[history.length - 2] || {},\n back = previousEntry.id === locationID,\n // If explicit transition is set, it will be with highest priority\n // Next we will try using the history record transition or the view transition configuration\n theTransition = transition || ( back ? history[history.length - 1].transition : view.transition ),\n transitionData = parseTransition(theTransition);\n\n if (that.running) {\n that.effect.stop();\n }\n\n if (theTransition === \"none\") {\n theTransition = null;\n }\n\n that.trigger(\"accepted\", { view: view });\n that.view = view;\n that.previous = current;\n that.running = true;\n\n if (!back) {\n history.push({ id: locationID, transition: theTransition });\n } else {\n history.pop();\n }\n\n if (!current) {\n view.showStart();\n view.showEnd();\n that.after();\n return true;\n }\n\n if (!theTransition || !kendo.effects.enabled) {\n view.showStart();\n that.end();\n } else {\n // hide the view element before init/show - prevents blinks on iPad\n // the replace effect will remove this class\n view.element.addClass(\"k-fx-hidden\");\n view.showStart();\n // do not reverse the explicit transition\n if (back && !transition) {\n transitionData.reverse = !transitionData.reverse;\n }\n\n that.effect = kendo.fx(view.element).replace(current.element, transitionData.type)\n .beforeTransition(function() {\n view.beforeTransition(\"show\");\n current.beforeTransition(\"hide\");\n })\n .afterTransition(function() {\n view.afterTransition(\"show\");\n current.afterTransition(\"hide\");\n })\n .direction(transitionData.direction)\n .setReverse(transitionData.reverse);\n\n that.effect.run().then(function() { that.end(); });\n }\n\n return true;\n },\n\n destroy: function() {\n var that = this;\n var view = that.view;\n\n if (view && view.destroy) {\n view.destroy();\n }\n }\n });\n\n var ViewEngine = Observable.extend({\n init: function(options) {\n var that = this,\n views,\n container;\n\n Observable.fn.init.call(that);\n that.options = options;\n\n $.extend(that, options);\n that.sandbox = $(\"
    \");\n container = that.container;\n\n views = that._hideViews(container);\n that.rootView = views.first();\n that.layouts = {};\n\n that.viewContainer = new kendo.ViewContainer(that.container);\n\n that.viewContainer.bind(\"accepted\", function(e) {\n e.view.params = that.params;\n });\n\n that.viewContainer.bind(\"complete\", function(e) {\n that.trigger(VIEW_SHOW, { view: e.view });\n });\n\n that.viewContainer.bind(AFTER, function() {\n that.trigger(AFTER);\n });\n\n this.bind(this.events, options);\n },\n\n events: [\n SHOW_START,\n AFTER,\n VIEW_SHOW,\n LOAD_START,\n LOAD_COMPLETE,\n SAME_VIEW_REQUESTED,\n VIEW_TYPE_DETERMINED\n ],\n\n destroy: function() {\n var that = this;\n var viewContainer = that.viewContainer;\n\n kendo.destroy(that.container);\n\n for (var id in that.layouts) {\n this.layouts[id].destroy();\n }\n\n if (viewContainer) {\n viewContainer.destroy();\n }\n },\n\n view: function() {\n return this.viewContainer.view;\n },\n\n showView: function(url, transition, params) {\n url = url.replace(new RegExp(\"^\" + this.remoteViewURLPrefix), \"\");\n if (url === \"\" && this.remoteViewURLPrefix) {\n url = \"/\";\n }\n\n if (url.replace(/^#/, \"\") === this.url) {\n this.trigger(SAME_VIEW_REQUESTED);\n return false;\n }\n\n this.trigger(SHOW_START);\n\n var that = this,\n element = that._findViewElement(url),\n view = kendo.widgetInstance(element);\n\n that.url = url.replace(/^#/, \"\");\n\n that.params = params;\n\n if (view && view.reload) {\n view.purge();\n element = [];\n }\n\n this.trigger(VIEW_TYPE_DETERMINED, { remote: element.length === 0, url: url });\n\n if (element[0]) {\n if (!view) {\n view = that._createView(element);\n }\n\n return that.viewContainer.show(view, transition, url);\n } else {\n return true;\n }\n },\n\n append: function(html, url) {\n var sandbox = this.sandbox,\n urlPath = (url || \"\").split(\"?\")[0],\n container = this.container,\n views,\n view;\n\n if (bodyRegExp.test(html)) {\n html = RegExp.$1;\n }\n\n sandbox[0].innerHTML = html;\n\n container.append(sandbox.children(\"script, style\"));\n\n views = this._hideViews(sandbox);\n view = views.first();\n\n // Generic HTML content found as remote view - no remote view markers\n if (!view.length) {\n views = view = sandbox.wrapInner(\"
    \").children(); // one element\n }\n\n if (urlPath) {\n view.hide().attr(attr(\"url\"), urlPath);\n }\n\n container.append(views);\n\n return this._createView(view);\n },\n\n _locate: function(selectors) {\n return this.$angular ? directiveSelector(selectors) : roleSelector(selectors);\n },\n\n _findViewElement: function(url) {\n var element,\n urlPath = url.split(\"?\")[0];\n\n if (!urlPath) {\n return this.rootView;\n }\n\n element = this.container.children(\"[\" + attr(\"url\") + \"='\" + urlPath + \"']\");\n\n // do not try to search for \"#/foo/bar\" id, jQuery throws error\n if (!element[0] && urlPath.indexOf(\"/\") === -1) {\n element = this.container.children(urlPath.charAt(0) === \"#\" ? urlPath : \"#\" + urlPath);\n }\n\n if (!element[0]) {\n element = this._findViewElementById(url);\n }\n\n return element;\n },\n\n _findViewElementById: function(id) {\n var element = this.container.children(\"[id='\" + id + \"']\");\n return element;\n },\n\n _createView: function(element) {\n //return this._createMobileView(element);\n return this._createSpaView(element);\n },\n\n _createMobileView: function(element) {\n return kendo.initWidget(element, {\n defaultTransition: this.transition,\n loader: this.loader,\n container: this.container,\n getLayout: this.getLayoutProxy,\n modelScope: this.modelScope,\n reload: attrValue(element, \"reload\")\n }, ui.roles);\n },\n\n _createSpaView: function(element) {\n var viewOptions = (this.options || {}).viewOptions || {};\n return new kendo.View(element, {\n renderOnInit: viewOptions.renderOnInit,\n wrap: viewOptions.wrap || false,\n wrapInSections: viewOptions.wrapInSections,\n detachOnHide: viewOptions.detachOnHide,\n detachOnDestroy: viewOptions.detachOnDestroy\n });\n },\n\n _hideViews: function(container) {\n return container.children(this._locate(\"view\")).hide();\n }\n });\n\n kendo.ViewEngine = ViewEngine;\n\n kendo.ViewContainer = ViewContainer;\n kendo.Fragment = Fragment;\n kendo.Layout = Layout;\n kendo.View = View;\n kendo.ViewClone = ViewClone;\n\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.floatinglabel',[\"kendo.core\"], f);\n})(function() {\n\nvar __meta__ = {\n id: \"floatinglabel\",\n name: \"FloatingLabel\",\n category: \"framework\",\n depends: [\"core\"],\n hidden: true\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n Widget = kendo.ui.Widget,\n ui = kendo.ui,\n NS = \".kendoFloatingLabel\",\n FLOATINGLABELCONTAINER = \"k-floating-label-container\",\n EMPTY = \"k-state-empty\",\n FOCUSED = \"k-focus\",\n STATEDISABLED = \"k-disabled\",\n NOCLICKCLASS = \"k-no-click\",\n STATEREADONLY = \"k-readonly\";\n\n var FloatingLabel = Widget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n options = $.extend(true, {}, options);\n\n that.refresh();\n that._editable({\n readonly: that.options.widget.options.readonly !== undefined ? that.options.widget.options.readonly : false,\n disable: that.options.widget.options.enable !== undefined ? !(that.options.widget.options.enable) : false\n });\n\n that.element.addClass(FLOATINGLABELCONTAINER);\n\n kendo.notify(that);\n },\n\n options: {\n name: 'FloatingLabel',\n widget: null,\n useReadOnlyClass: false\n },\n\n readonly: function(readonly) {\n this._editable({\n readonly: readonly === undefined ? true : readonly,\n disable: false\n });\n },\n\n enable: function(enable) {\n this._editable({\n readonly: false,\n disable: !(enable = enable === undefined ? true : enable)\n });\n },\n\n refresh: function() {\n var that = this;\n var element = that.element;\n\n element\n .removeClass(EMPTY)\n .removeClass(FOCUSED);\n\n\n if (!that.options.widget.element.val()) {\n element.addClass(EMPTY);\n }\n\n if (document.activeElement === that.options.widget.element[0]) {\n element.addClass(FOCUSED);\n }\n },\n\n destroy: function() {\n var that = this;\n\n that.element.off(NS);\n Widget.fn.destroy.call(that);\n },\n\n _editable: function(options) {\n var that = this;\n var element = that.element;\n var disable = options.disable;\n var readonly = options.readonly;\n\n element.off(NS);\n\n if (!readonly && !disable) {\n element\n .removeClass(STATEDISABLED)\n .removeClass(that.options.useReadOnlyClass ? STATEREADONLY : NOCLICKCLASS);\n\n element.on(\"focusin\" + NS, that.refresh.bind(that));\n element.on(\"focusout\" + NS, that.refresh.bind(that));\n } else {\n element\n .toggleClass(STATEDISABLED, disable)\n .toggleClass(that.options.useReadOnlyClass ? STATEREADONLY : NOCLICKCLASS, readonly);\n }\n }\n });\n ui.plugin(FloatingLabel);\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.data.signalr',[ \"kendo.data\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"data.signalr\",\n name: \"SignalR\",\n category: \"framework\",\n depends: [ \"data\" ],\n hidden: true\n};\n\n(function($) {\n var kendo = window.kendo;\n var isFunction = kendo.isFunction;\n\n function isJQueryPromise(promise) {\n return promise && isFunction(promise.done) && isFunction(promise.fail);\n }\n\n function isNativePromise(promise) {\n return promise && isFunction(promise.then) && isFunction(promise.catch);\n }\n\n var transport = kendo.data.RemoteTransport.extend({\n init: function(options) {\n var signalr = options && options.signalr ? options.signalr : {};\n\n var promise = signalr.promise;\n\n if (!promise) {\n throw new Error('The \"promise\" option must be set.');\n }\n\n if (!isJQueryPromise(promise) && !isNativePromise(promise)) {\n throw new Error('The \"promise\" option must be a Promise.');\n }\n\n this.promise = promise;\n\n var hub = signalr.hub;\n\n if (!hub) {\n throw new Error('The \"hub\" option must be set.');\n }\n\n if (typeof hub.on != \"function\" || typeof hub.invoke != \"function\") {\n throw new Error('The \"hub\" option is not a valid SignalR hub proxy.');\n }\n\n this.hub = hub;\n\n kendo.data.RemoteTransport.fn.init.call(this, options);\n },\n\n push: function(callbacks) {\n var client = this.options.signalr.client || {};\n\n if (client.create) {\n this.hub.on(client.create, callbacks.pushCreate);\n }\n\n if (client.update) {\n this.hub.on(client.update, callbacks.pushUpdate);\n }\n\n if (client.destroy) {\n this.hub.on(client.destroy, callbacks.pushDestroy);\n }\n },\n\n _crud: function(options, type) {\n var hub = this.hub;\n var promise = this.promise;\n var server = this.options.signalr.server;\n\n if (!server || !server[type]) {\n throw new Error(kendo.format('The \"server.{0}\" option must be set.', type));\n }\n\n var args = [server[type]];\n\n var data = this.parameterMap(options.data, type);\n\n if (!$.isEmptyObject(data)) {\n args.push(data);\n }\n\n if (isJQueryPromise(promise)) {\n promise.done(function() {\n hub.invoke.apply(hub, args)\n .done(options.success)\n .fail(options.error);\n });\n } else if (isNativePromise(promise)) {\n promise.then(function() {\n hub.invoke.apply(hub, args)\n .then(options.success)\n .catch(options.error);\n });\n }\n },\n\n read: function(options) {\n this._crud(options, \"read\");\n },\n\n create: function(options) {\n this._crud(options, \"create\");\n },\n\n update: function(options) {\n this._crud(options, \"update\");\n },\n\n destroy: function(options) {\n this._crud(options, \"destroy\");\n }\n });\n\n $.extend(true, kendo.data, {\n transports: {\n signalr: transport\n }\n });\n\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.validator',[ \"kendo.core\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"validator\",\n name: \"Validator\",\n category: \"web\",\n description: \"The Validator offers an easy way to do a client-side form validation.\",\n depends: [ \"core\" ]\n};\n\n\n(function($, undefined) {\n var kendo = window.kendo,\n Widget = kendo.ui.Widget,\n NS = \".kendoValidator\",\n INVALIDMSG = \"k-invalid-msg\",\n invalidMsgRegExp = new RegExp(INVALIDMSG,'i'),\n INVALIDINPUT = \"k-invalid\",\n VALIDINPUT = \"k-valid\",\n VALIDATIONSUMMARY = \"k-validation-summary\",\n INVALIDLABEL = \"k-text-error\",\n MESSAGEBOX = \"k-messagebox k-messagebox-error\",\n INPUTINNER = \".k-input-inner\",\n INPUTWRAPPER = \".k-input\",\n ARIAINVALID = \"aria-invalid\",\n ARIADESCRIBEDBY = \"aria-describedby\",\n emailRegExp = /^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/i,\n urlRegExp = /^(https?|ftp):\\/\\/(((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?)(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|[\\uE000-\\uF8FF]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i,\n INPUTSELECTOR = \":input:not(:button,[type=submit],[type=reset],[disabled],[readonly])\",\n CHECKBOXSELECTOR = \":checkbox:not([disabled],[readonly])\",\n NUMBERINPUTSELECTOR = \"[type=number],[type=range]\",\n BLUR = \"blur\",\n NAME = \"name\",\n FORM = \"form\",\n NOVALIDATE = \"novalidate\",\n //events\n VALIDATE = \"validate\",\n CHANGE = \"change\",\n VALIDATE_INPUT = \"validateInput\",\n\n patternMatcher = function(value, pattern) {\n if (typeof pattern === \"string\") {\n pattern = new RegExp('^(?:' + pattern + ')$');\n }\n return pattern.test(value);\n },\n matcher = function(input, selector, pattern) {\n var value = input.val();\n\n if (input.filter(selector).length && value !== \"\") {\n return patternMatcher(value, pattern);\n }\n return true;\n },\n hasAttribute = function(input, name) {\n if (input.length) {\n return input[0].attributes[name] != null;\n }\n return false;\n };\n\n if (!kendo.ui.validator) {\n kendo.ui.validator = { rules: {}, messages: {}, allowSubmit: $.noop, validateOnInit: $.noop };\n }\n\n function resolveRules(element) {\n var resolvers = kendo.ui.validator.ruleResolvers || {},\n rules = {},\n name;\n\n for (name in resolvers) {\n $.extend(true, rules, resolvers[name].resolve(element));\n }\n return rules;\n }\n\n function decode(value) {\n return value.replace(/&/g, '&')\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\")\n .replace(/</g, '<')\n .replace(/>/g, '>');\n }\n\n function numberOfDecimalDigits(value) {\n value = (value + \"\").split('.');\n if (value.length > 1) {\n return value[1].length;\n }\n return 0;\n }\n\n function parseHtml(text) {\n if ($.parseHTML) {\n return $($.parseHTML(text));\n }\n return $(text);\n }\n\n function searchForMessageContainer(elements, fieldName) {\n var containers = $(),\n element,\n attr;\n\n for (var idx = 0, length = elements.length; idx < length; idx++) {\n element = elements[idx];\n if (invalidMsgRegExp.test(element.className)) {\n attr = element.getAttribute(kendo.attr(\"for\"));\n if (attr === fieldName) {\n containers = containers.add(element);\n }\n }\n }\n return containers;\n }\n\n function isLabelFor(label, element) {\n if (!label) {\n return false;\n }\n if (typeof label.nodeName !== 'string' || label.nodeName !== 'LABEL') {\n return false;\n }\n if (typeof label.getAttribute('for') !== 'string' || typeof element.getAttribute('id') !== 'string') {\n return false;\n }\n if (label.getAttribute('for') !== element.getAttribute('id')) {\n return false;\n }\n\n return true;\n }\n\n var SUMMARYTEMPLATE = '';\n\n var Validator = Widget.extend({\n init: function(element, options) {\n var that = this,\n resolved = resolveRules(element),\n validateAttributeSelector = \"[\" + kendo.attr(\"validate\") + \"!=false]\";\n\n options = options || {};\n\n options.rules = $.extend({}, kendo.ui.validator.rules, resolved.rules, options.rules);\n options.messages = $.extend({}, kendo.ui.validator.messages, resolved.messages, options.messages);\n\n Widget.fn.init.call(that, element, options);\n\n that._errorTemplate = kendo.template(that.options.errorTemplate);\n that._summaryTemplate = kendo.template(that.options.validationSummary.template || SUMMARYTEMPLATE);\n\n if (that.element.is(FORM)) {\n that.element.attr(NOVALIDATE, NOVALIDATE);\n }\n\n that._inputSelector = INPUTSELECTOR + validateAttributeSelector;\n that._checkboxSelector = CHECKBOXSELECTOR + validateAttributeSelector;\n\n that._errors = {};\n that._attachEvents();\n that._isValidated = false;\n\n if (that._validateOnInit()) {\n that.validate();\n }\n },\n\n events: [ VALIDATE, CHANGE, VALIDATE_INPUT ],\n\n options: {\n name: \"Validator\",\n errorTemplate: '#= message #',\n messages: {\n required: \"{0} is required\",\n pattern: \"{0} is not valid\",\n min: \"{0} should be greater than or equal to {1}\",\n max: \"{0} should be smaller than or equal to {1}\",\n step: \"{0} is not valid\",\n email: \"{0} is not valid email\",\n url: \"{0} is not valid URL\",\n date: \"{0} is not valid date\",\n dateCompare: \"End date should be greater than or equal to the start date\",\n captcha: \"The text you entered doesn't match the image.\"\n },\n rules: {\n required: function(input) {\n var noNameCheckbox = !input.attr(\"name\") && !input.is(\":checked\"),\n name = input.attr(\"name\"),\n quote = !!name && name.indexOf(\"'\") > -1 ? '\\\"' : \"'\",\n namedCheckbox = input.attr(\"name\") && !this.element.find(\"input[name=\" + quote + input.attr(\"name\") + quote + \"]:checked\").length,\n checkbox = input.filter(\"[type=checkbox]\").length && (noNameCheckbox || namedCheckbox),\n radio = input.filter(\"[type=radio]\").length && !this.element.find(\"input[name=\" + quote + input.attr(\"name\") + quote + \"]:checked\").length,\n value = input.val();\n\n return !(hasAttribute(input, \"required\") && (!value || value === \"\" || value.length === 0 || checkbox || radio));\n },\n pattern: function(input) {\n if (input.filter(\"[type=text],[type=email],[type=url],[type=tel],[type=search],[type=password]\").filter(\"[pattern]\").length && input.val() !== \"\") {\n return patternMatcher(input.val(), input.attr(\"pattern\"));\n }\n return true;\n },\n min: function(input) {\n if (input.filter(NUMBERINPUTSELECTOR + \",[\" + kendo.attr(\"type\") + \"=number]\").filter(\"[min]\").length && input.val() !== \"\") {\n var min = parseFloat(input.attr(\"min\")) || 0,\n val = kendo.parseFloat(input.val());\n\n return min <= val;\n }\n return true;\n },\n max: function(input) {\n if (input.filter(NUMBERINPUTSELECTOR + \",[\" + kendo.attr(\"type\") + \"=number]\").filter(\"[max]\").length && input.val() !== \"\") {\n var max = parseFloat(input.attr(\"max\")) || 0,\n val = kendo.parseFloat(input.val());\n\n return max >= val;\n }\n return true;\n },\n step: function(input) {\n if (input.filter(NUMBERINPUTSELECTOR + \",[\" + kendo.attr(\"type\") + \"=number]\").filter(\"[step]\").length && input.val() !== \"\") {\n var min = parseFloat(input.attr(\"min\")) || 0,\n step = parseFloat(input.attr(\"step\")) || 1,\n val = parseFloat(input.val()),\n decimals = numberOfDecimalDigits(step),\n raise;\n\n if (decimals) {\n raise = Math.pow(10, decimals);\n return ((Math.floor((val - min) * raise)) % (step * raise)) / Math.pow(100, decimals) === 0;\n }\n return ((val - min) % step) === 0;\n }\n return true;\n },\n email: function(input) {\n return matcher(input, \"[type=email],[\" + kendo.attr(\"type\") + \"=email]\", emailRegExp);\n },\n url: function(input) {\n return matcher(input, \"[type=url],[\" + kendo.attr(\"type\") + \"=url]\", urlRegExp);\n },\n date: function(input) {\n if (input.filter(\"[type^=date],[\" + kendo.attr(\"type\") + \"=date]\").length && input.val() !== \"\") {\n return kendo.parseDate(input.val(), input.attr(kendo.attr(\"format\"))) !== null;\n }\n return true;\n },\n captcha: function(input) {\n if (input.filter(\"[\" + kendo.attr(\"role\") + \"=captcha]\").length) {\n var that = this,\n captcha = kendo.widgetInstance(input),\n isValidated = function(isValid) {\n return typeof(isValid) !== 'undefined' && isValid !== null;\n };\n\n if (!input.data(\"captcha_validating\") && !isValidated(captcha.isValid()) && !!captcha.getCaptchaId()) {\n input.data(\"captcha_validating\", true);\n that._validating = true;\n captcha.validate().done(function() {\n that._validating = false;\n that._checkElement(input);\n }).fail(function(data) {\n that._validating = false;\n if (data.error && data.error === \"handler_not_defined\") {\n window.console.warn(\"Captcha's validationHandler is not defined! You should either define a proper validation endpoint or declare a callback function to ensure the required behavior.\");\n }\n });\n }\n\n if (isValidated(captcha.isValid())) {\n input.removeData(\"captcha_validating\");\n return captcha.isValid();\n }\n }\n return true;\n }\n },\n validateOnBlur: true,\n validationSummary: false\n },\n\n _allowSubmit: function() {\n return kendo.ui.validator.allowSubmit(this.element, this.errors());\n },\n\n _validateOnInit: function() {\n return kendo.ui.validator.validateOnInit(this.element);\n },\n\n destroy: function() {\n Widget.fn.destroy.call(this);\n\n this.element.off(NS);\n\n if (this.validationSummary) {\n this.validationSummary.off(NS);\n this.validationSummary = null;\n }\n },\n\n value: function() {\n if (!this._isValidated) {\n return false;\n }\n\n return this.errors().length === 0;\n },\n\n _submit: function(e) {\n if ((!this.validate() && !this._allowSubmit()) || this._validating) {\n e.stopPropagation();\n e.stopImmediatePropagation();\n e.preventDefault();\n return false;\n }\n return true;\n },\n\n _checkElement: function(element) {\n var state = this.value();\n\n this.validateInput(element);\n\n if (this.value() !== state) {\n this.trigger(CHANGE);\n }\n },\n\n _attachEvents: function() {\n var that = this;\n\n if (that.element.is(FORM)) {\n that.element.on(\"submit\" + NS, that._submit.bind(that));\n }\n\n if (that.options.validateOnBlur) {\n if (!that.element.is(INPUTSELECTOR)) {\n that.element.on(BLUR + NS, that._inputSelector, function() {\n that._checkElement($(this));\n });\n\n that.element.on(\"click\" + NS, that._checkboxSelector, function() {\n that._checkElement($(this));\n });\n } else {\n that.element.on(BLUR + NS, function() {\n that._checkElement(that.element);\n });\n\n if (that.element.is(CHECKBOXSELECTOR)) {\n that.element.on(\"click\" + NS, function() {\n that._checkElement(that.element);\n });\n }\n }\n }\n },\n\n validate: function() {\n var inputs;\n var idx;\n var result = false;\n var length;\n\n var isValid = this.value();\n\n this._errors = {};\n\n if (!this.element.is(INPUTSELECTOR)) {\n var invalid = false;\n\n inputs = this.element.find(this._inputSelector);\n\n for (idx = 0, length = inputs.length; idx < length; idx++) {\n if (!this.validateInput(inputs.eq(idx))) {\n invalid = true;\n }\n }\n\n result = !invalid;\n } else {\n result = this.validateInput(this.element);\n }\n\n if (this.options.validationSummary && !isValid) {\n this.showValidationSummary();\n }\n\n this.trigger(VALIDATE, { valid: result, errors: this.errors() });\n\n if (isValid !== result) {\n this.trigger(CHANGE);\n }\n\n return result;\n },\n\n validateInput: function(input) {\n input = $(input);\n\n\n this._isValidated = true;\n\n var that = this,\n template = that._errorTemplate,\n result = that._checkValidity(input),\n valid = result.valid,\n widgetInstance,\n className = \".\" + INVALIDMSG,\n fieldName = (input.attr(NAME) || \"\"),\n lbl = that._findMessageContainer(fieldName).add(input.next(className).filter(function() {\n var element = $(this);\n if (element.filter(\"[\" + kendo.attr(\"for\") + \"]\").length) {\n return element.attr(kendo.attr(\"for\")) === fieldName;\n }\n\n return true;\n\n })).addClass(\"k-hidden\"),\n messageText = !valid ? that._extractMessage(input, result.key) : \"\",\n messageLabel = !valid ? parseHtml(template({ message: decode(messageText), field: fieldName })) : \"\",\n wasValid = !input.attr(ARIAINVALID),\n isInputInner = input.is(INPUTINNER),\n inputWrapper = input.parent(INPUTWRAPPER);\n\n input.removeAttr(ARIAINVALID);\n\n if (input.hasClass(\"k-hidden\")) {\n widgetInstance = kendo.widgetInstance(input.closest(\".k-signature\"));\n }\n\n if (!valid && !input.data(\"captcha_validating\")) {\n that._errors[fieldName] = messageText;\n var lblId = lbl.attr('id');\n\n that._decorateMessageContainer(messageLabel, fieldName);\n\n\n if (lblId) {\n messageLabel.attr('id', lblId);\n }\n\n if (lbl.length !== 0) {\n lbl.replaceWith(messageLabel);\n } else {\n widgetInstance = widgetInstance || kendo.widgetInstance(input);\n var parentElement = input.parent().get(0);\n var nextElement = input.next().get(0);\n var prevElement = input.prev().get(0);\n\n // Get the instance of the RadioGroup which is not initialized on the input element\n if (!widgetInstance && input.is(\"[type=radio]\")) {\n widgetInstance = kendo.widgetInstance(input.closest(\".k-radio-list\"));\n }\n\n // Get the instance of the CheckBoxGroup which is not initialized on the input element\n if (!widgetInstance && input.is(\"[type=checkbox]\")) {\n widgetInstance = kendo.widgetInstance(input.closest(\".k-checkbox-list\"));\n }\n\n if (widgetInstance && widgetInstance.wrapper && (widgetInstance.element !== widgetInstance.wrapper || widgetInstance.options.name == \"Signature\")) {\n messageLabel.insertAfter(widgetInstance.wrapper);\n } else if (parentElement && parentElement.nodeName === \"LABEL\") {\n // Input inside label\n messageLabel.insertAfter(parentElement);\n } else if (nextElement && isLabelFor(nextElement, input[0])) {\n // Input before label\n messageLabel.insertAfter(nextElement);\n } else if (prevElement && isLabelFor(prevElement, input[0])) {\n // Input after label\n messageLabel.insertAfter(input);\n } else if (isInputInner && inputWrapper.length) {\n // Input after input wrapper\n messageLabel.insertAfter(inputWrapper);\n } else {\n messageLabel.insertAfter(input);\n }\n }\n\n messageLabel.removeClass(\"k-hidden\");\n\n input.attr(ARIAINVALID, true);\n } else {\n delete that._errors[fieldName];\n }\n\n if (wasValid !== valid) {\n this.trigger(VALIDATE_INPUT, { valid: valid, input: input, error: messageText, field: fieldName });\n }\n\n widgetInstance = (widgetInstance && widgetInstance.options.name == \"Signature\") ? widgetInstance : kendo.widgetInstance(input);\n if (!widgetInstance || !(widgetInstance._inputWrapper || widgetInstance.wrapper)) {\n input.toggleClass(INVALIDINPUT, !valid);\n input.toggleClass(VALIDINPUT, valid);\n }\n\n if (widgetInstance) {\n var inputWrap = widgetInstance._inputWrapper || widgetInstance.wrapper;\n var inputLabel = widgetInstance._inputLabel;\n\n if (inputWrap) {\n inputWrap.toggleClass(INVALIDINPUT, !valid);\n inputWrap.toggleClass(VALIDINPUT, valid);\n }\n if (inputLabel) {\n inputLabel.toggleClass(INVALIDLABEL, !valid);\n }\n }\n\n if (wasValid !== valid) {\n var errorId = messageLabel ? messageLabel.attr(\"id\") : lbl.attr(\"id\");\n\n that._associateMessageContainer(input, errorId);\n\n if (this.options.validationSummary && this.options.validateOnBlur) {\n this.showValidationSummary();\n }\n }\n\n return valid;\n },\n\n hideMessages: function() {\n var that = this,\n className = \".\" + INVALIDMSG,\n element = that.element;\n\n that._disassociateMessageContainers();\n\n if (!element.is(INPUTSELECTOR)) {\n element.find(className).addClass(\"k-hidden\");\n } else {\n element.next(className).addClass(\"k-hidden\");\n }\n },\n\n reset: function() {\n var that = this,\n inputs = that.element.find(\".\" + INVALIDINPUT),\n labels = that.element.find(\".\" + INVALIDLABEL);\n\n that._errors = [];\n\n that.hideMessages();\n\n that.hideValidationSummary();\n\n inputs.removeAttr(ARIAINVALID);\n inputs.removeClass(INVALIDINPUT);\n labels.removeClass(INVALIDLABEL);\n },\n\n _findMessageContainer: function(fieldName) {\n var locators = kendo.ui.validator.messageLocators,\n name,\n containers = $();\n\n for (var idx = 0, length = this.element.length; idx < length; idx++) {\n containers = containers.add(searchForMessageContainer(this.element[idx].getElementsByTagName(\"*\"), fieldName));\n }\n\n for (name in locators) {\n containers = containers.add(locators[name].locate(this.element, fieldName));\n }\n\n return containers;\n },\n\n _decorateMessageContainer: function(container, fieldName) {\n var locators = kendo.ui.validator.messageLocators,\n name;\n\n container.addClass(INVALIDMSG)\n .attr(kendo.attr(\"for\"), fieldName || \"\");\n\n if (!container.attr(\"id\")) {\n container.attr(\"id\", fieldName + \"-error\");\n }\n\n for (name in locators) {\n locators[name].decorate(container, fieldName);\n }\n },\n\n _extractMessage: function(input, ruleKey) {\n var that = this,\n customMessage = that.options.messages[ruleKey],\n fieldName = input.attr(NAME),\n nonDefaultMessage;\n\n if (!kendo.ui.Validator.prototype.options.messages[ruleKey]) {\n nonDefaultMessage = kendo.isFunction(customMessage) ? customMessage(input) : customMessage;\n }\n\n customMessage = kendo.isFunction(customMessage) ? customMessage(input) : customMessage;\n\n return kendo.format(input.attr(kendo.attr(ruleKey + \"-msg\")) || input.attr(\"validationMessage\") || nonDefaultMessage || customMessage || input.attr(\"title\") || \"\",\n fieldName,\n input.attr(ruleKey) || input.attr(kendo.attr(ruleKey)));\n },\n\n _checkValidity: function(input) {\n var rules = this.options.rules,\n rule;\n\n for (rule in rules) {\n if (!rules[rule].call(this, input)) {\n return { valid: false, key: rule };\n }\n }\n\n return { valid: true };\n },\n\n errors: function() {\n var results = [],\n errors = this._errors,\n error;\n\n for (error in errors) {\n results.push(errors[error]);\n }\n return results;\n },\n\n setOptions: function(options) {\n if (options.validationSummary) {\n this.hideValidationSummary();\n }\n\n kendo.deepExtend(this.options, options);\n\n this.destroy();\n\n this.init(this.element, this.options);\n\n this._setEvents(this.options);\n },\n\n _getInputNames: function() {\n var that = this,\n inputs = that.element.find(that._inputSelector),\n sorted = [];\n\n for (var idx = 0, length = inputs.length; idx < length; idx++) {\n var input = $(inputs[idx]);\n\n if (hasAttribute(input, NAME)) {\n // Add current name if:\n // - not present so far;\n // - present but not part of CheckBoxGroup or RadioGroup.\n if (sorted.indexOf(input.attr(NAME)) === -1 ||\n (input.closest(\".k-checkbox-list\").length === 0 &&\n input.closest(\".k-radio-list\").length === 0)) {\n sorted.push(input.attr(NAME));\n }\n }\n }\n\n return sorted;\n },\n\n _associateMessageContainer: function(input, errorId) {\n var nextFocusable = kendo.getWidgetFocusableElement(input);\n\n if (!nextFocusable || !errorId) {\n return;\n }\n\n kendo.toggleAttribute(nextFocusable, ARIADESCRIBEDBY, errorId);\n },\n\n _disassociateMessageContainers: function() {\n var that = this,\n inputs = that.element.find(\".\" + INVALIDINPUT).addBack(),\n input, errorId;\n\n for (var i = 0; i < inputs.length; i += 1) {\n input = $(inputs[i]);\n\n if (input.is(\"input\")) {\n errorId = that._findMessageContainer(input.attr(NAME))\n .add(input.next(\".\" + INVALIDMSG))\n .attr(\"id\");\n\n that._associateMessageContainer(input, errorId);\n }\n }\n },\n\n _errorsByName: function() {\n var that = this,\n inputNames = that._getInputNames(),\n sorted = [];\n\n for (var i = 0; i < inputNames.length; i += 1) {\n var name = inputNames[i];\n\n if (that._errors[name]) {\n sorted.push({\n field: name,\n message: that._errors[name]\n });\n }\n }\n\n return sorted;\n },\n\n _renderSummary: function() {\n var that = this,\n options = this.options.validationSummary,\n element = this.element,\n prevElement = element.prev(),\n container;\n\n if (options.container) {\n container = $(options.container);\n } else if (prevElement && prevElement.hasClass(VALIDATIONSUMMARY)) {\n container = prevElement;\n } else {\n container = $(\"
    \").insertBefore(that.element);\n }\n\n container.addClass([VALIDATIONSUMMARY, MESSAGEBOX].join(\" \"));\n container.attr(\"role\", \"alert\");\n\n container.on(\"click\" + NS, that._summaryClick.bind(that));\n\n return container;\n },\n\n _summaryClick: function(e) {\n e.preventDefault();\n\n var that = this,\n link = $(e.target),\n target = that.element.find(\"[name='\" + link.data(\"field\") + \"']\"),\n nextFocusable;\n\n if (!target.length) {\n return;\n }\n\n nextFocusable = kendo.getWidgetFocusableElement(target);\n\n if (nextFocusable) {\n nextFocusable.trigger(\"focus\");\n }\n },\n\n showValidationSummary: function() {\n var that = this,\n summary = that.validationSummary,\n errors = that._errorsByName(),\n errorsList;\n\n if (!summary) {\n summary = that.validationSummary = that._renderSummary();\n }\n\n errorsList = parseHtml(that._summaryTemplate({\n errors: errors\n }));\n\n summary.html(errorsList);\n\n summary.toggleClass(\"k-hidden\", !errors.length);\n },\n\n hideValidationSummary: function() {\n var that = this,\n summary = that.validationSummary;\n\n if (!summary) {\n return;\n }\n\n summary.addClass(\"k-hidden\");\n }\n });\n\n kendo.ui.plugin(Validator);\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.draganddrop',[ \"kendo.core\", \"kendo.userevents\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"draganddrop\",\n name: \"Drag & drop\",\n category: \"framework\",\n description: \"Drag & drop functionality for any DOM element.\",\n depends: [ \"core\", \"userevents\" ]\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n support = kendo.support,\n document = window.document,\n $window = $(window),\n Class = kendo.Class,\n Widget = kendo.ui.Widget,\n Observable = kendo.Observable,\n UserEvents = kendo.UserEvents,\n extend = $.extend,\n getOffset = kendo.getOffset,\n draggables = {},\n dropTargets = {},\n dropAreas = {},\n lastDropTarget,\n elementUnderCursor = kendo.elementUnderCursor,\n KEYUP = \"keyup\",\n CHANGE = \"change\",\n\n // Draggable events\n DRAGSTART = \"dragstart\",\n HOLD = \"hold\",\n DRAG = \"drag\",\n DRAGEND = \"dragend\",\n DRAGCANCEL = \"dragcancel\",\n HINTDESTROYED = \"hintDestroyed\",\n\n // DropTarget events\n DRAGENTER = \"dragenter\",\n DRAGLEAVE = \"dragleave\",\n DROP = \"drop\";\n\n function contains(parent, child) {\n try {\n return $.contains(parent, child) || parent == child;\n } catch (e) {\n return false;\n }\n }\n\n function numericCssPropery(element, property) {\n return parseInt(element.css(property), 10) || 0;\n }\n\n function within(value, range) {\n return Math.min(Math.max(value, range.min), range.max);\n }\n\n function containerBoundaries(container, element) {\n var offset = getOffset(container),\n outerWidth = kendo._outerWidth,\n outerHeight = kendo._outerHeight,\n minX = offset.left + numericCssPropery(container, \"borderLeftWidth\") + numericCssPropery(container, \"paddingLeft\"),\n minY = offset.top + numericCssPropery(container, \"borderTopWidth\") + numericCssPropery(container, \"paddingTop\"),\n maxX = minX + container.width() - outerWidth(element, true),\n maxY = minY + container.height() - outerHeight(element, true);\n\n return {\n x: { min: minX, max: maxX },\n y: { min: minY, max: maxY }\n };\n }\n\n function checkTarget(target, targets, areas) {\n var theTarget, theFilter, i = 0,\n targetLen = targets && targets.length,\n areaLen = areas && areas.length;\n\n while (target && target.parentNode) {\n for (i = 0; i < targetLen; i ++) {\n theTarget = targets[i];\n if (theTarget.element[0] === target) {\n return { target: theTarget, targetElement: target };\n }\n }\n\n for (i = 0; i < areaLen; i ++) {\n theFilter = areas[i];\n if ($.contains(theFilter.element[0], target) && support.matchesSelector.call(target, theFilter.options.filter)) {\n return { target: theFilter, targetElement: target };\n }\n }\n\n target = target.parentNode;\n }\n\n return undefined;\n }\n\n var TapCapture = Observable.extend({\n init: function(element, options) {\n var that = this,\n domElement = element[0];\n\n that.capture = false;\n\n if (domElement.addEventListener) {\n $.each(kendo.eventMap.down.split(\" \"), function() {\n domElement.addEventListener(this, that._press.bind(that), true);\n });\n $.each(kendo.eventMap.up.split(\" \"), function() {\n domElement.addEventListener(this, that._release.bind(that), true);\n });\n } else {\n $.each(kendo.eventMap.down.split(\" \"), function() {\n domElement.attachEvent(this, that._press.bind(that));\n });\n $.each(kendo.eventMap.up.split(\" \"), function() {\n domElement.attachEvent(this, that._release.bind(that));\n });\n }\n\n Observable.fn.init.call(that);\n\n that.bind([\"press\", \"release\"], options || {});\n },\n\n captureNext: function() {\n this.capture = true;\n },\n\n cancelCapture: function() {\n this.capture = false;\n },\n\n _press: function(e) {\n var that = this;\n that.trigger(\"press\");\n if (that.capture) {\n e.preventDefault();\n }\n },\n\n _release: function(e) {\n var that = this;\n that.trigger(\"release\");\n\n if (that.capture) {\n e.preventDefault();\n that.cancelCapture();\n }\n }\n });\n\n var PaneDimension = Observable.extend({\n init: function(options) {\n var that = this;\n Observable.fn.init.call(that);\n\n that.forcedEnabled = false;\n\n $.extend(that, options);\n\n that.scale = 1;\n\n if (that.horizontal) {\n that.measure = \"offsetWidth\";\n that.scrollSize = \"scrollWidth\";\n that.axis = \"x\";\n } else {\n that.measure = \"offsetHeight\";\n that.scrollSize = \"scrollHeight\";\n that.axis = \"y\";\n }\n },\n\n makeVirtual: function() {\n $.extend(this, {\n virtual: true,\n forcedEnabled: true,\n _virtualMin: 0,\n _virtualMax: 0\n });\n },\n\n virtualSize: function(min, max) {\n if (this._virtualMin !== min || this._virtualMax !== max) {\n this._virtualMin = min;\n this._virtualMax = max;\n this.update();\n }\n },\n\n outOfBounds: function(offset) {\n return offset > this.max || offset < this.min;\n },\n\n forceEnabled: function() {\n this.forcedEnabled = true;\n },\n\n getSize: function() {\n return this.container[0][this.measure];\n },\n\n getTotal: function() {\n return this.element[0][this.scrollSize];\n },\n\n rescale: function(scale) {\n this.scale = scale;\n },\n\n update: function(silent) {\n var that = this,\n total = that.virtual ? that._virtualMax : that.getTotal(),\n scaledTotal = total * that.scale,\n size = that.getSize();\n\n if (total === 0 && !that.forcedEnabled) {\n return; // we are not visible.\n }\n\n that.max = that.virtual ? -that._virtualMin : 0;\n that.size = size;\n that.total = scaledTotal;\n that.min = Math.min(that.max, size - scaledTotal);\n that.minScale = size / total;\n that.centerOffset = (scaledTotal - size) / 2;\n\n that.enabled = that.forcedEnabled || (scaledTotal > size);\n\n if (!silent) {\n that.trigger(CHANGE, that);\n }\n }\n });\n\n var PaneDimensions = Observable.extend({\n init: function(options) {\n var that = this;\n\n Observable.fn.init.call(that);\n\n that.x = new PaneDimension(extend({ horizontal: true }, options));\n that.y = new PaneDimension(extend({ horizontal: false }, options));\n that.container = options.container;\n that.forcedMinScale = options.minScale;\n that.maxScale = options.maxScale || 100;\n\n that.bind(CHANGE, options);\n },\n\n rescale: function(newScale) {\n this.x.rescale(newScale);\n this.y.rescale(newScale);\n this.refresh();\n },\n\n centerCoordinates: function() {\n return { x: Math.min(0, -this.x.centerOffset), y: Math.min(0, -this.y.centerOffset) };\n },\n\n refresh: function() {\n var that = this;\n that.x.update();\n that.y.update();\n that.enabled = that.x.enabled || that.y.enabled;\n that.minScale = that.forcedMinScale || Math.min(that.x.minScale, that.y.minScale);\n that.fitScale = Math.max(that.x.minScale, that.y.minScale);\n that.trigger(CHANGE);\n }\n });\n\n var PaneAxis = Observable.extend({\n init: function(options) {\n var that = this;\n extend(that, options);\n Observable.fn.init.call(that);\n },\n\n outOfBounds: function() {\n return this.dimension.outOfBounds(this.movable[this.axis]);\n },\n\n dragMove: function(delta) {\n var that = this,\n dimension = that.dimension,\n axis = that.axis,\n movable = that.movable,\n position = movable[axis] + delta;\n\n if (!dimension.enabled) {\n return;\n }\n\n if ((position < dimension.min && delta < 0) || (position > dimension.max && delta > 0)) {\n delta *= that.resistance;\n }\n\n movable.translateAxis(axis, delta);\n that.trigger(CHANGE, that);\n }\n });\n\n var Pane = Class.extend({\n\n init: function(options) {\n var that = this,\n x,\n y,\n resistance,\n movable;\n\n extend(that, { elastic: true }, options);\n\n resistance = that.elastic ? 0.5 : 0;\n movable = that.movable;\n\n that.x = x = new PaneAxis({\n axis: \"x\",\n dimension: that.dimensions.x,\n resistance: resistance,\n movable: movable\n });\n\n that.y = y = new PaneAxis({\n axis: \"y\",\n dimension: that.dimensions.y,\n resistance: resistance,\n movable: movable\n });\n\n that.userEvents.bind([\"press\", \"move\", \"end\", \"gesturestart\", \"gesturechange\"], {\n gesturestart: function(e) {\n that.gesture = e;\n that.offset = that.dimensions.container.offset();\n },\n\n press: function(e) {\n if ($(e.event.target).closest(\"a\").is(\"[data-navigate-on-press=true]\")) {\n e.sender.cancel();\n }\n },\n\n gesturechange: function(e) {\n var previousGesture = that.gesture,\n previousCenter = previousGesture.center,\n\n center = e.center,\n\n scaleDelta = e.distance / previousGesture.distance,\n\n minScale = that.dimensions.minScale,\n maxScale = that.dimensions.maxScale,\n coordinates;\n\n if (movable.scale <= minScale && scaleDelta < 1) {\n // Resist shrinking. Instead of shrinking from 1 to 0.5, it will shrink to 0.5 + (1 /* minScale */ - 0.5) * 0.8 = 0.9;\n scaleDelta += (1 - scaleDelta) * 0.8;\n }\n\n if (movable.scale * scaleDelta >= maxScale) {\n scaleDelta = maxScale / movable.scale;\n }\n\n var offsetX = movable.x + that.offset.left,\n offsetY = movable.y + that.offset.top;\n\n coordinates = {\n x: (offsetX - previousCenter.x) * scaleDelta + center.x - offsetX,\n y: (offsetY - previousCenter.y) * scaleDelta + center.y - offsetY\n };\n\n movable.scaleWith(scaleDelta);\n\n x.dragMove(coordinates.x);\n y.dragMove(coordinates.y);\n\n that.dimensions.rescale(movable.scale);\n that.gesture = e;\n e.preventDefault();\n },\n\n move: function(e) {\n if (e.event.target.tagName.match(/textarea|input/i)) {\n return;\n }\n\n if (x.dimension.enabled || y.dimension.enabled) {\n x.dragMove(e.x.delta);\n y.dragMove(e.y.delta);\n e.preventDefault();\n } else {\n e.touch.skip();\n }\n },\n\n end: function(e) {\n e.preventDefault();\n }\n });\n }\n });\n\n var TRANSFORM_STYLE = support.transitions.prefix + \"Transform\",\n translate;\n\n\n if (support.hasHW3D) {\n translate = function(x, y, scale) {\n return \"translate3d(\" + x + \"px,\" + y + \"px,0) scale(\" + scale + \")\";\n };\n } else {\n translate = function(x, y, scale) {\n return \"translate(\" + x + \"px,\" + y + \"px) scale(\" + scale + \")\";\n };\n }\n\n var Movable = Observable.extend({\n init: function(element) {\n var that = this;\n\n Observable.fn.init.call(that);\n\n that.element = $(element);\n that.element[0].style.webkitTransformOrigin = \"left top\";\n that.x = 0;\n that.y = 0;\n that.scale = 1;\n that._saveCoordinates(translate(that.x, that.y, that.scale));\n },\n\n translateAxis: function(axis, by) {\n this[axis] += by;\n this.refresh();\n },\n\n scaleTo: function(scale) {\n this.scale = scale;\n this.refresh();\n },\n\n scaleWith: function(scaleDelta) {\n this.scale *= scaleDelta;\n this.refresh();\n },\n\n translate: function(coordinates) {\n this.x += coordinates.x;\n this.y += coordinates.y;\n this.refresh();\n },\n\n moveAxis: function(axis, value) {\n this[axis] = value;\n this.refresh();\n },\n\n moveTo: function(coordinates) {\n extend(this, coordinates);\n this.refresh();\n },\n\n refresh: function() {\n var that = this,\n x = that.x,\n y = that.y,\n newCoordinates;\n\n if (that.round) {\n x = Math.round(x);\n y = Math.round(y);\n }\n\n newCoordinates = translate(x, y, that.scale);\n\n if (newCoordinates != that.coordinates) {\n if (kendo.support.browser.msie && kendo.support.browser.version < 10) {\n that.element[0].style.position = \"absolute\";\n that.element[0].style.left = that.x + \"px\";\n that.element[0].style.top = that.y + \"px\";\n\n } else {\n that.element[0].style[TRANSFORM_STYLE] = newCoordinates;\n }\n that._saveCoordinates(newCoordinates);\n that.trigger(CHANGE);\n }\n },\n\n _saveCoordinates: function(coordinates) {\n this.coordinates = coordinates;\n }\n });\n\n function destroyDroppable(collection, widget) {\n var groupName = widget.options.group,\n droppables = collection[groupName],\n i;\n\n Widget.fn.destroy.call(widget);\n\n if (droppables.length > 1) {\n for (i = 0; i < droppables.length; i++) {\n if (droppables[i] == widget) {\n droppables.splice(i, 1);\n break;\n }\n }\n } else {\n droppables.length = 0; // WTF, porting this from the previous destroyGroup\n delete collection[groupName];\n }\n }\n\n var DropTarget = Widget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n\n var group = that.options.group;\n\n if (!(group in dropTargets)) {\n dropTargets[group] = [ that ];\n } else {\n dropTargets[group].push( that );\n }\n },\n\n events: [\n DRAGENTER,\n DRAGLEAVE,\n DROP\n ],\n\n options: {\n name: \"DropTarget\",\n group: \"default\"\n },\n\n destroy: function() {\n destroyDroppable(dropTargets, this);\n },\n\n _trigger: function(eventName, e) {\n var that = this,\n draggable = draggables[that.options.group];\n\n if (draggable) {\n return that.trigger(eventName, extend({}, e.event, {\n draggable: draggable,\n dropTarget: e.dropTarget\n }));\n }\n },\n\n _over: function(e) {\n this._trigger(DRAGENTER, e);\n },\n\n _out: function(e) {\n this._trigger(DRAGLEAVE, e);\n },\n\n _drop: function(e) {\n var that = this,\n draggable = draggables[that.options.group];\n\n if (draggable) {\n draggable.dropped = !that._trigger(DROP, e);\n }\n }\n });\n\n DropTarget.destroyGroup = function(groupName) {\n var group = dropTargets[groupName] || dropAreas[groupName],\n i;\n\n if (group) {\n for (i = 0; i < group.length; i++) {\n Widget.fn.destroy.call(group[i]);\n }\n\n group.length = 0;\n delete dropTargets[groupName];\n delete dropAreas[groupName];\n }\n };\n\n DropTarget._cache = dropTargets;\n\n var DropTargetArea = DropTarget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n\n var group = that.options.group;\n\n if (!(group in dropAreas)) {\n dropAreas[group] = [ that ];\n } else {\n dropAreas[group].push( that );\n }\n },\n\n destroy: function() {\n destroyDroppable(dropAreas, this);\n },\n\n options: {\n name: \"DropTargetArea\",\n group: \"default\",\n filter: null\n }\n });\n\n var Draggable = Widget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n\n that._activated = false;\n\n that.userEvents = new UserEvents(that.element, {\n global: true,\n allowSelection: true,\n filter: that.options.filter,\n threshold: that.options.distance,\n start: that._start.bind(that),\n hold: that._hold.bind(that),\n move: that._drag.bind(that),\n end: that._end.bind(that),\n cancel: that._cancel.bind(that),\n select: that._select.bind(that)\n });\n\n if (kendo.support.touch) {\n that.element.find(that.options.filter).css('touch-action', 'none');\n }\n\n that._afterEndHandler = that._afterEnd.bind(that);\n that._captureEscape = that._captureEscape.bind(that);\n },\n\n events: [\n HOLD,\n DRAGSTART,\n DRAG,\n DRAGEND,\n DRAGCANCEL,\n HINTDESTROYED\n ],\n\n options: {\n name: \"Draggable\",\n distance: ( kendo.support.touch ? 0 : 5),\n group: \"default\",\n cursorOffset: null,\n axis: null,\n container: null,\n filter: null,\n ignore: null,\n holdToDrag: false,\n autoScroll: false,\n dropped: false\n },\n\n cancelHold: function() {\n this._activated = false;\n },\n\n _captureEscape: function(e) {\n var that = this;\n\n if (e.keyCode === kendo.keys.ESC) {\n that._trigger(DRAGCANCEL, { event: e });\n that.userEvents.cancel();\n }\n },\n\n _updateHint: function(e) {\n var that = this,\n coordinates,\n options = that.options,\n boundaries = that.boundaries,\n axis = options.axis,\n cursorOffset = that.options.cursorOffset;\n\n if (cursorOffset) {\n coordinates = { left: e.x.location + cursorOffset.left, top: e.y.location + cursorOffset.top };\n } else {\n that.hintOffset.left += e.x.delta;\n that.hintOffset.top += e.y.delta;\n coordinates = $.extend({}, that.hintOffset);\n }\n\n if (boundaries) {\n coordinates.top = within(coordinates.top, boundaries.y);\n coordinates.left = within(coordinates.left, boundaries.x);\n }\n\n if (axis === \"x\") {\n delete coordinates.top;\n } else if (axis === \"y\") {\n delete coordinates.left;\n }\n\n that.hint.css(coordinates);\n },\n\n _shouldIgnoreTarget: function(target) {\n var ignoreSelector = this.options.ignore;\n return ignoreSelector && $(target).is(ignoreSelector);\n },\n\n _select: function(e) {\n if (!this._shouldIgnoreTarget(e.event.target)) {\n e.preventDefault();\n }\n },\n\n _start: function(e) {\n var that = this,\n options = that.options,\n container = options.container ? $(options.container) : null,\n hint = options.hint;\n\n if (this._shouldIgnoreTarget(e.touch.initialTouch) || (options.holdToDrag && !that._activated)) {\n that.userEvents.cancel();\n return;\n }\n\n that.currentTarget = e.target;\n that.currentTargetOffset = getOffset(that.currentTarget);\n\n if (hint) {\n if (that.hint) {\n that.hint.stop(true, true).remove();\n }\n\n that.hint = kendo.isFunction(hint) ? $(hint.call(that, that.currentTarget)) : hint;\n\n var offset = getOffset(that.currentTarget);\n that.hintOffset = offset;\n\n that.hint.css( {\n position: \"absolute\",\n zIndex: 20000, // the Window's z-index is 10000 and can be raised because of z-stacking\n left: offset.left,\n top: offset.top\n })\n .appendTo(document.body);\n\n that.angular(\"compile\", function() {\n that.hint.removeAttr(\"ng-repeat\");\n var scopeTarget = $(e.target);\n\n while (!scopeTarget.data(\"$$kendoScope\") && scopeTarget.length) {\n scopeTarget = scopeTarget.parent();\n }\n\n return {\n elements: that.hint.get(),\n scopeFrom: scopeTarget.data(\"$$kendoScope\")\n };\n });\n }\n\n draggables[options.group] = that;\n\n that.dropped = false;\n\n if (container) {\n that.boundaries = containerBoundaries(container, that.hint);\n }\n\n $(document).on(KEYUP, that._captureEscape);\n\n if (that._trigger(DRAGSTART, e)) {\n that.userEvents.cancel();\n that._afterEnd();\n }\n\n that.userEvents.capture();\n },\n\n _hold: function(e) {\n this.currentTarget = e.target;\n\n if (this._trigger(HOLD, e)) {\n this.userEvents.cancel();\n } else {\n this._activated = true;\n }\n },\n\n _drag: function(e) {\n e.preventDefault();\n\n var cursorElement = this._elementUnderCursor(e);\n\n if (this.options.autoScroll && this._cursorElement !== cursorElement) {\n this._scrollableParent = findScrollableParent(cursorElement);\n this._cursorElement = cursorElement;\n }\n\n this._lastEvent = e;\n this._processMovement(e, cursorElement);\n\n if (this.options.autoScroll) {\n // chrome seems to trigger mousemove when mouse is moved outside of the window (over the Chrome), too.\n if (this._scrollableParent[0]) {\n var velocity = autoScrollVelocity(e.x.location, e.y.location, scrollableViewPort(this._scrollableParent));\n\n\n this._scrollCompenstation = $.extend({}, this.hintOffset);\n this._scrollVelocity = velocity;\n\n if (velocity.y === 0 && velocity.x === 0) {\n clearInterval(this._scrollInterval);\n this._scrollInterval = null;\n } else if (!this._scrollInterval) {\n this._scrollInterval = setInterval(this._autoScroll.bind(this), 50);\n }\n }\n }\n\n if (this.hint) {\n this._updateHint(e);\n }\n },\n\n _processMovement: function(e, cursorElement) {\n this._withDropTarget(cursorElement, function(target, targetElement) {\n if (!target) {\n if (lastDropTarget) {\n lastDropTarget._trigger(DRAGLEAVE, extend(e, { dropTarget: $(lastDropTarget.targetElement) }));\n lastDropTarget = null;\n }\n return;\n }\n\n if (lastDropTarget) {\n if (targetElement === lastDropTarget.targetElement) {\n return;\n }\n\n lastDropTarget._trigger(DRAGLEAVE, extend(e, { dropTarget: $(lastDropTarget.targetElement) }));\n }\n\n target._trigger(DRAGENTER, extend(e, { dropTarget: $(targetElement) }));\n lastDropTarget = extend(target, { targetElement: targetElement });\n });\n\n this._trigger(DRAG, extend(e, { dropTarget: lastDropTarget, elementUnderCursor: cursorElement }));\n },\n\n _autoScroll: function() {\n var parent = this._scrollableParent[0],\n velocity = this._scrollVelocity,\n compensation = this._scrollCompenstation;\n\n if (!parent) {\n return;\n }\n\n var cursorElement = this._elementUnderCursor(this._lastEvent);\n this._processMovement(this._lastEvent, cursorElement);\n\n var yIsScrollable, xIsScrollable;\n\n var isRootNode = parent === scrollableRoot()[0];\n\n if (isRootNode) {\n yIsScrollable = document.body.scrollHeight > $window.height();\n xIsScrollable = document.body.scrollWidth > $window.width();\n } else {\n yIsScrollable = parent.offsetHeight <= parent.scrollHeight;\n xIsScrollable = parent.offsetWidth <= parent.scrollWidth;\n }\n\n var yDelta = parent.scrollTop + velocity.y;\n var yInBounds = yIsScrollable && yDelta > 0 && yDelta < parent.scrollHeight;\n\n var xDelta = parent.scrollLeft + velocity.x;\n var xInBounds = xIsScrollable && xDelta > 0 && xDelta < parent.scrollWidth;\n\n if (yInBounds) {\n parent.scrollTop += velocity.y;\n } else if (yIsScrollable && yDelta < 0) {\n parent.scrollTop = 0;\n }\n\n if (xInBounds) {\n parent.scrollLeft += velocity.x;\n } else if (xIsScrollable && xDelta < 0) {\n parent.scrollLeft = 0;\n }\n\n if (this.hint && isRootNode && (xInBounds || yInBounds)) {\n if (yInBounds) {\n compensation.top += velocity.y;\n }\n\n if (xInBounds) {\n compensation.left += velocity.x;\n }\n\n this.hint.css(compensation);\n }\n },\n\n _end: function(e) {\n this._withDropTarget(this._elementUnderCursor(e), function(target, targetElement) {\n if (target) {\n target._drop(extend({}, e, { dropTarget: $(targetElement) }));\n lastDropTarget = null;\n }\n });\n\n clearInterval(this._scrollInterval);\n this._scrollInterval = null;\n this._cancel(this._trigger(DRAGEND, e));\n },\n\n _cancel: function(isDefaultPrevented) {\n var that = this;\n\n that._scrollableParent = null;\n this._cursorElement = null;\n clearInterval(this._scrollInterval);\n that._activated = false;\n\n if (that.hint && !that.dropped) {\n setTimeout(function() {\n that.hint.stop(true, true);\n\n if (isDefaultPrevented) {\n that._afterEndHandler();\n } else {\n that.hint.animate(that.currentTargetOffset, \"fast\", that._afterEndHandler);\n }\n }, 0);\n\n } else {\n that._afterEnd();\n }\n },\n\n _trigger: function(eventName, e) {\n var that = this;\n\n return that.trigger(\n eventName, extend(\n {},\n e.event,\n {\n x: e.x,\n y: e.y,\n currentTarget: that.currentTarget,\n initialTarget: e.touch ? e.touch.initialTouch : null,\n dropTarget: e.dropTarget,\n elementUnderCursor: e.elementUnderCursor\n }\n ));\n },\n\n _elementUnderCursor: function(e) {\n var target = elementUnderCursor(e),\n hint = this.hint;\n\n if (hint && contains(hint[0], target)) {\n hint.hide();\n target = elementUnderCursor(e);\n // IE8 does not return the element in iframe from first attempt\n if (!target) {\n target = elementUnderCursor(e);\n }\n hint.show();\n }\n\n return target;\n },\n\n _withDropTarget: function(element, callback) {\n var result,\n group = this.options.group,\n targets = dropTargets[group],\n areas = dropAreas[group];\n\n if (targets && targets.length || areas && areas.length) {\n result = checkTarget(element, targets, areas);\n\n if (result) {\n callback(result.target, result.targetElement);\n } else {\n callback();\n }\n }\n },\n\n destroy: function() {\n var that = this;\n\n Widget.fn.destroy.call(that);\n\n that._afterEnd();\n\n that.userEvents.destroy();\n\n this._scrollableParent = null;\n this._cursorElement = null;\n clearInterval(this._scrollInterval);\n\n that.currentTarget = null;\n },\n\n _afterEnd: function() {\n var that = this;\n\n if (that.hint) {\n that.hint.remove();\n }\n\n delete draggables[that.options.group];\n\n that.trigger(\"destroy\");\n that.trigger(HINTDESTROYED);\n $(document).off(KEYUP, that._captureEscape);\n }\n });\n\n kendo.ui.plugin(DropTarget);\n kendo.ui.plugin(DropTargetArea);\n kendo.ui.plugin(Draggable);\n kendo.TapCapture = TapCapture;\n kendo.containerBoundaries = containerBoundaries;\n\n extend(kendo.ui, {\n Pane: Pane,\n PaneDimensions: PaneDimensions,\n Movable: Movable\n });\n\n function scrollableViewPort(element) {\n var root = scrollableRoot()[0],\n offset,\n top,\n left;\n\n if (element[0] === root) {\n top = root.scrollTop;\n left = root.scrollLeft;\n\n return {\n top: top,\n left: left,\n bottom: top + $window.height(),\n right: left + $window.width()\n };\n } else {\n offset = element.offset();\n offset.bottom = offset.top + element.height();\n offset.right = offset.left + element.width();\n return offset;\n }\n }\n\n function scrollableRoot() {\n return $(kendo.support.browser.edge || kendo.support.browser.safari ? document.body : document.documentElement);\n }\n\n function findScrollableParent(element) {\n var root = scrollableRoot();\n\n if (!element || element === document.body || element === document.documentElement) {\n return root;\n }\n\n var parent = $(element)[0];\n\n while (parent && !kendo.isScrollable(parent) && parent !== document.body) {\n parent = parent.parentNode;\n }\n\n if (parent === document.body) {\n return root;\n }\n\n return $(parent);\n }\n\n function autoScrollVelocity(mouseX, mouseY, rect) {\n var velocity = { x: 0, y: 0 };\n\n var AUTO_SCROLL_AREA = 50;\n\n if (mouseX - rect.left < AUTO_SCROLL_AREA) {\n velocity.x = -(AUTO_SCROLL_AREA - (mouseX - rect.left));\n } else if (rect.right - mouseX < AUTO_SCROLL_AREA) {\n velocity.x = AUTO_SCROLL_AREA - (rect.right - mouseX);\n }\n\n if (mouseY - rect.top < AUTO_SCROLL_AREA) {\n velocity.y = -(AUTO_SCROLL_AREA - (mouseY - rect.top));\n } else if (rect.bottom - mouseY < AUTO_SCROLL_AREA) {\n velocity.y = AUTO_SCROLL_AREA - (rect.bottom - mouseY);\n }\n\n return velocity;\n }\n\n // export for testing\n kendo.ui.Draggable.utils = {\n autoScrollVelocity: autoScrollVelocity,\n scrollableViewPort: scrollableViewPort,\n findScrollableParent: findScrollableParent\n };\n\n })(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.mobile.scroller',[ \"kendo.fx\", \"kendo.draganddrop\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"mobile.scroller\",\n name: \"Scroller\",\n category: \"mobile\",\n description: \"The Kendo Mobile Scroller widget enables touch friendly kinetic scrolling for the contents of a given DOM element.\",\n depends: [ \"fx\", \"draganddrop\" ]\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n mobile = kendo.mobile,\n fx = kendo.effects,\n ui = mobile.ui,\n extend = $.extend,\n Widget = ui.Widget,\n Class = kendo.Class,\n Movable = kendo.ui.Movable,\n Pane = kendo.ui.Pane,\n PaneDimensions = kendo.ui.PaneDimensions,\n Transition = fx.Transition,\n Animation = fx.Animation,\n abs = Math.abs,\n SNAPBACK_DURATION = 500,\n SCROLLBAR_OPACITY = 0.7,\n FRICTION = 0.96,\n VELOCITY_MULTIPLIER = 10,\n MAX_VELOCITY = 55,\n OUT_OF_BOUNDS_FRICTION = 0.5,\n ANIMATED_SCROLLER_PRECISION = 5,\n RELEASECLASS = \"km-scroller-release\",\n REFRESHCLASS = \"km-scroller-refresh\",\n PULL = \"pull\",\n CHANGE = \"change\",\n RESIZE = \"resize\",\n SCROLL = \"scroll\",\n MOUSE_WHEEL_ID = 2;\n\n var ZoomSnapBack = Animation.extend({\n init: function(options) {\n var that = this;\n Animation.fn.init.call(that);\n extend(that, options);\n\n that.userEvents.bind(\"gestureend\", that.start.bind(that));\n that.tapCapture.bind(\"press\", that.cancel.bind(that));\n },\n\n enabled: function() {\n return this.movable.scale < this.dimensions.minScale;\n },\n\n done: function() {\n return this.dimensions.minScale - this.movable.scale < 0.01;\n },\n\n tick: function() {\n var movable = this.movable;\n movable.scaleWith(1.1);\n this.dimensions.rescale(movable.scale);\n },\n\n onEnd: function() {\n var movable = this.movable;\n movable.scaleTo(this.dimensions.minScale);\n this.dimensions.rescale(movable.scale);\n }\n });\n\n var DragInertia = Animation.extend({\n init: function(options) {\n var that = this;\n\n Animation.fn.init.call(that);\n\n extend(that, options, {\n transition: new Transition({\n axis: options.axis,\n movable: options.movable,\n onEnd: function() { that._end(); }\n })\n });\n\n that.tapCapture.bind(\"press\", function() { that.cancel(); });\n that.userEvents.bind(\"end\", that.start.bind(that));\n that.userEvents.bind(\"gestureend\", that.start.bind(that));\n that.userEvents.bind(\"tap\", that.onEnd.bind(that));\n },\n\n onCancel: function() {\n this.transition.cancel();\n },\n\n freeze: function(location) {\n var that = this;\n that.cancel();\n that._moveTo(location);\n },\n\n onEnd: function() {\n var that = this;\n if (that.paneAxis.outOfBounds()) {\n that._snapBack();\n } else {\n that._end();\n }\n },\n\n done: function() {\n return abs(this.velocity) < 1;\n },\n\n start: function(e) {\n var that = this,\n velocity;\n\n if (!that.dimension.enabled) { return; }\n\n if (that.paneAxis.outOfBounds()) {\n if (that.transition._started) {\n that.transition.cancel();\n that.velocity = Math.min(e.touch[that.axis].velocity * that.velocityMultiplier, MAX_VELOCITY);\n\n Animation.fn.start.call(that);\n } else {\n that._snapBack();\n }\n } else {\n velocity = e.touch.id === MOUSE_WHEEL_ID ? 0 : e.touch[that.axis].velocity;\n that.velocity = Math.max(Math.min(velocity * that.velocityMultiplier, MAX_VELOCITY), -MAX_VELOCITY);\n\n that.tapCapture.captureNext();\n Animation.fn.start.call(that);\n }\n },\n\n tick: function() {\n var that = this,\n dimension = that.dimension,\n friction = that.paneAxis.outOfBounds() ? OUT_OF_BOUNDS_FRICTION : that.friction,\n delta = (that.velocity *= friction),\n location = that.movable[that.axis] + delta;\n\n if (!that.elastic && dimension.outOfBounds(location)) {\n location = Math.max(Math.min(location, dimension.max), dimension.min);\n that.velocity = 0;\n }\n\n that.movable.moveAxis(that.axis, location);\n },\n\n _end: function() {\n this.tapCapture.cancelCapture();\n this.end();\n },\n\n _snapBack: function() {\n var that = this,\n dimension = that.dimension,\n snapBack = that.movable[that.axis] > dimension.max ? dimension.max : dimension.min;\n that._moveTo(snapBack);\n },\n\n _moveTo: function(location) {\n this.transition.moveTo({ location: location, duration: SNAPBACK_DURATION, ease: Transition.easeOutExpo });\n }\n });\n\n var AnimatedScroller = Animation.extend({\n init: function(options) {\n var that = this;\n\n kendo.effects.Animation.fn.init.call(this);\n\n extend(that, options, {\n origin: {},\n destination: {},\n offset: {}\n });\n },\n\n tick: function() {\n this._updateCoordinates();\n this.moveTo(this.origin);\n },\n\n done: function() {\n return abs(this.offset.y) < ANIMATED_SCROLLER_PRECISION && abs(this.offset.x) < ANIMATED_SCROLLER_PRECISION;\n },\n\n onEnd: function() {\n this.moveTo(this.destination);\n if (this.callback) {\n this.callback.call();\n }\n },\n\n setCoordinates: function(from, to) {\n this.offset = {};\n this.origin = from;\n this.destination = to;\n },\n\n setCallback: function(callback) {\n if (callback && kendo.isFunction(callback)) {\n this.callback = callback;\n } else {\n callback = undefined;\n }\n },\n\n _updateCoordinates: function() {\n this.offset = {\n x: (this.destination.x - this.origin.x) / 4,\n y: (this.destination.y - this.origin.y) / 4\n };\n\n this.origin = {\n y: this.origin.y + this.offset.y,\n x: this.origin.x + this.offset.x\n };\n }\n });\n\n var ScrollBar = Class.extend({\n init: function(options) {\n var that = this,\n horizontal = options.axis === \"x\",\n element = $('
    ');\n\n if (horizontal) {\n element.attr(\"aria-orientation\", \"horizontal\");\n }\n\n extend(that, options, {\n element: element,\n elementSize: 0,\n movable: new Movable(element),\n scrollMovable: options.movable,\n alwaysVisible: options.alwaysVisible,\n size: horizontal ? \"width\" : \"height\"\n });\n\n that.scrollMovable.bind(CHANGE, that.refresh.bind(that));\n that.container.append(element);\n if (options.alwaysVisible) {\n that.show();\n }\n },\n\n refresh: function() {\n var that = this,\n axis = that.axis,\n dimension = that.dimension,\n paneSize = dimension.size,\n scrollMovable = that.scrollMovable,\n sizeRatio = paneSize / dimension.total,\n position = Math.round(-scrollMovable[axis] * sizeRatio),\n size = Math.round(paneSize * sizeRatio);\n\n if (sizeRatio >= 1) {\n this.element.css(\"display\", \"none\");\n } else {\n this.element.css(\"display\", \"\");\n }\n\n if (position + size > paneSize) {\n size = paneSize - position;\n } else if (position < 0) {\n size += position;\n position = 0;\n }\n\n if (that.elementSize != size) {\n that.element.css(that.size, size + \"px\");\n that.elementSize = size;\n }\n\n that._ariaValue(position, dimension.size - that.elementSize);\n\n that.movable.moveAxis(axis, position);\n },\n\n show: function() {\n this.element.css({ opacity: SCROLLBAR_OPACITY, visibility: \"visible\" });\n },\n\n hide: function() {\n if (!this.alwaysVisible) {\n this.element.css({ opacity: 0 });\n }\n },\n\n _ariaValue: function(current, total) {\n var element = this.element;\n\n if (current > total) {\n current = total;\n }\n\n element.attr(\"aria-valuemax\", total);\n element.attr(\"aria-valuenow\", current);\n }\n });\n\n var Scroller = Widget.extend({\n init: function(element, options) {\n var that = this;\n Widget.fn.init.call(that, element, options);\n\n element = that.element;\n\n that._native = that.options.useNative && kendo.support.hasNativeScrolling;\n if (that._native) {\n element.addClass(\"km-native-scroller\")\n .prepend('
    ');\n\n extend(that, {\n scrollElement: element,\n fixedContainer: element.children().first()\n });\n\n return;\n }\n\n element\n .css(\"overflow\", \"hidden\")\n .addClass(\"km-scroll-wrapper\")\n .wrapInner('
    ')\n .prepend('
    ');\n\n var inner = element.children().eq(1),\n\n tapCapture = new kendo.TapCapture(element),\n\n movable = new Movable(inner),\n\n dimensions = new PaneDimensions({\n element: inner,\n container: element,\n forcedEnabled: that.options.zoom\n }),\n\n avoidScrolling = this.options.avoidScrolling,\n\n userEvents = new kendo.UserEvents(element, {\n touchAction: \"pan-y\",\n fastTap: true,\n allowSelection: true,\n preventDragEvent: true,\n captureUpIfMoved: true,\n multiTouch: that.options.zoom,\n supportDoubleTap: that.options.supportDoubleTap,\n start: function(e) {\n dimensions.refresh();\n\n var velocityX = abs(e.x.velocity),\n velocityY = abs(e.y.velocity),\n horizontalSwipe = velocityX * 2 >= velocityY,\n originatedFromFixedContainer = $.contains(that.fixedContainer[0], e.event.target),\n verticalSwipe = velocityY * 2 >= velocityX;\n\n\n if (!originatedFromFixedContainer && !avoidScrolling(e) && that.enabled && (dimensions.x.enabled && horizontalSwipe || dimensions.y.enabled && verticalSwipe)) {\n userEvents.capture();\n } else {\n userEvents.cancel();\n }\n }\n }),\n\n pane = new Pane({\n movable: movable,\n dimensions: dimensions,\n userEvents: userEvents,\n elastic: that.options.elastic\n }),\n\n zoomSnapBack = new ZoomSnapBack({\n movable: movable,\n dimensions: dimensions,\n userEvents: userEvents,\n tapCapture: tapCapture\n }),\n\n animatedScroller = new AnimatedScroller({\n moveTo: function(coordinates) {\n that.scrollTo(coordinates.x, coordinates.y);\n }\n });\n\n movable.bind(CHANGE, function() {\n that.scrollTop = - movable.y;\n that.scrollLeft = - movable.x;\n\n that.trigger(SCROLL, {\n scrollTop: that.scrollTop,\n scrollLeft: that.scrollLeft\n });\n });\n\n if (that.options.mousewheelScrolling) {\n element.on(\"DOMMouseScroll mousewheel\", this._wheelScroll.bind(this));\n }\n\n extend(that, {\n movable: movable,\n dimensions: dimensions,\n zoomSnapBack: zoomSnapBack,\n animatedScroller: animatedScroller,\n userEvents: userEvents,\n pane: pane,\n tapCapture: tapCapture,\n pulled: false,\n enabled: true,\n scrollElement: inner,\n scrollTop: 0,\n scrollLeft: 0,\n fixedContainer: element.children().first()\n });\n\n that._initAxis(\"x\");\n that._initAxis(\"y\");\n\n // build closure\n that._wheelEnd = function() {\n that._wheel = false;\n that.userEvents.end(0, that._wheelY);\n };\n\n dimensions.refresh();\n\n if (that.options.pullToRefresh) {\n that._initPullToRefresh();\n }\n },\n\n _wheelScroll: function(e) {\n if (e.ctrlKey) {\n return;\n }\n\n if (!this._wheel) {\n this._wheel = true;\n this._wheelY = 0;\n this.userEvents.press(0, this._wheelY);\n }\n\n clearTimeout(this._wheelTimeout);\n this._wheelTimeout = setTimeout(this._wheelEnd, 50);\n\n var delta = kendo.wheelDeltaY(e);\n\n if (delta) {\n this._wheelY += delta;\n this.userEvents.move(0, this._wheelY);\n }\n\n e.preventDefault();\n },\n\n makeVirtual: function() {\n this.dimensions.y.makeVirtual();\n },\n\n virtualSize: function(min, max) {\n this.dimensions.y.virtualSize(min, max);\n },\n\n height: function() {\n return this.dimensions.y.size;\n },\n\n scrollHeight: function() {\n return this.scrollElement[0].scrollHeight;\n },\n\n scrollWidth: function() {\n return this.scrollElement[0].scrollWidth;\n },\n\n options: {\n name: \"Scroller\",\n zoom: false,\n pullOffset: 140,\n visibleScrollHints: false,\n elastic: true,\n useNative: false,\n mousewheelScrolling: true,\n avoidScrolling: function() { return false; },\n pullToRefresh: false,\n messages: {\n pullTemplate: \"Pull to refresh\",\n releaseTemplate: \"Release to refresh\",\n refreshTemplate: \"Refreshing\"\n }\n },\n\n events: [\n PULL,\n SCROLL,\n RESIZE\n ],\n\n _resize: function() {\n if (!this._native) {\n this.contentResized();\n }\n },\n\n setOptions: function(options) {\n var that = this;\n Widget.fn.setOptions.call(that, options);\n if (options.pullToRefresh) {\n that._initPullToRefresh();\n }\n },\n\n reset: function() {\n if (this._native) {\n this.scrollElement.scrollTop(0);\n } else {\n this.movable.moveTo({ x: 0, y: 0 });\n this._scale(1);\n }\n },\n\n contentResized: function() {\n this.dimensions.refresh();\n if (this.pane.x.outOfBounds()) {\n this.movable.moveAxis(\"x\", this.dimensions.x.min);\n }\n\n if (this.pane.y.outOfBounds()) {\n this.movable.moveAxis(\"y\", this.dimensions.y.min);\n }\n },\n\n zoomOut: function() {\n var dimensions = this.dimensions;\n dimensions.refresh();\n this._scale(dimensions.fitScale);\n this.movable.moveTo(dimensions.centerCoordinates());\n },\n\n enable: function() {\n this.enabled = true;\n },\n\n disable: function() {\n this.enabled = false;\n },\n\n scrollTo: function(x, y) {\n if (this._native) {\n kendo.scrollLeft(this.scrollElement, abs(x));\n this.scrollElement.scrollTop(abs(y));\n } else {\n this.dimensions.refresh();\n this.movable.moveTo({ x: x, y: y });\n }\n },\n\n animatedScrollTo: function(x, y, callback) {\n var from,\n to;\n\n if (this._native) {\n this.scrollTo(x, y);\n } else {\n from = { x: this.movable.x, y: this.movable.y };\n to = { x: x, y: y };\n\n this.animatedScroller.setCoordinates(from, to);\n this.animatedScroller.setCallback(callback);\n this.animatedScroller.start();\n }\n },\n\n pullHandled: function() {\n var that = this;\n that.refreshHint.removeClass(REFRESHCLASS);\n that.hintContainer.html(that.pullTemplate({}));\n that.yinertia.onEnd();\n that.xinertia.onEnd();\n that.userEvents.cancel();\n },\n\n destroy: function() {\n Widget.fn.destroy.call(this);\n if (this.userEvents) {\n this.userEvents.destroy();\n }\n },\n\n _scale: function(scale) {\n this.dimensions.rescale(scale);\n this.movable.scaleTo(scale);\n },\n\n _initPullToRefresh: function() {\n var that = this;\n\n that.dimensions.y.forceEnabled();\n that.pullTemplate = kendo.template(that.options.messages.pullTemplate);\n that.releaseTemplate = kendo.template(that.options.messages.releaseTemplate);\n that.refreshTemplate = kendo.template(that.options.messages.refreshTemplate);\n\n that.scrollElement.prepend('' + that.pullTemplate({}) + '');\n that.refreshHint = that.scrollElement.children().first();\n that.hintContainer = that.refreshHint.children(\".km-template\");\n\n that.pane.y.bind(\"change\", that._paneChange.bind(that));\n that.userEvents.bind(\"end\", that._dragEnd.bind(that));\n },\n\n _dragEnd: function() {\n var that = this;\n\n if (!that.pulled) {\n return;\n }\n\n that.pulled = false;\n that.refreshHint.removeClass(RELEASECLASS).addClass(REFRESHCLASS);\n that.hintContainer.html(that.refreshTemplate({}));\n that.yinertia.freeze(that.options.pullOffset / 2);\n that.trigger(\"pull\");\n },\n\n _paneChange: function() {\n var that = this;\n\n if (that.movable.y / OUT_OF_BOUNDS_FRICTION > that.options.pullOffset) {\n if (!that.pulled) {\n that.pulled = true;\n that.refreshHint.removeClass(REFRESHCLASS).addClass(RELEASECLASS);\n that.hintContainer.html(that.releaseTemplate({}));\n }\n } else if (that.pulled) {\n that.pulled = false;\n that.refreshHint.removeClass(RELEASECLASS);\n that.hintContainer.html(that.pullTemplate({}));\n }\n },\n\n _initAxis: function(axis) {\n var that = this,\n elementId = that.element.attr(\"id\"),\n movable = that.movable,\n dimension = that.dimensions[axis],\n tapCapture = that.tapCapture,\n paneAxis = that.pane[axis],\n scrollBar;\n\n if (!elementId) {\n elementId = kendo.guid();\n that.element.attr(\"id\", elementId);\n }\n\n scrollBar = new ScrollBar({\n axis: axis,\n movable: movable,\n dimension: dimension,\n container: that.element,\n alwaysVisible: that.options.visibleScrollHints,\n controlsId: elementId\n });\n\n dimension.bind(CHANGE, function() {\n scrollBar.refresh();\n });\n\n paneAxis.bind(CHANGE, function() {\n scrollBar.show();\n });\n\n that[axis + \"inertia\"] = new DragInertia({\n axis: axis,\n paneAxis: paneAxis,\n movable: movable,\n tapCapture: tapCapture,\n userEvents: that.userEvents,\n dimension: dimension,\n elastic: that.options.elastic,\n friction: that.options.friction || FRICTION,\n velocityMultiplier: that.options.velocityMultiplier || VELOCITY_MULTIPLIER,\n end: function() {\n scrollBar.hide();\n that.trigger(\"scrollEnd\", {\n axis: axis,\n scrollTop: that.scrollTop,\n scrollLeft: that.scrollLeft\n });\n }\n });\n }\n });\n\n ui.plugin(Scroller);\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.resizable',[ \"kendo.core\", \"kendo.draganddrop\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"resizable\",\n name: \"Resizable\",\n category: \"framework\",\n depends: [ \"core\", \"draganddrop\" ],\n advanced: true\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n ui = kendo.ui,\n Widget = ui.Widget,\n isFunction = kendo.isFunction,\n extend = $.extend,\n HORIZONTAL = \"horizontal\",\n VERTICAL = \"vertical\",\n START = \"start\",\n RESIZE = \"resize\",\n RESIZEEND = \"resizeend\";\n\n var Resizable = Widget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n\n that.orientation = that.options.orientation.toLowerCase() != VERTICAL ? HORIZONTAL : VERTICAL;\n that._positionMouse = that.orientation == HORIZONTAL ? \"x\" : \"y\";\n that._position = that.orientation == HORIZONTAL ? \"left\" : \"top\";\n that._sizingDom = that.orientation == HORIZONTAL ? \"outerWidth\" : \"outerHeight\";\n\n that.draggable = new ui.Draggable(options.draggableElement || element, {\n distance: 1,\n filter: options.handle,\n drag: that._resize.bind(that),\n dragcancel: that._cancel.bind(that),\n dragstart: that._start.bind(that),\n dragend: that._stop.bind(that)\n });\n\n that.userEvents = that.draggable.userEvents;\n },\n\n events: [\n RESIZE,\n RESIZEEND,\n START\n ],\n\n options: {\n name: \"Resizable\",\n orientation: HORIZONTAL\n },\n\n resize: function() {\n // Overrides base widget resize\n },\n\n _max: function(e) {\n var that = this,\n hintSize = that.hint ? that.hint[that._sizingDom]() : 0,\n size = that.options.max;\n\n return isFunction(size) ? size(e) : size !== undefined ? (that._initialElementPosition + size) - hintSize : size;\n },\n\n _min: function(e) {\n var that = this,\n size = that.options.min;\n\n return isFunction(size) ? size(e) : size !== undefined ? that._initialElementPosition + size : size;\n },\n\n _start: function(e) {\n var that = this,\n hint = that.options.hint,\n el = $(e.currentTarget);\n\n that._initialElementPosition = el.position()[that._position];\n that._initialMousePosition = e[that._positionMouse].startLocation;\n\n if (hint) {\n that.hint = isFunction(hint) ? $(hint(el)) : hint;\n\n that.hint.css({\n position: \"absolute\"\n })\n .css(that._position, that._initialElementPosition)\n .appendTo(that.element);\n }\n\n that.trigger(START, e);\n\n that._maxPosition = that._max(e);\n that._minPosition = that._min(e);\n\n $(document.body).css(\"cursor\", el.css(\"cursor\"));\n },\n\n _resize: function(e) {\n var that = this,\n maxPosition = that._maxPosition,\n minPosition = that._minPosition,\n currentPosition = that._initialElementPosition + (e[that._positionMouse].location - that._initialMousePosition),\n position;\n\n position = minPosition !== undefined ? Math.max(minPosition, currentPosition) : currentPosition;\n that.position = position = maxPosition !== undefined ? Math.min(maxPosition, position) : position;\n\n if (that.hint) {\n that.hint.toggleClass(that.options.invalidClass || \"\", position == maxPosition || position == minPosition)\n .css(that._position, position);\n }\n\n that.resizing = true;\n that.trigger(RESIZE, extend(e, { position: position }));\n },\n\n _stop: function(e) {\n var that = this;\n\n if (that.hint) {\n that.hint.remove();\n }\n\n that.resizing = false;\n that.trigger(RESIZEEND, extend(e, { position: that.position }));\n $(document.body).css(\"cursor\", \"\");\n },\n\n _cancel: function(e) {\n var that = this;\n\n if (that.hint) {\n that.position = undefined;\n that.hint.css(that._position, that._initialElementPosition);\n that._stop(e);\n }\n },\n\n destroy: function() {\n var that = this;\n\n Widget.fn.destroy.call(that);\n\n if (that.draggable) {\n that.draggable.destroy();\n }\n },\n\n press: function(target) {\n if (!target) {\n return;\n }\n\n var position = target.position(),\n that = this;\n\n that.userEvents.press(position.left, position.top, target[0]);\n that.targetPosition = position;\n that.target = target;\n },\n\n move: function(delta) {\n var that = this,\n orientation = that._position,\n position = that.targetPosition,\n current = that.position;\n\n if (current === undefined) {\n current = position[orientation];\n }\n\n position[orientation] = current + delta;\n\n that.userEvents.move(position.left, position.top);\n },\n\n end: function() {\n this.userEvents.end();\n this.target = this.position = undefined;\n }\n });\n\n kendo.ui.plugin(Resizable);\n\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n\n(function(f, define) {\n define('kendo.sortable',[ \"kendo.draganddrop\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"sortable\",\n name: \"Sortable\",\n category: \"framework\",\n depends: [ \"draganddrop\" ]\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n Widget = kendo.ui.Widget,\n outerWidth = kendo._outerWidth,\n outerHeight = kendo._outerHeight,\n\n START = \"start\",\n BEFORE_MOVE = \"beforeMove\",\n MOVE = \"move\",\n END = \"end\",\n CHANGE = \"change\",\n CANCEL = \"cancel\",\n\n ACTION_SORT = \"sort\",\n ACTION_REMOVE = \"remove\",\n ACTION_RECEIVE = \"receive\",\n\n DEFAULT_FILTER = \">*\",\n MISSING_INDEX = -1;\n\n function containsOrEqualTo(parent, child) {\n try {\n return $.contains(parent, child) || parent == child;\n } catch (e) {\n return false;\n }\n }\n\n function defaultHint(element) {\n return element.clone();\n }\n\n function defaultPlaceholder(element) {\n return element.clone().removeAttr(\"id\").css(\"visibility\", \"hidden\");\n }\n\n var Sortable = Widget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n\n if (!that.options.placeholder) {\n that.options.placeholder = defaultPlaceholder;\n }\n\n if (!that.options.hint) {\n that.options.hint = defaultHint;\n }\n\n that.draggable = that._createDraggable();\n },\n\n events: [\n START,\n BEFORE_MOVE,\n MOVE,\n END,\n CHANGE,\n CANCEL\n ],\n\n options: {\n name: \"Sortable\",\n hint: null,\n placeholder: null,\n filter: DEFAULT_FILTER,\n holdToDrag: false,\n disabled: null,\n container: null,\n connectWith: null,\n handler: null,\n cursorOffset: null,\n axis: null,\n ignore: null,\n autoScroll: false,\n cursor: \"auto\",\n moveOnDragEnter: false\n },\n\n destroy: function() {\n this.draggable.destroy();\n Widget.fn.destroy.call(this);\n },\n\n _createDraggable: function() {\n var that = this,\n element = that.element,\n options = that.options;\n\n return new kendo.ui.Draggable(element, {\n filter: options.filter,\n hint: kendo.isFunction(options.hint) ? options.hint : $(options.hint),\n holdToDrag: options.holdToDrag,\n container: options.container ? $(options.container) : null,\n cursorOffset: options.cursorOffset,\n axis: options.axis,\n ignore: options.ignore,\n autoScroll: options.autoScroll,\n dragstart: that._dragstart.bind(that),\n dragcancel: that._dragcancel.bind(that),\n drag: that._drag.bind(that),\n dragend: that._dragend.bind(that)\n });\n },\n\n _dragstart: function(e) {\n var draggedElement = this.draggedElement = e.currentTarget,\n disabled = this.options.disabled,\n handler = this.options.handler,\n _placeholder = this.options.placeholder,\n placeholder = this.placeholder = kendo.isFunction(_placeholder) ? $(_placeholder.call(this, draggedElement)) : $(_placeholder);\n\n if (disabled && draggedElement.is(disabled)) {\n e.preventDefault();\n } else if (handler && !$(e.initialTarget).is(handler)) {\n e.preventDefault();\n } else {\n\n if (this.trigger(START, { item: draggedElement, draggableEvent: e })) {\n e.preventDefault();\n } else {\n draggedElement.css(\"display\", \"none\");\n draggedElement.before(placeholder);\n\n this._setCursor();\n }\n\n }\n },\n\n _dragcancel: function() {\n this._cancel();\n this.trigger(CANCEL, { item: this.draggedElement });\n\n this._resetCursor();\n },\n\n _drag: function(e) {\n var draggedElement = this.draggedElement,\n target = this._findTarget(e),\n targetCenter,\n cursorOffset = { left: e.x.location, top: e.y.location },\n offsetDelta,\n axisDelta = { x: e.x.delta, y: e.y.delta },\n direction,\n sibling,\n getSibling,\n axis = this.options.axis,\n moveOnDragEnter = this.options.moveOnDragEnter,\n eventData = { item: draggedElement, list: this, draggableEvent: e };\n\n if (axis === \"x\" || axis === \"y\") {\n this._movementByAxis(axis, cursorOffset, axisDelta[axis], eventData);\n return;\n }\n\n if (target) {\n targetCenter = this._getElementCenter(target.element);\n\n offsetDelta = {\n left: Math.round(cursorOffset.left - targetCenter.left),\n top: Math.round(cursorOffset.top - targetCenter.top)\n };\n\n $.extend(eventData, { target: target.element });\n\n if (target.appendToBottom) {\n this._movePlaceholder(target, null, eventData);\n return;\n }\n\n if (target.appendAfterHidden) {\n this._movePlaceholder(target, \"next\", eventData);\n }\n\n if (this._isFloating(target.element)) { //horizontal\n if ((axisDelta.x < 0 && moveOnDragEnter) || (!moveOnDragEnter && offsetDelta.left < 0)) {\n direction = \"prev\";\n } else if ((axisDelta.x > 0 && moveOnDragEnter) || (!moveOnDragEnter && offsetDelta.left > 0)) {\n direction = \"next\";\n }\n } else { //vertical\n if ((axisDelta.y < 0 && moveOnDragEnter) || (!moveOnDragEnter && offsetDelta.top < 0)) {\n direction = \"prev\";\n } else if ((axisDelta.y > 0 && moveOnDragEnter) || (!moveOnDragEnter && offsetDelta.top > 0)) {\n direction = \"next\";\n }\n }\n\n if (direction) {\n getSibling = (direction === \"prev\") ? jQuery.fn.prev : jQuery.fn.next;\n\n sibling = getSibling.call(target.element);\n\n //find the prev/next visible sibling\n while (sibling.length && !sibling.is(\":visible\")) {\n sibling = getSibling.call(sibling);\n }\n\n if (sibling[0] != this.placeholder[0]) {\n this._movePlaceholder(target, direction, eventData);\n }\n }\n }\n },\n\n _dragend: function(e) {\n var placeholder = this.placeholder,\n draggedElement = this.draggedElement,\n draggedIndex = this.indexOf(draggedElement),\n placeholderIndex = this.indexOf(placeholder),\n connectWith = this.options.connectWith,\n connectedList,\n isDefaultPrevented,\n eventData,\n connectedListEventData;\n\n this._resetCursor();\n\n eventData = {\n action: ACTION_SORT,\n item: draggedElement,\n oldIndex: draggedIndex,\n newIndex: placeholderIndex,\n draggableEvent: e\n };\n\n if (placeholderIndex >= 0) {\n isDefaultPrevented = this.trigger(END, eventData);\n } else {\n connectedList = placeholder.parents(connectWith).getKendoSortable();\n\n eventData.action = ACTION_REMOVE;\n connectedListEventData = $.extend({}, eventData, {\n action: ACTION_RECEIVE,\n oldIndex: MISSING_INDEX,\n newIndex: connectedList.indexOf(placeholder)\n });\n\n isDefaultPrevented = !(!this.trigger(END, eventData) && !connectedList.trigger(END, connectedListEventData));\n }\n\n if (isDefaultPrevented || placeholderIndex === draggedIndex) {\n this._cancel();\n return;\n }\n\n placeholder.replaceWith(draggedElement);\n\n draggedElement.show();\n this.draggable.dropped = true;\n\n eventData = {\n action: this.indexOf(draggedElement) != MISSING_INDEX ? ACTION_SORT : ACTION_REMOVE,\n item: draggedElement,\n oldIndex: draggedIndex,\n newIndex: this.indexOf(draggedElement),\n draggableEvent: e\n };\n\n this.trigger(CHANGE, eventData);\n\n if (connectedList) {\n connectedListEventData = $.extend({}, eventData, {\n action: ACTION_RECEIVE,\n oldIndex: MISSING_INDEX,\n newIndex: connectedList.indexOf(draggedElement)\n });\n\n connectedList.trigger(CHANGE, connectedListEventData);\n }\n\n },\n\n _findTarget: function(e) {\n var element = this._findElementUnderCursor(e),\n items,\n connectWith = this.options.connectWith,\n node;\n\n if ($.contains(this.element[0], element)) { //the element is part of the sortable container\n items = this.items();\n node = items.filter(element)[0] || items.has(element)[0];\n\n return node ? { element: $(node), sortable: this } : null;\n } else if (this.element[0] == element && this._isEmpty()) {\n return { element: this.element, sortable: this, appendToBottom: true };\n } else if (this.element[0] == element && this._isLastHidden()) {\n node = this.items().eq(0);\n return { element: node , sortable: this, appendAfterHidden: true };\n } else if (connectWith) { //connected lists are present\n return this._searchConnectedTargets(element, e);\n }\n },\n\n _findElementUnderCursor: function(e) {\n var elementUnderCursor = kendo.elementUnderCursor(e),\n draggable = e.sender;\n\n if (containsOrEqualTo(draggable.hint[0], elementUnderCursor)) {\n draggable.hint.hide();\n elementUnderCursor = kendo.elementUnderCursor(e);\n // IE8 does not return the element in iframe from first attempt\n if (!elementUnderCursor) {\n elementUnderCursor = kendo.elementUnderCursor(e);\n }\n draggable.hint.show();\n }\n\n return elementUnderCursor;\n },\n\n _searchConnectedTargets: function(element, e) {\n var connected = $(this.options.connectWith),\n sortableInstance,\n items,\n node;\n\n for (var i = 0; i < connected.length; i++) {\n sortableInstance = connected.eq(i).getKendoSortable();\n\n if ($.contains(connected[i], element)) {\n if (sortableInstance) {\n items = sortableInstance.items();\n node = items.filter(element)[0] || items.has(element)[0];\n\n if (node) {\n sortableInstance.placeholder = this.placeholder;\n return { element: $(node), sortable: sortableInstance };\n } else {\n return null;\n }\n }\n } else if (connected[i] == element) {\n if (sortableInstance && sortableInstance._isEmpty()) {\n return { element: connected.eq(i), sortable: sortableInstance, appendToBottom: true };\n } else if (this._isCursorAfterLast(sortableInstance, e)) {\n node = sortableInstance.items().last();\n return { element: node, sortable: sortableInstance };\n }\n }\n }\n\n },\n\n _isCursorAfterLast: function(sortable, e) {\n var lastItem = sortable.items().last(),\n cursorOffset = { left: e.x.location, top: e.y.location },\n lastItemOffset,\n delta;\n\n lastItemOffset = kendo.getOffset(lastItem);\n lastItemOffset.top += outerHeight(lastItem);\n lastItemOffset.left += outerWidth(lastItem);\n\n if (this._isFloating(lastItem)) { //horizontal\n delta = lastItemOffset.left - cursorOffset.left;\n } else { //vertical\n delta = lastItemOffset.top - cursorOffset.top;\n }\n\n return delta < 0 ? true : false;\n },\n\n _movementByAxis: function(axis, cursorOffset, delta, eventData) {\n var cursorPosition = (axis === \"x\") ? cursorOffset.left : cursorOffset.top,\n target = (delta < 0) ? this.placeholder.prev() : this.placeholder.next(),\n items = this.items(),\n targetCenter;\n\n if (target.length && !target.is(\":visible\")) {\n target = (delta < 0) ? target.prev() : target.next();\n }\n\n if (!items.filter(target).length) {\n return;\n }\n\n $.extend(eventData, { target: target });\n targetCenter = this._getElementCenter(target);\n\n if (targetCenter) {\n targetCenter = (axis === \"x\") ? targetCenter.left : targetCenter.top;\n }\n\n if (target.length && delta < 0 && cursorPosition - targetCenter < 0) { //prev\n this._movePlaceholder({ element: target, sortable: this }, \"prev\", eventData);\n } else if (target.length && delta > 0 && cursorPosition - targetCenter > 0) { //next\n this._movePlaceholder({ element: target, sortable: this }, \"next\", eventData);\n }\n },\n\n _movePlaceholder: function(target, direction, eventData) {\n var placeholder = this.placeholder;\n\n if (!target.sortable.trigger(BEFORE_MOVE, eventData)) {\n\n if (!direction) {\n target.element.append(placeholder);\n } else if (direction === \"prev\") {\n target.element.before(placeholder);\n } else if (direction === \"next\") {\n target.element.after(placeholder);\n }\n\n target.sortable.trigger(MOVE, eventData);\n }\n },\n\n _setCursor: function() {\n var cursor = this.options.cursor,\n body;\n\n if (cursor && cursor !== \"auto\") {\n body = $(document.body);\n\n this._originalCursorType = body.css(\"cursor\");\n body.css({ \"cursor\": cursor });\n\n if (!this._cursorStylesheet) {\n this._cursorStylesheet = $(\"\");\n }\n\n this._cursorStylesheet.appendTo(body);\n }\n },\n\n _resetCursor: function() {\n if (this._originalCursorType) {\n $(document.body).css(\"cursor\", this._originalCursorType);\n this._originalCursorType = null;\n\n this._cursorStylesheet.remove();\n }\n },\n\n _getElementCenter: function(element) {\n var center = element.length ? kendo.getOffset(element) : null;\n if (center) {\n center.top += outerHeight(element) / 2;\n center.left += outerWidth(element) / 2;\n }\n\n return center;\n },\n\n _isFloating: function(item) {\n var isFloating = /left|right/.test(item.css('float'));\n var isTable = /inline|table-cell/.test(item.css('display'));\n var isHorizontalFlex = /flex/.test(item.parent().css('display')) && (/row|row-reverse/.test(item.parent().css('flex-direction')) || !item.parent().css('flex-direction'));\n return isFloating || isTable || isHorizontalFlex;\n },\n\n _cancel: function() {\n this.draggedElement.show();\n this.placeholder.remove();\n this.draggable.dropped = true;\n },\n\n _items: function() {\n var filter = this.options.filter,\n items;\n\n if (filter) {\n items = this.element.find(filter);\n } else {\n items = this.element.children();\n }\n\n return items;\n },\n\n indexOf: function(element) {\n var items = this._items(),\n placeholder = this.placeholder,\n draggedElement = this.draggedElement;\n\n if (placeholder && element[0] == placeholder[0]) {\n return items.not(draggedElement).index(element);\n } else {\n return items.not(placeholder).index(element);\n }\n },\n\n items: function() {\n var placeholder = this.placeholder,\n items = this._items();\n\n if (placeholder) {\n items = items.not(placeholder);\n }\n\n return items;\n },\n\n _isEmpty: function() {\n return !this.items().length;\n },\n\n _isLastHidden: function() {\n return this.items().length === 1 && this.items().is(\":hidden\");\n }\n\n });\n\n kendo.ui.plugin(Sortable);\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.selectable',[ \"kendo.core\", \"kendo.userevents\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"selectable\",\n name: \"Selectable\",\n category: \"framework\",\n depends: [ \"core\", \"userevents\" ],\n advanced: true\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n Widget = kendo.ui.Widget,\n abs = Math.abs,\n ARIASELECTED = \"aria-selected\",\n SELECTED = \"k-selected\",\n ACTIVE = \"k-selecting\",\n SELECTABLE = \"k-selectable\",\n CHANGE = \"change\",\n NS = \".kendoSelectable\",\n UNSELECT = \"unselect\",\n UNSELECTING = \"k-unselecting\",\n INPUTSELECTOR = \"input,a,textarea,.k-multiselect-wrap,select,button,.k-button>span,.k-button>img,span.k-icon.k-i-arrow-60-down,span.k-icon.k-i-arrow-60-up,label.k-checkbox-label.k-no-text,.k-icon.k-i-collapse,.k-icon.k-i-expand,span.k-numeric-wrap,.k-focusable\",\n msie = kendo.support.browser.msie,\n supportEventDelegation = false,\n extend = $.extend;\n\n (function($) {\n (function() {\n $('
    ')\n .on(\"click\", \">*\", function() {\n supportEventDelegation = true;\n })\n .find(\"span\")\n .trigger(\"click\")\n .end()\n .off();\n })();\n })($);\n\n var Selectable = Widget.extend({\n init: function(element, options) {\n var that = this,\n multiple,\n dragToSelect;\n\n Widget.fn.init.call(that, element, options);\n\n that._marquee = $(\"
    \");\n that._lastActive = null;\n that.element.addClass(SELECTABLE);\n\n that.relatedTarget = that.options.relatedTarget;\n\n multiple = that.options.multiple;\n dragToSelect = that.options.dragToSelect;\n\n that.userEvents = new kendo.UserEvents(that.element, {\n global: true,\n allowSelection: true,\n filter: (!supportEventDelegation ? \".\" + SELECTABLE + \" \" : \"\") + that.options.filter,\n tap: that._tap.bind(that),\n touchAction: multiple ? \"none\" : \"pan-x pan-y\"\n });\n\n if (multiple) {\n if (dragToSelect) {\n that.userEvents\n .bind(\"start\", that._start.bind(that))\n .bind(\"move\", that._move.bind(that))\n .bind(\"end\", that._end.bind(that));\n }\n that.userEvents\n .bind(\"select\", that._select.bind(that));\n }\n },\n\n events: [CHANGE, UNSELECT],\n\n options: {\n name: \"Selectable\",\n filter: \">*\",\n inputSelectors: INPUTSELECTOR,\n multiple: false,\n dragToSelect: true,\n relatedTarget: $.noop,\n ignoreOverlapped: false,\n addIdToRanges: false\n },\n\n _isElement: function(target) {\n var elements = this.element;\n var idx, length = elements.length, result = false;\n\n target = target[0];\n\n for (idx = 0; idx < length; idx ++) {\n if (elements[idx] === target) {\n result = true;\n break;\n }\n }\n\n return result;\n },\n\n _tap: function(e) {\n var target = $(e.target),\n that = this,\n ctrlKey = e.event.ctrlKey || e.event.metaKey,\n multiple = that.options.multiple,\n shiftKey = multiple && e.event.shiftKey,\n selectedClass = that.options.selectedClass || SELECTED,\n selected,\n whichCode = e.event.which,\n buttonCode = e.event.button;\n\n //in case of hierarchy or right-click\n if (!that._isElement(target.closest(\".\" + SELECTABLE)) || whichCode && whichCode == 3 || buttonCode && buttonCode == 2) {\n return;\n }\n\n if (!this._allowSelection(e.event.target)) {\n return;\n }\n\n selected = target.hasClass(selectedClass);\n\n target = target.add(that.relatedTarget(target));\n\n if (!multiple) {\n if (selected && ctrlKey) {\n that._unselect(target);\n that._notify(CHANGE, e);\n } else if (!selected) {\n that.clear();\n that.value(target, e);\n that._notify(CHANGE, e);\n }\n } else {\n if (shiftKey) {\n if (!that._lastRange || !compareElements(that._lastRange, target)) {\n that.selectRange(that._firstSelectee(), target, e);\n that._notify(CHANGE, e);\n }\n that._lastRange = target;\n } else {\n that._lastRange = null;\n if (selected && ctrlKey) {\n that._unselect(target);\n that._notify(CHANGE, e);\n } else if (ctrlKey) {\n that.value(target, e);\n that._notify(CHANGE, e);\n } else if (!selected || that.value().length > 1) {\n that.clear();\n that.value(target, e);\n that._notify(CHANGE, e);\n }\n\n that._lastActive = that._downTarget = target;\n }\n }\n },\n\n _start: function(e) {\n var that = this,\n target = $(e.target),\n selectedClass = that.options.selectedClass || SELECTED,\n selected = target.hasClass(selectedClass),\n currentElement,\n ctrlKey = e.event.ctrlKey || e.event.metaKey;\n\n if (!this._allowSelection(e.event.target)) {\n return;\n }\n\n that._downTarget = target;\n\n //in case of hierarchy\n if (!that._isElement(target.closest(\".\" + SELECTABLE))) {\n that.userEvents.cancel();\n return;\n }\n\n if (that.options.useAllItems) {\n that._items = that.element.find(that.options.filter);\n } else {\n currentElement = target.closest(that.element);\n that._items = currentElement.find(that.options.filter);\n }\n\n e.sender.capture();\n\n that._marquee\n .appendTo(document.body)\n .css({\n left: e.x.client + 1,\n top: e.y.client + 1,\n width: 0,\n height: 0\n });\n\n if (!ctrlKey) {\n that.clear();\n }\n\n target = target.add(that.relatedTarget(target));\n if (selected) {\n that._selectElement(target, true);\n if (ctrlKey) {\n target.addClass(UNSELECTING);\n }\n }\n },\n\n _move: function(e) {\n var that = this,\n position = {\n left: e.x.startLocation > e.x.location ? e.x.location : e.x.startLocation,\n top: e.y.startLocation > e.y.location ? e.y.location : e.y.startLocation,\n width: abs(e.x.initialDelta),\n height: abs(e.y.initialDelta)\n };\n\n that._marquee.css(position);\n\n that._invalidateSelectables(position, (e.event.ctrlKey || e.event.metaKey));\n\n e.preventDefault();\n },\n\n _end: function(e) {\n var that = this,\n rangeSelectedAttr = kendo.attr(\"range-selected\"),\n uid = kendo.guid();\n\n that._marquee.remove();\n\n that._unselect(that.element\n .find(that.options.filter + \".\" + UNSELECTING))\n .removeClass(UNSELECTING);\n\n\n var target = that.element.find(that.options.filter + \".\" + ACTIVE);\n target = target.add(that.relatedTarget(target));\n\n if (that.options.addIdToRanges) {\n for (var i = 0; i < that._currentlyActive.length; i++) {\n $(that._currentlyActive[i]).attr(rangeSelectedAttr, uid);\n }\n }\n\n if (!that._lastRange || !compareElements(that._lastRange, target)) {\n that.value(target, e);\n that._notify(CHANGE, e);\n }\n that._lastRange = target;\n that._lastActive = that._downTarget;\n that._items = null;\n },\n\n _invalidateSelectables: function(position, ctrlKey) {\n var idx,\n length,\n target = this._downTarget[0],\n items = this._items,\n selectedClass = this.options.selectedClass || SELECTED,\n related,\n toSelect;\n\n this._currentlyActive = [];\n\n for (idx = 0, length = items.length; idx < length; idx ++) {\n toSelect = items.eq(idx);\n related = toSelect.add(this.relatedTarget(toSelect));\n\n if (collision(toSelect, position)) {\n if (toSelect.hasClass(selectedClass)) {\n if (ctrlKey && target !== toSelect[0]) {\n related.removeClass(selectedClass).addClass(UNSELECTING);\n }\n } else if (!toSelect.hasClass(ACTIVE) && !toSelect.hasClass(UNSELECTING) && !this._collidesWithActiveElement(related, position)) {\n related.addClass(ACTIVE);\n }\n this._currentlyActive.push(related[0]);\n } else {\n if (toSelect.hasClass(ACTIVE)) {\n related.removeClass(ACTIVE);\n } else if (ctrlKey && toSelect.hasClass(UNSELECTING)) {\n related.removeClass(UNSELECTING).addClass(selectedClass);\n }\n }\n }\n },\n\n _collidesWithActiveElement: function(element, marqueeRect) {\n if (!this.options.ignoreOverlapped) {\n return false;\n }\n\n var activeElements = this._currentlyActive;\n var elemRect = element[0].getBoundingClientRect();\n var activeElementRect;\n var collision = false;\n var isRtl = kendo.support.isRtl(element);\n var leftRight = isRtl ? \"right\" : \"left\";\n var tempRect = {};\n\n marqueeRect.right = marqueeRect.left + marqueeRect.width;\n marqueeRect.bottom = marqueeRect.top + marqueeRect.height;\n\n for (var i = 0; i < activeElements.length; i++) {\n activeElementRect = activeElements[i].getBoundingClientRect();\n if (overlaps(elemRect, activeElementRect)) {\n tempRect[leftRight] = leftRight === \"left\" ? activeElementRect.right : activeElementRect.left;\n elemRect = extend({}, elemRect, tempRect);\n if (elemRect.left > elemRect.right) {\n return true;\n }\n collision = !overlaps(elemRect, marqueeRect);\n }\n }\n return collision;\n },\n\n value: function(val) {\n var that = this,\n selectElement = that._selectElement.bind(that);\n\n if (val) {\n val.each(function() {\n selectElement(this);\n });\n\n return;\n }\n\n return that.element.find(that.options.filter + \".\" + (that.options.selectedClass || SELECTED));\n },\n\n selectedRanges: function() {\n var that = this;\n var rangeSelectedAttr = kendo.attr(\"range-selected\");\n var map = {};\n\n that.element.find(\"[\" + rangeSelectedAttr + \"]\").each(function(_, elem) {\n var rangeId = $(elem).attr(rangeSelectedAttr);\n var mapLocation = map[rangeId];\n\n if (!mapLocation) {\n mapLocation = map[rangeId] = [];\n }\n\n mapLocation.push($(elem));\n });\n\n return map;\n },\n\n selectedSingleItems: function() {\n var that = this;\n var rangeSelectedAttr = kendo.attr(\"range-selected\");\n\n return that.element.find(that.options.filter + \".\" + (that.options.selectedClass || SELECTED) + \":not([\" + rangeSelectedAttr + \"])\").toArray().map(function(elem) {\n return $(elem);\n });\n },\n\n _firstSelectee: function() {\n var that = this,\n selected;\n\n if (that._lastActive !== null) {\n return that._lastActive;\n }\n\n selected = that.value();\n return selected.length > 0 ?\n selected[0] :\n that.element.find(that.options.filter)[0];\n },\n\n _selectElement: function(element, preventNotify) {\n var toSelect = $(element),\n selectedClass = this.options.selectedClass || SELECTED,\n isPrevented = !preventNotify && this._notify(\"select\", { element: element });\n\n toSelect.removeClass(ACTIVE);\n if (!isPrevented) {\n toSelect.addClass(selectedClass);\n\n if (this.options.aria) {\n toSelect.attr(ARIASELECTED, true);\n }\n }\n },\n\n _notify: function(name, args) {\n args = args || { };\n return this.trigger(name, args);\n },\n\n _unselect: function(element) {\n if (this.trigger(UNSELECT, { element: element })) {\n return;\n }\n\n var rangeSelectedAttr = kendo.attr(\"range-selected\");\n\n element.removeClass(this.options.selectedClass || SELECTED).removeAttr(rangeSelectedAttr);\n\n if (this.options.aria) {\n element.attr(ARIASELECTED, false);\n }\n\n return element;\n },\n\n _select: function(e) {\n if (this._allowSelection(e.event.target)) {\n if (!msie || (msie && !$(kendo._activeElement()).is(this.options.inputSelectors))) {\n e.preventDefault();\n }\n }\n },\n\n _allowSelection: function(target) {\n if ($(target).is(this.options.inputSelectors)) {\n this.userEvents.cancel();\n this._downTarget = null;\n return false;\n }\n\n return true;\n },\n\n resetTouchEvents: function() {\n this.userEvents.cancel();\n },\n\n clear: function() {\n var items = this.element.find(this.options.filter + \".\" + (this.options.selectedClass || SELECTED));\n this._unselect(items);\n },\n\n selectRange: function(start, end) {\n var that = this,\n idx,\n tmp,\n items;\n\n that.clear();\n\n if (that.element.length > 1) {\n items = that.options.continuousItems();\n }\n\n if (!items || !items.length) {\n items = that.element.find(that.options.filter);\n }\n\n start = $.inArray($(start)[0], items);\n end = $.inArray($(end)[0], items);\n\n if (start > end) {\n tmp = start;\n start = end;\n end = tmp;\n }\n\n if (!that.options.useAllItems) {\n end += that.element.length - 1;\n }\n\n for (idx = start; idx <= end; idx ++ ) {\n that._selectElement(items[idx], true);\n }\n },\n\n destroy: function() {\n var that = this;\n\n Widget.fn.destroy.call(that);\n\n that.element.off(NS);\n\n that.userEvents.destroy();\n\n that._marquee = that._lastActive = that.element = that.userEvents = null;\n }\n });\n\n Selectable.parseOptions = function(selectable) {\n var selectableMode = selectable.mode || selectable;\n var asLowerString = typeof selectableMode === \"string\" && selectableMode.toLowerCase();\n return {\n multiple: asLowerString && asLowerString.indexOf(\"multiple\") > -1,\n cell: asLowerString && asLowerString.indexOf(\"cell\") > -1\n };\n };\n\n function compareElements(element, toCompare) {\n\n if (element.length !== toCompare.length) {\n return false;\n }\n\n for (var i = 0; i < element.length; i++) {\n if (element[i] !== toCompare[i]) {\n return false;\n }\n }\n\n return true;\n }\n\n function collision(element, position) {\n if (!element.is(\":visible\")) {\n return false;\n }\n\n var elementPosition = kendo.getOffset(element),\n right = position.left + position.width,\n bottom = position.top + position.height;\n\n elementPosition.right = elementPosition.left + kendo._outerWidth(element);\n elementPosition.bottom = elementPosition.top + kendo._outerHeight(element);\n\n return !(elementPosition.left > right ||\n elementPosition.right < position.left ||\n elementPosition.top > bottom ||\n elementPosition.bottom < position.top);\n }\n\n function overlaps(firstRect, secondRect) {\n return !(firstRect.right <= secondRect.left ||\n firstRect.left >= secondRect.right ||\n firstRect.bottom <= secondRect.top ||\n firstRect.top >= secondRect.bottom);\n }\n\n kendo.ui.plugin(Selectable);\n\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.badge',[\"kendo.core\"], f);\n})(function() {\n\nvar __meta__ = {\n id: \"badge\",\n name: \"Badge\",\n category: \"web\", // suite\n description: \"The Badge decorates avatars, navigation menus, or other components in the application when visual notification is needed\",\n depends: [\"core\"] // dependencies\n};\n\n(function($, undefined) {\n var kendo = window.kendo;\n var Widget = kendo.ui.Widget;\n var ui = kendo.ui;\n var HIDDEN = 'k-hidden';\n\n var iconTemplate = '';\n var svgIconTemplate = '#= icon #';\n\n var Badge = Widget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n\n that._content();\n\n that._appearance();\n\n kendo.notify(that);\n },\n\n destroy: function() {\n var that = this;\n\n Widget.fn.destroy.call(that);\n },\n\n options: {\n name: 'Badge',\n cutoutBorder: false,\n data: {},\n fillMode: 'solid',\n icon: '',\n max: Infinity,\n position: 'inline',\n align: '',\n rounded: 'medium',\n roundings: {\n 'small': 'sm',\n 'medium': 'md',\n 'large': 'lg',\n 'full': 'full'\n },\n sizes: {\n 'small': 'sm',\n 'medium': 'md',\n 'large': 'lg'\n },\n size: 'medium',\n template: null,\n text: '',\n themeColor: 'secondary',\n visible: true,\n _classNames: []\n },\n\n _content: function() {\n var that = this;\n var text = that.options.text;\n var template = that.options.template;\n var data = that.options.data;\n var icon = that.options.icon;\n\n // Order of precedence\n // 1) template\n // 2) icon\n // 3) text\n // 4) content\n\n if (template !== null) {\n that._text = text;\n that._template = kendo.template(template).bind(that);\n that.element.html( that._template(data) );\n\n return;\n }\n\n if (icon !== '') {\n that.icon(icon);\n\n return;\n }\n\n if (text !== '') {\n that.text(text);\n\n return;\n }\n\n that.text(that.element.html());\n },\n\n _appearance: function() {\n var that = this;\n that._themeColor = that.options.themeColor;\n that._shape = that.options.shape;\n that._sizes = that.options.sizes;\n that._size = that.options.size;\n that._fillMode = that.options.fillMode;\n that._rounded = that.options.rounded;\n that._roundings = that.options.roundings;\n that._cutoutBorder = that.options.cutoutBorder;\n that._align = that.options.align;\n that._position = that.options.position;\n that._visible = that.options.visible;\n\n that._updateClassNames();\n },\n\n _updateClassNames: function() {\n var that = this;\n var classNames = ['k-badge'];\n var keepClassNames = that.options._classNames;\n var themeColor = that._themeColor;\n var shape = that._shape;\n var sizes = that._sizes;\n var size = that._size;\n var sizeAbbr = sizes[size] === undefined ? size : sizes[size];\n var fillMode = that._fillMode;\n var rounded = that._rounded;\n var roundings = that._roundings;\n var roundedAbbr = roundings[rounded] === undefined ? rounded : roundings[rounded];\n var cutoutBorder = that._cutoutBorder;\n var align = that._align;\n var position = that._position;\n var visible = that._visible;\n\n // Remove all class names\n that.element.removeClass(function(index, className) {\n if (className.indexOf('k-') === 0 && keepClassNames.indexOf(className) === -1) {\n that.element.removeClass(className);\n }\n });\n\n // Fill\n if (typeof fillMode === 'string' && fillMode !== '') {\n classNames.push('k-badge-' + fillMode);\n }\n\n // Color\n if (typeof themeColor === 'string' && themeColor !== '') {\n classNames.push('k-badge-' + fillMode + '-' + themeColor);\n }\n\n // Size\n if (typeof size === 'string' && size !== '') {\n classNames.push('k-badge-' + sizeAbbr);\n }\n\n // Rounded\n if (typeof rounded === 'string' && rounded !== '') {\n classNames.push('k-rounded-' + roundedAbbr);\n }\n\n // Shape\n if (typeof shape === 'string' && shape !== '') {\n classNames.push('k-badge-' + shape);\n }\n\n // Cutout border\n if (typeof cutoutBorder === 'boolean' && cutoutBorder === true) {\n classNames.push('k-badge-border-cutout');\n }\n\n // Position\n if (typeof position === 'string' && position !== '') {\n classNames.push('k-badge-' + position);\n }\n\n // Align\n if (typeof position === 'string' && position !== '' && position !== 'inline' && typeof align === 'string' && align.split(' ').length == 2) {\n classNames.push('k-' + align.replace(' ', '-'));\n }\n\n // Visibility\n if (visible === false) {\n classNames.push(HIDDEN);\n }\n\n // Apply classnames\n that.element.addClass(classNames.join(' '));\n },\n\n setOptions: function(options) {\n var that = this;\n\n that.element.removeClass(function(index, className) {\n if (className.indexOf('k-') >= 0) {\n that.element.removeClass(className);\n }\n });\n\n Widget.fn.setOptions.call(that, options);\n\n that._content();\n\n that._appearance();\n },\n\n text: function(text) {\n var that = this;\n var max = that.options.max;\n\n // handle badge.text()\n if (arguments.length === 0 || text === undefined) {\n return that._text;\n }\n\n that._text = text;\n\n // handle badge.text(true|false|null)\n if (text === true || text === false || text === null) {\n that.element.html('');\n\n return;\n }\n\n // handle badge.text('string')\n if (typeof text === 'string') {\n that.element.html(text);\n\n return;\n }\n\n // handle badge.text(1)\n if (typeof text === 'number') {\n if (text > max) {\n that.element.html(max + '+');\n } else {\n that.element.html(text);\n }\n\n return;\n }\n\n // handle other objects\n if (typeof text === 'object' && 'toString' in text) {\n that.element.html(text.toString());\n\n return;\n }\n\n },\n\n icon: function(icon) {\n var that = this;\n var iconTemplateFunction;\n\n // handle badge.icon()\n if (arguments.length === 0 || icon === undefined) {\n return that._icon;\n }\n\n that._icon = icon;\n\n // Handle badge.icon()\n if (icon.indexOf('\");\n }\n\n return (new HTMLButton(element, options)).html();\n };\n\n var HTMLButton = HTMLBase.extend({\n init: function(element, options) {\n var that = this;\n HTMLBase.fn.init.call(that, element, options);\n that.wrapper = that.element.addClass(KBUTTON);\n\n if (!that.element.attr(\"type\")) {\n that.element.attr(\"type\", that.options.type);\n }\n\n that._addClasses();\n that.iconElement();\n that._textElement();\n },\n options: {\n name: \"HTMLButton\",\n type: \"button\",\n icon: \"\",\n iconClass: \"\",\n spriteCssClass: \"\",\n imageUrl: \"\",\n size: \"medium\",\n rounded: \"medium\",\n fillMode: \"solid\",\n themeColor: \"base\",\n stylingOptions: [ \"size\", \"rounded\", \"fillMode\", \"themeColor\" ]\n },\n iconElement: function() {\n var that = this,\n element = that.element,\n options = that.options,\n icon = options.icon,\n iconClass = options.iconClass,\n spriteCssClass = options.spriteCssClass,\n imageUrl = options.imageUrl,\n span, img, isEmpty;\n\n if (spriteCssClass || imageUrl || icon || iconClass) {\n isEmpty = true;\n\n element.contents().filter(function() {\n return (!$(this).hasClass(\"k-sprite\") && !$(this).hasClass(\"k-icon\") && !$(this).hasClass(\"k-image\"));\n }).each(function(idx, el) {\n if (el.nodeType == 1 || el.nodeType == 3 && kendo.trim(el.nodeValue).length > 0) {\n isEmpty = false;\n }\n });\n }\n\n if (isEmpty) {\n that.element.addClass(\"k-icon-button\");\n }\n\n if (imageUrl) {\n img = element.children(\"img.k-image\").first();\n if (!img[0]) {\n img = $('\"icon\"').prependTo(element);\n }\n img.attr(\"src\", imageUrl);\n img.addClass(KBUTTONICON);\n } else if (icon || iconClass) {\n span = element.children(\"span.k-icon\").first();\n if (!span[0]) {\n span = $('').prependTo(element);\n }\n span.attr(\"class\", icon ? \"k-icon k-i-\" + icon : iconClass);\n span.addClass(KBUTTONICON);\n } else if (spriteCssClass) {\n span = element.children(\"span.k-sprite\").first();\n if (!span[0]) {\n span = $('').prependTo(element);\n }\n span.addClass(spriteCssClass + \" \" + KBUTTONICON);\n }\n },\n _textElement: function() {\n var element = this.element;\n\n element.contents().filter(function() {\n return (!$(this).hasClass(KBUTTONICON) && !$(this).hasClass(\"k-sprite\") && !$(this).hasClass(\"k-icon\") && !$(this).hasClass(\"k-image\"));\n }).each(function(idx, el) {\n if (el.nodeType == 1 || el.nodeType == 3 && kendo.trim(el.nodeValue).length > 0) {\n if (el.nodeType === 3) {\n var newSpan = document.createElement('span');\n\n el.parentNode.insertBefore(newSpan, el);\n newSpan.appendChild(el);\n el = newSpan;\n }\n\n el.classList.add(KBUTTONTEXT);\n }\n });\n }\n });\n\n $.extend(kendo.html, {\n renderButton: renderButton,\n HTMLButton: HTMLButton\n });\n\n kendo.cssProperties.registerPrefix(\"HTMLButton\", \"k-button-\");\n\n kendo.cssProperties.registerValues(\"HTMLButton\", [{\n prop: \"fillMode\",\n values: kendo.cssProperties.fillModeValues.concat([\"link\"])\n }, {\n prop: \"rounded\",\n values: kendo.cssProperties.roundedValues.concat([['full', 'full']])\n }]);\n\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.button',[\"kendo.core\", \"kendo.badge\", \"kendo.html.button\"], f);\n})(function() {\n\n var __meta__ = {\n id: \"button\",\n name: \"Button\",\n category: \"web\",\n description: \"The Button widget displays styled buttons.\",\n depends: [\"core\", \"badge\", \"html.button\"]\n };\n\n (function($, undefined) {\n var kendo = window.kendo,\n Widget = kendo.ui.Widget,\n html = kendo.html,\n ui = kendo.ui,\n keys = kendo.keys,\n CLICK = \"click\",\n MOUSEDOWN = kendo.support.mousedown,\n MOUSEUP = kendo.support.mouseup,\n MOUSEOUT = \"mouseout\",\n NS = \".kendoButton\",\n DISABLED = \"disabled\",\n DISABLEDSTATE = \"k-disabled\",\n FOCUSEDSTATE = \"k-focus\",\n ACTIVESTATE = \"k-active\";\n\n var BUTTON_DEFAULTS = {\n icon: \"\",\n iconClass: \"\",\n spriteCssClass: \"\",\n imageUrl: \"\",\n badge: null\n };\n kendo.setDefaults(\"button\", BUTTON_DEFAULTS);\n\n var Button = Widget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n\n element = that.wrapper = that.element;\n options = that.options;\n\n html.renderButton(element, $.extend({}, options));\n\n element.attr(\"role\", \"button\");\n\n options.enable = options.enable && options.enabled && !element.attr(DISABLED);\n that.enable(options.enable);\n\n if (options.enable) {\n that._tabindex();\n }\n\n that._badge();\n\n element\n .on(CLICK + NS, that._click.bind(that))\n .on(\"focus\" + NS, that._focus.bind(that))\n .on(\"blur\" + NS, that._blur.bind(that))\n .on(\"keydown\" + NS, that._keydown.bind(that))\n .on(\"keyup\" + NS, that._removeActive.bind(that))\n .on(MOUSEDOWN + NS, that._addActive.bind(that))\n .on(MOUSEUP + NS + \" \" + MOUSEOUT + NS, that._removeActive.bind(that));\n\n kendo.notify(that);\n },\n\n destroy: function() {\n var that = this;\n\n that.wrapper.off(NS);\n\n if (that.badge) {\n that.badge.destroy();\n }\n\n Widget.fn.destroy.call(that);\n },\n\n events: [\n CLICK\n ],\n\n options: {\n name: \"Button\",\n enable: true,\n enabled: true,\n icon: \"\",\n iconClass: \"\",\n spriteCssClass: \"\",\n imageUrl: \"\",\n badge: null,\n size: \"medium\",\n shape: \"rectangle\",\n rounded: \"medium\",\n fillMode: \"solid\",\n themeColor: \"base\"\n },\n\n _isNativeButton: function() {\n return this.element.prop(\"tagName\").toLowerCase() == \"button\";\n },\n\n _click: function(e) {\n if (this.options.enable) {\n if (this.trigger(CLICK, { event: e })) {\n e.preventDefault();\n }\n }\n },\n\n _focus: function() {\n if (this.options.enable) {\n this.element.addClass(FOCUSEDSTATE);\n }\n },\n\n _blur: function() {\n var that = this;\n that.element.removeClass(FOCUSEDSTATE);\n setTimeout(function() {\n that.element.removeClass(ACTIVESTATE);\n });\n },\n\n _keydown: function(e) {\n var that = this;\n if (e.keyCode == keys.ENTER || e.keyCode == keys.SPACEBAR) {\n that._addActive();\n\n if (!that._isNativeButton()) {\n if (e.keyCode == keys.SPACEBAR) {\n e.preventDefault();\n }\n that._click(e);\n }\n }\n },\n\n _removeActive: function() {\n this.element.removeClass(ACTIVESTATE);\n },\n\n _addActive: function() {\n if (this.options.enable) {\n this.element.addClass(ACTIVESTATE);\n }\n },\n\n enable: function(enable) {\n var that = this,\n element = that.element;\n\n if (enable === undefined) {\n enable = true;\n }\n\n enable = !!enable;\n that.options.enable = enable;\n element.toggleClass(DISABLEDSTATE, !enable)\n .attr(\"aria-disabled\", !enable)\n .attr(DISABLED, !enable);\n\n if (enable) {\n that._tabindex();\n }\n\n // prevent 'Unspecified error' in IE when inside iframe\n try {\n element.trigger(\"blur\");\n } catch (err) {}\n },\n\n _badge: function() {\n var that = this;\n var badgeOptions = that.options.badge;\n var badgeEelement;\n\n if (badgeOptions === null || badgeOptions === undefined) {\n return;\n }\n\n if (badgeOptions.constructor !== Object) {\n badgeOptions = { text: badgeOptions };\n }\n\n if (badgeOptions.position === undefined || badgeOptions.position === \"\") {\n badgeOptions.position = \"edge\";\n\n if (badgeOptions.align === undefined || badgeOptions.align === \"\") {\n badgeOptions.align = \"top end\";\n }\n }\n\n badgeOptions._classNames = [\"k-button-badge\"];\n\n that.element.addClass(\"k-badge-container\");\n\n badgeEelement = $('').appendTo(that.element);\n that.badge = new ui.Badge(badgeEelement, badgeOptions);\n }\n });\n\n if (Button.fn.hasOwnProperty(\"defaults\") === false) {\n Object.defineProperty(Button.fn, \"defaults\", {\n get: function() {\n return kendo.defaults.button;\n }\n });\n }\n\n kendo.cssProperties.registerPrefix(\"Button\", \"k-button-\");\n\n kendo.cssProperties.registerValues(\"Button\", [{\n prop: \"fillMode\",\n values: kendo.cssProperties.fillModeValues.concat([\"link\"])\n }, {\n prop: \"rounded\",\n values: kendo.cssProperties.roundedValues.concat([['full', 'full']])\n }]);\n\n kendo.ui.plugin(Button);\n\n })(window.kendo.jQuery);\n\n return window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n\n(function(f, define) {\n define('kendo.bottomnavigation',[ \"kendo.core\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"bottomnavigation\",\n name: \"BottomNavigation\",\n category: \"web\",\n description: \"The BottomNavigation widget is a navigation element that allows movement between primary destinations in an app.\",\n depends: [ \"core\" ]\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n ui = kendo.ui,\n Widget = ui.Widget,\n extend = $.extend,\n template = kendo.template,\n keys = kendo.keys,\n isPlainObject = $.isPlainObject,\n isEmptyObject = $.isEmptyObject,\n\n NS = \".kendoBottomNavigation\",\n PREFIX = \"k-bottom-nav-\",\n K_POS = \"k-pos-\",\n DOT = \".\",\n\n SELECT = \"select\";\n\n var isString = function(value) {\n return typeof value === \"string\";\n };\n\n var bottomNavigationStyles = {\n widget: \"k-bottom-nav\",\n item: \"k-bottom-nav-item\",\n navIcon: \"k-bottom-nav-item-icon\",\n icon: \"k-icon\",\n text: \"k-bottom-nav-item-text\",\n itemFlow: {\n vertical: \"k-bottom-nav-item-flow-vertical\",\n horizontal: \"k-bottom-nav-item-flow-horizontal\"\n },\n selected: \"k-selected\",\n disabled: \"k-disabled\",\n border: \"k-bottom-nav-border\",\n shadow: \"k-bottom-nav-shadow\",\n focus: \"k-focus\"\n };\n\n var templates = {\n item: template(\"\"),\n anchor: template(\"\"),\n text: template(\"#=text#\"),\n icon: template(\"\")\n };\n\n var BottomNavigation = Widget.extend({\n init: function(element, options) {\n var that = this;\n options = options || {};\n Widget.fn.init.call(that, element, options);\n\n that.element = $(element);\n\n that._updateCssClasses();\n that._items();\n that._bindEvents();\n },\n\n options: {\n name: \"BottomNavigation\",\n positionMode: \"fixed\",\n items: [],\n themeColor: \"primary\",\n itemFlow: \"vertical\",\n fill: \"flat\",\n shadow: false,\n border: true,\n template: null\n },\n\n events: [\n SELECT\n ],\n\n destroy: function() {\n var that = this;\n\n that.element.off(NS);\n\n Widget.fn.destroy.call(this);\n },\n\n _tabindex: function(target) {\n var that = this,\n element = that.element,\n TABINDEX = \"tabindex\",\n cachedTabIndex = element.attr(\"data-\" + kendo.ns + TABINDEX),\n tabindex = target.attr(TABINDEX) || element.attr(TABINDEX) || cachedTabIndex;\n\n if (!cachedTabIndex) {\n element.removeAttr(TABINDEX);\n element.attr(\"data-\" + kendo.ns + TABINDEX, tabindex);\n }\n\n target.attr(TABINDEX, !isNaN(tabindex) ? tabindex : 0);\n },\n\n _updateCssClasses: function() {\n var that = this,\n options = that.options,\n styles = bottomNavigationStyles;\n\n // Remove all class names\n that.element.removeClass(function(index, className) {\n if (className.indexOf('k-') === 0) {\n that.element.removeClass(className);\n }\n });\n\n that.element.addClass(styles.widget);\n that.element.addClass(kendo.getValidCssClass(PREFIX, \"themeColor\", options.themeColor));\n that.element.addClass(kendo.getValidCssClass(PREFIX, \"fill\", options.fill));\n that.element.addClass(kendo.getValidCssClass(K_POS, \"positionMode\", options.positionMode));\n that.element.toggleClass(styles.border, options.border);\n that.element.toggleClass(styles.shadow, options.shadow);\n that._itemFlow(options.itemFlow);\n },\n\n _itemFlow: function(orientation) {\n var that = this,\n orientationStyles = bottomNavigationStyles.itemFlow;\n\n that._toggleClassGroup(that.element, orientation, orientationStyles);\n },\n\n _toggleClassGroup: function(element, value, group) {\n if (isString(group[value])) {\n for (var key in group) {\n element.removeClass(group[key]);\n }\n\n element.addClass(group[value]);\n }\n },\n\n _items: function() {\n var that = this,\n options = that.options,\n items = options.items,\n item;\n\n for (var i = 0; i < items.length; i++) {\n item = that._renderItem(items[i]);\n that.element.append(item);\n }\n },\n\n _renderItem: function(item) {\n var that = this,\n itemTemplate = item.template || that.options.template,\n isLink = item.url && isString(item.url),\n elm, icon;\n\n elm = $(isLink ? template(templates.anchor)(item) : template(templates.item)(item));\n\n elm.toggleClass(bottomNavigationStyles.selected, item.selected === true)\n .toggleClass(bottomNavigationStyles.disabled, item.enabled === false)\n .addClass(item.cssClass)\n .attr(extend({}, item.attributes, {\n \"aria-disabled\": item.enabled === false\n }))\n .data(item.data);\n\n that._tabindex(elm);\n\n if (!elm.attr(\"role\") && !isLink) {\n elm.attr(\"role\", \"link\");\n }\n\n if (itemTemplate) {\n elm.append(template(itemTemplate)(item));\n return elm;\n }\n\n item = extend({}, {\n icon: \"\"\n }, item);\n\n icon = $(templates.icon(item)).addClass(item.iconClass);\n\n elm.append(icon);\n\n if (item.text) {\n item.text = item.encoded === false ? item.text : kendo.htmlEncode(item.text);\n elm.append($(templates.text(item)));\n }\n\n return elm;\n },\n\n _bindEvents: function() {\n var that = this,\n clickProxy = that._click.bind(that),\n keydownProxy = that._keydown.bind(that);\n\n that.element.on(\"click\" + NS, DOT + bottomNavigationStyles.item, clickProxy)\n .on(\"keydown\" + NS, DOT + bottomNavigationStyles.item, keydownProxy);\n },\n\n _click: function(ev) {\n var that = this,\n item = $(ev.target).closest(DOT + bottomNavigationStyles.item);\n\n if (item.is(DOT + bottomNavigationStyles.disabled)) {\n ev.preventDefault();\n return;\n }\n\n that._triggerSelect(item, ev);\n },\n\n _triggerSelect: function(item, ev) {\n var that = this;\n\n if (item.is(DOT + bottomNavigationStyles.disabled)) {\n return;\n }\n\n if (that.trigger(SELECT, { originalEvent: ev, item: item, data: item.data() })) {\n return;\n }\n\n that.select(item);\n },\n\n _keydown: function(ev) {\n var that = this,\n target = $(ev.target),\n key = ev.keyCode;\n\n if (key === keys.ENTER || key === keys.SPACEBAR) {\n if (that._isItem(target)) {\n that._triggerSelect(target, ev);\n\n if (key === keys.SPACEBAR) {\n ev.preventDefault();\n }\n }\n }\n },\n\n _isItem: function(item) {\n var that = this;\n\n item = $(item);\n\n return item.is(DOT + bottomNavigationStyles.item) && !!that.element.find(item).length;\n },\n\n items: function() {\n var that = this;\n\n return that.element.children();\n },\n\n select: function(item, state) {\n var that = this,\n selectedItem = that.items().filter(DOT + bottomNavigationStyles.selected);\n\n if (!item) {\n return selectedItem;\n }\n\n state = state !== false;\n\n if (that._isItem(item)) {\n selectedItem.removeClass(bottomNavigationStyles.selected);\n $(item).toggleClass(bottomNavigationStyles.selected, state);\n }\n },\n\n enable: function(item, state) {\n var that = this;\n\n state = state === false;\n\n if (item && that._isItem(item)) {\n $(item).toggleClass(bottomNavigationStyles.disabled, state);\n $(item).attr(\"aria-disabled\", state);\n }\n },\n\n item: function(index) {\n var that = this;\n\n if (isNaN(index)) {\n return null;\n }\n\n return that.items().eq(index);\n },\n\n itemById: function(id) {\n var that = this;\n\n return that.element.find(\"#\" + id);\n },\n\n add: function(item, before) {\n var that = this,\n method = \"append\",\n targetElement = that.element;\n\n if (before && that._isItem(before)) {\n method = \"before\";\n targetElement = $(before);\n }\n\n if (item && isPlainObject(item) && !isEmptyObject(item)) {\n targetElement[method](that._renderItem(item));\n }\n },\n\n remove: function(item) {\n var that = this;\n\n if (item && that._isItem(item)) {\n item.remove();\n }\n },\n\n showText: function(toggle) {\n var that = this,\n textItems = that.items().find(DOT + bottomNavigationStyles.text);\n\n toggle = toggle !== false;\n\n textItems.toggle(toggle);\n },\n\n setOptions: function(options) {\n var that = this;\n\n Widget.fn.setOptions.call(this, options);\n that._updateCssClasses();\n\n if (\"items\" in options || \"template\" in options) {\n that.element.empty();\n that._items();\n }\n }\n });\n\n ui.plugin(BottomNavigation);\n})(window.kendo.jQuery);\n\nreturn window.kendo;\n\n}, typeof define == 'function' && define.amd ? define : function(a1, a2, a3) { (a3 || a2)(); });\n(function(f, define) {\n define('kendo.pager',[ \"kendo.data\" ], f);\n})(function() {\n\nvar __meta__ = {\n id: \"pager\",\n name: \"Pager\",\n category: \"framework\",\n depends: [ \"data\" ],\n advanced: true\n};\n\n(function($, undefined) {\n var kendo = window.kendo,\n ui = kendo.ui,\n Widget = ui.Widget,\n keys = kendo.keys,\n template = kendo.template,\n FIRST = \".k-i-arrow-end-left\",\n LAST = \".k-i-arrow-end-right\",\n PREV = \".k-i-arrow-60-left\",\n NEXT = \".k-i-arrow-60-right\",\n SIZE = \"k-pager-md k-pager-sm\",\n FOCUSABLE = \":kendoFocusable:not([tabindex='-1'])\",\n CHANGE = \"change\",\n NS = \".kendoPager\",\n CLICK = \"click\",\n KEYDOWN = \"keydown\",\n DISABLED = \"disabled\",\n MOUSEDOWN = \"down\",\n MAX_VALUE = Number.MAX_VALUE,\n isRtl = false,\n iconTemplate = kendo.template('');\n\n function button(options) {\n return options.template( {\n idx: options.idx,\n text: options.text,\n ns: kendo.ns,\n numeric: options.numeric,\n title: options.title || \"\",\n tabindex: options.navigatable ? 0 : -1,\n navigatable: options.navigatable\n });\n }\n\n function selectOption(template, idx, text, selected) {\n return template( {\n idx: idx,\n text: text || idx,\n selected: selected || false\n });\n }\n\n function icon(className, text, wrapClassName, id) {\n return iconTemplate({\n className: className.substring(1),\n text: text,\n wrapClassName: wrapClassName || \"\",\n id: id || \"\"\n });\n }\n\n function update(element, selector, page, disabled) {\n element.find(selector)\n .parent()\n .attr(kendo.attr(\"page\"), page)\n .attr(\"tabindex\", disabled ? -1 : 0)\n .attr(\"aria-disabled\", disabled)\n .toggleClass(\"k-disabled\", disabled);\n }\n\n function first(element, page) {\n update(element, FIRST, 1, page <= 1);\n }\n\n function prev(element, page) {\n update(element, PREV, Math.max(1, page - 1), page <= 1);\n }\n\n function next(element, page, totalPages) {\n update(element, NEXT, Math.min(totalPages, page + 1), page >= totalPages);\n }\n\n function last(element, page, totalPages) {\n update(element, LAST, totalPages, page >= totalPages);\n }\n\n var Pager = Widget.extend( {\n init: function(element, options) {\n var that = this, page, totalPages;\n var sizeClassName = null;\n\n Widget.fn.init.call(that, element, options);\n\n options = that.options;\n that._createDataSource(options);\n that.linkTemplate = kendo.template(that.options.linkTemplate);\n that.selectTemplate = kendo.template(that.options.selectTemplate);\n that.numericSelectItemTemplate = kendo.template(that.options.numericSelectItemTemplate);\n\n page = that.page();\n totalPages = that.totalPages();\n\n that._refreshHandler = that.refresh.bind(that);\n\n that.dataSource.bind(CHANGE, that._refreshHandler);\n that.downEvent = kendo.applyEventMap(MOUSEDOWN, kendo.guid());\n\n isRtl = kendo.support.isRtl(element);\n\n if (options.navigatable) {\n that._id = that.element.attr(\"id\") || kendo.guid();\n }\n that._template();\n\n if (options.previousNext) {\n if (!that.element.find(FIRST).length) {\n that.element.append(icon(FIRST, options.messages.first, \"k-pager-first\", that._id));\n\n first(that.element, page, totalPages);\n }\n\n if (!that.element.find(PREV).length) {\n that.element.append(icon(PREV, options.messages.previous, null, that._id));\n\n prev(that.element, page, totalPages);\n }\n }\n\n if (options.numeric) {\n if (!that._numericWrap) {\n that._numericWrap = that.element.find(\".k-pager-numbers-wrap\");\n\n if (that._numericWrap.length === 0) {\n that._numericWrap = $(\"
    \").appendTo(that.element);\n }\n }\n\n if (!that._numericSelect) {\n that._numericSelect = that._numericWrap.find(\".k-dropdown\");\n\n if (that._numericSelect.length === 0) {\n that._numericSelect = $(\"' +\n kendo.format(options.messages.of, totalPages) +\n '');\n }\n\n that.element.on(KEYDOWN + NS, \".k-pager-input input\", that._keydown.bind(that));\n }\n\n if (options.previousNext) {\n if (!that.element.find(NEXT).length) {\n that.element.append(icon(NEXT, options.messages.next, null, that._id));\n\n next(that.element, page, totalPages);\n }\n\n if (!that.element.find(LAST).length) {\n that.element.append(icon(LAST, options.messages.last, \"k-pager-last\", that._id));\n\n last(that.element, page, totalPages);\n }\n }\n\n if (options.pageSizes) {\n if (!that.element.find(\".k-pager-sizes\").length) {\n var pageSizes = options.pageSizes.length ? options.pageSizes : [\"all\", 5, 10, 20];\n var pageItems = $.map(pageSizes, function(size) {\n if (size.toLowerCase && size.toLowerCase() === \"all\") {\n return \"\";\n }\n\n return \"\";\n });\n\n $('' + options.messages.itemsPerPage + \"\")\n .appendTo(that.element)\n .find(\"select\").html(pageItems.join(\"\")).end()\n .appendTo(that.element);\n }\n\n that.element.find(\".k-pager-sizes select\").val(that.pageSize());\n\n if (kendo.ui.DropDownList) {\n that.element.find(\".k-pager-sizes select\").show().attr(\"aria-label\", options.messages.pageSizeDropDownLabel).kendoDropDownList();\n }\n\n that.element.on(CHANGE + NS, \".k-pager-sizes select\", that._change.bind(that));\n }\n\n if (options.refresh) {\n if (!that.element.find(\".k-pager-refresh\").length) {\n that.element.append('');\n }\n\n that.element.on(CLICK + NS, \".k-pager-refresh\", that._refreshClick.bind(that));\n }\n\n if (options.info) {\n if (!that.element.find(\".k-pager-info\").length) {\n that.element.append('');\n }\n }\n\n that.element\n .on(CLICK + NS , \"a\", that._click.bind(that))\n .on(CHANGE + NS , \"select.k-dropdown\", that._numericSelectChange.bind(that))\n .addClass(\"k-pager-wrap k-widget k-floatwrap\");\n\n if (options.autoBind) {\n that.refresh();\n }\n\n that._resizeHandler = that.resize.bind(that, true);\n $(window).on(\"resize\" + NS, that._resizeHandler);\n\n sizeClassName = that._getWidthSizeClass(that.element.outerWidth());\n\n if (sizeClassName) {\n that.element.addClass(sizeClassName);\n }\n\n that._navigatable();\n\n kendo.notify(that);\n },\n\n destroy: function() {\n var that = this;\n\n Widget.fn.destroy.call(that);\n\n that.element.off(NS);\n that.dataSource.unbind(CHANGE, that._refreshHandler);\n that._refreshHandler = null;\n $(window).off(\"resize\" + NS, this._resizeHandler);\n\n kendo.destroy(that.element);\n that.element = that.list = null;\n },\n\n events: [\n CHANGE\n ],\n\n options: {\n name: \"Pager\",\n ARIATemplate: \"Page navigation, page #=page# of #=totalPages#\",\n selectTemplate: '
  • #=text#
  • ',\n linkTemplate: '
  • #=text#
  • ',\n numericSelectItemTemplate: '',\n buttonCount: 10,\n autoBind: true,\n numeric: true,\n info: true,\n input: false,\n previousNext: true,\n pageSizes: false,\n refresh: false,\n responsive: true,\n navigatable: false,\n messages: {\n allPages: \"All\",\n display: \"{0} - {1} of {2} items\",\n empty: \"No items to display\",\n page: \"Page\",\n of: \"of {0}\",\n itemsPerPage: \"items per page\",\n pageButtonLabel: \"Page {0}\",\n pageSizeDropDownLabel: \"Page sizes drop down\",\n numbersSelectLabel: \"Page select\",\n first: \"Go to the first page\",\n previous: \"Go to the previous page\",\n next: \"Go to the next page\",\n last: \"Go to the last page\",\n refresh: \"Refresh\",\n morePages: \"More pages\"\n }\n },\n\n setDataSource: function(dataSource) {\n var that = this;\n\n that.dataSource.unbind(CHANGE, that._refreshHandler);\n that.dataSource = that.options.dataSource = dataSource;\n dataSource.bind(CHANGE, that._refreshHandler);\n\n if (that.options.autoBind) {\n dataSource.fetch();\n }\n },\n\n _aria: function() {\n this.element.attr({\n \"role\": \"application\",\n \"aria-roledescription\": \"pager\",\n \"aria-keyshortcuts\": \"Enter ArrowRight ArrowLeft\"\n });\n },\n\n _resize: function(size) {\n if (size.width) {\n var sizeClassName = this._getWidthSizeClass(size.width);\n var el = this.element;\n\n if (!sizeClassName) {\n el.removeClass(SIZE);\n } else if (!el.hasClass(sizeClassName)) {\n el.removeClass(SIZE);\n el.addClass(sizeClassName);\n }\n }\n },\n\n _createDataSource: function(options) {\n this.dataSource = kendo.data.DataSource.create(options.dataSource);\n },\n\n refresh: function(e) {\n var that = this,\n idx,\n end,\n start = 1,\n reminder,\n page = that.page(),\n html = \"\",\n selectHtml = \"\",\n options = that.options,\n pageSize = that.pageSize(),\n collapsedTotal = that._collapsedTotal(),\n total = that.dataSource._isGroupPaged() ? that.dataSource.groupsTotal(true) : that.dataSource.total(),\n totalPages = that.totalPages(),\n linkTemplate = that.linkTemplate,\n navigatable = options.navigatable,\n numericSelectItemTemplate = that.numericSelectItemTemplate,\n buttonCount = options.buttonCount;\n\n if (e && e.action == \"itemchange\") {\n return;\n }\n\n if (options.numeric) {\n\n if (page > buttonCount) {\n reminder = (page % buttonCount);\n start = (reminder === 0) ? (page - buttonCount) + 1 : (page - reminder) + 1;\n }\n\n end = Math.min((start + buttonCount) - 1, totalPages);\n\n if (start > 1) {\n html += button({\n template: linkTemplate,\n navigatable: navigatable,\n idx: start - 1,\n text: \"...\",\n numeric: false,\n title: options.messages.morePages\n });\n selectHtml += selectOption(numericSelectItemTemplate, start - 1, options.messages.morePages);\n }\n\n for (idx = start; idx <= end; idx++) {\n html += button({\n template: idx == page ? that.selectTemplate : linkTemplate,\n navigatable: navigatable,\n idx: idx,\n text: idx,\n numeric: true,\n title: kendo.format(options.messages.pageButtonLabel, idx)\n });\n selectHtml += selectOption(numericSelectItemTemplate, idx, idx, idx == page);\n }\n\n if (end < totalPages) {\n html += button({\n template: linkTemplate,\n navigatable: navigatable,\n idx: idx,\n text: \"...\",\n numeric: numericSelectItemTemplate,\n title: options.messages.morePages\n });\n selectHtml += selectOption(numericSelectItemTemplate, idx, options.messages.morePages);\n }\n\n if (html === \"\") {\n html = that.selectTemplate({ text: 0, tabindex: navigatable ? 0 : -1, navigatable: navigatable, title: kendo.format(options.messages.pageButtonLabel, 0) });\n selectHtml = $(\"