forked from meritt/base2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase2-p.js
9 lines (8 loc) · 22.4 KB
/
base2-p.js
1
2
3
4
5
6
7
8
9
/*
base2 - copyright 2007-2009, Dean Edwards
http://code.google.com/p/base2/
http://www.opensource.org/licenses/mit-license.php
Contributors:
Doeke Zanstra
*/
var base2={name:"base2",version:"1.1 (alpha1)",exports:"Base,Package,Abstract,Module,Enumerable,Map,Collection,RegGrp,Undefined,Null,This,True,False,assignID,detect,global",namespace:""};new function(_z){/*@cc_on @*/var Undefined=K(),Null=K(null),True=K(true),False=K(false),This=function(){return this};var global=This(),base2=global.base2;var _c=K(),_A=/%([1-9])/g,_j=/^\s\s*/,_k=/\s\s*$/,_l=/([\/()[\]{}|*+-.,^$?\\])/g,_d=/try/.test(detect)?/\bbase\b/:/.*/,_e=["constructor","toString"],_m=detect("(jscript)")?new RegExp("^"+rescape(isNaN).replace(/isNaN/,"\\w+")+"$"):{test:False},_n=1,_3=Array.prototype.slice;_6();function assignID(a,b){if(!b)b=a.nodeType==1?"uniqueID":"base2ID";if(!a[b])a[b]="b2_"+_n++;return a[b]};var _f=function(a,b){base2.__prototyping=this.prototype;var c=new this;if(a)extend(c,a);c.base=function(){};delete base2.__prototyping;var e=c.constructor;function d(){if(!base2.__prototyping){if(this.constructor==d||this.__constructing){this.__constructing=true;e.apply(this,arguments);delete this.__constructing}else{return extend(arguments[0],c)}}return this};c.constructor=d;for(var f in Base)d[f]=this[f];if(b)extend(d,b);d.ancestor=this;d.ancestorOf=Base.ancestorOf;d.base=c.base;d.prototype=c;if(d.init)d.init();return d};var Base=_f.call(Object,{constructor:function(){if(arguments.length>0){this.extend(arguments[0])}},extend:delegate(extend),toString:function(){if(this.constructor.toString==Function.prototype.toString){return"[object base2.Base]"}else{return"[object "+String2.slice(this.constructor,1,-1)+"]"}}},Base={ancestorOf:function(a){return _a(this,a)},extend:_f,forEach:function(a,b,c){_6(this,a,b,c)},implement:function(a){if(typeof a=="function"){a=a.prototype}extend(this.prototype,a);return this}});var Package=Base.extend({constructor:function(e,d){var f=this;f.extend(d);if(f.name&&f.name!="base2"){if(d.parent===undefined)f.parent=base2;if(f.parent)f.parent.addName(f.name,f);f.namespace=format("var %1=%2;",f.name,String2.slice(f,1,-1))}if(e){var g=base2.js?base2.js.namespace:"";var h="var base2=(function(){return this.base2})(),_0=base2.toString;"+base2.namespace+g;var i=csv(f.imports),j;for(var l=0;j=i[l];l++){var m=n(j)||n("js."+j);if(!m)throw new ReferenceError(format("Object not found: '%1'.",j));h+=m.namespace}e.init=function(){if(f.init)f.init()};e.imports=h+lang.namespace+"this.init();";h="";var p=csv(f.exports);for(var l=0;j=p[l];l++){var o=f.name+"."+j;f.namespace+="var "+j+"="+o+";";h+="if(!"+o+")"+o+"="+j+";"}e.exports=h+"this._o"+f.name+"();";var k=String2.slice(f,1,-1);e["_o"+f.name]=function(){for(var a in f){var b=f[a];if(b&&b.ancestorOf==Base.ancestorOf&&a!="constructor"){b.toString=K("["+k+"."+a+"]")}}}}function n(a){a=a.split(".");var b=base2,c=0;while(b&&a[c]!=null){b=b[a[c++]]}return b}},exports:"",imports:"",name:"",namespace:"",parent:null,addName:function(a,b){if(!this[a]){this[a]=b;this.exports+=","+a;this.namespace+=format("var %1=%2.%1;",a,this.name);if(b&&b.ancestorOf==Base.ancestorOf&&a!="constructor"){b.toString=K("["+String2.slice(this,1,-1)+"."+a+"]")}}},addPackage:function(a){this.addName(a,new Package(null,{name:a,parent:this}))},toString:function(){return format("[%1]",this.parent?String2.slice(this.parent,1,-1)+"."+this.name:this.name)}});var Abstract=Base.extend({constructor:function(){throw new TypeError("Abstract class cannot be instantiated.");}});var _p=0;var Module=Abstract.extend(null,{namespace:"",extend:function(a,b){var c=this.base();var e=_p++;c.namespace="";c.partial=this.partial;c.toString=K("[base2.Module["+e+"]]");Module[e]=c;c.implement(this);if(a)c.implement(a);if(b){extend(c,b);if(c.init)c.init()}return c},forEach:function(c,e){_6(Module,this.prototype,function(a,b){if(typeOf(a)=="function"){c.call(e,this[b],b,this)}},this)},implement:function(a){var b=this;var c=b.toString().slice(1,-1);if(typeof a=="function"){if(!_a(a,b)){this.base(a)}if(_a(Module,a)){for(var e in a){if(typeof b[e]=="undefined"){var d=a[e];if(typeof d=="function"&&d.call&&a.prototype[e]){d=_q(a,e)}b[e]=d}}b.namespace+=a.namespace.replace(/base2\.Module\[\d+\]/g,c)}}else{extend(b,a);_g(b,a)}return b},partial:function(){var c=Module.extend();var e=c.toString().slice(1,-1);c.namespace=this.namespace.replace(/(\w+)=b[^\)]+\)/g,"$1="+e+".$1");this.forEach(function(a,b){c[b]=partial(bind(a,c))});return c}});Module.prototype.base=Module.prototype.extend=_c;function _g(a,b){var c=a.prototype;var e=a.toString().slice(1,-1);for(var d in b){var f=b[d],g="";if(d.indexOf("@")==0){if(detect(d.slice(1)))_g(a,f)}else if(!c[d]){if(d==d.toUpperCase()){g="var "+d+"="+e+"."+d+";"}else if(typeof f=="function"&&f.call){g="var "+d+"=base2.lang.bind('"+d+"',"+e+");";c[d]=_r(a,d)}if(a.namespace.indexOf(g)==-1){a.namespace+=g}}}};function _q(a,b){return function(){return a[b].apply(a,arguments)}};function _r(b,c){return function(){var a=_3.call(arguments);a.unshift(this);return b[c].apply(b,a)}};var Enumerable=Module.extend({every:function(c,e,d){var f=true;try{forEach(c,function(a,b){f=e.call(d,a,b,c);if(!f)throw StopIteration;})}catch(error){if(error!=StopIteration)throw error;}return!!f},filter:function(e,d,f){var g=0;return this.reduce(e,function(a,b,c){if(d.call(f,b,c,e)){a[g++]=b}return a},[])},invoke:function(b,c){var e=_3.call(arguments,2);return this.map(b,typeof c=="function"?function(a){return a==null?undefined:c.apply(a,e)}:function(a){return a==null?undefined:a[c].apply(a,e)})},map:function(c,e,d){var f=[],g=0;forEach(c,function(a,b){f[g++]=e.call(d,a,b,c)});return f},pluck:function(b,c){return this.map(b,function(a){return a==null?undefined:a[c]})},reduce:function(c,e,d,f){var g=arguments.length>2;forEach(c,function(a,b){if(g){d=e.call(f,d,a,b,c)}else{d=a;g=true}});return d},some:function(a,b,c){return!this.every(a,not(b),c)}});var _2="#";var Map=Base.extend({constructor:function(a){if(a)this.merge(a)},clear:function(){for(var a in this)if(a.indexOf(_2)==0){delete this[a]}},copy:function(){base2.__prototyping=true;var a=new this.constructor;delete base2.__prototyping;for(var b in this)if(this[b]!==a[b]){a[b]=this[b]}return a},forEach:function(a,b){for(var c in this)if(c.indexOf(_2)==0){a.call(b,this[c],c.slice(1),this)}},get:function(a){return this[_2+a]},getKeys:function(){return this.map(II)},getValues:function(){return this.map(I)},has:function(a){a=_2+a;/*@if(@_jscript_version<5.5)return this[a]!==undefined||$Legacy.has(this,a);@else @*/return a in this;/*@end @*/},merge:function(b){var c=flip(this.put);forEach(arguments,function(a){forEach(a,c,this)},this);return this},put:function(a,b){this[_2+a]=b;return b},remove:function(a){delete this[_2+a]},size:function(){var a=0;for(var b in this)if(b.indexOf(_2)==0)a++;return a},union:function(a){return this.merge.apply(this.copy(),arguments)}});Map.implement(Enumerable);Map.prototype.filter=function(e,d){return this.reduce(function(a,b,c){if(!e.call(d,b,c,this)){a.remove(c)}return a},this.copy(),this)};var _1="~";var Collection=Map.extend({constructor:function(a){this[_1]=new Array2;this.base(a)},add:function(a,b){if(this.has(a))throw"Duplicate key '"+a+"'.";return this.put.apply(this,arguments)},clear:function(){this.base();this[_1].length=0},copy:function(){var a=this.base();a[_1]=this[_1].copy();return a},forEach:function(a,b){var c=this[_1].concat();var e=c.length;for(var d=0;d<e;d++){a.call(b,this[_2+c[d]],c[d],this)}},getAt:function(a){var b=this[_1].item(a);return(b===undefined)?undefined:this[_2+b]},getKeys:function(){return this[_1].copy()},indexOf:function(a){return this[_1].indexOf(String(a))},insertAt:function(a,b,c){if(this[_1].item(a)==null)throw"Index out of bounds.";if(this.has(b))throw"Duplicate key '"+b+"'.";this[_1].insertAt(a,String(b));this[_2+b]=null;return this.put.apply(this,_3.call(arguments,1))},item:function(a){return this[typeof a=="number"?"getAt":"get"](a)},put:function(a,b){var c=this.constructor;if(c.Item&&!instanceOf(b,c.Item)){b=c.create.apply(c,arguments)}if(!this.has(a)){this[_1].push(String(a))}this[_2+a]=b;return b},putAt:function(a,b){arguments[0]=this[_1].item(a);if(arguments[0]==null)throw"Index out of bounds.";return this.put.apply(this,arguments)},remove:function(a){if(this.has(a)){this[_1].remove(String(a));delete this[_2+a]}},removeAt:function(a){var b=this[_1].item(a);if(b!==undefined){this[_1].removeAt(a);delete this[_2+b]}},reverse:function(){this[_1].reverse();return this},size:function(){return this[_1].length},slice:function(a,b){var c=this.copy();if(arguments.length>0){var e=this[_1],d=e;c[_1]=Array2(_3.apply(e,arguments));if(c[_1].length){d=d.slice(0,a);if(arguments.length>1){d=d.concat(e.slice(b))}}for(var f=0;f<d.length;f++){delete c[_2+d[f]]}}return c},sort:function(c){if(c){this[_1].sort(bind(function(a,b){return c(this[_2+a],this[_2+b],a,b)},this))}else this[_1].sort();return this},toString:function(){return"("+(this[_1]||"")+")"}},{Item:null,create:function(a,b){return this.Item?new this.Item(a,b):b},extend:function(a,b){var c=this.base(a);c.create=this.create;if(b)extend(c,b);if(!c.Item){c.Item=this.Item}else if(typeof c.Item!="function"){c.Item=(this.Item||Base).extend(c.Item)}if(c.init)c.init();return c}});var _s=/\\(\d+)/g,_t=/\\./g,_u=/\(\?[:=!]|\[[^\]]+\]/g,_v=/\(/g,_w=/\$(\d+)/,_x=/^\$\d+$/;var RegGrp=Collection.extend({constructor:function(a,b){this.base(a);this.ignoreCase=!!b},ignoreCase:false,exec:function(g,h){g+="";var i=this,j=this[_1];if(!j.length)return g;if(h==RegGrp.IGNORE)h=0;return g.replace(new RegExp(this,this.ignoreCase?"gi":"g"),function(a){var b,c=1,e=0;while((b=i[_2+j[e++]])){var d=c+b.length+1;if(arguments[c]){var f=h==null?b.replacement:h;switch(typeof f){case"function":return f.apply(i,_3.call(arguments,c,d));case"number":return arguments[c+f];default:return f}}c=d}return a})},insertAt:function(a,b,c){if(instanceOf(b,RegExp)){arguments[1]=b.source}return this.base.apply(this,arguments)},test:function(a){return this.exec(a)!=a},toString:function(){var d=1;return"("+this.map(function(c){var e=(c+"").replace(_s,function(a,b){return"\\"+(d+Number(b))});d+=c.length+1;return e}).join(")|(")+")"}},{IGNORE:"$0",init:function(){forEach("add,get,has,put,remove".split(","),function(b){this[b]=_b(this,b,function(a){if(instanceOf(a,RegExp)){arguments[0]=a.source}return this.base.apply(this,arguments)})},this.prototype)},Item:{constructor:function(a,b){if(b==null)b=RegGrp.IGNORE;else if(b.replacement!=null)b=b.replacement;else if(typeof b!="function")b=String(b);if(typeof b=="string"&&_w.test(b)){if(_x.test(b)){b=parseInt(b.slice(1),10)}else{var c='"';b=b.replace(/\\/g,"\\\\").replace(/"/g,"\\x22").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\$(\d+)/g,c+"+(arguments[$1]||"+c+c+")+"+c).replace(/(['"])\1\+(.*)\+\1\1$/,"$1");b=new Function("return "+c+b+c)}}this.length=RegGrp.count(a);this.replacement=b;this.toString=K(a+"")},disabled:false,length:0,replacement:""},count:function(a){a=(a+"").replace(_t,"").replace(_u,"");return match(a,_v).length}});var lang={name:"lang",version:base2.version,exports:"assert,assertArity,assertType,bind,copy,extend,forEach,format,instanceOf,match,pcopy,rescape,trim,typeOf",namespace:""};function assert(a,b,c){if(!a){throw new(c||Error)(b||"Assertion failed.");}};function assertArity(a,b,c){if(b==null)b=a.callee.length;if(a.length<b){throw new SyntaxError(c||"Not enough arguments.");}};function assertType(a,b,c){if(b&&(typeof b=="function"?!instanceOf(a,b):typeOf(a)!=b)){throw new TypeError(c||"Invalid type.");}};function copy(a){var b={};for(var c in a){b[c]=a[c]}return b};function pcopy(a){_h.prototype=a;return new _h};function _h(){};function extend(a,b){if(a&&b){var c=base2.__prototyping;if(arguments.length>2){var e=b;b={};b[e]=arguments[2];c=true}var d=global[(typeof b=="function"?"Function":"Object")].prototype;if(c){var f=_e.length,e;while((e=_e[--f])){var g=b[e];if(g!=d[e]){if(_d.test(g)){a[e]=_b(a,e,g)}else{a[e]=g}}}}for(e in b){if(typeof d[e]=="undefined"){g=b[e];if(e.indexOf("@")==0){if(detect(e.slice(1)))extend(a,g)}else if(g!=_c){var h=a[e];if(h&&typeof g=="function"){if(g!=h){if(_d.test(g)){a[e]=_b(a,e,g)}else{g.ancestor=h;a[e]=g}}}else{a[e]=g}}}}}/*@if(@_jscript){try{return a}finally{a=null}}@else @*/return a;/*@end @*/};function _a(a,b){while(b){if(!b.ancestor)return false;b=b.ancestor;if(b==a)return true}return false};function _b(c,e,d){var f=c[e];var g=base2.__prototyping;if(g&&f!=g[e])g=null;function h(){var a=this.base;this.base=g?g[e]:f;var b=d.apply(this,arguments);this.base=a;return b};h.method=d;h.ancestor=f;return h};if(typeof StopIteration=="undefined"){StopIteration=new Error("StopIteration")}function forEach(a,b,c,e){if(a==null)return;if(!e){if(typeof a=="function"&&a.call){e=Function}else if(typeof a.forEach=="function"&&a.forEach!=forEach){a.forEach(b,c);return}else if(typeof a.length=="number"){_7(a,b,c);return}}_6(e||Object,a,b,c)};forEach.csv=function(a,b,c){forEach(csv(a),b,c)};forEach.detect=function(c,e,d){var f=function(a,b){if(b.indexOf("@")==0){if(detect(b.slice(1)))forEach(a,f)}else e.call(d,a,b,c)};forEach(c,f)};function _7(a,b,c){if(a==null)a=global;var e=a.length||0,d;if(typeof a=="string"){for(d=0;d<e;d++){b.call(c,a.charAt(d),d,a)}}else{for(d=0;d<e;d++){/*@if(@_jscript_version<5.2)if(a[d]!==undefined&&$Legacy.has(a,d))@else @*/if(d in a)/*@end @*/b.call(c,a[d],d,a)}}};function _6(g,h,i,j){var l=function(){this.i=1};l.prototype={i:1};var m=0;for(var p in new l)m++;_6=m>1?function(a,b,c,e){var d={};for(var f in b){if(!d[f]&&a.prototype[f]===undefined){d[f]=true;c.call(e,b[f],f,b)}}}:function(a,b,c,e){for(var d in b){if(typeof a.prototype[d]=="undefined"){c.call(e,b[d],d,b)}}};_6(g,h,i,j)};function instanceOf(a,b){if(typeof b!="function"){throw new TypeError("Invalid 'instanceOf' operand.");}if(a==null)return false;/*@if(@_jscript)if(typeof a.constructor!="function"){return b==Object}/*@end @*/if(a.constructor==b)return true;if(b.ancestorOf)return b.ancestorOf(a.constructor);/*@if(@_jscript_version<5.1)@else @*/if(a instanceof b)return true;/*@end @*/if(Base.ancestorOf==b.ancestorOf)return false;if(Base.ancestorOf==a.constructor.ancestorOf)return b==Object;switch(b){case Array:return _8.call(a)=="[object Array]";case Date:return _8.call(a)=="[object Date]";case RegExp:return _8.call(a)=="[object RegExp]";case Function:return typeOf(a)=="function";case String:case Number:case Boolean:return typeOf(a)==typeof b.prototype.valueOf();case Object:return true}return false};var _8=Object.prototype.toString;function typeOf(a){var b=typeof a;switch(b){case"object":return a==null?"null":typeof a.constructor!="function"?_m.test(a)?"function":b:_8.call(a)=="[object Date]"?b:typeof a.constructor.prototype.valueOf();case"function":return typeof a.call=="function"?b:"object";default:return b}};var js={name:"js",version:base2.version,exports:"Array2,Date2,Function2,String2",namespace:"",bind:function(c){var e=global;global=c;forEach.csv(this.exports,function(a){var b=a.slice(0,-1);extend(c[b],this[a]);this[a](c[b].prototype)},this);global=e;return c}};function _9(b,c,e,d){var f=Module.extend();var g=f.toString().slice(1,-1);forEach.csv(e,function(a){f[a]=unbind(b.prototype[a]);f.namespace+=format("var %1=%2.%1;",a,g)});forEach(_3.call(arguments,3),f.implement,f);var h=function(){return f(this.constructor==f?c.apply(null,arguments):arguments[0])};h.prototype=f.prototype;for(var i in f){var j=b[i];if(j&&i!="prototype"&&i!="toString"&&j!=Function.prototype[i]){f[i]=j;delete f.prototype[i]}h[i]=f[i]}h.ancestor=Object;delete h.extend;h.namespace=h.namespace.replace(/(var (\w+)=)[^,;]+,([^\)]+)\)/g,"$1$3.$2");return h};if((new Date).getYear()>1900){Date.prototype.getYear=function(){return this.getFullYear()-1900};Date.prototype.setYear=function(a){return this.setFullYear(a+1900)}}var _i=new Date(Date.UTC(2006,1,20));_i.setUTCDate(15);if(_i.getUTCHours()!=0){forEach.csv("FullYear,Month,Date,Hours,Minutes,Seconds,Milliseconds",function(b){extend(Date.prototype,"setUTC"+b,function(){var a=this.base.apply(this,arguments);if(a>=57722401000){a-=3600000;this.setTime(a)}return a})})}Function.prototype.prototype={};if("".replace(/^/,K("$$"))=="$"){extend(String.prototype,"replace",function(a,b){if(typeof b=="function"){var c=b;b=function(){return String(c.apply(null,arguments)).split("$").join("$$")}}return this.base(a,b)})}var Array2=_9(Array,Array,"concat,join,pop,push,reverse,shift,slice,sort,splice,unshift",Enumerable,{batch:function(e,d,f,g,h){var i=0,j=e.length;var l=function(){var a=Date2.now(),b=a,c=0;while(i<j&&(a-b<f)){d.call(h,e[i],i++,e);if(c++<5||c%50==0)a=Date2.now()}if(i<j){setTimeout(l,10)}else{if(g)g.call(h)}};setTimeout(l,1)},combine:function(e,d){if(!d)d=e;return Array2.reduce(e,function(a,b,c){a[b]=d[c];return a},{})},contains:function(a,b){return Array2.indexOf(a,b)!=-1},copy:function(a){var b=_3.call(a);if(!b.swap)Array2(b);return b},flatten:function(c){var e=0;var d=function(a,b){if(Array2.like(b)){Array2.reduce(b,d,a)}else{a[e++]=b}return a};return Array2.reduce(c,d,[])},forEach:_7,indexOf:function(a,b,c){var e=a.length;if(c==null){c=0}else if(c<0){c=Math.max(0,e+c)}for(var d=c;d<e;d++){if(a[d]===b)return d}return-1},insertAt:function(a,b,c){Array2.splice(a,b,0,c)},item:function(a,b){if(b<0)b+=a.length;return a[b]},lastIndexOf:function(a,b,c){var e=a.length;if(c==null){c=e-1}else if(c<0){c=Math.max(0,e+c)}for(var d=c;d>=0;d--){if(a[d]===b)return d}return-1},map:function(c,e,d){var f=[];_7(c,function(a,b){f[b]=e.call(d,a,b,c)});return f},remove:function(a,b){var c=Array2.indexOf(a,b);if(c!=-1)Array2.removeAt(a,c)},removeAt:function(a,b){Array2.splice(a,b,1)},swap:function(a,b,c){if(b<0)b+=a.length;if(c<0)c+=a.length;var e=a[b];a[b]=a[c];a[c]=e;return a}});Array2.forEach=_7;Array2.reduce=Enumerable.reduce;Array2.like=function(a){return typeOf(a)=="object"&&typeof a.length=="number"};var _y=/^((-\d+|\d{4,})(-(\d{2})(-(\d{2}))?)?)?T((\d{2})(:(\d{2})(:(\d{2})(\.(\d{1,3})(\d)?\d*)?)?)?)?(([+-])(\d{2})(:(\d{2}))?|Z)?$/;var _4={FullYear:2,Month:4,Date:6,Hours:8,Minutes:10,Seconds:12,Milliseconds:14};var _5={Hectomicroseconds:15,UTC:16,Sign:17,Hours:18,Minutes:20};var Date2=_9(Date,function(a,b,c,e,d,f,g){switch(arguments.length){case 0:return new Date;case 1:return typeof a=="string"?new Date(Date2.parse(a)):new Date(a.valueOf());default:return new Date(a,b,arguments.length==2?1:c,e||0,d||0,f||0,g||0)}},"",{toISOString:function(c){var e="####-##-##T##:##:##.###";for(var d in _4){e=e.replace(/#+/,function(a){var b=c["getUTC"+d]();if(d=="Month")b++;return("000"+b).slice(-a.length)})}return e+"Z"}});delete Date2.forEach;Date2.now=function(){return(new Date).valueOf()};Date2.parse=function(a,b){if(arguments.length>1){assertType(b,"number","Default date should be of type 'number'.")}var c=match(a,_y);if(c.length){var e=c[_4.Month];if(e)c[_4.Month]=String(e-1);if(c[_5.Hectomicroseconds]>=5)c[_4.Milliseconds]++;var d=c[_5.UTC]||c[_5.Hours]?"UTC":"";var f=new Date(b||0);if(c[_4.Date])f["set"+d+"Date"](14);for(var g in _4){var h=c[_4[g]];if(h){f["set"+d+g](h);if(f["get"+d+g]()!=c[_4[g]]){return NaN}}}if(c[_5.Hours]){var i=Number(c[_5.Sign]+c[_5.Hours]);var j=Number(c[_5.Sign]+(c[_5.Minutes]||0));f.setUTCMinutes(f.getUTCMinutes()+(i*60)+j)}return f.valueOf()}else{return Date.parse(a)}};var String2=_9(String,function(a){return new String(arguments.length==0?"":a)},"charAt,charCodeAt,concat,indexOf,lastIndexOf,match,replace,search,slice,split,substr,substring,toLowerCase,toUpperCase",{csv:csv,format:format,rescape:rescape,trim:trim});delete String2.forEach;function trim(a){return String(a).replace(_j,"").replace(_k,"")};function csv(a){return a?(a+"").split(/\s*,\s*/):[]};function format(c){var e=arguments;var d=new RegExp("%([1-"+(arguments.length-1)+"])","g");return(c+"").replace(d,function(a,b){return e[b]})};function match(a,b){return(a+"").match(b)||[]};function rescape(a){return(a+"").replace(_l,"\\$1")};var Function2=_9(Function,Function,"",{I:I,II:II,K:K,bind:bind,compose:compose,delegate:delegate,flip:flip,not:not,partial:partial,unbind:unbind});function I(a){return a};function II(a,b){return b};function K(a){return function(){return a}};function bind(a,b){var c=typeof a!="function";if(arguments.length>2){var e=_3.call(arguments,2);return function(){return(c?b[a]:a).apply(b,e.concat.apply(e,arguments))}}else{return function(){return(c?b[a]:a).apply(b,arguments)}}};function compose(){var c=_3.call(arguments);return function(){var a=c.length,b=c[--a].apply(this,arguments);while(a--)b=c[a].call(this,b);return b}};function delegate(b,c){return function(){var a=_3.call(arguments);a.unshift(this);return b.apply(c,a)}};function flip(a){return function(){return a.apply(this,Array2.swap(arguments,0,1))}};function not(a){return function(){return!a.apply(this,arguments)}};function partial(e){var d=_3.call(arguments,1);return function(){var a=d.concat(),b=0,c=0;while(b<d.length&&c<arguments.length){if(a[b]===undefined)a[b]=arguments[c++];b++}while(c<arguments.length){a[b++]=arguments[c++]}if(Array2.contains(a,undefined)){a.unshift(e);return partial.apply(null,a)}return e.apply(this,a)}};function unbind(b){return function(a){return b.apply(a,_3.call(arguments,1))}};function detect(){var i=NaN/*@cc_on||@_jscript_version@*/,j=true;if(global.navigator){var l=/MSIE[\d.]+/g,m=document.createElement("span"),p=document.createElement("input"),o=m.style,k=navigator.userAgent.replace(/([a-z])[\s\/](\d)/gi,"$1$2");j&=navigator.javaEnabled();if(!i)k=k.replace(l,"");if(/MSIE/.test(k)){k=k.match(l)[0]+";"+k.replace(l,"").replace(/user\-agent.*$/i,"")}if(/Chrome/.test(k))k=k.replace(/Safari[\d.]*/gi,"");else if(/Gecko/.test(k))k=k.replace(/Gecko/g,"Gecko/").replace(/rv:/,"Gecko");if(!/^CSS/.test(document.compatMode))k+=";QuirksMode";base2.userAgent=k.replace(/like \w+/gi,"")+";"+navigator.platform}var n={};detect=function(d){var f=d.indexOf("!")==0;if(f)d=d.slice(1);if(n[d]==null){var g=false,h=d;if(h.indexOf("(")==0){if(base2.dom){h=h.replace(/(hasFeature)/,"document.implementation.$1").replace(/\bstyle\.(\w+)/g,function(a,b){if(!o[b]){b=base2.dom.CSSStyleDeclaration.getPropertyName(b)}return"style."+b}).replace(/^\((\w+\.[\w\.]+)\)$/,function(a,b){b=b.split(".");var c=b.pop(),e=b.join(".");return"("+(i<5.6?e+"."+c+"!==undefined":"'"+c+"' in "+e)+")"})}try{g=new Function("global,element,input,style,jscript,java","return !!"+h)(global,m,p,o,i,j?global.java:null)}catch(x){}}else{g=new RegExp("("+h+")","i").test(base2.userAgent)}n[d]=g}return!!(f^n[d])};detect.MSIE=!!i;detect.MSIE5=i<5.6;return detect(arguments[0])};base2=global.base2=new Package(this,base2);base2.toString=K("[base2]");var exports=this.exports;lang=new Package(this,lang);exports+=this.exports;js=new Package(this,js);eval(exports+this.exports);lang.extend=extend;base2.JavaScript=pcopy(js);base2.JavaScript.namespace+="var JavaScript=js;"};