videopdf/static/oxjs/Ox.js
2013-02-12 19:00:50 +05:30

258 lines
No EOL
97 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* OxJS 0.1.2612 (c) 2013 0x2620, dual-licensed GPL/MIT, see https://oxjs.org for details */'use strict';this.Ox=function(value){return Ox.wrap(value);};Ox.load=function(){var callback=arguments[arguments.length-1],length,loaded=0,modules={},succeeded=0,type=Ox.typeOf(arguments[0]);function done(success){Ox.documentReady(function(){callback(success);});}
if(type=='string'){modules=Ox.extend({},arguments[0],Ox.isObject(arguments[1])?arguments[1]:{});}else if(type=='array'){arguments[0].forEach(function(value){if(Ox.isString(value)){modules[value]={};}else{Ox.extend(modules,value)}});}else if(type=='object'){modules=arguments[0];}
length=Ox.len(modules);Ox.documentReady(function(){if(!length){callback(true);}else{Ox.forEach(modules,function(options,module){Ox.getFile(Ox.PATH+'Ox.'+module+'/Ox.'+module+'.js',function(){Ox.load[module](options,function(success){succeeded+=success;++loaded==length&&callback(succeeded==length);});});});}});};Ox.localStorage=function(namespace){var localStorage=window.localStorage||{};try{Ox.forEach(localStorage,function(value,key){});}catch(e){localStorage={};}
function storage(key,value){var ret;if(arguments.length==0){ret={};Ox.forEach(localStorage,function(value,key){if(Ox.startsWith(key,namespace+'.')){ret[key.slice(namespace.length+1)]=JSON.parse(value);}});}else if(arguments.length==1&&typeof key=='string'){value=localStorage[namespace+'.'+key];ret=value===void 0?void 0:JSON.parse(value);}else{Ox.forEach(Ox.makeObject(arguments),function(value,key){localStorage[namespace+'.'+key]=JSON.stringify(value);});ret=storage;}
return ret;};storage['delete']=function(){var keys=arguments.length==0?Object.keys(storage()):Ox.toArray(arguments)
keys.forEach(function(key){delete localStorage[namespace+'.'+key];});return storage;};return storage;};Ox.Log=(function(){var storage=Ox.localStorage('Ox'),log=storage('log')||{filter:[],filterEnabled:true},that=function(){var ret;if(arguments.length==0){ret=log;}else{ret=that.log.apply(null,arguments);}
return ret;};that.filter=function(value){if(!Ox.isUndefined(value)){that.filter.enable();log.filter=Ox.makeArray(value);storage('log',log);}
return log.filter;};that.filter.add=function(value){return that.filter(Ox.unique(log.filter.concat(Ox.makeArray(value))));};that.filter.disable=function(){log.filterEnabled=false;storage('log',log);};that.filter.enable=function(){log.filterEnabled=true;storage('log',log);};that.filter.remove=function(value){value=Ox.makeArray(value);return that.filter(log.filter.filter(function(v){return value.indexOf(v)==-1;}));};that.log=function(){var args=Ox.toArray(arguments),date,ret;if(!log.filterEnabled||log.filter.indexOf(args[0])>-1){date=new Date();args.unshift(Ox.formatDate(date,'%H:%M:%S.')+(+date).toString().slice(-3));window.console&&window.console.log.apply(window.console,args);ret=args.join(' ');}
return ret;};return that;}());Ox.loop=function(){var length=arguments.length,start=length>2?arguments[0]:0,stop=arguments[length>2?1:0],step=length==4?arguments[2]:(start<=stop?1:-1),iterator=arguments[length-1],i;for(i=start;step>0?i<stop:i>stop;i+=step){if(iterator(i)===false){break;}}
return i;};Ox.print=function(){var args=Ox.toArray(arguments),date=new Date();args.unshift(Ox.formatDate(date,'%H:%M:%S.')+(+date).toString().slice(-3));window.console&&window.console.log.apply(window.console,args);return args.join(' ');};Ox.uid=(function(){var uid=0;return function(){return uid++;};}());Ox.wrap=function(value,chained){var wrapper={chain:function(){wrapper.chained=true;return wrapper;},chained:chained||false,value:function(){return value;}};Ox.methods(Ox).filter(function(method){return method[0]==method[0].toLowerCase();}).forEach(function(method){wrapper[method]=function(){var args=Array.prototype.slice.call(arguments),ret;args.unshift(value);ret=Ox[method].apply(Ox,args);return wrapper.chained?Ox.wrap(ret,true):ret;};});return wrapper;};'use strict';Ox.cache=function(fn,options){var cache={},ret=function(){options=Ox.extend({async:false,key:JSON.stringify},options||{});var args=Ox.toArray(arguments),key=options.key(args);function callback(){cache[key]=Ox.toArray(arguments);Ox.last(args).apply(this,arguments);}
if(options.async){if(!(key in cache)){fn.apply(this,args.slice(0,-1).concat(callback));}else{callback.apply(this,cache[key])}}else{if(!(key in cache)){cache[key]=fn.apply(this,args);}
return cache[key];}};ret.clear=function(){if(arguments.length==0){cache={};}else{Ox.makeArray(arguments).forEach(function(key){delete cache[key];});}
return ret;};return ret;};Ox.identity=function(value){return value;};Ox.noop=function(){var callback=Ox.last(arguments);Ox.isFunction(callback)&&callback();};'use strict';Ox.polyfill={};(function(){var digits='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';Ox.polyfill.atob=function(string){var binary='',ret='';String(string).replace(/=/g,'').split('').forEach(function(char){binary+=Ox.pad(digits.indexOf(char).toString(2),'left',6,'0');});while(binary.length>=8){ret+=Ox.char(parseInt(binary.slice(0,8),2));binary=binary.slice(8);}
return ret;};Ox.polyfill.btoa=function(string){var binary='',ret='';String(string).split('').forEach(function(char){binary+=Ox.pad(char.charCodeAt(0).toString(2),'left',8,'0');});binary=Ox.pad(binary,Math.ceil(binary.length/6)*6,'0')
while(binary){ret+=digits[parseInt(binary.slice(0,6),2)];binary=binary.slice(6);}
return Ox.pad(ret,Math.ceil(ret.length/4)*4,'=');};}());(function(window){Ox.polyfill.bind=function(that){if(typeof this!=='function'){throw new TypeError();}
var args=Array.prototype.slice.call(arguments,1),fn=function(){},this_=this,ret=function(){return this_.apply(this instanceof fn?this:that||window,args.concat(Array.prototype.slice.call(arguments)));};fn.prototype=this.prototype;ret.prototype=new fn();return ret;};})(this);Ox.polyfill.every=function(iterator,that){if(this===void 0||this===null||typeof iterator!=='function'){throw new TypeError();}
var array=Object(this),i,length=array.length>>>0,ret=true;for(i=0;i<length;i++){if(i in array&&!iterator.call(that,array[i],i,array)){ret=false;break;}}
return ret;};Ox.polyfill.filter=function(iterator,that){if(this===void 0||this===null||typeof iterator!=='function'){throw new TypeError();}
var array=Object(this),i,length=array.length>>>0,ret=[],value;for(i=0;i<length;i++){if(i in array&&iterator.call(that,value=array[i],i,array)){ret.push(value);}}
return ret;};Ox.polyfill.forEach=function(iterator,that){if(this===void 0||this===null||typeof iterator!=='function'){throw new TypeError();}
var array=Object(this),i,length=array.length>>>0;for(i=0;i<length;i++){if(i in array){iterator.call(that,array[i],i,array);}}};Ox.polyfill.indexOf=function(value){if(this===void 0||this===null){throw new TypeError();}var array=Object(this),i,length=array.length>>>0,ret=-1;for(i=0;i<length;i++){if(i in array&&array[i]===value){ret=i;break;}}
return ret;};Ox.polyfill.isArray=function(value){return Object.prototype.toString.call(value)=='[object Array]';};Ox.polyfill.JSON=(function(){var replace={'"':'\\"','\b':'\\b','\f':'\\f','\n':'\\n','\r':'\\r','\t':'\\t','\\':'\\\\'};function quote(value){return'"'+value.split('').map(function(char){return replace[char]||char;}).join('')+'"';};return{parse:function parse(string){return eval('('+string+')');},stringify:function stringify(value){var ret='null',type=Ox.typeOf(value);if(type=='arguments'||type=='regexp'){ret='{}';}else if(type=='array'){ret=['[',']'].join(value.map(function(v){return stringify(v);}).join(','));}else if(type=='boolean'){ret=String(value);}else if(type=='date'){ret=Ox.splice(Ox.getISODate(value,true),19,0,'.'+String(+value).slice(-3));}else if(type=='number'){ret=isFinite(value)?String(value):'null';}else if(type=='object'){ret=['{','}'].join(Object.keys(value).map(function(k){return quote(k)+': '+stringify(value[k]);}).join(','));}else if(type=='string'){ret=quote(value);}
return ret;}};}());Ox.polyfill.keys=function(object){if(object!==Object(object)){throw new TypeError();}
var key,ret=[];for(key in object){Object.prototype.hasOwnProperty.call(object,key)&&ret.push(key);}
return ret;};Ox.polyfill.lastIndexOf=function(value){if(this===void 0||this===null){throw new TypeError();}var array=Object(this),i,length=array.length>>>0,ret=-1;for(i=length-1;i>=0;i--){if(i in array&&array[i]===value){ret=i;break;}}
return ret;};Ox.polyfill.map=function(iterator,that){if(this===void 0||this===null||typeof iterator!=='function'){throw new TypeError();}
var array=Object(this),i,length=array.length>>>0,ret=new Array(length);for(i=0;i<length;i++){if(i in array){ret[i]=iterator.call(that,array[i],i,array);}}
return ret;};Ox.polyfill.reduce=function(iterator,ret){if(this===void 0||this===null||typeof iterator!=='function'){throw new TypeError();}
var array=Object(this),i,length=array.length;if(!length&&ret===void 0){throw new TypeError();}
if(ret===void 0){ret=array[0];i=1;}
for(i=i||0;i<length;i++){if(i in array){ret=iterator.call(void 0,ret,array[i],i,array);}}
return ret;};Ox.polyfill.reduceRight=function(iterator,ret){if(this===void 0||this===null||typeof iterator!=='function'){throw new TypeError();}
var array=Object(this),i,length=array.length;if(!length&&ret===void 0){throw new TypeError();}
if(ret===void 0){ret=array[length-1];i=length-2;}
for(i=i||length-1;i>=0;i--){if(i in array){ret=iterator.call(void 0,ret,array[i],i,array);}}
return ret;};Ox.polyfill.some=function(iterator,that){if(this===void 0||this===null||typeof iterator!=='function'){throw new TypeError();}
var array=Object(this),i,length=array.length>>>0,ret=false;for(i=0;i<length;i++){if(i in array&&iterator.call(that,array[i],i,array)){ret=true;break;}}
return ret;};Ox.polyfill.trim=function(){return this.replace(/^\s+|\s+$/g,'');};(function(window){var key,log,object;for(key in Ox.polyfill){object=key=='bind'?Function.prototype:key=='isArray'?Array:key=='atob'||key=='btoa'||key=='JSON'?window:key=='keys'?Object:key=='trim'?String.prototype:Array.prototype;if(!object[key]){object[key]=Ox.polyfill[key];}}
if(window.console){if(typeof window.console.log!=='function'){log=window.console.log;window.console.log=function(){log(Array.prototype.slice.call(arguments).join(' '));};}else if(!window.console.log.apply){window.console.log=Function.prototype.bind.call(window.console.log,window.console);}}})(this);'use strict';Ox.api=function(items,options){options=options||{};var api={cache:options.cache,enums:options.enums?parseEnums(options.enums):{},geo:options.geo,map:options.map||{},sort:options.sort||[],sums:options.sums||[],unique:options.unique||'id'},fn=function(options,callback){var data,keys,map={},result={data:{},status:{code:200,text:'ok'}};options=options||{};if(options.query){options.query.conditions=parseConditions(options.query.conditions);result.data.items=items.filter(function(item){return testQuery(item,options.query);});}else{result.data.items=Ox.clone(items);}
if(options.sort&&result.data.items.length>1){keys=[];options.sort=parseSort(options.sort.concat(api.sort)).filter(function(v){var ret=keys.indexOf(v.key)==-1;keys.push(v.key);return ret;});options.sort.forEach(function(v){var key=v.key;if(api.enums[key]){map[key]=function(value){return api.enums[key].indexOf(value.toLowerCase());};}else if(api.map[key]){map[key]=api.map[key];}});if(options.keys||options.positions){result.data.items=sortBy(result.data.items,options.sort,map,options.query);}}
if(options.positions){data={positions:{}};options.positions.forEach(function(id){data.positions[id]=Ox.indexOf(result.data.items,function(item){return item[api.unique]==id;});});result.data=data;}else if(!options.keys){data={};api.sums.forEach(function(key){data[key]=result.data.items.map(function(item){return item[key];});data[key]=Ox.isString(data[key][0])?Ox.unique(data[key]).length:Ox.sum(data[key]);});data.items=result.data.items.length;if(api.geo){data.area=data.items==0?{south:-Ox.MAX_LATITUDE,west:-179,north:Ox.MAX_LATITUDE,east:179}:result.data.items.reduce(function(prev,curr){return{south:Math.min(prev.south,curr.south),west:Math.min(prev.west,curr.west),north:Math.max(prev.north,curr.north),east:Math.max(prev.east,curr.east)};},{south:Ox.MAX_LATITUDE,west:180,north:-Ox.MAX_LATITUDE,east:-180});}
result.data=data;}else{if(!Ox.isEmpty(options.keys)){if(options.keys.indexOf(api.unique)==-1){options.keys.push(api.unique);}
result.data.items=result.data.items.map(function(item){var ret={};options.keys.forEach(function(key){ret[key]=item[key];});return ret;});}
if(options.range){result.data.items=result.data.items.slice(options.range[0],options.range[1]);}}
callback&&callback(result);return result;},sortBy=Ox.cache(function sortBy(array,by,map,query){return Ox.sortBy(array,by,map);},{key:function(args){return JSON.stringify([args[1],args[3]])}});function parseEnums(enums){return Ox.map(enums,function(values){return values.map(function(value){return value.toLowerCase();});});}
function parseConditions(conditions){return conditions.map(function(condition){var key=condition.key,operator=condition.operator,values=Ox.makeArray(condition.value);if(condition.conditions){condition.conditions=parseConditions(condition.conditions);}else{values=values.map(function(value){if(Ox.isString(value)){value=value.toLowerCase();}
if(api.enums[key]&&(operator.indexOf('<')>-1||operator.indexOf('>')>-1)){value=api.enums[key].indexOf(value);}
return value;});condition.value=Ox.isArray(condition.value)?values:values[0];}
return condition;});}
function parseSort(sort){return sort.map(function(sort){return Ox.isString(sort)?{key:sort.replace(/^[\+\-]/,''),operator:sort[0]=='-'?'-':'+'}:sort;});}
function testCondition(item,condition){var key=condition.key,operator=condition.operator.replace('!',''),value=condition.value,not=condition.operator[0]=='!',itemValue=item[key],test={'=':function(a,b){return Ox.isArray(b)?a>=b[0]&&a<b[1]:Ox.isArray(a)?a.some(function(value){return value.indexOf(b)>-1;}):Ox.isString(a)?a.indexOf(b)>-1:a===b;},'==':function(a,b){return Ox.isArray(a)?a.some(function(value){return value===b;}):a===b;},'<':function(a,b){return a<b;},'<=':function(a,b){return a<=b;},'>':function(a,b){return a>b;},'>=':function(a,b){return a>=b;},'^':function(a,b){return Ox.startsWith(a,b);},'$':function(a,b){return Ox.endsWith(a,b);}};if(Ox.isString(itemValue)){itemValue=itemValue.toLowerCase();}else if(Ox.isArray(itemValue)&&Ox.isString(itemValue[0])){itemValue=itemValue.map(function(value){return value.toLowerCase();});}
if(api.enums[key]&&(operator.indexOf('<')>-1||operator.indexOf('>')>-1)){itemValue=api.enums[key].indexOf(itemValue);}
return test[operator](itemValue,value)==!not;}
function testQuery(item,query){var match=true;Ox.forEach(query.conditions,function(condition){if(condition.conditions){match=testQuery(item,condition);}else{match=testCondition(item,condition)}
if((query.operator=='&'&&!match)||(query.operator=='|'&&match)){return false;}});return match;}
return api.cache?Ox.cache(fn,{async:true}):fn;};Ox.compact=function(array){return array.filter(function(value){return value!=null;});};Ox.find=function(array,string,leading){var matches=[[],[]];string=string.toLowerCase();array.forEach(function(value){var lowerCase=value.toLowerCase(),index=lowerCase.indexOf(string);index>-1&&matches[index==0?0:1][lowerCase==string?'unshift':'push'](value);})
return leading?matches[0]:matches[0].concat(matches[1]);};Ox.flatten=function(array){var ret=[];array.forEach(function(value){if(Ox.isArray(value)){ret=ret.concat(Ox.flatten(value));}else{ret.push(value);}});return ret;};Ox.getIndexById=function(array,id){return Ox.indexOf(array,function(obj){return obj.id===id;});};Ox.getObjectById=function(array,id){var index=Ox.getIndexById(array,id);return index>-1?array[index]:null;};Ox.last=function(array,value){var ret;if(arguments.length==1){ret=array[array.length-1];}else{array[array.length-1]=value;ret=array;}
return ret;};Ox.makeArray=function(value){var ret,type=Ox.typeOf(value);if(type=='arguments'){ret=Ox.toArray(value);}else if(type=='array'){ret=value;}else{ret=[value];}
return ret;};Ox.range=function(){var array=[];Ox.loop.apply(null,Ox.toArray(arguments).concat(function(index){array.push(index);}));return array;};(function(){var getSortValue=Ox.cache(function getSortValue(value){var sortValue=value;function trim(value){return value.replace(/^\W+(?=\w)/,'');}
if(Ox.isEmpty(value)||Ox.isNull(value)||Ox.isUndefined(value)){sortValue=null;}else if(Ox.isString(value)){sortValue=trim(value.toLowerCase());Ox.forEach(['a','an','the'],function(article){if(new RegExp('^'+article+' ').test(sortValue)){sortValue=trim(sortValue.slice(article.length+1))
+', '+sortValue.slice(0,article.length);return false;}});sortValue=sortValue.replace(/(\d),(?=(\d{3}))/g,'$1').replace(/\d+/g,function(match){return Ox.pad(match,'left',64,'0');});}
return sortValue;},{key:function(args){return Ox.typeOf(args[0])+' '+args[0];}});Ox.sort=function(array,map){return array.sort(function(a,b){a=getSortValue(map?map(a):a);b=getSortValue(map?map(b):b);return a<b?-1:a>b?1:0;});};Ox.sortBy=function(array,by,map){var sortValues={};by=Ox.makeArray(by).map(function(value){return Ox.isString(value)?{key:value.replace(/^[\+\-]/,''),operator:value[0]=='-'?'-':'+'}:value;});map=map||{};return array.sort(function(a,b){var aValue,bValue,index=0,key,ret=0;while(ret==0&&index<by.length){key=by[index].key;aValue=getSortValue(map[key]?map[key](a[key],a):a[key]);bValue=getSortValue(map[key]?map[key](b[key],b):b[key]);if((aValue===null)!=(bValue===null)){ret=aValue===null?1:-1;}else if(aValue<bValue){ret=by[index].operator=='+'?-1:1;}else if(aValue>bValue){ret=by[index].operator=='+'?1:-1;}else{index++;}}
return ret;});};}());Ox.toArray=function(collection){return Ox.slice(collection);};try{Array.prototype.slice.call(document.getElementsByTagName('a'));}catch(error){Ox.toArray=function(collection){var i,length,ret=[];try{ret=Ox.slice(collection);}catch(error){length=collection.length;for(i=0;i<length;i++){ret[i]=collection[i];}}
return ret;};}
Ox.unique=function(array){return Ox.filter(array,function(value,index){return array.indexOf(value)==index;});};Ox.zip=function(){var args=arguments.length==1?arguments[0]:Ox.toArray(arguments),array=[];args[0].forEach(function(value,index){array[index]=[];args.forEach(function(value){array[index].push(value[index]);});});return array;};'use strict';Ox.char=String.fromCharCode;Ox.clean=function(string){return Ox.filter(Ox.map(string.split('\n'),function(string){return string.replace(/\s+/g,' ').trim()||'';})).join('\n');};Ox.endsWith=function(string,substring){string=string.toString();substring=substring.toString();return string.slice(string.length-substring.length)==substring;};Ox.isValidEmail=function(string){return!!/^[0-9A-Z\.\+\-_]+@(?:[0-9A-Z\-]+\.)+[A-Z]{2,6}$/i.test(string);};Ox.pad=function(string,position,length,padding){var hasPosition=Ox.isString(arguments[1]),isNumber=Ox.isNumber(arguments[0]),last=Ox.last(arguments);position=hasPosition?arguments[1]:isNumber?'left':'right';length=Math.max(hasPosition?arguments[2]:arguments[1],0);padding=Ox.isString(last)?last:isNumber&&position=='left'?'0':' ';string=string.toString();padding=Ox.repeat(padding,length-string.length);return position=='left'?(padding+string).slice(-length):(string+padding).slice(0,length);};Ox.parseDuration=function(string){return string.split(':').reverse().slice(0,3).reduce(function(p,c,i){return p+(parseFloat(c)||0)*Math.pow(60,i);},0);};Ox.parsePath=function(string){var matches=/^(.+\/)?(.+?(\..+)?)?$/.exec(string);return{pathname:matches[1]||'',filename:matches[2]||'',extension:matches[3]?matches[3].slice(1):''};};Ox.parseSRT=function(string,fps){return string.replace(/\r\n/g,'\n').replace(/\n+$/,'').split('\n\n').map(function(block){var lines=block.split('\n'),points;lines.shift();points=lines.shift().split(' --> ').map(function(point){return point.replace(',',':').split(':').reduce(function(previous,current,index){return previous+parseInt(current,10)*[3600,60,1,0.001][index];},0);});if(fps){points=points.map(function(point){return Math.round(point*fps)/fps;});}
return{'in':points[0],out:points[1],text:lines.join('\n')};});};Ox.parseURL=(function(){var a=document.createElement('a'),keys=['hash','host','hostname','origin','pathname','port','protocol','search'];return function(string){var ret={};a.href=string;keys.forEach(function(key){ret[key]=a[key];});return ret;};}());Ox.parseUserAgent=function(userAgent){var aliases={browser:{'Firefox':/(Fennec|Firebird|Iceweasel|Minefield|Namoroka|Phoenix|SeaMonkey|Shiretoko)/},system:{'BSD':/(FreeBSD|NetBSD|OpenBSD)/,'Linux':/(CrOS|MeeGo|webOS)/,'Unix':/(AIX|HP-UX|IRIX|SunOS)/}},names={browser:{'chromeframe':'Chrome Frame','MSIE':'Internet Explorer'},system:{'CPU OS':'iOS','iPhone OS':'iOS','Macintosh':'Mac OS X'}},regexps={browser:[/(Camino)\/(\d+)/,/(chromeframe)\/(\d+)/,/(Chrome)\/(\d+)/,/(Epiphany)\/(\d+)/,/(Firefox)\/(\d+)/,/(Galeon)\/(\d+)/,/(Googlebot)\/(\d+)/,/(Konqueror)\/(\d+)/,/(MSIE) (\d+)/,/(Netscape)\d?\/(\d+)/,/(NokiaBrowser)\/(\d+)/,/(Opera) (\d+)/,/(Opera)\/.+Version\/(\d+)/,/Version\/(\d+).+(Safari)/],system:[/(Android) (\d+)/,/(BeOS)/,/(BlackBerry) (\d+)/,/(Darwin)/,/(BSD) (FreeBSD|NetBSD|OpenBSD)/,/(CPU OS) (\d+)/,/(iPhone OS) (\d+)/,/(Linux).+(CentOS|CrOS|Debian|Fedora|Gentoo|Mandriva|MeeGo|Mint|Red Hat|SUSE|Ubuntu|webOS)/,/(CentOS|CrOS|Debian|Fedora|Gentoo|Mandriva|MeeGo|Mint|Red Hat|SUSE|Ubuntu|webOS).+(Linux)/,/(Linux)/,/(Mac OS X) (10.\d)/,/(Mac OS X)/,/(Macintosh)/,/(SymbianOS)\/(\d+)/,/(SymbOS)/,/(OS\/2)/,/(Unix) (AIX|HP-UX|IRIX|SunOS)/,/(Unix)/,/(Windows) (NT \d\.\d)/,/(Windows) (95|98|2000|2003|ME|NT|XP)/,/(Windows).+(Win 9x 4\.90)/,/(Windows).+(Win9\d)/,/(Windows).+(WinNT4.0)/]},versions={browser:{},system:{'10.0':'10.0 (Cheetah)','10.1':'10.1 (Puma)','10.2':'10.2 (Jaguar)','10.3':'10.3 (Panther)','10.4':'10.4 (Tiger)','10.5':'10.5 (Leopard)','10.6':'10.6 (Snow Leopard)','10.7':'10.7 (Lion)','10.8':'10.8 (Mountain Lion)','CrOS':'Chrome OS','NT 4.0':'NT 4.0 (Windows NT)','NT 4.1':'NT 4.1 (Windows 98)','Win 9x 4.90':'NT 4.9 (Windows ME)','NT 5.0':'NT 5.0 (Windows 2000)','NT 5.1':'NT 5.1 (Windows XP)','NT 5.2':'NT 5.2 (Windows 2003)','NT 6.0':'NT 6.0 (Windows Vista)','NT 6.1':'NT 6.1 (Windows 7)','NT 6.2':'NT 6.2 (Windows 8)','95':'NT 4.0 (Windows 95)','NT':'NT 4.0 (Windows NT)','98':'NT 4.1 (Windows 98)','ME':'NT 4.9 (Windows ME)','2000':'NT 5.0 (Windows 2000)','2003':'NT 5.2 (Windows 2003)','XP':'NT 5.1 (Windows XP)','Win95':'NT 4.0 (Windows 95)','WinNT4.0':'NT 4.0 (Windows NT)','Win98':'NT 4.1 (Windows 98)'}},userAgentData={};Ox.forEach(regexps,function(regexps,key){userAgentData[key]={name:'',string:'',version:''};Ox.forEach(aliases[key],function(regexp,alias){userAgent=userAgent.replace(regexp,key=='browser'?alias:alias+' $1');});Ox.forEach(regexps,function(regexp){var matches=userAgent.match(regexp),name,string,swap,version;if(matches){matches[2]=matches[2]||'';swap=matches[1].match(/^\d/)||matches[2]=='Linux';name=matches[swap?2:1];version=matches[swap?1:2].replace('_','.');name=names[key][name]||name,version=versions[key][version]||version;string=name;if(version){string+=' '+(['BSD','Linux','Unix'].indexOf(name)>-1?'('+version+')':version)}
userAgentData[key]={name:names[name]||name,string:string,version:versions[version]||version};return false;}});});return userAgentData;};Ox.repeat=function(value,times){var ret;if(Ox.isArray(value)){ret=[];Ox.loop(times,function(){ret=ret.concat(value);});}else{ret=times>=1?new Array(times+1).join(value.toString()):'';}
return ret;};Ox.splice=function(string,index,remove){var array=string.split('');Array.prototype.splice.apply(array,Ox.slice(arguments,1));return array.join('');};Ox.startsWith=function(string,substring){string=string.toString();substring=substring.toString();return string.slice(0,substring.length)==substring;};Ox.toCamelCase=function(string){return string.replace(/[\-\/_][a-z]/g,function(string){return string[1].toUpperCase();});};Ox.toDashes=function(string){return string.replace(/[A-Z]/g,function(string){return'-'+string.toLowerCase();});};Ox.toSlashes=function(string){return string.replace(/[A-Z]/g,function(string){return'/'+string.toLowerCase();});};Ox.toTitleCase=function(string){return string.split(' ').map(function(value){var substring=value.slice(1),lowercase=substring.toLowerCase();if(substring==lowercase){value=value.slice(0,1).toUpperCase()+lowercase;}
return value;}).join(' ');};Ox.toUnderscores=function(string){return string.replace(/[A-Z]/g,function(string){return'_'+string.toLowerCase();});};Ox.truncate=function(string,position,length,padding){var hasPosition=Ox.isString(arguments[1]),last=Ox.last(arguments);position=hasPosition?arguments[1]:'right';length=hasPosition?arguments[2]:arguments[1];padding=Ox.isString(last)?last:'…';if(string.length>length){if(position=='left'){string=padding
+string.slice(padding.length+string.length-length);}else if(position=='center'){string=string.slice(0,Math.ceil((length-padding.length)/2))
+padding
+string.slice(-Math.floor((length-padding.length)/2));}else if(position=='right'){string=string.slice(0,length-padding.length)+padding;}}
return string;};Ox.words=function(string){var array=string.toLowerCase().split(/\b/),length=array.length,startsWithWord=/\w/.test(array[0]);array.forEach(function(v,i){if(i>0&&i<length-1&&(v=='-'||v=='\'')){array[i+1]=array[i-1]+array[i]+array[i+1];array[i-1]=array[i]='';}});array=array.filter(function(v){return v.length;});return array.filter(function(v,i){return i%2==!startsWithWord;});}
Ox.wordwrap=function(string,length){var balanced,lines,max,newline,words;string=String(string);length=length||80;balanced=Ox.isBoolean(arguments[2])?arguments[2]:Ox.isBoolean(arguments[3])?arguments[3]:false;newline=Ox.isString(arguments[2])?arguments[2]:Ox.isString(arguments[3])?arguments[3]:'\n';words=string.split(' ');if(balanced){lines=Ox.wordwrap(string,length,newline).split(newline);if(lines.length>1){max=Ox.max(words.map(function(word){return word.length;}));while(length>max){if(Ox.wordwrap(string,--length,newline).split(newline).length>lines.length){length++;break;}}}}
lines=[''];words.forEach(function(word){var index;if((lines[lines.length-1]+word).length<=length){lines[lines.length-1]+=word+' ';}else{if(word.length<=length){lines.push(word+' ');}else{index=length-lines[lines.length-1].length;lines[lines.length-1]+=word.slice(0,index);while(index<word.length){lines.push(word.substr(index,length));index+=length;}
lines[lines.length-1]+=' ';}}});return lines.join(newline).trim();};'use strict';Ox.avg=function(collection){return Ox.sum(collection)/Ox.len(collection);};Ox.clone=function(collection,deep){var ret,type=Ox.typeOf(collection);if(type!='array'&&type!='object'){ret=collection;}else if(deep){ret=type=='array'?[]:{};Ox.forEach(collection,function(value,key){type=Ox.typeOf(value);ret[key]=type=='array'||type=='object'?Ox.clone(value,true):value;});}else{ret=type=='array'?collection.slice():Ox.extend({},collection)}
return ret;};Ox.contains=function(collection,value){return(Ox.isObject(collection)?Ox.values(collection):collection).indexOf(value)>-1;};Ox.count=function(collection,value){var count={};Ox.forEach(collection,function(value){count[value]=(count[value]||0)+1;});return value?count[value]||0:count;};Ox.every=function(collection,iterator){return Ox.filter(Ox.values(collection),iterator||Ox.identity).length==Ox.len(collection);};Ox.filter=function(collection,iterator,that){var ret,type=Ox.typeOf(collection);iterator=iterator||Ox.identity;if(type=='object'||type=='storage'){ret={};Ox.forEach(collection,function(value,key){if(iterator.call(that,value,key,collection)){ret[key]=value;}});}else{ret=Ox.toArray(collection).filter(iterator,that);if(type=='string'){ret=ret.join('');}}
return ret;};Ox.forEach=function(collection,iterator,that){var i=0,key,type=Ox.typeOf(collection);if(type=='object'||type=='storage'){for(key in collection){if(Ox.hasOwn(collection,key)&&iterator.call(that,collection[key],key,collection)===false){break;}
i++;}}else{collection=Ox.toArray(collection);for(i=0;i<collection.length;i++){if(i in collection&&iterator.call(that,collection[i],i,collection)===false){break;}}}
return i;};Ox.indexOf=function(collection,test){var index=Ox.forEach(collection,function(value){return!test(value);});return Ox.isObject(collection)?Object.keys(collection)[index]||null:index==collection.length?-1:index;};Ox.indicesOf=function(collection,test){var ret=[];Ox.forEach(collection,function(value,index){test(value)&&ret.push(index);});return ret;};Ox.len=function(collection){var ret,type=Ox.typeOf(collection);if(type=='arguments'||type=='array'||type=='nodelist'||type=='string'){ret=collection.length;}else if(type=='object'||type=='storage'){ret=Object.keys(collection).length;}
return ret;};Ox.map=function(collection,iterator,that){var ret,type=Ox.typeOf(collection);if(type=='object'||type=='storage'){ret={};Ox.forEach(collection,function(value,key){ret[key]=iterator.call(that,value,key,collection);});}else{ret=Ox.toArray(collection).map(iterator);if(type=='string'){ret=ret.join('');}}
return ret;};Ox.max=function(collection){var ret,values=Ox.values(collection);if(values.length<Ox.STACK_LENGTH){ret=Math.max.apply(null,values)}else{ret=values.reduce(function(previousValue,currentValue){return Math.max(previousValue,currentValue);},-Infinity);}
return ret;};Ox.min=function(collection){var ret,values=Ox.values(collection);if(values.length<Ox.STACK_LENGTH){ret=Math.min.apply(null,values)}else{ret=values.reduce(function(previousValue,currentValue){return Math.min(previousValue,currentValue);},Infinity);}
return ret;};Ox.reverse=function(collection){return Ox.isArray(collection)?Ox.clone(collection).reverse():collection.toString().split('').reverse().join('');};Ox.shuffle=function(collection){var keys,ret,type=Ox.typeOf(collection),values;if(type=='object'||type=='storage'){keys=Object.keys(collection);values=Ox.shuffle(Ox.values(collection));ret={};keys.forEach(function(key,index){ret[key]=values[index];});}else{ret=[];Ox.toArray(collection).forEach(function(value,index){var random=Math.floor(Math.random()*(index+1));ret[index]=ret[random];ret[random]=value;});if(type=='string'){ret=ret.join('');}}
return ret;};Ox.slice=function(value,start,stop){return Array.prototype.slice.call(value,start,stop);};if(Ox.slice([0]).length==0||Ox.slice('0')[0]===null||Ox.slice('0')[0]===void 0){Ox.slice=function(value,start,stop){if(Ox.typeOf(value)=='string'){value=value.split('');}
return stop===void 0?Array.prototype.slice.call(value,start):Array.prototype.slice.call(value,start,stop);};}
Ox.some=function(collection,iterator){return Ox.filter(Ox.values(collection),iterator||Ox.identity).length>0;};Ox.sum=function(collection){var ret=0;collection=arguments.length>1?Ox.toArray(arguments):collection;Ox.forEach(collection,function(value){value=+value;ret+=isFinite(value)?value:0;});return ret;};Ox.values=function(collection){var ret,type=Ox.typeOf(collection);if(type=='array'){ret=Ox.clone(collection);}else if(type=='object'||type=='storage'){ret=[];Ox.forEach(collection,function(value){ret.push(value);});}else if(type=='string'){ret=collection.split('');}
return ret;};Ox.walk=function(collection,iterator,that,keys){keys=keys||[];Ox.forEach(collection,function(value,key){var keys_=keys.concat(key);iterator.call(that,value,keys_,collection);Ox.walk(collection[key],iterator,that,keys_);});};'use strict';Ox.acosh=function(x){return Math.log(x+Math.sqrt(x*x-1));};Ox.asinh=function(x){return Math.log(x+Math.sqrt(x*x+1));};Ox.atanh=function(x){return 0.5*Math.log((1+x)/(1-x));};Ox.cosh=function(x){return(Math.exp(x)+Math.exp(-x))/2;};Ox.deg=function(rad){return rad*180/Math.PI;};Ox.hypot=function(x,y,z){z=z||0;return Math.sqrt(x*x+y*y+z*z)||0;};Ox.limit=function(){var number=arguments[0],min=arguments.length==3?arguments[1]:-Infinity,max=arguments[arguments.length-1];return Math.min(Math.max(number,min),max);};Ox.log=function(number,base){return Math.log(number)/Math.log(base||Math.E);};Ox.mod=function(number,by){return(number%by+by)%by;};Ox.rad=function(deg){return deg*Math.PI/180;};Ox.random=function(){var min=arguments.length==2?arguments[0]:0,max=arguments.length?Ox.last(arguments):2;return min+Math.floor(Math.random()*(max-min));};Ox.round=function(number,decimals){var pow=Math.pow(10,decimals||0);return Math.round(number*pow)/pow;};Ox.sign=function(x){x=+x;return x!==x||x===0?x:x<0?-1:1;};Ox.sinh=function(x){return(Math.exp(x)-Math.exp(-x))/2;};Ox.splitInt=function(number,by){var div=Math.floor(number/by),mod=number%by;return Ox.range(by).map(function(i){return div+(i>by-1-mod);});};Ox.tanh=function(x){return(Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x));};Ox.trunc=function(x){return~~x;};'use strict';(function(){function asyncMap(forEach,collection,iterator,that,callback){var type=Ox.typeOf(collection),results=type=='object'?{}:[];callback=Ox.last(arguments);that=arguments.length==5?that:null;forEach(collection,function(value,key,collection,callback){iterator(value,key,collection,function(value){results[key]=value;callback();});},that,function(){callback(type=='string'?results.join(''):results);});};Ox.asyncMap=function(array,iterator,that,callback){array=Ox.makeArray(array);callback=Ox.last(arguments);that=arguments.length==4?that:null;if(array.some(Ox.isArray)){Ox.serialMap(array,function(value,key,array,callback){Ox.parallelMap(Ox.makeArray(value),iterator,callback);},callback);}else{Ox.parallelMap(array,iterator,callback);}};Ox.nonblockingForEach=function(collection,iterator,that,callback,ms){var i=0,keys,last=Ox.last(arguments),n,time,type=Ox.typeOf(collection);callback=Ox.isFunction(last)?last:arguments[arguments.length-2];collection=type=='array'||type=='object'?collection:Ox.toArray(collection);keys=type=='object'?Object.keys(collection):Ox.range(collection.length);ms=ms||1000;n=Ox.len(collection);that=arguments.length==5||(arguments.length==4&&Ox.isFunction(last))?that:null;time=+new Date();iterate();function iterate(){Ox.forEach(keys.slice(i),function(key){if(key in collection){if(iterator.call(that,collection[key],key,collection)===false){i=n;return false;}}
i++;if(+new Date()>=time+ms){return false;}});if(i<n){setTimeout(function(){time=+new Date();iterate();},1);}else{callback();}}};Ox.nonblockingMap=function(collection,iterator,that,callback,ms){var last=Ox.last(arguments),type=Ox.typeOf(collection),results=type=='object'?{}:[];callback=Ox.isFunction(last)?last:arguments[arguments.length-2];that=arguments.length==5||(arguments.length==4&&Ox.isFunction(last))?that:null;Ox.nonblockingForEach(collection,function(value,key,collection){results[key]=iterator.call(that,value,key,collection);},function(){callback(type=='string'?results.join(''):results);},ms);};Ox.parallelForEach=function(collection,iterator,that,callback){var i=0,n,type=Ox.typeOf(collection);callback=Ox.last(arguments);collection=type=='array'||type=='object'?collection:Ox.toArray(collection);n=Ox.len(collection);that=arguments.length==4?that:null;Ox.forEach(collection,function(value,key,collection){iterator.call(that,value,key,collection,function(){++i==n&&callback();});});};Ox.parallelMap=function(){asyncMap.apply(null,[Ox.parallelForEach].concat(Ox.toArray(arguments)));};Ox.serialForEach=function(collection,iterator,that,callback){var i=0,keys,n,type=Ox.typeOf(collection);callback=Ox.last(arguments);collection=type=='array'||type=='object'?collection:Ox.toArray(collection);keys=type=='object'?Object.keys(collection):Ox.range(collection.length);n=Ox.len(collection);that=arguments.length==4?that:null;iterate();function iterate(){keys[i]in collection&&iterator.call(that,collection[keys[i]],keys[i],collection,function(){++i<n?iterate():callback();});}};Ox.serialMap=function(collection,iterator,that,callback){asyncMap.apply(null,[Ox.serialForEach].concat(Ox.toArray(arguments)));};}());'use strict';Ox.hsl=function(rgb){var hsl=[0,0,0],max,min;if(arguments.length==3){rgb=Ox.toArray(arguments);}
rgb=Ox.clone(rgb).map(function(value){return value/255;});max=Ox.max(rgb);min=Ox.min(rgb);hsl[2]=0.5*(max+min);if(max==min){hsl[0]=0;hsl[1]=0;}else{if(max==rgb[0]){hsl[0]=(60*(rgb[1]-rgb[2])/(max-min)+360)%360;}else if(max==rgb[1]){hsl[0]=60*(rgb[2]-rgb[0])/(max-min)+120;}else if(max==rgb[2]){hsl[0]=60*(rgb[0]-rgb[1])/(max-min)+240;}
if(hsl[2]<=0.5){hsl[1]=(max-min)/(2*hsl[2]);}else{hsl[1]=(max-min)/(2-2*hsl[2]);}}
return hsl;};Ox.rgb=function(hsl){var rgb=[0,0,0],v1,v2,v3;if(arguments.length==3){hsl=Ox.toArray(arguments);}
hsl=Ox.clone(hsl);hsl[0]/=360;if(hsl[1]==0){rgb=[hsl[2],hsl[2],hsl[2]];}else{if(hsl[2]<0.5){v2=hsl[2]*(1+hsl[1]);}else{v2=hsl[1]+hsl[2]-(hsl[1]*hsl[2]);}
v1=2*hsl[2]-v2;rgb.forEach(function(v,i){v3=hsl[0]+(1-i)*1/3;if(v3<0){v3++;}else if(v3>1){v3--;}
if(v3<1/6){rgb[i]=v1+((v2-v1)*6*v3);}else if(v3<0.5){rgb[i]=v2;}else if(v3<2/3){rgb[i]=v1+((v2-v1)*6*(2/3-v3));}else{rgb[i]=v1;}});}
return rgb.map(function(value){return Math.round(value*255);});};Ox.toHex=function(rgb){return rgb.map(function(value){return Ox.pad(value.toString(16).toUpperCase(),'left',2,'0');}).join('');};Ox.toRGB=function(hex){return Ox.range(3).map(function(index){return parseInt(hex.substr(index*2,2),16);});};'use strict';Ox.AMPM=['AM','PM'];Ox.BASE_32_ALIASES={'I':'1','L':'1','O':'0','U':'V'},Ox.BASE_32_DIGITS='0123456789ABCDEFGHJKMNPQRSTVWXYZ';Ox.BCAD=['BC','AD'];Ox.EARTH_RADIUS=6378137;Ox.EARTH_CIRCUMFERENCE=2*Math.PI*Ox.EARTH_RADIUS;Ox.EARTH_SURFACE=4*Math.PI*Math.pow(Ox.EARTH_RADIUS,2);Ox.HTML_ENTITIES={'"':'&quot;','&':'&amp;',"'":'&apos;','<':'&lt;','>':'&gt;'};Ox.KEYS={0:'section',8:'backspace',9:'tab',12:'clear',13:'enter',16:'shift',17:'control',18:'alt',20:'capslock',27:'escape',32:'space',33:'pageup',34:'pagedown',35:'end',36:'home',37:'left',38:'up',39:'right',40:'down',45:'insert',46:'delete',47:'help',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',91:'meta.left',92:'meta.right',93:'meta.right',96:'0.numpad',97:'1.numpad',98:'2.numpad',99:'3.numpad',100:'4.numpad',101:'5.numpad',102:'6.numpad',103:'7.numpad',104:'8.numpad',105:'9.numpad',106:'asterisk.numpad',107:'plus.numpad',109:'minus.numpad',108:'enter.numpad',110:'dot.numpad',111:'slash.numpad',112:'f1',113:'f2',114:'f3',115:'f4',116:'f5',117:'f6',118:'f7',119:'f8',120:'f9',121:'f10',122:'f11',123:'f12',124:'f13',125:'f14',126:'f15',127:'f16',128:'f17',129:'f18',130:'f19',131:'f20',144:'numlock',145:'scrolllock',186:'semicolon',187:'equal',188:'comma',189:'minus',190:'dot',191:'slash',192:'backtick',219:'openbracket',220:'backslash',221:'closebracket',222:'quote',224:'meta'},Ox.MAX_LATITUDE=Ox.deg(Math.atan(Ox.sinh(Math.PI)));Ox.MIN_LATITUDE=-Ox.MAX_LATITUDE;Ox.MODIFIER_KEYS={altKey:'alt',ctrlKey:'control',shiftKey:'shift',metaKey:'meta'}
Ox.MONTHS=['January','February','March','April','May','June','July','August','September','October','November','December'];Ox.SHORT_MONTHS=Ox.MONTHS.map(function(val){return val.slice(0,3);});Ox.PATH=Ox.toArray(document.getElementsByTagName('script')).reverse().filter(function(element){return/Ox\.js$/.test(element.src);})[0].src.replace(/Ox\.js$/,'');Ox.PREFIXES=['','K','M','G','T','P'];Ox.SEASONS=['Winter','Spring','Summer','Fall'];Ox.STACK_SIZE=65536;Ox.SYMBOLS={DOLLAR:'\u0024',CENT:'\u00A2',POUND:'\u00A3',CURRENCY:'\u00A4',YEN:'\u00A5',BULLET:'\u2022',ELLIPSIS:'\u2026',PERMILLE:'\u2030',COLON:'\u20A1',CRUZEIRO:'\u20A2',FRANC:'\u20A3',LIRA:'\u20A4',NAIRA:'\u20A6',PESETA:'\u20A7',WON:'\u20A9',SHEQEL:'\u20AA',DONG:'\u20AB',EURO:'\u20AC',KIP:'\u20AD',TUGRIK:'\u20AE',DRACHMA:'\u20AF',PESO:'\u20B1',GUARANI:'\u20B2',AUSTRAL:'\u20B3',HRYVNIA:'\u20B4',CEDI:'\u20B5',TENGE:'\u20B8',RUPEE:'\u20B9',CELSIUS:'\u2103',FAHRENHEIT:'\u2109',POUNDS:'\u2114',OUNCE:'\u2125',OHM:'\u2126',KELVIN:'\u212A',ANGSTROM:'\u212B',INFO:'\u2139',LEFT:'\u2190',UP:'\u2191',RIGHT:'\u2192',DOWN:'\u2193',HOME:'\u2196',END:'\u2198',RETURN:'\u21A9',REDO:'\u21BA',UNDO:'\u21BB',PAGEUP:'\u21DE',PAGEDOWN:'\u21DF',CAPSLOCK:'\u21EA',TAB:'\u21E5',SHIFT:'\u21E7',INFINITY:'\u221E',CONTROL:'\u2303',COMMAND:'\u2318',ENTER:'\u2324',ALT:'\u2325',DELETE:'\u2326',CLEAR:'\u2327',BACKSPACE:'\u232B',OPTION:'\u2387',NAVIGATE:'\u2388',ESCAPE:'\u238B',EJECT:'\u23CF',SPACE:'\u2423',DIAMOND:'\u25C6',STAR:'\u2605',SOUND:'\u266B',TRASH:'\u267A',FLAG:'\u2691',ANCHOR:'\u2693',GEAR:'\u2699',ATOM:'\u269B',WARNING:'\u26A0',CUT:'\u2702',BACKUP:'\u2707',FLY:'\u2708',CHECK:'\u2713',CLOSE:'\u2715',BALLOT:'\u2717',WINDOWS:'\u2756',EDIT:'\uF802',CLICK:'\uF803',APPLE:'\uF8FF'};Ox.VERSION='0.1.2612';Ox.WEEKDAYS=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];Ox.SHORT_WEEKDAYS=Ox.WEEKDAYS.map(function(val){return val.slice(0,3);});'use strict';Ox.$=Ox.element=function(value){var element=!Ox.isString(value)?value:value[0]=='<'?document.createElement(value.slice(1,-1)):value[0]=='#'?document.getElementById(value.slice(1)):value[0]=='.'?document.getElementsByClassName(value.slice(1))[0]:document.getElementsByTagName(value)[0];return element?{0:element,addClass:function(string){this[0].className=Ox.unique(((this[0].className?this[0].className+' ':'')+Ox.clean(string)).split(' ')).join(' ');return this;},append:function(){var that=this;Ox.makeArray(arguments[0]).forEach(function(element){that[0].appendChild(element[0]);});return this;},appendTo:function(element){element[0].appendChild(this[0]);return this;},attr:function(){var ret,that=this;if(arguments.length==1&&Ox.isString(arguments[0])){ret=this[0].getAttribute(arguments[0]);if(ret===null){ret=void 0;}}else{Ox.forEach(Ox.makeObject(arguments),function(value,key){that[0].setAttribute(key,value);});ret=this;}
return ret;},css:function(){var ret,that=this;if(arguments.length==1&&Ox.isString(arguments[0])){ret=this[0].style[arguments[0]];}else{Ox.forEach(Ox.makeObject(arguments),function(value,key){that[0].style[key]=value;});ret=this;}
return ret;},empty:function(){return this.html('');},hasClass:function(string){return this[0].className.split(' ').indexOf(string)>-1;},height:function(){return this[0].offsetHeight;},hide:function(){return this.css({display:'none'});},html:function(string){var ret;if(arguments.length==0){ret=this[0].innerHTML;}else{this[0].innerHTML=string;ret=this;}
return ret;},on:function(){var that=this;Ox.forEach(Ox.makeObject(arguments),function(callback,event){that[0].addEventListener(event,callback,false);});return this;},one:function(events){var that=this;Ox.forEach(Ox.makeObject(arguments),function(callback,event){that.on(event,function fn(){that.off(event,fn);callback();});});return this;},off:function(event,callback){var that=this;Ox.forEach(Ox.makeObject(arguments),function(callback,event){if(callback){that[0].removeEventListener(event,callback,false);}else{that[0]['on'+event]=null;}});return this;},remove:function(){this[0].parentNode.removeChild(this[0]);return this;},removeAttr:function(){var that=this;Ox.makeArray(arguments[0]).forEach(function(key){that[0].removeAttribute(key);});return this;},removeClass:function(string){var array=Ox.clean(string).split(' ');this[0].className=this[0].className.split(' ').filter(function(className){return array.indexOf(className)==-1;}).join(' ');return this;},show:function(){return this.css({display:'block'});},toggleClass:function(string){return this[this.hasClass(string)?'removeClass':'addClass'](string);},trigger:function(event){var e=document.createEvent('MouseEvents');e.initEvent(event,true,true);this[0].dispatchEvent(e);return this;},val:function(value){var ret;if(arguments.length==0){ret=this[0].value;}else{this[0].value=value;ret=this;}
return ret;},width:function(){return this[0].offsetWidth;}}:null;};Ox.canvas=function(){var c={},isImage=arguments.length==1,image=isImage?arguments[0]:{width:arguments[0],height:arguments[1]};c.context=(c.canvas=Ox.$('<canvas>').attr({width:image.width,height:image.height})[0]).getContext('2d');isImage&&c.context.drawImage(image,0,0);c.data=(c.imageData=c.context.getImageData(0,0,image.width,image.height)).data;return c;};Ox.documentReady=(function(){var callbacks=[];document.onreadystatechange=window.onload=function(){if(document.readyState=='complete'){callbacks.forEach(function(callback){callback();});document.onreadystatechange=window.onload=null;}};return function(callback){if(document.readyState=='complete'){callback();return true;}else{callbacks.push(callback);return false;}};}());'use strict';Ox.getDateInWeek=function(date,weekday,utc){date=Ox.makeDate(date);var sourceWeekday=Ox.getISODay(date,utc),targetWeekday=Ox.isNumber(weekday)?weekday:Ox.indexOf(Ox.WEEKDAYS,function(v){return v.slice(0,3)==weekday.slice(0,3);})+1;return Ox.setDate(date,Ox.getDate(date,utc)-sourceWeekday+targetWeekday,utc);}
Ox.getDayOfTheYear=function(date,utc){date=Ox.makeDate(date);var month=Ox.getMonth(date,utc),year=Ox.getFullYear(date,utc);return Ox.sum(Ox.range(month).map(function(i){return Ox.getDaysInMonth(year,i+1);}))+Ox.getDate(date,utc);};Ox.getDaysInMonth=function(year,month){year=Ox.makeYear(year);month=Ox.isNumber(month)?month:Ox.indexOf(Ox.MONTHS,function(v){return v.slice(0,3)==month.slice(0,3);})+1;return new Date(year,month,0).getDate();}
Ox.getDaysInYear=function(year,utc){return 365+Ox.isLeapYear(Ox.makeYear(year,utc));};Ox.getFirstDayOfTheYear=function(date,utc){date=Ox.makeDate(date);date=Ox.setMonth(date,0,utc);date=Ox.setDate(date,1,utc);return Ox.getDay(date,utc)};Ox.getISODate=function(date,utc){return Ox.formatDate(Ox.makeDate(date),'%FT%TZ',utc);};Ox.getISODay=function(date,utc){return Ox.getDay(Ox.makeDate(date),utc)||7;};Ox.getISOWeek=function(date,utc){date=Ox.makeDate(date);return Math.floor((Ox.getDayOfTheYear(Ox.setDate(date,Ox.getDate(date,utc)-Ox.getISODay(date,utc)+4,utc),utc)-1)/7)+1;};Ox.getISOYear=function(date,utc){date=Ox.makeDate(date);return Ox.getFullYear(Ox.setDate(date,Ox.getDate(date,utc)-Ox.getISODay(date,utc)+4,utc));};Ox.getTime=function(utc){return+new Date()-(utc?Ox.getTimezoneOffset():0);};Ox.getTimezoneOffset=function(date){return Ox.makeDate(date).getTimezoneOffset()*60000;};Ox.getTimezoneOffsetString=function(date){var offset=Ox.makeDate(date).getTimezoneOffset();return(offset<=0?'+':'-')
+Ox.pad(Math.floor(Math.abs(offset)/60),2)
+Ox.pad(Math.abs(offset)%60,2);};Ox.getWeek=function(date,utc){date=Ox.makeDate(date);return Math.floor((Ox.getDayOfTheYear(date,utc)
+Ox.getFirstDayOfTheYear(date,utc)-1)/7);};Ox.isLeapYear=function(year,utc){year=Ox.makeYear(year,utc);return year%4==0&&(year%100!=0||year%400==0);};Ox.makeDate=function(date){return Ox.isUndefined(date)?new Date():new Date(date);};Ox.makeYear=function(date,utc){return Ox.isDate(date)?Ox.getFullYear(date,utc):parseInt(date,10);};Ox.parseDate=function(string,utc){var date,defaults=[,1,1,0,0,0,0],values=/(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?\.?(\d+)?/.exec(string);if(values){values.shift();date=new Date();values=values.map(function(v,i){return v?(i==6?Ox.pad(v,3,'0'):v):defaults[i];});values[1]--;['FullYear','Month','Date','Hours','Minutes','Seconds','Milliseconds'].forEach(function(part,i){Ox['set'+part](date,values[i],utc);});}else{date=null;}
return date;};['FullYear','Month','Date','Day','Hours','Minutes','Seconds','Milliseconds'].forEach(function(part){Ox['get'+part]=function(date,utc){return Ox.makeDate(date)['get'+(utc?'UTC':'')+part]();}
Ox['set'+part]=function(date,num,utc){return(Ox.isDate(date)?date:new Date(date))['set'+(utc?'UTC':'')+part](num);}});'use strict';Ox.encodeBase26=function(number){var string='';while(number){string=String.fromCharCode(65+(number-1)%26)+string;number=Math.floor((number-1)/26);}
return string;};Ox.decodeBase26=function(string){return string.toUpperCase().split('').reverse().reduce(function(p,c,i){return p+(c.charCodeAt(0)-64)*Math.pow(26,i);},0);};Ox.encodeBase32=function(number){return Ox.map(number.toString(32),function(char){return Ox.BASE_32_DIGITS[parseInt(char,32)];});};Ox.decodeBase32=function(string){return parseInt(Ox.map(string.toUpperCase(),function(char){var index=Ox.BASE_32_DIGITS.indexOf(Ox.BASE_32_ALIASES[char]||char);return index==-1?' ':index.toString(32);}),32);};Ox.encodeBase64=function(number){return btoa(Ox.encodeBase256(number)).replace(/=/g,'');};Ox.decodeBase64=function(string){return Ox.decodeBase256(atob(string));};Ox.encodeBase128=function(number){var string='';while(number){string=Ox.char(number&127)+string;number>>=7;}
return string;};Ox.decodeBase128=function(string){return string.split('').reverse().reduce(function(p,c,i){return p+(c.charCodeAt(0)<<i*7);},0);};Ox.encodeBase256=function(number){var string='';while(number){string=Ox.char(number&255)+string;number>>=8;}
return string;};Ox.decodeBase256=function(string){return string.split('').reverse().reduce(function(p,c,i){return p+(c.charCodeAt(0)<<i*8);},0);};Ox.encodeDeflate=function(string,callback){string=Ox.encodeUTF8(string);var length=1+string.length,c=Ox.canvas(Math.ceil(length/3),1),data,idat,pad=(3-length%3)%3;string=Ox.char(pad)+string+Ox.repeat('\u00FF',pad);Ox.loop(c.data.length,function(i){c.data[i]=i%4<3?string.charCodeAt(i-parseInt(i/4)):255;});c.context.putImageData(c.imageData,0,0);string=atob(c.canvas.toDataURL().split(',')[1]);data=string.slice(16,20)+string.slice(29,33);idat=string.slice(33,-12);while(idat){length=idat.slice(0,4);data+=length+idat.slice(8,12+(length=Ox.decodeBase256(length)));idat=idat.slice(12+length);}
callback&&callback(data);return data;};Ox.decodeDeflate=function(string,callback){var image=new Image(),data='\u0089PNG\r\n\u001A\n\u0000\u0000\u0000\u000DIHDR'
+string.slice(0,4)+'\u0000\u0000\u0000\u0001'
+'\u0008\u0006\u0000\u0000\u0000'+string.slice(4,8),idat=string.slice(8),length;function error(){throw new RangeError('Deflate codec can\'t decode data.');}
while(idat){length=idat.slice(0,4);data+=length+'IDAT'+idat.slice(4,8+(length=Ox.decodeBase256(length)));idat=idat.slice(8+length);}
data+='\u0000\u0000\u0000\u0000IEND\u00AE\u0042\u0060\u0082';image.onload=function(){string=Ox.toArray(Ox.canvas(image).data).map(function(value,index){return index%4<3?Ox.char(value):'';}).join('');try{string=Ox.decodeUTF8(string.slice(1,-string.charCodeAt(0)||void 0));}catch(e){error();}
callback(string);}
image.onerror=error;image.src='data:image/png;base64,'+btoa(data);};Ox.encodeUTF8=function(string){return Ox.map(string,function(char){var code=char.charCodeAt(0),string='';if(code<128){string=char;}else if(code<2048){string=String.fromCharCode(code>>6|192)
+String.fromCharCode(code&63|128);}else{string=String.fromCharCode(code>>12|224)
+String.fromCharCode(code>>6&63|128)
+String.fromCharCode(code&63|128);}
return string;});};Ox.decodeUTF8=function(string){var code,i=0,length=string.length,ret='';function error(byte,position){throw new RangeError('UTF-8 codec can\'t decode byte 0x'+byte.toString(16).toUpperCase()+' at position '+position);}
while(i<length){code=[string.charCodeAt(i),string.charCodeAt(i+1),string.charCodeAt(i+2)];if(code[0]<=128){ret+=string[i];i++;}else if(code[0]>=192&&code[0]<240&&i<length-(code[0]<224?1:2)){if(code[1]>=128&&code[1]<192){if(code[0]<224){ret+=String.fromCharCode((code[0]&31)<<6|code[1]&63);i+=2;}else if(code[2]>=128&&code[2]<192){ret+=String.fromCharCode((code[0]&15)<<12|(code[1]&63)<<6|code[2]&63);i+=3;}else{error(code[2],i+2);}}else{error(code[1],i+1);}}else{error(code[0],i);}}
return ret;};'use strict';Ox.formatArea=function(number,decimals){var k=number>=1000000?'k':'';decimals=Ox.isUndefined(decimals)?8:decimals;return Ox.formatNumber((k?number/1000000:number).toPrecision(decimals))+' '+k+'m\u00B2';};Ox.formatCount=function(number,singular,plural){return(number===0?'no':Ox.formatNumber(number))+' '
+(number===1?singular:plural||singular+'s');};Ox.formatCurrency=function(number,string,decimals){return string+Ox.formatNumber(number,decimals);};(function(){var format=[['%',function(){return'%{%}';}],['c',function(){return'%D %r';}],['D',function(){return'%m/%d/%y';}],['F',function(){return'%Y-%m-%d';}],['h',function(){return'%b';}],['R',function(){return'%H:%M';}],['r',function(){return'%I:%M:%S %p';}],['T',function(){return'%H:%M:%S';}],['v',function(){return'%e-%b-%Y';}],['\\+',function(){return'%a %b %e %H:%M:%S %Z %Y';}],['A',function(date,utc){return Ox.WEEKDAYS[(Ox.getDay(date,utc)+6)%7];}],['a',function(date,utc){return Ox.SHORT_WEEKDAYS[(Ox.getDay(date,utc)+6)%7];}],['B',function(date,utc){return Ox.MONTHS[Ox.getMonth(date,utc)];}],['b',function(date,utc){return Ox.SHORT_MONTHS[Ox.getMonth(date,utc)];}],['C',function(date,utc){return Math.floor(Ox.getFullYear(date,utc)/100).toString();}],['d',function(date,utc){return Ox.pad(Ox.getDate(date,utc),2);}],['e',function(date,utc){return Ox.pad(Ox.getDate(date,utc),2,' ');}],['G',function(date,utc){return Ox.getISOYear(date,utc);}],['g',function(date,utc){return Ox.getISOYear(date,utc).toString().slice(-2);}],['H',function(date,utc){return Ox.pad(Ox.getHours(date,utc),2);}],['I',function(date,utc){return Ox.pad((Ox.getHours(date,utc)+11)%12+1,2);}],['j',function(date,utc){return Ox.pad(Ox.getDayOfTheYear(date,utc),3);}],['k',function(date,utc){return Ox.pad(Ox.getHours(date,utc),2,' ');}],['l',function(date,utc){return Ox.pad(((Ox.getHours(date,utc)+11)%12+1),2,' ');}],['M',function(date,utc){return Ox.pad(Ox.getMinutes(date,utc),2);}],['m',function(date,utc){return Ox.pad((Ox.getMonth(date,utc)+1),2);}],['p',function(date,utc){return Ox.AMPM[Math.floor(Ox.getHours(date,utc)/12)];}],['Q',function(date,utc){return Math.floor(Ox.getMonth(date,utc)/4)+1;}],['S',function(date,utc){return Ox.pad(Ox.getSeconds(date,utc),2);}],['s',function(date,utc){return Math.floor((+date-(utc?Ox.getTimezoneOffset(date):0))/1000);}],['U',function(date,utc){return Ox.pad(Ox.getWeek(date,utc),2);}],['u',function(date,utc){return Ox.getISODay(date,utc);}],['V',function(date,utc){return Ox.pad(Ox.getISOWeek(date,utc),2);}],['W',function(date,utc){return Ox.pad(Math.floor((Ox.getDayOfTheYear(date,utc)
+(Ox.getFirstDayOfTheYear(date,utc)||7)-2)/7),2);}],['w',function(date,utc){return Ox.getDay(date,utc);}],['X',function(date,utc){var y=Ox.getFullYear(date,utc);return Math.abs(y)+' '+Ox.BCAD[y<0?0:1];}],['x',function(date,utc){var y=Ox.getFullYear(date,utc);return Math.abs(y)+(y<1000?' '+Ox.BCAD[y<0?0:1]:'');}],['Y',function(date,utc){return Ox.getFullYear(date,utc);}],['y',function(date,utc){return Ox.getFullYear(date,utc).toString().slice(-2);}],['Z',function(date,utc){return utc?'UTC':(date.toString().split('(')[1]||'').replace(')','');}],['z',function(date,utc){return utc?'+0000':Ox.getTimezoneOffsetString(date);}],['n',function(){return'\n';}],['t',function(){return'\t';}],['\\{%\\}',function(){return'%';}]].map(function(value){return[new RegExp('%'+value[0],'g'),value[1]];});Ox.formatDate=function(date,string,utc){if(date===''){return'';}
date=Ox.makeDate(date);format.forEach(function(value){string=string.replace(value[0],value[1](date,utc));});return string;};}());Ox.formatDateRange=function(start,end,utc){end=end||Ox.formatDate(new Date(),'%Y-%m-%d');var isOneUnit=false,range=[start,end],strings,dates=range.map(function(str){return Ox.parseDate(str,utc);}),parts=range.map(function(str){var parts=Ox.compact(/(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?/.exec(str));parts.shift();return parts.map(function(part){return parseInt(part,10);});}),precision=parts.map(function(parts){return parts.length;}),y=parts[0][0]<0?'%X':'%Y',formats=[y,'%B '+y,'%a, %b %e, '+y,'%a, %b %e, '+y+', %H:%M','%a, %b %e, '+y+', %H:%M','%a, %b %e, '+y+', %H:%M:%S',];if(precision[0]==precision[1]){isOneUnit=true;Ox.loop(precision[0],function(i){if((i<precision[0]-1&&parts[0][i]!=parts[1][i])||(i==precision[0]-1&&parts[0][i]!=parts[1][i]-1)){isOneUnit=false;return false;}});}
if(isOneUnit){strings=[Ox.formatDate(dates[0],formats[precision[0]-1],utc)];}else{strings=[Ox.formatDate(dates[0],formats[precision[0]-1],utc),Ox.formatDate(dates[1],formats[precision[1]-1],utc)];if(parts[0][0]==parts[1][0]&&precision[0]<=3&&precision[1]<=3){strings[0]=Ox.formatDate(dates[0],formats[precision[0]-1].replace(new RegExp(',? '+y),''),utc);}
if(parts[0][0]==parts[1][0]&&parts[0][1]==parts[1][1]&&parts[0][2]==parts[1][2]){strings[1]=strings[1].split(', ').pop();}}
return strings.join(' - ').replace(/ /g,' ');};Ox.formatDateRangeDuration=function(start,end,utc){end=end||Ox.formatDate(new Date(),'%Y-%m-%d');var date=Ox.parseDate(start,utc),dates=[start,end].map(function(string){return Ox.parseDate(string,utc);}),keys=['year','month','day','hour','minute','second'],parts=['FullYear','Month','Date','Hours','Minutes','Seconds'],values=[];date&&keys.forEach(function(key,i){while(true){if(key=='month'){var day=Ox.getDate(date,utc);Ox.setDate(date,Math.min(day,Ox.getDaysInMonth(Ox.getFullYear(date,utc),Ox.getMonth(date,utc)+2,utc)),utc);}
Ox['set'+parts[i]](date,Ox['get'+parts[i]](date,utc)+1,utc);if(date<=dates[1]){values[i]=(values[i]||0)+1;}else{Ox['set'+parts[i]](date,Ox['get'+parts[i]](date,utc)-1,utc);key=='month'&&Ox.setDate(date,day,utc);break;}}});return Ox.filter(Ox.map(values,function(value,i){return value?value+' '+keys[i]+(value>1?'s':''):'';})).join(' ');};Ox.formatDegrees=function(degrees,mode){var days=0,seconds=Math.round(Math.abs(degrees)*3600),sign=degrees<0?'-':'',array=Ox.formatDuration(seconds).split(':');if(array.length==4){days=parseInt(array.shift(),10);}
array[0]=days*24+parseInt(array[0],10);return(!mode?sign:'')
+array[0]+'°'+array[1]+"'"+array[2]+'"'
+(mode=='lat'?(degrees<0?'S':'N'):mode=='lng'?(degrees<0?'W':'E'):'');};Ox.formatDimensions=Ox.formatResolution=function(array,string){return array.join(' × ')+(string?' '+string:'');};Ox.formatDuration=function(seconds){var last=Ox.last(arguments),format=last=='short'||last=='long'?last:'none',decimals=Ox.isNumber(arguments[1])?arguments[1]:0,seconds=Ox.round(seconds,decimals),values=[Math.floor(seconds/31536000),Math.floor(seconds%31536000/86400),Math.floor(seconds%86400/3600),Math.floor(seconds%3600/60),Ox.formatNumber(seconds%60,decimals)],string=format=='short'?['y','d','h','m','s']:format=='long'?['year','day','hour','minute','second']:[],pad=[values[0].toString().length,values[0]?3:values[1].toString().length,2,2,decimals?decimals+3:2];while(!values[0]&&values.length>(format=='none'?3:1)){values.shift();string.shift();pad.shift();}
return Ox.filter(Ox.map(values,function(value,index){var ret;if(format=='none'){ret=Ox.pad(value,'left',pad[index],'0');}else if(Ox.isNumber(value)?value:parseFloat(value)){ret=value+(format=='long'?' ':'')+string[index]
+(format=='long'&&value!=1?'s':'');}else{ret='';}
return ret;})).join(format=='none'?':':' ');};Ox.formatNumber=function(number,decimals){var array=[],abs=Math.abs(number),split=abs.toFixed(decimals).split('.');while(split[0]){array.unshift(split[0].slice(-3));split[0]=split[0].slice(0,-3);}
split[0]=array.join(',');return(number<0?'-':'')+split.join('.');};Ox.formatOrdinal=function(number){var string=Ox.formatNumber(number),length=string.length,last=string[length-1],ten=length>1&&string[length-2]=='1';if(last=='1'&&!ten){string+='st';}else if(last=='2'&&!ten){string+='nd';}else if(last=='3'&&!ten){string+='rd';}else{string+='th';}
return string;};Ox.formatPercent=function(number,total,decimals){return Ox.formatNumber(number/total*100,decimals)+'%'};Ox.formatRoman=function(number){var string='';Ox.forEach({M:1000,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1},function(value,roman){while(number>=value){string+=roman;number-=value;}});return string;};Ox.formatString=function(string,collection){return string.replace(/\{([^}]+)\}/g,function(string,match){return collection[match];});};Ox.formatUnit=function(number,string,decimals){return Ox.formatNumber(number,decimals)
+(/^[:%]/.test(string)?'':' ')+string;};Ox.formatValue=function(number,string,bin){var base=bin?1024:1000,length=Ox.PREFIXES.length,ret;Ox.forEach(Ox.PREFIXES,function(prefix,index){if(number<Math.pow(base,index+1)||index==length-1){ret=Ox.formatNumber(number/Math.pow(base,index),index?index-1:0)+' '+prefix+(prefix&&bin?'i':'')+string;return false;}});return ret;};'use strict';(function(){function deg(point){return Ox.map(point,function(val){return Ox.mod(Ox.deg(val)+180,360)-180;});}
function rad(point){return Ox.map(point,function(val){return Ox.rad(val);});}
function splitArea(area){return Ox.crossesDateline(area.sw,area.ne)?[{sw:area.sw,ne:{lat:area.ne.lat,lng:180}},{sw:{lat:area.sw.lat,lng:-180},ne:area.ne}]:[area];}
Ox.crossesDateline=function(pointA,pointB){return pointA.lng>pointB.lng;};Ox.getArea=function(pointA,pointB){if(Ox.crossesDateline(pointA,pointB)){pointB.lng+=360;}
pointA=rad(pointA);pointB=rad(pointB);return Math.pow(Ox.EARTH_RADIUS,2)*Math.abs(Math.sin(pointA.lat)-Math.sin(pointB.lat))*Math.abs(pointA.lng-pointB.lng);};Ox.getBearing=function(pointA,pointB){var pointA=rad(pointA),pointB=rad(pointB),x=Math.cos(pointA.lat)*Math.sin(pointB.lat)
-Math.sin(pointA.lat)*Math.cos(pointB.lat)*Math.cos(pointB.lng-pointA.lng),y=Math.sin(pointB.lng-pointA.lng)*Math.cos(pointB.lat);return(Ox.deg(Math.atan2(y,x))+360)%360;};Ox.getCenter=function(pointA,pointB){var pointA=rad(pointA),pointB=rad(pointB),x=Math.cos(pointB.lat)*Math.cos(pointB.lng-pointA.lng),y=Math.cos(pointB.lat)*Math.sin(pointB.lng-pointA.lng),d=Math.sqrt(Math.pow(Math.cos(pointA.lat)+x,2)+Math.pow(y,2)),lat=Math.atan2(Math.sin(pointA.lat)+Math.sin(pointB.lat),d),lng=pointA.lng+Math.atan2(y,Math.cos(pointA.lat)+x);return deg({lat:lat,lng:lng});};Ox.getCircle=function(center,radius,precision){return Ox.range(0,360,360/Math.pow(2,precision)).map(function(bearing){return Ox.getPoint(center,radius,bearing);});};Ox.getDegreesPerMeter=function(lat){return 360/Ox.EARTH_CIRCUMFERENCE/Math.cos(lat*Math.PI/180);};Ox.getDistance=function(pointA,pointB){var pointA=rad(pointA),pointB=rad(pointB);return Math.acos(Math.sin(pointA.lat)*Math.sin(pointB.lat)
+Math.cos(pointA.lat)*Math.cos(pointB.lat)*Math.cos(pointB.lng-pointA.lng))*Ox.EARTH_RADIUS;};Ox.getLatLngByXY=function(xy){function getValue(value){return(value-0.5)*2*Math.PI;}
return{lat:-Ox.deg(Math.atan(Ox.sinh(getValue(xy.y)))),lng:Ox.deg(getValue(xy.x))};};Ox.getLine=function(pointA,pointB,precision){var line=[pointA,pointB],points;while(precision>0){points=[line[0]];Ox.loop(line.length-1,function(i){points.push(Ox.getCenter(line[i],line[i+1]),line[i+1]);});line=points;precision--;}
return line;};Ox.getMetersPerDegree=function(lat){return Math.cos(lat*Math.PI/180)*Ox.EARTH_CIRCUMFERENCE/360;};Ox.getPoint=function(point,distance,bearing){var pointB={};point=rad(point);distance/=Ox.EARTH_RADIUS;bearing=Ox.rad(bearing);pointB.lat=Math.asin(Math.sin(point.lat)*Math.cos(distance)
+Math.cos(point.lat)*Math.sin(distance)*Math.cos(bearing));pointB.lng=point.lng+Math.atan2(Math.sin(bearing)*Math.sin(distance)*Math.cos(point.lat),Math.cos(distance)-Math.sin(point.lat)*Math.sin(pointB.lat));return deg(pointB);};Ox.getXYByLatLng=function(latlng){function getValue(value){return(value/(2*Math.PI)+0.5);}
return{x:getValue(Ox.rad(latlng.lng)),y:getValue(Ox.asinh(Math.tan(Ox.rad(-latlng.lat))))};};Ox.isPolar=function(point){return point.lat<Ox.MIN_LATITUDE||point.lat>Ox.MAX_LATITUDE;};Ox.containsArea=function(areaA,areaB){var areas=[areaA,areaB].map(splitArea),ret;function contains(areaA,areaB){return areaA.sw.lat<=areaB.sw.lat&&areaA.sw.lng<=areaB.sw.lng&&areaA.ne.lat>=areaB.ne.lat&&areaA.ne.lng>=areaB.ne.lng;}
Ox.forEach(areas[1],function(area1){Ox.forEach(areas[0],function(area0){ret=contains(area0,area1);return!ret;});return ret;});return ret;};Ox.intersectAreas=function(areas){var intersections,ret;areas=areas.map(splitArea);ret=areas[0];function intersect(areaA,areaB){return areaA.sw.lat>areaB.ne.lat||areaA.sw.lng>areaB.ne.lng||areaA.ne.lat<areaB.sw.lat||areaA.ne.lng<areaB.sw.lng?null:{sw:{lat:Math.max(areaA.sw.lat,areaB.sw.lat),lng:Math.max(areaA.sw.lng,areaB.sw.lng)},ne:{lat:Math.min(areaA.ne.lat,areaB.ne.lat),lng:Math.min(areaA.ne.lng,areaB.ne.lng)}};}
Ox.forEach(areas.slice(1),function(parts){if(ret.length==1&&parts.length==1){ret=intersect(ret[0],parts[0]);}else{intersections=Ox.compact(ret.map(function(part){return Ox.intersectAreas(parts.concat(part));}));ret=intersections.length==0?null:Ox.joinAreas(intersections);}
if(ret===null){return false;}else{ret=splitArea(ret);}});return ret?Ox.joinAreas(ret):null;};Ox.joinAreas=function(areas){var ret=areas[0],gaps=[{sw:{lat:-90,lng:ret.ne.lng},ne:{lat:90,lng:ret.sw.lng}}];function containsGaps(area){return Ox.getIndices(gaps,function(gap){return Ox.containsArea({sw:{lat:-90,lng:area.sw.lng},ne:{lat:90,lng:area.ne.lng}},gap);});}
function intersectsWithGaps(area){var ret={};gaps.forEach(function(gap,i){var intersection=Ox.intersectAreas([area,gap]);if(intersection){ret[i]=intersection;}});return ret;}
function isContainedInGap(area){var ret=-1;Ox.forEach(gaps,function(gap,i){if(Ox.containsArea(gap,area)){ret=i;return false;}});return ret;}
areas.slice(1).forEach(function(area){var index,indices,intersections;if(area.sw.lat<ret.sw.lat){ret.sw.lat=area.sw.lat;}
if(area.ne.lat>ret.ne.lat){ret.ne.lat=area.ne.lat;}
index=isContainedInGap(area);if(index>-1){gaps.push({sw:gaps[index].sw,ne:{lat:90,lng:area.sw.lng}});gaps.push({sw:{lat:-90,lng:area.ne.lng},ne:gaps[index].ne});gaps.splice(index,1);}else{indices=containsGaps(area);Ox.reverse(indices).forEach(function(index){gaps.splice(index,1);});intersections=intersectsWithGaps(area);Ox.forEach(intersections,function(intersection,index){gaps[index]={sw:{lat:-90,lng:gaps[index].sw.lng==intersection.sw.lng?intersection.ne.lng:gaps[index].sw.lng},ne:{lat:90,lng:gaps[index].ne.lng==intersection.ne.lng?intersection.sw.lng:gaps[index].ne.lng}};});}});if(gaps.length==0){ret.sw.lng=-180;ret.ne.lng=180;}else{gaps.sort(function(a,b){return(b.ne.lng
+(Ox.crossesDateline(b.sw,b.ne)?360:0)
-b.sw.lng)-(a.ne.lng
+(Ox.crossesDateline(a.sw,a.ne)?360:0)
-a.sw.lng);});ret.sw.lng=gaps[0].ne.lng;ret.ne.lng=gaps[0].sw.lng;}
return ret;};}());'use strict';(function(){var defaultTags=['b','code','em','i','s','strong','sub','sup','u','blockquote','h1','h2','h3','p','pre','li','ol','ul','table','tbody','td','tfoot','th','thead','tr','a','br','img','rtl','[]'],htmlEntities={'"':'&quot;','&':'&amp;',"'":'&apos;','<':'&lt;','>':'&gt;'},regexp={entity:/&[^\s]+?;/g,html:/[<&]/,tag:new RegExp('<\\/?('+['a','b','br','code','i','s','span','u'].join('|')+')\\/?>','gi')},replace={a:[[/<a [^<>]*?href="((\/|https?:\/\/|mailto:).+?)".*?>/gi,'<a href="{1}">',],[/<\/a>/gi,'</a>']],img:[[/<img [^<>]*?src="((\/|https?:\/\/).+?)".*?>/gi,'<img src="$1">']],rtl:[[/<rtl>/gi,'<div style="direction: rtl">'],[/<\/rtl>/gi,'</div>']],'*':function(tag){return[[new RegExp('</?'+tag+' ?/?>','gi'),'{0}']];}},salt=Ox.range(2).map(function(){return Ox.range(16).map(function(){return Ox.char(65+Ox.random(26));}).join('');});function addLinks(string,obfuscate){return string.replace(/\b((https?:\/\/|www\.).+?)([.,:;!?)\]]*?(\s|$))/gi,function(match,url,prefix,end){prefix=prefix.toLowerCase()=='www.'?'http://':'';return Ox.formatString('<a href="{prefix}{url}">{url}</a>{end}',{end:end,prefix:prefix,url:url});}).replace(/\b([0-9A-Z.+\-_]+@(?:[0-9A-Z\-]+\.)+[A-Z]{2,6})\b/gi,obfuscate?function(match,mail){return Ox.encodeEmailAddress(mail);}:'<a href="mailto:$1">$1</a>');}
function decodeHTMLEntities(string){return string.replace(new RegExp('('+Ox.values(htmlEntities).join('|')+')','g'),function(match){return Ox.keyOf(htmlEntities,match);}).replace(/&#([0-9A-FX]+);/gi,function(match,code){return Ox.char(/^X/i.test(code)?parseInt(code.slice(1),16):parseInt(code,10));});}function splitHTMLTags(string,ignore){var isTag=false,ret=[''];ignore=ignore||[];Ox.forEach(string,function(char,i){if(!isTag&&char=='<'&&ignore.indexOf(i)==-1){isTag=true;ret.push('');}
ret[ret.length-1]+=char;if(isTag&&char=='>'){isTag=false;ret.push('');}});return ret;};Ox.addLinks=function(string,isHTML){var isLink=false;return isHTML?splitHTMLTags(string).map(function(string,i){var isTag=i%2;if(isTag){if(/^<a/.test(string)){isLink=true;}else if(/^<\/a/.test(string)){isLink=false;}}
return isTag||isLink?string:addLinks(string);}).join(''):Ox.normalizeHTML(addLinks(string));};Ox.encodeEmailAddress=function(string){var parts=['mailto:'+string,string].map(function(part){return Ox.map(part,function(char){var code=char.charCodeAt(0);return char==':'?':':'&#'
+(Math.random()<0.5?code:'x'+code.toString(16))
+';'});});return'<a href="'+parts[0]+'">'+parts[1]+'</a>';};Ox.encodeHTMLEntities=function(string,encodeAll){return Ox.map(String(string),function(char){var code=char.charCodeAt(0);if(code<128){char=char in htmlEntities?htmlEntities[char]:char;}else if(encodeAll){char='&#x'
+Ox.pad(code.toString(16).toUpperCase(),'left',4,'0')
+';';}
return char;});};Ox.decodeHTMLEntities=function(string,decodeAll){return decodeAll?Ox.decodeHTMLEntities(Ox.normalizeHTML(string)):decodeHTMLEntities(string);};Ox.highlight=function(string,query,classname,isHTML){if(!query){return string;}
var cursor=0,entities=[],matches=[],offset=0,re=Ox.isRegExp(query)?query:new RegExp(Ox.escapeRegExp(query),'gi'),span=['<span class="'+classname+'">','</span>'],tags=[];function insert(array){array.forEach(function(v){string=Ox.splice(string,v.position,v.length,v.value);matches.forEach(function(match){if(v.position<match.position){match.position+=v.value.length-v.length;}else if(v.position<match.position+match.value.length){match.value=Ox.splice(match.value,v.position-match.position,v.length,v.value);}});});}
if(isHTML&&regexp.html.test(string)){string=string.replace(regexp.tag,function(value,tag,position){tags.push({length:0,position:position,value:value});return'';}).replace(regexp.entity,function(value,position){var ret=Ox.decodeHTMLEntities(value,true);entities.push({length:ret.length,position:position,value:value});return ret;});splitHTMLTags(string,entities.map(function(entity){var ret=entity.position+offset;offset+=entity.length-entity.value.length
return ret;})).forEach(function(v,i){if(i%2==0){v.replace(re,function(value,position){matches.push({position:cursor+position,value:value});});}
cursor+=v.length;});insert(entities);insert(tags);matches.reverse().forEach(function(match){string=Ox.splice(string,match.position,match.value.length,span.join(match.value));});if(matches.length&&tags.length){string=Ox.normalizeHTML(string);}}else{string=Ox.encodeHTMLEntities(string.replace(re,function(value){matches.push(span.join(Ox.encodeHTMLEntities(value)));return salt.join(matches.length-1);}));matches.forEach(function(match,i){string=string.replace(new RegExp(salt.join(i)),match);});}
return string;};Ox.normalizeHTML=function(html){return regexp.html.test(html)?Ox.$('<div>').html(html).html():html;};Ox.parseMarkdown=function(string){var array=[];return string.replace(/\r\n/g,'\n').replace(/\r/g,'\n').replace(/(?:^|\n)```(.*)\n([^`]+)\n```/g,function(match,classname,code){array.push('<pre><code'
+(classname?' class="'+classname+'"':'')+'>'
+code.trim().replace(/</g,'&lt;')+'\n</code></pre>');return salt.join(array.length-1);}).replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(match,prev,backticks,code,next){array.push(prev+'<code>'
+code.trim().replace(/</g,'&lt;')+'</code>');return salt.join(array.length-1);}).replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,'<strong>$2</strong>').replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,'<em>$2</em>').replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,function(match,all,text,id,url,rest,quote,title){return'<a href="'+Ox.encodeHTMLEntities(url)+'"'+(title?' title="'+Ox.encodeHTMLEntities(title)+'"':'')+'>'+text+'</a>';}).replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href=\"$1\">$1</a>').replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(match,mail){return Ox.encodeEmailAddress(mail);}).replace(/\n\n/g,'<br><br>').replace(new RegExp(salt.join('(\\d+)'),'g'),function(match,index){return array[parseInt(index)];});};Ox.sanitizeHTML=function(html,tags){var matches=[];tags=tags||defaultTags;if(tags.indexOf('[]')>-1){html=html.replace(/\[((\/|https?:\/\/|mailto:).+?) (.+?)\]/gi,'<a href="$1">$3</a>');tags=tags.filter(function(tag){return tag!='[]';});}
tags.forEach(function(tag){var array=replace[tag]||replace['*'](tag);Ox.forEach(array,function(value){html=html.replace(value[0],function(){matches.push(Ox.formatString(value[1],arguments));return salt.join(matches.length-1);});});});html=Ox.encodeHTMLEntities(Ox.decodeHTMLEntities(html));matches.forEach(function(match,i){html=html.replace(new RegExp(salt.join(i)),match);});html=Ox.addLinks(html,true);html=html.replace(/\n\n/g,'<br/><br/>');return Ox.normalizeHTML(html);};Ox.stripTags=function(string){return string.replace(/<.*?>/g,'');};}());'use strict';Ox.oshash=function(file,callback){var hash=fromString(file.size.toString());read(0);function add(A,B){var a,b,c,d;d=A[3]+B[3];c=A[2]+B[2]+(d>>16);d&=0xffff;b=A[1]+B[1]+(c>>16);c&=0xffff;a=A[0]+B[0]+(b>>16);b&=0xffff;a&=0xffff;return[a,b,c,d];}
function fromData(s,offset){offset=offset||0;return[s.charCodeAt(offset+6)+(s.charCodeAt(offset+7)<<8),s.charCodeAt(offset+4)+(s.charCodeAt(offset+5)<<8),s.charCodeAt(offset+2)+(s.charCodeAt(offset+3)<<8),s.charCodeAt(offset+0)+(s.charCodeAt(offset+1)<<8)];}
function fromString(str){var base=10,blen=1,i,num,pos,r=[0,0,0,0];for(pos=0;pos<str.length;pos++){num=parseInt(str.charAt(pos),base);i=0;do{while(i<blen){num+=r[3-i]*base;r[3-i++]=(num&0xFFFF);num>>>=16;}
if(num){blen++;}}while(num);}
return r;}
function hex(h){return(Ox.pad(h[0].toString(16),'left',4,'0')
+Ox.pad(h[1].toString(16),'left',4,'0')
+Ox.pad(h[2].toString(16),'left',4,'0')
+Ox.pad(h[3].toString(16),'left',4,'0')).toLowerCase();}
function read(offset,last){var blob,block=65536,length=8,reader=new FileReader();reader.onload=function(data){var s=data.target.result,s_length=s.length-length,i;for(i=0;i<=s_length;i+=length){hash=add(hash,fromData(s,i));}
if(file.size<block||last){callback(hex(hash));}else{read(file.size-block,true);}};if(file.mozSlice){blob=file.mozSlice(offset,offset+block);}else if(file.webkitSlice){blob=file.webkitSlice(offset,offset+block);}else{blob=file.slice(offset,offset+block);}
reader.readAsBinaryString(blob);}};'use strict';Ox.doc=(function(){var re={item:/^(.+?)\s+<(.+?)>\s+(.+?)$/,multiline:/^\/\*\@.*?\n([\w\W]+)\n.*?\@?\*\/$/,script:/\n(\s*<script>s*\n[\w\W]+\n\s*<\/script>s*)/g,signature:/^(\(.*?\))\s+\->(.*)/,singleline:/^\/\/@\s*(.*?)\s*$/,test:/\n(\s*> .+\n.+?)/g,},types={a:'array',b:'boolean',d:'date',e:'error',f:'function',g:'arguments',h:'htmlelement','l':'nodelist',n:'number',o:'object',r:'regexp',s:'string',u:'undefined','w':'window','*':'any','+':'other','!':'event'};function addInheritedProperties(items){var constructors=getConstructors(items),instances={},nodes={};function hasProperty(item,property){var properties=item.properties||[],inheritedproperties=item.inheritedproperties?item.inheritedproperties.map(function(v){return v.properties;}):[];return Ox.contains(properties.concat(inheritedproperties).map(function(property){return property.name;}),property.name);}
constructors.forEach(function(constructor){var instance=Ox.last(constructor.returns);instances[constructor.name]=instance;nodes[constructor.name]=instance['class'];});Ox.forEach(getChains(nodes),function(chain,childName){var child=instances[childName];chain.forEach(function(parentName){var parent=instances[parentName]||Ox.last(items[Ox.indexOf(items,function(item){return item.name==parentName;})].returns);['properties','events'].forEach(function(key){parent[key]&&parent[key].forEach(function(value){var key_='inherited'+key;if(key=='events'||!hasProperty(child,value)){if(!child[key_]){child[key_]=[];}
if(!child[key_].some(function(v){return v.name==parentName;})){child[key_].push(Ox.extend({name:parentName},key,[]));}
Ox.last(child[key_])[key].push(value);}})});});});return items;}
function decodeLinebreaks(match,submatch){return(submatch||match).replace(/\u21A9/g,'\n');}
function encodeLinebreaks(match,submatch){return'\n'+(submatch||match).replace(/\n/g,'\u21A9');}
function getChains(nodes){var chains={},sorted=[],visited=[];function visit(name,stack){stack=stack||[];if(Ox.contains(stack,name)){throw new Error('Circular dependency: '+name+' <-> '+Ox.last(stack));}
if(!Ox.contains(visited,name)){visited.push(name);stack.push(name)
Ox.forEach(nodes,function(parent,name_){parent==name&&visit(name_,stack);});sorted.unshift(name);}}
Ox.forEach(nodes,function(parent,name){visit(name);});sorted.forEach(function(name){chains[name]=[nodes[name]].concat(chains[nodes[name]]||[])});return chains;}
function getConstructors(items){var constructors=[];items.forEach(function(item){if(item.returns){Ox.forEach(item.returns,function(v){if(v['class']){constructors.push(item);return false;}});}
['arguments','properties','returns'].forEach(function(key){if(item[key]){constructors.concat(getConstructors(item[key]));}});});return constructors;}
function getIndent(string){var indent=-1;while(string[++indent]==' '){}
return indent;}
function parseItem(string){var matches=re.item.exec(string);return matches&&(matches[2].indexOf('/')==-1||'\'"'.indexOf(matches[2].slice(-2,-1))>-1)?Ox.extend(parseName(matches[1]),parseTypes(matches[2]),{summary:matches[3].trim()}):null;}
function parseName(string){var matches=re.signature.exec(string);return matches?{signature:matches[1],name:matches[2].trim()}:{name:string};}
function parseNode(node){var item=parseItem(node.line),order=[];item.name=item.name.replace(/^\./,'');node.nodes&&node.nodes.forEach(function(node){var key,line=node.line,subitem;if(!/^#/.test(node.line)){if(/^<script>/.test(line)){item.tests=[parseScript(line)];}else if(/^>/.test(line)){item.tests=item.tests||[];item.tests.push(parseTest(line));}else if((subitem=parseItem(line))){if(subitem.signature){item.returns=item.returns||[];item.returns.push(parseNode(node));order.push('returns');}else if(subitem.types[0]=='event'){item.events=item.events||[];item.events.push(parseNode(node));order.push('events');}else{key=item.types[0]=='function'&&!/^\./.test(subitem.name)?'arguments':'properties';item[key]=item[key]||[];item[key].push(parseNode(node));order.push(key);}}else{item.description=item.description?item.description+' '+line:line}}});item.summary=Ox.parseMarkdown(item.summary);if(item.description){item.description=Ox.parseMarkdown(item.description)}
if(item.types[0]=='function'){item.order=Ox.unique(order);}
return item;}
function parseScript(string){var lines=decodeLinebreaks(string).split('\n'),indent=getIndent(lines[1]);return{statement:lines.slice(1,-1).map(function(line,i){return line.slice(indent);}).join('\n')};}
function parseSource(source,file){var blocks=[],items=[],section='',tokens=[];Ox.tokenize(source).forEach(function(token){var match;if(token.type=='comment'&&(match=re.multiline.exec(token.value)||re.singleline.exec(token.value))){blocks.push(match[1]);tokens.push([]);}else if(tokens.length){tokens[tokens.length-1].push(token);}});blocks.forEach(function(block,i){var item,lastItem,lastToken,lines=block.replace(re.script,encodeLinebreaks).replace(re.test,encodeLinebreaks).split('\n'),parent,tree=parseTree(lines);if(re.item.test(tree.line)){item=parseNode(tree);item.file=file||'';if(section){item.section=section;}
if(/^[A-Z]/.test(item.name)){item.source=parseTokens(tokens[i]);item.line=item.source[0].line;items.push(item);}else{item.name=item.name.replace(/^\./,'');lastItem=Ox.last(items);parent=lastItem.types[0]=='function'&&lastItem.returns&&lastItem.returns[0].types[0]=='object'?lastItem.returns[0]:lastItem;parent.properties=parent.properties||[];parent.properties.push(item);if(parent.order&&!Ox.contains(parent.order,'properties')){parent.order.push('properties');}
lastToken=Ox.last(lastItem.source);lastItem.source=lastItem.source.concat({column:lastToken.column+lastToken.value.length,line:lastToken.line,type:'linebreak',value:'\n'},parseTokens(tokens[i],true));}}else{section=tree.line}});return items;}
function parseTest(string){var lines=decodeLinebreaks(string).split('\n ');return{statement:lines[0].slice(2),expected:lines[1].trim()};}
function parseTokens(tokens,includeLeading){var start=0,stop=tokens.length,types=['linebreak','whitespace'];if(includeLeading){while(tokens[start].type=='whitespace'){start++;}}else{while(types.indexOf(tokens[start].type)>-1){start++;}
while(start&&tokens[start-1].type=='whitespace'){start--;}}
while(stop>start&&types.indexOf(tokens[stop-1].type)>-1){stop--;}
return tokens.slice(start,stop);}
function parseTree(lines){var branches=[],indent,node={line:lines.shift().trim()};if(lines.length){indent=getIndent(lines[0]);lines.forEach(function(line){if(getIndent(line)==indent){branches.push([line]);}else{branches[branches.length-1].push(line);}});node.nodes=branches.map(function(lines){return parseTree(lines);});}
return node;}
function parseTypes(string){var array,isArray,ret={types:[]},type;if('\'"'.indexOf(string.slice(-2,-1))==-1){array=string.split(':');string=array[0];if(array.length==2){ret['class']=array[1];}}
string.split('|').forEach(function(string){var unwrapped=unwrap(string);if(unwrapped in types){ret.types.push(wrap(types[unwrapped]))}else if((type=Ox.filter(Ox.values(types),function(type){return Ox.startsWith(type,unwrapped);})).length){ret.types.push(wrap(type[0]));}else{ret['default']=string;}});function unwrap(string){return(isArray=/^\[.+\]$/.test(string))?string.slice(1,-1):string;}
function wrap(string){return isArray?'['+string+'s'+']':string;}
return ret;}
return function(argument,callback){var counter=0,items=[],ret;if(arguments.length==1){ret=addInheritedProperties(parseSource(argument));}else{argument=Ox.makeArray(argument);argument.forEach(function(file){Ox.get(file,function(source){items=items.concat(parseSource(source,file.split('?')[0]));if(++counter==argument.length){callback(addInheritedProperties(items));}});})}
return ret;}}());Ox.identify=(function(){var identifiers={constant:['E','LN2','LN10','LOG2E','LOG10E','PI','SQRT1_2','SQRT2','MAX_VALUE','MIN_VALUE','NEGATIVE_INFINITY','POSITIVE_INFINITY'],keyword:['break','case','catch','class','const','continue','debugger','default','delete','do','else','enum','export','extends','false','finally','for','function','if','implements','import','in','instanceof','interface','let','module','new','null','package','private','protected','public','return','super','switch','static','this','throw','true','try','typeof','var','void','yield','while','with'],method:['concat','every','filter','forEach','join','lastIndexOf','indexOf','isArray','map','pop','push','reduce','reduceRight','reverse','shift','slice','some','sort','splice','unshift','getDate','getDay','getFullYear','getHours','getMilliseconds','getMinutes','getMonth','getSeconds','getTime','getTimezoneOffset','getUTCDate','getUTCDay','getUTCFullYear','getUTCHours','getUTCMilliseconds','getUTCMinutes','getUTCMonth','getUTCSeconds','now','parse','setDate','setFullYear','setHours','setMilliseconds','setMinutes','setMonth','setSeconds','setTime','setUTCDate','setUTCFullYear','setUTCHours','setUTCMilliseconds','setUTCMinutes','setUTCMonth','setUTCSeconds','toDateString','toJSON','toLocaleDateString','toLocaleString','toLocaleTimeString','toTimeString','toUTCString','UTC','apply','bind','call','isGenerator','parse','stringify','abs','acos','asin','atan','atan2','ceil','cos','exp','floor','log','max','min','pow','random','round','sin','sqrt','tan','toExponential','toFixed','toLocaleString','toPrecision','create','defineProperty','defineProperties','freeze','getOwnPropertyDescriptor','getOwnPropertyNames','getPrototypeOf','hasOwnProperty','isExtensible','isFrozen','isPrototypeOf','isSealed','keys','preventExtensions','propertyIsEnumerable','seal','toLocaleString','toString','valueOf','exec','test','charAt','charCodeAt','concat','fromCharCode','indexOf','lastIndexOf','localeCompare','match','replace','search','slice','split','substr','substring','toLocaleLowerCase','toLocaleUpperCase','toLowerCase','toUpperCase','trim','addEventListener','alert','atob','blur','btoa','clearInterval','clearTimeout','close','confirm','dispatchEvent','escape','find','focus','getComputedStyle','getSelection','moveBy','moveTo','open','postMessage','print','prompt','removeEventListener','resizeBy','resizeTo','scroll','scrollBy','scrollTo','setCursor','setInterval','setTimeout','stop','unescape'],object:['Array','Boolean','Date','decodeURI','decodeURIComponent','encodeURI','encodeURIComponent','Error','eval','EvalError','Function','Infinity','isFinite','isNaN','JSON','Math','NaN','Number','Object','parseFloat','parseInt','RangeError','ReferenceError','RegExp','String','SyntaxError','TypeError','undefined','URIError','window'],property:['constructor','length','prototype','global','ignoreCase','lastIndex','multiline','source','applicationCache','closed','console','content','crypto','defaultStatus','document','frameElement','frames','history','innerHeight','innerWidth','length','location','locationbar','localStorage','menubar','name','navigator','opener','outerHeight','outerWidth','pageXOffset','pageYOffset','parent','personalbar','screen','screenX','screenY','scrollbars','scrollX','scrollY','self','sessionStorage','status','statusbar','toolbar','top']};return function(identifier){var ret;if(identifiers.keyword.indexOf(identifier)>-1){ret='keyword';}else{ret='identifier';Ox.forEach(identifiers,function(words,type){if(words.indexOf(identifier)>-1){ret=type;return false;}});}
return ret;};}());Ox.minify=function(){if(arguments.length==1){return minify(arguments[0]);}else{Ox.get(arguments[0],function(source){arguments[1](minify(source));});}
function minify(source){var tokens=Ox.tokenize(source),length=tokens.length,ret='';tokens.forEach(function(token,i){var next,nextToken,prevToken;if(['linebreak','whitespace'].indexOf(token.type)>-1){prevToken=i==0?null:tokens[i-1];next=i+1;while(next<length&&['comment','linebreak','whitespace'].indexOf(tokens[next].type)>-1){next++;}
nextToken=next==length?null:tokens[next];}
if(token.type=='linebreak'){if(prevToken&&nextToken&&(['identifier','number','string'].indexOf(prevToken.type)>-1||['++','--',')',']','}'].indexOf(prevToken.value)>-1)&&(['identifier','number','string'].indexOf(nextToken.type)>-1||['+','-','++','--','~','!','(','[','{'].indexOf(nextToken.value)>-1)){ret+='\n';}}else if(token.type=='whitespace'){if(prevToken&&nextToken&&((['identifier','number'].indexOf(prevToken.type)>-1&&['identifier','number'].indexOf(nextToken.type)>-1)||(['+','-','++','--'].indexOf(prevToken.value)>-1&&['+','-','++','--'].indexOf(nextToken.value)>-1))){ret+=' ';}}else if(token.type!='comment'){ret+=token.value;}});return ret;}};Ox.test=function(argument,callback){function runTests(items){var id=Ox.uid(),regexp=/(.+Ox\.test\()/,results=[];Ox.test.data[id]={callback:callback,done:false,results:results,tests:{}};items.forEach(function(item){item.tests&&item.tests.some(function(test){return test.expected;})&&item.tests.forEach(function(test){var actual,statement=test.statement,isAsync=regexp.test(statement);if(isAsync){Ox.test.data[id].tests[test.statement]={expected:test.expected,name:item.name,section:item.section};statement=statement.replace(regexp,"$1'"+statement.replace(/'/g,"\\'")+"', ");}
Ox.Log('TEST',statement);actual=eval(statement);if(!isAsync&&test.expected){Ox.test.data[id].results.push({actual:stringifyResult(actual),expected:test.expected,name:item.name,section:item.section,statement:statement,passed:Ox.isEqual(actual,eval('('+test.expected+')'))});}});});Ox.test.data[id].done=true;if(Ox.isEmpty(Ox.test.data[id].tests)){callback(Ox.test.data[id].results);delete Ox.test.data[id];}}
function stringifyResult(result){return Ox.isEqual(result,-0)?'-0':Ox.isNaN(result)?'NaN':Ox.isUndefined(result)?'undefined':JSON.stringify(result);}
if(arguments.length==2){if(Ox.typeOf(argument)=='string'&&Ox.contains(argument,'\n')){runTests(Ox.doc(argument))}else{argument=Ox.makeArray(argument);if(Ox.typeOf(argument[0])=='string'){Ox.doc(argument,runTests);}else{runTests(argument);}}}else{var statement=arguments[0],actual=arguments[1],expected=arguments[2],id,test;Ox.forEach(Ox.test.data,function(v,k){if(v.tests[statement]){id=k;test=v.tests[statement];return false;}});Ox.test.data[id].results.push(Ox.extend(test,{actual:stringifyResult(actual),statement:statement,passed:Ox.isEqual(actual,expected)}));delete Ox.test.data[id].tests[statement];if(Ox.test.data[id].done&&Ox.isEmpty(Ox.test.data[id].tests)){Ox.test.data[id].callback(Ox.test.data[id].results);delete Ox.test.data[id];}}};Ox.test.data={};Ox.tokenize=(function(){var comment=['//','/*'],identifier='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_',linebreak='\n\r',number='0123456789',operator=['+','-','*','/','%','++','--','=','+=','-=','*=','/=','%=','&=','|=','^=','<<=','>>=','>>>=','&','|','^','~','<<','>>','>>>','==','!=','===','!==','>','>=','<','<=','?',':','(',')','[',']','{','}','&&','||','!','.',',',';'],regexp='abcdefghijklmnopqrstuvwxyz',string='\'"',whitespace=' \t';function isRegExp(tokens){var i=tokens.length-1,isRegExp,token
while(i>=0&&['comment','linebreak','whitespace'].indexOf(tokens[i].type)>-1){i--;}
if(i==-1){isRegExp=true;}else{token=tokens[i];isRegExp=(token.type=='identifier'&&Ox.identify(token.value)=='keyword'&&['false','null','true'].indexOf(token.value)==-1)||(token.type=='operator'&&['++','--',')',']','}'].indexOf(token.value)==-1)}
return isRegExp;}
return function(source){var char,column=1,cursor=0,delimiter,length=source.length,line=1,lines,next,tokens=[],start,type,value;source=source.replace(/\r\n/g,'\n').replace(/\r/g,'\n');while(cursor<length){start=cursor;char=source[cursor];if(comment.indexOf(delimiter=char+source[cursor+1])>-1){type='comment';++cursor;while(char=source[++cursor]){if(delimiter=='//'&&char=='\n'){break;}else if(delimiter=='/*'&&char+source[cursor+1]=='*/'){cursor+=2;break;}}}else if(identifier.indexOf(char)>-1){type='identifier';while((identifier+number).indexOf(source[++cursor])>-1){}}else if(linebreak.indexOf(char)>-1){type='linebreak';while(linebreak.indexOf(source[++cursor])>-1){}}else if(number.indexOf(char)>-1||char=='.'&&number.indexOf(source[cursor+1])>-1){type='number';while((number+'.abcdefxABCDEFX+-').indexOf(source[++cursor])>-1){if(source[cursor-1]!='e'&&source[cursor-1]!='E'&&(source[cursor]=='+'||source[cursor]=='-')){break;}}}else if(char=='/'&&isRegExp(tokens)){type='regexp';while((char=source[++cursor])!='/'&&cursor<length){char=='\\'&&++cursor;}
while(regexp.indexOf(source[++cursor])>-1){}}else if(operator.indexOf(char)>-1){type='operator';while(operator.indexOf(char+=source[++cursor])>-1&&cursor<length){}}else if(string.indexOf(delimiter=char)>-1){type='string';while((char=source[++cursor])!=delimiter&&cursor<length){char=='\\'&&++cursor;}
++cursor;}else if(whitespace.indexOf(char)>-1){type='whitespace';while(whitespace.indexOf(source[++cursor])>-1){}}else{type='error';++cursor;}
value=source.slice(start,cursor);if(type=='error'&&tokens.length&&tokens[tokens.length-1].type=='error'){tokens[tokens.length-1].value+=value;}else{tokens.push({column:column,line:line,type:type,value:value});}
if(type=='comment'){lines=value.split('\n');column=lines[lines.length-1].length;line+=lines.length-1;}else if(type=='linebreak'){column=1;line+=value.length;}else{column+=value.length;}}
return tokens;};}());'use strict';Ox.extend=function(object){var args=Ox.slice(arguments,1);if(args.length==2&&!Ox.isObject(args[0])){args=[Ox.makeObject(args)];}
Ox.forEach(args,function(argument,i){Ox.forEach(argument,function(value,key){object[key]=value;});});return object;};Ox.getset=function(object,args,callback,that){var object_=Ox.clone(object),ret;if(args.length==0){ret=object_;}else if(args.length==1&&!Ox.isObject(args[0])){ret=Ox.clone(object[args[0]]);}else{args=Ox.makeObject(args);object=Ox.extend(object,args);Ox.forEach(args,function(value,key){if(!object_||!Ox.isEqual(object_[key],value)){callback&&callback(key,value);}});ret=that;}
return ret;};Ox.hasOwn=function(object,value){return Object.prototype.hasOwnProperty.call(object,value)};Ox.keyOf=function(object,value){var key;Ox.forEach(object,function(v,k){if(v===value){key=k;return false;}});return key;};Ox.makeObject=function(array){var ret={};if(Ox.isObject(array[0])){ret=array[0];}else if(array.length){ret[array[0]]=array[1];}
return ret;};Ox.methods=function(object,includePrototype){var key,keys;if(includePrototype){keys=[];for(var key in object){keys.push(key);}}else{keys=Object.keys(object);}
return keys.filter(function(key){return Ox.isFunction(object[key]);}).sort();};Ox.serialize=function(object){var ret=[];Ox.forEach(object,function(value,key){if(!Ox.isEmpty(value)&&!Ox.isNull(value)&&!Ox.isUndefined(value)){ret.push(key+'='+value);}});return ret.join('&');};Ox.unserialize=function(string,toNumber){var ret={};Ox.filter(string.split('&')).forEach(function(value){var array=value.split('=');if(array[1]){ret[array[0]]=!toNumber?array[1]:array[1].indexOf(',')==-1?+array[1]:array[1].split(',').map(function(value){return+value;});}});return ret;};Ox.escapeRegExp=function(string){return(string+'').replace(/([\/\\^$*+?.\-|(){}[\]])/g,'\\$1')};'use strict';Ox.get=function(url,callback){var request=new XMLHttpRequest();request.open('GET',url,true);request.onreadystatechange=function(){if(request.readyState==4){if(request.status==200){callback(request.responseText,null);}else{callback(null,{code:request.status,text:request.statusText});}}};request.send();};Ox.getAsync=function(urls,get,callback){urls=Ox.clone(Ox.makeArray(urls));var errors={},i=0,n=urls.length,results={};function done(){callback(n==1?results[urls[0]]:results,n==1?errors[urls[0]]:Ox.some(errors,function(error){return error!==null;})?errors:null);}
function iterate(){var url=urls.shift();Ox.getAsync(url,function(result,error){Ox.extend(results,url,result);Ox.extend(errors,url,error);urls.length?iterate():done();});}
if(urls.some(Ox.isArray)){iterate();}else{urls.forEach(function(url){get(url,function(result,error){Ox.extend(results,url,result);Ox.extend(errors,url,error);++i==n&&done();});});}};Ox.getFile=(function(){var cache={};function getFile(file,callback){var element,head=document.head||document.getElementsByTagName('head')[0]||document.documentElement,request,type=file.split('.').pop(),isImage=type!='css'&&type!='js';if(!cache[file]){if(isImage){element=new Image();element.onload=addFileToCache;element.src=file;}else{if(!findFileInHead()){element=document.createElement(type=='css'?'link':'script');element[type=='css'?'href':'src']=file+'?'+Ox.random(1000000);element.type=type=='css'?'text/css':'text/javascript';if(type=='css'){element.rel='stylesheet';}
if(/MSIE/.test(navigator.userAgent)){setTimeout(addFileToCache,2500);}else{if(type=='css'){waitForCSS();}else{element.onload=addFileToCache;}}
head.appendChild(element);}else{addFileToCache();}}}else{callback();}
function addFileToCache(){if(isImage){cache[file]=element;callback(element);}else{cache[file]=true;callback();}}
function findFileInHead(){return Ox.toArray(document.getElementsByTagName(type=='css'?'link':'script')).map(function(element){return element[type=='css'?'href':'src']==file;}).reduce(function(prev,curr){return prev||curr;},false);}
function waitForCSS(){var error=false;try{element.sheet.cssRule;}catch(e){error=true;setTimeout(function(){waitForCSS();},25);}
!error&&addFileToCache();}};return function(files,callback){Ox.getAsync(files,function(file,callback){getFile(file,function(images){callback(images?{file:images}:{});});},callback);};}());Ox.getJSON=function(url,callback,isJSONC){var urls=Ox.makeArray(url);Ox.getAsync(urls,function(url,callback){Ox.get(url,function(data,error){callback(JSON.parse(isJSONC?Ox.minify(data||''):data),error);});},callback);};Ox.getJSONC=function(url,callback){Ox.getJSON(url,function(results,errors){callback(results,errors);},true);};Ox.getJSONP=function(url,callback){var urls=Ox.makeArray(url);Ox.getAsync(urls,function(url,callback){var id='callback'+Ox.uid();Ox.getJSONP[id]=function(data){delete Ox.getJSONP[id];callback(data,null);};Ox.$('body').append(Ox.$('<script>').attr({'src':url.replace('{callback}','Ox.getJSONP.'+id),'type':'text/javascript'}));},callback);};'use strict';Ox.checkType=function(value,type){if(!Ox.contains(Ox.makeArray(type),Ox.typeOf(value))){throw new TypeError();}};Ox.isArguments=function(value){return Ox.typeOf(value)=='arguments';};Ox.isArray=function(value){return Ox.typeOf(value)=='array';};Ox.isBoolean=function(value){return Ox.typeOf(value)=='boolean';};Ox.isDate=function(value){return Ox.typeOf(value)=='date';};Ox.isElement=function(value){return Ox.endsWith(Ox.typeOf(value),'element');};Ox.isEmpty=function(value){return Ox.len(value)===0;};Ox.isEqual=function(a,b){var ret=false,type=Ox.typeOf(a);if(a===b){ret=a!==0||1/a===1/b;}else if(type==Ox.typeOf(b)){if(a==b||a!==a){ret=true;}else if(type=='date'){ret=+a==+b;}else if(type=='element'){ret=a.isEqualNode(b);}else if(type=='regexp'){ret=a.global==b.global&&a.ignore==b.ignore&&a.multiline==b.multiline&&a.source==b.source;}else if((type=='arguments'||type=='array'||type=='object')&&Ox.len(a)==Ox.len(b)){ret=true;Ox.forEach(a,function(value,key){ret=Ox.isEqual(value,b[key]);return ret;});}}
return ret;};Ox.isError=function(value){return Ox.typeOf(value)=='error';};Ox.isFunction=function(value){return Ox.typeOf(value)=='function';};Ox.isInfinity=function(value){return Ox.typeOf(value)=='number'&&!isFinite(value)&&!Ox.isNaN(value);};Ox.isInt=function(value){return isFinite(value)&&value===Math.floor(value);};Ox.isNaN=function(value){return value!==value;}
Ox.isNull=function(value){return Ox.typeOf(value)=='null';};Ox.isNumber=function(value){return Ox.typeOf(value)=='number';};Ox.isObject=function(value){return Ox.typeOf(value)=='object';};Ox.isPrimitive=function(value){return Ox.contains(['boolean','null','number','string','undefined'],Ox.typeOf(value));};Ox.isRegExp=function(value){return Ox.typeOf(value)=='regexp';};Ox.isString=function(value){return Ox.typeOf(value)=='string';};Ox.isUndefined=function(value){return Ox.typeOf(value)=='undefined';};Ox.typeOf=function(value){return Object.prototype.toString.call(value).slice(8,-1).toLowerCase();};if(Ox.typeOf((function(){return arguments;}()))!='arguments'||Ox.typeOf(document.getElementsByTagName('a'))!='nodelist'||Ox.typeOf(null)!='null'||Ox.typeOf()!='undefined'){Ox.typeOf=function(value){var type=Object.prototype.toString.call(value).slice(8,-1).toLowerCase();if(value===null){type='null';}else if(value===void 0){type='undefined'}else if(type=='object'&&typeof value.callee=='function'){type='arguments';}else if(type=='htmlcollection'||(type=='object'&&typeof value.item!='undefined'&&typeof value.length=='number')){type='nodelist';}
return type;};}