Skip to content

Instantly share code, notes, and snippets.

@Rulexec
Last active July 8, 2019 07:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rulexec/04877df23ccf9bfd8f00d69896ef919b to your computer and use it in GitHub Desktop.
Save Rulexec/04877df23ccf9bfd8f00d69896ef919b to your computer and use it in GitHub Desktop.
const wialon = require('./wialon.node.js').wialon;
// Print message to log
function msg(text) { console.log(text); }
function init() { // Execute after login succeed
var sess = wialon.core.Session.getInstance(); // get instance of current Session
// flags to specify what kind of data should be returned
var flags = wialon.item.Item.dataFlag.base | wialon.item.Unit.dataFlag.lastMessage;
sess.updateDataFlags( // load items to current session
[{type: "type", data: "avl_unit", flags: flags, mode: 0}], // Items specification
function (code) { // updateDataFlags callback
if (code) { msg(wialon.core.Errors.getErrorText(code)); return; } // exit if error code
// get loaded 'avl_unit's items
var units = sess.getItems("avl_unit");
if (!units || !units.length){ msg("Units not found"); return; } // check if units found
for (var i = 0; i< units.length; i++){ // construct Select object using found units
var u = units[i]; // current unit in cycle
console.log('unit', u.getName());
}
}
);
}
wialon.core.Session.getInstance().initSession("https://hst-api.wialon.com"); // init session
// For more info about how to generate token check
// http://sdk.wialon.com/playground/demo/app_auth_token
wialon.core.Session.getInstance().loginToken("5dce19710a5e26ab8b7b8986cb3c49e58C291791B7F0A7AEB8AFBFCEED7DC03BC48FF5F8", "", // try to login
function (code) { // login callback
// if error code - print error message
if (code){ msg(wialon.core.Errors.getErrorText(code)); return; }
msg("Logged successfully"); init(); // when login suceed then run init() function
});
!function(){var document={documentMode:!1},qx={},wialon={},navigator={userAgent:"node"};exports.qx=qx,exports.wialon=wialon;var window={qx:qx,wialon:wialon,setTimeout:setTimeout,clearTimeout:clearTimeout,setInterval:setInterval,clearInterval:clearInterval,document:document,JSON:JSON,encodeURIComponent:encodeURIComponent,navigator:navigator,__IS_NODEJS:!0},debug,arabicMapForth;!function(){qx.$$start=new Date,qx.$$environment||(qx.$$environment={});var e={"qx.application":"wialon.Application","qx.debug":!1,"qx.debug.databinding":!1,"qx.debug.dispose":!1,"qx.debug.io":!1,"qx.debug.ui.queue":!1,"qx.revision":"","qx.theme":"qx.theme.Modern","qx.version":"4.1"};for(var t in e)qx.$$environment[t]=e[t];qx.$$libraries||(qx.$$libraries={});var n={__out__:{sourceUri:"script"},qx:{resourceUri:"resource",sourceUri:"script",sourceViewUri:"https://github.com/qooxdoo/qooxdoo/blob/%{qxGitBranch}/framework/source/class/%{classFilePath}#L%{lineNumber}"},wialon:{resourceUri:"resource",sourceUri:"script"}};for(var t in n)qx.$$libraries[t]=n[t];qx.$$resources={},qx.$$translations={C:null},qx.$$locales={C:null},qx.$$packageData={},qx.$$g={},qx.$$loader={parts:{boot:[0]},packages:{0:{uris:["__out__:wialon.59ed6bbf25fc.js"]}},urisBefore:[],cssBefore:[],boot:"boot",closureParts:{},bootIsInline:!0,addNoCacheParam:!1,decodeUris:function(e){for(var t=qx.$$libraries,n=[],r=0;r<e.length;r++){var i,a=e[r].split(":");i=2==a.length&&a[0]in t?t[a[0]].sourceUri+"/"+a[1]:e[r],qx.$$loader.addNoCacheParam&&(i+="?nocache="+Math.random()),"/"!=(i=(i=i.replace("../","")).replace("source","")).substr(0,1)&&(i="/"+i),i="/wsdk"+i,"undefined"!=typeof wialonSDKExternalUrl&&(i=wialonSDKExternalUrl+i),n.push(i)}return n}};var r={complete:!0};function i(e,t){var n=document.createElement("script");n.charset="utf-8",n.src=e,n.onreadystatechange=n.onload=function(){this.readyState&&!r[this.readyState]||(n.onreadystatechange=n.onload=null,"function"==typeof t&&t())},s&&(n.async=null),document.getElementsByTagName("head")[0].appendChild(n)}(document.documentMode&&document.documentMode<10||void 0!==window.ActiveXObject&&!document.documentMode)&&(r.loaded=!0);var a=/AppleWebKit\/([^ ]+)/.test(navigator.userAgent),s=!0;function o(e,t){var n;if(0!=e.length)if(s)for(;e.length;)n=e.shift(),e.length?i(n):i(n,t);else i(n=e.shift(),function(){a?window.setTimeout(function(){o(e,t)},0):o(e,t)});else t()}var l=function(){qx.$$domReady=!0,document.removeEventListener("DOMContentLoaded",l,!1)};document.addEventListener&&document.addEventListener("DOMContentLoaded",l,!1),qx.$$loader.importPackageData=function(e,t){if(e.resources){var n=e.resources;for(var r in n)qx.$$resources[r]=n[r]}if(e.locales){var i=e.locales,a=qx.$$locales;for(var s in i)if(a[s])for(var r in i[s])a[s][r]=i[s][r];else a[s]=i[s]}if(e.translations){var o=e.translations,l=qx.$$translations;for(var s in o)if(l[s])for(var r in o[s])l[s][r]=o[s][r];else l[s]=o[s]}t&&t(e)},qx.$$loader.signalStartup=function(){qx.$$loader.scriptLoaded=!0,window.qx&&qx.event&&qx.event.handler&&qx.event.handler.Application?(qx.event.handler.Application.onScriptLoaded(),qx.$$loader.applicationHandlerReady=!0):qx.$$loader.applicationHandlerReady=!1},qx.$$loader.init=function(){var e,t,n=qx.$$loader;if(n.cssBefore.length>0)for(var r=0,i=n.cssBefore.length;r<i;r++)e=n.cssBefore[r],t=void 0,(t=document.createElement("link")).rel="stylesheet",t.type="text/css",t.href=e,document.getElementsByTagName("head")[0].appendChild(t);n.urisBefore.length>0?o(n.urisBefore,function(){n.initUris()}):n.initUris()},qx.$$loader.initUris=function(){var e=qx.$$loader,t=e.parts[e.boot][0];e.bootIsInline?(e.importPackageData(qx.$$packageData[t]),e.signalStartup()):o(e.decodeUris(e.packages[e.parts[e.boot][0]].uris),function(){window.setTimeout(function(){e.importPackageData(qx.$$packageData[t]||{}),e.signalStartup()},0)})}}(),qx.$$packageData[0]={locales:{},resources:{},translations:{C:{}}},window.qx||(window.qx={}),qx.Bootstrap={genericToString:function(){return"[Class "+this.classname+"]"},createNamespace:function(e,t){for(var n=e.split("."),r=n[0],i=qx.$$namespaceRoot&&qx.$$namespaceRoot[r]?qx.$$namespaceRoot:window,a=0,s=n.length-1;a<s;r=n[++a])i=i[r]?i[r]:i[r]={};return i[r]=t,r},setDisplayName:function(e,t,n){e.displayName=t+"."+n+"()"},setDisplayNames:function(e,t){for(var n in e){var r=e[n];r instanceof Function&&(r.displayName=t+"."+n+"()")}},base:function(e,t){if(qx.Bootstrap.DEBUG&&!qx.Bootstrap.isFunction(e.callee.base))throw new Error("Cannot call super class. Method is not derived: "+e.callee.displayName);return 1===arguments.length?e.callee.base.call(this):e.callee.base.apply(this,Array.prototype.slice.call(arguments,1))},define:function(e,t){var n;t||(t={statics:{}});var r=null;if(qx.Bootstrap.setDisplayNames(t.statics,e),t.members||t.extend){qx.Bootstrap.setDisplayNames(t.members,e+".prototype"),n=t.construct||new Function,t.extend&&this.extendClass(n,n,t.extend,e,g);for(var i=t.statics||{},a=0,s=(c=qx.Bootstrap.keys(i)).length;a<s;a++)n[o=c[a]]=i[o];(r=n.prototype).base=qx.Bootstrap.base,r.name=r.classname=e;var o,l,c,u=t.members||{};for(a=0,s=(c=qx.Bootstrap.keys(u)).length;a<s;a++)(l=u[o=c[a]])instanceof Function&&r[o]&&(l.base=r[o]),r[o]=l}else if(n=t.statics||{},qx.Bootstrap.$$registry&&qx.Bootstrap.$$registry[e]){var d=qx.Bootstrap.$$registry[e];if(0!==this.keys(n).length){for(var p in t.defer&&t.defer(n,r),n)d[p]=n[p];return d}}n.$$type="Class",n.hasOwnProperty("toString")||(n.toString=this.genericToString);var g=e?this.createNamespace(e,n):"";return n.name=n.classname=e,n.basename=g,n.$$events=t.events,t.defer&&t.defer(n,r),null!=e&&(qx.Bootstrap.$$registry[e]=n),n}},qx.Bootstrap.define("qx.Bootstrap",{statics:{LOADSTART:qx.$$start||new Date,DEBUG:(debug=!0,qx.$$environment&&!1===qx.$$environment["qx.debug"]&&(debug=!1),debug),getEnvironmentSetting:function(e){if(qx.$$environment)return qx.$$environment[e]},setEnvironmentSetting:function(e,t){qx.$$environment||(qx.$$environment={}),void 0===qx.$$environment[e]&&(qx.$$environment[e]=t)},createNamespace:qx.Bootstrap.createNamespace,setRoot:function(e){qx.$$namespaceRoot=e},base:qx.Bootstrap.base,define:qx.Bootstrap.define,setDisplayName:qx.Bootstrap.setDisplayName,setDisplayNames:qx.Bootstrap.setDisplayNames,genericToString:qx.Bootstrap.genericToString,extendClass:function(e,t,n,r,i){var a=n.prototype,s=new Function;s.prototype=a;var o=new s;e.prototype=o,o.name=o.classname=r,o.basename=i,t.base=n,e.superclass=n,t.self=e.constructor=o.constructor=e},getByName:function(e){return qx.Bootstrap.$$registry[e]},$$registry:{},objectGetLength:function(e){return qx.Bootstrap.keys(e).length},objectMergeWith:function(e,t,n){for(var r in void 0===n&&(n=!0),t)(n||void 0===e[r])&&(e[r]=t[r]);return e},__shadowedKeys:["isPrototypeOf","hasOwnProperty","toLocaleString","toString","valueOf","propertyIsEnumerable","constructor"],keys:{ES5:Object.keys,BROKEN_IE:function(e){if(null===e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("Object.keys requires an object as argument.");var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);for(var i=0,a=qx.Bootstrap.__shadowedKeys,s=a.length;i<s;i++)n.call(e,a[i])&&t.push(a[i]);return t},default:function(e){if(null===e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("Object.keys requires an object as argument.");var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);return t}}["function"==typeof Object.keys?"ES5":"toString"!==function(){for(var e in{toString:1})return e}()?"BROKEN_IE":"default"],__classToTypeMap:{"[object String]":"String","[object Array]":"Array","[object Object]":"Object","[object RegExp]":"RegExp","[object Number]":"Number","[object Boolean]":"Boolean","[object Date]":"Date","[object Function]":"Function","[object Error]":"Error"},bind:function(e,t,n){var r=Array.prototype.slice.call(arguments,2,arguments.length);return function(){var n=Array.prototype.slice.call(arguments,0,arguments.length);return e.apply(t,r.concat(n))}},firstUp:function(e){return e.charAt(0).toUpperCase()+e.substr(1)},firstLow:function(e){return e.charAt(0).toLowerCase()+e.substr(1)},getClass:function(e){if(void 0===e)return"Undefined";if(null===e)return"Null";var t=Object.prototype.toString.call(e);return qx.Bootstrap.__classToTypeMap[t]||t.slice(8,-1)},isString:function(e){return null!==e&&("string"==typeof e||"String"==qx.Bootstrap.getClass(e)||e instanceof String||!!e&&!!e.$$isString)},isArray:function(e){return null!==e&&(e instanceof Array||e&&qx.data&&qx.data.IListData&&qx.util.OOUtil.hasInterface(e.constructor,qx.data.IListData)||"Array"==qx.Bootstrap.getClass(e)||!!e&&!!e.$$isArray)},isObject:function(e){return void 0!==e&&null!==e&&"Object"==qx.Bootstrap.getClass(e)},isFunction:function(e){return"Function"==qx.Bootstrap.getClass(e)},$$logs:[],debug:function(e,t){qx.Bootstrap.$$logs.push(["debug",arguments])},info:function(e,t){qx.Bootstrap.$$logs.push(["info",arguments])},warn:function(e,t){qx.Bootstrap.$$logs.push(["warn",arguments])},error:function(e,t){qx.Bootstrap.$$logs.push(["error",arguments])},trace:function(e){}}}),qx.Bootstrap.define("qx.util.OOUtil",{statics:{classIsDefined:function(e){return void 0!==qx.Bootstrap.getByName(e)},getPropertyDefinition:function(e,t){for(;e;){if(e.$$properties&&e.$$properties[t])return e.$$properties[t];e=e.superclass}return null},hasProperty:function(e,t){return!!qx.util.OOUtil.getPropertyDefinition(e,t)},getEventType:function(e,t){for(e=e.constructor;e.superclass;){if(e.$$events&&void 0!==e.$$events[t])return e.$$events[t];e=e.superclass}return null},supportsEvent:function(e,t){return!!qx.util.OOUtil.getEventType(e,t)},getByInterface:function(e,t){for(var n,r,i;e;){if(e.$$implements)for(r=0,i=(n=e.$$flatImplements).length;r<i;r++)if(n[r]===t)return e;e=e.superclass}return null},hasInterface:function(e,t){return!!qx.util.OOUtil.getByInterface(e,t)},getMixins:function(e){for(var t=[];e;)e.$$includes&&t.push.apply(t,e.$$flatIncludes),e=e.superclass;return t}}}),qx.Bootstrap.define("qx.core.Environment",{statics:{_checks:{},_asyncChecks:{},__cache:{},_checksMap:{},_defaults:{true:!0,"qx.allowUrlSettings":!1,"qx.allowUrlVariants":!1,"qx.debug.property.level":0,"qx.debug":!0,"qx.debug.ui.queue":!0,"qx.aspects":!1,"qx.dynlocale":!0,"qx.dyntheme":!0,"qx.blankpage":"qx/static/blank.html","qx.debug.databinding":!1,"qx.debug.dispose":!1,"qx.optimization.basecalls":!1,"qx.optimization.comments":!1,"qx.optimization.privates":!1,"qx.optimization.strings":!1,"qx.optimization.variables":!1,"qx.optimization.variants":!1,"module.databinding":!0,"module.logger":!0,"module.property":!0,"module.events":!0,"qx.nativeScrollBars":!1},get:function(e){if(void 0!=this.__cache[e])return this.__cache[e];var t=this._checks[e];if(t){var n=t();return this.__cache[e]=n,n}var r=this._getClassNameFromEnvKey(e);if(void 0!=r[0])return n=r[0][r[1]](),this.__cache[e]=n,n;qx.Bootstrap.DEBUG&&(qx.Bootstrap.warn(e+" is not a valid key. Please see the API-doc of qx.core.Environment for a list of predefined keys."),qx.Bootstrap.trace(this))},_getClassNameFromEnvKey:function(e){var t=this._checksMap;if(void 0!=t[e]){var n=t[e],r=n.lastIndexOf(".");if(r>-1){var i=n.slice(0,r),a=n.slice(r+1),s=qx.Bootstrap.getByName(i);if(void 0!=s)return[s,a]}}return[void 0,void 0]},getAsync:function(e,t,n){var r=this;if(void 0==this.__cache[e]){var i=this._asyncChecks[e];if(i)i(function(i){r.__cache[e]=i,t.call(n,i)});else{var a=this._getClassNameFromEnvKey(e);void 0==a[0]?qx.Bootstrap.DEBUG&&(qx.Bootstrap.warn(e+" is not a valid key. Please see the API-doc of qx.core.Environment for a list of predefined keys."),qx.Bootstrap.trace(this)):a[0][a[1]](function(i){r.__cache[e]=i,t.call(n,i)})}}else window.setTimeout(function(){t.call(n,r.__cache[e])},0)},select:function(e,t){return this.__pickFromValues(this.get(e),t)},selectAsync:function(e,t,n){this.getAsync(e,function(r){this.__pickFromValues(e,t).call(n,r)},this)},__pickFromValues:function(e,t){var n=t[e];if(t.hasOwnProperty(e))return n;for(var r in t)if(-1!=r.indexOf("|"))for(var i=r.split("|"),a=0;a<i.length;a++)if(i[a]==e)return t[r];if(void 0!==t.default)return t.default;if(qx.Bootstrap.DEBUG)throw new Error('No match for variant "'+e+'" ('+typeof e+" type) in variants ["+qx.Bootstrap.keys(t)+'] found, and no default ("default") given')},filter:function(e){var t=[];for(var n in e)this.get(n)&&t.push(e[n]);return t},invalidateCacheKey:function(e){delete this.__cache[e]},add:function(e,t){void 0==this._checks[e]&&(t instanceof Function?(!this._checksMap[e]&&t.displayName&&(this._checksMap[e]=t.displayName.substr(0,t.displayName.length-2)),this._checks[e]=t):this._checks[e]=this.__createCheck(t))},addAsync:function(e,t){void 0==this._checks[e]&&(this._asyncChecks[e]=t)},getChecks:function(){return this._checks},getAsyncChecks:function(){return this._asyncChecks},_initDefaultQxValues:function(){var e=function(e){return function(){return e}};for(var t in this._defaults)this.add(t,e(this._defaults[t]))},__importFromGenerator:function(){if(qx&&qx.$$environment)for(var e in qx.$$environment){var t=qx.$$environment[e];this._checks[e]=this.__createCheck(t)}},__importFromUrl:function(){if(window.document&&window.document.location)for(var e=window.document.location.search.slice(1).split("&"),t=0;t<e.length;t++){var n=e[t].split(":");if(3==n.length&&"qxenv"==n[0]){var r=n[1],i=decodeURIComponent(n[2]);"true"==i?i=!0:"false"==i?i=!1:/^(\d|\.)+$/.test(i)&&(i=parseFloat(i)),this._checks[r]=this.__createCheck(i)}}},__createCheck:function(e){return qx.Bootstrap.bind(function(e){return e},null,e)}},defer:function(e){e._initDefaultQxValues(),e.__importFromGenerator(),!0===e.get("qx.allowUrlSettings")&&e.__importFromUrl()}}),qx.Bootstrap.define("qx.bom.client.EcmaScript",{statics:{getStackTrace:function(){var e=new Error("e");if(!e.stack&&!e.stacktrace)try{throw e}catch(t){e=t}return e.stacktrace?"stacktrace":e.stack?"stack":null},getArrayIndexOf:function(){return!!Array.prototype.indexOf},getArrayLastIndexOf:function(){return!!Array.prototype.lastIndexOf},getArrayForEach:function(){return!!Array.prototype.forEach},getArrayFilter:function(){return!!Array.prototype.filter},getArrayMap:function(){return!!Array.prototype.map},getArraySome:function(){return!!Array.prototype.some},getArrayEvery:function(){return!!Array.prototype.every},getArrayReduce:function(){return!!Array.prototype.reduce},getArrayReduceRight:function(){return!!Array.prototype.reduceRight},getErrorToString:function(){return"function"==typeof Error.prototype.toString&&"[object Error]"!==Error.prototype.toString()},getFunctionBind:function(){return"function"==typeof Function.prototype.bind},getObjectKeys:function(){return!!Object.keys},getDateNow:function(){return!!Date.now},getStringTrim:function(){return"function"==typeof String.prototype.trim}},defer:function(e){qx.core.Environment.add("ecmascript.array.indexof",e.getArrayIndexOf),qx.core.Environment.add("ecmascript.array.lastindexof",e.getArrayLastIndexOf),qx.core.Environment.add("ecmascript.array.foreach",e.getArrayForEach),qx.core.Environment.add("ecmascript.array.filter",e.getArrayFilter),qx.core.Environment.add("ecmascript.array.map",e.getArrayMap),qx.core.Environment.add("ecmascript.array.some",e.getArraySome),qx.core.Environment.add("ecmascript.array.every",e.getArrayEvery),qx.core.Environment.add("ecmascript.array.reduce",e.getArrayReduce),qx.core.Environment.add("ecmascript.array.reduceright",e.getArrayReduceRight),qx.core.Environment.add("ecmascript.date.now",e.getDateNow),qx.core.Environment.add("ecmascript.error.toString",e.getErrorToString),qx.core.Environment.add("ecmascript.error.stacktrace",e.getStackTrace),qx.core.Environment.add("ecmascript.function.bind",e.getFunctionBind),qx.core.Environment.add("ecmascript.object.keys",e.getObjectKeys),qx.core.Environment.add("ecmascript.string.trim",e.getStringTrim)}}),qx.Bootstrap.define("qx.lang.normalize.Array",{statics:{indexOf:function(e,t){null==t?t=0:t<0&&(t=Math.max(0,this.length+t));for(var n=t;n<this.length;n++)if(this[n]===e)return n;return-1},lastIndexOf:function(e,t){null==t?t=this.length-1:t<0&&(t=Math.max(0,this.length+t));for(var n=t;n>=0;n--)if(this[n]===e)return n;return-1},forEach:function(e,t){for(var n=this.length,r=0;r<n;r++){var i=this[r];void 0!==i&&e.call(t||window,i,r,this)}},filter:function(e,t){for(var n=[],r=this.length,i=0;i<r;i++){var a=this[i];void 0!==a&&e.call(t||window,a,i,this)&&n.push(this[i])}return n},map:function(e,t){for(var n=[],r=this.length,i=0;i<r;i++){var a=this[i];void 0!==a&&(n[i]=e.call(t||window,a,i,this))}return n},some:function(e,t){for(var n=this.length,r=0;r<n;r++){var i=this[r];if(void 0!==i&&e.call(t||window,i,r,this))return!0}return!1},every:function(e,t){for(var n=this.length,r=0;r<n;r++){var i=this[r];if(void 0!==i&&!e.call(t||window,i,r,this))return!1}return!0},reduce:function(e,t){if("function"!=typeof e)throw new TypeError("First argument is not callable");if(void 0===t&&0===this.length)throw new TypeError("Length is 0 and no second argument given");for(var n=void 0===t?this[0]:t,r=void 0===t?1:0;r<this.length;r++)r in this&&(n=e.call(void 0,n,this[r],r,this));return n},reduceRight:function(e,t){if("function"!=typeof e)throw new TypeError("First argument is not callable");if(void 0===t&&0===this.length)throw new TypeError("Length is 0 and no second argument given");for(var n=void 0===t?this[this.length-1]:t,r=void 0===t?this.length-2:this.length-1;r>=0;r--)r in this&&(n=e.call(void 0,n,this[r],r,this));return n}},defer:function(e){qx.core.Environment.get("ecmascript.array.indexof")||(Array.prototype.indexOf=e.indexOf),qx.core.Environment.get("ecmascript.array.lastindexof")||(Array.prototype.lastIndexOf=e.lastIndexOf),qx.core.Environment.get("ecmascript.array.foreach")||(Array.prototype.forEach=e.forEach),qx.core.Environment.get("ecmascript.array.filter")||(Array.prototype.filter=e.filter),qx.core.Environment.get("ecmascript.array.map")||(Array.prototype.map=e.map),qx.core.Environment.get("ecmascript.array.some")||(Array.prototype.some=e.some),qx.core.Environment.get("ecmascript.array.every")||(Array.prototype.every=e.every),qx.core.Environment.get("ecmascript.array.reduce")||(Array.prototype.reduce=e.reduce),qx.core.Environment.get("ecmascript.array.reduceright")||(Array.prototype.reduceRight=e.reduceRight)}}),qx.Bootstrap.define("qx.Mixin",{statics:{define:function(e,t){if(t){t.include&&"Array"!==qx.Bootstrap.getClass(t.include)&&(t.include=[t.include]),qx.core.Environment.get("qx.debug")&&this.__validateConfig(e,t);var n=t.statics?t.statics:{};for(var r in qx.Bootstrap.setDisplayNames(n,e),n)n[r]instanceof Function&&(n[r].$$mixin=n);for(var r in t.construct&&(n.$$constructor=t.construct,qx.Bootstrap.setDisplayName(t.construct,e,"constructor")),t.include&&(n.$$includes=t.include),t.properties&&(n.$$properties=t.properties),t.members&&(n.$$members=t.members,qx.Bootstrap.setDisplayNames(t.members,e+".prototype")),n.$$members)n.$$members[r]instanceof Function&&(n.$$members[r].$$mixin=n);t.events&&(n.$$events=t.events),t.destruct&&(n.$$destructor=t.destruct,qx.Bootstrap.setDisplayName(t.destruct,e,"destruct"))}else n={};return n.$$type="Mixin",n.name=e,n.toString=this.genericToString,n.basename=qx.Bootstrap.createNamespace(e,n),this.$$registry[e]=n,n},checkCompatibility:function(e){var t=this.flatten(e),n=t.length;if(n<2)return!0;for(var r,i={},a={},s={},o=0;o<n;o++){for(var l in(r=t[o]).events){if(s[l])throw new Error('Conflict between mixin "'+r.name+'" and "'+s[l]+'" in member "'+l+'"!');s[l]=r.name}for(var l in r.properties){if(i[l])throw new Error('Conflict between mixin "'+r.name+'" and "'+i[l]+'" in property "'+l+'"!');i[l]=r.name}for(var l in r.members){if(a[l])throw new Error('Conflict between mixin "'+r.name+'" and "'+a[l]+'" in member "'+l+'"!');a[l]=r.name}}return!0},isCompatible:function(e,t){var n=qx.util.OOUtil.getMixins(t);return n.push(e),qx.Mixin.checkCompatibility(n)},getByName:function(e){return this.$$registry[e]},isDefined:function(e){return void 0!==this.getByName(e)},getTotalNumber:function(){return qx.Bootstrap.objectGetLength(this.$$registry)},flatten:function(e){if(!e)return[];for(var t=e.concat(),n=0,r=e.length;n<r;n++)e[n].$$includes&&t.push.apply(t,this.flatten(e[n].$$includes));return t},genericToString:function(){return"[Mixin "+this.name+"]"},$$registry:{},__allowedKeys:qx.core.Environment.select("qx.debug",{true:{include:"object",statics:"object",members:"object",properties:"object",events:"object",destruct:"function",construct:"function"},default:null}),__validateConfig:qx.core.Environment.select("qx.debug",{true:function(e,t){var n=this.__allowedKeys;for(var r in t){if(!n[r])throw new Error('The configuration key "'+r+'" in mixin "'+e+'" is not allowed!');if(null==t[r])throw new Error('Invalid key "'+r+'" in mixin "'+e+'"! The value is undefined/null!');if(null!==n[r]&&typeof t[r]!==n[r])throw new Error('Invalid type of key "'+r+'" in mixin "'+e+'"! The type of the key must be "'+n[r]+'"!')}for(var i=["statics","members","properties","events"],a=0,s=i.length;a<s;a++)if(void 0!==t[r=i[a]]&&(-1!=["Array","RegExp","Date"].indexOf(qx.Bootstrap.getClass(t[r]))||void 0!==t[r].classname))throw new Error('Invalid key "'+r+'" in mixin "'+e+'"! The value needs to be a map!');if(t.include){a=0;var o=t.include;for(s=o.length;a<s;a++){if(null==o[a])throw new Error("Includes of mixins must be mixins. The include number '"+(a+1)+"' in mixin '"+e+"'is undefined/null!");if("Mixin"!==o[a].$$type)throw new Error("Includes of mixins must be mixins. The include number '"+(a+1)+"' in mixin '"+e+"'is not a mixin!")}this.checkCompatibility(t.include)}},default:function(e,t){}})}}),qx.Mixin.define("wialon.item.MPoi",{members:{getPoiImageUrl:function(e,t){return void 0!==t&&t||(t=32),e.icon?wialon.core.Session.getInstance().getBaseUrl()+e.icon+"?b="+t+"&v=1":""},setPoiImage:function(e,t,n){return"string"==typeof t?wialon.core.Uploader.getInstance().uploadFiles([],"resource/upload_poi_image",{fileUrl:t,itemId:this.getId(),poiId:e.id},n,!0):null===t||void 0===t?wialon.core.Uploader.getInstance().uploadFiles([],"resource/upload_poi_image",{fileUrl:"",itemId:this.getId(),poiId:e.id},n,!0):wialon.core.Uploader.getInstance().uploadFiles([t],"resource/upload_poi_image",{itemId:this.getId(),poiId:e.id},n,!0)}}}),qx.Bootstrap.define("qx.lang.normalize.String",{statics:{trim:function(){return this.replace(/^\s+|\s+$/g,"")}},defer:function(e){qx.core.Environment.get("ecmascript.string.trim")||(String.prototype.trim=e.trim)}}),qx.Bootstrap.define("qx.lang.normalize.Object",{statics:{keys:qx.Bootstrap.keys},defer:function(e){qx.core.Environment.get("ecmascript.object.keys")||(Object.keys=e.keys)}}),qx.Bootstrap.define("qx.lang.normalize.Function",{statics:{bind:function(e){var t=Array.prototype.slice,n=this;if("function"!=typeof n)throw new TypeError("Function.prototype.bind called on incompatible "+n);var r=t.call(arguments,1),i=function(){if(this instanceof i){var a=function(){};a.prototype=n.prototype;var s=new a,o=n.apply(s,r.concat(t.call(arguments)));return Object(o)===o?o:s}return n.apply(e,r.concat(t.call(arguments)))};return i}},defer:function(e){qx.core.Environment.get("ecmascript.function.bind")||(Function.prototype.bind=e.bind)}}),qx.Bootstrap.define("qx.lang.normalize.Error",{statics:{toString:function(){var e=this.name||"Error",t=this.message||"";return""===e&&""===t?"Error":""===e?t:""===t?e:e+": "+t}},defer:function(e){qx.core.Environment.get("ecmascript.error.toString")||(Error.prototype.toString=e.toString)}}),qx.Bootstrap.define("qx.lang.normalize.Date",{statics:{now:function(){return+new Date}},defer:function(e){qx.core.Environment.get("ecmascript.date.now")||(Date.now=e.now)}}),qx.Bootstrap.define("qx.core.Property",{statics:{__gatherDependency:function(){qx.core.Environment.get("module.events")&&(qx.event.type.Data,qx.event.dispatch.Direct)},__checks:{Boolean:"qx.core.Assert.assertBoolean(value, msg) || true",String:"qx.core.Assert.assertString(value, msg) || true",Number:"qx.core.Assert.assertNumber(value, msg) || true",Integer:"qx.core.Assert.assertInteger(value, msg) || true",PositiveNumber:"qx.core.Assert.assertPositiveNumber(value, msg) || true",PositiveInteger:"qx.core.Assert.assertPositiveInteger(value, msg) || true",Error:"qx.core.Assert.assertInstance(value, Error, msg) || true",RegExp:"qx.core.Assert.assertInstance(value, RegExp, msg) || true",Object:"qx.core.Assert.assertObject(value, msg) || true",Array:"qx.core.Assert.assertArray(value, msg) || true",Map:"qx.core.Assert.assertMap(value, msg) || true",Function:"qx.core.Assert.assertFunction(value, msg) || true",Date:"qx.core.Assert.assertInstance(value, Date, msg) || true",Node:"value !== null && value.nodeType !== undefined",Element:"value !== null && value.nodeType === 1 && value.attributes",Document:"value !== null && value.nodeType === 9 && value.documentElement",Window:"value !== null && value.document",Event:"value !== null && value.type !== undefined",Class:'value !== null && value.$$type === "Class"',Mixin:'value !== null && value.$$type === "Mixin"',Interface:'value !== null && value.$$type === "Interface"',Theme:'value !== null && value.$$type === "Theme"',Color:"qx.lang.Type.isString(value) && qx.util.ColorUtil.isValidPropertyValue(value)",Decorator:"value !== null && qx.theme.manager.Decoration.getInstance().isValidPropertyValue(value)",Font:"value !== null && qx.theme.manager.Font.getInstance().isDynamic(value)"},__dereference:{Node:!0,Element:!0,Document:!0,Window:!0,Event:!0},$$inherit:"inherit",$$store:{runtime:{},user:{},theme:{},inherit:{},init:{},useinit:{}},$$method:{get:{},set:{},reset:{},init:{},refresh:{},setRuntime:{},resetRuntime:{},setThemed:{},resetThemed:{}},$$allowedKeys:{name:"string",dereference:"boolean",inheritable:"boolean",nullable:"boolean",themeable:"boolean",refine:"boolean",init:null,apply:"string",event:"string",check:null,transform:"string",deferredInit:"boolean",validate:null},$$allowedGroupKeys:{name:"string",group:"object",mode:"string",themeable:"boolean"},$$inheritable:{},__executeOptimizedRefresh:function(e){var t=this.__getInheritablesOfClass(e);if(t.length)n=this.__createRefresher(t);else var n=function(){};e.prototype.$$refreshInheritables=n},__getInheritablesOfClass:function(e){for(var t=[];e;){var n=e.$$properties;if(n)for(var r in this.$$inheritable)n[r]&&n[r].inheritable&&t.push(r);e=e.superclass}return t},__createRefresher:function(e){for(var t=this.$$store.inherit,n=this.$$store.init,r=this.$$method.refresh,i=["var parent = this.getLayoutParent();","if (!parent) return;"],a=0,s=e.length;a<s;a++){var o=e[a];i.push("var value = parent.",t[o],";","if (value===undefined) value = parent.",n[o],";","this.",r[o],"(value);")}return new Function(i.join(""))},attachRefreshInheritables:function(e){e.prototype.$$refreshInheritables=function(){return qx.core.Property.__executeOptimizedRefresh(e),this.$$refreshInheritables()}},attachMethods:function(e,t,n){n.group?this.__attachGroupMethods(e,n,t):this.__attachPropertyMethods(e,n,t)},__attachGroupMethods:function(e,t,n){var r=qx.Bootstrap.firstUp(n),i=e.prototype,a=!0===t.themeable;qx.core.Environment.get("qx.debug")&&qx.core.Environment.get("qx.debug.property.level")>1&&qx.Bootstrap.debug("Generating property group: "+n);var s=[],o=[];if(a)var l=[],c=[];var u="var a=arguments[0] instanceof Array?arguments[0]:arguments;";if(s.push(u),a&&l.push(u),"shorthand"==t.mode){var d="a=qx.lang.Array.fromShortHand(qx.lang.Array.fromArguments(a));";s.push(d),a&&l.push(d)}for(var p=0,g=t.group,h=g.length;p<h;p++){if(qx.core.Environment.get("qx.debug")&&(!this.$$method.set[g[p]]||!this.$$method.reset[g[p]]))throw new Error("Cannot create property group '"+n+"' including non-existing property '"+g[p]+"'!");if(s.push("this.",this.$$method.set[g[p]],"(a[",p,"]);"),o.push("this.",this.$$method.reset[g[p]],"();"),a){if(qx.core.Environment.get("qx.debug")&&!this.$$method.setThemed[g[p]])throw new Error("Cannot add the non themable property '"+g[p]+"' to the themable property group '"+n+"'");l.push("this.",this.$$method.setThemed[g[p]],"(a[",p,"]);"),c.push("this.",this.$$method.resetThemed[g[p]],"();")}}this.$$method.set[n]="set"+r,i[this.$$method.set[n]]=new Function(s.join("")),this.$$method.reset[n]="reset"+r,i[this.$$method.reset[n]]=new Function(o.join("")),a&&(this.$$method.setThemed[n]="setThemed"+r,i[this.$$method.setThemed[n]]=new Function(l.join("")),this.$$method.resetThemed[n]="resetThemed"+r,i[this.$$method.resetThemed[n]]=new Function(c.join("")))},__attachPropertyMethods:function(e,t,n){var r=qx.Bootstrap.firstUp(n),i=e.prototype;qx.core.Environment.get("qx.debug")&&qx.core.Environment.get("qx.debug.property.level")>1&&qx.Bootstrap.debug("Generating property wrappers: "+n),void 0===t.dereference&&"string"==typeof t.check&&(t.dereference=this.__shouldBeDereferenced(t.check));var a=this.$$method,s=this.$$store;s.runtime[n]="$$runtime_"+n,s.user[n]="$$user_"+n,s.theme[n]="$$theme_"+n,s.init[n]="$$init_"+n,s.inherit[n]="$$inherit_"+n,s.useinit[n]="$$useinit_"+n,a.get[n]="get"+r,i[a.get[n]]=function(){return qx.core.Property.executeOptimizedGetter(this,e,n,"get")},a.set[n]="set"+r,i[a.set[n]]=function(t){return qx.core.Property.executeOptimizedSetter(this,e,n,"set",arguments)},a.reset[n]="reset"+r,i[a.reset[n]]=function(){return qx.core.Property.executeOptimizedSetter(this,e,n,"reset")},(t.inheritable||t.apply||t.event||t.deferredInit)&&(a.init[n]="init"+r,i[a.init[n]]=function(t){return qx.core.Property.executeOptimizedSetter(this,e,n,"init",arguments)},qx.core.Environment.get("qx.debug")&&(i[a.init[n]].$$propertyMethod=!0)),t.inheritable&&(a.refresh[n]="refresh"+r,i[a.refresh[n]]=function(t){return qx.core.Property.executeOptimizedSetter(this,e,n,"refresh",arguments)},qx.core.Environment.get("qx.debug")&&(i[a.refresh[n]].$$propertyMethod=!0)),a.setRuntime[n]="setRuntime"+r,i[a.setRuntime[n]]=function(t){return qx.core.Property.executeOptimizedSetter(this,e,n,"setRuntime",arguments)},a.resetRuntime[n]="resetRuntime"+r,i[a.resetRuntime[n]]=function(){return qx.core.Property.executeOptimizedSetter(this,e,n,"resetRuntime")},t.themeable&&(a.setThemed[n]="setThemed"+r,i[a.setThemed[n]]=function(t){return qx.core.Property.executeOptimizedSetter(this,e,n,"setThemed",arguments)},a.resetThemed[n]="resetThemed"+r,i[a.resetThemed[n]]=function(){return qx.core.Property.executeOptimizedSetter(this,e,n,"resetThemed")},qx.core.Environment.get("qx.debug")&&(i[a.setThemed[n]].$$propertyMethod=!0,i[a.resetThemed[n]].$$propertyMethod=!0)),"Boolean"===t.check&&(i["toggle"+r]=new Function("return this."+a.set[n]+"(!this."+a.get[n]+"())"),i["is"+r]=new Function("return this."+a.get[n]+"()"),qx.core.Environment.get("qx.debug")&&(i["toggle"+r].$$propertyMethod=!0,i["is"+r].$$propertyMethod=!0)),qx.core.Environment.get("qx.debug")&&(i[a.get[n]].$$propertyMethod=!0,i[a.set[n]].$$propertyMethod=!0,i[a.reset[n]].$$propertyMethod=!0,i[a.setRuntime[n]].$$propertyMethod=!0,i[a.resetRuntime[n]].$$propertyMethod=!0)},__shouldBeDereferenced:function(e){return!!this.__dereference[e]},__errors:{0:"Could not change or apply init value after constructing phase!",1:"Requires exactly one argument!",2:"Undefined value is not allowed!",3:"Does not allow any arguments!",4:"Null value is not allowed!",5:"Is invalid!"},error:function(e,t,n,r,i){var a="Error in property "+n+" of class "+e.constructor.classname+" in method "+this.$$method[r][n]+" with incoming value '"+i+"': ";throw new Error(a+(this.__errors[t]||"Unknown reason: "+t))},__unwrapFunctionFromCode:function(e,t,n,r,i,a){var s=this.$$method[r][n];if(qx.core.Environment.get("qx.debug")){qx.core.Environment.get("qx.debug.property.level")>1&&qx.Bootstrap.debug("Code["+this.$$method[r][n]+"]: "+i.join(""));try{t[s]=o(new Function("window","value",i.join("")))}catch(e){throw new Error("Malformed generated code to unwrap method: "+this.$$method[r][n]+"\n"+i.join(""))}}else t[s]=o(new Function("window","value",i.join("")));return qx.core.Environment.get("qx.aspects")&&(t[s]=qx.core.Aspect.wrap(e.classname+"."+s,t[s],"property")),qx.Bootstrap.setDisplayName(t[s],e.classname+".prototype",s),void 0===a?e[s]():qx.core.Environment.get("qx.debug")?e[s].apply(e,a):e[s](a[0]);function o(e){return function(t){return e.call(this,window,t)}}},executeOptimizedGetter:function(e,t,n,r){var i=t.$$properties[n],a=t.prototype,s=[],o=this.$$store;return s.push("if(this.",o.runtime[n],"!==undefined)"),s.push("return this.",o.runtime[n],";"),i.inheritable&&(s.push("else if(this.",o.inherit[n],"!==undefined)"),s.push("return this.",o.inherit[n],";"),s.push("else ")),s.push("if(this.",o.user[n],"!==undefined)"),s.push("return this.",o.user[n],";"),i.themeable&&(s.push("else if(this.",o.theme[n],"!==undefined)"),s.push("return this.",o.theme[n],";")),i.deferredInit&&void 0===i.init&&(s.push("else if(this.",o.init[n],"!==undefined)"),s.push("return this.",o.init[n],";")),s.push("else "),void 0!==i.init?i.inheritable?(s.push("var init=this.",o.init[n],";"),i.nullable?s.push("if(init==window.qx.core.Property.$$inherit)init=null;"):void 0!==i.init?s.push("return this.",o.init[n],";"):s.push('if(init==window.qx.core.Property.$$inherit)throw new Error("Inheritable property ',n," of an instance of ",t.classname,' is not (yet) ready!");'),s.push("return init;")):s.push("return this.",o.init[n],";"):i.inheritable||i.nullable?s.push("return null;"):s.push('throw new Error("Property ',n," of an instance of ",t.classname,' is not (yet) ready!");'),this.__unwrapFunctionFromCode(e,a,n,r,s)},executeOptimizedSetter:function(e,t,n,r,i){var a=t.$$properties[n],s=t.prototype,o=[],l="set"===r||"setThemed"===r||"setRuntime"===r||"init"===r&&void 0===a.init,c=a.apply||a.event||a.inheritable,u=this.__getStore(r,n);return this.__emitSetterPreConditions(o,a,n,r,l),l&&this.__emitIncomingValueTransformation(o,t,a,n),c&&this.__emitOldNewComparison(o,l,u,r),a.inheritable&&o.push("var inherit=prop.$$inherit;"),qx.core.Environment.get("window.qx.debug")&&l&&this.__emitIncomingValueValidation(o,a,t,n,r),c?this.__emitStoreComputedAndOldValue(o,a,n,r,l):this.__emitStoreValue(o,n,r,l),a.inheritable?this.__emitStoreInheritedPropertyValue(o,a,n,r):c&&this.__emitNormalizeUndefinedValues(o,a,n,r),c&&(this.__emitCallCallback(o,a,n,r),a.inheritable&&s._getChildren&&this.__emitRefreshChildrenValue(o,n)),l&&o.push("return value;"),this.__unwrapFunctionFromCode(e,s,n,r,o,i)},__getStore:function(e,t){if("setRuntime"===e||"resetRuntime"===e)var n=this.$$store.runtime[t];else n="setThemed"===e||"resetThemed"===e?this.$$store.theme[t]:"init"===e?this.$$store.init[t]:this.$$store.user[t];return n},__emitSetterPreConditions:function(e,t,n,r,i){qx.core.Environment.get("qx.debug")?(e.push("var prop=window.qx.core.Property;"),"init"===r&&e.push('if(this.$$initialized)prop.error(this,0,"',n,'","',r,'",value);'),"refresh"===r||(i?(e.push('if(arguments.length!==1)prop.error(this,1,"',n,'","',r,'",value);'),e.push('if(value===undefined)prop.error(this,2,"',n,'","',r,'",value);')):e.push('if(arguments.length!==0)prop.error(this,3,"',n,'","',r,'",value);'))):((!t.nullable||t.check||t.inheritable)&&e.push("var prop=window.qx.core.Property;"),"set"===r&&e.push('if(value===undefined)prop.error(this,2,"',n,'","',r,'",value);'))},__emitIncomingValueTransformation:function(e,t,n,r){n.transform&&e.push("value=this.",n.transform,"(value);"),n.validate&&("string"==typeof n.validate?e.push("this.",n.validate,"(value);"):n.validate instanceof Function&&(e.push(t.classname,".$$properties.",r),e.push(".validate.call(this, value);")))},__emitOldNewComparison:function(e,t,n,r){var i="reset"===r||"resetThemed"===r||"resetRuntime"===r;t?e.push("if(this.",n,"===value)return value;"):i&&e.push("if(this.",n,"===undefined)return;")},__emitIncomingValueValidation:qx.core.Environment.select("qx.debug",{true:function(e,t,n,r,i){if(t.nullable||e.push('if(value===null)prop.error(this,4,"',r,'","',i,'",value);'),void 0!==t.check){if(e.push("var msg = \"Invalid incoming value for property '"+r+"' of class '"+n.classname+"'\";"),t.nullable&&e.push("if(value!==null)"),t.inheritable&&e.push("if(value!==inherit)"),e.push("if("),void 0!==this.__checks[t.check])e.push("!(",this.__checks[t.check],")");else if(qx.Class.isDefined(t.check))e.push('qx.core.Assert.assertInstance(value, window.qx.Class.getByName("',t.check,'"), msg)');else if(qx.Interface&&qx.Interface.isDefined(t.check))e.push('qx.core.Assert.assertInterface(value, window.qx.Interface.getByName("',t.check,'"), msg)');else if("function"==typeof t.check)e.push("!",n.classname,".$$properties.",r),e.push(".check.call(this, value)");else if("string"==typeof t.check)e.push("!(",t.check,")");else{if(!(t.check instanceof Array))throw new Error("Could not add check to property "+r+" of class "+n.classname);e.push("window.qx.core.Assert.assertInArray(value, ",n.classname,".$$properties.",r,".check, msg)")}e.push(')prop.error(this,5,"',r,'","',i,'",value);')}},false:void 0}),__emitStoreValue:function(e,t,n,r){"setRuntime"===n?e.push("this.",this.$$store.runtime[t],"=value;"):"resetRuntime"===n?(e.push("if(this.",this.$$store.runtime[t],"!==undefined)"),e.push("delete this.",this.$$store.runtime[t],";")):"set"===n?e.push("this.",this.$$store.user[t],"=value;"):"reset"===n?(e.push("if(this.",this.$$store.user[t],"!==undefined)"),e.push("delete this.",this.$$store.user[t],";")):"setThemed"===n?e.push("this.",this.$$store.theme[t],"=value;"):"resetThemed"===n?(e.push("if(this.",this.$$store.theme[t],"!==undefined)"),e.push("delete this.",this.$$store.theme[t],";")):"init"===n&&r&&e.push("this.",this.$$store.init[t],"=value;")},__emitStoreComputedAndOldValue:function(e,t,n,r,i){t.inheritable?e.push("var computed, old=this.",this.$$store.inherit[n],";"):e.push("var computed, old;"),e.push("if(this.",this.$$store.runtime[n],"!==undefined){"),"setRuntime"===r?e.push("computed=this.",this.$$store.runtime[n],"=value;"):"resetRuntime"===r?(e.push("delete this.",this.$$store.runtime[n],";"),e.push("if(this.",this.$$store.user[n],"!==undefined)"),e.push("computed=this.",this.$$store.user[n],";"),e.push("else if(this.",this.$$store.theme[n],"!==undefined)"),e.push("computed=this.",this.$$store.theme[n],";"),e.push("else if(this.",this.$$store.init[n],"!==undefined){"),e.push("computed=this.",this.$$store.init[n],";"),e.push("this.",this.$$store.useinit[n],"=true;"),e.push("}")):(e.push("old=computed=this.",this.$$store.runtime[n],";"),"set"===r?e.push("this.",this.$$store.user[n],"=value;"):"reset"===r?e.push("delete this.",this.$$store.user[n],";"):"setThemed"===r?e.push("this.",this.$$store.theme[n],"=value;"):"resetThemed"===r?e.push("delete this.",this.$$store.theme[n],";"):"init"===r&&i&&e.push("this.",this.$$store.init[n],"=value;")),e.push("}"),e.push("else if(this.",this.$$store.user[n],"!==undefined){"),"set"===r?(t.inheritable||e.push("old=this.",this.$$store.user[n],";"),e.push("computed=this.",this.$$store.user[n],"=value;")):"reset"===r?(t.inheritable||e.push("old=this.",this.$$store.user[n],";"),e.push("delete this.",this.$$store.user[n],";"),e.push("if(this.",this.$$store.runtime[n],"!==undefined)"),e.push("computed=this.",this.$$store.runtime[n],";"),e.push("if(this.",this.$$store.theme[n],"!==undefined)"),e.push("computed=this.",this.$$store.theme[n],";"),e.push("else if(this.",this.$$store.init[n],"!==undefined){"),e.push("computed=this.",this.$$store.init[n],";"),e.push("this.",this.$$store.useinit[n],"=true;"),e.push("}")):("setRuntime"===r?e.push("computed=this.",this.$$store.runtime[n],"=value;"):t.inheritable?e.push("computed=this.",this.$$store.user[n],";"):e.push("old=computed=this.",this.$$store.user[n],";"),"setThemed"===r?e.push("this.",this.$$store.theme[n],"=value;"):"resetThemed"===r?e.push("delete this.",this.$$store.theme[n],";"):"init"===r&&i&&e.push("this.",this.$$store.init[n],"=value;")),e.push("}"),t.themeable&&(e.push("else if(this.",this.$$store.theme[n],"!==undefined){"),t.inheritable||e.push("old=this.",this.$$store.theme[n],";"),"setRuntime"===r?e.push("computed=this.",this.$$store.runtime[n],"=value;"):"set"===r?e.push("computed=this.",this.$$store.user[n],"=value;"):"setThemed"===r?e.push("computed=this.",this.$$store.theme[n],"=value;"):"resetThemed"===r?(e.push("delete this.",this.$$store.theme[n],";"),e.push("if(this.",this.$$store.init[n],"!==undefined){"),e.push("computed=this.",this.$$store.init[n],";"),e.push("this.",this.$$store.useinit[n],"=true;"),e.push("}")):"init"===r?(i&&e.push("this.",this.$$store.init[n],"=value;"),e.push("computed=this.",this.$$store.theme[n],";")):"refresh"===r&&e.push("computed=this.",this.$$store.theme[n],";"),e.push("}")),e.push("else if(this.",this.$$store.useinit[n],"){"),t.inheritable||e.push("old=this.",this.$$store.init[n],";"),"init"===r?i?e.push("computed=this.",this.$$store.init[n],"=value;"):e.push("computed=this.",this.$$store.init[n],";"):"set"!==r&&"setRuntime"!==r&&"setThemed"!==r&&"refresh"!==r||(e.push("delete this.",this.$$store.useinit[n],";"),"setRuntime"===r?e.push("computed=this.",this.$$store.runtime[n],"=value;"):"set"===r?e.push("computed=this.",this.$$store.user[n],"=value;"):"setThemed"===r?e.push("computed=this.",this.$$store.theme[n],"=value;"):"refresh"===r&&e.push("computed=this.",this.$$store.init[n],";")),e.push("}"),"set"!==r&&"setRuntime"!==r&&"setThemed"!==r&&"init"!==r||(e.push("else{"),"setRuntime"===r?e.push("computed=this.",this.$$store.runtime[n],"=value;"):"set"===r?e.push("computed=this.",this.$$store.user[n],"=value;"):"setThemed"===r?e.push("computed=this.",this.$$store.theme[n],"=value;"):"init"===r&&(i?e.push("computed=this.",this.$$store.init[n],"=value;"):e.push("computed=this.",this.$$store.init[n],";"),e.push("this.",this.$$store.useinit[n],"=true;")),e.push("}"))},__emitStoreInheritedPropertyValue:function(e,t,n,r){e.push("if(computed===undefined||computed===inherit){"),"refresh"===r?e.push("computed=value;"):e.push("var pa=this.getLayoutParent();if(pa)computed=pa.",this.$$store.inherit[n],";"),e.push("if((computed===undefined||computed===inherit)&&"),e.push("this.",this.$$store.init[n],"!==undefined&&"),e.push("this.",this.$$store.init[n],"!==inherit){"),e.push("computed=this.",this.$$store.init[n],";"),e.push("this.",this.$$store.useinit[n],"=true;"),e.push("}else{"),e.push("delete this.",this.$$store.useinit[n],";}"),e.push("}"),e.push("if(old===computed)return value;"),e.push("if(computed===inherit){"),e.push("computed=undefined;delete this.",this.$$store.inherit[n],";"),e.push("}"),e.push("else if(computed===undefined)"),e.push("delete this.",this.$$store.inherit[n],";"),e.push("else this.",this.$$store.inherit[n],"=computed;"),e.push("var backup=computed;"),void 0!==t.init&&"init"!==r?e.push("if(old===undefined)old=this.",this.$$store.init[n],";"):e.push("if(old===undefined)old=null;"),e.push("if(computed===undefined||computed==inherit)computed=null;")},__emitNormalizeUndefinedValues:function(e,t,n,r){"set"!==r&&"setRuntime"!==r&&"setThemed"!==r&&e.push("if(computed===undefined)computed=null;"),e.push("if(old===computed)return value;"),void 0!==t.init&&"init"!==r?e.push("if(old===undefined)old=this.",this.$$store.init[n],";"):e.push("if(old===undefined)old=null;")},__emitCallCallback:function(e,t,n,r){t.apply&&e.push("this.",t.apply,'(computed, old, "',n,'", "',r,'");'),t.event&&e.push("var reg=window.qx.event.Registration;","if(reg.hasListener(this, '",t.event,"')){","reg.fireEvent(this, '",t.event,"', window.qx.event.type.Data, [computed, old]",")}")},__emitRefreshChildrenValue:function(e,t){e.push("var a=this._getChildren();if(a)for(var i=0,l=a.length;i<l;i++){"),e.push("if(a[i].",this.$$method.refresh[t],")a[i].",this.$$method.refresh[t],"(backup);"),e.push("}")}}}),qx.Mixin.define("qx.data.MBinding",{construct:function(){this.__objectHash=this.toHashCode()},members:{__objectHash:null,bind:function(e,t,n,r){return qx.data.SingleValueBinding.bind(this,e,t,n,r)},removeBinding:function(e){qx.data.SingleValueBinding.removeBindingFromObject(this,e)},removeRelatedBindings:function(e){qx.data.SingleValueBinding.removeRelatedBindings(this,e)},removeAllBindings:function(){qx.data.SingleValueBinding.removeAllBindingsForObject(this)},getBindings:function(){return qx.data.SingleValueBinding.getAllBindingsForObject(this)}},destruct:function(){this.$$hash=this.__objectHash,this.removeAllBindings(),delete this.$$hash}}),qx.Bootstrap.define("qx.core.Aspect",{statics:{__registry:[],wrap:function(e,t,n){for(var r,i=[],a=[],s=this.__registry,o=0;o<s.length;o++)null!=(r=s[o]).type&&n!=r.type&&"*"!=r.type||null!=r.name&&!e.match(r.name)||(-1==r.pos?i.push(r.fcn):a.push(r.fcn));if(0===i.length&&0===a.length)return t;var l=function(){for(var r=0;r<i.length;r++)i[r].call(this,e,t,n,arguments);var s=t.apply(this,arguments);for(r=0;r<a.length;r++)a[r].call(this,e,t,n,arguments,s);return s};return"static"!==n&&(l.self=t.self,l.base=t.base),t.wrapper=l,l.original=t,l},addAdvice:function(e,t,n,r){this.__registry.push({fcn:e,pos:"before"===t?-1:1,type:n,name:r})}}}),qx.Bootstrap.define("qx.Interface",{statics:{define:function(e,t){if(t){t.extend&&"Array"!==qx.Bootstrap.getClass(t.extend)&&(t.extend=[t.extend]),qx.core.Environment.get("qx.debug")&&this.__validateConfig(e,t);var n=t.statics?t.statics:{};t.extend&&(n.$$extends=t.extend),t.properties&&(n.$$properties=t.properties),t.members&&(n.$$members=t.members),t.events&&(n.$$events=t.events)}else n={};return n.$$type="Interface",n.name=e,n.toString=this.genericToString,n.basename=qx.Bootstrap.createNamespace(e,n),qx.Interface.$$registry[e]=n,n},getByName:function(e){return this.$$registry[e]},isDefined:function(e){return void 0!==this.getByName(e)},getTotalNumber:function(){return qx.Bootstrap.objectGetLength(this.$$registry)},flatten:function(e){if(!e)return[];for(var t=e.concat(),n=0,r=e.length;n<r;n++)e[n].$$extends&&t.push.apply(t,this.flatten(e[n].$$extends));return t},__checkMembers:function(e,t,n,r,i){var a=n.$$members;if(a)for(var s in a)if(qx.Bootstrap.isFunction(a[s])){var o=this.__isPropertyMethod(t,s);if(!o&&!qx.Bootstrap.isFunction(e[s])){if(i)throw new Error('Implementation of method "'+s+'" is missing in class "'+t.classname+'" required by interface "'+n.name+'"');return!1}!0===r&&!o&&!qx.util.OOUtil.hasInterface(t,n)&&(e[s]=this.__wrapInterfaceMember(n,e[s],s,a[s]))}else if(void 0===typeof e[s]&&"function"!=typeof e[s]){if(i)throw new Error('Implementation of member "'+s+'" is missing in class "'+t.classname+'" required by interface "'+n.name+'"');return!1}if(!i)return!0},__isPropertyMethod:function(e,t){var n=t.match(/^(is|toggle|get|set|reset)(.*)$/);if(!n)return!1;var r=qx.Bootstrap.firstLow(n[2]);return!(!qx.util.OOUtil.getPropertyDefinition(e,r)||("is"==n[0]||"toggle"==n[0])&&"Boolean"!=qx.util.OOUtil.getPropertyDefinition(e,r).check)},__checkProperties:function(e,t,n){if(t.$$properties)for(var r in t.$$properties)if(!qx.util.OOUtil.getPropertyDefinition(e,r)){if(n)throw new Error('The property "'+r+'" is not supported by Class "'+e.classname+'"!');return!1}if(!n)return!0},__checkEvents:function(e,t,n){if(t.$$events)for(var r in t.$$events)if(!qx.util.OOUtil.supportsEvent(e,r)){if(n)throw new Error('The event "'+r+'" is not supported by Class "'+e.classname+'"!');return!1}if(!n)return!0},assertObject:function(e,t){var n=e.constructor;this.__checkMembers(e,n,t,!1,!0),this.__checkProperties(n,t,!0),this.__checkEvents(n,t,!0);var r=t.$$extends;if(r)for(var i=0,a=r.length;i<a;i++)this.assertObject(e,r[i])},assert:function(e,t,n){this.__checkMembers(e.prototype,e,t,n,!0),this.__checkProperties(e,t,!0),this.__checkEvents(e,t,!0);var r=t.$$extends;if(r)for(var i=0,a=r.length;i<a;i++)this.assert(e,r[i],n)},objectImplements:function(e,t){var n=e.constructor;if(!this.__checkMembers(e,n,t)||!this.__checkProperties(n,t)||!this.__checkEvents(n,t))return!1;var r=t.$$extends;if(r)for(var i=0,a=r.length;i<a;i++)if(!this.objectImplements(e,r[i]))return!1;return!0},classImplements:function(e,t){if(!this.__checkMembers(e.prototype,e,t)||!this.__checkProperties(e,t)||!this.__checkEvents(e,t))return!1;var n=t.$$extends;if(n)for(var r=0,i=n.length;r<i;r++)if(!this.has(e,n[r]))return!1;return!0},genericToString:function(){return"[Interface "+this.name+"]"},$$registry:{},__wrapInterfaceMember:qx.core.Environment.select("qx.debug",{true:function(e,t,n,r){function i(){return r.apply(this,arguments),t.apply(this,arguments)}return t.wrapper=i,i},default:function(e,t,n,r){}}),__allowedKeys:qx.core.Environment.select("qx.debug",{true:{extend:"object",statics:"object",members:"object",properties:"object",events:"object"},default:null}),__validateConfig:qx.core.Environment.select("qx.debug",{true:function(e,t){if(qx.core.Environment.get("qx.debug")){var n=this.__allowedKeys;for(var r in t){if(void 0===n[r])throw new Error('The configuration key "'+r+'" in class "'+e+'" is not allowed!');if(null==t[r])throw new Error("Invalid key '"+r+"' in interface '"+e+"'! The value is undefined/null!");if(null!==n[r]&&typeof t[r]!==n[r])throw new Error('Invalid type of key "'+r+'" in interface "'+e+'"! The type of the key must be "'+n[r]+'"!')}for(var i=["statics","members","properties","events"],a=0,s=i.length;a<s;a++)if(void 0!==t[r=i[a]]&&(-1!=["Array","RegExp","Date"].indexOf(qx.Bootstrap.getClass(t[r]))||void 0!==t[r].classname))throw new Error('Invalid key "'+r+'" in interface "'+e+'"! The value needs to be a map!');if(t.extend){a=0;var o=t.extend;for(s=o.length;a<s;a++){if(null==o[a])throw new Error("Extends of interfaces must be interfaces. The extend number '"+a+"1' in interface '"+e+"' is undefined/null!");if("Interface"!==o[a].$$type)throw new Error("Extends of interfaces must be interfaces. The extend number '"+a+"1' in interface '"+e+"' is not an interface!")}}if(t.statics)for(var r in t.statics){if(r.toUpperCase()!==r)throw new Error('Invalid key "'+r+'" in interface "'+e+'"! Static constants must be all uppercase.');switch(typeof t.statics[r]){case"boolean":case"string":case"number":break;default:throw new Error('Invalid key "'+r+'" in interface "'+e+'"! Static constants must be all of a primitive type.')}}}},default:function(e,t){}})}}),qx.Bootstrap.define("qx.Class",{statics:{__Property:qx.core.Environment.get("module.property")?qx.core.Property:null,define:function(e,t){t||(t={}),t.include&&"Array"!==qx.Bootstrap.getClass(t.include)&&(t.include=[t.include]),t.implement&&"Array"!==qx.Bootstrap.getClass(t.implement)&&(t.implement=[t.implement]);var n=!1;if(t.hasOwnProperty("extend")||t.type||(t.type="static",n=!0),qx.core.Environment.get("qx.debug"))try{this.__validateConfig(e,t)}catch(e){throw n&&(e.message='Assumed static class because no "extend" key was found. '+e.message),e}var r=this.__createClass(e,t.type,t.extend,t.statics,t.construct,t.destruct,t.include);if(t.extend){if(t.properties&&this.__addProperties(r,t.properties,!0),t.members&&this.__addMembers(r,t.members,!0,!0,!1),t.events&&this.__addEvents(r,t.events,!0),t.include)for(var i=0,a=t.include.length;i<a;i++)this.__addMixin(r,t.include[i],!1)}else if(t.hasOwnProperty("extend")&&qx.core.Environment.get("qx.debug"))throw new Error('"extend" parameter is null or undefined');if(t.environment)for(var s in t.environment)qx.core.Environment.add(s,t.environment[s]);if(t.implement)for(i=0,a=t.implement.length;i<a;i++)this.__addInterface(r,t.implement[i]);return qx.core.Environment.get("qx.debug")&&this.__validateAbstractInterfaces(r),t.defer&&(t.defer.self=r,t.defer(r,r.prototype,{add:function(e,t){var n={};n[e]=t,qx.Class.__addProperties(r,n,!0)}})),r},undefine:function(e){delete this.$$registry[e];for(var t=e.split("."),n=[window],r=0;r<t.length;r++)n.push(n[r][t[r]]);for(r=n.length-1;r>=1;r--){var i=n[r],a=n[r-1];if(!qx.Bootstrap.isFunction(i)&&0!==qx.Bootstrap.objectGetLength(i))break;delete a[t[r-1]]}},isDefined:qx.util.OOUtil.classIsDefined,getTotalNumber:function(){return qx.Bootstrap.objectGetLength(this.$$registry)},getByName:qx.Bootstrap.getByName,include:function(e,t){if(qx.core.Environment.get("qx.debug")){if(!t)throw new Error("The mixin to include into class '"+e.classname+"' is undefined/null!");qx.Mixin.isCompatible(t,e)}qx.Class.__addMixin(e,t,!1)},patch:function(e,t){if(qx.core.Environment.get("qx.debug")){if(!t)throw new Error("The mixin to patch class '"+e.classname+"' is undefined/null!");qx.Mixin.isCompatible(t,e)}qx.Class.__addMixin(e,t,!0)},isSubClassOf:function(e,t){return!!e&&(e==t||e.prototype instanceof t)},getPropertyDefinition:qx.util.OOUtil.getPropertyDefinition,getProperties:function(e){for(var t=[];e;)e.$$properties&&t.push.apply(t,Object.keys(e.$$properties)),e=e.superclass;return t},getByProperty:function(e,t){for(;e;){if(e.$$properties&&e.$$properties[t])return e;e=e.superclass}return null},hasProperty:qx.util.OOUtil.hasProperty,getEventType:qx.util.OOUtil.getEventType,supportsEvent:qx.util.OOUtil.supportsEvent,hasOwnMixin:function(e,t){return e.$$includes&&-1!==e.$$includes.indexOf(t)},getByMixin:function(e,t){for(var n,r,i;e;){if(e.$$includes)for(r=0,i=(n=e.$$flatIncludes).length;r<i;r++)if(n[r]===t)return e;e=e.superclass}return null},getMixins:qx.util.OOUtil.getMixins,hasMixin:function(e,t){return!!this.getByMixin(e,t)},hasOwnInterface:function(e,t){return e.$$implements&&-1!==e.$$implements.indexOf(t)},getByInterface:qx.util.OOUtil.getByInterface,getInterfaces:function(e){for(var t=[];e;)e.$$implements&&t.push.apply(t,e.$$flatImplements),e=e.superclass;return t},hasInterface:qx.util.OOUtil.hasInterface,implementsInterface:function(e,t){var n=e.constructor;return!!this.hasInterface(n,t)||!!qx.Interface.objectImplements(e,t)||!!qx.Interface.classImplements(n,t)},getInstance:function(){return this.$$instance||(this.$$allowconstruct=!0,this.$$instance=new this,delete this.$$allowconstruct),this.$$instance},genericToString:function(){return"[Class "+this.classname+"]"},$$registry:qx.Bootstrap.$$registry,__allowedKeys:qx.core.Environment.select("qx.debug",{true:{type:"string",extend:"function",implement:"object",include:"object",construct:"function",statics:"object",properties:"object",members:"object",environment:"object",events:"object",defer:"function",destruct:"function"},default:null}),__staticAllowedKeys:qx.core.Environment.select("qx.debug",{true:{type:"string",statics:"object",environment:"object",defer:"function"},default:null}),__validateConfig:qx.core.Environment.select("qx.debug",{true:function(e,t){if(t.type&&"static"!==t.type&&"abstract"!==t.type&&"singleton"!==t.type)throw new Error('Invalid type "'+t.type+'" definition for class "'+e+'"!');if(t.type&&"static"!==t.type&&!t.extend)throw new Error('Invalid config in class "'+e+'"! Every non-static class has to extend at least the "qx.core.Object" class.');var n="static"===t.type?this.__staticAllowedKeys:this.__allowedKeys;for(var r in t){if(!n[r])throw new Error('The configuration key "'+r+'" in class "'+e+'" is not allowed!');if(null==t[r])throw new Error('Invalid key "'+r+'" in class "'+e+'"! The value is undefined/null!');if(typeof t[r]!==n[r])throw new Error('Invalid type of key "'+r+'" in class "'+e+'"! The type of the key must be "'+n[r]+'"!')}for(var i=["statics","properties","members","environment","settings","variants","events"],a=0,s=i.length;a<s;a++)if(void 0!==t[r=i[a]]&&(void 0!==t[r].$$hash||!qx.Bootstrap.isObject(t[r])))throw new Error('Invalid key "'+r+'" in class "'+e+'"! The value needs to be a map!');if(t.include){if("Array"!==qx.Bootstrap.getClass(t.include))throw new Error('Invalid include definition in class "'+e+'"! Only mixins and arrays of mixins are allowed!');for(a=0,s=(o=t.include).length;a<s;a++)if(null==o[a]||"Mixin"!==o[a].$$type)throw new Error('The include definition in class "'+e+'" contains an invalid mixin at position '+a+": "+o[a])}if(t.implement){if("Array"!==qx.Bootstrap.getClass(t.implement))throw new Error('Invalid implement definition in class "'+e+'"! Only interfaces and arrays of interfaces are allowed!');var o;for(a=0,s=(o=t.implement).length;a<s;a++)if(null==o[a]||"Interface"!==o[a].$$type)throw new Error('The implement definition in class "'+e+'" contains an invalid interface at position '+a+": "+o[a])}if(t.include)try{qx.Mixin.checkCompatibility(t.include)}catch(t){throw new Error('Error in include definition of class "'+e+'"! '+t.message)}if(t.environment)for(var r in t.environment)if(r.substr(0,r.indexOf("."))!=e.substr(0,e.indexOf(".")))throw new Error('Forbidden environment setting "'+r+'" found in "'+e+'". It is forbidden to define a environment setting for an external namespace!');if(t.settings)for(var r in t.settings)if(r.substr(0,r.indexOf("."))!=e.substr(0,e.indexOf(".")))throw new Error('Forbidden setting "'+r+'" found in "'+e+'". It is forbidden to define a default setting for an external namespace!');if(t.variants)for(var r in t.variants)if(r.substr(0,r.indexOf("."))!=e.substr(0,e.indexOf(".")))throw new Error('Forbidden variant "'+r+'" found in "'+e+'". It is forbidden to define a variant for an external namespace!')},default:function(e,t){}}),__validateAbstractInterfaces:qx.core.Environment.select("qx.debug",{true:function(e){for(var t=e.superclass;t&&"abstract"===t.$$classtype;){var n=t.$$implements;if(n)for(var r=0;r<n.length;r++)qx.Interface.assert(e,n[r],!0);t=t.superclass}},default:function(e){}}),__createClass:function(e,t,n,r,i,a,s){var o;if(n||0!=qx.core.Environment.get("qx.aspects")){if(o={},n&&(i||(i=this.__createDefaultConstructor()),o=this.__needsConstructorWrapper(n,s)?this.__wrapConstructor(i,e,t):i,"singleton"===t&&(o.getInstance=this.getInstance),qx.Bootstrap.setDisplayName(i,e,"constructor")),r){var l;qx.Bootstrap.setDisplayNames(r,e);for(var c=0,u=Object.keys(r),d=u.length;c<d;c++){var p=r[l=u[c]];qx.core.Environment.get("qx.aspects")?(p instanceof Function&&(p=qx.core.Aspect.wrap(e+"."+l,p,"static")),o[l]=p):o[l]=p}}}else o=r||{},qx.Bootstrap.setDisplayNames(o,e);var g=e?qx.Bootstrap.createNamespace(e,o):"";return o.name=o.classname=e,o.basename=g,o.$$type="Class",t&&(o.$$classtype=t),o.hasOwnProperty("toString")||(o.toString=this.genericToString),n&&(qx.Bootstrap.extendClass(o,i,n,e,g),a&&(qx.core.Environment.get("qx.aspects")&&(a=qx.core.Aspect.wrap(e,a,"destructor")),o.$$destructor=a,qx.Bootstrap.setDisplayName(a,e,"destruct"))),this.$$registry[e]=o,o},__addEvents:function(e,t,n){if(qx.core.Environment.get("qx.debug")){if("object"!=typeof t||"Array"===qx.Bootstrap.getClass(t))throw new Error(e.classname+": the events must be defined as map!");for(var r in t)if("string"!=typeof t[r])throw new Error(e.classname+"/"+r+": the event value needs to be a string with the class name of the event object which will be fired.");if(e.$$events&&!0!==n)for(var r in t)if(void 0!==e.$$events[r]&&e.$$events[r]!==t[r])throw new Error(e.classname+"/"+r+": the event value/type cannot be changed from "+e.$$events[r]+" to "+t[r])}if(e.$$events)for(var r in t)e.$$events[r]=t[r];else e.$$events=t},__addProperties:function(e,t,n){if(!qx.core.Environment.get("module.property"))throw new Error("Property module disabled.");var r;void 0===n&&(n=!1);var i=e.prototype;for(var a in t){if(r=t[a],qx.core.Environment.get("qx.debug")&&this.__validateProperty(e,a,r,n),r.name=a,r.refine||(void 0===e.$$properties&&(e.$$properties={}),e.$$properties[a]=r),void 0!==r.init&&(e.prototype["$$init_"+a]=r.init),void 0!==r.event){if(!qx.core.Environment.get("module.events"))throw new Error("Events module not enabled.");var s={};s[r.event]="qx.event.type.Data",this.__addEvents(e,s,n)}r.inheritable&&(this.__Property.$$inheritable[a]=!0,i.$$refreshInheritables||this.__Property.attachRefreshInheritables(e)),r.refine||this.__Property.attachMethods(e,a,r)}},__validateProperty:qx.core.Environment.select("qx.debug",{true:function(e,t,n,r){if(!qx.core.Environment.get("module.property"))throw new Error("Property module disabled.");var i=this.hasProperty(e,t);if(i){var a=this.getPropertyDefinition(e,t);if(n.refine&&void 0===a.init)throw new Error("Could not refine an init value if there was previously no init value defined. Property '"+t+"' of class '"+e.classname+"'.")}if(!i&&n.refine)throw new Error("Could not refine non-existent property: '"+t+"' of class: '"+e.classname+"'!");if(i&&!r)throw new Error("Class "+e.classname+" already has a property: "+t+"!");if(i&&r){if(!n.refine)throw new Error('Could not refine property "'+t+'" without a "refine" flag in the property definition! This class: '+e.classname+", original class: "+this.getByProperty(e,t).classname+".");for(var s in n)if("init"!==s&&"refine"!==s)throw new Error("Class "+e.classname+" could not refine property: "+t+"! Key: "+s+" could not be refined!")}var o=n.group?this.__Property.$$allowedGroupKeys:this.__Property.$$allowedKeys;for(var s in n){if(void 0===o[s])throw new Error('The configuration key "'+s+'" of property "'+t+'" in class "'+e.classname+'" is not allowed!');if(void 0===n[s])throw new Error('Invalid key "'+s+'" of property "'+t+'" in class "'+e.classname+'"! The value is undefined: '+n[s]);if(null!==o[s]&&typeof n[s]!==o[s])throw new Error('Invalid type of key "'+s+'" of property "'+t+'" in class "'+e.classname+'"! The type of the key must be "'+o[s]+'"!')}if(null!=n.transform&&"string"!=typeof n.transform)throw new Error('Invalid transform definition of property "'+t+'" in class "'+e.classname+'"! Needs to be a String.');if(null!=n.check&&!qx.Bootstrap.isString(n.check)&&!qx.Bootstrap.isArray(n.check)&&!qx.Bootstrap.isFunction(n.check))throw new Error('Invalid check definition of property "'+t+'" in class "'+e.classname+'"! Needs to be a String, Array or Function.')},default:null}),__addMembers:function(e,t,n,r,i){var a,s,o=e.prototype;qx.Bootstrap.setDisplayNames(t,e.classname+".prototype");for(var l=0,c=Object.keys(t),u=c.length;l<u;l++){if(s=t[a=c[l]],qx.core.Environment.get("qx.debug")){if(void 0!==o[a]&&"_"==a.charAt(0)&&"_"==a.charAt(1))throw new Error('Overwriting private member "'+a+'" of Class "'+e.classname+'" is not allowed!');if(!0!==n&&o.hasOwnProperty(a))throw new Error('Overwriting member "'+a+'" of Class "'+e.classname+'" is not allowed!');if(void 0!=o[a]&&o[a].$$propertyMethod)throw new Error('Overwriting generated property method "'+a+'" of Class "'+e.classname+'" is not allowed!')}!1!==r&&s instanceof Function&&null==s.$$type&&(1==i?s=this.__mixinMemberWrapper(s,o[a]):(o[a]&&(s.base=o[a]),s.self=e),qx.core.Environment.get("qx.aspects")&&(s=qx.core.Aspect.wrap(e.classname+"."+a,s,"member"))),o[a]=s}},__mixinMemberWrapper:function(e,t){return t?function(){var n=e.base;e.base=t;var r=e.apply(this,arguments);return e.base=n,r}:e},__addInterface:function(e,t){if(qx.core.Environment.get("qx.debug")){if(!e||!t)throw new Error("Incomplete parameters!");if(this.hasOwnInterface(e,t))throw new Error('Interface "'+t.name+'" is already used by Class "'+e.classname+"!");"abstract"!==e.$$classtype&&qx.Interface.assert(e,t,!0)}var n=qx.Interface.flatten([t]);e.$$implements?(e.$$implements.push(t),e.$$flatImplements.push.apply(e.$$flatImplements,n)):(e.$$implements=[t],e.$$flatImplements=n)},__retrospectWrapConstruct:function(e){for(var t=e.classname,n=this.__wrapConstructor(e,t,e.$$classtype),r=0,i=(a=Object.keys(e)).length;r<i;r++)n[l=a[r]]=e[l];n.prototype=e.prototype;var a,s=e.prototype;for(r=0,i=(a=Object.keys(s)).length;r<i;r++){var o=s[l=a[r]];o&&o.self==e&&(o.self=n)}for(var l in this.$$registry){var c=this.$$registry[l];c&&(c.base==e&&(c.base=n),c.superclass==e&&(c.superclass=n),c.$$original&&(c.$$original.base==e&&(c.$$original.base=n),c.$$original.superclass==e&&(c.$$original.superclass=n)))}return qx.Bootstrap.createNamespace(t,n),this.$$registry[t]=n,n},__addMixin:function(e,t,n){if(qx.core.Environment.get("qx.debug")&&(!e||!t))throw new Error("Incomplete parameters!");if(!this.hasMixin(e,t)){var r=e.$$original;t.$$constructor&&!r&&(e=this.__retrospectWrapConstruct(e));for(var i,a=qx.Mixin.flatten([t]),s=0,o=a.length;s<o;s++)(i=a[s]).$$events&&this.__addEvents(e,i.$$events,n),i.$$properties&&this.__addProperties(e,i.$$properties,n),i.$$members&&this.__addMembers(e,i.$$members,n,n,n);e.$$includes?(e.$$includes.push(t),e.$$flatIncludes.push.apply(e.$$flatIncludes,a)):(e.$$includes=[t],e.$$flatIncludes=a)}},__createDefaultConstructor:function(){return function e(){e.base.apply(this,arguments)}},__needsConstructorWrapper:function(e,t){if(qx.core.Environment.get("qx.debug"))return!0;if(e&&e.$$includes)for(var n=e.$$flatIncludes,r=0,i=n.length;r<i;r++)if(n[r].$$constructor)return!0;if(t){var a=qx.Mixin.flatten(t);for(r=0,i=a.length;r<i;r++)if(a[r].$$constructor)return!0}return!1},__wrapConstructor:function(e,t,n){var r=function(){var e=r;if(qx.core.Environment.get("qx.debug")){if(!(this instanceof e))throw new Error("Please initialize '"+t+"' objects using the new keyword!");if("abstract"===n){if(this.classname===t)throw new Error("The class ',"+t+"' is abstract! It is not possible to instantiate it.")}else if("singleton"===n&&!e.$$allowconstruct)throw new Error("The class '"+t+"' is a singleton! It is not possible to instantiate it directly. Use the static getInstance() method instead.")}var i=e.$$original.apply(this,arguments);if(e.$$includes)for(var a=e.$$flatIncludes,s=0,o=a.length;s<o;s++)a[s].$$constructor&&a[s].$$constructor.apply(this,arguments);return qx.core.Environment.get("qx.debug")&&this.classname===t&&(this.$$initialized=!0),i};if(qx.core.Environment.get("qx.aspects")){var i=qx.core.Aspect.wrap(t,r,"constructor");r.$$original=e,r.constructor=i,r=i}return r.$$original=e,e.wrapper=r,r}},defer:function(){if(qx.core.Environment.get("qx.aspects"))for(var e in qx.Bootstrap.$$registry){var t=qx.Bootstrap.$$registry[e];for(var n in t)t[n]instanceof Function&&(t[n]=qx.core.Aspect.wrap(e+"."+n,t[n],"static"))}}}),qx.Class.define("qx.data.SingleValueBinding",{statics:{__bindings:{},__bindingsByTarget:{},bind:function(e,t,n,r,i){qx.core.Environment.get("qx.debug")&&(qx.core.Assert.assertObject(e,"sourceObject"),qx.core.Assert.assertString(t,"sourcePropertyChain"),qx.core.Assert.assertObject(n,"targetObject"),qx.core.Assert.assertString(r,"targetPropertyChain"));var a=this.__setUpTargetBinding(e,t,n,r,i),s=t.split("."),o=this.__checkForArrayInPropertyChain(s),l=[],c=[],u=[],d=[],p=e;try{for(var g=0;g<s.length;g++){if(""!==o[g]?d.push("change"):d.push(this.__getEventNameForProperty(p,s[g])),l[g]=p,g==s.length-1)if(""!==o[g]){var h="last"===o[g]?p.length-1:o[g],m=p.getItem(h);this.__setInitialValue(m,n,r,i,e),u[g]=this.__bindEventToProperty(p,d[g],n,r,i,o[g])}else null!=s[g]&&null!=p["get"+qx.lang.String.firstUp(s[g])]&&(m=p["get"+qx.lang.String.firstUp(s[g])](),this.__setInitialValue(m,n,r,i,e)),u[g]=this.__bindEventToProperty(p,d[g],n,r,i);else{var f={index:g,propertyNames:s,sources:l,listenerIds:u,arrayIndexValues:o,targetObject:n,targetPropertyChain:r,options:i,listeners:c},_=qx.lang.Function.bind(this.__chainListener,this,f);c.push(_),u[g]=p.addListener(d[g],_)}if(null==p["get"+qx.lang.String.firstUp(s[g])]?p=void 0:""!==o[g]?(h="last"===o[g]?p.length-1:o[g],p=p["get"+qx.lang.String.firstUp(s[g])](h)):null===(p=p["get"+qx.lang.String.firstUp(s[g])]())&&s.length-1!=g&&(p=void 0),!p){this.__setInitialValue(p,n,r,i,e);break}}}catch(e){for(g=0;g<l.length;g++)l[g]&&u[g]&&l[g].removeListenerById(u[g]);var v=a.targets,x=a.listenerIds;for(g=0;g<v.length;g++)v[g]&&x[g]&&v[g].removeListenerById(x[g]);throw e}var b={type:"deepBinding",listenerIds:u,sources:l,targetListenerIds:a.listenerIds,targets:a.targets};return this.__storeBinding(b,e,t,n,r),b},__chainListener:function(e){e.options&&e.options.onUpdate&&e.options.onUpdate(e.sources[e.index],e.targetObject);for(var t=e.index+1;t<e.propertyNames.length;t++){var n=e.sources[t];e.sources[t]=null,n&&n.removeListenerById(e.listenerIds[t])}for(n=e.sources[e.index],t=e.index+1;t<e.propertyNames.length;t++){if(n=""!==e.arrayIndexValues[t-1]?n["get"+qx.lang.String.firstUp(e.propertyNames[t-1])](e.arrayIndexValues[t-1]):n["get"+qx.lang.String.firstUp(e.propertyNames[t-1])](),e.sources[t]=n,!n){if(e.options&&e.options.converter){var r=!1;if(e.options.ignoreConverter){var i=e.propertyNames.slice(0,t).join(".").match(new RegExp("^"+e.options.ignoreConverter));r=!!i&&i.length>0}r?this.__resetTargetValue(e.targetObject,e.targetPropertyChain):this.__setTargetValue(e.targetObject,e.targetPropertyChain,e.options.converter())}else this.__resetTargetValue(e.targetObject,e.targetPropertyChain);break}if(t==e.propertyNames.length-1)if(qx.Class.implementsInterface(n,qx.data.IListData)){var a="last"===e.arrayIndexValues[t]?n.length-1:e.arrayIndexValues[t],s=n.getItem(a);this.__setInitialValue(s,e.targetObject,e.targetPropertyChain,e.options,e.sources[e.index]),e.listenerIds[t]=this.__bindEventToProperty(n,"change",e.targetObject,e.targetPropertyChain,e.options,e.arrayIndexValues[t])}else{null!=e.propertyNames[t]&&null!=n["get"+qx.lang.String.firstUp(e.propertyNames[t])]&&(s=n["get"+qx.lang.String.firstUp(e.propertyNames[t])](),this.__setInitialValue(s,e.targetObject,e.targetPropertyChain,e.options,e.sources[e.index]));var o=this.__getEventNameForProperty(n,e.propertyNames[t]);e.listenerIds[t]=this.__bindEventToProperty(n,o,e.targetObject,e.targetPropertyChain,e.options)}else{if(null==e.listeners[t]){var l=qx.lang.Function.bind(this.__chainListener,this,e);e.listeners.push(l)}o=qx.Class.implementsInterface(n,qx.data.IListData)?"change":this.__getEventNameForProperty(n,e.propertyNames[t]),e.listenerIds[t]=n.addListener(o,e.listeners[t])}}},__setUpTargetBinding:function(e,t,n,r,i){for(var a=r.split("."),s=this.__checkForArrayInPropertyChain(a),o=[],l=[],c=[],u=[],d=n,p=0;p<a.length-1;p++){if(""!==s[p])u.push("change");else try{u.push(this.__getEventNameForProperty(d,a[p]))}catch(e){break}o[p]=d;var g=function(){for(var u=p+1;u<a.length-1;u++){var d=o[u];o[u]=null,d&&d.removeListenerById(c[u])}for(d=o[p],u=p+1;u<a.length-1;u++){var h=qx.lang.String.firstUp(a[u-1]);if(""!==s[u-1]){var m="last"===s[u-1]?d.getLength()-1:s[u-1];d=d["get"+h](m)}else d=d["get"+h]();if(o[u]=d,null==l[u]&&l.push(g),qx.Class.implementsInterface(d,qx.data.IListData))var f="change";else try{f=qx.data.SingleValueBinding.__getEventNameForProperty(d,a[u])}catch(e){break}c[u]=d.addListener(f,l[u])}qx.data.SingleValueBinding.updateTarget(e,t,n,r,i)};l.push(g),c[p]=d.addListener(u[p],g);var h=qx.lang.String.firstUp(a[p]);if(!(d=null==d["get"+h]?null:""!==s[p]?d["get"+h](s[p]):d["get"+h]()))break}return{listenerIds:c,targets:o}},updateTarget:function(e,t,n,r,i){var a=this.resolvePropertyChain(e,t);a=qx.data.SingleValueBinding.__convertValue(a,n,r,i,e),this.__setTargetValue(n,r,a)},resolvePropertyChain:function(e,t){var n=this.__getPropertyChainArray(t);return this.__getTargetFromChain(e,n,n.length)},__getEventNameForProperty:function(e,t){var n=this.__getEventForProperty(e,t);if(null==n)if(qx.Class.supportsEvent(e.constructor,t))n=t;else{if(!qx.Class.supportsEvent(e.constructor,"change"+qx.lang.String.firstUp(t)))throw new qx.core.AssertionError("Binding property "+t+" of object "+e+" not possible: No event available. ");n="change"+qx.lang.String.firstUp(t)}return n},__resetTargetValue:function(e,t){var n=this.__getPropertyChainArray(t),r=this.__getTargetFromChain(e,n);if(null!=r){var i=n[n.length-1];if(this.__getArrayIndex(i))return void this.__setTargetValue(e,t,null);void 0!=r["reset"+qx.lang.String.firstUp(i)]?r["reset"+qx.lang.String.firstUp(i)]():r["set"+qx.lang.String.firstUp(i)](null)}},__setTargetValue:function(e,t,n){var r=this.__getPropertyChainArray(t),i=this.__getTargetFromChain(e,r);if(i){var a=r[r.length-1],s=this.__getArrayIndex(a);s?("last"===s&&(s=i.length-1),i.setItem(s,n)):i["set"+qx.lang.String.firstUp(a)](n)}},__getArrayIndex:function(e){var t=e.match(/^\[(\d+|last)\]$/);return t?t[1]:null},__getPropertyChainArray:function(e){return e.replace(/\[/g,".[").split(".").filter(function(e){return""!==e})},__getTargetFromChain:function(e,t,n){n=n||t.length-1;for(var r=e,i=0;i<n;i++)try{var a=t[i],s=this.__getArrayIndex(a);s?("last"===s&&(s=r.length-1),r=r.getItem(s)):r=r["get"+qx.lang.String.firstUp(a)]()}catch(e){return null}return r},__setInitialValue:function(e,t,n,r,i){if(void 0===(e=this.__convertValue(e,t,n,r,i))&&this.__resetTargetValue(t,n),void 0!==e)try{this.__setTargetValue(t,n,e),r&&r.onUpdate&&r.onUpdate(i,t,e)}catch(n){if(!(n instanceof qx.core.ValidationError))throw n;r&&r.onSetFail?r.onSetFail(n):qx.log.Logger.warn("Failed so set value "+e+" on "+t+". Error message: "+n)}},__checkForArrayInPropertyChain:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];if(qx.lang.String.endsWith(r,"]")){var i=r.substring(r.indexOf("[")+1,r.indexOf("]"));if(r.indexOf("]")!=r.length-1)throw new Error("Please use only one array at a time: "+r+" does not work.");if("last"!==i&&(""==i||isNaN(parseInt(i,10))))throw new Error("No number or 'last' value hast been given in an array binding: "+r+" does not work.");0!=r.indexOf("[")?(e[n]=r.substring(0,r.indexOf("[")),t[n]="",t[n+1]=i,e.splice(n+1,0,"item"),n++):(t[n]=i,e.splice(n,1,"item"))}else t[n]=""}return t},__bindEventToProperty:function(e,t,n,r,i,a){if(qx.core.Environment.get("qx.debug")){var s=qx.Class.getEventType(e.constructor,t);qx.core.Assert.assertEquals("qx.event.type.Data",s,t+" is not an data (qx.event.type.Data) event on "+e+".")}var o=function(a,s){if(""!==a){"last"===a&&(a=e.length-1),void 0===(c=e.getItem(a))&&qx.data.SingleValueBinding.__resetTargetValue(n,r);var o=s.getData().start,l=s.getData().end;if(a<o||a>l)return}else var c=s.getData();qx.core.Environment.get("qx.debug.databinding")&&(qx.log.Logger.debug("Binding executed from "+e+" by "+t+" to "+n+" ("+r+")"),qx.log.Logger.debug("Data before conversion: "+c)),c=qx.data.SingleValueBinding.__convertValue(c,n,r,i,e),qx.core.Environment.get("qx.debug.databinding")&&qx.log.Logger.debug("Data after conversion: "+c);try{void 0!==c?qx.data.SingleValueBinding.__setTargetValue(n,r,c):qx.data.SingleValueBinding.__resetTargetValue(n,r),i&&i.onUpdate&&i.onUpdate(e,n,c)}catch(e){if(!(e instanceof qx.core.ValidationError))throw e;i&&i.onSetFail?i.onSetFail(e):qx.log.Logger.warn("Failed so set value "+c+" on "+n+". Error message: "+e)}};return a||(a=""),o=qx.lang.Function.bind(o,e,a),e.addListener(t,o)},__storeBinding:function(e,t,n,r,i){var a;a=t.toHashCode(),void 0===this.__bindings[a]&&(this.__bindings[a]=[]);var s=[e,t,n,r,i];this.__bindings[a].push(s),a=r.toHashCode(),void 0===this.__bindingsByTarget[a]&&(this.__bindingsByTarget[a]=[]),this.__bindingsByTarget[a].push(s)},__convertValue:function(e,t,n,r,i){var a;if(r&&r.converter)return t.getModel&&(a=t.getModel()),r.converter(e,a,i,t);var s=this.__getPropertyChainArray(n),o=this.__getTargetFromChain(t,s),l=n.substring(n.lastIndexOf(".")+1,n.length);if(null==o)return e;var c=qx.Class.getPropertyDefinition(o.constructor,l),u=null==c?"":c.check;return this.__defaultConversion(e,u)},__getEventForProperty:function(e,t){var n=qx.Class.getPropertyDefinition(e.constructor,t);return null==n?null:n.event},__defaultConversion:function(e,t){var n=qx.lang.Type.getClass(e);return"Number"!=n&&"String"!=n||"Integer"!=t&&"PositiveInteger"!=t||(e=parseInt(e,10)),"Boolean"!=n&&"Number"!=n&&"Date"!=n||"String"!=t||(e+=""),"Number"!=n&&"String"!=n||"Number"!=t&&"PositiveNumber"!=t||(e=parseFloat(e)),e},removeBindingFromObject:function(e,t){if("deepBinding"==t.type){for(var n=0;n<t.sources.length;n++)t.sources[n]&&t.sources[n].removeListenerById(t.listenerIds[n]);for(n=0;n<t.targets.length;n++)t.targets[n]&&t.targets[n].removeListenerById(t.targetListenerIds[n])}else e.removeListenerById(t);var r=this.getAllBindingsForObject(e);if(void 0!=r)for(n=0;n<r.length;n++)if(r[n][0]==t){var i=r[n][3];this.__bindingsByTarget[i.toHashCode()]&&qx.lang.Array.remove(this.__bindingsByTarget[i.toHashCode()],r[n]);var a=r[n][1];return void(this.__bindings[a.toHashCode()]&&qx.lang.Array.remove(this.__bindings[a.toHashCode()],r[n]))}throw new Error("Binding could not be found!")},removeAllBindingsForObject:function(e){qx.core.Environment.get("qx.debug")&&qx.core.Assert.assertNotNull(e,"Can not remove the bindings for null object!");var t=this.getAllBindingsForObject(e);if(void 0!=t)for(var n=t.length-1;n>=0;n--)this.removeBindingFromObject(e,t[n][0])},removeRelatedBindings:function(e,t){qx.core.Environment.get("qx.debug")&&(qx.core.Assert.assertNotNull(e,"Can not remove the bindings for null object!"),qx.core.Assert.assertNotNull(t,"Can not remove the bindings for null object!"));var n=this.getAllBindingsForObject(e);if(void 0!=n)for(var r=n.length-1;r>=0;r--){var i=n[r][1],a=n[r][3];i!==t&&a!==t||this.removeBindingFromObject(e,n[r][0])}},getAllBindingsForObject:function(e){var t=e.toHashCode();void 0===this.__bindings[t]&&(this.__bindings[t]=[]);var n=this.__bindings[t],r=this.__bindingsByTarget[t]?this.__bindingsByTarget[t]:[];return qx.lang.Array.unique(n.concat(r))},removeAllBindings:function(){for(var e in this.__bindings){var t=qx.core.ObjectRegistry.fromHashCode(e);null!=t?this.removeAllBindingsForObject(t):delete this.__bindings[e]}this.__bindings={}},getAllBindings:function(){return this.__bindings},showBindingInLog:function(e,t){for(var n,r=0;r<this.__bindings[e.toHashCode()].length;r++)if(this.__bindings[e.toHashCode()][r][0]==t){n=this.__bindings[e.toHashCode()][r];break}if(void 0===n)var i="Binding does not exist!";else i="Binding from '"+n[1]+"' ("+n[2]+") to the object '"+n[3]+"' ("+n[4]+").";qx.log.Logger.debug(i)},showAllBindingsInLog:function(){for(var e in this.__bindings)for(var t=qx.core.ObjectRegistry.fromHashCode(e),n=0;n<this.__bindings[e].length;n++)this.showBindingInLog(t,this.__bindings[e][n][0])}}}),qx.Bootstrap.define("qx.util.RingBuffer",{extend:Object,construct:function(e){this.setMaxEntries(e||50)},members:{__nextIndexToStoreTo:0,__entriesStored:0,__isMarkActive:!1,__entriesStoredSinceMark:0,__entries:null,__maxEntries:null,setMaxEntries:function(e){this.__maxEntries=e,this.clear()},getMaxEntries:function(){return this.__maxEntries},addEntry:function(e){this.__entries[this.__nextIndexToStoreTo]=e,this.__nextIndexToStoreTo=this.__addToIndex(this.__nextIndexToStoreTo,1);var t=this.getMaxEntries();this.__entriesStored<t&&this.__entriesStored++,this.__isMarkActive&&this.__entriesStoredSinceMark<t&&this.__entriesStoredSinceMark++},mark:function(){this.__isMarkActive=!0,this.__entriesStoredSinceMark=0},clearMark:function(){this.__isMarkActive=!1},getAllEntries:function(){return this.getEntries(this.getMaxEntries(),!1)},getEntries:function(e,t){if(e>this.__entriesStored&&(e=this.__entriesStored),t&&this.__isMarkActive&&e>this.__entriesStoredSinceMark&&(e=this.__entriesStoredSinceMark),e>0){var n,r=this.__addToIndex(this.__nextIndexToStoreTo,-1),i=this.__addToIndex(r,1-e);n=i<=r?this.__entries.slice(i,r+1):this.__entries.slice(i,this.__entriesStored).concat(this.__entries.slice(0,r+1))}else n=[];return n},clear:function(){this.__entries=new Array(this.getMaxEntries()),this.__entriesStored=0,this.__entriesStoredSinceMark=0,this.__nextIndexToStoreTo=0},__addToIndex:function(e,t){var n=this.getMaxEntries(),r=(e+t)%n;return r<0&&(r+=n),r}}}),qx.Bootstrap.define("qx.log.appender.RingBuffer",{extend:qx.util.RingBuffer,construct:function(e){this.setMaxMessages(e||50)},members:{setMaxMessages:function(e){this.setMaxEntries(e)},getMaxMessages:function(){return this.getMaxEntries()},process:function(e){this.addEntry(e)},getAllLogEvents:function(){return this.getAllEntries()},retrieveLogEvents:function(e,t){return this.getEntries(e,t)},clearHistory:function(){this.clear()}}}),qx.Bootstrap.define("qx.lang.Type",{statics:{getClass:qx.Bootstrap.getClass,isString:qx.Bootstrap.isString,isArray:qx.Bootstrap.isArray,isObject:qx.Bootstrap.isObject,isFunction:qx.Bootstrap.isFunction,isRegExp:function(e){return"RegExp"==this.getClass(e)},isNumber:function(e){return null!==e&&("Number"==this.getClass(e)||e instanceof Number)},isBoolean:function(e){return null!==e&&("Boolean"==this.getClass(e)||e instanceof Boolean)},isDate:function(e){return null!==e&&("Date"==this.getClass(e)||e instanceof Date)},isError:function(e){return null!==e&&("Error"==this.getClass(e)||e instanceof Error)}}}),qx.Bootstrap.define("qx.lang.Array",{statics:{cast:function(e,t,n){if(e.constructor===t)return e;qx.data&&qx.data.IListData&&qx.Class&&qx.Class.hasInterface(e,qx.data.IListData)&&(e=e.toArray());var r=new t;if("mshtml"==qx.core.Environment.get("engine.name")&&e.item){for(var i=n||0,a=e.length;i<a;i++)r.push(e[i]);return r}return"[object Array]"===Object.prototype.toString.call(e)&&null==n?r.push.apply(r,e):r.push.apply(r,Array.prototype.slice.call(e,n||0)),r},fromArguments:function(e,t){return Array.prototype.slice.call(e,t||0)},fromCollection:function(e){if("mshtml"==qx.core.Environment.get("engine.name")&&e.item){for(var t=[],n=0,r=e.length;n<r;n++)t[n]=e[n];return t}return Array.prototype.slice.call(e,0)},fromShortHand:function(e){var t=e.length,n=qx.lang.Array.clone(e);switch(t){case 1:n[1]=n[2]=n[3]=n[0];break;case 2:n[2]=n[0];case 3:n[3]=n[1]}return n},clone:function(e){return e.concat()},insertAt:function(e,t,n){return e.splice(n,0,t),e},insertBefore:function(e,t,n){var r=e.indexOf(n);return-1==r?e.push(t):e.splice(r,0,t),e},insertAfter:function(e,t,n){var r=e.indexOf(n);return-1==r||r==e.length-1?e.push(t):e.splice(r+1,0,t),e},removeAt:function(e,t){return e.splice(t,1)[0]},removeAll:function(e){return e.length=0,this},append:function(e,t){return qx.core.Environment.get("qx.debug")&&(qx.core.Assert&&qx.core.Assert.assertArray(e,"The first parameter must be an array."),qx.core.Assert&&qx.core.Assert.assertArray(t,"The second parameter must be an array.")),Array.prototype.push.apply(e,t),e},exclude:function(e,t){qx.core.Environment.get("qx.debug")&&(qx.core.Assert&&qx.core.Assert.assertArray(e,"The first parameter must be an array."),qx.core.Assert&&qx.core.Assert.assertArray(t,"The second parameter must be an array."));for(var n,r=0,i=t.length;r<i;r++)-1!=(n=e.indexOf(t[r]))&&e.splice(n,1);return e},remove:function(e,t){var n=e.indexOf(t);if(-1!=n)return e.splice(n,1),t},contains:function(e,t){return-1!==e.indexOf(t)},equals:function(e,t){var n=e.length;if(n!==t.length)return!1;for(var r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0},sum:function(e){for(var t=0,n=0,r=e.length;n<r;n++)void 0!=e[n]&&(t+=e[n]);return t},max:function(e){qx.core.Environment.get("qx.debug")&&qx.core.Assert&&qx.core.Assert.assertArray(e,"Parameter must be an array.");var t,n=e.length,r=e[0];for(t=1;t<n;t++)e[t]>r&&(r=e[t]);return void 0===r?null:r},min:function(e){qx.core.Environment.get("qx.debug")&&qx.core.Assert&&qx.core.Assert.assertArray(e,"Parameter must be an array.");var t,n=e.length,r=e[0];for(t=1;t<n;t++)e[t]<r&&(r=e[t]);return void 0===r?null:r},unique:function(e){for(var t,n=[],r={},i={},a={},s=0,o="qx"+Date.now(),l=!1,c=!1,u=!1,d=0,p=e.length;d<p;d++)null===(t=e[d])?l||(l=!0,n.push(t)):void 0===t||(!1===t?c||(c=!0,n.push(t)):!0===t?u||(u=!0,n.push(t)):"string"==typeof t?r[t]||(r[t]=1,n.push(t)):"number"==typeof t?i[t]||(i[t]=1,n.push(t)):(null==(g=t[o])&&(g=t[o]=s++),a[g]||(a[g]=t,n.push(t))));for(var g in a)try{delete a[g][o]}catch(e){try{a[g][o]=null}catch(e){throw new Error("Cannot clean-up map entry doneObjects["+g+"]["+o+"]")}}return n},range:function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;for(var r=Math.max(Math.ceil((t-e)/n),0),i=0,a=Array(r);i<r;)a[i++]=e,e+=n;return a}}}),qx.Bootstrap.define("qx.core.Assert",{statics:{__logError:!0,__fail:function(e,t){for(var n="",r=1,i=arguments.length;r<i;r++)n+=this.__toString(void 0===arguments[r]?"'undefined'":arguments[r]);var a="Assertion error! "+(n?e+": "+n:e);if(qx.Class&&qx.Class.isDefined("qx.core.AssertionError")){var s=new qx.core.AssertionError(e,n);throw this.__logError&&qx.Bootstrap.error(a+"\n Stack trace: \n"+s.getStackTrace()),s}throw this.__logError&&qx.Bootstrap.error(a),new Error(a)},__toString:function(e){var t;if(null===e)t="null";else if(qx.lang.Type.isArray(e)&&e.length>10)t="Array["+e.length+"]";else if(e instanceof Object&&null==e.toString)t=qx.lang.Json.stringify(e,null,2);else try{t=e.toString()}catch(e){t=""}return t},assert:function(e,t){1==e||this.__fail(t||"","Called assert with 'false'")},fail:function(e,t){var n=t?"":"Called fail().";this.__fail(e||"",n)},assertTrue:function(e,t){!0===e||this.__fail(t||"","Called assertTrue with '",e,"'")},assertFalse:function(e,t){!1===e||this.__fail(t||"","Called assertFalse with '",e,"'")},assertEquals:function(e,t,n){e==t||this.__fail(n||"","Expected '",e,"' but found '",t,"'!")},assertNotEquals:function(e,t,n){e!=t||this.__fail(n||"","Expected '",e,"' to be not equal with '",t,"'!")},assertIdentical:function(e,t,n){e===t||this.__fail(n||"","Expected '",e,"' (identical) but found '",t,"'!")},assertNotIdentical:function(e,t,n){e!==t||this.__fail(n||"","Expected '",e,"' to be not identical with '",t,"'!")},assertNotUndefined:function(e,t){void 0!==e||this.__fail(t||"","Expected value not to be undefined but found undefined!")},assertUndefined:function(e,t){void 0===e||this.__fail(t||"","Expected value to be undefined but found ",e,"!")},assertNotNull:function(e,t){null!==e||this.__fail(t||"","Expected value not to be null but found null!")},assertNull:function(e,t){null===e||this.__fail(t||"","Expected value to be null but found ",e,"!")},assertJsonEquals:function(e,t,n){this.assertEquals(qx.lang.Json.stringify(e),qx.lang.Json.stringify(t),n)},assertMatch:function(e,t,n){this.assertString(e),this.assert(qx.lang.Type.isRegExp(t)||qx.lang.Type.isString(t),"The parameter 're' must be a string or a regular expression."),e.search(t)>=0||this.__fail(n||"","The String '",e,"' does not match the regular expression '",t.toString(),"'!")},assertArgumentsCount:function(e,t,n,r){var i=e.length;i>=t&&i<=n||this.__fail(r||"","Wrong number of arguments given. Expected '",t,"' to '",n,"' arguments but found '",i,"' arguments.")},assertEventFired:function(e,t,n,r,i){var a,s=!1;try{a=e.addListener(t,function(t){r&&r.call(e,t),s=!0},e),n.call(e)}catch(e){throw e}finally{try{e.removeListenerById(a)}catch(e){}}!0===s||this.__fail(i||"","Event (",t,") not fired.")},assertEventNotFired:function(e,t,n,r){var i=!1,a=e.addListener(t,function(e){i=!0},e);n.call(),!1===i||this.__fail(r||"","Event (",t,") was fired."),e.removeListenerById(a)},assertException:function(e,t,n,r){var i;t=t||Error;try{this.__logError=!1,e()}catch(e){i=e}finally{this.__logError=!0}null==i&&this.__fail(r||"","The function did not raise an exception!"),i instanceof t||this.__fail(r||"","The raised exception does not have the expected type! ",t," != ",i),n&&this.assertMatch(i.toString(),n,r)},assertInArray:function(e,t,n){-1!==t.indexOf(e)||this.__fail(n||"","The value '",e,"' must have any of the values defined in the array '",t,"'")},assertArrayEquals:function(e,t,n){this.assertArray(e,n),this.assertArray(t,n),n=n||"Expected ["+e.join(", ")+"], but found ["+t.join(", ")+"]",e.length!==t.length&&this.fail(n,!0);for(var r=0;r<e.length;r++)e[r]!==t[r]&&this.fail(n,!0)},assertKeyInMap:function(e,t,n){void 0!==t[e]||this.__fail(n||"","The value '",e,"' must must be a key of the map '",t,"'")},assertFunction:function(e,t){qx.lang.Type.isFunction(e)||this.__fail(t||"","Expected value to be typeof function but found ",e,"!")},assertString:function(e,t){qx.lang.Type.isString(e)||this.__fail(t||"","Expected value to be a string but found ",e,"!")},assertBoolean:function(e,t){qx.lang.Type.isBoolean(e)||this.__fail(t||"","Expected value to be a boolean but found ",e,"!")},assertNumber:function(e,t){qx.lang.Type.isNumber(e)&&isFinite(e)||this.__fail(t||"","Expected value to be a number but found ",e,"!")},assertPositiveNumber:function(e,t){qx.lang.Type.isNumber(e)&&isFinite(e)&&e>=0||this.__fail(t||"","Expected value to be a number >= 0 but found ",e,"!")},assertInteger:function(e,t){qx.lang.Type.isNumber(e)&&isFinite(e)&&e%1==0||this.__fail(t||"","Expected value to be an integer but found ",e,"!")},assertPositiveInteger:function(e,t){qx.lang.Type.isNumber(e)&&isFinite(e)&&e%1==0&&e>=0||this.__fail(t||"","Expected value to be an integer >= 0 but found ",e,"!")},assertInRange:function(e,t,n,r){e>=t&&e<=n||this.__fail(r||"",qx.lang.String.format("Expected value '%1' to be in the range '%2'..'%3'!",[e,t,n]))},assertObject:function(e,t){null!==e&&(qx.lang.Type.isObject(e)||"object"==typeof e)||this.__fail(t||"","Expected value to be typeof object but found ",e,"!")},assertArray:function(e,t){qx.lang.Type.isArray(e)||this.__fail(t||"","Expected value to be an array but found ",e,"!")},assertMap:function(e,t){qx.lang.Type.isObject(e)||this.__fail(t||"","Expected value to be a map but found ",e,"!")},assertRegExp:function(e,t){qx.lang.Type.isRegExp(e)||this.__fail(t||"","Expected value to be a regular expression but found ",e,"!")},assertType:function(e,t,n){this.assertString(t,"Invalid argument 'type'"),typeof e===t||this.__fail(n||"","Expected value to be typeof '",t,"' but found ",e,"!")},assertInstance:function(e,t,n){var r=t.classname||t+"";e instanceof t||this.__fail(n||"","Expected value to be instanceof '",r,"' but found ",e,"!")},assertInterface:function(e,t,n){qx.Class&&qx.Class.implementsInterface(e,t)||this.__fail(n||"","Expected object '",e,"' to implement the interface '",t,"'!")},assertCssColor:function(e,t,n){var r=qx.Class?qx.Class.getByName("qx.util.ColorUtil"):null;if(!r)throw new Error("qx.util.ColorUtil not available! Your code must have a dependency on 'qx.util.ColorUtil'");var i=r.stringToRgb(e);try{var a=r.stringToRgb(t)}catch(r){this.__fail(n||"","Expected value to be the CSS color '",e,"' (rgb(",i.join(","),")), but found value '",t,"', which cannot be converted to a CSS color!")}i[0]==a[0]&&i[1]==a[1]&&i[2]==a[2]||this.__fail(n||"","Expected value to be the CSS color '",i,"' (rgb(",i.join(","),")), but found value '",t,"' (rgb(",a.join(","),"))!")},assertElement:function(e,t){e&&1===e.nodeType||this.__fail(t||"","Expected value to be a DOM element but found '",e,"'!")},assertQxObject:function(e,t){this.__isQxInstance(e,"qx.core.Object")||this.__fail(t||"","Expected value to be a qooxdoo object but found ",e,"!")},assertQxWidget:function(e,t){this.__isQxInstance(e,"qx.ui.core.Widget")||this.__fail(t||"","Expected value to be a qooxdoo widget but found ",e,"!")},__isQxInstance:function(e,t){if(!e)return!1;for(var n=e.constructor;n;){if(n.classname===t)return!0;n=n.superclass}return!1}}}),qx.Bootstrap.define("qx.lang.String",{statics:{__unicodeLetters:"0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",__unicodeFirstLetterInWordRegexp:null,__stringsMap:{},camelCase:function(e){var t=this.__stringsMap[e];return t||(t=e.replace(/\-([a-z])/g,function(e,t){return t.toUpperCase()}),e.indexOf("-")>=0&&(this.__stringsMap[e]=t)),t},hyphenate:function(e){var t=this.__stringsMap[e];return t||(t=e.replace(/[A-Z]/g,function(e){return"-"+e.charAt(0).toLowerCase()}),-1==e.indexOf("-")&&(this.__stringsMap[e]=t)),t},capitalize:function(e){return null===this.__unicodeFirstLetterInWordRegexp&&(this.__unicodeFirstLetterInWordRegexp=new RegExp("(^|[^"+this.__unicodeLetters.replace(/[0-9A-F]{4}/g,function(e){return"\\u"+e})+"])["+this.__unicodeLetters.replace(/[0-9A-F]{4}/g,function(e){return"\\u"+e})+"]","g")),e.replace(this.__unicodeFirstLetterInWordRegexp,function(e){return e.toUpperCase()})},clean:function(e){return e.replace(/\s+/g," ").trim()},trimLeft:function(e){return e.replace(/^\s+/,"")},trimRight:function(e){return e.replace(/\s+$/,"")},startsWith:function(e,t){return 0===e.indexOf(t)},endsWith:function(e,t){return e.substring(e.length-t.length,e.length)===t},repeat:function(e,t){return e.length>0?new Array(t+1).join(e):""},pad:function(e,t,n){var r=t-e.length;return r>0?(void 0===n&&(n="0"),this.repeat(n,r)+e):e},firstUp:qx.Bootstrap.firstUp,firstLow:qx.Bootstrap.firstLow,contains:function(e,t){return-1!=e.indexOf(t)},format:function(e,t){for(var n=e,r=t.length;r--;)n=n.replace(new RegExp("%"+(r+1),"g"),function(){return t[r]+""});return n},escapeRegexpChars:function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},toArray:function(e){return e.split(/\B|\b/g)},stripTags:function(e){return e.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(e,t){var n="",r=e.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){return n+=arguments[1]+"\n",""});return!0===t&&qx.lang.Function.globalEval(n),r},quote:function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"'}}}),qx.Bootstrap.define("qx.lang.Function",{statics:{getCaller:function(e){return e.caller?e.caller.callee:e.callee.caller},getName:function(e){if(e.displayName)return e.displayName;if(e.$$original||e.wrapper||e.classname)return e.classname+".constructor()";if(e.$$mixin){for(var t in e.$$mixin.$$members)if(e.$$mixin.$$members[t]==e)return e.$$mixin.name+".prototype."+t+"()";for(var t in e.$$mixin)if(e.$$mixin[t]==e)return e.$$mixin.name+"."+t+"()"}if(e.self){var n=e.self.constructor;if(n){for(var t in n.prototype)if(n.prototype[t]==e)return n.classname+".prototype."+t+"()";for(var t in n)if(n[t]==e)return n.classname+"."+t+"()"}}var r=e.toString().match(/function\s*(\w*)\s*\(.*/);return r&&r.length>=1&&r[1]?r[1]+"()":"anonymous()"},globalEval:function(e){return window.execScript?window.execScript(e):eval.call(window,e)},create:function(e,t){return qx.core.Environment.get("qx.debug")&&qx.core.Assert&&qx.core.Assert.assertFunction(e,"Invalid parameter 'func'."),t&&(t.self||t.args||null!=t.delay||null!=t.periodical||t.attempt)?function(n){qx.core.Environment.get("qx.debug")&&qx.core.Object&&t.self&&qx.Bootstrap.isObject(t.self)&&t.self.isDisposed&&qx.Bootstrap.isFunction(t.self.isDisposed)&&qx.core.Assert&&qx.core.Assert.assertFalse(t.self.isDisposed(),"Trying to call a bound function with a disposed object as context: "+t.self.toString()+" :: "+qx.lang.Function.getName(e));var r=qx.lang.Array.fromArguments(arguments);if(t.args&&(r=t.args.concat(r)),!t.delay&&!t.periodical){if(t.attempt){var i=!1;try{i=e.apply(t.self||this,r)}catch(e){}return i}return e.apply(t.self||this,r)}var a=function(){return e.apply(t.self||this,r)};return qx.core.Environment.get("qx.globalErrorHandling")&&(a=qx.event.GlobalError.observeMethod(a)),t.delay?window.setTimeout(a,t.delay):t.periodical?window.setInterval(a,t.periodical):void 0}:e},bind:function(e,t,n){return this.create(e,{self:t,args:arguments.length>2?qx.lang.Array.fromArguments(arguments,2):null})},curry:function(e,t){return this.create(e,{args:arguments.length>1?qx.lang.Array.fromArguments(arguments,1):null})},listener:function(e,t,n){if(arguments.length<3)return function(n){return e.call(t||this,n||window.event)};var r=qx.lang.Array.fromArguments(arguments,2);return function(n){var i=[n||window.event];i.push.apply(i,r),e.apply(t||this,i)}},attempt:function(e,t,n){return this.create(e,{self:t,attempt:!0,args:arguments.length>2?qx.lang.Array.fromArguments(arguments,2):null})()},delay:function(e,t,n,r){return this.create(e,{delay:t,self:n,args:arguments.length>3?qx.lang.Array.fromArguments(arguments,3):null})()},periodical:function(e,t,n,r){return this.create(e,{periodical:t,self:n,args:arguments.length>3?qx.lang.Array.fromArguments(arguments,3):null})()}}}),qx.Bootstrap.define("qx.event.GlobalError",{statics:{__callback:null,__originalOnError:null,__context:null,__isGlobaErrorHandlingEnabled:function(){return qx.core&&qx.core.Environment?qx.core.Environment.get("qx.globalErrorHandling"):!!qx.Bootstrap.getEnvironmentSetting("qx.globalErrorHandling")},setErrorHandler:function(e,t){if(this.__callback=e||null,this.__context=t||window,this.__isGlobaErrorHandlingEnabled()){if(e&&window.onerror){var n=qx.Bootstrap.bind(this.__onErrorWindow,this);null==this.__originalOnError&&(this.__originalOnError=window.onerror);var r=this;window.onerror=function(e,t,i){r.__originalOnError(e,t,i),n(e,t,i)}}e&&!window.onerror&&(window.onerror=qx.Bootstrap.bind(this.__onErrorWindow,this)),null==this.__callback&&(null!=this.__originalOnError?(window.onerror=this.__originalOnError,this.__originalOnError=null):window.onerror=null)}},__onErrorWindow:function(e,t,n){this.__callback&&this.handleError(new qx.core.WindowError(e,t,n))},observeMethod:function(e){if(this.__isGlobaErrorHandlingEnabled()){var t=this;return function(){if(!t.__callback)return e.apply(this,arguments);try{return e.apply(this,arguments)}catch(e){t.handleError(new qx.core.GlobalError(e,arguments))}}}return e},handleError:function(e){this.__callback&&this.__callback.call(this.__context,e)}},defer:function(e){qx.core&&qx.core.Environment?qx.core.Environment.add("qx.globalErrorHandling",!0):qx.Bootstrap.setEnvironmentSetting("qx.globalErrorHandling",!0),e.setErrorHandler(null,null)}}),qx.Bootstrap.define("qx.core.WindowError",{extend:Error,construct:function(e,t,n){var r=Error.call(this,e);r.stack&&(this.stack=r.stack),r.stacktrace&&(this.stacktrace=r.stacktrace),this.__failMessage=e,this.__uri=t||"",this.__lineNumber=void 0===n?-1:n},members:{__failMessage:null,__uri:null,__lineNumber:null,toString:function(){return this.__failMessage},getUri:function(){return this.__uri},getLineNumber:function(){return this.__lineNumber}}}),qx.Bootstrap.define("qx.core.GlobalError",{extend:Error,construct:function(e,t){qx.Bootstrap.DEBUG&&qx.core.Assert.assertNotUndefined(e),this.__failMessage="GlobalError: "+(e&&e.message?e.message:e);var n=Error.call(this,this.__failMessage);n.stack&&(this.stack=n.stack),n.stacktrace&&(this.stacktrace=n.stacktrace),this.__arguments=t,this.__exc=e},members:{__exc:null,__arguments:null,__failMessage:null,toString:function(){return this.__failMessage},getArguments:function(){return this.__arguments},getSourceException:function(){return this.__exc}},destruct:function(){this.__exc=null,this.__arguments=null,this.__failMessage=null}}),qx.Bootstrap.define("qx.lang.Json",{statics:{stringify:null,parse:null}}),function(){!function(e){var t,n,r,i={}.toString,a=!1;a?"object"==typeof JSON&&JSON&&(a?(a.stringify=JSON.stringify,a.parse=JSON.parse):a=JSON):a=e.JSON||(e.JSON={});var s=new Date(-0xc782b5b800cec);try{s=-109252==s.getUTCFullYear()&&0===s.getUTCMonth()&&1===s.getUTCDate()&&10==s.getUTCHours()&&37==s.getUTCMinutes()&&6==s.getUTCSeconds()&&708==s.getUTCMilliseconds()}catch(e){}function o(e){if("bug-string-char-index"==e)return"a"!="a"[0];var t,n='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}',o="json"==e;if(o||"json-stringify"==e||"json-parse"==e){if("json-stringify"==e||o){var l=a.stringify,c="function"==typeof l&&s;if(c){(t=function(){return 1}).toJSON=t;try{c="0"===l(0)&&"0"===l(new Number)&&'""'==l(new String)&&l(i)===r&&l(r)===r&&l()===r&&"1"===l(t)&&"[1]"==l([t])&&"[null]"==l([r])&&"null"==l(null)&&"[null,null,null]"==l([r,i,null])&&l({a:[t,!0,!1,null,"\0\b\n\f\r\t"]})==n&&"1"===l(null,t)&&"[\n 1,\n 2\n]"==l([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==l(new Date(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==l(new Date(864e13))&&'"-000001-01-01T00:00:00.000Z"'==l(new Date(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==l(new Date(-1))}catch(e){c=!1}}if(!o)return c}if("json-parse"==e||o){var u=a.parse;if("function"==typeof u)try{if(0===u("0")&&!u(!1)){var d=5==(t=u(n)).a.length&&1===t.a[0];if(d){try{d=!u('"\t"')}catch(e){}if(d)try{d=1!==u("01")}catch(e){}}}}catch(e){d=!1}if(!o)return d}return c&&d}}if(!o("json")){var l=o("bug-string-char-index");if(!s)var c=Math.floor,u=[0,31,59,90,120,151,181,212,243,273,304,334],d=function(e,t){return u[t]+365*(e-1970)+c((e-1969+(t=+(t>1)))/4)-c((e-1901+t)/100)+c((e-1601+t)/400)};(t={}.hasOwnProperty)||(t=function(e){var n,r={};return(r.__proto__=null,r.__proto__={toString:1},r).toString!=i?t=function(e){var t=this.__proto__,n=e in(this.__proto__=null,this);return this.__proto__=t,n}:(n=r.constructor,t=function(e){var t=(this.constructor||n).prototype;return e in this&&!(e in t&&this[e]===t[e])}),r=null,t.call(this,e)});var p={boolean:1,number:1,string:1,undefined:1};if(n=function(e,n){var r,a,s,o,l=0;for(s in(r=function(){this.valueOf=0}).prototype.valueOf=0,a=new r)t.call(a,s)&&l++;return r=a=null,l?o=2==l?function(e,n){var r,a={},s="[object Function]"==i.call(e);for(r in e)s&&"prototype"==r||t.call(a,r)||!(a[r]=1)||!t.call(e,r)||n(r)}:function(e,n){var r,a,s="[object Function]"==i.call(e);for(r in e)s&&"prototype"==r||!t.call(e,r)||(a="constructor"===r)||n(r);(a||t.call(e,r="constructor"))&&n(r)}:(a=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],o=function(e,n){var r,s,o="[object Function]"==i.call(e),l=!o&&"function"!=typeof e.constructor&&function(e,t){var n=typeof e.hasOwnProperty;return"object"==n?!!e.hasOwnProperty:!p[n]}(e)?e.hasOwnProperty:t;for(r in e)o&&"prototype"==r||!l.call(e,r)||n(r);for(s=a.length;r=a[--s];l.call(e,r)&&n(r));}),o(e,n)},!o("json-stringify")){var g={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},h=function(e,t){return("000000"+(t||0)).slice(-e)},m=function(e){var t,n='"',r=0,i=e.length,a=i>10&&l;for(a&&(t=e.split(""));r<i;r++){var s=e.charCodeAt(r);switch(s){case 8:case 9:case 10:case 12:case 13:case 34:case 92:n+=g[s];break;default:if(s<32){n+="\\u00"+h(2,s.toString(16));break}n+=a?t[r]:l?e.charAt(r):e[r]}}return n+'"'},f=function(e,a,s,o,l,u,p){var g,_,v,x,b,w,y,I,q,C,T,E,S,A,U,k,$=a[e];try{$=a[e]}catch(e){}if("object"==typeof $&&$)if("[object Date]"!=(g=i.call($))||t.call($,"toJSON"))"function"==typeof $.toJSON&&("[object Number]"!=g&&"[object String]"!=g&&"[object Array]"!=g||t.call($,"toJSON"))&&($=$.toJSON(e));else if($>-1/0&&$<1/0){if(d){for(x=c($/864e5),_=c(x/365.2425)+1970-1;d(_+1,0)<=x;_++);for(v=c((x-d(_,0))/30.42);d(_,v+1)<=x;v++);x=1+x-d(_,v),w=c((b=($%864e5+864e5)%864e5)/36e5)%24,y=c(b/6e4)%60,I=c(b/1e3)%60,q=b%1e3}else _=$.getUTCFullYear(),v=$.getUTCMonth(),x=$.getUTCDate(),w=$.getUTCHours(),y=$.getUTCMinutes(),I=$.getUTCSeconds(),q=$.getUTCMilliseconds();$=(_<=0||_>=1e4?(_<0?"-":"+")+h(6,_<0?-_:_):h(4,_))+"-"+h(2,v+1)+"-"+h(2,x)+"T"+h(2,w)+":"+h(2,y)+":"+h(2,I)+"."+h(3,q)+"Z"}else $=null;if(s&&($=s.call(a,e,$)),null===$)return"null";if("[object Boolean]"==(g=i.call($)))return""+$;if("[object Number]"==g)return $>-1/0&&$<1/0?""+$:"null";if("[object String]"==g)return m(""+$);if("object"==typeof $){for(S=p.length;S--;)if(p[S]===$)throw TypeError();if(p.push($),C=[],A=u,u+=l,"[object Array]"==g){for(E=0,S=$.length;E<S;U||(U=!0),E++)T=f(E,$,s,o,l,u,p),C.push(T===r?"null":T);k=U?l?"[\n"+u+C.join(",\n"+u)+"\n"+A+"]":"["+C.join(",")+"]":"[]"}else n(o||$,function(e){var t=f(e,$,s,o,l,u,p);t!==r&&C.push(m(e)+":"+(l?" ":"")+t),U||(U=!0)}),k=U?l?"{\n"+u+C.join(",\n"+u)+"\n"+A+"}":"{"+C.join(",")+"}":"{}";return p.pop(),k}};a.stringify=function(e,t,n){var r,a,s;if("function"==typeof t||"object"==typeof t&&t)if("[object Function]"==i.call(t))a=t;else if("[object Array]"==i.call(t)){s={};for(var o,l=0,c=t.length;l<c;o=t[l++],("[object String]"==i.call(o)||"[object Number]"==i.call(o))&&(s[o]=1));}if(n)if("[object Number]"==i.call(n)){if((n-=n%1)>0)for(r="",n>10&&(n=10);r.length<n;r+=" ");}else"[object String]"==i.call(n)&&(r=n.length<=10?n:n.slice(0,10));return f("",((o={})[""]=e,o),a,s,r,"",[])}}if(!o("json-parse")){var _,v,x=String.fromCharCode,b={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},w=function(){throw _=v=null,SyntaxError()},y=function(){for(var e,t,n,r,i,a=v,s=a.length;_<s;)switch(i=a.charCodeAt(_)){case 9:case 10:case 13:case 32:_++;break;case 123:case 125:case 91:case 93:case 58:case 44:return e=l?a.charAt(_):a[_],_++,e;case 34:for(e="@",_++;_<s;)if((i=a.charCodeAt(_))<32)w();else if(92==i)switch(i=a.charCodeAt(++_)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:e+=b[i],_++;break;case 117:for(t=++_,n=_+4;_<n;_++)(i=a.charCodeAt(_))>=48&&i<=57||i>=97&&i<=102||i>=65&&i<=70||w();e+=x("0x"+a.slice(t,_));break;default:w()}else{if(34==i)break;for(i=a.charCodeAt(_),t=_;i>=32&&92!=i&&34!=i;)i=a.charCodeAt(++_);e+=a.slice(t,_)}if(34==a.charCodeAt(_))return _++,e;w();default:if(t=_,45==i&&(r=!0,i=a.charCodeAt(++_)),i>=48&&i<=57){for(48==i&&(i=a.charCodeAt(_+1))>=48&&i<=57&&w(),r=!1;_<s&&(i=a.charCodeAt(_))>=48&&i<=57;_++);if(46==a.charCodeAt(_)){for(n=++_;n<s&&(i=a.charCodeAt(n))>=48&&i<=57;n++);n==_&&w(),_=n}if(101==(i=a.charCodeAt(_))||69==i){for(43!=(i=a.charCodeAt(++_))&&45!=i||_++,n=_;n<s&&(i=a.charCodeAt(n))>=48&&i<=57;n++);n==_&&w(),_=n}return+a.slice(t,_)}if(r&&w(),"true"==a.slice(_,_+4))return _+=4,!0;if("false"==a.slice(_,_+5))return _+=5,!1;if("null"==a.slice(_,_+4))return _+=4,null;w()}return"$"},I=function(e){var t,n;if("$"==e&&w(),"string"==typeof e){if("@"==(l?e.charAt(0):e[0]))return e.slice(1);if("["==e){for(t=[];"]"!=(e=y());n||(n=!0))n&&(","==e?"]"==(e=y())&&w():w()),","==e&&w(),t.push(I(e));return t}if("{"==e){for(t={};"}"!=(e=y());n||(n=!0))n&&(","==e?"}"==(e=y())&&w():w()),","!=e&&"string"==typeof e&&"@"==(l?e.charAt(0):e[0])&&":"==y()||w(),t[e.slice(1)]=I(y());return t}w()}return e},q=function(e,t,n){var i=C(e,t,n);i===r?delete e[t]:e[t]=i},C=function(e,t,r){var a,s=e[t];if("object"==typeof s&&s)if("[object Array]"==i.call(s))for(a=s.length;a--;)q(s,a,r);else n(s,function(e){q(s,e,r)});return r.call(e,t,s)};a.parse=function(e,t){var n,r;return _=0,v=""+e,n=I(y()),"$"!=y()&&w(),_=v=null,t&&"[object Function]"==i.call(t)?C(((r={})[""]=n,r),"",t):n}}}}(this)}(),qx.lang.Json.stringify=window.JSON.stringify,qx.lang.Json.parse=window.JSON.parse,qx.Bootstrap.define("qx.type.BaseError",{extend:Error,construct:function(e,t){var n=Error.call(this,t);n.stack&&(this.stack=n.stack),n.stacktrace&&(this.stacktrace=n.stacktrace),this.__comment=e||"",this.message=t||qx.type.BaseError.DEFAULTMESSAGE},statics:{DEFAULTMESSAGE:"error"},members:{__sTrace:null,__comment:null,message:null,getComment:function(){return this.__comment},toString:function(){return this.__comment+(this.message?": "+this.message:"")}}}),qx.Bootstrap.define("qx.core.AssertionError",{extend:qx.type.BaseError,construct:function(e,t){qx.type.BaseError.call(this,e,t),this.__trace=qx.dev.StackTrace.getStackTrace()},members:{__trace:null,getStackTrace:function(){return this.__trace}}}),qx.Bootstrap.define("qx.dev.StackTrace",{statics:{FILENAME_TO_CLASSNAME:null,FORMAT_STACKTRACE:null,getStackTrace:function(){var e=[];try{throw new Error}catch(h){if(qx.dev.StackTrace.hasEnvironmentCheck&&qx.core.Environment.get("ecmascript.error.stacktrace")){var t=qx.dev.StackTrace.getStackTraceFromError(h),n=qx.dev.StackTrace.getStackTraceFromCaller(arguments);qx.lang.Array.removeAt(t,0),e=n.length>t.length?n:t;for(var r=0;r<Math.min(n.length,t.length);r++){var i=n[r];if(!(i.indexOf("anonymous")>=0)){var a=null,s=i.split("."),o=/(.*?)\(/.exec(s[s.length-1]);o&&2==o.length&&(a=o[1],s.pop()),"prototype"==s[s.length-1]&&s.pop();var l,c=s.join("."),u=t[r].split(":"),d=u[0],p=u[1];u[2]&&(l=u[2]);var g=qx.Class&&qx.Class.getByName(d)?d:c;a&&(g+="."+a),g+=":"+p,l&&(g+=":"+l),e[r]=g}}}else e=this.getStackTraceFromCaller(arguments)}return e},getStackTraceFromCaller:function(e){for(var t=[],n=qx.lang.Function.getCaller(e),r={};n;){var i=qx.lang.Function.getName(n);t.push(i);try{n=n.caller}catch(e){break}if(!n)break;var a=qx.core.ObjectRegistry.toHashCode(n);if(r[a]){t.push("...");break}r[a]=n}return t},getStackTraceFromError:function(e){var t,n,r,i,a,s,o,l=[],c=qx.dev.StackTrace.hasEnvironmentCheck?qx.core.Environment.get("ecmascript.error.stacktrace"):null;if("stack"===c){if(!e.stack)return l;for(t=/@(.+):(\d+)$/gm;null!=(n=t.exec(e.stack));)o=n[1],i=n[2],r=this.__fileNameToClassName(o),l.push(r+":"+i);if(l.length>0)return this.__formatStackTrace(l);t=/at (.*)/gm;for(var u=/\((.*?)(:[^\/].*)\)/,d=/(.*?)(:[^\/].*)/;null!=(n=t.exec(e.stack));){var p=u.exec(n[1]);p||(p=d.exec(n[1])),p?(r=this.__fileNameToClassName(p[1]),l.push(r+p[2])):l.push(n[1])}}else if("stacktrace"===c){var g=e.stacktrace;if(!g)return l;for(g.indexOf("Error created at")>=0&&(g=g.split("Error created at")[0]),t=/line\ (\d+?),\ column\ (\d+?)\ in\ (?:.*?)\ in\ (.*?):[^\/]/gm;null!=(n=t.exec(g));)i=n[1],a=n[2],o=n[3],r=this.__fileNameToClassName(o),l.push(r+":"+i+":"+a);if(l.length>0)return this.__formatStackTrace(l);for(t=/Line\ (\d+?)\ of\ linked\ script\ (.*?)$/gm;null!=(n=t.exec(g));)i=n[1],o=n[2],r=this.__fileNameToClassName(o),l.push(r+":"+i)}else if(e.message&&e.message.indexOf("Backtrace:")>=0)for(var h=e.message.split("Backtrace:")[1].trim().split("\n"),m=0;m<h.length;m++){var f=h[m].match(/\s*Line ([0-9]+) of.* (\S.*)/);f&&f.length>=2&&(i=f[1],s=this.__fileNameToClassName(f[2]),l.push(s+":"+i))}else e.sourceURL&&e.line&&l.push(this.__fileNameToClassName(e.sourceURL)+":"+e.line);return this.__formatStackTrace(l)},__fileNameToClassName:function(e){if("function"==typeof qx.dev.StackTrace.FILENAME_TO_CLASSNAME){var t=qx.dev.StackTrace.FILENAME_TO_CLASSNAME(e);if(qx.core.Environment.get("qx.debug")&&!qx.lang.Type.isString(t))throw new Error("FILENAME_TO_CLASSNAME must return a string!");return t}return qx.dev.StackTrace.__fileNameToClassNameDefault(e)},__fileNameToClassNameDefault:function(e){var t=e.indexOf("/source/class/"),n=e.indexOf("?");return n>=0&&(e=e.substring(0,n)),-1==t?e:e.substring(t+"/source/class/".length).replace(/\//g,".").replace(/\.js$/,"")},__formatStackTrace:function(e){if("function"==typeof qx.dev.StackTrace.FORMAT_STACKTRACE&&(e=qx.dev.StackTrace.FORMAT_STACKTRACE(e),qx.core.Environment.get("qx.debug")&&!qx.lang.Type.isArray(e)))throw new Error("FORMAT_STACKTRACE must return an array of strings!");return e}},defer:function(e){e.hasEnvironmentCheck=qx.bom&&qx.bom.client&&qx.bom.client.EcmaScript&&qx.bom.client.EcmaScript.getStackTrace}}),qx.Bootstrap.define("qx.core.ObjectRegistry",{statics:{inShutDown:!1,__registry:{},__nextHash:0,__freeHashes:[],__postId:"",__stackTraces:{},register:function(e){var t=this.__registry;if(t){var n=e.$$hash;if(null==n){var r=this.__freeHashes;n=r.length>0&&!qx.core.Environment.get("qx.debug.dispose")?r.pop():this.__nextHash+++this.__postId,e.$$hash=n,qx.core.Environment.get("qx.debug.dispose")&&qx.dev&&qx.dev.Debug&&qx.dev.Debug.disposeProfilingActive&&(this.__stackTraces[n]=qx.dev.StackTrace.getStackTrace())}if(qx.core.Environment.get("qx.debug")&&!e.dispose)throw new Error("Invalid object: "+e);t[n]=e}},unregister:function(e){var t=e.$$hash;if(null!=t){var n=this.__registry;n&&n[t]&&(delete n[t],this.__freeHashes.push(t));try{delete e.$$hash}catch(t){e.removeAttribute&&e.removeAttribute("$$hash")}}},toHashCode:function(e){if(qx.core.Environment.get("qx.debug")&&null==e)throw new Error("Invalid object: "+e);var t=e.$$hash;if(null!=t)return t;var n=this.__freeHashes;return t=n.length>0?n.pop():this.__nextHash+++this.__postId,e.$$hash=t},clearHashCode:function(e){if(qx.core.Environment.get("qx.debug")&&null==e)throw new Error("Invalid object: "+e);var t=e.$$hash;if(null!=t){this.__freeHashes.push(t);try{delete e.$$hash}catch(t){e.removeAttribute&&e.removeAttribute("$$hash")}}},fromHashCode:function(e){return this.__registry[e]||null},shutdown:function(){this.inShutDown=!0;var e=this.__registry,t=[];for(var n in e)t.push(n);t.sort(function(e,t){return parseInt(t,10)-parseInt(e,10)});for(var r,i=0,a=t.length;;){try{for(;i<a;i++)(r=e[n=t[i]])&&r.dispose&&r.dispose()}catch(e){if(qx.Bootstrap.error(this,"Could not dispose object "+r.toString()+": "+e,e),i!==a){i++;continue}}break}qx.Bootstrap.debug(this,"Disposed "+a+" objects"),delete this.__registry},getRegistry:function(){return this.__registry},getNextHash:function(){return this.__nextHash},getPostId:function(){return this.__postId},getStackTraces:function(){return this.__stackTraces}},defer:function(e){if(window&&window.top)for(var t=window.top.frames,n=0;n<t.length;n++)if(t[n]===window)return void(e.__postId="-"+(n+1));e.__postId="-0"}}),qx.Bootstrap.define("qx.bom.client.Engine",{statics:{getVersion:function(){var e=window.navigator.userAgent,t="";if(qx.bom.client.Engine.__isOpera())/Opera[\s\/]([0-9]+)\.([0-9])([0-9]*)/.test(e)&&(-1!=e.indexOf("Version/")?t=(i=e.match(/Version\/(\d+)\.(\d+)/))[1]+"."+i[2].charAt(0)+"."+i[2].substring(1,i[2].length):(t=RegExp.$1+"."+RegExp.$2,""!=RegExp.$3&&(t+="."+RegExp.$3)));else if(qx.bom.client.Engine.__isWebkit()){if(/AppleWebKit\/([^ ]+)/.test(e)){t=RegExp.$1;var n=RegExp("[^\\.0-9]").exec(t);n&&(t=t.slice(0,n.index))}}else if(qx.bom.client.Engine.__isGecko()||qx.bom.client.Engine.__isMaple())/rv\:([^\);]+)(\)|;)/.test(e)&&(t=RegExp.$1);else if(qx.bom.client.Engine.__isMshtml()){var r=/Trident\/([^\);]+)(\)|;)/.test(e);if(/MSIE\s+([^\);]+)(\)|;)/.test(e))(t=RegExp.$1)<8&&r&&("4.0"==RegExp.$1?t="8.0":"5.0"==RegExp.$1&&(t="9.0"));else if(r){var i;(i=/\brv\:(\d+?\.\d+?)\b/.exec(e))&&(t=i[1])}}else{var a=window.qxFail;a&&"function"==typeof a?t=a().FULLVERSION:(t="1.9.0.0",qx.Bootstrap.warn("Unsupported client: "+e+"! Assumed gecko version 1.9.0.0 (Firefox 3.0)."))}return t},getName:function(){var e;if(qx.bom.client.Engine.__isOpera())e="opera";else if(qx.bom.client.Engine.__isWebkit())e="webkit";else if(qx.bom.client.Engine.__isGecko()||qx.bom.client.Engine.__isMaple())e="gecko";else if(qx.bom.client.Engine.__isMshtml())e="mshtml";else{var t=window.qxFail;t&&"function"==typeof t?e=t().NAME:(e="gecko",qx.Bootstrap.warn("Unsupported client: "+window.navigator.userAgent+"! Assumed gecko version 1.9.0.0 (Firefox 3.0)."))}return e},__isOpera:function(){return window.opera&&"[object Opera]"==Object.prototype.toString.call(window.opera)},__isWebkit:function(){return-1!=window.navigator.userAgent.indexOf("AppleWebKit/")},__isMaple:function(){return-1!=window.navigator.userAgent.indexOf("Maple")},__isGecko:function(){return window.navigator.mozApps&&"Gecko"===window.navigator.product&&-1==window.navigator.userAgent.indexOf("Maple")&&-1==window.navigator.userAgent.indexOf("Trident")},__isMshtml:function(){return window.navigator.cpuClass&&(/MSIE\s+([^\);]+)(\)|;)/.test(window.navigator.userAgent)||/Trident\/\d+?\.\d+?/.test(window.navigator.userAgent))}},defer:function(e){qx.core.Environment.add("engine.version",e.getVersion),qx.core.Environment.add("engine.name",e.getName)}}),qx.Bootstrap.define("qx.log.Logger",{statics:{__level:"debug",setLevel:function(e){this.__level=e},getLevel:function(){return this.__level},setTreshold:function(e){this.__buffer.setMaxMessages(e)},getTreshold:function(){return this.__buffer.getMaxMessages()},__appender:{},__id:0,register:function(e){if(!e.$$id){var t=this.__id++;this.__appender[t]=e,e.$$id=t;for(var n=this.__levels,r=this.__buffer.getAllLogEvents(),i=0,a=r.length;i<a;i++)n[r[i].level]>=n[this.__level]&&e.process(r[i])}},unregister:function(e){var t=e.$$id;null!=t&&(delete this.__appender[t],delete e.$$id)},debug:function(e,t){qx.log.Logger.__log("debug",arguments)},info:function(e,t){qx.log.Logger.__log("info",arguments)},warn:function(e,t){qx.log.Logger.__log("warn",arguments)},error:function(e,t){qx.log.Logger.__log("error",arguments)},trace:function(e){var t=qx.dev.StackTrace.getStackTrace();qx.log.Logger.__log("info",[(void 0!==e?[e].concat(t):t).join("\n")])},deprecatedMethodWarning:function(e,t){if(qx.core.Environment.get("qx.debug")){var n=qx.lang.Function.getName(e);this.warn("The method '"+n+"' is deprecated: "+(t||"Please consult the API documentation of this method for alternatives.")),this.trace()}},deprecatedClassWarning:function(e,t){if(qx.core.Environment.get("qx.debug")){var n=e.classname||"unknown";this.warn("The class '"+n+"' is deprecated: "+(t||"Please consult the API documentation of this class for alternatives.")),this.trace()}},deprecatedEventWarning:function(e,t,n){if(qx.core.Environment.get("qx.debug")){var r=e.self?e.self.classname:"unknown";this.warn("The event '"+(t||"unknown")+"' from class '"+r+"' is deprecated: "+(n||"Please consult the API documentation of this class for alternatives.")),this.trace()}},deprecatedMixinWarning:function(e,t){if(qx.core.Environment.get("qx.debug")){var n=e?e.name:"unknown";this.warn("The mixin '"+n+"' is deprecated: "+(t||"Please consult the API documentation of this class for alternatives.")),this.trace()}},deprecatedConstantWarning:function(e,t,n){if(qx.core.Environment.get("qx.debug")&&e.__defineGetter__){var r=this,i=e[t];e.__defineGetter__(t,function(){return r.warn("The constant '"+t+"' is deprecated: "+(n||"Please consult the API documentation for alternatives.")),r.trace(),i})}},deprecateMethodOverriding:function(e,t,n,r){if(qx.core.Environment.get("qx.debug"))for(var i=e.constructor;i.classname!==t.classname;){if(i.prototype.hasOwnProperty(n)){this.warn("The method '"+qx.lang.Function.getName(e[n])+"' overrides a deprecated method: "+(r||"Please consult the API documentation for alternatives.")),this.trace();break}i=i.superclass}},clear:function(){this.__buffer.clearHistory()},__buffer:new qx.log.appender.RingBuffer(50),__levels:{debug:0,info:1,warn:2,error:3},__log:function(e,t){var n=this.__levels;if(!(n[e]<n[this.__level])){for(var r=t.length<2?null:t[0],i=[],a=r?1:0,s=t.length;a<s;a++)i.push(this.__serialize(t[a],!0));var o=new Date,l={time:o,offset:o-qx.Bootstrap.LOADSTART,level:e,items:i,win:window};r&&(void 0!==r.$$hash?l.object=r.$$hash:r.$$type?l.clazz=r:r.constructor&&(l.clazz=r.constructor)),this.__buffer.process(l);var c=this.__appender;for(var u in c)c[u].process(l)}},__detect:function(e){if(void 0===e)return"undefined";if(null===e)return"null";if(e.$$type)return"class";var t=typeof e;return"function"===t||"string"==t||"number"===t||"boolean"===t?t:"object"===t?e.nodeType?"node":e instanceof Error||e.name&&e.message?"error":e.classname?"instance":e instanceof Array?"array":e instanceof Date?"date":"map":e.toString?"stringify":"unknown"},__serialize:function(e,t){var n=this.__detect(e),r="unknown",i=[];switch(n){case"null":case"undefined":r=n;break;case"string":case"number":case"boolean":case"date":r=e;break;case"node":9===e.nodeType?r="document":3===e.nodeType?r="text["+e.nodeValue+"]":1===e.nodeType?(r=e.nodeName.toLowerCase(),e.id&&(r+="#"+e.id)):r="node";break;case"function":r=qx.lang.Function.getName(e)||n;break;case"instance":r=e.basename+"["+e.$$hash+"]";break;case"class":case"stringify":r=e.toString();break;case"error":i=qx.dev.StackTrace.getStackTraceFromError(e),r=(e.basename?e.basename+": ":"")+e.toString();break;case"array":if(t){r=[];for(var a=0,s=e.length;a<s;a++){if(r.length>20){r.push("...(+"+(s-a)+")");break}r.push(this.__serialize(e[a],!1))}}else r="[...("+e.length+")]";break;case"map":if(t){var o,l=[];for(var c in e)l.push(c);for(l.sort(),r=[],a=0,s=l.length;a<s;a++){if(r.length>20){r.push("...(+"+(s-a)+")");break}c=l[a],(o=this.__serialize(e[c],!1)).key=c,r.push(o)}}else{var u=0;for(var c in e)u++;r="{...("+u+")}"}}return{type:n,text:r,trace:i}}},defer:function(e){for(var t=qx.Bootstrap.$$logs,n=0;n<t.length;n++)e.__log(t[n][0],t[n][1]);qx.Bootstrap.debug=e.debug,qx.Bootstrap.info=e.info,qx.Bootstrap.warn=e.warn,qx.Bootstrap.error=e.error,qx.Bootstrap.trace=e.trace}}),qx.Interface.define("qx.data.IListData",{events:{change:"qx.event.type.Data",changeLength:"qx.event.type.Event"},members:{getItem:function(e){},setItem:function(e,t){},splice:function(e,t,n){},contains:function(e){},getLength:function(){},toArray:function(){}}}),qx.Class.define("qx.core.ValidationError",{extend:qx.type.BaseError}),qx.Mixin.define("qx.core.MProperty",{members:{set:function(e,t){var n=qx.core.Property.$$method.set;if(qx.Bootstrap.isString(e)){if(!this[n[e]]){if(void 0!=this["set"+qx.Bootstrap.firstUp(e)])return this["set"+qx.Bootstrap.firstUp(e)](t),this;throw new Error("No such property: "+e)}return this[n[e]](t)}for(var r in e){if(!this[n[r]]){if(void 0!=this["set"+qx.Bootstrap.firstUp(r)]){this["set"+qx.Bootstrap.firstUp(r)](e[r]);continue}throw new Error("No such property: "+r)}this[n[r]](e[r])}return this},get:function(e){var t=qx.core.Property.$$method.get;if(!this[t[e]]){if(void 0!=this["get"+qx.Bootstrap.firstUp(e)])return this["get"+qx.Bootstrap.firstUp(e)]();throw new Error("No such property: "+e)}return this[t[e]]()},reset:function(e){var t=qx.core.Property.$$method.reset;if(!this[t[e]]){if(void 0!=this["reset"+qx.Bootstrap.firstUp(e)])return void this["reset"+qx.Bootstrap.firstUp(e)]();throw new Error("No such property: "+e)}this[t[e]]()}}}),qx.Mixin.define("qx.core.MLogging",{members:{__Logger:qx.log.Logger,debug:function(e){this.__logMessage("debug",arguments)},info:function(e){this.__logMessage("info",arguments)},warn:function(e){this.__logMessage("warn",arguments)},error:function(e){this.__logMessage("error",arguments)},trace:function(){this.__Logger.trace(this)},__logMessage:function(e,t){var n=qx.lang.Array.fromArguments(t);n.unshift(this),this.__Logger[e].apply(this.__Logger,n)}}}),qx.Bootstrap.define("qx.bom.Event",{statics:{addNativeListener:function(e,t,n,r){e.addEventListener?e.addEventListener(t,n,!!r):e.attachEvent?e.attachEvent("on"+t,n):void 0!==e["on"+t]?e["on"+t]=n:qx.core.Environment.get("qx.debug")&&qx.log.Logger.warn("No method available to add native listener to "+e)},removeNativeListener:function(e,t,n,r){if(e.removeEventListener)e.removeEventListener(t,n,!!r);else if(e.detachEvent)try{e.detachEvent("on"+t,n)}catch(e){if(-2146828218!==e.number)throw e}else void 0!==e["on"+t]?e["on"+t]=null:qx.core.Environment.get("qx.debug")&&qx.log.Logger.warn("No method available to remove native listener from "+e)},getTarget:function(e){return e.target||e.srcElement},getRelatedTarget:function(e){if(void 0!==e.relatedTarget){if("gecko"==qx.core.Environment.get("engine.name"))try{e.relatedTarget&&e.relatedTarget.nodeType}catch(e){return null}return e.relatedTarget}return void 0===e.fromElement||"mouseover"!==e.type&&"pointerover"!==e.type?void 0!==e.toElement?e.toElement:null:e.fromElement},preventDefault:function(e){if(e.preventDefault)e.preventDefault();else{try{e.keyCode=0}catch(e){}e.returnValue=!1}},stopPropagation:function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},fire:function(e,t){if(document.createEvent)return(n=document.createEvent("HTMLEvents")).initEvent(t,!0,!0),!e.dispatchEvent(n);var n=document.createEventObject();return e.fireEvent("on"+t,n)},supportsEvent:function(e,t){var n=qx.core.Environment.get("browser.name"),r=qx.core.Environment.get("engine.name");if(-1!=t.toLowerCase().indexOf("transitionend")&&"mshtml"===r&&qx.core.Environment.get("browser.documentmode")>9)return!0;if("webkit"===r&&["mobile safari","safari"].indexOf(n)>-1&&["loadeddata","progress","timeupdate","seeked","canplay","play","playing","pause","loadedmetadata","ended","volumechange"].indexOf(t.toLowerCase())>-1)return!0;if(e!=window&&-1!=t.toLowerCase().indexOf("transitionend")){var i=qx.core.Environment.get("css.transition");return i&&i["end-event"]==t}var a="on"+t.toLowerCase(),s=a in e;return s||!(s="function"==typeof e[a])&&e.setAttribute&&(e.setAttribute(a,"return;"),s="function"==typeof e[a],e.removeAttribute(a)),s},getEventName:function(e,t){for(var n=[""].concat(qx.bom.Style.VENDOR_PREFIXES),r=0,i=n.length;r<i;r++){var a=n[r].toLowerCase();if(qx.bom.Event.supportsEvent(e,a+t))return a?a+qx.lang.String.firstUp(t):t}return null}}}),qx.Bootstrap.define("qx.bom.client.CssTransition",{statics:{getTransitionName:function(){return qx.bom.Style.getPropertyName("transition")},getSupport:function(){var e=qx.bom.client.CssTransition.getTransitionName();if(!e)return null;var t=qx.bom.Event.getEventName(window,"transitionEnd");return(t="transitionEnd"==t?t.toLowerCase():t)||(t=e+(e.indexOf("Trans")>0?"E":"e")+"nd"),{name:e,"end-event":t}}},defer:function(e){qx.core.Environment.add("css.transition",e.getSupport)}}),qx.Bootstrap.define("qx.bom.Style",{statics:{VENDOR_PREFIXES:["Webkit","Moz","O","ms","Khtml"],__cssName:{},__supports:null,getPropertyName:function(e){var t=document.documentElement.style;if(void 0!==t[e])return e;for(var n=0,r=this.VENDOR_PREFIXES.length;n<r;n++){var i=this.VENDOR_PREFIXES[n]+qx.lang.String.firstUp(e);if(void 0!==t[i])return i}return null},getCssName:function(e){var t=this.__cssName[e];return t||(t=e.replace(/[A-Z]/g,function(e){return"-"+e.charAt(0).toLowerCase()}),/^ms/.test(t)&&(t="-"+t),this.__cssName[e]=t),t},getAppliedStyle:function(e,t,n,r){for(var i=qx.bom.Style.getCssName(t),a=qx.dom.Node.getWindow(e),s=!1!==r?[null].concat(this.VENDOR_PREFIXES):[null],o=0,l=s.length;o<l;o++){var c=!1,u=s[o]?"-"+s[o].toLowerCase()+"-"+n:n;if(qx.bom.Style.__supports?c=qx.bom.Style.__supports.call(a,i,u):(e.style.cssText+=i+":"+u+";",c="string"==typeof e.style[t]&&""!==e.style[t]),c)return u}return null}},defer:function(e){window.CSS&&window.CSS.supports?qx.bom.Style.__supports=window.CSS.supports.bind(window.CSS):window.supportsCSS&&(qx.bom.Style.__supports=window.supportsCSS.bind(window))}}),qx.Bootstrap.define("qx.dom.Node",{statics:{ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12,getDocument:function(e){return e.nodeType===this.DOCUMENT?e:e.ownerDocument||e.document},getWindow:function(e){return null==e.nodeType?e:(e.nodeType!==this.DOCUMENT&&(e=e.ownerDocument),e.defaultView||e.parentWindow)},getDocumentElement:function(e){return this.getDocument(e).documentElement},getBodyElement:function(e){return this.getDocument(e).body},isNode:function(e){return!(!e||null==e.nodeType)},isElement:function(e){return!(!e||e.nodeType!==this.ELEMENT)},isDocument:function(e){return!(!e||e.nodeType!==this.DOCUMENT)},isDocumentFragment:function(e){return!(!e||e.nodeType!==this.DOCUMENT_FRAGMENT)},isText:function(e){return!(!e||e.nodeType!==this.TEXT)},isWindow:function(e){return!!(e&&e.history&&e.location&&e.document)},isNodeName:function(e,t){return!!(t&&e&&e.nodeName)&&t.toLowerCase()==qx.dom.Node.getName(e)},getName:function(e){return e&&e.nodeName?e.nodeName.toLowerCase():null},getText:function(e){if(!e||!e.nodeType)return null;switch(e.nodeType){case 1:var t,n=[],r=e.childNodes,i=r.length;for(t=0;t<i;t++)n[t]=this.getText(r[t]);return n.join("");case 2:case 3:case 4:return e.nodeValue}return null},isBlockNode:function(e){return!!qx.dom.Node.isElement(e)&&(e=qx.dom.Node.getName(e),/^(body|form|textarea|fieldset|ul|ol|dl|dt|dd|li|div|hr|p|h[1-6]|quote|pre|table|thead|tbody|tfoot|tr|td|th|iframe|address|blockquote)$/.test(e))}}}),qx.Bootstrap.define("qx.bom.client.OperatingSystem",{statics:{getName:function(){if(!navigator)return"";var e=navigator.platform||"",t=navigator.userAgent||"";return-1!=e.indexOf("Windows")||-1!=e.indexOf("Win32")||-1!=e.indexOf("Win64")?"win":-1!=e.indexOf("Macintosh")||-1!=e.indexOf("MacPPC")||-1!=e.indexOf("MacIntel")||-1!=e.indexOf("Mac OS X")?"osx":-1!=t.indexOf("RIM Tablet OS")?"rim_tabletos":-1!=t.indexOf("webOS")?"webos":-1!=e.indexOf("iPod")||-1!=e.indexOf("iPhone")||-1!=e.indexOf("iPad")?"ios":-1!=t.indexOf("Android")?"android":-1!=e.indexOf("Linux")?"linux":-1!=e.indexOf("X11")||-1!=e.indexOf("BSD")||-1!=e.indexOf("Darwin")?"unix":-1!=e.indexOf("SymbianOS")?"symbian":-1!=e.indexOf("BlackBerry")?"blackberry":""},__ids:{"Windows NT 6.3":"8.1","Windows NT 6.2":"8","Windows NT 6.1":"7","Windows NT 6.0":"vista","Windows NT 5.2":"2003","Windows NT 5.1":"xp","Windows NT 5.0":"2000","Windows 2000":"2000","Windows NT 4.0":"nt4","Win 9x 4.90":"me","Windows CE":"ce","Windows 98":"98",Win98:"98","Windows 95":"95",Win95:"95","Mac OS X 10_9":"10.9","Mac OS X 10.9":"10.9","Mac OS X 10_8":"10.8","Mac OS X 10.8":"10.8","Mac OS X 10_7":"10.7","Mac OS X 10.7":"10.7","Mac OS X 10_6":"10.6","Mac OS X 10.6":"10.6","Mac OS X 10_5":"10.5","Mac OS X 10.5":"10.5","Mac OS X 10_4":"10.4","Mac OS X 10.4":"10.4","Mac OS X 10_3":"10.3","Mac OS X 10.3":"10.3","Mac OS X 10_2":"10.2","Mac OS X 10.2":"10.2","Mac OS X 10_1":"10.1","Mac OS X 10.1":"10.1","Mac OS X 10_0":"10.0","Mac OS X 10.0":"10.0"},getVersion:function(){var e=qx.bom.client.OperatingSystem.__getVersionForDesktopOs(navigator.userAgent);return null==e&&(e=qx.bom.client.OperatingSystem.__getVersionForMobileOs(navigator.userAgent)),null!=e?e:""},__getVersionForDesktopOs:function(e){var t=[];for(var n in qx.bom.client.OperatingSystem.__ids)t.push(n);var r=new RegExp("("+t.join("|").replace(/\./g,".")+")","g").exec(e);return r&&r[1]?qx.bom.client.OperatingSystem.__ids[r[1]]:null},__getVersionForMobileOs:function(e){var t=-1!=e.indexOf("Android"),n=!!e.match(/(iPad|iPhone|iPod)/i);if(t){var r=new RegExp(/ Android (\d+(?:\.\d+)+)/i).exec(e);if(r&&r[1])return r[1]}else if(n){var i=new RegExp(/(CPU|iPhone|iPod) OS (\d+)_(\d+)(?:_(\d+))*\s+/).exec(e);if(i&&i[2]&&i[3])return i[4]?i[2]+"."+i[3]+"."+i[4]:i[2]+"."+i[3]}return null}},defer:function(e){qx.core.Environment.add("os.name",e.getName),qx.core.Environment.add("os.version",e.getVersion)}}),qx.Bootstrap.define("qx.bom.client.Browser",{statics:{getName:function(){var e=navigator.userAgent,t=new RegExp("("+qx.bom.client.Browser.__agents+")(/|)?([0-9]+.[0-9])?"),n=e.match(t);if(!n)return"";var r=n[1].toLowerCase(),i=qx.bom.client.Engine.getName();return"webkit"===i?"android"===r?r="mobile chrome":-1!==e.indexOf("Mobile Safari")||-1!==e.indexOf("Mobile/")?r="mobile safari":-1!=e.indexOf(" OPR/")&&(r="opera"):"mshtml"===i?"msie"!==r&&"trident"!==r||(r="ie","ce"===qx.bom.client.OperatingSystem.getVersion()&&(r="iemobile"),t=new RegExp("IEMobile"),e.match(t)&&(r="iemobile")):"opera"===i?"opera mobi"===r?r="operamobile":"opera mini"===r&&(r="operamini"):"gecko"===i&&-1!==e.indexOf("Maple")&&(r="maple"),r},getVersion:function(){var e=navigator.userAgent,t=new RegExp("("+qx.bom.client.Browser.__agents+")(/| )([0-9]+.[0-9])"),n=e.match(t);if(!n)return"";var r=n[1].toLowerCase(),i=n[3];if(e.match(/Version(\/| )([0-9]+\.[0-9])/)&&(i=RegExp.$2),"mshtml"==qx.bom.client.Engine.getName()&&(i=qx.bom.client.Engine.getVersion(),"msie"===r&&"ce"==qx.bom.client.OperatingSystem.getVersion()&&(i="5.0")),"maple"==qx.bom.client.Browser.getName()){if(t=new RegExp("(Maple )([0-9]+.[0-9]+.[0-9]*)"),!(n=e.match(t)))return"";i=n[2]}return"webkit"!=qx.bom.client.Engine.getName()&&"opera"!=qx.bom.client.Browser.getName()||e.match(/OPR(\/| )([0-9]+\.[0-9])/)&&(i=RegExp.$2),i},getDocumentMode:function(){return document.documentMode?document.documentMode:0},getQuirksMode:function(){return"mshtml"==qx.bom.client.Engine.getName()&&parseFloat(qx.bom.client.Engine.getVersion())>=8?5===qx.bom.client.Engine.DOCUMENT_MODE:"CSS1Compat"!==document.compatMode},__agents:{webkit:"AdobeAIR|Titanium|Fluid|Chrome|Android|Epiphany|Konqueror|iCab|iPad|iPhone|OmniWeb|Maxthon|Pre|PhantomJS|Mobile Safari|Safari",gecko:"prism|Fennec|Camino|Kmeleon|Galeon|Netscape|SeaMonkey|Namoroka|Firefox",mshtml:"IEMobile|Maxthon|MSIE|Trident",opera:"Opera Mini|Opera Mobi|Opera"}[qx.bom.client.Engine.getName()]},defer:function(e){qx.core.Environment.add("browser.name",e.getName),qx.core.Environment.add("browser.version",e.getVersion),qx.core.Environment.add("browser.documentmode",e.getDocumentMode),qx.core.Environment.add("browser.quirksmode",e.getQuirksMode)}}),qx.Class.define("qx.event.Manager",{extend:Object,construct:function(e,t){if(this.__window=e,this.__windowId=qx.core.ObjectRegistry.toHashCode(e),this.__registration=t,e.qx!==qx){var n=this;qx.bom.Event.addNativeListener(e,"unload",qx.event.GlobalError.observeMethod(function(){qx.bom.Event.removeNativeListener(e,"unload",arguments.callee),n.dispose()}))}this.__listeners={},this.__handlers={},this.__dispatchers={},this.__handlerCache={}},statics:{__lastUnique:0,getNextUniqueId:function(){return this.__lastUnique+++""}},members:{__registration:null,__listeners:null,__dispatchers:null,__disposeWrapper:null,__handlers:null,__handlerCache:null,__window:null,__windowId:null,getWindow:function(){return this.__window},getWindowId:function(){return this.__windowId},getHandler:function(e){return this.__handlers[e.classname]||(this.__handlers[e.classname]=new e(this))},getDispatcher:function(e){return this.__dispatchers[e.classname]||(this.__dispatchers[e.classname]=new e(this,this.__registration))},getListeners:function(e,t,n){var r=e.$$hash||qx.core.ObjectRegistry.toHashCode(e),i=this.__listeners[r];if(!i)return null;var a=i[t+(n?"|capture":"|bubble")];return a?a.concat():null},getAllListeners:function(){return this.__listeners},serializeListeners:function(e){var t,n,r,i,a,s=e.$$hash||qx.core.ObjectRegistry.toHashCode(e),o=this.__listeners[s],l=[];if(o)for(var c in o){t=c.indexOf("|"),n=c.substring(0,t),r="c"==c.charAt(t+1);for(var u=0,d=(i=o[c]).length;u<d;u++)a=i[u],l.push({self:a.context,handler:a.handler,type:n,capture:r})}return l},toggleAttachedEvents:function(e,t){var n,r,i,a=e.$$hash||qx.core.ObjectRegistry.toHashCode(e),s=this.__listeners[a];if(s)for(var o in s)n=o.indexOf("|"),r=o.substring(0,n),i=99===o.charCodeAt(n+1),s[o],t?this.__registerAtHandler(e,r,i):this.__unregisterAtHandler(e,r,i)},hasListener:function(e,t,n){if(qx.core.Environment.get("qx.debug")&&null==e)throw qx.log.Logger.trace(this),new Error("Invalid object: "+e);var r=e.$$hash||qx.core.ObjectRegistry.toHashCode(e),i=this.__listeners[r];if(!i)return!1;var a=i[t+(n?"|capture":"|bubble")];return!!(a&&a.length>0)},importListeners:function(e,t){if(qx.core.Environment.get("qx.debug")&&null==e)throw qx.log.Logger.trace(this),new Error("Invalid object: "+e);var n=e.$$hash||qx.core.ObjectRegistry.toHashCode(e),r=this.__listeners[n]={},i=qx.event.Manager;for(var a in t){var s=t[a],o=s.type+(s.capture?"|capture":"|bubble"),l=r[o];l||(l=r[o]=[],this.__registerAtHandler(e,s.type,s.capture)),l.push({handler:s.listener,context:s.self,unique:s.unique||i.__lastUnique+++""})}},addListener:function(e,t,n,r,i){if(qx.core.Environment.get("qx.debug")){var a="Failed to add event listener for type '"+t+"' to the target '"+e.classname+"': ";qx.core.Assert.assertObject(e,a+"Invalid Target."),qx.core.Assert.assertString(t,a+"Invalid event type."),qx.core.Assert.assertFunction(n,a+"Invalid callback function"),void 0!==i&&qx.core.Assert.assertBoolean(i,"Invalid capture flag.")}var s=e.$$hash||qx.core.ObjectRegistry.toHashCode(e),o=this.__listeners[s];o||(o=this.__listeners[s]={});var l=t+(i?"|capture":"|bubble"),c=o[l];c||(c=o[l]=[]),0===c.length&&this.__registerAtHandler(e,t,i);var u=qx.event.Manager.__lastUnique+++"",d={handler:n,context:r,unique:u};return c.push(d),l+"|"+u},findHandler:function(e,t){var n,r=!1,i=!1,a=!1,s=!1;1===e.nodeType?(r=!0,n="DOM_"+e.tagName.toLowerCase()+"_"+t):9===e.nodeType?(s=!0,n="DOCUMENT_"+t):e==this.__window?(i=!0,n="WIN_"+t):e.classname?(a=!0,n="QX_"+e.classname+"_"+t):n="UNKNOWN_"+e+"_"+t;var o=this.__handlerCache;if(o[n])return o[n];for(var l,c,u,d,p=this.__registration.getHandlers(),g=qx.event.IEventHandler,h=0,m=p.length;h<m;h++)if(!(u=(l=p[h]).SUPPORTED_TYPES)||u[t]){if(d=l.TARGET_CHECK){var f=!1;if(r&&0!=(d&g.TARGET_DOMNODE)?f=!0:i&&0!=(d&g.TARGET_WINDOW)?f=!0:a&&0!=(d&g.TARGET_OBJECT)?f=!0:s&&0!=(d&g.TARGET_DOCUMENT)&&(f=!0),!f)continue}if(c=this.getHandler(p[h]),l.IGNORE_CAN_HANDLE||c.canHandleEvent(e,t))return o[n]=c,c}return null},__registerAtHandler:function(e,t,n){var r=this.findHandler(e,t);r?r.registerEvent(e,t,n):qx.core.Environment.get("qx.debug")&&qx.log.Logger.warn(this,"There is no event handler for the event '"+t+"' on target '"+e+"'!")},removeListener:function(e,t,n,r,i){if(qx.core.Environment.get("qx.debug")){var a="Failed to remove event listener for type '"+t+"' from the target '"+e.classname+"': ";qx.core.Assert.assertObject(e,a+"Invalid Target."),qx.core.Assert.assertString(t,a+"Invalid event type."),qx.core.Assert.assertFunction(n,a+"Invalid callback function"),void 0!==r&&qx.core.Assert.assertObject(r,"Invalid context for callback."),void 0!==i&&qx.core.Assert.assertBoolean(i,"Invalid capture flag.")}var s=e.$$hash||qx.core.ObjectRegistry.toHashCode(e),o=this.__listeners[s];if(!o)return!1;var l,c=o[t+(i?"|capture":"|bubble")];if(!c)return!1;for(var u=0,d=c.length;u<d;u++)if((l=c[u]).handler===n&&l.context===r)return qx.lang.Array.removeAt(c,u),0==c.length&&this.__unregisterAtHandler(e,t,i),!0;return!1},removeListenerById:function(e,t){if(qx.core.Environment.get("qx.debug")){var n="Failed to remove event listener for id '"+t+"' from the target '"+e.classname+"': ";qx.core.Assert.assertObject(e,n+"Invalid Target."),qx.core.Assert.assertString(t,n+"Invalid id type.")}var r=t.split("|"),i=r[0],a=99==r[1].charCodeAt(0),s=r[2],o=e.$$hash||qx.core.ObjectRegistry.toHashCode(e),l=this.__listeners[o];if(!l)return!1;var c=l[i+(a?"|capture":"|bubble")];if(!c)return!1;for(var u=0,d=c.length;u<d;u++)if(c[u].unique===s)return qx.lang.Array.removeAt(c,u),0==c.length&&this.__unregisterAtHandler(e,i,a),!0;return!1},removeAllListeners:function(e){var t,n,r,i=e.$$hash||qx.core.ObjectRegistry.toHashCode(e),a=this.__listeners[i];if(!a)return!1;for(var s in a)a[s].length>0&&(n=(t=s.split("|"))[0],r="capture"===t[1],this.__unregisterAtHandler(e,n,r));return delete this.__listeners[i],!0},deleteAllListeners:function(e){delete this.__listeners[e]},__unregisterAtHandler:function(e,t,n){var r=this.findHandler(e,t);r?r.unregisterEvent(e,t,n):qx.core.Environment.get("qx.debug")&&qx.log.Logger.warn(this,"There is no event handler for the event '"+t+"' on target '"+e+"'!")},dispatchEvent:function(e,t){if(qx.core.Environment.get("qx.debug")){var n="Could not dispatch event '"+t+"' on target '"+e.classname+"': ";qx.core.Assert.assertNotUndefined(e,n+"Invalid event target."),qx.core.Assert.assertNotNull(e,n+"Invalid event target."),qx.core.Assert.assertInstance(t,qx.event.type.Event,n+"Invalid event object.")}var r=t.getType();if(!t.getBubbles()&&!this.hasListener(e,r))return qx.event.Pool.getInstance().poolObject(t),!0;t.getTarget()||t.setTarget(e);for(var i,a=this.__registration.getDispatchers(),s=!1,o=0,l=a.length;o<l;o++)if((i=this.getDispatcher(a[o])).canDispatchEvent(e,t,r)){i.dispatchEvent(e,t,r),s=!0;break}if(!s)return qx.core.Environment.get("qx.debug")&&qx.log.Logger.error(this,"No dispatcher can handle event of type "+r+" on "+e),!0;var c=t.getDefaultPrevented();return qx.event.Pool.getInstance().poolObject(t),!c},dispose:function(){this.__registration.removeManager(this),qx.util.DisposeUtil.disposeMap(this,"__handlers"),qx.util.DisposeUtil.disposeMap(this,"__dispatchers"),this.__listeners=this.__window=this.__disposeWrapper=null,this.__registration=this.__handlerCache=null}}}),qx.Class.define("qx.util.DisposeUtil",{statics:{disposeObjects:function(e,t,n){for(var r,i=0,a=t.length;i<a;i++)if(null!=e[r=t[i]]&&e.hasOwnProperty(r)){if(!qx.core.ObjectRegistry.inShutDown){if(!e[r].dispose)throw new Error("Has no disposable object under key: "+r+"!");if(!n&&e[r].constructor.$$instance)throw new Error("The object stored in key "+r+" is a singleton! Please use disposeSingleton instead.");e[r].dispose()}e[r]=null}},disposeArray:function(e,t){var n=e[t];if(n)if(qx.core.ObjectRegistry.inShutDown)e[t]=null;else{try{for(var r,i=n.length-1;i>=0;i--)(r=n[i])&&r.dispose()}catch(n){throw new Error("The array field: "+t+" of object: "+e+" has non disposable entries: "+n)}n.length=0,e[t]=null}},disposeMap:function(e,t){var n=e[t];if(n)if(qx.core.ObjectRegistry.inShutDown)e[t]=null;else{try{var r;for(var i in n)r=n[i],n.hasOwnProperty(i)&&r&&r.dispose()}catch(n){throw new Error("The map field: "+t+" of object: "+e+" has non disposable entries: "+n)}e[t]=null}},disposeTriggeredBy:function(e,t){var n=t.dispose;t.dispose=function(){n.call(t),e.dispose()}},destroyContainer:function(e){qx.core.Environment.get("qx.debug")&&(qx.ui.mobile&&e instanceof qx.ui.mobile.core.Widget?qx.core.Assert.assertTrue(this.__isChildrenContainer(e),"Container must be an instance of qx.ui.mobile.container.Composite."):(qx.core.Assert.assertQxWidget(e,"First argument must be a container widget!"),qx.core.Assert.assertTrue(this.__isChildrenContainer(e),"Container must be an instance of qx.ui.container.Composite or qx.ui.container.Scroll or qx.ui.container.Resizer or qx.ui.container.SlideBar or qx.ui.container.Stack!")));var t=[];this._collectContainerChildren(e,t);for(var n=t.length-1;n>=0;n--)t[n].destroy();e.destroy()},_collectContainerChildren:function(e,t){for(var n=e.getChildren(),r=0;r<n.length;r++){var i=n[r];t.push(i),this.__isChildrenContainer(i)&&this._collectContainerChildren(i,t)}},__isChildrenContainer:function(e){for(var t,n=0,r=(t=qx.ui.mobile&&e instanceof qx.ui.mobile.core.Widget?[qx.ui.mobile.container.Composite]:[qx.ui.container.Composite,qx.ui.container.Scroll,qx.ui.container.SlideBar,qx.ui.container.Stack]).length;n<r;n++)if(void 0!==t[n]&&qx.Class.isSubClassOf(e.constructor,t[n]))return!0;return!1}}}),qx.Class.define("qx.event.Registration",{statics:{__managers:{},getManager:function(e){null==e?(qx.core.Environment.get("qx.debug")&&(qx.log.Logger.error("qx.event.Registration.getManager(null) was called!"),qx.log.Logger.trace(this)),e=window):e.nodeType?e=qx.dom.Node.getWindow(e):qx.dom.Node.isWindow(e)||(e=window);var t=e.$$hash||qx.core.ObjectRegistry.toHashCode(e),n=this.__managers[t];return n||(n=new qx.event.Manager(e,this),this.__managers[t]=n),n},removeManager:function(e){var t=e.getWindowId();delete this.__managers[t]},addListener:function(e,t,n,r,i){return this.getManager(e).addListener(e,t,n,r,i)},removeListener:function(e,t,n,r,i){return this.getManager(e).removeListener(e,t,n,r,i)},removeListenerById:function(e,t){return this.getManager(e).removeListenerById(e,t)},removeAllListeners:function(e){return this.getManager(e).removeAllListeners(e)},deleteAllListeners:function(e){var t=e.$$hash;t&&this.getManager(e).deleteAllListeners(t)},hasListener:function(e,t,n){return this.getManager(e).hasListener(e,t,n)},serializeListeners:function(e){return this.getManager(e).serializeListeners(e)},createEvent:function(e,t,n){if(qx.core.Environment.get("qx.debug")&&arguments.length>1&&void 0===t)throw new Error("Create event of type "+e+" with undefined class. Please use null to explicit fallback to default event type!");null==t&&(t=qx.event.type.Event);var r=qx.event.Pool.getInstance().getObject(t);return n?r.init.apply(r,n):r.init(),e&&r.setType(e),r},dispatchEvent:function(e,t){return this.getManager(e).dispatchEvent(e,t)},fireEvent:function(e,t,n,r){if(qx.core.Environment.get("qx.debug")){if(arguments.length>2&&void 0===n&&void 0!==r)throw new Error("Create event of type "+t+" with undefined class. Please use null to explicit fallback to default event type!");var i="Could not fire event '"+t+"' on target '"+(e?e.classname:"undefined")+"': ";qx.core.Assert.assertNotUndefined(e,i+"Invalid event target."),qx.core.Assert.assertNotNull(e,i+"Invalid event target.")}var a=this.createEvent(t,n||null,r);return this.getManager(e).dispatchEvent(e,a)},fireNonBubblingEvent:function(e,t,n,r){if(qx.core.Environment.get("qx.debug")&&arguments.length>2&&void 0===n&&void 0!==r)throw new Error("Create event of type "+t+" with undefined class. Please use null to explicit fallback to default event type!");var i=this.getManager(e);if(!i.hasListener(e,t,!1))return!0;var a=this.createEvent(t,n||null,r);return i.dispatchEvent(e,a)},PRIORITY_FIRST:-32e3,PRIORITY_NORMAL:0,PRIORITY_LAST:32e3,__handlers:[],addHandler:function(e){qx.core.Environment.get("qx.debug")&&qx.core.Assert.assertInterface(e,qx.event.IEventHandler,"Invalid event handler."),this.__handlers.push(e),this.__handlers.sort(function(e,t){return e.PRIORITY-t.PRIORITY})},getHandlers:function(){return this.__handlers},__dispatchers:[],addDispatcher:function(e,t){qx.core.Environment.get("qx.debug")&&qx.core.Assert.assertInterface(e,qx.event.IEventDispatcher,"Invalid event dispatcher!"),this.__dispatchers.push(e),this.__dispatchers.sort(function(e,t){return e.PRIORITY-t.PRIORITY})},getDispatchers:function(){return this.__dispatchers}}}),qx.Mixin.define("qx.core.MEvent",{members:{__Registration:qx.event.Registration,addListener:function(e,t,n,r){return this.$$disposed?null:this.__Registration.addListener(this,e,t,n,r)},addListenerOnce:function(e,t,n,r){var i=function(i){this.removeListener(e,t,this,r),t.call(n||this,i)};return t.$$wrapped_callback||(t.$$wrapped_callback={}),t.$$wrapped_callback[e+this.$$hash]=i,this.addListener(e,i,this,r)},removeListener:function(e,t,n,r){if(!this.$$disposed){if(t.$$wrapped_callback&&t.$$wrapped_callback[e+this.$$hash]){var i=t.$$wrapped_callback[e+this.$$hash];delete t.$$wrapped_callback[e+this.$$hash],t=i}return this.__Registration.removeListener(this,e,t,n,r)}return!1},removeListenerById:function(e){return!this.$$disposed&&this.__Registration.removeListenerById(this,e)},hasListener:function(e,t){return this.__Registration.hasListener(this,e,t)},dispatchEvent:function(e){return!!this.$$disposed||this.__Registration.dispatchEvent(this,e)},fireEvent:function(e,t,n){return!!this.$$disposed||this.__Registration.fireEvent(this,e,t,n)},fireNonBubblingEvent:function(e,t,n){return!!this.$$disposed||this.__Registration.fireNonBubblingEvent(this,e,t,n)},fireDataEvent:function(e,t,n,r){return!!this.$$disposed||(void 0===n&&(n=null),this.__Registration.fireNonBubblingEvent(this,e,qx.event.type.Data,[t,n,!!r]))}}}),qx.Mixin.define("qx.core.MAssert",{members:{assert:function(e,t){qx.core.Assert.assert(e,t)},fail:function(e,t){qx.core.Assert.fail(e,t)},assertTrue:function(e,t){qx.core.Assert.assertTrue(e,t)},assertFalse:function(e,t){qx.core.Assert.assertFalse(e,t)},assertEquals:function(e,t,n){qx.core.Assert.assertEquals(e,t,n)},assertNotEquals:function(e,t,n){qx.core.Assert.assertNotEquals(e,t,n)},assertIdentical:function(e,t,n){qx.core.Assert.assertIdentical(e,t,n)},assertNotIdentical:function(e,t,n){qx.core.Assert.assertNotIdentical(e,t,n)},assertNotUndefined:function(e,t){qx.core.Assert.assertNotUndefined(e,t)},assertUndefined:function(e,t){qx.core.Assert.assertUndefined(e,t)},assertNotNull:function(e,t){qx.core.Assert.assertNotNull(e,t)},assertNull:function(e,t){qx.core.Assert.assertNull(e,t)},assertJsonEquals:function(e,t,n){qx.core.Assert.assertJsonEquals(e,t,n)},assertMatch:function(e,t,n){qx.core.Assert.assertMatch(e,t,n)},assertArgumentsCount:function(e,t,n,r){qx.core.Assert.assertArgumentsCount(e,t,n,r)},assertEventFired:function(e,t,n,r,i){qx.core.Assert.assertEventFired(e,t,n,r,i)},assertEventNotFired:function(e,t,n,r){qx.core.Assert.assertEventNotFired(e,t,n,r)},assertException:function(e,t,n,r){qx.core.Assert.assertException(e,t,n,r)},assertInArray:function(e,t,n){qx.core.Assert.assertInArray(e,t,n)},assertArrayEquals:function(e,t,n){qx.core.Assert.assertArrayEquals(e,t,n)},assertKeyInMap:function(e,t,n){qx.core.Assert.assertKeyInMap(e,t,n)},assertFunction:function(e,t){qx.core.Assert.assertFunction(e,t)},assertString:function(e,t){qx.core.Assert.assertString(e,t)},assertBoolean:function(e,t){qx.core.Assert.assertBoolean(e,t)},assertNumber:function(e,t){qx.core.Assert.assertNumber(e,t)},assertPositiveNumber:function(e,t){qx.core.Assert.assertPositiveNumber(e,t)},assertInteger:function(e,t){qx.core.Assert.assertInteger(e,t)},assertPositiveInteger:function(e,t){qx.core.Assert.assertPositiveInteger(e,t)},assertInRange:function(e,t,n,r){qx.core.Assert.assertInRange(e,t,n,r)},assertObject:function(e,t){qx.core.Assert.assertObject(e,t)},assertArray:function(e,t){qx.core.Assert.assertArray(e,t)},assertMap:function(e,t){qx.core.Assert.assertMap(e,t)},assertRegExp:function(e,t){qx.core.Assert.assertRegExp(e,t)},assertType:function(e,t,n){qx.core.Assert.assertType(e,t,n)},assertInstance:function(e,t,n){qx.core.Assert.assertInstance(e,t,n)},assertInterface:function(e,t,n){qx.core.Assert.assertInterface(e,t,n)},assertCssColor:function(e,t,n){qx.core.Assert.assertCssColor(e,t,n)},assertElement:function(e,t){qx.core.Assert.assertElement(e,t)},assertQxObject:function(e,t){qx.core.Assert.assertQxObject(e,t)},assertQxWidget:function(e,t){qx.core.Assert.assertQxWidget(e,t)}}}),qx.Class.define("qx.core.Object",{extend:Object,include:qx.core.Environment.filter({"module.databinding":qx.data.MBinding,"module.logger":qx.core.MLogging,"module.events":qx.core.MEvent,"module.property":qx.core.MProperty,"qx.debug":qx.core.MAssert}),construct:function(){qx.core.ObjectRegistry.register(this)},statics:{$$type:"Object"},members:{__Property:qx.core.Environment.get("module.property")?qx.core.Property:null,toHashCode:function(){return this.$$hash},toString:function(){return this.classname+"["+this.$$hash+"]"},base:function(e,t){if(qx.core.Environment.get("qx.debug")&&!qx.Bootstrap.isFunction(e.callee.base))throw new Error("Cannot call super class. Method is not derived: "+e.callee.displayName);return 1===arguments.length?e.callee.base.call(this):e.callee.base.apply(this,Array.prototype.slice.call(arguments,1))},self:function(e){return e.callee.self},clone:function(){if(!qx.core.Environment.get("module.property"))throw new Error("Cloning only possible with properties.");for(var e,t=this.constructor,n=new t,r=qx.Class.getProperties(t),i=this.__Property.$$store.user,a=this.__Property.$$method.set,s=0,o=r.length;s<o;s++)e=r[s],this.hasOwnProperty(i[e])&&n[a[e]](this[i[e]]);return n},__userData:null,setUserData:function(e,t){this.__userData||(this.__userData={}),this.__userData[e]=t},getUserData:function(e){if(!this.__userData)return null;var t=this.__userData[e];return void 0===t?null:t},isDisposed:function(){return this.$$disposed||!1},dispose:function(){if(!this.$$disposed){this.$$disposed=!0,this.$$instance=null,this.$$allowconstruct=null,qx.core.Environment.get("qx.debug")&&qx.core.Environment.get("qx.debug.dispose.level")>2&&qx.Bootstrap.debug(this,"Disposing "+this.classname+"["+this.toHashCode()+"]");for(var e,t,n,r=this.constructor;r.superclass;){if(r.$$destructor&&r.$$destructor.call(this),r.$$includes)for(var i=0,a=(e=r.$$flatIncludes).length;i<a;i++)e[i].$$destructor&&e[i].$$destructor.call(this);r=r.superclass}if(qx.core.Environment.get("qx.debug")&&qx.core.Environment.get("qx.debug.dispose.level")>0)for(t in this)if(null!==(n=this[t])&&"object"==typeof n&&!qx.Bootstrap.isString(n)){if(null!=this.constructor.prototype[t])continue;qx.core.Environment.get("qx.debug.dispose.level")>1&&(qx.Bootstrap.warn(this,"Missing destruct definition for '"+t+"' in "+this.classname+"["+this.toHashCode()+"]: "+n),delete this[t])}}},_disposeObjects:function(e){qx.util.DisposeUtil.disposeObjects(this,arguments)},_disposeSingletonObjects:function(e){qx.util.DisposeUtil.disposeObjects(this,arguments,!0)},_disposeArray:function(e){qx.util.DisposeUtil.disposeArray(this,e)},_disposeMap:function(e){qx.util.DisposeUtil.disposeMap(this,e)}},environment:{"qx.debug.dispose.level":0},destruct:function(){if(qx.core.Environment.get("module.events")&&(qx.core.ObjectRegistry.inShutDown?qx.event.Registration.deleteAllListeners(this):qx.event.Registration.removeAllListeners(this)),qx.core.ObjectRegistry.unregister(this),this.__userData=null,qx.core.Environment.get("module.property"))for(var e,t=this.constructor,n=this.__Property.$$store,r=n.user,i=n.theme,a=n.inherit,s=n.useinit,o=n.init;t;){if(e=t.$$properties)for(var l in e)e[l].dereference&&(this[r[l]]=this[i[l]]=this[a[l]]=this[s[l]]=this[o[l]]=void 0);t=t.superclass}}}),qx.Class.define("qx.event.type.Event",{extend:qx.core.Object,statics:{CAPTURING_PHASE:1,AT_TARGET:2,BUBBLING_PHASE:3},members:{init:function(e,t){return qx.core.Environment.get("qx.debug")&&(void 0!==e&&qx.core.Assert.assertBoolean(e,"Invalid argument value 'canBubble'."),void 0!==t&&qx.core.Assert.assertBoolean(t,"Invalid argument value 'cancelable'.")),this._type=null,this._target=null,this._currentTarget=null,this._relatedTarget=null,this._originalTarget=null,this._stopPropagation=!1,this._preventDefault=!1,this._bubbles=!!e,this._cancelable=!!t,this._timeStamp=(new Date).getTime(),this._eventPhase=null,this},clone:function(e){if(e)var t=e;else t=qx.event.Pool.getInstance().getObject(this.constructor);return t._type=this._type,t._target=this._target,t._currentTarget=this._currentTarget,t._relatedTarget=this._relatedTarget,t._originalTarget=this._originalTarget,t._stopPropagation=this._stopPropagation,t._bubbles=this._bubbles,t._preventDefault=this._preventDefault,t._cancelable=this._cancelable,t},stop:function(){this._bubbles&&this.stopPropagation(),this._cancelable&&this.preventDefault()},stopPropagation:function(){qx.core.Environment.get("qx.debug")&&this.assertTrue(this._bubbles,"Cannot stop propagation on a non bubbling event: "+this.getType()),this._stopPropagation=!0},getPropagationStopped:function(){return!!this._stopPropagation},preventDefault:function(){qx.core.Environment.get("qx.debug")&&this.assertTrue(this._cancelable,"Cannot prevent default action on a non cancelable event: "+this.getType()),this._preventDefault=!0},getDefaultPrevented:function(){return!!this._preventDefault},getType:function(){return this._type},setType:function(e){this._type=e},getEventPhase:function(){return this._eventPhase},setEventPhase:function(e){this._eventPhase=e},getTimeStamp:function(){return this._timeStamp},getTarget:function(){return this._target},setTarget:function(e){this._target=e},getCurrentTarget:function(){return this._currentTarget||this._target},setCurrentTarget:function(e){this._currentTarget=e},getRelatedTarget:function(){return this._relatedTarget},setRelatedTarget:function(e){this._relatedTarget=e},getOriginalTarget:function(){return this._originalTarget},setOriginalTarget:function(e){this._originalTarget=e},getBubbles:function(){return this._bubbles},setBubbles:function(e){this._bubbles=e},isCancelable:function(){return this._cancelable},setCancelable:function(e){this._cancelable=e}},destruct:function(){this._target=this._currentTarget=this._relatedTarget=this._originalTarget=null}}),qx.Class.define("qx.util.ObjectPool",{extend:qx.core.Object,construct:function(e){this.base(arguments),this.__pool={},null!=e&&this.setSize(e)},properties:{size:{check:"Integer",init:1/0}},members:{__pool:null,getObject:function(e){if(this.$$disposed)return new e;if(!e)throw new Error("Class needs to be defined!");var t=null,n=this.__pool[e.classname];return n&&(t=n.pop()),t?t.$$pooled=!1:t=new e,t},poolObject:function(e){if(this.__pool){var t=e.classname,n=this.__pool[t];if(e.$$pooled)throw new Error("Object is already pooled: "+e);n||(this.__pool[t]=n=[]),n.length>this.getSize()?e.destroy?e.destroy():e.dispose():(e.$$pooled=!0,n.push(e))}}},destruct:function(){var e,t,n,r,i=this.__pool;for(e in i)for(n=0,r=(t=i[e]).length;n<r;n++)t[n].dispose();delete this.__pool}}),qx.Class.define("qx.event.Pool",{extend:qx.util.ObjectPool,type:"singleton",construct:function(){this.base(arguments,30)}}),qx.Class.define("qx.event.type.Data",{extend:qx.event.type.Event,members:{__data:null,__old:null,init:function(e,t,n){return this.base(arguments,!1,n),this.__data=e,this.__old=t,this},clone:function(e){var t=this.base(arguments,e);return t.__data=this.__data,t.__old=this.__old,t},getData:function(){return this.__data},getOldData:function(){return this.__old}},destruct:function(){this.__data=this.__old=null}}),qx.Interface.define("qx.event.IEventHandler",{statics:{TARGET_DOMNODE:1,TARGET_WINDOW:2,TARGET_OBJECT:4,TARGET_DOCUMENT:8},members:{canHandleEvent:function(e,t){},registerEvent:function(e,t,n){},unregisterEvent:function(e,t,n){}}}),qx.Class.define("qx.event.handler.Object",{extend:qx.core.Object,implement:qx.event.IEventHandler,statics:{PRIORITY:qx.event.Registration.PRIORITY_LAST,SUPPORTED_TYPES:null,TARGET_CHECK:qx.event.IEventHandler.TARGET_OBJECT,IGNORE_CAN_HANDLE:!1},members:{canHandleEvent:function(e,t){return qx.Class.supportsEvent(e.constructor,t)},registerEvent:function(e,t,n){},unregisterEvent:function(e,t,n){}},defer:function(e){qx.event.Registration.addHandler(e)}}),qx.Interface.define("qx.event.IEventDispatcher",{members:{canDispatchEvent:function(e,t,n){this.assertInstance(t,qx.event.type.Event),this.assertString(n)},dispatchEvent:function(e,t,n){this.assertInstance(t,qx.event.type.Event),this.assertString(n)}}}),qx.Class.define("qx.event.dispatch.Direct",{extend:qx.core.Object,implement:qx.event.IEventDispatcher,construct:function(e){this._manager=e},statics:{PRIORITY:qx.event.Registration.PRIORITY_LAST},members:{canDispatchEvent:function(e,t,n){return!t.getBubbles()},dispatchEvent:function(e,t,n){if(qx.core.Environment.get("qx.debug")&&e instanceof qx.core.Object){var r=qx.Class.getEventType(e.constructor,n),i=qx.Class.getByName(r);i?t instanceof i||this.error("Expected event type to be instanceof '"+r+"' but found '"+t.classname+"'"):this.error("The event type '"+n+"' declared in the class '"+e.constructor+" is not an available class': "+r)}t.setEventPhase(qx.event.type.Event.AT_TARGET);var a=this._manager.getListeners(e,n,!1);if(a)for(var s=0,o=a.length;s<o;s++){var l=a[s].context||e;qx.core.Environment.get("qx.debug")&&l&&l.isDisposed&&l.isDisposed()&&this.warn("The context object '"+l+"' for the event '"+n+"' of '"+e+"'is already disposed."),a[s].handler.call(l,t)}}},defer:function(e){qx.event.Registration.addDispatcher(e)}}),qx.Class.define("wialon.core.Session",{extend:qx.core.Object,type:"singleton",construct:function(){this.base(arguments),this.__itemFuncs={},this.__itemConstr={},this._libraries={}},members:{__initialized:0,__sessionId:"",__evtPollInterval:0,__evtPollTimeoutId:null,__evtPollLastTime:0,__currUser:null,__serverTime:0,__classes:null,__itemsById:null,__itemsByType:null,__itemFuncs:null,__itemConstr:null,_libraries:null,__authUser:"",__renderer:null,__messagesLoader:null,__baseUrl:"",__internalGis:!1,__appDns:"",__loginHash:"",__checkLoginService:"",__skippedUpdates:{},__features:null,__version:"",__jsVersion:"1.51",__ajaxVersion:"",__token:null,__hiddenLogin:0,__isLocal:0,__hwGatewayIp:"",__env:{},__gisBaseUrl:"",__apiPath:"/wialon/ajax.html",__ignoreBaseUrl:!1,__whiteLabel:!1,__logger:null,__siteName:null,initSession:function(e,t,n,r,i,a){return!this.__initialized&&(wialon.item.Item.registerProperties(),wialon.item.User.registerProperties(),wialon.item.Unit.registerProperties(),wialon.item.Resource.registerProperties(),wialon.item.UnitGroup.registerProperties(),wialon.item.Retranslator.registerProperties(),wialon.item.Route.registerProperties(),this.__baseUrl=e,this.__gisBaseUrl=e,void 0!==t&&(this.__appDns=t),void 0===n||isNaN(parseInt(n))||2048&parseInt(n)&&(this.__internalGis=!0),void 0!==r&&(this.__checkLoginService=r),this.__renderer=new wialon.render.Renderer,this.__messagesLoader=new wialon.core.MessagesLoader,this.__initialized=1,i&&(this.__version=i),a&&(a.apiPath&&(this.__apiPath=a.apiPath),a.gisUrl&&(this.__gisBaseUrl=a.gisUrl),this.__ignoreBaseUrl=!!a.ignoreBaseUrl,this.__whiteLabel=!!a.whiteLabel,this.__logger=a.logger,this.__siteName=a.loginSiteName),!0)},isInitialized:function(){return this.__initialized},getToken:function(){return this.__token},getVersion:function(){return this.__version},getJsVersion:function(){return this.__jsVersion},getAjaxVersion:function(){return this.__ajaxVersion},getHiddenLogin:function(){return this.__hiddenLogin},getAuthUser:function(){return this.__authUser},isLocal:function(){return this.__isLocal},getHwGatewayIp:function(){return this.__hwGatewayIp},getEnv:function(e){return e?this.__env[e]:this.__env},getClasses:function(){return this.__classes},login:function(e,t,n,r){if(r=wialon.util.Helper.wrapCallback(r),!this.__currUser&&this.__initialized)return wialon.core.Remote.getInstance().remoteCall("core/login",{user:e,password:t,operateAs:n,loginHash:this.__loginHash,appName:this.__appDns,checkService:this.__checkLoginService},qx.lang.Function.bind(this.__onLoginResult,this,r));r(2)},loginAuthHash:function(e,t,n){var r="";if(t&&"function"==typeof t?n=t:t&&"string"==typeof t&&(r=t),n=wialon.util.Helper.wrapCallback(n),!this.__currUser&&this.__initialized){var i={authHash:e,operateAs:r,appName:this.__appDns,checkService:this.__checkLoginService};return this.__siteName&&(i.siteName=this.__siteName),wialon.core.Remote.getInstance().remoteCall("core/use_auth_hash",i,qx.lang.Function.bind(this.__onLoginResult,this,n))}n(2)},loginToken:function(e,t,n){var r="";if(t&&"function"==typeof t?n=t:t&&"string"==typeof t&&(r=t),n=wialon.util.Helper.wrapCallback(n),!this.__currUser&&this.__initialized){var i={token:e,operateAs:r,appName:this.__appDns,checkService:this.__checkLoginService};return this.__siteName&&(i.siteName=this.__siteName),wialon.core.Remote.getInstance().remoteCall("token/login",i,qx.lang.Function.bind(this.__onLoginResult,this,n))}n(2)},duplicate:function(e,t,n,r,i){var a=0;if(i&&(a=1),r=wialon.util.Helper.wrapCallback(r),!this.__currUser&&this.__initialized)return this.__sessionId=e,wialon.core.Remote.getInstance().remoteCall("core/duplicate",{operateAs:t,continueCurrentSession:n,checkService:this.__checkLoginService,restore:a,appName:this.__appDns},qx.lang.Function.bind(this.__onLoginResult,this,r));r(2)},logout:function(e){if(e=wialon.util.Helper.wrapCallback(e),this.__currUser)return wialon.core.Remote.getInstance().remoteCall("core/logout",null,qx.lang.Function.bind(function(t,n){t?e(t):(this.__cleanupSession(),e(0))},this));e(2)},createAuthHash:function(e){if(e=wialon.util.Helper.wrapCallback(e),this.__currUser)return wialon.core.Remote.getInstance().remoteCall("core/create_auth_hash",{},e);e(2)},updateSessionProperty:function(e,t){return wialon.core.Remote.getInstance().remoteCall("core/set_session_property",{prop_name:e.propName,prop_value:e.propValue},wialon.util.Helper.wrapCallback(t))},updateToken:function(e,t,n){return n=wialon.util.Helper.wrapCallback(n),wialon.core.Remote.getInstance().remoteCall("token/update",{callMode:e,h:t.h,app:t.app,at:t.at,dur:t.dur,fl:t.fl,p:t.p,items:t.items,deleteAll:t.deleteAll,userId:t.userId},n)},listTokens:function(e,t){return wialon.core.Remote.getInstance().remoteCall("token/list",{app:e.app,userId:e.userId},wialon.util.Helper.wrapCallback(t))},updateDataFlags:function(e,t){if(t=wialon.util.Helper.wrapCallback(t),this.__currUser&&"object"==typeof e)return wialon.core.Remote.getInstance().remoteCall("core/update_data_flags",{spec:e},qx.lang.Function.bind(this.__onDataFlagsUpdated,this,t));t(2)},searchItems:function(e,t,n,r,i,a,s){if(a=wialon.util.Helper.wrapCallback(a),this.__currUser&&"object"==typeof e)return wialon.core.Remote.getInstance().remoteCall("core/search_items",{spec:e,force:t?1:0,flags:n,from:r,to:i},qx.lang.Function.bind(this.__onSearchItemsResult,this,a),s);a(2,null)},searchItem:function(e,t,n){if(n=wialon.util.Helper.wrapCallback(n),this.__currUser)return wialon.core.Remote.getInstance().remoteCall("core/search_item",{id:e,flags:t},qx.lang.Function.bind(this.__onSearchItemResult,this,n));n(2,null)},loadLibrary:function(e){if(void 0!==this._libraries[e])return!0;if("userNotifications"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.User,"usnf","userNotification","user/update_user_notification");else if("itemCustomFields"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Item,"flds","customField","item/update_custom_field");else if("itemFtpProps"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Item,"ftp","FtpProp","item/update_ftp_property");else if("itemAdminFields"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Item,"aflds","adminField","item/update_admin_field");else if("itemProfileFields"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Item,"pflds","profileField","item/update_profile_field");else if("itemIcon"==e)qx.Class.include(wialon.item.Unit,wialon.item.MIcon),qx.Class.include(wialon.item.UnitGroup,wialon.item.MIcon);else if("unitCommandDefinitions"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Unit,"cml","commandDefinition","unit/update_command_definition");else if("unitSensors"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Unit,"sens","sensor","unit/update_sensor"),qx.Class.include(wialon.item.Unit,wialon.item.MUnitSensor);else if("unitServiceIntervals"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Unit,"si","serviceInterval","unit/update_service_interval");else if("unitTripDetector"==e)qx.Class.include(wialon.item.Unit,wialon.item.MUnitTripDetector);else if("unitMessagesFilter"==e)qx.Class.include(wialon.item.Unit,wialon.item.MUnitMessagesFilter);else if("unitEventRegistrar"==e)qx.Class.include(wialon.item.Unit,wialon.item.MUnitEventRegistrar);else if("unitReportSettings"==e)qx.Class.include(wialon.item.Unit,wialon.item.MUnitReportSettings);else if("unitDriveRankSettings"==e)qx.Class.include(wialon.item.Unit,wialon.item.MUnitDriveRankSettings);else if("unitFuelSettings"==e)qx.Class.include(wialon.item.Unit,wialon.item.MUnitFuelSettings);else if("resourceNotifications"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"unf","notification","resource/update_notification","resource/get_notification_data");else if("resourceJobs"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"ujb","job","resource/update_job","resource/get_job_data");else if("resourceZones"==e)qx.Class.include(wialon.item.Resource,wialon.item.MZone),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"zl","zone","resource/update_zone","resource/get_zone_data");else if("resourceZoneGroups"==e)qx.Class.include(wialon.item.Resource,wialon.item.MZone),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"zg","zonesGroup","resource/update_zones_group");else if("resourcePois"==e)qx.Class.include(wialon.item.Resource,wialon.item.MPoi),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"poi","poi","resource/update_poi","resource/get_poi_data");else if("resourceDrivers"==e)qx.Class.include(wialon.item.Resource,wialon.item.MDriver),wialon.item.MDriver.registerDriverProperties(),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"drvrs","driver","resource/update_driver");else if("resourceDriverGroups"==e)qx.Class.include(wialon.item.Resource,wialon.item.MDriver),wialon.item.MDriver.registerDriverProperties(),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"drvrsgr","driversGroup","resource/update_drivers_group");else if("resourceTrailers"==e)qx.Class.include(wialon.item.Resource,wialon.item.MDriver),wialon.item.MDriver.registerDriverProperties(),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"trlrs","trailer","resource/update_trailer");else if("resourceTrailerGroups"==e)qx.Class.include(wialon.item.Resource,wialon.item.MDriver),wialon.item.MDriver.registerDriverProperties(),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"trlrsgr","trailersGroup","resource/update_trailers_group");else if("resourceAccounts"==e)qx.Class.include(wialon.item.Resource,wialon.item.MAccount);else if("resourceReports"==e)qx.Class.include(wialon.item.Resource,wialon.item.MReport),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"rep","report","report/update_report","report/get_report_data");else if("routeRounds"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Route,"rr","round","route/update_round","route/get_round_data");else if("routeSchedules"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Route,"rs","schedule","route/update_schedule");else if("unitEvents"==e)qx.Class.include(wialon.item.Unit,wialon.item.MUnitEvents);else if("mobileApps"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.User,"mapps","mobileApp","user/update_mobile_app");else if("resourceOrders"==e)qx.Class.include(wialon.item.Resource,wialon.item.MOrder),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"orders","order","order/update"),qx.Class.include(wialon.item.Resource,wialon.item.MOrderRoute),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"order_routes","orderRoute","order/route_update");else{if("resourceTags"!=e)return!1;qx.Class.include(wialon.item.Resource,wialon.item.MTag),wialon.item.MTag.registerTagProperties(),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"tags","tag","resource/update_tag"),wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"tagsgr","tagsGroup","resource/update_tags_group")}return this._libraries[e]=1,!0},getHwTypes:function(e,t){var n={};if(e&&"function"==typeof e?t=e:e&&"object"==typeof e&&(n=e),this.__currUser)return wialon.core.Remote.getInstance().remoteCall("core/get_hw_types",{filterType:n.filterType,filterValue:n.filterValue,includeType:n.includeType},wialon.util.Helper.wrapCallback(t));t(2)},getHwCommands:function(e,t,n){if(n=wialon.util.Helper.wrapCallback(n),this.__currUser)return wialon.core.Remote.getInstance().remoteCall("core/get_hw_cmds",{deviceTypeId:e,unitId:t},n);n(2)},getHwCommandTemplates:function(e,t){var n={};if(e&&"object"==typeof e?(n=e,t=wialon.util.Helper.wrapCallback(t)):(n.deviceTypeId=arguments[0],n.unitId=arguments[1],n.lang="en",t=wialon.util.Helper.wrapCallback(arguments[2])),this.__currUser)return wialon.core.Remote.getInstance().remoteCall("core/get_hw_cmds",{deviceTypeId:n.deviceTypeId,unitId:n.unitId,template:1,lang:n.lang},t);t(2)},createUnit:function(e,t,n,r,i){if(i=wialon.util.Helper.wrapCallback(i),this.__currUser)return wialon.core.Remote.getInstance().remoteCall("core/create_unit",{creatorId:e.getId(),name:t,hwTypeId:n,dataFlags:r},qx.lang.Function.bind(this.__onSearchItemResult,this,i));i(2)},createUser:function(e,t,n,r,i){if(i=wialon.util.Helper.wrapCallback(i),this.__currUser)return wialon.core.Remote.getInstance().remoteCall("core/create_user",{creatorId:e.getId(),name:t,password:n,dataFlags:r},qx.lang.Function.bind(this.__onSearchItemResult,this,i));i(2)},createUnitGroup:function(e,t,n,r){if(r=wialon.util.Helper.wrapCallback(r),this.__currUser)return wialon.core.Remote.getInstance().remoteCall("core/create_unit_group",{creatorId:e.getId(),name:t,dataFlags:n},qx.lang.Function.bind(this.__onSearchItemResult,this,r));r(2)},createRetranslator:function(e,t,n,r,i){if(i=wialon.util.Helper.wrapCallback(i),this.__currUser)return wialon.core.Remote.getInstance().remoteCall("core/create_retranslator",{creatorId:e.getId(),name:t,config:n,dataFlags:r},qx.lang.Function.bind(this.__onSearchItemResult,this,i));i(2)},createRoute:function(e,t,n,r){if(r=wialon.util.Helper.wrapCallback(r),this.__currUser)return wialon.core.Remote.getInstance().remoteCall("core/create_route",{creatorId:e.getId(),name:t,dataFlags:n},qx.lang.Function.bind(this.__onSearchItemResult,this,r));r(2)},createResource:function(e,t,n,r,i){if(i=wialon.util.Helper.wrapCallback(i),this.__currUser)return"function"==typeof r&&(i=r,r=0),wialon.core.Remote.getInstance().remoteCall("core/create_resource",{creatorId:e.getId(),name:t,skipCreatorCheck:r,dataFlags:n},qx.lang.Function.bind(this.__onSearchItemResult,this,i));i(2)},deleteItem:function(e,t){return t=wialon.util.Helper.wrapCallback(t),wialon.core.Remote.getInstance().remoteCall("item/delete_item",{itemId:e.getId()},qx.lang.Function.bind(this.__onDeleteItem,this,t,e.getId()))},updateItem:function(e,t){if(e&&t)for(var n in"ud"===t.tp&&t.pos&&(void 0===t.pos.t&&(t.pos.t=t.t),void 0===t.pos.f&&(t.pos.f=t.f),void 0===t.pos.lc&&(t.pos.lc=t.lc)),t){var r=this.__itemFuncs[n];"function"==typeof r&&r(e,t[n])}},getIconsLibrary:function(e,t,n){var r=0;void 0!==n?r=t:n=t,wialon.core.Remote.getInstance().remoteCall("file/library",{type:e,flags:r},wialon.util.Helper.wrapCallback(n))},getFirmwareLibrary:function(e,t){wialon.core.Remote.getInstance().remoteCall("file/list",{itemId:0,storageType:1,path:"firmware",mask:e,recursive:!0,fullPath:!0},wialon.util.Helper.wrapCallback(t))},getLibraryFile:function(e){var t={itemId:0,storageType:1,path:e};return wialon.core.Session.getInstance().getBaseUrl()+this.__apiPath+"?sid="+wialon.core.Session.getInstance().getId()+"&svc=file/get&params="+wialon.util.Json.stringify(t)},readLibraryFile:function(e,t){wialon.core.Remote.getInstance().remoteCall("file/read",{itemId:0,storageType:1,path:e},wialon.util.Helper.wrapCallback(t))},resetPasswordRequest:function(e,t,n,r,i){if(i=wialon.util.Helper.wrapCallback(i),this.__initialized){for(var a=document.cookie.split("; "),s="en",o=0;o<a.length;o++){var l=a[o].split("=");if(2==l.length&&"lang"==l[0]){s=l[1];break}}return wialon.core.Remote.getInstance().remoteCall("core/reset_password_request",{user:e,email:t,emailFrom:n,url:r,lang:s},i)}i(2)},resetPasswordPerform:function(e,t,n){if(n=wialon.util.Helper.wrapCallback(n),this.__initialized)return wialon.core.Remote.getInstance().remoteCall("core/reset_password_perform",{user:e,code:t},n);n(2)},sendSms:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("user/send_sms",{phoneNumber:e,smsText:t},wialon.util.Helper.wrapCallback(n))},getAccountData:function(e,t){return wialon.core.Remote.getInstance().remoteCall("core/get_account_data",{type:e?2:1},wialon.util.Helper.wrapCallback(t))},getAccountsData:function(e,t,n){return"function"==typeof t&&(n=t,t=2),wialon.core.Remote.getInstance().remoteCall("account/get_account_data",{itemId:e,type:t},wialon.util.Helper.wrapCallback(n))},checkItemsBilling:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("core/check_items_billing",{items:e,serviceName:t,accessFlags:n},wialon.util.Helper.wrapCallback(r))},checkAccessors:function(e,t){return wialon.core.Remote.getInstance().remoteCall("core/check_accessors",e,wialon.util.Helper.wrapCallback(t))},listChangeAccount:function(e,t){return wialon.core.Remote.getInstance().remoteCall("account/list_change_accounts",{dataFlags:e.dataFlags,units:e.units},wialon.util.Helper.wrapCallback(t))},getReportTables:function(e){return wialon.core.Remote.getInstance().remoteCall("report/get_report_tables",{},wialon.util.Helper.wrapCallback(e))},setLoginHash:function(e){this.__loginHash=e},getExportListUrl:function(e){var t=qx.lang.Object.clone(e);return wialon.core.Session.getInstance().getBaseUrl()+this.__apiPath+"?sid="+wialon.core.Session.getInstance().getId()+"&svc=core/export_file&params="+encodeURIComponent(wialon.util.Json.stringify(t))},getCurrUser:function(){return this.__currUser},getServerTime:function(){return this.__serverTime},getItem:function(e){if(!this.__itemsById)return null;var t=this.__itemsById[parseInt(e)];return void 0!==t?t:null},getItems:function(e){if(!this.__itemsById||!this.__itemsByType)return null;if(void 0===e||""==e){var t=new Array;for(var n in this.__itemsById)t.push(this.__itemsById[n]);return t}var r=this.__itemsByType[e];return void 0!==r?r:new Array},registerConstructor:function(e,t){void 0===this.__itemConstr[e]&&(this.__itemConstr[e]=t)},registerProperty:function(e,t){void 0===this.__itemFuncs[e]&&(this.__itemFuncs[e]=t)},getBaseUrl:function(){return this.__baseUrl},setBaseUrl:function(e){this.__baseUrl=e,this.__gisBaseUrl=e,wialon.core.Remote.getInstance().setRequestsBaseUrl()},getEvtPollInterval:function(){return this.__evtPollInterval},setEvtPollInterval:function(e){if(this.__evtPollInterval!==e&&(this.__evtPollInterval=e,this.__evtPollTimeoutId)){clearTimeout(this.__evtPollTimeoutId);var t=Date.now()-this.__evtPollLastTime;if(t>=1e3*e)this.__PollEvents();else{var n=1e3*e-t;n<0&&(n=0),this.__evtPollTimeoutId=qx.lang.Function.delay(this.__PollEvents,n,this)}}},getBaseGisUrl:function(e){if(!this.__internalGis&&""!=this.__gisBaseUrl){var t=this.__gisBaseUrl.split("//");if(t.length>=2){if("render"==e)return t[0]+"//render-maps.wialon.com/"+t[1];if("search"==e)return t[0]+"//search-maps.wialon.com/"+t[1];if("geocode"==e)return t[0]+"//geocode-maps.wialon.com/"+t[1];if("routing"==e)return t[0]+"//routing-maps.wialon.com/"+t[1]}}return this.__gisBaseUrl},getId:function(){return this.__sessionId},getRenderer:function(){return this.__renderer},getMessagesLoader:function(){return this.__messagesLoader},getFeatures:function(){return this.__features},checkFeature:function(e){if(!this.__features||void 0===this.__features.svcs)return 0;if(void 0===this.__features.svcs[e])return 1==this.__features.unlim?1:0;var t=this.__features.svcs[e];return 1==t?1:0==t?-1:0},__PollEvents:function(){this.__evtPollTimeoutId=null,this.__evtPollLastTime=Date.now(),this.__sessionId&&this.__evtPollInterval&&void 0!==wialon&&wialon.core.Remote.getInstance().ajaxRequest("/avl_evts",{sid:this.__sessionId},qx.lang.Function.bind(this.__eventsResponse,this,this.__sessionId),60)},__eventsResponse:function(e,t,n){if(0==t){this.__serverTime=n.tm;for(var r=0;r<n.events.length;r++){var i=n.events[r];if(i.i>0){if((d=this.getItem(i.i))&&void 0!==d)"u"==i.t?this.updateItem(d,i.d):"m"==i.t?d.handleMessage(i.d):"d"==i.t&&this._onItemDeleted(d);else if(i&&"number"==typeof i.i&&"u"===i.t){var a=this.__skippedUpdates[i.i];a||(a=[],this.__skippedUpdates[i.i]=a),a.push(i)}}else if(-1==i.i)this.fireDataEvent("fileUploaded",i.d,null);else if(-2==i.i)this.__cleanupSession(e)&&this.fireEvent("invalidSession");else if(-3==i.i)this.__features=i.d,this.fireEvent("featuresUpdated");else if(-4==i.i)this.fireDataEvent("statsFinished",i.d,null);else if(-5==i.i){var s=i.d;if(void 0!==s.r&&s.r.length)for(var o=0;o<s.r.length;o++)(d=this.getItem(s.r[o]))&&this._onItemDeleted(d);if(void 0!==s.a&&s.a.length){var l=[];for(o=0;o<s.a.length;o++)for(var c=s.a[o].ids,u=0;u<c.length;u++){var d,p=c[u];(d=this.getItem(p))||l.push(p)}l.length&&this.checkNewItems({ids:l})}}}this.__evtPollInterval&&(this.__evtPollTimeoutId||(this.__evtPollTimeoutId=qx.lang.Function.delay(this.__PollEvents,1e3*this.__evtPollInterval,this))),this.fireEvent("serverUpdated")}else 1==t?this.__cleanupSession(e)&&this.fireEvent("invalidSession"):this.__evtPollInterval&&(this.__evtPollTimeoutId||(this.__evtPollTimeoutId=qx.lang.Function.delay(this.__PollEvents,1e3*this.__evtPollInterval,this)))},__checkingNewItems:{},checkNewItems:function(e,t){var n=e.ids,r=e.updateDataFlagsSpec;if(wialon.core.Session.getInstance(),n=n.filter(qx.lang.Function.bind(function(e){return!this.__checkingNewItems[e]&&!this.getItem(e)&&(this.__checkingNewItems[e]=!0,!0)},this)),!r){if(!n.length)return void("function"==typeof t&&t(null));r=[{type:"col",data:n,flags:wialon.item.Item.dataFlag.base,mode:1}]}this.updateDataFlags(r,qx.lang.Function.bind(function(e){if(n.forEach(qx.lang.Function.bind(function(e){delete this.__checkingNewItems[e]},this)),e)"function"==typeof t&&t(e);else{var r=[];n.forEach(qx.lang.Function.bind(function(e){var t=this.getItem(e);t&&r.push(t)},this)),this.fireDataEvent("itemCreated",r,null),"function"==typeof t&&t(null)}},this))},parseSessionData:function(e){if(!e||this.__currUser)return!1;for(var t in this.__sessionId=e.eid,this.__evtPollInterval=2,this.__serverTime=e.tm,this.__authUser=e.au,this.__isLocal=e.api&&e.api.indexOf("local")>=0?1:0,e.wsdk_version&&(this.__ajaxVersion=e.wsdk_version),e.hl&&(this.__hiddenLogin=e.hl),this.__classes={},e.classes)this.__classes[e.classes[t]]=t;if(this.__itemsById={},this.__itemsByType={},this.__currUser=this.__constructItem(e.user,wialon.item.User.defaultDataFlags()),this.__registerItem(this.__currUser),e.token)try{this.__token=wialon.util.Json.parse(e.token),e.th&&(this.__token.th=e.th),this.__token.p&&(this.__token.p=wialon.util.Json.parse(this.__token.p))}catch(e){console.log("Can't parse avl_evts json, possible wrong chars in responce. Data is ignored.")}return void 0!==e.features&&(this.__features=e.features),void 0!==e.base_url&&""!=e.base_url&&e.base_url!=this.getBaseUrl()&&(this.__gisBaseUrl=e.base_url,this.__ignoreBaseUrl||this.setBaseUrl(e.base_url)),void 0!==e.hw_gw_ip&&e.hw_gw_ip&&(this.__hwGatewayIp=e.hw_gw_ip),void 0!==e.env&&e.env&&(this.__env=e.env),this.__evtPollInterval&&(this.__evtPollTimeoutId||(this.__evtPollTimeoutId=qx.lang.Function.delay(this.__PollEvents,1e3*this.__evtPollInterval,this))),!0},getApiPath:function(){return this.__apiPath},isWhiteLabel:function(){return this.__whiteLabel},getLogger:function(){return this.__logger},__cleanupSession:function(e){return!(e&&e!=this.__sessionId||(this.__initialized=0,this.__sessionId="",this.__currUser=null,this.__serverTime,this.__itemsById=null,this.__itemsByType=null,this.__evtPollInterval=0,this.__renderer=null,this.__messagesLoader=null,this.__baseUrl="",this.__internalGis=!1,this.__itemFuncs={},this.__itemConstr={},this.__authUser="",this._libraries={},this._disposeMap("__itemsById"),this._disposeObjects("__currUser"),this.__classes=null,this.__features=null,this.__isLocal=0,this.__hwGatewayIp="",this.__env={},0))},__constructItem:function(e,t){if(!e||!t)return null;if(e.tp=this.__classes[e.cls],void 0===e.tp)return null;var n,r=this.__itemConstr[e.tp];if(void 0===r)return null;n=new r(e,t),this.updateItem(n,e);var i=n&&this.__skippedUpdates[n.getId()];return i&&(delete this.__skippedUpdates[n.getId()],i.forEach(qx.lang.Function.bind(function(e){this.updateItem(n,e.d)},this))),n},__registerItem:function(e){if(e&&this.__itemsById){this.__itemsById[e.getId()]=e;var t=this.__itemsByType[e.getType()];void 0===t&&(this.__itemsByType[e.getType()]=new Array,t=this.__itemsByType[e.getType()]),t.push(e)}},__removeItem:function(e){if(e){void 0!==this.__itemsById[e.getId()]&&delete this.__itemsById[e.getId()];var t=this.__itemsByType[e.getType()];void 0!==t&&qx.lang.Array.remove(t,e),e.dispose()}},_onItemDeleted:function(e){e&&(e.fireEvent("itemDeleted"),this.__removeItem(e))},__onLoginResult:function(e,t,n){!t&&n?this.parseSessionData(n)?e(0):e(6):e(t)},__onDataFlagsUpdated:function(e,t,n){if(!t&&n){for(var r=0;r<n.length;r++){var i,a=n[r].f,s=n[r].i,o=n[r].d;if(void 0===(i=this.__itemsById[s])&&0!=a&&o)(i=this.__constructItem(o,a))&&this.__registerItem(i);else if(0==a)this.__removeItem(i);else{if(void 0===i)return;o&&this.updateItem(i,o),i.setDataFlags(a)}o=null}e(0)}else e(t)},__onSearchItemsResult:function(e,t,n){if(!t&&n){for(var r={searchSpec:n.searchSpec,dataFlags:n.dataFlags,totalItemsCount:n.totalItemsCount,indexFrom:n.indexFrom,indexTo:n.indexTo,items:[]},i=0;i<n.items.length;i++){var a=this.__constructItem(n.items[i],n.dataFlags);a&&r.items.push(a),qx.core.ObjectRegistry.unregister(a)}return e(0,r),r}e(t,null)},__onSearchItemResult:function(e,t,n){if(!t&&n){var r=this.__constructItem(n.item,n.flags);return qx.core.ObjectRegistry.unregister(r),e(null===r?6:0,r),r}e(t,n)},__onDeleteItem:function(e,t,n){if(!n){var r=this.getItem(t);r&&(r.fireEvent("itemDeleted"),this.__removeItem(r))}e(n)}},destruct:function(){this.__cleanupSession(),this._disposeObjects("__currUser","__renderer","__messagesLoader")},events:{serverUpdated:"qx.event.type.Event",invalidSession:"qx.event.type.Event",fileUploaded:"qx.event.type.Data",featuresUpdated:"qx.event.type.Event"},statics:{exportDataFlag:{userName:1,userCreatorName:2,userAccount:4,userBillingPlan:8,userLastVisit:16,unitName:1,unitCreatorName:2,unitAccount:4,unitDeviceType:8,unitUid:16,unitPhone:32,unitLastMsg:64,unitCreated:128,unitCustomFields:256,unitGroups:512,unitDeactivation:1024,unitGroupName:1,unitGroupCreatorName:2,unitGroupAccount:4,unitGroupUnitsCount:8,accountName:1,accountCreatorName:2,accountParentAccount:4,accountBillingPlan:8,accountDealer:16,accountUnits:32,accountBalance:64,accountDays:128,accountStatus:256,accountBlocked:512,retranslatorName:1,retranslatorCreatorName:2,retranslatorAccount:4,retranslatorProtocol:8,retranslatorServer:16,retranslatorState:32,retranslatorUnitNames:64,retranslatorUnitIds:128},destroyInstance:function(){this.$$instance&&(this.$$instance.dispose(),delete this.$$instance)}}}),qx.Class.define("wialon.item.Item",{extend:qx.core.Object,construct:function(e,t){this.base(arguments),this.setDataFlags(t),this._id=e.id,this._type=e.tp},properties:{dataFlags:{init:null,check:"Integer",event:"changeDataFlags"},name:{init:null,check:"String",event:"changeName"},measureUnits:{init:0,check:"Integer",event:"changeMeasureUnits"},userAccess:{init:null,check:"Integer",event:"changeUserAccess"},customProps:{init:null,check:"Object"},creatorId:{init:null,check:"Integer"},accountId:{init:null,check:"Integer"},creationTime:{init:null,check:"Integer"},ftpProps:{init:null,check:"Object"}},members:{_id:0,_type:"",getId:function(){return this._id},getType:function(){return this._type},getCustomProperty:function(e,t){var n=this.getCustomProps();if(n){var r=n[e];if(void 0!==r)return r}return void 0!==t?t:""},setCustomProperty:function(e,t){var n=this.getCustomProps();if(n){var r=n[e];void 0===r&&(r=""),""!=t?n[e]=t:""!=r&&delete n[e],t!=r&&this.fireDataEvent("changeCustomProperty",{n:e,v:t},{n:e,v:r})}},getFtpProperty:function(e,t){var n=this.getFtpProps();if(n){var r=n[e];if(void 0!==r)return r}return void 0!==t?t:""},setFtpProperty:function(e,t){var n=this.getFtpProps();if(n){var r=n[e];void 0===r&&(r=""),""!=t?n[e]=t:""!=r&&delete n[e],t!=r&&this.fireDataEvent("changeFtpProperty",{n:e,v:t},{n:e,v:r})}},handleMessage:function(e){this.fireDataEvent("messageRegistered",e,null)},updateCustomProperty:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("item/update_custom_property",{itemId:this.getId(),name:e,value:"string"==typeof t||"number"==typeof t?t:""},qx.lang.Function.bind(this.__onUpdateCustomProperty,this,wialon.util.Helper.wrapCallback(n)))},updateFtpProperty:function(e,t){return void 0===e.ps?wialon.core.Remote.getInstance().remoteCall("item/update_ftp_property",{itemId:this.getId(),host:e.hs,login:e.lg,path:e.pt,check:e.ch,hostingFtp:e.tp},qx.lang.Function.bind(this.__onUpdateFtpProperty,this,wialon.util.Helper.wrapCallback(t))):wialon.core.Remote.getInstance().remoteCall("item/update_ftp_property",{itemId:this.getId(),host:e.hs,login:e.lg,pass:e.ps,path:e.pt,check:e.ch,hostingFtp:e.tp},qx.lang.Function.bind(this.__onUpdateFtpProperty,this,wialon.util.Helper.wrapCallback(t)))},updateMeasureUnits:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("item/update_measure_units",{itemId:this.getId(),type:e,flags:t},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(n)))},updateName:function(e,t){return wialon.core.Remote.getInstance().remoteCall("item/update_name",{itemId:this.getId(),name:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},addLogRecord:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("item/add_log_record",{itemId:this.getId(),action:e,newValue:t||"",oldValue:n||""},wialon.util.Helper.wrapCallback(r))},fileGet:function(e,t){var n={itemId:this.getId(),storageType:e,path:t},r=wialon.core.Session.getInstance();return r.getBaseUrl()+r.getApiPath()+"?sid="+wialon.core.Session.getInstance().getId()+"&svc=file/get&params="+encodeURIComponent(wialon.util.Json.stringify(n))},fileList:function(e,t,n,r,i,a){wialon.core.Remote.getInstance().remoteCall("file/list",{itemId:this.getId(),storageType:e,path:t,mask:n,recursive:r,fullPath:i},wialon.util.Helper.wrapCallback(a))},fileRm:function(e,t,n){wialon.core.Remote.getInstance().remoteCall("file/rm",{itemId:this.getId(),storageType:e,path:t},wialon.util.Helper.wrapCallback(n))},fileMkdir:function(e,t,n){wialon.core.Remote.getInstance().remoteCall("file/mkdir",{itemId:this.getId(),storageType:e,path:t},wialon.util.Helper.wrapCallback(n))},filePut:function(e,t,n,r,i,a){var s={};s.itemId=this.getId(),s.storageType=e,s.path=t,s.writeType=r,wialon.core.Uploader.getInstance().uploadFiles([n],"file/put",s,a,!0,i)},fileRead:function(e,t,n,r){wialon.core.Remote.getInstance().remoteCall("file/read",{itemId:this.getId(),storageType:e,contentType:n,path:t},wialon.util.Helper.wrapCallback(r))},fileWrite:function(e,t,n,r,i,a){wialon.core.Remote.getInstance().remoteCall("file/write",{itemId:this.getId(),storageType:e,path:t,writeType:r,contentType:i,content:n},wialon.util.Helper.wrapCallback(a))},listBackups:function(e){wialon.core.Remote.getInstance().remoteCall("item/list_backups",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},getBackup:function(e,t){wialon.core.Remote.getInstance().remoteCall("item/get_backup",{itemId:this.getId(),fileId:e},wialon.util.Helper.wrapCallback(t))},restoreIcons:function(e,t){var n={};e&&"object"==typeof e?(n=e).resId=this.getId():(n.unitIcons={},n.unitIcons[this.getId()]=e),wialon.core.Remote.getInstance().remoteCall("item/restore_icons",n,wialon.util.Helper.wrapCallback(t))},__onUpdateCustomProperty:function(e,t,n){0==t&&n&&this.setCustomProperty(n.n,n.v),e(t)},__onUpdateFtpProperty:function(e,t,n){0==t&&n&&this.setFtpProps(n),e(t)},_onUpdateProperties:function(e,t,n){0==t&&n&&wialon.core.Session.getInstance().updateItem(this,n),e(t)}},statics:{dataFlag:{base:1,customProps:2,billingProps:4,customFields:8,image:16,messages:32,guid:64,adminFields:128,profileFields:8388608},accessFlag:{view:1,viewProperties:2,setAcl:4,deleteItem:8,editName:16,viewCFields:32,editCFields:64,editOther:128,editImage:256,execReports:512,editSubItems:1024,manageLog:2048,viewAFields:4096,editAFields:8192,viewFile:16384,editFile:32768},messageFlag:{typeMask:65280,typeUnitData:0,typeUnitSMS:256,typeUnitCmd:512,typeUnitEvent:1536,typeUserLog:1024,typeNotification:768,typeBalance:1280,typeAgroCultivation:1792,typeDriverSMS:2304,typeLogRecord:4096,typeOrder:2816,typeOther:65280},measureUnitsType:{si:0,us:1,im:2,lat:3},measureUnitsFlag:{setMeasureUnits:0,convertMeasureUnits:1},logMessageAction:{itemCustomMessage:"custom_msg",itemUpdatedName:"update_name",itemUpdatedUserAccess:"update_access",itemDeleted:"delete_item"},fileStorageType:{publicType:1,protectedType:2},fileWriteType:{overwrite:0,append:1,skip:2},fileContentType:{plainText:0,hexString:1,base64:2},registerProperties:function(){var e=wialon.core.Session.getInstance();e.registerProperty("nm",this.remoteUpdateName),e.registerProperty("mu",this.remoteUpdateMeasureUnits),e.registerProperty("uacl",this.remoteUpdateUserAccess),e.registerProperty("prp",this.remoteUpdateCustomProps),e.registerProperty("prpu",this.remoteUpdateCustomProp),e.registerProperty("crt",this.remoteUpdateCreatorId),e.registerProperty("bact",this.remoteUpdateAccountId),e.registerProperty("ct",this.remoteUpdateCreationTime)},remoteUpdateName:function(e,t){e.setName(t)},remoteUpdateMeasureUnits:function(e,t){e.setMeasureUnits(t)},remoteUpdateUserAccess:function(e,t){e.setUserAccess(t)},remoteUpdateCustomProps:function(e,t){e.setCustomProps(t)},remoteUpdateCustomProp:function(e,t){for(var n in t)e.setCustomProperty(n,t[n])},remoteUpdateCreatorId:function(e,t){e.setCreatorId(t)},remoteUpdateAccountId:function(e,t){e.setAccountId(t)},remoteUpdateCreationTime:function(e,t){e.setCreationTime(t)}},events:{changeName:"qx.event.type.Data",changeDataFlags:"qx.event.type.Data",changeUserAccess:"qx.event.type.Data",changeCustomProperty:"qx.event.type.Data",itemDeleted:"qx.event.type.Event",messageRegistered:"qx.event.type.Data",changeFtpProperty:"qx.event.type.Data"}}),qx.Class.define("wialon.core.Remote",{extend:qx.core.Object,type:"singleton",construct:function(){this.base(arguments),this.setRequestsBaseUrl()},members:{__batchCalls:null,__finishBatchCalls:[],__batchCallsOwner:"",__defaultTimeout:30,setRequestsBaseUrl:function(){var e,t=wialon.core.Session.getInstance(),n=t.isWhiteLabel()?"":"/wialon";e=void 0===window||window&&window.__IS_NODEJS?wialon.core.NodeHttp:wialon.core.PostMessage,this._req={},this._req.sdk=new e(this.createFullUrl(t.getBaseUrl())+n+"/post.html",0),""!=t.getBaseGisUrl("search")?this._req.search=new e(this.createFullUrl(t.getBaseGisUrl("search"))+"/gis_post?1",1):this._req.search=new e(this.createFullUrl()+"/wialon/post.html?1",1),""!=t.getBaseGisUrl("geocode")?this._req.geocode=new e(this.createFullUrl(t.getBaseGisUrl("geocode"))+"/gis_post?2",1):this._req.geocode=new e(this.createFullUrl()+"/wialon/post.html?2",1),""!=t.getBaseGisUrl("routing")?this._req.routing=new e(this.createFullUrl(t.getBaseGisUrl("routing"))+"/gis_post?3",1):this._req.routing=new e(this.createFullUrl()+"/wialon/post.html?3",1)},remoteCall:function(e,t,n,r){if(n=wialon.util.Helper.wrapCallback(n),void 0===r&&(r=this.__defaultTimeout),!this.__batchCalls){var i=wialon.core.Session.getInstance(),a=i.getApiPath()+"?svc="+e+"&sid="+i.getId(),s={params:{}};return t&&(s={params:t}),this.ajaxRequest(a,s,n,r,e)}this.__batchCalls.push({svc:e,params:t||{},callback:n,timeout:r})},replaceSender:function(e,t){this._req[e]=t},startBatch:function(e){return this.__batchCalls?0:(e&&(this.__batchCallsOwner=e),this.__batchCalls=new Array,1)},finishBatch:function(e,t,n){if(e=wialon.util.Helper.wrapCallback(e),this.__batchCalls){if(this.__finishBatchCalls.push(e),!this.__batchCallsOwner||t==this.__batchCallsOwner){if(e=wialon.util.Helper.wrapCallback(this.__finishBatchCalls),!this.__batchCalls.length)return this.__batchCallsOwner="",this.__finishBatchCalls=[],this.__batchCalls=null,void e(0,0);n||(n=0);for(var r=0,i=[],a=[],s=0;s<this.__batchCalls.length;s++){var o=this.__batchCalls[s];i.push({svc:o.svc,params:o.params}),a.push(o.callback),o.timeout>r&&(r=o.timeout)}this.__batchCalls=null,this.__batchCallsOwner="",this.__finishBatchCalls=[],this.remoteCall("core/batch",{params:i,flags:n},qx.lang.Function.bind(this.__onBatchCallCompleted,this,e,a),r)}}else e(2,2)},ajaxRequest:function(e,t,n,r,i){var a="sdk";if(e.match("/gis_geocode")?a="geocode":e.match("/gis_search")&&(a="search"),!this._req[a].supportAsync()){t.svc=i;var s=wialon.util.Json.stringify(t);return t=null,this.__onAjaxRequestCompleted(n,wialon.util.Json.parse(this._req[a].send(s)))}this._req[a].send(e,t,qx.lang.Function.bind(this.__onAjaxRequestCompleted,this,n),qx.lang.Function.bind(this.__onAjaxRequestFailed,this,n),r,{})},jsonRequest:function(e,t,n,r,i){var a=new qx.io.request.Jsonp(e),s=null;a.setCache(!1),i&&a.setCallbackName(i),a.setTimeout(1e3*r),t&&("object"==typeof t?a.setRequestData(t):a.setRequestData({params:t})),n&&(a.addListener("success",qx.lang.Function.bind(this.__onJsonRequestCompleted,this,n,a)),s=qx.lang.Function.bind(this.__onAjaxRequestFailed,this,n,a),a.addListener("error",s),a.addListener("abort",s),a.addListener("timeout",s),a.addListener("statusError",s)),a.send(),a=null,s=null},setBaseUrl:function(e){this.__baseUrl=e},setTimeout:function(e){this.__defaultTimeout=e},getTimeout:function(){return this.__defaultTimeout},createFullUrl:function(e){return void 0===document?e:e||document.location.protocol+"//"+document.location.hostname+(document.location.port.length?":"+document.location.port:"")},__onAjaxRequestCompleted:function(e,t){return this.__handleCallResult(t,e)},__onAjaxRequestFailed:function(e,t){e(5,null)},__onJsonRequestCompleted:function(e,t){this.__handleCallResult(t.getResponse(),e)},__onBatchCallCompleted:function(e,t,n,r){if(0!=n||r&&t&&t.length==r.length||(n=3),!n){var i=0,a=[],s=0,o=[];for(l=0;l<r.length;l++)o.push(this.__handleCallResult(r[l],t[l])),r[l]&&(i=r[l]),a.push(r[l]),void 0!==r[l].error&&s++;return e(n,i,s,a),o}for(var l=0;l<t.length;l++)t[l]&&t[l](n);e(n,n)},__handleCallResult:function(e,t){return e&&void 0!==e.error&&0!=e.error?t(e.error,e):e?t(0,e):t(3,null)}},destruct:function(){if(this._req)for(var e in this._req)if(this._req.hasOwnProperty(e)){var t=this._req[e];t&&"function"==typeof t.dispose&&t.dispose()}},statics:{BatchFlag:{breakFailure:1},destroyInstance:function(){this.$$instance&&(this.$$instance.dispose(),delete this.$$instance)}}}),qx.Class.define("wialon.core.NodeHttp",{extend:qx.core.Object,construct:function(e){this.base(arguments);var t=wialon.core.Session.getInstance().getBaseUrl().split("://");"https"==t[0]?(this._port=443,this._http=require("https")):(this._port=80,this._http=require("http")),(t=t[t.length-1].split(":")).length>1&&(this._port=t[1]),this._hostname=t[0],this._callbacks={}},members:{send:function(e,t,n,r,i){var a=Buffer.from(this.__urlEncodeData(t)),s={method:"POST",host:this._hostname,port:this._port,path:e,headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":a.length}},o={counter:++this._counter,options:s,body:a};this._callbacks[this._counter]=[n,r,o,0,i,null,""],this.__postMessage(this._counter)},supportAsync:function(){return!0},_http:null,_hostname:"",_port:80,_id:0,_callbacks:{},_timeout:0,_counter:0,__urlEncodeData:function(e){var t=[],n=!1,r=wialon.core.Session.getInstance().getId(),i=r?"sid="+r:"";if("object"==typeof e){for(var a in e)"object"==typeof e[a]?t.push(a+"="+encodeURIComponent(wialon.util.Json.stringify(e[a]))):t.push(a+"="+encodeURIComponent(e[a])),"sid"==a&&(n=!0);return t.join("&")+(n?"":i)}return n?"":i},__timeout:function(e){var t=this._callbacks[e];t&&(t[1]&&t[1](),delete this._callbacks[e])},__postMessage:function(e){var t=this._callbacks[e];t[4]&&t.push(setTimeout(qx.lang.Function.bind(this.__timeout,this,e),1e3*t[4]));var n=qx.lang.Function.bind(this.__recieveMessage,this,e,0,""),r=qx.lang.Function.bind(function(e,t){t.setEncoding("utf8"),t.on("data",qx.lang.Function.bind(this.__recieveMessagePart,this,e)),t.on("end",qx.lang.Function.bind(this.__recieveMessage,this,e))},this,e),i=this._http.request(t[2].options,r).on("error",n);i.write(t[2].body),i.end()},__recieveMessagePart:function(e,t){var n=this._callbacks[e];n&&t&&(n[6]+=t)},__recieveMessage:function(e){var t=this._callbacks[e];if(t){var n=wialon.util.Json.parse(t[6]);if(n){if(n.error&&1003==n.error&&t[3]<3)return t[3]++,t[6]="",t[4]&&t[5]&&(clearTimeout(t[5]),t[5]=setTimeout(qx.lang.Function.bind(this.__timeout,this,e),1e3*t[4])),void setTimeout(qx.lang.Function.bind(function(t){this.__postMessage(e)},this,e),1e3*Math.random());t[0]&&t[0](n),t[4]&&t[5]&&clearTimeout(t[5]),delete this._callbacks[e]}else t[1]()}}}}),qx.Class.define("wialon.util.Json",{type:"static",statics:{stringify:function(e){var t=null;return(t=isNaN(e)?this.__types[typeof e]:e instanceof Array?this.__types.array:this.__types.number)?t.apply(this,[e]):""},parse:function(json,safe){try{return JSON.parse(json)}catch(e){}if(void 0===safe&&(safe=!1),!safe||/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json)){if(!json||""==json)return{};var res=null;try{res=qx.lang.Json.parse(json)}catch(e1){try{res=eval("("+json+")")}catch(e){try{res=eval('"'+json+'"')}catch(e){return null}}}return res}},compareObjects:function(e,t){return!(null==e&&null!=t||null==t&&null!=e)&&this.stringify(e)==this.stringify(t)},__types:{array:function(e){var t,n,r,i,a=["["],s=e.length;for(r=0;r<s;r+=1)i=e[r],(n=this.__types[typeof i])&&"string"==typeof(i=n.apply(this,[i]))&&(t&&(a[a.length]=","),a[a.length]=i,t=!0);return a[a.length]="]",a.join("")},boolean:function(e){return String(e)},null:function(e){return"null"},number:function(e){return isFinite(e)?String(e):"null"},object:function(e){if(e){if(e instanceof Array)return this.__types.array.apply(this,[e]);var t,n,r,i,a=["{"];for(r in e)i=e[r],(n=this.__types[typeof i])&&"string"==typeof(i=n.apply(this,[i]))&&(t&&(a[a.length]=","),a.push(this.__types.string.apply(this,[r]),":",i),t=!0);return a[a.length]="}",a.join("")}return"null"},string:function(e){return/["\\\x00-\x1f]/.test(e)&&(e=e.replace(/([\x00-\x1f\\"])/g,function(e,t){var n={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}[t];return n||(n=t.charCodeAt(),"\\u00"+Math.floor(n/16).toString(16)+(n%16).toString(16))})),'"'+e+'"'}}}}),qx.Class.define("wialon.core.PostMessage",{extend:qx.core.Object,construct:function(e){this.base(arguments),this._url=e,this._id=this._url,this._io=null,this._callbacks={},this._chunkedPrefix="posthtml"+ ++wialon.core.PostMessage._postMessagePrefixCounter+":"},members:{send:function(e,t,n,r,i){this._io||(this._io=document.createElement("iframe"),this._io.style.display="none",window.attachEvent?this._io.attachEvent("onload",qx.lang.Function.bind(this.__frameLoaded,this)):this._io.addEventListener("load",qx.lang.Function.bind(this.__frameLoaded,this),!1),this._io.setAttribute("src",this._url),document.body.appendChild(this._io),this._messageEventHandler=qx.lang.Function.bind(this.__recieveMessage,this),window.addEventListener?window.addEventListener("message",this._messageEventHandler,!1):window.attachEvent("onmessage",this._messageEventHandler));var a={id:++this._counter,url:e,params:this.__urlEncodeData(t),source:this._id},s=this._io.contentWindow;if(s){var o=wialon.util.Json.stringify(a);this._callbacks[this._counter]=[n,r,o,0,i],i&&this._callbacks[this._counter].push(setTimeout(qx.lang.Function.bind(this.__timeout,this,this._counter),1e3*i)),this._frameReady?s.postMessage(o,this._url):this._requests.push(o)}else r()},supportAsync:function(){return!0},_url:"",_io:null,_id:0,_callbacks:{},_requests:[],_frameReady:!1,_timeout:0,_counter:0,_chunkedPrefix:null,_chunkedResultEnabled:!1,_chunksAwaiting:{},__recieveMessage:function(e){var t=e.data;if(this._chunkedResultEnabled){var n=this.__parseChunk(t);if(!n)return;if(1===n.chunksCount)t=n.data;else{var r=this._chunksAwaiting[n.id];if(!r){r={chunksLeft:n.chunksCount,chunks:[]};for(var i=0;i<n.chunksCount;i++)r.chunks.push(null);this._chunksAwaiting[n.id]=r}if(r.chunks[n.chunkIndex]||(r.chunks[n.chunkIndex]=n.data,r.chunksLeft--),r.chunksLeft)return;t=r.chunks.join(""),delete this._chunksAwaiting[n.id]}}var a=wialon.util.Json.parse(t);if(a&&a.source==this._id){if(!a.id)return this._frameReady=!0,a.chunkedResult&&(this._chunkedResultEnabled=!0),void this.__frameLoaded();var s=this._callbacks[a.id];if(s){if(a&&a.text&&a.text.error&&1003==a.text.error&&s[3]<3&&(s[3]++,s[4]&&s[5]&&(clearTimeout(s[5]),s[5]=setTimeout(qx.lang.Function.bind(this.__timeout,this,this._counter),1e3*s[4])),this._io.contentWindow))return void setTimeout(qx.lang.Function.bind(function(e){this._io.contentWindow.postMessage(e,this._url)},this,s[2]),1e3*Math.random());s[a.error]&&s[a.error](a.text),s[4]&&s[5]&&clearTimeout(s[5]),delete this._callbacks[a.id]}}},__parseChunk:function(e){if("string"!=typeof e)return!1;if(e.slice(0,this._chunkedPrefix.length)!==this._chunkedPrefix)return null;var t=e.indexOf(":",this._chunkedPrefix.length);if(t<0)return!1;var n=e.indexOf(":",t+1);if(n<0)return!1;var r=e.indexOf(":",n+1);if(r<0)return!1;var i=parseInt(e.slice(this._chunkedPrefix.length,t),10),a=parseInt(e.slice(t+1,n),10),s=parseInt(e.slice(n+1,r),10),o=e.slice(r+1);return!!(isFinite(i)&&isFinite(a)&&isFinite(s))&&{id:i,chunkIndex:a,chunksCount:s,data:o}},__frameLoaded:function(){if(this._frameReady){for(var e=0;e<this._requests.length;e++)this._io.contentWindow.postMessage(this._requests[e],this._url);this._requests=[]}else{var t='{"id": 0, "source":"'+this._id+'", "chunkedPrefix": "'+this._chunkedPrefix+'", "enableChunkedResult": true}';this._io.contentWindow.postMessage(t,this._url)}},__timeout:function(e){var t=this._callbacks[e];t&&(t[1]&&t[1](),delete this._callbacks[e])},__urlEncodeData:function(e){var t=[],n=!1;if("object"==typeof e){for(var r in e)"object"==typeof e[r]?t.push(r+"="+encodeURIComponent(wialon.util.Json.stringify(e[r]))):t.push(r+"="+encodeURIComponent(e[r])),"sid"==r&&(n=!0);return t.join("&")+(n?"":"&sid="+wialon.core.Session.getInstance().getId())}return n?"":"&sid="+wialon.core.Session.getInstance().getId()}},destruct:function(){this._io&&this._io.parentNode&&(this._io.parentNode.removeChild(this._io),this._io=null),this._messageEventHandler&&(window.addEventListener?window.removeEventListener("message",this._messageEventHandler):window.detachEvent("onmessage",this._messageEventHandler),this._messageEventHandler=null)},statics:{_postMessagePrefixCounter:0}}),qx.Class.define("wialon.util.Helper",{type:"static",statics:{filterItems:function(e,t){if(!e)return null;for(var n=new Array,r=0;r<e.length;r++){var i=e[r];i&&wialon.util.Number.and(i.getUserAccess(),t)==t&&n.push(i)}return n},searchObject:function(e,t,n){if(!e||!t||!n)return null;for(var r in e)if(void 0!==e[r][t]&&e[r][t]==n)return e[r];return null},sortItems:function(e,t,n,r){if((new Date).getTime(),!e)return null;"function"!=typeof t&&(t=function(e){return e.getName()});var i,a,s,o,l,c,u,d={},p=!1,g=0,h=0,m=0,f=!1,_=!1,v=0,x=0,b=!1,w=!1,y=!1;l=/(-?\d*\.?\d+)|((-*\.*[^-\d]+)+)/g,u=c=/(\d*\.?\d+)|((-*\.*[^\d]+)+)/g,void 0!==r&&(1&r&&(y=!0),2&r&&(c=l),4&r&&(u=l));var I=function(e,t){return e.match(t?u:c)},q=this._containsRTL,C=this._convertArabicForth.bind(this),T=e.some(function(e){if(!e)return!1;var n=t(e);return q(n)}),E=function(e){if(!e)return null;var t;for(_=!1,x=0;x<e.length;x++)_?(t=e[x],T&&"string"==typeof t&&(e[x]=C(t)),_=!1):(v=~~e[x],g=e[x].length,f=!1,(v+"").length!=g||v!=e[x]?(v=parseFloat(e[x]),f=v==v):f=!0,x>0||f?(e[x]=[v,e[x],g],_=!0):_=!1);return e},S=function(e,r,l){if(s=(p=l&&"function"==typeof n)?n(y?r:e):t(y?r:e),o=p?n(y?e:r):t(y?e:r),void 0===(i=d[s])&&(i=E(I(s.toLowerCase(),l)),d[s]=i),void 0===(a=d[o])&&(a=E(I(o.toLowerCase(),l)),d[o]=a),!(i&&a&&i.length&&a.length))return i&&i.length?a&&a.length?(l||"function"!=typeof n||S(e,r,!0),0):1:-1;for(g=0;i[g]&&a[g];g++){if("object"==typeof i[g]?(h=i[g][0],b=!0):(h=i[g],b=!1),"object"==typeof a[g]?(m=a[g][0],w=!0):(m=a[g],w=!1),h!==m)return b&&w?h-m:(b&&(h=i[g][1]),w&&(m=a[g][1]),h>m?1:-1);if(b&&w&&i[g][2]!=a[g][2])return a[g][2]-i[g][2]}return i.length!=a.length||l||"function"!=typeof n?i.length-a.length:S(e,r,!0)};return e.sort(S),d=null,e},getZonesInPoint:function(e,t){return wialon.core.Remote.getInstance().remoteCall("resource/get_zones_by_point",{spec:e},wialon.util.Helper.wrapCallback(t))},checkUniqueName:function(e,t){return wialon.core.Remote.getInstance().remoteCall("core/check_unique",e,wialon.util.Helper.wrapCallback(t))},wildcardCompare:function(e,t,n){if(null==e||null==t)return null;n&&-1==t.indexOf("*")&&-1==t.indexOf("?")&&(t="*"+t+"*");var r=t.toLowerCase();return r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=r.replace(/\\/g,"\\\\")).replace(/\./g,"\\.")).replace(/\?/g,".")).replace(/\*/g,".*")).replace(/\^/g,"\\^")).replace(/\$/g,"\\$")).replace(/\+/g,"\\+")).replace(/\(/g,"\\(")).replace(/\)/g,"\\)")).replace(/\[/g,"\\[")).replace(/\]/g,"\\]")).replace(/\{/g,"\\{")).replace(/\}/g,"\\}"),null!=e.toLowerCase().match(new RegExp("^"+r+"$"))},wrapCallback:function(e){return"function"==typeof e?e:qx.lang.Function.bind(this.__callback,this,e)},countProps:function(e){var t=0;for(var n in e)e.hasOwnProperty(n)&&t++;return t},objectsEqual:function(e,t){if(typeof e!=typeof t)return!1;if("function"==typeof e)return e.toString()===t.toString();if(e instanceof Object&&t instanceof Object){if(this.countProps(e)!==this.countProps(t))return!1;for(var n in e)if(!this.objectsEqual(e[n],t[n]))return!1;return!0}return e===t},__callback:function(){if(!arguments.length)return arguments;var e=Array.prototype.slice.call(arguments,1),t=arguments[0];if(!t)return e;t instanceof Array||(t=[t]);for(var n=0;n<t.length;n++)t[n].apply(this,e);return e},_containsRTL:function(e){return/[\u0591-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/.test(e)},_convertArabicForth:function(e){var t=this._arabicMapForth;return e.replace(/[\u0591-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/g,function(e){return t[e]||e})},_arabicMapForth:(arabicMapForth={},[[8207,1425],[1768,1426],[1767,1456],[1764,1457],[1763,1458],[1762,1459],[1761,1460],[1760,1461],[1759,1462],[1757,1463],[1756,1464],[1755,1465],[1754,1466],[1753,1467],[1752,1468],[1751,1470],[1750,1471],[1807,1472],[8238,1473],[1770,1474],[1771,1475],[1772,1478],[1773,1479],[8235,1480],[1856,1481],[1859,1482],[1860,1483],[1863,1484],[1864,1485],[1865,1486],[1866,1487],[65139,1488],[2042,1489],[1425,1490],[1600,1491],[1426,1492],[1564,1493],[1562,1494],[1561,1495],[1560,1496],[1559,1497],[1558,1498],[1557,1499],[1556,1500],[1555,1501],[1554,1502],[1553,1503],[1552,1504],[1541,1505],[1540,1506],[1539,1507],[1538,1508],[1537,1509],[1536,1510],[1861,1511],[1857,1512],[1858,1513],[1862,1514],[1456,1515],[1457,1516],[1458,1517],[1459,1518],[1460,1519],[1461,1520],[1462,1521],[1463,1522],[1479,1523],[1464,1524],[1466,1525],[1465,1526],[1467,1527],[1474,1528],[1473,1529],[1468,1530],[1471,1531],[64286,1532],[1611,1533],[65137,1534],[65136,1535],[1612,1536],[65138,1537],[64606,1538],[1613,1539],[65140,1540],[64607,1541],[1614,1542],[65143,1543],[65142,1544],[64754,1545],[64608,1546],[1615,1547],[65145,1548],[65144,1549],[64755,1550],[64609,1551],[1616,1552],[65147,1553],[65146,1554],[64756,1555],[64610,1556],[1617,1557],[65149,1558],[65148,1559],[64611,1560],[1618,1561],[65151,1562],[65150,1563],[1619,1564],[1620,1565],[1621,1566],[1631,1567],[1622,1568],[1623,1569],[1624,1570],[1625,1571],[1626,1572],[1627,1573],[1628,1574],[1629,1575],[1630,1576],[1648,1577],[1809,1578],[1840,1579],[1841,1580],[1842,1581],[1843,1582],[1844,1583],[1845,1584],[1846,1585],[1847,1586],[1848,1587],[1849,1588],[1850,1589],[1851,1590],[1852,1591],[1853,1592],[1854,1593],[1855,1594],[2027,1595],[2028,1596],[2029,1597],[2030,1598],[2031,1599],[2032,1600],[2033,1601],[2034,1602],[2035,1603],[1548,1604],[1549,1605],[1643,1606],[1644,1607],[2040,1608],[1563,1609],[1566,1610],[1795,1611],[1796,1612],[1797,1613],[1798,1614],[1799,1615],[1800,1616],[2041,1617],[1567,1618],[1801,1619],[1748,1620],[1793,1621],[1794,1622],[1792,1623],[2039,1624],[64830,1625],[64831,1626],[1645,1627],[1642,1628],[1545,1629],[1546,1630],[1470,1631],[1472,1632],[1475,1633],[1478,1634],[1523,1635],[1524,1636],[1802,1637],[1803,1638],[1804,1639],[1805,1640],[1544,1641],[1550,1642],[1551,1643],[1758,1644],[1769,1645],[65021,1646],[64434,1647],[64435,1648],[64436,1649],[64437,1650],[64438,1651],[64439,1652],[64440,1653],[64441,1654],[64442,1655],[64443,1656],[64444,1657],[64445,1658],[64446,1659],[64447,1660],[64448,1661],[64449,1662],[2038,1663],[64297,1664],[1542,1665],[1543,1666],[1547,1667],[65020,1668],[1632,1669],[1776,1670],[1984,1671],[1633,1672],[1985,1673],[1777,1674],[1634,1675],[1778,1676],[1986,1677],[1779,1678],[1987,1679],[1635,1680],[1988,1681],[1636,1682],[1780,1683],[1637,1684],[1989,1685],[1781,1686],[1990,1687],[1638,1688],[1782,1689],[1991,1690],[1783,1691],[1639,1692],[1640,1693],[1784,1694],[1992,1695],[1641,1696],[1785,1697],[1993,1698],[1488,1699],[64289,1700],[64302,1701],[64303,1702],[64304,1703],[64335,1704],[1489,1705],[64305,1706],[64332,1707],[1490,1708],[64306,1709],[1491,1710],[64290,1711],[64307,1712],[1492,1713],[64291,1714],[64308,1715],[1493,1716],[64331,1717],[64309,1718],[1520,1719],[1521,1720],[1494,1721],[64310,1722],[1495,1723],[1496,1724],[64312,1725],[1497,1726],[64285,1727],[64313,1728],[1522,1729],[64287,1730],[1499,1731],[64292,1732],[1498,1733],[64315,1734],[64314,1735],[64333,1736],[1500,1737],[64293,1738],[64316,1739],[1502,1740],[64294,1741],[1501,1742],[64318,1743],[1504,1744],[1503,1745],[64320,1746],[1505,1747],[64321,1748],[1506,1749],[64288,1750],[1508,1751],[1507,1752],[64324,1753],[64323,1754],[64334,1755],[1510,1756],[1509,1757],[64326,1758],[1511,1759],[64327,1760],[1512,1761],[64295,1762],[64328,1763],[1513,1764],[64299,1765],[64298,1766],[64329,1767],[64301,1768],[64300,1769],[1514,1770],[64296,1771],[64330,1772],[1569,1773],[1652,1774],[65152,1775],[1789,1776],[1570,1777],[65154,1778],[65153,1779],[1571,1780],[65156,1781],[65155,1782],[1650,1783],[1649,1784],[64337,1785],[64336,1786],[1572,1787],[65158,1788],[65157,1789],[1573,1790],[65160,1791],[65159,1792],[1651,1793],[1907,1794],[1908,1795],[1574,1796],[65163,1797],[65164,1798],[65162,1799],[65161,1800],[64491,1801],[64490,1802],[64663,1803],[64512,1804],[64664,1805],[64513,1806],[64665,1807],[64612,1808],[64613,1809],[64666,1810],[64735,1811],[64614,1812],[64514,1813],[64615,1814],[64667,1815],[64736,1816],[64493,1817],[64492,1818],[64495,1819],[64494,1820],[64499,1821],[64498,1822],[64497,1823],[64496,1824],[64501,1825],[64500,1826],[64507,1827],[64616,1828],[64506,1829],[64515,1830],[64505,1831],[64617,1832],[64516,1833],[64504,1834],[64503,1835],[64502,1836],[1575,1837],[65166,1838],[65165,1839],[64828,1840],[64829,1841],[1653,1842],[65011,1843],[65010,1844],[1646,1845],[1576,1846],[65169,1847],[65170,1848],[65168,1849],[65167,1850],[64668,1851],[64517,1852],[64669,1853],[64518,1854],[64962,1855],[64670,1856],[64519,1857],[64926,1858],[64618,1859],[64619,1860],[64671,1861],[64737,1862],[64620,1863],[64520,1864],[64621,1865],[64672,1866],[64738,1867],[64622,1868],[64521,1869],[64623,1870],[64522,1871],[1659,1872],[64340,1873],[64341,1874],[64339,1875],[64338,1876],[1662,1877],[64344,1878],[64345,1879],[64343,1880],[64342,1881],[1664,1882],[64348,1883],[64349,1884],[64347,1885],[64346,1886],[1872,1887],[1873,1888],[1874,1889],[1875,1890],[1876,1891],[1877,1892],[1878,1893],[1577,1894],[65172,1895],[65171,1896],[1578,1897],[65175,1898],[65176,1899],[65174,1900],[65173,1901],[64673,1902],[64523,1903],[64848,1904],[64928,1905],[64927,1906],[64674,1907],[64524,1908],[64850,1909],[64849,1910],[64851,1911],[64675,1912],[64525,1913],[64852,1914],[64930,1915],[64929,1916],[64624,1917],[64625,1918],[64676,1919],[64739,1920],[64626,1921],[64526,1922],[64853,1923],[64854,1924],[64855,1925],[64932,1926],[64931,1927],[64627,1928],[64677,1929],[64740,1930],[64628,1931],[64527,1932],[64629,1933],[64528,1934],[1579,1935],[65179,1936],[65180,1937],[65178,1938],[65177,1939],[64529,1940],[64630,1941],[64631,1942],[64678,1943],[64741,1944],[64632,1945],[64530,1946],[64633,1947],[64742,1948],[64634,1949],[64531,1950],[64635,1951],[64532,1952],[1657,1953],[64360,1954],[64361,1955],[64359,1956],[64358,1957],[1658,1958],[64352,1959],[64353,1960],[64351,1961],[64350,1962],[1660,1963],[1661,1964],[1663,1965],[64356,1966],[64357,1967],[64355,1968],[64354,1969],[1580,1970],[65183,1971],[65184,1972],[65182,1973],[65181,1974],[64679,1975],[64533,1976],[64934,1977],[64958,1978],[65019,1979],[64680,1980],[64534,1981],[64857,1982],[64856,1983],[64935,1984],[64933,1985],[64797,1986],[64769,1987],[64798,1988],[64770,1989],[1667,1990],[64376,1991],[64377,1992],[64375,1993],[64374,1994],[1668,1995],[64372,1996],[64373,1997],[64371,1998],[64370,1999],[1670,2e3],[64380,2001],[64381,2002],[64379,2003],[64378,2004],[1727,2005],[1671,2006],[64384,2007],[64385,2008],[64383,2009],[64382,2010],[1581,2011],[65187,2012],[65188,2013],[65186,2014],[65185,2015],[64681,2016],[64535,2017],[64959,2018],[64682,2019],[64536,2020],[64859,2021],[64858,2022],[64795,2023],[64767,2024],[64796,2025],[64768,2026],[1582,2027],[65191,2028],[65192,2029],[65190,2030],[65189,2031],[64683,2032],[64537,2033],[64538,2034],[64684,2035],[64539,2036],[64799,2037],[64771,2038],[64800,2039],[64772,2040],[1665,2041],[1666,2042],[1669,2043],[1879,2044],[1880,2045],[1902,2046],[1903,2047],[1906,8207],[1916,8235],[1583,8238],[65194,64285],[65193,64286],[1584,64287],[65196,64288],[65195,64289],[64603,64290],[1672,64291],[64393,64292],[64392,64293],[1673,64294],[1674,64295],[1675,64296],[1676,64297],[64389,64298],[64388,64299],[1677,64300],[64387,64301],[64386,64302],[1678,64303],[64391,64304],[64390,64305],[1679,64306],[1680,64307],[1774,64308],[1881,64309],[1882,64310],[1585,64311],[65198,64312],[65197,64313],[64604,64314],[65014,64315],[1586,64316],[65200,64317],[65199,64318],[1681,64319],[64397,64320],[64396,64321],[1682,64322],[1683,64323],[1684,64324],[1685,64325],[1686,64326],[1687,64327],[1688,64328],[64395,64329],[64394,64330],[1689,64331],[1775,64332],[1883,64333],[1899,64334],[1900,64335],[1905,64336],[1587,64337],[65203,64338],[65204,64339],[65202,64340],[65201,64341],[64685,64342],[64820,64343],[64540,64344],[64861,64345],[64862,64346],[64686,64347],[64821,64348],[64541,64349],[64860,64350],[64687,64351],[64822,64352],[64542,64353],[64936,64354],[64966,64355],[64810,64356],[64782,64357],[64688,64358],[64743,64359],[64543,64360],[64865,64361],[64864,64362],[64863,64363],[64867,64364],[64866,64365],[64817,64366],[64744,64367],[64791,64368],[64763,64369],[64792,64370],[64764,64371],[1588,64372],[65207,64373],[65208,64374],[65206,64375],[65205,64376],[64813,64377],[64823,64378],[64805,64379],[64777,64380],[64873,64381],[64814,64382],[64824,64383],[64806,64384],[64778,64385],[64872,64386],[64871,64387],[64938,64388],[64815,64389],[64825,64390],[64807,64391],[64779,64392],[64809,64393],[64781,64394],[64816,64395],[64745,64396],[64808,64397],[64780,64398],[64875,64399],[64874,64400],[64877,64401],[64876,64402],[64818,64403],[64746,64404],[64793,64405],[64765,64406],[64794,64407],[64766,64408],[1690,64409],[1691,64410],[1692,64411],[1786,64412],[1884,64413],[1901,64414],[1904,64415],[1917,64416],[1918,64417],[1589,64418],[65211,64419],[65212,64420],[65210,64421],[65209,64422],[64689,64423],[64544,64424],[64869,64425],[64868,64426],[64937,64427],[64690,64428],[64811,64429],[64783,64430],[65013,64431],[65017,64432],[65018,64433],[65008,64434],[64691,64435],[64545,64436],[64965,64437],[64870,64438],[64801,64439],[64773,64440],[64802,64441],[64774,64442],[1590,64443],[65215,64444],[65216,64445],[65214,64446],[65213,64447],[64692,64448],[64546,64449],[64693,64450],[64547,64451],[64878,64452],[64939,64453],[64694,64454],[64548,64455],[64880,64456],[64879,64457],[64812,64458],[64784,64459],[64695,64460],[64549,64461],[64803,64462],[64775,64463],[64804,64464],[64776,64465],[1693,64466],[1694,64467],[1787,64468],[1591,64469],[65219,64470],[65220,64471],[65218,64472],[65217,64473],[64696,64474],[64550,64475],[64819,64476],[64826,64477],[64551,64478],[64882,64479],[64881,64480],[64883,64481],[64884,64482],[64785,64483],[64757,64484],[64786,64485],[64758,64486],[1592,64487],[65223,64488],[65224,64489],[65222,64490],[65221,64491],[64697,64492],[64827,64493],[64552,64494],[1695,64495],[1593,64496],[65227,64497],[65228,64498],[65226,64499],[65225,64500],[64698,64501],[64553,64502],[64964,64503],[64885,64504],[65015,64505],[64699,64506],[64554,64507],[64887,64508],[64886,64509],[64888,64510],[64950,64511],[64787,64512],[64759,64513],[64788,64514],[64760,64515],[1594,64516],[65231,64517],[65232,64518],[65230,64519],[65229,64520],[64700,64521],[64555,64522],[64701,64523],[64556,64524],[64889,64525],[64891,64526],[64890,64527],[64789,64528],[64761,64529],[64790,64530],[64762,64531],[1696,64532],[1788,64533],[1885,64534],[1886,64535],[1887,64536],[1601,64537],[65235,64538],[65236,64539],[65234,64540],[65233,64541],[64702,64542],[64557,64543],[64703,64544],[64558,64545],[64704,64546],[64559,64547],[64893,64548],[64892,64549],[64705,64550],[64560,64551],[64961,64552],[64636,64553],[64561,64554],[64637,64555],[64562,64556],[1697,64557],[1698,64558],[1699,64559],[1700,64560],[64364,64561],[64365,64562],[64363,64563],[64362,64564],[1701,64565],[1702,64566],[64368,64567],[64369,64568],[64367,64569],[64366,64570],[1888,64571],[1889,64572],[1647,64573],[1602,64574],[65239,64575],[65240,64576],[65238,64577],[65237,64578],[64706,64579],[64563,64580],[65009,64581],[64707,64582],[64564,64583],[64948,64584],[64894,64585],[64895,64586],[64946,64587],[64638,64588],[64565,64589],[64639,64590],[64566,64591],[1703,64592],[1704,64593],[1603,64594],[65243,64595],[65244,64596],[65242,64597],[65241,64598],[64640,64599],[64567,64600],[64708,64601],[64568,64602],[64709,64603],[64569,64604],[64710,64605],[64570,64606],[64711,64607],[64747,64608],[64641,64609],[64571,64610],[64712,64611],[64748,64612],[64642,64613],[64572,64614],[64963,64615],[64955,64616],[64951,64617],[64643,64618],[64573,64619],[64644,64620],[64574,64621],[1705,64622],[64400,64623],[64401,64624],[64399,64625],[64398,64626],[1706,64627],[1707,64628],[1708,64629],[1919,64630],[1709,64631],[64469,64632],[64470,64633],[64468,64634],[64467,64635],[1710,64636],[1711,64637],[64404,64638],[64405,64639],[64403,64640],[64402,64641],[1712,64642],[1713,64643],[64412,64644],[64413,64645],[64411,64646],[64410,64647],[1714,64648],[1715,64649],[64408,64650],[64409,64651],[64407,64652],[64406,64653],[1716,64654],[1890,64655],[1595,64656],[1596,64657],[1891,64658],[1892,64659],[1604,64660],[65247,64661],[65248,64662],[65246,64663],[65245,64664],[65270,64665],[65269,64666],[65272,64667],[65271,64668],[65274,64669],[65273,64670],[65276,64671],[65275,64672],[64713,64673],[64575,64674],[64899,64675],[64900,64676],[64954,64677],[64956,64678],[64940,64679],[64714,64680],[64576,64681],[64949,64682],[64896,64683],[64898,64684],[64897,64685],[64715,64686],[64577,64687],[64902,64688],[64901,64689],[64716,64690],[64749,64691],[64645,64692],[64578,64693],[64904,64694],[64903,64695],[64941,64696],[64717,64697],[64646,64698],[64579,64699],[64647,64700],[64580,64701],[1717,64702],[1718,64703],[1719,64704],[1720,64705],[1898,64706],[1605,64707],[65251,64708],[65252,64709],[65250,64710],[65249,64711],[1790,64712],[64648,64713],[64718,64714],[64581,64715],[64908,64716],[64914,64717],[64909,64718],[64960,64719],[64719,64720],[64582,64721],[64905,64722],[64906,64723],[65012,64724],[64907,64725],[64720,64726],[64583,64727],[64910,64728],[64911,64729],[64953,64730],[64721,64731],[64649,64732],[64584,64733],[64945,64734],[64585,64735],[64586,64736],[1893,64737],[1894,64738],[1606,64739],[65255,64740],[65256,64741],[65254,64742],[65253,64743],[64722,64744],[64587,64745],[64952,64746],[64957,64747],[64920,64748],[64919,64749],[64921,64750],[64967,64751],[64723,64752],[64588,64753],[64917,64754],[64918,64755],[64947,64756],[64724,64757],[64589,64758],[64650,64759],[64651,64760],[64725,64761],[64750,64762],[64652,64763],[64590,64764],[64923,64765],[64922,64766],[64653,64767],[64726,64768],[64751,64769],[64654,64770],[64591,64771],[64655,64772],[64592,64773],[1722,64774],[64415,64775],[64414,64776],[1723,64777],[64418,64778],[64419,64779],[64417,64780],[64416,64781],[1724,64782],[1725,64783],[1721,64784],[1895,64785],[1896,64786],[1897,64787],[1607,64788],[65259,64789],[65260,64790],[65258,64791],[65257,64792],[64729,64793],[64727,64794],[64593,64795],[64728,64796],[64594,64797],[64915,64798],[64916,64799],[64595,64800],[64596,64801],[1726,64802],[64428,64803],[64429,64804],[64427,64805],[64426,64806],[1729,64807],[64424,64808],[64425,64809],[64423,64810],[64422,64811],[1730,64812],[1731,64813],[1791,64814],[1749,64815],[1728,64816],[64421,64817],[64420,64818],[1608,64819],[1765,64820],[65262,64821],[65261,64822],[1654,64823],[65016,64824],[1732,64825],[1733,64826],[64481,64827],[64480,64828],[1734,64829],[64474,64830],[64473,64831],[1735,64832],[64472,64833],[64471,64834],[1655,64835],[64477,64836],[1736,64837],[64476,64838],[64475,64839],[1737,64840],[64483,64841],[64482,64842],[1738,64843],[1739,64844],[64479,64845],[64478,64846],[1743,64847],[1912,64848],[1913,64849],[1609,64850],[64488,64851],[64489,64852],[65264,64853],[65263,64854],[64656,64855],[64605,64856],[1610,64857],[1766,64858],[65267,64859],[65268,64860],[65266,64861],[65265,64862],[1656,64863],[64730,64864],[64597,64865],[64943,64866],[64731,64867],[64598,64868],[64942,64869],[64732,64870],[64599,64871],[64657,64872],[64658,64873],[64733,64874],[64752,64875],[64659,64876],[64600,64877],[64925,64878],[64924,64879],[64944,64880],[64660,64881],[64734,64882],[64753,64883],[64661,64884],[64601,64885],[64662,64886],[64602,64887],[1740,64888],[64510,64889],[64511,64890],[64509,64891],[64508,64892],[1741,64893],[1742,64894],[1744,64895],[64486,64896],[64487,64897],[64485,64898],[64484,64899],[1745,64900],[1597,64901],[1598,64902],[1599,64903],[1568,64904],[1909,64905],[1910,64906],[1911,64907],[1746,64908],[64431,64909],[64430,64910],[1747,64911],[64433,64912],[64432,64913],[1914,64914],[1915,64915],[1808,64916],[1810,64917],[1837,64918],[1811,64919],[1812,64920],[1838,64921],[1814,64922],[1813,64923],[1839,64924],[1815,64925],[1816,64926],[1817,64927],[1869,64928],[1818,64929],[1819,64930],[1820,64931],[1821,64932],[1822,64933],[1823,64934],[1870,64935],[1824,64936],[1825,64937],[1826,64938],[1827,64939],[1828,64940],[1829,64941],[1830,64942],[1831,64943],[1871,64944],[1832,64945],[1833,64946],[1834,64947],[1835,64948],[1836,64949],[1920,64950],[1945,64951],[1946,64952],[1921,64953],[1922,64954],[1923,64955],[1948,64956],[1924,64957],[1925,64958],[1926,64959],[1927,64960],[1954,64961],[1955,64962],[1928,64963],[1957,64964],[1929,64965],[1930,64966],[1931,64967],[1947,64968],[1932,64969],[1944,64970],[1952,64971],[1953,64972],[1933,64973],[1934,64974],[1956,64975],[1935,64976],[1936,64977],[1949,64978],[1950,64979],[1951,64980],[1937,64981],[1938,64982],[1939,64983],[1940,64984],[1941,64985],[1942,64986],[1943,64987],[1969,64988],[1958,64989],[1959,64990],[1960,64991],[1961,64992],[1962,64993],[1963,64994],[1964,64995],[1965,64996],[1966,64997],[1967,64998],[1968,64999],[1994,65e3],[1995,65001],[1996,65002],[1997,65003],[1998,65004],[1999,65005],[2e3,65006],[2001,65007],[2002,65008],[2003,65009],[2004,65010],[2005,65011],[2006,65012],[2024,65013],[2007,65014],[2025,65015],[2008,65016],[2009,65017],[2026,65018],[2010,65019],[2011,65020],[2012,65021],[2013,65136],[2014,65137],[2015,65138],[2016,65139],[2017,65140],[2018,65141],[2019,65142],[2020,65143],[2021,65144],[2022,65145],[2023,65146],[2036,65147],[2037,65148],[1480,65149],[1481,65150],[1482,65151],[1483,65152],[1484,65153],[1485,65154],[1486,65155],[1487,65156],[1515,65157],[1516,65158],[1517,65159],[1518,65160],[1519,65161],[1525,65162],[1526,65163],[1527,65164],[1528,65165],[1529,65166],[1530,65167],[1531,65168],[1532,65169],[1533,65170],[1534,65171],[1535,65172],[1565,65173],[1806,65174],[1867,65175],[1868,65176],[1970,65177],[1971,65178],[1972,65179],[1973,65180],[1974,65181],[1975,65182],[1976,65183],[1977,65184],[1978,65185],[1979,65186],[1980,65187],[1981,65188],[1982,65189],[1983,65190],[2043,65191],[2044,65192],[2045,65193],[2046,65194],[2047,65195],[64311,65196],[64317,65197],[64319,65198],[64322,65199],[64325,65200],[64450,65201],[64451,65202],[64452,65203],[64453,65204],[64454,65205],[64455,65206],[64456,65207],[64457,65208],[64458,65209],[64459,65210],[64460,65211],[64461,65212],[64462,65213],[64463,65214],[64464,65215],[64465,65216],[64466,65217],[64832,65218],[64833,65219],[64834,65220],[64835,65221],[64836,65222],[64837,65223],[64838,65224],[64839,65225],[64840,65226],[64841,65227],[64842,65228],[64843,65229],[64844,65230],[64845,65231],[64846,65232],[64847,65233],[64912,65234],[64913,65235],[64968,65236],[64969,65237],[64970,65238],[64971,65239],[64972,65240],[64973,65241],[64974,65242],[64975,65243],[64976,65244],[64977,65245],[64978,65246],[64979,65247],[64980,65248],[64981,65249],[64982,65250],[64983,65251],[64984,65252],[64985,65253],[64986,65254],[64987,65255],[64988,65256],[64989,65257],[64990,65258],[64991,65259],[64992,65260],[64993,65261],[64994,65262],[64995,65263],[64996,65264],[64997,65265],[64998,65266],[64999,65267],[65e3,65268],[65001,65269],[65002,65270],[65003,65271],[65004,65272],[65005,65273],[65006,65274],[65007,65275],[65141,65276]].forEach(function(e){arabicMapForth[String.fromCharCode(e[0])]=String.fromCharCode(e[1])}),arabicMapForth)}}),qx.Class.define("wialon.util.Number",{type:"static",statics:{or:function(e){for(var t=this.__constructNumber(),n=0;n<arguments.length;n++){var r=this.__constructNumber(arguments[n]);t[0]=(t[0]|r[0])>>>0,t[1]=(t[1]|r[1])>>>0}return 4294967296*t[0]+t[1]},xor:function(e){for(var t=this.__constructNumber(),n=0;n<arguments.length;n++){var r=this.__constructNumber(arguments[n]);t[0]=(t[0]^r[0])>>>0,t[1]=(t[1]^r[1])>>>0}return 4294967296*t[0]+t[1]},and:function(e){for(var t=[4294967295,4294967295],n=0;n<arguments.length;n++){var r=this.__constructNumber(arguments[n]);t[0]=(t[0]&r[0])>>>0,t[1]=(t[1]&r[1])>>>0}return 4294967296*t[0]+t[1]},not:function(e){var t=this.__constructNumber(e);return t[0]=(2097151&~t[0])>>>0,t[1]=~t[1]>>>0,4294967296*t[0]+t[1]},exclude:function(e){if(!arguments.length)return 0;for(var t=this.__constructNumber(arguments[0]),n=1;n<arguments.length;n++){var r=this.__constructNumber(this.not(arguments[n]));t[0]=(t[0]&r[0])>>>0,t[1]=(t[1]&r[1])>>>0}return 4294967296*t[0]+t[1]},umax:function(){return 9007199254740991},__constructNumber:function(e){var t=[0,0];if("number"==typeof e){if(-1==e)return[2097151,4294967295];e<0&&(e=9007199254740992+e),e=e.toString(16)}if("string"==typeof e&&e.length&&e.length<=16)for(var n=e.length;n>0;n--)t[e.length-n<8?1:0]|=parseInt(e[n-1],16)<<4*(e.length-n)%32;return t[0]=t[0]>>>0,t[1]=t[1]>>>0,t}}}),qx.Class.define("qx.io.request.AbstractRequest",{type:"abstract",extend:qx.core.Object,construct:function(e){this.base(arguments),void 0!==e&&this.setUrl(e),this.__requestHeaders={};var t=this._transport=this._createTransport();this._setPhase("unsent"),this.__onReadyStateChangeBound=qx.lang.Function.bind(this._onReadyStateChange,this),this.__onLoadBound=qx.lang.Function.bind(this._onLoad,this),this.__onLoadEndBound=qx.lang.Function.bind(this._onLoadEnd,this),this.__onAbortBound=qx.lang.Function.bind(this._onAbort,this),this.__onTimeoutBound=qx.lang.Function.bind(this._onTimeout,this),this.__onErrorBound=qx.lang.Function.bind(this._onError,this),t.onreadystatechange=this.__onReadyStateChangeBound,t.onload=this.__onLoadBound,t.onloadend=this.__onLoadEndBound,t.onabort=this.__onAbortBound,t.ontimeout=this.__onTimeoutBound,t.onerror=this.__onErrorBound},events:{readyStateChange:"qx.event.type.Event",success:"qx.event.type.Event",load:"qx.event.type.Event",loadEnd:"qx.event.type.Event",abort:"qx.event.type.Event",timeout:"qx.event.type.Event",error:"qx.event.type.Event",statusError:"qx.event.type.Event",fail:"qx.event.type.Event",changeResponse:"qx.event.type.Data",changePhase:"qx.event.type.Data"},properties:{url:{check:"String"},timeout:{check:"Number",nullable:!0,init:0},requestData:{check:function(e){return qx.lang.Type.isString(e)||qx.Class.isSubClassOf(e.constructor,qx.core.Object)||qx.lang.Type.isObject(e)||qx.lang.Type.isArray(e)},nullable:!0},authentication:{check:"qx.io.request.authentication.IAuthentication",nullable:!0}},members:{__onReadyStateChangeBound:null,__onLoadBound:null,__onLoadEndBound:null,__onAbortBound:null,__onTimeoutBound:null,__onErrorBound:null,__response:null,__abort:null,__phase:null,__requestHeaders:null,__requestHeadersDeprecated:null,_transport:null,_createTransport:function(){throw new Error("Abstract method call")},_getConfiguredUrl:function(){},_getConfiguredRequestHeaders:function(){},_getParsedResponse:function(){throw new Error("Abstract method call")},_getMethod:function(){return"GET"},_isAsync:function(){return!0},send:function(){var e,t,n,r,i=this._transport;e=this._getConfiguredUrl(),/\#/.test(e)&&(e=e.replace(/\#.*/,"")),i.timeout=this.getTimeout(),t=this._getMethod(),n=this._isAsync(),qx.core.Environment.get("qx.debug.io")&&this.debug("Open low-level request with method: "+t+", url: "+e+", async: "+n),i.open(t,e,n),this._setPhase("opened"),r=this._serializeData(this.getRequestData()),this._setRequestHeaders(),qx.core.Environment.get("qx.debug.io")&&this.debug("Send low-level request"),"GET"==t?i.send():i.send(r),this._setPhase("sent")},abort:function(){qx.core.Environment.get("qx.debug.io")&&this.debug("Abort request"),this.__abort=!0,this.__phase="abort",this._transport.abort()},_setRequestHeaders:function(){var e=this._transport,t=this._getAllRequestHeaders();for(var n in t)e.setRequestHeader(n,t[n])},_getAllRequestHeaders:function(){var e={};return qx.lang.Object.mergeWith(e,this._getConfiguredRequestHeaders()),qx.lang.Object.mergeWith(e,this.__getAuthRequestHeaders()),qx.lang.Object.mergeWith(e,this.__requestHeadersDeprecated),qx.lang.Object.mergeWith(e,this.__requestHeaders),e},__getAuthRequestHeaders:function(){var e=this.getAuthentication(),t={};if(e)return e.getAuthHeaders().forEach(function(e){t[e.key]=e.value}),t},setRequestHeader:function(e,t){this.__requestHeaders[e]=t},getRequestHeader:function(e){return this.__requestHeaders[e]},removeRequestHeader:function(e){this.__requestHeaders[e]&&delete this.__requestHeaders[e]},getTransport:function(){return this._transport},getReadyState:function(){return this._transport.readyState},getPhase:function(){return this.__phase},getStatus:function(){return this._transport.status},getStatusText:function(){return this._transport.statusText},getResponseText:function(){return this._transport.responseText},getAllResponseHeaders:function(){return this._transport.getAllResponseHeaders()},getResponseHeader:function(e){return this._transport.getResponseHeader(e)},overrideResponseContentType:function(e){return this._transport.overrideMimeType(e)},getResponseContentType:function(){return this.getResponseHeader("Content-Type")},isDone:function(){return 4===this.getReadyState()},getResponse:function(){return this.__response},_setResponse:function(e){var t=e;this.__response!==e&&(this.__response=e,this.fireEvent("changeResponse",qx.event.type.Data,[this.__response,t]))},_onReadyStateChange:function(){var e=this.getReadyState();qx.core.Environment.get("qx.debug.io")&&this.debug("Fire readyState: "+e),this.fireEvent("readyStateChange"),this.__abort||(3===e&&this._setPhase("loading"),this.isDone()&&this.__onReadyStateDone())},__onReadyStateDone:function(){if(qx.core.Environment.get("qx.debug.io")&&this.debug("Request completed with HTTP status: "+this.getStatus()),this._setPhase("load"),qx.util.Request.isSuccessful(this.getStatus()))qx.core.Environment.get("qx.debug.io")&&this.debug("Response is of type: '"+this.getResponseContentType()+"'"),this._setResponse(this._getParsedResponse()),this._fireStatefulEvent("success");else{try{this._setResponse(this._getParsedResponse())}catch(e){}0!==this.getStatus()&&(this._fireStatefulEvent("statusError"),this.fireEvent("fail"))}},_onLoad:function(){this.fireEvent("load")},_onLoadEnd:function(){this.fireEvent("loadEnd")},_onAbort:function(){this._fireStatefulEvent("abort")},_onTimeout:function(){this._fireStatefulEvent("timeout"),this.fireEvent("fail")},_onError:function(){this.fireEvent("error"),this.fireEvent("fail")},_fireStatefulEvent:function(e){qx.core.Environment.get("qx.debug")&&qx.core.Assert.assertString(e),this._setPhase(e),this.fireEvent(e)},_setPhase:function(e){var t=this.__phase;qx.core.Environment.get("qx.debug")&&(qx.core.Assert.assertString(e),qx.core.Assert.assertMatch(e,/^(unsent)|(opened)|(sent)|(loading)|(load)|(success)|(abort)|(timeout)|(statusError)$/)),this.__phase=e,this.fireDataEvent("changePhase",e,t)},_serializeData:function(e){var t=void 0!==this.getMethod&&"POST"==this.getMethod(),n=/application\/.*\+?json/.test(this.getRequestHeader("Content-Type"));return e?qx.lang.Type.isString(e)?e:qx.Class.isSubClassOf(e.constructor,qx.core.Object)?qx.util.Serializer.toUriParameter(e):n&&(qx.lang.Type.isObject(e)||qx.lang.Type.isArray(e))?qx.lang.Json.stringify(e):qx.lang.Type.isObject(e)?qx.util.Uri.toParameter(e,t):void 0:null}},environment:{"qx.debug.io":!1},destruct:function(){var e=this._transport;this._transport&&(e.onreadystatechange=e.onload=e.onloadend=e.onabort=e.ontimeout=e.onerror=function(){},window.setTimeout(function(){e.dispose()},0))}}),qx.Bootstrap.define("qx.util.Uri",{statics:{parseUri:function(e,t){for(var n={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},r=n,i=n.parser[t?"strict":"loose"].exec(e),a={},s=14;s--;)a[r.key[s]]=i[s]||"";return a[r.q.name]={},a[r.key[12]].replace(r.q.parser,function(e,t,n){t&&(a[r.q.name][t]=n)}),a},appendParamsToUrl:function(e,t){if(void 0===t)return e;if(qx.core.Environment.get("qx.debug")&&!qx.lang.Type.isString(t)&&!qx.lang.Type.isObject(t))throw new Error("params must be either string or object");return qx.lang.Type.isObject(t)&&(t=qx.util.Uri.toParameter(t)),t?e+(/\?/.test(e)?"&"+t:"?"+t):e},toParameter:function(e,t){var n,r=[];for(n in e)if(e.hasOwnProperty(n)){var i=e[n];if(i instanceof Array)for(var a=0;a<i.length;a++)this.__toParameterPair(n,i[a],r,t);else this.__toParameterPair(n,i,r,t)}return r.join("&")},__toParameterPair:function(e,t,n,r){var i=window.encodeURIComponent;r?n.push(i(e).replace(/%20/g,"+")+"="+i(t).replace(/%20/g,"+")):n.push(i(e)+"="+i(t))},getAbsolute:function(e){var t=document.createElement("div");return t.innerHTML='<a href="'+e+'">0</a>',t.firstChild.href}}}),qx.Class.define("qx.util.Serializer",{statics:{toUriParameter:function(e,t,n){var r="",i=qx.util.PropertyUtil.getAllProperties(e.constructor);for(var a in i)if(void 0==i[a].group){var s=e["get"+qx.lang.String.firstUp(a)]();if(qx.lang.Type.isArray(s))for(var o=qx.data&&qx.data.IListData&&qx.Class.hasInterface(s&&s.constructor,qx.data.IListData),l=0;l<s.length;l++){var c=o?s.getItem(l):s[l];r+=this.__toUriParameter(a,c,t)}else qx.lang.Type.isDate(s)&&null!=n?r+=this.__toUriParameter(a,n.format(s),t):r+=this.__toUriParameter(a,s,t)}return r.substring(0,r.length-1)},__toUriParameter:function(e,t,n){if(t&&"Class"==t.$$type&&(t=t.classname),!t||"Interface"!=t.$$type&&"Mixin"!=t.$$type||(t=t.name),t instanceof qx.core.Object&&null!=n){if(void 0===(r=encodeURIComponent(n(t))))var r=encodeURIComponent(t)}else r=encodeURIComponent(t);return encodeURIComponent(e)+"="+r+"&"},toNativeObject:function(e,t,n){var r;if(null==e)return null;if(qx.data&&qx.data.IListData&&qx.Class.hasInterface(e.constructor,qx.data.IListData)){r=[];for(var i=0;i<e.getLength();i++)r.push(qx.util.Serializer.toNativeObject(e.getItem(i),t,n));return r}if(qx.lang.Type.isArray(e)){for(r=[],i=0;i<e.length;i++)r.push(qx.util.Serializer.toNativeObject(e[i],t,n));return r}if("Class"==e.$$type)return e.classname;if("Interface"==e.$$type||"Mixin"==e.$$type)return e.name;if(e instanceof qx.core.Object){if(null!=t){var a=t(e);if(void 0!=a)return a}r={};var s=qx.util.PropertyUtil.getAllProperties(e.constructor);for(var o in s)if(void 0==s[o].group){var l=e["get"+qx.lang.String.firstUp(o)]();r[o]=qx.util.Serializer.toNativeObject(l,t,n)}return r}if(qx.lang.Type.isDate(e)&&null!=n)return n.format(e);if(qx.locale&&qx.locale.LocalizedString&&e instanceof qx.locale.LocalizedString)return e.toString();if(qx.lang.Type.isObject(e)){for(var c in r={},e)r[c]=qx.util.Serializer.toNativeObject(e[c],t,n);return r}return e},toJson:function(e,t,n){var r="";if(null==e)return"null";if(qx.data&&qx.data.IListData&&qx.Class.hasInterface(e.constructor,qx.data.IListData)){r+="[";for(var i=0;i<e.getLength();i++)r+=qx.util.Serializer.toJson(e.getItem(i),t,n)+",";return"["!=r&&(r=r.substring(0,r.length-1)),r+"]"}if(qx.lang.Type.isArray(e)){for(r+="[",i=0;i<e.length;i++)r+=qx.util.Serializer.toJson(e[i],t,n)+",";return"["!=r&&(r=r.substring(0,r.length-1)),r+"]"}if("Class"==e.$$type)return'"'+e.classname+'"';if("Interface"==e.$$type||"Mixin"==e.$$type)return'"'+e.name+'"';if(e instanceof qx.core.Object){if(null!=t){var a=t(e);if(void 0!=a)return'"'+a+'"'}r+="{";var s=qx.util.PropertyUtil.getAllProperties(e.constructor);for(var o in s)if(void 0==s[o].group){var l=e["get"+qx.lang.String.firstUp(o)]();r+='"'+o+'":'+qx.util.Serializer.toJson(l,t,n)+","}return"{"!=r&&(r=r.substring(0,r.length-1)),r+"}"}if(qx.locale&&qx.locale.LocalizedString&&e instanceof qx.locale.LocalizedString&&(e=e.toString()),qx.lang.Type.isDate(e)&&null!=n)return'"'+n.format(e)+'"';if(qx.lang.Type.isObject(e)){for(var c in r+="{",e)r+='"'+c+'":'+qx.util.Serializer.toJson(e[c],t,n)+",";return"{"!=r&&(r=r.substring(0,r.length-1)),r+"}"}return qx.lang.Type.isString(e)?'"'+(e=(e=(e=(e=(e=(e=(e=e.replace(/([\\])/g,"\\\\")).replace(/(["])/g,'\\"')).replace(/([\r])/g,"\\r")).replace(/([\f])/g,"\\f")).replace(/([\n])/g,"\\n")).replace(/([\t])/g,"\\t")).replace(/([\b])/g,"\\b"))+'"':qx.lang.Type.isDate(e)||qx.lang.Type.isRegExp(e)?'"'+e+'"':e+""}}}),qx.Class.define("qx.util.PropertyUtil",{statics:{getProperties:function(e){return e.$$properties},getAllProperties:function(e){for(var t={},n=e;n!=qx.core.Object;){var r=this.getProperties(n);for(var i in r)t[i]=r[i];n=n.superclass}return t},getUserValue:function(e,t){return e["$$user_"+t]},setUserValue:function(e,t,n){e["$$user_"+t]=n},deleteUserValue:function(e,t){delete e["$$user_"+t]},getInitValue:function(e,t){return e["$$init_"+t]},setInitValue:function(e,t,n){e["$$init_"+t]=n},deleteInitValue:function(e,t){delete e["$$init_"+t]},getThemeValue:function(e,t){return e["$$theme_"+t]},setThemeValue:function(e,t,n){e["$$theme_"+t]=n},deleteThemeValue:function(e,t){delete e["$$theme_"+t]},setThemed:function(e,t,n){e[qx.core.Property.$$method.setThemed[t]](n)},resetThemed:function(e,t){e[qx.core.Property.$$method.resetThemed[t]]()}}}),qx.Bootstrap.define("qx.util.Request",{statics:{isCrossDomain:function(e){var t=qx.util.Uri.parseUri(e),n=window.location;if(!n)return!1;var r=n.protocol;return-1!==e.indexOf("//")&&(r.substr(0,r.length-1)!=t.protocol||n.host!==t.host||n.port!==t.port)},isSuccessful:function(e){return e>=200&&e<300||304===e},isMethod:function(e){return-1!==["GET","POST","PUT","DELETE","HEAD","OPTIONS","TRACE","CONNECT","PATCH"].indexOf(e)},methodAllowsRequestBody:function(e){return!/^(GET|HEAD)$/.test(e)}}}),qx.Bootstrap.define("qx.lang.Object",{statics:{empty:function(e){for(var t in qx.core.Environment.get("qx.debug")&&qx.core.Assert&&qx.core.Assert.assertMap(e,"Invalid argument 'map'"),e)e.hasOwnProperty(t)&&delete e[t]},isEmpty:function(e){for(var t in qx.core.Environment.get("qx.debug")&&qx.core.Assert&&qx.core.Assert.assertMap(e,"Invalid argument 'map'"),e)return!1;return!0},getLength:qx.Bootstrap.objectGetLength,getValues:function(e){qx.core.Environment.get("qx.debug")&&qx.core.Assert&&qx.core.Assert.assertMap(e,"Invalid argument 'map'");for(var t=[],n=Object.keys(e),r=0,i=n.length;r<i;r++)t.push(e[n[r]]);return t},mergeWith:qx.Bootstrap.objectMergeWith,clone:function(e,t){if(qx.lang.Type.isObject(e)){var n={};for(var r in e)n[r]=t?qx.lang.Object.clone(e[r],t):e[r];return n}if(qx.lang.Type.isArray(e)){n=[];for(var i=0;i<e.length;i++)n[i]=t?qx.lang.Object.clone(e[i],t):e[i];return n}return e},equals:function(e,t){return qx.lang.Object.__equals(e,t,[],[])},__equals:function(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;var i=Object.prototype.toString.call(e);if(i!=Object.prototype.toString.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if("object"!=typeof e||"object"!=typeof t)return!1;for(var a=n.length;a--;)if(n[a]==e)return r[a]==t;var s=e.constructor,o=t.constructor;if(s!==o&&!(qx.Bootstrap.isFunction(s)&&s instanceof s&&qx.Bootstrap.isFunction(o)&&o instanceof o)&&"constructor"in e&&"constructor"in t)return!1;n.push(e),r.push(t);var l=0,c=!0;if("[object Array]"==i){if(c=(l=e.length)==t.length)for(;l--&&(c=qx.lang.Object.__equals(e[l],t[l],n,r)););}else{for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)&&(l++,!(c=Object.prototype.hasOwnProperty.call(t,u)&&qx.lang.Object.__equals(e[u],t[u],n,r))))break;if(c){for(u in t)if(Object.prototype.hasOwnProperty.call(t,u)&&!l--)break;c=!l}}return n.pop(),r.pop(),c},invert:function(e){qx.core.Environment.get("qx.debug")&&qx.core.Assert&&qx.core.Assert.assertMap(e,"Invalid argument 'map'");var t={};for(var n in e)t[e[n].toString()]=n;return t},getKeyFromValue:function(e,t){for(var n in qx.core.Environment.get("qx.debug")&&qx.core.Assert&&qx.core.Assert.assertMap(e,"Invalid argument 'map'"),e)if(e.hasOwnProperty(n)&&e[n]===t)return n;return null},contains:function(e,t){return qx.core.Environment.get("qx.debug")&&qx.core.Assert&&qx.core.Assert.assertMap(e,"Invalid argument 'map'"),null!==this.getKeyFromValue(e,t)},fromArray:function(e){qx.core.Environment.get("qx.debug")&&qx.core.Assert&&qx.core.Assert.assertArray(e,"Invalid argument 'array'");for(var t={},n=0,r=e.length;n<r;n++){if(qx.core.Environment.get("qx.debug"))switch(typeof e[n]){case"object":case"function":case"undefined":throw new Error("Could not convert complex objects like "+e[n]+" at array index "+n+" to map syntax")}t[e[n].toString()]=!0}return t}}}),qx.Class.define("qx.io.request.Jsonp",{extend:qx.io.request.AbstractRequest,events:{success:"qx.event.type.Event",load:"qx.event.type.Event",statusError:"qx.event.type.Event"},properties:{cache:{check:"Boolean",init:!0}},members:{_createTransport:function(){return new qx.bom.request.Jsonp},_getConfiguredUrl:function(){var e,t=this.getUrl();return this.getRequestData()&&(e=this._serializeData(this.getRequestData()),t=qx.util.Uri.appendParamsToUrl(t,e)),this.getCache()||(t=qx.util.Uri.appendParamsToUrl(t,{nocache:(new Date).valueOf()})),t},_getParsedResponse:function(){return this._transport.responseJson},setCallbackParam:function(e){this._transport.setCallbackParam(e)},setCallbackName:function(e){this._transport.setCallbackName(e)}}}),qx.Bootstrap.define("qx.bom.request.Script",{construct:function(){this.__initXhrProperties(),this.__onNativeLoadBound=qx.Bootstrap.bind(this._onNativeLoad,this),this.__onNativeErrorBound=qx.Bootstrap.bind(this._onNativeError,this),this.__onTimeoutBound=qx.Bootstrap.bind(this._onTimeout,this),this.__headElement=document.head||document.getElementsByTagName("head")[0]||document.documentElement,this._emitter=new qx.event.Emitter,this.timeout=this.__supportsErrorHandler()?0:15e3},events:{readystatechange:"qx.bom.request.Script",error:"qx.bom.request.Script",loadend:"qx.bom.request.Script",timeout:"qx.bom.request.Script",abort:"qx.bom.request.Script",load:"qx.bom.request.Script"},members:{readyState:null,status:null,statusText:null,timeout:null,__determineSuccess:null,on:function(e,t,n){return this._emitter.on(e,t,n),this},open:function(e,t){this.__disposed||(this.__initXhrProperties(),this.__abort=null,this.__url=t,this.__environmentGet("qx.debug.io")&&qx.Bootstrap.debug(qx.bom.request.Script,"Open native request with url: "+t),this._readyStateChange(1))},setRequestHeader:function(e,t){if(this.__disposed)return null;var n={};if(1!==this.readyState)throw new Error("Invalid state");return n[e]=t,this.__url=qx.util.Uri.appendParamsToUrl(this.__url,n),this},send:function(){if(this.__disposed)return null;var e=this.__createScriptElement(),t=this.__headElement,n=this;return this.timeout>0&&(this.__timeoutId=window.setTimeout(this.__onTimeoutBound,this.timeout)),this.__environmentGet("qx.debug.io")&&qx.Bootstrap.debug(qx.bom.request.Script,"Send native request"),t.insertBefore(e,t.firstChild),window.setTimeout(function(){n._readyStateChange(2),n._readyStateChange(3)}),this},abort:function(){return this.__disposed?null:(this.__abort=!0,this.__disposeScriptElement(),this._emit("abort"),this)},_emit:function(e){this["on"+e](),this._emitter.emit(e,this)},onreadystatechange:function(){},onload:function(){},onloadend:function(){},onerror:function(){},onabort:function(){},ontimeout:function(){},getResponseHeader:function(e){return this.__disposed?null:(this.__environmentGet("qx.debug")&&qx.Bootstrap.debug("Response header cannot be determined for requests made with script transport."),"unknown")},getAllResponseHeaders:function(){return this.__disposed?null:(this.__environmentGet("qx.debug")&&qx.Bootstrap.debug("Response headers cannot be determined forrequests made with script transport."),"Unknown response headers")},setDetermineSuccess:function(e){this.__determineSuccess=e},dispose:function(){var e=this.__scriptElement;this.__disposed||(e&&(e.onload=e.onreadystatechange=null,this.__disposeScriptElement()),this.__timeoutId&&window.clearTimeout(this.__timeoutId),this.__disposed=!0)},isDisposed:function(){return!!this.__disposed},_getUrl:function(){return this.__url},_getScriptElement:function(){return this.__scriptElement},_onTimeout:function(){this.__failure(),this.__supportsErrorHandler()||this._emit("error"),this._emit("timeout"),this.__supportsErrorHandler()||this._emit("loadend")},_onNativeLoad:function(){var e=this.__scriptElement,t=this.__determineSuccess,n=this;if(!this.__abort){if("mshtml"===this.__environmentGet("engine.name")&&this.__environmentGet("browser.documentmode")<9){if(!/loaded|complete/.test(e.readyState))return;this.__environmentGet("qx.debug.io")&&qx.Bootstrap.debug(qx.bom.request.Script,"Received native readyState: loaded")}this.__environmentGet("qx.debug.io")&&qx.Bootstrap.debug(qx.bom.request.Script,"Received native load"),t&&(this.status||(this.status=t()?200:500)),500===this.status&&this.__environmentGet("qx.debug.io")&&qx.Bootstrap.debug(qx.bom.request.Script,"Detected error"),this.__timeoutId&&window.clearTimeout(this.__timeoutId),window.setTimeout(function(){n._success(),n._readyStateChange(4),n._emit("load"),n._emit("loadend")})}},_onNativeError:function(){this.__failure(),this._emit("error"),this._emit("loadend")},__scriptElement:null,__headElement:null,__url:"",__onNativeLoadBound:null,__onNativeErrorBound:null,__onTimeoutBound:null,__timeoutId:null,__abort:null,__disposed:null,__initXhrProperties:function(){this.readyState=0,this.status=0,this.statusText=""},_readyStateChange:function(e){this.readyState=e,this._emit("readystatechange")},_success:function(){this.__disposeScriptElement(),this.readyState=4,this.status||(this.status=200),this.statusText=""+this.status},__failure:function(){this.__disposeScriptElement(),this.readyState=4,this.status=0,this.statusText=null},__supportsErrorHandler:function(){var e="mshtml"===this.__environmentGet("engine.name")&&this.__environmentGet("browser.documentmode")<9,t="opera"===this.__environmentGet("engine.name");return!(e||t)},__createScriptElement:function(){var e=this.__scriptElement=document.createElement("script");return e.src=this.__url,e.onerror=this.__onNativeErrorBound,e.onload=this.__onNativeLoadBound,"mshtml"===this.__environmentGet("engine.name")&&this.__environmentGet("browser.documentmode")<9&&(e.onreadystatechange=this.__onNativeLoadBound),e},__disposeScriptElement:function(){var e=this.__scriptElement;e&&e.parentNode&&this.__headElement.removeChild(e)},__environmentGet:function(e){if(qx&&qx.core&&qx.core.Environment)return qx.core.Environment.get(e);if("engine.name"===e)return qx.bom.client.Engine.getName();if("browser.documentmode"===e)return qx.bom.client.Browser.getDocumentMode();if("qx.debug.io"==e)return!1;throw new Error("Unknown environment key at this phase")}},defer:function(){qx&&qx.core&&qx.core.Environment&&qx.core.Environment.add("qx.debug.io",!1)}}),qx.Bootstrap.define("qx.event.Emitter",{extend:Object,statics:{__storage:[]},members:{__listener:null,__any:null,on:function(e,t,n){var r=qx.event.Emitter.__storage.length;return this.__getStorage(e).push({listener:t,ctx:n,id:r,name:e}),qx.event.Emitter.__storage.push({name:e,listener:t,ctx:n}),r},once:function(e,t,n){var r=qx.event.Emitter.__storage.length;return this.__getStorage(e).push({listener:t,ctx:n,once:!0,id:r}),qx.event.Emitter.__storage.push({name:e,listener:t,ctx:n}),r},off:function(e,t,n){for(var r=this.__getStorage(e),i=r.length-1;i>=0;i--){var a=r[i];if(a.listener==t&&a.ctx==n)return r.splice(i,1),qx.event.Emitter.__storage[a.id]=null,a.id}return null},offById:function(e){var t=qx.event.Emitter.__storage[e];return t&&this.off(t.name,t.listener,t.ctx),null},addListener:function(e,t,n){return this.on(e,t,n)},addListenerOnce:function(e,t,n){return this.once(e,t,n)},removeListener:function(e,t,n){this.off(e,t,n)},removeListenerById:function(e){this.offById(e)},emit:function(e,t){for(var n=this.__getStorage(e).concat(),r=[],i=0;i<n.length;i++)(a=n[i]).listener.call(a.ctx,t),a.once&&r.push(a);for(r.forEach(function(t){var n=this.__getStorage(e),r=n.indexOf(t);n.splice(r,1)}.bind(this)),i=(n=this.__getStorage("*")).length-1;i>=0;i--){var a;(a=n[i]).listener.call(a.ctx,t)}},getListeners:function(){return this.__listener},getEntryById:function(e){for(var t in this.__listener)for(var n=this.__listener[t],r=0,i=n.length;r<i;r++)if(n[r].id===e)return n[r]},__getStorage:function(e){return null==this.__listener&&(this.__listener={}),null==this.__listener[e]&&(this.__listener[e]=[]),this.__listener[e]}}}),qx.Bootstrap.define("qx.bom.request.Jsonp",{extend:qx.bom.request.Script,construct:function(){qx.bom.request.Script.apply(this),this.__generateId()},members:{responseJson:null,__id:null,__callbackParam:null,__callbackName:null,__callbackCalled:null,__customCallbackCreated:null,__generatedUrl:null,__disposed:null,__prefix:"",open:function(e,t){if(!this.__disposed){var n,r,i={},a=this;this.responseJson=null,this.__callbackCalled=!1,n=this.__callbackParam||"callback",r=this.__callbackName||this.__prefix+"qx.bom.request.Jsonp."+this.__id+".callback",this.__callbackName?window[this.__callbackName]?qx.core.Environment.get("qx.debug.io")&&qx.Bootstrap.debug(qx.bom.request.Jsonp,"Callback "+this.__callbackName+" already exists"):(this.__customCallbackCreated=!0,window[this.__callbackName]=function(e){a.callback(e)}):this.constructor[this.__id]=this,qx.core.Environment.get("qx.debug.io")&&qx.Bootstrap.debug(qx.bom.request.Jsonp,"Expecting JavaScript response to call: "+r),i[n]=r,this.__generatedUrl=t=qx.util.Uri.appendParamsToUrl(t,i),this.__callBase("open",[e,t])}},callback:function(e){this.__disposed||(this.__callbackCalled=!0,qx.core.Environment.get("qx.debug")&&(e=qx.lang.Json.stringify(e),e=qx.lang.Json.parse(e)),this.responseJson=e,this.constructor[this.__id]=void 0,this.__deleteCustomCallback())},setCallbackParam:function(e){return this.__callbackParam=e,this},setCallbackName:function(e){return this.__callbackName=e,this},setPrefix:function(e){this.__prefix=e},getGeneratedUrl:function(){return this.__generatedUrl},dispose:function(){this.__deleteCustomCallback(),this.__callBase("dispose")},_onNativeLoad:function(){this.status=this.__callbackCalled?200:500,this.__callBase("_onNativeLoad")},__deleteCustomCallback:function(){this.__customCallbackCreated&&window[this.__callbackName]&&(window[this.__callbackName]=void 0,this.__customCallbackCreated=!1)},__callBase:function(e,t){qx.bom.request.Script.prototype[e].apply(this,t||[])},__generateId:function(){this.__id="qx"+(new Date).valueOf()+(""+Math.random()).substring(2,5)}}}),qx.Class.define("wialon.core.Uploader",{extend:qx.core.Object,type:"singleton",members:{__fileUploadedEvent:null,__filesHash:{},__uploadMaxSize:67108864,uploadFiles:function(e,t,n,r,i,a){if(this.__uploadMaxSize=wialon.core.Session.getInstance().getEnv("max_http_buff")||this.__uploadMaxSize,r=wialon.util.Helper.wrapCallback(r),!(e instanceof Array))return r(4);var s,o=(new Date).getTime(),l="jUploadForm"+o,c="jUploadFrame"+o,u=wialon.core.Session.getInstance(),d=u.getBaseUrl()+u.getApiPath()+"?svc="+t+"&sid="+u.getId(),p=document.createElement("form");n||(n={}),n.eventHash=l,(s=document.createElement("input")).name="params",s.type="hidden",s.value=wialon.util.Json.stringify(n).replace(/&lt;/g,"<").replace(/&gt;/g,">"),p.appendChild(s),(s=document.createElement("input")).name="eventHash",s.type="hidden",s.value=l,p.appendChild(s);var g=document.createElement("iframe");p.setAttribute("action",d),p.setAttribute("method","POST"),p.setAttribute("name",l),p.setAttribute("id",l),p.setAttribute("enctype","multipart/form-data"),p.style.display="none";for(var h=0,m=0;m<e.length;m++){var f=e[m],_=document.getElementById(f.id),v=0;if(_&&"object"==typeof _.files&&_.files.length){var x=_.files[0];v=void 0!==x.fileSize?x.fileSize:void 0!==x.size?x.size:0}f.parentNode.insertBefore(f.cloneNode(!0),f),f.setAttribute("id",""),p.appendChild(f),h+=v}document.body.appendChild(p),g.setAttribute("id",c),g.setAttribute("name",c),g.style.display="none",document.body.appendChild(g);var b=qx.lang.Function.bind(this.__uploadCallback,this,{callback:r,io:g,form:p,phase:0});if(!(h>this.__uploadMaxSize)){if(i?(this.__fileUploadedEvent||(this.__fileUploadedEvent=u.addListener("fileUploaded",this.__onFileUploaded,this)),this.__filesHash[l]=b):window.attachEvent?g.attachEvent("onload",b):g.addEventListener("load",b,!1),p.setAttribute("target",c),p.submit(),a&&i){var w=qx.lang.Function.bind(function(){"function"==typeof this.__filesHash[l]&&this.__filesHash[l]()},this);setTimeout(w,1e3*a)}return!0}b()},__uploadCallback:function(e,t){e.io.parentNode.removeChild(e.io),e.form.parentNode.removeChild(e.form),e.io=null,e.form=null,t&&"object"==typeof t.result?e.callback(t.result.svc_error,t.result.svc_result):e.callback(t?0:6,t&&"function"==typeof t.preventDefault?null:t)},__onFileUploaded:function(e){var t=e.getData();if(t&&void 0!==t.hash){var n=this.__filesHash[t.hash];n&&(n(t),delete this.__filesHash[t.hash])}}}}),qx.Class.define("wialon.item.User",{extend:wialon.item.Item,properties:{userFlags:{init:null,check:"Integer",event:"changeUserFlags"},hostsMask:{init:null,check:"String",event:"changeHostsMask"},loginDate:{init:null,check:"Integer",event:"changeLoginDate"},authParams:{init:null,check:"Object",nullable:!0,event:"changeAuthParams"}},members:{getItemsAccess:function(e,t){var n={};return e&&"object"==typeof e?n=e:arguments.length>2&&(n.flags=0,n.directAccess=arguments[0],n.itemSuperclass=arguments[1],t=arguments[2]),wialon.core.Remote.getInstance().remoteCall("user/get_items_access",{userId:this.getId(),directAccess:n.directAccess,itemSuperclass:n.itemSuperclass,flags:n.flags},wialon.util.Helper.wrapCallback(t))},updateItemAccess:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("user/update_item_access",{userId:this.getId(),itemId:e.getId(),accessMask:t},wialon.util.Helper.wrapCallback(n))},updateUserFlags:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("user/update_user_flags",{userId:this.getId(),flags:e,flagsMask:t},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(n)))},updateHostsMask:function(e,t){return wialon.core.Remote.getInstance().remoteCall("user/update_hosts_mask",{userId:this.getId(),hostsMask:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},getLocale:function(e){return wialon.core.Remote.getInstance().remoteCall("user/get_locale",{userId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateLocale:function(e,t){return wialon.core.Remote.getInstance().remoteCall("user/update_locale",{userId:this.getId(),locale:e},wialon.util.Helper.wrapCallback(t))},updatePassword:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("user/update_password",{userId:this.getId(),oldPassword:e,newPassword:t},wialon.util.Helper.wrapCallback(n))},sendPushMessage:function(e,t,n,r,i){return wialon.core.Remote.getInstance().remoteCall("user/send_push_message",{userId:this.getId(),appName:e,message:t,ttl:r,params:n},wialon.util.Helper.wrapCallback(i))},verifyAuth:function(e,t){var n={userId:this.getId(),type:e.type,destination:e.destination};return wialon.core.Remote.getInstance().remoteCall("user/verify_auth",n,wialon.util.Helper.wrapCallback(t))},updateAuthParams:function(e,t){var n={userId:this.getId(),type:e.type};return e.phone&&(n.phone=e.phone),wialon.core.Remote.getInstance().remoteCall("user/update_auth_params",n,wialon.util.Helper.wrapCallback(t))}},statics:{dataFlag:{flags:256,notifications:512,connSettings:1024,mobileApps:2048},accessFlag:{setItemsAccess:1048576,operateAs:2097152,editUserFlags:4194304},authParamsType:{email:1,sms:2},defaultDataFlags:function(){return wialon.item.Item.dataFlag.base|wialon.item.Item.dataFlag.customProps|wialon.item.Item.dataFlag.billingProps|wialon.item.User.dataFlag.flags},userFlag:{isDisabled:1,cantChangePassword:2,canCreateItems:4,isReadonly:16,canSendSMS:32},accessDataFlag:{combined:1,direct:2},logMessageAction:{userCreated:"create_user",userUpdatedHostsMask:"update_hosts_mask",userUpdatedPassword:"update_user_pass",userUpdatedFlags:"update_user_flags",userCreatedNotification:"create_user_notify",userDeletedNotification:"delete_user_notify"},registerProperties:function(){var e=wialon.core.Session.getInstance();e.registerConstructor("user",wialon.item.User),e.registerProperty("fl",this.remoteUpdateUserFlags),e.registerProperty("hm",this.remoteUpdateHostsMask),e.registerProperty("ld",this.remoteUpdateLoginDate),e.registerProperty("acl",this.remoteUpdateAcl),e.registerProperty("ap",this.remoteUpdateAuthParams)},remoteUpdateUserFlags:function(e,t){e.setUserFlags(t)},remoteUpdateAcl:function(e,t){this.fireDataEvent("userAccessChanged",arguments)},remoteUpdateHostsMask:function(e,t){e.setHostsMask(t)},remoteUpdateLoginDate:function(e,t){e.setLoginDate(t)},remoteUpdateAuthParams:function(e,t){e.setAuthParams(t)}},events:{changeUserFlags:"qx.event.type.Data",changeHostsMask:"qx.event.type.Data",changeLoginDate:"qx.event.type.Data",userAccessChanged:"qx.event.type.Data",changeAuthParams:"qx.event.type.Data"}}),qx.Class.define("wialon.item.Unit",{extend:wialon.item.Item,properties:{uniqueId:{init:null,check:"String",event:"changeUniqueId"},uniqueId2:{init:null,check:"String",event:"changeUniqueId2"},deviceTypeId:{init:null,check:"Integer",event:"changeDeviceTypeId"},phoneNumber:{init:null,check:"String",event:"changePhoneNumber"},phoneNumber2:{init:null,check:"String",event:"changePhoneNumber2"},accessPassword:{init:null,check:"String",event:"changeAccessPassword"},commands:{init:null,check:"Array",event:"changeCommands"},position:{init:null,check:"Object",event:"changePosition",nullable:!0},lastMessage:{init:null,check:"Object",event:"changeLastMessage",nullable:!0},prevMessage:{init:null,check:"Object",nullable:!0},driverCode:{init:null,check:"String",event:"changeDriverCode"},calcFlags:{init:null,check:"Integer",event:"changeCalcFlags"},mileageCounter:{init:null,check:"Integer",event:"changeMileageCounter"},engineHoursCounter:{init:null,check:"Float",event:"changeEngineHoursCounter"},trafficCounter:{init:null,check:"Integer",event:"changeTrafficCounter"},messageParams:{init:null,check:"Object",event:"changeMessageParams",nullable:!0},netConn:{init:0,check:"Integer",event:"changeNetConn"},activity:{init:1,check:"Integer",event:"changeActive"},deactivationTime:{init:0,check:"Integer",event:"changeDeactivationTime"}},members:{remoteCommand:function(e,t,n,r,i,a){return i&&"function"==typeof i&&(a=i,i=0),wialon.core.Remote.getInstance().remoteCall("unit/exec_cmd",{itemId:this.getId(),commandName:e,linkType:t,param:n,timeout:r,flags:i},wialon.util.Helper.wrapCallback(a))},remoteCommandDefinitions:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/get_command_definition_data",{itemId:this.getId(),col:e.commands},wialon.util.Helper.wrapCallback(t))},updateDeviceSettings:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("unit/update_device_type",{itemId:this.getId(),deviceTypeId:e,uniqueId:t},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(n)))},updateUniqueId2:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_unique_id2",{itemId:this.getId(),uniqueId2:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},updatePhoneNumber:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_phone",{itemId:this.getId(),phoneNumber:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},updatePhoneNumber2:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_phone2",{itemId:this.getId(),phoneNumber:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},updateAccessPassword:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_access_password",{itemId:this.getId(),accessPassword:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},updateMileageCounter:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_mileage_counter",{itemId:this.getId(),newValue:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},updateEngineHoursCounter:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_eh_counter",{itemId:this.getId(),newValue:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},updateTrafficCounter:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("unit/update_traffic_counter",{itemId:this.getId(),newValue:e,regReset:t||0},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(n)))},updateCalcFlags:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_calc_flags",{itemId:this.getId(),newValue:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},updateActive:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/set_active",{itemId:this.getId(),active:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},setActive:function(e){this.updateActivity(e)},getActive:function(){var e=this.getActivity();return null===e?1:e},changeAccount:function(e,t){return wialon.core.Remote.getInstance().remoteCall("account/change_account",{itemId:this.getId(),resourceId:e.resourceId},wialon.util.Helper.wrapCallback(t))},handleMessage:function(e){if(e&&"ud"==e.tp){var t=this.getLastMessage(),n=this.getPosition(),r=e.f&wialon.item.Unit.dataMessageFlag.lbsFlag,i=0;if(n&&(i=n.f&wialon.item.Unit.dataMessageFlag.lbsFlag),!t||t.t<e.t)if(t){var a=qx.lang.Object.clone(e);e.p&&(a.p=qx.lang.Object.clone(e.p)),"v1311"==wialon.core.Session.getInstance().getVersion()&&(qx.lang.Object.mergeWith(a,t,0),t.p&&qx.lang.Object.mergeWith(a.p,t.p,0)),a.pos&&(!n||!r||n.lc!=e.lc&&(i||e.t-n.t>=300))||(a.pos=qx.lang.Object.clone(n)),this.setLastMessage(a),this.setPrevMessage(t)}else this.setLastMessage(e),this.setPrevMessage(t);if(e.pos&&(!n||!n.t||n.t<e.t)&&(!n||!r||!n.t||n.lc!=e.lc&&(i||e.t-n.t>=300))){var s=qx.lang.Object.clone(e.pos);s.t=e.t,s.f=e.f,s.lc=e.lc,wialon.item.Unit.__validatePosition(this,s),this.setPosition(s)}}this.base(arguments,e)},getMessageImageUrl:function(e,t,n){return n||(n=""),wialon.core.Session.getInstance().getBaseUrl()+"/adfurl"+n+"/avl_msg_photo.jpeg?sid="+wialon.core.Session.getInstance().getId()+"&time="+e+"&unitIndex="+this.getId()+"&msgIndex="+t},downloadHwParamFile:function(e,t,n){var r=wialon.core.Session.getInstance();return r.getBaseUrl()+r.getApiPath()+"?sid="+r.getId()+"&svc=unit/update_hw_params&params="+qx.lang.Json.stringify({itemId:this.getId(),hwId:e,fileId:t,action:"download_file"})},updateHwParams:function(e,t,n,r){if(!n||!n.length||void 0===t.full_data||t.full_data)return wialon.core.Remote.getInstance().remoteCall("unit/update_hw_params",{itemId:this.getId(),hwId:e,params_data:t,action:"set"},wialon.util.Helper.wrapCallback(r));wialon.core.Uploader.getInstance().uploadFiles(n,"unit/update_hw_params",{itemId:this.getId(),hwId:e,params_data:t,action:"set"},wialon.util.Helper.wrapCallback(r),!0,3e4)},getDriverActivitySettings:function(e){return wialon.core.Remote.getInstance().remoteCall("unit/get_activity_settings",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateDriverActivitySettings:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_activity_settings",{itemId:this.getId(),type:e},wialon.util.Helper.wrapCallback(t))}},statics:{dataFlag:{restricted:256,commands:512,lastMessage:1024,driverCode:2048,sensors:4096,counters:8192,routeControl:16384,maintenance:32768,log:65536,reportSettings:131072,other:262144,commandAliases:524288,messageParams:1048576,netConn:2097152,lastPosition:4194304},accessFlag:{editDevice:1048576,viewDevice:67108864,editSensors:2097152,editCounters:4194304,deleteMessages:8388608,executeCommands:16777216,registerEvents:33554432,viewServiceIntervals:268435456,editServiceIntervals:536870912,importMessages:1073741824,exportMessages:2147483648,viewCmdAliases:17179869184,editCmdAliases:34359738368,editReportSettings:274877906944,monitorState:549755813888},calcFlag:{mileageMask:15,mileageGps:0,mileageAbsOdometer:1,mileageRelOdometer:2,mileageGpsIgn:3,engineHoursMask:240,engineHoursIgn:16,engineHoursAbs:32,engineHoursRel:64,mileageAuto:256,engineHoursAuto:512,trafficAuto:1024},dataMessageFlag:{position:1,inputs:2,outputs:4,alarm:16,driverCode:32,imported:64,lbsFlag:131072},eventMessageFlag:{typeMask:15,typeSimple:0,typeViolation:1,typeMaintenance:2,typeRouteControl:4,typeDrivingInfo:8,maintenanceMask:0,maintenanceService:16,maintenanceFilling:32},execCmdFlag:{primaryPhone:1,secondaryPhone:2,paramFsLink:4,paramTempFile:8,paramJson:16},logMessageAction:{unitCreated:"create_unit",unitUpdatedPassword:"update_unit_pass",unitUpdatedPhone:"update_unit_phone",unitUpdatedPhone2:"update_unit_phone2",unitUpdatedCalcFlags:"update_unit_calcflags",unitChangeMilageCounter:"update_unit_milcounter",unitChangeByteCounter:"update_unit_bytecounter",unitChangeEngineHoursCounter:"update_unit_ehcounter",unitUpdatedUniqueId:"update_unit_uid",unitUpdatedUniqueId2:"update_unit_uid2",unitUpdatedHwType:"update_unit_hw",unitUpdatedHwConfig:"update_unit_hw_config",unitUpdatedFuelConsumptionSettings:"update_unit_fuel_cfg",unitUpdatedTripDetectorSettings:"update_unit_trip_cfg",unitCreatedSensor:"create_sensor",unitUpdatedSensor:"update_sensor",unitDeletedSensor:"delete_sensor",unitCreatedCommandAlias:"create_alias",unitUpdatedCommandAlias:"update_alias",unitDeletedCommandAlias:"delete_alias",unitCreatedServiceInterval:"create_service_interval",unitUpdatedServiceInterval:"update_service_interval",unitDeletedServiceInterval:"delete_service_interval",unitSettingsImported:"import_unit_cfg",unitMessagesImported:"import_unit_msgs",unitMessageDeleted:"delete_unit_msg",unitMessagesDeleted:"delete_unit_msgs",unitDriverBinded:"bind_unit_driver",unitDriverUnbinded:"unbind_unit_driver",unitTrailerBinded:"bind_unit_trailer",unitTrailerUnbinded:"unbind_unit_trailer",unitReportSettingsUpdated:"update_unit_report_cfg",unitMessagesFilterSettingsUpdated:"update_msgs_filter_cfg"},driverActivitySource:{none:0,trips:1,tachograph:2},registerProperties:function(){var e=wialon.core.Session.getInstance();e.registerConstructor("avl_unit",wialon.item.Unit),e.registerProperty("uid",this.remoteUpdateUniqueId),e.registerProperty("uid2",this.remoteUpdateUniqueId2),e.registerProperty("hw",this.remoteUpdateDeviceTypeId),e.registerProperty("ph",this.remoteUpdatePhoneNumber),e.registerProperty("ph2",this.remoteUpdatePhoneNumber2),e.registerProperty("psw",this.remoteUpdateAccessPassword),e.registerProperty("cmds",this.remoteUpdateCommands),e.registerProperty("pos",this.remoteUpdatePosition),e.registerProperty("lmsg",this.remoteUpdateLastMessage),e.registerProperty("drv",this.remoteUpdateDriverCode),e.registerProperty("cfl",this.remoteUpdateCalcFlags),e.registerProperty("cnm",this.remoteUpdateMileageCounter),e.registerProperty("cneh",this.remoteUpdateEngineHoursCounter),e.registerProperty("cnkb",this.remoteUpdateTrafficCounter),e.registerProperty("prms",this.remoteUpdateMessageParams),e.registerProperty("netconn",this.remoteUpdateNetConn),e.registerProperty("act",this.remoteUpdateActive),e.registerProperty("dactt",this.remoteUpdateDeactivationTime),wialon.item.MIcon.registerIconProperties()},remoteUpdateUniqueId:function(e,t){e.setUniqueId(t)},remoteUpdateUniqueId2:function(e,t){e.setUniqueId2(t)},remoteUpdateDeviceTypeId:function(e,t){e.setDeviceTypeId(t)},remoteUpdatePhoneNumber:function(e,t){e.setPhoneNumber(t)},remoteUpdatePhoneNumber2:function(e,t){e.setPhoneNumber2(t)},remoteUpdateAccessPassword:function(e,t){e.setAccessPassword(t)},remoteUpdateCommands:function(e,t){e.setCommands(t)},remoteUpdatePosition:function(e,t){var n=wialon.core.Session.getInstance().getLogger();n&&"function"==typeof n.warn&&(e.getPosition()&&!t?n.warn({type:"position_deletion",unit:e}):wialon.item.Unit.__validatePosition(e,t)),e.setPosition(t)},remoteUpdateLastMessage:function(e,t){e.setLastMessage(t)},remoteUpdateDriverCode:function(e,t){e.setDriverCode(t)},remoteUpdateCalcFlags:function(e,t){e.setCalcFlags(t)},remoteUpdateMileageCounter:function(e,t){e.setMileageCounter(t)},remoteUpdateEngineHoursCounter:function(e,t){e.setEngineHoursCounter(t)},remoteUpdateTrafficCounter:function(e,t){e.setTrafficCounter(t)},remoteUpdateMessageParams:function(e,t){if("object"==typeof t){var n=e.getMessageParams();for(var r in n=n?qx.lang.Object.clone(n):{},t)if("object"==typeof t[r]&&"object"==typeof n[r]&&t[r].ct>n[r].ct){var i=n[r].at;n[r]=t[r],i>t[r].at&&(n[r].at=i)}else"object"==typeof t[r]&&void 0===n[r]?n[r]=t[r]:"object"==typeof n[r]&&"number"==typeof t[r]&&t[r]>n[r].at&&(n[r].at=t[r]);e.setMessageParams(n)}},remoteUpdateNetConn:function(e,t){e.setNetConn(t)},remoteUpdateActive:function(e,t){e.setActivity(t)},remoteUpdateDeactivationTime:function(e,t){e.setDeactivationTime(t)},checkHwConfig:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_hw_params",{hwId:e,action:"check_config"},wialon.util.Helper.wrapCallback(t))},getHwParams:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("unit/update_hw_params",{itemId:e,hwId:t,fullData:n?1:0,action:"get"},wialon.util.Helper.wrapCallback(r))},__validatePosition:function(e,t){if(t){var n=wialon.core.Session.getInstance().getLogger();if(n&&"function"==typeof n.warn){var r="number"==typeof t.x&&"number"==typeof t.y;r&&((r=-90<=t.y&&t.y<=90)||n.warn({type:"position_validation",unit:e,pos:t}))}}}},events:{changeUniqueId:"qx.event.type.Data",changeUniqueId2:"qx.event.type.Data",changeDeviceTypeId:"qx.event.type.Data",changePhoneNumber:"qx.event.type.Data",changePhoneNumber2:"qx.event.type.Data",changeAccessPassword:"qx.event.type.Data",changeCommands:"qx.event.type.Data",changePosition:"qx.event.type.Data",changeLastMessage:"qx.event.type.Data",changeDriverCode:"qx.event.type.Data",changeCalcFlags:"qx.event.type.Data",changeMileageCounter:"qx.event.type.Data",changeEngineHoursCounter:"qx.event.type.Data",changeTrafficCounter:"qx.event.type.Data",changeMessageParams:"qx.event.type.Data",changeNetConn:"qx.event.type.Data",changeActive:"qx.event.type.Data",changeDeactivationTime:"qx.event.type.Data"}}),qx.Mixin.define("wialon.item.MIcon",{properties:{iconCookie:{init:null,check:"Integer",event:"changeIcon"},iconUri:{init:null,check:"String",event:"changeIconUri"}},members:{getIconUrl:function(e){void 0!==e&&e||(e=32);var t=this.getIconUri(),n=wialon.core.Session.getInstance();return t?n.getBaseUrl()+t+"?b="+e+"&v=1&sid="+n.getId():n.getBaseUrl()+"/avl_item_image/"+this.getId()+"/"+e+"/"+this.getIconCookie()+".png?sid="+n.getId()},updateIcon:function(e,t){return"string"==typeof e?wialon.core.Uploader.getInstance().uploadFiles([],"unit/upload_image",{fileUrl:e,itemId:this.getId()},t,!0):"number"==typeof e?wialon.core.Remote.getInstance().remoteCall("unit/update_image",{itemId:this.getId(),oldItemId:e},t):wialon.core.Uploader.getInstance().uploadFiles([e],"unit/upload_image",{itemId:this.getId()},t,!0)},updateIconLibrary:function(e,t,n){wialon.core.Remote.getInstance().remoteCall("unit/update_image",{itemId:this.getId(),libId:e,path:t},n)},canRotate:function(){return 0!=this.getCustomProperty("img_rot")&&0==wialon.util.Number.and(this.getIconCookie(),9007194959773696)},getIconGroupId:function(){return 0!=wialon.util.Number.and(this.getIconCookie(),9007194959773696)?4294967295&this.getIconCookie():0}},statics:{registerIconProperties:function(){var e=wialon.core.Session.getInstance();e.registerProperty("ugi",this.remoteUpdateIconCookie),e.registerProperty("uri",this.remoteUpdateIconUri)},remoteUpdateIconCookie:function(e,t){e.setIconCookie(t)},remoteUpdateIconUri:function(e,t){e.setIconUri(t)}},events:{changeIcon:"qx.event.type.Data",changeIconUri:"qx.event.type.Data"}}),qx.Class.define("wialon.item.Resource",{extend:wialon.item.Item,members:{saveTachoData:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("resource/upload_tacho_file",{itemId:this.getId(),driverCode:e,guid:t,outputFlag:n},wialon.util.Helper.wrapCallback(r))},getOrdersNotification:function(e){return wialon.core.Remote.getInstance().remoteCall("resource/get_orders_notification",{resourceId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateOrdersNotification:function(e,t){return wialon.core.Remote.getInstance().remoteCall("resource/update_orders_notification",{resourceId:this.getId(),ordersNotification:e},wialon.util.Helper.wrapCallback(t))},getEmailTemplate:function(e){return wialon.core.Remote.getInstance().remoteCall("resource/get_email_template",{resourceId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateEmailTemplate:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("resource/update_email_template",{resourceId:this.getId(),subject:e,body:t,flags:n},wialon.util.Helper.wrapCallback(r))}},statics:{dataFlag:{drivers:256,jobs:512,notifications:1024,poi:2048,zones:4096,reports:8192,agro:16777216,driverUnits:16384,driverGroups:32768,trailers:65536,trailerGroups:131072,trailerUnits:262144,orders:524288,zoneGroups:1048576,tags:2097152,tagUnits:4194304,tagGroups:8388608},accessFlag:{viewNotifications:1048576,editNotifications:2097152,viewPoi:4194304,editPoi:8388608,viewZones:16777216,editZones:33554432,viewJobs:67108864,editJobs:134217728,viewReports:268435456,editReports:536870912,viewDrivers:1073741824,editDrivers:2147483648,manageAccount:4294967296,viewOrders:8589934592,editOrders:17179869184,viewTags:34359738368,editTags:68719476736,agroEditCultivations:1099511627776,agroView:2199023255552,agroEdit:4398046511104,viewTrailers:17592186044416,editTrailers:35184372088832},logMessageAction:{resourceCreated:"create_resource",resourceCreatedZone:"create_zone",resourceUpdatedZone:"update_zone",resourceDeletedZone:"delete_zone",resourceCreatedZonesGroup:"create_zones_group",resourceUpdatedZonesGroup:"update_zones_group",resourceDeletedZonesGroup:"delete_zones_group",resourceCreatedPoi:"create_poi",resourceUpdatedPoi:"update_poi",resourceDeletedPoi:"delete_poi",resourceCreatedJob:"create_job",resourceSwitchedJob:"switch_job",resourceUpdatedJob:"update_job",resourceDeletedJob:"delete_job",resourceCreatedNotification:"create_notify",resourceSwitchedNotification:"switch_notify",resourceUpdatedNotification:"update_notify",resourceDeletedNotification:"delete_notify",resourceCreatedDriver:"create_driver",resourceUpdatedDriver:"update_driver",resourceDeletedDriver:"delete_driver",resourceCreatedDriversGroup:"create_drivers_group",resourceUpdatedDriversGroup:"update_drivers_group",resourceDeletedDriversGroup:"delete_drivers_group",resourceUpdatedDriverUnits:"update_driver_units",resourceCreatedReport:"create_report",resourceUpdatedReport:"update_report",resourceDeletedReport:"delete_report",resourceImportedPois:"import_pois",resourceImportedZones:"import_zones"},remoteOptimizeFlag:{fitSchedule:1,optimizeDuration:2},jobFlags:{removeAfterLimit:1},registerProperties:function(){wialon.core.Session.getInstance().registerConstructor("avl_resource",wialon.item.Resource)}}}),qx.Class.define("wialon.item.UnitGroup",{extend:wialon.item.Item,properties:{units:{init:null,check:"Array",event:"changeUnits"}},members:{updateUnits:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit_group/update_units",{itemId:this.getId(),units:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))}},statics:{registerProperties:function(){var e=wialon.core.Session.getInstance();e.registerConstructor("avl_unit_group",wialon.item.UnitGroup),e.registerProperty("u",this.remoteUpdateUnits),wialon.item.MIcon.registerIconProperties()},logMessageAction:{unitGroupCreated:"create_group",unitGroupUnitsUpdated:"units_group"},remoteUpdateUnits:function(e,t){var n=e.getUnits();n&&wialon.util.Json.compareObjects(t,n)||e.setUnits(t)},checkUnit:function(e,t){if(!e||"avl_unit_group"!=e.getType()||!t||"avl_unit"!=t.getType())return!1;var n=e.getUnits(),r=t.getId();return-1!=n.indexOf(r)}},events:{changeUnits:"qx.event.type.Data"}}),qx.Class.define("wialon.item.Retranslator",{extend:wialon.item.Item,properties:{operating:{init:null,check:"Boolean",event:"changeOperating"},stopTime:{init:null,check:"Integer",event:"changeStopTime"},config:{init:null,check:"Object",event:"changeConfig"},units:{init:null,check:"Object",event:"changeUnits"}},members:{updateOperating:function(e,t){var n={};return e&&"object"==typeof e?n=e:n.operate=e,wialon.core.Remote.getInstance().remoteCall("retranslator/update_operating",{itemId:this.getId(),callMode:n.callMode,operate:n.operate,timeFrom:n.timeFrom,timeTo:n.timeTo},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},updateOperatingWithTimeout:function(e,t,n,r){var i;return i=n?t:wialon.core.Session.getInstance().getServerTime()+t,wialon.core.Remote.getInstance().remoteCall("retranslator/update_operating",{itemId:this.getId(),operate:e,stopTime:i},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(r)))},getStatistics:function(e){return wialon.core.Remote.getInstance().remoteCall("retranslator/get_stats",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateConfig:function(e,t){return wialon.core.Remote.getInstance().remoteCall("retranslator/update_config",{itemId:this.getId(),config:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},updateUnits:function(e,t){return wialon.core.Remote.getInstance().remoteCall("retranslator/update_units",{itemId:this.getId(),units:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))}},statics:{dataFlag:{state:256,units:512},accessFlag:{editSettings:1048576,editUnits:2097152},logMessageAction:{retranslatorCreated:"create_retranslator",retranslatorUpdated:"update_retranslator",retranslatorUnitsUpdated:"units_retranslator",retranslatorSwitched:"switch_retranslator"},registerProperties:function(){var e=wialon.core.Session.getInstance();e.registerConstructor("avl_retranslator",wialon.item.Retranslator),e.registerProperty("rtro",this.remoteUpdateOperating),e.registerProperty("rtrst",this.remoteUpdateStopTime),e.registerProperty("rtrc",this.remoteUpdateConfig),e.registerProperty("rtru",this.remoteUpdateUnits)},remoteUpdateOperating:function(e,t){e.setOperating(!!t)},remoteUpdateStopTime:function(e,t){e.setStopTime(t)},remoteUpdateConfig:function(e,t){e.setConfig(t||{})},remoteUpdateUnits:function(e,t){var n=e.getUnits();n&&wialon.util.Json.compareObjects(t,n)||e.setUnits(t)},getRetranslatorTypes:function(e){return wialon.core.Remote.getInstance().remoteCall("retranslator/list",{},wialon.util.Helper.wrapCallback(e))}},events:{changeOperating:"qx.event.type.Data",changeStopTime:"qx.event.type.Data",changeConfig:"qx.event.type.Data",changeUnits:"qx.event.type.Data"}}),qx.Class.define("wialon.item.Route",{extend:wialon.item.Item,properties:{config:{init:null,check:"Object",nullable:!0,event:"changeConfig"},checkPoints:{init:null,check:"Array",event:"changeCheckPoints"}},members:{updateConfig:function(e,t){return wialon.core.Remote.getInstance().remoteCall("route/update_config",{itemId:this.getId(),config:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},getNextRoundTime:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("route/get_schedule_time",{itemId:this.getId(),scheduleId:e,timeFrom:t,timeTo:n},wialon.util.Helper.wrapCallback(r))},loadRoundsHistory:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("route/load_rounds",{itemId:this.getId(),timeFrom:e,timeTo:t,fullJson:n},wialon.util.Helper.wrapCallback(r))},updateCheckPoints:function(e,t){return wialon.core.Remote.getInstance().remoteCall("route/update_checkpoints",{itemId:this.getId(),checkPoints:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},getRouteRounds:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("route/get_all_rounds",{itemId:this.getId(),timeFrom:e,timeTo:t,fullJson:n},wialon.util.Helper.wrapCallback(r))}},statics:{dataFlag:{config:256,checkPoints:512,schedules:1024,rounds:2048},accessFlag:{editSettings:1048576},states:{stateInactive:65536,stateFinshed:131072,stateCheckingArrive:262144,stateCheckingDeparture:524288,stateTimeLate:2097152,stateTimeEarly:4194304,stateDisabled:8388608,stateAborted:1048576,eventControlStarted:1,eventControlFinished:2,eventControlAborted:4,eventPointArrived:8,eventPointSkipped:16,eventPointDepartured:32,eventControlLate:64,eventControlEarly:128,eventControlInTime:256},routePointFlag:{simple:1,geozone:2,unit:4},scheduleFlag:{relative:1,relativeDaily:2,absolute:4},roundFlag:{autoDelete:2,allowSkipPoints:16,generateEvents:32,arbituaryPoints:64},logMessageAction:{routeCreated:"create_route",routeUpdatedPoints:"update_route_points",routeUpdatedConfiguration:"update_route_cfg",routeCreatedRound:"create_round",routeUpdatedRound:"update_round",routeDeletedRound:"delete_round",routeCreatedSchedule:"create_schedule",routeUpdatedSchedule:"update_schedule",routeDeletedSchedule:"delete_schedule"},registerProperties:function(){var e=wialon.core.Session.getInstance();e.registerConstructor("avl_route",wialon.item.Route),e.registerProperty("rpts",this.remoteUpdateCheckPoints),e.registerProperty("rcfg",this.remoteUpdateConfig)},remoteUpdateCheckPoints:function(e,t){e.setCheckPoints(t)},remoteUpdateConfig:function(e,t){e.setConfig(t)}},events:{changeCheckPoints:"qx.event.type.Data",changeConfig:"qx.event.type.Data"}}),qx.Class.define("wialon.render.Renderer",{extend:qx.core.Object,construct:function(){this.base(arguments),this.__layers=new Array},properties:{version:{init:0,check:"Integer",event:"changeVersion"},reportResult:{init:null,check:"Object",nullable:!0,apply:"__applyReportResult"}},members:{__layers:null,__sessionStartTime:Date.now(),getLayers:function(){return this.__layers},getReportLayer:function(){for(var e=0;e<this.__layers.length;e++)if("report"==this.__layers[e].getName().substr(0,6))return this.__layers[e];return null},getTileUrl:function(e,t,n){return wialon.core.Session.getInstance().getBaseUrl()+"/adfurl"+this.__sessionStartTime+"_"+this.getVersion()+"/avl_render/"+e+"_"+t+"_"+(17-n)+"/"+wialon.core.Session.getInstance().getId()+".png"},setLocale:function(e,t,n,r){var i=0,a="";return n&&"function"==typeof n?r=n:n&&"number"==typeof n?i=n:n&&"object"==typeof n&&(i=n.flags,a=n.formatDate),wialon.core.Remote.getInstance().remoteCall("render/set_locale",{tzOffset:e,language:t,flags:i,formatDate:a},wialon.util.Helper.wrapCallback(r))},createMessagesLayer:function(e,t){return wialon.core.Remote.getInstance().remoteCall("render/create_messages_layer",e,qx.lang.Function.bind(this.__onCreatedMessagesLayer,this,wialon.util.Helper.wrapCallback(t)))},createPoiLayer:function(e,t,n,r){for(var i=this.__layers.length-1;i>=0;i--)this.__layers[i].getName()==e&&(this.__layers[i].dispose(),qx.lang.Array.remove(this.__layers,this.__layers[i]));return wialon.core.Remote.getInstance().remoteCall("render/create_poi_layer",{layerName:e,pois:t,flags:n},qx.lang.Function.bind(this.__onCreatedSimpleLayer,this,wialon.util.Helper.wrapCallback(r)))},createZonesLayer:function(e,t,n,r){for(var i=this.__layers.length-1;i>=0;i--)this.__layers[i].getName()==e&&(this.__layers[i].dispose(),qx.lang.Array.remove(this.__layers,this.__layers[i]));return wialon.core.Remote.getInstance().remoteCall("render/create_zones_layer",{layerName:e,zones:t,flags:n},qx.lang.Function.bind(this.__onCreatedSimpleLayer,this,wialon.util.Helper.wrapCallback(r)))},removeLayer:function(e,t){return wialon.core.Remote.getInstance().remoteCall("render/remove_layer",{layerName:e.getName()},qx.lang.Function.bind(this.__onRemovedLayer,this,wialon.util.Helper.wrapCallback(t),e))},enableLayer:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("render/enable_layer",{layerName:e.getName(),enable:t?1:0},qx.lang.Function.bind(this.__onLayerEnabled,this,wialon.util.Helper.wrapCallback(n),e))},removeAllLayers:function(e){return wialon.core.Remote.getInstance().remoteCall("render/remove_all_layers",{},qx.lang.Function.bind(this.__onAllLayersRemoved,this,wialon.util.Helper.wrapCallback(e)))},hitTest:function(e,t,n,r,i,a,s){var o=0;"function"==typeof a?s=a:"number"==typeof a&&(o=a),wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseUrl()+"/avl_hittest_pos",{sid:wialon.core.Session.getInstance().getId(),lat:e,flags:o,lon:t,scale:n,radius:r,layerName:""+i},wialon.util.Helper.wrapCallback(s),60)},createZoneByTrack:function(e,t){return wialon.core.Remote.getInstance().remoteCall("resource/create_zone_by_track",e,wialon.util.Helper.wrapCallback(t))},__onCreatedMessagesLayer:function(e,t,n){var r=null;0==t&&n&&(void 0!==n.name&&(r=new wialon.render.MessagesLayer(n),this.__layers.push(r)),this.setVersion(this.getVersion()+1)),e(t,r)},__onCreatedSimpleLayer:function(e,t,n){var r=null;0==t&&n&&(void 0!==n.name&&(r=new wialon.render.Layer(n),this.__layers.push(r)),this.setVersion(this.getVersion()+1)),e(t,r)},__onRemovedLayer:function(e,t,n,r){n?e(n):(qx.lang.Array.remove(this.__layers,t),t.dispose(),this.setVersion(this.getVersion()+1),e(n))},__onAllLayersRemoved:function(e,t,n){if(t)e(t);else{if(this.__layers.length){for(var r=0;r<this.__layers.length;r++)this.__layers[r].dispose();qx.lang.Array.removeAll(this.__layers),this.setVersion(this.getVersion()+1)}e(t)}},__onLayerEnabled:function(e,t,n,r){if(n)e(n);else{var i=!!r.enabled;i!=t.getEnabled()&&(t.setEnabled(i),this.setVersion(this.getVersion()+1)),e(n)}},__applyReportResult:function(e){for(var t=!1,n=0;n<this.__layers.length;n++)if("report"==this.__layers[n].getName().substr(0,6)){this.__layers.splice(n,1),t=!0;break}if(e){var r=e.getLayerData();if(r){var i=r.units?new wialon.render.MessagesLayer(r):new wialon.render.Layer(r);this.__layers.push(i),e.setLayer(i),t=!0}}t&&this.setVersion(this.getVersion()+1)}},statics:{PoiFlag:{renderLabels:1,enableGroups:2},Hittest:{full:1,markersLayer:16,msgsLayer:32,shapesLayer:64},ZonesFlag:{renderLabels:1},MarkerFlag:{grouping:1,numbering:2,events:4,fillings:8,images:16,parkings:32,speedings:64,stops:128,thefts:256,usUnits:512,imUnits:1024,videos:2048,latUnits:4096},OptionalFlag:{usMetrics:1,imMetrics:2,latMetrics:3,skipBlankTiles:256,zoomGoogle:512}},destruct:function(){this._disposeArray("__layers")},events:{changeVersion:"qx.event.type.Event"}}),qx.Class.define("wialon.render.Layer",{extend:qx.core.Object,construct:function(e){this.base(arguments,e),this._data=e},properties:{enabled:{init:!0,check:"Boolean"}},members:{_data:null,getName:function(){return this._data.name},getBounds:function(){return this._data.bounds}}}),qx.Class.define("wialon.render.MessagesLayer",{extend:wialon.render.Layer,members:{getUnitsCount:function(){return this._data.units?this._data.units.length:0},getUnitId:function(e){return"number"!=typeof e?this._data.units[0].id:this._data.units[e>=0?e:0].id},getMaxSpeed:function(e){return"number"!=typeof e?this._data.units[0].max_speed:this._data.units[e>=0?e:0].max_speed},getMileage:function(e){return"number"!=typeof e?this._data.units[0].mileage:this._data.units[e>=0?e:0].mileage},getMessagesCount:function(e){return"number"!=typeof e?this._data.units[0].msgs.count:this._data.units[e>=0?e:0].msgs.count},getFirstPoint:function(e){return"number"!=typeof e?this._data.units[0].msgs.first:this._data.units[e>=0?e:0].msgs.first},getLastPoint:function(e){return"number"!=typeof e?this._data.units[0].msgs.last:this._data.units[e>=0?e:0].msgs.last},getMessageImageUrl:function(e,t,n){return n||(n=""),wialon.core.Session.getInstance().getBaseUrl()+"/adfurl"+n+"/avl_msg_photo.jpeg?sid="+wialon.core.Session.getInstance().getId()+"&layerName="+this.getName()+"&unitIndex="+e+"&msgIndex="+t},getMessages:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("render/get_messages",{layerName:this.getName(),indexFrom:t,indexTo:n,unitId:this.getUnitId(e)},wialon.util.Helper.wrapCallback(r))},deleteMessage:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("render/delete_message",{layerName:this.getName(),msgIndex:t,unitId:this.getUnitId(e)},wialon.util.Helper.wrapCallback(n))},hitTest:function(e,t){var n={};e&&"object"==typeof e?n=e:arguments.length>2&&(n.unitId=arguments[0],n.time=arguments[1],n.revert=arguments[2],t=arguments[arguments.length-1]),n.sid=wialon.core.Session.getInstance().getId(),n.layerName=this.getName(),wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseUrl()+"/avl_hittest_time",{sid:n.sid,layerName:n.layerName,unitId:n.unitId,time:n.time,revert:n.revert,anyMsg:n.anyMsg},wialon.util.Helper.wrapCallback(t),60)}},statics:{}}),qx.Class.define("wialon.core.MessagesLoader",{extend:qx.core.Object,members:{loadInterval:function(e,t,n,r,i,a,s){return wialon.core.Remote.getInstance().remoteCall("messages/load_interval",{itemId:e,timeFrom:t,timeTo:n,flags:r,flagsMask:i,loadCount:a},wialon.util.Helper.wrapCallback(s))},loadLast:function(e,t,n,r,i,a,s){return wialon.core.Remote.getInstance().remoteCall("messages/load_last",{itemId:e,lastTime:t,lastCount:n,flags:r,flagsMask:i,loadCount:a},wialon.util.Helper.wrapCallback(s))},unload:function(e){return wialon.core.Remote.getInstance().remoteCall("messages/unload",{},wialon.util.Helper.wrapCallback(e))},getMessages:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("messages/get_messages",{indexFrom:e,indexTo:t},wialon.util.Helper.wrapCallback(n))},getMessageFile:function(e,t){var n=wialon.core.Session.getInstance();return n.getBaseUrl()+n.getApiPath()+"?sid="+n.getId()+"&svc=messages/get_message_file&params="+encodeURIComponent(wialon.util.Json.stringify({msgIndex:e,fileName:t}))},deleteMessage:function(e,t){return wialon.core.Remote.getInstance().remoteCall("messages/delete_message",{msgIndex:e},wialon.util.Helper.wrapCallback(t))},getPackedMessages:function(e,t,n,r,i){return wialon.core.Remote.getInstance().remoteCall("messages/get_packed_messages",{itemId:e,timeFrom:t,timeTo:n,filtrationFlags:r},wialon.util.Helper.wrapCallback(i))}},statics:{packedFiltration:{sats:1}}}),qx.Class.define("wialon.item.PluginsManager",{type:"static",statics:{bindPropItem:function(clazz,propName,itemName,ajaxPath,extAjaxPath){var itemNameUCase=itemName.substr(0,1).toUpperCase()+itemName.substr(1),multName=itemNameUCase+"s",mixinBody={members:{},properties:{},statics:{},events:{}};mixinBody.events["update"+itemNameUCase]="qx.event.type.Data",mixinBody.properties[itemName+"s"]={init:null,check:"Object"},mixinBody.members["get"+itemNameUCase]=function(e){var t=this["get"+multName]();if(!t)return null;var n=t[e];return void 0===n?null:n},mixinBody.members["modify"+multName]=function(e,t,n){var r=this["get"+multName](),i=!1;e&&"object"==typeof e?(i=e.skipFlag,e=wialon.util.Helper.wrapCallback(e.callback)):e=wialon.util.Helper.wrapCallback(e);var a=null;if(0==t&&r&&n instanceof Array&&2==n.length){var s=n[0];a=n[1];var o=r[s];void 0===o&&(o=null),null!=a?r[s]=a:o&&!i&&delete r[s],i||wialon.util.Json.stringify(a)==wialon.util.Json.stringify(o)||this.fireDataEvent("update"+itemNameUCase,a,o)}e(t,a,{result:n})},ajaxPath&&ajaxPath.length&&("ProfileField"==itemNameUCase?mixinBody.members["update"+itemNameUCase]=function(e,t,n){return n=wialon.util.Helper.wrapCallback(n),wialon.core.Remote.getInstance().remoteCall(ajaxPath,{itemId:this.getId(),n:e,v:t},qx.lang.Function.bind(this["modify"+multName],this,n))}:(mixinBody.members["create"+itemNameUCase]=function(e,t,n){if(t=wialon.util.Helper.wrapCallback(t),e&&((e=qx.lang.Object.clone(e)).itemId=this.getId(),e.id=0,e.callMode="create"),!n)return wialon.core.Remote.getInstance().remoteCall(ajaxPath,e,qx.lang.Function.bind(this["modify"+multName],this,t));wialon.core.Uploader.getInstance().uploadFiles([n],ajaxPath,e,qx.lang.Function.bind(this["modify"+multName],this,t),!0,60)},mixinBody.members["update"+itemNameUCase]=function(e,t,n,r){if(t=wialon.util.Helper.wrapCallback(t),e&&((e=qx.lang.Object.clone(e)).itemId=this.getId(),e.callMode="string"==typeof n?n:"update"),!r)return wialon.core.Remote.getInstance().remoteCall(ajaxPath,e,qx.lang.Function.bind(this["modify"+multName],this,t));wialon.core.Uploader.getInstance().uploadFiles([r],ajaxPath,e,qx.lang.Function.bind(this["modify"+multName],this,t),!0,60)},mixinBody.members["delete"+itemNameUCase]=function(e,t,n){return void 0===n&&(n=!1),t=wialon.util.Helper.wrapCallback(t),wialon.core.Remote.getInstance().remoteCall(ajaxPath,{itemId:this.getId(),id:e,callMode:"delete"},qx.lang.Function.bind(this["modify"+multName],this,{callback:t,skipFlag:n}))},"Driver"!=itemNameUCase&&"Trailer"!=itemNameUCase&&"Poi"!=itemNameUCase&&"Zone"!=itemNameUCase&&"Tag"!=itemNameUCase||(mixinBody.members["resetImage"+itemNameUCase]=function(e,t,n){return void 0===n&&(n=!1),t=wialon.util.Helper.wrapCallback(t),wialon.core.Remote.getInstance().remoteCall(ajaxPath,{itemId:this.getId(),id:e,callMode:"reset_image"},qx.lang.Function.bind(this["modify"+multName],this,{callback:t,skipFlag:n}))}))),extAjaxPath&&extAjaxPath.length&&(mixinBody.members["get"+multName+"Data"]=function(e,t,n){t&&"function"==typeof t&&(n=t,t=0),n=wialon.util.Helper.wrapCallback(n);var r={itemId:this.getId()};if(e&&"number"==typeof e.length){r.col=[];for(var i=0;i<e.length;i++)void 0===e[i].id?r.col.push(e[i]):r.col.push(e[i].id)}return r.flags=t,wialon.core.Remote.getInstance().remoteCall(extAjaxPath,r,n)}),mixinBody.statics["remoteCreate"+itemNameUCase]=function(e,t){e["set"+multName](t)},mixinBody.statics["remoteUpdate"+itemNameUCase]=function(e,t){e["modify"+multName](null,0,t)};var session=wialon.core.Session.getInstance();session.registerProperty(propName,qx.lang.Function.bind(mixinBody.statics["remoteCreate"+itemNameUCase],mixinBody)),session.registerProperty(propName+"u",qx.lang.Function.bind(mixinBody.statics["remoteUpdate"+itemNameUCase],mixinBody));var mixinDef=null;if(eval("mixinDef = wialon.item.M"+multName),!qx.Class.hasMixin(clazz,mixinDef)){var propMixin=qx.Mixin.define("wialon.item.M"+multName,mixinBody);qx.Class.include(clazz,propMixin)}}}}),qx.Mixin.define("wialon.item.MUnitSensor",{members:{calculateSensorValue:function(e,t,n){return e?(void 0!==t&&t||(t=null),void 0!==n&&n||(n=null),this.__calculateSensorValueImpl(e,t,n,null)):wialon.item.MUnitSensor.invalidValue},remoteCalculateLastMessage:function(e,t){return e&&e instanceof Array||(e=[]),wialon.core.Remote.getInstance().remoteCall("unit/calc_last_message",{sensors:e,unitId:this.getId()},wialon.util.Helper.wrapCallback(t))},remoteCalculateMsgs:function(e,t,n,r,i){return wialon.core.Remote.getInstance().remoteCall("unit/calc_sensors",{source:e,unitId:this.getId(),indexFrom:t,indexTo:n,sensorId:r},wialon.util.Helper.wrapCallback(i))},remoteCalculateFilteredMsgs:function(e,t,n,r,i,a){return wialon.core.Remote.getInstance().remoteCall("unit/calc_sensors",{source:e,unitId:this.getId(),indexFrom:t,indexTo:n,sensorId:r,width:i},wialon.util.Helper.wrapCallback(a))},getValue:function(e,t){return e?this.__getValueImpl(e.p,t,e):wialon.item.MUnitSensor.invalidValue},__parsedTokens:{},__calculateSensorValueImpl:function(e,t,n,r){if(!e)return wialon.item.MUnitSensor.invalidValue;var i=e.id;if(r){if(r[i])return wialon.item.MUnitSensor.invalidValue}else r=new Object;r[i]=1;var a=this.__parseExpression(e,t,n,r);if("string"==typeof a)return a;if(a!=wialon.item.MUnitSensor.invalidValue&&(a=this.__tableCalculate(e,a)),e.vs&&e.vt){var s=this.getSensor(e.vs);if(!s)return delete r[i],wialon.item.MUnitSensor.invalidValue;var o=this.__calculateSensorValueImpl(s,t,n,r);a!=wialon.item.MUnitSensor.invalidValue&&o!=wialon.item.MUnitSensor.invalidValue?e.vt==wialon.item.MUnitSensor.validation.logicalAnd?a=a&&o?1:0:e.vt==wialon.item.MUnitSensor.validation.noneZero?o||(delete r[i],a=wialon.item.MUnitSensor.invalidValue):e.vt==wialon.item.MUnitSensor.validation.mathAnd?a=Math.ceil(o)&Math.ceil(a):e.vt==wialon.item.MUnitSensor.validation.logicalOr?(a||o)&&(a=1):e.vt==wialon.item.MUnitSensor.validation.mathOr?a=Math.ceil(o)|Math.ceil(a):e.vt==wialon.item.MUnitSensor.validation.summarize?a+=o:e.vt==wialon.item.MUnitSensor.validation.subtructValidator?a-=o:e.vt==wialon.item.MUnitSensor.validation.subtructValue?a=o-a:e.vt==wialon.item.MUnitSensor.validation.multiply?a*=o:e.vt==wialon.item.MUnitSensor.validation.divideValidator?o?a/=o:a=wialon.item.MUnitSensor.invalidValue:e.vt==wialon.item.MUnitSensor.validation.divideValue&&(a=a?o/a:wialon.item.MUnitSensor.invalidValue):e.vt==wialon.item.MUnitSensor.validation.replaceOnError?a==wialon.item.MUnitSensor.invalidValue&&(a=o):a=wialon.item.MUnitSensor.invalidValue}return delete r[i],a},__getValueImpl:function(e,t,n){if(!t)return wialon.item.MUnitSensor.invalidValue;var r=wialon.item.MUnitSensor.invalidValue,i=t.p,a=e.split(":");e=a[0];var s=0;if(i&&void 0!==i[a[0]]){if("string"==typeof(r=i[a[0]])){var o="-0123456789";void 0!==a[1]&&(8==a[1]?o="-01234567":16==a[1]&&(o="-0123456789ABCDEFabcdefx"),wialon.util.String.strspn(r,o)==r.length?(r=parseInt(r,a[1]),a=[]):r=wialon.item.MUnitSensor.invalidValue)}}else"d"==a[1]&&(s=1);if(r==wialon.item.MUnitSensor.invalidValue)if("speed"==e){if(!t.pos)return wialon.item.MUnitSensor.invalidValue;r=t.pos.s}else if("sats"==e){if(!t.pos)return wialon.item.MUnitSensor.invalidValue;r=t.pos.sc}else if("altitude"==e){if(!t.pos)return wialon.item.MUnitSensor.invalidValue;r=t.pos.z}else if("course"==e){if(!t.pos)return wialon.item.MUnitSensor.invalidValue;r=t.pos.c}else if("lat"==e){if(!t.pos)return wialon.item.MUnitSensor.invalidValue;r=t.pos.y}else if("lon"==e){if(!t.pos)return wialon.item.MUnitSensor.invalidValue;r=t.pos.x}else if(/^in\d{0,2}$/.test(e)){if(!(2&t.f))return wialon.item.MUnitSensor.invalidValue;var l=parseInt(e.substr(2),10);if(isNaN(l)||l<1||l>32)return t.i;var c=1<<l-1;r=t.i&c?1:0}else if(/^out\d{0,2}$/.test(e)){if(!(4&t.f))return wialon.item.MUnitSensor.invalidValue;if(l=parseInt(e.substr(3),10),isNaN(l)||l<1||l>32)return t.o;c=1<<l-1,r=t.o&c?1:0}else/^const-?(?:\d+(?:\.\d+)?|\.\d+)$/.test(e)?r=parseFloat(e.substr(5)):"time"===e?r=t.t:"regtime"===e&&"number"==typeof t.rt&&(r=t.rt);if(1==s&&r!=wialon.item.MUnitSensor.invalidValue){var u=new Date(1e3*r),d=Date.UTC(u.getFullYear(),0,0),p=u.getTime()-d;r=Math.floor(p/864e5)}else if(a.length>1&&r!=wialon.item.MUnitSensor.invalidValue){var g=parseInt(r,10),h=parseInt(a[1],10)-1;r=(r=h<32?g&1<<h:wialon.util.Number.and(g,Math.pow(2,h)))?1:0}return r},__tableCalculate:function(e,t){if(!e||isNaN(t))return wialon.item.MUnitSensor.invalidValue;var n=wialon.item.MUnitSensor.invalidValue,r=wialon.item.MUnitSensor.invalidValue,i=null;try{i=wialon.util.Json.parse(e.c)}catch(e){}if(i&&"number"==typeof i.lower_bound&&(n=i.lower_bound),i&&"number"==typeof i.upper_bound&&(r=i.upper_bound),n!=wialon.item.MUnitSensor.invalidValue&&r!=wialon.item.MUnitSensor.invalidValue&&r<=n&&(n=wialon.item.MUnitSensor.invalidValue,r=wialon.item.MUnitSensor.invalidValue),!(e.f&wialon.item.MUnitSensor.flags.boundsAfterCalc)&&(n!=wialon.item.MUnitSensor.invalidValue&&t<n||r!=wialon.item.MUnitSensor.invalidValue&&t>=r))return wialon.item.MUnitSensor.invalidValue;for(var a=t,s=0;s<e.tbl.length&&!(0!=s&&e.tbl[s].x>t);s++)a=parseFloat(e.tbl[s].a)*parseFloat(t)+parseFloat(e.tbl[s].b);return e.f&wialon.item.MUnitSensor.flags.boundsAfterCalc&&(n!=wialon.item.MUnitSensor.invalidValue&&a<n||r!=wialon.item.MUnitSensor.invalidValue&&a>=r)?wialon.item.MUnitSensor.invalidValue:a},__parseExpression:function(e,t,n,r){if(!e||"string"!=typeof e.p||!e.p.length)return wialon.item.MUnitSensor.invalidValue;var i=this.__parsedTokens[e.p];if(void 0===i){if(!(i=this.__createTokens(e.p)).length)return wialon.item.MUnitSensor.invalidValue;this.__parsedTokens[e.p]=i}for(var a=[],s=0,o=0;o<i.length;o++){var l=i[o],c=a.length;if("*"==l[0]&&c>1)wialon.item.MUnitSensor.invalidValue==a[c-2]||wialon.item.MUnitSensor.invalidValue==a[c-1]?a[c-2]=wialon.item.MUnitSensor.invalidValue:a[c-2]=a[c-2]*a[c-1],a.pop();else if("/"==l[0]&&c>1)wialon.item.MUnitSensor.invalidValue==a[c-2]||wialon.item.MUnitSensor.invalidValue==a[c-1]||0==a[c-1]?a[c-2]=wialon.item.MUnitSensor.invalidValue:a[c-2]=a[c-2]/a[c-1],a.pop();else if("+"==l[0]&&c>1)wialon.item.MUnitSensor.invalidValue==a[c-2]||wialon.item.MUnitSensor.invalidValue==a[c-1]?a[c-2]=wialon.item.MUnitSensor.invalidValue:a[c-2]=a[c-2]+a[c-1],a.pop();else if("-"==l[0])c>1?(wialon.item.MUnitSensor.invalidValue==a[c-2]||wialon.item.MUnitSensor.invalidValue==a[c-1]?a[c-2]=wialon.item.MUnitSensor.invalidValue:a[c-2]=a[c-2]-a[c-1],a.pop()):1==c&&(a[c-1]=-a[c-1]);else if("^"==l[0]&&c>1)wialon.item.MUnitSensor.invalidValue==a[c-2]||wialon.item.MUnitSensor.invalidValue==a[c-1]?a[c-2]=wialon.item.MUnitSensor.invalidValue:a[c-2]=Math.pow(a[c-2],a[c-1]),a.pop();else if("|"==l[0]&&c>1)wialon.item.MUnitSensor.invalidValue==a[c-2]&&(a[c-2]=a[c-1]),a.pop();else if("["==l[0]){if(!(e=wialon.util.Helper.searchObject(this.getSensors(),"n",l.slice(1)))){a.push(wialon.item.MUnitSensor.invalidValue);continue}s=this.__calculateSensorValueImpl(e,t,n,r),a.push(s)}else{if(s=wialon.item.MUnitSensor.invalidValue,"string"==typeof(s="#"==l[0]?this.__getValueImpl(l.slice(1),n,e):this.__getValueImpl(l,t,e)))return s;a.push(s)}}return 1==a.length?a[0]:wialon.item.MUnitSensor.invalidValue},__createTokens:function(e){for(var t=e.length,n="",r=[],i=[],a=0,s=!1,o=!1,l=0;l<t;l++){if(" "==e[l]){if(!a)continue}else"["==e[l]?s=!0:"]"==e[l]&&(s=!1);var c=e[l].charCodeAt(0);if(!((s||c>47&&c<58||c>64&&c<91||c>96&&c<123||"_"===e[l]||"#"===e[l]||"."===e[l]||":"===e[l]||" "===e[l]||"-"===e[l]&&"const"===n)&&(n+=e[l],a++,l<t-1))){a&&-1==this.__getTokenPriority(n)&&(n=n.replace(/\s+$/,""),o=!1,i.push(n)),n=e[l];var u=this.__getTokenPriority(n);if(-1!=u)if("-"==e[l]&&o&&i.push("const0"),o="("==e[l],r.length)if("("==e[l])r.push(n);else if(")"==e[l])for(;r.length;){var d=r[r.length-1];if(r.pop(),"("==d[0])break;i.push(d)}else{for(;r.length&&(d=r[r.length-1],this.__getTokenPriority(d)>=u);)"("!=d[0]&&")"!=d[0]&&i.push(r[r.length-1]),r.pop();r.push(n)}else r.push(n);n="",a=0}}for(;r.length;)")"!=(d=r[r.length-1])[0]&&"("!=d[0]&&i.push(d),r.pop();return i.length||i.push(e),i},__getTokenPriority:function(e){if(""==e)return-1;switch(e[0]){case"|":return 5;case"^":return 4;case"*":case"/":return 3;case"-":case"+":return 2;case")":return 1;case"(":return 0}return-1}},statics:{invalidValue:-348201.3876,flags:{overflow:32,boundsAfterCalc:64},validation:{logicalAnd:1,logicalOr:2,mathAnd:3,mathOr:4,summarize:5,subtructValidator:6,subtructValue:7,multiply:8,divideValidator:9,divideValue:10,noneZero:11,replaceOnError:12}}}),qx.Class.define("wialon.util.String",{type:"static",statics:{wrapString:function(e){return void 0!==e&&e.length||(e=""),e},xor:function(e,t){for(var n=[],r=0;r<e.length;r++)n.push(e.charCodeAt(r)^t.charCodeAt(r%t.length));return n.join(":")},unxor:function(e,t){var n="";if(""==e)return e;e=e.split(":");for(var r=0;r<e.length;r++)n+=String.fromCharCode(e[r]^t.charCodeAt(r%t.length));return n},isValidText:function(e){if("null"===e)return!1;var t=""+e;return!(null==t||"string"!=typeof t||t.length&&/([\"\{\}\\])/i.test(t))},isValidName:function(e,t){var n=""+e;if(null==t)return null!=n&&this.isValidText(n)&&n.length>0&&" "!=n[0]&&" "!=n[n.length-1];var r=null!=t.min?t.min:1,i=null!=t.max?t.max:4096;return null!=n&&this.isValidText(n)&&n.length>=r&&n.length<=i&&" "!=n[0]&&" "!=n[n.length-1]},isValidEmail:function(e){return/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i.test(e)},isValidPhone:function(e){var t=""+e;return null!=t&&this.isValidText(t)&&/^[+]{1,1}[\d]{7,16}$/i.test(t)},stringMatchTemplates:function(e,t,n){if(!("string"==typeof e&&e.length&&t instanceof Array))return!0;"string"==typeof n&&1==n.length||(n="x");for(var r=0;r<t.length;r++){var i=t[r];if("string"==typeof i&&i.length==e.length){for(var a=!0,s=0;s<e.length;s++)if(e[s]!=i[s]&&i[s].toLowerCase()!=n[0]){a=!1;break}if(a)return!0}}return!1},sprintf:function(){if(void 0===arguments)return null;if(arguments.length<1)return null;if("string"!=typeof arguments[0])return null;if("undefined"==typeof RegExp)return null;for(var e=arguments[0],t=new RegExp(/(%([%]|(\-)?(\+|\x20)?(0)?(\d+)?(\.(\d+)?)?([bcdfosxX])))/g),n=new Array,r=new Array,i=0,a=0,s=0,o=0,l="",c=null;c=t.exec(e);)c[9]&&(i+=1),a=o,s=t.lastIndex-c[0].length,r[r.length]=e.substring(a,s),o=t.lastIndex,n[n.length]={match:c[0],left:!!c[3],sign:c[4]||"",pad:c[5]||" ",min:c[6]||0,precision:c[8],code:c[9]||"%",negative:parseFloat(arguments[i])<0,argument:String(arguments[i])};if(r[r.length]=e.substring(o),0==n.length)return e;if(arguments.length-1<i)return null;c=null;var u=null,d=null;for(u=0;u<n.length;u++)"%"==n[u].code?d="%":"b"==n[u].code?(n[u].argument=String(Math.abs(parseInt(n[u].argument)).toString(2)),d=this.__convert(n[u],!0)):"c"==n[u].code?(n[u].argument=String(String.fromCharCode(parseInt(Math.abs(parseInt(n[u].argument))))),d=this.__convert(n[u],!0)):"d"==n[u].code?(n[u].argument=String(Math.abs(parseInt(n[u].argument))),d=this.__convert(n[u])):"f"==n[u].code?(n[u].argument=String(Math.abs(parseFloat(n[u].argument)).toFixed(n[u].precision<15?n[u].precision:6)),d=this.__convert(n[u])):"o"==n[u].code?(n[u].argument=String(Math.abs(parseInt(n[u].argument)).toString(8)),d=this.__convert(n[u])):"s"==n[u].code?(n[u].argument=n[u].argument.substring(0,n[u].precision?n[u].precision:n[u].argument.length),d=this.__convert(n[u],!0)):"x"==n[u].code?(n[u].argument=String(Math.abs(parseInt(n[u].argument)).toString(16)),d=this.__convert(n[u])):"X"==n[u].code?(n[u].argument=String(Math.abs(parseInt(n[u].argument)).toString(16)),d=this.__convert(n[u]).toUpperCase()):d=n[u].match,l+=r[u],l+=d;return l+r[u]},strspn:function(e,t){if("string"!=typeof e||"string"!=typeof t)return 0;var n,r;for(n=0;n<e.length;n++){for(r=0;r<t.length&&t[r]!=e[n];r++);if(r==t.length&&t[r]!=e[n])break}return n},__convert:function(e,t){e.sign=t?"":e.negative?"-":e.sign;var n=e.min-e.argument.length+1-e.sign.length,r=new Array(n<0?0:n).join(e.pad);return e.left?"0"==e.pad||t?e.sign+e.argument+r.replace(/0/g," "):e.sign+e.argument+r:"0"==e.pad||t?e.sign+r+e.argument:r+e.sign+e.argument}}}),qx.Mixin.define("wialon.item.MUnitTripDetector",{members:{getTripDetector:function(e){return wialon.core.Remote.getInstance().remoteCall("unit/get_trip_detector",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},getTrips:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("unit/get_trips",{itemId:this.getId(),timeFrom:e,timeTo:t,msgsSource:n},wialon.util.Helper.wrapCallback(r))},updateTripDetector:function(e,t,n,r,i,a,s,o,l){return wialon.core.Remote.getInstance().remoteCall("unit/update_trip_detector",{itemId:this.getId(),type:e,gpsCorrection:t,minSat:n,minMovingSpeed:r,minStayTime:i,maxMessagesDistance:a,minTripTime:s,minTripDistance:o},wialon.util.Helper.wrapCallback(l))}},statics:{tripDetectionType:{gpsSpeed:1,gpsPosition:2,ignitionSensor:3,mileageSensorAbsolute:4,mileageSensorRelative:5}}}),qx.Mixin.define("wialon.item.MUnitMessagesFilter",{members:{getMessagesFilter:function(e){return wialon.core.Remote.getInstance().remoteCall("unit/get_messages_filter",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateMessagesFilter:function(e,t,n,r,i,a,s){return void 0===s&&(s=a,a=0),wialon.core.Remote.getInstance().remoteCall("unit/update_messages_filter",{itemId:this.getId(),enabled:e,skipInvalid:t,minSats:n,maxHdop:r,maxSpeed:i,lbsCorrection:a},wialon.util.Helper.wrapCallback(s))}}}),qx.Mixin.define("wialon.item.MUnitEventRegistrar",{members:{registryStatusEvent:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("unit/registry_status_event",{date:e,description:t,params:n,itemId:this.getId()},wialon.util.Helper.wrapCallback(r))},registryInsuranceEvent:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("unit/registry_insurance_event",{type:t,case_num:n,description:e,itemId:this.getId()},wialon.util.Helper.wrapCallback(r))},registryCustomEvent:function(e,t,n,r,i,a,s){var o={date:e,x:n,y:r,description:t,violation:i,itemId:this.getId()};return s&&s.nt&&s.nct&&(o.nt=s.nt+"",o.nct=s.nct+""),wialon.core.Remote.getInstance().remoteCall("unit/registry_custom_event",o,wialon.util.Helper.wrapCallback(a))},registryFuelFillingEvent:function(e,t,n,r,i,a,s,o,l){return wialon.core.Remote.getInstance().remoteCall("unit/registry_fuel_filling_event",{date:e,volume:a,cost:s,location:i,deviation:o,x:n,y:r,description:t,itemId:this.getId()},wialon.util.Helper.wrapCallback(l))},registryMaintenanceEvent:function(e,t,n,r,i,a,s,o,l,c,u,d){return wialon.core.Remote.getInstance().remoteCall("unit/registry_maintenance_event",{date:e,info:a,duration:s,cost:o,location:i,x:n,y:r,description:t,mileage:l,eh:c,done_svcs:u,itemId:this.getId()},wialon.util.Helper.wrapCallback(d))}}}),qx.Mixin.define("wialon.item.MUnitReportSettings",{members:{getReportSettings:function(e){return wialon.core.Remote.getInstance().remoteCall("unit/get_report_settings",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateReportSettings:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_report_settings",{itemId:this.getId(),params:e},wialon.util.Helper.wrapCallback(t))}}}),qx.Mixin.define("wialon.item.MUnitDriveRankSettings",{members:{getDriveRankSettings:function(e){return wialon.core.Remote.getInstance().remoteCall("unit/get_drive_rank_settings",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateDriveRankSettings:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_drive_rank_settings",{itemId:this.getId(),driveRank:e},wialon.util.Helper.wrapCallback(t))},getAccelerometersCalibration:function(e){return wialon.core.Remote.getInstance().remoteCall("unit/get_accelerometers_calibration",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateAccelerometersCalibration:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("unit/update_accelerometers_calibration",{itemId:this.getId(),timeFrom:e,timeTo:t},wialon.util.Helper.wrapCallback(n))},resetAccelerometersCalibration:function(e){return wialon.core.Remote.getInstance().remoteCall("unit/update_accelerometers_calibration",{itemId:this.getId(),reset:1},wialon.util.Helper.wrapCallback(e))}}}),qx.Mixin.define("wialon.item.MUnitFuelSettings",{members:{getFuelSettings:function(e){return wialon.core.Remote.getInstance().remoteCall("unit/get_fuel_settings",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateFuelCalcTypes:function(e,t){return wialon.core.Remote.getInstance().remoteCall("unit/update_fuel_calc_types",{itemId:this.getId(),calcTypes:e},wialon.util.Helper.wrapCallback(t))},updateFuelLevelParams:function(e,t){var n={};return e&&"object"==typeof e?n=e:arguments.length>2&&(n.flags=arguments[0],n.ignoreStayTimeout=arguments[1],n.minFillingVolume=arguments[2],n.minTheftTimeout=arguments[3],n.minTheftVolume=arguments[4],n.filterQuality=arguments[5],arguments.length>7?(n.fillingsJoinInterval=arguments[6],n.theftsJoinInterval=arguments[7],t=arguments[8]):(n.fillingsJoinInterval=300,n.theftsJoinInterval=300,t=arguments[6])),wialon.core.Remote.getInstance().remoteCall("unit/update_fuel_level_params",{itemId:this.getId(),flags:n.flags,ignoreStayTimeout:n.ignoreStayTimeout,minFillingVolume:n.minFillingVolume,minTheftTimeout:n.minTheftTimeout,minTheftVolume:n.minTheftVolume,filterQuality:n.filterQuality,fillingsJoinInterval:n.fillingsJoinInterval,theftsJoinInterval:n.theftsJoinInterval,extraFillingTimeout:n.extraFillingTimeout},wialon.util.Helper.wrapCallback(t))},updateFuelConsMath:function(e,t){var n,r,i;if(arguments.length>=4)n=arguments[0],r=arguments[1],i=arguments[2],t=arguments[4];else{if(!e||"object"!=typeof e)return void("function"==typeof t&&t(4));n=e.idling,r=e.urban,i=e.suburban}return wialon.core.Remote.getInstance().remoteCall("unit/update_fuel_math_params",{itemId:this.getId(),idling:n,urban:r,suburban:i},wialon.util.Helper.wrapCallback(t))},updateFuelConsRates:function(e,t,n,r,i,a,s,o,l){return wialon.core.Remote.getInstance().remoteCall("unit/update_fuel_rates_params",{itemId:this.getId(),idlingSummer:e,idlingWinter:t,consSummer:n,consWinter:r,winterMonthFrom:i,winterDayFrom:a,winterMonthTo:s,winterDayTo:o},wialon.util.Helper.wrapCallback(l))},updateFuelConsImpulse:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("unit/update_fuel_impulse_params",{itemId:this.getId(),maxImpulses:e,skipZero:t},wialon.util.Helper.wrapCallback(n))}},statics:{fuelCalcType:{math:1,levelSensors:2,levelSensorsMath:4,absConsSensors:8,impConsSensors:16,instConsSensors:32,rates:64},fuelLevelFlag:{mergeSensors:1,smoothData:2,splitConsSensors:4,requireStay:8,calcByTime:16,calcFillingsByRaw:64,calcTheftsByRaw:128,detectTheftsInMotion:256,calcFillingsByTime:512,calcTheftsByTime:1024,calcConsumptionByTime:2048}}}),qx.Mixin.define("wialon.item.MZone",{members:{getZoneImageUrl:function(e,t){return void 0!==t&&t||(t=32),e.icon?wialon.core.Session.getInstance().getBaseUrl()+e.icon+"?b="+t+"&v=1":""},setZoneImage:function(e,t,n){return"string"==typeof t?wialon.core.Uploader.getInstance().uploadFiles([],"resource/upload_zone_image",{fileUrl:t,itemId:this.getId(),id:e.id},n,!0):null===t||void 0===t?wialon.core.Uploader.getInstance().uploadFiles([],"resource/upload_zone_image",{fileUrl:"",itemId:this.getId(),id:e.id},n,!0):"object"==typeof t&&"number"==typeof t.resId&&"number"==typeof t.zoneId?wialon.core.Remote.getInstance().remoteCall("resource/upload_zone_image",{itemId:this.getId(),id:e.id,oldItemId:t.resId,oldZoneId:t.zoneId},n):wialon.core.Uploader.getInstance().uploadFiles([t],"resource/upload_zone_image",{itemId:this.getId(),id:e.id},n,!0)}},statics:{flags:{area:1,perimeter:2,boundary:4,points:8,base:16}}}),qx.Mixin.define("wialon.item.MDriver",{construct:function(){var e=wialon.core.Session.getInstance();e.registerProperty("drvrun",qx.lang.Function.bind(function(e,t){e.setDriverUnits(t)},this)),e.registerProperty("trlrun",qx.lang.Function.bind(function(e,t){e.setTrailerUnits(t)},this))},properties:{driverUnits:{init:null,check:"Array",event:"changeDriverUnits"},trailerUnits:{init:null,check:"Array",event:"changeTrailerUnits"}},members:{updateDriverUnits:function(e,t){return wialon.core.Remote.getInstance().remoteCall("resource/update_driver_units",{itemId:this.getId(),units:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},updateTrailerUnits:function(e,t){return wialon.core.Remote.getInstance().remoteCall("resource/update_trailer_units",{itemId:this.getId(),units:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},getDriverImageUrl:function(e,t){void 0!==t&&t||(t=32);var n=wialon.core.Session.getInstance();return n.getBaseUrl()+"/avl_driver_image/"+this.getId()+"/"+e.id+"/"+t+"/1/"+e.ck+".png?sid="+n.getId()},getTrailerImageUrl:function(e,t){void 0!==t&&t||(t=32);var n=wialon.core.Session.getInstance();return n.getBaseUrl()+"/avl_driver_image/"+this.getId()+"/"+e.id+"/"+t+"/2/"+e.ck+".png?sid="+n.getId()},setDriverImage:function(e,t,n){return"object"==typeof t&&"number"==typeof t.resId&&"number"==typeof t.drvId?wialon.core.Remote.getInstance().remoteCall("resource/upload_driver_image",{itemId:this.getId(),driverId:e.id,oldItemId:t.resId,oldDrvId:t.drvId},n):wialon.core.Uploader.getInstance().uploadFiles([t],"resource/upload_driver_image",{itemId:this.getId(),driverId:e.id},n)},setTrailerImage:function(e,t,n){return"object"==typeof t&&"number"==typeof t.resId&&"number"==typeof t.trId?wialon.core.Remote.getInstance().remoteCall("resource/upload_trailer_image",{itemId:this.getId(),trailerId:e.id,oldItemId:t.resId,oldTrId:t.trId},n):wialon.core.Uploader.getInstance().uploadFiles([t],"resource/upload_trailer_image",{itemId:this.getId(),trailerId:e.id},n)},bindDriverToUnit:function(e,t,n,r,i){var a=0,s=0;return e&&(a=e.id),t&&(s=t.getId()),wialon.core.Remote.getInstance().remoteCall("resource/bind_unit_driver",{resourceId:this.getId(),driverId:a,time:n,unitId:s,mode:r},wialon.util.Helper.wrapCallback(i))},bindTrailerToUnit:function(e,t,n,r,i){var a=0,s=0;return e&&(a=e.id),t&&(s=t.getId()),wialon.core.Remote.getInstance().remoteCall("resource/bind_unit_trailer",{resourceId:this.getId(),trailerId:a,time:n,unitId:s,mode:r},wialon.util.Helper.wrapCallback(i))},cleanupDriverInterval:function(e,t,n,r){var i=0;return e&&(i=e.id),wialon.core.Remote.getInstance().remoteCall("resource/cleanup_driver_interval",{resourceId:this.getId(),driverId:i,timeFrom:t,timeTo:n},wialon.util.Helper.wrapCallback(r))},cleanupTrailerInterval:function(e,t,n,r){var i=0;return e&&(i=e.id),wialon.core.Remote.getInstance().remoteCall("resource/cleanup_trailer_interval",{resourceId:this.getId(),trailerId:i,timeFrom:t,timeTo:n},wialon.util.Helper.wrapCallback(r))},getDriverBindings:function(e,t,n,r,i){var a=0,s=0;return t&&(a=t.id),e&&(s=e.getId()),wialon.core.Remote.getInstance().remoteCall("resource/get_driver_bindings",{resourceId:this.getId(),unitId:s,driverId:a,timeFrom:n,timeTo:r},wialon.util.Helper.wrapCallback(i))},getTrailerBindings:function(e,t,n,r,i){var a=0,s=0;return t&&(a=t.id),e&&(s=e.getId()),wialon.core.Remote.getInstance().remoteCall("resource/get_trailer_bindings",{resourceId:this.getId(),unitId:s,trailerId:a,timeFrom:n,timeTo:r},wialon.util.Helper.wrapCallback(i))},registerChatMessage:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("driver/operate",{resourceId:this.getId(),driverId:e.id,message:t,callMode:"say"},wialon.util.Helper.wrapCallback(n))},getChatHistory:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("driver/operate",{resourceId:this.getId(),driverId:e.id,timeFrom:t,timeTo:n,callMode:"read"},wialon.util.Helper.wrapCallback(r))}},statics:{registerDriverProperties:function(){var e=wialon.core.Session.getInstance();e.registerProperty("drvrun",this.remoteUpdateDriverUnits),e.registerProperty("trlrun",this.remoteUpdateTrailerUnits)},remoteUpdateDriverUnits:function(e,t){e.setDriverUnits(t)},remoteUpdateTrailerUnits:function(e,t){e.setTrailerUnits(t)},flags:{driver:1,trailer:2,assignmentRestriction:4}},events:{changeDriverUnits:"qx.event.type.Data",changeTrailerUnits:"qx.event.type.Data"}}),qx.Mixin.define("wialon.item.MAccount",{members:{getAccountData:function(e,t){return"function"==typeof e&&(t=e,e=2),wialon.core.Remote.getInstance().remoteCall("account/get_account_data",{itemId:this.getId(),type:e},wialon.util.Helper.wrapCallback(t))},getAccountHistory:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("account/get_account_history",{itemId:this.getId(),days:e,tz:t},wialon.util.Helper.wrapCallback(n))},updateDealerRights:function(e,t){return wialon.core.Remote.getInstance().remoteCall("account/update_dealer_rights",{itemId:this.getId(),enable:e},wialon.util.Helper.wrapCallback(t))},updatePlan:function(e,t){return wialon.core.Remote.getInstance().remoteCall("account/update_plan",{itemId:this.getId(),plan:e},wialon.util.Helper.wrapCallback(t))},updateFlags:function(e,t){var n={};return e&&"object"==typeof e?n=e:"number"==typeof e&&(n.flags=e),wialon.core.Remote.getInstance().remoteCall("account/update_flags",{itemId:this.getId(),flags:n.flags,blockBalance:n.blockBalance,denyBalance:n.denyBalance},wialon.util.Helper.wrapCallback(t))},updateMinDays:function(e,t){return wialon.core.Remote.getInstance().remoteCall("account/update_min_days",{itemId:this.getId(),minDays:e},wialon.util.Helper.wrapCallback(t))},updateHistoryPeriod:function(e,t){return wialon.core.Remote.getInstance().remoteCall("account/update_history_period",{itemId:this.getId(),historyPeriod:e},wialon.util.Helper.wrapCallback(t))},updateBillingService:function(e,t,n,r,i){return wialon.core.Remote.getInstance().remoteCall("account/update_billing_service",{itemId:this.getId(),name:e,type:t,intervalType:n,costTable:r},wialon.util.Helper.wrapCallback(i))},enableAccount:function(e,t){return wialon.core.Remote.getInstance().remoteCall("account/enable_account",{itemId:this.getId(),enable:e},wialon.util.Helper.wrapCallback(t))},updateSubPlans:function(e,t){return wialon.core.Remote.getInstance().remoteCall("account/update_sub_plans",{itemId:this.getId(),plans:e},wialon.util.Helper.wrapCallback(t))},doPayment:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("account/do_payment",{itemId:this.getId(),balanceUpdate:e,daysUpdate:t,description:n},wialon.util.Helper.wrapCallback(r))},createAccount:function(e,t){return wialon.core.Remote.getInstance().remoteCall("account/create_account",{itemId:this.getId(),plan:e},wialon.util.Helper.wrapCallback(t))},deleteAccount:function(e){return wialon.core.Remote.getInstance().remoteCall("account/delete_account",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},getBillingPlans:function(e){return wialon.core.Remote.getInstance().remoteCall("account/get_billing_plans",{},wialon.util.Helper.wrapCallback(e))},updateBillingPlan:function(e,t,n){return n=wialon.util.Helper.wrapCallback(n),wialon.core.Remote.getInstance().remoteCall("account/update_billing_plan",{callMode:e,plan:t},n)}},statics:{billingPlanFlag:{blockAccount:1,denyServices:2,allowUnknownServices:4,restrictDeviceListedOnly:8,restrictDeviceNotListedOnly:16,subtractDays:32,overridePlanFlags:64},billingIntervalType:{none:0,hourly:1,daily:2,weekly:3,monthly:4},billingServiceType:{onDemand:1,periodic:2},logMessageAction:{accountCreated:"create_account",accountSwitched:"switch_account",accountUpdateDealerRights:"update_dealer_rights",accountUpdateFlags:"update_account_flags",accountUpdateMinDays:"update_account_min_days",accountUpdatedHistoryPeriod:"update_account_history_period",accountUpdatePlan:"update_account_plan",accountUpdateSubplans:"update_account_subplans",accountCreatedService:"create_account_service",accountUpdatedService:"update_account_service",accountDeletedService:"delete_account_service"}}}),qx.Mixin.define("wialon.item.MReport",{members:{execReport:function(e,t,n,r,i){return arguments.length<=2||"function"==typeof t?this.__executeReport(e,t):this.__executeReport({report:e,objectId:t,objectSecondaryId:n,interval:r},i)},getReportStatus:function(e){return wialon.core.Remote.getInstance().remoteCall("report/get_report_status",{},wialon.util.Helper.wrapCallback(e))},abortReport:function(e){return wialon.core.Remote.getInstance().remoteCall("report/abort_report",{},wialon.util.Helper.wrapCallback(e))},applyReportResult:function(e){return wialon.core.Remote.getInstance().remoteCall("report/apply_report_result",{},qx.lang.Function.bind(this.__createReportResult,this,wialon.util.Helper.wrapCallback(e)))},cleanupResult:function(e){return wialon.core.Remote.getInstance().remoteCall("report/cleanup_result",{},qx.lang.Function.bind(this.__cleanupReportResult,this,wialon.util.Helper.wrapCallback(e)))},__executeReport:function(e,t){var n=e.report,r=e.objectId,i=e.additionalObjectsIds,a=e.objectSecondaryId,s=e.interval,o=e.remoteExec,l=null;n.id||(l=n);var c={reportResourceId:this.getId(),reportTemplateId:n.id,reportTemplate:l,reportObjectId:r,reportObjectSecId:a,interval:s};if(o&&(c.remoteExec=1),Array.isArray(i)){var u=[],d={};i.forEach(function(e){var t=parseInt(e,10);isFinite(t)&&t>0?d.hasOwnProperty(t)||(u.push(t),d[t]=!0):console.warn("Invalid execReport additional id:",e)}),c.reportObjectIdList=u}return wialon.core.Remote.getInstance().remoteCall("report/exec_report",c,qx.lang.Function.bind(this.__createReportResult,this,wialon.util.Helper.wrapCallback(t)),180)},__createReportResult:function(e,t,n){var r=null;if(0==t&&n){if(!n.reportResult)return void e(0,Object.assign(n,{remoteExec:!0}));r=new wialon.report.ReportResult(n);var i=wialon.core.Session.getInstance().getRenderer();i&&i.setReportResult(r)}e(t,r)},__cleanupReportResult:function(e,t,n){var r=wialon.core.Session.getInstance().getRenderer();r&&r.setReportResult(null),e(t)}},statics:{intervalFlag:{absolute:0,useCurrentTime:1,prevHour:64,prevMinute:128,prevDay:2,prevWeek:4,prevMonth:8,prevYear:16,currTimeAndPrev:32,weekDayMask:1792},tableFlag:{},columnFlag:{},remoteExecFlag:{queued:1,executing:2,ready:4,cancelled:8,error:16}}}),qx.Class.define("wialon.report.ReportResult",{extend:qx.core.Object,construct:function(e){this.base(arguments,e),this._data=e},properties:{layer:{init:null,check:"Object",nullable:!0}},members:{_data:null,getTables:function(){return this._data.reportResult.tables},isRendered:function(){return this._data.reportResult.msgsRendered},isEmpty:function(){var e=0,t=0,n=0;return this._data.reportResult.tables&&(e=this._data.reportResult.tables.length),this._data.reportResult.stats&&(t=this._data.reportResult.stats.length),this._data.reportResult.attachments&&(n=this._data.reportResult.attachments.length),!(e||t||n)},getTableRows:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("report/get_result_rows",{tableIndex:e,indexFrom:t,indexTo:n},wialon.util.Helper.wrapCallback(r))},getRowDetail:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("report/get_result_subrows",{tableIndex:e,rowIndex:t},wialon.util.Helper.wrapCallback(n))},selectRows:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("report/select_result_rows",{tableIndex:e,config:t},wialon.util.Helper.wrapCallback(n))},renderJSON:function(e,t,n,r,i,a){return wialon.core.Remote.getInstance().remoteCall("report/render_json",{attachmentIndex:e,width:t,useCrop:n,cropBegin:r,cropEnd:i},wialon.util.Helper.wrapCallback(a))},getMessages:function(e,t,n){n=wialon.util.Helper.wrapCallback(n);var r=this.getLayer();r&&r instanceof wialon.render.MessagesLayer?r.getMessages(0,e,t,n):n(3)},getStatistics:function(){return this._data.reportResult.stats},getAttachments:function(){return this._data.reportResult.attachments},getChartUrl:function(e,t,n,r,i,a,s,o){var l={reportResourceId:this._data.reportResourceId,attachmentIndex:e,action:t,width:n,height:r,autoScaleY:i,pixelFrom:a,pixelTo:s,flags:o,rnd:(new Date).getTime()},c=wialon.core.Session.getInstance();return c.getBaseUrl()+c.getApiPath()+"?sid="+c.getId()+"&svc=report/get_result_chart&params="+encodeURIComponent(wialon.util.Json.stringify(l))},hitTestChart:function(e,t){var n={};return e&&"object"==typeof e?n=e:arguments.length>2&&(n.attachmentIndex=arguments[0],n.datasetIndex=arguments[1],n.valueX=arguments[2],arguments.length>4?(n.valueY=arguments[3],n.flags=arguments[4]):(n.valueY=0,n.flags=0),t=arguments[arguments.length-1]),wialon.core.Remote.getInstance().remoteCall("report/hittest_chart",{attachmentIndex:n.attachmentIndex,datasetIndex:n.datasetIndex,valueX:n.valueX,valueY:n.valueY,flags:n.flags},wialon.util.Helper.wrapCallback(t))},getExportUrl:function(e,t){var n=qx.lang.Object.clone(t);n.format=e;var r=wialon.core.Session.getInstance();return r.getBaseUrl()+r.getApiPath()+"?sid="+r.getId()+"&svc=report/export_result&params="+encodeURIComponent(wialon.util.Json.stringify(n))},getMapUrl:function(e,t){var n={width:e,height:t,rnd:(new Date).getTime()},r=wialon.core.Session.getInstance();return r.getBaseUrl()+r.getApiPath()+"?sid="+r.getId()+"&svc=report/get_result_map&params="+encodeURIComponent(wialon.util.Json.stringify(n))},getPhotoUrl:function(e,t){var n={attachmentIndex:e,border:t,rnd:(new Date).getTime()},r=wialon.core.Session.getInstance();return r.getBaseUrl()+r.getApiPath()+"?sid="+r.getId()+"&svc=report/get_result_photo&params="+encodeURIComponent(wialon.util.Json.stringify(n))},getVideoUrl:function(e,t){var n={attachmentIndex:e,rnd:(new Date).getTime()};return wialon.core.Remote.getInstance().remoteCall("report/get_result_video",n,wialon.util.Helper.wrapCallback(t))},getLayerData:function(){return this._data.reportLayer}},statics:{chartFlag:{headerTop:1,headerBottom:2,headerNone:4,axisUpDown:64,axisDownUp:128,legendTop:256,legendBottom:512,legendLeft:1024,legendShowAlways:4096},exportFormat:{html:1,pdf:2,xls:4,xlsx:8,xml:16,csv:32}}}),qx.Mixin.define("wialon.item.MUnitEvents",{members:{getTripsHistory:function(e,t,n,r){return this.__getEvents("trips",e,t,n,0,0,"*",r)},getCurrentTrip:function(e,t){return this.__getEvents("trips",0,0,0,e,0,"*",t)},updateTripsData:function(e,t,n,r,i){return this.__updateEventsData(e,"trips",t,n,r,0,"*",i)},resetTrips:function(e,t){return this.__getEvents("trips",e?-1:-2,0,0,0,0,"*",t)},getIgnitionHistory:function(e,t,n,r,i,a){return this.__getEvents("ignition",e,t,n,0,r,i,a)},getCurrentIgnition:function(e,t,n,r){return this.__getEvents("ignition",0,0,0,n,e,t,r)},updateIgnitionData:function(e,t,n,r,i){return this.__updateEventsData(e,"ignition",t,n,r,0,"*",i)},resetIgnition:function(e,t){return this.__getEvents("ignition",e?-1:-2,0,0,0,0,"*",t)},getSensorsHistory:function(e,t,n,r,i,a){return this.__getEvents("sensors",e,t,n,0,r,i,a)},getCurrentSensors:function(e,t,n,r){return this.__getEvents("sensors",0,0,0,n,e,t,r)},updateSensorsData:function(e,t,n,r,i){return this.__updateEventsData(e,"sensors",t,n,r,0,"*",i)},resetSensors:function(e,t){return this.__getEvents("ignition",e?-1:-2,0,0,0,0,"*",t)},__getEvents:function(e,t,n,r,i,a,s,o){return wialon.core.Remote.getInstance().remoteCall("unit/get_events",{itemId:this.getId(),eventType:e,ivalType:t,ivalFrom:n,ivalTo:r,diffOnly:i,filter1:a,filter2:s},wialon.util.Helper.wrapCallback(o))},__updateEventsData:function(e,t,n,r,i,a,s,o){return wialon.core.Remote.getInstance().remoteCall("unit/update_event_data",{itemId:this.getId(),params:e,eventType:t,ivalType:n,ivalFrom:r,ivalTo:i,filter1:a,filter2:s},wialon.util.Helper.wrapCallback(o))}}}),qx.Mixin.define("wialon.item.MOrder",{members:{getOrderAttachments:function(e,t){return wialon.core.Remote.getInstance().remoteCall("order/list_attachments",{itemId:this.getId(),id:e.id},wialon.util.Helper.wrapCallback(t))},attachToOrder:function(e,t,n){return wialon.core.Uploader.getInstance().uploadFiles([t],"order/attach",{itemId:this.getId(),id:e.id},n,!0)},rejectOrder:function(e,t){return wialon.core.Remote.getInstance().remoteCall("order/update",{callMode:"reject",itemId:this.getId(),id:e.id},wialon.util.Helper.wrapCallback(t))},confirmOrder:function(e,t){return wialon.core.Remote.getInstance().remoteCall("order/update",{callMode:"confirm",itemId:this.getId(),id:e.id},wialon.util.Helper.wrapCallback(t))},detachFromOrder:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("order/detach",{itemId:this.getId(),id:e.id,path:t},wialon.util.Helper.wrapCallback(n))},getOrderAttachment:function(e,t){var n=wialon.core.Session.getInstance();return n.getBaseUrl()+n.getApiPath()+"?sid="+n.getId()+"&svc=order/get_attachment&params="+encodeURIComponent(wialon.util.Json.stringify({itemId:this.getId(),id:e.id,path:t}))},assignUnitToOrder:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("order/update",{callMode:"assign",itemId:this.getId(),id:e.id,u:t},wialon.util.Helper.wrapCallback(n))},moveOrderToHistory:function(e,t){return wialon.core.Remote.getInstance().remoteCall("order/update",{callMode:"register",itemId:this.getId(),id:e.id},wialon.util.Helper.wrapCallback(t))},remoteOptimizeOrderDelivery:function(e,t,n,r,i){if(void 0===i&&(i=r,r=0),"object"!=typeof r&&(r={addPoints:r}),"number"!=typeof t){var a=wialon.util.Helper.wrapCallback(i);return wialon.core.Remote.getInstance().remoteCall("order/optimize",{itemId:this.getId(),orders:e,units:t,flags:n,gis:r},a)}return a=wialon.util.Helper.wrapCallback(i),wialon.core.Remote.getInstance().remoteCall("order/optimize",{itemId:this.getId(),orders:e,unitCount:t,flags:n,gis:r},a)},remoteCompleteOrdersFromHistory:function(e,t){var n=wialon.util.Helper.wrapCallback(t);return wialon.core.Remote.getInstance().remoteCall("order/complete_from_history",{itemId:this.getId(),orders:e},n)},routeUpdate:function(e,t,n,r){var i=wialon.util.Helper.wrapCallback(r);return wialon.core.Remote.getInstance().remoteCall("order/route_update",{itemId:this.getId(),orders:e,routeId:t,callMode:n},i)}},statics:{status:{inactive:0,active:1,completedInTime:2,completedOverdue:3,canceled:4},trackingFlag:{stopRequired:1},statusFlag:{rejected:256}}}),qx.Mixin.define("wialon.item.MOrderRoute",{members:{registerOrderRoute:function(e,t){var n=wialon.util.Helper.wrapCallback(t),r={};return qx.lang.Object.mergeWith(r,e),qx.lang.Object.mergeWith(r,{itemId:this.getId(),callMode:"register"}),wialon.core.Remote.getInstance().remoteCall("order/route_update",r,n)}},statics:{statusMask:255,status:{notStarted:0,started:1,completed:2,cancelled:3},statusFlagsMask:4294967040,statusFlag:{expired:256},trackingFlag:{strict:1,fixed:32}}}),qx.Mixin.define("wialon.item.MTag",{construct:function(){wialon.core.Session.getInstance().registerProperty("tagrun",qx.lang.Function.bind(function(e,t){e.setTagUnits(t)},this))},properties:{tagUnits:{init:null,check:"Array",event:"changeTagUnits"},tagGroups:{init:null,check:"Array",event:"changeTagGroups"}},members:{updateTagUnits:function(e,t){return wialon.core.Remote.getInstance().remoteCall("resource/update_tag_units",{itemId:this.getId(),units:e},qx.lang.Function.bind(this._onUpdateProperties,this,wialon.util.Helper.wrapCallback(t)))},getTagImageUrl:function(e,t){void 0!==t&&t||(t=32);var n=wialon.core.Session.getInstance();return n.getBaseUrl()+"/avl_tag_image/"+this.getId()+"/"+e.id+"/"+t+"/1/"+e.ck+".png?sid="+n.getId()},setTagImage:function(e,t,n){return"object"==typeof t&&"number"==typeof t.resId&&"number"==typeof t.tagId?wialon.core.Remote.getInstance().remoteCall("resource/upload_tag_image",{itemId:this.getId(),tagId:e.id,oldItemId:t.resId,oldTagId:t.tagId},n):wialon.core.Uploader.getInstance().uploadFiles([t],"resource/upload_tag_image",{itemId:this.getId(),tagId:e.id},n)},bindTagToUnit:function(e,t,n,r,i){var a=0,s=0;return e&&(a=e.id),t&&(s=t.getId()),wialon.core.Remote.getInstance().remoteCall("resource/bind_unit_tag",{resourceId:this.getId(),tagId:a,time:n,unitId:s,mode:r},wialon.util.Helper.wrapCallback(i))},getTagBindings:function(e,t,n,r,i){var a=0,s=0;return t&&(a=t.id),e&&(s=e.getId()),wialon.core.Remote.getInstance().remoteCall("resource/get_tag_bindings",{resourceId:this.getId(),unitId:s,tagId:a,timeFrom:n,timeTo:r},wialon.util.Helper.wrapCallback(i))},registerChatMessage:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("driver/operate",{resourceId:this.getId(),driverId:e.id,message:t,callMode:"say"},wialon.util.Helper.wrapCallback(n))}},statics:{registerTagProperties:function(){wialon.core.Session.getInstance().registerProperty("tagrun",this.remoteUpdateTagUnits)},remoteUpdateTagUnits:function(e,t){e.setTagUnits(t)},flags:{Passenger:1}},events:{changeTagUnits:"qx.event.type.Data"}}),qx.Class.define("wialon.util.Apps",{type:"static",statics:{createApplication:function(e,t,n,r,i,a,s,o,l){return l=wialon.util.Helper.wrapCallback(l),wialon.core.Remote.getInstance().remoteCall("apps/create",{name:e,description:t,url:n,flags:r,langs:i,sortOrder:a,requiredServicesList:s,billingPlans:o},l)},updateApplication:function(e,t,n,r,i,a,s,o,l,c){return c=wialon.util.Helper.wrapCallback(c),wialon.core.Remote.getInstance().remoteCall("apps/update",{id:e,name:t,description:n,url:r,flags:i,langs:a,sortOrder:s,requiredServicesList:o,billingPlans:l},c)},deleteApplication:function(e,t){return t=wialon.util.Helper.wrapCallback(t),wialon.core.Remote.getInstance().remoteCall("apps/delete",{id:e},t)},getApplications:function(e,t,n){return n=wialon.util.Helper.wrapCallback(n),wialon.core.Remote.getInstance().remoteCall("apps/list",{manageMode:e,filterLang:t},n)},remoteCheckTopService:function(e){return e=wialon.util.Helper.wrapCallback(e),wialon.core.Remote.getInstance().remoteCall("apps/check_top_service",{},e)},urlFlags:{sid:1,user:2,baseUrl:4,hostUrl:8,lang:16,authHash:32},appTypes:{reportsServer:65536}}}),qx.Mixin.define("wialon.agro.MAgro",{members:{loadAgroLibrary:function(e){if(!this._libraries)return!1;if(void 0!==this._libraries[e])return!0;if("plots"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"aplt","plot","agro/update_plot","agro/get_plot_data");else if("plotGroups"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"apltg","plotGroup","agro/update_plot_group");else if("machines"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"amch","machine","agro/update_machine");else if("equipments"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"aequ","equipment","agro/update_equipment");else if("cultivationTypes"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"acltt","cultivationType","agro/update_cultivation_type");else if("crops"==e)wialon.item.PluginsManager.bindPropItem(wialon.item.Resource,"aclt","crop","agro/update_crop");else if("fuelRates"==e)qx.Class.include(wialon.item.Resource,wialon.agro.MFuelRates);else{if("agroUnit"!=e)return!1;qx.Class.include(wialon.item.Unit,wialon.agro.MAgroUnit)}return this._libraries[e]=1,!0},logMessageAction:{agroCreatedCrop:"create_agro_crop",agroUpdatedCrop:"update_agro_crop",agroDeletedCrop:"delete_agro_crop",agroCreatedCultivationType:"create_agro_cul_type",agroUpdatedCultivationType:"update_agro_cul_type",agroDeletedCultivationType:"delete_agro_cul_type",agroCreatedEquipment:"create_agro_equip",agroUpdatedEquipment:"update_agro_equip",agroDeletedEquipment:"delete_agro_equip",agroCreatedMachine:"create_agro_machine",agroUpdatedMachine:"update_agro_machine",agroDeletedMachine:"delete_agro_machine",agroCreatedPlot:"create_agro_plot",agroUpdatedPlot:"update_agro_plot",agroDeletedPlot:"delete_agro_plot",agroCreatedPlotGroup:"create_agro_plot_group",agroUpdatedPlotGroup:"update_agro_plot_group",agroDeletedPlotGroup:"delete_agro_plot_group",agroDeletedMessage:"delete_agro_msg",agroUpdatedProperties:"update_agro_props",agroUpdatedUnitSettings:"update_agro_unit_cfg",agroUpdatedFuelRates:"update_agro_fuel",agroImportedAgroPlots:"import_agro_plots"}}}),qx.Mixin.define("wialon.agro.MFuelRates",{members:{getFuelRates:function(e){return wialon.core.Remote.getInstance().remoteCall("agro/get_fuel_rates",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateFuelRates:function(e,t){return wialon.core.Remote.getInstance().remoteCall("agro/update_fuel_rates",{itemId:this.getId(),rates:e},wialon.util.Helper.wrapCallback(t))}}}),qx.Mixin.define("wialon.agro.MAgroUnit",{members:{getAgroProps:function(e){return wialon.core.Remote.getInstance().remoteCall("agro/get_agro_props",{itemId:this.getId()},wialon.util.Helper.wrapCallback(e))},updateAgroProps:function(e,t){return wialon.core.Remote.getInstance().remoteCall("agro/update_agro_props",{itemId:this.getId(),props:e},wialon.util.Helper.wrapCallback(t))}}}),qx.Mixin.define("wialon.util.MDataFlagsHelper",{members:{properties:{newItemsCheckingTimeout:{init:600,check:"Integer"}},startBatch:function(){return this.__batchCalls?0:(this.__batchCalls=new Array,1)},finishBatch:function(e){if(e=wialon.util.Helper.wrapCallback(e),this.__batchCalls){if(!this.__batchCalls.length)return this.__batchCalls=null,void e(0);this.__manageItems(this.__batchCalls),this.__batchCalls=null}else e(2)},addItems:function(e,t,n){if(n=wialon.util.Helper.wrapCallback(n),"object"!=typeof t)return n(2);var r={owner:e,spec:t,callback:n,mode:1};this.__batchCalls?this.__batchCalls.push(r):this.__manageItems([r])},removeItems:function(e,t,n){if(n=wialon.util.Helper.wrapCallback(n),"object"!=typeof t)return n(2);var r={owner:e,spec:t,callback:n,mode:2};this.__batchCalls?this.__batchCalls.push(r):this.__manageItems([r])},getItemsByOwner:function(e,t){if("string"!=typeof e||!e.length)return[];var n=[];for(var r in this.__managedItems){var i=wialon.core.Session.getInstance().getItem(r);i&&(t&&t!=i.getType()||this.__managedItems[r][e]&&n.push(i))}return n},getItemDataFlags:function(e,t){if("string"!=typeof e||!e.length)return 0;var n=this.__managedItems[t];return n&&n[e]?n[e]:0},getItemByOwner:function(e,t){if("string"!=typeof e||!e.length)return null;var n=this.__managedItems[t];return n&&n[e]?wialon.core.Session.getInstance().getItem(t):null},startNewItemsChecking:function(e){if(!this.__newItemsCheckingStarted){if(e&&"object"==typeof e){var t=wialon.core.Session.getInstance().getClasses();for(var n in e)n in t&&(this.__checkNewItems[n]=1)}wialon.core.Session.getInstance().updateDataFlags([{type:"access",data:1,flags:0,mode:0}],qx.lang.Function.bind(function(e){e||(this.__newItemsCheckingStarted=!0)},this))}},stopNewItemsChecking:function(){this.__newItemsCheckingStarted&&wialon.core.Session.getInstance().updateDataFlags([{type:"access",data:0,flags:0,mode:0}],qx.lang.Function.bind(function(e){e||(this.__checkNewItems={},this.__newItemsCheckingStarted=!1)},this))},startItemsCreationChecking:function(e){void 0===this.__newItemsCheckers[e]&&(this.__newItemsCheckers[e]={},this.findNewItems(e,!0))},finishItemsCreationChecking:function(e){void 0!==this.__newItemsCheckers[e]&&delete this.__newItemsCheckers[e]},findNewItems:function(e,t,n,r){clearTimeout(this.__newItemsCheckingTimer),this.__newItemsCheckingTimer=null,wialon.core.Remote.getInstance().startBatch();var i=0;for(var a in!n||e in this.__newItemsCheckers||(this.__newItemsCheckers[e]={},i=1),this.__newItemsCheckers)if(!e||e==a){var s=qx.lang.Function.bind(function(e,t,n){if(!t){for(var i=[],a=[],s=0;s<n.items.length;s++){var o=n.items[s].getId();this.__newItemsCheckers[e.itemsType][o]||wialon.core.Session.getInstance().getItem(o)||(this.__newItemsCheckers[e.itemsType][o]=1,i.push({type:"id",data:o,flags:0,mode:0}),i.push({type:"id",data:o,flags:wialon.item.Item.dataFlag.base,mode:1}),a.push(o))}var l=!e.skipEvent&&a.length>0;l&&wialon.core.Session.getInstance().checkNewItems({ids:a,updateDataFlagsSpec:i},r);var c=0;for(var u in this.__newItemsCheckers[e.itemsType])c++;if(c>n.items.length)for(var u in this.__newItemsCheckers[e.itemsType]){var d=0;for(s=0;s<n.items.length;s++)if(n.items[s].getId()==u){d=u;break}d||(delete this.__newItemsCheckers[e.itemsType][u],this._onItemDeleted(this.getItem(u)))}for(s=0;s<n.items.length;s++){var p=n.items[s];p&&void 0!==p.dispose&&p.dispose()}l||"function"!=typeof r||r(null)}},this,{itemsType:a,skipEvent:t?1:0});wialon.core.Session.getInstance().searchItems({itemsType:a,propName:"*",propValueMask:"*",sortType:""},1,wialon.item.Item.dataFlag.base,0,4294967295,s)}wialon.core.Remote.getInstance().finishBatch(qx.lang.Function.bind(function(e,t,n){e&&t&&delete this.__newItemsCheckers[n],this.__newItemsCheckingTimer||e||(this.__newItemsCheckingTimer=setTimeout(qx.lang.Function.bind(this.findNewItems,this),1e3*this.__newItemsCheckingTimeout))},this,n,i,e))},__managedItems:{},__batchCalls:null,__newItemsCheckingTimer:null,__newItemsCheckers:{},__newItemsCheckingTimeout:600,__newItemsCheckingStarted:!1,__checkNewItems:{},__manageItems:function(e){if(!(!e instanceof Array)){wialon.core.Remote.getInstance().startBatch();for(var t=0;t<e.length;t++){var n=e[t];if("object"==typeof n)if(n.spec.mode=n.mode,1==n.mode){var r=qx.lang.Function.bind(this.__onItemsLoaded,this,n);wialon.core.Session.getInstance().updateDataFlags([n.spec],r)}else if(2==n.mode){var i=[];if("id"==n.spec.type)i.push(n.spec.data);else if("col"==n.spec.type)i=i.concat(n.spec.data);else if("type"==n.spec.type)for(var a in this.__managedItems){var s=wialon.core.Session.getInstance().getItem(a);s&&s.getType()==n.spec.data&&i.push(a)}if(!i.length)continue;var o={},l=n.spec.flags;for(t=0;t<i.length;t++){var c=this.__managedItems[i[t]];if(c&&c[n.owner]){var u=c[n.owner];"number"!=typeof u&&(u=0);var d=wialon.util.Number.and(u,l);if(c[n.owner]=wialon.util.Number.exclude(u,d),d)for(var p in c)if(Object.prototype.hasOwnProperty.call(c,p)){var g=c[p];d=wialon.util.Number.exclude(d,g)}d&&(o[i[t]]||(o[i[t]]={type:"id",data:i[t],flags:0,mode:2}),o[i[t]].flags=wialon.util.Number.or(o[i[t]].flags,d))}}for(var a in o)o.hasOwnProperty(a)&&wialon.core.Session.getInstance().updateDataFlags([o[a]]);n.callback&&n.callback()}}wialon.core.Remote.getInstance().finishBatch()}},__onItemsLoaded:function(e,t){if((new Date).getTime(),e){if(t)return e.callback?e.callback():null;var n=[];if("id"==e.spec.type)n.push(e.spec.data);else if("col"==e.spec.type)n=n.concat(e.spec.data);else if("type"==e.spec.type)for(var r=wialon.core.Session.getInstance().getItems(e.spec.data),i=0;i<r.length;i++)n.push(r[i].getId());for(i=0;i<n.length;i++){var a=n[i];this.__managedItems[a]||(this.__managedItems[a]={}),this.__managedItems[a][e.owner]||(this.__managedItems[a][e.owner]=0),this.__managedItems[a][e.owner]=wialon.util.Number.or(this.__managedItems[a][e.owner],e.spec.flags)}return e.callback?e.callback():null}}},events:{itemCreated:"qx.event.type.Event"}}),qx.Class.define("wialon.util.Routing",{type:"static",statics:{remoteOptimizeCourierRoute:function(e,t,n,r){return r=wialon.util.Helper.wrapCallback(r),wialon.core.Remote.getInstance().remoteCall("route/optimize",{pathMatrix:e,pointSchedules:t,flags:n},r)},remoteOptimizeFlag:{fitSchedule:1,optimizeDuration:2,optimizeTime:4,fixFirstPoint:8,fixLastPoint:16}}}),qx.Class.define("wialon.agro.Helper",{type:"static",statics:{getPlotsInPoint:function(e,t){return wialon.core.Remote.getInstance().remoteCall("agro/get_plots_by_point",{spec:e},wialon.util.Helper.wrapCallback(t))},getCultivations:function(e,t,n,r,i,a,s){var o=wialon.core.Session.getInstance().getRenderer();if(o){for(var l=o.getLayers(),c=l.length-1;c>=0;c--)l[c].getName()==i&&(l[c].dispose(),qx.lang.Array.remove(l,l[c]));return wialon.core.Remote.getInstance().remoteCall("agro/get_cultivations",{plotItemId:e,plotId:t,timeFrom:n,timeTo:r,layerName:void 0===i?"":i,paintingScheme:a||null},qx.lang.Function.bind(this.__onCreatedCultivationsLayer,this,wialon.util.Helper.wrapCallback(s)),300)}},getCultivationsList:function(e,t,n,r,i){return wialon.core.Remote.getInstance().remoteCall("agro/get_cultivations",{plotItemId:e,plotId:t,timeFrom:n,timeTo:r,layerName:"",paintingScheme:null},wialon.util.Helper.wrapCallback(i),300)},uploadCultivation:function(e,t,n,r){wialon.core.Uploader.getInstance().uploadFiles(e,"agro/upload_cultivation",{tzOffset:t,color:n,callMode:"upload"},qx.lang.Function.bind(this.__onCreatedUploadCultivationsLayer,this,wialon.util.Helper.wrapCallback(r)),!0)},updateCultivationLayer:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("agro/upload_cultivation",{time:e,action:t,color:n,callMode:"render"},qx.lang.Function.bind(this.__onUpdatedCultivationsLayer,this,wialon.util.Helper.wrapCallback(r)),300)},uploadUnitCultivation:function(e,t,n,r,i,a,s,o,l,c,u,d,p,g){return wialon.core.Remote.getInstance().remoteCall("agro/upload_cultivation",{unitId:e,timeFrom:t,timeTo:n,switchSensorId:r,widthSensorId:i,flags:a,tzOffset:s,color:o,defaultWidth:l,plotItemId:c,plotId:u,withinPlot:d?1:0,callMode:"uploadTrack",filter:p},qx.lang.Function.bind(this.__onCreatedUploadCultivationsLayer,this,wialon.util.Helper.wrapCallback(g)),300)},uploadPlot:function(e,t,n){wialon.core.Uploader.getInstance().uploadFiles(e,"agro/upload_plot",{tzOffset:t,callMode:"upload"},wialon.util.Helper.wrapCallback(n),!0)},uploadUnitPlot:function(e,t,n,r,i){return wialon.core.Remote.getInstance().remoteCall("agro/upload_plot",{unitId:e,timeFrom:t,timeTo:n,switchSensorId:r,callMode:"uploadTrack"},wialon.util.Helper.wrapCallback(i),300)},clearUploadedCultivation:function(e){return wialon.core.Remote.getInstance().remoteCall("agro/upload_cultivation",{callMode:"clear"},qx.lang.Function.bind(this.__onClearedCultivationsLayer,this,wialon.util.Helper.wrapCallback(e)),300)},registerUploadedCultivation:function(e,t,n,r,i,a,s,o,l,c,u,d,p,g){return wialon.core.Remote.getInstance().remoteCall("agro/upload_cultivation",{plotItemId:e,plotId:t,ctypeItemId:n,ctypeId:r,machineItemId:i,machineId:a,equipItemId:s,equipId:o,description:l,timeFrom:c,timeTo:u,unitId:d,fuelFlags:p,callMode:"register"},wialon.util.Helper.wrapCallback(g),300)},registerUnitCultivation:function(e,t,n,r,i,a,s,o,l,c,u,d,p,g,h){return wialon.core.Remote.getInstance().remoteCall("agro/upload_cultivation",{plotItemId:e,plotId:t,ctypeItemId:n,ctypeId:r,machineItemId:i,machineId:a,equipItemId:s,equipId:o,description:l,timeFrom:c,timeTo:u,tzOffset:d,unitId:p,filter:g,callMode:"register_ex"},wialon.util.Helper.wrapCallback(h),300)},createPlotsLayer:function(e,t,n,r){var i=wialon.core.Session.getInstance().getRenderer();if(i){for(var a=i.getLayers(),s=a.length-1;s>=0;s--)a[s].getName()==e&&(a[s].dispose(),qx.lang.Array.remove(a,a[s]));return wialon.core.Remote.getInstance().remoteCall("agro/create_plots_layer",{layerName:e,plots:t,flags:n},qx.lang.Function.bind(this.__onCreatedSimpleLayer,this,wialon.util.Helper.wrapCallback(r)),300)}},getPrintUrl:function(e){var t={};e&&"object"==typeof e?t=e:arguments.length>8&&(t.fileType=arguments[0],t.isPlotGroup=arguments[1],t.plots=arguments[2],t.imageFlags=arguments[3],t.plotFlags=arguments[4],arguments.length>9?(t.mapScale=arguments[5],t.font=arguments[6],t.fontSize=arguments[7],t.fontColor=arguments[8],t.lang=arguments[9]):(t.font=arguments[5],t.fontSize=arguments[6],t.fontColor=arguments[7],t.lang=arguments[8]),t.rnd=(new Date).getTime());var n=wialon.core.Session.getInstance();return n.getBaseUrl()+n.getApiPath()+"?sid="+n.getId()+"&svc=agro/print_plots&params="+wialon.util.Json.stringify(t)},getUnitSettings:function(e,t){return wialon.core.Remote.getInstance().remoteCall("agro/get_unit_settings",{itemId:this.getId()},wialon.util.Helper.wrapCallback(t),300)},updateUnitSettings:function(e,t,n,r,i){return wialon.core.Remote.getInstance().remoteCall("agro/update_unit_settings",{unitId:e,machineItemId:t,machineId:n,settings:r},wialon.util.Helper.wrapCallback(i),300)},convertPlots:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("agro/convert_plots",{resourceId:e,plots:t},wialon.util.Helper.wrapCallback(n),300)},updateCultivationMsg:function(e,t,n,r,i,a,s){return wialon.core.Remote.getInstance().remoteCall("agro/update_cultivation_msg",{plotItemId:e,plotId:t,timeFrom:n,timeTo:r,msgIndex:i,params:a},wialon.util.Helper.wrapCallback(s),300)},deleteCultivationMsg:function(e,t,n,r,i,a){return wialon.core.Remote.getInstance().remoteCall("agro/delete_cultivation_msg",{plotItemId:e,plotId:t,timeFrom:n,timeTo:r,msgIndex:i},wialon.util.Helper.wrapCallback(a),300)},getPlotsUrl:function(e,t,n){var r=wialon.core.Session.getInstance();return r.getBaseUrl()+r.getApiPath()+"?sid="+r.getId()+"&svc=agro/export_plots&params="+wialon.util.Json.stringify({fileName:e||"plots",plots:t,tzOffset:n})},importPlot:function(e,t,n){wialon.core.Uploader.getInstance().uploadFiles([e],"agro/import_plots",{tzOffset:t,callMode:"upload"},wialon.util.Helper.wrapCallback(n),!0)},registerPlots:function(e,t,n,r){return wialon.core.Remote.getInstance().remoteCall("agro/import_plots",{resourceId:e,groupId:t,config:n,callMode:"register"},wialon.util.Helper.wrapCallback(r),300)},getUnitsInPlots:function(e){return wialon.core.Remote.getInstance().remoteCall("agro/get_units_in_plots",{},wialon.util.Helper.wrapCallback(e),300)},print:{fileType:{svg:1,png:2},imageFlag:{a0:1,a1:2,a2:4,a3:8,a4:16,attachMap:32,colored:64},mapScale:{normal:0,x2:1,x4:2,x6:3,x8:4,x10:5,x20:6,x50:7,x100:8,x200:9,x400:10,x1000:11},font:{dejaVuSans:"DejaVuSans",dejaVuSansOblique:"DejaVuSans-Oblique",dejaVuSansBold:"DejaVuSans-Bold",dejaVuSansBoldOblique:"DejaVuSans-BoldOblique",arial:"Arial",arialBlack:"Arial Black",courierNew:"Courier New",comicSansMS:"Comic Sans MS",georgia:"Georgia",impact:"Impact",timesNewRoman:"Times New Roman",trebuchetMS:"Trebuchet MS",verdana:"Verdana"},plotFlag:{placementHorizontal:0,landscape:1,rotate90CCW:2,plotName:4,plotDescription:8,plotArea:16,usefulPlotArea:32,crop:64,placementVertical:128}},__onClearedCultivationsLayer:function(e,t,n){var r=wialon.core.Session.getInstance().getRenderer();if(r){if(0==t&&n){for(var i=r.getLayers(),a=i.length-1;a>=0;a--)i[a].getName()==n.layerName&&(i[a].dispose(),qx.lang.Array.remove(i,i[a]));r.setVersion(r.getVersion()+1)}e(t,n)}},__onCreatedSimpleLayer:function(e,t,n){var r=wialon.core.Session.getInstance().getRenderer();if(r){var i=null;0==t&&n&&(void 0!==n.name&&(i=new wialon.render.Layer(n),r.getLayers().push(i)),r.setVersion(r.getVersion()+1)),e(t,i)}},__onCreatedCultivationsLayer:function(e,t,n){var r=wialon.core.Session.getInstance().getRenderer();if(r){var i=null;0==t&&n&&n.layer&&(void 0!==n.layer.name&&(i=new wialon.render.Layer(n.layer),r.getLayers().push(i)),r.setVersion(r.getVersion()+1)),e(t,{layer:i,cultivation:n.cultivation})}},__onCreatedUploadCultivationsLayer:function(e,t,n){var r=wialon.core.Session.getInstance().getRenderer();if(r){var i=null;if(0==t&&n&&n.data&&n.data.layer){for(var a=r.getLayers(),s=a.length-1;s>=0;s--)a[s].getName()==n.data.layer.name&&(a[s].dispose(),qx.lang.Array.remove(a,a[s]));void 0!==n.data.layer.name&&(i=new wialon.render.Layer(n.data.layer),r.getLayers().push(i)),r.setVersion(r.getVersion()+1)}e(t,{layer:i,registrar:n&&n.data?n.data.registrar:[]})}},__onUpdatedCultivationsLayer:function(e,t,n){var r=wialon.core.Session.getInstance().getRenderer();r&&(r.setVersion(r.getVersion()+1),e(t,n))}}}),qx.Class.define("wialon.util.Geometry",{type:"static",statics:{getDistance:function(e,t,n,r){var i,a,s,o,l,c,u,d,p,g,h,m,f,_,v,x=Math.PI/180,b=1/298.257;return e==n&&t==r?0:(a=(e+n)/2,s=(e-n)/2,o=(t-r)/2,g=Math.sin(s*x),h=Math.cos(s*x),m=Math.sin(a*x),f=Math.cos(a*x),_=Math.sin(o*x),v=Math.cos(o*x),u=(d=Math.pow(g*v,2))+(p=Math.pow(f*_,2)),i=(d=Math.pow(h*v,2))+(p=Math.pow(m*_,2)),l=Math.atan(Math.sqrt(u/i)),c=Math.sqrt(u*i)/l,2*l*6378.137*((d=(d=m*h)*d*((3*c-1)/(2*i))*b+1)-(p=(p=f*g)*p*((3*c+1)/(2*u))*b))*1e3)},getCoordDegrees:function(e,t,n,r,i,a){return a||(a="&deg;"),e.toFixed(6)+a},getCoordMinutes:function(e,t,n,r,i,a){a||(a="&deg;");var s=Number(e),o=s<0?"-":"",l=s>0?r:i;s=Math.abs(s);var c=Math.floor(s),u=60*(s-c),d=String(u);u<10&&(d="0"+u);var p="";return 2==t?p=c>=0&&c<10?"0"+c:c:3==t&&(p=c>=0&&c<10?"00"+c:c>=10&&c<100?"0"+c:c),l+" "+(p=o+p)+a+" "+d.substr(0,n+3)+"'"},getCoord:function(e,t,n,r,i,a){return this.getCoordMinutes(e,t,n,r,i,a)},getDistanceToLine:function(e,t,n,r,i,a,s){if(e==n&&t==r)return this.getDistance(e,t,i,a);var o,l,c=0,u=0;return t!=r?u=(c=(a+(o=(e-n)/(t-r))*i-o*(l=e-t*o))/(o*o+1))*o+l:c=(u=(i+(o=(t-r)/(e-n))*a-o*(l=t-e*o))/(o*o+1))*o+l,s&&(c<t&&c<r||c>t&&c>r||u<e&&u<n||u>e&&u>n)?-1:this.getDistance(u,c,i,a)},pointInShape:function(e,t,n,r,i){if(!e||"object"!=typeof e)return!1;var a=e.length;if(e.length>2&&0==t){if(i&&!(r>=i.min_y&&r<=i.max_y&&n>=i.min_x&&n<=i.max_x))return;var s=0,o=0,l=0,c=0,u=0,d=0,p=0,g=0,h=!1;l=e[a-1].x,c=e[a-1].y;for(var m=0;m<a;m++)s=e[m].x,o=e[m].y,s>l?(u=l,p=s,d=c,g=o):(u=s,p=l,d=o,g=c),s<n==n<=l&&(r-d)*(p-u)<(g-d)*(n-u)&&(h=!h),l=s,c=o;return h}if(e.length>1&&t){if(i&&!(r>=i.min_y&&r<=i.max_y&&n>=i.min_x&&n<=i.max_x))return;var f=0,_=0;for(m=0;m<a;m++){var v=this.getDistance(e[m].y,e[m].x,r,n);if(t&&-1!=v&&v<=t)return!0;if(t){if(-1!=v&&v<=t/2)return!0;if(m>0&&-1!=(v=this.getDistanceToLine(e[m].y,e[m].x,f,_,r,n,!0))&&v<=t/2)return!0}f=e[m].y,_=e[m].x}}else if(1==e.length&&t){var x=e[0];if(-1!=(v=this.getDistance(x.y,x.x,r,n))&&v<=t)return!0}return!1},getShapeCenter:function(e){if(e&&"object"==typeof e){for(var t=e.length,n=4294967295,r=4294967295,i=-4294967295,a=-4294967295,s=0;s<t;s++)e[s].x<n&&(n=e[s].x),e[s].x>i&&(i=e[s].x),e[s].y<r&&(r=e[s].y),e[s].y>a&&(a=e[s].y);return{x:(i+n)/2,y:(a+r)/2}}},calculatePolygon:function(e,t,n){wialon.core.Remote.getInstance().remoteCall("render/calculate_polygon",{p:e,flags:t},wialon.util.Helper.wrapCallback(n))},calculatePolyline:function(e,t,n,r){wialon.core.Remote.getInstance().remoteCall("render/calculate_polyline",{p:e,flags:t,w:n},wialon.util.Helper.wrapCallback(r))},calculateBoundary:function(e){var t=0,n=0,r=0,i=0,a=0;if(!(t||n||r||i)){a=0;for(var s=0;s<e.length;s++){var o=e[s];t||n||r||i?(i>o.x&&(i=o.x),n<o.x&&(n=o.x),r>o.y&&(r=o.y),t<o.y&&(t=o.y),o.radius>a&&(a=o.w)):(r=o.y,t=o.y,i=o.x,n=o.x,a=o.w)}var l=wialon.util.Geometry.getDistance(r,i,r+1,i),c=wialon.util.Geometry.getDistance(r,i,r,i+1);l&&c&&(r-=a/l,i-=a/c,t+=a/l,n+=a/c)}return{min_y:r,min_x:i,max_y:t,max_x:n}}}}),qx.Class.define("wialon.exchange.Exchange",{type:"static",statics:{msgExportFormat:{plt:"plt",nmea:"txt",kml:"kml",wln:"wln",wlb:"wlb"},getJsonExportUrl:function(e,t){"string"==typeof t&&t.length||(t=(new Date).getTime());var n={json:e,fileName:t},r=wialon.core.Session.getInstance();return r.getBaseUrl()+r.getApiPath()+"?sid="+r.getId()+"&svc=exchange/export_json&params="+encodeURI(qx.lang.Json.stringify(n).replace(/&lt;/g,"<").replace(/&gt;/g,">"))},importJson:function(e,t){wialon.core.Uploader.getInstance().uploadFiles(e,"exchange/import_json",{},t,!0)},importXml:function(e,t){wialon.core.Uploader.getInstance().uploadFiles(e,"exchange/import_xml",{},t,!0)},importCsv:function(e,t,n){qx.lang.Type.isFunction(t)&&(n=t),qx.lang.Type.isString(t)||(t=","),n=wialon.util.Helper.wrapCallback(n),wialon.core.Uploader.getInstance().uploadFiles(e,"exchange/import_csv",{separator:t},n,!0)},getMessagesExportUrl:function(e,t,n){var r={layerName:e,format:t,compress:n},i=wialon.core.Session.getInstance();return i.getBaseUrl()+i.getApiPath()+"?sid="+i.getId()+"&svc=exchange/export_messages&params="+qx.lang.Json.stringify(r)},getPOIsExportUrl:function(e,t,n){if(!t||!t.length)return"";var r={fileName:e,pois:t,compress:n},i=wialon.core.Session.getInstance();return i.getBaseUrl()+i.getApiPath()+"?sid="+i.getId()+"&svc=exchange/export_pois&params="+qx.lang.Json.stringify(r)},getZonesExportUrl:function(e,t,n){if(!t||!t.length)return"";var r={fileName:e,zones:t,compress:n},i=wialon.core.Session.getInstance();return i.getBaseUrl()+i.getApiPath()+"?sid="+i.getId()+"&svc=exchange/export_zones&params="+qx.lang.Json.stringify(r)},importPois:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("exchange/import_pois_save",{itemId:e,pois:t},qx.lang.Function.bind(this.__onImportResult,this,n))},importZones:function(e,t,n){return wialon.core.Remote.getInstance().remoteCall("exchange/import_zones_save",{itemId:e,zones:t},qx.lang.Function.bind(this.__onImportResult,this,n))},getItemJson:function(e,t){return t=wialon.util.Helper.wrapCallback(t),wialon.core.Remote.getInstance().remoteCall("core/search_item",{id:e,flags:wialon.util.Number.umax()},qx.lang.Function.bind(t))},uploadTachoFile:function(e,t,n){wialon.core.Uploader.getInstance().uploadFiles(e,"resource/upload_tacho_file",{outputFlag:t},n,!0)},__onImportResult:function(e,t,n){!t&&n?e(0,n):e(t)}}}),qx.Class.define("wialon.util.Gis",{type:"static",statics:{geocodingFlags:{level_countries:1,level_regions:2,level_cities:3,level_streets:4,level_houses:5},searchFlags:{search_countries:0,search_regions:1,search_cities:2,search_streets:3,search_houses:4,search_full_path:256,search_map_name:512,search_coords:1024},searchByStringFlags:{search_countries:1,search_regions:2,search_cities:4,search_streets:8,search_houses:16},geocodingParams:{flags:0,city_radius:0,dist_from_unit:0,txt_dist:"",house_detect_radius:0},routingFlags:{CH:1},routingViaWaypointsFlags:{detailed_information_by_section:1},decodePoly:function(e){for(var t=[],n=0,r=(e=String(e)).length,i=0,a=0;n<r;){var s=0,o=0,l=0;do{o|=(31&(l=e.charCodeAt(n++)-63))<<s,s+=5}while(l>=32);i+=0!=(1&o)?~(o>>1):o>>1,s=0,o=0;do{o|=(31&(l=e.charCodeAt(n++)-63))<<s,s+=5}while(l>=32);var c={lat:i/1e5,lon:(a+=0!=(1&o)?~(o>>1):o>>1)/1e5};t.push(c)}return t},getRoute:function(e,t,n,r,i,a){return this.getRouteBetween({origin:{lat:e,lon:t},destination:{lat:n,lon:r},flags:i},a)},getRouteBetween:function(e,t){var n=e.origin,r=e.destination,i=e.waypoints,a=e.flags,s=e.params,o=e.searchProvider,l=this;t=wialon.util.Helper.wrapCallback(t),n&&r?i&&i.length?function(){if(i){var e={data:{origin:n,destination:r,waypoints:i,flags:a||0}},c=wialon.core.Session.getInstance().getCurrUser();c&&(e.uid=c.getId()),o&&(e.search_provider=o),s&&(e.params=s),wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseGisUrl("routing")+"/gis_get_route_via_waypoints",e,function(e,n){e?t(e,null):(n.points&&(n.points=l.decodePoly(n.points)),t(0,n))},wialon.core.Remote.getInstance().getTimeout())}else t&&t(2,null)}():function(){var e=n.lat,i=n.lon,c=r.lat,u=r.lon;if("number"==typeof e&&"number"==typeof i&&"number"==typeof c&&"number"==typeof u){"number"==typeof a&&a||(a=1);var d={lat1:e,lon1:i,lat2:c,lon2:u,flags:a},p=wialon.core.Session.getInstance().getCurrUser();p&&(d.uid=p.getId()),o&&(d.search_provider=o),s&&(d.params=s),wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseGisUrl("routing")+"/gis_get_route",d,function(e,n){e?t(e,null):(n.points&&(n.points=l.decodePoly(n.points)),t(0,n))},wialon.core.Remote.getInstance().getTimeout())}else t(2,null)}():t&&t(2,null)},getRouteViaWaypoints:function(e,t,n,r,i){if(r=wialon.util.Helper.wrapCallback(r),e&&t&&n){var a={data:{origin:e,destination:t,waypoints:n,flags:i||0}},s=wialon.core.Session.getInstance().getCurrUser();s&&(a.uid=s.getId());var o=this;wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseGisUrl("routing")+"/gis_get_route_via_waypoints",a,function(e,t){e?r(e,null):(t.points&&(t.points=o.decodePoly(t.points)),r(0,t))},wialon.core.Remote.getInstance().getTimeout())}else r&&r(2,null)},getManyToManyRoute:function(e,t){return this.manyToManyRouting({points:e},t)},manyToManyRouting:function(e,t){var n=e.points,r=e.searchProvider;t=wialon.util.Helper.wrapCallback(t);var i=[];if(Array.isArray(n)&&n.every(function(e){return!(!e||"number"!=typeof e.lat||"number"!=typeof e.lon||(i.push({lat:e.lat,lon:e.lon}),0))})){var a={data:{points:i}},s=wialon.core.Session.getInstance().getCurrUser();s&&(a.uid=s.getId()),r&&(a.search_provider=r);var o=this;wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseGisUrl("routing")+"/gis_get_many_to_many_route",a,function(e,n){e?t(e,null):(n.points&&(n.points=o.decodePoly(n.points)),t(0,n))},wialon.core.Remote.getInstance().getTimeout())}else t&&t(2,null)},getOneToManyRoute:function(e,t,n,r){if(r=wialon.util.Helper.wrapCallback(r),n&&n.length&&"number"==typeof e&&"number"==typeof t){var i={data:{lat:e,lon:t,points:n}},a=wialon.core.Session.getInstance().getCurrUser();a&&(i.uid=a.getId());var s=this;wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseGisUrl("routing")+"/gis_get_one_to_many_route",i,function(e,t){e?r(e,null):(t.points&&(t.points=s.decodePoly(t.points)),r(0,t))},wialon.core.Remote.getInstance().getTimeout())}else r&&r(2,null)},getLevelFlags:function(e,t,n,r,i){if(e<1||e>5)return 1255211008;var a=e<<28;return(t>0||t<6)&&(a+=t<<25),(n>0||n<6)&&(a+=n<<22),(r>0||r<6)&&(a+=r<<19),(i>0||i<6)&&(a+=i<<16),a},getLocations:function(e,t){return this.pointsToAddresses({positions:e},t)},pointsToAddresses:function(e,t){if(t=wialon.util.Helper.wrapCallback(t),e&&e.positions){var n=qx.lang.Object.clone(this.geocodingParams),r=e.positions;Array.isArray(r)&&(r=r.map(function(e){return{lat:e.lat,lon:e.lon}})),n.coords=wialon.util.Json.stringify(r),e.searchProvider&&(n.search_provider=e.searchProvider);var i=wialon.core.Session.getInstance().getCurrUser();i&&(n.uid=i.getId()),wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseGisUrl("geocode")+"/gis_geocode",n,t,wialon.core.Remote.getInstance().getTimeout())}else t(2,null)},searchByString:function(e,t,n,r){return this.addressToPoints({phrase:e,count:n,flags:t},r)},addressToPoints:function(e,t){t=wialon.util.Helper.wrapCallback(t);var n=e.phrase,r=e.count,i=e.flags||0;if("string"==typeof n&&"number"==typeof r){var a={phrase:n,flags:i,count:r};e.searchProvider&&(a.search_provider=e.searchProvider);var s=wialon.core.Session.getInstance().getCurrUser();s&&(a.uid=s.getId()),wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseGisUrl("search")+"/gis_searchintelli",a,t,wialon.core.Remote.getInstance().getTimeout())}else t(2,null)},searchByStringArray:function(e,t,n,r){if(r=wialon.util.Helper.wrapCallback(r),"[object Array]"===Object.prototype.toString.call(e)&&"number"==typeof n){var i={phrases:e,flags:t,count:n},a=wialon.core.Session.getInstance().getCurrUser();a&&(i.uid=a.getId()),wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseGisUrl("search")+"/gis_many_searchintelli",i,r,wialon.core.Remote.getInstance().getTimeout())}else r(2,null)},search:function(e,t,n,r,i,a,s){if(s=wialon.util.Helper.wrapCallback(s),"string"==typeof e&&"string"==typeof t&&"string"==typeof n&&"string"==typeof r){var o={country:e,region:t,city:n,street:r,flags:i,count:a},l=wialon.core.Session.getInstance().getCurrUser();l&&(o.uid=l.getId()),wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseGisUrl("search")+"/gis_search",o,s,wialon.core.Remote.getInstance().getTimeout())}else s(2,null)},copyright:function(e,t,n,r,i,a){if(a=wialon.util.Helper.wrapCallback(a),"number"==typeof e&&"number"==typeof t&&"number"==typeof n&&"number"==typeof r&&"number"==typeof i){var s={lat1:e,lon1:t,lat2:n,lon2:r,zoom:i},o=wialon.core.Session.getInstance().getCurrUser();o&&(s.uid=o.getId()),wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseGisUrl("render")+"/gis_copyright",s,a,wialon.core.Remote.getInstance().getTimeout())}else a(2,null)},checkPointForObject:function(e,t,n,r,i,a,s,o,l){if(l=wialon.util.Helper.wrapCallback(l),"number"==typeof e&&"number"==typeof t&&"string"==typeof n&&"string"==typeof r&&"string"==typeof i&&"string"==typeof a&&"number"==typeof o){var c={lat:e,lon:t,country:n,region:r,city:i,street:a,house:s,radius:o};wialon.core.Remote.getInstance().ajaxRequest(wialon.core.Session.getInstance().getBaseGisUrl("geocode")+"/gis_check_point",c,l,wialon.core.Remote.getInstance().getTimeout())}else l(2,null)}}}),qx.Class.define("wialon.util.Trash",{type:"static",statics:{getDeletedItems:function(e){e=wialon.util.Helper.wrapCallback(e);var t={callMode:"list"},n="account/trash";return wialon.core.Session.getInstance().isLocal()&&(n="admin/trash",t.creator="wialon"),wialon.core.Remote.getInstance().remoteCall(n,t,e)},restoreDeletedItems:function(e,t){if(t=wialon.util.Helper.wrapCallback(t),"object"!=typeof e)return t(2);var n={callMode:"restore",guids:e.guids},r="account/trash";return wialon.core.Session.getInstance().isLocal()&&(r="admin/trash",n.creator="wialon"),wialon.core.Remote.getInstance().remoteCall(r,n,t)}}}),qx.Class.define("wialon.core.Errors",{type:"static",statics:{getErrorText:function(e){switch(e){case 0:return"";case 1:return"Invalid session";case 2:return"Invalid service";case 3:return"Invalid result";case 4:return"Invalid input";case 5:return"Error performing request";case 6:break;case 7:return"Access denied";case 8:return"Invalid user name or password";case 9:return"Authorization server is unavailable, please try again later";case 10:return"Abort batch request";case 11:return"Invalid user name or e-mail";case 12:return"Subsystem not available";case 1001:return"No message for selected interval";case 1002:return"Item with such unique property already exists";case 1003:return"Only one request of given time is allowed at the moment";case 1004:return"Messages count has exceeded the limit";case 1005:return"Execution time has exceeded the limit";case 2001:return"Invalid input item or source account";case 2002:return"Destination resource is not an account";case 2003:return"Internal billing error";case 2004:return"Account is blocked";case 2005:return"Error getting creator of destination account";case 2006:return"Creator of destination account no access to item";case 2007:return"Error getting source account";case 2008:return"Item already in the destination account";case 2009:return"Error moving item on a tree parents";case 2010:return"Error operation in the billing";case 2011:return"Internal billing error";case 2012:return"Error changing account of the item";case 2013:return"Error changing creator of the item";case 2014:return"Selected user is a creator for some system objects, thus this user cannot be bound to a new account";case 2015:return"Item is locked"}return"Unknown error"}}}),qx.Class.define("wialon.util.File",{type:"static",statics:{fileStorageType:{publicType:1,protectedType:2},getFileURL:function(e,t,n){var r={itemId:e,path:t,flags:n},i=wialon.core.Session.getInstance();return i.getBaseUrl()+i.getApiPath()+"?sid="+wialon.core.Session.getInstance().getId()+"&svc=file/get_file&params="+wialon.util.Json.stringify(r)},listFiles:function(e,t,n,r,i){r=this.__checkFlags(r),wialon.core.Remote.getInstance().remoteCall("file/list_files",{itemId:e,path:t,mask:n,flags:r},wialon.util.Helper.wrapCallback(i))},rm:function(e,t,n,r){n=this.__checkFlags(n),wialon.core.Remote.getInstance().remoteCall("file/rm",{itemId:e,path:t,flags:n},wialon.util.Helper.wrapCallback(r))},putFiles:function(e,t,n,r,i,a){i=this.__checkFlags(i);var s={};s.itemId=e,s.path=t,s.flags=i,wialon.core.Uploader.getInstance().uploadFiles(n,"file/put_file",s,qx.lang.Function.bind(this.__uploadCallback,this,a),1,r)},readFile:function(e,t,n,r){n=this.__checkFlags(n),wialon.core.Remote.getInstance().remoteCall("file/read_file",{itemId:e,path:t,flags:n},wialon.util.Helper.wrapCallback(r))},writeFile:function(e,t,n,r,i){n=this.__checkFlags(n),wialon.core.Remote.getInstance().remoteCall("file/write_file",{itemId:e,path:t,flags:n,fileData:r},wialon.util.Helper.wrapCallback(i))},__uploadCallback:function(e,t,n){n&&this.__isKeyInObject(n,"error")&&this.__isKeyInObject(n,"files")?e(n.error,n.files):e(0,"{}")},__isKeyInObject:function(e,t){return e instanceof Object&&-1!==Object.keys(e).indexOf(t)},__checkFlags:function(e){var t=e;return t||(t=0),t}}}),qx.Class.define("wialon.util.DateTime",{type:"static",statics:{formatTime:function(e,t,n){if(!e||"number"!=typeof e)return"";var r=this,i=n;e=this.userTime(e);var a=new Date(1e3*e);if((!i||"string"!=typeof i)&&(i="yyyy-MM-dd HH:mm:ss",t)){var s=new Date(1e3*this.userTime(wialon.core.Session.getInstance().getServerTime()));(a.getUTCFullYear()==s.getUTCFullYear()&&a.getUTCMonth()==s.getUTCMonth()&&a.getUTCDate()==s.getUTCDate()||2==t)&&(i="HH:mm")}function o(e){var t,n=!1;return function(){return n?t:(t=e(),n=!0,t)}}i.indexOf("%")<0&&(i=this.convertFormat(i));var l={"%A":o(function(){return r.__locale.days[a.getUTCDay()]}),"%a":o(function(){return r.__locale.days_abbrev[a.getUTCDay()]}),"%E":o(function(){return r.__addZero(a.getUTCDate())}),"%e":o(function(){return a.getUTCDate()}),"%I":o(function(){return r.__addZero(a.getUTCHours()%12?a.getUTCHours()%12:12)}),"%M":o(function(){return r.__addZero(a.getUTCMinutes())}),"%S":o(function(){return r.__addZero(a.getUTCSeconds())}),"%p":o(function(){return a.getUTCHours()>=12?"pm":"am"}),"%Y":o(function(){return a.getUTCFullYear()}),"%y":o(function(){return r.__addZero(a.getUTCFullYear()%100)}),"%H":o(function(){return r.__addZero(a.getUTCHours())}),"%B":o(function(){return r.__locale.months[a.getUTCMonth()]}),"%b":o(function(){return r.__locale.months_abbrev[a.getUTCMonth()]}),"%m":o(function(){return r.__addZero(a.getUTCMonth()+1)}),"%l":o(function(){return a.getUTCMonth()+1}),"%P":o(function(){return r.persianFormatTime(r.absoluteTime(e))})};return i.replace(/%A|%a|%E|%e|%I|%M|%S|%p|%Y|%y|%H|%B|%b|%m|%l|%P/g,function(e){return l[e]()})},formatDate:function(e,t){if(!e||"number"!=typeof e)return"";var n=t;n&&"string"==typeof n||(n="yyyy-MM-dd"),e=this.userTime(e);var r=new Date(1e3*e);n.indexOf("%")<0&&(n=this.convertFormat(n));var i={"%A":this.__locale.days[r.getUTCDay()],"%a":this.__locale.days_abbrev[r.getUTCDay()],"%E":this.__addZero(r.getUTCDate()),"%e":r.getUTCDate(),"%Y":r.getUTCFullYear(),"%y":this.__addZero(r.getUTCFullYear()%100),"%B":this.__locale.months[r.getUTCMonth()],"%b":this.__locale.months_abbrev[r.getUTCMonth()],"%m":this.__addZero(r.getUTCMonth()+1),"%l":r.getUTCMonth()+1,"%P":this.persianFormatTime(this.absoluteTime(e))};for(var a in i)n=n.replace(new RegExp(a,"g"),i[a]);return n},formatDuration:function(e,t){var n="";if("number"!=typeof e||e<0)return n;t&&"string"==typeof t||(t="H:m:s");for(var r=this.getAbsoluteDaysDuration(e),i={d:r,l:this.getPluralForm(r),h:this.__addZero(this.getRelativeHoursDuration(e)),H:this.__addZero(this.getAbsoluteHoursDuration(e)),m:this.__addZero(this.getRelativeMinutesDuration(e)),M:this.__addZero(this.getAbsoluteHoursDuration(e)),s:this.__addZero(this.getRelativeSecondsDuration(e)),S:this.__addZero(this.getAbsoluteSecondsDuration(e))},a=0,s=t.length;a<s;a++){var o=t[a];i.hasOwnProperty(o)?n+=i[o]:n+=o}return n},getAbsoluteDaysDuration:function(e){return"number"!=typeof e||e<0?0:Math.floor(e/86400)},getPluralForm:function(e,t){return t||(t=this.__locale.days_plural),3===t.length?t[e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2]:""},getAbsoluteHoursDuration:function(e){return"number"!=typeof e||e<0?0:Math.floor(e/3600)},getRelativeHoursDuration:function(e){return"number"!=typeof e||e<0?0:Math.floor((e-86400*this.getAbsoluteDaysDuration(e))/3600)},getAbsoluteMinutesDuration:function(e){return"number"!=typeof e||e<0?0:Math.floor(e/60)},getRelativeMinutesDuration:function(e){if("number"!=typeof e||e<0)return 0;var t=this.getAbsoluteHoursDuration(e);return Math.floor((e-3600*t)/60)},getAbsoluteSecondsDuration:function(e){return"number"!=typeof e||e<0?0:e},getRelativeSecondsDuration:function(e){return"number"!=typeof e||e<0?"":e-60*this.getAbsoluteMinutesDuration(e)},persianFormatTime:function(e){if(!e||"number"!=typeof e)return"";e=this.userTime(e);var t=new Date(1e3*e),n=0,r=[31,28,31,30,31,30,31,31,30,31,30,31],i=[31,31,31,31,31,31,30,30,30,30,30,29],a=t.getUTCFullYear()-1600,s=365*a+parseInt((a+3)/4)-parseInt((a+99)/100)+parseInt((a+399)/400);for(n=0;n<t.getUTCMonth();n++)s+=r[n];t.getUTCMonth()>1&&(!(a%4)&&a%100||!(a%400))&&s++;var o=(s+=t.getUTCDate()-1)-79,l=parseInt(o/12053);o%=12053;var c=979+33*l+4*parseInt(o/1461);for((o%=1461)>=366&&(c+=parseInt((o-1)/365),o=(o-1)%365),n=0;n<11&&o>=i[n];n++)o-=i[n];return wialon.util.String.sprintf("%02d %s %04d %02d:%02d:%02d",o+1,["Farvardin","Ordibehest","Khordad","Tir","Mordad","Shahrivar","Mehr","Aban","Azar","Day","Bahman","Esfand"][n],c,t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())},setLocale:function(e,t,n,r,i){e instanceof Array&&(this.__locale.days=e),t instanceof Array&&(this.__locale.months=t),n instanceof Array&&(this.__locale.days_abbrev=n),r instanceof Array&&(this.__locale.months_abbrev=r),i instanceof Array&&(this.__locale.days_plural=i)},convertFormat:function(e,t){var n={HH:"%H",MMMM:"%B",MMM:"%b",MM:"%m",M:"%l",PC:"%P",dddd:"%A",ddd:"%a",dd:"%E",d:"%e",hh:"%I",mm:"%M",ss:"%S",tt:"%p",yyyy:"%Y",yy:"%y"},r={"%H":"HH","%B":"MMMM","%b":"MMM","%m":"MM","%l":"M","%P":"PC","%A":"dddd","%a":"ddd","%E":"dd","%e":"d","%I":"hh","%M":"mm","%S":"ss","%p":"tt","%Y":"yyyy","%y":"yy"};return t?e.replace(/%H|%B|%b|%m|%l|%P|%A|%a|%E|%e|%I|%M|%S|%p|%Y|%y/g,function(e){return r[e]}):e.replace(/HH|MMMM|MMM|MM|M|PC|dddd|ddd|dd|d|hh|mm|ss|tt|yyyy|yy/g,function(e){return n[e]})},getTimezone:function(){var e=60*-(new Date).getTimezoneOffset(),t=wialon.core.Session.getInstance().getCurrUser();return t?parseInt(t.getCustomProperty("tz",e))>>>0:e},getTimezoneOffset:function(){var e=this.getTimezone();return(e&this.__dstFlags.TZ_TYPE_MASK)!=this.__dstFlags.TZ_TYPE_WITH_DST?e&this.__dstFlags.TZ_OFFSET_MASK:parseInt(2147483648&e?65535&e|4294901760:65535&e)},getDSTOffset:function(e){if(!e)return 0;var t=this.getTimezone(),n=t&this.__dstFlags.TZ_TYPE_MASK,r=this.getTimezoneOffset(t);if(n==this.__dstFlags.TZ_TYPE_WITH_DST&&(t&this.__dstFlags.TZ_DST_TYPE_MASK)==this.__dstFlags.TZ_DST_TYPE_NONE||n!=this.__dstFlags.TZ_TYPE_WITH_DST&&t&this.__dstFlags.TZ_DISABLE_DST_BIT)return 0;if(n==this.__dstFlags.TZ_TYPE_WITH_DST&&(t&this.__dstFlags.TZ_DST_TYPE_MASK)==this.__dstFlags.TZ_DST_TYPE_SERVER||n!=this.__dstFlags.TZ_TYPE_WITH_DST){var i=new Date;i.setTime(1e3*e);var a=new Date;a.setTime(1e3*(e-7776e3));var s=new Date;return s.setTime(1e3*(e+1296e4)),i.getTimezoneOffset()<a.getTimezoneOffset()||i.getTimezoneOffset()<s.getTimezoneOffset()?3600:0}var o=t&this.__dstFlags.TZ_CUSTOM_DST_MASK,l=new Date(1e3*(e+r)),c=(l.getTime(),0),u=0,d=l.getUTCFullYear();if(void 0===this.__dstCache.from[o|d]||void 0===this.__dstCache.to[o|d]){switch(o){case this.__dstRules.DST_MAR2SUN2AM_NOV1SUN2AM:c=this.getWdayTime(d,2,2,0,0,2),u=this.getWdayTime(d,10,1,0,0,1);break;case this.__dstRules.DST_MAR6SUN_OCT6SUN:c=this.getWdayTime(d,2,6,0),u=this.getWdayTime(d,9,6,0);break;case this.__dstRules.DST_MAR6SUN1AM_OCT6SUN1AM:c=this.getWdayTime(d,2,6,0,0,1),u=this.getWdayTime(d,9,6,0,1);break;case this.__dstRules.DST_MAR6FRI_OCT6FRI:c=this.getWdayTime(d,2,6,5),u=this.getWdayTime(d,9,6,5);break;case this.__dstRules.DST_MAR6SUN2AM_OCT6SUN2AM:return c=this.getWdayTime(d,2,6,0,0,2),u=this.getWdayTime(d,9,6,0,0,2),e>1414281600?0:3600;case this.__dstRules.DST_MAR6FRI_OCT6FRI_SYRIA:c=this.getWdayTime(d,2,6,5),u=this.getWdayTime(d,9,6,5);break;case this.__dstRules.DST_APR1SUN2AM_OCT6SUN2AM:c=this.getWdayTime(d,3,1,0,0,2),u=this.getWdayTime(d,9,6,0,0,2);break;case this.__dstRules.DST_MAR2SUN_NOV1SUN:c=this.getWdayTime(d,2,2,0,0,0),u=this.getWdayTime(d,10,1,0,0,0);break;case this.__dstRules.DST_MAR21_22SUN_SEP20_21SUN:this.isLeapYear(d)?(c=this.getWdayTime(d,2,0,-1,21),u=this.getWdayTime(d,8,0,-1,20,23,0,0)):(c=this.getWdayTime(d,2,0,-1,22),u=this.getWdayTime(d,8,0,-1,21,23,0,0));break;case this.__dstRules.DST_SEP1SUN_APR1SUN:c=this.getWdayTime(d,8,1,0),u=this.getWdayTime(d,3,1,0);break;case this.__dstRules.DST_SEP6SUN_APR1SUN:c=this.getWdayTime(d,8,6,0,0,2),u=this.getWdayTime(d,3,1,0,0,2);break;case this.__dstRules.DST_AUG2SUN_MAY2SUN:e>1546315200?(c=this.getWdayTime(d,8,2,0,0,4),u=this.getWdayTime(d,3,1,0,0,4)):(c=this.getWdayTime(d,7,2,0),u=this.getWdayTime(d,4,2,0,0,-1));break;case this.__dstRules.DST_OCT3SUN_FEB3SUN:c=this.getWdayTime(d,9,3,0),u=this.getWdayTime(d,1,3,0,0,-1);break;case this.__dstRules.DST_OCT1SUN_MAR6SUN:c=this.getWdayTime(d,9,1,0),u=this.getWdayTime(d,2,6,0);break;case this.__dstRules.DST_OCT1SUN_MAR2SUN:c=this.getWdayTime(d,9,1,0),u=this.getWdayTime(d,2,2,0);break;case this.__dstRules.DST_OCT1SUN_APR1SUN:c=this.getWdayTime(d,9,1,0,0,2),u=this.getWdayTime(d,3,1,0,0,2);break;case this.__dstRules.DST_NOV1SUN_JAN3SUN:c=this.getWdayTime(d,10,1,0,0,2),u=this.getWdayTime(d,0,3,0,0,2);break;case this.__dstRules.DST_OCT1SUN_APR1SUN_TASMANIA:c=this.getWdayTime(d,9,1,0),u=this.getWdayTime(d,0,3,0);break;default:return 0}this.__dstCache.from[o|d]=c,u%2==0&&u--,this.__dstCache.to[o|d]=u}else c=this.__dstCache.from[o|d],u=this.__dstCache.to[o|d];var p=(t&this.__dstFlags.TZ_DST_TYPE_MASK)==this.__dstFlags.TZ_DST_TYPE_CUSTOM_UTC?c:c-r,g=(t&this.__dstFlags.TZ_DST_TYPE_MASK)==this.__dstFlags.TZ_DST_TYPE_CUSTOM_UTC?u:u-r;return o>=this.__dstRules.DST_SOUTHERN_SEMISPHERE?e<=p&&e>=g?0:3600:e>=p&&e<=g?3600:0},isLeapYear:function(e){return e%4==0&&e%100!=0||e%4==0&&e%100==0&&e%400==0},getWdayTime:function(e,t,n,r,i,a,s,o){var l=new Date;l.setUTCFullYear(e),l.setUTCMonth(t),l.setUTCDate(1),l.setUTCHours(0),l.setUTCMilliseconds(0),l.setUTCMinutes(0),l.setUTCSeconds(0);var c=0;if(-1==r)c=i;else if(c=l.getUTCDay()<=r?r-l.getUTCDay()+1:8-(l.getUTCDay()-r),n<6)if(i)for(;c<=i;)c+=7;else n&&(c+=7*(n-1));else c+=c+28<=this.getMonthDays(t,e)?28:21;return l.setUTCDate(c),a&&l.setUTCHours(a),s&&l.setUTCMinutes(s),o&&l.setUTCSeconds(o),parseInt(l.getTime()/1e3)},getMonthDays:function(e,t){if(e<0||!t)return 0;var n=[31,28,31,30,31,30,31,31,30,31,30,31];return e>=n.length?0:1==e&&365==this.getYearDays(t)?29:n[e]},getYearDays:function(e){return e?e%4==0?e%100==0?e%400==0?365:364:365:364:0},userTime:function(e){return e+this.getDSTOffset(e)+this.getTimezoneOffset()},absoluteTime:function(e){var t=e-this.getTimezoneOffset(),n=this.getDSTOffset(t);return n==this.getDSTOffset(t-3600)?t-n:t},calculateFlags:function(e,t){return e&&"number"==typeof e||(e=0),(!t||t<1||t>7)&&(t=1),t<<24|e},calculateInterval:function(e,t,n){var r=wialon.item.MReport.intervalFlag,i=wialon.core.Session.getInstance().getServerTime();n&r.useCurrentTime&&(t=i),n&(r.prevMinute|r.prevHour|r.prevDay|r.prevWeek|r.prevMonth|r.prevYear)&&(e=i);var a=new Date(1e3*this.userTime(e)),s=e-a.getUTCSeconds()-60*a.getUTCMinutes()-3600*a.getUTCHours();if(n&r.prevMinute)n&r.currTimeAndPrev?(e=(o=i)-60*t+1,t=o):(e=(o=s+3600*a.getUTCHours()+60*a.getUTCMinutes())-60*t,t=o-1);else if(n&r.prevHour){var o;n&r.currTimeAndPrev?(e=(o=i-i%60)-3600*t,t=o-1):(e=(o=s+3600*a.getUTCHours())-3600*t,t=o-1)}else if(n&r.prevDay)n&r.currTimeAndPrev?(e=s-86400*(t-1),t=i):(e=s-86400*t,t=s-1);else if(n&r.prevWeek){var l=(117440512&n)>>24;l||(l=1);var c=a.getUTCDay()-l,u=s-86400*(c>=0?c:7-Math.abs(c));n&r.currTimeAndPrev?(e=u-604800*(t-1),t=i):(e=u-604800*t,t=u-1)}else if(n&r.prevMonth){var d=a.getUTCMonth(),p=a.getUTCFullYear(),g=s-86400*(a.getUTCDate()-1);for(e=g,n&r.currTimeAndPrev&&(t-=1);t-- >0;){if(--d<0&&(d=11,0==--p))return;e-=86400*this.getMonthDays(d,p)}t=n&r.currTimeAndPrev?i:g-1}else if(n&r.prevYear){p=1970;for(var h=Math.floor(s/86400),m=this.getYearDays(p)+1;h>=m;)h-=m,m=this.getYearDays(++p)+1;var f=s-86400*++h;for(e=f,n&r.currTimeAndPrev&&(t-=1);t-- >0;){if(0==--p)return;e-=86400*(this.getYearDays(p)+1)}t=n&r.currTimeAndPrev?i:f-1}return{from:e,to:t}},__addZero:function(e){return e<10&&(e="0"+e),e},__dstFlags:{TZ_DISABLE_DST_BIT:1,TZ_TYPE_MASK:201326592,TZ_TYPE_WITH_DST:134217728,TZ_DST_TYPE_MASK:50331648,TZ_DST_TYPE_NONE:0,TZ_DST_TYPE_SERVER:16777216,TZ_DST_TYPE_CUSTOM:33554432,TZ_CUSTOM_DST_MASK:16711680,TZ_DST_TYPE_CUSTOM_UTC:50331648,TZ_OFFSET_MASK:4294967294},__dstRules:{DST_MAR2SUN2AM_NOV1SUN2AM:65536,DST_MAR6SUN_OCT6SUN:131072,DST_MAR6SUN1AM_OCT6SUN1AM:196608,DST_MAR6FRI_OCT6FRI:262144,DST_MAR6SUN2AM_OCT6SUN2AM:327680,DST_MAR6FRI_OCT6FRI_SYRIA:393216,DST_APR1SUN2AM_OCT6SUN2AM:458752,DST_MAR2SUN_NOV1SUN:524288,DST_APR6THU_SEP6THU:589824,DST_APR6THU_UNKNOWN:655360,DST_MAR21_22SUN_SEP20_21SUN:786432,DST_SOUTHERN_SEMISPHERE:2097152,DST_SEP1SUN_APR1SUN:2162688,DST_SEP6SUN_APR1SUN:2228224,DST_AUG2SUN_MAY2SUN:2293760,DST_OCT3SUN_FEB3SUN:2359296,DST_OCT1SUN_MAR6SUN:2424832,DST_OCT1SUN_MAR2SUN:2490368,DST_OCT1SUN_APR1SUN:2555904,DST_OCT1SUN_APR1SUN_TASMANIA:2621440,DST_NOV1SUN_JAN3SUN:2686976},__dstCache:{from:{},to:{}},__locale:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],days_abbrev:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months_abbrev:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days_plural:["day","days","days"]}}}),qx.$$loader.init()}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment