"undefined"==typeofgj&&(gj={}),gj.widget=function(){vara=this;a.xhr=null,a.generateGUID=function(){functiona(){returnMath.floor(65536*(1+Math.random())).toString(16).substring(1)}returna()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()},a.mouseX=function(a){if(a){if(a.pageX)returna.pageX;if(a.clientX)returna.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);if(a.touches&&a.touches.length)returna.touches[0].pageX;if(a.changedTouches&&a.changedTouches.length)returna.changedTouches[0].pageX;if(a.originalEvent&&a.originalEvent.touches&&a.originalEvent.touches.length)returna.originalEvent.touches[0].pageX;if(a.originalEvent&&a.originalEvent.changedTouches&&a.originalEvent.changedTouches.length)returna.originalEvent.touches[0].pageX}returnnull},a.mouseY=function(a){if(a){if(a.pageY)returna.pageY;if(a.clientY)returna.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);if(a.touches&&a.touches.length)returna.touches[0].pageY;if(a.changedTouches&&a.changedTouches.length)returna.changedTouches[0].pageY;if(a.originalEvent&&a.originalEvent.touches&&a.originalEvent.touches.length)returna.originalEvent.touches[0].pageY;if(a.originalEvent&&a.originalEvent.changedTouches&&a.originalEvent.changedTouches.length)returna.originalEvent.touches[0].pageY}returnnull}},gj.widget.prototype.init=function(a,b){varc,d,e;d=$.extend(!0,{},this.getHTMLConfig()||{}),$.extend(!0,d,a||{}),e=this.getConfig(d,b),this.attr("data-guid",e.guid),this.data(e);for(cine)gj[b].events.hasOwnProperty(c)&&(this.on(c,e[c]),deletee[c]);for(pluginingj[b].plugins)gj[b].plugins.hasOwnProperty(plugin)&&gj[b].plugins[plugin].configure(this,e,d);returnthis},gj.widget.prototype.getConfig=function(a,b){varc,d,e,f;c=$.extend(!0,{},gj[b].config.base),d=a.hasOwnProperty("uiLibrary")?a.uiLibrary:c.uiLibrary,gj[b].config[d]&&$.extend(!0,c,gj[b].config[d]),e=a.hasOwnProperty("iconsLibrary")?a.iconsLibrary:c.iconsLibrary,gj[b].config[e]&&$.extend(!0,c,gj[b].config[e]);for(fingj[b].plugins)gj[b].plugins.hasOwnProperty(f)&&($.extend(!0,c,gj[b].plugins[f].config.base),gj[b].plugins[f].config[d]&&$.extend(!0,c,gj[b].plugins[f].config[d]),gj[b].plugins[f].config[e]&&$.extend(!0,c,gj[b].plugins[f].config[e]));return$.extend(!0,c,a),c.guid||(c.guid=this.generateGUID()),c},gj.widget.prototype.getHTMLConfig=function(){vara=this.data(),b=this[0].attributes;returnb.width&&(a.width=b.width.nodeValue),b.height&&(a.height=b.height.nodeValue),b.align&&(a.align=b.align.nodeValue),a&&a.source&&(a.dataSource=a.source,deletea.source),a},gj.widget.prototype.createDoneHandler=function(){vara=this;returnfunction(b){"string"==typeofb&&JSON&&(b=JSON.parse(b)),gj[a.data("type")].methods.render(a,b)}},gj.widget.prototype.createErrorHandler=function(){returnfunction(a){a&&a.statusText&&"abort"!==a.statusText&&alert(a.statusText)}},gj.widget.prototype.reload=function(a){varb,c,d=this.data(),e=this.data("type");returnvoid0===d.dataSource&&gj[e].methods.useHtmlDataSource(this,d),$.extend(d.params,a),$.isArray(d.dataSource)?(c=gj[e].methods.filter(this),gj[e].methods.render(this,c)):"string"==typeofd.dataSource?(b={url:d.dataSource,data:d.params},this.xhr&&this.xhr.abort(),this.xhr=$.ajax(b).done(this.createDoneHandler()).fail(this.createErrorHandler())):"object"==typeofd.dataSource&&(d.dataSource.data||(d.dataSource.data={}),$.extend(d.dataSource.data,d.params),b=$.extend(!0,{},d.dataSource),"json"===b.dataType&&"object"==typeofb.data&&(b.data=JSON.stringify(b.data)),b.success||(b.success=this.createDoneHandler()),b.error||(b.error=this.createErrorHandler()),this.xhr&&this.xhr.abort(),this.xhr=$.ajax(b)),this},gj.documentManager={events:{},subscribeForEvent:function(a,b,c){if(gj.documentManager.events[a]&&0!==gj.documentManager.events[a].length){if(gj.documentManager.events[a][b])throw"Event "+a+" for widget with guid='"+b+"' is already attached.";gj.documentManager.events[a].push({widgetId:b,callback:c})}elsegj.documentManager.events[a]=[{widgetId:b,callback:c}],$(d