fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
1.5 MiB

/*! fineui */
function accAdd(a,b){var c,d,e,f;try{c=a.toString().split(".")[1].length}catch(g){c=0}try{d=b.toString().split(".")[1].length}catch(g){d=0}if(f=Math.abs(c-d),e=Math.pow(10,Math.max(c,d)),f>0){var h=Math.pow(10,f);c>d?(a=Number(a.toString().replace(".","")),b=Number(b.toString().replace(".",""))*h):(a=Number(a.toString().replace(".",""))*h,b=Number(b.toString().replace(".","")))}else a=Number(a.toString().replace(".","")),b=Number(b.toString().replace(".",""));return(a+b)/e}function accSub(a,b){var c,d,e,f;try{c=a.toString().split(".")[1].length}catch(g){c=0}try{d=b.toString().split(".")[1].length}catch(g){d=0}return e=Math.pow(10,Math.max(c,d)),f=c>=d?c:d,((a*e-b*e)/e).toFixed(f)}function accMul(a,b){var c=0,d=a.toString(),e=b.toString();try{c+=d.split(".")[1].length}catch(f){}try{c+=e.split(".")[1].length}catch(f){}return Number(d.replace(".",""))*Number(e.replace(".",""))/Math.pow(10,c)}function accDiv(arg1,arg2){var t1=0,t2=0,r1,r2;try{t1=arg1.toString().split(".")[1].length}catch(e){}try{t2=arg2.toString().split(".")[1].length}catch(e){}with(Math)return r1=Number(arg1.toString().replace(".","")),r2=Number(arg2.toString().replace(".","")),t2>t1?r1/r2*pow(10,t2-t1):r1/r2/pow(10,t1-t2)}!function(a,b){function c(a){var b=a.length,c=ia.type(a);return!ia.isWindow(a)&&(!(1!==a.nodeType||!b)||("array"===c||"function"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)))}function d(a){var b=xa[a]={};return ia.each(a.match(ka)||[],function(a,c){b[c]=!0}),b}function e(a,c,d,e){if(ia.acceptData(a)){var f,g,h=ia.expando,i="string"==typeof c,j=a.nodeType,k=j?ia.cache:a,l=j?a[h]:a[h]&&h;if(l&&k[l]&&(e||k[l].data)||!i||d!==b)return l||(j?a[h]=l=_.pop()||ia.guid++:l=h),k[l]||(k[l]={},j||(k[l].toJSON=ia.noop)),"object"!=typeof c&&"function"!=typeof c||(e?k[l]=ia.extend(k[l],c):k[l].data=ia.extend(k[l].data,c)),f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[ia.camelCase(c)]=d),i?(g=f[c],null==g&&(g=f[ia.camelCase(c)])):g=f,g}}function f(a,b,c){if(ia.acceptData(a)){var d,e,f,g=a.nodeType,i=g?ia.cache:a,j=g?a[ia.expando]:ia.expando;if(i[j]){if(b&&(f=c?i[j]:i[j].data)){ia.isArray(b)?b=b.concat(ia.map(b,ia.camelCase)):b in f?b=[b]:(b=ia.camelCase(b),b=b in f?[b]:b.split(" "));for(d=0,e=b.length;d<e;d++)delete f[b[d]];if(!(c?h:ia.isEmptyObject)(f))return}(c||(delete i[j].data,h(i[j])))&&(g?ia.cleanData([a],!0):ia.support.deleteExpando||i!=i.window?delete i[j]:i[j]=null)}}}function g(a,c,d){if(d===b&&1===a.nodeType){var e="data-"+c.replace(za,"-$1").toLowerCase();if(d=a.getAttribute(e),"string"==typeof d){try{d="true"===d||"false"!==d&&("null"===d?null:+d+""===d?+d:ya.test(d)?ia.parseJSON(d):d)}catch(f){}ia.data(a,c,d)}else d=b}return d}function h(a){var b;for(b in a)if(("data"!==b||!ia.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function i(){return!0}function j(){return!1}function k(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function l(a,b,c){if(b=b||0,ia.isFunction(b))return ia.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return ia.grep(a,function(a){return a===b===c});if("string"==typeof b){var d=ia.grep(a,function(a){return 1===a.nodeType});if(Ra.test(b))return ia.filter(b,d,!c);b=ia.filter(b,d)}return ia.grep(a,function(a){return ia.inArray(a,b)>=0===c})}function m(a){var b=Ua.split("|"),c=a.createDocumentFragment();if(c.createElement)for(;b.length;)c.createElement(b.pop());return c}function n(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function o(a){var b=a.getAttributeNode("type");return a.type=(b&&b.specified)+"/"+a.type,a}function p(a){var b=eb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function q(a,b){for(var c,d=0;null!=(c=a[d]);d++)ia._data(c,"globalEval",!b||ia._data(b[d],"globalEval"))}function r(a,b){if(1===b.nodeType&&ia.hasData(a)){var c,d,e,f=ia._data(a),g=ia._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)ia.event.add(b,c,h[c][d])}g.data&&(g.data=ia.extend({},g.data))}}function s(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!ia.support.noCloneEvent&&b[ia.expando]){e=ia._data(b);for(d in e.events)ia.removeEvent(b,d,e.handle);b.removeAttribute(ia.expando)}"script"===c&&b.text!==a.text?(o(b).text=a.text,p(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),ia.support.html5Clone&&a.innerHTML&&!ia.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&bb.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}}function t(a,c){var d,e,f=0,g=typeof a.getElementsByTagName!==V?a.getElementsByTagName(c||"*"):typeof a.querySelectorAll!==V?a.querySelectorAll(c||"*"):b;if(!g)for(g=[],d=a.childNodes||a;null!=(e=d[f]);f++)!c||ia.nodeName(e,c)?g.push(e):ia.merge(g,t(e,c));return c===b||c&&ia.nodeName(a,c)?ia.merge([a],g):g}function u(a){bb.test(a.type)&&(a.defaultChecked=a.checked)}function v(a,b){if(b in a)return b;for(var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=yb.length;e--;)if(b=yb[e]+c,b in a)return b;return d}function w(a,b){return a=b||a,"none"===ia.css(a,"display")||!ia.contains(a.ownerDocument,a)}function x(a,b){for(var c,d,e,f=[],g=0,h=a.length;g<h;g++)d=a[g],d.style&&(f[g]=ia._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&w(d)&&(f[g]=ia._data(d,"olddisplay",B(d.nodeName)))):f[g]||(e=w(d),(c&&"none"!==c||!e)&&ia._data(d,"olddisplay",e?c:ia.css(d,"display"))));for(g=0;g<h;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function y(a,b,c){var d=rb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function z(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;f<4;f+=2)"margin"===c&&(g+=ia.css(a,c+xb[f],!0,e)),d?("content"===c&&(g-=ia.css(a,"padding"+xb[f],!0,e)),"margin"!==c&&(g-=ia.css(a,"border"+xb[f]+"Width",!0,e))):(g+=ia.css(a,"padding"+xb[f],!0,e),"padding"!==c&&(g+=ia.css(a,"border"+xb[f]+"Width",!0,e)));return g}function A(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=kb(a),g=ia.support.boxSizing&&"border-box"===ia.css(a,"boxSizing",!1,f);if(e<=0||null==e){if(e=lb(a,b,f),(e<0||null==e)&&(e=a.style[b]),sb.test(e))return e;d=g&&(ia.support.boxSizingReliable||e===a.style[b]),e=parseFloat(e)||0}return e+z(a,b,c||(g?"border":"content"),d,f)+"px"}function B(a){var b=W,c=ub[a];return c||(c=C(a,b),"none"!==c&&c||(jb=(jb||ia("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(b.documentElement),b=(jb[0].contentWindow||jb[0].contentDocument).document,b.write("<!doctype html><html><body>"),b.close(),c=C(a,b),jb.detach()),ub[a]=c),c}function C(a,b){var c=ia(b.createElement(a)).appendTo(b.body),d=ia.css(c[0],"display");return c.remove(),d}function D(a,b,c,d){var e;if(ia.isArray(b))ia.each(b,function(b,e){c||Ab.test(a)?d(a,e):D(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==ia.type(b))d(a,b);else for(e in b)D(a+"["+e+"]",b[e],c,d)}function E(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(ka)||[];if(ia.isFunction(c))for(;d=f[e++];)"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function F(a,b,c,d){function e(h){var i;return f[h]=!0,ia.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||g||f[j]?g?!(i=j):void 0:(b.dataTypes.unshift(j),e(j),!1)}),i}var f={},g=a===Rb;return e(b.dataTypes[0])||!f["*"]&&e("*")}function G(a,c){var d,e,f=ia.ajaxSettings.flatOptions||{};for(e in c)c[e]!==b&&((f[e]?a:d||(d={}))[e]=c[e]);return d&&ia.extend(!0,a,d),a}function H(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(h in k)h in d&&(c[k[h]]=d[h]);for(;"*"===j[0];)j.shift(),f===b&&(f=a.mimeType||c.getResponseHeader("Content-Type"));if(f)for(h in i)if(i[h]&&i[h].test(f)){j.unshift(h);break}if(j[0]in d)g=j[0];else{for(h in d){if(!j[0]||a.converters[h+" "+j[0]]){g=h;break}e||(e=h)}g=g||e}if(g)return g!==j[0]&&j.unshift(g),d[g]}function I(a,b){var c,d,e,f,g={},h=0,i=a.dataTypes.slice(),j=i[0];if(a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i[1])for(e in a.converters)g[e.toLowerCase()]=a.converters[e];for(;d=i[++h];)if("*"!==d){if("*"!==j&&j!==d){if(e=g[j+" "+d]||g["* "+d],!e)for(c in g)if(f=c.split(" "),f[1]===d&&(e=g[j+" "+f[0]]||g["* "+f[0]])){e===!0?e=g[c]:g[c]!==!0&&(d=f[0],i.splice(h--,0,d));break}if(e!==!0)if(e&&a["throws"])b=e(b);else try{b=e(b)}catch(k){return{state:"parsererror",error:e?k:"No conversion from "+j+" to "+d}}}j=d}return{state:"success",data:b}}function J(){try{return new a.XMLHttpRequest}catch(b){}}function K(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function L(){return setTimeout(function(){$b=b}),$b=ia.now()}function M(a,b){ia.each(b,function(b,c){for(var d=(ec[b]||[]).concat(ec["*"]),e=0,f=d.length;e<f;e++)if(d[e].call(a,b,c))return})}function N(a,b,c){var d,e,f=0,g=dc.length,h=ia.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||L(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:ia.extend({},b),opts:ia.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||L(),duration:c.duration,tweens:[],createTween:function(b,c){var d=ia.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(O(k,j.opts.specialEasing);f<g;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return M(j,k),ia.isFunction(j.opts.start)&&j.opts.start.call(a,j),ia.fx.timer(ia.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function O(a,b){var c,d,e,f,g;for(e in a)if(d=ia.camelCase(e),f=b[d],c=a[e],ia.isArray(c)&&(f=c[1],c=a[e]=c[0]),e!==d&&(a[d]=c,delete a[e]),g=ia.cssHooks[d],g&&"expand"in g){c=g.expand(c),delete a[d];for(e in c)e in a||(a[e]=c[e],b[e]=f)}else b[d]=f}function P(a,b,c){var d,e,f,g,h,i,j,k,l,m=this,n=a.style,o={},p=[],q=a.nodeType&&w(a);c.queue||(k=ia._queueHooks(a,"fx"),null==k.unqueued&&(k.unqueued=0,l=k.empty.fire,k.empty.fire=function(){k.unqueued||l()}),k.unqueued++,m.always(function(){m.always(function(){k.unqueued--,ia.queue(a,"fx").length||k.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[n.overflow,n.overflowX,n.overflowY],"inline"===ia.css(a,"display")&&"none"===ia.css(a,"float")&&(ia.support.inlineBlockNeedsLayout&&"inline"!==B(a.nodeName)?n.zoom=1:n.display="inline-block")),c.overflow&&(n.overflow="hidden",ia.support.shrinkWrapBlocks||m.always(function(){n.overflow=c.overflow[0],n.overflowX=c.overflow[1],n.overflowY=c.overflow[2]}));for(e in b)if(g=b[e],ac.exec(g)){if(delete b[e],i=i||"toggle"===g,g===(q?"hide":"show"))continue;p.push(e)}if(f=p.length){h=ia._data(a,"fxshow")||ia._data(a,"fxshow",{}),"hidden"in h&&(q=h.hidden),i&&(h.hidden=!q),q?ia(a).show():m.done(function(){ia(a).hide()}),m.done(function(){var b;ia._removeData(a,"fxshow");for(b in o)ia.style(a,b,o[b])});for(e=0;e<f;e++)d=p[e],j=m.createTween(d,q?h[d]:0),o[d]=h[d]||ia.style(a,d),d in h||(h[d]=j.start,q&&(j.end=j.start,j.start="width"===d||"height"===d?1:0))}}function Q(a,b,c,d,e){return new Q.prototype.init(a,b,c,d,e)}function R(a,b){var c,d={height:a},e=0;for(b=b?1:0;e<4;e+=2-b)c=xb[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function S(a){return ia.isWindow(a)?a:9===a.nodeType&&(a.defaultView||a.parentWindow)}var T,U,V=typeof b,W=a.document,X=a.location,Y=a.jQuery,Z=a.$,$={},_=[],aa="1.9.1",ba=_.concat,ca=_.push,da=_.slice,ea=_.indexOf,fa=$.toString,ga=$.hasOwnProperty,ha=aa.trim,ia=function(a,b){return new ia.fn.init(a,b,U)},ja=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ka=/\S+/g,la=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ma=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,na=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,oa=/^[\],:{}\s]*$/,pa=/(?:^|:|,)(?:\s*\[)+/g,qa=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,ra=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,sa=/^-ms-/,ta=/-([\da-z])/gi,ua=function(a,b){return b.toUpperCase()},va=function(a){(W.addEventListener||"load"===a.type||"complete"===W.readyState)&&(wa(),ia.ready())},wa=function(){W.addEventListener?(W.removeEventListener("DOMContentLoaded",va,!1),a.removeEventListener("load",va,!1)):(W.detachEvent("onreadystatechange",va),a.detachEvent("onload",va))};ia.fn=ia.prototype={jquery:aa,constructor:ia,init:function(a,c,d){var e,f;if(!a)return this;if("string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:ma.exec(a),!e||!e[1]&&c)return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a);if(e[1]){if(c=c instanceof ia?c[0]:c,ia.merge(this,ia.parseHTML(e[1],c&&c.nodeType?c.ownerDocument||c:W,!0)),na.test(e[1])&&ia.isPlainObject(c))for(e in c)ia.isFunction(this[e])?this[e](c[e]):this.attr(e,c[e]);return this}if(f=W.getElementById(e[2]),f&&f.parentNode){if(f.id!==e[2])return d.find(a);this.length=1,this[0]=f}return this.context=W,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):ia.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),ia.makeArray(a,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return da.call(this)},get:function(a){return null==a?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a){var b=ia.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return ia.each(this,a,b)},ready:function(a){return ia.ready.promise().done(a),this},slice:function(){return this.pushStack(da.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},map:function(a){return this.pushStack(ia.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:ca,sort:[].sort,splice:[].splice},ia.fn.init.prototype=ia.fn,ia.extend=ia.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[1]||{},i=2),"object"==typeof h||ia.isFunction(h)||(h={}),j===i&&(h=this,--i);i<j;i++)if(null!=(f=arguments[i]))for(e in f)a=h[e],d=f[e],h!==d&&(k&&d&&(ia.isPlainObject(d)||(c=ia.isArray(d)))?(c?(c=!1,g=a&&ia.isArray(a)?a:[]):g=a&&ia.isPlainObject(a)?a:{},h[e]=ia.extend(k,g,d)):d!==b&&(h[e]=d));return h},ia.extend({noConflict:function(b){return a.$===ia&&(a.$=Z),b&&a.jQuery===ia&&(a.jQuery=Y),ia},isReady:!1,readyWait:1,holdReady:function(a){a?ia.readyWait++:ia.ready(!0)},ready:function(a){if(a===!0?!--ia.readyWait:!ia.isReady){if(!W.body)return setTimeout(ia.ready);ia.isReady=!0,a!==!0&&--ia.readyWait>0||(T.resolveWith(W,[ia]),ia.fn.trigger&&ia(W).trigger("ready").off("ready"))}},isFunction:function(a){return"function"===ia.type(a)},isArray:Array.isArray||function(a){return"array"===ia.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return null==a?String(a):"object"==typeof a||"function"==typeof a?$[fa.call(a)]||"object":typeof a},isPlainObject:function(a){if(!a||"object"!==ia.type(a)||a.nodeType||ia.isWindow(a))return!1;try{if(a.constructor&&!ga.call(a,"constructor")&&!ga.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||ga.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||W;var d=na.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=ia.buildFragment([a],b,e),e&&ia(e).remove(),ia.merge([],d.childNodes))},parseJSON:function(b){return a.JSON&&a.JSON.parse?a.JSON.parse(b):null===b?b:"string"==typeof b&&(b=ia.trim(b),b&&oa.test(b.replace(qa,"@").replace(ra,"]").replace(pa,"")))?new Function("return "+b)():void ia.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||"string"!=typeof c)return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return d&&d.documentElement&&!d.getElementsByTagName("parsererror").length||ia.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&ia.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(sa,"ms-").replace(ta,ua)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,d){var e,f=0,g=a.length,h=c(a);if(d){if(h)for(;f<g&&(e=b.apply(a[f],d),e!==!1);f++);else for(f in a)if(e=b.apply(a[f],d),e===!1)break}else if(h)for(;f<g&&(e=b.call(a[f],f,a[f]),e!==!1);f++);else for(f in a)if(e=b.call(a[f],f,a[f]),e===!1)break;return a},trim:ha&&!ha.call("\ufeff ")?function(a){return null==a?"":ha.call(a)}:function(a){return null==a?"":(a+"").replace(la,"")},makeArray:function(a,b){var d=b||[];return null!=a&&(c(Object(a))?ia.merge(d,"string"==typeof a?[a]:a):ca.call(d,a)),d},inArray:function(a,b,c){var d;if(b){if(ea)return ea.call(b,a,c);for(d=b.length,c=c?c<0?Math.max(0,d+c):c:0;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if("number"==typeof d)for(;f<d;f++)a[e++]=c[f];else for(;c[f]!==b;)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;for(c=!!c;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,b,d){var e,f=0,g=a.length,h=c(a),i=[];if(h)for(;f<g;f++)e=b(a[f],f,d),null!=e&&(i[i.length]=e);else for(f in a)e=b(a[f],f,d),null!=e&&(i[i.length]=e);return ba.apply([],i)},guid:1,proxy:function(a,c){var d,e,f;return"string"==typeof c&&(f=a[c],c=a,a=f),ia.isFunction(a)?(d=da.call(arguments,2),e=function(){return a.apply(c||this,d.concat(da.call(arguments)))},e.guid=a.guid=a.guid||ia.guid++,e):b},access:function(a,c,d,e,f,g,h){var i=0,j=a.length,k=null==d;if("object"===ia.type(d)){f=!0;for(i in d)ia.access(a,c,i,d[i],!0,g,h)}else if(e!==b&&(f=!0,ia.isFunction(e)||(h=!0),k&&(h?(c.call(a,e),c=null):(k=c,c=function(a,b,c){return k.call(ia(a),c)})),c))for(;i<j;i++)c(a[i],d,h?e:e.call(a[i],i,c(a[i],d)));return f?a:k?c.call(a):j?c(a[0],d):g},now:function(){return(new Date).getTime()}}),ia.ready.promise=function(b){if(!T)if(T=ia.Deferred(),"complete"===W.readyState)setTimeout(ia.ready);else if(W.addEventListener)W.addEventListener("DOMContentLoaded",va,!1),a.addEventListener("load",va,!1);else{W.attachEvent("onreadystatechange",va),a.attachEvent("onload",va);var c=!1;try{c=null==a.frameElement&&W.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!ia.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}wa(),ia.ready()}}()}return T.promise(b)},ia.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){$["[object "+b+"]"]=b.toLowerCase()}),U=ia(W);var xa={};ia.Callbacks=function(a){a="string"==typeof a?xa[a]||d(a):ia.extend({},a);var c,e,f,g,h,i,j=[],k=!a.once&&[],l=function(b){for(e=a.memory&&b,f=!0,h=i||0,i=0,g=j.length,c=!0;j&&h<g;h++)if(j[h].apply(b[0],b[1])===!1&&a.stopOnFalse){e=!1;break}c=!1,j&&(k?k.length&&l(k.shift()):e?j=[]:m.disable())},m={add:function(){if(j){var b=j.length;!function d(b){ia.each(b,function(b,c){var e=ia.type(c);"function"===e?a.unique&&m.has(c)||j.push(c):c&&c.length&&"string"!==e&&d(c)})}(arguments),c?g=j.length:e&&(i=b,l(e))}return this},remove:function(){return j&&ia.each(arguments,function(a,b){for(var d;(d=ia.inArray(b,j,d))>-1;)j.splice(d,1),c&&(d<=g&&g--,d<=h&&h--)}),this},has:function(a){return a?ia.inArray(a,j)>-1:!(!j||!j.length)},empty:function(){return j=[],this},disable:function(){return j=k=e=b,this},disabled:function(){return!j},lock:function(){return k=b,e||m.disable(),this},locked:function(){return!k},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],!j||f&&!k||(c?k.push(b):l(b)),this},fire:function(){return m.fireWith(this,arguments),this},fired:function(){return!!f}};return m},ia.extend({Deferred:function(a){var b=[["resolve","done",ia.Callbacks("once memory"),"resolved"],["reject","fail",ia.Callbacks("once memory"),"rejected"],["notify","progress",ia.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return ia.Deferred(function(c){ia.each(b,function(b,f){var g=f[0],h=ia.isFunction(a[b])&&a[b];e[f[1]](function(){var a=h&&h.apply(this,arguments);a&&ia.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[g+"With"](this===d?c.promise():this,h?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?ia.extend(a,d):d}},e={};return d.pipe=d.then,ia.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b,c,d,e=0,f=da.call(arguments),g=f.length,h=1!==g||a&&ia.isFunction(a.promise)?g:0,i=1===h?a:ia.Deferred(),j=function(a,c,d){return function(e){c[a]=this,d[a]=arguments.length>1?da.call(arguments):e,d===b?i.notifyWith(c,d):--h||i.resolveWith(c,d)}};if(g>1)for(b=new Array(g),c=new Array(g),d=new Array(g);e<g;e++)f[e]&&ia.isFunction(f[e].promise)?f[e].promise().done(j(e,d,f)).fail(i.reject).progress(j(e,c,b)):--h;return h||i.resolveWith(d,f),i.promise()}}),ia.support=function(){var b,c,d,e,f,g,h,i,j,k,l=W.createElement("div");if(l.setAttribute("className","t"),l.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=l.getElementsByTagName("*"),d=l.getElementsByTagName("a")[0],!c||!d||!c.length)return{};f=W.createElement("select"),h=f.appendChild(W.createElement("option")),e=l.getElementsByTagName("input")[0],d.style.cssText="top:1px;float:left;opacity:.5",b={getSetAttribute:"t"!==l.className,leadingWhitespace:3===l.firstChild.nodeType,tbody:!l.getElementsByTagName("tbody").length,htmlSerialize:!!l.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:"/a"===d.getAttribute("href"),opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:!!e.value,optSelected:h.selected,enctype:!!W.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==W.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===W.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},e.checked=!0,b.noCloneChecked=e.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!h.disabled;try{delete l.test}catch(m){b.deleteExpando=!1}e=W.createElement("input"),e.setAttribute("value",""),b.input=""===e.getAttribute("value"),e.value="t",e.setAttribute("type","radio"),b.radioValue="t"===e.value,e.setAttribute("checked","t"),e.setAttribute("name","t"),g=W.createDocumentFragment(),g.appendChild(e),b.appendChecked=e.checked,b.checkClone=g.cloneNode(!0).cloneNode(!0).lastChild.checked,l.attachEvent&&(l.attachEvent("onclick",function(){b.noCloneEvent=!1}),l.cloneNode(!0).click());for(k in{submit:!0,change:!0,focusin:!0})l.setAttribute(i="on"+k,"t"),b[k+"Bubbles"]=i in a||l.attributes[i].expando===!1;return l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",b.clearCloneStyle="content-box"===l.style.backgroundClip,ia(function(){var c,d,e,f="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",g=W.getElementsByTagName("body")[0];g&&(c=W.createElement("div"),c.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",g.appendChild(c).appendChild(l),l.innerHTML="<table><tr><td></td><td>t</td></tr></table>",e=l.getElementsByTagName("td"),e[0].style.cssText="padding:0;margin:0;border:0;display:none",j=0===e[0].offsetHeight,e[0].style.display="",e[1].style.display="none",b.reliableHiddenOffsets=j&&0===e[0].offsetHeight,l.innerHTML="",l.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=4===l.offsetWidth,b.doesNotIncludeMarginInBodyOffset=1!==g.offsetTop,a.getComputedStyle&&(b.pixelPosition="1%"!==(a.getComputedStyle(l,null)||{}).top,b.boxSizingReliable="4px"===(a.getComputedStyle(l,null)||{width:"4px"}).width,d=l.appendChild(W.createElement("div")),d.style.cssText=l.style.cssText=f,d.style.marginRight=d.style.width="0",l.style.width="1px",b.reliableMarginRight=!parseFloat((a.getComputedStyle(d,null)||{}).marginRight)),typeof l.style.zoom!==V&&(l.innerHTML="",l.style.cssText=f+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=3===l.offsetWidth,l.style.display="block",l.innerHTML="<div></div>",l.firstChild.style.width="5px",b.shrinkWrapBlocks=3!==l.offsetWidth,b.inlineBlockNeedsLayout&&(g.style.zoom=1)),g.removeChild(c),c=l=e=d=null)}),c=f=g=h=d=e=null,b}();var ya=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,za=/([A-Z])/g;ia.extend({cache:{},expando:"jQuery"+(aa+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?ia.cache[a[ia.expando]]:a[ia.expando],!!a&&!h(a)},data:function(a,b,c){return e(a,b,c)},removeData:function(a,b){return f(a,b)},_data:function(a,b,c){return e(a,b,c,!0)},_removeData:function(a,b){return f(a,b,!0)},acceptData:function(a){if(a.nodeType&&1!==a.nodeType&&9!==a.nodeType)return!1;var b=a.nodeName&&ia.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),ia.fn.extend({data:function(a,c){var d,e,f=this[0],h=0,i=null;if(a===b){if(this.length&&(i=ia.data(f),1===f.nodeType&&!ia._data(f,"parsedAttrs"))){for(d=f.attributes;h<d.length;h++)e=d[h].name,e.indexOf("data-")||(e=ia.camelCase(e.slice(5)),g(f,e,i[e]));ia._data(f,"parsedAttrs",!0)}return i}return"object"==typeof a?this.each(function(){ia.data(this,a)}):ia.access(this,function(c){return c===b?f?g(f,a,ia.data(f,a)):null:void this.each(function(){ia.data(this,a,c)})},null,c,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){ia.removeData(this,a)})}}),ia.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=ia._data(a,b),c&&(!d||ia.isArray(c)?d=ia._data(a,b,ia.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=ia.queue(a,b),d=c.length,e=c.shift(),f=ia._queueHooks(a,b),g=function(){ia.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),f.cur=e,e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return ia._data(a,c)||ia._data(a,c,{empty:ia.Callbacks("once memory").add(function(){ia._removeData(a,b+"queue"),ia._removeData(a,c)})})}}),ia.fn.extend({queue:function(a,c){var d=2;return"string"!=typeof a&&(c=a,a="fx",d--),arguments.length<d?ia.queue(this[0],a):c===b?this:this.each(function(){var b=ia.queue(this,a,c);ia._queueHooks(this,a),"fx"===a&&"inprogress"!==b[0]&&ia.dequeue(this,a)})},dequeue:function(a){return this.each(function(){ia.dequeue(this,a)})},delay:function(a,b){return a=ia.fx?ia.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=ia.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};for("string"!=typeof a&&(c=a,a=b),a=a||"fx";h--;)d=ia._data(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var Aa,Ba,Ca=/[\t\r\n]/g,Da=/\r/g,Ea=/^(?:input|select|textarea|button|object)$/i,Fa=/^(?:a|area)$/i,Ga=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,Ha=/^(?:checked|selected)$/i,Ia=ia.support.getSetAttribute,Ja=ia.support.input;ia.fn.extend({attr:function(a,b){return ia.access(this,ia.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){ia.removeAttr(this,a)})},prop:function(a,b){return ia.access(this,ia.prop,a,b,arguments.length>1)},removeProp:function(a){return a=ia.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g=0,h=this.length,i="string"==typeof a&&a;if(ia.isFunction(a))return this.each(function(b){ia(this).addClass(a.call(this,b,this.className))});if(i)for(b=(a||"").match(ka)||[];g<h;g++)if(c=this[g],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(Ca," "):" ")){for(f=0;e=b[f++];)d.indexOf(" "+e+" ")<0&&(d+=e+" ");c.className=ia.trim(d)}return this},removeClass:function(a){var b,c,d,e,f,g=0,h=this.length,i=0===arguments.length||"string"==typeof a&&a;if(ia.isFunction(a))return this.each(function(b){ia(this).removeClass(a.call(this,b,this.className))});if(i)for(b=(a||"").match(ka)||[];g<h;g++)if(c=this[g],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(Ca," "):"")){for(f=0;e=b[f++];)for(;d.indexOf(" "+e+" ")>=0;)d=d.replace(" "+e+" "," ");c.className=a?ia.trim(d):""}return this},toggleClass:function(a,b){var c=typeof a,d="boolean"==typeof b;return ia.isFunction(a)?this.each(function(c){ia(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if("string"===c)for(var e,f=0,g=ia(this),h=b,i=a.match(ka)||[];e=i[f++];)h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e);else c!==V&&"boolean"!==c||(this.className&&ia._data(this,"__className__",this.className),this.className=this.className||a===!1?"":ia._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;c<d;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(Ca," ").indexOf(b)>=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];{if(arguments.length)return e=ia.isFunction(a),this.each(function(c){var f,g=ia(this);1===this.nodeType&&(f=e?a.call(this,c,g.val()):a,null==f?f="":"number"==typeof f?f+="":ia.isArray(f)&&(f=ia.map(f,function(a){return null==a?"":a+""})),d=ia.valHooks[this.type]||ia.valHooks[this.nodeName.toLowerCase()],d&&"set"in d&&d.set(this,f,"value")!==b||(this.value=f))});if(f)return d=ia.valHooks[f.type]||ia.valHooks[f.nodeName.toLowerCase()],d&&"get"in d&&(c=d.get(f,"value"))!==b?c:(c=f.value,"string"==typeof c?c.replace(Da,""):null==c?"":c)}}}),ia.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||e<0,g=f?null:[],h=f?e+1:d.length,i=e<0?h:f?e:0;i<h;i++)if(c=d[i],(c.selected||i===e)&&(ia.support.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!ia.nodeName(c.parentNode,"optgroup"))){if(b=ia(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c=ia.makeArray(b);return ia(a).find("option").each(function(){this.selected=ia.inArray(ia(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attr:function(a,c,d){var e,f,g,h=a.nodeType;if(a&&3!==h&&8!==h&&2!==h)return typeof a.getAttribute===V?ia.prop(a,c,d):(f=1!==h||!ia.isXMLDoc(a),f&&(c=c.toLowerCase(),e=ia.attrHooks[c]||(Ga.test(c)?Ba:Aa)),d===b?e&&f&&"get"in e&&null!==(g=e.get(a,c))?g:(typeof a.getAttribute!==V&&(g=a.getAttribute(c)),null==g?b:g):null!==d?e&&f&&"set"in e&&(g=e.set(a,d,c))!==b?g:(a.setAttribute(c,d+""),d):void ia.removeAttr(a,c))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(ka);if(f&&1===a.nodeType)for(;c=f[e++];)d=ia.propFix[c]||c,
Ga.test(c)?!Ia&&Ha.test(c)?a[ia.camelCase("default-"+c)]=a[d]=!1:a[d]=!1:ia.attr(a,c,""),a.removeAttribute(Ia?c:d)},attrHooks:{type:{set:function(a,b){if(!ia.support.radioValue&&"radio"===b&&ia.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(a&&3!==h&&8!==h&&2!==h)return g=1!==h||!ia.isXMLDoc(a),g&&(c=ia.propFix[c]||c,f=ia.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&null!==(e=f.get(a,c))?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):Ea.test(a.nodeName)||Fa.test(a.nodeName)&&a.href?0:b}}}}),Ba={get:function(a,c){var d=ia.prop(a,c),e="boolean"==typeof d&&a.getAttribute(c),f="boolean"==typeof d?Ja&&Ia?null!=e:Ha.test(c)?a[ia.camelCase("default-"+c)]:!!e:a.getAttributeNode(c);return f&&f.value!==!1?c.toLowerCase():b},set:function(a,b,c){return b===!1?ia.removeAttr(a,c):Ja&&Ia||!Ha.test(c)?a.setAttribute(!Ia&&ia.propFix[c]||c,c):a[ia.camelCase("default-"+c)]=a[c]=!0,c}},Ja&&Ia||(ia.attrHooks.value={get:function(a,c){var d=a.getAttributeNode(c);return ia.nodeName(a,"input")?a.defaultValue:d&&d.specified?d.value:b},set:function(a,b,c){return ia.nodeName(a,"input")?void(a.defaultValue=b):Aa&&Aa.set(a,b,c)}}),Ia||(Aa=ia.valHooks.button={get:function(a,c){var d=a.getAttributeNode(c);return d&&("id"===c||"name"===c||"coords"===c?""!==d.value:d.specified)?d.value:b},set:function(a,c,d){var e=a.getAttributeNode(d);return e||a.setAttributeNode(e=a.ownerDocument.createAttribute(d)),e.value=c+="","value"===d||c===a.getAttribute(d)?c:b}},ia.attrHooks.contenteditable={get:Aa.get,set:function(a,b,c){Aa.set(a,""!==b&&b,c)}},ia.each(["width","height"],function(a,b){ia.attrHooks[b]=ia.extend(ia.attrHooks[b],{set:function(a,c){if(""===c)return a.setAttribute(b,"auto"),c}})})),ia.support.hrefNormalized||(ia.each(["href","src","width","height"],function(a,c){ia.attrHooks[c]=ia.extend(ia.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return null==d?b:d}})}),ia.each(["href","src"],function(a,b){ia.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}})),ia.support.style||(ia.attrHooks.style={get:function(a){return a.style.cssText||b},set:function(a,b){return a.style.cssText=b+""}}),ia.support.optSelected||(ia.propHooks.selected=ia.extend(ia.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),ia.support.enctype||(ia.propFix.enctype="encoding"),ia.support.checkOn||ia.each(["radio","checkbox"],function(){ia.valHooks[this]={get:function(a){return null===a.getAttribute("value")?"on":a.value}}}),ia.each(["radio","checkbox"],function(){ia.valHooks[this]=ia.extend(ia.valHooks[this],{set:function(a,b){if(ia.isArray(b))return a.checked=ia.inArray(ia(a).val(),b)>=0}})});var Ka=/^(?:input|select|textarea)$/i,La=/^key/,Ma=/^(?:mouse|contextmenu)|click/,Na=/^(?:focusinfocus|focusoutblur)$/,Oa=/^([^.]*)(?:\.(.+)|)$/;ia.event={global:{},add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r=ia._data(a);if(r){for(d.handler&&(j=d,d=j.handler,f=j.selector),d.guid||(d.guid=ia.guid++),(h=r.events)||(h=r.events={}),(l=r.handle)||(l=r.handle=function(a){return typeof ia===V||a&&ia.event.triggered===a.type?b:ia.event.dispatch.apply(l.elem,arguments)},l.elem=a),c=(c||"").match(ka)||[""],i=c.length;i--;)g=Oa.exec(c[i])||[],o=q=g[1],p=(g[2]||"").split(".").sort(),k=ia.event.special[o]||{},o=(f?k.delegateType:k.bindType)||o,k=ia.event.special[o]||{},m=ia.extend({type:o,origType:q,data:e,handler:d,guid:d.guid,selector:f,needsContext:f&&ia.expr.match.needsContext.test(f),namespace:p.join(".")},j),(n=h[o])||(n=h[o]=[],n.delegateCount=0,k.setup&&k.setup.call(a,e,p,l)!==!1||(a.addEventListener?a.addEventListener(o,l,!1):a.attachEvent&&a.attachEvent("on"+o,l))),k.add&&(k.add.call(a,m),m.handler.guid||(m.handler.guid=d.guid)),f?n.splice(n.delegateCount++,0,m):n.push(m),ia.event.global[o]=!0;a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=ia.hasData(a)&&ia._data(a);if(q&&(k=q.events)){for(b=(b||"").match(ka)||[""],j=b.length;j--;)if(h=Oa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){for(l=ia.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=k[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;f--;)g=m[f],!e&&p!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||ia.removeEvent(a,n,q.handle),delete k[n])}else for(n in k)ia.event.remove(a,n+b[j],c,d,!0);ia.isEmptyObject(k)&&(delete q.handle,ia._removeData(a,"events"))}},trigger:function(c,d,e,f){var g,h,i,j,k,l,m,n=[e||W],o=ga.call(c,"type")?c.type:c,p=ga.call(c,"namespace")?c.namespace.split("."):[];if(i=l=e=e||W,3!==e.nodeType&&8!==e.nodeType&&!Na.test(o+ia.event.triggered)&&(o.indexOf(".")>=0&&(p=o.split("."),o=p.shift(),p.sort()),h=o.indexOf(":")<0&&"on"+o,c=c[ia.expando]?c:new ia.Event(o,"object"==typeof c&&c),c.isTrigger=!0,c.namespace=p.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,c.result=b,c.target||(c.target=e),d=null==d?[c]:ia.makeArray(d,[c]),k=ia.event.special[o]||{},f||!k.trigger||k.trigger.apply(e,d)!==!1)){if(!f&&!k.noBubble&&!ia.isWindow(e)){for(j=k.delegateType||o,Na.test(j+o)||(i=i.parentNode);i;i=i.parentNode)n.push(i),l=i;l===(e.ownerDocument||W)&&n.push(l.defaultView||l.parentWindow||a)}for(m=0;(i=n[m++])&&!c.isPropagationStopped();)c.type=m>1?j:k.bindType||o,g=(ia._data(i,"events")||{})[c.type]&&ia._data(i,"handle"),g&&g.apply(i,d),g=h&&i[h],g&&ia.acceptData(i)&&g.apply&&g.apply(i,d)===!1&&c.preventDefault();if(c.type=o,!f&&!c.isDefaultPrevented()&&(!k._default||k._default.apply(e.ownerDocument,d)===!1)&&("click"!==o||!ia.nodeName(e,"a"))&&ia.acceptData(e)&&h&&e[o]&&!ia.isWindow(e)){l=e[h],l&&(e[h]=null),ia.event.triggered=o;try{e[o]()}catch(q){}ia.event.triggered=b,l&&(e[h]=l)}return c.result}},dispatch:function(a){a=ia.event.fix(a);var c,d,e,f,g,h=[],i=da.call(arguments),j=(ia._data(this,"events")||{})[a.type]||[],k=ia.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){for(h=ia.event.handlers.call(this,a,j),c=0;(f=h[c++])&&!a.isPropagationStopped();)for(a.currentTarget=f.elem,g=0;(e=f.handlers[g++])&&!a.isImmediatePropagationStopped();)if(!a.namespace_re||a.namespace_re.test(e.namespace)){a.handleObj=e,a.data=e.data;var l=(ia.event.special[e.origType]||{}).handle||e.handler;l.apply&&(d=l.apply(f.elem,i)),d!==b&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation())}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,c){var d,e,f,g,h=[],i=c.delegateCount,j=a.target;if(i&&j.nodeType&&(!a.button||"click"!==a.type))for(;j!=this;j=j.parentNode||this)if(1===j.nodeType&&(j.disabled!==!0||"click"!==a.type)){for(f=[],g=0;g<i;g++)e=c[g],d=e.selector+" ",f[d]===b&&(f[d]=e.needsContext?ia(d,this).index(j)>=0:ia.find(d,this,null,[j]).length),f[d]&&f.push(e);f.length&&h.push({elem:j,handlers:f})}return i<c.length&&h.push({elem:this,handlers:c.slice(i)}),h},fix:function(a){if(a[ia.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];for(g||(this.fixHooks[e]=g=Ma.test(e)?this.mouseHooks:La.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new ia.Event(f),b=d.length;b--;)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||W),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,e,f,g=c.button,h=c.fromElement;return null==a.pageX&&null!=c.clientX&&(e=a.target.ownerDocument||W,f=e.documentElement,d=e.body,a.pageX=c.clientX+(f&&f.scrollLeft||d&&d.scrollLeft||0)-(f&&f.clientLeft||d&&d.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||d&&d.scrollTop||0)-(f&&f.clientTop||d&&d.clientTop||0)),!a.relatedTarget&&h&&(a.relatedTarget=h===a.target?c.toElement:h),a.which||g===b||(a.which=1&g?1:2&g?3:4&g?2:0),a}},special:{load:{noBubble:!0},click:{trigger:function(){if(ia.nodeName(this,"input")&&"checkbox"===this.type&&this.click)return this.click(),!1}},focus:{trigger:function(){if(this!==W.activeElement&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){if(this===W.activeElement&&this.blur)return this.blur(),!1},delegateType:"focusout"},beforeunload:{postDispatch:function(a){a.result!==b&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=ia.extend(new ia.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?ia.event.trigger(e,null,b):ia.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},ia.removeEvent=W.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===V&&(a[d]=null),a.detachEvent(d,c))},ia.Event=function(a,b){return this instanceof ia.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?i:j):this.type=a,b&&ia.extend(this,b),this.timeStamp=a&&a.timeStamp||ia.now(),void(this[ia.expando]=!0)):new ia.Event(a,b)},ia.Event.prototype={isDefaultPrevented:j,isPropagationStopped:j,isImmediatePropagationStopped:j,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=i,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=i,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=i,this.stopPropagation()}},ia.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){ia.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||ia.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),ia.support.submitBubbles||(ia.event.special.submit={setup:function(){return!ia.nodeName(this,"form")&&void ia.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=ia.nodeName(c,"input")||ia.nodeName(c,"button")?c.form:b;d&&!ia._data(d,"submitBubbles")&&(ia.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),ia._data(d,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&ia.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return!ia.nodeName(this,"form")&&void ia.event.remove(this,"._submit")}}),ia.support.changeBubbles||(ia.event.special.change={setup:function(){return Ka.test(this.nodeName)?("checkbox"!==this.type&&"radio"!==this.type||(ia.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),ia.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),ia.event.simulate("change",this,a,!0)})),!1):void ia.event.add(this,"beforeactivate._change",function(a){var b=a.target;Ka.test(b.nodeName)&&!ia._data(b,"changeBubbles")&&(ia.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||ia.event.simulate("change",this.parentNode,a,!0)}),ia._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type)return a.handleObj.handler.apply(this,arguments)},teardown:function(){return ia.event.remove(this,"._change"),!Ka.test(this.nodeName)}}),ia.support.focusinBubbles||ia.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){ia.event.simulate(b,a.target,ia.event.fix(a),!0)};ia.event.special[b]={setup:function(){0===c++&&W.addEventListener(a,d,!0)},teardown:function(){0===--c&&W.removeEventListener(a,d,!0)}}}),ia.fn.extend({on:function(a,c,d,e,f){var g,h;if("object"==typeof a){"string"!=typeof c&&(d=d||c,c=b);for(g in a)this.on(g,c,d,a[g],f);return this}if(null==d&&null==e?(e=c,d=c=b):null==e&&("string"==typeof c?(e=d,d=b):(e=d,d=c,c=b)),e===!1)e=j;else if(!e)return this;return 1===f&&(h=e,e=function(a){return ia().off(a),h.apply(this,arguments)},e.guid=h.guid||(h.guid=ia.guid++)),this.each(function(){ia.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,ia(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if("object"==typeof a){for(f in a)this.off(f,c,a[f]);return this}return c!==!1&&"function"!=typeof c||(d=c,c=b),d===!1&&(d=j),this.each(function(){ia.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){ia.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return ia.event.trigger(a,b,c,!0)}}),function(a,b){function c(a){return oa.test(a+"")}function d(){var a,b=[];return a=function(c,d){return b.push(c+=" ")>y.cacheLength&&delete a[b.shift()],a[c]=d}}function e(a){return a[N]=!0,a}function f(a){var b=F.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}}function g(a,b,c,d){var e,f,g,h,i,j,k,n,o,p;if((b?b.ownerDocument||b:O)!==F&&E(b),b=b||F,c=c||[],!a||"string"!=typeof a)return c;if(1!==(h=b.nodeType)&&9!==h)return[];if(!H&&!d){if(e=pa.exec(a))if(g=e[1]){if(9===h){if(f=b.getElementById(g),!f||!f.parentNode)return c;if(f.id===g)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(g))&&L(b,f)&&f.id===g)return c.push(f),c}else{if(e[2])return Z.apply(c,$.call(b.getElementsByTagName(a),0)),c;if((g=e[3])&&P.getByClassName&&b.getElementsByClassName)return Z.apply(c,$.call(b.getElementsByClassName(g),0)),c}if(P.qsa&&!I.test(a)){if(k=!0,n=N,o=b,p=9===h&&a,1===h&&"object"!==b.nodeName.toLowerCase()){for(j=l(a),(k=b.getAttribute("id"))?n=k.replace(sa,"\\$&"):b.setAttribute("id",n),n="[id='"+n+"'] ",i=j.length;i--;)j[i]=n+m(j[i]);o=na.test(a)&&b.parentNode||b,p=j.join(",")}if(p)try{return Z.apply(c,$.call(o.querySelectorAll(p),0)),c}catch(q){}finally{k||b.removeAttribute("id")}}}return u(a.replace(ga,"$1"),b,c,d)}function h(a,b){var c=b&&a,d=c&&(~b.sourceIndex||W)-(~a.sourceIndex||W);if(d)return d;if(c)for(;c=c.nextSibling;)if(c===b)return-1;return a?1:-1}function i(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function j(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function k(a){return e(function(b){return b=+b,e(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function l(a,b){var c,d,e,f,h,i,j,k=T[a+" "];if(k)return b?0:k.slice(0);for(h=a,i=[],j=y.preFilter;h;){c&&!(d=ha.exec(h))||(d&&(h=h.slice(d[0].length)||h),i.push(e=[])),c=!1,(d=ja.exec(h))&&(c=d.shift(),e.push({value:c,type:d[0].replace(ga," ")}),h=h.slice(c.length));for(f in y.filter)!(d=ma[f].exec(h))||j[f]&&!(d=j[f](d))||(c=d.shift(),e.push({value:c,type:f,matches:d}),h=h.slice(c.length));if(!c)break}return b?h.length:h?g.error(a):T(a,i).slice(0)}function m(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function n(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=R++;return b.first?function(b,c,f){for(;b=b[d];)if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=Q+" "+f;if(g){for(;b=b[d];)if((1===b.nodeType||e)&&a(b,c,g))return!0}else for(;b=b[d];)if(1===b.nodeType||e)if(j=b[N]||(b[N]={}),(i=j[d])&&i[0]===k){if((h=i[1])===!0||h===x)return h===!0}else if(i=j[d]=[k],i[1]=a(b,c,g)||x,i[1]===!0)return!0}}function o(a){return a.length>1?function(b,c,d){for(var e=a.length;e--;)if(!a[e](b,c,d))return!1;return!0}:a[0]}function p(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function q(a,b,c,d,f,g){return d&&!d[N]&&(d=q(d)),f&&!f[N]&&(f=q(f,g)),e(function(e,g,h,i){var j,k,l,m=[],n=[],o=g.length,q=e||t(b||"*",h.nodeType?[h]:h,[]),r=!a||!e&&b?q:p(q,m,a,h,i),s=c?f||(e?a:o||d)?[]:g:r;if(c&&c(r,s,h,i),d)for(j=p(s,n),d(j,[],h,i),k=j.length;k--;)(l=j[k])&&(s[n[k]]=!(r[n[k]]=l));if(e){if(f||a){if(f){for(j=[],k=s.length;k--;)(l=s[k])&&j.push(r[k]=l);f(null,s=[],j,i)}for(k=s.length;k--;)(l=s[k])&&(j=f?_.call(e,l):m[k])>-1&&(e[j]=!(g[j]=l))}}else s=p(s===g?s.splice(o,s.length):s),f?f(null,g,s,i):Z.apply(g,s)})}function r(a){for(var b,c,d,e=a.length,f=y.relative[a[0].type],g=f||y.relative[" "],h=f?1:0,i=n(function(a){return a===b},g,!0),j=n(function(a){return _.call(b,a)>-1},g,!0),k=[function(a,c,d){return!f&&(d||c!==D)||((b=c).nodeType?i(a,c,d):j(a,c,d))}];h<e;h++)if(c=y.relative[a[h].type])k=[n(o(k),c)];else{if(c=y.filter[a[h].type].apply(null,a[h].matches),c[N]){for(d=++h;d<e&&!y.relative[a[d].type];d++);return q(h>1&&o(k),h>1&&m(a.slice(0,h-1)).replace(ga,"$1"),c,h<d&&r(a.slice(h,d)),d<e&&r(a=a.slice(d)),d<e&&m(a))}k.push(c)}return o(k)}function s(a,b){var c=0,d=b.length>0,f=a.length>0,h=function(e,h,i,j,k){var l,m,n,o=[],q=0,r="0",s=e&&[],t=null!=k,u=D,v=e||f&&y.find.TAG("*",k&&h.parentNode||h),w=Q+=null==u?1:Math.random()||.1;for(t&&(D=h!==F&&h,x=c);null!=(l=v[r]);r++){if(f&&l){for(m=0;n=a[m++];)if(n(l,h,i)){j.push(l);break}t&&(Q=w,x=++c)}d&&((l=!n&&l)&&q--,e&&s.push(l))}if(q+=r,d&&r!==q){for(m=0;n=b[m++];)n(s,o,h,i);if(e){if(q>0)for(;r--;)s[r]||o[r]||(o[r]=Y.call(j));o=p(o)}Z.apply(j,o),t&&!e&&o.length>0&&q+b.length>1&&g.uniqueSort(j)}return t&&(Q=w,D=u),s};return d?e(h):h}function t(a,b,c){for(var d=0,e=b.length;d<e;d++)g(a,b[d],c);return c}function u(a,b,c,d){var e,f,g,h,i,j=l(a);if(!d&&1===j.length){if(f=j[0]=j[0].slice(0),f.length>2&&"ID"===(g=f[0]).type&&9===b.nodeType&&!H&&y.relative[f[1].type]){if(b=y.find.ID(g.matches[0].replace(ua,va),b)[0],!b)return c;a=a.slice(f.shift().value.length)}for(e=ma.needsContext.test(a)?0:f.length;e--&&(g=f[e],!y.relative[h=g.type]);)if((i=y.find[h])&&(d=i(g.matches[0].replace(ua,va),na.test(f[0].type)&&b.parentNode||b))){if(f.splice(e,1),a=d.length&&m(f),!a)return Z.apply(c,$.call(d,0)),c;break}}return B(a,j)(d,b,H,c,na.test(a)),c}function v(){}var w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N="sizzle"+-new Date,O=a.document,P={},Q=0,R=0,S=d(),T=d(),U=d(),V=typeof b,W=1<<31,X=[],Y=X.pop,Z=X.push,$=X.slice,_=X.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]===a)return b;return-1},aa="[\\x20\\t\\r\\n\\f]",ba="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ca=ba.replace("w","w#"),da="([*^$|!~]?=)",ea="\\["+aa+"*("+ba+")"+aa+"*(?:"+da+aa+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+ca+")|)|)"+aa+"*\\]",fa=":("+ba+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+ea.replace(3,8)+")*)|.*)\\)|)",ga=new RegExp("^"+aa+"+|((?:^|[^\\\\])(?:\\\\.)*)"+aa+"+$","g"),ha=new RegExp("^"+aa+"*,"+aa+"*"),ja=new RegExp("^"+aa+"*([\\x20\\t\\r\\n\\f>+~])"+aa+"*"),ka=new RegExp(fa),la=new RegExp("^"+ca+"$"),ma={ID:new RegExp("^#("+ba+")"),CLASS:new RegExp("^\\.("+ba+")"),NAME:new RegExp("^\\[name=['\"]?("+ba+")['\"]?\\]"),TAG:new RegExp("^("+ba.replace("w","w*")+")"),ATTR:new RegExp("^"+ea),PSEUDO:new RegExp("^"+fa),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+aa+"*(even|odd|(([+-]|)(\\d*)n|)"+aa+"*(?:([+-]|)"+aa+"*(\\d+)|))"+aa+"*\\)|)","i"),needsContext:new RegExp("^"+aa+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+aa+"*((?:-\\d)?\\d*)"+aa+"*\\)|)(?=[^-]|$)","i")},na=/[\x20\t\r\n\f]*[+~]/,oa=/^[^{]+\{\s*\[native code/,pa=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,qa=/^(?:input|select|textarea|button)$/i,ra=/^h\d$/i,sa=/'|\\/g,ta=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,ua=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,va=function(a,b){var c="0x"+b-65536;return c!==c?b:c<0?String.fromCharCode(c+65536):String.fromCharCode(c>>10|55296,1023&c|56320)};try{$.call(O.documentElement.childNodes,0)[0].nodeType}catch(wa){$=function(a){for(var b,c=[];b=this[a++];)c.push(b);return c}}A=g.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},E=g.setDocument=function(a){var d=a?a.ownerDocument||a:O;return d!==F&&9===d.nodeType&&d.documentElement?(F=d,G=d.documentElement,H=A(d),P.tagNameNoComments=f(function(a){return a.appendChild(d.createComment("")),!a.getElementsByTagName("*").length}),P.attributes=f(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return"boolean"!==b&&"string"!==b}),P.getByClassName=f(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!(!a.getElementsByClassName||!a.getElementsByClassName("e").length)&&(a.lastChild.className="e",2===a.getElementsByClassName("e").length)}),P.getByName=f(function(a){a.id=N+0,a.innerHTML="<a name='"+N+"'></a><div name='"+N+"'></div>",G.insertBefore(a,G.firstChild);var b=d.getElementsByName&&d.getElementsByName(N).length===2+d.getElementsByName(N+0).length;return P.getIdNotName=!d.getElementById(N),G.removeChild(a),b}),y.attrHandle=f(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==V&&"#"===a.firstChild.getAttribute("href")})?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},P.getIdNotName?(y.find.ID=function(a,b){if(typeof b.getElementById!==V&&!H){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},y.filter.ID=function(a){var b=a.replace(ua,va);return function(a){return a.getAttribute("id")===b}}):(y.find.ID=function(a,c){if(typeof c.getElementById!==V&&!H){var d=c.getElementById(a);return d?d.id===a||typeof d.getAttributeNode!==V&&d.getAttributeNode("id").value===a?[d]:b:[]}},y.filter.ID=function(a){var b=a.replace(ua,va);return function(a){var c=typeof a.getAttributeNode!==V&&a.getAttributeNode("id");return c&&c.value===b}}),y.find.TAG=P.tagNameNoComments?function(a,b){if(typeof b.getElementsByTagName!==V)return b.getElementsByTagName(a)}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(;c=f[e++];)1===c.nodeType&&d.push(c);return d}return f},y.find.NAME=P.getByName&&function(a,b){if(typeof b.getElementsByName!==V)return b.getElementsByName(name)},y.find.CLASS=P.getByClassName&&function(a,b){if(typeof b.getElementsByClassName!==V&&!H)return b.getElementsByClassName(a)},J=[],I=[":focus"],(P.qsa=c(d.querySelectorAll))&&(f(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||I.push("\\["+aa+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||I.push(":checked")}),f(function(a){a.innerHTML="<input type='hidden' i=''/>",a.querySelectorAll("[i^='']").length&&I.push("[*^$]="+aa+"*(?:\"\"|'')"),a.querySelectorAll(":enabled").length||I.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),I.push(",.*:")})),(P.matchesSelector=c(K=G.matchesSelector||G.mozMatchesSelector||G.webkitMatchesSelector||G.oMatchesSelector||G.msMatchesSelector))&&f(function(a){P.disconnectedMatch=K.call(a,"div"),K.call(a,"[s!='']:x"),J.push("!=",fa)}),I=new RegExp(I.join("|")),J=new RegExp(J.join("|")),L=c(G.contains)||G.compareDocumentPosition?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)for(;b=b.parentNode;)if(b===a)return!0;return!1},M=G.compareDocumentPosition?function(a,b){var c;return a===b?(C=!0,0):(c=b.compareDocumentPosition&&a.compareDocumentPosition&&a.compareDocumentPosition(b))?1&c||a.parentNode&&11===a.parentNode.nodeType?a===d||L(O,a)?-1:b===d||L(O,b)?1:0:4&c?-1:1:a.compareDocumentPosition?-1:1}:function(a,b){var c,e=0,f=a.parentNode,g=b.parentNode,i=[a],j=[b];if(a===b)return C=!0,0;if(!f||!g)return a===d?-1:b===d?1:f?-1:g?1:0;if(f===g)return h(a,b);for(c=a;c=c.parentNode;)i.unshift(c);for(c=b;c=c.parentNode;)j.unshift(c);for(;i[e]===j[e];)e++;return e?h(i[e],j[e]):i[e]===O?-1:j[e]===O?1:0},C=!1,[0,0].sort(M),P.detectDuplicates=C,F):F},g.matches=function(a,b){return g(a,null,null,b)},g.matchesSelector=function(a,b){if((a.ownerDocument||a)!==F&&E(a),b=b.replace(ta,"='$1']"),P.matchesSelector&&!H&&(!J||!J.test(b))&&!I.test(b))try{var c=K.call(a,b);if(c||P.disconnectedMatch||a.document&&11!==a.document.nodeType)return c}catch(d){}return g(b,F,null,[a]).length>0},g.contains=function(a,b){return(a.ownerDocument||a)!==F&&E(a),L(a,b)},g.attr=function(a,b){var c;return(a.ownerDocument||a)!==F&&E(a),H||(b=b.toLowerCase()),(c=y.attrHandle[b])?c(a):H||P.attributes?a.getAttribute(b):((c=a.getAttributeNode(b))||a.getAttribute(b))&&a[b]===!0?b:c&&c.specified?c.value:null},g.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},g.uniqueSort=function(a){var b,c=[],d=1,e=0;if(C=!P.detectDuplicates,a.sort(M),C){for(;b=a[d];d++)b===a[d-1]&&(e=c.push(d));for(;e--;)a.splice(c[e],1)}return a},z=g.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=z(a)}else if(3===e||4===e)return a.nodeValue}else for(;b=a[d];d++)c+=z(b);return c},y=g.selectors={cacheLength:50,createPseudo:e,match:ma,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ua,va),a[3]=(a[4]||a[5]||"").replace(ua,va),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||g.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&g.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return ma.CHILD.test(a[0])?null:(a[4]?a[2]=a[4]:c&&ka.test(c)&&(b=l(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){return"*"===a?function(){return!0}:(a=a.replace(ua,va).toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=S[a+" "];return b||(b=new RegExp("(^|"+aa+")"+a+"("+aa+"|$)"))&&S(a,function(a){return b.test(a.className||typeof a.getAttribute!==V&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=g.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){for(;p;){for(l=b;l=l[p];)if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){for(k=q[N]||(q[N]={}),j=k[a]||[],n=j[0]===Q&&j[1],m=j[0]===Q&&j[2],l=n&&q.childNodes[n];l=++n&&l&&l[p]||(m=n=0)||o.pop();)if(1===l.nodeType&&++m&&l===b){k[a]=[Q,n,m];break}}else if(s&&(j=(b[N]||(b[N]={}))[a])&&j[0]===Q)m=j[1];else for(;(l=++n&&l&&l[p]||(m=n=0)||o.pop())&&((h?l.nodeName.toLowerCase()!==r:1!==l.nodeType)||!++m||(s&&((l[N]||(l[N]={}))[a]=[Q,m]),l!==b)););return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,d=y.pseudos[a]||y.setFilters[a.toLowerCase()]||g.error("unsupported pseudo: "+a);return d[N]?d(b):d.length>1?(c=[a,a,"",b],y.setFilters.hasOwnProperty(a.toLowerCase())?e(function(a,c){for(var e,f=d(a,b),g=f.length;g--;)e=_.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:e(function(a){var b=[],c=[],d=B(a.replace(ga,"$1"));return d[N]?e(function(a,b,c,e){for(var f,g=d(a,null,e,[]),h=a.length;h--;)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:e(function(a){return function(b){return g(a,b).length>0}}),contains:e(function(a){return function(b){return(b.textContent||b.innerText||z(b)).indexOf(a)>-1}}),lang:e(function(a){return la.test(a||"")||g.error("unsupported lang: "+a),a=a.replace(ua,va).toLowerCase(),function(b){var c;do if(c=H?b.getAttribute("xml:lang")||b.getAttribute("lang"):b.lang)return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===G},focus:function(a){return a===F.activeElement&&(!F.hasFocus||F.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeName>"@"||3===a.nodeType||4===a.nodeType)return!1;return!0},parent:function(a){return!y.pseudos.empty(a)},header:function(a){return ra.test(a.nodeName)},input:function(a){return qa.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||b.toLowerCase()===a.type)},first:k(function(){return[0]}),last:k(function(a,b){return[b-1]}),eq:k(function(a,b,c){return[c<0?c+b:c]}),even:k(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:k(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:k(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:k(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}};for(w in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})y.pseudos[w]=i(w);for(w in{submit:!0,reset:!0})y.pseudos[w]=j(w);B=g.compile=function(a,b){var c,d=[],e=[],f=U[a+" "];if(!f){for(b||(b=l(a)),c=b.length;c--;)f=r(b[c]),f[N]?d.push(f):e.push(f);f=U(a,s(e,d))}return f},y.pseudos.nth=y.pseudos.eq,y.filters=v.prototype=y.pseudos,y.setFilters=new v,E(),g.attr=ia.attr,ia.find=g,ia.expr=g.selectors,ia.expr[":"]=ia.expr.pseudos,ia.unique=g.uniqueSort,ia.text=g.getText,ia.isXMLDoc=g.isXML,ia.contains=g.contains}(a);var Pa=/Until$/,Qa=/^(?:parents|prev(?:Until|All))/,Ra=/^.[^:#\[\.,]*$/,Sa=ia.expr.match.needsContext,Ta={children:!0,contents:!0,next:!0,prev:!0};ia.fn.extend({find:function(a){var b,c,d,e=this.length;if("string"!=typeof a)return d=this,this.pushStack(ia(a).filter(function(){for(b=0;b<e;b++)if(ia.contains(d[b],this))return!0}));for(c=[],b=0;b<e;b++)ia.find(a,this[b],c);return c=this.pushStack(e>1?ia.unique(c):c),c.selector=(this.selector?this.selector+" ":"")+a,c},has:function(a){var b,c=ia(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(ia.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(l(this,a,!1))},filter:function(a){
return this.pushStack(l(this,a,!0))},is:function(a){return!!a&&("string"==typeof a?Sa.test(a)?ia(a,this.context).index(this[0])>=0:ia.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=Sa.test(a)||"string"!=typeof a?ia(a,b||this.context):0;d<e;d++)for(c=this[d];c&&c.ownerDocument&&c!==b&&11!==c.nodeType;){if(g?g.index(c)>-1:ia.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}return this.pushStack(f.length>1?ia.unique(f):f)},index:function(a){return a?"string"==typeof a?ia.inArray(this[0],ia(a)):ia.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){var c="string"==typeof a?ia(a,b):ia.makeArray(a&&a.nodeType?[a]:a),d=ia.merge(this.get(),c);return this.pushStack(ia.unique(d))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),ia.fn.andSelf=ia.fn.addBack,ia.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return ia.dir(a,"parentNode")},parentsUntil:function(a,b,c){return ia.dir(a,"parentNode",c)},next:function(a){return k(a,"nextSibling")},prev:function(a){return k(a,"previousSibling")},nextAll:function(a){return ia.dir(a,"nextSibling")},prevAll:function(a){return ia.dir(a,"previousSibling")},nextUntil:function(a,b,c){return ia.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return ia.dir(a,"previousSibling",c)},siblings:function(a){return ia.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return ia.sibling(a.firstChild)},contents:function(a){return ia.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:ia.merge([],a.childNodes)}},function(a,b){ia.fn[a]=function(c,d){var e=ia.map(this,b,c);return Pa.test(a)||(d=c),d&&"string"==typeof d&&(e=ia.filter(d,e)),e=this.length>1&&!Ta[a]?ia.unique(e):e,this.length>1&&Qa.test(a)&&(e=e.reverse()),this.pushStack(e)}}),ia.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),1===b.length?ia.find.matchesSelector(b[0],a)?[b[0]]:[]:ia.find.matches(a,b)},dir:function(a,c,d){for(var e=[],f=a[c];f&&9!==f.nodeType&&(d===b||1!==f.nodeType||!ia(f).is(d));)1===f.nodeType&&e.push(f),f=f[c];return e},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}});var Ua="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Va=/ jQuery\d+="(?:null|\d+)"/g,Wa=new RegExp("<(?:"+Ua+")[\\s/>]","i"),Xa=/^\s+/,Ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Za=/<([\w:]+)/,$a=/<tbody/i,_a=/<|&#?\w+;/,ab=/<(?:script|style|link)/i,bb=/^(?:checkbox|radio)$/i,cb=/checked\s*(?:[^=]|=\s*.checked.)/i,db=/^$|\/(?:java|ecma)script/i,eb=/^true\/(.*)/,fb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,gb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:ia.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},hb=m(W),ib=hb.appendChild(W.createElement("div"));gb.optgroup=gb.option,gb.tbody=gb.tfoot=gb.colgroup=gb.caption=gb.thead,gb.th=gb.td,ia.fn.extend({text:function(a){return ia.access(this,function(a){return a===b?ia.text(this):this.empty().append((this[0]&&this[0].ownerDocument||W).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(ia.isFunction(a))return this.each(function(b){ia(this).wrapAll(a.call(this,b))});if(this[0]){var b=ia(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){for(var a=this;a.firstChild&&1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return ia.isFunction(a)?this.each(function(b){ia(this).wrapInner(a.call(this,b))}):this.each(function(){var b=ia(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=ia.isFunction(a);return this.each(function(c){ia(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){ia.nodeName(this,"body")||ia(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||this.insertBefore(a,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,!1,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=0;null!=(c=this[d]);d++)(!a||ia.filter(a,[c]).length>0)&&(b||1!==c.nodeType||ia.cleanData(t(c)),c.parentNode&&(b&&ia.contains(c.ownerDocument,c)&&q(t(c,"script")),c.parentNode.removeChild(c)));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){for(1===a.nodeType&&ia.cleanData(t(a,!1));a.firstChild;)a.removeChild(a.firstChild);a.options&&ia.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return ia.clone(this,a,b)})},html:function(a){return ia.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return 1===c.nodeType?c.innerHTML.replace(Va,""):b;if("string"==typeof a&&!ab.test(a)&&(ia.support.htmlSerialize||!Wa.test(a))&&(ia.support.leadingWhitespace||!Xa.test(a))&&!gb[(Za.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ya,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},1===c.nodeType&&(ia.cleanData(t(c,!1)),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){var b=ia.isFunction(a);return b||"string"==typeof a||(a=ia(a).not(this).detach()),this.domManip([a],!0,function(a){var b=this.nextSibling,c=this.parentNode;c&&(ia(this).remove(),c.insertBefore(a,b))})},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=ba.apply([],a);var e,f,g,h,i,j,k=0,l=this.length,m=this,q=l-1,r=a[0],s=ia.isFunction(r);if(s||!(l<=1||"string"!=typeof r||ia.support.checkClone)&&cb.test(r))return this.each(function(e){var f=m.eq(e);s&&(a[0]=r.call(this,e,c?f.html():b)),f.domManip(a,c,d)});if(l&&(j=ia.buildFragment(a,this[0].ownerDocument,!1,this),e=j.firstChild,1===j.childNodes.length&&(j=e),e)){for(c=c&&ia.nodeName(e,"tr"),h=ia.map(t(j,"script"),o),g=h.length;k<l;k++)f=j,k!==q&&(f=ia.clone(f,!0,!0),g&&ia.merge(h,t(f,"script"))),d.call(c&&ia.nodeName(this[k],"table")?n(this[k],"tbody"):this[k],f,k);if(g)for(i=h[h.length-1].ownerDocument,ia.map(h,p),k=0;k<g;k++)f=h[k],db.test(f.type||"")&&!ia._data(f,"globalEval")&&ia.contains(i,f)&&(f.src?ia.ajax({url:f.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):ia.globalEval((f.text||f.textContent||f.innerHTML||"").replace(fb,"")));j=e=null}return this}}),ia.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){ia.fn[a]=function(a){for(var c,d=0,e=[],f=ia(a),g=f.length-1;d<=g;d++)c=d===g?this:this.clone(!0),ia(f[d])[b](c),ca.apply(e,c.get());return this.pushStack(e)}}),ia.extend({clone:function(a,b,c){var d,e,f,g,h,i=ia.contains(a.ownerDocument,a);if(ia.support.html5Clone||ia.isXMLDoc(a)||!Wa.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ib.innerHTML=a.outerHTML,ib.removeChild(f=ib.firstChild)),!(ia.support.noCloneEvent&&ia.support.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||ia.isXMLDoc(a)))for(d=t(f),h=t(a),g=0;null!=(e=h[g]);++g)d[g]&&s(e,d[g]);if(b)if(c)for(h=h||t(a),d=d||t(f),g=0;null!=(e=h[g]);g++)r(e,d[g]);else r(a,f);return d=t(f,"script"),d.length>0&&q(d,!i&&t(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,l=a.length,n=m(b),o=[],p=0;p<l;p++)if(f=a[p],f||0===f)if("object"===ia.type(f))ia.merge(o,f.nodeType?[f]:f);else if(_a.test(f)){for(h=h||n.appendChild(b.createElement("div")),i=(Za.exec(f)||["",""])[1].toLowerCase(),k=gb[i]||gb._default,h.innerHTML=k[1]+f.replace(Ya,"<$1></$2>")+k[2],e=k[0];e--;)h=h.lastChild;if(!ia.support.leadingWhitespace&&Xa.test(f)&&o.push(b.createTextNode(Xa.exec(f)[0])),!ia.support.tbody)for(f="table"!==i||$a.test(f)?"<table>"!==k[1]||$a.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;e--;)ia.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j);for(ia.merge(o,h.childNodes),h.textContent="";h.firstChild;)h.removeChild(h.firstChild);h=n.lastChild}else o.push(b.createTextNode(f));for(h&&n.removeChild(h),ia.support.appendChecked||ia.grep(t(o,"input"),u),p=0;f=o[p++];)if((!d||ia.inArray(f,d)===-1)&&(g=ia.contains(f.ownerDocument,f),h=t(n.appendChild(f),"script"),g&&q(h),c))for(e=0;f=h[e++];)db.test(f.type||"")&&c.push(f);return h=null,n},cleanData:function(a,b){for(var c,d,e,f,g=0,h=ia.expando,i=ia.cache,j=ia.support.deleteExpando,k=ia.event.special;null!=(c=a[g]);g++)if((b||ia.acceptData(c))&&(e=c[h],f=e&&i[e])){if(f.events)for(d in f.events)k[d]?ia.event.remove(c,d):ia.removeEvent(c,d,f.handle);i[e]&&(delete i[e],j?delete c[h]:typeof c.removeAttribute!==V?c.removeAttribute(h):c[h]=null,_.push(e))}}});var jb,kb,lb,mb=/alpha\([^)]*\)/i,nb=/opacity\s*=\s*([^)]*)/,ob=/^(top|right|bottom|left)$/,pb=/^(none|table(?!-c[ea]).+)/,qb=/^margin/,rb=new RegExp("^("+ja+")(.*)$","i"),sb=new RegExp("^("+ja+")(?!px)[a-z%]+$","i"),tb=new RegExp("^([+-])=("+ja+")","i"),ub={BODY:"block"},vb={position:"absolute",visibility:"hidden",display:"block"},wb={letterSpacing:0,fontWeight:400},xb=["Top","Right","Bottom","Left"],yb=["Webkit","O","Moz","ms"];ia.fn.extend({css:function(a,c){return ia.access(this,function(a,c,d){var e,f,g={},h=0;if(ia.isArray(c)){for(f=kb(a),e=c.length;h<e;h++)g[c[h]]=ia.css(a,c[h],!1,f);return g}return d!==b?ia.style(a,c,d):ia.css(a,c)},a,c,arguments.length>1)},show:function(){return x(this,!0)},hide:function(){return x(this)},toggle:function(a){var b="boolean"==typeof a;return this.each(function(){(b?a:w(this))?ia(this).show():ia(this).hide()})}}),ia.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=lb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":ia.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var f,g,h,i=ia.camelCase(c),j=a.style;if(c=ia.cssProps[i]||(ia.cssProps[i]=v(j,i)),h=ia.cssHooks[c]||ia.cssHooks[i],d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];if(g=typeof d,"string"===g&&(f=tb.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(ia.css(a,c)),g="number"),!(null==d||"number"===g&&isNaN(d)||("number"!==g||ia.cssNumber[i]||(d+="px"),ia.support.clearCloneStyle||""!==d||0!==c.indexOf("background")||(j[c]="inherit"),h&&"set"in h&&(d=h.set(a,d,e))===b)))try{j[c]=d}catch(k){}}},css:function(a,c,d,e){var f,g,h,i=ia.camelCase(c);return c=ia.cssProps[i]||(ia.cssProps[i]=v(a.style,i)),h=ia.cssHooks[c]||ia.cssHooks[i],h&&"get"in h&&(g=h.get(a,!0,d)),g===b&&(g=lb(a,c,e)),"normal"===g&&c in wb&&(g=wb[c]),""===d||d?(f=parseFloat(g),d===!0||ia.isNumeric(f)?f||0:g):g},swap:function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e}}),a.getComputedStyle?(kb=function(b){return a.getComputedStyle(b,null)},lb=function(a,c,d){var e,f,g,h=d||kb(a),i=h?h.getPropertyValue(c)||h[c]:b,j=a.style;return h&&(""!==i||ia.contains(a.ownerDocument,a)||(i=ia.style(a,c)),sb.test(i)&&qb.test(c)&&(e=j.width,f=j.minWidth,g=j.maxWidth,j.minWidth=j.maxWidth=j.width=i,i=h.width,j.width=e,j.minWidth=f,j.maxWidth=g)),i}):W.documentElement.currentStyle&&(kb=function(a){return a.currentStyle},lb=function(a,c,d){var e,f,g,h=d||kb(a),i=h?h[c]:b,j=a.style;return null==i&&j&&j[c]&&(i=j[c]),sb.test(i)&&!ob.test(c)&&(e=j.left,f=a.runtimeStyle,g=f&&f.left,g&&(f.left=a.currentStyle.left),j.left="fontSize"===c?"1em":i,i=j.pixelLeft+"px",j.left=e,g&&(f.left=g)),""===i?"auto":i}),ia.each(["height","width"],function(a,b){ia.cssHooks[b]={get:function(a,c,d){if(c)return 0===a.offsetWidth&&pb.test(ia.css(a,"display"))?ia.swap(a,vb,function(){return A(a,b,d)}):A(a,b,d)},set:function(a,c,d){var e=d&&kb(a);return y(a,c,d?z(a,b,d,ia.support.boxSizing&&"border-box"===ia.css(a,"boxSizing",!1,e),e):0)}}}),ia.support.opacity||(ia.cssHooks.opacity={get:function(a,b){return nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=ia.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===ia.trim(f.replace(mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=mb.test(f)?f.replace(mb,e):f+" "+e)}}),ia(function(){ia.support.reliableMarginRight||(ia.cssHooks.marginRight={get:function(a,b){if(b)return ia.swap(a,{display:"inline-block"},lb,[a,"marginRight"])}}),!ia.support.pixelPosition&&ia.fn.position&&ia.each(["top","left"],function(a,b){ia.cssHooks[b]={get:function(a,c){if(c)return c=lb(a,b),sb.test(c)?ia(a).position()[b]+"px":c}}})}),ia.expr&&ia.expr.filters&&(ia.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!ia.support.reliableHiddenOffsets&&"none"===(a.style&&a.style.display||ia.css(a,"display"))},ia.expr.filters.visible=function(a){return!ia.expr.filters.hidden(a)}),ia.each({margin:"",padding:"",border:"Width"},function(a,b){ia.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+xb[d]+b]=f[d]||f[d-2]||f[0];return e}},qb.test(a)||(ia.cssHooks[a+b].set=y)});var zb=/%20/g,Ab=/\[\]$/,Bb=/\r?\n/g,Cb=/^(?:submit|button|image|reset|file)$/i,Db=/^(?:input|select|textarea|keygen)/i;ia.fn.extend({serialize:function(){return ia.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=ia.prop(this,"elements");return a?ia.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!ia(this).is(":disabled")&&Db.test(this.nodeName)&&!Cb.test(a)&&(this.checked||!bb.test(a))}).map(function(a,b){var c=ia(this).val();return null==c?null:ia.isArray(c)?ia.map(c,function(a){return{name:b.name,value:a.replace(Bb,"\r\n")}}):{name:b.name,value:c.replace(Bb,"\r\n")}}).get()}}),ia.param=function(a,c){var d,e=[],f=function(a,b){b=ia.isFunction(b)?b():null==b?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(c===b&&(c=ia.ajaxSettings&&ia.ajaxSettings.traditional),ia.isArray(a)||a.jquery&&!ia.isPlainObject(a))ia.each(a,function(){f(this.name,this.value)});else for(d in a)D(d,a[d],c,f);return e.join("&").replace(zb,"+")},ia.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){ia.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),ia.fn.hover=function(a,b){return this.mouseenter(a).mouseleave(b||a)};var Eb,Fb,Gb=ia.now(),Hb=/\?/,Ib=/#.*$/,Jb=/([?&])_=[^&]*/,Kb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Lb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mb=/^(?:GET|HEAD)$/,Nb=/^\/\//,Ob=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Pb=ia.fn.load,Qb={},Rb={},Sb="*/".concat("*");try{Fb=X.href}catch(Tb){Fb=W.createElement("a"),Fb.href="",Fb=Fb.href}Eb=Ob.exec(Fb.toLowerCase())||[],ia.fn.load=function(a,c,d){if("string"!=typeof a&&Pb)return Pb.apply(this,arguments);var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),ia.isFunction(c)?(d=c,c=b):c&&"object"==typeof c&&(g="POST"),h.length>0&&ia.ajax({url:a,type:g,dataType:"html",data:c}).done(function(a){f=arguments,h.html(e?ia("<div>").append(ia.parseHTML(a)).find(e):a)}).complete(d&&function(a,b){h.each(d,f||[a.responseText,b,a])}),this},ia.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){ia.fn[b]=function(a){return this.on(b,a)}}),ia.each(["get","post"],function(a,c){ia[c]=function(a,d,e,f){return ia.isFunction(d)&&(f=f||e,e=d,d=b),ia.ajax({url:a,type:c,dataType:f,data:d,success:e})}}),ia.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Fb,type:"GET",isLocal:Lb.test(Eb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Sb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":ia.parseJSON,"text xml":ia.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?G(G(a,ia.ajaxSettings),b):G(ia.ajaxSettings,a)},ajaxPrefilter:E(Qb),ajaxTransport:E(Rb),ajax:function(a,c){function d(a,c,d,e){var f,l,s,t,v,x=c;2!==u&&(u=2,i&&clearTimeout(i),k=b,h=e||"",w.readyState=a>0?4:0,d&&(t=H(m,w,d)),a>=200&&a<300||304===a?(m.ifModified&&(v=w.getResponseHeader("Last-Modified"),v&&(ia.lastModified[g]=v),v=w.getResponseHeader("etag"),v&&(ia.etag[g]=v)),204===a?(f=!0,x="nocontent"):304===a?(f=!0,x="notmodified"):(f=I(m,t),x=f.state,l=f.data,s=f.error,f=!s)):(s=x,!a&&x||(x="error",a<0&&(a=0))),w.status=a,w.statusText=(c||x)+"",f?p.resolveWith(n,[l,x,w]):p.rejectWith(n,[w,x,s]),w.statusCode(r),r=b,j&&o.trigger(f?"ajaxSuccess":"ajaxError",[w,m,f?l:s]),q.fireWith(n,[w,x]),j&&(o.trigger("ajaxComplete",[w,m]),--ia.active||ia.event.trigger("ajaxStop")))}"object"==typeof a&&(c=a,a=b),c=c||{};var e,f,g,h,i,j,k,l,m=ia.ajaxSetup({},c),n=m.context||m,o=m.context&&(n.nodeType||n.jquery)?ia(n):ia.event,p=ia.Deferred(),q=ia.Callbacks("once memory"),r=m.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!l)for(l={};b=Kb.exec(h);)l[b[1].toLowerCase()]=b[2];b=l[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?h:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(m.mimeType=a),this},statusCode:function(a){var b;if(a)if(u<2)for(b in a)r[b]=[r[b],a[b]];else w.always(a[w.status]);return this},abort:function(a){var b=a||v;return k&&k.abort(b),d(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,m.url=((a||m.url||Fb)+"").replace(Ib,"").replace(Nb,Eb[1]+"//"),m.type=c.method||c.type||m.method||m.type,m.dataTypes=ia.trim(m.dataType||"*").toLowerCase().match(ka)||[""],null==m.crossDomain&&(e=Ob.exec(m.url.toLowerCase()),m.crossDomain=!(!e||e[1]===Eb[1]&&e[2]===Eb[2]&&(e[3]||("http:"===e[1]?80:443))==(Eb[3]||("http:"===Eb[1]?80:443)))),m.data&&m.processData&&"string"!=typeof m.data&&(m.data=ia.param(m.data,m.traditional)),F(Qb,m,c,w),2===u)return w;j=m.global,j&&0===ia.active++&&ia.event.trigger("ajaxStart"),m.type=m.type.toUpperCase(),m.hasContent=!Mb.test(m.type),g=m.url,m.hasContent||(m.data&&(g=m.url+=(Hb.test(g)?"&":"?")+m.data,delete m.data),m.cache===!1&&(m.url=Jb.test(g)?g.replace(Jb,"$1_="+Gb++):g+(Hb.test(g)?"&":"?")+"_="+Gb++)),m.ifModified&&(ia.lastModified[g]&&w.setRequestHeader("If-Modified-Since",ia.lastModified[g]),ia.etag[g]&&w.setRequestHeader("If-None-Match",ia.etag[g])),(m.data&&m.hasContent&&m.contentType!==!1||c.contentType)&&w.setRequestHeader("Content-Type",m.contentType),w.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+Sb+"; q=0.01":""):m.accepts["*"]);for(f in m.headers)w.setRequestHeader(f,m.headers[f]);if(m.beforeSend&&(m.beforeSend.call(n,w,m)===!1||2===u))return w.abort();v="abort";for(f in{success:1,error:1,complete:1})w[f](m[f]);if(k=F(Rb,m,c,w)){w.readyState=1,j&&o.trigger("ajaxSend",[w,m]),m.async&&m.timeout>0&&(i=setTimeout(function(){w.abort("timeout")},m.timeout));try{u=1,k.send(s,d)}catch(x){if(!(u<2))throw x;d(-1,x)}}else d(-1,"No Transport");return w},getScript:function(a,c){return ia.get(a,b,c,"script")},getJSON:function(a,b,c){return ia.get(a,b,c,"json")}}),ia.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return ia.globalEval(a),a}}}),ia.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),ia.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=W.head||ia("head")[0]||W.documentElement;return{send:function(b,e){c=W.createElement("script"),c.async=!0,a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,b){(b||!c.readyState||/loaded|complete/.test(c.readyState))&&(c.onload=c.onreadystatechange=null,c.parentNode&&c.parentNode.removeChild(c),c=null,b||e(200,"success"))},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(b,!0)}}}});var Ub=[],Vb=/(=)\?(?=&|$)|\?\?/;ia.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Ub.pop()||ia.expando+"_"+Gb++;return this[a]=!0,a}}),ia.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.jsonp!==!1&&(Vb.test(c.url)?"url":"string"==typeof c.data&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vb.test(c.data)&&"data");if(i||"jsonp"===c.dataTypes[0])return f=c.jsonpCallback=ia.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,i?c[i]=c[i].replace(Vb,"$1"+f):c.jsonp!==!1&&(c.url+=(Hb.test(c.url)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||ia.error(f+" was not called"),h[0]},c.dataTypes[0]="json",g=a[f],a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,Ub.push(f)),h&&ia.isFunction(g)&&g(h[0]),h=g=b}),"script"});var Wb,Xb,Yb=0,Zb=a.ActiveXObject&&function(){var a;for(a in Wb)Wb[a](b,!0)};ia.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&J()||K()}:J,Xb=ia.ajaxSettings.xhr(),ia.support.cors=!!Xb&&"withCredentials"in Xb,Xb=ia.support.ajax=!!Xb,Xb&&ia.ajaxTransport(function(c){if(!c.crossDomain||ia.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();if(c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async),c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),c.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l;try{if(d&&(e||4===i.readyState))if(d=b,g&&(i.onreadystatechange=ia.noop,Zb&&delete Wb[g]),e)4!==i.readyState&&i.abort();else{l={},h=i.status,j=i.getAllResponseHeaders(),"string"==typeof i.responseText&&(l.text=i.responseText);try{k=i.statusText}catch(m){k=""}h||!c.isLocal||c.crossDomain?1223===h&&(h=204):h=l.text?200:404}}catch(n){e||f(-1,n)}l&&f(h,k,l,j)},c.async?4===i.readyState?setTimeout(d):(g=++Yb,Zb&&(Wb||(Wb={},ia(a).unload(Zb)),Wb[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(b,!0)}}}});var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+ja+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[P],ec={"*":[function(a,b){var c,d,e=this.createTween(a,b),f=bc.exec(b),g=e.cur(),h=+g||0,i=1,j=20;if(f){if(c=+f[2],d=f[3]||(ia.cssNumber[a]?"":"px"),"px"!==d&&h){h=ia.css(e.elem,a,!0)||c||1;do i=i||".5",h/=i,ia.style(e.elem,a,h+d);while(i!==(i=e.cur()/g)&&1!==i&&--j)}e.unit=d,e.start=h,e.end=f[1]?h+(f[1]+1)*c:c}return e}]};ia.Animation=ia.extend(N,{tweener:function(a,b){ia.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;d<e;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),ia.Tween=Q,Q.prototype={constructor:Q,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(ia.cssNumber[c]?"":"px")},cur:function(){var a=Q.propHooks[this.prop];return a&&a.get?a.get(this):Q.propHooks._default.get(this)},run:function(a){var b,c=Q.propHooks[this.prop];return this.options.duration?this.pos=b=ia.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Q.propHooks._default.set(this),this}},Q.prototype.init.prototype=Q.prototype,Q.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=ia.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){ia.fx.step[a.prop]?ia.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[ia.cssProps[a.prop]]||ia.cssHooks[a.prop])?ia.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Q.propHooks.scrollTop=Q.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},ia.each(["toggle","show","hide"],function(a,b){var c=ia.fn[b];ia.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(R(b,!0),a,d,e)}}),ia.fn.extend({fadeTo:function(a,b,c,d){return this.filter(w).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=ia.isEmptyObject(a),f=ia.speed(b,c,d),g=function(){var b=N(this,ia.extend({},a),f);g.finish=function(){b.stop(!0)},(e||ia._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return"string"!=typeof a&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=null!=a&&a+"queueHooks",f=ia.timers,g=ia._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cc.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem!==this||null!=a&&f[c].queue!==a||(f[c].anim.stop(d),b=!1,f.splice(c,1));!b&&d||ia.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=ia._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=ia.timers,g=d?d.length:0;for(c.finish=!0,ia.queue(this,a,[]),e&&e.cur&&e.cur.finish&&e.cur.finish.call(this),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),ia.each({slideDown:R("show"),slideUp:R("hide"),slideToggle:R("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){ia.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),ia.speed=function(a,b,c){var d=a&&"object"==typeof a?ia.extend({},a):{complete:c||!c&&b||ia.isFunction(a)&&a,duration:a,easing:c&&b||b&&!ia.isFunction(b)&&b};return d.duration=ia.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in ia.fx.speeds?ia.fx.speeds[d.duration]:ia.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){ia.isFunction(d.old)&&d.old.call(this),d.queue&&ia.dequeue(this,d.queue)},d},ia.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},ia.timers=[],ia.fx=Q.prototype.init,ia.fx.tick=function(){var a,c=ia.timers,d=0;for($b=ia.now();d<c.length;d++)a=c[d],a()||c[d]!==a||c.splice(d--,1);c.length||ia.fx.stop(),$b=b},ia.fx.timer=function(a){a()&&ia.timers.push(a)&&ia.fx.start()},ia.fx.interval=13,ia.fx.start=function(){_b||(_b=setInterval(ia.fx.tick,ia.fx.interval))},ia.fx.stop=function(){clearInterval(_b),_b=null},ia.fx.speeds={slow:600,fast:200,_default:400},ia.fx.step={},ia.expr&&ia.expr.filters&&(ia.expr.filters.animated=function(a){return ia.grep(ia.timers,function(b){return a===b.elem}).length}),ia.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){ia.offset.setOffset(this,a,b)});var c,d,e={top:0,left:0},f=this[0],g=f&&f.ownerDocument;if(g)return c=g.documentElement,ia.contains(c,f)?(typeof f.getBoundingClientRect!==V&&(e=f.getBoundingClientRect()),d=S(g),{top:e.top+(d.pageYOffset||c.scrollTop)-(c.clientTop||0),left:e.left+(d.pageXOffset||c.scrollLeft)-(c.clientLeft||0)}):e},ia.offset={setOffset:function(a,b,c){var d=ia.css(a,"position");"static"===d&&(a.style.position="relative");var e,f,g=ia(a),h=g.offset(),i=ia.css(a,"top"),j=ia.css(a,"left"),k=("absolute"===d||"fixed"===d)&&ia.inArray("auto",[i,j])>-1,l={},m={};k?(m=g.position(),e=m.top,f=m.left):(e=parseFloat(i)||0,f=parseFloat(j)||0),ia.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(l.top=b.top-h.top+e),null!=b.left&&(l.left=b.left-h.left+f),"using"in b?b.using.call(a,l):g.css(l)}},ia.fn.extend({position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===ia.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),ia.nodeName(a[0],"html")||(c=a.offset()),c.top+=ia.css(a[0],"borderTopWidth",!0),c.left+=ia.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-ia.css(d,"marginTop",!0),left:b.left-c.left-ia.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||W.documentElement;a&&!ia.nodeName(a,"html")&&"static"===ia.css(a,"position");)a=a.offsetParent;return a||W.documentElement})}}),ia.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);ia.fn[a]=function(e){return ia.access(this,function(a,e,f){var g=S(a);return f===b?g?c in g?g[c]:g.document.documentElement[e]:a[e]:void(g?g.scrollTo(d?ia(g).scrollLeft():f,d?f:ia(g).scrollTop()):a[e]=f)},a,e,arguments.length,null)}}),ia.each({Height:"height",Width:"width"},function(a,c){ia.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){ia.fn[e]=function(e,f){var g=arguments.length&&(d||"boolean"!=typeof e),h=d||(e===!0||f===!0?"margin":"border");return ia.access(this,function(c,d,e){var f;return ia.isWindow(c)?c.document.documentElement["client"+a]:9===c.nodeType?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?ia.css(c,d,h):ia.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.jQuery=a.$=ia,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return ia})}(window),function(){function a(a){function b(b,c,d,e,f,g){for(;f>=0&&f<g;f+=a){var h=e?e[f]:f;d=c(d,b[h],h,b)}return d}return function(c,d,e,f){d=s(d,f,4);var g=!x(c)&&r.keys(c),h=(g||c).length,i=a>0?0:h-1;return arguments.length<3&&(e=c[g?g[i]:i],i+=a),b(c,d,e,g,i,h)}}function b(a){return function(b,c,d){c=t(c,d);for(var e=null!=b&&b.length,f=a>0?0:e-1;f>=0&&f<e;f+=a)if(c(b[f],f,b))return f;return-1}}function c(a,b){var c=C.length,d=a.constructor,e=r.isFunction(d)&&d.prototype||g,f="constructor";for(r.has(a,f)&&!r.contains(b,f)&&b.push(f);c--;)f=C[c],f in a&&a[f]!==e[f]&&!r.contains(b,f)&&b.push(f)}var d=this,e=d._,f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=g.toString,l=g.hasOwnProperty,m=Array.isArray,n=Object.keys,o=h.bind,p=Object.create,q=function(){},r=function(a){return a instanceof r?a:this instanceof r?void(this._wrapped=a):new r(a)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=r),exports._=r):d._=r,r.VERSION="1.8.2";var s=function(a,b,c){if(void 0===b)return a;switch(null==c?3:c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return function(){return a.apply(b,arguments)}},t=function(a,b,c){return null==a?r.identity:r.isFunction(a)?s(a,b,c):r.isObject(a)?r.matcher(a):r.property(a)};r.iteratee=function(a,b){return t(a,b,1/0)};var u=function(a,b){return function(c){var d=arguments.length;if(d<2||null==c)return c;for(var e=1;e<d;e++)for(var f=arguments[e],g=a(f),h=g.length,i=0;i<h;i++){
var j=g[i];b&&void 0!==c[j]||(c[j]=f[j])}return c}},v=function(a){if(!r.isObject(a))return{};if(p)return p(a);q.prototype=a;var b=new q;return q.prototype=null,b},w=Math.pow(2,53)-1,x=function(a){var b=null!=a&&a.length;return"number"==typeof b&&b>=0&&b<=w};r.each=r.forEach=function(a,b,c){b=s(b,c);var d,e;if(x(a))for(d=0,e=a.length;d<e;d++)b(a[d],d,a);else{var f=r.keys(a);for(d=0,e=f.length;d<e;d++)b(a[f[d]],f[d],a)}return a},r.map=r.collect=function(a,b,c){b=t(b,c);for(var d=!x(a)&&r.keys(a),e=(d||a).length,f=Array(e),g=0;g<e;g++){var h=d?d[g]:g;f[g]=b(a[h],h,a)}return f},r.reduce=r.foldl=r.inject=a(1),r.reduceRight=r.foldr=a(-1),r.find=r.detect=function(a,b,c){var d;if(d=x(a)?r.findIndex(a,b,c):r.findKey(a,b,c),void 0!==d&&d!==-1)return a[d]},r.filter=r.select=function(a,b,c){var d=[];return b=t(b,c),r.each(a,function(a,c,e){b(a,c,e)&&d.push(a)}),d},r.reject=function(a,b,c){return r.filter(a,r.negate(t(b)),c)},r.every=r.all=function(a,b,c){b=t(b,c);for(var d=!x(a)&&r.keys(a),e=(d||a).length,f=0;f<e;f++){var g=d?d[f]:f;if(!b(a[g],g,a))return!1}return!0},r.some=r.any=function(a,b,c){b=t(b,c);for(var d=!x(a)&&r.keys(a),e=(d||a).length,f=0;f<e;f++){var g=d?d[f]:f;if(b(a[g],g,a))return!0}return!1},r.contains=r.includes=r.include=function(a,b,c){return x(a)||(a=r.values(a)),r.indexOf(a,b,"number"==typeof c&&c)>=0},r.invoke=function(a,b){var c=j.call(arguments,2),d=r.isFunction(b);return r.map(a,function(a){var e=d?b:a[b];return null==e?e:e.apply(a,c)})},r.pluck=function(a,b){return r.map(a,r.property(b))},r.where=function(a,b){return r.filter(a,r.matcher(b))},r.findWhere=function(a,b){return r.find(a,r.matcher(b))},r.max=function(a,b,c){var d,e,f=-(1/0),g=-(1/0);if(null==b&&null!=a){a=x(a)?a:r.values(a);for(var h=0,i=a.length;h<i;h++)d=a[h],d>f&&(f=d)}else b=t(b,c),r.each(a,function(a,c,d){e=b(a,c,d),(e>g||e===-(1/0)&&f===-(1/0))&&(f=a,g=e)});return f},r.min=function(a,b,c){var d,e,f=1/0,g=1/0;if(null==b&&null!=a){a=x(a)?a:r.values(a);for(var h=0,i=a.length;h<i;h++)d=a[h],d<f&&(f=d)}else b=t(b,c),r.each(a,function(a,c,d){e=b(a,c,d),(e<g||e===1/0&&f===1/0)&&(f=a,g=e)});return f},r.shuffle=function(a){for(var b,c=x(a)?a:r.values(a),d=c.length,e=Array(d),f=0;f<d;f++)b=r.random(0,f),b!==f&&(e[f]=e[b]),e[b]=c[f];return e},r.sample=function(a,b,c){return null==b||c?(x(a)||(a=r.values(a)),a[r.random(a.length-1)]):r.shuffle(a).slice(0,Math.max(0,b))},r.sortBy=function(a,b,c){return b=t(b,c),r.pluck(r.map(a,function(a,c,d){return{value:a,index:c,criteria:b(a,c,d)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(c<d||void 0===d)return-1}return a.index-b.index}),"value")};var y=function(a){return function(b,c,d){var e={};return c=t(c,d),r.each(b,function(d,f){var g=c(d,f,b);a(e,d,g)}),e}};r.groupBy=y(function(a,b,c){r.has(a,c)?a[c].push(b):a[c]=[b]}),r.indexBy=y(function(a,b,c){a[c]=b}),r.countBy=y(function(a,b,c){r.has(a,c)?a[c]++:a[c]=1}),r.toArray=function(a){return a?r.isArray(a)?j.call(a):x(a)?r.map(a,r.identity):r.values(a):[]},r.size=function(a){return null==a?0:x(a)?a.length:r.keys(a).length},r.partition=function(a,b,c){b=t(b,c);var d=[],e=[];return r.each(a,function(a,c,f){(b(a,c,f)?d:e).push(a)}),[d,e]},r.first=r.head=r.take=function(a,b,c){if(null!=a)return null==b||c?a[0]:r.initial(a,a.length-b)},r.initial=function(a,b,c){return j.call(a,0,Math.max(0,a.length-(null==b||c?1:b)))},r.last=function(a,b,c){if(null!=a)return null==b||c?a[a.length-1]:r.rest(a,Math.max(0,a.length-b))},r.rest=r.tail=r.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},r.compact=function(a){return r.filter(a,r.identity)};var z=function(a,b,c,d){for(var e=[],f=0,g=d||0,h=a&&a.length;g<h;g++){var i=a[g];if(x(i)&&(r.isArray(i)||r.isArguments(i))){b||(i=z(i,b,c));var j=0,k=i.length;for(e.length+=k;j<k;)e[f++]=i[j++]}else c||(e[f++]=i)}return e};r.flatten=function(a,b){return z(a,b,!1)},r.without=function(a){return r.difference(a,j.call(arguments,1))},r.uniq=r.unique=function(a,b,c,d){if(null==a)return[];r.isBoolean(b)||(d=c,c=b,b=!1),null!=c&&(c=t(c,d));for(var e=[],f=[],g=0,h=a.length;g<h;g++){var i=a[g],j=c?c(i,g,a):i;b?(g&&f===j||e.push(i),f=j):c?r.contains(f,j)||(f.push(j),e.push(i)):r.contains(e,i)||e.push(i)}return e},r.union=function(){return r.uniq(z(arguments,!0,!0))},r.intersection=function(a){if(null==a)return[];for(var b=[],c=arguments.length,d=0,e=a.length;d<e;d++){var f=a[d];if(!r.contains(b,f)){for(var g=1;g<c&&r.contains(arguments[g],f);g++);g===c&&b.push(f)}}return b},r.difference=function(a){var b=z(arguments,!0,!0,1);return r.filter(a,function(a){return!r.contains(b,a)})},r.zip=function(){return r.unzip(arguments)},r.unzip=function(a){for(var b=a&&r.max(a,"length").length||0,c=Array(b),d=0;d<b;d++)c[d]=r.pluck(a,d);return c},r.object=function(a,b){for(var c={},d=0,e=a&&a.length;d<e;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},r.indexOf=function(a,b,c){var d=0,e=a&&a.length;if("number"==typeof c)d=c<0?Math.max(0,e+c):c;else if(c&&e)return d=r.sortedIndex(a,b),a[d]===b?d:-1;if(b!==b)return r.findIndex(j.call(a,d),r.isNaN);for(;d<e;d++)if(a[d]===b)return d;return-1},r.lastIndexOf=function(a,b,c){var d=a?a.length:0;if("number"==typeof c&&(d=c<0?d+c+1:Math.min(d,c+1)),b!==b)return r.findLastIndex(j.call(a,0,d),r.isNaN);for(;--d>=0;)if(a[d]===b)return d;return-1},r.findIndex=b(1),r.findLastIndex=b(-1),r.sortedIndex=function(a,b,c,d){c=t(c,d,1);for(var e=c(b),f=0,g=a.length;f<g;){var h=Math.floor((f+g)/2);c(a[h])<e?f=h+1:g=h}return f},r.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=c||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=Array(d),f=0;f<d;f++,a+=c)e[f]=a;return e};var A=function(a,b,c,d,e){if(!(d instanceof b))return a.apply(c,e);var f=v(a.prototype),g=a.apply(f,e);return r.isObject(g)?g:f};r.bind=function(a,b){if(o&&a.bind===o)return o.apply(a,j.call(arguments,1));if(!r.isFunction(a))throw new TypeError("Bind must be called on a function");var c=j.call(arguments,2),d=function(){return A(a,d,b,this,c.concat(j.call(arguments)))};return d},r.partial=function(a){var b=j.call(arguments,1),c=function(){for(var d=0,e=b.length,f=Array(e),g=0;g<e;g++)f[g]=b[g]===r?arguments[d++]:b[g];for(;d<arguments.length;)f.push(arguments[d++]);return A(a,c,this,this,f)};return c},r.bindAll=function(a){var b,c,d=arguments.length;if(d<=1)throw new Error("bindAll must be passed function names");for(b=1;b<d;b++)c=arguments[b],a[c]=r.bind(a[c],a);return a},r.memoize=function(a,b){var c=function(d){var e=c.cache,f=""+(b?b.apply(this,arguments):d);return r.has(e,f)||(e[f]=a.apply(this,arguments)),e[f]};return c.cache={},c},r.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},r.defer=r.partial(r.delay,r,1),r.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:r.now(),g=null,f=a.apply(d,e),g||(d=e=null)};return function(){var j=r.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,k<=0||k>b?(g&&(clearTimeout(g),g=null),h=j,f=a.apply(d,e),g||(d=e=null)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},r.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=r.now()-g;j<b&&j>=0?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),d||(f=e=null)))};return function(){f=this,e=arguments,g=r.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},r.wrap=function(a,b){return r.partial(b,a)},r.negate=function(a){return function(){return!a.apply(this,arguments)}},r.compose=function(){var a=arguments,b=a.length-1;return function(){for(var c=b,d=a[b].apply(this,arguments);c--;)d=a[c].call(this,d);return d}},r.after=function(a,b){return function(){if(--a<1)return b.apply(this,arguments)}},r.before=function(a,b){var c;return function(){return--a>0&&(c=b.apply(this,arguments)),a<=1&&(b=null),c}},r.once=r.partial(r.before,2);var B=!{toString:null}.propertyIsEnumerable("toString"),C=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];r.keys=function(a){if(!r.isObject(a))return[];if(n)return n(a);var b=[];for(var d in a)r.has(a,d)&&b.push(d);return B&&c(a,b),b},r.allKeys=function(a){if(!r.isObject(a))return[];var b=[];for(var d in a)b.push(d);return B&&c(a,b),b},r.values=function(a){for(var b=r.keys(a),c=b.length,d=Array(c),e=0;e<c;e++)d[e]=a[b[e]];return d},r.mapObject=function(a,b,c){b=t(b,c);for(var d,e=r.keys(a),f=e.length,g={},h=0;h<f;h++)d=e[h],g[d]=b(a[d],d,a);return g},r.pairs=function(a){for(var b=r.keys(a),c=b.length,d=Array(c),e=0;e<c;e++)d[e]=[b[e],a[b[e]]];return d},r.invert=function(a){for(var b={},c=r.keys(a),d=0,e=c.length;d<e;d++)b[a[c[d]]]=c[d];return b},r.functions=r.methods=function(a){var b=[];for(var c in a)r.isFunction(a[c])&&b.push(c);return b.sort()},r.extend=u(r.allKeys),r.extendOwn=r.assign=u(r.keys),r.findKey=function(a,b,c){b=t(b,c);for(var d,e=r.keys(a),f=0,g=e.length;f<g;f++)if(d=e[f],b(a[d],d,a))return d},r.pick=function(a,b,c){var d,e,f={},g=a;if(null==g)return f;r.isFunction(b)?(e=r.allKeys(g),d=s(b,c)):(e=z(arguments,!1,!1,1),d=function(a,b,c){return b in c},g=Object(g));for(var h=0,i=e.length;h<i;h++){var j=e[h],k=g[j];d(k,j,g)&&(f[j]=k)}return f},r.omit=function(a,b,c){if(r.isFunction(b))b=r.negate(b);else{var d=r.map(z(arguments,!1,!1,1),String);b=function(a,b){return!r.contains(d,b)}}return r.pick(a,b,c)},r.defaults=u(r.allKeys,!0),r.create=function(a,b){var c=v(a);return b&&r.extendOwn(c,b),c},r.clone=function(a){return r.isObject(a)?r.isArray(a)?a.slice():r.extend({},a):a},r.tap=function(a,b){return b(a),a},r.isMatch=function(a,b){var c=r.keys(b),d=c.length;if(null==a)return!d;for(var e=Object(a),f=0;f<d;f++){var g=c[f];if(b[g]!==e[g]||!(g in e))return!1}return!0};var D=function(a,b,c,d){if(a===b)return 0!==a||1/a===1/b;if(null==a||null==b)return a===b;a instanceof r&&(a=a._wrapped),b instanceof r&&(b=b._wrapped);var e=k.call(a);if(e!==k.call(b))return!1;switch(e){case"[object RegExp]":case"[object String]":return""+a==""+b;case"[object Number]":return+a!==+a?+b!==+b:0===+a?1/+a===1/b:+a===+b;case"[object Date]":case"[object Boolean]":return+a===+b}var f="[object Array]"===e;if(!f){if("object"!=typeof a||"object"!=typeof b)return!1;var g=a.constructor,h=b.constructor;if(g!==h&&!(r.isFunction(g)&&g instanceof g&&r.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1}c=c||[],d=d||[];for(var i=c.length;i--;)if(c[i]===a)return d[i]===b;if(c.push(a),d.push(b),f){if(i=a.length,i!==b.length)return!1;for(;i--;)if(!D(a[i],b[i],c,d))return!1}else{var j,l=r.keys(a);if(i=l.length,r.keys(b).length!==i)return!1;for(;i--;)if(j=l[i],!r.has(b,j)||!D(a[j],b[j],c,d))return!1}return c.pop(),d.pop(),!0};r.isEqual=function(a,b){return D(a,b)},r.isEmpty=function(a){return null==a||(x(a)&&(r.isArray(a)||r.isString(a)||r.isArguments(a))?0===a.length:0===r.keys(a).length)},r.isElement=function(a){return!(!a||1!==a.nodeType)},r.isArray=m||function(a){return"[object Array]"===k.call(a)},r.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a},r.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(a){r["is"+a]=function(b){return k.call(b)==="[object "+a+"]"}}),r.isArguments(arguments)||(r.isArguments=function(a){return r.has(a,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(r.isFunction=function(a){return"function"==typeof a||!1}),r.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},r.isNaN=function(a){return r.isNumber(a)&&a!==+a},r.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"===k.call(a)},r.isNull=function(a){return null===a},r.isUndefined=function(a){return void 0===a},r.has=function(a,b){return null!=a&&l.call(a,b)},r.noConflict=function(){return d._=e,this},r.identity=function(a){return a},r.constant=function(a){return function(){return a}},r.noop=function(){},r.property=function(a){return function(b){return null==b?void 0:b[a]}},r.propertyOf=function(a){return null==a?function(){}:function(b){return a[b]}},r.matcher=r.matches=function(a){return a=r.extendOwn({},a),function(b){return r.isMatch(b,a)}},r.times=function(a,b,c){var d=Array(Math.max(0,a));b=s(b,c,1);for(var e=0;e<a;e++)d[e]=b(e);return d},r.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},r.now=Date.now||function(){return(new Date).getTime()};var E={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},F=r.invert(E),G=function(a){var b=function(b){return a[b]},c="(?:"+r.keys(a).join("|")+")",d=RegExp(c),e=RegExp(c,"g");return function(a){return a=null==a?"":""+a,d.test(a)?a.replace(e,b):a}};r.escape=G(E),r.unescape=G(F),r.result=function(a,b,c){var d=null==a?void 0:a[b];return void 0===d&&(d=c),r.isFunction(d)?d.call(a):d};var H=0;r.uniqueId=function(a){var b=++H+"";return a?a+b:b},r.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var I=/(.)^/,J={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},K=/\\|'|\r|\n|\u2028|\u2029/g,L=function(a){return"\\"+J[a]};r.template=function(a,b,c){!b&&c&&(b=c),b=r.defaults({},b,r.templateSettings);var d=RegExp([(b.escape||I).source,(b.interpolate||I).source,(b.evaluate||I).source].join("|")+"|$","g"),e=0,f="__p+='";a.replace(d,function(b,c,d,g,h){return f+=a.slice(e,h).replace(K,L),e=h+b.length,c?f+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'":d?f+="'+\n((__t=("+d+"))==null?'':__t)+\n'":g&&(f+="';\n"+g+"\n__p+='"),b}),f+="';\n",b.variable||(f="with(obj||{}){\n"+f+"}\n"),f="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+f+"return __p;\n";try{var g=new Function(b.variable||"obj","_",f)}catch(h){throw h.source=f,h}var i=function(a){return g.call(this,a,r)},j=b.variable||"obj";return i.source="function("+j+"){\n"+f+"}",i},r.chain=function(a){var b=r(a);return b._chain=!0,b};var M=function(a,b){return a._chain?r(b).chain():b};r.mixin=function(a){r.each(r.functions(a),function(b){var c=r[b]=a[b];r.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),M(this,c.apply(r,a))}})},r.mixin(r),r.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];r.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!==a&&"splice"!==a||0!==c.length||delete c[0],M(this,c)}}),r.each(["concat","join","slice"],function(a){var b=f[a];r.prototype[a]=function(){return M(this,b.apply(this._wrapped,arguments))}}),r.prototype.value=function(){return this._wrapped},r.prototype.valueOf=r.prototype.toJSON=r.prototype.value,r.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return r})}.call(this),null==window.BI&&(window.BI={}),window.BI||(window.BI={}),!function(a,b){var c=function(a,b){return function(c,d,e){return a.call(b,d,c,e)}},d=function(a){return function(){return _[a].apply(_,arguments)}},e=function(a){return function(){var b=Array.prototype.slice.call(arguments,0);return b[1]=_.isFunction(b[1])?c(b[1],b[2]):b[1],_[a].apply(_,b)}};_.extend(BI,{i18nText:function(a){var b=BI.i18n&&BI.i18n[a]||"";b||(b=a);var c=arguments.length;if(c>1)for(var d=1;d<c;d++){var a="{R"+d+"}";b=b.replaceAll(a,arguments[d]+"")}return b},assert:function(a,b){if(this.isFunction(b)){if(b(a))return!0;throw new Error(a+" error")}if(this.isArray(b)||(b=[b]),!this.deepContains(b,a))throw new Error(a+" error")},warn:function(a){console.warn(a)},UUID:function(){for(var a=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],b="",c=0;c<16;c++){var d=parseInt(a.length*Math.random(),10);b+=a[d]}return b},isWidget:function(a){return a instanceof BI.Widget||BI.View&&a instanceof BI.View},createWidgets:function(a,b){if(!BI.isArray(a))throw new Error("cannot create Widgets");return BI.map(BI.flatten(a),function(a,c){return BI.createWidget(c,BI.deepClone(b))})},createItems:function(a,b,c){return b=BI.isArray(b)?b:BI.makeArray(BI.flatten(a).length,b),c=BI.isArray(c)?c:BI.makeArray(BI.flatten(a).length,c),BI.map(a,function(a,d){return BI.isArray(d)?BI.createItems(d,b,c):d instanceof BI.Widget?BI.extend({},b.shift(),c.shift(),{type:null,el:d}):b[0]instanceof BI.Widget?(c.shift(),BI.extend({},d,{el:b.shift()})):d.el instanceof BI.Widget||BI.View&&d.el instanceof BI.View?(b.shift(),BI.extend({},c.shift(),{type:null},d)):d.el?BI.extend({},c.shift(),d,{el:BI.extend({},b.shift(),d.el)}):BI.extend({},c.shift(),{el:BI.extend({},b.shift(),d)})})},packageItems:function(a,b){for(var c=b.length-1;c>=0;c--)a=BI.map(a,function(a,d){return BI.extend({},b[c],{items:[BI.extend({},b[c].el,{el:d})]})});return a},formatEL:function(a){return a&&!a.type&&a.el?a:{el:a}},stripEL:function(a){return a.type&&a||a.el||a},trans2Element:function(a){return BI.map(a,function(a,b){return b.element})}}),_.each(["where","findWhere","contains","invoke","pluck","shuffle","sample","toArray","size"],function(a){BI[a]=d(a)}),_.each(["each","map","reduce","reduceRight","find","filter","reject","every","all","some","any","max","min","sortBy","groupBy","indexBy","countBy","partition"],function(a){BI[a]=e(a)}),_.extend(BI,{clamp:function(a,b,c){return a<b&&(a=b),a>c&&(a=c),a},count:function(a,b,c){var d;if(c)for(d=a;d<b;d++)c(d);return b-a},inverse:function(a,b,c){return BI.count(b,a,c)},firstKey:function(a){var c=b;return BI.any(a,function(a,b){return c=a,!0}),c},lastKey:function(a){var c=b;return BI.each(a,function(a,b){return c=a,!0}),c},firstObject:function(a){var c=b;return BI.any(a,function(a,b){return c=b,!0}),c},lastObject:function(a){var c=b;return BI.each(a,function(a,b){return c=b,!0}),c},concat:function(a,b){return BI.isKey(a)?a+""+b:BI.isArray(a)?a.concat(b):BI.isObject(a)?_.extend({},a,b):void 0},backEach:function(a,b,c){b=BI.iteratee(b,c);for(var d=a.length-1;d>=0;d--)b(d,a[d],a);return!1},backAny:function(a,b,c){b=BI.iteratee(b,c);for(var d=a.length-1;d>=0;d--)if(b(d,a[d],a))return!0;return!1},backEvery:function(a,b,c){b=BI.iteratee(b,c);for(var d=a.length-1;d>=0;d--)if(!b(d,a[d],a))return!1;return!0},backFindKey:function(a,b,c){b=BI.iteratee(b,c);for(var d,e=_.keys(a),f=e.length-1;f>=0;f--)if(d=e[f],b(a[d],d,a))return d},backFind:function(a,b,c){var d;if(d=BI.isArray(a)?BI.findLastIndex(a,b,c):BI.backFindKey(a,b,c),void 0!==d&&d!==-1)return a[d]},remove:function(a,b,c){var d=BI.isFunction(b);b=d||BI.isArray(b)?b:[b];var e;if(BI.isArray(a))for(e=0;e<a.length;e++)(d&&b.apply(c,[e,a[e]])===!0||!d&&b.contains(a[e]))&&a.splice(e--,1);else BI.each(a,function(e,f){(d&&b.apply(c,[e,a[e]])===!0||!d&&b.contains(a[e]))&&delete a[e]})},removeAt:function(a,b){b=BI.isArray(b)?b:[b];var c,d=BI.isArray(a);for(c=0;c<b.length;c++)d?a[b[c]]="$deleteIndex":delete a[b[c]];d&&BI.remove(a,"$deleteIndex")},string2Array:function(a){return a.split("&-&")},array2String:function(a){return a.join("&-&")},abc2Int:function(a){for(var b=0,c="A",a=a.toUpperCase(),d=0,e=a.length;d<e;++d)if(b=a.charAt(d).charCodeAt(0)-c.charCodeAt(0)+26*b+1,b>(2147483646-a.charAt(d).charCodeAt(0)+c.charCodeAt(0))/26)return 0;return b},int2Abc:function(a){var b=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],c=a,d="";if(0===a)return"";for(;0!==c;){var e=c%26;0===e&&(e=26),d=b[e-1]+d,c=(c-e)/26}return d}}),_.each(["first","initial","last","rest","compact","flatten","without","union","intersection","difference","zip","unzip","object","indexOf","lastIndexOf","sortedIndex","range"],function(a){BI[a]=d(a)}),_.each(["findIndex","findLastIndex"],function(a){BI[a]=e(a)}),_.extend(BI,{makeArray:function(a,b){for(var c=[],d=0;d<a;d++)BI.isNull(b)?c.push(d):c.push(BI.deepClone(b));return c},makeObject:function(a,b){for(var c={},d=0;d<a.length;d++)BI.isNull(b)?c[a[d]]=a[d]:c[a[d]]=BI.deepClone(b);return c},makeArrayByArray:function(a,b){var c=[];if(!a)return c;for(var d=0,e=a.length;d<e;d++)BI.isArray(a[d])?c.push(arguments.callee(a[d],b)):c.push(BI.deepClone(b));return c},uniq:function(a,b,d,e){return null==a?[]:(_.isBoolean(b)||(e=d,d=b,b=!1),d&&(d=c(d,e)),_.uniq.call(_,a,b,d,e))}}),_.each(["keys","allKeys","values","pairs","invert","create","functions","extend","extendOwn","defaults","clone","property","propertyOf","matcher","isEqual","isMatch","isEmpty","isElement","isNumber","isString","isArray","isObject","isArguments","isFunction","isFinite","isBoolean","isDate","isRegExp","isError","isNaN","isUndefined"],function(a){BI[a]=d(a)}),_.each(["mapObject","findKey","pick","omit","tap"],function(a){BI[a]=e(a)}),_.extend(BI,{inherit:function(a,b,c){"object"==typeof b&&(c=b,b=a,a=function(){return b.apply(this,arguments)});var d=function(){},e=b.prototype;return d.prototype=e,a.prototype=new d,a.superclass=e,_.extend(a.prototype,c,{superclass:b}),a},has:function(a,b){return BI.isArray(b)?0!==b.length&&BI.every(b,function(b,c){return _.has(a,c)}):_.has.apply(_,arguments)},isKey:function(a){return BI.isNumber(a)||BI.isString(a)&&a.length>0},isCapitalEqual:function(a,b){return a=BI.isNull(a)?a:(""+a).toLowerCase(),b=BI.isNull(b)?b:(""+b).toLowerCase(),BI.isEqual(a,b)},isWidthOrHeight:function(a){return"number"==typeof a?a>=0:"string"==typeof a?/^\d{1,3}%$/.exec(a)||"auto"==a||/^\d+px$/.exec(a):void 0},isNotNull:function(a){return!BI.isNull(a)},isNull:function(a){return"undefined"==typeof a||null===a},isPlainObject:function(){return a.isPlainObject.apply(a,arguments)},isEmptyArray:function(a){return BI.isArray(a)&&BI.isEmpty(a)},isNotEmptyArray:function(a){return BI.isArray(a)&&!BI.isEmpty(a)},isEmptyObject:function(a){return BI.isEqual(a,{})},isNotEmptyObject:function(a){return BI.isPlainObject(a)&&!BI.isEmptyObject(a)},isEmptyString:function(a){return BI.isString(a)&&0===a.length},isNotEmptyString:function(a){return BI.isString(a)&&!BI.isEmptyString(a)},isWindow:function(){return a.isWindow.apply(a,arguments)}}),_.extend(BI,{deepClone:function(a){if(null===a||a===b)return a;var c=Object.prototype.toString.call(a);if("[object Date]"===c)return Date.getDate(a.getTime());var d,e;if("[object Array]"===c)for(d=a.length,e=[];d--;)e[d]=BI.deepClone(a[d]);else if("[object Object]"===c&&a.constructor===Object){e={};for(var d in a)_.has(a,d)&&(e[d]=BI.deepClone(a[d]))}return e||a},isDeepMatch:function(a,b){var c=BI.keys(b),d=c.length;if(null==a)return!d;for(var e=Object(a),f=0;f<d;f++){var g=c[f];if(!(BI.isEqual(b[g],e[g])&&g in e))return!1}return!0},deepContains:function(a,b){return BI.isObject(b)?BI.any(a,function(a,c){if(BI.isEqual(c,b))return!0}):BI.contains(a,b)},deepIndexOf:function(a,b){for(var c=0;c<a.length;c++)if(BI.isEqual(b,a[c]))return c;return-1},deepRemove:function(a,b){var c,d=!1;if(BI.isArray(a))for(c=0;c<a.length;c++)BI.isEqual(b,a[c])&&(a.splice(c--,1),d=!0);else BI.each(a,function(c,e){BI.isEqual(b,a[c])&&(delete a[c],d=!0)});return d},deepWithout:function(a,b){if(BI.isArray(a)){for(var c=[],d=0;d<a.length;d++)BI.isEqual(b,a[d])||c.push(a[d]);return c}var c={};return BI.each(a,function(d,e){BI.isEqual(b,a[d])||(c[d]=e)}),c},deepUnique:function(a){var b=[];return BI.each(a,function(a,c){BI.deepContains(b,c)||b.push(c)}),b},deepDiff:function(a,b){a||(a={}),b||(b={});var c=[],d=[];for(var e in a)this.has(a,e)&&(this.isEqual(a[e],b[e])||c.push(e),d.push(e));for(var e in b)this.has(b,e)&&!d.contains(e)&&c.push(e);return c},deepExtend:function(){var b=[].slice.call(arguments);return b.unshift(!0),a.extend.apply(a,b)}}),_.each(["uniqueId","result","chain","iteratee","escape","unescape"],function(a){BI[a]=function(){return _[a].apply(_,arguments)}}),_.each(["bind","once","partial","debounce","throttle","delay","defer","wrap"],function(a){BI[a]=function(){return _[a].apply(_,arguments)}}),_.extend(BI,{nextTick:function(){function a(){d=!1;var a=c.slice(0);c=[];for(var b=0;b<a.length;b++)a[b]()}var b,c=[],d=!1;if("undefined"!=typeof Promise){var e=Promise.resolve();b=function(){e.then(a)}}else if("undefined"!=typeof MutationObserver){var f=1,g=new MutationObserver(a),h=document.createTextNode(f+"");g.observe(h,{characterData:!0}),b=function(){f=(f+1)%2,h.data=f+""}}else b=function(){setTimeout(a,0)};return function(a){var e,f=[].slice.call(arguments,1);if(c.push(function(){a&&a.apply(null,f),e&&e.apply(null,f)}),d||(d=!0,b()),!a&&"undefined"!=typeof Promise)return new Promise(function(a){e=a})}}()}),_.each(["random"],function(a){BI[a]=d(a)}),_.extend(BI,{getTime:function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():Date.getDate().getTime()},parseInt:function(a){var b=10;/^0x/g.test(a)&&(b=16);try{return parseInt(a,b)}catch(c){throw new Error(a+"parse int error")}},parseSafeInt:function(a){var b=9007199254740991;return a?this.clamp(this.parseInt(a),-b,b):0===a?a:0},parseFloat:function(a){try{return parseFloat(a)}catch(b){throw new Error(a+"parse float error")}},isNaturalNumber:function(a){return!!/^\d+$/.test(a)},isPositiveInteger:function(a){return!!/^\+?[1-9][0-9]*$/.test(a)},isNegativeInteger:function(a){return!!/^\-[1-9][0-9]*$/.test(a)},isInteger:function(a){return!!/^\-?\d+$/.test(a)},isNumeric:function(b){return a.isNumeric(b)},isFloat:function(a){return!!/^([+-]?)\\d*\\.\\d+$/.test(a)},isOdd:function(a){return!!BI.isInteger(a)&&a&!0},isEven:function(a){return!!BI.isInteger(a)&&a&!1},sum:function(a,b,c){var d=0;return BI.each(a,function(a,e){d+=b?Number(b.apply(c,[a,e])):Number(e)}),d},average:function(a,b,c){var d=BI.sum(a,b,c);return d/a.length}}),_.extend(BI,{trim:function(){return a.trim.apply(a,arguments)},toUpperCase:function(a){return(a+"").toLocaleUpperCase()},toLowerCase:function(a){return(a+"").toLocaleLowerCase()},isEndWithBlank:function(a){return/(\s|\u00A0)$/.test(a)},isLiteral:function(a){var b=/^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/;return b.test(a)},stripQuotes:function(a){var b=a.charCodeAt(0),c=a.charCodeAt(a.length-1);return b!==c||34!==b&&39!==b?a:a.slice(1,-1)},camelize:function(a){return a.replace(/-(.)/g,function(a,b){return b.toUpperCase()})},hyphenate:function(a){return a.replace(/([A-Z])/g,"-$1").toLowerCase()},isNotEmptyString:function(a){return BI.isString(a)&&!BI.isEmpty(a)},isEmptyString:function(a){return BI.isString(a)&&BI.isEmpty(a)},encrypt:function(a,b){if(""==a)return"";if(a=escape(a),b&&""!=b||(b="655"),b=escape(b),null==b||b.length<=0)return alert("Please enter a password with which to encrypt the message."),null;for(var c="",d=0;d<b.length;d++)c+=b.charCodeAt(d).toString();var e=Math.floor(c.length/5),f=parseInt(c.charAt(e)+c.charAt(2*e)+c.charAt(3*e)+c.charAt(4*e)+c.charAt(5*e)),g=Math.ceil(b.length/2),h=Math.pow(2,31)-1;if(f<2)return alert("Algorithm cannot find a suitable hash. Please choose a different password. \nPossible considerations are to choose a more complex or longer password."),null;var i=101;for(c+=i;c.length>10;)c=(parseInt(c.substring(0,10))+parseInt(c.substring(10,c.length),10)).toString();c=(f*c+g)%h;for(var j="",k="",d=0;d<a.length;d++)j=parseInt(a.charCodeAt(d)^Math.floor(c/h*255)),k+=j<16?"0"+j.toString(16):j.toString(16),c=(f*c+g)%h;for(i=i.toString(16);i.length<8;)i="0"+i;return k+=i},decrypt:function(a,b){if(""==a)return"";if(b&&""!=b||(b="655"),b=escape(b),!(null==a||a.length<8||null==b||b.length<=0)){for(var c="",d=0;d<b.length;d++)c+=b.charCodeAt(d).toString();var e=Math.floor(c.length/5),f=c.charAt(e)+c.charAt(2*e)+c.charAt(3*e)+c.charAt(4*e);5*e<c.length&&(f+=c.charAt(5*e));var g=parseInt(f),h=Math.round(b.length/2),i=Math.pow(2,31)-1,j=parseInt(a.substring(a.length-8,a.length),16);for(a=a.substring(0,a.length-8),c+=j;c.length>10;)c=(parseInt(c.substring(0,10),10)+parseInt(c.substring(10,c.length),10)).toString();c=(g*c+h)%i;for(var k="",l="",d=0;d<a.length;d+=2)k=parseInt(parseInt(a.substring(d,d+2),16)^Math.floor(c/i*255)),l+=String.fromCharCode(k),c=(g*c+h)%i;return unescape(l)}}}),_.extend(BI,{isIE:function(){return null==this.__isIE&&(this.__isIE=/(msie|trident)/i.test(navigator.userAgent.toLowerCase())),this.__isIE},getIEVersion:function(){if(null!=this.__IEVersion)return this.__IEVersion;var a=0,b=navigator.userAgent.toLowerCase(),c=b.match(/(?:msie\s([\w.]+))/),d=b.match(/(?:trident.*rv:([\w.]+))/);return a=c&&d&&c[1]&&d[1]?Math.max(1*c[1],1*d[1]):c&&c[1]?1*c[1]:d&&d[1]?1*d[1]:0,this.__IEVersion=a},isIE9Below:function(){return!!BI.isIE()&&this.getIEVersion()<9},isEdge:function(){return/edge/i.test(navigator.userAgent.toLowerCase())},isChrome:function(){return/chrome/i.test(navigator.userAgent.toLowerCase())},isFireFox:function(){return/firefox/i.test(navigator.userAgent.toLowerCase())},isOpera:function(){return/opera/i.test(navigator.userAgent.toLowerCase())},isSafari:function(){return/safari/i.test(navigator.userAgent.toLowerCase())},isKhtml:function(){return/Konqueror|Safari|KHTML/i.test(navigator.userAgent)},isMac:function(){return/macintosh|mac os x/i.test(navigator.userAgent)},isWindows:function(){return/windows|win32/i.test(navigator.userAgent)},isSupportCss3:function(a){var b,c,d=["webkit","Moz","ms","o"],e=[],f=document.documentElement.style,g=function(a){return a.replace(/-(\w)/g,function(a,b){return b.toUpperCase()})};for(b in d)e.push(g(d[b]+"-"+a));for(e.push(g(a)),b=0,c=e.length;b<c;b++)if(e[b]in f)return!0;return!1}}),_.extend(BI,{ajax:function(b){b||(b={});var c=b.async;b.data=BI.cjkEncodeDO(b.data||{}),a.ajax({url:b.url,type:"POST",data:b.data,async:c,error:b.error,complete:function(a,c){BI.isFunction(b.complete)&&b.complete(BI.jsonDecode(a.responseText),c)}})}})}(jQuery),BI.OB=function(a){var b=this.props;BI.isFunction(this.props)&&(b=this.props(a)),this.options=$.extend(this._defaultConfig(a),b,a),this._init(),this._initRef()},$.extend(BI.OB.prototype,{props:{},init:null,destroyed:null,_defaultConfig:function(a){return{}},_init:function(){this._initListeners(),this.init&&this.init()},_initListeners:function(){var a=this;null!=this.options.listeners&&($.each(this.options.listeners,function(b,c){(c.target?c.target:a)[c.once?"once":"on"](c.eventName,_.bind(c.action,a))}),delete this.options.listeners)},_initRef:function(){this.options.ref&&this.options.ref.call(this,this)},_getEvents:function(){return $.isArray(this.events)||(this.events=[]),this.events},on:function(a,b){a=a.toLowerCase();var c=this._getEvents()[a];$.isArray(c)||(c=[],this._getEvents()[a]=c),c.push(b)},once:function(a,b){var c=function(){b.apply(this,arguments),this.un(a,c)};this.on(a,c)},un:function(a,b){if(a=a.toLowerCase(),null==b)delete this._getEvents()[a];else{var c=this._getEvents()[a];if($.isArray(c)){var d=[];$.each(c,function(a,c){c!=b&&d.push(c)}),this._getEvents()[a]=d}}},purgeListeners:function(){this.events=[]},fireEvent:function(){var a=arguments[0].toLowerCase(),b=this._getEvents()[a];if(BI.isArray(b))if(BI.isArguments(arguments[1])){for(var c=0;c<b.length;c++)if(b[c].apply(this,arguments[1])===!1)return!1}else for(var d=Array.prototype.slice.call(arguments,1),c=0;c<b.length;c++)if(b[c].apply(this,d)===!1)return!1;return!0},destroy:function(){this.destroyed&&this.destroyed(),this.purgeListeners()}}),BI.Widget=BI.inherit(BI.OB,{_defaultConfig:function(){return BI.extend(BI.Widget.superclass._defaultConfig.apply(this),{root:!1,tagName:"div",attributes:null,data:null,tag:null,disabled:!1,invisible:!1,invalid:!1,baseCls:"",extraCls:"",cls:""})},beforeCreate:null,created:null,render:null,beforeMount:null,mounted:null,shouldUpdate:null,update:function(){},beforeDestroy:null,destroyed:null,_init:function(){BI.Widget.superclass._init.apply(this,arguments),this.beforeCreate&&this.beforeCreate(),this._initRoot(),this._initElementWidth(),this._initElementHeight(),this._initVisual(),this._initState(),this._initElement(),this._initEffects(),this.created&&this.created()},_initRoot:function(){var a=this.options;this.widgetName=a.widgetName||BI.uniqueId("widget"),this._isRoot=a.root,BI.isWidget(a.element)?(a.element instanceof BI.Widget?(this._parent=a.element,this._parent.addWidget(this.widgetName,this)):this._isRoot=!0,this.element=this.options.element.element):a.element?(this.element=$(a.element),this._isRoot=!0):this.element=$(document.createElement(a.tagName)),
this.element._isWidget=!0,(a.baseCls||a.extraCls||a.cls)&&this.element.addClass((a.baseCls||"")+" "+(a.extraCls||"")+" "+(a.cls||"")),a.attributes&&this.element.attr(a.attributes),a.data&&this.element.data(a.data),this._children={}},_initElementWidth:function(){var a=this.options;BI.isWidthOrHeight(a.width)&&this.element.css("width",a.width)},_initElementHeight:function(){var a=this.options;BI.isWidthOrHeight(a.height)&&this.element.css("height",a.height)},_initVisual:function(){var a=this.options;a.invisible&&this.element.css("display","none")},_initEffects:function(){var a=this.options;(a.disabled||a.invalid)&&(this.options.disabled&&this.setEnable(!1),this.options.invalid&&this.setValid(!1))},_initState:function(){this._isMounted=!1},_initElement:function(){var a=this,b=this.render&&this.render();BI.isPlainObject(b)&&(b=[b]),BI.isArray(b)&&BI.each(b,function(b,c){BI.createWidget(c,{element:a})}),this._mount()},_setParent:function(a){this._parent=a},_mount:function(){var a=this,b=this._isMounted;!b&&this.isVisible()&&(this._isRoot===!0?b=!0:this._parent&&this._parent._isMounted===!0&&(b=!0),b&&(this.beforeMount&&this.beforeMount(),this._isMounted=!0,this._mountChildren&&this._mountChildren(),BI.each(this._children,function(b,c){!a.isEnabled()&&c._setEnable(!1),!a.isValid()&&c._setValid(!1),c._mount&&c._mount()}),this.mounted&&this.mounted()))},_mountChildren:null,isMounted:function(){return this._isMounted},setWidth:function(a){this.options.width=a,this._initElementWidth()},setHeight:function(a){this.options.height=a,this._initElementHeight()},_setEnable:function(a){a===!0?this.options.disabled=!1:a===!1&&(this.options.disabled=!0),BI.each(this._children,function(b,c){!c._manualSetEnable&&c._setEnable&&c._setEnable(a)})},_setValid:function(a){a===!0?this.options.invalid=!1:a===!1&&(this.options.invalid=!0),BI.each(this._children,function(b,c){!c._manualSetValid&&c._setValid&&c._setValid(a)})},_setVisible:function(a){a===!0?this.options.invisible=!1:a===!1&&(this.options.invisible=!0)},setEnable:function(a){this._manualSetEnable=!0,this._setEnable(a),a===!0?this.element.removeClass("base-disabled disabled"):a===!1&&this.element.addClass("base-disabled disabled")},setVisible:function(a){this._setVisible(a),a===!0?(this.element.css("display",""),this._mount()):a===!1&&this.element.css("display","none"),this.fireEvent(BI.Events.VIEW,a)},setValid:function(a){this._manualSetValid=!0,this._setValid(a),a===!0?this.element.removeClass("base-invalid invalid"):a===!1&&this.element.addClass("base-invalid invalid")},doBehavior:function(){var a=arguments;BI.each(this._children,function(b,c){c.doBehavior&&c.doBehavior.apply(c,a)})},getWidth:function(){return this.options.width},getHeight:function(){return this.options.height},isValid:function(){return!this.options.invalid},addWidget:function(a,b){var c=this;if(a instanceof BI.Widget&&(b=a,a=b.getName()),BI.isKey(a)&&(a+=""),a=a||b.getName()||BI.uniqueId("widget"),this._children[a])throw new Error("name has already been existed");return b._setParent&&b._setParent(this),b.on(BI.Events.DESTROY,function(){BI.remove(c._children,this)}),this._children[a]=b},getWidgetByName:function(a){if(!BI.isKey(a)||a===this.getName())return this;a+="";var b=void 0,c={};return BI.any(this._children,function(d,e){return d===a?(b=e,!0):void(c[d]=e)}),b||BI.any(c,function(a,c){return b=c.getWidgetByName(a)}),b},removeWidget:function(a){BI.isWidget(a)?BI.remove(this._children,a):delete this._children[a]},hasWidget:function(a){return null!=this._children[a]},getName:function(){return this.widgetName},setTag:function(a){this.options.tag=a},getTag:function(){return this.options.tag},attr:function(a,b){var c=this;return BI.isPlainObject(a)?void BI.each(a,function(a,b){c.attr(a,b)}):BI.isNotNull(b)?this.options[a]=b:this.options[a]},getText:function(){},setText:function(a){},getValue:function(){},setValue:function(a){},isEnabled:function(){return!this.options.disabled},isVisible:function(){return!this.options.invisible},disable:function(){this.setEnable(!1)},enable:function(){this.setEnable(!0)},valid:function(){this.setValid(!0)},invalid:function(){this.setValid(!1)},invisible:function(){this.setVisible(!1)},visible:function(){this.setVisible(!0)},__d:function(){this.beforeDestroy&&this.beforeDestroy(),BI.each(this._children,function(a,b){b&&b._unMount&&b._unMount()}),this._children={},this._parent=null,this._isMounted=!1,this.destroyed&&this.destroyed()},_unMount:function(){this.__d(),this.fireEvent(BI.Events.UNMOUNT),this.purgeListeners()},isolate:function(){this._parent&&this._parent.removeWidget(this),BI.DOM.hang([this])},empty:function(){BI.each(this._children,function(a,b){b&&b._unMount&&b._unMount()}),this._children={},this.element.empty()},_destroy:function(){this.__d(),this.element.destroy(),this.purgeListeners()},destroy:function(){this.__d(),this.element.destroy(),this.fireEvent(BI.Events.DESTROY),this.purgeListeners()}}),function(){var a={};BI.shortcut=function(b,c){if(null!=a[b])throw"shortcut:["+b+"] has been registed";a[b]=c};var b=function(b){if(b.classType)return new(new Function("return "+b.classType+";")())(b);var c=a[b.type];return new c(b)};BI.createWidget=function(a,c){var d,e;if(c||(c={}),BI.isEmpty(a)&&BI.isEmpty(c))return BI.createWidget({type:"bi.layout"});if(BI.isWidget(a))return a;if(a&&(a.type||c.type))return d=BI.extend({},c,a),e=BI.Plugin.getWidget(d.type,d),e.type===d.type?BI.Plugin.getObject(d.type,b(e)):BI.createWidget(BI.extend({},a,{type:e.type},c));if(a&&a.el&&(a.el.type||c.type))return d=BI.extend({},c,a.el),e=BI.Plugin.getWidget(d.type,d),e.type===d.type?BI.Plugin.getObject(d.type,b(e)):BI.createWidget(BI.extend({},a,{type:e.type},c));if(a&&BI.isWidget(a.el))return a.el;throw new Error("无法根据item创建组件")}}(),function(a,b){function c(a){return function(b,c,d){var e,f=b[c];f&&f.target==b||(e=b[c]=function(){for(var a,b=e.before,c=arguments,d=b.length;d--;){if(a=b[d].advice.apply(this,c),a===!1)return!1;c=a||c}for(var f=e.method.apply(this,c),g=e.after,h=0,i=g.length;h<i;h++){if(a=g[h].advice.call(this,f,c),f===!1)return!1;c=a||c}return f},e.before=[],e.after=[],f&&(e.method=f),e.target=b);var g=(e||f)[a],h={advice:d,_index:g.length,remove:function(){g.splice(this._index,1)}};return g.push(h),h}}return BI.aspect={before:c("before"),after:c("after")},BI.aspect}(window),!function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b=function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);d<128?b+=String.fromCharCode(d):d>127&&d<2048?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b},c=function(a){for(var b="",c=0,d=0,e=0,f=0;c<a.length;)d=a.charCodeAt(c),d<128?(b+=String.fromCharCode(d),c++):d>191&&d<224?(f=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&f),c+=2):(f=a.charCodeAt(c+1),e=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&f)<<6|63&e),c+=3);return b};_.extend(BI,{encode:function(c){var d,e,f,g,h,i,j,k="",l=0;for(c=b(c);l<c.length;)d=c.charCodeAt(l++),e=c.charCodeAt(l++),f=c.charCodeAt(l++),g=d>>2,h=(3&d)<<4|e>>4,i=(15&e)<<2|f>>6,j=63&f,isNaN(e)?i=j=64:isNaN(f)&&(j=64),k=k+a.charAt(g)+a.charAt(h)+a.charAt(i)+a.charAt(j);return k},decode:function(b){var d,e,f,g,h,i,j,k="",l=0;for(b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<b.length;)g=a.indexOf(b.charAt(l++)),h=a.indexOf(b.charAt(l++)),i=a.indexOf(b.charAt(l++)),j=a.indexOf(b.charAt(l++)),d=g<<2|h>>4,e=(15&h)<<4|i>>2,f=(3&i)<<6|j,k+=String.fromCharCode(d),64!=i&&(k+=String.fromCharCode(e)),64!=j&&(k+=String.fromCharCode(f));return k=c(k)}})}(),BI.Cache={_prefix:"bi",setUsername:function(a){localStorage.setItem(BI.Cache._prefix+".username",(a+""||"").toUpperCase())},getUsername:function(){return localStorage.getItem(BI.Cache._prefix+".username")||""},_getKeyPrefix:function(){return BI.Cache.getUsername()+"."+BI.Cache._prefix+"."},_generateKey:function(a){return BI.Cache._getKeyPrefix()+(a||"")},getItem:function(a){return localStorage.getItem(BI.Cache._generateKey(a))},setItem:function(a,b){localStorage.setItem(BI.Cache._generateKey(a),b)},removeItem:function(a){localStorage.removeItem(BI.Cache._generateKey(a))},clear:function(){for(var a=localStorage.length;a>=0;a--){var b=localStorage.key(a);b&&0===b.indexOf(BI.Cache._getKeyPrefix())&&localStorage.removeItem(b)}},keys:function(){for(var a=[],b=localStorage.length;b>=0;b--){var c=localStorage.key(b);if(c){var d=BI.Cache._getKeyPrefix();0===c.indexOf(d)&&(a[a.length]=c.substring(d.length))}}return a},addCookie:function(a,b,c,d){var e=a+"="+escape(b);if(d&&d>0){var f=new Date;f.setTime(f.getTime()+3600*d*1e3),e=e+"; expires="+f.toGMTString()}c&&(e=e+"; path="+c),document.cookie=e},getCookie:function(a){var b,c=new RegExp("(^| )"+a+"=([^;]*)(;|$)");return(b=document.cookie.match(c))?unescape(b[2]):null},deleteCookie:function(a,b){var c=new Date;c.setTime(c.getTime()-1e4);var d=a+"=v; expires="+c.toGMTString();b&&(d=d+"; path="+b),document.cookie=d}},BI.CellSizeAndPositionManager=function(a,b,c){this._cellSizeGetter=b,this._cellCount=a,this._estimatedCellSize=c,this._cellSizeAndPositionData={},this._lastMeasuredIndex=-1},BI.CellSizeAndPositionManager.prototype={constructor:BI.CellSizeAndPositionManager,configure:function(a,b){this._cellCount=a,this._estimatedCellSize=b},getCellCount:function(){return this._cellCount},getEstimatedCellSize:function(){return this._estimatedCellSize},getLastMeasuredIndex:function(){return this._lastMeasuredIndex},getSizeAndPositionOfCell:function(a){if(!(a<0||a>=this._cellCount)){if(a>this._lastMeasuredIndex){for(var b=this.getSizeAndPositionOfLastMeasuredCell(),c=b.offset+b.size,d=this._lastMeasuredIndex+1;d<=a;d++){var e=this._cellSizeGetter(d);null==e||isNaN(e)||(this._cellSizeAndPositionData[d]={offset:c,size:e},c+=e)}this._lastMeasuredIndex=a}return this._cellSizeAndPositionData[a]}},getSizeAndPositionOfLastMeasuredCell:function(){return this._lastMeasuredIndex>=0?this._cellSizeAndPositionData[this._lastMeasuredIndex]:{offset:0,size:0}},getTotalSize:function(){var a=this.getSizeAndPositionOfLastMeasuredCell();return a.offset+a.size+(this._cellCount-this._lastMeasuredIndex-1)*this._estimatedCellSize},getUpdatedOffsetForIndex:function(a,b,c,d){var e,f=this.getSizeAndPositionOfCell(d),g=f.offset,h=g-b+f.size;switch(a){case"start":e=g;break;case"end":e=h;break;case"center":e=g-(b-f.size)/2;break;default:e=Math.max(h,Math.min(g,c))}var i=this.getTotalSize();return Math.max(0,Math.min(i-b,e))},getVisibleCellRange:function(a,b){var c=this.getTotalSize();if(0===c)return{};var d=b+a,e=this._findNearestCell(b),f=this.getSizeAndPositionOfCell(e);b=f.offset+f.size;for(var g=e;b<d&&g<this._cellCount-1;)g++,b+=this.getSizeAndPositionOfCell(g).size;return{start:e,stop:g}},resetCell:function(a){this._lastMeasuredIndex=Math.min(this._lastMeasuredIndex,a-1)},_binarySearch:function(a,b,c){for(var d,e;b<=a;){if(d=b+Math.floor((a-b)/2),e=this.getSizeAndPositionOfCell(d).offset,e===c)return d;e<c?b=d+1:e>c&&(a=d-1)}if(b>0)return b-1},_exponentialSearch:function(a,b){for(var c=1;a<this._cellCount&&this.getSizeAndPositionOfCell(a).offset<b;)a+=c,c*=2;return this._binarySearch(Math.min(a,this._cellCount-1),Math.floor(a/2),b)},_findNearestCell:function(a){if(!isNaN(a)){a=Math.max(0,a);var b=this.getSizeAndPositionOfLastMeasuredCell(),c=Math.max(0,this._lastMeasuredIndex);return b.offset>=a?this._binarySearch(c,0,a):this._exponentialSearch(c,a)}}},BI.ScalingCellSizeAndPositionManager=function(a,b,c,d){this._cellSizeAndPositionManager=new BI.CellSizeAndPositionManager(a,b,c),this._maxScrollSize=d||1e7},BI.ScalingCellSizeAndPositionManager.prototype={constructor:BI.ScalingCellSizeAndPositionManager,configure:function(){this._cellSizeAndPositionManager.configure.apply(this._cellSizeAndPositionManager,arguments)},getCellCount:function(){return this._cellSizeAndPositionManager.getCellCount()},getEstimatedCellSize:function(){return this._cellSizeAndPositionManager.getEstimatedCellSize()},getLastMeasuredIndex:function(){return this._cellSizeAndPositionManager.getLastMeasuredIndex()},getOffsetAdjustment:function(a,b){var c=this._cellSizeAndPositionManager.getTotalSize(),d=this.getTotalSize(),e=this._getOffsetPercentage(a,b,d);return Math.round(e*(d-c))},getSizeAndPositionOfCell:function(a){return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(a)},getSizeAndPositionOfLastMeasuredCell:function(){return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell()},getTotalSize:function(){return Math.min(this._maxScrollSize,this._cellSizeAndPositionManager.getTotalSize())},getUpdatedOffsetForIndex:function(a,b,c,d){c=this._safeOffsetToOffset(b,c);var e=this._cellSizeAndPositionManager.getUpdatedOffsetForIndex(a,b,c,d);return this._offsetToSafeOffset(b,e)},getVisibleCellRange:function(a,b){return b=this._safeOffsetToOffset(a,b),this._cellSizeAndPositionManager.getVisibleCellRange(a,b)},resetCell:function(a){this._cellSizeAndPositionManager.resetCell(a)},_getOffsetPercentage:function(a,b,c){return c<=a?0:b/(c-a)},_offsetToSafeOffset:function(a,b){var c=this._cellSizeAndPositionManager.getTotalSize(),d=this.getTotalSize();if(c===d)return b;var e=this._getOffsetPercentage(a,b,c);return Math.round(e*(d-a))},_safeOffsetToOffset:function(a,b){var c=this._cellSizeAndPositionManager.getTotalSize(),d=this.getTotalSize();if(c===d)return b;var e=this._getOffsetPercentage(a,b,d);return Math.round(e*(c-a))}},!function(){var a="YDYQSXMWZSSXJBYMGCCZQPSSQBYCDSCDQLDYLYBSSJGYZZJJFKCCLZDHWDWZJLJPFYYNWJJTMYHZWZHFLZPPQHGSCYYYNJQYXXGJHHSDSJNKKTMOMLCRXYPSNQSECCQZGGLLYJLMYZZSECYKYYHQWJSSGGYXYZYJWWKDJHYCHMYXJTLXJYQBYXZLDWRDJRWYSRLDZJPCBZJJBRCFTLECZSTZFXXZHTRQHYBDLYCZSSYMMRFMYQZPWWJJYFCRWFDFZQPYDDWYXKYJAWJFFXYPSFTZYHHYZYSWCJYXSCLCXXWZZXNBGNNXBXLZSZSBSGPYSYZDHMDZBQBZCWDZZYYTZHBTSYYBZGNTNXQYWQSKBPHHLXGYBFMJEBJHHGQTJCYSXSTKZHLYCKGLYSMZXYALMELDCCXGZYRJXSDLTYZCQKCNNJWHJTZZCQLJSTSTBNXBTYXCEQXGKWJYFLZQLYHYXSPSFXLMPBYSXXXYDJCZYLLLSJXFHJXPJBTFFYABYXBHZZBJYZLWLCZGGBTSSMDTJZXPTHYQTGLJSCQFZKJZJQNLZWLSLHDZBWJNCJZYZSQQYCQYRZCJJWYBRTWPYFTWEXCSKDZCTBZHYZZYYJXZCFFZZMJYXXSDZZOTTBZLQWFCKSZSXFYRLNYJMBDTHJXSQQCCSBXYYTSYFBXDZTGBCNSLCYZZPSAZYZZSCJCSHZQYDXLBPJLLMQXTYDZXSQJTZPXLCGLQTZWJBHCTSYJSFXYEJJTLBGXSXJMYJQQPFZASYJNTYDJXKJCDJSZCBARTDCLYJQMWNQNCLLLKBYBZZSYHQQLTWLCCXTXLLZNTYLNEWYZYXCZXXGRKRMTCNDNJTSYYSSDQDGHSDBJGHRWRQLYBGLXHLGTGXBQJDZPYJSJYJCTMRNYMGRZJCZGJMZMGXMPRYXKJNYMSGMZJYMKMFXMLDTGFBHCJHKYLPFMDXLQJJSMTQGZSJLQDLDGJYCALCMZCSDJLLNXDJFFFFJCZFMZFFPFKHKGDPSXKTACJDHHZDDCRRCFQYJKQCCWJDXHWJLYLLZGCFCQDSMLZPBJJPLSBCJGGDCKKDEZSQCCKJGCGKDJTJDLZYCXKLQSCGJCLTFPCQCZGWPJDQYZJJBYJHSJDZWGFSJGZKQCCZLLPSPKJGQJHZZLJPLGJGJJTHJJYJZCZMLZLYQBGJWMLJKXZDZNJQSYZMLJLLJKYWXMKJLHSKJGBMCLYYMKXJQLBMLLKMDXXKWYXYSLMLPSJQQJQXYXFJTJDXMXXLLCXQBSYJBGWYMBGGBCYXPJYGPEPFGDJGBHBNSQJYZJKJKHXQFGQZKFHYGKHDKLLSDJQXPQYKYBNQSXQNSZSWHBSXWHXWBZZXDMNSJBSBKBBZKLYLXGWXDRWYQZMYWSJQLCJXXJXKJEQXSCYETLZHLYYYSDZPAQYZCMTLSHTZCFYZYXYLJSDCJQAGYSLCQLYYYSHMRQQKLDXZSCSSSYDYCJYSFSJBFRSSZQSBXXPXJYSDRCKGJLGDKZJZBDKTCSYQPYHSTCLDJDHMXMCGXYZHJDDTMHLTXZXYLYMOHYJCLTYFBQQXPFBDFHHTKSQHZYYWCNXXCRWHOWGYJLEGWDQCWGFJYCSNTMYTOLBYGWQWESJPWNMLRYDZSZTXYQPZGCWXHNGPYXSHMYQJXZTDPPBFYHZHTJYFDZWKGKZBLDNTSXHQEEGZZYLZMMZYJZGXZXKHKSTXNXXWYLYAPSTHXDWHZYMPXAGKYDXBHNHXKDPJNMYHYLPMGOCSLNZHKXXLPZZLBMLSFBHHGYGYYGGBHSCYAQTYWLXTZQCEZYDQDQMMHTKLLSZHLSJZWFYHQSWSCWLQAZYNYTLSXTHAZNKZZSZZLAXXZWWCTGQQTDDYZTCCHYQZFLXPSLZYGPZSZNGLNDQTBDLXGTCTAJDKYWNSYZLJHHZZCWNYYZYWMHYCHHYXHJKZWSXHZYXLYSKQYSPSLYZWMYPPKBYGLKZHTYXAXQSYSHXASMCHKDSCRSWJPWXSGZJLWWSCHSJHSQNHCSEGNDAQTBAALZZMSSTDQJCJKTSCJAXPLGGXHHGXXZCXPDMMHLDGTYBYSJMXHMRCPXXJZCKZXSHMLQXXTTHXWZFKHCCZDYTCJYXQHLXDHYPJQXYLSYYDZOZJNYXQEZYSQYAYXWYPDGXDDXSPPYZNDLTWRHXYDXZZJHTCXMCZLHPYYYYMHZLLHNXMYLLLMDCPPXHMXDKYCYRDLTXJCHHZZXZLCCLYLNZSHZJZZLNNRLWHYQSNJHXYNTTTKYJPYCHHYEGKCTTWLGQRLGGTGTYGYHPYHYLQYQGCWYQKPYYYTTTTLHYHLLTYTTSPLKYZXGZWGPYDSSZZDQXSKCQNMJJZZBXYQMJRTFFBTKHZKBXLJJKDXJTLBWFZPPTKQTZTGPDGNTPJYFALQMKGXBDCLZFHZCLLLLADPMXDJHLCCLGYHDZFGYDDGCYYFGYDXKSSEBDHYKDKDKHNAXXYBPBYYHXZQGAFFQYJXDMLJCSQZLLPCHBSXGJYNDYBYQSPZWJLZKSDDTACTBXZDYZYPJZQSJNKKTKNJDJGYYPGTLFYQKASDNTCYHBLWDZHBBYDWJRYGKZYHEYYFJMSDTYFZJJHGCXPLXHLDWXXJKYTCYKSSSMTWCTTQZLPBSZDZWZXGZAGYKTYWXLHLSPBCLLOQMMZSSLCMBJCSZZKYDCZJGQQDSMCYTZQQLWZQZXSSFPTTFQMDDZDSHDTDWFHTDYZJYQJQKYPBDJYYXTLJHDRQXXXHAYDHRJLKLYTWHLLRLLRCXYLBWSRSZZSYMKZZHHKYHXKSMDSYDYCJPBZBSQLFCXXXNXKXWYWSDZYQOGGQMMYHCDZTTFJYYBGSTTTYBYKJDHKYXBELHTYPJQNFXFDYKZHQKZBYJTZBXHFDXKDASWTAWAJLDYJSFHBLDNNTNQJTJNCHXFJSRFWHZFMDRYJYJWZPDJKZYJYMPCYZNYNXFBYTFYFWYGDBNZZZDNYTXZEMMQBSQEHXFZMBMFLZZSRXYMJGSXWZJSPRYDJSJGXHJJGLJJYNZZJXHGXKYMLPYYYCXYTWQZSWHWLYRJLPXSLSXMFSWWKLCTNXNYNPSJSZHDZEPTXMYYWXYYSYWLXJQZQXZDCLEEELMCPJPCLWBXSQHFWWTFFJTNQJHJQDXHWLBYZNFJLALKYYJLDXHHYCSTYYWNRJYXYWTRMDRQHWQCMFJDYZMHMYYXJWMYZQZXTLMRSPWWCHAQBXYGZYPXYYRRCLMPYMGKSJSZYSRMYJSNXTPLNBAPPYPYLXYYZKYNLDZYJZCZNNLMZHHARQMPGWQTZMXXMLLHGDZXYHXKYXYCJMFFYYHJFSBSSQLXXNDYCANNMTCJCYPRRNYTYQNYYMBMSXNDLYLYSLJRLXYSXQMLLYZLZJJJKYZZCSFBZXXMSTBJGNXYZHLXNMCWSCYZYFZLXBRNNNYLBNRTGZQYSATSWRYHYJZMZDHZGZDWYBSSCSKXSYHYTXXGCQGXZZSHYXJSCRHMKKBXCZJYJYMKQHZJFNBHMQHYSNJNZYBKNQMCLGQHWLZNZSWXKHLJHYYBQLBFCDSXDLDSPFZPSKJYZWZXZDDXJSMMEGJSCSSMGCLXXKYYYLNYPWWWGYDKZJGGGZGGSYCKNJWNJPCXBJJTQTJWDSSPJXZXNZXUMELPXFSXTLLXCLJXJJLJZXCTPSWXLYDHLYQRWHSYCSQYYBYAYWJJJQFWQCQQCJQGXALDBZZYJGKGXPLTZYFXJLTPADKYQHPMATLCPDCKBMTXYBHKLENXDLEEGQDYMSAWHZMLJTWYGXLYQZLJEEYYBQQFFNLYXRDSCTGJGXYYNKLLYQKCCTLHJLQMKKZGCYYGLLLJDZGYDHZWXPYSJBZKDZGYZZHYWYFQYTYZSZYEZZLYMHJJHTSMQWYZLKYYWZCSRKQYTLTDXWCTYJKLWSQZWBDCQYNCJSRSZJLKCDCDTLZZZACQQZZDDXYPLXZBQJYLZLLLQDDZQJYJYJZYXNYYYNYJXKXDAZWYRDLJYYYRJLXLLDYXJCYWYWNQCCLDDNYYYNYCKCZHXXCCLGZQJGKWPPCQQJYSBZZXYJSQPXJPZBSBDSFNSFPZXHDWZTDWPPTFLZZBZDMYYPQJRSDZSQZSQXBDGCPZSWDWCSQZGMDHZXMWWFYBPDGPHTMJTHZSMMBGZMBZJCFZWFZBBZMQCFMBDMCJXLGPNJBBXGYHYYJGPTZGZMQBQTCGYXJXLWZKYDPDYMGCFTPFXYZTZXDZXTGKMTYBBCLBJASKYTSSQYYMSZXFJEWLXLLSZBQJJJAKLYLXLYCCTSXMCWFKKKBSXLLLLJYXTYLTJYYTDPJHNHNNKBYQNFQYYZBYYESSESSGDYHFHWTCJBSDZZTFDMXHCNJZYMQWSRYJDZJQPDQBBSTJGGFBKJBXTGQHNGWJXJGDLLTHZHHYYYYYYSXWTYYYCCBDBPYPZYCCZYJPZYWCBDLFWZCWJDXXHYHLHWZZXJTCZLCDPXUJCZZZLYXJJTXPHFXWPYWXZPTDZZBDZCYHJHMLXBQXSBYLRDTGJRRCTTTHYTCZWMXFYTWWZCWJWXJYWCSKYBZSCCTZQNHXNWXXKHKFHTSWOCCJYBCMPZZYKBNNZPBZHHZDLSYDDYTYFJPXYNGFXBYQXCBHXCPSXTYZDMKYSNXSXLHKMZXLYHDHKWHXXSSKQYHHCJYXGLHZXCSNHEKDTGZXQYPKDHEXTYKCNYMYYYPKQYYYKXZLTHJQTBYQHXBMYHSQCKWWYLLHCYYLNNEQXQWMCFBDCCMLJGGXDQKTLXKGNQCDGZJWYJJLYHHQTTTNWCHMXCXWHWSZJYDJCCDBQCDGDNYXZTHCQRXCBHZTQCBXWGQWYYBXHMBYMYQTYEXMQKYAQYRGYZSLFYKKQHYSSQYSHJGJCNXKZYCXSBXYXHYYLSTYCXQTHYSMGSCPMMGCCCCCMTZTASMGQZJHKLOSQYLSWTMXSYQKDZLJQQYPLSYCZTCQQPBBQJZCLPKHQZYYXXDTDDTSJCXFFLLCHQXMJLWCJCXTSPYCXNDTJSHJWXDQQJSKXYAMYLSJHMLALYKXCYYDMNMDQMXMCZNNCYBZKKYFLMCHCMLHXRCJJHSYLNMTJZGZGYWJXSRXCWJGJQHQZDQJDCJJZKJKGDZQGJJYJYLXZXXCDQHHHEYTMHLFSBDJSYYSHFYSTCZQLPBDRFRZTZYKYWHSZYQKWDQZRKMSYNBCRXQBJYFAZPZZEDZCJYWBCJWHYJBQSZYWRYSZPTDKZPFPBNZTKLQYHBBZPNPPTYZZYBQNYDCPJMMCYCQMCYFZZDCMNLFPBPLNGQJTBTTNJZPZBBZNJKLJQYLNBZQHKSJZNGGQSZZKYXSHPZSNBCGZKDDZQANZHJKDRTLZLSWJLJZLYWTJNDJZJHXYAYNCBGTZCSSQMNJPJYTYSWXZFKWJQTKHTZPLBHSNJZSYZBWZZZZLSYLSBJHDWWQPSLMMFBJDWAQYZTCJTBNNWZXQXCDSLQGDSDPDZHJTQQPSWLYYJZLGYXYZLCTCBJTKTYCZJTQKBSJLGMGZDMCSGPYNJZYQYYKNXRPWSZXMTNCSZZYXYBYHYZAXYWQCJTLLCKJJTJHGDXDXYQYZZBYWDLWQCGLZGJGQRQZCZSSBCRPCSKYDZNXJSQGXSSJMYDNSTZTPBDLTKZWXQWQTZEXNQCZGWEZKSSBYBRTSSSLCCGBPSZQSZLCCGLLLZXHZQTHCZMQGYZQZNMCOCSZJMMZSQPJYGQLJYJPPLDXRGZYXCCSXHSHGTZNLZWZKJCXTCFCJXLBMQBCZZWPQDNHXLJCTHYZLGYLNLSZZPCXDSCQQHJQKSXZPBAJYEMSMJTZDXLCJYRYYNWJBNGZZTMJXLTBSLYRZPYLSSCNXPHLLHYLLQQZQLXYMRSYCXZLMMCZLTZSDWTJJLLNZGGQXPFSKYGYGHBFZPDKMWGHCXMSGDXJMCJZDYCABXJDLNBCDQYGSKYDQTXDJJYXMSZQAZDZFSLQXYJSJZYLBTXXWXQQZBJZUFBBLYLWDSLJHXJYZJWTDJCZFQZQZZDZSXZZQLZCDZFJHYSPYMPQZMLPPLFFXJJNZZYLSJEYQZFPFZKSYWJJJHRDJZZXTXXGLGHYDXCSKYSWMMZCWYBAZBJKSHFHJCXMHFQHYXXYZFTSJYZFXYXPZLCHMZMBXHZZSXYFYMNCWDABAZLXKTCSHHXKXJJZJSTHYGXSXYYHHHJWXKZXSSBZZWHHHCWTZZZPJXSNXQQJGZYZYWLLCWXZFXXYXYHXMKYYSWSQMNLNAYCYSPMJKHWCQHYLAJJMZXHMMCNZHBHXCLXTJPLTXYJHDYYLTTXFSZHYXXSJBJYAYRSMXYPLCKDUYHLXRLNLLSTYZYYQYGYHHSCCSMZCTZQXKYQFPYYRPFFLKQUNTSZLLZMWWTCQQYZWTLLMLMPWMBZSSTZRBPDDTLQJJBXZCSRZQQYGWCSXFWZLXCCRSZDZMCYGGDZQSGTJSWLJMYMMZYHFBJDGYXCCPSHXNZCSBSJYJGJMPPWAFFYFNXHYZXZYLREMZGZCYZSSZDLLJCSQFNXZKPTXZGXJJGFMYYYSNBTYLBNLHPFZDCYFBMGQRRSSSZXYSGTZRNYDZZCDGPJAFJFZKNZBLCZSZPSGCYCJSZLMLRSZBZZLDLSLLYSXSQZQLYXZLSKKBRXBRBZCYCXZZZEEYFGKLZLYYHGZSGZLFJHGTGWKRAAJYZKZQTSSHJJXDCYZUYJLZYRZDQQHGJZXSSZBYKJPBFRTJXLLFQWJHYLQTYMBLPZDXTZYGBDHZZRBGXHWNJTJXLKSCFSMWLSDQYSJTXKZSCFWJLBXFTZLLJZLLQBLSQMQQCGCZFPBPHZCZJLPYYGGDTGWDCFCZQYYYQYSSCLXZSKLZZZGFFCQNWGLHQYZJJCZLQZZYJPJZZBPDCCMHJGXDQDGDLZQMFGPSYTSDYFWWDJZJYSXYYCZCYHZWPBYKXRYLYBHKJKSFXTZJMMCKHLLTNYYMSYXYZPYJQYCSYCWMTJJKQYRHLLQXPSGTLYYCLJSCPXJYZFNMLRGJJTYZBXYZMSJYJHHFZQMSYXRSZCWTLRTQZSSTKXGQKGSPTGCZNJSJCQCXHMXGGZTQYDJKZDLBZSXJLHYQGGGTHQSZPYHJHHGYYGKGGCWJZZYLCZLXQSFTGZSLLLMLJSKCTBLLZZSZMMNYTPZSXQHJCJYQXYZXZQZCPSHKZZYSXCDFGMWQRLLQXRFZTLYSTCTMJCXJJXHJNXTNRZTZFQYHQGLLGCXSZSJDJLJCYDSJTLNYXHSZXCGJZYQPYLFHDJSBPCCZHJJJQZJQDYBSSLLCMYTTMQTBHJQNNYGKYRQYQMZGCJKPDCGMYZHQLLSLLCLMHOLZGDYYFZSLJCQZLYLZQJESHNYLLJXGJXLYSYYYXNBZLJSSZCQQCJYLLZLTJYLLZLLBNYLGQCHXYYXOXCXQKYJXXXYKLXSXXYQXCYKQXQCSGYXXYQXYGYTQOHXHXPYXXXULCYEYCHZZCBWQBBWJQZSCSZSSLZYLKDESJZWMYMCYTSDSXXSCJPQQSQYLYYZYCMDJDZYWCBTJSYDJKCYDDJLBDJJSODZYSYXQQYXDHHGQQYQHDYXWGMMMAJDYBBBPPBCMUUPLJZSMTXERXJMHQNUTPJDCBSSMSSSTKJTSSMMTRCPLZSZMLQDSDMJMQPNQDXCFYNBFSDQXYXHYAYKQYDDLQYYYSSZBYDSLNTFQTZQPZMCHDHCZCWFDXTMYQSPHQYYXSRGJCWTJTZZQMGWJJTJHTQJBBHWZPXXHYQFXXQYWYYHYSCDYDHHQMNMTMWCPBSZPPZZGLMZFOLLCFWHMMSJZTTDHZZYFFYTZZGZYSKYJXQYJZQBHMBZZLYGHGFMSHPZFZSNCLPBQSNJXZSLXXFPMTYJYGBXLLDLXPZJYZJYHHZCYWHJYLSJEXFSZZYWXKZJLUYDTMLYMQJPWXYHXSKTQJEZRPXXZHHMHWQPWQLYJJQJJZSZCPHJLCHHNXJLQWZJHBMZYXBDHHYPZLHLHLGFWLCHYYTLHJXCJMSCPXSTKPNHQXSRTYXXTESYJCTLSSLSTDLLLWWYHDHRJZSFGXTSYCZYNYHTDHWJSLHTZDQDJZXXQHGYLTZPHCSQFCLNJTCLZPFSTPDYNYLGMJLLYCQHYSSHCHYLHQYQTMZYPBYWRFQYKQSYSLZDQJMPXYYSSRHZJNYWTQDFZBWWTWWRXCWHGYHXMKMYYYQMSMZHNGCEPMLQQMTCWCTMMPXJPJJHFXYYZSXZHTYBMSTSYJTTQQQYYLHYNPYQZLCYZHZWSMYLKFJXLWGXYPJYTYSYXYMZCKTTWLKSMZSYLMPWLZWXWQZSSAQSYXYRHSSNTSRAPXCPWCMGDXHXZDZYFJHGZTTSBJHGYZSZYSMYCLLLXBTYXHBBZJKSSDMALXHYCFYGMQYPJYCQXJLLLJGSLZGQLYCJCCZOTYXMTMTTLLWTGPXYMZMKLPSZZZXHKQYSXCTYJZYHXSHYXZKXLZWPSQPYHJWPJPWXQQYLXSDHMRSLZZYZWTTCYXYSZZSHBSCCSTPLWSSCJCHNLCGCHSSPHYLHFHHXJSXYLLNYLSZDHZXYLSXLWZYKCLDYAXZCMDDYSPJTQJZLNWQPSSSWCTSTSZLBLNXSMNYYMJQBQHRZWTYYDCHQLXKPZWBGQYBKFCMZWPZLLYYLSZYDWHXPSBCMLJBSCGBHXLQHYRLJXYSWXWXZSLDFHLSLYNJLZYFLYJYCDRJLFSYZFSLLCQYQFGJYHYXZLYLMSTDJCYHBZLLNWLXXYGYYHSMGDHXXHHLZZJZXCZZZCYQZFNGWPYLCPKPYYPMCLQKDGXZGGWQBDXZZKZFBXXLZXJTPJPTTBYTSZZDWSLCHZHSLTYXHQLHYXXXYYZYSWTXZKHLXZXZPYHGCHKCFSYHUTJRLXFJXPTZTWHPLYXFCRHXSHXKYXXYHZQDXQWULHYHMJTBFLKHTXCWHJFWJCFPQRYQXCYYYQYGRPYWSGSUNGWCHKZDXYFLXXHJJBYZWTSXXNCYJJYMSWZJQRMHXZWFQSYLZJZGBHYNSLBGTTCSYBYXXWXYHXYYXNSQYXMQYWRGYQLXBBZLJSYLPSYTJZYHYZAWLRORJMKSCZJXXXYXCHDYXRYXXJDTSQFXLYLTSFFYXLMTYJMJUYYYXLTZCSXQZQHZXLYYXZHDNBRXXXJCTYHLBRLMBRLLAXKYLLLJLYXXLYCRYLCJTGJCMTLZLLCYZZPZPCYAWHJJFYBDYYZSMPCKZDQYQPBPCJPDCYZMDPBCYYDYCNNPLMTMLRMFMMGWYZBSJGYGSMZQQQZTXMKQWGXLLPJGZBQCDJJJFPKJKCXBLJMSWMDTQJXLDLPPBXCWRCQFBFQJCZAHZGMYKPHYYHZYKNDKZMBPJYXPXYHLFPNYYGXJDBKXNXHJMZJXSTRSTLDXSKZYSYBZXJLXYSLBZYSLHXJPFXPQNBYLLJQKYGZMCYZZYMCCSLCLHZFWFWYXZMWSXTYNXJHPYYMCYSPMHYSMYDYSHQYZCHMJJMZCAAGCFJBBHPLYZYLXXSDJGXDHKXXTXXNBHRMLYJSLTXMRHNLXQJXYZLLYSWQGDLBJHDCGJYQYCMHWFMJYBMBYJYJWYMDPWHXQLDYGPDFXXBCGJSPCKRSSYZJMSLBZZJFLJJJLGXZGYXYXLSZQYXBEXYXHGCXBPLDYHWETTWWCJMBTXCHXYQXLLXFLYXLLJLSSFWDPZSMYJCLMWYTCZPCHQEKCQBWLCQYDPLQPPQZQFJQDJHYMMCXTXDRMJWRHXCJZYLQXDYYNHYYHRSLSRSYWWZJYMTLTLLGTQCJZYABTCKZCJYCCQLJZQXALMZYHYWLWDXZXQDLLQSHGPJFJLJHJABCQZDJGTKHSSTCYJLPSWZLXZXRWGLDLZRLZXTGSLLLLZLYXXWGDZYGBDPHZPBRLWSXQBPFDWOFMWHLYPCBJCCLDMBZPBZZLCYQXLDOMZBLZWPDWYYGDSTTHCSQSCCRSSSYSLFYBFNTYJSZDFNDPDHDZZMBBLSLCMYFFGTJJQWFTMTPJWFNLBZCMMJTGBDZLQLPYFHYYMJYLSDCHDZJWJCCTLJCLDTLJJCPDDSQDSSZYBNDBJLGGJZXSXNLYCYBJXQYCBYLZCFZPPGKCXZDZFZTJJFJSJXZBNZYJQTTYJYHTYCZHYMDJXTTMPXSPLZCDWSLSHXYPZGTFMLCJTYCBPMGDKWYCYZCDSZZYHFLYCTYGWHKJYYLSJCXGYWJCBLLCSNDDBTZBSCLYZCZZSSQDLLMQYYHFSLQLLXFTYHABXGWNYWYYPLLSDLDLLBJCYXJZMLHLJDXYYQYTDLLLBUGBFDFBBQJZZMDPJHGCLGMJJPGAEHHBWCQXAXHHHZCHXYPHJAXHLPHJPGPZJQCQZGJJZZUZDMQYYBZZPHYHYBWHAZYJHYKFGDPFQSDLZMLJXKXGALXZDAGLMDGXMWZQYXXDXXPFDMMSSYMPFMDMMKXKSYZYSHDZKXSYSMMZZZMSYDNZZCZXFPLSTMZDNMXCKJMZTYYMZMZZMSXHHDCZJEMXXKLJSTLWLSQLYJZLLZJSSDPPMHNLZJCZYHMXXHGZCJMDHXTKGRMXFWMCGMWKDTKSXQMMMFZZYDKMSCLCMPCGMHSPXQPZDSSLCXKYXTWLWJYAHZJGZQMCSNXYYMMPMLKJXMHLMLQMXCTKZMJQYSZJSYSZHSYJZJCDAJZYBSDQJZGWZQQXFKDMSDJLFWEHKZQKJPEYPZYSZCDWYJFFMZZYLTTDZZEFMZLBNPPLPLPEPSZALLTYLKCKQZKGENQLWAGYXYDPXLHSXQQWQCQXQCLHYXXMLYCCWLYMQYSKGCHLCJNSZKPYZKCQZQLJPDMDZHLASXLBYDWQLWDNBQCRYDDZTJYBKBWSZDXDTNPJDTCTQDFXQQMGNXECLTTBKPWSLCTYQLPWYZZKLPYGZCQQPLLKCCYLPQMZCZQCLJSLQZDJXLDDHPZQDLJJXZQDXYZQKZLJCYQDYJPPYPQYKJYRMPCBYMCXKLLZLLFQPYLLLMBSGLCYSSLRSYSQTMXYXZQZFDZUYSYZTFFMZZSMZQHZSSCCMLYXWTPZGXZJGZGSJSGKDDHTQGGZLLBJDZLCBCHYXYZHZFYWXYZYMSDBZZYJGTSMTFXQYXQSTDGSLNXDLRYZZLRYYLXQHTXSRTZNGZXBNQQZFMYKMZJBZYMKBPNLYZPBLMCNQYZZZSJZHJCTZKHYZZJRDYZHNPXGLFZTLKGJTCTSSYLLGZRZBBQZZKLPKLCZYSSUYXBJFPNJZZXCDWXZYJXZZDJJKGGRSRJKMSMZJLSJYWQSKYHQJSXPJZZZLSNSHRNYPZTWCHKLPSRZLZXYJQXQKYSJYCZTLQZYBBYBWZPQDWWYZCYTJCJXCKCWDKKZXSGKDZXWWYYJQYYTCYTDLLXWKCZKKLCCLZCQQDZLQLCSFQCHQHSFSMQZZLNBJJZBSJHTSZDYSJQJPDLZCDCWJKJZZLPYCGMZWDJJBSJQZSYZYHHXJPBJYDSSXDZNCGLQMBTSFSBPDZDLZNFGFJGFSMPXJQLMBLGQCYYXBQKDJJQYRFKZTJDHCZKLBSDZCFJTPLLJGXHYXZCSSZZXSTJYGKGCKGYOQXJPLZPBPGTGYJZGHZQZZLBJLSQFZGKQQJZGYCZBZQTLDXRJXBSXXPZXHYZYCLWDXJJHXMFDZPFZHQHQMQGKSLYHTYCGFRZGNQXCLPDLBZCSCZQLLJBLHBZCYPZZPPDYMZZSGYHCKCPZJGSLJLNSCDSLDLXBMSTLDDFJMKDJDHZLZXLSZQPQPGJLLYBDSZGQLBZLSLKYYHZTTNTJYQTZZPSZQZTLLJTYYLLQLLQYZQLBDZLSLYYZYMDFSZSNHLXZNCZQZPBWSKRFBSYZMTHBLGJPMCZZLSTLXSHTCSYZLZBLFEQHLXFLCJLYLJQCBZLZJHHSSTBRMHXZHJZCLXFNBGXGTQJCZTMSFZKJMSSNXLJKBHSJXNTNLZDNTLMSJXGZJYJCZXYJYJWRWWQNZTNFJSZPZSHZJFYRDJSFSZJZBJFZQZZHZLXFYSBZQLZSGYFTZDCSZXZJBQMSZKJRHYJZCKMJKHCHGTXKXQGLXPXFXTRTYLXJXHDTSJXHJZJXZWZLCQSBTXWXGXTXXHXFTSDKFJHZYJFJXRZSDLLLTQSQQZQWZXSYQTWGWBZCGZLLYZBCLMQQTZHZXZXLJFRMYZFLXYSQXXJKXRMQDZDMMYYBSQBHGZMWFWXGMXLZPYYTGZYCCDXYZXYWGSYJYZNBHPZJSQSYXSXRTFYZGRHZTXSZZTHCBFCLSYXZLZQMZLMPLMXZJXSFLBYZMYQHXJSXRXSQZZZSSLYFRCZJRCRXHHZXQYDYHXSJJHZCXZBTYNSYSXJBQLPXZQPYMLXZKYXLXCJLCYSXXZZLXDLLLJJYHZXGYJWKJRWYHCPSGNRZLFZWFZZNSXGXFLZSXZZZBFCSYJDBRJKRDHHGXJLJJTGXJXXSTJTJXLYXQFCSGSWMSBCTLQZZWLZZKXJMLTMJYHSDDBXGZHDLBMYJFRZFSGCLYJBPMLYSMSXLSZJQQHJZFXGFQFQBPXZGYYQXGZTCQWYLTLGWSGWHRLFSFGZJMGMGBGTJFSYZZGZYZAFLSSPMLPFLCWBJZCLJJMZLPJJLYMQDMYYYFBGYGYZMLYZDXQYXRQQQHSYYYQXYLJTYXFSFSLLGNQCYHYCWFHCCCFXPYLYPLLZYXXXXXKQHHXSHJZCFZSCZJXCPZWHHHHHAPYLQALPQAFYHXDYLUKMZQGGGDDESRNNZLTZGCHYPPYSQJJHCLLJTOLNJPZLJLHYMHEYDYDSQYCDDHGZUNDZCLZYZLLZNTNYZGSLHSLPJJBDGWXPCDUTJCKLKCLWKLLCASSTKZZDNQNTTLYYZSSYSSZZRYLJQKCQDHHCRXRZYDGRGCWCGZQFFFPPJFZYNAKRGYWYQPQXXFKJTSZZXSWZDDFBBXTBGTZKZNPZZPZXZPJSZBMQHKCYXYLDKLJNYPKYGHGDZJXXEAHPNZKZTZCMXCXMMJXNKSZQNMNLWBWWXJKYHCPSTMCSQTZJYXTPCTPDTNNPGLLLZSJLSPBLPLQHDTNJNLYYRSZFFJFQWDPHZDWMRZCCLODAXNSSNYZRESTYJWJYJDBCFXNMWTTBYLWSTSZGYBLJPXGLBOCLHPCBJLTMXZLJYLZXCLTPNCLCKXTPZJSWCYXSFYSZDKNTLBYJCYJLLSTGQCBXRYZXBXKLYLHZLQZLNZCXWJZLJZJNCJHXMNZZGJZZXTZJXYCYYCXXJYYXJJXSSSJSTSSTTPPGQTCSXWZDCSYFPTFBFHFBBLZJCLZZDBXGCXLQPXKFZFLSYLTUWBMQJHSZBMDDBCYSCCLDXYCDDQLYJJWMQLLCSGLJJSYFPYYCCYLTJANTJJPWYCMMGQYYSXDXQMZHSZXPFTWWZQSWQRFKJLZJQQYFBRXJHHFWJJZYQAZMYFRHCYYBYQWLPEXCCZSTYRLTTDMQLYKMBBGMYYJPRKZNPBSXYXBHYZDJDNGHPMFSGMWFZMFQMMBCMZZCJJLCNUXYQLMLRYGQZCYXZLWJGCJCGGMCJNFYZZJHYCPRRCMTZQZXHFQGTJXCCJEAQCRJYHPLQLSZDJRBCQHQDYRHYLYXJSYMHZYDWLDFRYHBPYDTSSCNWBXGLPZMLZZTQSSCPJMXXYCSJYTYCGHYCJWYRXXLFEMWJNMKLLSWTXHYYYNCMMCWJDQDJZGLLJWJRKHPZGGFLCCSCZMCBLTBHBQJXQDSPDJZZGHGLFQYWBZYZJLTSTDHQHCTCBCHFLQMPWDSHYYTQWCNZZJTLBYMBPDYYYXSQKXWYYFLXXNCWCXYPMAELYKKJMZZZBRXYYQJFLJPFHHHYTZZXSGQQMHSPGDZQWBWPJHZJDYSCQWZKTXXSQLZYYMYSDZGRXCKKUJLWPYSYSCSYZLRMLQSYLJXBCXTLWDQZPCYCYKPPPNSXFYZJJRCEMHSZMSXLXGLRWGCSTLRSXBZGBZGZTCPLUJLSLYLYMTXMTZPALZXPXJTJWTCYYZLBLXBZLQMYLXPGHDSLSSDMXMBDZZSXWHAMLCZCPJMCNHJYSNSYGCHSKQMZZQDLLKABLWJXSFMOCDXJRRLYQZKJMYBYQLYHETFJZFRFKSRYXFJTWDSXXSYSQJYSLYXWJHSNLXYYXHBHAWHHJZXWMYLJCSSLKYDZTXBZSYFDXGXZJKHSXXYBSSXDPYNZWRPTQZCZENYGCXQFJYKJBZMLJCMQQXUOXSLYXXLYLLJDZBTYMHPFSTTQQWLHOKYBLZZALZXQLHZWRRQHLSTMYPYXJJXMQSJFNBXYXYJXXYQYLTHYLQYFMLKLJTMLLHSZWKZHLJMLHLJKLJSTLQXYLMBHHLNLZXQJHXCFXXLHYHJJGBYZZKBXSCQDJQDSUJZYYHZHHMGSXCSYMXFEBCQWWRBPYYJQTYZCYQYQQZYHMWFFHGZFRJFCDPXNTQYZPDYKHJLFRZXPPXZDBBGZQSTLGDGYLCQMLCHHMFYWLZYXKJLYPQHSYWMQQGQZMLZJNSQXJQSYJYCBEHSXFSZPXZWFLLBCYYJDYTDTHWZSFJMQQYJLMQXXLLDTTKHHYBFPWTYYSQQWNQWLGWDEBZWCMYGCULKJXTMXMYJSXHYBRWFYMWFRXYQMXYSZTZZTFYKMLDHQDXWYYNLCRYJBLPSXCXYWLSPRRJWXHQYPHTYDNXHHMMYWYTZCSQMTSSCCDALWZTCPQPYJLLQZYJSWXMZZMMYLMXCLMXCZMXMZSQTZPPQQBLPGXQZHFLJJHYTJSRXWZXSCCDLXTYJDCQJXSLQYCLZXLZZXMXQRJMHRHZJBHMFLJLMLCLQNLDXZLLLPYPSYJYSXCQQDCMQJZZXHNPNXZMEKMXHYKYQLXSXTXJYYHWDCWDZHQYYBGYBCYSCFGPSJNZDYZZJZXRZRQJJYMCANYRJTLDPPYZBSTJKXXZYPFDWFGZZRPYMTNGXZQBYXNBUFNQKRJQZMJEGRZGYCLKXZDSKKNSXKCLJSPJYYZLQQJYBZSSQLLLKJXTBKTYLCCDDBLSPPFYLGYDTZJYQGGKQTTFZXBDKTYYHYBBFYTYYBCLPDYTGDHRYRNJSPTCSNYJQHKLLLZSLYDXXWBCJQSPXBPJZJCJDZFFXXBRMLAZHCSNDLBJDSZBLPRZTSWSBXBCLLXXLZDJZSJPYLYXXYFTFFFBHJJXGBYXJPMMMPSSJZJMTLYZJXSWXTYLEDQPJMYGQZJGDJLQJWJQLLSJGJGYGMSCLJJXDTYGJQJQJCJZCJGDZZSXQGSJGGCXHQXSNQLZZBXHSGZXCXYLJXYXYYDFQQJHJFXDHCTXJYRXYSQTJXYEFYYSSYYJXNCYZXFXMSYSZXYYSCHSHXZZZGZZZGFJDLTYLNPZGYJYZYYQZPBXQBDZTZCZYXXYHHSQXSHDHGQHJHGYWSZTMZMLHYXGEBTYLZKQWYTJZRCLEKYSTDBCYKQQSAYXCJXWWGSBHJYZYDHCSJKQCXSWXFLTYNYZPZCCZJQTZWJQDZZZQZLJJXLSBHPYXXPSXSHHEZTXFPTLQYZZXHYTXNCFZYYHXGNXMYWXTZSJPTHHGYMXMXQZXTSBCZYJYXXTYYZYPCQLMMSZMJZZLLZXGXZAAJZYXJMZXWDXZSXZDZXLEYJJZQBHZWZZZQTZPSXZTDSXJJJZNYAZPHXYYSRNQDTHZHYYKYJHDZXZLSWCLYBZYECWCYCRYLCXNHZYDZYDYJDFRJJHTRSQTXYXJRJHOJYNXELXSFSFJZGHPZSXZSZDZCQZBYYKLSGSJHCZSHDGQGXYZGXCHXZJWYQWGYHKSSEQZZNDZFKWYSSTCLZSTSYMCDHJXXYWEYXCZAYDMPXMDSXYBSQMJMZJMTZQLPJYQZCGQHXJHHLXXHLHDLDJQCLDWBSXFZZYYSCHTYTYYBHECXHYKGJPXHHYZJFXHWHBDZFYZBCAPNPGNYDMSXHMMMMAMYNBYJTMPXYYMCTHJBZYFCGTYHWPHFTWZZEZSBZEGPFMTSKFTYCMHFLLHGPZJXZJGZJYXZSBBQSCZZLZCCSTPGXMJSFTCCZJZDJXCYBZLFCJSYZFGSZLYBCWZZBYZDZYPSWYJZXZBDSYUXLZZBZFYGCZXBZHZFTPBGZGEJBSTGKDMFHYZZJHZLLZZGJQZLSFDJSSCBZGPDLFZFZSZYZYZSYGCXSNXXCHCZXTZZLJFZGQSQYXZJQDCCZTQCDXZJYQJQCHXZTDLGSCXZSYQJQTZWLQDQZTQCHQQJZYEZZZPBWKDJFCJPZTYPQYQTTYNLMBDKTJZPQZQZZFPZSBNJLGYJDXJDZZKZGQKXDLPZJTCJDQBXDJQJSTCKNXBXZMSLYJCQMTJQWWCJQNJNLLLHJCWQTBZQYDZCZPZZDZYDDCYZZZCCJTTJFZDPRRTZTJDCQTQZDTJNPLZBCLLCTZSXKJZQZPZLBZRBTJDCXFCZDBCCJJLTQQPLDCGZDBBZJCQDCJWYNLLZYZCCDWLLXWZLXRXNTQQCZXKQLSGDFQTDDGLRLAJJTKUYMKQLLTZYTDYYCZGJWYXDXFRSKSTQTENQMRKQZHHQKDLDAZFKYPBGGPZREBZZYKZZSPEGJXGYKQZZZSLYSYYYZWFQZYLZZLZHWCHKYPQGNPGBLPLRRJYXCCSYYHSFZFYBZYYTGZXYLXCZWXXZJZBLFFLGSKHYJZEYJHLPLLLLCZGXDRZELRHGKLZZYHZLYQSZZJZQLJZFLNBHGWLCZCFJYSPYXZLZLXGCCPZBLLCYBBBBUBBCBPCRNNZCZYRBFSRLDCGQYYQXYGMQZWTZYTYJXYFWTEHZZJYWLCCNTZYJJZDEDPZDZTSYQJHDYMBJNYJZLXTSSTPHNDJXXBYXQTZQDDTJTDYYTGWSCSZQFLSHLGLBCZPHDLYZJYCKWTYTYLBNYTSDSYCCTYSZYYEBHEXHQDTWNYGYCLXTSZYSTQMYGZAZCCSZZDSLZCLZRQXYYELJSBYMXSXZTEMBBLLYYLLYTDQYSHYMRQWKFKBFXNXSBYCHXBWJYHTQBPBSBWDZYLKGZSKYHXQZJXHXJXGNLJKZLYYCDXLFYFGHLJGJYBXQLYBXQPQGZTZPLNCYPXDJYQYDYMRBESJYYHKXXSTMXRCZZYWXYQYBMCLLYZHQYZWQXDBXBZWZMSLPDMYSKFMZKLZCYQYCZLQXFZZYDQZPZYGYJYZMZXDZFYFYTTQTZHGSPCZMLCCYTZXJCYTJMKSLPZHYSNZLLYTPZCTZZCKTXDHXXTQCYFKSMQCCYYAZHTJPCYLZLYJBJXTPNYLJYYNRXSYLMMNXJSMYBCSYSYLZYLXJJQYLDZLPQBFZZBLFNDXQKCZFYWHGQMRDSXYCYTXNQQJZYYPFZXDYZFPRXEJDGYQBXRCNFYYQPGHYJDYZXGRHTKYLNWDZNTSMPKLBTHBPYSZBZTJZSZZJTYYXZPHSSZZBZCZPTQFZMYFLYPYBBJQXZMXXDJMTSYSKKBJZXHJCKLPSMKYJZCXTMLJYXRZZQSLXXQPYZXMKYXXXJCLJPRMYYGADYSKQLSNDHYZKQXZYZTCGHZTLMLWZYBWSYCTBHJHJFCWZTXWYTKZLXQSHLYJZJXTMPLPYCGLTBZZTLZJCYJGDTCLKLPLLQPJMZPAPXYZLKKTKDZCZZBNZDYDYQZJYJGMCTXLTGXSZLMLHBGLKFWNWZHDXUHLFMKYSLGXDTWWFRJEJZTZHYDXYKSHWFZCQSHKTMQQHTZHYMJDJSKHXZJZBZZXYMPAGQMSTPXLSKLZYNWRTSQLSZBPSPSGZWYHTLKSSSWHZZLYYTNXJGMJSZSUFWNLSOZTXGXLSAMMLBWLDSZYLAKQCQCTMYCFJBSLXCLZZCLXXKSBZQCLHJPSQPLSXXCKSLNHPSFQQYTXYJZLQLDXZQJZDYYDJNZPTUZDSKJFSLJHYLZSQZLBTXYDGTQFDBYAZXDZHZJNHHQBYKNXJJQCZMLLJZKSPLDYCLBBLXKLELXJLBQYCXJXGCNLCQPLZLZYJTZLJGYZDZPLTQCSXFDMNYCXGBTJDCZNBGBQYQJWGKFHTNPYQZQGBKPBBYZMTJDYTBLSQMPSXTBNPDXKLEMYYCJYNZCTLDYKZZXDDXHQSHDGMZSJYCCTAYRZLPYLTLKXSLZCGGEXCLFXLKJRTLQJAQZNCMBYDKKCXGLCZJZXJHPTDJJMZQYKQSECQZDSHHADMLZFMMZBGNTJNNLGBYJBRBTMLBYJDZXLCJLPLDLPCQDHLXZLYCBLCXZZJADJLNZMMSSSMYBHBSQKBHRSXXJMXSDZNZPXLGBRHWGGFCXGMSKLLTSJYYCQLTSKYWYYHYWXBXQYWPYWYKQLSQPTNTKHQCWDQKTWPXXHCPTHTWUMSSYHBWCRWXHJMKMZNGWTMLKFGHKJYLSYYCXWHYECLQHKQHTTQKHFZLDXQWYZYYDESBPKYRZPJFYYZJCEQDZZDLATZBBFJLLCXDLMJSSXEGYGSJQXCWBXSSZPDYZCXDNYXPPZYDLYJCZPLTXLSXYZYRXCYYYDYLWWNZSAHJSYQYHGYWWAXTJZDAXYSRLTDPSSYYFNEJDXYZHLXLLLZQZSJNYQYQQXYJGHZGZCYJCHZLYCDSHWSHJZYJXCLLNXZJJYYXNFXMWFPYLCYLLABWDDHWDXJMCXZTZPMLQZHSFHZYNZTLLDYWLSLXHYMMYLMBWWKYXYADTXYLLDJPYBPWUXJMWMLLSAFDLLYFLBHHHBQQLTZJCQJLDJTFFKMMMBYTHYGDCQRDDWRQJXNBYSNWZDBYYTBJHPYBYTTJXAAHGQDQTMYSTQXKBTZPKJLZRBEQQSSMJJBDJOTGTBXPGBKTLHQXJJJCTHXQDWJLWRFWQGWSHCKRYSWGFTGYGBXSDWDWRFHWYTJJXXXJYZYSLPYYYPAYXHYDQKXSHXYXGSKQHYWFDDDPPLCJLQQEEWXKSYYKDYPLTJTHKJLTCYYHHJTTPLTZZCDLTHQKZXQYSTEEYWYYZYXXYYSTTJKLLPZMCYHQGXYHSRMBXPLLNQYDQHXSXXWGDQBSHYLLPJJJTHYJKYPPTHYYKTYEZYENMDSHLCRPQFDGFXZPSFTLJXXJBSWYYSKSFLXLPPLBBBLBSFXFYZBSJSSYLPBBFFFFSSCJDSTZSXZRYYSYFFSYZYZBJTBCTSBSDHRTJJBYTCXYJEYLXCBNEBJDSYXYKGSJZBXBYTFZWGENYHHTHZHHXFWGCSTBGXKLSXYWMTMBYXJSTZSCDYQRCYTWXZFHMYMCXLZNSDJTTTXRYCFYJSBSDYERXJLJXBBDEYNJGHXGCKGSCYMBLXJMSZNSKGXFBNBPTHFJAAFXYXFPXMYPQDTZCXZZPXRSYWZDLYBBKTYQPQJPZYPZJZNJPZJLZZFYSBTTSLMPTZRTDXQSJEHBZYLZDHLJSQMLHTXTJECXSLZZSPKTLZKQQYFSYGYWPCPQFHQHYTQXZKRSGTTSQCZLPTXCDYYZXSQZSLXLZMYCPCQBZYXHBSXLZDLTCDXTYLZJYYZPZYZLTXJSJXHLPMYTXCQRBLZSSFJZZTNJYTXMYJHLHPPLCYXQJQQKZZSCPZKSWALQSBLCCZJSXGWWWYGYKTJBBZTDKHXHKGTGPBKQYSLPXPJCKBMLLXDZSTBKLGGQKQLSBKKTFXRMDKBFTPZFRTBBRFERQGXYJPZSSTLBZTPSZQZSJDHLJQLZBPMSMMSXLQQNHKNBLRDDNXXDHDDJCYYGYLXGZLXSYGMQQGKHBPMXYXLYTQWLWGCPBMQXCYZYDRJBHTDJYHQSHTMJSBYPLWHLZFFNYPMHXXHPLTBQPFBJWQDBYGPNZTPFZJGSDDTQSHZEAWZZYLLTYYBWJKXXGHLFKXDJTMSZSQYNZGGSWQSPHTLSSKMCLZXYSZQZXNCJDQGZDLFNYKLJCJLLZLMZZNHYDSSHTHZZLZZBBHQZWWYCRZHLYQQJBEYFXXXWHSRXWQHWPSLMSSKZTTYGYQQWRSLALHMJTQJSMXQBJJZJXZYZKXBYQXBJXSHZTSFJLXMXZXFGHKZSZGGYLCLSARJYHSLLLMZXELGLXYDJYTLFBHBPNLYZFBBHPTGJKWETZHKJJXZXXGLLJLSTGSHJJYQLQZFKCGNNDJSSZFDBCTWWSEQFHQJBSAQTGYPQLBXBMMYWXGSLZHGLZGQYFLZBYFZJFRYSFMBYZHQGFWZSYFYJJPHZBYYZFFWODGRLMFTWLBZGYCQXCDJYGZYYYYTYTYDWEGAZYHXJLZYYHLRMGRXXZCLHNELJJTJTPWJYBJJBXJJTJTEEKHWSLJPLPSFYZPQQBDLQJJTYYQLYZKDKSQJYYQZLDQTGJQYZJSUCMRYQTHTEJMFCTYHYPKMHYZWJDQFHYYXWSHCTXRLJHQXHCCYYYJLTKTTYTMXGTCJTZAYYOCZLYLBSZYWJYTSJYHBYSHFJLYGJXXTMZYYLTXXYPZLXYJZYZYYPNHMYMDYYLBLHLSYYQQLLNJJYMSOYQBZGDLYXYLCQYXTSZEGXHZGLHWBLJHEYXTWQMAKBPQCGYSHHEGQCMWYYWLJYJHYYZLLJJYLHZYHMGSLJLJXCJJYCLYCJPCPZJZJMMYLCQLNQLJQJSXYJMLSZLJQLYCMMHCFMMFPQQMFYLQMCFFQMMMMHMZNFHHJGTTHHKHSLNCHHYQDXTMMQDCYZYXYQMYQYLTDCYYYZAZZCYMZYDLZFFFMMYCQZWZZMABTBYZTDMNZZGGDFTYPCGQYTTSSFFWFDTZQSSYSTWXJHXYTSXXYLBYQHWWKXHZXWZNNZZJZJJQJCCCHYYXBZXZCYZTLLCQXYNJYCYYCYNZZQYYYEWYCZDCJYCCHYJLBTZYYCQWMPWPYMLGKDLDLGKQQBGYCHJXY",b={
19969:"DZ",19975:"WM",19988:"QJ",20048:"YL",20056:"SC",20060:"NM",20094:"QG",20127:"QJ",20167:"QC",20193:"YG",20250:"KH",20256:"ZC",20282:"SC",20285:"QJG",20291:"TD",20314:"YD",20315:"BF",20340:"NE",20375:"TD",20389:"YJ",20391:"CZ",20415:"PB",20446:"YS",20447:"SQ",20504:"TC",20608:"KG",20854:"QJ",20857:"ZC",20911:"PF",20985:"AW",21032:"PB",21048:"XQ",21049:"SC",21089:"YS",21119:"JC",21242:"SB",21273:"SC",21305:"YP",21306:"QO",21330:"ZC",21333:"SDC",21345:"QK",21378:"CA",21397:"SC",21414:"XS",21442:"SC",21477:"JG",21480:"TD",21484:"ZS",21494:"YX",21505:"YX",21512:"HG",21523:"XH",21537:"PB",21542:"PF",21549:"KH",21571:"E",21574:"DA",21588:"TD",21589:"O",21618:"ZC",21621:"KHA",21632:"ZJ",21654:"KG",21679:"LKG",21683:"KH",21710:"A",21719:"YH",21734:"WOE",21769:"A",21780:"WN",21804:"XH",21834:"A",21899:"ZD",21903:"RN",21908:"WO",21939:"ZC",21956:"SA",21964:"YA",21970:"TD",22003:"A",22031:"JG",22040:"XS",22060:"ZC",22066:"ZC",22079:"MH",22129:"XJ",22179:"XA",22237:"NJ",22244:"TD",22280:"JQ",22300:"YH",22313:"XW",22331:"YQ",22343:"YJ",22351:"PH",22395:"DC",22412:"TD",22484:"PB",22500:"PB",22534:"ZD",22549:"DH",22561:"PB",22612:"TD",22771:"KQ",22831:"HB",22841:"JG",22855:"QJ",22865:"XQ",23013:"ML",23081:"WM",23487:"SX",23558:"QJ",23561:"YW",23586:"YW",23614:"YW",23615:"SN",23631:"PB",23646:"ZS",23663:"ZT",23673:"YG",23762:"TD",23769:"ZS",23780:"QJ",23884:"QK",24055:"XH",24113:"DC",24162:"ZC",24191:"GA",24273:"QJ",24324:"NL",24377:"TD",24378:"QJ",24439:"PF",24554:"ZS",24683:"TD",24694:"WE",24733:"LK",24925:"TN",25094:"ZG",25100:"XQ",25103:"XH",25153:"PB",25170:"PB",25179:"KG",25203:"PB",25240:"ZS",25282:"FB",25303:"NA",25324:"KG",25341:"ZY",25373:"WZ",25375:"XJ",25384:"A",25457:"A",25528:"SD",25530:"SC",25552:"TD",25774:"ZC",25874:"ZC",26044:"YW",26080:"WM",26292:"PB",26333:"PB",26355:"ZY",26366:"CZ",26397:"ZC",26399:"QJ",26415:"ZS",26451:"SB",26526:"ZC",26552:"JG",26561:"TD",26588:"JG",26597:"CZ",26629:"ZS",26638:"YL",26646:"XQ",26653:"KG",26657:"XJ",26727:"HG",26894:"ZC",26937:"ZS",26946:"ZC",26999:"KJ",27099:"KJ",27449:"YQ",27481:"XS",27542:"ZS",27663:"ZS",27748:"TS",27784:"SC",27788:"ZD",27795:"TD",27812:"O",27850:"PB",27852:"MB",27895:"SL",27898:"PL",27973:"QJ",27981:"KH",27986:"HX",27994:"XJ",28044:"YC",28065:"WG",28177:"SM",28267:"QJ",28291:"KH",28337:"ZQ",28463:"TL",28548:"DC",28601:"TD",28689:"PB",28805:"JG",28820:"QG",28846:"PB",28952:"TD",28975:"ZC",29100:"A",29325:"QJ",29575:"SL",29602:"FB",30010:"TD",30044:"CX",30058:"PF",30091:"YSP",30111:"YN",30229:"XJ",30427:"SC",30465:"SX",30631:"YQ",30655:"QJ",30684:"QJG",30707:"SD",30729:"XH",30796:"LG",30917:"PB",31074:"NM",31085:"JZ",31109:"SC",31181:"ZC",31192:"MLB",31293:"JQ",31400:"YX",31584:"YJ",31896:"ZN",31909:"ZY",31995:"XJ",32321:"PF",32327:"ZY",32418:"HG",32420:"XQ",32421:"HG",32438:"LG",32473:"GJ",32488:"TD",32521:"QJ",32527:"PB",32562:"ZSQ",32564:"JZ",32735:"ZD",32793:"PB",33071:"PF",33098:"XL",33100:"YA",33152:"PB",33261:"CX",33324:"BP",33333:"TD",33406:"YA",33426:"WM",33432:"PB",33445:"JG",33486:"ZN",33493:"TS",33507:"QJ",33540:"QJ",33544:"ZC",33564:"XQ",33617:"YT",33632:"QJ",33636:"XH",33637:"YX",33694:"WG",33705:"PF",33728:"YW",33882:"SR",34067:"WM",34074:"YW",34121:"QJ",34255:"ZC",34259:"XL",34425:"JH",34430:"XH",34485:"KH",34503:"YS",34532:"HG",34552:"XS",34558:"YE",34593:"ZL",34660:"YQ",34892:"XH",34928:"SC",34999:"QJ",35048:"PB",35059:"SC",35098:"ZC",35203:"TQ",35265:"JX",35299:"JX",35782:"SZ",35828:"YS",35830:"E",35843:"TD",35895:"YG",35977:"MH",36158:"JG",36228:"QJ",36426:"XQ",36466:"DC",36710:"JC",36711:"ZYG",36767:"PB",36866:"SK",36951:"YW",37034:"YX",37063:"XH",37218:"ZC",37325:"ZC",38063:"PB",38079:"TD",38085:"QY",38107:"DC",38116:"TD",38123:"YD",38224:"HG",38241:"XTC",38271:"ZC",38415:"YE",38426:"KH",38461:"YD",38463:"AE",38466:"PB",38477:"XJ",38518:"YT",38551:"WK",38585:"ZC",38704:"XS",38739:"LJ",38761:"GJ",38808:"SQ",39048:"JG",39049:"XJ",39052:"HG",39076:"CZ",39271:"XT",39534:"TD",39552:"TD",39584:"PB",39647:"SB",39730:"LG",39748:"TPB",40109:"ZQ",40479:"ND",40516:"HG",40536:"HG",40583:"QJ",40765:"YQ",40784:"QJ",40840:"YK",40863:"QJG"},c=function(c){var d=c.charCodeAt(0);return d>40869||d<19968?c:b[d]?b[d]:a.charAt(d-19968)},d=function(a){for(var b,c=[""],d=0,e=a.length;d<e;d++){var f=a[d],g=f.length;if(1==g)for(b=0;b<c.length;b++)c[b]+=f;else{var h=c.slice(0);for(c=[],b=0;b<g;b++){for(var i=h.slice(0),j=0;j<i.length;j++)i[j]+=f.charAt(b);c=c.concat(i)}}}return c.join("").toLowerCase()};_.extend(BI,{makeFirstPY:function(a){if("string"!=typeof a)return""+a;for(var b=[],e=0,f=a.length;e<f;e++){var g=a.charAt(e);b.push(c(g))}return d(b)}})}(),!function(){var a;a="undefined"!=typeof window?window:"undefined"!=typeof self?self:this;var b="undefined"!=typeof document&&document.addEventListener,c=!1;if(b){var d=function(){var b=a.requestAnimationFrame||a.mozRequestAnimationFrame||a.webkitRequestAnimationFrame||function(b){return a.setTimeout(b,20)};return function(a){return b(a)}}(),e=function(){var b=a.cancelAnimationFrame||a.mozCancelAnimationFrame||a.webkitCancelAnimationFrame||a.clearTimeout;return function(a){return b(a)}}(),f=function(a){var b=a.__resizeTriggers__,c=b.firstElementChild,d=b.lastElementChild,e=c.firstElementChild;d.scrollLeft=d.scrollWidth,d.scrollTop=d.scrollHeight,e.style.width=c.offsetWidth+1+"px",e.style.height=c.offsetHeight+1+"px",c.scrollLeft=c.scrollWidth,c.scrollTop=c.scrollHeight},g=function(a){return a.offsetWidth!==a.__resizeLast__.width||a.offsetHeight!==a.__resizeLast__.height},h=function(a){var b=this;f(this),this.__resizeRAF__&&e(this.__resizeRAF__),this.__resizeRAF__=d(function(){g(b)&&(b.__resizeLast__.width=b.offsetWidth,b.__resizeLast__.height=b.offsetHeight,b.__resizeListeners__.forEach(function(c){c.call(b,a)}))})},i=!1,j="animation",k="",l="animationstart",m="Webkit Moz O ms".split(" "),n="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),o="",p=document.createElement("fakeelement");if(void 0!==p.style.animationName&&(i=!0),i===!1)for(var q=0;q<m.length;q++)if(void 0!==p.style[m[q]+"AnimationName"]){o=m[q],j=o+"Animation",k="-"+o.toLowerCase()+"-",l=n[q],i=!0;break}var r="resizeanim",s="@"+k+"keyframes "+r+" { from { opacity: 0; } to { opacity: 0; } } ",t=k+"animation: 1ms "+r+"; "}var u=function(){if(!c){var a=(s?s:"")+".resize-triggers { "+(t?t:"")+'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',b=document.head||document.getElementsByTagName("head")[0],d=document.createElement("style");d.type="text/css",d.styleSheet?d.styleSheet.cssText=a:d.appendChild(document.createTextNode(a)),b.appendChild(d),c=!0}},v=function(a,c){b?(a.__resizeTriggers__||("static"===getComputedStyle(a).position&&(a.style.position="relative"),u(),a.__resizeLast__={},a.__resizeListeners__=[],(a.__resizeTriggers__=document.createElement("div")).className="resize-triggers",a.__resizeTriggers__.innerHTML='<div class="expand-trigger"><div></div></div><div class="contract-trigger"></div>',a.appendChild(a.__resizeTriggers__),f(a),a.addEventListener("scroll",h,!0),l&&a.__resizeTriggers__.addEventListener(l,function(b){b.animationName===r&&f(a)})),a.__resizeListeners__.push(c)):a.attachEvent("onresize",c)},w=function(a,c){b?(a.__resizeListeners__.splice(a.__resizeListeners__.indexOf(c),1),a.__resizeListeners__.length||(a.removeEventListener("scroll",h,!0),a.__resizeTriggers__=!a.removeChild(a.__resizeTriggers__))):a.detachEvent("onresize",c)};BI.ResizeDetector={addResizeListener:function(a,b){return v(a.element[0],b),function(){w(a.element[0],b)}},removeResizeListener:function(a,b){w(a.element[0],b)}}}(),function(){function a(a,b){return a<b}BI.Heap=function(b,c){this._items=b||[],this._size=this._items.length,this._comparator=c||a,this._heapify()},BI.Heap.prototype={constructor:BI.Heap,empty:function(){return 0===this._size},pop:function(){if(0!==this._size){var a=this._items[0],b=this._items.pop();return this._size--,this._size>0&&(this._items[0]=b,this._sinkDown(0)),a}},push:function(a){this._items[this._size++]=a,this._bubbleUp(this._size-1)},size:function(){return this._size},peek:function(){if(0!==this._size)return this._items[0]},_heapify:function(){for(var a=Math.floor((this._size+1)/2);a>=0;a--)this._sinkDown(a)},_bubbleUp:function(a){for(var b=this._items[a];a>0;){var c=Math.floor((a+1)/2)-1,d=this._items[c];if(this._comparator(d,b))return;this._items[c]=b,this._items[a]=d,a=c}},_sinkDown:function(a){for(var b=this._items[a];;){var c=2*(a+1)-1,d=2*(a+1),e=-1;if(c<this._size){var f=this._items[c];this._comparator(f,b)&&(e=c)}if(d<this._size){var g=this._items[d];this._comparator(g,b)&&(e===-1||this._comparator(g,this._items[e]))&&(e=d)}if(e===-1)return;this._items[a]=this._items[e],this._items[e]=b,a=e}}}}(),function(){var a=function(a,b,c){return b<a?a:b>c?c:b},b=5,c={index:0,offset:0,position:0,contentHeight:0};BI.TableScrollHelper=function(a,b,c,d){this._rowOffsets=BI.PrefixIntervalTree.uniform(a,b),this._storedHeights=new Array(a);for(var e=0;e<a;++e)this._storedHeights[e]=b;this._rowCount=a,this._position=0,this._contentHeight=a*b,this._defaultRowHeight=b,this._rowHeightGetter=d?d:function(){return b},this._viewportHeight=c,this._updateHeightsInViewport(0,0)},BI.TableScrollHelper.prototype={constructor:BI.TableScrollHelper,setRowHeightGetter:function(a){this._rowHeightGetter=a},setViewportHeight:function(a){this._viewportHeight=a},getContentHeight:function(){return this._contentHeight},_updateHeightsInViewport:function(a,b){for(var c=b,d=a;c<=this._viewportHeight&&d<this._rowCount;)this._updateRowHeight(d),c+=this._storedHeights[d],d++},_updateHeightsAboveViewport:function(a){for(var c=a-1;c>=0&&c>=a-b;){var d=this._updateRowHeight(c);this._position+=d,c--}},_updateRowHeight:function(a){if(a<0||a>=this._rowCount)return 0;var b=this._rowHeightGetter(a);if(b!==this._storedHeights[a]){var c=b-this._storedHeights[a];return this._rowOffsets.set(a,b),this._storedHeights[a]=b,this._contentHeight+=c,c}return 0},getRowPosition:function(a){return this._updateRowHeight(a),this._rowOffsets.sumUntil(a)},scrollBy:function(b){if(0===this._rowCount)return c;var d=this._rowOffsets.greatestLowerBound(this._position);d=a(d,0,Math.max(this._rowCount-1,0));var e=this._rowOffsets.sumUntil(d),f=d,g=this._position,h=this._updateRowHeight(f);0!==e&&(g+=h);var i=this._storedHeights[f]-(g-e);if(b>=0)for(;b>0&&f<this._rowCount;)b<i?(g+=b,b=0):(b-=i,g+=i,f++),f<this._rowCount&&(this._updateRowHeight(f),i=this._storedHeights[f]);else if(b<0){b=-b;for(var j=this._storedHeights[f]-i;b>0&&f>=0;)if(b<j?(g-=b,b=0):(g-=j,b-=j,f--),f>=0){var k=this._updateRowHeight(f);j=this._storedHeights[f],g+=k}}var l=this._contentHeight-this._viewportHeight;g=a(g,0,l),this._position=g;var m=this._rowOffsets.greatestLowerBound(g);m=a(m,0,Math.max(this._rowCount-1,0)),e=this._rowOffsets.sumUntil(m);var n=e-g;return this._updateHeightsInViewport(m,n),this._updateHeightsAboveViewport(m),{index:m,offset:n,position:this._position,contentHeight:this._contentHeight}},_getRowAtEndPosition:function(a){this._updateRowHeight(a);for(var b=a,c=this._storedHeights[b];c<this._viewportHeight&&b>=0;)b--,b>=0&&(this._updateRowHeight(b),c+=this._storedHeights[b]);var d=this._rowOffsets.sumTo(a)-this._viewportHeight;return d<0&&(d=0),d},scrollTo:function(b){if(0===this._rowCount)return c;if(b<=0)return this._position=0,this._updateHeightsInViewport(0,0),{index:0,offset:0,position:this._position,contentHeight:this._contentHeight};if(b>=this._contentHeight-this._viewportHeight){var d=this._rowCount-1;b=this._getRowAtEndPosition(d)}this._position=b;var e=this._rowOffsets.greatestLowerBound(b);e=a(e,0,Math.max(this._rowCount-1,0));var f=this._rowOffsets.sumUntil(e),g=f-b;return this._updateHeightsInViewport(e,g),this._updateHeightsAboveViewport(e),{index:e,offset:g,position:this._position,contentHeight:this._contentHeight}},scrollToRow:function(b,c){b=a(b,0,Math.max(this._rowCount-1,0)),c=a(c,-this._storedHeights[b],0);var d=this._rowOffsets.sumUntil(b);return this.scrollTo(d-c)},scrollRowIntoView:function(b){b=a(b,0,Math.max(this._rowCount-1,0));var c=this._rowOffsets.sumUntil(b),d=c+this._storedHeights[b];if(c<this._position)return this.scrollTo(c);if(this._position+this._viewportHeight<d){var e=this._getRowAtEndPosition(b);return this.scrollTo(e)}return this.scrollTo(this._position)}}}(),BI.IntegerBufferSet=function(){this._valueToPositionMap={},this._size=0,this._smallValues=new BI.Heap([],this._smallerComparator),this._largeValues=new BI.Heap([],this._greaterComparator)},BI.IntegerBufferSet.prototype={constructor:BI.IntegerBufferSet,getSize:function(){return this._size},getValuePosition:function(a){return void 0===this._valueToPositionMap[a]?null:this._valueToPositionMap[a]},getNewPositionForValue:function(a){var b=this._size;return this._size++,this._pushToHeaps(b,a),this._valueToPositionMap[a]=b,b},replaceFurthestValuePosition:function(a,b,c){if(this._cleanHeaps(),this._smallValues.empty()||this._largeValues.empty())return null;var d=this._smallValues.peek().value,e=this._largeValues.peek().value;if(d>=a&&e<=b)return null;var f;a-d>e-b?(f=d,this._smallValues.pop()):(f=e,this._largeValues.pop());var g=this._valueToPositionMap[f];return delete this._valueToPositionMap[f],this._valueToPositionMap[c]=g,this._pushToHeaps(g,c),g},_pushToHeaps:function(a,b){var c={position:a,value:b};this._smallValues.push(c),this._largeValues.push(c)},_cleanHeaps:function(){this._cleanHeap(this._smallValues),this._cleanHeap(this._largeValues);var a=Math.min(this._smallValues.size(),this._largeValues.size()),b=Math.max(this._smallValues.size(),this._largeValues.size());b>10*a&&this._recreateHeaps()},_recreateHeaps:function(){for(var a=this._smallValues.size()<this._largeValues.size()?this._smallValues:this._largeValues,b=new Heap([],this._smallerComparator),c=new Heap([],this._greaterComparator);!a.empty();){var d=a.pop();void 0!==this._valueToPositionMap[d.value]&&(b.push(d),c.push(d))}this._smallValues=b,this._largeValues=c},_cleanHeap:function(a){for(;!a.empty()&&void 0===this._valueToPositionMap[a.peek().value];)a.pop()},_smallerComparator:function(a,b){return a.value<b.value},_greaterComparator:function(a,b){return a.value>b.value}},!function(){BI.LinkHashMap=function(){this.array=[],this.map={}},BI.LinkHashMap.prototype={constructor:BI.LinkHashMap,has:function(a){return a in this.map},add:function(a,b){"undefined"!=typeof a&&(a in this.map?this.map[a]=b:(this.array.push(a),this.map[a]=b))},remove:function(a){if(a in this.map){delete this.map[a];for(var b=0;b<this.array.length;b++)if(this.array[b]==a){this.array.splice(b,1);break}}},size:function(){return this.array.length},each:function(a,b){var b=b||window,a=a||null;if(null!=a&&"function"==typeof a)for(var c=0;c<this.array.length;c++){var d=this.array[c],e=this.map[d],f=a.call(b,d,e,c,this.array,this.map);if(0==f)break}},get:function(a){return this.map[a]},toArray:function(){var a=[];return this.each(function(b,c){a.push(c)}),a}}}(),window.BI=window.BI||{},$.extend(BI,{$defaultImport:function(a,b){var c;BI.isObject(a)?(c=$.extend({op:"resource",path:null,type:null,must:!1},a),c.url=BI.servletURL+"?op="+c.op+"&resource="+c.path):c={url:BI.servletURL+"?op=resource&resource="+a,type:arguments[1],must:arguments[2]},this.$import(c.url,c.type,c.must)},$import:function(){function a(a,c){var d=$("head script, body script");$.each(d,function(c,d){d.src.indexOf(a)!=-1&&(b[a]=!0)});var e=$("head link");$.each(e,function(d,e){e.href.indexOf(a)!=-1&&c&&(b[a]=!1,$(e).remove())})}var b={};return function(c,d,e){if(a(c,e),b[c]!==!0)if("css"===d){var f=document.createElement("link");f.rel="stylesheet",f.type="text/css",f.href=c;var g=document.getElementsByTagName("head")[0];g.appendChild(f),b[c]=!0}else $.ajax({url:c,dataType:"script",async:!1,cache:!0,complete:function(a,d){"success"==d&&(b[c]=!0)}})}}()}),!function(){BI.LRU=function(a){this.size=0,this.limit=a,this.head=this.tail=void 0,this._keymap={}};var a=BI.LRU.prototype;a.put=function(a,b){var c;this.size===this.limit&&(c=this.shift());var d=this.get(a,!0);return d||(d={key:a},this._keymap[a]=d,this.tail?(this.tail.newer=d,d.older=this.tail):this.head=d,this.tail=d,this.size++),d.value=b,c},a.shift=function(){var a=this.head;return a&&(this.head=this.head.newer,this.head.older=void 0,a.newer=a.older=void 0,this._keymap[a.key]=void 0,this.size--),a},a.get=function(a,b){var c=this._keymap[a];if(void 0!==c)return c===this.tail?b?c:c.value:(c.newer&&(c===this.head&&(this.head=c.newer),c.newer.older=c.older),c.older&&(c.older.newer=c.newer),c.newer=void 0,c.older=this.tail,this.tail&&(this.tail.newer=c),this.tail=c,b?c:c.value)},a.has=function(a){return null!=this._keymap[a]}}(),!function(){var a=function(a){this.hexcase=a?1:0,this.b64pad="",this.chrsz=8};a.prototype.hex_md5=function(a){return this.binl2hex(this.core_md5(this.str2binl(a),a.length*this.chrsz))},a.prototype.hex_md5_salt=function(a){for(var b=this.hex_md5(a),c=[],d=[],e=0;e<b.length;e++)e%2===0?c.push(b.charAt(e)):d.push(b.charAt(e));var f=":"+c.join("")+d.join("");return f},a.prototype.b64_md5=function(a){return this.binl2b64(this.core_md5(this.str2binl(a),a.length*this.chrsz))},a.prototype.hex_hmac_md5=function(a,b){return this.binl2hex(this.core_hmac_md5(a,b))},a.prototype.b64_hmac_md5=function(a,b){return this.binl2b64(this.core_hmac_md5(a,b))},a.prototype.calcMD5=function(a){return this.binl2hex(this.core_md5(this.str2binl(a),a.length*this.chrsz))},a.prototype.core_md5=function(a,b){a[b>>5]|=128<<b%32,a[(b+64>>>9<<4)+14]=b;for(var c=1732584193,d=-271733879,e=-1732584194,f=271733878,g=0;g<a.length;g+=16){var h=c,i=d,j=e,k=f;c=this.md5_ff(c,d,e,f,a[g+0],7,-680876936),f=this.md5_ff(f,c,d,e,a[g+1],12,-389564586),e=this.md5_ff(e,f,c,d,a[g+2],17,606105819),d=this.md5_ff(d,e,f,c,a[g+3],22,-1044525330),c=this.md5_ff(c,d,e,f,a[g+4],7,-176418897),f=this.md5_ff(f,c,d,e,a[g+5],12,1200080426),e=this.md5_ff(e,f,c,d,a[g+6],17,-1473231341),d=this.md5_ff(d,e,f,c,a[g+7],22,-45705983),c=this.md5_ff(c,d,e,f,a[g+8],7,1770035416),f=this.md5_ff(f,c,d,e,a[g+9],12,-1958414417),e=this.md5_ff(e,f,c,d,a[g+10],17,-42063),d=this.md5_ff(d,e,f,c,a[g+11],22,-1990404162),c=this.md5_ff(c,d,e,f,a[g+12],7,1804603682),f=this.md5_ff(f,c,d,e,a[g+13],12,-40341101),e=this.md5_ff(e,f,c,d,a[g+14],17,-1502002290),d=this.md5_ff(d,e,f,c,a[g+15],22,1236535329),c=this.md5_gg(c,d,e,f,a[g+1],5,-165796510),f=this.md5_gg(f,c,d,e,a[g+6],9,-1069501632),e=this.md5_gg(e,f,c,d,a[g+11],14,643717713),d=this.md5_gg(d,e,f,c,a[g+0],20,-373897302),c=this.md5_gg(c,d,e,f,a[g+5],5,-701558691),f=this.md5_gg(f,c,d,e,a[g+10],9,38016083),e=this.md5_gg(e,f,c,d,a[g+15],14,-660478335),d=this.md5_gg(d,e,f,c,a[g+4],20,-405537848),c=this.md5_gg(c,d,e,f,a[g+9],5,568446438),f=this.md5_gg(f,c,d,e,a[g+14],9,-1019803690),e=this.md5_gg(e,f,c,d,a[g+3],14,-187363961),d=this.md5_gg(d,e,f,c,a[g+8],20,1163531501),c=this.md5_gg(c,d,e,f,a[g+13],5,-1444681467),f=this.md5_gg(f,c,d,e,a[g+2],9,-51403784),e=this.md5_gg(e,f,c,d,a[g+7],14,1735328473),d=this.md5_gg(d,e,f,c,a[g+12],20,-1926607734),c=this.md5_hh(c,d,e,f,a[g+5],4,-378558),f=this.md5_hh(f,c,d,e,a[g+8],11,-2022574463),e=this.md5_hh(e,f,c,d,a[g+11],16,1839030562),d=this.md5_hh(d,e,f,c,a[g+14],23,-35309556),c=this.md5_hh(c,d,e,f,a[g+1],4,-1530992060),f=this.md5_hh(f,c,d,e,a[g+4],11,1272893353),e=this.md5_hh(e,f,c,d,a[g+7],16,-155497632),d=this.md5_hh(d,e,f,c,a[g+10],23,-1094730640),c=this.md5_hh(c,d,e,f,a[g+13],4,681279174),f=this.md5_hh(f,c,d,e,a[g+0],11,-358537222),e=this.md5_hh(e,f,c,d,a[g+3],16,-722521979),d=this.md5_hh(d,e,f,c,a[g+6],23,76029189),c=this.md5_hh(c,d,e,f,a[g+9],4,-640364487),f=this.md5_hh(f,c,d,e,a[g+12],11,-421815835),e=this.md5_hh(e,f,c,d,a[g+15],16,530742520),d=this.md5_hh(d,e,f,c,a[g+2],23,-995338651),c=this.md5_ii(c,d,e,f,a[g+0],6,-198630844),f=this.md5_ii(f,c,d,e,a[g+7],10,1126891415),e=this.md5_ii(e,f,c,d,a[g+14],15,-1416354905),d=this.md5_ii(d,e,f,c,a[g+5],21,-57434055),c=this.md5_ii(c,d,e,f,a[g+12],6,1700485571),f=this.md5_ii(f,c,d,e,a[g+3],10,-1894986606),e=this.md5_ii(e,f,c,d,a[g+10],15,-1051523),d=this.md5_ii(d,e,f,c,a[g+1],21,-2054922799),c=this.md5_ii(c,d,e,f,a[g+8],6,1873313359),f=this.md5_ii(f,c,d,e,a[g+15],10,-30611744),e=this.md5_ii(e,f,c,d,a[g+6],15,-1560198380),d=this.md5_ii(d,e,f,c,a[g+13],21,1309151649),c=this.md5_ii(c,d,e,f,a[g+4],6,-145523070),f=this.md5_ii(f,c,d,e,a[g+11],10,-1120210379),e=this.md5_ii(e,f,c,d,a[g+2],15,718787259),d=this.md5_ii(d,e,f,c,a[g+9],21,-343485551),c=this.safe_add(c,h),d=this.safe_add(d,i),e=this.safe_add(e,j),f=this.safe_add(f,k)}return Array(c,d,e,f)},a.prototype.md5_cmn=function(a,b,c,d,e,f){return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(b,a),this.safe_add(d,f)),e),c)},a.prototype.md5_ff=function(a,b,c,d,e,f,g){return this.md5_cmn(b&c|~b&d,a,b,e,f,g)},a.prototype.md5_gg=function(a,b,c,d,e,f,g){return this.md5_cmn(b&d|c&~d,a,b,e,f,g)},a.prototype.md5_hh=function(a,b,c,d,e,f,g){return this.md5_cmn(b^c^d,a,b,e,f,g)},a.prototype.md5_ii=function(a,b,c,d,e,f,g){return this.md5_cmn(c^(b|~d),a,b,e,f,g)},a.prototype.core_hmac_md5=function(a,b){var c=this.str2binl(a);c.length>16&&(c=this.core_md5(c,a.length*this.chrsz));for(var d=Array(16),e=Array(16),f=0;f<16;f++)d[f]=909522486^c[f],e[f]=1549556828^c[f];var g=this.core_md5(d.concat(this.str2binl(b)),512+b.length*this.chrsz);return this.core_md5(e.concat(g),640)},a.prototype.safe_add=function(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c},a.prototype.bit_rol=function(a,b){return a<<b|a>>>32-b},a.prototype.str2binl=function(a){for(var b=Array(),c=(1<<this.chrsz)-1,d=0;d<a.length*this.chrsz;d+=this.chrsz)b[d>>5]|=(a.charCodeAt(d/this.chrsz)&c)<<d%32;return b},a.prototype.binl2hex=function(a){for(var b=this.hexcase?"0123456789ABCDEF":"0123456789abcdef",c="",d=0;d<4*a.length;d++)c+=b.charAt(a[d>>2]>>d%4*8+4&15)+b.charAt(a[d>>2]>>d%4*8&15);return c},a.prototype.binl2b64=function(a){for(var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c="",d=0;d<4*a.length;d+=3)for(var e=(a[d>>2]>>8*(d%4)&255)<<16|(a[d+1>>2]>>8*((d+1)%4)&255)<<8|a[d+2>>2]>>8*((d+2)%4)&255,f=0;f<4;f++)c+=8*d+6*f>32*a.length?this.b64pad:b.charAt(e>>6*(3-f)&63);return c},BI.MD5=new a}(),function(){var a=function(a){return Math.floor(a/2)},b=window.Int32Array||function(a){for(var b=[],c=a-1;c>=0;--c)b[c]=0;return b},c=function(a){for(var b=1;b<a;)b*=2;return b};BI.PrefixIntervalTree=function(a){this._size=a.length,this._half=c(this._size),this._heap=new b(2*this._half);var d;for(d=0;d<this._size;++d)this._heap[this._half+d]=a[d];for(d=this._half-1;d>0;--d)this._heap[d]=this._heap[2*d]+this._heap[2*d+1]},BI.PrefixIntervalTree.prototype={constructor:BI.PrefixIntervalTree,set:function(b,c){var d=this._half+b;for(this._heap[d]=c,d=a(d);0!==d;d=a(d))this._heap[d]=this._heap[2*d]+this._heap[2*d+1]},get:function(a){var b=this._half+a;return this._heap[b]},getSize:function(){return this._size},sumUntil:function(b){if(0===b)return 0;for(var c=this._half+b-1,d=this._heap[c];1!==c;c=a(c))c%2===1&&(d+=this._heap[c-1]);return d},sumTo:function(a){return this.sumUntil(a+1)},sum:function(a,b){return this.sumUntil(b)-this.sumUntil(a)},greatestLowerBound:function(a){if(a<0)return-1;var b=1;if(this._heap[b]<=a)return this._size;for(;b<this._half;){var c=this._heap[2*b];a<c?b=2*b:(b=2*b+1,a-=c)}return b-this._half},greatestStrictLowerBound:function(a){if(a<=0)return-1;var b=1;if(this._heap[b]<a)return this._size;for(;b<this._half;){var c=this._heap[2*b];a<=c?b=2*b:(b=2*b+1,a-=c)}return b-this._half},leastUpperBound:function(a){return this.greatestStrictLowerBound(a)+1},leastStrictUpperBound:function(a){return this.greatestLowerBound(a)+1}},BI.PrefixIntervalTree.uniform=function(a,b){for(var c=[],d=a-1;d>=0;--d)c[d]=b;return new BI.PrefixIntervalTree(c)},BI.PrefixIntervalTree.empty=function(a){return BI.PrefixIntervalTree.uniform(a,0)}}(),!function(){BI.Queue=function(a){this.capacity=a,this.array=[]},BI.Queue.prototype={constructor:BI.Queue,contains:function(a){return this.array.contains(a)},indexOf:function(a){return this.array.contains(a)},getElementByIndex:function(a){return this.array[a]},push:function(a){this.array.push(a),this.capacity&&this.array.length>this.capacity&&this.array.shift()},pop:function(){this.array.pop()},shift:function(){this.array.shift()},unshift:function(a){this.array.unshift(a),this.capacity&&this.array.length>this.capacity&&this.array.pop()},remove:function(a){this.array.remove(a)},splice:function(){this.array.splice.apply(this.array,arguments)},slice:function(){this.array.slice.apply(this.array,arguments)},size:function(){return this.array.length},each:function(a,b){var b=b||window,a=a||null;if(null!=a&&"function"==typeof a)for(var c=0;c<this.array.length;c++){var d=a.call(b,c,this.array[c],this.array);if(0==d)break}},toArray:function(){return this.array},fromArray:function(a){var b=this;BI.each(a,function(a,c){b.push(c)})},clear:function(){this.array.clear()}}}(),!function(){var a=function(a,b,c,d){this.height=a,this.width=b,this.x=c,this.y=d,this._indexMap={},this._indices=[]};a.prototype={constructor:a,addCellIndex:function(a){this._indexMap[a]||(this._indexMap[a]=!0,this._indices.push(a))},getCellIndices:function(){return this._indices}};var b=100;BI.SectionManager=function(a){this._sectionSize=a||b,this._cellMetadata=[],this._sections={}},BI.SectionManager.prototype={constructor:BI.SectionManager,getCellIndices:function(a,b,c,d){var e={};return BI.each(this.getSections(a,b,c,d),function(a,b){BI.each(b.getCellIndices(),function(a,b){e[b]=b})}),BI.map(BI.keys(e),function(a,b){return e[b]})},getCellMetadata:function(a){return this._cellMetadata[a]},getSections:function(b,c,d,e){for(var f=Math.floor(d/this._sectionSize),g=Math.floor((d+c-1)/this._sectionSize),h=Math.floor(e/this._sectionSize),i=Math.floor((e+b-1)/this._sectionSize),j=[],k=f;k<=g;k++)for(var l=h;l<=i;l++){var m=k+"."+l;this._sections[m]||(this._sections[m]=new a(this._sectionSize,this._sectionSize,k*this._sectionSize,l*this._sectionSize)),j.push(this._sections[m])}return j},getTotalSectionCount:function(){return BI.size(this._sections)},registerCell:function(a,b){this._cellMetadata[b]=a,BI.each(this.getSections(a.height,a.width,a.x,a.y),function(a,c){c.addCellIndex(b)})}}}(),function(){var a=function(a,b,c){return a<b?b:a>c?c:a},b=6,c=10;BI.TableRowBuffer=function(d,e,f,g){this._bufferSet=new BI.IntegerBufferSet,this._defaultRowHeight=e,this._viewportRowsBegin=0,this._viewportRowsEnd=0,this._maxVisibleRowCount=Math.ceil(f/e)+1,this._bufferRowsCount=a(Math.floor(this._maxVisibleRowCount/2),b,c),this._rowsCount=d,this._rowHeightGetter=g,this._rows=[],this._viewportHeight=f},BI.TableRowBuffer.prototype={constructor:BI.TableRowBuffer,getRowsWithUpdatedBuffer:function(){for(var a=2*this._bufferRowsCount,b=Math.max(this._viewportRowsBegin-this._bufferRowsCount,0);b<this._viewportRowsBegin;)this._addRowToBuffer(b,this._viewportRowsBegin,this._viewportRowsEnd-1),b++,a--;for(b=this._viewportRowsEnd;b<this._rowsCount&&a>0;)this._addRowToBuffer(b,this._viewportRowsBegin,this._viewportRowsEnd-1),b++,a--;return this._rows},getRows:function(a,b){var c=b,d=c,e=a,f=Math.min(a+this._maxVisibleRowCount,this._rowsCount);for(this._viewportRowsBegin=a;e<f||d<this._viewportHeight&&e<this._rowsCount;)this._addRowToBuffer(e,a,f-1),d+=this._rowHeightGetter(e),++e,this._viewportRowsEnd=e;return this._rows},_addRowToBuffer:function(a,b,c){var d=this._bufferSet.getValuePosition(a),e=c-b+1,f=e+2*this._bufferRowsCount;null===d&&this._bufferSet.getSize()>=f&&(d=this._bufferSet.replaceFurthestValuePosition(b,c,a)),null===d?(d=this._bufferSet.getNewPositionForValue(a),this._rows[d]=a):this._rows[d]=a}}}(),function(){BI.Tree=function(){this.root=new BI.Node(BI.UUID())},BI.Tree.prototype={constructor:BI.Tree,addNode:function(a,b,c){BI.isNull(b)?this.root.addChild(a,c):BI.isNull(a)?this.root.addChild(b,c):a.addChild(b,c)},isRoot:function(a){return a===this.root},getRoot:function(){return this.root},clear:function(){this.root.clear()},initTree:function(a){var b=this;this.clear();var c=[];for(BI.each(a,function(a,d){var e=new BI.Node(d);e.set("data",d),b.addNode(e),c.push(e)});!BI.isEmpty(c);){var d=c.shift(),e=d.get("data");BI.each(e.children,function(a,e){var f=new BI.Node(e);f.set("data",e),c.push(f),b.addNode(d,f)})}},_toJSON:function(a){var b=this,c=[];return BI.each(a.getChildren(),function(a,d){c.push(b._toJSON(d))}),BI.extend({id:a.id},BI.deepClone(a.get("data")),c.length>0?{children:c}:{})},toJSON:function(a){var b=this,c=[];return BI.each((a||this.root).getChildren(),function(a,d){c.push(b._toJSON(d))}),c},_toJSONWithNode:function(a){var b=this,c=[];return BI.each(a.getChildren(),function(a,d){c.push(b._toJSONWithNode(d))}),BI.extend({id:a.id},BI.deepClone(a.get("data")),{node:a},c.length>0?{children:c}:{})},toJSONWithNode:function(a){var b=this,c=[];return BI.each((a||this.root).getChildren(),function(a,d){c.push(b._toJSONWithNode(d))}),c},search:function(a,b,c){if(!(a instanceof BI.Node))return arguments.callee.apply(this,[this.root,a,b]);var d=this,e=null;return BI.isNull(b)?null:BI.isEqual(a[c||"id"],b)?a:(BI.any(a.getChildren(),function(a,f){if(e=d.search(f,b,c),null!==e)return!0}),e)},_traverse:function(a,b){var c=[];for(c.push(a);!BI.isEmpty(c);){var d=c.shift(),e=b&&b(d);if(e===!1)break;e!==!0&&null!=d&&(c=c.concat(d.getChildren()))}},traverse:function(a){this._traverse(this.root,a)},_recursion:function(a,b,c){var d=this;return BI.every(a.getChildren(),function(a,e){var f=BI.clone(b);f.push(e.id);var g=c&&c(e,f);return g!==!1&&(g===!0||d._recursion(e,f,c))})},recursion:function(a){this._recursion(this.root,[],a)},inOrderTraverse:function(a){this._inOrderTraverse(this.root,a)},_inOrderTraverse:function(a,b){null!=a&&(this._inOrderTraverse(a.getLeft()),b&&b(a),this._inOrderTraverse(a.getRight()))},nrInOrderTraverse:function(a){for(var b=[],c=this.root;null!=c||!BI.isEmpty(b);){for(;null!=c;)b.push(c),c=c.getLeft();c=b.pop(),a&&a(c),c=c.getRight()}},preOrderTraverse:function(a){this._preOrderTraverse(this.root,a)},_preOrderTraverse:function(a,b){null!=a&&(b&&b(a),this._preOrderTraverse(a.getLeft()),this._preOrderTraverse(a.getRight()))},nrPreOrderTraverse:function(a){for(var b=[],c=this.root;null!=c||!BI.isEmpty(b);){for(;null!=c;)a&&a(c),b.push(c),c=c.getLeft();c=b.pop(),c=c.getRight()}},postOrderTraverse:function(a){this._postOrderTraverse(this.root,a)},_postOrderTraverse:function(a,b){null!=a&&(this._postOrderTraverse(a.getLeft()),this._postOrderTraverse(a.getRight()),b&&b(a))},nrPostOrderTraverse:function(a){for(var b=[],c=this.root,d=null;null!=c||!BI.isEmpty(b);){for(;null!=c;)b.push(c),c=c.getLeft();c=BI.last(b),null==c.getRight()||c.getRight()==d?(a&&a(c),c=b.pop(),d=c,c=null):c=c.getRight()}}},BI.Node=function(a){BI.isObject(a)?BI.extend(this,a):this.id=a,this.clear.apply(this,arguments)},BI.Node.prototype={constructor:BI.Node,set:function(a,b){return BI.isObject(a)?void BI.extend(this,a):void(this[a]=b)},get:function(a){return this[a]},isLeaf:function(){return BI.isEmpty(this.children)},getChildren:function(){return this.children},getChildrenLength:function(){return this.children.length},getFirstChild:function(){return BI.first(this.children)},getLastChild:function(){return BI.last(this.children)},setLeft:function(a){this.left=a},getLeft:function(){return this.left},setRight:function(a){this.right=a},getRight:function(){return this.right},setParent:function(a){this.parent=a},getParent:function(){return this.parent},getChild:function(a){return this.children[a]},getChildIndex:function(a){return BI.findIndex(this.children,function(b,c){return c.get("id")===a})},removeChild:function(a){this.removeChildByIndex(this.getChildIndex(a))},removeChildByIndex:function(a){var b=this.getChild(a-1),c=this.getChild(a+1);null!=b&&b.setRight(c||null),null!=c&&c.setLeft(b||null),
this.children.splice(a,1)},removeAllChilds:function(){this.children=[]},addChild:function(a,b){var c=null;c=BI.isUndefined(b)?this.children.length-1:b-1,a.setParent(this),c>=0&&(this.getChild(c)&&this.getChild(c).setRight(a),a.setLeft(this.getChild(c))),BI.isUndefined(b)?this.children.push(a):this.children.splice(b,0,a)},equals:function(a){return this===a||this.id===a.id},clear:function(){this.parent=null,this.left=null,this.right=null,this.children=[]}},BI.extend(BI.Tree,{transformToArrayFormat:function(a,b){if(!a)return[];var c=[];if(BI.isArray(a))for(var d=0,e=a.length;d<e;d++){var f=BI.clone(a[d]);f.pId=null==f.pId?b:f.pId,delete f.children,c.push(f),a[d].children&&(c=c.concat(BI.Tree.transformToArrayFormat(a[d].children,f.id)))}else{var g=BI.clone(a);g.pId=null==g.pId?b:g.pId,delete g.children,c.push(g),a.children&&(c=c.concat(BI.Tree.transformToArrayFormat(a.children,g.id)))}return c},arrayFormat:function(a,b){if(!a)return[];var c=[];if(BI.isArray(a))for(var d=0,e=a.length;d<e;d++){var f=a[d];f.pId=null==f.pId?b:f.pId,c.push(f),a[d].children&&(c=c.concat(BI.Tree.arrayFormat(a[d].children,f.id)))}else{var g=a;g.pId=null==g.pId?b:g.pId,c.push(g),a.children&&(c=c.concat(BI.Tree.arrayFormat(a.children,g.id)))}return c},transformToTreeFormat:function(a){var b,c;if(!a)return[];if(BI.isArray(a)){var d=[],e=[];for(b=0,c=a.length;b<c;b++){if(BI.isNull(a[b].id))return a;e[a[b].id]=BI.clone(a[b])}for(b=0,c=a.length;b<c;b++)e[a[b].pId]&&a[b].id!==a[b].pId?(e[a[b].pId].children||(e[a[b].pId].children=[]),e[a[b].pId].children.push(e[a[b].id])):d.push(e[a[b].id]),delete e[a[b].id].pId;return d}return[a]},treeFormat:function(a){var b,c;if(!a)return[];if(BI.isArray(a)){var d=[],e=[];for(b=0,c=a.length;b<c;b++){if(BI.isNull(a[b].id))return a;e[a[b].id]=a[b]}for(b=0,c=a.length;b<c;b++)e[a[b].pId]&&a[b].id!==a[b].pId?(e[a[b].pId].children||(e[a[b].pId].children=[]),e[a[b].pId].children.push(e[a[b].id])):d.push(e[a[b].id]);return d}return[a]},traversal:function(a,b){if(!BI.isNull(a)){var c=this;BI.any(a,function(a,d){return b(a,d)===!1||void c.traversal(d.children,b)})}}})}(),BI.Vector=function(a,b){this.x=a,this.y=b},BI.Vector.prototype={constructor:BI.Vector,cross:function(a){return this.x*a.y-this.y*a.x},length:function(a){return Math.sqrt(this.x*a.x+this.y*a.y)}},BI.Region=function(a,b,c,d){this.x=a,this.y=b,this.w=c,this.h=d},BI.Region.prototype={constructor:BI.Region,isIntersects:function(a){if(this.isPointInside(a.x,a.y)||this.isPointInside(a.x+a.w,a.y)||this.isPointInside(a.x,a.y+a.h)||this.isPointInside(a.x+a.w,a.y+a.h))return!0;if(a.isPointInside(this.x,this.y)||a.isPointInside(this.x+this.w,this.y)||a.isPointInside(this.x,this.y+this.h)||a.isPointInside(this.x+this.w,this.y+this.h))return!0;if(null!=a.x&&null!=a.y){var b=new BI.Vector(this.w,this.h),c=new BI.Vector(a.x-this.x,a.y-this.y),d=new BI.Vector(c.x+a.w,c.y+a.h);if(b.cross(c)*b.cross(d)<0)return!0}return!1},isPointInside:function(a,b){return null!=this.x&&null!=this.y&&(a>=this.x&&a<=this.x+this.w&&b>=this.y&&b<=this.y+this.h)},getPosition:function(){var a=[];return a.push(this.x+this.w/2),a.push(this.y+this.h/2),a}},BI.BehaviorFactory={createBehavior:function(a,b){var c;switch(a){case"highlight":c=BI.HighlightBehavior;break;case"redmark":c=BI.RedMarkBehavior}return new c(b)}},BI.Behavior=BI.inherit(BI.OB,{_defaultConfig:function(){return BI.extend(BI.Behavior.superclass._defaultConfig.apply(this,arguments),{rule:function(){return!0}})},_init:function(){BI.Behavior.superclass._init.apply(this,arguments)},doBehavior:function(){}}),BI.Layout=BI.inherit(BI.Widget,{props:function(){return{scrollable:null,scrollx:!1,scrolly:!1,items:[]}},render:function(){this._init4Margin(),this._init4Scroll()},_init4Margin:function(){this.options.top&&this.element.css("top",this.options.top),this.options.left&&this.element.css("left",this.options.left),this.options.bottom&&this.element.css("bottom",this.options.bottom),this.options.right&&this.element.css("right",this.options.right)},_init4Scroll:function(){switch(this.options.scrollable){case!0:this.element.css("overflow","auto");break;case!1:this.element.css("overflow","hidden")}this.options.scrollx&&this.element.css({"overflow-x":"auto","overflow-y":"hidden"}),this.options.scrolly&&this.element.css({"overflow-x":"hidden","overflow-y":"auto"})},_mountChildren:function(){var a=this,b=document.createDocumentFragment(),c=!1;BI.each(this._children,function(d,e){e.element!==a.element&&(b.appendChild(e.element[0]),c=!0)}),c===!0&&this.element.append(b)},_getChildName:function(a){return a+""},_addElement:function(a,b){var c,d=this;return this.hasWidget(this._getChildName(a))?c=this.getWidgetByName(this._getChildName(a)):(c=BI.createWidget(b),c.on(BI.Events.DESTROY,function(){BI.each(d._children,function(a,b){b===c&&(BI.remove(d._children,b),d.removeItemAt(0|a))})}),this.addWidget(this._getChildName(a),c)),c},_getOptions:function(a){return a instanceof BI.Widget&&(a=a.options),a=BI.stripEL(a),a instanceof BI.Widget&&(a=a.options),a},_compare:function(a,b){function c(a,b,e,f){if(a===b)return 0!==a||1/a===1/b;if(null==a||null==b)return a===b;var g=Object.prototype.toString.call(a);switch(g){case"[object RegExp]":case"[object String]":return""+a==""+b;case"[object Number]":return+a!==+a?+b!==+b:0===+a?1/+a===1/b:+a===+b;case"[object Date]":case"[object Boolean]":return+a===+b}var h="[object Array]"===g;if(!h){if(BI.isFunction(a)&&BI.isFunction(b))return!0;a=d._getOptions(a),b=d._getOptions(b)}e=e||[],f=f||[];for(var i=e.length;i--;)if(e[i]===a)return f[i]===b;if(e.push(a),f.push(b),h){if(i=a.length,i!==b.length)return!1;for(;i--;)if(!c(a[i],b[i],e,f))return!1}else{var j,k=_.keys(a);if(i=k.length,_.keys(b).length!==i)return!1;for(;i--;)if(j=k[i],!_.has(b,j)||!c(a[j],b[j],e,f))return!1}return e.pop(),f.pop(),!0}var d=this;return c(a,b)},_getWrapper:function(){return this.element},_addItemAt:function(a,b){for(var c=this.options.items.length;c>a;c--)this._children[this._getChildName(c)]=this._children[this._getChildName(c-1)];delete this._children[this._getChildName(a)],this.options.items.splice(a,0,b)},_removeItemAt:function(a){for(var b=a;b<this.options.items.length-1;b++)this._children[this._getChildName(b)]=this._children[this._getChildName(b+1)];delete this._children[this._getChildName(this.options.items.length-1)],this.options.items.splice(a,1)},addItem:function(a){return this.addItemAt(this.options.items.length,a)},prependItem:function(a){return this.addItemAt(0,a)},addItemAt:function(a,b){if(!(a<0||a>this.options.items.length)){this._addItemAt(a,b);var c=this._addElement(a,b);return a>0?this._children[this._getChildName(a-1)].element.after(c.element):c.element.prependTo(this._getWrapper()),c._mount(),c}},removeItemAt:function(a){a=BI.isArray(a)?a:[a];for(var b=[],c=[],d={},e=0,f=this.options.items.length;e<f;e++){var g=this._children[this._getChildName(e)];a.contains(e)?g&&b.push(g):(d[this._getChildName(c.length)]=g,c.push(this.options.items[e]))}this.options.items=c,this._children=d,BI.each(b,function(a,b){b._destroy()})},shouldUpdateItem:function(a,b){if(a<0||a>this.options.items.length-1)return!1;var c=this._children[this._getChildName(a)];return c.shouldUpdate?c.shouldUpdate(this._getOptions(b))===!0:null},updateItemAt:function(a,b){if(!(a<0||a>this.options.items.length-1)){var c,d=this._children[this._getChildName(a)];if(c=d.update(this._getOptions(b)))return c;var e=this._children[this._getChildName(a)];delete this._children[this._getChildName(a)],this.options.items.splice(a,1);var f=this._addElement(a,b);this.options.items.splice(a,0,b),this._children[this._getChildName(a)]=f,a>0?this._children[this._getChildName(a-1)].element.after(f.element):f.element.prependTo(this._getWrapper()),e._destroy(),f._mount()}},addItems:function(a){var b=this,c=this.options,d=document.createDocumentFragment(),e=[];BI.each(a,function(a,f){var g=b._addElement(c.items.length,f);b._children[b._getChildName(c.items.length)]=g,c.items.push(f),e.push(g),d.appendChild(g.element[0])}),this._getWrapper().append(d),BI.each(e,function(a,b){b._mount()})},prependItems:function(a){var b=this;a=a||[];for(var c=document.createDocumentFragment(),d=[],e=a.length-1;e>=0;e--){this._addItemAt(0,a[e]);var f=this._addElement(0,a[e]);b._children[b._getChildName(0)]=f,this.options.items.unshift(a[e]),d.push(f),c.appendChild(f.element[0])}this._getWrapper().prepend(c),BI.each(d,function(a,b){b._mount()})},getValue:function(){var a,b=this,c=[];return BI.each(this.options.items,function(d){if(a=b._children[b._getChildName(d)]){var e=a.getValue();e=BI.isArray(e)?e:[e],c=c.concat(e)}}),c},setValue:function(a){var b,c=this;BI.each(this.options.items,function(d){(b=c._children[c._getChildName(d)])&&b.setValue(a)})},setText:function(a){var b,c=this;BI.each(this.options.items,function(d){(b=c._children[c._getChildName(d)])&&b.setText(a)})},patchItem:function(a,b,c){var d=this.shouldUpdateItem(c,b);if(d===!0||null===d&&!this._compare(a,b))return this.updateItemAt(c,b)},updateChildren:function(a,b){function c(a,b,c,d){return a=j._getOptions(a),b=j._getOptions(b),BI.isKey(a.key)?a.key===b.key:c>=0?c===d:void 0}function d(a,b){var c=j._getOptions(a),d=null==c.key?b:c.key;return s[d]=j._addElement(d,a)}function e(a,b,c,e){for(;c<=e;++c){var f=d(b[c],c);g(f,a,!1,c)}}function f(a,b,c){for(;b<=c;++b){var d=j._getOptions(a[b]),e=null==d.key?b:d.key;s[e]._destroy()}}function g(a,b,c,d){a=j._getOptions(a),b=b&&j._getOptions(b);var e=BI.isKey(a.key)?a.key:d;if(b&&s[b.key]){var f,g=BI.isKey(b.key)?b.key:d;f=c?s[g].element.next():s[g].element,f.length>0?f.before(s[e].element):j._getWrapper().append(s[e].element)}else j._getWrapper().append(s[e].element)}var h,i,j=this,k=0,l=0,m=a.length-1,n=a[0],o=a[m],p=b.length-1,q=b[0],r=b[p],s={};for(BI.each(a,function(a,b){b=j._getOptions(b);var c=null==b.key?a:b.key;BI.isKey(c)&&(s[c]=j._children[j._getChildName(a)])});k<=m&&l<=p;)if(BI.isNull(n))n=a[++k];else if(BI.isNull(o))o=a[--m];else if(c(n,q,k,l))i=this.patchItem(n,q,k)||i,s[null==n.key?this._getChildName(k):n.key]=this._children[this._getChildName(k)],n=a[++k],q=b[++l];else if(c(o,r,m,p))i=this.patchItem(o,r,m)||i,s[null==o.key?this._getChildName(m):o.key]=this._children[this._getChildName(m)],o=a[--m],r=b[--p];else if(c(n,r))i=this.patchItem(n,r,k)||i,s[null==n.key?this._getChildName(k):n.key]=this._children[this._getChildName(k)],g(n,o,!0),n=a[++k],r=b[--p];else if(c(o,q))i=this.patchItem(o,q,m)||i,s[null==o.key?this._getChildName(m):o.key]=this._children[this._getChildName(m)],g(o,n),o=a[--m],q=b[++l];else{var t=d(q);g(t,n),q=b[++l]}return k>m?(h=BI.isNull(b[p+1])?null:b[p+1].elm,e(h,b,l,p)):l>p&&f(a,k,m),this._children={},BI.each(b,function(a,b){var c=j._getOptions(b),d=null==c.key?a:c.key;s[d]._mount(),j._children[j._getChildName(a)]=s[d]}),i},update:function(a){var b=this.options,c=a.items||[],d=this.updateChildren(b.items,c);return this.options.items=c,d},stroke:function(a){var b=this;BI.each(a,function(a,c){c&&b._addElement(a,c)})},removeWidget:function(a){var b;BI.isWidget(a)?BI.each(this._children,function(c,d){d===a&&(b=c)}):b=a,b&&this._removeItemAt(0|b)},empty:function(){BI.Layout.superclass.empty.apply(this,arguments),this.options.items=[]},destroy:function(){BI.Layout.superclass.destroy.apply(this,arguments),this.options.items=[]},populate:function(a){this.options;return a=a||[],this._isMounted?void this.update({items:a}):(this.options.items=a,void this.stroke(a))},resize:function(){}}),BI.shortcut("bi.layout",BI.Layout),BI.Action=BI.inherit(BI.OB,{_defaultConfig:function(){return BI.extend(BI.Action.superclass._defaultConfig.apply(this,arguments),{src:null,tar:null})},_init:function(){BI.Action.superclass._init.apply(this,arguments)},actionPerformed:function(a,b,c){},actionBack:function(a,b,c){}}),BI.ActionFactory={createAction:function(a,b){var c;switch(a){case"show":c=BI.ShowAction}return new c(b)}},BI.ShowAction=BI.inherit(BI.Action,{_defaultConfig:function(){return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.ShowAction.superclass._init.apply(this,arguments)},actionPerformed:function(a,b,c){b=b||this.options.tar,b.setVisible(!0),c&&c()},actionBack:function(a,b,c){a=a||this.options.tar,a.setVisible(!1),c&&c()}}),BI.PopoverSection=BI.inherit(BI.Widget,{_init:function(){BI.PopoverSection.superclass._init.apply(this,arguments)},rebuildNorth:function(a){return!0},rebuildCenter:function(a){},rebuildSouth:function(a){return!1},close:function(){this.fireEvent(BI.PopoverSection.EVENT_CLOSE)},end:function(){}}),BI.PopoverSection.EVENT_CLOSE="EVENT_CLOSE",function(){function isEmpty(a){var b=""===a||null===a||void 0===a;return b}function isInvalidDate(a){return"Invalid Date"==a||"NaN"==a}function _eFormat(a,b){var c=b.indexOf("E"),d=b.substr(0,c),e=b.substr(c+1);if(/^[0\.-]+$/.test(a))a=BI._numberFormat(0,d)+"E"+BI._numberFormat(0,e);else{var f=a<0;f&&(a=a.substr(1));var g=(d.split(".")[0]||"").length,h=a.indexOf(".");h<0&&(h=a.length);var i=0;a=a.replace(".","");for(var j=a.length;i<j;i++){var k=a.charAt(i);if(k<="9"&&k>="1")break}var l=h-i-g,m=a.substr(i,g),n=i+g-a.length;if(n>0)for(var o=0;o<n;o++)m+="0";else m+="."+a.substr(i+g);m=m.replace(/^[0]+/,""),l<0&&e.indexOf("-")<0&&(e+=";-"+e),a=BI._numberFormat(m,d)+"E"+BI._numberFormat(l,e),f&&(a="-"+a)}return a}function _numberFormat(a,b){var a=a+"",c=b.indexOf(";");if(c>-1)return a>=0?_numberFormat(a+"",b.substring(0,c)):_numberFormat(-a+"",b.substr(c+1));if(+a<0&&"-"!==b.charAt(0))return _numberFormat(-a+"","-"+b);var d=a.split("."),e=b.split("."),f=d[0]||"",g=e[0]||"",h=d[1]||"",i=e[1]||"";if(/[%‰]$/.test(b)){var j=/[%]$/.test(b)?"00":"000";h+=j,f+=h.substr(0,j.length),f=f.replace(/^0+/gi,""),h=h.substr(j.length).replace(/0+$/gi,"")}var k=_dealWithRight(h,i);k.leftPlus&&(f=parseInt(f)+1+"",f=isNaN(f)?"1":f),k=k.num;var l=_dealWithLeft(f,g);return/[0-9]/.test(l)||(l+="0"),/[0-9]/.test(k)?l+"."+k:l+k}function _dealWithRight(a,b){for(var c="",d=0,e=0,f=b.length;e<f;e++){var g=b.charAt(e),h=a.charAt(d);switch(g){case"0":isEmpty(h)&&(h="0"),c+=h,d++;break;case"#":c+=h,d++;break;default:c+=g}}var i=a.substr(d),j={};if(!isEmpty(i)&&i.charAt(0)>4){j.leftPlus=!0;var k=c.match(/^[0-9]+/);if(k){var l=k[0],m=l.length,n=parseInt(l)+1+"";n.length>m?n=n.substr(1):(n=String.leftPad(n,m,"0"),j.leftPlus=!1),c=c.replace(/^[0-9]+/,n)}}return j.num=c,j}function _dealWithLeft(a,b){for(var c="",d=a.length-1,e=-1,f=-1,g=b.length-1;g>=0;g--){var h=b.charAt(g),i=a.charAt(d);switch(h){case"0":isEmpty(i)&&(i="0"),f=-1,c=i+c,d--;break;case"#":f=g,c=i+c,d--;break;case",":if(!isEmpty(i)){var j=b.match(/,[#0]+/);j&&(e=j[0].length-1),c=","+c}break;default:c=h+c}}if(f>-1){var k=a.substr(0,d+1);c=c.substr(0,f)+k+c.substr(f)}if(e>0){var l=c.match(/[0-9]+,/);if(l){l=l[0];for(var m="",n=l.length-1-e;n>=0;n-=e)m=l.substr(n,e)+","+m;var o=l.substr(0,n+e);isEmpty(o)||(m=o+","+m)}c=c.replace(/[0-9]+,/,m)}return c}window.BI||(window.BI={}),BI.cjkEncode=function(a){if("string"!=typeof a)return a;for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);b+=d>=128||91===d||93===d?"["+d.toString(16)+"]":a.charAt(c)}return b},BI.cjkDecode=function(text){if(null==text)return"";if(!isNaN(text)||text.indexOf("[")==-1)return text;for(var newText="",i=0;i<text.length;i++){var ch=text.charAt(i);if("["==ch){var rightIdx=text.indexOf("]",i+1);if(rightIdx>i+1){var subText=text.substring(i+1,rightIdx);subText.length>0&&(ch=String.fromCharCode(eval("0x"+subText))),i=rightIdx}}newText+=ch}return newText},BI.htmlEncode=function(a){return null==a?"":String(a).replace(/&/g,"&amp;").replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},BI.htmlDecode=function(a){return null==a?"":String(a).replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ")},BI.cjkEncodeDO=function(a){if(BI.isPlainObject(a)){var b={};return $.each(a,function(a,c){"string"!=typeof c&&(c=BI.jsonEncode(c)),a=BI.cjkEncode(a),b[a]=BI.cjkEncode(c)}),b}return a},BI.jsonEncode=function(a){var b=!!{}.hasOwnProperty,c={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},d=function(a){return/["\\\x00-\x1f]/.test(a)?'"'+a.replace(/([\x00-\x1f\\"])/g,function(a,b){var d=c[b];return d?d:(d=b.charCodeAt(),"\\u00"+Math.floor(d/16).toString(16)+(d%16).toString(16))})+'"':'"'+a+'"'},e=function(a){var b,c,d,e=["["],f=a.length;for(c=0;c<f;c+=1)switch(d=a[c],typeof d){case"undefined":case"function":case"unknown":break;default:b&&e.push(","),e.push(null===d?"null":BI.jsonEncode(d)),b=!0}return e.push("]"),e.join("")};if("undefined"==typeof a||null===a)return"null";if(BI.isArray(a))return e(a);if(a instanceof Date)return BI.jsonEncode({__time__:a.getTime()});if("string"==typeof a)return d(a);if("number"==typeof a)return isFinite(a)?String(a):"null";if("boolean"==typeof a)return String(a);if(BI.isFunction(a))return String(a);var f,g,h,i=["{"];for(g in a)if(!b||a.hasOwnProperty(g))switch(h=a[g],typeof h){case"undefined":case"unknown":break;default:f&&i.push(","),i.push(BI.jsonEncode(g),":",null===h?"null":BI.jsonEncode(h)),f=!0}return i.push("}"),i.join("")},BI.jsonDecode=function(a){function b(a){return!(!a||"string"!=typeof a)&&a.indexOf("__time__")!=-1}try{var c=$.parseJSON(a);null==c&&(c={})}catch(d){try{c=new Function("return "+a)()||{}}catch(d){}null==c&&(c=[])}return b(a)?function(a){if("string"==typeof a)return a;if(a&&null!=a.__time__)return new Date(a.__time__);for(var b in a){if(a[b]==a||"object"==typeof a[b]||$.isFunction(a[b]))break;a[b]=arguments.callee(a[b])}return a}(c):c},BI.contentFormat=function(a,b){if(isEmpty(a))return"";var c=a.toString();if(isEmpty(b))return c;if(b.match(/^T/))return c;if(b.match(/^D/)){if(a instanceof Date||(a="number"==typeof a?new Date(a):Date.parseDate(a+"",Date.patterns.ISO8601Long)),!BI.isNull(a)){var d=b.match(/^DT/);c=BI.date2Str(a,b.substring(d?2:1))}}else c=b.match(/E/)?_eFormat(c,b):_numberFormat(c,b);return c=c.replace(/¤/g,"¥")},BI.date2Str=function(a,b){function c(a,b){var c=a.str,d=a.len,e=a["char"];switch(e){case"E":c=Date._DN[b.getDay()];break;case"y":c=d<=3?(b.getFullYear()+"").slice(2,4):b.getFullYear();break;case"M":c=d>2?Date._MN[b.getMonth()]:d<2?b.getMonth()+1:String.leftPad(b.getMonth()+1+"",2,"0");break;case"d":c=d>1?String.leftPad(b.getDate()+"",2,"0"):b.getDate();break;case"h":var f=b.getHours()%12;0===f&&(f=12),c=d>1?String.leftPad(f+"",2,"0"):f;break;case"H":c=d>1?String.leftPad(b.getHours()+"",2,"0"):b.getHours();break;case"m":c=d>1?String.leftPad(b.getMinutes()+"",2,"0"):b.getMinutes();break;case"s":c=d>1?String.leftPad(b.getSeconds()+"",2,"0"):b.getSeconds();break;case"a":c=b.getHours()<12?"am":"pm";break;case"z":c=b.getTimezone();break;default:c=a.str}return c}if(!a)return"";var d=b.length,e="";if(d>0){for(var f=b.charAt(0),g=0,h=f,i=1;i<d;i++){var j=b.charAt(i);f!==j?(e+=c({"char":f,str:h,len:i-g},a),f=j,g=i,h=f):h+=j}e+=c({"char":f,str:h,len:d-g},a)}return e},BI.object2Number=function(a){if(null==a)return 0;if("number"==typeof a)return a;var b=a+"";return b.indexOf(".")===-1?parseInt(b):parseFloat(b)},BI.object2Date=function(a){if(null==a)return new Date;if(a instanceof Date)return a;if("number"==typeof a)return new Date(a);var b=a+"";b=b.replace(/-/g,"/");var c=new Date(b);return isInvalidDate(c)?new Date:c},BI.object2Time=function(a){if(null==a)return new Date;if(a instanceof Date)return a;var b=a+"";b=b.replace(/-/g,"/");var c=new Date(b);return isInvalidDate(c)&&(b.indexOf("/")!==-1||b.indexOf(":")===-1||(c=new Date("1970/01/01 "+b),isInvalidDate(c)))?(c=BI.str2Date(b,"HH:mm:ss"),isInvalidDate(c)?new Date:c):c}}(),BI.HighlightBehavior=BI.inherit(BI.Behavior,{_defaultConfig:function(){return BI.extend(BI.HighlightBehavior.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.HighlightBehavior.superclass._init.apply(this,arguments)},doBehavior:function(a){var b=Array.prototype.slice.call(arguments,1),c=this.options;BI.each(a,function(a,d){function e(a){a===!0?d.doHighLight.apply(d,b):d.unHighLight.apply(d,b)}if(d instanceof BI.Single){var f=c.rule(d.getValue(),d);BI.isFunction(f)?f(e):e(f)}else d.doBehavior.apply(d,b)})}}),BI.RedMarkBehavior=BI.inherit(BI.Behavior,{_defaultConfig:function(){return BI.extend(BI.RedMarkBehavior.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.RedMarkBehavior.superclass._init.apply(this,arguments)},doBehavior:function(a){var b=Array.prototype.slice.call(arguments,1),c=this.options;BI.each(a,function(a,d){d instanceof BI.Single?c.rule(d.getValue(),d)?d.doRedMark.apply(d,b):d.unRedMark.apply(d,b):d.doBehavior.apply(d,b)})}}),BI.Controller=BI.inherit(BI.OB,{_defaultConfig:function(){return BI.extend(BI.Controller.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.Controller.superclass._init.apply(this,arguments)},destroy:function(){}}),BI.Controller.EVENT_CHANGE="__EVENT_CHANGE__",BI.BroadcastController=BI.inherit(BI.Controller,{_defaultConfig:function(){return BI.extend(BI.BroadcastController.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.BroadcastController.superclass._init.apply(this,arguments),this._broadcasts={}},on:function(a,b){var c=this;return this._broadcasts[a]||(this._broadcasts[a]=[]),this._broadcasts[a].push(b),function(){c.remove(a,b)}},send:function(a){var b=[].slice.call(arguments,1);BI.each(this._broadcasts[a],function(a,c){c.apply(null,b)})},remove:function(a,b){return b?(this._broadcasts[a].remove(b),0===this._broadcasts[a].length&&delete this._broadcasts[a]):delete this._broadcasts[a],this}}),BI.BubblesController=BI.inherit(BI.Controller,{_defaultConfig:function(){return BI.extend(BI.BubblesController.superclass._defaultConfig.apply(this,arguments),{})},_const:{bubbleHeight:35},_init:function(){BI.BubblesController.superclass._init.apply(this,arguments),this.bubblesManager={},this.storeBubbles={}},_createBubble:function(a,b,c){return BI.createWidget({type:"bi.bubble",text:b,height:c||35,direction:a})},_getOffsetLeft:function(a,b,c){var d=0;return"center"===c?(d=b.element.offset().left+(b.element.bounds().width-this.get(a).element.bounds().width)/2,d<0&&(d=0),d):"right"===c?(d=b.element.offset().left+b.element.bounds().width-this.get(a).element.bounds().width,d<0&&(d=0),d):b.element.offset().left},_getOffsetTop:function(a,b,c){var d=0;return"center"===c?(d=b.element.offset().top+(b.element.bounds().height-this.get(a).element.bounds().height)/2,d<0&&(d=0),d):"right"===c?(d=b.element.offset().top+b.element.bounds().height-this.get(a).element.bounds().height,d<0&&(d=0),d):b.element.offset().top},_getLeftPosition:function(a,b,c){var d=$.getLeftPosition(b,this.get(a));return d.top=this._getOffsetTop(a,b,c),d},_getBottomPosition:function(a,b,c){var d=$.getBottomPosition(b,this.get(a));return d.left=this._getOffsetLeft(a,b,c),d},_getTopPosition:function(a,b,c){var d=$.getTopPosition(b,this.get(a));return d.left=this._getOffsetLeft(a,b,c),d},_getRightPosition:function(a,b,c){var d=$.getRightPosition(b,this.get(a));return d.top=this._getOffsetTop(a,b,c),d},show:function(a,b,c,d){d||(d={});var e=d.container||c,f=d.offsetStyle||{};this.storeBubbles[a]||(this.storeBubbles[a]={}),this.storeBubbles[a].top||(this.storeBubbles[a].top=this._createBubble("top",b)),BI.createWidget({type:"bi.absolute",element:e,items:[{el:this.storeBubbles[a].top}]}),this.set(a,this.storeBubbles[a].top);var g=this._getTopPosition(a,c,f);if(this.get(a).element.css({left:g.left,top:g.top}),this.get(a).invisible(),!$.isTopSpaceEnough(c,this.get(a))){this.storeBubbles[a].left||(this.storeBubbles[a].left=this._createBubble("left",b,30)),BI.createWidget({type:"bi.absolute",element:e,items:[{el:this.storeBubbles[a].left}]}),this.set(a,this.storeBubbles[a].left);var g=this._getLeftPosition(a,c,f);if(this.get(a).element.css({left:g.left,top:g.top}),this.get(a).invisible(),!$.isLeftSpaceEnough(c,this.get(a))){this.storeBubbles[a].right||(this.storeBubbles[a].right=this._createBubble("right",b,30)),BI.createWidget({type:"bi.absolute",element:e,items:[{el:this.storeBubbles[a].right}]}),this.set(a,this.storeBubbles[a].right);var g=this._getRightPosition(a,c,f);if(this.get(a).element.css({left:g.left,top:g.top}),this.get(a).invisible(),!$.isRightSpaceEnough(c,this.get(a))){this.storeBubbles[a].bottom||(this.storeBubbles[a].bottom=this._createBubble("bottom",b)),BI.createWidget({type:"bi.absolute",element:e,items:[{el:this.storeBubbles[a].bottom}]}),this.set(a,this.storeBubbles[a].bottom);var g=this._getBottomPosition(a,c,f);this.get(a).element.css({left:g.left,top:g.top}),this.get(a).invisible()}}}return this.get(a).setText(b),this.get(a).visible(),this},hide:function(a){return this.has(a)?(this.get(a).invisible(),this):this},add:function(a,b){return this.has(a)?this:(this.set(a,b),this)},get:function(a){return this.bubblesManager[a]},set:function(a,b){this.bubblesManager[a]=b},has:function(a){return null!=this.bubblesManager[a]},remove:function(a){return this.has(a)?(BI.each(this.storeBubbles[a],function(a,b){b.destroy()}),delete this.storeBubbles[a],delete this.bubblesManager[a],this):this}}),BI.FloatBoxController=BI.inherit(BI.Controller,{_defaultConfig:function(){return BI.extend(BI.FloatBoxController.superclass._defaultConfig.apply(this,arguments),{modal:!0,render:"body"})},_init:function(){BI.FloatBoxController.superclass._init.apply(this,arguments),this.modal=this.options.modal,this.floatManager={},this.floatLayer={},this.floatContainer={},this.floatOpened={},this.zindex=BI.zIndex_floatbox,this.zindexMap={}},_check:function(a){return BI.isNotNull(this.floatManager[a])},create:function(a,b,c){if(this._check(a))return this;var d=BI.createWidget({type:"bi.float_box"},c);return d.populate(b),this.add(a,d,c),this},add:function(a,b,c){var d=this;return c||(c={}),this._check(a)?this:(this.floatContainer[a]=BI.createWidget({type:"bi.absolute",cls:"bi-popup-view",items:[{el:this.floatLayer[a]=BI.createWidget({type:"bi.absolute",items:[b]}),left:0,right:0,top:0,bottom:0}]}),this.floatManager[a]=b,function(a){b.on(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED,function(){d.close(a)})}(a),BI.createWidget({type:"bi.absolute",element:c.container||this.options.render,items:[{el:this.floatContainer[a],left:0,right:0,top:0,bottom:0}]}),this)},open:function(a){if(!this._check(a))return this;if(!this.floatOpened[a]){this.floatOpened[a]=!0;var b=this.floatContainer[a];b.element.css("zIndex",this.zindex++),this.modal&&b.element.__hasZIndexMask__(this.zindexMap[a])&&b.element.__releaseZIndexMask__(this.zindexMap[a]),this.zindexMap[a]=this.zindex,this.modal&&b.element.__buildZIndexMask__(this.zindex++),this.get(a).setZindex(this.zindex++),this.floatContainer[a].visible();var c=this.get(a);c.show();var d=$(this.options.render).width(),e=$(this.options.render).height(),f=c.element.width(),g=c.element.height(),h=(d-f)/2,i=(e-g)/2;h<0&&(h=0),i<0&&(i=0),c.element.css({left:h+"px",top:i+"px"})}return this},close:function(a){return this._check(a)?(this.floatOpened[a]&&(delete this.floatOpened[a],this.floatContainer[a].invisible(),this.modal&&this.floatContainer[a].element.__releaseZIndexMask__(this.zindexMap[a])),this):this},get:function(a){return this.floatManager[a]},remove:function(a){return this._check(a)?(this.floatContainer[a].destroy(),this.modal&&this.floatContainer[a].element.__releaseZIndexMask__(this.zindexMap[a]),delete this.floatManager[a],delete this.floatLayer[a],delete this.zindexMap[a],delete this.floatContainer[a],delete this.floatOpened[a],this):this}}),BI.LayerController=BI.inherit(BI.Controller,{_defaultConfig:function(){return BI.extend(BI.LayerController.superclass._defaultConfig.apply(this,arguments),{render:"body"})},_init:function(){BI.LayerController.superclass._init.apply(this,arguments),this.layerManager={},this.layouts={},this.zindex=BI.zIndex_layer,BI.Resizers.add("layerController"+BI.uniqueId(),BI.bind(this._resize,this))},_resize:function(){BI.each(this.layouts,function(a,b){b.element.is(":visible")&&b.element.trigger("__resize__")})},make:function(a,b,c){if(this.has(a))return this.get(a);c||(c={});var d=BI.createWidget(c.render||{},{type:"bi.layout"});return BI.createWidget({type:"bi.absolute",element:b||this.options.render,items:[BI.extend({el:d},{top:0,left:0,right:0,bottom:0},c.offset)]}),this.add(a,d,d),d},create:function(a,b,c){if(this.has(a))return this.get(a);c||(c={});var d=c.offset||{},e=b;if(BI.isWidget(b)&&(e=b.element),BI.isNotEmptyString(e)&&(e=$(e)),this.has(a))return this.get(a);var f=BI.createWidget(c.render||{},{type:"bi.layout",cls:c.cls}),g=BI.createWidget({type:"bi.absolute",items:[{el:f,left:0,right:0,top:0,bottom:0}]});return BI.createWidget({type:"bi.absolute",element:c.container||this.options.render,items:[{el:g,left:d.left||0,right:d.right||0,top:d.top||0,bottom:d.bottom||0}]}),e&&(g.element.addClass("bi-popup-view"),g.element.css({left:e.offset().left+(d.left||0),top:e.offset().top+(d.top||0),width:d.width||e.outerWidth()-(d.right||0)||"",height:d.height||e.outerHeight()-(d.bottom||0)||""}),g.element.on("__resize__",function(){e.is(":visible")&&g.element.css({left:e.offset().left+(d.left||0),top:e.offset().top+(d.top||0),width:d.width||e.outerWidth()-(d.right||0)||"",height:d.height||e.outerHeight()-(d.bottom||0)||""})})),this.add(a,f,g),f},hide:function(a,b){return this.has(a)?(this._getLayout(a).invisible(),this._getLayout(a).element.hide(0,b),this):this},show:function(a,b){return this.has(a)?(this._getLayout(a).visible(),this._getLayout(a).element.css("z-index",this.zindex++).show(0,b).trigger("__resize__"),this):this},isVisible:function(a){return this.has(a)&&this._getLayout(a).isVisible()},add:function(a,b,c){if(this.has(a))throw new Error("name is already exist");return c.setVisible(!1),this.layerManager[a]=b,this.layouts[a]=c,c.element.css("z-index",this.zindex++),this},_getLayout:function(a){return this.layouts[a]},get:function(a){return this.layerManager[a]},has:function(a){return null!=this.layerManager[a]},remove:function(a){return this.has(a)?(this.layerManager[a].destroy(),this.layouts[a].destroy(),delete this.layerManager[a],delete this.layouts[a],this):this}}),BI.MaskersController=BI.inherit(BI.LayerController,{_defaultConfig:function(){return BI.extend(BI.MaskersController.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.MaskersController.superclass._init.apply(this,arguments),this.zindex=BI.zIndex_masker}}),BI.ResizeController=BI.inherit(BI.Controller,{_defaultConfig:function(){return BI.extend(BI.ResizeController.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.ResizeController.superclass._init.apply(this,arguments);var a=this;this.resizerManger={};var b=BI.debounce(function(b){a._resize(b)},30);$(window).resize(b)},_resize:function(a){BI.each(this.resizerManger,function(b,c){return c instanceof $?void(c.is(":visible")&&c.trigger("__resize__")):c instanceof BI.Layout?void c.resize():BI.isFunction(c)?void c(a):void 0})},add:function(a,b){var c=this;return this.has(a)?this:(this.resizerManger[a]=b,function(){c.remove(a)})},get:function(a){return this.resizerManger[a]},has:function(a){return null!=this.resizerManger[a]},remove:function(a){return this.has(a)?(delete this.resizerManger[a],this):this}}),BI.TooltipsController=BI.inherit(BI.Controller,{_defaultConfig:function(){return BI.extend(BI.TooltipsController.superclass._defaultConfig.apply(this,arguments),{})},_const:{height:20},_init:function(){BI.TooltipsController.superclass._init.apply(this,arguments),this.tooltipsManager={},this.showingTips={}},_createTooltip:function(a,b){return BI.createWidget({type:"bi.tooltip",text:a,level:b,stopEvent:!0,height:this._const.height})},hide:function(a,b){return this.has(a)?(delete this.showingTips[a],this.get(a).element.hide(0,b),this.get(a).invisible(),this):this},create:function(a,b,c,d){if(!this.has(a)){var e=this._createTooltip(b,c);this.add(a,e),BI.createWidget({type:"bi.absolute",element:d||"body",items:[{el:e}]}),e.invisible()}return this.get(a)},show:function(a,b,c,d,e,f){f||(f={});var g=this;if(BI.each(this.showingTips,function(a,b){
g.hide(a)}),this.showingTips={},this.has(b)||this.create(b,c,d,f.container||e),!f.belowMouse){var h=e.element.offset(),i=e.element.bounds();if(0===i.height||0===i.width)return;var j=h.top+i.height+5}var k=this.get(b);k.setText(c),k.element.css({left:"0px",top:"0px"}),k.visible(),k.element.height(k.element[0].scrollHeight),this.showingTips[b]=!0;var l=(a.pageX||a.clientX)+15,m=(a.pageY||a.clientY)+15;return l+k.element.outerWidth()>$("body").outerWidth()&&(l-=k.element.outerWidth()+15),m+k.element.outerHeight()>$("body").outerHeight()?(m-=k.element.outerHeight()+15,!f.belowMouse&&(m=Math.min(m,h.top-k.element.outerHeight()-5))):!f.belowMouse&&(m=Math.max(m,j)),k.element.css({left:l<0?0:l+"px",top:m<0?0:m+"px"}),k.element.hover(function(){g.remove(b),e.element.trigger("mouseleave.title"+e.getName())}),this},add:function(a,b){return this.has(a)?this:(this.set(a,b),this)},get:function(a){return this.tooltipsManager[a]},set:function(a,b){this.tooltipsManager[a]=b},has:function(a){return null!=this.tooltipsManager[a]},remove:function(a){return this.has(a)?(this.tooltipsManager[a].destroy(),delete this.tooltipsManager[a],this):this}}),_.extend(BI,{Events:{KEYDOWN:"_KEYDOWN",BACKSPACE:"_BACKSPACE",SPACE:"_SPACE",ENTER:"_ENTER",CONFIRM:"_CONFIRM",ERROR:"_ERROR",PAUSE:"_PAUSE",DESTROY:"_DESTROY",UNMOUNT:"_UNMOUNT",CLEAR:"_CLEAR",ADD:"_ADD",EDITING:"_EDITING",EMPTY:"_EMPTY",VIEW:"_VIEW",RESIZE:"_RESIZE",BEFOREEDIT:"_BEFOREEDIT",AFTEREDIT:"_AFTEREDIT",STARTEDIT:"_STARTEDIT",STOPEDIT:"_STOPEDIT",CHANGE:"_CHANGE",EXPAND:"_EXPAND",COLLAPSE:"_COLLAPSE",CALLBACK:"_CALLBACK",CLICK:"_CLICK",STATECHANGE:"_STATECHANGE",BEFORESTATECHANGE:"_BEFORESTATECHANGE",INIT:"_INIT",AFTERINIT:"_AFTERINIT",SCROLL:"_SCROLL",STARTLOAD:"_STARTLOAD",AFTERLOAD:"_AFTERLOAD",BS:"beforesubmit",AS:"aftersubmit",SC:"submitcomplete",SF:"submitfailure",SS:"submitsuccess",BVW:"beforeverifywrite",AVW:"afterverifywrite",AV:"afterverify",BW:"beforewrite",AW:"afterwrite",WS:"writesuccess",WF:"writefailure",BA:"beforeappend",AA:"afterappend",BD:"beforedelete",AD:"beforedelete",UC:"unloadcheck",BTOPDF:"beforetopdf",ATOPDF:"aftertopdf",BTOEXCEL:"beforetoexcel",ATOEXCEL:"aftertoexcel",BTOWORD:"beforetoword",ATOWORD:"aftertoword",BTOIMAGE:"beforetoimage",ATOIMAGE:"aftertoimage",BTOHTML:"beforetohtml",ATOHTML:"aftertohtml",BIMEXCEL:"beforeimportexcel",AIMEXCEL:"afterimportexcel",BPDFPRINT:"beforepdfprint",APDFPRINT:"afterpdfprint",BFLASHPRINT:"beforeflashprint",AFLASHPRINT:"afterflashprint",BAPPLETPRINT:"beforeappletprint",AAPPLETPRINT:"afterappletprint",BSEVERPRINT:"beforeserverprint",ASERVERPRINT:"afterserverprint",BEMAIL:"beforeemail",AEMAIL:"afteremail"}}),BI.extend(jQuery.fn,{destroy:function(){this.remove(),BI.isIE()===!0&&(this[0].outerHTML="")},__textKeywordMarked__:function(a,b,c){if(!BI.isKey(b)||(a+"").length>100)return this.html(BI.htmlEncode(a));b+="",b=BI.toUpperCase(b);var d=(a||"")+"";for(c=(c||BI.makeFirstPY(a))+"",null!=c&&(c=BI.toUpperCase(c)),this.empty();;){var e=BI.toUpperCase(d).indexOf(b),f=null;if(null!=c&&(f=c.indexOf(b),f>=0&&(f%=a.length)),e>=0)this.append(d.substr(0,e)),this.append($("<span>").addClass("bi-keyword-red-mark").html(BI.htmlEncode(d.substr(e,b.length)))),d=d.substr(e+b.length),null!=c&&(c=c.substr(e+b.length));else{if(!(null!=f&&f>=0&&Math.floor(f/a.length)===Math.floor((f+b.length-1)/a.length))){this.append(d);break}this.append(d.substr(0,f)),this.append($("<span>").addClass("bi-keyword-red-mark").html(BI.htmlEncode(d.substr(f,b.length)))),null!=c&&(c=c.substr(f+b.length)),d=d.substr(f+b.length)}}return this},getDomHeight:function(a){var b=$(this).clone();b.appendTo($(a||"body"));var c=b.height();return b.remove(),c},hasVerticalScroll:function(){return this.height()>0&&this[0].clientWidth<this[0].offsetWidth},hasHorizonScroll:function(){return this.width()>0&&this[0].clientHeight<this[0].offsetHeight},getStyle:function(a){var b=this[0],c=void 0;if(window.getComputedStyle&&(c=window.getComputedStyle(b,null)))return c.getPropertyValue(BI.hyphenate(a));if(document.defaultView&&document.defaultView.getComputedStyle){if(c=document.defaultView.getComputedStyle(b,null))return c.getPropertyValue(BI.hyphenate(a));if("display"===a)return"none"}return b.currentStyle?"float"===a?b.currentStyle.cssFloat||b.currentStyle.styleFloat:b.currentStyle[BI.camelize(a)]:b.style&&b.style[BI.camelize(a)]},__isMouseInBounds__:function(a){var b=this.offset();return!(a.pageX<b.left||a.pageX>b.left+this.outerWidth()||a.pageY<b.top||a.pageY>b.top+this.outerHeight())},__hasZIndexMask__:function(a){return a&&null!=this.zIndexMask[a]},__buildZIndexMask__:function(a,b){this.zIndexMask=this.zIndexMask||{},this.indexMask=this.indexMask||[];var c=BI.createWidget({type:"bi.center_adapt",cls:"bi-z-index-mask",items:b});return c.element.css({"z-index":a}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:c,left:0,right:0,top:0,bottom:0}]}),this.indexMask.push(c),a&&(this.zIndexMask[a]=c),c.element},__releaseZIndexMask__:function(a){if(a&&this.zIndexMask[a])return this.indexMask.remove(this.zIndexMask[a]),void this.zIndexMask[a].destroy();this.indexMask=this.indexMask||[];var b=this.indexMask.pop();b&&b.destroy()}}),BI.extend(jQuery,{getLeftPosition:function(a,b,c){return{left:a.element.offset().left-b.element.outerWidth()-(c||0)}},getRightPosition:function(a,b,c){var d=a.element;return{left:d.offset().left+d.outerWidth()+(c||0)}},getTopPosition:function(a,b,c){return{top:a.element.offset().top-b.element.outerHeight()-(c||0)}},getBottomPosition:function(a,b,c){var d=a.element;return{top:d.offset().top+d.outerHeight()+(c||0)}},isLeftSpaceEnough:function(a,b,c){return $.getLeftPosition(a,b,c).left>=0},isRightSpaceEnough:function(a,b,c){var d=b.element.bounds(),e=$("body").bounds();return $.getRightPosition(a,b,c).left+d.width<=e.width},isTopSpaceEnough:function(a,b,c){return $.getTopPosition(a,b,c).top>=0},isBottomSpaceEnough:function(a,b,c){var d=b.element.bounds(),e=$("body").bounds();return $.getBottomPosition(a,b,c).top+d.height<=e.height},isRightSpaceLarger:function(a){var b=$("body").bounds();return b.width-a.element.offset().left-a.element.bounds().width>=a.element.offset().left},isBottomSpaceLarger:function(a){var b=$("body").bounds();return b.height-a.element.offset().top-a.element.bounds().height>=a.element.offset().top},getLeftAlignPosition:function(a,b,c){var d=b.element.bounds(),e=$("body").bounds(),f=a.element.offset().left+c;return f+d.width>e.width&&(f=e.width-d.width),f<0&&(f=0),{left:f}},getLeftAdaptPosition:function(a,b,c){return $.isLeftSpaceEnough(a,b,c)?$.getLeftPosition(a,b,c):{left:0}},getRightAlignPosition:function(a,b,c){var d=a.element.bounds(),e=b.element.bounds(),f=a.element.offset().left+d.width-e.width-c;return f<0&&(f=0),{left:f}},getRightAdaptPosition:function(a,b,c){return $.isRightSpaceEnough(a,b,c)?$.getRightPosition(a,b,c):{left:$("body").bounds().width-b.element.bounds().width}},getTopAlignPosition:function(a,b,c,d){var e,f,g=a.element.offset(),h=a.element.bounds(),i=b.element.bounds(),j=$("body").bounds();return $.isBottomSpaceEnough(a,b,-1*h.height+c)?e=g.top+c:d?(e=g.top+c,f=j.height-e):(e=j.height-i.height,e<c&&(f=j.height-c)),e<c&&(e=c),f?{top:e,adaptHeight:f}:{top:e}},getTopAdaptPosition:function(a,b,c,d){var e=b.element.bounds(),f=$("body").bounds();return $.isTopSpaceEnough(a,b,c)?$.getTopPosition(a,b,c):d?{top:0,adaptHeight:a.element.offset().top-c}:e.height+c>f.height?{top:0,adaptHeight:f.height-c}:{top:0}},getBottomAlignPosition:function(a,b,c,d){var e,f,g=a.element.offset(),h=a.element.bounds(),i=b.element.bounds(),j=$("body").bounds();return $.isTopSpaceEnough(a,b,-1*h.height+c)?e=g.top+h.height-i.height-c:d?(e=0,f=g.top+h.height-c):(e=0,i.height+c>j.height&&(f=j.height-c)),e<0&&(e=0),f?{top:e,adaptHeight:f}:{top:e}},getBottomAdaptPosition:function(a,b,c,d){var e=a.element.offset(),f=a.element.bounds(),g=b.element.bounds(),h=$("body").bounds();return $.isBottomSpaceEnough(a,b,c)?$.getBottomPosition(a,b,c):d?{top:e.top+f.height+c,adaptHeight:h.height-e.top-f.height-c}:g.height+c>h.height?{top:c,adaptHeight:h.height-c}:{top:h.height-g.height-c}},getCenterAdaptPosition:function(a,b){var c,d=a.element.offset(),e=a.element.bounds(),f=b.element.bounds(),g=$("body").bounds();return c=d.left+e.width/2+f.width/2>g.width?g.width-f.width:d.left+e.width/2-f.width/2,c<0&&(c=0),{left:c}},getMiddleAdaptPosition:function(a,b){var c,d=a.element.offset(),e=a.element.bounds(),f=b.element.bounds(),g=$("body").bounds();return c=d.top+e.height/2+f.height/2>g.height?g.height-f.height:d.top+e.height/2-f.height/2,c<0&&(c=0),{top:c}},getComboPositionByDirections:function(a,b,c,d,e,f){c||(c=0),d||(d=0);var g,h,i,j,k,l=[],m=[],n=!1,o=!1,p=!1;for(g=0;g<f.length;g++)switch(h=f[g]){case"left":l.push(h);break;case"right":l.push(h);break;case"top":m.push(h);break;case"bottom":m.push(h)}for(g=0;g<f.length;g++)switch(h=f[g]){case"left":if(!n){var q=o?d:c,r=o?0:d;if($.isLeftSpaceEnough(a,b,q))return i=$.getLeftPosition(a,b,q).left,"bottom"===m[0]?(k=$.getTopAlignPosition(a,b,r,e),k.dir="left,bottom"):(k=$.getBottomAlignPosition(a,b,r,e),k.dir="left,top"),o&&(k.change="left"),k.left=i,k}p=!0;break;case"right":if(!n){var q=o?d:c,r=o?c:d;if($.isRightSpaceEnough(a,b,q))return i=$.getRightPosition(a,b,q).left,"bottom"===m[0]?(k=$.getTopAlignPosition(a,b,r,e),k.dir="right,bottom"):(k=$.getBottomAlignPosition(a,b,r,e),k.dir="right,top"),o&&(k.change="right"),k.left=i,k}p=!0;break;case"top":var q=p?d:c,r=p?c:d;if($.isTopSpaceEnough(a,b,r))return j=$.getTopPosition(a,b,r).top,"right"===l[0]?(k=$.getLeftAlignPosition(a,b,q,e),k.dir="top,right"):(k=$.getRightAlignPosition(a,b,q),k.dir="top,left"),p&&(k.change="top"),k.top=j,k;e&&(n=!0),o=!0;break;case"bottom":var q=p?d:c,r=p?c:d;if($.isBottomSpaceEnough(a,b,r))return j=$.getBottomPosition(a,b,r).top,"right"===l[0]?(k=$.getLeftAlignPosition(a,b,q,e),k.dir="bottom,right"):(k=$.getRightAlignPosition(a,b,q),k.dir="bottom,left"),p&&(k.change="bottom"),k.top=j,k;e&&(n=!0),o=!0}switch(f[0]){case"left":case"right":return i=$.isRightSpaceLarger(a)?$.getRightAdaptPosition(a,b,c).left:$.getLeftAdaptPosition(a,b,c).left,"bottom"===m[0]?(k=$.getTopAlignPosition(a,b,d,e),k.left=i,k.dir=f[0]+",bottom",k):(k=$.getBottomAlignPosition(a,b,d,e),k.left=i,k.dir=f[0]+",top",k);default:return k=$.isBottomSpaceLarger(a)?$.getBottomAdaptPosition(a,b,d,e):$.getTopAdaptPosition(a,b,d,e),"right"===l[0]?(i=$.getLeftAlignPosition(a,b,c,e).left,k.left=i,k.dir=f[0]+",right",k):(i=$.getRightAlignPosition(a,b,c).left,k.left=i,k.dir=f[0]+",left",k)}},getComboPosition:function(a,b,c,d,e,f,g){c||(c=0),d||(d=0);var h=$("body").bounds().height-d,i=Math.min(b.attr("maxHeight")||h,h);b.resetHeight&&b.resetHeight(i);var j=$.getComboPositionByDirections(a,b,c,d,e,f||["bottom","top","right","left"]);switch(g){case"center":if(j.change){var k=$.getMiddleAdaptPosition(a,b);j.top=k.top}else{var k=$.getCenterAdaptPosition(a,b);j.left=k.left}break;case"middle":if(j.change){var k=$.getCenterAdaptPosition(a,b);j.left=k.left}else{var k=$.getMiddleAdaptPosition(a,b);j.top=k.top}}return e===!0&&b.resetHeight&&b.resetHeight(Math.min(h-j.top,i)),j}}),BI.Func={},BI.extend(BI.Func,{createDistinctName:function(a,b){var c=b,d=1;for(b=b||"";;){if(BI.every(a,function(a,c){return c.name!==b}))break;b=c+d++}return b},getSearchResult:function(a,b,c){var d=BI.isArray(a);if(a=d?BI.flatten(a):a,c||(c="text"),!BI.isKey(b))return{finded:BI.deepClone(a),matched:d?[]:{}};var e,f,g;b=BI.toUpperCase(b);var h=d?[]:{},i=d?[]:{};return BI.each(a,function(a,j){j=BI.deepClone(j),e=BI.stripEL(j),f=e[c]||e.text||e.value||e.name||e,g=BI.makeFirstPY(f),f=BI.toUpperCase(f),g=BI.toUpperCase(g);var k;f.indexOf(b)>-1?f===b?d?h.push(j):h[a]=j:d?i.push(j):i[a]=j:(k=g.indexOf(b),k>-1&&Math.floor(k/f.length)===Math.floor((k+b.length-1)/f.length)&&(f===b||b.length===f.length?d?h.push(j):h[a]=j:d?i.push(j):i[a]=j))}),{matched:h,finded:i}}}),BI.DOM={},BI.extend(BI.DOM,{hang:function(a){if(!BI.isEmpty(a)){var b=document.createDocumentFragment();return BI.each(a,function(a,c){c instanceof BI.Widget&&(c=c.element),c instanceof $&&c[0]&&b.appendChild(c[0])}),b}},isExist:function(a){return $("body").find(a.element).length>0},preloadImages:function(a,b){function c(){d++,d>=a.length&&b()}var d=0,e=[];BI.each(a,function(a,b){e[a]=new Image,e[a].src=b,e[a].onload=function(){c()},e[a].onerror=function(){c()}})},isColor:function(a){return a&&(this.isRGBColor(a)||this.isHexColor(a))},isRGBColor:function(a){return!!a&&"rgb"===a.substr(0,3)},isHexColor:function(a){return!!a&&("#"===a[0]&&7===a.length)},isDarkColor:function(a){if(!a||!this.isHexColor(a))return!1;var b=this.rgb2json(this.hex2rgb(a)),c=Math.round(.299*b.r+.587*b.g+.114*b.b);return c<192},getContrastColor:function(a){return a&&this.isColor(a)?this.isDarkColor(a)?"#ffffff":"#1a1a1a":""},rgb2hex:function(a){if(!a||"rgb"!=a.substr(0,3))return"";var b=a.match(/\d+(\.\d+)?/g),c=BI.parseInt(b[0]),d=BI.parseInt(b[1]),e=BI.parseInt(b[2]),f="#"+this.int2hex(c)+this.int2hex(d)+this.int2hex(e);return f},rgb2json:function(a){if(!a)return{};if(!this.isRGBColor(a))return{};var b=a.match(/\d+(\.\d+)?/g);return{r:BI.parseInt(b[0]),g:BI.parseInt(b[1]),b:BI.parseInt(b[2])}},rgba2json:function(a){if(!a)return{};var b=a.match(/\d+(\.\d+)?/g);return{r:BI.parseInt(b[0]),g:BI.parseInt(b[1]),b:BI.parseInt(b[2]),a:BI.parseFloat(b[3])}},json2rgb:function(a){return BI.isKey(a.r)&&BI.isKey(a.g)&&BI.isKey(a.b)?"rgb("+a.r+","+a.g+","+a.b+")":""},json2rgba:function(a){return BI.isKey(a.r)&&BI.isKey(a.g)&&BI.isKey(a.b)?"rgba("+a.r+","+a.g+","+a.b+","+a.a+")":""},int2hex:function(a){var b=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];return b[a>>>4]+""+b[15&a]},hex2rgb:function(a){if(!a)return"";if(!this.isHexColor(a))return a;var b,c="rgb(";return 7===a.length?b=[BI.parseInt("0x"+a.substring(1,3)),BI.parseInt("0x"+a.substring(3,5)),BI.parseInt("0x"+a.substring(5,7))]:4===a.length&&(b=[BI.parseInt("0x"+a.substring(1,2)),BI.parseInt("0x"+a.substring(2,3)),BI.parseInt("0x"+a.substring(3,4))]),c+=b[0]+",",c+=b[1]+",",c+=b[2]+")"},rgba2rgb:function(a,b){if(BI.isNull(b)&&(b=1),"rgba"!=a.substr(0,4))return"";var c=a.match(/\d+(\.\d+)?/g);if(c.length<4)return"";var d=BI.parseFloat(c[0]),e=BI.parseFloat(c[1]),f=BI.parseFloat(c[2]),g=BI.parseFloat(c[3]);return"rgb("+Math.floor(255*(b*(1-g))+d*g)+","+Math.floor(255*(b*(1-g))+e*g)+","+Math.floor(255*(b*(1-g))+f*g)+")"},getTextSizeWidth:function(a,b){var c=$("<span></span>").addClass("text-width-span").appendTo($("body"));null==b&&(b=12),b+="px",c.css("font-size",b).text(a);var d=c.width();return c.remove(),d},getScrollWidth:function(){if(null==this._scrollWidth){var a=$("<div>").width(50).height(50).css({position:"absolute",top:"-9999px",overflow:"scroll"}).appendTo($("body"));this._scrollWidth=a[0].offsetWidth-a[0].clientWidth,a.destroy()}return this._scrollWidth}}),function(){var a={};BI.constant=function(b,c){if(null!=a[b])throw"constant:["+b+"] has been registed";a[b]=c};var b={};BI.model=function(a,c){if(null!=b[a])throw"model:["+a+"] has been registed";b[a]=c};var c={};BI.store=function(a,b){if(null!=c[a])throw"store:["+a+"] has been registed";c[a]=b};var d={};BI.service=function(a,b){if(null!=d[a])throw"service:["+a+"] has been registed";d[a]=b};var e={};BI.provider=function(a,b){if(null!=e[a])throw"provider:["+a+"] has been registed";e[a]=b},BI.config=function(b,c){return a[b]?a[b]=c(a[b]):e[b]?(i[b]||(i[b]=new e[b]),c(i[b])):void BI.Plugin.registerWidget(b,c)};var f={};BI.action=function(a,b){return f[a]||(f[a]=[]),f[a].push(b),function(){f[a].remove(b),0===f[a].length&&delete f[a]}},BI.Constants={getConstant:function(b){return a[b]}},BI.Models={getModel:function(a,c){return new b[a](c)}};var g={};BI.Stores={getStore:function(a,b){return g[a]?g[a]:g[a]=new c[a](b)},releaseStore:function(a){delete g[a]}};var h={};BI.Services={getService:function(a,b){return h[a]?h[a]:h[a]=new d[a](b)},releaseService:function(a){delete h[a]}};var i={},j={};BI.Providers={getProvider:function(a,b){return i[a]||(i[a]=new e[a]),j[a]||(j[a]=(new i[a].$get)(b)),j[a]},releaseProvider:function(a){delete i[a],delete j[a]}},BI.Actions={runAction:function(a,b){BI.each(f[a],function(a,c){c(b)})}}}(),BI.ShowListener=BI.inherit(BI.OB,{_defaultConfig:function(){return BI.extend(BI.ShowListener.superclass._defaultConfig.apply(this,arguments),{eventObj:BI.createWidget(),cardLayout:null,cardNameCreator:function(a){return a},cardCreator:BI.emptyFn,afterCardCreated:BI.emptyFn,afterCardShow:BI.emptyFn})},_init:function(){BI.ShowListener.superclass._init.apply(this,arguments);var a=this,b=this.options;b.eventObj.on(BI.Controller.EVENT_CHANGE,function(c,d,e){if(c===BI.Events.CLICK){if(d=d||b.eventObj.getValue(),d=BI.isArray(d)?d.length>1?d.toString():d[0]:d,BI.isNull(d))throw new Error("value cannot be null");var f=b.cardNameCreator(d);if(!b.cardLayout.isCardExisted(f)){var g=b.cardCreator(f);b.cardLayout.addCardByName(f,g),b.afterCardCreated(f)}b.cardLayout.showCardByName(f),BI.nextTick(function(){b.afterCardShow(f),a.fireEvent(BI.ShowListener.EVENT_CHANGE,f)})}})}}),BI.ShowListener.EVENT_CHANGE="ShowListener.EVENT_CHANGE",BI.StyleLoaderManager=BI.inherit(BI.OB,{_defaultConfig:function(){return BI.extend(BI.StyleLoaderManager.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.StyleLoaderManager.superclass._init.apply(this,arguments),this.stylesManager={}},loadStyle:function(a,b){var c=document,d=c.createElement("style");return c.getElementsByTagName("head")[0].appendChild(d),d.setAttribute("type","text/css"),d.styleSheet?d.styleSheet.cssText=b:d.appendChild(document.createTextNode(b)),this.stylesManager[a]=d,this},get:function(a){return this.stylesManager[a]},has:function(a){return null!=this.stylesManager[a]},removeStyle:function(a){return this.has(a)?(this.stylesManager[a].parentNode.removeChild(this.stylesManager[a]),delete this.stylesManager[a],this):this}}),BI.Logic=BI.inherit(BI.OB,{createLogic:function(){return this.options||{}}}),BI.LogicFactory={Type:{Vertical:"vertical",Horizontal:"horizontal",Table:"table",HorizontalFill:"horizontal_fill"},createLogic:function(a,b){var c;switch(a){case BI.LogicFactory.Type.Vertical:c=BI.VerticalLayoutLogic;break;case BI.LogicFactory.Type.Horizontal:c=BI.HorizontalLayoutLogic;break;case BI.LogicFactory.Type.Table:c=BI.TableLayoutLogic;break;case BI.LogicFactory.Type.HorizontalFill:c=BI.HorizontalFillLayoutLogic;break;default:c=BI.Logic}return new c(b).createLogic()},createLogicTypeByDirection:function(a){switch(a){case BI.Direction.Top:case BI.Direction.Bottom:case BI.Direction.Custom:return BI.LogicFactory.Type.Vertical;case BI.Direction.Left:case BI.Direction.Right:return BI.LogicFactory.Type.Horizontal}},createLogicItemsByDirection:function(a){var b,c=Array.prototype.slice.call(arguments,1);switch(c=BI.map(c,function(a,b){return BI.isWidget(b)?{el:b,width:b.options.width,height:b.options.height}:b}),a){case BI.Direction.Bottom:b=BI.LogicFactory.Type.Vertical,c.reverse();break;case BI.Direction.Right:b=BI.LogicFactory.Type.Horizontal,c.reverse();break;case BI.Direction.Custom:c=c.slice(1)}return c}},BI.VerticalLayoutLogic=BI.inherit(BI.Logic,{_defaultConfig:function(){return BI.extend(BI.VerticalLayoutLogic.superclass._defaultConfig.apply(this,arguments),{dynamic:!1,scrollable:null,scrolly:!1,scrollx:!1,items:[],hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},createLogic:function(){var a,b=this.options;return a=b.dynamic?"bi.vertical":"bi.vtape",{type:a,scrollable:b.scrollable,scrolly:b.scrolly,scrollx:b.scrollx,hgap:b.hgap,vgap:b.vgap,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,items:b.items}},_init:function(){BI.VerticalLayoutLogic.superclass._init.apply(this,arguments)}}),BI.HorizontalLayoutLogic=BI.inherit(BI.Logic,{_defaultConfig:function(){return BI.extend(BI.HorizontalLayoutLogic.superclass._defaultConfig.apply(this,arguments),{dynamic:!1,scrollable:null,scrolly:!1,scrollx:!1,items:[],hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},createLogic:function(){var a,b=this.options;return a=b.dynamic?"bi.vertical_adapt":"bi.htape",{type:a,scrollable:b.scrollable,scrolly:b.scrolly,scrollx:b.scrollx,hgap:b.hgap,vgap:b.vgap,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,items:b.items}},_init:function(){BI.HorizontalLayoutLogic.superclass._init.apply(this,arguments)}}),BI.TableLayoutLogic=BI.inherit(BI.Logic,{_defaultConfig:function(){return BI.extend(BI.TableLayoutLogic.superclass._defaultConfig.apply(this,arguments),{dynamic:!1,scrollable:null,scrolly:!1,scrollx:!1,columns:0,rows:0,columnSize:[],rowSize:[],hgap:0,vgap:0,items:[]})},createLogic:function(){var a,b=this.options;return a=b.dynamic?"bi.table":"bi.window",{type:a,scrollable:b.scrollable,scrolly:b.scrolly,scrollx:b.scrollx,columns:b.columns,rows:b.rows,columnSize:b.columnSize,rowSize:b.rowSize,hgap:b.hgap,vgap:b.vgap,items:b.items}},_init:function(){BI.TableLayoutLogic.superclass._init.apply(this,arguments)}}),BI.HorizontalFillLayoutLogic=BI.inherit(BI.Logic,{_defaultConfig:function(){return BI.extend(BI.HorizontalFillLayoutLogic.superclass._defaultConfig.apply(this,arguments),{dynamic:!1,scrollable:null,scrolly:!1,scrollx:!1,items:[],hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},createLogic:function(){var a,b=this.options,c=[];return BI.each(b.items,function(a,b){c.push(b.width||0)}),a=b.dynamic?"bi.horizontal_adapt":"bi.htape",{type:a,columnSize:c,scrollable:b.scrollable,scrolly:b.scrolly,scrollx:b.scrollx,hgap:b.hgap,vgap:b.vgap,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,items:b.items}},_init:function(){BI.HorizontalFillLayoutLogic.superclass._init.apply(this,arguments)}}),BI.Plugin=BI.Plugin||{},!function(){var a={},b={};BI.extend(BI.Plugin,{getWidget:function(b,c){if(a[b])for(var d,e=a[b].length-1;e>=0;e--)if(d=a[b][e](c))return d;return c},registerWidget:function(b,c){a[b]||(a[b]=[]),a[b].length>0&&console.log("组件已经注册过了!"),a[b].push(c)},relieveWidget:function(b){delete a[b]},getObject:function(a,c){if(b[a])for(var d,e=0,f=b[a].length;e<f;e++)d=b[a][e](c);return d||c},registerObject:function(a,c){b[a]||(b[a]=[]),b[a].length>0&&console.log("对象已经注册过了!"),b[a].push(c)},relieveObject:function(a){delete b[a]}})}(),$.extend(Array.prototype,{contains:function(a){return this.indexOf(a)>-1},remove:function(a){var b=this.indexOf(a);return b!==-1&&this.splice(b,1),this},pushArray:function(a){for(var b=0;b<a.length;b++)this.push(a[b])},pushDistinct:function(a){this.contains(a)||this.push(a)},pushDistinctArray:function(a){for(var b=0,c=a.length;b<c;b++)this.pushDistinct(a[b])}}),$(function(){Date._DN=[BI.i18nText("BI-Basic_Sunday"),BI.i18nText("BI-Basic_Monday"),BI.i18nText("BI-Basic_Tuesday"),BI.i18nText("BI-Basic_Wednesday"),BI.i18nText("BI-Basic_Thursday"),BI.i18nText("BI-Basic_Friday"),BI.i18nText("BI-Basic_Saturday"),BI.i18nText("BI-Basic_Sunday")],Date._SDN=[BI.i18nText("BI-Basic_Simple_Sunday"),BI.i18nText("BI-Basic_Simple_Monday"),BI.i18nText("BI-Basic_Simple_Tuesday"),BI.i18nText("BI-Basic_Simple_Wednesday"),BI.i18nText("BI-Basic_Simple_Thursday"),BI.i18nText("BI-Basic_Simple_Friday"),BI.i18nText("BI-Basic_Simple_Saturday"),BI.i18nText("BI-Basic_Simple_Sunday")],Date._FD=1,Date._MN=[BI.i18nText("BI-Basic_January"),BI.i18nText("BI-Basic_February"),BI.i18nText("BI-Basic_March"),BI.i18nText("BI-Basic_April"),BI.i18nText("BI-Basic_May"),BI.i18nText("BI-Basic_June"),BI.i18nText("BI-Basic_July"),BI.i18nText("BI-Basic_August"),BI.i18nText("BI-Basic_September"),BI.i18nText("BI-Basic_October"),BI.i18nText("BI-Basic_November"),BI.i18nText("BI-Basic_December")],Date._SMN=[0,1,2,3,4,5,6,7,8,9,10,11],Date._QN=["",BI.i18nText("BI-Quarter_1"),BI.i18nText("BI-Quarter_2"),BI.i18nText("BI-Quarter_3"),BI.i18nText("BI-Quarter_4")],Date._MD=[31,28,31,30,31,30,31,31,30,31,30,31]}),Date.SECOND=1e3,Date.MINUTE=60*Date.SECOND,Date.HOUR=60*Date.MINUTE,Date.DAY=24*Date.HOUR,Date.WEEK=7*Date.DAY,Date.prototype.getTimezone=function(){return this.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/,"$1$2").replace(/[^A-Z]/g,"")},Date.prototype.getMonthDays=function(a){var b=this.getFullYear();return"undefined"==typeof a&&(a=this.getMonth()),0!=b%4||0==b%100&&0!=b%400||1!=a?Date._MD[a]:29},Date.prototype.getLastDateOfMonth=function(){return Date.getDate(this.getFullYear(),this.getMonth(),this.getMonthDays())},Date.prototype.getDayOfYear=function(){var a=Date.getDate(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),b=Date.getDate(this.getFullYear(),0,0,0,0,0),c=a-b;return Math.floor(c/Date.DAY)},Date.prototype.getWeekNumber=function(){var a=Date.getDate(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),b=0===a.getDay()?7:a.getDay();if(0===this.getMonth()&&this.getDate()<=b)return 1;a.setDate(this.getDate()-(b-1));var c=a.valueOf();a.setMonth(0),a.setDate(1);var d=Math.floor((c-a.valueOf())/6048e5)+1;return 1!==a.getDay()&&d++,d},Date.prototype.getQuarter=function(){return Math.floor(this.getMonth()/3)+1},Date.prototype.getOffsetDate=function(a){return Date.getDate(Date.getTime(this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds())+864e5*a)},Date.prototype.getAfterMulQuarter=function(a){var b=Date.getDate(Date.getTime(this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds()));return b.setMonth(b.getMonth()+3*a),b},Date.prototype.getBeforeMulQuarter=function(a){var b=Date.getDate(Date.getTime(this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds()));return b.setMonth(b.getMonth()-3*a),b},Date.prototype.getQuarterStartMonth=function(){var a=0,b=this.getMonth();return b<3&&(a=0),2<b&&b<6&&(a=3),5<b&&b<9&&(a=6),b>8&&(a=9),a},Date.prototype.getQuarterStartDate=function(){return Date.getDate(this.getFullYear(),this.getQuarterStartMonth(),1)},Date.prototype.getQuarterEndDate=function(){var a=this.getQuarterStartMonth()+2;return Date.getDate(this.getFullYear(),a,this.getMonthDays(a))},Date.prototype.getAfterMultiMonth=function(a){var b=Date.getDate(Date.getTime(this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds()));return b.setMonth(b.getMonth()+a|0),b},Date.prototype.getBeforeMultiMonth=function(a){var b=Date.getDate(Date.getTime(this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds()));return b.setMonth(b.getMonth()-a|0),b},Date.prototype.getOffsetMonth=function(a){var b=Date.getDate(Date.getTime(this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds())),c=b.getDate(),d=Date.getDate(b.getFullYear(),b.getMonth()+parseInt(a),1).getMonthDays();return c>d&&(c=d),b.setDate(c),b.setMonth(b.getMonth()+parseInt(a)),b},Date.prototype.getWeekStartDate=function(){var a=this.getDay();return this.getOffsetDate(0===a?-6:1-a)},Date.prototype.getWeekEndDate=function(){var a=this.getDay();return this.getOffsetDate(0===a?0:7-a)},Date.prototype.equalsTo=function(a){return this.getFullYear()==a.getFullYear()&&this.getMonth()==a.getMonth()&&this.getDate()==a.getDate()&&this.getHours()==a.getHours()&&this.getMinutes()==a.getMinutes()&&this.getSeconds()==a.getSeconds()},Date.prototype.setDateOnly=function(a){var b=Date.getDate(a);this.setDate(1),this.setFullYear(b.getFullYear()),this.setMonth(b.getMonth()),this.setDate(b.getDate())},Date.prototype.print=function(a){var b=this.getMonth(),c=this.getDate(),d=this.getFullYear(),e=this.getWeekNumber(),f=this.getQuarter(),g=this.getDay(),h={},i=this.getHours(),j=i>=12,k=j?i-12:i,l=this.getDayOfYear();0==k&&(k=12);var m=this.getMinutes(),n=this.getSeconds();h["%a"]=Date._SDN[g],h["%A"]=Date._DN[g],h["%b"]=Date._SMN[b],h["%B"]=Date._MN[b],h["%C"]=1+Math.floor(d/100),h["%d"]=c<10?"0"+c:c,h["%e"]=c,h["%H"]=i<10?"0"+i:i,h["%I"]=k<10?"0"+k:k,h["%j"]=l<100?l<10?"00"+l:"0"+l:l,h["%k"]=i,h["%l"]=k,h["%X"]=b<9?"0"+(1+b):1+b,h["%x"]=b+1,h["%M"]=m<10?"0"+m:m,h["%n"]="\n",h["%p"]=j?"PM":"AM",h["%P"]=j?"pm":"am",h["%s"]=Math.floor(this.getTime()/1e3),h["%S"]=n<10?"0"+n:n,h["%t"]="\t",h["%U"]=h["%W"]=h["%V"]=e<10?"0"+e:e,h["%u"]=g+1,h["%w"]=g,h["%y"]=(""+d).substr(2,2),h["%Y"]=d,h["%%"]="%",h["%Q"]=f;var o=/%./g;if(!BI.isKhtml())return a.replace(o,function(a){return h[a]||a});for(var p=a.match(o),q=0;q<p.length;q++){var r=h[p[q]];r&&(o=new RegExp(p[q],"g"),a=a.replace(o,r))}return a},Date.isLeap=function(a){return a%4===0&&a%100!==0||a%400===0},Date.checkVoid=function(a,b,c,d,e){var f=[];return a=0|a,b=0|b,c=0|c,d=BI.isString(d)?d.match(/\d+/g):d,e=BI.isString(e)?e.match(/\d+/g):e,a<d[0]?f=["y"]:a>e[0]?f=["y",1]:a>=d[0]&&a<=e[0]&&(a==d[0]&&(b<d[1]?f=["m"]:b==d[1]&&c<d[2]&&(f=["d"])),a==e[0]&&(b>e[1]?f=["m",1]:b==e[1]&&c>e[2]&&(f=["d",1]))),f},Date.checkLegal=function(a){var b=a.match(/\d+/g),c=0|b[0],d=0|b[1],e=0|b[2];if(b.length<=1)return!0;if(b.length<=2)return d>=1&&d<=12;var f=Date._MD.slice(0);return f[1]=Date.isLeap(c)?29:28,d>=1&&d<=12&&e<=f[d-1]},Date.parseDateTime=function(a,b){var c=Date.getDate(),d=0,e=0,f=1,g=a.split(/\W+/);if("%y%x"==b.toLowerCase()||"%y%x%d"==b.toLowerCase()){var h=4,i=2;g[0]=a.substring(0,h),g[1]=a.substring(h,h+i),g[2]=a.substring(h+i,h+2*i)}var j=b.match(/%./g),k=0,l=0,m=0,n=0,o=0;for(k=0;k<g.length;++k)switch(j[k]){case"%d":case"%e":f=parseInt(g[k],10);break;case"%X":e=parseInt(g[k],10)-1;break;case"%x":e=parseInt(g[k],10)-1;break;case"%Y":case"%y":d=parseInt(g[k],10),d<100&&(d+=d>29?1900:2e3);break;case"%b":case"%B":for(l=0;l<12;++l)if(Date._MN[l].substr(0,g[k].length).toLowerCase()==g[k].toLowerCase()){e=l;break}break;case"%H":case"%I":case"%k":case"%l":m=parseInt(g[k],10);break;case"%P":case"%p":/pm/i.test(g[k])&&m<12?m+=12:/am/i.test(g[k])&&m>=12&&(m-=12);break;case"%M":n=parseInt(g[k],10);case"%S":o=parseInt(g[k],10)}if(isNaN(d)&&(d=c.getFullYear()),isNaN(e)&&(e=c.getMonth()),isNaN(f)&&(f=c.getDate()),isNaN(m)&&(m=c.getHours()),isNaN(n)&&(n=c.getMinutes()),isNaN(o)&&(o=c.getSeconds()),0!=d)return Date.getDate(d,e,f,m,n,o);for(d=0,e=-1,f=0,k=0;k<g.length;++k)if(g[k].search(/[a-zA-Z]+/)!=-1){var p=-1;for(l=0;l<12;++l)if(Date._MN[l].substr(0,g[k].length).toLowerCase()==g[k].toLowerCase()){p=l;break}p!=-1&&(e!=-1&&(f=e+1),e=p)}else parseInt(g[k],10)<=12&&e==-1?e=g[k]-1:parseInt(g[k],10)>31&&0==d?(d=parseInt(g[k],10),d<100&&(d+=d>29?1900:2e3)):0==f&&(f=g[k]);return 0==d&&(d=c.getFullYear()),e!=-1&&0!=f?Date.getDate(d,e,f,m,n,o):c},Date.getDate=function(){var a=new(Function.prototype.bind.apply(Date,BI.concat([null],[].slice.apply(arguments))));if(BI.isNotNull(Date.timeZone)&&(0===arguments.length||1===arguments.length&&BI.isNumber(arguments[0]))){var b=a.getTime(),c=6e4*a.getTimezoneOffset(),d=b+c;return new Date(d+Date.timeZone)}return a},Date.getTime=function(){var a=Function.prototype.bind.apply(Date.getDate,BI.concat([null],[].slice.apply(arguments)))();return BI.isNotNull(Date.timeZone)?a.getTime()-Date.timeZone-6e4*a.getTimezoneOffset():a.getTime()},$.extend($.Event.prototype,{stopEvent:function(){this.stopPropagation(),this.preventDefault()}}),Function.prototype.before=function(a){var b=this;return function(){return a.apply(this,arguments)!==!1&&b.apply(this,arguments)}},Function.prototype.after=function(a){var b=this;return function(){var c=b.apply(this,arguments);return c!==!1&&(a.apply(this,arguments),c)}},jQuery&&!function(a){a.fn.insets||(a.fn.insets=function(){var a=this.padding(),b=this.border();return{top:a.top,bottom:a.bottom+b.bottom+b.top,left:a.left,right:a.right+b.right+b.left}}),a.fn.bounds||(a.fn.bounds=function(a){var b={hasIgnoredBounds:!0};return a?(isNaN(a.x)||(b.left=a.x),isNaN(a.y)||(b.top=a.y),null!=a.width&&(b.width=a.width-(this.outerWidth(!0)-this.width()),b.width=b.width>=0?b.width:a.width),null!=a.height&&(b.height=a.height-(this.outerHeight(!0)-this.height()),b.height=b.height>=0?b.height:a.height),this.css(b),this):(b=this.position(),{x:b.left,y:b.top,width:this.outerWidth(),height:this.outerHeight()})})}(jQuery),Number.prototype.toFixed&&"0.000"===8e-5.toFixed(3)&&"0"!==.9.toFixed(0)&&"1.25"===1.255.toFixed(2)&&"1000000000000000128"===(0xde0b6b3a7640080).toFixed(0)||!function(){
function a(a,b){for(var c=-1;++c<g;)b+=a*h[c],h[c]=b%f,b=Math.floor(b/f)}function b(a){for(var b=g,c=0;--b>=0;)c+=h[b],h[b]=Math.floor(c/a),c=c%a*f}function c(){for(var a=g,b="";--a>=0;)if(""!==b||0===a||0!==h[a]){var c=String(h[a]);""===b?b=c:b+="0000000".slice(0,7-c.length)+c}return b}function d(a,b,c){return 0===b?c:b%2===1?d(a,b-1,c*a):d(a*a,b/2,c)}function e(a){for(var b=0;a>=4096;)b+=12,a/=4096;for(;a>=2;)b+=1,a/=2;return b}var f,g,h;f=1e7,g=6,h=[0,0,0,0,0,0],Number.prototype.toFixed=function(f){var g,h,i,j,k,l,m,n;if(g=Number(f),g=g!==g?0:Math.floor(g),g<0||g>20)throw new RangeError("Number.toFixed called with invalid number of decimals");if(h=Number(this),h!==h)return"NaN";if(h<=-1e21||h>1e21)return String(h);if(i="",h<0&&(i="-",h=-h),j="0",h>1e-21)if(k=e(h*d(2,69,1))-69,l=k<0?h*d(2,-k,1):h/d(2,k,1),l*=4503599627370496,k=52-k,k>0){for(a(0,l),m=g;m>=7;)a(1e7,0),m-=7;for(a(d(10,m,1),0),m=k-1;m>=23;)b(1<<23),m-=23;b(1<<m),a(1,1),b(2),j=c()}else a(0,l),a(1<<-k,0),j=c()+"0.00000000000000000000".slice(2,2+g);return g>0?(n=j.length,j=n<=g?i+"0.0000000000000000000".slice(0,g-n+2)+j:i+j.slice(0,n-g)+"."+j.slice(n-g)):j=i+j,j}}(),Number.prototype.add=function(a){return accAdd(a,this)},Number.prototype.sub=function(a){return accSub(this,a)},Number.prototype.mul=function(a){return accMul(a,this)},Number.prototype.div=function(a){return accDiv(this,a)},$.extend(String.prototype,{startWith:function(a){return!(null==a||""==a||0===this.length||a.length>this.length)&&this.substr(0,a.length)==a},endWith:function(a){return!(null==a||""==a||0===this.length||a.length>this.length)&&this.substring(this.length-a.length)==a},getQuery:function(a){var b=new RegExp("(^|&)"+a+"=([^&]*)(&|$)"),c=this.substr(this.indexOf("?")+1).match(b);return c?unescape(c[2]):null},appendQuery:function(a){if(!a)return this;var b=this;return b.indexOf("?")===-1&&(b+="?"),b.endWith("?")!==!1||(b+="&"),$.each(a,function(a,c){"string"==typeof a&&(b+=a+"="+c+"&")}),b=b.substr(0,b.length-1)},replaceAll:function(a,b){return this.replace(new RegExp(a,"gm"),b)},perfectStart:function(a){return this.startWith(a)?this:a+this},allIndexOf:function(a){if("string"!=typeof a)return[];for(var b=this,c=[],d=0;b.length>0;){var e=b.indexOf(a);if(e===-1)break;c.push(d+e),b=b.substring(e+a.length,b.length),d+=e+a.length}return c}}),$.extend(String,{escape:function(a){return a.replace(/('|\\)/g,"\\$1")},leftPad:function(a,b,c){var d=String(a);for(c||(c=" ");d.length<b;)d=c+d;return d.toString()},format:function(a){var b=Array.prototype.slice.call(arguments,1);return a.replace(/\{(\d+)\}/g,function(a,c){return b[c]})}}),BI.EventListener={listen:function(a,b,c){return a.addEventListener?(a.addEventListener(b,c,!1),{remove:function(){a.removeEventListener(b,c,!1)}}):a.attachEvent?(a.attachEvent("on"+b,c),{remove:function(){a.detachEvent("on"+b,c)}}):void 0},capture:function(a,b,c){return a.addEventListener?(a.addEventListener(b,c,!0),{remove:function(){a.removeEventListener(b,c,!0)}}):{remove:BI.emptyFn}},registerDefault:function(){}},!function(){var a=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||window.clearTimeout,b=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||window.setTimeout;BI.MouseMoveTracker=function(a,b,c){this._isDragging=!1,this._animationFrameID=null,this._domNode=c,this._onMove=a,this._onMoveEnd=b,this._onMouseMove=BI.bind(this._onMouseMove,this),this._onMouseUp=BI.bind(this._onMouseUp,this),this._didMouseMove=BI.bind(this._didMouseMove,this)},BI.MouseMoveTracker.prototype={constructor:BI.MouseMoveTracker,captureMouseMoves:function(a){this._eventMoveToken||this._eventUpToken||(this._eventMoveToken=BI.EventListener.listen(this._domNode,"mousemove",this._onMouseMove),this._eventUpToken=BI.EventListener.listen(this._domNode,"mouseup",this._onMouseUp)),this._isDragging||(this._deltaX=0,this._deltaY=0,this._isDragging=!0,this._x=a.clientX,this._y=a.clientY),a.preventDefault?a.preventDefault():a.returnValue=!1},releaseMouseMoves:function(){this._eventMoveToken&&this._eventUpToken&&(this._eventMoveToken.remove(),this._eventMoveToken=null,this._eventUpToken.remove(),this._eventUpToken=null),null!==this._animationFrameID&&(a(this._animationFrameID),this._animationFrameID=null),this._isDragging&&(this._isDragging=!1,this._x=null,this._y=null)},isDragging:function(){return this._isDragging},_onMouseMove:function(a){var c=a.clientX,d=a.clientY;this._deltaX+=c-this._x,this._deltaY+=d-this._y,null===this._animationFrameID&&(this._animationFrameID=b(this._didMouseMove)),this._x=c,this._y=d,a.preventDefault?a.preventDefault():a.returnValue=!1},_didMouseMove:function(){this._animationFrameID=null,this._onMove(this._deltaX,this._deltaY),this._deltaX=0,this._deltaY=0},_onMouseUp:function(){this._animationFrameID&&this._didMouseMove(),this._onMoveEnd()}}}(),!function(){function a(a){var e=0,f=0,g=0,h=0;return"detail"in a&&(f=a.detail),"wheelDelta"in a&&(f=-a.wheelDelta/120),"wheelDeltaY"in a&&(f=-a.wheelDeltaY/120),"wheelDeltaX"in a&&(e=-a.wheelDeltaX/120),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(e=f,f=0),g=e*b,h=f*b,"deltaY"in a&&(h=a.deltaY),"deltaX"in a&&(g=a.deltaX),(g||h)&&a.deltaMode&&(1===a.deltaMode?(g*=c,h*=c):(g*=d,h*=d)),g&&!e&&(e=g<1?-1:1),h&&!f&&(f=h<1?-1:1),{spinX:e,spinY:f,pixelX:g,pixelY:h}}var b=10,c=40,d=800,e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||window.setTimeout;BI.WheelHandler=function(a,b,c,d){this._animationFrameID=null,this._deltaX=0,this._deltaY=0,this._didWheel=BI.bind(this._didWheel,this),"function"!=typeof b&&(b=b?function(){return!0}:function(){return!1}),"function"!=typeof c&&(c=c?function(){return!0}:function(){return!1}),"function"!=typeof d&&(d=d?function(){return!0}:function(){return!1}),this._handleScrollX=b,this._handleScrollY=c,this._stopPropagation=d,this._onWheelCallback=a,this.onWheel=BI.bind(this.onWheel,this)},BI.WheelHandler.prototype={constructor:BI.WheelHandler,onWheel:function(b){var c=a(b),d=this._deltaX+c.pixelX,f=this._deltaY+c.pixelY,g=this._handleScrollX(d,f),h=this._handleScrollY(f,d);if(g||h){this._deltaX+=g?c.pixelX:0,this._deltaY+=h?c.pixelY:0,b.preventDefault?b.preventDefault():b.returnValue=!1;var i;0===this._deltaX&&0===this._deltaY||(this._stopPropagation()&&(b.stopPropagation?b.stopPropagation():b.cancelBubble=!0),i=!0),i===!0&&null===this._animationFrameID&&(this._animationFrameID=e(this._didWheel))}},_didWheel:function(){this._animationFrameID=null,this._onWheelCallback(this._deltaX,this._deltaY),this._deltaX=0,this._deltaY=0}}}(),_.extend(BI,{MAX:0x1000000000000000,MIN:-0x1000000000000000,EVENT_RESPONSE_TIME:200,zIndex_layer:1e5,zIndex_floatbox:1e6,zIndex_popup:1e7,zIndex_masker:1e8,zIndex_tip:1e9,emptyStr:"",emptyFn:function(){},empty:null,Key:{48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/"},KeyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},Status:{SUCCESS:1,WRONG:2,START:3,END:4,WAITING:5,READY:6,RUNNING:7,OUTOFBOUNDS:8,NULL:-1},Direction:{Top:"top",Bottom:"bottom",Left:"left",Right:"right",Custom:"custom"},Axis:{Vertical:"vertical",Horizontal:"horizontal"},Selection:{Default:-2,None:-1,Single:0,Multi:1,All:2},HorizontalAlign:{Left:"left",Right:"right",Center:"center",Stretch:"stretch"},VerticalAlign:{Middle:"middle",Top:"top",Bottom:"bottom",Stretch:"stretch"}}),BI.version="2.0",BI.AbsoluteCenterLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.AbsoluteCenterLayout.superclass.props.apply(this,arguments),{baseCls:"bi-absolute-center-layout",hgap:0,lgap:0,rgap:0,vgap:0,tgap:0,bgap:0})},render:function(){BI.AbsoluteCenterLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.AbsoluteCenterLayout.superclass._addElement.apply(this,arguments);return d.element.css({position:"absolute",left:c.hgap+c.lgap+(b.lgap||0),right:c.hgap+c.rgap+(b.rgap||0),top:c.vgap+c.tgap+(b.tgap||0),bottom:c.vgap+c.bgap+(b.bgap||0),margin:"auto"}),d},resize:function(){},populate:function(a){BI.AbsoluteCenterLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.absolute_center_adapt",BI.AbsoluteCenterLayout),BI.AbsoluteHorizontalLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.AbsoluteHorizontalLayout.superclass.props.apply(this,arguments),{baseCls:"bi-absolute-horizontal-layout",hgap:0,lgap:0,rgap:0,vgap:0,tgap:0,bgap:0})},render:function(){BI.AbsoluteHorizontalLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.AbsoluteHorizontalLayout.superclass._addElement.apply(this,arguments);return d.element.css({position:"absolute",left:c.hgap+c.lgap+(b.lgap||0),right:c.hgap+c.rgap+(b.rgap||0),margin:"auto"}),c.vgap+c.tgap+(b.tgap||0)!==0&&d.element.css("top",c.vgap+c.tgap+(b.tgap||0)),c.vgap+c.bgap+(b.bgap||0)!==0&&d.element.css("bottom",c.vgap+c.bgap+(b.bgap||0)),d},resize:function(){},populate:function(a){BI.AbsoluteHorizontalLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.absolute_horizontal_adapt",BI.AbsoluteHorizontalLayout),BI.AbsoluteVerticalLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.AbsoluteVerticalLayout.superclass.props.apply(this,arguments),{baseCls:"bi-absolute-vertical-layout",hgap:0,lgap:0,rgap:0,vgap:0,tgap:0,bgap:0})},render:function(){BI.AbsoluteVerticalLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.AbsoluteVerticalLayout.superclass._addElement.apply(this,arguments);return d.element.css({position:"absolute",left:b.lgap,right:b.rgap,top:c.vgap+c.tgap+(b.tgap||0),bottom:c.vgap+c.bgap+(b.bgap||0),margin:"auto"}),c.hgap+c.lgap+(b.lgap||0)!==0&&d.element.css("left",c.hgap+c.lgap+(b.lgap||0)),c.hgap+c.rgap+(b.rgap||0)!==0&&d.element.css("right",c.hgap+c.rgap+(b.rgap||0)),d},resize:function(){},populate:function(a){BI.AbsoluteVerticalLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.absolute_vertical_adapt",BI.AbsoluteVerticalLayout),BI.CenterAdaptLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this,arguments),{baseCls:"bi-center-adapt-layout",columnSize:[],hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.CenterAdaptLayout.superclass.render.apply(this,arguments),this.$table=$("<table>").attr({cellspacing:0,cellpadding:0}).css({position:"relative",width:"100%",height:"100%","white-space":"nowrap","border-spacing":"0px",border:"none","border-collapse":"separate"}),this.$tr=$("<tr>"),this.$tr.appendTo(this.$table),this.populate(this.options.items)},_addElement:function(a,b){var c,d=this.options,e=d.columnSize[a]<=1?100*d.columnSize[a]+"%":d.columnSize[a];if(this.hasWidget(this._getChildName(a)))c=this.getWidgetByName(this._getChildName(a)),c.element.attr("width",e);else{var f=BI.createWidget(b);f.element.css({position:"relative",top:"0",left:"0",margin:"0px auto"}),c=BI.createWidget({type:"bi.default",tagName:"td",attributes:{width:e},items:[f]}),this.addWidget(this._getChildName(a),c)}return c.element.css({"max-width":d.columnSize[a]}),0===a&&c.element.addClass("first-element"),c.element.css({position:"relative",height:"100%","vertical-align":"middle",margin:"0",padding:"0",border:"none"}),d.hgap+d.lgap+(b.lgap||0)!==0&&f.element.css({"margin-left":d.hgap+d.lgap+(b.lgap||0)+"px"}),d.hgap+d.rgap+(b.rgap||0)!==0&&f.element.css({"margin-right":d.hgap+d.rgap+(b.rgap||0)+"px"}),d.vgap+d.tgap+(b.tgap||0)!==0&&f.element.css({"margin-top":d.vgap+d.tgap+(b.tgap||0)+"px"}),d.vgap+d.bgap+(b.bgap||0)!==0&&f.element.css({"margin-bottom":d.vgap+d.bgap+(b.bgap||0)+"px"}),c},_mountChildren:function(){var a=this,b=document.createDocumentFragment(),c=!1;BI.each(this._children,function(d,e){e.element!==a.element&&(b.appendChild(e.element[0]),c=!0)}),c===!0&&(this.$tr.append(b),this.element.append(this.$table))},resize:function(){},_getWrapper:function(){return this.$tr},populate:function(a){BI.CenterAdaptLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.center_adapt",BI.CenterAdaptLayout),BI.HorizontalAdaptLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.HorizontalAdaptLayout.superclass.props.apply(this,arguments),{baseCls:"bi-horizontal-adapt-layout",verticalAlign:BI.VerticalAlign.Top,columnSize:[],hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.HorizontalAdaptLayout.superclass.render.apply(this,arguments),this.$table=$("<table>").attr({cellspacing:0,cellpadding:0}).css({position:"relative",width:"100%","white-space":"nowrap","border-spacing":"0px",border:"none","border-collapse":"separate"}),this.$tr=$("<tr>"),this.$tr.appendTo(this.$table),this.populate(this.options.items)},_addElement:function(a,b){var c,d=this.options,e=d.columnSize[a]<=1?100*d.columnSize[a]+"%":d.columnSize[a];if(this.hasWidget(this._getChildName(a)))c=this.getWidgetByName(this._getChildName(a)),c.element.attr("width",e);else{var f=BI.createWidget(b);f.element.css({position:"relative",top:"0",left:"0",margin:"0px auto"}),c=BI.createWidget({type:"bi.default",tagName:"td",attributes:{width:e},items:[f]}),this.addWidget(this._getChildName(a),c)}return c.element.css({"max-width":d.columnSize[a]+"px"}),0===a&&c.element.addClass("first-element"),c.element.css({position:"relative","vertical-align":d.verticalAlign,margin:"0",padding:"0",border:"none"}),d.hgap+d.lgap+(b.lgap||0)!==0&&f.element.css({"margin-left":d.hgap+d.lgap+(b.lgap||0)+"px"}),d.hgap+d.rgap+(b.rgap||0)!==0&&f.element.css({"margin-right":d.hgap+d.rgap+(b.rgap||0)+"px"}),d.vgap+d.tgap+(b.tgap||0)!==0&&f.element.css({"margin-top":d.vgap+d.tgap+(b.tgap||0)+"px"}),d.vgap+d.bgap+(b.bgap||0)!==0&&f.element.css({"margin-bottom":d.vgap+d.bgap+(b.bgap||0)+"px"}),c},_mountChildren:function(){var a=this,b=document.createDocumentFragment(),c=!1;BI.each(this._children,function(d,e){e.element!==a.element&&(b.appendChild(e.element[0]),c=!0)}),c===!0&&(this.$tr.append(b),this.element.append(this.$table))},resize:function(){},_getWrapper:function(){return this.$tr},populate:function(a){BI.HorizontalAdaptLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.horizontal_adapt",BI.HorizontalAdaptLayout),BI.LeftRightVerticalAdaptLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.LeftRightVerticalAdaptLayout.superclass.props.apply(this,arguments),{baseCls:"bi-left-right-vertical-adapt-layout",items:{},llgap:0,lrgap:0,lhgap:0,rlgap:0,rrgap:0,rhgap:0})},render:function(){BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){},addItem:function(){throw new Error("cannot be added")},stroke:function(a){var b=this.options;if("left"in a){var c=BI.createWidget({type:"bi.vertical_adapt",items:a.left,hgap:b.lhgap,lgap:b.llgap,rgap:b.lrgap});c.element.css("height","100%"),BI.createWidget({type:"bi.left",element:this,items:[c]})}if("right"in a){var d=BI.createWidget({type:"bi.vertical_adapt",items:a.right,hgap:b.rhgap,lgap:b.rlgap,rgap:b.rrgap});d.element.css("height","100%"),BI.createWidget({type:"bi.right",element:this,items:[d]})}},populate:function(a){BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.left_right_vertical_adapt",BI.LeftRightVerticalAdaptLayout),BI.LeftVerticalAdaptLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.LeftRightVerticalAdaptLayout.superclass.props.apply(this,arguments),{baseCls:"bi-left-vertical-adapt-layout",items:[],lgap:0,rgap:0,hgap:0})},render:function(){BI.LeftVerticalAdaptLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){},addItem:function(){throw new Error("cannot be added")},stroke:function(a){var b=this.options,c=BI.createWidget({type:"bi.vertical_adapt",items:a,lgap:b.lgap,hgap:b.hgap,rgap:b.rgap});c.element.css("height","100%"),BI.createWidget({type:"bi.left",element:this,items:[c]})},populate:function(a){BI.LeftVerticalAdaptLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.left_vertical_adapt",BI.LeftVerticalAdaptLayout),BI.RightVerticalAdaptLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.RightVerticalAdaptLayout.superclass.props.apply(this,arguments),{baseCls:"bi-right-vertical-adapt-layout",items:[],lgap:0,rgap:0,hgap:0})},render:function(){BI.RightVerticalAdaptLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){},addItem:function(){throw new Error("cannot be added")},stroke:function(a){var b=this.options,c=BI.createWidget({type:"bi.vertical_adapt",items:a,lgap:b.lgap,hgap:b.hgap,rgap:b.rgap});c.element.css("height","100%"),BI.createWidget({type:"bi.right",element:this,items:[c]})},populate:function(a){BI.RightVerticalAdaptLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.right_vertical_adapt",BI.RightVerticalAdaptLayout),BI.VerticalAdaptLayout=BI.inherit(BI.Layout,{props:{baseCls:"bi-vertical-adapt-layout",columnSize:[],horizontalAlign:BI.HorizontalAlign.Left,hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0},render:function(){BI.VerticalAdaptLayout.superclass.render.apply(this,arguments);var a=this.options;this.$table=$("<table>").attr({cellspacing:0,cellpadding:0}).css({position:"relative",width:a.horizontalAlign===BI.HorizontalAlign.Stretch?"100%":"auto",height:"100%","white-space":"nowrap","border-spacing":"0px",border:"none","border-collapse":"separate"}),this.$tr=$("<tr>"),this.$tr.appendTo(this.$table),this.populate(this.options.items)},_addElement:function(a,b){var c,d=this.options,e=d.columnSize[a]<=1?100*d.columnSize[a]+"%":d.columnSize[a];if(this.hasWidget(this._getChildName(a)))c=this.getWidgetByName(this._getChildName(a)),c.element.attr("width",e);else{var f=BI.createWidget(b);f.element.css({position:"relative",top:"0",left:"0",margin:"0px auto"}),c=BI.createWidget({type:"bi.default",tagName:"td",attributes:{width:e},items:[f]}),this.addWidget(this._getChildName(a),c)}return 0===a&&c.element.addClass("first-element"),c.element.css({position:"relative",height:"100%","vertical-align":"middle",margin:"0",padding:"0",border:"none"}),d.hgap+d.lgap+(b.lgap||0)!==0&&f.element.css({"margin-left":d.hgap+d.lgap+(b.lgap||0)+"px"}),d.hgap+d.rgap+(b.rgap||0)!==0&&f.element.css({"margin-right":d.hgap+d.rgap+(b.rgap||0)+"px"}),d.vgap+d.tgap+(b.tgap||0)!==0&&f.element.css({"margin-top":d.vgap+d.tgap+(b.tgap||0)+"px"}),d.vgap+d.bgap+(b.bgap||0)!==0&&f.element.css({"margin-bottom":d.vgap+d.bgap+(b.bgap||0)+"px"}),c},_mountChildren:function(){var a=this,b=document.createDocumentFragment(),c=!1;BI.each(this._children,function(d,e){e.element!==a.element&&(b.appendChild(e.element[0]),c=!0)}),c===!0&&(this.$tr.append(b),this.element.append(this.$table))},_getWrapper:function(){return this.$tr},resize:function(){},populate:function(a){BI.VerticalAdaptLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.vertical_adapt",BI.VerticalAdaptLayout),BI.HorizontalAutoLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.HorizontalAutoLayout.superclass.props.apply(this,arguments),{baseCls:"bi-horizon-auto-layout",hgap:0,lgap:0,rgap:0,vgap:0,tgap:0,bgap:0})},render:function(){BI.HorizontalAutoLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.HorizontalAutoLayout.superclass._addElement.apply(this,arguments);return d.element.css({position:"relative",margin:"0px auto"}),c.hgap+c.lgap+(b.lgap||0)!==0&&d.element.css({"margin-left":c.hgap+c.lgap+(b.lgap||0)+"px"}),c.hgap+c.rgap+(b.rgap||0)!==0&&d.element.css({"margin-right":c.hgap+c.rgap+(b.rgap||0)+"px"}),c.vgap+c.tgap+(b.tgap||0)!==0&&d.element.css({"margin-top":c.vgap+c.tgap+(b.tgap||0)+"px"}),c.vgap+c.bgap+(b.bgap||0)!==0&&d.element.css({"margin-bottom":c.vgap+c.bgap+(b.bgap||0)+"px"}),d},resize:function(){},populate:function(a){BI.HorizontalAutoLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.horizontal_auto",BI.HorizontalAutoLayout),BI.FloatCenterAdaptLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.FloatCenterAdaptLayout.superclass.props.apply(this,arguments),{baseCls:"bi-float-center-adapt-layout",items:[],hgap:0,vgap:0,tgap:0,bgap:0,lgap:0,rgap:0})},render:function(){BI.FloatCenterAdaptLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){},addItem:function(){throw new Error("cannot be added")},mounted:function(){var a=this,b=this.left.element.outerWidth(),c=this.left.element.outerHeight();this.left.element.width(b).height(c).css("float","none"),BI.remove(this._children,function(b,c){c===a.container&&delete a._children[b]}),BI.createWidget({type:"bi.center_adapt",element:this,items:[this.left]})},stroke:function(a){var b=this.options;this.left=BI.createWidget({type:"bi.vertical",items:a,hgap:b.hgap,vgap:b.vgap,tgap:b.tgap,bgap:b.bgap,lgap:b.lgap,rgap:b.rgap}),this.container=BI.createWidget({type:"bi.left",element:this,items:[this.left]})},populate:function(a){BI.FloatCenterAdaptLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.float_center_adapt",BI.FloatCenterAdaptLayout),BI.FloatHorizontalLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.FloatHorizontalLayout.superclass.props.apply(this,arguments),{baseCls:"bi-float-horizontal-adapt-layout",items:[],hgap:0,vgap:0,tgap:0,bgap:0,lgap:0,rgap:0})},render:function(){BI.FloatHorizontalLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){},mounted:function(){var a=this,b=this.left.element.width(),c=this.left.element.height();this.left.element.width(b).height(c).css("float","none"),BI.remove(this._children,function(b,c){c===a.container&&delete a._children[b]}),BI.createWidget({type:"bi.horizontal_auto",element:this,items:[this.left]})},_addElement:function(a,b){var c=this.options;return this.left=BI.createWidget({type:"bi.vertical",items:[b],hgap:c.hgap,vgap:c.vgap,tgap:c.tgap,bgap:c.bgap,lgap:c.lgap,rgap:c.rgap}),this.container=BI.createWidget({type:"bi.left",element:this,items:[this.left]}),this.left},populate:function(a){BI.HorizontalAutoLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.horizontal_float",BI.FloatHorizontalLayout),BI.FlexCenterLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.FlexCenterLayout.superclass.props.apply(this,arguments),{baseCls:"bi-flex-center-layout"})},render:function(){BI.FlexCenterLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=(this.options,BI.FlexCenterLayout.superclass._addElement.apply(this,arguments));return c.element.css({position:"relative","flex-shrink":"0"}),c},resize:function(){},populate:function(a){BI.FlexCenterLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.flex_center",BI.FlexCenterLayout),BI.FlexHorizontalLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.FlexHorizontalLayout.superclass.props.apply(this,arguments),{baseCls:"bi-flex-horizontal-layout",verticalAlign:BI.VerticalAlign.Top,columnSize:[],scrollx:!0,hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.FlexHorizontalLayout.superclass.render.apply(this,arguments);var a=this.options;this.element.addClass(a.verticalAlign),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.FlexHorizontalLayout.superclass._addElement.apply(this,arguments);return d.element.css({position:"relative","flex-shrink":"0"}),c.hgap+c.lgap+(b.lgap||0)>0&&d.element.css({"margin-left":c.hgap+c.lgap+(b.lgap||0)+"px"}),c.hgap+c.rgap+(b.rgap||0)>0&&d.element.css({"margin-right":c.hgap+c.rgap+(b.rgap||0)+"px"}),c.vgap+c.tgap+(b.tgap||0)>0&&d.element.css({"margin-top":c.vgap+c.tgap+(b.tgap||0)+"px"}),c.vgap+c.bgap+(b.bgap||0)>0&&d.element.css({"margin-bottom":c.vgap+c.bgap+(b.bgap||0)+"px"}),d},resize:function(){},populate:function(a){BI.FlexHorizontalLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.flex_horizontal",BI.FlexHorizontalLayout),BI.FlexVerticalCenter=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.FlexVerticalCenter.superclass.props.apply(this,arguments),{baseCls:"bi-flex-vertical-center",horizontalAlign:BI.HorizontalAlign.Left,columnSize:[],hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.FlexVerticalCenter.superclass.render.apply(this,arguments);var a=this.options;this.element.addClass(a.horizontalAlign),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.FlexVerticalCenter.superclass._addElement.apply(this,arguments);return d.element.css({position:"relative","flex-shrink":"0"}),c.hgap+c.lgap+(b.lgap||0)>0&&d.element.css({"margin-left":c.hgap+c.lgap+(b.lgap||0)+"px"}),c.hgap+c.rgap+(b.rgap||0)>0&&d.element.css({"margin-right":c.hgap+c.rgap+(b.rgap||0)+"px"}),c.vgap+c.tgap+(b.tgap||0)>0&&d.element.css({"margin-top":c.vgap+c.tgap+(b.tgap||0)+"px"}),c.vgap+c.bgap+(b.bgap||0)>0&&d.element.css({"margin-bottom":c.vgap+c.bgap+(b.bgap||0)+"px"}),d},resize:function(){},populate:function(a){BI.FlexVerticalCenter.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.flex_vertical_center",BI.FlexVerticalCenter),BI.FlexCenterLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.FlexCenterLayout.superclass.props.apply(this,arguments),{baseCls:"bi-flex-wrapper-center-layout clearfix"})},render:function(){BI.FlexCenterLayout.superclass.render.apply(this,arguments),this.$wrapper=$("<div>").addClass("flex-wrapper-center-layout-wrapper"),this.populate(this.options.items)},_addElement:function(a,b){var c=(this.options,BI.FlexCenterLayout.superclass._addElement.apply(this,arguments));return c.element.css({position:"relative"}),c},_mountChildren:function(){var a=this,b=document.createDocumentFragment(),c=!1;BI.each(this._children,function(d,e){e.element!==a.element&&(b.appendChild(e.element[0]),c=!0)}),c===!0&&(this.$wrapper.append(b),this.element.append(this.$wrapper))},_getWrapper:function(){return this.$wrapper},resize:function(){},populate:function(a){BI.FlexCenterLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.flex_wrapper_center",BI.FlexCenterLayout),BI.FlexHorizontalLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.FlexHorizontalLayout.superclass.props.apply(this,arguments),{baseCls:"bi-flex-wrapper-horizontal-layout clearfix",verticalAlign:BI.VerticalAlign.Middle,columnSize:[],hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.FlexHorizontalLayout.superclass.render.apply(this,arguments);var a=this.options;this.$wrapper=$("<div>").addClass("flex-wrapper-horizontal-layout-wrapper "+a.verticalAlign),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.FlexHorizontalLayout.superclass._addElement.apply(this,arguments);return d.element.css({position:"relative"}),c.hgap+c.lgap+(b.lgap||0)>0&&d.element.css({"margin-left":c.hgap+c.lgap+(b.lgap||0)+"px"}),c.hgap+c.rgap+(b.rgap||0)>0&&d.element.css({"margin-right":c.hgap+c.rgap+(b.rgap||0)+"px"}),c.vgap+c.tgap+(b.tgap||0)>0&&d.element.css({"margin-top":c.vgap+c.tgap+(b.tgap||0)+"px"}),c.vgap+c.bgap+(b.bgap||0)>0&&d.element.css({"margin-bottom":c.vgap+c.bgap+(b.bgap||0)+"px"}),d},_mountChildren:function(){var a=this,b=document.createDocumentFragment(),c=!1;BI.each(this._children,function(d,e){e.element!==a.element&&(b.appendChild(e.element[0]),c=!0)}),c===!0&&(this.$wrapper.append(b),this.element.append(this.$wrapper))},_getWrapper:function(){return this.$wrapper},resize:function(){},populate:function(a){BI.FlexHorizontalLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.flex_wrapper_horizontal",BI.FlexHorizontalLayout),BI.FlexVerticalCenter=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.FlexVerticalCenter.superclass.props.apply(this,arguments),{baseCls:"bi-flex-wrapper-vertical-center clearfix",horizontalAlign:BI.HorizontalAlign.Middle,columnSize:[],hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.FlexVerticalCenter.superclass.render.apply(this,arguments);var a=this.options;this.$wrapper=$("<div>").addClass("flex-wrapper-vertical-center-wrapper "+a.horizontalAlign),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.FlexVerticalCenter.superclass._addElement.apply(this,arguments);return d.element.css({position:"relative"}),c.hgap+c.lgap+(b.lgap||0)>0&&d.element.css({"margin-left":c.hgap+c.lgap+(b.lgap||0)+"px"}),c.hgap+c.rgap+(b.rgap||0)>0&&d.element.css({"margin-right":c.hgap+c.rgap+(b.rgap||0)+"px"}),c.vgap+c.tgap+(b.tgap||0)>0&&d.element.css({"margin-top":c.vgap+c.tgap+(b.tgap||0)+"px"}),c.vgap+c.bgap+(b.bgap||0)>0&&d.element.css({"margin-bottom":c.vgap+c.bgap+(b.bgap||0)+"px"}),d},_mountChildren:function(){var a=this,b=document.createDocumentFragment(),c=!1;BI.each(this._children,function(d,e){e.element!==a.element&&(b.appendChild(e.element[0]),c=!0)}),c===!0&&(this.$wrapper.append(b),this.element.append(this.$wrapper))},_getWrapper:function(){return this.$wrapper},resize:function(){},populate:function(a){BI.FlexVerticalCenter.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.flex_wrapper_vertical_center",BI.FlexVerticalCenter),BI.AbsoluteLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.AbsoluteLayout.superclass.props.apply(this,arguments),{baseCls:"bi-absolute-layout",hgap:null,vgap:null,lgap:null,rgap:null,tgap:null,bgap:null})},render:function(){BI.AbsoluteLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.AbsoluteLayout.superclass._addElement.apply(this,arguments),e=0,f=0,g=0,h=0;return BI.isNotNull(b.left)&&(d.element.css({left:b.left}),e+=b.left),BI.isNotNull(b.right)&&(d.element.css({right:b.right}),f+=b.right),BI.isNotNull(b.top)&&(d.element.css({top:b.top}),g+=b.top),BI.isNotNull(b.bottom)&&(d.element.css({bottom:b.bottom}),h+=b.bottom),BI.isNotNull(c.hgap)&&(e+=c.hgap,d.element.css({left:e}),f+=c.hgap,d.element.css({right:f})),BI.isNotNull(c.vgap)&&(g+=c.vgap,d.element.css({top:g}),h+=c.vgap,d.element.css({bottom:h})),BI.isNotNull(c.lgap)&&(e+=c.lgap,d.element.css({left:e})),BI.isNotNull(c.rgap)&&(f+=c.rgap,d.element.css({right:f})),BI.isNotNull(c.tgap)&&(g+=c.tgap,d.element.css({top:g})),BI.isNotNull(c.bgap)&&(h+=c.bgap,d.element.css({bottom:h})),BI.isNotNull(b.width)&&d.element.css({width:b.width}),BI.isNotNull(b.height)&&d.element.css({height:b.height}),d.element.css({position:"absolute"}),d},resize:function(){this.stroke(this.options.items)},stroke:function(a){this.options.items=a||[];var b=this;BI.each(a,function(a,c){if(c){if(!BI.isWidget(c)&&!c.el)throw new Error("el must be exist");b._addElement(a,c)}})},populate:function(a){BI.AbsoluteLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.absolute",BI.AbsoluteLayout),BI.AdaptiveLayout=BI.inherit(BI.Layout,{props:function(){
return BI.extend(BI.AdaptiveLayout.superclass.props.apply(this,arguments),{baseCls:"bi-adaptive-layout",hgap:null,vgap:null,lgap:null,rgap:null,tgap:null,bgap:null})},render:function(){BI.AdaptiveLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.AdaptiveLayout.superclass._addElement.apply(this,arguments);d.element.css({position:"relative"});var e=0,f=0,g=0,h=0;return BI.isNotNull(b.left)&&d.element.css({"margin-left":b.left}),BI.isNotNull(b.right)&&d.element.css({"margin-right":b.right}),BI.isNotNull(b.top)&&d.element.css({"margin-top":b.top}),BI.isNotNull(b.bottom)&&d.element.css({"margin-bottom":b.bottom}),BI.isNotNull(c.hgap)&&(e+=c.hgap,d.element.css({left:e}),f+=c.hgap,d.element.css({right:f})),BI.isNotNull(c.vgap)&&(g+=c.vgap,d.element.css({top:g}),h+=c.vgap,d.element.css({bottom:h})),BI.isNotNull(c.lgap)&&(e+=c.lgap,d.element.css({left:e})),BI.isNotNull(c.rgap)&&(f+=c.rgap,d.element.css({right:f})),BI.isNotNull(c.tgap)&&(g+=c.tgap,d.element.css({top:g})),BI.isNotNull(c.bgap)&&(h+=c.bgap,d.element.css({bottom:h})),BI.isNotNull(b.width)&&d.element.css({width:b.width}),BI.isNotNull(b.height)&&d.element.css({height:b.height}),d},resize:function(){this.stroke(this.options.items)},populate:function(a){BI.AbsoluteLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.adaptive",BI.AdaptiveLayout),BI.BorderLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.BorderLayout.superclass.props.apply(this,arguments),{baseCls:"bi-border-layout",items:{}})},render:function(){BI.BorderLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){this.stroke(this.options.items)},addItem:function(a){throw new Error("cannot be added")},stroke:function(a){var b,c=0,d=0,e=0,f=0;if("north"in a&&(b=a.north,null!=b)){if(b.el){if(!this.hasWidget(this.getName()+"north")){var g=BI.createWidget(b);this.addWidget(this.getName()+"north",g)}this.getWidgetByName(this.getName()+"north").element.height(b.height).css({position:"absolute",top:b.top||0,left:b.left||0,right:b.right||0,bottom:"initial"})}c=(b.height||0)+(b.top||0)+(b.bottom||0)}if("south"in a&&(b=a.south,null!=b)){if(b.el){if(!this.hasWidget(this.getName()+"south")){var g=BI.createWidget(b);this.addWidget(this.getName()+"south",g)}this.getWidgetByName(this.getName()+"south").element.height(b.height).css({position:"absolute",bottom:b.bottom||0,left:b.left||0,right:b.right||0,top:"initial"})}d=(b.height||0)+(b.top||0)+(b.bottom||0)}if("west"in a&&(b=a.west,null!=b)){if(b.el){if(!this.hasWidget(this.getName()+"west")){var g=BI.createWidget(b);this.addWidget(this.getName()+"west",g)}this.getWidgetByName(this.getName()+"west").element.width(b.width).css({position:"absolute",left:b.left||0,top:c,bottom:d,right:"initial"})}e=(b.width||0)+(b.left||0)+(b.right||0)}if("east"in a&&(b=a.east,null!=b)){if(b.el){if(!this.hasWidget(this.getName()+"east")){var g=BI.createWidget(b);this.addWidget(this.getName()+"east",g)}this.getWidgetByName(this.getName()+"east").element.width(b.width).css({position:"absolute",right:b.right||0,top:c,bottom:d,left:"initial"})}f=(b.width||0)+(b.left||0)+(b.right||0)}if("center"in a&&(b=a.center,null!=b)){if(!this.hasWidget(this.getName()+"center")){var g=BI.createWidget(b);this.addWidget(this.getName()+"center",g)}this.getWidgetByName(this.getName()+"center").element.css({position:"absolute",top:c,bottom:d,left:e,right:f})}},populate:function(a){BI.BorderLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.border",BI.BorderLayout),BI.CardLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.CardLayout.superclass.props.apply(this,arguments),{baseCls:"bi-card-layout",items:[]})},render:function(){BI.CardLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){},stroke:function(a){var b=this,c=this.options;this.showIndex=void 0,BI.each(a,function(a,d){if(d){if(b.hasWidget(d.cardName))var e=b.getWidgetByName(d.cardName);else{var e=BI.createWidget(d);e.on(BI.Events.DESTROY,function(){var a=BI.findIndex(c.items,function(a,b){return b.cardName==d.cardName});a>-1&&c.items.splice(a,1)}),b.addWidget(d.cardName,e)}e.element.css({position:"absolute",top:"0",right:"0",bottom:"0",left:"0"}),e.setVisible(!1)}})},update:function(){},empty:function(){BI.CardLayout.superclass.empty.apply(this,arguments),this.options.items=[]},populate:function(a){BI.CardLayout.superclass.populate.apply(this,arguments),this._mount(),this.options.defaultShowName&&this.showCardByName(this.options.defaultShowName)},isCardExisted:function(a){return BI.some(this.options.items,function(b,c){return c.cardName==a&&c.el})},getCardByName:function(a){if(!this.isCardExisted(a))throw new Error("cardName is not exist");return this._children[a]},_deleteCardByName:function(a){delete this._children[a];var b=BI.findIndex(this.options.items,function(b,c){return c.cardName==a});b>-1&&this.options.items.splice(b,1)},deleteCardByName:function(a){if(!this.isCardExisted(a))throw new Error("cardName is not exist");var b=this._children[a];this._deleteCardByName(a),b&&b._destroy()},addCardByName:function(a,b){if(this.isCardExisted(a))throw new Error("cardName is already exist");var c=BI.createWidget(b);return c.element.css({position:"relative",top:"0",left:"0",width:"100%",height:"100%"}).appendTo(this.element),c.invisible(),this.addWidget(a,c),this.options.items.push({el:b,cardName:a}),c},showCardByName:function(a,b,c){var d=this,e=this.isCardExisted(a);null!=this.showIndex&&(this.lastShowIndex=this.showIndex),this.showIndex=a;var f=!1;BI.each(this.options.items,function(g,h){var i=d._children[h.cardName];i&&(a!=h.cardName?!f&&!e&&BI.Action&&b instanceof BI.Action?(b.actionBack(i),f=!0):i.invisible():BI.Action&&b instanceof BI.Action?b.actionPerformed(void 0,i,c):(i.visible(),c&&c()))})},showLastCard:function(){var a=this;this.showIndex=this.lastShowIndex,BI.each(this.options.items,function(b,c){a._children[c.cardName].setVisible(a.showIndex==b)})},setDefaultShowName:function(a){return this.options.defaultShowName=a,this},getDefaultShowName:function(){return this.options.defaultShowName},getAllCardNames:function(){return BI.map(this.options.items,function(a,b){return b.cardName})},getShowingCard:function(){if(BI.isKey(this.showIndex))return this.getWidgetByName(this.showIndex)},deleteAllCard:function(){var a=this;BI.each(this.getAllCardNames(),function(b,c){a.deleteCardByName(c)})},hideAllCard:function(){var a=this;BI.each(this.options.items,function(b,c){a._children[c.cardName].invisible()})},isAllCardHide:function(){var a=this,b=!0;return BI.some(this.options.items,function(c,d){if(a._children[d.cardName].isVisible())return b=!1,!1}),b},removeWidget:function(a){var b;BI.isWidget(a)?BI.each(this._children,function(c,d){d===a&&(b=c)}):b=a,b&&this._deleteCardByName(b)}}),BI.shortcut("bi.card",BI.CardLayout),BI.DefaultLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.DefaultLayout.superclass.props.apply(this,arguments),{hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0,items:[]})},render:function(){BI.DefaultLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.DefaultLayout.superclass._addElement.apply(this,arguments);return c.vgap+c.tgap+(b.tgap||0)!==0&&d.element.css({"margin-top":c.vgap+c.tgap+(b.tgap||0)+"px"}),c.hgap+c.lgap+(b.lgap||0)!==0&&d.element.css({"margin-left":c.hgap+c.lgap+(b.lgap||0)+"px"}),c.hgap+c.rgap+(b.rgap||0)!==0&&d.element.css({"margin-right":c.hgap+c.rgap+(b.rgap||0)+"px"}),c.vgap+c.bgap+(b.bgap||0)!==0&&d.element.css({"margin-bottom":c.vgap+c.bgap+(b.bgap||0)+"px"}),d},resize:function(){},populate:function(a){BI.DefaultLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.default",BI.DefaultLayout),BI.DivisionLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.DivisionLayout.superclass.props.apply(this,arguments),{baseCls:"bi-division-layout",columns:null,rows:null,items:[]})},render:function(){BI.DivisionLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){this.stroke(this.opitons.items)},addItem:function(a){throw new Error("cannot be added")},stroke:function(a){function b(a,b,c){0===b&&a.addClass("first-row"),0===c&&a.addClass("first-col"),a.addClass(BI.isOdd(b+1)?"odd-row":"even-row"),a.addClass(BI.isOdd(c+1)?"odd-col":"even-col"),a.addClass("center-element")}function c(a,b,c){var d="";0===b&&(d+=" first-row"),0===c&&(d+=" first-col"),d+=BI.isOdd(b+1)?" odd-row":" even-row",d+=BI.isOdd(c+1)?" odd-col":" even-col",a.cls=(a.cls||"")+d+" center-element"}function d(a,d,e){a instanceof BI.Widget?b(a.element,d,e):a.el instanceof BI.Widget?b(a.el.element,d,e):a.el?c(a.el,d,e):c(a,d,e)}var e=this.options,f=e.rows||e.items.length,g=e.columns||0|(e.items[0]&&e.items[0].length),h=BI.makeArray(f),i={},j={};BI.each(h,function(a){h[a]=BI.makeArray(g)}),BI.each(a,function(a,b){return BI.isArray(b)?void BI.each(b,function(c,d){i[a]=(i[a]||0)+b.width,j[c]=(j[c]||0)+b.height,h[a][c]=d}):(i[b.row]=(i[b.row]||0)+b.width,j[b.column]=(j[b.column]||0)+b.height,void(h[b.row][b.column]=b))});for(var k=0;k<f;k++)for(var l=0,m=0;m<g;m++){if(!h[k][m])throw new Error("item be required");if(this.hasWidget(this.getName()+k+"_"+m))n=this.getWidgetByName(this.getName()+k+"_"+m);else{var n=BI.createWidget(h[k][m]);this.addWidget(this.getName()+k+"_"+m,n)}var o=100*l/i[k];if(n.element.css({position:"absolute",left:o+"%"}),m>0){var p=this.getWidgetByName(this.getName()+k+"_"+(m-1));p.element.css({right:100-o+"%"})}m==e.columns-1&&n.element.css({right:"0%"}),d(n,k,m),l+=h[k][m].width}for(var m=0;m<e.columns;m++)for(var q=0,k=0;k<e.rows;k++){var n=this.getWidgetByName(this.getName()+k+"_"+m),r=100*q/j[m];if(n.element.css({top:r+"%"}),k>0){var p=this.getWidgetByName(this.getName()+(k-1)+"_"+m);p.element.css({bottom:100-r+"%"})}k==e.rows-1&&n.element.css({bottom:"0%"}),q+=h[k][m].height}},populate:function(a){BI.DivisionLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.division",BI.DivisionLayout),BI.FloatLeftLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.FloatLeftLayout.superclass.props.apply(this,arguments),{baseCls:"bi-float-left-layout clearfix",hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.FloatLeftLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.FloatLeftLayout.superclass._addElement.apply(this,arguments);return d.element.css({position:"relative","float":"left"}),BI.isNotNull(b.left)&&d.element.css({left:b.left}),BI.isNotNull(b.right)&&d.element.css({right:b.right}),BI.isNotNull(b.top)&&d.element.css({top:b.top}),(b.lgap||0)+c.hgap+c.lgap!==0&&d.element.css("margin-left",(b.lgap||0)+c.hgap+c.lgap),(b.rgap||0)+c.hgap+c.rgap!==0&&d.element.css("margin-right",(b.rgap||0)+c.hgap+c.rgap),(b.tgap||0)+c.vgap+c.tgap!==0&&d.element.css("margin-top",(b.tgap||0)+c.vgap+c.tgap),(b.bgap||0)+c.vgap+c.bgap!==0&&d.element.css("margin-bottom",(b.bgap||0)+c.vgap+c.bgap),d},resize:function(){this.stroke(this.options.items)},populate:function(a){BI.FloatLeftLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.left",BI.FloatLeftLayout),BI.FloatRightLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.FloatRightLayout.superclass.props.apply(this,arguments),{baseCls:"bi-float-right-layout clearfix",hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.FloatRightLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.FloatRightLayout.superclass._addElement.apply(this,arguments);return d.element.css({position:"relative","float":"right"}),BI.isNotNull(b.left)&&d.element.css({left:b.left}),BI.isNotNull(b.right)&&d.element.css({right:b.right}),BI.isNotNull(b.top)&&d.element.css({top:b.top}),(b.lgap||0)+c.hgap+c.lgap!==0&&d.element.css("margin-left",(b.lgap||0)+c.hgap+c.lgap),(b.rgap||0)+c.hgap+c.rgap!==0&&d.element.css("margin-right",(b.rgap||0)+c.hgap+c.rgap),(b.tgap||0)+c.vgap+c.tgap!==0&&d.element.css("margin-top",(b.tgap||0)+c.vgap+c.tgap),(b.bgap||0)+c.vgap+c.bgap!==0&&d.element.css("margin-bottom",(b.bgap||0)+c.vgap+c.bgap),d},resize:function(){this.stroke(this.options.items)},populate:function(a){BI.FloatRightLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.right",BI.FloatRightLayout),BI.GridLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.GridLayout.superclass.props.apply(this,arguments),{baseCls:"bi-grid-layout",columns:null,rows:null,items:[]})},render:function(){BI.GridLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){},addItem:function(){throw new Error("cannot be added")},stroke:function(a){function b(a,b,c){0===b&&a.addClass("first-row"),0===c&&a.addClass("first-col"),a.addClass(BI.isOdd(b+1)?"odd-row":"even-row"),a.addClass(BI.isOdd(c+1)?"odd-col":"even-col"),a.addClass("center-element")}function c(a,b,c){var d="";0===b&&(d+=" first-row"),0===c&&(d+=" first-col"),d+=BI.isOdd(b+1)?" odd-row":" even-row",d+=BI.isOdd(c+1)?" odd-col":" even-col",a.cls=(a.cls||"")+d+" center-element"}function d(a,d,e){a instanceof BI.Widget?b(a.element,d,e):a.el instanceof BI.Widget?b(a.el.element,d,e):a.el?c(a.el,d,e):c(a,d,e)}for(var e=this.options,f=e.rows||e.items.length,g=e.columns||0|(e.items[0]&&e.items[0].length),h=100/g,i=100/f,j=[],k=0;k<f;k++)j[k]=[];BI.each(a,function(a,b){return BI.isArray(b)?void BI.each(b,function(b,c){j[a][b]=BI.createWidget(c)}):void(j[b.row][b.column]=BI.createWidget(b))});for(var k=0;k<f;k++)for(var l=0;l<g;l++)j[k][l]||(j[k][l]=BI.createWidget({type:"bi.layout"})),d(j[k][l],k,l),j[k][l].element.css({position:"absolute",top:i*k+"%",left:h*l+"%",right:100-h*(l+1)+"%",bottom:100-i*(k+1)+"%"}),this.addWidget(j[k][l])},populate:function(a){BI.GridLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.grid",BI.GridLayout),BI.HorizontalLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.HorizontalLayout.superclass.props.apply(this,arguments),{baseCls:"bi-horizontal-layout",verticalAlign:BI.VerticalAlign.Top,columnSize:[],scrollx:!0,hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.HorizontalLayout.superclass.render.apply(this,arguments),this.$table=$("<table>").attr({cellspacing:0,cellpadding:0}).css({position:"relative","white-space":"nowrap","border-spacing":"0px",border:"none","border-collapse":"separate"}),this.$tr=$("<tr>"),this.$tr.appendTo(this.$table),this.populate(this.options.items)},_addElement:function(a,b){var c,d=this.options,e=d.columnSize[a]<=1?100*d.columnSize[a]+"%":d.columnSize[a];if(this.hasWidget(this._getChildName(a)))c=this.getWidgetByName(this._getChildName(a)),c.element.attr("width",e);else{var f=BI.createWidget(b);f.element.css({position:"relative",margin:"0px auto"}),c=BI.createWidget({type:"bi.default",tagName:"td",attributes:{width:e},items:[f]}),this.addWidget(this._getChildName(a),c)}return 0===a&&c.element.addClass("first-element"),c.element.css({position:"relative","vertical-align":d.verticalAlign,margin:"0",padding:"0",border:"none"}),d.hgap+d.lgap+(b.lgap||0)>0&&f.element.css({"margin-left":d.hgap+d.lgap+(b.lgap||0)+"px"}),d.hgap+d.rgap+(b.rgap||0)>0&&f.element.css({"margin-right":d.hgap+d.rgap+(b.rgap||0)+"px"}),d.vgap+d.tgap+(b.tgap||0)>0&&f.element.css({"margin-top":d.vgap+d.tgap+(b.tgap||0)+"px"}),d.vgap+d.bgap+(b.bgap||0)>0&&f.element.css({"margin-bottom":d.vgap+d.bgap+(b.bgap||0)+"px"}),c},_mountChildren:function(){var a=this,b=document.createDocumentFragment(),c=!1;BI.each(this._children,function(d,e){e.element!==a.element&&(b.appendChild(e.element[0]),c=!0)}),c===!0&&(this.$tr.append(b),this.element.append(this.$table))},resize:function(){},_getWrapper:function(){return this.$tr},populate:function(a){BI.HorizontalLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.horizontal",BI.HorizontalLayout),BI.HorizontalCellLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.HorizontalCellLayout.superclass.props.apply(this,arguments),{baseCls:"bi-horizontal-cell-layout",scrollable:!0,hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.HorizontalCellLayout.superclass.render.apply(this,arguments),this.element.css({display:"table","vertical-align":"top"}),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.HorizontalCellLayout.superclass._addElement.apply(this,arguments);return d.element.css({position:"relative",display:"table-cell","vertical-align":"middle"}),c.hgap+c.lgap>0&&d.element.css({"margin-left":c.hgap+c.lgap+"px"}),c.hgap+c.rgap>0&&d.element.css({"margin-right":c.hgap+c.rgap+"px"}),c.vgap+c.tgap>0&&d.element.css({"margin-top":c.vgap+c.tgap+"px"}),c.vgap+c.bgap>0&&d.element.css({"margin-bottom":c.vgap+c.bgap+"px"}),d},resize:function(){},populate:function(a){BI.HorizontalCellLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.horizontal_cell",BI.HorizontalCellLayout),BI.LatticeLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.LatticeLayout.superclass.props.apply(this,arguments),{baseCls:"bi-lattice-layout clearfix"})},render:function(){BI.LatticeLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.LatticeLayout.superclass._addElement.apply(this,arguments);if(c.columnSize&&c.columnSize[a])var e=c.columnSize[a]/BI.sum(c.columnSize)*100+"%";else var e=1/this.options.items.length*100+"%";return d.element.css({position:"relative","float":"left",width:e}),d},addItem:function(a){var b=BI.LatticeLayout.superclass.addItem.apply(this,arguments);return this.resize(),b},addItemAt:function(a){var b=BI.LatticeLayout.superclass.addItemAt.apply(this,arguments);return this.resize(),b},resize:function(){this.stroke(this.options.items)},populate:function(a){BI.LatticeLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.lattice",BI.LatticeLayout),BI.TableLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.TableLayout.superclass.props.apply(this,arguments),{baseCls:"bi-table-layout",scrolly:!0,columnSize:[200,200,"fill"],rowSize:30,hgap:0,vgap:0,items:[[{el:{text:"label1"}},{el:{text:"label2"}},{el:{text:"label3"}}]]})},render:function(){BI.TableLayout.superclass.render.apply(this,arguments),this.rows=0,this.populate(this.options.items)},_addElement:function(a,b){function c(a,b,c){0===b&&a.addClass("first-row"),0===c&&a.addClass("first-col"),a.addClass(BI.isOdd(b+1)?"odd-row":"even-row"),a.addClass(BI.isOdd(c+1)?"odd-col":"even-col"),a.addClass("center-element")}function d(a,b,c){var d="";0===b&&(d+=" first-row"),0===c&&(d+=" first-col"),d+=BI.isOdd(b+1)?" odd-row":" even-row",d+=BI.isOdd(c+1)?" odd-col":" even-col",a.cls=(a.cls||"")+d+" center-element"}function e(a,b,e){a instanceof BI.Widget?c(a.element,b,e):a.el instanceof BI.Widget?c(a.el.element,b,e):a.el?d(a.el,b,e):d(a,b,e)}var f,g,h=this.options,i=[],j=0,k=0;for(f=0;f<b.length&&BI.isNumber(h.columnSize[f]);f++)e(b[f],this.rows,f),i.push(BI.extend({top:0,bottom:0,left:h.columnSize[f]<=1?100*j+"%":j,width:h.columnSize[f]<=1?100*h.columnSize[f]+"%":h.columnSize[f]},b[f])),j+=h.columnSize[f]+(h.columnSize[f]<1?0:h.hgap);for(g=b.length-1;g>f;g--){if(!BI.isNumber(h.columnSize[g]))throw new Error("item with fill can only be one");e(b[g],this.rows,g),i.push(BI.extend({top:0,bottom:0,right:h.columnSize[g]<=1?100*k+"%":k,width:h.columnSize[g]<=1?100*h.columnSize[g]+"%":h.columnSize[g]},b[g])),k+=h.columnSize[g]+(h.columnSize[g]<1?0:h.hgap)}f>=0&&f<b.length&&(e(b[f],this.rows,f),i.push(BI.extend({top:0,bottom:0,left:j<=1?100*j+"%":j,right:k<=1?100*k+"%":k},b[f])));var l=BI.createWidget({type:"bi.absolute",height:BI.isArray(h.rowSize)?h.rowSize[this.rows]:h.rowSize,items:i});return this.rows>0&&this.getWidgetByName(this.getName()+(this.rows-1)).element.css({"margin-bottom":h.vgap}),l.element.css({position:"relative"}),this.addWidget(this.getName()+this.rows++,l),l},resize:function(){},addItem:function(a){if(!BI.isArray(a))throw new Error("item must be array");return BI.TableLayout.superclass.addItem.apply(this,arguments)},populate:function(a){BI.TableLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.table",BI.TableLayout),BI.HTapeLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.HTapeLayout.superclass.props.apply(this,arguments),{baseCls:"bi-h-tape-layout",hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0,items:[{width:100,el:{type:"bi.button",text:"button1"}},{width:"fill",el:{type:"bi.button",text:"button2"}},{width:200,el:{type:"bi.button",text:"button3"}}]})},render:function(){BI.HTapeLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){this.stroke(this.options.items)},addItem:function(a){throw new Error("cannot be added")},stroke:function(a){var b=this,c=this.options;a=BI.compact(a),BI.each(a,function(a,d){if(b.hasWidget(b.getName()+a+""))e=b.getWidgetByName(b.getName()+a+"");else{var e=BI.createWidget(d);b.addWidget(b.getName()+a+"",e)}e.element.css({position:"absolute",top:c.vgap+c.tgap+"px",bottom:c.vgap+c.bgap+"px"})});var d={},e={};d[0]=0,e[a.length-1]=0,BI.any(a,function(e,f){var g=b.getWidgetByName(b.getName()+e+"");if(BI.isNull(d[e])&&(d[e]=d[e-1]+a[e-1].width+2*c.hgap+c.lgap+c.rgap),f.width<1&&f.width>=0?g.element.css({left:100*d[e]+"%",width:100*f.width+"%"}):g.element.css({left:d[e]+c.hgap+c.lgap+"px",width:BI.isNumber(f.width)?f.width:""}),!BI.isNumber(f.width))return!0}),BI.backAny(a,function(d,f){var g=b.getWidgetByName(b.getName()+d+"");if(BI.isNull(e[d])&&(e[d]=e[d+1]+a[d+1].width+2*c.hgap+c.lgap+c.rgap),f.width<1&&f.width>=0?g.element.css({right:100*e[d]+"%",width:100*f.width+"%"}):g.element.css({right:e[d]+c.hgap+c.rgap+"px",width:BI.isNumber(f.width)?f.width:""}),!BI.isNumber(f.width))return!0})},populate:function(a){BI.HTapeLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.htape",BI.HTapeLayout),BI.VTapeLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.VTapeLayout.superclass.props.apply(this,arguments),{baseCls:"bi-v-tape-layout",hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0,items:[{height:100,el:{type:"bi.button",text:"button1"}},{height:"fill",el:{type:"bi.button",text:"button2"}},{height:200,el:{type:"bi.button",text:"button3"}}]})},render:function(){BI.VTapeLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){this.stroke(this.options.items)},addItem:function(a){throw new Error("cannot be added")},stroke:function(a){var b=this,c=this.options;a=BI.compact(a),BI.each(a,function(a,d){if(b.hasWidget(b.getName()+a+""))e=b.getWidgetByName(b.getName()+a+"");else{var e=BI.createWidget(d);b.addWidget(b.getName()+a+"",e)}e.element.css({position:"absolute",left:c.hgap+c.lgap+"px",right:c.hgap+c.rgap+"px"})});var d={},e={};d[0]=0,e[a.length-1]=0,BI.any(a,function(e,f){var g=b.getWidgetByName(b.getName()+e+"");if(BI.isNull(d[e])&&(d[e]=d[e-1]+a[e-1].height+2*c.vgap+c.tgap+c.bgap),f.height<1&&f.height>=0?g.element.css({top:100*d[e]+"%",height:100*f.height+"%"}):g.element.css({top:d[e]+c.vgap+c.tgap+"px",height:BI.isNumber(f.height)?f.height:""}),!BI.isNumber(f.height))return!0}),BI.backAny(a,function(d,f){var g=b.getWidgetByName(b.getName()+d+"");if(BI.isNull(e[d])&&(e[d]=e[d+1]+a[d+1].height+2*c.vgap+c.tgap+c.bgap),f.height<1&&f.height>=0?g.element.css({bottom:100*e[d]+"%",height:100*f.height+"%"}):g.element.css({bottom:e[d]+c.vgap+c.bgap+"px",height:BI.isNumber(f.height)?f.height:""}),!BI.isNumber(f.height))return!0})},populate:function(a){BI.VTapeLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.vtape",BI.VTapeLayout),BI.TdLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.TdLayout.superclass.props.apply(this,arguments),{baseCls:"bi-td-layout",columnSize:[200,200,200],hgap:0,vgap:0,items:[[{el:{text:"label1"}},{el:{text:"label2"}},{el:{text:"label3"}}]]})},render:function(){BI.TdLayout.superclass.render.apply(this,arguments),this.$table=$("<table>").attr({cellspacing:0,cellpadding:0}).css({position:"relative",width:"100%",height:"100%","border-spacing":"0px",border:"none","border-collapse":"separate"}),this.rows=0,this.populate(this.options.items)},_addElement:function(a,b){function c(a,b,c){0===b&&a.addClass("first-row"),0===c&&a.addClass("first-col"),a.addClass(BI.isOdd(b+1)?"odd-row":"even-row"),a.addClass(BI.isOdd(c+1)?"odd-col":"even-col"),a.addClass("center-element")}function d(a,b,c){var d="";0===b&&(d+=" first-row"),0===c&&(d+=" first-col"),d+=BI.isOdd(b+1)?" odd-row":" even-row",d+=BI.isOdd(c+1)?" odd-col":" even-col",a.cls=(a.cls||"")+d+" center-element"}function e(a,b,e){a instanceof BI.Widget?c(a.element,b,e):a.el instanceof BI.Widget?c(a.el.element,b,e):a.el?d(a.el,b,e):d(a,b,e)}for(var f=this.options,g=BI.createWidget({type:"bi.default",tagName:"tr"}),h=0;h<b.length;h++){var i=BI.createWidget(b[h]);i.element.css({position:"relative",top:"0",left:"0",margin:"0px auto"}),b[h].lgap&&i.element.css({"margin-left":b[h].lgap+"px"}),b[h].rgap&&i.element.css({"margin-right":b[h].rgap+"px"}),b[h].tgap&&i.element.css({"margin-top":b[h].tgap+"px"}),b[h].bgap&&i.element.css({"margin-bottom":b[h].bgap+"px"}),e(i,this.rows++,h);var j=BI.createWidget({type:"bi.default",attributes:{width:f.columnSize[h]<=1?100*f.columnSize[h]+"%":f.columnSize[h]},tagName:"td",items:[i]});j.element.css({position:"relative","vertical-align":"middle",margin:"0",padding:"0",border:"none"}),g.addItem(j)}return this.addWidget(this.getName()+a,g),g},_mountChildren:function(){var a=this,b=document.createDocumentFragment(),c=!1;BI.each(this._children,function(d,e){e.element!==a.element&&(b.appendChild(e.element[0]),c=!0)}),c===!0&&(this.$table.append(b),this.element.append(this.$table))},resize:function(){},addItem:function(a){if(!BI.isArray(a))throw new Error("item must be array");return BI.TdLayout.superclass.addItem.apply(this,arguments)},populate:function(a){BI.TdLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.td",BI.TdLayout),BI.VerticalLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.VerticalLayout.superclass.props.apply(this,arguments),{baseCls:"bi-vertical-layout",hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0,scrolly:!0})},render:function(){BI.VerticalLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},_addElement:function(a,b){var c=this.options,d=BI.VerticalLayout.superclass._addElement.apply(this,arguments);return d.element.css({position:"relative"}),c.vgap+c.tgap+(b.tgap||0)!==0&&d.element.css({"margin-top":c.vgap+c.tgap+(b.tgap||0)+"px"}),c.hgap+c.lgap+(b.lgap||0)!==0&&d.element.css({"margin-left":c.hgap+c.lgap+(b.lgap||0)+"px"}),c.hgap+c.rgap+(b.rgap||0)!==0&&d.element.css({"margin-right":c.hgap+c.rgap+(b.rgap||0)+"px"}),c.vgap+c.bgap+(b.bgap||0)!==0&&d.element.css({"margin-bottom":c.vgap+c.bgap+(b.bgap||0)+"px"}),d},resize:function(){this.stroke(this.options.items)},populate:function(a){BI.VerticalLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.vertical",BI.VerticalLayout),BI.WindowLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.WindowLayout.superclass.props.apply(this,arguments),{baseCls:"bi-window-layout",columns:3,rows:2,hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0,columnSize:[100,"fill",200],rowSize:[100,"fill"],items:[[{el:{type:"bi.button",text:"button1"}},{el:{type:"bi.button",text:"button2"}},{el:{type:"bi.button",text:"button3"}}]]})},render:function(){BI.WindowLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){this.stroke(this.options.items)},addItem:function(a){throw new Error("cannot be added")},stroke:function(a){function b(a,b,c){0===b&&a.addClass("first-row"),0===c&&a.addClass("first-col"),a.addClass(BI.isOdd(b+1)?"odd-row":"even-row"),a.addClass(BI.isOdd(c+1)?"odd-col":"even-col"),a.addClass("center-element")}function c(a,b,c){var d="";0===b&&(d+=" first-row"),0===c&&(d+=" first-col"),d+=BI.isOdd(b+1)?" odd-row":" even-row",d+=BI.isOdd(c+1)?" odd-col":" even-col",a.cls=(a.cls||"")+d+" center-element"}function d(a,d,e){a instanceof BI.Widget?b(a.element,d,e):a.el instanceof BI.Widget?b(a.el.element,d,e):a.el?c(a.el,d,e):c(a,d,e)}var e=this.options;BI.isNumber(e.rowSize)&&(e.rowSize=BI.makeArray(e.items.length,1/e.items.length)),BI.isNumber(e.columnSize)&&(e.columnSize=BI.makeArray(e.items[0].length,1/e.items[0].length));for(var f=0;f<e.rows;f++)for(var g=0;g<e.columns;g++){if(!e.items[f][g])throw new Error("item be required");if(!this.hasWidget(this.getName()+f+"_"+g)){var h=BI.createWidget(e.items[f][g]);h.element.css({position:"absolute"}),this.addWidget(this.getName()+f+"_"+g,h)}}var i={},j={},k={},l={};i[0]=0,k[0]=0,j[e.columns-1]=0,l[e.rows-1]=0;for(var f=0;f<e.rows;f++){for(var g=0;g<e.columns;g++){var m=this.getWidgetByName(this.getName()+f+"_"+g);BI.isNull(k[f])&&(k[f]=k[f-1]+(e.rowSize[f-1]<1?e.rowSize[f-1]:e.rowSize[f-1]+e.vgap+e.bgap));var n=k[f]<=1?100*k[f]+"%":k[f]+e.vgap+e.tgap+"px",o="";BI.isNumber(e.rowSize[f])&&(o=e.rowSize[f]<=1?100*e.rowSize[f]+"%":e.rowSize[f]+"px"),m.element.css({top:n,height:o}),d(m,f,g)}if(!BI.isNumber(e.rowSize[f]))break}for(var f=e.rows-1;f>=0;f--){for(var g=0;g<e.columns;g++){var m=this.getWidgetByName(this.getName()+f+"_"+g);BI.isNull(l[f])&&(l[f]=l[f+1]+(e.rowSize[f+1]<1?e.rowSize[f+1]:e.rowSize[f+1]+e.vgap+e.tgap));var p=l[f]<=1?100*l[f]+"%":l[f]+e.vgap+e.bgap+"px",o="";BI.isNumber(e.rowSize[f])&&(o=e.rowSize[f]<=1?100*e.rowSize[f]+"%":e.rowSize[f]+"px"),m.element.css({bottom:p,height:o}),d(m,f,g)}if(!BI.isNumber(e.rowSize[f]))break}for(var g=0;g<e.columns;g++){for(var f=0;f<e.rows;f++){var m=this.getWidgetByName(this.getName()+f+"_"+g);BI.isNull(i[g])&&(i[g]=i[g-1]+(e.columnSize[g-1]<1?e.columnSize[g-1]:e.columnSize[g-1]+e.hgap+e.rgap));var q=i[g]<=1?100*i[g]+"%":i[g]+e.hgap+e.lgap+"px",h="";BI.isNumber(e.columnSize[g])&&(h=e.columnSize[g]<=1?100*e.columnSize[g]+"%":e.columnSize[g]+"px"),m.element.css({left:q,width:h}),d(m,f,g)}if(!BI.isNumber(e.columnSize[g]))break}for(var g=e.columns-1;g>=0;g--){for(var f=0;f<e.rows;f++){var m=this.getWidgetByName(this.getName()+f+"_"+g);BI.isNull(j[g])&&(j[g]=j[g+1]+(e.columnSize[g+1]<1?e.columnSize[g+1]:e.columnSize[g+1]+e.hgap+e.lgap));var r=j[g]<=1?100*j[g]+"%":j[g]+e.hgap+e.rgap+"px",h="";BI.isNumber(e.columnSize[g])&&(h=e.columnSize[g]<=1?100*e.columnSize[g]+"%":e.columnSize[g]+"px"),m.element.css({right:r,width:h}),d(m,f,g)}if(!BI.isNumber(e.columnSize[g]))break}},populate:function(a){BI.WindowLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.window",BI.WindowLayout),BI.CenterLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.CenterLayout.superclass.props.apply(this,arguments),{baseCls:"bi-center-layout",hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.CenterLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){},addItem:function(a){throw new Error("cannot be added")},stroke:function(a){var b=this.options,c=[];BI.each(a,function(b){c.push({column:b,row:0,el:BI.createWidget({type:"bi.default",cls:"center-element "+(0===b?"first-element ":"")+(b===a.length-1?"last-element":"")})})}),BI.each(a,function(a,d){if(d){var e=BI.createWidget(d);e.element.css({position:"absolute",left:b.hgap+b.lgap,right:b.hgap+b.rgap,top:b.vgap+b.tgap,bottom:b.vgap+b.bgap,width:"auto",height:"auto"}),c[a].el.addItem(e)}}),BI.createWidget({type:"bi.grid",element:this,columns:c.length,rows:1,items:c})},populate:function(a){BI.CenterLayout.superclass.populate.apply(this,arguments),
this._mount()}}),BI.shortcut("bi.center",BI.CenterLayout),BI.FloatCenterLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.FloatCenterLayout.superclass.props.apply(this,arguments),{baseCls:"bi-float-center-layout",hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.FloatCenterLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){},addItem:function(a){throw new Error("cannot be added")},stroke:function(a){var b=this.options,c=[],d=100/a.length;BI.each(a,function(b){var e=BI.createWidget({type:"bi.default"});e.element.addClass("center-element "+(0===b?"first-element ":"")+(b===a.length-1?"last-element":"")).css({width:d+"%",height:"100%"}),c.push({el:e})}),BI.each(a,function(a,d){if(d){var e=BI.createWidget(d);e.element.css({position:"absolute",left:b.hgap+b.lgap,right:b.hgap+b.rgap,top:b.vgap+b.tgap,bottom:b.vgap+b.bgap,width:"auto",height:"auto"}),c[a].el.addItem(e)}}),BI.createWidget({type:"bi.left",element:this,items:c})},populate:function(a){BI.FloatCenterLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.float_center",BI.FloatCenterLayout),BI.HorizontalCenterLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.HorizontalCenterLayout.superclass.props.apply(this,arguments),{baseCls:"bi-horizontal-center-layout",hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.HorizontalCenterLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){},addItem:function(a){throw new Error("cannot be added")},stroke:function(a){var b=this.options,c=[];BI.each(a,function(b){c.push({column:b,row:0,el:BI.createWidget({type:"bi.default",cls:"center-element "+(0===b?"first-element ":"")+(b===a.length-1?"last-element":"")})})}),BI.each(a,function(a,d){if(d){var e=BI.createWidget(d);e.element.css({position:"absolute",left:b.hgap+b.lgap,right:b.hgap+b.rgap,top:b.vgap+b.tgap,bottom:b.vgap+b.bgap,width:"auto"}),c[a].el.addItem(e)}}),BI.createWidget({type:"bi.grid",element:this,columns:c.length,rows:1,items:c})},populate:function(a){BI.HorizontalCenterLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.horizontal_center",BI.HorizontalCenterLayout),BI.VerticalCenterLayout=BI.inherit(BI.Layout,{props:function(){return BI.extend(BI.VerticalCenterLayout.superclass.props.apply(this,arguments),{baseCls:"bi-vertical-center-layout",hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0})},render:function(){BI.VerticalCenterLayout.superclass.render.apply(this,arguments),this.populate(this.options.items)},resize:function(){},addItem:function(a){throw new Error("cannot be added")},stroke:function(a){var b=this.options,c=[];BI.each(a,function(b){c.push({column:0,row:b,el:BI.createWidget({type:"bi.default",cls:"center-element "+(0===b?"first-element ":"")+(b===a.length-1?"last-element":"")})})}),BI.each(a,function(a,d){if(d){var e=BI.createWidget(d);e.element.css({position:"absolute",left:b.hgap+b.lgap,right:b.hgap+b.rgap,top:b.vgap+b.tgap,bottom:b.vgap+b.bgap,height:"auto"}),c[a].el.addItem(e)}}),BI.createWidget({type:"bi.grid",element:this,columns:1,rows:c.length,items:c})},populate:function(a){BI.VerticalCenterLayout.superclass.populate.apply(this,arguments),this._mount()}}),BI.shortcut("bi.vertical_center",BI.VerticalCenterLayout),BI.Data=Data={},Data.Constant=BICst={},function(){var a={};Data.BufferPool={put:function(b,c){if(BI.isNotNull(a[b]))throw new Error("Buffer Pool has the key already!");a[b]=c},get:function(b){return a[b]}}}(),function(){var a={};Data.SharingPool={_Shared:a,put:function(b,c){a[b]=c},cat:function(){for(var b=Array.prototype.slice.call(arguments,0),c=a,d=0;d<b.length;d++)c=c&&c[b[d]];return c},get:function(){return BI.deepClone(this.cat.apply(this,arguments))},remove:function(b){delete a[b]}}}(),Data.Req={},Data.Source=BISource={},function(a){"function"==typeof define&&define.amd?define(["../core/jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=g.detail*-1),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=g.wheelDeltaX*-1),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=m*-1,m=0),j=0===m?l:m,"deltaY"in g&&(m=g.deltaY*-1,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=l*-1)),0!==m||0!==l){if(1===g.deltaMode){var q=40;j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=800;j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||n<f)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var a=h.length;a;)this.addEventListener(h[--a],b,!1);else this.onmousewheel=b},teardown:function(){if(this.removeEventListener)for(var a=h.length;a;)this.removeEventListener(h[--a],b,!1);else this.onmousewheel=null},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}),BI.FormulaCollections=["abs","ABS","acos","ACOS","acosh","ACOSH","add2array","ADD2ARRAY","and","AND","array","ARRAY","asin","ASIN","asinh","ASINH","atan","ATAN","atan2","ATAN2","atanh","ATANH","average","AVERAGE","bitnot","BITNOT","bitoperation","BITOPERATION","ceiling","CEILING","char","CHAR","circular","CIRCULAR","class","CLASS","cnmoney","CNMONEY","code","CODE","col","COL","colcount","COLCOUNT","colname","COLNAME","combin","COMBIN","concatenate","CONCATENATE","correl","CORREL","cos","COS","cosh","COSH","count","COUNT","crosslayertotal","CROSSLAYERTOTAL","date","DATE","datedelta","DATEDELTA","datedif","DATEDIF","dateinmonth","DATEINMONTH","dateinquarter","DATEINQUARTER","dateinweek","DATEINWEEK","dateinyear","DATEINYEAR","datesubdate","DATESUBDATE","datetime","DATETIME","datetonumber","DATETONUMBER","day","DAY","days360","DAYS360","daysofmonth","DAYSOFMONTH","daysofquarter","DAYSOFQUARTER","daysofyear","DAYSOFYEAR","dayvalue","DAYVALUE","decimal","DECIMAL","decode","DECODE","degrees","DEGREES","encode","ENCODE","endwith","ENDWITH","enmoney","ENMONEY","ennumber","ENNUMBER","eval","EVAL","even","EVEN","exact","EXACT","exp","EXP","fact","FACT","fields","FIELDS","filename","FILENAME","filesize","FILESIZE","filetype","FILETYPE","find","FIND","floor","FLOOR","format","FORMAT","getuserdepartments","GETUSERDEPARTMENTS","getuserjobtitles","GETUSERJOBTITLES","greparray","GREPARRAY","hierarchy","HIERARCHY","hour","HOUR","i18n","I18N","if","IF","inarray","INARRAY","index","INDEX","indexof","INDEXOF","indexofarray","INDEXOFARRAY","int","INT","isnull","ISNULL","joinarray","JOINARRAY","jvm","JVM","layertotal","LAYERTOTAL","left","LEFT","len","LEN","let","LET","ln","LN","log","LOG","log10","LOG10","lower","LOWER","lunar","LUNAR","map","MAP","maparray","MAPARRAY","max","MAX","median","MEDIAN","mid","MID","min","MIN","minute","MINUTE","mod","MOD","mom","MOM","month","MONTH","monthdelta","MONTHDELTA","now","NOW","numto","NUMTO","nvl","NVL","odd","ODD","or","OR","pi","PI","power","POWER","product","PRODUCT","promotion","PROMOTION","proper","PROPER","proportion","PROPORTION","radians","RADIANS","rand","RAND","randbetween","RANDBETWEEN","range","RANGE","rank","RANK","records","RECORDS","regexp","REGEXP","removearray","REMOVEARRAY","repeat","REPEAT","replace","REPLACE","reverse","REVERSE","reversearray","REVERSEARRAY","right","RIGHT","round","ROUND","round5","ROUND5","rounddown","ROUNDDOWN","roundup","ROUNDUP","row","ROW","rowcount","ROWCOUNT","second","SECOND","seq","SEQ","sign","SIGN","sin","SIN","sinh","SINH","slicearray","SLICEARRAY","sort","SORT","sortarray","SORTARRAY","split","SPLIT","sql","SQL","sqrt","SQRT","startwith","STARTWITH","stdev","STDEV","substitute","SUBSTITUTE","sum","SUM","sumsq","SUMSQ","switch","SWITCH","tabledatafields","TABLEDATAFIELDS","tabledatas","TABLEDATAS","tables","TABLES","tan","TAN","tanh","TANH","time","TIME","tobigdecimal","TOBIGDECIMAL","tobinary","TOBINARY","todate","TODATE","today","TODAY","todouble","TODOUBLE","tohex","TOHEX","toimage","TOIMAGE","tointeger","TOINTEGER","tooctal","TOOCTAL","totext","TOTEXT","treelayer","TREELAYER","trim","TRIM","trunc","TRUNC","uniquearray","UNIQUEARRAY","upper","UPPER","uuid","UUID","value","VALUE","webimage","WEBIMAGE","week","WEEK","weekdate","WEEKDATE","weekday","WEEKDAY","weightedaverage","WEIGHTEDAVERAGE","year","YEAR","yeardelta","YEARDELTA"],BI.FormulaJson=[{def:'MONTH:(serial_number)返回日期中的月。月是介于1和12之间的一个数。\nSerial_number:含有所求的月的日期.\n备注:\nFineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。\n在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,\n将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。\n示例:\nMONTH("2000/1/1")等于1。\nMONTH("2006/05/05")等于5。\nMONTH("1997/04/20")等于4。\nMONTH("2000-1-1", "yyyy-MM-dd")等于1。\nMONTH("2006-05-05", "yyyy-MM-dd")等于5。\nMONTH("1997-04-20", "yyyy-MM-dd")等于4。\nMONTH(35796)等于1。',name:"MONTH",type:"DATETIME"},{def:'ROWCOUNT(tableData)返回tableData的行数。\ntableData:TableData的名字,字符串形式的。\n备注:\n 先从私有数据源中查找,然后再从公有数据源中查找,返回的是tableData的行数。\n示例:\n以我们提供的数据源FRDemo为例\n新建数据集ds1:SELECT * FROM [CUSTOMER]\nROWCOUNT("ds1")等于20。',name:"ROWCOUNT",type:"REPORT"},{def:"RAND(): 返回均匀分布的随机数。每计算一次工作表,函数都会返回一个新的随机数值。\n备注:\n 要生成一个位于a和b之间的随机数,可以使用以下的公式: C=RAND()*(b-a)+a。\n 如果要使一个随机产生的数值不随单元格的重计算而改变,可以在编辑框中输入=RAND()并保持编辑状态,然后按F9,将公式永久性地改为随机数。\n示例:\n假如需要生成一个大于等于0,小于60的随机数,使用公式: =RAND()*60。\n假如需要生成一个大于等于0,小于19的随机数,使用公式: =RAND()*19。\n假如需要生成一个大于等于0,小于50的随机数,使用公式: =RAND()*50。",name:"RAND",type:"MATH"},{def:"GETUSERDEPARTMENTS():返回角色部门\n示例:\nGETUSERDEPARTMENTS():返回角色所有部门,若多个部门则数组\nGETUSERDEPARTMENTS(3,2):返回角色该部门的第三层和第二层名字,\n若多个部门则返回数组,若没有第三层则只显示第二层",name:"GETUSERDEPARTMENTS",type:"OTHER"},{def:'FORMAT(object,format) : 返回object的format格式。\nobject 需要被格式化对象,可以是String,数字,Object(常用的有Date, Time)。\nformat 格式化的样式。\n示例\nFORMAT(1234.5, "#,##0.00") => 1234.50\nFORMAT(1234.5, "#,##0") => 1234\nFORMAT(1234.5, "¥#,##0.00") => ¥1234.50\nFORMAT(1.5, "0%") => 150%\nFORMAT(1.5, "0.000%") => 150.000%\nFORMAT(6789, "##0.0E0") => 6.789E3\nFORMAT(6789, "0.00E00") => 6.79E03\nFORMAT(date(2007,1,1), "EEEEE, MMMMM dd, yyyy") => 星期一,一月 01,2007\nFORMAT(date(2007,1,13), "MM/dd/yyyy") => 01/13/2007\nFORMAT(date(2007,1,13), "M-d-yy") => 1-13-07\nFORMAT(time(16,23,56), "h:mm:ss a") => 4:23:56 下午',name:"FORMAT",type:"TEXT"},{def:'TRIM(text): 清除文本中所有空格,单词间的单个空格除外,也可用于带有不规则空格的文本。\nText:需要清除空格的文本。\n示例:\nTRIM(" Monthly Report")等于Monthly Report。',name:"TRIM",type:"TEXT"},{def:"SQRT(number): 返回一个正数的平方根。\nNumber:要求其平方根的任一正数。\n备注:\nNumber必须是一个正数,否则函数返回错误信息*NUM!。\n示例:\nSQRT(64)等于8。\nSQRT(-64)返回*NUM!。",name:"SQRT",type:"MATH"},{def:'DAYSOFYEAR(year):返回某年包含的天数。\n示例:\nDAYSOFYEAR(2008)等于365,等价于DAYSOFYEAR("2008-01-01")。',name:"DAYSOFYEAR",type:"DATETIME"},{def:'RANK(number,ref,order): 返回一个数在一个数组中的秩。(如果把这个数组排序,该数的秩即为它在数组中的序号。)\nNumber 所求秩的数。(可以是Boolean型,true=1,false=0)\nRef 可以是数组,引用,或一系列数,非实数的值被忽略处理(接受Boolean型,true=1,false=0)。\nOrder 指定求秩的参数,非零为升序,零为降序\n\n备注\n1. RANK对重复的数返回相同的秩,但重复的数影响后面的数的秩,比如,在一组升序排列的整数中,如果5出现了2次,并且秩为3,那么6的秩为5 (没有数的秩是4).\n\n示例\nA1:A5 = 6, 4.5, 4.5, 2, 4\nRANK(A1,A1:A5,1) 即 6 的秩为 5.\n\nRANK(3,1,2,"go",3,4,1) = 3, "go"被忽略。',name:"RANK",type:"OTHER"},{def:"ODD(number):返回对指定数值进行舍入后的奇数。\nnumber:是要舍入求奇的数值。\n不论正负号如何,数值都朝着远离 0 的方向舍入。如果 number 恰好是奇数,则不须进行任何舍入处理。\n示例:\nODD(1.5) 等于 3\nODD(3) 等于 3\nODD(2) 等于 3\nODD(-1) 等于 -1",name:"ODD",type:"MATH"},{def:'COLCOUNT(tableData):返回tableData中列的个数。\ntableData:tableData的名字,字符串形式的。\n备注:\n 先从私有数据源中查找,然后再从公有数据源中查找,返回的是第一个查找到的tableData中列数。\n示例:\n以我们提供的数据源FRDemo为例\n新建数据集ds1:SELECT * FROM [CUSTOMER]\nCOLCOUNT("ds1")等于6。\n',name:"COLCOUNT",type:"REPORT"},{def:'ENDWITH(str1,str2):判断字符串str1是否以str2结束。\n备注:\n str1和str2都是大小写敏感的。\n示例:\nENDWITH("FineReport","Report")等于true。\nENDWITH("FineReport","Fine")等于false。\nENDWITH("FineReport","report")等于false。',name:"ENDWITH",type:"TEXT"},{def:"LOG10(number):返回以 10 为底的对数。\nnumber: 用于常用对数计算的正实数。\n示例:\nLOG10(86) 等于 1.934498451\nLOG10(10) 等于 1\nLOG10(1E5) 等于 5\n",name:"LOG10",type:"MATH"},{def:"MAPARRAY(array, fn):把一个数组中的项目转换到另一个数组中。\narray (Array): 要转换的数组 \nfn (Function): 处理数组项目的函数 \n示例:\nMAPARRAY([3,4,2,3,6,8,7], item != 3)等于[false,true,true,false,true,true,true].",name:"MAPARRAY",type:"ARRAY"},{def:"FLOOR(number): 将参数number沿绝对值减小的方向去尾舍入。\nNumber:待舍入的数值。\n示例:\nFLOOR(-2.5)等于-2。\nFLOOR(2.5)等于2。\n",name:"FLOOR",type:"MATH"},{def:"NUMTO(number,bool)或NUMTO(number):返回number的中文表示。其中bool用于选择中文表示的方式,当没有bool时采用默认方式显示。\n示例:NUMTO(2345,true)等于二三四五。\n示例:NUMTO(2345,false)等于二千三百四十五。\n示例:NUMTO(2345)等于二千三百四十五。",name:"NUMTO",type:"TEXT"},{def:"ATANH(number): 返回数字的反双曲正切值,该函数的参数值即为反双曲正切值的双曲正切值。\nNumber:指介于-1~1之间的任意实数。\n备注:\n 指定的number必须介于-1~1之间(不包括-1,1)。\n ATANH(TANH(number))=number,例如,ATANH(TANH(8))=8。\n示例:\nATANH(-0.5)等于-0.549306144。\nATANH(0)等于0。\nATANH(0.7)等于0.867300528。",name:"ATANH",type:"MATH"},{def:'YEAR:(serial_number)返回日期中的年。Year是介于1900和9999之间的一个数。\nSerial_number:含有所求的年的日期.\n备注:\nFineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。\n在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,\n将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。\n示例:\nYEAR("2000/1/1")等于2000。\nYEAR("2006/05/05")等于2006。\nYEAR("1997/04/20")等于1997。\nYEAR("2000-1-1", "yyyy-MM-dd")等于2000。\nYEAR("2006-05-05", "yyyy-MM-dd")等于2006。\nYEAR("1997-04-20", "yyyy-MM-dd")等于1997。\nYEAR(35796)等于1998。',name:"YEAR",type:"DATETIME"},{def:"SLICEARRAY(array, start, end):返回数组从第start个到第end个元素(包括第end个元素)。\n示例:\nSLICEARRAY([3, 4, 4, 5, 1, 5, 7], 3, 6)返回[4, 5, 1, 5].\n当不使用end参数时,返回从start开始到数组结束之间的元素。\nSLICEARRAY([3, 4, 4, 5, 1, 5, 7], 3)返回[4, 5, 1, 5, 7].",name:"SLICEARRAY",type:"ARRAY"},{def:"",name:"DECODE",type:"OTHER"},{def:"ENMONEY(value):将给定的BigDemical类型的数字转换成英文金额字符串。\n示例:\nENMONEY(23.49)等于TWENTY THREE AND CENTS FORTY NINE",name:"ENMONEY",type:"TEXT"},{def:'IF(boolean,number1/string1,number2/string2):判断函数,boolean为true时返回第二个参数,为false时返回第三个。\nboolean: 用于判断的布尔值,true或者false。\nnumber1/string1: 第一个参数,如果boolean为ture,返回这个值。\nnumber2/string2: 第二个参数,如果boolean为false,返回这个值。\n示例:\nIF(true,2,8)等于2\nIF(false,"first","second")等于second\nIF(true,"first",7)等于first',name:"IF",type:"LOGIC"},{def:'DATEINWEEK(date, number):函数返回在某一个星期当中第几天的日期。\n示例:\ndateInWeek("2008-08-28", 2)等于2008-08-26。\ndateInWeek("2008-08-28", -1)等于2008-08-31。\n如果最后一个参数为-1,返回该日期所在星期的最后一天\n',name:"DATEINWEEK",type:"DATETIME"},{def:'MONTHDELTA(date,delta):返回指定日期date后delta个月的日期。\n示例:\nMONTHDELTA("2008-08-08", 4)等于2008-12-08。',name:"MONTHDELTA",type:"DATETIME"},{def:'FIELDS(connectionName,tableName):返回tableName这个表中的所有字段名。\n示例:\n数据库BASE中有个名叫task的表的内容如下:\nname start end\na 2008 2009\nb 2009 2012\n那么FIELDS("BASE","task")等于[name,start,end].',name:"FIELDS",type:"REPORT"},{def:'DATEDIF(start_date,end_date,unit):返回两个指定日期间的天数、月数或年数。\nStart_date:代表所指定时间段的初始日期。\nEnd_date:代表所指定时间段的终止日期。\nUnit:函数返回信息的类型。\n若unit=“Y”,则DATEDIF返回指定时间段的年差数。\n若unit=“M”,则DATEDIF返回指定时间段的月差数。\n若unit=“D”,则DATEDIF返回指定时间段的日差数。\n若unit=“MD”,则DATEDIF忽略年和月,返回指定时间段的日差数。\n若unit=“YM”,则DATEDIF忽略年和日,返回指定时间段的月差数。\n若unit=“YD”,则DATEDIF忽略年,返回指定时间段的日差数。\n示例:\nDATEDIF("2001/2/28","2004/3/20","Y")等于3,即在2001年2月28日与2004年3月20日之间有3个整年。\nDATEDIF("2001/2/28","2004/3/20","M")等于37,即在2001年2月28日与2004年3月20日之间有36个整月。\nDATEDIF("2001/2/28","2004/3/20","D")等于1116,即在2001年2月28日与2004年3月20日之间有1116个整天。\nDATEDIF("2001/2/28","2004/3/20","MD")等于8,即忽略月和年后,2001年2月28日与2004年3月20日的差为8天。\nDATEDIF("2001/1/28","2004/3/20","YM")等于2,即忽略日和年后,2001年1月28日与2004年3月20日的差为2个月。\nDATEDIF("2001/2/28","2004/3/20","YD")等于21,即忽略年后,2001年2月28日与2004年3月20日的差为21天。',name:"DATEDIF",type:"DATETIME"},{def:'TOIMAGE(path):显示指定路径下的图片。此处默认开启了图片缓存功能以加速报表的生成.\n如不需要缓存,请在参数后面追加值FALSE,例如:TOIMAGE("D:/fr.png",false).\n如需要指定图片大小,拉伸显示, 则需要添加参数,TOIMAGE(patch, true, width, height).\n示例:=toimage("d:/1.jpg", true, "50%", 300), 第三个参数为指定宽度, 第四个参数为指定高度.\n如果参数为整数, 则直接写数字, 如果为百分比, 则需要加上引号, 如"300%"',name:"TOIMAGE",type:"OTHER"},{def:'LEFT(text,num_chars): 根据指定的字符数返回文本串中的第一个或前几个字符。\nText:包含需要选取字符的文本串或单元格引用。\nNum_chars:指定返回的字符串长度。\n备注:\n Num_chars的值必须等于或大于0。\n 如果num_chars大于整个文本的长度,LEFT函数将返回所有的文本。\n 如果省略num_chars,则默认值为1。\n示例:\nLEFT("Fine software",8)等于“Fine sof”。\nLEFT("Fine software")等于“F”。\n如果单元格A3中含有“China”,则LEFT(A3,2)等于“Ch”。',name:"LEFT",type:"TEXT"},{def:'SUBSTITUTE(text,old_text,new_text,instance_num): 用new_text替换文本串中的old_text。\nText:需要被替换字符的文本,或含有文本的单元格引用。\nOld_text:需要被替换的部分文本。\nNew_text:用于替换old_text的文本。\nInstance_num:指定用new_text来替换第几次出现的old_text。如果指定了instance_num,则只有指定位置上的old_text被替换,否则文字串中出现的所有old_text都被new_text替换。\n备注:\n 如果需要替换文本串中的指定文本,则使用SUBSTITUTE函数;如果需要替换文本串中指定位置上的任意文本,则使用REPLACE函数。\n示例:\nSUBSTITUTE("data base","base","model")等于“data model”。\nSUBSTITUTE("July 28, 2000","2","1",1)等于“July 18, 2000”。\nSUBSTITUTE("July 28, 2000","2","1")等于“July 18, 1000”。\nSUBSTITUTE("July 28, 2000","2","1",2)等于“July 28, 1000”。 ',name:"SUBSTITUTE",type:"TEXT"},{def:"LOG(number,base): 按指定的任意底数,返回数值的对数。\nNumber:需要求对数的正实数。\nBase:对数的底数。如果省略底数,默认值为10。\n示例:\nLOG(16,2)等于4。\nLOG(10)等于1。\nLOG(24,3)等于2.892789261。",name:"LOG",type:"MATH"},{def:"SORTARRAY(array):返回数组array排过序的数组。\n示例:\nSORTARRAY([3, 4, 4, 5, 1, 5, 7])返回[1, 3, 4, 4, 5, 5, 7].\n注意:数组array的元素类型必须一样,并且要可比较。",name:"SORTARRAY",type:"ARRAY"},{def:'DATEDELTA(date, deltadays):返回一个日期??date后deltadays的日期。\ndeltaDays可以为正值,负值,零。\n示例:\nDATEDELTA("2008-08-08", -10)等于2008-07-29。\nDATEDELTA("2008-08-08", 10)等于2008-08-18。',name:"DATEDELTA",type:"DATETIME"},{def:'MID(text,start_num,num_chars): 返回文本串中从指定位置开始的一定数目的字符,该数目由用户指定。\nText:包含要提取字符的文本串。\nStart_num:文本中需要提取字符的起始位置。文本中第一个字符的start_num为1,依此类推。\nNum_chars:返回字符的长度。\n备注:\n 如果start_num大于文本长度,MID函数返回“”(空文本)。\n 如果start_num小于文本长度,并且start_num加上num_chars大于文本长度,MID函数将从start_num指定的起始字符直至文本末的所有字符。\n 如果start_num小于1,MID函数返回错误信息*VALUE!。\n 如果num_chars是负数,MID函数返回错误信息*VALUE!。\n示例:\nMID("Finemore software",10,8)返回“software”。\nMID("Finemore software",30,5)返回“”(空文本)。\nMID("Finemore software",0,8)返回*VALUE!。\nMID("Finemore software",5,-1)返回*VALUE!。',name:"MID",type:"TEXT"},{def:"ATAN2(x_num,y_num): 返回x、y坐标的反正切值。返回角度为x轴与过(x_num,y_num)与坐标原点(0,0)的一条直线形成的角度。该角度以弧度显示。\nX_num:指定点的x坐标。\nY_num:指定点的y坐标。\n备注:\n 正值表示从x轴开始以逆时针方式所得的角度;负值表示从x轴开始以顺时针方式所得的角度。\na > 0,b > 0 or a > 0, b < 0时,公式直接成立;\na < 0,b > 0, ATAN2(a,b)=PI()-ABS(ATAN(b/a))\na < 0,b < 0, ATAN2(a,b)=ABS(ATAN(b/a))-PI()\n 当x_num与y_num都为0时,ATAN2返回错误信息*DIV/0!。\n 用角度制显示返回数值时,把返回数值乘以180/PI()。\n 返回值以弧度表示(返回值大于-pi且小于等于pi)。\n示例:\nATAN2(-2,2)等于2.356194490192345(弧度制的3*pi/4)。\nATAN2(2,2)等于0.785398163(弧度制的pi/4)。\nATAN2(-2,2)*180/PI()等于135(角度制)。",name:"ATAN2",type:"MATH"},{def:'SUM(number1,number2,…): 求一个指定单元格区域中所有数字之和。\nNumber1,number2,…:1到30个参数或指定单元格区域中所有数字。\n备注:\n 函数将直接键入参数中的数值、逻辑值及文本表达式计算在内。\n 若参数是数组或引用,则只有数组或单元格引用中的数值进行计算。\n示例:\nSUM(70,80)等于150。\nSUM("70",80,TRUE)等于151,逻辑值“TRUE”作为1来计算;“FALSE”作为0计算;文本“70”作为70来计算。',name:"SUM",type:"MATH"},{def:'EXACT(text1,text2): 检测两组文本是否相同。如果完全相同,EXACT函数返回TRUE;否则,返回FALSE。EXACT函数可以区分大小写,但忽略格式的不同。同时也可以利用EXACT函数来检测输入文档的文字。\nText1:需要比较的第一组文本。\nText2:需要比较的第二组文本。\n示例:\nEXACT("Spreadsheet","Spreadsheet")等于TRUE。\nEXACT("Spreadsheet","S preadsheet")等于FALSE。\nEXACT("Spreadsheet","spreadsheet")等于FALSE。',name:"EXACT",type:"TEXT"},{def:'TOINTEGER(text): 将文本转换成Integer对象。\nText:需要转换的文本。\n示例:\nTOINTEGER("123")等于 new Integer(123)。',name:"TOINTEGER",type:"TEXT"},{def:"ACOSH(number): 返回给定数值的反双曲余弦。\nNumber:返回值的双曲余弦。\n备注:\n 参数number的值必须大于或等于1。\n ACOSH(COSH(number))=number。\n示例:\nACOSH(1)等于0。\nACOSH(8)等于2.768659383。\nACOSH(5.5)等于2.389526435。",name:"ACOSH",type:"MATH"},{def:"weekdate(year,month,weekOfMonth,dayOfWeek): 返回指定年月的指定周的周几的具体日期。\n示例:\nweekdate(2009,10,2,1)\n返回的是2009年的10月的第二个周的第一天即星期天的日期,返回的是2009-10-04\n最后一个参数dayOfWeek为-1时,表示这个周的最后一天\n示例:\nweekdate(2009,12,1,-1)\n返回的是2009年的12月的第一个周的最后一天即星期六的日期,返回的是2009-12-05\n",name:"WEEKDATE",type:"DATETIME"},{def:"MIN(number1,number2,…): 返回参数列表中的最小值。\nNumber1,number2,…:1到30个需要找出最小值的参数。\n备注:\n 若参数中没有数字,函数MIN将返回0。\n 参数应为数字、空白单元格、逻辑值或是表示数值的文本串。如果参数是错误值时,MIN将返回错误信息。\n 如果数组或引用参数中包含可解析文本值,逻辑值,零值或空白单元格,这些值都将参与计算,而不可解析的文本值忽略不计。\n示例:\n如果B1:B4包含3,6,9,12,则:\nMIN(B1:B4)等于3。\nMIN(B1:B4,0)等于0。",name:"MIN",type:"MATH"},{def:'STARTWITH(str1,str2):判断字符串str1是否以str2开始。\n备注:\n str1和str2都是大小写敏感的。\n示例:\nSTARTWITH("FineReport","Fine")等于true。\nSTARTWITH("FineReport","Report")等于false。\nSTARTWITH("FineReport","fine")等于false。',name:"STARTWITH",type:"TEXT"},{def:"COMBIN(number,number_chosen): 返回若干个指定对象的组合数。该函数与数学表达式为Cnk功能相同。\nNumber或数学表达式中的“n”指对象总数。\nNumber_chosen或数学表达式中的“k”指在对象总数中某一组合的数量。\n备注:\n Number必须是正整数,number_chosen必须是非负整数。\n 如果number和number_chosen小于0或number小于number_chosen,函数返回错误信息*NUM!。\n 对象组合是对象的子集。与排列不同的是,组合不涉及对象内部的先后顺序,而顺序对排列是非常重要的。\n 假设number=n,number_chosen=k,则: COMBIN(n,k)=Cnk=n!/(k!(n-k)!)。\n示例:\nCOMBIN(5,6)等于*NUM!。\nCOMBIN(5,2)等于10。",name:"COMBIN",type:"MATH"},{def:"EVEN(number):返回沿绝对值增大方向取整后最接近的偶数。使用该函数可以处理那些成对出现的对象。\nnumber:所要取整的数值。\n不论正负号如何,数值都朝着远离 0 的方向舍入。如果 number 恰好是偶数,则不须进行任何舍入处理。\n示例:\nEVEN(1.5) 等于 2\nEVEN(3) 等于 4\nEVEN(2) 等于 2\nEVEN(-1) 等于 -2",name:"EVEN",type:"MATH"},{def:"COUNT(value1,value2,…): 计算数组或数据区域中所含项的个数。\nValue1,value2,…:可包含任何类型数据的参数。",name:"COUNT",type:"MATH"},{def:'INDEXOFARRAY(array, index):返回数组array的第index个元素。\n示例:\nINDEXOFARRAY(["第一个", "第二个", "第三个"], 2)返回"第二个"。',name:"INDEXOFARRAY",type:"ARRAY"},{def:'MAP(object, string, int, int):四个参数分别是索引值,数据集的名字,索引值所在列序号,返回值所在列序号。\n提醒:后两个参数也可以写列名代替。\n根据数据集的名字,找到对应的数据集,找到其中索引列的值为key所对应的返回值。\n数据集的查找方式是依次从报表数据集找到服务器数据集。\n索引列序号与返回值序列号的初始值为1示例:\nMAP(1001, "employee", 1, 2)返回employee数据集,第1列中值为1001那条记录中第2列的值。\nMAP(1001, "employee", "name", "address")返回employee数据集,name列中值为1001那条记录中address列的值。',name:"MAP",type:"REPORT"},{def:"SEQ(): 返回数值,在整个报表执行过程中,返回该函数被第几次执行了。\n示例:\nSEQ()在第一次执行时,结果为1。\nSEQ()在第二次执行时,结果为2。",name:"SEQ",type:"OTHER"},{def:"i18n为本软件内置的国际化公式,可以对一些常用的词语进行国际化.\n示例:i18n('File'), 则会在中文语言环境下显示为: 文件, 而在英文语言环境下显示为: File",name:"I18N",type:"REPORT"},{def:"层次坐标简写, 等同于=A1[A1:-1], 若需=B1[A1:-1]则HIERARCHY(A1, B1).\n若为横向, 偏移量为-2, 则写成HIERARCHY(A1, B1, -2, false), 等同于=B1[;A1:-1].\n公式中最后一个参数表示横纵向, 默认不传递, 表示纵向扩展, 若横向扩展, 则需要加上最后一个参数FALSE来区分. ",name:"HIERARCHY",type:"HA"},{def:"",name:"ENCODE",type:"OTHER"},{def:'DATEINMONTH(date, number):函数返回在某一个月当中第几天的日期。\n示例:\nDATEINMONTH("2008-08-08", 20) 等于2008-08-20。\nDATEINMONTH("2008-08-08", -1) 等于2008-08-31。',name:"DATEINMONTH",type:"DATETIME"},{def:'TOOCTAL(int): 将一个十进制整型数转换成八进制表示的字符串。\nint:表示需要进行转换的十进制整数。\n示例:\nTOOCTAL(10)等于 "12"。\nTOOCTAL(20)等于 "24"。',name:"TOOCTAL",type:"MATH"},{def:'REPEAT(text,number_times): 根据指定的次数重复显示文本。REPEAT函数可用来显示同一字符串,并对单元格进行填充。\nText:需要重复显示的文本或包含文本的单元格引用。\nNumber_times:指定文本重复的次数,且为正数。如果number_times为0,REPEAT函数将返回“”(空文本)。如果number_times不是整数,将被取整。REPEAT函数的最终结果通常不大于32767个字符。\n备注:\n 该函数可被用于在工作表中创建简单的直方图。\n示例:\nREPEAT("$",4)等于“$$$$”。\n如果单元格B10的内容为“你好”,REPEAT(B10,3)等于“你好你好你好”。',name:"REPEAT",type:"TEXT"},{def:"GREPARRAY(array,fn):函数(返回true或者false)是条件,过滤此数组,最后形成一个新数组。\n示例:\nGREPARRAY([3,4,2,3,6,8,7], item != 3)等于[4,2,6,8,7].\n",name:"GREPARRAY",type:"ARRAY"},{def:"MAX(number1,number2,…): 返回参数列表中的最大值。\nNumber1,number2,…:1到30个需要找出最大值的参数。\n备注:\n 参数可以是数字、空白单元格、逻辑值或数字的文本表达式。\n 如果数组或引用参数中包含可解析文本值,逻辑值,零值或空白单元格,这些值都将参与计算,而不可解析的文本值忽略不计。\n 如果参数中没有任何数字,MAX将返回0。\n示例:\nMAX(0.1,0,1.2)等于1.2。",name:"MAX",type:"MATH"},{def:"CHAR(number): 根据指定数字返回对应的字符。CHAR函数可将计算机其他类型的数字代码转换为字符。\nNumber:用于指定字符的数字,介于1~65535之间(包括1和65535)。\n示例:\nCHAR(88)等于“X”。\nCHAR(45)等于“-”。",name:"CHAR",type:"TEXT"},{def:"TRUNC(number,num_digits):将数字的小数部分截去,返回整数。\nnumber:需要截尾取整的数字。\nnum_digits:用于指定取整精度的数字。\n示例:\nTRUNC(8.9) 等于 8\nTRUNC(-8.9) 等于 -8\nTRUNC(PI()) 等于 3\n",name:"TRUNC",type:"MATH"},{def:"FACT(number):返回数的阶乘,一个数的阶乘等于 1*2*3*...*该数。\nnumber:要计算其阶乘的非负数。如果输入的 number 不是整数,则截尾取整。\n示例:\nFACT(1) 等于 1\nFACT(1.9) 等于 FACT(1) 等于 1\nFACT(0) 等于 1\nFACT(5) 等于 1*2*3*4*5 等于 120\n",name:"FACT",type:"MATH"},{def:"STDEV(array1): 计算数据系列的标准偏差(与Excel的同名函数作用相同)。\n\n示例:\nSTDEV([1,2,3])=1。\n",name:"STDEV",type:"OTHER"},{def:'SPLIT(String1,String2):返回由String2分割String1组成的字符串数组。\nString1:以双引号表示的字符串。\nString2:以双引号表示的分隔符。例如逗号","\n示例:\nSPLIT("hello,world,yes",",") = ["hello","world","yes"]。\nSPLIT("this is very good"," ") = ["this","is","very","good"]。\n备注:\n如果只有一个参数,则返回一个错误。\n如果有多个参数,则只有前两个起作用。',name:"SPLIT",type:"TEXT"},{def:'INARRAY(co, array):返回co在数组array中的位置,如果co不在array中,则返回0.\n示例:\nString[] arr = {"a","b","c","d"}\n那么INARRAY("b", arr)等于2.',name:"INARRAY",type:"ARRAY"},{def:'REVERSEARRAY(array):返回数组array的倒序数组。\n示例:\nREVERSEARRAY(["第一个", "第二个", "第三个"])返回["第三个", "第二个", "第一个"].',name:"REVERSEARRAY",type:"ARRAY"},{def:"RANDBETWEEN(value1,value2):返回value1和value2之间的一个随机整数。\n示例:\nRANDBETWEEN(12.333, 13.233)只会返回13。\nRANDBETWEEN(11.2, 13.3)有可能返回12或者13。",name:"RANDBETWEEN",type:"MATH"},{def:'UPPER(text): 将文本中所有的字符转化为大写。\nText:需要转化为大写字符的文本,或是包含文本的单元格引用。\n示例:\nUPPER("notes")等于“NOTES”。\n如果单元格E5的值为“Examples”,则UPPER(E5)等于“EXAMPLES”。',name:"UPPER",type:"TEXT"},{def:"ABS(number): 返回指定数字的绝对值。绝对值是指没有正负符号的数值。\nNumber:需要求出绝对值的任意实数。\n示例:\nABS(-1.5)等于1.5。\nABS(0)等于0。\nABS(2.5)等于2.5。",name:"ABS",type:"MATH"},{def:'RIGHT(text,num_chars): 根据指定的字符数从右开始返回文本串中的最后一个或几个字符。\nText:包含需要提取字符的文本串或单元格引用。\nNum_chars:指定RIGHT函数从文本串中提取的字符数。Num_chars不能小于0。如果num_chars大于文本串长度,RIGHT函数将返回整个文本。如果不指定num_chars,则默认值为1。\n示例:\nRIGHT("It is interesting",6)等于“esting”。\nRIGHT("Share Holder")等于“r”。\nRIGHT("Huge sale",4)等于“sale”。',name:"RIGHT",type:"TEXT"},{def:"MEDIAN(array1): 返回数据系列的中值(与Excel的同名函数作用相同)。\n\n示例:\nMEDIAN([1,2,3])=2。\n",name:"MEDIAN",type:"OTHER"},{def:'TABLEDATAFIELDS(tableData):返回tableData中所有的字段名。\n备注:\n 先从报表数据集中查找,然后再从服务器数据集中查找,返回的是tableData的列名组成的数组。\n以我们提供的数据源FRDemo为例\n新建数据集ds1:SELECT * FROM [CUSTOMER]\nTABLEDATAFIELDS("ds1")等于\nCUSTOMERID,CUSTOMERAME,CITY,COUNTRY,TEL,DISTRICT。',name:"TABLEDATAFIELDS",type:"REPORT"},{def:"占比公式, =PROPORTION(A1)等同于=A1/sum(A1[!0])",name:"PROPORTION",type:"HA"},{def:'COL()返回当前单元格的列号,必须使用于条件属性中\n示例:\n如果当前单元格是A5,在A5中写入"=col()"则返回1。\n如果当前单元格是C6,在C6中写入"=col()"则返回3。',name:"COL",type:"REPORT"},{def:'TOHEX(int): 将一个十进制整型数转换成十六进制表示的字符串。\nint:表示需要进行转换的十进制整数。\n示例:\nTOHEX(15)等于 "f"。\nTOHEX(20)等于 "14"。',name:"TOHEX",type:"MATH"},{def:"COS(number): 返回一个角度的余弦值。\nNumber:以弧度表示的需要求余弦值的角度。\n备注:\n 要把一个角度转换成弧度值,将角度乘于PI()/180。\n COS(n*2*PI()+number)=COS(number)(其中n为整数,number从-pi到pi)。\n示例:\nCOS(0.5)等于0.877582562。\nCOS(30*PI()/180)等于0.866025404。",name:"COS",type:"MATH"},{def:"跨层累计, =CROSSLAYERTOTAL(A1, B1, C1, D1)等同于=IF(&B1 >1, D1[B1:-1] + C1, D1[A1:-1,B1:!-1] + C1), 如需横向, 则传递第五个参数false",name:"CROSSLAYERTOTAL",type:"HA"},{def:"POWER(number,power): 返回指定数字的乘幂。\nNumber:底数,可以为任意实数。\nPower:指数。参数number按照该指数次幂乘方。\n备注:\n 可以使用符号“^”代替POWER,如: POWER(5,2)等于5^2。\n示例:\nPOWER(6,2)等于36。\nPOWER(14,5)等于537824。\nPOWER(4,2/3)等于2.519842100。\nPOWER(3,-2.3)等于0.079913677。",name:"POWER",type:"MATH"},{def:'DAYS360(start_date,end_date,method):按照一年 360 天的算法(每个月以 30 天计,一年共计 12 个月),\n返回两日期间相差的天数,这在会计计算中将会用到。如果财务系统是基于一年 12 个月,每月 30 天,\n可用此函数帮助计算支付款项。\nStart_date 和 end_date :是用于计算期间天数的起止日期。\nMethod : 它指定了在计算中是采用欧洲方法还是美国方法。\nMethod 定义 :\nFALSE或忽略 美国方法 (NASD)。如果起始日期是一个月的 31 号,则等于同月的 30 号。如果终止日期是一个月的\n31号,并且起始日期早于 30 号,则终止日期等于下一个月的 1 号,否则,终止日期等于本月的 30 号。\nTRUE 欧洲方法。无论是起始日期还是终止日期为一个月的 31 号,都将等于本月的 30 号。\n备注:\nFineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。\n在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,\n将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。\n示例:\nDAYS360("1998/1/30", "1998/2/1") 等于 1',name:"DAYS360",type:"DATETIME"},{def:"filetype(file)获取文件的类型。\n当file为单文件时,返回文件类型字符串,当file为多文件时,返回文件类型的字符串数组。\n如果file不为文件类型,则返回错误信息。\n示例:\n假设文件控件在B2单元格,而B2单元格依次上传了三个不同类型文件{A.doc, C.xls ,B.txt },则filetype(B2)返回值为[“doc”, “xls”, “txt”]。",name:"FILETYPE",type:"OTHER"},{def:'ADDARRAY(array, insertArray, start):在数组第start个位置插入insertArray中的所有元素,再返回该数组。\n示例:\nADDARRAY([3, 4, 1, 5, 7], [23, 43, 22], 3)返回[3, 4, 23, 43, 22, 1, 5, 7].\nADDARRAY([3, 4, 1, 5, 7], "测试", 3)返回[3, 4, "测试", 1, 5, 7].\n注意:如果start为小于1的数或者不写start参数,则默认从数组的第一位开始插入数组元素。',name:"ADD2ARRAY",type:"ARRAY"},{def:"BITNOT(int):将一个十进制整数进行二进制取反运算。\nint:需要进行转换的十进制数。\n示例:\nBITNOT(3)等于-4。\nBITNOT(12)等于-13。",name:"BITNOT",type:"LOGIC"},{def:'TABLEAS(connectionName):返回名为connectionName的数据库中的所有表名。\n示例:\n假设在FRDemo这个数据库中,有3个表:a,b,c;\n那么TABLES("FRDemo")等于[a,b,c].',name:"TABLES",type:"REPORT"},{def:"SUMSQ(number1,number2, ...):返回所有参数的平方和。\nnumber1, number2, ...:为 1 到 30 个需要求平方和的参数,也可以使用数组或对数组的引用来代替以逗号分隔的参数。\n示例:\nSUMSQ(3, 4) 等于 25\n",name:"SUMSQ",type:"MATH"},{def:'RECORDS(connection, table,field):返回数据库表table中字段名field下的所有元素。\n示例:\n数据库BASE中有个名叫task的表的内容如下:\nname start end\na 2008 2009\nb 2009 2012\n那么RECORDS("BASE","task","end")等于[2009,2012].\n\nRECORDS(connection, table,field,row)返回table中field字段下的第row行的记录,field可以为列名也可以为列号。\n RECORDS("BASE","task","end",2)等于2012.\n RECORDS("BASE","task",2,2)等于2009.',name:"RECORDS",type:"REPORT"},{def:"",name:"TOBIGDECIMAL",type:"DELETE"},{def:'TODOUBLE(text): 将文本转换成Double对象。\nText:需要转换的文本。\n示例:\nTODOUBLE("123.21")等于 new Double(123.21)。',name:"TODOUBLE",type:"TEXT"},{def:'TODATE()函数可以将各种日期形式的参数转换为日期类型。\n它有三种参数的形式:\n1 参数是一个日期型的参数,那么直接将这个参数返回。\n示例:\nTODATE(DATE(2007,12,12))返回2007年12月12日组成的日期。\n2 参数是以从1970年1月1日0时0分0秒开始的毫秒数,返回对应的时间。\n示例:\nTODATE(1023542354746)返回2002年6月8日。\n3 参数是日期格式的文本,那么返回这个文本对应的日期。\n示例:\nTODATE("2007/10/15")返回2007年10月5日组成的日期。\nTODATE("2007-6-8")返回2007年6月8日组成的日期。\n4 有两个参数,第一个参数是一个日期格式的文本,第二个参数是用来解析日期的格式。\n示例:\nTODATE("1/15/07","mm/dd/yy")返回07年1月15日组成的日期。\n特别的,"yyyyMMdd"是用来解析形如“20081230”之类的日期格式的。比如TODATE("20110830","yyyyMMdd")返回11年08月30日组成的日期\n5 有三个参数,第一个参数是一个日期格式的文本,第二个参数是用来解析日期的格式,第三个参数为解析日期的语言,如:zh(中文),en(英文)。\n示例:\nTODATE("星期三 1/15/07","EEE mm/dd/yy", "zh")返回07年1月15日组成的日期,使用“zh(中文)”才能够正常解析“星期三”这个字符串。',name:"TODATE",type:"DATETIME"},{def:'PROPER(text): 将文本中的第一个字母和所有非字母字符后的第一个字母转化成大写,其他字母变为小写。\nText:需要转化为文本的公式、由双引号引用的文本串或是单元格引用。\n示例:\nPROPER("Finemore Integrated Office")等于“Finemore Integrated Office”。\nPROPER("100 percent")等于“100 Percent”。\nPROPER("SpreaDSheEt")等于“Spreadsheet”。',name:"PROPER",type:"TEXT"},{def:'DAY:(serial_number)返回日期中的日。DAY是介于1和31之间的一个数。\nSerial_number:含有所求的年的日期.\n备注:\nFineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。\n在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,\n将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。\n示例:\nDAY("2000/1/1")等于1。\nDAY("2006/05/05")等于5。\nDAY("1997/04/20")等于20。\nDAY("2000-1-1", "yyyy-MM-dd")等于1。\nDAY("2006-05-05", "yyyy-MM-dd")等于5。\nDAY("1997-04-20", "yyyy-MM-dd")等于20。\nDAY(35796)等于1。',name:"DAY",type:"DATETIME"},{def:"LUNAR(year,day,month): 返回当前日期对应的农历时间。\nyear,month,day:分别对应年月日。\n示例:\n如果需要查询2011年7月21日对应的农历时间,则只需输入LUNAR(2011,7,21)结果将显示为:辛卯年六月廿一\n同样,如输入LUNAR(2001,7,21),则显示:辛巳年六月初一 。本公式支持的时间段为1900-2100年。",name:"LUNAR",type:"DATETIME"},{def:"TABLEDATAS():返回报表数据集和服务器数据集名字。\n示例:\n服务器数据集有:ds1,ds2,ds3;报表数据集有dsr1,dsr2.\nTABLEDATAS()等于[dsr1,dsr2,ds1,ds2,ds3].\n而TABLEDATAS(0)返回服务器数据集名字;TABLEDATAS(1)返回报表数据集名字;\nTABLEDATAS(0)等于[ds1,ds2,ds3];TABLEDATAS(1)等于[dsr1,dsr2].",name:"TABLEDATAS",type:"REPORT"},{def:"TAN(number): 返回指定角度的正切值。\nNumber:待求正切值的角度,以弧度表示。如果参数是以度为单位的,乘以Pi()/180后转换为弧度。\n示例:\nTAN(0.8)等于1.029638557。\nTAN(45*Pi()/180)等于1。",name:"TAN",type:"MATH"},{def:"",name:"JVM",type:"DELETE"},{def:"LN(number):返回一个数的自然对数。自然对数以常数项 e(2.71828182845904)为底。\nnumber:是用于计算其自然对数的正实数。\n示例:\nLN(86) 等于 4.45437\nLN(2.7182818) 等于 1\nLN(EXP(3)) 等于 3\nEXP(LN(4)) 等于 4\n",name:"LN",type:"MATH"},{def:'ARRAY(arg1,arg2...):返回一个由arg1,arg2,...组成的数组.\narg1,arg2,...:字符串或者数字.\n示例:\nARRAY("hello") = ["hello"].\nARRAY("hello","world") = ["hello","world"].\nARRAY("hello",98) = ["hello",98].\nARRAY(67,98) = [67,98].',
name:"ARRAY",type:"ARRAY"},{def:'TOBINARY(int): 将一个十进制整型数转换成二进制表示的字符串。\nint:表示需要进行转换的十进制整数。\n示例:\nTOBINARY(10)等于 "1010"。\nTOBINARY(20)等于 "10100"。',name:"TOBINARY",type:"MATH"},{def:"NVL(value1,value2,value3,...):在所有参数中返回第一个不是null的值value1:可以为任意数,也可以为null。\nvalue2:可以为任意数,也可以为null。\n当字符串长度为0时, 返回也为null\n示例:\nNVL(12,20)等于12。\nNVL(null,12)等于12。\nNVL(null,null)等于null。\nNVL(20,null)等于20。\nNVL(null,null,10)等于10。",name:"NVL",type:"OTHER"},{def:"CORREL(array1,array2): 求两个相同长度数据系列的相关系数(与Excel的同名函数作用相同)。\n如果数组或引用参数包含文本、逻辑值或空白单元格,则这些值将被忽略;但包含零值的单元格将计算在内。\n函数计算结果出现负数表示负相关。相关系数的取值范围是[-1,1]之间的数。相关系数的绝对值越大,表示误差越小。 Array1 和 Array2 的数据点的个数必须相同,例如:\nCORREL([1,2,3],[2,4,6])=1。\n",name:"CORREL",type:"OTHER"},{def:'COLNAME(tableData,colIndex)返回的是tableData中列序号colIndex的列名。\ntableData:表示TableData的名字,字符串形式。\ncolIndex:表示列序号。\n备注:\n TableData先从私有数据源中查找,再从公有数据源中查找。\n示例:\nCOLNAME("Check",3)等于AcceName。\nCOLNAME("country",4)等于Area。',name:"COLNAME",type:"REPORT"},{def:"DECIMAL(number): 返回number的大数类型,常用于精确计算。",name:"DECIMAL",type:"MATH"},{def:"CLASS(object):返回object对象的所属的类。",name:"CLASS",type:"OTHER"},{def:'VALUE(tableData,col,row)返回tableData中列号为col的值, 行号为row。\ntableData:tableData的名字,字符串形式的。\nrow:行号。\ncol:列号。\n备注:\n 先从报表数据集中查找,然后再从服务器数据集中查找,返回的是tableData的行数。\n示例:\nVALUE("country",5,3)等于South America。\nVALUE("Simple",8,3)等于jonnason。\n示例:VALUE("country",5,"大陆")等于South America。\n\nVALUE(tableData,col)返回tableData中列号为col的一列值。\nVALUE(tableData,targetCol, orgCol, element)返回tableData中第targetCol列中的元素,这些元素对应的第orgCol列的值为element。\n示例:\ntableData : co\n国家 省份\n\n中国 江苏\n中国 浙江\n中国 北京\n美国 纽约\n美国 新泽西\nVALUE("co",2, 1, "中国")等于["江苏", "浙江", "北京"]。\n特别说明:列号也可以写为列名。\nVALUE(tableData,targetCol, orgCol, element, idx)返回VALUE(tableData,targetCol, orgCol, element)数组的第idx个值。\n特别说明:idx的值小于0时,会取数组的第一个值,idx的值大于数组长度时,会取数组的最后一个值。\n',name:"VALUE",type:"REPORT"},{def:'JOINARRAY(array,sepa):返回一个由sepa作为分隔符的字符串.\narray:[arg1,arg2...]格式的数组;\nsepa:分隔符。\n示例:\nJOINARRAY([1,2],";") = [1;2].\nJOINARRAY([hello,world],"-") = [hello-world].',name:"JOINARRAY",type:"ARRAY"},{def:'DATETONUMBER(date):返回自 1970 年 1 月 1 日 00:00:00 GMT 经过的毫秒数。\n示例:\nDATETONUMBER("2008-08-08")等于1218124800000。',name:"DATETONUMBER",type:"DATETIME"},{def:'INDEXOF(str1,index):返回字符串str1在index位置上的字符。\n备注:\n index是从0开始计数的。\n示例:\nINDEXOF("FineReport",0)等于\'F\'。\nINDEXOF("FineReport",2)等于\'n\'。\nINDEXOF("FineReport",9)等于\'t\'。\n\nINDEXOF(array, index):返回数组在index位置上的元素。\n备注:\n index是从1开始计数的。\n示例:\nString[] array = {"a", "b", "c"}\nINDEXOF(array, 1)等于"a".\n',name:"INDEXOF",type:"TEXT"},{def:"PRODUCT(number1,number2, ...):将所有以参数形式给出的数字相乘,并返回乘积值。\nnumber1, number2, ...:为 1 到 30 个需要相乘的数字参数。\n示例:\nPRODUCT(3,4) 等于 12\nPRODUCT(3,4,5) 等于 60\n\n",name:"PRODUCT",type:"MATH"},{def:"ACOS(number): 返回指定数值的反余弦值。反余弦值为一个角度,返回角度以弧度形式表示。\nNumber:需要返回角度的余弦值。\n备注:\n 函数的参数必须在-1和1之间,包括-1和1。\n 返回的角度值在0和Pi之间。\n 如果要把返回的角度用度数来表示,用180/PI()乘返回值即可。\n示例:\nACOS(1)等于0(弧度)。\nACOS(0.5)等于1.047197551(Pi/3弧度)。\nACOS(0.5)*180/PI()等于60(度)。",name:"ACOS",type:"MATH"},{def:'FIND(find_text,within_text,start_num):从指定的索引(start_num)处开始,返回第一次出现的指定子字符串(find_text)在此字符串(within_text)中的索引。\nFind_text:需要查找的文本或包含文本的单元格引用。\nWithin_text:包含需要查找文本的文本或单元格引用。\nStart_num:指定进行查找字符的索引位置。within_text里的索引从1开始。如果省略start_num,则假设值为1。\n备注:\n 如果find_text不在within_text中,FIND函数返回值为0。\n 如果start_num不大于0,FIND函数返回错误信息*VALUE!。\n 如果start_num大于within_text的长度,FIND函数返回值为0。\n 如果find_text是空白文本,FIND函数将在搜索串中匹配第一个字符(即编号为start_num或1的字符)。\n示例:\nFIND("I","Information")等于1。\nFIND("i","Information")等于9。\nFIND("o","Information",2)等于4。\nFIND("o","Information",12)等于0。\nFIND("o","Information",-1)等于*VALUE!。',name:"FIND",type:"TEXT"},{def:'MINUTE(serial_number):返回某一指定时间的分钟数,其值是介于0与59之间的一个整数。\nserial_number:包含所求分钟数的时间。\n示例:\nMINUTE("15:36:25")等于36。\nMINUTE("15:36:25", "HH:mm:ss")等于36。',name:"MINUTE",type:"DATETIME"},{def:"SIGN(number):返回数字的符号。当数字为正数时返回 1,为零时返回 0,为负数时返回 -1。\nNumber:为任意实数。\n示例:\nSIGN(10) 等于 1\nSIGN(4-4) 等于 0\nSIGN(-0.00001) 等于 -1\n",name:"SIGN",type:"MATH"},{def:'INDEX(key,val1,val2,...):返回key在val1,val2,...所组成的序列中的位置,不存在于序列中则返回参数的个数.\n备注:\n key和valn可以是任意类型\n示例:\nINDEX(2,2)等于1。\nINDEX(2,1,2)等于2。\nINDEX(2,4,5,6)等于4。\nINDEX("b","b","o","y")等于1。',name:"INDEX",type:"OTHER"},{def:"REVERSE(value):返回与value相反的逻辑值。\n示例:\nREVERSE(true)等于false。",name:"REVERSE",type:"LOGIC"},{def:'REPLACE(text, texttoreplace, replacetext):根据指定字符串,用其他文本来代替原始文本中的内容。\ntext:需要被替换部分字符的文本或单元格引用。\ntexttoreplace:指定的字符串或正则表达式。\nreplacetext:需要替换部分旧文本的文本。\n示例:\nREPLACE("abcd", "a", "re")等于"rebcd"。\nREPLACE("a**d", "**d", "rose")等于"arose"。\nREPLACE(old_text,start_num,num_chars,new_text): 根据指定的字符数,用其他文本串来替换某个文本串中的部分内容。\nOld_text:需要被替换部分字符的文本或单元格引用。\nStart_num:需要用new_text来替换old_text中字符的起始位置。\nNum_chars:需要用new_text来替换old_text中字符的个数。\nNew_text:需要替换部分旧文本的文本。\n示例:\nREPLACE("0123456789",5,4,"*")等于“0123*89”。\nREPLACE("1980",3,2,"99")等于“1999”。',name:"REPLACE",type:"TEXT"},{def:"UUID():返回随机的UUID。\n示例:UUID()返回36位随机机器数。\n UUID(32)返回32位随机机器数。",name:"UUID",type:"OTHER"},{def:'DATESUBDATE(date1, date2, op):返回两个日期之间的时间差。\nop表示返回的时间单位:\n"s",以秒为单位。\n"m",以分钟为单位。\n"h",以小时为单位。\n"d",以天为单位。\n"w",以周为单位。\n示例:\nDATESUBDATE("2008-08-08", "2008-06-06","h")等于1512。',name:"DATESUBDATE",type:"DATETIME"},{def:'CONCATENATE(text1,text2,...): 将数个字符串合并成一个字符串。\nText1,text2,...:需要合并成单个文本的文本项,可以是字符,数字或是单元格引用。\n示例:\nCONCATENATE("Average ","Price")等于“Average Price”。\nCONCATENATE("1","2")等于12。',name:"CONCATENATE",type:"TEXT"},{def:"filesize(file)获取文件的大小,单位为Kb。\n当file为单文件时,返回文件大小,当file为多文件时,返回文件大小的数组。\n如果file不为文件类型,则返回错误信息。\n示例:\n假设文件控件在B2单元格,而B2单元格依次上传了两个大小分别为100字节和10240字节的文件,则filename(B2)返回值为[0.098, 10.0]。",name:"FILESIZE",type:"OTHER"},{def:'DAYSOFMONTH(date):返回从1900年1月后某年某月包含的天数。\n示例:\nDAYSOFMONTH("1900-02-01")等于28。\nDAYSOFMONTH("2008/04/04")等于30。',name:"DAYSOFMONTH",type:"DATETIME"},{def:'DATEINQUARTER(date, number): 函数返回在某一个季度当中第几天的日期。\n示例:\nDATEINQUARTER("2009-05-05", 20)等于 2009-04-20。',name:"DATEINQUARTER",type:"DATETIME"},{def:"逐层累计, =LAYERTOTAL(B1, C1, D1)等同于=D1[B1:-1] + C1, 如需横向, 则传递第四个参数false.如LAYERTOTAL(B1, C1, D1, false)",name:"LAYERTOTAL",type:"HA"},{def:'CNMONEY(number,unit)返回人民币大写。\nnumber:需要转换的数值型的数。\nunit:单位,"s","b","q","w","sw","bw","qw","y","sy","by","qy","wy"分别代表“拾”,“佰”,“仟”,“万”,“拾万”,“佰万”,“仟万”,“亿”,“拾亿”,“佰亿”,“仟亿”,“万亿”。\n备注:\n 单位可以为空,如果为空,则直接将number转换为人民币大写,否则先将number与单位的进制相乘,然后再将相乘的结果转换为人民币大写。\n示例:\nCNMONEY(1200)等于壹仟贰佰圆整。\nCNMONEY(12.5,"w")等于壹拾贰万伍仟圆整。\nCNMONEY(56.3478,"bw")等于伍仟陆佰叁拾肆万柒仟捌佰圆整。\nCNMONEY(3.4567,"y")等于叁亿肆仟伍佰陆拾柒万圆整。',name:"CNMONEY",type:"TEXT"},{def:'DAYVALUE(date):返回1900年至 date日期所经历的天数。\n示例:\nDAYVALUE("2008/08/08")等于39668。',name:"DAYVALUE",type:"DATETIME"},{def:'SQL(connectionName,sql,columnIndex,rowIndex)返回通过sql语句从connectionName中获得数据表的第columnIndex列第rowIndex行所对应的元素。\nconnectionName:数据库库的名字,字符串形式;\nsql:SQL语句,字符串形式;\ncolumnIndex:列序号,整形;\nrowIndex:行序号,整形。\n备注:行序号可以不写,这样返回值为数据列。\n示例:\n以我们提供的数据源HSQL为例\nSQL("HSQL","SELECT * FROM CUSTOMER",2,2)等于王先生。',name:"SQL",type:"REPORT"},{def:"DATE(year,month,day): 返回一个表示某一特定日期的系列数。\nYear:代表年,可为一到四位数。\nMonth:代表月份。\n若1 month 12,则函数把参数值作为月。\n若month>12,则函数从年的一月份开始往上累加。例如: DATE(2000,25,2)等于2002年1月2日的系列数。\nDay:代表日。\n若日期小于等于某指定月的天数,则函数将此参数值作为日。\n若日期大于某指定月的天数,则函数从指定月份的第一天开始往上累加。若日期大于两个或多个月的总天数,则函数把减去两个月或多个月的余数加到第三或第四个月上,依此类推。例如:DATE(2000,3,35)等于2000年4月4日的系列数。\n备注:\n 若需要处理公式中日期的一部分,如年或月等,则可用此公式。\n 若年,月和日是函数而不是函数中的常量,则此公式最能体现其作用。\n示例:\nDATE(1978, 9, 19) 等于1978-09-19.\nDATE(1211, 12, 1) 等于1211-12-01. ",name:"DATE",type:"DATETIME"},{def:'BITOPERATIOIN(int,int,op) 位运算,返回两个整数根据op进行位运算后的结果。\nint:十进制整数。\nop:位运算操作符,支持"&"(与),"|"(或),"^"(异或),"<<"(左移),">>"(右移)。\n示例:\nBITOPERATION(4,2,"&")表示4与2进行"与"运算,结果等于0。\nBITOPERATION(4,2,"|")表示4与2进行"或"运算,结果等于6。\nBITOPERATION(4,2,"^")表示4与2进行"异或"运算,结果等于6。\nBITOPERATION(4,2,"<<")表示4按位左移2位,结果等于16。\nBITOPERATION(4,2,">>")表示4按位右移2位,结果等于1。\nBITOPERATION(4,2,"^~")表示4与2进行"同或"运算,结果为-7。',name:"BITOPERATION",type:"LOGIC"},{def:'LOWER(text): 将所有的大写字母转化为小写字母。\nText:需要转化为小写字母的文本串。LOWER函数不转化文本串中非字母的字符。\n示例:\nLOWER("A.M.10:30")等于“a.m.10:30”。\nLOWER("China")等于“china”。',name:"LOWER",type:"TEXT"},{def:"CEILING(number): 将参数number沿绝对值增大的方向,舍入为最接近的整数\nNumber:指待舍入的数值。\nCEILING(-2.5)等于-3。\nCEILING(0.5)等于1。",name:"CEILING",type:"MATH"},{def:"SINH(number):返回某一数字的双曲正弦值。\nnumber:为任意实数。\n示例:\nSINH(1) 等于 1.175201194\nSINH(-1) 等于 -1.175201194",name:"SINH",type:"MATH"},{def:"AND(logical1,logical2,…): 当所有参数的值为真时,返回TRUE;当任意参数的值为假时,返回FALSE。\nLogical1,logical2,…:指1到30个需要检验TRUE或FALSE的条件值。\n备注:\n 参数必须是逻辑值,或是含有逻辑值的数组或引用。\n 如果数组或引用中含有文本或空的单元格,则忽略其值。\n 如果在指定的单元格区域中没有逻辑值,AND函数将返回错误信息*NAME?。\n示例:\nAND(1+7=8,5+7=12)等于TRUE。\nAND(1+7=8,5+7=11)等于FALSE。\n如果单元格A1到A4的值分别为TRUE、TRUE、FALSE和TRUE,则:\nAND(A1:A4)等于FALSE。\n如果单元格A5的值在0~50之间,则: AND(0<A5,A5<50)等于TRUE。",name:"AND",type:"LOGIC"},{def:"NOW():获取当前时间。\n示例:\n如果系统时间是2012年5月12日 15点18分38秒\n则NOW()等于2012-05-12 15:18:36。",name:"NOW",type:"DATETIME"},{def:"排名公式, =SORT(A1)等同于=COUNT(A1[!0]{A1 > $A1}) + 1, 默认升序排列, 如需要降序, 则传递参数false,\n =SORT(A1, false)等同于=COUNT(A1[!0]{A1 < $A1}) + 1.",name:"SORT",type:"HA"},{def:"SIN(number): 计算给定角度的正弦值。\nNumber:待求正弦值的以弧度表示的角度。\n备注:\n 如果参数的单位是度,将其乘以PI()/180即可转换成弧度。\n示例:\nSIN(10)等于-0.5440211108893698。\nSIN(45*PI()/180)等于0.707106781。",name:"SIN",type:"MATH"},{def:"switch(表达式, 值1, 结果1, 值2, 结果2, ...)\n如果表达式的结果是值1,整个函数返回结果1\n如果表达式的结果是值2,整个函数返回结果2\n如果表达式的结果是值3,整个函数返回结果3\n等等\n",name:"SWITCH",type:"LOGIC"},{def:'ROW()返回当前单元格的行号,必须使用于条件属性中\n示例:\n如果当前单元格为A5,在A5中写入"=ROW()"则返回5。\n如果当前单元格为B8,在B8中写入"=ROW()"则返回8。',name:"ROW",type:"REPORT"},{def:'EVAL(exp)返回表达式exp计算后的结果。\nexp:一个表达式形式字符串。\n备注:\n 只要EVAL中的参数exp最终可以转化成一表达式形式的字符串,比如"sum(2,4)","2+7"等等,那么它就可以被计算。\nEVAL("2+5")等于7。\nEVAL("count(2,3)")等于2。\nEVAL("sum"+"(2,3,5)")等于10。\nEVAL(IF(true, "sum", "count") + "(1,2,3,4)")等于10。\nEVAL(IF(false, "sum", "count") + "(1,2,3,4)")等于4。',name:"EVAL",type:"OTHER"},{def:"ATAN(number): 计算指定数值的反正切值。指定数值是返回角度的正切值,返回角度以弧度形式表示。\nNumber:返回角度的正切。\n备注:\n 返回角度在-pi/2到pi/2之间。\n 如果返回角度等于-pi/2或pi/2,ATAN将返回错误信息*NUM!。\n 用角度形式返回数值时,返回数值乘以180/PI()。\n示例:\nATAN(-1)等于-0.785398163(-pi/4弧度)。\nATAN(0)等于0(弧度)。\nATAN(2)*180/PI()等于63.43494882(度)。",name:"ATAN",type:"MATH"},{def:"RANGE(from,to,step)函数表示从整数from开始,以step为每一步的大小,直到整数to的一个数字序列。\n例如:\nRANGE(1,5,1)表示从1开始,直到5(包括5),每一步大小为1,那么它返回一个数字序列为[1,2,3,4,5]。\nRANGE(-1,6,2)表示从-1开始,直到6(包括6),每一步大小为2,那么它返回一个数字序列为[-1,1,3,5]。\n备注:RANGE函数有三种参数形式:\n1 RANGE(to),默认的from为1,step为1,例如:\n RANGE(4)返回[1,2,3,4]。\n RANGE(-5)返回[]。\n2 RANGE(from,to),默认的step为1,例如:\n RANGE(-1,3)返回[-1,0,1,2,3]。\n RANGE(0,5)返回[0,1,2,3,4,5]。\n3 RANGE(from,to,step),三个参数的情况参照上面的注释,例如:\n RANGE(6,-1,-2)返回[6,4,2,0]。\n RANGE(4,1,1)返回[]。",name:"RANGE",type:"ARRAY"},{def:"TANH(number):返回某一数字的双曲正切值。\nnumber:为任意实数。\n双曲正切的计算公式如下:\n示例:\nTANH(-2) 等于 -0.96403\nTANH(0) 等于 0\nTANH(0.5) 等于 0.462117\n",name:"TANH",type:"MATH"},{def:"ROUNDDOWN(number,num_digits):靠近零值,向下(绝对值减小的方向)舍入数字。\nnumber:为需要向下舍入的任意实数。\nnum_digits:舍入后的数字的位数。\n函数 ROUNDDOWN 和函数 ROUND 功能相似,不同之处在于函数 ROUNDDOWN 总是向下舍入数字。\n示例:\nROUNDDOWN(3.2, 0) 等于 3\nROUNDDOWN(76.9,0) 等于 76\nROUNDDOWN(3.14159, 3) 等于 3.141\nROUNDDOWN(-3.14159, 1) 等于 -3.1\nROUNDDOWN(31415.92654, -2) 等于 31,400\n",name:"ROUNDDOWN",type:"MATH"},{def:"循环引用, =CIRCULAR(A1, B1, C1, D1)等同于=IF(&A1 = 1, 0, B1[A1:-1] + C1[A1:-1] – D1[A1:-1]),如需横向, 则传递第五个参数false",name:"CIRCULAR",type:"HA"},{def:'HOUR(serial_number):返回某一指定时间的小时数。函数指定HOUR为0(0:00)到23(23:00)之间的一个整数。\nSerial_number:包含所求小时的时间。\n示例:\nHOUR("11:32:40")等于11。\nHOUR("11:32:40", "HH:mm:ss")等于11。',name:"HOUR",type:"DATETIME"},{def:"ROUND(number,num_digits):返回某个数字按指定位数舍入后的数字。\nnumber:需要进行舍入的数字。\nnum_digits:指定的位数,按此位数进行舍入。\n如果 num_digits 大于 0,则舍入到指定的小数位。\n如果 num_digits 等于 0,则舍入到最接近的整数。\n如果 num_digits 小于 0,则在小数点左侧进行舍入。\n示例:\nROUND(2.15, 1) 等于 2.2\nROUND(2.149, 1) 等于 2.1\nROUND(-1.475, 2) 等于 -1.48\nROUND(21.5, -1) 等于 20\n因浮点数存在精度计算丢失问题, 导致计算结果里可能带上9999, 0000这些, \n因此加入第三个参数来控制是否需要去除9999. true表示需要过滤9999, 0000这些数据.",name:"ROUND",type:"MATH"},{def:'YEARDELTA(date, delta):返回指定日期后delta年的日期。\n示例:\nYEARDELTA("2008-10-10",10)等于2018-10-10。',name:"YEARDELTA",type:"DATETIME"},{def:'DATEINYEAR(date, number):函数返回在一年当中第几天的日期。\n示例:\nDATEINYEAR(2008,100)等于2008-04-09,等价于DATEINYEAR("2008-08-08",100),也返回2008-04-09.\nDATEINYEAR(2008,-1)等于2008-12-31,等价于DATEINYEAR("2008-08-08",-1),也返回2008-12-31.',name:"DATEINYEAR",type:"DATETIME"},{def:"WEIGHTEDAVERAGE(A1:A4,B1:B4): 返回指定数据的加权平均值。\n加权平均数是不同比重数据的平均数,加权平均数就是把原始数据按照合理的比例来计算。\nA1:A4,B1:B4:用于计算平均值的参数,A1~A4为数据,B1~B4为权值。\n示例:\n如果A1:A4为10,9,8,7,B1:B4为0.2,0.1,0.3,0.4则:\nWEIGHTEDAVERAGE(A1:A4,B1:B4)等于8.1。",name:"WEIGHTEDAVERAGE",type:"MATH"},{def:"ASIN(number): 返回指定数值的反正弦值。反正弦值为一个角度,返回角度以弧度形式表示。\nNumber:需要返回角度的正弦值。\n备注:\n 指定数值必须在-1到1之间(含1与-1)。\n 返回角度在-pi/2到pi/2之间(含-pi/2与pi/2)。\n 用角度形式返回数值时,返回数值乘以180/PI()。\n示例:\nASIN(0.5)等于0.523598776(pi/6弧度)。\nASIN(1)等于1.570796327(pi/2弧度)。\nASIN(0.5)*180/PI()等于30(度)。",name:"ASIN",type:"MATH"},{def:"INT(number): 返回数字下舍入(数值减小的方向)后最接近的整数值。\nNumber:需要下舍入为整数的实数。\n示例:\nINT(4.8)等于4。\nINT(-4.8)等于-5。\nINT(4.3)等于4。\nINT(-4.3)等于-5。\n公式INT(A1)将返回A1单元格中的一个正实数的整数数部分。",name:"INT",type:"MATH"},{def:"GETUSERJOBTITLES():返回角色职务\n示例:\nGETUSERDEPARTMENTS():返回角色所有职务,若多个部门职务则返回职务数组",name:"GETUSERJOBTITLES",type:"OTHER"},{def:'REGEXP(str, pattern):字符串str是否与正则表达式pattern相匹配。\n示例:\nREGEXP("aaaaac","a*c")等于true。\nREGEXP("abc","a*c")等于false。\n\nREGEXP(str, pattern, intNumber):字符串str是否与具有给定模式 intNumber的正则表达式pattern相匹配。\n示例:\nCASE_INSENSITIVE = 0 启用不区分大小写的匹配。 默认情况下,不区分大小写的匹配假定仅匹配 US-ASCII 字符集中的字符。可以通过指 定 UNICODE_CASE 标志连同此标志来启用 Unicode 感知的、不区分大小写的匹配。 \nMULTILINE = 1 启用多行模式。\nDOTALL = 2 启用 dotall 模式。在 dotall 模式中,表达式 . 可以匹配任何字符,包括行结束符。默认情况下,此表达式不匹配行 结束符。\nUNICODE_CASE = 3 启用 Unicode 感知的大小写折叠。指定此标志后,由 CASE_INSENSITIVE 标志启用时,不区分大小写的匹配将以 符合 Unicode Standard 的方式完成。\nCANON_EQ = 4 启用规范等价。 指定此标志后,当且仅当其完整规范分解匹配时,两个字符才可视为匹配。\nUNIX_LINES = 5 启用 Unix 行模式。 在此模式中,.、^ 和 $ 的行为中仅识别 \'\\n\' 行结束符。\nLITERAL = 6 启用模式的字面值解析。 指定此标志后,指定模式的输入字符串就会作为字面值字符序列来对待。输入序列中的 元字符或转义序列不具有任何特殊意义。 标志 CASE_INSENSITIVE 和 UNICODE_CASE 在与此标志一起使用时将 对匹配产生影响。其他标志都变得多余了。\nCOMMENTS = 7 模式中允许空白和注释。 此模式将忽略空白和在结束行之前以 # 开头的嵌入式注释。\n \nREGEXP("Aaaaabbbbc","a*b*c", 3)等于true。\nREGEXP("Aaaaabbbbc","a*b*c", 1)等于false。\n\n',name:"REGEXP",type:"TEXT"},{def:'DAYSOFQUARTER(date): 返回从1900年1月后某年某季度的天数。\n示例:\nDAYSOFQUARTER("2009-02-01")等于90。\nDAYSOFQUARTER("2009/05/05")等于91。',name:"DAYSOFQUARTER",type:"DATETIME"},{def:"AVERAGE(number1,number2,…,countstring): 返回指定数据的平均值。\nNumber1,number2…:用于计算平均值的参数; countString:文字、逻辑值是否参与计数。\n备注:\n 参数必须是数字,或是含有数字的名称,数组或引用。\n 如果数组或引用参数中含有文字,逻辑值,默认参与计数,countString为false则不参与计数;\n 空单元格始终不参与计数,但是,单元格中的零值参与。\n示例:\n如果A1:A6被命名为“ages”,分别等于10,23,文字,29,33及25,则:\nAVERAGE(A1:A6)等于20。\nAVERAGE(A1:A6, false)等于24。\nAVERAGE(ages)等于20。\n如果还有一个年龄为27的,求所有年龄的平均值为: AVERAGE(A1:A6,27)等于21。",name:"AVERAGE",type:"MATH"},{def:"RADIANS(angle): 将角度转换成弧度。\nAngle:需要转换为弧度的角度。\n示例:\nRADIANS(90)等于1.570796327(π/2弧度)。",name:"RADIANS",type:"MATH"},{def:"REMOVEARRAY(array, start, deleteCount):从数组array中删除从第start个元素开始的deleteCount个数组元素,并返回删除后的数组。\n示例:\nREMOVEARRAY([3, 4, 4, 2, 6, 7, 87], 4, 2)返回[3, 4, 4, 7, 87].\n",name:"REMOVEARRAY",type:"ARRAY"},{def:"WEBIMAGE(path):在web页面上显示指定路径下的图片。",name:"WEBIMAGE",type:"OTHER"},{def:'WEEK(serial_num):返回一个代表一年中的第几周的数字。\nSerial_num:表示输入的日期。\n备注:\nFineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。\n在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,\n将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。\n示例:\nWEEK("2010/1/1")等于52。\nWEEK("2010/1/6")等于1。\nWEEK(35796)等于1。',name:"WEEK",type:"DATETIME"},{def:"filename(file)获取文件的文件名。\n当file为单文件时,返回文件名字符串,当file为多文件时,返回文件名的字符串数组。\n如果file不为文件类型,则返回错误信息。\n示例:\n假设文件控件在B2单元格,而B2单元格依次上传了三个不同类型文件{A.doc, C.xls ,B.cpt },则filename(B2)返回值为[“A.doc”, “C.xls”, “B.cpt”]。",name:"FILENAME",type:"OTHER"},{def:"COSH(number): 返回一个数值的双曲线余弦值。\nNumber:需要求其双曲线余弦值的一个实数。\n备注:\n 双曲线余弦值计算公式为: ,其中e是自然对数的底,e=2.71828182845904。\n示例:\nCOSH(3)等于10.06766200。\nCOSH(5)等于74.20994852。\nCOSH(6)等于201.7156361。",name:"COSH",type:"MATH"},{def:'WEEKDAY(Serial_number):获取日期并返回星期数。返回值为介于0到6之间的某一整数,分别代表星期中的某一天(从星期日到星期六)。\nSerial_number:输入的日期\n备注:\nFineReport将日期保存为系列数,一个系列数代表一个与之匹配的日期,以方便用户对日期进行数值式计算。\n在1900年日期系统中,FineReport电子表格将1900年1月1日保存为系列数2,将1900年1月2日保存为系列数3,\n将1900年1月3日保存为系列数4……依此类推。如在1900年日期系统,1998年1月1日存为系列数35796。\n举例:\nWEEKDAY("2005/9/10")等于6(星期六)。\nWEEKDAY("2005/9/11")等于0(星期日)。\nWEEKDAY(35796)等于4(星期四)。\n',name:"WEEKDAY",type:"DATETIME"},{def:"OR(logical1,logical2,…): 当所有参数的值为假时,返回FALSE;当任意参数的值为真时,返回TRUE。\nLogical1,logical2,…:指1到30个需要检验TRUE或FALSE的条件值。\n备注:\n 参数必须是逻辑值,或是含有逻辑值的数组或引用。\n 如果数组或引用中含有文本或空的单元格,则忽略其值。\n 如果在指定的单元格区域中没有逻辑值,AND函数将返回错误信息*NAME?。\n示例:\nOR(1+7=9,5+7=11)等于FALSE。\nOR(1+7=8,5+7=11)等于TRUE。",name:"OR",type:"LOGIC"},{def:"MOD(number,divisor):返回两数相除的余数。结果的正负号与除数相同。\nnumber:为被除数。\ndivisor:为除数。\n示例:\nMOD(3, 2) 等于 1\nMOD(-3, 2) 等于 1\nMOD(3, -2) 等于 -1\nMOD(-3, -2) 等于 -1\n",name:"MOD",type:"MATH"},{def:"TODAY():获取当前日期。\n示例:\n如果系统日期是2005年9月10日\n则TODAY()等于2005-9-10。",name:"TODAY",type:"DATETIME"},{def:"ROUNDUP(number,num_digits):远离零值,向上(绝对值增大的方向)舍入数字。\nnumber:为需要向上舍入的任意实数。\nnum_digits:舍入后的数字的位数。\n函数 ROUNDUP 和函数 ROUND 功能相似,不同之处在于函数 ROUNDUP 总是向上舍入数字。\n示例:\nROUNDUP(3.2,0) 等于 4\nROUNDUP(76.9,0) 等于 77\nROUNDUP(3.14159, 3) 等于 3.142\nROUNDUP(-3.14159, 1) 等于 -3.2\nROUNDUP(31415.92654, -2) 等于 31,500\n\n",name:"ROUNDUP",type:"MATH"},{def:"ROUND5(number,num_digits):这个是四舍五入,奇进偶不进。\nnumber:需要进行舍入的数字。\nnum_digits:指定的位数,按此位数进行舍入。\n如果 num_digits 大于 0,则舍入到指定的小数位。\n如果 num_digits 等于 0,则舍入到最接近的整数。\n如果 num_digits 小于 0,则在小数点左侧进行舍入。\n示例:\nROUND5(2.125, 2) 等于 2.12\nROUND5(2.135, 2) 等于 2.14\n",name:"ROUND5",type:"MATH"},{def:"TIME(hour,minute,second): 返回代表指定时间的小数。介于0:00:00(12:00:00 A.M.)与23:59:59(11:59:59 P.M.)之间的时间可返回0到0.99999999之间的对应数值。\nHour:介于0到23之间的数。\nMinute:介于0到59之间的数。\nSecond:介于0到59之间的数。\n示例:\nTIME(14,40,0)等于2:40 PM。\nTIME(19,43,24)等于7:43 PM。",name:"TIME",type:"DATETIME"},{def:"环比公式, =MOM(A1, B1)等同于=IF(&A1 > 1, B1 / B1[A1:-1],0), 其中如果需要指定偏移量x, 则传递第三个参数x, 第四个参数表示横纵向.\n如=MOM(A1, B1, -2, false)等同于=IF(&A1 > 1, B1 / B1[;A1:-2], 0)",name:"MOM",type:"HA"},{def:"ASINH(number): 返回指定数值的反双曲正弦值。反双曲正弦值的双曲正弦等于指定数值。即: ASINH(SINH(number))=number。\nNumber:任意实数。\n示例:\nASINH(-5)等于-2.312438341。\nASINH(8)等于2.776472281。\nASINH(16)等于3.466711038。",name:"ASINH",type:"MATH"},{def:"EENNUMBER(value):将给定的BigDecimal类型的数字(100以内)取整后转化成英文金额的字符串。\n示例:\nENNUMBER(23.49)等于TWENTY THREE。\n注:若出现结果为空,需要将数字强制转换为BigDecimal类型,例如:ENNUMBER(TOBIGDECIMAL(80))",name:"ENNUMBER",type:"TEXT"},{def:'CODE(text): 计算文本串中第一个字符的数字代码。返回的代码对应于计算机使用的字符集。\nText:需要计算第一个字符代码的文本或单元格引用。\n示例:\nCODE("S")等于83。\nCODE("Spreadsheet")等于83。',name:"CODE",type:"TEXT"},{def:"DEGREES(angle): 将弧度转化为度。\nangle:待转换的弧度角。\n示例:\nDEGREES(PI()/2)等于90。\nDEGREES(3.1415926)等于179.9999969。",name:"DEGREES",type:"MATH"},{def:"LEN(args): 返回文本串中的字符数或者数组的长度。\n需要注意的是:参数args为文本串时,空格也计为字符。\n参数args为数组时,直接返回数组长度。\n示例:\nLEN(\"Evermore software\")等于17。\nLEN(\" \")等于1。\nLEN(['a','b'])等于2。\n",name:"LEN",type:"TEXT"},{def:"DATETIME():获取当前日期和时间。\n示例:\n如果系统时间是2005年9月10日 15点18分38秒\n则DATETIME()等于2005-9-10 15:18:36。",name:"DATETIME",type:"DELETE"},{def:"UNIQUEARRAY(array):去掉数组array中的重复元素。\n示例:\nUNIQUEARRAY([14, 2, 3, 4, 3, 2, 5, 6, 2, 7, 9, 12, 3])返回[14, 2, 3, 4, 5, 6, 7, 9, 12].",name:"UNIQUEARRAY",type:"ARRAY"},{def:"PROMOTION(value1,value2):返回value2在value1上提升的比例。\n示例:\nPROMOTION(12, 14)等于0.166666666,即提升了16.6666666%.\nPROMOTION(-12, 14)等于2.166666666,即提升了216.6666666%.",name:"PROMOTION",type:"MATH"},{def:"PI(number): 是一个数学常量函数,当number为空时,函数返回精确到15位的数值3.141592653589793;当参数不为空时,number表示PI的倍数。\n示例:\nSIN(PI()/2)等于1。\n计算圆的面积的公式: S=PI()*(r^2),其中S为圆的面积,R为圆的半径。\nPI(3)等于9.42477796076938。",name:"PI",type:"MATH"},{def:"ISNULL(object):判断对象中所有的值是否全部都是NULL或者为空字符串。",name:"ISNULL",type:"OTHER"},{def:"LET(变量名,变量值,变量名,变量值,..., 表达式):局部变量赋值函数,参数的个数N必须为奇数, 最后一个是表达式,前面是N-1(偶数)为局部变量赋值对。\n变量名: 必须是合法的变量名,以字母开头,可以包括字母,数字和下划线\n表达式: 根据前面的N-1个参数赋值后计算出来的结果,这些变量赋值只在这个表达式内部有效\n示例:\nLET(a, 5,b, 6, a+b)等于11\n",name:"LET",type:"OTHER"},{def:'SECOND(serial_number):返回某一指定时间的秒数,其值是介于0与59之间的一个整数。\nSerial_number:包含所求秒数的时间。\n示例:\nSECOND("15:36:25")等于25。\nSECOND("15:36:25", "HH:mm:ss")等于25。',name:"SECOND",type:"DATETIME"},{def:"EXP(number): 返回e的n次幂。常数e为自然对数的底数,等于2.71828182845904。\nNumber:为任意实数,作为常数e的指数。\n备注:\n 如果要返回其他常数作为底数的幂,可以使用指数运算符(^)。例如: 在4^2中,4是底数,而2是指数。\n EXP函数与LN函数互为反函数。\n示例:\nEXP(0)等于1。\nEXP(3)等于20.08553692。\nEXP(LN(2))等于2。",name:"EXP",type:"MATH"},{def:'treelayer(TreeObject, Int, Boolean, String):\n返回tree对象第n层的值,并且可以设置返回值类型及分隔符。\nTreeObject:tree对象,如$tree。\nInt:想要获得层级的数值,最上层为1,第二层为2,依此类推,若无则返回最底层\n。Boolean:返回值类型为字符串还是数组,默认false,返回数组;为true时返回字符串。\nString:当Boolean为true返回字符串时的分隔符,以双引号表示,默认为逗号",",如";"。\n示例:\n假设$tree勾选的值为中国-江苏-南京,中国-浙江-杭州,则treelayer($tree, true, ”\\’,\\’”):返回”’,’”分割的所选中节点字符串”南京’,’杭州”treelayer($tree, 2):以数组形式返回第二层[“江苏”,”浙江”]。treelayer($tree, 2, true, ”\\’,\\’”):返回”’,’”分割的字符串江苏’,’浙江。',name:"TREELAYER",type:"OTHER"},{def:"读取配置文件",name:"TOTEXT",type:"DELETE"}],BI.Pane=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Pane.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-pane",tipText:BI.i18nText("BI-No_Selected_Item"),overlap:!0,onLoaded:BI.emptyFn})},_init:function(){BI.Pane.superclass._init.apply(this,arguments)},_assertTip:function(){var a=this.options;this._tipText||(this._tipText=BI.createWidget({type:"bi.label",cls:"bi-tips",text:a.tipText,height:25}),BI.createWidget({type:"bi.vertical",element:this,items:[this._tipText],bgap:25}))},loading:function(){var a=this,b=this.options;b.overlap===!0?(BI.Layers.has(this.getName())||BI.createWidget({type:"bi.vtape",items:[{el:{type:"bi.layout",cls:"loading-background"},height:30}],element:BI.Layers.make(this.getName(),this)}),BI.Layers.show(a.getName())):BI.isNull(this._loading)&&(this._loading=BI.createWidget({type:"bi.layout",cls:"loading-background",height:30}),this._loading.element.css("zIndex",1),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this._loading,left:0,right:0,top:0}]}))},loaded:function(){var a=this,b=this.options;BI.Layers.remove(a.getName()),this._loading&&this._loading.destroy(),this._loading&&(this._loading=null),b.onLoaded(),a.fireEvent(BI.Pane.EVENT_LOADED)},check:function(){this.setTipVisible(BI.isEmpty(this.options.items))},setTipVisible:function(a){a===!0?(this._assertTip(),this._tipText.setVisible(!0)):this._tipText&&this._tipText.setVisible(!1)},populate:function(a){this.options.items=a||[],this.check()},empty:function(){}}),BI.Pane.EVENT_LOADED="EVENT_LOADED",BI.Single=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.Single.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-single",readonly:!1,title:null,warningTitle:null,tipType:null,value:null})},_showToolTip:function(a,b){b||(b={});var c=this.getTipType()||(this.isEnabled()?"success":"warning"),d="success"===c?this.getTitle():this.getWarningTitle()||this.getTitle();BI.isKey(d)&&BI.Tooltips.show(a,this.getName(),d,c,this,b)},_hideTooltip:function(){var a=this,b=BI.Tooltips.get(this.getName());BI.isNotNull(b)&&b.element.fadeOut(200,function(){BI.Tooltips.remove(a.getName())})},_init:function(){BI.Single.superclass._init.apply(this,arguments);var a=this.options;(BI.isKey(a.title)||BI.isKey(a.warningTitle)||BI.isFunction(a.title)||BI.isFunction(a.warningTitle))&&this.enableHover()},enableHover:function(a){a||(a={});var b=this;this._hoverBinded||(this.element.on("mouseenter.title"+this.getName(),function(c){b._e=c,"warning"===b.getTipType()||BI.isKey(b.getWarningTitle())&&!b.isEnabled()?b.timeout=BI.delay(function(){b._showToolTip(b._e||c,a)},200):("success"===b.getTipType()||b.isEnabled())&&(b.timeout=BI.delay(function(){b._showToolTip(b._e||c,a)},500))}),this.element.on("mousemove.title"+this.getName(),function(a){b._e=a,b.element.__isMouseInBounds__(a)||(BI.isNotNull(b.timeout)&&clearTimeout(b.timeout),b._hideTooltip())}),this.element.on("mouseleave.title"+this.getName(),function(){b._e=null,BI.isNotNull(b.timeout)&&clearTimeout(b.timeout),b._hideTooltip()}),this._hoverBinded=!0)},disabledHover:function(){BI.isNotNull(this.timeout)&&clearTimeout(this.timeout),this._hideTooltip(),$(this.element).unbind("mouseenter.title"+this.getName()).unbind("mousemove.title"+this.getName()).unbind("mouseleave.title"+this.getName()),this._hoverBinded=!1},populate:function(a){this.items=a||[]},setTitle:function(a,b){this.options.title=a,BI.isKey(a)?this.enableHover(b):this.disabledHover()},setWarningTitle:function(a,b){this.options.warningTitle=a,BI.isKey(a)?this.enableHover(b):this.disabledHover()},getTipType:function(){return this.options.tipType},isReadOnly:function(){return!!this.options.readonly},getTitle:function(){var a=this.options.title;return BI.isFunction(a)?a():a},getWarningTitle:function(){var a=this.options.warningTitle;return BI.isFunction(a)?a():a},setValue:function(a){this.options.readonly||(this.options.value=a)},getValue:function(){return this.options.value}}),BI.Text=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.Text.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-text",textAlign:"left",whiteSpace:"normal",lineHeight:null,handler:null,hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0,text:"",py:""})},_init:function(){BI.Text.superclass._init.apply(this,arguments);var a=this,b=this.options;b.hgap+b.lgap>0&&this.element.css({"padding-left":b.hgap+b.lgap+"px"}),b.hgap+b.rgap>0&&this.element.css({"padding-right":b.hgap+b.rgap+"px"}),b.vgap+b.tgap>0&&this.element.css({"padding-top":b.vgap+b.tgap+"px"}),b.vgap+b.bgap>0&&this.element.css({"padding-bottom":b.vgap+b.bgap+"px"}),BI.isNumber(b.height)&&this.element.css({lineHeight:b.height+"px"}),BI.isNumber(b.lineHeight)&&this.element.css({lineHeight:b.lineHeight+"px"}),this.element.css({textAlign:b.textAlign,whiteSpace:b.whiteSpace}),b.handler?(this.text=BI.createWidget({type:"bi.layout",tagName:"span"}),this.text.element.click(function(){b.handler(a.getValue())}),BI.createWidget({type:"bi.default",element:this,items:[this.text]})):this.text=this,BI.isKey(b.text)?this.setText(b.text):BI.isKey(b.value)&&this.setText(b.value),BI.isKey(b.keyword)&&this.text.element.__textKeywordMarked__(b.text,b.keyword,b.py)},doRedMark:function(a){var b=this.options;this.text.element.__textKeywordMarked__(b.text||b.value,a,b.py)},unRedMark:function(){var a=this.options;this.text.element.__textKeywordMarked__(a.text||a.value,"",a.py)},doHighLight:function(){this.text.element.addClass("bi-high-light")},unHighLight:function(){this.text.element.removeClass("bi-high-light")},setValue:function(a){BI.Text.superclass.setValue.apply(this,arguments),this.isReadOnly()||this.setText(a)},setStyle:function(a){this.text.element.css(a)},setText:function(a){BI.Text.superclass.setText.apply(this,arguments),this.options.text=a,this.text.element.html(BI.htmlEncode(a))}}),BI.shortcut("bi.text",BI.Text),BI.BasicButton=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.BasicButton.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-basic-button"+(a.invalid?"":" cursor-pointer"),value:"",text:"",stopEvent:!1,stopPropagation:!1,selected:!1,once:!1,forceSelected:!1,forceNotSelected:!1,disableSelected:!1,shadow:!1,isShadowShowingOnSelected:!1,trigger:null,handler:BI.emptyFn})},_init:function(){BI.BasicButton.superclass._init.apply(this,arguments);var a=this.options;a.selected===!0&&BI.nextTick(BI.bind(function(){this.setSelected(a.selected)},this)),BI.nextTick(BI.bind(this.bindEvent,this)),a.shadow&&this._createShadow()},_createShadow:function(){var a=this,b=this.options,c=function(){a.$mask||(a.$mask=BI.createWidget(BI.isObject(b.shadow)?b.shadow:{},{type:"bi.layout",cls:"bi-button-mask"}),a.$mask.invisible(),BI.createWidget({type:"bi.absolute",element:a,items:[{el:a.$mask,left:0,right:0,top:0,bottom:0}]}))};this.element.mouseup(function(){a._hover||b.isShadowShowingOnSelected||(c(),a.$mask.invisible())}),this.element.on("mouseenter."+this.getName(),function(d){a.element.__isMouseInBounds__(d)&&(!a.isEnabled()||a._hover||!b.isShadowShowingOnSelected&&a.isSelected()||(c(),a.$mask.visible()))}),this.element.on("mousemove."+this.getName(),function(b){a.element.__isMouseInBounds__(b)||a.isEnabled()&&!a._hover&&(c(),a.$mask.invisible())}),this.element.on("mouseleave."+this.getName(),function(){a.isEnabled()&&!a._hover&&(c(),a.$mask.invisible())})},bindEvent:function(){function a(a){d.stopEvent&&a.stopEvent(),d.stopPropagation&&a.stopPropagation()}function b(b){a(b),!c.isEnabled()||c.isOnce()&&c.isSelected()||g.apply(c,arguments)}var c=this,d=this.options,e=this.handle();if(e){e=e.element;var f=(d.trigger||"").split(",");BI.each(f,function(f,g){switch(g){case"mouseup":var h=!1;e.mousedown(function(){h=!0}),e.mouseup(function(c){h===!0&&b(c),h=!1,a(c)});break;case"mousedown":var h=!1,i=!1;e.mousedown(function(d){$(document).bind("mouseup."+c.getName(),function(a){!BI.DOM.isExist(c)||e.__isMouseInBounds__(a)||h!==!0||i||c._trigger(),h=!1,$(document).unbind("mouseup."+c.getName())}),h!==!0&&(c.isSelected()?i=!0:b(d),h=!0,a(d))}),e.mouseup(function(a){BI.DOM.isExist(c)&&h===!0&&i===!0&&b(a),h=!1,i=!1,$(document).unbind("mouseup."+c.getName())});break;case"dblclick":e.dblclick(b);break;case"lclick":var j,h=!1;e.mousedown(function(b){$(document).bind("mouseup."+c.getName(),function(a){j&&clearInterval(j),j=null,h=!1,$(document).unbind("mouseup."+c.getName())}),h!==!0&&(!c.isEnabled()||c.isOnce()&&c.isSelected()||(j=setInterval(function(){c.isEnabled()&&c.doClick()},100),h=!0,a(b)))});break;default:(d.stopEvent||d.stopPropagation)&&e.mousedown(function(b){a(b)}),e.click(b)}});var g=BI.debounce(this._doClick,BI.EVENT_RESPONSE_TIME,!0)}},_trigger:function(){var a=this.options;if(this.isEnabled()&&(this.isDisableSelected()||(this.isForceSelected()?this.setSelected(!0):this.isForceNotSelected()?this.setSelected(!1):this.setSelected(!this.isSelected())),this.isValid())){a.handler.call(this,this.getValue(),this);var b=this.getValue();this.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.CLICK,b,this),this.fireEvent(BI.BasicButton.EVENT_CHANGE,b,this),a.action&&BI.Actions.runAction(a.action,a)}},_doClick:function(a){this.isValid()&&this.beforeClick(a),this._trigger(),this.isValid()&&this.doClick(a)},beforeClick:function(){},doClick:function(){},handle:function(){return this},hover:function(){this._hover=!0,this.handle().element.addClass("hover"),this.options.shadow&&this.$mask&&this.$mask.setVisible(!0)},dishover:function(){this._hover=!1,this.handle().element.removeClass("hover"),this.options.shadow&&this.$mask&&this.$mask.setVisible(!1)},setSelected:function(a){var b=this.options;b.selected=a,a?this.handle().element.addClass("active"):this.handle().element.removeClass("active"),b.shadow&&!b.isShadowShowingOnSelected&&this.$mask&&this.$mask.setVisible(!1)},isSelected:function(){return this.options.selected},isOnce:function(){return this.options.once},isForceSelected:function(){return this.options.forceSelected},isForceNotSelected:function(){return this.options.forceNotSelected},isDisableSelected:function(){return this.options.disableSelected},setText:function(a){this.options.text=a},getText:function(){return this.options.text},_setEnable:function(a){BI.BasicButton.superclass._setEnable.apply(this,arguments),a===!0?this.element.removeClass("base-disabled disabled"):a===!1&&this.element.addClass("base-disabled disabled"),a||this.options.shadow&&this.$mask&&this.$mask.setVisible(!1)},empty:function(){$(document).unbind("mouseup."+this.getName()),BI.BasicButton.superclass.empty.apply(this,arguments)},destroy:function(){BI.BasicButton.superclass.destroy.apply(this,arguments)}}),BI.BasicButton.EVENT_CHANGE="BasicButton.EVENT_CHANGE",BI.NodeButton=BI.inherit(BI.BasicButton,{_defaultConfig:function(){var a=BI.NodeButton.superclass._defaultConfig.apply(this,arguments);
return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-node",open:!1})},_init:function(){BI.NodeButton.superclass._init.apply(this,arguments);var a=this;BI.nextTick(function(){a.setOpened(a.isOpened())})},doClick:function(){BI.NodeButton.superclass.doClick.apply(this,arguments),this.setOpened(!this.isOpened())},isOnce:function(){return!1},isOpened:function(){return!!this.options.open},setOpened:function(a){this.options.open=!!a},triggerCollapse:function(){this.isOpened()&&(this.setOpened(!1),this.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.COLLAPSE,this.getValue(),this))},triggerExpand:function(){this.isOpened()||(this.setOpened(!0),this.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.EXPAND,this.getValue(),this))}}),BI.Tip=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.Link.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-tip",zIndex:BI.zIndex_tip})},_init:function(){BI.Tip.superclass._init.apply(this,arguments),this.element.css({zIndex:this.options.zIndex})}}),BI.ButtonGroup=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ButtonGroup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-button-group",behaviors:{},items:[],chooseType:BI.Selection.Single,layouts:[{type:"bi.center",hgap:0,vgap:0}]})},_init:function(){BI.ButtonGroup.superclass._init.apply(this,arguments);var a={};BI.each(this.options.behaviors,function(b,c){a[b]=BI.BehaviorFactory.createBehavior(b,{rule:c})}),this.behaviors=a,this.populate(this.options.items)},_createBtns:function(a){this.options;return BI.createWidgets(BI.createItems(a,{type:"bi.text_button"}))},_btnsCreator:function(a){var b=this,c=Array.prototype.slice.call(arguments),d=this.options,e=this._createBtns(a);return c[0]=e,BI.each(this.behaviors,function(a,b){b.doBehavior.apply(b,c)}),BI.each(e,function(a,c){c.on(BI.Controller.EVENT_CHANGE,function(a,e,f){if(a===BI.Events.CLICK){switch(d.chooseType){case BI.ButtonGroup.CHOOSE_TYPE_SINGLE:b.setValue(c.getValue());break;case BI.ButtonGroup.CHOOSE_TYPE_NONE:b.setValue([])}b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b.fireEvent(BI.ButtonGroup.EVENT_CHANGE,e,f)}else b.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),c.on(BI.Events.DESTROY,function(){BI.remove(b.buttons,c)})}),e},_packageBtns:function(a){for(var b=this.options,c=b.layouts.length-1;c>0;c--)a=BI.map(a,function(a,d){return BI.extend({},b.layouts[c],{items:[BI.extend({},b.layouts[c].el,{el:d})]})});return a},_packageSimpleItems:function(a){var b=this.options;return BI.map(b.items,function(b,c){return BI.stripEL(c)===c?a[b]:BI.extend({},c,{el:a[b]})})},_packageItems:function(a,b){return BI.createItems(BI.makeArrayByArray(a,{}),BI.clone(b))},_packageLayout:function(a){for(var b=this.options,c=BI.deepClone(b.layouts[0]),d=BI.formatEL(c).el;d&&d.items&&!BI.isEmpty(d.items);)d=BI.formatEL(d.items[0]).el;return d.items=a,c},_isSimpleLayout:function(){var a=this.options;return 1===a.layouts.length&&!BI.isArray(a.items[0])},doBehavior:function(){var a=Array.prototype.slice.call(arguments);a.unshift(this.buttons),BI.each(this.behaviors,function(b,c){c.doBehavior.apply(c,a)})},prependItems:function(a){var b=(this.options,this._btnsCreator.apply(this,arguments));return this.buttons=BI.concat(b,this.buttons),this._isSimpleLayout()&&this.layouts&&this.layouts.prependItems?void this.layouts.prependItems(b):(a=this._packageItems(a,this._packageBtns(b)),void this.layouts.prependItems(this._packageLayout(a).items))},addItems:function(a){var b=(this.options,this._btnsCreator.apply(this,arguments));return this.buttons=BI.concat(this.buttons,b),this._isSimpleLayout()&&this.layouts&&this.layouts.addItems?void this.layouts.addItems(b):(a=this._packageItems(a,this._packageBtns(b)),void this.layouts.addItems(this._packageLayout(a).items))},removeItemAt:function(a){BI.removeAt(this.buttons,a),this.layouts.removeItemAt(a)},removeItems:function(a){a=BI.isArray(a)?a:[a];var b=[];BI.each(this.buttons,function(c,d){BI.deepContains(a,d.getValue())&&b.push(c)}),BI.removeAt(this.buttons,b),this.layouts.removeItemAt(b)},populate:function(a){a=a||[],this.empty(),this.options.items=a,this.buttons=this._btnsCreator.apply(this,arguments),a=this._isSimpleLayout()?this._packageSimpleItems(this.buttons):this._packageItems(a,this._packageBtns(this.buttons)),this.layouts=BI.createWidget(BI.extend({element:this},this._packageLayout(a)))},setNotSelectedValue:function(a){a=BI.isArray(a)?a:[a],BI.each(this.buttons,function(b,c){BI.deepContains(a,c.getValue())?c.setSelected&&c.setSelected(!1):c.setSelected&&c.setSelected(!0)})},setEnabledValue:function(a){a=BI.isArray(a)?a:[a],BI.each(this.buttons,function(b,c){BI.deepContains(a,c.getValue())?c.setEnable(!0):c.setEnable(!1)})},setValue:function(a){a=BI.isArray(a)?a:[a],BI.each(this.buttons,function(b,c){BI.deepContains(a,c.getValue())?c.setSelected&&c.setSelected(!0):c.setSelected&&c.setSelected(!1)})},getNotSelectedValue:function(){var a=[];return BI.each(this.buttons,function(b,c){!c.isEnabled()||c.isSelected&&c.isSelected()||a.push(c.getValue())}),a},getValue:function(){var a=[];return BI.each(this.buttons,function(b,c){c.isEnabled()&&c.isSelected&&c.isSelected()&&a.push(c.getValue())}),a},getAllButtons:function(){return this.buttons},getAllLeaves:function(){return this.buttons},getSelectedButtons:function(){var a=[];return BI.each(this.buttons,function(b,c){c.isSelected&&c.isSelected()&&a.push(c)}),a},getNotSelectedButtons:function(){var a=[];return BI.each(this.buttons,function(b,c){c.isSelected&&!c.isSelected()&&a.push(c)}),a},getIndexByValue:function(a){var b=-1;return BI.any(this.buttons,function(c,d){if(d.isEnabled()&&d.getValue()===a)return b=c,!0}),b},getNodeById:function(a){var b;return BI.any(this.buttons,function(c,d){if(d.isEnabled()&&d.options.id===a)return b=d,!0}),b},getNodeByValue:function(a){var b;return BI.any(this.buttons,function(c,d){if(d.isEnabled()&&d.getValue()===a)return b=d,!0}),b},empty:function(){BI.ButtonGroup.superclass.empty.apply(this,arguments),this.options.items=[]},destroy:function(){BI.ButtonGroup.superclass.destroy.apply(this,arguments),this.options.items=[]}}),BI.extend(BI.ButtonGroup,{CHOOSE_TYPE_SINGLE:BI.Selection.Single,CHOOSE_TYPE_MULTI:BI.Selection.Multi,CHOOSE_TYPE_ALL:BI.Selection.All,CHOOSE_TYPE_NONE:BI.Selection.None,CHOOSE_TYPE_DEFAULT:BI.Selection.Default}),BI.ButtonGroup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.button_group",BI.ButtonGroup),BI.ButtonTree=BI.inherit(BI.ButtonGroup,{_defaultConfig:function(){return BI.extend(BI.ButtonTree.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-button-tree"})},_init:function(){BI.ButtonTree.superclass._init.apply(this,arguments)},setNotSelectedValue:function(a){a=BI.isArray(a)?a:[a],BI.each(this.buttons,function(b,c){return BI.isFunction(c.setSelected)?void(BI.deepContains(a,c.getValue())?c.setSelected(!1):c.setSelected(!0)):void c.setNotSelectedValue(a)})},setEnabledValue:function(a){a=BI.isArray(a)?a:[a],BI.each(this.buttons,function(b,c){return BI.isFunction(c.setEnabledValue)?void c.setEnabledValue(a):void(BI.deepContains(a,c.getValue())?c.setEnable(!0):c.setEnable(!1))})},setValue:function(a){a=BI.isArray(a)?a:[a],BI.each(this.buttons,function(b,c){return BI.isFunction(c.setSelected)?void(BI.deepContains(a,c.getValue())?c.setSelected(!0):c.setSelected(!1)):void c.setValue(a)})},getNotSelectedValue:function(){var a=[];return BI.each(this.buttons,function(b,c){return c.isEnabled()&&!BI.isFunction(c.setSelected)?void(a=BI.concat(a,c.getNotSelectedValue())):void(c.isEnabled()&&c.isSelected&&!c.isSelected()&&a.push(c.getValue()))}),a},getValue:function(){var a=[];return BI.each(this.buttons,function(b,c){return c.isEnabled()&&!BI.isFunction(c.setSelected)?void(a=BI.concat(a,c.getValue())):void(c.isEnabled()&&c.isSelected&&c.isSelected()&&a.push(c.getValue()))}),a},getSelectedButtons:function(){var a=[];return BI.each(this.buttons,function(b,c){return c.isEnabled()&&!BI.isFunction(c.setSelected)?void(a=a.concat(c.getSelectedButtons())):void(c.isSelected&&c.isSelected()&&a.push(c))}),a},getNotSelectedButtons:function(){var a=[];return BI.each(this.buttons,function(b,c){return c.isEnabled()&&!BI.isFunction(c.setSelected)?void(a=a.concat(c.getNotSelectedButtons())):void(c.isSelected&&!c.isSelected()&&a.push(c))}),a},getAllLeaves:function(){var a=[];return BI.each(this.buttons,function(b,c){return c.isEnabled()&&!BI.isFunction(c.setSelected)?void(a=a.concat(c.getAllLeaves())):void(c.isEnabled()&&a.push(c))}),a},getIndexByValue:function(a){var b=-1;return BI.any(this.buttons,function(c,d){var e=d.getValue();if(d.isEnabled()&&(e===a||BI.contains(e,a)))return b=c,!0}),b},getNodeById:function(a){var b;return BI.any(this.buttons,function(c,d){if(d.isEnabled()){if(d.attr("id")===a)return b=d,!0;if(BI.isFunction(d.getNodeById)&&(b=d.getNodeById(a)))return!0}}),b},getNodeByValue:function(a){var b;return BI.any(this.buttons,function(c,d){if(d.isEnabled())if(BI.isFunction(d.getNodeByValue)){if(b=d.getNodeByValue(a))return!0}else if(d.attr("value")===a)return b=d,!0}),b}}),BI.ButtonTree.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.button_tree",BI.ButtonTree),BI.TreeView=BI.inherit(BI.Pane,{_defaultConfig:function(){return BI.extend(BI.TreeView.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-tree",paras:{},itemsCreator:BI.emptyFn})},_init:function(){BI.TreeView.superclass._init.apply(this,arguments),this._stop=!1,this._createTree(),this.tip=BI.createWidget({type:"bi.loading_bar",invisible:!0,handler:BI.bind(this._loadMore,this)}),BI.createWidget({type:"bi.vertical",scrollable:!0,scrolly:!1,element:this,items:[this.tip]})},_createTree:function(){this.id="bi-tree"+BI.UUID(),this.nodes&&this.nodes.destroy(),this.tree&&this.tree.destroy(),this.tree=BI.createWidget({type:"bi.layout",element:"<ul id='"+this.id+"' class='ztree'></ul>"}),BI.createWidget({type:"bi.default",element:this.element,items:[this.tree]})},_selectTreeNode:function(a,b){this.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.CLICK,b,this),this.fireEvent(BI.TreeView.EVENT_CHANGE,b,this)},_configSetting:function(){function a(a,b,c){l.nodes.checkNode(c,!c.checked,!0,!0)}function b(a,b){var c=l._getParentValues(b);b.times=b.times||1;var d="id="+b.id+"&times="+b.times++ +"&parentValues= "+window.encodeURIComponent(BI.jsonEncode(c))+"&checkState="+window.encodeURIComponent(BI.jsonEncode(b.getCheckStatus()));return BI.servletURL+"?op="+l.options.op+"&cmd="+l.options.cmd+"&"+d}function c(a,b){return b.isAjaxing?(BI.Msg.toast("Please Wait。","warning"),!1):(b.children||(b.times=1,f(b,"refresh")),!0)}function d(a,b,c,d){if(c.halfCheck=!1,d&&0!==d.length&&!/^<html>[\s,\S]*<\/html>$/gi.test(d)&&!l._stop){var e=l.nodes,g=c.count||0;c.children.length>g?(c.count=c.children.length,BI.delay(function(){f(c)},n)):(e.updateNode(c),e.selectNode(c.children[0]))}}function e(a,b,c,d,e,f){l.nodes;BI.Msg.toast("Error!","warning")}function f(a,b){var c=l.nodes;"refresh"==b&&c.updateNode(a),c.reAsyncChildNodes(a,b,!0)}function g(a,b){function c(a){BI.each(a,function(a,b){b.halfCheck===!0&&(b.halfCheck=!1,c(b.children))})}if(b.halfCheck=!1,b.checked===!0){c(b.children);var d=l.nodes,e=d.getSelectedNodes();$.each(e,function(a,b){b.halfCheck=!1})}}function h(a,b,c){l._selectTreeNode(b,c)}function i(a,b,c){c.halfCheck=!1}function j(a,b,c){}var k=this.options.paras,l=this,m={async:{enable:!0,url:b,autoParam:["id","name"],otherParam:BI.cjkEncodeDO(k)},check:{enable:!0},data:{key:{title:"title",name:"text"},simpleData:{enable:!0}},view:{showIcon:!1,expandSpeed:"",nameIsHTML:!0,dblClickExpand:!1},callback:{beforeExpand:c,onAsyncSuccess:d,onAsyncError:e,beforeCheck:g,onCheck:h,onExpand:i,onCollapse:j,onClick:a}},n=100;return m},_getParentValues:function(a){if(!a.getParentNode())return[];var b=a.getParentNode(),c=this._getParentValues(b);return c=c.concat([this._getNodeValue(b)])},_getNodeValue:function(a){return null==a.value?a.text.replace(/<[^>]+>/g,"").replaceAll("&nbsp;"," "):a.value},_getHalfSelectedValues:function(a,b){var c=this,d=b.getCheckStatus();if(d.checked!==!1||d.half!==!1){if(BI.isNotEmptyArray(b.children)&&d.half===!0){var e=b.children;return void BI.each(e,function(b,d){c._getHalfSelectedValues(a,d)})}var f=b.parentValues||c._getParentValues(b),g=f.concat(this._getNodeValue(b));if(BI.isNotEmptyArray(b.children)||d.half===!1)return void this._buildTree(a,g);var h=BI.deepClone(this.options.paras.selectedValues),i=this._getTree(h,g);this._addTreeNode(a,f,this._getNodeValue(b),i)}},_getTree:function(a,b){var c=a;return BI.any(b,function(a,b){return null==c[b]||void(c=c[b])}),c},_addTreeNode:function(a,b,c,d){var e=a;BI.each(b,function(a,b){null==e[b]&&(e[b]={}),e=e[b]}),e[c]=d},_buildTree:function(a,b){var c=a;BI.each(b,function(a,b){null==c[b]&&(c[b]={}),c=c[b]})},_getSelectedValues:function(){function a(a){BI.each(a,function(a,d){var e=d.getCheckStatus();if(e.checked===!0||e.half===!0)if(e.half===!0)b._getHalfSelectedValues(c,d);else{var f=d.parentValues||b._getParentValues(d),g=f.concat([b._getNodeValue(d)]);b._buildTree(c,g)}})}var b=this,c={},d=this.nodes.getNodes();return a(d),c},_dealWidthNodes:function(a){var b=this.options,c=BI.Tree.arrayFormat(a);return BI.each(c,function(a,c){c.title=c.title||c.text||c.value,BI.isKey(b.paras.keyword)?c.text=$("<div>").__textKeywordMarked__(c.text,b.paras.keyword,c.py).html():c.text=(c.text+"").replaceAll(" ","&nbsp;")}),a},_loadMore:function(){var a=this,b=this.options;this.tip.setLoading();var c=BI.extend({},b.paras,{times:++this.times});b.itemsCreator(c,function(b){if(a._stop!==!0){var c=!!b.hasNext,d=b.items||[];c?a.tip.setLoaded():a.tip.setEnd(),d.length>0&&a.nodes.addNodes(null,a._dealWidthNodes(d))}})},_initTree:function(a){var b=this,c=this.options;b.fireEvent(BI.Events.INIT),this.times=1;var d=this.tree;d.empty(),this.loading(),this.tip.setVisible(!1);var e=function(c){b._stop!==!0&&(b.nodes=$.fn.zTree.init(d.element,a,c))},f=BI.extend({},c.paras,{times:1});c.itemsCreator(f,function(a){if(b._stop!==!0){var c=!!a.hasNext,d=a.items||[];d.length>0&&e(b._dealWidthNodes(d)),b.setTipVisible(d.length<=0),b.loaded(),c?b.tip.setLoaded():b.tip.invisible(),1===f.times&&b.fireEvent(BI.Events.AFTERINIT)}})},initTree:function(a,b){var b=b||{async:{enable:!1},check:{enable:!1},data:{key:{title:"title",name:"text"},simpleData:{enable:!0}},view:{showIcon:!1,expandSpeed:"",nameIsHTML:!0},callback:{}};this.nodes=$.fn.zTree.init(this.tree.element,b,a)},start:function(){this._stop=!1},stop:function(){this._stop=!0},stroke:function(a){delete this.options.keyword,BI.extend(this.options.paras,a);var b=this._configSetting();this._createTree(),this.start(),this._initTree(b)},populate:function(){this.stroke.apply(this,arguments)},hasChecked:function(){var a=this.nodes;return a.getCheckedNodes(!0).length>0},checkAll:function(a){function b(a){BI.each(a,function(a,c){c.halfCheck=!1,b(c.children)})}BI.each(this.nodes.getNodes(),function(a,c){c.halfCheck=!1,b(c.children)}),this.nodes&&this.nodes.checkAllNodes(a)},expandAll:function(a){this.nodes&&this.nodes.expandAll(a)},setValue:function(a,b){this.checkAll(!1),this.updateValue(a,b),this.refresh()},setSelectedValue:function(a){this.options.paras.selectedValues=BI.deepClone(a||{})},updateValue:function(a,b){if(this.nodes){b||(b="value");var c=this.nodes;BI.each(a,function(a,d){var e=c.getNodesByParam(b,a,null);BI.each(e,function(a,b){BI.extend(b,{checked:!0},d),c.updateNode(b)})})}},refresh:function(){this.nodes&&this.nodes.refresh()},getValue:function(){return this.nodes?this._getSelectedValues():null},destroyed:function(){this.stop(),this.nodes&&this.nodes.destroy()}}),BI.extend(BI.TreeView,{REQ_TYPE_INIT_DATA:1,REQ_TYPE_ADJUST_DATA:2,REQ_TYPE_SELECT_DATA:3,REQ_TYPE_GET_SELECTED_DATA:4}),BI.TreeView.EVENT_CHANGE="EVENT_CHANGE",BI.TreeView.EVENT_INIT=BI.Events.INIT,BI.TreeView.EVENT_AFTERINIT=BI.Events.AFTERINIT,BI.shortcut("bi.tree_view",BI.TreeView),BI.AsyncTree=BI.inherit(BI.TreeView,{_defaultConfig:function(){return BI.extend(BI.AsyncTree.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.AsyncTree.superclass._init.apply(this,arguments)},_configSetting:function(){function a(a,b,c){var d=$.fn.zTree.getZTreeObj(b);d.checkNode(c,!c.checked,!0,!0)}function b(a,b){function c(a){BI.each(a,function(a,b){b.halfCheck===!0&&(b.halfCheck=!1,c(b.children))})}if(b.halfCheck=!1,b.checked===!0){c(b.children);var d=$.fn.zTree.getZTreeObj(a),e=d.getSelectedNodes();BI.each(e,function(a,b){b.halfCheck=!1})}}function c(a,b){h._beforeExpandNode(a,b)}function d(a,b,c){h._selectTreeNode(b,c)}function e(a,b,c){c.halfCheck=!1}function f(a,b,c){c.halfCheck=!1}var g=this.options.paras,h=this,i={async:{enable:!1,otherParam:BI.cjkEncodeDO(g)},check:{enable:!0},data:{key:{title:"title",name:"text"},simpleData:{enable:!0}},view:{showIcon:!1,expandSpeed:"",nameIsHTML:!0,dblClickExpand:!1},callback:{beforeCheck:b,onCheck:d,beforeExpand:c,onExpand:e,onCollapse:f,onClick:a}};return i},_selectTreeNode:function(a,b){var c=this,d=(this.options,BI.deepClone(b.parentValues||c._getParentValues(b))),e=this._getNodeValue(b);if(b.checked===!0);else{var f=b,g=this._getTree(this.options.paras.selectedValues,d);for(BI.isNotNull(g[e])&&delete g[e];null!=f&&BI.isEmpty(g);)d=d.slice(0,d.length-1),f=f.getParentNode(),null!=f&&(g=this._getTree(this.options.paras.selectedValues,d),e=this._getNodeValue(f),delete g[e])}BI.AsyncTree.superclass._selectTreeNode.apply(c,arguments)},_beforeExpandNode:function(a,b){function c(a,c){d.nodes.addNodes(b,a),c===!0&&BI.delay(function(){i++,g.times=i,e.itemsCreator(g,h)},100)}var d=this,e=this.options,f=b.parentValues||d._getParentValues(b),g=BI.extend({},e.paras,{id:b.id,times:1,parentValues:f.concat(this._getNodeValue(b)),checkState:b.getCheckStatus()}),h=function(a){var b=a.items||[];b.length>0&&c(d._dealWidthNodes(b),!!a.hasNext)},i=1;b.children||setTimeout(function(){e.itemsCreator(g,h)},17)},_join:function(a,b){function c(a,b,f){BI.each(b,function(g,h){BI.isNull(f[g])?d._addTreeNode(e,a,g,h):BI.isEmpty(f[g])?d._addTreeNode(e,a,g,{}):c(a.concat([g]),b[g],f[g])})}var d=this,e={};return c([],a,b),c([],b,a),e},hasChecked:function(){return!BI.isEmpty(this.options.paras.selectedValues)||BI.AsyncTree.superclass.hasChecked.apply(this,arguments)},getValue:function(){if(!this.nodes)return{};var a=this._getSelectedValues();return BI.isEmpty(a)?BI.deepClone(this.options.paras.selectedValues):BI.isEmpty(this.options.paras.selectedValues)?a:this._join(a,this.options.paras.selectedValues)},stroke:function(a){delete this.options.keyword,BI.extend(this.options.paras,a);var b=this._configSetting();this._initTree(b)}}),BI.shortcut("bi.async_tree",BI.AsyncTree),BI.PartTree=BI.inherit(BI.AsyncTree,{_defaultConfig:function(){return BI.extend(BI.PartTree.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.PartTree.superclass._init.apply(this,arguments)},_loadMore:function(){var a=this,b=this.options,c=BI.extend({},b.paras,{type:BI.TreeView.REQ_TYPE_INIT_DATA,times:++this.times});this.tip.setLoading(),b.itemsCreator(c,function(c){var d=!!c.hasNext,e=c.items||[];b.paras.lastSearchValue=c.lastSearchValue,a._stop!==!0&&(d?a.tip.setLoaded():a.tip.setEnd(),e.length>0&&a.nodes.addNodes(null,a._dealWidthNodes(e)))})},_selectTreeNode:function(a,b){var c=this,d=this.options,e=BI.deepClone(b.parentValues||c._getParentValues(b)),f=this._getNodeValue(b);if(b.checked===!0)BI.AsyncTree.superclass._selectTreeNode.apply(c,arguments);else{for(var g=this.options.paras.selectedValues,h=e.concat(f),i=0,j=h.length;i<j;i++){if(g=g[h[i]],null==g)return;if(BI.isEmpty(g))break}d.itemsCreator(BI.extend({},d.paras,{type:BI.TreeView.REQ_TYPE_SELECT_DATA,notSelectedValue:f,parentValues:e}),function(a){c.options.paras.selectedValues=a,BI.AsyncTree.superclass._selectTreeNode.apply(c,arguments)})}},_getSelectedValues:function(){function a(d){BI.each(d,function(d,e){var f=e.getCheckStatus();if(f.checked===!1)return!0;var g=e.parentValues||b._getParentValues(e),h=g.concat([b._getNodeValue(e)]);return b._buildTree(c,h),BI.isNotEmptyArray(e.children)?(a(e.children),!0):void(f.half===!0&&b._getHalfSelectedValues(c,e))})}var b=this,c={},d=this.nodes.getNodes();return a(d),c},_initTree:function(a,b){function c(b){d._stop!==!0&&(d.nodes=$.fn.zTree.init(f.element,a,b))}var d=this,e=this.options;this.times=1;var f=this.tree;f.empty(),d.tip.setVisible(!1),this.loading();var g=BI.extend({},e.paras,{type:BI.TreeView.REQ_TYPE_INIT_DATA,times:this.times}),h=function(a){if(d._stop!==!0&&b==e.paras.keyword){var f=!!a.hasNext,g=a.items||[];e.paras.lastSearchValue=a.lastSearchValue,g.length>0&&c(d._dealWidthNodes(g)),d.setTipVisible(g.length<=0),d.loaded(),f?d.tip.setLoaded():d.tip.invisible(),d.fireEvent(BI.Events.AFTERINIT)}};BI.delay(function(){e.itemsCreator(g,h)},100)},getValue:function(){var a=this.options,b=BI.PartTree.superclass.getValue.apply(this,arguments);return a.itemsCreator({type:BI.TreeView.REQ_TYPE_ADJUST_DATA,selectedValues:b},function(a){b=a}),b},stroke:function(a){var b=this.options;delete b.paras.keyword,BI.extend(b.paras,a),delete b.paras.lastSearchValue;var c=this._configSetting();this._initTree(c,b.paras.keyword)}}),BI.shortcut("bi.part_tree",BI.PartTree),BI.Resizers=new BI.ResizeController,BI.Layers=new BI.LayerController,BI.Maskers=new BI.MaskersController,BI.Bubbles=new BI.BubblesController,BI.Tooltips=new BI.TooltipsController,BI.Popovers=new BI.FloatBoxController,BI.Broadcasts=new BI.BroadcastController,BI.StyleLoaders=new BI.StyleLoaderManager,BI.Canvas=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Canvas.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-canvas"})},_init:function(){BI.Canvas.superclass._init.apply(this,arguments);var a=this.options,b=document.createElement("canvas");document.createElement("canvas").getContext||(b=window.G_vmlCanvasManager.initElement(b)),this.element.append(b),b.width=a.width,b.height=a.height,$(b).width("100%"),$(b).height("100%"),this.canvas=b,this._queue=[]},mounted:function(){this.stroke()},_getContext:function(){return this.ctx||(this.ctx=this.canvas.getContext("2d")),this.ctx},_attr:function(a,b){var c=this;if(!BI.isNull(a))return BI.isObject(a)?void BI.each(a,function(a,b){c._queue.push({k:a,v:b})}):void this._queue.push({k:a,v:b})},_line:function(a,b){var c=this,d=[].slice.call(arguments,2);BI.isOdd(d.length)&&(this._attr(BI.last(d)),d=BI.initial(d)),this._attr("moveTo",[a,b]);var e=BI.filter(d,function(a){return a%2===0}),f=BI.filter(d,function(a){return a%2!==0});d=BI.zip(e,f),BI.each(d,function(a,b){c._attr("lineTo",b)})},line:function(a,b,c,d){this._line.apply(this,arguments),this._attr("stroke",[])},rect:function(a,b,c,d,e){this._attr("fillStyle",e),this._attr("fillRect",[a,b,c,d])},circle:function(a,b,c,d){this._attr({fillStyle:d,beginPath:[],arc:[a,b,c,0,2*Math.PI,!0],closePath:[],fill:[]})},hollow:function(){this._attr("beginPath",[]),this._line.apply(this,arguments),this._attr("closePath",[]),this._attr("stroke",[])},solid:function(){this.hollow.apply(this,arguments),this._attr("fill",[])},gradient:function(a,b,c,d,e,f){var g=this._getContext().createLinearGradient(a,b,c,d);return g.addColorStop(0,e),g.addColorStop(1,f),g},reset:function(){this._getContext().clearRect(0,0,this.canvas.width,this.canvas.height)},stroke:function(){var a=this._getContext();return!!a&&(BI.each(this._queue,function(b,c){BI.isFunction(a[c.k])?a[c.k].apply(a,c.v):a[c.k]=c.v}),void(this._queue=[]))}}),BI.shortcut("bi.canvas",BI.Canvas),BI.CollectionView=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.CollectionView.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-collection",overflowX:!0,overflowY:!0,cellSizeAndPositionGetter:BI.emptyFn,horizontalOverscanSize:0,verticalOverscanSize:0,scrollLeft:0,scrollTop:0,items:[]})},_init:function(){BI.CollectionView.superclass._init.apply(this,arguments);var a=this,b=this.options;this.renderedCells=[],this.renderedKeys=[],this.renderRange={},this._scrollLock=!1,this._debounceRelease=BI.debounce(function(){a._scrollLock=!1},1e3/60),this.container=BI.createWidget({type:"bi.absolute"}),this.element.scroll(function(){a._scrollLock!==!0&&(b.scrollLeft=a.element.scrollLeft(),b.scrollTop=a.element.scrollTop(),a._calculateChildrenToRender(),a.fireEvent(BI.CollectionView.EVENT_SCROLL,{scrollLeft:b.scrollLeft,scrollTop:b.scrollTop}))}),BI.createWidget({type:"bi.vertical",element:this,scrollable:b.overflowX===!0&&b.overflowY===!0,scrolly:b.overflowX===!1&&b.overflowY===!0,scrollx:b.overflowX===!0&&b.overflowY===!1,items:[this.container]}),b.items.length>0&&(this._calculateSizeAndPositionData(),this._populate()),0===b.scrollLeft&&0===b.scrollTop||BI.nextTick(function(){a.element.scrollTop(b.scrollTop),a.element.scrollLeft(b.scrollLeft)})},_calculateSizeAndPositionData:function(){for(var a=this.options,b=[],c=new BI.SectionManager,d=0,e=0,f=0,g=a.items.length;f<g;f++){var h=a.cellSizeAndPositionGetter(f);if(null==h.height||isNaN(h.height)||null==h.width||isNaN(h.width)||null==h.x||isNaN(h.x)||null==h.y||isNaN(h.y))throw Error();d=Math.max(d,h.y+h.height),e=Math.max(e,h.x+h.width),h.index=f,b[f]=h,c.registerCell(h,f)}this._cellMetadata=b,this._sectionManager=c,this._height=d,this._width=e},_cellRenderers:function(a,b,c,d){return this._lastRenderedCellIndices=this._sectionManager.getCellIndices(a,b,c,d),this._cellGroupRenderer()},_cellGroupRenderer:function(){var a=this,b=(this.options,[]);return BI.each(this._lastRenderedCellIndices,function(c,d){var e=a._sectionManager.getCellMetadata(d);b.push(e)}),b},_calculateChildrenToRender:function(){var a=this,b=this.options,c=BI.clamp(b.scrollLeft,0,this._getMaxScrollLeft()),d=BI.clamp(b.scrollTop,0,this._getMaxScrollTop()),e=Math.max(0,c-b.horizontalOverscanSize),f=Math.max(0,d-b.verticalOverscanSize),g=Math.min(this._width,c+b.width+b.horizontalOverscanSize),h=Math.min(this._height,d+b.height+b.verticalOverscanSize);if(g>0&&h>0){if(f>=this.renderRange.minY&&h<=this.renderRange.maxY&&e>=this.renderRange.minX&&g<=this.renderRange.maxX)return;for(var i=this._cellRenderers(h-f,g-e,e,f),j=[],k={},l={},m={},n={},o=0,p=i.length;o<p;o++){var q=i[o];m[q.x]=q.x,m[q.x+q.width]=q.x+q.width,n[q.y]=q.y,n[q.y+q.height]=q.y+q.height}m=BI.toArray(m),n=BI.toArray(n);for(var r=BI.invert(m),s=BI.invert(n),t={},u={},v={},w={},x=function(a,b){null==a[b]&&(a[b]=Number.MAX_VALUE)},y=function(a,b){null==a[b]&&(a[b]=0)},o=0,p=i.length;o<p;o++){var z,q=i[o],A=this.renderedKeys[q.index]&&this.renderedKeys[q.index][1];A>=0?(q.width!==this.renderedCells[A]._width&&(this.renderedCells[A]._width=q.width,this.renderedCells[A].el.setWidth(q.width)),q.height!==this.renderedCells[A]._height&&(this.renderedCells[A]._height=q.height,this.renderedCells[A].el.setHeight(q.height)),this.renderedCells[A]._left!==q.x&&this.renderedCells[A].el.element.css("left",q.x+"px"),this.renderedCells[A]._top!==q.y&&this.renderedCells[A].el.element.css("top",q.y+"px"),j.push(z=this.renderedCells[A])):(z=BI.createWidget(BI.extend({type:"bi.label",width:q.width,height:q.height},b.items[q.index],{cls:(b.items[q.index].cls||"")+" container-cell"+(0===q.y?" first-row":"")+(0===q.x?" first-col":""),_left:q.x,_top:q.y})),j.push({el:z,left:q.x,top:q.y,_left:q.x,_top:q.y,_width:q.width,_height:q.height}));for(var B=0|s[q.y],C=0|s[q.y+q.height],D=B;D<=C;D++){var E=n[D];x(t,E),y(u,E),t[E]=Math.min(t[E],q.x),u[E]=Math.max(u[E],q.x+q.width)}for(var F=0|r[q.x],G=0|r[q.x+q.width],D=F;D<=G;D++){var H=m[D];x(v,H),y(w,H),v[H]=Math.min(v[H],q.y),w[H]=Math.max(w[H],q.y+q.height)}k[q.index]=[q.index,o],l[o]=z}var I={},J={},K=[];BI.each(k,function(b,c){a.renderedKeys[b]?I[b]=c:J[b]=c}),BI.each(this.renderedKeys,function(a,b){I[a]||J[a]||K.push(b[1])}),BI.each(K,function(b,c){a.renderedCells[c].el._destroy()});var L=[];BI.each(J,function(a,b){L.push(j[b[1]])}),this.container.addItems(L),this.container._children=l,this.container.attr("items",j),this.renderedCells=j,this.renderedKeys=k;var M=BI.min(t),N=BI.max(u),O=BI.max(v),P=BI.min(w);this.renderRange={minX:M,minY:O,maxX:N,maxY:P}}},_getMaxScrollLeft:function(){return Math.max(0,this._width-this.options.width+(this.options.overflowX?BI.DOM.getScrollWidth():0))},_getMaxScrollTop:function(){return Math.max(0,this._height-this.options.height+(this.options.overflowY?BI.DOM.getScrollWidth():0))},_populate:function(a){var b=this.options;if(this._reRange(),a&&a!==this.options.items&&(this.options.items=a,this._calculateSizeAndPositionData()),b.items.length>0){this.container.setWidth(this._width),this.container.setHeight(this._height),this._calculateChildrenToRender();try{this.element.scrollTop(b.scrollTop),this.element.scrollLeft(b.scrollLeft)}catch(c){}}},setScrollLeft:function(a){this.options.scrollLeft!==a&&(this._scrollLock=!0,this.options.scrollLeft=BI.clamp(a||0,0,this._getMaxScrollLeft()),this._debounceRelease(),this._calculateChildrenToRender(),this.element.scrollLeft(this.options.scrollLeft))},setScrollTop:function(a){this.options.scrollTop!==a&&(this._scrollLock=!0,this.options.scrollTop=BI.clamp(a||0,0,this._getMaxScrollTop()),this._debounceRelease(),this._calculateChildrenToRender(),this.element.scrollTop(this.options.scrollTop))},setOverflowX:function(a){var b=this;this.options.overflowX!==!!a&&(this.options.overflowX=!!a,BI.nextTick(function(){b.element.css({overflowX:a?"auto":"hidden"})}))},setOverflowY:function(a){var b=this;this.options.overflowY!==!!a&&(this.options.overflowY=!!a,BI.nextTick(function(){b.element.css({overflowY:a?"auto":"hidden"})}))},getScrollLeft:function(){return this.options.scrollLeft},getScrollTop:function(){return this.options.scrollTop},getMaxScrollLeft:function(){return this._getMaxScrollLeft()},getMaxScrollTop:function(){return this._getMaxScrollTop()},_reRange:function(){this.renderRange={}},_clearChildren:function(){this.container._children={},this.container.attr("items",[])},restore:function(){BI.each(this.renderedCells,function(a,b){b.el._destroy()}),this._clearChildren(),this.renderedCells=[],this.renderedKeys=[],this.renderRange={},this._scrollLock=!1},populate:function(a){a&&a!==this.options.items&&this.restore(),this._populate(a)}}),BI.CollectionView.EVENT_SCROLL="EVENT_SCROLL",BI.shortcut("bi.collection_view",BI.CollectionView),BI.Combo=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.Combo.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-combo",trigger:"click",toggle:!0,direction:"bottom",container:null,isDefaultInit:!1,destroyWhenHide:!1,isNeedAdjustHeight:!0,isNeedAdjustWidth:!0,stopEvent:!1,stopPropagation:!1,adjustLength:0,adjustXOffset:0,adjustYOffset:0,hideChecker:BI.emptyFn,offsetStyle:"left",el:{},popup:{},comboClass:"bi-combo-popup",hoverClass:"bi-combo-hover"})},_init:function(){BI.Combo.superclass._init.apply(this,arguments);var a=this,b=this.options;this._initCombo(),this._initPullDownAction(),this.combo.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.isEnabled()&&a.isValid()&&(b===BI.Events.EXPAND&&a._popupView(),b===BI.Events.COLLAPSE&&a._hideView(),b===BI.Events.EXPAND&&(a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a.fireEvent(BI.Combo.EVENT_EXPAND)),b===BI.Events.COLLAPSE&&(a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a.isViewVisible()&&a.fireEvent(BI.Combo.EVENT_COLLAPSE)),b===BI.Events.CLICK&&a.fireEvent(BI.Combo.EVENT_TRIGGER_CHANGE,d))}),a.element.on("mouseenter."+a.getName(),function(c){a.isEnabled()&&a.isValid()&&a.combo.isEnabled()&&a.combo.isValid()&&a.element.addClass(b.hoverClass)}),a.element.on("mouseleave."+a.getName(),function(c){a.isEnabled()&&a.isValid()&&a.combo.isEnabled()&&a.combo.isValid()&&a.element.removeClass(b.hoverClass)}),BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[{el:this.combo}]}),b.isDefaultInit&&this._assertPopupView(),BI.Resizers.add(this.getName(),BI.bind(function(){this.isViewVisible()&&this._hideView()},this))},_toggle:function(){this._assertPopupViewRender(),this.popupView.isVisible()?this._hideView():this.isEnabled()&&this._popupView()},_initPullDownAction:function(){
function a(){b.isEnabled()&&b.isValid()&&b.combo.isEnabled()&&b.combo.isValid()&&c.toggle===!0&&(b._hideView(),b.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.COLLAPSE,"",b.combo),b.fireEvent(BI.Combo.EVENT_COLLAPSE)),b.popupView&&b.popupView.element.off("mouseenter."+b.getName()).off("mouseleave."+b.getName()),f=!1}var b=this,c=this.options,d=this.options.trigger.split(","),e=function(a){c.stopEvent&&a.stopEvent(),c.stopPropagation&&a.stopPropagation()},f=!1;BI.each(d,function(d,g){switch(g){case"hover":b.element.on("mouseenter."+b.getName(),function(a){b.isEnabled()&&b.isValid()&&b.combo.isEnabled()&&b.combo.isValid()&&(b._popupView(),b.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.EXPAND,"",b.combo),b.fireEvent(BI.Combo.EVENT_EXPAND))}),b.element.on("mouseleave."+b.getName(),function(c){b.popupView&&(b.popupView.element.on("mouseenter."+b.getName(),function(c){f=!0,b.popupView.element.on("mouseleave."+b.getName(),function(b){a()}),b.popupView.element.off("mouseenter."+b.getName())}),BI.defer(function(){f||a()},50))});break;case"click":var h=BI.debounce(function(a){b.combo.element.__isMouseInBounds__(a)&&b.isEnabled()&&b.isValid()&&b.combo.isEnabled()&&b.combo.isValid()&&(c.toggle?b._toggle():b._popupView(),b.isViewVisible()?(b.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.EXPAND,"",b.combo),b.fireEvent(BI.Combo.EVENT_EXPAND)):(b.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.COLLAPSE,"",b.combo),b.fireEvent(BI.Combo.EVENT_COLLAPSE)))},BI.EVENT_RESPONSE_TIME,!0);b.element.off(g+"."+b.getName()).on(g+"."+b.getName(),function(a){h(a),e(a)});break;case"click-hover":var h=BI.debounce(function(a){b.combo.element.__isMouseInBounds__(a)&&b.isEnabled()&&b.isValid()&&b.combo.isEnabled()&&b.combo.isValid()&&(b._popupView(),b.isViewVisible()&&(b.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.EXPAND,"",b.combo),b.fireEvent(BI.Combo.EVENT_EXPAND)))},BI.EVENT_RESPONSE_TIME,!0);b.element.off("click."+b.getName()).on("click."+b.getName(),function(a){h(a),e(a)}),b.element.on("mouseleave."+b.getName(),function(c){b.popupView&&(b.popupView.element.on("mouseenter."+b.getName(),function(c){f=!0,b.popupView.element.on("mouseleave."+b.getName(),function(b){a()}),b.popupView.element.off("mouseenter."+b.getName())}),BI.defer(function(){f||a()},50))})}})},_initCombo:function(){this.combo=BI.createWidget(this.options.el)},_assertPopupView:function(){var a=this;null==this.popupView&&(this.popupView=BI.createWidget(this.options.popup,{type:"bi.popup_view"}),this.popupView.on(BI.Controller.EVENT_CHANGE,function(b,c,d){b===BI.Events.CLICK&&(a.combo.setValue(a.getValue()),a.fireEvent(BI.Combo.EVENT_CHANGE,c,d)),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.popupView.setVisible(!1),BI.nextTick(function(){a.fireEvent(BI.Combo.EVENT_AFTER_INIT)}))},_assertPopupViewRender:function(){this._assertPopupView(),this._rendered||(BI.createWidget({type:"bi.vertical",scrolly:!1,element:this.options.container||this,items:[{el:this.popupView}]}),this._rendered=!0)},_hideIf:function(a){if(!(this.element.find(a.target).length>0||"CodeMirror-cursor"===a.target.className||$(a.target).closest(".CodeMirror-hints").length>0)){var b=this.options.hideChecker.apply(this,[a]);b!==!1&&this._hideView()}},_hideView:function(){this.fireEvent(BI.Combo.EVENT_BEFORE_HIDEVIEW),this.options.destroyWhenHide===!0?(this.popupView&&this.popupView.destroy(),this.popupView=null,this._rendered=!1):this.popupView&&this.popupView.invisible(),this.element.removeClass(this.options.comboClass),$(document).unbind("mousedown."+this.getName()).unbind("mousewheel."+this.getName()),this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW)},_popupView:function(){this._assertPopupViewRender(),this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW),this.popupView.visible(),this.adjustWidth(),this.adjustHeight(),this.element.addClass(this.options.comboClass),$(document).unbind("mousedown."+this.getName()).unbind("mousewheel."+this.getName()),$(document).bind("mousedown."+this.getName(),BI.bind(this._hideIf,this)).bind("mousewheel."+this.getName(),BI.bind(this._hideIf,this)),this.fireEvent(BI.Combo.EVENT_AFTER_POPUPVIEW)},adjustWidth:function(){var a=this.options;if(this.popupView&&a.isNeedAdjustWidth===!0){this.resetListWidth("");var b=this.popupView.element.outerWidth(),c=this.element.outerWidth()||a.width;b>c+80?c+=80:b>c&&(c=b),this.resetListWidth(c<100?100:c)}},adjustHeight:function(){var a=this.options,b={};if(this.popupView){var c=this.popupView.isVisible();switch(this.popupView.visible(),a.direction){case"bottom":case"bottom,right":b=$.getComboPosition(this.combo,this.popupView,a.adjustXOffset,a.adjustYOffset||a.adjustLength,a.isNeedAdjustHeight,["bottom","top","right","left"],a.offsetStyle);break;case"top":case"top,right":b=$.getComboPosition(this.combo,this.popupView,a.adjustXOffset,a.adjustYOffset||a.adjustLength,a.isNeedAdjustHeight,["top","bottom","right","left"],a.offsetStyle);break;case"left":case"left,bottom":b=$.getComboPosition(this.combo,this.popupView,a.adjustXOffset||a.adjustLength,a.adjustYOffset,a.isNeedAdjustHeight,["left","right","bottom","top"],a.offsetStyle);break;case"right":case"right,bottom":b=$.getComboPosition(this.combo,this.popupView,a.adjustXOffset||a.adjustLength,a.adjustYOffset,a.isNeedAdjustHeight,["right","left","bottom","top"],a.offsetStyle);break;case"top,left":b=$.getComboPosition(this.combo,this.popupView,a.adjustXOffset,a.adjustYOffset||a.adjustLength,a.isNeedAdjustHeight,["top","bottom","left","right"],a.offsetStyle);break;case"bottom,left":b=$.getComboPosition(this.combo,this.popupView,a.adjustXOffset,a.adjustYOffset||a.adjustLength,a.isNeedAdjustHeight,["bottom","top","left","right"],a.offsetStyle);break;case"left,top":b=$.getComboPosition(this.combo,this.popupView,a.adjustXOffset||a.adjustLength,a.adjustYOffset,a.isNeedAdjustHeight,["left","right","top","bottom"],a.offsetStyle);break;case"right,top":b=$.getComboPosition(this.combo,this.popupView,a.adjustXOffset||a.adjustLength,a.adjustYOffset,a.isNeedAdjustHeight,["right","left","top","bottom"],a.offsetStyle);break;case"top,custom":case"custom,top":b=$.getTopAdaptPosition(this.combo,this.popupView,a.adjustYOffset||a.adjustLength,a.isNeedAdjustHeight);break;case"custom,bottom":case"bottom,custom":b=$.getBottomAdaptPosition(this.combo,this.popupView,a.adjustYOffset||a.adjustLength,a.isNeedAdjustHeight);break;case"left,custom":case"custom,left":b=$.getLeftAdaptPosition(this.combo,this.popupView,a.adjustXOffset||a.adjustLength),delete b.top,delete b.adaptHeight;break;case"custom,right":case"right,custom":b=$.getRightAdaptPosition(this.combo,this.popupView,a.adjustXOffset||a.adjustLength),delete b.top,delete b.adaptHeight}"adaptHeight"in b&&this.resetListHeight(b.adaptHeight),"left"in b&&this.popupView.element.css({left:b.left}),"top"in b&&this.popupView.element.css({top:b.top}),this.position=b,this.popupView.setVisible(c)}},resetListHeight:function(a){this._assertPopupView(),this.popupView.resetHeight&&this.popupView.resetHeight(a)},resetListWidth:function(a){this._assertPopupView(),this.popupView.resetWidth&&this.popupView.resetWidth(a)},populate:function(a){this._assertPopupView(),this.popupView.populate.apply(this.popupView,arguments),this.combo.populate.apply(this.combo,arguments)},_setEnable:function(a){BI.Combo.superclass._setEnable.apply(this,arguments),!a&&this.element.removeClass(this.options.hoverClass),!a&&this.isViewVisible()&&this._hideView()},setValue:function(a){this._assertPopupView(),this.combo.setValue(a),this.popupView&&this.popupView.setValue(a)},getValue:function(){return this._assertPopupView(),this.popupView&&this.popupView.getValue()},isViewVisible:function(){return this.isEnabled()&&this.combo.isEnabled()&&!!this.popupView&&this.popupView.isVisible()},showView:function(){this.isEnabled()&&this.combo.isEnabled()&&this._popupView()},hideView:function(){this._hideView()},getView:function(){return this.popupView},getPopupPosition:function(){return this.position},toggle:function(){this._toggle()},destroy:function(){$(document).unbind("mousedown."+this.getName()).unbind("mousewheel."+this.getName()).unbind("mouseenter."+this.getName()).unbind("mousemove."+this.getName()).unbind("mouseleave."+this.getName()),BI.Resizers.remove(this.getName()),BI.Combo.superclass.destroy.apply(this,arguments)}}),BI.Combo.EVENT_TRIGGER_CHANGE="EVENT_TRIGGER_CHANGE",BI.Combo.EVENT_CHANGE="EVENT_CHANGE",BI.Combo.EVENT_EXPAND="EVENT_EXPAND",BI.Combo.EVENT_COLLAPSE="EVENT_COLLAPSE",BI.Combo.EVENT_AFTER_INIT="EVENT_AFTER_INIT",BI.Combo.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.Combo.EVENT_AFTER_POPUPVIEW="EVENT_AFTER_POPUPVIEW",BI.Combo.EVENT_BEFORE_HIDEVIEW="EVENT_BEFORE_HIDEVIEW",BI.Combo.EVENT_AFTER_HIDEVIEW="EVENT_AFTER_HIDEVIEW",BI.shortcut("bi.combo",BI.Combo),BI.Expander=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Expander.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-expander",trigger:"click",toggle:!0,isDefaultInit:!1,el:{},popup:{},expanderClass:"bi-expander-popup",hoverClass:"bi-expander-hover"})},_init:function(){BI.Expander.superclass._init.apply(this,arguments);var a=this,b=this.options;this._expanded=!!b.el.open,this._initExpander(),this._initPullDownAction(),this.expander.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.isEnabled()&&a.isValid()&&(b===BI.Events.EXPAND&&a._popupView(),b===BI.Events.COLLAPSE&&a._hideView(),b===BI.Events.EXPAND&&(a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a.fireEvent(BI.Expander.EVENT_EXPAND)),b===BI.Events.COLLAPSE&&(a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a.isViewVisible()&&a.fireEvent(BI.Expander.EVENT_COLLAPSE)),b===BI.Events.CLICK&&a.fireEvent(BI.Expander.EVENT_TRIGGER_CHANGE,c,d))}),this.element.hover(function(){a.isEnabled()&&a.isValid()&&a.expander.isEnabled()&&a.expander.isValid()&&a.element.addClass(b.hoverClass)},function(){a.isEnabled()&&a.isValid()&&a.expander.isEnabled()&&a.expander.isValid()&&a.element.removeClass(b.hoverClass)}),BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[{el:this.expander}]}),b.isDefaultInit&&this._assertPopupView(),this.expander.isOpened()===!0&&this._popupView()},_toggle:function(){this._assertPopupViewRender(),this.popupView.isVisible()?this._hideView():this.isEnabled()&&this._popupView()},_initPullDownAction:function(){var a=this,b=this.options,c=this.options.trigger.split(",");BI.each(c,function(c,d){switch(d){case"hover":a.element[d](function(b){a.isEnabled()&&a.isValid()&&a.expander.isEnabled()&&a.expander.isValid()&&(a._popupView(),a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.EXPAND,"",a.expander),a.fireEvent(BI.Expander.EVENT_EXPAND))},function(){a.isEnabled()&&a.isValid()&&a.expander.isEnabled()&&a.expander.isValid()&&b.toggle&&(a._hideView(),a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.COLLAPSE,"",a.expander),a.fireEvent(BI.Expander.EVENT_COLLAPSE))});break;default:d&&a.element.off(d+"."+a.getName()).on(d+"."+a.getName(),BI.debounce(function(c){a.expander.element.__isMouseInBounds__(c)&&a.isEnabled()&&a.isValid()&&a.expander.isEnabled()&&a.expander.isValid()&&(b.toggle?a._toggle():a._popupView(),a.isExpanded()?(a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.EXPAND,"",a.expander),a.fireEvent(BI.Expander.EVENT_EXPAND)):(a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.COLLAPSE,"",a.expander),a.fireEvent(BI.Expander.EVENT_COLLAPSE)))},BI.EVENT_RESPONSE_TIME,!0))}})},_initExpander:function(){this.expander=BI.createWidget(this.options.el)},_assertPopupView:function(){var a=this;null==this.popupView&&(this.popupView=BI.createWidget(this.options.popup,{type:"bi.button_group",cls:"expander-popup",layouts:[{type:"bi.vertical",hgap:0,vgap:0}]}),this.popupView.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.Expander.EVENT_CHANGE,c,d)}),this.popupView.setVisible(this.isExpanded()),BI.nextTick(function(){a.fireEvent(BI.Expander.EVENT_AFTER_INIT)}))},_assertPopupViewRender:function(){this._assertPopupView(),this._rendered||(BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[{el:this.popupView}]}),this._rendered=!0)},_hideView:function(){this.fireEvent(BI.Expander.EVENT_BEFORE_HIDEVIEW),this._expanded=!1,this.expander.setOpened(!1),this.popupView&&this.popupView.invisible(),this.element.removeClass(this.options.expanderClass),this.fireEvent(BI.Expander.EVENT_AFTER_HIDEVIEW)},_popupView:function(){this._assertPopupViewRender(),this.fireEvent(BI.Expander.EVENT_BEFORE_POPUPVIEW),this._expanded=!0,this.expander.setOpened(!0),this.popupView.visible(),this.element.addClass(this.options.expanderClass),this.fireEvent(BI.Expander.EVENT_AFTER_POPUPVIEW)},populate:function(a){this.popupView&&this.popupView.populate.apply(this.popupView,arguments),this.expander.populate.apply(this.expander,arguments)},_setEnable:function(a){BI.Expander.superclass._setEnable.apply(this,arguments),!a&&this.element.removeClass(this.options.hoverClass),!a&&this.isViewVisible()&&this._hideView()},setValue:function(a){this.expander.setValue(a),this.popupView&&this.popupView.setValue(a)},getValue:function(){return this.popupView?this.popupView.getValue():[]},isViewVisible:function(){return this.isEnabled()&&this.expander.isEnabled()&&!!this.popupView&&this.popupView.isVisible()},isExpanded:function(){return this._expanded},showView:function(){this.isEnabled()&&this.expander.isEnabled()&&this._popupView()},hideView:function(){this._hideView()},getView:function(){return this.popupView},getAllLeaves:function(){return this.popupView&&this.popupView.getAllLeaves()},getNodeById:function(a){return this.expander.options.id===a?this.expander:this.popupView&&this.popupView.getNodeById(a)},getNodeByValue:function(a){return this.expander.getValue()===a?this.expander:this.popupView&&this.popupView.getNodeByValue(a)},destroy:function(){BI.Expander.superclass.destroy.apply(this,arguments)}}),BI.Expander.EVENT_EXPAND="EVENT_EXPAND",BI.Expander.EVENT_COLLAPSE="EVENT_COLLAPSE",BI.Expander.EVENT_TRIGGER_CHANGE="EVENT_TRIGGER_CHANGE",BI.Expander.EVENT_CHANGE="EVENT_CHANGE",BI.Expander.EVENT_AFTER_INIT="EVENT_AFTER_INIT",BI.Expander.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.Expander.EVENT_AFTER_POPUPVIEW="EVENT_AFTER_POPUPVIEW",BI.Expander.EVENT_BEFORE_HIDEVIEW="EVENT_BEFORE_HIDEVIEW",BI.Expander.EVENT_AFTER_HIDEVIEW="EVENT_AFTER_HIDEVIEW",BI.shortcut("bi.expander",BI.Expander),BI.ComboGroup=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ComboGroup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-combo-group bi-list-item",trigger:"click,hover",direction:"right",adjustLength:0,isDefaultInit:!1,isNeedAdjustHeight:!1,isNeedAdjustWidth:!1,el:{type:"bi.text_button",text:"",value:""},children:[],popup:{el:{type:"bi.button_tree",chooseType:0,layouts:[{type:"bi.vertical"}]}}})},_init:function(){BI.ComboGroup.superclass._init.apply(this,arguments),this._populate(this.options.el)},_populate:function(a){var b=this,c=this.options,d=c.children;if(BI.isEmpty(d))throw new Error("ComboGroup构造错误");BI.each(d,function(a,b){var d=BI.formatEL(b).el.children;b=BI.formatEL(b).el,BI.isEmpty(d)||(b.el=BI.clone(b),b.children=d,b.type="bi.combo_group",b.action=c.action,b.height=c.height,b.direction=c.direction,b.isDefaultInit=c.isDefaultInit,b.isNeedAdjustHeight=c.isNeedAdjustHeight,b.isNeedAdjustWidth=c.isNeedAdjustWidth,b.adjustLength=c.adjustLength,b.popup=c.popup)}),this.combo=BI.createWidget({type:"bi.combo",element:this,height:c.height,trigger:c.trigger,direction:c.direction,isDefaultInit:c.isDefaultInit,isNeedAdjustWidth:c.isNeedAdjustWidth,isNeedAdjustHeight:c.isNeedAdjustHeight,adjustLength:c.adjustLength,el:a,popup:BI.extend({},c.popup,{el:BI.extend({items:d},c.popup.el)})}),this.combo.on(BI.Controller.EVENT_CHANGE,function(a,c,d){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.ComboGroup.EVENT_CHANGE,d)})},getValue:function(){return this.combo.getValue()},setValue:function(a){this.combo.setValue(a)}}),BI.ComboGroup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.combo_group",BI.ComboGroup),BI.VirtualGroup=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.VirtualGroup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-virtual-group",items:[],layouts:[{type:"bi.center",hgap:0,vgap:0}]})},render:function(){this.populate(this.options.items)},_packageBtns:function(a){for(var b=this.options,c=b.layouts.length-1;c>0;c--)a=BI.map(a,function(a,d){return BI.extend({},b.layouts[c],{items:[BI.extend({},b.layouts[c].el,{el:BI.stripEL(d)})]})});return a},_packageItems:function(a,b){return BI.createItems(BI.makeArrayByArray(a,{}),BI.clone(b))},_packageLayout:function(a){for(var b=this.options,c=BI.deepClone(b.layouts[0]),d=BI.formatEL(c).el;d&&d.items&&!BI.isEmpty(d.items);)d=BI.formatEL(d.items[0]).el;return d.items=a,c},addItems:function(a){this.layouts.addItems(a)},prependItems:function(a){this.layouts.prependItems(a)},setValue:function(a){},getValue:function(){return this.layouts.getValue()},populate:function(a){a=a||[],this.options.items=a,a=this._packageBtns(a),this.layouts?this.layouts.populate(a):this.layouts=BI.createWidget(BI.extend({element:this},this._packageLayout(a)))}}),BI.VirtualGroup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.virtual_group",BI.VirtualGroup),BI.Loader=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Loader.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-loader",direction:"top",isDefaultInit:!0,logic:{dynamic:!0,scrolly:!0},el:{type:"bi.button_group"},items:[],itemsCreator:BI.emptyFn,onLoaded:BI.emptyFn,count:!1,prev:!1,next:{},hasPrev:BI.emptyFn,hasNext:BI.emptyFn})},_prevLoad:function(){var a=this,b=this.options;this.prev.setLoading(),b.itemsCreator.apply(this,[{times:--this.times},function(){a.prev.setLoaded(),a.prependItems.apply(a,arguments)}])},_nextLoad:function(){var a=this,b=this.options;this.next.setLoading(),b.itemsCreator.apply(this,[{times:++this.times},function(){a.next.setLoaded(),a.addItems.apply(a,arguments)}])},_init:function(){BI.Loader.superclass._init.apply(this,arguments);var a=this,b=this.options;b.itemsCreator===!1&&(b.prev=!1,b.next=!1),b.prev!==!1&&(this.prev=BI.createWidget(BI.extend({type:"bi.loading_bar"},b.prev)),this.prev.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&a._prevLoad()})),this.button_group=BI.createWidget(b.el,{type:"bi.button_group",chooseType:0,items:b.items,behaviors:{},layouts:[{type:"bi.vertical"}]}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.Loader.EVENT_CHANGE,d)}),b.next!==!1&&(this.next=BI.createWidget(BI.extend({type:"bi.loading_bar"},b.next)),this.next.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&a._nextLoad()})),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(b.direction),BI.extend({scrolly:!0},b.logic,{items:BI.LogicFactory.createLogicItemsByDirection(b.direction,this.prev,this.button_group,this.next)})))),b.isDefaultInit&&BI.isEmpty(b.items)&&BI.nextTick(BI.bind(function(){b.isDefaultInit&&BI.isEmpty(b.items)&&this.populate()},this)),BI.isNotEmptyArray(b.items)&&this.populate(b.items)},hasPrev:function(){var a=this.options;return BI.isNumber(a.count)?this.count<a.count:!!a.hasPrev.apply(this,[{times:this.times,count:this.count}])},hasNext:function(){var a=this.options;return BI.isNumber(a.count)?this.count<a.count:!!a.hasNext.apply(this,[{times:this.times,count:this.count}])},prependItems:function(a){this.count+=a.length,this.next!==!1&&(this.hasPrev()?(this.options.items=this.options.items.concat(a),this.prev.setLoaded()):this.prev.setEnd()),this.button_group.prependItems.apply(this.button_group,arguments)},addItems:function(a){this.count+=a.length,BI.isObject(this.next)&&(this.hasNext()?(this.options.items=this.options.items.concat(a),this.next.setLoaded()):this.next.setEnd()),this.button_group.addItems.apply(this.button_group,arguments)},populate:function(a){var b=this,c=this.options;return 0===arguments.length&&BI.isFunction(c.itemsCreator)?void c.itemsCreator.apply(this,[{times:1},function(){if(0===arguments.length)throw new Error("arguments can not be null!!!");b.populate.apply(b,arguments),c.onLoaded()}]):(this.options.items=a,this.times=1,this.count=0,this.count+=a.length,BI.isObject(this.next)&&(this.hasNext()?this.next.setLoaded():this.next.invisible()),BI.isObject(this.prev)&&(this.hasPrev()?this.prev.setLoaded():this.prev.invisible()),void this.button_group.populate.apply(this.button_group,arguments))},setNotSelectedValue:function(){this.button_group.setNotSelectedValue.apply(this.button_group,arguments)},getNotSelectedValue:function(){return this.button_group.getNotSelectedValue()},setValue:function(){this.button_group.setValue.apply(this.button_group,arguments)},getValue:function(){return this.button_group.getValue.apply(this.button_group,arguments)},getAllButtons:function(){return this.button_group.getAllButtons()},getAllLeaves:function(){return this.button_group.getAllLeaves()},getSelectedButtons:function(){return this.button_group.getSelectedButtons()},getNotSelectedButtons:function(){return this.button_group.getNotSelectedButtons()},getIndexByValue:function(a){return this.button_group.getIndexByValue(a)},getNodeById:function(a){return this.button_group.getNodeById(a)},getNodeByValue:function(a){return this.button_group.getNodeByValue(a)},empty:function(){this.button_group.empty(),BI.each([this.prev,this.next],function(a,b){b&&b.setVisible(!1)})},destroy:function(){BI.Loader.superclass.destroy.apply(this,arguments)}}),BI.Loader.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.loader",BI.Loader),BI.Navigation=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Navigation.superclass._defaultConfig.apply(this,arguments),{direction:"bottom",logic:{dynamic:!1},single:!1,defaultShowIndex:!1,tab:!1,cardCreator:function(a){return BI.createWidget()},afterCardCreated:BI.emptyFn,afterCardShow:BI.emptyFn})},render:function(){var a=this,b=this.options;this.tab=BI.createWidget(this.options.tab,{type:"bi.button_group"}),this.cardMap={},this.showIndex=0,this.layout=BI.createWidget({type:"bi.card"}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(b.direction),BI.extend({},b.logic,{items:BI.LogicFactory.createLogicItemsByDirection(b.direction,this.tab,this.layout)})))),new BI.ShowListener({eventObj:this.tab,cardLayout:this.layout,cardNameCreator:function(b){return a.showIndex+b},cardCreator:function(c){var d=b.cardCreator(c);return a.cardMap[c]=d,d},afterCardCreated:BI.bind(this.afterCardCreated,this),afterCardShow:BI.bind(this.afterCardShow,this)})},mounted:function(){var a=this.options;a.defaultShowIndex!==!1&&this.setSelect(a.defaultShowIndex)},_deleteOtherCards:function(a){var b=this,c=this.options;c.single===!0&&BI.each(this.cardMap,function(c,d){c!==a+""&&(b.layout.deleteCardByName(c),delete b.cardMap[c])})},afterCardCreated:function(a){var b=this;this.cardMap[a].on(BI.Controller.EVENT_CHANGE,function(a,c,d){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.Navigation.EVENT_CHANGE,d)}),this.options.afterCardCreated.apply(this,arguments)},afterCardShow:function(a){this.showIndex=a,this._deleteOtherCards(a),this.options.afterCardShow.apply(this,arguments)},populate:function(){var a=this.layout.getShowingCard();if(a)return a.populate.apply(a,arguments)},_assertCard:function(a){if(!this.layout.isCardExisted(a)){var b=this.options.cardCreator(a);this.cardMap[a]=b,this.layout.addCardByName(a,b),this.afterCardCreated(a)}},setSelect:function(a){this._assertCard(a),this.layout.showCardByName(a),this._deleteOtherCards(a),this.showIndex!==a&&(this.showIndex=a,BI.nextTick(BI.bind(this.afterCardShow,this,a)))},getSelect:function(){return this.showIndex},getSelectedCard:function(){if(BI.isKey(this.showIndex))return this.cardMap[this.showIndex]},setValue:function(a){var b=this.layout.getShowingCard();b&&b.setValue(a)},getValue:function(){var a=this.layout.getShowingCard();if(a)return a.getValue()},empty:function(){this.layout.deleteAllCard(),this.cardMap={}},destroy:function(){BI.Navigation.superclass.destroy.apply(this,arguments)}}),BI.Navigation.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.navigation",BI.Navigation),BI.Searcher=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Searcher.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-searcher",lgap:0,rgap:0,tgap:0,bgap:0,vgap:0,hgap:0,isDefaultInit:!1,isAutoSearch:!0,isAutoSync:!0,chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,onSearch:function(a,b){b([])},el:{type:"bi.search_editor"},popup:{type:"bi.searcher_view"},adapter:null,masker:{offset:{}}})},_init:function(){BI.Searcher.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget(b.el,{type:"bi.search_editor"}),BI.createWidget({type:"bi.vertical",element:this,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,vgap:b.vgap,hgap:b.hgap,items:[this.editor]}),b.isDefaultInit&&this._assertPopupView();var c=BI.debounce(BI.bind(this._search,this),BI.EVENT_RESPONSE_TIME,!0);this.editor.on(BI.Controller.EVENT_CHANGE,function(b){switch(b){case BI.Events.STARTEDIT:a._startSearch();break;case BI.Events.EMPTY:a._stopSearch();break;case BI.Events.CHANGE:c();break;case BI.Events.PAUSE:a._pauseSearch()}})},_assertPopupView:function(){var a=this,b=this.options;(b.masker&&!BI.Maskers.has(this.getName())||b.masker===!1&&!this.popupView)&&(this.popupView=BI.createWidget(b.popup,{type:"bi.searcher_view",chooseType:b.chooseType}),this.popupView.on(BI.Controller.EVENT_CHANGE,function(c,d,e){if(a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),c===BI.Events.CLICK){if(b.isAutoSync){var f=b.adapter&&b.adapter.getValue();if(e.isSelected())switch(b.chooseType){case BI.ButtonGroup.CHOOSE_TYPE_SINGLE:b.adapter&&b.adapter.setValue([e.getValue()]);break;case BI.ButtonGroup.CHOOSE_TYPE_MULTI:f.push(e.getValue()),b.adapter&&b.adapter.setValue(f)}else b.adapter&&b.adapter.setValue(BI.deepWithout(f,e.getValue()))}a.fireEvent(BI.Searcher.EVENT_CHANGE,d,e)}}),BI.nextTick(function(){a.fireEvent(BI.Searcher.EVENT_AFTER_INIT)})),b.masker&&!BI.Maskers.has(this.getName())&&BI.Maskers.create(this.getName(),b.adapter,BI.extend({container:this,render:this.popupView},b.masker))},_startSearch:function(){this._assertPopupView(),this._stop=!1,this._isSearching=!0,this.fireEvent(BI.Searcher.EVENT_START),this.popupView.startSearch&&this.popupView.startSearch(),BI.nextTick(function(a){BI.Maskers.show(a)},this.getName())},_pauseSearch:function(){this.options,this.getName();this._stop=!0,BI.nextTick(function(a){BI.Maskers.hide(a)},this.getName()),this._isSearching===!0&&(this.popupView&&this.popupView.pauseSearch&&this.popupView.pauseSearch(),this.fireEvent(BI.Searcher.EVENT_PAUSE)),this._isSearching=!1},_stopSearch:function(){var a=(this.options,this.getName());this._stop=!0,BI.Maskers.hide(a),this._isSearching===!0&&(this.popupView&&this.popupView.stopSearch&&this.popupView.stopSearch(),this.fireEvent(BI.Searcher.EVENT_STOP)),this._isSearching=!1},_search:function(){var a=this,b=this.options,c=this.editor.getValue();if(""!==c&&!this._stop){if(b.isAutoSearch){var d=b.adapter&&(b.adapter.getItems&&b.adapter.getItems()||b.adapter.attr("items"))||[],e=BI.Func.getSearchResult(d,c),f=e.matched,g=e.finded;return this.popupView.populate(g,f,c),b.isAutoSync&&b.adapter&&b.adapter.getValue&&this.popupView.setValue(b.adapter.getValue()),void a.fireEvent(BI.Searcher.EVENT_SEARCHING)}this.popupView.loading&&this.popupView.loading(),b.onSearch({times:1,keyword:c,selectedValues:b.adapter&&b.adapter.getValue()},function(d,e){if(!a._stop){var f=[].slice.call(arguments);f.length>0&&f.push(c),BI.Maskers.show(a.getName()),a.popupView.populate.apply(a.popupView,f),b.isAutoSync&&b.adapter&&b.adapter.getValue&&a.popupView.setValue(b.adapter.getValue()),a.popupView.loaded&&a.popupView.loaded(),a.fireEvent(BI.Searcher.EVENT_SEARCHING)}})}},setAdapter:function(a){this.options.adapter=a,BI.Maskers.remove(this.getName())},doSearch:function(){this.isSearching()&&this._search()},stopSearch:function(){this._stopSearch();try{this.editor.blur()}catch(a){if(!this.editor.blur)throw new Error("editor没有实现blur方法")}finally{this.editor.setValue("")}},isSearching:function(){return this._isSearching},isViewVisible:function(){return this.editor.isEnabled()&&BI.Maskers.isVisible(this.getName())},getView:function(){return this.popupView},hasMatched:function(){return this._assertPopupView(),this.popupView.hasMatched()},adjustHeight:function(){BI.Maskers.has(this.getName())&&BI.Maskers.get(this.getName()).isVisible()&&BI.Maskers.show(this.getName())},adjustView:function(){this.isViewVisible()&&BI.Maskers.show(this.getName())},setValue:function(a){this._assertPopupView(),this.popupView&&this.popupView.setValue(a)},getKeyword:function(){return this.editor.getValue()},getKeywords:function(){return this.editor.getKeywords()},getValue:function(){var a=this.options;return a.isAutoSync&&a.adapter&&a.adapter.getValue?a.adapter.getValue():this.isSearching()?this.popupView.getValue():a.adapter&&a.adapter.getValue?a.adapter.getValue():this.popupView.getValue()},populate:function(a,b,c){var d=this.options;this._assertPopupView(),this.popupView.populate.apply(this.popupView,arguments),d.isAutoSync&&d.adapter&&d.adapter.getValue&&this.popupView.setValue(d.adapter.getValue())},empty:function(){this.popupView&&this.popupView.empty()},destroy:function(){BI.Maskers.remove(this.getName()),BI.Searcher.superclass.destroy.apply(this,arguments)}}),BI.Searcher.EVENT_CHANGE="EVENT_CHANGE",BI.Searcher.EVENT_START="EVENT_START",BI.Searcher.EVENT_STOP="EVENT_STOP",BI.Searcher.EVENT_PAUSE="EVENT_PAUSE",BI.Searcher.EVENT_SEARCHING="EVENT_SEARCHING",BI.Searcher.EVENT_AFTER_INIT="EVENT_AFTER_INIT",BI.shortcut("bi.searcher",BI.Searcher),BI.Switcher=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Switcher.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-switcher",direction:BI.Direction.Top,trigger:"click",toggle:!0,el:{},popup:{},adapter:null,masker:{},switcherClass:"bi-switcher-popup",hoverClass:"bi-switcher-hover"})},_init:function(){BI.Switcher.superclass._init.apply(this,arguments);var a=this,b=this.options;this._initSwitcher(),this._initPullDownAction(),this.switcher.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.isEnabled()&&a.isValid()&&(b===BI.Events.EXPAND&&a._popupView(),b===BI.Events.COLLAPSE&&a._hideView(),b===BI.Events.EXPAND&&(a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a.fireEvent(BI.Switcher.EVENT_EXPAND)),b===BI.Events.COLLAPSE&&(a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a.isViewVisible()&&a.fireEvent(BI.Switcher.EVENT_COLLAPSE)),b===BI.Events.CLICK&&a.fireEvent(BI.Switcher.EVENT_TRIGGER_CHANGE,c,d))}),this.element.hover(function(){a.isEnabled()&&a.switcher.isEnabled()&&a.element.addClass(b.hoverClass)},function(){a.isEnabled()&&a.switcher.isEnabled()&&a.element.removeClass(b.hoverClass)}),BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[{el:this.switcher}]}),b.isDefaultInit&&this._assertPopupView()},_toggle:function(){this._assertPopupView(),this.isExpanded()?this._hideView():this.isEnabled()&&this._popupView()},_initPullDownAction:function(){var a=this,b=this.options,c=this.options.trigger.split(",");BI.each(c,function(c,d){switch(d){case"hover":a.element[d](function(b){a.isEnabled()&&a.switcher.isEnabled()&&(a._popupView(),a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.EXPAND,"",a.switcher),a.fireEvent(BI.Switcher.EVENT_EXPAND))},function(){a.isEnabled()&&a.switcher.isEnabled()&&b.toggle&&(a._hideView(),a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.COLLAPSE,"",a.switcher),a.fireEvent(BI.Switcher.EVENT_COLLAPSE))});break;default:d&&a.element.off(d+"."+a.getName()).on(d+"."+a.getName(),BI.debounce(function(c){a.switcher.element.__isMouseInBounds__(c)&&a.isEnabled()&&a.switcher.isEnabled()&&(b.toggle?a._toggle():a._popupView(),
a.isExpanded()?(a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.EXPAND,"",a.switcher),a.fireEvent(BI.Switcher.EVENT_EXPAND)):(a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.COLLAPSE,"",a.switcher),a.fireEvent(BI.Switcher.EVENT_COLLAPSE)))},BI.EVENT_RESPONSE_TIME,!0))}})},_initSwitcher:function(){this.switcher=BI.createWidget(this.options.el)},_assertPopupView:function(){var a=this,b=this.options;this._created||(this.popupView=BI.createWidget(b.popup,{type:"bi.button_group",element:b.adapter&&BI.Maskers.create(this.getName(),b.adapter,BI.extend({container:this},b.masker)),cls:"switcher-popup",layouts:[{type:"bi.vertical",hgap:0,vgap:0}]}),this.popupView.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.Switcher.EVENT_CHANGE,c,d)}),b.direction===BI.Direction.Custom||b.adapter||BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[{el:this.popupView}]}),this._created=!0,BI.nextTick(function(){a.fireEvent(BI.Switcher.EVENT_AFTER_INIT)}))},_hideView:function(){this.fireEvent(BI.Switcher.EVENT_BEFORE_HIDEVIEW);var a=this,b=this.options;b.adapter?BI.Maskers.hide(a.getName()):a.popupView&&a.popupView.setVisible(!1),BI.nextTick(function(){b.adapter?BI.Maskers.hide(a.getName()):a.popupView&&a.popupView.setVisible(!1),a.element.removeClass(b.switcherClass),a.fireEvent(BI.Switcher.EVENT_AFTER_HIDEVIEW)})},_popupView:function(){var a=this,b=this.options;this._assertPopupView(),this.fireEvent(BI.Switcher.EVENT_BEFORE_POPUPVIEW),b.adapter?BI.Maskers.show(this.getName()):a.popupView.setVisible(!0),BI.nextTick(function(c){b.adapter?BI.Maskers.show(c):a.popupView.setVisible(!0),a.element.addClass(b.switcherClass),a.fireEvent(BI.Switcher.EVENT_AFTER_POPUPVIEW)},this.getName())},populate:function(a){this._assertPopupView(),this.popupView.populate.apply(this.popupView,arguments),this.switcher.populate.apply(this.switcher,arguments)},_setEnable:function(a){BI.Switcher.superclass._setEnable.apply(this,arguments),!a&&this.isViewVisible()&&this._hideView()},setValue:function(a){this._assertPopupView(),this.switcher.setValue(a),this.popupView&&this.popupView.setValue(a)},getValue:function(){return this._assertPopupView(),this.popupView?this.popupView.getValue():[]},setAdapter:function(a){this.options.adapter=a,BI.Maskers.remove(this.getName())},isViewVisible:function(){return this.isEnabled()&&this.switcher.isEnabled()&&(this.options.adapter?BI.Maskers.isVisible(this.getName()):this.popupView&&this.popupView.isVisible())},isExpanded:function(){return this.isViewVisible()},showView:function(){this.isEnabled()&&this.switcher.isEnabled()&&this._popupView()},hideView:function(){this._hideView()},getView:function(){return this.popupView},adjustView:function(){this.isViewVisible()&&BI.Maskers.show(this.getName())},getAllLeaves:function(){return this.popupView&&this.popupView.getAllLeaves()},getNodeById:function(a){return this.switcher.attr("id")===a?this.switcher:this.popupView&&this.popupView.getNodeById(a)},getNodeByValue:function(a){return this.switcher.getValue()===a?this.switcher:this.popupView&&this.popupView.getNodeByValue(a)},empty:function(){this.popupView&&this.popupView.empty()},destroy:function(){BI.Switcher.superclass.destroy.apply(this,arguments)}}),BI.Switcher.EVENT_EXPAND="EVENT_EXPAND",BI.Switcher.EVENT_COLLAPSE="EVENT_COLLAPSE",BI.Switcher.EVENT_TRIGGER_CHANGE="EVENT_TRIGGER_CHANGE",BI.Switcher.EVENT_CHANGE="EVENT_CHANGE",BI.Switcher.EVENT_AFTER_INIT="EVENT_AFTER_INIT",BI.Switcher.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.Switcher.EVENT_AFTER_POPUPVIEW="EVENT_AFTER_POPUPVIEW",BI.Switcher.EVENT_BEFORE_HIDEVIEW="EVENT_BEFORE_HIDEVIEW",BI.Switcher.EVENT_AFTER_HIDEVIEW="EVENT_AFTER_HIDEVIEW",BI.shortcut("bi.switcher",BI.Switcher),BI.Tab=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Tab.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-tab",direction:"top",single:!1,logic:{dynamic:!1},defaultShowIndex:!1,tab:!1,cardCreator:function(a){return BI.createWidget()}})},render:function(){var a=this,b=this.options;BI.isObject(b.tab)&&(this.tab=BI.createWidget(this.options.tab,{type:"bi.button_group"}),this.tab.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})),this.cardMap={},this.layout=BI.createWidget({type:"bi.card"}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(b.direction),BI.extend({},b.logic,{items:BI.LogicFactory.createLogicItemsByDirection(b.direction,this.tab,this.layout)}))));var c=new BI.ShowListener({eventObj:this.tab,cardLayout:this.layout,cardCreator:function(c){var d=b.cardCreator.apply(a,arguments);return a.cardMap[c]=d,d},afterCardShow:function(b){a._deleteOtherCards(b),a.curr=b}});c.on(BI.ShowListener.EVENT_CHANGE,function(b){a.fireEvent(BI.Tab.EVENT_CHANGE,b,a)})},_deleteOtherCards:function(a){var b=this,c=this.options;c.single===!0&&BI.each(this.cardMap,function(c,d){c!==a+""&&(b.layout.deleteCardByName(c),delete b.cardMap[c])})},_assertCard:function(a){if(!this.layout.isCardExisted(a)){var b=this.options.cardCreator(a);this.cardMap[a]=b,this.layout.addCardByName(a,b)}},mounted:function(){var a=this.options;a.defaultShowIndex!==!1&&this.setSelect(a.defaultShowIndex)},setSelect:function(a){this.tab&&this.tab.setValue(a),this._assertCard(a),this.layout.showCardByName(a),this._deleteOtherCards(a),this.curr!==a&&(this.curr=a)},removeTab:function(a){var b=this;this.options;BI.any(this.cardMap,function(c,d){if(BI.isEqual(c,a+""))return b.layout.deleteCardByName(c),delete b.cardMap[c],!0})},getSelect:function(){return this.curr},getSelectedTab:function(){return this.layout.getShowingCard()},getTab:function(a){return this._assertCard(a),this.layout.getCardByName(a)},setValue:function(a){var b=this.layout.getShowingCard();b&&b.setValue(a)},getValue:function(){var a=this.layout.getShowingCard();if(a)return a.getValue()},populate:function(){var a=this.layout.getShowingCard();if(a)return a.populate&&a.populate.apply(a,arguments)},empty:function(){this.layout.deleteAllCard(),this.cardMap={}},destroy:function(){this.cardMap={},BI.Tab.superclass.destroy.apply(this,arguments)}}),BI.Tab.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.tab",BI.Tab),BI.EL=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.EL.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-el",el:{},layout:{}})},_init:function(){BI.EL.superclass._init.apply(this,arguments);var a=this,b=this.options;this.ele=BI.createWidget(b.el),BI.createWidget(b.layout,{type:"bi.adaptive",element:this,items:[this.ele]}),this.ele.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})},setValue:function(a){this.ele.setValue(a)},getValue:function(){return this.ele.getValue()},populate:function(){this.ele.populate.apply(this,arguments)}}),BI.shortcut("bi.el",BI.EL),function(a){this.CodeMirror=a()}(function(){"use strict";function a(c,d){if(!(this instanceof a))return new a(c,d);this.options=d=d?He(d):{},He(Vf,d,!1),n(d);var e=d.value;"string"==typeof e&&(e=new rg(e,d.mode)),this.doc=e;var f=new a.inputStyles[d.inputStyle](this),g=this.display=new b(c,e,f);g.wrapper.CodeMirror=this,j(this),h(this),d.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),d.autofocus&&!xf&&g.input.focus(),r(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new ze,keySeq:null,specialChars:null};var i=this;nf&&of<11&&setTimeout(function(){i.display.input.reset(!0)},20),Pb(this),Te(),tb(this),this.curOp.forceUpdate=!0,Ud(this,e),d.autofocus&&!xf||i.hasFocus()?setTimeout(Ie(nc,this),20):oc(this);for(var k in Wf)Wf.hasOwnProperty(k)&&Wf[k](this,d[k],Xf);w(this),d.finishInit&&d.finishInit(this);for(var l=0;l<_f.length;++l)_f[l](this);vb(this),pf&&d.lineWrapping&&"optimizelegibility"==getComputedStyle(g.lineDiv).textRendering&&(g.lineDiv.style.textRendering="auto")}function b(a,b,c){var d=this;this.input=c,d.scrollbarFiller=Me("div",null,"CodeMirror-scrollbar-filler"),d.scrollbarFiller.setAttribute("cm-not-content","true"),d.gutterFiller=Me("div",null,"CodeMirror-gutter-filler"),d.gutterFiller.setAttribute("cm-not-content","true"),d.lineDiv=Me("div",null,"CodeMirror-code"),d.selectionDiv=Me("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=Me("div",null,"CodeMirror-cursors"),d.measure=Me("div",null,"CodeMirror-measure"),d.lineMeasure=Me("div",null,"CodeMirror-measure"),d.lineSpace=Me("div",[d.measure,d.lineMeasure,d.selectionDiv,d.cursorDiv,d.lineDiv],null,"position: relative; outline: none"),d.mover=Me("div",[Me("div",[d.lineSpace],"CodeMirror-lines")],null,"position: relative"),d.sizer=Me("div",[d.mover],"CodeMirror-sizer"),d.sizerWidth=null,d.heightForcer=Me("div",null,null,"position: absolute; height: "+Bg+"px; width: 1px;"),d.gutters=Me("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=Me("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=Me("div",[d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),nf&&of<8&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),pf||kf&&xf||(d.scroller.draggable=!0),a&&(a.appendChild?a.appendChild(d.wrapper):a(d.wrapper)),d.viewFrom=d.viewTo=b.first,d.reportedViewFrom=d.reportedViewTo=b.first,d.view=[],d.renderedView=null,d.externalMeasured=null,d.viewOffset=0,d.lastWrapHeight=d.lastWrapWidth=0,d.updateLineNumbers=null,d.nativeBarWidth=d.barHeight=d.barWidth=0,d.scrollbarsClipped=!1,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.alignWidgets=!1,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1,d.selForContextMenu=null,d.activeTouch=null,c.init(d)}function c(b){b.doc.mode=a.getMode(b.options,b.doc.modeOption),d(b)}function d(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,Ma(a,100),a.state.modeGen++,a.curOp&&Ib(a)}function e(a){a.options.lineWrapping?(Rg(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Qg(a.display.wrapper,"CodeMirror-wrap"),m(a)),g(a),Ib(a),gb(a),setTimeout(function(){s(a)},100)}function f(a){var b=rb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/sb(a.display)-3);return function(e){if(sd(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function g(a){var b=a.doc,c=f(a);b.iter(function(a){var b=c(a);b!=a.height&&Yd(a,b)})}function h(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),gb(a)}function i(a){j(a),Ib(a),setTimeout(function(){v(a)},20)}function j(a){var b=a.display.gutters,c=a.options.gutters;Ne(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(Me("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none",k(a)}function k(a){var b=a.display.gutters.offsetWidth;a.display.sizer.style.marginLeft=b+"px"}function l(a){if(0==a.height)return 0;for(var b,c=a.text.length,d=a;b=ld(d);){var e=b.find(0,!0);d=e.from.line,c+=e.from.ch-e.to.ch}for(d=a;b=md(d);){var e=b.find(0,!0);c-=d.text.length-e.from.ch,d=e.to.line,c+=d.text.length-e.to.ch}return c}function m(a){var b=a.display,c=a.doc;b.maxLine=Vd(c,c.first),b.maxLineLength=l(b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var c=l(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function n(a){var b=De(a.gutters,"CodeMirror-linenumbers");b==-1&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function o(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+Ra(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Ta(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function p(a,b,c){this.cm=c;var d=this.vert=Me("div",[Me("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=Me("div",[Me("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d),a(e),xg(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")}),xg(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")}),this.checkedOverlay=!1,nf&&of<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function q(){}function r(b){b.display.scrollbars&&(b.display.scrollbars.clear(),b.display.scrollbars.addClass&&Qg(b.display.wrapper,b.display.scrollbars.addClass)),b.display.scrollbars=new a.scrollbarModel[b.options.scrollbarStyle](function(a){b.display.wrapper.insertBefore(a,b.display.scrollbarFiller),xg(a,"mousedown",function(){b.state.focused&&setTimeout(function(){b.display.input.focus()},0)}),a.setAttribute("cm-not-content","true")},function(a,c){"horizontal"==c?bc(b,a):ac(b,a)},b),b.display.scrollbars.addClass&&Rg(b.display.wrapper,b.display.scrollbars.addClass)}function s(a,b){b||(b=o(a));var c=a.display.barWidth,d=a.display.barHeight;t(a,b);for(var e=0;e<4&&c!=a.display.barWidth||d!=a.display.barHeight;e++)c!=a.display.barWidth&&a.options.lineWrapping&&F(a),t(a,o(a)),c=a.display.barWidth,d=a.display.barHeight}function t(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px",c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px",d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="",d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function u(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-Qa(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=$d(b,d),g=$d(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;h<f?(f=h,g=$d(b,_d(Vd(b,h))+a.wrapper.clientHeight)):Math.min(i,b.lastLine())>=g&&(f=$d(b,_d(Vd(b,i))-a.wrapper.clientHeight),g=i)}return{from:f,to:Math.max(g,f+1)}}function v(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=y(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&c[g].gutter&&(c[g].gutter.style.left=f);var h=c[g].alignable;if(h)for(var i=0;i<h.length;i++)h[i].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function w(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=x(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(Me("div",[Me("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth,g=e.offsetWidth-f;return d.lineGutter.style.width="",d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g)+1,d.lineNumWidth=d.lineNumInnerWidth+g,d.lineNumChars=d.lineNumInnerWidth?c.length:-1,d.lineGutter.style.width=d.lineNumWidth+"px",k(a),!0}return!1}function x(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function y(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function z(a,b,c){var d=a.display;this.viewport=b,this.visible=u(d,a.doc,b),this.editorIsHidden=!d.wrapper.offsetWidth,this.wrapperHeight=d.wrapper.clientHeight,this.wrapperWidth=d.wrapper.clientWidth,this.oldDisplayWidth=Ua(a),this.force=c,this.dims=H(a),this.events=[]}function A(a){var b=a.display;!b.scrollbarsClipped&&b.scroller.offsetWidth&&(b.nativeBarWidth=b.scroller.offsetWidth-b.scroller.clientWidth,b.heightForcer.style.height=Ta(a)+"px",b.sizer.style.marginBottom=-b.nativeBarWidth+"px",b.sizer.style.borderRightWidth=Ta(a)+"px",b.scrollbarsClipped=!0)}function B(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return Kb(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==Ob(a))return!1;w(a)&&(Kb(a),b.dims=H(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFrom<f&&f-c.viewFrom<20&&(f=Math.max(d.first,c.viewFrom)),c.viewTo>g&&c.viewTo-g<20&&(g=Math.min(e,c.viewTo)),Ef&&(f=qd(a.doc,f),g=rd(a.doc,g));var h=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;Nb(a,f,g),c.viewOffset=_d(Vd(a.doc,c.viewFrom)),a.display.mover.style.top=c.viewOffset+"px";var i=Ob(a);if(!h&&0==i&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;var j=Pe();return i>4&&(c.lineDiv.style.display="none"),I(a,c.updateLineNumbers,b.dims),i>4&&(c.lineDiv.style.display=""),c.renderedView=c.view,j&&Pe()!=j&&j.offsetHeight&&j.focus(),Ne(c.cursorDiv),Ne(c.selectionDiv),c.gutters.style.height=0,h&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,Ma(a,400)),c.updateLineNumbers=null,!0}function C(a,b){for(var c=b.viewport,d=!0;(d&&a.options.lineWrapping&&b.oldDisplayWidth!=Ua(a)||(c&&null!=c.top&&(c={top:Math.min(a.doc.height+Ra(a.display)-Va(a),c.top)}),b.visible=u(a.display,a.doc,c),!(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)))&&B(a,b);d=!1){F(a);var e=o(a);Ha(a),E(a,e),s(a,e)}b.signal(a,"update",a),a.display.viewFrom==a.display.reportedViewFrom&&a.display.viewTo==a.display.reportedViewTo||(b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo)}function D(a,b){var c=new z(a,b);if(B(a,c)){F(a),C(a,c);var d=o(a);Ha(a),E(a,d),s(a,d),c.finish()}}function E(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";var c=b.docHeight+a.display.barHeight;a.display.heightForcer.style.top=c+"px",a.display.gutters.style.height=Math.max(c+Ta(a),b.clientHeight)+"px"}function F(a){for(var b=a.display,c=b.lineDiv.offsetTop,d=0;d<b.view.length;d++){var e,f=b.view[d];if(!f.hidden){if(nf&&of<8){var g=f.node.offsetTop+f.node.offsetHeight;e=g-c,c=g}else{var h=f.node.getBoundingClientRect();e=h.bottom-h.top}var i=f.line.height-e;if(e<2&&(e=rb(b)),(i>.001||i<-.001)&&(Yd(f.line,e),G(f.line),f.rest))for(var j=0;j<f.rest.length;j++)G(f.rest[j])}}}function G(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function H(a){for(var b=a.display,c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:y(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function I(a,b,c){function d(b){var c=b.nextSibling;return pf&&yf&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),c}for(var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,i=e.view,j=e.viewFrom,k=0;k<i.length;k++){var l=i[k];if(l.hidden);else if(l.node&&l.node.parentNode==g){for(;h!=l.node;)h=d(h);var m=f&&null!=b&&b<=j&&l.lineNumber;l.changes&&(De(l.changes,"gutter")>-1&&(m=!1),J(a,l,j,c)),m&&(Ne(l.lineNumber),l.lineNumber.appendChild(document.createTextNode(x(a.options,j)))),h=l.node.nextSibling}else{var n=R(a,l,j,c);g.insertBefore(n,h)}j+=l.size}for(;h;)h=d(h)}function J(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];"text"==f?N(a,b):"gutter"==f?P(a,b,c,d):"class"==f?O(b):"widget"==f&&Q(a,b,d)}b.changes=null}function K(a){return a.node==a.text&&(a.node=Me("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),nf&&of<8&&(a.node.style.zIndex=2)),a.node}function L(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;if(b&&(b+=" CodeMirror-linebackground"),a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=K(a);a.background=c.insertBefore(Me("div",null,b),c.firstChild)}}function M(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):Id(a,b)}function N(a,b){var c=b.text.className,d=M(a,b);b.text==b.node&&(b.node=d.pre),b.text.parentNode.replaceChild(d.pre,b.text),b.text=d.pre,d.bgClass!=b.bgClass||d.textClass!=b.textClass?(b.bgClass=d.bgClass,b.textClass=d.textClass,O(b)):c&&(b.text.className=c)}function O(a){L(a),a.line.wrapClass?K(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");var b=a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass;a.text.className=b||""}function P(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);var e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=K(b),g=b.gutter=Me("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px");if(a.display.input.setUneditable(g),f.insertBefore(g,b.text),b.line.gutterClass&&(g.className+=" "+b.line.gutterClass),!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(Me("div",x(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),e)for(var h=0;h<a.options.gutters.length;++h){var i=a.options.gutters[h],j=e.hasOwnProperty(i)&&e[i];j&&g.appendChild(Me("div",[j],"CodeMirror-gutter-elt","left: "+d.gutterLeft[i]+"px; width: "+d.gutterWidth[i]+"px"))}}}function Q(a,b,c){b.alignable&&(b.alignable=null);for(var d,e=b.node.firstChild;e;e=d){var d=e.nextSibling;"CodeMirror-linewidget"==e.className&&b.node.removeChild(e)}S(a,b,c)}function R(a,b,c,d){var e=M(a,b);return b.text=b.node=e.pre,e.bgClass&&(b.bgClass=e.bgClass),e.textClass&&(b.textClass=e.textClass),O(b),P(a,b,c,d),S(a,b,d),b.node}function S(a,b,c){if(T(a,b.line,b,c,!0),b.rest)for(var d=0;d<b.rest.length;d++)T(a,b.rest[d],b,c,!1)}function T(a,b,c,d,e){if(b.widgets)for(var f=K(c),g=0,h=b.widgets;g<h.length;++g){var i=h[g],j=Me("div",[i.node],"CodeMirror-linewidget");i.handleMouseEvents||j.setAttribute("cm-ignore-events","true"),U(i,j,c,d),a.display.input.setUneditable(j),e&&i.above?f.insertBefore(j,c.gutter||c.text):f.appendChild(j),te(i,"redraw")}}function U(a,b,c,d){if(a.noHScroll){(c.alignable||(c.alignable=[])).push(b);var e=d.wrapperWidth;b.style.left=d.fixedPos+"px",a.coverGutter||(e-=d.gutterTotalWidth,b.style.paddingLeft=d.gutterTotalWidth+"px"),b.style.width=e+"px"}a.coverGutter&&(b.style.zIndex=5,b.style.position="relative",a.noHScroll||(b.style.marginLeft=-d.gutterTotalWidth+"px"))}function V(a){return Ff(a.line,a.ch)}function W(a,b){return Gf(a,b)<0?b:a}function X(a,b){return Gf(a,b)<0?a:b}function Y(a){a.state.focused||(a.display.input.focus(),nc(a))}function Z(a){return a.options.readOnly||a.doc.cantEdit}function $(a,b,c,d,e){var f=a.doc;a.display.shift=!1,d||(d=f.sel);var g=a.state.pasteIncoming||"paste"==e,h=Ug(b),i=null;g&&d.ranges.length>1&&(Hf&&Hf.join("\n")==b?i=d.ranges.length%Hf.length==0&&Ee(Hf,Ug):h.length==d.ranges.length&&(i=Ee(h,function(a){return[a]})));for(var j=d.ranges.length-1;j>=0;j--){var k=d.ranges[j],l=k.from(),m=k.to();k.empty()&&(c&&c>0?l=Ff(l.line,l.ch-c):a.state.overwrite&&!g&&(m=Ff(m.line,Math.min(Vd(f,m.line).text.length,m.ch+Ce(h).length))));var n=a.curOp.updateInput,o={from:l,to:m,text:i?i[j%i.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};wc(a.doc,o),te(a,"inputRead",a,o)}b&&!g&&aa(a,b),Ic(a),a.curOp.updateInput=n,a.curOp.typing=!0,a.state.pasteIncoming=a.state.cutIncoming=!1}function _(a,b){var c=a.clipboardData&&a.clipboardData.getData("text/plain");if(c)return a.preventDefault(),Cb(b,function(){$(b,c,0,null,"paste")}),!0}function aa(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;d>=0;d--){var e=c.ranges[d];if(!(e.head.ch>100||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars){for(var h=0;h<f.electricChars.length;h++)if(b.indexOf(f.electricChars.charAt(h))>-1){g=Kc(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(Vd(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=Kc(a,e.head.line,"smart"));g&&te(a,"electricInput",a,e.head.line)}}}function ba(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line,f={anchor:Ff(e,0),head:Ff(e+1,0)};c.push(f),b.push(a.getRange(f.anchor,f.head))}return{text:b,ranges:c}}function ca(a){a.setAttribute("autocorrect","off"),a.setAttribute("autocapitalize","off"),a.setAttribute("spellcheck","false")}function da(a){this.cm=a,this.prevInput="",this.pollingFast=!1,this.polling=new ze,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function ea(){var a=Me("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),b=Me("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return pf?a.style.width="1000px":a.setAttribute("wrap","off"),wf&&(a.style.border="1px solid black"),ca(a),b}function fa(a){this.cm=a,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ze,this.gracePeriod=!1}function ga(a,b){var c=$a(a,b.line);if(!c||c.hidden)return null;var d=Vd(a.doc,b.line),e=Xa(c,d,b.line),f=ae(d),g="left";if(f){var h=ff(f,b.ch);g=h%2?"right":"left"}var i=bb(e.map,b.ch,g);return i.offset="right"==i.collapse?i.end:i.start,i}function ha(a,b){return b&&(a.bad=!0),a}function ia(a,b,c){var d;if(b==a.display.lineDiv){if(d=a.display.lineDiv.childNodes[c],!d)return ha(a.clipPos(Ff(a.display.viewTo-1)),!0);b=null,c=0}else for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d)return ja(f,b,c)}}function ja(a,b,c){function d(b,c,d){for(var e=-1;e<(k?k.length:0);e++)for(var f=e<0?j.map:k[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==c){var i=Zd(e<0?a.line:a.rest[e]),l=f[g]+d;return(d<0||h!=b)&&(l=f[g+(d?1:0)]),Ff(i,l)}}}var e=a.text.firstChild,f=!1;if(!b||!Ng(e,b))return ha(Ff(Zd(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b)){var g=a.rest?Ce(a.rest):a.line;return ha(Ff(Zd(g),g.text.length),f)}var h=3==b.nodeType?b:null,i=b;for(h||1!=b.childNodes.length||3!=b.firstChild.nodeType||(h=b.firstChild,c&&(c=h.nodeValue.length));i.parentNode!=e;)i=i.parentNode;var j=a.measure,k=j.maps,l=d(h,i,c);if(l)return ha(l,f);for(var m=i.nextSibling,n=h?h.nodeValue.length-c:0;m;m=m.nextSibling){if(l=d(m,m.firstChild,0))return ha(Ff(l.line,l.ch-n),f);n+=m.textContent.length}for(var o=i.previousSibling,n=c;o;o=o.previousSibling){if(l=d(o,o.firstChild,-1))return ha(Ff(l.line,l.ch+n),f);n+=m.textContent.length}}function ka(a,b,c,d,e){function f(a){return function(b){return b.id==a}}function g(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)return""==c&&(c=b.textContent.replace(/\u200b/g,"")),void(h+=c);var j,k=b.getAttribute("cm-marker");if(k){var l=a.findMarks(Ff(d,0),Ff(e+1,0),f(+k));return void(l.length&&(j=l[0].find())&&(h+=Wd(a.doc,j.from,j.to).join("\n")))}if("false"==b.getAttribute("contenteditable"))return;for(var m=0;m<b.childNodes.length;m++)g(b.childNodes[m]);/^(pre|div|p)$/i.test(b.nodeName)&&(i=!0)}else if(3==b.nodeType){var n=b.nodeValue;if(!n)return;i&&(h+="\n",i=!1),h+=n}}for(var h="",i=!1;g(b),b!=c;)b=b.nextSibling;return h}function la(a,b){this.ranges=a,this.primIndex=b}function ma(a,b){this.anchor=a,this.head=b}function na(a,b){var c=a[b];a.sort(function(a,b){return Gf(a.from(),b.from())}),b=De(a,c);for(var d=1;d<a.length;d++){var e=a[d],f=a[d-1];if(Gf(f.to(),e.from())>=0){var g=X(f.from(),e.from()),h=W(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;d<=b&&--b,a.splice(--d,2,new ma(i?h:g,i?g:h))}}return new la(a,b)}function oa(a,b){return new la([new ma(a,b||a)],0)}function pa(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function qa(a,b){if(b.line<a.first)return Ff(a.first,0);var c=a.first+a.size-1;return b.line>c?Ff(c,Vd(a,c).text.length):ra(b,Vd(a,b.line).text.length)}function ra(a,b){var c=a.ch;return null==c||c>b?Ff(a.line,b):c<0?Ff(a.line,0):a}function sa(a,b){return b>=a.first&&b<a.first+a.size}function ta(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=qa(a,b[d]);return c}function ua(a,b,c,d){if(a.cm&&a.cm.display.shift||a.extend){var e=b.anchor;if(d){var f=Gf(c,e)<0;f!=Gf(d,e)<0?(e=c,c=d):f!=Gf(c,d)<0&&(c=d)}return new ma(e,c)}return new ma(d||c,c)}function va(a,b,c,d){Ba(a,new la([ua(a,a.sel.primary(),b,c)],0),d)}function wa(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=ua(a,a.sel.ranges[e],b[e],null);var f=na(d,a.sel.primIndex);Ba(a,f,c)}function xa(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c,Ba(a,na(e,a.sel.primIndex),d)}function ya(a,b,c,d){Ba(a,oa(b,c),d)}function za(a,b){var c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new ma(qa(a,b[c].anchor),qa(a,b[c].head))}};return zg(a,"beforeSelectionChange",a,c),a.cm&&zg(a.cm,"beforeSelectionChange",a.cm,c),c.ranges!=b.ranges?na(c.ranges,c.ranges.length-1):b}function Aa(a,b,c){var d=a.history.done,e=Ce(d);e&&e.ranges?(d[d.length-1]=b,Ca(a,b,c)):Ba(a,b,c)}function Ba(a,b,c){Ca(a,b,c),he(a,a.sel,a.cm?a.cm.curOp.id:NaN,c)}function Ca(a,b,c){(xe(a,"beforeSelectionChange")||a.cm&&xe(a.cm,"beforeSelectionChange"))&&(b=za(a,b));var d=c&&c.bias||(Gf(b.primary().head,a.sel.primary().head)<0?-1:1);Da(a,Fa(a,b,d,!0)),c&&c.scroll===!1||!a.cm||Ic(a.cm)}function Da(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,we(a.cm)),te(a,"cursorActivity",a))}function Ea(a){Da(a,Fa(a,a.sel,null,!1),Dg)}function Fa(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=Ga(a,g.anchor,c,d),i=Ga(a,g.head,c,d);(e||h!=g.anchor||i!=g.head)&&(e||(e=b.ranges.slice(0,f)),e[f]=new ma(h,i))}return e?na(e,b.primIndex):b}function Ga(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=Vd(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;if((null==j.from||(k.inclusiveLeft?j.from<=f.ch:j.from<f.ch))&&(null==j.to||(k.inclusiveRight?j.to>=f.ch:j.to>f.ch))){if(d&&(zg(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find(g<0?-1:1);if(0==Gf(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?qa(a,Ff(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?Ff(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,Ff(a.first,0)):Ga(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function Ha(a){a.display.input.showSelection(a.display.input.prepareSelection())}function Ia(a,b){for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++)if(b!==!1||g!=c.sel.primIndex){var h=c.sel.ranges[g],i=h.empty();(i||a.options.showCursorWhenSelecting)&&Ja(a,h,e),i||Ka(a,h,f)}return d}function Ja(a,b,c){var d=mb(a,b.head,"div",null,null,!a.options.singleCursorHeightPerLine),e=c.appendChild(Me("div"," ","CodeMirror-cursor"));if(e.style.left=d.left+"px",e.style.top=d.top+"px",e.style.height=Math.max(0,d.bottom-d.top)*a.options.cursorHeight+"px",d.other){var f=c.appendChild(Me("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));
f.style.display="",f.style.left=d.other.left+"px",f.style.top=d.other.top+"px",f.style.height=.85*(d.other.bottom-d.other.top)+"px"}}function Ka(a,b,c){function d(a,b,c,d){b<0&&(b=0),b=Math.round(b),d=Math.round(d),h.appendChild(Me("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?k-a:c)+"px; height: "+(d-b)+"px"))}function e(b,c,e){function f(c,d){return lb(a,Ff(b,c),"div",l,d)}var h,i,l=Vd(g,b),m=l.text.length;return Ye(ae(l),c||0,null==e?m:e,function(a,b,g){var l,n,o,p=f(a,"left");if(a==b)l=p,n=o=p.left;else{if(l=f(b-1,"right"),"rtl"==g){var q=p;p=l,l=q}n=p.left,o=l.right}null==c&&0==a&&(n=j),l.top-p.top>3&&(d(n,p.top,null,p.bottom),n=j,p.bottom<l.top&&d(n,p.bottom,null,l.top)),null==e&&b==m&&(o=k),(!h||p.top<h.top||p.top==h.top&&p.left<h.left)&&(h=p),(!i||l.bottom>i.bottom||l.bottom==i.bottom&&l.right>i.right)&&(i=l),n<j+1&&(n=j),d(n,l.top,o-n,l.bottom)}),{start:h,end:i}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),i=Sa(a.display),j=i.left,k=Math.max(f.sizerWidth,Ua(a)-f.sizer.offsetLeft)-i.right,l=b.from(),m=b.to();if(l.line==m.line)e(l.line,l.ch,m.ch);else{var n=Vd(g,l.line),o=Vd(g,m.line),p=od(n)==od(o),q=e(l.line,l.ch,p?n.text.length+1:null).end,r=e(m.line,p?0:null,m.ch).start;p&&(q.top<r.top-2?(d(q.right,q.top,null,q.bottom),d(j,r.top,r.left,r.bottom)):d(q.right,q.top,r.left-q.right,q.bottom)),q.bottom<r.top&&d(j,q.bottom,null,r.top)}c.appendChild(h)}function La(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="",a.options.cursorBlinkRate>0?b.blinker=setInterval(function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):a.options.cursorBlinkRate<0&&(b.cursorDiv.style.visibility="hidden")}}function Ma(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,Ie(Na,a))}function Na(a){var b=a.doc;if(b.frontier<b.first&&(b.frontier=b.first),!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=bg(b.mode,Pa(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=Ed(a,f,d,!0);f.styles=h.styles;var i=f.styleClasses,j=h.classes;j?f.styleClasses=j:i&&(f.styleClasses=null);for(var k=!g||g.length!=f.styles.length||i!=j&&(!i||!j||i.bgClass!=j.bgClass||i.textClass!=j.textClass),l=0;!k&&l<g.length;++l)k=g[l]!=f.styles[l];k&&e.push(b.frontier),f.stateAfter=bg(b.mode,d)}else Gd(a,f.text,d),f.stateAfter=b.frontier%5==0?bg(b.mode,d):null;if(++b.frontier,+new Date>c)return Ma(a,a.options.workDelay),!0}),e.length&&Cb(a,function(){for(var b=0;b<e.length;b++)Jb(a,e[b],"text")})}}function Oa(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1e3:100),h=b;h>g;--h){if(h<=f.first)return f.first;var i=Vd(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=Gg(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function Pa(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Oa(a,b,c),g=f>d.first&&Vd(d,f-1).stateAfter;return g=g?bg(d.mode,g):cg(d.mode),d.iter(f,b,function(c){Gd(a,c.text,g);var h=f==b-1||f%5==0||f>=e.viewFrom&&f<e.viewTo;c.stateAfter=h?bg(d.mode,g):null,++f}),c&&(d.frontier=f),g}function Qa(a){return a.lineSpace.offsetTop}function Ra(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function Sa(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=Oe(a.measure,Me("pre","x")),c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,d={left:parseInt(c.paddingLeft),right:parseInt(c.paddingRight)};return isNaN(d.left)||isNaN(d.right)||(a.cachedPaddingH=d),d}function Ta(a){return Bg-a.display.nativeBarWidth}function Ua(a){return a.display.scroller.clientWidth-Ta(a)-a.display.barWidth}function Va(a){return a.display.scroller.clientHeight-Ta(a)-a.display.barHeight}function Wa(a,b,c){var d=a.options.lineWrapping,e=d&&Ua(a);if(!b.measure.heights||d&&b.measure.width!=e){var f=b.measure.heights=[];if(d){b.measure.width=e;for(var g=b.text.firstChild.getClientRects(),h=0;h<g.length-1;h++){var i=g[h],j=g[h+1];Math.abs(i.bottom-j.bottom)>2&&f.push((i.bottom+j.top)/2-c.top)}}f.push(c.bottom-c.top)}}function Xa(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(var d=0;d<a.rest.length;d++)if(Zd(a.rest[d])>c)return{map:a.measure.maps[d],cache:a.measure.caches[d],before:!0}}function Ya(a,b){b=od(b);var c=Zd(b),d=a.display.externalMeasured=new Gb(a.doc,b,c);d.lineN=c;var e=d.built=Id(a,d);return d.text=e.pre,Oe(a.display.lineMeasure,e.pre),d}function Za(a,b,c,d){return ab(a,_a(a,b),c,d)}function $a(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[Lb(a,b)];var c=a.display.externalMeasured;return c&&b>=c.lineN&&b<c.lineN+c.size?c:void 0}function _a(a,b){var c=Zd(b),d=$a(a,c);d&&!d.text?d=null:d&&d.changes&&J(a,d,c,H(a)),d||(d=Ya(a,b));var e=Xa(d,b,c);return{line:b,view:d,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function ab(a,b,c,d,e){b.before&&(c=-1);var f,g=c+(d||"");return b.cache.hasOwnProperty(g)?f=b.cache[g]:(b.rect||(b.rect=b.view.text.getBoundingClientRect()),b.hasHeights||(Wa(a,b.view,b.rect),b.hasHeights=!0),f=cb(a,b,c,d),f.bogus||(b.cache[g]=f)),{left:f.left,right:f.right,top:e?f.rtop:f.top,bottom:e?f.rbottom:f.bottom}}function bb(a,b,c){for(var d,e,f,g,h=0;h<a.length;h+=3){var i=a[h],j=a[h+1];if(b<i?(e=0,f=1,g="left"):b<j?(e=b-i,f=e+1):(h==a.length-3||b==j&&a[h+3]>b)&&(f=j-i,e=f-1,b>=j&&(g="right")),null!=e){if(d=a[h+2],i==j&&c==(d.insertLeft?"left":"right")&&(g=c),"left"==c&&0==e)for(;h&&a[h-2]==a[h-3]&&a[h-1].insertLeft;)d=a[(h-=3)+2],g="left";if("right"==c&&e==j-i)for(;h<a.length-3&&a[h+3]==a[h+4]&&!a[h+5].insertLeft;)d=a[(h+=3)+2],g="right";break}}return{node:d,start:e,end:f,collapse:g,coverStart:i,coverEnd:j}}function cb(a,b,c,d){var e,f=bb(b.map,c,d),g=f.node,h=f.start,i=f.end,j=f.collapse;if(3==g.nodeType){for(var k=0;k<4;k++){for(;h&&Le(b.line.text.charAt(f.coverStart+h));)--h;for(;f.coverStart+i<f.coverEnd&&Le(b.line.text.charAt(f.coverStart+i));)++i;if(nf&&of<9&&0==h&&i==f.coverEnd-f.coverStart)e=g.parentNode.getBoundingClientRect();else if(nf&&a.options.lineWrapping){var l=Jg(g,h,i).getClientRects();e=l.length?l["right"==d?l.length-1:0]:Lf}else e=Jg(g,h,i).getBoundingClientRect()||Lf;if(e.left||e.right||0==h)break;i=h,h-=1,j="right"}nf&&of<11&&(e=db(a.display.measure,e))}else{h>0&&(j=d="right");var l;e=a.options.lineWrapping&&(l=g.getClientRects()).length>1?l["right"==d?l.length-1:0]:g.getBoundingClientRect()}if(nf&&of<9&&!h&&(!e||!e.left&&!e.right)){var m=g.parentNode.getClientRects()[0];e=m?{left:m.left,right:m.left+sb(a.display),top:m.top,bottom:m.bottom}:Lf}for(var n=e.top-b.rect.top,o=e.bottom-b.rect.top,p=(n+o)/2,q=b.view.measure.heights,k=0;k<q.length-1&&!(p<q[k]);k++);var r=k?q[k-1]:0,s=q[k],t={left:("right"==j?e.right:e.left)-b.rect.left,right:("left"==j?e.left:e.right)-b.rect.left,top:r,bottom:s};return e.left||e.right||(t.bogus=!0),a.options.singleCursorHeightPerLine||(t.rtop=n,t.rbottom=o),t}function db(a,b){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Xe(a))return b;var c=screen.logicalXDPI/screen.deviceXDPI,d=screen.logicalYDPI/screen.deviceYDPI;return{left:b.left*c,right:b.right*c,top:b.top*d,bottom:b.bottom*d}}function eb(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function fb(a){a.display.externalMeasure=null,Ne(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)eb(a.display.view[b])}function gb(a){fb(a),a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function hb(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ib(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function jb(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=vd(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=_d(b);if("local"==d?g+=Qa(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+("window"==d?0:ib());var i=h.left+("window"==d?0:hb());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function kb(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=hb(),e-=ib();else if("local"==c||!c){var f=a.display.sizer.getBoundingClientRect();d+=f.left,e+=f.top}var g=a.display.lineSpace.getBoundingClientRect();return{left:d-g.left,top:e-g.top}}function lb(a,b,c,d,e){return d||(d=Vd(a.doc,b.line)),jb(a,d,Za(a,d,b.ch,e),c)}function mb(a,b,c,d,e,f){function g(b,g){var h=ab(a,e,b,g?"right":"left",f);return g?h.left=h.right:h.right=h.left,jb(a,d,h,c)}function h(a,b){var c=i[b],d=c.level%2;return a==Ze(c)&&b&&c.level<i[b-1].level?(c=i[--b],a=$e(c)-(c.level%2?0:1),d=!0):a==$e(c)&&b<i.length-1&&c.level<i[b+1].level&&(c=i[++b],a=Ze(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?g(a-1):g(a,d)}d=d||Vd(a.doc,b.line),e||(e=_a(a,d));var i=ae(d),j=b.ch;if(!i)return g(j);var k=ff(i,j),l=h(j,k);return null!=Zg&&(l.other=h(j,Zg)),l}function nb(a,b){var c=0,b=qa(a.doc,b);a.options.lineWrapping||(c=sb(a.display)*b.ch);var d=Vd(a.doc,b.line),e=_d(d)+Qa(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function ob(a,b,c,d){var e=Ff(a,b);return e.xRel=d,c&&(e.outside=!0),e}function pb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,c<0)return ob(d.first,0,!0,-1);var e=$d(d,c),f=d.first+d.size-1;if(e>f)return ob(d.first+d.size-1,Vd(d,f).text.length,!0,1);b<0&&(b=0);for(var g=Vd(d,e);;){var h=qb(a,g,e,b,c),i=md(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=Zd(g=j.to.line)}}function qb(a,b,c,d,e){function f(d){var e=mb(a,Ff(c,d),"line",b,j);return h=!0,g>e.bottom?e.left-i:g<e.top?e.left+i:(h=!1,e.left)}var g=e-_d(b),h=!1,i=2*a.display.wrapper.clientWidth,j=_a(a,b),k=ae(b),l=b.text.length,m=_e(b),n=af(b),o=f(m),p=h,q=f(n),r=h;if(d>q)return ob(c,n,r,1);for(;;){if(k?n==m||n==hf(b,m,1):n-m<=1){for(var s=d<o||d-o<=q-d?m:n,t=d-(s==m?o:q);Le(b.text.charAt(s));)++s;var u=ob(c,s,s==m?p:r,t<-1?-1:t>1?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;x<v;++x)w=hf(b,w,1)}var y=f(w);y>d?(n=w,q=y,(r=h)&&(q+=1e3),l=v):(m=w,o=y,p=h,l-=v)}}function rb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==If){If=Me("pre");for(var b=0;b<49;++b)If.appendChild(document.createTextNode("x")),If.appendChild(Me("br"));If.appendChild(document.createTextNode("x"))}Oe(a.measure,If);var c=If.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),Ne(a.measure),c||1}function sb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=Me("span","xxxxxxxxxx"),c=Me("pre",[b]);Oe(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;return e>2&&(a.cachedCharWidth=e),e||10}function tb(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Nf},Mf?Mf.ops.push(a.curOp):a.curOp.ownsGroup=Mf={ops:[a.curOp],delayedCallbacks:[]}}function ub(a){var b=a.delayedCallbacks,c=0;do{for(;c<b.length;c++)b[c]();for(var d=0;d<a.ops.length;d++){var e=a.ops[d];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++](e.cm)}}while(c<b.length)}function vb(a){var b=a.curOp,c=b.ownsGroup;if(c)try{ub(c)}finally{Mf=null;for(var d=0;d<c.ops.length;d++)c.ops[d].cm.curOp=null;wb(c)}}function wb(a){for(var b=a.ops,c=0;c<b.length;c++)xb(b[c]);for(var c=0;c<b.length;c++)yb(b[c]);for(var c=0;c<b.length;c++)zb(b[c]);for(var c=0;c<b.length;c++)Ab(b[c]);for(var c=0;c<b.length;c++)Bb(b[c])}function xb(a){var b=a.cm,c=b.display;A(b),a.updateMaxLine&&m(b),a.mustUpdate=a.viewChanged||a.forceUpdate||null!=a.scrollTop||a.scrollToPos&&(a.scrollToPos.from.line<c.viewFrom||a.scrollToPos.to.line>=c.viewTo)||c.maxLineChanged&&b.options.lineWrapping,a.update=a.mustUpdate&&new z(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)}function yb(a){a.updatedDisplay=a.mustUpdate&&B(a.cm,a.update)}function zb(a){var b=a.cm,c=b.display;a.updatedDisplay&&F(b),a.barMeasure=o(b),c.maxLineChanged&&!b.options.lineWrapping&&(a.adjustWidthTo=Za(b,c.maxLine,c.maxLine.text.length).left+3,b.display.sizerWidth=a.adjustWidthTo,a.barMeasure.scrollWidth=Math.max(c.scroller.clientWidth,c.sizer.offsetLeft+a.adjustWidthTo+Ta(b)+b.display.barWidth),a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo-Ua(b))),(a.updatedDisplay||a.selectionChanged)&&(a.preparedSelection=c.input.prepareSelection())}function Ab(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeft<b.doc.scrollLeft&&bc(b,Math.min(b.display.scroller.scrollLeft,a.maxScrollLeft),!0),b.display.maxLineChanged=!1),a.preparedSelection&&b.display.input.showSelection(a.preparedSelection),a.updatedDisplay&&E(b,a.barMeasure),(a.updatedDisplay||a.startHeight!=b.doc.height)&&s(b,a.barMeasure),a.selectionChanged&&La(b),b.state.focused&&a.updateInput&&b.display.input.reset(a.typing),a.focus&&a.focus==Pe()&&Y(a.cm)}function Bb(a){var b=a.cm,c=b.display,d=b.doc;if(a.updatedDisplay&&C(b,a.update),null==c.wheelStartX||null==a.scrollTop&&null==a.scrollLeft&&!a.scrollToPos||(c.wheelStartX=c.wheelStartY=null),null==a.scrollTop||c.scroller.scrollTop==a.scrollTop&&!a.forceScroll||(d.scrollTop=Math.max(0,Math.min(c.scroller.scrollHeight-c.scroller.clientHeight,a.scrollTop)),c.scrollbars.setScrollTop(d.scrollTop),c.scroller.scrollTop=d.scrollTop),null==a.scrollLeft||c.scroller.scrollLeft==a.scrollLeft&&!a.forceScroll||(d.scrollLeft=Math.max(0,Math.min(c.scroller.scrollWidth-Ua(b),a.scrollLeft)),c.scrollbars.setScrollLeft(d.scrollLeft),c.scroller.scrollLeft=d.scrollLeft,v(b)),a.scrollToPos){var e=Ec(b,qa(d,a.scrollToPos.from),qa(d,a.scrollToPos.to),a.scrollToPos.margin);a.scrollToPos.isCursor&&b.state.focused&&Dc(b,e)}var f=a.maybeHiddenMarkers,g=a.maybeUnhiddenMarkers;if(f)for(var h=0;h<f.length;++h)f[h].lines.length||zg(f[h],"hide");if(g)for(var h=0;h<g.length;++h)g[h].lines.length&&zg(g[h],"unhide");c.wrapper.offsetHeight&&(d.scrollTop=b.display.scroller.scrollTop),a.changeObjs&&zg(b,"changes",b,a.changeObjs),a.update&&a.update.finish()}function Cb(a,b){if(a.curOp)return b();tb(a);try{return b()}finally{vb(a)}}function Db(a,b){return function(){if(a.curOp)return b.apply(a,arguments);tb(a);try{return b.apply(a,arguments)}finally{vb(a)}}}function Eb(a){return function(){if(this.curOp)return a.apply(this,arguments);tb(this);try{return a.apply(this,arguments)}finally{vb(this)}}}function Fb(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);tb(b);try{return a.apply(this,arguments)}finally{vb(b)}}}function Gb(a,b,c){this.line=b,this.rest=pd(b),this.size=this.rest?Zd(Ce(this.rest))-c+1:1,this.node=this.text=null,this.hidden=sd(a,b)}function Hb(a,b,c){for(var d,e=[],f=b;f<c;f=d){var g=new Gb(a.doc,Vd(a.doc,f),f);d=f+g.size,e.push(g)}return e}function Ib(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)Ef&&qd(a.doc,b)<e.viewTo&&Kb(a);else if(c<=e.viewFrom)Ef&&rd(a.doc,c+d)>e.viewFrom?Kb(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Kb(a);else if(b<=e.viewFrom){var f=Mb(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Kb(a)}else if(c>=e.viewTo){var f=Mb(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Kb(a)}else{var g=Mb(a,b,b,-1),h=Mb(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(Hb(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Kb(a)}var i=e.externalMeasured;i&&(c<i.lineN?i.lineN+=d:b<i.lineN+i.size&&(e.externalMeasured=null))}function Jb(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;if(e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null),!(b<d.viewFrom||b>=d.viewTo)){var f=d.view[Lb(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);De(g,c)==-1&&g.push(c)}}}function Kb(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function Lb(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,b<0)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,b<0)return d}function Mb(a,b,c,d){var e,f=Lb(a,b),g=a.display.view;if(!Ef||c==a.doc.first+a.doc.size)return{index:f,lineN:c};for(var h=0,i=a.display.viewFrom;h<f;h++)i+=g[h].size;if(i!=b){if(d>0){if(f==g.length-1)return null;e=i+g[f].size-b,f++}else e=i-b;b+=e,c+=e}for(;qd(a.doc,c)!=c;){if(f==(d<0?0:g.length-1))return null;c+=d*g[f-(d<0?1:0)].size,f+=d}return{index:f,lineN:c}}function Nb(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=Hb(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=Hb(a,b,d.viewFrom).concat(d.view):d.viewFrom<b&&(d.view=d.view.slice(Lb(a,b))),d.viewFrom=b,d.viewTo<c?d.view=d.view.concat(Hb(a,d.viewTo,c)):d.viewTo>c&&(d.view=d.view.slice(0,Lb(a,c)))),d.viewTo=c}function Ob(a){for(var b=a.display.view,c=0,d=0;d<b.length;d++){var e=b[d];e.hidden||e.node&&!e.changes||++c}return c}function Pb(a){function b(){e.activeTouch&&(f=setTimeout(function(){e.activeTouch=null},1e3),g=e.activeTouch,g.end=+new Date)}function c(a){if(1!=a.touches.length)return!1;var b=a.touches[0];return b.radiusX<=1&&b.radiusY<=1}function d(a,b){if(null==b.left)return!0;var c=b.left-a.left,d=b.top-a.top;return c*c+d*d>400}var e=a.display;xg(e.scroller,"mousedown",Db(a,Ub)),nf&&of<11?xg(e.scroller,"dblclick",Db(a,function(b){if(!ve(a,b)){var c=Tb(a,b);if(c&&!Zb(a,b)&&!Sb(a.display,b)){ug(b);var d=a.findWordAt(c);va(a.doc,d.anchor,d.head)}}})):xg(e.scroller,"dblclick",function(b){ve(a,b)||ug(b)}),Cf||xg(e.scroller,"contextmenu",function(b){pc(a,b)});var f,g={end:0};xg(e.scroller,"touchstart",function(a){if(!c(a)){clearTimeout(f);var b=+new Date;e.activeTouch={start:b,moved:!1,prev:b-g.end<=300?g:null},1==a.touches.length&&(e.activeTouch.left=a.touches[0].pageX,e.activeTouch.top=a.touches[0].pageY)}}),xg(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)}),xg(e.scroller,"touchend",function(c){var f=e.activeTouch;if(f&&!Sb(e,c)&&null!=f.left&&!f.moved&&new Date-f.start<300){var g,h=a.coordsChar(e.activeTouch,"page");g=!f.prev||d(f,f.prev)?new ma(h,h):!f.prev.prev||d(f,f.prev.prev)?a.findWordAt(h):new ma(Ff(h.line,0),qa(a.doc,Ff(h.line+1,0))),a.setSelection(g.anchor,g.head),a.focus(),ug(c)}b()}),xg(e.scroller,"touchcancel",b),xg(e.scroller,"scroll",function(){e.scroller.clientHeight&&(ac(a,e.scroller.scrollTop),bc(a,e.scroller.scrollLeft,!0),zg(a,"scroll",a))}),xg(e.scroller,"mousewheel",function(b){cc(a,b)}),xg(e.scroller,"DOMMouseScroll",function(b){cc(a,b)}),xg(e.wrapper,"scroll",function(){e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),e.dragFunctions={simple:function(b){ve(a,b)||wg(b)},start:function(b){_b(a,b)},drop:Db(a,$b)};var h=e.input.getField();xg(h,"keyup",function(b){kc.call(a,b)}),xg(h,"keydown",Db(a,ic)),xg(h,"keypress",Db(a,lc)),xg(h,"focus",Ie(nc,a)),xg(h,"blur",Ie(oc,a))}function Qb(b,c,d){var e=d&&d!=a.Init;if(!c!=!e){var f=b.display.dragFunctions,g=c?xg:yg;g(b.display.scroller,"dragstart",f.start),g(b.display.scroller,"dragenter",f.simple),g(b.display.scroller,"dragover",f.simple),g(b.display.scroller,"drop",f.drop)}}function Rb(a){var b=a.display;b.lastWrapHeight==b.wrapper.clientHeight&&b.lastWrapWidth==b.wrapper.clientWidth||(b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize())}function Sb(a,b){for(var c=re(b);c!=a.wrapper;c=c.parentNode)if(!c||1==c.nodeType&&"true"==c.getAttribute("cm-ignore-events")||c.parentNode==a.sizer&&c!=a.mover)return!0}function Tb(a,b,c,d){var e=a.display;if(!c&&"true"==re(b).getAttribute("cm-not-content"))return null;var f,g,h=e.lineSpace.getBoundingClientRect();try{f=b.clientX-h.left,g=b.clientY-h.top}catch(b){return null}var i,j=pb(a,f,g);if(d&&1==j.xRel&&(i=Vd(a.doc,j.line).text).length==j.ch){var k=Gg(i,i.length,a.options.tabSize)-i.length;j=Ff(j.line,Math.max(0,Math.round((f-Sa(a.display).left)/sb(a.display))-k))}return j}function Ub(a){var b=this,c=b.display;if(!(c.activeTouch&&c.input.supportsTouch()||ve(b,a))){if(c.shift=a.shiftKey,Sb(c,a))return void(pf||(c.scroller.draggable=!1,setTimeout(function(){c.scroller.draggable=!0},100)));if(!Zb(b,a)){var d=Tb(b,a);switch(window.focus(),se(a)){case 1:d?Vb(b,a,d):re(a)==c.scroller&&ug(a);break;case 2:pf&&(b.state.lastMiddleDown=+new Date),d&&va(b.doc,d),setTimeout(function(){c.input.focus()},20),ug(a);break;case 3:Cf?pc(b,a):mc(b)}}}}function Vb(a,b,c){nf?setTimeout(Ie(Y,a),0):a.curOp.focus=Pe();var d,e=+new Date;Kf&&Kf.time>e-400&&0==Gf(Kf.pos,c)?d="triple":Jf&&Jf.time>e-400&&0==Gf(Jf.pos,c)?(d="double",Kf={time:e,pos:c}):(d="single",Jf={time:e,pos:c});var f,g=a.doc.sel,h=yf?b.metaKey:b.ctrlKey;a.options.dragDrop&&Tg&&!Z(a)&&"single"==d&&(f=g.contains(c))>-1&&(Gf((f=g.ranges[f]).from(),c)<0||c.xRel>0)&&(Gf(f.to(),c)>0||c.xRel<0)?Wb(a,b,c,h):Xb(a,b,c,d,h)}function Wb(a,b,c,d){var e=a.display,f=+new Date,g=Db(a,function(h){pf&&(e.scroller.draggable=!1),a.state.draggingText=!1,yg(document,"mouseup",g),yg(e.scroller,"drop",g),Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)<10&&(ug(h),!d&&+new Date-200<f&&va(a.doc,c),pf||nf&&9==of?setTimeout(function(){document.body.focus(),e.input.focus()},20):e.input.focus())});pf&&(e.scroller.draggable=!0),a.state.draggingText=g,e.scroller.dragDrop&&e.scroller.dragDrop(),xg(document,"mouseup",g),xg(e.scroller,"drop",g)}function Xb(a,b,c,d,e){function f(b){if(0!=Gf(q,b))if(q=b,"rect"==d){for(var e=[],f=a.options.tabSize,g=Gg(Vd(j,c.line).text,c.ch,f),h=Gg(Vd(j,b.line).text,b.ch,f),i=Math.min(g,h),n=Math.max(g,h),o=Math.min(c.line,b.line),p=Math.min(a.lastLine(),Math.max(c.line,b.line));o<=p;o++){var r=Vd(j,o).text,s=Ae(r,i,f);i==n?e.push(new ma(Ff(o,s),Ff(o,s))):r.length>s&&e.push(new ma(Ff(o,s),Ff(o,Ae(r,n,f))))}e.length||e.push(new ma(c,c)),Ba(j,na(m.ranges.slice(0,l).concat(e),l),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var t=k,u=t.anchor,v=b;if("single"!=d){if("double"==d)var w=a.findWordAt(b);else var w=new ma(Ff(b.line,0),qa(j,Ff(b.line+1,0)));Gf(w.anchor,u)>0?(v=w.head,u=X(t.from(),w.anchor)):(v=w.anchor,u=W(t.to(),w.head))}var e=m.ranges.slice(0);e[l]=new ma(qa(j,u),v),Ba(j,na(e,l),Eg)}}function g(b){var c=++s,e=Tb(a,b,!0,"rect"==d);if(e)if(0!=Gf(e,q)){a.curOp.focus=Pe(),f(e);var h=u(i,j);(e.line>=h.to||e.line<h.from)&&setTimeout(Db(a,function(){s==c&&g(b)}),150)}else{var k=b.clientY<r.top?-20:b.clientY>r.bottom?20:0;k&&setTimeout(Db(a,function(){s==c&&(i.scroller.scrollTop+=k,g(b))}),50)}}function h(a){s=1/0,ug(a),i.input.focus(),yg(document,"mousemove",t),yg(document,"mouseup",v),j.history.lastSelOrigin=null}var i=a.display,j=a.doc;ug(b);var k,l,m=j.sel,n=m.ranges;if(e&&!b.shiftKey?(l=j.sel.contains(c),k=l>-1?n[l]:new ma(c,c)):(k=j.sel.primary(),l=j.sel.primIndex),b.altKey)d="rect",e||(k=new ma(c,c)),c=Tb(a,b,!0,!0),l=-1;else if("double"==d){var o=a.findWordAt(c);k=a.display.shift||j.extend?ua(j,k,o.anchor,o.head):o}else if("triple"==d){var p=new ma(Ff(c.line,0),qa(j,Ff(c.line+1,0)));k=a.display.shift||j.extend?ua(j,k,p.anchor,p.head):p}else k=ua(j,k,c);e?l==-1?(l=n.length,Ba(j,na(n.concat([k]),l),{scroll:!1,origin:"*mouse"})):n.length>1&&n[l].empty()&&"single"==d&&!b.shiftKey?(Ba(j,na(n.slice(0,l).concat(n.slice(l+1)),0)),m=j.sel):xa(j,l,k,Eg):(l=0,Ba(j,new la([k],0),Eg),m=j.sel);var q=c,r=i.wrapper.getBoundingClientRect(),s=0,t=Db(a,function(a){se(a)?g(a):h(a)}),v=Db(a,h);xg(document,"mousemove",t),xg(document,"mouseup",v)}function Yb(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&ug(b);var h=a.display,i=h.lineDiv.getBoundingClientRect();if(g>i.bottom||!xe(a,c))return qe(b);g-=i.top-h.viewOffset;for(var j=0;j<a.options.gutters.length;++j){var k=h.gutters.childNodes[j];if(k&&k.getBoundingClientRect().right>=f){var l=$d(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),qe(b)}}}function Zb(a,b){return Yb(a,b,"gutterClick",!0,te)}function $b(a){var b=this;if(!ve(b,a)&&!Sb(b.display,a)){ug(a),nf&&(Of=+new Date);var c=Tb(b,a,!0),d=a.dataTransfer.files;if(c&&!Z(b))if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){var h=new FileReader;h.onload=Db(b,function(){if(f[d]=h.result,++g==e){c=qa(b.doc,c);var a={from:c,to:c,text:Ug(f.join("\n")),origin:"paste"};wc(b.doc,a),Aa(b.doc,oa(c,Uf(a)))}}),h.readAsText(a)},i=0;i<e;++i)h(d[i],i);else{if(b.state.draggingText&&b.doc.sel.contains(c)>-1)return b.state.draggingText(a),void setTimeout(function(){b.display.input.focus()},20);try{var f=a.dataTransfer.getData("Text");if(f){if(b.state.draggingText&&!(yf?a.altKey:a.ctrlKey))var j=b.listSelections();if(Ca(b.doc,oa(c,c)),j)for(var i=0;i<j.length;++i)Cc(b.doc,"",j[i].anchor,j[i].head,"drag");b.replaceSelection(f,"around","paste"),b.display.input.focus()}}catch(a){}}}}function _b(a,b){if(nf&&(!a.state.draggingText||+new Date-Of<100))return void wg(b);if(!ve(a,b)&&!Sb(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.setDragImage&&!tf)){var c=Me("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",sf&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop),b.dataTransfer.setDragImage(c,0,0),sf&&c.parentNode.removeChild(c)}}function ac(a,b){Math.abs(a.doc.scrollTop-b)<2||(a.doc.scrollTop=b,kf||D(a,{top:b}),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbars.setScrollTop(b),kf&&D(a),Ma(a,100))}function bc(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,v(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function cc(a,b){var c=Rf(b),d=c.x,e=c.y,f=a.display,g=f.scroller;if(d&&g.scrollWidth>g.clientWidth||e&&g.scrollHeight>g.clientHeight){if(e&&yf&&pf)a:for(var h=b.target,i=f.view;h!=g;h=h.parentNode)for(var j=0;j<i.length;j++)if(i[j].node==h){a.display.currentWheelTarget=h;break a}if(d&&!kf&&!sf&&null!=Qf)return e&&ac(a,Math.max(0,Math.min(g.scrollTop+e*Qf,g.scrollHeight-g.clientHeight))),bc(a,Math.max(0,Math.min(g.scrollLeft+d*Qf,g.scrollWidth-g.clientWidth))),ug(b),void(f.wheelStartX=null);if(e&&null!=Qf){var k=e*Qf,l=a.doc.scrollTop,m=l+f.wrapper.clientHeight;k<0?l=Math.max(0,l+k-50):m=Math.min(a.doc.height,m+k+50),D(a,{top:l,bottom:m})}Pf<20&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=d,f.wheelDY=e,setTimeout(function(){if(null!=f.wheelStartX){var a=g.scrollLeft-f.wheelStartX,b=g.scrollTop-f.wheelStartY,c=b&&f.wheelDY&&b/f.wheelDY||a&&f.wheelDX&&a/f.wheelDX;f.wheelStartX=f.wheelStartY=null,c&&(Qf=(Qf*Pf+c)/(Pf+1),++Pf)}},200)):(f.wheelDX+=d,f.wheelDY+=e))}}function dc(a,b,c){if("string"==typeof b&&(b=dg[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{Z(a)&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Cg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function ec(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=fg(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&fg(b,a.options.extraKeys,c,a)||fg(b,a.options.keyMap,c,a)}function fc(a,b,c,d){var e=a.state.keySeq;if(e){if(gg(b))return"handled";Sf.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())}),b=e+" "+b}var f=ec(a,b,d);return"multi"==f&&(a.state.keySeq=b),"handled"==f&&te(a,"keyHandled",a,b,c),"handled"!=f&&"multi"!=f||(ug(c),La(a)),e&&!f&&/\'$/.test(b)?(ug(c),!0):!!f}function gc(a,b){var c=hg(b,!0);return!!c&&(b.shiftKey&&!a.state.keySeq?fc(a,"Shift-"+c,b,function(b){return dc(a,b,!0)})||fc(a,c,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return dc(a,b)}):fc(a,c,b,function(b){return dc(a,b)}))}function hc(a,b,c){return fc(a,"'"+c+"'",b,function(b){return dc(a,b,!0)})}function ic(a){var b=this;if(b.curOp.focus=Pe(),!ve(b,a)){nf&&of<11&&27==a.keyCode&&(a.returnValue=!1);var c=a.keyCode;b.display.shift=16==c||a.shiftKey;var d=gc(b,a);sf&&(Tf=d?c:null,!d&&88==c&&!Wg&&(yf?a.metaKey:a.ctrlKey)&&b.replaceSelection("",null,"cut")),18!=c||/\bCodeMirror-crosshair\b/.test(b.display.lineDiv.className)||jc(b)}}function jc(a){function b(a){18!=a.keyCode&&a.altKey||(Qg(c,"CodeMirror-crosshair"),yg(document,"keyup",b),yg(document,"mouseover",b))}var c=a.display.lineDiv;Rg(c,"CodeMirror-crosshair"),xg(document,"keyup",b),xg(document,"mouseover",b)}function kc(a){16==a.keyCode&&(this.doc.sel.shift=!1),ve(this,a)}function lc(a){var b=this;if(!(Sb(b.display,a)||ve(b,a)||a.ctrlKey&&!a.altKey||yf&&a.metaKey)){var c=a.keyCode,d=a.charCode;if(sf&&c==Tf)return Tf=null,void ug(a);if(!sf||a.which&&!(a.which<10)||!gc(b,a)){var e=String.fromCharCode(null==d?c:d);hc(b,a,e)||b.display.input.onKeyPress(a)}}}function mc(a){a.state.delayingBlurEvent=!0,setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,oc(a))},100)}function nc(a){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1),"nocursor"!=a.options.readOnly&&(a.state.focused||(zg(a,"focus",a),a.state.focused=!0,Rg(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),pf&&setTimeout(function(){a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),La(a))}function oc(a){a.state.delayingBlurEvent||(a.state.focused&&(zg(a,"blur",a),a.state.focused=!1,Qg(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function pc(a,b){Sb(a.display,b)||qc(a,b)||a.display.input.onContextMenu(b)}function qc(a,b){return!!xe(a,"gutterContextMenu")&&Yb(a,b,"gutterContextMenu",!1,zg)}function rc(a,b){if(Gf(a,b.from)<0)return a;if(Gf(a,b.to)<=0)return Uf(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=Uf(b).ch-b.to.ch),Ff(c,d)}function sc(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new ma(rc(e.anchor,b),rc(e.head,b)))}return na(c,a.sel.primIndex)}function tc(a,b,c){return a.line==b.line?Ff(c.line,a.ch-b.ch+c.ch):Ff(c.line+(a.line-b.line),a.ch)}function uc(a,b,c){for(var d=[],e=Ff(a.first,0),f=e,g=0;g<b.length;g++){var h=b[g],i=tc(h.from,e,f),j=tc(Uf(h),e,f);if(e=h.to,f=j,"around"==c){var k=a.sel.ranges[g],l=Gf(k.head,k.anchor)<0;d[g]=new ma(l?j:i,l?i:j)}else d[g]=new ma(i,i)}return new la(d,a.sel.primIndex)}function vc(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};return c&&(d.update=function(b,c,d,e){b&&(this.from=qa(a,b)),c&&(this.to=qa(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),zg(a,"beforeChange",a,d),a.cm&&zg(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function wc(a,b,c){if(a.cm){if(!a.cm.curOp)return Db(a.cm,wc)(a,b,c);if(a.cm.state.suppressEdits)return}if(!(xe(a,"beforeChange")||a.cm&&xe(a.cm,"beforeChange"))||(b=vc(a,b,!0))){var d=Df&&!c&&ed(a,b.from,b.to);if(d)for(var e=d.length-1;e>=0;--e)xc(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else xc(a,b)}}function xc(a,b){if(1!=b.text.length||""!=b.text[0]||0!=Gf(b.from,b.to)){var c=sc(a,b);fe(a,b,c,a.cm?a.cm.curOp.id:NaN),Ac(a,b,c,bd(a,b));var d=[];Td(a,function(a,c){c||De(d,a.history)!=-1||(pe(a.history,b),d.push(a.history)),Ac(a,b,null,bd(a,b));
})}}function yc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var d,e=a.history,f=a.sel,g="undo"==b?e.done:e.undone,h="undo"==b?e.undone:e.done,i=0;i<g.length&&(d=g[i],c?!d.ranges||d.equals(a.sel):d.ranges);i++);if(i!=g.length){for(e.lastOrigin=e.lastSelOrigin=null;d=g.pop(),d.ranges;){if(ie(d,h),c&&!d.equals(a.sel))return void Ba(a,d,{clearRedo:!1});f=d}var j=[];ie(f,h),h.push({changes:j,generation:e.generation}),e.generation=d.generation||++e.maxGeneration;for(var k=xe(a,"beforeChange")||a.cm&&xe(a.cm,"beforeChange"),i=d.changes.length-1;i>=0;--i){var l=d.changes[i];if(l.origin=b,k&&!vc(a,l,!1))return void(g.length=0);j.push(ce(a,l));var m=i?sc(a,l):Ce(g);Ac(a,l,m,dd(a,l)),!i&&a.cm&&a.cm.scrollIntoView({from:l.from,to:Uf(l)});var n=[];Td(a,function(a,b){b||De(n,a.history)!=-1||(pe(a.history,l),n.push(a.history)),Ac(a,l,null,dd(a,l))})}}}}function zc(a,b){if(0!=b&&(a.first+=b,a.sel=new la(Ee(a.sel.ranges,function(a){return new ma(Ff(a.anchor.line+b,a.anchor.ch),Ff(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){Ib(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)Jb(a.cm,d,"gutter")}}function Ac(a,b,c,d){if(a.cm&&!a.cm.curOp)return Db(a.cm,Ac)(a,b,c,d);if(b.to.line<a.first)return void zc(a,b.text.length-1-(b.to.line-b.from.line));if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);zc(a,e),b={from:Ff(a.first,0),to:Ff(b.to.line+e,b.to.ch),text:[Ce(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:Ff(f,Vd(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=Wd(a,b.from,b.to),c||(c=sc(a,b)),a.cm?Bc(a.cm,b,d):Qd(a,b,d),Ca(a,c,Dg)}}function Bc(a,b,c){var d=a.doc,e=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=Zd(od(Vd(d,g.line))),d.iter(j,h.line+1,function(a){if(a==e.maxLine)return i=!0,!0})),d.sel.contains(b.from,b.to)>-1&&we(a),Qd(d,b,c,f(a)),a.options.lineWrapping||(d.iter(j,g.line+b.text.length,function(a){var b=l(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,i=!1)}),i&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,g.line),Ma(a,400);var k=b.text.length-(h.line-g.line)-1;b.full?Ib(a):g.line!=h.line||1!=b.text.length||Pd(a.doc,b)?Ib(a,g.line,h.line+1,k):Jb(a,g.line,"text");var m=xe(a,"changes"),n=xe(a,"change");if(n||m){var o={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};n&&te(a,"change",a,o),m&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(o)}a.display.selForContextMenu=null}function Cc(a,b,c,d,e){if(d||(d=c),Gf(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=Ug(b)),wc(a,{from:c,to:d,text:b,origin:e})}function Dc(a,b){if(!ve(a,"scrollCursorIntoView")){var c=a.display,d=c.sizer.getBoundingClientRect(),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!vf){var f=Me("div","",null,"position: absolute; top: "+(b.top-c.viewOffset-Qa(a.display))+"px; height: "+(b.bottom-b.top+Ta(a)+c.barHeight)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}}function Ec(a,b,c,d){null==d&&(d=0);for(var e=0;e<5;e++){var f=!1,g=mb(a,b),h=c&&c!=b?mb(a,c):g,i=Gc(a,Math.min(g.left,h.left),Math.min(g.top,h.top)-d,Math.max(g.left,h.left),Math.max(g.bottom,h.bottom)+d),j=a.doc.scrollTop,k=a.doc.scrollLeft;if(null!=i.scrollTop&&(ac(a,i.scrollTop),Math.abs(a.doc.scrollTop-j)>1&&(f=!0)),null!=i.scrollLeft&&(bc(a,i.scrollLeft),Math.abs(a.doc.scrollLeft-k)>1&&(f=!0)),!f)break}return g}function Fc(a,b,c,d,e){var f=Gc(a,b,c,d,e);null!=f.scrollTop&&ac(a,f.scrollTop),null!=f.scrollLeft&&bc(a,f.scrollLeft)}function Gc(a,b,c,d,e){var f=a.display,g=rb(a.display);c<0&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=Va(a),j={};e-c>i&&(e=c+i);var k=a.doc.height+Ra(f),l=c<g,m=e>k-g;if(c<h)j.scrollTop=l?0:c;else if(e>h+i){var n=Math.min(c,(m?k:e)-i);n!=h&&(j.scrollTop=n)}var o=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft,p=Ua(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0),q=d-b>p;return q&&(d=b+p),b<10?j.scrollLeft=0:b<o?j.scrollLeft=Math.max(0,b-(q?0:10)):d>p+o-3&&(j.scrollLeft=d+(q?0:10)-p),j}function Hc(a,b,c){null==b&&null==c||Jc(a),null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b),null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function Ic(a){Jc(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?Ff(b.line,b.ch-1):b,d=Ff(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function Jc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=nb(a,b.from),d=nb(a,b.to),e=Gc(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function Kc(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=Pa(a,b):c="prev");var g=a.options.tabSize,h=Vd(f,b),i=Gg(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var j,k=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(j=f.mode.indent(e,h.text.slice(k.length),h.text),j==Cg||j>150)){if(!d)return;c="prev"}}else j=0,c="not";"prev"==c?j=b>f.first?Gg(Vd(f,b-1).text,null,g):0:"add"==c?j=i+a.options.indentUnit:"subtract"==c?j=i-a.options.indentUnit:"number"==typeof c&&(j=i+c),j=Math.max(0,j);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(j/g);n;--n)m+=g,l+="\t";if(m<j&&(l+=Be(j-m)),l!=k)return Cc(f,l,Ff(b,0),Ff(b,k.length),"+input"),h.stateAfter=null,!0;for(var n=0;n<f.sel.ranges.length;n++){var o=f.sel.ranges[n];if(o.head.line==b&&o.head.ch<k.length){var m=Ff(b,k.length);xa(f,n,new ma(m,m));break}}}function Lc(a,b,c,d){var e=b,f=b;return"number"==typeof b?f=Vd(a,pa(a,b)):e=Zd(b),null==e?null:(d(f,e)&&a.cm&&Jb(a.cm,e,c),f)}function Mc(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&Gf(f.from,Ce(d).to)<=0;){var g=d.pop();if(Gf(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}Cb(a,function(){for(var b=d.length-1;b>=0;b--)Cc(a.doc,"",d[b].from,d[b].to,"+delete");Ic(a)})}function Nc(a,b,c,d,e){function f(){var b=h+c;return b<a.first||b>=a.first+a.size?l=!1:(h=b,k=Vd(a,b))}function g(a){var b=(e?hf:jf)(k,i,c,!0);if(null==b){if(a||!f())return l=!1;i=e?(c<0?af:_e)(k):c<0?k.text.length:0}else i=b;return!0}var h=b.line,i=b.ch,j=c,k=Vd(a,h),l=!0;if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=a.cm&&a.cm.getHelper(b,"wordChars"),p=!0;!(c<0)||g(!p);p=!1){var q=k.text.charAt(i)||"\n",r=Je(q,o)?"w":n&&"\n"==q?"n":!n||/\s/.test(q)?null:"p";if(!n||p||r||(r="s"),m&&m!=r){c<0&&(c=1,g());break}if(r&&(m=r),c>0&&!g(!p))break}var s=Ga(a,Ff(h,i),j,!0);return l||(s.hitSide=!0),s}function Oc(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);e=b.top+c*(h-(c<0?1.5:.5)*rb(a.display))}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(;;){var i=pb(a,g,e);if(!i.outside)break;if(c<0?e<=0:e>=f.height){i.hitSide=!0;break}e+=5*c}return i}function Pc(b,c,d,e){a.defaults[b]=c,d&&(Wf[b]=e?function(a,b,c){c!=Xf&&d(a,b,c)}:d)}function Qc(a){for(var b,c,d,e,f=a.split(/-(?!$)/),a=f[f.length-1],g=0;g<f.length-1;g++){var h=f[g];if(/^(cmd|meta|m)$/i.test(h))e=!0;else if(/^a(lt)?$/i.test(h))b=!0;else if(/^(c|ctrl|control)$/i.test(h))c=!0;else{if(!/^s(hift)$/i.test(h))throw new Error("Unrecognized modifier name: "+h);d=!0}}return b&&(a="Alt-"+a),c&&(a="Ctrl-"+a),e&&(a="Cmd-"+a),d&&(a="Shift-"+a),a}function Rc(a){return"string"==typeof a?eg[a]:a}function Sc(a,b,c,d,e){if(d&&d.shared)return Tc(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return Db(a.cm,Sc)(a,b,c,d,e);var f=new kg(a,e),g=Gf(b,c);if(d&&He(d,f,!1),g>0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=Me("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(nd(a,b.line,b,c,f)||b.line!=c.line&&nd(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ef=!0}f.addToHistory&&fe(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var h,i=b.line,j=a.cm;if(a.iter(i,c.line+1,function(a){j&&f.collapsed&&!j.options.lineWrapping&&od(a)==j.display.maxLine&&(h=!0),f.collapsed&&i!=b.line&&Yd(a,0),$c(a,new Xc(f,i==b.line?b.ch:null,i==c.line?c.ch:null)),++i}),f.collapsed&&a.iter(b.line,c.line+1,function(b){sd(a,b)&&Yd(b,0)}),f.clearOnEnter&&xg(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(Df=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.id=++jg,f.atomic=!0),j){if(h&&(j.curOp.updateMaxLine=!0),f.collapsed)Ib(j,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(var k=b.line;k<=c.line;k++)Jb(j,k,"text");f.atomic&&Ea(j.doc),te(j,"markerAdded",j,f)}return f}function Tc(a,b,c,d,e){d=He(d),d.shared=!1;var f=[Sc(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Td(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(Sc(a,qa(a,b),qa(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=Ce(f)}),new lg(f,g)}function Uc(a){return a.findMarks(Ff(a.first,0),a.clipPos(Ff(a.lastLine())),function(a){return a.parent})}function Vc(a,b){for(var c=0;c<b.length;c++){var d=b[c],e=d.find(),f=a.clipPos(e.from),g=a.clipPos(e.to);if(Gf(f,g)){var h=Sc(a,f,g,d.primary,d.primary.type);d.markers.push(h),h.parent=d}}}function Wc(a){for(var b=0;b<a.length;b++){var c=a[b],d=[c.primary.doc];Td(c.primary.doc,function(a){d.push(a)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];De(d,f.doc)==-1&&(f.parent=null,c.markers.splice(e--,1))}}}function Xc(a,b,c){this.marker=a,this.from=b,this.to=c}function Yc(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Zc(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function $c(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function _c(a,b,c){if(a)for(var d,e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||f.from==b&&"bookmark"==g.type&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(d||(d=[])).push(new Xc(g,f.from,i?null:f.to))}}return d}function ad(a,b,c){if(a)for(var d,e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(d||(d=[])).push(new Xc(g,i?null:f.from-b,null==f.to?null:f.to-b))}}return d}function bd(a,b){if(b.full)return null;var c=sa(a,b.from.line)&&Vd(a,b.from.line).markedSpans,d=sa(a,b.to.line)&&Vd(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==Gf(b.from,b.to),h=_c(c,e,g),i=ad(d,f,g),j=1==b.text.length,k=Ce(b.text).length+(j?e:0);if(h)for(var l=0;l<h.length;++l){var m=h[l];if(null==m.to){var n=Yc(i,m.marker);n?j&&(m.to=null==n.to?null:n.to+k):m.to=e}}if(i)for(var l=0;l<i.length;++l){var m=i[l];if(null!=m.to&&(m.to+=k),null==m.from){var n=Yc(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}h&&(h=cd(h)),i&&i!=h&&(i=cd(i));var o=[h];if(!j){var p,q=b.text.length-2;if(q>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(p||(p=[])).push(new Xc(h[l].marker,null,null));for(var l=0;l<q;++l)o.push(p);o.push(i)}return o}function cd(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&c.marker.clearWhenEmpty!==!1&&a.splice(b--,1)}return a.length?a:null}function dd(a,b){var c=le(a,b),d=bd(a,b);if(!c)return d;if(!d)return c;for(var e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g)a:for(var h=0;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}else g&&(c[e]=g)}return c}function ed(a,b,c){var d=null;if(a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&De(d,c)!=-1||(d||(d=[])).push(c)}}),!d)return null;for(var e=[{from:b,to:c}],f=0;f<d.length;++f)for(var g=d[f],h=g.find(0),i=0;i<e.length;++i){var j=e[i];if(!(Gf(j.to,h.from)<0||Gf(j.from,h.to)>0)){var k=[i,1],l=Gf(j.from,h.from),m=Gf(j.to,h.to);(l<0||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(m>0||!g.inclusiveRight&&!m)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function fd(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function gd(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function hd(a){return a.inclusiveLeft?-1:0}function id(a){return a.inclusiveRight?1:0}function jd(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var d=a.find(),e=b.find(),f=Gf(d.from,e.from)||hd(a)-hd(b);if(f)return-f;var g=Gf(d.to,e.to)||id(a)-id(b);return g?g:b.id-a.id}function kd(a,b){var c,d=Ef&&a.markedSpans;if(d)for(var e,f=0;f<d.length;++f)e=d[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!c||jd(c,e.marker)<0)&&(c=e.marker);return c}function ld(a){return kd(a,!0)}function md(a){return kd(a,!1)}function nd(a,b,c,d,e){var f=Vd(a,b),g=Ef&&f.markedSpans;if(g)for(var h=0;h<g.length;++h){var i=g[h];if(i.marker.collapsed){var j=i.marker.find(0),k=Gf(j.from,c)||hd(i.marker)-hd(e),l=Gf(j.to,d)||id(i.marker)-id(e);if(!(k>=0&&l<=0||k<=0&&l>=0)&&(k<=0&&(Gf(j.to,c)>0||i.marker.inclusiveRight&&e.inclusiveLeft)||k>=0&&(Gf(j.from,d)<0||i.marker.inclusiveLeft&&e.inclusiveRight)))return!0}}}function od(a){for(var b;b=ld(a);)a=b.find(-1,!0).line;return a}function pd(a){for(var b,c;b=md(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function qd(a,b){var c=Vd(a,b),d=od(c);return c==d?b:Zd(d)}function rd(a,b){if(b>a.lastLine())return b;var c,d=Vd(a,b);if(!sd(a,d))return b;for(;c=md(d);)d=c.find(1,!0).line;return Zd(d)+1}function sd(a,b){var c=Ef&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed){if(null==d.from)return!0;if(!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&td(a,b,d))return!0}}function td(a,b,c){if(null==c.to){var d=c.marker.find(1,!0);return td(a,d.line,Yc(d.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var e,f=0;f<b.markedSpans.length;++f)if(e=b.markedSpans[f],e.marker.collapsed&&!e.marker.widgetNode&&e.from==c.to&&(null==e.to||e.to!=c.from)&&(e.marker.inclusiveLeft||c.marker.inclusiveRight)&&td(a,b,e))return!0}function ud(a,b,c){_d(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Hc(a,null,c)}function vd(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!Ng(document.body,a.node)){var c="position: relative;";a.coverGutter&&(c+="margin-left: -"+b.display.gutters.offsetWidth+"px;"),a.noHScroll&&(c+="width: "+b.display.wrapper.clientWidth+"px;"),Oe(b.display.measure,Me("div",[a.node],null,c))}return a.height=a.node.offsetHeight}function wd(a,b,c,d){var e=new mg(a,c,d),f=a.cm;return f&&e.noHScroll&&(f.display.alignWidgets=!0),Lc(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,f&&!sd(a,b)){var d=_d(b)<a.scrollTop;Yd(b,b.height+vd(e)),d&&Hc(f,null,e.height),f.curOp.forceUpdate=!0}return!0}),e}function xd(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),fd(a),gd(a,c);var e=d?d(a):1;e!=a.height&&Yd(a,e)}function yd(a){a.parent=null,fd(a)}function zd(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:new RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return a}function Ad(b,c){if(b.blankLine)return b.blankLine(c);if(b.innerMode){var d=a.innerMode(b,c);return d.mode.blankLine?d.mode.blankLine(d.state):void 0}}function Bd(b,c,d,e){for(var f=0;f<10;f++){e&&(e[0]=a.innerMode(b,d).mode);var g=b.token(c,d);if(c.pos>c.start)return g}throw new Error("Mode "+b.name+" failed to advance stream.")}function Cd(a,b,c,d){function e(a){return{start:l.start,end:l.pos,string:l.current(),type:f||null,state:a?bg(g.mode,k):k}}var f,g=a.doc,h=g.mode;b=qa(g,b);var i,j=Vd(g,b.line),k=Pa(a,b.line,c),l=new ig(j.text,a.options.tabSize);for(d&&(i=[]);(d||l.pos<b.ch)&&!l.eol();)l.start=l.pos,f=Bd(h,l,k),d&&i.push(e(!0));return d?i:e()}function Dd(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var i,j=0,k=null,l=new ig(b,a.options.tabSize),m=a.options.addModeClass&&[null];for(""==b&&zd(Ad(c,d),f);!l.eol();){if(l.pos>a.options.maxHighlightLength?(h=!1,g&&Gd(a,b,d,l.pos),l.pos=b.length,i=null):i=zd(Bd(c,l,d,m),f),m){var n=m[0].name;n&&(i="m-"+(i?n+" "+i:n))}if(!h||k!=i){for(;j<l.start;)j=Math.min(l.start,j+5e4),e(j,k);k=i}l.start=l.pos}for(;j<l.pos;){var o=Math.min(l.pos,j+5e4);e(o,k),j=o}}function Ed(a,b,c,d){var e=[a.state.modeGen],f={};Dd(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},f,d);for(var g=0;g<a.state.overlays.length;++g){var h=a.state.overlays[g],i=1,j=0;Dd(a,b.text,h.mode,!0,function(a,b){for(var c=i;j<a;){var d=e[i];d>a&&e.splice(i,1,a,e[i+1],d),i+=2,j=Math.min(a,d)}if(b)if(h.opaque)e.splice(c,i-c,a,"cm-overlay "+b),i=c+2;else for(;c<i;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"cm-overlay "+b}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function Fd(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=Ed(a,b,b.stateAfter=Pa(a,Zd(b)));b.styles=d.styles,d.classes?b.styleClasses=d.classes:b.styleClasses&&(b.styleClasses=null),c===a.doc.frontier&&a.doc.frontier++}return b.styles}function Gd(a,b,c,d){var e=a.doc.mode,f=new ig(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&Ad(e,c);!f.eol()&&f.pos<=a.options.maxHighlightLength;)Bd(e,f,c),f.start=f.pos}function Hd(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?pg:og;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function Id(a,b){var c=Me("span",null,null,pf?"padding-right: .1px":null),d={pre:Me("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,splitSpaces:(nf||pf)&&a.getOption("lineWrapping")};b.measure={};for(var e=0;e<=(b.rest?b.rest.length:0);e++){var f,g=e?b.rest[e-1]:b.line;d.pos=0,d.addToken=Kd,We(a.display.measure)&&(f=ae(g))&&(d.addToken=Md(d.addToken,f)),d.map=[];var h=b!=a.display.externalMeasured&&Zd(g);Od(g,d,Fd(a,g,h)),g.styleClasses&&(g.styleClasses.bgClass&&(d.bgClass=Re(g.styleClasses.bgClass,d.bgClass||"")),g.styleClasses.textClass&&(d.textClass=Re(g.styleClasses.textClass,d.textClass||""))),0==d.map.length&&d.map.push(0,0,d.content.appendChild(Ve(a.display.measure))),0==e?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}return pf&&/\bcm-tab\b/.test(d.content.lastChild.className)&&(d.content.className="cm-tab-wrap-hack"),zg(a,"renderLine",a,b.line,d.pre),d.pre.className&&(d.textClass=Re(d.pre.className,d.textClass||"")),d}function Jd(a){var b=Me("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b.setAttribute("aria-label",b.title),b}function Kd(a,b,c,d,e,f,g){if(b){var h=a.splitSpaces?b.replace(/ {3,}/g,Ld):b,i=a.cm.state.specialChars,j=!1;if(i.test(b))for(var k=document.createDocumentFragment(),l=0;;){i.lastIndex=l;var m=i.exec(b),n=m?m.index-l:b.length-l;if(n){var o=document.createTextNode(h.slice(l,l+n));nf&&of<9?k.appendChild(Me("span",[o])):k.appendChild(o),a.map.push(a.pos,a.pos+n,o),a.col+=n,a.pos+=n}if(!m)break;if(l+=n+1,"\t"==m[0]){var p=a.cm.options.tabSize,q=p-a.col%p,o=k.appendChild(Me("span",Be(q),"cm-tab"));o.setAttribute("role","presentation"),o.setAttribute("cm-text","\t"),a.col+=q}else{var o=a.cm.options.specialCharPlaceholder(m[0]);o.setAttribute("cm-text",m[0]),nf&&of<9?k.appendChild(Me("span",[o])):k.appendChild(o),a.col+=1}a.map.push(a.pos,a.pos+1,o),a.pos++}else{a.col+=b.length;var k=document.createTextNode(h);a.map.push(a.pos,a.pos+b.length,k),nf&&of<9&&(j=!0),a.pos+=b.length}if(c||d||e||j||g){var r=c||"";d&&(r+=d),e&&(r+=e);var s=Me("span",[k],r,g);return f&&(s.title=f),a.content.appendChild(s)}a.content.appendChild(k)}}function Ld(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":" ";return b+=" "}function Md(a,b){return function(c,d,e,f,g,h,i){e=e?e+" cm-force-border":"cm-force-border";for(var j=c.pos,k=j+d.length;;){for(var l=0;l<b.length;l++){var m=b[l];if(m.to>j&&m.from<=j)break}if(m.to>=k)return a(c,d,e,f,g,h,i);a(c,d.slice(0,m.to-j),e,f,null,h,i),f=null,d=d.slice(m.to-j),j=m.to}}}function Nd(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e),!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id)),e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e)),a.pos+=b}function Od(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m,n=e.length,o=0,p=1,q="",r=0;;){if(r==o){i=j=k=l=h="",m=null,r=1/0;for(var s=[],t=0;t<d.length;++t){var u=d[t],v=u.marker;"bookmark"==v.type&&u.from==o&&v.widgetNode?s.push(v):u.from<=o&&(null==u.to||u.to>o||v.collapsed&&u.to==o&&u.from==o)?(null!=u.to&&u.to!=o&&r>u.to&&(r=u.to,j=""),v.className&&(i+=" "+v.className),v.css&&(h=v.css),v.startStyle&&u.from==o&&(k+=" "+v.startStyle),v.endStyle&&u.to==r&&(j+=" "+v.endStyle),v.title&&!l&&(l=v.title),v.collapsed&&(!m||jd(m.marker,v)<0)&&(m=u)):u.from>o&&r>u.from&&(r=u.from)}if(m&&(m.from||0)==o){if(Nd(b,(null==m.to?n+1:m.to)-o,m.marker,null==m.from),null==m.to)return;m.to==o&&(m=!1)}if(!m&&s.length)for(var t=0;t<s.length;++t)Nd(b,0,s[t])}if(o>=n)break;for(var w=Math.min(n,r);;){if(q){var x=o+q.length;if(!m){var y=x>w?q.slice(0,w-o):q;b.addToken(b,y,g?g+i:i,k,o+y.length==r?j:"",l,h)}if(x>=w){q=q.slice(w-o),o=w;break}o=x,k=""}q=e.slice(f,f=c[p++]),g=Hd(c[p++],b.cm.options)}}else for(var p=1;p<c.length;p+=2)b.addToken(b,e.slice(f,f=c[p]),Hd(c[p+1],b.cm.options))}function Pd(a,b){return 0==b.from.ch&&0==b.to.ch&&""==Ce(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Qd(a,b,c,d){function e(a){return c?c[a]:null}function f(a,c,e){xd(a,c,e,d),te(a,"change",a,b)}function g(a,b){for(var c=a,f=[];c<b;++c)f.push(new ng(j[c],e(c),d));return f}var h=b.from,i=b.to,j=b.text,k=Vd(a,h.line),l=Vd(a,i.line),m=Ce(j),n=e(j.length-1),o=i.line-h.line;if(b.full)a.insert(0,g(0,j.length)),a.remove(j.length,a.size-j.length);else if(Pd(a,b)){var p=g(0,j.length-1);f(l,l.text,n),o&&a.remove(h.line,o),p.length&&a.insert(h.line,p)}else if(k==l)if(1==j.length)f(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{var p=g(1,j.length-1);p.push(new ng(m+k.text.slice(i.ch),n,d)),f(k,k.text.slice(0,h.ch)+j[0],e(0)),a.insert(h.line+1,p)}else if(1==j.length)f(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),e(0)),a.remove(h.line+1,o);else{f(k,k.text.slice(0,h.ch)+j[0],e(0)),f(l,m+l.text.slice(i.ch),n);var p=g(1,j.length-1);o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,p)}te(a,"change",a,b)}function Rd(a){this.lines=a,this.parent=null;for(var b=0,c=0;b<a.length;++b)a[b].parent=this,c+=a[b].height;this.height=c}function Sd(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize(),c+=e.height,e.parent=this}this.size=b,this.height=c,this.parent=null}function Td(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g<a.linked.length;++g){var h=a.linked[g];if(h.doc!=e){var i=f&&h.sharedHist;c&&!i||(b(h.doc,i),d(h.doc,a,i))}}}d(a,null,!0)}function Ud(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,g(a),c(a),a.options.lineWrapping||m(a),a.options.mode=b.modeOption,Ib(a)}function Vd(a,b){if(b-=a.first,b<0||b>=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b<f){c=e;break}b-=f}return c.lines[b]}function Wd(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function Xd(a,b,c,d){var e=[];return a.iter(b,c,function(a){var b=a.text;d&&(b=d(a)),e.push(b)}),e}function Yd(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function Zd(a){if(null==a.parent)return null;for(var b=a.parent,c=De(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first}function $d(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f,c+=e.chunkSize()}return c}while(!a.lines);for(var d=0;d<a.lines.length;++d){var g=a.lines[d],h=g.height;if(b<h)break;b-=h}return c+d}function _d(a){a=od(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;b+=e.height}for(var f=c.parent;f;c=f,f=c.parent)for(var d=0;d<f.children.length;++d){var g=f.children[d];if(g==c)break;b+=g.height}return b}function ae(a){var b=a.order;return null==b&&(b=a.order=$g(a.text)),b}function be(a){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=a||1}function ce(a,b){var c={from:V(b.from),to:Uf(b),text:Wd(a,b.from,b.to)};return je(a,c,b.from.line,b.to.line+1),Td(a,function(a){je(a,c,b.from.line,b.to.line+1)},!0),c}function de(a){for(;a.length;){var b=Ce(a);if(!b.ranges)break;a.pop()}}function ee(a,b){return b?(de(a.done),Ce(a.done)):a.done.length&&!Ce(a.done).ranges?Ce(a.done):a.done.length>1&&!a.done[a.done.length-2].ranges?(a.done.pop(),Ce(a.done)):void 0}function fe(a,b,c,d){var e=a.history;e.undone.length=0;var f,g=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>g-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(f=ee(e,e.lastOp==d))){var h=Ce(f.changes);0==Gf(b.from,b.to)&&0==Gf(b.from,h.to)?h.to=Uf(b):f.changes.push(ce(a,b))}else{var i=Ce(e.done);for(i&&i.ranges||ie(a.sel,e.done),f={changes:[ce(a,b)],generation:e.generation},e.done.push(f);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=g,e.lastOp=e.lastSelOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,h||zg(a,"historyAdded")}function ge(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function he(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastSelOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||ge(a,f,Ce(e.done),b))?e.done[e.done.length-1]=b:ie(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&de(e.undone)}function ie(a,b){var c=Ce(b);c&&c.ranges&&c.equals(a)||b.push(a)}function je(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function ke(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function le(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(ke(c[d]));return e}function me(a,b,c){for(var d=0,e=[];d<a.length;++d){var f=a[d];if(f.ranges)e.push(c?la.prototype.deepCopy.call(f):f);else{var g=f.changes,h=[];e.push({changes:h});for(var i=0;i<g.length;++i){var j,k=g[i];if(h.push({from:k.from,to:k.to,text:k.text}),b)for(var l in k)(j=l.match(/^spans_(\d+)$/))&&De(b,Number(j[1]))>-1&&(Ce(h)[l]=k[l],delete k[l])}}}return e}function ne(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function oe(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges){f.copied||(f=a[e]=f.deepCopy(),f.copied=!0);for(var h=0;h<f.ranges.length;h++)ne(f.ranges[h].anchor,b,c,d),ne(f.ranges[h].head,b,c,d)}else{for(var h=0;h<f.changes.length;++h){var i=f.changes[h];if(c<i.from.line)i.from=Ff(i.from.line+d,i.from.ch),i.to=Ff(i.to.line+d,i.to.ch);else if(b<=i.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function pe(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;oe(a.done,c,d,e),oe(a.undone,c,d,e)}function qe(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function re(a){return a.target||a.srcElement}function se(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),yf&&a.ctrlKey&&1==b&&(b=3),b}function te(a,b){function c(a){return function(){a.apply(null,f)}}var d=a._handlers&&a._handlers[b];if(d){var e,f=Array.prototype.slice.call(arguments,2);Mf?e=Mf.delayedCallbacks:Ag?e=Ag:(e=Ag=[],setTimeout(ue,0));for(var g=0;g<d.length;++g)e.push(c(d[g]))}}function ue(){var a=Ag;Ag=null;for(var b=0;b<a.length;++b)a[b]()}function ve(a,b,c){return"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}}),zg(a,c||b.type,a,b),qe(b)||b.codemirrorIgnore}function we(a){var b=a._handlers&&a._handlers.cursorActivity;if(b)for(var c=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]),d=0;d<b.length;++d)De(c,b[d])==-1&&c.push(b[d])}function xe(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function ye(a){a.prototype.on=function(a,b){xg(this,a,b)},a.prototype.off=function(a,b){yg(this,a,b)}}function ze(){this.id=null}function Ae(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);f==-1&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}}function Be(a){for(;Hg.length<=a;)Hg.push(Ce(Hg)+" ");return Hg[a]}function Ce(a){return a[a.length-1]}function De(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function Ee(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function Fe(){}function Ge(a,b){var c;return Object.create?c=Object.create(a):(Fe.prototype=a,c=new Fe),b&&He(b,c),c}function He(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||c===!1&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function Ie(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Je(a,b){return b?!!(b.source.indexOf("\\w")>-1&&Lg(a))||b.test(a):Lg(a)}function Ke(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Le(a){return a.charCodeAt(0)>=768&&Mg.test(a)}function Me(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function Ne(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function Oe(a,b){return Ne(a).appendChild(b)}function Pe(){return document.activeElement}function Qe(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function Re(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)c[d]&&!Qe(c[d]).test(b)&&(b+=" "+c[d]);return b}function Se(a){if(document.body.getElementsByClassName)for(var b=document.body.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function Te(){Sg||(Ue(),Sg=!0)}function Ue(){var a;xg(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null,Se(Rb)},100))}),xg(window,"blur",function(){Se(oc)})}function Ve(a){if(null==Og){var b=Me("span","");Oe(a,Me("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Og=b.offsetWidth<=1&&b.offsetHeight>2&&!(nf&&of<8))}var c=Og?Me("span",""):Me("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return c.setAttribute("cm-text",""),c}function We(a){if(null!=Pg)return Pg;var b=Oe(a,document.createTextNode("AخA")),c=Jg(b,0,1).getBoundingClientRect();if(!c||c.left==c.right)return!1;var d=Jg(b,1,2).getBoundingClientRect();return Pg=d.right-c.right<3}function Xe(a){if(null!=Xg)return Xg;var b=Oe(a,Me("span","x")),c=b.getBoundingClientRect(),d=Jg(b,0,1).getBoundingClientRect();
return Xg=Math.abs(c.left-d.left)>1}function Ye(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];(g.from<c&&g.to>b||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function Ze(a){return a.level%2?a.to:a.from}function $e(a){return a.level%2?a.from:a.to}function _e(a){var b=ae(a);return b?Ze(b[0]):0}function af(a){var b=ae(a);return b?$e(Ce(b)):a.text.length}function bf(a,b){var c=Vd(a.doc,b),d=od(c);d!=c&&(b=Zd(d));var e=ae(d),f=e?e[0].level%2?af(d):_e(d):0;return Ff(b,f)}function cf(a,b){for(var c,d=Vd(a.doc,b);c=md(d);)d=c.find(1,!0).line,b=null;var e=ae(d),f=e?e[0].level%2?_e(d):af(d):d.text.length;return Ff(null==b?Zd(d):b,f)}function df(a,b){var c=bf(a,b.line),d=Vd(a.doc,c.line),e=ae(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;return Ff(c.line,g?0:f)}return c}function ef(a,b,c){var d=a[0].level;return b==d||c!=d&&b<c}function ff(a,b){Zg=null;for(var c,d=0;d<a.length;++d){var e=a[d];if(e.from<b&&e.to>b)return d;if(e.from==b||e.to==b){if(null!=c)return ef(a,e.level,a[c].level)?(e.from!=e.to&&(Zg=c),d):(e.from!=e.to&&(Zg=d),c);c=d}}return c}function gf(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Le(a.text.charAt(b)));return b}function hf(a,b,c,d){var e=ae(a);if(!e)return jf(a,b,c,d);for(var f=ff(e,b),g=e[f],h=gf(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h<g.to)return h;if(h==g.from||h==g.to)return ff(e,h)==f?h:(g=e[f+=c],c>0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?gf(a,g.to,-1,d):gf(a,g.from,1,d)}}function jf(a,b,c,d){var e=b+c;if(d)for(;e>0&&Le(a.text.charAt(e));)e+=c;return e<0||e>a.text.length?null:e}var kf=/gecko\/\d/i.test(navigator.userAgent),lf=/MSIE \d/.test(navigator.userAgent),mf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),nf=lf||mf,of=nf&&(lf?document.documentMode||6:mf[1]),pf=/WebKit\//.test(navigator.userAgent),qf=pf&&/Qt\/\d+\.\d+/.test(navigator.userAgent),rf=/Chrome\//.test(navigator.userAgent),sf=/Opera\//.test(navigator.userAgent),tf=/Apple Computer/.test(navigator.vendor),uf=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),vf=/PhantomJS/.test(navigator.userAgent),wf=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),xf=wf||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),yf=wf||/Mac/.test(navigator.platform),zf=/win/i.test(navigator.platform),Af=sf&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Af&&(Af=Number(Af[1])),Af&&Af>=15&&(sf=!1,pf=!0);var Bf=yf&&(qf||sf&&(null==Af||Af<12.11)),Cf=kf||nf&&of>=9,Df=!1,Ef=!1;p.prototype=He({update:function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;if(c){this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0";var e=a.viewHeight-(b?d:0);this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+e)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(b){this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px";var f=a.viewWidth-a.barLeft-(c?d:0);this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+f+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&a.clientHeight>0&&(0==d&&this.overlayHack(),this.checkedOverlay=!0),{right:c?d:0,bottom:b?d:0}},setScrollLeft:function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a)},setScrollTop:function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a)},overlayHack:function(){var a=yf&&!uf?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=a;var b=this,c=function(a){re(a)!=b.vert&&re(a)!=b.horiz&&Db(b.cm,Ub)(a)};xg(this.vert,"mousedown",c),xg(this.horiz,"mousedown",c)},clear:function(){var a=this.horiz.parentNode;a.removeChild(this.horiz),a.removeChild(this.vert)}},p.prototype),q.prototype=He({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},q.prototype),a.scrollbarModel={"native":p,"null":q},z.prototype.signal=function(a,b){xe(a,b)&&this.events.push(arguments)},z.prototype.finish=function(){for(var a=0;a<this.events.length;a++)zg.apply(null,this.events[a])};var Ff=a.Pos=function(a,b){return this instanceof Ff?(this.line=a,void(this.ch=b)):new Ff(a,b)},Gf=a.cmpPos=function(a,b){return a.line-b.line||a.ch-b.ch},Hf=null;da.prototype=He({init:function(a){function b(a){if(d.somethingSelected())Hf=d.getSelections(),c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,f.value=Hf.join("\n"),Ig(f));else{if(!d.options.lineWiseCopyCut)return;var b=ba(d);Hf=b.text,"cut"==a.type?d.setSelections(b.ranges,null,Dg):(c.prevInput="",f.value=b.text.join("\n"),Ig(f))}"cut"==a.type&&(d.state.cutIncoming=!0)}var c=this,d=this.cm,e=this.wrapper=ea(),f=this.textarea=e.firstChild;a.wrapper.insertBefore(e,a.wrapper.firstChild),wf&&(f.style.width="0px"),xg(f,"input",function(){nf&&of>=9&&c.hasSelection&&(c.hasSelection=null),c.poll()}),xg(f,"paste",function(a){return!!_(a,d)||(d.state.pasteIncoming=!0,void c.fastPoll())}),xg(f,"cut",b),xg(f,"copy",b),xg(a.scroller,"paste",function(b){Sb(a,b)||(d.state.pasteIncoming=!0,c.focus())}),xg(a.lineSpace,"selectstart",function(b){Sb(a,b)||ug(b)}),xg(f,"compositionstart",function(){var a=d.getCursor("from");c.composing={start:a,range:d.markText(a,d.getCursor("to"),{className:"CodeMirror-composing"})}}),xg(f,"compositionend",function(){c.composing&&(c.poll(),c.composing.range.clear(),c.composing=null)})},prepareSelection:function(){var a=this.cm,b=a.display,c=a.doc,d=Ia(a);if(a.options.moveInputWithCursor){var e=mb(a,c.sel.primary().head,"div"),f=b.wrapper.getBoundingClientRect(),g=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,e.top+g.top-f.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,e.left+g.left-f.left))}return d},showSelection:function(a){var b=this.cm,c=b.display;Oe(c.cursorDiv,a.cursors),Oe(c.selectionDiv,a.selection),null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")},reset:function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;if(d.somethingSelected()){this.prevInput="";var f=e.sel.primary();b=Wg&&(f.to().line-f.from().line>100||(c=d.getSelection()).length>1e3);var g=b?"-":c||d.getSelection();this.textarea.value=g,d.state.focused&&Ig(this.textarea),nf&&of>=9&&(this.hasSelection=g)}else a||(this.prevInput=this.textarea.value="",nf&&of>=9&&(this.hasSelection=null));this.inaccurateSelection=b}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!xf||Pe()!=this.textarea))try{this.textarea.focus()}catch(a){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var a=this;a.pollingFast||a.polling.set(this.cm.options.pollInterval,function(){a.poll(),a.cm.state.focused&&a.slowPoll()})},fastPoll:function(){function a(){var d=c.poll();d||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0,c.polling.set(20,a)},poll:function(){var a=this.cm,b=this.textarea,c=this.prevInput;if(this.contextMenuPending||!a.state.focused||Vg(b)&&!c||Z(a)||a.options.disableInput||a.state.keySeq)return!1;var d=b.value;if(d==c&&!a.somethingSelected())return!1;if(nf&&of>=9&&this.hasSelection===d||yf&&/[\uf700-\uf7ff]/.test(d))return a.display.input.reset(),!1;if(a.doc.sel==a.display.selForContextMenu){var e=d.charCodeAt(0);if(8203!=e||c||(c=""),8666==e)return this.reset(),this.cm.execCommand("undo")}for(var f=0,g=Math.min(c.length,d.length);f<g&&c.charCodeAt(f)==d.charCodeAt(f);)++f;var h=this;return Cb(a,function(){$(a,d.slice(f),c.length-f,null,h.composing?"*compose":null),d.length>1e3||d.indexOf("\n")>-1?b.value=h.prevInput="":h.prevInput=d,h.composing&&(h.composing.range.clear(),h.composing.range=a.markText(h.composing.start,a.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){nf&&of>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b=""+(a?g.value:"");g.value="⇚",g.value=b,d.prevInput=a?"":"",g.selectionStart=1,g.selectionEnd=b.length,f.selForContextMenu=e.doc.sel}}function c(){if(d.contextMenuPending=!1,d.wrapper.style.position="relative",g.style.cssText=k,nf&&of<9&&f.scrollbars.setScrollTop(f.scroller.scrollTop=i),null!=g.selectionStart){(!nf||nf&&of<9)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&g.selectionEnd>0&&""==d.prevInput?Db(e,dg.selectAll)(e):a++<10?f.detectingSelectAll=setTimeout(c,500):f.input.reset()};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=Tb(e,a),i=f.scroller.scrollTop;if(h&&!sf){var j=e.options.resetSelectionOnContextMenu;j&&e.doc.sel.contains(h)==-1&&Db(e,Ba)(e.doc,oa(h),Dg);var k=g.style.cssText;if(d.wrapper.style.position="absolute",g.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: "+(nf?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",pf)var l=window.scrollY;if(f.input.focus(),pf&&window.scrollTo(null,l),f.input.reset(),e.somethingSelected()||(g.value=d.prevInput=" "),d.contextMenuPending=!0,f.selForContextMenu=e.doc.sel,clearTimeout(f.detectingSelectAll),nf&&of>=9&&b(),Cf){wg(a);var m=function(){yg(window,"mouseup",m),setTimeout(c,20)};xg(window,"mouseup",m)}else setTimeout(c,50)}},setUneditable:Fe,needsContentAttribute:!1},da.prototype),fa.prototype=He({init:function(a){function b(a){if(d.somethingSelected())Hf=d.getSelections(),"cut"==a.type&&d.replaceSelection("",null,"cut");else{if(!d.options.lineWiseCopyCut)return;var b=ba(d);Hf=b.text,"cut"==a.type&&d.operation(function(){d.setSelections(b.ranges,0,Dg),d.replaceSelection("",null,"cut")})}if(a.clipboardData&&!wf)a.preventDefault(),a.clipboardData.clearData(),a.clipboardData.setData("text/plain",Hf.join("\n"));else{var c=ea(),e=c.firstChild;d.display.lineSpace.insertBefore(c,d.display.lineSpace.firstChild),e.value=Hf.join("\n");var f=document.activeElement;Ig(e),setTimeout(function(){d.display.lineSpace.removeChild(c),f.focus()},50)}}var c=this,d=c.cm,e=c.div=a.lineDiv;e.contentEditable="true",ca(e),xg(e,"paste",function(a){_(a,d)}),xg(e,"compositionstart",function(a){var b=a.data;if(c.composing={sel:d.doc.sel,data:b,startData:b},b){var e=d.doc.sel.primary(),f=d.getLine(e.head.line),g=f.indexOf(b,Math.max(0,e.head.ch-b.length));g>-1&&g<=e.head.ch&&(c.composing.sel=oa(Ff(e.head.line,g),Ff(e.head.line,g+b.length)))}}),xg(e,"compositionupdate",function(a){c.composing.data=a.data}),xg(e,"compositionend",function(a){var b=c.composing;b&&(a.data==b.startData||/\u200b/.test(a.data)||(b.data=a.data),setTimeout(function(){b.handled||c.applyComposition(b),c.composing==b&&(c.composing=null)},50))}),xg(e,"touchstart",function(){c.forceCompositionEnd()}),xg(e,"input",function(){c.composing||c.pollContent()||Cb(c.cm,function(){Ib(d)})}),xg(e,"copy",b),xg(e,"cut",b)},prepareSelection:function(){var a=Ia(this.cm,!1);return a.focus=this.cm.state.focused,a},showSelection:function(a){a&&this.cm.display.view.length&&(a.focus&&this.showPrimarySelection(),this.showMultipleSelections(a))},showPrimarySelection:function(){var a=window.getSelection(),b=this.cm.doc.sel.primary(),c=ia(this.cm,a.anchorNode,a.anchorOffset),d=ia(this.cm,a.focusNode,a.focusOffset);if(!c||c.bad||!d||d.bad||0!=Gf(X(c,d),b.from())||0!=Gf(W(c,d),b.to())){var e=ga(this.cm,b.from()),f=ga(this.cm,b.to());if(e||f){var g=this.cm.display.view,h=a.rangeCount&&a.getRangeAt(0);if(e){if(!f){var i=g[g.length-1].measure,j=i.maps?i.maps[i.maps.length-1]:i.map;f={node:j[j.length-1],offset:j[j.length-2]-j[j.length-3]}}}else e={node:g[0].measure.map[2],offset:0};try{var k=Jg(e.node,e.offset,f.offset,f.node)}catch(l){}k&&(a.removeAllRanges(),a.addRange(k),h&&null==a.anchorNode?a.addRange(h):kf&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var a=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){a.gracePeriod=!1,a.selectionChanged()&&a.cm.operation(function(){a.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(a){Oe(this.cm.display.cursorDiv,a.cursors),Oe(this.cm.display.selectionDiv,a.selection)},rememberSelection:function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode,this.lastAnchorOffset=a.anchorOffset,this.lastFocusNode=a.focusNode,this.lastFocusOffset=a.focusOffset},selectionInEditor:function(){var a=window.getSelection();if(!a.rangeCount)return!1;var b=a.getRangeAt(0).commonAncestorContainer;return Ng(this.div,b)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():Cb(this.cm,function(){b.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,a)},selectionChanged:function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;this.rememberSelection();var c=ia(b,a.anchorNode,a.anchorOffset),d=ia(b,a.focusNode,a.focusOffset);c&&d&&Cb(b,function(){Ba(b.doc,oa(c,d),Dg),(c.bad||d.bad)&&(b.curOp.selectionChanged=!0)})}},pollContent:function(){var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),e=c.to();if(d.line<b.viewFrom||e.line>b.viewTo-1)return!1;var f;if(d.line==b.viewFrom||0==(f=Lb(a,d.line)))var g=Zd(b.view[0].line),h=b.view[0].node;else var g=Zd(b.view[f].line),h=b.view[f-1].node.nextSibling;var i=Lb(a,e.line);if(i==b.view.length-1)var j=b.viewTo-1,k=b.lineDiv.lastChild;else var j=Zd(b.view[i+1].line)-1,k=b.view[i+1].node.previousSibling;for(var l=Ug(ka(a,h,k,g,j)),m=Wd(a.doc,Ff(g,0),Ff(j,Vd(a.doc,j).text.length));l.length>1&&m.length>1;)if(Ce(l)==Ce(m))l.pop(),m.pop(),j--;else{if(l[0]!=m[0])break;l.shift(),m.shift(),g++}for(var n=0,o=0,p=l[0],q=m[0],r=Math.min(p.length,q.length);n<r&&p.charCodeAt(n)==q.charCodeAt(n);)++n;for(var s=Ce(l),t=Ce(m),u=Math.min(s.length-(1==l.length?n:0),t.length-(1==m.length?n:0));o<u&&s.charCodeAt(s.length-o-1)==t.charCodeAt(t.length-o-1);)++o;l[l.length-1]=s.slice(0,s.length-o),l[0]=l[0].slice(n);var v=Ff(g,n),w=Ff(j,m.length?Ce(m).length-o:0);return l.length>1||l[0]||Gf(v,w)?(Cc(a.doc,l,v,w,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(a){a.data&&a.data!=a.startData&&Db(this.cm,$)(this.cm,a.data,0,a.sel)},setUneditable:function(a){a.setAttribute("contenteditable","false")},onKeyPress:function(a){a.preventDefault(),Db(this.cm,$)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0)},onContextMenu:Fe,resetPosition:Fe,needsContentAttribute:!0},fa.prototype),a.inputStyles={textarea:da,contenteditable:fa},la.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(0!=Gf(c.anchor,d.anchor)||0!=Gf(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new ma(V(this.ranges[b].anchor),V(this.ranges[b].head));return new la(a,this.primIndex)},somethingSelected:function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(Gf(b,d.from())>=0&&Gf(a,d.to())<=0)return c}return-1}},ma.prototype={from:function(){return X(this.anchor,this.head)},to:function(){return W(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var If,Jf,Kf,Lf={left:0,right:0,top:0,bottom:0},Mf=null,Nf=0,Of=0,Pf=0,Qf=null;nf?Qf=-.53:kf?Qf=15:rf?Qf=-.7:tf&&(Qf=-1/3);var Rf=function(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;return null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail),null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta),{x:b,y:c}};a.wheelEventPixels=function(a){var b=Rf(a);return b.x*=Qf,b.y*=Qf,b};var Sf=new ze,Tf=null,Uf=a.changeEnd=function(a){return a.text?Ff(a.from.line+a.text.length-1,Ce(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};a.prototype={constructor:a,focus:function(){window.focus(),this.display.input.focus()},setOption:function(a,b){var c=this.options,d=c[a];c[a]==b&&"mode"!=a||(c[a]=b,Wf.hasOwnProperty(a)&&Db(this,Wf[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](Rc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||b[c].name==a)return b.splice(c,1),!0},addOverlay:Eb(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:d,modeSpec:b,opaque:c&&c.opaque}),this.state.modeGen++,Ib(this)}),removeOverlay:Eb(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a)return b.splice(c,1),this.state.modeGen++,void Ib(this)}}),indentLine:Eb(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),sa(this.doc,a)&&Kc(this,a,b,c)}),indentSelection:Eb(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty())e.head.line>c&&(Kc(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Ic(this));else{var f=e.from(),g=e.to(),h=Math.max(c,f.line);c=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var i=h;i<c;++i)Kc(this,i,a);var j=this.doc.sel.ranges;0==f.ch&&b.length==j.length&&j[d].from().ch>0&&xa(this.doc,d,new ma(f,j[d].to()),Dg)}}}),getTokenAt:function(a,b){return Cd(this,a,b)},getLineTokens:function(a,b){return Cd(this,Ff(a),b,!0)},getTokenTypeAt:function(a){a=qa(this.doc,a);var b,c=Fd(this,Vd(this.doc,a.line)),d=0,e=(c.length-1)/2,f=a.ch;if(0==f)b=c[2];else for(;;){var g=d+e>>1;if((g?c[2*g-1]:0)>=f)e=g;else{if(!(c[2*g+1]<f)){b=c[2*g+2];break}d=g+1}}var h=b?b.indexOf("cm-overlay "):-1;return h<0?b:0==h?null:b.slice(0,h-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!ag.hasOwnProperty(b))return c;var d=ag[b],e=this.getModeAt(a);if("string"==typeof e[b])d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var g=d[e[b][f]];g&&c.push(g)}else e.helperType&&d[e.helperType]?c.push(d[e.helperType]):d[e.name]&&c.push(d[e.name]);for(var f=0;f<d._global.length;f++){var h=d._global[f];h.pred(e,this)&&De(c,h.val)==-1&&c.push(h.val)}return c},getStateAfter:function(a,b){var c=this.doc;return a=pa(c,null==a?c.first+c.size-1:a),Pa(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel.primary();return c=null==a?d.head:"object"==typeof a?qa(this.doc,a):a?d.from():d.to(),mb(this,c,b||"page")},charCoords:function(a,b){return lb(this,qa(this.doc,a),b||"page")},coordsChar:function(a,b){return a=kb(this,a,b||"page"),pb(this,a.left,a.top)},lineAtHeight:function(a,b){return a=kb(this,{top:a,left:0},b||"page").top,$d(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c,d=!1;if("number"==typeof a){var e=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>e&&(a=e,d=!0),c=Vd(this.doc,a)}else c=a;return jb(this,c,{top:0,left:0},b||"page").top+(d?this.doc.height-_d(c):0)},defaultTextHeight:function(){return rb(this.display)},defaultCharWidth:function(){return sb(this.display)},setGutterMarker:Eb(function(a,b,c){return Lc(this.doc,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&Ke(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Eb(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Jb(b,d,"gutter"),Ke(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),lineInfo:function(a){if("number"==typeof a){if(!sa(this.doc,a))return null;var b=a;if(a=Vd(this.doc,a),!a)return null}else{var b=Zd(a);if(null==b)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=mb(this,qa(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",b.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(b),f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Fc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Eb(ic),triggerOnKeyPress:Eb(lc),triggerOnKeyUp:kc,execCommand:function(a){if(dg.hasOwnProperty(a))return dg[a](this)},triggerElectric:Eb(function(a){aa(this,a)}),findPosH:function(a,b,c,d){var e=1;b<0&&(e=-1,b=-b);for(var f=0,g=qa(this.doc,a);f<b&&(g=Nc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Eb(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Nc(c.doc,d.head,a,b,c.options.rtlMoveVisually):a<0?d.from():d.to()},Fg)}),deleteH:Eb(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):Mc(this,function(c){var e=Nc(d,c.head,a,b,!1);return a<0?{from:e,to:c.head}:{from:c.head,to:e}})}),findPosV:function(a,b,c,d){var e=1,f=d;b<0&&(e=-1,b=-b);for(var g=0,h=qa(this.doc,a);g<b;++g){var i=mb(this,h,"div");if(null==f?f=i.left:i.left=f,h=Oc(this,i,e,c),h.hitSide)break}return h},moveV:Eb(function(a,b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();if(d.extendSelectionsBy(function(g){if(f)return a<0?g.from():g.to();var h=mb(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=Oc(c,h,a,b);return"page"==b&&g==d.sel.primary()&&Hc(c,null,lb(c,i,"div").top-h.top),i},Fg),e.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),findWordAt:function(a){var b=this.doc,c=Vd(b,a.line).text,d=a.ch,e=a.ch;if(c){var f=this.getHelper(a,"wordChars");(a.xRel<0||e==c.length)&&d?--d:++e;for(var g=c.charAt(d),h=Je(g,f)?function(a){return Je(a,f)}:/\s/.test(g)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!Je(a)};d>0&&h(c.charAt(d-1));)--d;for(;e<c.length&&h(c.charAt(e));)++e}return new ma(Ff(a.line,d),Ff(a.line,e))},toggleOverwrite:function(a){null!=a&&a==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?Rg(this.display.cursorDiv,"CodeMirror-overwrite"):Qg(this.display.cursorDiv,"CodeMirror-overwrite"),zg(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Pe()},scrollTo:Eb(function(a,b){null==a&&null==b||Jc(this),null!=a&&(this.curOp.scrollLeft=a),null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Ta(this)-this.display.barHeight,width:a.scrollWidth-Ta(this)-this.display.barWidth,clientHeight:Va(this),clientWidth:Ua(this)}},scrollIntoView:Eb(function(a,b){if(null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:Ff(a,0),to:null}:null==a.from&&(a={from:a,to:null}),a.to||(a.to=a.from),a.margin=b||0,null!=a.from.line)Jc(this),this.curOp.scrollToPos=a;else{var c=Gc(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:Eb(function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}var d=this;null!=a&&(d.display.wrapper.style.width=c(a)),null!=b&&(d.display.wrapper.style.height=c(b)),d.options.lineWrapping&&fb(this);var e=d.display.viewFrom;d.doc.iter(e,d.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){Jb(d,e,"widget");break}++e}),d.curOp.forceUpdate=!0,zg(d,"refresh",this)}),operation:function(a){return Cb(this,a)},refresh:Eb(function(){var a=this.display.cachedTextHeight;Ib(this),this.curOp.forceUpdate=!0,gb(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),k(this),(null==a||Math.abs(a-rb(this.display))>.5)&&g(this),zg(this,"refresh",this)}),swapDoc:Eb(function(a){var b=this.doc;return b.cm=null,Ud(this,a),gb(this),this.display.input.reset(),this.scrollTo(a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,te(this,"swapDoc",this,b),b}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ye(a);var Vf=a.defaults={},Wf=a.optionHandlers={},Xf=a.Init={toString:function(){return"CodeMirror.Init"}};Pc("value","",function(a,b){a.setValue(b)},!0),Pc("mode",null,function(a,b){a.doc.modeOption=b,c(a)},!0),Pc("indentUnit",2,c,!0),Pc("indentWithTabs",!1),Pc("smartIndent",!0),Pc("tabSize",4,function(a){d(a),gb(a),Ib(a)},!0),Pc("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(b,c,d){b.state.specialChars=new RegExp(c.source+(c.test("\t")?"":"|\t"),"g"),d!=a.Init&&b.refresh()}),Pc("specialCharPlaceholder",Jd,function(a){a.refresh()},!0),Pc("electricChars",!0),Pc("inputStyle",xf?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Pc("rtlMoveVisually",!zf),Pc("wholeLineUpdateBefore",!0),Pc("theme","default",function(a){h(a),i(a)},!0),Pc("keyMap","default",function(b,c,d){var e=Rc(c),f=d!=a.Init&&Rc(d);f&&f.detach&&f.detach(b,e),e.attach&&e.attach(b,f||null)}),Pc("extraKeys",null),Pc("lineWrapping",!1,e,!0),Pc("gutters",[],function(a){n(a.options),i(a)},!0),Pc("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?y(a.display)+"px":"0",a.refresh()},!0),Pc("coverGutterNextToScrollbar",!1,function(a){s(a)},!0),Pc("scrollbarStyle","native",function(a){r(a),s(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0),Pc("lineNumbers",!1,function(a){n(a.options),i(a)},!0),Pc("firstLineNumber",1,i,!0),Pc("lineNumberFormatter",function(a){return a},i,!0),Pc("showCursorWhenSelecting",!1,Ha,!0),Pc("resetSelectionOnContextMenu",!0),Pc("lineWiseCopyCut",!0),Pc("readOnly",!1,function(a,b){"nocursor"==b?(oc(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||a.display.input.reset())}),Pc("disableInput",!1,function(a,b){b||a.display.input.reset()},!0),Pc("dragDrop",!0,Qb),Pc("cursorBlinkRate",530),Pc("cursorScrollMargin",0),Pc("cursorHeight",1,Ha,!0),Pc("singleCursorHeightPerLine",!0,Ha,!0),Pc("workTime",100),Pc("workDelay",100),Pc("flattenSpans",!0,d,!0),Pc("addModeClass",!1,d,!0),Pc("pollInterval",100),Pc("undoDepth",200,function(a,b){a.doc.history.undoDepth=b}),Pc("historyEventDelay",1250),Pc("viewportMargin",10,function(a){a.refresh()},!0),Pc("maxHighlightLength",1e4,d,!0),Pc("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()}),Pc("tabindex",null,function(a,b){a.display.input.getField().tabIndex=b||""}),Pc("autofocus",null);var Yf=a.modes={},Zf=a.mimeModes={};a.defineMode=function(b,c){a.defaults.mode||"null"==b||(a.defaults.mode=b),arguments.length>2&&(c.dependencies=Array.prototype.slice.call(arguments,2)),Yf[b]=c},a.defineMIME=function(a,b){Zf[a]=b},a.resolveMode=function(b){if("string"==typeof b&&Zf.hasOwnProperty(b))b=Zf[b];else if(b&&"string"==typeof b.name&&Zf.hasOwnProperty(b.name)){var c=Zf[b.name];"string"==typeof c&&(c={name:c}),b=Ge(c,b),b.name=c.name}else if("string"==typeof b&&/^[\w\-]+\/[\w\-]+\+xml$/.test(b))return a.resolveMode("application/xml");return"string"==typeof b?{name:b}:b||{name:"null"}},a.getMode=function(b,c){var c=a.resolveMode(c),d=Yf[c.name];if(!d)return a.getMode(b,"text/plain");var e=d(b,c);if($f.hasOwnProperty(c.name)){var f=$f[c.name];for(var g in f)f.hasOwnProperty(g)&&(e.hasOwnProperty(g)&&(e["_"+g]=e[g]),e[g]=f[g])}if(e.name=c.name,c.helperType&&(e.helperType=c.helperType),c.modeProps)for(var g in c.modeProps)e[g]=c.modeProps[g];return e},a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null");var $f=a.modeExtensions={};a.extendMode=function(a,b){var c=$f.hasOwnProperty(a)?$f[a]:$f[a]={};He(b,c)},a.defineExtension=function(b,c){a.prototype[b]=c},a.defineDocExtension=function(a,b){rg.prototype[a]=b},a.defineOption=Pc;var _f=[];a.defineInitHook=function(a){_f.push(a)};var ag=a.helpers={};a.registerHelper=function(b,c,d){ag.hasOwnProperty(b)||(ag[b]=a[b]={_global:[]}),ag[b][c]=d},a.registerGlobalHelper=function(b,c,d,e){a.registerHelper(b,c,e),ag[b]._global.push({pred:d,val:e})};var bg=a.copyState=function(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c},cg=a.startState=function(a,b,c){return!a.startState||a.startState(b,c)};a.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var dg=a.commands={selectAll:function(a){a.setSelection(Ff(a.firstLine(),0),Ff(a.lastLine()),Dg)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Dg)},killLine:function(a){Mc(a,function(b){if(b.empty()){var c=Vd(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:Ff(b.head.line+1,0)}:{from:b.head,to:Ff(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){Mc(a,function(b){return{from:Ff(b.from().line,0),to:qa(a.doc,Ff(b.to().line+1,0))}})},delLineLeft:function(a){Mc(a,function(a){return{from:Ff(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){Mc(a,function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:c},"div");return{from:d,to:b.from()}})},delWrappedLineRight:function(a){Mc(a,function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:d}})},undo:function(a){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(Ff(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(Ff(a.lastLine()));
},goLineStart:function(a){a.extendSelectionsBy(function(b){return bf(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){return df(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){a.extendSelectionsBy(function(b){return cf(a,b.head.line)},{origin:"+move",bias:-1})},goLineRight:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div")},Fg)},goLineLeft:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:c},"div")},Fg)},goLineLeftSmart:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:c},"div");return d.ch<a.getLine(d.line).search(/\S/)?df(a,b.head):d},Fg)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("\t")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),g=Gg(a.getLine(f.line),f.ch,d);b.push(new Array(d-g%d+1).join(" "))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){Cb(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++){var e=b[d].head,f=Vd(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new Ff(e.line,e.ch-1)),e.ch>0)e=new Ff(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),Ff(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=Vd(a.doc,e.line-1).text;g&&a.replaceRange(f.charAt(0)+"\n"+g.charAt(g.length-1),Ff(e.line-1,g.length-1),Ff(e.line,1),"+transpose")}c.push(new ma(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){Cb(a,function(){for(var b=a.listSelections().length,c=0;c<b;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input"),a.indentLine(d.from().line+1,null,!0),Ic(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},eg=a.keyMap={};eg.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},eg.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},eg.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},eg.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},eg["default"]=yf?eg.macDefault:eg.pcDefault,a.normalizeKeyMap=function(a){var b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];if(/^(name|fallthrough|(de|at)tach)$/.test(c))continue;if("..."==d){delete a[c];continue}for(var e=Ee(c.split(" "),Qc),f=0;f<e.length;f++){var g,h;f==e.length-1?(h=e.join(" "),g=d):(h=e.slice(0,f+1).join(" "),g="...");var i=b[h];if(i){if(i!=g)throw new Error("Inconsistent bindings for "+h)}else b[h]=g}delete a[c]}for(var j in b)a[j]=b[j];return a};var fg=a.lookupKey=function(a,b,c,d){b=Rc(b);var e=b.call?b.call(a,d):b[a];if(e===!1)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return fg(a,b.fallthrough,c,d);for(var f=0;f<b.fallthrough.length;f++){var g=fg(a,b.fallthrough[f],c,d);if(g)return g}}},gg=a.isModifierKey=function(a){var b="string"==typeof a?a:Yg[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b},hg=a.keyName=function(a,b){if(sf&&34==a.keyCode&&a["char"])return!1;var c=Yg[a.keyCode],d=c;return null!=d&&!a.altGraphKey&&(a.altKey&&"Alt"!=c&&(d="Alt-"+d),(Bf?a.metaKey:a.ctrlKey)&&"Ctrl"!=c&&(d="Ctrl-"+d),(Bf?a.ctrlKey:a.metaKey)&&"Cmd"!=c&&(d="Cmd-"+d),!b&&a.shiftKey&&"Shift"!=c&&(d="Shift-"+d),d)};a.fromTextArea=function(b,c){function d(){b.value=j.getValue()}if(c=c?He(c):{},c.value=b.value,!c.tabindex&&b.tabIndex&&(c.tabindex=b.tabIndex),!c.placeholder&&b.placeholder&&(c.placeholder=b.placeholder),null==c.autofocus){var e=Pe();c.autofocus=e==b||null!=b.getAttribute("autofocus")&&e==document.body}if(b.form&&(xg(b.form,"submit",d),!c.leaveSubmitMethodAlone)){var f=b.form,g=f.submit;try{var h=f.submit=function(){d(),f.submit=g,f.submit(),f.submit=h}}catch(i){}}c.finishInit=function(a){a.save=d,a.getTextArea=function(){return b},a.toTextArea=function(){a.toTextArea=isNaN,d(),b.parentNode.removeChild(a.getWrapperElement()),b.style.display="",b.form&&(yg(b.form,"submit",d),"function"==typeof b.form.submit&&(b.form.submit=g))}},b.style.display="none";var j=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return j};var ig=a.StringStream=function(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};ig.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a)var c=b==a;else var c=b&&(a.test?a.test(b):a(b));if(c)return++this.pos,b},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Gg(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Gg(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Gg(this.string,null,this.tabSize)-(this.lineStart?Gg(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"!=typeof a){var d=this.string.slice(this.pos).match(a);return d&&d.index>0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);if(e(f)==e(a))return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var jg=0,kg=a.TextMarker=function(a,b){this.lines=[],this.type=b,this.doc=a,this.id=++jg};ye(kg),kg.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&tb(a),xe(this,"clear")){var c=this.find();c&&te(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;f<this.lines.length;++f){var g=this.lines[f],h=Yc(g.markedSpans,this);a&&!this.collapsed?Jb(a,Zd(g),"text"):a&&(null!=h.to&&(e=Zd(g)),null!=h.from&&(d=Zd(g))),g.markedSpans=Zc(g.markedSpans,h),null==h.from&&this.collapsed&&!sd(this.doc,g)&&a&&Yd(g,rb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=od(this.lines[f]),j=l(i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&this.collapsed&&Ib(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Ea(a.doc)),a&&te(a,"markerCleared",a,this),b&&vb(a),this.parent&&this.parent.clear()}},kg.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=Yc(f.markedSpans,this);if(null!=g.from&&(c=Ff(b?f:Zd(f),g.from),a==-1))return c;if(null!=g.to&&(d=Ff(b?f:Zd(f),g.to),1==a))return d}return c&&{from:c,to:d}},kg.prototype.changed=function(){var a=this.find(-1,!0),b=this,c=this.doc.cm;a&&c&&Cb(c,function(){var d=a.line,e=Zd(a.line),f=$a(c,e);if(f&&(eb(f),c.curOp.selectionChanged=c.curOp.forceUpdate=!0),c.curOp.updateMaxLine=!0,!sd(b.doc,d)&&null!=b.height){var g=b.height;b.height=null;var h=vd(b)-g;h&&Yd(d,d.height+h)}})},kg.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&De(b.maybeHiddenMarkers,this)!=-1||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},kg.prototype.detachLine=function(a){if(this.lines.splice(De(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}};var jg=0,lg=a.SharedTextMarker=function(a,b){this.markers=a,this.primary=b;for(var c=0;c<a.length;++c)a[c].parent=this};ye(lg),lg.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();te(this,"clear")}},lg.prototype.find=function(a,b){return this.primary.find(a,b)};var mg=a.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.doc=a,this.node=b};ye(mg),mg.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,c=this.line,d=Zd(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=vd(this);Yd(c,Math.max(0,c.height-f)),a&&Cb(a,function(){ud(a,c,-f),Jb(a,d,"widget")})}},mg.prototype.changed=function(){var a=this.height,b=this.doc.cm,c=this.line;this.height=null;var d=vd(this)-a;d&&(Yd(c,c.height+d),b&&Cb(b,function(){b.curOp.forceUpdate=!0,ud(b,c,d)}))};var ng=a.Line=function(a,b,c){this.text=a,gd(this,b),this.height=c?c(this):1};ye(ng),ng.prototype.lineNo=function(){return Zd(this)};var og={},pg={};Rd.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height,yd(e),te(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0;d<b.length;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;a<d;++a)if(c(this.lines[a]))return!0}},Sd.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25&&(this.children.length>1||!(this.children[0]instanceof Rd))){var h=[];this.collapse(h),this.children=[new Rd(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<=f){if(e.insertInner(a,b,c),e.lines&&e.lines.length>50){for(;e.lines.length>50;){var g=e.lines.splice(e.lines.length-25,25),h=new Rd(g);e.height-=h.height,this.children.splice(d+1,0,h),h.parent=this}this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new Sd(b);if(a.parent){a.size-=c.size,a.height-=c.height;var d=De(a.parent.children,a);a.parent.children.splice(d+1,0,c)}else{var e=new Sd(a.children);e.parent=a,a.children=[e,c],a=e}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){var g=Math.min(b,f-a);if(e.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=f}}};var qg=0,rg=a.Doc=function(a,b,c){if(!(this instanceof rg))return new rg(a,b,c);null==c&&(c=0),Sd.call(this,[new Rd([new ng("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=c;var d=Ff(c,0);this.sel=oa(d),this.history=new be(null),this.id=++qg,this.modeOption=b,"string"==typeof a&&(a=Ug(a)),Qd(this,{from:d,to:d,text:a}),Ba(this,oa(d),Dg)};rg.prototype=Ge(Sd.prototype,{constructor:rg,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a,b){var c=Xd(this,this.first,this.first+this.size,b);return a===!1?c:c.join(a||"\n")},setValue:Fb(function(a){var b=Ff(this.first,0),c=this.first+this.size-1;wc(this,{from:b,to:Ff(c,Vd(this,c).text.length),text:Ug(a),origin:"setValue",full:!0},!0),Ba(this,oa(b))}),replaceRange:function(a,b,c,d){b=qa(this,b),c=c?qa(this,c):b,Cc(this,a,b,c,d)},getRange:function(a,b,c){var d=Wd(this,qa(this,a),qa(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},getLineHandle:function(a){if(sa(this,a))return Vd(this,a)},getLineNumber:function(a){return Zd(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=Vd(this,a)),od(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return qa(this,a)},getCursor:function(a){var b,c=this.sel.primary();return b=null==a||"head"==a?c.head:"anchor"==a?c.anchor:"end"==a||"to"==a||a===!1?c.to():c.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Fb(function(a,b,c){ya(this,qa(this,"number"==typeof a?Ff(a,b||0):a),null,c)}),setSelection:Fb(function(a,b,c){ya(this,qa(this,a),qa(this,b||a),c)}),extendSelection:Fb(function(a,b,c){va(this,qa(this,a),b&&qa(this,b),c)}),extendSelections:Fb(function(a,b){wa(this,ta(this,a,b))}),extendSelectionsBy:Fb(function(a,b){wa(this,Ee(this.sel.ranges,a),b)}),setSelections:Fb(function(a,b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new ma(qa(this,a[d].anchor),qa(this,a[d].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex)),Ba(this,na(e,b),c)}}),addSelection:Fb(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new ma(qa(this,a),qa(this,b||a))),Ba(this,na(d,d.length-1),c)}),getSelection:function(a){for(var b,c=this.sel.ranges,d=0;d<c.length;d++){var e=Wd(this,c[d].from(),c[d].to());b=b?b.concat(e):e}return a===!1?b:b.join(a||"\n")},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=Wd(this,c[d].from(),c[d].to());a!==!1&&(e=e.join(a||"\n")),b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:Fb(function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:Ug(a[f]),origin:c}}for(var h=b&&"end"!=b&&uc(this,d,b),f=d.length-1;f>=0;f--)wc(this,d[f]);h?Aa(this,h):this.cm&&Ic(this.cm)}),undo:Fb(function(){yc(this,"undo")}),redo:Fb(function(){yc(this,"redo")}),undoSelection:Fb(function(){yc(this,"undo",!0)}),redoSelection:Fb(function(){yc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(var d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new be(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){return a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:me(this.history.done),undone:me(this.history.undone)}},setHistory:function(a){var b=this.history=new be(this.history.maxGeneration);b.done=me(a.done.slice(0),null,!0),b.undone=me(a.undone.slice(0),null,!0)},addLineClass:Fb(function(a,b,c){return Lc(this,a,"gutter"==b?"gutter":"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(a[d]){if(Qe(c).test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:Fb(function(a,b,c){return Lc(this,a,"gutter"==b?"gutter":"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(Qe(c));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(f.index&&g!=e.length?" ":"")+e.slice(g)||null}return!0})}),addLineWidget:Fb(function(a,b,c){return wd(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return Sc(this,qa(this,a),qa(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};return a=qa(this,a),Sc(this,a,a,c,"bookmark")},findMarksAt:function(a){a=qa(this,a);var b=[],c=Vd(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=qa(this,a),b=qa(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,function(f){var g=f.markedSpans;if(g)for(var h=0;h<g.length;h++){var i=g[h];e==a.line&&a.ch>i.to||null==i.from&&e!=a.line||e==b.line&&i.from>b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e}),d},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;d<c.length;++d)null!=c[d].from&&a.push(c[d].marker)}),a},posFromIndex:function(a){var b,c=this.first;return this.iter(function(d){var e=d.text.length+1;return e>a?(b=a,!0):(a-=e,void++c)}),qa(this,Ff(c,b))},indexFromPos:function(a){a=qa(this,a);var b=a.ch;return a.line<this.first||a.ch<0?0:(this.iter(this.first,a.line,function(a){b+=a.text.length+1}),b)},copy:function(a){var b=new rg(Xd(this,this.first,this.first+this.size),this.modeOption,this.first);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel=this.sel,b.extend=!1,a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory())),b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from),null!=a.to&&a.to<c&&(c=a.to);var d=new rg(Xd(this,b,c),a.mode||this.modeOption,b);return a.sharedHist&&(d.history=this.history),(this.linked||(this.linked=[])).push({doc:d,sharedHist:a.sharedHist}),d.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}],Vc(d,Uc(this)),d},unlinkDoc:function(b){if(b instanceof a&&(b=b.doc),this.linked)for(var c=0;c<this.linked.length;++c){var d=this.linked[c];if(d.doc==b){this.linked.splice(c,1),b.unlinkDoc(this),Wc(Uc(this));break}}if(b.history==this.history){var e=[b.id];Td(b,function(a){e.push(a.id)},!0),b.history=new be(null),b.history.done=me(this.history.done,e),b.history.undone=me(this.history.undone,e)}},iterLinkedDocs:function(a){Td(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),rg.prototype.eachLine=rg.prototype.iter;var sg="iter insert remove copy getEditor constructor".split(" ");for(var tg in rg.prototype)rg.prototype.hasOwnProperty(tg)&&De(sg,tg)<0&&(a.prototype[tg]=function(a){return function(){return a.apply(this.doc,arguments)}}(rg.prototype[tg]));ye(rg);var ug=a.e_preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},vg=a.e_stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},wg=a.e_stop=function(a){ug(a),vg(a)},xg=a.on=function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a._handlers||(a._handlers={}),e=d[b]||(d[b]=[]);e.push(c)}},yg=a.off=function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers&&a._handlers[b];if(!d)return;for(var e=0;e<d.length;++e)if(d[e]==c){d.splice(e,1);break}}},zg=a.signal=function(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)},Ag=null,Bg=30,Cg=a.Pass={toString:function(){return"CodeMirror.Pass"}},Dg={scroll:!1},Eg={origin:"*mouse"},Fg={origin:"+move"};ze.prototype.set=function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)};var Gg=a.countColumn=function(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),b==-1&&(b=a.length));for(var f=d||0,g=e||0;;){var h=a.indexOf("\t",f);if(h<0||h>=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}},Hg=[""],Ig=function(a){a.select()};wf?Ig=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:nf&&(Ig=function(a){try{a.select()}catch(b){}});var Jg,Kg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Lg=a.isWordChar=function(a){return/\w/.test(a)||a>"€"&&(a.toUpperCase()!=a.toLowerCase()||Kg.test(a))},Mg=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Jg=document.createRange?function(a,b,c,d){var e=document.createRange();return e.setEnd(d||a,c),e.setStart(a,b),e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}return d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d};var Ng=a.contains=function(a,b){if(3==b.nodeType&&(b=b.parentNode),a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)};nf&&of<11&&(Pe=function(){try{return document.activeElement}catch(a){return document.body}});var Og,Pg,Qg=a.rmClass=function(a,b){var c=a.className,d=Qe(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);a.className=c.slice(0,d.index)+(e?d[1]+e:"")}},Rg=a.addClass=function(a,b){var c=a.className;Qe(b).test(c)||(a.className+=(c?" ":"")+b)},Sg=!1,Tg=function(){if(nf&&of<9)return!1;var a=Me("div");return"draggable"in a||"dragDrop"in a}(),Ug=a.splitLines=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);e==-1&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");g!=-1?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},Vg=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return!(!b||b.parentElement()!=a)&&0!=b.compareEndPoints("StartToEnd",b)},Wg=function(){var a=Me("div");return"oncopy"in a||(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),Xg=null,Yg={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};a.keyNames=Yg,function(){for(var a=0;a<10;a++)Yg[a+48]=Yg[a+96]=String(a);for(var a=65;a<=90;a++)Yg[a]=String.fromCharCode(a);for(var a=1;a<=12;a++)Yg[a+111]=Yg[a+63235]="F"+a}();var Zg,$g=function(){function a(a){return a<=247?c.charAt(a):1424<=a&&a<=1524?"R":1536<=a&&a<=1773?d.charAt(a-1536):1774<=a&&a<=2220?"r":8192<=a&&a<=8203?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a,this.from=b,this.to=c}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",d="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,i=/[1n]/,j="L";return function(c){if(!e.test(c))return!1;for(var d,k=c.length,l=[],m=0;m<k;++m)l.push(d=a(c.charCodeAt(m)));for(var m=0,n=j;m<k;++m){var d=l[m];"m"==d?l[m]=n:n=d}for(var m=0,o=j;m<k;++m){var d=l[m];"1"==d&&"r"==o?l[m]="n":g.test(d)&&(o=d,"r"==d&&(l[m]="R"))}for(var m=1,n=l[0];m<k-1;++m){var d=l[m];"+"==d&&"1"==n&&"1"==l[m+1]?l[m]="1":","!=d||n!=l[m+1]||"1"!=n&&"n"!=n||(l[m]=n),n=d}for(var m=0;m<k;++m){var d=l[m];if(","==d)l[m]="N";else if("%"==d){for(var p=m+1;p<k&&"%"==l[p];++p);for(var q=m&&"!"==l[m-1]||p<k&&"1"==l[p]?"1":"N",r=m;r<p;++r)l[r]=q;m=p-1}}for(var m=0,o=j;m<k;++m){var d=l[m];"L"==o&&"1"==d?l[m]="L":g.test(d)&&(o=d)}for(var m=0;m<k;++m)if(f.test(l[m])){for(var p=m+1;p<k&&f.test(l[p]);++p);for(var s="L"==(m?l[m-1]:j),t="L"==(p<k?l[p]:j),q=s||t?"L":"R",r=m;r<p;++r)l[r]=q;m=p-1}for(var u,v=[],m=0;m<k;)if(h.test(l[m])){var w=m;for(++m;m<k&&h.test(l[m]);++m);v.push(new b(0,w,m))}else{var x=m,y=v.length;for(++m;m<k&&"L"!=l[m];++m);for(var r=x;r<m;)if(i.test(l[r])){x<r&&v.splice(y,0,new b(1,x,r));var z=r;for(++r;r<m&&i.test(l[r]);++r);v.splice(y,0,new b(2,z,r)),x=r}else++r;x<m&&v.splice(y,0,new b(1,x,m))}return 1==v[0].level&&(u=c.match(/^\s+/))&&(v[0].from=u[0].length,v.unshift(new b(0,0,u[0].length))),1==Ce(v).level&&(u=c.match(/\s+$/))&&(Ce(v).to-=u[0].length,v.push(new b(0,k-u[0].length,k))),2==v[0].level&&v.unshift(new b(1,v[0].to,v[0].to)),v[0].level!=Ce(v).level&&v.push(new b(v[0].level,k,k)),v}}();return a.version="5.4.1",a}),function(a){a(CodeMirror)}(function(a){function b(a,b){for(var c=0,d=a.length;c<d;++c)b(a[c])}function c(a,b){if(!Array.prototype.indexOf){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1}return a.indexOf(b)!=-1}function d(b,c,d,e){var f=b.getCursor(),i=d(b,f);if(!/\b(?:string)\b/.test(i.type)){i.state=a.innerMode(b.getMode(),i.state).state,/^[\w$_]*$/.test(i.string)?i.end>f.ch&&(i.end=f.ch,i.string=i.string.slice(0,f.ch-i.start)):i={start:f.ch,end:f.ch,string:"",state:i.state,type:"."==i.string?"property":null};for(var j=i;"property"==j.type;){if(j=d(b,h(f.line,j.start)),"."!=j.string)return;if(j=d(b,h(f.line,j.start)),!k)var k=[];k.push(j)}return{list:g(i,k,c,e),from:h(f.line,i.start),to:h(f.line,i.end)}}}function e(){return BI.FormulaCollections}function f(a,b){return d(a,e(),function(a,b){return a.getTokenAt(b)},b)}function g(a,d,e,f){function g(a){0!=a.lastIndexOf(i,0)||c(h,a)||h.push(a)}var h=[],i=a.string;return i?(d&&d.length?d.pop():b(e,g),h):h}var h=a.Pos;a.registerHelper("hint","formula",f)}),function(a){a(CodeMirror)}(function(a){"use strict";a.defineMode("formula",function(){function a(a){for(var b={},c=0,d=a.length;c<d;++c)b[a[c]]=!0;return b}function b(a,b){if(a.eatSpace())return null;var d=a.next();if('"'===d||"'"===d)return c(a,d),"string";if(""===d)return c(a,d),"field";if(/[\[\],\(\)]/.test(d))return"bracket";a.eatWhile(/[\w-]/);var g=a.current();return e.hasOwnProperty(g)?"atom":f.hasOwnProperty(g)?"keyword":null}function c(a,b){for(var c,d=!1;null!=(c=a.next());){if(c===b&&!d)return!1;d=!d&&"\\"===c}return d}function d(a,c){return(c.tokens[0]||b)(a,c)}var e=a(["false","true"]),f=a(BI.FormulaCollections);return{startState:function(){return{tokens:[]}},token:function(a,b){return d(a,b)},fold:"brace"}}),a.defineMIME("text/fx-formula","formula")}),function(a){a(CodeMirror)}(function(a){"use strict";function b(a,b){this.cm=a,this.options=this.buildOptions(b),this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor(),
this.startLen=this.cm.getLine(this.startPos.line).length;var c=this;a.on("cursorActivity",this.activityFunc=function(){c.cursorActivity()})}function c(a){return"string"==typeof a?a:a.text}function d(a,b){function c(a,c){var e;e="string"!=typeof c?function(a){return c(a,b)}:d.hasOwnProperty(c)?d[c]:c,f[a]=e}var d={Up:function(){b.moveFocus(-1)},Down:function(){b.moveFocus(1)},PageUp:function(){b.moveFocus(-b.menuSize()+1,!0)},PageDown:function(){b.moveFocus(b.menuSize()-1,!0)},Home:function(){b.setFocus(0)},End:function(){b.setFocus(b.length-1)},Enter:b.pick,Tab:b.pick,Esc:b.close},e=a.options.customKeys,f=e?{}:d;if(e)for(var g in e)e.hasOwnProperty(g)&&c(g,e[g]);var h=a.options.extraKeys;if(h)for(var g in h)h.hasOwnProperty(g)&&c(g,h[g]);return f}function e(a,b){for(;b&&b!=a;){if("LI"===b.nodeName.toUpperCase()&&b.parentNode==a)return b;b=b.parentNode}}function f(b,f){this.completion=b,this.data=f,this.picked=!1;var i=this,j=b.cm,k=this.hints=document.createElement("ul");k.className="CodeMirror-hints",this.selectedHint=f.selectedHint||0;for(var l=f.list,m=0;m<l.length;++m){var n=k.appendChild(document.createElement("li")),o=l[m],p=g+(m!=this.selectedHint?"":" "+h);null!=o.className&&(p=o.className+" "+p),n.className=p,o.render?o.render(n,f,o):n.appendChild(document.createTextNode(o.displayText||c(o))),n.hintId=m}var q=j.cursorCoords(b.options.alignWithWord?f.from:null),r=q.left,s=q.bottom,t=!0;k.style.left=r+"px",k.style.top=s+"px";var u=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),v=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(b.options.container||document.body).appendChild(k);var w=k.getBoundingClientRect(),x=w.bottom-v;if(x>0){var y=w.bottom-w.top,z=q.top-(q.bottom-w.top);if(z-y>0)k.style.top=(s=q.top-y)+"px",t=!1;else if(y>v){k.style.height=v-5+"px",k.style.top=(s=q.bottom-w.top)+"px";var A=j.getCursor();f.from.ch!=A.ch&&(q=j.cursorCoords(A),k.style.left=(r=q.left)+"px",w=k.getBoundingClientRect())}}var B=w.right-u;if(B>0&&(w.right-w.left>u&&(k.style.width=u-5+"px",B-=w.right-w.left-u),k.style.left=(r=q.left-B)+"px"),j.addKeyMap(this.keyMap=d(b,{moveFocus:function(a,b){i.changeActive(i.selectedHint+a,b)},setFocus:function(a){i.changeActive(a)},menuSize:function(){return i.screenAmount()},length:l.length,close:function(){b.close()},pick:function(){i.pick()},data:f})),b.options.closeOnUnfocus){var C;j.on("blur",this.onBlur=function(){C=setTimeout(function(){b.close()},100)}),j.on("focus",this.onFocus=function(){clearTimeout(C)})}var D=j.getScrollInfo();return j.on("scroll",this.onScroll=function(){var a=j.getScrollInfo(),c=j.getWrapperElement().getBoundingClientRect(),d=s+D.top-a.top,e=d-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return t||(e+=k.offsetHeight),e<=c.top||e>=c.bottom?b.close():(k.style.top=d+"px",void(k.style.left=r+D.left-a.left+"px"))}),a.on(k,"dblclick",function(a){var b=e(k,a.target||a.srcElement);b&&null!=b.hintId&&(i.changeActive(b.hintId),i.pick())}),a.on(k,"click",function(a){var c=e(k,a.target||a.srcElement);c&&null!=c.hintId&&(i.changeActive(c.hintId),b.options.completeOnSingleClick&&i.pick())}),a.on(k,"mousedown",function(){setTimeout(function(){j.focus()},20)}),a.signal(f,"select",l[0],k.firstChild),!0}var g="CodeMirror-hint",h="CodeMirror-hint-active";a.showHint=function(a,b,c){if(!b)return a.showHint(c);c&&c.async&&(b.async=!0);var d={hint:b};if(c)for(var e in c)d[e]=c[e];return a.showHint(d)},a.defineExtension("showHint",function(c){if(!(this.listSelections().length>1||this.somethingSelected())){this.state.completionActive&&this.state.completionActive.close();var d=this.state.completionActive=new b(this,c);d.options.hint&&(a.signal(this,"startCompletion",this),d.update(!0))}});var i=window.requestAnimationFrame||function(a){return setTimeout(a,1e3/60)},j=window.cancelAnimationFrame||clearTimeout;b.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&a.signal(this.data,"close"),this.widget&&this.widget.close(),a.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(b,d){var e=b.list[d];if(e.hint)e.hint(this.cm,b,e);else if(this.cm.replaceRange(c(e),e.from||b.from,e.to||b.to,"complete"),e.isKeyword===!0);else{var f=this.cm.getCursor();this.cm.markText(e.from||b.from,f,{className:"#function",atomic:!0}),this.cm.replaceSelection("() "),f=this.cm.getCursor(),f.ch=f.ch-2,this.cm.setCursor(f),this.cm.focus()}a.signal(b,"pick",e),this.close()},cursorActivity:function(){this.debounce&&(j(this.debounce),this.debounce=0);var a=this.cm.getCursor(),b=this.cm.getLine(a.line);if(a.line!=this.startPos.line||b.length-a.ch!=this.startLen-this.startPos.ch||a.ch<this.startPos.ch||this.cm.somethingSelected()||a.ch&&this.options.closeCharacters.test(b.charAt(a.ch-1)))this.close();else{var c=this;this.debounce=i(function(){c.update()}),this.widget&&this.widget.disable()}},update:function(b){if(null!=this.tick)if(this.data&&a.signal(this.data,"update"),this.options.hint.async){var c=++this.tick,d=this;this.options.hint(this.cm,function(a){d.tick==c&&d.finishUpdate(a,b)},this.options)}else this.finishUpdate(this.options.hint(this.cm,this.options),b)},finishUpdate:function(b,c){this.data=b;var d=this.widget&&this.widget.picked||c&&this.options.completeSingle;this.widget&&this.widget.close(),b&&b.list.length&&(d&&1==b.list.length?this.pick(b,0):(this.widget=new f(this,b),a.signal(b,"shown")))},buildOptions:function(a){var b=this.cm.options.hintOptions,c={};for(var d in k)c[d]=k[d];if(b)for(var d in b)void 0!==b[d]&&(c[d]=b[d]);if(a)for(var d in a)void 0!==a[d]&&(c[d]=a[d]);return c}},f.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var a=this.completion.cm;this.completion.options.closeOnUnfocus&&(a.off("blur",this.onBlur),a.off("focus",this.onFocus)),a.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var a=this;this.keyMap={Enter:function(){a.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(b,c){if(b>=this.data.list.length?b=c?this.data.list.length-1:0:b<0&&(b=c?0:this.data.list.length-1),this.selectedHint!=b){var d=this.hints.childNodes[this.selectedHint];d.className=d.className.replace(" "+h,""),d=this.hints.childNodes[this.selectedHint=b],d.className+=" "+h,d.offsetTop<this.hints.scrollTop?this.hints.scrollTop=d.offsetTop-3:d.offsetTop+d.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=d.offsetTop+d.offsetHeight-this.hints.clientHeight+3),a.signal(this.data,"select",this.data.list[this.selectedHint],d)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},a.registerHelper("hint","auto",function(b,c){var d,e=b.getHelpers(b.getCursor(),"hint");if(e.length)for(var f=0;f<e.length;f++){var g=e[f](b,c);if(g&&g.list.length)return g}else if(d=b.getHelper(b.getCursor(),"hintWords")){if(d)return a.hint.fromList(b,{words:d})}else if(a.hint.anyword)return a.hint.anyword(b,c)}),a.registerHelper("hint","fromList",function(b,c){for(var d=b.getCursor(),e=b.getTokenAt(d),f=[],g=0;g<c.words.length;g++){var h=c.words[g];h.slice(0,e.string.length)==e.string&&f.push(h)}if(f.length)return{list:f,from:a.Pos(d.line,e.start),to:a.Pos(d.line,e.end)}}),a.commands.autocomplete=a.showHint;var k={hint:a.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};a.defineOption("hintOptions",null)}),BI.FormulaEditor=BI.inherit(BI.Single,{_defaultConfig:function(){return $.extend(BI.FormulaEditor.superclass._defaultConfig.apply(),{baseCls:"bi-formula-editor bi-card",watermark:"",value:"",fieldTextValueMap:{},showHint:!0,lineHeight:2})},_init:function(){BI.FormulaEditor.superclass._init.apply(this,arguments);var a=this.options,b=this;if(this.editor=CodeMirror(this.element[0],{textWrapping:!0,lineWrapping:!0,lineNumbers:!1,mode:"formula",specialChars:/[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/}),1===a.lineHeight?this.element.addClass("codemirror-low-line-height"):this.element.addClass("codemirror-high-line-height"),this.editor.on("change",function(c,d){b._checkWaterMark(),a.showHint&&CodeMirror.showHint(c,CodeMirror.formulaHint,{completeSingle:!1}),BI.nextTick(function(){b.fireEvent(BI.FormulaEditor.EVENT_CHANGE)})}),this.editor.on("focus",function(){b._checkWaterMark(),b.fireEvent(BI.FormulaEditor.EVENT_FOCUS)}),this.editor.on("blur",function(){b.fireEvent(BI.FormulaEditor.EVENT_BLUR)}),BI.isKey(a.value)&&b.setValue(a.value),BI.isKey(this.options.watermark)){var b=this;this.watermark=BI.createWidget({type:"bi.label",cls:"bi-water-mark",text:this.options.watermark,whiteSpace:"nowrap",textAlign:"left"}),BI.createWidget({type:"bi.absolute",element:b,items:[{el:b.watermark,left:0,top:0}]}),this.watermark.element.bind("mousedown",function(a){b.insertString(""),b.editor.focus(),a.stopEvent()}),this.watermark.element.bind("click",function(a){b.editor.focus(),a.stopEvent()}),this.watermark.element.css({position:"absolute",left:3,right:3,top:6,bottom:0})}},_checkWaterMark:function(){var a=this.options;!this.disabledWaterMark&&BI.isEmptyString(this.editor.getValue())&&BI.isKey(a.watermark)?this.watermark&&this.watermark.visible():this.watermark&&this.watermark.invisible()},disableWaterMark:function(){this.disabledWaterMark=!0,this._checkWaterMark()},focus:function(){this.editor.focus()},insertField:function(a){var b=this.editor.getCursor();this.editor.replaceSelection(""+a+"");var c=this.editor.getCursor();this.editor.markText(b,c,{className:"fieldName",atomic:!0,startStyle:"start",endStyle:"end"}),this.editor.replaceSelection(" "),this.editor.focus()},insertFunction:function(a){var b=this.editor.getCursor();this.editor.replaceSelection(a);var c=this.editor.getCursor();this.editor.markText(b,c,{className:"#function",atomic:!0}),this.editor.replaceSelection("() "),c=this.editor.getCursor(),c.ch=c.ch-2,this.editor.setCursor(c),this.editor.focus()},insertOperator:function(a){var b=this.editor.getCursor();this.editor.replaceSelection(a);var c=this.editor.getCursor();this.editor.markText(b,c,{className:"%operator",atomic:!0}),this.editor.replaceSelection(" "),this.editor.focus()},setFunction:function(a){var b=this.editor.getCursor();this.editor.replaceSelection(a);var c=this.editor.getCursor();this.editor.markText(b,c,{className:"#function",atomic:!0})},insertString:function(a){this.editor.replaceSelection(a),this.editor.focus()},getFormulaString:function(){return this.editor.getValue()},getUsedFields:function(){var a=this.options.fieldTextValueMap,b=[];return this.editor.getValue(!0,function(c){var d=c.text;_.forEach(c.markedSpans,function(c,e){switch(c.marker.className){case"fieldName":var f=a[d.substr(c.from+1,c.to-c.from-2)];b.contains(f)||b.push(f)}})}),b},getCheckString:function(){return this.editor.getValue(!0,function(a){var b=a.text,c=a.text,d=0;return c.text=b,_.forEach(a.markedSpans,function(a,b){switch(a.marker.className){case"fieldName":var e=a.to-a.from;c=c.substr(0,a.from+d)+"$a"+c.substr(a.to+d,c.length),d=d+2-e}}),c})},getValue:function(){var a=this.options.fieldTextValueMap;return this.editor.getValue("\n",function(b){var c=b.text,d=b.text,e=0;return d.text=c,_.forEach(b.markedSpans,function(b,c){switch(b.marker.className){case"fieldName":var f=b.to-b.from,g=b.from+e+1,h=f-2,i=a[d.substr(g,h)];d=d.substr(0,b.from+e)+"${"+i+"}"+d.substr(b.to+e,d.length),e+=i.length-f+3}}),d})},setValue:function(a){this.editor.setValue(a)},setFieldTextValueMap:function(a){this.options.fieldTextValueMap=a},refresh:function(){var a=this;BI.nextTick(function(){a.editor.refresh()})}}),BI.FormulaEditor.EVENT_CHANGE="EVENT_CHANGE",BI.FormulaEditor.EVENT_BLUR="EVENT_BLUR",BI.FormulaEditor.EVENT_FOCUS="EVENT_FOCUS",BI.shortcut("bi.formula_editor",BI.FormulaEditor),$.extend(BI,{Msg:function(){var a,b,c;return{alert:function(a,b,c){this._show(!1,a,b,c)},confirm:function(a,b,c){this._show(!0,a,b,c)},prompt:function(a,b,c,d,e){},toast:function(a,b,c){c=c||$("body");var d=BI.createWidget({type:"bi.toast",level:b,text:a});BI.createWidget({type:"bi.absolute",element:c,items:[{el:d,left:"50%",top:0}]}),d.element.outerWidth()>c.outerWidth()&&d.setWidth(c.width()),d.element.css({"margin-left":-1*d.element.outerWidth()/2}),d.invisible(),d.element.slideDown(500,function(){BI.delay(function(){d.element.slideUp(500,function(){d.destroy()})},5e3)})},_show:function(d,e,f,g){b=$('<div class="bi-z-index-mask">').css({position:"absolute",zIndex:BI.zIndex_tip-2,top:0,left:0,right:0,bottom:0,opacity:.5}).appendTo("body"),c=$('<div class="bi-message-depend">').css({position:"absolute",zIndex:BI.zIndex_tip-1,top:0,left:0,right:0,bottom:0}).appendTo("body");var h=function(){a.destroy(),b.remove()},i=[];d===!0&&i.push({el:{type:"bi.button",text:BI.i18nText("BI-Basic_Cancel"),height:30,level:"ignore",handler:function(){h(),BI.isFunction(g)&&g.apply(null,[!1])}}}),i.push({el:{type:"bi.button",text:BI.i18nText("BI-Basic_OK"),height:30,handler:function(){h(),BI.isFunction(g)&&g.apply(null,[!0])}}});var j={element:c,type:"bi.center_adapt",items:[{type:"bi.border",cls:"bi-message-content bi-card",items:{north:{el:{type:"bi.border",cls:"bi-message-title bi-background",items:{center:{el:{type:"bi.label",text:e||BI.i18nText("BI-Basic_Prompt"),textAlign:"left",hgap:20,height:50}},east:{el:{type:"bi.icon_button",cls:"bi-message-close close-font",handler:function(){h()}},width:60}}},height:50},center:{el:{type:"bi.text",cls:"bi-message-text",tgap:60,hgap:20,lineHeight:30,whiteSpace:"normal",text:f}},south:{el:{type:"bi.absolute",items:[{el:{type:"bi.right_vertical_adapt",hgap:5,items:i},top:0,left:20,right:20,bottom:0}]},height:60}},width:400,height:300}]};a=BI.createWidget(j)}}}()}),BI.GridView=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.GridView.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-grid-view",overflowX:!0,overflowY:!0,overscanColumnCount:0,overscanRowCount:0,rowHeightGetter:BI.emptyFn,columnWidthGetter:BI.emptyFn,scrollLeft:0,scrollTop:0,items:[]})},_init:function(){BI.GridView.superclass._init.apply(this,arguments);var a=this,b=this.options;this.renderedCells=[],this.renderedKeys=[],this.renderRange={},this._scrollLock=!1,this._debounceRelease=BI.debounce(function(){a._scrollLock=!1},1e3/60),this.container=BI.createWidget({type:"bi.absolute"}),this.element.scroll(function(){a._scrollLock!==!0&&(b.scrollLeft=a.element.scrollLeft(),b.scrollTop=a.element.scrollTop(),a._calculateChildrenToRender(),a.fireEvent(BI.GridView.EVENT_SCROLL,{scrollLeft:b.scrollLeft,scrollTop:b.scrollTop}))}),BI.createWidget({type:"bi.vertical",element:this,scrollable:b.overflowX===!0&&b.overflowY===!0,scrolly:b.overflowX===!1&&b.overflowY===!0,scrollx:b.overflowX===!0&&b.overflowY===!1,items:[this.container]}),b.items.length>0&&this._populate(),0===b.scrollLeft&&0===b.scrollTop||BI.nextTick(function(){a.element.scrollTop(b.scrollTop),a.element.scrollLeft(b.scrollLeft)})},_getOverscanIndices:function(a,b,c,d){return{overscanStartIndex:Math.max(0,c-b),overscanStopIndex:Math.min(a-1,d+b)}},_calculateChildrenToRender:function(){var a=this,b=this.options,c=b.width,d=b.height,e=BI.clamp(b.scrollLeft,0,this._getMaxScrollLeft()),f=BI.clamp(b.scrollTop,0,this._getMaxScrollTop()),g=b.overscanColumnCount,h=b.overscanRowCount;if(d>0&&c>0){var i=this._columnSizeAndPositionManager.getVisibleCellRange(c,e),j=this._rowSizeAndPositionManager.getVisibleCellRange(d,f);if(BI.isEmpty(i)||BI.isEmpty(j))return;var k=this._columnSizeAndPositionManager.getOffsetAdjustment(c,e),l=this._rowSizeAndPositionManager.getOffsetAdjustment(d,f);this._renderedColumnStartIndex=i.start,this._renderedColumnStopIndex=i.stop,this._renderedRowStartIndex=j.start,this._renderedRowStopIndex=j.stop;var m=this._getOverscanIndices(this.columnCount,g,this._renderedColumnStartIndex,this._renderedColumnStopIndex),n=this._getOverscanIndices(this.rowCount,h,this._renderedRowStartIndex,this._renderedRowStopIndex),o=m.overscanStartIndex,p=m.overscanStopIndex,q=n.overscanStartIndex,r=n.overscanStopIndex,s=this._rowSizeAndPositionManager.getSizeAndPositionOfCell(q),t=this._columnSizeAndPositionManager.getSizeAndPositionOfCell(o),u=this._rowSizeAndPositionManager.getSizeAndPositionOfCell(r),v=this._columnSizeAndPositionManager.getSizeAndPositionOfCell(p),w=s.offset+l,x=t.offset+k,y=u.offset+l+u.size,z=v.offset+k+v.size;if(w>=this.renderRange.minY&&y<=this.renderRange.maxY&&x>=this.renderRange.minX&&z<=this.renderRange.maxX)return;for(var A=[],B={},C={},D=this._getMaxScrollLeft(),E=this._getMaxScrollTop(),F=0,G=0,H=0,I=q;I<=r;I++)for(var J=this._rowSizeAndPositionManager.getSizeAndPositionOfCell(I),K=o;K<=p;K++){var L,M=I+"-"+K,N=this._columnSizeAndPositionManager.getSizeAndPositionOfCell(K),O=this.renderedKeys[M]&&this.renderedKeys[M][2];O>=0?(N.size!==this.renderedCells[O]._width&&(this.renderedCells[O]._width=N.size,this.renderedCells[O].el.setWidth(N.size)),J.size!==this.renderedCells[O]._height&&(this.renderedCells[O]._height=J.size,this.renderedCells[O].el.setHeight(J.size)),this.renderedCells[O]._left!==N.offset+k&&this.renderedCells[O].el.element.css("left",N.offset+k+"px"),this.renderedCells[O]._top!==J.offset+l&&this.renderedCells[O].el.element.css("top",J.offset+l+"px"),A.push(L=this.renderedCells[O])):(L=BI.createWidget(BI.extend({type:"bi.label",width:N.size,height:J.size},b.items[I][K],{cls:(b.items[I][K].cls||"")+" grid-cell"+(0===I?" first-row":"")+(0===K?" first-col":""),_rowIndex:I,_columnIndex:K,_left:N.offset+k,_top:J.offset+l})),A.push({el:L,left:N.offset+k,top:J.offset+l,_left:N.offset+k,_top:J.offset+l,_width:N.size,_height:J.size})),D=Math.min(D,N.offset+k),F=Math.max(F,N.offset+k+N.size),E=Math.min(E,J.offset+l),G=Math.max(G,J.offset+l+J.size),B[M]=[I,K,H],C[H]=L,H++}var P={},Q={},R=[];BI.each(B,function(b,c){a.renderedKeys[b]?P[b]=c:Q[b]=c}),BI.each(this.renderedKeys,function(a,b){P[a]||Q[a]||R.push(b[2])}),BI.each(R,function(b,c){a.renderedCells[c].el._destroy()});var S=[];BI.each(Q,function(a,b){S.push(A[b[2]])}),this.container.addItems(S),this.container._children=C,this.container.attr("items",A),this.renderedCells=A,this.renderedKeys=B,this.renderRange={minX:D,minY:E,maxX:F,maxY:G}}},_getMaxScrollLeft:function(){return Math.max(0,this._columnSizeAndPositionManager.getTotalSize()-this.options.width+(this.options.overflowX?BI.DOM.getScrollWidth():0))},_getMaxScrollTop:function(){return Math.max(0,this._rowSizeAndPositionManager.getTotalSize()-this.options.height+(this.options.overflowY?BI.DOM.getScrollWidth():0))},_populate:function(a){var b=this.options;this._reRange(),this.columnCount=0,this.rowCount=0,a&&a!==this.options.items&&(this.options.items=a),BI.isNumber(b.columnCount)?this.columnCount=b.columnCount:b.items.length>0&&(this.columnCount=b.items[0].length),BI.isNumber(b.rowCount)?this.rowCount=b.rowCount:this.rowCount=b.items.length,this.container.setWidth(this.columnCount*b.estimatedColumnSize),this.container.setHeight(this.rowCount*b.estimatedRowSize),this._columnSizeAndPositionManager=new BI.ScalingCellSizeAndPositionManager(this.columnCount,b.columnWidthGetter,b.estimatedColumnSize),this._rowSizeAndPositionManager=new BI.ScalingCellSizeAndPositionManager(this.rowCount,b.rowHeightGetter,b.estimatedRowSize),this._calculateChildrenToRender();try{this.element.scrollTop(b.scrollTop),this.element.scrollLeft(b.scrollLeft)}catch(c){}},setScrollLeft:function(a){this.options.scrollLeft!==a&&(this._scrollLock=!0,this.options.scrollLeft=BI.clamp(a||0,0,this._getMaxScrollLeft()),this._debounceRelease(),this._calculateChildrenToRender(),this.element.scrollLeft(this.options.scrollLeft))},setScrollTop:function(a){this.options.scrollTop!==a&&(this._scrollLock=!0,this.options.scrollTop=BI.clamp(a||0,0,this._getMaxScrollTop()),this._debounceRelease(),this._calculateChildrenToRender(),this.element.scrollTop(this.options.scrollTop))},setColumnCount:function(a){this.options.columnCount=a},setRowCount:function(a){this.options.rowCount=a},setOverflowX:function(a){var b=this;this.options.overflowX!==!!a&&(this.options.overflowX=!!a,BI.nextTick(function(){b.element.css({overflowX:a?"auto":"hidden"})}))},setOverflowY:function(a){var b=this;this.options.overflowY!==!!a&&(this.options.overflowY=!!a,BI.nextTick(function(){b.element.css({overflowY:a?"auto":"hidden"})}))},getScrollLeft:function(){return this.options.scrollLeft},getScrollTop:function(){return this.options.scrollTop},getMaxScrollLeft:function(){return this._getMaxScrollLeft()},getMaxScrollTop:function(){return this._getMaxScrollTop()},setEstimatedColumnSize:function(a){this.options.estimatedColumnSize=a},setEstimatedRowSize:function(a){this.options.estimatedRowSize=a},_reRange:function(){this.renderRange={}},_clearChildren:function(){this.container._children={},this.container.attr("items",[])},restore:function(){BI.each(this.renderedCells,function(a,b){b.el._destroy()}),this._clearChildren(),this.renderedCells=[],this.renderedKeys=[],this.renderRange={},this._scrollLock=!1},populate:function(a){a&&a!==this.options.items&&this.restore(),this._populate(a)}}),BI.GridView.EVENT_SCROLL="EVENT_SCROLL",BI.shortcut("bi.grid_view",BI.GridView),BI.FloatBox=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-float-box bi-card",width:600,height:500})},_init:function(){BI.FloatBox.superclass._init.apply(this,arguments);var a=this,b=this.options;this.showAction=new BI.ShowAction({tar:this}),this._center=BI.createWidget(),this._north=BI.createWidget(),this.element.draggable&&this.element.draggable({handle:".bi-message-title",drag:function(a,c){var d=$("body").width(),e=$("body").height();c.position.left+b.width>d&&(c.position.left=d-b.width),c.position.top+b.height>e&&(c.position.top=e-b.height),c.position.left<0&&(c.position.left=0),c.position.top<0&&(c.position.top=0),BI.Resizers._resize()}}),this._south=BI.createWidget(),BI.createWidget({type:"bi.border",element:this,items:{north:{el:{type:"bi.border",cls:"bi-message-title bi-background",items:{center:{el:{type:"bi.absolute",items:[{el:this._north,left:10,top:0,right:0,bottom:0}]}},east:{el:{type:"bi.icon_button",cls:"bi-message-close close-font",height:50,handler:function(){a.currentSectionProvider.close()}},width:60}}},height:50},center:{el:{type:"bi.absolute",items:[{el:this._center,left:20,top:20,right:20,bottom:0}]}},south:{el:{type:"bi.absolute",items:[{el:this._south,left:20,top:0,right:20,bottom:0}]},height:60}}})},populate:function(a){var b=this;this.currentSectionProvider&&this.currentSectionProvider!==a&&this.currentSectionProvider.destroy(),this.currentSectionProvider=a,a.rebuildNorth(this._north),a.rebuildCenter(this._center),a.rebuildSouth(this._south),a.on(BI.PopoverSection.EVENT_CLOSE,function(){b.close()})},show:function(){this.showAction.actionPerformed()},hide:function(){this.showAction.actionBack()},open:function(){this.show(),this.fireEvent(BI.FloatBox.EVENT_FLOAT_BOX_OPEN)},close:function(){this.hide(),this.fireEvent(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED)},setZindex:function(a){this.element.css({"z-index":a})},destroyed:function(){this.currentSectionProvider&&this.currentSectionProvider.destroy()}}),BI.shortcut("bi.float_box",BI.FloatBox),BI.FloatBox.EVENT_FLOAT_BOX_CLOSED="EVENT_FLOAT_BOX_CLOSED",BI.FloatBox.EVENT_FLOAT_BOX_OPEN="EVENT_FLOAT_BOX_CLOSED",BI.PopupView=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.PopupView.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-popup-view",maxWidth:"auto",minWidth:100,minHeight:25,lgap:0,rgap:0,tgap:0,bgap:0,vgap:0,hgap:0,direction:BI.Direction.Top,stopEvent:!1,stopPropagation:!1,logic:{dynamic:!0},tool:!1,tabs:[],buttons:[],el:{type:"bi.button_group",items:[],chooseType:0,behaviors:{},layouts:[{type:"bi.vertical"}]}})},_init:function(){BI.PopupView.superclass._init.apply(this,arguments);var a=this,b=this.options,c=function(a){a.stopPropagation()},d=function(a){return a.stopEvent(),!1};this.element.css({"z-index":BI.zIndex_popup,"min-width":b.minWidth+"px","max-width":b.maxWidth+"px"}).bind({click:c}),this.element.bind("mousewheel",c),b.stopPropagation&&this.element.bind({mousedown:c,mouseup:c,mouseover:c}),b.stopEvent&&this.element.bind({mousedown:d,mouseup:d,mouseover:d}),this.tool=this._createTool(),this.tab=this._createTab(),this.view=this._createView(),this.toolbar=this._createToolBar(),this.button_group.on(BI.Controller.EVENT_CHANGE,function(b){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.PopupView.EVENT_CHANGE)}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(b.direction),BI.extend({},b.logic,{scrolly:!1,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,vgap:b.vgap,hgap:b.hgap,items:BI.LogicFactory.createLogicItemsByDirection(b.direction,BI.extend({cls:"list-view-outer bi-card bi-border"},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(b.direction),BI.extend({},b.logic,{items:BI.LogicFactory.createLogicItemsByDirection(b.direction,this.tool,this.tab,this.view,this.toolbar)}))))}))))},_createView:function(){var a=this.options;return this.button_group=BI.createWidget(a.el,{type:"bi.button_group"}),this.button_group.element.css({"min-height":a.minHeight+"px"}),this.button_group},_createTool:function(){var a=this.options;if(!1!==a.tool)return BI.createWidget(a.tool)},_createTab:function(){var a=this.options;if(0!==a.tabs.length)return BI.createWidget({type:"bi.center",cls:"list-view-tab",height:25,items:a.tabs})},_createToolBar:function(){var a=this.options;if(0!==a.buttons.length)return BI.createWidget({type:"bi.center",cls:"list-view-toolbar bi-high-light bi-border-top",height:30,items:BI.createItems(a.buttons,{once:!1,shadow:!0,isShadowShowingOnSelected:!0})})},getView:function(){return this.button_group},populate:function(a){this.button_group.populate.apply(this.button_group,arguments)},resetWidth:function(a){this.options.width=a,this.element.width(a)},resetHeight:function(a){var b=this.toolbar?this.toolbar.attr("height")||30:0,c=this.tab?this.tab.attr("height")||25:0,d=(this.tool&&this.tool.attr("height")||25)*(this.tool&&this.tool.isVisible()?1:0);this.view.resetHeight?this.view.resetHeight(a-b-c-d-2):this.view.element.css({"max-height":a-b-c-d-2+"px"})},setValue:function(a){this.tab&&this.tab.setValue(a),this.button_group.setValue(a)},getValue:function(){return this.button_group.getValue()}}),BI.PopupView.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.popup_view",BI.PopupView),BI.SearcherView=BI.inherit(BI.Pane,{_defaultConfig:function(){var a=BI.SearcherView.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-searcher-view bi-card",tipText:BI.i18nText("BI-No_Select"),chooseType:BI.Selection.Single,matcher:{type:"bi.button_group",behaviors:{redmark:function(){return!0}},items:[],layouts:[{type:"bi.vertical"}]},searcher:{type:"bi.button_group",behaviors:{redmark:function(){return!0}},items:[],layouts:[{type:"bi.vertical"}]}})},_init:function(){BI.SearcherView.superclass._init.apply(this,arguments);var a=this,b=this.options;this.matcher=BI.createWidget(b.matcher,{type:"bi.button_group",chooseType:b.chooseType,behaviors:{redmark:function(){return!0}},layouts:[{type:"bi.vertical"}]}),this.matcher.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.SearcherView.EVENT_CHANGE,c,d)}),this.spliter=BI.createWidget({type:"bi.vertical",height:1,hgap:10,items:[{type:"bi.layout",height:1,cls:"searcher-view-spliter bi-background"}]}),this.searcher=BI.createWidget(b.searcher,{type:"bi.button_group",chooseType:b.chooseType,behaviors:{redmark:function(){return!0}},layouts:[{type:"bi.vertical"}]}),this.searcher.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.SearcherView.EVENT_CHANGE,c,d)}),BI.createWidget({type:"bi.vertical",element:this,items:[this.matcher,this.spliter,this.searcher]})},startSearch:function(){},stopSearch:function(){},setValue:function(a){this.matcher.setValue(a),this.searcher.setValue(a)},getValue:function(){return this.matcher.getValue().concat(this.searcher.getValue())},populate:function(a,b,c){a||(a=[]),b||(b=[]),this.setTipVisible(a.length+b.length===0),this.spliter.setVisible(BI.isNotEmptyArray(b)&&BI.isNotEmptyArray(a)),this.matcher.populate(b,c),this.searcher.populate(a,c)},empty:function(){this.searcher.empty(),this.matcher.empty()},hasMatched:function(){return this.matcher.getAllButtons().length>0}}),BI.SearcherView.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.searcher_view",BI.SearcherView),BI.ListView=BI.inherit(BI.Widget,{props:function(){return{baseCls:"bi-list-view",overscanHeight:100,blockSize:10,scrollTop:0,el:{},items:[]}},init:function(){this.renderedIndex=-1,this.cache={}},render:function(){var a=this,b=this.options;return{type:"bi.vertical",items:[BI.extend({type:"bi.vertical",scrolly:!1,ref:function(){a.container=this}},b.el)],element:this}},mounted:function(){var a=this,b=this.options;this._populate(),this.element.scroll(function(c){b.scrollTop=a.element.scrollTop(),a._calculateBlocksToRender()}),BI.ResizeDetector.addResizeListener(this,function(){a._calculateBlocksToRender()})},_renderMoreIf:function(){for(var a,b=this,c=this.options,d=this.element.height(),e=c.scrollTop+d+c.overscanHeight,f=this.cache[this.renderedIndex]&&this.cache[this.renderedIndex].index+c.blockSize||0,g=this.renderedIndex+1,h=function(){return b.container.element.height()};(a=h())<e&&f<c.items.length;){var i=c.items.slice(f,f+c.blockSize);this.container.addItems(i);var j=h()-a;this.cache[g]={index:f,scrollTop:a,height:j},this.renderedIndex=g,g++,f+=c.blockSize}},_calculateBlocksToRender:function(){this.options;this._renderMoreIf()},_populate:function(a){var b=this.options;a&&this.options.items!==a&&(this.options.items=a),this._calculateBlocksToRender(),this.element.scrollTop(b.scrollTop)},restore:function(){this.renderedIndex=-1,this.container.empty(),this.cache={}},populate:function(a){a&&this.options.items!==a&&this.restore(),this._populate(a)},destroyed:function(){this.restore()}}),BI.shortcut("bi.list_view",BI.ListView),BI.VirtualList=BI.inherit(BI.Widget,{props:function(){return{baseCls:"bi-virtual-list",overscanHeight:100,blockSize:10,scrollTop:0,items:[]}},init:function(){this.renderedIndex=-1,this.cache={}},render:function(){var a=this;this.options;return{type:"bi.vertical",items:[{type:"bi.layout",ref:function(){a.topBlank=this}},{type:"bi.vertical",scrolly:!1,ref:function(){a.container=this}},{type:"bi.layout",ref:function(){a.bottomBlank=this}}],element:this}},mounted:function(){var a=this,b=this.options;this._populate(),this.element.scroll(function(c){b.scrollTop=a.element.scrollTop(),a._calculateBlocksToRender()}),BI.ResizeDetector.addResizeListener(this,function(){a._calculateBlocksToRender()})},_renderMoreIf:function(){for(var a,b=this,c=this.options,d=this.element.height(),e=c.scrollTop+d+c.overscanHeight,f=this.cache[this.renderedIndex]&&this.cache[this.renderedIndex].index+c.blockSize||0,g=this.renderedIndex+1,h=function(){return b.container.element.height()+b.topBlank.element.height()+b.bottomBlank.element.height()};(a=h())<e&&f<c.items.length;){var i=c.items.slice(f,f+c.blockSize);this.container.addItems(i);var j=h()-a;this.cache[g]={index:f,scrollTop:a,height:j},this.tree.set(g,j),this.renderedIndex=g,g++,f+=c.blockSize}},_calculateBlocksToRender:function(){var a=this.options;this._renderMoreIf();
for(var b=this.element.height(),c=a.scrollTop-a.overscanHeight,d=a.scrollTop+b+a.overscanHeight,e=this.tree.greatestLowerBound(c),f=this.tree.leastUpperBound(d),g=[],h=0;h<e;h++){var i=this.cache[h].index;if(!this.cache[h].destroyed){for(var j=i;j<i+a.blockSize&&j<a.items.length;j++)g.push(this.container._children[j]),this.container._children[j]=null;this.cache[h].destroyed=!0}}for(var h=f+1;h<=this.renderedIndex;h++){var i=this.cache[h].index;if(!this.cache[h].destroyed){for(var j=i;j<i+a.blockSize&&j<a.items.length;j++)g.push(this.container._children[j]),this.container._children[j]=null;this.cache[h].destroyed=!0}}for(var k=document.createDocumentFragment(),l=document.createDocumentFragment(),m=k,h=e<0?0:e;h<=f&&h<=this.renderedIndex;h++){var i=this.cache[h].index;if(this.cache[h].destroyed||(m=l),this.cache[h].destroyed===!0){for(var j=i;j<i+a.blockSize&&j<a.items.length;j++){var n=this.container._addElement(j,BI.extend({root:!0},BI.stripEL(a.items[j])));m.appendChild(n.element[0])}this.cache[h].destroyed=!1}}this.container.element.prepend(k),this.container.element.append(l),this.topBlank.setHeight(this.cache[e<0?0:e].scrollTop);var o=this.cache[Math.min(f,this.renderedIndex)];this.bottomBlank.setHeight(this.tree.sumTo(this.renderedIndex)-o.scrollTop-o.height),BI.each(g,function(a,b){b&&b._destroy()})},_populate:function(a){var b=this.options;a&&this.options.items!==a&&(this.options.items=a),this.tree=BI.PrefixIntervalTree.empty(Math.ceil(b.items.length/b.blockSize)),this._calculateBlocksToRender(),this.element.scrollTop(b.scrollTop)},_clearChildren:function(){BI.each(this.container._children,function(a,b){b&&b.el._destroy()}),this.container._children={},this.container.attr("items",[])},restore:function(){this.renderedIndex=-1,this._clearChildren(),this.cache={},this.options.scrollTop=0},populate:function(a){a&&this.options.items!==a&&this.restore(),this._populate()},destroyed:function(){this.restore()}}),BI.shortcut("bi.virtual_list",BI.VirtualList),BI.Pager=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Pager.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-pager",behaviors:{},layouts:[{type:"bi.horizontal",hgap:10,vgap:0}],dynamicShow:!0,dynamicShowFirstLast:!1,dynamicShowPrevNext:!1,pages:!1,curr:function(){return 1},groups:0,jump:BI.emptyFn,first:!1,last:!1,prev:"上一页",next:"下一页",firstPage:1,lastPage:function(){return 1},hasPrev:BI.emptyFn,hasNext:BI.emptyFn})},_init:function(){BI.Pager.superclass._init.apply(this,arguments);this.currPage=BI.result(this.options,"curr"),this._populate()},_populate:function(){var a=this,b=this.options,c=[],d={};this.empty();var e=BI.result(b,"pages"),f=BI.result(this,"currPage"),g=BI.result(b,"groups"),h=BI.result(b,"first"),i=BI.result(b,"last"),j=BI.result(b,"prev"),k=BI.result(b,"next");e===!1?(g=0,h=!1,i=!1):g>e&&(g=e),d.index=Math.ceil((f+(g>1&&g!==e?1:0))/(0===g?1:g)),(!b.dynamicShow&&!b.dynamicShowPrevNext||f>1)&&j!==!1&&(BI.isKey(j)?c.push({text:j,value:"prev",disabled:e===!1?b.hasPrev(f)===!1:!(f>1&&j!==!1)}):c.push(BI.extend({disabled:e===!1?b.hasPrev(f)===!1:!(f>1&&j!==!1)},j))),(!b.dynamicShow&&!b.dynamicShowFirstLast||d.index>1&&0!==g)&&h&&(c.push({text:h,value:"first",disabled:!(d.index>1&&0!==g)}),d.index>1&&0!==g&&c.push({type:"bi.label",cls:"page-ellipsis",text:"…"})),d.poor=Math.floor((g-1)/2),d.start=d.index>1?f-d.poor:1,d.end=d.index>1?function(){var a=f+(g-d.poor-1);return a>e?e:a}():g,d.end-d.start<g-1&&(d.start=d.end-g+1);var l=d.start,m=d.end;for(h&&i&&d.index>1&&0!==g&&e>g&&d.end<e&&0!==g&&(l++,m--);l<=m;l++)l===f?c.push({text:l,value:l,selected:!0}):c.push({text:l,value:l});(!b.dynamicShow&&!b.dynamicShowFirstLast||e>g&&d.end<e&&0!==g)&&i&&(e>g&&d.end<e&&0!==g&&c.push({type:"bi.label",cls:"page-ellipsis",text:"…"}),c.push({text:i,value:"last",disabled:!(e>g&&d.end<e&&0!==g)})),d.flow=!j&&0===g,(!b.dynamicShow&&!b.dynamicShowPrevNext&&k||f!==e&&k||d.flow)&&c.push(function(){return BI.isKey(k)?e===!1?{text:k,value:"next",disabled:b.hasNext(f)===!1}:d.flow&&f===e?{text:k,value:"next",disabled:!0}:{text:k,value:"next",disabled:!(f!==e&&k||d.flow)}:BI.extend({disabled:e===!1?b.hasNext(f)===!1:!(f!==e&&k||d.flow)},k)}()),this.button_group=BI.createWidget({type:"bi.button_group",element:this,items:BI.createItems(c,{cls:"bi-list-item-select",height:23,hgap:10}),behaviors:b.behaviors,layouts:b.layouts}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(c,d,f){if(c===BI.Events.CLICK){var g=a.button_group.getValue()[0];switch(g){case"first":a.currPage=1;break;case"last":a.currPage=e;break;case"prev":a.currPage--;break;case"next":a.currPage++;break;default:a.currPage=g}b.jump.apply(a,[{pages:e,curr:a.currPage}]),a._populate(),a.fireEvent(BI.Pager.EVENT_CHANGE,f)}a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.fireEvent(BI.Pager.EVENT_AFTER_POPULATE)},getCurrentPage:function(){return this.currPage},setAllPages:function(a){this.options.pages=a},hasPrev:function(a){a||(a=1);var b=this.options,c=this.options.pages;return c===!1?b.hasPrev(a):a>1},hasNext:function(a){a||(a=1);var b=this.options,c=this.options.pages;return c===!1?b.hasNext(a):a<c},setValue:function(a){var b=this.options;if(a=0|a,a=a<1?1:a,b.pages===!1){var c=BI.result(b,"lastPage"),d=1;this.currPage=a>c?c:(d=BI.result(b,"firstPage"),a<d?d:a)}else a=a>b.pages?b.pages:a,this.currPage=a;this._populate()},getValue:function(){var a=this.button_group.getValue()[0];switch(a){case"prev":return-1;case"next":return 1;case"first":return BI.MIN;case"last":return BI.MAX;default:return a}},attr:function(a,b){BI.Pager.superclass.attr.apply(this,arguments),"curr"===a&&(this.currPage=BI.result(this.options,"curr"))},populate:function(){this._populate()}}),BI.Pager.EVENT_CHANGE="EVENT_CHANGE",BI.Pager.EVENT_AFTER_POPULATE="EVENT_AFTER_POPULATE",BI.shortcut("bi.pager",BI.Pager),BI.A=BI.inherit(BI.Text,{_defaultConfig:function(){var a=BI.A.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-a display-block",href:"",target:"_blank",el:null,element:"<a/>"})},_init:function(){var a=this.options;BI.A.superclass._init.apply(this,arguments),this.element.attr({href:a.href,target:a.target}),a.el&&BI.createWidget(a.el,{element:this})}}),BI.shortcut("bi.a",BI.A),BI.LoadingBar=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.LoadingBar.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-loading-bar bi-tips",height:30,handler:BI.emptyFn})},_init:function(){BI.LoadingBar.superclass._init.apply(this,arguments);var a=this;this.loaded=BI.createWidget({type:"bi.text_button",cls:"loading-text bi-list-item-simple",text:BI.i18nText("BI-Load_More"),width:120,handler:this.options.handler}),this.loaded.on(BI.Controller.EVENT_CHANGE,function(b){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.loading=BI.createWidget({type:"bi.layout",width:this.options.height,height:this.options.height,cls:"loading-background cursor-default"});var b=BI.createWidget({type:"bi.center_adapt",items:[this.loaded]}),c=BI.createWidget({type:"bi.center_adapt",items:[this.loading]});this.cardLayout=BI.createWidget({type:"bi.card",element:this,items:[{el:b,cardName:"loaded"},{el:c,cardName:"loading"}]}),this.invisible()},_reset:function(){this.visible(),this.loaded.setText(BI.i18nText("BI-Load_More")),this.loaded.enable()},setLoaded:function(){this._reset(),this.cardLayout.showCardByName("loaded")},setEnd:function(){this.setLoaded(),this.loaded.setText(BI.i18nText("BI-No_More_Data")),this.loaded.disable()},setLoading:function(){this._reset(),this.cardLayout.showCardByName("loading")}}),BI.shortcut("bi.loading_bar",BI.LoadingBar),BI.IconButton=BI.inherit(BI.BasicButton,{_defaultConfig:function(){var a=BI.IconButton.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-icon-button horizon-center",iconWidth:null,iconHeight:null})},_init:function(){BI.IconButton.superclass._init.apply(this,arguments);var a=this.options;this.element.css({textAlign:"center"}),this.icon=BI.createWidget({type:"bi.icon",width:a.iconWidth,height:a.iconHeight}),BI.isNumber(a.height)&&a.height>0&&BI.isNull(a.iconWidth)&&BI.isNull(a.iconHeight)?(this.element.css("lineHeight",a.height+"px"),BI.createWidget({type:"bi.default",element:this,items:[this.icon]})):BI.createWidget({element:this,type:"bi.center_adapt",items:[this.icon]})},doClick:function(){BI.IconButton.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.IconButton.EVENT_CHANGE,this)}}),BI.IconButton.EVENT_CHANGE="IconButton.EVENT_CHANGE",BI.shortcut("bi.icon_button",BI.IconButton),BI.ImageButton=BI.inherit(BI.BasicButton,{_defaultConfig:function(){var a=BI.ImageButton.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-image-button",src:"",iconWidth:"100%",iconHeight:"100%"})},_init:function(){BI.ImageButton.superclass._init.apply(this,arguments);var a=this.options;this.image=BI.createWidget({type:"bi.img",width:a.iconWidth,height:a.iconHeight,src:a.src}),BI.isNumber(a.iconWidth)||BI.isNumber(a.iconHeight)?BI.createWidget({type:"bi.center_adapt",element:this,items:[this.image]}):BI.createWidget({type:"bi.adaptive",element:this,items:[this.image],scrollable:!1})},setWidth:function(a){BI.ImageButton.superclass.setWidth.apply(this,arguments),this.options.width=a},setHeight:function(a){BI.ImageButton.superclass.setHeight.apply(this,arguments),this.options.height=a},setImageWidth:function(a){this.image.setWidth(a)},setImageHeight:function(a){this.image.setHeight(a)},getImageWidth:function(){return this.image.element.width()},getImageHeight:function(){return this.image.element.height()},setSrc:function(a){this.options.src=a,this.image.setSrc(a)},getSrc:function(){return this.image.getSrc()},doClick:function(){BI.ImageButton.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.ImageButton.EVENT_CHANGE,this)}}),BI.ImageButton.EVENT_CHANGE="ImageButton.EVENT_CHANGE",BI.shortcut("bi.image_button",BI.ImageButton),function(a){BI.Button=BI.inherit(BI.BasicButton,{_defaultConfig:function(a){var b=BI.Button.superclass._defaultConfig.apply(this,arguments);return BI.extend(b,{baseCls:(b.baseCls||"")+" bi-button",minWidth:a.block===!0||a.clear===!0?0:90,shadow:a.clear!==!0,isShadowShowingOnSelected:!0,readonly:!0,iconClass:"",level:"common",block:!1,clear:!1,textAlign:"center",whiteSpace:"nowrap",forceCenter:!1,textWidth:null,textHeight:null,hgap:a.clear?0:10,vgap:0,tgap:0,bgap:0,lgap:0,rgap:0})},_init:function(){BI.Button.superclass._init.apply(this,arguments);var a=this.options;!BI.isNumber(a.height)||a.clear||a.block?this.element.css({lineHeight:a.height+"px"}):this.element.css({height:a.height+"px",lineHeight:a.height+"px"}),BI.isKey(a.iconClass)?(this.icon=BI.createWidget({type:"bi.icon",width:18}),this.text=BI.createWidget({type:"bi.label",text:a.text,value:a.value}),BI.createWidget({type:"bi.horizontal_auto",cls:"button-"+a.level+" "+a.iconClass,element:this,hgap:a.hgap,vgap:a.vgap,tgap:a.tgap,bgap:a.bgap,lgap:a.lgap,rgap:a.rgap,items:[{type:"bi.horizontal",items:[this.icon,this.text]}]})):this.text=BI.createWidget({type:"bi.label",cls:"button-"+a.level,textAlign:a.textAlign,whiteSpace:a.whiteSpace,forceCenter:a.forceCenter,textWidth:a.textWidth,textHeight:a.textHeight,hgap:a.hgap,vgap:a.vgap,tgap:a.tgap,bgap:a.bgap,lgap:a.lgap,rgap:a.rgap,element:this,text:a.text,value:a.value}),a.block===!0&&this.element.addClass("block"),a.clear===!0&&this.element.addClass("clear"),a.minWidth>0&&this.element.css({"min-width":a.minWidth+"px"})},doClick:function(){BI.Button.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.Button.EVENT_CHANGE,this)},setText:function(a){BI.Button.superclass.setText.apply(this,arguments),this.text.setText(a)},setValue:function(a){BI.Button.superclass.setValue.apply(this,arguments),this.isReadOnly()||this.text.setValue(a)},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},destroy:function(){BI.Button.superclass.destroy.apply(this,arguments)}}),BI.shortcut("bi.button",BI.Button),BI.Button.EVENT_CHANGE="EVENT_CHANGE"}(jQuery),BI.TextButton=BI.inherit(BI.BasicButton,{_defaultConfig:function(){var a=BI.TextButton.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-text-button",textAlign:"center",whiteSpace:"nowrap",forceCenter:!1,textWidth:null,textHeight:null,hgap:0,lgap:0,rgap:0,text:"",py:""})},_init:function(){BI.TextButton.superclass._init.apply(this,arguments);var a=this.options;this.text=BI.createWidget({type:"bi.label",element:this,textAlign:a.textAlign,whiteSpace:a.whiteSpace,textWidth:a.textWidth,textHeight:a.textHeight,forceCenter:a.forceCenter,width:a.width,height:a.height,hgap:a.hgap,lgap:a.lgap,rgap:a.rgap,text:a.text,value:a.value,py:a.py})},doClick:function(){BI.TextButton.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.TextButton.EVENT_CHANGE,this.getValue(),this)},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},setText:function(a){BI.TextButton.superclass.setText.apply(this,arguments),a=BI.isArray(a)?a.join(","):a,this.text.setText(a)},setStyle:function(a){this.text.setStyle(a)},setValue:function(a){BI.TextButton.superclass.setValue.apply(this,arguments),this.isReadOnly()||(a=BI.isArray(a)?a.join(","):a,this.text.setValue(a))}}),BI.TextButton.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.text_button",BI.TextButton),BI.BlankIconIconTextItem=BI.inherit(BI.BasicButton,{_const:{commonWidth:25},_defaultConfig:function(){var a=BI.BlankIconIconTextItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-blank-icon-text-item",logic:{dynamic:!1},iconCls1:"close-ha-font",iconCls2:"close-ha-font",blankWidth:0,iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.BlankIconIconTextItem.superclass._init.apply(this,arguments);var a=this.options,b=this._const,c=BI.createWidget({type:"bi.layout",width:a.blankWidth,height:a.height});this.text=BI.createWidget({type:"bi.label",cls:"list-item-text",textAlign:"left",hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,height:a.height}),this.icon1=BI.createWidget({type:"bi.icon_button",cls:a.iconCls1,forceNotSelected:!0,width:b.commonWidth,height:a.height}),this.icon2=BI.createWidget({type:"bi.icon_button",cls:a.iconCls2,forceNotSelected:!0,width:b.commonWidth,height:a.height}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("horizontal",BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",c,this.icon1,this.icon2,this.text)}))))},doClick:function(){BI.BlankIconIconTextItem.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.BlankIconIconTextItem.EVENT_CHANGE,this.getValue(),this)},setSelected:function(a){BI.BlankIconIconTextItem.superclass.setSelected.apply(this,arguments),this.icon1.setSelected(a),this.icon2.setSelected(a)},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)}}),BI.BlankIconIconTextItem.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.blank_icon_icon_text_item",BI.BlankIconIconTextItem),BI.BlankIconTextIconItem=BI.inherit(BI.BasicButton,{_const:{commonWidth:25},_defaultConfig:function(){var a=BI.BlankIconTextIconItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-blank-icon-text-icon-item",logic:{dynamic:!1},iconCls1:"close-ha-font",iconCls2:"close-ha-font",blankWidth:0,iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.BlankIconTextIconItem.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",textAlign:"left",hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,height:a.height});var c=BI.createWidget({type:"bi.center_adapt",cls:a.iconCls1,width:b.commonWidth,height:a.height,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]});BI.createWidget({type:"bi.absolute",element:this,items:[{el:{type:"bi.center_adapt",cls:a.iconCls2,width:b.commonWidth,height:a.height,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]},top:0,bottom:0,right:0}]}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("horizontal",BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",{type:"bi.layout",width:a.blankWidth},c,this.text,{type:"bi.layout",width:b.commonWidth})}))))},doClick:function(){BI.BlankIconTextIconItem.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.BlankIconTextIconItem.EVENT_CHANGE,this.getValue(),this)},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()}}),BI.BlankIconTextIconItem.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.blank_icon_text_icon_item",BI.BlankIconTextIconItem),BI.BlankIconTextItem=BI.inherit(BI.BasicButton,{_const:{commonWidth:25},_defaultConfig:function(){var a=BI.BlankIconTextItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-blank-icon-text-item",logic:{dynamic:!1},cls:"close-ha-font",blankWidth:0,iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.BlankIconTextItem.superclass._init.apply(this,arguments);var a=this.options,b=this._const,c=BI.createWidget({type:"bi.layout",width:a.blankWidth});this.text=BI.createWidget({type:"bi.label",cls:"list-item-text",textAlign:"left",hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,height:a.height}),this.icon=BI.createWidget({type:"bi.center_adapt",width:b.commonWidth,height:a.height,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("horizontal",BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",c,this.icon,this.text)}))))},doClick:function(){BI.BlankIconTextItem.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.BlankIconTextItem.EVENT_CHANGE,this.getValue(),this)},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)}}),BI.BlankIconTextItem.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.blank_icon_text_item",BI.BlankIconTextItem),BI.IconTextIconItem=BI.inherit(BI.BasicButton,{_const:{commonWidth:25},_defaultConfig:function(){var a=BI.IconTextIconItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-icon-text-icon-item",logic:{dynamic:!1},iconCls1:"close-ha-font",iconCls2:"close-ha-font",iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.IconTextIconItem.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",textAlign:"left",hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,height:a.height});var c=BI.createWidget({type:"bi.center_adapt",cls:a.iconCls1,width:b.commonWidth,height:a.height,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]}),d=BI.createWidget({type:"bi.layout",width:b.commonWidth});BI.createWidget({type:"bi.absolute",element:this,items:[{el:{type:"bi.center_adapt",cls:a.iconCls2,width:b.commonWidth,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]},top:0,bottom:0,right:0}]}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("horizontal",BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",c,this.text,d)}))))},doClick:function(){BI.IconTextIconItem.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.IconTextIconItem.EVENT_CHANGE,this.getValue(),this)},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()}}),BI.IconTextIconItem.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.icon_text_icon_item",BI.IconTextIconItem),BI.IconTextItem=BI.inherit(BI.BasicButton,{_const:{commonWidth:25},_defaultConfig:function(){var a=BI.IconTextItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-icon-text-item",direction:BI.Direction.Left,logic:{dynamic:!1},iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.IconTextItem.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",cls:"list-item-text",textAlign:"left",hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,height:a.height}),this.icon=BI.createWidget({type:"bi.center_adapt",width:b.commonWidth,height:a.height,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(a.direction),BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection(a.direction,this.icon,this.text)}))))},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()},doClick:function(){BI.IconTextItem.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.IconTextItem.EVENT_CHANGE,this.getValue(),this)},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)}}),BI.IconTextItem.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.icon_text_item",BI.IconTextItem),BI.TextIconItem=BI.inherit(BI.BasicButton,{_const:{commonWidth:25},_defaultConfig:function(){var a=BI.TextIconItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-text-icon-item",logic:{dynamic:!1},cls:"close-ha-font",iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.TextIconItem.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",cls:"list-item-text",textAlign:"left",hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,height:a.height}),this.icon=BI.createWidget({type:"bi.center_adapt",width:b.commonWidth,height:a.height,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("horizontal",BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",this.text,this.icon)}))))},doClick:function(){BI.TextIconItem.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.TextIconItem.EVENT_CHANGE,this.getValue(),this)},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)}}),BI.TextIconItem.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.text_icon_item",BI.TextIconItem),BI.TextItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){var a=BI.TextItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-text-item",textAlign:"left",whiteSpace:"nowrap",textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.TextItem.superclass._init.apply(this,arguments);var a=this.options;this.text=BI.createWidget({type:"bi.label",element:this,textAlign:a.textAlign,whiteSpace:a.whiteSpace,textHeight:"nowrap"==a.whiteSpace?a.height:a.textHeight,height:a.height,hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,py:a.py})},doClick:function(){BI.TextItem.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.TextItem.EVENT_CHANGE,this.getValue(),this)},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()}}),BI.TextItem.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.text_item",BI.TextItem),BI.IconTextIconNode=BI.inherit(BI.NodeButton,{_const:{commonWidth:25},_defaultConfig:function(){var a=BI.IconTextIconNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-icon-text-icon-node",logic:{dynamic:!1},iconCls1:"close-ha-font",iconCls2:"close-ha-font",iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.IconTextIconNode.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",textAlign:"left",hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,height:a.height});var c=BI.createWidget({type:"bi.center_adapt",cls:a.iconCls1,width:b.commonWidth,height:a.height,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]}),d=BI.createWidget({type:"bi.layout",width:b.commonWidth,height:a.height});BI.createWidget({type:"bi.absolute",element:this,items:[{el:{type:"bi.center_adapt",cls:a.iconCls2,width:b.commonWidth,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]},top:0,bottom:0,right:0}]}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("horizontal",BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",c,this.text,d)}))))},doClick:function(){BI.IconTextIconNode.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.IconTextIconNode.EVENT_CHANGE,this.getValue(),this)},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()}}),BI.IconTextIconNode.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.icon_text_icon_node",BI.IconTextIconNode),BI.IconTextNode=BI.inherit(BI.NodeButton,{_const:{commonWidth:25},_defaultConfig:function(){var a=BI.IconTextNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-icon-text-node",logic:{dynamic:!1},cls:"close-ha-font",iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.IconTextNode.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",cls:"list-item-text",textAlign:"left",hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,height:a.height}),this.icon=BI.createWidget({type:"bi.center_adapt",width:b.commonWidth,height:a.height,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("horizontal",BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",this.icon,this.text)}))))},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()},doClick:function(){BI.IconTextNode.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.IconTextNode.EVENT_CHANGE,this.getValue(),this)},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)}}),BI.IconTextNode.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.icon_text_node",BI.IconTextNode),BI.TextIconNode=BI.inherit(BI.NodeButton,{_const:{commonWidth:25},_defaultConfig:function(){var a=BI.TextIconNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-text-icon-node",logic:{dynamic:!1},cls:"close-ha-font",iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.TextIconNode.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",cls:"list-item-text",textAlign:"left",hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,height:a.height}),this.icon=BI.createWidget({type:"bi.center_adapt",width:b.commonWidth,height:a.height,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("horizontal",BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",this.text,this.icon)}))))},
doClick:function(){BI.TextIconNode.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.TextIconNode.EVENT_CHANGE,this.getValue(),this)},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)}}),BI.TextIconNode.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.text_icon_node",BI.TextIconNode),BI.TextNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.TextNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-text-node",textAlign:"left",whiteSpace:"nowrap",textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.TextNode.superclass._init.apply(this,arguments);var a=this.options;this.text=BI.createWidget({type:"bi.label",element:this,textAlign:a.textAlign,whiteSpace:a.whiteSpace,textHeight:"nowrap"==a.whiteSpace?a.height:a.textHeight,height:a.height,hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,py:a.py})},doClick:function(){BI.TextNode.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.TextNode.EVENT_CHANGE,this.getValue(),this)},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()}}),BI.TextNode.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.text_node",BI.TextNode),BI.CodeEditor=BI.inherit(BI.Single,{_defaultConfig:function(){return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(),{baseCls:"bi-code-editor",value:"",watermark:"",lineHeight:2,readOnly:!1,paramFormatter:function(a){return a}})},_init:function(){BI.CodeEditor.superclass._init.apply(this,arguments);var a=this.options,b=this;this.editor=CodeMirror(this.element[0],{textWrapping:!0,lineWrapping:!0,lineNumbers:!1,readOnly:a.readOnly,specialChars:/[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/}),1===a.lineHeight?this.element.addClass("codemirror-low-line-height"):this.element.addClass("codemirror-high-line-height"),this.editor.on("change",function(a,c){BI.nextTick(function(){b.fireEvent(BI.CodeEditor.EVENT_CHANGE)})}),this.editor.on("focus",function(){b.watermark.setVisible(!1),b.fireEvent(BI.CodeEditor.EVENT_FOCUS)}),this.editor.on("blur",function(){b.watermark.setVisible(BI.isEmptyString(b.getValue())),b.fireEvent(BI.CodeEditor.EVENT_BLUR)}),this.watermark=BI.createWidget({type:"bi.label",text:a.watermark,cls:"bi-water-mark",whiteSpace:"nowrap",textAlign:"left"}),this.watermark.element.bind("mousedown",function(a){b.insertString(""),b.editor.focus(),a.stopEvent()}),this.watermark.element.bind("click",function(a){b.editor.focus(),a.stopEvent()}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.watermark,top:0,left:5}]}),BI.isKey(a.value)&&BI.nextTick(function(){b.setValue(a.value)})},_setEnable:function(a){BI.CodeEditor.superclass._setEnable.apply(this,arguments),this.editor.setOption("readOnly",a!==!0&&"nocursor")},_checkWaterMark:function(){var a=this.options;BI.isEmptyString(this.editor.getValue())&&BI.isKey(a.watermark)?this.watermark&&this.watermark.visible():this.watermark&&this.watermark.invisible()},insertParam:function(a){var b=a;a=this.options.paramFormatter(a);var c=this.editor.getCursor();this.editor.replaceSelection(""+a+"");var d=this.editor.getCursor(),e={className:"param",atomic:!0};BI.isNotNull(a.match(/^<!.*!>$/))&&(e.className="error-param"),e.value=b,this.editor.markText(c,d,e),this.editor.replaceSelection(" "),this.editor.focus()},insertString:function(a){this.editor.replaceSelection(a),this.editor.focus()},getValue:function(){return this.editor.getValue("\n",function(a){var b=a.text,c=a.text,d=0;return c.text=b,_.forEach(_.sortBy(a.markedSpans,"from"),function(a,b){switch(a.marker.className){case"param":case"error-param":var e=a.to-a.from;c=c.substr(0,a.from+d)+"${"+a.marker.value+"}"+c.substr(a.to+d,c.length),d+=3,d+=a.marker.value.length-e}}),c})},_analyzeContent:function(a){var b=/\$[\{][^\}]*[\}]|[^\$\{]*[^\$\{]/g;return a.match(b)},setValue:function(a){var b,c=this;this.refresh(),c.editor.setValue(""),b=this._analyzeContent(a||""),BI.each(b,function(a,b){var d=/\$[\{][^\}]*[\}]/,e=b.match(d);BI.isNotEmptyArray(e)?c.insertParam(e[0].substring(2,b.length-1)):c.insertString(b)}),this._checkWaterMark()},focus:function(){this.editor.focus()},blur:function(){this.editor.getInputField().blur()},setStyle:function(a){this.style=a,this.element.css(a)},getStyle:function(){return this.style},refresh:function(){var a=this;BI.nextTick(function(){a.editor.refresh()})}}),BI.CodeEditor.EVENT_CHANGE="EVENT_CHANGE",BI.CodeEditor.EVENT_BLUR="EVENT_BLUR",BI.CodeEditor.EVENT_FOCUS="EVENT_FOCUS",BI.shortcut("bi.code_editor",BI.CodeEditor),BI.Editor=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.Editor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:"bi-editor",hgap:4,vgap:2,lgap:0,rgap:0,tgap:0,bgap:0,tipType:"warning",inputType:"text",validationChecker:BI.emptyFn,quitChecker:BI.emptyFn,allowBlank:!1,watermark:"",errorText:""})},_init:function(){BI.Editor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=this.addWidget(BI.createWidget({type:"bi.input",element:"<input type='"+b.inputType+"'/>",root:!0,watermark:b.watermark,validationChecker:b.validationChecker,quitChecker:b.quitChecker,allowBlank:b.allowBlank})),this.editor.element.css({width:"100%",height:"100%",border:"none",outline:"none",padding:"0",margin:"0"}),BI.isKey(this.options.watermark)&&(this.watermark=BI.createWidget({type:"bi.label",cls:"bi-water-mark",text:this.options.watermark,forceCenter:!0,height:b.height-2*(b.vgap+b.tgap),whiteSpace:"nowrap",textAlign:"left"}),this.watermark.element.bind({mousedown:function(b){a.isEnabled()?a.editor.isEditing()||a.editor.focus():a.editor.isEditing()&&a.editor.blur(),b.stopEvent()}}),this.watermark.element.bind("click",function(b){a.isEnabled()?a.editor.isEditing()||a.editor.focus():a.editor.isEditing()&&a.editor.blur(),b.stopEvent()}),this.watermark.element.css({position:"absolute",left:"3px",right:"3px",top:"0px",bottom:"0px"}));var c=[{el:{type:"bi.default",items:this.watermark?[this.editor,this.watermark]:[this.editor]},left:b.hgap+b.lgap,right:b.hgap+b.rgap,top:b.vgap+b.tgap,bottom:b.vgap+b.bgap}];BI.createWidget({type:"bi.absolute",element:this,items:c}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.Input.EVENT_FOCUS,function(){a._checkError(),a.element.addClass("bi-editor-focus"),a.fireEvent(BI.Editor.EVENT_FOCUS,arguments)}),this.editor.on(BI.Input.EVENT_BLUR,function(){a.setErrorVisible(!1),a.element.removeClass("bi-editor-focus"),a.fireEvent(BI.Editor.EVENT_BLUR,arguments)}),this.editor.on(BI.Input.EVENT_CLICK,function(){a.fireEvent(BI.Editor.EVENT_CLICK,arguments)}),this.editor.on(BI.Input.EVENT_CHANGE,function(){a.fireEvent(BI.Editor.EVENT_CHANGE,arguments)}),this.editor.on(BI.Input.EVENT_KEY_DOWN,function(b){a.fireEvent(BI.Editor.EVENT_KEY_DOWN,arguments)}),this.editor.on(BI.Input.EVENT_QUICK_DOWN,function(b){a.watermark&&a.watermark.invisible()}),this.editor.on(BI.Input.EVENT_VALID,function(){a._checkWaterMark(),a.setErrorVisible(!1),a.fireEvent(BI.Editor.EVENT_VALID,arguments)}),this.editor.on(BI.Input.EVENT_ERROR,function(){a._checkWaterMark(),a.fireEvent(BI.Editor.EVENT_ERROR,arguments),a.setErrorVisible(a.isEditing())}),this.editor.on(BI.Input.EVENT_RESTRICT,function(){a._checkWaterMark();var b=a.setErrorVisible(!0);b&&b.element.fadeOut(100,function(){b.element.fadeIn(100)}),a.fireEvent(BI.Editor.EVENT_RESTRICT,arguments)}),this.editor.on(BI.Input.EVENT_EMPTY,function(){a._checkWaterMark(),a.fireEvent(BI.Editor.EVENT_EMPTY,arguments)}),this.editor.on(BI.Input.EVENT_ENTER,function(){a.fireEvent(BI.Editor.EVENT_ENTER,arguments)}),this.editor.on(BI.Input.EVENT_SPACE,function(){a.fireEvent(BI.Editor.EVENT_SPACE,arguments)}),this.editor.on(BI.Input.EVENT_BACKSPACE,function(){a.fireEvent(BI.Editor.EVENT_BACKSPACE,arguments)}),this.editor.on(BI.Input.EVENT_REMOVE,function(){a.fireEvent(BI.Editor.EVENT_REMOVE,arguments)}),this.editor.on(BI.Input.EVENT_START,function(){a.fireEvent(BI.Editor.EVENT_START,arguments)}),this.editor.on(BI.Input.EVENT_PAUSE,function(){a.fireEvent(BI.Editor.EVENT_PAUSE,arguments)}),this.editor.on(BI.Input.EVENT_STOP,function(){a.fireEvent(BI.Editor.EVENT_STOP,arguments)}),this.editor.on(BI.Input.EVENT_CONFIRM,function(){a.fireEvent(BI.Editor.EVENT_CONFIRM,arguments)}),this.element.click(function(a){return a.stopPropagation(),!1}),BI.isKey(this.options.value)||BI.isEmptyString(this.options.value)?this.setValue(this.options.value):this._checkWaterMark()},_checkToolTip:function(){var a=this.options,b=a.errorText;BI.isFunction(b)&&(b=b(this.editor.getValue())),BI.isKey(b)&&(!this.isEnabled()||this.isValid()||BI.Bubbles.has(this.getName())&&BI.Bubbles.get(this.getName()).isVisible()?this.setTitle(""):this.setTitle(b))},_checkError:function(){this.setErrorVisible(this.isEnabled()&&!this.isValid()),this._checkToolTip()},_checkWaterMark:function(){var a=this.options;!this.disabledWaterMark&&""===this.editor.getValue()&&BI.isKey(a.watermark)?this.watermark&&this.watermark.visible():this.watermark&&this.watermark.invisible()},setErrorText:function(a){this.options.errorText=a},getErrorText:function(){return this.options.errorText},setErrorVisible:function(a){var b=this.options,c=b.errorText;if(BI.isFunction(c)&&(c=c(this.editor.getValue())),!this.disabledError&&BI.isKey(c))return BI.Bubbles[a?"show":"hide"](this.getName(),c,this),this._checkToolTip(),BI.Bubbles.get(this.getName())},disableError:function(){this.disabledError=!0,this._checkError()},enableError:function(){this.disabledError=!1,this._checkError()},disableWaterMark:function(){this.disabledWaterMark=!0,this._checkWaterMark()},enableWaterMark:function(){this.disabledWaterMark=!1,this._checkWaterMark()},focus:function(){this.element.addClass("text-editor-focus"),this.editor.focus()},blur:function(){this.element.removeClass("text-editor-focus"),this.editor.blur()},selectAll:function(){this.editor.selectAll()},onKeyDown:function(a){this.editor.onKeyDown(a)},setValue:function(a){BI.Editor.superclass.setValue.apply(this,arguments),this.editor.setValue(a),this._checkError(),this._checkWaterMark()},getLastValidValue:function(){return this.editor.getLastValidValue()},resetLastValidValue:function(){this.editor.resetLastValidValue()},getValue:function(){return this.isValid()?BI.trim(this.editor.getValue()):BI.trim(this.editor.getLastValidValue())},isEditing:function(){return this.editor.isEditing()},isValid:function(){return this.editor.isValid()}}),BI.Editor.EVENT_CHANGE="EVENT_CHANGE",BI.Editor.EVENT_FOCUS="EVENT_FOCUS",BI.Editor.EVENT_BLUR="EVENT_BLUR",BI.Editor.EVENT_CLICK="EVENT_CLICK",BI.Editor.EVENT_KEY_DOWN="EVENT_KEY_DOWN",BI.Editor.EVENT_SPACE="EVENT_SPACE",BI.Editor.EVENT_BACKSPACE="EVENT_BACKSPACE",BI.Editor.EVENT_START="EVENT_START",BI.Editor.EVENT_PAUSE="EVENT_PAUSE",BI.Editor.EVENT_STOP="EVENT_STOP",BI.Editor.EVENT_CONFIRM="EVENT_CONFIRM",BI.Editor.EVENT_VALID="EVENT_VALID",BI.Editor.EVENT_ERROR="EVENT_ERROR",BI.Editor.EVENT_ENTER="EVENT_ENTER",BI.Editor.EVENT_RESTRICT="EVENT_RESTRICT",BI.Editor.EVENT_REMOVE="EVENT_REMOVE",BI.Editor.EVENT_EMPTY="EVENT_EMPTY",BI.shortcut("bi.editor",BI.Editor),BI.MultifileEditor=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.MultifileEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-multifile-editor",multiple:!1,maxSize:-1,accept:"",url:""})},_init:function(){var a=this,b=this.options;BI.MultifileEditor.superclass._init.apply(this,arguments),this.file=BI.createWidget({type:"bi.file",cls:"multifile-editor",width:"100%",height:"100%",name:b.name,url:b.url,multiple:b.multiple,accept:b.accept,maxSize:b.maxSize}),this.file.on(BI.File.EVENT_CHANGE,function(){a.fireEvent(BI.MultifileEditor.EVENT_CHANGE,arguments)}),this.file.on(BI.File.EVENT_UPLOADSTART,function(){a.fireEvent(BI.MultifileEditor.EVENT_UPLOADSTART,arguments)}),this.file.on(BI.File.EVENT_ERROR,function(){a.fireEvent(BI.MultifileEditor.EVENT_ERROR,arguments)}),this.file.on(BI.File.EVENT_PROGRESS,function(){a.fireEvent(BI.MultifileEditor.EVENT_PROGRESS,arguments)}),this.file.on(BI.File.EVENT_UPLOADED,function(){a.fireEvent(BI.MultifileEditor.EVENT_UPLOADED,arguments)}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:{type:"bi.adaptive",scrollable:!1,items:[this.file]},top:0,right:0,left:0,bottom:0}]})},select:function(){this.file.select()},getValue:function(){return this.file.getValue()},upload:function(){this.file.upload()},reset:function(){this.file.reset()}}),BI.MultifileEditor.EVENT_CHANGE="MultifileEditor.EVENT_CHANGE",BI.MultifileEditor.EVENT_UPLOADSTART="MultifileEditor.EVENT_UPLOADSTART",BI.MultifileEditor.EVENT_ERROR="MultifileEditor.EVENT_ERROR",BI.MultifileEditor.EVENT_PROGRESS="MultifileEditor.EVENT_PROGRESS",BI.MultifileEditor.EVENT_UPLOADED="MultifileEditor.EVENT_UPLOADED",BI.shortcut("bi.multifile_editor",BI.MultifileEditor),BI.TextAreaEditor=BI.inherit(BI.Single,{_defaultConfig:function(){return $.extend(BI.TextAreaEditor.superclass._defaultConfig.apply(),{baseCls:"bi-textarea-editor bi-card",value:""})},_init:function(){BI.TextAreaEditor.superclass._init.apply(this,arguments);var a=this.options,b=this;this.content=BI.createWidget({type:"bi.layout",tagName:"textarea",width:"100%",height:"100%",cls:"bi-textarea textarea-editor-content display-block"}),this.content.element.css({resize:"none"}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:{type:"bi.adaptive",items:[this.content]},left:0,right:3,top:0,bottom:5}]}),this.content.element.on("input propertychange",function(a){b._checkWaterMark(),b.fireEvent(BI.TextAreaEditor.EVENT_CHANGE)}),this.content.element.focus(function(){b.isValid()&&(b._focus(),b.fireEvent(BI.TextAreaEditor.EVENT_FOCUS)),$(document).bind("mousedown."+b.getName(),function(a){BI.DOM.isExist(b)&&!b.element.__isMouseInBounds__(a)&&($(document).unbind("mousedown."+b.getName()),b.content.element.blur())})}),this.content.element.blur(function(){b.isValid()&&(b._blur(),b.fireEvent(BI.TextAreaEditor.EVENT_BLUR)),$(document).unbind("mousedown."+b.getName())}),BI.isKey(a.value)&&b.setValue(a.value),BI.isNotNull(a.style)&&b.setValue(a.style),this._checkWaterMark()},_checkWaterMark:function(){var a=this,b=this.options,c=this.getValue();BI.isNotEmptyString(c)?(this.watermark&&this.watermark.destroy(),this.watermark=null):BI.isNotEmptyString(b.watermark)&&(this.watermark?(this.watermark.setText(b.watermark),this.watermark.setValid(!b.invalid),this.watermark.setEnable(!b.disabled)):(this.watermark=BI.createWidget({type:"bi.text_button",cls:"bi-water-mark",textAlign:"left",height:30,text:b.watermark,invalid:b.invalid,disabled:b.disabled}),this.watermark.on(BI.TextButton.EVENT_CHANGE,function(){a.focus()}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.watermark,left:0,top:0,right:0}]})))},_focus:function(){this.content.element.addClass("textarea-editor-focus"),this._checkWaterMark()},_blur:function(){this.content.element.removeClass("textarea-editor-focus"),this._checkWaterMark()},focus:function(){this._focus(),this.content.element.focus()},blur:function(){this._blur(),this.content.element.blur()},getValue:function(){return this.content.element.val()},setValue:function(a){this.content.element.val(a),this._checkWaterMark()},setStyle:function(a){this.style=a,this.element.css(a),this.content.element.css(BI.extend({},a,{color:a.color||BI.DOM.getContrastColor(BI.DOM.isRGBColor(a.backgroundColor)?BI.DOM.rgb2hex(a.backgroundColor):a.backgroundColor)}))},getStyle:function(){return this.style},_setValid:function(a){BI.TextAreaEditor.superclass._setValid.apply(this,arguments)}}),BI.TextAreaEditor.EVENT_CHANGE="EVENT_CHANGE",BI.TextAreaEditor.EVENT_BLUR="EVENT_BLUR",BI.TextAreaEditor.EVENT_FOCUS="EVENT_FOCUS",BI.shortcut("bi.textarea_editor",BI.TextAreaEditor),BI.Icon=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.Icon.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{tagName:"i",baseCls:(a.baseCls||"")+" x-icon b-font horizon-center display-block"})},_init:function(){BI.Icon.superclass._init.apply(this,arguments),BI.isIE9Below()&&this.element.addClass("hack")}}),BI.shortcut("bi.icon",BI.Icon),BI.Iframe=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.Iframe.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-iframe",src:"",width:"100%",height:"100%"})},_init:function(){var a=this.options;this.options.element=$("<iframe frameborder='0' src='"+a.src+"'>"),BI.Iframe.superclass._init.apply(this,arguments)},setSrc:function(a){this.options.src=a,this.element.attr("src",a)},getSrc:function(){return this.options.src},setName:function(a){this.options.name=a,this.element.attr("name",a)},getName:function(){return this.options.name},getWidth:function(){return this.options.width},getHeight:function(){return this.options.height}}),BI.shortcut("bi.iframe",BI.Iframe),BI.Img=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.Img.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-img display-block",src:"",width:"100%",height:"100%"})},_init:function(){var a=this.options;this.options.element=$("<img src='"+a.src+"'>"),BI.Img.superclass._init.apply(this,arguments)},setSrc:function(a){this.options.src=a,this.element.attr("src",a)},getSrc:function(){return this.options.src}}),BI.shortcut("bi.img",BI.Img),BI.Checkbox=BI.inherit(BI.IconButton,{_defaultConfig:function(){var a=BI.Checkbox.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-checkbox check-box-icon",selected:!1,handler:BI.emptyFn,width:16,height:16,iconWidth:16,iconHeight:16})},_init:function(){BI.Checkbox.superclass._init.apply(this,arguments)},doClick:function(){BI.Checkbox.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.Checkbox.EVENT_CHANGE)}}),BI.Checkbox.EVENT_CHANGE="Checkbox.EVENT_CHANGE",BI.shortcut("bi.checkbox",BI.Checkbox),function(){var F=function(a){return function(b){var c=b.files||[b];return c.item||(c.item=a),c}}(function(a){return this[a]}),event={add:document.addEventListener?function(a,b,c){return a.addEventListener(b,c,!1),this}:function(a,b,c){return a.attachEvent("on"+b,c),this},del:document.removeEventListener?function(a,b,c){return a.removeEventListener(b,c,!1),this}:function(a,b,c){return a.detachEvent("on"+b,c),this},stop:function(a){return a?(a.stopPropagation?a.stopPropagation():a.cancelBubble=!0,a.preventDefault?a.preventDefault():a.returnValue=!1):self.event&&(event.returnValue=!(event.cancelBubble=!0)),!1}},sendFile=function(toString){var multipart=function(a,b,c){return"--".concat(a,CRLF,'Content-Disposition: form-data; name="',b,'"; filename="',BI.cjkEncode(c.fileName),'"',CRLF,"Content-Type: application/octet-stream",CRLF,CRLF,c.getAsBinary(),CRLF,"--",a,"--",CRLF)},isFunction=function(a){return"[object Function]"===toString.call(a)},split="onabort.onerror.onloadstart.onprogress".split("."),length=split.length,CRLF="\r\n",xhr=this.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),sendFile;return sendFile=xhr.upload||xhr.sendAsBinary?function(a,b,c,d){if(-1<b&&b<a.file.fileSize)return void(isFunction(a.onerror)&&a.onerror());for(var e=new XMLHttpRequest,f=e.upload||{addEventListener:function(a,b){this["on"+a]=b}},g=0;g<length;g++)f.addEventListener(split[g].substring(2),function(b){return function(c){isFunction(a[b])&&a[b](c,e)}}(split[g]),!1);if(f.addEventListener("load",function(b){a.onreadystatechange===!1?isFunction(a.onload)&&a.onload(b,e):setTimeout(function(){4===e.readyState?isFunction(a.onload)&&a.onload(b,e):setTimeout(arguments.callee,15)},15)},!1),e.open("post",a.url+"&filename="+window.encodeURIComponent(a.file.fileName),!0),e.upload)e.onreadystatechange=function(){switch(e.readyState){case 4:var b=BI.jsonDecode(e.responseText);a.file.type.indexOf("image")!=-1&&(b.attach_type="image"),b.filename=a.file.fileName,1==a.maxlength?a.attach_array[0]=b:a.attach_array.push(b)}},f.onloadstart();else{var h={loaded:0,total:a.file.fileSize||a.file.size,simulation:!0};h.interval=setInterval(function(){h.loaded+=256,h.total<=h.loaded&&(h.loaded=h.total),f.onprogress(h)},100),e.onabort=function(){f.onabort({})},e.onerror=function(){f.onerror({})},e.onreadystatechange=function(){switch(e.readyState){case 2:case 3:h.total<=h.loaded&&(h.loaded=h.total),f.onprogress(h);break;case 4:if(clearInterval(h.interval),h.interval=0,h.loaded=h.total,f.onprogress(h),199<e.status&&e.status<400){f.onload({});var b=BI.jsonDecode(e.responseText);b.filename=a.file.fileName,a.file.type.indexOf("image")!=-1&&(b.attach_type="image"),a.attach_array.push(b)}else f.onerror({})}},f.onloadstart(h)}var i="AjaxUploadBoundary"+(new Date).getTime();if(e.setRequestHeader("Content-Type","multipart/form-data; boundary="+i),a.file.getAsBinary)e[e.sendAsBinary?"sendAsBinary":"send"](multipart(i,a.name,a.file));else{e.setRequestHeader("Content-Type","multipart/form-data");var j=new FormData;j.append("FileData",a.file),e.send(j)}return a}:function(handler,maxSize,width,height){var url=handler.url.concat(-1===handler.url.indexOf("?")?"?":"&","AjaxUploadFrame=true"),rpe={loaded:1,total:100,simulation:!0,interval:setInterval(function(){rpe.loaded<rpe.total&&++rpe.loaded,isFunction(handler.onprogress)&&handler.onprogress(rpe,{})},100)},onload=function(){iframe.onreadystatechange=iframe.onload=iframe.onerror=null,form.parentNode.removeChild(form),form=null,clearInterval(rpe.interval);try{var a=(iframe.contentWindow.document||iframe.contentWindow.contentDocument).body.innerHTML,b=BI.jsonDecode(a);handler.file.type.indexOf("image")!=-1&&(b.attach_type="image"),b.filename=BI.cjkDecode(handler.file.fileName),1==handler.maxlength?handler.attach_array[0]=b:handler.attach_array.push(b)}catch(c){isFunction(handler.onerror)&&handler.onerror(rpe,event||window.event)}isFunction(handler.onload)&&handler.onload(rpe,{responseText:a})},target=["AjaxUpload",(new Date).getTime(),String(Math.random()).substring(2)].join("_");try{var form=document.createElement('<form enctype="multipart/form-data"></form>'),iframe=handler.iframe||(handler.iframe=document.createElement('<iframe id="'+target+'" name="'+target+'" src="'+url+'"></iframe>'))}catch(e){var form=document.createElement("form"),iframe=handler.iframe||(handler.iframe=document.createElement("iframe"));form.setAttribute("enctype","multipart/form-data"),iframe.setAttribute("name",iframe.id=target),iframe.setAttribute("src",url)}with(iframe.style.position="absolute",iframe.style.left=iframe.style.top="-10000px",iframe.onload=onload,iframe.onerror=function(a){isFunction(handler.onerror)&&handler.onerror(rpe,a||window.event)},iframe.onreadystatechange=function(){/loaded|complete/i.test(iframe.readyState)?onload():isFunction(handler.onloadprogress)&&(rpe.loaded<rpe.total&&++rpe.loaded,handler.onloadprogress(rpe,{readyState:{loading:2,interactive:3,loaded:4,complete:4}[iframe.readyState]||1}))},form.setAttribute("action",handler.url),form.setAttribute("target",iframe.id),form.setAttribute("method","post"),form.appendChild(handler.file),form.style.display="none",isFunction(handler.onloadstart)&&handler.onloadstart(rpe,{}),document.body||document.documentElement)appendChild(iframe),appendChild(form),form.submit();return handler},xhr=null,sendFile}(Object.prototype.toString),sendFiles=function(a,b,c,d){var e=a.files.length,f=a.onload,g=a.onloadstart;for(a.current=0,a.total=0,a.sent=0;a.current<e;)a.total+=a.files[a.current].fileSize||a.files[a.current].size,a.current++;return a.current=0,e&&a.files[0].fileSize!==-1?(a.file=a.files[a.current],sendFile(a,b,c,d).onload=function(h,i){a.onloadstart=null,a.sent+=a.files[a.current].fileSize||a.files[a.current].size,++a.current<e?(a.file=a.files[a.current],sendFile(a,b,c,d).onload=arguments.callee):f&&(a.onloadstart=g,a.onload=f,a.onload(h,i))}):e&&(a.total=100*e,a.file=a.files[a.current],sendFile(a,b,c,d).onload=function(h,i){var j=arguments.callee;a.onloadstart=null,a.sent+=100,++a.current<e?(/\b(chrome|safari)\b/i.test(navigator.userAgent)&&(a.iframe.parentNode.removeChild(a.iframe),a.iframe=null),setTimeout(function(){a.file=a.files[a.current],sendFile(a,b,c,d).onload=j},15)):f&&setTimeout(function(){a.iframe.parentNode.removeChild(a.iframe),a.iframe=null,a.onloadstart=g,a.onload=f,a.onload(h,i)},15)}),a};BI.File=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.File.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-file display-block",element:"<input type='file'>",name:"",url:"",multiple:!0,accept:"",maxSize:-1})},_init:function(){var a=this.options;BI.File.superclass._init.apply(this,arguments),a.multiple===!0&&this.element.attr("multiple","multiple"),this.element.attr("name",a.name||this.getName())},mounted:function(){var a=this,b=this.options,c=this.wrap=this._wrap(this.element[0],b.maxSize);c.onloadstart=function(b,c){a.fireEvent(BI.File.EVENT_UPLOADSTART,arguments)},c.onprogress=function(b,c){this.file.fileSize!==-1&&b.simulation,a.fireEvent(BI.File.EVENT_PROGRESS,{file:this.file,total:b.total,loaded:b.loaded,simulation:b.simulation})},c.onerror=function(){a.fireEvent(BI.File.EVENT_ERROR)},c.onload=function(b,c){var d=this;setTimeout(function(){d.clean(),d.hide(),a.fireEvent(BI.File.EVENT_UPLOADED)},1e3)},c.url=b.url?b.url:BI.servletURL+"?op=fr_attach&cmd=ah_upload",c.fileType=b.accept,c.attach_array=[],c.attach_names=[],c.attachNum=0},_events:function(a){var b=this;return event.add(a.dom.input,"change",function(){event.del(a.dom.input,"change",arguments.callee);for(var c=a.dom.input.cloneNode(!0),d=0,e=F(a.dom.input);d<e.length;d++){var f=e.item(d),g=f.value||f.name,h=f.fileName||(f.fileName=g.split("\\").pop()),i=-1!==h.indexOf(".")?h.split(".").pop().toLowerCase():"unknown",j=f.fileSize||f.size;a.fileType&&-1===a.fileType.indexOf("*."+i)?(BI.Msg.toast(BI.i18nText("BI-Upload_File_Type_Error")),b.fireEvent(BI.File.EVENT_ERROR,{errorType:0,file:f})):a.maxSize!==-1&&j&&a.maxSize<j?(BI.Msg.toast(BI.i18nText("BI-Upload_File_Size_Error")),b.fireEvent(BI.File.EVENT_ERROR,{errorType:1,file:f})):(a.files.unshift(f),b.fireEvent(BI.File.EVENT_CHANGE,{file:f}))}c.value="",a.dom.input.parentNode.replaceChild(c,a.dom.input),a.dom.input=c,event.add(a.dom.input,"change",arguments.callee)}),a},_wrap:function(){var a=this.options,b=this.element[0];return a.multiple===!0&&this.element.attr("multiple","multiple"),b.value="",this._events({dom:{input:b,disabled:!1},name:b.name,maxSize:a.maxSize?a.maxSize>>0:-1,files:[],clean:function(){this.files=[]},upload:function(a){if(a)for(var b in a)this[b]=a[b];return sendFiles(this,this.maxSize),this},hide:function(){this.dom.disabled&&(this.dom.disabled=!1,this.dom.input.removeAttribute("disabled"))},show:function(a,b,c,d){this.dom.disabled||(this.dom.disabled=!0,this.dom.input.setAttribute("disabled","disabled"))}})},select:function(){$(this.wrap.dom.input).click()},upload:function(a){this.wrap.upload(a)},getValue:function(){return this.wrap.attach_array},reset:function(){this.wrap.attach_array=[],this.wrap.attach_names=[],this.wrap.attachNum=0},_setEnable:function(a){BI.File.superclass._setEnable.apply(this,arguments),a===!0?this.element.attr("disabled","disabled"):this.element.removeAttr("disabled")}}),BI.File.EVENT_CHANGE="BI.File.EVENT_CHANGE",BI.File.EVENT_UPLOADSTART="EVENT_UPLOADSTART",BI.File.EVENT_ERROR="EVENT_ERROR",BI.File.EVENT_PROGRESS="EVENT_PROGRESS",BI.File.EVENT_UPLOADED="EVENT_UPLOADED",BI.shortcut("bi.file",BI.File)}(),BI.Input=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.Input.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-input display-block",element:"<input/>",validationChecker:BI.emptyFn,quitChecker:BI.emptyFn,allowBlank:!1})},_init:function(){BI.Input.superclass._init.apply(this,arguments);var a=this,b=!1,c=!1,d=BI.debounce(function(c){a.onKeyDown(c,b),a._keydown_=!1},300),e=BI.debounce(BI.bind(this._click,this),BI.EVENT_RESPONSE_TIME,!0);this._blurDebounce=BI.debounce(BI.bind(this._blur,this),BI.EVENT_RESPONSE_TIME,!0),this.element.keydown(function(d){c=!1,b=d.ctrlKey,a.fireEvent(BI.Input.EVENT_QUICK_DOWN)}).keyup(function(b){c&&b.keyCode===BI.KeyCode.ENTER||(a._keydown_=!0,d(b.keyCode))}).on("input propertychange",function(b){BI.isNotNull(b.keyCode)&&(c=!0,a._keydown_=!0,d(b.keyCode))}).click(function(a){a.stopPropagation(),e()}).mousedown(function(b){a.element.val(a.element.val())}).focusout(function(b){a._blurDebounce()})},_focus:function(){this.element.addClass("bi-input-focus"),this._checkValidationOnValueChange(),this._isEditing=!0,""==this.getValue()&&(this.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.EMPTY,this.getValue(),this),this.fireEvent(BI.Input.EVENT_EMPTY)),this.fireEvent(BI.Input.EVENT_FOCUS)},_blur:function(){function a(){b.isValid()||b.options.quitChecker.apply(b,[BI.trim(b.getValue())])===!1||(b.element.val(b._lastValidValue?b._lastValidValue:""),b._checkValidationOnValueChange(),b._defaultState()),b.element.removeClass("bi-input-focus"),b._isEditing=!1,b._start=!1,b.isValid()&&(b.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.CONFIRM,b.getValue(),b),b.fireEvent(BI.Input.EVENT_CONFIRM)),b.fireEvent(BI.Input.EVENT_BLUR)}var b=this;b._keydown_===!0?BI.delay(a,300):a()},_click:function(){this._isEditing!==!0&&(this._focus(),this.selectAll(),this.fireEvent(BI.Input.EVENT_CLICK))},onClick:function(){this._click()},onKeyDown:function(a,b){this.isValid()&&BI.trim(this._lastValidValue)===BI.trim(this.getValue())||this._checkValidationOnValueChange(),this.isValid()&&""!==BI.trim(this.getValue())&&((BI.trim(this.getValue())===this._lastValue||this._start&&null!=this._lastValue&&""!==this._lastValue)&&(this._pause!==!0||/(\s|\u00A0)$/.test(this.getValue()))||(this._start=!0,this._pause=!1,this.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.STARTEDIT,this.getValue(),this),this.fireEvent(BI.Input.EVENT_START))),b===!0&&86===a?this._valueChange():(a==BI.KeyCode.ENTER&&(this.isValid()||this.options.quitChecker.apply(this,[BI.trim(this.getValue())])!==!1?(this.blur(),this.fireEvent(BI.Input.EVENT_ENTER)):this.fireEvent(BI.Input.EVENT_RESTRICT)),a==BI.KeyCode.SPACE&&this.fireEvent(BI.Input.EVENT_SPACE),a==BI.KeyCode.BACKSPACE&&""==this._lastValue&&this.fireEvent(BI.Input.EVENT_REMOVE),a!=BI.KeyCode.BACKSPACE&&a!=BI.KeyCode.DELETE||this.fireEvent(BI.Input.EVENT_BACKSPACE)),this.fireEvent(BI.Input.EVENT_KEY_DOWN),BI.isEndWithBlank(this.getValue())?(this._pause=!0,this.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.PAUSE,"",this),this.fireEvent(BI.Input.EVENT_PAUSE),this._defaultState()):a!==BI.KeyCode.BACKSPACE&&a!==BI.KeyCode.DELETE||""!==BI.trim(this.getValue())||null===this._lastValue||""===BI.trim(this._lastValue)?this._valueChange():(this.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.STOPEDIT,this.getValue(),this),this.fireEvent(BI.Input.EVENT_STOP),this._valueChange())},_defaultState:function(){""==this.getValue()&&(this.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.EMPTY,this.getValue(),this),this.fireEvent(BI.Input.EVENT_EMPTY)),this._lastValue=this.getValue(),this._lastSubmitValue=null},_valueChange:function(){this.isValid()&&BI.trim(this.getValue())!==this._lastSubmitValue&&(this.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.CHANGE,this.getValue(),this),
this.fireEvent(BI.Input.EVENT_CHANGE),this._lastSubmitValue=BI.trim(this.getValue())),""==this.getValue()&&(this.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.EMPTY,this.getValue(),this),this.fireEvent(BI.Input.EVENT_EMPTY)),this._lastValue=this.getValue()},_checkValidationOnValueChange:function(){var a=this.options,b=this.getValue();this.setValid(a.allowBlank===!0&&""==BI.trim(b)||BI.isNotEmptyString(BI.trim(b))&&(b===this._lastValidValue||a.validationChecker.apply(this,[BI.trim(b)])!==!1))},focus:function(){if(!this.element.is(":visible"))throw new Error("input输入框在不可见下不能focus");!this._isEditing==!0&&(this.element.focus(),this._focus(),this.selectAll())},blur:function(){if(!this.element.is(":visible"))throw new Error("input输入框在不可见下不能blur");this._isEditing===!0&&(this.element.blur(),this._blurDebounce())},selectAll:function(){if(!this.element.is(":visible"))throw new Error("input输入框在不可见下不能select");this.element.select(),this._isEditing=!0},setValue:function(a){this.element.val(a),BI.nextTick(BI.bind(function(){this._checkValidationOnValueChange(),this._defaultState(),this.isValid()&&(this._lastSubmitValue=this.getValue())},this))},getValue:function(){return this.element.val()||""},isEditing:function(){return this._isEditing},getLastValidValue:function(){return this._lastValidValue},_setValid:function(){BI.Input.superclass._setValid.apply(this,arguments),this.isValid()?(this._lastValidValue=this.getValue(),this.element.removeClass("bi-input-error"),this.fireEvent(BI.Input.EVENT_VALID,BI.trim(this.getValue()),this)):(this._lastValidValue===this.getValue()&&(this._lastValidValue=null),this.element.addClass("bi-input-error"),this.fireEvent(BI.Input.EVENT_ERROR,BI.trim(this.getValue()),this))},_setEnable:function(a){BI.Input.superclass._setEnable.apply(this,[a]),this.element[0].disabled=!a}}),BI.Input.EVENT_CHANGE="EVENT_CHANGE",BI.Input.EVENT_FOCUS="EVENT_FOCUS",BI.Input.EVENT_CLICK="EVENT_CLICK",BI.Input.EVENT_BLUR="EVENT_BLUR",BI.Input.EVENT_KEY_DOWN="EVENT_KEY_DOWN",BI.Input.EVENT_QUICK_DOWN="EVENT_QUICK_DOWN",BI.Input.EVENT_SPACE="EVENT_SPACE",BI.Input.EVENT_BACKSPACE="EVENT_BACKSPACE",BI.Input.EVENT_START="EVENT_START",BI.Input.EVENT_PAUSE="EVENT_PAUSE",BI.Input.EVENT_STOP="EVENT_STOP",BI.Input.EVENT_CONFIRM="EVENT_CONFIRM",BI.Input.EVENT_REMOVE="EVENT_REMOVE",BI.Input.EVENT_EMPTY="EVENT_EMPTY",BI.Input.EVENT_VALID="EVENT_VALID",BI.Input.EVENT_ERROR="EVENT_ERROR",BI.Input.EVENT_ENTER="EVENT_ENTER",BI.Input.EVENT_RESTRICT="EVENT_RESTRICT",BI.shortcut("bi.input",BI.Input),BI.Radio=BI.inherit(BI.IconButton,{_defaultConfig:function(){var a=BI.Radio.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-radio radio-icon",selected:!1,handler:BI.emptyFn,width:16,height:16,iconWidth:16,iconHeight:16})},_init:function(){BI.Radio.superclass._init.apply(this,arguments)},doClick:function(){BI.Radio.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.Radio.EVENT_CHANGE)}}),BI.Radio.EVENT_CHANGE="Radio.EVENT_CHANGE",BI.shortcut("bi.radio",BI.Radio),BI.Label=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.Label.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-label",textAlign:"center",whiteSpace:"nowrap",forceCenter:!1,textWidth:null,textHeight:null,hgap:0,vgap:0,lgap:0,rgap:0,tgap:0,bgap:0,text:"",py:"",keyword:""})},_createJson:function(){var a=this.options;return{type:"bi.text",textAlign:a.textAlign,whiteSpace:a.whiteSpace,lineHeight:a.textHeight,text:a.text,value:a.value,py:a.py,keyword:a.keyword}},_init:function(){BI.Label.superclass._init.apply(this,arguments),"center"===this.options.textAlign?this._createCenterEl():this._createNotCenterEl()},_createCenterEl:function(){var a=this.options,b=this._createJson();if(BI.isNumber(a.width)&&a.width>0){if(BI.isNumber(a.textWidth)&&a.textWidth>0){if(BI.isNumber(a.height)&&a.height>0){var c=(a.width-a.textWidth)/2;return BI.createWidget({type:"bi.adaptive",height:a.height,scrollable:"normal"===a.whiteSpace,element:this,items:[{el:this.text=BI.createWidget(b),left:c+a.hgap+a.lgap,right:c+a.hgap+a.rgap,top:a.vgap+a.tgap,bottom:a.vgap+a.bgap}]}),void this.element.css({"line-height":a.height+"px"})}return b.width=a.textWidth,void BI.createWidget({type:"bi.center_adapt",scrollable:"normal"===a.whiteSpace,element:this,items:[{el:this.text=BI.createWidget(b)}]})}return"normal"==a.whiteSpace?(this.text=BI.createWidget(b),void BI.createWidget({type:"bi.center_adapt",scrollable:"normal"===a.whiteSpace,hgap:a.hgap,vgap:a.vgap,lgap:a.lgap,rgap:a.rgap,tgap:a.tgap,bgap:a.bgap,element:this,items:[this.text]})):BI.isNumber(a.height)&&a.height>0?(this.element.css({"line-height":a.height+"px"}),void BI.createWidget({type:"bi.absolute",scrollable:"normal"===a.whiteSpace,element:this,items:[{el:this.text=BI.createWidget(b),left:a.hgap+a.lgap,right:a.hgap+a.rgap,top:a.vgap+a.tgap,bottom:a.vgap+a.bgap}]})):(b.width=a.width-2*a.hgap,void BI.createWidget({type:"bi.center_adapt",scrollable:"normal"===a.whiteSpace,element:this,items:[{el:this.text=BI.createWidget(b)}]}))}return BI.isNumber(a.textWidth)&&a.textWidth>0?(b.width=a.textWidth,void BI.createWidget({type:"bi.center_adapt",scrollable:"normal"===a.whiteSpace,element:this,items:[{el:this.text=BI.createWidget(b)}]})):"normal"==a.whiteSpace?(this.text=BI.createWidget(b),void BI.createWidget({type:"bi.center_adapt",hgap:a.hgap,vgap:a.vgap,lgap:a.lgap,rgap:a.rgap,tgap:a.tgap,bgap:a.bgap,scrollable:"normal"===a.whiteSpace,element:this,items:[this.text]})):BI.isNumber(a.height)&&a.height>0?BI.isNumber(a.textHeight)&&a.textHeight>0?(this.element.css({"line-height":a.height+"px"}),void BI.createWidget({type:"bi.adaptive",height:a.height,scrollable:"normal"===a.whiteSpace,element:this,items:[{el:this.text=BI.createWidget(b),left:a.hgap+a.lgap,right:a.hgap+a.rgap,top:a.vgap+a.tgap,bottom:a.vgap+a.bgap}]})):(BI.extend(b,{hgap:a.hgap,vgap:a.vgap,lgap:a.lgap,rgap:a.rgap,tgap:a.tgap,bgap:a.bgap}),this.element.css({"line-height":a.height+"px"}),this.text=BI.createWidget(BI.extend(b,{element:this})),void BI.createWidget({type:"bi.layout",element:this.text,scrollable:"normal"===a.whiteSpace})):(BI.extend(b,{hgap:a.hgap,vgap:a.vgap,lgap:a.lgap,rgap:a.rgap,tgap:a.tgap,bgap:a.bgap}),a.forceCenter?(this.text=BI.createWidget(b),void BI.createWidget({type:"bi.center_adapt",element:this,items:[this.text]})):(this.text=BI.createWidget(BI.extend(b,{element:this})),void BI.createWidget({type:"bi.layout",element:this.text,scrollable:"normal"===a.whiteSpace})))},_createNotCenterEl:function(){var a=this.options,b=this._createJson();return BI.isNumber(a.width)&&a.width>0?BI.isNumber(a.textWidth)&&a.textWidth>0?BI.isNumber(a.height)&&a.height>0?(BI.createWidget({type:"bi.adaptive",height:a.height,scrollable:"normal"===a.whiteSpace,element:this,items:[{el:this.text=BI.createWidget(b),left:a.hgap+a.lgap,right:a.hgap+a.rgap,top:a.vgap+a.tgap,bottom:a.vgap+a.bgap}]}),void this.element.css({"line-height":a.height+"px"})):(b.width=a.textWidth,void BI.createWidget({type:"bi.vertical_adapt",scrollable:"normal"===a.whiteSpace,hgap:a.hgap,vgap:a.vgap,lgap:a.lgap,rgap:a.rgap,tgap:a.tgap,bgap:a.bgap,element:this,items:[{el:this.text=BI.createWidget(b)}]})):"normal"==a.whiteSpace?(this.text=BI.createWidget(b),void BI.createWidget({type:"bi.vertical_adapt",scrollable:"normal"===a.whiteSpace,hgap:a.hgap,vgap:a.vgap,lgap:a.lgap,rgap:a.rgap,tgap:a.tgap,bgap:a.bgap,element:this,items:[this.text]})):BI.isNumber(a.height)&&a.height>0?(this.element.css({"line-height":a.height+"px"}),void BI.createWidget({type:"bi.absolute",scrollable:"normal"===a.whiteSpace,element:this,items:[{el:this.text=BI.createWidget(b),left:a.hgap+a.lgap,right:a.hgap+a.rgap,top:a.vgap+a.tgap,bottom:a.vgap+a.bgap}]})):(b.width=a.width-2*a.hgap-a.lgap-a.rgap,void BI.createWidget({type:"bi.vertical_adapt",scrollable:"normal"===a.whiteSpace,hgap:a.hgap,vgap:a.vgap,lgap:a.lgap,rgap:a.rgap,tgap:a.tgap,bgap:a.bgap,element:this,items:[{el:this.text=BI.createWidget(b)}]})):BI.isNumber(a.textWidth)&&a.textWidth>0?(b.width=a.textWidth,void BI.createWidget({type:"bi.vertical_adapt",scrollable:"normal"===a.whiteSpace,hgap:a.hgap,vgap:a.vgap,lgap:a.lgap,rgap:a.rgap,tgap:a.tgap,bgap:a.bgap,element:this,items:[{el:this.text=BI.createWidget(b)}]})):"normal"==a.whiteSpace?(this.text=BI.createWidget(b),void BI.createWidget({type:"bi.vertical_adapt",scrollable:"normal"===a.whiteSpace,hgap:a.hgap,vgap:a.vgap,lgap:a.lgap,rgap:a.rgap,tgap:a.tgap,bgap:a.bgap,element:this,items:[this.text]})):BI.isNumber(a.height)&&a.height>0?BI.isNumber(a.textHeight)&&a.textHeight>0?(this.element.css({"line-height":a.height+"px"}),void BI.createWidget({type:"bi.adaptive",height:a.height,scrollable:"normal"===a.whiteSpace,element:this,items:[{el:this.text=BI.createWidget(b),left:a.hgap+a.lgap,right:a.hgap+a.rgap,top:a.vgap+a.tgap,bottom:a.vgap+a.bgap}]})):(BI.extend(b,{hgap:a.hgap,vgap:a.vgap,lgap:a.lgap,rgap:a.rgap,tgap:a.tgap,bgap:a.bgap}),this.element.css({"line-height":a.height+"px"}),this.text=BI.createWidget(BI.extend(b,{element:this})),void BI.createWidget({type:"bi.layout",element:this.text,scrollable:"normal"===a.whiteSpace})):(BI.extend(b,{hgap:a.hgap,vgap:a.vgap,lgap:a.lgap,rgap:a.rgap,tgap:a.tgap,bgap:a.bgap}),a.forceCenter?(this.text=BI.createWidget(b),void BI.createWidget({type:"bi.vertical_adapt",element:this,items:[this.text]})):(this.text=BI.createWidget(BI.extend(b,{element:this})),void BI.createWidget({type:"bi.layout",element:this.text,scrollable:"normal"===a.whiteSpace})))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},setText:function(a){this.options.text=a,this.text.setText(a)},getText:function(){return this.options.text},setStyle:function(a){this.text.setStyle(a)},setValue:function(a){BI.Label.superclass.setValue.apply(this,arguments),this.isReadOnly()||this.text.setValue(a)},populate:function(){BI.Label.superclass.populate.apply(this,arguments)}}),BI.shortcut("bi.label",BI.Label),BI.Link=BI.inherit(BI.Label,{_defaultConfig:function(){var a=BI.Link.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-link",href:"",target:"_blank"})},_createJson:function(){var a=this.options;return{type:"bi.a",textAlign:a.textAlign,whiteSpace:a.whiteSpace,lineHeight:a.textHeight,text:a.text,keyword:a.keyword,value:a.value,py:a.py,href:a.href,target:a.target}},_init:function(){BI.Link.superclass._init.apply(this,arguments)}}),BI.shortcut("bi.link",BI.Link),BI.Bubble=BI.inherit(BI.Tip,{_defaultConfig:function(){return BI.extend(BI.Bubble.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-bubble",direction:"top",text:"",height:35})},_init:function(){BI.Bubble.superclass._init.apply(this,arguments);var a=function(a){return a.stopPropagation(),a.stopEvent(),!1};this.element.bind({click:a,mousedown:a,mouseup:a,mouseover:a,mouseenter:a,mouseleave:a,mousemove:a}),BI.createWidget({type:"bi.left",element:this,items:[this["_"+this.options.direction]()]})},_createBubbleText:function(){return this.text=BI.createWidget({type:"bi.label",cls:"bubble-text",text:this.options.text,hgap:10,height:30})},_top:function(){return BI.createWidget({type:"bi.vertical",items:[{el:this._createBubbleText(),height:30},{el:{type:"bi.layout"},height:3}]})},_bottom:function(){return BI.createWidget({type:"bi.vertical",items:[{el:{type:"bi.layout"},height:3},{el:this._createBubbleText(),height:30}]})},_left:function(){return BI.createWidget({type:"bi.right",items:[{el:{type:"bi.layout",width:3,height:30}},{el:this._createBubbleText()}]})},_right:function(){return BI.createWidget({type:"bi.left",items:[{el:{type:"bi.layout",width:3,height:30}},{el:this._createBubbleText()}]})},setText:function(a){this.text.setText(a)}}),BI.shortcut("bi.bubble",BI.Bubble),BI.Toast=BI.inherit(BI.Tip,{_const:{minWidth:200,hgap:20},_defaultConfig:function(){return BI.extend(BI.Toast.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-toast",text:"",level:"success",height:30})},_init:function(){BI.Toast.superclass._init.apply(this,arguments);var a=this.options;this.element.css({minWidth:this._const.minWidth+"px"}),this.element.addClass("toast-"+a.level);var b=function(a){return a.stopPropagation(),a.stopEvent(),!1};this.element.bind({click:b,mousedown:b,mouseup:b,mouseover:b,mouseenter:b,mouseleave:b,mousemove:b}),this.text=BI.createWidget({type:"bi.label",element:this,text:a.text,height:30,hgap:this._const.hgap})},setWidth:function(a){this.element.width(a)},setText:function(a){this.text.setText(a)}}),BI.shortcut("bi.toast",BI.Toast),BI.Tooltip=BI.inherit(BI.Tip,{_const:{hgap:10},_defaultConfig:function(){return BI.extend(BI.Tooltip.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-tooltip",text:"",level:"success",stopEvent:!1,stopPropagation:!1,height:20})},_init:function(){BI.Tooltip.superclass._init.apply(this,arguments);var a=this.options;this.element.addClass("tooltip-"+a.level);var b=function(b){a.stopPropagation&&b.stopPropagation(),a.stopEvent&&b.stopEvent()};this.element.bind({click:b,mousedown:b,mouseup:b,mouseover:b,mouseenter:b,mouseleave:b,mousemove:b});var c=(a.text+"").split("\n");c.length>1?BI.createWidget({type:"bi.vertical",element:this,hgap:this._const.hgap,items:BI.map(c,function(a,b){return{type:"bi.label",textAlign:"left",whiteSpace:"normal",text:b,textHeight:16}})}):this.text=BI.createWidget({type:"bi.label",element:this,textAlign:"left",whiteSpace:"normal",text:a.text,textHeight:20,hgap:this._const.hgap})},setWidth:function(a){this.element.width(a-2*this._const.hgap)},setText:function(a){this.text&&this.text.setText(a)},setLevel:function(a){this.element.removeClass("tooltip-success").removeClass("tooltip-warning"),this.element.addClass("tooltip-"+a)}}),BI.shortcut("bi.tooltip",BI.Tooltip),BI.Trigger=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.Trigger.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-trigger cursor-pointer",height:24})},_init:function(){BI.Trigger.superclass._init.apply(this,arguments)},setKey:function(){},getKey:function(){}}),function(a){a(CodeMirror)}(function(a){function b(a){return"[object Array]"==Object.prototype.toString.call(a)}function c(b){var c=b.doc.modeOption;return"sql"===c&&(c="text/x-sql"),a.resolveMode(c).keywords}function d(b){var c=b.doc.modeOption;return"sql"===c&&(c="text/x-sql"),a.resolveMode(c).identifierQuote||"`"}function e(a){return"string"==typeof a?a:a.text}function f(a,c){return b(c)&&(c={columns:c}),c.text||(c.text=a),c}function g(a){var c={};if(b(a))for(var d=a.length-1;d>=0;d--){var g=a[d];c[e(g).toUpperCase()]=f(e(g),g)}else if(a)for(var h in a)c[h.toUpperCase()]=f(h,a[h]);return c}function h(a){return q[a.toUpperCase()]}function i(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function j(a,b){if(BI.isNotEmptyString(a)&&b.length!==a.length){var c=a.length,d=e(b).substr(0,c);return a.toUpperCase()===d.toUpperCase()}}function k(a,c,d,e){if(b(d))for(var f=0;f<d.length;f++)j(c,d[f])&&a.push(e(d[f],f));else for(var g in d)if(d.hasOwnProperty(g)){var h=d[g];h=h&&h!==!0?h.displayText?{text:h.text,displayText:h.displayText}:h.text:g,j(c,h)&&a.push(e(h))}}function l(a){"."==a.charAt(0)&&(a=a.substr(1));for(var b=a.split(t+t),c=0;c<b.length;c++)b[c]=b[c].replace(new RegExp(t,"g"),"");return b.join(t)}function m(a){for(var b=e(a).split("."),c=0;c<b.length;c++)b[c]=t+b[c].replace(new RegExp(t,"g"),t+t)+t;var d=b.join(".");return"string"==typeof a?d:(a=i(a),a.text=d,a)}function n(a,b,c,d){for(var e=!1,f=[],g=b.start,j=!0;j;)j="."==b.string.charAt(0),e=e||b.string.charAt(0)==t,g=b.start,f.unshift(l(b.string)),b=d.getTokenAt(v(a.line,b.start)),"."==b.string&&(j=!0,b=d.getTokenAt(v(a.line,b.start)));var n=f.join(".");k(c,n,q,function(a){return e?m(a):a}),k(c,n,r,function(a){return e?m(a):a}),n=f.pop();var o=f.join("."),s=!1,u=o;if(!h(o)){var w=o;o=p(o,d),o!==w&&(s=!0)}var x=h(o);return x&&x.columns&&(x=x.columns),x&&k(c,n,x,function(a){var b=o;return 1==s&&(b=u),"string"==typeof a?a=b+"."+a:(a=i(a),a.text=b+"."+a.text),e?m(a):a}),g}function o(a,b){for(var c=a.split(/\s+/),d=0;d<c.length;d++)c[d]&&b(c[d].replace(/[,;]/g,""))}function p(a,b){for(var c=b.doc,d=c.getValue(),e=a.toUpperCase(),f="",g="",i=[],j={start:v(0,0),end:v(b.lastLine(),b.getLineHandle(b.lastLine()).length)},k=d.indexOf(u.QUERY_DIV);k!=-1;)i.push(c.posFromIndex(k)),k=d.indexOf(u.QUERY_DIV,k+1);i.unshift(v(0,0)),i.push(v(b.lastLine(),b.getLineHandle(b.lastLine()).text.length));for(var l=null,m=b.getCursor(),n=0;n<i.length;n++){if((null==l||w(m,l)>0)&&w(m,i[n])<=0){j={start:l,end:i[n]};break}l=i[n]}for(var p=c.getRange(j.start,j.end,!1),n=0;n<p.length;n++){var q=p[n];if(o(q,function(a){var b=a.toUpperCase();b===e&&h(f)&&(g=f),b!==u.ALIAS_KEYWORD&&(f=a)}),g)break}return g}var q,r,s,t,u={QUERY_DIV:";",ALIAS_KEYWORD:"AS"},v=a.Pos,w=a.cmpPos;a.registerHelper("hint","sql",function(a,b){q=g(b&&b.tables);var e=b&&b.defaultTable,f=b&&b.disableKeywords;r=e&&h(e),s=c(a);var i=BI.size(s),j=[],l={},m=a.getCursor(),o=a.getTokenAt(m);BI.each(BI.FormulaCollections,function(a,b){0!=b.lastIndexOf(o.string,0)||BI.contains(j,b)||j.push(b)}),BI.each(BI.FormulaJson,function(a,b){l[b.name.toLowerCase()]=b.def}),s=BI.concat(BI.keys(s),j),t=d(a),e&&!r&&(r=p(e,a)),r=r||[],r.columns&&(r=r.columns);var u,w,x,y=[];return o.end>m.ch&&(o.end=m.ch,o.string=o.string.slice(0,m.ch-o.start)),o.string.match(/^[.`"\w@]\w*$/)?(x=o.string,u=o.start,w=o.end):(u=w=m.ch,x=""),"."==x.charAt(0)||x.charAt(0)==t?u=n(m,o,y,a):(k(y,x,q,function(a){return a}),k(y,x,r,function(a){return a}),f||k(y,x,s,function(a,b){var c=b<i;return{isKeyword:c,text:a}})),{list:y,from:v(m.line,u),to:v(m.line,w)}})}),function(a){a(CodeMirror)}(function(a){"use strict";a.defineMode("sql",function(b,c){function d(a,b){var c=a.next();if(o[c]){var d=o[c](a,b);if(d!==!1)return d}if(n.hexNumber&&("0"==c&&a.match(/^[xX][0-9a-fA-F]+/)||("x"==c||"X"==c)&&a.match(/^'[0-9a-fA-F]+'/)))return"number";if(n.binaryNumber&&(("b"==c||"B"==c)&&a.match(/^'[01]+'/)||"0"==c&&a.match(/^b[01]+/)))return"number";if(c.charCodeAt(0)>47&&c.charCodeAt(0)<58)return a.match(/^[0-9]*(\.[0-9]+)?([eE][-+]?[0-9]+)?/),n.decimallessFloat&&a.match(/^\.(?!\.)/),"number";if("?"==c&&(a.eatSpace()||a.eol()||a.eat(";")))return"variable-3";if("'"==c||'"'==c&&n.doubleQuote)return b.tokenize=e(c),b.tokenize(a,b);if((n.nCharCast&&("n"==c||"N"==c)||n.charsetCast&&"_"==c&&a.match(/[a-z][a-z0-9]*/i))&&("'"==a.peek()||'"'==a.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(c))return null;if(n.commentSlashSlash&&"/"==c&&a.eat("/"))return a.skipToEnd(),"comment";if(n.commentHash&&"#"==c||"-"==c&&a.eat("-")&&(!n.commentSpaceRequired||a.eat(" ")))return a.skipToEnd(),"comment";if("/"==c&&a.eat("*"))return b.tokenize=f(1),b.tokenize(a,b);if("."!=c){if(m.test(c))return a.eatWhile(m),null;if("{"==c&&(a.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||a.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";a.eatWhile(/^[_\w\d]/);var g=a.current().toLowerCase();return p.hasOwnProperty(g)&&(a.match(/^( )+'[^']*'/)||a.match(/^( )+"[^"]*"/))?"number":j.hasOwnProperty(g)?"atom":k.hasOwnProperty(g)?"builtin":q.hasOwnProperty(g)&&"("===a.peek()?"function":l.hasOwnProperty(g)?"keyword":i.hasOwnProperty(g)?"string-2":null}return n.zerolessFloat&&a.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":a.match(/^\.+/)?null:n.ODBCdotTable&&a.match(/^[\w\d_]+/)?"variable-2":void 0}function e(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){c.tokenize=d;break}f=!f&&"\\"==e}return"string"}}function f(a){return function(b,c){var e=b.match(/^.*?(\/\*|\*\/)/);return e?"/*"==e[1]?c.tokenize=f(a+1):a>1?c.tokenize=f(a-1):c.tokenize=d:b.skipToEnd(),"comment"}}function g(a,b,c){b.context={prev:b.context,indent:a.indentation(),col:a.column(),type:c}}function h(a){a.indent=a.context.indent,a.context=a.context.prev}var i=c.client||{},j=c.atoms||{"false":!0,"true":!0,"null":!0},k=c.builtin||{},l=c.keywords||{},m=c.operatorChars||/^[*+\-%<>!=&|~^]/,n=c.support||{},o=c.hooks||{},p=c.dateSQL||{date:!0,time:!0,timestamp:!0},q=c.functions||{};return{startState:function(){return{tokenize:d,context:null}},token:function(a,b){if(a.sol()&&b.context&&null==b.context.align&&(b.context.align=!1),b.tokenize==d&&a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"==c)return c;b.context&&null==b.context.align&&(b.context.align=!0);var e=a.current();return"("==e?g(a,b,")"):"["==e?g(a,b,"]"):b.context&&b.context.type==e&&h(b),c},indent:function(c,d){var e=c.context;if(!e)return a.Pass;var f=d.charAt(0)==e.type;return e.align?e.col+(f?0:1):e.indent+(f?0:b.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:n.commentSlashSlash?"//":n.commentHash?"#":"--"}}),function(){function b(a){for(var b={},c=a.split(" "),d=0;d<c.length;++d)b[c[d]]=!0;return b}var c="alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit ";a.defineMIME("text/x-sql",{name:"sql",keywords:b(c+"begin"),builtin:b("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),atoms:b("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:b("date time timestamp"),support:b("ODBCdotTable doubleQuote binaryNumber hexNumber"),functions:BI.makeObject(BI.FormulaCollections,!0)})}()}),BI.SQLEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(),{baseCls:"bi-sql-editor",value:"",lineHeight:2,showHint:!0})},_init:function(){BI.CodeEditor.superclass._init.apply(this,arguments);var a=this.options,b=this;this.editor=CodeMirror(this.element[0],{mode:"text/x-sql",textWrapping:!0,lineWrapping:!0,lineNumbers:!1}),1===a.lineHeight?this.element.addClass("codemirror-low-line-height"):this.element.addClass("codemirror-high-line-height"),this.editor.on("change",function(c,d){b._checkWaterMark(),a.showHint&&CodeMirror.showHint(c,CodeMirror.sqlHint,{completeSingle:!1}),BI.nextTick(function(){b.fireEvent(BI.FormulaEditor.EVENT_CHANGE)})}),this.editor.on("focus",function(){b._checkWaterMark(),b.fireEvent(BI.FormulaEditor.EVENT_FOCUS)}),this.editor.on("blur",function(){b.fireEvent(BI.FormulaEditor.EVENT_BLUR)}),this.watermark=BI.createWidget({type:"bi.label",text:BI.i18nText("Please_Enter_SQL"),cls:"bi-water-mark",whiteSpace:"nowrap",textAlign:"left"}),this.watermark.element.bind("mousedown",function(a){b.insertString(""),b.editor.focus(),a.stopEvent()}),this.watermark.element.bind("click",function(a){b.editor.focus(),a.stopEvent()}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.watermark,top:0,left:5}]}),BI.isKey(a.value)&&BI.nextTick(function(){b.setValue(a.value)})},insertString:function(a){this.editor.replaceSelection(a),this.editor.focus()},_checkWaterMark:function(){var a=this.options;!this.disabledWaterMark&&BI.isEmptyString(this.editor.getValue())&&BI.isKey(a.watermark)?this.watermark&&this.watermark.visible():this.watermark&&this.watermark.invisible()},getValue:function(){return this.editor.getValue()},setValue:function(a){this.editor.setValue(a)}}),BI.shortcut("bi.sql_editor",BI.SQLEditor),function(a,b){"function"==typeof define&&define.amd?define("eve",function(){return b()}):"object"==typeof exports?module.exports=b():a.eve=b()}(this,function(){var a,b,c="0.4.2",d="hasOwnProperty",e=/[\.\/]/,f="*",g=function(){},h=function(a,b){return a-b},i={n:{}},j=function(c,d){c=String(c);var e,f=b,g=Array.prototype.slice.call(arguments,2),i=j.listeners(c),k=0,l=[],m={},n=[],o=a;a=c,b=0;for(var p=0,q=i.length;p<q;p++)"zIndex"in i[p]&&(l.push(i[p].zIndex),i[p].zIndex<0&&(m[i[p].zIndex]=i[p]));for(l.sort(h);l[k]<0;)if(e=m[l[k++]],n.push(e.apply(d,g)),b)return b=f,n;for(p=0;p<q;p++)if(e=i[p],"zIndex"in e)if(e.zIndex==l[k]){if(n.push(e.apply(d,g)),b)break;do if(k++,e=m[l[k]],e&&n.push(e.apply(d,g)),b)break;while(e)}else m[e.zIndex]=e;else if(n.push(e.apply(d,g)),b)break;return b=f,a=o,n.length?n:null};return j._events=i,j.listeners=function(a){var b,c,d,g,h,j,k,l,m=a.split(e),n=i,o=[n],p=[];for(g=0,h=m.length;g<h;g++){for(l=[],j=0,k=o.length;j<k;j++)for(n=o[j].n,c=[n[m[g]],n[f]],d=2;d--;)b=c[d],b&&(l.push(b),p=p.concat(b.f||[]));o=l}return p},j.on=function(a,b){if(a=String(a),"function"!=typeof b)return function(){};for(var c=a.split(e),d=i,f=0,h=c.length;f<h;f++)d=d.n,d=d.hasOwnProperty(c[f])&&d[c[f]]||(d[c[f]]={n:{}});for(d.f=d.f||[],f=0,h=d.f.length;f<h;f++)if(d.f[f]==b)return g;return d.f.push(b),function(a){+a==+a&&(b.zIndex=+a)}},j.f=function(a){var b=[].slice.call(arguments,1);return function(){j.apply(null,[a,null].concat(b).concat([].slice.call(arguments,0)))}},j.stop=function(){b=1},j.nt=function(b){return b?new RegExp("(?:\\.|\\/|^)"+b+"(?:\\.|\\/|$)").test(a):a},j.nts=function(){return a.split(e)},j.off=j.unbind=function(a,b){if(!a)return void(j._events=i={n:{}});var c,g,h,k,l,m,n,o=a.split(e),p=[i];for(k=0,l=o.length;k<l;k++)for(m=0;m<p.length;m+=h.length-2){if(h=[m,1],c=p[m].n,o[k]!=f)c[o[k]]&&h.push(c[o[k]]);else for(g in c)c[d](g)&&h.push(c[g]);p.splice.apply(p,h)}for(k=0,l=p.length;k<l;k++)for(c=p[k];c.n;){if(b){if(c.f){for(m=0,n=c.f.length;m<n;m++)if(c.f[m]==b){c.f.splice(m,1);break}!c.f.length&&delete c.f}for(g in c.n)if(c.n[d](g)&&c.n[g].f){var q=c.n[g].f;for(m=0,n=q.length;m<n;m++)if(q[m]==b){q.splice(m,1);break}!q.length&&delete c.n[g].f}}else{delete c.f;for(g in c.n)c.n[d](g)&&c.n[g].f&&delete c.n[g].f}c=c.n}},j.once=function(a,b){var c=function(){return j.unbind(a,c),b.apply(this,arguments)};return j.on(a,c)},j.version=c,j.toString=function(){return"You are running Eve "+c},j}),function(a,b){"function"==typeof define&&define.amd?define("raphael.core",["eve"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("eve")):a.Raphael=b(a.eve)}(this,function(a){function b(c){if(b.is(c,"function"))return t?c():a.on("raphael.DOMload",c);if(b.is(c,U))return b._engine.create[C](b,c.splice(0,3+b.is(c[0],S))).add(c);var d=Array.prototype.slice.call(arguments,0);if(b.is(d[d.length-1],"function")){var e=d.pop();return t?e.call(b._engine.create[C](b,d)):a.on("raphael.DOMload",function(){e.call(b._engine.create[C](b,d))})}return b._engine.create[C](b,arguments)}function c(a){if("function"==typeof a||Object(a)!==a)return a;var b=new a.constructor;for(var d in a)a[y](d)&&(b[d]=c(a[d]));return b}function d(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function e(a,b,c){function e(){var f=Array.prototype.slice.call(arguments,0),g=f.join("␀"),h=e.cache=e.cache||{},i=e.count=e.count||[];return h[y](g)?(d(i,g),c?c(h[g]):h[g]):(i.length>=1e3&&delete h[i.shift()],i.push(g),h[g]=a[C](b,f),c?c(h[g]):h[g])}return e}function f(){return this.hex}function g(a,b){for(var c=[],d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function h(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function i(a,b,c,d,e,f,g,i,j){null==j&&(j=1),j=j>1?1:j<0?0:j;for(var k=j/2,l=12,m=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],n=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],o=0,p=0;p<l;p++){var q=k*m[p]+k,r=h(q,a,c,e,g),s=h(q,b,d,f,i),t=r*r+s*s;o+=n[p]*M.sqrt(t)}return k*o}function j(a,b,c,d,e,f,g,h,j){if(!(j<0||i(a,b,c,d,e,f,g,h)<j)){var k,l=1,m=l/2,n=l-m,o=.01;for(k=i(a,b,c,d,e,f,g,h,n);P(k-j)>o;)m/=2,n+=(k<j?1:-1)*m,k=i(a,b,c,d,e,f,g,h,n);return n}}function k(a,b,c,d,e,f,g,h){if(!(N(a,c)<O(e,g)||O(a,c)>N(e,g)||N(b,d)<O(f,h)||O(b,d)>N(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(k){var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(!(n<+O(a,c).toFixed(2)||n>+N(a,c).toFixed(2)||n<+O(e,g).toFixed(2)||n>+N(e,g).toFixed(2)||o<+O(b,d).toFixed(2)||o>+N(b,d).toFixed(2)||o<+O(f,h).toFixed(2)||o>+N(f,h).toFixed(2)))return{x:l,y:m}}}}function l(a,c,d){var e=b.bezierBBox(a),f=b.bezierBBox(c);if(!b.isBBoxIntersect(e,f))return d?0:[];for(var g=i.apply(0,a),h=i.apply(0,c),j=N(~~(g/5),1),l=N(~~(h/5),1),m=[],n=[],o={},p=d?0:[],q=0;q<j+1;q++){var r=b.findDotsAtSegment.apply(b,a.concat(q/j));m.push({x:r.x,y:r.y,t:q/j})}for(q=0;q<l+1;q++)r=b.findDotsAtSegment.apply(b,c.concat(q/l)),n.push({x:r.x,y:r.y,t:q/l});for(q=0;q<j;q++)for(var s=0;s<l;s++){var t=m[q],u=m[q+1],v=n[s],w=n[s+1],x=P(u.x-t.x)<.001?"y":"x",y=P(w.x-v.x)<.001?"y":"x",z=k(t.x,t.y,u.x,u.y,v.x,v.y,w.x,w.y);if(z){if(o[z.x.toFixed(4)]==z.y.toFixed(4))continue;o[z.x.toFixed(4)]=z.y.toFixed(4);var A=t.t+P((z[x]-t[x])/(u[x]-t[x]))*(u.t-t.t),B=v.t+P((z[y]-v[y])/(w[y]-v[y]))*(w.t-v.t);A>=0&&A<=1.001&&B>=0&&B<=1.001&&(d?p++:p.push({x:z.x,y:z.y,t1:O(A,1),t2:O(B,1)}))}}return p}function m(a,c,d){a=b._path2curve(a),c=b._path2curve(c);for(var e,f,g,h,i,j,k,m,n,o,p=d?0:[],q=0,r=a.length;q<r;q++){var s=a[q];if("M"==s[0])e=i=s[1],f=j=s[2];else{"C"==s[0]?(n=[e,f].concat(s.slice(1)),e=n[6],f=n[7]):(n=[e,f,e,f,i,j,i,j],e=i,f=j);for(var t=0,u=c.length;t<u;t++){var v=c[t];if("M"==v[0])g=k=v[1],h=m=v[2];else{"C"==v[0]?(o=[g,h].concat(v.slice(1)),g=o[6],h=o[7]):(o=[g,h,g,h,k,m,k,m],g=k,h=m);var w=l(n,o,d);if(d)p+=w;else{for(var x=0,y=w.length;x<y;x++)w[x].segment1=q,w[x].segment2=t,w[x].bez1=n,w[x].bez2=o;p=p.concat(w)}}}}}return p}function n(a,b,c,d,e,f){null!=a?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function o(){return this.x+G+this.y+G+this.width+" × "+this.height}function p(a,b,c,d,e,f){function g(a){return((l*a+k)*a+j)*a}function h(a,b){var c=i(a,b);return((o*c+n)*c+m)*c}function i(a,b){var c,d,e,f,h,i;for(e=a,i=0;i<8;i++){if(f=g(e)-a,P(f)<b)return e;if(h=(3*l*e+2*k)*e+j,P(h)<1e-6)break;e-=f/h}if(c=0,d=1,e=a,e<c)return c;if(e>d)return d;for(;c<d;){if(f=g(e),P(f-a)<b)return e;a>f?c=e:d=e,e=(d-c)/2+c}return e}var j=3*b,k=3*(d-b)-j,l=1-j-k,m=3*c,n=3*(e-c)-m,o=1-m-n;return h(a,1/(200*f))}function q(a,b){var c=[],d={};if(this.ms=b,this.times=1,a){for(var e in a)a[y](e)&&(d[$(e)]=a[e],c.push($(e)));c.sort(ka)}this.anim=d,this.top=c[c.length-1],this.percents=c}function r(c,d,e,f,g,h){e=$(e);var i,j,k,l,m,o,q=c.ms,r={},s={},t={};if(f)for(w=0,x=fb.length;w<x;w++){var u=fb[w];if(u.el.id==d.id&&u.anim==c){u.percent!=e?(fb.splice(w,1),k=1):j=u,d.attr(u.totalOrigin);break}}else f=+s;for(var w=0,x=c.percents.length;w<x;w++){if(c.percents[w]==e||c.percents[w]>f*c.top){e=c.percents[w],m=c.percents[w-1]||0,q=q/c.top*(e-m),l=c.percents[w+1],i=c.anim[e];break}f&&d.attr(c.anim[c.percents[w]])}if(i){if(j)j.initstatus=f,j.start=new Date-j.ms*f;else{for(var z in i)if(i[y](z)&&(ca[y](z)||d.paper.customAttributes[y](z)))switch(r[z]=d.attr(z),null==r[z]&&(r[z]=ba[z]),s[z]=i[z],ca[z]){case S:t[z]=(s[z]-r[z])/q;break;case"colour":r[z]=b.getRGB(r[z]);var A=b.getRGB(s[z]);t[z]={r:(A.r-r[z].r)/q,g:(A.g-r[z].g)/q,b:(A.b-r[z].b)/q};break;case"path":var B=Ia(r[z],s[z]),C=B[1];for(r[z]=B[0],t[z]=[],w=0,x=r[z].length;w<x;w++){t[z][w]=[0];for(var E=1,F=r[z][w].length;E<F;E++)t[z][w][E]=(C[w][E]-r[z][w][E])/q}break;case"transform":var G=d._,J=Na(G[z],s[z]);if(J)for(r[z]=J.from,s[z]=J.to,t[z]=[],t[z].real=!0,w=0,x=r[z].length;w<x;w++)for(t[z][w]=[r[z][w][0]],E=1,F=r[z][w].length;E<F;E++)t[z][w][E]=(s[z][w][E]-r[z][w][E])/q;else{
var K=d.matrix||new n,L={_:{transform:G.transform},getBBox:function(){return d.getBBox(1)}};r[z]=[K.a,K.b,K.c,K.d,K.e,K.f],La(L,s[z]),s[z]=L._.transform,t[z]=[(L.matrix.a-K.a)/q,(L.matrix.b-K.b)/q,(L.matrix.c-K.c)/q,(L.matrix.d-K.d)/q,(L.matrix.e-K.e)/q,(L.matrix.f-K.f)/q]}break;case"csv":var M=H(i[z])[I](v),N=H(r[z])[I](v);if("clip-rect"==z)for(r[z]=N,t[z]=[],w=N.length;w--;)t[z][w]=(M[w]-r[z][w])/q;s[z]=M;break;default:for(M=[][D](i[z]),N=[][D](r[z]),t[z]=[],w=d.paper.customAttributes[z].length;w--;)t[z][w]=((M[w]||0)-(N[w]||0))/q}var O=i.easing,P=b.easing_formulas[O];if(!P)if(P=H(O).match(Y),P&&5==P.length){var Q=P;P=function(a){return p(a,+Q[1],+Q[2],+Q[3],+Q[4],q)}}else P=la;if(o=i.start||c.start||+new Date,u={anim:c,percent:e,timestamp:o,start:o+(c.del||0),status:0,initstatus:f||0,stop:!1,ms:q,easing:P,from:r,diff:t,to:s,el:d,callback:i.callback,prev:m,next:l,repeat:h||c.times,origin:d.attr(),totalOrigin:g},fb.push(u),f&&!j&&!k&&(u.stop=!0,u.start=new Date-q*f,1==fb.length))return hb();k&&(u.start=new Date-u.ms*f),1==fb.length&&gb(hb)}a("raphael.anim.start."+d.id,d,c)}}function s(a){for(var b=0;b<fb.length;b++)fb[b].el.paper==a&&fb.splice(b--,1)}b.version="2.1.4",b.eve=a;var t,u,v=/[, ]+/,w={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},x=/\{(\d+)\}/g,y="hasOwnProperty",z={doc:document,win:window},A={was:Object.prototype[y].call(z.win,"Raphael"),is:z.win.Raphael},B=function(){this.ca=this.customAttributes={}},C="apply",D="concat",E="ontouchstart"in z.win||z.win.DocumentTouch&&z.doc instanceof DocumentTouch,F="",G=" ",H=String,I="split",J="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[I](G),K={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},L=H.prototype.toLowerCase,M=Math,N=M.max,O=M.min,P=M.abs,Q=M.pow,R=M.PI,S="number",T="string",U="array",V=Object.prototype.toString,W=(b._ISURL=/^url\(['"]?(.+?)['"]?\)$/i,/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i),X={NaN:1,Infinity:1,"-Infinity":1},Y=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,Z=M.round,$=parseFloat,_=parseInt,aa=H.prototype.toUpperCase,ba=b._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0},ca=b._availableAnimAttrs={blur:S,"clip-rect":"csv",cx:S,cy:S,fill:"colour","fill-opacity":S,"font-size":S,height:S,opacity:S,path:"path",r:S,rx:S,ry:S,stroke:"colour","stroke-opacity":S,"stroke-width":S,transform:"transform",width:S,x:S,y:S},da=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,ea={hs:1,rg:1},fa=/,?([achlmqrstvxz]),?/gi,ga=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,ha=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,ia=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/gi,ja=(b._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,{}),ka=function(a,b){return $(a)-$(b)},la=function(a){return a},ma=b._rectPath=function(a,b,c,d,e){return e?[["M",a+e,b],["l",c-2*e,0],["a",e,e,0,0,1,e,e],["l",0,d-2*e],["a",e,e,0,0,1,-e,e],["l",2*e-c,0],["a",e,e,0,0,1,-e,-e],["l",0,2*e-d],["a",e,e,0,0,1,e,-e],["z"]]:[["M",a,b],["l",c,0],["l",0,d],["l",-c,0],["z"]]},na=function(a,b,c,d){return null==d&&(d=c),[["M",a,b],["m",0,-d],["a",c,d,0,1,1,0,2*d],["a",c,d,0,1,1,0,-2*d],["z"]]},oa=b._getPath={path:function(a){return a.attr("path")},circle:function(a){var b=a.attrs;return na(b.cx,b.cy,b.r)},ellipse:function(a){var b=a.attrs;return na(b.cx,b.cy,b.rx,b.ry)},rect:function(a){var b=a.attrs;return ma(b.x,b.y,b.width,b.height,b.r)},image:function(a){var b=a.attrs;return ma(b.x,b.y,b.width,b.height)},text:function(a){var b=a._getBBox();return ma(b.x,b.y,b.width,b.height)},set:function(a){var b=a._getBBox();return ma(b.x,b.y,b.width,b.height)}},pa=b.mapPath=function(a,b){if(!b)return a;var c,d,e,f,g,h,i;for(a=Ia(a),e=0,g=a.length;e<g;e++)for(i=a[e],f=1,h=i.length;f<h;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d;return a};if(b._g=z,b.type=z.win.SVGAngle||z.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML","VML"==b.type){var qa,ra=z.doc.createElement("div");if(ra.innerHTML='<v:shape adj="1"/>',qa=ra.firstChild,qa.style.behavior="url(#default#VML)",!qa||"object"!=typeof qa.adj)return b.type=F;ra=null}b.svg=!(b.vml="VML"==b.type),b._Paper=B,b.fn=u=B.prototype=b.prototype,b._id=0,b._oid=0,b.is=function(a,b){return b=L.call(b),"finite"==b?!X[y](+a):"array"==b?a instanceof Array:"null"==b&&null===a||b==typeof a&&null!==a||"object"==b&&a===Object(a)||"array"==b&&Array.isArray&&Array.isArray(a)||V.call(a).slice(8,-1).toLowerCase()==b},b.angle=function(a,c,d,e,f,g){if(null==f){var h=a-d,i=c-e;return h||i?(180+180*M.atan2(-i,-h)/R+360)%360:0}return b.angle(a,c,f,g)-b.angle(d,e,f,g)},b.rad=function(a){return a%360*R/180},b.deg=function(a){return Math.round(180*a/R%360*1e3)/1e3},b.snapTo=function(a,c,d){if(d=b.is(d,"finite")?d:10,b.is(a,U)){for(var e=a.length;e--;)if(P(a[e]-c)<=d)return a[e]}else{a=+a;var f=c%a;if(f<d)return c-f;if(f>a-d)return c-f+a}return c};b.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=16*M.random()|0,c="x"==a?b:3&b|8;return c.toString(16)});b.setWindow=function(c){a("raphael.setWindow",b,z.win,c),z.win=c,z.doc=z.win.document,b._engine.initWin&&b._engine.initWin(z.win)};var sa=function(a){if(b.vml){var c,d=/^\s+|\s+$/g;try{var f=new ActiveXObject("htmlfile");f.write("<body>"),f.close(),c=f.body}catch(g){c=createPopup().document.body}var h=c.createTextRange();sa=e(function(a){try{c.style.color=H(a).replace(d,F);var b=h.queryCommandValue("ForeColor");return b=(255&b)<<16|65280&b|(16711680&b)>>>16,"#"+("000000"+b.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=z.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",z.doc.body.appendChild(i),sa=e(function(a){return i.style.color=a,z.doc.defaultView.getComputedStyle(i,F).getPropertyValue("color")})}return sa(a)},ta=function(){return"hsb("+[this.h,this.s,this.b]+")"},ua=function(){return"hsl("+[this.h,this.s,this.l]+")"},va=function(){return this.hex},wa=function(a,c,d){if(null==c&&b.is(a,"object")&&"r"in a&&"g"in a&&"b"in a&&(d=a.b,c=a.g,a=a.r),null==c&&b.is(a,T)){var e=b.getRGB(a);a=e.r,c=e.g,d=e.b}return(a>1||c>1||d>1)&&(a/=255,c/=255,d/=255),[a,c,d]},xa=function(a,c,d,e){a*=255,c*=255,d*=255;var f={r:a,g:c,b:d,hex:b.rgb(a,c,d),toString:va};return b.is(e,"finite")&&(f.opacity=e),f};b.color=function(a){var c;return b.is(a,"object")&&"h"in a&&"s"in a&&"b"in a?(c=b.hsb2rgb(a),a.r=c.r,a.g=c.g,a.b=c.b,a.hex=c.hex):b.is(a,"object")&&"h"in a&&"s"in a&&"l"in a?(c=b.hsl2rgb(a),a.r=c.r,a.g=c.g,a.b=c.b,a.hex=c.hex):(b.is(a,"string")&&(a=b.getRGB(a)),b.is(a,"object")&&"r"in a&&"g"in a&&"b"in a?(c=b.rgb2hsl(a),a.h=c.h,a.s=c.s,a.l=c.l,c=b.rgb2hsb(a),a.v=c.b):(a={hex:"none"},a.r=a.g=a.b=a.h=a.s=a.v=a.l=-1)),a.toString=va,a},b.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,d=a.o,a=a.h),a*=360;var e,f,g,h,i;return a=a%360/60,i=c*b,h=i*(1-P(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a],xa(e,f,g,d)},b.hsl2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"l"in a&&(c=a.l,b=a.s,a=a.h),(a>1||b>1||c>1)&&(a/=360,b/=100,c/=100),a*=360;var e,f,g,h,i;return a=a%360/60,i=2*b*(c<.5?c:1-c),h=i*(1-P(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a],xa(e,f,g,d)},b.rgb2hsb=function(a,b,c){c=wa(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;return f=N(a,b,c),g=f-O(a,b,c),d=0==g?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=(d+360)%6*60/360,e=0==g?0:g/f,{h:d,s:e,b:f,toString:ta}},b.rgb2hsl=function(a,b,c){c=wa(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;return g=N(a,b,c),h=O(a,b,c),i=g-h,d=0==i?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=(d+360)%6*60/360,f=(g+h)/2,e=0==i?0:f<.5?i/(2*f):i/(2-2*f),{h:d,s:e,l:f,toString:ua}},b._path2string=function(){return this.join(",").replace(fa,"$1")};b._preload=function(a,b){var c=z.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,z.doc.body.removeChild(this)},c.onerror=function(){z.doc.body.removeChild(this)},z.doc.body.appendChild(c),c.src=a};b.getRGB=e(function(a){if(!a||(a=H(a)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:f};if("none"==a)return{r:-1,g:-1,b:-1,hex:"none",toString:f};!(ea[y](a.toLowerCase().substring(0,2))||"#"==a.charAt())&&(a=sa(a));var c,d,e,g,h,i,j=a.match(W);return j?(j[2]&&(e=_(j[2].substring(5),16),d=_(j[2].substring(3,5),16),c=_(j[2].substring(1,3),16)),j[3]&&(e=_((h=j[3].charAt(3))+h,16),d=_((h=j[3].charAt(2))+h,16),c=_((h=j[3].charAt(1))+h,16)),j[4]&&(i=j[4][I](da),c=$(i[0]),"%"==i[0].slice(-1)&&(c*=2.55),d=$(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=$(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),"rgba"==j[1].toLowerCase().slice(0,4)&&(g=$(i[3])),i[3]&&"%"==i[3].slice(-1)&&(g/=100)),j[5]?(i=j[5][I](da),c=$(i[0]),"%"==i[0].slice(-1)&&(c*=2.55),d=$(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=$(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),("deg"==i[0].slice(-3)||"°"==i[0].slice(-1))&&(c/=360),"hsba"==j[1].toLowerCase().slice(0,4)&&(g=$(i[3])),i[3]&&"%"==i[3].slice(-1)&&(g/=100),b.hsb2rgb(c,d,e,g)):j[6]?(i=j[6][I](da),c=$(i[0]),"%"==i[0].slice(-1)&&(c*=2.55),d=$(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=$(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),("deg"==i[0].slice(-3)||"°"==i[0].slice(-1))&&(c/=360),"hsla"==j[1].toLowerCase().slice(0,4)&&(g=$(i[3])),i[3]&&"%"==i[3].slice(-1)&&(g/=100),b.hsl2rgb(c,d,e,g)):(j={r:c,g:d,b:e,toString:f},j.hex="#"+(16777216|e|d<<8|c<<16).toString(16).slice(1),b.is(g,"finite")&&(j.opacity=g),j)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:f}},b),b.hsb=e(function(a,c,d){return b.hsb2rgb(a,c,d).hex}),b.hsl=e(function(a,c,d){return b.hsl2rgb(a,c,d).hex}),b.rgb=e(function(a,b,c){function d(a){return a+.5|0}return"#"+(16777216|d(c)|d(b)<<8|d(a)<<16).toString(16).slice(1)}),b.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);return b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b})),c.hex},b.getColor.reset=function(){delete this.start},b.parsePathString=function(a){if(!a)return null;var c=ya(a);if(c.arr)return Aa(c.arr);var d={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},e=[];return b.is(a,U)&&b.is(a[0],U)&&(e=Aa(a)),e.length||H(a).replace(ga,function(a,b,c){var f=[],g=b.toLowerCase();if(c.replace(ia,function(a,b){b&&f.push(+b)}),"m"==g&&f.length>2&&(e.push([b][D](f.splice(0,2))),g="l",b="m"==b?"l":"L"),"r"==g)e.push([b][D](f));else for(;f.length>=d[g]&&(e.push([b][D](f.splice(0,d[g]))),d[g]););}),e.toString=b._path2string,c.arr=Aa(e),e},b.parseTransformString=e(function(a){if(!a)return null;var c=[];return b.is(a,U)&&b.is(a[0],U)&&(c=Aa(a)),c.length||H(a).replace(ha,function(a,b,d){var e=[];L.call(b);d.replace(ia,function(a,b){b&&e.push(+b)}),c.push([b][D](e))}),c.toString=b._path2string,c});var ya=function(a){var b=ya.ps=ya.ps||{};return b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[y](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])}),b[a]};b.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=Q(j,3),l=Q(j,2),m=i*i,n=m*i,o=k*a+3*l*i*c+3*j*i*i*e+n*g,p=k*b+3*l*i*d+3*j*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,w=j*e+i*g,x=j*f+i*h,y=90-180*M.atan2(q-s,r-t)/R;return(q>s||r<t)&&(y+=180),{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:w,y:x},alpha:y}},b.bezierBBox=function(a,c,d,e,f,g,h,i){b.is(a,"array")||(a=[a,c,d,e,f,g,h,i]);var j=Ha.apply(null,a);return{x:j.min.x,y:j.min.y,x2:j.max.x,y2:j.max.y,width:j.max.x-j.min.x,height:j.max.y-j.min.y}},b.isPointInsideBBox=function(a,b,c){return b>=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2},b.isBBoxIntersect=function(a,c){var d=b.isPointInsideBBox;return d(c,a.x,a.y)||d(c,a.x2,a.y)||d(c,a.x,a.y2)||d(c,a.x2,a.y2)||d(a,c.x,c.y)||d(a,c.x2,c.y)||d(a,c.x,c.y2)||d(a,c.x2,c.y2)||(a.x<c.x2&&a.x>c.x||c.x<a.x2&&c.x>a.x)&&(a.y<c.y2&&a.y>c.y||c.y<a.y2&&c.y>a.y)},b.pathIntersection=function(a,b){return m(a,b)},b.pathIntersectionNumber=function(a,b){return m(a,b,1)},b.isPointInsidePath=function(a,c,d){var e=b.pathBBox(a);return b.isPointInsideBBox(e,c,d)&&m(a,[["M",c,d],["H",e.x2+10]],1)%2==1},b._removedFactory=function(b){return function(){a("raphael.log",null,"Raphaël: you are calling to method “"+b+"” of removed object",b)}};var za=b.pathBBox=function(a){var b=ya(a);if(b.bbox)return c(b.bbox);if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=Ia(a);for(var d,e=0,f=0,g=[],h=[],i=0,j=a.length;i<j;i++)if(d=a[i],"M"==d[0])e=d[1],f=d[2],g.push(e),h.push(f);else{var k=Ha(e,f,d[1],d[2],d[3],d[4],d[5],d[6]);g=g[D](k.min.x,k.max.x),h=h[D](k.min.y,k.max.y),e=d[5],f=d[6]}var l=O[C](0,g),m=O[C](0,h),n=N[C](0,g),o=N[C](0,h),p=n-l,q=o-m,r={x:l,y:m,x2:n,y2:o,width:p,height:q,cx:l+p/2,cy:m+q/2};return b.bbox=c(r),r},Aa=function(a){var d=c(a);return d.toString=b._path2string,d},Ba=b._pathToRelative=function(a){var c=ya(a);if(c.rel)return Aa(c.rel);b.is(a,U)&&b.is(a&&a[0],U)||(a=b.parsePathString(a));var d=[],e=0,f=0,g=0,h=0,i=0;"M"==a[0][0]&&(e=a[0][1],f=a[0][2],g=e,h=f,i++,d.push(["M",e,f]));for(var j=i,k=a.length;j<k;j++){var l=d[j]=[],m=a[j];if(m[0]!=L.call(m[0]))switch(l[0]=L.call(m[0]),l[0]){case"a":l[1]=m[1],l[2]=m[2],l[3]=m[3],l[4]=m[4],l[5]=m[5],l[6]=+(m[6]-e).toFixed(3),l[7]=+(m[7]-f).toFixed(3);break;case"v":l[1]=+(m[1]-f).toFixed(3);break;case"m":g=m[1],h=m[2];default:for(var n=1,o=m.length;n<o;n++)l[n]=+(m[n]-(n%2?e:f)).toFixed(3)}else{l=d[j]=[],"m"==m[0]&&(g=m[1]+e,h=m[2]+f);for(var p=0,q=m.length;p<q;p++)d[j][p]=m[p]}var r=d[j].length;switch(d[j][0]){case"z":e=g,f=h;break;case"h":e+=+d[j][r-1];break;case"v":f+=+d[j][r-1];break;default:e+=+d[j][r-2],f+=+d[j][r-1]}}return d.toString=b._path2string,c.rel=Aa(d),d},Ca=b._pathToAbsolute=function(a){var c=ya(a);if(c.abs)return Aa(c.abs);if(b.is(a,U)&&b.is(a&&a[0],U)||(a=b.parsePathString(a)),!a||!a.length)return[["M",0,0]];var d=[],e=0,f=0,h=0,i=0,j=0;"M"==a[0][0]&&(e=+a[0][1],f=+a[0][2],h=e,i=f,j++,d[0]=["M",e,f]);for(var k,l,m=3==a.length&&"M"==a[0][0]&&"R"==a[1][0].toUpperCase()&&"Z"==a[2][0].toUpperCase(),n=j,o=a.length;n<o;n++){if(d.push(k=[]),l=a[n],l[0]!=aa.call(l[0]))switch(k[0]=aa.call(l[0]),k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+e),k[7]=+(l[7]+f);break;case"V":k[1]=+l[1]+f;break;case"H":k[1]=+l[1]+e;break;case"R":for(var p=[e,f][D](l.slice(1)),q=2,r=p.length;q<r;q++)p[q]=+p[q]+e,p[++q]=+p[q]+f;d.pop(),d=d[D](g(p,m));break;case"M":h=+l[1]+e,i=+l[2]+f;default:for(q=1,r=l.length;q<r;q++)k[q]=+l[q]+(q%2?e:f)}else if("R"==l[0])p=[e,f][D](l.slice(1)),d.pop(),d=d[D](g(p,m)),k=["R"][D](l.slice(-2));else for(var s=0,t=l.length;s<t;s++)k[s]=l[s];switch(k[0]){case"Z":e=h,f=i;break;case"H":e=k[1];break;case"V":f=k[1];break;case"M":h=k[k.length-2],i=k[k.length-1];default:e=k[k.length-2],f=k[k.length-1]}}return d.toString=b._path2string,c.abs=Aa(d),d},Da=function(a,b,c,d){return[a,b,c,d,c,d]},Ea=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},Fa=function(a,b,c,d,f,g,h,i,j,k){var l,m=120*R/180,n=R/180*(+f||0),o=[],p=e(function(a,b,c){var d=a*M.cos(c)-b*M.sin(c),e=a*M.sin(c)+b*M.cos(c);return{x:d,y:e}});if(k)y=k[0],z=k[1],w=k[2],x=k[3];else{l=p(a,b,-n),a=l.x,b=l.y,l=p(i,j,-n),i=l.x,j=l.y;var q=(M.cos(R/180*f),M.sin(R/180*f),(a-i)/2),r=(b-j)/2,s=q*q/(c*c)+r*r/(d*d);s>1&&(s=M.sqrt(s),c=s*c,d=s*d);var t=c*c,u=d*d,v=(g==h?-1:1)*M.sqrt(P((t*u-t*r*r-u*q*q)/(t*r*r+u*q*q))),w=v*c*r/d+(a+i)/2,x=v*-d*q/c+(b+j)/2,y=M.asin(((b-x)/d).toFixed(9)),z=M.asin(((j-x)/d).toFixed(9));y=a<w?R-y:y,z=i<w?R-z:z,y<0&&(y=2*R+y),z<0&&(z=2*R+z),h&&y>z&&(y-=2*R),!h&&z>y&&(z-=2*R)}var A=z-y;if(P(A)>m){var B=z,C=i,E=j;z=y+m*(h&&z>y?1:-1),i=w+c*M.cos(z),j=x+d*M.sin(z),o=Fa(i,j,c,d,f,0,h,C,E,[z,B,w,x])}A=z-y;var F=M.cos(y),G=M.sin(y),H=M.cos(z),J=M.sin(z),K=M.tan(A/4),L=4/3*c*K,N=4/3*d*K,O=[a,b],Q=[a+L*G,b-N*F],S=[i+L*J,j-N*H],T=[i,j];if(Q[0]=2*O[0]-Q[0],Q[1]=2*O[1]-Q[1],k)return[Q,S,T][D](o);o=[Q,S,T][D](o).join()[I](",");for(var U=[],V=0,W=o.length;V<W;V++)U[V]=V%2?p(o[V-1],o[V],n).y:p(o[V],o[V+1],n).x;return U},Ga=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:Q(j,3)*a+3*Q(j,2)*i*c+3*j*i*i*e+Q(i,3)*g,y:Q(j,3)*b+3*Q(j,2)*i*d+3*j*i*i*f+Q(i,3)*h}},Ha=e(function(a,b,c,d,e,f,g,h){var i,j=e-2*c+a-(g-2*e+c),k=2*(c-a)-2*(e-c),l=a-c,m=(-k+M.sqrt(k*k-4*j*l))/2/j,n=(-k-M.sqrt(k*k-4*j*l))/2/j,o=[b,h],p=[a,g];return P(m)>"1e12"&&(m=.5),P(n)>"1e12"&&(n=.5),m>0&&m<1&&(i=Ga(a,b,c,d,e,f,g,h,m),p.push(i.x),o.push(i.y)),n>0&&n<1&&(i=Ga(a,b,c,d,e,f,g,h,n),p.push(i.x),o.push(i.y)),j=f-2*d+b-(h-2*f+d),k=2*(d-b)-2*(f-d),l=b-d,m=(-k+M.sqrt(k*k-4*j*l))/2/j,n=(-k-M.sqrt(k*k-4*j*l))/2/j,P(m)>"1e12"&&(m=.5),P(n)>"1e12"&&(n=.5),m>0&&m<1&&(i=Ga(a,b,c,d,e,f,g,h,m),p.push(i.x),o.push(i.y)),n>0&&n<1&&(i=Ga(a,b,c,d,e,f,g,h,n),p.push(i.x),o.push(i.y)),{min:{x:O[C](0,p),y:O[C](0,o)},max:{x:N[C](0,p),y:N[C](0,o)}}}),Ia=b._path2curve=e(function(a,b){var c=!b&&ya(a);if(!b&&c.curve)return Aa(c.curve);for(var d=Ca(a),e=b&&Ca(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=(function(a,b,c){var d,e,f={T:1,Q:1};if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];switch(!(a[0]in f)&&(b.qx=b.qy=null),a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][D](Fa[C](0,[b.x,b.y][D](a.slice(1))));break;case"S":"C"==c||"S"==c?(d=2*b.x-b.bx,e=2*b.y-b.by):(d=b.x,e=b.y),a=["C",d,e][D](a.slice(1));break;case"T":"Q"==c||"T"==c?(b.qx=2*b.x-b.qx,b.qy=2*b.y-b.qy):(b.qx=b.x,b.qy=b.y),a=["C"][D](Ea(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][D](Ea(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][D](Da(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][D](Da(b.x,b.y,a[1],b.y));break;case"V":a=["C"][D](Da(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][D](Da(b.x,b.y,b.X,b.Y))}return a}),i=function(a,b){if(a[b].length>7){a[b].shift();for(var c=a[b];c.length;)k[b]="A",e&&(l[b]="A"),a.splice(b++,0,["C"][D](c.splice(0,6)));a.splice(b,1),p=N(d.length,e&&e.length||0)}},j=function(a,b,c,f,g){a&&b&&"M"==a[g][0]&&"M"!=b[g][0]&&(b.splice(g,0,["M",f.x,f.y]),c.bx=0,c.by=0,c.x=a[g][1],c.y=a[g][2],p=N(d.length,e&&e.length||0))},k=[],l=[],m="",n="",o=0,p=N(d.length,e&&e.length||0);o<p;o++){d[o]&&(m=d[o][0]),"C"!=m&&(k[o]=m,o&&(n=k[o-1])),d[o]=h(d[o],f,n),"A"!=k[o]&&"C"==m&&(k[o]="C"),i(d,o),e&&(e[o]&&(m=e[o][0]),"C"!=m&&(l[o]=m,o&&(n=l[o-1])),e[o]=h(e[o],g,n),"A"!=l[o]&&"C"==m&&(l[o]="C"),i(e,o)),j(d,e,f,g,o),j(e,d,g,f,o);var q=d[o],r=e&&e[o],s=q.length,t=e&&r.length;f.x=q[s-2],f.y=q[s-1],f.bx=$(q[s-4])||f.x,f.by=$(q[s-3])||f.y,g.bx=e&&($(r[t-4])||g.x),g.by=e&&($(r[t-3])||g.y),g.x=e&&r[t-2],g.y=e&&r[t-1]}return e||(c.curve=Aa(d)),e?[d,e]:d},null,Aa),Ja=(b._parseDots=e(function(a){for(var c=[],d=0,e=a.length;d<e;d++){var f={},g=a[d].match(/^([^:]*):?([\d\.]*)/);if(f.color=b.getRGB(g[1]),f.color.error)return null;f.opacity=f.color.opacity,f.color=f.color.hex,g[2]&&(f.offset=g[2]+"%"),c.push(f)}for(d=1,e=c.length-1;d<e;d++)if(!c[d].offset){for(var h=$(c[d-1].offset||0),i=0,j=d+1;j<e;j++)if(c[j].offset){i=c[j].offset;break}i||(i=100,j=e),i=$(i);for(var k=(i-h)/(j-d+1);d<j;d++)h+=k,c[d].offset=h+"%"}return c}),b._tear=function(a,b){a==b.top&&(b.top=a.prev),a==b.bottom&&(b.bottom=a.next),a.next&&(a.next.prev=a.prev),a.prev&&(a.prev.next=a.next)}),Ka=(b._tofront=function(a,b){b.top!==a&&(Ja(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a)},b._toback=function(a,b){b.bottom!==a&&(Ja(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a)},b._insertafter=function(a,b,c){Ja(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},b._insertbefore=function(a,b,c){Ja(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},b.toMatrix=function(a,b){var c=za(a),d={_:{transform:F},getBBox:function(){return c}};return La(d,b),d.matrix}),La=(b.transformPath=function(a,b){return pa(a,Ka(a,b))},b._extractTransform=function(a,c){if(null==c)return a._.transform;c=H(c).replace(/\.{3}|\u2026/g,a._.transform||F);var d=b.parseTransformString(c),e=0,f=0,g=0,h=1,i=1,j=a._,k=new n;if(j.transform=d||[],d)for(var l=0,m=d.length;l<m;l++){var o,p,q,r,s,t=d[l],u=t.length,v=H(t[0]).toLowerCase(),w=t[0]!=v,x=w?k.invert():0;"t"==v&&3==u?w?(o=x.x(0,0),p=x.y(0,0),q=x.x(t[1],t[2]),r=x.y(t[1],t[2]),k.translate(q-o,r-p)):k.translate(t[1],t[2]):"r"==v?2==u?(s=s||a.getBBox(1),k.rotate(t[1],s.x+s.width/2,s.y+s.height/2),e+=t[1]):4==u&&(w?(q=x.x(t[2],t[3]),r=x.y(t[2],t[3]),k.rotate(t[1],q,r)):k.rotate(t[1],t[2],t[3]),e+=t[1]):"s"==v?2==u||3==u?(s=s||a.getBBox(1),k.scale(t[1],t[u-1],s.x+s.width/2,s.y+s.height/2),h*=t[1],i*=t[u-1]):5==u&&(w?(q=x.x(t[3],t[4]),r=x.y(t[3],t[4]),k.scale(t[1],t[2],q,r)):k.scale(t[1],t[2],t[3],t[4]),h*=t[1],i*=t[2]):"m"==v&&7==u&&k.add(t[1],t[2],t[3],t[4],t[5],t[6]),j.dirtyT=1,a.matrix=k}a.matrix=k,j.sx=h,j.sy=i,j.deg=e,j.dx=f=k.e,j.dy=g=k.f,1==h&&1==i&&!e&&j.bbox?(j.bbox.x+=+f,j.bbox.y+=+g):j.dirtyT=1}),Ma=function(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return 4==a.length?[b,0,a[2],a[3]]:[b,0];case"s":return 5==a.length?[b,1,1,a[3],a[4]]:3==a.length?[b,1,1]:[b,1]}},Na=b._equaliseTransform=function(a,c){c=H(c).replace(/\.{3}|\u2026/g,a),a=b.parseTransformString(a)||[],c=b.parseTransformString(c)||[];for(var d,e,f,g,h=N(a.length,c.length),i=[],j=[],k=0;k<h;k++){if(f=a[k]||Ma(c[k]),g=c[k]||Ma(f),f[0]!=g[0]||"r"==f[0].toLowerCase()&&(f[2]!=g[2]||f[3]!=g[3])||"s"==f[0].toLowerCase()&&(f[3]!=g[3]||f[4]!=g[4]))return;for(i[k]=[],j[k]=[],d=0,e=N(f.length,g.length);d<e;d++)d in f&&(i[k][d]=f[d]),d in g&&(j[k][d]=g[d])}return{from:i,to:j}};b._getContainer=function(a,c,d,e){var f;if(f=null!=e||b.is(a,"object")?a:z.doc.getElementById(a),null!=f)return f.tagName?null==c?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:c,height:d}:{container:1,x:a,y:c,width:d,height:e}},b.pathToRelative=Ba,b._engine={},b.path2curve=Ia,b.matrix=function(a,b,c,d,e,f){return new n(a,b,c,d,e,f)},function(a){function c(a){return a[0]*a[0]+a[1]*a[1]}function d(a){var b=M.sqrt(c(a));a[0]&&(a[0]/=b),a[1]&&(a[1]/=b)}a.add=function(a,b,c,d,e,f){var g,h,i,j,k=[[],[],[]],l=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],m=[[a,c,e],[b,d,f],[0,0,1]];for(a&&a instanceof n&&(m=[[a.a,a.c,a.e],[a.b,a.d,a.f],[0,0,1]]),g=0;g<3;g++)for(h=0;h<3;h++){for(j=0,i=0;i<3;i++)j+=l[g][i]*m[i][h];k[g][h]=j}this.a=k[0][0],this.b=k[1][0],this.c=k[0][1],this.d=k[1][1],this.e=k[0][2],this.f=k[1][2]},a.invert=function(){var a=this,b=a.a*a.d-a.b*a.c;return new n(a.d/b,-a.b/b,-a.c/b,a.a/b,(a.c*a.f-a.d*a.e)/b,(a.b*a.e-a.a*a.f)/b)},a.clone=function(){return new n(this.a,this.b,this.c,this.d,this.e,this.f)},a.translate=function(a,b){this.add(1,0,0,1,a,b)},a.scale=function(a,b,c,d){null==b&&(b=a),(c||d)&&this.add(1,0,0,1,c,d),this.add(a,0,0,b,0,0),(c||d)&&this.add(1,0,0,1,-c,-d)},a.rotate=function(a,c,d){a=b.rad(a),c=c||0,d=d||0;var e=+M.cos(a).toFixed(9),f=+M.sin(a).toFixed(9);this.add(e,f,-f,e,c,d),this.add(1,0,0,1,-c,-d)},a.x=function(a,b){return a*this.a+b*this.c+this.e},a.y=function(a,b){return a*this.b+b*this.d+this.f},a.get=function(a){return+this[H.fromCharCode(97+a)].toFixed(4)},a.toString=function(){return b.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},a.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},a.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},a.split=function(){var a={};a.dx=this.e,a.dy=this.f;var e=[[this.a,this.c],[this.b,this.d]];a.scalex=M.sqrt(c(e[0])),d(e[0]),a.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*a.shear,e[1][1]-e[0][1]*a.shear],a.scaley=M.sqrt(c(e[1])),d(e[1]),a.shear/=a.scaley;var f=-e[0][1],g=e[1][1];return g<0?(a.rotate=b.deg(M.acos(g)),f<0&&(a.rotate=360-a.rotate)):a.rotate=b.deg(M.asin(f)),a.isSimple=!(+a.shear.toFixed(9)||a.scalex.toFixed(9)!=a.scaley.toFixed(9)&&a.rotate),a.isSuperSimple=!+a.shear.toFixed(9)&&a.scalex.toFixed(9)==a.scaley.toFixed(9)&&!a.rotate,a.noRotation=!+a.shear.toFixed(9)&&!a.rotate,a},a.toTransformString=function(a){var b=a||this[I]();return b.isSimple?(b.scalex=+b.scalex.toFixed(4),b.scaley=+b.scaley.toFixed(4),b.rotate=+b.rotate.toFixed(4),(b.dx||b.dy?"t"+[b.dx,b.dy]:F)+(1!=b.scalex||1!=b.scaley?"s"+[b.scalex,b.scaley,0,0]:F)+(b.rotate?"r"+[b.rotate,0,0]:F)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(n.prototype);for(var Oa=function(){this.returnValue=!1},Pa=function(){return this.originalEvent.preventDefault()},Qa=function(){this.cancelBubble=!0},Ra=function(){return this.originalEvent.stopPropagation()},Sa=function(a){var b=z.doc.documentElement.scrollTop||z.doc.body.scrollTop,c=z.doc.documentElement.scrollLeft||z.doc.body.scrollLeft;return{x:a.clientX+c,y:a.clientY+b}},Ta=function(){return z.doc.addEventListener?function(a,b,c,d){var e=function(a){var b=Sa(a);return c.call(d,a,b.x,b.y)};if(a.addEventListener(b,e,!1),E&&K[b]){var f=function(b){for(var e=Sa(b),f=b,g=0,h=b.targetTouches&&b.targetTouches.length;g<h;g++)if(b.targetTouches[g].target==a){b=b.targetTouches[g],b.originalEvent=f,b.preventDefault=Pa,b.stopPropagation=Ra;break}return c.call(d,b,e.x,e.y)};a.addEventListener(K[b],f,!1)}return function(){return a.removeEventListener(b,e,!1),E&&K[b]&&a.removeEventListener(K[b],f,!1),!0}}:z.doc.attachEvent?function(a,b,c,d){var e=function(a){a=a||z.win.event;var b=z.doc.documentElement.scrollTop||z.doc.body.scrollTop,e=z.doc.documentElement.scrollLeft||z.doc.body.scrollLeft,f=a.clientX+e,g=a.clientY+b;return a.preventDefault=a.preventDefault||Oa,a.stopPropagation=a.stopPropagation||Qa,c.call(d,a,f,g)};a.attachEvent("on"+b,e);var f=function(){return a.detachEvent("on"+b,e),!0};return f}:void 0}(),Ua=[],Va=function(b){for(var c,d=b.clientX,e=b.clientY,f=z.doc.documentElement.scrollTop||z.doc.body.scrollTop,g=z.doc.documentElement.scrollLeft||z.doc.body.scrollLeft,h=Ua.length;h--;){if(c=Ua[h],E&&b.touches){for(var i,j=b.touches.length;j--;)if(i=b.touches[j],i.identifier==c.el._drag.id){d=i.clientX,e=i.clientY,(b.originalEvent?b.originalEvent:b).preventDefault();break}}else b.preventDefault();var k,l=c.el.node,m=l.nextSibling,n=l.parentNode,o=l.style.display;z.win.opera&&n.removeChild(l),l.style.display="none",k=c.el.paper.getElementByPoint(d,e),l.style.display=o,z.win.opera&&(m?n.insertBefore(l,m):n.appendChild(l)),k&&a("raphael.drag.over."+c.el.id,c.el,k),d+=g,e+=f,a("raphael.drag.move."+c.el.id,c.move_scope||c.el,d-c.el._drag.x,e-c.el._drag.y,d,e,b)}},Wa=function(c){b.unmousemove(Va).unmouseup(Wa);for(var d,e=Ua.length;e--;)d=Ua[e],d.el._drag={},a("raphael.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,c);Ua=[]},Xa=b.el={},Ya=J.length;Ya--;)!function(a){b[a]=Xa[a]=function(c,d){return b.is(c,"function")&&(this.events=this.events||[],this.events.push({name:a,f:c,unbind:Ta(this.shape||this.node||z.doc,a,c,d||this)})),this},b["un"+a]=Xa["un"+a]=function(c){for(var d=this.events||[],e=d.length;e--;)d[e].name!=a||!b.is(c,"undefined")&&d[e].f!=c||(d[e].unbind(),d.splice(e,1),!d.length&&delete this.events);return this}}(J[Ya]);Xa.data=function(c,d){var e=ja[this.id]=ja[this.id]||{};if(0==arguments.length)return e;if(1==arguments.length){if(b.is(c,"object")){for(var f in c)c[y](f)&&this.data(f,c[f]);return this}return a("raphael.data.get."+this.id,this,e[c],c),e[c]}return e[c]=d,a("raphael.data.set."+this.id,this,d,c),this},Xa.datum=function(){return 0==arguments.length?this._bindData:(this._bindData=arguments[0],this)},Xa.removeData=function(a){return null==a?ja[this.id]={}:ja[this.id]&&delete ja[this.id][a],this},Xa.getData=function(){return c(ja[this.id]||{})},Xa.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},Xa.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var Za=[];Xa.drag=function(c,d,e,f,g,h){function i(i){(i.originalEvent||i).preventDefault();var j=i.clientX,k=i.clientY,l=z.doc.documentElement.scrollTop||z.doc.body.scrollTop,m=z.doc.documentElement.scrollLeft||z.doc.body.scrollLeft;if(this._drag.id=i.identifier,E&&i.touches)for(var n,o=i.touches.length;o--;)if(n=i.touches[o],this._drag.id=n.identifier,n.identifier==this._drag.id){j=n.clientX,k=n.clientY;break}this._drag.x=j+m,this._drag.y=k+l,!Ua.length&&b.mousemove(Va).mouseup(Wa),Ua.push({el:this,move_scope:f,start_scope:g,end_scope:h}),d&&a.on("raphael.drag.start."+this.id,d),c&&a.on("raphael.drag.move."+this.id,c),e&&a.on("raphael.drag.end."+this.id,e),a("raphael.drag.start."+this.id,g||f||this,i.clientX+m,i.clientY+l,i)}return this._drag={},Za.push({el:this,start:i}),this.mousedown(i),this},Xa.onDragOver=function(b){b?a.on("raphael.drag.over."+this.id,b):a.unbind("raphael.drag.over."+this.id)},Xa.undrag=function(){for(var c=Za.length;c--;)Za[c].el==this&&(this.unmousedown(Za[c].start),Za.splice(c,1),a.unbind("raphael.drag.*."+this.id));!Za.length&&b.unmousemove(Va).unmouseup(Wa),Ua=[]},u.circle=function(a,c,d){var e=b._engine.circle(this,a||0,c||0,d||0);return this.__set__&&this.__set__.push(e),e},u.rect=function(a,c,d,e,f){var g=b._engine.rect(this,a||0,c||0,d||0,e||0,f||0);return this.__set__&&this.__set__.push(g),g},u.ellipse=function(a,c,d,e){var f=b._engine.ellipse(this,a||0,c||0,d||0,e||0);return this.__set__&&this.__set__.push(f),f},u.path=function(a){a&&!b.is(a,T)&&!b.is(a[0],U)&&(a+=F);
var c=b._engine.path(b.format[C](b,arguments),this);return this.__set__&&this.__set__.push(c),c},u.image=function(a,c,d,e,f){var g=b._engine.image(this,a||"about:blank",c||0,d||0,e||0,f||0);return this.__set__&&this.__set__.push(g),g},u.text=function(a,c,d){var e=b._engine.text(this,a||0,c||0,H(d));return this.__set__&&this.__set__.push(e),e},u.set=function(a){!b.is(a,"array")&&(a=Array.prototype.splice.call(arguments,0,arguments.length));var c=new jb(a);return this.__set__&&this.__set__.push(c),c.paper=this,c.type="set",c},u.setStart=function(a){this.__set__=a||this.set()},u.setFinish=function(a){var b=this.__set__;return delete this.__set__,b},u.getSize=function(){var a=this.canvas.parentNode;return{width:a.offsetWidth,height:a.offsetHeight}},u.setSize=function(a,c){return b._engine.setSize.call(this,a,c)},u.setViewBox=function(a,c,d,e,f){return b._engine.setViewBox.call(this,a,c,d,e,f)},u.top=u.bottom=null,u.raphael=b;var $a=function(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.body,e=c.documentElement,f=e.clientTop||d.clientTop||0,g=e.clientLeft||d.clientLeft||0,h=b.top+(z.win.pageYOffset||e.scrollTop||d.scrollTop)-f,i=b.left+(z.win.pageXOffset||e.scrollLeft||d.scrollLeft)-g;return{y:h,x:i}};u.getElementByPoint=function(a,b){var c=this,d=c.canvas,e=z.doc.elementFromPoint(a,b);if(z.win.opera&&"svg"==e.tagName){var f=$a(d),g=d.createSVGRect();g.x=a-f.x,g.y=b-f.y,g.width=g.height=1;var h=d.getIntersectionList(g,null);h.length&&(e=h[h.length-1])}if(!e)return null;for(;e.parentNode&&e!=d.parentNode&&!e.raphael;)e=e.parentNode;return e==c.canvas.parentNode&&(e=d),e=e&&e.raphael?c.getById(e.raphaelid):null},u.getElementsByBBox=function(a){var c=this.set();return this.forEach(function(d){b.isBBoxIntersect(d.getBBox(),a)&&c.push(d)}),c},u.getById=function(a){for(var b=this.bottom;b;){if(b.id==a)return b;b=b.next}return null},u.forEach=function(a,b){for(var c=this.bottom;c;){if(a.call(b,c)===!1)return this;c=c.next}return this},u.getElementsByPoint=function(a,b){var c=this.set();return this.forEach(function(d){d.isPointInside(a,b)&&c.push(d)}),c},Xa.isPointInside=function(a,c){var d=this.realPath=oa[this.type](this);return this.attr("transform")&&this.attr("transform").length&&(d=b.transformPath(d,this.attr("transform"))),b.isPointInsidePath(d,a,c)},Xa.getBBox=function(a){if(this.removed)return{};var b=this._;return a?(!b.dirty&&b.bboxwt||(this.realPath=oa[this.type](this),b.bboxwt=za(this.realPath),b.bboxwt.toString=o,b.dirty=0),b.bboxwt):((b.dirty||b.dirtyT||!b.bbox)&&(!b.dirty&&this.realPath||(b.bboxwt=0,this.realPath=oa[this.type](this)),b.bbox=za(pa(this.realPath,this.matrix)),b.bbox.toString=o,b.dirty=b.dirtyT=0),b.bbox)},Xa.clone=function(){if(this.removed)return null;var a=this.paper[this.type]().attr(this.attr());return this.__set__&&this.__set__.push(a),a},Xa.glow=function(a){if("text"==this.type)return null;a=a||{};var b={width:(a.width||10)+(+this.attr("stroke-width")||1),fill:a.fill||!1,opacity:null==a.opacity?.5:a.opacity,offsetx:a.offsetx||0,offsety:a.offsety||0,color:a.color||"#000"},c=b.width/2,d=this.paper,e=d.set(),f=this.realPath||oa[this.type](this);f=this.matrix?pa(f,this.matrix):f;for(var g=1;g<c+1;g++)e.push(d.path(f).attr({stroke:b.color,fill:b.fill?b.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(b.width/c*g).toFixed(3),opacity:+(b.opacity/c).toFixed(3)}));return e.insertBefore(this).translate(b.offsetx,b.offsety)};var _a=function(a,c,d,e,f,g,h,k,l){return null==l?i(a,c,d,e,f,g,h,k):b.findDotsAtSegment(a,c,d,e,f,g,h,k,j(a,c,d,e,f,g,h,k,l))},ab=function(a,c){return function(d,e,f){d=Ia(d);for(var g,h,i,j,k,l="",m={},n=0,o=0,p=d.length;o<p;o++){if(i=d[o],"M"==i[0])g=+i[1],h=+i[2];else{if(j=_a(g,h,i[1],i[2],i[3],i[4],i[5],i[6]),n+j>e){if(c&&!m.start){if(k=_a(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),l+=["C"+k.start.x,k.start.y,k.m.x,k.m.y,k.x,k.y],f)return l;m.start=l,l=["M"+k.x,k.y+"C"+k.n.x,k.n.y,k.end.x,k.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!a&&!c)return k=_a(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),{x:k.x,y:k.y,alpha:k.alpha}}n+=j,g=+i[5],h=+i[6]}l+=i.shift()+i}return m.end=l,k=a?n:c?m:b.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),k.alpha&&(k={x:k.x,y:k.y,alpha:k.alpha}),k}},bb=ab(1),cb=ab(),db=ab(0,1);b.getTotalLength=bb,b.getPointAtLength=cb,b.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return db(a,b).end;var d=db(a,c,1);return b?db(d,b).end:d},Xa.getTotalLength=function(){var a=this.getPath();if(a)return this.node.getTotalLength?this.node.getTotalLength():bb(a)},Xa.getPointAtLength=function(a){var b=this.getPath();if(b)return cb(b,a)},Xa.getPath=function(){var a,c=b._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return c&&(a=c(this)),a},Xa.getSubpath=function(a,c){var d=this.getPath();if(d)return b.getSubpath(d,a,c)};var eb=b.easing_formulas={linear:function(a){return a},"<":function(a){return Q(a,1.7)},">":function(a){return Q(a,.48)},"<>":function(a){var b=.48-a/1.04,c=M.sqrt(.1734+b*b),d=c-b,e=Q(P(d),1/3)*(d<0?-1:1),f=-c-b,g=Q(P(f),1/3)*(f<0?-1:1),h=e+g+.5;return 3*(1-h)*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a-=1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){return a==!!a?a:Q(2,-10*a)*M.sin((a-.075)*(2*R)/.3)+1},bounce:function(a){var b,c=7.5625,d=2.75;return a<1/d?b=c*a*a:a<2/d?(a-=1.5/d,b=c*a*a+.75):a<2.5/d?(a-=2.25/d,b=c*a*a+.9375):(a-=2.625/d,b=c*a*a+.984375),b}};eb.easeIn=eb["ease-in"]=eb["<"],eb.easeOut=eb["ease-out"]=eb[">"],eb.easeInOut=eb["ease-in-out"]=eb["<>"],eb["back-in"]=eb.backIn,eb["back-out"]=eb.backOut;var fb=[],gb=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},hb=function(){for(var c=+new Date,d=0;d<fb.length;d++){var e=fb[d];if(!e.el.removed&&!e.paused){var f,g,h=c-e.start,i=e.ms,j=e.easing,k=e.from,l=e.diff,m=e.to,n=(e.t,e.el),o={},p={};if(e.initstatus?(h=(e.initstatus*e.anim.top-e.prev)/(e.percent-e.prev)*i,e.status=e.initstatus,delete e.initstatus,e.stop&&fb.splice(d--,1)):e.status=(e.prev+(e.percent-e.prev)*(h/i))/e.anim.top,!(h<0))if(h<i){var q=j(h/i);for(var s in k)if(k[y](s)){switch(ca[s]){case S:f=+k[s]+q*i*l[s];break;case"colour":f="rgb("+[ib(Z(k[s].r+q*i*l[s].r)),ib(Z(k[s].g+q*i*l[s].g)),ib(Z(k[s].b+q*i*l[s].b))].join(",")+")";break;case"path":f=[];for(var t=0,u=k[s].length;t<u;t++){f[t]=[k[s][t][0]];for(var v=1,w=k[s][t].length;v<w;v++)f[t][v]=+k[s][t][v]+q*i*l[s][t][v];f[t]=f[t].join(G)}f=f.join(G);break;case"transform":if(l[s].real)for(f=[],t=0,u=k[s].length;t<u;t++)for(f[t]=[k[s][t][0]],v=1,w=k[s][t].length;v<w;v++)f[t][v]=k[s][t][v]+q*i*l[s][t][v];else{var x=function(a){return+k[s][a]+q*i*l[s][a]};f=[["m",x(0),x(1),x(2),x(3),x(4),x(5)]]}break;case"csv":if("clip-rect"==s)for(f=[],t=4;t--;)f[t]=+k[s][t]+q*i*l[s][t];break;default:var z=[][D](k[s]);for(f=[],t=n.paper.customAttributes[s].length;t--;)f[t]=+z[t]+q*i*l[s][t]}o[s]=f}n.attr(o),function(b,c,d){setTimeout(function(){a("raphael.anim.frame."+b,c,d)})}(n.id,n,e.anim)}else{if(function(c,d,e){setTimeout(function(){a("raphael.anim.frame."+d.id,d,e),a("raphael.anim.finish."+d.id,d,e),b.is(c,"function")&&c.call(d)})}(e.callback,n,e.anim),n.attr(m),fb.splice(d--,1),e.repeat>1&&!e.next){for(g in m)m[y](g)&&(p[g]=e.totalOrigin[g]);e.el.attr(p),r(e.anim,e.el,e.anim.percents[0],null,e.totalOrigin,e.repeat-1)}e.next&&!e.stop&&r(e.anim,e.el,e.next,null,e.totalOrigin,e.repeat)}}}fb.length&&gb(hb)},ib=function(a){return a>255?255:a<0?0:a};Xa.animateWith=function(a,c,d,e,f,g){var h=this;if(h.removed)return g&&g.call(h),h;var i=d instanceof q?d:b.animation(d,e,f,g);r(i,h,i.percents[0],null,h.attr());for(var j=0,k=fb.length;j<k;j++)if(fb[j].anim==c&&fb[j].el==a){fb[k-1].start=fb[j].start;break}return h},Xa.onAnimation=function(b){return b?a.on("raphael.anim.frame."+this.id,b):a.unbind("raphael.anim.frame."+this.id),this},q.prototype.delay=function(a){var b=new q(this.anim,this.ms);return b.times=this.times,b.del=+a||0,b},q.prototype.repeat=function(a){var b=new q(this.anim,this.ms);return b.del=this.del,b.times=M.floor(N(a,0))||1,b},b.animation=function(a,c,d,e){if(a instanceof q)return a;!b.is(d,"function")&&d||(e=e||d||null,d=null),a=Object(a),c=+c||0;var f,g,h={};for(g in a)a[y](g)&&$(g)!=g&&$(g)+"%"!=g&&(f=!0,h[g]=a[g]);if(f)return d&&(h.easing=d),e&&(h.callback=e),new q({100:h},c);if(e){var i=0;for(var j in a){var k=_(j);a[y](j)&&k>i&&(i=k)}i+="%",!a[i].callback&&(a[i].callback=e)}return new q(a,c)},Xa.animate=function(a,c,d,e){var f=this;if(f.removed)return e&&e.call(f),f;var g=a instanceof q?a:b.animation(a,c,d,e);return r(g,f,g.percents[0],null,f.attr()),f},Xa.setTime=function(a,b){return a&&null!=b&&this.status(a,O(b,a.ms)/a.ms),this},Xa.status=function(a,b){var c,d,e=[],f=0;if(null!=b)return r(a,this,-1,O(b,1)),this;for(c=fb.length;f<c;f++)if(d=fb[f],d.el.id==this.id&&(!a||d.anim==a)){if(a)return d.status;e.push({anim:d.anim,status:d.status})}return a?0:e},Xa.pause=function(b){for(var c=0;c<fb.length;c++)fb[c].el.id!=this.id||b&&fb[c].anim!=b||a("raphael.anim.pause."+this.id,this,fb[c].anim)!==!1&&(fb[c].paused=!0);return this},Xa.resume=function(b){for(var c=0;c<fb.length;c++)if(fb[c].el.id==this.id&&(!b||fb[c].anim==b)){var d=fb[c];a("raphael.anim.resume."+this.id,this,d.anim)!==!1&&(delete d.paused,this.status(d.anim,d.status))}return this},Xa.stop=function(b){for(var c=0;c<fb.length;c++)fb[c].el.id!=this.id||b&&fb[c].anim!=b||a("raphael.anim.stop."+this.id,this,fb[c].anim)!==!1&&fb.splice(c--,1);return this},a.on("raphael.remove",s),a.on("raphael.clear",s),Xa.toString=function(){return"Raphaël’s object"};var jb=function(a){if(this.items=[],this.length=0,this.type="set",a)for(var b=0,c=a.length;b<c;b++)!a[b]||a[b].constructor!=Xa.constructor&&a[b].constructor!=jb||(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},kb=jb.prototype;kb.push=function(){for(var a,b,c=0,d=arguments.length;c<d;c++)a=arguments[c],!a||a.constructor!=Xa.constructor&&a.constructor!=jb||(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},kb.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},kb.forEach=function(a,b){for(var c=0,d=this.items.length;c<d;c++)if(a.call(b,this.items[c],c)===!1)return this;return this};for(var lb in Xa)Xa[y](lb)&&(kb[lb]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a][C](c,b)})}}(lb));return kb.attr=function(a,c){if(a&&b.is(a,U)&&b.is(a[0],"object"))for(var d=0,e=a.length;d<e;d++)this.items[d].attr(a[d]);else for(var f=0,g=this.items.length;f<g;f++)this.items[f].attr(a,c);return this},kb.clear=function(){for(;this.length;)this.pop()},kb.splice=function(a,b,c){a=a<0?N(this.length+a,0):a,b=N(0,O(this.length-a,b));var d,e=[],f=[],g=[];for(d=2;d<arguments.length;d++)g.push(arguments[d]);for(d=0;d<b;d++)f.push(this[a+d]);for(;d<this.length-a;d++)e.push(this[a+d]);var h=g.length;for(d=0;d<h+e.length;d++)this.items[a+d]=this[a+d]=d<h?g[d]:e[d-h];for(d=this.items.length=this.length-=b-h;this[d];)delete this[d++];return new jb(f)},kb.exclude=function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]==a)return this.splice(b,1),!0},kb.animate=function(a,c,d,e){(b.is(d,"function")||!d)&&(e=d||null);var f,g,h=this.items.length,i=h,j=this;if(!h)return this;e&&(g=function(){!--h&&e.call(j)}),d=b.is(d,T)?d:g;var k=b.animation(a,c,d,g);for(f=this.items[--i].animate(k);i--;)this.items[i]&&!this.items[i].removed&&this.items[i].animateWith(f,k,k),this.items[i]&&!this.items[i].removed||h--;return this},kb.insertAfter=function(a){for(var b=this.items.length;b--;)this.items[b].insertAfter(a);return this},kb.getBBox=function(){for(var a=[],b=[],c=[],d=[],e=this.items.length;e--;)if(!this.items[e].removed){var f=this.items[e].getBBox();a.push(f.x),b.push(f.y),c.push(f.x+f.width),d.push(f.y+f.height)}return a=O[C](0,a),b=O[C](0,b),c=N[C](0,c),d=N[C](0,d),{x:a,y:b,x2:c,y2:d,width:c-a,height:d-b}},kb.clone=function(a){a=this.paper.set();for(var b=0,c=this.items.length;b<c;b++)a.push(this.items[b].clone());return a},kb.toString=function(){return"Raphaël‘s set"},kb.glow=function(a){var b=this.paper.set();return this.forEach(function(c,d){var e=c.glow(a);null!=e&&e.forEach(function(a,c){b.push(a)})}),b},kb.isPointInside=function(a,b){var c=!1;return this.forEach(function(d){if(d.isPointInside(a,b))return c=!0,!1}),c},b.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[y](d)&&(b.face[d]=a.face[d]);if(this.fonts[c]?this.fonts[c].push(b):this.fonts[c]=[b],!a.svg){b.face["units-per-em"]=_(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[y](e)){var f=a.glyphs[e];if(b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d.replace(/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"},f.k)for(var g in f.k)f[y](g)&&(b.glyphs[e].k[g]=f.k[g])}}return a},u.getFont=function(a,c,d,e){if(e=e||"normal",d=d||"normal",c=+c||{normal:400,bold:700,lighter:300,bolder:800}[c]||400,b.fonts){var f=b.fonts[a];if(!f){var g=new RegExp("(^|\\s)"+a.replace(/[^\w\d\s+!~.:_-]/g,F)+"(\\s|$)","i");for(var h in b.fonts)if(b.fonts[y](h)&&g.test(h)){f=b.fonts[h];break}}var i;if(f)for(var j=0,k=f.length;j<k&&(i=f[j],i.face["font-weight"]!=c||i.face["font-style"]!=d&&i.face["font-style"]||i.face["font-stretch"]!=e);j++);return i}},u.print=function(a,c,d,e,f,g,h,i){g=g||"middle",h=N(O(h||0,1),-1),i=N(O(i||1,3),1);var j,k=H(d)[I](F),l=0,m=0,n=F;if(b.is(e,"string")&&(e=this.getFont(e)),e){j=(f||16)/e.face["units-per-em"];for(var o=e.face.bbox[I](v),p=+o[0],q=o[3]-o[1],r=0,s=+o[1]+("baseline"==g?q+ +e.face.descent:q/2),t=0,u=k.length;t<u;t++){if("\n"==k[t])l=0,x=0,m=0,r+=q*i;else{var w=m&&e.glyphs[k[t-1]]||{},x=e.glyphs[k[t]];l+=m?(w.w||e.w)+(w.k&&w.k[k[t]]||0)+e.w*h:0,m=1}x&&x.d&&(n+=b.transformPath(x.d,["t",l*j,r*j,"s",j,j,p,s,"t",(a-p)/j,(c-s)/j]))}}return this.path(n).attr({fill:"#000",stroke:"none"})},u.add=function(a){if(b.is(a,"array"))for(var c,d=this.set(),e=0,f=a.length;e<f;e++)c=a[e]||{},w[y](c.type)&&d.push(this[c.type]().attr(c));return d},b.format=function(a,c){var d=b.is(c,U)?[0][D](c):arguments;return a&&b.is(a,T)&&d.length-1&&(a=a.replace(x,function(a,b){return null==d[++b]?F:d[b]})),a||F},b.fullfill=function(){var a=/\{([^\}]+)\}/g,b=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,c=function(a,c,d){var e=d;return c.replace(b,function(a,b,c,d,f){b=b||d,e&&(b in e&&(e=e[b]),"function"==typeof e&&f&&(e=e()))}),e=(null==e||e==d?a:e)+""};return function(b,d){return String(b).replace(a,function(a,b){return c(a,b,d)})}}(),b.ninja=function(){return A.was?z.win.Raphael=A.is:delete Raphael,b},b.st=kb,a.on("raphael.DOMload",function(){t=!0}),function(a,c,d){function e(){/in/.test(a.readyState)?setTimeout(e,9):b.eve("raphael.DOMload")}null==a.readyState&&a.addEventListener&&(a.addEventListener(c,d=function(){a.removeEventListener(c,d,!1),a.readyState="complete"},!1),a.readyState="loading"),e()}(document,"DOMContentLoaded"),b}),function(a,b){"function"==typeof define&&define.amd?define("raphael.svg",["raphael.core"],function(a){return b(a)}):b("object"==typeof exports?require("raphael.core"):a.Raphael)}(this,function(a){if(!a||a.svg){var b="hasOwnProperty",c=String,d=parseFloat,e=parseInt,f=Math,g=f.max,h=f.abs,i=f.pow,j=/[, ]+/,k=a.eve,l="",m=" ",n="http://www.w3.org/1999/xlink",o={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},p={};a.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var q=function(d,e){if(e){"string"==typeof d&&(d=q(d));for(var f in e)e[b](f)&&("xlink:"==f.substring(0,6)?d.setAttributeNS(n,f.substring(6),c(e[f])):d.setAttribute(f,c(e[f])))}else d=a._g.doc.createElementNS("http://www.w3.org/2000/svg",d),d.style&&(d.style.webkitTapHighlightColor="rgba(0,0,0,0)");return d},r=function(b,e){var j="linear",k=b.id+e,m=.5,n=.5,o=b.node,p=b.paper,r=o.style,s=a._g.doc.getElementById(k);if(!s){if(e=c(e).replace(a._radial_gradient,function(a,b,c){if(j="radial",b&&c){m=d(b),n=d(c);var e=2*(n>.5)-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&.5!=n&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/),"linear"==j){var t=e.shift();if(t=-d(t),isNaN(t))return null;var u=[0,0,f.cos(a.rad(t)),f.sin(a.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=a._parseDots(e);if(!w)return null;if(k=k.replace(/[\(\)\s,\xb0#]/g,"_"),b.gradient&&k!=b.gradient.id&&(p.defs.removeChild(b.gradient),delete b.gradient),!b.gradient){s=q(j+"Gradient",{id:k}),b.gradient=s,q(s,"radial"==j?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:b.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;x<y;x++)s.appendChild(q("stop",{offset:w[x].offset?w[x].offset:x?"100%":"0%","stop-color":w[x].color||"#fff","stop-opacity":isFinite(w[x].opacity)?w[x].opacity:1}))}}return q(o,{fill:"url('"+document.location.origin+document.location.pathname+"#"+k+"')",opacity:1,"fill-opacity":1}),r.fill=l,r.opacity=1,r.fillOpacity=1,1},s=function(a){var b=a.getBBox(1);q(a.pattern,{patternTransform:a.matrix.invert()+" translate("+b.x+","+b.y+")"})},t=function(d,e,f){if("path"==d.type){for(var g,h,i,j,k,m=c(e).toLowerCase().split("-"),n=d.paper,r=f?"end":"start",s=d.node,t=d.attrs,u=t["stroke-width"],v=m.length,w="classic",x=3,y=3,z=5;v--;)switch(m[v]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":w=m[v];break;case"wide":y=5;break;case"narrow":y=2;break;case"long":x=5;break;case"short":x=2}if("open"==w?(x+=2,y+=2,z+=2,i=1,j=f?4:1,k={fill:"none",stroke:t.stroke}):(j=i=x/2,k={fill:t.stroke,stroke:"none"}),d._.arrows?f?(d._.arrows.endPath&&p[d._.arrows.endPath]--,d._.arrows.endMarker&&p[d._.arrows.endMarker]--):(d._.arrows.startPath&&p[d._.arrows.startPath]--,d._.arrows.startMarker&&p[d._.arrows.startMarker]--):d._.arrows={},"none"!=w){var A="raphael-marker-"+w,B="raphael-marker-"+r+w+x+y+"-obj"+d.id;a._g.doc.getElementById(A)?p[A]++:(n.defs.appendChild(q(q("path"),{"stroke-linecap":"round",d:o[w],id:A})),p[A]=1);var C,D=a._g.doc.getElementById(B);D?(p[B]++,C=D.getElementsByTagName("use")[0]):(D=q(q("marker"),{id:B,markerHeight:y,markerWidth:x,orient:"auto",refX:j,refY:y/2}),C=q(q("use"),{"xlink:href":"#"+A,transform:(f?"rotate(180 "+x/2+" "+y/2+") ":l)+"scale("+x/z+","+y/z+")","stroke-width":(1/((x/z+y/z)/2)).toFixed(4)}),D.appendChild(C),n.defs.appendChild(D),p[B]=1),q(C,k);var E=i*("diamond"!=w&&"oval"!=w);f?(g=d._.arrows.startdx*u||0,h=a.getTotalLength(t.path)-E*u):(g=E*u,h=a.getTotalLength(t.path)-(d._.arrows.enddx*u||0)),k={},k["marker-"+r]="url(#"+B+")",(h||g)&&(k.d=a.getSubpath(t.path,g,h)),q(s,k),d._.arrows[r+"Path"]=A,d._.arrows[r+"Marker"]=B,d._.arrows[r+"dx"]=E,d._.arrows[r+"Type"]=w,d._.arrows[r+"String"]=e}else f?(g=d._.arrows.startdx*u||0,h=a.getTotalLength(t.path)-g):(g=0,h=a.getTotalLength(t.path)-(d._.arrows.enddx*u||0)),d._.arrows[r+"Path"]&&q(s,{d:a.getSubpath(t.path,g,h)}),delete d._.arrows[r+"Path"],delete d._.arrows[r+"Marker"],delete d._.arrows[r+"dx"],delete d._.arrows[r+"Type"],delete d._.arrows[r+"String"];for(k in p)if(p[b](k)&&!p[k]){var F=a._g.doc.getElementById(k);F&&F.parentNode.removeChild(F)}}},u={"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},v=function(a,b,d){if(b=u[c(b).toLowerCase()]){for(var e=a.attrs["stroke-width"]||"1",f={round:e,square:e,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],h=b.length;h--;)g[h]=b[h]*e+(h%2?1:-1)*f;q(a.node,{"stroke-dasharray":g.join(",")})}else q(a.node,{"stroke-dasharray":"none"})},w=function(d,f){var i=d.node,k=d.attrs,m=i.style.visibility;i.style.visibility="hidden";for(var o in f)if(f[b](o)){if(!a._availableAttrs[b](o))continue;var p=f[o];switch(k[o]=p,o){case"blur":d.blur(p);break;case"title":var u=i.getElementsByTagName("title");if(u.length&&(u=u[0]))u.firstChild.nodeValue=p;else{u=q("title");var w=a._g.doc.createTextNode(p);u.appendChild(w),i.appendChild(u)}break;case"href":case"target":var x=i.parentNode;if("a"!=x.tagName.toLowerCase()){var z=q("a");x.insertBefore(z,i),z.appendChild(i),x=z}"target"==o?x.setAttributeNS(n,"show","blank"==p?"new":p):x.setAttributeNS(n,o,p);break;case"cursor":i.style.cursor=p;break;case"transform":d.transform(p);break;case"arrow-start":t(d,p);break;case"arrow-end":t(d,p,1);break;case"clip-rect":var A=c(p).split(j);if(4==A.length){d.clip&&d.clip.parentNode.parentNode.removeChild(d.clip.parentNode);var B=q("clipPath"),C=q("rect");B.id=a.createUUID(),q(C,{x:A[0],y:A[1],width:A[2],height:A[3]}),B.appendChild(C),d.paper.defs.appendChild(B),q(i,{"clip-path":"url(#"+B.id+")"}),d.clip=C}if(!p){var D=i.getAttribute("clip-path");if(D){var E=a._g.doc.getElementById(D.replace(/(^url\(#|\)$)/g,l));E&&E.parentNode.removeChild(E),q(i,{"clip-path":l}),delete d.clip}}break;case"path":"path"==d.type&&(q(i,{d:p?k.path=a._pathToAbsolute(p):"M0,0"}),d._.dirty=1,d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1)));break;case"width":if(i.setAttribute(o,p),d._.dirty=1,!k.fx)break;o="x",p=k.x;case"x":k.fx&&(p=-k.x-(k.width||0));case"rx":if("rx"==o&&"rect"==d.type)break;case"cx":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"height":if(i.setAttribute(o,p),d._.dirty=1,!k.fy)break;o="y",p=k.y;case"y":k.fy&&(p=-k.y-(k.height||0));case"ry":if("ry"==o&&"rect"==d.type)break;case"cy":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"r":"rect"==d.type?q(i,{rx:p,ry:p}):i.setAttribute(o,p),d._.dirty=1;break;case"src":"image"==d.type&&i.setAttributeNS(n,"href",p);break;case"stroke-width":1==d._.sx&&1==d._.sy||(p/=g(h(d._.sx),h(d._.sy))||1),i.setAttribute(o,p),k["stroke-dasharray"]&&v(d,k["stroke-dasharray"],f),d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"stroke-dasharray":v(d,p,f);break;case"fill":var F=c(p).match(a._ISURL);if(F){B=q("pattern");var G=q("image");B.id=a.createUUID(),q(B,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),q(G,{x:0,y:0,"xlink:href":F[1]}),B.appendChild(G),function(b){a._preload(F[1],function(){var a=this.offsetWidth,c=this.offsetHeight;q(b,{width:a,height:c}),q(G,{width:a,height:c})})}(B),d.paper.defs.appendChild(B),q(i,{fill:"url(#"+B.id+")"}),d.pattern=B,d.pattern&&s(d);break}var H=a.getRGB(p);if(H.error){if(("circle"==d.type||"ellipse"==d.type||"r"!=c(p).charAt())&&r(d,p)){if("opacity"in k||"fill-opacity"in k){var I=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l));if(I){var J=I.getElementsByTagName("stop");q(J[J.length-1],{"stop-opacity":("opacity"in k?k.opacity:1)*("fill-opacity"in k?k["fill-opacity"]:1)})}}k.gradient=p,k.fill="none";break}}else delete f.gradient,delete k.gradient,!a.is(k.opacity,"undefined")&&a.is(f.opacity,"undefined")&&q(i,{opacity:k.opacity}),!a.is(k["fill-opacity"],"undefined")&&a.is(f["fill-opacity"],"undefined")&&q(i,{"fill-opacity":k["fill-opacity"]});H[b]("opacity")&&q(i,{"fill-opacity":H.opacity>1?H.opacity/100:H.opacity});case"stroke":H=a.getRGB(p),i.setAttribute(o,H.hex),"stroke"==o&&H[b]("opacity")&&q(i,{"stroke-opacity":H.opacity>1?H.opacity/100:H.opacity}),"stroke"==o&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":("circle"==d.type||"ellipse"==d.type||"r"!=c(p).charAt())&&r(d,p);break;case"opacity":k.gradient&&!k[b]("stroke-opacity")&&q(i,{"stroke-opacity":p>1?p/100:p});case"fill-opacity":if(k.gradient){I=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),I&&(J=I.getElementsByTagName("stop"),q(J[J.length-1],{"stop-opacity":p}));break}default:"font-size"==o&&(p=e(p,10)+"px");var K=o.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[K]=p,d._.dirty=1,i.setAttribute(o,p)}}y(d,f),i.style.visibility=m},x=1.2,y=function(d,f){if("text"==d.type&&(f[b]("text")||f[b]("font")||f[b]("font-size")||f[b]("x")||f[b]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(a._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10;if(f[b]("text")){for(g.text=f.text;h.firstChild;)h.removeChild(h.firstChild);for(var j,k=c(f.text).split("\n"),m=[],n=0,o=k.length;n<o;n++)j=q("tspan"),n&&q(j,{dy:i*x,x:g.x}),j.appendChild(a._g.doc.createTextNode(k[n])),h.appendChild(j),m[n]=j}else for(m=h.getElementsByTagName("tspan"),n=0,o=m.length;n<o;n++)n?q(m[n],{dy:i*x,x:g.x}):q(m[0],{dy:0});q(h,{x:g.x,y:g.y}),d._.dirty=1;var p=d._getBBox(),r=g.y-(p.y+p.height/2);r&&a.is(r,"finite")&&q(m[0],{dy:r})}},z=function(a){return a.parentNode&&"a"===a.parentNode.tagName.toLowerCase()?a.parentNode:a},A=function(b,c){this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.matrix=a.matrix(),this.realPath=null,this.paper=c,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},B=a.el;A.prototype=B,B.constructor=A,a._engine.path=function(a,b){var c=q("path");b.canvas&&b.canvas.appendChild(c);var d=new A(c,b);return d.type="path",w(d,{fill:"none",stroke:"#000",path:a}),d},B.rotate=function(a,b,e){if(this.removed)return this;if(a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),null==e&&(b=e),null==b||null==e){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}return this.transform(this._.transform.concat([["r",a,b,e]])),this},B.scale=function(a,b,e,f){if(this.removed)return this;if(a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3])),a=d(a[0]),null==b&&(b=a),null==f&&(e=f),null==e||null==f)var g=this.getBBox(1);return e=null==e?g.x+g.width/2:e,f=null==f?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]])),this},B.translate=function(a,b){return this.removed?this:(a=c(a).split(j),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this.transform(this._.transform.concat([["t",a,b]])),this)},B.transform=function(c){var d=this._;if(null==c)return d.transform;if(a._extractTransform(this,c),this.clip&&q(this.clip,{transform:this.matrix.invert()}),this.pattern&&s(this),this.node&&q(this.node,{transform:this.matrix}),1!=d.sx||1!=d.sy){var e=this.attrs[b]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":e})}return this},B.hide=function(){return this.removed||(this.node.style.display="none"),this},B.show=function(){return this.removed||(this.node.style.display=""),this},B.remove=function(){var b=z(this.node);if(!this.removed&&b.parentNode){var c=this.paper;c.__set__&&c.__set__.exclude(this),k.unbind("raphael.*.*."+this.id),this.gradient&&c.defs.removeChild(this.gradient),a._tear(this,c),b.parentNode.removeChild(b),this.removeData();for(var d in this)this[d]="function"==typeof this[d]?a._removedFactory(d):null;this.removed=!0}},B._getBBox=function(){if("none"==this.node.style.display){this.show();var a=!0}var b,c=!1;this.paper.canvas.parentElement?b=this.paper.canvas.parentElement.style:this.paper.canvas.parentNode&&(b=this.paper.canvas.parentNode.style),b&&"none"==b.display&&(c=!0,b.display="");var d={};try{d=this.node.getBBox()}catch(e){d={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}finally{d=d||{},c&&(b.display="none")}return a&&this.hide(),d},B.attr=function(c,d){if(this.removed)return this;if(null==c){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);return e.gradient&&"none"==e.fill&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform,e}if(null==d&&a.is(c,"string")){if("fill"==c&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;if("transform"==c)return this._.transform;for(var g=c.split(j),h={},i=0,l=g.length;i<l;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return l-1?h:h[g[0]]}if(null==d&&a.is(c,"array")){for(h={},i=0,l=c.length;i<l;i++)h[c[i]]=this.attr(c[i]);return h}if(null!=d){var m={};m[c]=d}else null!=c&&a.is(c,"object")&&(m=c);for(var n in m)k("raphael.attr."+n+"."+this.id,this,m[n]);for(n in this.paper.customAttributes)if(this.paper.customAttributes[b](n)&&m[b](n)&&a.is(this.paper.customAttributes[n],"function")){var o=this.paper.customAttributes[n].apply(this,[].concat(m[n]));this.attrs[n]=m[n];for(var p in o)o[b](p)&&(m[p]=o[p])}return w(this,m),this},B.toFront=function(){if(this.removed)return this;var b=z(this.node);b.parentNode.appendChild(b);var c=this.paper;return c.top!=this&&a._tofront(this,c),this},B.toBack=function(){if(this.removed)return this;var b=z(this.node),c=b.parentNode;c.insertBefore(b,c.firstChild),a._toback(this,this.paper);this.paper;return this},B.insertAfter=function(b){if(this.removed||!b)return this;var c=z(this.node),d=z(b.node||b[b.length-1].node);return d.nextSibling?d.parentNode.insertBefore(c,d.nextSibling):d.parentNode.appendChild(c),a._insertafter(this,b,this.paper),this},B.insertBefore=function(b){if(this.removed||!b)return this;var c=z(this.node),d=z(b.node||b[0].node);return d.parentNode.insertBefore(c,d),a._insertbefore(this,b,this.paper),this},B.blur=function(b){var c=this;if(0!==+b){var d=q("filter"),e=q("feGaussianBlur");c.attrs.blur=b,d.id=a.createUUID(),q(e,{stdDeviation:+b||1.5}),d.appendChild(e),c.paper.defs.appendChild(d),c._blur=d,q(c.node,{filter:"url(#"+d.id+")"})}else c._blur&&(c._blur.parentNode.removeChild(c._blur),delete c._blur,delete c.attrs.blur),c.node.removeAttribute("filter");return c},a._engine.circle=function(a,b,c,d){var e=q("circle");a.canvas&&a.canvas.appendChild(e);var f=new A(e,a);return f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",q(e,f.attrs),f},a._engine.rect=function(a,b,c,d,e,f){var g=q("rect");a.canvas&&a.canvas.appendChild(g);var h=new A(g,a);return h.attrs={x:b,y:c,width:d,height:e,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},h.type="rect",q(g,h.attrs),h},a._engine.ellipse=function(a,b,c,d,e){var f=q("ellipse");a.canvas&&a.canvas.appendChild(f);var g=new A(f,a);return g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",q(f,g.attrs),g},a._engine.image=function(a,b,c,d,e,f){var g=q("image");q(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(n,"href",b),a.canvas&&a.canvas.appendChild(g);var h=new A(g,a);return h.attrs={x:c,y:d,width:e,height:f,src:b},h.type="image",h},a._engine.text=function(b,c,d,e){var f=q("text");b.canvas&&b.canvas.appendChild(f);var g=new A(f,b);return g.attrs={x:c,y:d,"text-anchor":"middle",text:e,"font-family":a._availableAttrs["font-family"],"font-size":a._availableAttrs["font-size"],stroke:"none",fill:"#000"},g.type="text",w(g,g.attrs),g},a._engine.setSize=function(a,b){return this.width=a||this.width,this.height=b||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox),this},a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b&&b.container,d=b.x,e=b.y,f=b.width,g=b.height;if(!c)throw new Error("SVG container not found.");var h,i=q("svg"),j="overflow:hidden;";return d=d||0,e=e||0,f=f||512,g=g||342,q(i,{height:g,version:1.1,width:f,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}),1==c?(i.style.cssText=j+"position:absolute;left:"+d+"px;top:"+e+"px",a._g.doc.body.appendChild(i),h=1):(i.style.cssText=j+"position:relative",c.firstChild?c.insertBefore(i,c.firstChild):c.appendChild(i)),c=new a._Paper,c.width=f,c.height=g,c.canvas=i,c.clear(),c._left=c._top=0,h&&(c.renderfix=function(){}),c.renderfix(),c},a._engine.setViewBox=function(a,b,c,d,e){k("raphael.setViewBox",this,this._viewBox,[a,b,c,d,e]);
var f,h,i=this.getSize(),j=g(c/i.width,d/i.height),l=this.top,n=e?"xMidYMid meet":"xMinYMin";for(null==a?(this._vbSize&&(j=1),delete this._vbSize,f="0 0 "+this.width+m+this.height):(this._vbSize=j,f=a+m+b+m+c+m+d),q(this.canvas,{viewBox:f,preserveAspectRatio:n});j&&l;)h="stroke-width"in l.attrs?l.attrs["stroke-width"]:1,l.attr({"stroke-width":h}),l._.dirty=1,l._.dirtyT=1,l=l.prev;return this._viewBox=[a,b,c,d,!!e],this},a.prototype.renderfix=function(){var a,b=this.canvas,c=b.style;try{a=b.getScreenCTM()||b.createSVGMatrix()}catch(d){a=b.createSVGMatrix()}var e=-a.e%1,f=-a.f%1;(e||f)&&(e&&(this._left=(this._left+e)%1,c.left=this._left+"px"),f&&(this._top=(this._top+f)%1,c.top=this._top+"px"))},a.prototype.clear=function(){a.eve("raphael.clear",this);for(var b=this.canvas;b.firstChild;)b.removeChild(b.firstChild);this.bottom=this.top=null,(this.desc=q("desc")).appendChild(a._g.doc.createTextNode("Created with Raphaël "+a.version)),b.appendChild(this.desc),b.appendChild(this.defs=q("defs"))},a.prototype.remove=function(){k("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]="function"==typeof this[b]?a._removedFactory(b):null};var C=a.st;for(var D in B)B[b](D)&&!C[b](D)&&(C[D]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(D))}}),function(a,b){"function"==typeof define&&define.amd?define("raphael.vml",["raphael.core"],function(a){return b(a)}):b("object"==typeof exports?require("raphael"):a.Raphael)}(this,function(a){if(!a||a.vml){var b="hasOwnProperty",c=String,d=parseFloat,e=Math,f=e.round,g=e.max,h=e.min,i=e.abs,j="fill",k=/[, ]+/,l=a.eve,m=" progid:DXImageTransform.Microsoft",n=" ",o="",p={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},q=/([clmz]),?([^clmz]*)/gi,r=/ progid:\S+Blur\([^\)]+\)/g,s=/-?[^,\s-]+/g,t="position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)",u=21600,v={path:1,rect:1,image:1},w={circle:1,ellipse:1},x=function(b){var d=/[ahqstv]/gi,e=a._pathToAbsolute;if(c(b).match(d)&&(e=a._path2curve),d=/[clmz]/g,e==a._pathToAbsolute&&!c(b).match(d)){var g=c(b).replace(q,function(a,b,c){var d=[],e="m"==b.toLowerCase(),g=p[b];return c.replace(s,function(a){e&&2==d.length&&(g+=d+p["m"==b?"l":"L"],d=[]),d.push(f(a*u))}),g+d});return g}var h,i,j=e(b);g=[];for(var k=0,l=j.length;k<l;k++){h=j[k],i=j[k][0].toLowerCase(),"z"==i&&(i="x");for(var m=1,r=h.length;m<r;m++)i+=f(h[m]*u)+(m!=r-1?",":o);g.push(i)}return g.join(n)},y=function(b,c,d){var e=a.matrix();return e.rotate(-b,.5,.5),{dx:e.x(c,d),dy:e.y(c,d)}},z=function(a,b,c,d,e,f){var g=a._,h=a.matrix,k=g.fillpos,l=a.node,m=l.style,o=1,p="",q=u/b,r=u/c;if(m.visibility="hidden",b&&c){if(l.coordsize=i(q)+n+i(r),m.rotation=f*(b*c<0?-1:1),f){var s=y(f,d,e);d=s.dx,e=s.dy}if(b<0&&(p+="x"),c<0&&(p+=" y")&&(o=-1),m.flip=p,l.coordorigin=d*-q+n+e*-r,k||g.fillsize){var t=l.getElementsByTagName(j);t=t&&t[0],l.removeChild(t),k&&(s=y(f,h.x(k[0],k[1]),h.y(k[0],k[1])),t.position=s.dx*o+n+s.dy*o),g.fillsize&&(t.size=g.fillsize[0]*i(b)+n+g.fillsize[1]*i(c)),l.appendChild(t)}m.visibility="visible"}};a.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var A=function(a,b,d){for(var e=c(b).toLowerCase().split("-"),f=d?"end":"start",g=e.length,h="classic",i="medium",j="medium";g--;)switch(e[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":h=e[g];break;case"wide":case"narrow":j=e[g];break;case"long":case"short":i=e[g]}var k=a.node.getElementsByTagName("stroke")[0];k[f+"arrow"]=h,k[f+"arrowlength"]=i,k[f+"arrowwidth"]=j},B=function(e,i){e.attrs=e.attrs||{};var l=e.node,m=e.attrs,p=l.style,q=v[e.type]&&(i.x!=m.x||i.y!=m.y||i.width!=m.width||i.height!=m.height||i.cx!=m.cx||i.cy!=m.cy||i.rx!=m.rx||i.ry!=m.ry||i.r!=m.r),r=w[e.type]&&(m.cx!=i.cx||m.cy!=i.cy||m.r!=i.r||m.rx!=i.rx||m.ry!=i.ry),s=e;for(var t in i)i[b](t)&&(m[t]=i[t]);if(q&&(m.path=a._getPath[e.type](e),e._.dirty=1),i.href&&(l.href=i.href),i.title&&(l.title=i.title),i.target&&(l.target=i.target),i.cursor&&(p.cursor=i.cursor),"blur"in i&&e.blur(i.blur),(i.path&&"path"==e.type||q)&&(l.path=x(~c(m.path).toLowerCase().indexOf("r")?a._pathToAbsolute(m.path):m.path),e._.dirty=1,"image"==e.type&&(e._.fillpos=[m.x,m.y],e._.fillsize=[m.width,m.height],z(e,1,1,0,0,0))),"transform"in i&&e.transform(i.transform),r){var y=+m.cx,B=+m.cy,D=+m.rx||+m.r||0,E=+m.ry||+m.r||0;l.path=a.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((y-D)*u),f((B-E)*u),f((y+D)*u),f((B+E)*u),f(y*u)),e._.dirty=1}if("clip-rect"in i){var G=c(i["clip-rect"]).split(k);if(4==G.length){G[2]=+G[2]+ +G[0],G[3]=+G[3]+ +G[1];var H=l.clipRect||a._g.doc.createElement("div"),I=H.style;I.clip=a.format("rect({1}px {2}px {3}px {0}px)",G),l.clipRect||(I.position="absolute",I.top=0,I.left=0,I.width=e.paper.width+"px",I.height=e.paper.height+"px",l.parentNode.insertBefore(H,l),H.appendChild(l),l.clipRect=H)}i["clip-rect"]||l.clipRect&&(l.clipRect.style.clip="auto")}if(e.textpath){var J=e.textpath.style;i.font&&(J.font=i.font),i["font-family"]&&(J.fontFamily='"'+i["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,o)+'"'),i["font-size"]&&(J.fontSize=i["font-size"]),i["font-weight"]&&(J.fontWeight=i["font-weight"]),i["font-style"]&&(J.fontStyle=i["font-style"])}if("arrow-start"in i&&A(s,i["arrow-start"]),"arrow-end"in i&&A(s,i["arrow-end"],1),null!=i.opacity||null!=i["stroke-width"]||null!=i.fill||null!=i.src||null!=i.stroke||null!=i["stroke-width"]||null!=i["stroke-opacity"]||null!=i["fill-opacity"]||null!=i["stroke-dasharray"]||null!=i["stroke-miterlimit"]||null!=i["stroke-linejoin"]||null!=i["stroke-linecap"]){var K=l.getElementsByTagName(j),L=!1;if(K=K&&K[0],!K&&(L=K=F(j)),"image"==e.type&&i.src&&(K.src=i.src),i.fill&&(K.on=!0),null!=K.on&&"none"!=i.fill&&null!==i.fill||(K.on=!1),K.on&&i.fill){var M=c(i.fill).match(a._ISURL);if(M){K.parentNode==l&&l.removeChild(K),K.rotate=!0,K.src=M[1],K.type="tile";var N=e.getBBox(1);K.position=N.x+n+N.y,e._.fillpos=[N.x,N.y],a._preload(M[1],function(){e._.fillsize=[this.offsetWidth,this.offsetHeight]})}else K.color=a.getRGB(i.fill).hex,K.src=o,K.type="solid",a.getRGB(i.fill).error&&(s.type in{circle:1,ellipse:1}||"r"!=c(i.fill).charAt())&&C(s,i.fill,K)&&(m.fill="none",m.gradient=i.fill,K.rotate=!1)}if("fill-opacity"in i||"opacity"in i){var O=((+m["fill-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+a.getRGB(i.fill).o+1||2)-1);O=h(g(O,0),1),K.opacity=O,K.src&&(K.color="none")}l.appendChild(K);var P=l.getElementsByTagName("stroke")&&l.getElementsByTagName("stroke")[0],Q=!1;!P&&(Q=P=F("stroke")),(i.stroke&&"none"!=i.stroke||i["stroke-width"]||null!=i["stroke-opacity"]||i["stroke-dasharray"]||i["stroke-miterlimit"]||i["stroke-linejoin"]||i["stroke-linecap"])&&(P.on=!0),("none"==i.stroke||null===i.stroke||null==P.on||0==i.stroke||0==i["stroke-width"])&&(P.on=!1);var R=a.getRGB(i.stroke);P.on&&i.stroke&&(P.color=R.hex),O=((+m["stroke-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+R.o+1||2)-1);var S=.75*(d(i["stroke-width"])||1);if(O=h(g(O,0),1),null==i["stroke-width"]&&(S=m["stroke-width"]),i["stroke-width"]&&(P.weight=S),S&&S<1&&(O*=S)&&(P.weight=1),P.opacity=O,i["stroke-linejoin"]&&(P.joinstyle=i["stroke-linejoin"]||"miter"),P.miterlimit=i["stroke-miterlimit"]||8,i["stroke-linecap"]&&(P.endcap="butt"==i["stroke-linecap"]?"flat":"square"==i["stroke-linecap"]?"square":"round"),"stroke-dasharray"in i){var T={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};P.dashstyle=T[b](i["stroke-dasharray"])?T[i["stroke-dasharray"]]:o}Q&&l.appendChild(P)}if("text"==s.type){s.paper.canvas.style.display=o;var U=s.paper.span,V=100,W=m.font&&m.font.match(/\d+(?:\.\d*)?(?=px)/);p=U.style,m.font&&(p.font=m.font),m["font-family"]&&(p.fontFamily=m["font-family"]),m["font-weight"]&&(p.fontWeight=m["font-weight"]),m["font-style"]&&(p.fontStyle=m["font-style"]),W=d(m["font-size"]||W&&W[0])||10,p.fontSize=W*V+"px",s.textpath.string&&(U.innerHTML=c(s.textpath.string).replace(/</g,"&#60;").replace(/&/g,"&#38;").replace(/\n/g,"<br>"));var X=U.getBoundingClientRect();s.W=m.w=(X.right-X.left)/V,s.H=m.h=(X.bottom-X.top)/V,s.X=m.x,s.Y=m.y+s.H/2,("x"in i||"y"in i)&&(s.path.v=a.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));for(var Y=["x","y","text","font","font-family","font-weight","font-style","font-size"],Z=0,$=Y.length;Z<$;Z++)if(Y[Z]in i){s._.dirty=1;break}switch(m["text-anchor"]){case"start":s.textpath.style["v-text-align"]="left",s.bbx=s.W/2;break;case"end":s.textpath.style["v-text-align"]="right",s.bbx=-s.W/2;break;default:s.textpath.style["v-text-align"]="center",s.bbx=0}s.textpath.style["v-text-kern"]=!0}},C=function(b,f,g){b.attrs=b.attrs||{};var h=(b.attrs,Math.pow),i="linear",j=".5 .5";if(b.attrs.gradient=f,f=c(f).replace(a._radial_gradient,function(a,b,c){return i="radial",b&&c&&(b=d(b),c=d(c),h(b-.5,2)+h(c-.5,2)>.25&&(c=e.sqrt(.25-h(b-.5,2))*(2*(c>.5)-1)+.5),j=b+n+c),o}),f=f.split(/\s*\-\s*/),"linear"==i){var k=f.shift();if(k=-d(k),isNaN(k))return null}var l=a._parseDots(f);if(!l)return null;if(b=b.shape||b.node,l.length){b.removeChild(g),g.on=!0,g.method="none",g.color=l[0].color,g.color2=l[l.length-1].color;for(var m=[],p=0,q=l.length;p<q;p++)l[p].offset&&m.push(l[p].offset+n+l[p].color);g.colors=m.length?m.join():"0% "+g.color,"radial"==i?(g.type="gradientTitle",g.focus="100%",g.focussize="0 0",g.focusposition=j,g.angle=0):(g.type="gradient",g.angle=(270-k)%360),b.appendChild(g)}return 1},D=function(b,c){this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=c,this.matrix=a.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},E=a.el;D.prototype=E,E.constructor=D,E.transform=function(b){if(null==b)return this._.transform;var d,e=this.paper._viewBoxShift,f=e?"s"+[e.scale,e.scale]+"-1-1t"+[e.dx,e.dy]:o;e&&(d=b=c(b).replace(/\.{3}|\u2026/g,this._.transform||o)),a._extractTransform(this,f+b);var g,h=this.matrix.clone(),i=this.skew,j=this.node,k=~c(this.attrs.fill).indexOf("-"),l=!c(this.attrs.fill).indexOf("url(");if(h.translate(1,1),l||k||"image"==this.type)if(i.matrix="1 0 0 1",i.offset="0 0",g=h.split(),k&&g.noRotation||!g.isSimple){j.style.filter=h.toFilter();var m=this.getBBox(),p=this.getBBox(1),q=m.x-p.x,r=m.y-p.y;j.coordorigin=q*-u+n+r*-u,z(this,1,1,q,r,0)}else j.style.filter=o,z(this,g.scalex,g.scaley,g.dx,g.dy,g.rotate);else j.style.filter=o,i.matrix=c(h),i.offset=h.offset();return null!==d&&(this._.transform=d,a._extractTransform(this,d)),this},E.rotate=function(a,b,e){if(this.removed)return this;if(null!=a){if(a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),null==e&&(b=e),null==b||null==e){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}return this._.dirtyT=1,this.transform(this._.transform.concat([["r",a,b,e]])),this}},E.translate=function(a,b){return this.removed?this:(a=c(a).split(k),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this._.bbox&&(this._.bbox.x+=a,this._.bbox.y+=b),this.transform(this._.transform.concat([["t",a,b]])),this)},E.scale=function(a,b,e,f){if(this.removed)return this;if(a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3]),isNaN(e)&&(e=null),isNaN(f)&&(f=null)),a=d(a[0]),null==b&&(b=a),null==f&&(e=f),null==e||null==f)var g=this.getBBox(1);return e=null==e?g.x+g.width/2:e,f=null==f?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]])),this._.dirtyT=1,this},E.hide=function(){return!this.removed&&(this.node.style.display="none"),this},E.show=function(){return!this.removed&&(this.node.style.display=o),this},E.auxGetBBox=a.el.getBBox,E.getBBox=function(){var a=this.auxGetBBox();if(this.paper&&this.paper._viewBoxShift){var b={},c=1/this.paper._viewBoxShift.scale;return b.x=a.x-this.paper._viewBoxShift.dx,b.x*=c,b.y=a.y-this.paper._viewBoxShift.dy,b.y*=c,b.width=a.width*c,b.height=a.height*c,b.x2=b.x+b.width,b.y2=b.y+b.height,b}return a},E._getBBox=function(){return this.removed?{}:{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},E.remove=function(){if(!this.removed&&this.node.parentNode){this.paper.__set__&&this.paper.__set__.exclude(this),a.eve.unbind("raphael.*.*."+this.id),a._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var b in this)this[b]="function"==typeof this[b]?a._removedFactory(b):null;this.removed=!0}},E.attr=function(c,d){if(this.removed)return this;if(null==c){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);return e.gradient&&"none"==e.fill&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform,e}if(null==d&&a.is(c,"string")){if(c==j&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;for(var g=c.split(k),h={},i=0,m=g.length;i<m;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return m-1?h:h[g[0]]}if(this.attrs&&null==d&&a.is(c,"array")){for(h={},i=0,m=c.length;i<m;i++)h[c[i]]=this.attr(c[i]);return h}var n;null!=d&&(n={},n[c]=d),null==d&&a.is(c,"object")&&(n=c);for(var o in n)l("raphael.attr."+o+"."+this.id,this,n[o]);if(n){for(o in this.paper.customAttributes)if(this.paper.customAttributes[b](o)&&n[b](o)&&a.is(this.paper.customAttributes[o],"function")){var p=this.paper.customAttributes[o].apply(this,[].concat(n[o]));this.attrs[o]=n[o];for(var q in p)p[b](q)&&(n[q]=p[q])}n.text&&"text"==this.type&&(this.textpath.string=n.text),B(this,n)}return this},E.toFront=function(){return!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&a._tofront(this,this.paper),this},E.toBack=function(){return this.removed?this:(this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper)),this)},E.insertAfter=function(b){return this.removed?this:(b.constructor==a.st.constructor&&(b=b[b.length-1]),b.node.nextSibling?b.node.parentNode.insertBefore(this.node,b.node.nextSibling):b.node.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper),this)},E.insertBefore=function(b){return this.removed?this:(b.constructor==a.st.constructor&&(b=b[0]),b.node.parentNode.insertBefore(this.node,b.node),a._insertbefore(this,b,this.paper),this)},E.blur=function(b){var c=this.node.runtimeStyle,d=c.filter;return d=d.replace(r,o),0!==+b?(this.attrs.blur=b,c.filter=d+n+m+".Blur(pixelradius="+(+b||1.5)+")",c.margin=a.format("-{0}px 0 0 -{0}px",f(+b||1.5))):(c.filter=d,c.margin=0,delete this.attrs.blur),this},a._engine.path=function(a,b){var c=F("shape");c.style.cssText=t,c.coordsize=u+n+u,c.coordorigin=b.coordorigin;var d=new D(c,b),e={fill:"none",stroke:"#000"};a&&(e.path=a),d.type="path",d.path=[],d.Path=o,B(d,e),b.canvas.appendChild(c);var f=F("skew");return f.on=!0,c.appendChild(f),d.skew=f,d.transform(o),d},a._engine.rect=function(b,c,d,e,f,g){var h=a._rectPath(c,d,e,f,g),i=b.path(h),j=i.attrs;return i.X=j.x=c,i.Y=j.y=d,i.W=j.width=e,i.H=j.height=f,j.r=g,j.path=h,i.type="rect",i},a._engine.ellipse=function(a,b,c,d,e){var f=a.path();f.attrs;return f.X=b-d,f.Y=c-e,f.W=2*d,f.H=2*e,f.type="ellipse",B(f,{cx:b,cy:c,rx:d,ry:e}),f},a._engine.circle=function(a,b,c,d){var e=a.path();e.attrs;return e.X=b-d,e.Y=c-d,e.W=e.H=2*d,e.type="circle",B(e,{cx:b,cy:c,r:d}),e},a._engine.image=function(b,c,d,e,f,g){var h=a._rectPath(d,e,f,g),i=b.path(h).attr({stroke:"none"}),k=i.attrs,l=i.node,m=l.getElementsByTagName(j)[0];return k.src=c,i.X=k.x=d,i.Y=k.y=e,i.W=k.width=f,i.H=k.height=g,k.path=h,i.type="image",m.parentNode==l&&l.removeChild(m),m.rotate=!0,m.src=c,m.type="tile",i._.fillpos=[d,e],i._.fillsize=[f,g],l.appendChild(m),z(i,1,1,0,0,0),i},a._engine.text=function(b,d,e,g){var h=F("shape"),i=F("path"),j=F("textpath");d=d||0,e=e||0,g=g||"",i.v=a.format("m{0},{1}l{2},{1}",f(d*u),f(e*u),f(d*u)+1),i.textpathok=!0,j.string=c(g),j.on=!0,h.style.cssText=t,h.coordsize=u+n+u,h.coordorigin="0 0";var k=new D(h,b),l={fill:"#000",stroke:"none",font:a._availableAttrs.font,text:g};k.shape=h,k.path=i,k.textpath=j,k.type="text",k.attrs.text=c(g),k.attrs.x=d,k.attrs.y=e,k.attrs.w=1,k.attrs.h=1,B(k,l),h.appendChild(j),h.appendChild(i),b.canvas.appendChild(h);var m=F("skew");return m.on=!0,h.appendChild(m),k.skew=m,k.transform(o),k},a._engine.setSize=function(b,c){var d=this.canvas.style;return this.width=b,this.height=c,b==+b&&(b+="px"),c==+c&&(c+="px"),d.width=b,d.height=c,d.clip="rect(0 "+b+" "+c+" 0)",this._viewBox&&a._engine.setViewBox.apply(this,this._viewBox),this},a._engine.setViewBox=function(b,c,d,e,f){a.eve("raphael.setViewBox",this,this._viewBox,[b,c,d,e,f]);var g,h,i=this.getSize(),j=i.width,k=i.height;return f&&(g=k/e,h=j/d,d*g<j&&(b-=(j-d*g)/2/g),e*h<k&&(c-=(k-e*h)/2/h)),this._viewBox=[b,c,d,e,!!f],this._viewBoxShift={dx:-b,dy:-c,scale:i},this.forEach(function(a){a.transform("...")}),this};var F;a._engine.initWin=function(a){var b=a.document;b.styleSheets.length<31?b.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"):b.styleSheets[0].addRule(".rvml","behavior:url(#default#VML)");try{!b.namespaces.rvml&&b.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),F=function(a){return b.createElement("<rvml:"+a+' class="rvml">')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},a._engine.initWin(a._g.win),a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b.container,d=b.height,e=b.width,f=b.x,g=b.y;if(!c)throw new Error("VML container not found.");var h=new a._Paper,i=h.canvas=a._g.doc.createElement("div"),j=i.style;return f=f||0,g=g||0,e=e||512,d=d||342,h.width=e,h.height=d,e==+e&&(e+="px"),d==+d&&(d+="px"),h.coordsize=1e3*u+n+1e3*u,h.coordorigin="0 0",h.span=a._g.doc.createElement("span"),h.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",i.appendChild(h.span),j.cssText=a.format("top:0;left:0;display:inline-block;position:absolute;clip:rect(0 {0} {1} 0);",e,d),1==c?(a._g.doc.body.appendChild(i),j.left=f+"px",j.top=g+"px",j.position="absolute"):c.firstChild?c.insertBefore(i,c.firstChild):c.appendChild(i),h.renderfix=function(){},h},a.prototype.clear=function(){a.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=a._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},a.prototype.remove=function(){a.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]="function"==typeof this[b]?a._removedFactory(b):null;return!0};var G=a.st;for(var H in E)E[b](H)&&!G[b](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}}),function(a,b){if("function"==typeof define&&define.amd)define("raphael",["raphael.core","raphael.svg","raphael.vml"],function(a){return b(a)});else if("object"==typeof exports){var c=require("raphael.core");require("raphael.svg"),require("raphael.vml"),module.exports=b(c)}}(this,function(a){return a.ninja()}),BI.Svg=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Svg.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-svg"})},_init:function(){BI.Svg.superclass._init.apply(this,arguments),this.paper=Raphael(this.element[0]),this.element.css("overflow","hidden"),$(this.paper.canvas).width("100%").height("100%").css({left:"0",top:"0"}).appendTo(this.element),this.top=this.paper.top,this.bottom=this.paper.bottom,this.customAttributes=this.paper.customAttributes,this.ca=this.paper.ca,this.raphael=this.paper.raphael},add:function(){return this.paper.add.apply(this.paper,arguments)},path:function(){return this.paper.path.apply(this.paper,arguments)},image:function(){return this.paper.image.apply(this.paper,arguments)},rect:function(){return this.paper.rect.apply(this.paper,arguments)},circle:function(){return this.paper.circle.apply(this.paper,arguments)},ellipse:function(){return this.paper.ellipse.apply(this.paper,arguments)},text:function(){return this.paper.text.apply(this.paper,arguments)},print:function(){return this.paper.print.apply(this.paper,arguments)},setStart:function(){return this.paper.setStart.apply(this.paper,arguments)},setFinish:function(){return this.paper.setFinish.apply(this.paper,arguments)},setSize:function(){return this.paper.setSize.apply(this.paper,arguments)},setViewBox:function(){return this.paper.setViewBox.apply(this.paper,arguments)},getById:function(){return this.paper.getById.apply(this.paper,arguments)},getElementByPoint:function(){return this.paper.getElementByPoint.apply(this.paper,arguments)},getElementsByPoint:function(){return this.paper.getElementsByPoint.apply(this.paper,arguments)},getFont:function(){return this.paper.getFont.apply(this.paper,arguments)},set:function(){return this.paper.set.apply(this.paper,arguments)},remove:function(){return this.paper.remove.apply(this.paper,arguments)},clear:function(){return this.paper.clear.apply(this.paper,arguments)}}),BI.shortcut("bi.svg",BI.Svg),BI.NativeTableScrollbar=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.NativeTableScrollbar.superclass._defaultConfig.apply(this,arguments),{attributes:{tabIndex:0},contentSize:0,defaultPosition:0,position:0,size:0})},render:function(){var a=this;this.options;this.element.width(36);var b=BI.throttle(function(){a.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL,a.element.scrollTop())},150,{leading:!1});return this.element.scroll(function(){b()}),{type:"bi.default",scrolly:!0,items:[{type:"bi.layout",width:1,ref:function(b){a.inner=b}}]}},mounted:function(){this._populate()},_populate:function(){var a=this.options;if(a.size<1||a.contentSize<=a.size)return void this.setVisible(!1);this.setVisible(!0);try{this.element.scrollTop(a.position)}catch(b){}this.inner.element.height(a.contentSize)},setContentSize:function(a){this.options.contentSize=a},setPosition:function(a){this.options.position=a},setSize:function(a){this.setHeight(a),this.options.size=a},populate:function(){this._populate()}}),BI.NativeTableScrollbar.EVENT_SCROLL="EVENT_SCROLL",BI.shortcut("bi.native_table_scrollbar",BI.NativeTableScrollbar),BI.NativeTableHorizontalScrollbar=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.NativeTableHorizontalScrollbar.superclass._defaultConfig.apply(this,arguments),{attributes:{tabIndex:0},contentSize:0,position:0,size:0})},render:function(){var a=this;this.options;this.element.height(36);var b=BI.throttle(function(){a.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL,a.element.scrollLeft())},150,{leading:!1});return this.element.scroll(function(){b()}),{type:"bi.default",scrollx:!0,items:[{type:"bi.layout",height:1,ref:function(b){a.inner=b}}]}},setContentSize:function(a){this.options.contentSize=a},setPosition:function(a){this.options.position=a},setSize:function(a){this.setWidth(a),this.options.size=a},_populate:function(){var a=this.options;if(a.size<1||a.contentSize<=a.size)return void this.setVisible(!1);this.setVisible(!0);try{this.element.scrollLeft(a.position)}catch(b){}this.inner.element.width(a.contentSize)},populate:function(){this._populate()}}),BI.NativeTableHorizontalScrollbar.EVENT_SCROLL="EVENT_SCROLL",BI.shortcut("bi.native_table_horizontal_scrollbar",BI.NativeTableHorizontalScrollbar),BI.TableCell=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.TableCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-table-cell",textAlign:"left",text:""})},_init:function(){BI.TableCell.superclass._init.apply(this,arguments),BI.createWidget({type:"bi.label",element:this,whiteSpace:"nowrap",textAlign:this.options.textAlign,height:this.options.height,text:this.options.text,value:this.options.value,lgap:5})}}),BI.shortcut("bi.table_cell",BI.TableCell),BI.CollectionTableCell=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.CollectionTableCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-collection-table-cell bi-border-right bi-border-bottom",width:0,height:0,_left:0,_top:0,cell:{}})},_init:function(){BI.CollectionTableCell.superclass._init.apply(this,arguments);var a=this.options;this.cell=BI.createWidget(BI.extend({type:"bi.label"},a.cell,{cls:(a.cell.cls||"")+" collection-table-cell-wrapper",width:a.width-(0===a._left?1:0)-1,height:a.height-(0===a._top?1:0)-1})),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.cell,left:0,right:0,top:0,bottom:0}]})},setWidth:function(a){BI.CollectionTableCell.superclass.setWidth.apply(this,arguments);var b=this.options;this.cell.setWidth(b.width-(0===b._left?1:0)-1)},setHeight:function(a){BI.CollectionTableCell.superclass.setHeight.apply(this,arguments);var b=this.options;this.cell.setHeight(b.height-(0===b._top?1:0)-1)}}),BI.shortcut("bi.collection_table_cell",BI.CollectionTableCell),BI.CollectionTable=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.CollectionTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-collection-table",headerRowSize:25,rowSize:25,columnSize:[],isNeedFreeze:!1,freezeCols:[],isNeedMerge:!1,mergeCols:[],mergeRule:BI.emptyFn,header:[],items:[],regionColumnSize:[]})},render:function(){var a=this,b=this.options;this._width=0,this._height=0,this._scrollBarSize=BI.DOM.getScrollWidth(),this.topLeftCollection=BI.createWidget({type:"bi.collection_view",cellSizeAndPositionGetter:function(b){return a.topLeftItems[b]}}),this.topLeftCollection.on(BI.CollectionView.EVENT_SCROLL,function(b){a.bottomLeftCollection.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.topRightCollection=BI.createWidget({type:"bi.collection_view",cellSizeAndPositionGetter:function(b){return a.topRightItems[b]}}),this.topRightCollection.on(BI.CollectionView.EVENT_SCROLL,function(b){a.bottomRightCollection.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.bottomLeftCollection=BI.createWidget({type:"bi.collection_view",cellSizeAndPositionGetter:function(b){return a.bottomLeftItems[b]}}),this.bottomLeftCollection.on(BI.CollectionView.EVENT_SCROLL,function(b){a.bottomRightCollection.setScrollTop(b.scrollTop),a.topLeftCollection.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.bottomRightCollection=BI.createWidget({type:"bi.collection_view",cellSizeAndPositionGetter:function(b){return a.bottomRightItems[b]}}),this.bottomRightCollection.on(BI.CollectionView.EVENT_SCROLL,function(b){a.bottomLeftCollection.setScrollTop(b.scrollTop),a.topRightCollection.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.topLeft=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.topLeftCollection]}),this.topRight=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.topRightCollection]}),this.bottomLeft=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.bottomLeftCollection]}),this.bottomRight=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.bottomRightCollection]}),this.contextLayout=BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.topLeft,top:0,left:0},{el:this.topRight,top:0},{el:this.bottomLeft,left:0},{el:this.bottomRight}]}),this.topScrollbar=BI.createWidget({type:"bi.grid_table_scrollbar",width:BI.GridTableScrollbar.SIZE}),this.topScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL,function(b){a.bottomLeftCollection.setScrollTop(b),a.bottomRightCollection.setScrollTop(b),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.leftScrollbar=BI.createWidget({type:"bi.grid_table_horizontal_scrollbar",height:BI.GridTableScrollbar.SIZE}),this.leftScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL,function(b){a.topLeftCollection.setScrollLeft(b),a.bottomLeftCollection.setScrollLeft(b),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.rightScrollbar=BI.createWidget({type:"bi.grid_table_horizontal_scrollbar",height:BI.GridTableScrollbar.SIZE}),this.rightScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL,function(b){a.topRightCollection.setScrollLeft(b),a.bottomRightCollection.setScrollLeft(b),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.scrollBarLayout=BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.topScrollbar,right:0,top:0},{el:this.leftScrollbar,left:0},{el:this.rightScrollbar}]}),this._width=b.width-BI.GridTableScrollbar.SIZE,this._height=b.height-BI.GridTableScrollbar.SIZE},mounted:function(){var a=this.options;(a.items.length>0||a.header.length>0)&&(this._digest(),this._populate())},_getFreezeColLength:function(){var a=this.options;return a.isNeedFreeze===!0?BI.clamp(a.freezeCols.length,0,a.columnSize.length):0},_getFreezeHeaderHeight:function(){var a=this.options;return a.header.length*a.headerRowSize>=this._height?0:a.header.length*a.headerRowSize},_getActualItems:function(){var a=this.options;return a.header.length*a.headerRowSize>=this._height?a.header.concat(a.items):a.items},_populateScrollbar:function(){var a=this.options,b=this.getRegionSize(),c=0,d=0,e=0,f=[];BI.each(a.columnSize,function(b,g){a.isNeedFreeze===!0&&a.freezeCols.contains(b)?c+=g:d+=g,e+=g,0===b?f[b]=g:f[b]=f[b-1]+g}),this.topScrollbar.setContentSize(this._getActualItems().length*a.rowSize),this.topScrollbar.setSize(this._height-this._getFreezeHeaderHeight()),this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop()),this.topScrollbar.populate(),this.leftScrollbar.setContentSize(c),this.leftScrollbar.setSize(b),this.leftScrollbar.setPosition(this.bottomLeftCollection.getScrollLeft()),this.leftScrollbar.populate(),this.rightScrollbar.setContentSize(d),this.rightScrollbar.setSize(this._width-b),this.rightScrollbar.setPosition(this.bottomRightCollection.getScrollLeft()),this.rightScrollbar.populate();var g=this.scrollBarLayout.attr("items");g[0].top=this._getFreezeHeaderHeight(),g[1].top=this._height,g[2].top=this._height,g[2].left=b,this.scrollBarLayout.attr("items",g),this.scrollBarLayout.resize()},_populateTable:function(){var a=this.options,b=this.getRegionSize(),c=0,d=0,e=0,f=[];BI.each(a.columnSize,function(b,g){a.isNeedFreeze===!0&&a.freezeCols.contains(b)?c+=g:d+=g,e+=g,0===b?f[b]=g:f[b]=f[b-1]+g});var g=b,h=this._getFreezeHeaderHeight(),i=this._width-b,j=this._getFreezeHeaderHeight(),k=b,l=this._height-h,m=this._width-b,n=this._height-j,o=g+this._scrollBarSize,p=h+this._scrollBarSize,q=i+this._scrollBarSize,r=j+this._scrollBarSize,s=k+this._scrollBarSize,t=l+this._scrollBarSize,u=m+this._scrollBarSize,v=n+this._scrollBarSize,w=function(a){a.element.css({overflow:"scroll",overflowX:"scroll",overflowY:"scroll"})};this.topLeft.setWidth(g),this.topLeft.setHeight(h),this.topRight.setWidth(i),this.topRight.setHeight(j),this.bottomLeft.setWidth(k),this.bottomLeft.setHeight(l),this.bottomRight.setWidth(m),this.bottomRight.setHeight(n),this.topLeftCollection.setWidth(o),this.topLeftCollection.setHeight(p),this.topRightCollection.setWidth(q),this.topRightCollection.setHeight(r),this.bottomLeftCollection.setWidth(s),this.bottomLeftCollection.setHeight(t),this.bottomRightCollection.setWidth(u),this.bottomRightCollection.setHeight(v),w(this.topLeftCollection),w(this.topRightCollection),w(this.bottomLeftCollection),w(this.bottomRightCollection);var x=this.contextLayout.attr("items");x[1].left=b,x[2].top=this._getFreezeHeaderHeight(),x[3].left=b,x[3].top=this._getFreezeHeaderHeight(),this.contextLayout.attr("items",x),this.contextLayout.resize();var y=[],z=[],A=[],B=[],C=function(a,b,c){BI.each(a,function(a,d){var e={type:"bi.collection_table_cell",
cell:b[d.row][d.col]};c.push(e)})};C(this.topLeftItems,a.header,y),C(this.topRightItems,a.header,z),C(this.bottomLeftItems,this._getActualItems(),A),C(this.bottomRightItems,this._getActualItems(),B),this.topLeftCollection._populate(y),this.topRightCollection._populate(z),this.bottomLeftCollection._populate(A),this.bottomRightCollection._populate(B)},_digest:function(){var a=this.options,b=this._getFreezeColLength();this._getFreezeHeaderHeight()<=0?(this.topLeftItems=[],this.topRightItems=[],this.bottomLeftItems=this._serialize(this._getActualItems(),0,b,a.rowSize,a.columnSize,a.mergeCols,BI.range(a.header.length)),this.bottomRightItems=this._serialize(this._getActualItems(),b,a.columnSize.length,a.rowSize,a.columnSize,a.mergeCols,BI.range(a.header.length))):(this.topLeftItems=this._serialize(a.header,0,b,a.headerRowSize,a.columnSize,a.mergeCols),this.topRightItems=this._serialize(a.header,b,a.columnSize.length,a.headerRowSize,a.columnSize,!0),this.bottomLeftItems=this._serialize(a.items,0,b,a.rowSize,a.columnSize,a.mergeCols),this.bottomRightItems=this._serialize(a.items,b,a.columnSize.length,a.rowSize,a.columnSize,a.mergeCols))},_serialize:function(a,b,c,d,e,f,g){f=f||[],g=g||[];for(var h=this.options,i=[],j={},k={},l={},m={},n=[],o=b;o<c;o++)o===b?n[o]=e[o]:n[o]=n[o-1]+e[o];var p=function(a,b){k[b]._height+=d,k[b].__mergeRows.push(a)},q=function(a,b){l[a]._width+=e[b],l[a].__mergeCols.push(b)},r=function(a,b){var c=e[b],f=d;m[a][b]._row=a,m[a][b]._col=b,m[a][b]._width=c,m[a][b]._height=f,k[b]=m[a][b],k[b].__mergeRows=[a],l[a]=m[a][b],l[a].__mergeCols=[b],i.push({x:n[b]-e[b],y:+a*d,item:m[a][b]})};return BI.each(a,function(a,d){for(var e=b;e<c;e++)if(j[a]||(j[a]={}),m[a]||(m[a]={}),j[a][e]=d[e],m[a][e]={},f===!0||f.indexOf(e)>-1||g===!0||g.indexOf(a)>-1)if(0===a&&e===b)r(0,b);else if(e===b&&a>0){var i=h.mergeRule(j[a][e],j[a-1][e]);i===!0?(p(a,e),l[a]=k[e]):r(a,e)}else if(0===a&&e>b){var n=h.mergeRule(j[a][e],j[a][e-1]);n===!0?(q(a,e),k[e]=l[a]):r(a,e)}else{var i=h.mergeRule(j[a][e],j[a-1][e]),n=h.mergeRule(j[a][e],j[a][e-1]);if(n&&i)continue;n&&q(a,e),i&&p(a,e),n||i||r(a,e)}else r(a,e)}),BI.map(i,function(a,b){return{x:b.x,y:b.y,row:b.item._row,col:b.item._col,width:b.item._width,height:b.item._height}})},_populate:function(){this._width<=0||this._height<=0||(this._isNeedDigest===!0&&this._digest(),this._isNeedDigest=!1,this._populateTable(),this._populateScrollbar())},getRegionSize:function(){var a=this.options,b=a.regionColumnSize[0]||0;return a.isNeedFreeze===!1||0===a.freezeCols.length?0:(b||BI.each(a.freezeCols,function(c,d){b+=a.columnSize[d]}),b)},setVerticalScroll:function(a){this.bottomLeftCollection.setScrollTop(a),this.bottomRightCollection.setScrollTop(a)},setLeftHorizontalScroll:function(a){this.topLeftCollection.setScrollLeft(a),this.bottomLeftCollection.setScrollLeft(a)},setRightHorizontalScroll:function(a){this.topRightCollection.setScrollLeft(a),this.bottomRightCollection.setScrollLeft(a)},getVerticalScroll:function(){return this.bottomRightCollection.getScrollTop()},getLeftHorizontalScroll:function(){return this.bottomLeftCollection.getScrollLeft()},getRightHorizontalScroll:function(){return this.bottomRightCollection.getScrollLeft()},setWidth:function(a){BI.CollectionTable.superclass.setWidth.apply(this,arguments),this._width=this.options.width-BI.GridTableScrollbar.SIZE},setHeight:function(a){BI.CollectionTable.superclass.setHeight.apply(this,arguments),this._height=this.options.height-BI.GridTableScrollbar.SIZE},setColumnSize:function(a){this._isNeedDigest=!0,this.options.columnSize=a},setRegionColumnSize:function(a){this._isNeedDigest=!0,this.options.regionColumnSize=a},getColumnSize:function(){return this.options.columnSize},getRegionColumnSize:function(){return this.options.regionColumnSize},populate:function(a,b){a&&a!==this.options.items&&(this._isNeedDigest=!0,this.options.items=a,this._restore()),b&&b!==this.options.header&&(this._isNeedDigest=!0,this.options.header=b,this._restore()),this._populate()},_restore:function(){this.topLeftCollection.restore(),this.topRightCollection.restore(),this.bottomLeftCollection.restore(),this.bottomRightCollection.restore()},restore:function(){this._restore()}}),BI.shortcut("bi.collection_table",BI.CollectionTable),BI.QuickCollectionTable=BI.inherit(BI.CollectionTable,{_defaultConfig:function(){return BI.extend(BI.QuickCollectionTable.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-quick-collection-table"})},render:function(){BI.QuickCollectionTable.superclass.render.apply(this,arguments);this.options;this.topLeftCollection.setOverflowX(!1),this.topLeftCollection.setOverflowY(!1),this.topRightCollection.setOverflowX(!1),this.topRightCollection.setOverflowY(!1),this.bottomLeftCollection.setOverflowX(!1),this.bottomLeftCollection.setOverflowY(!1),this.bottomRightCollection.setOverflowX(!1),this.bottomRightCollection.setOverflowY(!1)},mounted:function(){BI.QuickCollectionTable.superclass.mounted.apply(this,arguments);var a=this;this._topLeftWheelHandler=new BI.WheelHandler(BI.bind(this._onWheelLeft,this),BI.bind(this._shouldHandleLeftX,this),BI.bind(this._shouldHandleY,this)),this._topRightWheelHandler=new BI.WheelHandler(BI.bind(this._onWheelRight,this),BI.bind(this._shouldHandleRightX,this),BI.bind(this._shouldHandleY,this)),this._bottomLeftWheelHandler=new BI.WheelHandler(BI.bind(this._onWheelLeft,this),BI.bind(this._shouldHandleLeftX,this),BI.bind(this._shouldHandleY,this)),this._bottomRightWheelHandler=new BI.WheelHandler(BI.bind(this._onWheelRight,this),BI.bind(this._shouldHandleRightX,this),BI.bind(this._shouldHandleY,this)),this.topLeftCollection.element.mousewheel(function(b){a._topLeftWheelHandler.onWheel(b.originalEvent)}),this.topRightCollection.element.mousewheel(function(b){a._topRightWheelHandler.onWheel(b.originalEvent)}),this.bottomLeftCollection.element.mousewheel(function(b){a._bottomLeftWheelHandler.onWheel(b.originalEvent)}),this.bottomRightCollection.element.mousewheel(function(b){a._bottomRightWheelHandler.onWheel(b.originalEvent)})},_shouldHandleLeftX:function(a){return a>0?this.bottomLeftCollection.getScrollLeft()<this.bottomLeftCollection.getMaxScrollLeft():this.bottomLeftCollection.getScrollLeft()>0},_shouldHandleRightX:function(a){return a>0?this.bottomRightCollection.getScrollLeft()<this.bottomRightCollection.getMaxScrollLeft():this.bottomRightCollection.getScrollLeft()>0},_shouldHandleY:function(a){return a>0?this.bottomRightCollection.getScrollTop()<this.bottomRightCollection.getMaxScrollTop():this.bottomRightCollection.getScrollTop()>0},_onWheelLeft:function(a,b){var c=this,d=this.bottomLeftCollection.getScrollTop(),e=this.bottomLeftCollection.getScrollLeft();d+=b,e+=a,this.bottomLeftCollection.setScrollTop(d),this.bottomRightCollection.setScrollTop(d),this.topLeftCollection.setScrollLeft(e),this.bottomLeftCollection.setScrollLeft(e),c._populateScrollbar(),this.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)},_onWheelRight:function(a,b){var c=this,d=this.bottomRightCollection.getScrollTop(),e=this.bottomRightCollection.getScrollLeft();d+=b,e+=a,this.bottomLeftCollection.setScrollTop(d),this.bottomRightCollection.setScrollTop(d),this.topRightCollection.setScrollLeft(e),this.bottomRightCollection.setScrollLeft(e),c._populateScrollbar(),this.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)},_populateTable:function(){var a=this.options,b=this.getRegionSize(),c=0,d=0,e=0,f=[];BI.each(a.columnSize,function(b,g){a.isNeedFreeze===!0&&a.freezeCols.contains(b)?c+=g:d+=g,e+=g,0===b?f[b]=g:f[b]=f[b-1]+g});var g=b,h=this._getFreezeHeaderHeight(),i=this._width-b,j=this._getFreezeHeaderHeight(),k=b,l=this._height-h,m=this._width-b,n=this._height-j;this.topLeft.setWidth(g),this.topLeft.setHeight(h),this.topRight.setWidth(i),this.topRight.setHeight(j),this.bottomLeft.setWidth(k),this.bottomLeft.setHeight(l),this.bottomRight.setWidth(m),this.bottomRight.setHeight(n),this.topLeftCollection.setWidth(g),this.topLeftCollection.setHeight(h),this.topRightCollection.setWidth(i),this.topRightCollection.setHeight(j),this.bottomLeftCollection.setWidth(k),this.bottomLeftCollection.setHeight(l),this.bottomRightCollection.setWidth(m),this.bottomRightCollection.setHeight(n);var o=this.contextLayout.attr("items");o[1].left=b,o[2].top=this._getFreezeHeaderHeight(),o[3].left=b,o[3].top=this._getFreezeHeaderHeight(),this.contextLayout.attr("items",o),this.contextLayout.resize();var p=[],q=[],r=[],s=[],t=function(a,b,c){BI.each(a,function(a,d){var e={type:"bi.collection_table_cell",cell:b[d.row][d.col]};c.push(e)})};t(this.topLeftItems,a.header,p),t(this.topRightItems,a.header,q),t(this.bottomLeftItems,this._getActualItems(),r),t(this.bottomRightItems,this._getActualItems(),s),this.topLeftCollection.populate(p),this.topRightCollection.populate(q),this.bottomLeftCollection.populate(r),this.bottomRightCollection.populate(s)}}),BI.shortcut("bi.quick_collection_table",BI.QuickCollectionTable),BI.GridTableCell=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.GridTableCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-grid-table-cell bi-border-right bi-border-bottom",width:0,height:0,_rowIndex:0,_columnIndex:0,_left:0,_top:0,cell:{}})},_init:function(){BI.GridTableCell.superclass._init.apply(this,arguments);var a=this.options;this.cell=BI.createWidget(BI.extend({type:"bi.label"},a.cell,{cls:(a.cell.cls||"")+"grid-table-cell-wrapper",width:a.width-(0===a._columnIndex?1:0)-1,height:a.height-(0===a._rowIndex?1:0)-1})),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.cell,left:0,right:0,top:0,bottom:0}]})},setWidth:function(a){BI.GridTableCell.superclass.setWidth.apply(this,arguments);var b=this.options;this.cell.setWidth(b.width-(0===b._columnIndex?1:0)-1)},setHeight:function(a){BI.GridTableCell.superclass.setHeight.apply(this,arguments);var b=this.options;this.cell.setHeight(b.height-(0===b._rowIndex?1:0)-1)}}),BI.shortcut("bi.grid_table_cell",BI.GridTableCell),BI.GridTable=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.GridTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-grid-table",headerRowSize:25,rowSize:25,columnSize:[],isNeedFreeze:!1,freezeCols:[],header:[],items:[],regionColumnSize:[]})},render:function(){var a=this,b=this.options;this._width=0,this._height=0,this._scrollBarSize=BI.DOM.getScrollWidth();var c=function(){return b.rowSize},d=function(a){return b.columnSize[a]},e=function(c){return b.columnSize[c+a._getFreezeColLength()]};this.topLeftGrid=BI.createWidget({type:"bi.grid_view",rowHeightGetter:c,columnWidthGetter:d}),this.topLeftGrid.on(BI.GridView.EVENT_SCROLL,function(b){a.bottomLeftGrid.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.topRightGrid=BI.createWidget({type:"bi.grid_view",rowHeightGetter:c,columnWidthGetter:e}),this.topRightGrid.on(BI.GridView.EVENT_SCROLL,function(b){a.bottomRightGrid.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.bottomLeftGrid=BI.createWidget({type:"bi.grid_view",rowHeightGetter:c,columnWidthGetter:d}),this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL,function(b){a.bottomRightGrid.setScrollTop(b.scrollTop),a.topLeftGrid.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.bottomRightGrid=BI.createWidget({type:"bi.grid_view",rowHeightGetter:c,columnWidthGetter:e}),this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL,function(b){a.bottomLeftGrid.setScrollTop(b.scrollTop),a.topRightGrid.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.topLeft=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.topLeftGrid]}),this.topRight=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.topRightGrid]}),this.bottomLeft=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.bottomLeftGrid]}),this.bottomRight=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.bottomRightGrid]}),this.contextLayout=BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.topLeft,top:0,left:0},{el:this.topRight,top:0},{el:this.bottomLeft,left:0},{el:this.bottomRight}]}),this.topScrollbar=BI.createWidget({type:"bi.grid_table_scrollbar",width:BI.GridTableScrollbar.SIZE}),this.topScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL,function(b){a.bottomLeftGrid.setScrollTop(b),a.bottomRightGrid.setScrollTop(b),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.leftScrollbar=BI.createWidget({type:"bi.grid_table_horizontal_scrollbar",height:BI.GridTableScrollbar.SIZE}),this.leftScrollbar.on(BI.GridTableHorizontalScrollbar.EVENT_SCROLL,function(b){a.topLeftGrid.setScrollLeft(b),a.bottomLeftGrid.setScrollLeft(b),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.rightScrollbar=BI.createWidget({type:"bi.grid_table_horizontal_scrollbar",height:BI.GridTableScrollbar.SIZE}),this.rightScrollbar.on(BI.GridTableHorizontalScrollbar.EVENT_SCROLL,function(b){a.topRightGrid.setScrollLeft(b),a.bottomRightGrid.setScrollLeft(b),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.scrollBarLayout=BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.topScrollbar,right:0,top:0},{el:this.leftScrollbar,left:0},{el:this.rightScrollbar}]}),this._width=b.width-BI.GridTableScrollbar.SIZE,this._height=b.height-BI.GridTableScrollbar.SIZE,this.header=this._getHeader(),this.items=this._getItems()},mounted:function(){var a=this.options;(a.items.length>0||a.header.length>0)&&this._populate()},_getFreezeColLength:function(){var a=this.options;return a.isNeedFreeze===!0?BI.clamp(a.freezeCols.length,0,a.columnSize.length):0},_getFreezeHeaderHeight:function(){var a=this.options;return a.header.length*a.headerRowSize>=this._height?0:a.header.length*a.headerRowSize},_getActualItems:function(){var a=this.options;return a.header.length*a.headerRowSize>=this._height?a.header.concat(a.items):a.items},_populateScrollbar:function(){var a=this.options,b=this.getRegionSize(),c=0,d=0,e=0,f=[];BI.each(a.columnSize,function(b,g){a.isNeedFreeze===!0&&a.freezeCols.contains(b)?c+=g:d+=g,e+=g,0===b?f[b]=g:f[b]=f[b-1]+g}),this.topScrollbar.setContentSize(this._getActualItems().length*a.rowSize),this.topScrollbar.setSize(this._height-this._getFreezeHeaderHeight()),this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(),this.bottomRightGrid.getScrollTop())),this.topScrollbar.populate(),this.leftScrollbar.setContentSize(c),this.leftScrollbar.setSize(b),this.leftScrollbar.setPosition(this.bottomLeftGrid.getScrollLeft()),this.leftScrollbar.populate(),this.rightScrollbar.setContentSize(d),this.rightScrollbar.setSize(this._width-b),this.rightScrollbar.setPosition(this.bottomRightGrid.getScrollLeft()),this.rightScrollbar.populate();var g=this.scrollBarLayout.attr("items");g[0].top=this._getFreezeHeaderHeight(),g[1].top=this._height,g[2].top=this._height,g[2].left=b,this.scrollBarLayout.attr("items",g),this.scrollBarLayout.resize()},_getHeader:function(){var a=this.options,b=this._getFreezeColLength(),c=[],d=[];return BI.each(a.header,function(a,e){c[a]=[],d[a]=[],BI.each(e,function(e,f){var g={type:"bi.grid_table_cell",cell:f};e<b?c[a].push(g):d[a].push(g)})}),[c,d]},_getItems:function(){var a=(this.options,this._getFreezeColLength()),b=[],c=[];return BI.each(this._getActualItems(),function(d,e){b[d]=[],c[d]=[],BI.each(e,function(e,f){var g={type:"bi.grid_table_cell",cell:f};e<a?b[d].push(g):c[d].push(g)})}),[b,c]},_populateTable:function(){var a=this.options,b=this.getRegionSize(),c=0,d=0,e=0,f=[],g=this._getFreezeColLength();BI.each(a.columnSize,function(b,g){a.isNeedFreeze===!0&&a.freezeCols.contains(b)?c+=g:d+=g,e+=g,0===b?f[b]=g:f[b]=f[b-1]+g});var h=b,i=this._getFreezeHeaderHeight(),j=this._width-b,k=this._getFreezeHeaderHeight(),l=b,m=this._height-i,n=this._width-b,o=this._height-k,p=h+this._scrollBarSize,q=i+this._scrollBarSize,r=j+this._scrollBarSize,s=k+this._scrollBarSize,t=l+this._scrollBarSize,u=m+this._scrollBarSize,v=n+this._scrollBarSize,w=o+this._scrollBarSize,x=function(a){a.element.css({overflow:"scroll",overflowX:"scroll",overflowY:"scroll"})};this.topLeft.setWidth(h),this.topLeft.setHeight(i),this.topRight.setWidth(j),this.topRight.setHeight(k),this.bottomLeft.setWidth(l),this.bottomLeft.setHeight(m),this.bottomRight.setWidth(n),this.bottomRight.setHeight(o),this.topLeftGrid.setWidth(p),this.topLeftGrid.setHeight(q),this.topRightGrid.setWidth(r),this.topRightGrid.setHeight(s),this.bottomLeftGrid.setWidth(t),this.bottomLeftGrid.setHeight(u),this.bottomRightGrid.setWidth(v),this.bottomRightGrid.setHeight(w),x(this.topLeftGrid),x(this.topRightGrid),x(this.bottomLeftGrid),x(this.bottomRightGrid),this.topLeftGrid.setEstimatedColumnSize(g>0?c/g:0),this.topLeftGrid.setEstimatedRowSize(a.headerRowSize),this.topRightGrid.setEstimatedColumnSize(a.columnSize.length-g>0?d/(a.columnSize.length-g):0),this.topRightGrid.setEstimatedRowSize(a.headerRowSize),this.bottomLeftGrid.setEstimatedColumnSize(g>0?c/g:0),this.bottomLeftGrid.setEstimatedRowSize(a.rowSize),this.bottomRightGrid.setEstimatedColumnSize(a.columnSize.length-g>0?d/(a.columnSize.length-g):0),this.bottomRightGrid.setEstimatedRowSize(a.rowSize),this.topLeftGrid.setColumnCount(g),this.topRightGrid.setColumnCount(a.columnSize.length-g),this.bottomLeftGrid.setColumnCount(g),this.bottomRightGrid.setColumnCount(a.columnSize.length-g);var y=this.contextLayout.attr("items");y[1].left=b,y[2].top=this._getFreezeHeaderHeight(),y[3].left=b,y[3].top=this._getFreezeHeaderHeight(),this.contextLayout.attr("items",y),this.contextLayout.resize(),this.topLeftGrid._populate(this.header[0]),this.topRightGrid._populate(this.header[1]),this.bottomLeftGrid._populate(this.items[0]),this.bottomRightGrid._populate(this.items[1])},_populate:function(){this._width<=0||this._height<=0||(this._populateTable(),this._populateScrollbar())},getRegionSize:function(){var a=this.options,b=a.regionColumnSize[0]||0;return a.isNeedFreeze===!1||0===a.freezeCols.length?0:(b||BI.each(a.freezeCols,function(c,d){b+=a.columnSize[d]}),b)},setVerticalScroll:function(a){this.bottomLeftGrid.setScrollTop(a),this.bottomRightGrid.setScrollTop(a)},setLeftHorizontalScroll:function(a){this.topLeftGrid.setScrollLeft(a),this.bottomLeftGrid.setScrollLeft(a)},setRightHorizontalScroll:function(a){this.topRightGrid.setScrollLeft(a),this.bottomRightGrid.setScrollLeft(a)},getVerticalScroll:function(){return this.bottomRightGrid.getScrollTop()},getLeftHorizontalScroll:function(){return this.bottomLeftGrid.getScrollLeft()},getRightHorizontalScroll:function(){return this.bottomRightGrid.getScrollLeft()},setWidth:function(a){BI.GridTable.superclass.setWidth.apply(this,arguments),this._width=this.options.width-BI.GridTableScrollbar.SIZE},setHeight:function(a){BI.GridTable.superclass.setHeight.apply(this,arguments),this._height=this.options.height-BI.GridTableScrollbar.SIZE},setColumnSize:function(a){this.options.columnSize=a,this._isNeedDigest=!0},setRegionColumnSize:function(a){this.options.regionColumnSize=a,this._isNeedDigest=!0},getColumnSize:function(){return this.options.columnSize},getRegionColumnSize:function(){return this.options.regionColumnSize},populate:function(a,b){a&&this.options.items!==a&&(this.options.items=a,this.items=this._getItems(),this._restore()),b&&this.options.header!==b&&(this.options.header=b,this.header=this._getHeader(),this._restore()),this._populate()},_restore:function(){this.topLeftGrid.restore(),this.topRightGrid.restore(),this.bottomLeftGrid.restore(),this.bottomRightGrid.restore()},restore:function(){this._restore()}}),BI.shortcut("bi.grid_table",BI.GridTable),BI.QuickGridTable=BI.inherit(BI.GridTable,{_defaultConfig:function(){return BI.extend(BI.QuickGridTable.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-quick-grid-table"})},render:function(){BI.QuickGridTable.superclass.render.apply(this,arguments);this.options;this.topLeftGrid.setOverflowX(!1),this.topLeftGrid.setOverflowY(!1),this.topRightGrid.setOverflowX(!1),this.topRightGrid.setOverflowY(!1),this.bottomLeftGrid.setOverflowX(!1),this.bottomLeftGrid.setOverflowY(!1),this.bottomRightGrid.setOverflowX(!1),this.bottomRightGrid.setOverflowY(!1)},mounted:function(){BI.QuickGridTable.superclass.mounted.apply(this,arguments);var a=this;this._topLeftWheelHandler=new BI.WheelHandler(BI.bind(this._onWheelLeft,this),BI.bind(this._shouldHandleLeftX,this),BI.bind(this._shouldHandleY,this)),this._topRightWheelHandler=new BI.WheelHandler(BI.bind(this._onWheelRight,this),BI.bind(this._shouldHandleRightX,this),BI.bind(this._shouldHandleY,this)),this._bottomLeftWheelHandler=new BI.WheelHandler(BI.bind(this._onWheelLeft,this),BI.bind(this._shouldHandleLeftX,this),BI.bind(this._shouldHandleY,this)),this._bottomRightWheelHandler=new BI.WheelHandler(BI.bind(this._onWheelRight,this),BI.bind(this._shouldHandleRightX,this),BI.bind(this._shouldHandleY,this)),this.topLeftGrid.element.mousewheel(function(b){a._topLeftWheelHandler.onWheel(b.originalEvent)}),this.topRightGrid.element.mousewheel(function(b){a._topRightWheelHandler.onWheel(b.originalEvent)}),this.bottomLeftGrid.element.mousewheel(function(b){a._bottomLeftWheelHandler.onWheel(b.originalEvent)}),this.bottomRightGrid.element.mousewheel(function(b){a._bottomRightWheelHandler.onWheel(b.originalEvent)})},_shouldHandleLeftX:function(a){return a>0?this.bottomLeftGrid.getScrollLeft()<this.bottomLeftGrid.getMaxScrollLeft():this.bottomLeftGrid.getScrollLeft()>0},_shouldHandleRightX:function(a){return a>0?this.bottomRightGrid.getScrollLeft()<this.bottomRightGrid.getMaxScrollLeft():this.bottomRightGrid.getScrollLeft()>0},_shouldHandleY:function(a){return a>0?this.bottomRightGrid.getScrollTop()<this.bottomRightGrid.getMaxScrollTop():this.bottomRightGrid.getScrollTop()>0},_onWheelLeft:function(a,b){var c=this,d=this.bottomLeftGrid.getScrollTop(),e=this.bottomLeftGrid.getScrollLeft();d+=b,e+=a,this.bottomLeftGrid.setScrollTop(d),this.bottomRightGrid.setScrollTop(d),this.topLeftGrid.setScrollLeft(e),this.bottomLeftGrid.setScrollLeft(e),c._populateScrollbar(),this.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)},_onWheelRight:function(a,b){var c=this,d=this.bottomRightGrid.getScrollTop(),e=this.bottomRightGrid.getScrollLeft();d+=b,e+=a,this.bottomLeftGrid.setScrollTop(d),this.bottomRightGrid.setScrollTop(d),this.topRightGrid.setScrollLeft(e),this.bottomRightGrid.setScrollLeft(e),c._populateScrollbar(),this.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)},_populateTable:function(){var a=this.options,b=this.getRegionSize(),c=0,d=0,e=0,f=[],g=this._getFreezeColLength();BI.each(a.columnSize,function(b,g){a.isNeedFreeze===!0&&a.freezeCols.contains(b)?c+=g:d+=g,e+=g,0===b?f[b]=g:f[b]=f[b-1]+g});var h=b,i=this._getFreezeHeaderHeight(),j=this._width-b,k=this._getFreezeHeaderHeight(),l=b,m=this._height-i,n=this._width-b,o=this._height-k;this.topLeft.setWidth(h),this.topLeft.setHeight(i),this.topRight.setWidth(j),this.topRight.setHeight(k),this.bottomLeft.setWidth(l),this.bottomLeft.setHeight(m),this.bottomRight.setWidth(n),this.bottomRight.setHeight(o),this.topLeftGrid.setWidth(h),this.topLeftGrid.setHeight(i),this.topRightGrid.setWidth(j),this.topRightGrid.setHeight(k),this.bottomLeftGrid.setWidth(l),this.bottomLeftGrid.setHeight(m),this.bottomRightGrid.setWidth(n),this.bottomRightGrid.setHeight(o),this.topLeftGrid.setEstimatedColumnSize(g>0?c/g:0),this.topLeftGrid.setEstimatedRowSize(a.headerRowSize),this.topRightGrid.setEstimatedColumnSize(a.columnSize.length-g>0?d/(a.columnSize.length-g):0),this.topRightGrid.setEstimatedRowSize(a.headerRowSize),this.bottomLeftGrid.setEstimatedColumnSize(g>0?c/g:0),this.bottomLeftGrid.setEstimatedRowSize(a.rowSize),this.bottomRightGrid.setEstimatedColumnSize(a.columnSize.length-g>0?d/(a.columnSize.length-g):0),this.bottomRightGrid.setEstimatedRowSize(a.rowSize),this.topLeftGrid.setColumnCount(g),this.topRightGrid.setColumnCount(a.columnSize.length-g),this.bottomLeftGrid.setColumnCount(g),this.bottomRightGrid.setColumnCount(a.columnSize.length-g);var p=this.contextLayout.attr("items");p[1].left=b,p[2].top=this._getFreezeHeaderHeight(),p[3].left=b,p[3].top=this._getFreezeHeaderHeight(),this.contextLayout.attr("items",p),this.contextLayout.resize();var q=[],r=[],s=[],t=[];BI.each(a.header,function(a,b){q[a]=[],r[a]=[],BI.each(b,function(b,c){var d={type:"bi.grid_table_cell",cell:c};b<g?q[a].push(d):r[a].push(d)})}),BI.each(this._getActualItems(),function(a,b){s[a]=[],t[a]=[],BI.each(b,function(b,c){var d={type:"bi.grid_table_cell",cell:c};b<g?s[a].push(d):t[a].push(d)})}),this.topLeftGrid.populate(q),this.topRightGrid.populate(r),this.bottomLeftGrid.populate(s),this.bottomRightGrid.populate(t)}}),BI.shortcut("bi.quick_grid_table",BI.QuickGridTable),BI.GridTableScrollbar=BI.inherit(BI.Widget,{_const:{FACE_MARGIN:4,FACE_MARGIN_2:8,FACE_SIZE_MIN:30,KEYBOARD_SCROLL_AMOUNT:40},_defaultConfig:function(){return BI.extend(BI.GridTableScrollbar.superclass._defaultConfig.apply(this,arguments),{baseCls:"scrollbar-layout-main public-scrollbar-main",attributes:{tabIndex:0},contentSize:0,defaultPosition:0,isOpaque:!1,orientation:"vertical",position:0,size:0})},render:function(){this.options;this.focused=!1,this.isDragging=!1,this.face=BI.createWidget({type:"bi.layout",cls:"scrollbar-layout-face public-scrollbar-face "+(this._isHorizontal()?"scrollbar-layout-face-horizontal":"scrollbar-layout-face-vertical")}),this.contextLayout=BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.face,left:0,top:0}]})},mounted:function(){var a=this,b=this.options,c="horizontal"===b.orientation?this._onWheelX:this._onWheelY;this._wheelHandler=new BI.WheelHandler(BI.bind(c,this),BI.bind(this._shouldHandleX,this),BI.bind(this._shouldHandleY,this)),this._mouseMoveTracker=new BI.MouseMoveTracker(BI.bind(this._onMouseMove,this),BI.bind(this._onMouseMoveEnd,this),document),this.element.on("mousedown",BI.bind(this._onMouseDown,this)),this.element.on("mousewheel",function(b){a._wheelHandler.onWheel(b.originalEvent)}),this.element.on("keydown",BI.bind(this._onKeyDown,this)),this.element.on("focus",function(){a.focused=!0,a._populate()}),this.element.on("blur",function(){a.focused=!1,a._populate()}),this._isHorizontal()?this.element.addClass("scrollbar-layout-main-horizontal"):this.element.addClass("scrollbar-layout-main-vertical"),this._populate()},_isHorizontal:function(){return"horizontal"===this.options.orientation},_getScale:function(){var a=this.options,b=a.size/a.contentSize,c=a.size*b;return c<this._const.FACE_SIZE_MIN&&(b=(a.size-this._const.FACE_SIZE_MIN)/(a.contentSize-a.size)),b},_getFaceSize:function(){var a=this.options,b=a.size/a.contentSize,c=a.size*b;return c<this._const.FACE_SIZE_MIN&&(c=this._const.FACE_SIZE_MIN),c},_shouldHandleX:function(a){return"horizontal"===this.options.orientation&&this._shouldHandleChange(a)},_shouldHandleY:function(a){return"horizontal"!==this.options.orientation&&this._shouldHandleChange(a)},_shouldHandleChange:function(a){return this.options.position+a!==this.options.position},_onWheelY:function(a,b){this._onWheel(b)},_onWheelX:function(a,b){this._onWheel(a)},_onWheel:function(a){var b=this.options.contentSize-this.options.size;this.options.position+=a,this.options.position<0?this.options.position=0:this.options.position>b&&(this.options.position=b),this._populate(),this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL,this.options.position)},_onMouseDown:function(a){if(a.target!==this.face.element[0]){var b=this._isHorizontal()?a.offsetX:a.offsetY;b/=this._getScale(),this.options.position=BI.clamp(b-.5*this._getFaceSize()/this._getScale(),0,this.options.contentSize-this.options.size),this._populate(),this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL,this.options.position)}else this._mouseMoveTracker.captureMouseMoves(a);try{this.element[0].focus()}catch(a){}},_onMouseMove:function(a,b){var c=this._isHorizontal()?a:b;c/=this._getScale(),this.options.position=BI.clamp(this.options.position+c,0,this.options.contentSize-this.options.size),this.isDragging=this._mouseMoveTracker.isDragging(),this._populate(),this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL,this.options.position)},_onMouseMoveEnd:function(a){this._mouseMoveTracker.releaseMouseMoves(),this.isDragging===!0&&(this.isDragging=!1,this._populate())},_onKeyDown:function(a){var b={BACKSPACE:8,TAB:9,RETURN:13,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,COMMA:188,PERIOD:190,A:65,Z:90,ZERO:48,NUMPAD_0:96,NUMPAD_9:105},c=a.keyCode;if(c!==b.TAB){var d=40,e=0;if(this._isHorizontal())switch(c){case b.HOME:e=-1,d=this.options.contentSize;break;case b.LEFT:e=-1;break;case b.RIGHT:e=1;break;default:return}if(!this._isHorizontal())switch(c){case b.SPACE:e=a.shiftKey?-1:1;break;case b.HOME:e=-1,d=this.options.contentSize;break;case b.UP:e=-1;break;case b.DOWN:e=1;break;case b.PAGE_UP:e=-1,d=this.options.size;break;case b.PAGE_DOWN:e=1,d=this.options.size;break;default:return}this.options.position=BI.clamp(this.options.position+d*e,0,this.options.contentSize-this.options.size),a.preventDefault(),this._populate(),this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL,this.options.position)}},_populate:function(){var a=this.options;if(a.size<1||a.contentSize<=a.size)return void this.setVisible(!1);this.setVisible(!0);var b=a.size,c=this._isHorizontal(),d=this.focused||this.isDragging,e=this._getFaceSize(),f=a.isOpaque;this.element[f===!0?"addClass":"removeClass"]("public-scrollbar-main-opaque"),this.element[d===!0?"addClass":"removeClass"]("public-scrollbar-main-active"),this.face.element[d===!0?"addClass":"removeClass"]("public-scrollbar-face-active");var g=a.position*this._getScale()+this._const.FACE_MARGIN,h=this.contextLayout.attr("items");c?(this.setWidth(b),this.face.setWidth(e-this._const.FACE_MARGIN_2),h[0].left=g,h[0].top=0):(this.setHeight(b),this.face.setHeight(e-this._const.FACE_MARGIN_2),h[0].left=0,h[0].top=g),this.contextLayout.attr("items",h),this.contextLayout.resize()},setContentSize:function(a){this.options.contentSize=a},setPosition:function(a){this.options.position=a},setSize:function(a){this.options.size=a},populate:function(){this._populate()}}),BI.GridTableScrollbar.SIZE=10,BI.GridTableScrollbar.EVENT_SCROLL="EVENT_SCROLL",BI.shortcut("bi.grid_table_scrollbar",BI.GridTableScrollbar),BI.GridTableHorizontalScrollbar=BI.inherit(BI.Widget,{_const:{FACE_MARGIN:4,FACE_MARGIN_2:8,FACE_SIZE_MIN:30,KEYBOARD_SCROLL_AMOUNT:40},_defaultConfig:function(){return BI.extend(BI.GridTableHorizontalScrollbar.superclass._defaultConfig.apply(this,arguments),{attributes:{tabIndex:0},contentSize:0,position:0,size:0})},_init:function(){BI.GridTableHorizontalScrollbar.superclass._init.apply(this,arguments);var a=this,b=this.options;this.scrollbar=BI.createWidget({type:"bi.grid_table_scrollbar",orientation:"horizontal",isOpaque:!0,position:b.position,contentSize:b.contentSize,size:b.size}),this.scrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL,function(){a.fireEvent(BI.GridTableHorizontalScrollbar.EVENT_SCROLL,arguments)}),BI.createWidget({type:"bi.absolute",cls:"horizontal-scrollbar",element:this,width:b.size,height:BI.GridTableScrollbar.SIZE,items:[{el:{type:"bi.absolute",scrollable:!1,height:BI.GridTableScrollbar.SIZE,items:[{el:this.scrollbar,left:0,top:0}]},top:0,left:0,right:0}]})},setContentSize:function(a){this.options.contentSize=a,this.scrollbar.setContentSize(a)},setPosition:function(a){this.options.position=a,this.scrollbar.setPosition(a)},setSize:function(a){this.setWidth(a),this.options.size=a,this.scrollbar.setSize(a)},populate:function(){this.scrollbar.populate();var a=this.options;return a.size<1||a.contentSize<=a.size?void this.setVisible(!1):void this.setVisible(!0)}}),BI.GridTableHorizontalScrollbar.EVENT_SCROLL="EVENT_SCROLL",BI.shortcut("bi.grid_table_horizontal_scrollbar",BI.GridTableHorizontalScrollbar),BI.TableHeaderCell=BI.inherit(BI.Widget,{
_defaultConfig:function(){return BI.extend(BI.TableHeaderCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-table-header-cell",text:""})},_init:function(){BI.TableHeaderCell.superclass._init.apply(this,arguments),BI.createWidget({type:"bi.label",element:this,textAlign:"center",height:this.options.height,text:this.options.text,value:this.options.value})}}),BI.shortcut("bi.table_header_cell",BI.TableHeaderCell),BI.Table=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Table.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-table",logic:{dynamic:!1},isNeedFreeze:!1,freezeCols:[],isNeedMerge:!1,mergeCols:[],mergeRule:function(a,b){return BI.isEqual(a,b)},columnSize:[],headerRowSize:25,footerRowSize:25,rowSize:25,regionColumnSize:!1,header:[],footer:!1,items:[]})},_calculateWidth:function(a){return a&&"0"!==a?(a=BI.parseFloat(a),a<0&&(a=0),a>1.01?a:100*a+"%"):""},_calculateHeight:function(a){return a?a:""},_isRightFreeze:function(){return BI.isNotEmptyArray(this.options.freezeCols)&&0!==BI.first(this.options.freezeCols)},_createTopLeft:function(){var a=this.options,b=this._isRightFreeze();this.topLeftColGroupTds={},this.topLeftBodyTds={},this.topLeftBodyItems={};var c=this._table(),d=this._createColGroup(this.columnLeft,this.topLeftColGroupTds),e=this.topLeftBody=this._body();if(e.element.append(this._createHeaderCells(this.topLeftItems,this.columnLeft,this.mergeLeft,this.topLeftBodyTds,this.topLeftBodyItems)),BI.createWidget({type:"bi.adaptive",element:c,items:[d,e]}),b){var f=0;BI.each(a.columnSize,function(b,c){a.freezeCols.contains(b)||(f+=c)}),BI.isNumeric(f)&&f>1&&(f=BI.parseFloat(f)+a.columnSize.length-a.freezeCols.length)}return this.topLeftContainer=BI.createWidget({type:"bi.adaptive",width:this._calculateWidth(f),items:[c]})},_createTopRight:function(){var a=this.options,b=this._isRightFreeze();this.topRightColGroupTds={},this.topRightBodyTds={},this.topRightBodyItems={};var c=this._table(),d=this._createColGroup(this.columnRight,this.topRightColGroupTds),e=this.topRightBody=this._body();if(e.element.append(this._createHeaderCells(this.topRightItems,this.columnRight,this.mergeRight,this.topRightBodyTds,this.topRightBodyItems,this.columnLeft.length)),BI.createWidget({type:"bi.adaptive",element:c,items:[d,e]}),!b){var f=0;BI.each(a.columnSize,function(b,c){a.freezeCols.contains(b)||(f+=c)}),BI.isNumeric(f)&&(f=BI.parseFloat(f)+a.columnSize.length-a.freezeCols.length)}return this.topRightContainer=BI.createWidget({type:"bi.adaptive",width:f||void 0,items:[c]})},_createBottomLeft:function(){var a=this.options,b=this._isRightFreeze();this.bottomLeftColGroupTds={},this.bottomLeftBodyTds={},this.bottomLeftBodyItems={};var c=this._table(),d=this._createColGroup(this.columnLeft,this.bottomLeftColGroupTds),e=this._createBottomLeftBody();if(BI.createWidget({type:"bi.adaptive",element:c,items:[d,e]}),b){var f=0;BI.each(a.columnSize,function(b,c){a.freezeCols.contains(b)||(f+=c)}),BI.isNumeric(f)&&f>1&&(f=BI.parseFloat(f)+a.columnSize.length-a.freezeCols.length)}return this.bottomLeftContainer=BI.createWidget({type:"bi.adaptive",width:this._calculateWidth(f),items:[c]})},_createBottomLeftBody:function(){var a=this.bottomLeftBody=this._body();return a.element.append(this._createCells(this.bottomLeftItems,this.columnLeft,this.mergeLeft,this.bottomLeftBodyTds,this.bottomLeftBodyItems)),a},_createBottomRight:function(){var a=this.options,b=this._isRightFreeze();this.bottomRightColGroupTds={},this.bottomRightBodyTds={},this.bottomRightBodyItems={};var c=this._table(),d=this._createColGroup(this.columnRight,this.bottomRightColGroupTds),e=this._createBottomRightBody();if(BI.createWidget({type:"bi.adaptive",element:c,items:[d,e]}),!b){var f=0;BI.each(a.columnSize,function(b,c){a.freezeCols.contains(b)||(f+=c)}),BI.isNumeric(f)&&f>1&&(f=BI.parseFloat(f)+a.columnSize.length-a.freezeCols.length)}return this.bottomRightContainer=BI.createWidget({type:"bi.adaptive",width:this._calculateWidth(f),items:[c]})},_createBottomRightBody:function(){var a=this.bottomRightBody=this._body();return a.element.append(this._createCells(this.bottomRightItems,this.columnRight,this.mergeRight,this.bottomRightBodyTds,this.bottomRightBodyItems,this.columnLeft.length)),a},_createFreezeTable:function(){var a=this,b=this.options,c=this._isRightFreeze(),d=this._split(b.header);this.topLeftItems=d.left,this.topRightItems=d.right,d=this._split(b.items),this.bottomLeftItems=d.left,this.bottomRightItems=d.right,this.columnLeft=[],this.columnRight=[],BI.each(b.columnSize,function(d,e){b.freezeCols.contains(d)?a[c?"columnRight":"columnLeft"].push(e):a[c?"columnLeft":"columnRight"].push(e)}),this.mergeLeft=[],this.mergeRight=[],BI.each(b.mergeCols,function(d,e){b.freezeCols.contains(e)?a[c?"mergeRight":"mergeLeft"].push(e):a[c?"mergeLeft":"mergeRight"].push(e)});var e=this._createTopLeft(),f=this._createTopRight(),g=this._createBottomLeft(),h=this._createBottomRight();this.scrollTopLeft=BI.createWidget({type:"bi.adaptive",cls:"scroll-top-left",width:"100%",height:"100%",scrollable:!1,items:[e]}),this.scrollTopRight=BI.createWidget({type:"bi.adaptive",cls:"scroll-top-right",width:"100%",height:"100%",scrollable:!1,items:[f]}),this.scrollBottomLeft=BI.createWidget({type:"bi.adaptive",cls:"scroll-bottom-left",width:"100%",height:"100%",scrollable:c||null,scrollx:!c,items:[g]}),this.scrollBottomRight=BI.createWidget({type:"bi.adaptive",cls:"scroll-bottom-right",width:"100%",height:"100%",scrollable:!c||null,scrollx:c,items:[h]}),this.topLeft=BI.createWidget({type:"bi.adaptive",cls:"top-left",scrollable:!1,items:[this.scrollTopLeft]}),this.topRight=BI.createWidget({type:"bi.adaptive",cls:"top-right",scrollable:!1,items:[this.scrollTopRight]}),this.bottomLeft=BI.createWidget({type:"bi.adaptive",cls:"bottom-left",items:[this.scrollBottomLeft]}),this.bottomRight=BI.createWidget({type:"bi.adaptive",cls:"bottom-right",scrollable:!1,items:[this.scrollBottomRight]});var i=b.header.length*((b.headerRowSize||b.rowSize)+1)+1,j=BI.sum(b.freezeCols,function(a,c){return b.columnSize[c]>1?b.columnSize[c]+1:b.columnSize[c]});this._resize=function(){a.scrollBottomLeft.element.is(":visible")&&(a.scrollBottomLeft.element.css({"overflow-x":"auto"}),a.scrollBottomRight.element.css({"overflow-x":"auto"}),a.setColumnSize(b.columnSize),c?a.scrollBottomLeft.element.css({"overflow-y":"auto"}):a.scrollBottomRight.element.css({"overflow-y":"auto"}),(a.scrollBottomLeft.element.hasHorizonScroll()||a.scrollBottomRight.element.hasHorizonScroll())&&(a.scrollBottomLeft.element.css("overflow-x","scroll"),a.scrollBottomRight.element.css("overflow-x","scroll")),a.scrollBottomRight.element.hasVerticalScroll()?a.scrollTopRight.element.css("overflow-y","scroll"):a.scrollTopRight.element.css("overflow-y","hidden"),a.scrollBottomLeft.element.hasVerticalScroll()?a.scrollTopLeft.element.css("overflow-y","scroll"):a.scrollTopLeft.element.css("overflow-y","hidden"),a.scrollTopLeft.element[0].scrollLeft=a.scrollBottomLeft.element[0].scrollLeft,a.scrollTopRight.element[0].scrollLeft=a.scrollBottomRight.element[0].scrollLeft,a.scrollBottomLeft.element[0].scrollTop=a.scrollBottomRight.element[0].scrollTop)};var k=b.regionColumnSize;0===b.freezeCols.length?k=c?["fill",0]:[0,"fill"]:b.freezeCols.length>=b.columnSize.length&&(k=c?[0,"fill"]:["fill",0]),this.partitions=BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("table",BI.extend({},b.logic,{rows:2,columns:2,columnSize:k||(c?["fill",j]:[j,"fill"]),rowSize:[i,"fill"],items:[[{el:this.topLeft},{el:this.topRight}],[{el:this.bottomLeft},{el:this.bottomRight}]]})))),this._initFreezeScroll(),BI.ResizeDetector.addResizeListener(this,function(){a._resize(),a.fireEvent(BI.Table.EVENT_TABLE_RESIZE)})},mounted:function(){this._resize&&this._resize(),this.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT)},_initFreezeScroll:function(){function a(a,c,d){a.scroll(function(e){d.scrollTop(a.scrollTop()),c.scrollLeft(a.scrollLeft()),b.fireEvent(BI.Table.EVENT_TABLE_SCROLL)})}var b=this;this.options;a(this.scrollBottomRight.element,this.scrollTopRight.element,this.scrollBottomLeft.element)},resize:function(){this._resize&&this._resize()},_createCells:function(a,b,c,d,e,f,g){var h=this,i=this.options,j={},k={},l={},m={},n={};b=b||i.columnSize,c=c||i.mergeCols,d=d||{},e=e||{},f=f||0,g||(g=i.rowSize);var o=document.createDocumentFragment();return BI.each(a,function(a,p){function q(a,b){var c=(0|j[b].attr("height"))+g+1;j[b].attr("height",c).css("height",c);var f=(0|(j[b].attr("rowspan")||1))+1;j[b].attr("rowspan",f),j[b].__mergeRows.pushDistinct(a),d[a][b]=j[b],e[a][b]=m[b]}function r(a,c){if(b[c]){var f=0|k[a].attr("width");f>1.05&&b[c]?(f=f+b[c]+1,c===b.length-1&&f--):f+=b[c],f=h._calculateWidth(f),k[a].attr("width",f).css("width",f),l[a].element.width(f)}var g=(0|(k[a].attr("colspan")||1))+1;k[a].attr("colspan",g),k[a].__mergeCols.pushDistinct(c),d[a][c]=k[a],e[a][c]=l[a]}function s(a,c){var i=h._calculateWidth(b[c]);i>1.05&&c===b.length-1&&i--;var o=h._calculateHeight(g),q=$("<td>").attr("height",o).attr("width",i).css({width:i,height:o,position:"relative"}).addClass(0===(1&c)?"odd-col":"even-col").addClass(0===a?"first-row":"").addClass(0===c?"first-col":"").addClass(c===p.length-1?"last-col":""),r=BI.createWidget(n[a][c],{type:"bi.table_cell",textAlign:"left",width:BI.isNumeric(i)?i:"",height:BI.isNumeric(o)?o:"",_row:a,_col:c+f});h.addWidget(r.getName(),r),r._mount(),r.element.css("position","relative"),q.append(r.element),t.append(q),j[c]=q,j[c].__mergeRows=[a],m[c]=r,k[a]=q,k[a].__mergeCols=[c],l[a]=r,d[a][c]=q,e[a][c]=r}var t=$("<tr>").addClass(0===(1&a)?"odd":"even");BI.each(p,function(b,f){if(n[a]||(n[a]={}),d[a]||(d[a]={}),e[a]||(e[a]={}),n[a][b]=f,i.isNeedMerge&&c.contains(b))if(0===a&&0===b)s(0,0);else if(0===b&&a>0){var g=i.mergeRule(n[a][b],n[a-1][b]);g===!0?(q(a,b),k[a]=j[b],l[a]=m[b]):s(a,b)}else if(0===a&&b>0){var h=i.mergeRule(n[a][b],n[a][b-1]);h===!0?(r(a,b),j[b]=k[a],m[b]=l[a]):s(a,b)}else{var g=i.mergeRule(n[a][b],n[a-1][b]),h=i.mergeRule(n[a][b],n[a][b-1]);if(h&&g)return;h&&r(a,b),g&&q(a,b),h||g||s(a,b)}else s(a,b)}),o.appendChild(t[0])}),o},_createColGroupCells:function(a,b){var c=this,d=this.options;a=a||d.columnSize,b=b||{};var e=document.createDocumentFragment();return BI.each(a,function(a,d){var f=c._calculateWidth(d),g=$("<col>").attr("width",f).css("width",f);b[a]=g,e.appendChild(g[0])}),e},_createHeaderCells:function(a,b,c,d,e,f){var g=this.options;f||(f=0);var h=this._createCells(a,b,BI.range(g.columnSize.length),d,e,f,g.headerRowSize||g.rowSize);return h},_createFooterCells:function(a,b,c,d){var e=(this.options,this._createCells(a,b,[],c,d,0));return e},_createColGroup:function(a,b,c){this.options;return this.colgroup=this._colgroup(),this.colgroup.element.append(this._createColGroupCells(a,b,c)),this.colgroup},_createHeader:function(){var a=this.options;if(a.header!==!1)return this.header=this._header(),this.header.element.append(this._createHeaderCells(a.header,null,null,this.headerTds,this.headerItems)),this.header},_createFooter:function(a,b,c){var d=this.options;if(d.footer!==!1)return this.footer=this._footer(),this.footer.element.append(this._createFooterCells(d.footer,null,this.footerTds,this.footerItems)),this.footer},_createBody:function(){var a=this.options;return this.body=this._body(),this.body.element.append(this._createCells(a.items,null,null,this.bodyTds,this.bodyItems)),this.body},_createNormalTable:function(){var a=this,b=this.options,c=this._table();this.colgroupTds={},this.headerTds={},this.footerTds={},this.bodyTds={},this.headerItems={},this.footerItems={},this.bodyItems={};var d=this._createColGroup(null,this.colgroupTds),e=this._createHeader(),f=this._createFooter(),g=this._createBody();BI.createWidget({type:"bi.adaptive",element:c,items:[d,e,f,g]});var h=BI.sum(this.options.columnSize)||void 0;h=this._calculateWidth(h),BI.isNumeric(h)&&h>1&&(h+=b.columnSize.length),this.tableContainer=BI.createWidget({type:"bi.adaptive",width:this._calculateWidth(h),items:[c]}),this.scrollBottomRight=BI.createWidget({type:"bi.adaptive",width:"100%",height:"100%",cls:"scroll-bottom-right",scrollable:!0,items:[this.tableContainer]}),BI.createWidget({type:"bi.adaptive",cls:"bottom-right",element:this,scrollable:!1,items:[this.scrollBottomRight]}),this._initNormalScroll(),BI.nextTick(function(){a.element.is(":visible")&&a.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT)})},_initNormalScroll:function(){var a=this;this.scrollBottomRight.element.scroll(function(b){a.fireEvent(BI.Table.EVENT_TABLE_SCROLL)})},_split:function(a){var b=this.options,c=[],d=[],e=this._isRightFreeze();return BI.each(a,function(a,f){c.push([]),d.push([]),BI.each(f,function(f,g){b.freezeCols.contains(f)?(e?d:c)[a].push(g):(e?c:d)[a].push(g)})}),{left:c,right:d}},_table:function(){return BI.createWidget({type:"bi.layout",tagName:"table",cls:"table",attribute:{cellspacing:0,cellpadding:0}})},_header:function(){return BI.createWidget({type:"bi.layout",cls:"header",tagName:"thead"})},_footer:function(){return BI.createWidget({type:"bi.layout",cls:"footer",tagName:"tfoot"})},_body:function(){return BI.createWidget({type:"bi.layout",tagName:"tbody",cls:"body"})},_colgroup:function(){return BI.createWidget({type:"bi.layout",tagName:"colgroup"})},render:function(){this.populate(this.options.items)},setColumnSize:function(a){var b=this,c=this.options,d=this._isRightFreeze();if(c.columnSize=a||[],c.isNeedFreeze){var e=[],f=[];BI.each(c.columnSize,function(a,b){c.freezeCols.contains(a)?d?f.push(b):e.push(b):d?e.push(b):f.push(b)});var g=0,h=1,i=2,j=3,k=function(a){var c,d,k,l;switch(a){case g:c=b.topLeftColGroupTds,d=b.topLeftBodyTds,k=b.topLeftBodyItems,l=e;break;case h:c=b.topRightColGroupTds,d=b.topRightBodyTds,k=b.topRightBodyItems,l=f;break;case i:c=b.bottomLeftColGroupTds,d=b.bottomLeftBodyTds,k=b.bottomLeftBodyItems,l=e;break;case j:c=b.bottomRightColGroupTds,d=b.bottomRightBodyTds,k=b.bottomRightBodyItems,l=f}BI.each(c,function(a,c){var e=0|c.attr("width");if(""!==l[a]&&e!==l[a]){var f=b._calculateWidth(l[a]);c.attr("width",f).css("width",f),BI.each(d,function(c,d){if(d[a])if(d[a].__mergeCols.length>1){var e=0;BI.each(l,function(b,c){d[a].__mergeCols.contains(b)&&(e+=c)}),e=b._calculateWidth(e),e>1&&(e+=d[a].__mergeCols.length-1),BI.isNumeric(e)?a==BI.size(d)-1?d[a].attr("width",e-1).css("width",e-1):d[a].attr("width",e).css("width",e):d[a].attr("width","").css("width","")}else a==BI.size(d)-1?d[a].attr("width",f-1).css("width",f-1):d[a].attr("width",f).css("width",f)}),BI.each(k,function(c,e){if(e[a])if(d[c][a].__mergeCols.length>1){var g=0;BI.each(l,function(b,e){d[c][a].__mergeCols.contains(b)&&(g+=e)}),g=b._calculateWidth(g),g>1&&(g+=d[c][a].__mergeCols.length-1),BI.isNumeric(g)?a==BI.size(e)-1?e[a].element.attr("width",g-1).css("width",g-1):e[a].element.attr("width",g).css("width",g):e[a].element.attr("width","").css("width","")}else BI.isNumeric(f)?a==BI.size(e)-1?e[a].element.attr("width",f-1).css("width",f-1):e[a].element.attr("width",f).css("width",f):e[a].element.attr("width","").css("width","")})}})};k(g),k(h),k(i),k(j);var l=0,m=0;this.columnLeft=[],this.columnRight=[],BI.each(c.columnSize,function(a,e){c.freezeCols.contains(a)?(l+=e,b[d?"columnRight":"columnLeft"].push(e)):(m+=e,b[d?"columnLeft":"columnRight"].push(e))}),l=this._calculateWidth(l),m=this._calculateWidth(m),BI.isNumeric(l)&&(l=BI.parseFloat(l)+c.freezeCols.length),BI.isNumeric(m)&&(m=BI.parseFloat(m)+c.columnSize.length-c.freezeCols.length),this.topLeftContainer.element.width(d?m:l),this.bottomLeftContainer.element.width(d?m:l),this.topRightContainer.element.width(d?l:m),this.bottomRightContainer.element.width(d?l:m),this.scrollTopLeft.element[0].scrollLeft=this.scrollBottomLeft.element[0].scrollLeft,this.scrollTopRight.element[0].scrollLeft=this.scrollBottomRight.element[0].scrollLeft}else{BI.each(this.colgroupTds,function(a,d){var e=0|d.attr("width");if(""!==c.columnSize[a]&&e!==c.columnSize[a]){var f=b._calculateWidth(c.columnSize[a]);d.attr("width",f).css("width",f),BI.each(b.bodyTds,function(d,e){if(e[a])if(e[a].__mergeCols.length>1){var g=0;BI.each(c.columnSize,function(b,c){e[a].__mergeCols.contains(b)&&(g+=c)}),g=b._calculateWidth(g),g>1&&(g+=e[a].__mergeCols.length-1),BI.isNumeric(g)?a==BI.size(e)-1?e[a].attr("width",f-1).css("width",f-1):e[a].attr("width",f).css("width",f):e[a].attr("width","").css("width","")}else a==BI.size(e)-1?e[a].attr("width",f-1).css("width",f-1):e[a].attr("width",f).css("width",f)}),BI.each(b.headerTds,function(d,e){if(e[a])if(e[a].__mergeCols.length>1){var g=0;BI.each(c.columnSize,function(b,c){e[a].__mergeCols.contains(b)&&(g+=c)}),g=b._calculateWidth(g),g>1&&(g+=e[a].__mergeCols.length-1),BI.isNumeric(g)?a==BI.size(e)-1?e[a].attr("width",f-1).css("width",f-1):e[a].attr("width",f).css("width",f):e[a].attr("width","").css("width","")}else a==BI.size(e)-1?e[a].attr("width",f-1).css("width",f-1):e[a].attr("width",f).css("width",f)}),BI.each(b.footerTds,function(d,e){if(e[a])if(e[a].__mergeCols.length>1){var g=0;BI.each(c.columnSize,function(b,c){e[a].__mergeCols.contains(b)&&(g+=c)}),g=b._calculateWidth(g),g>1&&(g+=e[a].__mergeCols.length-1),BI.isNumeric(g)?a==BI.size(e)-1?e[a].attr("width",f-1).css("width",f-1):e[a].attr("width",f).css("width",f):e[a].attr("width","").css("width","")}else a==BI.size(e)-1?e[a].attr("width",f-1).css("width",f-1):e[a].attr("width",f).css("width",f)}),BI.each(b.bodyItems,function(d,e){if(e[a])if(b.bodyTds[d][a].__mergeCols.length>1){var g=0;BI.each(c.columnSize,function(c,e){b.bodyTds[d][a].__mergeCols.contains(c)&&(g+=e)}),g=b._calculateWidth(g),g>1&&(g+=b.bodyTds[d][a].__mergeCols.length-1),BI.isNumeric(g)?a==BI.size(e)-1?e[a].element.attr("width",g-1).css("width",g-1):e[a].element.attr("width",g).css("width",g):e[a].element.attr("width","").css("width","")}else BI.isNumeric(f)?a==BI.size(e)-1?e[a].element.attr("width",f-1).css("width",f-1):e[a].element.attr("width",f).css("width",f):e[a].element.attr("width","").css("width","")}),BI.each(b.headerItems,function(d,e){if(e[a])if(b.headerTds[d][a].__mergeCols.length>1){var g=0;BI.each(c.columnSize,function(c,e){b.headerTds[d][a].__mergeCols.contains(c)&&(g+=e)}),g=b._calculateWidth(g),g>1&&(g+=b.headerTds[d][a].__mergeCols.length-1),BI.isNumeric(g)?a==BI.size(e)-1?e[a].element.attr("width",g-1).css("width",g-1):e[a].element.attr("width",g).css("width",g):e[a].element.attr("width","").css("width","")}else BI.isNumeric(f)?a==BI.size(e)-1?e[a].element.attr("width",f-1).css("width",f-1):e[a].element.attr("width",f).css("width",f):e[a].element.attr("width","").css("width","")}),BI.each(b.footerItems,function(d,e){if(e[a])if(b.footerTds[d][a].__mergeCols.length>1){var g=0;BI.each(c.columnSize,function(c,e){b.footerTds[d][a].__mergeCols.contains(c)&&(g+=e)}),g=b._calculateWidth(g),g>1&&(g+=b.footerTds[d][a].__mergeCols.length-1),BI.isNumeric(g)?a==BI.size(e)-1?e[a].element.attr("width",g-1).css("width",g-1):e[a].element.attr("width",g).css("width",g):e[a].element.attr("width","").css("width","")}else BI.isNumeric(f)?a==BI.size(e)-1?e[a].element.attr("width",f-1).css("width",f-1):e[a].element.attr("width",f).css("width",f):e[a].element.attr("width","").css("width","")})}});var n=this._calculateWidth(BI.sum(c.columnSize));n>1.05&&(n+=c.columnSize.length),n>1.05&&this.tableContainer.element.width(n)}},getColumnSize:function(){return this.options.columnSize},getCalculateColumnSize:function(){var a=this,b=this.options,c=[];if(b.isNeedFreeze===!0){if(BI.size(this.bottomLeftBodyTds)>0||BI.size(this.bottomRightBodyTds)>0)return BI.any(this.bottomLeftBodyTds,function(a,b){if(!BI.any(b,function(a,b){if(b.__mergeCols.length>1)return!0}))return BI.each(b,function(a,d){var e=d.width()/d.__mergeCols.length;a==BI.size(b)-1&&e++,c.push(e)}),!0})||BI.each(this.bottomLeftBodyTds[0],function(b,d){var e=d.width()/d.__mergeCols.length;b==BI.size(a.bottomLeftBodyTds[0])-1&&e++,c.push(e)}),BI.any(this.bottomRightBodyTds,function(a,b){if(!BI.any(b,function(a,b){if(b.__mergeCols.length>1)return!0}))return BI.each(b,function(a,d){var e=d.width()/d.__mergeCols.length;a==BI.size(b)-1&&e++,c.push(e)}),!0})||BI.each(this.bottomRightBodyTds[0],function(b,d){var e=d.width()/d.__mergeCols.length;b==BI.size(a.bottomRightBodyTds[0])-1&&e++,c.push(e)}),c;BI.any(this.topLeftBodyTds,function(a,b){if(!BI.any(b,function(a,b){if(b.__mergeCols.length>1)return!0}))return BI.each(b,function(a,d){var e=d.width()/d.__mergeCols.length;a==BI.size(b)-1&&e++,c.push(e)}),!0})||BI.each(this.topLeftBodyTds[BI.size(this.topLeftBodyTds)-1],function(b,d){var e=d.width()/d.__mergeCols.length;b==BI.size(a.topLeftBodyTds[BI.size(a.topLeftBodyTds)-1])-1&&e++,c.push(e)}),BI.any(this.topRightBodyTds,function(a,b){if(!BI.any(b,function(a,b){if(b.__mergeCols.length>1)return!0}))return BI.each(b,function(a,d){var e=d.width()/d.__mergeCols.length;a==BI.size(b)-1&&e++,c.push(e)}),!0})||BI.each(this.topRightBodyTds[BI.size(this.topRightBodyTds)-1],function(b,d){var e=d.width()/d.__mergeCols.length;b==BI.size(a.topRightBodyTds[BI.size(a.topRightBodyTds)-1])-1&&e++,c.push(e)})}else BI.each(this.headerTds[BI.size(this.headerTds)-1],function(b,d){var e=d.width()/d.__mergeCols.length;b==BI.size(a.headerTds[BI.size(a.headerTds)-1])-1&&e++,c.push(e)});return c},setHeaderColumnSize:function(a){var b=this,c=this.options,d=this._isRightFreeze();if(c.isNeedFreeze){var e=[],f=[];BI.each(a,function(a,b){c.freezeCols.contains(a)?d?f.push(b):e.push(b):d?e.push(b):f.push(b)});var g=0,h=1,i=function(a){var c,d,i,j;switch(a){case g:c=b.topLeftColGroupTds,d=b.topLeftBodyTds,i=b.topLeftBodyItems,j=e;break;case h:c=b.topRightColGroupTds,d=b.topRightBodyTds,i=b.topRightBodyItems,j=f}BI.each(c,function(a,c){var e=0|c.attr("width");if(e!==j[a]){var f=b._calculateWidth(j[a]);c.attr("width",f).css("width",f),BI.each(d,function(c,d){if(d[a])if(d[a].__mergeCols.length>1){var e=0;BI.each(j,function(b,c){d[a].__mergeCols.contains(b)&&(e+=c)}),e=b._calculateWidth(e),e>1&&(e+=d[a].__mergeCols.length-1),BI.isNumeric(e)?a==BI.size(d)-1?d[a].attr("width",e-1).css("width",e-1):d[a].attr("width",e).css("width",e):d[a].attr("width","").css("width","")}else a==BI.size(d)-1?d[a].attr("width",f-1).css("width",f-1):d[a].attr("width",f).css("width",f)}),BI.each(i,function(c,e){if(e[a])if(d[c][a].__mergeCols.length>1){var g=0;BI.each(j,function(b,e){d[c][a].__mergeCols.contains(b)&&(g+=e)}),g=b._calculateWidth(g),g>1&&(g+=d[c][a].__mergeCols.length-1),BI.isNumeric(g)?a==BI.size(e)-1?e[a].element.attr("width",g-1).css("width",g-1):e[a].element.attr("width",g).css("width",g):e[a].element.attr("width","").css("width","")}else BI.isNumeric(f)?a==BI.size(e)-1?e[a].element.attr("width",f-1).css("width",f-1):e[a].element.attr("width",f).css("width",f):e[a].element.attr("width","").css("width","")})}})};i(g),i(h);var j=0,k=0;BI.each(a,function(a,b){c.freezeCols.contains(a)?j+=b:k+=b}),j=this._calculateWidth(j),k=this._calculateWidth(k),BI.isNumeric(j)&&(j=BI.parseFloat(j)+c.freezeCols.length),BI.isNumeric(k)&&(k=BI.parseFloat(k)+a.length-c.freezeCols.length),this.topLeftContainer.element.width(d?k:j),this.topRightContainer.element.width(d?j:k),this.scrollTopLeft.element[0].scrollLeft=this.scrollBottomLeft.element[0].scrollLeft,this.scrollTopRight.element[0].scrollLeft=this.scrollBottomRight.element[0].scrollLeft}else{BI.each(this.colgroupTds,function(c,d){var e=0|d.attr("width");if(e!==a[c]){var f=b._calculateWidth(a[c]);d.attr("width",f).css("width",f),BI.each(b.headerTds,function(d,e){if(e[c])if(e[c].__mergeCols.length>1){var g=0;BI.each(a,function(a,b){e[c].__mergeCols.contains(a)&&(g+=b)}),g=b._calculateWidth(g),g>1&&(g+=e[c].__mergeCols.length-1),BI.isNumeric(g)?c==BI.size(e)-1?e[c].element.attr("width",g-1).css("width",g-1):e[c].element.attr("width",g).css("width",g):e[c].attr("width","").css("width","")}else c==BI.size(e)-1?e[c].attr("width",f-1).css("width",f-1):e[c].attr("width",f).css("width",f)}),BI.each(b.headerItems,function(d,e){if(e[c])if(b.headerTds[d][c].__mergeCols.length>1){var g=0;BI.each(a,function(a,e){b.headerTds[d][c].__mergeCols.contains(a)&&(g+=e)}),g=b._calculateWidth(g),g>1&&(g+=b.headerTds[d][c].__mergeCols.length-1),BI.isNumeric(g)?c==BI.size(e)-1?e[c].element.attr("width",g-1).css("width",g-1):e[c].element.attr("width",g).css("width",g):e[c].element.attr("width","").css("width","")}else BI.isNumeric(f)?c==BI.size(e)-1?e[c].element.attr("width",f-1).css("width",f-1):e[c].element.attr("width",f).css("width",f):e[c].element.attr("width","").css("width","")})}});var l=this._calculateWidth(BI.sum(a));l>1.05&&(l+=a.length),this.tableContainer.element.width(l)}},setRegionColumnSize:function(a){var b=this.options;b.regionColumnSize=a,0===b.freezeCols.length?b.isNeedFreeze?(this.partitions.attr("columnSize",this._isRightFreeze()?["fill",0]:[0,"fill"]),this.partitions.resize()):this.tableContainer.element.width(a[0]):b.freezeCols.length>0&&b.freezeCols.length<b.columnSize.length?b.isNeedFreeze?(this.partitions.attr("columnSize",a),this.partitions.resize()):this.tableContainer.element.width(a[0]):b.isNeedFreeze?(this.partitions.attr("columnSize",this._isRightFreeze()?[0,"fill"]:["fill",0]),this.partitions.resize()):this.tableContainer.element.width(a[0])},getRegionColumnSize:function(){return this.options.regionColumnSize},getCalculateRegionColumnSize:function(){var a=this.options;return a.isNeedFreeze?[this.scrollBottomLeft.element.width(),this.scrollBottomRight.element.width()]:[this.scrollBottomRight.element.width()]},getCalculateRegionRowSize:function(){var a=this.options;return a.isNeedFreeze?[this.scrollTopRight.element.height(),this.scrollBottomRight.element.height()]:[this.scrollBottomRight.element.height()]},getClientRegionColumnSize:function(){var a=this.options;return a.isNeedFreeze?[this.scrollBottomLeft.element[0].clientWidth,this.scrollBottomRight.element[0].clientWidth]:[this.scrollBottomRight.element[0].clientWidth]},getClientRegionRowSize:function(){var a=this.options;return a.isNeedFreeze?[this.scrollBottomLeft.element[0].clientHeight,this.scrollBottomRight.element[0].clientHeight]:[this.scrollBottomRight.element[0].clientHeight]},getScrollRegionColumnSize:function(){var a=this.options;return a.isNeedFreeze?[this.scrollBottomLeft.element[0].scrollWidth,this.scrollBottomRight.element[0].scrollWidth]:[this.scrollBottomRight.element[0].scrollWidth]},getScrollRegionRowSize:function(){var a=this.options;return a.isNeedFreeze?a.freezeCols.length<a.columnSize.length?[this.scrollTopRight.element[0].scrollHeight,this.scrollBottomRight.element[0].scrollHeight]:[this.scrollTopLeft.element[0].scrollHeight,this.scrollBottomLeft.element[0].scrollHeight]:[this.scrollBottomRight.element[0].scrollHeight]},hasVerticalScroll:function(){var a=this.options;return a.isNeedFreeze?this.scrollBottomRight.element.hasVerticalScroll()||this.scrollBottomLeft.element.hasVerticalScroll():this.scrollBottomRight.element.hasVerticalScroll()},setVerticalScroll:function(a){var b=this.options;b.isNeedFreeze?(this.scrollBottomRight.element[0].scrollTop!==a&&(this.scrollBottomRight.element[0].scrollTop=a),this.scrollBottomLeft.element[0].scrollTop!==a&&(this.scrollBottomLeft.element[0].scrollTop=a)):this.scrollBottomRight.element[0].scrollTop!==a&&(this.scrollBottomRight.element[0].scrollTop=a)},setLeftHorizontalScroll:function(a){var b=this.options;b.isNeedFreeze?(this.scrollBottomLeft.element[0].scrollLeft!==a&&(this.scrollBottomLeft.element[0].scrollLeft=a),this.scrollTopLeft.element[0].scrollLeft!==a&&(this.scrollTopLeft.element[0].scrollLeft=a)):this.scrollBottomRight.element[0].scrollLeft!==a&&(this.scrollBottomRight.element[0].scrollLeft=a)},setRightHorizontalScroll:function(a){var b=this.options;b.isNeedFreeze?(this.scrollBottomRight.element[0].scrollLeft!==a&&(this.scrollBottomRight.element[0].scrollLeft=a),this.scrollTopRight.element[0].scrollLeft!==a&&(this.scrollTopRight.element[0].scrollLeft=a)):this.scrollBottomRight.element[0].scrollLeft!==a&&(this.scrollBottomRight.element[0].scrollLeft=a)},getVerticalScroll:function(){var a=this.options;return a.isNeedFreeze?this.scrollBottomRight.element[0].scrollTop||this.scrollBottomLeft.element[0].scrollTop:this.scrollBottomRight.element[0].scrollTop},getLeftHorizontalScroll:function(){var a=this.options;return a.isNeedFreeze?this.scrollBottomLeft.element[0].scrollLeft:this.scrollBottomRight.element[0].scrollLeft},getRightHorizontalScroll:function(){var a=this.options;return a.isNeedFreeze?this.scrollBottomRight.element[0].scrollLeft:this.scrollBottomRight.element[0].scrollLeft},getColumns:function(){var a=this.options;return a.isNeedFreeze?{topLeft:this.topLeftBodyItems,topRight:this.topRightBodyItems,bottomLeft:this.bottomLeftBodyItems,bottomRight:this.bottomRightBodyItems}:{header:this.headerItems,body:this.bodyItems,footer:this.footerItems}},populate:function(a,b){this.options.items=a||[],b&&(this.options.header=b),this.empty(),this.options.isNeedFreeze?this._createFreezeTable():this._createNormalTable()}}),BI.Table.EVENT_TABLE_AFTER_INIT="EVENT_TABLE_AFTER_INIT",BI.Table.EVENT_TABLE_RESIZE="EVENT_TABLE_RESIZE",BI.Table.EVENT_TABLE_SCROLL="EVENT_TABLE_SCROLL",BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE="EVENT_TABLE_BEFORE_COLUMN_RESIZE",BI.Table.EVENT_TABLE_COLUMN_RESIZE="EVENT_TABLE_COLUMN_RESIZE",BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE="EVENT_TABLE_AFTER_COLUMN_RESIZE",BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE="EVENT_TABLE_BEFORE_REGION_RESIZE",BI.Table.EVENT_TABLE_REGION_RESIZE="EVENT_TABLE_REGION_RESIZE",BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE="EVENT_TABLE_AFTER_REGION_RESIZE",BI.shortcut("bi.table_view",BI.Table),BI.ResizableTableCell=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-resizable-table-cell",cell:{},minSize:15,maxSize:Number.MAX_VALUE,start:BI.emptyFn,resize:BI.emptyFn,stop:BI.emptyFn})},_init:function(){function a(a){var b=BI.clamp(a,c.minSize,c.maxSize||Number.MAX_VALUE);return b}BI.ResizableTableCell.superclass._init.apply(this,arguments);var b=this,c=this.options;this.cell=BI.createWidget(BI.extend({type:"bi.label"},c.cell,{width:c.width,height:c.height}));var d=!1,e=0,f=0,g=c.width,h=new BI.MouseMoveTracker(function(i,j){h.isDragging()&&(d=!0,f+=i,e=a(g+f),b.handler.element.addClass("dragging"),c.resize(e))},function(){d===!0&&(e=a(e),c.stop(e),e=0,f=0,g=c.width,d=!1),b.handler.element.removeClass("dragging"),b.handler.element.removeClass("suitable"),h.releaseMouseMoves()},document);this.handler=BI.createWidget({type:"bi.absolute",cls:"resizable-table-cell-resizer-container",width:6,items:[{el:{type:"bi.layout",cls:"resizable-table-cell-resizer-knob",width:4},right:0,top:0,bottom:0}]}),this.handler.element.on("mousedown",function(b){g=c.width,a(g),h.captureMouseMoves(b)}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.cell,left:0,right:0,top:0,bottom:0},{el:this.handler,right:0,top:0,bottom:0}]})},setWidth:function(a){BI.ResizableTableCell.superclass.setWidth.apply(this,arguments);var b=this.options;this.cell.setWidth(b.width)},setHeight:function(a){BI.ResizableTableCell.superclass.setHeight.apply(this,arguments);var b=this.options;this.cell.setHeight(b.height)}}),BI.shortcut("bi.resizable_table_cell",BI.ResizableTableCell),BI.ResizableTable=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ResizableTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-resizable-table",el:{type:"bi.grid_table"},isNeedFreeze:!1,isNeedResize:!0,isResizeAdapt:!1,headerRowSize:25,rowSize:25,isNeedMerge:!0,mergeCols:[],mergeRule:BI.emptyFn,columnSize:[],minColumnSize:[],maxColumnSize:[],freezeCols:[],header:[],items:[],regionColumnSize:[]})},_init:function(){BI.ResizableTable.superclass._init.apply(this,arguments);var a=this,b=this.options;this.resizer=BI.createWidget({type:"bi.layout",cls:"resizable-table-resizer",invisible:!0,width:2}),this.regionResizerHandler=this._createResizerHandler(),this.table=BI.createWidget(b.el,{type:"bi.grid_table",
element:this,width:b.width,height:b.height,headerRowSize:b.headerRowSize,rowSize:b.rowSize,columnSize:b.columnSize,isNeedFreeze:b.isNeedFreeze,freezeCols:b.freezeCols,isNeedMerge:b.isNeedMerge,mergeCols:b.mergeCols,mergeRule:BI.bind(this._mergeRule,this),header:this._formatHeader(b.header),items:b.items,regionColumnSize:b.regionColumnSize}),this.table.on(BI.Table.EVENT_TABLE_SCROLL,function(){a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.regionResizerHandler,left:0,top:0,bottom:0},{el:this.resizer,left:0,top:0}]}),this._populate()},_mergeRule:function(a,b){var c=this.options;return"bi.resizable_table_cell"===a.type&&(a=a.cell),"bi.resizable_table_cell"===b.type&&(b=b.cell),c.mergeRule(a,b)},_createResizerHandler:function(){var a=this,b=this.options,c=BI.createWidget({type:"bi.absolute",cls:"resizable-table-region-resizer",invisible:!0,width:6,items:[{el:{type:"bi.layout",width:2,cls:"resizable-table-region-resizer-knob"},left:2,top:0,bottom:0}]}),d=0,e=0,f=0,g=!1,h=new BI.MouseMoveTracker(function(c,i){h.isDragging()&&(g=!0,e+=c,d=BI.clamp(f+e,15,b.width-15),a.regionResizerHandler.element.addClass("dragging"),a._setRegionResizerHandlerPosition(d-3,0))},function(){if(g===!0){if(b.regionColumnSize[0]=BI.clamp(d,15,b.width-15),a.table.setRegionColumnSize(b.regionColumnSize),b.isResizeAdapt===!0){var c=a._getFreezeColumnSize();b.columnSize[a._getFreezeColLength()-1]+=b.regionColumnSize[0]-c,a.table.setColumnSize(b.columnSize)}a._populate(),a.regionResizerHandler.element.removeClass("dragging"),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE),g=!1}h.releaseMouseMoves()},document);return c.element.on("mousedown",function(b){f=d=a._getRegionSize(),e=0,a._setResizerPosition(0,0),h.captureMouseMoves(b)}),c},_setResizerPosition:function(a,b){this.resizer.element.css({left:a+"px",top:b+"px"})},_setRegionResizerHandlerPosition:function(a,b){this.regionResizerHandler.element.css({left:a+"px",top:b+"px"})},_getRegionSize:function(){var a=this.options,b=a.regionColumnSize[0]||0;return a.isNeedFreeze===!1||0===a.freezeCols.length?0:(b||BI.each(a.freezeCols,function(c,d){b+=a.columnSize[d]}),b)},_getRegionRowSize:function(){var a=this.options;return[a.header.length*a.headerRowSize,Math.min(a.height-a.header.length*a.headerRowSize,a.items.length*a.rowSize)]},_getFreezeColLength:function(){var a=this.options;return a.isNeedFreeze===!0?BI.clamp(a.freezeCols.length,0,a.columnSize.length):0},_getFreezeColumnSize:function(){for(var a=this.options.columnSize,b=0,c=0,d=this._getFreezeColLength();c<d;c++)b+=a[c];return b},_getResizerLeft:function(a){for(var b=0,c=this.options.columnSize,d=this._getFreezeColLength(),e=a>=d?d:0;e<a;e++)b+=c[e]||0;return a>=d?(b+=this.table.getRegionSize(),b-=this.table.getRightHorizontalScroll()):b-=this.table.getLeftHorizontalScroll(),b},_formatHeader:function(a){var b=this,c=this.options,d=[],e=function(a,d){b.resizer.setVisible(!0);var e=c.headerRowSize+b._getRegionRowSize()[1];b.resizer.setHeight(e),b._setResizerPosition(b._getResizerLeft(a)+d,(c.header.length-1)*c.headerRowSize)},f=function(a,d){b.resizer.setVisible(!1);var e=c.columnSize.slice();e[a]=d,c.columnSize=e,b.table.setColumnSize(e),b._populate(),b.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE)};return BI.each(a,function(g,h){g===a.length-1?(d[g]=[],BI.each(h,function(a,i){if(a===b._getFreezeColLength()-1||a===h.length-1)d[g][a]=i;else if(d[g][a]={type:"bi.resizable_table_cell",cell:i,suitableSize:c.minColumnSize[a],maxSize:c.maxColumnSize[a],resize:BI.bind(e,null,a),stop:BI.bind(f,null,a)},c.isNeedMerge)for(var j=g;j>0&&b._mergeRule(d[j][a],d[j-1][a]);)d[j-1][a]={type:"bi.resizable_table_cell",cell:d[j-1][a],suitableSize:c.minColumnSize[a],maxSize:c.maxColumnSize[a],resize:BI.bind(e,null,a),stop:BI.bind(f,null,a)},j--})):d.push(h)}),d},_populate:function(){var a=(this.options,this._getRegionSize());a>0?(this.regionResizerHandler.setVisible(!0),this._setRegionResizerHandlerPosition(a-3,0)):this.regionResizerHandler.setVisible(!1)},setWidth:function(a){BI.ResizableTable.superclass.setWidth.apply(this,arguments),this.table.setWidth(a)},setHeight:function(a){BI.ResizableTable.superclass.setHeight.apply(this,arguments),this.table.setHeight(a)},setVerticalScroll:function(a){this.table.setVerticalScroll(a)},setLeftHorizontalScroll:function(a){this.table.setLeftHorizontalScroll(a)},setRightHorizontalScroll:function(a){this.table.setRightHorizontalScroll(a)},setColumnSize:function(a){this.options.columnSize=a,this.table.setColumnSize(a)},getColumnSize:function(){return this.table.getColumnSize()},setRegionColumnSize:function(a){this.options.regionColumnSize=a,this.table.setRegionColumnSize(a)},getRegionColumnSize:function(){return this.table.getRegionColumnSize()},getVerticalScroll:function(){return this.table.getVerticalScroll()},getLeftHorizontalScroll:function(){return this.table.getLeftHorizontalScroll()},getRightHorizontalScroll:function(){return this.table.getRightHorizontalScroll()},attr:function(){BI.ResizableTable.superclass.attr.apply(this,arguments),this.table.attr.apply(this.table,arguments)},restore:function(){this.table.restore()},populate:function(a,b){a&&(this.options.items=a),b&&(this.options.header=b,this.options.isNeedResize&&(b=this._formatHeader(b))),this.table.populate(a,b),this._populate()}}),BI.shortcut("bi.resizable_table",BI.ResizableTable),BI.CustomTree=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.CustomTree.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-custom-tree",expander:{el:{},popup:{type:"bi.custom_tree"}},items:[],itemsCreator:BI.emptyFn,el:{type:"bi.button_tree",chooseType:0,layouts:[{type:"bi.vertical"}]}})},_init:function(){BI.CustomTree.superclass._init.apply(this,arguments),this.initTree(this.options.items)},_formatItems:function(a){var b=this,c=this.options;a=BI.Tree.transformToTreeFormat(a);var d=[];return BI.each(a,function(a,e){if(BI.isNotEmptyArray(e.children)||e.isParent===!0){var f=BI.extend({type:"bi.expander",el:{},popup:{type:"bi.custom_tree"}},BI.deepClone(c.expander),{id:e.id,pId:e.pId,value:e.value}),g=BI.stripEL(e);BI.isWidget(g)?f.el=g:(g=BI.clone(g),delete g.children,BI.extend(f.el,g)),f.popup.expander=BI.deepClone(c.expander),f.items=f.popup.items=e.children,f.itemsCreator=f.popup.itemsCreator=function(a){if(BI.isNotNull(a.node))return c.itemsCreator.apply(b,arguments);var d=Array.prototype.slice.call(arguments,0);return d[0].node=e,c.itemsCreator.apply(b,d)},BI.isNull(f.popup.el)&&(f.popup.el=BI.deepClone(c.el)),d.push(f)}else d.push(e)}),d},initTree:function(a){var b=this,c=this.options;this.tree=BI.createWidget(c.el,{element:this,items:this._formatItems(a),itemsCreator:function(a,d){c.itemsCreator.apply(this,[a,function(a){var c=Array.prototype.slice.call(arguments,0);c[0]=b._formatItems(a),d.apply(null,c)}])}}),this.tree.on(BI.Controller.EVENT_CHANGE,function(a,c,d){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.CustomTree.EVENT_CHANGE,c,d)})},stroke:function(a){this.populate.apply(this,arguments)},populate:function(a){var b=Array.prototype.slice.call(arguments,0);arguments.length>0&&(b[0]=this._formatItems(a)),this.tree.populate.apply(this.tree,b)},setValue:function(a){this.tree&&this.tree.setValue(a)},getValue:function(){return this.tree?this.tree.getValue():[]},getAllButtons:function(){return this.tree?this.tree.getAllButtons():[]},getAllLeaves:function(){return this.tree?this.tree.getAllLeaves():[]},getNodeById:function(a){return this.tree&&this.tree.getNodeById(a)},getNodeByValue:function(a){return this.tree&&this.tree.getNodeByValue(a)},empty:function(){this.tree.empty()}}),BI.CustomTree.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.custom_tree",BI.CustomTree),function($){var settings={},roots={},caches={},_consts={className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand",COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error",REMOVE:"ztree_remove",SELECTED:"ztree_selected",UNSELECTED:"ztree_unselected"},id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_setting={treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:!0,dblClickExpand:!0,expandSpeed:"fast",fontCss:{},nameIsHTML:!1,selectedMulti:!0,showIcon:!0,showLine:!0,showTitle:!0,txtSelectedEnable:!1},data:{key:{children:"children",name:"name",title:"",url:"url"},simpleData:{enable:!1,idKey:"id",pIdKey:"pId",rootPId:null},keep:{parent:!1,leaf:!1}},async:{enable:!1,contentType:"application/x-www-form-urlencoded",type:"post",dataType:"text",url:"",autoParam:[],otherParam:[],dataFilter:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null}},_initRoot=function(a){var b=data.getRoot(a);b||(b={},data.setRoot(a,b)),b[a.data.key.children]=[],b.expandTriggerFlag=!1,b.curSelectedList=[],b.noSelection=!0,b.createdNodes=[],b.zId=0,b._ver=(new Date).getTime()},_initCache=function(a){var b=data.getCache(a);b||(b={},data.setCache(a,b)),b.nodes=[],b.doms=[]},_bindEvent=function(a){var b=a.treeObj,c=consts.event;b.bind(c.NODECREATED,function(b,c,d){tools.apply(a.callback.onNodeCreated,[b,c,d])}),b.bind(c.CLICK,function(b,c,d,e,f){tools.apply(a.callback.onClick,[c,d,e,f])}),b.bind(c.EXPAND,function(b,c,d){tools.apply(a.callback.onExpand,[b,c,d])}),b.bind(c.COLLAPSE,function(b,c,d){tools.apply(a.callback.onCollapse,[b,c,d])}),b.bind(c.ASYNC_SUCCESS,function(b,c,d,e){tools.apply(a.callback.onAsyncSuccess,[b,c,d,e])}),b.bind(c.ASYNC_ERROR,function(b,c,d,e,f,g){tools.apply(a.callback.onAsyncError,[b,c,d,e,f,g])}),b.bind(c.REMOVE,function(b,c,d){tools.apply(a.callback.onRemove,[b,c,d])}),b.bind(c.SELECTED,function(b,c,d,e){tools.apply(a.callback.onSelected,[c,d,e])}),b.bind(c.UNSELECTED,function(b,c,d,e){tools.apply(a.callback.onUnSelected,[c,d,e])})},_unbindEvent=function(a){var b=a.treeObj,c=consts.event;b.unbind(c.NODECREATED).unbind(c.CLICK).unbind(c.EXPAND).unbind(c.COLLAPSE).unbind(c.ASYNC_SUCCESS).unbind(c.ASYNC_ERROR).unbind(c.REMOVE).unbind(c.SELECTED).unbind(c.UNSELECTED)},_eventProxy=function(a){var b=a.target,c=data.getSetting(a.data.treeId),d="",e=null,f="",g="",h=null,i=null,j=null;if(tools.eqs(a.type,"mousedown")?g="mousedown":tools.eqs(a.type,"mouseup")?g="mouseup":tools.eqs(a.type,"contextmenu")?g="contextmenu":tools.eqs(a.type,"click")?tools.eqs(b.tagName,"span")&&null!==b.getAttribute("treeNode"+consts.id.SWITCH)?(d=tools.getNodeMainDom(b).id,f="switchNode"):(j=tools.getMDom(c,b,[{tagName:"a",attrName:"treeNode"+consts.id.A}]),j&&(d=tools.getNodeMainDom(j).id,f="clickNode")):tools.eqs(a.type,"dblclick")&&(g="dblclick",j=tools.getMDom(c,b,[{tagName:"a",attrName:"treeNode"+consts.id.A}]),j&&(d=tools.getNodeMainDom(j).id,f="switchNode")),g.length>0&&0==d.length&&(j=tools.getMDom(c,b,[{tagName:"a",attrName:"treeNode"+consts.id.A}]),j&&(d=tools.getNodeMainDom(j).id)),d.length>0)switch(e=data.getNodeCache(c,d),f){case"switchNode":e.isParent&&(tools.eqs(a.type,"click")||tools.eqs(a.type,"dblclick")&&tools.apply(c.view.dblClickExpand,[c.treeId,e],c.view.dblClickExpand))?h=handler.onSwitchNode:f="";break;case"clickNode":h=handler.onClickNode}switch(g){case"mousedown":i=handler.onZTreeMousedown;break;case"mouseup":i=handler.onZTreeMouseup;break;case"dblclick":i=handler.onZTreeDblclick;break;case"contextmenu":i=handler.onZTreeContextmenu}var k={stop:!1,node:e,nodeEventType:f,nodeEventCallback:h,treeEventType:g,treeEventCallback:i};return k},_initNode=function(a,b,c,d,e,f,g){if(c){var h=data.getRoot(a),i=a.data.key.children;c.level=b,c.tId=a.treeId+"_"+ ++h.zId,c.parentTId=d?d.tId:null,c.open="string"==typeof c.open?tools.eqs(c.open,"true"):!!c.open,c[i]&&c[i].length>0?(c.isParent=!0,c.zAsync=!0):(c.isParent="string"==typeof c.isParent?tools.eqs(c.isParent,"true"):!!c.isParent,c.open=!(!c.isParent||a.async.enable)&&c.open,c.zAsync=!c.isParent),c.isFirstNode=e,c.isLastNode=f,c.getParentNode=function(){return data.getNodeCache(a,c.parentTId)},c.getPreNode=function(){return data.getPreNode(a,c)},c.getNextNode=function(){return data.getNextNode(a,c)},c.isAjaxing=!1,data.fixPIdKeyValue(a,c)}},_init={bind:[_bindEvent],unbind:[_unbindEvent],caches:[_initCache],nodes:[_initNode],proxys:[_eventProxy],roots:[_initRoot],beforeA:[],afterA:[],innerBeforeA:[],innerAfterA:[],zTreeTools:[]},data={addNodeCache:function(a,b){data.getCache(a).nodes[data.getNodeCacheId(b.tId)]=b},getNodeCacheId:function(a){return a.substring(a.lastIndexOf("_")+1)},addAfterA:function(a){_init.afterA.push(a)},addBeforeA:function(a){_init.beforeA.push(a)},addInnerAfterA:function(a){_init.innerAfterA.push(a)},addInnerBeforeA:function(a){_init.innerBeforeA.push(a)},addInitBind:function(a){_init.bind.push(a)},addInitUnBind:function(a){_init.unbind.push(a)},addInitCache:function(a){_init.caches.push(a)},addInitNode:function(a){_init.nodes.push(a)},addInitProxy:function(a,b){b?_init.proxys.splice(0,0,a):_init.proxys.push(a)},addInitRoot:function(a){_init.roots.push(a)},addNodesData:function(a,b,c){var d=a.data.key.children;b[d]||(b[d]=[]),b[d].length>0&&(b[d][b[d].length-1].isLastNode=!1,view.setNodeLineIcos(a,b[d][b[d].length-1])),b.isParent=!0,b[d]=b[d].concat(c)},addSelectedNode:function(a,b){var c=data.getRoot(a);data.isSelectedNode(a,b)||c.curSelectedList.push(b)},addCreatedNode:function(a,b){if(a.callback.onNodeCreated||a.view.addDiyDom){var c=data.getRoot(a);c.createdNodes.push(b)}},addZTreeTools:function(a){_init.zTreeTools.push(a)},exSetting:function(a){$.extend(!0,_setting,a)},fixPIdKeyValue:function(a,b){a.data.simpleData.enable&&(b[a.data.simpleData.pIdKey]=b.parentTId?b.getParentNode()[a.data.simpleData.idKey]:a.data.simpleData.rootPId)},getAfterA:function(a,b,c){for(var d=0,e=_init.afterA.length;d<e;d++)_init.afterA[d].apply(this,arguments)},getBeforeA:function(a,b,c){for(var d=0,e=_init.beforeA.length;d<e;d++)_init.beforeA[d].apply(this,arguments)},getInnerAfterA:function(a,b,c){for(var d=0,e=_init.innerAfterA.length;d<e;d++)_init.innerAfterA[d].apply(this,arguments)},getInnerBeforeA:function(a,b,c){for(var d=0,e=_init.innerBeforeA.length;d<e;d++)_init.innerBeforeA[d].apply(this,arguments)},getCache:function(a){return caches[a.treeId]},getNextNode:function(a,b){if(!b)return null;for(var c=a.data.key.children,d=b.parentTId?b.getParentNode():data.getRoot(a),e=0,f=d[c].length-1;e<=f;e++)if(d[c][e]===b)return e==f?null:d[c][e+1];return null},getNodeByParam:function(a,b,c,d){if(!b||!c)return null;for(var e=a.data.key.children,f=0,g=b.length;f<g;f++){if(b[f][c]==d)return b[f];var h=data.getNodeByParam(a,b[f][e],c,d);if(h)return h}return null},getNodeCache:function(a,b){if(!b)return null;var c=caches[a.treeId].nodes[data.getNodeCacheId(b)];return c?c:null},getNodeName:function(a,b){var c=a.data.key.name;return""+b[c]},getNodeTitle:function(a,b){var c=""===a.data.key.title?a.data.key.name:a.data.key.title;return""+b[c]},getNodes:function(a){return data.getRoot(a)[a.data.key.children]},getNodesByParam:function(a,b,c,d){if(!b||!c)return[];for(var e=a.data.key.children,f=[],g=0,h=b.length;g<h;g++)b[g][c]==d&&f.push(b[g]),f=f.concat(data.getNodesByParam(a,b[g][e],c,d));return f},getNodesByParamFuzzy:function(a,b,c,d){if(!b||!c)return[];var e=a.data.key.children,f=[];d=d.toLowerCase();for(var g=0,h=b.length;g<h;g++)"string"==typeof b[g][c]&&b[g][c].toLowerCase().indexOf(d)>-1&&f.push(b[g]),f=f.concat(data.getNodesByParamFuzzy(a,b[g][e],c,d));return f},getNodesByFilter:function(a,b,c,d,e){if(!b)return d?null:[];for(var f=a.data.key.children,g=d?null:[],h=0,i=b.length;h<i;h++){if(tools.apply(c,[b[h],e],!1)){if(d)return b[h];g.push(b[h])}var j=data.getNodesByFilter(a,b[h][f],c,d,e);if(d&&j)return j;g=d?j:g.concat(j)}return g},getPreNode:function(a,b){if(!b)return null;for(var c=a.data.key.children,d=b.parentTId?b.getParentNode():data.getRoot(a),e=0,f=d[c].length;e<f;e++)if(d[c][e]===b)return 0==e?null:d[c][e-1];return null},getRoot:function(a){return a?roots[a.treeId]:null},getRoots:function(){return roots},getSetting:function(a){return settings[a]},getSettings:function(){return settings},getZTreeTools:function(a){var b=this.getRoot(this.getSetting(a));return b?b.treeTools:null},initCache:function(a){for(var b=0,c=_init.caches.length;b<c;b++)_init.caches[b].apply(this,arguments)},initNode:function(a,b,c,d,e,f){for(var g=0,h=_init.nodes.length;g<h;g++)_init.nodes[g].apply(this,arguments)},initRoot:function(a){for(var b=0,c=_init.roots.length;b<c;b++)_init.roots[b].apply(this,arguments)},isSelectedNode:function(a,b){for(var c=data.getRoot(a),d=0,e=c.curSelectedList.length;d<e;d++)if(b===c.curSelectedList[d])return!0;return!1},removeNodeCache:function(a,b){var c=a.data.key.children;if(b[c])for(var d=0,e=b[c].length;d<e;d++)arguments.callee(a,b[c][d]);data.getCache(a).nodes[data.getNodeCacheId(b.tId)]=null},removeSelectedNode:function(a,b){for(var c=data.getRoot(a),d=0,e=c.curSelectedList.length;d<e;d++)b!==c.curSelectedList[d]&&data.getNodeCache(a,c.curSelectedList[d].tId)||(c.curSelectedList.splice(d,1),d--,e--)},setCache:function(a,b){caches[a.treeId]=b},setRoot:function(a,b){roots[a.treeId]=b},setZTreeTools:function(a,b){for(var c=0,d=_init.zTreeTools.length;c<d;c++)_init.zTreeTools[c].apply(this,arguments)},transformToArrayFormat:function(a,b){if(!b)return[];var c=a.data.key.children,d=[];if(tools.isArray(b))for(var e=0,f=b.length;e<f;e++)d.push(b[e]),b[e][c]&&(d=d.concat(data.transformToArrayFormat(a,b[e][c])));else d.push(b),b[c]&&(d=d.concat(data.transformToArrayFormat(a,b[c])));return d},transformTozTreeFormat:function(a,b){var c,d,e=a.data.simpleData.idKey,f=a.data.simpleData.pIdKey,g=a.data.key.children;if(!e||""==e||!b)return[];if(tools.isArray(b)){var h=[],i=[];for(c=0,d=b.length;c<d;c++)i[b[c][e]]=b[c];for(c=0,d=b.length;c<d;c++)i[b[c][f]]&&b[c][e]!=b[c][f]?(i[b[c][f]][g]||(i[b[c][f]][g]=[]),i[b[c][f]][g].push(b[c])):h.push(b[c]);return h}return[b]}},event={bindEvent:function(a){for(var b=0,c=_init.bind.length;b<c;b++)_init.bind[b].apply(this,arguments)},unbindEvent:function(a){for(var b=0,c=_init.unbind.length;b<c;b++)_init.unbind[b].apply(this,arguments)},bindTree:function(a){var b={treeId:a.treeId},c=a.treeObj;a.view.txtSelectedEnable||c.bind("selectstart",function(a){var b=a.originalEvent.srcElement.nodeName.toLowerCase();return"input"===b||"textarea"===b}).css({"-moz-user-select":"-moz-none"}),c.bind("click",b,event.proxy),c.bind("dblclick",b,event.proxy),c.bind("mouseover",b,event.proxy),c.bind("mouseout",b,event.proxy),c.bind("mousedown",b,event.proxy),c.bind("mouseup",b,event.proxy),c.bind("contextmenu",b,event.proxy)},unbindTree:function(a){var b=a.treeObj;b.unbind("click",event.proxy).unbind("dblclick",event.proxy).unbind("mouseover",event.proxy).unbind("mouseout",event.proxy).unbind("mousedown",event.proxy).unbind("mouseup",event.proxy).unbind("contextmenu",event.proxy)},doProxy:function(a){for(var b=[],c=0,d=_init.proxys.length;c<d;c++){var e=_init.proxys[c].apply(this,arguments);if(b.push(e),e.stop)break}return b},proxy:function(a){var b=data.getSetting(a.data.treeId);if(!tools.uCanDo(b,a))return!0;for(var c=event.doProxy(a),d=!0,e=!1,f=0,g=c.length;f<g;f++){var h=c[f];h.nodeEventCallback&&(e=!0,d=h.nodeEventCallback.apply(h,[a,h.node])&&d),h.treeEventCallback&&(e=!0,d=h.treeEventCallback.apply(h,[a,h.node])&&d)}return d}},handler={onSwitchNode:function(a,b){var c=data.getSetting(a.data.treeId);if(b.open){if(0==tools.apply(c.callback.beforeCollapse,[c.treeId,b],!0))return!0;data.getRoot(c).expandTriggerFlag=!0,view.switchNode(c,b)}else{if(0==tools.apply(c.callback.beforeExpand,[c.treeId,b],!0))return!0;data.getRoot(c).expandTriggerFlag=!0,view.switchNode(c,b)}return!0},onClickNode:function(a,b){var c=data.getSetting(a.data.treeId),d=c.view.autoCancelSelected&&(a.ctrlKey||a.metaKey)&&data.isSelectedNode(c,b)?0:c.view.autoCancelSelected&&(a.ctrlKey||a.metaKey)&&c.view.selectedMulti?2:1;return 0==tools.apply(c.callback.beforeClick,[c.treeId,b,d],!0)||(0===d?view.cancelPreSelectedNode(c,b):view.selectNode(c,b,2===d),c.treeObj.trigger(consts.event.CLICK,[a,c.treeId,b,d]),!0)},onZTreeMousedown:function(a,b){var c=data.getSetting(a.data.treeId);return tools.apply(c.callback.beforeMouseDown,[c.treeId,b],!0)&&tools.apply(c.callback.onMouseDown,[a,c.treeId,b]),!0},onZTreeMouseup:function(a,b){var c=data.getSetting(a.data.treeId);return tools.apply(c.callback.beforeMouseUp,[c.treeId,b],!0)&&tools.apply(c.callback.onMouseUp,[a,c.treeId,b]),!0},onZTreeDblclick:function(a,b){var c=data.getSetting(a.data.treeId);return tools.apply(c.callback.beforeDblClick,[c.treeId,b],!0)&&tools.apply(c.callback.onDblClick,[a,c.treeId,b]),!0},onZTreeContextmenu:function(a,b){var c=data.getSetting(a.data.treeId);return tools.apply(c.callback.beforeRightClick,[c.treeId,b],!0)&&tools.apply(c.callback.onRightClick,[a,c.treeId,b]),"function"!=typeof c.callback.onRightClick}},tools={apply:function(a,b,c){return"function"==typeof a?a.apply(zt,b?b:[]):c},canAsync:function(a,b){var c=a.data.key.children;return a.async.enable&&b&&b.isParent&&!(b.zAsync||b[c]&&b[c].length>0)},clone:function(a){if(null===a)return null;var b=tools.isArray(a)?[]:{};for(var c in a)b[c]=a[c]instanceof Date?new Date(a[c].getTime()):"object"==typeof a[c]?arguments.callee(a[c]):a[c];return b},eqs:function(a,b){return a.toLowerCase()===b.toLowerCase()},isArray:function(a){return"[object Array]"===Object.prototype.toString.apply(a)},$:function(a,b,c){return b&&"string"!=typeof b&&(c=b,b=""),"string"==typeof a?$(a,c?c.treeObj.get(0).ownerDocument:null):$("#"+a.tId+b,c?c.treeObj:null)},getMDom:function(a,b,c){if(!b)return null;for(;b&&b.id!==a.treeId;){for(var d=0,e=c.length;b.tagName&&d<e;d++)if(tools.eqs(b.tagName,c[d].tagName)&&null!==b.getAttribute(c[d].attrName))return b;b=b.parentNode}return null},getNodeMainDom:function(a){return $(a).parent("li").get(0)||$(a).parentsUntil("li").parent().get(0)},isChildOrSelf:function(a,b){return $(a).closest("#"+b).length>0},uCanDo:function(a,b){return!0}},view={addNodes:function(a,b,c,d){if(!a.data.keep.leaf||!b||b.isParent)if(tools.isArray(c)||(c=[c]),a.data.simpleData.enable&&(c=data.transformTozTreeFormat(a,c)),b){var e=$$(b,consts.id.SWITCH,a),f=$$(b,consts.id.ICON,a),g=$$(b,consts.id.UL,a);b.open||(view.replaceSwitchClass(b,e,consts.folder.CLOSE),view.replaceIcoClass(b,f,consts.folder.CLOSE),b.open=!1,g.css({display:"none"})),data.addNodesData(a,b,c),view.createNodes(a,b.level+1,c,b),d||view.expandCollapseParentNode(a,b,!0)}else data.addNodesData(a,data.getRoot(a),c),view.createNodes(a,0,c,null)},appendNodes:function(a,b,c,d,e,f){if(!c)return[];for(var g=[],h=a.data.key.children,i=0,j=c.length;i<j;i++){var k=c[i];if(e){var l=d?d:data.getRoot(a),m=l[h],n=m.length==c.length&&0==i,o=i==c.length-1;data.initNode(a,b,k,d,n,o,f),data.addNodeCache(a,k)}var p=[];k[h]&&k[h].length>0&&(p=view.appendNodes(a,b+1,k[h],k,e,f&&k.open)),f&&(view.makeDOMNodeMainBefore(g,a,k),view.makeDOMNodeLine(g,a,k),data.getBeforeA(a,k,g),view.makeDOMNodeNameBefore(g,a,k),data.getInnerBeforeA(a,k,g),view.makeDOMNodeIcon(g,a,k),data.getInnerAfterA(a,k,g),view.makeDOMNodeNameAfter(g,a,k),data.getAfterA(a,k,g),k.isParent&&k.open&&view.makeUlHtml(a,k,g,p.join("")),view.makeDOMNodeMainAfter(g,a,k),data.addCreatedNode(a,k))}return g},appendParentULDom:function(a,b){var c=[],d=$$(b,a);!d.get(0)&&b.parentTId&&(view.appendParentULDom(a,b.getParentNode()),d=$$(b,a));var e=$$(b,consts.id.UL,a);e.get(0)&&e.remove();var f=a.data.key.children,g=view.appendNodes(a,b.level+1,b[f],b,!1,!0);view.makeUlHtml(a,b,c,g.join("")),d.append(c.join(""))},asyncNode:function(setting,node,isSilent,callback){var i,l;if(node&&!node.isParent)return tools.apply(callback),!1;if(node&&node.isAjaxing)return!1;if(0==tools.apply(setting.callback.beforeAsync,[setting.treeId,node],!0))return tools.apply(callback),!1;if(node){node.isAjaxing=!0;var icoObj=$$(node,consts.id.ICON,setting);icoObj.attr({style:"","class":consts.className.BUTTON+" "+consts.className.ICO_LOADING})}var tmpParam={};for(i=0,l=setting.async.autoParam.length;node&&i<l;i++){var pKey=setting.async.autoParam[i].split("="),spKey=pKey;pKey.length>1&&(spKey=pKey[1],pKey=pKey[0]),tmpParam[spKey]=node[pKey]}if(tools.isArray(setting.async.otherParam))for(i=0,l=setting.async.otherParam.length;i<l;i+=2)tmpParam[setting.async.otherParam[i]]=setting.async.otherParam[i+1];else for(var p in setting.async.otherParam)tmpParam[p]=setting.async.otherParam[p];var _tmpV=data.getRoot(setting)._ver;return $.ajax({contentType:setting.async.contentType,cache:!1,type:setting.async.type,url:tools.apply(setting.async.url,[setting.treeId,node],setting.async.url),data:tmpParam,dataType:setting.async.dataType,success:function(msg){if(_tmpV==data.getRoot(setting)._ver){var newNodes=[];try{newNodes=msg&&0!=msg.length?"string"==typeof msg?eval("("+msg+")"):msg:[]}catch(err){newNodes=msg}node&&(node.isAjaxing=null,node.zAsync=!0),view.setNodeLineIcos(setting,node),newNodes&&""!==newNodes?(newNodes=tools.apply(setting.async.dataFilter,[setting.treeId,node,newNodes],newNodes),view.addNodes(setting,node,newNodes?tools.clone(newNodes):[],!!isSilent)):view.addNodes(setting,node,[],!!isSilent),setting.treeObj.trigger(consts.event.ASYNC_SUCCESS,[setting.treeId,node,msg]),tools.apply(callback)}},error:function(a,b,c){_tmpV==data.getRoot(setting)._ver&&(node&&(node.isAjaxing=null),view.setNodeLineIcos(setting,node),setting.treeObj.trigger(consts.event.ASYNC_ERROR,[setting.treeId,node,a,b,c]))}}),!0},cancelPreSelectedNode:function(a,b,c){var d,e,f=data.getRoot(a).curSelectedList;for(d=f.length-1;d>=0;d--)if(e=f[d],b===e||!b&&(!c||c!==e)){if($$(e,consts.id.A,a).removeClass(consts.node.CURSELECTED),b){data.removeSelectedNode(a,b),a.treeObj.trigger(consts.event.UNSELECTED,[event,a.treeId,e]);break}f.splice(d,1),a.treeObj.trigger(consts.event.UNSELECTED,[event,a.treeId,e])}},createNodeCallback:function(a){if(a.callback.onNodeCreated||a.view.addDiyDom)for(var b=data.getRoot(a);b.createdNodes.length>0;){var c=b.createdNodes.shift();tools.apply(a.view.addDiyDom,[a.treeId,c]),a.callback.onNodeCreated&&a.treeObj.trigger(consts.event.NODECREATED,[a.treeId,c])}},createNodes:function(a,b,c,d){if(c&&0!=c.length){var e=data.getRoot(a),f=a.data.key.children,g=!d||d.open||!!$$(d[f][0],a).get(0);e.createdNodes=[];var h=view.appendNodes(a,b,c,d,!0,g);if(d){var i=$$(d,consts.id.UL,a);i.get(0)&&i.append(h.join(""))}else a.treeObj.append(h.join(""));view.createNodeCallback(a)}},destroy:function(a){a&&(data.initCache(a),data.initRoot(a),event.unbindTree(a),event.unbindEvent(a),a.treeObj.empty(),delete settings[a.treeId])},expandCollapseNode:function(a,b,c,d,e){var f=data.getRoot(a),g=a.data.key.children;if(!b)return void tools.apply(e,[]);if(f.expandTriggerFlag){var h=e;e=function(){h&&h(),b.open?a.treeObj.trigger(consts.event.EXPAND,[a.treeId,b]):a.treeObj.trigger(consts.event.COLLAPSE,[a.treeId,b])},f.expandTriggerFlag=!1}if(!b.open&&b.isParent&&(!$$(b,consts.id.UL,a).get(0)||b[g]&&b[g].length>0&&!$$(b[g][0],a).get(0))&&(view.appendParentULDom(a,b),view.createNodeCallback(a)),b.open==c)return void tools.apply(e,[]);var i=$$(b,consts.id.UL,a),j=$$(b,consts.id.SWITCH,a),k=$$(b,consts.id.ICON,a);b.isParent?(b.open=!b.open,b.iconOpen&&b.iconClose&&k.attr("style",view.makeNodeIcoStyle(a,b)),b.open?(view.replaceSwitchClass(b,j,consts.folder.OPEN),view.replaceIcoClass(b,k,consts.folder.OPEN),0==d||""==a.view.expandSpeed?(i.show(),tools.apply(e,[])):b[g]&&b[g].length>0?i.slideDown(a.view.expandSpeed,e):(i.show(),tools.apply(e,[]))):(view.replaceSwitchClass(b,j,consts.folder.CLOSE),view.replaceIcoClass(b,k,consts.folder.CLOSE),0!=d&&""!=a.view.expandSpeed&&b[g]&&b[g].length>0?i.slideUp(a.view.expandSpeed,e):(i.hide(),tools.apply(e,[])))):tools.apply(e,[])},expandCollapseParentNode:function(a,b,c,d,e){if(b){if(!b.parentTId)return void view.expandCollapseNode(a,b,c,d,e);view.expandCollapseNode(a,b,c,d),b.parentTId&&view.expandCollapseParentNode(a,b.getParentNode(),c,d,e)}},expandCollapseSonNode:function(a,b,c,d,e){var f=data.getRoot(a),g=a.data.key.children,h=b?b[g]:f[g],i=!b&&d,j=data.getRoot(a).expandTriggerFlag;if(data.getRoot(a).expandTriggerFlag=!1,h)for(var k=0,l=h.length;k<l;k++)h[k]&&view.expandCollapseSonNode(a,h[k],c,i);data.getRoot(a).expandTriggerFlag=j,view.expandCollapseNode(a,b,c,d,e)},isSelectedNode:function(a,b){if(!b)return!1;var c,d=data.getRoot(a).curSelectedList;for(c=d.length-1;c>=0;c--)if(b===d[c])return!0;return!1},makeDOMNodeIcon:function(a,b,c){var d=data.getNodeName(b,c),e=b.view.nameIsHTML?d:d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");a.push("<span id='",c.tId,consts.id.ICON,"' title='' treeNode",consts.id.ICON," class='",view.makeNodeIcoClass(b,c),"' style='",view.makeNodeIcoStyle(b,c),"'></span><span id='",c.tId,consts.id.SPAN,"'>",e,"</span>")},makeDOMNodeLine:function(a,b,c){a.push("<span id='",c.tId,consts.id.SWITCH,"' title='' class='",view.makeNodeLineClass(b,c),"' treeNode",consts.id.SWITCH,"></span>")},makeDOMNodeMainAfter:function(a,b,c){a.push("</li>")},makeDOMNodeMainBefore:function(a,b,c){a.push("<li id='",c.tId,"' class='",consts.className.LEVEL,c.level,"' tabindex='0' hidefocus='true' treenode>")},makeDOMNodeNameAfter:function(a,b,c){a.push("</a>")},makeDOMNodeNameBefore:function(a,b,c){var d=data.getNodeTitle(b,c),e=view.makeNodeUrl(b,c),f=view.makeNodeFontCss(b,c),g=[];for(var h in f)g.push(h,":",f[h],";");a.push("<a id='",c.tId,consts.id.A,"' class='",consts.className.LEVEL,c.level,"' treeNode",consts.id.A,' onclick="',c.click||"",'" ',null!=e&&e.length>0?"href='"+e+"'":""," target='",view.makeNodeTarget(c),"' style='",g.join(""),"'"),tools.apply(b.view.showTitle,[b.treeId,c],b.view.showTitle)&&d&&a.push("title='",d.replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"'"),a.push(">")},makeNodeFontCss:function(a,b){var c=tools.apply(a.view.fontCss,[a.treeId,b],a.view.fontCss);return c&&"function"!=typeof c?c:{}},makeNodeIcoClass:function(a,b){var c=["ico"];return b.isAjaxing||(c[0]=(b.iconSkin?b.iconSkin+"_":"")+c[0],b.isParent?c.push(b.open?consts.folder.OPEN:consts.folder.CLOSE):c.push(consts.folder.DOCU)),consts.className.BUTTON+" "+c.join("_")},makeNodeIcoStyle:function(a,b){var c=[];if(!b.isAjaxing){var d=b.isParent&&b.iconOpen&&b.iconClose?b.open?b.iconOpen:b.iconClose:b.icon;d&&c.push("background:url(",d,") 0 0 no-repeat;"),0!=a.view.showIcon&&tools.apply(a.view.showIcon,[a.treeId,b],!0)||c.push("width:0px;height:0px;")}return c.join("")},makeNodeLineClass:function(a,b){var c=[];return a.view.showLine?0==b.level&&b.isFirstNode&&b.isLastNode?c.push(consts.line.ROOT):0==b.level&&b.isFirstNode?c.push(consts.line.ROOTS):b.isLastNode?c.push(consts.line.BOTTOM):c.push(consts.line.CENTER):c.push(consts.line.NOLINE),b.isParent?c.push(b.open?consts.folder.OPEN:consts.folder.CLOSE):c.push(consts.folder.DOCU),view.makeNodeLineClassEx(b)+c.join("_")},makeNodeLineClassEx:function(a){return consts.className.BUTTON+" "+consts.className.LEVEL+a.level+" "+consts.className.SWITCH+" "},makeNodeTarget:function(a){return a.target||"_blank"},makeNodeUrl:function(a,b){var c=a.data.key.url;return b[c]?b[c]:null},makeUlHtml:function(a,b,c,d){c.push("<ul id='",b.tId,consts.id.UL,"' class='",consts.className.LEVEL,b.level," ",view.makeUlLineClass(a,b),"' style='display:",b.open?"block":"none","'>"),c.push(d),c.push("</ul>")},makeUlLineClass:function(a,b){return a.view.showLine&&!b.isLastNode?consts.line.LINE:""},removeChildNodes:function(a,b){if(b){var c=a.data.key.children,d=b[c];
if(d){for(var e=0,f=d.length;e<f;e++)data.removeNodeCache(a,d[e]);if(data.removeSelectedNode(a),delete b[c],a.data.keep.parent)$$(b,consts.id.UL,a).empty();else{b.isParent=!1,b.open=!1;var g=$$(b,consts.id.SWITCH,a),h=$$(b,consts.id.ICON,a);view.replaceSwitchClass(b,g,consts.folder.DOCU),view.replaceIcoClass(b,h,consts.folder.DOCU),$$(b,consts.id.UL,a).remove()}}}},setFirstNode:function(a,b){var c=a.data.key.children,d=b[c].length;d>0&&(b[c][0].isFirstNode=!0)},setLastNode:function(a,b){var c=a.data.key.children,d=b[c].length;d>0&&(b[c][d-1].isLastNode=!0)},removeNode:function(a,b){var c=data.getRoot(a),d=a.data.key.children,e=b.parentTId?b.getParentNode():c;if(b.isFirstNode=!1,b.isLastNode=!1,b.getPreNode=function(){return null},b.getNextNode=function(){return null},data.getNodeCache(a,b.tId)){$$(b,a).remove(),data.removeNodeCache(a,b),data.removeSelectedNode(a,b);for(var f=0,g=e[d].length;f<g;f++)if(e[d][f].tId==b.tId){e[d].splice(f,1);break}view.setFirstNode(a,e),view.setLastNode(a,e);var h,i,j,k=e[d].length;if(a.data.keep.parent||0!=k){if(a.view.showLine&&k>0){var l=e[d][k-1];if(h=$$(l,consts.id.UL,a),i=$$(l,consts.id.SWITCH,a),j=$$(l,consts.id.ICON,a),e==c)if(1==e[d].length)view.replaceSwitchClass(l,i,consts.line.ROOT);else{var m=$$(e[d][0],consts.id.SWITCH,a);view.replaceSwitchClass(e[d][0],m,consts.line.ROOTS),view.replaceSwitchClass(l,i,consts.line.BOTTOM)}else view.replaceSwitchClass(l,i,consts.line.BOTTOM);h.removeClass(consts.line.LINE)}}else e.isParent=!1,e.open=!1,h=$$(e,consts.id.UL,a),i=$$(e,consts.id.SWITCH,a),j=$$(e,consts.id.ICON,a),view.replaceSwitchClass(e,i,consts.folder.DOCU),view.replaceIcoClass(e,j,consts.folder.DOCU),h.css("display","none")}},replaceIcoClass:function(a,b,c){if(b&&!a.isAjaxing){var d=b.attr("class");if(void 0!=d){var e=d.split("_");switch(c){case consts.folder.OPEN:case consts.folder.CLOSE:case consts.folder.DOCU:e[e.length-1]=c}b.attr("class",e.join("_"))}}},replaceSwitchClass:function(a,b,c){if(b){var d=b.attr("class");if(void 0!=d){var e=d.split("_");switch(c){case consts.line.ROOT:case consts.line.ROOTS:case consts.line.CENTER:case consts.line.BOTTOM:case consts.line.NOLINE:e[0]=view.makeNodeLineClassEx(a)+c;break;case consts.folder.OPEN:case consts.folder.CLOSE:case consts.folder.DOCU:e[1]=c}b.attr("class",e.join("_")),c!==consts.folder.DOCU?b.removeAttr("disabled"):b.attr("disabled","disabled")}}},selectNode:function(a,b,c){c||view.cancelPreSelectedNode(a,null,b),$$(b,consts.id.A,a).addClass(consts.node.CURSELECTED),data.addSelectedNode(a,b),a.treeObj.trigger(consts.event.SELECTED,[event,a.treeId,b])},setNodeFontCss:function(a,b){var c=$$(b,consts.id.A,a),d=view.makeNodeFontCss(a,b);d&&c.css(d)},setNodeLineIcos:function(a,b){if(b){var c=$$(b,consts.id.SWITCH,a),d=$$(b,consts.id.UL,a),e=$$(b,consts.id.ICON,a),f=view.makeUlLineClass(a,b);0==f.length?d.removeClass(consts.line.LINE):d.addClass(f),c.attr("class",view.makeNodeLineClass(a,b)),b.isParent?c.removeAttr("disabled"):c.attr("disabled","disabled"),e.removeAttr("style"),e.attr("style",view.makeNodeIcoStyle(a,b)),e.attr("class",view.makeNodeIcoClass(a,b))}},setNodeName:function(a,b){var c=data.getNodeTitle(a,b),d=$$(b,consts.id.SPAN,a);if(d.empty(),a.view.nameIsHTML?d.html(data.getNodeName(a,b)):d.text(data.getNodeName(a,b)),tools.apply(a.view.showTitle,[a.treeId,b],a.view.showTitle)){var e=$$(b,consts.id.A,a);e.attr("title",c?c:"")}},setNodeTarget:function(a,b){var c=$$(b,consts.id.A,a);c.attr("target",view.makeNodeTarget(b))},setNodeUrl:function(a,b){var c=$$(b,consts.id.A,a),d=view.makeNodeUrl(a,b);null==d||0==d.length?c.removeAttr("href"):c.attr("href",d)},switchNode:function(a,b){if(b.open||!tools.canAsync(a,b))view.expandCollapseNode(a,b,!b.open);else if(a.async.enable){if(!view.asyncNode(a,b))return void view.expandCollapseNode(a,b,!b.open)}else b&&view.expandCollapseNode(a,b,!b.open)}};$.fn.zTree={consts:_consts,_z:{tools:tools,view:view,event:event,data:data},getZTreeObj:function(a){var b=data.getZTreeTools(a);return b?b:null},destroy:function(a){if(a&&a.length>0)view.destroy(data.getSetting(a));else for(var b in settings)view.destroy(settings[b])},init:function(a,b,c){var d=tools.clone(_setting);$.extend(!0,d,b),d.treeId=a.attr("id"),d.treeObj=a,d.treeObj.empty(),settings[d.treeId]=d,"undefined"==typeof document.body.style.maxHeight&&(d.view.expandSpeed=""),data.initRoot(d);var e=data.getRoot(d),f=d.data.key.children;c=c?tools.clone(tools.isArray(c)?c:[c]):[],d.data.simpleData.enable?e[f]=data.transformTozTreeFormat(d,c):e[f]=c,data.initCache(d),event.unbindTree(d),event.bindTree(d),event.unbindEvent(d),event.bindEvent(d);var g={setting:d,addNodes:function(a,b,c){function e(){view.addNodes(d,a,f,1==c)}if(!b)return null;if(a||(a=null),a&&!a.isParent&&d.data.keep.leaf)return null;var f=tools.clone(tools.isArray(b)?b:[b]);return tools.canAsync(d,a)?view.asyncNode(d,a,c,e):e(),f},cancelSelectedNode:function(a){view.cancelPreSelectedNode(d,a)},destroy:function(){view.destroy(d)},expandAll:function(a){return a=!!a,view.expandCollapseSonNode(d,null,a,!0),a},expandNode:function(a,b,c,e,f){if(!a||!a.isParent)return null;if(b!==!0&&b!==!1&&(b=!a.open),f=!!f,f&&b&&0==tools.apply(d.callback.beforeExpand,[d.treeId,a],!0))return null;if(f&&!b&&0==tools.apply(d.callback.beforeCollapse,[d.treeId,a],!0))return null;if(b&&a.parentTId&&view.expandCollapseParentNode(d,a.getParentNode(),b,!1),b===a.open&&!c)return null;if(data.getRoot(d).expandTriggerFlag=f,!tools.canAsync(d,a)&&c)view.expandCollapseSonNode(d,a,b,!0,function(){if(e!==!1)try{$$(a,d).focus().blur()}catch(b){}});else if(a.open=!b,view.switchNode(this.setting,a),e!==!1)try{$$(a,d).focus().blur()}catch(g){}return b},getNodes:function(){return data.getNodes(d)},getNodeByParam:function(a,b,c){return a?data.getNodeByParam(d,c?c[d.data.key.children]:data.getNodes(d),a,b):null},getNodeByTId:function(a){return data.getNodeCache(d,a)},getNodesByParam:function(a,b,c){return a?data.getNodesByParam(d,c?c[d.data.key.children]:data.getNodes(d),a,b):null},getNodesByParamFuzzy:function(a,b,c){return a?data.getNodesByParamFuzzy(d,c?c[d.data.key.children]:data.getNodes(d),a,b):null},getNodesByFilter:function(a,b,c,e){return b=!!b,a&&"function"==typeof a?data.getNodesByFilter(d,c?c[d.data.key.children]:data.getNodes(d),a,b,e):b?null:[]},getNodeIndex:function(a){if(!a)return null;for(var b=d.data.key.children,c=a.parentTId?a.getParentNode():data.getRoot(d),e=0,f=c[b].length;e<f;e++)if(c[b][e]==a)return e;return-1},getSelectedNodes:function(){for(var a=[],b=data.getRoot(d).curSelectedList,c=0,e=b.length;c<e;c++)a.push(b[c]);return a},isSelectedNode:function(a){return data.isSelectedNode(d,a)},reAsyncChildNodes:function(a,b,c){if(this.setting.async.enable){var e=!a;if(e&&(a=data.getRoot(d)),"refresh"==b){for(var f=this.setting.data.key.children,g=0,h=a[f]?a[f].length:0;g<h;g++)data.removeNodeCache(d,a[f][g]);if(data.removeSelectedNode(d),a[f]=[],e)this.setting.treeObj.empty();else{var i=$$(a,consts.id.UL,d);i.empty()}}view.asyncNode(this.setting,e?null:a,!!c)}},refresh:function(){this.setting.treeObj.empty();var a=data.getRoot(d),b=a[d.data.key.children];data.initRoot(d),a[d.data.key.children]=b,data.initCache(d),view.createNodes(d,0,a[d.data.key.children])},removeChildNodes:function(a){if(!a)return null;var b=d.data.key.children,c=a[b];return view.removeChildNodes(d,a),c?c:null},removeNode:function(a,b){a&&(b=!!b,b&&0==tools.apply(d.callback.beforeRemove,[d.treeId,a],!0)||(view.removeNode(d,a),b&&this.setting.treeObj.trigger(consts.event.REMOVE,[d.treeId,a])))},selectNode:function(a,b){if(a&&tools.uCanDo(d)){if(b=d.view.selectedMulti&&b,a.parentTId)view.expandCollapseParentNode(d,a.getParentNode(),!0,!1,function(){try{$$(a,d).focus().blur()}catch(b){}});else try{$$(a,d).focus().blur()}catch(c){}view.selectNode(d,a,b)}},transformTozTreeNodes:function(a){return data.transformTozTreeFormat(d,a)},transformToArray:function(a){return data.transformToArrayFormat(d,a)},updateNode:function(a,b){if(a){var c=$$(a,d);c.get(0)&&tools.uCanDo(d)&&(view.setNodeName(d,a),view.setNodeTarget(d,a),view.setNodeUrl(d,a),view.setNodeLineIcos(d,a),view.setNodeFontCss(d,a))}}};return e.treeTools=g,data.setZTreeTools(d,g),e[f]&&e[f].length>0?view.createNodes(d,0,e[f]):d.async.enable&&d.async.url&&""!==d.async.url&&view.asyncNode(d),g}};var zt=$.fn.zTree,$$=tools.$,consts=zt.consts}(jQuery),function(a){var b={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},c={check:{enable:!1,autoCheckTrigger:!1,chkStyle:b.checkbox.STYLE,nocheckInherit:!1,chkDisabledInherit:!1,radioType:b.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}},d=function(a){var b=v.getRoot(a);b.radioCheckedList=[]},e=function(a){},f=function(a){var b=a.treeObj,c=t.event;b.bind(c.CHECK,function(b,c,d,e){b.srcEvent=c,s.apply(a.callback.onCheck,[b,d,e])})},g=function(a){var b=a.treeObj,c=t.event;b.unbind(c.CHECK)},h=function(a){var b=a.target,c=v.getSetting(a.data.treeId),d="",e=null,f="",g="",h=null,i=null;if(s.eqs(a.type,"mouseover")?c.check.enable&&s.eqs(b.tagName,"span")&&null!==b.getAttribute("treeNode"+t.id.CHECK)&&(d=s.getNodeMainDom(b).id,f="mouseoverCheck"):s.eqs(a.type,"mouseout")?c.check.enable&&s.eqs(b.tagName,"span")&&null!==b.getAttribute("treeNode"+t.id.CHECK)&&(d=s.getNodeMainDom(b).id,f="mouseoutCheck"):s.eqs(a.type,"click")&&c.check.enable&&s.eqs(b.tagName,"span")&&null!==b.getAttribute("treeNode"+t.id.CHECK)&&(d=s.getNodeMainDom(b).id,f="checkNode"),d.length>0)switch(e=v.getNodeCache(c,d),f){case"checkNode":h=n.onCheckNode;break;case"mouseoverCheck":h=n.onMouseoverCheck;break;case"mouseoutCheck":h=n.onMouseoutCheck}var j={stop:"checkNode"===f,node:e,nodeEventType:f,nodeEventCallback:h,treeEventType:g,treeEventCallback:i};return j},i=function(a,b,c,d,e,f,g){if(c){var h=a.data.key.checked;if("string"==typeof c[h]&&(c[h]=s.eqs(c[h],"true")),c[h]=!!c[h],c.checkedOld=c[h],"string"==typeof c.nocheck&&(c.nocheck=s.eqs(c.nocheck,"true")),c.nocheck=!!c.nocheck||a.check.nocheckInherit&&d&&!!d.nocheck,"string"==typeof c.chkDisabled&&(c.chkDisabled=s.eqs(c.chkDisabled,"true")),c.chkDisabled=!!c.chkDisabled||a.check.chkDisabledInherit&&d&&!!d.chkDisabled,"string"==typeof c.halfCheck&&(c.halfCheck=s.eqs(c.halfCheck,"true")),c.halfCheck=!!c.halfCheck,c.check_Child_State=-1,c.check_Focus=!1,c.getCheckStatus=function(){return v.getCheckStatus(a,c)},a.check.chkStyle==t.radio.STYLE&&a.check.radioType==t.radio.TYPE_ALL&&c[h]){var i=v.getRoot(a);i.radioCheckedList.push(c)}}},j=function(a,b,c){a.data.key.checked;a.check.enable&&(v.makeChkFlag(a,b),c.push("<span ID='",b.tId,t.id.CHECK,"' class='",u.makeChkClass(a,b),"' treeNode",t.id.CHECK,b.nocheck===!0?" style='display:none;'":"","></span>"))},k=function(a,b){b.checkNode=function(a,b,c,d){var e=this.setting.data.key.checked;if(a.chkDisabled!==!0&&(b!==!0&&b!==!1&&(b=!a[e]),d=!!d,(a[e]!==b||c)&&(!d||0!=s.apply(this.setting.callback.beforeCheck,[this.setting.treeId,a],!0))&&s.uCanDo(this.setting)&&this.setting.check.enable&&a.nocheck!==!0)){a[e]=b;var f=w(a,t.id.CHECK,this.setting);(c||this.setting.check.chkStyle===t.radio.STYLE)&&u.checkNodeRelation(this.setting,a),u.setChkClass(this.setting,f,a),u.repairParentChkClassWithSelf(this.setting,a),d&&this.setting.treeObj.trigger(t.event.CHECK,[null,this.setting.treeId,a])}},b.checkAllNodes=function(a){u.repairAllChk(this.setting,!!a)},b.getCheckedNodes=function(a){var b=this.setting.data.key.children;return a=a!==!1,v.getTreeCheckedNodes(this.setting,v.getRoot(this.setting)[b],a)},b.getChangeCheckedNodes=function(){var a=this.setting.data.key.children;return v.getTreeChangeCheckedNodes(this.setting,v.getRoot(this.setting)[a])},b.setChkDisabled=function(a,b,c,d){b=!!b,c=!!c,d=!!d,u.repairSonChkDisabled(this.setting,a,b,d),u.repairParentChkDisabled(this.setting,a.getParentNode(),b,c)};var c=b.updateNode;b.updateNode=function(a,d){if(c&&c.apply(b,arguments),a&&this.setting.check.enable){var e=w(a,this.setting);if(e.get(0)&&s.uCanDo(this.setting)){var f=w(a,t.id.CHECK,this.setting);1!=d&&this.setting.check.chkStyle!==t.radio.STYLE||u.checkNodeRelation(this.setting,a),u.setChkClass(this.setting,f,a),u.repairParentChkClassWithSelf(this.setting,a)}}}},l={getRadioCheckedList:function(a){for(var b=v.getRoot(a).radioCheckedList,c=0,d=b.length;c<d;c++)v.getNodeCache(a,b[c].tId)||(b.splice(c,1),c--,d--);return b},getCheckStatus:function(a,b){if(!a.check.enable||b.nocheck||b.chkDisabled)return null;var c=a.data.key.checked,d={checked:b[c],half:b.halfCheck?b.halfCheck:a.check.chkStyle==t.radio.STYLE?2===b.check_Child_State:b[c]?b.check_Child_State>-1&&b.check_Child_State<2:b.check_Child_State>0};return d},getTreeCheckedNodes:function(a,b,c,d){if(!b)return[];var e=a.data.key.children,f=a.data.key.checked,g=c&&a.check.chkStyle==t.radio.STYLE&&a.check.radioType==t.radio.TYPE_ALL;d=d?d:[];for(var h=0,i=b.length;h<i&&(b[h].nocheck===!0||b[h].chkDisabled===!0||b[h][f]!=c||(d.push(b[h]),!g))&&(v.getTreeCheckedNodes(a,b[h][e],c,d),!(g&&d.length>0));h++);return d},getTreeChangeCheckedNodes:function(a,b,c){if(!b)return[];var d=a.data.key.children,e=a.data.key.checked;c=c?c:[];for(var f=0,g=b.length;f<g;f++)b[f].nocheck!==!0&&b[f].chkDisabled!==!0&&b[f][e]!=b[f].checkedOld&&c.push(b[f]),v.getTreeChangeCheckedNodes(a,b[f][d],c);return c},makeChkFlag:function(a,b){if(b){var c=a.data.key.children,d=a.data.key.checked,e=-1;if(b[c])for(var f=0,g=b[c].length;f<g;f++){var h=b[c][f],i=-1;if(a.check.chkStyle==t.radio.STYLE){if(i=h.nocheck===!0||h.chkDisabled===!0?h.check_Child_State:h.halfCheck===!0?2:h[d]?2:h.check_Child_State>0?2:0,2==i){e=2;break}0==i&&(e=0)}else if(a.check.chkStyle==t.checkbox.STYLE){if(i=h.nocheck===!0||h.chkDisabled===!0?h.check_Child_State:h.halfCheck===!0?1:h[d]?h.check_Child_State===-1||2===h.check_Child_State?2:1:h.check_Child_State>0?1:0,1===i){e=1;break}if(2===i&&e>-1&&f>0&&i!==e){e=1;break}if(2===e&&i>-1&&i<2){e=1;break}i>-1&&(e=i)}}b.check_Child_State=e}}},m={},n={onCheckNode:function(a,b){if(b.chkDisabled===!0)return!1;var c=v.getSetting(a.data.treeId),d=c.data.key.checked;if(0==s.apply(c.callback.beforeCheck,[c.treeId,b],!0))return!0;b[d]=!b[d],u.checkNodeRelation(c,b);var e=w(b,t.id.CHECK,c);return u.setChkClass(c,e,b),u.repairParentChkClassWithSelf(c,b),c.treeObj.trigger(t.event.CHECK,[a,c.treeId,b]),!0},onMouseoverCheck:function(a,b){if(b.chkDisabled===!0)return!1;var c=v.getSetting(a.data.treeId),d=w(b,t.id.CHECK,c);return b.check_Focus=!0,u.setChkClass(c,d,b),!0},onMouseoutCheck:function(a,b){if(b.chkDisabled===!0)return!1;var c=v.getSetting(a.data.treeId),d=w(b,t.id.CHECK,c);return b.check_Focus=!1,u.setChkClass(c,d,b),!0}},o={},p={checkNodeRelation:function(a,b){var c,d,e,f=a.data.key.children,g=a.data.key.checked,h=t.radio;if(a.check.chkStyle==h.STYLE){var i=v.getRadioCheckedList(a);if(b[g])if(a.check.radioType==h.TYPE_ALL){for(d=i.length-1;d>=0;d--)c=i[d],c[g]&&c!=b&&(c[g]=!1,i.splice(d,1),u.setChkClass(a,w(c,t.id.CHECK,a),c),c.parentTId!=b.parentTId&&u.repairParentChkClassWithSelf(a,c));i.push(b)}else{var j=b.parentTId?b.getParentNode():v.getRoot(a);for(d=0,e=j[f].length;d<e;d++)c=j[f][d],c[g]&&c!=b&&(c[g]=!1,u.setChkClass(a,w(c,t.id.CHECK,a),c))}else if(a.check.radioType==h.TYPE_ALL)for(d=0,e=i.length;d<e;d++)if(b==i[d]){i.splice(d,1);break}}else b[g]&&(!b[f]||0==b[f].length||a.check.chkboxType.Y.indexOf("s")>-1)&&u.setSonNodeCheckBox(a,b,!0),b[g]||b[f]&&0!=b[f].length&&!(a.check.chkboxType.N.indexOf("s")>-1)||u.setSonNodeCheckBox(a,b,!1),b[g]&&a.check.chkboxType.Y.indexOf("p")>-1&&u.setParentNodeCheckBox(a,b,!0),!b[g]&&a.check.chkboxType.N.indexOf("p")>-1&&u.setParentNodeCheckBox(a,b,!1)},makeChkClass:function(a,b){var c=a.data.key.checked,d=t.checkbox,e=t.radio,f="";f=b.chkDisabled===!0?d.DISABLED:b.halfCheck?d.PART:a.check.chkStyle==e.STYLE?b.check_Child_State<1?d.FULL:d.PART:b[c]?2===b.check_Child_State||b.check_Child_State===-1?d.FULL:d.PART:b.check_Child_State<1?d.FULL:d.PART;var g=a.check.chkStyle+"_"+(b[c]?d.TRUE:d.FALSE)+"_"+f;return g=b.check_Focus&&b.chkDisabled!==!0?g+"_"+d.FOCUS:g,t.className.BUTTON+" "+d.DEFAULT+" "+g},repairAllChk:function(a,b){if(a.check.enable&&a.check.chkStyle===t.checkbox.STYLE)for(var c=a.data.key.checked,d=a.data.key.children,e=v.getRoot(a),f=0,g=e[d].length;f<g;f++){var h=e[d][f];h.nocheck!==!0&&h.chkDisabled!==!0&&(h[c]=b),u.setSonNodeCheckBox(a,h,b)}},repairChkClass:function(a,b){if(b&&(v.makeChkFlag(a,b),b.nocheck!==!0)){var c=w(b,t.id.CHECK,a);u.setChkClass(a,c,b)}},repairParentChkClass:function(a,b){if(b&&b.parentTId){var c=b.getParentNode();u.repairChkClass(a,c),u.repairParentChkClass(a,c)}},repairParentChkClassWithSelf:function(a,b){if(b){var c=a.data.key.children;b[c]&&b[c].length>0?u.repairParentChkClass(a,b[c][0]):u.repairParentChkClass(a,b)}},repairSonChkDisabled:function(a,b,c,d){if(b){var e=a.data.key.children;if(b.chkDisabled!=c&&(b.chkDisabled=c),u.repairChkClass(a,b),b[e]&&d)for(var f=0,g=b[e].length;f<g;f++){var h=b[e][f];u.repairSonChkDisabled(a,h,c,d)}}},repairParentChkDisabled:function(a,b,c,d){b&&(b.chkDisabled!=c&&d&&(b.chkDisabled=c),u.repairChkClass(a,b),u.repairParentChkDisabled(a,b.getParentNode(),c,d))},setChkClass:function(a,b,c){b&&(c.nocheck===!0?b.hide():b.show(),b.attr("class",u.makeChkClass(a,c)))},setParentNodeCheckBox:function(a,b,c,d){var e=a.data.key.children,f=a.data.key.checked,g=w(b,t.id.CHECK,a);if(d||(d=b),v.makeChkFlag(a,b),b.nocheck!==!0&&b.chkDisabled!==!0&&(b[f]=c,u.setChkClass(a,g,b),a.check.autoCheckTrigger&&b!=d&&a.treeObj.trigger(t.event.CHECK,[null,a.treeId,b])),b.parentTId){var h=!0;if(!c)for(var i=b.getParentNode()[e],j=0,k=i.length;j<k;j++)if(i[j].nocheck!==!0&&i[j].chkDisabled!==!0&&i[j][f]||(i[j].nocheck===!0||i[j].chkDisabled===!0)&&i[j].check_Child_State>0){h=!1;break}h&&u.setParentNodeCheckBox(a,b.getParentNode(),c,d)}},setSonNodeCheckBox:function(a,b,c,d){if(b){var e=a.data.key.children,f=a.data.key.checked,g=w(b,t.id.CHECK,a);d||(d=b);var h=!1;if(b[e])for(var i=0,j=b[e].length;i<j&&b.chkDisabled!==!0;i++){var k=b[e][i];u.setSonNodeCheckBox(a,k,c,d),k.chkDisabled===!0&&(h=!0)}b!=v.getRoot(a)&&b.chkDisabled!==!0&&(h&&b.nocheck!==!0&&v.makeChkFlag(a,b),b.nocheck!==!0&&b.chkDisabled!==!0?(b[f]=c,h||(b.check_Child_State=b[e]&&b[e].length>0?c?2:0:-1)):b.check_Child_State=-1,u.setChkClass(a,g,b),a.check.autoCheckTrigger&&b!=d&&b.nocheck!==!0&&b.chkDisabled!==!0&&a.treeObj.trigger(t.event.CHECK,[null,a.treeId,b]))}}},q={tools:o,view:p,event:m,data:l};a.extend(!0,a.fn.zTree.consts,b),a.extend(!0,a.fn.zTree._z,q);var r=a.fn.zTree,s=r._z.tools,t=r.consts,u=r._z.view,v=r._z.data,w=(r._z.event,s.$);v.exSetting(c),v.addInitBind(f),v.addInitUnBind(g),v.addInitCache(e),v.addInitNode(i),v.addInitProxy(h,!0),v.addInitRoot(d),v.addBeforeA(j),v.addZTreeTools(k);var x=u.createNodes;u.createNodes=function(a,b,c,d){x&&x.apply(u,arguments),c&&u.repairParentChkClassWithSelf(a,d)};var y=u.removeNode;u.removeNode=function(a,b){var c=b.getParentNode();y&&y.apply(u,arguments),b&&c&&(u.repairChkClass(a,c),u.repairParentChkClass(a,c))};var z=u.appendNodes;u.appendNodes=function(a,b,c,d,e,f){var g="";return z&&(g=z.apply(u,arguments)),d&&v.makeChkFlag(a,d),g}}(jQuery),BI.IconChangeButton=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.IconChangeButton.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:"bi-icon-change-button",iconClass:"",iconWidth:null,iconHeight:null,stopEvent:!1,stopPropagation:!1,selected:!1,once:!1,forceSelected:!1,forceNotSelected:!1,disableSelected:!1,shadow:!1,isShadowShowingOnSelected:!1,trigger:null,handler:BI.emptyFn})},_init:function(){BI.IconChangeButton.superclass._init.apply(this,arguments);var a=this,b=this.options;this.button=BI.createWidget({type:"bi.icon_button",element:this,cls:b.iconClass,height:b.height,iconWidth:b.iconWidth,iconHeight:b.iconHeight,stopEvent:b.stopEvent,stopPropagation:b.stopPropagation,selected:b.selected,once:b.once,forceSelected:b.forceSelected,forceNotSelected:b.forceNotSelected,disableSelected:b.disableSelected,shadow:b.shadow,isShadowShowingOnSelected:b.isShadowShowingOnSelected,trigger:b.trigger,handler:b.handler}),this.button.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.button.on(BI.IconButton.EVENT_CHANGE,function(){a.fireEvent(BI.IconChangeButton.EVENT_CHANGE,arguments)})},isSelected:function(){return this.button.isSelected()},setSelected:function(a){this.button.setSelected(a)},setIcon:function(a){var b=this.options;b.iconClass!==a&&(this.element.removeClass(b.iconClass).addClass(a),b.iconClass=a)}}),BI.IconChangeButton.EVENT_CHANGE="IconChangeButton.EVENT_CHANGE",BI.shortcut("bi.icon_change_button",BI.IconChangeButton),BI.HalfIconButton=BI.inherit(BI.IconButton,{_defaultConfig:function(){var a=BI.HalfIconButton.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{extraCls:"bi-half-icon-button check-half-select-icon",height:16,width:16,iconWidth:16,iconHeight:16,selected:!1})},_init:function(){BI.HalfIconButton.superclass._init.apply(this,arguments)},doClick:function(){BI.HalfIconButton.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.HalfIconButton.EVENT_CHANGE)}}),BI.HalfIconButton.EVENT_CHANGE="HalfIconButton.EVENT_CHANGE",BI.shortcut("bi.half_icon_button",BI.HalfIconButton),BI.TriggerIconButton=BI.inherit(BI.IconButton,{_defaultConfig:function(){var a=BI.TriggerIconButton.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-trigger-icon-button",extraCls:"pull-down-font"})},_init:function(){BI.TriggerIconButton.superclass._init.apply(this,arguments)},doClick:function(){BI.TriggerIconButton.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.TriggerIconButton.EVENT_CHANGE,this)}}),BI.TriggerIconButton.EVENT_CHANGE="TriggerIconButton.EVENT_CHANGE",BI.shortcut("bi.trigger_icon_button",BI.TriggerIconButton),BI.MultiSelectItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.MultiSelectItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-multi-select-item",height:25,logic:{dynamic:!1}})},_init:function(){BI.MultiSelectItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.checkbox"}),this.text=BI.createWidget({type:"bi.label",cls:"list-item-text",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,rgap:b.rgap,text:b.text,keyword:b.keyword,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&a.setSelected(a.isSelected())}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("horizontal",BI.extend(b.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",{type:"bi.center_adapt",items:[this.checkbox],width:36},this.text)}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.MultiSelectItem.superclass.doClick.apply(this,arguments),this.checkbox.setSelected(this.isSelected()),this.isValid()&&this.fireEvent(BI.MultiSelectItem.EVENT_CHANGE,this.getValue(),this)},setSelected:function(a){BI.MultiSelectItem.superclass.setSelected.apply(this,arguments),this.checkbox.setSelected(a)}}),BI.MultiSelectItem.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multi_select_item",BI.MultiSelectItem),BI.SingleSelectIconTextItem=BI.inherit(BI.Single,{_defaultConfig:function(){return BI.extend(BI.SingleSelectIconTextItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-single-select-icon-text-item bi-list-item-active",iconClass:"",hgap:10,height:25})},_init:function(){BI.SingleSelectIconTextItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.text=BI.createWidget({type:"bi.icon_text_item",element:this,cls:b.iconClass,once:b.once,selected:b.selected,height:b.height,iconHeight:b.iconHeight,iconWidth:b.iconWidth,text:b.text,keyword:b.keyword,value:b.value,py:b.py}),this.text.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})},isSelected:function(){return this.text.isSelected()},setSelected:function(a){this.text.setSelected(a)},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.SingleSelectIconTextItem.superclass.doClick.apply(this,arguments)}}),BI.shortcut("bi.single_select_icon_text_item",BI.SingleSelectIconTextItem),BI.SingleSelectItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.SingleSelectItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-single-select-item bi-list-item-active",hgap:10,height:25,textAlign:"left"})},_init:function(){BI.SingleSelectItem.superclass._init.apply(this,arguments);var a=this.options;this.text=BI.createWidget({type:"bi.label",element:this,textAlign:a.textAlign,whiteSpace:"nowrap",textHeight:a.height,height:a.height,hgap:a.hgap,text:a.text,keyword:a.keyword,value:a.value,py:a.py})},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.SingleSelectItem.superclass.doClick.apply(this,arguments)},setSelected:function(a){BI.SingleSelectItem.superclass.setSelected.apply(this,arguments)}}),BI.shortcut("bi.single_select_item",BI.SingleSelectItem),BI.SingleSelectRadioItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.SingleSelectRadioItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-single-select-radio-item bi-list-item-active",logic:{dynamic:!1},hgap:10,height:25})},_init:function(){BI.SingleSelectRadioItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.radio=BI.createWidget({type:"bi.radio"}),this.radio.on(BI.Controller.EVENT_CHANGE,function(b){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.text=BI.createWidget({type:"bi.label",cls:"list-item-text",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,keyword:b.keyword,value:b.value,py:b.py}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("horizontal",BI.extend(b.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",{type:"bi.center_adapt",items:[this.radio],width:36},this.text)}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.SingleSelectRadioItem.superclass.doClick.apply(this,arguments),this.radio.setSelected(this.isSelected())},setSelected:function(a){BI.SingleSelectRadioItem.superclass.setSelected.apply(this,arguments),this.radio.setSelected(a)}}),BI.shortcut("bi.single_select_radio_item",BI.SingleSelectRadioItem),BI.ArrowNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.ArrowNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-arrow-group-node bi-list-item",logic:{dynamic:!1},id:"",pId:"",open:!1,height:25})},_init:function(){var a=this,b=this.options;BI.ArrowNode.superclass._init.apply(this,arguments),this.checkbox=BI.createWidget({type:"bi.arrow_tree_group_node_checkbox",iconWidth:13,iconHeight:13}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&a.setSelected(a.isSelected()),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,{width:25,el:this.checkbox},this.text);BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.ArrowNode.superclass.doClick.apply(this,arguments),this.checkbox.setSelected(this.isOpened())},setValue:function(a){this.text.setValue(a)},setOpened:function(a){BI.ArrowNode.superclass.setOpened.apply(this,arguments),this.checkbox.setSelected(a)}}),BI.shortcut("bi.arrow_group_node",BI.ArrowNode),BI.FirstPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.FirstPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-first-plus-group-node bi-list-item",logic:{dynamic:!1},id:"",pId:"",open:!1,height:25})},_init:function(){BI.FirstPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.first_tree_node_checkbox",stopPropagation:!0}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&(this.isSelected()?a.triggerExpand():a.triggerCollapse())});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,{width:25,el:this.checkbox},this.text);BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.FirstPlusGroupNode.superclass.doClick.apply(this,arguments),this.checkbox.setSelected(this.isSelected())},setOpened:function(a){BI.FirstPlusGroupNode.superclass.setOpened.apply(this,arguments),BI.isNotNull(this.checkbox)&&this.checkbox.setSelected(a)}}),BI.shortcut("bi.first_plus_group_node",BI.FirstPlusGroupNode),BI.IconArrowNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.IconArrowNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-icon-arrow-node bi-list-item",logic:{dynamic:!1},id:"",pId:"",open:!1,height:25,iconHeight:13,iconWidth:13,iconCls:""})},_init:function(){BI.IconArrowNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.tree_group_node_checkbox",width:23,stopPropagation:!0});var c=BI.createWidget({type:"bi.center_adapt",cls:b.iconCls,width:23,items:[{type:"bi.icon",height:b.iconHeight,width:b.iconWidth}]});this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&(this.isSelected()?a.triggerExpand():a.triggerCollapse())});var d=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),e=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,{width:25,el:this.checkbox},{width:23,el:c},this.text);BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(d,BI.extend(b.logic,{items:e}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.IconArrowNode.superclass.doClick.apply(this,arguments),this.checkbox.setSelected(this.isSelected())},setOpened:function(a){BI.IconArrowNode.superclass.setOpened.apply(this,arguments),BI.isNotNull(this.checkbox)&&this.checkbox.setSelected(a)}}),BI.shortcut("bi.icon_arrow_node",BI.IconArrowNode),BI.LastPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.LastPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-last-plus-group-node bi-list-item",logic:{dynamic:!1},id:"",pId:"",
open:!1,height:25})},_init:function(){BI.LastPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.last_tree_node_checkbox",stopPropagation:!0}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&(this.isSelected()?a.triggerExpand():a.triggerCollapse())});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,{width:25,el:this.checkbox},this.text);BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.LastPlusGroupNode.superclass.doClick.apply(this,arguments),this.checkbox.setSelected(this.isSelected())},setOpened:function(a){BI.LastPlusGroupNode.superclass.setOpened.apply(this,arguments),BI.isNotNull(this.checkbox)&&this.checkbox.setSelected(a)}}),BI.shortcut("bi.last_plus_group_node",BI.LastPlusGroupNode),BI.MidPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.MidPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-mid-plus-group-node bi-list-item",logic:{dynamic:!1},id:"",pId:"",open:!1,height:25})},_init:function(){BI.MidPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.mid_tree_node_checkbox",stopPropagation:!0}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&(this.isSelected()?a.triggerExpand():a.triggerCollapse())});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,{width:25,el:this.checkbox},this.text);BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.MidPlusGroupNode.superclass.doClick.apply(this,arguments),this.checkbox.setSelected(this.isSelected())},setOpened:function(a){BI.MidPlusGroupNode.superclass.setOpened.apply(this,arguments),BI.isNotNull(this.checkbox)&&this.checkbox.setSelected(a)}}),BI.shortcut("bi.mid_plus_group_node",BI.MidPlusGroupNode),BI.MultiLayerIconArrowNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.MultiLayerIconArrowNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{extraCls:"bi-multilayer-icon-arrow-node bi-list-item",layer:0,id:"",pId:"",open:!1,height:25,iconHeight:13,iconWidth:13,iconCls:""})},_init:function(){BI.MultiLayerIconArrowNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.node=BI.createWidget({type:"bi.icon_arrow_node",iconCls:b.iconCls,id:b.id,pId:b.pId,open:b.open,height:b.height,iconHeight:b.iconHeight,iconWidth:b.iconWidth,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.node.on(BI.Controller.EVENT_CHANGE,function(b){a.setSelected(a.isSelected()),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=[];BI.count(0,b.layer,function(){c.push({type:"bi.layout",width:13,height:b.height})}),c.push(this.node),BI.createWidget({type:"bi.td",element:this,columnSize:BI.makeArray(b.layer,13),items:[c]})},isOnce:function(){return!0},doRedMark:function(){this.node.doRedMark.apply(this.node,arguments)},unRedMark:function(){this.node.unRedMark.apply(this.node,arguments)},isSelected:function(){return this.node.isSelected()},setSelected:function(a){BI.MultiLayerIconArrowNode.superclass.setSelected.apply(this,arguments),this.node.setSelected(a)},doClick:function(){BI.NodeButton.superclass.doClick.apply(this,arguments),this.node.setSelected(this.isSelected())},setOpened:function(a){BI.MultiLayerIconArrowNode.superclass.setOpened.apply(this,arguments),this.node.setOpened(a)}}),BI.shortcut("bi.multilayer_icon_arrow_node",BI.MultiLayerIconArrowNode),BI.PlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.PlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-plus-group-node bi-list-item",logic:{dynamic:!1},id:"",pId:"",open:!1,height:25})},_init:function(){BI.PlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.tree_node_checkbox"}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&a.setSelected(a.isSelected()),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,{width:25,el:this.checkbox},this.text);BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.PlusGroupNode.superclass.doClick.apply(this,arguments),this.checkbox.setSelected(this.isSelected())},setOpened:function(a){BI.PlusGroupNode.superclass.setOpened.apply(this,arguments),this.checkbox&&this.checkbox.setSelected(a)}}),BI.shortcut("bi.plus_group_node",BI.PlusGroupNode),BI.TriangleGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.TriangleGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-triangle-group-node bi-list-item",logic:{dynamic:!1},id:"",pId:"",open:!1,height:25})},_init:function(){BI.TriangleGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({iconWidth:13,iconHeight:13,type:"bi.tree_group_node_checkbox"}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py,keyword:b.keyword}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&a.setSelected(a.isSelected()),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,{width:25,el:this.checkbox},this.text);BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.TriangleGroupNode.superclass.doClick.apply(this,arguments),this.checkbox.setSelected(this.isOpened())},setOpened:function(a){BI.TriangleGroupNode.superclass.setOpened.apply(this,arguments),this.checkbox.setSelected(a)},setText:function(a){BI.TriangleGroupNode.superclass.setText.apply(this,arguments),this.text.setText(a)}}),BI.shortcut("bi.triangle_group_node",BI.TriangleGroupNode),BI.FirstTreeLeafItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.FirstTreeLeafItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-first-tree-leaf-item bi-list-item-active",logic:{dynamic:!1},id:"",pId:"",layer:0,height:25})},_init:function(){BI.FirstTreeLeafItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.checkbox"}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&a.setSelected(a.isSelected()),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,0===b.layer?"":{width:13,el:{type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height}},{width:25,el:{type:"bi.layout",cls:"mid-line-conn-background",width:25,height:b.height}},{el:this.text});BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},getId:function(){return this.options.id},getPId:function(){return this.options.pId},doClick:function(){BI.FirstTreeLeafItem.superclass.doClick.apply(this,arguments),this.checkbox.setSelected(this.isSelected())},setSelected:function(a){BI.FirstTreeLeafItem.superclass.setSelected.apply(this,arguments),this.checkbox.setSelected(a)}}),BI.shortcut("bi.first_tree_leaf_item",BI.FirstTreeLeafItem),BI.IconTreeLeafItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.IconTreeLeafItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-icon-tree-leaf-item bi-list-item-active",logic:{dynamic:!1},height:25,iconWidth:16,iconHeight:16,iconCls:""})},_init:function(){BI.IconTreeLeafItem.superclass._init.apply(this,arguments);var a=this.options,b=BI.createWidget({type:"bi.center_adapt",width:23,cls:a.iconCls,items:[{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}]});this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:a.height,height:a.height,hgap:a.hgap,text:a.text,value:a.value,py:a.py});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,{width:23,el:b},{el:this.text});BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(a.logic,{items:d}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},getId:function(){return this.options.id},getPId:function(){return this.options.pId},doClick:function(){BI.IconTreeLeafItem.superclass.doClick.apply(this,arguments)},setSelected:function(a){BI.IconTreeLeafItem.superclass.setSelected.apply(this,arguments)}}),BI.shortcut("bi.icon_tree_leaf_item",BI.IconTreeLeafItem),BI.LastTreeLeafItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.LastTreeLeafItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-last-tree-leaf-item bi-list-item-active",logic:{dynamic:!1},id:"",pId:"",layer:0,height:25})},_init:function(){BI.LastTreeLeafItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.checkbox"}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&a.setSelected(a.isSelected()),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,0===b.layer?"":{width:13,el:{type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height}},{width:25,el:{type:"bi.layout",cls:"mid-line-conn-background",width:25,height:b.height}},{el:this.text});BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},getId:function(){return this.options.id},getPId:function(){return this.options.pId},doClick:function(){BI.LastTreeLeafItem.superclass.doClick.apply(this,arguments)},setSelected:function(a){BI.LastTreeLeafItem.superclass.setSelected.apply(this,arguments)}}),BI.shortcut("bi.last_tree_leaf_item",BI.LastTreeLeafItem),BI.MidTreeLeafItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.MidTreeLeafItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-mid-tree-leaf-item bi-list-item-active",logic:{dynamic:!1},id:"",pId:"",layer:0,height:25})},_init:function(){BI.MidTreeLeafItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.checkbox"}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&a.setSelected(a.isSelected()),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,0===b.layer?"":{width:13,el:{type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height}},{width:25,el:{type:"bi.layout",cls:"mid-line-conn-background",width:25,height:b.height}},{el:this.text});BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},getId:function(){return this.options.id},getPId:function(){return this.options.pId},doClick:function(){BI.MidTreeLeafItem.superclass.doClick.apply(this,arguments),this.checkbox.setSelected(this.isSelected())},setSelected:function(a){BI.MidTreeLeafItem.superclass.setSelected.apply(this,arguments),this.checkbox.setSelected(a)}}),BI.shortcut("bi.mid_tree_leaf_item",BI.MidTreeLeafItem),BI.MultiLayerIconTreeLeafItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.MultiLayerIconTreeLeafItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-multilayer-icon-tree-leaf-item bi-list-item-active",layer:0,height:25,iconCls:"",iconHeight:14,iconWidth:12})},_init:function(){BI.MultiLayerIconTreeLeafItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.item=BI.createWidget({type:"bi.icon_tree_leaf_item",cls:"bi-list-item-none",iconCls:b.iconCls,id:b.id,pId:b.pId,isFront:!0,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py,iconWidth:b.iconWidth,iconHeight:b.iconHeight}),this.item.on(BI.Controller.EVENT_CHANGE,function(b){b!==BI.Events.CLICK&&a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=[];BI.count(0,b.layer,function(){c.push({type:"bi.layout",width:13,height:b.height})}),c.push(this.item),BI.createWidget({type:"bi.td",element:this,columnSize:BI.makeArray(b.layer,13),items:[c]})},doRedMark:function(){this.item.doRedMark.apply(this.item,arguments)},unRedMark:function(){this.item.unRedMark.apply(this.item,arguments)},doHighLight:function(){this.item.doHighLight.apply(this.item,arguments)},unHighLight:function(){this.item.unHighLight.apply(this.item,arguments)},getId:function(){return this.options.id},getPId:function(){return this.options.pId},doClick:function(){BI.MultiLayerIconTreeLeafItem.superclass.doClick.apply(this,arguments),this.item.setSelected(this.isSelected())},setSelected:function(a){BI.MultiLayerIconTreeLeafItem.superclass.setSelected.apply(this,arguments),this.item.setSelected(a)},getValue:function(){return this.options.value}}),BI.shortcut("bi.multilayer_icon_tree_leaf_item",BI.MultiLayerIconTreeLeafItem),BI.TreeTextLeafItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.TreeTextLeafItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-tree-text-leaf-item bi-list-item-active",id:"",pId:"",height:25,hgap:0,lgap:0,rgap:0})},_init:function(){BI.TreeTextLeafItem.superclass._init.apply(this,arguments);var a=this.options;this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:a.height,height:a.height,hgap:a.hgap,lgap:a.lgap,rgap:a.hgap,text:a.text,value:a.value,py:a.py}),BI.createWidget({type:"bi.htape",element:this,items:[{el:this.text}]})},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},getId:function(){return this.options.id},getPId:function(){return this.options.pId}}),BI.shortcut("bi.tree_text_leaf_item",BI.TreeTextLeafItem),BI.Calendar=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.Calendar.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:"bi-calendar",logic:{dynamic:!1},min:"1900-01-01",max:"2099-12-31",year:2015,month:7,day:25})},_dateCreator:function(a,b,c){var d=this.options,e={},f=Date.getDate(),g=d.min.match(/\d+/g),h=d.max.match(/\d+/g);a<(0|g[0])&&(a=0|g[0]),a>(0|h[0])&&(a=0|h[0]),f.setFullYear(a,b,c),e.ymd=[f.getFullYear(),f.getMonth(),f.getDate()];var i=Date._MD.slice(0);i[1]=Date.isLeap(e.ymd[0])?29:28,f.setFullYear(e.ymd[0],e.ymd[1],1),e.FDay=f.getDay(),e.PDay=i[0===b?11:b-1]-e.FDay+1,e.NDay=1;var j=[];return BI.each(BI.range(42),function(a){var b,c={},d=e.ymd[0],f=e.ymd[1]+1;a<e.FDay?(c.lastMonth=!0,b=a+e.PDay,1===f&&(d-=1),f=1===f?12:f-1):a>=e.FDay&&a<e.FDay+i[e.ymd[1]]?(b=a-e.FDay+1,a-e.FDay+1===e.ymd[2]&&(c.currentDay=!0)):(c.nextMonth=!0,b=e.NDay++,12===f&&(d+=1),f=12===f?1:f+1),Date.checkVoid(d,f,b,g,h)[0]&&(c.disabled=!0),c.text=b,j.push(c)}),j},_init:function(){BI.Calendar.superclass._init.apply(this,arguments);var a=this,b=this.options,c=BI.map(Date._SDN.slice(0,7),function(a,b){return{type:"bi.label",height:25,text:b}}),d=BI.createWidget({type:"bi.button_group",height:25,items:c}),e=this._dateCreator(b.year,b.month,b.day);c=[],c.push(e.slice(0,7)),c.push(e.slice(7,14)),c.push(e.slice(14,21)),c.push(e.slice(21,28)),c.push(e.slice(28,35)),c.push(e.slice(35,42)),c=BI.map(c,function(a,c){return BI.map(c,function(a,c){return BI.extend(c,{type:"bi.text_item",cls:"bi-list-item-active",textAlign:"center",whiteSpace:"normal",once:!1,forceSelected:!0,height:25,value:b.year+"-"+b.month+"-"+c.text,disabled:c.lastMonth||c.nextMonth||c.disabled})})}),this.days=BI.createWidget({type:"bi.button_group",items:BI.createItems(c,{}),layouts:[BI.LogicFactory.createLogic("table",BI.extend({},b.logic,{columns:7,rows:6,columnSize:[1/7,1/7,1/7,1/7,1/7,1/7,1/7],rowSize:25}))]}),this.days.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("vertical",BI.extend({},b.logic,{items:BI.LogicFactory.createLogicItemsByDirection("top",d,this.days)}))))},isFrontDate:function(){var a=this.options,b=(this._const,a.year),c=a.month,d=Date.getDate(),e=d.getDay();b=0|b,d.setFullYear(b,c,1);var f=d.getOffsetDate(-1*(e+1));return!!Date.checkVoid(f.getFullYear(),f.getMonth(),f.getDate(),a.min,a.max)[0]},isFinalDate:function(){var a=this.options,b=(this._const,a.year),c=a.month,d=Date.getDate(),e=d.getDay();b=0|b,d.setFullYear(b,c,1);var f=d.getOffsetDate(42-e);return!!Date.checkVoid(f.getFullYear(),f.getMonth(),f.getDate(),a.min,a.max)[0]},setValue:function(a){this.days.setValue([a.year+"-"+a.month+"-"+a.day])},getValue:function(){var a=this.days.getValue()[0].match(/\d+/g);return{year:0|a[0],month:0|a[1],day:0|a[2]}}}),BI.extend(BI.Calendar,{getPageByDateJSON:function(a){var b=Date.getDate().getFullYear(),c=Date.getDate().getMonth(),d=12*(a.year-b);return d+=a.month-c},getDateJSONByPage:function(a){var b=Date.getDate().getMonth(),c=a;c+=b;var d=BI.parseInt(c/12);c<0&&c%12!==0&&d--;var e=c>=0?c%12:(12+c%12)%12;return{year:Date.getDate().getFullYear()+d,month:e}}}),BI.shortcut("bi.calendar",BI.Calendar),BI.YearCalendar=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.YearCalendar.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:"bi-year-calendar",behaviors:{},logic:{dynamic:!1},min:"1900-01-01",max:"2099-12-31",year:null})},_yearCreator:function(a){var b=this.options;a=0|a;var c=BI.YearCalendar.getStartYear(a),d=[];return BI.each(BI.range(BI.YearCalendar.INTERVAL),function(a){var e={};Date.checkVoid(c+a,1,1,b.min,b.max)[0]&&(e.disabled=!0),e.text=c+a,d.push(e)}),d},_init:function(){BI.YearCalendar.superclass._init.apply(this,arguments);var a=this,b=this.options;this.currentYear=Date.getDate().getFullYear();var c=this._yearCreator(b.year||this.currentYear),d=c.length,e=BI.makeArray(d,""),f=[0,6,1,7,2,8,3,9,4,10,5,11];BI.each(c,function(a,b){e[a]=c[f[a]]});var g=[];g.push(e.slice(0,2)),g.push(e.slice(2,4)),g.push(e.slice(4,6)),g.push(e.slice(6,8)),g.push(e.slice(8,10)),g.push(e.slice(10,12)),g=BI.map(g,function(a,b){return BI.map(b,function(a,b){return BI.extend(b,{type:"bi.text_item",cls:"bi-list-item-active",textAlign:"center",whiteSpace:"normal",once:!1,forceSelected:!0,height:23,width:38,value:b.text,disabled:b.disabled})})}),this.years=BI.createWidget({type:"bi.button_group",behaviors:b.behaviors,items:BI.createItems(g,{}),layouts:[BI.LogicFactory.createLogic("table",BI.extend({},b.logic,{columns:2,rows:6,columnSize:[.5,.5],rowSize:25})),{type:"bi.center_adapt",vgap:1}]}),this.years.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("vertical",BI.extend({},b.logic,{items:BI.LogicFactory.createLogicItemsByDirection("top",this.years)}))))},isFrontYear:function(){var a=this.options,b=a.year;return b=0|b,!!Date.checkVoid(BI.YearCalendar.getStartYear(b)-1,1,1,a.min,a.max)[0]},isFinalYear:function(){var a=this.options,b=(this._const,a.year);return b=0|b,!!Date.checkVoid(BI.YearCalendar.getEndYear(b)+1,1,1,a.min,a.max)[0]},setValue:function(a){this.years.setValue([a])},getValue:function(){return this.years.getValue()[0]}}),BI.extend(BI.YearCalendar,{INTERVAL:12,getStartYear:function(a){var b=Date.getDate().getFullYear();return a-((a-b+3)%BI.YearCalendar.INTERVAL+12)%BI.YearCalendar.INTERVAL},getEndYear:function(a){return BI.YearCalendar.getStartYear(a)+BI.YearCalendar.INTERVAL},getPageByYear:function(a){var b=Date.getDate().getFullYear();return a=BI.YearCalendar.getStartYear(a),(a-b+3)/BI.YearCalendar.INTERVAL}}),BI.shortcut("bi.year_calendar",BI.YearCalendar),BI.ComplexCanvas=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ComplexCanvas.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-complex-canvas"})},_init:function(){BI.ComplexCanvas.superclass._init.apply(this,arguments);var a=this.options;this.canvas=BI.createWidget({type:"bi.canvas",element:this,width:a.width,height:a.height})},branch:function(a,b,c,d,e,f){var g=this,h=[].slice.call(arguments);if(h.length<=5)return this.canvas.line.apply(this.canvas,arguments);var i;BI.isOdd(h.length)&&(i=BI.last(h),h=BI.initial(h)),h=[].slice.call(h,2);var j=BI.filter(h,function(a){return a%2===0}),k=BI.filter(h,function(a){return a%2!==0});i||(i={});var l=i.offset||20;if(b>d&&b>f||b<d&&b<f){if(b>d&&b>f)var m=Math.max.apply(this,k)+l;else var m=Math.min.apply(this,k)-l;var n=Math.min.apply(this,j),o=BI.indexOf(j,n),p=Math.max.apply(this,j),q=BI.indexOf(j,p);return this.canvas.line(n,k[o],n,m,p,m,p,k[q],i),BI.each(j,function(a,b){a!==q&&a!==o&&g.canvas.line(b,k[a],b,m,i)}),void this.canvas.line(a,m,a,b,i)}if(a>c&&a>e||a<c&&a<e){if(a>c&&a>e)var r=Math.max.apply(this,j)+l;else var r=Math.min.apply(this,j)-l;var s=Math.min.apply(this,k),t=BI.indexOf(k,s),u=Math.max.apply(this,k),v=BI.indexOf(k,u);return this.canvas.line(j[t],s,r,s,r,u,j[v],u,i),BI.each(k,function(a,b){a!==t&&a!==v&&g.canvas.line(j[a],b,r,b,i)}),void this.canvas.line(r,b,a,b,i)}},stroke:function(a){this.canvas.stroke(a)}}),BI.shortcut("bi.complex_canvas",BI.ComplexCanvas),BI.ArrowTreeGroupNodeCheckbox=BI.inherit(BI.IconButton,{_defaultConfig:function(){return BI.extend(BI.ArrowTreeGroupNodeCheckbox.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-arrow-tree-group-node",iconWidth:13,iconHeight:13})},_init:function(){BI.ArrowTreeGroupNodeCheckbox.superclass._init.apply(this,arguments)},setSelected:function(a){BI.ArrowTreeGroupNodeCheckbox.superclass.setSelected.apply(this,arguments),a?this.element.removeClass("pull-down-font").addClass("pull-right-font"):this.element.removeClass("pull-right-font").addClass("pull-down-font")}}),BI.shortcut("bi.arrow_tree_group_node_checkbox",BI.ArrowTreeGroupNodeCheckbox),BI.CheckingMarkNode=BI.inherit(BI.IconButton,{_defaultConfig:function(){return BI.extend(BI.CheckingMarkNode.superclass._defaultConfig.apply(this,arguments),{extraCls:"check-mark-font",iconWidth:13,iconHeight:13})},_init:function(){BI.CheckingMarkNode.superclass._init.apply(this,arguments),this.setSelected(this.options.selected)},setSelected:function(a){BI.CheckingMarkNode.superclass.setSelected.apply(this,arguments),a===!0?this.element.addClass("check-mark-font"):this.element.removeClass("check-mark-font")}}),BI.shortcut("bi.checking_mark_node",BI.CheckingMarkNode),BI.FirstTreeNodeCheckbox=BI.inherit(BI.IconButton,{_defaultConfig:function(){return BI.extend(BI.FirstTreeNodeCheckbox.superclass._defaultConfig.apply(this,arguments),{extraCls:"tree-collapse-icon-type2",iconWidth:25,iconHeight:25})},_init:function(){BI.FirstTreeNodeCheckbox.superclass._init.apply(this,arguments)},setSelected:function(a){BI.FirstTreeNodeCheckbox.superclass.setSelected.apply(this,arguments),a===!0?this.element.addClass("tree-expand-icon-type2"):this.element.removeClass("tree-expand-icon-type2")}}),BI.shortcut("bi.first_tree_node_checkbox",BI.FirstTreeNodeCheckbox),BI.LastTreeNodeCheckbox=BI.inherit(BI.IconButton,{_defaultConfig:function(){return BI.extend(BI.LastTreeNodeCheckbox.superclass._defaultConfig.apply(this,arguments),{extraCls:"tree-collapse-icon-type4",iconWidth:25,iconHeight:25})},_init:function(){BI.LastTreeNodeCheckbox.superclass._init.apply(this,arguments)},setSelected:function(a){BI.LastTreeNodeCheckbox.superclass.setSelected.apply(this,arguments),a===!0?this.element.addClass("tree-expand-icon-type3"):this.element.removeClass("tree-expand-icon-type3")}}),BI.shortcut("bi.last_tree_node_checkbox",BI.LastTreeNodeCheckbox),BI.MidTreeNodeCheckbox=BI.inherit(BI.IconButton,{_defaultConfig:function(){return BI.extend(BI.MidTreeNodeCheckbox.superclass._defaultConfig.apply(this,arguments),{extraCls:"tree-collapse-icon-type3",iconWidth:25,iconHeight:25})},_init:function(){BI.MidTreeNodeCheckbox.superclass._init.apply(this,arguments)},setSelected:function(a){BI.MidTreeNodeCheckbox.superclass.setSelected.apply(this,arguments),a===!0?this.element.addClass("tree-expand-icon-type3"):this.element.removeClass("tree-expand-icon-type3")}}),BI.shortcut("bi.mid_tree_node_checkbox",BI.MidTreeNodeCheckbox),BI.TreeGroupNodeCheckbox=BI.inherit(BI.IconButton,{_defaultConfig:function(){return BI.extend(BI.TreeGroupNodeCheckbox.superclass._defaultConfig.apply(this,arguments),{extraCls:"tree-node-triangle-collapse-font",iconWidth:13,iconHeight:13})},_init:function(){BI.TreeGroupNodeCheckbox.superclass._init.apply(this,arguments)},setSelected:function(a){BI.TreeGroupNodeCheckbox.superclass.setSelected.apply(this,arguments),a?this.element.removeClass("tree-node-triangle-collapse-font").addClass("tree-node-triangle-expand-font"):this.element.removeClass("tree-node-triangle-expand-font").addClass("tree-node-triangle-collapse-font")}}),BI.shortcut("bi.tree_group_node_checkbox",BI.TreeGroupNodeCheckbox),BI.TreeNodeCheckbox=BI.inherit(BI.IconButton,{_defaultConfig:function(){return BI.extend(BI.TreeNodeCheckbox.superclass._defaultConfig.apply(this,arguments),{extraCls:"tree-collapse-icon-type1",iconWidth:25,iconHeight:25})},_init:function(){BI.TreeNodeCheckbox.superclass._init.apply(this,arguments)},setSelected:function(a){BI.TreeNodeCheckbox.superclass.setSelected.apply(this,arguments),a?this.element.addClass("tree-expand-icon-type1"):this.element.removeClass("tree-expand-icon-type1")}}),BI.shortcut("bi.tree_node_checkbox",BI.TreeNodeCheckbox);try{!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Clipboard=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};a[g][0].call(k.exports,function(b){var c=a[g][1][b];return e(c?c:b)},k,k.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a,b){for(;a&&a.nodeType!==e;){if(a.matches(b))return a;a=a.parentNode}}var e=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var f=Element.prototype;f.matches=f.matchesSelector||f.mozMatchesSelector||f.msMatchesSelector||f.oMatchesSelector||f.webkitMatchesSelector}b.exports=d},{}],2:[function(a,b,c){function d(a,b,c,d,f){var g=e.apply(this,arguments);return a.addEventListener(c,g,f),{destroy:function(){a.removeEventListener(c,g,f)}}}function e(a,b,c,d){return function(c){c.delegateTarget=f(c.target,b),c.delegateTarget&&d.call(a,c)}}var f=a("./closest");b.exports=d},{"./closest":1}],3:[function(a,b,c){c.node=function(a){return void 0!==a&&a instanceof HTMLElement&&1===a.nodeType},c.nodeList=function(a){var b=Object.prototype.toString.call(a);return void 0!==a&&("[object NodeList]"===b||"[object HTMLCollection]"===b)&&"length"in a&&(0===a.length||c.node(a[0]))},c.string=function(a){return"string"==typeof a||a instanceof String},c.fn=function(a){var b=Object.prototype.toString.call(a);return"[object Function]"===b}},{}],4:[function(a,b,c){function d(a,b,c){if(!a&&!b&&!c)throw new Error("Missing required arguments");if(!h.string(b))throw new TypeError("Second argument must be a String");if(!h.fn(c))throw new TypeError("Third argument must be a Function");if(h.node(a))return e(a,b,c);if(h.nodeList(a))return f(a,b,c);if(h.string(a))return g(a,b,c);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function e(a,b,c){return a.addEventListener(b,c),{destroy:function(){a.removeEventListener(b,c)}}}function f(a,b,c){return Array.prototype.forEach.call(a,function(a){a.addEventListener(b,c)}),{destroy:function(){Array.prototype.forEach.call(a,function(a){a.removeEventListener(b,c)})}}}function g(a,b,c){return i(document.body,a,b,c)}var h=a("./is"),i=a("delegate");b.exports=d},{"./is":3,delegate:2}],5:[function(a,b,c){function d(a){var b;if("SELECT"===a.nodeName)a.focus(),b=a.value;else if("INPUT"===a.nodeName||"TEXTAREA"===a.nodeName){var c=a.hasAttribute("readonly");c||a.setAttribute("readonly",""),a.select(),a.setSelectionRange(0,a.value.length),c||a.removeAttribute("readonly"),b=a.value}else{a.hasAttribute("contenteditable")&&a.focus();var d=window.getSelection(),e=document.createRange();e.selectNodeContents(a),d.removeAllRanges(),d.addRange(e),b=d.toString()}return b}b.exports=d},{}],6:[function(a,b,c){
function d(){}d.prototype={on:function(a,b,c){var d=this.e||(this.e={});return(d[a]||(d[a]=[])).push({fn:b,ctx:c}),this},once:function(a,b,c){function d(){e.off(a,d),b.apply(c,arguments)}var e=this;return d._=b,this.on(a,d,c)},emit:function(a){var b=[].slice.call(arguments,1),c=((this.e||(this.e={}))[a]||[]).slice(),d=0,e=c.length;for(d;d<e;d++)c[d].fn.apply(c[d].ctx,b);return this},off:function(a,b){var c=this.e||(this.e={}),d=c[a],e=[];if(d&&b)for(var f=0,g=d.length;f<g;f++)d[f].fn!==b&&d[f].fn._!==b&&e.push(d[f]);return e.length?c[a]=e:delete c[a],this}},b.exports=d},{}],7:[function(b,c,d){!function(e,f){if("function"==typeof a&&a.amd)a(["module","select"],f);else if("undefined"!=typeof d)f(c,b("select"));else{var g={exports:{}};f(g,e.select),e.clipboardAction=g.exports}}(this,function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e=c(b),f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),h=function(){function a(b){d(this,a),this.resolveOptions(b),this.initSelection()}return g(a,[{key:"resolveOptions",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=a.action,this.emitter=a.emitter,this.target=a.target,this.text=a.text,this.trigger=a.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var a=this,b="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return a.removeFake()},this.fakeHandler=document.body.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[b?"right":"left"]="-9999px";var c=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=c+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,e["default"])(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(document.body.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,e["default"])(this.target),this.copyText()}},{key:"copyText",value:function(){var a=void 0;try{a=document.execCommand(this.action)}catch(b){a=!1}this.handleResult(a)}},{key:"handleResult",value:function(a){this.emitter.emit(a?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=a,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(a){if(void 0!==a){if(!a||"object"!==("undefined"==typeof a?"undefined":f(a))||1!==a.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&a.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(a.hasAttribute("readonly")||a.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=a}},get:function(){return this._target}}]),a}();a.exports=h})},{select:5}],8:[function(b,c,d){!function(e,f){if("function"==typeof a&&a.amd)a(["module","./clipboard-action","tiny-emitter","good-listener"],f);else if("undefined"!=typeof d)f(c,b("./clipboard-action"),b("tiny-emitter"),b("good-listener"));else{var g={exports:{}};f(g,e.clipboardAction,e.tinyEmitter,e.goodListener),e.clipboard=g.exports}}(this,function(a,b,c,d){"use strict";function e(a){return a&&a.__esModule?a:{"default":a}}function f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function g(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function h(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function i(a,b){var c="data-clipboard-"+a;if(b.hasAttribute(c))return b.getAttribute(c)}var j=e(b),k=e(c),l=e(d),m=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),n=function(a){function b(a,c){f(this,b);var d=g(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return d.resolveOptions(c),d.listenClick(a),d}return h(b,a),m(b,[{key:"resolveOptions",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof a.action?a.action:this.defaultAction,this.target="function"==typeof a.target?a.target:this.defaultTarget,this.text="function"==typeof a.text?a.text:this.defaultText}},{key:"listenClick",value:function(a){var b=this;this.listener=(0,l["default"])(a,"click",function(a){return b.onClick(a)})}},{key:"onClick",value:function(a){var b=a.delegateTarget||a.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new j["default"]({action:this.action(b),target:this.target(b),text:this.text(b),trigger:b,emitter:this})}},{key:"defaultAction",value:function(a){return i("action",a)}},{key:"defaultTarget",value:function(a){var b=i("target",a);if(b)return document.querySelector(b)}},{key:"defaultText",value:function(a){return i("text",a)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],b="string"==typeof a?[a]:a,c=!!document.queryCommandSupported;return b.forEach(function(a){c=c&&!!document.queryCommandSupported(a)}),c}}]),b}(k["default"]);a.exports=n})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)})}catch(e){!function(a){a.fn.zclip=function(b){if("object"==typeof b&&!b.length){var c=a.extend({path:"ZeroClipboard.swf",copy:null,beforeCopy:null,afterCopy:null,clickAfter:!0,setHandCursor:!0,setCSSEffects:!0},b);return this.each(function(){var b=a(this);if(b.is(":visible")&&("string"==typeof c.copy||a.isFunction(c.copy))){ZeroClipboard.setMoviePath(c.path);var d=new ZeroClipboard.Client;a.isFunction(c.copy)&&b.bind("zClip_copy",c.copy),a.isFunction(c.beforeCopy)&&b.bind("zClip_beforeCopy",c.beforeCopy),a.isFunction(c.afterCopy)&&b.bind("zClip_afterCopy",c.afterCopy),d.setHandCursor(c.setHandCursor),d.setCSSEffects(c.setCSSEffects),d.addEventListener("mouseOver",function(a){b.trigger("mouseenter")}),d.addEventListener("mouseOut",function(a){b.trigger("mouseleave")}),d.addEventListener("mouseDown",function(e){b.trigger("mousedown"),a.isFunction(c.copy)?d.setText(b.triggerHandler("zClip_copy")):d.setText(c.copy),a.isFunction(c.beforeCopy)&&b.trigger("zClip_beforeCopy")}),d.addEventListener("complete",function(d,e){a.isFunction(c.afterCopy)?b.trigger("zClip_afterCopy"):(e.length>500&&(e=e.substr(0,500)+"...\n\n("+(e.length-500)+" characters not shown)"),b.removeClass("hover"),alert("Copied text to clipboard:\n\n "+e)),c.clickAfter&&b.trigger("click")}),d.glue(b[0],b.parent()[0]),a(window).bind("load resize",function(){d.reposition()})}})}if("string"==typeof b)return this.each(function(){var c=a(this);b=b.toLowerCase();var d=c.data("zclipId"),e=a("#"+d+".zclip");"remove"==b?(e.remove(),c.removeClass("active hover")):"hide"==b?(e.hide(),c.removeClass("active hover")):"show"==b&&e.show()})}}(jQuery);var ZeroClipboard={version:"1.0.7",clients:{},moviePath:"ZeroClipboard.swf",nextId:1,$:function(a){return"string"==typeof a&&(a=document.getElementById(a)),a.addClass||(a.hide=function(){this.style.display="none"},a.show=function(){this.style.display=""},a.addClass=function(a){this.removeClass(a),this.className+=" "+a},a.removeClass=function(a){for(var b=this.className.split(/\s+/),c=-1,d=0;d<b.length;d++)b[d]==a&&(c=d,d=b.length);return c>-1&&(b.splice(c,1),this.className=b.join(" ")),this},a.hasClass=function(a){return!!this.className.match(new RegExp("\\s*"+a+"\\s*"))}),a},setMoviePath:function(a){this.moviePath=a},dispatch:function(a,b,c){var d=this.clients[a];d&&d.receiveEvent(b,c)},register:function(a,b){this.clients[a]=b},getDOMObjectPosition:function(a,b){var c={left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};return a&&a!=b&&(c.left+=a.offsetLeft,c.top+=a.offsetTop),c},Client:function(a){this.handlers={},this.id=ZeroClipboard.nextId++,this.movieId="ZeroClipboardMovie_"+this.id,ZeroClipboard.register(this.id,this),a&&this.glue(a)}};ZeroClipboard.Client.prototype={id:0,ready:!1,movie:null,clipText:"",handCursorEnabled:!0,cssEffects:!0,handlers:null,glue:function(a,b,c){this.domElement=ZeroClipboard.$(a);var d=99;this.domElement.style.zIndex&&(d=parseInt(this.domElement.style.zIndex,10)+1),"string"==typeof b?b=ZeroClipboard.$(b):"undefined"==typeof b&&(b=document.getElementsByTagName("body")[0]);var e=ZeroClipboard.getDOMObjectPosition(this.domElement,b);this.div=document.createElement("div"),this.div.className="zclip",this.div.id="zclip-"+this.movieId,$(this.domElement).data("zclipId","zclip-"+this.movieId);var f=this.div.style;if(f.position="absolute",f.left=""+e.left+"px",f.top=""+e.top+"px",f.width=""+e.width+"px",f.height=""+e.height+"px",f.zIndex=d,"object"==typeof c)for(addedStyle in c)f[addedStyle]=c[addedStyle];b.appendChild(this.div),this.div.innerHTML=this.getHTML(e.width,e.height)},getHTML:function(a,b){var c="",d="id="+this.id+"&width="+a+"&height="+b;if(navigator.userAgent.match(/MSIE/)){var e=location.href.match(/^https/i)?"https://":"http://";c+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+a+'" height="'+b+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+d+'"/><param name="wmode" value="transparent"/></object>'}else c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+a+'" height="'+b+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+d+'" wmode="transparent" />';return c},hide:function(){this.div&&(this.div.style.left="-2000px")},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide(),this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.domElement=null,this.div=null}},reposition:function(a){if(a&&(this.domElement=ZeroClipboard.$(a),this.domElement||this.hide()),this.domElement&&this.div){var b=ZeroClipboard.getDOMObjectPosition(this.domElement),c=this.div.style;c.left=""+b.left+"px",c.top=""+b.top+"px"}},setText:function(a){this.clipText=a,this.ready&&this.movie.setText(a)},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,""),this.handlers[a]||(this.handlers[a]=[]),this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a,this.ready&&this.movie.setHandCursor(a)},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(a,b){switch(a=a.toString().toLowerCase().replace(/^on/,"")){case"load":if(this.movie=document.getElementById(this.movieId),!this.movie){var c=this;return void setTimeout(function(){c.receiveEvent("load",null)},1)}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var c=this;return setTimeout(function(){c.receiveEvent("load",null)},100),void(this.ready=!0)}this.ready=!0;try{this.movie.setText(this.clipText)}catch(d){}try{this.movie.setHandCursor(this.handCursorEnabled)}catch(d){}break;case"mouseover":this.domElement&&this.cssEffects&&(this.domElement.addClass("hover"),this.recoverActive&&this.domElement.addClass("active"));break;case"mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0),this.domElement.removeClass("hover"));break;case"mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case"mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[a])for(var e=0,f=this.handlers[a].length;e<f;e++){var g=this.handlers[a][e];"function"==typeof g?g(this,b):"object"==typeof g&&2==g.length?g[0][g[1]](this,b):"string"==typeof g&&window[g](this,b)}}}}BI.ClipBoard=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.ClipBoard.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-clipboard",copy:BI.emptyFn,afterCopy:BI.emptyFn})},_init:function(){BI.ClipBoard.superclass._init.apply(this,arguments)},mounted:function(){var a=this.options;window.Clipboard?(this.clipboard=new Clipboard(this.element[0],{text:function(){return BI.isFunction(a.copy)?a.copy():a.copy}}),this.clipboard.on("success",a.afterCopy)):this.element.zclip({path:BI.resourceURL+"/ZeroClipboard.swf",copy:a.copy,beforeCopy:a.beforeCopy,afterCopy:a.afterCopy})},destroyed:function(){this.clipboard&&this.clipboard.destroy()}}),BI.shortcut("bi.clipboard",BI.ClipBoard),BI.CustomColorChooser=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.CustomColorChooser.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-custom-color-chooser",width:227,height:245})},_init:function(){BI.CustomColorChooser.superclass._init.apply(this,arguments);var a=this;this.editor=BI.createWidget({type:"bi.color_picker_editor"}),this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE,function(){a.setValue(this.getValue())}),this.farbtastic=BI.createWidget({type:"bi.farbtastic"}),this.farbtastic.on(BI.Farbtastic.EVENT_CHANGE,function(){a.setValue(this.getValue())}),BI.createWidget({type:"bi.vtape",element:this,items:[{type:"bi.absolute",items:[{el:this.editor,left:10,top:10,right:10}],height:30},{type:"bi.absolute",items:[{el:this.farbtastic,left:15,right:15,top:10}],height:215}]})},setValue:function(a){this.editor.setValue(a),this.farbtastic.setValue(a)},getValue:function(){return this.editor.getValue()}}),BI.CustomColorChooser.EVENT_CHANGE="CustomColorChooser.EVENT_CHANGE",BI.shortcut("bi.custom_color_chooser",BI.CustomColorChooser),BI.ColorChooser=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ColorChooser.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-color-chooser",el:{}})},_init:function(){BI.ColorChooser.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget(BI.extend({type:"bi.color_chooser_trigger",width:b.width,height:b.height},b.el)),this.colorPicker=BI.createWidget({type:"bi.color_chooser_popup"}),this.combo=BI.createWidget({type:"bi.combo",element:this,adjustLength:1,el:this.trigger,popup:{el:this.colorPicker,stopPropagation:!1,minWidth:202}});var c=function(){var b=a.colorPicker.getValue();a.trigger.setValue(b);var c=BI.string2Array(BI.Cache.getItem("colors")||""),d=new BI.Queue(8);d.fromArray(c),d.remove(b),d.unshift(b),BI.Cache.setItem("colors",BI.array2String(d.toArray()))};this.colorPicker.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE,function(){c()}),this.colorPicker.on(BI.ColorChooserPopup.EVENT_CHANGE,function(){c(),a.combo.hideView()}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){a.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors")||""))}),this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW,function(){a.fireEvent(BI.ColorChooser.EVENT_CHANGE,arguments)})},isViewVisible:function(){return this.combo.isViewVisible()},hideView:function(){this.combo.hideView()},showView:function(){this.combo.showView()},setValue:function(a){this.combo.setValue(a)},getValue:function(){return this.colorPicker.getValue()}}),BI.ColorChooser.EVENT_CHANGE="ColorChooser.EVENT_CHANGE",BI.shortcut("bi.color_chooser",BI.ColorChooser),BI.ColorChooserPopup=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ColorChooserPopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-color-chooser-popup",width:200,height:145})},_init:function(){BI.ColorChooserPopup.superclass._init.apply(this,arguments);var a=this;this.options;this.colorEditor=BI.createWidget({type:"bi.color_picker_editor"}),this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE,function(){a.setValue(this.getValue()),a.fireEvent(BI.ColorChooserPopup.EVENT_VALUE_CHANGE,arguments)}),this.storeColors=BI.createWidget({type:"bi.color_picker",items:[[{value:"",disabled:!0},{value:"",disabled:!0},{value:"",disabled:!0},{value:"",disabled:!0},{value:"",disabled:!0},{value:"",disabled:!0},{value:"",disabled:!0},{value:"",disabled:!0}]],width:190,height:25}),this.storeColors.on(BI.ColorPicker.EVENT_CHANGE,function(){a.setValue(this.getValue()[0]),a.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE,arguments)}),this.colorPicker=BI.createWidget({type:"bi.color_picker",width:190,height:50}),this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE,function(){a.setValue(this.getValue()[0]),a.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE,arguments)}),this.customColorChooser=BI.createWidget({type:"bi.custom_color_chooser"});var b=BI.createWidget({type:"bi.popup_panel",buttons:[BI.i18nText("BI-Basic_Cancel"),BI.i18nText("BI-Basic_Save")],title:BI.i18nText("BI-Custom_Color"),el:this.customColorChooser,stopPropagation:!1,bgap:-1,rgap:1,lgap:1,minWidth:227});this.more=BI.createWidget({type:"bi.combo",direction:"right,top",isNeedAdjustHeight:!1,el:{type:"bi.text_item",cls:"color-chooser-popup-more bi-list-item",textAlign:"center",height:20,text:BI.i18nText("BI-Basic_More")+"..."},popup:b}),this.more.on(BI.Combo.EVENT_AFTER_POPUPVIEW,function(){a.customColorChooser.setValue(a.getValue())}),b.on(BI.PopupPanel.EVENT_CLICK_TOOLBAR_BUTTON,function(b){switch(b){case 0:a.more.hideView();break;case 1:a.setValue(a.customColorChooser.getValue()),a.more.hideView(),a.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE,arguments)}}),BI.createWidget({type:"bi.vtape",element:this,items:[{el:{type:"bi.absolute",cls:"bi-background bi-border-bottom",items:[{el:this.colorEditor,left:0,right:0,top:5}]},height:30},{el:{type:"bi.absolute",items:[{el:this.storeColors,left:5,right:5,top:5}]},height:30},{el:{type:"bi.absolute",items:[{el:this.colorPicker,left:5,right:5,top:5}]},height:65},{el:this.more,height:20}]})},setStoreColors:function(a){if(BI.isArray(a)){var b=BI.map(a,function(a,b){return{value:b}});BI.count(a.length,8,function(a){b.push({value:"",disabled:!0})}),this.storeColors.populate([b])}},setValue:function(a){this.colorEditor.setValue(a),this.colorPicker.setValue(a),this.storeColors.setValue(a)},getValue:function(){return this.colorEditor.getValue()}}),BI.ColorChooserPopup.EVENT_VALUE_CHANGE="ColorChooserPopup.EVENT_VALUE_CHANGE",BI.ColorChooserPopup.EVENT_CHANGE="ColorChooserPopup.EVENT_CHANGE",BI.shortcut("bi.color_chooser_popup",BI.ColorChooserPopup),BI.ColorChooserTrigger=BI.inherit(BI.Trigger,{_defaultConfig:function(){var a=BI.ColorChooserTrigger.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-color-chooser-trigger",height:30})},_init:function(){BI.ColorChooserTrigger.superclass._init.apply(this,arguments),this.colorContainer=BI.createWidget({type:"bi.layout",cls:"bi-card color-chooser-trigger-content"});var a=BI.createWidget({type:"bi.icon_button",disableSelected:!0,cls:"icon-combo-down-icon trigger-triangle-font",width:12,height:8});BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.colorContainer,left:3,right:3,top:3,bottom:3},{el:a,right:3,bottom:3}]}),this.options.value&&this.setValue(this.options.value)},setValue:function(a){BI.ColorChooserTrigger.superclass.setValue.apply(this,arguments),""===a?this.colorContainer.element.css("background-color","").removeClass("trans-color-background").addClass("auto-color-background"):"transparent"===a?this.colorContainer.element.css("background-color","").removeClass("auto-color-background").addClass("trans-color-background"):this.colorContainer.element.css({"background-color":a}).removeClass("auto-color-background").removeClass("trans-color-background")}}),BI.ColorChooserTrigger.EVENT_CHANGE="ColorChooserTrigger.EVENT_CHANGE",BI.shortcut("bi.color_chooser_trigger",BI.ColorChooserTrigger),BI.ColorPickerButton=BI.inherit(BI.BasicButton,{_defaultConfig:function(){var a=BI.ColorPickerButton.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-color-picker-button bi-background bi-border-top bi-border-left"})},_init:function(){BI.ColorPickerButton.superclass._init.apply(this,arguments);var a=this,b=this.options;if(b.value){this.element.css("background-color",b.value);var c=this.getName();this.element.hover(function(){a._createMask(),a.isEnabled()&&BI.Maskers.show(c)},function(){a.isSelected()||BI.Maskers.hide(c)})}},_createMask:function(){var a=this.options,b=this.getName();if(this.isEnabled()&&!BI.Maskers.has(b)){var c=BI.Maskers.make(b,this,{offset:{left:-1,top:-1,right:-1,bottom:-1}});c.element.addClass("color-picker-button-mask").css("background-color",a.value)}},setSelected:function(a){BI.ColorPickerButton.superclass.setSelected.apply(this,arguments),a&&this._createMask(),BI.Maskers[a?"show":"hide"](this.getName())}}),BI.ColorPickerButton.EVENT_CHANGE="ColorPickerButton.EVENT_CHANGE",BI.shortcut("bi.color_picker_button",BI.ColorPickerButton),BI.ColorPicker=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ColorPicker.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-color-picker",items:null})},_items:[[{value:"#ffffff"},{value:"#f2f2f2"},{value:"#e5e5e5"},{value:"#d9d9d9"},{value:"#cccccc"},{value:"#bfbfbf"},{value:"#b2b2b2"},{value:"#a6a6a6"},{value:"#999999"},{value:"#8c8c8c"},{value:"#808080"},{value:"#737373"},{value:"#666666"},{value:"#4d4d4d"},{value:"#333333"},{value:"#000000"}],[{value:"#d8b5a6"},{value:"#ff9e9a"},{value:"#ffc17d"},{value:"#f5e56b"},{value:"#d8e698"},{value:"#e0ebaf"},{value:"#c3d825"},{value:"#bce2e8"},{value:"#85d3cd"},{value:"#bce2e8"},{value:"#a0d8ef"},{value:"#89c3eb"},{value:"#bbc8e6"},{value:"#bbbcde"},{value:"#d6b4cc"},{value:"#fbc0d3"}],[{value:"#bb9581"},{value:"#f37d79"},{value:"#fba74f"},{value:"#ffdb4f"},{value:"#c7dc68"},{value:"#b0ca71"},{value:"#99ab4e"},{value:"#84b9cb"},{value:"#00a3af"},{value:"#2ca9e1"},{value:"#0095d9"},{value:"#4c6cb3"},{value:"#8491c3"},{value:"#a59aca"},{value:"#cc7eb1"},{value:"#e89bb4"}],[{value:"#9d775f"},{value:"#dd4b4b"},{value:"#ef8b07"},{value:"#fcc800"},{value:"#aacf53"},{value:"#82ae46"},{value:"#69821b"},{value:"#59b9c6"},{value:"#2a83a2"},{value:"#007bbb"},{value:"#19448e"},{value:"#274a78"},{value:"#4a488e"},{value:"#7058a3"},{value:"#884898"},{value:"#d47596"}]],_init:function(){BI.ColorPicker.superclass._init.apply(this,arguments);var a=this,b=this.options;this.colors=BI.createWidget({type:"bi.button_group",element:this,items:BI.createItems(b.items||this._items,{type:"bi.color_picker_button",once:!1}),layouts:[{type:"bi.grid"}]}),this.colors.on(BI.ButtonGroup.EVENT_CHANGE,function(){a.fireEvent(BI.ColorPicker.EVENT_CHANGE,arguments)})},populate:function(a){var b=[].slice.call(arguments);b[0]=BI.createItems(a,{type:"bi.color_picker_button",once:!1}),this.colors.populate.apply(this.colors,b)},setValue:function(a){this.colors.setValue(a)},getValue:function(){return this.colors.getValue()}}),BI.ColorPicker.EVENT_CHANGE="ColorPicker.EVENT_CHANGE",BI.shortcut("bi.color_picker",BI.ColorPicker),BI.ColorPickerEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ColorPickerEditor.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-color-picker-editor",height:20})},_init:function(){BI.ColorPickerEditor.superclass._init.apply(this,arguments);var a=this;this.options;this.colorShow=BI.createWidget({type:"bi.layout",cls:"color-picker-editor-display bi-card",height:20});var b=BI.createWidgets(BI.createItems([{text:"R"},{text:"G"},{text:"B"}],{type:"bi.label",cls:"color-picker-editor-label",width:10,height:20})),c=function(a){return BI.isNumeric(a)&&(0|a)>=0&&(0|a)<=255},d=BI.createWidgets([{},{},{}],{type:"bi.small_text_editor",cls:"color-picker-editor-input",validationChecker:c,errorText:BI.i18nText("BI-Color_Picker_Error_Text"),allowBlank:!0,value:255,width:32,height:20});BI.each(d,function(b,c){c.on(BI.TextEditor.EVENT_CHANGE,function(){a.R.isValid()&&a.G.isValid()&&a.B.isValid()&&(a.colorShow.element.css("background-color",a.getValue()),a.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE))})}),this.R=d[0],this.G=d[1],this.B=d[2],this.none=BI.createWidget({type:"bi.checkbox",title:BI.i18nText("BI-Basic_Auto")}),this.none.on(BI.Checkbox.EVENT_CHANGE,function(){this.isSelected()?(a.lastColor=a.getValue(),a.setValue("")):a.setValue(a.lastColor||"#000000"),a.R.isValid()&&a.G.isValid()&&a.B.isValid()&&(a.colorShow.element.css("background-color",a.getValue()),a.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE))}),this.transparent=BI.createWidget({type:"bi.checkbox",title:BI.i18nText("BI-Transparent_Color")}),this.transparent.on(BI.Checkbox.EVENT_CHANGE,function(){this.isSelected()?(a.lastColor=a.getValue(),a.setValue("transparent")):a.setValue(a.lastColor||"#000000"),a.R.isValid()&&a.G.isValid()&&a.B.isValid()&&(a.colorShow.element.css("background-color",a.getValue()),a.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE))}),BI.createWidget({type:"bi.htape",element:this,items:[{el:this.colorShow,width:"fill"},{el:b[0],lgap:10,width:16},{el:this.R,width:32},{el:b[1],lgap:10,width:16},{el:this.G,width:32},{el:b[2],lgap:10,width:16},{el:this.B,width:32},{el:{type:"bi.center_adapt",items:[this.none]},width:18},{el:{type:"bi.center_adapt",items:[this.transparent]},width:18}]})},setValue:function(a){if("transparent"===a)return this.transparent.setSelected(!0),this.none.setSelected(!1),this.R.setValue(""),this.G.setValue(""),void this.B.setValue("");a?this.none.setSelected(!1):(a="",this.none.setSelected(!0)),this.transparent.setSelected(!1),this.colorShow.element.css("background-color",a);var b=BI.DOM.rgb2json(BI.DOM.hex2rgb(a));this.R.setValue(BI.isNull(b.r)?"":b.r),this.G.setValue(BI.isNull(b.g)?"":b.g),this.B.setValue(BI.isNull(b.b)?"":b.b)},getValue:function(){return this.transparent.isSelected()?"transparent":BI.DOM.rgb2hex(BI.DOM.json2rgb({r:this.R.getValue(),g:this.G.getValue(),b:this.B.getValue()}))}}),BI.ColorPickerEditor.EVENT_CHANGE="ColorPickerEditor.EVENT_CHANGE",BI.shortcut("bi.color_picker_editor",BI.ColorPickerEditor),BI.Farbtastic=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Farbtastic.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-farbtastic",width:195,height:195})},_init:function(){BI.Farbtastic.superclass._init.apply(this,arguments)},mounted:function(){var a=this;this.farbtastic=$.farbtastic(this.element,function(b){a.fireEvent(BI.Farbtastic.EVENT_CHANGE,a.getValue(),a)})},setValue:function(a){this.farbtastic.setColor(a)},getValue:function(){return this.farbtastic.color}}),BI.Farbtastic.EVENT_CHANGE="Farbtastic.EVENT_CHANGE",BI.shortcut("bi.farbtastic",BI.Farbtastic),jQuery.fn.farbtastic=function(a){return $.farbtastic(this,a),this},jQuery.farbtastic=function(a,b){var a=$(a).get(0);return a.farbtastic||(a.farbtastic=new jQuery._farbtastic(a,b))},jQuery._farbtastic=function(a,b){var c=this;$(a).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');var d=$(".farbtastic",a);c.wheel=$(".wheel",a).get(0),c.radius=84,c.square=100,c.width=194,navigator.appVersion.match(/MSIE [0-6]\./)&&$("*",d).each(function(){if("none"!=this.currentStyle.backgroundImage){var a=this.currentStyle.backgroundImage;a=this.currentStyle.backgroundImage.substring(5,a.length-2),$(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+a+"')"})}}),c.linkTo=function(a){return"object"==typeof c.callback&&$(c.callback).unbind("keyup",c.updateValue),c.color=null,"function"==typeof a?c.callback=a:"object"!=typeof a&&"string"!=typeof a||(c.callback=$(a),c.callback.bind("keyup",c.updateValue),c.callback.get(0).value&&c.setColor(c.callback.get(0).value)),this},c.updateValue=function(a){this.value&&this.value!=c.color&&c.setColor(this.value)},c.setColor=function(a){var b=c.unpack(a);return c.color!=a&&b&&(c.color=a,c.rgb=b,c.hsl=c.RGBToHSL(c.rgb),c.updateDisplay()),this},c.setHSL=function(a){return c.hsl=a,c.rgb=c.HSLToRGB(a),c.color=c.pack(c.rgb),c.updateDisplay(),this},c.widgetCoords=function(a){var b,d,e=a.target||a.srcElement,f=c.wheel;if("undefined"!=typeof a.offsetX){for(var g={x:a.offsetX,y:a.offsetY},h=e;h;)h.mouseX=g.x,h.mouseY=g.y,g.x+=h.offsetLeft,g.y+=h.offsetTop,h=h.offsetParent;for(var h=f,i={x:0,y:0};h;){if("undefined"!=typeof h.mouseX){b=h.mouseX-i.x,d=h.mouseY-i.y;break}i.x+=h.offsetLeft,i.y+=h.offsetTop,h=h.offsetParent}for(h=e;h;)h.mouseX=void 0,h.mouseY=void 0,h=h.offsetParent}else{var g=c.absolutePosition(f);b=(a.pageX||0*(a.clientX+$("html").get(0).scrollLeft))-g.x,d=(a.pageY||0*(a.clientY+$("html").get(0).scrollTop))-g.y}return{x:b-c.width/2,y:d-c.width/2}},c.click=function(a){var b=c.widgetCoords(a);return c.circleDrag=2*Math.max(Math.abs(b.x),Math.abs(b.y))>c.square,c.mousemove(a),!1},c.mousemove=function(a){var b=c.widgetCoords(a);if(c.circleDrag){var d=Math.atan2(b.x,-b.y)/6.28;d<0&&(d+=1),c.setHSL([d,c.hsl[1],c.hsl[2]])}else{var e=Math.max(0,Math.min(1,-(b.x/c.square)+.5)),f=Math.max(0,Math.min(1,-(b.y/c.square)+.5));c.setHSL([c.hsl[0],e,f])}return!1},c.updateDisplay=function(){var a=6.28*c.hsl[0];$(".h-marker",d).css({left:Math.round(Math.sin(a)*c.radius+c.width/2)+"px",top:Math.round(-Math.cos(a)*c.radius+c.width/2)+"px"}),$(".sl-marker",d).css({left:Math.round(c.square*(.5-c.hsl[1])+c.width/2)+"px",top:Math.round(c.square*(.5-c.hsl[2])+c.width/2)+"px"}),$(".color",d).css("backgroundColor",c.pack(c.HSLToRGB([c.hsl[0],1,.5]))),"object"==typeof c.callback?($(c.callback).css({backgroundColor:c.color,color:c.hsl[2]>.5?"#000":"#fff"}),$(c.callback).each(function(){this.value&&this.value!=c.color&&(this.value=c.color)})):"function"==typeof c.callback&&c.callback.call(c,c.color);
},c.absolutePosition=function(a){var b={x:a.offsetLeft,y:a.offsetTop};if(a.offsetParent){var d=c.absolutePosition(a.offsetParent);b.x+=d.x,b.y+=d.y}return b},c.pack=function(a){var b=Math.round(255*a[0]),c=Math.round(255*a[1]),d=Math.round(255*a[2]);return"#"+(b<16?"0":"")+b.toString(16)+(c<16?"0":"")+c.toString(16)+(d<16?"0":"")+d.toString(16)},c.unpack=function(a){return 7==a.length?[parseInt("0x"+a.substring(1,3))/255,parseInt("0x"+a.substring(3,5))/255,parseInt("0x"+a.substring(5,7))/255]:4==a.length?[parseInt("0x"+a.substring(1,2))/15,parseInt("0x"+a.substring(2,3))/15,parseInt("0x"+a.substring(3,4))/15]:void 0},c.HSLToRGB=function(a){var b,c,d=a[0],e=a[1],f=a[2];return c=f<=.5?f*(e+1):f+e-f*e,b=2*f-c,[this.hueToRGB(b,c,d+.33333),this.hueToRGB(b,c,d),this.hueToRGB(b,c,d-.33333)]},c.hueToRGB=function(a,b,c){return c=c<0?c+1:c>1?c-1:c,6*c<1?a+(b-a)*c*6:2*c<1?b:3*c<2?a+(b-a)*(.66666-c)*6:a},c.RGBToHSL=function(a){var b,c,d,e,f,g,h=a[0],i=a[1],j=a[2];return b=Math.min(h,Math.min(i,j)),c=Math.max(h,Math.max(i,j)),d=c-b,g=(b+c)/2,f=0,g>0&&g<1&&(f=d/(g<.5?2*g:2-2*g)),e=0,d>0&&(c==h&&c!=i&&(e+=(i-j)/d),c==i&&c!=j&&(e+=2+(j-h)/d),c==j&&c!=h&&(e+=4+(h-i)/d),e/=6),[e,f,g]},$("*",d).click(c.click),c.setColor("#000000"),b&&c.linkTo(b)},BI.BubbleCombo=BI.inherit(BI.Widget,{_const:{TRIANGLE_LENGTH:6},_defaultConfig:function(){return BI.extend(BI.BubbleCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-bubble-combo",trigger:"click",toggle:!0,direction:"bottom",isDefaultInit:!1,destroyWhenHide:!1,isNeedAdjustHeight:!0,isNeedAdjustWidth:!0,stopPropagation:!1,adjustLength:0,hideChecker:BI.emptyFn,offsetStyle:"left",el:{},popup:{}})},_init:function(){BI.BubbleCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.combo=BI.createWidget({type:"bi.combo",element:this,trigger:b.trigger,toggle:b.toggle,direction:b.direction,isDefaultInit:b.isDefaultInit,destroyWhenHide:b.destroyWhenHide,isNeedAdjustHeight:b.isNeedAdjustHeight,isNeedAdjustWidth:b.isNeedAdjustWidth,adjustLength:this._getAdjustLength(),stopPropagation:b.stopPropagation,adjustXOffset:0,adjustYOffset:0,hideChecker:b.hideChecker,offsetStyle:b.offsetStyle,el:b.el,popup:BI.extend({type:"bi.bubble_popup_view"},b.popup)}),this.combo.on(BI.Combo.EVENT_TRIGGER_CHANGE,function(){a.fireEvent(BI.BubbleCombo.EVENT_TRIGGER_CHANGE,arguments)}),this.combo.on(BI.Combo.EVENT_CHANGE,function(){a.fireEvent(BI.BubbleCombo.EVENT_CHANGE,arguments)}),this.combo.on(BI.Combo.EVENT_EXPAND,function(){a.fireEvent(BI.BubbleCombo.EVENT_EXPAND,arguments)}),this.combo.on(BI.Combo.EVENT_COLLAPSE,function(){a.fireEvent(BI.BubbleCombo.EVENT_COLLAPSE,arguments)}),this.combo.on(BI.Combo.EVENT_AFTER_INIT,function(){a.fireEvent(BI.BubbleCombo.EVENT_AFTER_INIT,arguments)}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){a.fireEvent(BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW,arguments)}),this.combo.on(BI.Combo.EVENT_AFTER_POPUPVIEW,function(){a._showTriangle(),a.fireEvent(BI.BubbleCombo.EVENT_AFTER_POPUPVIEW,arguments)}),this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW,function(){a._hideTriangle(),a.fireEvent(BI.BubbleCombo.EVENT_BEFORE_HIDEVIEW,arguments)}),this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW,function(){a.fireEvent(BI.BubbleCombo.EVENT_AFTER_HIDEVIEW,arguments)})},_getAdjustLength:function(){return this._const.TRIANGLE_LENGTH+this.options.adjustLength},_createTriangle:function(a){var b={},c={},d=this.options.adjustLength,e=this.element.offset(),f=e.left,g=e.left+this.element.outerWidth(),h=e.top,i=e.top+this.element.outerHeight();switch(a){case"left":b={top:h,height:this.element.outerHeight(),left:f-d-this._const.TRIANGLE_LENGTH},c={width:this._const.TRIANGLE_LENGTH};break;case"right":b={top:h,height:this.element.outerHeight(),left:g+d},c={width:this._const.TRIANGLE_LENGTH};break;case"top":b={left:f,width:this.element.outerWidth(),top:h-d-this._const.TRIANGLE_LENGTH},c={height:this._const.TRIANGLE_LENGTH};break;case"bottom":b={left:f,width:this.element.outerWidth(),top:i+d},c={height:this._const.TRIANGLE_LENGTH}}this.triangle&&this.triangle.destroy(),this.triangle=BI.createWidget(c,{type:"bi.center_adapt",cls:"button-combo-triangle-wrapper",items:[{type:"bi.layout",cls:"bubble-combo-triangle-"+a+" bi-high-light-border"}]}),b.el=this.triangle,BI.createWidget({type:"bi.absolute",element:this,items:[b]})},_createLeftTriangle:function(){this._createTriangle("left")},_createRightTriangle:function(){this._createTriangle("right")},_createTopTriangle:function(){this._createTriangle("top")},_createBottomTriangle:function(){this._createTriangle("bottom")},_showTriangle:function(){var a=this.combo.getPopupPosition();switch(a.dir){case"left,top":case"left,bottom":this._createLeftTriangle(),this.combo.getView().showLine("right");break;case"right,top":case"right,bottom":this._createRightTriangle(),this.combo.getView().showLine("left");break;case"top,left":case"top,right":this._createTopTriangle(),this.combo.getView().showLine("bottom");break;case"bottom,left":case"bottom,right":this._createBottomTriangle(),this.combo.getView().showLine("top")}},_hideTriangle:function(){this.triangle&&this.triangle.destroy(),this.triangle=null,this.combo.getView()&&this.combo.getView().hideLine()},hideView:function(){this._hideTriangle(),this.combo&&this.combo.hideView()},showView:function(){this.combo&&this.combo.showView()},isViewVisible:function(){return this.combo.isViewVisible()}}),BI.BubbleCombo.EVENT_TRIGGER_CHANGE="EVENT_TRIGGER_CHANGE",BI.BubbleCombo.EVENT_CHANGE="EVENT_CHANGE",BI.BubbleCombo.EVENT_EXPAND="EVENT_EXPAND",BI.BubbleCombo.EVENT_COLLAPSE="EVENT_COLLAPSE",BI.BubbleCombo.EVENT_AFTER_INIT="EVENT_AFTER_INIT",BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.BubbleCombo.EVENT_AFTER_POPUPVIEW="EVENT_AFTER_POPUPVIEW",BI.BubbleCombo.EVENT_BEFORE_HIDEVIEW="EVENT_BEFORE_HIDEVIEW",BI.BubbleCombo.EVENT_AFTER_HIDEVIEW="EVENT_AFTER_HIDEVIEW",BI.shortcut("bi.bubble_combo",BI.BubbleCombo),BI.BubblePopupView=BI.inherit(BI.PopupView,{_defaultConfig:function(){var a=BI.BubblePopupView.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:a.baseCls+" bi-bubble-popup-view"})},_init:function(){BI.BubblePopupView.superclass._init.apply(this,arguments)},showLine:function(a){var b={},c={};switch(a){case"left":b={top:0,bottom:0,left:-1},c={width:3};break;case"right":b={top:0,bottom:0,right:-1},c={width:3};break;case"top":b={left:0,right:0,top:-1},c={height:3};break;case"bottom":b={left:0,right:0,bottom:-1},c={height:3}}this.line=BI.createWidget(c,{type:"bi.layout",cls:"bubble-popup-line bi-high-light-background"}),b.el=this.line,BI.createWidget({type:"bi.absolute",element:this,items:[b]})},hideLine:function(){this.line&&this.line.destroy()}}),BI.shortcut("bi.bubble_popup_view",BI.BubblePopupView),BI.BubblePopupBarView=BI.inherit(BI.BubblePopupView,{_defaultConfig:function(){return BI.extend(BI.BubblePopupBarView.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-bubble-bar-popup-view",buttons:[{value:BI.i18nText(BI.i18nText("BI-Basic_Sure"))},{value:BI.i18nText("BI-Basic_Cancel"),level:"ignore"}]})},_init:function(){BI.BubblePopupBarView.superclass._init.apply(this,arguments)},_createToolBar:function(){var a=this.options,b=this,c=[];return BI.each(a.buttons.reverse(),function(a,d){BI.isWidget(d)?c.push(d):c.push(BI.extend({type:"bi.button",height:30,handler:function(a){b.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON,a)}},d))}),BI.createWidget({type:"bi.right_vertical_adapt",height:40,hgap:10,bgap:10,items:c})}}),BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON="EVENT_CLICK_TOOLBAR_BUTTON",BI.shortcut("bi.bubble_bar_popup_view",BI.BubblePopupBarView),BI.EditorIconCheckCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.EditorIconCheckCombo.superclass._defaultConfig.apply(this,arguments),{baseClass:"bi-check-editor-combo",width:100,height:24,chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,validationChecker:BI.emptyFn,quitChecker:BI.emptyFn,allowBlank:!0,watermark:"",errorText:""})},_init:function(){BI.EditorIconCheckCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget({type:"bi.editor_trigger",items:b.items,height:b.height,validationChecker:b.validationChecker,quitChecker:b.quitChecker,allowBlank:b.allowBlank,watermark:b.watermark,errorText:b.errorText}),this.trigger.on(BI.EditorTrigger.EVENT_CHANGE,function(){a.popup.setValue(this.getValue()),a.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE)}),this.popup=BI.createWidget({type:"bi.text_value_check_combo_popup",chooseType:b.chooseType,items:b.items}),this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.editorIconCheckCombo.hideView(),a.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE)}),this.popup.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editorIconCheckCombo=BI.createWidget({type:"bi.combo",element:this,adjustLength:2,el:this.trigger,popup:{el:this.popup,maxHeight:300}})},setValue:function(a){this.editorIconCheckCombo.setValue(a)},getValue:function(){return this.trigger.getValue()},populate:function(a){this.options.items=a,this.editorIconCheckCombo.populate(a)}}),BI.EditorIconCheckCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.editor_icon_check_combo",BI.EditorIconCheckCombo),BI.IconCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.IconCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-icon-combo",width:24,height:24,iconClass:"",el:{},popup:{},minWidth:100,maxWidth:"auto",maxHeight:300,direction:"bottom",adjustLength:3,adjustXOffset:0,adjustYOffset:0,offsetStyle:"left",chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE})},_init:function(){BI.IconCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget(b.el,{type:"bi.icon_combo_trigger",iconClass:b.iconClass,title:b.title,items:b.items,width:b.width,height:b.height,iconWidth:b.iconWidth,iconHeight:b.iconHeight}),this.popup=BI.createWidget(b.popup,{type:"bi.icon_combo_popup",chooseType:b.chooseType,items:b.items}),this.popup.on(BI.IconComboPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.iconCombo.hideView(),a.fireEvent(BI.IconCombo.EVENT_CHANGE)}),this.popup.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.iconCombo=BI.createWidget({type:"bi.combo",element:this,direction:b.direction,trigger:b.trigger,container:b.container,adjustLength:b.adjustLength,adjustXOffset:b.adjustXOffset,adjustYOffset:b.adjustYOffset,offsetStyle:b.offsetStyle,el:this.trigger,popup:{el:this.popup,maxWidth:b.maxWidth,maxHeight:b.maxHeight,minWidth:b.minWidth}})},showView:function(){this.iconCombo.showView()},hideView:function(){this.iconCombo.hideView()},setValue:function(a){this.iconCombo.setValue(a)},getValue:function(){return this.iconCombo.getValue()},populate:function(a){this.options.items=a,this.iconCombo.populate(a)}}),BI.IconCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.icon_combo",BI.IconCombo),BI.IconComboPopup=BI.inherit(BI.Pane,{_defaultConfig:function(){return BI.extend(BI.IconComboPopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi.icon-combo-popup",chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE})},_init:function(){BI.IconComboPopup.superclass._init.apply(this,arguments);var a=this.options,b=this;this.popup=BI.createWidget({type:"bi.button_group",items:BI.createItems(a.items,{type:"bi.single_select_icon_text_item",height:30}),chooseType:a.chooseType,layouts:[{type:"bi.vertical"}]}),this.popup.on(BI.Controller.EVENT_CHANGE,function(a,c,d){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.IconComboPopup.EVENT_CHANGE,c,d)}),BI.createWidget({type:"bi.vertical",element:this,items:[this.popup]})},populate:function(a){BI.IconComboPopup.superclass.populate.apply(this,arguments),a=BI.createItems(a,{type:"bi.single_select_icon_text_item",height:30}),this.popup.populate(a)},getValue:function(){return this.popup.getValue()},setValue:function(a){this.popup.setValue(a)}}),BI.IconComboPopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.icon_combo_popup",BI.IconComboPopup),BI.IconComboTrigger=BI.inherit(BI.Trigger,{_defaultConfig:function(){return BI.extend(BI.IconComboTrigger.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-icon-combo-trigger",el:{},items:[],iconClass:"",width:25,height:25,isShowDown:!0})},_init:function(){BI.IconComboTrigger.superclass._init.apply(this,arguments);var a=this.options;this.button=BI.createWidget(a.el,{type:"bi.icon_change_button",cls:"icon-combo-trigger-icon "+a.iconClass,disableSelected:!0,width:a.width,height:a.height,iconWidth:a.iconWidth,iconHeight:a.iconHeight}),this.down=BI.createWidget({type:"bi.icon_button",disableSelected:!0,cls:"icon-combo-down-icon trigger-triangle-font",width:12,height:8}),this.down.setVisible(a.isShowDown),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.button,left:0,right:0,top:0,bottom:0},{el:this.down,right:0,bottom:0}]}),BI.isKey(a.value)&&this.setValue(a.value)},populate:function(a){var b=this.options;this.options.items=a||[],this.button.setIcon(b.iconClass),this.button.setSelected(!1),this.down.setSelected(!1)},setValue:function(a){BI.IconComboTrigger.superclass.setValue.apply(this,arguments);var b=this.options,c="";a=BI.isArray(a)?a[0]:a,BI.any(this.options.items,function(b,d){if(a===d.value)return c=d.iconClass,!0})?(this.button.setIcon(c),this.button.setSelected(!0),this.down.setSelected(!0)):(this.button.setIcon(b.iconClass),this.button.setSelected(!1),this.down.setSelected(!1))}}),BI.IconComboTrigger.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.icon_combo_trigger",BI.IconComboTrigger),BI.IconTextValueCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.IconTextValueCombo.superclass._defaultConfig.apply(this,arguments),{baseClass:"bi-icon-text-value-combo",height:30,value:"",el:{}})},_init:function(){BI.IconTextValueCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget(b.el,{type:"bi.select_icon_text_trigger",items:b.items,height:b.height,value:b.value}),this.popup=BI.createWidget({type:"bi.icon_text_value_combo_popup",items:b.items}),this.popup.on(BI.IconTextValueComboPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.textIconCombo.hideView(),a.fireEvent(BI.IconTextValueCombo.EVENT_CHANGE,arguments)}),this.popup.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.textIconCombo=BI.createWidget({type:"bi.combo",element:this,adjustLength:2,el:this.trigger,popup:{el:this.popup,maxHeight:300}}),BI.isKey(b.value)&&this.setValue(b.value)},setValue:function(a){this.textIconCombo.setValue(a)},getValue:function(){return this.textIconCombo.getValue()},populate:function(a){this.options.items=a,this.textIconCombo.populate(a)}}),BI.IconTextValueCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.icon_text_value_combo",BI.IconTextValueCombo),BI.IconTextValueComboPopup=BI.inherit(BI.Pane,{_defaultConfig:function(){return BI.extend(BI.IconTextValueComboPopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-icon-text-icon-popup"})},_init:function(){BI.IconTextValueComboPopup.superclass._init.apply(this,arguments);var a=this.options,b=this;this.popup=BI.createWidget({type:"bi.button_group",items:BI.createItems(a.items,{type:"bi.single_select_icon_text_item",height:30}),chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,layouts:[{type:"bi.vertical"}]}),this.popup.on(BI.Controller.EVENT_CHANGE,function(a,c,d){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.IconTextValueComboPopup.EVENT_CHANGE,c,d)}),BI.createWidget({type:"bi.vertical",element:this,items:[this.popup]})},populate:function(a){BI.IconTextValueComboPopup.superclass.populate.apply(this,arguments),a=BI.createItems(a,{type:"bi.single_select_icon_text_item",height:30}),this.popup.populate(a)},getValue:function(){return this.popup.getValue()},setValue:function(a){this.popup.setValue(a)}}),BI.IconTextValueComboPopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.icon_text_value_combo_popup",BI.IconTextValueComboPopup),BI.StaticCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.StaticCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-static-combo",height:24,text:"",el:{},items:[],chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE})},_init:function(){BI.StaticCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget(b.el,{type:"bi.text_icon_item",cls:"bi-select-text-trigger bi-border pull-down-font",text:b.text,readonly:!0,textLgap:5,height:b.height-2}),this.popup=BI.createWidget({type:"bi.text_value_combo_popup",textAlign:b.textAlign,chooseType:b.chooseType,items:b.items}),this.popup.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE,function(){a.combo.hideView(),a.fireEvent(BI.StaticCombo.EVENT_CHANGE,arguments)}),this.combo=BI.createWidget({type:"bi.combo",element:this,adjustLength:2,el:this.trigger,popup:{el:this.popup}})},populate:function(a){this.combo.populate(a)},setValue:function(a){this.combo.setValue(a)},getValue:function(){return this.combo.getValue()}}),BI.StaticCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.static_combo",BI.StaticCombo),BI.TextValueCheckCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.TextValueCheckCombo.superclass._defaultConfig.apply(this,arguments),{baseClass:"bi-text-value-check-combo",width:100,height:24,chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,value:""})},_init:function(){BI.TextValueCheckCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget({type:"bi.select_text_trigger",items:b.items,height:b.height}),this.popup=BI.createWidget({type:"bi.text_value_check_combo_popup",chooseType:b.chooseType,items:b.items}),this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.textIconCheckCombo.hideView(),a.fireEvent(BI.TextValueCheckCombo.EVENT_CHANGE)}),this.popup.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.textIconCheckCombo=BI.createWidget({type:"bi.combo",element:this,adjustLength:2,el:this.trigger,popup:{el:this.popup,maxHeight:300}}),BI.isKey(b.value)&&this.setValue(b.value)},setTitle:function(a){this.trigger.setTitle(a)},setValue:function(a){this.textIconCheckCombo.setValue(a)},setWarningTitle:function(a){this.trigger.setWarningTitle(a)},getValue:function(){return this.textIconCheckCombo.getValue()},populate:function(a){this.options.items=a,this.textIconCheckCombo.populate(a)}}),BI.TextValueCheckCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.text_value_check_combo",BI.TextValueCheckCombo),BI.SmallTextValueCheckCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this,arguments),{width:100,height:24,chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,text:""})},_init:function(){BI.SmallTextValueCheckCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget({type:"bi.small_select_text_trigger",items:b.items,height:b.height,text:b.text}),this.popup=BI.createWidget({type:"bi.text_value_check_combo_popup",chooseType:b.chooseType,items:b.items}),this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.SmallTextIconCheckCombo.hideView(),a.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE)}),this.popup.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.SmallTextIconCheckCombo=BI.createWidget({type:"bi.combo",element:this,adjustLength:2,el:this.trigger,popup:{el:this.popup,maxHeight:300}})},setValue:function(a){this.SmallTextIconCheckCombo.setValue(a)},getValue:function(){return this.SmallTextIconCheckCombo.getValue()},populate:function(a){this.options.items=a,this.SmallTextIconCheckCombo.populate(a)}}),BI.SmallTextValueCheckCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.small_text_value_check_combo",BI.SmallTextValueCheckCombo),BI.TextValueCheckComboPopup=BI.inherit(BI.Pane,{_defaultConfig:function(){return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-text-icon-popup",chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE})},_init:function(){BI.TextValueCheckComboPopup.superclass._init.apply(this,arguments);var a=this.options,b=this;this.popup=BI.createWidget({type:"bi.button_group",items:this._formatItems(a.items),chooseType:a.chooseType,layouts:[{type:"bi.vertical"}]}),this.popup.on(BI.Controller.EVENT_CHANGE,function(a,c,d){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.TextValueCheckComboPopup.EVENT_CHANGE,c,d)}),BI.createWidget({type:"bi.vertical",element:this,items:[this.popup]})},_formatItems:function(a){return BI.map(a,function(a,b){return BI.extend({type:"bi.icon_text_item",cls:"item-check-font bi-list-item",height:30},b)})},populate:function(a){BI.TextValueCheckComboPopup.superclass.populate.apply(this,arguments),this.popup.populate(this._formatItems(a))},getValue:function(){return this.popup.getValue()},setValue:function(a){this.popup.setValue(a)}}),BI.TextValueCheckComboPopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.text_value_check_combo_popup",BI.TextValueCheckComboPopup),BI.TextValueCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.TextValueCombo.superclass._defaultConfig.apply(this,arguments),{baseClass:"bi-text-value-combo",height:30,chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,value:"",el:{}})},_init:function(){BI.TextValueCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget(b.el,{type:"bi.select_text_trigger",items:b.items,height:b.height}),this.popup=BI.createWidget({type:"bi.text_value_combo_popup",chooseType:b.chooseType,items:b.items}),this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.textIconCombo.hideView(),a.fireEvent(BI.TextValueCombo.EVENT_CHANGE,arguments)}),this.popup.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.textIconCombo=BI.createWidget({type:"bi.combo",element:this,adjustLength:2,el:this.trigger,popup:{el:this.popup,maxHeight:300}}),BI.isKey(b.value)&&this.setValue(b.value)},setValue:function(a){this.textIconCombo.setValue(a)},getValue:function(){return this.textIconCombo.getValue()},populate:function(a){this.options.items=a,this.textIconCombo.populate(a)}}),BI.TextValueCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.text_value_combo",BI.TextValueCombo),BI.SmallTextValueCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SmallTextValueCombo.superclass._defaultConfig.apply(this,arguments),{width:100,height:24,chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,el:{},text:""})},_init:function(){BI.SmallTextValueCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget(b.el,{type:"bi.small_select_text_trigger",items:b.items,height:b.height,text:b.text}),this.popup=BI.createWidget({type:"bi.text_value_combo_popup",chooseType:b.chooseType,items:b.items}),this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.SmallTextValueCombo.hideView(),a.fireEvent(BI.SmallTextValueCombo.EVENT_CHANGE)}),this.popup.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.SmallTextValueCombo=BI.createWidget({type:"bi.combo",element:this,adjustLength:2,el:this.trigger,popup:{el:this.popup,maxHeight:300}})},setValue:function(a){this.SmallTextValueCombo.setValue(a)},getValue:function(){return this.SmallTextValueCombo.getValue()},populate:function(a){this.options.items=a,this.SmallTextValueCombo.populate(a)}}),BI.SmallTextValueCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.small_text_value_combo",BI.SmallTextValueCombo),BI.TextValueComboPopup=BI.inherit(BI.Pane,{_defaultConfig:function(){return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-text-icon-popup",chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE})},_init:function(){BI.TextValueComboPopup.superclass._init.apply(this,arguments);var a=this.options,b=this;this.popup=BI.createWidget({type:"bi.button_group",items:BI.createItems(a.items,{type:"bi.single_select_item",textAlign:a.textAlign,height:30}),chooseType:a.chooseType,layouts:[{type:"bi.vertical"}]}),this.popup.on(BI.Controller.EVENT_CHANGE,function(a,c,d){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE,c,d)}),BI.createWidget({type:"bi.vertical",element:this,items:[this.popup]})},populate:function(a){BI.TextValueComboPopup.superclass.populate.apply(this,arguments),a=BI.createItems(a,{type:"bi.single_select_item",height:30}),this.popup.populate(a)},getValue:function(){return this.popup.getValue()},setValue:function(a){this.popup.setValue(a)}}),BI.TextValueComboPopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.text_value_combo_popup",BI.TextValueComboPopup),BI.TextValueDownListCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.TextValueDownListCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-text-value-down-list-combo",height:30})},_init:function(){BI.TextValueDownListCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this._createValueMap(),this.trigger=BI.createWidget({type:"bi.down_list_select_text_trigger",height:b.height,items:b.items}),this.combo=BI.createWidget({type:"bi.down_list_combo",element:this,chooseType:BI.Selection.Single,adjustLength:2,height:b.height,el:this.trigger,items:BI.deepClone(b.items)}),this.combo.on(BI.DownListCombo.EVENT_CHANGE,function(){a.setValue(a.combo.getValue()[0].value),a.fireEvent(BI.TextValueDownListCombo.EVENT_CHANGE)}),this.combo.on(BI.DownListCombo.EVENT_SON_VALUE_CHANGE,function(){a.setValue(a.combo.getValue()[0].childValue),a.fireEvent(BI.TextValueDownListCombo.EVENT_CHANGE)})},_createValueMap:function(){var a=this;this.valueMap={},BI.each(BI.flatten(this.options.items),function(b,c){BI.has(c,"el")?BI.each(c.children,function(b,d){a.valueMap[d.value]={value:c.el.value,childValue:d.value}}):a.valueMap[c.value]={value:c.value}})},setValue:function(a){a=this.valueMap[a],this.combo.setValue([a]),this.trigger.setValue(a.childValue||a.value)},getValue:function(){var a=this.combo.getValue()[0];return[a.childValue||a.value]},populate:function(a){this.options.items=BI.flatten(a),this.combo.populate(a),this._createValueMap()}}),BI.TextValueDownListCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.text_value_down_list_combo",BI.TextValueDownListCombo),BI.DownListSelectTextTrigger=BI.inherit(BI.Trigger,{_defaultConfig:function(){return BI.extend(BI.DownListSelectTextTrigger.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-down-list-select-text-trigger",height:24,text:""})},_init:function(){BI.DownListSelectTextTrigger.superclass._init.apply(this,arguments);var a=this.options;this.trigger=BI.createWidget({type:"bi.select_text_trigger",element:this,height:a.height,items:this._formatItemArray(a.items),text:a.text})},_formatItemArray:function(){var a=BI.flatten(BI.deepClone(this.options.items)),b=[];return BI.each(a,function(a,c){BI.has(c,"el")?(BI.each(c.children,function(a,b){b.text=c.el.text+"("+b.text+")"}),b=BI.concat(b,c.children)):b.push(c)}),b},setValue:function(a){this.trigger.setValue(a)},populate:function(a){this.trigger.populate(this._formatItemArray(a))}}),BI.shortcut("bi.down_list_select_text_trigger",BI.DownListSelectTextTrigger),BI.ClearEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.ClearEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:"bi-clear-editor",height:24,errorText:"",watermark:"",validationChecker:BI.emptyFn,quitChecker:BI.emptyFn})},_init:function(){BI.ClearEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.editor",height:b.height,watermark:b.watermark,allowBlank:!0,errorText:b.errorText,validationChecker:b.validationChecker,quitChecker:b.quitChecker}),this.clear=BI.createWidget({type:"bi.icon_button",stopEvent:!0,cls:"search-close-h-font"}),this.clear.on(BI.IconButton.EVENT_CHANGE,function(){a.setValue(""),a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.STOPEDIT),a.fireEvent(BI.ClearEditor.EVENT_CLEAR)}),BI.createWidget({element:this,type:"bi.htape",items:[{el:this.editor},{el:this.clear,width:25}]}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_FOCUS,function(){a.fireEvent(BI.ClearEditor.EVENT_FOCUS)}),this.editor.on(BI.Editor.EVENT_BLUR,function(){a.fireEvent(BI.ClearEditor.EVENT_BLUR)}),this.editor.on(BI.Editor.EVENT_CLICK,function(){a.fireEvent(BI.ClearEditor.EVENT_CLICK)}),this.editor.on(BI.Editor.EVENT_CHANGE,function(){a._checkClear(),a.fireEvent(BI.ClearEditor.EVENT_CHANGE)}),this.editor.on(BI.Editor.EVENT_KEY_DOWN,function(b){a.fireEvent(BI.ClearEditor.EVENT_KEY_DOWN,b)}),this.editor.on(BI.Editor.EVENT_SPACE,function(){a.fireEvent(BI.ClearEditor.EVENT_SPACE)}),this.editor.on(BI.Editor.EVENT_BACKSPACE,function(){a.fireEvent(BI.ClearEditor.EVENT_BACKSPACE)}),this.editor.on(BI.Editor.EVENT_VALID,function(){a.fireEvent(BI.ClearEditor.EVENT_VALID)}),this.editor.on(BI.Editor.EVENT_ERROR,function(){a.fireEvent(BI.ClearEditor.EVENT_ERROR)}),this.editor.on(BI.Editor.EVENT_ENTER,function(){a.fireEvent(BI.ClearEditor.EVENT_ENTER)}),this.editor.on(BI.Editor.EVENT_RESTRICT,function(){a.fireEvent(BI.ClearEditor.EVENT_RESTRICT)}),this.editor.on(BI.Editor.EVENT_EMPTY,function(){a._checkClear(),a.fireEvent(BI.ClearEditor.EVENT_EMPTY)}),this.editor.on(BI.Editor.EVENT_REMOVE,function(){a.fireEvent(BI.ClearEditor.EVENT_REMOVE)}),this.editor.on(BI.Editor.EVENT_CONFIRM,function(){a.fireEvent(BI.ClearEditor.EVENT_CONFIRM)}),this.editor.on(BI.Editor.EVENT_START,function(){a.fireEvent(BI.ClearEditor.EVENT_START)}),this.editor.on(BI.Editor.EVENT_PAUSE,function(){a.fireEvent(BI.ClearEditor.EVENT_PAUSE)}),this.editor.on(BI.Editor.EVENT_STOP,function(){a.fireEvent(BI.ClearEditor.EVENT_STOP)}),this.clear.invisible()},_checkClear:function(){this.getValue()?this.clear.visible():this.clear.invisible()},focus:function(){this.editor.focus()},blur:function(){this.editor.blur()},getValue:function(){if(this.isValid()){var a=this.editor.getValue().match(/[\S]+/g);return BI.isNull(a)?"":a[a.length-1]}},setValue:function(a){this.editor.setValue(a),BI.isKey(a)&&this.clear.visible()},isValid:function(){return this.editor.isValid()}}),BI.ClearEditor.EVENT_CHANGE="EVENT_CHANGE",BI.ClearEditor.EVENT_FOCUS="EVENT_FOCUS",BI.ClearEditor.EVENT_BLUR="EVENT_BLUR",BI.ClearEditor.EVENT_CLICK="EVENT_CLICK",BI.ClearEditor.EVENT_KEY_DOWN="EVENT_KEY_DOWN",BI.ClearEditor.EVENT_SPACE="EVENT_SPACE",BI.ClearEditor.EVENT_BACKSPACE="EVENT_BACKSPACE",BI.ClearEditor.EVENT_CLEAR="EVENT_CLEAR",BI.ClearEditor.EVENT_START="EVENT_START",BI.ClearEditor.EVENT_PAUSE="EVENT_PAUSE",BI.ClearEditor.EVENT_STOP="EVENT_STOP",BI.ClearEditor.EVENT_CONFIRM="EVENT_CONFIRM",BI.ClearEditor.EVENT_VALID="EVENT_VALID",BI.ClearEditor.EVENT_ERROR="EVENT_ERROR",BI.ClearEditor.EVENT_ENTER="EVENT_ENTER",BI.ClearEditor.EVENT_RESTRICT="EVENT_RESTRICT",BI.ClearEditor.EVENT_REMOVE="EVENT_REMOVE",BI.ClearEditor.EVENT_EMPTY="EVENT_EMPTY",BI.shortcut("bi.clear_editor",BI.ClearEditor),BI.ShelterEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.ShelterEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-shelter-editor",hgap:4,vgap:2,lgap:0,rgap:0,tgap:0,bgap:0,validationChecker:BI.emptyFn,quitChecker:BI.emptyFn,allowBlank:!0,
watermark:"",errorText:"",height:24,textAlign:"left"})},_init:function(){BI.ShelterEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.editor",height:b.height,hgap:b.hgap,vgap:b.vgap,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,value:b.value,validationChecker:b.validationChecker,quitChecker:b.quitChecker,allowBlank:b.allowBlank,watermark:b.watermark,errorText:b.errorText}),this.text=BI.createWidget({type:"bi.text_button",cls:"shelter-editor-text",title:b.title,warningTitle:b.warningTitle,tipType:b.tipType,textAlign:b.textAlign,height:b.height,hgap:4}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.text,left:0,right:0,top:0,bottom:0}]}),this.text.on(BI.Controller.EVENT_CHANGE,function(){arguments[2]=a,a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.text.on(BI.TextButton.EVENT_CHANGE,function(){a.fireEvent(BI.ShelterEditor.EVENT_CLICK_LABEL)}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_FOCUS,function(){a.fireEvent(BI.ShelterEditor.EVENT_FOCUS,arguments)}),this.editor.on(BI.Editor.EVENT_BLUR,function(){a.fireEvent(BI.ShelterEditor.EVENT_BLUR,arguments)}),this.editor.on(BI.Editor.EVENT_CLICK,function(){a.fireEvent(BI.ShelterEditor.EVENT_CLICK,arguments)}),this.editor.on(BI.Editor.EVENT_CHANGE,function(){a.fireEvent(BI.ShelterEditor.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_KEY_DOWN,function(b){a.fireEvent(BI.ShelterEditor.EVENT_KEY_DOWN,arguments)}),this.editor.on(BI.Editor.EVENT_VALID,function(){a.fireEvent(BI.ShelterEditor.EVENT_VALID,arguments)}),this.editor.on(BI.Editor.EVENT_CONFIRM,function(){a._showHint(),a._checkText(),a.fireEvent(BI.ShelterEditor.EVENT_CONFIRM,arguments)}),this.editor.on(BI.Editor.EVENT_START,function(){a.fireEvent(BI.ShelterEditor.EVENT_START,arguments)}),this.editor.on(BI.Editor.EVENT_PAUSE,function(){a.fireEvent(BI.ShelterEditor.EVENT_PAUSE,arguments)}),this.editor.on(BI.Editor.EVENT_STOP,function(){a.fireEvent(BI.ShelterEditor.EVENT_STOP,arguments)}),this.editor.on(BI.Editor.EVENT_SPACE,function(){a.fireEvent(BI.ShelterEditor.EVENT_SPACE,arguments)}),this.editor.on(BI.Editor.EVENT_ERROR,function(){a._checkText(),a.fireEvent(BI.ShelterEditor.EVENT_ERROR,arguments)}),this.editor.on(BI.Editor.EVENT_ENTER,function(){a.fireEvent(BI.ShelterEditor.EVENT_ENTER,arguments)}),this.editor.on(BI.Editor.EVENT_RESTRICT,function(){a.fireEvent(BI.ShelterEditor.EVENT_RESTRICT,arguments)}),this.editor.on(BI.Editor.EVENT_EMPTY,function(){a.fireEvent(BI.ShelterEditor.EVENT_EMPTY,arguments)}),BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[this.editor]}),this._showHint(),a._checkText()},_checkText:function(){var a=this.options;""===this.editor.getValue()?(this.text.setValue(a.watermark||""),this.text.element.addClass("bi-water-mark")):(this.text.setValue(this.editor.getValue()),this.text.element.removeClass("bi-water-mark"))},_showInput:function(){this.editor.visible(),this.text.invisible()},_showHint:function(){this.editor.invisible(),this.text.visible()},setTitle:function(a){this.text.setTitle(a)},setWarningTitle:function(a){this.text.setWarningTitle(a)},focus:function(){this._showInput(),this.editor.focus()},blur:function(){this.editor.blur(),this._showHint(),this._checkText()},doRedMark:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},isValid:function(){return this.editor.isValid()},setErrorText:function(a){this.editor.setErrorText(a)},getErrorText:function(){return this.editor.getErrorText()},isEditing:function(){return this.editor.isEditing()},getLastValidValue:function(){return this.editor.getLastValidValue()},setTextStyle:function(a){this.text.setStyle(a)},setValue:function(a){this.editor.setValue(a),this._checkText()},getValue:function(){return this.editor.getValue()},getState:function(){return this.text.getValue()},setState:function(a){this._showHint(),this.text.setValue(a)}}),BI.ShelterEditor.EVENT_CHANGE="EVENT_CHANGE",BI.ShelterEditor.EVENT_FOCUS="EVENT_FOCUS",BI.ShelterEditor.EVENT_BLUR="EVENT_BLUR",BI.ShelterEditor.EVENT_CLICK="EVENT_CLICK",BI.ShelterEditor.EVENT_KEY_DOWN="EVENT_KEY_DOWN",BI.ShelterEditor.EVENT_CLICK_LABEL="EVENT_CLICK_LABEL",BI.ShelterEditor.EVENT_START="EVENT_START",BI.ShelterEditor.EVENT_PAUSE="EVENT_PAUSE",BI.ShelterEditor.EVENT_STOP="EVENT_STOP",BI.ShelterEditor.EVENT_CONFIRM="EVENT_CONFIRM",BI.ShelterEditor.EVENT_VALID="EVENT_VALID",BI.ShelterEditor.EVENT_ERROR="EVENT_ERROR",BI.ShelterEditor.EVENT_ENTER="EVENT_ENTER",BI.ShelterEditor.EVENT_RESTRICT="EVENT_RESTRICT",BI.ShelterEditor.EVENT_SPACE="EVENT_SPACE",BI.ShelterEditor.EVENT_EMPTY="EVENT_EMPTY",BI.shortcut("bi.shelter_editor",BI.ShelterEditor),BI.SignInitialEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.SignInitialEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-sign-initial-editor",hgap:4,vgap:2,lgap:0,rgap:0,tgap:0,bgap:0,validationChecker:BI.emptyFn,quitChecker:BI.emptyFn,allowBlank:!0,watermark:"",errorText:"",value:"",text:"",height:24})},_init:function(){BI.SignInitialEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.editor",height:b.height,hgap:b.hgap,vgap:b.vgap,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,value:b.value,validationChecker:b.validationChecker,quitChecker:b.quitChecker,allowBlank:b.allowBlank,watermark:b.watermark,errorText:b.errorText}),this.text=BI.createWidget({type:"bi.text_button",cls:"sign-editor-text",title:b.title,warningTitle:b.warningTitle,tipType:b.tipType,textAlign:"left",height:b.height,hgap:4,handler:function(){a._showInput(),a.editor.focus(),a.editor.selectAll()}}),this.text.on(BI.TextButton.EVENT_CHANGE,function(){BI.nextTick(function(){a.fireEvent(BI.SignInitialEditor.EVENT_CLICK_LABEL)})}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.text,left:0,right:0,top:0,bottom:0}]}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_FOCUS,function(){a.fireEvent(BI.SignInitialEditor.EVENT_FOCUS,arguments)}),this.editor.on(BI.Editor.EVENT_BLUR,function(){a.fireEvent(BI.SignInitialEditor.EVENT_BLUR,arguments)}),this.editor.on(BI.Editor.EVENT_CLICK,function(){a.fireEvent(BI.SignInitialEditor.EVENT_CLICK,arguments)}),this.editor.on(BI.Editor.EVENT_CHANGE,function(){a.fireEvent(BI.SignInitialEditor.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_KEY_DOWN,function(b){a.fireEvent(BI.SignInitialEditor.EVENT_KEY_DOWN,arguments)}),this.editor.on(BI.Editor.EVENT_VALID,function(){a.fireEvent(BI.SignInitialEditor.EVENT_VALID,arguments)}),this.editor.on(BI.Editor.EVENT_CONFIRM,function(){a._showHint(),a._checkText(),a.fireEvent(BI.SignInitialEditor.EVENT_CONFIRM,arguments)}),this.editor.on(BI.Editor.EVENT_START,function(){a.fireEvent(BI.SignInitialEditor.EVENT_START,arguments)}),this.editor.on(BI.Editor.EVENT_PAUSE,function(){a.fireEvent(BI.SignInitialEditor.EVENT_PAUSE,arguments)}),this.editor.on(BI.Editor.EVENT_STOP,function(){a.fireEvent(BI.SignInitialEditor.EVENT_STOP,arguments)}),this.editor.on(BI.Editor.EVENT_SPACE,function(){a.fireEvent(BI.SignInitialEditor.EVENT_SPACE,arguments)}),this.editor.on(BI.Editor.EVENT_ERROR,function(){a._checkText(),a.fireEvent(BI.SignInitialEditor.EVENT_ERROR,arguments)}),this.editor.on(BI.Editor.EVENT_ENTER,function(){a.fireEvent(BI.SignInitialEditor.EVENT_ENTER,arguments)}),this.editor.on(BI.Editor.EVENT_RESTRICT,function(){a.fireEvent(BI.SignInitialEditor.EVENT_RESTRICT,arguments)}),this.editor.on(BI.Editor.EVENT_EMPTY,function(){a.fireEvent(BI.SignInitialEditor.EVENT_EMPTY,arguments)}),BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[this.editor]}),this._showHint(),a._checkText()},_checkText:function(){var a=this.options;BI.nextTick(BI.bind(function(){if(""===this.editor.getValue())this.text.setValue(a.watermark||""),this.text.element.addClass("bi-water-mark");else{var b=this.editor.getValue();b=BI.isEmpty(b)||b==a.text?a.text:b+"("+a.text+")",this.text.setValue(b),this.text.element.removeClass("bi-water-mark")}},this))},_showInput:function(){this.editor.visible(),this.text.invisible()},_showHint:function(){this.editor.invisible(),this.text.visible()},setTitle:function(a){this.text.setTitle(a)},setWarningTitle:function(a){this.text.setWarningTitle(a)},focus:function(){this._showInput(),this.editor.focus()},blur:function(){this.editor.blur(),this._showHint(),this._checkText()},doRedMark:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},isValid:function(){return this.editor.isValid()},setErrorText:function(a){this.editor.setErrorText(a)},getErrorText:function(){return this.editor.getErrorText()},isEditing:function(){return this.editor.isEditing()},getLastValidValue:function(){return this.editor.getLastValidValue()},setValue:function(a){var b=this.options;this.editor.setValue(a.value),b.text=a.text||b.text,this._checkText()},getValue:function(){return{value:this.editor.getValue(),text:this.options.text}},getState:function(){return this.text.getValue()},setState:function(a){var b=this.options;this._showHint(),a=BI.isEmpty(a)||a==b.text?b.text:a+"("+b.text+")",this.text.setValue(a)}}),BI.SignInitialEditor.EVENT_CHANGE="EVENT_CHANGE",BI.SignInitialEditor.EVENT_FOCUS="EVENT_FOCUS",BI.SignInitialEditor.EVENT_BLUR="EVENT_BLUR",BI.SignInitialEditor.EVENT_CLICK="EVENT_CLICK",BI.SignInitialEditor.EVENT_KEY_DOWN="EVENT_KEY_DOWN",BI.SignInitialEditor.EVENT_CLICK_LABEL="EVENT_CLICK_LABEL",BI.SignInitialEditor.EVENT_START="EVENT_START",BI.SignInitialEditor.EVENT_PAUSE="EVENT_PAUSE",BI.SignInitialEditor.EVENT_STOP="EVENT_STOP",BI.SignInitialEditor.EVENT_CONFIRM="EVENT_CONFIRM",BI.SignInitialEditor.EVENT_VALID="EVENT_VALID",BI.SignInitialEditor.EVENT_ERROR="EVENT_ERROR",BI.SignInitialEditor.EVENT_ENTER="EVENT_ENTER",BI.SignInitialEditor.EVENT_RESTRICT="EVENT_RESTRICT",BI.SignInitialEditor.EVENT_SPACE="EVENT_SPACE",BI.SignInitialEditor.EVENT_EMPTY="EVENT_EMPTY",BI.shortcut("bi.sign_initial_editor",BI.SignInitialEditor),BI.SignEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.SignEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-sign-editor",hgap:4,vgap:2,lgap:0,rgap:0,tgap:0,bgap:0,validationChecker:BI.emptyFn,quitChecker:BI.emptyFn,allowBlank:!0,watermark:"",errorText:"",height:24})},_init:function(){BI.SignEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.editor",height:b.height,hgap:b.hgap,vgap:b.vgap,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,value:b.value,validationChecker:b.validationChecker,quitChecker:b.quitChecker,allowBlank:b.allowBlank,watermark:b.watermark,errorText:b.errorText}),this.text=BI.createWidget({type:"bi.text_button",cls:"sign-editor-text",title:b.title,warningTitle:b.warningTitle,tipType:b.tipType,textAlign:"left",height:b.height,hgap:4,handler:function(){a._showInput(),a.editor.focus(),a.editor.selectAll()}}),this.text.on(BI.TextButton.EVENT_CHANGE,function(){BI.nextTick(function(){a.fireEvent(BI.SignEditor.EVENT_CLICK_LABEL)})}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.text,left:0,right:0,top:0,bottom:0}]}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_FOCUS,function(){a.fireEvent(BI.SignEditor.EVENT_FOCUS,arguments)}),this.editor.on(BI.Editor.EVENT_BLUR,function(){a.fireEvent(BI.SignEditor.EVENT_BLUR,arguments)}),this.editor.on(BI.Editor.EVENT_CLICK,function(){a.fireEvent(BI.SignEditor.EVENT_CLICK,arguments)}),this.editor.on(BI.Editor.EVENT_CHANGE,function(){a.fireEvent(BI.SignEditor.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_KEY_DOWN,function(b){a.fireEvent(BI.SignEditor.EVENT_KEY_DOWN,arguments)}),this.editor.on(BI.Editor.EVENT_VALID,function(){a.fireEvent(BI.SignEditor.EVENT_VALID,arguments)}),this.editor.on(BI.Editor.EVENT_CONFIRM,function(){a._showHint(),a._checkText(),a.fireEvent(BI.SignEditor.EVENT_CONFIRM,arguments)}),this.editor.on(BI.Editor.EVENT_START,function(){a.fireEvent(BI.SignEditor.EVENT_START,arguments)}),this.editor.on(BI.Editor.EVENT_PAUSE,function(){a.fireEvent(BI.SignEditor.EVENT_PAUSE,arguments)}),this.editor.on(BI.Editor.EVENT_STOP,function(){a.fireEvent(BI.SignEditor.EVENT_STOP,arguments)}),this.editor.on(BI.Editor.EVENT_SPACE,function(){a.fireEvent(BI.SignEditor.EVENT_SPACE,arguments)}),this.editor.on(BI.Editor.EVENT_ERROR,function(){a._checkText(),a.fireEvent(BI.SignEditor.EVENT_ERROR,arguments)}),this.editor.on(BI.Editor.EVENT_ENTER,function(){a.fireEvent(BI.SignEditor.EVENT_ENTER,arguments)}),this.editor.on(BI.Editor.EVENT_RESTRICT,function(){a.fireEvent(BI.SignEditor.EVENT_RESTRICT,arguments)}),this.editor.on(BI.Editor.EVENT_EMPTY,function(){a.fireEvent(BI.SignEditor.EVENT_EMPTY,arguments)}),BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[this.editor]}),this._showHint(),a._checkText()},_checkText:function(){var a=this.options;BI.nextTick(BI.bind(function(){""===this.editor.getValue()?(this.text.setValue(a.watermark||""),this.text.element.addClass("bi-water-mark")):(this.text.setValue(this.editor.getValue()),this.text.element.removeClass("bi-water-mark"))},this))},_showInput:function(){this.editor.visible(),this.text.invisible()},_showHint:function(){this.editor.invisible(),this.text.visible()},setTitle:function(a){this.text.setTitle(a)},setWarningTitle:function(a){this.text.setWarningTitle(a)},focus:function(){this._showInput(),this.editor.focus()},blur:function(){this.editor.blur(),this._showHint(),this._checkText()},doRedMark:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},isValid:function(){return this.editor.isValid()},setErrorText:function(a){this.editor.setErrorText(a)},getErrorText:function(){return this.editor.getErrorText()},isEditing:function(){return this.editor.isEditing()},getLastValidValue:function(){return this.editor.getLastValidValue()},setValue:function(a){this.editor.setValue(a),this._checkText()},getValue:function(){return this.editor.getValue()},getState:function(){return this.text.getValue()},setState:function(a){this._showHint(),this.text.setValue(a)}}),BI.SignEditor.EVENT_CHANGE="EVENT_CHANGE",BI.SignEditor.EVENT_FOCUS="EVENT_FOCUS",BI.SignEditor.EVENT_BLUR="EVENT_BLUR",BI.SignEditor.EVENT_CLICK="EVENT_CLICK",BI.SignEditor.EVENT_KEY_DOWN="EVENT_KEY_DOWN",BI.SignEditor.EVENT_CLICK_LABEL="EVENT_CLICK_LABEL",BI.SignEditor.EVENT_START="EVENT_START",BI.SignEditor.EVENT_PAUSE="EVENT_PAUSE",BI.SignEditor.EVENT_STOP="EVENT_STOP",BI.SignEditor.EVENT_CONFIRM="EVENT_CONFIRM",BI.SignEditor.EVENT_VALID="EVENT_VALID",BI.SignEditor.EVENT_ERROR="EVENT_ERROR",BI.SignEditor.EVENT_ENTER="EVENT_ENTER",BI.SignEditor.EVENT_RESTRICT="EVENT_RESTRICT",BI.SignEditor.EVENT_SPACE="EVENT_SPACE",BI.SignEditor.EVENT_EMPTY="EVENT_EMPTY",BI.shortcut("bi.sign_editor",BI.SignEditor),BI.StateEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.StateEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-state-editor",hgap:4,vgap:2,lgap:0,rgap:0,tgap:0,bgap:0,validationChecker:BI.emptyFn,quitChecker:BI.emptyFn,allowBlank:!0,watermark:"",errorText:"",height:24})},_init:function(){BI.StateEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.editor",height:b.height,hgap:b.hgap,vgap:b.vgap,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,value:b.value,validationChecker:b.validationChecker,quitChecker:b.quitChecker,allowBlank:b.allowBlank,watermark:b.watermark,errorText:b.errorText}),this.text=BI.createWidget({type:"bi.text_button",cls:"state-editor-infinite-text bi-disabled",textAlign:"left",height:b.height,text:BI.i18nText("BI-Basic_Unrestricted"),hgap:4,handler:function(){a._showInput(),a.editor.focus(),a.editor.setValue("")}}),this.text.on(BI.TextButton.EVENT_CHANGE,function(){BI.nextTick(function(){a.fireEvent(BI.StateEditor.EVENT_CLICK_LABEL)})}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.text,left:0,right:0,top:0,bottom:0}]}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_FOCUS,function(){a.fireEvent(BI.StateEditor.EVENT_FOCUS,arguments)}),this.editor.on(BI.Editor.EVENT_BLUR,function(){a.fireEvent(BI.StateEditor.EVENT_BLUR,arguments)}),this.editor.on(BI.Editor.EVENT_CLICK,function(){a.fireEvent(BI.StateEditor.EVENT_CLICK,arguments)}),this.editor.on(BI.Editor.EVENT_CHANGE,function(){a.fireEvent(BI.StateEditor.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_KEY_DOWN,function(b){a.fireEvent(BI.StateEditor.EVENT_KEY_DOWN,arguments)}),this.editor.on(BI.Editor.EVENT_VALID,function(){a.fireEvent(BI.StateEditor.EVENT_VALID,arguments)}),this.editor.on(BI.Editor.EVENT_CONFIRM,function(){a._showHint(),a.fireEvent(BI.StateEditor.EVENT_CONFIRM,arguments)}),this.editor.on(BI.Editor.EVENT_START,function(){a.fireEvent(BI.StateEditor.EVENT_START,arguments)}),this.editor.on(BI.Editor.EVENT_PAUSE,function(){a.fireEvent(BI.StateEditor.EVENT_PAUSE,arguments)}),this.editor.on(BI.Editor.EVENT_STOP,function(){a.fireEvent(BI.StateEditor.EVENT_STOP,arguments)}),this.editor.on(BI.Editor.EVENT_SPACE,function(){a.fireEvent(BI.StateEditor.EVENT_SPACE,arguments)}),this.editor.on(BI.Editor.EVENT_ERROR,function(){a.fireEvent(BI.StateEditor.EVENT_ERROR,arguments)}),this.editor.on(BI.Editor.EVENT_ENTER,function(){a.fireEvent(BI.StateEditor.EVENT_ENTER,arguments)}),this.editor.on(BI.Editor.EVENT_RESTRICT,function(){a.fireEvent(BI.StateEditor.EVENT_RESTRICT,arguments)}),this.editor.on(BI.Editor.EVENT_EMPTY,function(){a.fireEvent(BI.StateEditor.EVENT_EMPTY,arguments)}),BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[this.editor]}),this._showHint()},doRedMark:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},focus:function(){this.options.disabled===!1&&(this._showInput(),this.editor.focus())},blur:function(){this.editor.blur(),this._showHint()},_showInput:function(){this.editor.visible(),this.text.invisible()},_showHint:function(){this.editor.invisible(),this.text.visible()},isValid:function(){return this.editor.isValid()},setErrorText:function(a){this.editor.setErrorText(a)},getErrorText:function(){return this.editor.getErrorText()},isEditing:function(){return this.editor.isEditing()},getLastValidValue:function(){return this.editor.getLastValidValue()},setValue:function(a){this.editor.setValue(a)},getValue:function(){return this.editor.getValue()},getState:function(){return this.editor.getValue().match(/[^\s]+/g)},setState:function(a){return BI.StateEditor.superclass.setValue.apply(this,arguments),BI.isNumber(a)?void(a===BI.Selection.All?(this.text.setText(BI.i18nText("BI-Select_All")),this.text.setTitle(""),this.text.element.removeClass("state-editor-infinite-text")):a===BI.Selection.Multi?(this.text.setText(BI.i18nText("BI-Select_Part")),this.text.setTitle(""),this.text.element.removeClass("state-editor-infinite-text")):(this.text.setText(BI.i18nText("BI-Basic_Unrestricted")),this.text.setTitle(""),this.text.element.addClass("state-editor-infinite-text"))):BI.isString(a)?(this.text.setText(a),this.text.setTitle(a),void this.text.element.removeClass("state-editor-infinite-text")):void(BI.isArray(a)&&(BI.isEmpty(a)?(this.text.setText(BI.i18nText("BI-Basic_Unrestricted")),this.text.element.addClass("state-editor-infinite-text")):1===a.length?(this.text.setText(a[0]),this.text.setTitle(a[0]),this.text.element.removeClass("state-editor-infinite-text")):(this.text.setText(BI.i18nText("BI-Select_Part")),this.text.setTitle(""),this.text.element.removeClass("state-editor-infinite-text"))))}}),BI.StateEditor.EVENT_CHANGE="EVENT_CHANGE",BI.StateEditor.EVENT_FOCUS="EVENT_FOCUS",BI.StateEditor.EVENT_BLUR="EVENT_BLUR",BI.StateEditor.EVENT_CLICK="EVENT_CLICK",BI.StateEditor.EVENT_KEY_DOWN="EVENT_KEY_DOWN",BI.StateEditor.EVENT_CLICK_LABEL="EVENT_CLICK_LABEL",BI.StateEditor.EVENT_START="EVENT_START",BI.StateEditor.EVENT_PAUSE="EVENT_PAUSE",BI.StateEditor.EVENT_STOP="EVENT_STOP",BI.StateEditor.EVENT_CONFIRM="EVENT_CONFIRM",BI.StateEditor.EVENT_VALID="EVENT_VALID",BI.StateEditor.EVENT_ERROR="EVENT_ERROR",BI.StateEditor.EVENT_ENTER="EVENT_ENTER",BI.StateEditor.EVENT_RESTRICT="EVENT_RESTRICT",BI.StateEditor.EVENT_SPACE="EVENT_SPACE",BI.StateEditor.EVENT_EMPTY="EVENT_EMPTY",BI.shortcut("bi.state_editor",BI.StateEditor),BI.SimpleStateEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.SimpleStateEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-simple-state-editor",hgap:4,vgap:2,lgap:0,rgap:0,tgap:0,bgap:0,validationChecker:BI.emptyFn,quitChecker:BI.emptyFn,mouseOut:!1,allowBlank:!0,watermark:"",errorText:"",height:24})},_init:function(){BI.SimpleStateEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.editor",height:b.height,hgap:b.hgap,vgap:b.vgap,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,value:b.value,validationChecker:b.validationChecker,quitChecker:b.quitChecker,allowBlank:b.allowBlank,watermark:b.watermark,errorText:b.errorText}),this.text=BI.createWidget({type:"bi.text_button",cls:"state-editor-infinite-text bi-disabled",textAlign:"left",height:b.height,text:BI.i18nText("BI-Basic_Unrestricted"),hgap:4,handler:function(){a._showInput(),a.editor.focus(),a.editor.setValue("")}}),this.text.on(BI.TextButton.EVENT_CHANGE,function(){BI.nextTick(function(){a.fireEvent(BI.SimpleStateEditor.EVENT_CLICK_LABEL)})}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.text,left:0,right:0,top:0,bottom:0}]}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_FOCUS,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_FOCUS,arguments)}),this.editor.on(BI.Editor.EVENT_BLUR,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_BLUR,arguments)}),this.editor.on(BI.Editor.EVENT_CLICK,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_CLICK,arguments)}),this.editor.on(BI.Editor.EVENT_CHANGE,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_KEY_DOWN,function(b){a.fireEvent(BI.SimpleStateEditor.EVENT_KEY_DOWN,arguments)}),this.editor.on(BI.Editor.EVENT_VALID,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_VALID,arguments)}),this.editor.on(BI.Editor.EVENT_CONFIRM,function(){a._showHint(),a.fireEvent(BI.SimpleStateEditor.EVENT_CONFIRM,arguments)}),this.editor.on(BI.Editor.EVENT_START,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_START,arguments)}),this.editor.on(BI.Editor.EVENT_PAUSE,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_PAUSE,arguments)}),this.editor.on(BI.Editor.EVENT_STOP,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_STOP,arguments)}),this.editor.on(BI.Editor.EVENT_SPACE,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_SPACE,arguments)}),this.editor.on(BI.Editor.EVENT_ERROR,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_ERROR,arguments)}),this.editor.on(BI.Editor.EVENT_ENTER,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_ENTER,arguments)}),this.editor.on(BI.Editor.EVENT_RESTRICT,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_RESTRICT,arguments)}),this.editor.on(BI.Editor.EVENT_EMPTY,function(){a.fireEvent(BI.SimpleStateEditor.EVENT_EMPTY,arguments)}),BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[this.editor]}),this._showHint()},doRedMark:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},focus:function(){this._showInput(),this.editor.focus()},blur:function(){this.editor.blur(),this._showHint()},_showInput:function(){this.editor.visible(),this.text.invisible()},_showHint:function(){this.editor.invisible(),this.text.visible()},isValid:function(){return this.editor.isValid()},setErrorText:function(a){this.editor.setErrorText(a)},getErrorText:function(){return this.editor.getErrorText()},isEditing:function(){return this.editor.isEditing()},getLastValidValue:function(){return this.editor.getLastValidValue()},setValue:function(a){this.editor.setValue(a)},getValue:function(){return this.editor.getValue()},getState:function(){return this.editor.getValue().match(/[^\s]+/g)},setState:function(a){return BI.SimpleStateEditor.superclass.setValue.apply(this,arguments),BI.isNumber(a)?void(a===BI.Selection.All?(this.text.setText(BI.i18nText("BI-Already_Selected")),this.text.element.removeClass("state-editor-infinite-text")):a===BI.Selection.Multi?(this.text.setText(BI.i18nText("BI-Already_Selected")),this.text.element.removeClass("state-editor-infinite-text")):(this.text.setText(BI.i18nText("BI-Basic_Unrestricted")),this.text.element.addClass("state-editor-infinite-text"))):void(BI.isArray(a)&&1!==a.length?BI.isEmpty(a)?(this.text.setText(BI.i18nText("BI-Basic_Unrestricted")),this.text.element.addClass("state-editor-infinite-text")):(this.text.setText(BI.i18nText("BI-Already_Selected")),this.text.element.removeClass("state-editor-infinite-text")):(this.text.setText(a),this.text.setTitle(a),this.text.element.removeClass("state-editor-infinite-text")))}}),BI.SimpleStateEditor.EVENT_CHANGE="EVENT_CHANGE",BI.SimpleStateEditor.EVENT_FOCUS="EVENT_FOCUS",BI.SimpleStateEditor.EVENT_BLUR="EVENT_BLUR",BI.SimpleStateEditor.EVENT_CLICK="EVENT_CLICK",BI.SimpleStateEditor.EVENT_KEY_DOWN="EVENT_KEY_DOWN",BI.SimpleStateEditor.EVENT_CLICK_LABEL="EVENT_CLICK_LABEL",BI.SimpleStateEditor.EVENT_START="EVENT_START",BI.SimpleStateEditor.EVENT_PAUSE="EVENT_PAUSE",BI.SimpleStateEditor.EVENT_STOP="EVENT_STOP",BI.SimpleStateEditor.EVENT_CONFIRM="EVENT_CONFIRM",BI.SimpleStateEditor.EVENT_VALID="EVENT_VALID",BI.SimpleStateEditor.EVENT_ERROR="EVENT_ERROR",BI.SimpleStateEditor.EVENT_ENTER="EVENT_ENTER",BI.SimpleStateEditor.EVENT_RESTRICT="EVENT_RESTRICT",BI.SimpleStateEditor.EVENT_SPACE="EVENT_SPACE",BI.SimpleStateEditor.EVENT_EMPTY="EVENT_EMPTY",BI.shortcut("bi.simple_state_editor",BI.SimpleStateEditor),BI.BarPopoverSection=BI.inherit(BI.PopoverSection,{_defaultConfig:function(){return BI.extend(BI.BarPopoverSection.superclass._defaultConfig.apply(this,arguments),{btns:[BI.i18nText(BI.i18nText("BI-Basic_Sure")),BI.i18nText(BI.i18nText("BI-Basic_Cancel"))]})},_init:function(){BI.BarPopoverSection.superclass._init.apply(this,arguments)},rebuildSouth:function(a){var b=this,c=this.options;this.sure=BI.createWidget({type:"bi.button",text:this.options.btns[0],warningTitle:c.warningTitle,height:30,value:0,handler:function(a){b.end(),b.close(a)}}),this.cancel=BI.createWidget({type:"bi.button",text:this.options.btns[1],height:30,value:1,level:"ignore",handler:function(a){b.close(a)}}),BI.createWidget({type:"bi.right_vertical_adapt",element:a,lgap:10,items:[this.cancel,this.sure]})},setConfirmButtonEnable:function(a){this.sure.setEnable(!!a)}}),BI.MultiPopupView=BI.inherit(BI.PopupView,{_defaultConfig:function(){var a=BI.MultiPopupView.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-multi-list-view",buttons:[BI.i18nText("BI-Basic_Sure")]})},_init:function(){BI.MultiPopupView.superclass._init.apply(this,arguments)},_createToolBar:function(){var a=this.options,b=this;if(0!==a.buttons.length){var c=[];return BI.each(a.buttons,function(a,b){c.push({text:b,value:a})}),this.buttongroup=BI.createWidget({type:"bi.button_group",cls:"list-view-toolbar bi-high-light bi-border-top",height:30,items:BI.createItems(c,{type:"bi.text_button",once:!1,shadow:!0,isShadowShowingOnSelected:!0}),layouts:[{type:"bi.center",hgap:0,vgap:0}]}),this.buttongroup.on(BI.ButtonGroup.EVENT_CHANGE,function(a,c){b.fireEvent(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON,a,c)}),this.buttongroup}}}),BI.MultiPopupView.EVENT_CHANGE="EVENT_CHANGE",BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON="EVENT_CLICK_TOOLBAR_BUTTON",BI.shortcut("bi.multi_popup_view",BI.MultiPopupView),BI.PopupPanel=BI.inherit(BI.MultiPopupView,{_defaultConfig:function(){var a=BI.PopupPanel.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-popup-panel",title:""})},_init:function(){BI.PopupPanel.superclass._init.apply(this,arguments)},_createTool:function(){var a=this,b=this.options,c=BI.createWidget({type:"bi.icon_button",cls:"close-h-font",width:25,height:25});return c.on(BI.IconButton.EVENT_CHANGE,function(){a.setVisible(!1),a.fireEvent(BI.PopupPanel.EVENT_CLOSE)}),BI.createWidget({type:"bi.htape",cls:"popup-panel-title bi-background bi-border",height:25,items:[{el:{type:"bi.label",textAlign:"left",text:b.title,height:25,lgap:10}},{el:c,width:25}]})}}),BI.PopupPanel.EVENT_CHANGE="EVENT_CHANGE",BI.PopupPanel.EVENT_CLOSE="EVENT_CLOSE",BI.PopupPanel.EVENT_CLICK_TOOLBAR_BUTTON="EVENT_CLICK_TOOLBAR_BUTTON",BI.shortcut("bi.popup_panel",BI.PopupPanel),BI.ListPane=BI.inherit(BI.Pane,{_defaultConfig:function(){var a=BI.ListPane.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-list-pane",logic:{dynamic:!0},lgap:0,rgap:0,tgap:0,bgap:0,vgap:0,hgap:0,items:[],itemsCreator:BI.emptyFn,hasNext:BI.emptyFn,onLoaded:BI.emptyFn,el:{type:"bi.button_group"}})},_init:function(){BI.ListPane.superclass._init.apply(this,arguments);var a=this,b=this.options;this.button_group=BI.createWidget(b.el,{type:"bi.button_group",chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,behaviors:{},items:b.items,itemsCreator:function(c,d){1===c.times&&(a.empty(),BI.nextTick(function(){a.loading()})),b.itemsCreator(c,function(){d.apply(a,arguments),1===c.times&&BI.nextTick(function(){a.loaded()})})},hasNext:b.hasNext,layouts:[{type:"bi.vertical"}]}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.ListPane.EVENT_CHANGE,c,d)}),this.check(),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Top),BI.extend({scrolly:!0,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,vgap:b.vgap,hgap:b.hgap},b.logic,{items:BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Top,this.button_group)}))))},hasPrev:function(){return this.button_group.hasPrev&&this.button_group.hasPrev();
},hasNext:function(){return this.button_group.hasNext&&this.button_group.hasNext()},prependItems:function(a){this.options.items=a.concat(this.options.items),this.button_group.prependItems.apply(this.button_group,arguments),this.check()},addItems:function(a){this.options.items=this.options.items.concat(a),this.button_group.addItems.apply(this.button_group,arguments),this.check()},removeItemAt:function(a){a=a||[],BI.removeAt(this.options.items,a),this.button_group.removeItemAt.apply(this.button_group,arguments),this.check()},populate:function(a){var b=this;this.options;return 0===arguments.length&&BI.isFunction(this.button_group.attr("itemsCreator"))?void this.button_group.attr("itemsCreator").apply(this,[{times:1},function(){if(0===arguments.length)throw new Error("参数不能为空");b.populate.apply(b,arguments)}]):(BI.ListPane.superclass.populate.apply(this,arguments),void this.button_group.populate.apply(this.button_group,arguments))},empty:function(){this.button_group.empty()},setNotSelectedValue:function(){this.button_group.setNotSelectedValue.apply(this.button_group,arguments)},getNotSelectedValue:function(){return this.button_group.getNotSelectedValue()},setValue:function(){this.button_group.setValue.apply(this.button_group,arguments)},getValue:function(){return this.button_group.getValue.apply(this.button_group,arguments)},getAllButtons:function(){return this.button_group.getAllButtons()},getAllLeaves:function(){return this.button_group.getAllLeaves()},getSelectedButtons:function(){return this.button_group.getSelectedButtons()},getNotSelectedButtons:function(){return this.button_group.getNotSelectedButtons()},getIndexByValue:function(a){return this.button_group.getIndexByValue(a)},getNodeById:function(a){return this.button_group.getNodeById(a)},getNodeByValue:function(a){return this.button_group.getNodeByValue(a)}}),BI.ListPane.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.list_pane",BI.ListPane),BI.Panel=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Panel.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-panel bi-border",title:"",titleButtons:[],el:{},logic:{dynamic:!1}})},_init:function(){BI.Panel.superclass._init.apply(this,arguments);var a=this.options;BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("vertical",BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection("top",this._createTitle(),this.options.el)}))))},_createTitle:function(){var a=this,b=this.options;return this.text=BI.createWidget({type:"bi.label",cls:"panel-title-text",text:b.title,height:30}),this.button_group=BI.createWidget({type:"bi.button_group",items:b.titleButtons,layouts:[{type:"bi.center_adapt",lgap:10}]}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.button_group.on(BI.ButtonGroup.EVENT_CHANGE,function(b,c){a.fireEvent(BI.Panel.EVENT_CHANGE,b,c)}),{el:{type:"bi.left_right_vertical_adapt",cls:"panel-title bi-tips bi-border-bottom bi-background",height:30,items:{left:[this.text],right:[this.button_group]},lhgap:10,rhgap:10},height:30}},setTitle:function(a){this.text.setValue(a)}}),BI.Panel.EVENT_CHANGE="Panel.EVENT_CHANGE",BI.shortcut("bi.panel",BI.Panel),BI.SelectList=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SelectList.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-select-list",direction:BI.Direction.Top,logic:{dynamic:!0},items:[],itemsCreator:BI.emptyFn,hasNext:BI.emptyFn,onLoaded:BI.emptyFn,toolbar:{type:"bi.multi_select_bar"},el:{type:"bi.list_pane"}})},_init:function(){BI.SelectList.superclass._init.apply(this,arguments);var a=this,b=this.options;this.toolbar=BI.createWidget(b.toolbar),this.allSelected=!1,this.toolbar.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.allSelected=this.isSelected(),b===BI.Events.CLICK&&(a.setAllSelected(a.allSelected),a.fireEvent(BI.SelectList.EVENT_CHANGE,c,d)),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.list=BI.createWidget(b.el,{type:"bi.list_pane",items:b.items,itemsCreator:function(c,d){1===c.times&&a.toolbar.setVisible(!1),b.itemsCreator(c,function(b){d.apply(a,arguments),1===c.times&&(a.toolbar.setVisible(b&&b.length>0),a.toolbar.setEnable(b&&b.length>0)),a._checkAllSelected()})},onLoaded:b.onLoaded,hasNext:b.hasNext}),this.list.on(BI.Controller.EVENT_CHANGE,function(b,c,d){b===BI.Events.CLICK&&(a._checkAllSelected(),a.fireEvent(BI.SelectList.EVENT_CHANGE,c,d)),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(b.direction),BI.extend({scrolly:!0},b.logic,{items:BI.LogicFactory.createLogicItemsByDirection(b.direction,this.toolbar,this.list)})))),b.items.length<=0&&(this.toolbar.setVisible(!1),this.toolbar.setEnable(!1))},_checkAllSelected:function(){var a=this.list.getValue().length,b=this.getAllLeaves().length-a,c=this.list.hasNext(),d=this.toolbar.isSelected(),e=a>0&&(b>0||!d&&c);e=e||b>0&&c&&d,this.toolbar.setHalfSelected(e),!e&&this.toolbar.setSelected(a>0&&b<=0&&(!c||d))},setAllSelected:function(a){BI.each(this.getAllButtons(),function(b,c){(c.setSelected||c.setAllSelected).apply(c,[a])}),this.allSelected=!!a,this.toolbar.setSelected(a),this.toolbar.setHalfSelected(!1)},setToolBarVisible:function(a){this.toolbar.setVisible(a)},isAllSelected:function(){return this.allSelected},hasPrev:function(){return this.list.hasPrev()},hasNext:function(){return this.list.hasNext()},prependItems:function(a){this.list.prependItems.apply(this.list,arguments)},addItems:function(a){this.list.addItems.apply(this.list,arguments)},setValue:function(a){var b=a.type===BI.ButtonGroup.CHOOSE_TYPE_ALL;this.setAllSelected(b),this.list[b?"setNotSelectedValue":"setValue"](a.value),this._checkAllSelected()},getValue:function(){return this.isAllSelected()===!1?{type:BI.ButtonGroup.CHOOSE_TYPE_MULTI,value:this.list.getValue(),assist:this.list.getNotSelectedValue()}:{type:BI.ButtonGroup.CHOOSE_TYPE_ALL,value:this.list.getNotSelectedValue(),assist:this.list.getValue()}},empty:function(){this.list.empty()},populate:function(a){this.toolbar.setVisible(!BI.isEmptyArray(a)),this.toolbar.setEnable(!BI.isEmptyArray(a)),this.list.populate.apply(this.list,arguments),this._checkAllSelected()},_setEnable:function(a){BI.SelectList.superclass._setEnable.apply(this,arguments),this.toolbar.setEnable(a)},resetHeight:function(a){var b=(this.toolbar.element.outerHeight()||25)*(this.toolbar.isVisible()?1:0);this.list.resetHeight?this.list.resetHeight(a-b):this.list.element.css({"max-height":a-b+"px"})},setNotSelectedValue:function(){this.list.setNotSelectedValue.apply(this.list,arguments),this._checkAllSelected()},getNotSelectedValue:function(){return this.list.getNotSelectedValue()},getAllButtons:function(){return this.list.getAllButtons()},getAllLeaves:function(){return this.list.getAllLeaves()},getSelectedButtons:function(){return this.list.getSelectedButtons()},getNotSelectedButtons:function(){return this.list.getNotSelectedButtons()},getIndexByValue:function(a){return this.list.getIndexByValue(a)},getNodeById:function(a){return this.list.getNodeById(a)},getNodeByValue:function(a){return this.list.getNodeByValue(a)}}),BI.SelectList.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.select_list",BI.SelectList),BI.LazyLoader=BI.inherit(BI.Widget,{_const:{PAGE:100},_defaultConfig:function(){return BI.extend(BI.LazyLoader.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-lazy-loader",el:{}})},_init:function(){var a=this,b=this.options;BI.LazyLoader.superclass._init.apply(this,arguments);var c=b.items.length;this.loader=BI.createWidget({type:"bi.loader",element:this,el:b.el,itemsCreator:function(b,c){c(a._getNextItems(b))},hasNext:function(a){return a.count<c}}),this.loader.on(BI.Loader.EVENT_CHANGE,function(b){a.fireEvent(BI.LazyLoader.EVENT_CHANGE,b)})},_getNextItems:function(a){var b=this.options,c=b.items.length-this._const.PAGE*(a.times-1),d=BI.last(b.items,c),e=BI.first(d,this._const.PAGE);return e},populate:function(a){this.loader.populate(a)},addItems:function(a){this.loader.addItems(a)},empty:function(){this.loader.empty()},setNotSelectedValue:function(){this.loader.setNotSelectedValue.apply(this.loader,arguments)},getNotSelectedValue:function(){return this.loader.getNotSelectedValue()},setValue:function(){this.loader.setValue.apply(this.loader,arguments)},getValue:function(){return this.loader.getValue.apply(this.loader,arguments)},getAllButtons:function(){return this.loader.getAllButtons()},getAllLeaves:function(){return this.loader.getAllLeaves()},getSelectedButtons:function(){return this.loader.getSelectedButtons()},getNotSelectedButtons:function(){return this.loader.getNotSelectedButtons()},getIndexByValue:function(a){return this.loader.getIndexByValue(a)},getNodeById:function(a){return this.loader.getNodeById(a)},getNodeByValue:function(a){return this.loader.getNodeByValue(a)}}),BI.LazyLoader.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.lazy_loader",BI.LazyLoader),BI.ListLoader=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ListLoader.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-list-loader",isDefaultInit:!0,el:{type:"bi.button_group"},items:[],itemsCreator:BI.emptyFn,onLoaded:BI.emptyFn,count:!1,next:{},hasNext:BI.emptyFn})},_nextLoad:function(){var a=this,b=this.options;this.next.setLoading(),b.itemsCreator.apply(this,[{times:++this.times},function(){a.next.setLoaded(),a.addItems.apply(a,arguments)}])},_init:function(){BI.ListLoader.superclass._init.apply(this,arguments);var a=this,b=this.options;b.itemsCreator===!1&&(b.next=!1),this.button_group=BI.createWidget(b.el,{type:"bi.button_group",element:this,chooseType:0,items:b.items,behaviors:{},layouts:[{type:"bi.vertical"}]}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.ListLoader.EVENT_CHANGE,d)}),b.next!==!1&&(this.next=BI.createWidget(BI.extend({type:"bi.loading_bar"},b.next)),this.next.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&a._nextLoad()})),BI.createWidget({type:"bi.vertical",element:this,items:[this.next]}),b.isDefaultInit&&BI.isEmpty(b.items)&&BI.nextTick(BI.bind(function(){this.populate()},this)),BI.isNotEmptyArray(b.items)&&this.populate(b.items)},hasNext:function(){var a=this.options;return BI.isNumber(a.count)?this.count<a.count:!!a.hasNext.apply(this,[{times:this.times,count:this.count}])},addItems:function(a){this.count+=a.length,BI.isObject(this.next)&&(this.hasNext()?(this.options.items=this.options.items.concat(a),this.next.setLoaded()):this.next.setEnd()),this.button_group.addItems.apply(this.button_group,arguments),this.next.element.appendTo(this.element)},populate:function(a){var b=this,c=this.options;return 0===arguments.length&&BI.isFunction(c.itemsCreator)?void c.itemsCreator.apply(this,[{times:1},function(){if(0===arguments.length)throw new Error("参数不能为空");b.populate.apply(b,arguments),c.onLoaded()}]):(this.options.items=a,this.times=1,this.count=0,this.count+=a.length,BI.isObject(this.next)&&(this.hasNext()?this.next.setLoaded():this.next.invisible()),BI.DOM.hang([this.next]),this.button_group.populate.apply(this.button_group,arguments),void this.next.element.appendTo(this.element))},empty:function(){BI.DOM.hang([this.next]),this.button_group.empty(),this.next.element.appendTo(this.element),BI.each([this.next],function(a,b){b&&b.setVisible(!1)})},setNotSelectedValue:function(){this.button_group.setNotSelectedValue.apply(this.button_group,arguments)},getNotSelectedValue:function(){return this.button_group.getNotSelectedValue()},setValue:function(){this.button_group.setValue.apply(this.button_group,arguments)},getValue:function(){return this.button_group.getValue.apply(this.button_group,arguments)},getAllButtons:function(){return this.button_group.getAllButtons()},getAllLeaves:function(){return this.button_group.getAllLeaves()},getSelectedButtons:function(){return this.button_group.getSelectedButtons()},getNotSelectedButtons:function(){return this.button_group.getNotSelectedButtons()},getIndexByValue:function(a){return this.button_group.getIndexByValue(a)},getNodeById:function(a){return this.button_group.getNodeById(a)},getNodeByValue:function(a){return this.button_group.getNodeByValue(a)}}),BI.ListLoader.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.list_loader",BI.ListLoader),BI.SortList=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SortList.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-sort-list",isDefaultInit:!0,el:{type:"bi.button_group"},items:[],itemsCreator:BI.emptyFn,onLoaded:BI.emptyFn,count:!1,next:{},hasNext:BI.emptyFn})},_init:function(){BI.SortList.superclass._init.apply(this,arguments);var a=this,b=this.options;this.loader=BI.createWidget({type:"bi.list_loader",element:this,isDefaultInit:b.isDefaultInit,el:b.el,items:this._formatItems(b.items),itemsCreator:function(c,d){b.itemsCreator(c,function(b){d(a._formatItems(b))})},onLoaded:b.onLoaded,count:b.count,next:b.next,hasNext:b.hasNext}),this.loader.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.SortList.EVENT_CHANGE,c,d)}),this.loader.element.sortable({containment:b.containment||this.element,connectWith:b.connectWith||".bi-sort-list",items:".sort-item",cursor:b.cursor||"drag",tolerance:b.tolerance||"intersect",placeholder:{element:function(a){var b=BI.createWidget({type:"bi.layout",cls:"bi-sortable-holder",height:a.outerHeight()});return b.element.css({"margin-left":a.css("margin-left"),"margin-right":a.css("margin-right"),"margin-top":a.css("margin-top"),"margin-bottom":a.css("margin-bottom"),margin:a.css("margin")}),b.element},update:function(){}},start:function(a,b){},stop:function(b,c){a.fireEvent(BI.SortList.EVENT_CHANGE)},over:function(a,b){}})},_formatItems:function(a){return BI.each(a,function(a,b){b=BI.stripEL(b),b.cls=b.cls?b.cls+" sort-item":"sort-item",b.attributes={sorted:b.value}}),a},hasNext:function(){return this.loader.hasNext()},addItems:function(a){this.loader.addItems(a)},populate:function(a){a&&(arguments[0]=this._formatItems(a)),this.loader.populate.apply(this.loader,arguments)},empty:function(){this.loader.empty()},setNotSelectedValue:function(){this.loader.setNotSelectedValue.apply(this.loader,arguments)},getNotSelectedValue:function(){return this.loader.getNotSelectedValue()},setValue:function(){this.loader.setValue.apply(this.loader,arguments)},getValue:function(){return this.loader.getValue()},getAllButtons:function(){return this.loader.getAllButtons()},getAllLeaves:function(){return this.loader.getAllLeaves()},getSelectedButtons:function(){return this.loader.getSelectedButtons()},getNotSelectedButtons:function(){return this.loader.getNotSelectedButtons()},getIndexByValue:function(a){return this.loader.getIndexByValue(a)},getNodeById:function(a){return this.loader.getNodeById(a)},getNodeByValue:function(a){return this.loader.getNodeByValue(a)},getSortedValues:function(){return this.loader.element.sortable("toArray",{attribute:"sorted"})}}),BI.SortList.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.sort_list",BI.SortList),BI.AllCountPager=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.AllCountPager.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-all-count-pager",height:30,pages:1,curr:1,count:1})},_init:function(){BI.AllCountPager.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.small_text_editor",cls:"pager-editor",validationChecker:function(b){return 0===a.rowCount.getValue()&&"0"===b||BI.isPositiveInteger(b)},hgap:4,vgap:0,value:b.curr,errorText:BI.i18nText("BI-Please_Input_Positive_Integer"),width:35,height:20}),this.pager=BI.createWidget({type:"bi.pager",width:36,layouts:[{type:"bi.horizontal",hgap:1,vgap:1}],dynamicShow:!1,pages:b.pages,curr:b.curr,groups:0,first:!1,last:!1,prev:{type:"bi.icon_button",value:"prev",title:BI.i18nText("BI-Previous_Page"),warningTitle:BI.i18nText("BI-Current_Is_First_Page"),height:20,cls:"all-pager-prev column-pre-page-h-font"},next:{type:"bi.icon_button",value:"next",title:BI.i18nText("BI-Next_Page"),warningTitle:BI.i18nText("BI-Current_Is_Last_Page"),height:20,cls:"all-pager-next column-next-page-h-font"},hasPrev:b.hasPrev,hasNext:b.hasNext,firstPage:b.firstPage,lastPage:b.lastPage}),this.editor.on(BI.TextEditor.EVENT_CONFIRM,function(){a.pager.setValue(BI.parseInt(a.editor.getValue())),a.fireEvent(BI.AllCountPager.EVENT_CHANGE)}),this.pager.on(BI.Pager.EVENT_CHANGE,function(){a.fireEvent(BI.AllCountPager.EVENT_CHANGE)}),this.pager.on(BI.Pager.EVENT_AFTER_POPULATE,function(){a.editor.setValue(a.pager.getCurrentPage())}),this.allPages=BI.createWidget({type:"bi.label",width:30,title:b.pages,text:"/"+b.pages}),this.rowCount=BI.createWidget({type:"bi.label",height:b.height,hgap:5,text:b.count,title:b.count});var c=BI.createWidget({type:"bi.left",height:b.height,scrollable:!1,items:[{type:"bi.label",height:b.height,text:BI.i18nText("BI-Basic_Total"),width:15},this.rowCount,{type:"bi.label",height:b.height,text:BI.i18nText("BI-Tiao_Data"),width:50,textAlign:"left"}]});BI.createWidget({type:"bi.center_adapt",element:this,columnSize:["",35,40,36],items:[c,this.editor,this.allPages,this.pager]})},alwaysShowPager:!0,setAllPages:function(a){this.allPages.setText("/"+a),this.allPages.setTitle(a),this.pager.setAllPages(a),this.editor.setEnable(a>=1)},setValue:function(a){this.pager.setValue(a)},setVPage:function(a){this.pager.setValue(a)},setCount:function(a){this.rowCount.setText(a),this.rowCount.setTitle(a)},getCurrentPage:function(){return this.pager.getCurrentPage()},hasPrev:function(){return this.pager.hasPrev()},hasNext:function(){return this.pager.hasNext()},setPagerVisible:function(a){this.editor.setVisible(a),this.allPages.setVisible(a),this.pager.setVisible(a)},populate:function(){this.pager.populate()}}),BI.AllCountPager.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.all_count_pager",BI.AllCountPager),BI.DirectionPager=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.DirectionPager.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-direction-pager",height:30,horizontal:{pages:!1,curr:1,hasPrev:BI.emptyFn,hasNext:BI.emptyFn,firstPage:1,lastPage:BI.emptyFn},vertical:{pages:!1,curr:1,hasPrev:BI.emptyFn,hasNext:BI.emptyFn,firstPage:1,lastPage:BI.emptyFn}})},_init:function(){BI.DirectionPager.superclass._init.apply(this,arguments);var a=this.options;a.vertical,a.horizontal;this._createVPager(),this._createHPager(),this.layout=BI.createWidget({type:"bi.absolute",scrollable:!1,element:this,items:[{el:this.vpager,top:5,right:74},{el:this.vlabel,top:5,right:111},{el:this.hpager,top:5,right:-9},{el:this.hlabel,top:5,right:28}]})},_createVPager:function(){var a=this,b=this.options,c=b.vertical;this.vlabel=BI.createWidget({type:"bi.label",width:24,height:20,value:c.curr,title:c.curr,invisible:!0}),this.vpager=BI.createWidget({type:"bi.pager",width:76,layouts:[{type:"bi.horizontal",scrollx:!1,rgap:24,vgap:1}],invisible:!0,dynamicShow:!1,pages:c.pages,curr:c.curr,groups:0,first:!1,last:!1,prev:{type:"bi.icon_button",value:"prev",title:BI.i18nText("BI-Up_Page"),warningTitle:BI.i18nText("BI-Current_Is_First_Page"),height:20,iconWidth:16,iconHeight:16,cls:"direction-pager-prev column-pre-page-h-font"},next:{type:"bi.icon_button",value:"next",title:BI.i18nText("BI-Down_Page"),warningTitle:BI.i18nText("BI-Current_Is_Last_Page"),height:20,iconWidth:16,iconHeight:16,cls:"direction-pager-next column-next-page-h-font"},hasPrev:c.hasPrev,hasNext:c.hasNext,firstPage:c.firstPage,lastPage:c.lastPage}),this.vpager.on(BI.Pager.EVENT_CHANGE,function(){a.fireEvent(BI.DirectionPager.EVENT_CHANGE)}),this.vpager.on(BI.Pager.EVENT_AFTER_POPULATE,function(){a.vlabel.setValue(this.getCurrentPage()),a.vlabel.setTitle(this.getCurrentPage())})},_createHPager:function(){var a=this,b=this.options,c=b.horizontal;this.hlabel=BI.createWidget({type:"bi.label",width:24,height:20,value:c.curr,title:c.curr,invisible:!0}),this.hpager=BI.createWidget({type:"bi.pager",width:76,layouts:[{type:"bi.horizontal",scrollx:!1,rgap:24,vgap:1}],invisible:!0,dynamicShow:!1,pages:c.pages,curr:c.curr,groups:0,first:!1,last:!1,prev:{type:"bi.icon_button",value:"prev",title:BI.i18nText("BI-Left_Page"),warningTitle:BI.i18nText("BI-Current_Is_First_Page"),height:20,iconWidth:16,iconHeight:16,cls:"direction-pager-prev row-pre-page-h-font"},next:{type:"bi.icon_button",value:"next",title:BI.i18nText("BI-Right_Page"),warningTitle:BI.i18nText("BI-Current_Is_Last_Page"),height:20,iconWidth:16,iconHeight:16,cls:"direction-pager-next row-next-page-h-font"},hasPrev:c.hasPrev,hasNext:c.hasNext,firstPage:c.firstPage,lastPage:c.lastPage}),this.hpager.on(BI.Pager.EVENT_CHANGE,function(){a.fireEvent(BI.DirectionPager.EVENT_CHANGE)}),this.hpager.on(BI.Pager.EVENT_AFTER_POPULATE,function(){a.hlabel.setValue(this.getCurrentPage()),a.hlabel.setTitle(this.getCurrentPage())})},getVPage:function(){return this.vpager.getCurrentPage()},getHPage:function(){return this.hpager.getCurrentPage()},setVPage:function(a){this.vpager.setValue(a),this.vlabel.setValue(a),this.vlabel.setTitle(a)},setHPage:function(a){this.hpager.setValue(a),this.hlabel.setValue(a),this.hlabel.setTitle(a)},hasVNext:function(){return this.vpager.hasNext()},hasHNext:function(){return this.hpager.hasNext()},hasVPrev:function(){return this.vpager.hasPrev()},hasHPrev:function(){return this.hpager.hasPrev()},setHPagerVisible:function(a){this.hpager.setVisible(a),this.hlabel.setVisible(a)},setVPagerVisible:function(a){this.vpager.setVisible(a),this.vlabel.setVisible(a)},populate:function(){this.vpager.populate(),this.hpager.populate();var a=!1,b=!1;this.hasHNext()||this.hasHPrev()?(this.setHPagerVisible(!0),b=!0):this.setHPagerVisible(!1),this.hasVNext()||this.hasVPrev()?(this.setVPagerVisible(!0),a=!0):this.setVPagerVisible(!1),this.setVisible(b||a);var c=[74,111,-9,28],d=this.layout.attr("items");a===!0&&b===!0?(d[0].right=c[0],d[1].right=c[1],d[2].right=c[2],d[3].right=c[3]):a===!0?(d[0].right=c[2],d[1].right=c[3]):b===!0&&(d[2].right=c[2],d[3].right=c[3]),this.layout.attr("items",d),this.layout.resize()},clear:function(){this.vpager.attr("curr",1),this.hpager.attr("curr",1)}}),BI.DirectionPager.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.direction_pager",BI.DirectionPager),BI.DetailPager=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.DetailPager.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-detail-pager",behaviors:{},layouts:[{type:"bi.horizontal",hgap:10,vgap:0}],dynamicShow:!0,dynamicShowFirstLast:!1,dynamicShowPrevNext:!1,pages:!1,curr:function(){return 1},groups:0,jump:BI.emptyFn,first:!1,last:!1,prev:"上一页",next:"下一页",firstPage:1,lastPage:function(){return 1},hasPrev:BI.emptyFn,hasNext:BI.emptyFn})},_init:function(){BI.DetailPager.superclass._init.apply(this,arguments);var a=this;this.currPage=BI.result(this.options,"curr"),this._lock=!1,this._debouce=BI.debounce(function(){a._lock=!1},300),this._populate()},_populate:function(){var a=this,b=this.options,c=[],d={};this.empty();var e=BI.result(b,"pages"),f=BI.result(this,"currPage"),g=BI.result(b,"groups"),h=BI.result(b,"first"),i=BI.result(b,"last"),j=BI.result(b,"prev"),k=BI.result(b,"next");e===!1?(g=0,h=!1,i=!1):g>e&&(g=e),d.index=Math.ceil((f+(g>1&&g!==e?1:0))/(0===g?1:g)),(!b.dynamicShow&&!b.dynamicShowPrevNext||f>1)&&j!==!1&&(BI.isKey(j)?c.push({text:j,value:"prev",disabled:e===!1?b.hasPrev(f)===!1:!(f>1&&j!==!1)}):c.push(BI.extend({disabled:e===!1?b.hasPrev(f)===!1:!(f>1&&j!==!1)},j))),(!b.dynamicShow&&!b.dynamicShowFirstLast||d.index>1&&0!==g)&&h&&(c.push({text:h,value:"first",disabled:!(d.index>1&&0!==g)}),d.index>1&&0!==g&&c.push({type:"bi.label",cls:"page-ellipsis",text:"…"})),d.poor=Math.floor((g-1)/2),d.start=d.index>1?f-d.poor:1,d.end=d.index>1?function(){var a=f+(g-d.poor-1);return a>e?e:a}():g,d.end-d.start<g-1&&(d.start=d.end-g+1);var l=d.start,m=d.end;for(h&&i&&d.index>1&&0!==g&&e>g&&d.end<e&&0!==g&&(l++,m--);l<=m;l++)l===f?c.push({text:l,value:l,selected:!0}):c.push({text:l,value:l});(!b.dynamicShow&&!b.dynamicShowFirstLast||e>g&&d.end<e&&0!==g)&&i&&(e>g&&d.end<e&&0!==g&&c.push({type:"bi.label",cls:"page-ellipsis",text:"…"}),c.push({text:i,value:"last",disabled:!(e>g&&d.end<e&&0!==g)})),d.flow=!j&&0===g,(!b.dynamicShow&&!b.dynamicShowPrevNext&&k||f!==e&&k||d.flow)&&c.push(function(){return BI.isKey(k)?e===!1?{text:k,value:"next",disabled:b.hasNext(f)===!1}:d.flow&&f===e?{text:k,value:"next",disabled:!0}:{text:k,value:"next",disabled:!(f!==e&&k||d.flow)}:BI.extend({disabled:e===!1?b.hasNext(f)===!1:!(f!==e&&k||d.flow)},k)}()),this.button_group=BI.createWidget({type:"bi.button_group",element:this,items:BI.createItems(c,{cls:"page-item bi-border bi-list-item-active",height:23,hgap:10}),behaviors:b.behaviors,layouts:b.layouts}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(c,d,f){if(a._lock!==!0){if(a._lock=!0,a._debouce(),c===BI.Events.CLICK){var g=a.button_group.getValue()[0];switch(g){case"first":a.currPage=1;break;case"last":a.currPage=e;break;case"prev":a.currPage--;break;case"next":a.currPage++;break;default:a.currPage=g}b.jump.apply(a,[{pages:e,curr:a.currPage}]),a._populate(),a.fireEvent(BI.DetailPager.EVENT_CHANGE,f)}a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}}),this.fireEvent(BI.DetailPager.EVENT_AFTER_POPULATE)},getCurrentPage:function(){return this.currPage},setAllPages:function(a){this.options.pages=a},hasPrev:function(a){a||(a=1);var b=this.options,c=this.options.pages;return c===!1?b.hasPrev(a):a>1},hasNext:function(a){a||(a=1);var b=this.options,c=this.options.pages;return c===!1?b.hasNext(a):a<c},setValue:function(a){var b=this.options;if(a=0|a,a=a<1?1:a,b.pages===!1){var c=BI.result(b,"lastPage"),d=1;this.currPage=a>c?c:(d=BI.result(b,"firstPage"),a<d?d:a)}else a=a>b.pages?b.pages:a,this.currPage=a;this._populate()},getValue:function(){var a=this.button_group.getValue()[0];switch(a){case"prev":return-1;case"next":return 1;case"first":return BI.MIN;case"last":return BI.MAX;default:return a}},attr:function(a,b){BI.DetailPager.superclass.attr.apply(this,arguments),"curr"===a&&(this.currPage=BI.result(this.options,"curr"))},populate:function(){this._populate()}}),BI.DetailPager.EVENT_CHANGE="EVENT_CHANGE",BI.DetailPager.EVENT_AFTER_POPULATE="EVENT_AFTER_POPULATE",BI.shortcut("bi.detail_pager",BI.DetailPager),BI.RichEditorAction=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.RichEditorAction.superclass._defaultConfig.apply(this,arguments),{width:20,height:20,command:""})},_init:function(){BI.RichEditorAction.superclass._init.apply(this,arguments);var a=this,b=this.options;b.editor.on(BI.NicEditor.EVENT_SELECTED,function(b){a.setEnable(!0),a.checkNodes(b.target),a.key(b)}),b.editor.on(BI.NicEditor.EVENT_BLUR,function(){a.setEnable(!1)}),b.editor.on(BI.NicEditor.EVENT_KEYDOWN,BI.bind(this.keydown,this))},checkNodes:function(a){if(!a)return!1;var b=a;do if(this.options.tags&&this.options.tags.contains(b.nodeName))return this.activate(),!0;while(b=b.parentNode&&b.className&&b.className.indexOf("bi-nic-editor")>=-1);for(b=a;3==b.nodeType;)b=b.parentNode;if(this.options.css)for(var c in this.options.css)if($(b).css(c)==this.options.css[c])return this.activate(),!0;return this.deactivate(),!1},start:function(){},key:function(){},keydown:function(){},hideIf:function(a){},activate:function(){},deactivate:function(){},doCommand:function(a){this.options.command&&this.options.editor.nicCommand(this.options.command,a)}}),BI.RichEditorParamAction=BI.inherit(BI.RichEditorAction,{_defaultConfig:function(){return BI.extend(BI.RichEditorParamAction.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.RichEditorParamAction.superclass._init.apply(this,arguments)},_isParam:function(a){return"param"===a.attr("data-type")},_createBlankNode:function(){return $("<span>").html("&nbsp;")},_addBlank:function(a){var b=this.options,c=b.editor.selectedInstance,d=a.next();if(0===d.length||this._isParam(d)){var e=this._createBlankNode(),f=this._createBlankNode();a.before(e),a.after(f),c.setFocus(f[0])}else c.setFocus(d[0])},_get$Sel:function(){var a=this.options,b=a.editor.selectedInstance,c=$(b.selElm());return 3===c[0].nodeType&&this._isParam(c.parent())&&(c=c.parent()),c},addParam:function(a){var b=this.options,c=this._get$Sel(),d=$("<span>").attr({"data-type":"param","data-value":a}).css({color:"white",backgroundColor:"#009de3",padding:"0 5px"}).text(a).keydown(function(a){return a.keyCode!==BI.KeyCode.BACKSPACE&&a.keyCode!==BI.KeyCode.DELETE||d.destroy(),a.stopEvent(),!1}),e=b.editor.instance.getElm().element;e.find(c).length<=0?e.append(d):c.after(d),this._addBlank(d)},keydown:function(a){var b=(this.options,this._get$Sel());return 229===a.keyCode&&this._isParam(b)?(this._addBlank(b),a.stopEvent(),!1):(BI.Key[a.keyCode]||a.keyCode===BI.KeyCode.TAB||a.keyCode===BI.KeyCode.ENTER||a.keyCode===BI.KeyCode.SPACE)&&this._isParam(b)?(a.stopEvent(),!1):a.keyCode!==BI.KeyCode.BACKSPACE&&a.keyCode!==BI.KeyCode.DELETE||!this._isParam(b)?void 0:(b.destroy(),a.preventDefault(),!1)},key:function(a){}}),BI.RichEditorTextToolbar=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-rich-editor-text-toolbar bi-background",buttons:[{type:"bi.rich_editor_size_chooser"},{type:"bi.rich_editor_bold_button"},{type:"bi.rich_editor_italic_button"},{type:"bi.rich_editor_underline_button"},{type:"bi.rich_editor_color_chooser"},{type:"bi.rich_editor_background_color_chooser"},{type:"bi.rich_editor_align_left_button"},{type:"bi.rich_editor_align_center_button"},{type:"bi.rich_editor_align_right_button"},{type:"bi.rich_editor_param_button"}],height:28})},_init:function(){BI.RichEditorTextToolbar.superclass._init.apply(this,arguments);var a=this.options,b=BI.createWidgets(BI.map(a.buttons,function(b,c){return BI.extend(c,{editor:a.editor})}));this.element.mousedown(function(a){BI.each(b,function(b,c){c.hideIf(a)})}),BI.createWidget({type:"bi.left",element:this,items:b,hgap:3,vgap:3})},mounted:function(){var a=this;BI.isIE9Below()&&(this.element.mousedown(function(){a._noSelect(a.element[0])}),this._noSelect(this.element[0]))},_noSelect:function(a){a.setAttribute&&"input"!=a.nodeName.toLowerCase()&&"textarea"!=a.nodeName.toLowerCase()&&a.setAttribute("unselectable","on");for(var b=0;b<a.childNodes.length;b++)this._noSelect(a.childNodes[b])}}),BI.shortcut("bi.rich_editor_text_toolbar",BI.RichEditorTextToolbar),!function(){BI.NicEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.NicEditor.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-nic-editor"})},_init:function(){BI.NicEditor.superclass._init.apply(this,arguments);this.options;$(document).bind("mousedown."+this.getName(),BI.bind(this.selectCheck,this)),BI.createWidget({type:"bi.vertical",element:this,items:[{type:"bi.layout",height:1},this.instance=this.addInstance()]})},addInstance:function(){var a=this.options,c={ne:this,height:a.height-1,maxHeight:a.maxHeight?a.maxHeight:null};if(this.element[0].contentEditable||window.opera)var d=new b(c);else console.error("不支持此浏览器");return d},nicCommand:function(a,b){this.selectedInstance&&this.selectedInstance.nicCommand(a,b)},selectCheck:function(b){var c=b.target;do if("svg"!==c.nodeName&&c.className&&c.className.indexOf(a)!=-1)return;while(c=c.parentNode);this.fireEvent("blur",c),this.lastSelectedInstance=this.selectedInstance,this.selectedInstance=null},setValue:function(a){this.instance.setContent(a)},getValue:function(){return this.instance.getContent()},destroyed:function(){$(document).unbind("mousedown."+this.getName())}}),BI.NicEditor.EVENT_SELECTED="selected",BI.NicEditor.EVENT_BLUR="blur",BI.NicEditor.EVENT_KEYDOWN="keydown",BI.shortcut("bi.nic_editor",BI.NicEditor);var a="niceditor-",b=BI.inherit(BI.Layout,{
isSelected:!1,_init:function(){b.superclass._init.apply(this,arguments);var a=this.options;this.ne=this.options.ne,this.elm=BI.createWidget({type:"bi.layout",width:a.width-8,scrollable:!1}),this.elm.element.css({margin:"4px",minHeight:a.height-8+"px",outline:"none"}).html(a.value),this.element.css("maxHeight",a.maxHeight?a.maxHeight+"px":null),this.e=BI.createWidget({type:"bi.layout",invisible:!0,tagName:"textarea"}),BI.createWidget({type:"bi.default",element:this,scrolly:!0,items:[this.elm,this.e]}),this.ne.on("blur",BI.bind(this.blur,this)),this.start(),this.blur()},start:function(){this.elm.element.attr("contentEditable",!0),""==this.getContent(),this.instanceDoc=document.defaultView,this.elm.element.on("mousedown",BI.bind(this.selected,this)),this.elm.element.on("keydown",BI.bind(this.keyDown,this)),this.elm.element.on("focus",BI.bind(this.selected,this)),this.elm.element.on("blur",BI.bind(this.blur,this)),this.elm.element.on("keyup",BI.bind(this.selected,this)),this.ne.fireEvent("add")},disable:function(){this.elm.element.attr("contentEditable",!1)},getSel:function(){return window.getSelection?window.getSelection():document.selection},getRng:function(){var a=this.getSel();if(a&&0!==a.rangeCount)return a.rangeCount>0?a.getRangeAt(0):a.createRange()},selRng:function(a,b){window.getSelection?(b.removeAllRanges(),b.addRange(a)):a.select()},selElm:function(){var a=this.getRng();if(a){if(a.startContainer){var b=a.startContainer;if(1==a.cloneContents().childNodes.length)for(var c=0;c<b.childNodes.length;c++){var d=b.childNodes[c].ownerDocument.createRange();if(d.selectNode(b.childNodes[c]),1!=a.compareBoundaryPoints(Range.START_TO_START,d)&&a.compareBoundaryPoints(Range.END_TO_END,d)!=-1)return b.childNodes[c]}return b}return"Control"==this.getSel().type?a.item(0):a.parentElement()}},saveRng:function(){this.savedRange=this.getRng(),this.savedSel=this.getSel()},setFocus:function(a){try{a.focus()}catch(b){}if(window.getSelection){var c=document.createRange();c.selectNodeContents(a),c.collapse(!1);var d=window.getSelection();d.removeAllRanges(),d.addRange(c)}else{var e;try{a.focus()}catch(b){}e=document.selection.createRange(),e.moveStart("character",-a.innerText.length);for(var f=e.text,g=0;g<a.innerText.length;g++)a.innerText.substring(0,g+1)==f.substring(f.length-g-1,f.length)&&(result=g+1)}},restoreRng:function(){this.savedRange&&this.selRng(this.savedRange,this.savedSel)},keyDown:function(a,b){this.ne.fireEvent("keydown",a)},selected:function(b){var c=b.target;if(c||(c=this.selElm())||(c=this.selElm()),!b.ctrlKey){var d=this.ne.selectedInstance;d!=this&&(d&&this.ne.fireEvent("blur",b),this.ne.selectedInstance=this,this.ne.fireEvent("focus",b)),this.ne.fireEvent("selected",b),this.isFocused=!0,this.elm.element.addClass(a+"selected")}},blur:function(){this.isFocused=!1,this.elm.element.removeClass(a+"selected")},saveContent:function(){this.ne.fireEvent("save"),this.e.element.value(this.getContent())},getElm:function(){return this.elm},getContent:function(){return this.content=this.getElm().element.html(),this.ne.fireEvent("get"),this.content},setContent:function(a){this.content=a,this.ne.fireEvent("set"),this.elm.element.html(this.content)},nicCommand:function(a,b){document.execCommand(a,!1,b)}})}(),BI.RichEditorBackgroundChooserTrigger=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.RichEditorBackgroundChooserTrigger.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{width:20,height:20})},_init:function(){BI.RichEditorBackgroundChooserTrigger.superclass._init.apply(this,arguments),this.font=BI.createWidget({type:"bi.icon_button",cls:"text-background-font"}),this.underline=BI.createWidget({type:"bi.icon_button",cls:"text-color-underline-font"}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.font,top:2,left:2},{el:this.underline,top:7,left:2}]})},setValue:function(a){this.underline.element.css("color",a)},getValue:function(){return this.font.element.css("color")}}),BI.shortcut("bi.rich_editor_background_color_chooser_trigger",BI.RichEditorBackgroundChooserTrigger),BI.RichEditorAlignCenterButton=BI.inherit(BI.RichEditorAction,{_defaultConfig:function(){return BI.extend(BI.RichEditorAlignCenterButton.superclass._defaultConfig.apply(this,arguments),{width:20,height:20,command:"justifycenter"})},_init:function(){BI.RichEditorAlignCenterButton.superclass._init.apply(this,arguments);var a=this;this.options;this.align=BI.createWidget({type:"bi.icon_button",element:this,forceNotSelected:!0,title:BI.i18nText("BI-Word_Align_Center"),height:20,width:20,cls:"text-toolbar-button bi-list-item-active text-align-center-font"}),this.align.on(BI.IconButton.EVENT_CHANGE,function(){a.doCommand()})},activate:function(){},deactivate:function(){}}),BI.shortcut("bi.rich_editor_align_center_button",BI.RichEditorAlignCenterButton),BI.RichEditorAlignLeftButton=BI.inherit(BI.RichEditorAction,{_defaultConfig:function(){return BI.extend(BI.RichEditorAlignLeftButton.superclass._defaultConfig.apply(this,arguments),{width:20,height:20,command:"justifyleft"})},_init:function(){BI.RichEditorAlignLeftButton.superclass._init.apply(this,arguments);var a=this;this.options;this.align=BI.createWidget({type:"bi.icon_button",element:this,forceNotSelected:!0,title:BI.i18nText("BI-Word_Align_Left"),height:20,width:20,cls:"text-toolbar-button bi-list-item-active text-align-left-font"}),this.align.on(BI.IconButton.EVENT_CHANGE,function(){a.doCommand()})},activate:function(){},deactivate:function(){}}),BI.shortcut("bi.rich_editor_align_left_button",BI.RichEditorAlignLeftButton),BI.RichEditorAlignRightButton=BI.inherit(BI.RichEditorAction,{_defaultConfig:function(){return BI.extend(BI.RichEditorAlignRightButton.superclass._defaultConfig.apply(this,arguments),{width:20,height:20,command:"justifyright"})},_init:function(){BI.RichEditorAlignRightButton.superclass._init.apply(this,arguments);var a=this;this.options;this.align=BI.createWidget({type:"bi.icon_button",element:this,forceNotSelected:!0,title:BI.i18nText("BI-Word_Align_Right"),height:20,width:20,cls:"text-toolbar-button bi-list-item-active text-align-right-font"}),this.align.on(BI.IconButton.EVENT_CHANGE,function(){a.doCommand()})},activate:function(){},deactivate:function(){}}),BI.shortcut("bi.rich_editor_align_right_button",BI.RichEditorAlignRightButton),BI.RichEditorBoldButton=BI.inherit(BI.RichEditorAction,{_defaultConfig:function(){return BI.extend(BI.RichEditorBoldButton.superclass._defaultConfig.apply(this,arguments),{width:20,height:20,command:"Bold",tags:["B","STRONG"],css:{fontWeight:"bold"}})},_init:function(){BI.RichEditorBoldButton.superclass._init.apply(this,arguments);var a=this;this.options;this.bold=BI.createWidget({type:"bi.icon_button",element:this,title:BI.i18nText("BI-Basic_Bold"),height:20,width:20,cls:"text-toolbar-button bi-list-item-active text-bold-font"}),this.bold.on(BI.IconButton.EVENT_CHANGE,function(){a.doCommand()})},activate:function(){this.bold.setSelected(!0)},deactivate:function(){this.bold.setSelected(!1)}}),BI.shortcut("bi.rich_editor_bold_button",BI.RichEditorBoldButton),BI.RichEditorItalicButton=BI.inherit(BI.RichEditorAction,{_defaultConfig:function(){return BI.extend(BI.RichEditorItalicButton.superclass._defaultConfig.apply(this,arguments),{width:20,height:20,command:"Italic",tags:["EM","I"],css:{fontStyle:"italic"}})},_init:function(){BI.RichEditorItalicButton.superclass._init.apply(this,arguments);var a=this;this.options;this.italic=BI.createWidget({type:"bi.icon_button",element:this,title:BI.i18nText("BI-Basic_Italic"),height:20,width:20,cls:"text-toolbar-button bi-list-item-active text-italic-font"}),this.italic.on(BI.IconButton.EVENT_CHANGE,function(){a.doCommand()})},activate:function(){this.italic.setSelected(!0)},deactivate:function(){this.italic.setSelected(!1)}}),BI.shortcut("bi.rich_editor_italic_button",BI.RichEditorItalicButton),BI.RichEditorParamButton=BI.inherit(BI.RichEditorParamAction,{_defaultConfig:function(){return BI.extend(BI.RichEditorParamButton.superclass._defaultConfig.apply(this,arguments),{width:20,height:20})},_init:function(){BI.RichEditorParamButton.superclass._init.apply(this,arguments);var a=this;this.options;this.param=BI.createWidget({type:"bi.button",element:this,level:"ignore",minWidth:0,text:BI.i18nText("BI-Formula_Insert"),height:20,width:30}),this.param.on(BI.Button.EVENT_CHANGE,function(){a.addParam("参数")})},activate:function(){},deactivate:function(){}}),BI.shortcut("bi.rich_editor_param_button",BI.RichEditorParamButton),BI.RichEditorUnderlineButton=BI.inherit(BI.RichEditorAction,{_defaultConfig:function(){return BI.extend(BI.RichEditorUnderlineButton.superclass._defaultConfig.apply(this,arguments),{width:20,height:20,command:"Underline",tags:["U"],css:{textDecoration:"underline"}})},_init:function(){BI.RichEditorUnderlineButton.superclass._init.apply(this,arguments);var a=this;this.options;this.underline=BI.createWidget({type:"bi.icon_button",element:this,title:BI.i18nText("BI-Basic_Underline"),height:20,width:20,cls:"text-toolbar-button bi-list-item-active text-underline-font"}),this.underline.on(BI.IconButton.EVENT_CHANGE,function(){a.doCommand()})},activate:function(){this.underline.setSelected(!0)},deactivate:function(){this.underline.setSelected(!1)}}),BI.shortcut("bi.rich_editor_underline_button",BI.RichEditorUnderlineButton),BI.RichEditorColorChooserTrigger=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.RichEditorColorChooserTrigger.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{width:20,height:20})},_init:function(){BI.RichEditorColorChooserTrigger.superclass._init.apply(this,arguments),this.font=BI.createWidget({type:"bi.icon_button",cls:"text-color-font"}),this.underline=BI.createWidget({type:"bi.icon_button",cls:"text-color-underline-font"}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.font,top:2,left:2},{el:this.underline,top:7,left:2}]})},setValue:function(a){this.underline.element.css("color",a)},getValue:function(){return this.font.element.css("color")}}),BI.shortcut("bi.rich_editor_color_chooser_trigger",BI.RichEditorColorChooserTrigger),BI.RichEditorBackgroundColorChooser=BI.inherit(BI.RichEditorAction,{_defaultConfig:function(){return BI.extend(BI.RichEditorBackgroundColorChooser.superclass._defaultConfig.apply(this,arguments),{width:20,height:20})},_init:function(){BI.RichEditorBackgroundColorChooser.superclass._init.apply(this,arguments);var a=this.options;this.colorchooser=BI.createWidget({type:"bi.color_chooser",element:this,width:a.width,height:a.height,el:{type:"bi.rich_editor_background_color_chooser_trigger",title:BI.i18nText("BI-Widget_Background_Colour"),cls:"text-toolbar-button"}}),this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE,function(){var b=this.getValue();a.editor.element.css({backgroundColor:b,color:BI.DOM.getContrastColor(b)}),this.setValue("")})},hideIf:function(a){!this.colorchooser.element.find(a.target).length>0&&this.colorchooser.hideView()},deactivate:function(){}}),BI.shortcut("bi.rich_editor_background_color_chooser",BI.RichEditorBackgroundColorChooser),BI.RichEditorColorChooser=BI.inherit(BI.RichEditorAction,{_defaultConfig:function(){return BI.extend(BI.RichEditorColorChooser.superclass._defaultConfig.apply(this,arguments),{width:20,height:20,command:"foreColor"})},_init:function(){BI.RichEditorColorChooser.superclass._init.apply(this,arguments);var a=this,b=this.options;this.colorchooser=BI.createWidget({type:"bi.color_chooser",element:this,width:b.width,height:b.height,el:{type:"bi.rich_editor_color_chooser_trigger",title:BI.i18nText("BI-Font_Colour"),cls:"text-toolbar-button"}}),this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE,function(){a.doCommand(this.getValue())})},hideIf:function(a){!this.colorchooser.element.find(a.target).length>0&&this.colorchooser.hideView()},deactivate:function(){this.colorchooser.setValue("")}}),BI.shortcut("bi.rich_editor_color_chooser",BI.RichEditorColorChooser),BI.RichEditorSizeChooser=BI.inherit(BI.RichEditorAction,{_defaultConfig:function(){return BI.extend(BI.RichEditorSizeChooser.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-rich-editor-size-chooser bi-border bi-card",command:"FontSize",width:50,height:20})},_items:[{value:1,text:"1(8pt)"},{value:2,text:"2(10pt)"},{value:3,text:"3(12pt)"},{value:4,text:"4(14pt)"},{value:5,text:"5(18pt)"},{value:6,text:"6(24pt)"}],_init:function(){BI.RichEditorSizeChooser.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget({type:"bi.text_trigger",readonly:!0,height:b.height,triggerWidth:16,text:BI.i18nText("BI-Font_Size")}),this.combo=BI.createWidget({type:"bi.combo",element:this,el:this.trigger,adjustLength:1,popup:{maxWidth:70,minWidth:70,el:{type:"bi.button_group",items:BI.createItems(this._items,{type:"bi.single_select_item"}),layouts:[{type:"bi.vertical"}]}}}),this.combo.on(BI.Combo.EVENT_CHANGE,function(){var b=this.getValue()[0];a.doCommand(b),this.hideView(),this.setValue([])})},hideIf:function(a){!this.combo.element.find(a.target).length>0&&this.combo.hideView()}}),BI.shortcut("bi.rich_editor_size_chooser",BI.RichEditorSizeChooser),BI.RichEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.RichEditor.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-rich-editor bi-card",toolbar:{}})},_init:function(){BI.RichEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.nic_editor",width:b.width,height:b.height}),this.editor.on(BI.NicEditor.EVENT_BLUR,function(){a.fireEvent(BI.RichEditor.EVENT_CONFIRM)}),this.combo=BI.createWidget({type:"bi.combo",element:this,toggle:!1,direction:"top,left",isNeedAdjustWidth:!1,isNeedAdjustHeight:!1,adjustLength:1,el:this.editor,popup:{el:BI.extend({type:"bi.rich_editor_text_toolbar",editor:this.editor},b.toolbar),height:30,stopPropagation:!0,stopEvent:!0}}),this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW,function(){})},setValue:function(a){this.editor.setValue(a)},getValue:function(){return this.editor.getValue()}}),BI.RichEditor.EVENT_CONFIRM="EVENT_CONFIRM",BI.shortcut("bi.rich_editor",BI.RichEditor),BI.SegmentButton=BI.inherit(BI.BasicButton,{_defaultConfig:function(){var a=BI.SegmentButton.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-segment-button bi-list-item-active",shadow:!0,readonly:!0,hgap:5})},_init:function(){BI.SegmentButton.superclass._init.apply(this,arguments);var a=this.options;this.text=BI.createWidget({type:"bi.label",element:this,height:a.height-2,whiteSpace:a.whiteSpace,text:a.text,value:a.value,hgap:a.hgap})},setSelected:function(){BI.SegmentButton.superclass.setSelected.apply(this,arguments)},setText:function(a){BI.SegmentButton.superclass.setText.apply(this,arguments),this.text.setText(a)},destroy:function(){BI.SegmentButton.superclass.destroy.apply(this,arguments)}}),BI.shortcut("bi.segment_button",BI.SegmentButton),BI.Segment=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Segment.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-segment",items:[],height:24})},_init:function(){BI.Segment.superclass._init.apply(this,arguments);var a=this,b=this.options;this.buttonGroup=BI.createWidget({element:this,type:"bi.button_group",items:BI.createItems(b.items,{type:"bi.segment_button",height:b.height-2,whiteSpace:b.whiteSpace}),layout:[{type:"bi.center"}]}),this.buttonGroup.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.buttonGroup.on(BI.ButtonGroup.EVENT_CHANGE,function(b,c){a.fireEvent(BI.Segment.EVENT_CHANGE,b,c)})},setValue:function(a){this.buttonGroup.setValue(a)},setEnabledValue:function(a){this.buttonGroup.setEnabledValue(a)},getValue:function(){return this.buttonGroup.getValue()}}),BI.Segment.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.segment",BI.Segment),BI.AdaptiveTable=BI.inherit(BI.Widget,{_const:{perColumnSize:100},_defaultConfig:function(){return BI.extend(BI.AdaptiveTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-adaptive-table",el:{type:"bi.resizable_table"},isNeedResize:!0,isNeedFreeze:!1,freezeCols:[],isNeedMerge:!1,mergeCols:[],mergeRule:BI.emptyFn,columnSize:[],minColumnSize:[],maxColumnSize:[],headerRowSize:25,rowSize:25,regionColumnSize:[],header:[],items:[],crossHeader:[],crossItems:[]})},_init:function(){BI.AdaptiveTable.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._digest();this.table=BI.createWidget(b.el,{type:"bi.resizable_table",element:this,width:b.width,height:b.height,isNeedResize:b.isNeedResize,isResizeAdapt:!1,isNeedFreeze:b.isNeedFreeze,freezeCols:c.freezeCols,isNeedMerge:b.isNeedMerge,mergeCols:b.mergeCols,mergeRule:b.mergeRule,columnSize:c.columnSize,headerRowSize:b.headerRowSize,rowSize:b.rowSize,regionColumnSize:c.regionColumnSize,header:b.header,items:b.items,crossHeader:b.crossHeader,crossItems:b.crossItems}),this.table.on(BI.Table.EVENT_TABLE_SCROLL,function(){a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,function(){b.regionColumnSize=this.getRegionColumnSize(),a._populate(),a.table.populate(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,function(){b.columnSize=this.getColumnSize(),a._populate(),a.table.populate(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,arguments)})},_getFreezeColLength:function(){var a=this.options;return a.isNeedFreeze===!0?BI.clamp(a.freezeCols.length,0,a.columnSize.length):0},_digest:function(){var a=this.options,b=a.columnSize.slice(),c=a.regionColumnSize.slice(),d=a.freezeCols.slice(),e=a.regionColumnSize[0],f=this._getFreezeColLength();(!e||e>a.width-10||e<10)&&(e=(f>a.columnSize.length/2?2/3:1/3)*a.width),0===f&&(e=0),d.length>=b.length&&(d=[]),BI.isNumber(b[0])||(b=a.minColumnSize.slice());var g=0,h=0;return BI.each(b,function(a,b){a<f&&(g+=b),h+=b}),f>0&&(b[f-1]=BI.clamp(e-(g-b[f-1]),a.minColumnSize[f-1]||10,a.maxColumnSize[f-1]||Number.MAX_VALUE)),b.length>0&&(b[b.length-1]=BI.clamp(a.width-BI.GridTableScrollbar.SIZE-e-(h-g-b[b.length-1]),a.minColumnSize[b.length-1]||10,a.maxColumnSize[b.length-1]||Number.MAX_VALUE)),c[0]=e,{freezeCols:d,columnSize:b,regionColumnSize:c}},_populate:function(){var a=this.options,b=this._digest();a.regionColumnSize=b.regionColumnSize,a.columnSize=b.columnSize,this.table.setColumnSize(b.columnSize),this.table.setRegionColumnSize(b.regionColumnSize),this.table.attr("freezeCols",b.freezeCols)},setWidth:function(a){BI.AdaptiveTable.superclass.setWidth.apply(this,arguments),this.table.setWidth(a)},setHeight:function(a){BI.AdaptiveTable.superclass.setHeight.apply(this,arguments),this.table.setHeight(a)},setColumnSize:function(a){this.options.columnSize=a},getColumnSize:function(){return this.table.getColumnSize()},setRegionColumnSize:function(a){this.options.regionColumnSize=a},getRegionColumnSize:function(){return this.table.getRegionColumnSize()},setVerticalScroll:function(a){this.table.setVerticalScroll(a)},setLeftHorizontalScroll:function(a){this.table.setLeftHorizontalScroll(a)},setRightHorizontalScroll:function(a){this.table.setRightHorizontalScroll(a)},getVerticalScroll:function(){return this.table.getVerticalScroll()},getLeftHorizontalScroll:function(){return this.table.getLeftHorizontalScroll()},getRightHorizontalScroll:function(){return this.table.getRightHorizontalScroll()},attr:function(a,b){var c=BI.AdaptiveTable.superclass.attr.apply(this,arguments);return"freezeCols"===a?c:this.table.attr.apply(this.table,arguments)},restore:function(){this.table.restore()},populate:function(a){this.options;this._populate(),this.table.populate.apply(this.table,arguments)},destroy:function(){this.table.destroy(),BI.AdaptiveTable.superclass.destroy.apply(this,arguments)}}),BI.shortcut("bi.adaptive_table",BI.AdaptiveTable),BI.DynamicSummaryLayerTreeTable=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.DynamicSummaryLayerTreeTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-dynamic-summary-layer-tree-table",el:{type:"bi.resizable_table"},isNeedResize:!0,isResizeAdapt:!0,isNeedFreeze:!1,freezeCols:[],isNeedMerge:!0,mergeCols:[],mergeRule:BI.emptyFn,columnSize:[],minColumnSize:[],maxColumnSize:[],headerRowSize:25,footerRowSize:25,rowSize:25,regionColumnSize:[],rowHeaderCreator:null,headerCellStyleGetter:BI.emptyFn,summaryCellStyleGetter:BI.emptyFn,sequenceCellStyleGetter:BI.emptyFn,header:[],footer:!1,items:[],crossHeader:[],crossItems:[]})},_getVDeep:function(){return this.options.crossHeader.length},_getHDeep:function(){var a=this.options;return Math.max(a.mergeCols.length,a.freezeCols.length,BI.TableTree.maxDeep(a.items)-1)},_createHeader:function(a){var b=this.options,c=b.header||[],d=b.crossHeader||[],e=BI.TableTree.formatCrossItems(b.crossItems,a,b.headerCellStyleGetter),f=[];if(BI.each(e,function(a,b){var c=[d[a]];f.push(c.concat(b||[]))}),c&&c.length>0){var g=this._formatColumns(c),h=this._getHDeep();h<=0?g.unshift(b.rowHeaderCreator||{type:"bi.table_style_cell",text:BI.i18nText("BI-Row_Header"),styleGetter:b.headerCellStyleGetter}):g[0]=b.rowHeaderCreator||{type:"bi.table_style_cell",text:BI.i18nText("BI-Row_Header"),styleGetter:b.headerCellStyleGetter},f.push(g)}return f},_formatItems:function(a,b,c){function d(a,b){a.type||(a.type="bi.layer_tree_table_cell"),a.layer=b;var c=[a];c=c.concat(a.values||[]),c.length>0&&f.push(c),BI.isNotEmptyArray(a.children)&&BI.each(a.children,function(a,c){d(c,b+1)})}var e=this.options,f=[];return BI.each(a,function(a,b){if(BI.each(b.children,function(a,b){d(b,0)}),BI.isArray(b.values)){var c=[{type:"bi.table_style_cell",text:BI.i18nText("BI-Summary_Values"),styleGetter:function(){return e.summaryCellStyleGetter(!0)}}].concat(b.values);f.push(c)}}),BI.DynamicSummaryTreeTable.formatSummaryItems(f,b,e.crossItems,1)},_formatColumns:function(a,b){return BI.isNotEmptyArray(a)?(b=b||this._getHDeep(),a.slice(Math.max(0,b-1))):a},_formatFreezeCols:function(){return this.options.freezeCols.length>0?[0]:[]},_formatColumnSize:function(a,b){if(a.length<=0)return[];var c=[0];return b=b||this._getHDeep(),BI.each(a,function(a,d){return a<b?void(c[0]+=d):void c.push(d)}),c},_recomputeColumnSize:function(){var a=this.options;a.regionColumnSize=this.table.getRegionColumnSize();var b=this.table.getColumnSize().slice();if(a.freezeCols.length>1)for(var c=0;c<a.freezeCols.length-1;c++)b.splice(1,0,0);a.columnSize=b},_digest:function(){var a=this.options,b=this._getHDeep(),c=this._getVDeep(),d=this._createHeader(c),e=this._formatItems(a.items,d,b),f=a.columnSize.slice(),g=a.minColumnSize.slice(),h=a.maxColumnSize.slice();return BI.removeAt(f,e.deletedCols),BI.removeAt(g,e.deletedCols),BI.removeAt(h,e.deletedCols),{header:e.header,items:e.items,columnSize:this._formatColumnSize(f,b),minColumnSize:this._formatColumns(g,b),maxColumnSize:this._formatColumns(h,b),freezeCols:this._formatFreezeCols()}},_init:function(){BI.DynamicSummaryLayerTreeTable.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._digest();this.table=BI.createWidget(b.el,{type:"bi.resizable_table",element:this,width:b.width,height:b.height,isNeedResize:b.isNeedResize,isResizeAdapt:b.isResizeAdapt,isNeedFreeze:b.isNeedFreeze,freezeCols:c.freezeCols,isNeedMerge:b.isNeedMerge,mergeCols:[],mergeRule:b.mergeRule,columnSize:c.columnSize,minColumnSize:c.minColumnSize,maxColumnSize:c.maxColumnSize,headerRowSize:b.headerRowSize,rowSize:b.rowSize,regionColumnSize:b.regionColumnSize,header:c.header,items:c.items}),this.table.on(BI.Table.EVENT_TABLE_SCROLL,function(){a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,function(){a._recomputeColumnSize(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,function(){a._recomputeColumnSize(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,arguments)})},setWidth:function(a){BI.DynamicSummaryLayerTreeTable.superclass.setWidth.apply(this,arguments),this.table.setWidth(a)},setHeight:function(a){BI.DynamicSummaryLayerTreeTable.superclass.setHeight.apply(this,arguments),this.table.setHeight(a)},setColumnSize:function(a){this.options.columnSize=a},getColumnSize:function(){return this.options.columnSize},setRegionColumnSize:function(a){this.options.regionColumnSize=a,this.table.setRegionColumnSize(a)},getRegionColumnSize:function(){return this.table.getRegionColumnSize()},setVerticalScroll:function(a){this.table.setVerticalScroll(a)},setLeftHorizontalScroll:function(a){this.table.setLeftHorizontalScroll(a)},setRightHorizontalScroll:function(a){this.table.setRightHorizontalScroll(a)},getVerticalScroll:function(){return this.table.getVerticalScroll()},getLeftHorizontalScroll:function(){return this.table.getLeftHorizontalScroll()},getRightHorizontalScroll:function(){return this.table.getRightHorizontalScroll()},attr:function(a,b){var c=this;if(BI.isObject(a))return void BI.each(a,function(a,b){c.attr(a,b)});switch(BI.DynamicSummaryLayerTreeTable.superclass.attr.apply(this,arguments),a){case"columnSize":case"minColumnSize":case"maxColumnSize":case"freezeCols":case"mergeCols":return}this.table.attr.apply(this.table,[a,b])},restore:function(){this.table.restore()},populate:function(a,b,c,d){var e=this.options;a&&(e.items=a),b&&(e.header=b),c&&(e.crossItems=c),d&&(e.crossHeader=d);var f=this._digest();this.table.setColumnSize(f.columnSize),this.table.attr("minColumnSize",f.minColumnSize),this.table.attr("maxColumnSize",f.maxColumnSize),this.table.attr("freezeCols",f.freezeCols),this.table.populate(f.items,f.header)},destroy:function(){this.table.destroy(),BI.DynamicSummaryLayerTreeTable.superclass.destroy.apply(this,arguments)}}),BI.shortcut("bi.dynamic_summary_layer_tree_table",BI.DynamicSummaryLayerTreeTable),BI.DynamicSummaryTreeTable=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.DynamicSummaryTreeTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-dynamic-summary-tree-table",el:{type:"bi.resizable_table"},isNeedResize:!0,isResizeAdapt:!0,isNeedFreeze:!1,freezeCols:[],isNeedMerge:!0,mergeCols:[],mergeRule:BI.emptyFn,columnSize:[],minColumnSize:[],maxColumnSize:[],headerRowSize:25,footerRowSize:25,rowSize:25,regionColumnSize:[],headerCellStyleGetter:BI.emptyFn,summaryCellStyleGetter:BI.emptyFn,sequenceCellStyleGetter:BI.emptyFn,header:[],footer:!1,items:[],crossHeader:[],crossItems:[]})},_getVDeep:function(){return this.options.crossHeader.length},_getHDeep:function(){var a=this.options;return Math.max(a.mergeCols.length,a.freezeCols.length,BI.TableTree.maxDeep(a.items)-1)},_init:function(){BI.DynamicSummaryTreeTable.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._digest();this.table=BI.createWidget(b.el,{type:"bi.resizable_table",element:this,width:b.width,height:b.height,isNeedResize:b.isNeedResize,isResizeAdapt:b.isResizeAdapt,isNeedFreeze:b.isNeedFreeze,freezeCols:b.freezeCols,isNeedMerge:b.isNeedMerge,mergeCols:b.mergeCols,mergeRule:b.mergeRule,columnSize:b.columnSize,minColumnSize:b.minColumnSize,maxColumnSize:b.maxColumnSize,headerRowSize:b.headerRowSize,rowSize:b.rowSize,regionColumnSize:b.regionColumnSize,header:c.header,items:c.items}),this.table.on(BI.Table.EVENT_TABLE_SCROLL,function(){a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,function(){b.regionColumnSize=this.getRegionColumnSize();var c=this.getColumnSize(),d=b.columnSize.length-c.length;b.columnSize=c.slice(),b.columnSize=b.columnSize.concat(BI.makeArray(d,0)),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,function(){b.regionColumnSize=this.getRegionColumnSize();var c=this.getColumnSize(),d=b.columnSize.length-c.length;b.columnSize=c.slice(),b.columnSize=b.columnSize.concat(BI.makeArray(d,0)),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,arguments)})},_digest:function(){var a=this.options,b=this._getHDeep(),c=this._getVDeep(),d=BI.TableTree.formatHeader(a.header,a.crossHeader,a.crossItems,b,c,a.headerCellStyleGetter),e=BI.DynamicSummaryTreeTable.formatHorizontalItems(a.items,b,!1,a.summaryCellStyleGetter),f=BI.DynamicSummaryTreeTable.formatSummaryItems(e,d,a.crossItems,b),g=a.columnSize.slice(),h=a.minColumnSize.slice(),i=a.maxColumnSize.slice();return BI.removeAt(g,f.deletedCols),BI.removeAt(h,f.deletedCols),BI.removeAt(i,f.deletedCols),{header:f.header,items:f.items,columnSize:g,minColumnSize:h,maxColumnSize:i}},setWidth:function(a){BI.DynamicSummaryTreeTable.superclass.setWidth.apply(this,arguments),this.table.setWidth(a)},setHeight:function(a){BI.DynamicSummaryTreeTable.superclass.setHeight.apply(this,arguments),this.table.setHeight(a)},setColumnSize:function(a){this.options.columnSize=a},getColumnSize:function(){return this.options.columnSize},setRegionColumnSize:function(a){this.options.regionColumnSize=a,this.table.setRegionColumnSize(a)},getRegionColumnSize:function(){return this.table.getRegionColumnSize()},setVerticalScroll:function(a){this.table.setVerticalScroll(a)},setLeftHorizontalScroll:function(a){this.table.setLeftHorizontalScroll(a)},setRightHorizontalScroll:function(a){this.table.setRightHorizontalScroll(a)},getVerticalScroll:function(){return this.table.getVerticalScroll()},getLeftHorizontalScroll:function(){return this.table.getLeftHorizontalScroll()},getRightHorizontalScroll:function(){return this.table.getRightHorizontalScroll()},attr:function(a){switch(BI.DynamicSummaryTreeTable.superclass.attr.apply(this,arguments),a){case"minColumnSize":case"maxColumnSize":return}this.table.attr.apply(this.table,arguments)},restore:function(){this.table.restore()},populate:function(a,b,c,d){var e=this.options;a&&(e.items=a),b&&(e.header=b),c&&(e.crossItems=c),d&&(e.crossHeader=d);var f=this._digest();this.table.setColumnSize(f.columnSize),this.table.attr("minColumnSize",f.minColumnSize),this.table.attr("maxColumnSize",f.maxColumnSize),this.table.populate(f.items,f.header)},destroy:function(){this.table.destroy(),BI.DynamicSummaryTreeTable.superclass.destroy.apply(this,arguments)}}),BI.extend(BI.DynamicSummaryTreeTable,{formatHorizontalItems:function(a,b,c,d){function e(a,g){var h;if(BI.isArray(g.children)){if(BI.each(g.children,function(b,c){var d;a!=-1?(d=a.slice(),d.push(g)):d=[],e(d,c)}),a!=-1?(h=a.slice(),h.push(g)):h=[],(a==-1||g.children.length>1)&&BI.isNotEmptyArray(g.values)){for(var i={text:BI.i18nText("BI-Summary_Values"),type:"bi.table_style_cell",styleGetter:function(){return d(a===-1)}},j=h.length;j<b;j++)h.push(i);if(c||(h=h.concat(g.values)),h.length>0)if(c)for(var k=0,l=g.values.length;k<l;k++)f.push(h);else f.push(h)}}else{if(a!=-1){h=a.slice();for(var j=h.length;j<b;j++)h.push(g)}else h=[];if(!c&&BI.isArray(g.values)&&(h=h.concat(g.values)),c&&BI.isArray(g.values))for(var j=0,m=g.values.length;j<m-1;j++)h.length>0&&f.push(h);h.length>0&&f.push(h)}}var f=[];return BI.each(a,function(a,b){e(-1,b)}),BI.each(f,function(a,c){for(var d=BI.last(c),e=c.length;e<b;e++)c.push(d)}),f},formatSummaryItems:function(a,b,c,d){function e(a){if(BI.isArray(a.children)){if(BI.each(a.children,function(a,b){e(b)}),BI.isNotEmptyArray(a.values)){if(1===a.children.length)for(var b=0;b<a.values.length;b++)f.push(g+b+d);g+=a.values.length}}else a.values&&a.values.length>1?g+=a.values.length:g++}var f=[],g=0;if(BI.each(c,function(a,b){e(b)}),f.length>0){var h=[],i=[];BI.each(b,function(a,b){var c=b.slice();BI.removeAt(c,f),h.push(c)}),BI.each(a,function(a,b){var c=b.slice();BI.removeAt(c,f),i.push(c)}),b=h,a=i}return{items:a,header:b,deletedCols:f}}}),BI.shortcut("bi.dynamic_summary_tree_table",BI.DynamicSummaryTreeTable),BI.LayerTreeTableCell=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.LayerTreeTableCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-layer-tree-table-cell",layer:0,text:""
})},_init:function(){BI.LayerTreeTableCell.superclass._init.apply(this,arguments);var a=this.options;BI.createWidget({type:"bi.label",element:this.element,textAlign:"left",whiteSpace:"nowrap",height:a.height,text:a.text,value:a.value,lgap:5+30*a.layer,rgap:5})}}),BI.shortcut("bi.layer_tree_table_cell",BI.LayerTreeTableCell),BI.LayerTreeTable=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.LayerTreeTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-layer-tree-table",el:{type:"bi.resizable_table"},isNeedResize:!1,isResizeAdapt:!0,isNeedFreeze:!1,freezeCols:[],isNeedMerge:!0,mergeCols:[],mergeRule:BI.emptyFn,columnSize:[],minColumnSize:[],maxColumnSize:[],headerRowSize:25,rowSize:25,regionColumnSize:[],rowHeaderCreator:null,headerCellStyleGetter:BI.emptyFn,summaryCellStyleGetter:BI.emptyFn,sequenceCellStyleGetter:BI.emptyFn,header:[],items:[],crossHeader:[],crossItems:[]})},_getVDeep:function(){return this.options.crossHeader.length},_getHDeep:function(){var a=this.options;return Math.max(a.mergeCols.length,a.freezeCols.length,BI.TableTree.maxDeep(a.items)-1)},_createHeader:function(a){var b=this.options,c=b.header||[],d=b.crossHeader||[],e=BI.TableTree.formatCrossItems(b.crossItems,a,b.headerCellStyleGetter),f=[];if(BI.each(e,function(a,b){var c=[d[a]];f.push(c.concat(b||[]))}),c&&c.length>0){var g=this._formatColumns(c),h=this._getHDeep();h<=0?g.unshift(b.rowHeaderCreator||{type:"bi.table_style_cell",text:BI.i18nText("BI-Row_Header"),styleGetter:b.headerCellStyleGetter}):g[0]=b.rowHeaderCreator||{type:"bi.table_style_cell",text:BI.i18nText("BI-Row_Header"),styleGetter:b.headerCellStyleGetter},f.push(g)}return f},_formatItems:function(a){function b(a,c){a.type||(a.type="bi.layer_tree_table_cell"),a.layer=c;var e=[a];e=e.concat(a.values||[]),e.length>0&&d.push(e),BI.isNotEmptyArray(a.children)&&BI.each(a.children,function(a,d){b(d,c+1)})}var c=this.options,d=[];return BI.each(a,function(a,e){if(BI.each(e.children,function(a,c){b(c,0)}),BI.isArray(e.values)){var f=[{type:"bi.table_style_cell",text:BI.i18nText("BI-Summary_Values"),styleGetter:function(){return c.summaryCellStyleGetter(!0)}}].concat(e.values);d.push(f)}}),d},_formatColumns:function(a,b){return BI.isNotEmptyArray(a)?(b=b||this._getHDeep(),a.slice(Math.max(0,b-1))):a},_formatFreezeCols:function(){return this.options.freezeCols.length>0?[0]:[]},_formatColumnSize:function(a,b){if(a.length<=0)return[];var c=[0];return b=b||this._getHDeep(),BI.each(a,function(a,d){return a<b?void(c[0]+=d):void c.push(d)}),c},_digest:function(){var a=this.options,b=this._getHDeep(),c=this._getVDeep();return{header:this._createHeader(c),items:this._formatItems(a.items),columnSize:this._formatColumnSize(a.columnSize,b),minColumnSize:this._formatColumns(a.minColumnSize,b),maxColumnSize:this._formatColumns(a.maxColumnSize,b),freezeCols:this._formatFreezeCols()}},_init:function(){BI.LayerTreeTable.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._digest();this.table=BI.createWidget(b.el,{type:"bi.resizable_table",element:this,width:b.width,height:b.height,isNeedResize:b.isNeedResize,isResizeAdapt:b.isResizeAdapt,isNeedFreeze:b.isNeedFreeze,freezeCols:c.freezeCols,isNeedMerge:b.isNeedMerge,mergeCols:[],mergeRule:b.mergeRule,columnSize:c.columnSize,minColumnSize:c.minColumnSize,maxColumnSize:c.maxColumnSize,headerRowSize:b.headerRowSize,rowSize:b.rowSize,regionColumnSize:b.regionColumnSize,header:c.header,items:c.items}),this.table.on(BI.Table.EVENT_TABLE_SCROLL,function(){a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,function(){b.regionColumnSize=this.getRegionColumnSize(),b.columnSize=this.getColumnSize(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,function(){b.regionColumnSize=this.getRegionColumnSize(),b.columnSize=this.getColumnSize(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,arguments)})},setWidth:function(a){BI.LayerTreeTable.superclass.setWidth.apply(this,arguments),this.table.setWidth(a)},setHeight:function(a){BI.LayerTreeTable.superclass.setHeight.apply(this,arguments),this.table.setHeight(a)},setColumnSize:function(a){this.options.columnSize=a},getColumnSize:function(){var a=this.table.getColumnSize(),b=this._getHDeep(),c=[];return b>0&&(c=BI.makeArray(b,a[0]/b)),c.concat(a.slice(1))},setRegionColumnSize:function(a){this.options.regionColumnSize=a,this.table.setRegionColumnSize(a)},getRegionColumnSize:function(){return this.table.getRegionColumnSize()},setVerticalScroll:function(a){this.table.setVerticalScroll(a)},setLeftHorizontalScroll:function(a){this.table.setLeftHorizontalScroll(a)},setRightHorizontalScroll:function(a){this.table.setRightHorizontalScroll(a)},getVerticalScroll:function(){return this.table.getVerticalScroll()},getLeftHorizontalScroll:function(){return this.table.getLeftHorizontalScroll()},getRightHorizontalScroll:function(){return this.table.getRightHorizontalScroll()},attr:function(a,b){var c=this;if(BI.isObject(a))return void BI.each(a,function(a,b){c.attr(a,b)});switch(BI.LayerTreeTable.superclass.attr.apply(this,arguments),a){case"columnSize":case"minColumnSize":case"maxColumnSize":case"freezeCols":case"mergeCols":return}this.table.attr.apply(this.table,[a,b])},restore:function(){this.table.restore()},populate:function(a,b,c,d){var e=this.options;e.items=a||[],b&&(e.header=b),c&&(e.crossItems=c),d&&(e.crossHeader=d);var f=this._digest();this.table.setColumnSize(f.columnSize),this.table.attr("freezeCols",f.freezeCols),this.table.attr("minColumnSize",f.minColumnSize),this.table.attr("maxColumnSize",f.maxColumnSize),this.table.populate(f.items,f.header)},destroy:function(){this.table.destroy(),BI.LayerTreeTable.superclass.destroy.apply(this,arguments)}}),BI.shortcut("bi.layer_tree_table",BI.LayerTreeTable),BI.TableStyleCell=BI.inherit(BI.Single,{_defaultConfig:function(){return BI.extend(BI.TableStyleCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-table-style-cell",styleGetter:BI.emptyFn})},_init:function(){BI.TableStyleCell.superclass._init.apply(this,arguments);var a=this.options;this.text=BI.createWidget({type:"bi.label",element:this,textAlign:"left",forceCenter:!0,hgap:5,text:a.text}),this._digestStyle()},_digestStyle:function(){var a=this.options,b=a.styleGetter();b&&this.text.element.css(b)},setText:function(a){this.text.setText(a)},populate:function(){this._digestStyle()}}),BI.shortcut("bi.table_style_cell",BI.TableStyleCell),BI.TableTree=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.TableTree.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-table-tree",el:{type:"bi.resizable_table"},isNeedResize:!0,isResizeAdapt:!0,freezeCols:[],isNeedMerge:!0,mergeCols:[],mergeRule:BI.emptyFn,columnSize:[],minColumnSize:[],maxColumnSize:[],headerRowSize:25,rowSize:25,regionColumnSize:[],headerCellStyleGetter:BI.emptyFn,summaryCellStyleGetter:BI.emptyFn,sequenceCellStyleGetter:BI.emptyFn,header:[],items:[],crossHeader:[],crossItems:[]})},_getVDeep:function(){return this.options.crossHeader.length},_getHDeep:function(){var a=this.options;return Math.max(a.mergeCols.length,a.freezeCols.length,BI.TableTree.maxDeep(a.items)-1)},_init:function(){BI.TableTree.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._digest();this.table=BI.createWidget(b.el,{type:"bi.resizable_table",element:this,width:b.width,height:b.height,isNeedResize:b.isNeedResize,isResizeAdapt:b.isResizeAdapt,isNeedFreeze:b.isNeedFreeze,freezeCols:b.freezeCols,isNeedMerge:b.isNeedMerge,mergeCols:b.mergeCols,mergeRule:b.mergeRule,columnSize:b.columnSize,minColumnSize:b.minColumnSize,maxColumnSize:b.maxColumnSize,headerRowSize:b.headerRowSize,rowSize:b.rowSize,regionColumnSize:b.regionColumnSize,header:c.header,items:c.items}),this.table.on(BI.Table.EVENT_TABLE_SCROLL,function(){a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,function(){b.regionColumnSize=this.getRegionColumnSize(),b.columnSize=this.getColumnSize(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,function(){b.regionColumnSize=this.getRegionColumnSize(),b.columnSize=this.getColumnSize(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,arguments)})},_digest:function(){var a=this.options,b=this._getHDeep(),c=this._getVDeep(),d=BI.TableTree.formatHeader(a.header,a.crossHeader,a.crossItems,b,c,a.headerCellStyleGetter),e=BI.TableTree.formatItems(a.items,b,!1,a.summaryCellStyleGetter);return{header:d,items:e}},setWidth:function(a){BI.TableTree.superclass.setWidth.apply(this,arguments),this.table.setWidth(a)},setHeight:function(a){BI.TableTree.superclass.setHeight.apply(this,arguments),this.table.setHeight(a)},setColumnSize:function(a){this.options.columnSize=a,this.table.setColumnSize(a)},getColumnSize:function(){return this.table.getColumnSize()},setRegionColumnSize:function(a){this.options.regionColumnSize=a,this.table.setRegionColumnSize(a)},getRegionColumnSize:function(){return this.table.getRegionColumnSize()},setVerticalScroll:function(a){this.table.setVerticalScroll(a)},setLeftHorizontalScroll:function(a){this.table.setLeftHorizontalScroll(a)},setRightHorizontalScroll:function(a){this.table.setRightHorizontalScroll(a)},getVerticalScroll:function(){return this.table.getVerticalScroll()},getLeftHorizontalScroll:function(){return this.table.getLeftHorizontalScroll()},getRightHorizontalScroll:function(){return this.table.getRightHorizontalScroll()},attr:function(){BI.TableTree.superclass.attr.apply(this,arguments),this.table.attr.apply(this.table,arguments)},restore:function(){this.table.restore()},populate:function(a,b,c,d){var e=this.options;a&&(e.items=a||[]),b&&(e.header=b),c&&(e.crossItems=c),d&&(e.crossHeader=d);var f=this._digest();this.table.populate(f.items,f.header)},destroy:function(){this.table.destroy(),BI.TableTree.superclass.destroy.apply(this,arguments)}}),BI.extend(BI.TableTree,{formatHeader:function(a,b,c,d,e,f){for(var g=BI.TableTree.formatCrossItems(c,e,f),h=[],i=0;i<e;i++){for(var j=[],k=0;k<d;k++)j.push(b[i]);h.push(j.concat(g[i]||[]))}return a&&a.length>0&&h.push(a),h},formatItems:function(a,b,c,d){function e(a,g){var h;if(BI.isArray(g.children)){if(BI.each(g.children,function(b,c){var d;a!=-1?(d=a.slice(),d.push(g)):d=[],e(d,c)}),a!=-1?(h=a.slice(),h.push(g)):h=[],BI.isNotEmptyArray(g.values)){for(var i={text:BI.i18nText("BI-Summary_Values"),type:"bi.table_style_cell",styleGetter:function(){return d(a===-1)}},j=h.length;j<b;j++)h.push(i);if(c||(h=h.concat(g.values)),h.length>0)if(c)for(var k=0,l=g.values.length;k<l;k++)f.push(h);else f.push(h)}}else{if(a!=-1){h=a.slice();for(var j=h.length;j<b;j++)h.push(g)}else h=[];if(!c&&BI.isArray(g.values)&&(h=h.concat(g.values)),c&&BI.isArray(g.values))for(var j=0,m=g.values.length;j<m-1;j++)h.length>0&&f.push(h);h.length>0&&f.push(h)}}var f=[];return BI.each(a,function(a,b){e(-1,b)}),BI.each(f,function(a,c){for(var d=BI.last(c),e=c.length;e<b;e++)c.push(d)}),f},formatCrossItems:function(a,b,c){var d=BI.TableTree.formatItems(a,b,!0,c);return BI.unzip(d)},maxDeep:function(a){function b(a,c){var d=a;return BI.isNotEmptyArray(c.children)&&BI.each(c.children,function(c,e){d=Math.max(d,b(a+1,e))}),d}var c=1;return BI.isObject(a)&&BI.each(a,function(a,d){c=Math.max(c,b(1,d))}),c}}),BI.shortcut("bi.tree_table",BI.TableTree),BI.MultiSelectBar=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.MultiSelectBar.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-multi-select-bar",height:25,text:BI.i18nText("BI-Select_All"),isAllCheckedBySelectedValue:BI.emptyFn,disableSelected:!0,isHalfCheckedBySelectedValue:function(a){return a.length>0}})},_init:function(){BI.MultiSelectBar.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.checkbox",stopPropagation:!0,handler:function(){a.setSelected(a.isSelected())}}),this.half=BI.createWidget({type:"bi.half_icon_button",stopPropagation:!0,handler:function(){a.setSelected(!0)}}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.CLICK,a.isSelected(),a)}),this.half.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.CLICK,a.isSelected(),a)}),this.half.on(BI.HalfIconButton.EVENT_CHANGE,function(){a.fireEvent(BI.MultiSelectBar.EVENT_CHANGE,a.isSelected(),a)}),this.checkbox.on(BI.Checkbox.EVENT_CHANGE,function(){a.fireEvent(BI.MultiSelectBar.EVENT_CHANGE,a.isSelected(),a)}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,keyword:b.keyword,value:b.value,py:b.py}),BI.createWidget({type:"bi.htape",element:this,items:[{width:36,el:{type:"bi.center_adapt",items:[this.checkbox,this.half]}},{el:this.text}]}),this.half.invisible()},beforeClick:function(){var a=this.isHalfSelected(),b=this.isSelected();a===!0?this.setSelected(!0):this.setSelected(!b)},setSelected:function(a){this.checkbox.setSelected(a),this.setHalfSelected(!1)},setHalfSelected:function(a){this._half=!!a,a===!0?(this.half.visible(),this.checkbox.invisible()):(this.half.invisible(),this.checkbox.visible())},isHalfSelected:function(){return!!this._half},isSelected:function(){return this.checkbox.isSelected()},setValue:function(a){BI.MultiSelectBar.superclass.setValue.apply(this,arguments);var b=this.options.isAllCheckedBySelectedValue.apply(this,arguments);this.setSelected(b),!b&&this.setHalfSelected(this.options.isHalfCheckedBySelectedValue.apply(this,arguments))}}),BI.MultiSelectBar.EVENT_CHANGE="MultiSelectBar.EVENT_CHANGE",BI.shortcut("bi.multi_select_bar",BI.MultiSelectBar),BI.BranchRelation=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.BranchRelation.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-branch-relation-tree",items:[],centerOffset:0,direction:BI.Direction.Bottom,align:BI.VerticalAlign.Top})},_init:function(){BI.BranchRelation.superclass._init.apply(this,arguments),this.populate(this.options.items)},_stratification:function(){var a=[];return this.tree.recursion(function(b,c){b.leaf=b.isLeaf(),a[c.length-1]||(a[c.length-1]=[]),a[c.length-1].push(b)}),a},_calculateLeaves:function(){function a(b){var c=0;return b.isLeaf()?1:(BI.each(b.getChildren(),function(b,d){c+=a(d)}),b.set("leaves",c),c)}var b=0;return b=a(this.tree.getRoot())},_translate:function(a){var b=[],c=a.length;return BI.each(a,function(d,e){b[d]||(b[d]=[]),BI.each(e,function(f,g){if(g.isLeaf()&&d<c-1){var h=new BI.Node(BI.UUID());h.isNew=!0;var i=0;if(f>0){var j=e[f-1].getLastChild();i=a[d+1].indexOf(j)+1}a[d+1].splice(i,0,g);var k=g.parent.getChildIndex(g.id);g.parent.removeChildByIndex(k),g.parent.addChild(h,k),h.addChild(g),b[d].push(h),e[f]=h}else b[d].push(g)})}),b},_fill:function(a){var b=[],c=a.length;return BI.each(a,function(d,e){b[d]||(b[d]=[]),BI.each(e,function(f,g){if(g.isLeaf()&&d<c-1){var h=new BI.Node(BI.UUID());h.leaf=!0,h.width=g.width,h.height=g.height,h.isNew=!0;var i=0;if(f>0){var j=e[f-1].getLastChild();i=a[d+1].indexOf(j)+1}a[d+1].splice(i,0,h),g.addChild(h)}b[d].push(g)})}),b},_adjust:function(a){for(;;){var b=!1;if(BI.backEach(a,function(a,c){BI.each(c,function(a,c){if(!c.isNew){var d=!0;if(BI.any(c.getChildren(),function(a,b){if(!b.isNew)return d=!1,!0}),!c.isLeaf()&&d===!0){var e=[];BI.each(c.getChildren(),function(a,b){e=e.concat(b.getChildren())}),c.removeAllChilds(),BI.each(e,function(a,b){c.addChild(b)});var f=new BI.Node(BI.UUID());f.isNew=!0;var g=c.parent.getChildIndex(c.id);c.parent.removeChildByIndex(g),c.parent.addChild(f,g),f.addChild(c),b=!0}}})}),b===!1)break;a=this._stratification()}return a},_calculateWidth:function(){function a(b){var c=0;return b.isLeaf()?b.width:(BI.each(b.getChildren(),function(b,d){c+=a(d)}),c)}function b(a){var c=0;return a.isLeaf()?a.height:(BI.each(a.getChildren(),function(a,d){c+=b(d)}),c)}var c=(this.options,0);return c=this._isVertical()?a(this.tree.getRoot()):b(this.tree.getRoot())},_isVertical:function(){var a=this.options;return a.direction===BI.Direction.Top||a.direction===BI.Direction.Bottom},_calculateHeight:function(){function a(b){var c=0;return BI.each(b.getChildren(),function(b,d){c=Math.max(c,a(d))}),c+(b.height||0)}function b(a){var c=0;return BI.each(a.getChildren(),function(a,d){c=Math.max(c,b(d))}),c+(a.width||0)}var c=(this.options,0);return c=this._isVertical()?a(this.tree.getRoot()):b(this.tree.getRoot())},_calculateXY:function(a){var b=(this.options,this._calculateWidth()),c=this._calculateHeight(),d=a.length,e=this._calculateLeaves(),f={},g=c/d;return BI.each(a,function(a,c){var d=[];BI.each(c,function(a,b){d[a]=(b.get("leaves")||1)/e}),BI.each(c,function(c,e){var h=BI.sum(d.slice(0,c)),i=h*b+d[c]*b/2,j=a*g+g/2;f[e.id]={x:i,y:j}})}),f},_stroke:function(a,b){var c=this._calculateHeight(),d=a.length,e=c/d,f=this,g=this.options;switch(g.direction){case BI.Direction.Top:BI.each(a,function(a,c){BI.each(c,function(a,c){if(c.getChildrenLength()>0&&!c.leaf){var d="",h=b[c.id],i=h.y+e/2;d+="M"+h.x+","+(h.y+g.centerOffset)+"L"+h.x+","+i;var j=[];BI.each(c.getChildren(),function(a,c){var e=j[a]=b[c.id];d+="M"+e.x+","+(e.y+g.centerOffset)+"L"+e.x+","+i}),j.length>0&&(d+="M"+BI.first(j).x+","+i+"L"+BI.last(j).x+","+i),f.svg.path(d).attr("stroke","#d4dadd")}})});break;case BI.Direction.Bottom:BI.each(a,function(a,c){BI.each(c,function(a,c){if(c.getChildrenLength()>0&&!c.leaf){var d="",h=b[c.id],i=h.y-e/2;d+="M"+h.x+","+(h.y-g.centerOffset)+"L"+h.x+","+i;var j=[];BI.each(c.getChildren(),function(a,c){var e=j[a]=b[c.id];d+="M"+e.x+","+(e.y-g.centerOffset)+"L"+e.x+","+i}),j.length>0&&(d+="M"+BI.first(j).x+","+i+"L"+BI.last(j).x+","+i),f.svg.path(d).attr("stroke","#d4dadd")}})});break;case BI.Direction.Left:BI.each(a,function(a,c){BI.each(c,function(a,c){if(c.getChildrenLength()>0&&!c.leaf){var d="",h=b[c.id],i=h.y+e/2;d+="M"+(h.y+g.centerOffset)+","+h.x+"L"+i+","+h.x;var j=[];BI.each(c.getChildren(),function(a,c){var e=j[a]=b[c.id];d+="M"+(e.y+g.centerOffset)+","+e.x+"L"+i+","+e.x}),j.length>0&&(d+="M"+i+","+BI.first(j).x+"L"+i+","+BI.last(j).x),f.svg.path(d).attr("stroke","#d4dadd")}})});break;case BI.Direction.Right:BI.each(a,function(a,c){BI.each(c,function(a,c){if(c.getChildrenLength()>0&&!c.leaf){var d="",h=b[c.id],i=h.y-e/2;d+="M"+(h.y-g.centerOffset)+","+h.x+"L"+i+","+h.x;var j=[];BI.each(c.getChildren(),function(a,c){var e=j[a]=b[c.id];d+="M"+(e.y-g.centerOffset)+","+e.x+"L"+i+","+e.x}),j.length>0&&(d+="M"+i+","+BI.first(j).x+"L"+i+","+BI.last(j).x),f.svg.path(d).attr("stroke","#d4dadd")}})})}},_createBranches:function(a){var b=this.options;b.direction!==BI.Direction.Bottom&&b.direction!==BI.Direction.Right||(a=a.reverse());var c=this._calculateXY(a);this._stroke(a,c)},_isNeedAdjust:function(){var a=this.options;return a.direction===BI.Direction.Top&&a.align===BI.VerticalAlign.Bottom||a.direction===BI.Direction.Bottom&&a.align===BI.VerticalAlign.Top||a.direction===BI.Direction.Left&&a.align===BI.HorizontalAlign.Right||a.direction===BI.Direction.Right&&a.align===BI.HorizontalAlign.Left},setValue:function(a){},getValue:function(){},_transformToTreeFormat:function(a){var b,c;if(!a)return[];if(BI.isArray(a)){var d=[],e=[];for(b=0,c=a.length;b<c;b++)e[a[b].id]=a[b];for(b=0,c=a.length;b<c;b++)e[a[b].pId]&&a[b].id!=a[b].pId?(e[a[b].pId].children||(e[a[b].pId].children=[]),e[a[b].pId].children.push(a[b])):d.push(a[b]);return d}return[a]},populate:function(a){var b=this.options;b.items=a||[],this.empty(),a=this._transformToTreeFormat(b.items),this.tree=new BI.Tree,this.tree.initTree(a),this.svg=BI.createWidget({type:"bi.svg"});var c=this._stratification();if(this._isNeedAdjust()){var d=this._translate(c);d=this._adjust(d),this._createBranches(d)}else{var d=this._fill(c);this._createBranches(d)}var e=BI.createWidget({type:"bi.layout",width:this._isVertical()?this._calculateWidth():this._calculateHeight(),height:this._isVertical()?this._calculateHeight():this._calculateWidth()});BI.createWidget({type:"bi.absolute",element:e,items:[{el:this.svg,top:0,left:0,right:0,bottom:0}]}),a=this._isVertical()?[{type:"bi.handstand_branch_tree",expander:{direction:b.direction},el:{layouts:[{type:"bi.horizontal_adapt",verticalAlign:b.align}]},items:a}]:[{type:"bi.branch_tree",expander:{direction:b.direction},el:{layouts:[{type:"bi.vertical"},{type:b.align===BI.HorizontalAlign.Left?"bi.left":"bi.right"}]},items:a}],BI.createWidget({type:"bi.adaptive",element:e,items:a}),BI.createWidget({type:"bi.center_adapt",scrollable:!0,element:this,items:[e]})}}),BI.BranchRelation.EVENT_CHANGE="BranchRelation.EVENT_CHANGE",BI.shortcut("bi.branch_relation",BI.BranchRelation),BI.HandStandBranchExpander=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.HandStandBranchExpander.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-handstand-branch-expander",direction:BI.Direction.Top,logic:{dynamic:!0},el:{type:"bi.label"},popup:{}})},_init:function(){BI.HandStandBranchExpander.superclass._init.apply(this,arguments);var a=this.options;this._initExpander(),this._initBranchView(),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(a.direction),BI.extend({},a.logic,{items:BI.LogicFactory.createLogicItemsByDirection(a.direction,{type:"bi.center_adapt",items:[this.expander]},this.branchView)}))))},_initExpander:function(){var a=this,b=this.options;this.expander=BI.createWidget(b.el),this.expander.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})},_initBranchView:function(){var a=this,b=this.options;this.branchView=BI.createWidget(b.popup,{}),this.branchView.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})},populate:function(a){this.branchView.populate.apply(this.branchView,arguments)},getValue:function(){return this.branchView.getValue()}}),BI.HandStandBranchExpander.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.handstand_branch_expander",BI.HandStandBranchExpander),BI.BranchExpander=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.BranchExpander.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-branch-expander",direction:BI.Direction.Left,logic:{dynamic:!0},el:{},popup:{}})},_init:function(){BI.BranchExpander.superclass._init.apply(this,arguments);var a=this.options;this._initExpander(),this._initBranchView(),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(a.direction),BI.extend({},a.logic,{items:BI.LogicFactory.createLogicItemsByDirection(a.direction,this.expander,this.branchView)}))))},_initExpander:function(){var a=this,b=this.options;this.expander=BI.createWidget(b.el,{type:"bi.label",width:30,height:"100%"}),this.expander.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})},_initBranchView:function(){var a=this,b=this.options;this.branchView=BI.createWidget(b.popup,{}),this.branchView.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})},populate:function(a){this.branchView.populate.apply(this.branchView,arguments)},getValue:function(){return this.branchView.getValue()}}),BI.BranchExpander.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.branch_expander",BI.BranchExpander),BI.HandStandBranchTree=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.HandStandBranchTree.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-handstand-branch-tree",expander:{},el:{},items:[]})},_init:function(){BI.HandStandBranchTree.superclass._init.apply(this,arguments);var a=this,b=this.options;this.branchTree=BI.createWidget({type:"bi.custom_tree",element:this,expander:BI.extend({type:"bi.handstand_branch_expander",el:{},popup:{type:"bi.custom_tree"}},b.expander),el:BI.extend({type:"bi.button_tree",chooseType:BI.ButtonGroup.CHOOSE_TYPE_MULTI,layouts:[{type:"bi.horizontal_adapt"}]},b.el),items:this.options.items}),this.branchTree.on(BI.CustomTree.EVENT_CHANGE,function(){a.fireEvent(BI.HandStandBranchTree.EVENT_CHANGE,arguments)}),this.branchTree.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})},populate:function(){this.branchTree.populate.apply(this.branchTree,arguments)},getValue:function(){return this.branchTree.getValue()}}),BI.HandStandBranchTree.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.handstand_branch_tree",BI.HandStandBranchTree),BI.BranchTree=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.BranchTree.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-branch-tree",expander:{},el:{},items:[]})},_init:function(){BI.BranchTree.superclass._init.apply(this,arguments);var a=this,b=this.options;this.branchTree=BI.createWidget({type:"bi.custom_tree",element:this,expander:BI.extend({type:"bi.branch_expander",el:{},popup:{type:"bi.custom_tree"}},b.expander),el:BI.extend({type:"bi.button_tree",chooseType:BI.ButtonGroup.CHOOSE_TYPE_MULTI,layouts:[{type:"bi.vertical"}]},b.el),items:this.options.items}),this.branchTree.on(BI.CustomTree.EVENT_CHANGE,function(){a.fireEvent(BI.BranchTree.EVENT_CHANGE,arguments)}),this.branchTree.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})},populate:function(){this.branchTree.populate.apply(this.branchTree,arguments)},getValue:function(){return this.branchTree.getValue()}}),BI.BranchTree.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.branch_tree",BI.BranchTree),BI.DisplayTree=BI.inherit(BI.TreeView,{_defaultConfig:function(){return BI.extend(BI.DisplayTree.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-display-tree"})},_init:function(){BI.DisplayTree.superclass._init.apply(this,arguments)},_configSetting:function(){function a(a,b){return!1}var b={view:{selectedMulti:!1,dblClickExpand:!1,showIcon:!1,showTitle:!1},data:{key:{title:"title",name:"text"},simpleData:{enable:!0}},callback:{beforeCollapse:a}};return b},_dealWidthNodes:function(a){a=BI.DisplayTree.superclass._dealWidthNodes.apply(this,arguments);this.options;return BI.each(a,function(a,b){null==b.text&&b.count>0&&(b.text=b.value+"("+BI.i18nText("BI-Basic_Altogether")+b.count+BI.i18nText("BI-Basic_Count")+")")}),a},initTree:function(a,b){var b=b||this._configSetting();this.nodes=$.fn.zTree.init(this.tree.element,b,a)},destroy:function(){BI.DisplayTree.superclass.destroy.apply(this,arguments)}}),BI.DisplayTree.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.display_tree",BI.DisplayTree),BI.LevelTree=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.LevelTree.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-level-tree",el:{chooseType:0},expander:{},items:[]})},_init:function(){BI.LevelTree.superclass._init.apply(this,arguments),this.initTree(this.options.items)},_formatItems:function(a,b){var c=this;return BI.each(a,function(d,e){var f={layer:b};if(BI.isKey(e.id)||(e.id=BI.UUID()),e.isParent===!0||BI.isNotEmptyArray(e.children)){switch(d){case 0:f.type="bi.first_plus_group_node";break;case a.length-1:f.type="bi.last_plus_group_node";break;default:f.type="bi.mid_plus_group_node"}BI.defaults(e,f),c._formatItems(e.children,b+1)}else{switch(d){case a.length-1:f.type="bi.last_tree_leaf_item";break;default:f.type="bi.mid_tree_leaf_item"}BI.defaults(e,f)}}),a},_assertId:function(a){BI.each(a,function(a,b){BI.isKey(b.id)||(b.id=BI.UUID())})},initTree:function(a){var b=this,c=this.options;this.empty(),this._assertId(a),this.tree=BI.createWidget({type:"bi.custom_tree",element:this,expander:BI.extend({el:{},popup:{type:"bi.custom_tree"}},c.expander),items:this._formatItems(BI.Tree.transformToTreeFormat(a),0),el:BI.extend({type:"bi.button_tree",chooseType:0,layouts:[{type:"bi.vertical"}]},c.el)}),this.tree.on(BI.Controller.EVENT_CHANGE,function(a,c,d){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.LevelTree.EVENT_CHANGE,c,d)})},stroke:function(a){this.tree.stroke.apply(this.tree,arguments)},populate:function(a){a=this._formatItems(BI.Tree.transformToTreeFormat(a),0),this.tree.populate(a)},setValue:function(a){this.tree.setValue(a)},getValue:function(){return this.tree.getValue()},getAllLeaves:function(){return this.tree.getAllLeaves()},getNodeById:function(a){return this.tree.getNodeById(a)},getNodeByValue:function(a){return this.tree.getNodeByValue(a)}}),BI.LevelTree.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.level_tree",BI.LevelTree),BI.SimpleTreeView=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SimpleTreeView.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-simple-tree",itemsCreator:BI.emptyFn,items:null})},_init:function(){BI.SimpleTreeView.superclass._init.apply(this,arguments);var a=this,b=this.options;this.structure=new BI.Tree,this.tree=BI.createWidget({type:"bi.tree_view",element:this,itemsCreator:function(c,d){var e=function(b){d({items:b}),a.structure.initTree(BI.Tree.transformToTreeFormat(b))};BI.isNotNull(b.items)?e(b.items):b.itemsCreator(c,e)}}),this.tree.on(BI.TreeView.EVENT_CHANGE,function(){a.fireEvent(BI.SimpleTreeView.EVENT_CHANGE,arguments)}),BI.isNotEmptyArray(b.items)&&this.populate()},populate:function(a,b){a&&(this.options.items=a),this.tree.stroke({keyword:b})},setValue:function(a){a||(a=[]);var b=this,c={},d=[];BI.each(a,function(a,e){var f=b.structure.search(e,"value");if(f){var g=f;for(g=g.getParent(),g&&(c[g.value]||(c[g.value]=0),c[g.value]++);g&&g.getChildrenLength()<=c[g.value];)d.push(g.value),g=g.getParent(),g&&(c[g.value]||(c[g.value]=0),c[g.value]++)}}),this.tree.setValue(BI.makeObject(a.concat(d)))},_getValue:function(){var a=[],b=this.tree.getValue(),c=function(b){BI.each(b,function(b,d){BI.isEmpty(d)?a.push(b):c(d)})};return c(b),a},empty:function(){this.tree.empty()},getValue:function(){var a=this,b=[],c=this._getValue();return BI.each(c,function(c,d){var e=a.structure.search(d,"value");e&&a.structure._traverse(e,function(a){a.isLeaf()&&b.push(a.value)})}),b}}),BI.SimpleTreeView.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.simple_tree",BI.SimpleTreeView),BI.EditorTrigger=BI.inherit(BI.Trigger,{_const:{hgap:4},_defaultConfig:function(){var a=BI.EditorTrigger.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-editor-trigger bi-border",height:24,validationChecker:BI.emptyFn,quitChecker:BI.emptyFn,allowBlank:!1,watermark:"",errorText:""})},_init:function(){this.options.height-=2,BI.EditorTrigger.superclass._init.apply(this,arguments);var a=this,b=this.options;this._const;this.editor=BI.createWidget({type:"bi.sign_editor",height:b.height,value:b.value,validationChecker:b.validationChecker,quitChecker:b.quitChecker,allowBlank:b.allowBlank,watermark:b.watermark,errorText:b.errorText}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.SignEditor.EVENT_CHANGE,function(){a.fireEvent(BI.EditorTrigger.EVENT_CHANGE,arguments)}),BI.createWidget({element:this,type:"bi.htape",items:[{el:this.editor},{el:{type:"bi.trigger_icon_button",cls:"bi-border-left",width:b.triggerWidth||b.height},width:b.triggerWidth||b.height}]})},getValue:function(){return this.editor.getValue()},setValue:function(a){this.editor.setValue(a)},setText:function(a){this.editor.setState(a)}}),BI.EditorTrigger.EVENT_CHANGE="BI.EditorTrigger.EVENT_CHANGE",BI.shortcut("bi.editor_trigger",BI.EditorTrigger),BI.IconTrigger=BI.inherit(BI.Trigger,{_defaultConfig:function(){return BI.extend(BI.IconTrigger.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-icon-trigger",el:{},height:24})},_init:function(){var a=this.options;BI.IconTrigger.superclass._init.apply(this,arguments),this.iconButton=BI.createWidget(a.el,{type:"bi.trigger_icon_button",element:this,width:a.width,height:a.height})}}),BI.shortcut("bi.icon_trigger",BI.IconTrigger),
BI.IconTextTrigger=BI.inherit(BI.Trigger,{_const:{hgap:4},_defaultConfig:function(){var a=BI.IconTextTrigger.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-text-trigger",height:24})},_init:function(){BI.IconTextTrigger.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._const;this.text=BI.createWidget({type:"bi.label",textAlign:"left",height:b.height,text:b.text,hgap:c.hgap}),this.trigerButton=BI.createWidget({type:"bi.trigger_icon_button",cls:"bi-border-left",width:b.triggerWidth||b.height}),BI.createWidget({element:this,type:"bi.htape",ref:function(b){a.wrapper=b},items:[{el:{type:"bi.icon_change_button",cls:"icon-combo-trigger-icon "+b.iconClass,ref:function(b){a.icon=b},disableSelected:!0},width:b.triggerWidth||b.height},{el:this.text},{el:this.trigerButton,width:b.triggerWidth||b.height}]})},setValue:function(a){this.text.setValue(a),this.text.setTitle(a)},setIcon:function(a){var b=this.options;this.icon.setIcon(a);var c=this.wrapper.attr("items")[0];BI.isNull(a)||BI.isEmptyString(a)?0!==c.width&&(c.width=0,this.wrapper.resize()):c.width!==(b.triggerWidth||b.height)&&(c.width=b.triggerWidth||b.height,this.wrapper.resize())},setText:function(a){this.text.setText(a),this.text.setTitle(a)}}),BI.shortcut("bi.icon_text_trigger",BI.IconTextTrigger),BI.SelectIconTextTrigger=BI.inherit(BI.Trigger,{_defaultConfig:function(){return BI.extend(BI.SelectIconTextTrigger.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-select-text-trigger bi-border",height:24})},_init:function(){this.options.height-=2,BI.SelectIconTextTrigger.superclass._init.apply(this,arguments);var a=this.options;this.trigger=BI.createWidget({type:"bi.icon_text_trigger",element:this,height:a.height}),BI.isKey(a.value)&&this.setValue(a.value)},setValue:function(a){var b=this.options;a=BI.isArray(a)?a:[a];var c,d=BI.Tree.transformToArrayFormat(this.options.items);BI.any(d,function(b,d){if(BI.deepContains(a,d.value))return c={text:d.text||d.value,iconClass:d.iconClass},!0}),BI.isNotNull(c)?(this.trigger.setText(c.text),this.trigger.setIcon(c.iconClass)):(this.trigger.setText(b.value),this.trigger.setIcon(""))},populate:function(a){this.options.items=a}}),BI.shortcut("bi.select_icon_text_trigger",BI.SelectIconTextTrigger),BI.TextTrigger=BI.inherit(BI.Trigger,{_const:{hgap:4},_defaultConfig:function(){var a=BI.TextTrigger.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-text-trigger",height:24})},_init:function(){BI.TextTrigger.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",textAlign:"left",height:a.height,text:a.text,hgap:b.hgap,readonly:a.readonly}),this.trigerButton=BI.createWidget({type:"bi.trigger_icon_button",cls:"bi-border-left",width:a.triggerWidth||a.height}),BI.createWidget({element:this,type:"bi.htape",items:[{el:this.text},{el:this.trigerButton,width:a.triggerWidth||a.height}]})},setValue:function(a){this.text.setValue(a),this.text.setTitle(a)},setText:function(a){this.text.setText(a),this.text.setTitle(a)}}),BI.shortcut("bi.text_trigger",BI.TextTrigger),BI.SelectTextTrigger=BI.inherit(BI.Trigger,{_defaultConfig:function(){return BI.extend(BI.SelectTextTrigger.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-select-text-trigger bi-border",height:24})},_init:function(){this.options.height-=2,BI.SelectTextTrigger.superclass._init.apply(this,arguments);var a=this.options;this.trigger=BI.createWidget({type:"bi.text_trigger",element:this,height:a.height}),BI.isKey(a.text)&&this.setValue(a.text)},setValue:function(a){var b=this.options;a=BI.isArray(a)?a:[a];var c=[],d=BI.Tree.transformToArrayFormat(this.options.items);BI.each(d,function(b,d){BI.deepContains(a,d.value)&&!c.contains(d.text||d.value)&&c.push(d.text||d.value)}),c.length>0?this.trigger.setText(c.join(",")):this.trigger.setText(b.text)},populate:function(a){this.options.items=a}}),BI.shortcut("bi.select_text_trigger",BI.SelectTextTrigger),BI.SmallSelectTextTrigger=BI.inherit(BI.Trigger,{_defaultConfig:function(){return BI.extend(BI.SmallSelectTextTrigger.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-small-select-text-trigger bi-border",height:20})},_init:function(){this.options.height-=2,BI.SmallSelectTextTrigger.superclass._init.apply(this,arguments);var a=this.options;this.trigger=BI.createWidget({type:"bi.small_text_trigger",element:this,height:a.height-2}),BI.isKey(a.text)&&this.setValue(a.text)},setValue:function(a){var b=this.options;a=BI.isArray(a)?a:[a];var c=[],d=BI.Tree.transformToArrayFormat(this.options.items);BI.each(d,function(b,d){BI.deepContains(a,d.value)&&!c.contains(d.text||d.value)&&c.push(d.text||d.value)}),c.length>0?(this.trigger.element.removeClass("bi-water-mark"),this.trigger.setText(c.join(","))):(this.trigger.element.addClass("bi-water-mark"),this.trigger.setText(b.text))},populate:function(a){this.options.items=a}}),BI.shortcut("bi.small_select_text_trigger",BI.SmallSelectTextTrigger),BI.SmallTextTrigger=BI.inherit(BI.Trigger,{_const:{hgap:4},_defaultConfig:function(){var a=BI.SmallTextTrigger.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-text-trigger",height:20})},_init:function(){BI.SmallTextTrigger.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",textAlign:"left",height:a.height,text:a.text,hgap:b.hgap}),this.trigerButton=BI.createWidget({type:"bi.trigger_icon_button",width:a.triggerWidth||a.height}),BI.createWidget({element:this,type:"bi.htape",items:[{el:this.text},{el:this.trigerButton,width:a.triggerWidth||a.height}]})},setValue:function(a){this.text.setValue(a)},setText:function(a){this.text.setText(a)}}),BI.shortcut("bi.small_text_trigger",BI.SmallTextTrigger),BI.SequenceTableTreeNumber=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SequenceTableTreeNumber.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-sequence-table-tree-number",isNeedFreeze:!1,startSequence:1,scrollTop:0,headerRowSize:25,rowSize:25,sequenceHeaderCreator:null,header:[],items:[],crossHeader:[],crossItems:[]})},_init:function(){BI.SequenceTableTreeNumber.superclass._init.apply(this,arguments);this.options;this.vCurr=1,this.hCurr=1,this.tasks=[],this.renderedCells=[],this.renderedKeys=[],this.container=BI.createWidget({type:"bi.absolute",width:60,scrollable:!1}),this.scrollContainer=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.container]}),this.headerContainer=BI.createWidget({type:"bi.absolute",cls:"bi-border",width:58,scrollable:!1}),this.layout=BI.createWidget({type:"bi.vtape",element:this,items:[{el:this.headerContainer,height:this._getHeaderHeight()-2},{el:{type:"bi.layout"},height:2},{el:this.scrollContainer}]}),this.start=this.options.startSequence,this.cache={},this._nextState(),this._populate()},_getNextSequence:function(a){function b(a){c.cache[a.text||a.value]||(c.cache[a.text||a.value]=e),e++}var c=this,d=this.start,e=this.start;return BI.each(a,function(a,f){BI.isNotEmptyArray(f.children)&&BI.each(f.children,function(a,f){0===a&&c.cache[f.text||f.value]&&(d=e=c.cache[f.text||f.value]),b(f)})}),this.start=e,d},_getStart:function(a){var b=this,c=this.start;return BI.some(a,function(a,d){if(BI.isNotEmptyArray(d.children))return BI.some(d.children,function(a,d){if(0===a&&b.cache[d.text||d.value])return c=b.cache[d.text||d.value],!0})}),c},_formatNumber:function(a){function b(a){var c=0;return BI.isNotEmptyArray(a.children)?(BI.each(a.children,function(a,d){c+=b(d)}),BI.isNotEmptyArray(a.values)&&c++):c++,c}var c=this.options,d=[],e=this._getStart(a),f=0,g=0;return BI.each(a,function(a,h){BI.isArray(h.children)&&(BI.each(h.children,function(a,h){var i=b(h);d.push({text:e++,start:f,top:g,cnt:i,index:a,height:i*c.rowSize}),f+=i,g+=i*c.rowSize}),BI.isNotEmptyArray(h.values)&&(d.push({text:BI.i18nText("BI-Summary_Values"),start:f++,top:g,cnt:1,isSummary:!0,height:c.rowSize}),g+=c.rowSize))}),d},_layout:function(){var a=this.options,b=this._getHeaderHeight()-2,c=this.layout.attr("items");a.isNeedFreeze===!1?(c[0].height=0,c[1].height=0):a.isNeedFreeze===!0&&(c[0].height=b,c[1].height=2),this.layout.attr("items",c),this.layout.resize();try{this.scrollContainer.element.scrollTop(a.scrollTop)}catch(d){}},_getHeaderHeight:function(){var a=this.options;return a.headerRowSize*(a.crossHeader.length+(a.header.length>0?1:0))},_nextState:function(){var a=this.options;this._getNextSequence(a.items)},_prevState:function(){var a,b=this.options;BI.some(b.items,function(b,c){if(BI.isNotEmptyArray(c.children))return BI.some(c.children,function(b,c){return a=c,!0})}),a&&BI.isNotEmptyObject(this.cache)?this.start=this.cache[a.text||a.value]:this.start=1,this._nextState()},_getMaxScrollTop:function(a){var b=0;return BI.each(a,function(a,c){b+=c.cnt}),Math.max(0,b*this.options.rowSize-(this.options.height-this._getHeaderHeight())+BI.DOM.getScrollWidth())},_createHeader:function(){var a=this.options;BI.createWidget({type:"bi.absolute",element:this.headerContainer,items:[{el:a.sequenceHeaderCreator||{type:"bi.table_style_cell",cls:"sequence-table-title-cell",styleGetter:a.headerCellStyleGetter,text:BI.i18nText("BI-Number_Index")},left:0,top:0,right:0,bottom:0}]})},_calculateChildrenToRender:function(){var a=this,b=this.options,c=[],d=[],e=this._formatNumber(b.items),f=BI.PrefixIntervalTree.uniform(e.length,0);BI.each(e,function(a,b){f.set(a,b.height)});for(var g=BI.clamp(b.scrollTop,0,this._getMaxScrollTop(e)),h=f.greatestLowerBound(g),i=-(g-(h>0?f.sumTo(h-1):0)),j=i,k=b.height-this._getHeaderHeight();j<k&&h<e.length;)d.push(h),i+=e[h].height,j+=e[h].height,h++;BI.each(d,function(d,f){var g=BI.deepIndexOf(a.renderedKeys,f);if(g>-1)e[f].height!==a.renderedCells[g]._height&&(a.renderedCells[g]._height=e[f].height,a.renderedCells[g].el.setHeight(e[f].height)),e[f].top!==a.renderedCells[g].top&&(a.renderedCells[g].top=e[f].top,a.renderedCells[g].el.element.css("top",e[f].top+"px")),c.push(a.renderedCells[g]);else{var h=BI.createWidget(BI.extend({type:"bi.table_style_cell",cls:"sequence-table-number-cell bi-border-left bi-border-right bi-border-bottom",width:60,styleGetter:e[f].isSummary===!0?function(){return b.summaryCellStyleGetter(!0)}:function(a){return function(){return b.sequenceCellStyleGetter(a)}}(e[f].index)},e[f]));c.push({el:h,left:0,top:e[f].top,_height:e[f].height})}});var l={},m={},n=[];BI.each(d,function(b,c){BI.deepContains(a.renderedKeys,c)?l[b]=c:m[b]=c}),BI.each(this.renderedKeys,function(a,b){BI.deepContains(l,b)||BI.deepContains(m,b)||n.push(a)}),BI.each(n,function(b,c){a.renderedCells[c].el.destroy()});var o=[];BI.each(m,function(a){o.push(c[a])}),BI.createWidget({type:"bi.absolute",element:this.container,items:o}),this.renderedCells=c,this.renderedKeys=d,this.container.setHeight(f.sumUntil(e.length))},_restore:function(){BI.each(this.renderedCells,function(a,b){b.el.destroy()}),this.renderedCells=[],this.renderedKeys=[]},_populate:function(){var a=this;BI.each(this.tasks,function(b,c){c.apply(a)}),this.tasks=[],this.headerContainer.empty(),this._createHeader(),this._layout(),this._calculateChildrenToRender()},setVerticalScroll:function(a){if(this.options.scrollTop!==a){this.options.scrollTop=a;try{this.scrollContainer.element.scrollTop(a)}catch(b){}}},getVerticalScroll:function(){return this.options.scrollTop},setVPage:function(a){a<=1?(this.cache={},this.start=this.options.startSequence,this._restore(),this.tasks.push(this._nextState)):a===this.vCurr+1?this.tasks.push(this._nextState):a===this.vCurr-1&&this.tasks.push(this._prevState),this.vCurr=a},setHPage:function(a){a!==this.hCurr&&this.tasks.push(this._prevState),this.hCurr=a},restore:function(){this._restore()},populate:function(a,b,c,d){var e=this.options;a&&a!==this.options.items&&(e.items=a,this._restore(),this.tasks.push(this._prevState)),b&&b!==this.options.header&&(e.header=b),c&&c!==this.options.crossItems&&(e.crossItems=c),d&&d!==this.options.crossHeader&&(e.crossHeader=d),this._populate()}}),BI.shortcut("bi.sequence_table_tree_number",BI.SequenceTableTreeNumber),BI.AdaptiveArrangement=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.AdaptiveArrangement.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-adaptive-arrangement",resizable:!0,layoutType:BI.Arrangement.LAYOUT_TYPE.FREE,items:[]})},_init:function(){BI.AdaptiveArrangement.superclass._init.apply(this,arguments);var a=this,b=this.options;this.arrangement=BI.createWidget({type:"bi.arrangement",element:this,layoutType:b.layoutType,items:b.items}),this.arrangement.on(BI.Arrangement.EVENT_SCROLL,function(){a.fireEvent(BI.AdaptiveArrangement.EVENT_SCROLL,arguments)}),this.zIndex=0,BI.each(b.items,function(b,c){a._initResizable(c.el)}),$(document).mousedown(function(b){BI.each(a.getAllRegions(),function(a,c){0===c.el.element.find(b.target).length&&c.el.element.removeClass("selected")})}),BI.ResizeDetector.addResizeListener(this,function(){a.arrangement.resize(),a.fireEvent(BI.AdaptiveArrangement.EVENT_RESIZE)})},_isEqual:function(){return this.arrangement._isEqual.apply(this.arrangement,arguments)},_setSelect:function(a){a.element.hasClass("selected")||(a.element.css("zIndex",++this.zIndex),BI.each(this.getAllRegions(),function(a,b){b.el.element.removeClass("selected")}),a.element.addClass("selected"))},_initResizable:function(a){var b=this;this.options;a.element.css("zIndex",++this.zIndex),a.element.mousedown(function(){b._setSelect(a)})},_getScrollOffset:function(){return this.arrangement._getScrollOffset()},getClientWidth:function(){return this.arrangement.getClientWidth()},getClientHeight:function(){return this.arrangement.getClientHeight()},addRegion:function(a,b){this._initResizable(a.el),this._setSelect(a.el);var c,d=this.arrangement.getAllRegions();return(c=this.arrangement.addRegion(a,b))&&(this._old=d),c},deleteRegion:function(a){var b,c=this.getAllRegions();return(b=this.arrangement.deleteRegion(a))?this._old=c:(this._old=this.getAllRegions(),this.relayout()),b},setRegionSize:function(a,b){var c,d=this.getAllRegions();return(c=this.arrangement.setRegionSize(a,b))&&(this._old=d),c},setPosition:function(a,b){return this.arrangement.setPosition(a,b)},setRegionPosition:function(a,b){this.getRegionByName(a);return this.arrangement.setRegionPosition(a,b)},setDropPosition:function(a,b){return this.arrangement.setDropPosition(a,b)},scrollInterval:function(a,b,c,d){d({offsetX:0,offsetY:0})},scrollEnd:function(){this.lastActiveRegion="",this._scrollInterval&&(clearInterval(this._scrollInterval),this._scrollInterval=null)},scrollTo:function(a){this.arrangement.scrollTo(a)},zoom:function(a){this.arrangement.zoom(a)},resize:function(){this.arrangement.resize()},relayout:function(){return this.arrangement.relayout()},setLayoutType:function(a){this.arrangement.setLayoutType(a)},getLayoutType:function(){return this.arrangement.getLayoutType()},getLayoutRatio:function(){return this.arrangement.getLayoutRatio()},getHelper:function(){return this.arrangement.getHelper()},getRegionByName:function(a){return this.arrangement.getRegionByName(a)},getAllRegions:function(){return this.arrangement.getAllRegions()},revoke:function(){this._old&&this.populate(BI.toArray(this._old))},populate:function(a){var b=this;BI.each(a,function(a,c){b._initResizable(c.el)}),this.arrangement.populate(a)}}),BI.AdaptiveArrangement.EVENT_ELEMENT_START_RESIZE="AdaptiveArrangement.EVENT_ELEMENT_START_RESIZE",BI.AdaptiveArrangement.EVENT_ELEMENT_RESIZE="AdaptiveArrangement.EVENT_ELEMENT_RESIZE",BI.AdaptiveArrangement.EVENT_ELEMENT_STOP_RESIZE="AdaptiveArrangement.EVENT_ELEMENT_STOP_RESIZE",BI.AdaptiveArrangement.EVENT_RESIZE="AdaptiveArrangement.EVENT_RESIZE",BI.AdaptiveArrangement.EVENT_SCROLL="AdaptiveArrangement.EVENT_SCROLL",BI.shortcut("bi.adaptive_arrangement",BI.AdaptiveArrangement),BI.ArrangementBlock=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ArrangementBlock.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-arrangement-block bi-mask"})}}),BI.shortcut("bi.arrangement_block",BI.ArrangementBlock),BI.ArrangementDroppable=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.ArrangementDroppable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-arrangement-droppable bi-resizer"})}}),BI.shortcut("bi.arrangement_droppable",BI.ArrangementDroppable),BI.Arrangement=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Arrangement.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-arrangement",layoutType:BI.Arrangement.LAYOUT_TYPE.GRID,items:[]})},_init:function(){BI.Arrangement.superclass._init.apply(this,arguments);var a=this,b=this.options;this.arrangement=BI.createWidget({type:"bi.arrangement_droppable",cls:"arrangement-block",invisible:!0}),this.block=BI.createWidget({type:"bi.arrangement_block",invisible:!0}),this.container=BI.createWidget({type:"bi.absolute",scrollable:!0,cls:"arrangement-container",items:b.items.concat([this.block,this.arrangement])}),this.container.element.scroll(function(){a.fireEvent(BI.Arrangement.EVENT_SCROLL,{scrollLeft:a.container.element.scrollLeft(),scrollTop:a.container.element.scrollTop(),clientWidth:a.container.element[0].clientWidth,clientHeight:a.container.element[0].clientHeight})}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.container,left:0,right:0,top:0,bottom:0}]}),this.regions={},b.items.length>0&&BI.nextTick(function(){a.populate(b.items)})},_calculateRegions:function(a){var b=this;this.options;this.regions={},BI.each(a,function(a,c){var d=b._createOneRegion(c);b.regions[d.id]=d})},_isEqual:function(a,b){return Math.abs(a-b)<2},_isLessThan:function(a,b){return a<b&&!this._isEqual(a,b)},_isMoreThan:function(a,b){return a>b&&!this._isEqual(a,b)},_isLessThanEqual:function(a,b){return a<=b||this._isEqual(a,b)},_isMoreThanEqual:function(a,b){return a>=b||this._isEqual(a,b)},_getRegionOccupied:function(a){this.options;if(BI.size(a||this.regions)<=0)return{left:0,top:0,width:0,height:0};var b=BI.MAX,c=BI.MIN,d=BI.MAX,e=BI.MIN;return BI.each(a||this.regions,function(a,f){b=Math.min(b,f.left),c=Math.max(c,f.left+f.width),d=Math.min(d,f.top),e=Math.max(e,f.top+f.height)}),{left:b,top:d,width:c-b,height:e-d}},_getCrossArea:function(a,b){if(a.left<=b.left){if(a.top<=b.top){if(a.top+a.height>b.top&&a.left+a.width>b.left)return this._isEqual(a.top+a.height,b.top)||this._isEqual(a.left+a.width,b.left)?0:(a.top+a.height-b.top)*(a.left+a.width-b.left)}else if(b.top+b.height>a.top&&a.left+a.width>b.left)return this._isEqual(b.top+b.height,a.top)||this._isEqual(a.left+a.width,b.left)?0:(b.top+b.height-a.top)*(a.left+a.width-b.left)}else if(a.top<=b.top){if(a.top+a.height>b.top&&b.left+b.width>a.left)return this._isEqual(a.top+a.height,b.top)||this._isEqual(b.left+b.width,a.left)?0:(a.top+a.height-b.top)*(b.left+b.width-a.left)}else if(b.top+b.height>a.top&&b.left+b.width>a.left)return this._isEqual(b.top+b.height,a.top)||this._isEqual(b.left+b.width,a.left)?0:(b.top+b.height-a.top)*(b.left+b.width-a.left);return 0},_isRegionOverlay:function(a){var b=[];BI.each(a||this.regions,function(a,c){b.push(new BI.Region(c.left,c.top,c.width,c.height))});for(var c=0,d=b.length;c<d;c++)for(var e=c+1;e<d;e++){var f={left:b[c].x,top:b[c].y,width:b[c].w,height:b[c].h},g={left:b[e].x,top:b[e].y,width:b[e].w,height:b[e].h};if(b[c].isIntersects(b[e])&&this._getCrossArea(f,g)>1)return!0}return!1},_isArrangeFine:function(a){switch(this.options.layoutType){case BI.Arrangement.LAYOUT_TYPE.FREE:return!0;case BI.Arrangement.LAYOUT_TYPE.GRID:}return!0},_getRegionNames:function(a){var b=[];return BI.each(a||this.regions,function(a,c){b.push(c.id||c.attr("id"))}),b},_getRegionsByNames:function(a,b){if(a=BI.isArray(a)?a:[a],b=b||this.regions,BI.isArray(b)){var c=[];BI.each(b,function(b,d){a.contains(d.id||d.attr("id"))&&c.push(d)})}else{var c={};BI.each(a,function(a,d){c[d]=b[d]})}return c},_cloneRegion:function(a){var b={};return BI.each(a||this.regions,function(a,c){b[a]={},b[a].el=c.el,b[a].id=c.id,b[a].left=c.left,b[a].top=c.top,b[a].width=c.width,b[a].height=c.height}),b},_test:function(a){return!BI.any(a||this.regions,function(a,b){if(BI.isNaN(b.width)||BI.isNaN(b.height)||b.width<=21||b.height<=21)return!0})},_getScrollOffset:function(){return{left:this.container.element[0].scrollLeft,top:this.container.element[0].scrollTop}},_createOneRegion:function(a){var b=BI.createWidget(a.el);return b.setVisible(!0),{id:b.attr("id"),left:a.left,top:a.top,width:a.width,height:a.height,el:b}},_applyRegion:function(a){this.options;BI.each(a||this.regions,function(a,b){b.el.element.css({left:b.left,top:b.top,width:b.width,height:b.height})}),this._applyContainer(),this.ratio=this.getLayoutRatio()},_renderRegion:function(){var a=BI.toArray(this.regions);BI.each(a,function(a,b){BI.isNotNull(b.el)?b.el.options.key=b.id:b.key=b.id}),BI.isNull(this.wrapper)&&(this.wrapper=BI.createWidget({type:"bi.absolute",element:this.container})),this.wrapper.addItems(a)},getClientWidth:function(){return this.container.element[0].clientWidth},getClientHeight:function(){return this.container.element[0].clientHeight},_applyContainer:function(){var a=this._getRegionOccupied();return a},_modifyRegion:function(a){BI.each(this.regions,function(b,c){a[b]&&(c.left=a[b].left,c.top=a[b].top,c.width=a[b].width,c.height=a[b].height)})},_addRegion:function(a){var b=this._createOneRegion(a);this.regions[b.id]=b,BI.createWidget({type:"bi.absolute",element:this.container,items:[b]})},_deleteRegionByName:function(a){this.regions[a].el.setVisible(!1),delete this.regions[a]},_setArrangeSize:function(a){this.arrangement.element.css({left:a.left,top:a.top,width:a.width,height:a.height})},_getOneWidthPortion:function(){return this.getClientWidth()/BI.Arrangement.PORTION},_getOneHeightPortion:function(){return this.getClientHeight()/BI.Arrangement.H_PORTION},_getGridPositionAndSize:function(a){var b=this._getOneWidthPortion(),c=this._getOneHeightPortion(),d=Math.round(a.width/b),e=Math.round(a.left/b),f=Math.round(a.top/c),g=Math.round(a.height/c);return 0===d&&(d=1),0===g&&(g=1),{x:e,y:f,w:d,h:g}},_getBlockPositionAndSize:function(a){var b=this._getOneWidthPortion(),c=this._getOneHeightPortion();return{left:a.x*b,top:a.y*c,width:a.w*b,height:a.h*c}},_getLayoutsByRegions:function(a){var b=this,c=[];return BI.each(a||this.regions,function(a,d){c.push(BI.extend(b._getGridPositionAndSize(d),{i:d.id}))}),c},_getLayoutIndexByName:function(a,b){return BI.findIndex(a,function(a,c){return c.i===b})},_setBlockPositionAndSize:function(a){this.block.element.css({left:a.left,top:a.top,width:a.width,height:a.height})},_getRegionsByLayout:function(a){var b=this,c={};return BI.each(a,function(a,d){c[d.i]=BI.extend(b._getBlockPositionAndSize(d),{id:d.i})}),c},_setRegionsByLayout:function(a,b){var c=this;return a||(a=this.regions),BI.each(b,function(b,d){a[d.i]&&BI.extend(a[d.i],c._getBlockPositionAndSize(d))}),a},_moveElement:function(a,b,c,d,e){function f(a,b){return BI.filter(a,function(a,c){return g._collides(c,b)})}var g=this;if(b._static)return a;if(b.y===d&&b.x===c)return a;var h=d&&b.y>d;"number"==typeof c&&(b.x=c),"number"==typeof d&&(b.y=d),b.moved=!0;var i=this._sortLayoutItemsByRowCol(a);h&&(i=i.reverse());for(var j=f(i,b),k=0,l=j.length;k<l;k++){var m=j[k];m.moved||b.y>m.y&&b.y-m.y>m.h/4||(a=m._static?this._moveElementAwayFromCollision(a,m,b,e):this._moveElementAwayFromCollision(a,b,m,e))}return a},_sortLayoutItemsByRowCol:function(a){return[].concat(a).sort(function(a,b){return a.y>b.y||a.y===b.y&&a.x>b.x?1:-1})},_collides:function(a,b){return a!==b&&(!(a.x+a.w<=b.x)&&(!(a.x>=b.x+b.w)&&(!(a.y+a.h<=b.y)&&!(a.y>=b.y+b.h))))},_getFirstCollision:function(a,b){for(var c=0,d=a.length;c<d;c++)if(this._collides(a[c],b))return a[c]},_moveElementAwayFromCollision:function(a,b,c,d){if(d){var e={x:c.x,y:c.y,w:c.w,h:c.h,i:"-1"};if(e.y=Math.max(b.y-c.h,0),!this._getFirstCollision(a,e))return this._moveElement(a,c,void 0,e.y)}return this._moveElement(a,c,void 0,c.y+1)},_compactItem:function(a,b,c){if(c)for(;b.y>0&&!this._getFirstCollision(a,b);)b.y--;for(var d;d=this._getFirstCollision(a,b);)b.y=d.y+d.h;return b},compact:function(a,b){function c(a){return BI.filter(a,function(a,b){return b._static})}for(var d=c(a),e=this._sortLayoutItemsByRowCol(a),f=[],g=0,h=e.length;g<h;g++){var i=e[g];i._static||(i=this._compactItem(d,i,b),d.push(i)),f[a.indexOf(i)]=i,i.moved=!1}return f},getRegionByName:function(a){var b={};return b[a]=this.regions[a],this._cloneRegion(b)[a]},getAllRegions:function(){return BI.toArray(this._cloneRegion())},getHelper:function(){var a=BI.createWidget({type:"bi.layout",width:18,height:18,cls:"arrangement-helper bi-border"});return BI.createWidget({type:"bi.absolute",element:this,items:[a]}),a},_start:function(){this.options.layoutType===BI.Arrangement.LAYOUT_TYPE.GRID?this.block.setVisible(!0):this.arrangement.setVisible(!0)},_stop:function(){this.arrangement.setVisible(!1),this.block.setVisible(!1)},setLayoutType:function(a){var b=this.options;if(a!==b.layoutType)switch(b.layoutType=a,b.layoutType){case BI.Arrangement.LAYOUT_TYPE.FREE:break;case BI.Arrangement.LAYOUT_TYPE.GRID:this.relayout()}},getLayoutType:function(){return this.options.layoutType},getLayoutRatio:function(){var a=this._getRegionOccupied(),b=this.getClientWidth(),c=this.getClientHeight();return{x:BI.parseFloat(BI.contentFormat((a.left+a.width)/b,"#.##;-#.##")),y:BI.parseFloat(BI.contentFormat((a.top+a.height)/c,"#.##;-#.##"))}},addRegion:function(a,b){b&&this.setPosition(b,a);this.options;if(!this.position)return!1;var c=this._cloneRegion();BI.each(this.position.regions,function(a,b){c[b.id].left=b.left,c[b.id].top=b.top,c[b.id].width=b.width,c[b.id].height=b.height});var d=BI.extend({},a,{left:this.position.insert.left,top:this.position.insert.top,width:this.position.insert.width,height:this.position.insert.height}),e=this._createOneRegion(d);return c[e.id]=e,!!this._test(c)&&(delete c[e.id],this._modifyRegion(c),this._addRegion(d),this._populate(this.getAllRegions()),!0)},deleteRegion:function(a){if(!this.regions[a])return!1;var b=this.options;switch(b.layoutType){case BI.Arrangement.LAYOUT_TYPE.FREE:return this._deleteRegionByName(a),this._populate(this.getAllRegions()),!0;case BI.Arrangement.LAYOUT_TYPE.GRID:return this._deleteRegionByName(a),this._populate(this.getAllRegions()),this.resize(),!0}return!1},setRegionSize:function(a,b){var c=this.options,d=!1;switch(c.layoutType){case BI.Arrangement.LAYOUT_TYPE.FREE:var e=this._cloneRegion();BI.extend(e[a],{width:b.width,height:b.height}),this._test(e)&&(this._modifyRegion(e),d=!0);break;case BI.Arrangement.LAYOUT_TYPE.GRID:var e=this._cloneRegion();if(BI.extend(e[a],{width:b.width,height:b.height}),this._test(e)){var f=this._getLayoutsByRegions(e);f=this.compact(f,!0);var g=this._getRegionsByLayout(f);this._modifyRegion(g),d=!0}}return this._applyRegion(),d},setPosition:function(a,b){var c,d,e=this.options,f=[];if(a.left<0||a.top<0){switch(e.layoutType){case BI.Arrangement.LAYOUT_TYPE.FREE:break;case BI.Arrangement.LAYOUT_TYPE.GRID:this.resize()}return this._stop(),this.position=null,null}var g=this._getScrollOffset();switch(a={left:a.left+g.left,top:a.top+g.top},e.layoutType){case BI.Arrangement.LAYOUT_TYPE.FREE:var c={top:a.top<0?0:a.top,left:a.left<0?0:a.left,width:b.width,height:b.height};this.position={insert:c},this._setArrangeSize(c),this._start();break;case BI.Arrangement.LAYOUT_TYPE.GRID:var h={top:a.top<0?0:a.top,left:a.left<0?0:a.left,width:b.width,height:b.height};this._setArrangeSize(h);var d=this._getGridPositionAndSize(h),i=[{x:0,y:BI.MAX,w:d.w,h:d.h,i:d.i}].concat(this._getLayoutsByRegions());i=this._moveElement(i,i[0],d.x,d.y,!0),i=this.compact(i,!0);var f=this._setRegionsByLayout(this._cloneRegion(),i),c=this._getBlockPositionAndSize(i[0]);this.position={insert:c,regions:f},this._applyRegion(f),this._setBlockPositionAndSize(c),this._start()}return this.position},setRegionPosition:function(a,b){var c=this.options,d=this._getScrollOffset();switch(b=BI.extend(b,{left:b.left+d.left,top:b.top+d.top}),c.layoutType){case BI.Arrangement.LAYOUT_TYPE.FREE:BI.extend(this.regions[a],{left:b.left<0?0:b.left,top:b.top<0?0:b.top}),this._applyRegion();break;case BI.Arrangement.LAYOUT_TYPE.GRID:if(b.stop){BI.extend(this.regions[a],{left:b.left<0?0:b.left,top:b.top<0?0:b.top});var e=this._cloneRegion(),f=this._getLayoutsByRegions(e);f=this.compact(f,!0);var g=this._getRegionsByLayout(f);this._modifyRegion(g),this._applyRegion(),this.block.setVisible(!1)}else{BI.extend(this.regions[a],{left:b.left<0?0:b.left,top:b.top<0?0:b.top});var e=this._cloneRegion(),h=this._getGridPositionAndSize(BI.extend(e[a],{left:b.left<0?0:b.left,top:b.top<0?0:b.top})),i=h.x,j=h.y;h=BI.extend(h,{x:0,y:BI.MAX,i:-1}),delete e[a];var f=this._getLayoutsByRegions(e);f=this._moveElement([h].concat(f),h,i,j,!0),f=this.compact(f,!0);var g=this._getRegionsByLayout(f);this._modifyRegion(g),this._applyRegion(),this._setBlockPositionAndSize(this._getBlockPositionAndSize(h)),this.block.setVisible(!0)}}},setDropPosition:function(a,b){var c=this;this.arrangement.setVisible(!0);var d=this._getScrollOffset();return this._setArrangeSize(BI.extend({},b,{left:a.left+d.left,top:a.top+d.top})),function(){c.arrangement.setVisible(!1)}},scrollTo:function(a){this.container.element.scrollTop(a.top),this.container.element.scrollLeft(a.left)},zoom:function(a){var b=this;this.options;if(a){var c=this._applyContainer();switch(this.getLayoutType()){case BI.Arrangement.LAYOUT_TYPE.FREE:if(this._isArrangeFine()){var d=this.getClientWidth(),e=(a.x||1)*d/(c.left+c.width),f=this._cloneRegion();BI.each(f,function(a,b){b.left=b.left*e,b.width=b.width*e}),this._test(f)&&(this._modifyRegion(f),this._applyRegion()),this.resize(),this.relayout()}break;case BI.Arrangement.LAYOUT_TYPE.GRID:if(this._isArrangeFine()){var d=this.getClientWidth(),g=this.getClientHeight(),e=(a.x||1)*d/(c.left+c.width),h=(a.y||1)*g/(c.top+c.height),f=this._cloneRegion();if(BI.each(f,function(a,c){c.left=c.left*e,c.width=c.width*e,c.top=c.top*h,c.height=c.height*h;var d=b._getOneWidthPortion(),f=Math.round(c.width/d),g=Math.round(c.left/d),i=Math.round((c.width+c.left)/d);g+f!==i&&(c.left=g*d,c.width=i*d-c.left)}),this._test(f)){var i=this._getLayoutsByRegions(f);i=this.compact(i,!0),f=this._getRegionsByLayout(i),this._modifyRegion(f),this._applyRegion()}}else this.relayout()}}},resize:function(){var a=this.options;switch(a.layoutType){case BI.Arrangement.LAYOUT_TYPE.FREE:break;case BI.Arrangement.LAYOUT_TYPE.GRID:this.zoom(this.ratio);var b=this._cloneRegion(),c=this._getLayoutsByRegions(b);c=this.compact(c,!0),b=this._getRegionsByLayout(c),this._modifyRegion(b),this._applyRegion()}},relayout:function(){var a=this,b=this.options;switch(b.layoutType){case BI.Arrangement.LAYOUT_TYPE.FREE:break;case BI.Arrangement.LAYOUT_TYPE.GRID:if(this._isArrangeFine())this.resize();else{var c=this._getOneHeightPortion(),d=this.getClientWidth(),e=(this.getClientHeight(),this._cloneRegion()),f=BI.toArray(e);f.sort(function(b,c){return a._isEqual(b.top,c.top)?b.left-c.left:b.top-c.top});var g=f.length,h=4,i=(Math.floor((g-1)/4+1),d/h),j={};if(BI.each(f,function(a,b){var d=Math.floor(a/4),e=a%4;BI.extend(b,{top:d*c*6,left:e*i,width:i,height:6*c}),j[d]||(j[d]={}),j[d][e]=b}),this._test(f)){var k=this._getLayoutsByRegions(e);k=this.compact(k,!0),e=this._getRegionsByLayout(k),this._modifyRegion(e),this._populate(f)}}}},_populate:function(a){this._stop(),this._calculateRegions(a),this._applyRegion()},populate:function(a){var b=this;BI.each(this.regions,function(c,d){var e=BI.some(a,function(a,b){return b.el.attr("id")===c});e||b.regions[c].el.setVisible(!1),delete b.regions[c]}),this._populate(a),this._renderRegion()}}),BI.Arrangement.EVENT_SCROLL="EVENT_SCROLL",BI.extend(BI.Arrangement,{PORTION:36,H_PORTION:18,LAYOUT_TYPE:{GRID:0,FREE:1}}),BI.shortcut("bi.arrangement",BI.Arrangement),BI.MonthDateCombo=BI.inherit(BI.Trigger,{
_defaultConfig:function(){return BI.extend(BI.MonthDateCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-month-combo",height:25})},_init:function(){BI.MonthDateCombo.superclass._init.apply(this,arguments);var a=this;this.options;this.trigger=BI.createWidget({type:"bi.date_triangle_trigger"}),this.popup=BI.createWidget({type:"bi.month_popup"}),this.popup.on(BI.YearPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue())}),this.combo=BI.createWidget({type:"bi.combo",offsetStyle:"center",element:this,isNeedAdjustHeight:!1,isNeedAdjustWidth:!1,el:this.trigger,popup:{minWidth:85,stopPropagation:!1,el:this.popup}}),this.combo.on(BI.Combo.EVENT_CHANGE,function(){a.combo.hideView(),a.fireEvent(BI.MonthDateCombo.EVENT_CHANGE)})},setValue:function(a){this.trigger.setValue(a+1),this.popup.setValue(a)},getValue:function(){return this.popup.getValue()}}),BI.MonthDateCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.month_date_combo",BI.MonthDateCombo),BI.YearDateCombo=BI.inherit(BI.Trigger,{_defaultConfig:function(){return BI.extend(BI.YearDateCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-year-combo",min:"1900-01-01",max:"2099-12-31",height:25})},_init:function(){BI.YearDateCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget({type:"bi.date_triangle_trigger"}),this.popup=BI.createWidget({type:"bi.year_popup",min:b.min,max:b.max}),this.popup.on(BI.YearPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.combo.hideView(),a.fireEvent(BI.YearDateCombo.EVENT_CHANGE)}),this.combo=BI.createWidget({type:"bi.combo",offsetStyle:"center",element:this,isNeedAdjustHeight:!1,isNeedAdjustWidth:!1,el:this.trigger,popup:{minWidth:85,stopPropagation:!1,el:this.popup}}),this.combo.on(BI.Combo.EVENT_CHANGE,function(){a.fireEvent(BI.YearDateCombo.EVENT_CHANGE)})},setValue:function(a){this.trigger.setValue(a),this.popup.setValue(a)},getValue:function(){return this.popup.getValue()}}),BI.YearDateCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.year_date_combo",BI.YearDateCombo),BI.DatePicker=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.DatePicker.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:"bi-date-picker bi-background",height:25,min:"1900-01-01",max:"2099-12-31"})},_init:function(){BI.DatePicker.superclass._init.apply(this,arguments);var a=this,b=this.options;this._year=Date.getDate().getFullYear(),this._month=Date.getDate().getMonth(),this.left=BI.createWidget({type:"bi.icon_button",cls:"pre-page-h-font",width:25,height:25}),this.left.on(BI.IconButton.EVENT_CHANGE,function(){0===a._month?a.setValue({year:a.year.getValue()-1,month:11}):a.setValue({year:a.year.getValue(),month:a.month.getValue()-1}),a.fireEvent(BI.DatePicker.EVENT_CHANGE),a._checkLeftValid(),a._checkRightValid()}),this.right=BI.createWidget({type:"bi.icon_button",cls:"next-page-h-font",width:25,height:25}),this.right.on(BI.IconButton.EVENT_CHANGE,function(){11===a._month?a.setValue({year:a.year.getValue()+1,month:0}):a.setValue({year:a.year.getValue(),month:a.month.getValue()+1}),a.fireEvent(BI.DatePicker.EVENT_CHANGE),a._checkLeftValid(),a._checkRightValid()}),this.year=BI.createWidget({type:"bi.year_date_combo",min:b.min,max:b.max}),this.year.on(BI.YearDateCombo.EVENT_CHANGE,function(){a.setValue({year:a.year.getValue(),month:a.month.getValue()}),a.fireEvent(BI.DatePicker.EVENT_CHANGE)}),this.month=BI.createWidget({type:"bi.month_date_combo"}),this.month.on(BI.MonthDateCombo.EVENT_CHANGE,function(){a.setValue({year:a.year.getValue(),month:a.month.getValue()}),a.fireEvent(BI.DatePicker.EVENT_CHANGE)}),BI.createWidget({type:"bi.htape",element:this,items:[{el:this.left,width:25},{type:"bi.center_adapt",items:[{type:"bi.horizontal",width:100,items:[this.year,this.month]}]},{el:this.right,width:25}]}),this.setValue({year:this._year,month:this._month})},_checkLeftValid:function(){var a=this.options,b=!(0===this._month&&this._year===Date.parseDateTime(a.min,"%Y-%X-%d").getFullYear());return this.left.setEnable(b),b},_checkRightValid:function(){var a=this.options,b=!(11===this._month&&this._year===Date.parseDateTime(a.max,"%Y-%X-%d").getFullYear());return this.right.setEnable(b),b},setValue:function(a){this._year=a.year,this._month=a.month,this.year.setValue(a.year),this.month.setValue(a.month),this._checkLeftValid(),this._checkRightValid()},getValue:function(){return{year:this.year.getValue(),month:this.month.getValue()}}}),BI.DatePicker.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.date_picker",BI.DatePicker),BI.DateCalendarPopup=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.DateCalendarPopup.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:"bi-date-calendar-popup",min:"1900-01-01",max:"2099-12-31",selectedTime:null})},_createNav:function(a){var b=BI.Calendar.getDateJSONByPage(a),c=BI.createWidget({type:"bi.calendar",logic:{dynamic:!0},min:this.options.min,max:this.options.max,year:b.year,month:b.month,day:this.selectedTime.day});return c},_init:function(){BI.DateCalendarPopup.superclass._init.apply(this,arguments);var a=this,b=this.options;this.today=Date.getDate(),this._year=this.today.getFullYear(),this._month=this.today.getMonth(),this._day=this.today.getDate(),this.selectedTime=b.selectedTime||{year:this._year,month:this._month,day:this._day},this.datePicker=BI.createWidget({type:"bi.date_picker",min:b.min,max:b.max}),this.calendar=BI.createWidget({direction:"top",element:this,logic:{dynamic:!0},type:"bi.navigation",tab:this.datePicker,cardCreator:BI.bind(this._createNav,this),afterCardCreated:function(){},afterCardShow:function(){this.setValue(a.selectedTime)}}),this.datePicker.on(BI.DatePicker.EVENT_CHANGE,function(){a.selectedTime=a.datePicker.getValue(),a.selectedTime.day=1,a.calendar.setSelect(BI.Calendar.getPageByDateJSON(a.selectedTime))}),this.calendar.on(BI.Navigation.EVENT_CHANGE,function(){a.selectedTime=a.calendar.getValue(),a.setValue(a.selectedTime),a.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE)})},setValue:function(a){this.datePicker.setValue(a),this.calendar.setSelect(BI.Calendar.getPageByDateJSON(a)),this.calendar.setValue(a),this.selectedTime=a},getValue:function(){return this.selectedTime}}),BI.DateCalendarPopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.date_calendar_popup",BI.DateCalendarPopup),BI.DateTriangleTrigger=BI.inherit(BI.Trigger,{_const:{height:25,iconWidth:16,iconHeight:13},_defaultConfig:function(){return BI.extend(BI.DateTriangleTrigger.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-date-triangle-trigger pull-down-ha-font cursor-pointer",height:25})},_init:function(){BI.DateTriangleTrigger.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",cls:"list-item-text",textAlign:"right",text:a.text,value:a.value,height:b.height}),this.icon=BI.createWidget({type:"bi.icon",width:b.iconWidth,height:b.iconHeight}),BI.createWidget({type:"bi.center_adapt",element:this,items:[{type:"bi.center_adapt",width:50,height:b.height,items:[this.text,this.icon]}]})},setValue:function(a){this.text.setValue(a)},getValue:function(){return this.text.getValue()},setText:function(a){this.text.setText(a)},getText:function(){return this.item.getText()},getKey:function(){}}),BI.shortcut("bi.date_triangle_trigger",BI.DateTriangleTrigger),BI.DateCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.DateCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-date-combo bi-border",height:25})},_init:function(){BI.DateCombo.superclass._init.apply(this,arguments);var a=this;this.options;this.trigger=BI.createWidget({type:"bi.date_trigger"}),this.trigger.on(BI.DateTrigger.EVENT_TRIGGER_CLICK,function(){a.combo.toggle()}),this.popup=BI.createWidget({type:"bi.date_calendar_popup"}),this.popup.on(BI.DateCalendarPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue())}),this.combo=BI.createWidget({type:"bi.combo",toggle:!1,element:this,isNeedAdjustHeight:!1,isNeedAdjustWidth:!1,el:this.trigger,popup:{width:270,el:this.popup,stopPropagation:!1}})},setValue:function(a){this.trigger.setValue(a),this.popup.setValue(a)},getValue:function(){return this.popup.getValue()}}),BI.shortcut("bi.date_combo",BI.DateCombo),BI.DateTrigger=BI.inherit(BI.Trigger,{_const:{hgap:4,vgap:2,yearLength:4,yearMonthLength:7},_defaultConfig:function(){return BI.extend(BI.DateTrigger.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-date-trigger",min:"1900-01-01",max:"2099-12-31",height:24})},_init:function(){BI.DateTrigger.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._const;this.editor=BI.createWidget({type:"bi.sign_editor",height:b.height,validationChecker:function(b){var c=b.match(/\d+/g);return a._autoAppend(b,c),a._dateCheck(b)&&Date.checkLegal(b)&&a._checkVoid({year:c[0],month:c[1],day:c[2]})},quitChecker:function(){return!1},hgap:c.hgap,vgap:c.vgap,allowBlank:!0,watermark:BI.i18nText("BI-Basic_Unrestricted"),errorText:function(){return a.editor.isEditing()?BI.i18nText("BI-Date_Trigger_Error_Text"):BI.i18nText("BI-Year_Trigger_Invalid_Text")}}),this.editor.on(BI.SignEditor.EVENT_KEY_DOWN,function(){a.fireEvent(BI.DateTrigger.EVENT_KEY_DOWN)}),this.editor.on(BI.SignEditor.EVENT_FOCUS,function(){a.fireEvent(BI.DateTrigger.EVENT_FOCUS)}),this.editor.on(BI.SignEditor.EVENT_STOP,function(){a.fireEvent(BI.DateTrigger.EVENT_STOP)}),this.editor.on(BI.SignEditor.EVENT_VALID,function(){a.fireEvent(BI.DateTrigger.EVENT_VALID)}),this.editor.on(BI.SignEditor.EVENT_ERROR,function(){a.fireEvent(BI.DateTrigger.EVENT_ERROR)}),this.editor.on(BI.SignEditor.EVENT_CONFIRM,function(){var b=a.editor.getValue();if(BI.isNotNull(b)&&a.editor.setState(b),BI.isNotEmptyString(b)){var c=b.split("-");a.store_value={type:BI.DateTrigger.MULTI_DATE_CALENDAR,value:{year:0|c[0],month:c[1]-1,day:0|c[2]}}}a.fireEvent(BI.DateTrigger.EVENT_CONFIRM)}),this.editor.on(BI.SignEditor.EVENT_SPACE,function(){a.editor.isValid()&&a.editor.blur()}),this.editor.on(BI.SignEditor.EVENT_START,function(){a.fireEvent(BI.DateTrigger.EVENT_START)}),this.editor.on(BI.SignEditor.EVENT_CHANGE,function(){a.fireEvent(BI.DateTrigger.EVENT_CHANGE)}),BI.createWidget({type:"bi.htape",element:this,items:[{el:BI.createWidget(),width:30},{el:this.editor}]})},_dateCheck:function(a){return Date.parseDateTime(a,"%Y-%x-%d").print("%Y-%x-%d")==a||Date.parseDateTime(a,"%Y-%X-%d").print("%Y-%X-%d")==a||Date.parseDateTime(a,"%Y-%x-%e").print("%Y-%x-%e")==a||Date.parseDateTime(a,"%Y-%X-%e").print("%Y-%X-%e")==a},_checkVoid:function(a){return!Date.checkVoid(a.year,a.month,a.day,this.options.min,this.options.max)[0]},_autoAppend:function(a,b){var c=this,d=Date.parseDateTime(a,"%Y-%X-%d").print("%Y-%X-%d"),e=function(a){return Date.parseDateTime(a,"%Y").print("%Y")==a&&d>=c.options.min&&d<=c.options.max},f=function(a){return Date.parseDateTime(a,"%Y-%X").print("%Y-%X")==a&&d>=c.options.min&&d<=c.options.max};if(BI.isNotNull(b)&&Date.checkLegal(a))switch(a.length){case this._const.yearLength:e(a)&&this.editor.setValue(a+"-");break;case this._const.yearMonthLength:f(a)&&this.editor.setValue(a+"-")}},setValue:function(a){var b,c,d=this,e=Date.getDate();this.store_value=a,BI.isNotNull(a)&&(b=a.type||BI.DateTrigger.MULTI_DATE_CALENDAR,c=a.value,BI.isNull(c)&&(c=a));var f=function(a,b){var c=a.print("%Y-%x-%e");d.editor.setState(c),d.editor.setValue(c),d.setTitle(b+":"+c)};switch(b){case BI.DateTrigger.MULTI_DATE_YEAR_PREV:var g=c+BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV];e=Date.getDate(e.getFullYear()-1*c,e.getMonth(),e.getDate()),f(e,g);break;case BI.DateTrigger.MULTI_DATE_YEAR_AFTER:var g=c+BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER];e=Date.getDate(e.getFullYear()+1*c,e.getMonth(),e.getDate()),f(e,g);break;case BI.DateTrigger.MULTI_DATE_YEAR_BEGIN:var g=BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN];e=Date.getDate(e.getFullYear(),0,1),f(e,g);break;case BI.DateTrigger.MULTI_DATE_YEAR_END:var g=BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END];e=Date.getDate(e.getFullYear(),11,31),f(e,g);break;case BI.DateTrigger.MULTI_DATE_QUARTER_PREV:var g=c+BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV];e=Date.getDate().getBeforeMulQuarter(c),f(e,g);break;case BI.DateTrigger.MULTI_DATE_QUARTER_AFTER:var g=c+BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER];e=Date.getDate().getAfterMulQuarter(c),f(e,g);break;case BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN:var g=BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN];e=Date.getDate().getQuarterStartDate(),f(e,g);break;case BI.DateTrigger.MULTI_DATE_QUARTER_END:var g=BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END];e=Date.getDate().getQuarterEndDate(),f(e,g);break;case BI.DateTrigger.MULTI_DATE_MONTH_PREV:var g=c+BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV];e=Date.getDate().getBeforeMultiMonth(c),f(e,g);break;case BI.DateTrigger.MULTI_DATE_MONTH_AFTER:var g=c+BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER];e=Date.getDate().getAfterMultiMonth(c),f(e,g);break;case BI.DateTrigger.MULTI_DATE_MONTH_BEGIN:var g=BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN];e=Date.getDate(e.getFullYear(),e.getMonth(),1),f(e,g);break;case BI.DateTrigger.MULTI_DATE_MONTH_END:var g=BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END];e=Date.getDate(e.getFullYear(),e.getMonth(),e.getLastDateOfMonth().getDate()),f(e,g);break;case BI.DateTrigger.MULTI_DATE_WEEK_PREV:var g=c+BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_WEEK_PREV];e=e.getOffsetDate(-7*c),f(e,g);break;case BI.DateTrigger.MULTI_DATE_WEEK_AFTER:var g=c+BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_WEEK_AFTER];e=e.getOffsetDate(7*c),f(e,g);break;case BI.DateTrigger.MULTI_DATE_DAY_PREV:var g=c+BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_PREV];e=e.getOffsetDate(-1*c),f(e,g);break;case BI.DateTrigger.MULTI_DATE_DAY_AFTER:var g=c+BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_AFTER];e=e.getOffsetDate(1*c),f(e,g);break;case BI.DateTrigger.MULTI_DATE_DAY_TODAY:var g=BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY];e=Date.getDate(),f(e,g);break;default:if(BI.isNull(c)||BI.isNull(c.day))this.editor.setState(""),this.editor.setValue(""),this.setTitle("");else{var h=c.year+"-"+(c.month+1)+"-"+c.day;this.editor.setState(h),this.editor.setValue(h),this.setTitle(h)}}},getKey:function(){return this.editor.getValue()},getValue:function(){return this.store_value}}),BI.DateTrigger.MULTI_DATE_YEAR_PREV=1,BI.DateTrigger.MULTI_DATE_YEAR_AFTER=2,BI.DateTrigger.MULTI_DATE_YEAR_BEGIN=3,BI.DateTrigger.MULTI_DATE_YEAR_END=4,BI.DateTrigger.MULTI_DATE_MONTH_PREV=5,BI.DateTrigger.MULTI_DATE_MONTH_AFTER=6,BI.DateTrigger.MULTI_DATE_MONTH_BEGIN=7,BI.DateTrigger.MULTI_DATE_MONTH_END=8,BI.DateTrigger.MULTI_DATE_QUARTER_PREV=9,BI.DateTrigger.MULTI_DATE_QUARTER_AFTER=10,BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN=11,BI.DateTrigger.MULTI_DATE_QUARTER_END=12,BI.DateTrigger.MULTI_DATE_WEEK_PREV=13,BI.DateTrigger.MULTI_DATE_WEEK_AFTER=14,BI.DateTrigger.MULTI_DATE_DAY_PREV=15,BI.DateTrigger.MULTI_DATE_DAY_AFTER=16,BI.DateTrigger.MULTI_DATE_DAY_TODAY=17,BI.DateTrigger.MULTI_DATE_PARAM=18,BI.DateTrigger.MULTI_DATE_CALENDAR=19,BI.DateTrigger.MULTI_DATE_SEGMENT_NUM={},BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV]=BI.i18nText("BI-Multi_Date_Year_Prev"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER]=BI.i18nText("BI-Multi_Date_Year_Next"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN]=BI.i18nText("BI-Multi_Date_Year_Begin"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END]=BI.i18nText("BI-Multi_Date_Year_End"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV]=BI.i18nText("BI-Multi_Date_Quarter_Prev"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER]=BI.i18nText("BI-Multi_Date_Quarter_Next"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN]=BI.i18nText("BI-Multi_Date_Quarter_Begin"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END]=BI.i18nText("BI-Multi_Date_Quarter_End"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV]=BI.i18nText("BI-Multi_Date_Month_Prev"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER]=BI.i18nText("BI-Multi_Date_Month_Next"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN]=BI.i18nText("BI-Multi_Date_Month_Begin"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END]=BI.i18nText("BI-Multi_Date_Month_End"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_WEEK_PREV]=BI.i18nText("BI-Multi_Date_Week_Prev"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_WEEK_AFTER]=BI.i18nText("BI-Multi_Date_Week_Next"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_PREV]=BI.i18nText("BI-Multi_Date_Day_Prev"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_AFTER]=BI.i18nText("BI-Multi_Date_Day_Next"),BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY]=BI.i18nText("BI-Multi_Date_Today"),BI.DateTrigger.EVENT_FOCUS="EVENT_FOCUS",BI.DateTrigger.EVENT_START="EVENT_START",BI.DateTrigger.EVENT_STOP="EVENT_STOP",BI.DateTrigger.EVENT_CONFIRM="EVENT_CONFIRM",BI.DateTrigger.EVENT_CHANGE="EVENT_CHANGE",BI.DateTrigger.EVENT_VALID="EVENT_VALID",BI.DateTrigger.EVENT_ERROR="EVENT_ERROR",BI.DateTrigger.EVENT_TRIGGER_CLICK="EVENT_TRIGGER_CLICK",BI.DateTrigger.EVENT_KEY_DOWN="EVENT_KEY_DOWN",BI.shortcut("bi.date_trigger",BI.DateTrigger),BI.DatePaneWidget=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.DatePaneWidget.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:"bi-date-pane",min:"1900-01-01",max:"2099-12-31",selectedTime:null})},_init:function(){BI.DatePaneWidget.superclass._init.apply(this,arguments);var a=this,b=this.options;this.today=Date.getDate(),this._year=this.today.getFullYear(),this._month=this.today.getMonth(),this.selectedTime=b.selectedTime||{year:this._year,month:this._month},this.datePicker=BI.createWidget({type:"bi.date_picker",min:b.min,max:b.max}),this.datePicker.on(BI.DatePicker.EVENT_CHANGE,function(){a.selectedTime=a.datePicker.getValue(),a.calendar.setSelect(BI.Calendar.getPageByDateJSON(a.selectedTime))}),this.calendar=BI.createWidget({direction:"top",element:this,logic:{dynamic:!1},type:"bi.navigation",tab:this.datePicker,cardCreator:BI.bind(this._createNav,this)}),this.calendar.on(BI.Navigation.EVENT_CHANGE,function(){a.selectedTime=a.calendar.getValue(),a.calendar.empty(),a.setValue(a.selectedTime),a.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE)})},_createNav:function(a){var b=BI.Calendar.getDateJSONByPage(a),c=BI.createWidget({type:"bi.calendar",logic:{dynamic:!1},min:this.options.min,max:this.options.max,year:b.year,month:b.month,day:this.selectedTime.day});return c},_getNewCurrentDate:function(){var a=Date.getDate();return{year:a.getFullYear(),month:a.getMonth()}},_setCalenderValue:function(a){this.calendar.setSelect(BI.Calendar.getPageByDateJSON(a)),this.calendar.setValue(a),this.selectedTime=a},_setDatePicker:function(a){BI.isNull(a)||BI.isNull(a.year)||BI.isNull(a.month)?this.datePicker.setValue(this._getNewCurrentDate()):this.datePicker.setValue(a)},_setCalendar:function(a){BI.isNull(a)||BI.isNull(a.day)?(this.calendar.empty(),this._setCalenderValue(this._getNewCurrentDate())):this._setCalenderValue(a)},setValue:function(a){this._setDatePicker(a),this._setCalendar(a)},getValue:function(){return this.selectedTime}}),BI.shortcut("bi.date_pane",BI.DatePaneWidget),BI.DateTimeCombo=BI.inherit(BI.Single,{constants:{popupHeight:290,popupWidth:270,comboAdjustHeight:1,border:1,DATE_MIN_VALUE:"1900-01-01",DATE_MAX_VALUE:"2099-12-31"},_defaultConfig:function(){return BI.extend(BI.DateTimeCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-date-time-combo bi-border",width:200,height:24})},_init:function(){BI.DateTimeCombo.superclass._init.apply(this,arguments);var a=this,b=(this.options,Date.getDate());this.storeValue={year:b.getFullYear(),month:b.getMonth(),day:b.getDate(),hour:b.getHours(),minute:b.getMinutes(),second:b.getSeconds()},this.trigger=BI.createWidget({type:"bi.date_time_trigger",min:this.constants.DATE_MIN_VALUE,max:this.constants.DATE_MAX_VALUE}),this.popup=BI.createWidget({type:"bi.date_time_popup",min:this.constants.DATE_MIN_VALUE,max:this.constants.DATE_MAX_VALUE}),a.setValue(this.storeValue),this.popup.on(BI.DateTimePopup.BUTTON_CANCEL_EVENT_CHANGE,function(){a.setValue(a.storeValue),a.hidePopupView(),a.fireEvent(BI.DateTimeCombo.EVENT_CANCEL)}),this.popup.on(BI.DateTimePopup.BUTTON_OK_EVENT_CHANGE,function(){a.storeValue=a.popup.getValue(),a.setValue(a.storeValue),a.hidePopupView(),a.fireEvent(BI.DateTimeCombo.EVENT_CONFIRM)}),this.popup.on(BI.DateTimePopup.CALENDAR_EVENT_CHANGE,function(){a.trigger.setValue(a.popup.getValue()),a.fireEvent(BI.DateTimeCombo.EVENT_CHANGE)}),this.combo=BI.createWidget({type:"bi.combo",toggle:!1,isNeedAdjustHeight:!1,isNeedAdjustWidth:!1,el:this.trigger,adjustLength:this.constants.comboAdjustHeight,popup:{el:this.popup,maxHeight:this.constants.popupHeight,width:this.constants.popupWidth,stopPropagation:!1}}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){a.popup.setValue(a.storeValue),a.fireEvent(BI.DateTimeCombo.EVENT_BEFORE_POPUPVIEW)});var c=BI.createWidget({type:"bi.icon_button",cls:"bi-trigger-icon-button date-font bi-border-right",width:24,height:24});c.on(BI.TriggerIconButton.EVENT_CHANGE,function(){a.combo.isViewVisible()?a.combo.hideView():a.combo.showView()}),BI.createWidget({type:"bi.htape",element:this,items:[{type:"bi.absolute",items:[{el:this.combo,top:0,left:0,right:0,bottom:0},{el:c,top:0,left:0}]}]})},setValue:function(a){this.storeValue=a,this.popup.setValue(a),this.trigger.setValue(a)},getValue:function(){return this.storeValue},hidePopupView:function(){this.combo.hideView()}}),BI.DateTimeCombo.EVENT_CANCEL="EVENT_CANCEL",BI.DateTimeCombo.EVENT_CONFIRM="EVENT_CONFIRM",BI.DateTimeCombo.EVENT_CHANGE="EVENT_CHANGE",BI.DateTimeCombo.EVENT_BEFORE_POPUPVIEW="BI.DateTimeCombo.EVENT_BEFORE_POPUPVIEW",BI.shortcut("bi.date_time_combo",BI.DateTimeCombo),BI.DateTimePopup=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.DateTimePopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-date-time-popup",width:268,height:290})},_init:function(){BI.DateTimePopup.superclass._init.apply(this,arguments);var a=this;this.options;this.cancelButton=BI.createWidget({type:"bi.text_button",forceCenter:!0,cls:"multidate-popup-button bi-border-top bi-border-right",shadow:!0,text:BI.i18nText("BI-Basic_Cancel")}),this.cancelButton.on(BI.TextButton.EVENT_CHANGE,function(){a.fireEvent(BI.DateTimePopup.BUTTON_CANCEL_EVENT_CHANGE)}),this.okButton=BI.createWidget({type:"bi.text_button",forceCenter:!0,cls:"multidate-popup-button bi-border-top",shadow:!0,text:BI.i18nText("BI-Basic_OK")}),this.okButton.on(BI.TextButton.EVENT_CHANGE,function(){a.fireEvent(BI.DateTimePopup.BUTTON_OK_EVENT_CHANGE)}),this.dateCombo=BI.createWidget({type:"bi.date_calendar_popup",min:a.options.min,max:a.options.max}),a.dateCombo.on(BI.DateCalendarPopup.EVENT_CHANGE,function(){a.fireEvent(BI.DateTimePopup.CALENDAR_EVENT_CHANGE)}),this.dateSelect=BI.createWidget({type:"bi.vertical_adapt",cls:"bi-border-top",items:[{type:"bi.label",text:BI.i18nText("BI-Basic_Time"),width:45},{type:"bi.date_time_select",max:23,min:0,width:60,height:30,listeners:[{eventName:BI.DateTimeSelect.EVENT_CONFIRM,action:function(){a.fireEvent(BI.DateTimePopup.CALENDAR_EVENT_CHANGE)}}],ref:function(b){a.hour=b}},{type:"bi.label",text:":",width:15},{type:"bi.date_time_select",max:59,min:0,width:60,height:30,listeners:[{eventName:BI.DateTimeSelect.EVENT_CONFIRM,action:function(){a.fireEvent(BI.DateTimePopup.CALENDAR_EVENT_CHANGE)}}],ref:function(b){a.minute=b}},{type:"bi.label",text:":",width:15},{type:"bi.date_time_select",max:59,min:0,width:60,height:30,listeners:[{eventName:BI.DateTimeSelect.EVENT_CONFIRM,action:function(){a.fireEvent(BI.DateTimePopup.CALENDAR_EVENT_CHANGE)}}],ref:function(b){a.second=b}}]});var b=Date.getDate();this.dateCombo.setValue({year:b.getFullYear(),month:b.getMonth(),day:b.getDate()}),this.hour.setValue(b.getHours()),this.minute.setValue(b.getMinutes()),this.second.setValue(b.getSeconds()),this.dateButton=BI.createWidget({type:"bi.grid",items:[[this.cancelButton,this.okButton]]}),BI.createWidget({element:this,type:"bi.vtape",items:[{el:this.dateCombo},{el:this.dateSelect,height:50},{el:this.dateButton,height:30}]})},setValue:function(a){var b,c=a;BI.isNull(c)?(b=Date.getDate(),this.dateCombo.setValue({year:b.getFullYear(),month:b.getMonth(),day:b.getDate()}),this.hour.setValue(b.getHours()),this.minute.setValue(b.getMinutes()),this.second.setValue(b.getSeconds())):(this.dateCombo.setValue({year:c.year,month:c.month,day:c.day}),this.hour.setValue(c.hour),this.minute.setValue(c.minute),this.second.setValue(c.second))},getValue:function(){return{year:this.dateCombo.getValue().year,month:this.dateCombo.getValue().month,day:this.dateCombo.getValue().day,hour:this.hour.getValue(),minute:this.minute.getValue(),second:this.second.getValue()}}}),BI.DateTimePopup.BUTTON_OK_EVENT_CHANGE="BUTTON_OK_EVENT_CHANGE",BI.DateTimePopup.BUTTON_CANCEL_EVENT_CHANGE="BUTTON_CANCEL_EVENT_CHANGE",BI.DateTimePopup.CALENDAR_EVENT_CHANGE="CALENDAR_EVENT_CHANGE",BI.shortcut("bi.date_time_popup",BI.DateTimePopup),BI.DateTimeSelect=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.DateTimeSelect.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-date-time-select bi-border",max:23,min:0})},_init:function(){BI.DateTimeSelect.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.sign_editor",value:this._alertInEditorValue(b.min),allowBlank:!1,errorText:BI.i18nText("BI-Please_Input_Natural_Number"),validationChecker:function(a){return BI.isNaturalNumber(a)}}),this.editor.on(BI.TextEditor.EVENT_CONFIRM,function(){a._finetuning(0),a.fireEvent(BI.DateTimeSelect.EVENT_CONFIRM)}),this.topBtn=BI.createWidget({type:"bi.icon_button",cls:"column-pre-page-h-font top-button bi-border-left bi-border-bottom"}),this.topBtn.on(BI.IconButton.EVENT_CHANGE,function(){a._finetuning(1),a.fireEvent(BI.DateTimeSelect.EVENT_CONFIRM)}),this.bottomBtn=BI.createWidget({type:"bi.icon_button",cls:"column-next-page-h-font bottom-button bi-border-left"}),this.bottomBtn.on(BI.IconButton.EVENT_CHANGE,function(){a._finetuning(-1),a.fireEvent(BI.DateTimeSelect.EVENT_CONFIRM)}),this._finetuning(0),BI.createWidget({type:"bi.htape",element:this,items:[this.editor,{el:{type:"bi.grid",columns:1,rows:2,items:[{column:0,row:0,el:this.topBtn},{column:0,row:1,el:this.bottomBtn}]},width:30}]})},_alertOutEditorValue:function(a){return a>this.options.max&&(a=this.options.min),a<this.options.min&&(a=this.options.max),BI.parseInt(a)},_alertInEditorValue:function(a){return a>this.options.max&&(a=this.options.min),a<this.options.min&&(a=this.options.max),a=a<10?"0"+a:a},_finetuning:function(a){var b=BI.parseInt(this._alertOutEditorValue(this.editor.getValue()));this.editor.setValue(this._alertInEditorValue(b+a))},getValue:function(){var a=this.editor.getValue();return this._alertOutEditorValue(a)},setValue:function(a){this.editor.setValue(this._alertInEditorValue(a)),this._finetuning(0)}}),BI.DateTimeSelect.EVENT_CONFIRM="EVENT_CONFIRM",BI.shortcut("bi.date_time_select",BI.DateTimeSelect),BI.DateTimeTrigger=BI.inherit(BI.Trigger,{_const:{hgap:4},_defaultConfig:function(){return BI.extend(BI.DateTimeTrigger.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-date-time-trigger",min:"1900-01-01",max:"2099-12-31",height:24,width:200})},_init:function(){BI.DateTimeTrigger.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",textAlign:"left",height:a.height,width:a.width,hgap:b.hgap}),BI.createWidget({type:"bi.htape",element:this,items:[{el:BI.createWidget(),width:a.height},{el:this.text}]})},_printTime:function(a){return a<10?"0"+a:a},setValue:function(a){var b,c=a;if(BI.isNull(c))c=Date.getDate(),b=c.print("%Y-%X-%d %H:%M:%S");else{var d=Date.getDate(c.year,c.month,c.day,c.hour,c.minute,c.second);b=d.print("%Y-%X-%d %H:%M:%S")}this.text.setText(b),this.text.setTitle(b)}}),BI.shortcut("bi.date_time_trigger",BI.DateTimeTrigger),BI.DirectionPathChooser=BI.inherit(BI.Widget,{_const:{lineColor:"#808080",selectLineColor:"#009de3"},_defaultConfig:function(){return BI.extend(BI.DirectionPathChooser.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-excel-table",items:[]})},_init:function(){BI.DirectionPathChooser.superclass._init.apply(this,arguments);var a=this,b=this.options;this.pathChooser=BI.createWidget({type:"bi.path_chooser",element:this,items:b.items}),this.pathChooser.on(BI.PathChooser.EVENT_CHANGE,function(b,c){a._setValue(b,c),a.fireEvent(BI.DirectionPathChooser.EVENT_CHANGE)}),this._drawArrows()},_unselectAllArrows:function(){var a=this._const.lineColor;BI.each(this.arrows,function(b,c){BI.each(c,function(b,c){BI.each(c,function(b,c){c.attr({fill:a,stroke:a})})})})},_drawOneArrow:function(a,b){var c=this._const.lineColor,d=(this._const.selectLineColor,this.pathChooser.svg),e="";switch(b){case 0:e="M"+a.x+","+a.y+"L"+(a.x-3)+","+(a.y+5)+"L"+(a.x+3)+","+(a.y+5)+"L"+a.x+","+a.y;break;case 1:e="M"+a.x+","+a.y+"L"+(a.x-5)+","+(a.y-3)+"L"+(a.x-5)+","+(a.y+3)+"L"+a.x+","+a.y;break;case 2:e="M"+a.x+","+a.y+"L"+(a.x-3)+","+(a.y-5)+"L"+(a.x+3)+","+(a.y-5)+"L"+a.x+","+a.y;break;case 3:e="M"+a.x+","+a.y+"L"+(a.x+5)+","+(a.y-3)+"L"+(a.x+5)+","+(a.y+3)+"L"+a.x+","+a.y}return d.path(e).attr({fill:c,stroke:c})},_drawArrows:function(){function a(a,b){return b===-1?100*(a+1)-20:100*a+20}function b(a,b){var c=BI.find(a,function(c,d){if(c>0&&a[c-1].x<b&&a[c].x>b)return!0});return c.y}var c=this,d=(this.options,this.pathChooser.routes),e=this.pathChooser.pathes,f=this.pathChooser.cache;this.arrows={},BI.each(d,function(d,g){c.arrows[d]=[],BI.each(g,function(g,h){c.arrows[d][g]=[];var i=e[d][g];BI.each(i,function(a,b){if(a>0&&a<i.length-1){var e;b.y===i[a-1].y?i[a+1].y!=b.y&&(f[h[h.length-2]].direction===-1?a-1>0&&(e=c._drawOneArrow(i[a-1],3)):e=c._drawOneArrow(i[a],1)):b.x===i[a-1].x&&(e=b.y>i[a-1].y?f[BI.first(h)].direction===-1?c._drawOneArrow(i[a-1],0):c._drawOneArrow(b,2):f[h[h.length-2]].direction===-1?c._drawOneArrow(i[a-1],2):c._drawOneArrow(b,0)),e&&c.arrows[d][g].push(e)}}),BI.each(h,function(e,j){if(0!==e){var k,l=h[e-1];if(f[l].direction===-1){var m=c.pathChooser.getRegionIndexById(l),n=a(m,-1),o=b(i,n);k=c._drawOneArrow({x:n,y:o},3)}else{var m=c.pathChooser.getRegionIndexById(j),n=a(m),o=b(i,n);k=c._drawOneArrow({x:n,y:o},1)}k&&c.arrows[d][g].push(k)}})})})},_setValue:function(a,b){var c=this,d=this._const.lineColor,e=this._const.selectLineColor,f=this.pathChooser.routes,g=this.pathChooser.start,h=[a];g.contains(a)&&(h=g),BI.each(h,function(a,b){BI.each(c.arrows[b],function(a,b){BI.each(b,function(a,b){b.attr({fill:d,stroke:d}).toFront()})})}),BI.each(this.arrows[a][b],function(a,b){b.attr({fill:e,stroke:e}).toFront()});for(var i=BI.last(f[a][b]);i&&f[i]&&1===f[i].length;)BI.each(c.arrows[i][0],function(a,b){b.attr({fill:e,stroke:e}).toFront()}),i=BI.last(f[i][0])},setValue:function(a){this.pathChooser.setValue(a),this._unselectAllArrows();var b=this.pathChooser.routes,c=BI.keys(b),d=this,e=[],f=[];BI.each(a,function(a,b){BI.contains(c,b)&&f.length>0&&(f.push(b),e.push(f),f=[]),f.push(b)}),f.length>0&&e.push(f),BI.each(e,function(a,c){
var e=c[0],f=BI.findIndex(b[e],function(a,b){if(BI.isEqual(c,b))return!0});f>=0&&d._setValue(e,f)})},getValue:function(){return this.pathChooser.getValue()},populate:function(a){this.pathChooser.populate(a),this._drawArrows()}}),BI.DirectionPathChooser.EVENT_CHANGE="DirectionPathChooser.EVENT_CHANGE",BI.shortcut("bi.direction_path_chooser",BI.DirectionPathChooser),BI.DownListCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.DownListCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-down-list-combo",invalid:!1,height:25,items:[],adjustLength:0,direction:"bottom",trigger:"click",container:null,el:{}})},_init:function(){BI.DownListCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.popupview=BI.createWidget({type:"bi.down_list_popup",items:b.items,chooseType:b.chooseType}),this.popupview.on(BI.DownListPopup.EVENT_CHANGE,function(b){a.fireEvent(BI.DownListCombo.EVENT_CHANGE,b),a.downlistcombo.hideView()}),this.popupview.on(BI.DownListPopup.EVENT_SON_VALUE_CHANGE,function(b,c){a.fireEvent(BI.DownListCombo.EVENT_SON_VALUE_CHANGE,b,c),a.downlistcombo.hideView()}),this.downlistcombo=BI.createWidget({element:this,type:"bi.combo",trigger:b.trigger,isNeedAdjustWidth:!1,container:b.container,adjustLength:b.adjustLength,direction:b.direction,el:BI.createWidget(b.el,{type:"bi.icon_trigger",extraCls:b.iconCls?b.iconCls:"pull-down-font",width:b.width,height:b.height}),popup:{el:this.popupview,stopPropagation:!0,maxHeight:1e3}}),this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){a.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW)})},hideView:function(){this.downlistcombo.hideView()},showView:function(){this.downlistcombo.showView()},populate:function(a){this.popupview.populate(a)},setValue:function(a){this.popupview.setValue(a)},getValue:function(){return this.popupview.getValue()}}),BI.DownListCombo.EVENT_CHANGE="EVENT_CHANGE",BI.DownListCombo.EVENT_SON_VALUE_CHANGE="EVENT_SON_VALUE_CHANGE",BI.DownListCombo.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.shortcut("bi.down_list_combo",BI.DownListCombo),BI.DownListGroup=BI.inherit(BI.Widget,{constants:{iconCls:"check-mark-ha-font"},_defaultConfig:function(){return BI.extend(BI.DownListGroup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-down-list-group",items:[{el:{}}]})},_init:function(){BI.DownListGroup.superclass._init.apply(this,arguments);var a=this.options,b=this;this.downlistgroup=BI.createWidget({element:this,type:"bi.button_tree",items:a.items,chooseType:0,layouts:[{type:"bi.vertical",hgap:0,vgap:0}]}),this.downlistgroup.on(BI.Controller.EVENT_CHANGE,function(a){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.DownListGroup.EVENT_CHANGE,arguments)})},getValue:function(){return this.downlistgroup.getValue()},setValue:function(a){this.downlistgroup.setValue(a)}}),BI.DownListGroup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.down_list_group",BI.DownListGroup),BI.DownListItem=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.DownListItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:"bi-down-list-item bi-list-item-active",cls:"",height:25,logic:{dynamic:!0},selected:!1,iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.DownListItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.text=BI.createWidget({type:"bi.icon_text_item",element:this,height:b.height,text:b.text,value:b.value,logic:b.logic,selected:b.selected,disabled:b.disabled,iconHeight:b.iconHeight,iconWidth:b.iconWidth,textHgap:b.textHgap,textVgap:b.textVgap,textLgap:b.textLgap,textRgap:b.textRgap,father:b.father}),this.text.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.text.on(BI.IconTextItem.EVENT_CHANGE,function(){a.fireEvent(BI.DownListItem.EVENT_CHANGE)})},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},isSelected:function(){return this.text.isSelected()},setSelected:function(a){this.text.setSelected(a)},setValue:function(a){this.text.setValue(a)},getValue:function(){return this.text.getValue()}}),BI.DownListItem.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.down_list_item",BI.DownListItem),BI.DownListGroupItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){var a=BI.DownListGroupItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-down-list-group-item",logic:{dynamic:!1},iconCls1:"dot-e-font",iconCls2:"pull-right-e-font"})},_init:function(){BI.DownListGroupItem.superclass._init.apply(this,arguments);var a=this.options,b=this;this.text=BI.createWidget({type:"bi.label",cls:"list-group-item-text",textAlign:"left",text:a.text,value:a.value,height:a.height}),this.icon1=BI.createWidget({type:"bi.icon_button",cls:a.iconCls1,width:25,forceNotSelected:!0}),this.icon2=BI.createWidget({type:"bi.icon_button",cls:a.iconCls2,width:25,forceNotSelected:!0});var c=BI.createWidget({type:"bi.layout",width:25});BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.icon2,top:0,bottom:0,right:0}]}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic("horizontal",BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",this.icon1,this.text,c)})))),this.element.hover(function(){b.isEnabled()&&b.hover()},function(){b.isEnabled()&&b.dishover()})},hover:function(){BI.DownListGroupItem.superclass.hover.apply(this,arguments),this.icon1.element.addClass("hover"),this.icon2.element.addClass("hover")},dishover:function(){BI.DownListGroupItem.superclass.dishover.apply(this,arguments),this.icon1.element.removeClass("hover"),this.icon2.element.removeClass("hover")},doClick:function(){BI.DownListGroupItem.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.DownListGroupItem.EVENT_CHANGE,this.getValue())},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},setValue:function(a){var b=this,c=this.options;a=BI.isArray(a)?a:[a],BI.find(a,function(a,d){return BI.contains(c.childValues,d)?(b.icon1.setSelected(!0),!0):void b.icon1.setSelected(!1)})}}),BI.DownListGroupItem.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.down_list_group_item",BI.DownListGroupItem),BI.DownListPopup=BI.inherit(BI.Pane,{constants:{nextIcon:"pull-right-e-font",height:25,iconHeight:12,iconWidth:12,hgap:0,vgap:0,border:1},_defaultConfig:function(){var a=BI.DownListPopup.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:"bi-down-list-popup",items:[],chooseType:BI.Selection.Multi})},_init:function(){BI.DownListPopup.superclass._init.apply(this,arguments),this.singleValues=[],this.childValueMap={},this.fatherValueMap={};var a=this,b=this.options,c=this._createChildren(b.items);this.popup=BI.createWidget({type:"bi.button_tree",items:BI.createItems(c,{},{adjustLength:-2}),layouts:[{type:"bi.vertical",hgap:this.constants.hgap,vgap:this.constants.vgap}],chooseType:b.chooseType}),this.popup.on(BI.ButtonTree.EVENT_CHANGE,function(b,c){var d=b;if(BI.isNotNull(a.childValueMap[b])?(d=a.childValueMap[b],a.fireEvent(BI.DownListPopup.EVENT_SON_VALUE_CHANGE,d,a.fatherValueMap[b])):a.fireEvent(BI.DownListPopup.EVENT_CHANGE,d,c),!a.singleValues.contains(d)){var e=a.getValue(),f=[];BI.each(e,function(a,b){b.value!=d&&f.push(b)}),a.setValue(f)}}),BI.createWidget({type:"bi.vertical",element:this,items:[this.popup]})},_createChildren:function(a){var b=this,c=[];return BI.each(a,function(d,e){var f={type:"bi.down_list_group",items:[]};if(BI.each(e,function(a,c){BI.isNotEmptyArray(c.children)&&!BI.isEmpty(c.el)?(c.type="bi.combo_group",c.cls="down-list-group",c.trigger="hover",c.isNeedAdjustWidth=!1,c.el.title=c.el.title||c.el.text,c.el.type="bi.down_list_group_item",c.el.logic={dynamic:!0},c.el.height=b.constants.height,c.el.iconCls2=b.constants.nextIcon,c.popup={lgap:4,el:{type:"bi.button_tree",chooseType:0,layouts:[{type:"bi.vertical"}]}},c.el.childValues=[],BI.each(c.children,function(a,d){var e=BI.deepClone(c.el.value),f=BI.deepClone(d.value);b.singleValues.push(d.value),d.type="bi.down_list_item",d.extraCls=" child-down-list-item",d.title=d.title||d.text,d.textRgap=10,d.isNeedAdjustWidth=!1,d.logic={dynamic:!0},d.father=e,b.fatherValueMap[b._createChildValue(e,f)]=e,b.childValueMap[b._createChildValue(e,f)]=f,d.value=b._createChildValue(e,f),c.el.childValues.push(d.value)})):(c.type="bi.down_list_item",c.title=c.title||c.text,c.textRgap=10,c.isNeedAdjustWidth=!1,c.logic={dynamic:!0});var d={};d.el=c,f.items.push(d)}),b._isGroup(f.items)&&BI.each(f.items,function(a,c){b.singleValues.push(c.el.value)}),c.push(f),b._needSpliter(d,a.length)){var g=BI.createWidget({type:"bi.vertical",items:[{el:{type:"bi.layout",cls:"bi-down-list-spliter bi-border-top cursor-pointer",height:0}}],cls:"bi-down-list-spliter-container cursor-pointer",lgap:10,rgap:10});c.push(g)}}),c},_isGroup:function(a){return a.length>1},_needSpliter:function(a,b){return a<b-1},_createChildValue:function(a,b){return a+"_"+b},populate:function(a){BI.DownListPopup.superclass.populate.apply(this,arguments);var b=this;b.childValueMap={},b.fatherValueMap={},b.singleValues=[];var c=b._createChildren(a),d=BI.createItems(c,{},{adjustLength:-2});b.popup.populate(d)},setValue:function(a){var b=this,c=[];BI.each(a,function(a,d){var e;e=BI.isNotNull(d.childValue)?b._createChildValue(d.value,d.childValue):d.value,c.push(e)}),this.popup.setValue(c)},getValue:function(){var a=this,b=[],c=this.popup.getValue();return BI.each(c,function(c,d){var e={};if(BI.isNotNull(a.childValueMap[d])){var f=a.fatherValueMap[d];e.childValue=a.childValueMap[d],e.value=f}else e.value=d;b.push(e)}),b}}),BI.DownListPopup.EVENT_CHANGE="EVENT_CHANGE",BI.DownListPopup.EVENT_SON_VALUE_CHANGE="EVENT_SON_VALUE_CHANGE",BI.shortcut("bi.down_list_popup",BI.DownListPopup),BI.SearchEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.SearchEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:"bi-search-editor bi-border",height:24,errorText:"",watermark:BI.i18nText("BI-Basic_Search"),validationChecker:BI.emptyFn,quitChecker:BI.emptyFn})},_init:function(){this.options.height-=2,BI.SearchEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.editor",height:b.height,watermark:b.watermark,allowBlank:!0,errorText:b.errorText,validationChecker:b.validationChecker,quitChecker:b.quitChecker}),this.clear=BI.createWidget({type:"bi.icon_button",stopEvent:!0,cls:"search-close-h-font"}),this.clear.on(BI.IconButton.EVENT_CHANGE,function(){a.setValue(""),a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.STOPEDIT),a.fireEvent(BI.SearchEditor.EVENT_CLEAR)}),BI.createWidget({element:this,type:"bi.htape",items:[{el:{type:"bi.center_adapt",cls:"search-font",items:[{el:{type:"bi.icon"}}]},width:25},{el:a.editor},{el:this.clear,width:25}]}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_FOCUS,function(){a.fireEvent(BI.SearchEditor.EVENT_FOCUS)}),this.editor.on(BI.Editor.EVENT_BLUR,function(){a.fireEvent(BI.SearchEditor.EVENT_BLUR)}),this.editor.on(BI.Editor.EVENT_CLICK,function(){a.fireEvent(BI.SearchEditor.EVENT_CLICK)}),this.editor.on(BI.Editor.EVENT_CHANGE,function(){a._checkClear(),a.fireEvent(BI.SearchEditor.EVENT_CHANGE)}),this.editor.on(BI.Editor.EVENT_KEY_DOWN,function(b){a.fireEvent(BI.SearchEditor.EVENT_KEY_DOWN,b)}),this.editor.on(BI.Editor.EVENT_SPACE,function(){a.fireEvent(BI.SearchEditor.EVENT_SPACE)}),this.editor.on(BI.Editor.EVENT_BACKSPACE,function(){a.fireEvent(BI.SearchEditor.EVENT_BACKSPACE)}),this.editor.on(BI.Editor.EVENT_VALID,function(){a.fireEvent(BI.SearchEditor.EVENT_VALID)}),this.editor.on(BI.Editor.EVENT_ERROR,function(){a.fireEvent(BI.SearchEditor.EVENT_ERROR)}),this.editor.on(BI.Editor.EVENT_ENTER,function(){a.fireEvent(BI.SearchEditor.EVENT_ENTER)}),this.editor.on(BI.Editor.EVENT_RESTRICT,function(){a.fireEvent(BI.SearchEditor.EVENT_RESTRICT)}),this.editor.on(BI.Editor.EVENT_EMPTY,function(){a._checkClear(),a.fireEvent(BI.SearchEditor.EVENT_EMPTY)}),this.editor.on(BI.Editor.EVENT_REMOVE,function(){a.fireEvent(BI.SearchEditor.EVENT_REMOVE)}),this.editor.on(BI.Editor.EVENT_CONFIRM,function(){a.fireEvent(BI.SearchEditor.EVENT_CONFIRM)}),this.editor.on(BI.Editor.EVENT_START,function(){a.fireEvent(BI.SearchEditor.EVENT_START)}),this.editor.on(BI.Editor.EVENT_PAUSE,function(){a.fireEvent(BI.SearchEditor.EVENT_PAUSE)}),this.editor.on(BI.Editor.EVENT_STOP,function(){a.fireEvent(BI.SearchEditor.EVENT_STOP)}),this.clear.invisible()},_checkClear:function(){this.getValue()?this.clear.visible():this.clear.invisible()},focus:function(){this.editor.focus()},blur:function(){this.editor.blur()},getValue:function(){if(this.isValid()){var a=this.editor.getValue().match(/[\S]+/g);return BI.isNull(a)?"":a[a.length-1]}},getLastValidValue:function(){return this.editor.getLastValidValue()},setValue:function(a){this.editor.setValue(a),BI.isKey(a)&&this.clear.visible()},isEditing:function(){return this.editor.isEditing()},isValid:function(){return this.editor.isValid()}}),BI.SearchEditor.EVENT_CHANGE="EVENT_CHANGE",BI.SearchEditor.EVENT_FOCUS="EVENT_FOCUS",BI.SearchEditor.EVENT_BLUR="EVENT_BLUR",BI.SearchEditor.EVENT_CLICK="EVENT_CLICK",BI.SearchEditor.EVENT_KEY_DOWN="EVENT_KEY_DOWN",BI.SearchEditor.EVENT_SPACE="EVENT_SPACE",BI.SearchEditor.EVENT_BACKSPACE="EVENT_BACKSPACE",BI.SearchEditor.EVENT_CLEAR="EVENT_CLEAR",BI.SearchEditor.EVENT_START="EVENT_START",BI.SearchEditor.EVENT_PAUSE="EVENT_PAUSE",BI.SearchEditor.EVENT_STOP="EVENT_STOP",BI.SearchEditor.EVENT_CONFIRM="EVENT_CONFIRM",BI.SearchEditor.EVENT_VALID="EVENT_VALID",BI.SearchEditor.EVENT_ERROR="EVENT_ERROR",BI.SearchEditor.EVENT_ENTER="EVENT_ENTER",BI.SearchEditor.EVENT_RESTRICT="EVENT_RESTRICT",BI.SearchEditor.EVENT_REMOVE="EVENT_REMOVE",BI.SearchEditor.EVENT_EMPTY="EVENT_EMPTY",BI.shortcut("bi.search_editor",BI.SearchEditor),BI.SmallSearchEditor=BI.inherit(BI.SearchEditor,{_defaultConfig:function(){var a=BI.SmallSearchEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-small-search-editor",height:24})},_init:function(){BI.SmallSearchEditor.superclass._init.apply(this,arguments)}}),BI.shortcut("bi.small_search_editor",BI.SmallSearchEditor),BI.TextEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.TextEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{extraCls:"bi-text-editor bi-border",hgap:4,vgap:2,lgap:0,rgap:0,tgap:0,bgap:0,validationChecker:BI.emptyFn,quitChecker:BI.emptyFn,allowBlank:!1,watermark:"",errorText:"",height:24})},_init:function(){BI.TextEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;BI.isNumber(b.height)&&this.element.css({height:b.height-2}),BI.isNumber(b.width)&&this.element.css({width:b.width-2}),this.editor=BI.createWidget({type:"bi.editor",height:b.height-2,hgap:b.hgap,vgap:b.vgap,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,value:b.value,title:b.title,tipType:b.tipType,validationChecker:b.validationChecker,quitChecker:b.quitChecker,allowBlank:b.allowBlank,watermark:b.watermark,errorText:b.errorText}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_FOCUS,function(){a.fireEvent(BI.TextEditor.EVENT_FOCUS)}),this.editor.on(BI.Editor.EVENT_BLUR,function(){a.fireEvent(BI.TextEditor.EVENT_BLUR)}),this.editor.on(BI.Editor.EVENT_CLICK,function(){a.fireEvent(BI.TextEditor.EVENT_CLICK)}),this.editor.on(BI.Editor.EVENT_CHANGE,function(){a.fireEvent(BI.TextEditor.EVENT_CHANGE)}),this.editor.on(BI.Editor.EVENT_KEY_DOWN,function(b){a.fireEvent(BI.TextEditor.EVENT_KEY_DOWN)}),this.editor.on(BI.Editor.EVENT_SPACE,function(b){a.fireEvent(BI.TextEditor.EVENT_SPACE)}),this.editor.on(BI.Editor.EVENT_BACKSPACE,function(b){a.fireEvent(BI.TextEditor.EVENT_BACKSPACE)}),this.editor.on(BI.Editor.EVENT_VALID,function(){a.fireEvent(BI.TextEditor.EVENT_VALID)}),this.editor.on(BI.Editor.EVENT_CONFIRM,function(){a.fireEvent(BI.TextEditor.EVENT_CONFIRM)}),this.editor.on(BI.Editor.EVENT_REMOVE,function(b){a.fireEvent(BI.TextEditor.EVENT_REMOVE)}),this.editor.on(BI.Editor.EVENT_START,function(){a.fireEvent(BI.TextEditor.EVENT_START)}),this.editor.on(BI.Editor.EVENT_PAUSE,function(){a.fireEvent(BI.TextEditor.EVENT_PAUSE)}),this.editor.on(BI.Editor.EVENT_STOP,function(){a.fireEvent(BI.TextEditor.EVENT_STOP)}),this.editor.on(BI.Editor.EVENT_ERROR,function(){a.fireEvent(BI.TextEditor.EVENT_ERROR,arguments)}),this.editor.on(BI.Editor.EVENT_ENTER,function(){a.fireEvent(BI.TextEditor.EVENT_ENTER)}),this.editor.on(BI.Editor.EVENT_RESTRICT,function(){a.fireEvent(BI.TextEditor.EVENT_RESTRICT)}),this.editor.on(BI.Editor.EVENT_EMPTY,function(){a.fireEvent(BI.TextEditor.EVENT_EMPTY)}),BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[this.editor]})},focus:function(){this.editor.focus()},blur:function(){this.editor.blur()},setErrorText:function(a){this.editor.setErrorText(a)},getErrorText:function(){return this.editor.getErrorText()},isValid:function(){return this.editor.isValid()},setValue:function(a){this.editor.setValue(a)},getValue:function(){return this.editor.getValue()}}),BI.TextEditor.EVENT_CHANGE="EVENT_CHANGE",BI.TextEditor.EVENT_FOCUS="EVENT_FOCUS",BI.TextEditor.EVENT_BLUR="EVENT_BLUR",BI.TextEditor.EVENT_CLICK="EVENT_CLICK",BI.TextEditor.EVENT_KEY_DOWN="EVENT_KEY_DOWN",BI.TextEditor.EVENT_SPACE="EVENT_SPACE",BI.TextEditor.EVENT_BACKSPACE="EVENT_BACKSPACE",BI.TextEditor.EVENT_START="EVENT_START",BI.TextEditor.EVENT_PAUSE="EVENT_PAUSE",BI.TextEditor.EVENT_STOP="EVENT_STOP",BI.TextEditor.EVENT_CONFIRM="EVENT_CONFIRM",BI.TextEditor.EVENT_VALID="EVENT_VALID",BI.TextEditor.EVENT_ERROR="EVENT_ERROR",BI.TextEditor.EVENT_ENTER="EVENT_ENTER",BI.TextEditor.EVENT_RESTRICT="EVENT_RESTRICT",BI.TextEditor.EVENT_REMOVE="EVENT_REMOVE",BI.TextEditor.EVENT_EMPTY="EVENT_EMPTY",BI.shortcut("bi.text_editor",BI.TextEditor),BI.SmallTextEditor=BI.inherit(BI.TextEditor,{_defaultConfig:function(){var a=BI.SmallTextEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-small-text-editor",height:25})},_init:function(){BI.SmallTextEditor.superclass._init.apply(this,arguments)}}),BI.shortcut("bi.small_text_editor",BI.SmallTextEditor),BI.FileManagerButtonGroup=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.FileManagerButtonGroup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-file-manager-button_group",items:[]})},_init:function(){BI.FileManagerButtonGroup.superclass._init.apply(this,arguments);var a=this,b=this.options;this.button_group=BI.createWidget({type:"bi.button_tree",element:this,chooseType:BI.Selection.Multi,items:this._formatItems(b.items),layouts:[{type:"bi.vertical"}]}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})},_formatItems:function(a){this.options;return BI.each(a,function(a,b){b.children&&b.children.length>0?b.type="bi.file_manager_folder_item":b.type="bi.file_manager_file_item"}),a},setValue:function(a){this.button_group.setValue(a)},getValue:function(){return this.button_group.getValue()},getNotSelectedValue:function(){return this.button_group.getNotSelectedValue()},getAllLeaves:function(){return this.button_group.getAllLeaves()},getAllButtons:function(){return this.button_group.getAllButtons()},getSelectedButtons:function(){return this.button_group.getSelectedButtons()},getNotSelectedButtons:function(){return this.button_group.getNotSelectedButtons()},populate:function(a){this.button_group.populate(this._formatItems(a))}}),BI.FileManagerButtonGroup.EVENT_CHANGE="FileManagerButtonGroup.EVENT_CHANGE",BI.shortcut("bi.file_manager_button_group",BI.FileManagerButtonGroup),BI.FileManager=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.FileManager.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-file-manager",el:{},items:[]})},_init:function(){BI.FileManager.superclass._init.apply(this,arguments);var a=this,b=this.options;this.tree=new BI.Tree;var c=BI.Tree.transformToTreeFormat(b.items);this.tree.initTree(c),this.selectedValues=[],this.nav=BI.createWidget({type:"bi.file_manager_nav",items:BI.deepClone(c)}),this.nav.on(BI.FileManagerNav.EVENT_CHANGE,function(b,c){if("-1"==b)a.populate({children:a.tree.toJSON()});else{var d=a.tree.search(c.attr("id"));a.populate(BI.extend({id:d.id},d.get("data"),{children:a.tree.toJSON(d)}))}a.setValue(a.selectedValues)}),this.list=BI.createWidget(b.el,{type:"bi.file_manager_list",items:c}),this.list.on(BI.Controller.EVENT_CHANGE,function(b,c,d){if(b===BI.Events.CHANGE){var e=a.tree.search(d.attr("id"));a.populate(BI.extend({id:e.id},e.get("data"),{children:a.tree.toJSON(e)}))}else if(b===BI.Events.CLICK){var f=[];if(d instanceof BI.MultiSelectBar){var g=a.list.getValue();c=g.type===BI.Selection.All,f=BI.concat(g.assist,g.value)}else f=d.getAllLeaves();BI.each(f,function(b,d){c===!0?a.selectedValues.pushDistinct(d):a.selectedValues.remove(d)})}a.setValue(a.selectedValues)}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.list,left:0,right:0,top:0,bottom:10},{el:this.nav,left:40,right:100,top:0}]})},setValue:function(a){this.selectedValues=a||[],this.list.setValue(this.selectedValues)},getValue:function(){var a=this.list.getValue(),b=a.type===BI.Selection.All?a.assist:a.value;return b.pushDistinctArray(this.selectedValues),b},_populate:function(a){this.list.populate(a)},getSelectedValue:function(){return this.nav.getValue()[0]},getSelectedId:function(){return this.nav.getId()[0]},populate:function(a){var b=BI.deepClone(a);this._populate(a.children),this.nav.populate(b)}}),BI.FileManager.EVENT_CHANGE="FileManager.EVENT_CHANGE",BI.shortcut("bi.file_manager",BI.FileManager),BI.FileManagerFileItem=BI.inherit(BI.Single,{_defaultConfig:function(){return BI.extend(BI.FileManagerFileItem.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-file-manager-file-item bi-list-item bi-border-bottom",height:30})},_init:function(){BI.FileManagerFileItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checked=BI.createWidget({type:"bi.multi_select_bar",text:"",width:36,height:b.height}),this.checked.on(BI.Controller.EVENT_CHANGE,function(){arguments[2]=a,a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),BI.createWidget({type:"bi.htape",element:this,items:[{el:this.checked,width:36},{el:{type:"bi.icon_button",cls:"create-by-me-file-font"},width:20},{el:{type:"bi.label",textAlign:"left",height:b.height,text:b.text,value:b.value}}]})},getAllLeaves:function(){return[this.options.value]},isSelected:function(){return this.checked.isSelected()},setSelected:function(a){this.checked.setSelected(a)}}),BI.FileManagerFileItem.EVENT_CHANGE="FileManagerFileItem.EVENT_CHANGE",BI.shortcut("bi.file_manager_file_item",BI.FileManagerFileItem),BI.FileManagerFolderItem=BI.inherit(BI.Single,{_defaultConfig:function(){return BI.extend(BI.FileManagerFolderItem.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-file-manager-folder-item bi-list-item bi-border-bottom",height:30})},_init:function(){BI.FileManagerFolderItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checked=BI.createWidget({type:"bi.multi_select_bar",text:"",width:36,height:b.height}),this.checked.on(BI.Controller.EVENT_CHANGE,function(){arguments[2]=a,a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.button=BI.createWidget({type:"bi.text_button",textAlign:"left",height:b.height,text:b.text,value:b.value}),this.button.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,BI.Events.CHANGE,b.value,a)}),this.tree=new BI.Tree,this.tree.initTree([{id:b.id,children:b.children}]),this.selectValue=[],BI.createWidget({type:"bi.htape",element:this,items:[{el:this.checked,width:36},{el:{type:"bi.icon_button",cls:"create-by-me-folder-font"},width:20},{el:this.button}]})},setAllSelected:function(a){this.checked.setSelected(a),this.selectValue=[]},setHalfSelected:function(a){this.checked.setHalfSelected(a),a||(this.selectValue=[])},setValue:function(a){var b=(this.options,!1),c=[];this.tree.traverse(function(d){d.isLeaf()&&(BI.contains(a,d.get("data").value)?c.push(d.get("data").value):b=!0)}),this.setAllSelected(c.length>0&&!b),this.setHalfSelected(c.length>0&&b),this.checked.isHalfSelected()&&(this.selectValue=c)},getAllButtons:function(){return[this]},getAllLeaves:function(){var a=(this.options,[]);return this.tree.traverse(function(b){b.isLeaf()&&a.push(b.get("data").value)}),a},getNotSelectedValue:function(){var a=this,b=(this.options,[]),c=this.checked.isSelected();if(c===!0)return b;var d=this.checked.isHalfSelected();return this.tree.traverse(function(c){if(c.isLeaf()){var e=c.get("data").value;d===!0?BI.contains(a.selectValue,c.get("data").value)||b.push(e):b.push(e)}}),b},getValue:function(){var a=[];return this.checked.isSelected()?(this.tree.traverse(function(b){b.isLeaf()&&a.push(b.get("data").value)}),a):this.checked.isHalfSelected()?this.selectValue:[]}}),BI.FileManagerFolderItem.EVENT_CHANGE="FileManagerFolderItem.EVENT_CHANGE",BI.shortcut("bi.file_manager_folder_item",BI.FileManagerFolderItem),BI.FileManagerList=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.FileManagerList.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-file-manager-list",el:{},items:[]})},_init:function(){BI.FileManagerList.superclass._init.apply(this,arguments);var a=this,b=this.options;this.list=BI.createWidget({type:"bi.select_list",element:this,items:b.items,toolbar:{type:"bi.multi_select_bar",height:40,text:""},el:{type:"bi.list_pane",el:BI.isWidget(b.el)?b.el:BI.extend({type:"bi.file_manager_button_group"},b.el)}}),this.list.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})},setValue:function(a){this.list.setValue({value:a})},getValue:function(){return this.list.getValue()},populate:function(a){this.list.populate(a),this.list.setToolBarVisible(!0)}}),BI.FileManagerList.EVENT_CHANGE="FileManagerList.EVENT_CHANGE",BI.shortcut("bi.file_manager_list",BI.FileManagerList),BI.FileManagerNavButton=BI.inherit(BI.Widget,{_const:{normal_color:"#ffffff",select_color:"#eff1f4"},_defaultConfig:function(){return BI.extend(BI.FileManagerNavButton.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-file-manager-nav-button",selected:!1,height:40})},_init:function(){BI.FileManagerNavButton.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._const;this.button=BI.createWidget({type:"bi.text_button",cls:"file-manager-nav-button-text bi-card",once:!0,selected:b.selected,text:b.text,title:b.text,value:b.value,height:b.height,lgap:20,rgap:10}),this.button.on(BI.Controller.EVENT_CHANGE,function(){arguments[2]=a,a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var d=BI.createWidget({type:"bi.svg",cls:"file-manager-nav-button-triangle",width:15,height:b.height}),e=d.path("M0,0L15,20L0,40").attr({stroke:c.select_color,fill:b.selected?c.select_color:c.normal_color});this.button.on(BI.TextButton.EVENT_CHANGE,function(){this.isSelected()?e.attr("fill",c.select_color):e.attr("fill",c.normal_color)}),BI.createWidget({type:"bi.default",element:this,items:[this.button]}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:d,right:-15,top:0,bottom:0}]})},isSelected:function(){return this.button.isSelected()},setValue:function(a){this.button.setValue(a)},getValue:function(){return this.button.getValue()},populate:function(a){}}),BI.FileManagerNavButton.EVENT_CHANGE="FileManagerNavButton.EVENT_CHANGE",BI.shortcut("bi.file_manager_nav_button",BI.FileManagerNavButton),BI.FileManagerNav=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.FileManagerNav.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-file-manager-nav bi-border-left",height:40,items:[]})},_init:function(){BI.FileManagerNav.superclass._init.apply(this,arguments);var a=this,b=this.options;this.tree=new BI.Tree,this.refreshTreeData(b.items),this.tree.getRoot().set("data",{text:BI.i18nText("BI-Created_By_Me"),value:BI.FileManagerNav.ROOT_CREATE_BY_ME,id:BI.FileManagerNav.ROOT_CREATE_BY_ME}),this.button_group=BI.createWidget({type:"bi.button_group",element:this,items:[{type:"bi.file_manager_nav_button",text:BI.i18nText("BI-Created_By_Me"),selected:!0,id:BI.FileManagerNav.ROOT_CREATE_BY_ME,value:BI.FileManagerNav.ROOT_CREATE_BY_ME}],layouts:[{type:"bi.horizontal"}]}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.button_group.on(BI.ButtonGroup.EVENT_CHANGE,function(b,c){a.fireEvent(BI.FileManagerNav.EVENT_CHANGE,arguments)})},_getAllParents:function(a){var b,c=[];for(b=a?this.tree.search(a):this.tree.getRoot();b.parent;)c.push(b),b=b.parent;return c.push(b),c.reverse()},_formatNodes:function(a){var b=[];return BI.each(a,function(a,c){b.push(BI.extend({type:"bi.file_manager_nav_button",id:c.id},c.get("data")))}),BI.last(b).selected=!0,b},getValue:function(){return this.button_group.getValue()},getId:function(){var a=[];return BI.each(this.button_group.getSelectedButtons(),function(b,c){a.push(c.attr("id"))}),a},refreshTreeData:function(a){this.tree.initTree(BI.Tree.transformToTreeFormat(a)),this.tree.getRoot().set("data",{text:BI.i18nText("BI-Created_By_Me"),value:BI.FileManagerNav.ROOT_CREATE_BY_ME,id:BI.FileManagerNav.ROOT_CREATE_BY_ME})},populate:function(a){var b=BI.isNull(a)?[this.tree.getRoot()]:this._getAllParents(a.id);this.button_group.populate(this._formatNodes(b))}}),BI.extend(BI.FileManagerNav,{ROOT_CREATE_BY_ME:"-1"}),BI.FileManagerNav.EVENT_CHANGE="FileManagerNav.EVENT_CHANGE",BI.shortcut("bi.file_manager_nav",BI.FileManagerNav),BI.InteractiveArrangement=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.InteractiveArrangement.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-interactive-arrangement",resizable:!0,layoutType:BI.Arrangement.LAYOUT_TYPE.GRID,items:[]})},_init:function(){BI.InteractiveArrangement.superclass._init.apply(this,arguments);var a=this,b=this.options;this.arrangement=BI.createWidget({type:"bi.adaptive_arrangement",element:this,resizable:b.resizable,layoutType:b.layoutType,items:b.items}),this.arrangement.on(BI.AdaptiveArrangement.EVENT_SCROLL,function(){a.fireEvent(BI.InteractiveArrangement.EVENT_SCROLL,arguments)}),this.arrangement.on(BI.AdaptiveArrangement.EVENT_RESIZE,function(){a.fireEvent(BI.InteractiveArrangement.EVENT_RESIZE,arguments)}),this.arrangement.on(BI.AdaptiveArrangement.EVENT_ELEMENT_RESIZE,function(b,c){var d=a._getRegionClientPosition(b);a.draw({left:d.left,top:d.top},c,b)}),this.arrangement.on(BI.AdaptiveArrangement.EVENT_ELEMENT_STOP_RESIZE,function(b,c){a.stopDraw(),a.setRegionSize(b,c)}),this.tags=[]},_isEqual:function(a,b){return this.arrangement._isEqual(a,b)},_getScrollOffset:function(){return this.arrangement._getScrollOffset()},_positionAt:function(a,b){var c=this;b=b||this.getAllRegions();var d=[],e=[],f=[],g=[],h=[],i=[];return BI.each(b,function(b,j){var k=c._getRegionClientPosition(j.id);Math.abs(k.left-a.left)<=3&&d.push(j),Math.abs(k.left+k.width/2-a.left)<=3&&e.push(j),Math.abs(k.left+k.width-a.left)<=3&&f.push(j),Math.abs(k.top-a.top)<=3&&g.push(j),Math.abs(k.top+k.height/2-a.top)<=3&&h.push(j),Math.abs(k.top+k.height-a.top)<=3&&i.push(j)}),{left:d,center:e,right:f,top:g,middle:h,bottom:i}},_getRegionClientPosition:function(a){var b=this.getRegionByName(a),c=this.arrangement._getScrollOffset();return{top:b.top-c.top,left:b.left-c.left,width:b.width,height:b.height,id:b.id}},_vAlign:function(a,b){var c,d=this,e=this._positionAt(a,b),f=[];if(e.left.length>0)c=this._getRegionClientPosition(e.left[0].id).left;else if(e.right.length>0){
var g=this._getRegionClientPosition(e.right[0].id);c=g.left+g.width}else if(e.center.length>0){var g=this._getRegionClientPosition(e.center[0].id);c=g.left+g.width/2}var h=e.left.concat(e.right).concat(e.center);return BI.each(h,function(b,e){var g=d._getRegionClientPosition(e.id);if(d._isEqual(g.left,c)||d._isEqual(g.left+g.width,c)||d._isEqual(g.left+g.width/2,c)){var h={top:g.top+g.height/2,left:c};f.push({id:e.id,start:h,end:{left:c,top:a.top}})}}),f},_leftAlign:function(a,b,c){return this._vAlign({left:a.left,top:a.top+b.height/2},c)},_rightAlign:function(a,b,c){return this._vAlign({left:a.left+b.width,top:a.top+b.height/2},c)},_hAlign:function(a,b){var c,d=this,e=this._positionAt(a,b),f=[];if(e.top.length>0){var g=this._getRegionClientPosition(e.top[0].id);c=g.top}else if(e.bottom.length>0){var g=this._getRegionClientPosition(e.bottom[0].id);c=g.top+g.height}else if(e.middle.length>0){var g=this._getRegionClientPosition(e.middle[0].id);c=g.top+g.height/2}var h=e.top.concat(e.bottom).concat(e.middle);return BI.each(h,function(b,e){var g=d._getRegionClientPosition(e.id);if(d._isEqual(g.top,c)||d._isEqual(g.top+g.height,c)||d._isEqual(g.top+g.height/2,c)){var h={top:c,left:g.left+g.width/2};f.push({id:g.id,start:h,end:{left:a.left,top:c}})}}),f},_topAlign:function(a,b,c){return this._hAlign({left:a.left+b.width/2,top:a.top},c)},_bottomAlign:function(a,b,c){return this._hAlign({left:a.left+b.width/2,top:a.top+b.height},c)},_centerAlign:function(a,b,c){return this._vAlign({left:a.left+b.width/2,top:a.top+b.height/2},c)},_middleAlign:function(a,b,c){return this._hAlign({left:a.left+b.width/2,top:a.top+b.height/2},c)},_drawOneTag:function(a,b){var c=BI.createWidget({type:"bi.icon_button",width:13,height:13,cls:"drag-tag-font interactive-arrangement-dragtag-icon"}),d=BI.createWidget({type:"bi.icon_button",width:13,height:13,cls:"drag-tag-font interactive-arrangement-dragtag-icon"});if(this._isEqual(a.left,b.left))var e=BI.createWidget({type:"bi.layout",cls:"interactive-arrangement-dragtag-line",width:1,height:Math.abs(a.top-b.top)});else var e=BI.createWidget({type:"bi.layout",cls:"interactive-arrangement-dragtag-line",height:1,width:Math.abs(a.left-b.left)});BI.createWidget({type:"bi.absolute",element:this,items:[{el:c,left:a.left-6,top:a.top-7},{el:d,left:b.left-6,top:b.top-7},{el:e,left:Math.min(a.left,b.left),top:Math.min(a.top,b.top)}]}),this.tags.push(c),this.tags.push(d),this.tags.push(e)},stopDraw:function(){BI.each(this.tags,function(a,b){b.destroy()}),this.tags=[]},_getRegionExcept:function(a,b){var c=[];return BI.each(b||this.getAllRegions(),function(b,d){a&&d.id===a||c.push(d)}),c},getClientWidth:function(){return this.arrangement.getClientWidth()},getClientHeight:function(){return this.arrangement.getClientHeight()},getPosition:function(a,b,c){var d,e=this.getAllRegions();a&&(d=this._getRegionClientPosition(a));var f=this._getRegionExcept(a,e);b=b||{left:d.left,top:d.top},c=c||{width:d.width,height:d.height};var g=this._leftAlign(b,c,f),h=this._rightAlign(b,c,f),i=this._topAlign(b,c,f,f),j=this._bottomAlign(b,c,f),k=this._centerAlign(b,c,f),l=this._middleAlign(b,c,f);return BI.each(k,function(a,d){b.left=d.end.left-c.width/2}),BI.each(h,function(a,d){b.left=d.end.left-c.width}),BI.each(g,function(a,c){b.left=c.end.left}),BI.each(l,function(a,d){b.top=d.end.top-c.height/2}),BI.each(j,function(a,d){b.top=d.end.top-c.height}),BI.each(i,function(a,c){b.top=c.end.top}),b},getSize:function(a,b,c){var d,e=this.getAllRegions();a&&(d=this._getRegionClientPosition(a));var f=this._getRegionExcept(a,e);b=b||{left:d.left,top:d.top},c=c||{width:d.width,height:d.height};var g=this._leftAlign(b,c,f),h=this._rightAlign(b,c,f),i=this._topAlign(b,c,f,f),j=this._bottomAlign(b,c,f),k=this._centerAlign(b,c,f),l=this._middleAlign(b,c,f);return BI.each(k,function(a,d){c.width=2*(d.end.left-b.left)}),BI.each(h,function(a,d){c.width=d.end.left-b.left}),BI.each(g,function(a,b){}),BI.each(l,function(a,d){c.height=2*(d.end.top-b.top)}),BI.each(j,function(a,d){c.height=d.end.top-b.top}),BI.each(i,function(a,b){}),c},draw:function(a,b,c){var d=this;switch(this.stopDraw(),this.getLayoutType()){case BI.Arrangement.LAYOUT_TYPE.FREE:var e=this._getRegionExcept(c),f=this._leftAlign(a,b,e),g=this._rightAlign(a,b,e),h=this._topAlign(a,b,e),i=this._bottomAlign(a,b,e),j=this._centerAlign(a,b,e),k=this._middleAlign(a,b,e);BI.each(j,function(a,b){d._drawOneTag(b.start,b.end)}),BI.each(g,function(a,b){d._drawOneTag(b.start,b.end)}),BI.each(f,function(a,b){d._drawOneTag(b.start,b.end)}),BI.each(k,function(a,b){d._drawOneTag(b.start,b.end)}),BI.each(i,function(a,b){d._drawOneTag(b.start,b.end)}),BI.each(h,function(a,b){d._drawOneTag(b.start,b.end)});break;case BI.Arrangement.LAYOUT_TYPE.GRID:}},addRegion:function(a,b){return this.stopDraw(),this.arrangement.addRegion(a,b)},deleteRegion:function(a){return this.arrangement.deleteRegion(a)},setRegionSize:function(a,b){return b=this.getSize(a,null,b),this.arrangement.setRegionSize(a,b)},setPosition:function(a,b){if(this.stopDraw(),a.left>0&&a.top>0)switch(this.getLayoutType()){case BI.Arrangement.LAYOUT_TYPE.FREE:a=this.getPosition(null,a,b),this.draw(a,b);break;case BI.Arrangement.LAYOUT_TYPE.GRID:}var c=this.arrangement.setPosition(a,b);return c},setRegionPosition:function(a,b){if(b.left>0&&b.top>0)switch(this.getLayoutType()){case BI.Arrangement.LAYOUT_TYPE.FREE:b=this.getPosition(a,b);break;case BI.Arrangement.LAYOUT_TYPE.GRID:}return this.arrangement.setRegionPosition(a,b)},setDropPosition:function(a,b){var c=this;if(this.stopDraw(),a.left>0&&a.top>0)switch(this.getLayoutType()){case BI.Arrangement.LAYOUT_TYPE.FREE:a=this.getPosition(null,a,b),this.draw(a,b);break;case BI.Arrangement.LAYOUT_TYPE.GRID:}var d=c.arrangement.setDropPosition(a,b);return function(){d(),c.stopDraw()}},scrollInterval:function(){this.arrangement.scrollInterval.apply(this.arrangement,arguments)},scrollEnd:function(){this.arrangement.scrollEnd.apply(this.arrangement,arguments)},scrollTo:function(a){this.arrangement.scrollTo(a)},zoom:function(a){this.arrangement.zoom(a)},resize:function(){return this.arrangement.resize()},relayout:function(){return this.arrangement.relayout()},setLayoutType:function(a){this.arrangement.setLayoutType(a)},getLayoutType:function(){return this.arrangement.getLayoutType()},getLayoutRatio:function(){return this.arrangement.getLayoutRatio()},getHelper:function(){return this.arrangement.getHelper()},getRegionByName:function(a){return this.arrangement.getRegionByName(a)},getAllRegions:function(){return this.arrangement.getAllRegions()},revoke:function(){return this.arrangement.revoke()},populate:function(a){this.arrangement.populate(a)}}),BI.InteractiveArrangement.EVENT_RESIZE="InteractiveArrangement.EVENT_RESIZE",BI.InteractiveArrangement.EVENT_SCROLL="InteractiveArrangement.EVENT_SCROLL",BI.shortcut("bi.interactive_arrangement",BI.InteractiveArrangement),BI.IntervalSlider=BI.inherit(BI.Widget,{_constant:{EDITOR_WIDTH:58,EDITOR_R_GAP:60,EDITOR_HEIGHT:30,SLIDER_WIDTH_HALF:15,SLIDER_WIDTH:30,SLIDER_HEIGHT:30,TRACK_HEIGHT:24},_defaultConfig:function(){return BI.extend(BI.IntervalSlider.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-interval-slider bi-slider-track",digit:!1,unit:""})},_init:function(){BI.IntervalSlider.superclass._init.apply(this,arguments);var a=this,b=this._constant;this.enable=!1,this.valueOne="",this.valueTwo="",this.calculation=new BI.AccurateCalculationModel,this.grayTrack=BI.createWidget({type:"bi.layout",cls:"gray-track",height:6}),this.blueTrack=BI.createWidget({type:"bi.layout",cls:"blue-track bi-high-light-background",height:6}),this.track=this._createTrackWrapper(),this.labelOne=BI.createWidget({type:"bi.sign_text_editor",cls:"slider-editor-button",text:this.options.unit,errorText:"",allowBlank:!1,width:b.EDITOR_WIDTH,validationChecker:function(b){return a._checkValidation(b)}}),this.labelOne.element.hover(function(){a.labelOne.element.removeClass("bi-border").addClass("bi-border")},function(){a.labelOne.element.removeClass("bi-border")}),this.labelOne.on(BI.Editor.EVENT_CONFIRM,function(){var b=BI.parseFloat(this.getValue());a.valueOne=b;var c=a._getPercentByValue(b),d=BI.parseFloat(c.toFixed(1));a._setLabelOnePosition(d),a._setSliderOnePosition(d),a._setBlueTrack(),a.fireEvent(BI.IntervalSlider.EVENT_CHANGE)}),this.labelTwo=BI.createWidget({type:"bi.sign_text_editor",cls:"slider-editor-button",errorText:"",text:this.options.unit,allowBlank:!1,width:b.EDITOR_WIDTH,validationChecker:function(b){return a._checkValidation(b)}}),this.labelTwo.element.hover(function(){a.labelTwo.element.removeClass("bi-border").addClass("bi-border")},function(){a.labelTwo.element.removeClass("bi-border")}),this.labelTwo.on(BI.Editor.EVENT_CONFIRM,function(){var b=BI.parseFloat(this.getValue());a.valueTwo=b;var c=a._getPercentByValue(b),d=BI.parseFloat(c.toFixed(1));a._setLabelTwoPosition(d),a._setSliderTwoPosition(d),a._setBlueTrack(),a.fireEvent(BI.IntervalSlider.EVENT_CHANGE)}),this.sliderOne=BI.createWidget({type:"bi.single_slider_button"}),this.sliderTwo=BI.createWidget({type:"bi.single_slider_button"}),this._draggable(this.sliderOne,!0),this._draggable(this.sliderTwo,!1),this._setVisible(!1),BI.createWidget({type:"bi.absolute",element:this,items:[{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[{el:this.track,width:"100%",height:b.TRACK_HEIGHT}]}],hgap:7,height:b.TRACK_HEIGHT},top:23,left:0,width:"100%"},this._createLabelWrapper(),this._createSliderWrapper()]})},_rePosBySizeAfterMove:function(a,b){var c=this.options,d=100*a/this._getGrayTrackLength(),e=BI.parseFloat(d.toFixed(1)),f=this._getValueByPercent(e);f=this._assertValue(f),f=c.digit===!1?f:f.toFixed(c.digit),b?(this._setLabelOnePosition(e),this._setSliderOnePosition(e),this.labelOne.setValue(f),this.valueOne=f):(this._setLabelTwoPosition(e),this._setSliderTwoPosition(e),this.labelTwo.setValue(f),this.valueTwo=f),this._setBlueTrack()},_rePosBySizeAfterStop:function(a,b){var c=100*a/this._getGrayTrackLength(),d=BI.parseFloat(c.toFixed(1));b?this._setSliderOnePosition(d):this._setSliderTwoPosition(d)},_draggable:function(a,b){function c(a){return BI.clamp(a,0,d._getGrayTrackLength())}var d=this,e=(this.options,!1),f=0,g=0,h=0,i=new BI.MouseMoveTracker(function(j){i.isDragging()&&(e=!0,g+=j,f=c(h+g),a.element.addClass("dragging"),d._rePosBySizeAfterMove(f,b))},function(){e===!0&&(f=c(f),d._rePosBySizeAfterStop(f,b),f=0,g=0,h=f,e=!1),a.element.removeClass("dragging"),i.releaseMouseMoves(),d.fireEvent(BI.IntervalSlider.EVENT_CHANGE)},document);a.element.on("mousedown",function(b){a.isEnabled()&&(h=this.offsetLeft,c(h),i.captureMouseMoves(b))})},_createLabelWrapper:function(){var a=this._constant;return{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[{el:this.labelOne,top:0,left:"0%"}]},{type:"bi.absolute",items:[{el:this.labelTwo,top:0,left:"100%"}]}],rgap:a.EDITOR_R_GAP,height:70},top:0,left:0,width:"100%"}},_createSliderWrapper:function(){var a=this._constant;return{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[{el:this.sliderOne,top:0,left:"0%"}]},{type:"bi.absolute",items:[{el:this.sliderTwo,top:0,left:"100%"}]}],hgap:a.SLIDER_WIDTH_HALF,height:a.SLIDER_HEIGHT},top:20,left:0,width:"100%"}},_createTrackWrapper:function(){return BI.createWidget({type:"bi.absolute",items:[{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[{el:this.grayTrack,top:0,left:0,width:"100%"},{el:this.blueTrack,top:0,left:0,width:"0%"}]}],hgap:8,height:8},top:8,left:0,width:"100%"}]})},_checkValidation:function(a){var b=this.options,c=!1,d=(a+"").split(".")[1];return BI.isEmptyString(d)||BI.isNumeric(a)&&!(BI.isNull(a)||a<this.min||a>this.max)&&(b.digit===!1?c=!0:(d=d||"",c=d.length===b.digit)),c},_checkOverlap:function(){var a=this.labelOne.element[0].offsetLeft,b=this.labelTwo.element[0].offsetLeft;a<=b?b-a<90?this.labelTwo.element.css({top:40}):this.labelTwo.element.css({top:0}):a-b<90?this.labelTwo.element.css({top:40}):this.labelTwo.element.css({top:0})},_setLabelOnePosition:function(a){this.labelOne.element.css({left:a+"%"}),this._checkOverlap()},_setLabelTwoPosition:function(a){this.labelTwo.element.css({left:a+"%"}),this._checkOverlap()},_setSliderOnePosition:function(a){this.sliderOne.element.css({left:a+"%"})},_setSliderTwoPosition:function(a){this.sliderTwo.element.css({left:a+"%"})},_setBlueTrackLeft:function(a){this.blueTrack.element.css({left:a+"%"})},_setBlueTrackWidth:function(a){this.blueTrack.element.css({width:a+"%"})},_setBlueTrack:function(){var a=this._getPercentByValue(this.labelOne.getValue()),b=this._getPercentByValue(this.labelTwo.getValue());a<=b?(this._setBlueTrackLeft(a),this._setBlueTrackWidth(b-a)):(this._setBlueTrackLeft(b),this._setBlueTrackWidth(a-b))},_setAllPosition:function(a,b){this._setSliderOnePosition(a),this._setLabelOnePosition(a),this._setSliderTwoPosition(b),this._setLabelTwoPosition(b),this._setBlueTrack()},_setVisible:function(a){this.sliderOne.setVisible(a),this.sliderTwo.setVisible(a),this.labelOne.setVisible(a),this.labelTwo.setVisible(a)},_setErrorText:function(){var a=BI.i18nText("BI-Please_Enter")+this.min+"-"+this.max+BI.i18nText("BI-Basic_De")+BI.i18nText("BI-Basic_Number");this.labelOne.setErrorText(a),this.labelTwo.setErrorText(a)},_getGrayTrackLength:function(){return this.grayTrack.element[0].scrollWidth},_getValueByPercent:function(a){var b=this.calculation.accurateSubtraction(this.max,this.min),c=this.calculation.accurateMultiplication(b,a),d=this.calculation.accurateDivisionTenExponent(c,2);if(this.precision<0){var e=BI.parseFloat(this.calculation.accurateAddition(d,this.min)),f=Math.round(this.calculation.accurateDivisionTenExponent(e,-this.precision));return this.calculation.accurateMultiplication(f,Math.pow(10,-this.precision))}return BI.parseFloat(this.calculation.accurateAddition(d,this.min).toFixed(this.precision))},_getPercentByValue:function(a){return 100*(a-this.min)/(this.max-this.min)},_setDraggableEnable:function(a){this.sliderOne.setEnable(a),this.sliderTwo.setEnable(a)},_getPrecision:function(){var a=this.calculation.accurateSubtraction(this.max,this.min),b=a.toPrecision(4),c=b.indexOf("e"),d=[];if(c>-1){d=b.split("e");var e=BI.size(d[0].split(".")[1]),f=BI.parseInt(d[1].substring(1));return e-f}return d=b.split("."),d.length>1?d[1].length:0},_assertValue:function(a){return a<=this.min?this.min:a>=this.max?this.max:a},getValue:function(){return this.valueOne<=this.valueTwo?{min:this.valueOne,max:this.valueTwo}:{min:this.valueTwo,max:this.valueOne}},setMinAndMax:function(a){var b=BI.parseFloat(a.min),c=BI.parseFloat(a.max);!isNaN(b)&&!isNaN(c)&&c>=b&&(this.min=b,this.max=c,this.valueOne=b,this.valueTwo=c,this.precision=this._getPrecision(),this._setDraggableEnable(!0)),c===b&&this._setDraggableEnable(!1)},setValue:function(a){var b=this.options,c=BI.parseFloat(a.min),d=BI.parseFloat(a.max);c=b.digit===!1?c:c.toFixed(b.digit),d=b.digit===!1?d:d.toFixed(b.digit),isNaN(c)||isNaN(d)||(this._checkValidation(c)&&(this.valueOne=c),this._checkValidation(d)&&(this.valueTwo=d),c<this.min&&(this.valueOne=this.min),d>this.max&&(this.valueTwo=this.max))},reset:function(){this._setVisible(!1),this.enable=!1,this.valueOne="",this.valueTwo="",this.min=NaN,this.max=NaN,this._setBlueTrackWidth(0)},populate:function(){isNaN(this.min)||isNaN(this.max)||(this.enable=!0,this._setVisible(!0),this._setErrorText(),(BI.isNumeric(this.valueOne)||BI.isNotEmptyString(this.valueOne))&&(BI.isNumeric(this.valueTwo)||BI.isNotEmptyString(this.valueTwo))?(this.labelOne.setValue(this.valueOne),this.labelTwo.setValue(this.valueTwo),this._setAllPosition(this._getPercentByValue(this.valueOne),this._getPercentByValue(this.valueTwo))):(this.labelOne.setValue(this.min),this.labelTwo.setValue(this.max),this._setAllPosition(0,100)))}}),BI.IntervalSlider.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.interval_slider",BI.IntervalSlider),BI.AccurateCalculationModel=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.AccurateCalculationModel.superclass._defaultConfig.apply(this,arguments),{baseCls:""})},_init:function(){BI.AccurateCalculationModel.superclass._init.apply(this,arguments)},_getMagnitude:function(a){for(var b="1",c=0;c<a;c++)b+="0";return BI.parseInt(b)},_formatDecimal:function(a,b){if(a.numDecimalLength!==b.numDecimalLength){var c=a.numDecimalLength-b.numDecimalLength;if(c>0)var d=b;else{var d=a;c=0-c}for(var e=0;e<c;e++)"0"===d.numDecimal&&0===e||(d.numDecimal+="0")}},_stringNumberFactory:function(a){var b=a.toString(),c=b.split("."),d=c[0];if(1===c.length)var e="0",f=0;else var e=c[1],f=c[1].length;return{numInteger:d,numDecimal:e,numDecimalLength:f}},_accurateSubtraction:function(a,b){function c(a,b){return a.numDecimal.length>=b.numDecimal.length?a.numDecimal.length:b.numDecimal.length}function d(a,b){for(var c=b-a.length,d=0;d<c;d++)a="0"+a;return a}var e=this._stringNumberFactory(a),f=this._stringNumberFactory(b),g=BI.parseInt(e.numInteger)-BI.parseInt(f.numInteger);this._formatDecimal(e,f);var h=c(e,f);if(BI.parseInt(e.numDecimal)>=BI.parseInt(f.numDecimal))var i=(BI.parseInt(e.numDecimal)-BI.parseInt(f.numDecimal)).toString(),j=d(i,h);else{g--;var k=this._getMagnitude(h),i=(k+BI.parseInt(e.numDecimal)-BI.parseInt(f.numDecimal)).toString(),j=d(i,h)}var l=g+"."+j;return BI.parseFloat(l)},_accurateAddition:function(a,b){function c(a,b){for(var c=b-a.length,d=0;d<c;d++)a="0"+a;return a}var d=this._stringNumberFactory(a),e=this._stringNumberFactory(b),f=BI.parseInt(d.numInteger)+BI.parseInt(e.numInteger);this._formatDecimal(d,e);var g=(BI.parseInt(d.numDecimal)+BI.parseInt(e.numDecimal)).toString();"0"!==g&&(g.length<=d.numDecimal.length?g=c(g,d.numDecimal.length):(f++,g=g.slice(1)));var h=f+"."+g;return BI.parseFloat(h)},_accurateMultiplication:function(a,b){var c=this._stringNumberFactory(a),d=this._stringNumberFactory(b),e=BI.parseInt(c.numInteger)*BI.parseInt(d.numInteger),f=this._accurateDivisionTenExponent(BI.parseInt(c.numDecimal)*BI.parseInt(d.numInteger),c.numDecimalLength),g=this._accurateDivisionTenExponent(BI.parseInt(c.numInteger)*BI.parseInt(d.numDecimal),d.numDecimalLength),h=this._accurateDivisionTenExponent(BI.parseInt(c.numDecimal)*BI.parseInt(d.numDecimal),c.numDecimalLength+d.numDecimalLength);return this._accurateAddition(this._accurateAddition(this._accurateAddition(e,f),g),h)},_accurateDivisionTenExponent:function(a,b){function c(a,b){for(var c=b-a.length,d=0;d<c;d++)a="0"+a;return a}var d=this._stringNumberFactory(a);if(d.numInteger.length>b)var e=d.numInteger.slice(0,d.numInteger.length-b),f=d.numInteger.slice(-b);else var e="0",f=c(d.numInteger,b);var g=e+"."+f+d.numDecimal;return BI.parseFloat(g)},accurateSubtraction:function(a,b){return a>=0&&b>=0?a>=b?this._accurateSubtraction(a,b):-this._accurateSubtraction(b,a):a>=0&&b<0?this._accurateAddition(a,-b):a<0&&b>=0?-this._accurateAddition(-a,b):a<0&&b<0?a>=b?this._accurateSubtraction(-b,-a):this._accurateSubtraction(-a,-b):void 0},accurateAddition:function(a,b){return a>=0&&b>=0?this._accurateAddition(a,b):a>=0&&b<0?this.accurateSubtraction(a,-b):a<0&&b>=0?this.accurateSubtraction(b,-a):a<0&&b<0?-this._accurateAddition(-a,-b):void 0},accurateMultiplication:function(a,b){return a>=0&&b>=0?this._accurateMultiplication(a,b):a>=0&&b<0?-this._accurateMultiplication(a,-b):a<0&&b>=0?-this._accurateMultiplication(-a,b):a<0&&b<0?this._accurateMultiplication(-a,-b):void 0},accurateDivisionTenExponent:function(a,b){return a>=0?this._accurateDivisionTenExponent(a,b):-this._accurateDivisionTenExponent(-a,b)}}),BI.MonthCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MonthCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-month-combo",behaviors:{},height:25})},_init:function(){BI.MonthCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget({type:"bi.month_trigger"}),this.trigger.on(BI.MonthTrigger.EVENT_CONFIRM,function(b){a.combo.isViewVisible()||(this.getKey()&&this.getKey()!==a.storeValue?a.setValue(this.getValue()):this.getKey()||a.setValue(),a.fireEvent(BI.MonthCombo.EVENT_CONFIRM))}),this.trigger.on(BI.MonthTrigger.EVENT_FOCUS,function(){a.storeValue=this.getKey()}),this.trigger.on(BI.MonthTrigger.EVENT_START,function(){a.combo.hideView()}),this.trigger.on(BI.MonthTrigger.EVENT_STOP,function(){a.combo.isViewVisible()||a.combo.showView()}),this.popup=BI.createWidget({type:"bi.month_popup",behaviors:b.behaviors}),this.popup.on(BI.MonthPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.combo.hideView(),a.fireEvent(BI.MonthCombo.EVENT_CONFIRM)}),this.combo=BI.createWidget({type:"bi.combo",element:this,isNeedAdjustHeight:!1,isNeedAdjustWidth:!1,el:this.trigger,popup:{minWidth:85,el:this.popup}}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){a.fireEvent(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW)})},setValue:function(a){this.trigger.setValue(a),this.popup.setValue(a)},getValue:function(){return this.popup.getValue()}}),BI.MonthCombo.EVENT_CONFIRM="EVENT_CONFIRM",BI.MonthCombo.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.shortcut("bi.month_combo",BI.MonthCombo),BI.MonthPopup=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MonthPopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-month-popup",behaviors:{}})},_init:function(){BI.MonthPopup.superclass._init.apply(this,arguments);var a=this,b=this.options,c=[0,6,1,7,2,8,3,9,4,10,5,11],d=[];d.push(c.slice(0,2)),d.push(c.slice(2,4)),d.push(c.slice(4,6)),d.push(c.slice(6,8)),d.push(c.slice(8,10)),d.push(c.slice(10,12)),d=BI.map(d,function(a,b){return BI.map(b,function(a,b){return{type:"bi.text_item",cls:"bi-list-item-active",textAlign:"center",whiteSpace:"nowrap",once:!1,forceSelected:!0,height:23,width:38,value:b,text:b+1}})}),this.month=BI.createWidget({type:"bi.button_group",element:this,behaviors:b.behaviors,items:BI.createItems(d,{}),layouts:[BI.LogicFactory.createLogic("table",BI.extend({dynamic:!0},{columns:2,rows:6,columnSize:[.5,.5],rowSize:25})),{type:"bi.center_adapt",vgap:1,hgap:2}]}),this.month.on(BI.Controller.EVENT_CHANGE,function(b){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.MonthPopup.EVENT_CHANGE)})},getValue:function(){return this.month.getValue()[0]},setValue:function(a){this.month.setValue([a])}}),BI.MonthPopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.month_popup",BI.MonthPopup),BI.MonthTrigger=BI.inherit(BI.Trigger,{_const:{hgap:4,vgap:2,errorText:BI.i18nText("BI-Month_Trigger_Error_Text")},_defaultConfig:function(){return BI.extend(BI.MonthTrigger.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-month-trigger bi-border",height:24})},_init:function(){BI.MonthTrigger.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._const;this.editor=BI.createWidget({type:"bi.sign_editor",height:b.height,validationChecker:function(a){return""===a||BI.isPositiveInteger(a)&&a>=1&&a<=12},quitChecker:function(a){return!1},hgap:c.hgap,vgap:c.vgap,allowBlank:!0,errorText:c.errorText}),this.editor.on(BI.SignEditor.EVENT_FOCUS,function(){a.fireEvent(BI.MonthTrigger.EVENT_FOCUS)}),this.editor.on(BI.SignEditor.EVENT_CHANGE,function(){a.fireEvent(BI.MonthTrigger.EVENT_CHANGE)}),this.editor.on(BI.SignEditor.EVENT_CONFIRM,function(){var b=a.editor.getValue();BI.isNotNull(b)&&(a.editor.setValue(b),a.editor.setTitle(b)),a.fireEvent(BI.MonthTrigger.EVENT_CONFIRM)}),this.editor.on(BI.SignEditor.EVENT_SPACE,function(){a.editor.isValid()&&a.editor.blur()}),this.editor.on(BI.SignEditor.EVENT_START,function(){a.fireEvent(BI.MonthTrigger.EVENT_START)}),this.editor.on(BI.SignEditor.EVENT_STOP,function(){a.fireEvent(BI.MonthTrigger.EVENT_STOP)}),BI.createWidget({element:this,type:"bi.htape",items:[{el:this.editor},{el:{type:"bi.text_button",text:BI.i18nText("BI-Multi_Date_Month"),baseCls:"bi-trigger-month-text",width:b.height},width:b.height},{el:{type:"bi.trigger_icon_button",width:b.height},width:b.height}]})},setValue:function(a){return BI.isNotNull(a)?(this.editor.setState(a+1),this.editor.setValue(a+1),void this.editor.setTitle(a+1)):(this.editor.setState(""),this.editor.setValue(""),void this.editor.setTitle(""))},getKey:function(){return 0|this.editor.getValue()},getValue:function(){return this.editor.getValue()-1}}),BI.MonthTrigger.EVENT_FOCUS="EVENT_FOCUS",BI.MonthTrigger.EVENT_CONFIRM="EVENT_CONFIRM",BI.MonthTrigger.EVENT_START="EVENT_START",BI.MonthTrigger.EVENT_STOP="EVENT_STOP",BI.MonthTrigger.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.month_trigger",BI.MonthTrigger),BI.MultiDateCard=BI.inherit(BI.Widget,{constants:{lgap:80,itemHeight:35,defaultEditorValue:"1"},_defaultConfig:function(){return $.extend(BI.MultiDateCard.superclass._defaultConfig.apply(this,arguments),{})},dateConfig:function(){},defaultSelectedItem:function(){},_init:function(){BI.MultiDateCard.superclass._init.apply(this,arguments);var a=this;this.options;this.label=BI.createWidget({type:"bi.label",height:this.constants.itemHeight,textAlign:"left",text:BI.i18nText("BI-Multi_Date_Relative_Current_Time"),cls:"bi-multidate-inner-label bi-tips"}),this.radioGroup=BI.createWidget({type:"bi.button_group",chooseType:0,items:BI.createItems(this.dateConfig(),{type:"bi.multidate_segment",height:this.constants.itemHeight}),layouts:[{type:"bi.vertical"}]}),this.radioGroup.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CONFIRM&&a.fireEvent(BI.MultiDateCard.EVENT_CHANGE)}),this.radioGroup.on(BI.ButtonGroup.EVENT_CHANGE,function(){a.setValue(a.getValue()),a.fireEvent(BI.MultiDateCard.EVENT_CHANGE)}),BI.createWidget({element:this,type:"bi.center_adapt",lgap:this.constants.lgap,items:[{type:"bi.vertical",items:[this.label,this.radioGroup]}]})},getValue:function(){var a=this.radioGroup.getSelectedButtons()[0],b=a.getValue(),c=a.getInputValue();return{type:b,value:c}},_isTypeAvaliable:function(a){var b=!1;return BI.find(this.dateConfig(),function(c,d){if(d.value===a)return b=!0,!0}),b},setValue:function(a){var b=this;BI.isNotNull(a)&&this._isTypeAvaliable(a.type)?(this.radioGroup.setValue(a.type),BI.each(this.radioGroup.getAllButtons(),function(c,d){d.isEditorExist()===!0&&d.isSelected()?d.setInputValue(a.value):d.setInputValue(b.constants.defaultEditorValue)})):(this.radioGroup.setValue(this.defaultSelectedItem()),BI.each(this.radioGroup.getAllButtons(),function(a,c){c.setInputValue(b.constants.defaultEditorValue)}))},getCalculationValue:function(){var a=this.getValue(),b=a.type,c=a.value;switch(b){case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV:return Date.getDate().getOffsetDate(-1*c);case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER:return Date.getDate().getOffsetDate(c);case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY:return Date.getDate();case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV:return Date.getDate().getBeforeMultiMonth(c);case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER:return Date.getDate().getAfterMultiMonth(c);case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN:return Date.getDate(Date.getDate().getFullYear(),Date.getDate().getMonth(),1);case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END:return Date.getDate(Date.getDate().getFullYear(),Date.getDate().getMonth(),Date.getDate().getLastDateOfMonth().getDate());case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV:return Date.getDate().getBeforeMulQuarter(c);case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER:return Date.getDate().getAfterMulQuarter(c);case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN:return Date.getDate().getQuarterStartDate();case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END:return Date.getDate().getQuarterEndDate();case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV:return Date.getDate().getOffsetDate(-7*c);case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER:return Date.getDate().getOffsetDate(7*c);case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV:return Date.getDate(Date.getDate().getFullYear()-1*c,Date.getDate().getMonth(),Date.getDate().getDate());case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER:return Date.getDate(Date.getDate().getFullYear()+1*c,Date.getDate().getMonth(),Date.getDate().getDate());case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN:return Date.getDate(Date.getDate().getFullYear(),0,1);case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END:return Date.getDate(Date.getDate().getFullYear(),11,31)}}}),BI.MultiDateCard.EVENT_CHANGE="EVENT_CHANGE",BI.MultiDateCombo=BI.inherit(BI.Single,{constants:{popupHeight:259,popupWidth:270,comboAdjustHeight:1,border:1,DATE_MIN_VALUE:"1900-01-01",DATE_MAX_VALUE:"2099-12-31"},_defaultConfig:function(){return BI.extend(BI.MultiDateCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multidate-combo bi-border",height:24})},_init:function(){BI.MultiDateCombo.superclass._init.apply(this,arguments);var a=this;this.options;this.storeTriggerValue="";var b=Date.getDate();this.storeValue=null,this.trigger=BI.createWidget({type:"bi.date_trigger",min:this.constants.DATE_MIN_VALUE,max:this.constants.DATE_MAX_VALUE}),this.trigger.on(BI.DateTrigger.EVENT_KEY_DOWN,function(){a.combo.isViewVisible()&&a.combo.hideView()}),this.trigger.on(BI.DateTrigger.EVENT_STOP,function(){a.combo.isViewVisible()||a.combo.showView()}),this.trigger.on(BI.DateTrigger.EVENT_TRIGGER_CLICK,function(){a.combo.toggle()}),this.trigger.on(BI.DateTrigger.EVENT_FOCUS,function(){a.storeTriggerValue=a.trigger.getKey(),a.combo.isViewVisible()||a.combo.showView(),a.fireEvent(BI.MultiDateCombo.EVENT_FOCUS)}),this.trigger.on(BI.DateTrigger.EVENT_ERROR,function(){a.storeValue={year:b.getFullYear(),month:b.getMonth()},a.popup.setValue(),a.fireEvent(BI.MultiDateCombo.EVENT_ERROR)}),this.trigger.on(BI.DateTrigger.EVENT_VALID,function(){a.fireEvent(BI.MultiDateCombo.EVENT_VALID)}),this.trigger.on(BI.DateTrigger.EVENT_CHANGE,function(){a.fireEvent(BI.MultiDateCombo.EVENT_CHANGE)}),this.trigger.on(BI.DateTrigger.EVENT_CONFIRM,function(){if(!a.combo.isViewVisible()){var b=a.storeTriggerValue,c=a.trigger.getKey();BI.isNotEmptyString(c)&&!BI.isEqual(c,b)?(a.storeValue=a.trigger.getValue(),a.setValue(a.trigger.getValue())):BI.isEmptyString(c)&&(a.storeValue=null,a.trigger.setValue()),a.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM)}}),this.popup=BI.createWidget({type:"bi.multidate_popup",min:this.constants.DATE_MIN_VALUE,max:this.constants.DATE_MAX_VALUE}),this.popup.on(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE,function(){a.setValue(),a.combo.hideView(),a.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM)}),this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE,function(){var b=Date.getDate();a.setValue({year:b.getFullYear(),month:b.getMonth(),day:b.getDate()}),a.combo.hideView(),a.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM)}),this.popup.on(BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.combo.hideView(),a.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM)}),this.popup.on(BI.MultiDatePopup.CALENDAR_EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.combo.hideView(),a.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM)}),this.combo=BI.createWidget({type:"bi.combo",toggle:!1,isNeedAdjustHeight:!1,isNeedAdjustWidth:!1,el:this.trigger,adjustLength:this.constants.comboAdjustHeight,popup:{el:this.popup,maxHeight:this.constants.popupHeight,width:this.constants.popupWidth,stopPropagation:!1}}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){a.popup.setValue(a.storeValue),a.fireEvent(BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW)});var c=BI.createWidget({type:"bi.icon_button",cls:"bi-trigger-icon-button date-font",width:24,height:24});c.on(BI.TriggerIconButton.EVENT_CHANGE,function(){a.combo.isViewVisible()?a.combo.hideView():a.combo.showView()}),this.changeIcon=BI.createWidget({type:"bi.icon_button",cls:"bi-trigger-icon-button date-change-h-font",width:24,height:24});var d=BI.createWidget({type:"bi.absolute",items:[{el:this.combo,top:0,left:0,right:0,bottom:0},{el:c,top:0,left:0}]});BI.createWidget({type:"bi.htape",element:this,items:[d,{el:this.changeIcon,width:30}],ref:function(b){
a.comboWrapper=b}})},_checkDynamicValue:function(a){var b=null;switch(BI.isNotNull(a)&&(b=a.type),b){case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY:this.changeIcon.setVisible(!0),this.comboWrapper.attr("items")[1].width=30,this.comboWrapper.resize();break;default:this.comboWrapper.attr("items")[1].width=0,this.comboWrapper.resize(),this.changeIcon.setVisible(!1)}},setValue:function(a){this.storeValue=a,this.popup.setValue(a),this.trigger.setValue(a),this._checkDynamicValue(a)},getValue:function(){return this.storeValue},getKey:function(){return this.trigger.getKey()},hidePopupView:function(){this.combo.hideView()}}),BI.shortcut("bi.multidate_combo",BI.MultiDateCombo),BI.MultiDateCombo.EVENT_CONFIRM="EVENT_CONFIRM",BI.MultiDateCombo.EVENT_FOCUS="EVENT_FOCUS",BI.MultiDateCombo.EVENT_CHANGE="EVENT_CHANGE",BI.MultiDateCombo.EVENT_VALID="EVENT_VALID",BI.MultiDateCombo.EVENT_ERROR="EVENT_ERROR",BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW="BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW",BI.extend(BI.MultiDateCombo,{MULTI_DATE_YMD_CARD:1,MULTI_DATE_YEAR_CARD:2,MULTI_DATE_QUARTER_CARD:3,MULTI_DATE_MONTH_CARD:4,MULTI_DATE_WEEK_CARD:5,MULTI_DATE_DAY_CARD:6}),BI.extend(BI.MultiDateCombo,{DATE_TYPE:{MULTI_DATE_YEAR_PREV:1,MULTI_DATE_YEAR_AFTER:2,MULTI_DATE_YEAR_BEGIN:3,MULTI_DATE_YEAR_END:4,MULTI_DATE_MONTH_PREV:5,MULTI_DATE_MONTH_AFTER:6,MULTI_DATE_MONTH_BEGIN:7,MULTI_DATE_MONTH_END:8,MULTI_DATE_QUARTER_PREV:9,MULTI_DATE_QUARTER_AFTER:10,MULTI_DATE_QUARTER_BEGIN:11,MULTI_DATE_QUARTER_END:12,MULTI_DATE_WEEK_PREV:13,MULTI_DATE_WEEK_AFTER:14,MULTI_DATE_DAY_PREV:15,MULTI_DATE_DAY_AFTER:16,MULTI_DATE_DAY_TODAY:17,MULTI_DATE_PARAM:18,MULTI_DATE_CALENDAR:19,YEAR_QUARTER:20,YEAR_MONTH:21,YEAR_WEEK:22,YEAR_DAY:23,MONTH_WEEK:24,MONTH_DAY:25,YEAR:26,SAME_PERIOD:27,LAST_SAME_PERIOD:28}}),BI.DayCard=BI.inherit(BI.MultiDateCard,{_defaultConfig:function(){return $.extend(BI.DayCard.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multidate-daycard"})},_init:function(){BI.DayCard.superclass._init.apply(this,arguments)},dateConfig:function(){return[{isEditorExist:!0,selected:!0,text:BI.i18nText("BI-Multi_Date_Day_Prev"),value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV},{isEditorExist:!0,text:BI.i18nText("BI-Multi_Date_Day_Next"),value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER},{isEditorExist:!1,value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY,text:BI.i18nText("BI-Multi_Date_Today")}]},defaultSelectedItem:function(){return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV}}),BI.DayCard.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.daycard",BI.DayCard),BI.MonthCard=BI.inherit(BI.MultiDateCard,{_defaultConfig:function(){return $.extend(BI.MonthCard.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multidate-monthcard"})},_init:function(){BI.MonthCard.superclass._init.apply(this,arguments)},dateConfig:function(){return[{selected:!0,isEditorExist:!0,value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV,text:BI.i18nText("BI-Multi_Date_Month_Prev")},{isEditorExist:!0,value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER,text:BI.i18nText("BI-Multi_Date_Month_Next")},{value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN,isEditorExist:!1,text:BI.i18nText("BI-Multi_Date_Month_Begin")},{value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END,isEditorExist:!1,text:BI.i18nText("BI-Multi_Date_Month_End")}]},defaultSelectedItem:function(){return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV}}),BI.MonthCard.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.monthcard",BI.MonthCard),BI.MultiDatePopup=BI.inherit(BI.Widget,{constants:{tabHeight:30,tabWidth:42,titleHeight:27,itemHeight:30,triggerHeight:24,buttonWidth:90,buttonHeight:25,cardHeight:229,cardWidth:270,popupHeight:259,popupWidth:270,comboAdjustHeight:1,ymdWidth:58,lgap:2,border:1},_defaultConfig:function(){return BI.extend(BI.MultiDatePopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multidate-popup",width:268,height:260})},_init:function(){BI.MultiDatePopup.superclass._init.apply(this,arguments);var a=this;this.options;this.storeValue="",this.textButton=BI.createWidget({type:"bi.text_button",forceCenter:!0,cls:"bi-multidate-popup-label bi-border-left bi-border-right bi-border-top",shadow:!0,text:BI.i18nText("BI-Multi_Date_Today")}),this.textButton.on(BI.TextButton.EVENT_CHANGE,function(){a.fireEvent(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE)}),this.clearButton=BI.createWidget({type:"bi.text_button",forceCenter:!0,cls:"bi-multidate-popup-button bi-border-top",shadow:!0,text:BI.i18nText("BI-Basic_Clear")}),this.clearButton.on(BI.TextButton.EVENT_CHANGE,function(){a.fireEvent(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE)}),this.okButton=BI.createWidget({type:"bi.text_button",forceCenter:!0,cls:"bi-multidate-popup-button bi-border-top",shadow:!0,text:BI.i18nText("BI-Basic_OK")}),this.okButton.on(BI.TextButton.EVENT_CHANGE,function(){a.fireEvent(BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE)}),this.dateTab=BI.createWidget({type:"bi.tab",tab:{cls:"bi-multidate-popup-tab bi-border-bottom",height:this.constants.tabHeight,items:BI.createItems([{text:BI.i18nText("BI-Multi_Date_YMD"),value:BI.MultiDateCombo.MULTI_DATE_YMD_CARD,width:this.constants.ymdWidth},{text:BI.i18nText("BI-Multi_Date_Year"),value:BI.MultiDateCombo.MULTI_DATE_YEAR_CARD},{text:BI.i18nText("BI-Multi_Date_Quarter"),value:BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD},{text:BI.i18nText("BI-Multi_Date_Month"),value:BI.MultiDateCombo.MULTI_DATE_MONTH_CARD},{text:BI.i18nText("BI-Multi_Date_Week"),value:BI.MultiDateCombo.MULTI_DATE_WEEK_CARD},{text:BI.i18nText("BI-Multi_Date_Day"),value:BI.MultiDateCombo.MULTI_DATE_DAY_CARD}],{width:this.constants.tabWidth,textAlign:"center",height:this.constants.itemHeight,cls:"bi-multidate-popup-item bi-list-item-active"}),layouts:[{type:"bi.left"}]},cardCreator:function(b){switch(b){case BI.MultiDateCombo.MULTI_DATE_YMD_CARD:return a.ymd=BI.createWidget({type:"bi.date_calendar_popup",min:a.options.min,max:a.options.max}),a.ymd.on(BI.DateCalendarPopup.EVENT_CHANGE,function(){a.fireEvent(BI.MultiDatePopup.CALENDAR_EVENT_CHANGE)}),a.ymd;case BI.MultiDateCombo.MULTI_DATE_YEAR_CARD:return a.year=BI.createWidget({type:"bi.yearcard"}),a.year.on(BI.MultiDateCard.EVENT_CHANGE,function(b){a._setInnerValue(a.year,b)}),a.year;case BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD:return a.quarter=BI.createWidget({type:"bi.quartercard"}),a.quarter.on(BI.MultiDateCard.EVENT_CHANGE,function(b){a._setInnerValue(a.quarter,b)}),a.quarter;case BI.MultiDateCombo.MULTI_DATE_MONTH_CARD:return a.month=BI.createWidget({type:"bi.monthcard"}),a.month.on(BI.MultiDateCard.EVENT_CHANGE,function(b){a._setInnerValue(a.month,b)}),a.month;case BI.MultiDateCombo.MULTI_DATE_WEEK_CARD:return a.week=BI.createWidget({type:"bi.weekcard"}),a.week.on(BI.MultiDateCard.EVENT_CHANGE,function(b){a._setInnerValue(a.week,b)}),a.week;case BI.MultiDateCombo.MULTI_DATE_DAY_CARD:return a.day=BI.createWidget({type:"bi.daycard"}),a.day.on(BI.MultiDateCard.EVENT_CHANGE,function(b){a._setInnerValue(a.day,b)}),a.day}}}),this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD),this.cur=BI.MultiDateCombo.MULTI_DATE_YMD_CARD,this.dateTab.on(BI.Tab.EVENT_CHANGE,function(){var b=a.dateTab.getSelect();switch(b){case BI.MultiDateCombo.MULTI_DATE_YMD_CARD:var c=this.getTab(a.cur).getCalculationValue();a.ymd.setValue({year:c.getFullYear(),month:c.getMonth(),day:c.getDate()}),a._setInnerValue(a.ymd);break;case BI.MultiDateCombo.MULTI_DATE_YEAR_CARD:a.year.setValue(a.storeValue),a._setInnerValue(a.year);break;case BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD:a.quarter.setValue(a.storeValue),a._setInnerValue(a.quarter);break;case BI.MultiDateCombo.MULTI_DATE_MONTH_CARD:a.month.setValue(a.storeValue),a._setInnerValue(a.month);break;case BI.MultiDateCombo.MULTI_DATE_WEEK_CARD:a.week.setValue(a.storeValue),a._setInnerValue(a.week);break;case BI.MultiDateCombo.MULTI_DATE_DAY_CARD:a.day.setValue(a.storeValue),a._setInnerValue(a.day)}a.cur=b}),this.dateButton=BI.createWidget({type:"bi.grid",items:[[this.clearButton,this.textButton,this.okButton]]}),BI.createWidget({element:this,type:"bi.vtape",items:[{el:this.dateTab},{el:this.dateButton,height:30}]})},_setInnerValue:function(a){if(this.dateTab.getSelect()===BI.MultiDateCombo.MULTI_DATE_YMD_CARD)this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today")),this.textButton.setEnable(!0);else{var b=a.getCalculationValue();b=b.print("%Y-%x-%e"),this.textButton.setValue(b),this.textButton.setEnable(!1)}},_checkValueValid:function(a){return BI.isNull(a)||BI.isEmptyObject(a)||BI.isEmptyString(a)},setValue:function(a){this.storeValue=a;var b,c,d,e=this;switch(BI.isNotNull(a)&&(c=a.type||BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_CALENDAR,d=a.value,BI.isNull(d)&&(d=a)),c){case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END:this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YEAR_CARD),this.year.setValue({type:c,value:d}),this.cur=BI.MultiDateCombo.MULTI_DATE_YEAR_CARD,e._setInnerValue(this.year);break;case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END:this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD),this.cur=BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD,this.quarter.setValue({type:c,value:d}),e._setInnerValue(this.quarter);break;case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END:this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_MONTH_CARD),this.cur=BI.MultiDateCombo.MULTI_DATE_MONTH_CARD,this.month.setValue({type:c,value:d}),e._setInnerValue(this.month);break;case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER:this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_WEEK_CARD),this.cur=BI.MultiDateCombo.MULTI_DATE_WEEK_CARD,this.week.setValue({type:c,value:d}),e._setInnerValue(this.week);break;case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER:case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY:this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_DAY_CARD),this.cur=BI.MultiDateCombo.MULTI_DATE_DAY_CARD,this.day.setValue({type:c,value:d}),e._setInnerValue(this.day);break;default:if(this._checkValueValid(d)){var b=Date.getDate();this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD),this.ymd.setValue({year:b.getFullYear(),month:b.getMonth(),day:b.getDate()}),this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"))}else this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD),this.ymd.setValue(d),this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));this.textButton.setEnable(!0)}},getValue:function(){var a=this.dateTab.getSelect();switch(a){case BI.MultiDateCombo.MULTI_DATE_YMD_CARD:return this.ymd.getValue();case BI.MultiDateCombo.MULTI_DATE_YEAR_CARD:return this.year.getValue();case BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD:return this.quarter.getValue();case BI.MultiDateCombo.MULTI_DATE_MONTH_CARD:return this.month.getValue();case BI.MultiDateCombo.MULTI_DATE_WEEK_CARD:return this.week.getValue();case BI.MultiDateCombo.MULTI_DATE_DAY_CARD:return this.day.getValue()}}}),BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE="BUTTON_OK_EVENT_CHANGE",BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE="BUTTON_lABEL_EVENT_CHANGE",BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE="BUTTON_CLEAR_EVENT_CHANGE",BI.MultiDatePopup.CALENDAR_EVENT_CHANGE="CALENDAR_EVENT_CHANGE",BI.shortcut("bi.multidate_popup",BI.MultiDatePopup),BI.QuarterCard=BI.inherit(BI.MultiDateCard,{_defaultConfig:function(){return $.extend(BI.QuarterCard.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multidate-quartercard"})},_init:function(){BI.QuarterCard.superclass._init.apply(this,arguments)},dateConfig:function(){return[{selected:!0,value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV,isEditorExist:!0,text:BI.i18nText("BI-Multi_Date_Quarter_Prev")},{value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER,isEditorExist:!0,text:BI.i18nText("BI-Multi_Date_Quarter_Next")},{value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN,isEditorExist:!1,text:BI.i18nText("BI-Multi_Date_Quarter_Begin")},{value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END,isEditorExist:!1,text:BI.i18nText("BI-Multi_Date_Quarter_End")}]},defaultSelectedItem:function(){return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV}}),BI.QuarterCard.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.quartercard",BI.QuarterCard),BI.MultiDateSegment=BI.inherit(BI.Single,{constants:{itemHeight:24,maxGap:15,minGap:10,textWidth:60,defaultEditorValue:"1"},_defaultConfig:function(){return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multidate-segment",text:"",height:30,isEditorExist:!0,selected:!1,defaultEditorValue:"1"})},_init:function(){BI.MultiDateSegment.superclass._init.apply(this,arguments);var a=this,b=this.options;this.radio=BI.createWidget({type:"bi.radio",selected:b.selected}),this.radio.on(BI.Controller.EVENT_CHANGE,function(b){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.textEditor=BI.createWidget({type:"bi.text_editor",value:this.constants.defaultEditorValue,title:function(){return a.textEditor.getValue()},tipType:"success",cls:"bi-multidate-editor",width:this.constants.textWidth,height:this.constants.itemHeight}),this.textEditor.on(BI.Controller.EVENT_CHANGE,function(b){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",cls:"bi-multidate-normal-label",text:b.text,height:this.constants.itemHeight}),this._createSegment()},_createSegment:function(){return this.options.isEditorExist===!0?BI.createWidget({element:this,type:"bi.left",items:[{el:{type:"bi.center_adapt",items:[this.radio],height:this.constants.itemHeight},lgap:0},{el:{type:"bi.center_adapt",items:[this.textEditor],widgetName:"textEditor"},lgap:this.constants.maxGap},{el:this.text,lgap:this.constants.minGap}]}):BI.createWidget({element:this,type:"bi.left",items:[{el:{type:"bi.center_adapt",items:[this.radio],height:this.constants.itemHeight},lgap:0},{el:this.text,lgap:this.constants.maxGap}]})},setSelected:function(a){BI.isNotNull(this.radio)&&(this.radio.setSelected(a),this.textEditor.setEnable(a))},isSelected:function(){return this.radio.isSelected()},getValue:function(){return this.options.value},getInputValue:function(){return 0|this.textEditor.getValue()},setInputValue:function(a){this.textEditor.setValue(a)},isEditorExist:function(){return this.options.isEditorExist}}),BI.MultiDateSegment.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multidate_segment",BI.MultiDateSegment),BI.WeekCard=BI.inherit(BI.MultiDateCard,{_defaultConfig:function(){return $.extend(BI.WeekCard.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multidate-weekcard"})},_init:function(){BI.WeekCard.superclass._init.apply(this,arguments)},dateConfig:function(){return[{selected:!0,isEditorExist:!0,text:BI.i18nText("BI-Multi_Date_Week_Prev"),value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV},{isEditorExist:!0,text:BI.i18nText("BI-Multi_Date_Week_Next"),value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER}]},defaultSelectedItem:function(){return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV}}),BI.WeekCard.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.weekcard",BI.WeekCard),BI.YearCard=BI.inherit(BI.MultiDateCard,{_defaultConfig:function(){return $.extend(BI.YearCard.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multidate-yearcard"})},_init:function(){BI.YearCard.superclass._init.apply(this,arguments)},dateConfig:function(){return[{selected:!0,isEditorExist:!0,text:BI.i18nText("BI-Multi_Date_Year_Prev"),value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV},{isEditorExist:!0,text:BI.i18nText("BI-Multi_Date_Year_Next"),value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER},{isEditorExist:!1,value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN,text:BI.i18nText("BI-Multi_Date_Year_Begin")},{isEditorExist:!1,value:BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END,text:BI.i18nText("BI-Multi_Date_Year_End")}]},defaultSelectedItem:function(){return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV}}),BI.YearCard.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.yearcard",BI.YearCard),BI.MultiLayerSelectTreeCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multilayer_select_tree-combo",isDefaultInit:!1,height:30,text:"",items:[]})},_init:function(){BI.MultiLayerSelectTreeCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget({type:"bi.single_tree_trigger",text:b.text,height:b.height,items:b.items}),this.popup=BI.createWidget({type:"bi.multilayer_select_tree_popup",isDefaultInit:b.isDefaultInit,items:b.items}),this.combo=BI.createWidget({type:"bi.combo",element:this,adjustLength:2,el:this.trigger,popup:{el:this.popup}}),this.combo.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.combo.hideView(),a.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE)})},setValue:function(a){a=BI.isArray(a)?a:[a],this.trigger.setValue(a),this.popup.setValue(a)},getValue:function(){return this.popup.getValue()},populate:function(a){this.combo.populate(a)}}),BI.MultiLayerSelectTreeCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multilayer_select_tree_combo",BI.MultiLayerSelectTreeCombo),BI.MultiLayerSelectLevelTree=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multilayer-select-level-tree",isDefaultInit:!1,items:[],itemsCreator:BI.emptyFn})},_init:function(){BI.MultiLayerSelectLevelTree.superclass._init.apply(this,arguments),this.initTree(this.options.items)},_formatItems:function(a,b){var c=this;return BI.each(a,function(d,e){var f={};if(e.layer=b,BI.isKey(e.id)||(e.id=BI.UUID()),e.isParent===!0||BI.isNotEmptyArray(e.children)){switch(d){case 0:f.type="bi.multilayer_select_tree_first_plus_group_node";break;case a.length-1:f.type="bi.multilayer_select_tree_last_plus_group_node";break;default:f.type="bi.multilayer_select_tree_mid_plus_group_node"}BI.defaults(e,f),c._formatItems(e.children,b+1)}else{switch(d){case a.length-1:f.type="bi.multilayer_single_tree_last_tree_leaf_item";break;default:f.type="bi.multilayer_single_tree_mid_tree_leaf_item"}BI.defaults(e,f)}}),a},_assertId:function(a){BI.each(a,function(a,b){b.id=b.id||BI.UUID()})},initTree:function(a){var b=this,c=this.options;this.empty(),this._assertId(a),this.tree=BI.createWidget({type:"bi.custom_tree",element:this,expander:{type:"bi.select_tree_expander",isDefaultInit:c.isDefaultInit,el:{},popup:{type:"bi.custom_tree"}},items:this._formatItems(BI.Tree.transformToTreeFormat(a),0),itemsCreator:c.itemsCreator,el:{type:"bi.button_tree",chooseType:BI.Selection.Single,layouts:[{type:"bi.vertical"}]}}),this.tree.on(BI.Controller.EVENT_CHANGE,function(a){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE,arguments)})},populate:function(a){this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(a),0))},setValue:function(a){this.tree.setValue(a)},getValue:function(){return this.tree.getValue()},getAllLeaves:function(){return this.tree.getAllLeaves()},getNodeById:function(a){return this.tree.getNodeById(a)},getNodeByValue:function(a){return this.tree.getNodeByValue(a)}}),BI.MultiLayerSelectLevelTree.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multilayer_select_level_tree",BI.MultiLayerSelectLevelTree),BI.MultiLayerSelectTreePopup=BI.inherit(BI.Pane,{_defaultConfig:function(){return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multilayer-select-tree-popup",tipText:BI.i18nText("BI-No_Selected_Item"),isDefaultInit:!1,itemsCreator:BI.emptyFn,items:[]})},_init:function(){BI.MultiLayerSelectTreePopup.superclass._init.apply(this,arguments);var a=this,b=this.options;this.tree=BI.createWidget({type:"bi.multilayer_select_level_tree",isDefaultInit:b.isDefaultInit,items:b.items,itemsCreator:b.itemsCreator}),BI.createWidget({type:"bi.vertical",scrolly:!1,scrollable:!0,element:this,items:[this.tree]}),this.tree.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE,function(){a.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE)}),this.check()},getValue:function(){return this.tree.getValue()},setValue:function(a){a=BI.isArray(a)?a:[a],this.tree.setValue(a)},populate:function(a){BI.MultiLayerSelectTreePopup.superclass.populate.apply(this,arguments),this.tree.populate(a)}}),BI.MultiLayerSelectTreePopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multilayer_select_tree_popup",BI.MultiLayerSelectTreePopup),BI.MultiLayerSelectTreeFirstPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{extraCls:"bi-multilayer-select-tree-first-plus-group-node bi-list-item-active",layer:0,id:"",pId:"",readonly:!0,open:!1,height:25})},_init:function(){BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.node=BI.createWidget({type:"bi.select_tree_first_plus_group_node",cls:"bi-list-item-none",stopPropagation:!0,logic:{dynamic:!0},id:b.id,pId:b.pId,open:b.open,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.node.on(BI.Controller.EVENT_CHANGE,function(b){a.setSelected(a.isSelected()),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=[];BI.count(0,b.layer,function(){c.push({type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height})}),c.push(this.node),BI.createWidget({type:"bi.td",element:this,columnSize:BI.makeArray(b.layer,13),items:[c]})},isOnce:function(){return!0},doRedMark:function(){this.node.doRedMark.apply(this.node,arguments)},unRedMark:function(){this.node.unRedMark.apply(this.node,arguments)},isSelected:function(){return this.node.isSelected()},setSelected:function(a){BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass.setSelected.apply(this,arguments),this.node.setSelected(a)},doClick:function(){BI.NodeButton.superclass.doClick.apply(this,arguments),this.node.setSelected(this.isSelected())},setOpened:function(a){BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass.setOpened.apply(this,arguments),this.node.setOpened(a)}}),BI.shortcut("bi.multilayer_select_tree_first_plus_group_node",BI.MultiLayerSelectTreeFirstPlusGroupNode),BI.MultiLayerSelectTreeLastPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.MultiLayerSelectTreeLastPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{extraCls:"bi-multilayer-select-tree-last-plus-group-node bi-list-item-active",layer:0,id:"",pId:"",readonly:!0,open:!1,height:25})},_init:function(){BI.MultiLayerSelectTreeLastPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.node=BI.createWidget({type:"bi.select_tree_last_plus_group_node",cls:"bi-list-item-none",stopPropagation:!0,logic:{dynamic:!0},id:b.id,pId:b.pId,open:b.open,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.node.on(BI.Controller.EVENT_CHANGE,function(b){a.setSelected(a.isSelected()),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=[];BI.count(0,b.layer,function(){c.push({type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height})}),c.push(this.node),BI.createWidget({type:"bi.td",element:this,columnSize:BI.makeArray(b.layer,13),items:[c]})},doRedMark:function(){this.node.doRedMark.apply(this.node,arguments)},unRedMark:function(){this.node.unRedMark.apply(this.node,arguments)},isSelected:function(){return this.node.isSelected()},setSelected:function(a){BI.MultiLayerSelectTreeLastPlusGroupNode.superclass.setSelected.apply(this,arguments),this.node.setSelected(a)},doClick:function(){BI.MultiLayerSelectTreeLastPlusGroupNode.superclass.doClick.apply(this,arguments),this.node.setSelected(this.isSelected())},setOpened:function(a){BI.MultiLayerSelectTreeLastPlusGroupNode.superclass.setOpened.apply(this,arguments),this.node.setOpened(a)}}),BI.shortcut("bi.multilayer_select_tree_last_plus_group_node",BI.MultiLayerSelectTreeLastPlusGroupNode),BI.MultiLayerSelectTreeMidPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.MultiLayerSelectTreeMidPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{extraCls:"bi-multilayer-select-tree-mid-plus-group-node bi-list-item-active",layer:0,id:"",pId:"",readonly:!0,open:!1,height:25})},_init:function(){BI.MultiLayerSelectTreeMidPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.node=BI.createWidget({type:"bi.select_tree_mid_plus_group_node",cls:"bi-list-item-none",stopPropagation:!0,logic:{dynamic:!0},id:b.id,pId:b.pId,open:b.open,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.node.on(BI.Controller.EVENT_CHANGE,function(b){a.setSelected(a.isSelected()),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=[];BI.count(0,b.layer,function(){c.push({type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height})}),c.push(this.node),BI.createWidget({type:"bi.td",element:this,columnSize:BI.makeArray(b.layer,13),items:[c]})},doRedMark:function(){this.node.doRedMark.apply(this.node,arguments)},unRedMark:function(){this.node.unRedMark.apply(this.node,arguments)},isSelected:function(){return this.node.isSelected()},setSelected:function(a){BI.MultiLayerSelectTreeMidPlusGroupNode.superclass.setSelected.apply(this,arguments),this.node.setSelected(a)},doClick:function(){BI.MultiLayerSelectTreeMidPlusGroupNode.superclass.doClick.apply(this,arguments),this.node.setSelected(this.isSelected())},setOpened:function(a){BI.MultiLayerSelectTreeMidPlusGroupNode.superclass.setOpened.apply(this,arguments),this.node.setOpened(a)}}),BI.shortcut("bi.multilayer_select_tree_mid_plus_group_node",BI.MultiLayerSelectTreeMidPlusGroupNode),BI.MultiLayerSingleTreeCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiLayerSingleTreeCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multilayer-singletree-combo",isDefaultInit:!1,height:30,text:"",itemsCreator:BI.emptyFn,items:[]})},_init:function(){BI.MultiLayerSingleTreeCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget({type:"bi.single_tree_trigger",text:b.text,height:b.height,items:b.items}),this.popup=BI.createWidget({type:"bi.multilayer_single_tree_popup",isDefaultInit:b.isDefaultInit,items:b.items}),this.combo=BI.createWidget({type:"bi.combo",element:this,adjustLength:2,el:this.trigger,popup:{el:this.popup}}),this.combo.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.popup.on(BI.MultiLayerSingleTreePopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.combo.hideView(),a.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE)})},setValue:function(a){a=BI.isArray(a)?a:[a],this.trigger.setValue(a),this.popup.setValue(a)},getValue:function(){return this.popup.getValue()},populate:function(a){this.combo.populate(a)}}),BI.MultiLayerSingleTreeCombo.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multilayer_single_tree_combo",BI.MultiLayerSingleTreeCombo),BI.MultiLayerSingleLevelTree=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multilayer-single-level-tree",isDefaultInit:!1,items:[],itemsCreator:BI.emptyFn})},_init:function(){BI.MultiLayerSingleLevelTree.superclass._init.apply(this,arguments),this.initTree(this.options.items)},_formatItems:function(a,b){var c=this;return BI.each(a,function(d,e){var f={};if(e.layer=b,BI.isKey(e.id)||(e.id=BI.UUID()),e.isParent===!0||BI.isNotEmptyArray(e.children)){switch(d){case 0:f.type="bi.multilayer_single_tree_first_plus_group_node";break;case a.length-1:f.type="bi.multilayer_single_tree_last_plus_group_node";break;default:f.type="bi.multilayer_single_tree_mid_plus_group_node"}BI.defaults(e,f),c._formatItems(e.children,b+1)}else{switch(d){case a.length-1:f.type="bi.multilayer_single_tree_last_tree_leaf_item";break;default:f.type="bi.multilayer_single_tree_mid_tree_leaf_item"}BI.defaults(e,f)}}),a},_assertId:function(a){BI.each(a,function(a,b){b.id=b.id||BI.UUID()})},initTree:function(a){var b=this,c=this.options;this.empty(),this._assertId(a),this.tree=BI.createWidget({type:"bi.custom_tree",element:this,expander:{isDefaultInit:c.isDefaultInit,el:{},popup:{type:"bi.custom_tree"}},items:this._formatItems(BI.Tree.transformToTreeFormat(a),0),itemsCreator:function(a,b){c.itemsCreator(a,function(a){b(BI.Tree.transformToTreeFormat(a),0)})},el:{type:"bi.button_tree",chooseType:BI.Selection.Single,layouts:[{type:"bi.vertical"}]}}),this.tree.on(BI.Controller.EVENT_CHANGE,function(a,c){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.MultiLayerSingleLevelTree.EVENT_CHANGE,c)})},populate:function(a){this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(a),0))},setValue:function(a){this.tree.setValue(a)},getValue:function(){return this.tree.getValue()},getAllLeaves:function(){return this.tree.getAllLeaves()},getNodeById:function(a){return this.tree.getNodeById(a)},getNodeByValue:function(a){return this.tree.getNodeByValue(a)}}),BI.MultiLayerSingleLevelTree.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multilayer_single_level_tree",BI.MultiLayerSingleLevelTree),BI.MultiLayerSingleTreePopup=BI.inherit(BI.Pane,{_defaultConfig:function(){return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multilayer-singletree-popup",tipText:BI.i18nText("BI-No_Selected_Item"),isDefaultInit:!1,itemsCreator:BI.emptyFn,items:[]})},_init:function(){BI.MultiLayerSingleTreePopup.superclass._init.apply(this,arguments);var a=this,b=this.options;this.tree=BI.createWidget({type:"bi.multilayer_single_level_tree",isDefaultInit:b.isDefaultInit,items:b.items,itemsCreator:b.itemsCreator}),BI.createWidget({type:"bi.vertical",scrolly:!1,scrollable:!0,element:this,items:[this.tree]}),this.tree.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE,function(){a.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE);
}),this.check()},getValue:function(){return this.tree.getValue()},setValue:function(a){a=BI.isArray(a)?a:[a],this.tree.setValue(a)},populate:function(a){BI.MultiLayerSingleTreePopup.superclass.populate.apply(this,arguments),this.tree.populate(a)}}),BI.MultiLayerSingleTreePopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multilayer_single_tree_popup",BI.MultiLayerSingleTreePopup),BI.MultiLayerSingleTreeFirstPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.MultiLayerSingleTreeFirstPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{extraCls:"bi-multilayer-single-tree-first-plus-group-node bi-list-item",layer:0,id:"",pId:"",open:!1,height:25})},_init:function(){BI.MultiLayerSingleTreeFirstPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.node=BI.createWidget({type:"bi.first_plus_group_node",cls:"bi-list-item-none",logic:{dynamic:!0},id:b.id,pId:b.pId,open:b.open,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.node.on(BI.Controller.EVENT_CHANGE,function(b){b!==BI.Events.CLICK&&a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=[];BI.count(0,b.layer,function(){c.push({type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height})}),c.push(this.node),BI.createWidget({type:"bi.td",element:this,columnSize:BI.makeArray(b.layer,13),items:[c]})},doRedMark:function(){this.node.doRedMark.apply(this.node,arguments)},unRedMark:function(){this.node.unRedMark.apply(this.node,arguments)},doClick:function(){BI.MultiLayerSingleTreeFirstPlusGroupNode.superclass.doClick.apply(this,arguments),this.node.setSelected(this.isSelected())},setOpened:function(a){BI.MultiLayerSingleTreeFirstPlusGroupNode.superclass.setOpened.apply(this,arguments),BI.isNotNull(this.node)&&this.node.setOpened(a)}}),BI.shortcut("bi.multilayer_single_tree_first_plus_group_node",BI.MultiLayerSingleTreeFirstPlusGroupNode),BI.MultiLayerSingleTreeLastPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.MultiLayerSingleTreeLastPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{extraCls:"bi-multilayer-single-tree-last-plus-group-node bi-list-item",layer:0,id:"",pId:"",open:!1,height:25})},_init:function(){BI.MultiLayerSingleTreeLastPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.node=BI.createWidget({type:"bi.last_plus_group_node",cls:"bi-list-item-none",logic:{dynamic:!0},id:b.id,pId:b.pId,open:b.open,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.node.on(BI.Controller.EVENT_CHANGE,function(b){b!==BI.Events.CLICK&&a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=[];BI.count(0,b.layer,function(){c.push({type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height})}),c.push(this.node),BI.createWidget({type:"bi.td",element:this,columnSize:BI.makeArray(b.layer,13),items:[c]})},doRedMark:function(){this.node.doRedMark.apply(this.node,arguments)},unRedMark:function(){this.node.unRedMark.apply(this.node,arguments)},doClick:function(){BI.MultiLayerSingleTreeLastPlusGroupNode.superclass.doClick.apply(this,arguments),this.node.setSelected(this.isSelected())},setOpened:function(a){BI.MultiLayerSingleTreeLastPlusGroupNode.superclass.setOpened.apply(this,arguments),BI.isNotNull(this.node)&&this.node.setOpened(a)}}),BI.shortcut("bi.multilayer_single_tree_last_plus_group_node",BI.MultiLayerSingleTreeLastPlusGroupNode),BI.MultiLayerSingleTreeMidPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.MultiLayerSingleTreeMidPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{extraCls:"bi-multilayer-single-tree-mid-plus-group-node bi-list-item",layer:0,id:"",pId:"",open:!1,height:25})},_init:function(){BI.MultiLayerSingleTreeMidPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.node=BI.createWidget({type:"bi.mid_plus_group_node",cls:"bi-list-item-none",logic:{dynamic:!0},id:b.id,pId:b.pId,open:b.open,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.node.on(BI.Controller.EVENT_CHANGE,function(b){b!==BI.Events.CLICK&&a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=[];BI.count(0,b.layer,function(){c.push({type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height})}),c.push(this.node),BI.createWidget({type:"bi.td",element:this,columnSize:BI.makeArray(b.layer,13),items:[c]})},doRedMark:function(){this.node.doRedMark.apply(this.node,arguments)},unRedMark:function(){this.node.unRedMark.apply(this.node,arguments)},doClick:function(){BI.MultiLayerSingleTreeMidPlusGroupNode.superclass.doClick.apply(this,arguments),this.node.setSelected(this.isSelected())},setOpened:function(a){BI.MultiLayerSingleTreeMidPlusGroupNode.superclass.setOpened.apply(this,arguments),BI.isNotNull(this.node)&&this.node.setOpened(a)}}),BI.shortcut("bi.multilayer_single_tree_mid_plus_group_node",BI.MultiLayerSingleTreeMidPlusGroupNode),BI.MultiLayerSingleTreeFirstTreeLeafItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.MultiLayerSingleTreeFirstTreeLeafItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-multilayer-single-tree-first-tree-leaf-item bi-list-item-active",logic:{dynamic:!1},layer:0,id:"",pId:"",height:25})},_init:function(){BI.MultiLayerSingleTreeFirstTreeLeafItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.item=BI.createWidget({type:"bi.first_tree_leaf_item",cls:"bi-list-item-none",logic:{dynamic:!0},id:b.id,pId:b.pId,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.item.on(BI.Controller.EVENT_CHANGE,function(b){b!==BI.Events.CLICK&&a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=[];BI.count(0,b.layer,function(){c.push({type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height})}),c.push(this.item),BI.createWidget({type:"bi.td",element:this,columnSize:BI.makeArray(b.layer,13),items:[c]})},doRedMark:function(){this.item.doRedMark.apply(this.item,arguments)},unRedMark:function(){this.item.unRedMark.apply(this.item,arguments)},doHighLight:function(){this.item.doHighLight.apply(this.item,arguments)},unHighLight:function(){this.item.unHighLight.apply(this.item,arguments)},getId:function(){return this.options.id},getPId:function(){return this.options.pId},doClick:function(){BI.MultiLayerSingleTreeFirstTreeLeafItem.superclass.doClick.apply(this,arguments),this.item.setSelected(this.isSelected())},setSelected:function(a){BI.MultiLayerSingleTreeFirstTreeLeafItem.superclass.setSelected.apply(this,arguments),this.item.setSelected(a)}}),BI.shortcut("bi.multilayer_single_tree_first_tree_leaf_item",BI.MultiLayerSingleTreeFirstTreeLeafItem),BI.MultiLayerSingleTreeLastTreeLeafItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.MultiLayerSingleTreeLastTreeLeafItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-multilayer-single-tree-last-tree-leaf-item bi-list-item-active",logic:{dynamic:!1},layer:0,id:"",pId:"",height:25})},_init:function(){BI.MultiLayerSingleTreeLastTreeLeafItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.item=BI.createWidget({type:"bi.last_tree_leaf_item",cls:"bi-list-item-none",logic:{dynamic:!0},id:b.id,pId:b.pId,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.item.on(BI.Controller.EVENT_CHANGE,function(b){b!==BI.Events.CLICK&&a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=[];BI.count(0,b.layer,function(){c.push({type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height})}),c.push(this.item),BI.createWidget({type:"bi.td",element:this,columnSize:BI.makeArray(b.layer,13),items:[c]})},doRedMark:function(){this.item.doRedMark.apply(this.item,arguments)},unRedMark:function(){this.item.unRedMark.apply(this.item,arguments)},doHighLight:function(){this.item.doHighLight.apply(this.item,arguments)},unHighLight:function(){this.item.unHighLight.apply(this.item,arguments)},getId:function(){return this.options.id},getPId:function(){return this.options.pId},doClick:function(){BI.MultiLayerSingleTreeLastTreeLeafItem.superclass.doClick.apply(this,arguments),this.item.setSelected(this.isSelected())},setSelected:function(a){BI.MultiLayerSingleTreeLastTreeLeafItem.superclass.setSelected.apply(this,arguments),this.item.setSelected(a)}}),BI.shortcut("bi.multilayer_single_tree_last_tree_leaf_item",BI.MultiLayerSingleTreeLastTreeLeafItem),BI.MultiLayerSingleTreeMidTreeLeafItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.MultiLayerSingleTreeMidTreeLeafItem.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-multilayer-single-tree-mid-tree-leaf-item bi-list-item-active",logic:{dynamic:!1},layer:0,id:"",pId:"",height:25})},_init:function(){BI.MultiLayerSingleTreeMidTreeLeafItem.superclass._init.apply(this,arguments);var a=this,b=this.options;this.item=BI.createWidget({type:"bi.mid_tree_leaf_item",cls:"bi-list-item-none",logic:{dynamic:!0},id:b.id,pId:b.pId,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.item.on(BI.Controller.EVENT_CHANGE,function(b){b!==BI.Events.CLICK&&a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)});var c=[];BI.count(0,b.layer,function(){c.push({type:"bi.layout",cls:"base-line-conn-background",width:13,height:b.height})}),c.push(this.item),BI.createWidget({type:"bi.td",element:this,columnSize:BI.makeArray(b.layer,13),items:[c]})},doRedMark:function(){this.item.doRedMark.apply(this.item,arguments)},unRedMark:function(){this.item.unRedMark.apply(this.item,arguments)},doHighLight:function(){this.item.doHighLight.apply(this.item,arguments)},unHighLight:function(){this.item.unHighLight.apply(this.item,arguments)},getId:function(){return this.options.id},getPId:function(){return this.options.pId},doClick:function(){BI.MultiLayerSingleTreeMidTreeLeafItem.superclass.doClick.apply(this,arguments),this.item.setSelected(this.isSelected())},setSelected:function(a){BI.MultiLayerSingleTreeMidTreeLeafItem.superclass.setSelected.apply(this,arguments),this.item.setSelected(a)}}),BI.shortcut("bi.multilayer_single_tree_mid_tree_leaf_item",BI.MultiLayerSingleTreeMidTreeLeafItem),BI.MultiSelectCheckPane=BI.inherit(BI.Widget,{constants:{height:25,lgap:10,tgap:5},_defaultConfig:function(){return BI.extend(BI.MultiSelectCheckPane.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-check-pane bi-background",items:[],itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,onClickContinueSelect:BI.emptyFn})},_init:function(){BI.MultiSelectCheckPane.superclass._init.apply(this,arguments);var a=this,b=this.options;this.storeValue={},this.display=BI.createWidget({type:"bi.display_selected_list",items:b.items,itemsCreator:function(c,d){return c=BI.extend(c||{},{selectedValues:a.storeValue.value}),a.storeValue.type===BI.Selection.Multi?void d({items:BI.map(a.storeValue.value,function(a,c){var d=b.valueFormatter(c)||c;return{text:d,value:c,title:d}})}):void b.itemsCreator(c,d)}}),this.continueSelect=BI.createWidget({type:"bi.text_button",text:BI.i18nText("BI-Continue_Select"),cls:"multi-select-check-selected bi-high-light"}),this.continueSelect.on(BI.TextButton.EVENT_CHANGE,function(){b.onClickContinueSelect()}),BI.createWidget({type:"bi.vtape",element:this,items:[{height:this.constants.height,el:{type:"bi.left",cls:"multi-select-continue-select",items:[{el:{type:"bi.label",text:BI.i18nText("BI-Selected_Data")},lgap:this.constants.lgap,tgap:this.constants.tgap},{el:this.continueSelect,lgap:this.constants.lgap,tgap:this.constants.tgap}]}},{height:"fill",el:this.display}]})},setValue:function(a){this.storeValue=a||{}},empty:function(){this.display.empty()},populate:function(){this.display.populate.apply(this.display,arguments)}}),BI.shortcut("bi.multi_select_check_pane",BI.MultiSelectCheckPane),BI.DisplaySelectedList=BI.inherit(BI.Pane,{constants:{height:25,lgap:10},_defaultConfig:function(){return BI.extend(BI.DisplaySelectedList.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-display-list",itemsCreator:BI.emptyFn,items:[]})},_init:function(){BI.DisplaySelectedList.superclass._init.apply(this,arguments);var a=this,b=this.options;this.hasNext=!1,this.button_group=BI.createWidget({type:"bi.list_pane",element:this,el:{type:"bi.loader",isDefaultInit:!1,logic:{dynamic:!0,scrolly:!0},items:this._createItems(b.items),chooseType:BI.ButtonGroup.CHOOSE_TYPE_MULTI,layouts:[{type:"bi.vertical",lgap:10}]},itemsCreator:function(c,d){b.itemsCreator(c,function(b){a.hasNext=!!b.hasNext,d(a._createItems(b.items))})},hasNext:function(){return a.hasNext}})},_createItems:function(a){return BI.createItems(a,{type:"bi.icon_text_item",cls:"cursor-default check-font display-list-item bi-tips",once:!0,invalid:!0,selected:!0,height:this.constants.height,logic:{dynamic:!0}})},empty:function(){this.button_group.empty()},populate:function(a){0===arguments.length?this.button_group.populate():this.button_group.populate(this._createItems(a))}}),BI.shortcut("bi.display_selected_list",BI.DisplaySelectedList),BI.MultiSelectInsertCombo=BI.inherit(BI.Single,{_defaultConfig:function(){return BI.extend(BI.MultiSelectInsertCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-insert-combo",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,height:28})},_init:function(){BI.MultiSelectInsertCombo.superclass._init.apply(this,arguments);var a=this,b=this.options,c=function(){BI.isKey(a._startValue)&&a.storeValue.value[a.storeValue.type===BI.Selection.All?"remove":"pushDistinct"](a._startValue),a.trigger.getSearcher().setState(a.storeValue),a.trigger.getCounter().setButtonChecked(a.storeValue)};this.storeValue={},this.requesting=!1,this.trigger=BI.createWidget({type:"bi.multi_select_trigger",height:b.height,masker:{offset:{left:1,top:1,right:2,bottom:33}},valueFormatter:b.valueFormatter,itemsCreator:function(c,d){b.itemsCreator(c,function(b){1===c.times&&BI.isNotNull(c.keywords)&&a.trigger.setValue(BI.deepClone(a.getValue())),d.apply(a,arguments)})}}),this.trigger.on(BI.MultiSelectTrigger.EVENT_START,function(){a._setStartValue(""),this.getSearcher().setValue(a.storeValue)}),this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP,function(){a._setStartValue("")}),this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE,function(){var b=this.getSearcher().getKeyword();a._join({type:BI.Selection.Multi,value:[b]},function(){a.storeValue.type===BI.Selection.Multi&&a.storeValue.value.pushDistinct(b),a.combo.setValue(a.storeValue),a._setStartValue(b),c(),a.populate(),a._setStartValue("")})}),this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING,function(b){var d=BI.last(b);b=BI.initial(b||[]),b.length>0&&a._joinKeywords(b,function(){BI.isEndWithBlank(d)?(a.combo.setValue(a.storeValue),c(),a.combo.populate(),a._setStartValue("")):(a.combo.setValue(a.storeValue),c())})}),this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE,function(b,d){d instanceof BI.MultiSelectBar?a._joinAll(this.getValue(),function(){c()}):a._join(this.getValue(),function(){c()})}),this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW,function(){this.getCounter().setValue(a.storeValue)}),this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK,function(){a.combo.isViewVisible()||a.combo.showView()}),this.combo=BI.createWidget({type:"bi.combo",toggle:!1,el:this.trigger,adjustLength:1,popup:{type:"bi.multi_select_popup_view",ref:function(){a.popup=this,a.trigger.setAdapter(this)},listeners:[{eventName:BI.MultiSelectPopupView.EVENT_CHANGE,action:function(){a.storeValue=this.getValue(),a._adjust(function(){c()})}},{eventName:BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,action:function(){a._defaultState()}},{eventName:BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,action:function(){a.setValue(),a._defaultState()}}],itemsCreator:b.itemsCreator,valueFormatter:b.valueFormatter,onLoaded:function(){BI.nextTick(function(){a.combo.adjustWidth(),a.combo.adjustHeight(),a.trigger.getCounter().adjustView(),a.trigger.getSearcher().adjustView()})}},hideChecker:function(a){return 0===d.element.find(a.target).length}}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){this.setValue(a.storeValue),BI.nextTick(function(){a.populate()})}),this.wants2Quit=!1,this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW,function(){a.trigger.stopEditing(),a.requesting===!0?a.wants2Quit=!0:a.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM)});var d=BI.createWidget({type:"bi.trigger_icon_button",width:b.height,height:b.height,cls:"multi-select-trigger-icon-button bi-border-left"});d.on(BI.TriggerIconButton.EVENT_CHANGE,function(){a.trigger.getCounter().hideView(),a.combo.isViewVisible()?a.combo.hideView():a.combo.showView()}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.combo,left:0,right:0,top:0,bottom:0},{el:d,right:0,top:0,bottom:0}]})},_defaultState:function(){this.trigger.stopEditing(),this.combo.hideView()},_assertValue:function(a){a||(a={}),a.type||(a.type=BI.Selection.Multi),a.value||(a.value=[])},_makeMap:function(a){return BI.makeObject(a||[])},_joinKeywords:function(a,b){function c(c){var e=d._makeMap(c);BI.each(a,function(a,b){BI.isNotNull(e[b])&&d.storeValue.value[d.storeValue.type===BI.Selection.Multi?"pushDistinct":"remove"](b)}),d._adjust(b)}var d=this,e=this.options;this._assertValue(this.storeValue),this.requesting=!0,e.itemsCreator({type:BI.MultiSelectInsertCombo.REQ_GET_ALL_DATA,keywords:a},function(a){var b=BI.pluck(a.items,"value");c(b)})},_joinAll:function(a,b){var c=this,d=this.options;this._assertValue(a),this.requesting=!0,d.itemsCreator({type:BI.MultiSelectInsertCombo.REQ_GET_ALL_DATA,keywords:[this.trigger.getKey()]},function(d){var e=BI.pluck(d.items,"value");if(c.storeValue.type===a.type){var f=!1,g=c._makeMap(c.storeValue.value);return BI.each(e,function(a,b){BI.isNotNull(g[b])&&(f=!0,delete g[b])}),f&&(c.storeValue.value=BI.values(g)),void c._adjust(b)}var h=c._makeMap(c.storeValue.value),i=c._makeMap(a.value),j=[];BI.each(e,function(a,b){BI.isNotNull(h[e[a]])&&delete h[e[a]],BI.isNull(i[e[a]])&&j.push(b)}),c.storeValue.value=j.concat(BI.values(h)),c._adjust(b)})},_adjust:function(a){function b(){c.wants2Quit===!0&&(c.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM),c.wants2Quit=!1),c.requesting=!1}var c=this;this.options;b(),a()},_join:function(a,b){var c=this;this.options;if(this._assertValue(a),this._assertValue(this.storeValue),this.storeValue.type===a.type){var d=this._makeMap(this.storeValue.value);BI.each(a.value,function(a,b){d[b]||(c.storeValue.value.push(b),d[b]=b)});var e=!1;return BI.each(a.assist,function(a,b){BI.isNotNull(d[b])&&(e=!0,delete d[b])}),e&&(this.storeValue.value=BI.values(d)),void c._adjust(b)}this._joinAll(a,b)},_setStartValue:function(a){this._startValue=a,this.popup.setStartValue(a)},setValue:function(a){this.storeValue=a||{},this._assertValue(this.storeValue),this.combo.setValue(this.storeValue)},getValue:function(){return BI.deepClone(this.storeValue)},populate:function(){this.combo.populate.apply(this.combo,arguments)}}),BI.extend(BI.MultiSelectInsertCombo,{REQ_GET_DATA_LENGTH:0,REQ_GET_ALL_DATA:-1}),BI.MultiSelectInsertCombo.EVENT_CONFIRM="EVENT_CONFIRM",BI.shortcut("bi.multi_select_insert_combo",BI.MultiSelectInsertCombo),BI.MultiSelectCombo=BI.inherit(BI.Single,{_defaultConfig:function(){return BI.extend(BI.MultiSelectCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-combo",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,height:28})},_init:function(){BI.MultiSelectCombo.superclass._init.apply(this,arguments);var a=this,b=this.options,c=function(){BI.isKey(a._startValue)&&a.storeValue.value[a.storeValue.type===BI.Selection.All?"remove":"pushDistinct"](a._startValue),a.trigger.getSearcher().setState(a.storeValue),a.trigger.getCounter().setButtonChecked(a.storeValue)};this.storeValue={},this.requesting=!1,this.trigger=BI.createWidget({type:"bi.multi_select_trigger",height:b.height,masker:{offset:{left:1,top:1,right:2,bottom:33}},valueFormatter:b.valueFormatter,itemsCreator:function(c,d){b.itemsCreator(c,function(b){1===c.times&&BI.isNotNull(c.keywords)&&a.trigger.setValue(BI.deepClone(a.getValue())),d.apply(a,arguments)})}}),this.trigger.on(BI.MultiSelectTrigger.EVENT_START,function(){a._setStartValue(""),this.getSearcher().setValue(a.storeValue)}),this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP,function(){a._setStartValue("")}),this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE,function(){if(this.getSearcher().hasMatched()){var b=this.getSearcher().getKeyword();a._join({type:BI.Selection.Multi,value:[b]},function(){a.combo.setValue(a.storeValue),a._setStartValue(b),c(),a.populate(),a._setStartValue("")})}}),this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING,function(b){var d=BI.last(b);b=BI.initial(b||[]),b.length>0&&a._joinKeywords(b,function(){BI.isEndWithBlank(d)?(a.combo.setValue(a.storeValue),c(),a.combo.populate(),a._setStartValue("")):(a.combo.setValue(a.storeValue),c())})}),this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE,function(b,d){d instanceof BI.MultiSelectBar?a._joinAll(this.getValue(),function(){c()}):a._join(this.getValue(),function(){c()})}),this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW,function(){this.getCounter().setValue(a.storeValue)}),this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK,function(){a.combo.isViewVisible()||a.combo.showView()}),this.combo=BI.createWidget({type:"bi.combo",toggle:!1,el:this.trigger,adjustLength:1,popup:{type:"bi.multi_select_popup_view",ref:function(){a.popup=this,a.trigger.setAdapter(this)},listeners:[{eventName:BI.MultiSelectPopupView.EVENT_CHANGE,action:function(){a.storeValue=this.getValue(),a._adjust(function(){c()})}},{eventName:BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,action:function(){a._defaultState()}},{eventName:BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,action:function(){a.setValue(),a._defaultState()}}],itemsCreator:b.itemsCreator,valueFormatter:b.valueFormatter,onLoaded:function(){BI.nextTick(function(){a.combo.adjustWidth(),a.combo.adjustHeight(),a.trigger.getCounter().adjustView(),a.trigger.getSearcher().adjustView()})}},hideChecker:function(a){return 0===d.element.find(a.target).length}}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){this.setValue(a.storeValue),BI.nextTick(function(){a.populate()})}),this.wants2Quit=!1,this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW,function(){a.trigger.stopEditing(),a.requesting===!0?a.wants2Quit=!0:a.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM)});var d=BI.createWidget({type:"bi.trigger_icon_button",width:b.height,height:b.height,cls:"multi-select-trigger-icon-button bi-border-left"});d.on(BI.TriggerIconButton.EVENT_CHANGE,function(){a.trigger.getCounter().hideView(),a.combo.isViewVisible()?a.combo.hideView():a.combo.showView()}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.combo,left:0,right:0,top:0,bottom:0},{el:d,right:0,top:0,bottom:0}]})},_defaultState:function(){this.trigger.stopEditing(),this.combo.hideView()},_assertValue:function(a){a||(a={}),a.type||(a.type=BI.Selection.Multi),a.value||(a.value=[])},_makeMap:function(a){return BI.makeObject(a||[])},_joinKeywords:function(a,b){function c(c){var e=d._makeMap(c);BI.each(a,function(a,b){BI.isNotNull(e[b])&&d.storeValue.value[d.storeValue.type===BI.Selection.Multi?"pushDistinct":"remove"](b)}),d._adjust(b)}var d=this,e=this.options;this._assertValue(this.storeValue),this.requesting=!0,e.itemsCreator({type:BI.MultiSelectCombo.REQ_GET_ALL_DATA,keywords:a},function(a){var b=BI.pluck(a.items,"value");c(b)})},_joinAll:function(a,b){var c=this,d=this.options;this._assertValue(a),this.requesting=!0,d.itemsCreator({type:BI.MultiSelectCombo.REQ_GET_ALL_DATA,keywords:[this.trigger.getKey()]},function(d){var e=BI.pluck(d.items,"value");if(c.storeValue.type===a.type){var f=!1,g=c._makeMap(c.storeValue.value);return BI.each(e,function(a,b){BI.isNotNull(g[b])&&(f=!0,delete g[b])}),f&&(c.storeValue.value=BI.values(g)),void c._adjust(b)}var h=c._makeMap(c.storeValue.value),i=c._makeMap(a.value),j=[];BI.each(e,function(a,b){BI.isNotNull(h[e[a]])&&delete h[e[a]],BI.isNull(i[e[a]])&&j.push(b)}),c.storeValue.value=j.concat(BI.values(h)),c._adjust(b)})},_adjust:function(a){function b(){c.storeValue.type===BI.Selection.All&&c.storeValue.value.length>=c._count?c.storeValue={type:BI.Selection.Multi,value:[]}:c.storeValue.type===BI.Selection.Multi&&c.storeValue.value.length>=c._count&&(c.storeValue={type:BI.Selection.All,value:[]}),c.wants2Quit===!0&&(c.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM),c.wants2Quit=!1),c.requesting=!1}var c=this,d=this.options;this._count?(b(),a()):d.itemsCreator({type:BI.MultiSelectCombo.REQ_GET_DATA_LENGTH},function(d){c._count=d.count,b(),a()})},_join:function(a,b){var c=this;this.options;if(this._assertValue(a),this._assertValue(this.storeValue),this.storeValue.type===a.type){var d=this._makeMap(this.storeValue.value);BI.each(a.value,function(a,b){d[b]||(c.storeValue.value.push(b),d[b]=b)});var e=!1;return BI.each(a.assist,function(a,b){BI.isNotNull(d[b])&&(e=!0,delete d[b])}),e&&(this.storeValue.value=BI.values(d)),void c._adjust(b)}this._joinAll(a,b)},_setStartValue:function(a){this._startValue=a,this.popup.setStartValue(a)},setValue:function(a){this.storeValue=a||{},this._assertValue(this.storeValue),this.combo.setValue(this.storeValue)},getValue:function(){return BI.deepClone(this.storeValue)},populate:function(){this._count=null,this.combo.populate.apply(this.combo,arguments)}}),BI.extend(BI.MultiSelectCombo,{REQ_GET_DATA_LENGTH:0,REQ_GET_ALL_DATA:-1}),BI.MultiSelectCombo.EVENT_CONFIRM="EVENT_CONFIRM",BI.shortcut("bi.multi_select_combo",BI.MultiSelectCombo),BI.MultiSelectLoader=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiSelectLoader.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-loader",logic:{dynamic:!0},el:{height:400},valueFormatter:BI.emptyFn,itemsCreator:BI.emptyFn,onLoaded:BI.emptyFn})},_init:function(){BI.MultiSelectLoader.superclass._init.apply(this,arguments);var a=this,b=this.options,c=!1;this.button_group=BI.createWidget({type:"bi.select_list",element:this,logic:b.logic,el:BI.extend({onLoaded:b.onLoaded,el:{type:"bi.loader",isDefaultInit:!1,logic:{dynamic:!0,scrolly:!0},el:{chooseType:BI.ButtonGroup.CHOOSE_TYPE_MULTI,behaviors:{redmark:function(){return!0}},layouts:[{type:"bi.vertical"}]}}},b.el),itemsCreator:function(d,e){var f=a._startValue;a.storeValue&&(d=BI.extend(d||{},{selectedValues:BI.isKey(f)&&a.storeValue.type===BI.Selection.Multi?a.storeValue.value.concat(f):a.storeValue.value})),b.itemsCreator(d,function(g){c=g.hasNext;var h=[];if(1===d.times&&a.storeValue){var i=BI.map(a.storeValue.value,function(c,d){var e=b.valueFormatter(d)||d;return{text:e,value:d,title:e,selected:a.storeValue.type===BI.Selection.Multi}});if(BI.isKey(a._startValue)&&!a.storeValue.value.contains(a._startValue)){var j=b.valueFormatter(f)||f;i.unshift({text:j,value:f,title:j,selected:!0})}h=a._createItems(i)}e(h.concat(a._createItems(g.items)),g.keyword||""),1===d.times&&a.storeValue&&(BI.isKey(f)&&a.storeValue.value[a.storeValue.type===BI.Selection.All?"remove":"pushDistinct"](f),a.setValue(a.storeValue)),1===d.times&&a._scrollToTop()})},hasNext:function(){return c}}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.button_group.on(BI.SelectList.EVENT_CHANGE,function(){a.fireEvent(BI.MultiSelectLoader.EVENT_CHANGE,arguments)})},_createItems:function(a){return BI.createItems(a,{type:"bi.multi_select_item",logic:this.options.logic,height:25,selected:this.isAllSelected()})},_scrollToTop:function(){var a=this;BI.delay(function(){a.button_group.element.scrollTop(0)},30)},isAllSelected:function(){return this.button_group.isAllSelected()},_assertValue:function(a){a||(a={}),a.type||(a.type=BI.Selection.Multi),a.value||(a.value=[])},setStartValue:function(a){this._startValue=a},setValue:function(a){this.storeValue=a||{},this._assertValue(this.storeValue),this.button_group.setValue(this.storeValue)},getValue:function(){return this.button_group.getValue()},getAllButtons:function(){return this.button_group.getAllButtons()},empty:function(){this.button_group.empty()},populate:function(a){this.button_group.populate.apply(this.button_group,arguments)},resetHeight:function(a){this.button_group.resetHeight(a)},resetWidth:function(a){this.button_group.resetWidth(a)}}),BI.MultiSelectLoader.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multi_select_loader",BI.MultiSelectLoader),BI.MultiSelectPopupView=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiSelectPopupView.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-popup-view",maxWidth:"auto",minWidth:135,maxHeight:400,valueFormatter:BI.emptyFn,itemsCreator:BI.emptyFn,onLoaded:BI.emptyFn})},_init:function(){BI.MultiSelectPopupView.superclass._init.apply(this,arguments);var a=this,b=this.options;this.loader=BI.createWidget({type:"bi.multi_select_loader",itemsCreator:b.itemsCreator,valueFormatter:b.valueFormatter,onLoaded:b.onLoaded}),this.popupView=BI.createWidget({type:"bi.multi_popup_view",stopPropagation:!1,maxWidth:b.maxWidth,minWidth:b.minWidth,maxHeight:b.maxHeight,element:this,buttons:[BI.i18nText("BI-Basic_Clears"),BI.i18nText("BI-Basic_Sure")],el:this.loader}),this.popupView.on(BI.MultiPopupView.EVENT_CHANGE,function(){a.fireEvent(BI.MultiSelectPopupView.EVENT_CHANGE)}),this.popupView.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON,function(b){switch(b){case 0:a.fireEvent(BI.MultiSelectPopupView.EVENT_CLICK_CLEAR);break;case 1:a.fireEvent(BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM)}})},isAllSelected:function(){return this.loader.isAllSelected()},setStartValue:function(a){this.loader.setStartValue(a)},setValue:function(a){this.popupView.setValue(a)},getValue:function(){return this.popupView.getValue()},populate:function(a){this.popupView.populate.apply(this.popupView,arguments)},resetHeight:function(a){this.popupView.resetHeight(a)},resetWidth:function(a){this.popupView.resetWidth(a)}}),BI.MultiSelectPopupView.EVENT_CHANGE="EVENT_CHANGE",BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM="EVENT_CLICK_CONFIRM",BI.MultiSelectPopupView.EVENT_CLICK_CLEAR="EVENT_CLICK_CLEAR",BI.shortcut("bi.multi_select_popup_view",BI.MultiSelectPopupView),BI.MultiSelectTrigger=BI.inherit(BI.Trigger,{constants:{height:14,rgap:4,lgap:4},_defaultConfig:function(){return BI.extend(BI.MultiSelectTrigger.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-trigger bi-border",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,searcher:{},switcher:{},adapter:null,masker:{}})},_init:function(){BI.MultiSelectTrigger.superclass._init.apply(this,arguments);var a=this,b=this.options;b.height&&this.setHeight(b.height-2),this.searcher=BI.createWidget(b.searcher,{type:"bi.multi_select_searcher",height:b.height,itemsCreator:b.itemsCreator,valueFormatter:b.valueFormatter,popup:{},adapter:b.adapter,masker:b.masker}),this.searcher.on(BI.MultiSelectSearcher.EVENT_START,function(){a.fireEvent(BI.MultiSelectTrigger.EVENT_START)}),this.searcher.on(BI.MultiSelectSearcher.EVENT_PAUSE,function(){a.fireEvent(BI.MultiSelectTrigger.EVENT_PAUSE)}),this.searcher.on(BI.MultiSelectSearcher.EVENT_SEARCHING,function(){a.fireEvent(BI.MultiSelectTrigger.EVENT_SEARCHING,arguments)}),this.searcher.on(BI.MultiSelectSearcher.EVENT_STOP,function(){a.fireEvent(BI.MultiSelectTrigger.EVENT_STOP)}),this.searcher.on(BI.MultiSelectSearcher.EVENT_CHANGE,function(){a.fireEvent(BI.MultiSelectTrigger.EVENT_CHANGE,arguments)}),this.numberCounter=BI.createWidget(b.switcher,{type:"bi.multi_select_check_selected_switcher",valueFormatter:b.valueFormatter,itemsCreator:b.itemsCreator,adapter:b.adapter,masker:b.masker}),this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE,function(){a.fireEvent(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK)}),this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW,function(){
a.fireEvent(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW)});var c=BI.createWidget({type:"bi.right_vertical_adapt",hgap:4,items:[{el:this.numberCounter}]}),d=BI.createWidget({type:"bi.htape",element:this,items:[{el:this.searcher,width:"fill"},{el:c,width:0},{el:BI.createWidget(),width:30}]});this.numberCounter.on(BI.Events.VIEW,function(b){BI.nextTick(function(){d.attr("items")[1].width=b===!0?a.numberCounter.element.outerWidth()+8:0,d.resize()})}),this.element.click(function(b){a.element.__isMouseInBounds__(b)&&!a.numberCounter.element.__isMouseInBounds__(b)&&a.numberCounter.hideView()})},getCounter:function(){return this.numberCounter},getSearcher:function(){return this.searcher},stopEditing:function(){this.searcher.stopSearch(),this.numberCounter.hideView()},setAdapter:function(a){this.searcher.setAdapter(a),this.numberCounter.setAdapter(a)},setValue:function(a){this.searcher.setValue(a),this.numberCounter.setValue(a)},getKey:function(){return this.searcher.getKey()},getValue:function(){return this.searcher.getValue()}}),BI.MultiSelectTrigger.EVENT_TRIGGER_CLICK="EVENT_TRIGGER_CLICK",BI.MultiSelectTrigger.EVENT_COUNTER_CLICK="EVENT_COUNTER_CLICK",BI.MultiSelectTrigger.EVENT_CHANGE="EVENT_CHANGE",BI.MultiSelectTrigger.EVENT_START="EVENT_START",BI.MultiSelectTrigger.EVENT_STOP="EVENT_STOP",BI.MultiSelectTrigger.EVENT_PAUSE="EVENT_PAUSE",BI.MultiSelectTrigger.EVENT_SEARCHING="EVENT_SEARCHING",BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW="EVENT_BEFORE_COUNTER_POPUPVIEW",BI.shortcut("bi.multi_select_trigger",BI.MultiSelectTrigger),BI.MultiSelectSearchLoader=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiSelectSearchLoader.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-search-loader",itemsCreator:BI.emptyFn,keywordGetter:BI.emptyFn,valueFormatter:BI.emptyFn})},_init:function(){BI.MultiSelectSearchLoader.superclass._init.apply(this,arguments);var a=this,b=this.options,c=!1;this.button_group=BI.createWidget({type:"bi.select_list",element:this,logic:{dynamic:!1},el:{tipText:BI.i18nText("BI-No_Select"),el:{type:"bi.loader",isDefaultInit:!1,logic:{dynamic:!0,scrolly:!0},el:{chooseType:BI.ButtonGroup.CHOOSE_TYPE_MULTI,behaviors:{redmark:function(){return!0}},layouts:[{type:"bi.vertical"}]}}},itemsCreator:function(d,e){a.storeValue&&(d=BI.extend(d||{},{selectedValues:a.storeValue.value})),b.itemsCreator(d,function(f){var g=f.keyword=b.keywordGetter();c=f.hasNext;var h=[];if(1===d.times&&a.storeValue){var i=a._filterValues(a.storeValue);h=a._createItems(i)}e(h.concat(a._createItems(f.items)),g),1===d.times&&a.storeValue&&a.setValue(a.storeValue)})},hasNext:function(){return c}}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.button_group.on(BI.SelectList.EVENT_CHANGE,function(){a.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE,arguments)})},_createItems:function(a){return BI.createItems(a,{type:"bi.multi_select_item",logic:{dynamic:!1},height:25,selected:this.isAllSelected()})},isAllSelected:function(){return this.button_group.isAllSelected()},_filterValues:function(a){var b=this.options,c=b.keywordGetter(),d=BI.deepClone(a.value)||[],e=BI.map(d,function(a,c){return{text:b.valueFormatter(c)||c,value:c}});if(BI.isKey(c)){var f=BI.Func.getSearchResult(e,c);d=f.matched.concat(f.finded)}return BI.map(d,function(b,c){return{text:c.text,title:c.text,value:c.value,selected:a.type===BI.Selection.All}})},setValue:function(a){this.storeValue=BI.deepClone(a),this.button_group.setValue(a)},getValue:function(){return this.button_group.getValue()},getAllButtons:function(){return this.button_group.getAllButtons()},empty:function(){this.button_group.empty()},populate:function(a){this.button_group.populate.apply(this.button_group,arguments)},resetHeight:function(a){this.button_group.resetHeight(a)},resetWidth:function(a){this.button_group.resetWidth(a)}}),BI.MultiSelectSearchLoader.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multi_select_search_loader",BI.MultiSelectSearchLoader),BI.MultiSelectSearchPane=BI.inherit(BI.Widget,{constants:{height:25,lgap:10,tgap:5},_defaultConfig:function(){return BI.extend(BI.MultiSelectSearchPane.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-search-pane bi-card",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,keywordGetter:BI.emptyFn})},_init:function(){BI.MultiSelectSearchPane.superclass._init.apply(this,arguments);var a=this,b=this.options;this.tooltipClick=BI.createWidget({type:"bi.label",invisible:!0,text:BI.i18nText("BI-Click_Blank_To_Select"),cls:"multi-select-toolbar",height:this.constants.height}),this.loader=BI.createWidget({type:"bi.multi_select_search_loader",keywordGetter:b.keywordGetter,valueFormatter:b.valueFormatter,itemsCreator:function(c,d){b.itemsCreator.apply(a,[c,function(c){d(c),a.setKeyword(b.keywordGetter())}])}}),this.loader.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.resizer=BI.createWidget({type:"bi.vtape",element:this,items:[{el:this.tooltipClick,height:0},{el:this.loader}]}),this.tooltipClick.setVisible(!1)},setKeyword:function(a){var b,c=this.loader.getAllButtons().length>0&&(b=this.loader.getAllButtons()[0])&&a===b.getValue();c!==this.tooltipClick.isVisible()&&(this.tooltipClick.setVisible(c),this.resizer.attr("items")[0].height=c?this.constants.height:0,this.resizer.resize())},isAllSelected:function(){return this.loader.isAllSelected()},hasMatched:function(){return this.tooltipClick.isVisible()},setValue:function(a){this.loader.setValue(a)},getValue:function(){return this.loader.getValue()},empty:function(){this.loader.empty()},populate:function(a){this.loader.populate.apply(this.loader,arguments)}}),BI.MultiSelectSearchPane.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multi_select_search_pane",BI.MultiSelectSearchPane),BI.MultiSelectCheckSelectedButton=BI.inherit(BI.Single,{_const:{checkSelected:BI.i18nText("BI-Check_Selected")},_defaultConfig:function(){return BI.extend(BI.MultiSelectCheckSelectedButton.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-check-selected-button bi-high-light",itemsCreator:BI.emptyFn})},_init:function(){BI.MultiSelectCheckSelectedButton.superclass._init.apply(this,arguments);var a=this;this.numberCounter=BI.createWidget({type:"bi.text_button",element:this,hgap:4,text:"0",textAlign:"center",textHeight:15}),this.numberCounter.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.numberCounter.on(BI.TextButton.EVENT_CHANGE,function(){a.fireEvent(BI.MultiSelectCheckSelectedButton.EVENT_CHANGE,arguments)}),this.numberCounter.element.hover(function(){a.numberCounter.setTag(a.numberCounter.getText()),a.numberCounter.setText(a._const.checkSelected)},function(){a.numberCounter.setText(a.numberCounter.getTag())}),this.setVisible(!1)},setValue:function(a){var b=this,c=this.options;return a||(a={}),a.type||(a.type=BI.Selection.Multi),a.value||(a.value=[]),a.type===BI.Selection.All?void c.itemsCreator({type:BI.MultiSelectCombo.REQ_GET_DATA_LENGTH},function(c){var d=c.count-a.value.length;BI.nextTick(function(){b.numberCounter.setText(d),b.setVisible(d>0)})}):void BI.nextTick(function(){b.numberCounter.setText(a.value.length),b.setVisible(a.value.length>0)})},getValue:function(){}}),BI.MultiSelectCheckSelectedButton.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multi_select_check_selected_button",BI.MultiSelectCheckSelectedButton),BI.MultiSelectEditor=BI.inherit(BI.Widget,{_const:{checkSelected:BI.i18nText("BI-Check_Selected")},_defaultConfig:function(){return BI.extend(BI.MultiSelectEditor.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-editor",el:{}})},_init:function(){BI.MultiSelectEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget(b.el,{type:"bi.state_editor",element:this,height:b.height,watermark:BI.i18nText("BI-Basic_Search"),allowBlank:!0}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.StateEditor.EVENT_PAUSE,function(){a.fireEvent(BI.MultiSelectEditor.EVENT_PAUSE)}),this.editor.on(BI.StateEditor.EVENT_CLICK_LABEL,function(){})},focus:function(){this.editor.focus()},blur:function(){this.editor.blur()},setState:function(a){this.editor.setState(a)},setValue:function(a){this.editor.setValue(a)},getValue:function(){var a=this.editor.getState();return BI.isArray(a)&&a.length>0?a[a.length-1]:""},getKeywords:function(){var a=this.editor.getLastValidValue(),b=a.match(/[\S]+/g);return BI.isEndWithBlank(a)?b.concat([" "]):b},populate:function(a){}}),BI.MultiSelectEditor.EVENT_PAUSE="MultiSelectEditor.EVENT_PAUSE",BI.shortcut("bi.multi_select_editor",BI.MultiSelectEditor),BI.MultiSelectSearcher=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiSelectSearcher.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-searcher",itemsCreator:BI.emptyFn,el:{},popup:{},valueFormatter:BI.emptyFn,adapter:null,masker:{}})},_init:function(){BI.MultiSelectSearcher.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget(b.el,{type:"bi.multi_select_editor",height:b.height}),this.searcher=BI.createWidget({type:"bi.searcher",element:this,height:b.height,isAutoSearch:!1,isAutoSync:!1,onSearch:function(a,b){b()},el:this.editor,popup:BI.extend({type:"bi.multi_select_search_pane",valueFormatter:b.valueFormatter,keywordGetter:function(){return a.editor.getValue()},itemsCreator:function(c,d){c.keyword=a.editor.getValue(),this.setKeyword(c.keyword),b.itemsCreator(c,d)}},b.popup),adapter:b.adapter,masker:b.masker}),this.searcher.on(BI.Searcher.EVENT_START,function(){a.fireEvent(BI.MultiSelectSearcher.EVENT_START)}),this.searcher.on(BI.Searcher.EVENT_PAUSE,function(){this.hasMatched(),a.fireEvent(BI.MultiSelectSearcher.EVENT_PAUSE)}),this.searcher.on(BI.Searcher.EVENT_STOP,function(){a.fireEvent(BI.MultiSelectSearcher.EVENT_STOP)}),this.searcher.on(BI.Searcher.EVENT_CHANGE,function(){a.fireEvent(BI.MultiSelectSearcher.EVENT_CHANGE,arguments)}),this.searcher.on(BI.Searcher.EVENT_SEARCHING,function(){var b=this.getKeywords();a.fireEvent(BI.MultiSelectSearcher.EVENT_SEARCHING,b)})},adjustView:function(){this.searcher.adjustView()},isSearching:function(){return this.searcher.isSearching()},stopSearch:function(){this.searcher.stopSearch()},getKeyword:function(){return this.editor.getValue()},hasMatched:function(){return this.searcher.hasMatched()},hasChecked:function(){return this.searcher.getView()&&this.searcher.getView().hasChecked()},setAdapter:function(a){this.searcher.setAdapter(a)},setState:function(a){var b=this.options;if(a||(a={}),a.value||(a.value=[]),a.type===BI.Selection.All)if(0===a.value.length)this.editor.setState(BI.Selection.All);else if(BI.size(a.assist)<=20){var c="";BI.each(a.assist,function(a,d){c+=0===a?""+(b.valueFormatter(d+"")||d):","+(b.valueFormatter(d+"")||d)}),this.editor.setState(c)}else this.editor.setState(BI.Selection.Multi);else if(0===a.value.length)this.editor.setState(BI.Selection.None);else if(BI.size(a.value)<=20){var c="";BI.each(a.value,function(a,d){c+=0===a?""+(b.valueFormatter(d+"")||d):","+(b.valueFormatter(d+"")||d)}),this.editor.setState(c)}else this.editor.setState(BI.Selection.Multi)},setValue:function(a){this.setState(a),this.searcher.setValue(a)},getKey:function(){return this.editor.getValue()},getValue:function(){return this.searcher.getValue()},populate:function(a){this.searcher.populate.apply(this.searcher,arguments)}}),BI.MultiSelectSearcher.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.MultiSelectSearcher.EVENT_CHANGE="EVENT_CHANGE",BI.MultiSelectSearcher.EVENT_START="EVENT_START",BI.MultiSelectSearcher.EVENT_STOP="EVENT_STOP",BI.MultiSelectSearcher.EVENT_PAUSE="EVENT_PAUSE",BI.MultiSelectSearcher.EVENT_SEARCHING="EVENT_SEARCHING",BI.shortcut("bi.multi_select_searcher",BI.MultiSelectSearcher),BI.MultiSelectCheckSelectedSwitcher=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiSelectCheckSelectedSwitcher.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-check-selected-switcher",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,el:{},popup:{},adapter:null,masker:{}})},_init:function(){BI.MultiSelectCheckSelectedSwitcher.superclass._init.apply(this,arguments);var a=this,b=this.options;this.button=BI.createWidget(b.el,{type:"bi.multi_select_check_selected_button",itemsCreator:b.itemsCreator}),this.button.on(BI.Events.VIEW,function(){a.fireEvent(BI.Events.VIEW,arguments)}),this.switcher=BI.createWidget({type:"bi.switcher",toggle:!1,element:this,el:this.button,popup:BI.extend({type:"bi.multi_select_check_pane",valueFormatter:b.valueFormatter,itemsCreator:b.itemsCreator,onClickContinueSelect:function(){a.switcher.hideView()}},b.popup),adapter:b.adapter,masker:b.masker}),this.switcher.on(BI.Switcher.EVENT_TRIGGER_CHANGE,function(){a.fireEvent(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE)}),this.switcher.on(BI.Switcher.EVENT_BEFORE_POPUPVIEW,function(){a.fireEvent(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW)}),this.switcher.on(BI.Switcher.EVENT_AFTER_POPUPVIEW,function(){var a=this;BI.nextTick(function(){a.populate()})}),this.switcher.element.click(function(a){a.stopPropagation()})},adjustView:function(){this.switcher.adjustView()},hideView:function(){this.switcher.empty(),this.switcher.hideView()},setAdapter:function(a){this.switcher.setAdapter(a)},setValue:function(a){this.switcher.setValue(a)},setButtonChecked:function(a){this.button.setValue(a)},getValue:function(){},populate:function(a){this.switcher.populate.apply(this.switcher,arguments)}}),BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE="MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE",BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW="MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW",BI.shortcut("bi.multi_select_check_selected_switcher",BI.MultiSelectCheckSelectedSwitcher),BI.MultiSelectInsertList=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiSelectInsertList.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-insert-list",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn})},_init:function(){BI.MultiSelectInsertList.superclass._init.apply(this,arguments);var a=this,b=this.options;this.storeValue={};var c=function(){BI.isKey(a._startValue)&&a.storeValue.value[a.storeValue.type===BI.Selection.All?"remove":"pushDistinct"](a._startValue)};this.adapter=BI.createWidget({type:"bi.multi_select_loader",cls:"popup-multi-select-list bi-border-left bi-border-right bi-border-bottom",itemsCreator:b.itemsCreator,valueFormatter:b.valueFormatter,logic:{dynamic:!1},el:{}}),this.adapter.on(BI.MultiSelectLoader.EVENT_CHANGE,function(){a.storeValue=this.getValue(),c(),a.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE)}),this.searcherPane=BI.createWidget({type:"bi.multi_select_search_pane",cls:"bi-border-left bi-border-right bi-border-bottom",valueFormatter:b.valueFormatter,keywordGetter:function(){return a.trigger.getKeyword()},itemsCreator:function(c,d){c.keyword=a.trigger.getKeyword(),this.setKeyword(c.keyword),b.itemsCreator(c,d)}}),this.searcherPane.setVisible(!1),this.trigger=BI.createWidget({type:"bi.searcher",isAutoSearch:!1,isAutoSync:!1,onSearch:function(a,b){b()},adapter:this.adapter,popup:this.searcherPane,height:200,masker:!1,listeners:[{eventName:BI.Searcher.EVENT_START,action:function(){a._showSearcherPane(),a._setStartValue(""),this.setValue(BI.deepClone(a.storeValue))}},{eventName:BI.Searcher.EVENT_STOP,action:function(){a._showAdapter(),a._setStartValue(""),a.adapter.setValue(a.storeValue),a.adapter.populate()}},{eventName:BI.Searcher.EVENT_PAUSE,action:function(){var b=this.getKeyword();this.hasMatched()?a._join({type:BI.Selection.Multi,value:[b]},function(){a.storeValue.type===BI.Selection.Multi&&a.storeValue.value.pushDistinct(b),a._showAdapter(),a.adapter.setValue(a.storeValue),a._setStartValue(b),c(),a.adapter.populate(),a._setStartValue(""),a.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE)}):(a.storeValue.type===BI.Selection.Multi&&a.storeValue.value.pushDistinct(b),a._showAdapter(),a.adapter.setValue(a.storeValue),a.adapter.populate(),a.storeValue.type===BI.Selection.Multi&&a.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE))}},{eventName:BI.Searcher.EVENT_SEARCHING,action:function(){var b=this.getKeyword(),d=BI.last(b);b=BI.initial(b||[]),b.length>0&&a._joinKeywords(b,function(){BI.isEndWithBlank(d)?(a.adapter.setValue(a.storeValue),c(),a.adapter.populate(),a._setStartValue("")):(a.adapter.setValue(a.storeValue),c())})}},{eventName:BI.Searcher.EVENT_CHANGE,action:function(b,d){d instanceof BI.MultiSelectBar?a._joinAll(this.getValue(),function(){c(),a.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE)}):a._join(this.getValue(),function(){c(),a.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE)})}}]}),BI.createWidget({type:"bi.vtape",element:this,items:[{el:this.trigger,height:24},{el:this.adapter,height:"fill"}]}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.searcherPane,top:30,bottom:0,left:0,right:0}]})},_showAdapter:function(){this.adapter.setVisible(!0),this.searcherPane.setVisible(!1)},_showSearcherPane:function(){this.searcherPane.setVisible(!0),this.adapter.setVisible(!1)},_defaultState:function(){this.trigger.stopEditing()},_assertValue:function(a){a||(a={}),a.type||(a.type=BI.Selection.Multi),a.value||(a.value=[])},_makeMap:function(a){return BI.makeObject(a||[])},_joinKeywords:function(a,b){function c(c){var e=d._makeMap(c);BI.each(a,function(a,b){BI.isNotNull(e[b])&&d.storeValue.value[d.storeValue.type===BI.Selection.Multi?"pushDistinct":"remove"](b)}),b()}var d=this,e=this.options;this._assertValue(this.storeValue),this._allData?c(this._allData):e.itemsCreator({type:BI.MultiSelectInsertList.REQ_GET_ALL_DATA},function(a){d._allData=BI.pluck(a.items,"value"),c(d._allData)})},_joinAll:function(a,b){var c=this,d=this.options;this._assertValue(a),d.itemsCreator({type:BI.MultiSelectInsertList.REQ_GET_ALL_DATA,keyword:c.trigger.getKeyword()},function(d){var e=BI.pluck(d.items,"value");if(c.storeValue.type===a.type){var f=!1,g=c._makeMap(c.storeValue.value);return BI.each(e,function(a,b){BI.isNotNull(g[b])&&(f=!0,delete g[b])}),f&&(c.storeValue.value=BI.values(g)),void b()}var h=c._makeMap(c.storeValue.value),i=c._makeMap(a.value),j=[];BI.each(e,function(a,b){BI.isNotNull(h[e[a]])&&delete h[e[a]],BI.isNull(i[e[a]])&&j.push(b)}),c.storeValue.value=j.concat(BI.values(h)),b()})},_join:function(a,b){var c=this;this.options;if(this._assertValue(a),this._assertValue(this.storeValue),this.storeValue.type===a.type){var d=this._makeMap(this.storeValue.value);BI.each(a.value,function(a,b){d[b]||(c.storeValue.value.push(b),d[b]=b)});var e=!1;return BI.each(a.assist,function(a,b){BI.isNotNull(d[b])&&(e=!0,delete d[b])}),e&&(this.storeValue.value=BI.values(d)),void b()}this._joinAll(a,b)},_setStartValue:function(a){this._startValue=a,this.adapter.setStartValue(a)},isAllSelected:function(){return this.adapter.isAllSelected()},resize:function(){},setValue:function(a){this.storeValue=a||{},this._assertValue(this.storeValue),this.adapter.setValue(this.storeValue),this.trigger.setValue(this.storeValue)},getValue:function(){return BI.deepClone(this.storeValue)},populate:function(){this._count=null,this._allData=null,this.adapter.populate.apply(this.adapter,arguments),this.trigger.populate.apply(this.trigger,arguments)}}),BI.extend(BI.MultiSelectInsertList,{REQ_GET_DATA_LENGTH:0,REQ_GET_ALL_DATA:-1}),BI.MultiSelectInsertList.EVENT_CHANGE="BI.MultiSelectInsertList.EVENT_CHANGE",BI.shortcut("bi.multi_select_insert_list",BI.MultiSelectInsertList),BI.MultiSelectList=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiSelectList.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-list",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn})},_init:function(){BI.MultiSelectList.superclass._init.apply(this,arguments);var a=this,b=this.options;this.storeValue={};var c=function(){BI.isKey(a._startValue)&&a.storeValue.value[a.storeValue.type===BI.Selection.All?"remove":"pushDistinct"](a._startValue)};this.adapter=BI.createWidget({type:"bi.multi_select_loader",cls:"popup-multi-select-list bi-border-left bi-border-right bi-border-bottom",itemsCreator:b.itemsCreator,valueFormatter:b.valueFormatter,logic:{dynamic:!1},el:{}}),this.adapter.on(BI.MultiSelectLoader.EVENT_CHANGE,function(){a.storeValue=this.getValue(),a._adjust(function(){c(),a.fireEvent(BI.MultiSelectList.EVENT_CHANGE)})}),this.searcherPane=BI.createWidget({type:"bi.multi_select_search_pane",cls:"bi-border-left bi-border-right bi-border-bottom",valueFormatter:b.valueFormatter,keywordGetter:function(){return a.trigger.getKeyword()},itemsCreator:function(c,d){c.keyword=a.trigger.getKeyword(),this.setKeyword(c.keyword),b.itemsCreator(c,d)}}),this.searcherPane.setVisible(!1),this.trigger=BI.createWidget({type:"bi.searcher",isAutoSearch:!1,isAutoSync:!1,onSearch:function(a,b){b()},adapter:this.adapter,popup:this.searcherPane,height:200,masker:!1,listeners:[{eventName:BI.Searcher.EVENT_START,action:function(){a._showSearcherPane(),a._setStartValue(""),this.setValue(BI.deepClone(a.storeValue))}},{eventName:BI.Searcher.EVENT_STOP,action:function(){a._showAdapter(),a._setStartValue(""),a.adapter.setValue(a.storeValue),a.adapter.populate()}},{eventName:BI.Searcher.EVENT_PAUSE,action:function(){var b=this.getKeyword();this.hasMatched()&&a._join({type:BI.Selection.Multi,value:[b]},function(){a._showAdapter(),a.adapter.setValue(a.storeValue),a._setStartValue(b),c(),a.adapter.populate(),a._setStartValue(""),a.fireEvent(BI.MultiSelectList.EVENT_CHANGE)})}},{eventName:BI.Searcher.EVENT_SEARCHING,action:function(){var b=this.getKeyword(),d=BI.last(b);b=BI.initial(b||[]),b.length>0&&a._joinKeywords(b,function(){BI.isEndWithBlank(d)?(a.adapter.setValue(a.storeValue),c(),a.adapter.populate(),a._setStartValue("")):(a.adapter.setValue(a.storeValue),c())})}},{eventName:BI.Searcher.EVENT_CHANGE,action:function(b,d){d instanceof BI.MultiSelectBar?a._joinAll(this.getValue(),function(){c(),a.fireEvent(BI.MultiSelectList.EVENT_CHANGE)}):a._join(this.getValue(),function(){c(),a.fireEvent(BI.MultiSelectList.EVENT_CHANGE)})}}]}),BI.createWidget({type:"bi.vtape",element:this,items:[{el:this.trigger,height:24},{el:this.adapter,height:"fill"}]}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.searcherPane,top:30,bottom:0,left:0,right:0}]})},_showAdapter:function(){this.adapter.setVisible(!0),this.searcherPane.setVisible(!1)},_showSearcherPane:function(){this.searcherPane.setVisible(!0),this.adapter.setVisible(!1)},_defaultState:function(){this.trigger.stopEditing()},_assertValue:function(a){a||(a={}),a.type||(a.type=BI.Selection.Multi),a.value||(a.value=[])},_makeMap:function(a){return BI.makeObject(a||[])},_joinKeywords:function(a,b){function c(c){var e=d._makeMap(c);BI.each(a,function(a,b){BI.isNotNull(e[b])&&d.storeValue.value[d.storeValue.type===BI.Selection.Multi?"pushDistinct":"remove"](b)}),d._adjust(b)}var d=this,e=this.options;this._assertValue(this.storeValue),this._allData?c(this._allData):e.itemsCreator({type:BI.MultiSelectList.REQ_GET_ALL_DATA},function(a){d._allData=BI.pluck(a.items,"value"),c(d._allData)})},_joinAll:function(a,b){var c=this,d=this.options;this._assertValue(a),d.itemsCreator({type:BI.MultiSelectList.REQ_GET_ALL_DATA,keyword:c.trigger.getKeyword()},function(d){var e=BI.pluck(d.items,"value");if(c.storeValue.type===a.type){var f=!1,g=c._makeMap(c.storeValue.value);return BI.each(e,function(a,b){BI.isNotNull(g[b])&&(f=!0,delete g[b])}),f&&(c.storeValue.value=BI.values(g)),void c._adjust(b)}var h=c._makeMap(c.storeValue.value),i=c._makeMap(a.value),j=[];BI.each(e,function(a,b){BI.isNotNull(h[e[a]])&&delete h[e[a]],BI.isNull(i[e[a]])&&j.push(b)}),c.storeValue.value=j.concat(BI.values(h)),c._adjust(b)})},_adjust:function(a){function b(){c.storeValue.type===BI.Selection.All&&c.storeValue.value.length>=c._count?c.storeValue={type:BI.Selection.Multi,value:[]}:c.storeValue.type===BI.Selection.Multi&&c.storeValue.value.length>=c._count&&(c.storeValue={type:BI.Selection.All,value:[]})}var c=this,d=this.options;this._count?(b(),a()):d.itemsCreator({type:BI.MultiSelectList.REQ_GET_DATA_LENGTH},function(d){c._count=d.count,b(),a()})},_join:function(a,b){var c=this;this.options;if(this._assertValue(a),this._assertValue(this.storeValue),this.storeValue.type===a.type){var d=this._makeMap(this.storeValue.value);BI.each(a.value,function(a,b){d[b]||(c.storeValue.value.push(b),d[b]=b)});var e=!1;return BI.each(a.assist,function(a,b){BI.isNotNull(d[b])&&(e=!0,delete d[b])}),e&&(this.storeValue.value=BI.values(d)),void c._adjust(b)}this._joinAll(a,b)},_setStartValue:function(a){this._startValue=a,this.adapter.setStartValue(a)},isAllSelected:function(){return this.adapter.isAllSelected()},resize:function(){},setValue:function(a){this.storeValue=a||{},this._assertValue(this.storeValue),this.adapter.setValue(this.storeValue),this.trigger.setValue(this.storeValue)},getValue:function(){return BI.deepClone(this.storeValue)},populate:function(){this._count=null,this._allData=null,this.adapter.populate.apply(this.adapter,arguments),this.trigger.populate.apply(this.trigger,arguments)}}),BI.extend(BI.MultiSelectList,{REQ_GET_DATA_LENGTH:0,REQ_GET_ALL_DATA:-1}),BI.MultiSelectList.EVENT_CHANGE="BI.MultiSelectList.EVENT_CHANGE",BI.shortcut("bi.multi_select_list",BI.MultiSelectList),BI.MultiSelectTree=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiSelectTree.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-tree",itemsCreator:BI.emptyFn})},_init:function(){BI.MultiSelectTree.superclass._init.apply(this,arguments);var a=this,b=this.options;this.storeValue={value:{}},this.adapter=BI.createWidget({type:"bi.multi_select_tree_popup",itemsCreator:b.itemsCreator}),this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE,function(){a.searcher.isSearching()?a.storeValue={value:a.searcherPane.getValue()}:a.storeValue={value:a.adapter.getValue()},a.setSelectedValue(a.storeValue.value),a.fireEvent(BI.MultiSelectTree.EVENT_CHANGE)}),this.searcherPane=BI.createWidget({type:"bi.multi_tree_search_pane",cls:"bi-border-left bi-border-right bi-border-bottom",keywordGetter:function(){return a.searcher.getKeyword()},itemsCreator:function(c,d){c.keyword=a.searcher.getKeyword(),b.itemsCreator(c,d)}}),this.searcherPane.setVisible(!1),this.searcher=BI.createWidget({type:"bi.searcher",isAutoSearch:!1,isAutoSync:!1,onSearch:function(b,c){c({keyword:a.searcher.getKeyword()})},adapter:this.adapter,popup:this.searcherPane,masker:!1,listeners:[{eventName:BI.Searcher.EVENT_START,action:function(){a._showSearcherPane()}},{eventName:BI.Searcher.EVENT_STOP,action:function(){a._showAdapter(),BI.nextTick(function(){a.adapter.populate()})}},{eventName:BI.Searcher.EVENT_CHANGE,action:function(){a.searcher.isSearching()?a.storeValue={value:a.searcherPane.getValue()}:a.storeValue={value:a.adapter.getValue()},a.setSelectedValue(a.storeValue.value),a.fireEvent(BI.MultiSelectTree.EVENT_CHANGE)}},{eventName:BI.Searcher.EVENT_PAUSE,action:function(){a._showAdapter()}}]}),BI.createWidget({type:"bi.vtape",element:this,items:[{el:this.searcher,height:24},{el:this.adapter,height:"fill"}]}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.searcherPane,top:30,bottom:0,left:0,right:0}]})},_showAdapter:function(){this.adapter.setVisible(!0),this.searcherPane.setVisible(!1)},_showSearcherPane:function(){this.searcherPane.setVisible(!0),this.adapter.setVisible(!1)},resize:function(){},setSelectedValue:function(a){this.storeValue.value=a||{},this.adapter.setSelectedValue(a),this.searcherPane.setSelectedValue(a),this.searcher.setValue({value:a||{}})},setValue:function(a){this.adapter.setValue(a)},stopSearch:function(){this.searcher.stopSearch()},updateValue:function(a){this.adapter.updateValue(a)},getValue:function(){return this.storeValue.value},populate:function(){this.searcher.populate.apply(this.searcher,arguments),this.adapter.populate.apply(this.adapter,arguments)}}),BI.MultiSelectTree.EVENT_CHANGE="BI.MultiSelectTree.EVENT_CHANGE",BI.shortcut("bi.multi_select_tree",BI.MultiSelectTree),BI.MultiSelectTreePopup=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiSelectTreePopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-select-tree-popup bi-border-left bi-border-right bi-border-bottom",itemsCreator:BI.emptyFn})},_init:function(){BI.MultiSelectTreePopup.superclass._init.apply(this,arguments);var a=this,b=this.options;this.popup=BI.createWidget({type:"bi.async_tree",element:this,itemsCreator:b.itemsCreator}),this.popup.on(BI.TreeView.EVENT_AFTERINIT,function(){a.fireEvent(BI.MultiSelectTreePopup.EVENT_AFTER_INIT)}),this.popup.on(BI.TreeView.EVENT_CHANGE,function(){a.fireEvent(BI.MultiSelectTreePopup.EVENT_CHANGE)})},hasChecked:function(){return this.popup.hasChecked()},getValue:function(){return this.popup.getValue()},setValue:function(a){a||(a={}),this.popup.setValue(a)},setSelectedValue:function(a){a||(a={}),this.popup.setSelectedValue(a)},updateValue:function(a){this.popup.updateValue(a),this.popup.refresh()},populate:function(a){this.popup.stroke(a)}}),BI.MultiSelectTreePopup.EVENT_AFTER_INIT="BI.MultiSelectTreePopup.EVENT_AFTER_INIT",BI.MultiSelectTreePopup.EVENT_CHANGE="BI.MultiSelectTreePopup.EVENT_CHANGE",BI.shortcut("bi.multi_select_tree_popup",BI.MultiSelectTreePopup),BI.MultiTreeCheckPane=BI.inherit(BI.Pane,{constants:{height:25,lgap:10,tgap:5},_defaultConfig:function(){return BI.extend(BI.MultiTreeCheckPane.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-tree-check-pane bi-background",onClickContinueSelect:BI.emptyFn})},_init:function(){BI.MultiTreeCheckPane.superclass._init.apply(this,arguments);var a=this,b=this.options;this.selectedValues={};var c=BI.createWidget({type:"bi.text_button",text:BI.i18nText("BI-Continue_Select"),cls:"multi-tree-check-selected"});c.on(BI.TextButton.EVENT_CHANGE,function(){b.onClickContinueSelect(),BI.nextTick(function(){a.empty()})});var d=BI.createWidget({type:"bi.left",cls:"multi-tree-continue-select",items:[{el:{type:"bi.label",text:BI.i18nText("BI-Selected_Data")},lgap:this.constants.lgap,tgap:this.constants.tgap},{el:c,lgap:this.constants.lgap,tgap:this.constants.tgap}]});this.display=BI.createWidget({type:"bi.display_tree",cls:"bi-multi-tree-display",itemsCreator:function(a,c){a.type=BI.TreeView.REQ_TYPE_GET_SELECTED_DATA,b.itemsCreator(a,c)}}),this.display.on(BI.Events.AFTERINIT,function(){a.fireEvent(BI.Events.AFTERINIT)}),this.display.on(BI.TreeView.EVENT_INIT,function(){d.setVisible(!1)}),this.display.on(BI.TreeView.EVENT_AFTERINIT,function(){d.setVisible(!0)}),BI.createWidget({type:"bi.vtape",element:this,items:[{height:this.constants.height,el:d},{height:"fill",el:this.display}]})},empty:function(){this.display.empty()},populate:function(a){this.display.stroke(a)},setValue:function(a){a||(a={}),this.display.setSelectedValue(a.value)},getValue:function(){}}),BI.MultiTreeCheckPane.EVENT_CONTINUE_CLICK="EVENT_CONTINUE_CLICK",BI.shortcut("bi.multi_tree_check_pane",BI.MultiTreeCheckPane),BI.MultiTreeCombo=BI.inherit(BI.Single,{constants:{offset:{top:1,left:1,right:2,bottom:33}},_defaultConfig:function(){return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-tree-combo",itemsCreator:BI.emptyFn,height:25})},_init:function(){function a(){h()?b.storeValue={value:b.trigger.getValue()}:i()&&(b.storeValue={value:b.combo.getValue()}),b.trigger.setValue(b.storeValue)}BI.MultiTreeCombo.superclass._init.apply(this,arguments);var b=this,c=this.options,d=!1,e=!1;this.trigger=BI.createWidget({type:"bi.multi_select_trigger",height:c.height,masker:{offset:this.constants.offset
},searcher:{type:"bi.multi_tree_searcher",itemsCreator:c.itemsCreator},switcher:{el:{type:"bi.multi_tree_check_selected_button"},popup:{type:"bi.multi_tree_check_pane",itemsCreator:c.itemsCreator}}}),this.combo=BI.createWidget({type:"bi.combo",toggle:!1,el:this.trigger,adjustLength:1,popup:{type:"bi.multi_tree_popup_view",ref:function(){b.popup=this,b.trigger.setAdapter(this)},listeners:[{eventName:BI.MultiTreePopup.EVENT_AFTERINIT,action:function(){b.trigger.getCounter().adjustView(),d=!0,e===!0&&a()}},{eventName:BI.MultiTreePopup.EVENT_CHANGE,action:function(){f=!0;var a={type:BI.Selection.Multi,value:this.hasChecked()?this.getValue():{}};b.trigger.getSearcher().setState(a),b.trigger.getCounter().setButtonChecked(a)}},{eventName:BI.MultiTreePopup.EVENT_CLICK_CONFIRM,action:function(){b.combo.hideView()}},{eventName:BI.MultiTreePopup.EVENT_CLICK_CLEAR,action:function(){g=!0,b.setValue(),b._defaultState()}}],itemsCreator:c.itemsCreator,onLoaded:function(){BI.nextTick(function(){b.trigger.getCounter().adjustView(),b.trigger.getSearcher().adjustView()})}},hideChecker:function(a){return 0===j.element.find(a.target).length}}),this.storeValue={value:{}};var f=!1,g=!1,h=function(){return b.trigger.getSearcher().isSearching()},i=function(){return b.combo.isViewVisible()};this.trigger.on(BI.MultiSelectTrigger.EVENT_START,function(){b.storeValue={value:b.combo.getValue()},this.setValue(b.storeValue)}),this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP,function(){b.storeValue={value:this.getValue()},b.combo.setValue(b.storeValue),BI.nextTick(function(){i()&&b.combo.populate()})}),this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW,function(){e===!1&&(e=!0),d===!0&&(e=null,a())}),this.trigger.on(BI.MultiSelectTrigger.EVENT_TRIGGER_CLICK,function(){b.combo.toggle()}),this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK,function(){b.combo.isViewVisible()||b.combo.showView()}),this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE,function(){var a=this.getSearcher().hasChecked(),b={type:BI.Selection.Multi,value:a?{1:1}:{}};this.getSearcher().setState(a?BI.Selection.Multi:BI.Selection.None),this.getCounter().setButtonChecked(b)}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){h()||(f===!0&&(b.storeValue={value:b.combo.getValue()},f=!1),b.combo.setValue(b.storeValue),b.populate())}),this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW,function(){h()?(b.trigger.stopEditing(),b.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM)):i()&&(b.trigger.stopEditing(),b.storeValue={value:b.combo.getValue()},g===!0&&(b.storeValue={value:{}}),b.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM)),g=!1,f=!1});var j=BI.createWidget({type:"bi.trigger_icon_button",width:c.height,height:c.height,cls:"multi-select-trigger-icon-button bi-border-left"});j.on(BI.TriggerIconButton.EVENT_CHANGE,function(){b.trigger.getCounter().hideView(),b.combo.isViewVisible()?b.combo.hideView():b.combo.showView()}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.combo,left:0,right:0,top:0,bottom:0},{el:j,right:0,top:0,bottom:0}]})},_defaultState:function(){this.trigger.stopEditing(),this.combo.hideView()},setValue:function(a){this.storeValue.value=a||{},this.combo.setValue({value:a||{}})},getValue:function(){return this.storeValue.value},populate:function(){this.combo.populate.apply(this.combo,arguments)}}),BI.MultiTreeCombo.EVENT_CONFIRM="MultiTreeCombo.EVENT_CONFIRM",BI.shortcut("bi.multi_tree_combo",BI.MultiTreeCombo),BI.MultiTreePopup=BI.inherit(BI.Pane,{_defaultConfig:function(){return BI.extend(BI.MultiTreePopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-tree-popup",maxWidth:"auto",minWidth:100,maxHeight:400,onLoaded:BI.emptyFn})},_init:function(){BI.MultiTreePopup.superclass._init.apply(this,arguments);var a=this,b=this.options;this.selectedValues={},this.tree=BI.createWidget({type:"bi.async_tree",height:400,cls:"popup-view-tree",itemsCreator:b.itemsCreator,onLoaded:b.onLoaded}),this.popupView=BI.createWidget({type:"bi.multi_popup_view",element:this,stopPropagation:!1,maxWidth:b.maxWidth,minWidth:b.minWidth,maxHeight:b.maxHeight,buttons:[BI.i18nText("BI-Basic_Clears"),BI.i18nText("BI-Basic_Sure")],el:this.tree}),this.popupView.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON,function(b){switch(b){case 0:a.fireEvent(BI.MultiTreePopup.EVENT_CLICK_CLEAR);break;case 1:a.fireEvent(BI.MultiTreePopup.EVENT_CLICK_CONFIRM)}}),this.tree.on(BI.TreeView.EVENT_CHANGE,function(){a.fireEvent(BI.MultiTreePopup.EVENT_CHANGE)}),this.tree.on(BI.TreeView.EVENT_AFTERINIT,function(){a.fireEvent(BI.MultiTreePopup.EVENT_AFTERINIT)})},getValue:function(){return this.tree.getValue()},setValue:function(a){a||(a={}),this.tree.setSelectedValue(a.value)},populate:function(a){this.tree.stroke(a)},hasChecked:function(){return this.tree.hasChecked()},resetHeight:function(a){this.popupView.resetHeight(a)},resetWidth:function(a){this.popupView.resetWidth(a)}}),BI.MultiTreePopup.EVENT_CHANGE="EVENT_CHANGE",BI.MultiTreePopup.EVENT_CLICK_CONFIRM="EVENT_CLICK_CONFIRM",BI.MultiTreePopup.EVENT_CLICK_CLEAR="EVENT_CLICK_CLEAR",BI.MultiTreePopup.EVENT_AFTERINIT="EVENT_AFTERINIT",BI.shortcut("bi.multi_tree_popup_view",BI.MultiTreePopup),BI.MultiTreeSearchPane=BI.inherit(BI.Pane,{_defaultConfig:function(){return BI.extend(BI.MultiTreeSearchPane.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-tree-search-pane bi-card",itemsCreator:BI.emptyFn,keywordGetter:BI.emptyFn})},_init:function(){BI.MultiTreeSearchPane.superclass._init.apply(this,arguments);var a=this,b=this.options;this.partTree=BI.createWidget({type:"bi.part_tree",element:this,tipText:BI.i18nText("BI-No_Select"),itemsCreator:function(a,c){a.keyword=b.keywordGetter(),b.itemsCreator(a,c)}}),this.partTree.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.partTree.on(BI.TreeView.EVENT_CHANGE,function(){a.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE)})},hasChecked:function(){return this.partTree.hasChecked()},setValue:function(a){this.setSelectedValue(a.value)},setSelectedValue:function(a){a||(a={}),this.partTree.setSelectedValue(a)},getValue:function(){return this.partTree.getValue()},empty:function(){this.partTree.empty()},populate:function(a){this.partTree.stroke.apply(this.partTree,arguments)}}),BI.MultiTreeSearchPane.EVENT_CHANGE="EVENT_CHANGE",BI.MultiTreeSearchPane.EVENT_CLICK_CONFIRM="EVENT_CLICK_CONFIRM",BI.MultiTreeSearchPane.EVENT_CLICK_CLEAR="EVENT_CLICK_CLEAR",BI.shortcut("bi.multi_tree_search_pane",BI.MultiTreeSearchPane),BI.MultiTreeCheckSelectedButton=BI.inherit(BI.Single,{_const:{checkSelected:BI.i18nText("BI-Check_Selected")},_defaultConfig:function(){return BI.extend(BI.MultiTreeCheckSelectedButton.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-tree-check-selected-button",itemsCreator:BI.emptyFn})},_init:function(){BI.MultiTreeCheckSelectedButton.superclass._init.apply(this,arguments);var a=this;this.indicator=BI.createWidget({type:"bi.icon_button",cls:"check-font trigger-check-selected",width:15,height:15,stopPropagation:!0}),this.checkSelected=BI.createWidget({type:"bi.text_button",cls:"trigger-check-selected",invisible:!0,hgap:4,text:this._const.checkSelected,textAlign:"center",textHeight:15}),this.checkSelected.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.checkSelected.on(BI.TextButton.EVENT_CHANGE,function(){a.fireEvent(BI.MultiSelectCheckSelectedButton.EVENT_CHANGE,arguments)}),BI.createWidget({type:"bi.horizontal",element:this,items:[this.indicator,this.checkSelected]}),this.element.hover(function(){a.indicator.setVisible(!1),a.checkSelected.setVisible(!0)},function(){a.indicator.setVisible(!0),a.checkSelected.setVisible(!1)}),this.setVisible(!1)},setValue:function(a){a||(a={}),this.setVisible(BI.size(a.value)>0)}}),BI.MultiTreeCheckSelectedButton.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.multi_tree_check_selected_button",BI.MultiTreeCheckSelectedButton),BI.MultiTreeSearcher=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.MultiTreeSearcher.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-multi-tree-searcher",itemsCreator:BI.emptyFn,popup:{},adapter:null,masker:{}})},_init:function(){BI.MultiTreeSearcher.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.multi_select_editor",height:b.height,el:{type:"bi.simple_state_editor",height:b.height}}),this.searcher=BI.createWidget({type:"bi.searcher",element:this,isAutoSearch:!1,isAutoSync:!1,onSearch:function(b,c){c({keyword:a.editor.getValue()})},el:this.editor,popup:BI.extend({type:"bi.multi_tree_search_pane",keywordGetter:function(){return a.editor.getValue()},itemsCreator:function(c,d){c.keyword=a.editor.getValue(),b.itemsCreator(c,d)}},b.popup),adapter:b.adapter,masker:b.masker}),this.searcher.on(BI.Searcher.EVENT_START,function(){a.fireEvent(BI.MultiTreeSearcher.EVENT_START)}),this.searcher.on(BI.Searcher.EVENT_PAUSE,function(){this.hasMatched(),a.fireEvent(BI.MultiTreeSearcher.EVENT_PAUSE)}),this.searcher.on(BI.Searcher.EVENT_STOP,function(){a.fireEvent(BI.MultiTreeSearcher.EVENT_STOP)}),this.searcher.on(BI.Searcher.EVENT_CHANGE,function(){a.fireEvent(BI.MultiTreeSearcher.EVENT_CHANGE,arguments)})},adjustView:function(){this.searcher.adjustView()},setAdapter:function(a){this.searcher.setAdapter(a)},isSearching:function(){return this.searcher.isSearching()},stopSearch:function(){this.searcher.stopSearch()},getKeyword:function(){return this.editor.getValue()},hasMatched:function(){return this.searcher.hasMatched()},hasChecked:function(){return this.searcher.getView()&&this.searcher.getView().hasChecked()},setState:function(a){function b(a){var c="",d=0,e=BI.size(a);return BI.each(a,function(a,f){d++;var g=b(f);c+=a+(""===g?"":":"+g)+(d===e?"":",")}),c}if(a||(a={}),a.value||(a.value={}),BI.isNumber(a))this.editor.setState(a);else if(0===BI.size(a.value))this.editor.setState(BI.Selection.None);else{var c="";BI.each(a.value,function(a,d){var e=b(d);c+=a+(""===e?"":":"+e)+"; "}),this.editor.setState(c)}},setValue:function(a){this.setState(a),this.searcher.setValue(a)},getKey:function(){return this.editor.getValue()},getValue:function(){return this.searcher.getValue()},populate:function(a){this.searcher.populate.apply(this.searcher,arguments)}}),BI.MultiTreeSearcher.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.MultiTreeSearcher.EVENT_CHANGE="EVENT_CHANGE",BI.MultiTreeSearcher.EVENT_START="EVENT_START",BI.MultiTreeSearcher.EVENT_STOP="EVENT_STOP",BI.MultiTreeSearcher.EVENT_PAUSE="EVENT_PAUSE",BI.shortcut("bi.multi_tree_searcher",BI.MultiTreeSearcher),BI.NumberEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.NumberEditor.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-number-editor bi-border",validationChecker:function(){return!0},valueFormatter:function(a){return a},value:0,allowBlank:!1,errorText:"",step:1})},_init:function(){BI.NumberEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.sign_editor",height:b.height,allowBlank:b.allowBlank,value:b.valueFormatter(b.value),validationChecker:b.validationChecker,errorText:b.errorText}),this.editor.on(BI.TextEditor.EVENT_CHANGE,function(){b.value=this.getValue(),a.fireEvent(BI.NumberEditor.EVENT_CHANGE)}),this.editor.on(BI.TextEditor.EVENT_CONFIRM,function(){a.fireEvent(BI.NumberEditor.EVENT_CONFIRM)}),this.topBtn=BI.createWidget({type:"bi.icon_button",trigger:"lclick,",cls:"column-pre-page-h-font top-button bi-border-left bi-border-bottom"}),this.topBtn.on(BI.IconButton.EVENT_CHANGE,function(){a._finetuning(b.step),a.fireEvent(BI.NumberEditor.EVENT_CHANGE),a.fireEvent(BI.NumberEditor.EVENT_CONFIRM)}),this.bottomBtn=BI.createWidget({type:"bi.icon_button",trigger:"lclick,",cls:"column-next-page-h-font bottom-button bi-border-left bi-border-top"}),this.bottomBtn.on(BI.IconButton.EVENT_CHANGE,function(){a._finetuning(-b.step),a.fireEvent(BI.NumberEditor.EVENT_CHANGE),a.fireEvent(BI.NumberEditor.EVENT_CONFIRM)}),BI.createWidget({type:"bi.htape",element:this,items:[this.editor,{el:{type:"bi.grid",columns:1,rows:2,items:[{column:0,row:0,el:this.topBtn},{column:0,row:1,el:this.bottomBtn}]},width:23}]})},_finetuning:function(a){var b=BI.parseFloat(this.getValue());this.setValue(b.add(a))},setUpEnable:function(a){this.topBtn.setEnable(!!a)},setDownEnable:function(a){this.bottomBtn.setEnable(!!a)},getValue:function(){return this.options.value},setValue:function(a){var b=this.options;b.value=a,this.editor.setValue(b.valueFormatter(a))}}),BI.NumberEditor.EVENT_CONFIRM="EVENT_CONFIRM",BI.NumberEditor.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.number_editor",BI.NumberEditor),BI.NumberInterval=BI.inherit(BI.Single,{constants:{typeError:"typeBubble",numberError:"numberBubble",signalError:"signalBubble",editorWidth:114,columns:5,width:30,rows:1,numberErrorCls:"number-error",border:1,less:0,less_equal:1,numTip:""},_defaultConfig:function(){var a=BI.NumberInterval.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{extraCls:"bi-number-interval",height:25,validation:"valid"})},_init:function(){var a=this,b=this.constants,c=this.options;BI.NumberInterval.superclass._init.apply(this,arguments),this.smallEditor=BI.createWidget({type:"bi.editor",height:c.height-2,watermark:BI.i18nText("BI-Basic_Unrestricted"),allowBlank:!0,value:c.min,level:"warning",tipType:"warning",quitChecker:function(){return!1},validationChecker:function(c){return!!BI.isNumeric(c)||(a.smallEditorBubbleType=b.typeError,!1)},cls:"number-interval-small-editor bi-border-top bi-border-bottom bi-border-left"}),this.smallTip=BI.createWidget({type:"bi.label",text:c.numTip,height:c.height-2,invisible:!0}),BI.createWidget({type:"bi.absolute",element:this.smallEditor.element,items:[{el:this.smallTip,top:0,right:5}]}),this.bigEditor=BI.createWidget({type:"bi.editor",height:c.height-2,watermark:BI.i18nText("BI-Basic_Unrestricted"),allowBlank:!0,value:c.max,level:"warning",tipType:"warning",quitChecker:function(){return!1},validationChecker:function(c){return!!BI.isNumeric(c)||(a.bigEditorBubbleType=b.typeError,!1)},cls:"number-interval-big-editor bi-border-top bi-border-bottom bi-border-right"}),this.bigTip=BI.createWidget({type:"bi.label",text:c.numTip,height:c.height-2,invisible:!0}),BI.createWidget({type:"bi.absolute",element:this.bigEditor.element,items:[{el:this.bigTip,top:0,right:5}]}),this.smallCombo=BI.createWidget({type:"bi.icon_combo",cls:"number-interval-small-combo bi-border",height:c.height-2,items:[{text:"("+BI.i18nText("BI-Less_Than")+")",iconClass:"less-font",value:0},{text:"("+BI.i18nText("BI-Less_And_Equal")+")",value:1,iconClass:"less-equal-font"}]}),c.closemin===!0?this.smallCombo.setValue(1):this.smallCombo.setValue(0),this.bigCombo=BI.createWidget({type:"bi.icon_combo",cls:"number-interval-big-combo bi-border",height:c.height-2,items:[{text:"("+BI.i18nText("BI-Less_Than")+")",iconClass:"less-font",value:0},{text:"("+BI.i18nText("BI-Less_And_Equal")+")",value:1,iconClass:"less-equal-font"}]}),c.closemax===!0?this.bigCombo.setValue(1):this.bigCombo.setValue(0),this.label=BI.createWidget({type:"bi.label",text:BI.i18nText("BI-Basic_Value"),textHeight:c.height-2*b.border,width:b.width-2*b.border,height:c.height-2*b.border,level:"warning",tipType:"warning"}),this.left=BI.createWidget({type:"bi.htape",items:[{el:a.smallEditor},{el:a.smallCombo,width:b.width-2*b.border}]}),this.right=BI.createWidget({type:"bi.htape",items:[{el:a.bigCombo,width:b.width-2*b.border},{el:a.bigEditor}]}),BI.createWidget({element:a,type:"bi.center",hgap:15,height:c.height,items:[{type:"bi.absolute",items:[{el:a.left,left:-15,right:0,top:0,bottom:0}]},{type:"bi.absolute",items:[{el:a.right,left:0,right:-15,top:0,bottom:0}]}]}),BI.createWidget({element:a,type:"bi.horizontal_auto",items:[a.label]}),a._setValidEvent(a.bigEditor,b.bigEditor),a._setValidEvent(a.smallEditor,b.smallEditor),a._setErrorEvent(a.bigEditor,b.bigEditor),a._setErrorEvent(a.smallEditor,b.smallEditor),a._setBlurEvent(a.bigEditor),a._setBlurEvent(a.smallEditor),a._setFocusEvent(a.bigEditor),a._setFocusEvent(a.smallEditor),a._setComboValueChangedEvent(a.bigCombo),a._setComboValueChangedEvent(a.smallCombo),a._setEditorValueChangedEvent(a.bigEditor),a._setEditorValueChangedEvent(a.smallEditor)},_checkValidation:function(){var a=this,b=this.constants,c=this.options;if(a._setTitle(""),BI.Bubbles.hide(b.typeError),BI.Bubbles.hide(b.numberError),BI.Bubbles.hide(b.signalError),!a.smallEditor.isValid()||!a.bigEditor.isValid())return a.element.removeClass("number-error"),c.validation="invalid",b.typeError;if(BI.isEmptyString(a.smallEditor.getValue())||BI.isEmptyString(a.bigEditor.getValue()))return a.element.removeClass("number-error"),c.validation="valid","";var d=parseFloat(a.smallEditor.getValue()),e=parseFloat(a.bigEditor.getValue()),f=a.bigCombo.getValue(),g=a.smallCombo.getValue();return f[0]===b.less_equal&&g[0]===b.less_equal?d>e?(a.element.addClass("number-error"),c.validation="invalid",b.numberError):(a.element.removeClass("number-error"),c.validation="valid",""):d>e?(a.element.addClass("number-error"),c.validation="invalid",b.numberError):d===e?(a.element.addClass("number-error"),c.validation="invalid",b.signalError):(a.element.removeClass("number-error"),c.validation="valid","")},_setTitle:function(a){var b=this;b.bigEditor.setTitle(a),b.smallEditor.setTitle(a),b.label.setTitle(a)},_setFocusEvent:function(a){var b=this,c=this.constants;a.on(BI.Editor.EVENT_FOCUS,function(){switch(b._setTitle(""),b._checkValidation()){case c.typeError:BI.Bubbles.show(c.typeError,BI.i18nText("BI-Numerical_Interval_Input_Data"),b,{offsetStyle:"center"});break;case c.numberError:BI.Bubbles.show(c.numberError,BI.i18nText("BI-Numerical_Interval_Number_Value"),b,{offsetStyle:"center"});break;case c.signalError:BI.Bubbles.show(c.signalError,BI.i18nText("BI-Numerical_Interval_Signal_Value"),b,{offsetStyle:"center"});break;default:return}})},_setBlurEvent:function(a){var b=this.constants,c=this;a.on(BI.Editor.EVENT_BLUR,function(){switch(BI.Bubbles.hide(b.typeError),BI.Bubbles.hide(b.numberError),BI.Bubbles.hide(b.signalError),c._checkValidation()){case b.typeError:c._setTitle(BI.i18nText("BI-Numerical_Interval_Input_Data"));break;case b.numberError:c._setTitle(BI.i18nText("BI-Numerical_Interval_Number_Value"));break;case b.signalError:c._setTitle(BI.i18nText("BI-Numerical_Interval_Signal_Value"));break;default:c._setTitle("")}})},_setErrorEvent:function(a){var b=this.constants,c=this;a.on(BI.Editor.EVENT_ERROR,function(){c._checkValidation(),BI.Bubbles.show(b.typeError,BI.i18nText("BI-Numerical_Interval_Input_Data"),c,{offsetStyle:"center"}),c.fireEvent(BI.NumberInterval.EVENT_ERROR)})},_setValidEvent:function(a){var b=this,c=this.constants;a.on(BI.Editor.EVENT_VALID,function(){switch(b._checkValidation()){case c.numberError:BI.Bubbles.show(c.numberError,BI.i18nText("BI-Numerical_Interval_Number_Value"),b,{offsetStyle:"center"}),b.fireEvent(BI.NumberInterval.EVENT_ERROR);break;case c.signalError:BI.Bubbles.show(c.signalError,BI.i18nText("BI-Numerical_Interval_Signal_Value"),b,{offsetStyle:"center"}),b.fireEvent(BI.NumberInterval.EVENT_ERROR);break;default:b.fireEvent(BI.NumberInterval.EVENT_VALID)}})},_setEditorValueChangedEvent:function(a){var b=this,c=this.constants;a.on(BI.Editor.EVENT_CHANGE,function(){switch(b._checkValidation()){case c.typeError:BI.Bubbles.show(c.typeError,BI.i18nText("BI-Numerical_Interval_Input_Data"),b,{offsetStyle:"center"});break;case c.numberError:BI.Bubbles.show(c.numberError,BI.i18nText("BI-Numerical_Interval_Number_Value"),b,{offsetStyle:"center"});break;case c.signalError:BI.Bubbles.show(c.signalError,BI.i18nText("BI-Numerical_Interval_Signal_Value"),b,{offsetStyle:"center"})}b.fireEvent(BI.NumberInterval.EVENT_CHANGE)})},_setComboValueChangedEvent:function(a){var b=this,c=this.constants;a.on(BI.IconCombo.EVENT_CHANGE,function(){switch(b._checkValidation()){case c.typeError:b._setTitle(BI.i18nText("BI-Numerical_Interval_Input_Data")),b.fireEvent(BI.NumberInterval.EVENT_ERROR);break;case c.numberError:b._setTitle(BI.i18nText("BI-Numerical_Interval_Number_Value")),b.fireEvent(BI.NumberInterval.EVENT_ERROR);break;case c.signalError:b._setTitle(BI.i18nText("BI-Numerical_Interval_Signal_Value")),b.fireEvent(BI.NumberInterval.EVENT_ERROR);break;default:b.fireEvent(BI.NumberInterval.EVENT_CHANGE),b.fireEvent(BI.NumberInterval.EVENT_VALID)}})},isStateValid:function(){return"valid"===this.options.validation},setMinEnable:function(a){this.smallEditor.setEnable(a)},setCloseMinEnable:function(a){this.smallCombo.setEnable(a)},setMaxEnable:function(a){this.bigEditor.setEnable(a)},setCloseMaxEnable:function(a){this.bigCombo.setEnable(a)},showNumTip:function(){this.smallTip.setVisible(!0),this.bigTip.setVisible(!0)},hideNumTip:function(){this.smallTip.setVisible(!1),this.bigTip.setVisible(!1)},setNumTip:function(a){this.smallTip.setText(a),this.bigTip.setText(a)},getNumTip:function(){return this.smallTip.getText()},setValue:function(a){a=a||{};var b,c=this;(BI.isNumeric(a.min)||BI.isEmptyString(a.min))&&c.smallEditor.setValue(a.min),BI.isNotNull(a.min)||c.smallEditor.setValue(""),(BI.isNumeric(a.max)||BI.isEmptyString(a.max))&&c.bigEditor.setValue(a.max),BI.isNotNull(a.max)||c.bigEditor.setValue(""),BI.isNull(a.closemin)||(b=a.closemin===!0?1:0,c.smallCombo.setValue(b)),BI.isNull(a.closemax)||(b=a.closemax===!0?1:0,c.bigCombo.setValue(b))},getValue:function(){var a=this,b={},c=a.smallCombo.getValue(),d=a.bigCombo.getValue();return b.min=a.smallEditor.getValue(),b.max=a.bigEditor.getValue(),0===c[0]?b.closemin=!1:b.closemin=!0,0===d[0]?b.closemax=!1:b.closemax=!0,b}}),BI.NumberInterval.EVENT_CHANGE="EVENT_CHANGE",BI.NumberInterval.EVENT_VALID="EVENT_VALID",BI.NumberInterval.EVENT_ERROR="EVENT_ERROR",BI.shortcut("bi.number_interval",BI.NumberInterval),BI.PageTableCell=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.PageTableCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-page-table-cell",text:"",title:""})},_init:function(){BI.PageTableCell.superclass._init.apply(this,arguments);BI.createWidget({type:"bi.label",element:this,textAlign:"left",whiteSpace:"nowrap",height:this.options.height,text:this.options.text,title:this.options.title,value:this.options.value,lgap:5,rgap:5});BI.isNotNull(this.options.styles)&&BI.isObject(this.options.styles)&&this.element.css(this.options.styles)}}),BI.shortcut("bi.page_table_cell",BI.PageTableCell),BI.PageTable=BI.inherit(BI.Widget,{_const:{scrollWidth:18,minScrollWidth:100},_defaultConfig:function(){return BI.extend(BI.PageTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-page-table",el:{type:"bi.sequence_table"},pager:{horizontal:{pages:!1,curr:1,hasPrev:BI.emptyFn,hasNext:BI.emptyFn,firstPage:1,lastPage:BI.emptyFn},vertical:{pages:!1,curr:1,hasPrev:BI.emptyFn,hasNext:BI.emptyFn,firstPage:1,lastPage:BI.emptyFn}},itemsCreator:BI.emptyFn,isNeedFreeze:!1,freezeCols:[],isNeedMerge:!1,mergeCols:[],mergeRule:BI.emptyFn,columnSize:[],minColumnSize:[],maxColumnSize:[],headerRowSize:25,rowSize:25,regionColumnSize:[],headerCellStyleGetter:BI.emptyFn,summaryCellStyleGetter:BI.emptyFn,sequenceCellStyleGetter:BI.emptyFn,header:[],items:[],crossHeader:[],crossItems:[]})},_init:function(){BI.PageTable.superclass._init.apply(this,arguments);var a=this,b=this.options;this.hCurr=1,this.vCurr=1,this.table=BI.createWidget(b.el,{type:"bi.sequence_table",width:b.width,height:b.height&&b.height-30,isNeedResize:!0,isResizeAdapt:!1,isNeedFreeze:b.isNeedFreeze,freezeCols:b.freezeCols,isNeedMerge:b.isNeedMerge,mergeCols:b.mergeCols,mergeRule:b.mergeRule,columnSize:b.columnSize,minColumnSize:b.minColumnSize,maxColumnSize:b.maxColumnSize,headerRowSize:b.headerRowSize,rowSize:b.rowSize,regionColumnSize:b.regionColumnSize,headerCellStyleGetter:b.headerCellStyleGetter,summaryCellStyleGetter:b.summaryCellStyleGetter,sequenceCellStyleGetter:b.sequenceCellStyleGetter,header:b.header,items:b.items,crossHeader:b.crossHeader,crossItems:b.crossItems}),this.table.on(BI.Table.EVENT_TABLE_SCROLL,function(){a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,function(){b.regionColumnSize=this.getRegionColumnSize(),b.columnSize=this.getColumnSize(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,function(){b.regionColumnSize=this.getRegionColumnSize(),b.columnSize=this.getColumnSize(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,arguments)}),this.pager=BI.createWidget(b.pager,{type:"bi.direction_pager",height:30}),this.pager.on(BI.Pager.EVENT_CHANGE,function(){var c=this.getVPage&&this.getVPage();BI.isNull(c)&&(c=this.getCurrentPage());var d=this.getHPage&&this.getHPage();b.itemsCreator({vpage:c,hpage:d},function(b,e,f,g){a.table.setVPage?a.table.setVPage(c):a.table.setValue(c),a.table.setHPage&&a.table.setHPage(d),a.populate.apply(a,arguments)})}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.table,left:0,top:0},{el:this.pager,left:0,right:0,bottom:0}]})},setHPage:function(a){this.hCurr=a,this.pager.setHPage&&this.pager.setHPage(a),this.table.setHPage&&this.table.setHPage(a)},setVPage:function(a){this.vCurr=a,this.pager.setVPage&&this.pager.setVPage(a),this.table.setVPage&&this.table.setVPage(a)},getHPage:function(){var a=this.pager.getHPage&&this.pager.getHPage();return BI.isNotNull(a)?a:(a=this.pager.getCurrentPage&&this.pager.getCurrentPage(),BI.isNotNull(a)?a:this.hpage)},getVPage:function(){var a=this.pager.getVPage&&this.pager.getVPage();return BI.isNotNull(a)?a:(a=this.pager.getCurrentPage&&this.pager.getCurrentPage(),BI.isNotNull(a)?a:this.vpage)},setWidth:function(a){BI.PageTable.superclass.setWidth.apply(this,arguments),this.table.setWidth(a)},setHeight:function(a){BI.PageTable.superclass.setHeight.apply(this,arguments);var b=!1;this.pager.alwaysShowPager?b=!0:this.pager.hasHNext&&this.pager.hasHNext()?b=!0:this.pager.hasHPrev&&this.pager.hasHPrev()?b=!0:this.pager.hasVNext&&this.pager.hasVNext()?b=!0:this.pager.hasVPrev&&this.pager.hasVPrev()?b=!0:this.pager.hasNext&&this.pager.hasNext()?b=!0:this.pager.hasPrev&&this.pager.hasPrev()&&(b=!0),this.table.setHeight(a-(b?30:0))},setColumnSize:function(a){this.options.columnSize=a,this.table.setColumnSize(a)},getColumnSize:function(){return this.table.getColumnSize()},setRegionColumnSize:function(a){this.options.columnSize=a,this.table.setRegionColumnSize(a)},getRegionColumnSize:function(){return this.table.getRegionColumnSize()},getVerticalScroll:function(){return this.table.getVerticalScroll()},setLeftHorizontalScroll:function(a){this.table.setLeftHorizontalScroll(a)},setRightHorizontalScroll:function(a){this.table.setRightHorizontalScroll(a)},setVerticalScroll:function(a){this.table.setVerticalScroll(a)},restore:function(){this.table.restore()},attr:function(){BI.PageTable.superclass.attr.apply(this,arguments),this.table.attr.apply(this.table,arguments)},populate:function(){this.pager.populate(),this.table.populate.apply(this.table,arguments)},destroy:function(){this.table.destroy(),this.pager&&this.pager.destroy(),BI.PageTable.superclass.destroy.apply(this,arguments)}}),BI.shortcut("bi.page_table",BI.PageTable),BI.PathChooser=BI.inherit(BI.Widget,{_const:{lineColor:"#d4dadd",selectLineColor:"#3f8ce8"},_defaultConfig:function(){return BI.extend(BI.PathChooser.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-path-chooser",items:[]})},_init:function(){BI.PathChooser.superclass._init.apply(this,arguments),this.populate(this.options.items)},_createRegions:function(a){var b=this;this.regions=BI.createWidgets(BI.map(a,function(a,c){return{type:"bi.path_region",title:b.texts[c]||c}})),this.regionMap={},BI.each(a,function(a,c){b.regionMap[c]=a}),this.container=BI.createWidget({type:"bi.horizontal",verticalAlign:"top",scrollx:!1,scrolly:!1,hgap:10,items:this.regions}),BI.createWidget({type:"bi.vertical_adapt",element:this,scrollable:!0,hgap:10,items:[this.container]})},getRegionIndexById:function(a){var b=this.cache[a],c=b.get("region");return this.regionMap[c]},_drawPath:function(a,b,c){var d=this,e=[];e=BI.contains(this.start,a)?this.start:[a],BI.each(e,function(a,b){BI.each(d.radios[b],function(a,b){b.setSelected(!1)}),BI.each(d.lines[b],function(a,b){b.attr("stroke",d._const.lineColor)}),BI.each(d.regionIndexes[b],function(a,b){d.regions[b].reset()})}),BI.each(this.routes[a][c],function(a,e){var f=d.getRegionIndexById(e);d.regions[f].setSelect(b+c,e)});for(var f=BI.last(this.routes[a][c]);f&&this.routes[f]&&1===this.routes[f].length;)BI.each(this.routes[f][0],function(a,b){var c=d.getRegionIndexById(b);d.regions[c].setSelect(0,b)}),this.lines[f][0].attr("stroke",d._const.selectLineColor).toFront(),f=BI.last(this.routes[f][0]);this.lines[a][c].attr("stroke",d._const.selectLineColor).toFront(),this.radios[a]&&this.radios[a][c]&&this.radios[a][c].setSelected(!0)},_drawRadio:function(a,b,c,d,e){var f=this,g=BI.createWidget({type:"bi.radio",cls:"path-chooser-radio",selected:b+c===0,start:a,index:c});g.on(BI.Radio.EVENT_CHANGE,function(){f._drawPath(a,b,c),f.fireEvent(BI.PathChooser.EVENT_CHANGE,a,c)}),this.radios[a]||(this.radios[a]=[]),this.radios[a].push(g),BI.createWidget({type:"bi.absolute",element:this.container,items:[{el:g,left:d-6.5,top:e-6.5}]})},_drawLine:function(a,b){var c=this;this.lines[a]||(this.lines[a]=[]),this.pathes[a]||(this.pathes[a]=[]);var d=this.getRegionIndexById(a),e=this.regions[d].getIndexByValue(a);BI.each(b,function(f,g){c.pathes[a][f]=[];var h=f+e,i="",j=47.5+29*h,k=50+100*d,l=k,m=j,n=j,o=c.getRegionIndexById(BI.last(g)),p=c.regions[o].getIndexByValue(BI.last(g)),q=50+100*o;if(BI.contains(c.start,a)?(l=k-50,i+="M"+(k-50)+","+j,c.pathes[a][f].push({x:k-50,y:j})):0===h?(l=k+50,i+="M"+k+","+j,c.pathes[a][f].push({x:k,y:j})):(l=k+50,i+="M"+k+",47.5L"+(k+50)+",47.5L"+(k+50)+","+j,c.pathes[a][f].push({x:k,y:47.5}),c.pathes[a][f].push({x:k+50,y:47.5}),c.pathes[a][f].push({x:k+50,y:j})),h>0){var r=29*p+47.5;i+="L"+(q-50)+","+n+"L"+(q-50)+","+r+"L"+q+","+r,c.pathes[a][f].push({x:q-50,y:n}),c.pathes[a][f].push({x:q-50,y:r}),c.pathes[a][f].push({x:q,y:r})}else i+="L"+q+","+n,c.pathes[a][f].push({x:q,y:n});var s=c.svg.path(i).attr({stroke:0===h?c._const.selectLineColor:c._const.lineColor,"stroke-dasharray":"-"});c.lines[a].push(s),b.length>1&&c.lines[a][0].toFront(),BI.contains(c.start,a)&&c.lines[c.regions[0].getValueByIndex(0)][0].toFront(),(b.length>1||BI.contains(c.start,a))&&c._drawRadio(a,e,f,l,m)})},_drawLines:function(a){var b=this;this.lines={},this.pathes={},this.radios={},this.regionIndexes={},BI.each(a,function(a,c){b.regionIndexes[a]||(b.regionIndexes[a]=[]),BI.each(c,function(c,d){BI.each(d,function(c,d){var e=b.getRegionIndexById(d);BI.contains(b.regionIndexes[a],e)||b.regionIndexes[a].push(e)})})}),BI.each(a,function(a,c){b._drawLine(a,c)})},_pushNodes:function(a){for(var b=this,c=[],d=0;d<a.length;d++){var e=a[d],f=b.getRegionIndexById(e);c.push(f);var g=b.regions[f];if(d===a.length-1){g.hasItem(e)||g.addItem(e,b.texts[e]);break}(d>0||BI.contains(b.start,e))&&g.addItem(e,b.texts[e])}for(var d=BI.first(c);d<BI.last(c);d++)BI.contains(c,d)||b.regions[d].addItem("")},_createNodes:function(){var a=this,b=this.options;this.cache={},this.texts={},this.start=[],this.end=[],BI.each(b.items,function(b,c){a.start.push(BI.first(c).value),a.end.push(BI.last(c).value)}),this.start=BI.uniq(this.start),this.end=BI.uniq(this.end);var c=[],d=new BI.Tree,e={},f=0;BI.each(b.items,function(b,c){BI.each(c,function(b,g){BI.has(e,g.value)||(e[g.value]=0),e[g.value]++,f=Math.max(f,e[g.value]);var h={};b>0&&(h=c[b-1]);var i=a.cache[h.value||""],j=a.cache[g.value]||new BI.Node(g.value);j.set(g),a.cache[g.value]=j,a.texts[g.value]=g.text,a.texts[g.region]=g.regionText,i=BI.isNull(i)?d.getRoot():i,i.getChildIndex(g.value)===-1&&d.addNode(i,j)})}),d.traverse(function(a){BI.each(a.getChildren(),function(b,d){
if(BI.contains(c,d.get("region"))){var e=BI.indexOf(c,a.get("region")),f=BI.indexOf(c,d.get("region"));if(e>f){for(var g=c[f],h=f;h<e;h++)c[h]=c[h+1];c[e]=g}}else c.push(d.get("region"))})}),this._createRegions(c),BI.each(e,function(a,b){b<f&&delete e[a]});for(var g=[],h=d.getRoot();h&&1===h.getChildrenLength();)BI.has(e,h.getChildren()[0].id)?(delete e[h.getChildren()[0].id],h=h.getChildren()[0]):h=null;d.traverse(function(a){BI.has(e,a.id)&&(g.push(a.id),delete e[a.id])});for(var i,j,k={},l=0,m=g.length;l<m+1;l++)0===m?(i=[],BI.each(this.start,function(a,b){i.push(d.search(b))}),j=[],BI.each(this.end,function(a,b){j.push(d.search(b))})):l===m?(i=j,j=[],BI.each(this.end,function(a,b){j.push(d.search(b))})):0===l?(i=[],BI.each(this.start,function(a,b){i.push(d.search(b))}),j=[d.search(g[l])]):(i=[d.search(j[0]||d.getRoot(),g[l-1])],j=[d.search(i[0],g[l])]),BI.each(i,function(b,c){d._recursion(c,[c.id],function(b,d){if(BI.contains(j,b)&&(k[c.id]||(k[c.id]=[]),k[c.id].push(d),a._pushNodes(d),j.length<=1))return!0})});this.routes=k,this._drawLines(k)},_unselectAllPath:function(){var a=this;BI.each(this.radios,function(a,b){BI.each(b,function(a,b){b.setSelected(!1)})}),BI.each(this.lines,function(b,c){BI.each(c,function(b,c){c.attr("stroke",a._const.lineColor)})}),BI.each(this.regions,function(a,b){b.reset()})},populate:function(a){this.options.items=a||[];this.empty(),this.options.items.length<=0||(this.svg=BI.createWidget({type:"bi.svg"}),this._createNodes(),BI.createWidget({type:"bi.absolute",element:this.container,items:[{el:this.svg,top:0,left:0,right:0,bottom:0}]}))},setValue:function(a){this._unselectAllPath();var b=BI.keys(this.routes),c=this,d=[],e=[];BI.each(a,function(a,c){BI.contains(b,c)&&e.length>0&&(e.push(c),d.push(e),e=[]),e.push(c)}),e.length>0&&d.push(e),BI.each(d,function(a,b){var d=b[0],e=BI.findIndex(c.routes[d],function(a,c){if(BI.isEqual(b,c))return!0});if(e>=0){var f=c.getRegionIndexById(d),g=c.regions[f].getIndexByValue(d);c._drawPath(d,g,e)}})},getValue:function(){var a=[];return BI.each(this.regions,function(b,c){var d=c.getValue();BI.isKey(d)&&a.push(d)}),a}}),BI.PathChooser.EVENT_CHANGE="PathChooser.EVENT_CHANGE",BI.shortcut("bi.path_chooser",BI.PathChooser),BI.PathRegion=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.PathRegion.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-path-region bi-background",width:80,title:""})},_init:function(){BI.PathRegion.superclass._init.apply(this,arguments);var a=this.options;this.zIndex=100;var b=BI.createWidget({type:"bi.label",text:a.title,title:a.title,height:30});b.element.css("zIndex",this.zIndex--),this.items=[],this.vertical=BI.createWidget({type:"bi.vertical",element:this,bgap:5,hgap:10,items:[b]})},hasItem:function(a){return BI.any(this.items,function(b,c){return a===c.getValue()})},addItem:function(a,b){if(BI.isKey(a))var c=BI.createWidget({type:"bi.label",cls:"path-region-label bi-card bi-border bi-list-item-select",text:b,value:a,title:b||a,height:24});else var c=BI.createWidget({type:"bi.layout",height:24});c.element.css("zIndex",this.zIndex--),this.items.push(c),this.vertical.addItem(c),1===this.items.length&&this.setSelect(0,a)},reset:function(){BI.each(this.items,function(a,b){b.element.removeClass("active")})},setSelect:function(a,b){if(this.reset(),!(this.items.length<=0))return 1===this.items.length?void this.items[0].element.addClass("active"):void(this.items[a].attr("value")===b&&this.items[a].element.addClass("active"))},setValue:function(a){this.setSelect(this.getIndexByValue(a),a)},getValueByIndex:function(a){return this.items[a].attr("value")},getIndexByValue:function(a){return BI.findIndex(this.items,function(b,c){return c.attr("value")===a})},getValue:function(){var a;return BI.any(this.items,function(b,c){if(c.element.hasClass("active"))return a=c.getValue(),!0}),a}}),BI.PathRegion.EVENT_CHANGE="PathRegion.EVENT_CHANGE",BI.shortcut("bi.path_region",BI.PathRegion),BI.PreviewTableCell=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-preview-table-cell",text:""})},_init:function(){BI.PreviewTableCell.superclass._init.apply(this,arguments);this.options;BI.createWidget({type:"bi.label",element:this,textAlign:"left",whiteSpace:"normal",height:this.options.height,text:this.options.text,value:this.options.value})}}),BI.shortcut("bi.preview_table_cell",BI.PreviewTableCell),BI.PreviewTableHeaderCell=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-preview-table-header-cell",text:""})},_init:function(){BI.PreviewTableHeaderCell.superclass._init.apply(this,arguments);this.options;BI.createWidget({type:"bi.label",element:this,textAlign:"left",whiteSpace:"normal",height:this.options.height,text:this.options.text,value:this.options.value})}}),BI.shortcut("bi.preview_table_header_cell",BI.PreviewTableHeaderCell),BI.PreviewTable=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-preview-table",isNeedFreeze:!1,freezeCols:[],rowSize:null,columnSize:[],headerRowSize:30,header:[],items:[]})},_init:function(){BI.PreviewTable.superclass._init.apply(this,arguments);var a=this,b=this.options;this.table=BI.createWidget({type:"bi.table_view",element:this,isNeedResize:!1,isResizeAdapt:!1,isNeedFreeze:b.isNeedFreeze,freezeCols:b.freezeCols,rowSize:b.rowSize,columnSize:b.columnSize,headerRowSize:b.headerRowSize,header:BI.map(b.header,function(a,b){return BI.map(b,function(a,b){return BI.extend({type:"bi.preview_table_header_cell"},b)})}),items:BI.map(b.items,function(a,b){return BI.map(b,function(a,b){return BI.extend({type:"bi.preview_table_cell"},b)})})}),this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT,function(){a._adjustColumns(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT,arguments)}),this.table.on(BI.Table.EVENT_TABLE_RESIZE,function(){a._adjustColumns()})},_hasAdaptCol:function(a){return BI.any(a,function(a,b){return""===b})},_isPercentage:function(a){return a[0]<=1},_adjustColumns:function(){var a=this.options;if(a.isNeedFreeze===!0){if(this._isPercentage(a.columnSize)){if(this._hasAdaptCol(a.columnSize)){var b=[],c=0;BI.each(a.columnSize,function(a,d){""===d?b.push(a):c+=d}),c=1-c;var d=c/b.length;BI.each(b,function(b,c){a.columnSize[c]=d})}var e=0!==BI.first(a.freezeCols),f=[],g=[];BI.each(a.columnSize,function(b,c){a.freezeCols.contains(b)?f.push(c):g.push(c)});var h=BI.sum(f),i=BI.sum(g);BI.each(f,function(a,b){f[a]=b/h}),BI.each(g,function(a,b){g[a]=b/i}),this.table.setRegionColumnSize(e?["fill",h]:[h,"fill"]),this.table.setColumnSize(e?g.concat(f):f.concat(g))}}else(this._hasAdaptCol(a.columnSize)||this._isPercentage(a.columnSize))&&this.table.setRegionColumnSize(["100%"])},setColumnSize:function(a){return this.table.setColumnSize(a)},getColumnSize:function(){return this.table.getColumnSize()},getCalculateColumnSize:function(){return this.table.getCalculateColumnSize()},setHeaderColumnSize:function(a){return this.table.setHeaderColumnSize(a)},setRegionColumnSize:function(a){return this.table.setRegionColumnSize(a)},getRegionColumnSize:function(){return this.table.getRegionColumnSize()},getCalculateRegionColumnSize:function(){return this.table.getCalculateRegionColumnSize()},getCalculateRegionRowSize:function(){return this.table.getCalculateRegionRowSize()},getClientRegionColumnSize:function(){return this.table.getClientRegionColumnSize()},getScrollRegionColumnSize:function(){return this.table.getScrollRegionColumnSize()},getScrollRegionRowSize:function(){return this.table.getScrollRegionRowSize()},hasVerticalScroll:function(){return this.table.hasVerticalScroll()},setVerticalScroll:function(a){return this.table.setVerticalScroll(a)},setLeftHorizontalScroll:function(a){return this.table.setLeftHorizontalScroll(a)},setRightHorizontalScroll:function(a){return this.table.setRightHorizontalScroll(a)},getVerticalScroll:function(){return this.table.getVerticalScroll()},getLeftHorizontalScroll:function(){return this.table.getLeftHorizontalScroll()},getRightHorizontalScroll:function(){return this.table.getRightHorizontalScroll()},getColumns:function(){return this.table.getColumns()},populate:function(a,b){this.table.populate(a,b)}}),BI.PreviewTable.EVENT_CHANGE="PreviewTable.EVENT_CHANGE",BI.shortcut("bi.preview_table",BI.PreviewTable),BI.QuarterCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.QuarterCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-quarter-combo",behaviors:{},height:25})},_init:function(){BI.QuarterCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.storeValue="",this.trigger=BI.createWidget({type:"bi.quarter_trigger"}),this.trigger.on(BI.QuarterTrigger.EVENT_FOCUS,function(){a.storeValue=this.getKey()}),this.trigger.on(BI.QuarterTrigger.EVENT_START,function(){a.combo.isViewVisible()&&a.combo.hideView()}),this.trigger.on(BI.QuarterTrigger.EVENT_STOP,function(){a.combo.isViewVisible()||a.combo.showView()}),this.trigger.on(BI.QuarterTrigger.EVENT_CONFIRM,function(){a.combo.isViewVisible()||(this.getKey()&&this.getKey()!==a.storeValue?a.setValue(this.getKey()):this.getKey()||a.setValue(),a.fireEvent(BI.QuarterCombo.EVENT_CONFIRM))}),this.popup=BI.createWidget({type:"bi.quarter_popup",behaviors:b.behaviors}),this.popup.on(BI.QuarterPopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.combo.hideView(),a.fireEvent(BI.QuarterCombo.EVENT_CONFIRM)}),this.combo=BI.createWidget({type:"bi.combo",element:this,isNeedAdjustHeight:!1,isNeedAdjustWidth:!1,el:this.trigger,popup:{minWidth:85,el:this.popup}}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){a.fireEvent(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW)})},setValue:function(a){this.trigger.setValue(a),this.popup.setValue(a)},getValue:function(){return this.popup.getValue()||""}}),BI.QuarterCombo.EVENT_CONFIRM="EVENT_CONFIRM",BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.shortcut("bi.quarter_combo",BI.QuarterCombo),BI.QuarterPopup=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.QuarterPopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-quarter-popup",behaviors:{}})},_init:function(){BI.QuarterPopup.superclass._init.apply(this,arguments);var a=this,b=this.options,c=[{text:Date._QN[1],value:1},{text:Date._QN[2],value:2},{text:Date._QN[3],value:3},{text:Date._QN[4],value:4}];c=BI.map(c,function(a,b){return BI.extend(b,{type:"bi.text_item",cls:"bi-list-item-active",textAlign:"left",whiteSpace:"nowrap",once:!1,forceSelected:!0,height:25})}),this.quarter=BI.createWidget({type:"bi.button_group",element:this,behaviors:b.behaviors,items:BI.createItems(c,{}),layouts:[{type:"bi.vertical"}]}),this.quarter.on(BI.Controller.EVENT_CHANGE,function(b){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.MonthPopup.EVENT_CHANGE)})},getValue:function(){return this.quarter.getValue()[0]},setValue:function(a){this.quarter.setValue([a])}}),BI.QuarterPopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.quarter_popup",BI.QuarterPopup),BI.QuarterTrigger=BI.inherit(BI.Trigger,{_const:{hgap:4,vgap:2,textWidth:40,errorText:BI.i18nText("BI-Quarter_Trigger_Error_Text")},_defaultConfig:function(){return BI.extend(BI.QuarterTrigger.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-quarter-trigger bi-border",height:24})},_init:function(){BI.QuarterTrigger.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._const;this.editor=BI.createWidget({type:"bi.sign_editor",height:b.height,validationChecker:function(a){return""===a||BI.isPositiveInteger(a)&&a>=1&&a<=4},quitChecker:function(a){return!1},hgap:c.hgap,vgap:c.vgap,allowBlank:!0,errorText:c.errorText}),this.editor.on(BI.SignEditor.EVENT_FOCUS,function(){a.fireEvent(BI.QuarterTrigger.EVENT_FOCUS)}),this.editor.on(BI.SignEditor.EVENT_CHANGE,function(){a.fireEvent(BI.QuarterTrigger.EVENT_CHANGE)}),this.editor.on(BI.SignEditor.EVENT_CONFIRM,function(){var b=a.editor.getValue();BI.isNotNull(b)&&(a.editor.setValue(b),a.editor.setTitle(b)),a.fireEvent(BI.QuarterTrigger.EVENT_CONFIRM)}),this.editor.on(BI.SignEditor.EVENT_SPACE,function(){a.editor.isValid()&&a.editor.blur()}),this.editor.on(BI.SignEditor.EVENT_START,function(){a.fireEvent(BI.QuarterTrigger.EVENT_START)}),this.editor.on(BI.SignEditor.EVENT_STOP,function(){a.fireEvent(BI.QuarterTrigger.EVENT_STOP)}),BI.createWidget({element:this,type:"bi.htape",items:[{el:this.editor},{el:{type:"bi.text_button",baseCls:"bi-trigger-quarter-text",text:BI.i18nText("BI-Multi_Date_Quarter"),width:c.textWidth},width:c.textWidth},{el:{type:"bi.trigger_icon_button",width:b.height},width:b.height}]})},setValue:function(a){a=a||"",this.editor.setState(a),this.editor.setValue(a),this.editor.setTitle(a)},getKey:function(){return this.editor.getValue()}}),BI.QuarterTrigger.EVENT_FOCUS="EVENT_FOCUS",BI.QuarterTrigger.EVENT_CHANGE="EVENT_CHANGE",BI.QuarterTrigger.EVENT_START="EVENT_START",BI.QuarterTrigger.EVENT_STOP="EVENT_STOP",BI.QuarterTrigger.EVENT_CONFIRM="EVENT_CONFIRM",BI.shortcut("bi.quarter_trigger",BI.QuarterTrigger),BI.RelationViewItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.RelationViewItem.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-relation-view-item bi-list-item-active",height:25,hoverIn:BI.emptyFn,hoverOut:BI.emptyFn})},_init:function(){BI.RelationViewItem.superclass._init.apply(this,arguments);var a=this.options;this.element.hover(a.hoverIn,a.hoverOut);var b=[];a.isPrimary&&b.push({type:"bi.icon",width:16,height:16,title:BI.i18nText("BI-Primary_Key")}),b.push({type:"bi.label",text:a.text,value:a.value,height:a.height,textAlign:"left",width:a.isPrimary?70:90,lgap:a.isPrimary?0:10}),BI.createWidget({type:"bi.vertical_adapt",element:this,items:b,cls:"primary-key-font",lgap:5})},enableHover:function(a){BI.RelationViewRegion.superclass.enableHover.apply(this,[{container:"body"}])},setSelected:function(a){this.element[a?"addClass":"removeClass"]("active")}}),BI.shortcut("bi.relation_view_item",BI.RelationViewItem),BI.RelationView=BI.inherit(BI.Widget,{_const:{lineColor:"#c4c6c6",selectLineColor:"#009de3"},_defaultConfig:function(){return BI.extend(BI.RelationView.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-relation-view",items:[]})},_init:function(){BI.RelationView.superclass._init.apply(this,arguments),this.populate(this.options.items)},_calculateWidths:function(){var a=[];return BI.each(this.views,function(b,c){BI.each(c,function(b,c){a[b]||(a[b]=BI.MIN),a[b]=Math.max(a[b],c.getWidth())})}),a},_calculateHeights:function(){var a=BI.makeArray(BI.size(this.views),BI.MIN);return BI.each(this.views,function(b,c){BI.each(c,function(c,d){a[b]=Math.max(a[b],d.getHeight())})}),a},_hoverIn:function(a){var b=this,c=this._const;BI.each(this.relations,function(d,e){BI.each(e,function(e,f){f[0].primary.value!==a&&f[0].foreign.value!==a||(b.lines[d][e].attr("stroke",c.selectLineColor).toFront(),b.storeViews[d].setValue(f[0].primary.value),b.storeViews[e].setValue(f[0].foreign.value))})})},_hoverOut:function(a){var b=this,c=this._const;BI.each(this.relations,function(d,e){BI.each(e,function(e,f){f[0].primary.value!==a&&f[0].foreign.value!==a||(b.lines[d][e].attr("stroke",c.lineColor),b.storeViews[d].setValue([]),b.storeViews[e].setValue([]))})})},previewRelationTables:function(a,b){return b?(BI.each(this.storeViews,function(b,c){a.contains(b)?c.setPreviewSelected(!0):c.toggleRegion(!1)}),void BI.each(this.lines,function(b,c){BI.each(c,function(c,d){a.contains(b)&&a.contains(c)||d.hide()})})):(BI.each(this.storeViews,function(a,b){b.toggleRegion(!0),b.setPreviewSelected(!1)}),void BI.each(this.lines,function(a,b){BI.each(b,function(a,b){b.show()})}))},populate:function(a){var b=this,c=this.options,d=this._const;c.items=a||[],this.empty(),this.svg=BI.createWidget({type:"bi.svg"});var e=this.regions={},f=this.relations={};BI.each(a,function(a,b){var c=b.primary.region,d=b.foreign&&b.foreign.region;c&&!f[c]&&(f[c]={}),c&&d&&!f[c][d]&&(f[c][d]=[]),c&&!e[c]&&(e[c]=[]),d&&!e[d]&&(e[d]=[]),c&&!BI.deepContains(e[c],b.primary)&&e[c].push(b.primary),d&&!BI.deepContains(e[d],b.foreign)&&e[d].push(b.foreign),c&&d&&f[c][d].push(b)});for(var g=[],h=BI.clone(e),i={};!BI.isEmpty(h);){var j=BI.clone(h);BI.each(c.items,function(a,b){i[b.primary.region]||delete j[b.foreign&&b.foreign.region]}),g.push(BI.keys(j)),BI.extend(i,j),BI.each(j,function(a,b){delete h[a]})}var k=this.views={},l=this.storeViews={},m=this.indexes={},n=[];BI.each(g,function(a,c){k[a]||(k[a]={});var d=[];BI.each(c,function(c,f){var g=e[f];k[a][c]=l[f]=BI.createWidget({type:"bi.relation_view_region_container",value:f,header:g[0].regionTitle,text:g.length>0?g[0].regionText:"",handler:g.length>0?g[0].regionHandler:BI.emptyFn,items:g,belongPackage:!(g.length>0)||g[0].belongPackage}),BI.isNotNull(g[0])&&BI.isNotNull(g[0].keyword)&&k[a][c].doRedMark(g[0].keyword),k[a][c].on(BI.RelationViewRegionContainer.EVENT_HOVER_IN,function(a){b._hoverIn(a)}),k[a][c].on(BI.RelationViewRegionContainer.EVENT_HOVER_OUT,function(a){b._hoverOut(a)}),k[a][c].on(BI.RelationViewRegionContainer.EVENT_PREVIEW,function(a){b.fireEvent(BI.RelationView.EVENT_PREVIEW,f,a)}),m[f]={i:a,j:c},d.push(k[a][c])}),n.push({type:"bi.horizontal",items:d})});var o=this._calculateHeights(),p=this._calculateWidths(),q=[0],r=[0];BI.each(o,function(a,b){0!==a&&(r[a]=r[a-1]+o[a-1])}),BI.each(p,function(a,b){0!==a&&(q[a]=q[a-1]+p[a-1])});var s=this.lines={};BI.each(f,function(a,c){BI.each(c,function(c,e){var f=m[a],g=m[c],h=0,i=1,j=2,n=3,t=j,u=h,v=function(a,b,c,d){var e,f=q[b]+(p[b]-k[a][b].getWidth())/2,g=r[a]+(o[a]-k[a][b].getHeight())/2,l="";switch(c){case h:e=d?k[a][b].getTopRightPosition():k[a][b].getTopLeftPosition(),f+=e.x,g+=e.y,l="M"+f+","+g+"L"+f+","+(g-10),g-=10;break;case i:e=k[a][b].getRightPosition(),f+=e.x,g+=e.y,l="M"+f+","+g+"L"+(f+10)+","+g,f+=10;break;case j:e=k[a][b].getBottomPosition(),f+=e.x,g+=e.y,l="M"+f+","+g+"L"+f+","+(g+10),g+=10;break;case n:e=k[a][b].getLeftPosition(),f+=e.x,g+=e.y,l="M"+f+","+g+"L"+(f-10)+","+g,f-=10}return{x:f,y:g,path:l}},w="",x=v(f.i,f.j,t),y=v(g.i,g.j,u,!0);w+=x.path+y.path,s[a]||(s[a]={}),w+="M"+x.x+","+x.y+"L"+y.x+","+y.y;var z=s[a][c]=b.svg.path(w).attr({stroke:d.lineColor,"stroke-width":"2"}).hover(function(){z.attr("stroke",d.selectLineColor).toFront(),l[a].setValue(e[0].primary.value),l[c].setValue(e[0].foreign.value)},function(){z.attr("stroke",d.lineColor),l[a].setValue([]),l[c].setValue([])})})});var t=BI.createWidget();BI.createWidget({type:"bi.vertical",element:t,items:n}),BI.createWidget({type:"bi.absolute",element:t,items:[{el:this.svg,left:0,right:0,top:0,bottom:0}]}),BI.createWidget({type:"bi.center_adapt",scrollable:!0,element:this,items:[t]})}}),BI.RelationView.EVENT_CHANGE="RelationView.EVENT_CHANGE",BI.RelationView.EVENT_PREVIEW="EVENT_PREVIEW",BI.shortcut("bi.relation_view",BI.RelationView),BI.RelationViewRegionContainer=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.RelationViewRegionContainer.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-relation-view-region-container",width:150})},_init:function(){BI.RelationViewRegionContainer.superclass._init.apply(this,arguments);var a=this,b=this.options;this.region=BI.createWidget({type:"bi.relation_view_region",value:b.value,header:b.header,text:b.text,handler:b.handler,items:b.items,belongPackage:b.belongPackage}),this.region.on(BI.RelationViewRegion.EVENT_PREVIEW,function(b){a.fireEvent(BI.RelationViewRegionContainer.EVENT_PREVIEW,b)}),this.region.on(BI.RelationViewRegion.EVENT_HOVER_IN,function(b){a.fireEvent(BI.RelationViewRegionContainer.EVENT_HOVER_IN,b)}),this.region.on(BI.RelationViewRegion.EVENT_HOVER_OUT,function(b){a.fireEvent(BI.RelationViewRegionContainer.EVENT_HOVER_OUT,b)}),BI.createWidget({type:"bi.vertical",element:this,items:[this.region],width:this.region.getWidth(),height:this.region.getHeight()})},doRedMark:function(){this.region.doRedMark.apply(this.region,arguments)},unRedMark:function(){this.region.unRedMark.apply(this.region,arguments)},getWidth:function(){return this.region.getWidth()},getHeight:function(){return this.region.getHeight()},getTopLeftPosition:function(){return this.region.getTopLeftPosition()},getTopRightPosition:function(){return this.region.getTopRightPosition()},getBottomPosition:function(){return this.region.getBottomPosition()},getLeftPosition:function(){return this.region.getLeftPosition()},getRightPosition:function(){return this.region.getRightPosition()},setValue:function(a){this.region.setValue(a)},toggleRegion:function(a){a===!0?this.region.element.fadeIn():this.region.element.fadeOut()},setPreviewSelected:function(a){this.region.setPreviewSelected(a)}}),BI.RelationViewRegionContainer.EVENT_HOVER_IN="RelationViewRegion.EVENT_HOVER_IN",BI.RelationViewRegionContainer.EVENT_HOVER_OUT="RelationViewRegion.EVENT_HOVER_OUT",BI.RelationViewRegionContainer.EVENT_PREVIEW="RelationViewRegion.EVENT_PREVIEW",BI.shortcut("bi.relation_view_region_container",BI.RelationViewRegionContainer),BI.RelationViewRegion=BI.inherit(BI.BasicButton,{_defaultConfig:function(){return BI.extend(BI.RelationViewRegion.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-relation-view-region cursor-pointer",width:150,text:"",value:"",header:"",items:[],belongPackage:!0})},_init:function(){BI.RelationViewRegion.superclass._init.apply(this,arguments);var a=this,b=this.options;this.preview=BI.createWidget({type:"bi.icon_button",cls:"relation-table-preview-font",width:25,height:25,stopPropagation:!0}),this.preview.on(BI.IconButton.EVENT_CHANGE,function(){a.fireEvent(BI.RelationViewRegion.EVENT_PREVIEW,this.isSelected())}),this.title=BI.createWidget({type:"bi.label",height:25,width:70,text:b.text,value:b.value,textAlign:"left"}),BI.isKey(b.header)&&this.title.setTitle(b.header,{container:"body"}),this.button_group=BI.createWidget({type:"bi.button_group",items:this._createItems(b.items),layouts:[{type:"bi.vertical"}]}),BI.createWidget({type:"bi.vertical",element:this,items:[{type:"bi.vertical",cls:"relation-view-region-container bi-card bi-border "+(b.belongPackage?"":"other-package"),items:[{type:"bi.vertical_adapt",cls:"relation-view-region-title bi-border-bottom",items:[this.preview,this.title]},this.button_group]}],hgap:25,vgap:20})},_createItems:function(a){var b=this;return BI.map(a,function(a,c){return BI.extend(c,{type:"bi.relation_view_item",hoverIn:function(){b.setValue(c.value),b.fireEvent(BI.RelationViewRegion.EVENT_HOVER_IN,c.value)},hoverOut:function(){b.setValue([]),b.fireEvent(BI.RelationViewRegion.EVENT_HOVER_OUT,c.value)}})})},doRedMark:function(){this.title.doRedMark.apply(this.title,arguments)},unRedMark:function(){this.title.unRedMark.apply(this.title,arguments)},getWidth:function(){return this.options.width},getHeight:function(){return 25*this.button_group.getAllButtons().length+25+40+3},getTopLeftPosition:function(){return{x:35,y:20}},getTopRightPosition:function(){return{x:this.getWidth()-25-10,y:20}},getBottomPosition:function(){return{x:35,y:this.getHeight()-20}},getLeftPosition:function(){return{x:25,y:30}},getRightPosition:function(){return{x:this.getWidth()-25,y:30}},setValue:function(a){this.button_group.setValue(a)},setPreviewSelected:function(a){this.preview.setSelected(a)}}),BI.RelationViewRegion.EVENT_HOVER_IN="RelationViewRegion.EVENT_HOVER_IN",BI.RelationViewRegion.EVENT_HOVER_OUT="RelationViewRegion.EVENT_HOVER_OUT",BI.RelationViewRegion.EVENT_PREVIEW="RelationViewRegion.EVENT_PREVIEW",BI.shortcut("bi.relation_view_region",BI.RelationViewRegion),BI.ResponisveTable=BI.inherit(BI.Widget,{_const:{perColumnSize:100},_defaultConfig:function(){return BI.extend(BI.ResponisveTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-responsive-table",isNeedFreeze:!1,freezeCols:[],isNeedMerge:!1,mergeCols:[],mergeRule:function(a,b){return BI.isEqual(a,b)},columnSize:[],headerRowSize:25,footerRowSize:25,rowSize:25,regionColumnSize:!1,header:[],footer:!1,items:[],crossHeader:[],crossItems:[]})},_init:function(){BI.ResponisveTable.superclass._init.apply(this,arguments);var a=this,b=this.options;this.table=BI.createWidget({type:"bi.table_view",element:this,isNeedFreeze:b.isNeedFreeze,freezeCols:b.freezeCols,isNeedMerge:b.isNeedMerge,mergeCols:b.mergeCols,mergeRule:b.mergeRule,columnSize:b.columnSize,headerRowSize:b.headerRowSize,footerRowSize:b.footerRowSize,rowSize:b.rowSize,regionColumnSize:b.regionColumnSize,header:b.header,footer:b.footer,items:b.items,crossHeader:b.crossHeader,crossItems:b.crossItems}),this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT,function(){a._initRegionSize(),a.table.resize(),a._resizeHeader(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT,arguments)}),this.table.on(BI.Table.EVENT_TABLE_RESIZE,function(){a._resizeRegion(),a._resizeHeader(),a.fireEvent(BI.Table.EVENT_TABLE_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_SCROLL,function(){a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.table.on(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE,function(){a.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_REGION_RESIZE,function(){b.isNeedResize===!0&&a._isAdaptiveColumn()&&a._resizeHeader(),a.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,function(){a._resizeHeader(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE,function(){a._resizeBody(),a.fireEvent(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_COLUMN_RESIZE,function(){a.fireEvent(BI.Table.EVENT_TABLE_COLUMN_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,function(){a._resizeRegion(),a._resizeHeader(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,arguments)})},_initRegionSize:function(){var a=this.options;if(a.isNeedFreeze===!0){var b=this.table.getRegionColumnSize(),c=this.table.element.width();if(!b[0]||"fill"===b[0]||b[0]>c||b[1]>c){var d=a.freezeCols;if(0===d.length)this.table.setRegionColumnSize([0,"fill"]);else if(d.length>0&&d.length<a.columnSize.length){var e=c/3;d.length>a.columnSize.length/2&&(e=2*c/3),this.table.setRegionColumnSize([e,"fill"])}else this.table.setRegionColumnSize(["fill",0])}}},_getBlockSize:function(){var a=this.options,b=this.table.getCalculateColumnSize();if(a.isNeedFreeze===!0){var c=[],d=[];BI.each(b,function(b,e){a.freezeCols.contains(b)?c.push(e):d.push(e)});var e=BI.sum(c)+c.length,f=BI.sum(d)+d.length;return{sumLeft:e,sumRight:f,left:c,right:d}}return{size:b,sum:BI.sum(b)+b.length}},_isAdaptiveColumn:function(a){return!(BI.last(a||this.table.getColumnSize())>1.05)},_resizeHeader:function(){var a=this,b=this.options;if(b.isNeedFreeze===!0)if(this._isAdaptiveColumn()){var c=this.table.getCalculateColumnSize();this.table.setHeaderColumnSize(c)}else{var d=this.table.getClientRegionColumnSize(),e=this._getBlockSize(),f=e.sumLeft,g=e.sumRight,h=e.left,i=e.right;h[h.length-1]+=d[0]-f,i[i.length-1]+=d[1]-g;var j=BI.clone(h),k=BI.clone(i);j[j.length-1]="",k[k.length-1]="",this.table.setColumnSize(j.concat(k)),e=a._getBlockSize(),h[h.length-1]<e.left[e.left.length-1]&&(h[h.length-1]=e.left[e.left.length-1]),i[i.length-1]<e.right[e.right.length-1]&&(i[i.length-1]=e.right[e.right.length-1]),a.table.setColumnSize(h.concat(i))}else if(!this._isAdaptiveColumn()){var d=this.table.getClientRegionColumnSize(),e=this._getBlockSize(),l=e.sum,m=e.size;m[m.length-1]+=d[0]-l;var n=BI.clone(m);n[n.length-1]="",this.table.setColumnSize(n),e=this._getBlockSize(),m[m.length-1]<e.size[e.size.length-1]&&(m[m.length-1]=e.size[e.size.length-1]),this.table.setColumnSize(m)}},_resizeBody:function(){if(this._isAdaptiveColumn()){var a=this.table.getCalculateColumnSize();this.setColumnSize(a)}},_adjustRegion:function(){var a=this.options,b=this.table.getCalculateRegionColumnSize();if(a.isNeedFreeze===!0&&a.freezeCols.length>0&&a.freezeCols.length<a.columnSize.length){var c=this._getBlockSize(),d=c.sumLeft,e=c.sumRight;(d<b[0]||b[0]>=d+e)&&this.table.setRegionColumnSize([d,"fill"]),this._resizeRegion()}},_resizeRegion:function(){var a=this.options,b=this.table.getCalculateRegionColumnSize();if(a.isNeedFreeze===!0&&a.freezeCols.length>0&&a.freezeCols.length<a.columnSize.length){var c=this.table.element.width();if(b[0]<15||b[1]<15){var d=a.freezeCols,e=c/3;d.length>a.columnSize.length/2&&(e=2*c/3),this.table.setRegionColumnSize([e,"fill"])}}},resize:function(){this.table.resize(),this._resizeRegion(),this._resizeHeader()},setColumnSize:function(a){this.table.setColumnSize(a),this._adjustRegion(),this._resizeHeader()},getColumnSize:function(){return this.table.getColumnSize()},getCalculateColumnSize:function(){return this.table.getCalculateColumnSize()},setHeaderColumnSize:function(a){this.table.setHeaderColumnSize(a),this._adjustRegion(),this._resizeHeader()},setRegionColumnSize:function(a){this.table.setRegionColumnSize(a),this._resizeHeader()},getRegionColumnSize:function(){return this.table.getRegionColumnSize()},getCalculateRegionColumnSize:function(){return this.table.getCalculateRegionColumnSize()},getCalculateRegionRowSize:function(){return this.table.getCalculateRegionRowSize()},getClientRegionColumnSize:function(){return this.table.getClientRegionColumnSize()},getScrollRegionColumnSize:function(){return this.table.getScrollRegionColumnSize()},getScrollRegionRowSize:function(){return this.table.getScrollRegionRowSize()},hasVerticalScroll:function(){return this.table.hasVerticalScroll()},setVerticalScroll:function(a){this.table.setVerticalScroll(a)},setLeftHorizontalScroll:function(a){this.table.setLeftHorizontalScroll(a)},setRightHorizontalScroll:function(a){this.table.setRightHorizontalScroll(a)},getVerticalScroll:function(){return this.table.getVerticalScroll()},getLeftHorizontalScroll:function(){return this.table.getLeftHorizontalScroll()},getRightHorizontalScroll:function(){return this.table.getRightHorizontalScroll()},getColumns:function(){return this.table.getColumns()},attr:function(){BI.ResponisveTable.superclass.attr.apply(this,arguments),this.table.attr.apply(this.table,arguments)},populate:function(a){var b=this,c=this.options;this.table.populate.apply(this.table,arguments),c.isNeedFreeze===!0&&BI.nextTick(function(){b._initRegionSize(),b.table.resize(),b._resizeHeader()})}}),BI.shortcut("bi.responsive_table",BI.ResponisveTable),BI.SelectTreeFirstPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.SelectTreeFirstPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-select-tree-first-plus-group-node bi-list-item-active",logic:{dynamic:!1},id:"",pId:"",readonly:!0,open:!1,height:25})},_init:function(){BI.SelectTreeFirstPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.first_tree_node_checkbox",stopPropagation:!0}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&(this.isSelected()?a.triggerExpand():a.triggerCollapse())});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,{width:25,el:this.checkbox},this.text);BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},isOnce:function(){return!0},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.NodeButton.superclass.doClick.apply(this,arguments)},setOpened:function(a){BI.SelectTreeFirstPlusGroupNode.superclass.setOpened.apply(this,arguments),
BI.isNotNull(this.checkbox)&&this.checkbox.setSelected(a)}}),BI.shortcut("bi.select_tree_first_plus_group_node",BI.SelectTreeFirstPlusGroupNode),BI.SelectTreeLastPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.SelectTreeLastPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-select-tree-last-plus-group-node bi-list-item-active",logic:{dynamic:!1},id:"",pId:"",readonly:!0,open:!1,height:25})},_init:function(){BI.SelectTreeLastPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.last_tree_node_checkbox",stopPropagation:!0}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&(this.isSelected()?a.triggerExpand():a.triggerCollapse())});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,{width:25,el:this.checkbox},this.text);BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},isOnce:function(){return!0},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.NodeButton.superclass.doClick.apply(this,arguments)},setOpened:function(a){BI.SelectTreeLastPlusGroupNode.superclass.setOpened.apply(this,arguments),BI.isNotNull(this.checkbox)&&this.checkbox.setSelected(a)}}),BI.shortcut("bi.select_tree_last_plus_group_node",BI.SelectTreeLastPlusGroupNode),BI.SelectTreeMidPlusGroupNode=BI.inherit(BI.NodeButton,{_defaultConfig:function(){var a=BI.SelectTreeMidPlusGroupNode.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-select-tree-mid-plus-group-node bi-list-item-active",logic:{dynamic:!1},id:"",pId:"",readonly:!0,open:!1,height:25})},_init:function(){BI.SelectTreeMidPlusGroupNode.superclass._init.apply(this,arguments);var a=this,b=this.options;this.checkbox=BI.createWidget({type:"bi.mid_tree_node_checkbox",stopPropagation:!0}),this.text=BI.createWidget({type:"bi.label",textAlign:"left",whiteSpace:"nowrap",textHeight:b.height,height:b.height,hgap:b.hgap,text:b.text,value:b.value,py:b.py}),this.checkbox.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&(this.isSelected()?a.triggerExpand():a.triggerCollapse())});var c=BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left),d=BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left,{width:25,el:this.checkbox},this.text);BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(c,BI.extend(b.logic,{items:d}))))},isOnce:function(){return!0},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doClick:function(){BI.NodeButton.superclass.doClick.apply(this,arguments)},setOpened:function(a){BI.SelectTreeMidPlusGroupNode.superclass.setOpened.apply(this,arguments),BI.isNotNull(this.checkbox)&&this.checkbox.setSelected(a)}}),BI.shortcut("bi.select_tree_mid_plus_group_node",BI.SelectTreeMidPlusGroupNode),BI.SelectTreeCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SelectTreeCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-select-tree-combo",height:30,text:"",items:[]})},_init:function(){BI.SelectTreeCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget({type:"bi.single_tree_trigger",text:b.text,height:b.height,items:b.items}),this.popup=BI.createWidget({type:"bi.select_level_tree",items:b.items}),this.combo=BI.createWidget({type:"bi.combo",element:this,adjustLength:2,el:this.trigger,popup:{el:this.popup}}),this.combo.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.popup.on(BI.SingleTreePopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.combo.hideView()})},setValue:function(a){a=BI.isArray(a)?a:[a],this.trigger.setValue(a),this.popup.setValue(a)},getValue:function(){return this.popup.getValue()},populate:function(a){this.combo.populate(a)}}),BI.shortcut("bi.select_tree_combo",BI.SelectTreeCombo),BI.SelectTreeExpander=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SelectTreeExpander.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-select-tree-expander",trigger:"click",toggle:!0,direction:"bottom",isDefaultInit:!0,el:{},popup:{}})},_init:function(){BI.SelectTreeExpander.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget(BI.extend({stopPropagation:!0},b.el)),this.trigger.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&this.isSelected()&&a.expander.setValue([]),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.expander=BI.createWidget({type:"bi.expander",element:this,trigger:b.trigger,toggle:b.toggle,direction:b.direction,isDefaultInit:b.isDefaultInit,el:this.trigger,popup:b.popup}),this.expander.on(BI.Controller.EVENT_CHANGE,function(b){b===BI.Events.CLICK&&a.trigger.setSelected(!1),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)})},setValue:function(a){BI.contains(a,this.trigger.getValue())?(this.trigger.setSelected(!0),this.expander.setValue([])):(this.trigger.setSelected(!1),this.expander.setValue(a))},getValue:function(){return this.trigger.isSelected()?[this.trigger.getValue()]:this.expander.getValue()},populate:function(a){this.expander.populate(a)}}),BI.shortcut("bi.select_tree_expander",BI.SelectTreeExpander),BI.SelectTreePopup=BI.inherit(BI.Pane,{_defaultConfig:function(){return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-select-level-tree",tipText:BI.i18nText("BI-No_Selected_Item"),items:[]})},_formatItems:function(a,b){var c=this;return BI.each(a,function(d,e){var f={layer:b};if(e.id=e.id||BI.UUID(),e.isParent===!0||BI.isNotEmptyArray(e.children)){switch(d){case 0:f.type="bi.select_tree_first_plus_group_node";break;case a.length-1:f.type="bi.select_tree_last_plus_group_node";break;default:f.type="bi.select_tree_mid_plus_group_node"}BI.defaults(e,f),c._formatItems(e.children)}else{switch(d){case a.length-1:f.type="bi.last_tree_leaf_item";break;default:f.type="bi.mid_tree_leaf_item"}BI.defaults(e,f)}}),a},_init:function(){BI.SelectTreePopup.superclass._init.apply(this,arguments);var a=this,b=this.options;this.tree=BI.createWidget({type:"bi.level_tree",expander:{type:"bi.select_tree_expander",isDefaultInit:!0},items:this._formatItems(BI.Tree.transformToTreeFormat(b.items)),chooseType:BI.Selection.Single}),BI.createWidget({type:"bi.vertical",element:this,items:[this.tree]}),this.tree.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.tree.on(BI.LevelTree.EVENT_CHANGE,function(){a.fireEvent(BI.SelectTreePopup.EVENT_CHANGE)}),this.check()},getValue:function(){return this.tree.getValue()},setValue:function(a){a=BI.isArray(a)?a:[a],this.tree.setValue(a)},populate:function(a){BI.SelectTreePopup.superclass.populate.apply(this,arguments),this.tree.populate(a)}}),BI.SelectTreePopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.select_level_tree",BI.SelectTreePopup),BI.SequenceTableDynamicNumber=BI.inherit(BI.SequenceTableTreeNumber,{_defaultConfig:function(){return BI.extend(BI.SequenceTableDynamicNumber.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-sequence-table-dynamic-number"})},_init:function(){BI.SequenceTableDynamicNumber.superclass._init.apply(this,arguments)},_formatNumber:function(a){function b(a){var c=0;return BI.isNotEmptyArray(a.children)?(BI.each(a.children,function(a,d){c+=b(d)}),a.children.length>1&&BI.isNotEmptyArray(a.values)&&c++):c++,c}var c=this.options,d=[],e=this._getStart(a),f=0,g=0;return BI.each(a,function(a,h){BI.isArray(h.children)&&(BI.each(h.children,function(a,h){var i=b(h);d.push({text:e++,start:f,top:g,cnt:i,index:a,height:i*c.rowSize}),f+=i,g+=i*c.rowSize}),BI.isNotEmptyArray(h.values)&&(d.push({text:BI.i18nText("BI-Summary_Values"),start:f++,top:g,cnt:1,isSummary:!0,height:c.rowSize}),g+=c.rowSize))}),d}}),BI.shortcut("bi.sequence_table_dynamic_number",BI.SequenceTableDynamicNumber),BI.SequenceTableListNumber=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SequenceTableListNumber.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-sequence-table-list-number",isNeedFreeze:!1,scrollTop:0,startSequence:1,headerRowSize:25,rowSize:25,sequenceHeaderCreator:null,header:[],items:[],crossHeader:[],crossItems:[],pageSize:20})},_init:function(){BI.SequenceTableListNumber.superclass._init.apply(this,arguments);var a=this.options;this.start=a.startSequence,this.renderedCells=[],this.renderedKeys=[],this.container=BI.createWidget({type:"bi.absolute",width:60,scrollable:!1}),this.scrollContainer=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.container]}),this.headerContainer=BI.createWidget({type:"bi.absolute",cls:"bi-border",width:58,scrollable:!1}),this.layout=BI.createWidget({type:"bi.vtape",element:this,items:[{el:this.headerContainer,height:a.headerRowSize*a.header.length-2},{el:{type:"bi.layout"},height:2},{el:this.scrollContainer}]}),this._populate()},_layout:function(){var a=this.options,b=a.headerRowSize*a.header.length-2,c=this.layout.attr("items");a.isNeedFreeze===!1?(c[0].height=0,c[1].height=0):a.isNeedFreeze===!0&&(c[0].height=b,c[1].height=2),this.layout.attr("items",c),this.layout.resize(),this.container.setHeight(a.items.length*a.rowSize);try{this.scrollContainer.element.scrollTop(a.scrollTop)}catch(d){}},_createHeader:function(){var a=this.options;BI.createWidget({type:"bi.absolute",element:this.headerContainer,items:[{el:a.sequenceHeaderCreator||{type:"bi.table_style_cell",cls:"sequence-table-title-cell",styleGetter:a.headerCellStyleGetter,text:BI.i18nText("BI-Number_Index")},left:0,top:0,right:0,bottom:0}]})},_calculateChildrenToRender:function(){for(var a=this,b=this.options,c=BI.clamp(b.scrollTop,0,b.rowSize*b.items.length-(b.height-b.header.length*b.headerRowSize)+BI.DOM.getScrollWidth()),d=Math.floor(c/b.rowSize),e=d+Math.floor((b.height-b.header.length*b.headerRowSize)/b.rowSize),f=[],g=[],h=d,i=0;h<=e&&h<b.items.length;h++,i++){var j=BI.deepIndexOf(this.renderedKeys,this.start+h),k=h*b.rowSize;if(j>-1)b.rowSize!==this.renderedCells[j]._height&&(this.renderedCells[j]._height=b.rowSize,this.renderedCells[j].el.setHeight(b.rowSize)),this.renderedCells[j].top!==k&&(this.renderedCells[j].top=k,this.renderedCells[j].el.element.css("top",k+"px")),f.push(this.renderedCells[j]);else{var l=BI.createWidget(BI.extend({type:"bi.table_style_cell",cls:"sequence-table-number-cell bi-border-left bi-border-right bi-border-bottom",width:60,height:b.rowSize,text:this.start+h,styleGetter:function(c){return function(){return b.sequenceCellStyleGetter(a.start+h-1)}}(i)}));f.push({el:l,left:0,top:k,_height:b.rowSize})}g.push(this.start+h)}var m={},n={},o=[];BI.each(g,function(b,c){BI.deepContains(a.renderedKeys,c)?m[b]=c:n[b]=c}),BI.each(this.renderedKeys,function(a,b){BI.deepContains(m,b)||BI.deepContains(n,b)||o.push(a)}),BI.each(o,function(b,c){a.renderedCells[c].el.destroy()});var p=[];BI.each(n,function(a){p.push(f[a])}),BI.createWidget({type:"bi.absolute",element:this.container,items:p}),this.renderedCells=f,this.renderedKeys=g},_populate:function(){this.headerContainer.empty(),this._createHeader(),this._layout(),this._calculateChildrenToRender()},setVerticalScroll:function(a){if(this.options.scrollTop!==a){this.options.scrollTop=a;try{this.scrollContainer.element.scrollTop(a)}catch(b){}}},getVerticalScroll:function(){return this.options.scrollTop},setVPage:function(a){a=a<1?1:a;var b=this.options;this.start=(a-1)*b.pageSize+1},_restore:function(){this.options;BI.each(this.renderedCells,function(a,b){b.el.destroy()}),this.renderedCells=[],this.renderedKeys=[]},restore:function(){this._restore()},populate:function(a,b){var c=this.options;a&&a!==this.options.items&&(c.items=a,this._restore()),b&&b!==this.options.header&&(c.header=b),this._populate()}}),BI.shortcut("bi.sequence_table_list_number",BI.SequenceTableListNumber),BI.SequenceTable=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SequenceTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-sequence-table",el:{type:"bi.adaptive_table"},sequence:{},isNeedResize:!0,isResizeAdapt:!1,isNeedFreeze:!1,freezeCols:[],isNeedMerge:!1,mergeCols:[],mergeRule:BI.emptyFn,columnSize:[],minColumnSize:[],maxColumnSize:[],headerRowSize:25,rowSize:25,regionColumnSize:[],headerCellStyleGetter:BI.emptyFn,summaryCellStyleGetter:BI.emptyFn,sequenceCellStyleGetter:BI.emptyFn,header:[],items:[],crossHeader:[],crossItems:[],showSequence:!1,startSequence:1})},_init:function(){BI.SequenceTable.superclass._init.apply(this,arguments);var a=this,b=this.options;this.sequence=BI.createWidget(b.sequence,{type:"bi.sequence_table_list_number",invisible:b.showSequence===!1,startSequence:b.startSequence,isNeedFreeze:b.isNeedFreeze,header:b.header,items:b.items,crossHeader:b.crossHeader,crossItems:b.crossItems,headerRowSize:b.headerRowSize,rowSize:b.rowSize,width:60,height:b.height&&b.height-BI.GridTableScrollbar.SIZE,headerCellStyleGetter:b.headerCellStyleGetter,summaryCellStyleGetter:b.summaryCellStyleGetter,sequenceCellStyleGetter:b.sequenceCellStyleGetter}),this.table=BI.createWidget(b.el,{type:"bi.adaptive_table",width:b.showSequence===!0?b.width-60:b.width,height:b.height,isNeedResize:b.isNeedResize,isResizeAdapt:b.isResizeAdapt,isNeedFreeze:b.isNeedFreeze,freezeCols:b.freezeCols,isNeedMerge:b.isNeedMerge,mergeCols:b.mergeCols,mergeRule:b.mergeRule,columnSize:b.columnSize,minColumnSize:b.minColumnSize,maxColumnSize:b.maxColumnSize,headerRowSize:b.headerRowSize,rowSize:b.rowSize,regionColumnSize:b.regionColumnSize,headerCellStyleGetter:b.headerCellStyleGetter,summaryCellStyleGetter:b.summaryCellStyleGetter,sequenceCellStyleGetter:b.sequenceCellStyleGetter,header:b.header,items:b.items,crossHeader:b.crossHeader,crossItems:b.crossItems}),this.table.on(BI.Table.EVENT_TABLE_SCROLL,function(b){a.sequence.getVerticalScroll()!==this.getVerticalScroll()&&(a.sequence.setVerticalScroll(this.getVerticalScroll()),a.sequence.populate()),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,function(){b.regionColumnSize=this.getRegionColumnSize(),b.columnSize=this.getColumnSize(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,function(){b.regionColumnSize=this.getRegionColumnSize(),b.columnSize=this.getColumnSize(),a.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,arguments)}),this.htape=BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.sequence,left:0,top:0},{el:this.table,top:0,left:b.showSequence===!0?60:0}]}),this._populate()},_populate:function(){var a=this.options;a.showSequence===!0?(this.sequence.setVisible(!0),this.table.element.css("left","60px"),this.table.setWidth(a.width-60)):(this.sequence.setVisible(!1),this.table.element.css("left","0px"),this.table.setWidth(a.width))},setWidth:function(a){BI.PageTable.superclass.setWidth.apply(this,arguments),this.table.setWidth(this.options.showSequence?a-60:a)},setHeight:function(a){BI.PageTable.superclass.setHeight.apply(this,arguments),this.table.setHeight(a),this.sequence.setHeight(a-BI.GridTableScrollbar.SIZE)},setColumnSize:function(a){this.options.columnSize=a,this.table.setColumnSize(a)},getColumnSize:function(){return this.table.getColumnSize()},setRegionColumnSize:function(a){this.options.columnSize=a,this.table.setRegionColumnSize(a)},getRegionColumnSize:function(){return this.table.getRegionColumnSize()},hasLeftHorizontalScroll:function(){return this.table.hasLeftHorizontalScroll()},hasRightHorizontalScroll:function(){return this.table.hasRightHorizontalScroll()},setLeftHorizontalScroll:function(a){this.table.setLeftHorizontalScroll(a)},setRightHorizontalScroll:function(a){this.table.setRightHorizontalScroll(a)},setVerticalScroll:function(a){this.table.setVerticalScroll(a),this.sequence.setVerticalScroll(a)},getVerticalScroll:function(){return this.table.getVerticalScroll()},setVPage:function(a){this.sequence.setVPage&&this.sequence.setVPage(a)},setHPage:function(a){this.sequence.setHPage&&this.sequence.setHPage(a)},attr:function(){BI.SequenceTable.superclass.attr.apply(this,arguments),this.table.attr.apply(this.table,arguments),this.sequence.attr.apply(this.sequence,arguments)},restore:function(){this.table.restore(),this.sequence.restore()},populate:function(a,b,c,d){var e=this.options;a&&(e.items=a),b&&(e.header=b),c&&(e.crossItems=c),d&&(e.crossHeader=d),this._populate(),this.table.populate.apply(this.table,arguments),this.sequence.populate.apply(this.sequence,arguments),this.sequence.setVerticalScroll(this.table.getVerticalScroll())},destroy:function(){this.table.destroy(),BI.SequenceTable.superclass.destroy.apply(this,arguments)}}),BI.shortcut("bi.sequence_table",BI.SequenceTable),BI.SingleSelectSearchLoader=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SingleSelectSearchLoader.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-search-loader",itemsCreator:BI.emptyFn,keywordGetter:BI.emptyFn,valueFormatter:BI.emptyFn})},_init:function(){BI.SingleSelectSearchLoader.superclass._init.apply(this,arguments);var a=this,b=this.options,c=!1;this.button_group=BI.createWidget({type:"bi.single_select_list",element:this,logic:{dynamic:!1},el:{tipText:BI.i18nText("BI-No_Select"),el:{type:"bi.loader",isDefaultInit:!1,logic:{dynamic:!0,scrolly:!0},el:{chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,behaviors:{redmark:function(){return!0}},layouts:[{type:"bi.vertical"}]}}},itemsCreator:function(d,e){a.storeValue&&(d=BI.extend(d||{},{selectedValues:[a.storeValue]})),b.itemsCreator(d,function(f){var g=f.keyword=b.keywordGetter();c=f.hasNext;var h=[];if(1===d.times&&a.storeValue){var i=BI.map([a.storeValue],function(a,c){var d=b.valueFormatter(c)||c;return{text:d,value:c,title:d,selected:!1}});h=a._createItems(i)}e(h.concat(a._createItems(f.items)),g),1===d.times&&a.storeValue&&a.setValue(a.storeValue)})},hasNext:function(){return c}}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.button_group.on(BI.SingleSelectList.EVENT_CHANGE,function(){a.fireEvent(BI.SingleSelectSearchLoader.EVENT_CHANGE,arguments)})},_createItems:function(a){return BI.createItems(a,{type:"bi.single_select_radio_item",logic:{dynamic:!1},height:25,selected:!1})},_filterValues:function(a){var b=this.options,c=b.keywordGetter(),d=BI.deepClone(a.value)||[],e=BI.map(d,function(a,c){return{text:b.valueFormatter(c)||c,value:c}});if(BI.isKey(c)){var f=BI.Func.getSearchResult(e,c);d=f.matched.concat(f.finded)}return BI.map(d,function(a,b){return{text:b.text,title:b.text,value:b.value,selected:!1}})},setValue:function(a){this.storeValue=a,this.button_group.setValue(a)},getValue:function(){return this.button_group.getValue()},getAllButtons:function(){return this.button_group.getAllButtons()},empty:function(){this.button_group.empty()},populate:function(a){this.button_group.populate.apply(this.button_group,arguments)},resetHeight:function(a){this.button_group.resetHeight(a)},resetWidth:function(a){this.button_group.resetWidth(a)}}),BI.SingleSelectSearchLoader.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.single_select_search_loader",BI.SingleSelectSearchLoader),BI.SingleSelectSearchPane=BI.inherit(BI.Widget,{constants:{height:25,lgap:10,tgap:5},_defaultConfig:function(){return BI.extend(BI.SingleSelectSearchPane.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-search-pane bi-card",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,keywordGetter:BI.emptyFn})},_init:function(){BI.SingleSelectSearchPane.superclass._init.apply(this,arguments);var a=this,b=this.options;this.tooltipClick=BI.createWidget({type:"bi.label",invisible:!0,text:BI.i18nText("BI-Click_Blank_To_Select"),cls:"single-select-toolbar",height:this.constants.height}),this.loader=BI.createWidget({type:"bi.single_select_search_loader",keywordGetter:b.keywordGetter,valueFormatter:b.valueFormatter,itemsCreator:function(c,d){b.itemsCreator.apply(a,[c,function(c){d(c),a.setKeyword(b.keywordGetter())}])}}),this.loader.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.resizer=BI.createWidget({type:"bi.vtape",element:this,items:[{el:this.tooltipClick,height:0},{el:this.loader}]}),this.tooltipClick.setVisible(!1)},setKeyword:function(a){var b,c=this.loader.getAllButtons().length>0&&(b=this.loader.getAllButtons()[0])&&a===b.getValue();c!==this.tooltipClick.isVisible()&&(this.tooltipClick.setVisible(c),this.resizer.attr("items")[0].height=c?this.constants.height:0,this.resizer.resize())},hasMatched:function(){return this.tooltipClick.isVisible()},setValue:function(a){this.loader.setValue(a)},getValue:function(){return this.loader.getValue()},empty:function(){this.loader.empty()},populate:function(a){this.loader.populate.apply(this.loader,arguments)}}),BI.SingleSelectSearchPane.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.single_select_search_pane",BI.SingleSelectSearchPane),BI.SingleSelectCombo=BI.inherit(BI.Single,{_defaultConfig:function(){return BI.extend(BI.SingleSelectCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-combo",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,height:28})},_init:function(){BI.SingleSelectCombo.superclass._init.apply(this,arguments);var a=this,b=this.options,c=function(){BI.isKey(a._startValue)&&(a.storeValue=a._startValue),a.trigger.getSearcher().setState(a.storeValue)};this.storeValue="",this.requesting=!1,this.trigger=BI.createWidget({type:"bi.single_select_trigger",height:b.height,masker:{offset:{left:1,top:1,right:2,bottom:33}},valueFormatter:b.valueFormatter,itemsCreator:function(c,d){b.itemsCreator(c,function(b){1===c.times&&BI.isNotNull(c.keywords)&&a.trigger.setValue(a.getValue()),d.apply(a,arguments)})}}),this.trigger.on(BI.SingleSelectTrigger.EVENT_START,function(){a._setStartValue(""),this.getSearcher().setValue(a.storeValue)}),this.trigger.on(BI.SingleSelectTrigger.EVENT_STOP,function(){a._setStartValue("")}),this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE,function(){if(this.getSearcher().hasMatched()){var b=this.getSearcher().getKeyword();a._join({type:BI.Selection.Multi,value:[b]},function(){a.combo.setValue(a.storeValue),a._setStartValue(b),c(),a.populate(),a._setStartValue("")})}}),this.trigger.on(BI.SingleSelectTrigger.EVENT_SEARCHING,function(b){var d=BI.last(b);b=BI.initial(b||[]),b.length>0&&a._joinKeywords(b,function(){BI.isEndWithBlank(d)?(a.combo.setValue(a.storeValue),c(),a.combo.populate(),a._setStartValue("")):(a.combo.setValue(a.storeValue),c())})}),this.trigger.on(BI.SingleSelectTrigger.EVENT_CHANGE,function(b,d){a.storeValue=this.getValue(),c()}),this.trigger.on(BI.SingleSelectTrigger.EVENT_COUNTER_CLICK,function(){a.combo.isViewVisible()||a.combo.showView()}),this.combo=BI.createWidget({type:"bi.combo",toggle:!1,el:this.trigger,adjustLength:1,popup:{type:"bi.single_select_popup_view",ref:function(){a.popup=this,a.trigger.setAdapter(this)},listeners:[{eventName:BI.SingleSelectPopupView.EVENT_CHANGE,action:function(){a.storeValue=this.getValue(),a._adjust(function(){c()})}},{eventName:BI.SingleSelectPopupView.EVENT_CLICK_CONFIRM,action:function(){a._defaultState()}},{eventName:BI.SingleSelectPopupView.EVENT_CLICK_CLEAR,action:function(){a.setValue(),a._defaultState()}}],itemsCreator:b.itemsCreator,valueFormatter:b.valueFormatter,onLoaded:function(){BI.nextTick(function(){a.combo.adjustWidth(),a.combo.adjustHeight(),a.trigger.getSearcher().adjustView()})}},hideChecker:function(a){return 0===d.element.find(a.target).length}}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){this.setValue(a.storeValue),BI.nextTick(function(){a.populate()})}),this.wants2Quit=!1,this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW,function(){a.trigger.stopEditing(),a.requesting===!0?a.wants2Quit=!0:a.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM)});var d=BI.createWidget({type:"bi.trigger_icon_button",width:b.height,height:b.height,cls:"single-select-trigger-icon-button bi-border-left"});d.on(BI.TriggerIconButton.EVENT_CHANGE,function(){a.combo.isViewVisible()?a.combo.hideView():a.combo.showView()}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.combo,left:0,right:0,top:0,bottom:0},{el:d,right:0,top:0,bottom:0}]})},_defaultState:function(){this.trigger.stopEditing(),this.combo.hideView()},_assertValue:function(a){a||(a="")},_makeMap:function(a){return BI.makeObject(a||[])},_joinKeywords:function(a,b){function c(c){var e=d._makeMap(c);BI.each(a,function(a,b){BI.isNotNull(e[b])&&d.storeValue.value.remove(b)}),d._adjust(b)}var d=this,e=this.options;this._assertValue(this.storeValue),this.requesting=!0,e.itemsCreator({type:BI.SingleSelectCombo.REQ_GET_ALL_DATA,keywords:a},function(a){var b=BI.pluck(a.items,"value");c(b)})},_joinAll:function(a,b){var c=this,d=this.options;this._assertValue(a),this.requesting=!0,d.itemsCreator({type:BI.SingleSelectCombo.REQ_GET_ALL_DATA,keywords:[this.trigger.getKey()]},function(d){var e=BI.pluck(d.items,"value");if(c.storeValue.type===a.type){var f=!1,g=c._makeMap(c.storeValue.value);return BI.each(e,function(a,b){BI.isNotNull(g[b])&&(f=!0,delete g[b])}),f&&(c.storeValue.value=BI.values(g)),void c._adjust(b)}var h=c._makeMap(c.storeValue.value),i=c._makeMap(a.value),j=[];BI.each(e,function(a,b){BI.isNotNull(h[e[a]])&&delete h[e[a]],BI.isNull(i[e[a]])&&j.push(b)}),c.storeValue.value=j.concat(BI.values(h)),c._adjust(b)})},_adjust:function(a){function b(){c.wants2Quit===!0&&(c.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM),c.wants2Quit=!1),c.requesting=!1}var c=this,d=this.options;this._count?(b(),a()):d.itemsCreator({type:BI.SingleSelectCombo.REQ_GET_DATA_LENGTH},function(d){c._count=d.count,b(),a()})},_join:function(a,b){var c=this;this.options;if(this._assertValue(a),this._assertValue(this.storeValue),this.storeValue.type===a.type){var d=this._makeMap(this.storeValue.value);BI.each(a.value,function(a,b){d[b]||(c.storeValue.value.push(b),d[b]=b)});var e=!1;return BI.each(a.assist,function(a,b){BI.isNotNull(d[b])&&(e=!0,delete d[b])}),e&&(this.storeValue.value=BI.values(d)),void c._adjust(b)}this._joinAll(a,b)},_setStartValue:function(a){this._startValue=a,this.popup.setStartValue(a)},setValue:function(a){this.storeValue=a||"",this._assertValue(this.storeValue),this.combo.setValue(this.storeValue)},getValue:function(){return this.storeValue},populate:function(){this._count=null,this.combo.populate.apply(this.combo,arguments)}}),BI.extend(BI.SingleSelectCombo,{REQ_GET_DATA_LENGTH:0,REQ_GET_ALL_DATA:-1}),BI.SingleSelectCombo.EVENT_CONFIRM="EVENT_CONFIRM",BI.shortcut("bi.single_select_combo",BI.SingleSelectCombo),BI.SingleSelectList=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SingleSelectList.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-select-list",direction:BI.Direction.Top,logic:{dynamic:!0},items:[],itemsCreator:BI.emptyFn,hasNext:BI.emptyFn,onLoaded:BI.emptyFn,el:{type:"bi.list_pane"}})},_init:function(){BI.SingleSelectList.superclass._init.apply(this,arguments);var a=this,b=this.options;this.list=BI.createWidget(b.el,{type:"bi.list_pane",items:b.items,itemsCreator:function(c,d){b.itemsCreator(c,function(b){d.apply(a,arguments)})},onLoaded:b.onLoaded,hasNext:b.hasNext}),this.list.on(BI.Controller.EVENT_CHANGE,function(b,c,d){b===BI.Events.CLICK&&a.fireEvent(BI.SingleSelectList.EVENT_CHANGE,c,d),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),BI.createWidget(BI.extend({element:this},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(b.direction),BI.extend({scrolly:!0},b.logic,{items:BI.LogicFactory.createLogicItemsByDirection(b.direction,this.list)}))))},hasPrev:function(){return this.list.hasPrev()},hasNext:function(){return this.list.hasNext()},prependItems:function(a){this.list.prependItems.apply(this.list,arguments)},addItems:function(a){this.list.addItems.apply(this.list,arguments)},setValue:function(a){this.list.setValue([a])},getValue:function(){return this.list.getValue()[0]},empty:function(){this.list.empty()},populate:function(a){this.list.populate.apply(this.list,arguments)},resetHeight:function(a){this.list.resetHeight?this.list.resetHeight(a):this.list.element.css({"max-height":a+"px"})},setNotSelectedValue:function(){this.list.setNotSelectedValue.apply(this.list,arguments)},getNotSelectedValue:function(){return this.list.getNotSelectedValue()},getAllButtons:function(){return this.list.getAllButtons()},getAllLeaves:function(){return this.list.getAllLeaves()},getSelectedButtons:function(){return this.list.getSelectedButtons()},getNotSelectedButtons:function(){return this.list.getNotSelectedButtons()},getIndexByValue:function(a){return this.list.getIndexByValue(a)},getNodeById:function(a){return this.list.getNodeById(a)},getNodeByValue:function(a){return this.list.getNodeByValue(a)}}),BI.SingleSelectList.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.single_select_list",BI.SingleSelectList),BI.SingleSelectLoader=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SingleSelectLoader.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-loader",logic:{dynamic:!0},el:{height:400},valueFormatter:BI.emptyFn,itemsCreator:BI.emptyFn,onLoaded:BI.emptyFn})},_init:function(){BI.SingleSelectLoader.superclass._init.apply(this,arguments);var a=this,b=this.options,c=!1;this.button_group=BI.createWidget({type:"bi.single_select_list",element:this,logic:b.logic,el:BI.extend({onLoaded:b.onLoaded,el:{type:"bi.loader",isDefaultInit:!1,logic:{dynamic:!0,scrolly:!0},el:{chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,behaviors:{redmark:function(){return!0}},layouts:[{type:"bi.vertical"}]}}},b.el),itemsCreator:function(d,e){var f=a._startValue;a.storeValue&&(d=BI.extend(d||{},{selectedValues:[a.storeValue]})),b.itemsCreator(d,function(g){c=g.hasNext;var h=[];if(1===d.times&&a.storeValue){var i=BI.map([a.storeValue],function(a,c){var d=b.valueFormatter(c)||c;return{text:d,value:c,title:d,selected:!1}});h=a._createItems(i)}e(h.concat(a._createItems(g.items)),g.keyword||""),1===d.times&&a.storeValue&&(BI.isKey(f)&&(a.storeValue=f),a.setValue(a.storeValue)),1===d.times&&a._scrollToTop()})},hasNext:function(){return c}}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.button_group.on(BI.SingleSelectList.EVENT_CHANGE,function(){a.fireEvent(BI.SingleSelectLoader.EVENT_CHANGE,arguments)})},_createItems:function(a){return BI.createItems(a,{type:"bi.single_select_radio_item",logic:this.options.logic,height:25,selected:!1})},_scrollToTop:function(){var a=this;BI.delay(function(){a.button_group.element.scrollTop(0)},30)},_assertValue:function(a){a||(a="")},setStartValue:function(a){this._startValue=a},setValue:function(a){this.storeValue=a||"",this._assertValue(this.storeValue),this.button_group.setValue(this.storeValue)},getValue:function(){return this.button_group.getValue()},getAllButtons:function(){return this.button_group.getAllButtons()},empty:function(){this.button_group.empty()},populate:function(a){this.button_group.populate.apply(this.button_group,arguments)},resetHeight:function(a){this.button_group.resetHeight(a)},resetWidth:function(a){this.button_group.resetWidth(a)}}),BI.SingleSelectLoader.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.single_select_loader",BI.SingleSelectLoader),BI.SingleSelectPopupView=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SingleSelectPopupView.superclass._defaultConfig.apply(this,arguments),{
baseCls:"bi-single-select-popup-view",maxWidth:"auto",minWidth:135,maxHeight:400,valueFormatter:BI.emptyFn,itemsCreator:BI.emptyFn,onLoaded:BI.emptyFn})},_init:function(){BI.SingleSelectPopupView.superclass._init.apply(this,arguments);var a=this,b=this.options;this.loader=BI.createWidget({type:"bi.single_select_loader",itemsCreator:b.itemsCreator,valueFormatter:b.valueFormatter,onLoaded:b.onLoaded}),this.popupView=BI.createWidget({type:"bi.multi_popup_view",stopPropagation:!1,maxWidth:b.maxWidth,minWidth:b.minWidth,maxHeight:b.maxHeight,element:this,buttons:[BI.i18nText("BI-Basic_Clears"),BI.i18nText("BI-Basic_Sure")],el:this.loader}),this.popupView.on(BI.MultiPopupView.EVENT_CHANGE,function(){a.fireEvent(BI.SingleSelectPopupView.EVENT_CHANGE)}),this.popupView.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON,function(b){switch(b){case 0:a.fireEvent(BI.SingleSelectPopupView.EVENT_CLICK_CLEAR);break;case 1:a.fireEvent(BI.SingleSelectPopupView.EVENT_CLICK_CONFIRM)}})},setStartValue:function(a){this.loader.setStartValue(a)},setValue:function(a){this.popupView.setValue(a)},getValue:function(){return this.popupView.getValue()},populate:function(a){this.popupView.populate.apply(this.popupView,arguments)},resetHeight:function(a){this.popupView.resetHeight(a)},resetWidth:function(a){this.popupView.resetWidth(a)}}),BI.SingleSelectPopupView.EVENT_CHANGE="EVENT_CHANGE",BI.SingleSelectPopupView.EVENT_CLICK_CONFIRM="EVENT_CLICK_CONFIRM",BI.SingleSelectPopupView.EVENT_CLICK_CLEAR="EVENT_CLICK_CLEAR",BI.shortcut("bi.single_select_popup_view",BI.SingleSelectPopupView),BI.SingleSelectTrigger=BI.inherit(BI.Trigger,{constants:{height:14,rgap:4,lgap:4},_defaultConfig:function(){return BI.extend(BI.SingleSelectTrigger.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-trigger bi-border",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,searcher:{},switcher:{},adapter:null,masker:{}})},_init:function(){BI.SingleSelectTrigger.superclass._init.apply(this,arguments);var a=this,b=this.options;b.height&&this.setHeight(b.height-2),this.searcher=BI.createWidget(b.searcher,{type:"bi.single_select_searcher",height:b.height,itemsCreator:b.itemsCreator,valueFormatter:b.valueFormatter,popup:{},adapter:b.adapter,masker:b.masker}),this.searcher.on(BI.SingleSelectSearcher.EVENT_START,function(){a.fireEvent(BI.SingleSelectTrigger.EVENT_START)}),this.searcher.on(BI.SingleSelectSearcher.EVENT_PAUSE,function(){a.fireEvent(BI.SingleSelectTrigger.EVENT_PAUSE)}),this.searcher.on(BI.SingleSelectSearcher.EVENT_SEARCHING,function(){a.fireEvent(BI.SingleSelectTrigger.EVENT_SEARCHING,arguments)}),this.searcher.on(BI.SingleSelectSearcher.EVENT_STOP,function(){a.fireEvent(BI.SingleSelectTrigger.EVENT_STOP)}),this.searcher.on(BI.SingleSelectSearcher.EVENT_CHANGE,function(){a.fireEvent(BI.SingleSelectTrigger.EVENT_CHANGE,arguments)});BI.createWidget({type:"bi.htape",element:this,items:[{el:this.searcher,width:"fill"},{el:BI.createWidget(),width:30}]})},getSearcher:function(){return this.searcher},stopEditing:function(){this.searcher.stopSearch()},setAdapter:function(a){this.searcher.setAdapter(a)},setValue:function(a){this.searcher.setValue(a)},getKey:function(){return this.searcher.getKey()},getValue:function(){return this.searcher.getValue()}}),BI.SingleSelectTrigger.EVENT_TRIGGER_CLICK="EVENT_TRIGGER_CLICK",BI.SingleSelectTrigger.EVENT_COUNTER_CLICK="EVENT_COUNTER_CLICK",BI.SingleSelectTrigger.EVENT_CHANGE="EVENT_CHANGE",BI.SingleSelectTrigger.EVENT_START="EVENT_START",BI.SingleSelectTrigger.EVENT_STOP="EVENT_STOP",BI.SingleSelectTrigger.EVENT_PAUSE="EVENT_PAUSE",BI.SingleSelectTrigger.EVENT_SEARCHING="EVENT_SEARCHING",BI.SingleSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW="EVENT_BEFORE_COUNTER_POPUPVIEW",BI.shortcut("bi.single_select_trigger",BI.SingleSelectTrigger),BI.SingleSelectEditor=BI.inherit(BI.Widget,{_const:{checkSelected:BI.i18nText("BI-Check_Selected")},_defaultConfig:function(){return BI.extend(BI.SingleSelectEditor.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-editor",el:{}})},_init:function(){BI.SingleSelectEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget(b.el,{type:"bi.state_editor",element:this,height:b.height,watermark:BI.i18nText("BI-Basic_Search"),allowBlank:!0}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.StateEditor.EVENT_PAUSE,function(){a.fireEvent(BI.SingleSelectEditor.EVENT_PAUSE)}),this.editor.on(BI.StateEditor.EVENT_CLICK_LABEL,function(){})},focus:function(){this.editor.focus()},blur:function(){this.editor.blur()},setState:function(a){this.editor.setState(a)},setValue:function(a){this.editor.setValue(a)},getValue:function(){var a=this.editor.getState();return BI.isArray(a)&&a.length>0?a[a.length-1]:""},getKeywords:function(){var a=this.editor.getLastValidValue(),b=a.match(/[\S]+/g);return BI.isEndWithBlank(a)?b.concat([" "]):b},populate:function(a){}}),BI.SingleSelectEditor.EVENT_PAUSE="SingleSelectEditor.EVENT_PAUSE",BI.shortcut("bi.single_select_editor",BI.SingleSelectEditor),BI.SingleSelectSearcher=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SingleSelectSearcher.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-searcher",itemsCreator:BI.emptyFn,el:{},popup:{},valueFormatter:BI.emptyFn,adapter:null,masker:{}})},_init:function(){BI.SingleSelectSearcher.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget(b.el,{type:"bi.single_select_editor",height:b.height}),this.searcher=BI.createWidget({type:"bi.searcher",element:this,height:b.height,isAutoSearch:!1,isAutoSync:!1,onSearch:function(a,b){b()},el:this.editor,popup:BI.extend({type:"bi.single_select_search_pane",valueFormatter:b.valueFormatter,keywordGetter:function(){return a.editor.getValue()},itemsCreator:function(c,d){c.keyword=a.editor.getValue(),this.setKeyword(c.keyword),b.itemsCreator(c,d)}},b.popup),adapter:b.adapter,masker:b.masker}),this.searcher.on(BI.Searcher.EVENT_START,function(){a.fireEvent(BI.SingleSelectSearcher.EVENT_START)}),this.searcher.on(BI.Searcher.EVENT_PAUSE,function(){this.hasMatched(),a.fireEvent(BI.SingleSelectSearcher.EVENT_PAUSE)}),this.searcher.on(BI.Searcher.EVENT_STOP,function(){a.fireEvent(BI.SingleSelectSearcher.EVENT_STOP)}),this.searcher.on(BI.Searcher.EVENT_CHANGE,function(){a.fireEvent(BI.SingleSelectSearcher.EVENT_CHANGE,arguments)}),this.searcher.on(BI.Searcher.EVENT_SEARCHING,function(){var b=this.getKeywords();a.fireEvent(BI.SingleSelectSearcher.EVENT_SEARCHING,b)})},adjustView:function(){this.searcher.adjustView()},isSearching:function(){return this.searcher.isSearching()},stopSearch:function(){this.searcher.stopSearch()},getKeyword:function(){return this.editor.getValue()},hasMatched:function(){return this.searcher.hasMatched()},hasChecked:function(){return this.searcher.getView()&&this.searcher.getView().hasChecked()},setAdapter:function(a){this.searcher.setAdapter(a)},setState:function(a){var b=this.options;a||(a=""),""===a?this.editor.setState(BI.Selection.None):this.editor.setState(b.valueFormatter(a+"")||a+"")},setValue:function(a){this.setState(a),this.searcher.setValue(a)},getKey:function(){return this.editor.getValue()},getValue:function(){return this.searcher.getValue()},populate:function(a){this.searcher.populate.apply(this.searcher,arguments)}}),BI.SingleSelectSearcher.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.SingleSelectSearcher.EVENT_CHANGE="EVENT_CHANGE",BI.SingleSelectSearcher.EVENT_START="EVENT_START",BI.SingleSelectSearcher.EVENT_STOP="EVENT_STOP",BI.SingleSelectSearcher.EVENT_PAUSE="EVENT_PAUSE",BI.SingleSelectSearcher.EVENT_SEARCHING="EVENT_SEARCHING",BI.shortcut("bi.single_select_searcher",BI.SingleSelectSearcher),BI.SingleSelectSearchLoader=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SingleSelectSearchLoader.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-search-loader",itemsCreator:BI.emptyFn,keywordGetter:BI.emptyFn,valueFormatter:BI.emptyFn})},_init:function(){BI.SingleSelectSearchLoader.superclass._init.apply(this,arguments);var a=this,b=this.options,c=!1;this.button_group=BI.createWidget({type:"bi.single_select_list",element:this,logic:{dynamic:!1},el:{tipText:BI.i18nText("BI-No_Select"),el:{type:"bi.loader",isDefaultInit:!1,logic:{dynamic:!0,scrolly:!0},el:{chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,behaviors:{redmark:function(){return!0}},layouts:[{type:"bi.vertical"}]}}},itemsCreator:function(d,e){a.storeValue&&(d=BI.extend(d||{},{selectedValues:[a.storeValue]})),b.itemsCreator(d,function(f){var g=f.keyword=b.keywordGetter();c=f.hasNext;var h=[];if(1===d.times&&a.storeValue){var i=BI.map([a.storeValue],function(a,c){var d=b.valueFormatter(c)||c;return{text:d,value:c,title:d,selected:!1}});h=a._createItems(i)}if(g){for(var j=!1,k=0;k<f.items.length;k++)BI.contains(f.items[k],g)&&(j=!0);if(!j){var l=a._createItems([{text:g,value:g,title:g,selected:!1}]);h=h.concat(l)}}e(h.concat(a._createItems(f.items)),g),1===d.times&&a.storeValue&&a.setValue(a.storeValue)})},hasNext:function(){return c}}),this.button_group.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.button_group.on(BI.SingleSelectList.EVENT_CHANGE,function(){a.fireEvent(BI.SingleSelectSearchLoader.EVENT_CHANGE,arguments)})},_createItems:function(a){return BI.createItems(a,{type:"bi.single_select_radio_item",logic:{dynamic:!1},height:25,selected:!1})},_filterValues:function(a){var b=this.options,c=b.keywordGetter(),d=BI.deepClone(a.value)||[],e=BI.map(d,function(a,c){return{text:b.valueFormatter(c)||c,value:c}});if(BI.isKey(c)){var f=BI.Func.getSearchResult(e,c);d=f.matched.concat(f.finded)}return BI.map(d,function(a,b){return{text:b.text,title:b.text,value:b.value,selected:!1}})},setValue:function(a){this.storeValue=a,this.button_group.setValue(a)},getValue:function(){return this.button_group.getValue()},getAllButtons:function(){return this.button_group.getAllButtons()},empty:function(){this.button_group.empty()},populate:function(a){this.button_group.populate.apply(this.button_group,arguments)},resetHeight:function(a){this.button_group.resetHeight(a)},resetWidth:function(a){this.button_group.resetWidth(a)}}),BI.SingleSelectSearchLoader.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.single_select_search_add_loader",BI.SingleSelectSearchLoader),BI.SingleSelectSearchPane=BI.inherit(BI.Widget,{constants:{height:25,lgap:10,tgap:5},_defaultConfig:function(){return BI.extend(BI.SingleSelectSearchPane.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-search-pane bi-card",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,keywordGetter:BI.emptyFn})},_init:function(){BI.SingleSelectSearchPane.superclass._init.apply(this,arguments);var a=this,b=this.options;this.tooltipClick=BI.createWidget({type:"bi.label",invisible:!0,text:BI.i18nText("BI-Click_Blank_To_Select"),cls:"single-select-toolbar",height:this.constants.height}),this.loader=BI.createWidget({type:"bi.single_select_search_add_loader",keywordGetter:b.keywordGetter,valueFormatter:b.valueFormatter,itemsCreator:function(c,d){b.itemsCreator.apply(a,[c,function(c){d(c),a.setKeyword(b.keywordGetter())}])}}),this.loader.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.resizer=BI.createWidget({type:"bi.vtape",element:this,items:[{el:this.tooltipClick,height:0},{el:this.loader}]}),this.tooltipClick.setVisible(!1)},setKeyword:function(a){var b,c=this.loader.getAllButtons().length>0&&(b=this.loader.getAllButtons()[0])&&a===b.getValue();c!==this.tooltipClick.isVisible()&&(this.tooltipClick.setVisible(c),this.resizer.attr("items")[0].height=c?this.constants.height:0,this.resizer.resize())},hasMatched:function(){return this.tooltipClick.isVisible()},setValue:function(a){this.loader.setValue(a)},getValue:function(){return this.loader.getValue()},empty:function(){this.loader.empty()},populate:function(a){this.loader.populate.apply(this.loader,arguments)}}),BI.SingleSelectSearchPane.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.single_select_search_add_pane",BI.SingleSelectSearchPane),BI.SingleSelectCombo=BI.inherit(BI.Single,{_defaultConfig:function(){return BI.extend(BI.SingleSelectCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-combo",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,height:28})},_init:function(){BI.SingleSelectCombo.superclass._init.apply(this,arguments);var a=this,b=this.options,c=function(){BI.isKey(a._startValue)&&(a.storeValue=a._startValue),a.trigger.getSearcher().setState(a.storeValue)};this.storeValue="",this.requesting=!1,this.trigger=BI.createWidget({type:"bi.single_select_add_trigger",height:b.height,masker:{offset:{left:1,top:1,right:2,bottom:33}},valueFormatter:b.valueFormatter,itemsCreator:function(c,d){b.itemsCreator(c,function(b){1===c.times&&BI.isNotNull(c.keywords)&&a.trigger.setValue(a.getValue()),d.apply(a,arguments)})}}),this.trigger.on(BI.SingleSelectTrigger.EVENT_START,function(){a._setStartValue(""),this.getSearcher().setValue(a.storeValue)}),this.trigger.on(BI.SingleSelectTrigger.EVENT_STOP,function(){a._setStartValue("")}),this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE,function(){if(this.getSearcher().hasMatched()){var b=this.getSearcher().getKeyword();a._join({type:BI.Selection.Multi,value:[b]},function(){a.combo.setValue(a.storeValue),a._setStartValue(b),c(),a.populate(),a._setStartValue("")})}}),this.trigger.on(BI.SingleSelectTrigger.EVENT_SEARCHING,function(b){var d=BI.last(b);b=BI.initial(b||[]),b.length>0&&a._joinKeywords(b,function(){BI.isEndWithBlank(d)?(a.combo.setValue(a.storeValue),c(),a.combo.populate(),a._setStartValue("")):(a.combo.setValue(a.storeValue),c())})}),this.trigger.on(BI.SingleSelectTrigger.EVENT_CHANGE,function(b,d){a.storeValue=this.getValue(),c()}),this.trigger.on(BI.SingleSelectTrigger.EVENT_COUNTER_CLICK,function(){a.combo.isViewVisible()||a.combo.showView()}),this.combo=BI.createWidget({type:"bi.combo",toggle:!1,el:this.trigger,adjustLength:1,popup:{type:"bi.single_select_popup_view",ref:function(){a.popup=this,a.trigger.setAdapter(this)},listeners:[{eventName:BI.SingleSelectPopupView.EVENT_CHANGE,action:function(){a.storeValue=this.getValue(),a._adjust(function(){c()})}},{eventName:BI.SingleSelectPopupView.EVENT_CLICK_CONFIRM,action:function(){a._defaultState()}},{eventName:BI.SingleSelectPopupView.EVENT_CLICK_CLEAR,action:function(){a.setValue(),a._defaultState()}}],itemsCreator:b.itemsCreator,valueFormatter:b.valueFormatter,onLoaded:function(){BI.nextTick(function(){a.combo.adjustWidth(),a.combo.adjustHeight(),a.trigger.getSearcher().adjustView()})}},hideChecker:function(a){return 0===d.element.find(a.target).length}}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){this.setValue(a.storeValue),BI.nextTick(function(){a.populate()})}),this.wants2Quit=!1,this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW,function(){a.trigger.stopEditing(),a.requesting===!0?a.wants2Quit=!0:a.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM)});var d=BI.createWidget({type:"bi.trigger_icon_button",width:b.height,height:b.height,cls:"single-select-trigger-icon-button bi-border-left"});d.on(BI.TriggerIconButton.EVENT_CHANGE,function(){a.combo.isViewVisible()?a.combo.hideView():a.combo.showView()}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.combo,left:0,right:0,top:0,bottom:0},{el:d,right:0,top:0,bottom:0}]})},_defaultState:function(){this.trigger.stopEditing(),this.combo.hideView()},_assertValue:function(a){a||(a="")},_makeMap:function(a){return BI.makeObject(a||[])},_joinKeywords:function(a,b){function c(c){var e=d._makeMap(c);BI.each(a,function(a,b){BI.isNotNull(e[b])&&d.storeValue.value.remove(b)}),d._adjust(b)}var d=this,e=this.options;this._assertValue(this.storeValue),this.requesting=!0,e.itemsCreator({type:BI.SingleSelectCombo.REQ_GET_ALL_DATA,keywords:a},function(a){var b=BI.pluck(a.items,"value");c(b)})},_joinAll:function(a,b){var c=this,d=this.options;this._assertValue(a),this.requesting=!0,d.itemsCreator({type:BI.SingleSelectCombo.REQ_GET_ALL_DATA,keywords:[this.trigger.getKey()]},function(d){var e=BI.pluck(d.items,"value");if(c.storeValue.type===a.type){var f=!1,g=c._makeMap(c.storeValue.value);return BI.each(e,function(a,b){BI.isNotNull(g[b])&&(f=!0,delete g[b])}),f&&(c.storeValue.value=BI.values(g)),void c._adjust(b)}var h=c._makeMap(c.storeValue.value),i=c._makeMap(a.value),j=[];BI.each(e,function(a,b){BI.isNotNull(h[e[a]])&&delete h[e[a]],BI.isNull(i[e[a]])&&j.push(b)}),c.storeValue.value=j.concat(BI.values(h)),c._adjust(b)})},_adjust:function(a){function b(){c.wants2Quit===!0&&(c.fireEvent(BI.SingleSelectCombo.EVENT_CONFIRM),c.wants2Quit=!1),c.requesting=!1}var c=this,d=this.options;this._count?(b(),a()):d.itemsCreator({type:BI.SingleSelectCombo.REQ_GET_DATA_LENGTH},function(d){c._count=d.count,b(),a()})},_join:function(a,b){var c=this;this.options;if(this._assertValue(a),this._assertValue(this.storeValue),this.storeValue.type===a.type){var d=this._makeMap(this.storeValue.value);BI.each(a.value,function(a,b){d[b]||(c.storeValue.value.push(b),d[b]=b)});var e=!1;return BI.each(a.assist,function(a,b){BI.isNotNull(d[b])&&(e=!0,delete d[b])}),e&&(this.storeValue.value=BI.values(d)),void c._adjust(b)}this._joinAll(a,b)},_setStartValue:function(a){this._startValue=a,this.popup.setStartValue(a)},setValue:function(a){this.storeValue=a||"",this._assertValue(this.storeValue),this.combo.setValue(this.storeValue)},getValue:function(){return this.storeValue},populate:function(){this._count=null,this.combo.populate.apply(this.combo,arguments)}}),BI.extend(BI.SingleSelectCombo,{REQ_GET_DATA_LENGTH:0,REQ_GET_ALL_DATA:-1}),BI.SingleSelectCombo.EVENT_CONFIRM="EVENT_CONFIRM",BI.shortcut("bi.single_select_add_combo",BI.SingleSelectCombo),BI.SingleSelectTrigger=BI.inherit(BI.Trigger,{constants:{height:14,rgap:4,lgap:4},_defaultConfig:function(){return BI.extend(BI.SingleSelectTrigger.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-trigger bi-border",itemsCreator:BI.emptyFn,valueFormatter:BI.emptyFn,searcher:{},switcher:{},adapter:null,masker:{}})},_init:function(){BI.SingleSelectTrigger.superclass._init.apply(this,arguments);var a=this,b=this.options;b.height&&this.setHeight(b.height-2),this.searcher=BI.createWidget(b.searcher,{type:"bi.single_select_add_searcher",height:b.height,itemsCreator:b.itemsCreator,valueFormatter:b.valueFormatter,popup:{},adapter:b.adapter,masker:b.masker}),this.searcher.on(BI.SingleSelectSearcher.EVENT_START,function(){a.fireEvent(BI.SingleSelectTrigger.EVENT_START)}),this.searcher.on(BI.SingleSelectSearcher.EVENT_PAUSE,function(){a.fireEvent(BI.SingleSelectTrigger.EVENT_PAUSE)}),this.searcher.on(BI.SingleSelectSearcher.EVENT_SEARCHING,function(){a.fireEvent(BI.SingleSelectTrigger.EVENT_SEARCHING,arguments)}),this.searcher.on(BI.SingleSelectSearcher.EVENT_STOP,function(){a.fireEvent(BI.SingleSelectTrigger.EVENT_STOP)}),this.searcher.on(BI.SingleSelectSearcher.EVENT_CHANGE,function(){a.fireEvent(BI.SingleSelectTrigger.EVENT_CHANGE,arguments)});BI.createWidget({type:"bi.htape",element:this,items:[{el:this.searcher,width:"fill"},{el:BI.createWidget(),width:30}]})},getSearcher:function(){return this.searcher},stopEditing:function(){this.searcher.stopSearch()},setAdapter:function(a){this.searcher.setAdapter(a)},setValue:function(a){this.searcher.setValue(a)},getKey:function(){return this.searcher.getKey()},getValue:function(){return this.searcher.getValue()}}),BI.SingleSelectTrigger.EVENT_TRIGGER_CLICK="EVENT_TRIGGER_CLICK",BI.SingleSelectTrigger.EVENT_COUNTER_CLICK="EVENT_COUNTER_CLICK",BI.SingleSelectTrigger.EVENT_CHANGE="EVENT_CHANGE",BI.SingleSelectTrigger.EVENT_START="EVENT_START",BI.SingleSelectTrigger.EVENT_STOP="EVENT_STOP",BI.SingleSelectTrigger.EVENT_PAUSE="EVENT_PAUSE",BI.SingleSelectTrigger.EVENT_SEARCHING="EVENT_SEARCHING",BI.SingleSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW="EVENT_BEFORE_COUNTER_POPUPVIEW",BI.shortcut("bi.single_select_add_trigger",BI.SingleSelectTrigger),BI.SingleSelectSearcher=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SingleSelectSearcher.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-select-searcher",itemsCreator:BI.emptyFn,el:{},popup:{},valueFormatter:BI.emptyFn,adapter:null,masker:{}})},_init:function(){BI.SingleSelectSearcher.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget(b.el,{type:"bi.single_select_editor",height:b.height}),this.searcher=BI.createWidget({type:"bi.searcher",element:this,height:b.height,isAutoSearch:!1,isAutoSync:!1,onSearch:function(a,b){b()},el:this.editor,popup:BI.extend({type:"bi.single_select_search_add_pane",valueFormatter:b.valueFormatter,keywordGetter:function(){return a.editor.getValue()},itemsCreator:function(c,d){c.keyword=a.editor.getValue(),this.setKeyword(c.keyword),b.itemsCreator(c,d)}},b.popup),adapter:b.adapter,masker:b.masker}),this.searcher.on(BI.Searcher.EVENT_START,function(){a.fireEvent(BI.SingleSelectSearcher.EVENT_START)}),this.searcher.on(BI.Searcher.EVENT_PAUSE,function(){this.hasMatched(),a.fireEvent(BI.SingleSelectSearcher.EVENT_PAUSE)}),this.searcher.on(BI.Searcher.EVENT_STOP,function(){a.fireEvent(BI.SingleSelectSearcher.EVENT_STOP)}),this.searcher.on(BI.Searcher.EVENT_CHANGE,function(){a.fireEvent(BI.SingleSelectSearcher.EVENT_CHANGE,arguments)}),this.searcher.on(BI.Searcher.EVENT_SEARCHING,function(){var b=this.getKeywords();a.fireEvent(BI.SingleSelectSearcher.EVENT_SEARCHING,b)})},adjustView:function(){this.searcher.adjustView()},isSearching:function(){return this.searcher.isSearching()},stopSearch:function(){this.searcher.stopSearch()},getKeyword:function(){return this.editor.getValue()},hasMatched:function(){return this.searcher.hasMatched()},hasChecked:function(){return this.searcher.getView()&&this.searcher.getView().hasChecked()},setAdapter:function(a){this.searcher.setAdapter(a)},setState:function(a){var b=this.options;a||(a=""),""===a?this.editor.setState(BI.Selection.None):this.editor.setState(b.valueFormatter(a+"")||a+"")},setValue:function(a){this.setState(a),this.searcher.setValue(a)},getKey:function(){return this.editor.getValue()},getValue:function(){return this.searcher.getValue()},populate:function(a){this.searcher.populate.apply(this.searcher,arguments)}}),BI.SingleSelectSearcher.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.SingleSelectSearcher.EVENT_CHANGE="EVENT_CHANGE",BI.SingleSelectSearcher.EVENT_START="EVENT_START",BI.SingleSelectSearcher.EVENT_STOP="EVENT_STOP",BI.SingleSelectSearcher.EVENT_PAUSE="EVENT_PAUSE",BI.SingleSelectSearcher.EVENT_SEARCHING="EVENT_SEARCHING",BI.shortcut("bi.single_select_add_searcher",BI.SingleSelectSearcher),BI.SignTextEditor=BI.inherit(BI.Widget,{_defaultConfig:function(){var a=BI.SignTextEditor.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-sign-initial-editor",hgap:4,vgap:2,lgap:0,rgap:0,tgap:0,bgap:0,validationChecker:BI.emptyFn,quitChecker:BI.emptyFn,allowBlank:!0,watermark:"",errorText:"",text:"",height:24})},_init:function(){BI.SignTextEditor.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget({type:"bi.editor",height:b.height,hgap:b.hgap,vgap:b.vgap,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,value:b.value,validationChecker:b.validationChecker,quitChecker:b.quitChecker,allowBlank:b.allowBlank,watermark:b.watermark,errorText:b.errorText}),this.text=BI.createWidget({type:"bi.text_button",cls:"sign-editor-text",title:b.title,warningTitle:b.warningTitle,tipType:b.tipType,textAlign:"left",height:b.height,hgap:4,handler:function(){a._showInput(),a.editor.focus(),a.editor.selectAll()}}),this.text.on(BI.TextButton.EVENT_CHANGE,function(){BI.nextTick(function(){a.fireEvent(BI.SignTextEditor.EVENT_CLICK_LABEL)})}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.text,left:0,right:0,top:0,bottom:0}]}),this.editor.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.editor.on(BI.Editor.EVENT_CONFIRM,function(){a._showHint(),a._checkText(),a.fireEvent(BI.SignTextEditor.EVENT_CONFIRM,arguments)}),this.editor.on(BI.Editor.EVENT_ERROR,function(){a._checkText()}),BI.createWidget({type:"bi.vertical",scrolly:!1,element:this,items:[this.editor]}),this._showHint(),a._checkText()},_checkText:function(){var a=this.options;BI.nextTick(BI.bind(function(){if(""===this.editor.getValue())this.text.setValue(a.watermark||""),this.text.element.addClass("bi-water-mark");else{var b=this.editor.getValue();b=BI.isEmpty(b)||b==a.text?a.text:b+a.text,this.text.setValue(b),this.text.element.removeClass("bi-water-mark")}},this))},_showInput:function(){this.editor.visible(),this.text.invisible()},_showHint:function(){this.editor.invisible(),this.text.visible()},setTitle:function(a){this.text.setTitle(a)},setWarningTitle:function(a){this.text.setWarningTitle(a)},focus:function(){this._showInput(),this.editor.focus()},blur:function(){this.editor.blur(),this._showHint(),this._checkText()},doRedMark:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){""===this.editor.getValue()&&BI.isKey(this.options.watermark)||this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)},isValid:function(){return this.editor.isValid()},setErrorText:function(a){this.editor.setErrorText(a)},getErrorText:function(){return this.editor.getErrorText()},isEditing:function(){return this.editor.isEditing()},getLastValidValue:function(){return this.editor.getLastValidValue()},setValue:function(a){this.editor.setValue(a),this._checkText()},getValue:function(){return this.editor.getValue()},getState:function(){return this.text.getValue()},setState:function(a){var b=this.options;this._showHint(),a=BI.isEmpty(a)||a==b.text?b.text:a+b.text,this.text.setValue(a)}}),BI.SignTextEditor.EVENT_CONFIRM="EVENT_CONFIRM",BI.SignTextEditor.EVENT_CLICK_LABEL="EVENT_CLICK_LABEL",BI.shortcut("bi.sign_text_editor",BI.SignTextEditor),BI.SliderIconButton=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SliderIconButton.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-slider-button"})},_init:function(){BI.extend(BI.SliderIconButton.superclass._init.apply(this,arguments)),this.slider=BI.createWidget({type:"bi.icon_button",cls:"slider-icon slider-button",iconWidth:14,iconHeight:14,height:14,width:14}),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.slider,top:7,left:-7}],width:0,height:14})}}),BI.shortcut("bi.single_slider_button",BI.SliderIconButton),BI.SingleSlider=BI.inherit(BI.Widget,{_constant:{EDITOR_WIDTH:90,EDITOR_HEIGHT:30,SLIDER_WIDTH_HALF:15,SLIDER_WIDTH:30,SLIDER_HEIGHT:30,TRACK_HEIGHT:24},_defaultConfig:function(){return BI.extend(BI.SingleSlider.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-slider bi-slider-track",digit:!1,unit:""})},_init:function(){BI.SingleSlider.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._constant;this.enable=!1,this.value="",this.grayTrack=BI.createWidget({type:"bi.layout",cls:"gray-track",height:6}),this.blueTrack=BI.createWidget({type:"bi.layout",cls:"blue-track bi-high-light-background",height:6}),this.track=this._createTrackWrapper(),this.slider=BI.createWidget({type:"bi.single_slider_button"}),this._draggable(this.slider);var d=BI.createWidget({type:"bi.vertical",items:[{type:"bi.absolute",items:[this.slider]}],hgap:c.SLIDER_WIDTH_HALF,height:c.SLIDER_HEIGHT});d.element.click(function(d){if(a.enable){var e=d.clientX-a.element.offset().left-c.SLIDER_WIDTH_HALF,f=a.track.element[0].scrollWidth,g=0;e<0&&(g=0),e>0&&e<f-c.SLIDER_WIDTH&&(g=100*e/a._getGrayTrackLength()),e>f-c.SLIDER_WIDTH&&(g=100);var h=BI.parseFloat(g.toFixed(1));a._setAllPosition(h);var i=a._getValueByPercent(h);i=b.digit===!1?i:i.toFixed(b.digit),a.label.setValue(i),a.value=i,a.fireEvent(BI.SingleSlider.EVENT_CHANGE)}}),this.label=BI.createWidget({type:"bi.sign_text_editor",cls:"slider-editor-button",errorText:"",text:b.unit,width:c.EDITOR_WIDTH-2,allowBlank:!1,validationChecker:function(b){return a._checkValidation(b)}}),this.label.element.hover(function(){a.label.element.removeClass("bi-border").addClass("bi-border")},function(){a.label.element.removeClass("bi-border")}),this.label.on(BI.SignEditor.EVENT_CONFIRM,function(){var b=BI.parseFloat(this.getValue()),c=a._getPercentByValue(b),d=BI.parseFloat(c.toFixed(1));a._setAllPosition(d),this.setValue(b),a.value=b,a.fireEvent(BI.SingleSlider.EVENT_CHANGE)}),this._setVisible(!1),BI.createWidget({type:"bi.absolute",element:this,items:[{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[{el:this.track,width:"100%",height:c.TRACK_HEIGHT}]}],hgap:7,height:c.TRACK_HEIGHT},top:23,left:0,width:"100%"},{el:d,top:20,left:0,width:"100%"},{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[this.label]}],rgap:c.EDITOR_WIDTH,height:c.EDITOR_HEIGHT},top:0,left:0,width:"100%"}]})},_draggable:function(a){function b(a){return BI.clamp(a,0,c._getGrayTrackLength())}var c=this,d=this.options,e=!1,f=0,g=0,h=0,i=new BI.MouseMoveTracker(function(j){if(i.isDragging()){e=!0,g+=j,f=b(h+g),a.element.addClass("dragging");var k=100*f/c._getGrayTrackLength(),l=BI.parseFloat(k.toFixed(1));c._setBlueTrack(l),c._setLabelPosition(l),c._setSliderPosition(l);var m=c._getValueByPercent(l);m=d.digit===!1?m:m.toFixed(d.digit),c.label.setValue(m),c.value=m,c.fireEvent(BI.SingleSlider.EVENT_CHANGE)}},function(){if(e===!0){f=b(f);var d=100*f/c._getGrayTrackLength(),j=BI.parseFloat(d.toFixed(1));c._setSliderPosition(j),f=0,g=0,h=f,e=!1}a.element.removeClass("dragging"),i.releaseMouseMoves(),c.fireEvent(BI.SingleSlider.EVENT_CHANGE)},document);a.element.on("mousedown",function(c){a.isEnabled()&&(h=this.offsetLeft,b(h),i.captureMouseMoves(c))})},_createTrackWrapper:function(){return BI.createWidget({type:"bi.absolute",items:[{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[{el:this.grayTrack,top:0,left:0,width:"100%"},{el:this.blueTrack,top:0,left:0,width:"0%"}]}],hgap:8,height:8},top:8,left:0,width:"100%"}]})},_checkValidation:function(a){var b=this.options,c=!1;if(BI.isNumeric(a)&&!(BI.isNull(a)||a<this.min||a>this.max))if(b.digit===!1)c=!0;else{var d=(a+"").split(".")[1]||"";c=d.length===b.digit}return c},_setBlueTrack:function(a){this.blueTrack.element.css({width:a+"%"})},_setLabelPosition:function(a){this.label.element.css({left:a+"%"})},_setSliderPosition:function(a){this.slider.element.css({left:a+"%"})},_setAllPosition:function(a){this._setSliderPosition(a),this._setLabelPosition(a),this._setBlueTrack(a)},_setVisible:function(a){this.slider.setVisible(a),this.label.setVisible(a)},_getGrayTrackLength:function(){return this.grayTrack.element[0].scrollWidth},_getValueByPercent:function(a){var b=BI.parseInt(10*a);return(this.max-this.min)*b/1e3+this.min},_getPercentByValue:function(a){return 100*(a-this.min)/(this.max-this.min)},getValue:function(){return this.value},setValue:function(a){var b=this.options;a=BI.parseFloat(a),a=b.digit===!1?a:a.toFixed(b.digit),isNaN(a)||(this._checkValidation(a)&&(this.value=a),a>this.max&&(this.value=this.max),a<this.min&&(this.value=this.min))},setMinAndMax:function(a){var b=BI.parseFloat(a.min),c=BI.parseFloat(a.max);!isNaN(b)&&!isNaN(c)&&c>b&&(this.min=b,this.max=c)},reset:function(){this._setVisible(!1),this.enable=!1,this.value="",this.min=0,this.max=0,this._setBlueTrack(0)},populate:function(){isNaN(this.min)||isNaN(this.max)||(this._setVisible(!0),this.enable=!0,this.label.setErrorText(BI.i18nText("BI-Please_Enter")+this.min+"-"+this.max+BI.i18nText("BI-Basic_De")+BI.i18nText("BI-Basic_Number")),BI.isNumeric(this.value)||BI.isNotEmptyString(this.value)?(this.label.setValue(this.value),
this._setAllPosition(this._getPercentByValue(this.value))):(this.label.setValue(this.max),this._setAllPosition(100)))}}),BI.SingleSlider.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.single_slider",BI.SingleSlider),BI.SingleSliderLabel=BI.inherit(BI.Widget,{_constant:{EDITOR_WIDTH:90,EDITOR_HEIGHT:20,HEIGHT:20,SLIDER_WIDTH_HALF:15,SLIDER_WIDTH:30,SLIDER_HEIGHT:30,TRACK_HEIGHT:24},_defaultConfig:function(){return BI.extend(BI.SingleSliderLabel.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-slider-label bi-slider-track",digit:!1,unit:""})},_init:function(){BI.SingleSliderLabel.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._constant;this.enable=!1,this.value="",this.grayTrack=BI.createWidget({type:"bi.layout",cls:"gray-track",height:6}),this.blueTrack=BI.createWidget({type:"bi.layout",cls:"blue-track bi-high-light-background",height:6}),this.track=this._createTrackWrapper(),this.slider=BI.createWidget({type:"bi.single_slider_button"}),this._draggable(this.slider);var d=BI.createWidget({type:"bi.vertical",items:[{type:"bi.absolute",items:[this.slider]}],hgap:c.SLIDER_WIDTH_HALF,height:c.SLIDER_HEIGHT});d.element.click(function(d){if(a.enable){var e=d.clientX-a.element.offset().left-c.SLIDER_WIDTH_HALF,f=a.track.element[0].scrollWidth,g=0;e<0&&(g=0),e>0&&e<f-c.SLIDER_WIDTH&&(g=100*e/a._getGrayTrackLength()),e>f-c.SLIDER_WIDTH&&(g=100);var h=BI.parseFloat(g.toFixed(1));a._setAllPosition(h);var i=a._getValueByPercent(h);i=b.digit===!1?i:i.toFixed(b.digit),a.label.setText(i+b.unit),a.value=i,a.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE)}}),this.label=BI.createWidget({type:"bi.label",height:c.HEIGHT,width:c.EDITOR_WIDTH-2}),this._setVisible(!1),BI.createWidget({type:"bi.absolute",element:this,items:[{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[{el:this.track,width:"100%",height:c.TRACK_HEIGHT}]}],hgap:7,height:c.TRACK_HEIGHT},top:13,left:0,width:"100%"},{el:d,top:10,left:0,width:"100%"},{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[this.label]}],rgap:c.EDITOR_WIDTH,height:c.EDITOR_HEIGHT},top:0,left:0,width:"100%"}]})},_draggable:function(a){function b(a){return BI.clamp(a,0,c._getGrayTrackLength())}var c=this,d=this.options,e=!1,f=0,g=0,h=0,i=new BI.MouseMoveTracker(function(j){if(i.isDragging()){e=!0,g+=j,f=b(h+g),a.element.addClass("dragging");var k=100*f/c._getGrayTrackLength(),l=BI.parseFloat(k.toFixed(1));c._setBlueTrack(l),c._setLabelPosition(l),c._setSliderPosition(l);var m=c._getValueByPercent(l);m=d.digit===!1?m:m.toFixed(d.digit),c.label.setValue(m),c.value=m,c.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE)}},function(){if(e===!0){f=b(f);var d=100*f/c._getGrayTrackLength(),j=BI.parseFloat(d.toFixed(1));c._setSliderPosition(j),f=0,g=0,h=f,e=!1}a.element.removeClass("dragging"),i.releaseMouseMoves(),c.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE)},document);a.element.on("mousedown",function(c){a.isEnabled()&&(h=this.offsetLeft,b(h),i.captureMouseMoves(c))})},_createTrackWrapper:function(){return BI.createWidget({type:"bi.absolute",items:[{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[{el:this.grayTrack,top:0,left:0,width:"100%"},{el:this.blueTrack,top:0,left:0,width:"0%"}]}],hgap:8,height:8},top:8,left:0,width:"100%"}]})},_checkValidation:function(a){return BI.isNumeric(a)&&!(BI.isNull(a)||a<this.min||a>this.max)},_setBlueTrack:function(a){this.blueTrack.element.css({width:a+"%"})},_setLabelPosition:function(a){this.label.element.css({left:a+"%"})},_setSliderPosition:function(a){this.slider.element.css({left:a+"%"})},_setAllPosition:function(a){this._setSliderPosition(a),this._setLabelPosition(a),this._setBlueTrack(a)},_setVisible:function(a){this.slider.setVisible(a),this.label.setVisible(a)},_getGrayTrackLength:function(){return this.grayTrack.element[0].scrollWidth},_getValueByPercent:function(a){var b=BI.parseInt(10*a);return(this.max-this.min)*b/1e3+this.min},_getPercentByValue:function(a){return 100*(a-this.min)/(this.max-this.min)},getValue:function(){return this.value},setValue:function(a){var b=this.options;a=BI.parseFloat(a),a=b.digit===!1?a:a.toFixed(b.digit),isNaN(a)||(this._checkValidation(a)&&(this.value=a),a>this.max&&(this.value=this.max),a<this.min&&(this.value=this.min))},setMinAndMax:function(a){var b=BI.parseFloat(a.min),c=BI.parseFloat(a.max);!isNaN(b)&&!isNaN(c)&&c>b&&(this.min=b,this.max=c)},reset:function(){this._setVisible(!1),this.enable=!1,this.value="",this.min=0,this.max=0,this._setBlueTrack(0)},populate:function(){var a=this.options;isNaN(this.min)||isNaN(this.max)||(this._setVisible(!0),this.enable=!0,BI.isNumeric(this.value)||BI.isNotEmptyString(this.value)?(this.label.setValue(this.value+a.unit),this._setAllPosition(this._getPercentByValue(this.value))):(this.label.setValue(this.max+a.unit),this._setAllPosition(100)))}}),BI.SingleSliderLabel.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.single_slider_label",BI.SingleSliderLabel),BI.SingleSliderNormal=BI.inherit(BI.Widget,{_constant:{HEIGHT:28,SLIDER_WIDTH_HALF:15,SLIDER_WIDTH:30,SLIDER_HEIGHT:30,TRACK_HEIGHT:24},props:{baseCls:"bi-single-slider-normal bi-slider-track",minMax:{min:0,max:100}},render:function(){var a=this,b=this._constant,c=this._createTrack();this.slider=BI.createWidget({type:"bi.single_slider_button"}),this._draggable(this.slider);var d=BI.createWidget({type:"bi.vertical",items:[{type:"bi.absolute",items:[this.slider]}],hgap:b.SLIDER_WIDTH_HALF,height:b.SLIDER_HEIGHT});return d.element.click(function(c){if(a.enable){var d=c.clientX-a.element.offset().left-b.SLIDER_WIDTH_HALF,e=a.track.element[0].scrollWidth,f=0;d<0&&(f=0),d>0&&d<e-b.SLIDER_WIDTH&&(f=100*d/a._getGrayTrackLength()),d>e-b.SLIDER_WIDTH&&(f=100);var g=BI.parseFloat(f.toFixed(1));a._setAllPosition(g);var h=a._getValueByPercent(g);a.value=h,a.fireEvent(BI.SingleSlider.EVENT_CHANGE)}}),{type:"bi.absolute",element:this,items:[{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[{el:c,width:"100%",height:b.TRACK_HEIGHT}]}],hgap:7,height:b.TRACK_HEIGHT},top:3,left:0,width:"100%"},{el:d,top:0,left:0,width:"100%"}]}},_draggable:function(a){function b(a){return BI.clamp(a,0,c._getGrayTrackLength())}var c=this,d=this.options,e=!1,f=0,g=0,h=0,i=new BI.MouseMoveTracker(function(j){if(i.isDragging()){e=!0,g+=j,f=b(h+g),a.element.addClass("dragging");var k=100*f/c._getGrayTrackLength(),l=BI.parseFloat(k.toFixed(1));c._setBlueTrack(l),c._setSliderPosition(l);var m=c._getValueByPercent(l);m=d.digit===!1?m:m.toFixed(d.digit),c.value=m,c.fireEvent(BI.SingleSliderNormal.EVENT_DRAG,m)}},function(){if(e===!0){f=b(f);var d=100*f/c._getGrayTrackLength(),j=BI.parseFloat(d.toFixed(1));c._setSliderPosition(j),f=0,g=0,h=f,e=!1}a.element.removeClass("dragging"),i.releaseMouseMoves(),c.fireEvent(BI.SingleSlider.EVENT_CHANGE)},document);a.element.on("mousedown",function(c){a.isEnabled()&&(h=this.offsetLeft,b(h),i.captureMouseMoves(c))})},_createTrack:function(){var a=this;this._constant;return this.grayTrack=BI.createWidget({type:"bi.layout",cls:"gray-track",height:6}),this.blueTrack=BI.createWidget({type:"bi.layout",cls:"blue-track bi-high-light-background",height:6}),this.options.color&&this.blueTrack.element.css({"background-color":this.options.color}),{type:"bi.absolute",items:[{el:{type:"bi.vertical",items:[{type:"bi.absolute",items:[{el:this.grayTrack,top:0,left:0,width:"100%"},{el:this.blueTrack,top:0,left:0,width:"0%"}]}],hgap:8,height:8},top:8,left:0,width:"100%"}],ref:function(b){a.track=b}}},_checkValidation:function(a){return!(BI.isNull(a)||a<this.min||a>this.max)},_setBlueTrack:function(a){this.blueTrack.element.css({width:a+"%"})},_setSliderPosition:function(a){this.slider.element.css({left:a+"%"})},_setAllPosition:function(a){this._setSliderPosition(a),this._setBlueTrack(a)},_setVisible:function(a){this.slider.setVisible(a)},_getGrayTrackLength:function(){return this.grayTrack.element[0].scrollWidth},_getValueByPercent:function(a){var b=BI.parseInt(10*a);return(this.max-this.min)*b/1e3+this.min},_getPercentByValue:function(a){return 100*(a-this.min)/(this.max-this.min)},getValue:function(){return this.value},setValue:function(a){var b=BI.parseFloat(a);isNaN(b)||(this._checkValidation(b)&&(this.value=b),b>this.max&&(this.value=this.max),b<this.min&&(this.value=this.min))},setMinAndMax:function(a){var b=BI.parseFloat(a.min),c=BI.parseFloat(a.max);!isNaN(b)&&!isNaN(c)&&c>b&&(this.min=b,this.max=c)},reset:function(){this._setVisible(!1),this.enable=!1,this.value="",this.min=0,this.max=0,this._setBlueTrack(0)},populate:function(){isNaN(this.min)||isNaN(this.max)||(this._setVisible(!0),this.enable=!0,BI.isNumeric(this.value)||BI.isNotEmptyString(this.value)?this._setAllPosition(this._getPercentByValue(this.value)):this._setAllPosition(100))}}),BI.SingleSliderNormal.EVENT_DRAG="EVENT_DRAG",BI.shortcut("bi.single_slider_normal",BI.SingleSliderNormal),BI.SingleTreeCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SingleTreeCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-tree-combo",trigger:{},height:24,text:"",items:[]})},_init:function(){BI.SingleTreeCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.trigger=BI.createWidget(BI.extend({type:"bi.single_tree_trigger",text:b.text,height:b.height,items:b.items},b.trigger)),this.popup=BI.createWidget({type:"bi.single_level_tree",items:b.items}),this.combo=BI.createWidget({type:"bi.combo",element:this,adjustLength:2,el:this.trigger,popup:{el:this.popup}}),this.combo.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){a.fireEvent(BI.SingleTreeCombo.EVENT_BEFORE_POPUPVIEW,arguments)}),this.popup.on(BI.SingleTreePopup.EVENT_CHANGE,function(){a.setValue(a.popup.getValue()),a.combo.hideView(),a.fireEvent(BI.SingleTreeCombo.EVENT_CHANGE)})},populate:function(a){this.combo.populate(a)},setValue:function(a){a=BI.isArray(a)?a:[a],this.trigger.setValue(a),this.popup.setValue(a)},getValue:function(){return this.popup.getValue()}}),BI.SingleTreeCombo.EVENT_CHANGE="SingleTreeCombo.EVENT_CHANGE",BI.SingleTreeCombo.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.shortcut("bi.single_tree_combo",BI.SingleTreeCombo),BI.SingleTreePopup=BI.inherit(BI.Pane,{_defaultConfig:function(){return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-level-tree",tipText:BI.i18nText("BI-No_Selected_Item"),items:[]})},_init:function(){BI.SingleTreePopup.superclass._init.apply(this,arguments);var a=this,b=this.options;this.tree=BI.createWidget({type:"bi.level_tree",expander:{isDefaultInit:!0},items:b.items,chooseType:BI.Selection.Single}),BI.createWidget({type:"bi.vertical",element:this,items:[this.tree]}),this.tree.on(BI.Controller.EVENT_CHANGE,function(){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments)}),this.tree.on(BI.LevelTree.EVENT_CHANGE,function(){a.fireEvent(BI.SingleTreePopup.EVENT_CHANGE)}),this.check()},getValue:function(){return this.tree.getValue()},setValue:function(a){a=BI.isArray(a)?a:[a],this.tree.setValue(a)},populate:function(a){BI.SingleTreePopup.superclass.populate.apply(this,arguments),this.tree.populate(a)}}),BI.SingleTreePopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.single_level_tree",BI.SingleTreePopup),BI.SingleTreeTrigger=BI.inherit(BI.Trigger,{_defaultConfig:function(){return BI.extend(BI.SingleTreeTrigger.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-single-tree-trigger",height:24,text:"",items:[]})},_init:function(){BI.SingleTreeTrigger.superclass._init.apply(this,arguments);var a=this.options;this.trigger=BI.createWidget({type:"bi.select_text_trigger",element:this,text:a.text,items:a.items,height:a.height})},_checkTitle:function(){var a=this,b=this.getValue();BI.any(this.options.items,function(c,d){if(b.contains(d.value))return a.trigger.setTitle(d.text||d.value),!0})},setValue:function(a){a=BI.isArray(a)?a:[a],this.options.value=a,this.trigger.setValue(a),this._checkTitle()},getValue:function(){return this.options.value||[]},populate:function(a){BI.SingleTreeTrigger.superclass.populate.apply(this,arguments),this.trigger.populate(a)}}),BI.shortcut("bi.single_tree_trigger",BI.SingleTreeTrigger),BI.SwitchTree=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.SwitchTree.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-switch-tree",items:[]})},_init:function(){BI.SwitchTree.superclass._init.apply(this,arguments);this.options;this.tab=BI.createWidget({type:"bi.tab",element:this,tab:null,defaultShowIndex:BI.SwitchTree.SelectType.SingleSelect,cardCreator:BI.bind(this._createTree,this)})},_createTree:function(a){var b=this,c=this.options;switch(a){case BI.SwitchTree.SelectType.SingleSelect:return this.levelTree=BI.createWidget({type:"bi.multilayer_single_level_tree",isDefaultInit:!0,items:BI.deepClone(c.items)}),this.levelTree.on(BI.LevelTree.EVENT_CHANGE,function(){b.fireEvent(BI.SwitchTree.EVENT_CHANGE,arguments)}),this.levelTree;case BI.SwitchTree.SelectType.MultiSelect:return this.tree=BI.createWidget({type:"bi.simple_tree",items:this._removeIsParent(BI.deepClone(c.items))}),this.tree.on(BI.SimpleTreeView.EVENT_CHANGE,function(){b.fireEvent(BI.SwitchTree.EVENT_CHANGE,arguments)}),this.tree}},_removeIsParent:function(a){return BI.each(a,function(a,b){BI.isNotNull(b.isParent)&&delete b.isParent}),a},switchSelect:function(){switch(this.getSelect()){case BI.SwitchTree.SelectType.SingleSelect:this.setSelect(BI.SwitchTree.SelectType.MultiSelect);break;case BI.SwitchTree.SelectType.MultiSelect:this.setSelect(BI.SwitchTree.SelectType.SingleSelect)}},setSelect:function(a){this.tab.setSelect(a)},getSelect:function(){return this.tab.getSelect()},setValue:function(a){switch(this.storeValue=a,this.getSelect()){case BI.SwitchTree.SelectType.SingleSelect:this.levelTree.setValue(a);break;case BI.SwitchTree.SelectType.MultiSelect:this.tree.setValue(a)}},getValue:function(){return this.tab.getValue()},populate:function(a){this.options.items=a,BI.isNotNull(this.levelTree)&&this.levelTree.populate(BI.deepClone(a)),BI.isNotNull(this.tree)&&this.tree.populate(this._removeIsParent(BI.deepClone(a)))}}),BI.SwitchTree.EVENT_CHANGE="SwitchTree.EVENT_CHANGE",BI.SwitchTree.SelectType={SingleSelect:BI.Selection.Single,MultiSelect:BI.Selection.Multi},BI.shortcut("bi.switch_tree",BI.SwitchTree),BI.TimeInterval=BI.inherit(BI.Single,{constants:{height:25,width:25,lgap:15,offset:-15,timeErrorCls:"time-error",DATE_MIN_VALUE:"1900-01-01",DATE_MAX_VALUE:"2099-12-31"},_defaultConfig:function(){var a=BI.TimeInterval.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{extraCls:"bi-time-interval"})},_init:function(){var a=this;BI.TimeInterval.superclass._init.apply(this,arguments),this.left=this._createCombo(),this.right=this._createCombo(),this.label=BI.createWidget({type:"bi.label",height:this.constants.height,width:this.constants.width,text:"-"}),BI.createWidget({element:a,type:"bi.center",hgap:15,height:this.constants.height,items:[{type:"bi.absolute",items:[{el:a.left,left:this.constants.offset,right:0,top:0,bottom:0}]},{type:"bi.absolute",items:[{el:a.right,left:0,right:this.constants.offset,top:0,bottom:0}]}]}),BI.createWidget({type:"bi.horizontal_auto",element:this,items:[a.label]})},_createCombo:function(){var a=this,b=BI.createWidget({type:"bi.multidate_combo"});return b.on(BI.MultiDateCombo.EVENT_ERROR,function(){a._clearTitle(),a.element.removeClass(a.constants.timeErrorCls),a.fireEvent(BI.TimeInterval.EVENT_ERROR)}),b.on(BI.MultiDateCombo.EVENT_VALID,function(){BI.Bubbles.hide("error");var b=a.left.getKey(),c=a.right.getKey();a._check(b,c)&&a._compare(b,c)?(a._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")),a.element.addClass(a.constants.timeErrorCls),BI.Bubbles.show("error",BI.i18nText("BI-Time_Interval_Error_Text"),a,{offsetStyle:"center"}),a.fireEvent(BI.TimeInterval.EVENT_ERROR)):(a._clearTitle(),a.element.removeClass(a.constants.timeErrorCls))}),b.on(BI.MultiDateCombo.EVENT_FOCUS,function(){BI.Bubbles.hide("error");var b=a.left.getKey(),c=a.right.getKey();a._check(b,c)&&a._compare(b,c)?(a._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")),a.element.addClass(a.constants.timeErrorCls),BI.Bubbles.show("error",BI.i18nText("BI-Time_Interval_Error_Text"),a,{offsetStyle:"center"}),a.fireEvent(BI.TimeInterval.EVENT_ERROR)):(a._clearTitle(),a.element.removeClass(a.constants.timeErrorCls))}),b.on(BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW,function(){a.left.hidePopupView(),a.right.hidePopupView()}),b.on(BI.MultiDateCombo.EVENT_CONFIRM,function(){BI.Bubbles.hide("error");var b=a.left.getKey(),c=a.right.getKey();a._check(b,c)&&a._compare(b,c)?(a._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")),a.element.addClass(a.constants.timeErrorCls),a.fireEvent(BI.TimeInterval.EVENT_ERROR)):(a._clearTitle(),a.element.removeClass(a.constants.timeErrorCls),a.fireEvent(BI.TimeInterval.EVENT_CHANGE))}),b},_dateCheck:function(a){return Date.parseDateTime(a,"%Y-%x-%d").print("%Y-%x-%d")==a||Date.parseDateTime(a,"%Y-%X-%d").print("%Y-%X-%d")==a||Date.parseDateTime(a,"%Y-%x-%e").print("%Y-%x-%e")==a||Date.parseDateTime(a,"%Y-%X-%e").print("%Y-%X-%e")==a},_checkVoid:function(a){return!Date.checkVoid(a.year,a.month,a.day,this.constants.DATE_MIN_VALUE,this.constants.DATE_MAX_VALUE)[0]},_check:function(a,b){var c=a.match(/\d+/g),d=b.match(/\d+/g);return this._dateCheck(a)&&Date.checkLegal(a)&&this._checkVoid({year:c[0],month:c[1],day:c[2]})&&this._dateCheck(b)&&Date.checkLegal(b)&&this._checkVoid({year:d[0],month:d[1],day:d[2]})},_compare:function(a,b){return a=Date.parseDateTime(a,"%Y-%X-%d").print("%Y-%X-%d"),b=Date.parseDateTime(b,"%Y-%X-%d").print("%Y-%X-%d"),BI.isNotNull(a)&&BI.isNotNull(b)&&a>b},_setTitle:function(a){this.left.setTitle(a),this.right.setTitle(a),this.label.setTitle(a)},_clearTitle:function(){this.left.setTitle(""),this.right.setTitle(""),this.label.setTitle("")},setValue:function(a){a=a||{},this.left.setValue(a.start),this.right.setValue(a.end)},getValue:function(){return{start:this.left.getValue(),end:this.right.getValue()}}}),BI.TimeInterval.EVENT_VALID="EVENT_VALID",BI.TimeInterval.EVENT_ERROR="EVENT_ERROR",BI.TimeInterval.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.time_interval",BI.TimeInterval),BI.YearCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.YearCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-year-combo",behaviors:{},min:"1900-01-01",max:"2099-12-31",height:25})},_init:function(){BI.YearCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.storeValue="",this.trigger=BI.createWidget({type:"bi.year_trigger",min:b.min,max:b.max}),this.trigger.on(BI.YearTrigger.EVENT_FOCUS,function(){a.storeValue=this.getKey()}),this.trigger.on(BI.YearTrigger.EVENT_START,function(){a.combo.isViewVisible()&&a.combo.hideView()}),this.trigger.on(BI.YearTrigger.EVENT_STOP,function(){a.combo.showView()}),this.trigger.on(BI.YearTrigger.EVENT_ERROR,function(){a.combo.isViewVisible()&&a.combo.hideView()}),this.trigger.on(BI.YearTrigger.EVENT_CONFIRM,function(){a.combo.isViewVisible()||(this.getKey()&&this.getKey()!==a.storeValue?a.setValue(this.getKey()):this.getKey()||a.setValue(),a.fireEvent(BI.YearCombo.EVENT_CONFIRM))}),this.combo=BI.createWidget({type:"bi.combo",element:this,destroyWhenHide:!0,isNeedAdjustHeight:!1,isNeedAdjustWidth:!1,el:this.trigger,popup:{minWidth:85,stopPropagation:!1,el:{type:"bi.year_popup",ref:function(){a.popup=this},listeners:[{eventName:BI.YearPopup.EVENT_CHANGE,action:function(){a.setValue(a.popup.getValue()),a.combo.hideView(),a.fireEvent(BI.YearCombo.EVENT_CONFIRM)}}],behaviors:b.behaviors,min:b.min,max:b.max}}}),this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW,function(){var b=a.trigger.getKey();BI.isNotNull(b)?a.popup.setValue(b):b||b===a.storeValue?a.setValue():a.popup.setValue(a.storeValue),a.fireEvent(BI.YearCombo.EVENT_BEFORE_POPUPVIEW)})},setValue:function(a){this.combo.setValue(a||"")},getValue:function(){return this.popup.getValue()}}),BI.YearCombo.EVENT_CONFIRM="EVENT_CONFIRM",BI.YearCombo.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.shortcut("bi.year_combo",BI.YearCombo),BI.YearPopup=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.YearPopup.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-year-popup",behaviors:{},min:"1900-01-01",max:"2099-12-31"})},_createYearCalendar:function(a){var b=this.options,c=this._year,d=BI.createWidget({type:"bi.year_calendar",behaviors:b.behaviors,min:b.min,max:b.max,logic:{dynamic:!0},year:c+12*a});return d.setValue(this._year),d},_init:function(){BI.YearPopup.superclass._init.apply(this,arguments);var a=this;this.selectedYear=this._year=Date.getDate().getFullYear();var b=BI.createWidget({type:"bi.icon_button",cls:"pre-page-h-font",width:25,height:25,value:-1}),c=BI.createWidget({type:"bi.icon_button",cls:"next-page-h-font",width:25,height:25,value:1});this.navigation=BI.createWidget({type:"bi.navigation",element:this,single:!0,logic:{dynamic:!0},tab:{cls:"year-popup-navigation bi-high-light bi-border-top",height:25,items:[b,c]},cardCreator:BI.bind(this._createYearCalendar,this),afterCardShow:function(){this.setValue(a.selectedYear);var d=this.getSelectedCard();b.setEnable(!d.isFrontYear()),c.setEnable(!d.isFinalYear())}}),this.navigation.on(BI.Navigation.EVENT_CHANGE,function(){a.selectedYear=this.getValue(),a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a.fireEvent(BI.YearPopup.EVENT_CHANGE,a.selectedYear)})},getValue:function(){return this.selectedYear},setValue:function(a){var b=this.options;Date.checkVoid(a,1,1,b.min,b.max)[0]?(a=Date.getDate().getFullYear(),this.selectedYear="",this.navigation.setSelect(BI.YearCalendar.getPageByYear(a)),this.navigation.setValue("")):(this.selectedYear=a,this.navigation.setSelect(BI.YearCalendar.getPageByYear(a)),this.navigation.setValue(a))}}),BI.YearPopup.EVENT_CHANGE="EVENT_CHANGE",BI.shortcut("bi.year_popup",BI.YearPopup),BI.YearTrigger=BI.inherit(BI.Trigger,{_const:{hgap:4,vgap:2,errorText:BI.i18nText("BI-Please_Input_Positive_Integer"),errorTextInvalid:BI.i18nText("BI-Year_Trigger_Invalid_Text")},_defaultConfig:function(){return BI.extend(BI.YearTrigger.superclass._defaultConfig.apply(this,arguments),{extraCls:"bi-year-trigger bi-border",min:"1900-01-01",max:"2099-12-31",height:24})},_init:function(){BI.YearTrigger.superclass._init.apply(this,arguments);var a=this,b=this.options,c=this._const;this.editor=BI.createWidget({type:"bi.sign_editor",height:b.height,validationChecker:function(d){return a.editor.setErrorText(BI.isPositiveInteger(d)?c.errorTextInvalid:c.errorText),""===d||BI.isPositiveInteger(d)&&!Date.checkVoid(d,1,1,b.min,b.max)[0]},quitChecker:function(a){return!1},hgap:c.hgap,vgap:c.vgap,allowBlank:!0,errorText:c.errorText}),this.editor.on(BI.SignEditor.EVENT_FOCUS,function(){a.fireEvent(BI.YearTrigger.EVENT_FOCUS)}),this.editor.on(BI.SignEditor.EVENT_STOP,function(){a.fireEvent(BI.YearTrigger.EVENT_STOP)}),this.editor.on(BI.SignEditor.EVENT_CONFIRM,function(){var b=a.editor.getValue();BI.isNotNull(b)&&(a.editor.setValue(b),a.editor.setTitle(b)),a.fireEvent(BI.YearTrigger.EVENT_CONFIRM)}),this.editor.on(BI.SignEditor.EVENT_SPACE,function(){a.editor.isValid()&&a.editor.blur()}),this.editor.on(BI.SignEditor.EVENT_START,function(){a.fireEvent(BI.YearTrigger.EVENT_START)}),this.editor.on(BI.SignEditor.EVENT_ERROR,function(){a.fireEvent(BI.YearTrigger.EVENT_ERROR)}),BI.createWidget({element:this,type:"bi.htape",items:[{el:this.editor},{el:{type:"bi.text_button",baseCls:"bi-trigger-year-text",text:BI.i18nText("BI-Multi_Date_Year"),width:b.height},width:b.height},{el:{type:"bi.trigger_icon_button",width:b.height},width:b.height}]})},setValue:function(a){this.editor.setState(a),this.editor.setValue(a),this.editor.setTitle(a)},getKey:function(){return 0|this.editor.getValue()}}),BI.YearTrigger.EVENT_FOCUS="EVENT_FOCUS",BI.YearTrigger.EVENT_ERROR="EVENT_ERROR",BI.YearTrigger.EVENT_START="EVENT_START",BI.YearTrigger.EVENT_CONFIRM="EVENT_CONFIRM",BI.YearTrigger.EVENT_STOP="EVENT_STOP",BI.shortcut("bi.year_trigger",BI.YearTrigger),BI.YearMonthCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.YearMonthCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-year-month-combo",yearBehaviors:{},monthBehaviors:{},height:25})},_init:function(){BI.YearMonthCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.year=BI.createWidget({type:"bi.year_combo",behaviors:b.yearBehaviors}),this.month=BI.createWidget({type:"bi.month_combo",behaviors:b.monthBehaviors}),this.year.on(BI.YearCombo.EVENT_CONFIRM,function(){a.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM)}),this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW,function(){a.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW)}),this.month.on(BI.MonthCombo.EVENT_CONFIRM,function(){a.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM)}),this.month.on(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW,function(){a.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW)}),BI.createWidget({type:"bi.center",element:this,hgap:5,items:[this.year,this.month]})},setValue:function(a){a=a||{},this.month.setValue(a.month),this.year.setValue(a.year)},getValue:function(){return{year:this.year.getValue(),month:this.month.getValue()}}}),BI.YearMonthCombo.EVENT_CONFIRM="EVENT_CONFIRM",BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.shortcut("bi.year_month_combo",BI.YearMonthCombo),BI.YearQuarterCombo=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.YearQuarterCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-year-quarter-combo",yearBehaviors:{},quarterBehaviors:{},height:25})},_init:function(){BI.YearQuarterCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;this.year=BI.createWidget({type:"bi.year_combo",behaviors:b.yearBehaviors}),this.quarter=BI.createWidget({type:"bi.quarter_combo",behaviors:b.quarterBehaviors}),this.year.on(BI.YearCombo.EVENT_CONFIRM,function(){a.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM)}),this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW,function(){a.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW)}),this.quarter.on(BI.QuarterCombo.EVENT_CONFIRM,function(){a.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM)}),this.quarter.on(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW,function(){a.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW)}),BI.createWidget({type:"bi.center",element:this,hgap:5,items:[this.year,this.quarter]})},setValue:function(a){a=a||{},this.quarter.setValue(a.quarter),this.year.setValue(a.year)},getValue:function(){return{year:this.year.getValue(),quarter:this.quarter.getValue()}}}),BI.YearQuarterCombo.EVENT_CONFIRM="EVENT_CONFIRM",BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW="EVENT_BEFORE_POPUPVIEW",BI.shortcut("bi.year_quarter_combo",BI.YearQuarterCombo),BI.AbstractAllValueChooser=BI.inherit(BI.Widget,{_const:{perPage:100},_defaultConfig:function(){return BI.extend(BI.AbstractAllValueChooser.superclass._defaultConfig.apply(this,arguments),{width:200,height:30,items:null,itemsCreator:BI.emptyFn,cache:!0})},_valueFormatter:function(a){var b=a;return BI.isNotNull(this.items)&&BI.some(this.items,function(c,d){if(d.value===a)return b=d.text,!0}),b},_itemsCreator:function(a,b){function c(c){var d=(a.keywords||[]).slice();if(a.keyword&&d.push(a.keyword),BI.each(d,function(a,b){var d=BI.Func.getSearchResult(c,b);c=d.matched.concat(d.finded)}),a.selectedValues){var e=BI.makeObject(a.selectedValues,!0);c=BI.filter(c,function(a,b){return!e[b.value]})}return a.type===BI.MultiSelectCombo.REQ_GET_ALL_DATA?void b({items:c}):a.type===BI.MultiSelectCombo.REQ_GET_DATA_LENGTH?void b({count:c.length}):void b({items:c,hasNext:!1})}var d=this,e=this.options;e.cache&&this.items?c(this.items):e.itemsCreator({},function(a){d.items=a,c(a)})}}),BI.AllValueChooserCombo=BI.inherit(BI.AbstractAllValueChooser,{_defaultConfig:function(){return BI.extend(BI.AllValueChooserCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-all-value-chooser-combo",width:200,height:30,items:null,itemsCreator:BI.emptyFn,cache:!0})},_init:function(){BI.AllValueChooserCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;BI.isNotNull(b.items)&&(this.items=b.items),this.combo=BI.createWidget({type:"bi.multi_select_combo",element:this,itemsCreator:BI.bind(this._itemsCreator,this),valueFormatter:BI.bind(this._valueFormatter,this),width:b.width,height:b.height}),this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM,function(){a.fireEvent(BI.AllValueChooserCombo.EVENT_CONFIRM)})},setValue:function(a){this.combo.setValue({type:BI.Selection.Multi,value:a||[]})},getValue:function(){var a=this.combo.getValue()||{};return a.type===BI.Selection.All?a.assist:a.value||[]},populate:function(){this.combo.populate.apply(this,arguments)}}),BI.AllValueChooserCombo.EVENT_CONFIRM="AllValueChooserCombo.EVENT_CONFIRM",BI.shortcut("bi.all_value_chooser_combo",BI.AllValueChooserCombo),BI.AllValueChooserPane=BI.inherit(BI.AbstractAllValueChooser,{_defaultConfig:function(){return BI.extend(BI.AllValueChooserPane.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-all-value-chooser-pane",width:200,height:30,items:null,itemsCreator:BI.emptyFn,cache:!0})},_init:function(){BI.AllValueChooserPane.superclass._init.apply(this,arguments);var a=this,b=this.options;BI.isNotNull(b.items)&&(this.items=b.items),this.list=BI.createWidget({type:"bi.multi_select_list",element:this,itemsCreator:BI.bind(this._itemsCreator,this),valueFormatter:BI.bind(this._valueFormatter,this),width:b.width,height:b.height}),this.list.on(BI.MultiSelectList.EVENT_CHANGE,function(){a.fireEvent(BI.AllValueChooserPane.EVENT_CHANGE)})},setValue:function(a){this.list.setValue({type:BI.Selection.Multi,value:a||[]})},getValue:function(){var a=this.list.getValue()||{};return a.type===BI.Selection.All?a.assist:a.value||[]},populate:function(){this.list.populate.apply(this.list,arguments)}}),BI.AllValueChooserPane.EVENT_CHANGE="AllValueChooserPane.EVENT_CHANGE",BI.shortcut("bi.all_value_chooser_pane",BI.AllValueChooserPane),BI.AbstractTreeValueChooser=BI.inherit(BI.Widget,{_const:{perPage:100},_defaultConfig:function(){return BI.extend(BI.AbstractTreeValueChooser.superclass._defaultConfig.apply(this,arguments),{items:null,itemsCreator:BI.emptyFn})},_initData:function(a){this.items=a;var b=BI.Tree.treeFormat(a);this.tree=new BI.Tree,this.tree.initTree(b)},_itemsCreator:function(a,b){function c(){switch(a.type){case BI.TreeView.REQ_TYPE_INIT_DATA:d._reqInitTreeNode(a,b);break;case BI.TreeView.REQ_TYPE_ADJUST_DATA:d._reqAdjustTreeNode(a,b);break;case BI.TreeView.REQ_TYPE_SELECT_DATA:d._reqSelectedTreeNode(a,b);break;case BI.TreeView.REQ_TYPE_GET_SELECTED_DATA:d._reqDisplayTreeNode(a,b);break;default:d._reqTreeNode(a,b)}}var d=this,e=this.options;this.items?c():e.itemsCreator({},function(a){d._initData(a),c()})},_reqDisplayTreeNode:function(a,b){function c(a,b,g){return null==g||BI.isEmpty(g)?void BI.each(b.getChildren(),function(d,g){var h=BI.clone(a);h.push(g.value);var i=f._getChildCount(h);e(g,b.id,i),c(h,g,{})}):void BI.each(g,function(b){var h=f._getTreeNode(a,b),i=BI.clone(a);i.push(h.value),e(h,h.parent&&h.parent.id,d(g[b],i)),c(i,h,g[b])})}function d(a,b){return null==a?0:BI.isEmpty(a)?f._getChildCount(b):BI.size(a)}function e(a,b,c){g.push({id:a.id,pId:b,text:a.text+(c>0?"("+BI.i18nText("BI-Basic_Altogether")+c+BI.i18nText("BI-Basic_Count")+")":""),value:a.value,open:!0})}var f=this,g=[],h=a.selectedValues;return null==h||BI.isEmpty(h)?void b({}):(c([],this.tree.getRoot(),h),void b({items:g}))},_reqSelectedTreeNode:function(a,b){function c(a){var b=m.concat(k);if(g(a,b))if(f(b))i._deleteNode(a,b);else{var c=[],j=e(m,k,[],c);j&&BI.isNotEmptyArray(c)&&BI.each(c,function(b,c){var e=i._getNode(a,c);e?i._deleteNode(a,c):d(a,c,BI.last(c))})}if(h(a,b)){var l=[],j=!1;f(b)?j=!0:(j=e(m,k,l),b=m),j===!0&&(d(a,b,k),l.length>0&&BI.each(l,function(b,c){i._buildTree(a,c)}))}}function d(a,b,c){var d=a,e=[],f=[];BI.some(b,function(g,h){
var j=d[h];if(null==j){if(0===g)return!0;if(!BI.isEmpty(d))return!0;var k=b.slice(0,g),l=i._getChildren(k);if(f.push(k),e.push(l.length),g===b.length-1&&1===l.length&&l[0]===c)for(var m=e.length-1;m>=0&&1===e[m];m--)i._deleteNode(a,f[m]);else BI.each(l,function(a,e){return g===b.length-1&&e.value===c||void(d[e.value]={})});d=d[h]}else d=j})}function e(a,b,c,d){var f=BI.clone(a);if(f.push(b),i._isMatch(a,b,l))return d&&d.push(f),!0;var g=i._getChildren(f),h=[],j=!1;return BI.each(g,function(a,b){e(f,b.value,c,d)?j=!0:h.push(b.value)}),j===!0&&BI.each(h,function(a,b){var d=BI.clone(f);d.push(b),c.push(d)}),j}function f(a){for(var b=0,c=a.length;b<c;b++)if(i._isMatch(a.slice(0,a.length-1),a[b],l))return!0;return!1}function g(a,b){for(var c=a,d=0;d<b.length;d++){var e=b[d];if(c=c[e],null==c)return!1}return!0}function h(a,b){for(var c=a,d=0;d<b.length;d++){var e=b[d];if(!BI.has(c,e))return!1;if(c=c[e],BI.isEmpty(c))return!0}return!1}var i=this,j=BI.deepClone(a.selectedValues),k=a.notSelectedValue||{},l=a.keyword||"",m=a.parentValues||[];return null==j||BI.isEmpty(j)?void b({}):(c(j),void b(j))},_reqAdjustTreeNode:function(a,b){function c(a,b){if(null==a||BI.isEmpty(a))return!0;var e=!0;return BI.each(a,function(d,g){var h=BI.clone(b);h.push(d),c(a[d],h)||(BI.each(a[d],function(a,b){var c=BI.clone(h);c.push(a),f.push(c)}),e=!1)}),e&&d(a,b)}function d(a,b){return BI.isEmpty(a)||e._getChildCount(b)===BI.size(a)}var e=this,f=[],g=a.selectedValues;if(null==g||BI.isEmpty(g))return void b({});BI.each(g,function(a,b){f.push([a])}),c(g,[]);var h={};BI.each(f,function(a,b){e._buildTree(h,b)}),b(h)},_reqInitTreeNode:function(a,b){function c(){var a=j._getChildren([]),b=a.length;if(""!==n){for(var c=0,e=b;c<e;c++)if(a[c].value===n){b=c+1;break}}else b=0;for(var f=[],g=b,e=a.length;g<e;g++){if(f.length<j._const.perPage)var h=d(1,[],a[g].value,!1,k);else if(f.length===j._const.perPage)var h=d(1,[],a[g].value,!1,[]);if(h[0]===!0&&f.push(a[g].value),f.length>j._const.perPage)break}return f}function d(a,b,c,i,k){if(j._isMatch(b,c,l)){var m=i||h(b,c);return e(b,c,!1,m,!i&&f(b,c),!0,k),[!0,m]}var n=BI.clone(b);n.push(c);var o=j._getChildren(n),p=!1,m=!1,q=i||g(b,c);return BI.each(o,function(b,c){var e=d(a+1,n,c.value,q,k);e[1]===!0&&(m=!0),e[0]===!0&&(p=!0)}),p===!0&&(m=q||h(b,c)&&m,e(b,c,!0,m,!1,!1,k)),[p,m]}function e(a,b,c,d,e,f,g){var h=j._getTreeNode(a,b);g.push({id:h.id,pId:h.pId,text:h.text,value:h.value,title:h.title,isParent:h.getChildrenLength()>0,open:c,checked:d,halfCheck:e,flag:f})}function f(a,b){var c=i(a);return null==c?null:BI.any(c,function(a,c){if(a===b&&null!=c&&!BI.isEmpty(c))return!0})}function g(a,b){var c=i(a);return null==c?null:BI.any(c,function(a,c){if(a===b&&null!=c&&BI.isEmpty(c))return!0})}function h(a,b){var c=i(a);return null!=c&&BI.any(c,function(a){if(a===b)return!0})}function i(a){var b=m;return null==b?null:(BI.every(a,function(a,c){return b=b[c],null!=b}),b)}var j=this,k=[],l=a.keyword||"",m=a.selectedValues,n=a.lastSearchValue||"",o=c();BI.nextTick(function(){b({hasNext:o.length>j._const.perPage,items:k,lastSearchValue:BI.last(o)})})},_reqTreeNode:function(a,b){function c(a,b){var c={};return BI.each(a,function(a,c){b=b[c]||{}}),BI.each(b,function(a,b){if(BI.isNull(b))return void(c[a]=[0,0]);if(BI.isEmpty(b))return void(c[a]=[2,0]);var d={};BI.each(b,function(a,b){(BI.isNull(b)||BI.isEmpty(b))&&(d[a]=!0)}),c[a]=[1,BI.size(d)]}),c}function d(a,b,c,d){var f=d.checked,g=d.half,h=!1,i=!1;if(BI.has(c,a))if(1===c[a][0]){var j=BI.clone(b);j.push(a);var k=e._getChildCount(j);k>0&&k!==c[a][1]&&(i=!0)}else 2===c[a][0]&&(h=!0);var l;return l=f||i||h?(h||f)&&!g||BI.has(c,a):BI.has(c,a),[l,i]}var e=this,f=[],g=a.times,h=a.checkState||{},i=a.parentValues||[],j=a.selectedValues||{},k={};k=c(i,j);for(var l=this._getChildren(i),m=(g-1)*this._const.perPage;l[m]&&m<g*this._const.perPage;m++){var n=d(l[m].value,i,k,h);f.push({id:l[m].id,pId:l[m].pId,value:l[m].value,text:l[m].text,times:1,isParent:l[m].getChildrenLength()>0,checked:n[0],halfCheck:n[1]})}BI.nextTick(function(){b({items:f,hasNext:l.length>g*e._const.perPage})})},_getNode:function(a,b){for(var c=a,d=0,e=b.length;d<e;d++){if(null==c)return null;c=c[b[d]]}return c},_deleteNode:function(a,b){var c=b[b.length-1],d=b.slice(0,b.length-1),e=this._getNode(a,d);if(null!=e&&e[c])for(delete e[c];d.length>0&&BI.isEmpty(e);)c=d[d.length-1],d=d.slice(0,d.length-1),e=this._getNode(a,d),null!=e&&delete e[c]},_buildTree:function(a,b){var c=a;BI.each(b,function(a,b){BI.has(c,b)||(c[b]={}),c=c[b]})},_isMatch:function(a,b,c){var d=this._getTreeNode(a,b),e=BI.Func.getSearchResult([d.text||d.value],c);return e.finded.length>0||e.matched.length>0},_getTreeNode:function(a,b){var c,d=this,e=0;return this.tree.traverse(function(f){if(!d.tree.isRoot(f))return!(e>a.length)&&(e===a.length&&f.value===b?(c=f,!1):f.value!==a[e]||void e++)}),c},_getChildren:function(a){if(a.length>0)var b=BI.last(a),c=this._getTreeNode(a.slice(0,a.length-1),b);else var c=this.tree.getRoot();return c.getChildren()},_getChildCount:function(a){return this._getChildren(a).length}}),BI.TreeValueChooserCombo=BI.inherit(BI.AbstractTreeValueChooser,{_defaultConfig:function(){return BI.extend(BI.TreeValueChooserCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-tree-value-chooser-combo",width:200,height:30,items:null,itemsCreator:BI.emptyFn})},_init:function(){BI.TreeValueChooserCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;BI.isNotNull(b.items)&&this._initData(b.items),this.combo=BI.createWidget({type:"bi.multi_tree_combo",element:this,itemsCreator:BI.bind(this._itemsCreator,this),width:b.width,height:b.height}),this.combo.on(BI.MultiTreeCombo.EVENT_CONFIRM,function(){a.fireEvent(BI.TreeValueChooserCombo.EVENT_CONFIRM)})},setValue:function(a){this.combo.setValue(a)},getValue:function(){return this.combo.getValue()},populate:function(){this.combo.populate.apply(this.combo,arguments)}}),BI.TreeValueChooserCombo.EVENT_CONFIRM="TreeValueChooserCombo.EVENT_CONFIRM",BI.shortcut("bi.tree_value_chooser_combo",BI.TreeValueChooserCombo),BI.TreeValueChooserPane=BI.inherit(BI.AbstractTreeValueChooser,{_defaultConfig:function(){return BI.extend(BI.TreeValueChooserPane.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-tree-value-chooser-pane",items:null,itemsCreator:BI.emptyFn})},_init:function(){BI.TreeValueChooserPane.superclass._init.apply(this,arguments);var a=this,b=this.options;this.pane=BI.createWidget({type:"bi.multi_select_tree",element:this,itemsCreator:BI.bind(this._itemsCreator,this)}),this.pane.on(BI.MultiSelectTree.EVENT_CHANGE,function(){a.fireEvent(BI.TreeValueChooserPane.EVENT_CHANGE)}),BI.isNotNull(b.items)&&(this._initData(b.items),this.populate())},setSelectedValue:function(a){this.pane.setSelectedValue(a)},setValue:function(a){this.pane.setValue(a)},getValue:function(){return this.pane.getValue()},populate:function(){this.pane.populate.apply(this.pane,arguments)}}),BI.TreeValueChooserPane.EVENT_CHANGE="TreeValueChooserPane.EVENT_CHANGE",BI.shortcut("bi.tree_value_chooser_pane",BI.TreeValueChooserPane),BI.AbstractValueChooser=BI.inherit(BI.Widget,{_const:{perPage:100},_defaultConfig:function(){return BI.extend(BI.AbstractValueChooser.superclass._defaultConfig.apply(this,arguments),{items:null,itemsCreator:BI.emptyFn,cache:!0})},_valueFormatter:function(a){var b=a;return BI.isNotNull(this.items)&&BI.some(this.items,function(c,d){if(d.value===a)return b=d.text,!0}),b},_getItemsByTimes:function(a,b){for(var c=[],d=(b-1)*this._const.perPage;a[d]&&d<b*this._const.perPage;d++)c.push(a[d]);return c},_hasNextByTimes:function(a,b){return b*this._const.perPage<a.length},_itemsCreator:function(a,b){function c(c){var e=(a.keywords||[]).slice();if(a.keyword&&e.push(a.keyword),BI.each(e,function(a,b){var d=BI.Func.getSearchResult(c,b);c=d.matched.concat(d.finded)}),a.selectedValues){var f=BI.makeObject(a.selectedValues,!0);c=BI.filter(c,function(a,b){return!f[b.value]})}return a.type===BI.MultiSelectCombo.REQ_GET_ALL_DATA?void b({items:c}):a.type===BI.MultiSelectCombo.REQ_GET_DATA_LENGTH?void b({count:c.length}):void b({items:d._getItemsByTimes(c,a.times),hasNext:d._hasNextByTimes(c,a.times)})}var d=this,e=this.options;e.cache&&this.items?c(this.items):e.itemsCreator({},function(a){d.items=a,c(a)})}}),BI.ValueChooserCombo=BI.inherit(BI.AbstractValueChooser,{_defaultConfig:function(){return BI.extend(BI.ValueChooserCombo.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-value-chooser-combo",width:200,height:30,items:null,itemsCreator:BI.emptyFn,cache:!0})},_init:function(){BI.ValueChooserCombo.superclass._init.apply(this,arguments);var a=this,b=this.options;BI.isNotNull(b.items)&&(this.items=b.items),this.combo=BI.createWidget({type:"bi.multi_select_combo",element:this,itemsCreator:BI.bind(this._itemsCreator,this),valueFormatter:BI.bind(this._valueFormatter,this),width:b.width,height:b.height}),this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM,function(){a.fireEvent(BI.ValueChooserCombo.EVENT_CONFIRM)})},setValue:function(a){this.combo.setValue(a)},getValue:function(){var a=this.combo.getValue()||{};return{type:a.type,value:a.value}},populate:function(){this.combo.populate.apply(this,arguments)}}),BI.ValueChooserCombo.EVENT_CONFIRM="ValueChooserCombo.EVENT_CONFIRM",BI.shortcut("bi.value_chooser_combo",BI.ValueChooserCombo),BI.ValueChooserPane=BI.inherit(BI.AbstractValueChooser,{_defaultConfig:function(){return BI.extend(BI.ValueChooserPane.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-value-chooser-pane",items:null,itemsCreator:BI.emptyFn,cache:!0})},_init:function(){BI.ValueChooserPane.superclass._init.apply(this,arguments);var a=this,b=this.options;this.list=BI.createWidget({type:"bi.multi_select_list",element:this,itemsCreator:BI.bind(this._itemsCreator,this),valueFormatter:BI.bind(this._valueFormatter,this)}),this.list.on(BI.MultiSelectList.EVENT_CHANGE,function(){a.fireEvent(BI.ValueChooserPane.EVENT_CHANGE)}),BI.isNotNull(b.items)&&(this.items=b.items,this.populate())},setValue:function(a){this.list.setValue(a)},getValue:function(){var a=this.list.getValue()||{};return{type:a.type,value:a.value}},populate:function(){this.list.populate.apply(this.list,arguments)}}),BI.ValueChooserPane.EVENT_CHANGE="ValueChooserPane.EVENT_CHANGE",BI.shortcut("bi.value_chooser_pane",BI.ValueChooserPane),function(){var a={on:function(a,b,d){if(!c(this,"on",a,[b,d])||!b)return this;this._events||(this._events={});var e=this._events[a]||(this._events[a]=[]);return e.push({callback:b,context:d,ctx:d||this}),this},once:function(a,b,d){if(!c(this,"once",a,[b,d])||!b)return this;var e=this,f=_.once(function(){e.off(a,f),b.apply(this,arguments)});return f._callback=b,this.on(a,f,d)},off:function(a,b,d){if(!this._events||!c(this,"off",a,[b,d]))return this;if(!a&&!b&&!d)return this._events=void 0,this;for(var e=a?[a]:_.keys(this._events),f=0,g=e.length;f<g;f++){a=e[f];var h=this._events[a];if(h)if(b||d){for(var i=[],j=0,k=h.length;j<k;j++){var l=h[j];(b&&b!==l.callback&&b!==l.callback._callback||d&&d!==l.context)&&i.push(l)}i.length?this._events[a]=i:delete this._events[a]}else delete this._events[a]}return this},un:function(){this.off.apply(this,arguments)},trigger:function(a){if(!this._events)return this;var b=slice.call(arguments,1);if(!c(this,"trigger",a,b))return this;var e=this._events[a],f=this._events.all;return e&&d(e,b),f&&d(f,arguments),this},fireEvent:function(){this.trigger.apply(this,arguments)},listenTo:function(a,b,c){var d=this._listeningTo||(this._listeningTo={}),e=a._listenId||(a._listenId=_.uniqueId("l"));return d[e]=a,c||"object"!=typeof b||(c=this),a.on(b,c,this),this},listenToOnce:function(a,c,d){if("object"==typeof c){for(var e in c)this.listenToOnce(a,e,c[e]);return this}if(b.test(c)){for(var f=c.split(b),g=0,h=f.length;g<h;g++)this.listenToOnce(a,f[g],d);return this}if(!d)return this;var i=_.once(function(){this.stopListening(a,c,i),d.apply(this,arguments)});return i._callback=d,this.listenTo(a,c,i)},stopListening:function(a,b,c){var d=this._listeningTo;if(!d)return this;var e=!b&&!c;c||"object"!=typeof b||(c=this),a&&((d={})[a._listenId]=a);for(var f in d)a=d[f],a.off(b,c,this),(e||_.isEmpty(a._events))&&delete this._listeningTo[f];return this}},b=/\s+/,c=function(a,c,d,e){if(!d)return!0;if("object"==typeof d){for(var f in d)a[c].apply(a,[f,d[f]].concat(e));return!1}if(b.test(d)){for(var g=d.split(b),h=0,i=g.length;h<i;h++)a[c].apply(a,[g[h]].concat(e));return!1}return!0},d=function(a,b){var c,d=-1,e=a.length,f=b[0],g=b[1],h=b[2];switch(b.length){case 0:for(;++d<e;)(c=a[d]).callback.call(c.ctx);return;case 1:for(;++d<e;)(c=a[d]).callback.call(c.ctx,f);return;case 2:for(;++d<e;)(c=a[d]).callback.call(c.ctx,f,g);return;case 3:for(;++d<e;)(c=a[d]).callback.call(c.ctx,f,g,h);return;default:for(;++d<e;)(c=a[d]).callback.apply(c.ctx,b);return}},e=BI.Router=function(a){a||(a={}),a.routes&&(this.routes=a.routes),this._bindRoutes(),this._init.apply(this,arguments)},f=/\((.*?)\)/g,g=/(\(\?)?:\w+/g,h=/\*\w+/g,i=/[\-{}\[\]+?.,\\\^$|#\s]/g;_.extend(e.prototype,a,{_init:function(){},route:function(a,b,c){_.isRegExp(a)||(a=this._routeToRegExp(a)),_.isFunction(b)&&(c=b,b=""),c||(c=this[b]);var d=this;return BI.history.route(a,function(e){var f=d._extractParameters(a,e);d.execute(c,f,b)!==!1&&(d.trigger.apply(d,["route:"+b].concat(f)),d.trigger("route",b,f),BI.history.trigger("route",d,b,f))}),this},execute:function(a,b,c){a&&a.apply(this,b)},navigate:function(a,b){return BI.history.navigate(a,b),this},_bindRoutes:function(){if(this.routes){this.routes=_.result(this,"routes");for(var a,b=_.keys(this.routes);null!=(a=b.pop());)this.route(a,this.routes[a])}},_routeToRegExp:function(a){return a=a.replace(i,"\\$&").replace(f,"(?:$1)?").replace(g,function(a,b){return b?a:"([^/?]+)"}).replace(h,"([^?]*?)"),new RegExp("^"+a+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(a,b){var c=a.exec(b).slice(1);return _.map(c,function(a,b){return b===c.length-1?a||null:a?decodeURIComponent(a):null})}});var j=function(){this.handlers=[],_.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},k=/^[#\/]|\s+$/g,l=/^\/+|\/+$/g,m=/#.*$/;j.started=!1,_.extend(j.prototype,a,{interval:50,atRoot:function(){var a=this.location.pathname.replace(/[^\/]$/,"$&/");return a===this.root&&!this.getSearch()},getSearch:function(){var a=this.location.href.replace(/#.*/,"").match(/\?.+/);return a?a[0]:""},getHash:function(a){var b=(a||this).location.href.match(/#(.*)$/);return b?b[1]:""},getPath:function(){var a=decodeURI(this.location.pathname+this.getSearch()),b=this.root.slice(0,-1);return a.indexOf(b)||(a=a.slice(b.length)),"/"===a.charAt(0)?a.slice(1):a},getFragment:function(a){return null==a&&(a=this._hasPushState||!this._wantsHashChange?this.getPath():this.getHash()),a.replace(k,"")},start:function(a){if(j.started)throw new Error("BI.history has already been started");if(j.started=!0,this.options=_.extend({root:"/"},this.options,a),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._hasHashChange="onhashchange"in window,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState),this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(l,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var b=this.root.slice(0,-1)||"/";return this.location.replace(b+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&(!this._wantsPushState||!this._hasPushState)){var c=document.createElement("iframe");c.src="javascript:0",c.style.display="none",c.tabIndex=-1;var d=document.body;this.iframe=d.insertBefore(c,d.firstChild).contentWindow,this.iframe.document.open().close(),this.iframe.location.hash="#"+this.fragment}var e=window.addEventListener||function(a,b){return attachEvent("on"+a,b)};if(this._hasPushState?e("popstate",this.checkUrl,!1):this._wantsHashChange&&this._hasHashChange&&!this.iframe?e("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var a=window.removeEventListener||function(a,b){return detachEvent("on"+a,b)};this._hasPushState?a("popstate",this.checkUrl,!1):this._wantsHashChange&&this._hasHashChange&&!this.iframe&&a("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe.frameElement),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),j.started=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(a){var b=this.getFragment();return b===this.fragment&&this.iframe&&(b=this.getHash(this.iframe)),b!==this.fragment&&(this.iframe&&this.navigate(b),void this.loadUrl())},loadUrl:function(a){return a=this.fragment=this.getFragment(a),_.any(this.handlers,function(b){if(b.route.test(a))return b.callback(a),!0})},navigate:function(a,b){if(!j.started)return!1;b&&b!==!0||(b={trigger:!!b}),a=this.getFragment(a||"");var c=this.root;""!==a&&"?"!==a.charAt(0)||(c=c.slice(0,-1)||"/");var d=c+a;if(a=decodeURI(a.replace(m,"")),this.fragment!==a){if(this.fragment=a,this._hasPushState)this.history[b.replace?"replaceState":"pushState"]({},document.title,d);else{if(!this._wantsHashChange)return this.location.assign(d);this._updateHash(this.location,a,b.replace),this.iframe&&a!==this.getHash(this.iframe)&&(b.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,a,b.replace))}return b.trigger?this.loadUrl(a):void 0}},_updateHash:function(a,b,c){if(c){var d=a.href.replace(/(javascript:|#).*$/,"");a.replace(d+"#"+b)}else a.hash="#"+b}}),BI.history=new j}(),BI.servletURL="https://fanruan.coding.me/fineui/dist/",BI.resourceURL="https://fanruan.coding.me/fineui/dist/resource/",BI.i18n={"BI-Multi_Date_Quarter_End":"季度末","BI-Multi_Date_Month_Begin":"月初","BI-Multi_Date_YMD":"年/月/日","BI-Custom_Color":"自定义颜色","BI-Numerical_Interval_Input_Data":"请输入数值","BI-Please_Input_Natural_Number":"请输入非负整数","BI-No_More_Data":"无更多数据","BI-Basic_Altogether":"共","BI-Basic_Sunday":"星期日","BI-Widget_Background_Colour":"组件背景","BI-Color_Picker_Error_Text":"请输入0~255的正整数","BI-Multi_Date_Month":"月","BI-No_Selected_Item":"没有可选项","BI-Multi_Date_Year_Begin":"年初","BI-Quarter_1":"第1季度","BI-Quarter_2":"第2季度","BI-Quarter_3":"第3季度","BI-Quarter_4":"第4季度","BI-Multi_Date_Year_Next":"年后","BI-Multi_Date_Month_Prev":"个月前","BI-Month_Trigger_Error_Text":"请输入1~12的正整数","BI-Less_And_Equal":"小于等于","BI-Year_Trigger_Invalid_Text":"请输入有效时间","BI-Multi_Date_Week_Next":"周后","BI-Font_Size":"字号","BI-Basic_Total":"共","BI-Already_Selected":"已选择","BI-Formula_Insert":"插入","BI-Select_All":"全选","BI-Basic_Tuesday":"星期二","BI-Multi_Date_Month_End":"月末","BI-Load_More":"点击加载更多数据","BI-Basic_September":"九月","BI-Current_Is_Last_Page":"当前已是最后一页","BI-Basic_Auto":"自动","BI-Basic_Count":"个","BI-Basic_Value":"值","BI-Basic_Unrestricted":"无限制","BI-Quarter_Trigger_Error_Text":"请输入1~4的正整数","BI-Basic_More":"更多","BI-Basic_Wednesday":"星期三","BI-Basic_Bold":"加粗","BI-Basic_Simple_Saturday":"六","BI-Multi_Date_Month_Next":"个月后","BI-Basic_March":"三月","BI-Current_Is_First_Page":"当前已是第一页","BI-Basic_Thursday":"星期四","BI-Basic_Prompt":"提示","BI-Multi_Date_Today":"今天","BI-Multi_Date_Quarter_Prev":"个季度前","BI-Row_Header":"行表头","BI-Date_Trigger_Error_Text":"日期格式示例:2015-3-11","BI-Basic_Cancel":"取消","BI-Basic_January":"一月","BI-Basic_June":"六月","BI-Basic_July":"七月","BI-Basic_April":"四月","BI-Multi_Date_Quarter_Begin":"季度初","BI-Multi_Date_Week":"周","BI-Click_Blank_To_Select":'点按"空格键"选中匹配项',"BI-Basic_August":"八月","BI-Word_Align_Left":"文字居左","BI-Basic_November":"十一月","BI-Font_Colour":"字体颜色","BI-Multi_Date_Day_Prev":"天前","BI-Select_Part":"部分选择","BI-Multi_Date_Day_Next":"天后","BI-Less_Than":"小于","BI-Basic_February":"二月","BI-Multi_Date_Year":"年","BI-Number_Index":"序号","BI-Multi_Date_Week_Prev":"周前","BI-Next_Page":"下一页","BI-Right_Page":"向右翻页","BI-Numerical_Interval_Signal_Value":"前后值相等,请将操作符改为“≤”","BI-Basic_December":"十二月","BI-Basic_Saturday":"星期六","BI-Basic_Simple_Wednesday":"三","BI-Multi_Date_Quarter_Next":"个季度后","BI-Basic_October":"十月","BI-Basic_Simple_Friday":"五","BI-Primary_Key":"主键","BI-Basic_Save":"保存","BI-Numerical_Interval_Number_Value":"请保证前面的数值小于/等于后面的数值","BI-Previous_Page":"上一页","BI-No_Select":"搜索结果为空","BI-Basic_Clears":"清空","BI-Created_By_Me":"我创建的","BI-Basic_Simple_Tuesday":"二","BI-Word_Align_Right":"文字居右","BI-Summary_Values":"汇总","BI-Basic_Clear":"清除","BI-Upload_File_Size_Error":"文件大小不支","BI-Up_Page":"向上翻页","BI-Basic_Simple_Sunday":"日","BI-Multi_Date_Relative_Current_Time":"相对当前时间","BI-Selected_Data":"已选数据:","BI-Multi_Date_Quarter":"季度","BI-Check_Selected":"查看已选","BI-Basic_Search":"搜索","BI-Basic_May":"五月","BI-Continue_Select":"继续选择","BI-Please_Input_Positive_Integer":"请输入正整数","BI-Upload_File_Type_Error":"文件类型不支持","BI-Basic_Friday":"星期五","BI-Down_Page":"向下翻页","BI-Basic_Monday":"星期一","BI-Left_Page":"向左翻页","BI-Transparent_Color":"透明","BI-Basic_Simple_Monday":"一","BI-Multi_Date_Year_End":"年末","BI-Time_Interval_Error_Text":"请保证前面时间小于/等于后面的时间","BI-Basic_Time":"时间","BI-Basic_OK":"确定","BI-Basic_Sure":"确定","BI-Basic_Simple_Thursday":"四","BI-Multi_Date_Year_Prev":"年前","BI-Tiao_Data":"条数据","BI-Basic_Italic":"斜体"};