diff --git a/bin/todo.rb b/bin/todo.rb index 6e52ffb..6e209af 100644 --- a/bin/todo.rb +++ b/bin/todo.rb @@ -300,18 +300,16 @@ def list(tasks = nil, patterns = nil) tasks = tasks || load_tasks task_indent = [tasks.keys.max.to_s.size, 4].max patterns = patterns.nil? || patterns.empty? ? [':active'] : patterns - items = filter_tasks(tasks, patterns) - items = items.sort_by do |num, task| + items = filter_tasks(tasks, patterns).sort_by do |num, task| [task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num] end items.each do |num, task| state = task[:state] || 'default' - color = COLORS[state] - display_state = colorize(STATES[state], color) + display_state = colorize(STATES[state], COLORS[state]) title = task[:title].gsub(CONTEXT_TAG_PATTERN) do |tag| (tag.start_with?(' ') ? ' ' : '') + colorize(tag.strip, :cyan) end - priority_flag = task[:priority] ? colorize(PRIORITY_FLAG, :red) : ' ' + priority_flag = task[:priority] && state != 'done' ? colorize(PRIORITY_FLAG, :red) : ' ' due_date = '' if task[:due] && state != 'done' date_diff = (Date.strptime(task[:due], DATE_FORMAT) - @today).to_i @@ -385,7 +383,7 @@ def filter_tasks(tasks, patterns) end def colorize(text, color) - "\e[#{COLOR_CODES[color]}m#{text}\e[0m" + "\e[#{COLOR_CODES[color] || 37}m#{text}\e[0m" end def convert_due_date(date) diff --git a/node/package.json b/node/package.json index 6da1d8a..315d973 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "todo-jsonl", - "version": "0.1.30", + "version": "0.1.31", "description": "todo list manager inspired by todo.txt using the jsonl format", "main": "todo.js", "bin": { @@ -26,9 +26,7 @@ "todotxt", "todoapp", "jsonlines", - "jsonl", - "ruby", - "opal" + "jsonl" ], "author": "Gabor Bata", "license": "MIT", diff --git a/node/todo.js b/node/todo.js index 192d173..978ede5 100644 --- a/node/todo.js +++ b/node/todo.js @@ -16,7 +16,7 @@ ab.polyfill("String.prototype.includes",function(a){return a?a:function(y,J){ret (function(a){function y(b,h,f){"string"===typeof b?b[h]=f:Object.defineProperty(b,h,{value:f,enumerable:!1,configurable:!0,writable:!0})}function J(b,h){if(b)return b.$$const[h]}function t(b,h){var f;if(null!=b){var q=e.ancestors(b);b=0;for(f=q.length;b $class $coerce_to! $new $!= $[] $upcase".split(" "));return function(H,x){H=p(H,"Opal");var k=[H].concat(x),m,u,c,l,I,e,n,L,D,R,ja;a.defs(H,"$bridge",m=function(da,ma){return a.bridge(da,ma)},m.$$arity=2);a.defs(H,"$coerce_to!",u=function(da,ma,b,h){var f=a.slice.call(arguments,3,arguments.length);f=z(da,ma,b,f);d(ma["$==="](f))|| +Opal.modules["corelib/helpers"]=function(a){var y=[],J=a.nil,t=a.$$,w=a.type_error,z=a.coerce_to,p=a.module,d=a.truthy;a.add_stubs("$=== $raise $respond_to? $nil? $__send__ $<=> $class $coerce_to! $new $!= $[] $upcase".split(" "));return function(H,x){H=p(H,"Opal");var k=[H].concat(x),m,u,c,l,I,e,n,L,D,R,ia;a.defs(H,"$bridge",m=function(da,ma){return a.bridge(da,ma)},m.$$arity=2);a.defs(H,"$coerce_to!",u=function(da,ma,b,h){var f=a.slice.call(arguments,3,arguments.length);f=z(da,ma,b,f);d(ma["$==="](f))|| this.$raise(w(da,ma,b,f));return f},u.$$arity=-4);a.defs(H,"$coerce_to?",c=function(da,ma,b,h){var f=a.slice.call(arguments,3,arguments.length);if(!d(da["$respond_to?"](b)))return J;f=z(da,ma,b,f);if(d(f["$nil?"]()))return J;d(ma["$==="](f))||this.$raise(w(da,ma,b,f));return f},c.$$arity=-4);a.defs(H,"$try_convert",l=function(da,ma,b){return d(ma["$==="](da))?da:d(da["$respond_to?"](b))?da.$__send__(b):J},l.$$arity=3);a.defs(H,"$compare",I=function(da,ma){var b=da["$<=>"](ma);d(b===J)&&this.$raise(t(k, "ArgumentError"),"comparison of "+da.$class()+" with "+ma.$class()+" failed");return b},I.$$arity=2);a.defs(H,"$destructure",e=function(da){if(1==da.length)return da[0];if(da.$$is_array)return da;for(var ma=Array(da.length),b=0,h=ma.length;bda.length||"@@"!==da.slice(0,2))&&this.$raise(t(k,"NameError").$new("`"+da+"' is not allowed as a class variable name",da));return da},D.$$arity=1);a.defs(H,"$const_name!",R=function(da){da=t(k,"Opal")["$coerce_to!"](da, -t(k,"String"),"to_str");d(da["$[]"](0)["$!="](da["$[]"](0).$upcase()))&&this.$raise(t(k,"NameError"),"wrong constant name "+da);return da},R.$$arity=1);a.defs(H,"$pristine",ja=function(da,ma){var b=a.slice.call(arguments,1,arguments.length);for(var h,f=b.length-1;0<=f;f--)h=b[f],(h=da.$$prototype["$"+h])&&!h.$$stub&&(h.$$pristine=!0);return J},ja.$$arity=-2)}(y[0],y)}; +t(k,"String"),"to_str");d(da["$[]"](0)["$!="](da["$[]"](0).$upcase()))&&this.$raise(t(k,"NameError"),"wrong constant name "+da);return da},R.$$arity=1);a.defs(H,"$pristine",ia=function(da,ma){var b=a.slice.call(arguments,1,arguments.length);for(var h,f=b.length-1;0<=f;f--)h=b[f],(h=da.$$prototype["$"+h])&&!h.$$stub&&(h.$$pristine=!0);return J},ia.$$arity=-2)}(y[0],y)}; Opal.modules["corelib/module"]=function(a){function y(l,I){return"number"===typeof l&&"number"===typeof I?l $nil? $attr_reader $attr_writer $warn $attr_accessor $class_variable_name! $new $const_name! $=~ $inject $split $const_get $== $!~ $start_with? $bind $call $class $append_features $included $name $cover? $size $merge $compile $proc $any? $prepend_features $prepended $to_s $__id__ $constants $include? $copy_class_variables $copy_constants".split(" ")); -return function(l,$super,e){l=H(l,$super,"Module");var n=[l].concat(e),L,D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,xa,Ba,La,na,S,sa,ya,pa,ea,F,V,ka,va,ia,wa,Ha,Ea,Qa,Sa,Ia,kb,Ra,W,za,Ca,Va,ib,db,Xa,bb,Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T,fa,la;a.defs(l,"$allocate",L=function(){var g=a.allocate_module(t,function(){});this!==a.Module&&Object.setPrototypeOf(g,this.$$prototype);return g},L.$$arity=0);a.def(l,"$initialize",D=function(){var g=D.$$p,C=g||t;g&&(D.$$p=null);g&&(D.$$p=null);return C!==t?x(this,"module_eval", -[],C.$to_proc()):t},D.$$arity=0);a.def(l,"$===",R=function(g){return p(null==g)?!1:a.is_a(g,this)},R.$$arity=1);a.def(l,"$<",ja=function(g){p(z(n,"Module")["$==="](g))||this.$raise(z(n,"TypeError"),"compared with non class/module");var C;if(this===g)return!1;var N=0;var aa=a.ancestors(this);for(C=aa.length;N",ma=function(g){p(z(n,"Module")["$==="](g))||this.$raise(z(n,"TypeError"),"compared with non class/module");return y(g,this)},ma.$$arity=1);a.def(l,"$>=",b=function(g){var C;return p(C=this["$equal?"](g))?C:"number"===typeof this&&"number"===typeof g?this>g:this["$>"](g)},b.$$arity=1);a.def(l,"$<=>",h=function(g){if(this===g)return 0;if(!p(z(n,"Module")["$==="](g)))return t;g=y(this,g);return p(g["$nil?"]())?t:p(g)?-1:1},h.$$arity=1);a.def(l,"$alias_method",f= function(g,C){g=d(g,z(n,"String"),"to_str");C=d(C,z(n,"String"),"to_str");a.alias(this,g,C);return this},f.$$arity=2);a.def(l,"$alias_native",q=function(g,C){null==C&&(C=g);a.alias_native(this,g,C);return this},q.$$arity=-2);a.def(l,"$ancestors",A=function(){return a.ancestors(this)},A.$$arity=0);a.def(l,"$append_features",E=function(g){a.append_features(this,g);return this},E.$$arity=1);a.def(l,"$attr_accessor",G=function(g){var C=a.slice.call(arguments,0,arguments.length);x(this,"attr_reader",a.to_a(C)); return x(this,"attr_writer",a.to_a(C))},G.$$arity=-1);a.def(l,"$attr",M=function(g){var C=a.slice.call(arguments,0,arguments.length);return 2!=C.length||!0!==C[1]&&!1!==C[1]?x(this,"attr_reader",a.to_a(C)):(this.$warn("optional boolean argument is obsoleted",k(["uplevel"],{uplevel:1})),C[1]?this.$attr_accessor(C[0]):this.$attr_reader(C[0]),t)},M.$$arity=-1);a.def(l,"$attr_reader",ba=function(g){var C=a.slice.call(arguments,0,arguments.length);for(var N=this.$$prototype,aa=C.length-1;0<=aa;aa--){var v= C[aa],U="$"+v;v=a.ivar(v);var oa=function(Ka){return function(){return null==this[Ka]?t:this[Ka]}}(v);a.defineProperty(N,v,t);oa.$$parameters=[];oa.$$arity=0;a.defn(this,U,oa)}return t},ba.$$arity=-1);a.def(l,"$attr_writer",ua=function(g){var C=a.slice.call(arguments,0,arguments.length);for(var N=this.$$prototype,aa=C.length-1;0<=aa;aa--){var v=C[aa],U="$"+v+"=";v=a.ivar(v);var oa=function(Ka){return function(jb){return this[Ka]=jb}}(v);oa.$$parameters=[["req"]];oa.$$arity=1;a.defineProperty(N,v, -t);a.defn(this,U,oa)}return t},ua.$$arity=-1);a.def(l,"$autoload",Oa=function(g,C){null==this.$$autoload&&(this.$$autoload={});a.const_cache_version++;this.$$autoload[g]=C;return t},Oa.$$arity=2);a.def(l,"$class_variables",xa=function(){return Object.keys(a.class_variables(this))},xa.$$arity=0);a.def(l,"$class_variable_get",Ba=function(g){g=z(n,"Opal")["$class_variable_name!"](g);var C=a.class_variables(this)[g];null==C&&this.$raise(z(n,"NameError").$new("uninitialized class variable "+g+" in "+this, +t);a.defn(this,U,oa)}return t},ua.$$arity=-1);a.def(l,"$autoload",Oa=function(g,C){null==this.$$autoload&&(this.$$autoload={});a.const_cache_version++;this.$$autoload[g]=C;return t},Oa.$$arity=2);a.def(l,"$class_variables",wa=function(){return Object.keys(a.class_variables(this))},wa.$$arity=0);a.def(l,"$class_variable_get",Ba=function(g){g=z(n,"Opal")["$class_variable_name!"](g);var C=a.class_variables(this)[g];null==C&&this.$raise(z(n,"NameError").$new("uninitialized class variable "+g+" in "+this, g));return C},Ba.$$arity=1);a.def(l,"$class_variable_set",La=function(g,C){g=z(n,"Opal")["$class_variable_name!"](g);return a.class_variable_set(this,g,C)},La.$$arity=2);a.def(l,"$class_variable_defined?",na=function(g){g=z(n,"Opal")["$class_variable_name!"](g);return a.class_variables(this).hasOwnProperty(g)},na.$$arity=1);a.def(l,"$remove_class_variable",S=function(g){g=z(n,"Opal")["$class_variable_name!"](g);if(a.hasOwnProperty.call(this.$$cvars,g)){var C=this.$$cvars[g];delete this.$$cvars[g]; return C}this.$raise(z(n,"NameError"),"cannot remove "+g+" for "+this)},S.$$arity=1);a.def(l,"$constants",sa=function(g){null==g&&(g=!0);return a.constants(this,g)},sa.$$arity=-1);a.defs(l,"$constants",ya=function(g){if(null==g){g=(this.$$nesting||[]).concat(a.Object);var C,N={},aa;var v=0;for(aa=g.length;v"},Y.$$arity=0);a.def(l,"$undef_method",Q=function(g){var C=a.slice.call(arguments,0,arguments.length);for(var N=0,aa=C.length;N":D?"#>":d(this,a.find_super_dispatcher(this,"to_s",L,!1,!0),"to_s",[],null)},L.$$arity=0),t)&&"to_s"}(J[0],null,J)}; -Opal.modules["corelib/basic_object"]=function(a){var y=[],J=a.nil,t=a.$$$,w=a.klass,z=a.truthy,p=a.range,d=a.hash2,H=a.send;a.add_stubs("$== $! $nil? $cover? $size $raise $merge $compile $proc $any? $inspect $new".split(" "));return function(x,$super,m){x=w(x,$super,"BasicObject");[x].concat(m);var u,c,l,I,e,n,L,D,R,ja,da,ma,b,h;a.def(x,"$initialize",u=function(f){a.slice.call(arguments,0,arguments.length);return J},u.$$arity=-1);a.def(x,"$==",c=function(f){return this===f},c.$$arity=1);a.def(x,"$eql?", +n,this.$constants());var C=[],N;for(N in this)this.hasOwnProperty(N)&&"$"!==N.charAt(0)&&"constructor"!==N&&!g["$include?"](N)&&C.push("@"+N);return C},Z.$$arity=0);a.def(l,"$dup",T=function(){var g=T.$$p,C;g&&(T.$$p=null);var N=0;var aa=arguments.length;for(C=Array(aa);N":D?"#>":d(this,a.find_super_dispatcher(this,"to_s",L,!1,!0),"to_s",[],null)},L.$$arity=0),t)&&"to_s"}(J[0],null,J)}; +Opal.modules["corelib/basic_object"]=function(a){var y=[],J=a.nil,t=a.$$$,w=a.klass,z=a.truthy,p=a.range,d=a.hash2,H=a.send;a.add_stubs("$== $! $nil? $cover? $size $raise $merge $compile $proc $any? $inspect $new".split(" "));return function(x,$super,m){x=w(x,$super,"BasicObject");[x].concat(m);var u,c,l,I,e,n,L,D,R,ia,da,ma,b,h;a.def(x,"$initialize",u=function(f){a.slice.call(arguments,0,arguments.length);return J},u.$$arity=-1);a.def(x,"$==",c=function(f){return this===f},c.$$arity=1);a.def(x,"$eql?", l=function(f){return this["$=="](f)},l.$$arity=1);a.alias(x,"equal?","==");a.def(x,"$__id__",I=function(){if(null!=this.$$id)return this.$$id;a.defineProperty(this,"$$id",a.uid());return this.$$id},I.$$arity=0);a.def(x,"$__send__",e=function(f,q){var A=e.$$p,E=A||J;A&&(e.$$p=null);A&&(e.$$p=null);A=a.slice.call(arguments,1,arguments.length);var G=this["$"+f];if(G)return E!==J&&(G.$$p=E),G.apply(this,A);E!==J&&(this.$method_missing.$$p=E);return this.$method_missing.apply(this,[f].concat(A))},e.$$arity= -2);a.def(x,"$!",n=function(){return!1},n.$$arity=0);a.def(x,"$!=",L=function(f){return this["$=="](f)["$!"]()},L.$$arity=1);a.def(x,"$instance_eval",D=function(f){var q=D.$$p,A=q||J,E,G,M=J,ba=E=J,ua=ba=J,Oa=ba=J;q&&(D.$$p=null);q&&(D.$$p=null);E=a.slice.call(arguments,0,arguments.length);z(z(M=A["$nil?"]())?!!a.compile:M)?(z(p(1,3,!1)["$cover?"](E.$size()))||t("::","Kernel").$raise(t("::","ArgumentError"),"wrong number of arguments (0 for 1..3)"),A=[].concat(a.to_a(E)),E=null==A[0]?J:A[0],ba=null== -A[1]?J:A[1],A,ba=d(["file","eval"],{file:z(ua=ba)?ua:"(eval)",eval:!0}),ba=a.hash({arity_check:!1}).$merge(ba),Oa=t("::","Opal").$compile(E,ba),A=H(t("::","Kernel"),"proc",[],(G=function(){return function(){return eval(Oa)}(null==G.$$s?this:G.$$s)},G.$$s=this,G.$$arity=0,G))):z(E["$any?"]())&&t("::","Kernel").$raise(t("::","ArgumentError"),"wrong number of arguments ("+E.$size()+" for 0)");ua=A.$$s;A.$$s=null;if(this.$$is_a_module){this.$$eval=!0;try{var xa=A.call(this,this)}finally{this.$$eval=!1}}else xa= -A.call(this,this);A.$$s=ua;return xa},D.$$arity=-1);a.def(x,"$instance_exec",R=function(f){var q=R.$$p,A=q||J;q&&(R.$$p=null);q&&(R.$$p=null);q=a.slice.call(arguments,0,arguments.length);z(A)||t("::","Kernel").$raise(t("::","ArgumentError"),"no block given");var E=A.$$s;A.$$s=null;if(this.$$is_a_module){this.$$eval=!0;try{var G=A.apply(this,q)}finally{this.$$eval=!1}}else G=A.apply(this,q);A.$$s=E;return G},R.$$arity=-1);a.def(x,"$singleton_method_added",ja=function(f){a.slice.call(arguments,0,arguments.length); -return J},ja.$$arity=-1);a.def(x,"$singleton_method_removed",da=function(f){a.slice.call(arguments,0,arguments.length);return J},da.$$arity=-1);a.def(x,"$singleton_method_undefined",ma=function(f){a.slice.call(arguments,0,arguments.length);return J},ma.$$arity=-1);a.def(x,"$method_missing",b=function(f,q){var A=b.$$p;A&&(b.$$p=null);A&&(b.$$p=null);a.slice.call(arguments,1,arguments.length);A=z(this.$inspect&&!this.$inspect.$$stub)?"undefined method `"+f+"' for "+this.$inspect()+":"+this.$$class: +A[1]?J:A[1],A,ba=d(["file","eval"],{file:z(ua=ba)?ua:"(eval)",eval:!0}),ba=a.hash({arity_check:!1}).$merge(ba),Oa=t("::","Opal").$compile(E,ba),A=H(t("::","Kernel"),"proc",[],(G=function(){return function(){return eval(Oa)}(null==G.$$s?this:G.$$s)},G.$$s=this,G.$$arity=0,G))):z(E["$any?"]())&&t("::","Kernel").$raise(t("::","ArgumentError"),"wrong number of arguments ("+E.$size()+" for 0)");ua=A.$$s;A.$$s=null;if(this.$$is_a_module){this.$$eval=!0;try{var wa=A.call(this,this)}finally{this.$$eval=!1}}else wa= +A.call(this,this);A.$$s=ua;return wa},D.$$arity=-1);a.def(x,"$instance_exec",R=function(f){var q=R.$$p,A=q||J;q&&(R.$$p=null);q&&(R.$$p=null);q=a.slice.call(arguments,0,arguments.length);z(A)||t("::","Kernel").$raise(t("::","ArgumentError"),"no block given");var E=A.$$s;A.$$s=null;if(this.$$is_a_module){this.$$eval=!0;try{var G=A.apply(this,q)}finally{this.$$eval=!1}}else G=A.apply(this,q);A.$$s=E;return G},R.$$arity=-1);a.def(x,"$singleton_method_added",ia=function(f){a.slice.call(arguments,0,arguments.length); +return J},ia.$$arity=-1);a.def(x,"$singleton_method_removed",da=function(f){a.slice.call(arguments,0,arguments.length);return J},da.$$arity=-1);a.def(x,"$singleton_method_undefined",ma=function(f){a.slice.call(arguments,0,arguments.length);return J},ma.$$arity=-1);a.def(x,"$method_missing",b=function(f,q){var A=b.$$p;A&&(b.$$p=null);A&&(b.$$p=null);a.slice.call(arguments,1,arguments.length);A=z(this.$inspect&&!this.$inspect.$$stub)?"undefined method `"+f+"' for "+this.$inspect()+":"+this.$$class: "undefined method `"+f+"' for "+this.$$class;return t("::","Kernel").$raise(t("::","NoMethodError").$new(A,f))},b.$$arity=-2);return(a.def(x,"$respond_to_missing?",h=function(){return!1},h.$$arity=-2),J)&&"respond_to_missing?"}(y[0],null,y)}; Opal.modules["corelib/kernel"]=function(a){function y(c,l){return"number"===typeof c&&"number"===typeof l?c<=l:c["$<="](l)}var J=[],t=a.nil,w=a.$$$,z=a.$$,p=a.truthy,d=a.coerce_to,H=a.module,x=a.gvars,k=a.hash2,m=a.send,u=a.klass;a.add_stubs("$raise $new $inspect $! $=~ $== $object_id $class $coerce_to? $<< $allocate $copy_instance_variables $copy_singleton_methods $initialize_clone $initialize_copy $define_method $singleton_class $to_proc $initialize_dup $for $empty? $pop $call $append_features $extend_object $extended $__id__ $to_s $instance_variable_name! $respond_to? $to_int $coerce_to! $Integer $nil? $=== $enum_for $result $any? $print $format $puts $each $<= $length $[] $< $first $caller $+ $map $exception $is_a? $rand $respond_to_missing? $pristine $try_convert! $expand_path $join $start_with? $new_seed $srand $sym $arg $open $include".split(" "));(function(c, -l){c=H(c,"Kernel");var I=[c].concat(l),e,n,L,D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,xa,Ba,La,na,S,sa,ya,pa,ea,F,V,ka,va,ia,wa,Ha,Ea,Qa,Sa,Ia,kb,Ra,W,za,Ca,Va,ib,db,Xa,bb,Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T,fa,la,g,C,N,aa;a.def(c,"$method_missing",e=function(v,U){var oa=e.$$p;oa&&(e.$$p=null);oa&&(e.$$p=null);oa=a.slice.call(arguments,1,arguments.length);return this.$raise(z(I,"NoMethodError").$new("undefined method `"+v+"' for "+this.$inspect(),v,oa))},e.$$arity=-2);a.def(c,"$=~",n=function(){return!1},n.$$arity= -1);a.def(c,"$!~",L=function(v){return this["$=~"](v)["$!"]()},L.$$arity=1);a.def(c,"$===",D=function(v){var U;return p(U=this.$object_id()["$=="](v.$object_id()))?U:this["$=="](v)},D.$$arity=1);a.def(c,"$<=>",R=function(v){this.$$comparable=!0;return(v=this["$=="](v))&&v!==t?0:t},R.$$arity=1);a.def(c,"$method",ja=function(v){var U=this["$"+v];U&&!U.$$stub||this.$raise(z(I,"NameError").$new("undefined method `"+v+"' for class `"+this.$class()+"'",v));return z(I,"Method").$new(this,U.$$owner||this.$class(), -U,v)},ja.$$arity=1);a.def(c,"$methods",da=function(v){null==v&&(v=!0);return p(v)?a.methods(this):a.own_methods(this)},da.$$arity=-1);a.def(c,"$public_methods",ma=function(v){null==v&&(v=!0);return p(v)?a.methods(this):a.receiver_methods(this)},ma.$$arity=-1);a.def(c,"$Array",b=function(v){if(v===t)return[];if(v.$$is_array)return v;var U=z(I,"Opal")["$coerce_to?"](v,z(I,"Array"),"to_ary");if(U!==t)return U;U=z(I,"Opal")["$coerce_to?"](v,z(I,"Array"),"to_a");return U!==t?U:[v]},b.$$arity=1);a.def(c, +l){c=H(c,"Kernel");var I=[c].concat(l),e,n,L,D,R,ia,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,wa,Ba,La,na,S,sa,ya,pa,ha,F,V,ka,va,ja,xa,Ha,Ea,Qa,Ra,Ia,kb,Sa,W,za,Da,Va,ib,db,bb,Xa,Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T,ea,la,g,C,N,aa;a.def(c,"$method_missing",e=function(v,U){var oa=e.$$p;oa&&(e.$$p=null);oa&&(e.$$p=null);oa=a.slice.call(arguments,1,arguments.length);return this.$raise(z(I,"NoMethodError").$new("undefined method `"+v+"' for "+this.$inspect(),v,oa))},e.$$arity=-2);a.def(c,"$=~",n=function(){return!1},n.$$arity= +1);a.def(c,"$!~",L=function(v){return this["$=~"](v)["$!"]()},L.$$arity=1);a.def(c,"$===",D=function(v){var U;return p(U=this.$object_id()["$=="](v.$object_id()))?U:this["$=="](v)},D.$$arity=1);a.def(c,"$<=>",R=function(v){this.$$comparable=!0;return(v=this["$=="](v))&&v!==t?0:t},R.$$arity=1);a.def(c,"$method",ia=function(v){var U=this["$"+v];U&&!U.$$stub||this.$raise(z(I,"NameError").$new("undefined method `"+v+"' for class `"+this.$class()+"'",v));return z(I,"Method").$new(this,U.$$owner||this.$class(), +U,v)},ia.$$arity=1);a.def(c,"$methods",da=function(v){null==v&&(v=!0);return p(v)?a.methods(this):a.own_methods(this)},da.$$arity=-1);a.def(c,"$public_methods",ma=function(v){null==v&&(v=!0);return p(v)?a.methods(this):a.receiver_methods(this)},ma.$$arity=-1);a.def(c,"$Array",b=function(v){if(v===t)return[];if(v.$$is_array)return v;var U=z(I,"Opal")["$coerce_to?"](v,z(I,"Array"),"to_ary");if(U!==t)return U;U=z(I,"Opal")["$coerce_to?"](v,z(I,"Array"),"to_a");return U!==t?U:[v]},b.$$arity=1);a.def(c, "$at_exit",h=function(){var v=h.$$p,U=v||t,oa=t;null==x.__at_exit__&&(x.__at_exit__=t);v&&(h.$$p=null);v&&(h.$$p=null);x.__at_exit__=p(oa=x.__at_exit__)?oa:[];x.__at_exit__["$<<"](U);return U},h.$$arity=0);a.def(c,"$caller",f=function(v,U){null==U&&(U=t);v=(Error().stack||"").split("\n");var oa=[];for(var Ka=3,jb=v.length;KaU||36=U?U-1:"9a-"+String.fromCharCode(97+(U-11)));(new RegExp("^\\s*[+-]?["+jb+"]+\\s*$")).test(Ka)||oa.$raise(z(I,"ArgumentError"),'invalid value for Integer(): "'+v+'"');Ka=parseInt(Ka,U);isNaN(Ka)&&oa.$raise(z(I,"ArgumentError"),'invalid value for Integer(): "'+ -v+'"');return Ka},ia.$$arity=-2);a.def(c,"$Float",wa=function(v){v===t&&this.$raise(z(I,"TypeError"),"can't convert nil into Float");if(v.$$is_string){var U=v.toString();U=U.replace(/(\d)_(?=\d)/g,"$1");if(/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(U))return this.$Integer(U);/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(U)||this.$raise(z(I,"ArgumentError"),'invalid value for Float(): "'+v+'"');return parseFloat(U)}return z(I,"Opal")["$coerce_to!"](v,z(I,"Float"),"to_f")},wa.$$arity=1);a.def(c, -"$Hash",Ha=function(v){var U=t;return p(p(U=v["$nil?"]())?U:v["$=="]([]))?k([],{}):p(z(I,"Hash")["$==="](v))?v:z(I,"Opal")["$coerce_to!"](v,z(I,"Hash"),"to_hash")},Ha.$$arity=1);a.def(c,"$is_a?",Ea=function(v){v.$$is_class||v.$$is_module||this.$raise(z(I,"TypeError"),"class or module required");return a.is_a(this,v)},Ea.$$arity=1);a.def(c,"$itself",Qa=function(){return this},Qa.$$arity=0);a.alias(c,"kind_of?","is_a?");a.def(c,"$lambda",Sa=function(){var v=Sa.$$p,U=v||t;v&&(Sa.$$p=null);v&&(Sa.$$p= -null);return a.lambda(U)},Sa.$$arity=0);a.def(c,"$load",Ia=function(v){v=z(I,"Opal")["$coerce_to!"](v,z(I,"String"),"to_str");return a.load(v)},Ia.$$arity=1);a.def(c,"$loop",kb=function(){var v,U=kb.$$p,oa=U||t,Ka=t;U&&(kb.$$p=null);if(oa===t)return m(this,"enum_for",["loop"],(v=function(){return w(z(I,"Float"),"INFINITY")},v.$$s=this,v.$$arity=0,v));for(;p(!0);)try{a.yieldX(oa,[])}catch(jb){if(a.rescue(jb,[z(I,"StopIteration")])){Ka=jb;try{return Ka.$result()}finally{a.pop_exception()}}else throw jb; -}return this},kb.$$arity=0);a.def(c,"$nil?",Ra=function(){return!1},Ra.$$arity=0);a.alias(c,"object_id","__id__");a.def(c,"$printf",W=function(v){var U=a.slice.call(arguments,0,arguments.length);p(U["$any?"]())&&this.$print(m(this,"format",a.to_a(U)));return t},W.$$arity=-1);a.def(c,"$proc",za=function(){var v=za.$$p,U=v||t;v&&(za.$$p=null);v&&(za.$$p=null);p(U)||this.$raise(z(I,"ArgumentError"),"tried to create Proc object without a block");U.$$is_lambda=!1;return U},za.$$arity=0);a.def(c,"$puts", -Ca=function(v){null==x.stdout&&(x.stdout=t);var U=a.slice.call(arguments,0,arguments.length);return m(x.stdout,"puts",a.to_a(U))},Ca.$$arity=-1);a.def(c,"$p",Va=function(v){var U;var oa=a.slice.call(arguments,0,arguments.length);m(oa,"each",[],(U=function(Ka){null==x.stdout&&(x.stdout=t);null==Ka&&(Ka=t);return x.stdout.$puts(Ka.$inspect())},U.$$s=this,U.$$arity=1,U));return p(y(oa.$length(),1))?oa["$[]"](0):oa},Va.$$arity=-1);a.def(c,"$print",ib=function(v){null==x.stdout&&(x.stdout=t);var U=a.slice.call(arguments, +v+'"');return Ka},ja.$$arity=-2);a.def(c,"$Float",xa=function(v){v===t&&this.$raise(z(I,"TypeError"),"can't convert nil into Float");if(v.$$is_string){var U=v.toString();U=U.replace(/(\d)_(?=\d)/g,"$1");if(/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(U))return this.$Integer(U);/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(U)||this.$raise(z(I,"ArgumentError"),'invalid value for Float(): "'+v+'"');return parseFloat(U)}return z(I,"Opal")["$coerce_to!"](v,z(I,"Float"),"to_f")},xa.$$arity=1);a.def(c, +"$Hash",Ha=function(v){var U=t;return p(p(U=v["$nil?"]())?U:v["$=="]([]))?k([],{}):p(z(I,"Hash")["$==="](v))?v:z(I,"Opal")["$coerce_to!"](v,z(I,"Hash"),"to_hash")},Ha.$$arity=1);a.def(c,"$is_a?",Ea=function(v){v.$$is_class||v.$$is_module||this.$raise(z(I,"TypeError"),"class or module required");return a.is_a(this,v)},Ea.$$arity=1);a.def(c,"$itself",Qa=function(){return this},Qa.$$arity=0);a.alias(c,"kind_of?","is_a?");a.def(c,"$lambda",Ra=function(){var v=Ra.$$p,U=v||t;v&&(Ra.$$p=null);v&&(Ra.$$p= +null);return a.lambda(U)},Ra.$$arity=0);a.def(c,"$load",Ia=function(v){v=z(I,"Opal")["$coerce_to!"](v,z(I,"String"),"to_str");return a.load(v)},Ia.$$arity=1);a.def(c,"$loop",kb=function(){var v,U=kb.$$p,oa=U||t,Ka=t;U&&(kb.$$p=null);if(oa===t)return m(this,"enum_for",["loop"],(v=function(){return w(z(I,"Float"),"INFINITY")},v.$$s=this,v.$$arity=0,v));for(;p(!0);)try{a.yieldX(oa,[])}catch(jb){if(a.rescue(jb,[z(I,"StopIteration")])){Ka=jb;try{return Ka.$result()}finally{a.pop_exception()}}else throw jb; +}return this},kb.$$arity=0);a.def(c,"$nil?",Sa=function(){return!1},Sa.$$arity=0);a.alias(c,"object_id","__id__");a.def(c,"$printf",W=function(v){var U=a.slice.call(arguments,0,arguments.length);p(U["$any?"]())&&this.$print(m(this,"format",a.to_a(U)));return t},W.$$arity=-1);a.def(c,"$proc",za=function(){var v=za.$$p,U=v||t;v&&(za.$$p=null);v&&(za.$$p=null);p(U)||this.$raise(z(I,"ArgumentError"),"tried to create Proc object without a block");U.$$is_lambda=!1;return U},za.$$arity=0);a.def(c,"$puts", +Da=function(v){null==x.stdout&&(x.stdout=t);var U=a.slice.call(arguments,0,arguments.length);return m(x.stdout,"puts",a.to_a(U))},Da.$$arity=-1);a.def(c,"$p",Va=function(v){var U;var oa=a.slice.call(arguments,0,arguments.length);m(oa,"each",[],(U=function(Ka){null==x.stdout&&(x.stdout=t);null==Ka&&(Ka=t);return x.stdout.$puts(Ka.$inspect())},U.$$s=this,U.$$arity=1,U));return p(y(oa.$length(),1))?oa["$[]"](0):oa},Va.$$arity=-1);a.def(c,"$print",ib=function(v){null==x.stdout&&(x.stdout=t);var U=a.slice.call(arguments, 0,arguments.length);return m(x.stdout,"print",a.to_a(U))},ib.$$arity=-1);a.def(c,"$warn",db=function(v,U){var oa,Ka=t,jb=t;null==x.VERBOSE&&(x.VERBOSE=t);null==x.stderr&&(x.stderr=t);var ob=a.slice.call(arguments,0,arguments.length);var mb=a.extract_kwargs(ob);if(null==mb)mb=k([],{});else if(!mb.$$is_hash)throw a.ArgumentError.$new("expected kwargs");mb=mb.$$smap.uplevel;null==mb&&(mb=t);p(mb)&&(mb=z(I,"Opal")["$coerce_to!"](mb,z(I,"Integer"),"to_str"),p("number"===typeof mb?0>mb:mb["$<"](0))&&this.$raise(z(I, -"ArgumentError"),"negative level ("+mb+")"),Ka=this.$caller("number"===typeof mb?mb+2:mb["$+"](2),1).$first(),p(Ka)&&(Ka=""+Ka+": "),ob=m(ob,"map",[],(oa=function(sb){null==sb&&(sb=t);return""+Ka+"warning: "+sb},oa.$$s=this,oa.$$arity=1,oa)));return p(p(jb=x.VERBOSE["$nil?"]())?jb:ob["$empty?"]())?t:m(x.stderr,"puts",a.to_a(ob))},db.$$arity=-1);a.def(c,"$raise",Xa=function(v,U){null==x["!"]&&(x["!"]=t);null==U&&(U=t);if(null==v&&x["!"]!==t)throw x["!"];null==v?v=z(I,"RuntimeError").$new():v.$$is_string? -v=z(I,"RuntimeError").$new(v):v.$$is_class&&v["$respond_to?"]("exception")?v=v.$exception(U):v["$is_a?"](z(I,"Exception"))||(v=z(I,"TypeError").$new("exception class/object expected"));x["!"]!==t&&a.exceptions.push(x["!"]);x["!"]=v;throw v;},Xa.$$arity=-1);a.alias(c,"fail","raise");a.def(c,"$rand",bb=function(v){if(void 0===v)return w(z(I,"Random"),"DEFAULT").$rand();v.$$is_number&&(0>v&&(v=Math.abs(v)),0!==v%1&&(v=v.$to_i()),0===v&&(v=void 0));return w(z(I,"Random"),"DEFAULT").$rand(v)},bb.$$arity= +"ArgumentError"),"negative level ("+mb+")"),Ka=this.$caller("number"===typeof mb?mb+2:mb["$+"](2),1).$first(),p(Ka)&&(Ka=""+Ka+": "),ob=m(ob,"map",[],(oa=function(sb){null==sb&&(sb=t);return""+Ka+"warning: "+sb},oa.$$s=this,oa.$$arity=1,oa)));return p(p(jb=x.VERBOSE["$nil?"]())?jb:ob["$empty?"]())?t:m(x.stderr,"puts",a.to_a(ob))},db.$$arity=-1);a.def(c,"$raise",bb=function(v,U){null==x["!"]&&(x["!"]=t);null==U&&(U=t);if(null==v&&x["!"]!==t)throw x["!"];null==v?v=z(I,"RuntimeError").$new():v.$$is_string? +v=z(I,"RuntimeError").$new(v):v.$$is_class&&v["$respond_to?"]("exception")?v=v.$exception(U):v["$is_a?"](z(I,"Exception"))||(v=z(I,"TypeError").$new("exception class/object expected"));x["!"]!==t&&a.exceptions.push(x["!"]);x["!"]=v;throw v;},bb.$$arity=-1);a.alias(c,"fail","raise");a.def(c,"$rand",Xa=function(v){if(void 0===v)return w(z(I,"Random"),"DEFAULT").$rand();v.$$is_number&&(0>v&&(v=Math.abs(v)),0!==v%1&&(v=v.$to_i()),0===v&&(v=void 0));return w(z(I,"Random"),"DEFAULT").$rand(v)},Xa.$$arity= -1);a.def(c,"$respond_to?",Aa=function(v,U){null==U&&(U=!1);var oa=this["$"+v];return"function"!==typeof oa||oa.$$stub?!0===this["$respond_to_missing?"].$$pristine?!1:this["$respond_to_missing?"](v,U):!0},Aa.$$arity=-2);a.def(c,"$respond_to_missing?",ta=function(){return!1},ta.$$arity=-2);z(I,"Opal").$pristine(c,"respond_to?","respond_to_missing?");a.def(c,"$require",Ma=function(v){v=z(I,"Opal")["$coerce_to!"](v,z(I,"String"),"to_str");return a.require(v)},Ma.$$arity=1);a.def(c,"$require_relative", Ta=function(v){z(I,"Opal")["$try_convert!"](v,z(I,"String"),"to_str");v=z(I,"File").$expand_path(z(I,"File").$join(a.current_file,"..",v));return a.require(v)},Ta.$$arity=1);a.def(c,"$require_tree",Za=function(v){var U=[];v=z(I,"File").$expand_path(v);v=a.normalize(v);"."===v&&(v="");for(var oa in a.modules)oa["$start_with?"](v)&&U.push([oa,a.require(oa)]);return U},Za.$$arity=1);a.alias(c,"send","__send__");a.alias(c,"public_send","__send__");a.def(c,"$singleton_class",Fa=function(){return a.get_singleton_class(this)}, Fa.$$arity=0);a.def(c,"$sleep",Y=function(v){null==v&&(v=t);v===t&&this.$raise(z(I,"TypeError"),"can't convert NilClass into time interval");v.$$is_number||this.$raise(z(I,"TypeError"),"can't convert "+v.$class()+" into time interval");0>v&&this.$raise(z(I,"ArgumentError"),"time interval must be positive");for(var U=a.global.performance?function(){return performance.now()}:function(){return new Date},oa=U();U()-oa<=1E3*v;);return Math.round(v)},Y.$$arity=-1);a.def(c,"$srand",Q=function(v){null==v&& -(v=z(I,"Random").$new_seed());return z(I,"Random").$srand(v)},Q.$$arity=-1);a.def(c,"$String",Z=function(v){var U;return p(U=z(I,"Opal")["$coerce_to?"](v,z(I,"String"),"to_str"))?U:z(I,"Opal")["$coerce_to!"](v,z(I,"String"),"to_s")},Z.$$arity=1);a.def(c,"$tap",T=function(){var v=T.$$p,U=v||t;v&&(T.$$p=null);v&&(T.$$p=null);a.yield1(U,this);return this},T.$$arity=0);a.def(c,"$to_proc",fa=function(){return this},fa.$$arity=0);a.def(c,"$to_s",la=function(){return"#<"+this.$class()+":0x"+this.$__id__().$to_s(16)+ +(v=z(I,"Random").$new_seed());return z(I,"Random").$srand(v)},Q.$$arity=-1);a.def(c,"$String",Z=function(v){var U;return p(U=z(I,"Opal")["$coerce_to?"](v,z(I,"String"),"to_str"))?U:z(I,"Opal")["$coerce_to!"](v,z(I,"String"),"to_s")},Z.$$arity=1);a.def(c,"$tap",T=function(){var v=T.$$p,U=v||t;v&&(T.$$p=null);v&&(T.$$p=null);a.yield1(U,this);return this},T.$$arity=0);a.def(c,"$to_proc",ea=function(){return this},ea.$$arity=0);a.def(c,"$to_s",la=function(){return"#<"+this.$class()+":0x"+this.$__id__().$to_s(16)+ ">"},la.$$arity=0);a.def(c,"$catch",g=function(v){var U=g.$$p,oa=U||t;U&&(g.$$p=null);try{return a.yieldX(oa,[])}catch(Ka){if(a.rescue(Ka,[z(I,"UncaughtThrowError")])){U=Ka;try{return U.$sym()["$=="](v)?U.$arg():this.$raise()}finally{a.pop_exception()}}else throw Ka;}},g.$$arity=1);a.def(c,"$throw",C=function(v){var U=a.slice.call(arguments,0,arguments.length);return this.$raise(z(I,"UncaughtThrowError"),U)},C.$$arity=-1);a.def(c,"$open",N=function(v){var U=N.$$p,oa=U||t;U&&(N.$$p=null);U&&(N.$$p= null);U=a.slice.call(arguments,0,arguments.length);return m(z(I,"File"),"open",a.to_a(U),oa.$to_proc())},N.$$arity=-1);a.def(c,"$yield_self",aa=function(){var v,U=aa.$$p,oa=U||t;U&&(aa.$$p=null);return oa===t?m(this,"enum_for",["yield_self"],(v=function(){return 1},v.$$s=this,v.$$arity=0,v)):a.yield1(oa,this)},aa.$$arity=0);a.alias(c,"then","yield_self");z(I,"Opal").$pristine(c,"method_missing")})(J[0],J);return function(c,$super,I){c=u(c,$super,"Object");I=[c].concat(I);return c.$include(z(I,"Kernel"))}(J[0], null,J)}; -Opal.modules["corelib/error"]=function(a){var y=[],J=a.nil,t=a.$$,w=a.klass,z=a.send,p=a.truthy,d=a.module,H=a.send2,x=a.hash2;a.add_stubs("$new $clone $to_s $empty? $class $raise $+ $attr_reader $[] $> $length $inspect".split(" "));(function(k,$super,u){k=w(k,$super,"Exception");var c=[k].concat(u),l,I,e,n,L,D,R,ja,da;k.$$prototype.message=J;a.defs(k,"$new",l=function(b){var h=a.slice.call(arguments,0,arguments.length);var f=0 $length $inspect".split(" "));(function(k,$super,u){k=w(k,$super,"Exception");var c=[k].concat(u),l,I,e,n,L,D,R,ia,da;k.$$prototype.message=J;a.defs(k,"$new",l=function(b){var h=a.slice.call(arguments,0,arguments.length);var f=0"},R.$$arity=0);a.def(k,"$set_backtrace",ja=function(b){var h= -!0,f;if(b===J)this.backtrace=J,this.stack="";else if(b.$$is_string)this.backtrace=[b],this.stack=b;else{if(b.$$is_array){var q=0;for(f=b.length;q"},R.$$arity=0);a.def(k,"$set_backtrace",ia=function(b){var h= +!0,f;if(b===J)this.backtrace=J,this.stack="";else if(b.$$is_string)this.backtrace=[b],this.stack=b;else{if(b.$$is_array){var q=0;for(f=b.length;q $length $Rational".split(" "));(function(d,$super,x){d=w(d,$super,"NilClass");var k=[d].concat(x),m,u,c,l,I,e,n,L,D,R,ja,da,ma,b,h,f,q,A;d.$$prototype.$$meta=d;(function(E,G){var M=[E].concat(G),ba;a.def(E,"$allocate",ba=function(){return this.$raise(t(M,"TypeError"),"allocator undefined for "+this.$name())},ba.$$arity=0);a.udef(E,"$new");return J})(a.get_singleton_class(d), +Opal.modules["corelib/nil"]=function(a){var y=[],J=a.nil,t=a.$$,w=a.klass,z=a.hash2,p=a.truthy;a.add_stubs("$raise $name $new $> $length $Rational".split(" "));(function(d,$super,x){d=w(d,$super,"NilClass");var k=[d].concat(x),m,u,c,l,I,e,n,L,D,R,ia,da,ma,b,h,f,q,A;d.$$prototype.$$meta=d;(function(E,G){var M=[E].concat(G),ba;a.def(E,"$allocate",ba=function(){return this.$raise(t(M,"TypeError"),"allocator undefined for "+this.$name())},ba.$$arity=0);a.udef(E,"$new");return J})(a.get_singleton_class(d), k);a.def(d,"$!",m=function(){return!0},m.$$arity=0);a.def(d,"$&",u=function(){return!1},u.$$arity=1);a.def(d,"$|",c=function(E){return!1!==E&&E!==J},c.$$arity=1);a.def(d,"$^",l=function(E){return!1!==E&&E!==J},l.$$arity=1);a.def(d,"$==",I=function(E){return E===J},I.$$arity=1);a.def(d,"$dup",e=function(){return J},e.$$arity=0);a.def(d,"$clone",n=function(E){if(null==E)z([],{});else if(!E.$$is_hash)throw a.ArgumentError.$new("expected kwargs");return J},n.$$arity=-1);a.def(d,"$inspect",L=function(){return"nil"}, -L.$$arity=0);a.def(d,"$nil?",D=function(){return!0},D.$$arity=0);a.def(d,"$singleton_class",R=function(){return t(k,"NilClass")},R.$$arity=0);a.def(d,"$to_a",ja=function(){return[]},ja.$$arity=0);a.def(d,"$to_h",da=function(){return a.hash()},da.$$arity=0);a.def(d,"$to_i",ma=function(){return 0},ma.$$arity=0);a.alias(d,"to_f","to_i");a.def(d,"$to_s",b=function(){return""},b.$$arity=0);a.def(d,"$to_c",h=function(){return t(k,"Complex").$new(0,0)},h.$$arity=0);a.def(d,"$rationalize",f=function(E){var G= +L.$$arity=0);a.def(d,"$nil?",D=function(){return!0},D.$$arity=0);a.def(d,"$singleton_class",R=function(){return t(k,"NilClass")},R.$$arity=0);a.def(d,"$to_a",ia=function(){return[]},ia.$$arity=0);a.def(d,"$to_h",da=function(){return a.hash()},da.$$arity=0);a.def(d,"$to_i",ma=function(){return 0},ma.$$arity=0);a.alias(d,"to_f","to_i");a.def(d,"$to_s",b=function(){return""},b.$$arity=0);a.def(d,"$to_c",h=function(){return t(k,"Complex").$new(0,0)},h.$$arity=0);a.def(d,"$rationalize",f=function(E){var G= a.slice.call(arguments,0,arguments.length).$length();G="number"===typeof G?1"](1);p(G)&&this.$raise(t(k,"ArgumentError"));return this.$Rational(0,1)},f.$$arity=-1);a.def(d,"$to_r",q=function(){return this.$Rational(0,1)},q.$$arity=0);return(a.def(d,"$instance_variables",A=function(){return[]},A.$$arity=0),J)&&"instance_variables"})(y[0],null,y);return a.const_set(y[0],"NIL",J)}; -Opal.modules["corelib/boolean"]=function(a){var y=[],J=a.nil,t=a.$$,w=a.klass,z=a.hash2;a.add_stubs(["$raise","$name"]);(function(p,$super,H){p=w(p,$super,"Boolean");var x=[p].concat(H),k,m,u,c,l,I,e,n,L,D;a.defineProperty(p.$$prototype,"$$is_boolean",!0);a.defineProperty(p.$$prototype,"$$meta",p);(function(R,ja){var da=[R].concat(ja),ma;a.def(R,"$allocate",ma=function(){return this.$raise(t(da,"TypeError"),"allocator undefined for "+this.$name())},ma.$$arity=0);a.udef(R,"$new");return J})(a.get_singleton_class(p), +Opal.modules["corelib/boolean"]=function(a){var y=[],J=a.nil,t=a.$$,w=a.klass,z=a.hash2;a.add_stubs(["$raise","$name"]);(function(p,$super,H){p=w(p,$super,"Boolean");var x=[p].concat(H),k,m,u,c,l,I,e,n,L,D;a.defineProperty(p.$$prototype,"$$is_boolean",!0);a.defineProperty(p.$$prototype,"$$meta",p);(function(R,ia){var da=[R].concat(ia),ma;a.def(R,"$allocate",ma=function(){return this.$raise(t(da,"TypeError"),"allocator undefined for "+this.$name())},ma.$$arity=0);a.udef(R,"$new");return J})(a.get_singleton_class(p), x);a.def(p,"$__id__",k=function(){return this.valueOf()?2:0},k.$$arity=0);a.alias(p,"object_id","__id__");a.def(p,"$!",m=function(){return 1!=this},m.$$arity=0);a.def(p,"$&",u=function(R){return 1==this?!1!==R&&R!==J:!1},u.$$arity=1);a.def(p,"$|",c=function(R){return 1==this?!0:!1!==R&&R!==J},c.$$arity=1);a.def(p,"$^",l=function(R){return 1==this?!1===R||R===J:!1!==R&&R!==J},l.$$arity=1);a.def(p,"$==",I=function(R){return 1==this===R.valueOf()},I.$$arity=1);a.alias(p,"equal?","==");a.alias(p,"eql?", "==");a.def(p,"$singleton_class",e=function(){return t(x,"Boolean")},e.$$arity=0);a.def(p,"$to_s",n=function(){return 1==this?"true":"false"},n.$$arity=0);a.def(p,"$dup",L=function(){return this},L.$$arity=0);return(a.def(p,"$clone",D=function(R){if(null==R)z([],{});else if(!R.$$is_hash)throw a.ArgumentError.$new("expected kwargs");return this},D.$$arity=-1),J)&&"clone"})(y[0],Boolean,y);a.const_set(y[0],"TrueClass",t(y,"Boolean"));a.const_set(y[0],"FalseClass",t(y,"Boolean"));a.const_set(y[0],"TRUE", !0);return a.const_set(y[0],"FALSE",!1)}; Opal.modules["corelib/comparable"]=function(a){function y(x,k){return"number"===typeof x&&"number"===typeof k?x>k:x["$>"](k)}function J(x,k){return"number"===typeof x&&"number"===typeof k?x $< $=== $raise $class $<=> $equal?".split(" "));return function(x,k){function m(ma){return a.is_a(ma,a.Integer)?ma:y(ma,0)?1:J(ma,0)?-1:0}function u(ma,b){var h=ma["$<=>"](b);p(h)&&(da=b,b=w["$==="](da)||(!0)["$==="](da)||(!1)["$==="](da)|| -z(l,"Integer")["$==="](da)||z(l,"Float")["$==="](da)?b.$inspect():b.$$class,c.$raise(z(l,"ArgumentError"),"comparison of "+ma.$class()+" with "+b+" failed"));return m(h)}var c=d(x,"Comparable"),l=[c].concat(k),I,e,n,L,D,R,ja,da=w;a.def(c,"$==",I=function(ma){var b;return H(this["$equal?"](ma))?!0:this["$<=>"]==a.Kernel["$<=>"]?!1:this.$$comparable?(delete this.$$comparable,!1):H(b=this["$<=>"](ma))?0==m(b):!1},I.$$arity=1);a.def(c,"$>",e=function(ma){return 0=", -n=function(ma){return 0<=u(this,ma)},n.$$arity=1);a.def(c,"$<",L=function(ma){return 0>u(this,ma)},L.$$arity=1);a.def(c,"$<=",D=function(ma){return 0>=u(this,ma)},D.$$arity=1);a.def(c,"$between?",R=function(ma,b){return J(this,ma)||y(this,b)?!1:!0},R.$$arity=2);a.def(c,"$clamp",ja=function(ma,b){null==b&&(b=w);if(b===w){a.is_a(ma,a.Range)||this.$raise(z(l,"TypeError"),"wrong argument type "+ma.$class()+" (expected Range)");var h=ma.excl;b=ma.end;ma=ma.begin;b!==w&&h&&this.$raise(z(l,"ArgumentError"), -"cannot clamp with an exclusive range")}ma!==w&&b!==w&&0h)return ma}return b!==w&&(h=u(this,b),0"]==a.Kernel["$<=>"]?!1:this.$$comparable?(delete this.$$comparable,!1):H(b=this["$<=>"](ma))?0==m(b):!1},I.$$arity=1);a.def(c,"$>",e=function(ma){return 0=", +n=function(ma){return 0<=u(this,ma)},n.$$arity=1);a.def(c,"$<",L=function(ma){return 0>u(this,ma)},L.$$arity=1);a.def(c,"$<=",D=function(ma){return 0>=u(this,ma)},D.$$arity=1);a.def(c,"$between?",R=function(ma,b){return J(this,ma)||y(this,b)?!1:!0},R.$$arity=2);a.def(c,"$clamp",ia=function(ma,b){null==b&&(b=w);if(b===w){a.is_a(ma,a.Range)||this.$raise(z(l,"TypeError"),"wrong argument type "+ma.$class()+" (expected Range)");var h=ma.excl;b=ma.end;ma=ma.begin;b!==w&&h&&this.$raise(z(l,"ArgumentError"), +"cannot clamp with an exclusive range")}ma!==w&&b!==w&&0h)return ma}return b!==w&&(h=u(this,b),0h&&(h+=b.length,0>h))return H["~"]=J;for(var A=a.global_regexp(this);;){f=A.exec(b);if(null===f)return H["~"]=J;if(f.index>= h)return H["~"]=t(c,"MatchData").$new(A,f),q===J?H["~"]:a.yield1(q,H["~"]);A.lastIndex=f.index+1}},L.$$arity=-2);a.def(k,"$match?",D=function(b,h){this.uninitialized&&this.$raise(t(c,"TypeError"),"uninitialized Regexp");if(void 0===h)return b===J?!1:this.test(w(b,t(c,"String"),"to_str"));h=w(h,t(c,"Integer"),"to_int");if(b===J)return!1;b=w(b,t(c,"String"),"to_str");if(0>h&&(h+=b.length,0>h))return!1;b=a.global_regexp(this).exec(b);return null===b||b.index"},ja.$$arity=0);a.def(k,"$length",da=function(){return this.matches.length},da.$$arity=0);a.alias(k,"size","length");a.def(k,"$to_a",ma=function(){return this.matches},ma.$$arity=0);a.def(k,"$to_s",b=function(){return this.matches[0]},b.$$arity=0);return(a.def(k,"$values_at",h=function(f){var q=a.slice.call(arguments,0,arguments.length);var A,E=[];for(A=0;A"},ia.$$arity=0);a.def(k,"$length",da=function(){return this.matches.length},da.$$arity=0);a.alias(k,"size","length");a.def(k,"$to_a",ma=function(){return this.matches},ma.$$arity=0);a.def(k,"$to_s",b=function(){return this.matches[0]},b.$$arity=0);return(a.def(k,"$values_at",h=function(f){var q=a.slice.call(arguments,0,arguments.length);var A,E=[];for(A=0;AG&&(G+=this.matches.length,0>G)){E.push(J);continue}E.push(this.matches[G])}return E},h.$$arity=-1),J)&&"values_at"}(y[0],null,y)}; Opal.modules["corelib/string"]=function(a){function y(l,I){return"number"===typeof l&&"number"===typeof I?l/I:l["$/"](I)}function J(l,I){return"number"===typeof l&&"number"===typeof I?l+I:l["$+"](I)}var t=a.top,w=[],z=a.nil,p=a.$$$,d=a.$$,H=a.coerce_to,x=a.respond_to,k=a.klass,m=a.truthy,u=a.send,c=a.gvars;a.add_stubs("$require $include $coerce_to? $raise $=== $format $to_s $respond_to? $to_str $<=> $== $=~ $new $force_encoding $casecmp $empty? $ljust $ceil $/ $+ $rjust $floor $to_a $each_char $to_proc $coerce_to! $copy_singleton_methods $initialize_clone $initialize_dup $enum_for $size $chomp $[] $to_i $each_line $encoding $class $match $match? $captures $proc $succ $escape $include? $upcase $unicode_normalize".split(" ")); t.$require("corelib/comparable");t.$require("corelib/regexp");(function(l,$super,e){function n(B){function O(Ua){var Ya="",gb,qb=Ua.length;for(gb=0;gbnb&&L.$raise(d(D,"ArgumentError"),'invalid range "'+pb+"-"+nb+'" in string transliteration');for(pb+=1;pbB&&this.$raise(d(D,"ArgumentError"),"negative argument");if(0===B)return this.$$cast("");var O="",ra=this.toString();for(268435456<=ra.length*B&&this.$raise(d(D,"RangeError"),"multiply count must not overflow maximum string size");;){1===(B&1)&&(O+=ra);B>>>=1;if(0===B)break;ra+=ra}return this.$$cast(O)},h.$$arity=1);a.def(L,"$+",f=function(B){B=H(B,d(D,"String"), "to_str");return this+B.$to_s()},f.$$arity=1);a.def(L,"$<=>",q=function(B){if(m(B["$respond_to?"]("to_str")))return B=B.$to_str().$to_s(),this>B?1:this"](this);return B===z?z:0B?1:0},q.$$arity=1);a.def(L,"$==",A=function(B){return B.$$is_string?this.toString()===B.toString():x(B,"$to_str")?B["$=="](this):!1},A.$$arity=1);a.alias(L,"eql?","==");a.alias(L,"===","==");a.def(L,"$=~",E=function(B){B.$$is_string&&this.$raise(d(D,"TypeError"),"type mismatch: String given");return B["$=~"](this)}, E.$$arity=1);a.def(L,"$[]",G=function(B,O){var ra=this.length;if(B.$$is_range){var Ga=B.excl;O=H(B.end,d(D,"Integer"),"to_int");B=H(B.begin,d(D,"Integer"),"to_int");if(Math.abs(B)>ra)return z;0>B&&(B+=ra);0>O&&(O+=ra);Ga||(O+=1);O-=B;0>O&&(O=0);return this.$$cast(this.substr(B,O))}if(B.$$is_string)return null!=O&&this.$raise(d(D,"TypeError")),-1!==this.indexOf(B)?this.$$cast(B):z;if(B.$$is_regexp){ra=this.match(B);if(null===ra)return c["~"]=z;c["~"]=d(D,"MatchData").$new(B,ra);if(null==O)return this.$$cast(ra[0]); O=H(O,d(D,"Integer"),"to_int");return 0>O&&-OB&&(B+=ra);if(null==O)return B>=ra||0>B?z:this.$$cast(this.substr(B,1));O=H(O,d(D,"Integer"),"to_int");return 0>O||B>ra||0>B?z:this.$$cast(this.substr(B,O))},G.$$arity=-2);a.alias(L,"byteslice","[]");a.def(L,"$b",M=function(){return this.$force_encoding("binary")},M.$$arity=0);a.def(L,"$capitalize",ba=function(){return this.$$cast(this.charAt(0).toUpperCase()+ -this.substr(1).toLowerCase())},ba.$$arity=0);a.def(L,"$casecmp",ua=function(B){var O=this;if(!m(B["$respond_to?"]("to_str")))return z;B=H(B,d(D,"String"),"to_str").$to_s();var ra=/^[\x00-\x7F]*$/;ra.test(O)&&ra.test(B)&&(O=O.toLowerCase(),B=B.toLowerCase());return O["$<=>"](B)},ua.$$arity=1);a.def(L,"$casecmp?",Oa=function(B){B=this.$casecmp(B);return B===z?z:0===B},Oa.$$arity=1);a.def(L,"$center",xa=function(B,O){null==O&&(O=" ");B=H(B,d(D,"Integer"),"to_int");O=H(O,d(D,"String"),"to_str").$to_s(); -m(O["$empty?"]())&&this.$raise(d(D,"ArgumentError"),"zero width padding");if(m(B<=this.length))return this;var ra=this.$ljust(y(J(B,this.length),2).$ceil(),O);B=this.$rjust(y(J(B,this.length),2).$floor(),O);return this.$$cast(B+ra.slice(this.length))},xa.$$arity=-2);a.def(L,"$chars",Ba=function(){var B=Ba.$$p,O=B||z;B&&(Ba.$$p=null);B&&(Ba.$$p=null);return m(O)?u(this,"each_char",[],O.$to_proc()):this.$each_char().$to_a()},Ba.$$arity=0);a.def(L,"$chomp",La=function(B){null==c["/"]&&(c["/"]=z);null== +this.substr(1).toLowerCase())},ba.$$arity=0);a.def(L,"$casecmp",ua=function(B){var O=this;if(!m(B["$respond_to?"]("to_str")))return z;B=H(B,d(D,"String"),"to_str").$to_s();var ra=/^[\x00-\x7F]*$/;ra.test(O)&&ra.test(B)&&(O=O.toLowerCase(),B=B.toLowerCase());return O["$<=>"](B)},ua.$$arity=1);a.def(L,"$casecmp?",Oa=function(B){B=this.$casecmp(B);return B===z?z:0===B},Oa.$$arity=1);a.def(L,"$center",wa=function(B,O){null==O&&(O=" ");B=H(B,d(D,"Integer"),"to_int");O=H(O,d(D,"String"),"to_str").$to_s(); +m(O["$empty?"]())&&this.$raise(d(D,"ArgumentError"),"zero width padding");if(m(B<=this.length))return this;var ra=this.$ljust(y(J(B,this.length),2).$ceil(),O);B=this.$rjust(y(J(B,this.length),2).$floor(),O);return this.$$cast(B+ra.slice(this.length))},wa.$$arity=-2);a.def(L,"$chars",Ba=function(){var B=Ba.$$p,O=B||z;B&&(Ba.$$p=null);B&&(Ba.$$p=null);return m(O)?u(this,"each_char",[],O.$to_proc()):this.$each_char().$to_a()},Ba.$$arity=0);a.def(L,"$chomp",La=function(B){null==c["/"]&&(c["/"]=z);null== B&&(B=c["/"]);if(m(B===z||0===this.length))return this;B=d(D,"Opal")["$coerce_to!"](B,d(D,"String"),"to_str").$to_s();var O;"\n"===B?O=this.replace(/\r?\n?$/,""):""===B?O=this.replace(/(\r?\n)+$/,""):this.length>=B.length&&this.substr(this.length-B.length,B.length)===B&&(O=this.substr(0,this.length-B.length));return null!=O?this.$$cast(O):this},La.$$arity=-1);a.def(L,"$chop",na=function(){var B=this.length;B=1>=B?"":"\n"===this.charAt(B-1)&&"\r"===this.charAt(B-2)?this.substr(0,B-2):this.substr(0, B-1);return this.$$cast(B)},na.$$arity=0);a.def(L,"$chr",S=function(){return this.charAt(0)},S.$$arity=0);a.def(L,"$clone",sa=function(){var B=new String(this);B.$copy_singleton_methods(this);B.$initialize_clone(this);return B},sa.$$arity=0);a.def(L,"$dup",ya=function(){var B=new String(this);B.$initialize_dup(this);return B},ya.$$arity=0);a.def(L,"$count",pa=function(B){var O=a.slice.call(arguments,0,arguments.length);0===O.length&&this.$raise(d(D,"ArgumentError"),"ArgumentError: wrong number of arguments (0 for 1+)"); -O=n(O);return null===O?0:this.length-this.replace(new RegExp(O,"g"),"").length},pa.$$arity=-1);a.def(L,"$delete",ea=function(B){var O=a.slice.call(arguments,0,arguments.length);0===O.length&&this.$raise(d(D,"ArgumentError"),"ArgumentError: wrong number of arguments (0 for 1+)");O=n(O);return null===O?this:this.$$cast(this.replace(new RegExp(O,"g"),""))},ea.$$arity=-1);a.def(L,"$delete_prefix",F=function(B){B.$$is_string||(B=H(B,d(D,"String"),"to_str"));return this.slice(0,B.length)===B?this.$$cast(this.slice(B.length)): +O=n(O);return null===O?0:this.length-this.replace(new RegExp(O,"g"),"").length},pa.$$arity=-1);a.def(L,"$delete",ha=function(B){var O=a.slice.call(arguments,0,arguments.length);0===O.length&&this.$raise(d(D,"ArgumentError"),"ArgumentError: wrong number of arguments (0 for 1+)");O=n(O);return null===O?this:this.$$cast(this.replace(new RegExp(O,"g"),""))},ha.$$arity=-1);a.def(L,"$delete_prefix",F=function(B){B.$$is_string||(B=H(B,d(D,"String"),"to_str"));return this.slice(0,B.length)===B?this.$$cast(this.slice(B.length)): this},F.$$arity=1);a.def(L,"$delete_suffix",V=function(B){B.$$is_string||(B=H(B,d(D,"String"),"to_str"));return this.slice(this.length-B.length)===B?this.$$cast(this.slice(0,this.length-B.length)):this},V.$$arity=1);a.def(L,"$downcase",ka=function(){return this.$$cast(this.toLowerCase())},ka.$$arity=0);a.def(L,"$each_char",va=function(){var B=va.$$p,O=B||z,ra;B&&(va.$$p=null);B&&(va.$$p=null);if(O===z)return u(this,"enum_for",["each_char"],(ra=function(){return(null==ra.$$s?this:ra.$$s).$size()}, -ra.$$s=this,ra.$$arity=0,ra));B=0;for(var Ga=this.length;B=Da.length&&this.substr(this.length- -Da.length,Da.length)==Da)return!0}return!1},Ha.$$arity=-1);a.alias(L,"equal?","===");a.def(L,"$gsub",Ea=function(B,O){var ra=Ea.$$p,Ga=ra||z,Da=this;ra&&(Ea.$$p=null);ra&&(Ea.$$p=null);if(void 0===O&&Ga===z)return Da.$enum_for("gsub",B);ra="";var Ja=z,Wa=0;B.$$is_regexp?B=a.global_multiline_regexp(B):(B=H(B,d(D,"String"),"to_str"),B=new RegExp(B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gm"));for(var hb;;){var eb=B.exec(Da);if(null===eb){c["~"]=z;ra+=Da.slice(Wa);break}Ja=d(D,"MatchData").$new(B,eb); -if(void 0===O){hb=B.lastIndex;var Ua=Ga(eb[0]);B.lastIndex=hb}else O.$$is_hash?Ua=O["$[]"](eb[0]).$to_s():(O.$$is_string||(O=H(O,d(D,"String"),"to_str")),Ua=O.replace(/([\\]+)([0-9+&`'])/g,function(Ya,gb,qb){if(0===gb.length%2)return Ya;switch(qb){case "+":for(Ya=eb.length-1;0O&&(O+=this.length,0>O))return z;if(B.$$is_regexp)for(ra=a.global_multiline_regexp(B);;){B=ra.exec(this);if(null===B){c["~"]=z;O=-1;break}if(B.index>=O){c["~"]=d(D,"MatchData").$new(ra,B);O=B.index;break}ra.lastIndex=B.index+1}else B=H(B,d(D,"String"),"to_str"),O=0===B.length&&O>this.length?-1:this.indexOf(B,O);return-1===O?z:O},kb.$$arity=-2);a.def(L,"$inspect",Ra=function(){var B={"\u0007":"\\a","\u001b":"\\e","\b":"\\b","\t":"\\t", -"\n":"\\n","\f":"\\f","\r":"\\r","\x0B":"\\v",'"':'\\"',"\\":"\\\\"};return'"'+this.replace(/[\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(O){return B[O]||"\\u"+("0000"+O.charCodeAt(0).toString(16).toUpperCase()).slice(-4)}).replace(/#[\$@\{]/g,"\\$&")+'"'},Ra.$$arity=0);a.def(L,"$intern",W=function(){return this.toString()},W.$$arity=0);a.def(L,"$lines",za=function(B){var O=za.$$p,ra=O||z;null==c["/"]&&(c["/"]=z);O&& -(za.$$p=null);O&&(za.$$p=null);null==B&&(B=c["/"]);B=u(this,"each_line",[B],ra.$to_proc());return m(ra)?this:B.$to_a()},za.$$arity=-1);a.def(L,"$length",Ca=function(){return this.length},Ca.$$arity=0);a.def(L,"$ljust",Va=function(B,O){null==O&&(O=" ");B=H(B,d(D,"Integer"),"to_int");O=H(O,d(D,"String"),"to_str").$to_s();m(O["$empty?"]())&&this.$raise(d(D,"ArgumentError"),"zero width padding");if(m(B<=this.length))return this;var ra=-1,Ga="";for(B-=this.length;++ra=Da||65<=Da&&90>=Da||97<=Da&&122>=Da)switch(Da){case 57:Ga=!0;Da=48;break;case 90:Ga=!0;Da=65;break;case 122:Ga=!0;Da=97;break;default:Ga=!1,Da+=1}else-1===ra?255===Da?(Ga=!0,Da=0):(Ga=!1,Da+=1):Ga=!0;O=O.slice(0,B)+String.fromCharCode(Da)+O.slice(B+1);if(Ga&&(0===B||B===ra)){switch(Da){case 65:break;case 97:break;default:Da+=1}O=0===B?String.fromCharCode(Da)+O:O.slice(0,B)+String.fromCharCode(Da)+O.slice(B);Ga=!1}if(!Ga)break}return this.$$cast(O)}, -Aa.$$arity=0);a.def(L,"$oct",ta=function(){var B=this;var O=8;if(/^\s*_/.test(B))return 0;B=B.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i,function(ra,Ga,Da,Ja){switch(Ja.charAt(0)){case "+":case "-":return ra;case "0":if("x"===Ja.charAt(1)&&"0x"===Da)return ra}switch(Da){case "0b":O=2;break;case "0":case "0o":O=8;break;case "0d":O=10;break;case "0x":O=16}return Ga+Ja});B=parseInt(B.replace(/_(?!_)/g,""),O);return isNaN(B)?0:B},ta.$$arity=0);a.def(L,"$ord",Ma=function(){return this.charCodeAt(0)},Ma.$$arity= +ra.$$s=this,ra.$$arity=0,ra));B=0;for(var Ga=this.length;B=Ca.length&&this.substr(this.length- +Ca.length,Ca.length)==Ca)return!0}return!1},Ha.$$arity=-1);a.alias(L,"equal?","===");a.def(L,"$gsub",Ea=function(B,O){var ra=Ea.$$p,Ga=ra||z,Ca=this;ra&&(Ea.$$p=null);ra&&(Ea.$$p=null);if(void 0===O&&Ga===z)return Ca.$enum_for("gsub",B);ra="";var Ja=z,Wa=0;B.$$is_regexp?B=a.global_multiline_regexp(B):(B=H(B,d(D,"String"),"to_str"),B=new RegExp(B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gm"));for(var hb;;){var eb=B.exec(Ca);if(null===eb){c["~"]=z;ra+=Ca.slice(Wa);break}Ja=d(D,"MatchData").$new(B,eb); +if(void 0===O){hb=B.lastIndex;var Ua=Ga(eb[0]);B.lastIndex=hb}else O.$$is_hash?Ua=O["$[]"](eb[0]).$to_s():(O.$$is_string||(O=H(O,d(D,"String"),"to_str")),Ua=O.replace(/([\\]+)([0-9+&`'])/g,function(Ya,gb,qb){if(0===gb.length%2)return Ya;switch(qb){case "+":for(Ya=eb.length-1;0O&&(O+=this.length,0>O))return z;if(B.$$is_regexp)for(ra=a.global_multiline_regexp(B);;){B=ra.exec(this);if(null===B){c["~"]=z;O=-1;break}if(B.index>=O){c["~"]=d(D,"MatchData").$new(ra,B);O=B.index;break}ra.lastIndex=B.index+1}else B=H(B,d(D,"String"),"to_str"),O=0===B.length&&O>this.length?-1:this.indexOf(B,O);return-1===O?z:O},kb.$$arity=-2);a.def(L,"$inspect",Sa=function(){var B={"\u0007":"\\a","\u001b":"\\e","\b":"\\b","\t":"\\t", +"\n":"\\n","\f":"\\f","\r":"\\r","\x0B":"\\v",'"':'\\"',"\\":"\\\\"};return'"'+this.replace(/[\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(O){return B[O]||"\\u"+("0000"+O.charCodeAt(0).toString(16).toUpperCase()).slice(-4)}).replace(/#[\$@\{]/g,"\\$&")+'"'},Sa.$$arity=0);a.def(L,"$intern",W=function(){return this.toString()},W.$$arity=0);a.def(L,"$lines",za=function(B){var O=za.$$p,ra=O||z;null==c["/"]&&(c["/"]=z);O&& +(za.$$p=null);O&&(za.$$p=null);null==B&&(B=c["/"]);B=u(this,"each_line",[B],ra.$to_proc());return m(ra)?this:B.$to_a()},za.$$arity=-1);a.def(L,"$length",Da=function(){return this.length},Da.$$arity=0);a.def(L,"$ljust",Va=function(B,O){null==O&&(O=" ");B=H(B,d(D,"Integer"),"to_int");O=H(O,d(D,"String"),"to_str").$to_s();m(O["$empty?"]())&&this.$raise(d(D,"ArgumentError"),"zero width padding");if(m(B<=this.length))return this;var ra=-1,Ga="";for(B-=this.length;++ra=Ca||65<=Ca&&90>=Ca||97<=Ca&&122>=Ca)switch(Ca){case 57:Ga=!0;Ca=48;break;case 90:Ga=!0;Ca=65;break;case 122:Ga=!0;Ca=97;break;default:Ga=!1,Ca+=1}else-1===ra?255===Ca?(Ga=!0,Ca=0):(Ga=!1,Ca+=1):Ga=!0;O=O.slice(0,B)+String.fromCharCode(Ca)+O.slice(B+1);if(Ga&&(0===B||B===ra)){switch(Ca){case 65:break;case 97:break;default:Ca+=1}O=0===B?String.fromCharCode(Ca)+O:O.slice(0,B)+String.fromCharCode(Ca)+O.slice(B);Ga=!1}if(!Ga)break}return this.$$cast(O)}, +Aa.$$arity=0);a.def(L,"$oct",ta=function(){var B=this;var O=8;if(/^\s*_/.test(B))return 0;B=B.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i,function(ra,Ga,Ca,Ja){switch(Ja.charAt(0)){case "+":case "-":return ra;case "0":if("x"===Ja.charAt(1)&&"0x"===Ca)return ra}switch(Ca){case "0b":O=2;break;case "0":case "0o":O=8;break;case "0d":O=10;break;case "0x":O=16}return Ga+Ja});B=parseInt(B.replace(/_(?!_)/g,""),O);return isNaN(B)?0:B},ta.$$arity=0);a.def(L,"$ord",Ma=function(){return this.charCodeAt(0)},Ma.$$arity= 0);a.def(L,"$partition",Ta=function(B){if(B.$$is_regexp){var O=B.exec(this);null===O?O=-1:(d(D,"MatchData").$new(B,O),B=O[0],O=O.index)}else B=H(B,d(D,"String"),"to_str"),O=this.indexOf(B);return-1===O?[this,"",""]:[this.slice(0,O),this.slice(O,O+B.length),this.slice(O+B.length)]},Ta.$$arity=1);a.def(L,"$reverse",Za=function(){return this.split("").reverse().join("")},Za.$$arity=0);a.def(L,"$rindex",Fa=function(B,O){if(void 0===O)O=this.length;else if(O=H(O,d(D,"Integer"),"to_int"),0>O&&(O+=this.length, 0>O))return z;if(B.$$is_regexp){var ra=null;for(B=a.global_multiline_regexp(B);;){var Ga=B.exec(this);if(null===Ga||Ga.index>O)break;ra=Ga;B.lastIndex=ra.index+1}null===ra?(c["~"]=z,O=-1):(d(D,"MatchData").$new(B,ra),O=ra.index)}else B=H(B,d(D,"String"),"to_str"),O=this.lastIndexOf(B,O);return-1===O?z:O},Fa.$$arity=-2);a.def(L,"$rjust",Y=function(B,O){null==O&&(O=" ");B=H(B,d(D,"Integer"),"to_int");O=H(O,d(D,"String"),"to_str").$to_s();m(O["$empty?"]())&&this.$raise(d(D,"ArgumentError"),"zero width padding"); if(m(B<=this.length))return this;B=Math.floor(B-this.length);var ra=Array(Math.floor(B/O.length)+1).join(O);return this.$$cast(ra+O.slice(0,B-ra.length)+this)},Y.$$arity=-2);a.def(L,"$rpartition",Q=function(B){var O;if(B.$$is_regexp){var ra=null;for(O=a.global_multiline_regexp(B);;){var Ga=O.exec(this);if(null===Ga)break;ra=Ga;O.lastIndex=ra.index+1}null===ra?ra=-1:(d(D,"MatchData").$new(O,ra),B=ra[0],ra=ra.index)}else B=H(B,d(D,"String"),"to_str"),ra=this.lastIndexOf(B);return-1===ra?["","",this]: -[this.slice(0,ra),this.slice(ra,ra+B.length),this.slice(ra+B.length)]},Q.$$arity=1);a.def(L,"$rstrip",Z=function(){return this.replace(/[\s\u0000]*$/,"")},Z.$$arity=0);a.def(L,"$scan",T=function(B){var O=T.$$p,ra=O||z;O&&(T.$$p=null);O&&(T.$$p=null);O=[];var Ga=z,Da;B.$$is_regexp?B=a.global_multiline_regexp(B):(B=H(B,d(D,"String"),"to_str"),B=new RegExp(B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gm"));for(;null!=(Da=B.exec(this));)Ga=d(D,"MatchData").$new(B,Da),ra===z?1==Da.length?O.push(Da[0]):O.push(Ga.$captures()): -1==Da.length?ra(Da[0]):ra.call(this,Ga.$captures()),B.lastIndex===Da.index&&(B.lastIndex+=1);c["~"]=Ga;return ra!==z?this:O},T.$$arity=1);a.alias(L,"size","length");a.alias(L,"slice","[]");a.def(L,"$split",fa=function(B,O){function ra(){for(hb=0;hbO){if(null!==eb&&""===eb[0]&&-1===B.source.indexOf("(?="))for(hb=0,B=eb.length;hb< -B;hb++)Ja.push("");ra();return Ja}if(null!==eb&&""===eb[0])return Ja.splice(O-1,Ja.length-1,Ja.slice(O-1).join("")),ra(),Ja;if(O>=Ja.length)return ra(),Ja;for(hb=0;null!==eb;){hb++;Wa=B.lastIndex;if(hb+1===O)break;eb=B.exec(Da)}Ja.splice(O-1,Ja.length-1,Da.slice(Wa));ra();return Ja},fa.$$arity=-1);a.def(L,"$squeeze",la=function(B){var O=a.slice.call(arguments,0,arguments.length);if(0===O.length)return this.$$cast(this.replace(/(.)\1+/g,"$1"));O=n(O);return null===O?this:this.$$cast(this.replace(new RegExp("("+ -O+")\\1+","g"),"$1"))},la.$$arity=-1);a.def(L,"$start_with?",g=function(B){var O=a.slice.call(arguments,0,arguments.length);for(var ra=0,Ga=O.length;raO){if(null!==eb&&""===eb[0]&&-1===B.source.indexOf("(?="))for(hb=0,B=eb.length;hb< +B;hb++)Ja.push("");ra();return Ja}if(null!==eb&&""===eb[0])return Ja.splice(O-1,Ja.length-1,Ja.slice(O-1).join("")),ra(),Ja;if(O>=Ja.length)return ra(),Ja;for(hb=0;null!==eb;){hb++;Wa=B.lastIndex;if(hb+1===O)break;eb=B.exec(Ca)}Ja.splice(O-1,Ja.length-1,Ca.slice(Wa));ra();return Ja},ea.$$arity=-1);a.def(L,"$squeeze",la=function(B){var O=a.slice.call(arguments,0,arguments.length);if(0===O.length)return this.$$cast(this.replace(/(.)\1+/g,"$1"));O=n(O);return null===O?this:this.$$cast(this.replace(new RegExp("("+ +O+")\\1+","g"),"$1"))},la.$$arity=-1);a.def(L,"$start_with?",g=function(B){var O=a.slice.call(arguments,0,arguments.length);for(var ra=0,Ga=O.length;ra=B?O:O&Math.pow(2,B)-1},aa.$$arity=-1);a.def(L,"$swapcase",v=function(){var B=this.replace(/([a-z]+)|([A-Z]+)/g,function(O,ra){return ra?O.toUpperCase():O.toLowerCase()});return this.constructor===String?B:this.$class().$new(B)},v.$$arity=0);a.def(L,"$to_f",U=function(){if("_"===this.charAt(0))return 0;var B=parseFloat(this.replace(/_/g,""));return isNaN(B)||Infinity==B||-Infinity==B?0:B},U.$$arity=0);a.def(L,"$to_i",oa=function(B){null==B&&(B=10);var O= -this.toLowerCase(),ra=H(B,d(D,"Integer"),"to_int");(1===ra||0>ra||36Ya&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ua)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ua+=1;UaYa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ua)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ua+=1;UaYa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ua)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ua+=1;UaYa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ua)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ua+=1;Uara||36Ya&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ua)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ua+=1;UaYa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ua)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ua+=1;UaYa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ua)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ua+=1;UaYa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ua)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ua+=1;Uan:e["$>"](n)}function J(e,n){return"number"===typeof e&&"number"===typeof n?e+n:e["$+"](n)}function t(e,n){return"number"===typeof e&&"number"===typeof n?e-n:e["$-"](n)}function w(e,n){return"number"===typeof e&&"number"===typeof n?e<=n:e["$<="](n)}var z=[],p=a.nil,d=a.$$$,H=a.$$,x=a.falsy,k=a.truthy,m=a.coerce_to,u=a.module,c=a.send,l=a.hash2,I=a.lambda;a.add_stubs("$each $public_send $destructure $to_enum $enumerator_size $new $yield $raise $slice_when $! $enum_for $flatten $map $warn $proc $== $nil? $respond_to? $coerce_to! $> $* $try_convert $< $+ $- $ceil $/ $size $select $to_proc $__send__ $length $<= $[] $push $<< $[]= $=== $inspect $<=> $first $reverse $sort $take $sort_by $compare $call $dup $to_a $sort! $map! $key? $values $transform_values $group_by $to_h $coerce_to? $class $zip".split(" ")); -return function(e,n){function L(Y){0===Y.length&&(Y=[p]);1=Y)))return p;var fa=[],la;this.$each.$$p=function(){var g=H(D,"Opal").$destructure(arguments);a.yield1(Z,g);fa.push(g)};this.$each();if(0===fa.length)return p;if(Y===p)for(;;)for(Q=0,la=fa.length;QY)&&this.$raise(H(D,"ArgumentError"),"attempt to drop negative size");var Q=[],Z=0;this.$each.$$p=function(){Y<=Z&&Q.push(H(D,"Opal").$destructure(arguments));Z++};this.$each();return Q},E.$$arity=1);a.def(e,"$drop_while",G=function(){var Y=G.$$p,Q=Y||p;Y&&(G.$$p=null);Y&&(G.$$p=null);if(Q===p)return this.$enum_for("drop_while");var Z=[],T=!0;this.$each.$$p=function(){var fa=H(D,"Opal").$destructure(arguments); -if(T){var la=a.yield1(Q,fa);x(la)&&(T=!1,Z.push(fa))}else Z.push(fa)};this.$each();return Z},G.$$arity=0);a.def(e,"$each_cons",M=function(Y){var Q=M.$$p,Z=Q||p,T;Q&&(M.$$p=null);Q&&(M.$$p=null);k(1!=arguments.length)&&this.$raise(H(D,"ArgumentError"),"wrong number of arguments ("+arguments.length+" for 1)");Y=H(D,"Opal").$try_convert(Y,H(D,"Integer"),"to_int");k(0>=Y)&&this.$raise(H(D,"ArgumentError"),"invalid size");if(Z===p)return c(this,"enum_for",["each_cons",Y],(T=function(){var la=p;var g=(null== -T.$$s?this:T.$$s).$enumerator_size();return k(g["$nil?"]())?p:k(k(la=g["$=="](0))?la:"number"===typeof g&&"number"===typeof Y?gY&&fa.shift();fa.length==Y&&a.yield1(Z,fa.slice(0,Y))};this.$each();return p},M.$$arity=1);a.def(e,"$each_entry",ba=function(Y){var Q=ba.$$p,Z=Q||p,T;Q&&(ba.$$p=null);Q&&(ba.$$p=null);Q=a.slice.call(arguments,0,arguments.length); -if(Z===p)return c(this,"to_enum",["each_entry"].concat(a.to_a(Q)),(T=function(){return(null==T.$$s?this:T.$$s).$enumerator_size()},T.$$s=this,T.$$arity=0,T));this.$each.$$p=function(){var fa=H(D,"Opal").$destructure(arguments);a.yield1(Z,fa)};this.$each.apply(this,Q);return this},ba.$$arity=-1);a.def(e,"$each_slice",ua=function(Y){var Q=ua.$$p,Z=Q||p,T;Q&&(ua.$$p=null);Q&&(ua.$$p=null);Y=m(Y,H(D,"Integer"),"to_int");k(0>=Y)&&this.$raise(H(D,"ArgumentError"),"invalid slice size");if(Z===p)return c(this, -"enum_for",["each_slice",Y],(T=function(){var la=null==T.$$s?this:T.$$s;return k(la["$respond_to?"]("size"))?(la=la.$size(),("number"===typeof la&&"number"===typeof Y?la/Y:la["$/"](Y)).$ceil()):p},T.$$s=this,T.$$arity=0,T));var fa=[];this.$each.$$p=function(){var la=H(D,"Opal").$destructure(arguments);fa.push(la);fa.length===Y&&(a.yield1(Z,fa),fa=[])};this.$each();0=Y)))return p;var ea=[],la;this.$each.$$p=function(){var g=H(D,"Opal").$destructure(arguments);a.yield1(Z,g);ea.push(g)};this.$each();if(0===ea.length)return p;if(Y===p)for(;;)for(Q=0,la=ea.length;QY)&&this.$raise(H(D,"ArgumentError"),"attempt to drop negative size");var Q=[],Z=0;this.$each.$$p=function(){Y<=Z&&Q.push(H(D,"Opal").$destructure(arguments));Z++};this.$each();return Q},E.$$arity=1);a.def(e,"$drop_while",G=function(){var Y=G.$$p,Q=Y||p;Y&&(G.$$p=null);Y&&(G.$$p=null);if(Q===p)return this.$enum_for("drop_while");var Z=[],T=!0;this.$each.$$p=function(){var ea=H(D,"Opal").$destructure(arguments); +if(T){var la=a.yield1(Q,ea);x(la)&&(T=!1,Z.push(ea))}else Z.push(ea)};this.$each();return Z},G.$$arity=0);a.def(e,"$each_cons",M=function(Y){var Q=M.$$p,Z=Q||p,T;Q&&(M.$$p=null);Q&&(M.$$p=null);k(1!=arguments.length)&&this.$raise(H(D,"ArgumentError"),"wrong number of arguments ("+arguments.length+" for 1)");Y=H(D,"Opal").$try_convert(Y,H(D,"Integer"),"to_int");k(0>=Y)&&this.$raise(H(D,"ArgumentError"),"invalid size");if(Z===p)return c(this,"enum_for",["each_cons",Y],(T=function(){var la=p;var g=(null== +T.$$s?this:T.$$s).$enumerator_size();return k(g["$nil?"]())?p:k(k(la=g["$=="](0))?la:"number"===typeof g&&"number"===typeof Y?gY&&ea.shift();ea.length==Y&&a.yield1(Z,ea.slice(0,Y))};this.$each();return p},M.$$arity=1);a.def(e,"$each_entry",ba=function(Y){var Q=ba.$$p,Z=Q||p,T;Q&&(ba.$$p=null);Q&&(ba.$$p=null);Q=a.slice.call(arguments,0,arguments.length); +if(Z===p)return c(this,"to_enum",["each_entry"].concat(a.to_a(Q)),(T=function(){return(null==T.$$s?this:T.$$s).$enumerator_size()},T.$$s=this,T.$$arity=0,T));this.$each.$$p=function(){var ea=H(D,"Opal").$destructure(arguments);a.yield1(Z,ea)};this.$each.apply(this,Q);return this},ba.$$arity=-1);a.def(e,"$each_slice",ua=function(Y){var Q=ua.$$p,Z=Q||p,T;Q&&(ua.$$p=null);Q&&(ua.$$p=null);Y=m(Y,H(D,"Integer"),"to_int");k(0>=Y)&&this.$raise(H(D,"ArgumentError"),"invalid slice size");if(Z===p)return c(this, +"enum_for",["each_slice",Y],(T=function(){var la=null==T.$$s?this:T.$$s;return k(la["$respond_to?"]("size"))?(la=la.$size(),("number"===typeof la&&"number"===typeof Y?la/Y:la["$/"](Y)).$ceil()):p},T.$$s=this,T.$$arity=0,T));var ea=[];this.$each.$$p=function(){var la=H(D,"Opal").$destructure(arguments);ea.push(la);ea.length===Y&&(a.yield1(Z,ea),ea=[])};this.$each();0Y)&&this.$raise(H(D,"ArgumentError"),"attempt to take negative size");if(k(0==Y))return[];fa=0;c(this,"each",[],(Z=function(la){var g=a.slice.call(arguments,0,arguments.length);T.push(H(D,"Opal").$destructure(g));if(k(Y<=++fa))a.ret(T);else return p},Z.$$s=this,Z.$$arity=-1,Z));return T}catch(la){if(la===a.returner)return la.$v;throw la;}},sa.$$arity=-1);a.alias(e,"flat_map","collect_concat");a.def(e,"$grep",ya=function(Y){var Q=ya.$$p,Z=Q||p,T,fa=p;Q&&(ya.$$p=null);Q&& -(ya.$$p=null);fa=[];c(this,"each",[],(T=function(la){var g=a.slice.call(arguments,0,arguments.length);var C=L(g);if(!k(c(Y,"__send__",["==="].concat(a.to_a(C)))))return p;Z!==p?(k(y(g.$length(),1))&&(g=[g]),g=a.yieldX(Z,a.to_a(g))):k(w(g.$length(),1))&&(g=g["$[]"](0));return fa.$push(g)},T.$$s=this,T.$$arity=-1,T));return fa},ya.$$arity=1);a.def(e,"$grep_v",pa=function(Y){var Q=pa.$$p,Z=Q||p,T,fa=p;Q&&(pa.$$p=null);Q&&(pa.$$p=null);fa=[];c(this,"each",[],(T=function(la){var g=a.slice.call(arguments, -0,arguments.length);var C=L(g);if(k(c(Y,"__send__",["==="].concat(a.to_a(C)))))return p;Z!==p?(k(y(g.$length(),1))&&(g=[g]),g=a.yieldX(Z,a.to_a(g))):k(w(g.$length(),1))&&(g=g["$[]"](0));return fa.$push(g)},T.$$s=this,T.$$arity=-1,T));return fa},pa.$$arity=1);a.def(e,"$group_by",ea=function(){var Y=ea.$$p,Q=Y||p,Z,T=p,fa=p,la=p;Y&&(ea.$$p=null);Y&&(ea.$$p=null);if(Q===p)return c(this,"enum_for",["group_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z)); -T=l([],{});this.$each.$$p=function(){var g=H(D,"Opal").$destructure(arguments),C=a.yield1(Q,g);k(fa=T["$[]"](C))?C=fa:(la=[C,[]],c(T,"[]=",a.to_a(la)),C=la[t(la.length,1)]);C["$<<"](g)};this.$each();return T},ea.$$arity=0);a.def(e,"$include?",F=function(Y){try{var Q;c(this,"each",[],(Q=function(Z){var T=a.slice.call(arguments,0,arguments.length);if(H(D,"Opal").$destructure(T)["$=="](Y))a.ret(!0);else return p},Q.$$s=this,Q.$$arity=-1,Q));return!1}catch(Z){if(Z===a.returner)return Z.$v;throw Z;}}, -F.$$arity=1);a.def(e,"$inject",V=function(Y,Q){var Z=V.$$p,T=Z||p;Z&&(V.$$p=null);Z&&(V.$$p=null);var fa=Y;T!==p&&void 0===Q?this.$each.$$p=function(){var la=H(D,"Opal").$destructure(arguments);void 0!==fa&&(la=a.yieldX(T,[fa,la]));fa=la}:(void 0===Q&&(H(D,"Symbol")["$==="](Y)||this.$raise(H(D,"TypeError"),""+Y.$inspect()+" is not a Symbol"),Q=Y,fa=void 0),this.$each.$$p=function(){var la=H(D,"Opal").$destructure(arguments);fa=void 0===fa?la:fa.$__send__(Q,la)});this.$each();return void 0==fa?p:fa}, -V.$$arity=-1);a.def(e,"$lazy",ka=function(){var Y;return c(d(H(D,"Enumerator"),"Lazy"),"new",[this,this.$enumerator_size()],(Y=function(Q,Z){null==Q&&(Q=p);var T=a.slice.call(arguments,1,arguments.length);return c(Q,"yield",a.to_a(T))},Y.$$s=this,Y.$$arity=-2,Y))},ka.$$arity=0);a.def(e,"$enumerator_size",va=function(){return k(this["$respond_to?"]("size"))?this.$size():p},va.$$arity=0);a.alias(e,"map","collect");a.def(e,"$max",ia=function(Y){var Q=ia.$$p,Z=Q||p,T=this;Q&&(ia.$$p=null);Q&&(ia.$$p= -null);if(void 0===Y||Y===p){var fa,la;T.$each.$$p=function(){var g=H(D,"Opal").$destructure(arguments);void 0===fa?fa=g:(la=Z!==p?a.yieldX(Z,[g,fa]):g["$<=>"](fa),la===p&&T.$raise(H(D,"ArgumentError"),"comparison failed"),0"](la)&&(fa=g,la=C)};this.$each();return void 0===fa?p:fa},wa.$$arity=-1);a.alias(e,"member?","include?");a.def(e,"$min",Ha=function(Y){var Q=Ha.$$p,Z=Q||p,T,fa=this;Q&&(Ha.$$p= -null);Q&&(Ha.$$p=null);null==Y&&(Y=p);if(!k(Y["$nil?"]()))return Z!==p?c(fa,"sort",[],(T=function(g,C){null==g&&(g=p);null==C&&(C=p);return a.yieldX(Z,[g,C])},T.$$s=fa,T.$$arity=2,T)).$take(Y):fa.$sort().$take(Y);var la;fa.$each.$$p=Z!==p?function(){var g=H(D,"Opal").$destructure(arguments);if(void 0===la)la=g;else{var C=Z(g,la);C===p&&fa.$raise(H(D,"ArgumentError"),"comparison failed");0>C&&(la=g)}}:function(){var g=H(D,"Opal").$destructure(arguments);void 0===la?la=g:0>H(D,"Opal").$compare(g,la)&& -(la=g)};fa.$each();return void 0===la?p:la},Ha.$$arity=-1);a.def(e,"$min_by",Ea=function(Y){var Q=Ea.$$p,Z=Q||p,T;Q&&(Ea.$$p=null);Q&&(Ea.$$p=null);null==Y&&(Y=p);if(!k(Z))return c(this,"enum_for",["min_by",Y],(T=function(){return(null==T.$$s?this:T.$$s).$enumerator_size()},T.$$s=this,T.$$arity=0,T));if(!k(Y["$nil?"]()))return c(this,"sort_by",[],Z.$to_proc()).$take(Y);var fa,la;this.$each.$$p=function(){var g=H(D,"Opal").$destructure(arguments),C=a.yield1(Z,g);void 0===fa?(fa=g,la=C):0>C["$<=>"](la)&& -(fa=g,la=C)};this.$each();return void 0===fa?p:fa},Ea.$$arity=-1);a.def(e,"$minmax",Qa=function(){var Y=Qa.$$p,Q=Y||p,Z,T=this,fa=p;Y&&(Qa.$$p=null);Y&&(Qa.$$p=null);Q=function(){return k(fa=Q)?fa:c(T,"proc",[],(Z=function(N,aa){null==N&&(N=p);null==aa&&(aa=p);return N["$<=>"](aa)},Z.$$s=T,Z.$$arity=2,Z))}();var la=p,g=p,C=!0;T.$each.$$p=function(){var N=H(D,"Opal").$destructure(arguments);if(C)la=g=N,C=!1;else{var aa=Q.$call(la,N);aa===p?T.$raise(H(D,"ArgumentError"),"comparison failed"):0aa&&(g=N)}};T.$each();return[la,g]},Qa.$$arity=0);a.def(e,"$minmax_by",Sa=function(){var Y=Sa.$$p,Q=Y||p,Z;Y&&(Sa.$$p=null);Y&&(Sa.$$p=null);if(!k(Q))return c(this,"enum_for",["minmax_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var T=p,fa=p,la,g;this.$each.$$p=function(){var C=H(D,"Opal").$destructure(arguments),N=a.yield1(Q,C);if(void 0===la||0>N["$<=>"](la))T=C,la= -N;if(void 0===g||0"](g))fa=C,g=N};this.$each();return[T,fa]},Sa.$$arity=0);a.def(e,"$none?",Ia=function(Y){try{var Q=Ia.$$p,Z=Q||p,T,fa,la;Q&&(Ia.$$p=null);Q&&(Ia.$$p=null);k(void 0!==Y)?c(this,"each",[],(T=function(g){var C=a.slice.call(arguments,0,arguments.length);C=L(C);if(k(c(Y,"public_send",["==="].concat(a.to_a(C)))))a.ret(!1);else return p},T.$$s=this,T.$$arity=-1,T)):Z!==p?c(this,"each",[],(fa=function(g){var C=a.slice.call(arguments,0,arguments.length);if(k(a.yieldX(Z,a.to_a(C))))a.ret(!1); -else return p},fa.$$s=this,fa.$$arity=-1,fa)):c(this,"each",[],(la=function(g){var C=a.slice.call(arguments,0,arguments.length);C=H(D,"Opal").$destructure(C);if(k(C))a.ret(!1);else return p},la.$$s=this,la.$$arity=-1,la));return!0}catch(g){if(g===a.returner)return g.$v;throw g;}},Ia.$$arity=-1);a.def(e,"$one?",kb=function(Y){try{var Q=kb.$$p,Z=Q||p,T,fa,la,g=p;Q&&(kb.$$p=null);Q&&(kb.$$p=null);g=0;k(void 0!==Y)?c(this,"each",[],(T=function(C){var N=a.slice.call(arguments,0,arguments.length);N=L(N); -if(k(c(Y,"public_send",["==="].concat(a.to_a(N)))))if(g=J(g,1),k(y(g,1)))a.ret(!1);else return p;else return p},T.$$s=this,T.$$arity=-1,T)):Z!==p?c(this,"each",[],(fa=function(C){var N=a.slice.call(arguments,0,arguments.length);if(!k(a.yieldX(Z,a.to_a(N))))return p;g=J(g,1);if(k(y(g,1)))a.ret(!1);else return p},fa.$$s=this,fa.$$arity=-1,fa)):c(this,"each",[],(la=function(C){var N=a.slice.call(arguments,0,arguments.length);if(!k(H(D,"Opal").$destructure(N)))return p;g=J(g,1);if(k(y(g,1)))a.ret(!1); -else return p},la.$$s=this,la.$$arity=-1,la));return g["$=="](1)}catch(C){if(C===a.returner)return C.$v;throw C;}},kb.$$arity=-1);a.def(e,"$partition",Ra=function(){var Y=Ra.$$p,Q=Y||p,Z;Y&&(Ra.$$p=null);Y&&(Ra.$$p=null);if(Q===p)return c(this,"enum_for",["partition"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var T=[],fa=[];this.$each.$$p=function(){var la=H(D,"Opal").$destructure(arguments),g=a.yield1(Q,la);k(g)?T.push(la):fa.push(la)};this.$each(); -return[T,fa]},Ra.$$arity=0);a.alias(e,"reduce","inject");a.def(e,"$reject",W=function(){var Y=W.$$p,Q=Y||p,Z;Y&&(W.$$p=null);Y&&(W.$$p=null);if(Q===p)return c(this,"enum_for",["reject"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var T=[];this.$each.$$p=function(){var fa=H(D,"Opal").$destructure(arguments),la=a.yield1(Q,fa);x(la)&&T.push(fa)};this.$each();return T},W.$$arity=0);a.def(e,"$reverse_each",za=function(){var Y=za.$$p,Q=Y||p,Z;Y&&(za.$$p=null); -Y&&(za.$$p=null);if(Q===p)return c(this,"enum_for",["reverse_each"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var T=[];this.$each.$$p=function(){T.push(arguments)};this.$each();for(Y=T.length-1;0<=Y;Y--)a.yieldX(Q,T[Y]);return T},za.$$arity=0);a.alias(e,"select","find_all");a.def(e,"$slice_before",Ca=function(Y){var Q=Ca.$$p,Z=Q||p,T;Q&&(Ca.$$p=null);Q&&(Ca.$$p=null);k(void 0===Y&&Z===p)&&this.$raise(H(D,"ArgumentError"),"both pattern and block are given"); -k(void 0!==Y&&Z!==p||1"](la)},Z.$$s=this,Z.$$arity=2,Z)));return c(T,"sort",[],Q.$to_proc())},db.$$arity=0);a.def(e,"$sort_by",Xa=function(){var Y=Xa.$$p,Q=Y||p,Z,T,fa,la,g=p;Y&&(Xa.$$p=null);Y&&(Xa.$$p=null);if(Q===p)return c(this,"enum_for",["sort_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()}, -Z.$$s=this,Z.$$arity=0,Z));g=c(this,"map",[],(T=function(){var C=H(D,"Opal").$destructure(arguments);return[a.yield1(Q,C),C]},T.$$s=this,T.$$arity=0,T));c(g,"sort!",[],(fa=function(C,N){null==C&&(C=p);null==N&&(N=p);return C[0]["$<=>"](N[0])},fa.$$s=this,fa.$$arity=2,fa));return c(g,"map!",[],(la=function(C){null==C&&(C=p);return C[1]},la.$$s=this,la.$$arity=1,la))},Xa.$$arity=0);a.def(e,"$sum",bb=function(Y){var Q,Z=bb.$$p,T=Z||p,fa=p;Z&&(bb.$$p=null);null==Y&&(Y=0);fa=Y;c(this,"each",[],(Q=function(la){var g= -a.slice.call(arguments,0,arguments.length);g=T!==p?a.yieldX(T,a.to_a(g)):H(D,"Opal").$destructure(g);return fa=J(fa,g)},Q.$$s=this,Q.$$arity=-1,Q));return fa},bb.$$arity=-1);a.def(e,"$take",Aa=function(Y){return this.$first(Y)},Aa.$$arity=1);a.def(e,"$take_while",ta=function(){try{var Y=ta.$$p,Q=Y||p,Z,T=p;Y&&(ta.$$p=null);Y&&(ta.$$p=null);if(!k(Q))return this.$enum_for("take_while");T=[];return c(this,"each",[],(Z=function(fa){var la=a.slice.call(arguments,0,arguments.length);la=H(D,"Opal").$destructure(la); -k(a.yield1(Q,la))||a.ret(T);return T.push(la)},Z.$$s=this,Z.$$arity=-1,Z))}catch(fa){if(fa===a.returner)return fa.$v;throw fa;}},ta.$$arity=0);a.def(e,"$uniq",Ma=function(){var Y=Ma.$$p,Q=Y||p,Z,T=p;Y&&(Ma.$$p=null);Y&&(Ma.$$p=null);T=l([],{});c(this,"each",[],(Z=function(fa){var la=a.slice.call(arguments,0,arguments.length);la=H(D,"Opal").$destructure(la);var g=Q!==p?a.yield1(Q,la):la;if(k(T["$key?"](g)))return p;la=[g,la];c(T,"[]=",a.to_a(la));return la[t(la.length,1)]},Z.$$s=this,Z.$$arity=-1, -Z));return T.$values()},Ma.$$arity=0);a.def(e,"$tally",Ta=function(){return c(c(this,"group_by",[],"itself".$to_proc()),"transform_values",[],"count".$to_proc())},Ta.$$arity=0);a.alias(e,"to_a","entries");a.def(e,"$to_h",Za=function(Y){var Q=Za.$$p,Z=Q||p,T=this;Q&&(Za.$$p=null);Q&&(Za.$$p=null);Q=a.slice.call(arguments,0,arguments.length);if(Z!==p)return c(c(T,"map",[],Z.$to_proc()),"to_h",a.to_a(Q));var fa=l([],{});T.$each.$$p=function(){var la=H(D,"Opal").$destructure(arguments);la=H(D,"Opal")["$coerce_to?"](la, -H(D,"Array"),"to_ary");la.$$is_array||T.$raise(H(D,"TypeError"),"wrong element type "+la.$class()+" (expected array)");2!==la.length&&T.$raise(H(D,"ArgumentError"),"wrong array length (expected 2, was "+la.$length()+")");a.hash_put(fa,la[0],la[1])};T.$each.apply(T,Q);return fa},Za.$$arity=-1);a.def(e,"$zip",Fa=function(Y){var Q=Fa.$$p;Q&&(Fa.$$p=null);Q&&(Fa.$$p=null);Q=a.slice.call(arguments,0,arguments.length);return c(this.$to_a(),"zip",a.to_a(Q))},Fa.$$arity=-1)}(z[0],z)}; +0,Z));var T=[];this.$each.$$p=function(){var ea=H(D,"Opal").$destructure(arguments),la=a.yield1(Q,ea);k(la)&&T.push(ea)};this.$each();return T},na.$$arity=0);a.alias(e,"filter","find_all");a.def(e,"$find_index",S=function(Y){try{var Q=S.$$p,Z=Q||p,T,ea,la=p;Q&&(S.$$p=null);Q&&(S.$$p=null);if(k(void 0===Y&&Z===p))return this.$enum_for("find_index");null!=Y&&Z!==p&&this.$warn("warning: given block not used");la=0;k(null!=Y)?c(this,"each",[],(T=function(g){var C=a.slice.call(arguments,0,arguments.length); +H(D,"Opal").$destructure(C)["$=="](Y)&&a.ret(la);return la+=1},T.$$s=this,T.$$arity=-1,T)):c(this,"each",[],(ea=function(g){var C=a.slice.call(arguments,0,arguments.length);k(a.yieldX(Z,a.to_a(C)))&&a.ret(la);return la+=1},ea.$$s=this,ea.$$arity=-1,ea));return p}catch(g){if(g===a.returner)return g.$v;throw g;}},S.$$arity=-1);a.def(e,"$first",sa=function(Y){try{var Q,Z,T=p,ea=p;if(k(void 0===Y))return c(this,"each",[],(Q=function(la){null==la&&(la=p);a.ret(la)},Q.$$s=this,Q.$$arity=1,Q));T=[];Y=m(Y, +H(D,"Integer"),"to_int");k(0>Y)&&this.$raise(H(D,"ArgumentError"),"attempt to take negative size");if(k(0==Y))return[];ea=0;c(this,"each",[],(Z=function(la){var g=a.slice.call(arguments,0,arguments.length);T.push(H(D,"Opal").$destructure(g));if(k(Y<=++ea))a.ret(T);else return p},Z.$$s=this,Z.$$arity=-1,Z));return T}catch(la){if(la===a.returner)return la.$v;throw la;}},sa.$$arity=-1);a.alias(e,"flat_map","collect_concat");a.def(e,"$grep",ya=function(Y){var Q=ya.$$p,Z=Q||p,T,ea=p;Q&&(ya.$$p=null);Q&& +(ya.$$p=null);ea=[];c(this,"each",[],(T=function(la){var g=a.slice.call(arguments,0,arguments.length);var C=L(g);if(!k(c(Y,"__send__",["==="].concat(a.to_a(C)))))return p;Z!==p?(k(y(g.$length(),1))&&(g=[g]),g=a.yieldX(Z,a.to_a(g))):k(w(g.$length(),1))&&(g=g["$[]"](0));return ea.$push(g)},T.$$s=this,T.$$arity=-1,T));return ea},ya.$$arity=1);a.def(e,"$grep_v",pa=function(Y){var Q=pa.$$p,Z=Q||p,T,ea=p;Q&&(pa.$$p=null);Q&&(pa.$$p=null);ea=[];c(this,"each",[],(T=function(la){var g=a.slice.call(arguments, +0,arguments.length);var C=L(g);if(k(c(Y,"__send__",["==="].concat(a.to_a(C)))))return p;Z!==p?(k(y(g.$length(),1))&&(g=[g]),g=a.yieldX(Z,a.to_a(g))):k(w(g.$length(),1))&&(g=g["$[]"](0));return ea.$push(g)},T.$$s=this,T.$$arity=-1,T));return ea},pa.$$arity=1);a.def(e,"$group_by",ha=function(){var Y=ha.$$p,Q=Y||p,Z,T=p,ea=p,la=p;Y&&(ha.$$p=null);Y&&(ha.$$p=null);if(Q===p)return c(this,"enum_for",["group_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z)); +T=l([],{});this.$each.$$p=function(){var g=H(D,"Opal").$destructure(arguments),C=a.yield1(Q,g);k(ea=T["$[]"](C))?C=ea:(la=[C,[]],c(T,"[]=",a.to_a(la)),C=la[t(la.length,1)]);C["$<<"](g)};this.$each();return T},ha.$$arity=0);a.def(e,"$include?",F=function(Y){try{var Q;c(this,"each",[],(Q=function(Z){var T=a.slice.call(arguments,0,arguments.length);if(H(D,"Opal").$destructure(T)["$=="](Y))a.ret(!0);else return p},Q.$$s=this,Q.$$arity=-1,Q));return!1}catch(Z){if(Z===a.returner)return Z.$v;throw Z;}}, +F.$$arity=1);a.def(e,"$inject",V=function(Y,Q){var Z=V.$$p,T=Z||p;Z&&(V.$$p=null);Z&&(V.$$p=null);var ea=Y;T!==p&&void 0===Q?this.$each.$$p=function(){var la=H(D,"Opal").$destructure(arguments);void 0!==ea&&(la=a.yieldX(T,[ea,la]));ea=la}:(void 0===Q&&(H(D,"Symbol")["$==="](Y)||this.$raise(H(D,"TypeError"),""+Y.$inspect()+" is not a Symbol"),Q=Y,ea=void 0),this.$each.$$p=function(){var la=H(D,"Opal").$destructure(arguments);ea=void 0===ea?la:ea.$__send__(Q,la)});this.$each();return void 0==ea?p:ea}, +V.$$arity=-1);a.def(e,"$lazy",ka=function(){var Y;return c(d(H(D,"Enumerator"),"Lazy"),"new",[this,this.$enumerator_size()],(Y=function(Q,Z){null==Q&&(Q=p);var T=a.slice.call(arguments,1,arguments.length);return c(Q,"yield",a.to_a(T))},Y.$$s=this,Y.$$arity=-2,Y))},ka.$$arity=0);a.def(e,"$enumerator_size",va=function(){return k(this["$respond_to?"]("size"))?this.$size():p},va.$$arity=0);a.alias(e,"map","collect");a.def(e,"$max",ja=function(Y){var Q=ja.$$p,Z=Q||p,T=this;Q&&(ja.$$p=null);Q&&(ja.$$p= +null);if(void 0===Y||Y===p){var ea,la;T.$each.$$p=function(){var g=H(D,"Opal").$destructure(arguments);void 0===ea?ea=g:(la=Z!==p?a.yieldX(Z,[g,ea]):g["$<=>"](ea),la===p&&T.$raise(H(D,"ArgumentError"),"comparison failed"),0"](la)&&(ea=g,la=C)};this.$each();return void 0===ea?p:ea},xa.$$arity=-1);a.alias(e,"member?","include?");a.def(e,"$min",Ha=function(Y){var Q=Ha.$$p,Z=Q||p,T,ea=this;Q&&(Ha.$$p= +null);Q&&(Ha.$$p=null);null==Y&&(Y=p);if(!k(Y["$nil?"]()))return Z!==p?c(ea,"sort",[],(T=function(g,C){null==g&&(g=p);null==C&&(C=p);return a.yieldX(Z,[g,C])},T.$$s=ea,T.$$arity=2,T)).$take(Y):ea.$sort().$take(Y);var la;ea.$each.$$p=Z!==p?function(){var g=H(D,"Opal").$destructure(arguments);if(void 0===la)la=g;else{var C=Z(g,la);C===p&&ea.$raise(H(D,"ArgumentError"),"comparison failed");0>C&&(la=g)}}:function(){var g=H(D,"Opal").$destructure(arguments);void 0===la?la=g:0>H(D,"Opal").$compare(g,la)&& +(la=g)};ea.$each();return void 0===la?p:la},Ha.$$arity=-1);a.def(e,"$min_by",Ea=function(Y){var Q=Ea.$$p,Z=Q||p,T;Q&&(Ea.$$p=null);Q&&(Ea.$$p=null);null==Y&&(Y=p);if(!k(Z))return c(this,"enum_for",["min_by",Y],(T=function(){return(null==T.$$s?this:T.$$s).$enumerator_size()},T.$$s=this,T.$$arity=0,T));if(!k(Y["$nil?"]()))return c(this,"sort_by",[],Z.$to_proc()).$take(Y);var ea,la;this.$each.$$p=function(){var g=H(D,"Opal").$destructure(arguments),C=a.yield1(Z,g);void 0===ea?(ea=g,la=C):0>C["$<=>"](la)&& +(ea=g,la=C)};this.$each();return void 0===ea?p:ea},Ea.$$arity=-1);a.def(e,"$minmax",Qa=function(){var Y=Qa.$$p,Q=Y||p,Z,T=this,ea=p;Y&&(Qa.$$p=null);Y&&(Qa.$$p=null);Q=function(){return k(ea=Q)?ea:c(T,"proc",[],(Z=function(N,aa){null==N&&(N=p);null==aa&&(aa=p);return N["$<=>"](aa)},Z.$$s=T,Z.$$arity=2,Z))}();var la=p,g=p,C=!0;T.$each.$$p=function(){var N=H(D,"Opal").$destructure(arguments);if(C)la=g=N,C=!1;else{var aa=Q.$call(la,N);aa===p?T.$raise(H(D,"ArgumentError"),"comparison failed"):0aa&&(g=N)}};T.$each();return[la,g]},Qa.$$arity=0);a.def(e,"$minmax_by",Ra=function(){var Y=Ra.$$p,Q=Y||p,Z;Y&&(Ra.$$p=null);Y&&(Ra.$$p=null);if(!k(Q))return c(this,"enum_for",["minmax_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var T=p,ea=p,la,g;this.$each.$$p=function(){var C=H(D,"Opal").$destructure(arguments),N=a.yield1(Q,C);if(void 0===la||0>N["$<=>"](la))T=C,la= +N;if(void 0===g||0"](g))ea=C,g=N};this.$each();return[T,ea]},Ra.$$arity=0);a.def(e,"$none?",Ia=function(Y){try{var Q=Ia.$$p,Z=Q||p,T,ea,la;Q&&(Ia.$$p=null);Q&&(Ia.$$p=null);k(void 0!==Y)?c(this,"each",[],(T=function(g){var C=a.slice.call(arguments,0,arguments.length);C=L(C);if(k(c(Y,"public_send",["==="].concat(a.to_a(C)))))a.ret(!1);else return p},T.$$s=this,T.$$arity=-1,T)):Z!==p?c(this,"each",[],(ea=function(g){var C=a.slice.call(arguments,0,arguments.length);if(k(a.yieldX(Z,a.to_a(C))))a.ret(!1); +else return p},ea.$$s=this,ea.$$arity=-1,ea)):c(this,"each",[],(la=function(g){var C=a.slice.call(arguments,0,arguments.length);C=H(D,"Opal").$destructure(C);if(k(C))a.ret(!1);else return p},la.$$s=this,la.$$arity=-1,la));return!0}catch(g){if(g===a.returner)return g.$v;throw g;}},Ia.$$arity=-1);a.def(e,"$one?",kb=function(Y){try{var Q=kb.$$p,Z=Q||p,T,ea,la,g=p;Q&&(kb.$$p=null);Q&&(kb.$$p=null);g=0;k(void 0!==Y)?c(this,"each",[],(T=function(C){var N=a.slice.call(arguments,0,arguments.length);N=L(N); +if(k(c(Y,"public_send",["==="].concat(a.to_a(N)))))if(g=J(g,1),k(y(g,1)))a.ret(!1);else return p;else return p},T.$$s=this,T.$$arity=-1,T)):Z!==p?c(this,"each",[],(ea=function(C){var N=a.slice.call(arguments,0,arguments.length);if(!k(a.yieldX(Z,a.to_a(N))))return p;g=J(g,1);if(k(y(g,1)))a.ret(!1);else return p},ea.$$s=this,ea.$$arity=-1,ea)):c(this,"each",[],(la=function(C){var N=a.slice.call(arguments,0,arguments.length);if(!k(H(D,"Opal").$destructure(N)))return p;g=J(g,1);if(k(y(g,1)))a.ret(!1); +else return p},la.$$s=this,la.$$arity=-1,la));return g["$=="](1)}catch(C){if(C===a.returner)return C.$v;throw C;}},kb.$$arity=-1);a.def(e,"$partition",Sa=function(){var Y=Sa.$$p,Q=Y||p,Z;Y&&(Sa.$$p=null);Y&&(Sa.$$p=null);if(Q===p)return c(this,"enum_for",["partition"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var T=[],ea=[];this.$each.$$p=function(){var la=H(D,"Opal").$destructure(arguments),g=a.yield1(Q,la);k(g)?T.push(la):ea.push(la)};this.$each(); +return[T,ea]},Sa.$$arity=0);a.alias(e,"reduce","inject");a.def(e,"$reject",W=function(){var Y=W.$$p,Q=Y||p,Z;Y&&(W.$$p=null);Y&&(W.$$p=null);if(Q===p)return c(this,"enum_for",["reject"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var T=[];this.$each.$$p=function(){var ea=H(D,"Opal").$destructure(arguments),la=a.yield1(Q,ea);x(la)&&T.push(ea)};this.$each();return T},W.$$arity=0);a.def(e,"$reverse_each",za=function(){var Y=za.$$p,Q=Y||p,Z;Y&&(za.$$p=null); +Y&&(za.$$p=null);if(Q===p)return c(this,"enum_for",["reverse_each"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var T=[];this.$each.$$p=function(){T.push(arguments)};this.$each();for(Y=T.length-1;0<=Y;Y--)a.yieldX(Q,T[Y]);return T},za.$$arity=0);a.alias(e,"select","find_all");a.def(e,"$slice_before",Da=function(Y){var Q=Da.$$p,Z=Q||p,T;Q&&(Da.$$p=null);Q&&(Da.$$p=null);k(void 0===Y&&Z===p)&&this.$raise(H(D,"ArgumentError"),"both pattern and block are given"); +k(void 0!==Y&&Z!==p||1"](la)},Z.$$s=this,Z.$$arity=2,Z)));return c(T,"sort",[],Q.$to_proc())},db.$$arity=0);a.def(e,"$sort_by",bb=function(){var Y=bb.$$p,Q=Y||p,Z,T,ea,la,g=p;Y&&(bb.$$p=null);Y&&(bb.$$p=null);if(Q===p)return c(this,"enum_for",["sort_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()}, +Z.$$s=this,Z.$$arity=0,Z));g=c(this,"map",[],(T=function(){var C=H(D,"Opal").$destructure(arguments);return[a.yield1(Q,C),C]},T.$$s=this,T.$$arity=0,T));c(g,"sort!",[],(ea=function(C,N){null==C&&(C=p);null==N&&(N=p);return C[0]["$<=>"](N[0])},ea.$$s=this,ea.$$arity=2,ea));return c(g,"map!",[],(la=function(C){null==C&&(C=p);return C[1]},la.$$s=this,la.$$arity=1,la))},bb.$$arity=0);a.def(e,"$sum",Xa=function(Y){var Q,Z=Xa.$$p,T=Z||p,ea=p;Z&&(Xa.$$p=null);null==Y&&(Y=0);ea=Y;c(this,"each",[],(Q=function(la){var g= +a.slice.call(arguments,0,arguments.length);g=T!==p?a.yieldX(T,a.to_a(g)):H(D,"Opal").$destructure(g);return ea=J(ea,g)},Q.$$s=this,Q.$$arity=-1,Q));return ea},Xa.$$arity=-1);a.def(e,"$take",Aa=function(Y){return this.$first(Y)},Aa.$$arity=1);a.def(e,"$take_while",ta=function(){try{var Y=ta.$$p,Q=Y||p,Z,T=p;Y&&(ta.$$p=null);Y&&(ta.$$p=null);if(!k(Q))return this.$enum_for("take_while");T=[];return c(this,"each",[],(Z=function(ea){var la=a.slice.call(arguments,0,arguments.length);la=H(D,"Opal").$destructure(la); +k(a.yield1(Q,la))||a.ret(T);return T.push(la)},Z.$$s=this,Z.$$arity=-1,Z))}catch(ea){if(ea===a.returner)return ea.$v;throw ea;}},ta.$$arity=0);a.def(e,"$uniq",Ma=function(){var Y=Ma.$$p,Q=Y||p,Z,T=p;Y&&(Ma.$$p=null);Y&&(Ma.$$p=null);T=l([],{});c(this,"each",[],(Z=function(ea){var la=a.slice.call(arguments,0,arguments.length);la=H(D,"Opal").$destructure(la);var g=Q!==p?a.yield1(Q,la):la;if(k(T["$key?"](g)))return p;la=[g,la];c(T,"[]=",a.to_a(la));return la[t(la.length,1)]},Z.$$s=this,Z.$$arity=-1, +Z));return T.$values()},Ma.$$arity=0);a.def(e,"$tally",Ta=function(){return c(c(this,"group_by",[],"itself".$to_proc()),"transform_values",[],"count".$to_proc())},Ta.$$arity=0);a.alias(e,"to_a","entries");a.def(e,"$to_h",Za=function(Y){var Q=Za.$$p,Z=Q||p,T=this;Q&&(Za.$$p=null);Q&&(Za.$$p=null);Q=a.slice.call(arguments,0,arguments.length);if(Z!==p)return c(c(T,"map",[],Z.$to_proc()),"to_h",a.to_a(Q));var ea=l([],{});T.$each.$$p=function(){var la=H(D,"Opal").$destructure(arguments);la=H(D,"Opal")["$coerce_to?"](la, +H(D,"Array"),"to_ary");la.$$is_array||T.$raise(H(D,"TypeError"),"wrong element type "+la.$class()+" (expected array)");2!==la.length&&T.$raise(H(D,"ArgumentError"),"wrong array length (expected 2, was "+la.$length()+")");a.hash_put(ea,la[0],la[1])};T.$each.apply(T,Q);return ea},Za.$$arity=-1);a.def(e,"$zip",Fa=function(Y){var Q=Fa.$$p;Q&&(Fa.$$p=null);Q&&(Fa.$$p=null);Q=a.slice.call(arguments,0,arguments.length);return c(this.$to_a(),"zip",a.to_a(Q))},Fa.$$arity=-1)}(z[0],z)}; Opal.modules["corelib/enumerator"]=function(a){function y(I,e){return"number"===typeof I&&"number"===typeof e?I+e:I["$+"](e)}function J(I,e){return"number"===typeof I&&"number"===typeof e?I")},h.$$arity=0);(function(f,$super,A){f=u(f,$super,"Generator");var E=[f].concat(A),G,M;f.$$prototype.block=z;f.$include(p(E,"Enumerable"));a.def(f,"$initialize",G=function(){var ba=G.$$p,ua=ba||z;ba&&(G.$$p=null);ba&&(G.$$p=null);k(ua)||this.$raise(p(E,"LocalJumpError"),"no block given");return this.block=ua},G.$$arity=0);return(a.def(f,"$each",M=function(ba){var ua=M.$$p, -Oa=ua||z;ua&&(M.$$p=null);ua&&(M.$$p=null);ua=a.slice.call(arguments,0,arguments.length);Oa=c(p(E,"Yielder"),"new",[],Oa.$to_proc());try{ua.unshift(Oa),a.yieldX(this.block,ua)}catch(xa){if(xa===d)return d.$v;throw xa;}return this},M.$$arity=-1),z)&&"each"})(L[0],null,L);(function(f,$super,A){f=u(f,$super,"Yielder");[f].concat(A);var E,G,M;f.$$prototype.block=z;a.def(f,"$initialize",E=function(){var ba=E.$$p,ua=ba||z;ba&&(E.$$p=null);ba&&(E.$$p=null);return this.block=ua},E.$$arity=0);a.def(f,"$yield", -G=function(ba){var ua=a.slice.call(arguments,0,arguments.length);ua=a.yieldX(this.block,ua);if(ua===d)throw d;return ua},G.$$arity=-1);return(a.def(f,"$<<",M=function(ba){var ua=a.slice.call(arguments,0,arguments.length);c(this,"yield",a.to_a(ua));return this},M.$$arity=-1),z)&&"<<"})(L[0],null,L);(function(f,$super,A){f=u(f,$super,"Lazy");var E=[f].concat(A),G,M,ba,ua,Oa,xa,Ba,La,na,S,sa,ya,pa;f.$$prototype.enumerator=z;(function(ea,$super,V){[u(ea,$super,"StopLazyError")].concat(V);return z})(E[0], -p(E,"Exception"),E);a.def(f,"$initialize",G=function(ea,F){var V=G.$$p,ka=V||z,va;V&&(G.$$p=null);V&&(G.$$p=null);null==F&&(F=z);ka===z&&this.$raise(p(E,"ArgumentError"),"tried to call lazy new without a block");this.enumerator=ea;return l(this,a.find_super_dispatcher(this,"initialize",G,!1,!0),"initialize",[F],(va=function(ia,wa){var Ha=null==va.$$s?this:va.$$s,Ea;null==ia&&(ia=z);var Qa=a.slice.call(arguments,1,arguments.length);try{return c(ea,"each",a.to_a(Qa),(Ea=function(Sa){var Ia=a.slice.call(arguments, -0,arguments.length);Ia.unshift(ia);a.yieldX(ka,Ia)},Ea.$$s=Ha,Ea.$$arity=-1,Ea))}catch(Sa){if(a.rescue(Sa,[p(E,"Exception")]))try{return z}finally{a.pop_exception()}else throw Sa;}},va.$$s=this,va.$$arity=-2,va))},G.$$arity=-2);a.alias(f,"force","to_a");a.def(f,"$lazy",M=function(){return this},M.$$arity=0);a.def(f,"$collect",ba=function(){var ea=ba.$$p,F=ea||z,V;ea&&(ba.$$p=null);ea&&(ba.$$p=null);k(F)||this.$raise(p(E,"ArgumentError"),"tried to call lazy map without a block");return c(p(E,"Lazy"), -"new",[this,this.$enumerator_size()],(V=function(ka,va){null==ka&&(ka=z);var ia=a.slice.call(arguments,1,arguments.length);ia=a.yieldX(F,ia);ka.$yield(ia)},V.$$s=this,V.$$arity=-2,V))},ba.$$arity=0);a.def(f,"$collect_concat",ua=function(){var ea=ua.$$p,F=ea||z,V;ea&&(ua.$$p=null);ea&&(ua.$$p=null);k(F)||this.$raise(p(E,"ArgumentError"),"tried to call lazy map without a block");return c(p(E,"Lazy"),"new",[this,z],(V=function(ka,va){var ia=null==V.$$s?this:V.$$s,wa,Ha;null==ka&&(ka=z);var Ea=a.slice.call(arguments, -1,arguments.length);Ea=a.yieldX(F,Ea);Ea["$respond_to?"]("force")&&Ea["$respond_to?"]("each")?c(Ea,"each",[],(wa=function(Qa){null==Qa&&(Qa=z);return ka.$yield(Qa)},wa.$$s=ia,wa.$$arity=1,wa)):p(E,"Opal").$try_convert(Ea,p(E,"Array"),"to_ary")===z?ka.$yield(Ea):c(Ea,"each",[],(Ha=function(Qa){null==Qa&&(Qa=z);return ka.$yield(Qa)},Ha.$$s=ia,Ha.$$arity=1,Ha))},V.$$s=this,V.$$arity=-2,V))},ua.$$arity=0);a.def(f,"$drop",Oa=function(ea){var F,V=z,ka=V=z;ea=m(ea,p(E,"Integer"),"to_int");k(J(ea,0))&&this.$raise(p(E, -"ArgumentError"),"attempt to drop negative size");V=this.$enumerator_size();V=k(p(E,"Integer")["$==="](V))?k(J(ea,V))?ea:V:V;ka=0;return c(p(E,"Lazy"),"new",[this,V],(F=function(va,ia){null==va&&(va=z);var wa=a.slice.call(arguments,1,arguments.length);return k(J(ka,ea))?ka=y(ka,1):c(va,"yield",a.to_a(wa))},F.$$s=this,F.$$arity=-2,F))},Oa.$$arity=1);a.def(f,"$drop_while",xa=function(){var ea=xa.$$p,F=ea||z,V,ka=z;ea&&(xa.$$p=null);ea&&(xa.$$p=null);k(F)||this.$raise(p(E,"ArgumentError"),"tried to call lazy drop_while without a block"); -ka=!0;return c(p(E,"Lazy"),"new",[this,z],(V=function(va,ia){null==va&&(va=z);var wa=a.slice.call(arguments,1,arguments.length);if(k(ka)){var Ha=a.yieldX(F,wa);x(Ha)&&(ka=!1,c(va,"yield",a.to_a(wa)))}else return c(va,"yield",a.to_a(wa))},V.$$s=this,V.$$arity=-2,V))},xa.$$arity=0);a.def(f,"$enum_for",Ba=function(ea,F){var V=Ba.$$p,ka=V||z;V&&(Ba.$$p=null);V&&(Ba.$$p=null);V=a.slice.call(arguments,0,arguments.length);if(0"},pa.$$arity=0),z)&&"inspect"})(L[0],I,L);return function(f,$super,A){[u(f,$super,"ArithmeticSequence")].concat(A);return z}(L[0],I,L)}(w[0],null,w)}; Opal.modules["corelib/numeric"]=function(a){function y(c,l){return"number"===typeof c&&"number"===typeof l?c-l:c["$-"](l)}function J(c,l){return"number"===typeof c&&"number"===typeof l?c*l:c["$*"](l)}function t(c,l){return"number"===typeof c&&"number"===typeof l?c".split(" ")); -z.$require("corelib/comparable");return function(c,$super,I){c=k(c,$super,"Numeric");var e=[c].concat(I),n,L,D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,xa,Ba,La,na,S,sa,ya,pa,ea,F,V,ka,va,ia,wa,Ha,Ea,Qa,Sa;c.$include(x(e,"Comparable"));a.def(c,"$coerce",n=function(Ia){return m(Ia["$instance_of?"](this.$class()))?[Ia,this]:[this.$Float(Ia),this.$Float(this)]},n.$$arity=1);a.def(c,"$__coerced__",L=function(Ia,kb){if(m(kb["$respond_to?"]("coerce"))){kb=kb.$coerce(this);var Ra=a.to_ary(kb);var W=null==Ra[0]? -d:Ra[0];Ra=null==Ra[1]?d:Ra[1];kb;return W.$__send__(Ia,Ra)}return"+"["$==="](Ia)||"-"["$==="](Ia)||"*"["$==="](Ia)||"/"["$==="](Ia)||"%"["$==="](Ia)||"&"["$==="](Ia)||"|"["$==="](Ia)||"^"["$==="](Ia)||"**"["$==="](Ia)?this.$raise(x(e,"TypeError"),""+kb.$class()+" can't be coerced into Numeric"):">"["$==="](Ia)||">="["$==="](Ia)||"<"["$==="](Ia)||"<="["$==="](Ia)||"<=>"["$==="](Ia)?this.$raise(x(e,"ArgumentError"),"comparison of "+this.$class()+" with "+kb.$class()+" failed"):d},L.$$arity=2);a.def(c, -"$<=>",D=function(Ia){return m(this["$equal?"](Ia))?0:d},D.$$arity=1);a.def(c,"$+@",R=function(){return this},R.$$arity=0);a.def(c,"$-@",ja=function(){return y(0,this)},ja.$$arity=0);a.def(c,"$%",da=function(Ia){return y(this,J(Ia,this.$div(Ia)))},da.$$arity=1);a.def(c,"$abs",ma=function(){return t(this,0)?this["$-@"]():this},ma.$$arity=0);a.def(c,"$abs2",b=function(){return J(this,this)},b.$$arity=0);a.def(c,"$angle",h=function(){return t(this,0)?H(x(e,"Math"),"PI"):0},h.$$arity=0);a.alias(c,"arg", +z.$require("corelib/comparable");return function(c,$super,I){c=k(c,$super,"Numeric");var e=[c].concat(I),n,L,D,R,ia,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,wa,Ba,La,na,S,sa,ya,pa,ha,F,V,ka,va,ja,xa,Ha,Ea,Qa,Ra;c.$include(x(e,"Comparable"));a.def(c,"$coerce",n=function(Ia){return m(Ia["$instance_of?"](this.$class()))?[Ia,this]:[this.$Float(Ia),this.$Float(this)]},n.$$arity=1);a.def(c,"$__coerced__",L=function(Ia,kb){if(m(kb["$respond_to?"]("coerce"))){kb=kb.$coerce(this);var Sa=a.to_ary(kb);var W=null==Sa[0]? +d:Sa[0];Sa=null==Sa[1]?d:Sa[1];kb;return W.$__send__(Ia,Sa)}return"+"["$==="](Ia)||"-"["$==="](Ia)||"*"["$==="](Ia)||"/"["$==="](Ia)||"%"["$==="](Ia)||"&"["$==="](Ia)||"|"["$==="](Ia)||"^"["$==="](Ia)||"**"["$==="](Ia)?this.$raise(x(e,"TypeError"),""+kb.$class()+" can't be coerced into Numeric"):">"["$==="](Ia)||">="["$==="](Ia)||"<"["$==="](Ia)||"<="["$==="](Ia)||"<=>"["$==="](Ia)?this.$raise(x(e,"ArgumentError"),"comparison of "+this.$class()+" with "+kb.$class()+" failed"):d},L.$$arity=2);a.def(c, +"$<=>",D=function(Ia){return m(this["$equal?"](Ia))?0:d},D.$$arity=1);a.def(c,"$+@",R=function(){return this},R.$$arity=0);a.def(c,"$-@",ia=function(){return y(0,this)},ia.$$arity=0);a.def(c,"$%",da=function(Ia){return y(this,J(Ia,this.$div(Ia)))},da.$$arity=1);a.def(c,"$abs",ma=function(){return t(this,0)?this["$-@"]():this},ma.$$arity=0);a.def(c,"$abs2",b=function(){return J(this,this)},b.$$arity=0);a.def(c,"$angle",h=function(){return t(this,0)?H(x(e,"Math"),"PI"):0},h.$$arity=0);a.alias(c,"arg", "angle");a.def(c,"$ceil",f=function(Ia){null==Ia&&(Ia=0);return this.$to_f().$ceil(Ia)},f.$$arity=-1);a.def(c,"$conj",q=function(){return this},q.$$arity=0);a.alias(c,"conjugate","conj");a.def(c,"$denominator",A=function(){return this.$to_r().$denominator()},A.$$arity=0);a.def(c,"$div",E=function(Ia){Ia["$=="](0)&&this.$raise(x(e,"ZeroDivisionError"),"divided by o");return w(this,Ia).$floor()},E.$$arity=1);a.def(c,"$divmod",G=function(Ia){return[this.$div(Ia),this["$%"](Ia)]},G.$$arity=1);a.def(c, -"$fdiv",M=function(Ia){return w(this.$to_f(),Ia)},M.$$arity=1);a.def(c,"$floor",ba=function(Ia){null==Ia&&(Ia=0);return this.$to_f().$floor(Ia)},ba.$$arity=-1);a.def(c,"$i",ua=function(){return this.$Complex(0,this)},ua.$$arity=0);a.def(c,"$imag",Oa=function(){return 0},Oa.$$arity=0);a.alias(c,"imaginary","imag");a.def(c,"$integer?",xa=function(){return!1},xa.$$arity=0);a.alias(c,"magnitude","abs");a.alias(c,"modulo","%");a.def(c,"$nonzero?",Ba=function(){return m(this["$zero?"]())?d:this},Ba.$$arity= +"$fdiv",M=function(Ia){return w(this.$to_f(),Ia)},M.$$arity=1);a.def(c,"$floor",ba=function(Ia){null==Ia&&(Ia=0);return this.$to_f().$floor(Ia)},ba.$$arity=-1);a.def(c,"$i",ua=function(){return this.$Complex(0,this)},ua.$$arity=0);a.def(c,"$imag",Oa=function(){return 0},Oa.$$arity=0);a.alias(c,"imaginary","imag");a.def(c,"$integer?",wa=function(){return!1},wa.$$arity=0);a.alias(c,"magnitude","abs");a.alias(c,"modulo","%");a.def(c,"$nonzero?",Ba=function(){return m(this["$zero?"]())?d:this},Ba.$$arity= 0);a.def(c,"$numerator",La=function(){return this.$to_r().$numerator()},La.$$arity=0);a.alias(c,"phase","arg");a.def(c,"$polar",na=function(){return[this.$abs(),this.$arg()]},na.$$arity=0);a.def(c,"$quo",S=function(Ia){return w(x(e,"Opal")["$coerce_to!"](this,x(e,"Rational"),"to_r"),Ia)},S.$$arity=1);a.def(c,"$real",sa=function(){return this},sa.$$arity=0);a.def(c,"$real?",ya=function(){return!0},ya.$$arity=0);a.def(c,"$rect",pa=function(){return[this,0]},pa.$$arity=0);a.alias(c,"rectangular","rect"); -a.def(c,"$round",ea=function(Ia){return this.$to_f().$round(Ia)},ea.$$arity=-1);a.def(c,"$to_c",F=function(){return this.$Complex(this,0)},F.$$arity=0);a.def(c,"$to_int",V=function(){return this.$to_i()},V.$$arity=0);a.def(c,"$truncate",ka=function(Ia){null==Ia&&(Ia=0);return this.$to_f().$truncate(Ia)},ka.$$arity=-1);a.def(c,"$zero?",va=function(){return this["$=="](0)},va.$$arity=0);a.def(c,"$positive?",ia=function(){return"number"===typeof this?0"](0)},ia.$$arity=0);a.def(c,"$negative?", -wa=function(){return t(this,0)},wa.$$arity=0);a.def(c,"$dup",Ha=function(){return this},Ha.$$arity=0);a.def(c,"$clone",Ea=function(Ia){if(null==Ia)u([],{});else if(!Ia.$$is_hash)throw a.ArgumentError.$new("expected kwargs");return this},Ea.$$arity=-1);a.def(c,"$finite?",Qa=function(){return!0},Qa.$$arity=0);return(a.def(c,"$infinite?",Sa=function(){return d},Sa.$$arity=0),d)&&"infinite?"}(p[0],null,p)}; -Opal.modules["corelib/array"]=function(a){function y(ja,da){return"number"===typeof ja&&"number"===typeof da?ja>da:ja["$>"](da)}var J=a.top,t=[],w=a.nil,z=a.$$$,p=a.$$,d=a.truthy,H=a.falsy,x=a.hash_ids,k=a.yield1,m=a.hash_get,u=a.hash_put,c=a.hash_delete,l=a.coerce_to,I=a.respond_to,e=a.klass,n=a.hash2,L=a.send2,D=a.send,R=a.gvars;a.add_stubs("$require $include $to_a $warn $raise $replace $respond_to? $to_ary $coerce_to? $=== $join $to_str $class $hash $<=> $== $object_id $inspect $enum_for $bsearch_index $to_proc $nil? $coerce_to! $> $* $enumerator_size $empty? $size $map $equal? $dup $each $[] $dig $eql? $length $exclude_end? $flatten $__id__ $to_s $new $max $min $! $>= $** $delete_if $reverse $rotate $rand $at $keep_if $shuffle! $< $sort $sort_by $!= $times $[]= $- $<< $values $is_a? $last $first $upto $reject $pristine $singleton_class".split(" ")); -J.$require("corelib/enumerable");J.$require("corelib/numeric");return function(ja,$super,ma){function b(r,K){return K.$$name===a.Array?r:K.$allocate().$replace(r.$to_a())}function h(r,K,P){for(var ca,ha=null,qa=Array(r.length),Pa=0,fb=0,$a=r.length;Pa<$a;Pa++){if(!ha)try{ca=k(P,r[Pa])}catch(lb){ha=lb}if(ha||K(ca))qa[fb]=r[Pa],fb+=1}fb!==Pa&&(r.splice.apply(r,[0,qa.length].concat(qa)),r.splice(fb,qa.length));if(ha)throw ha;}function f(r,K){var P=r.length;var ca=K.excl;var ha=l(K.begin,a.Integer,"to_int"); -K=l(K.end,a.Integer,"to_int");if(0>ha&&(ha+=P,0>ha)||ha>P)return w;if(0>K&&(K+=P,0>K))return[];ca||(K+=1);P=r.slice(ha,K);return b(P,r.$class())}function q(r,K,P){var ca=r.length;K=l(K,a.Integer,"to_int");if(0>K&&(K+=ca,0>K))return w;if(void 0===P)return K>=ca||0>K?w:r[K];P=l(P,a.Integer,"to_int");if(0>P||K>ca||0>K)return w;K=r.slice(K,K+P);return b(K,r.$class())}function A(r,K){return r===K||0===K?1:0K?A(r-1,K-1)+A(r-1,K):0}var E=e(ja,$super,"Array"),G=[E].concat(ma),M,ba,ua,Oa,xa,Ba,La,na, -S,sa,ya,pa,ea,F,V,ka,va,ia,wa,Ha,Ea,Qa,Sa,Ia,kb,Ra,W,za,Ca,Va,ib,db,Xa,bb,Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T,fa,la,g,C,N,aa,v,U,oa,Ka,jb,ob,mb,sb,tb,wb,xb,ub,X,Na,cb,B,O,ra,Ga,Da,Ja,Wa,hb,eb,Ua,Ya,gb,qb,nb,pb,Gb,Ab,Jb,Bb,Kb,Cb,Db,Lb,Mb,Eb,Nb,Fb,Ob;E.$include(p(G,"Enumerable"));a.defineProperty(E.$$prototype,"$$is_array",!0);a.defs(E,"$[]",M=function(r){var K=a.slice.call(arguments,0,arguments.length);return b(K,this)},M.$$arity=-1);a.def(E,"$initialize",ba=function(r,K){var P=ba.$$p,ca=P||w;P&&(ba.$$p=null); +a.def(c,"$round",ha=function(Ia){return this.$to_f().$round(Ia)},ha.$$arity=-1);a.def(c,"$to_c",F=function(){return this.$Complex(this,0)},F.$$arity=0);a.def(c,"$to_int",V=function(){return this.$to_i()},V.$$arity=0);a.def(c,"$truncate",ka=function(Ia){null==Ia&&(Ia=0);return this.$to_f().$truncate(Ia)},ka.$$arity=-1);a.def(c,"$zero?",va=function(){return this["$=="](0)},va.$$arity=0);a.def(c,"$positive?",ja=function(){return"number"===typeof this?0"](0)},ja.$$arity=0);a.def(c,"$negative?", +xa=function(){return t(this,0)},xa.$$arity=0);a.def(c,"$dup",Ha=function(){return this},Ha.$$arity=0);a.def(c,"$clone",Ea=function(Ia){if(null==Ia)u([],{});else if(!Ia.$$is_hash)throw a.ArgumentError.$new("expected kwargs");return this},Ea.$$arity=-1);a.def(c,"$finite?",Qa=function(){return!0},Qa.$$arity=0);return(a.def(c,"$infinite?",Ra=function(){return d},Ra.$$arity=0),d)&&"infinite?"}(p[0],null,p)}; +Opal.modules["corelib/array"]=function(a){function y(ia,da){return"number"===typeof ia&&"number"===typeof da?ia>da:ia["$>"](da)}var J=a.top,t=[],w=a.nil,z=a.$$$,p=a.$$,d=a.truthy,H=a.falsy,x=a.hash_ids,k=a.yield1,m=a.hash_get,u=a.hash_put,c=a.hash_delete,l=a.coerce_to,I=a.respond_to,e=a.klass,n=a.hash2,L=a.send2,D=a.send,R=a.gvars;a.add_stubs("$require $include $to_a $warn $raise $replace $respond_to? $to_ary $coerce_to? $=== $join $to_str $class $hash $<=> $== $object_id $inspect $enum_for $bsearch_index $to_proc $nil? $coerce_to! $> $* $enumerator_size $empty? $size $map $equal? $dup $each $[] $dig $eql? $length $exclude_end? $flatten $__id__ $to_s $new $max $min $! $>= $** $delete_if $reverse $rotate $rand $at $keep_if $shuffle! $< $sort $sort_by $!= $times $[]= $- $<< $values $is_a? $last $first $upto $reject $pristine $singleton_class".split(" ")); +J.$require("corelib/enumerable");J.$require("corelib/numeric");return function(ia,$super,ma){function b(r,K){return K.$$name===a.Array?r:K.$allocate().$replace(r.$to_a())}function h(r,K,P){for(var ca,fa=null,qa=Array(r.length),Pa=0,fb=0,$a=r.length;Pa<$a;Pa++){if(!fa)try{ca=k(P,r[Pa])}catch(lb){fa=lb}if(fa||K(ca))qa[fb]=r[Pa],fb+=1}fb!==Pa&&(r.splice.apply(r,[0,qa.length].concat(qa)),r.splice(fb,qa.length));if(fa)throw fa;}function f(r,K){var P=r.length;var ca=K.excl;var fa=l(K.begin,a.Integer,"to_int"); +K=l(K.end,a.Integer,"to_int");if(0>fa&&(fa+=P,0>fa)||fa>P)return w;if(0>K&&(K+=P,0>K))return[];ca||(K+=1);P=r.slice(fa,K);return b(P,r.$class())}function q(r,K,P){var ca=r.length;K=l(K,a.Integer,"to_int");if(0>K&&(K+=ca,0>K))return w;if(void 0===P)return K>=ca||0>K?w:r[K];P=l(P,a.Integer,"to_int");if(0>P||K>ca||0>K)return w;K=r.slice(K,K+P);return b(K,r.$class())}function A(r,K){return r===K||0===K?1:0K?A(r-1,K-1)+A(r-1,K):0}var E=e(ia,$super,"Array"),G=[E].concat(ma),M,ba,ua,Oa,wa,Ba,La,na, +S,sa,ya,pa,ha,F,V,ka,va,ja,xa,Ha,Ea,Qa,Ra,Ia,kb,Sa,W,za,Da,Va,ib,db,bb,Xa,Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T,ea,la,g,C,N,aa,v,U,oa,Ka,jb,ob,mb,sb,tb,wb,xb,ub,X,Na,cb,B,O,ra,Ga,Ca,Ja,Wa,hb,eb,Ua,Ya,gb,qb,nb,pb,Gb,Ab,Jb,Bb,Kb,Cb,Db,Lb,Mb,Eb,Nb,Fb,Ob;E.$include(p(G,"Enumerable"));a.defineProperty(E.$$prototype,"$$is_array",!0);a.defs(E,"$[]",M=function(r){var K=a.slice.call(arguments,0,arguments.length);return b(K,this)},M.$$arity=-1);a.def(E,"$initialize",ba=function(r,K){var P=ba.$$p,ca=P||w;P&&(ba.$$p=null); P&&(ba.$$p=null);null==r&&(r=w);null==K&&(K=w);K!==w&&ca!==w&&this.$warn("warning: block supersedes default value argument");r>z(p(G,"Integer"),"MAX")&&this.$raise(p(G,"ArgumentError"),"array size too big");2r&&this.$raise(p(G,"ArgumentError"),"negative array size");this.splice(0,this.length);if(ca===w)for(P=0;Pr)&&this.$raise(p(G, -"ArgumentError"),"negative argument");for(var K=[],P=this.$to_a(),ca=0;ca",sa=function(r){if(d(p(G,"Array")["$==="](r)))r=r.$to_a();else if(d(r["$respond_to?"]("to_ary")))r=r.$to_ary().$to_a();else return w;if(this.$hash()===r.$hash())return 0;for(var K=Math.min(this.length,r.length),P=0;P"](r[P]);if(0!==ca)return ca}return this.length["$<=>"](r.length)},sa.$$arity= -1);a.def(E,"$==",ya=function(r){function K(ca,ha){var qa;if(ca===ha)return!0;if(!ha.$$is_array)return I(ha,"$to_ary")?ha["$=="](ca):!1;ca.$$constructor!==Array&&(ca=ca.$to_a());ha.$$constructor!==Array&&(ha=ha.$to_a());if(ca.length!==ha.length)return!1;P[ca.$object_id()]=!0;var Pa=0;for(qa=ca.length;PaP&&(P+=ha,0>P&&this.$raise(p(G,"RangeError"),""+r.$inspect()+" out of range"));0>Pa&&(Pa+=ha);qa|| -(Pa+=1);if(P>ha)for(;haPa?this.splice.apply(this,[P,0].concat(ca)):this.splice.apply(this,[P,Pa-P].concat(ca))}else{d(void 0===P)?Pa=1:(Pa=K,K=P,ca=d(p(G,"Array")["$==="](K))?K.$to_a():d(K["$respond_to?"]("to_ary"))?K.$to_ary().$to_a():[K]);r=l(r,p(G,"Integer"),"to_int");Pa=l(Pa,p(G,"Integer"),"to_int");0>r&&(qa=r,r+=ha,0>r&&this.$raise(p(G,"IndexError"),"index "+qa+" too small for array; minimum "+-this.length));0>Pa&&this.$raise(p(G,"IndexError"),"negative length ("+Pa+")"); -if(r>ha)for(;har&&(r+=this.length);return 0>r||r>=this.length?w:this[r]},ka.$$arity=1);a.def(E,"$bsearch_index",va=function(){var r=va.$$p,K=r||w;r&&(va.$$p=null);r&&(va.$$p=null);if(K===w)return this.$enum_for("bsearch_index");r=0;for(var P=this.length,ca,ha,qa=!1,Pa=w;rha}else this.$raise(p(G, -"TypeError"),"wrong argument type "+ha.$class()+" (must be numeric, true, false or nil)");qa?P=ca:r=ca+1}return Pa},va.$$arity=0);a.def(E,"$bsearch",ia=function(){var r=ia.$$p,K=r||w;r&&(ia.$$p=null);r&&(ia.$$p=null);if(K===w)return this.$enum_for("bsearch");r=D(this,"bsearch_index",[],K.$to_proc());return null!=r&&r.$$is_number?this[r]:r},ia.$$arity=0);a.def(E,"$cycle",wa=function(r){var K=wa.$$p,P=K||w,ca,ha=w;K&&(wa.$$p=null);K&&(wa.$$p=null);null==r&&(r=w);if(P===w)return D(this,"enum_for",["cycle", -r],(ca=function(){var qa=null==ca.$$s?this:ca.$$s;if(d(r["$nil?"]()))return z(p(G,"Float"),"INFINITY");r=p(G,"Opal")["$coerce_to!"](r,p(G,"Integer"),"to_int");return d(y(r,0))?(qa=qa.$enumerator_size(),"number"===typeof qa&&"number"===typeof r?qa*r:qa["$*"](r)):0},ca.$$s=this,ca.$$arity=0,ca));if(d(d(ha=this["$empty?"]())?ha:r["$=="](0)))return w;if(r===w)for(;;)for(K=0,ha=this.length;K=r)return this;for(;0r&&(r+=this.length);if(0>r||r>= -this.length)return w;var K=this[r];this.splice(r,1);return K},ib.$$arity=1);a.def(E,"$delete_if",db=function(){var r=db.$$p,K=r||w,P;r&&(db.$$p=null);r&&(db.$$p=null);if(K===w)return D(this,"enum_for",["delete_if"],(P=function(){return(null==P.$$s?this:P.$$s).$size()},P.$$s=this,P.$$arity=0,P));h(this,H,K);return this},db.$$arity=0);a.alias(E,"difference","-");a.def(E,"$dig",Xa=function(r,K){var P=a.slice.call(arguments,1,arguments.length);var ca=this["$[]"](r);if(ca===w||0===P.length)return ca;d(ca["$respond_to?"]("dig"))|| -this.$raise(p(G,"TypeError"),""+ca.$class()+" does not have #dig method");return D(ca,"dig",a.to_a(P))},Xa.$$arity=-2);a.def(E,"$drop",bb=function(r){0>r&&this.$raise(p(G,"ArgumentError"));return this.slice(r)},bb.$$arity=1);a.def(E,"$dup",Aa=function(){var r=Aa.$$p,K;r&&(Aa.$$p=null);var P=0;var ca=arguments.length;for(K=Array(ca);Pr&&this.$raise(p(G,"ArgumentError"),"negative array size");this.splice(0,this.length);if(ca===w)for(P=0;Pr)&&this.$raise(p(G, +"ArgumentError"),"negative argument");for(var K=[],P=this.$to_a(),ca=0;ca",sa=function(r){if(d(p(G,"Array")["$==="](r)))r=r.$to_a();else if(d(r["$respond_to?"]("to_ary")))r=r.$to_ary().$to_a();else return w;if(this.$hash()===r.$hash())return 0;for(var K=Math.min(this.length,r.length),P=0;P"](r[P]);if(0!==ca)return ca}return this.length["$<=>"](r.length)},sa.$$arity= +1);a.def(E,"$==",ya=function(r){function K(ca,fa){var qa;if(ca===fa)return!0;if(!fa.$$is_array)return I(fa,"$to_ary")?fa["$=="](ca):!1;ca.$$constructor!==Array&&(ca=ca.$to_a());fa.$$constructor!==Array&&(fa=fa.$to_a());if(ca.length!==fa.length)return!1;P[ca.$object_id()]=!0;var Pa=0;for(qa=ca.length;PaP&&(P+=fa,0>P&&this.$raise(p(G,"RangeError"),""+r.$inspect()+" out of range"));0>Pa&&(Pa+=fa);qa|| +(Pa+=1);if(P>fa)for(;faPa?this.splice.apply(this,[P,0].concat(ca)):this.splice.apply(this,[P,Pa-P].concat(ca))}else{d(void 0===P)?Pa=1:(Pa=K,K=P,ca=d(p(G,"Array")["$==="](K))?K.$to_a():d(K["$respond_to?"]("to_ary"))?K.$to_ary().$to_a():[K]);r=l(r,p(G,"Integer"),"to_int");Pa=l(Pa,p(G,"Integer"),"to_int");0>r&&(qa=r,r+=fa,0>r&&this.$raise(p(G,"IndexError"),"index "+qa+" too small for array; minimum "+-this.length));0>Pa&&this.$raise(p(G,"IndexError"),"negative length ("+Pa+")"); +if(r>fa)for(;far&&(r+=this.length);return 0>r||r>=this.length?w:this[r]},ka.$$arity=1);a.def(E,"$bsearch_index",va=function(){var r=va.$$p,K=r||w;r&&(va.$$p=null);r&&(va.$$p=null);if(K===w)return this.$enum_for("bsearch_index");r=0;for(var P=this.length,ca,fa,qa=!1,Pa=w;rfa}else this.$raise(p(G, +"TypeError"),"wrong argument type "+fa.$class()+" (must be numeric, true, false or nil)");qa?P=ca:r=ca+1}return Pa},va.$$arity=0);a.def(E,"$bsearch",ja=function(){var r=ja.$$p,K=r||w;r&&(ja.$$p=null);r&&(ja.$$p=null);if(K===w)return this.$enum_for("bsearch");r=D(this,"bsearch_index",[],K.$to_proc());return null!=r&&r.$$is_number?this[r]:r},ja.$$arity=0);a.def(E,"$cycle",xa=function(r){var K=xa.$$p,P=K||w,ca,fa=w;K&&(xa.$$p=null);K&&(xa.$$p=null);null==r&&(r=w);if(P===w)return D(this,"enum_for",["cycle", +r],(ca=function(){var qa=null==ca.$$s?this:ca.$$s;if(d(r["$nil?"]()))return z(p(G,"Float"),"INFINITY");r=p(G,"Opal")["$coerce_to!"](r,p(G,"Integer"),"to_int");return d(y(r,0))?(qa=qa.$enumerator_size(),"number"===typeof qa&&"number"===typeof r?qa*r:qa["$*"](r)):0},ca.$$s=this,ca.$$arity=0,ca));if(d(d(fa=this["$empty?"]())?fa:r["$=="](0)))return w;if(r===w)for(;;)for(K=0,fa=this.length;K=r)return this;for(;0r&&(r+=this.length);if(0>r||r>= +this.length)return w;var K=this[r];this.splice(r,1);return K},ib.$$arity=1);a.def(E,"$delete_if",db=function(){var r=db.$$p,K=r||w,P;r&&(db.$$p=null);r&&(db.$$p=null);if(K===w)return D(this,"enum_for",["delete_if"],(P=function(){return(null==P.$$s?this:P.$$s).$size()},P.$$s=this,P.$$arity=0,P));h(this,H,K);return this},db.$$arity=0);a.alias(E,"difference","-");a.def(E,"$dig",bb=function(r,K){var P=a.slice.call(arguments,1,arguments.length);var ca=this["$[]"](r);if(ca===w||0===P.length)return ca;d(ca["$respond_to?"]("dig"))|| +this.$raise(p(G,"TypeError"),""+ca.$class()+" does not have #dig method");return D(ca,"dig",a.to_a(P))},bb.$$arity=-2);a.def(E,"$drop",Xa=function(r){0>r&&this.$raise(p(G,"ArgumentError"));return this.slice(r)},Xa.$$arity=1);a.def(E,"$dup",Aa=function(){var r=Aa.$$p,K;r&&(Aa.$$p=null);var P=0;var ca=arguments.length;for(K=Array(ca);Pr&&(r+=this.length);if(0<=r&&rha)&&(ha+=this.length),d(0>ha)&&this.$raise(p(G,"RangeError"),""+K.$inspect()+" out of range"), -qa=l(K.end,p(G,"Integer"),"to_int"),d(0>qa)&&(qa+=this.length),d(K["$exclude_end?"]())||(qa+=1),d(qa<=ha))return this}else if(d(K))if(ha=l(K,p(G,"Integer"),"to_int"),d(0>ha)&&(ha+=this.length),d(0>ha)&&(ha=0),d(qa)){qa=l(qa,p(G,"Integer"),"to_int");if(d(0==qa))return this;qa+=ha}else qa=this.length;else ha=0,qa=this.length;if(d(ha>this.length))for(K=this.length;Kthis.length)&&(this.length=qa);if(d(P))for(;har&&this.$raise(p(G,"ArgumentError"),"negative array size");return this.slice(0,r)},Q.$$arity=-1);a.def(E,"$flatten",Z=function(r){function K(ca,ha){var qa=[],Pa;ca=ca.$to_a();var fb=0;for(Pa=ca.length;fbfa)&&(fa+=this.length),d(0>fa)&&this.$raise(p(G,"RangeError"),""+K.$inspect()+" out of range"), +qa=l(K.end,p(G,"Integer"),"to_int"),d(0>qa)&&(qa+=this.length),d(K["$exclude_end?"]())||(qa+=1),d(qa<=fa))return this}else if(d(K))if(fa=l(K,p(G,"Integer"),"to_int"),d(0>fa)&&(fa+=this.length),d(0>fa)&&(fa=0),d(qa)){qa=l(qa,p(G,"Integer"),"to_int");if(d(0==qa))return this;qa+=fa}else qa=this.length;else fa=0,qa=this.length;if(d(fa>this.length))for(K=this.length;Kthis.length)&&(this.length=qa);if(d(P))for(;far&&this.$raise(p(G,"ArgumentError"),"negative array size");return this.slice(0,r)},Q.$$arity=-1);a.def(E,"$flatten",Z=function(r){function K(ca,fa){var qa=[],Pa;ca=ca.$to_a();var fb=0;for(Pa=ca.length;fbr&&(r+=this.length+1,0>r&&this.$raise(p(G,"IndexError"),""+r+" is out of bounds"));if(r>this.length)for(var ca=this.length;car&&this.$raise(p(G,"ArgumentError"),"negative array size");r>this.length&&(r=this.length);return this.slice(this.length-r,this.length)},U.$$arity=-1);a.def(E,"$length",oa=function(){return this.length}, -oa.$$arity=0);a.alias(E,"map","collect");a.alias(E,"map!","collect!");a.def(E,"$max",Ka=function(r){var K=Ka.$$p,P=K||w;K&&(Ka.$$p=null);K&&(Ka.$$p=null);return D(this.$each(),"max",[r],P.$to_proc())},Ka.$$arity=-1);a.def(E,"$min",jb=function(){var r=jb.$$p,K=r||w;r&&(jb.$$p=null);r&&(jb.$$p=null);return D(this.$each(),"min",[],K.$to_proc())},jb.$$arity=0);a.def(E,"$permutation",ob=function(r){var K=ob.$$p,P=K||w,ca,ha=this,qa=w,Pa=w;K&&(ob.$$p=null);K&&(ob.$$p=null);if(P===w)return D(ha,"enum_for", -["permutation",r],(ca=function(){var lb=null==ca.$$s?this:ca.$$s,vb=lb.length;lb=void 0===r?lb.length:r;for(var yb=0<=lb?1:0;lb;)yb*=vb,vb--,lb--;return yb},ca.$$s=ha,ca.$$arity=0,ca));var fb;r=void 0===r?ha.length:l(r,p(G,"Integer"),"to_int");if(!(0>r||ha.length="](0))?Pa.$size()["$**"](qa):0},P.$$s=this,P.$$arity=0,P));K(qa,[],this.slice());return this},mb.$$arity=1);a.def(E,"$pop",sb=function(r){if(d(void 0===r))return d(0===this.length)?w:this.pop();r=l(r,p(G,"Integer"),"to_int");d(0>r)&&this.$raise(p(G,"ArgumentError"),"negative array size");return d(0===this.length)?[]:d(1===r)?[this.pop()]:d(r> -this.length)?this.splice(0,this.length):this.splice(this.length-r,this.length)},sb.$$arity=-1);a.def(E,"$product",tb=function(r){var K=tb.$$p,P=K||w;K&&(tb.$$p=null);K&&(tb.$$p=null);var ca=a.slice.call(arguments,0,arguments.length);K=P!==w?null:[];var ha=ca.length+1,qa=Array(ha),Pa=Array(ha),fb=Array(ha),$a;var lb=1;fb[0]=this;for($a=1;$a--$a)break a;qa[$a]++}}return K||this},tb.$$arity=-1);a.def(E,"$push",wb=function(r){var K=a.slice.call(arguments,0,arguments.length);for(var P=0,ca=K.length;Pr||fa.length="](0))?Pa.$size()["$**"](qa):0},P.$$s=this,P.$$arity=0,P));K(qa,[],this.slice());return this},mb.$$arity=1);a.def(E,"$pop",sb=function(r){if(d(void 0===r))return d(0===this.length)?w:this.pop();r=l(r,p(G,"Integer"),"to_int");d(0>r)&&this.$raise(p(G,"ArgumentError"),"negative array size");return d(0===this.length)?[]:d(1===r)?[this.pop()]:d(r> +this.length)?this.splice(0,this.length):this.splice(this.length-r,this.length)},sb.$$arity=-1);a.def(E,"$product",tb=function(r){var K=tb.$$p,P=K||w;K&&(tb.$$p=null);K&&(tb.$$p=null);var ca=a.slice.call(arguments,0,arguments.length);K=P!==w?null:[];var fa=ca.length+1,qa=Array(fa),Pa=Array(fa),fb=Array(fa),$a;var lb=1;fb[0]=this;for($a=1;$a--$a)break a;qa[$a]++}}return K||this},tb.$$arity=-1);a.def(E,"$push",wb=function(r){var K=a.slice.call(arguments,0,arguments.length);for(var P=0,ca=K.length;P=this.length);K--){if(this[K]["$=="](r))return K}else if(P!==w)for(K=this.length-1;0<=K&&!(K>=this.length);K--){if(r=P(this[K]),!1!==r&&r!==w)return K}else if(null==r)return this.$enum_for("rindex");return w},ra.$$arity=-1);a.def(E,"$rotate",Ga=function(r){null==r&&(r=1);r=l(r,p(G,"Integer"),"to_int");if(1===this.length)return this.slice();if(0===this.length)return[];var K=this.slice();var P=r%K.length;r=K.slice(P);K=K.slice(0,P);return r.concat(K)},Ga.$$arity=-1); -a.def(E,"$rotate!",Da=function(r){null==r&&(r=1);if(0===this.length||1===this.length)return this;r=l(r,p(G,"Integer"),"to_int");r=this.$rotate(r);return this.$replace(r)},Da.$$arity=-1);(function(r,$super,P){r=e(r,$super,"SampleRandom");var ca=[r].concat(P),ha,qa;r.$$prototype.rng=w;a.def(r,"$initialize",ha=function(Pa){return this.rng=Pa},ha.$$arity=1);return(a.def(r,"$rand",qa=function(Pa){var fb=l(this.rng.$rand(Pa),p(ca,"Integer"),"to_int");d(0>fb)&&this.$raise(p(ca,"RangeError"),"random value must be >= 0"); -d(fbr:P)&&this.$raise(p(G,"ArgumentError"),"count must be greater than 0"); -d(K)&&(ca=K["$[]"]("random"));ca=d(d(ha=ca)?ca["$respond_to?"]("rand"):ha)?p(G,"SampleRandom").$new(ca):p(G,"Kernel");if(!d(r))return this[ca.$rand(this.length)];r>this.length&&(r=this.length);switch(r){case 0:return[];case 1:return[this[ca.$rand(this.length)]];case 2:var qa=ca.$rand(this.length);var Pa=ca.$rand(this.length);qa===Pa&&(Pa=0===qa?qa+1:qa-1);return[this[qa],this[Pa]];default:if(3fb)&&this.$raise(p(ca,"RangeError"),"random value must be >= 0"); +d(fbr:P)&&this.$raise(p(G,"ArgumentError"),"count must be greater than 0"); +d(K)&&(ca=K["$[]"]("random"));ca=d(d(fa=ca)?ca["$respond_to?"]("rand"):fa)?p(G,"SampleRandom").$new(ca):p(G,"Kernel");if(!d(r))return this[ca.$rand(this.length)];r>this.length&&(r=this.length);switch(r){case 0:return[];case 1:return[this[ca.$rand(this.length)]];case 2:var qa=ca.$rand(this.length);var Pa=ca.$rand(this.length);qa===Pa&&(Pa=0===qa?qa+1:qa-1);return[this[qa],this[Pa]];default:if(3r)&&this.$raise(p(G,"ArgumentError"),"negative array size");return d(0===this.length)?[]:this.splice(0,r)},eb.$$arity=-1);a.alias(E,"size","length");a.def(E,"$shuffle",Ua=function(r){return this.$dup().$to_a()["$shuffle!"](r)},Ua.$$arity=-1);a.def(E,"$shuffle!",Ya=function(r){var K,P=this.length;void 0!== r&&(r=p(G,"Opal")["$coerce_to?"](r,p(G,"Hash"),"to_hash"),r!==w&&(r=r["$[]"]("random"),r!==w&&r["$respond_to?"]("rand")&&(K=r)));for(;P;){K?(r=K.$rand(P).$to_int(),0>r&&this.$raise(p(G,"RangeError"),"random number too small "+r),r>=P&&this.$raise(p(G,"RangeError"),"random number too big "+r)):r=this.$rand(P);var ca=this[--P];this[P]=this[r];this[r]=ca}return this},Ya.$$arity=-1);a.alias(E,"slice","[]");a.def(E,"$slice!",gb=function(r,K){if(d(void 0===K))if(d(p(G,"Range")["$==="](r))){var P=this["$[]"](r); -K=l(r.begin,p(G,"Integer"),"to_int");var ca=l(r.end,p(G,"Integer"),"to_int");0>K&&(K+=this.length);0>ca?ca+=this.length:ca>=this.length&&(ca=this.length-1,r.excl&&(ca+=1));var ha=ca-K;r.excl?--ca:ha+=1;Kr&&(r+=this.length);if(0>r||r>=this.length)return w;P=this[r];0===r?this.shift():this.splice(r,1)}else{r=l(r,p(G,"Integer"),"to_int");K=l(K,p(G,"Integer"),"to_int");if(0>K)return w;P=this["$[]"](r, -K);0>r&&(r+=this.length);r+K>this.length&&(K=this.length-r);r"](ha)});return P.slice().sort(function(ca,ha){var qa=K(ca,ha);qa===w&&P.$raise(p(G,"ArgumentError"),"comparison of "+ca.$inspect()+" with "+ha.$inspect()+" failed");return y(qa,0)?1:("number"===typeof qa?0>qa:qa["$<"](0))? +K=l(r.begin,p(G,"Integer"),"to_int");var ca=l(r.end,p(G,"Integer"),"to_int");0>K&&(K+=this.length);0>ca?ca+=this.length:ca>=this.length&&(ca=this.length-1,r.excl&&(ca+=1));var fa=ca-K;r.excl?--ca:fa+=1;Kr&&(r+=this.length);if(0>r||r>=this.length)return w;P=this[r];0===r?this.shift():this.splice(r,1)}else{r=l(r,p(G,"Integer"),"to_int");K=l(K,p(G,"Integer"),"to_int");if(0>K)return w;P=this["$[]"](r, +K);0>r&&(r+=this.length);r+K>this.length&&(K=this.length-r);r"](fa)});return P.slice().sort(function(ca,fa){var qa=K(ca,fa);qa===w&&P.$raise(p(G,"ArgumentError"),"comparison of "+ca.$inspect()+" with "+fa.$inspect()+" failed");return y(qa,0)?1:("number"===typeof qa?0>qa:qa["$<"](0))? -1:0})},qb.$$arity=0);a.def(E,"$sort!",nb=function(){var r=nb.$$p,K=r||w;r&&(nb.$$p=null);r&&(nb.$$p=null);r=K!==w?D(this.slice(),"sort",[],K.$to_proc()):this.slice().$sort();K=this.length=0;for(var P=r.length;Kr&&this.$raise(p(G,"ArgumentError"));return this.slice(0,r)},Gb.$$arity=1);a.def(E,"$take_while",Ab=function(){var r=Ab.$$p,K=r||w;r&&(Ab.$$p=null);r&&(Ab.$$p=null);r=[];for(var P=0,ca=this.length,ha,qa;P$a)return $a+=qa.length,w;0>fb&&(fb+=qa.length);ha["$exclude_end?"]()&&fb--;return fb<$a?w:D($a,"upto",[fb],(Pa=function(lb){var vb=null==Pa.$$s?this:Pa.$$s;null==lb&&(lb=w);return P["$<<"](vb.$at(lb))}, -Pa.$$s=qa,Pa.$$arity=1,Pa))}fb=l(ha,p(G,"Integer"),"to_int");return P["$<<"](qa.$at(fb))},K.$$s=this,K.$$arity=1,K));return P},Mb.$$arity=-1);a.def(E,"$zip",Eb=function(r){var K=Eb.$$p,P=K||w,ca=w;K&&(Eb.$$p=null);K&&(Eb.$$p=null);K=a.slice.call(arguments,0,arguments.length);var ha=[],qa=this.length,Pa,fb;var $a=0;for(fb=K.length;$ar&&this.$raise(p(G,"ArgumentError"));return this.slice(0,r)},Gb.$$arity=1);a.def(E,"$take_while",Ab=function(){var r=Ab.$$p,K=r||w;r&&(Ab.$$p=null);r&&(Ab.$$p=null);r=[];for(var P=0,ca=this.length,fa,qa;P$a)return $a+=qa.length,w;0>fb&&(fb+=qa.length);fa["$exclude_end?"]()&&fb--;return fb<$a?w:D($a,"upto",[fb],(Pa=function(lb){var vb=null==Pa.$$s?this:Pa.$$s;null==lb&&(lb=w);return P["$<<"](vb.$at(lb))}, +Pa.$$s=qa,Pa.$$arity=1,Pa))}fb=l(fa,p(G,"Integer"),"to_int");return P["$<<"](qa.$at(fb))},K.$$s=this,K.$$arity=1,K));return P},Mb.$$arity=-1);a.def(E,"$zip",Eb=function(r){var K=Eb.$$p,P=K||w,ca=w;K&&(Eb.$$p=null);K&&(Eb.$$p=null);K=a.slice.call(arguments,0,arguments.length);var fa=[],qa=this.length,Pa,fb;var $a=0;for(fb=K.length;$a=m:k["$>="](m)}var J=a.top,t=[],w=a.nil,z=a.$$,p=a.klass,d=a.send,H=a.hash2,x=a.truthy;a.add_stubs("$require $include $coerce_to? $[] $merge! $allocate $raise $coerce_to! $each $fetch $>= $> $== $compare_by_identity $lambda? $abs $arity $enum_for $size $respond_to? $class $dig $new $inspect $map $to_proc $flatten $eql? $default $dup $default_proc $default_proc= $- $default= $to_h $proc".split(" "));J.$require("corelib/enumerable"); -return function(k,$super,u){k=p(k,$super,"Hash");var c=[k].concat(u),l,I,e,n,L,D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,xa,Ba,La,na,S,sa,ya,pa,ea,F,V,ka,va,ia,wa,Ha,Ea,Qa,Sa,Ia,kb,Ra,W,za,Ca,Va,ib,db,Xa,bb,Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T,fa;k.$include(z(c,"Enumerable"));k.$$prototype.$$is_hash=!0;a.defs(k,"$[]",l=function(g){var C=a.slice.call(arguments,0,arguments.length);var N=C.length,aa;if(1===N){var v=z(c,"Opal")["$coerce_to?"](C["$[]"](0),z(c,"Hash"),"to_hash");if(v!==w)return this.$allocate()["$merge!"](v); +return function(k,$super,u){k=p(k,$super,"Hash");var c=[k].concat(u),l,I,e,n,L,D,R,ia,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,wa,Ba,La,na,S,sa,ya,pa,ha,F,V,ka,va,ja,xa,Ha,Ea,Qa,Ra,Ia,kb,Sa,W,za,Da,Va,ib,db,bb,Xa,Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T,ea;k.$include(z(c,"Enumerable"));k.$$prototype.$$is_hash=!0;a.defs(k,"$[]",l=function(g){var C=a.slice.call(arguments,0,arguments.length);var N=C.length,aa;if(1===N){var v=z(c,"Opal")["$coerce_to?"](C["$[]"](0),z(c,"Hash"),"to_hash");if(v!==w)return this.$allocate()["$merge!"](v); C=z(c,"Opal")["$coerce_to?"](C["$[]"](0),z(c,"Array"),"to_ary");C===w&&this.$raise(z(c,"ArgumentError"),"odd number of arguments for Hash");N=C.length;v=this.$allocate();for(aa=0;aa=",D=function(g){var C,N=w;g=z(c,"Opal")["$coerce_to!"](g,z(c,"Hash"),"to_hash");if(this.$$keys.length",R=function(g){g=z(c,"Opal")["$coerce_to!"](g,z(c,"Hash"),"to_hash");return this.$$keys.length<=g.$$keys.length?!1:y(this,g)},R.$$arity=1);a.def(k,"$<",ja=function(g){g=z(c,"Opal")["$coerce_to!"](g,z(c,"Hash"),"to_hash");return"number"===typeof g&&"number"===typeof this?g>this:g["$>"](this)},ja.$$arity= +!0;d(g,"each",[],(C=function(aa,v){var U=null==C.$$s?this:C.$$s;null==aa&&(aa=w);null==v&&(v=w);aa=U.$fetch(aa,null);if(null==aa||aa!==v)N=!1},C.$$s=this,C.$$arity=2,C));return N},D.$$arity=1);a.def(k,"$>",R=function(g){g=z(c,"Opal")["$coerce_to!"](g,z(c,"Hash"),"to_hash");return this.$$keys.length<=g.$$keys.length?!1:y(this,g)},R.$$arity=1);a.def(k,"$<",ia=function(g){g=z(c,"Opal")["$coerce_to!"](g,z(c,"Hash"),"to_hash");return"number"===typeof g&&"number"===typeof this?g>this:g["$>"](this)},ia.$$arity= 1);a.def(k,"$<=",da=function(g){g=z(c,"Opal")["$coerce_to!"](g,z(c,"Hash"),"to_hash");return y(g,this)},da.$$arity=1);a.def(k,"$[]",ma=function(g){var C=a.hash_get(this,g);return void 0!==C?C:this.$default(g)},ma.$$arity=1);a.def(k,"$[]=",b=function(g,C){a.hash_put(this,g,C);return C},b.$$arity=2);a.def(k,"$assoc",h=function(g){for(var C=0,N=this.$$keys,aa=N.length,v;C"+oa.$inspect());return"{"+N.join(", ")+"}"}finally{g&&(la=void 0)}},Ea.$$arity=0);a.def(k,"$invert",Qa=function(){for(var g=a.hash(),C=0,N=this.$$keys,aa=N.length,v,U;C"+oa.$inspect());return"{"+N.join(", ")+"}"}finally{g&&(la=void 0)}},Ea.$$arity=0);a.def(k,"$invert",Qa=function(){for(var g=a.hash(),C=0,N=this.$$keys,aa=N.length,v,U;CL:n["$>"](L)}function J(n,L){return"number"===typeof n&&"number"===typeof L?n $** $new $< $to_f $== $nan? $infinite? $enum_for $+ $- $gcd $lcm $% $/ $frexp $to_i $ldexp $rationalize $* $<< $to_r $truncate $-@ $size $<= $>= $<=> $compare $any?".split(" "));d.$require("corelib/numeric");(function(n,$super,D){n=u(n,$super,"Number");var R=[n].concat(D),ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa, -xa,Ba,La,na,S,sa,ya,pa,ea,F,V,ka,va,ia,wa,Ha,Ea,Qa,Sa,Ia,kb,Ra,W,za,Ca,Va,ib,db,Xa,bb,Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T,fa,la,g,C,N,aa,v,U,oa,Ka,jb,ob,mb,sb,tb,wb,xb,ub;m(R,"Opal").$bridge(Number,n);a.defineProperty(n.$$prototype,"$$is_number",!0);n.$$is_number_class=!0;(function(X,Na){var cb=[X].concat(Na),B;a.def(X,"$allocate",B=function(){return this.$raise(m(cb,"TypeError"),"allocator undefined for "+this.$name())},B.$$arity=0);a.udef(X,"$new");return x})(a.get_singleton_class(n),R);a.def(n,"$coerce", -ja=function(X){if(X!==x){if(X.$$is_string)return[this.$Float(X),this];if(X["$respond_to?"]("to_f"))return[m(R,"Opal")["$coerce_to!"](X,m(R,"Float"),"to_f"),this];if(X.$$is_number)return[X,this]}this.$raise(m(R,"TypeError"),"can't convert "+X.$class()+" into Float")},ja.$$arity=1);a.def(n,"$__id__",da=function(){return 2*this+1},da.$$arity=0);a.alias(n,"object_id","__id__");a.def(n,"$+",ma=function(X){return X.$$is_number?this+X:this.$__coerced__("+",X)},ma.$$arity=1);a.def(n,"$-",b=function(X){return X.$$is_number? +var d=a.top,H=[],x=a.nil,k=a.$$$,m=a.$$,u=a.klass,c=a.truthy,l=a.send2,I=a.send,e=a.hash2;a.add_stubs("$require $bridge $raise $name $class $Float $respond_to? $coerce_to! $__coerced__ $=== $! $> $** $new $< $to_f $== $nan? $infinite? $enum_for $+ $- $gcd $lcm $% $/ $frexp $to_i $ldexp $rationalize $* $<< $to_r $truncate $-@ $size $<= $>= $<=> $compare $any?".split(" "));d.$require("corelib/numeric");(function(n,$super,D){n=u(n,$super,"Number");var R=[n].concat(D),ia,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa, +wa,Ba,La,na,S,sa,ya,pa,ha,F,V,ka,va,ja,xa,Ha,Ea,Qa,Ra,Ia,kb,Sa,W,za,Da,Va,ib,db,bb,Xa,Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T,ea,la,g,C,N,aa,v,U,oa,Ka,jb,ob,mb,sb,tb,wb,xb,ub;m(R,"Opal").$bridge(Number,n);a.defineProperty(n.$$prototype,"$$is_number",!0);n.$$is_number_class=!0;(function(X,Na){var cb=[X].concat(Na),B;a.def(X,"$allocate",B=function(){return this.$raise(m(cb,"TypeError"),"allocator undefined for "+this.$name())},B.$$arity=0);a.udef(X,"$new");return x})(a.get_singleton_class(n),R);a.def(n,"$coerce", +ia=function(X){if(X!==x){if(X.$$is_string)return[this.$Float(X),this];if(X["$respond_to?"]("to_f"))return[m(R,"Opal")["$coerce_to!"](X,m(R,"Float"),"to_f"),this];if(X.$$is_number)return[X,this]}this.$raise(m(R,"TypeError"),"can't convert "+X.$class()+" into Float")},ia.$$arity=1);a.def(n,"$__id__",da=function(){return 2*this+1},da.$$arity=0);a.alias(n,"object_id","__id__");a.def(n,"$+",ma=function(X){return X.$$is_number?this+X:this.$__coerced__("+",X)},ma.$$arity=1);a.def(n,"$-",b=function(X){return X.$$is_number? this-X:this.$__coerced__("-",X)},b.$$arity=1);a.def(n,"$*",h=function(X){return X.$$is_number?this*X:this.$__coerced__("*",X)},h.$$arity=1);a.def(n,"$/",f=function(X){return X.$$is_number?this/X:this.$__coerced__("/",X)},f.$$arity=1);a.alias(n,"fdiv","/");a.def(n,"$%",q=function(X){if(X.$$is_number){if(-Infinity==X)return X;if(0==X)this.$raise(m(R,"ZeroDivisionError"),"divided by 0");else return 0>X||0>this?(this%X+X)%X:this%X}else return this.$__coerced__("%",X)},q.$$arity=1);a.def(n,"$&",A=function(X){return X.$$is_number? this&X:this.$__coerced__("&",X)},A.$$arity=1);a.def(n,"$|",E=function(X){return X.$$is_number?this|X:this.$__coerced__("|",X)},E.$$arity=1);a.def(n,"$^",G=function(X){return X.$$is_number?this^X:this.$__coerced__("^",X)},G.$$arity=1);a.def(n,"$<",M=function(X){return X.$$is_number?this",ua=function(X){return X.$$is_number?this>X:this.$__coerced__(">", -X)},ua.$$arity=1);a.def(n,"$>=",Oa=function(X){return X.$$is_number?this>=X:this.$__coerced__(">=",X)},Oa.$$arity=1);a.def(n,"$<=>",xa=function(X){try{return X.$$is_number?isNaN(this)||isNaN(X)?x:this>X?1:this",X)}catch(Na){if(a.rescue(Na,[m(R,"ArgumentError")]))try{return x}finally{a.pop_exception()}else throw Na;}},xa.$$arity=1);a.def(n,"$<<",Ba=function(X){X=m(R,"Opal")["$coerce_to!"](X,m(R,"Integer"),"to_int");return 0>-X},Ba.$$arity=1);a.def(n,"$>>", +X)},ua.$$arity=1);a.def(n,"$>=",Oa=function(X){return X.$$is_number?this>=X:this.$__coerced__(">=",X)},Oa.$$arity=1);a.def(n,"$<=>",wa=function(X){try{return X.$$is_number?isNaN(this)||isNaN(X)?x:this>X?1:this",X)}catch(Na){if(a.rescue(Na,[m(R,"ArgumentError")]))try{return x}finally{a.pop_exception()}else throw Na;}},wa.$$arity=1);a.def(n,"$<<",Ba=function(X){X=m(R,"Opal")["$coerce_to!"](X,m(R,"Integer"),"to_int");return 0>-X},Ba.$$arity=1);a.def(n,"$>>", La=function(X){X=m(R,"Opal")["$coerce_to!"](X,m(R,"Integer"),"to_int");return 0>X:this<<-X},La.$$arity=1);a.def(n,"$[]",na=function(X){X=m(R,"Opal")["$coerce_to!"](X,m(R,"Integer"),"to_int");return 0>X?0:32<=X?0>this?1:0:this>>X&1},na.$$arity=1);a.def(n,"$+@",S=function(){return+this},S.$$arity=0);a.def(n,"$-@",sa=function(){return-this},sa.$$arity=0);a.def(n,"$~",ya=function(){return~this},ya.$$arity=0);a.def(n,"$**",pa=function(X){var Na=x,cb=x,B=x;return c(m(R,"Integer")["$==="](X))?c(c(Na= -m(R,"Integer")["$==="](this)["$!"]())?Na:y(X,0))?Math.pow(this,X):m(R,"Rational").$new(this,1)["$**"](X):c(c(cb=J(this,0))?c(B=m(R,"Float")["$==="](X))?B:m(R,"Rational")["$==="](X):cb)?m(R,"Complex").$new(this,0)["$**"](X.$to_f()):c(null!=X.$$is_number)?Math.pow(this,X):this.$__coerced__("**",X)},pa.$$arity=1);a.def(n,"$===",ea=function(X){return X.$$is_number?this.valueOf()===X.valueOf():X["$respond_to?"]("==")?X["$=="](this):!1},ea.$$arity=1);a.def(n,"$==",F=function(X){return X.$$is_number?this.valueOf()=== -X.valueOf():X["$respond_to?"]("==")?X["$=="](this):!1},F.$$arity=1);a.def(n,"$abs",V=function(){return Math.abs(this)},V.$$arity=0);a.def(n,"$abs2",ka=function(){return Math.abs(this*this)},ka.$$arity=0);a.def(n,"$allbits?",va=function(X){X=m(R,"Opal")["$coerce_to!"](X,m(R,"Integer"),"to_int");return(this&X)==X},va.$$arity=1);a.def(n,"$anybits?",ia=function(X){X=m(R,"Opal")["$coerce_to!"](X,m(R,"Integer"),"to_int");return 0!==(this&X)},ia.$$arity=1);a.def(n,"$angle",wa=function(){return c(this["$nan?"]())? -this:0==this?0<1/this?0:Math.PI:0>this?Math.PI:0},wa.$$arity=0);a.alias(n,"arg","angle");a.alias(n,"phase","angle");a.def(n,"$bit_length",Ha=function(){c(m(R,"Integer")["$==="](this))||this.$raise(m(R,"NoMethodError").$new("undefined method `bit_length` for "+this+":Float","bit_length"));if(0===this||-1===this)return 0;for(var X=0,Na=0>this?~this:this;0!=Na;)X+=1,Na>>>=1;return X},Ha.$$arity=0);a.def(n,"$ceil",Ea=function(X){null==X&&(X=0);var Na=this.$to_f();if(0===Na%1&&0<=X)return Na;X=Math.pow(10, -X);X=Math.ceil(Na*X)/X;0===Na%1&&(X=Math.round(X));return X},Ea.$$arity=-1);a.def(n,"$chr",Qa=function(){return String.fromCharCode(this)},Qa.$$arity=-1);a.def(n,"$denominator",Sa=function(){var X=Sa.$$p,Na=x,cb;X&&(Sa.$$p=null);var B=0;var O=arguments.length;for(cb=Array(O);Bthis?Math.PI:0},xa.$$arity=0);a.alias(n,"arg","angle");a.alias(n,"phase","angle");a.def(n,"$bit_length",Ha=function(){c(m(R,"Integer")["$==="](this))||this.$raise(m(R,"NoMethodError").$new("undefined method `bit_length` for "+this+":Float","bit_length"));if(0===this||-1===this)return 0;for(var X=0,Na=0>this?~this:this;0!=Na;)X+=1,Na>>>=1;return X},Ha.$$arity=0);a.def(n,"$ceil",Ea=function(X){null==X&&(X=0);var Na=this.$to_f();if(0===Na%1&&0<=X)return Na;X=Math.pow(10, +X);X=Math.ceil(Na*X)/X;0===Na%1&&(X=Math.round(X));return X},Ea.$$arity=-1);a.def(n,"$chr",Qa=function(){return String.fromCharCode(this)},Qa.$$arity=-1);a.def(n,"$denominator",Ra=function(){var X=Ra.$$p,Na=x,cb;X&&(Ra.$$p=null);var B=0;var O=arguments.length;for(cb=Array(O);B=X;Na--)cb(Na);return this},Ia.$$arity=1);a.alias(n,"eql?","=="); -a.def(n,"$equal?",kb=function(X){var Na;return c(Na=this["$=="](X))?Na:isNaN(this)&&isNaN(X)},kb.$$arity=1);a.def(n,"$even?",Ra=function(){return 0===this%2},Ra.$$arity=0);a.def(n,"$floor",W=function(X){null==X&&(X=0);var Na=this.$to_f();if(0===Na%1&&0<=X)return Na;X=Math.pow(10,X);X=Math.floor(Na*X)/X;0===Na%1&&(X=Math.round(X));return X},W.$$arity=-1);a.def(n,"$gcd",za=function(X){c(m(R,"Integer")["$==="](X))||this.$raise(m(R,"TypeError"),"not an integer");var Na=Math.abs(this);for(X=Math.abs(X);0< -Na;){var cb=Na;Na=X%Na;X=cb}return X},za.$$arity=1);a.def(n,"$gcdlcm",Ca=function(X){return[this.$gcd(X),this.$lcm(X)]},Ca.$$arity=1);a.def(n,"$integer?",Va=function(){return 0===this%1},Va.$$arity=0);a.def(n,"$is_a?",ib=function(X){var Na=ib.$$p,cb=x,B=x,O=x,ra;Na&&(ib.$$p=null);var Ga=0;var Da=arguments.length;for(ra=Array(Da);GaX&&this.$raise(m(R,"TypeError"),"Integer#pow() 1st argument cannot be negative when 2nd argument specified");m(R,"Integer")["$==="](Na)||this.$raise(m(R,"TypeError"),"Integer#pow() 2nd argument not allowed unless all arguments are integers"); 0===Na&&this.$raise(m(R,"ZeroDivisionError"),"divided by 0");return this["$**"](X)["$%"](Na)},Fa.$$arity=-2);a.def(n,"$pred",Y=function(){return this-1},Y.$$arity=0);a.def(n,"$quo",Q=function(X){var Na=Q.$$p,cb;Na&&(Q.$$p=null);var B=0;var O=arguments.length;for(cb=Array(O);Bthis.$size())return 0;X=Math.pow(10,X);X*=Math.floor((Math.abs(this)+X/2)/X);return 0>this?-X:X}c(c(cb=this["$nan?"]())?null==X:cb)&&this.$raise(m(R,"FloatDomainError"),"NaN");X=m(R,"Opal")["$coerce_to!"](X||0,m(R,"Integer"),"to_int");if(c("number"===typeof X?0>=X:X["$<="](0)))c(this["$nan?"]())?this.$raise(m(R,"RangeError"),"NaN"):c(this["$infinite?"]())&& -this.$raise(m(R,"FloatDomainError"),"Infinity");else{if(X["$=="](0))return Math.round(this);if(c(c(B=this["$nan?"]())?B:this["$infinite?"]()))return this}cb=m(R,"Math").$frexp(this);Na=a.to_ary(cb);Na=null==Na[1]?x:Na[1];cb;cb=w(t(k(m(R,"Float"),"DIG"),2),c(y(Na,0))?z(Na,4):w(z(Na,3),1));cb="number"===typeof X&&"number"===typeof cb?X>=cb:X["$>="](cb);return c(cb)?this:c(J(X,(c(y(Na,0))?t(z(Na,3),1):z(Na,4))["$-@"]()))?0:Math.round(this*Math.pow(10,X))/Math.pow(10,X)},fa.$$arity=-1);a.def(n,"$step", +this.$raise(m(R,"FloatDomainError"),"Infinity");else{if(X["$=="](0))return Math.round(this);if(c(c(B=this["$nan?"]())?B:this["$infinite?"]()))return this}cb=m(R,"Math").$frexp(this);Na=a.to_ary(cb);Na=null==Na[1]?x:Na[1];cb;cb=w(t(k(m(R,"Float"),"DIG"),2),c(y(Na,0))?z(Na,4):w(z(Na,3),1));cb="number"===typeof X&&"number"===typeof cb?X>=cb:X["$>="](cb);return c(cb)?this:c(J(X,(c(y(Na,0))?t(z(Na,3),1):z(Na,4))["$-@"]()))?0:Math.round(this*Math.pow(10,X))/Math.pow(10,X)},ea.$$arity=-1);a.def(n,"$step", la=function(X,Na,cb){function B(){void 0!==gb&&(Ua=gb);void 0===Ua&&(Ua=x);Ya===x&&hb.$raise(m(R,"TypeError"),"step must be numeric");0===Ya&&hb.$raise(m(R,"ArgumentError"),"step can't be 0");void 0!==qb&&(Ya=qb);if(Ya===x||null==Ya)Ya=1;var nb=Ya["$<=>"](0);nb===x&&hb.$raise(m(R,"ArgumentError"),"0 can't be coerced into "+Ya.$class());if(Ua===x||null==Ua)Ua=0Ua||0>Ya&&hbUa||0>Ya&&hbJa&&(Ja=Ua),Da(Ja),Ga+=1}else if(Wa=hb,0= -Ua;)Da(Wa),Wa+=Ya;return hb},la.$$arity=-1);a.alias(n,"succ","next");a.def(n,"$times",g=function(){var X=g.$$p,Na=X||x,cb;X&&(g.$$p=null);X&&(g.$$p=null);if(!c(Na))return I(this,"enum_for",["times"],(cb=function(){return null==cb.$$s?this:cb.$$s},cb.$$s=this,cb.$$arity=0,cb));for(X=0;XUa||0>Ya&&hbJa&&(Ja=Ua),Ca(Ja),Ga+=1}else if(Wa=hb,0= +Ua;)Ca(Wa),Wa+=Ya;return hb},la.$$arity=-1);a.alias(n,"succ","next");a.def(n,"$times",g=function(){var X=g.$$p,Na=X||x,cb;X&&(g.$$p=null);X&&(g.$$p=null);if(!c(Na))return I(this,"enum_for",["times"],(cb=function(){return null==cb.$$s?this:cb.$$s},cb.$$s=this,cb.$$arity=0,cb));for(X=0;X1/this},ub.$$arity=0),x)&&"negative?"})(H[0],m(H,"Numeric"),H);a.const_set(H[0],"Fixnum",m(H,"Number"));(function(n,$super,D){n=u(n,$super,"Integer");D=[n].concat(D);n.$$is_number_class=!0;n.$$is_integer_class=!0;(function(R,ja){var da=[R].concat(ja),ma,b;a.def(R,"$allocate",ma=function(){return this.$raise(m(da,"TypeError"),"allocator undefined for "+this.$name())},ma.$$arity=0);a.udef(R,"$new");return(a.def(R,"$sqrt",b=function(h){h=m(da,"Opal")["$coerce_to!"](h, -m(da,"Integer"),"to_int");0>h&&this.$raise(k(m(da,"Math"),"DomainError"),'Numerical argument is out of domain - "isqrt"');return parseInt(Math.sqrt(h),10)},b.$$arity=1),x)&&"sqrt"})(a.get_singleton_class(n),D);a.const_set(D[0],"MAX",Math.pow(2,30)-1);return a.const_set(D[0],"MIN",-Math.pow(2,30))})(H[0],m(H,"Numeric"),H);return function(n,$super,D){n=u(n,$super,"Float");D=[n].concat(D);n.$$is_number_class=!0;(function(R,ja){var da=[R].concat(ja),ma,b;a.def(R,"$allocate",ma=function(){return this.$raise(m(da, +function(){return-Infinity==this||0>1/this},ub.$$arity=0),x)&&"negative?"})(H[0],m(H,"Numeric"),H);a.const_set(H[0],"Fixnum",m(H,"Number"));(function(n,$super,D){n=u(n,$super,"Integer");D=[n].concat(D);n.$$is_number_class=!0;n.$$is_integer_class=!0;(function(R,ia){var da=[R].concat(ia),ma,b;a.def(R,"$allocate",ma=function(){return this.$raise(m(da,"TypeError"),"allocator undefined for "+this.$name())},ma.$$arity=0);a.udef(R,"$new");return(a.def(R,"$sqrt",b=function(h){h=m(da,"Opal")["$coerce_to!"](h, +m(da,"Integer"),"to_int");0>h&&this.$raise(k(m(da,"Math"),"DomainError"),'Numerical argument is out of domain - "isqrt"');return parseInt(Math.sqrt(h),10)},b.$$arity=1),x)&&"sqrt"})(a.get_singleton_class(n),D);a.const_set(D[0],"MAX",Math.pow(2,30)-1);return a.const_set(D[0],"MIN",-Math.pow(2,30))})(H[0],m(H,"Numeric"),H);return function(n,$super,D){n=u(n,$super,"Float");D=[n].concat(D);n.$$is_number_class=!0;(function(R,ia){var da=[R].concat(ia),ma,b;a.def(R,"$allocate",ma=function(){return this.$raise(m(da, "TypeError"),"allocator undefined for "+this.$name())},ma.$$arity=0);a.udef(R,"$new");return(a.def(R,"$===",b=function(h){return!!h.$$is_number},b.$$arity=1),x)&&"==="})(a.get_singleton_class(n),D);a.const_set(D[0],"INFINITY",Infinity);a.const_set(D[0],"MAX",Number.MAX_VALUE);a.const_set(D[0],"MIN",Number.MIN_VALUE);a.const_set(D[0],"NAN",NaN);a.const_set(D[0],"DIG",15);a.const_set(D[0],"MANT_DIG",53);a.const_set(D[0],"RADIX",2);return a.const_set(D[0],"EPSILON",Number.EPSILON||2.220446049250313E-16)}(H[0], m(H,"Numeric"),H)}; Opal.modules["corelib/range"]=function(a){function y(l,I){return"number"===typeof l&&"number"===typeof I?l<=I:l["$<="](I)}function J(l,I){return"number"===typeof l&&"number"===typeof I?lI:l["$>"](I)}function w(l,I){return"number"===typeof l&&"number"===typeof I?l+I:l["$+"](I)}var z=a.top,p=[],d=a.nil,H=a.$$$,x=a.$$,k=a.klass,m=a.truthy,u=a.send,c=a.send2;a.add_stubs("$require $include $attr_reader $raise $<=> $include? $<= $< $enum_for $size $upto $to_proc $respond_to? $class $succ $! $== $=== $exclude_end? $eql? $begin $end $last $to_a $> $- $abs $to_i $coerce_to! $ceil $/ $loop $+ $* $>= $each_with_index $% $bsearch $inspect $[] $hash".split(" "));z.$require("corelib/enumerable"); -return function(l,$super,e){l=k(l,$super,"Range");var n=[l].concat(e),L,D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa;l.$$prototype.begin=l.$$prototype.end=l.$$prototype.excl=d;l.$include(x(n,"Enumerable"));l.$$prototype.$$is_range=!0;l.$attr_reader("begin","end");a.def(l,"$initialize",L=function(xa,Ba,La){null==La&&(La=!1);m(this.begin)&&this.$raise(x(n,"NameError"),"'initialize' called twice");m(xa["$<=>"](Ba))||this.$raise(x(n,"ArgumentError"),"bad value for range");this.begin=xa;this.end=Ba;return this.excl= -La},L.$$arity=-3);a.def(l,"$===",D=function(xa){return this["$include?"](xa)},D.$$arity=1);a.def(l,"$cover?",R=function(xa){var Ba=d,La=d,na=d;var S=this.begin["$<=>"](xa);if(!m(m(Ba=S)?y(S,0):Ba))return!1;xa=xa["$<=>"](this.end);return m(this.excl)?m(La=xa)?J(xa,0):La:m(na=xa)?y(xa,0):na},R.$$arity=1);a.def(l,"$each",ja=function(){var xa=ja.$$p,Ba=xa||d,La,na=d,S=d,sa=d;xa&&(ja.$$p=null);xa&&(ja.$$p=null);if(Ba===d)return u(this,"enum_for",["each"],(La=function(){return(null==La.$$s?this:La.$$s).$size()}, -La.$$s=this,La.$$arity=0,La));if(this.begin.$$is_number&&this.end.$$is_number){0===this.begin%1&&0===this.end%1||this.$raise(x(n,"TypeError"),"can't iterate from Float");xa=this.begin;for(na=this.end+(m(this.excl)?0:1);xa"](S), -0));)a.yield1(Ba,na),na=na.$succ();m(m(sa=this.excl["$!"]())?na["$=="](S):sa)&&a.yield1(Ba,na);return this},ja.$$arity=0);a.def(l,"$eql?",da=function(xa){var Ba=d,La=d;return m(x(n,"Range")["$==="](xa))?m(Ba=m(La=this.excl["$==="](xa["$exclude_end?"]()))?this.begin["$eql?"](xa.$begin()):La)?this.end["$eql?"](xa.$end()):Ba:!1},da.$$arity=1);a.alias(l,"==","eql?");a.def(l,"$exclude_end?",ma=function(){return this.excl},ma.$$arity=0);a.def(l,"$first",b=function(xa){var Ba=b.$$p,La;Ba&&(b.$$p=null);var na= -0;var S=arguments.length;for(La=Array(S);naxa?ea.$raise(x(n, -"ArgumentError"),"step can't be negative"):0===xa&&ea.$raise(x(n,"ArgumentError"),"step can't be 0")}function La(){if(!ea.begin["$respond_to?"]("succ")||ea.begin.$$is_string&&ea.end.$$is_string)return d;if(0===xa%1){var V=ea.$size();return("number"===typeof V&&"number"===typeof xa?V/xa:V["$/"](xa)).$ceil()}V=ea.begin;var ka=ea.end,va=Math.abs,ia=Math.floor;va=(va(V)+va(ka)+va(ka-V))/va(xa)*H(x(n,"Float"),"EPSILON");.5=ka:va["$>="](ka),m(ka)&&a.brk(d,V)):m(t(va,ka.end))&&a.brk(d,V);a.yield1(pa,va);return F=w(F,1)},S.$$s=ea,S.$$brk=V,S.$$arity=0,S))}catch(ka){if(ka===V)return ka.$v;throw ka;}}()):(ea.begin.$$is_string&&ea.end.$$is_string&&0!==xa%1&&ea.$raise(x(n,"TypeError"),"no implicit conversion to float from string"),u(ea,"each_with_index",[],(sa=function(V,ka){null==V&&(V=d);null==ka&&(ka=d);return ka["$%"](xa)["$=="](0)?a.yield1(pa,V): -d},sa.$$s=ea,sa.$$arity=2,sa)));return ea},E.$$arity=-1);a.def(l,"$bsearch",G=function(){var xa=G.$$p,Ba=xa||d;xa&&(G.$$p=null);xa&&(G.$$p=null);if(Ba===d)return this.$enum_for("bsearch");m(this.begin.$$is_number&&this.end.$$is_number)||this.$raise(x(n,"TypeError"),"can't do binary search for "+this.begin.$class());return u(this.$to_a(),"bsearch",[],Ba.$to_proc())},G.$$arity=0);a.def(l,"$to_s",M=function(){return""+this.begin+(m(this.excl)?"...":"..")+this.end},M.$$arity=0);a.def(l,"$inspect",ba= -function(){return""+this.begin.$inspect()+(m(this.excl)?"...":"..")+this.end.$inspect()},ba.$$arity=0);a.def(l,"$marshal_load",ua=function(xa){this.begin=xa["$[]"]("begin");this.end=xa["$[]"]("end");return this.excl=xa["$[]"]("excl")},ua.$$arity=1);return(a.def(l,"$hash",Oa=function(){return[this.begin,this.end,this.excl].$hash()},Oa.$$arity=0),d)&&"hash"}(p[0],null,p)}; -Opal.modules["corelib/proc"]=function(a){var y=[],J=a.nil,t=a.$$,w=a.slice,z=a.klass,p=a.truthy,d=a.send;a.add_stubs(["$raise","$proc","$call","$to_proc","$coerce_to!"]);return function(H,$super,k){H=z(H,$super,"Proc");var m=[H].concat(k),u,c,l,I,e,n,L,D,R,ja,da,ma;a.defineProperty(H.$$prototype,"$$is_proc",!0);a.defineProperty(H.$$prototype,"$$is_lambda",!1);a.defs(H,"$new",u=function(){var b=u.$$p,h=b||J;b&&(u.$$p=null);b&&(u.$$p=null);p(h)||this.$raise(t(m,"ArgumentError"),"tried to create a Proc object without a block"); +return function(l,$super,e){l=k(l,$super,"Range");var n=[l].concat(e),L,D,R,ia,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa;l.$$prototype.begin=l.$$prototype.end=l.$$prototype.excl=d;l.$include(x(n,"Enumerable"));l.$$prototype.$$is_range=!0;l.$attr_reader("begin","end");a.def(l,"$initialize",L=function(wa,Ba,La){null==La&&(La=!1);m(this.begin)&&this.$raise(x(n,"NameError"),"'initialize' called twice");m(wa["$<=>"](Ba))||this.$raise(x(n,"ArgumentError"),"bad value for range");this.begin=wa;this.end=Ba;return this.excl= +La},L.$$arity=-3);a.def(l,"$===",D=function(wa){return this["$include?"](wa)},D.$$arity=1);a.def(l,"$cover?",R=function(wa){var Ba=d,La=d,na=d;var S=this.begin["$<=>"](wa);if(!m(m(Ba=S)?y(S,0):Ba))return!1;wa=wa["$<=>"](this.end);return m(this.excl)?m(La=wa)?J(wa,0):La:m(na=wa)?y(wa,0):na},R.$$arity=1);a.def(l,"$each",ia=function(){var wa=ia.$$p,Ba=wa||d,La,na=d,S=d,sa=d;wa&&(ia.$$p=null);wa&&(ia.$$p=null);if(Ba===d)return u(this,"enum_for",["each"],(La=function(){return(null==La.$$s?this:La.$$s).$size()}, +La.$$s=this,La.$$arity=0,La));if(this.begin.$$is_number&&this.end.$$is_number){0===this.begin%1&&0===this.end%1||this.$raise(x(n,"TypeError"),"can't iterate from Float");wa=this.begin;for(na=this.end+(m(this.excl)?0:1);wa"](S), +0));)a.yield1(Ba,na),na=na.$succ();m(m(sa=this.excl["$!"]())?na["$=="](S):sa)&&a.yield1(Ba,na);return this},ia.$$arity=0);a.def(l,"$eql?",da=function(wa){var Ba=d,La=d;return m(x(n,"Range")["$==="](wa))?m(Ba=m(La=this.excl["$==="](wa["$exclude_end?"]()))?this.begin["$eql?"](wa.$begin()):La)?this.end["$eql?"](wa.$end()):Ba:!1},da.$$arity=1);a.alias(l,"==","eql?");a.def(l,"$exclude_end?",ma=function(){return this.excl},ma.$$arity=0);a.def(l,"$first",b=function(wa){var Ba=b.$$p,La;Ba&&(b.$$p=null);var na= +0;var S=arguments.length;for(La=Array(S);nawa?ha.$raise(x(n, +"ArgumentError"),"step can't be negative"):0===wa&&ha.$raise(x(n,"ArgumentError"),"step can't be 0")}function La(){if(!ha.begin["$respond_to?"]("succ")||ha.begin.$$is_string&&ha.end.$$is_string)return d;if(0===wa%1){var V=ha.$size();return("number"===typeof V&&"number"===typeof wa?V/wa:V["$/"](wa)).$ceil()}V=ha.begin;var ka=ha.end,va=Math.abs,ja=Math.floor;va=(va(V)+va(ka)+va(ka-V))/va(wa)*H(x(n,"Float"),"EPSILON");.5=ka:va["$>="](ka),m(ka)&&a.brk(d,V)):m(t(va,ka.end))&&a.brk(d,V);a.yield1(pa,va);return F=w(F,1)},S.$$s=ha,S.$$brk=V,S.$$arity=0,S))}catch(ka){if(ka===V)return ka.$v;throw ka;}}()):(ha.begin.$$is_string&&ha.end.$$is_string&&0!==wa%1&&ha.$raise(x(n,"TypeError"),"no implicit conversion to float from string"),u(ha,"each_with_index",[],(sa=function(V,ka){null==V&&(V=d);null==ka&&(ka=d);return ka["$%"](wa)["$=="](0)?a.yield1(pa,V): +d},sa.$$s=ha,sa.$$arity=2,sa)));return ha},E.$$arity=-1);a.def(l,"$bsearch",G=function(){var wa=G.$$p,Ba=wa||d;wa&&(G.$$p=null);wa&&(G.$$p=null);if(Ba===d)return this.$enum_for("bsearch");m(this.begin.$$is_number&&this.end.$$is_number)||this.$raise(x(n,"TypeError"),"can't do binary search for "+this.begin.$class());return u(this.$to_a(),"bsearch",[],Ba.$to_proc())},G.$$arity=0);a.def(l,"$to_s",M=function(){return""+this.begin+(m(this.excl)?"...":"..")+this.end},M.$$arity=0);a.def(l,"$inspect",ba= +function(){return""+this.begin.$inspect()+(m(this.excl)?"...":"..")+this.end.$inspect()},ba.$$arity=0);a.def(l,"$marshal_load",ua=function(wa){this.begin=wa["$[]"]("begin");this.end=wa["$[]"]("end");return this.excl=wa["$[]"]("excl")},ua.$$arity=1);return(a.def(l,"$hash",Oa=function(){return[this.begin,this.end,this.excl].$hash()},Oa.$$arity=0),d)&&"hash"}(p[0],null,p)}; +Opal.modules["corelib/proc"]=function(a){var y=[],J=a.nil,t=a.$$,w=a.slice,z=a.klass,p=a.truthy,d=a.send;a.add_stubs(["$raise","$proc","$call","$to_proc","$coerce_to!"]);return function(H,$super,k){H=z(H,$super,"Proc");var m=[H].concat(k),u,c,l,I,e,n,L,D,R,ia,da,ma;a.defineProperty(H.$$prototype,"$$is_proc",!0);a.defineProperty(H.$$prototype,"$$is_lambda",!1);a.defs(H,"$new",u=function(){var b=u.$$p,h=b||J;b&&(u.$$p=null);b&&(u.$$p=null);p(h)||this.$raise(t(m,"ArgumentError"),"tried to create a Proc object without a block"); return h},u.$$arity=0);a.def(H,"$call",c=function(b){var h=c.$$p,f=h||J;h&&(c.$$p=null);h&&(c.$$p=null);h=a.slice.call(arguments,0,arguments.length);f!==J&&(this.$$p=f);if(f=this.$$brk)try{var q=this.$$is_lambda?this.apply(null,h):a.yieldX(this,h)}catch(A){if(A===f)return f.$v;throw A;}else q=this.$$is_lambda?this.apply(null,h):a.yieldX(this,h);return q},c.$$arity=-1);a.alias(H,"[]","call");a.alias(H,"===","call");a.alias(H,"yield","call");a.def(H,"$>>",l=function(b){var h;l.$$p&&(l.$$p=null);return d(this, "proc",[],(h=function(f){var q=null==h.$$s?this:h.$$s,A=h.$$p,E=A||J;A&&(h.$$p=null);A=a.slice.call(arguments,0,arguments.length);q=d(q,"call",a.to_a(A),E.$to_proc());return b.$call(q)},h.$$s=this,h.$$arity=-1,h))},l.$$arity=1);a.def(H,"$<<",I=function(b){var h;I.$$p&&(I.$$p=null);return d(this,"proc",[],(h=function(f){var q=null==h.$$s?this:h.$$s,A=h.$$p,E=A||J;A&&(h.$$p=null);A=a.slice.call(arguments,0,arguments.length);E=d(b,"call",a.to_a(A),E.$to_proc());return q.$call(E)},h.$$s=this,h.$$arity= --1,h))},I.$$arity=1);a.def(H,"$to_proc",e=function(){return this},e.$$arity=0);a.def(H,"$lambda?",n=function(){return!!this.$$is_lambda},n.$$arity=0);a.def(H,"$arity",L=function(){return this.$$is_curried?-1:this.$$arity},L.$$arity=0);a.def(H,"$source_location",D=function(){return J},D.$$arity=0);a.def(H,"$binding",R=function(){this.$$is_curried&&this.$raise(t(m,"ArgumentError"),"Can't create Binding");return J},R.$$arity=0);a.def(H,"$parameters",ja=function(){if(this.$$is_curried)return[["rest"]]; -if(this.$$parameters){if(this.$$is_lambda)return this.$$parameters;var b=[],h;var f=0;for(h=this.$$parameters.length;fb&&f.$$is_lambda&&!f.$$is_curried&&f.$raise(t(m,"ArgumentError"),"wrong number of arguments ("+A+" for "+b+")");if(A>=b)return f.$call.apply(f,q);A=function(){return h.apply(null,q.concat(w.call(arguments)))}; +-1,h))},I.$$arity=1);a.def(H,"$to_proc",e=function(){return this},e.$$arity=0);a.def(H,"$lambda?",n=function(){return!!this.$$is_lambda},n.$$arity=0);a.def(H,"$arity",L=function(){return this.$$is_curried?-1:this.$$arity},L.$$arity=0);a.def(H,"$source_location",D=function(){return J},D.$$arity=0);a.def(H,"$binding",R=function(){this.$$is_curried&&this.$raise(t(m,"ArgumentError"),"Can't create Binding");return J},R.$$arity=0);a.def(H,"$parameters",ia=function(){if(this.$$is_curried)return[["rest"]]; +if(this.$$parameters){if(this.$$is_lambda)return this.$$parameters;var b=[],h;var f=0;for(h=this.$$parameters.length;fb&&f.$$is_lambda&&!f.$$is_curried&&f.$raise(t(m,"ArgumentError"),"wrong number of arguments ("+A+" for "+b+")");if(A>=b)return f.$call.apply(f,q);A=function(){return h.apply(null,q.concat(w.call(arguments)))}; A.$$is_lambda=f.$$is_lambda;A.$$is_curried=!0;return A}var f=this;void 0===b?b=f.length:(b=t(m,"Opal")["$coerce_to!"](b,t(m,"Integer"),"to_int"),f.$$is_lambda&&b!==f.length&&f.$raise(t(m,"ArgumentError"),"wrong number of arguments ("+b+" for "+f.length+")"));h.$$is_lambda=f.$$is_lambda;h.$$is_curried=!0;return h},da.$$arity=-1);a.def(H,"$dup",ma=function(){function b(){return h.apply(this,arguments)}var h=this.$$original_proc||this,f;for(f in this)this.hasOwnProperty(f)&&(b[f]=this[f]);return b}, ma.$$arity=0);return a.alias(H,"clone","dup")}(y[0],Function,y)}; -Opal.modules["corelib/method"]=function(a){var y=[],J=a.nil,t=a.$$,w=a.klass,z=a.truthy;a.add_stubs("$attr_reader $arity $>> $<< $new $class $join $source_location $raise".split(" "));(function(p,$super,H){p=w(p,$super,"Method");var x=[p].concat(H),k,m,u,c,l,I,e,n,L,D,R;p.$$prototype.method=p.$$prototype.receiver=p.$$prototype.owner=p.$$prototype.name=J;p.$attr_reader("owner","receiver","name");a.def(p,"$initialize",k=function(ja,da,ma,b){this.receiver=ja;this.owner=da;this.name=b;return this.method= -ma},k.$$arity=4);a.def(p,"$arity",m=function(){return this.method.$arity()},m.$$arity=0);a.def(p,"$parameters",u=function(){return this.method.$$parameters},u.$$arity=0);a.def(p,"$source_location",c=function(){var ja;return z(ja=this.method.$$source_location)?ja:["(eval)",0]},c.$$arity=0);a.def(p,"$comments",l=function(){var ja;return z(ja=this.method.$$comments)?ja:[]},l.$$arity=0);a.def(p,"$call",I=function(ja){var da=I.$$p,ma=da||J;da&&(I.$$p=null);da&&(I.$$p=null);da=a.slice.call(arguments,0, -arguments.length);this.method.$$p=ma;return this.method.apply(this.receiver,da)},I.$$arity=-1);a.alias(p,"[]","call");a.def(p,"$>>",e=function(ja){return this.method["$>>"](ja)},e.$$arity=1);a.def(p,"$<<",n=function(ja){return this.method["$<<"](ja)},n.$$arity=1);a.def(p,"$unbind",L=function(){return t(x,"UnboundMethod").$new(this.receiver.$class(),this.owner,this.method,this.name)},L.$$arity=0);a.def(p,"$to_proc",D=function(){var ja=this.$call.bind(this);ja.$$unbound=this.method;ja.$$is_lambda=!0; -ja.$$arity=this.method.$$arity;ja.$$parameters=this.method.$$parameters;return ja},D.$$arity=0);return(a.def(p,"$inspect",R=function(){return"#<"+this.$class()+": "+this.receiver.$class()+"#"+this.name+" (defined in "+this.owner+" in "+this.$source_location().$join(":")+")>"},R.$$arity=0),J)&&"inspect"})(y[0],null,y);return function(p,$super,H){p=w(p,$super,"UnboundMethod");var x=[p].concat(H),k,m,u,c,l,I,e;p.$$prototype.method=p.$$prototype.owner=p.$$prototype.name=p.$$prototype.source=J;p.$attr_reader("source", +Opal.modules["corelib/method"]=function(a){var y=[],J=a.nil,t=a.$$,w=a.klass,z=a.truthy;a.add_stubs("$attr_reader $arity $>> $<< $new $class $join $source_location $raise".split(" "));(function(p,$super,H){p=w(p,$super,"Method");var x=[p].concat(H),k,m,u,c,l,I,e,n,L,D,R;p.$$prototype.method=p.$$prototype.receiver=p.$$prototype.owner=p.$$prototype.name=J;p.$attr_reader("owner","receiver","name");a.def(p,"$initialize",k=function(ia,da,ma,b){this.receiver=ia;this.owner=da;this.name=b;return this.method= +ma},k.$$arity=4);a.def(p,"$arity",m=function(){return this.method.$arity()},m.$$arity=0);a.def(p,"$parameters",u=function(){return this.method.$$parameters},u.$$arity=0);a.def(p,"$source_location",c=function(){var ia;return z(ia=this.method.$$source_location)?ia:["(eval)",0]},c.$$arity=0);a.def(p,"$comments",l=function(){var ia;return z(ia=this.method.$$comments)?ia:[]},l.$$arity=0);a.def(p,"$call",I=function(ia){var da=I.$$p,ma=da||J;da&&(I.$$p=null);da&&(I.$$p=null);da=a.slice.call(arguments,0, +arguments.length);this.method.$$p=ma;return this.method.apply(this.receiver,da)},I.$$arity=-1);a.alias(p,"[]","call");a.def(p,"$>>",e=function(ia){return this.method["$>>"](ia)},e.$$arity=1);a.def(p,"$<<",n=function(ia){return this.method["$<<"](ia)},n.$$arity=1);a.def(p,"$unbind",L=function(){return t(x,"UnboundMethod").$new(this.receiver.$class(),this.owner,this.method,this.name)},L.$$arity=0);a.def(p,"$to_proc",D=function(){var ia=this.$call.bind(this);ia.$$unbound=this.method;ia.$$is_lambda=!0; +ia.$$arity=this.method.$$arity;ia.$$parameters=this.method.$$parameters;return ia},D.$$arity=0);return(a.def(p,"$inspect",R=function(){return"#<"+this.$class()+": "+this.receiver.$class()+"#"+this.name+" (defined in "+this.owner+" in "+this.$source_location().$join(":")+")>"},R.$$arity=0),J)&&"inspect"})(y[0],null,y);return function(p,$super,H){p=w(p,$super,"UnboundMethod");var x=[p].concat(H),k,m,u,c,l,I,e;p.$$prototype.method=p.$$prototype.owner=p.$$prototype.name=p.$$prototype.source=J;p.$attr_reader("source", "owner","name");a.def(p,"$initialize",k=function(n,L,D,R){this.source=n;this.owner=L;this.method=D;return this.name=R},k.$$arity=4);a.def(p,"$arity",m=function(){return this.method.$arity()},m.$$arity=0);a.def(p,"$parameters",u=function(){return this.method.$$parameters},u.$$arity=0);a.def(p,"$source_location",c=function(){var n;return z(n=this.method.$$source_location)?n:["(eval)",0]},c.$$arity=0);a.def(p,"$comments",l=function(){var n;return z(n=this.method.$$comments)?n:[]},l.$$arity=0);a.def(p, "$bind",I=function(n){if(this.owner.$$is_module||a.is_a(n,this.owner))return t(x,"Method").$new(n,this.owner,this.method,this.name);this.$raise(t(x,"TypeError"),"can't bind singleton method to a different class (expected "+n+".kind_of?("+this.owner+" to be true)")},I.$$arity=1);return(a.def(p,"$inspect",e=function(){return"#<"+this.$class()+": "+this.source+"#"+this.name+" (defined in "+this.owner+" in "+this.$source_location().$join(":")+")>"},e.$$arity=0),J)&&"inspect"}(y[0],null,y)}; Opal.modules["corelib/variables"]=function(a){var y=[],J=a.nil,t=a.$$,w=a.gvars,z=a.hash2;a.add_stubs(["$new"]);w["&"]=w["~"]=w["`"]=w["'"]=J;w.LOADED_FEATURES=w['"']=a.loaded_features;w.LOAD_PATH=w[":"]=[];w["/"]="\n";w[","]=J;a.const_set(y[0],"ARGV",[]);a.const_set(y[0],"ARGF",t(y,"Object").$new());a.const_set(y[0],"ENV",z([],{}));w.VERBOSE=!1;w.DEBUG=!1;return w.SAFE=0}; Opal.modules["corelib/io"]=function(a){function y(u,c){return"number"===typeof u&&"number"===typeof c?u-c:u["$-"](c)}var J=[],t=a.nil,w=a.$$$,z=a.$$,p=a.klass,d=a.module,H=a.gvars,x=a.send,k=t;a.add_stubs("$attr_accessor $size $write $String $chomp $getbyte $getc $raise $new $write_proc= $- $extend".split(" "));(function(u,$super,l){u=p(u,$super,"IO");l=[u].concat(l);var I,e,n,L;u.$$prototype.tty=u.$$prototype.closed=t;a.const_set(l[0],"SEEK_SET",0);a.const_set(l[0],"SEEK_CUR",1);a.const_set(l[0], -"SEEK_END",2);a.def(u,"$tty?",I=function(){return this.tty},I.$$arity=0);a.def(u,"$closed?",e=function(){return this.closed},e.$$arity=0);u.$attr_accessor("write_proc");a.def(u,"$write",n=function(D){this.write_proc(D);return D.$size()},n.$$arity=1);u.$attr_accessor("sync","tty");a.def(u,"$flush",L=function(){return t},L.$$arity=0);(function(D,R){D=d(D,"Writable");[D].concat(R);var ja,da,ma;a.def(D,"$<<",ja=function(b){this.$write(b);return this},ja.$$arity=1);a.def(D,"$print",da=function(b){null== -H[","]&&(H[","]=t);var h=a.slice.call(arguments,0,arguments.length);for(var f=0,q=h.length;f=h.length&&da.$raise(t(k,"ArgumentError"),"too few arguments");return h[pa]}function n(){switch(G){case -1:da.$raise(t(k,"ArgumentError"),"unnumbered("+E+") mixed with numbered");case -2:da.$raise(t(k,"ArgumentError"),"unnumbered("+E+") mixed with named")}G=E++;return e(G-1)}function L(pa){0pa&&da.$raise(t(k,"ArgumentError"),"invalid index - "+pa+"$");G=-1;return e(pa-1)}function D(){return void 0===Oa?n():Oa}function R(pa){var ea;for(ea="";;f++){f===q&&da.$raise(t(k,"ArgumentError"),"malformed format string - %*[0-9]");if(48>u.charCodeAt(f)||57pa&&da.$raise(t(k,"ArgumentError"),"invalid index - "+pa+"$");G=-1;return e(pa-1)}function D(){return void 0===Oa?n():Oa}function R(pa){var ha;for(ha="";;f++){f===q&&da.$raise(t(k,"ArgumentError"),"malformed format string - %*[0-9]");if(48>u.charCodeAt(f)||57":"}";Ba="";for(f++;;f++){f===q&&da.$raise(t(k,"ArgumentError"),"malformed name - unmatched parenthesis");if(u.charAt(f)===La)if(0"===La)continue a;else{M=Oa.toString();-1!==ua&&(M=M.slice(0,ua));if(ba& -2)for(;M.lengthA&&(ba|=2,A=-A);continue a;case ".":ba&128&&da.$raise(t(k,"ArgumentError"),"precision given twice");ba|=192;ua=0;f++;if("*"===u.charAt(f)){f++;ua=ja("precision");0>ua&&(ba&=-65);continue a}ua=R("precision");continue a;case "d":case "i":case "u":Ba=da.$Integer(D());if(0<=Ba){for(M=Ba.toString();M.lengthA&&(ba|=2,A=-A);continue a;case ".":ba&128&&da.$raise(t(k,"ArgumentError"),"precision given twice");ba|=192;ua=0;f++;if("*"===u.charAt(f)){f++;ua=ia("precision");0>ua&&(ba&=-65);continue a}ua=R("precision");continue a;case "d":case "i":case "u":Ba=da.$Integer(D());if(0<=Ba){for(M=Ba.toString();M.length>>0).toString(na).replace(sa,ya);M.lengthLa||La>=(-1===ua?6:ua)||(M=(-Ba).toPrecision(-1===ua?ba&1?6:void 0:ua))}if(ba&2)for(M="-"+M;M.length"},q.$$arity=0);a.def(n,"$each_byte",A=function(G){a.slice.call(arguments,0,arguments.length); return this.$raise(m(R,"NotImplementedError"))},A.$$arity=-1);a.def(n,"$bytesize",E=function(G){a.slice.call(arguments,0,arguments.length);return this.$raise(m(R,"NotImplementedError"))},E.$$arity=-1);(function(G,$super,ba){[u(G,$super,"EncodingError")].concat(ba);return x})(R[0],m(R,"StandardError"),R);return function(G,$super,ba){[u(G,$super,"CompatibilityError")].concat(ba);return x}(R[0],m(R,"EncodingError"),R)})(H[0],null,H);I(m(H,"Encoding"),"register",["UTF-8",c(["aliases","ascii"],{aliases:["CP65001"], -ascii:!0})],(J=function(){var n=null==J.$$s?this:J.$$s,L,D;a.def(n,"$each_byte",L=function(R){var ja=L.$$p,da=ja||x;ja&&(L.$$p=null);ja&&(L.$$p=null);ja=Infinity;for(var ma,b=R.length,h=null,f=0;fma){if(!h){if(56319ma){-1<(ja-=3)&&(a.yield1(da,239),a.yield1(da,191), -a.yield1(da,189));h=ma;continue}ma=(h-55296<<10|ma-56320)+65536}else h&&-1<(ja-=3)&&(a.yield1(da,239),a.yield1(da,191),a.yield1(da,189));h=null;if(128>ma){if(0>--ja)break;a.yield1(da,ma)}else if(2048>ma){if(0>(ja-=2))break;a.yield1(da,ma>>6|192);a.yield1(da,ma&63|128)}else if(65536>ma){if(0>(ja-=3))break;a.yield1(da,ma>>12|224);a.yield1(da,ma>>6&63|128);a.yield1(da,ma&63|128)}else if(1114112>ma){if(0>(ja-=4))break;a.yield1(da,ma>>18|240);a.yield1(da,ma>>12&63|128);a.yield1(da,ma>>6&63|128);a.yield1(da, -ma&63|128)}}},L.$$arity=1);return(a.def(n,"$bytesize",D=function(R){return R.$bytes().$length()},D.$$arity=1),x)&&"bytesize"},J.$$s=d,J.$$arity=0,J));I(m(H,"Encoding"),"register",["UTF-16LE"],(t=function(){var n=null==t.$$s?this:t.$$s,L,D;a.def(n,"$each_byte",L=function(R){var ja=L.$$p,da=ja||x;ja&&(L.$$p=null);ja&&(L.$$p=null);ja=0;for(var ma=R.length;ja>8)}},L.$$arity=1);return(a.def(n,"$bytesize",D=function(R){return R.$bytes().$length()}, -D.$$arity=1),x)&&"bytesize"},t.$$s=d,t.$$arity=0,t));I(m(H,"Encoding"),"register",["UTF-16BE"],(w=function(){var n=null==w.$$s?this:w.$$s,L,D;a.def(n,"$each_byte",L=function(R){var ja=L.$$p,da=ja||x;ja&&(L.$$p=null);ja&&(L.$$p=null);ja=0;for(var ma=R.length;ja>8);a.yield1(da,b&255)}},L.$$arity=1);return(a.def(n,"$bytesize",D=function(R){return R.$bytes().$length()},D.$$arity=1),x)&&"bytesize"},w.$$s=d,w.$$arity=0,w));I(m(H,"Encoding"),"register",["UTF-32LE"], -(z=function(){var n=null==z.$$s?this:z.$$s,L,D;a.def(n,"$each_byte",L=function(R){var ja=L.$$p,da=ja||x;ja&&(L.$$p=null);ja&&(L.$$p=null);ja=0;for(var ma=R.length;ja>8)}},L.$$arity=1);return(a.def(n,"$bytesize",D=function(R){return R.$bytes().$length()},D.$$arity=1),x)&&"bytesize"},z.$$s=d,z.$$arity=0,z));I(m(H,"Encoding"),"register",["ASCII-8BIT",c(["aliases","ascii","dummy"],{aliases:["BINARY","US-ASCII","ASCII"],ascii:!0,dummy:!0})], -(p=function(){var n=null==p.$$s?this:p.$$s,L,D;a.def(n,"$each_byte",L=function(R){var ja=L.$$p,da=ja||x;ja&&(L.$$p=null);ja&&(L.$$p=null);ja=0;for(var ma=R.length;ja>8)}},L.$$arity=1);return(a.def(n,"$bytesize",D=function(R){return R.$bytes().$length()},D.$$arity=1),x)&&"bytesize"},p.$$s=d,p.$$arity=0,p));(function(n,$super,D){n=u(n,$super,"String");var R=[n].concat(D),ja,da,ma,b,h,f,q,A,E;n.$$prototype.bytes=n.$$prototype.internal_encoding= -x;n.$attr_reader("encoding");n.$attr_reader("internal_encoding");a.defineProperty(String.prototype,"bytes",x);a.defineProperty(String.prototype,"encoding",k(m(R,"Encoding"),"UTF_8"));a.defineProperty(String.prototype,"internal_encoding",k(m(R,"Encoding"),"UTF_8"));a.def(n,"$bytes",ja=function(){var G=x;this.bytes=l(G=this.bytes)?G:this.$each_byte().$to_a();return this.bytes.$dup()},ja.$$arity=0);a.def(n,"$bytesize",da=function(){return this.internal_encoding.$bytesize(this)},da.$$arity=0);a.def(n, +ascii:!0})],(J=function(){var n=null==J.$$s?this:J.$$s,L,D;a.def(n,"$each_byte",L=function(R){var ia=L.$$p,da=ia||x;ia&&(L.$$p=null);ia&&(L.$$p=null);ia=Infinity;for(var ma,b=R.length,h=null,f=0;fma){if(!h){if(56319ma){-1<(ia-=3)&&(a.yield1(da,239),a.yield1(da,191), +a.yield1(da,189));h=ma;continue}ma=(h-55296<<10|ma-56320)+65536}else h&&-1<(ia-=3)&&(a.yield1(da,239),a.yield1(da,191),a.yield1(da,189));h=null;if(128>ma){if(0>--ia)break;a.yield1(da,ma)}else if(2048>ma){if(0>(ia-=2))break;a.yield1(da,ma>>6|192);a.yield1(da,ma&63|128)}else if(65536>ma){if(0>(ia-=3))break;a.yield1(da,ma>>12|224);a.yield1(da,ma>>6&63|128);a.yield1(da,ma&63|128)}else if(1114112>ma){if(0>(ia-=4))break;a.yield1(da,ma>>18|240);a.yield1(da,ma>>12&63|128);a.yield1(da,ma>>6&63|128);a.yield1(da, +ma&63|128)}}},L.$$arity=1);return(a.def(n,"$bytesize",D=function(R){return R.$bytes().$length()},D.$$arity=1),x)&&"bytesize"},J.$$s=d,J.$$arity=0,J));I(m(H,"Encoding"),"register",["UTF-16LE"],(t=function(){var n=null==t.$$s?this:t.$$s,L,D;a.def(n,"$each_byte",L=function(R){var ia=L.$$p,da=ia||x;ia&&(L.$$p=null);ia&&(L.$$p=null);ia=0;for(var ma=R.length;ia>8)}},L.$$arity=1);return(a.def(n,"$bytesize",D=function(R){return R.$bytes().$length()}, +D.$$arity=1),x)&&"bytesize"},t.$$s=d,t.$$arity=0,t));I(m(H,"Encoding"),"register",["UTF-16BE"],(w=function(){var n=null==w.$$s?this:w.$$s,L,D;a.def(n,"$each_byte",L=function(R){var ia=L.$$p,da=ia||x;ia&&(L.$$p=null);ia&&(L.$$p=null);ia=0;for(var ma=R.length;ia>8);a.yield1(da,b&255)}},L.$$arity=1);return(a.def(n,"$bytesize",D=function(R){return R.$bytes().$length()},D.$$arity=1),x)&&"bytesize"},w.$$s=d,w.$$arity=0,w));I(m(H,"Encoding"),"register",["UTF-32LE"], +(z=function(){var n=null==z.$$s?this:z.$$s,L,D;a.def(n,"$each_byte",L=function(R){var ia=L.$$p,da=ia||x;ia&&(L.$$p=null);ia&&(L.$$p=null);ia=0;for(var ma=R.length;ia>8)}},L.$$arity=1);return(a.def(n,"$bytesize",D=function(R){return R.$bytes().$length()},D.$$arity=1),x)&&"bytesize"},z.$$s=d,z.$$arity=0,z));I(m(H,"Encoding"),"register",["ASCII-8BIT",c(["aliases","ascii","dummy"],{aliases:["BINARY","US-ASCII","ASCII"],ascii:!0,dummy:!0})], +(p=function(){var n=null==p.$$s?this:p.$$s,L,D;a.def(n,"$each_byte",L=function(R){var ia=L.$$p,da=ia||x;ia&&(L.$$p=null);ia&&(L.$$p=null);ia=0;for(var ma=R.length;ia>8)}},L.$$arity=1);return(a.def(n,"$bytesize",D=function(R){return R.$bytes().$length()},D.$$arity=1),x)&&"bytesize"},p.$$s=d,p.$$arity=0,p));(function(n,$super,D){n=u(n,$super,"String");var R=[n].concat(D),ia,da,ma,b,h,f,q,A,E;n.$$prototype.bytes=n.$$prototype.internal_encoding= +x;n.$attr_reader("encoding");n.$attr_reader("internal_encoding");a.defineProperty(String.prototype,"bytes",x);a.defineProperty(String.prototype,"encoding",k(m(R,"Encoding"),"UTF_8"));a.defineProperty(String.prototype,"internal_encoding",k(m(R,"Encoding"),"UTF_8"));a.def(n,"$bytes",ia=function(){var G=x;this.bytes=l(G=this.bytes)?G:this.$each_byte().$to_a();return this.bytes.$dup()},ia.$$arity=0);a.def(n,"$bytesize",da=function(){return this.internal_encoding.$bytesize(this)},da.$$arity=0);a.def(n, "$each_byte",ma=function(){var G=ma.$$p,M=G||x;G&&(ma.$$p=null);G&&(ma.$$p=null);if(M===x)return this.$enum_for("each_byte");I(this.internal_encoding,"each_byte",[this],M.$to_proc());return this},ma.$$arity=0);a.def(n,"$each_codepoint",b=function(){var G=b.$$p,M=G||x;G&&(b.$$p=null);G&&(b.$$p=null);if(M===x)return this.$enum_for("each_codepoint");G=0;for(var ba=this.length;GS)return-Math.cbrt(-S);for(var sa=S,ya=0;.125>sa;)sa*=8,ya--;for(;1ya;)sa*=.5,ya++;for(;0S&&(sa=-1);S=Math.abs(S);var ya=1/(1+.3275911*S);return sa*(1-((((1.061405429*ya+-1.453152027)*ya+1.421413741)*ya+-.284496736)*ya+.254829592)*ya*Math.exp(-S*S))});a.def(d,"$erf",ma=function(S){return t(x,"Math").$checked("erf",t(x,"Math")["$float!"](S))},ma.$$arity=1);p("undefined"!==typeof Math.erfc)||a.defineProperty(Math,"erfc",function(S){var sa=Math.abs(S),ya=1/(.5*sa+1);sa=ya*Math.exp(-sa*sa-1.26551223+ya*(ya*(ya*(ya*(ya*(ya*(ya*(ya*(.17087277*ya+-.82215223)+1.48851587)+ -1.13520398)+.27886807)+-.18628806)+.09678418)+.37409196)+1.00002368));return 0>S?2-sa:sa});a.def(d,"$erfc",b=function(S){return t(x,"Math").$checked("erfc",t(x,"Math")["$float!"](S))},b.$$arity=1);a.def(d,"$exp",h=function(S){return t(x,"Math").$checked("exp",t(x,"Math")["$float!"](S))},h.$$arity=1);a.def(d,"$frexp",f=function(S){S=t(x,"Math")["$float!"](S);if(isNaN(S))return[NaN,0];var sa=Math.floor(Math.log(Math.abs(S))/Math.log(2))+1;return[S/Math.pow(2,sa),sa]},f.$$arity=1);a.def(d,"$gamma", q=function(S){S=t(x,"Math")["$float!"](S);var sa=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3.399464998481189E-5,4.652362892704858E-5,-9.837447530487956E-5,1.580887032249125E-4,-2.1026444172410488E-4,2.1743961811521265E-4,-1.643181065367639E-4,8.441822398385275E-5,-2.6190838401581408E-5,3.6899182659531625E-6];if(isNaN(S))return NaN;if(0===S&&0>1/S)return-Infinity;-1!==S&&-Infinity!==S||this.$raise(t(x,"DomainError"),'Numerical argument is out of domain - "gamma"'); -if(t(x,"Integer")["$==="](S)){if(0>=S)return isFinite(S)?Infinity:NaN;if(171S)return Math.PI/(Math.sin(Math.PI*S)*t(x,"Math").$gamma("number"===typeof S?1-S:1["$-"](S)));if(171.35<=S)return Infinity;if(85=S)return isFinite(S)?Infinity:NaN;if(171S)return Math.PI/(Math.sin(Math.PI*S)*t(x,"Math").$gamma("number"===typeof S?1-S:1["$-"](S)));if(171.35<=S)return Infinity;if(85t(x,"Math").$gamma(S)?-1:1]},G.$$arity=1);a.def(d,"$log",M=function(S,sa){p(t(x,"String")["$==="](S))&&this.$raise(w(S,t(x,"Float")));if(p(null==sa))return t(x,"Math").$checked("log",t(x,"Math")["$float!"](S));p(t(x,"String")["$==="](sa))&&this.$raise(w(sa,t(x,"Float")));S=t(x,"Math").$checked("log",t(x,"Math")["$float!"](S));sa=t(x,"Math").$checked("log",t(x, "Math")["$float!"](sa));return"number"===typeof S&&"number"===typeof sa?S/sa:S["$/"](sa)},M.$$arity=-2);p("undefined"!==typeof Math.log10)||(Math.log10=function(S){return Math.log(S)/Math.LN10});a.def(d,"$log10",ba=function(S){p(t(x,"String")["$==="](S))&&this.$raise(w(S,t(x,"Float")));return t(x,"Math").$checked("log10",t(x,"Math")["$float!"](S))},ba.$$arity=1);p("undefined"!==typeof Math.log2)||(Math.log2=function(S){return Math.log(S)/Math.LN2});a.def(d,"$log2",ua=function(S){p(t(x,"String")["$==="](S))&& -this.$raise(w(S,t(x,"Float")));return t(x,"Math").$checked("log2",t(x,"Math")["$float!"](S))},ua.$$arity=1);a.def(d,"$sin",Oa=function(S){return t(x,"Math").$checked("sin",t(x,"Math")["$float!"](S))},Oa.$$arity=1);p("undefined"!==typeof Math.sinh)||(Math.sinh=function(S){return(Math.exp(S)-Math.exp(-S))/2});a.def(d,"$sinh",xa=function(S){return t(x,"Math").$checked("sinh",t(x,"Math")["$float!"](S))},xa.$$arity=1);a.def(d,"$sqrt",Ba=function(S){return t(x,"Math").$checked("sqrt",t(x,"Math")["$float!"](S))}, +this.$raise(w(S,t(x,"Float")));return t(x,"Math").$checked("log2",t(x,"Math")["$float!"](S))},ua.$$arity=1);a.def(d,"$sin",Oa=function(S){return t(x,"Math").$checked("sin",t(x,"Math")["$float!"](S))},Oa.$$arity=1);p("undefined"!==typeof Math.sinh)||(Math.sinh=function(S){return(Math.exp(S)-Math.exp(-S))/2});a.def(d,"$sinh",wa=function(S){return t(x,"Math").$checked("sinh",t(x,"Math")["$float!"](S))},wa.$$arity=1);a.def(d,"$sqrt",Ba=function(S){return t(x,"Math").$checked("sqrt",t(x,"Math")["$float!"](S))}, Ba.$$arity=1);a.def(d,"$tan",La=function(S){S=t(x,"Math")["$float!"](S);return p(S["$infinite?"]())?J(t(x,"Float"),"NAN"):t(x,"Math").$checked("tan",t(x,"Math")["$float!"](S))},La.$$arity=1);p("undefined"!==typeof Math.tanh)||(Math.tanh=function(S){return Infinity==S?1:-Infinity==S?-1:(Math.exp(S)-Math.exp(-S))/(Math.exp(S)+Math.exp(-S))});a.def(d,"$tanh",na=function(S){return t(x,"Math").$checked("tanh",t(x,"Math")["$float!"](S))},na.$$arity=1)}(y[0],y)}; Opal.modules["corelib/complex"]=function(a){function y(c,l){return"number"===typeof c&&"number"===typeof l?c*l:c["$*"](l)}function J(c,l){return"number"===typeof c&&"number"===typeof l?c+l:c["$+"](l)}function t(c,l){return"number"===typeof c&&"number"===typeof l?c-l:c["$-"](l)}function w(c,l){return"number"===typeof c&&"number"===typeof l?c/l:c["$/"](l)}var z=a.top,p=[],d=a.nil,H=a.$$$,x=a.$$,k=a.klass,m=a.truthy,u=a.module;a.add_stubs("$require $=== $real? $raise $new $* $cos $sin $attr_reader $class $== $real $imag $Complex $-@ $+ $__coerced__ $- $nan? $/ $conj $abs2 $quo $polar $exp $log $> $!= $divmod $** $hypot $atan2 $lcm $denominator $finite? $infinite? $numerator $abs $arg $rationalize $to_f $to_i $to_r $inspect $positive? $zero? $Rational".split(" ")); -z.$require("corelib/numeric");(function(c,$super,I){c=k(c,$super,"Complex");var e=[c].concat(I),n,L,D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,xa,Ba,La,na,S,sa,ya,pa,ea,F,V,ka,va;c.$$prototype.real=c.$$prototype.imag=d;a.defs(c,"$rect",n=function(ia,wa){var Ha=d,Ea=d,Qa=d;null==wa&&(wa=0);m(m(Ha=m(Ea=m(Qa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():Qa)?x(e,"Numeric")["$==="](wa):Ea)?wa["$real?"]():Ha)||this.$raise(x(e,"TypeError"),"not a real");return this.$new(ia,wa)},n.$$arity=-2);(function(ia,wa){[ia].concat(wa); -return a.alias(ia,"rectangular","rect")})(a.get_singleton_class(c),e);a.defs(c,"$polar",L=function(ia,wa){var Ha=d,Ea=d,Qa=d;null==wa&&(wa=0);m(m(Ha=m(Ea=m(Qa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():Qa)?x(e,"Numeric")["$==="](wa):Ea)?wa["$real?"]():Ha)||this.$raise(x(e,"TypeError"),"not a real");return this.$new(y(ia,x(e,"Math").$cos(wa)),y(ia,x(e,"Math").$sin(wa)))},L.$$arity=-2);c.$attr_reader("real","imag");a.def(c,"$initialize",D=function(ia,wa){null==wa&&(wa=0);this.real=ia;return this.imag= -wa},D.$$arity=-2);a.def(c,"$coerce",R=function(ia){var wa=d;return m(x(e,"Complex")["$==="](ia))?[ia,this]:m(m(wa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():wa)?[x(e,"Complex").$new(ia,0),this]:this.$raise(x(e,"TypeError"),""+ia.$class()+" can't be coerced into Complex")},R.$$arity=1);a.def(c,"$==",ja=function(ia){var wa=d,Ha=d,Ea=d;return m(x(e,"Complex")["$==="](ia))?m(wa=this.real["$=="](ia.$real()))?this.imag["$=="](ia.$imag()):wa:m(m(Ha=x(e,"Numeric")["$==="](ia))?ia["$real?"]():Ha)?m(Ea=this.real["$=="](ia))? -this.imag["$=="](0):Ea:ia["$=="](this)},ja.$$arity=1);a.def(c,"$-@",da=function(){return this.$Complex(this.real["$-@"](),this.imag["$-@"]())},da.$$arity=0);a.def(c,"$+",ma=function(ia){var wa=d;return m(x(e,"Complex")["$==="](ia))?this.$Complex(J(this.real,ia.$real()),J(this.imag,ia.$imag())):m(m(wa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():wa)?this.$Complex(J(this.real,ia),this.imag):this.$__coerced__("+",ia)},ma.$$arity=1);a.def(c,"$-",b=function(ia){var wa=d;return m(x(e,"Complex")["$==="](ia))? -this.$Complex(t(this.real,ia.$real()),t(this.imag,ia.$imag())):m(m(wa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():wa)?this.$Complex(t(this.real,ia),this.imag):this.$__coerced__("-",ia)},b.$$arity=1);a.def(c,"$*",h=function(ia){var wa=d;return m(x(e,"Complex")["$==="](ia))?this.$Complex(t(y(this.real,ia.$real()),y(this.imag,ia.$imag())),J(y(this.real,ia.$imag()),y(this.imag,ia.$real()))):m(m(wa=x(e,"Numeric")["$==="](ia))?ia["$real?"]():wa)?this.$Complex(y(this.real,ia),y(this.imag,ia)):this.$__coerced__("*", -ia)},h.$$arity=1);a.def(c,"$/",f=function(ia){var wa=d,Ha=d,Ea=d,Qa=d,Sa=d,Ia=d,kb=d,Ra=d;return m(x(e,"Complex")["$==="](ia))?m(m(wa=m(Ha=m(Ea=m(Qa=x(e,"Number")["$==="](this.real))?this.real["$nan?"]():Qa)?Ea:m(Sa=x(e,"Number")["$==="](this.imag))?this.imag["$nan?"]():Sa)?Ha:m(Ia=x(e,"Number")["$==="](ia.$real()))?ia.$real()["$nan?"]():Ia)?wa:m(kb=x(e,"Number")["$==="](ia.$imag()))?ia.$imag()["$nan?"]():kb)?x(e,"Complex").$new(H(x(e,"Float"),"NAN"),H(x(e,"Float"),"NAN")):w(y(this,ia.$conj()),ia.$abs2()): -m(m(Ra=x(e,"Numeric")["$==="](ia))?ia["$real?"]():Ra)?this.$Complex(this.real.$quo(ia),this.imag.$quo(ia)):this.$__coerced__("/",ia)},f.$$arity=1);a.def(c,"$**",q=function(ia){var wa=d;if(ia["$=="](0))return x(e,"Complex").$new(1,0);if(m(x(e,"Complex")["$==="](ia))){wa=this.$polar();var Ha=a.to_ary(wa);var Ea=null==Ha[0]?d:Ha[0];Ha=null==Ha[1]?d:Ha[1];wa;wa=ia.$real();var Qa=ia.$imag();ia=x(e,"Math").$exp(t(y(wa,x(e,"Math").$log(Ea)),y(Qa,Ha)));wa=J(y(Ha,wa),y(Qa,x(e,"Math").$log(Ea)));return x(e, -"Complex").$polar(ia,wa)}if(m(x(e,"Integer")["$==="](ia))){if(m("number"===typeof ia?0"](0))){Ha=Ea=this;for(Qa=t(ia,1);m(Qa["$!="](0));){ia=Qa.$divmod(2);wa=a.to_ary(ia);var Sa=null==wa[0]?d:wa[0];var Ia=null==wa[1]?d:wa[1];for(ia;Ia["$=="](0);)Ea=this.$Complex(t(y(Ea.$real(),Ea.$real()),y(Ea.$imag(),Ea.$imag())),y(y(2,Ea.$real()),Ea.$imag())),Qa=Sa,wa=Qa.$divmod(2),ia=a.to_ary(wa),Sa=null==ia[0]?d:ia[0],Ia=null==ia[1]?d:ia[1],wa;Ha=y(Ha,Ea);Qa=t(Qa,1)}return Ha}return w(x(e,"Rational").$new(1, -1),this)["$**"](ia["$-@"]())}return m(m(wa=x(e,"Float")["$==="](ia))?wa:x(e,"Rational")["$==="](ia))?(wa=this.$polar(),Ha=a.to_ary(wa),Ea=null==Ha[0]?d:Ha[0],Ha=null==Ha[1]?d:Ha[1],wa,x(e,"Complex").$polar(Ea["$**"](ia),y(Ha,ia))):this.$__coerced__("**",ia)},q.$$arity=1);a.def(c,"$abs",A=function(){return x(e,"Math").$hypot(this.real,this.imag)},A.$$arity=0);a.def(c,"$abs2",E=function(){return J(y(this.real,this.real),y(this.imag,this.imag))},E.$$arity=0);a.def(c,"$angle",G=function(){return x(e, -"Math").$atan2(this.imag,this.real)},G.$$arity=0);a.alias(c,"arg","angle");a.def(c,"$conj",M=function(){return this.$Complex(this.real,this.imag["$-@"]())},M.$$arity=0);a.alias(c,"conjugate","conj");a.def(c,"$denominator",ba=function(){return this.real.$denominator().$lcm(this.imag.$denominator())},ba.$$arity=0);a.alias(c,"divide","/");a.def(c,"$eql?",ua=function(ia){var wa=d,Ha=d;return m(wa=m(Ha=x(e,"Complex")["$==="](ia))?this.real.$class()["$=="](this.imag.$class()):Ha)?this["$=="](ia):wa},ua.$$arity= -1);a.def(c,"$fdiv",Oa=function(ia){m(x(e,"Numeric")["$==="](ia))||this.$raise(x(e,"TypeError"),""+ia.$class()+" can't be coerced into Complex");return w(this,ia)},Oa.$$arity=1);a.def(c,"$finite?",xa=function(){var ia;return m(ia=this.real["$finite?"]())?this.imag["$finite?"]():ia},xa.$$arity=0);a.def(c,"$hash",Ba=function(){return"Complex:"+this.real+":"+this.imag},Ba.$$arity=0);a.alias(c,"imaginary","imag");a.def(c,"$infinite?",La=function(){var ia;return m(ia=this.real["$infinite?"]())?ia:this.imag["$infinite?"]()}, -La.$$arity=0);a.def(c,"$inspect",na=function(){return"("+this+")"},na.$$arity=0);a.alias(c,"magnitude","abs");a.udef(c,"$negative?");a.def(c,"$numerator",S=function(){var ia=this.$denominator();return this.$Complex(y(this.real.$numerator(),w(ia,this.real.$denominator())),y(this.imag.$numerator(),w(ia,this.imag.$denominator())))},S.$$arity=0);a.alias(c,"phase","arg");a.def(c,"$polar",sa=function(){return[this.$abs(),this.$arg()]},sa.$$arity=0);a.udef(c,"$positive?");a.alias(c,"quo","/");a.def(c,"$rationalize", -ya=function(ia){1"](0))){Ha=Ea=this;for(Qa=t(ja,1);m(Qa["$!="](0));){ja=Qa.$divmod(2);xa=a.to_ary(ja);var Ra=null==xa[0]?d:xa[0];var Ia=null==xa[1]?d:xa[1];for(ja;Ia["$=="](0);)Ea=this.$Complex(t(y(Ea.$real(),Ea.$real()),y(Ea.$imag(),Ea.$imag())),y(y(2,Ea.$real()),Ea.$imag())),Qa=Ra,xa=Qa.$divmod(2),ja=a.to_ary(xa),Ra=null==ja[0]?d:ja[0],Ia=null==ja[1]?d:ja[1],xa;Ha=y(Ha,Ea);Qa=t(Qa,1)}return Ha}return w(x(e,"Rational").$new(1, +1),this)["$**"](ja["$-@"]())}return m(m(xa=x(e,"Float")["$==="](ja))?xa:x(e,"Rational")["$==="](ja))?(xa=this.$polar(),Ha=a.to_ary(xa),Ea=null==Ha[0]?d:Ha[0],Ha=null==Ha[1]?d:Ha[1],xa,x(e,"Complex").$polar(Ea["$**"](ja),y(Ha,ja))):this.$__coerced__("**",ja)},q.$$arity=1);a.def(c,"$abs",A=function(){return x(e,"Math").$hypot(this.real,this.imag)},A.$$arity=0);a.def(c,"$abs2",E=function(){return J(y(this.real,this.real),y(this.imag,this.imag))},E.$$arity=0);a.def(c,"$angle",G=function(){return x(e, +"Math").$atan2(this.imag,this.real)},G.$$arity=0);a.alias(c,"arg","angle");a.def(c,"$conj",M=function(){return this.$Complex(this.real,this.imag["$-@"]())},M.$$arity=0);a.alias(c,"conjugate","conj");a.def(c,"$denominator",ba=function(){return this.real.$denominator().$lcm(this.imag.$denominator())},ba.$$arity=0);a.alias(c,"divide","/");a.def(c,"$eql?",ua=function(ja){var xa=d,Ha=d;return m(xa=m(Ha=x(e,"Complex")["$==="](ja))?this.real.$class()["$=="](this.imag.$class()):Ha)?this["$=="](ja):xa},ua.$$arity= +1);a.def(c,"$fdiv",Oa=function(ja){m(x(e,"Numeric")["$==="](ja))||this.$raise(x(e,"TypeError"),""+ja.$class()+" can't be coerced into Complex");return w(this,ja)},Oa.$$arity=1);a.def(c,"$finite?",wa=function(){var ja;return m(ja=this.real["$finite?"]())?this.imag["$finite?"]():ja},wa.$$arity=0);a.def(c,"$hash",Ba=function(){return"Complex:"+this.real+":"+this.imag},Ba.$$arity=0);a.alias(c,"imaginary","imag");a.def(c,"$infinite?",La=function(){var ja;return m(ja=this.real["$infinite?"]())?ja:this.imag["$infinite?"]()}, +La.$$arity=0);a.def(c,"$inspect",na=function(){return"("+this+")"},na.$$arity=0);a.alias(c,"magnitude","abs");a.udef(c,"$negative?");a.def(c,"$numerator",S=function(){var ja=this.$denominator();return this.$Complex(y(this.real.$numerator(),w(ja,this.real.$denominator())),y(this.imag.$numerator(),w(ja,this.imag.$denominator())))},S.$$arity=0);a.alias(c,"phase","arg");a.def(c,"$polar",sa=function(){return[this.$abs(),this.$arg()]},sa.$$arity=0);a.udef(c,"$positive?");a.alias(c,"quo","/");a.def(c,"$rationalize", +ya=function(ja){1 $- $* $__coerced__ $+ $Rational $> $** $abs $ceil $with_precision $floor $<= $truncate $send $convert".split(" "));p.$require("corelib/numeric");(function(l,$super,e){l=m(l,$super,"Rational");var n=[l].concat(e),L,D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,xa,Ba,La,na,S,sa,ya,pa,ea;l.$$prototype.num=l.$$prototype.den=H;a.defs(l,"$reduce",L=function(F,V){F=F.$to_i(); -V=V.$to_i();if(V["$=="](0))this.$raise(k(n,"ZeroDivisionError"),"divided by 0");else if(u(y(V,0)))F=F["$-@"](),V=V["$-@"]();else if(V["$=="](1))return this.$new(F,V);var ka=F.$gcd(V);return this.$new(J(F,ka),J(V,ka))},L.$$arity=2);a.defs(l,"$convert",D=function(F,V){var ka=H,va=H,ia=H,wa=H,Ha=H,Ea=H,Qa=H,Sa=H;u(u(ka=F["$nil?"]())?ka:V["$nil?"]())&&this.$raise(k(n,"TypeError"),"cannot convert nil into Rational");if(u(u(va=k(n,"Integer")["$==="](F))?k(n,"Integer")["$==="](V):va))return this.$reduce(F, -V);u(u(ia=u(wa=k(n,"Float")["$==="](F))?wa:k(n,"String")["$==="](F))?ia:k(n,"Complex")["$==="](F))&&(F=F.$to_r());u(u(Ha=u(Ea=k(n,"Float")["$==="](V))?Ea:k(n,"String")["$==="](V))?Ha:k(n,"Complex")["$==="](V))&&(V=V.$to_r());return u(u(Qa=V["$equal?"](1))?k(n,"Integer")["$==="](F)["$!"]():Qa)?k(n,"Opal")["$coerce_to!"](F,k(n,"Rational"),"to_r"):u(u(Sa=k(n,"Numeric")["$==="](F))?k(n,"Numeric")["$==="](V):Sa)?J(F,V):this.$reduce(F,V)},D.$$arity=2);a.def(l,"$initialize",R=function(F,V){this.num=F;return this.den= -V},R.$$arity=2);a.def(l,"$numerator",ja=function(){return this.num},ja.$$arity=0);a.def(l,"$denominator",da=function(){return this.den},da.$$arity=0);a.def(l,"$coerce",ma=function(F){return k(n,"Rational")["$==="](F)?[F,this]:k(n,"Integer")["$==="](F)?[F.$to_r(),this]:k(n,"Float")["$==="](F)?[F,this.$to_f()]:H},ma.$$arity=1);a.def(l,"$==",b=function(F){var V=H,ka=H;return k(n,"Rational")["$==="](F)?u(V=this.num["$=="](F.$numerator()))?this.den["$=="](F.$denominator()):V:k(n,"Integer")["$==="](F)? +a.add_stubs("$require $to_i $== $raise $< $-@ $new $gcd $/ $nil? $=== $reduce $to_r $equal? $! $coerce_to! $to_f $numerator $denominator $<=> $- $* $__coerced__ $+ $Rational $> $** $abs $ceil $with_precision $floor $<= $truncate $send $convert".split(" "));p.$require("corelib/numeric");(function(l,$super,e){l=m(l,$super,"Rational");var n=[l].concat(e),L,D,R,ia,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,wa,Ba,La,na,S,sa,ya,pa,ha;l.$$prototype.num=l.$$prototype.den=H;a.defs(l,"$reduce",L=function(F,V){F=F.$to_i(); +V=V.$to_i();if(V["$=="](0))this.$raise(k(n,"ZeroDivisionError"),"divided by 0");else if(u(y(V,0)))F=F["$-@"](),V=V["$-@"]();else if(V["$=="](1))return this.$new(F,V);var ka=F.$gcd(V);return this.$new(J(F,ka),J(V,ka))},L.$$arity=2);a.defs(l,"$convert",D=function(F,V){var ka=H,va=H,ja=H,xa=H,Ha=H,Ea=H,Qa=H,Ra=H;u(u(ka=F["$nil?"]())?ka:V["$nil?"]())&&this.$raise(k(n,"TypeError"),"cannot convert nil into Rational");if(u(u(va=k(n,"Integer")["$==="](F))?k(n,"Integer")["$==="](V):va))return this.$reduce(F, +V);u(u(ja=u(xa=k(n,"Float")["$==="](F))?xa:k(n,"String")["$==="](F))?ja:k(n,"Complex")["$==="](F))&&(F=F.$to_r());u(u(Ha=u(Ea=k(n,"Float")["$==="](V))?Ea:k(n,"String")["$==="](V))?Ha:k(n,"Complex")["$==="](V))&&(V=V.$to_r());return u(u(Qa=V["$equal?"](1))?k(n,"Integer")["$==="](F)["$!"]():Qa)?k(n,"Opal")["$coerce_to!"](F,k(n,"Rational"),"to_r"):u(u(Ra=k(n,"Numeric")["$==="](F))?k(n,"Numeric")["$==="](V):Ra)?J(F,V):this.$reduce(F,V)},D.$$arity=2);a.def(l,"$initialize",R=function(F,V){this.num=F;return this.den= +V},R.$$arity=2);a.def(l,"$numerator",ia=function(){return this.num},ia.$$arity=0);a.def(l,"$denominator",da=function(){return this.den},da.$$arity=0);a.def(l,"$coerce",ma=function(F){return k(n,"Rational")["$==="](F)?[F,this]:k(n,"Integer")["$==="](F)?[F.$to_r(),this]:k(n,"Float")["$==="](F)?[F,this.$to_f()]:H},ma.$$arity=1);a.def(l,"$==",b=function(F){var V=H,ka=H;return k(n,"Rational")["$==="](F)?u(V=this.num["$=="](F.$numerator()))?this.den["$=="](F.$denominator()):V:k(n,"Integer")["$==="](F)? u(ka=this.num["$=="](F))?this.den["$=="](1):ka:k(n,"Float")["$==="](F)?this.$to_f()["$=="](F):F["$=="](this)},b.$$arity=1);a.def(l,"$<=>",h=function(F){return k(n,"Rational")["$==="](F)?t(w(this.num,F.$denominator()),w(this.den,F.$numerator()))["$<=>"](0):k(n,"Integer")["$==="](F)?t(this.num,w(this.den,F))["$<=>"](0):k(n,"Float")["$==="](F)?this.$to_f()["$<=>"](F):this.$__coerced__("<=>",F)},h.$$arity=1);a.def(l,"$+",f=function(F){if(k(n,"Rational")["$==="](F)){var V=z(w(this.num,F.$denominator()), w(this.den,F.$numerator()));F=w(this.den,F.$denominator());V=this.$Rational(V,F)}else V=k(n,"Integer")["$==="](F)?this.$Rational(z(this.num,w(F,this.den)),this.den):k(n,"Float")["$==="](F)?z(this.$to_f(),F):this.$__coerced__("+",F);return V},f.$$arity=1);a.def(l,"$-",q=function(F){if(k(n,"Rational")["$==="](F)){var V=t(w(this.num,F.$denominator()),w(this.den,F.$numerator()));F=w(this.den,F.$denominator());V=this.$Rational(V,F)}else V=k(n,"Integer")["$==="](F)?this.$Rational(t(this.num,w(F,this.den)), this.den):k(n,"Float")["$==="](F)?t(this.$to_f(),F):this.$__coerced__("-",F);return V},q.$$arity=1);a.def(l,"$*",A=function(F){if(k(n,"Rational")["$==="](F)){var V=w(this.num,F.$numerator());F=w(this.den,F.$denominator());V=this.$Rational(V,F)}else V=k(n,"Integer")["$==="](F)?this.$Rational(w(this.num,F),this.den):k(n,"Float")["$==="](F)?w(this.$to_f(),F):this.$__coerced__("*",F);return V},A.$$arity=1);a.def(l,"$/",E=function(F){if(k(n,"Rational")["$==="](F)){var V=w(this.num,F.$denominator());F= w(this.den,F.$numerator());V=this.$Rational(V,F)}else V=k(n,"Integer")["$==="](F)?F["$=="](0)?J(this.$to_f(),0):this.$Rational(this.num,w(this.den,F)):k(n,"Float")["$==="](F)?J(this.$to_f(),F):this.$__coerced__("/",F);return V},E.$$arity=1);a.def(l,"$**",G=function(F){var V=H,ka=H;return k(n,"Integer")["$==="](F)?u(u(V=this["$=="](0))?y(F,0):V)?x(k(n,"Float"),"INFINITY"):u("number"===typeof F?0"](0))?this.$Rational(this.num["$**"](F),this.den["$**"](F)):u(y(F,0))?this.$Rational(this.den["$**"](F["$-@"]()), this.num["$**"](F["$-@"]())):this.$Rational(1,1):k(n,"Float")["$==="](F)?this.$to_f()["$**"](F):k(n,"Rational")["$==="](F)?F["$=="](0)?this.$Rational(1,1):F.$denominator()["$=="](1)?u(y(F,0))?this.$Rational(this.den["$**"](F.$numerator().$abs()),this.num["$**"](F.$numerator().$abs())):this.$Rational(this.num["$**"](F.$numerator()),this.den["$**"](F.$numerator())):u(u(ka=this["$=="](0))?y(F,0):ka)?this.$raise(k(n,"ZeroDivisionError"),"divided by 0"):this.$to_f()["$**"](F):this.$__coerced__("**",F)}, G.$$arity=1);a.def(l,"$abs",M=function(){return this.$Rational(this.num.$abs(),this.den.$abs())},M.$$arity=0);a.def(l,"$ceil",ba=function(F){null==F&&(F=0);return F["$=="](0)?J(this.num["$-@"](),this.den)["$-@"]().$ceil():this.$with_precision("ceil",F)},ba.$$arity=-1);a.alias(l,"divide","/");a.def(l,"$floor",ua=function(F){null==F&&(F=0);return F["$=="](0)?J(this.num["$-@"](),this.den)["$-@"]().$floor():this.$with_precision("floor",F)},ua.$$arity=-1);a.def(l,"$hash",Oa=function(){return"Rational:"+ -this.num+":"+this.den},Oa.$$arity=0);a.def(l,"$inspect",xa=function(){return"("+this+")"},xa.$$arity=0);a.alias(l,"quo","/");a.def(l,"$rationalize",Ba=function(F){1 $to_f $nil? $> $< $strftime $year $month $day $+ $round $/ $- $copy_instance_variables $initialize_dup $is_a? $zero? $wday $utc? $mon $yday $hour $min $sec $rjust $ljust $zone $to_s $[] $cweek_cyear $isdst $<= $!= $== $ceil".split(" ")); z.$require("corelib/comparable");return function(c,$super,I){function e(Aa,ta,Ma,Ta,Za,Fa){Aa=Aa.$$is_string?parseInt(Aa,10):H(L,"Opal")["$coerce_to!"](Aa,H(L,"Integer"),"to_int");if(ta===d)ta=1;else if(!ta.$$is_number)if(ta["$respond_to?"]("to_str"))switch(ta=ta.$to_str(),ta.toLowerCase()){case "jan":ta=1;break;case "feb":ta=2;break;case "mar":ta=3;break;case "apr":ta=4;break;case "may":ta=5;break;case "jun":ta=6;break;case "jul":ta=7;break;case "aug":ta=8;break;case "sep":ta=9;break;case "oct":ta= 10;break;case "nov":ta=11;break;case "dec":ta=12;break;default:ta=ta.$to_i()}else ta=H(L,"Opal")["$coerce_to!"](ta,H(L,"Integer"),"to_int");(1>ta||12Ma||31Ta||24Za||59Fa||60Za||59Fa||60Aa&&ta.setFullYear(Aa);return ta},R.$$arity=-1);a.defs(n,"$local",ja=function(Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T){null==ta&&(ta=d);null==Ma&&(Ma=d);null==Ta&&(Ta=d);null==Za&&(Za=d);null==Fa&&(Fa=d);null==Y&&(Y=d);null==Q&&(Q=d);null==Z&&(Z=d);null==T&&(T=d);if(10===arguments.length){var fa= -x.call(arguments);Aa=fa[5];ta=fa[4];Ma=fa[3];Ta=fa[2];Za=fa[1];Fa=fa[0]}fa=e(Aa,ta,Ma,Ta,Za,Fa);Aa=fa[0];ta=fa[1];Ma=fa[2];Ta=fa[3];Za=fa[4];Fa=fa[5];fa=new Date(Aa,ta,Ma,Ta,Za,0,1E3*Fa);100>Aa&&fa.setFullYear(Aa);return fa},ja.$$arity=-2);a.defs(n,"$gm",da=function(Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T){null==ta&&(ta=d);null==Ma&&(Ma=d);null==Ta&&(Ta=d);null==Za&&(Za=d);null==Fa&&(Fa=d);null==Y&&(Y=d);null==Q&&(Q=d);null==Z&&(Z=d);null==T&&(T=d);if(10===arguments.length){var fa=x.call(arguments);Aa=fa[5];ta= -fa[4];Ma=fa[3];Ta=fa[2];Za=fa[1];Fa=fa[0]}fa=e(Aa,ta,Ma,Ta,Za,Fa);Aa=fa[0];ta=fa[1];Ma=fa[2];Ta=fa[3];Za=fa[4];Fa=fa[5];fa=new Date(Date.UTC(Aa,ta,Ma,Ta,Za,0,1E3*Fa));100>Aa&&fa.setUTCFullYear(Aa);fa.is_utc=!0;return fa},da.$$arity=-2);(function(Aa,ta){[Aa].concat(ta);a.alias(Aa,"mktime","local");return a.alias(Aa,"utc","gm")})(a.get_singleton_class(n),L);a.defs(n,"$now",ma=function(){return this.$new()},ma.$$arity=0);a.def(n,"$+",b=function(Aa){m(H(L,"Time")["$==="](Aa))&&this.$raise(H(L,"TypeError"), +Y!==d&&this.$raise(H(L,"ArgumentError"),"Opal does not support explicitly specifying UTC offset for Time");Fa=e(Aa,ta,Ma,Ta,Za,Fa);Aa=Fa[0];ta=Fa[1];Ma=Fa[2];Ta=Fa[3];Za=Fa[4];Fa=Fa[5];ta=new Date(Aa,ta,Ma,Ta,Za,0,1E3*Fa);100>Aa&&ta.setFullYear(Aa);return ta},R.$$arity=-1);a.defs(n,"$local",ia=function(Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T){null==ta&&(ta=d);null==Ma&&(Ma=d);null==Ta&&(Ta=d);null==Za&&(Za=d);null==Fa&&(Fa=d);null==Y&&(Y=d);null==Q&&(Q=d);null==Z&&(Z=d);null==T&&(T=d);if(10===arguments.length){var ea= +x.call(arguments);Aa=ea[5];ta=ea[4];Ma=ea[3];Ta=ea[2];Za=ea[1];Fa=ea[0]}ea=e(Aa,ta,Ma,Ta,Za,Fa);Aa=ea[0];ta=ea[1];Ma=ea[2];Ta=ea[3];Za=ea[4];Fa=ea[5];ea=new Date(Aa,ta,Ma,Ta,Za,0,1E3*Fa);100>Aa&&ea.setFullYear(Aa);return ea},ia.$$arity=-2);a.defs(n,"$gm",da=function(Aa,ta,Ma,Ta,Za,Fa,Y,Q,Z,T){null==ta&&(ta=d);null==Ma&&(Ma=d);null==Ta&&(Ta=d);null==Za&&(Za=d);null==Fa&&(Fa=d);null==Y&&(Y=d);null==Q&&(Q=d);null==Z&&(Z=d);null==T&&(T=d);if(10===arguments.length){var ea=x.call(arguments);Aa=ea[5];ta= +ea[4];Ma=ea[3];Ta=ea[2];Za=ea[1];Fa=ea[0]}ea=e(Aa,ta,Ma,Ta,Za,Fa);Aa=ea[0];ta=ea[1];Ma=ea[2];Ta=ea[3];Za=ea[4];Fa=ea[5];ea=new Date(Date.UTC(Aa,ta,Ma,Ta,Za,0,1E3*Fa));100>Aa&&ea.setUTCFullYear(Aa);ea.is_utc=!0;return ea},da.$$arity=-2);(function(Aa,ta){[Aa].concat(ta);a.alias(Aa,"mktime","local");return a.alias(Aa,"utc","gm")})(a.get_singleton_class(n),L);a.defs(n,"$now",ma=function(){return this.$new()},ma.$$arity=0);a.def(n,"$+",b=function(Aa){m(H(L,"Time")["$==="](Aa))&&this.$raise(H(L,"TypeError"), "time + time?");Aa.$$is_number||(Aa=H(L,"Opal")["$coerce_to!"](Aa,H(L,"Integer"),"to_int"));Aa=new Date(this.getTime()+1E3*Aa);Aa.is_utc=this.is_utc;return Aa},b.$$arity=1);a.def(n,"$-",h=function(Aa){if(m(H(L,"Time")["$==="](Aa)))return(this.getTime()-Aa.getTime())/1E3;Aa.$$is_number||(Aa=H(L,"Opal")["$coerce_to!"](Aa,H(L,"Integer"),"to_int"));Aa=new Date(this.getTime()-1E3*Aa);Aa.is_utc=this.is_utc;return Aa},h.$$arity=1);a.def(n,"$<=>",f=function(Aa){if(m(H(L,"Time")["$==="](Aa)))return this.$to_f()["$<=>"](Aa.$to_f()); Aa=Aa["$<=>"](this);return m(Aa["$nil?"]())?d:m("number"===typeof Aa?0"](0))?-1:m("number"===typeof Aa?0>Aa:Aa["$<"](0))?1:0},f.$$arity=1);a.def(n,"$==",q=function(Aa){var ta;return m(ta=H(L,"Time")["$==="](Aa))?this.$to_f()===Aa.$to_f():ta},q.$$arity=1);a.def(n,"$asctime",A=function(){return this.$strftime("%a %b %e %H:%M:%S %Y")},A.$$arity=0);a.alias(n,"ctime","asctime");a.def(n,"$day",E=function(){return this.is_utc?this.getUTCDate():this.getDate()},E.$$arity=0);a.def(n,"$yday",G=function(){var Aa= H(L,"Time").$new(this.$year()).$to_i();var ta=H(L,"Time").$new(this.$year(),this.$month(),this.$day()).$to_i();return y(J(t(ta,Aa),86400).$round(),1)},G.$$arity=0);a.def(n,"$isdst",M=function(){var Aa=new Date(this.getFullYear(),0,1),ta=new Date(this.getFullYear(),6,1);return this.getTimezoneOffset()"](Aa)["$zero?"]():ta},ua.$$arity=1);a.def(n,"$friday?",Oa=function(){return 5==this.$wday()},Oa.$$arity=0);a.def(n,"$hash",xa=function(){return"Time:"+this.getTime()},xa.$$arity=0);a.def(n,"$hour",Ba=function(){return this.is_utc?this.getUTCHours():this.getHours()},Ba.$$arity=0);a.def(n,"$inspect",La=function(){return m(this["$utc?"]())?this.$strftime("%Y-%m-%d %H:%M:%S UTC"):this.$strftime("%Y-%m-%d %H:%M:%S %z")}, +return Aa},ba.$$arity=0);a.def(n,"$eql?",ua=function(Aa){var ta;return m(ta=Aa["$is_a?"](H(L,"Time")))?this["$<=>"](Aa)["$zero?"]():ta},ua.$$arity=1);a.def(n,"$friday?",Oa=function(){return 5==this.$wday()},Oa.$$arity=0);a.def(n,"$hash",wa=function(){return"Time:"+this.getTime()},wa.$$arity=0);a.def(n,"$hour",Ba=function(){return this.is_utc?this.getUTCHours():this.getHours()},Ba.$$arity=0);a.def(n,"$inspect",La=function(){return m(this["$utc?"]())?this.$strftime("%Y-%m-%d %H:%M:%S UTC"):this.$strftime("%Y-%m-%d %H:%M:%S %z")}, La.$$arity=0);a.alias(n,"mday","day");a.def(n,"$min",na=function(){return this.is_utc?this.getUTCMinutes():this.getMinutes()},na.$$arity=0);a.def(n,"$mon",S=function(){return(this.is_utc?this.getUTCMonth():this.getMonth())+1},S.$$arity=0);a.def(n,"$monday?",sa=function(){return 1==this.$wday()},sa.$$arity=0);a.alias(n,"month","mon");a.def(n,"$saturday?",ya=function(){return 6==this.$wday()},ya.$$arity=0);a.def(n,"$sec",pa=function(){return this.is_utc?this.getUTCSeconds():this.getSeconds()},pa.$$arity= -0);a.def(n,"$succ",ea=function(){var Aa=new Date(this.getTime()+1E3);Aa.is_utc=this.is_utc;return Aa},ea.$$arity=0);a.def(n,"$usec",F=function(){return 1E3*this.getMilliseconds()},F.$$arity=0);a.def(n,"$zone",V=function(){var Aa=this.toString();var ta=-1==Aa.indexOf("(")?Aa.match(/[A-Z]{3,4}/)[0]:Aa.match(/\((.+)\)(?:\s|$)/)[1];return"GMT"==ta&&/(GMT\W*\d{4})/.test(Aa)?RegExp.$1:ta},V.$$arity=0);a.def(n,"$getgm",ka=function(){var Aa=new Date(this.getTime());Aa.is_utc=!0;return Aa},ka.$$arity=0);a.alias(n, -"getutc","getgm");a.def(n,"$gmtime",va=function(){this.is_utc=!0;return this},va.$$arity=0);a.alias(n,"utc","gmtime");a.def(n,"$gmt?",ia=function(){return!0===this.is_utc},ia.$$arity=0);a.def(n,"$gmt_offset",wa=function(){return this.is_utc?0:60*-this.getTimezoneOffset()},wa.$$arity=0);a.def(n,"$strftime",Ha=function(Aa){var ta=this;return Aa.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g,function(Ma,Ta,Za,Fa,Y){Fa="";var Q=-1!==Ta.indexOf("0"),Z=-1===Ta.indexOf("-"),T=-1!==Ta.indexOf("_"),fa=-1!== -Ta.indexOf("^"),la=-1!==Ta.indexOf("#"),g=(Ta.match(":")||[]).length;Za=parseInt(Za,10);Q&&T&&(Ta.indexOf("0")Ma?"+":"-")+(10>Ta?"0":"")+Ta;0Y?"0":"";Fa+=Y;1I:l["$>"](I)}function J(l,I){return"number"===typeof l&&"number"===typeof I?l-I:l["$-"](I)}function t(l,I){return"number"===typeof l&&"number"===typeof I?l=I:l["$>="](I)}function z(l,I){return"number"===typeof l&&"number"===typeof I?l+I:l["$+"](I)}var p=a.top,d=[],H=a.nil,x=a.$$,k=a.klass,m=a.hash2,u=a.truthy,c=a.send; a.add_stubs("$require $include $const_name! $unshift $map $coerce_to! $new $each $define_struct_attribute $allocate $initialize $alias_method $module_eval $to_proc $const_set $== $raise $<< $members $define_method $instance_eval $class $last $> $length $- $keys $any? $join $[] $[]= $each_with_index $hash $=== $< $-@ $size $>= $include? $to_sym $instance_of? $__id__ $eql? $enum_for $name $+ $each_pair $inspect $to_h $args $each_with_object $flatten $to_a $respond_to? $dig".split(" "));p.$require("corelib/enumerable"); -return function(l,$super,e){l=k(l,$super,"Struct");var n=[l].concat(e),L,D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,xa,Ba,La;l.$include(x(n,"Enumerable"));a.defs(l,"$new",L=function(na,S,sa){var ya=L.$$p,pa=ya||H,ea,F;var V=H;ya&&(L.$$p=null);ya&&(L.$$p=null);var ka=a.slice.call(arguments,1,arguments.length);V=a.extract_kwargs(ka);if(null==V)V=m([],{});else if(!V.$$is_hash)throw a.ArgumentError.$new("expected kwargs");ya=V.$$smap.keyword_init;null==ya&&(ya=!1);if(u(na))try{na=x(n,"Opal")["$const_name!"](na)}catch(va){if(a.rescue(va, -[x(n,"TypeError"),x(n,"NameError")]))try{ka.$unshift(na),na=H}finally{a.pop_exception()}else throw va;}c(ka,"map",[],(ea=function(va){null==va&&(va=H);return x(n,"Opal")["$coerce_to!"](va,x(n,"String"),"to_str")},ea.$$s=this,ea.$$arity=1,ea));V=c(x(n,"Class"),"new",[this],(F=function(){var va=null==F.$$s?this:F.$$s,ia;c(ka,"each",[],(ia=function(wa){var Ha=null==ia.$$s?this:ia.$$s;null==wa&&(wa=H);return Ha.$define_struct_attribute(wa)},ia.$$s=va,ia.$$arity=1,ia));return function(wa,Ha){[wa].concat(Ha); -var Ea;a.def(wa,"$new",Ea=function(Qa){var Sa=a.slice.call(arguments,0,arguments.length);var Ia=this.$allocate();Ia.$$data={};c(Ia,"initialize",a.to_a(Sa));return Ia},Ea.$$arity=-1);return wa.$alias_method("[]","new")}(a.get_singleton_class(va),n)},F.$$s=this,F.$$arity=0,F));u(pa)&&c(V,"module_eval",[],pa.$to_proc());V.$$keyword_init=ya;u(na)&&x(n,"Struct").$const_set(na,V);return V},L.$$arity=-2);a.defs(l,"$define_struct_attribute",D=function(na){var S,sa;this["$=="](x(n,"Struct"))&&this.$raise(x(n, +return function(l,$super,e){l=k(l,$super,"Struct");var n=[l].concat(e),L,D,R,ia,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,wa,Ba,La;l.$include(x(n,"Enumerable"));a.defs(l,"$new",L=function(na,S,sa){var ya=L.$$p,pa=ya||H,ha,F;var V=H;ya&&(L.$$p=null);ya&&(L.$$p=null);var ka=a.slice.call(arguments,1,arguments.length);V=a.extract_kwargs(ka);if(null==V)V=m([],{});else if(!V.$$is_hash)throw a.ArgumentError.$new("expected kwargs");ya=V.$$smap.keyword_init;null==ya&&(ya=!1);if(u(na))try{na=x(n,"Opal")["$const_name!"](na)}catch(va){if(a.rescue(va, +[x(n,"TypeError"),x(n,"NameError")]))try{ka.$unshift(na),na=H}finally{a.pop_exception()}else throw va;}c(ka,"map",[],(ha=function(va){null==va&&(va=H);return x(n,"Opal")["$coerce_to!"](va,x(n,"String"),"to_str")},ha.$$s=this,ha.$$arity=1,ha));V=c(x(n,"Class"),"new",[this],(F=function(){var va=null==F.$$s?this:F.$$s,ja;c(ka,"each",[],(ja=function(xa){var Ha=null==ja.$$s?this:ja.$$s;null==xa&&(xa=H);return Ha.$define_struct_attribute(xa)},ja.$$s=va,ja.$$arity=1,ja));return function(xa,Ha){[xa].concat(Ha); +var Ea;a.def(xa,"$new",Ea=function(Qa){var Ra=a.slice.call(arguments,0,arguments.length);var Ia=this.$allocate();Ia.$$data={};c(Ia,"initialize",a.to_a(Ra));return Ia},Ea.$$arity=-1);return xa.$alias_method("[]","new")}(a.get_singleton_class(va),n)},F.$$s=this,F.$$arity=0,F));u(pa)&&c(V,"module_eval",[],pa.$to_proc());V.$$keyword_init=ya;u(na)&&x(n,"Struct").$const_set(na,V);return V},L.$$arity=-2);a.defs(l,"$define_struct_attribute",D=function(na){var S,sa;this["$=="](x(n,"Struct"))&&this.$raise(x(n, "ArgumentError"),"you cannot define attributes to the Struct class");this.$members()["$<<"](na);c(this,"define_method",[na],(S=function(){return(null==S.$$s?this:S.$$s).$$data[na]},S.$$s=this,S.$$arity=0,S));return c(this,"define_method",[""+na+"="],(sa=function(ya){var pa=null==sa.$$s?this:sa.$$s;null==ya&&(ya=H);return pa.$$data[na]=ya},sa.$$s=this,sa.$$arity=1,sa))},D.$$arity=1);a.defs(l,"$members",R=function(){var na=H;null==this.members&&(this.members=H);this["$=="](x(n,"Struct"))&&this.$raise(x(n, -"ArgumentError"),"the Struct class has no members");return this.members=u(na=this.members)?na:[]},R.$$arity=0);a.defs(l,"$inherited",ja=function(na){var S,sa=H;null==this.members&&(this.members=H);sa=this.members;return c(na,"instance_eval",[],(S=function(){return(null==S.$$s?this:S.$$s).members=sa},S.$$s=this,S.$$arity=0,S))},ja.$$arity=1);a.def(l,"$initialize",da=function(na){var S,sa,ya=H,pa=H,ea=H,F=H;var V=a.slice.call(arguments,0,arguments.length);if(u(this.$class().$$keyword_init))return ya= -u(pa=V.$last())?pa:m([],{}),u(u(ea=y(V.$length(),1))?ea:1===V.length&&!ya.$$is_hash)&&this.$raise(x(n,"ArgumentError"),"wrong number of arguments (given "+V.$length()+", expected 0)"),F=J(ya.$keys(),this.$class().$members()),u(F["$any?"]())&&this.$raise(x(n,"ArgumentError"),"unknown keywords: "+F.$join(", ")),c(this.$class().$members(),"each",[],(S=function(ka){var va=null==S.$$s?this:S.$$s;null==ka&&(ka=H);ka=[ka,ya["$[]"](ka)];c(va,"[]=",a.to_a(ka));return ka[J(ka.length,1)]},S.$$s=this,S.$$arity= -1,S));u(y(V.$length(),this.$class().$members().$length()))&&this.$raise(x(n,"ArgumentError"),"struct size differs");return c(this.$class().$members(),"each_with_index",[],(sa=function(ka,va){var ia=null==sa.$$s?this:sa.$$s;null==ka&&(ka=H);null==va&&(va=H);ka=[ka,V["$[]"](va)];c(ia,"[]=",a.to_a(ka));return ka[J(ka.length,1)]},sa.$$s=this,sa.$$arity=2,sa))},da.$$arity=-1);a.def(l,"$initialize_copy",ma=function(na){this.$$data={};var S=Object.keys(na.$$data),sa;var ya=0;for(sa=S.length;ya")},Oa.$$arity=0);a.alias(l,"to_s","inspect");a.def(l,"$to_h",xa= -function(){var na=xa.$$p,S=na||H,sa;na&&(xa.$$p=null);na&&(xa.$$p=null);return S!==H?c(c(this,"map",[],S.$to_proc()),"to_h",a.to_a(this.$args())):c(this.$class().$members(),"each_with_object",[m([],{})],(sa=function(ya,pa){var ea=null==sa.$$s?this:sa.$$s;null==ya&&(ya=H);null==pa&&(pa=H);ya=[ya,ea["$[]"](ya)];c(pa,"[]=",a.to_a(ya));return ya[J(ya.length,1)]},sa.$$s=this,sa.$$arity=2,sa))},xa.$$arity=0);a.def(l,"$values_at",Ba=function(na){var S;var sa=a.slice.call(arguments,0,arguments.length);sa= -c(sa,"map",[],(S=function(ea){null==ea&&(ea=H);return ea.$$is_range?ea.$to_a():ea},S.$$s=this,S.$$arity=1,S)).$flatten();S=[];for(var ya=0,pa=sa.length;ya")},Oa.$$arity=0);a.alias(l,"to_s","inspect");a.def(l,"$to_h",wa= +function(){var na=wa.$$p,S=na||H,sa;na&&(wa.$$p=null);na&&(wa.$$p=null);return S!==H?c(c(this,"map",[],S.$to_proc()),"to_h",a.to_a(this.$args())):c(this.$class().$members(),"each_with_object",[m([],{})],(sa=function(ya,pa){var ha=null==sa.$$s?this:sa.$$s;null==ya&&(ya=H);null==pa&&(pa=H);ya=[ya,ha["$[]"](ya)];c(pa,"[]=",a.to_a(ya));return ya[J(ya.length,1)]},sa.$$s=this,sa.$$arity=2,sa))},wa.$$arity=0);a.def(l,"$values_at",Ba=function(na){var S;var sa=a.slice.call(arguments,0,arguments.length);sa= +c(sa,"map",[],(S=function(ha){null==ha&&(ha=H);return ha.$$is_range?ha.$to_a():ha},S.$$s=this,S.$$arity=1,S)).$flatten();S=[];for(var ya=0,pa=sa.length;yaja:ja["$<"](0))&&this.$raise(t(k,"ArgumentError"),"negative string size (or size too big)");return p(t(k,"Array"),"new",[ja],(da=function(){return(null==da.$$s?this:da.$$s).$rand(255).$chr()},da.$$s=this,da.$$arity=0,da)).$join().$encode("ASCII-8BIT")},e.$$arity=1);a.def(d,"$==",n=function(ja){var da;return z(t(k,"Random")["$==="](ja))?z(da=this.$seed()["$=="](ja.$seed()))? -this.$state()["$=="](ja.$state()):da:!1},n.$$arity=1);a.def(d,"$bytes",L=function(ja){var da;ja=t(k,"Opal")["$coerce_to!"](ja,t(k,"Integer"),"to_int");return p(t(k,"Array"),"new",[ja],(da=function(){return(null==da.$$s?this:da.$$s).$rand(255).$chr()},da.$$s=this,da.$$arity=0,da)).$join().$encode("ASCII-8BIT")},L.$$arity=1);a.def(d,"$rand",D=function(ja){function da(){b.state++;return a.$$rand.rand(b.$rng)}function ma(){var h=ja.begin,f=ja.end;if(h===J||f===J)return J;var q=f-h;if(0>q)return J;if(0=== -q)return h;0!==f%1||0!==h%1||ja.excl||q++;return b.$rand(q)+h}var b=this;if(null==ja)return da();if(ja.$$is_range)return ma();if(ja.$$is_number)return 0>=ja&&b.$raise(t(k,"ArgumentError"),"invalid argument - "+ja),0===ja%1?Math.floor(da()*ja):da()*ja;ja=t(k,"Opal")["$coerce_to!"](ja,t(k,"Integer"),"to_int");0>=ja&&b.$raise(t(k,"ArgumentError"),"invalid argument - "+ja);return Math.floor(da()*ja)},D.$$arity=-1);return(a.defs(d,"$generator=",R=function(ja){a.$$rand=ja;return z(this["$const_defined?"]("DEFAULT"))? +Opal.modules["corelib/random"]=function(a){var y=[],J=a.nil,t=a.$$,w=a.klass,z=a.truthy,p=a.send;a.add_stubs("$attr_reader $new_seed $coerce_to! $reseed $rand $seed $< $raise $encode $join $new $chr $=== $== $state $const_defined? $const_set".split(" "));return function(d,$super,x){d=w(d,$super,"Random");var k=[d].concat(x),m,u,c,l,I,e,n,L,D,R;d.$attr_reader("seed","state");a.def(d,"$initialize",m=function(ia){null==ia&&(ia=t(k,"Random").$new_seed());this.state=ia=t(k,"Opal")["$coerce_to!"](ia,t(k, +"Integer"),"to_int");return this.$reseed(ia)},m.$$arity=-1);a.def(d,"$reseed",u=function(ia){this.seed=ia;return this.$rng=a.$$rand.reseed(ia)},u.$$arity=1);a.defs(d,"$new_seed",c=function(){return a.$$rand.new_seed()},c.$$arity=0);a.defs(d,"$rand",l=function(ia){return t(k,"DEFAULT").$rand(ia)},l.$$arity=-1);a.defs(d,"$srand",I=function(ia){null==ia&&(ia=t(k,"Random").$new_seed());ia=t(k,"Opal")["$coerce_to!"](ia,t(k,"Integer"),"to_int");var da=t(k,"DEFAULT").$seed();t(k,"DEFAULT").$reseed(ia);return da}, +I.$$arity=-1);a.defs(d,"$urandom",e=function(ia){var da;ia=t(k,"Opal")["$coerce_to!"](ia,t(k,"Integer"),"to_int");z("number"===typeof ia?0>ia:ia["$<"](0))&&this.$raise(t(k,"ArgumentError"),"negative string size (or size too big)");return p(t(k,"Array"),"new",[ia],(da=function(){return(null==da.$$s?this:da.$$s).$rand(255).$chr()},da.$$s=this,da.$$arity=0,da)).$join().$encode("ASCII-8BIT")},e.$$arity=1);a.def(d,"$==",n=function(ia){var da;return z(t(k,"Random")["$==="](ia))?z(da=this.$seed()["$=="](ia.$seed()))? +this.$state()["$=="](ia.$state()):da:!1},n.$$arity=1);a.def(d,"$bytes",L=function(ia){var da;ia=t(k,"Opal")["$coerce_to!"](ia,t(k,"Integer"),"to_int");return p(t(k,"Array"),"new",[ia],(da=function(){return(null==da.$$s?this:da.$$s).$rand(255).$chr()},da.$$s=this,da.$$arity=0,da)).$join().$encode("ASCII-8BIT")},L.$$arity=1);a.def(d,"$rand",D=function(ia){function da(){b.state++;return a.$$rand.rand(b.$rng)}function ma(){var h=ia.begin,f=ia.end;if(h===J||f===J)return J;var q=f-h;if(0>q)return J;if(0=== +q)return h;0!==f%1||0!==h%1||ia.excl||q++;return b.$rand(q)+h}var b=this;if(null==ia)return da();if(ia.$$is_range)return ma();if(ia.$$is_number)return 0>=ia&&b.$raise(t(k,"ArgumentError"),"invalid argument - "+ia),0===ia%1?Math.floor(da()*ia):da()*ia;ia=t(k,"Opal")["$coerce_to!"](ia,t(k,"Integer"),"to_int");0>=ia&&b.$raise(t(k,"ArgumentError"),"invalid argument - "+ia);return Math.floor(da()*ia)},D.$$arity=-1);return(a.defs(d,"$generator=",R=function(ia){a.$$rand=ia;return z(this["$const_defined?"]("DEFAULT"))? t(k,"DEFAULT").$reseed():this.$const_set("DEFAULT",this.$new(this.$new_seed()))},R.$$arity=1),J)&&"generator="}(y[0],null,y)}; Opal.modules["corelib/random/mersenne_twister"]=function(a){function y(H,x){return"number"===typeof H&&"number"===typeof x?H-x:H["$-"](x)}var J=[],t=a.nil,w=a.$$,z=a.klass,p=a.send,d=t;a.add_stubs(["$generator=","$-"]);d=function(){function H(k,m){return(k&2147483648|m&2147483647)>>>1^(m&1?2567483615:0)}function x(k){if(0>=--k.left){var m=0,u=k.state,c;k.left=624;k.next=0;for(c=228;--c;m++)u[m]=u[m+397]^H(u[m+0],u[m+1]);for(c=397;--c;m++)u[m]=u[m+-227]^H(u[m+0],u[m+1]);u[m]=u[m+-227]^H(u[m+0],u[0])}k= k.state[k.next++];k^=k>>>11;k^=k<<7&2636928640;k^=k<<15&4022730752;return(k^k>>>18)>>>0}return{genrand_real:function(k){var m=x(k);k=x(k);return 1.1102230246251565E-16*(67108864*(m>>>5)+(k>>>6))},init:function(k){var m={left:0,next:624,state:Array(624)};m.state[0]=k>>>0;for(k=1;624>k;k++)m.state[k]=1812433253*(m.state[k-1]^m.state[k-1]>>30>>>0)+k,m.state[k]&=4294967295;m.left=1;m.next=624;return m}}}();return function(H,$super,k){H=z(H,$super,"Random");k=[H].concat(k);var m=t,u=Number.MAX_SAFE_INTEGER|| Math.pow(2,53)-1;a.const_set(k[0],"MERSENNE_TWISTER_GENERATOR",{new_seed:function(){return Math.round(Math.random()*u)},reseed:function(c){return d.init(c)},rand:function(c){return d.genrand_real(c)}});m=[w(k,"MERSENNE_TWISTER_GENERATOR")];p(H,"generator=",a.to_a(m));return m[y(m.length,1)]}(J[0],null,J)}; -Opal.modules["corelib/unsupported"]=function(a){function y(m){switch(a.config.unsupported_features_severity){case "error":d(z,"Kernel").$raise(d(z,"NotImplementedError"),m);break;case "warning":k[m]||(k[m]=!0,w.$warn(m))}}var J,t,w=a.top,z=[],p=a.nil,d=a.$$,H=a.klass,x=a.module;a.add_stubs(["$raise","$warn","$%"]);var k={};(function(m,$super,c){m=H(m,$super,"String");var l=[m].concat(c),I,e,n,L,D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,xa,Ba,La;a.def(m,"$<<",I=function(na){a.slice.call(arguments,0,arguments.length); +Opal.modules["corelib/unsupported"]=function(a){function y(m){switch(a.config.unsupported_features_severity){case "error":d(z,"Kernel").$raise(d(z,"NotImplementedError"),m);break;case "warning":k[m]||(k[m]=!0,w.$warn(m))}}var J,t,w=a.top,z=[],p=a.nil,d=a.$$,H=a.klass,x=a.module;a.add_stubs(["$raise","$warn","$%"]);var k={};(function(m,$super,c){m=H(m,$super,"String");var l=[m].concat(c),I,e,n,L,D,R,ia,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,wa,Ba,La;a.def(m,"$<<",I=function(na){a.slice.call(arguments,0,arguments.length); return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("<<"))},I.$$arity=-1);a.def(m,"$capitalize!",e=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("capitalize!"))},e.$$arity=-1);a.def(m,"$chomp!",n=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"), "String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("chomp!"))},n.$$arity=-1);a.def(m,"$chop!",L=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("chop!"))},L.$$arity=-1);a.def(m,"$downcase!",D=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("downcase!"))}, -D.$$arity=-1);a.def(m,"$gsub!",R=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("gsub!"))},R.$$arity=-1);a.def(m,"$lstrip!",ja=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("lstrip!"))},ja.$$arity=-1);a.def(m,"$next!",da=function(na){a.slice.call(arguments, +D.$$arity=-1);a.def(m,"$gsub!",R=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("gsub!"))},R.$$arity=-1);a.def(m,"$lstrip!",ia=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("lstrip!"))},ia.$$arity=-1);a.def(m,"$next!",da=function(na){a.slice.call(arguments, 0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("next!"))},da.$$arity=-1);a.def(m,"$reverse!",ma=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("reverse!"))},ma.$$arity=-1);a.def(m,"$slice!",b=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l, "NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("slice!"))},b.$$arity=-1);a.def(m,"$squeeze!",h=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("squeeze!"))},h.$$arity=-1);a.def(m,"$strip!",f=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("strip!"))}, f.$$arity=-1);a.def(m,"$sub!",q=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("sub!"))},q.$$arity=-1);a.def(m,"$succ!",A=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("succ!"))},A.$$arity=-1);a.def(m,"$swapcase!",E=function(na){a.slice.call(arguments, 0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("swapcase!"))},E.$$arity=-1);a.def(m,"$tr!",G=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("tr!"))},G.$$arity=-1);a.def(m,"$tr_s!",M=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l, "NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("tr_s!"))},M.$$arity=-1);a.def(m,"$upcase!",ba=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("upcase!"))},ba.$$arity=-1);a.def(m,"$prepend",ua=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("prepend"))}, -ua.$$arity=-1);a.def(m,"$[]=",Oa=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("[]="))},Oa.$$arity=-1);a.def(m,"$clear",xa=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("clear"))},xa.$$arity=-1);a.def(m,"$encode!",Ba=function(na){a.slice.call(arguments, +ua.$$arity=-1);a.def(m,"$[]=",Oa=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("[]="))},Oa.$$arity=-1);a.def(m,"$clear",wa=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("clear"))},wa.$$arity=-1);a.def(m,"$encode!",Ba=function(na){a.slice.call(arguments, 0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("encode!"))},Ba.$$arity=-1);return(a.def(m,"$unicode_normalize!",La=function(na){a.slice.call(arguments,0,arguments.length);return this.$raise(d(l,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("unicode_normalize!"))},La.$$arity=-1),p)&&"unicode_normalize!"})(z[0],null,z);(function(m,u){m=x(m, "Kernel");[m].concat(u);var c,l;a.def(m,"$freeze",c=function(){y("Object freezing is not supported by Opal");return this},c.$$arity=0);a.def(m,"$frozen?",l=function(){y("Object freezing is not supported by Opal");return!1},l.$$arity=0)})(z[0],z);(function(m,u){m=x(m,"Kernel");[m].concat(u);var c,l,I;a.def(m,"$taint",c=function(){y("Object tainting is not supported by Opal");return this},c.$$arity=0);a.def(m,"$untaint",l=function(){y("Object tainting is not supported by Opal");return this},l.$$arity= 0);a.def(m,"$tainted?",I=function(){y("Object tainting is not supported by Opal");return!1},I.$$arity=0)})(z[0],z);(function(m,$super,c){m=H(m,$super,"Module");[m].concat(c);var l,I,e,n;a.def(m,"$public",l=function(L){0===a.slice.call(arguments,0,arguments.length).length&&(this.$$module_function=!1);return p},l.$$arity=-1);a.alias(m,"private","public");a.alias(m,"protected","public");a.alias(m,"nesting","public");a.def(m,"$private_class_method",I=function(L){a.slice.call(arguments,0,arguments.length); @@ -647,101 +647,101 @@ null,z);(function(m,u){m=x(m,"Kernel");[m].concat(u);var c;a.def(m,"$private_met (d(c,"RUBY_ENGINE_VERSION")+"/docs/opal_parser.md for details."))},l.$$arity=-1)})(z[0],z);a.defs(w,"$public",J=function(m){a.slice.call(arguments,0,arguments.length);return p},J.$$arity=-1);return(a.defs(w,"$private",t=function(m){a.slice.call(arguments,0,arguments.length);return p},t.$$arity=-1),p)&&"private"};var rb=Opal.top;Opal.add_stubs(["$require"]);rb.$require("opal/base");rb.$require("opal/mini");rb.$require("corelib/kernel/format");rb.$require("corelib/string/encoding");rb.$require("corelib/math"); rb.$require("corelib/complex");rb.$require("corelib/rational");rb.$require("corelib/time");rb.$require("corelib/struct");rb.$require("corelib/io");rb.$require("corelib/main");rb.$require("corelib/dir");rb.$require("corelib/file");rb.$require("corelib/process");rb.$require("corelib/random");rb.$require("corelib/random/mersenne_twister");rb.$require("corelib/unsupported"); (function(a){function y(u,c){return"number"===typeof u&&"number"===typeof c?u+c:u["$+"](c)}function J(u,c){return"number"===typeof u&&"number"===typeof c?u-c:u["$-"](c)}function t(u,c){return"number"===typeof u&&"number"===typeof c?u $attr_reader $nonzero? $d $zero? $new $class $-@ $+@ $=== $coerce $== $> $+ $allocate $join $compact $map $to_proc $downcase $wrap $raise $clone $jd $>> $wday $year $month $day $- $to_s $to_i $< $* $reverse $step $abs $each".split(" ")); -return function(u,$super,l){function I(W,za){return[31,0===W%4&&0!==W%100||0===W%400?29:28,31,30,31,30,31,31,30,31,30,31][za]}u=H(u,$super,"Date");var e=[u].concat(l),n,L,D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,xa,Ba,La,na,S,sa,ya,pa,ea,F,V,ka,va,ia,wa,Ha,Ea,Qa,Sa,Ia,kb,Ra;u.$$prototype.date=z;u.$include(d(e,"Comparable"));(function(W,$super,Ca){W=H(W,$super,"Infinity");var Va=[W].concat(Ca),ib,db,Xa,bb,Aa,ta,Ma,Ta,Za,Fa,Y;W.$$prototype.d=z;W.$include(d(Va,"Comparable"));a.def(W,"$initialize",ib=function(Q){null== -Q&&(Q=1);return this.d=Q["$<=>"](0)},ib.$$arity=-1);W.$attr_reader("d");a.def(W,"$zero?",db=function(){return!1},db.$$arity=0);a.def(W,"$finite?",Xa=function(){return!1},Xa.$$arity=0);a.def(W,"$infinite?",bb=function(){return this.$d()["$nonzero?"]()},bb.$$arity=0);a.def(W,"$nan?",Aa=function(){return this.$d()["$zero?"]()},Aa.$$arity=0);a.def(W,"$abs",ta=function(){return this.$class().$new()},ta.$$arity=0);a.def(W,"$-@",Ma=function(){return this.$class().$new(this.$d()["$-@"]())},Ma.$$arity=0); -a.def(W,"$+@",Ta=function(){return this.$class().$new(this.$d()["$+@"]())},Ta.$$arity=0);a.def(W,"$<=>",Za=function(Q){var Z,T,fa=this,la=z,g=z,C=z;return function(){la=Q;if(d(Va,"Infinity")["$==="](la))return fa.$d()["$<=>"](Q.$d());if(d(Va,"Numeric")["$==="](la))return fa.$d();try{return T=Q.$coerce(fa),Z=a.to_ary(T),g=null==Z[0]?z:Z[0],C=null==Z[1]?z:Z[1],T,g["$<=>"](C)}catch(N){if(a.rescue(N,[d(Va,"NoMethodError")]))try{return z}finally{a.pop_exception()}else throw N;}}()},Za.$$arity=1);a.def(W, -"$coerce",Fa=function(Q){var Z=Fa.$$p,T;Z&&(Fa.$$p=null);var fa=0;var la=arguments.length;for(T=Array(la);fa"](0);return k(Q)?p(d(Va,"Float"),"INFINITY"):p(d(Va,"Float"),"INFINITY")["$-@"]()},Y.$$arity=0),z)&&"to_f"})(e[0], +return function(u,$super,l){function I(W,za){return[31,0===W%4&&0!==W%100||0===W%400?29:28,31,30,31,30,31,31,30,31,30,31][za]}u=H(u,$super,"Date");var e=[u].concat(l),n,L,D,R,ia,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,wa,Ba,La,na,S,sa,ya,pa,ha,F,V,ka,va,ja,xa,Ha,Ea,Qa,Ra,Ia,kb,Sa;u.$$prototype.date=z;u.$include(d(e,"Comparable"));(function(W,$super,Da){W=H(W,$super,"Infinity");var Va=[W].concat(Da),ib,db,bb,Xa,Aa,ta,Ma,Ta,Za,Fa,Y;W.$$prototype.d=z;W.$include(d(Va,"Comparable"));a.def(W,"$initialize",ib=function(Q){null== +Q&&(Q=1);return this.d=Q["$<=>"](0)},ib.$$arity=-1);W.$attr_reader("d");a.def(W,"$zero?",db=function(){return!1},db.$$arity=0);a.def(W,"$finite?",bb=function(){return!1},bb.$$arity=0);a.def(W,"$infinite?",Xa=function(){return this.$d()["$nonzero?"]()},Xa.$$arity=0);a.def(W,"$nan?",Aa=function(){return this.$d()["$zero?"]()},Aa.$$arity=0);a.def(W,"$abs",ta=function(){return this.$class().$new()},ta.$$arity=0);a.def(W,"$-@",Ma=function(){return this.$class().$new(this.$d()["$-@"]())},Ma.$$arity=0); +a.def(W,"$+@",Ta=function(){return this.$class().$new(this.$d()["$+@"]())},Ta.$$arity=0);a.def(W,"$<=>",Za=function(Q){var Z,T,ea=this,la=z,g=z,C=z;return function(){la=Q;if(d(Va,"Infinity")["$==="](la))return ea.$d()["$<=>"](Q.$d());if(d(Va,"Numeric")["$==="](la))return ea.$d();try{return T=Q.$coerce(ea),Z=a.to_ary(T),g=null==Z[0]?z:Z[0],C=null==Z[1]?z:Z[1],T,g["$<=>"](C)}catch(N){if(a.rescue(N,[d(Va,"NoMethodError")]))try{return z}finally{a.pop_exception()}else throw N;}}()},Za.$$arity=1);a.def(W, +"$coerce",Fa=function(Q){var Z=Fa.$$p,T;Z&&(Fa.$$p=null);var ea=0;var la=arguments.length;for(T=Array(la);ea"](0);return k(Q)?p(d(Va,"Float"),"INFINITY"):p(d(Va,"Float"),"INFINITY")["$-@"]()},Y.$$arity=0),z)&&"to_f"})(e[0], d(e,"Numeric"),e);a.const_set(e[0],"JULIAN",d(e,"Infinity").$new());a.const_set(e[0],"GREGORIAN",d(e,"Infinity").$new()["$-@"]());a.const_set(e[0],"ITALY",2299161);a.const_set(e[0],"ENGLAND",2361222);a.const_set(e[0],"MONTHNAMES",y([z],"January February March April May June July August September October November December".split(" ")));a.const_set(e[0],"ABBR_MONTHNAMES","jan feb mar apr may jun jul aug sep oct nov dec".split(" "));a.const_set(e[0],"DAYNAMES","Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ")); -a.const_set(e[0],"ABBR_DAYNAMES","Sun Mon Tue Wed Thu Fri Sat".split(" "));(function(W,za){var Ca=[W].concat(za),Va,ib,db,Xa;a.alias(W,"civil","new");a.def(W,"$wrap",Va=function(bb){var Aa=this.$allocate();Aa.date=bb;return Aa},Va.$$arity=1);a.def(W,"$parse",ib=function(bb,Aa){function ta(aa){return aa[1]}function Ma(aa){return aa[2]}function Ta(aa){return aa[3]}function Za(aa){return aa[4]}function Fa(aa){return function(v){v=aa(v);return 69<=v?v+1900:v+2E3}}function Y(aa){return function(v){v=aa(v).toLowerCase(); -return d(Ca,"ABBR_MONTHNAMES").indexOf(v)+1}}function Q(aa){return function(v){v=aa(v);return parseInt(v,10)}}function Z(aa){return function(v){v=aa(v);return m(d(Ca,"MONTHNAMES").$compact(),"map",[],"downcase".$to_proc()).indexOf(v.$downcase())+1}}null==Aa&&(Aa=!0);var T=new Date,fa=T.getDate(),la=T.getMonth(),g=T.getFullYear(),C=T.getDay();T=d(Ca,"MONTHNAMES").$compact().$join("|");T=[{regexp:/^(\d{2})$/,year:g,month:la,day:Q(ta)},{regexp:/^(\d{3})$/,year:g,month:0,day:Q(ta)},{regexp:/^(\d{2})(\d{2})$/, +a.const_set(e[0],"ABBR_DAYNAMES","Sun Mon Tue Wed Thu Fri Sat".split(" "));(function(W,za){var Da=[W].concat(za),Va,ib,db,bb;a.alias(W,"civil","new");a.def(W,"$wrap",Va=function(Xa){var Aa=this.$allocate();Aa.date=Xa;return Aa},Va.$$arity=1);a.def(W,"$parse",ib=function(Xa,Aa){function ta(aa){return aa[1]}function Ma(aa){return aa[2]}function Ta(aa){return aa[3]}function Za(aa){return aa[4]}function Fa(aa){return function(v){v=aa(v);return 69<=v?v+1900:v+2E3}}function Y(aa){return function(v){v=aa(v).toLowerCase(); +return d(Da,"ABBR_MONTHNAMES").indexOf(v)+1}}function Q(aa){return function(v){v=aa(v);return parseInt(v,10)}}function Z(aa){return function(v){v=aa(v);return m(d(Da,"MONTHNAMES").$compact(),"map",[],"downcase".$to_proc()).indexOf(v.$downcase())+1}}null==Aa&&(Aa=!0);var T=new Date,ea=T.getDate(),la=T.getMonth(),g=T.getFullYear(),C=T.getDay();T=d(Da,"MONTHNAMES").$compact().$join("|");T=[{regexp:/^(\d{2})$/,year:g,month:la,day:Q(ta)},{regexp:/^(\d{3})$/,year:g,month:0,day:Q(ta)},{regexp:/^(\d{2})(\d{2})$/, year:g,month:Q(ta),day:Q(Ma)},{regexp:/^(\d{2})(\d{3})$/,year:Fa(Q(ta)),month:0,day:Q(Ma)},{regexp:/^(\d{2})(\d{2})(\d{2})$/,year:Fa(Q(ta)),month:Q(Ma),day:Q(Ta)},{regexp:/^(\d{4})(\d{3})$/,year:Q(ta),month:0,day:Q(Ma)},{regexp:/^(\d{4})(\d{2})(\d{2})$/,year:Q(ta),month:Q(Ma),day:Q(Ta)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{3,4})$/,year:Q(Ma),month:Y(ta),day:1},{regexp:/^(\d{1,2})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{3,4})$/i,year:Q(Ta),month:Y(Ma),day:Q(ta)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{3,4})$/i, year:Q(Ta),month:Y(ta),day:Q(Ma)},{regexp:/^(\d{3,4})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{1,2})$/i,year:Q(ta),month:Y(Ma),day:Q(Ta)},{regexp:/^(\-?\d{3,4})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:Q(ta),month:Q(Ma),day:Q(Ta)},{regexp:/^(\d{2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:function(aa){return function(v){v=aa(v);return Aa?v+2E3:v}}(Q(ta)),month:Q(Ma),day:Q(Ta)},{regexp:/^(\d{1,2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\-?\d{3,4})$/,year:Q(Ta),month:Q(Ma),day:Q(ta)},{regexp:new RegExp("^("+ -d(Ca,"DAYNAMES").$join("|")+")$","i"),year:g,month:la,day:function(aa){return function(v){v=aa(v);v=m(d(Ca,"DAYNAMES"),"map",[],"downcase".$to_proc()).indexOf(v.$downcase());return fa-C+v}}(ta)},{regexp:new RegExp("^("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-](\\-?\\d{3,4})$","i"),year:Q(Za),month:Z(ta),day:Q(Ma)},{regexp:new RegExp("^("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)","i"),year:g,month:Z(ta),day:Q(Ma)},{regexp:new RegExp("^(\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-]("+T+")[\\s\\.\\/\\-](\\-?\\d{3,4})$", -"i"),year:Q(Za),month:Z(Ta),day:Q(ta)},{regexp:new RegExp("^(\\-?\\d{3,4})[\\s\\.\\/\\-]("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)$","i"),year:Q(ta),month:Z(Ma),day:Q(Ta)}];var N;for(N=0;N=bb&&la.setFullYear(bb),this.$wrap(la);return this.$raise(d(Ca,"ArgumentError"),"invalid date")},ib.$$arity= --2);a.def(W,"$today",db=function(){return this.$wrap(new Date)},db.$$arity=0);return(a.def(W,"$gregorian_leap?",Xa=function(bb){return 0===(new Date(bb,1,29)).getMonth()-1},Xa.$$arity=1),z)&&"gregorian_leap?"})(a.get_singleton_class(u),e);a.def(u,"$initialize",n=function(W,za,Ca,Va){null==W&&(W=-4712);null==za&&(za=1);null==Ca&&(Ca=1);null==Va&&d(e,"ITALY");1582===W&&10===za&&4Ca&&(Ca=4);return this.date=new Date(W,za-1,Ca)},n.$$arity=-1);a.def(u,"$-",L=function(W){if(W.$$is_number){var za= -this.$clone();za.date.setDate(this.date.getDate()-W);return za}if(W.date)return Math.round((this.date-W.date)/864E5);this.$raise(d(e,"TypeError"))},L.$$arity=1);a.def(u,"$+",D=function(W){if(W.$$is_number){var za=this.$clone();za.date.setDate(this.date.getDate()+W);return za}this.$raise(d(e,"TypeError"))},D.$$arity=1);a.def(u,"$<",R=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za",da=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za>W},da.$$arity=1);a.def(u,"$>=",ma=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za>=W},ma.$$arity=1);a.def(u,"$<=>",b=function(W){if(W.$$is_number)return this.$jd()["$<=>"](W);if(d(e,"Date")["$==="](W)){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return zaW?1:0}return z}, -b.$$arity=1);a.def(u,"$>>",h=function(W){W.$$is_number||this.$raise(d(e,"TypeError"));var za=this.$clone(),Ca=za.date,Va=Ca.getDate();Ca.setDate(1);Ca.setMonth(Ca.getMonth()+W);Ca.setDate(Math.min(Va,I(Ca.getFullYear(),Ca.getMonth())));return za},h.$$arity=1);a.def(u,"$<<",f=function(W){W.$$is_number||this.$raise(d(e,"TypeError"));return this["$>>"](-W)},f.$$arity=1);a.alias(u,"eql?","==");a.def(u,"$clone",q=function(){return d(e,"Date").$wrap(new Date(this.date.getTime()))},q.$$arity=0);a.def(u, -"$day",A=function(){return this.date.getDate()},A.$$arity=0);a.def(u,"$friday?",E=function(){return this.$wday()["$=="](5)},E.$$arity=0);a.def(u,"$jd",G=function(){var W=this.date.getMonth()+1,za=this.date.getDate(),Ca=this.date.getFullYear();var Va=1;1585>=Ca&&(Va=0);var ib=-1*Math.floor(7*(Math.floor((W+9)/12)+Ca)/4);var db=1;0>W-9&&(db=-1);db=Math.floor(Ca+db*Math.floor(Math.abs(W-9)/7));db=-1*Math.floor(3*(Math.floor(db/100)+1)/4);ib=ib+Math.floor(275*W/9)+za+Va*db;return ib+1721027+2*Va+367* -Ca-.5+.5},G.$$arity=0);a.def(u,"$julian?",M=function(){return this.dateCa&&(Ca="0"+Ca);10>W&&(W="0"+W);return za+"-"+Ca+"-"+W},V.$$arity=0);a.def(u,"$to_time",ka=function(){return d(e,"Time").$new(this.$year(),this.$month(),this.$day())},ka.$$arity=0);a.def(u,"$to_n",va=function(){return this.date},va.$$arity=0);a.def(u,"$tuesday?",ia=function(){return this.$wday()["$=="](2)},ia.$$arity=0);a.def(u,"$step", -wa=function(W,za){var Ca=wa.$$p,Va=Ca||z,ib,db,Xa=z;Xa=Xa=z;Ca&&(wa.$$p=null);Ca&&(wa.$$p=null);null==za&&(za=1);Xa=J(W,this).$to_i();Xa=k(t("number"===typeof Xa&&"number"===typeof za?Xa*za:Xa["$*"](za),0))?[]:k(t(Xa,0))?m(a.Range.$new(0,Xa["$-@"](),!1).$step(za.$abs()),"map",[],"-@".$to_proc()).$reverse():a.Range.$new(0,Xa,!1).$step(za.$abs());Xa=m(Xa,"map",[],(ib=function(bb){var Aa=null==ib.$$s?this:ib.$$s;null==bb&&(bb=z);return y(Aa,bb)},ib.$$s=this,ib.$$arity=1,ib));return Va!==z?(m(Xa,"each", -[],(db=function(bb){null==bb&&(bb=z);return a.yield1(Va,bb)},db.$$s=this,db.$$arity=1,db)),this):Xa},wa.$$arity=-2);a.def(u,"$upto",Ha=function(W){var za=Ha.$$p,Ca=za||z;za&&(Ha.$$p=null);za&&(Ha.$$p=null);return m(this,"step",[W,1],Ca.$to_proc())},Ha.$$arity=1);a.def(u,"$downto",Ea=function(W){var za=Ea.$$p,Ca=za||z;za&&(Ea.$$p=null);za&&(Ea.$$p=null);return m(this,"step",[W,-1],Ca.$to_proc())},Ea.$$arity=1);a.def(u,"$wday",Qa=function(){return this.date.getDay()},Qa.$$arity=0);a.def(u,"$wednesday?", -Sa=function(){return this.$wday()["$=="](3)},Sa.$$arity=0);a.def(u,"$year",Ia=function(){return this.date.getFullYear()},Ia.$$arity=0);a.def(u,"$cwday",kb=function(){return this.date.getDay()||7},kb.$$arity=0);a.def(u,"$cweek",Ra=function(){var W=new Date(this.date);W.setHours(0,0,0);W.setDate(W.getDate()+4-(W.getDay()||7));return Math.ceil(((W-new Date(W.getFullYear(),0,1))/864E5+1)/7)},Ra.$$arity=0)}(w[0],null,w)})(Opal); +d(Da,"DAYNAMES").$join("|")+")$","i"),year:g,month:la,day:function(aa){return function(v){v=aa(v);v=m(d(Da,"DAYNAMES"),"map",[],"downcase".$to_proc()).indexOf(v.$downcase());return ea-C+v}}(ta)},{regexp:new RegExp("^("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-](\\-?\\d{3,4})$","i"),year:Q(Za),month:Z(ta),day:Q(Ma)},{regexp:new RegExp("^("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)","i"),year:g,month:Z(ta),day:Q(Ma)},{regexp:new RegExp("^(\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-]("+T+")[\\s\\.\\/\\-](\\-?\\d{3,4})$", +"i"),year:Q(Za),month:Z(Ta),day:Q(ta)},{regexp:new RegExp("^(\\-?\\d{3,4})[\\s\\.\\/\\-]("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)$","i"),year:Q(ta),month:Z(Ma),day:Q(Ta)}];var N;for(N=0;N=Xa&&la.setFullYear(Xa),this.$wrap(la);return this.$raise(d(Da,"ArgumentError"),"invalid date")},ib.$$arity= +-2);a.def(W,"$today",db=function(){return this.$wrap(new Date)},db.$$arity=0);return(a.def(W,"$gregorian_leap?",bb=function(Xa){return 0===(new Date(Xa,1,29)).getMonth()-1},bb.$$arity=1),z)&&"gregorian_leap?"})(a.get_singleton_class(u),e);a.def(u,"$initialize",n=function(W,za,Da,Va){null==W&&(W=-4712);null==za&&(za=1);null==Da&&(Da=1);null==Va&&d(e,"ITALY");1582===W&&10===za&&4Da&&(Da=4);return this.date=new Date(W,za-1,Da)},n.$$arity=-1);a.def(u,"$-",L=function(W){if(W.$$is_number){var za= +this.$clone();za.date.setDate(this.date.getDate()-W);return za}if(W.date)return Math.round((this.date-W.date)/864E5);this.$raise(d(e,"TypeError"))},L.$$arity=1);a.def(u,"$+",D=function(W){if(W.$$is_number){var za=this.$clone();za.date.setDate(this.date.getDate()+W);return za}this.$raise(d(e,"TypeError"))},D.$$arity=1);a.def(u,"$<",R=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za",da=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za>W},da.$$arity=1);a.def(u,"$>=",ma=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za>=W},ma.$$arity=1);a.def(u,"$<=>",b=function(W){if(W.$$is_number)return this.$jd()["$<=>"](W);if(d(e,"Date")["$==="](W)){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return zaW?1:0}return z}, +b.$$arity=1);a.def(u,"$>>",h=function(W){W.$$is_number||this.$raise(d(e,"TypeError"));var za=this.$clone(),Da=za.date,Va=Da.getDate();Da.setDate(1);Da.setMonth(Da.getMonth()+W);Da.setDate(Math.min(Va,I(Da.getFullYear(),Da.getMonth())));return za},h.$$arity=1);a.def(u,"$<<",f=function(W){W.$$is_number||this.$raise(d(e,"TypeError"));return this["$>>"](-W)},f.$$arity=1);a.alias(u,"eql?","==");a.def(u,"$clone",q=function(){return d(e,"Date").$wrap(new Date(this.date.getTime()))},q.$$arity=0);a.def(u, +"$day",A=function(){return this.date.getDate()},A.$$arity=0);a.def(u,"$friday?",E=function(){return this.$wday()["$=="](5)},E.$$arity=0);a.def(u,"$jd",G=function(){var W=this.date.getMonth()+1,za=this.date.getDate(),Da=this.date.getFullYear();var Va=1;1585>=Da&&(Va=0);var ib=-1*Math.floor(7*(Math.floor((W+9)/12)+Da)/4);var db=1;0>W-9&&(db=-1);db=Math.floor(Da+db*Math.floor(Math.abs(W-9)/7));db=-1*Math.floor(3*(Math.floor(db/100)+1)/4);ib=ib+Math.floor(275*W/9)+za+Va*db;return ib+1721027+2*Va+367* +Da-.5+.5},G.$$arity=0);a.def(u,"$julian?",M=function(){return this.dateDa&&(Da="0"+Da);10>W&&(W="0"+W);return za+"-"+Da+"-"+W},V.$$arity=0);a.def(u,"$to_time",ka=function(){return d(e,"Time").$new(this.$year(),this.$month(),this.$day())},ka.$$arity=0);a.def(u,"$to_n",va=function(){return this.date},va.$$arity=0);a.def(u,"$tuesday?",ja=function(){return this.$wday()["$=="](2)},ja.$$arity=0);a.def(u,"$step", +xa=function(W,za){var Da=xa.$$p,Va=Da||z,ib,db,bb=z;bb=bb=z;Da&&(xa.$$p=null);Da&&(xa.$$p=null);null==za&&(za=1);bb=J(W,this).$to_i();bb=k(t("number"===typeof bb&&"number"===typeof za?bb*za:bb["$*"](za),0))?[]:k(t(bb,0))?m(a.Range.$new(0,bb["$-@"](),!1).$step(za.$abs()),"map",[],"-@".$to_proc()).$reverse():a.Range.$new(0,bb,!1).$step(za.$abs());bb=m(bb,"map",[],(ib=function(Xa){var Aa=null==ib.$$s?this:ib.$$s;null==Xa&&(Xa=z);return y(Aa,Xa)},ib.$$s=this,ib.$$arity=1,ib));return Va!==z?(m(bb,"each", +[],(db=function(Xa){null==Xa&&(Xa=z);return a.yield1(Va,Xa)},db.$$s=this,db.$$arity=1,db)),this):bb},xa.$$arity=-2);a.def(u,"$upto",Ha=function(W){var za=Ha.$$p,Da=za||z;za&&(Ha.$$p=null);za&&(Ha.$$p=null);return m(this,"step",[W,1],Da.$to_proc())},Ha.$$arity=1);a.def(u,"$downto",Ea=function(W){var za=Ea.$$p,Da=za||z;za&&(Ea.$$p=null);za&&(Ea.$$p=null);return m(this,"step",[W,-1],Da.$to_proc())},Ea.$$arity=1);a.def(u,"$wday",Qa=function(){return this.date.getDay()},Qa.$$arity=0);a.def(u,"$wednesday?", +Ra=function(){return this.$wday()["$=="](3)},Ra.$$arity=0);a.def(u,"$year",Ia=function(){return this.date.getFullYear()},Ia.$$arity=0);a.def(u,"$cwday",kb=function(){return this.date.getDay()||7},kb.$$arity=0);a.def(u,"$cweek",Sa=function(){var W=new Date(this.date);W.setHours(0,0,0);W.setDate(W.getDate()+4-(W.getDay()||7));return Math.ceil(((W-new Date(W.getFullYear(),0,1))/864E5+1)/7)},Sa.$$arity=0)}(w[0],null,w)})(Opal); (function(a){function y(m,u){return"number"===typeof m&&"number"===typeof u?m-u:m["$-"](u)}var J=[],t=a.nil,w=a.$$$,z=a.$$,p=a.module,d=a.klass,H=a.send,x=a.hash2,k=a.truthy;a.add_stubs("$raise $new $push $[]= $- $[] $create_id $json_create $const_get $attr_accessor $create_id= $=== $parse $generate $from_object $merge $to_json $responds_to? $to_io $write $to_s $to_a $strftime".split(" "));(function(m,u){function c(f){try{return JSON.parse(f)}catch(q){I.$raise(w(z(e,"JSON"),"ParserError"),q.message)}} function l(f,q){var A;switch(typeof f){case "string":return f;case "number":return f;case "boolean":return!!f;case "null":return t;case "object":if(!f)return t;if(f.$$is_array){var E=q.array_class.$new();var G=0;for(A=f.length;G $attr_reader $nonzero? $d $zero? $new $class $-@ $+@ $=== $coerce $== $> $+ $allocate $join $compact $map $to_proc $downcase $wrap $raise $clone $jd $>> $wday $year $month $day $- $to_s $to_i $< $* $reverse $step $abs $each".split(" ")); -return function(u,$super,l){function I(W,za){return[31,0===W%4&&0!==W%100||0===W%400?29:28,31,30,31,30,31,31,30,31,30,31][za]}u=H(u,$super,"Date");var e=[u].concat(l),n,L,D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,xa,Ba,La,na,S,sa,ya,pa,ea,F,V,ka,va,ia,wa,Ha,Ea,Qa,Sa,Ia,kb,Ra;u.$$prototype.date=z;u.$include(d(e,"Comparable"));(function(W,$super,Ca){W=H(W,$super,"Infinity");var Va=[W].concat(Ca),ib,db,Xa,bb,Aa,ta,Ma,Ta,Za,Fa,Y;W.$$prototype.d=z;W.$include(d(Va,"Comparable"));a.def(W,"$initialize",ib=function(Q){null== -Q&&(Q=1);return this.d=Q["$<=>"](0)},ib.$$arity=-1);W.$attr_reader("d");a.def(W,"$zero?",db=function(){return!1},db.$$arity=0);a.def(W,"$finite?",Xa=function(){return!1},Xa.$$arity=0);a.def(W,"$infinite?",bb=function(){return this.$d()["$nonzero?"]()},bb.$$arity=0);a.def(W,"$nan?",Aa=function(){return this.$d()["$zero?"]()},Aa.$$arity=0);a.def(W,"$abs",ta=function(){return this.$class().$new()},ta.$$arity=0);a.def(W,"$-@",Ma=function(){return this.$class().$new(this.$d()["$-@"]())},Ma.$$arity=0); -a.def(W,"$+@",Ta=function(){return this.$class().$new(this.$d()["$+@"]())},Ta.$$arity=0);a.def(W,"$<=>",Za=function(Q){var Z,T,fa=this,la=z,g=z,C=z;return function(){la=Q;if(d(Va,"Infinity")["$==="](la))return fa.$d()["$<=>"](Q.$d());if(d(Va,"Numeric")["$==="](la))return fa.$d();try{return T=Q.$coerce(fa),Z=a.to_ary(T),g=null==Z[0]?z:Z[0],C=null==Z[1]?z:Z[1],T,g["$<=>"](C)}catch(N){if(a.rescue(N,[d(Va,"NoMethodError")]))try{return z}finally{a.pop_exception()}else throw N;}}()},Za.$$arity=1);a.def(W, -"$coerce",Fa=function(Q){var Z=Fa.$$p,T;Z&&(Fa.$$p=null);var fa=0;var la=arguments.length;for(T=Array(la);fa"](0);return k(Q)?p(d(Va,"Float"),"INFINITY"):p(d(Va,"Float"),"INFINITY")["$-@"]()},Y.$$arity=0),z)&&"to_f"})(e[0], +return function(u,$super,l){function I(W,za){return[31,0===W%4&&0!==W%100||0===W%400?29:28,31,30,31,30,31,31,30,31,30,31][za]}u=H(u,$super,"Date");var e=[u].concat(l),n,L,D,R,ia,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,wa,Ba,La,na,S,sa,ya,pa,ha,F,V,ka,va,ja,xa,Ha,Ea,Qa,Ra,Ia,kb,Sa;u.$$prototype.date=z;u.$include(d(e,"Comparable"));(function(W,$super,Da){W=H(W,$super,"Infinity");var Va=[W].concat(Da),ib,db,bb,Xa,Aa,ta,Ma,Ta,Za,Fa,Y;W.$$prototype.d=z;W.$include(d(Va,"Comparable"));a.def(W,"$initialize",ib=function(Q){null== +Q&&(Q=1);return this.d=Q["$<=>"](0)},ib.$$arity=-1);W.$attr_reader("d");a.def(W,"$zero?",db=function(){return!1},db.$$arity=0);a.def(W,"$finite?",bb=function(){return!1},bb.$$arity=0);a.def(W,"$infinite?",Xa=function(){return this.$d()["$nonzero?"]()},Xa.$$arity=0);a.def(W,"$nan?",Aa=function(){return this.$d()["$zero?"]()},Aa.$$arity=0);a.def(W,"$abs",ta=function(){return this.$class().$new()},ta.$$arity=0);a.def(W,"$-@",Ma=function(){return this.$class().$new(this.$d()["$-@"]())},Ma.$$arity=0); +a.def(W,"$+@",Ta=function(){return this.$class().$new(this.$d()["$+@"]())},Ta.$$arity=0);a.def(W,"$<=>",Za=function(Q){var Z,T,ea=this,la=z,g=z,C=z;return function(){la=Q;if(d(Va,"Infinity")["$==="](la))return ea.$d()["$<=>"](Q.$d());if(d(Va,"Numeric")["$==="](la))return ea.$d();try{return T=Q.$coerce(ea),Z=a.to_ary(T),g=null==Z[0]?z:Z[0],C=null==Z[1]?z:Z[1],T,g["$<=>"](C)}catch(N){if(a.rescue(N,[d(Va,"NoMethodError")]))try{return z}finally{a.pop_exception()}else throw N;}}()},Za.$$arity=1);a.def(W, +"$coerce",Fa=function(Q){var Z=Fa.$$p,T;Z&&(Fa.$$p=null);var ea=0;var la=arguments.length;for(T=Array(la);ea"](0);return k(Q)?p(d(Va,"Float"),"INFINITY"):p(d(Va,"Float"),"INFINITY")["$-@"]()},Y.$$arity=0),z)&&"to_f"})(e[0], d(e,"Numeric"),e);a.const_set(e[0],"JULIAN",d(e,"Infinity").$new());a.const_set(e[0],"GREGORIAN",d(e,"Infinity").$new()["$-@"]());a.const_set(e[0],"ITALY",2299161);a.const_set(e[0],"ENGLAND",2361222);a.const_set(e[0],"MONTHNAMES",y([z],"January February March April May June July August September October November December".split(" ")));a.const_set(e[0],"ABBR_MONTHNAMES","jan feb mar apr may jun jul aug sep oct nov dec".split(" "));a.const_set(e[0],"DAYNAMES","Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ")); -a.const_set(e[0],"ABBR_DAYNAMES","Sun Mon Tue Wed Thu Fri Sat".split(" "));(function(W,za){var Ca=[W].concat(za),Va,ib,db,Xa;a.alias(W,"civil","new");a.def(W,"$wrap",Va=function(bb){var Aa=this.$allocate();Aa.date=bb;return Aa},Va.$$arity=1);a.def(W,"$parse",ib=function(bb,Aa){function ta(aa){return aa[1]}function Ma(aa){return aa[2]}function Ta(aa){return aa[3]}function Za(aa){return aa[4]}function Fa(aa){return function(v){v=aa(v);return 69<=v?v+1900:v+2E3}}function Y(aa){return function(v){v=aa(v).toLowerCase(); -return d(Ca,"ABBR_MONTHNAMES").indexOf(v)+1}}function Q(aa){return function(v){v=aa(v);return parseInt(v,10)}}function Z(aa){return function(v){v=aa(v);return m(d(Ca,"MONTHNAMES").$compact(),"map",[],"downcase".$to_proc()).indexOf(v.$downcase())+1}}null==Aa&&(Aa=!0);var T=new Date,fa=T.getDate(),la=T.getMonth(),g=T.getFullYear(),C=T.getDay();T=d(Ca,"MONTHNAMES").$compact().$join("|");T=[{regexp:/^(\d{2})$/,year:g,month:la,day:Q(ta)},{regexp:/^(\d{3})$/,year:g,month:0,day:Q(ta)},{regexp:/^(\d{2})(\d{2})$/, +a.const_set(e[0],"ABBR_DAYNAMES","Sun Mon Tue Wed Thu Fri Sat".split(" "));(function(W,za){var Da=[W].concat(za),Va,ib,db,bb;a.alias(W,"civil","new");a.def(W,"$wrap",Va=function(Xa){var Aa=this.$allocate();Aa.date=Xa;return Aa},Va.$$arity=1);a.def(W,"$parse",ib=function(Xa,Aa){function ta(aa){return aa[1]}function Ma(aa){return aa[2]}function Ta(aa){return aa[3]}function Za(aa){return aa[4]}function Fa(aa){return function(v){v=aa(v);return 69<=v?v+1900:v+2E3}}function Y(aa){return function(v){v=aa(v).toLowerCase(); +return d(Da,"ABBR_MONTHNAMES").indexOf(v)+1}}function Q(aa){return function(v){v=aa(v);return parseInt(v,10)}}function Z(aa){return function(v){v=aa(v);return m(d(Da,"MONTHNAMES").$compact(),"map",[],"downcase".$to_proc()).indexOf(v.$downcase())+1}}null==Aa&&(Aa=!0);var T=new Date,ea=T.getDate(),la=T.getMonth(),g=T.getFullYear(),C=T.getDay();T=d(Da,"MONTHNAMES").$compact().$join("|");T=[{regexp:/^(\d{2})$/,year:g,month:la,day:Q(ta)},{regexp:/^(\d{3})$/,year:g,month:0,day:Q(ta)},{regexp:/^(\d{2})(\d{2})$/, year:g,month:Q(ta),day:Q(Ma)},{regexp:/^(\d{2})(\d{3})$/,year:Fa(Q(ta)),month:0,day:Q(Ma)},{regexp:/^(\d{2})(\d{2})(\d{2})$/,year:Fa(Q(ta)),month:Q(Ma),day:Q(Ta)},{regexp:/^(\d{4})(\d{3})$/,year:Q(ta),month:0,day:Q(Ma)},{regexp:/^(\d{4})(\d{2})(\d{2})$/,year:Q(ta),month:Q(Ma),day:Q(Ta)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{3,4})$/,year:Q(Ma),month:Y(ta),day:1},{regexp:/^(\d{1,2})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{3,4})$/i,year:Q(Ta),month:Y(Ma),day:Q(ta)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{3,4})$/i, year:Q(Ta),month:Y(ta),day:Q(Ma)},{regexp:/^(\d{3,4})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{1,2})$/i,year:Q(ta),month:Y(Ma),day:Q(Ta)},{regexp:/^(\-?\d{3,4})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:Q(ta),month:Q(Ma),day:Q(Ta)},{regexp:/^(\d{2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:function(aa){return function(v){v=aa(v);return Aa?v+2E3:v}}(Q(ta)),month:Q(Ma),day:Q(Ta)},{regexp:/^(\d{1,2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\-?\d{3,4})$/,year:Q(Ta),month:Q(Ma),day:Q(ta)},{regexp:new RegExp("^("+ -d(Ca,"DAYNAMES").$join("|")+")$","i"),year:g,month:la,day:function(aa){return function(v){v=aa(v);v=m(d(Ca,"DAYNAMES"),"map",[],"downcase".$to_proc()).indexOf(v.$downcase());return fa-C+v}}(ta)},{regexp:new RegExp("^("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-](\\-?\\d{3,4})$","i"),year:Q(Za),month:Z(ta),day:Q(Ma)},{regexp:new RegExp("^("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)","i"),year:g,month:Z(ta),day:Q(Ma)},{regexp:new RegExp("^(\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-]("+T+")[\\s\\.\\/\\-](\\-?\\d{3,4})$", -"i"),year:Q(Za),month:Z(Ta),day:Q(ta)},{regexp:new RegExp("^(\\-?\\d{3,4})[\\s\\.\\/\\-]("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)$","i"),year:Q(ta),month:Z(Ma),day:Q(Ta)}];var N;for(N=0;N=bb&&la.setFullYear(bb),this.$wrap(la);return this.$raise(d(Ca,"ArgumentError"),"invalid date")},ib.$$arity= --2);a.def(W,"$today",db=function(){return this.$wrap(new Date)},db.$$arity=0);return(a.def(W,"$gregorian_leap?",Xa=function(bb){return 0===(new Date(bb,1,29)).getMonth()-1},Xa.$$arity=1),z)&&"gregorian_leap?"})(a.get_singleton_class(u),e);a.def(u,"$initialize",n=function(W,za,Ca,Va){null==W&&(W=-4712);null==za&&(za=1);null==Ca&&(Ca=1);null==Va&&d(e,"ITALY");1582===W&&10===za&&4Ca&&(Ca=4);return this.date=new Date(W,za-1,Ca)},n.$$arity=-1);a.def(u,"$-",L=function(W){if(W.$$is_number){var za= -this.$clone();za.date.setDate(this.date.getDate()-W);return za}if(W.date)return Math.round((this.date-W.date)/864E5);this.$raise(d(e,"TypeError"))},L.$$arity=1);a.def(u,"$+",D=function(W){if(W.$$is_number){var za=this.$clone();za.date.setDate(this.date.getDate()+W);return za}this.$raise(d(e,"TypeError"))},D.$$arity=1);a.def(u,"$<",R=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za",da=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za>W},da.$$arity=1);a.def(u,"$>=",ma=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za>=W},ma.$$arity=1);a.def(u,"$<=>",b=function(W){if(W.$$is_number)return this.$jd()["$<=>"](W);if(d(e,"Date")["$==="](W)){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return zaW?1:0}return z}, -b.$$arity=1);a.def(u,"$>>",h=function(W){W.$$is_number||this.$raise(d(e,"TypeError"));var za=this.$clone(),Ca=za.date,Va=Ca.getDate();Ca.setDate(1);Ca.setMonth(Ca.getMonth()+W);Ca.setDate(Math.min(Va,I(Ca.getFullYear(),Ca.getMonth())));return za},h.$$arity=1);a.def(u,"$<<",f=function(W){W.$$is_number||this.$raise(d(e,"TypeError"));return this["$>>"](-W)},f.$$arity=1);a.alias(u,"eql?","==");a.def(u,"$clone",q=function(){return d(e,"Date").$wrap(new Date(this.date.getTime()))},q.$$arity=0);a.def(u, -"$day",A=function(){return this.date.getDate()},A.$$arity=0);a.def(u,"$friday?",E=function(){return this.$wday()["$=="](5)},E.$$arity=0);a.def(u,"$jd",G=function(){var W=this.date.getMonth()+1,za=this.date.getDate(),Ca=this.date.getFullYear();var Va=1;1585>=Ca&&(Va=0);var ib=-1*Math.floor(7*(Math.floor((W+9)/12)+Ca)/4);var db=1;0>W-9&&(db=-1);db=Math.floor(Ca+db*Math.floor(Math.abs(W-9)/7));db=-1*Math.floor(3*(Math.floor(db/100)+1)/4);ib=ib+Math.floor(275*W/9)+za+Va*db;return ib+1721027+2*Va+367* -Ca-.5+.5},G.$$arity=0);a.def(u,"$julian?",M=function(){return this.dateCa&&(Ca="0"+Ca);10>W&&(W="0"+W);return za+"-"+Ca+"-"+W},V.$$arity=0);a.def(u,"$to_time",ka=function(){return d(e,"Time").$new(this.$year(),this.$month(),this.$day())},ka.$$arity=0);a.def(u,"$to_n",va=function(){return this.date},va.$$arity=0);a.def(u,"$tuesday?",ia=function(){return this.$wday()["$=="](2)},ia.$$arity=0);a.def(u,"$step", -wa=function(W,za){var Ca=wa.$$p,Va=Ca||z,ib,db,Xa=z;Xa=Xa=z;Ca&&(wa.$$p=null);Ca&&(wa.$$p=null);null==za&&(za=1);Xa=J(W,this).$to_i();Xa=k(t("number"===typeof Xa&&"number"===typeof za?Xa*za:Xa["$*"](za),0))?[]:k(t(Xa,0))?m(a.Range.$new(0,Xa["$-@"](),!1).$step(za.$abs()),"map",[],"-@".$to_proc()).$reverse():a.Range.$new(0,Xa,!1).$step(za.$abs());Xa=m(Xa,"map",[],(ib=function(bb){var Aa=null==ib.$$s?this:ib.$$s;null==bb&&(bb=z);return y(Aa,bb)},ib.$$s=this,ib.$$arity=1,ib));return Va!==z?(m(Xa,"each", -[],(db=function(bb){null==bb&&(bb=z);return a.yield1(Va,bb)},db.$$s=this,db.$$arity=1,db)),this):Xa},wa.$$arity=-2);a.def(u,"$upto",Ha=function(W){var za=Ha.$$p,Ca=za||z;za&&(Ha.$$p=null);za&&(Ha.$$p=null);return m(this,"step",[W,1],Ca.$to_proc())},Ha.$$arity=1);a.def(u,"$downto",Ea=function(W){var za=Ea.$$p,Ca=za||z;za&&(Ea.$$p=null);za&&(Ea.$$p=null);return m(this,"step",[W,-1],Ca.$to_proc())},Ea.$$arity=1);a.def(u,"$wday",Qa=function(){return this.date.getDay()},Qa.$$arity=0);a.def(u,"$wednesday?", -Sa=function(){return this.$wday()["$=="](3)},Sa.$$arity=0);a.def(u,"$year",Ia=function(){return this.date.getFullYear()},Ia.$$arity=0);a.def(u,"$cwday",kb=function(){return this.date.getDay()||7},kb.$$arity=0);a.def(u,"$cweek",Ra=function(){var W=new Date(this.date);W.setHours(0,0,0);W.setDate(W.getDate()+4-(W.getDay()||7));return Math.ceil(((W-new Date(W.getFullYear(),0,1))/864E5+1)/7)},Ra.$$arity=0)}(w[0],null,w)}; -(function(a){function y(I,e){return"number"===typeof I&&"number"===typeof e?I+e:I["$+"](e)}function J(I,e){return"number"===typeof I&&"number"===typeof e?I>e:I["$>"](e)}function t(I,e){return"number"===typeof I&&"number"===typeof e?I $length $change_state $to_i $list $< $set_priority $due_date $append $rename $!= $delete $add_note $delete_note $show $puts $usage $start_repl $cleanup $colorize $private $keys $map $select $parse $strftime $today $downcase $lambda $match $== $! $each $split $strip $chomp $[]= $- $has_key? $sort $generate $gsub $convert_due_date $postprocess_tags $load_tasks $call $write_tasks $update_task $push $max $size $to_s $filter_tasks $sort_by $start_with? $abs $rjust $kind_of? $execute $to_a $index $new".split(" ")); -z.$require("json");z.$require("date");(function(I,$super,n){I=k(I,$super,"Todo");var L=[I].concat(n),D,R,ja,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,xa,Ba,La,na,S,sa,ya;I.$$prototype.queries=I.$$prototype.today=I.$$prototype.due_date_days=d;a.const_set(L[0],"COLOR_CODES",m("black red green yellow blue magenta cyan white".split(" "),{black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37}));a.const_set(L[0],"STATES",m(["new","done","started","blocked","default"],{"new":"[ ]",done:"[x]",started:"[>]", +d(Da,"DAYNAMES").$join("|")+")$","i"),year:g,month:la,day:function(aa){return function(v){v=aa(v);v=m(d(Da,"DAYNAMES"),"map",[],"downcase".$to_proc()).indexOf(v.$downcase());return ea-C+v}}(ta)},{regexp:new RegExp("^("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-](\\-?\\d{3,4})$","i"),year:Q(Za),month:Z(ta),day:Q(Ma)},{regexp:new RegExp("^("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)","i"),year:g,month:Z(ta),day:Q(Ma)},{regexp:new RegExp("^(\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-]("+T+")[\\s\\.\\/\\-](\\-?\\d{3,4})$", +"i"),year:Q(Za),month:Z(Ta),day:Q(ta)},{regexp:new RegExp("^(\\-?\\d{3,4})[\\s\\.\\/\\-]("+T+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)$","i"),year:Q(ta),month:Z(Ma),day:Q(Ta)}];var N;for(N=0;N=Xa&&la.setFullYear(Xa),this.$wrap(la);return this.$raise(d(Da,"ArgumentError"),"invalid date")},ib.$$arity= +-2);a.def(W,"$today",db=function(){return this.$wrap(new Date)},db.$$arity=0);return(a.def(W,"$gregorian_leap?",bb=function(Xa){return 0===(new Date(Xa,1,29)).getMonth()-1},bb.$$arity=1),z)&&"gregorian_leap?"})(a.get_singleton_class(u),e);a.def(u,"$initialize",n=function(W,za,Da,Va){null==W&&(W=-4712);null==za&&(za=1);null==Da&&(Da=1);null==Va&&d(e,"ITALY");1582===W&&10===za&&4Da&&(Da=4);return this.date=new Date(W,za-1,Da)},n.$$arity=-1);a.def(u,"$-",L=function(W){if(W.$$is_number){var za= +this.$clone();za.date.setDate(this.date.getDate()-W);return za}if(W.date)return Math.round((this.date-W.date)/864E5);this.$raise(d(e,"TypeError"))},L.$$arity=1);a.def(u,"$+",D=function(W){if(W.$$is_number){var za=this.$clone();za.date.setDate(this.date.getDate()+W);return za}this.$raise(d(e,"TypeError"))},D.$$arity=1);a.def(u,"$<",R=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za",da=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za>W},da.$$arity=1);a.def(u,"$>=",ma=function(W){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return za>=W},ma.$$arity=1);a.def(u,"$<=>",b=function(W){if(W.$$is_number)return this.$jd()["$<=>"](W);if(d(e,"Date")["$==="](W)){var za=this.date;W=W.date;za.setHours(0,0,0,0);W.setHours(0,0,0,0);return zaW?1:0}return z}, +b.$$arity=1);a.def(u,"$>>",h=function(W){W.$$is_number||this.$raise(d(e,"TypeError"));var za=this.$clone(),Da=za.date,Va=Da.getDate();Da.setDate(1);Da.setMonth(Da.getMonth()+W);Da.setDate(Math.min(Va,I(Da.getFullYear(),Da.getMonth())));return za},h.$$arity=1);a.def(u,"$<<",f=function(W){W.$$is_number||this.$raise(d(e,"TypeError"));return this["$>>"](-W)},f.$$arity=1);a.alias(u,"eql?","==");a.def(u,"$clone",q=function(){return d(e,"Date").$wrap(new Date(this.date.getTime()))},q.$$arity=0);a.def(u, +"$day",A=function(){return this.date.getDate()},A.$$arity=0);a.def(u,"$friday?",E=function(){return this.$wday()["$=="](5)},E.$$arity=0);a.def(u,"$jd",G=function(){var W=this.date.getMonth()+1,za=this.date.getDate(),Da=this.date.getFullYear();var Va=1;1585>=Da&&(Va=0);var ib=-1*Math.floor(7*(Math.floor((W+9)/12)+Da)/4);var db=1;0>W-9&&(db=-1);db=Math.floor(Da+db*Math.floor(Math.abs(W-9)/7));db=-1*Math.floor(3*(Math.floor(db/100)+1)/4);ib=ib+Math.floor(275*W/9)+za+Va*db;return ib+1721027+2*Va+367* +Da-.5+.5},G.$$arity=0);a.def(u,"$julian?",M=function(){return this.dateDa&&(Da="0"+Da);10>W&&(W="0"+W);return za+"-"+Da+"-"+W},V.$$arity=0);a.def(u,"$to_time",ka=function(){return d(e,"Time").$new(this.$year(),this.$month(),this.$day())},ka.$$arity=0);a.def(u,"$to_n",va=function(){return this.date},va.$$arity=0);a.def(u,"$tuesday?",ja=function(){return this.$wday()["$=="](2)},ja.$$arity=0);a.def(u,"$step", +xa=function(W,za){var Da=xa.$$p,Va=Da||z,ib,db,bb=z;bb=bb=z;Da&&(xa.$$p=null);Da&&(xa.$$p=null);null==za&&(za=1);bb=J(W,this).$to_i();bb=k(t("number"===typeof bb&&"number"===typeof za?bb*za:bb["$*"](za),0))?[]:k(t(bb,0))?m(a.Range.$new(0,bb["$-@"](),!1).$step(za.$abs()),"map",[],"-@".$to_proc()).$reverse():a.Range.$new(0,bb,!1).$step(za.$abs());bb=m(bb,"map",[],(ib=function(Xa){var Aa=null==ib.$$s?this:ib.$$s;null==Xa&&(Xa=z);return y(Aa,Xa)},ib.$$s=this,ib.$$arity=1,ib));return Va!==z?(m(bb,"each", +[],(db=function(Xa){null==Xa&&(Xa=z);return a.yield1(Va,Xa)},db.$$s=this,db.$$arity=1,db)),this):bb},xa.$$arity=-2);a.def(u,"$upto",Ha=function(W){var za=Ha.$$p,Da=za||z;za&&(Ha.$$p=null);za&&(Ha.$$p=null);return m(this,"step",[W,1],Da.$to_proc())},Ha.$$arity=1);a.def(u,"$downto",Ea=function(W){var za=Ea.$$p,Da=za||z;za&&(Ea.$$p=null);za&&(Ea.$$p=null);return m(this,"step",[W,-1],Da.$to_proc())},Ea.$$arity=1);a.def(u,"$wday",Qa=function(){return this.date.getDay()},Qa.$$arity=0);a.def(u,"$wednesday?", +Ra=function(){return this.$wday()["$=="](3)},Ra.$$arity=0);a.def(u,"$year",Ia=function(){return this.date.getFullYear()},Ia.$$arity=0);a.def(u,"$cwday",kb=function(){return this.date.getDay()||7},kb.$$arity=0);a.def(u,"$cweek",Sa=function(){var W=new Date(this.date);W.setHours(0,0,0);W.setDate(W.getDate()+4-(W.getDay()||7));return Math.ceil(((W-new Date(W.getFullYear(),0,1))/864E5+1)/7)},Sa.$$arity=0)}(w[0],null,w)}; +(function(a){function y(I,e){return"number"===typeof I&&"number"===typeof e?I+e:I["$+"](e)}function J(I,e){return"number"===typeof I&&"number"===typeof e?I>e:I["$>"](e)}function t(I,e){return"number"===typeof I&&"number"===typeof e?I $length $change_state $to_i $list $< $set_priority $due_date $append $rename $!= $delete $add_note $delete_note $show $puts $usage $start_repl $cleanup $colorize $private $keys $map $select $parse $strftime $today $downcase $lambda $match $== $! $each $split $strip $chomp $[]= $- $has_key? $sort $generate $gsub $convert_due_date $postprocess_tags $load_tasks $call $write_tasks $update_task $push $max $size $to_s $sort_by $filter_tasks $start_with? $abs $rjust $kind_of? $execute $to_a $index $new".split(" ")); +z.$require("json");z.$require("date");(function(I,$super,n){I=k(I,$super,"Todo");var L=[I].concat(n),D,R,ia,da,ma,b,h,f,q,A,E,G,M,ba,ua,Oa,wa,Ba,La,na,S,sa,ya;I.$$prototype.queries=I.$$prototype.today=I.$$prototype.due_date_days=d;a.const_set(L[0],"COLOR_CODES",m("black red green yellow blue magenta cyan white".split(" "),{black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37}));a.const_set(L[0],"STATES",m(["new","done","started","blocked","default"],{"new":"[ ]",done:"[x]",started:"[>]", blocked:"[!]","default":"[?]"}));a.const_set(L[0],"ORDER",m(["new","done","started","blocked","default"],{"new":3,done:4,started:2,blocked:1,"default":100}));a.const_set(L[0],"COLORS",m(["new","done","started","blocked","default"],{"new":"white",done:"blue",started:"green",blocked:"yellow","default":"magenta"}));a.const_set(L[0],"DATE_FORMAT","%Y-%m-%d");a.const_set(L[0],"DUE_DATE_DAYS_SIMPLE",["today","tomorrow"]);a.const_set(L[0],"DUE_DATE_TAG_PATTERN",/(^| )due:([a-zA-Z0-9-]+)/);a.const_set(L[0], -"CONTEXT_TAG_PATTERN",/(^| )[@+][\w-]+/);a.const_set(L[0],"PRIORITY_FLAG","*");a.const_set(L[0],"TODO_FILE",require("path").join(require("os").homedir(),"/todo.jsonl"));a.def(I,"$execute",D=function(pa){var ea=d,F=d,V=d,ka=d,va=d,ia=d,wa=d,Ha=d,Ea=d,Qa=d,Sa=d,Ia=d;try{this.$setup(),ea=pa.$first(),F=u(V=pa["$[]"](c(1,-1,!1)))?V:[],ka=ea,"add"["$==="](ka)?(u(u(va=F["$nil?"]())?va:F["$empty?"]())&&this.$raise(y(ea," command requires at least one parameter")),this.$add(F.$join(" "))):"start"["$==="](ka)? -u(J(F.$length(),0))?this.$change_state(F.$first().$to_i(),"started",(u(ia=F["$[]"](c(1,-1,!1)))?ia:[]).$join(" ")):this.$list(d,[":started"]):"done"["$==="](ka)?u(J(F.$length(),0))?this.$change_state(F.$first().$to_i(),"done",(u(wa=F["$[]"](c(1,-1,!1)))?wa:[]).$join(" ")):this.$list(d,[":done"]):"block"["$==="](ka)?u(J(F.$length(),0))?this.$change_state(F.$first().$to_i(),"blocked",(u(Ha=F["$[]"](c(1,-1,!1)))?Ha:[]).$join(" ")):this.$list(d,[":blocked"]):"reset"["$==="](ka)?u(J(F.$length(),0))?this.$change_state(F.$first().$to_i(), -"new",(u(Ea=F["$[]"](c(1,-1,!1)))?Ea:[]).$join(" ")):this.$list(d,[":new"]):"prio"["$==="](ka)?(u(t(F.$length(),1))&&this.$raise(y(ea," command requires at least one parameter")),this.$set_priority(F.$first().$to_i(),(u(Qa=F["$[]"](c(1,-1,!1)))?Qa:[]).$join(" "))):"due"["$==="](ka)?(u(t(F.$length(),1))&&this.$raise(y(ea," command requires at least one parameter")),this.$due_date(F.$first().$to_i(),(u(Sa=F["$[]"](c(1,-1,!1)))?Sa:[]).$join(" "))):"append"["$==="](ka)?(u(t(F.$length(),2))&&this.$raise(y(ea, -" command requires at least two parameters")),this.$append(F.$first().$to_i(),F["$[]"](c(1,-1,!1)).$join(" "))):"rename"["$==="](ka)?(u(t(F.$length(),2))&&this.$raise(y(ea," command requires at least two parameters")),this.$rename(F.$first().$to_i(),F["$[]"](c(1,-1,!1)).$join(" "))):"del"["$==="](ka)?(u(F.$length()["$!="](1))&&this.$raise(y(ea," command requires exactly one parameter")),this.$delete(F.$first().$to_i())):"note"["$==="](ka)?(u(t(F.$length(),2))&&this.$raise(y(ea," command requires at least two parameters")), -this.$add_note(F.$first().$to_i(),F["$[]"](c(1,-1,!1)).$join(" "))):"delnote"["$==="](ka)?(u(F.$length()["$!="](1))&&this.$raise(y(ea," command requires exactly one parameter")),this.$delete_note(F.$first().$to_i())):"list"["$==="](ka)?this.$list(d,F):"show"["$==="](ka)?(u(F.$length()["$!="](1))&&this.$raise(y(ea," command requires exactly one parameter")),this.$show(F.$first().$to_i())):"help"["$==="](ka)?(u(J(F.$length(),0))&&this.$raise(y(ea," command has no parameters")),this.$puts(this.$usage())): -"repl"["$==="](ka)?(u(J(F.$length(),0))&&this.$raise(y(ea," command has no parameters")),this.$start_repl()):"cleanup"["$==="](ka)?(u(u(Ia=F["$nil?"]())?Ia:F["$empty?"]())&&this.$raise(y(ea," command requires at least one parameter")),this.$cleanup(F)):this.$list(d,pa)}catch(kb){if(a.rescue(kb,[H(x(L,"JS"),"Error"),x(L,"RuntimeError")])){pa=kb;try{this.$puts(""+this.$colorize("ERROR:","red")+" "+pa)}finally{a.pop_exception()}}else throw kb;}return this},D.$$arity=1);I.$private();a.def(I,"$usage", -R=function(){var pa,ea;return"Usage: todo \n\nCommands:\n* add add new task\n* start [text] mark task as started, with optional note\n* done [text] mark task as completed, with optional note\n* block [text] mark task as blocked, with optional note\n* reset [text] reset task to new state, with optional note\n* prio [text] toggle high priority flag, with optional note\n* due [date] set/unset due date (in YYYY-MM-DD format)\n\n* append append text to task title\n* rename rename task\n* del delete task\n* note add note to task\n* delnote delete all notes from task\n\n* list [regex...] list tasks (only active tasks by default)\n* show show all task details\n* repl enter read-eval-print loop mode\n* cleanup [regex...] cleanup completed tasks by regex\n* help this help screen\n\nWith list command the following pre-defined regex patterns can be also used:\n"+ -this.queries.$keys().$join(", ")+'\n\nDue dates can be also added via tags in task title: "due:YYYY-MM-DD"\n\nLegend:\n'+l(l(x(L,"STATES"),"select",[],(pa=function(F){null==F&&(F=d);return F["$!="]("default")},pa.$$s=this,pa.$$arity=2,pa)),"map",[],(ea=function(F,V){null==F&&(F=d);null==V&&(V=d);return""+F+" "+V},ea.$$s=this,ea.$$arity=2,ea)).$join(", ")+", priority "+x(L,"PRIORITY_FLAG")+"\n\nTodo file: "+x(L,"TODO_FILE")+"\n"},R.$$arity=0);a.def(I,"$setup",ja=function(){var pa,ea,F,V,ka,va,ia,wa, -Ha,Ea,Qa,Sa,Ia=d,kb=d;this.today=x(L,"Date").$parse(x(L,"Date").$today().$strftime(x(L,"DATE_FORMAT")));Ia=l(c(0,6,!1),"map",[],(pa=function(Ra){var W=null==pa.$$s?this:pa.$$s;null==W.today&&(W.today=d);null==Ra&&(Ra=d);return y(W.today,Ra)},pa.$$s=this,pa.$$arity=1,pa));this.due_date_days=l(Ia,"map",[],(ea=function(Ra){null==Ra&&(Ra=d);return Ra.$strftime("%A").$downcase()},ea.$$s=this,ea.$$arity=1,ea));kb=l(Ia,"map",[],(F=function(Ra){null==Ra&&(Ra=d);return Ra.$strftime(x(L,"DATE_FORMAT"))},F.$$s= -this,F.$$arity=1,F));return this.queries=m(":active :done :blocked :started :new :all :today :tomorrow :next7days".split(" "),{":active":l(this,"lambda",[],(V=function(Ra){null==Ra&&(Ra=d);return/(new|started|blocked)/.$match(Ra["$[]"]("state"))},V.$$s=this,V.$$arity=1,V)),":done":l(this,"lambda",[],(ka=function(Ra){null==Ra&&(Ra=d);return"done"["$=="](Ra["$[]"]("state"))},ka.$$s=this,ka.$$arity=1,ka)),":blocked":l(this,"lambda",[],(va=function(Ra){null==Ra&&(Ra=d);return"blocked"["$=="](Ra["$[]"]("state"))}, -va.$$s=this,va.$$arity=1,va)),":started":l(this,"lambda",[],(ia=function(Ra){null==Ra&&(Ra=d);return"started"["$=="](Ra["$[]"]("state"))},ia.$$s=this,ia.$$arity=1,ia)),":new":l(this,"lambda",[],(wa=function(Ra){null==Ra&&(Ra=d);return"new"["$=="](Ra["$[]"]("state"))},wa.$$s=this,wa.$$arity=1,wa)),":all":l(this,"lambda",[],(Ha=function(Ra){null==Ra&&(Ra=d);return/\w+/.$match(Ra["$[]"]("state"))},Ha.$$s=this,Ha.$$arity=1,Ha)),":today":l(this,"lambda",[],(Ea=function(Ra){null==Ra&&(Ra=d);return kb["$[]"](0)["$=="](Ra["$[]"]("due"))}, -Ea.$$s=this,Ea.$$arity=1,Ea)),":tomorrow":l(this,"lambda",[],(Qa=function(Ra){null==Ra&&(Ra=d);return kb["$[]"](1)["$=="](Ra["$[]"]("due"))},Qa.$$s=this,Qa.$$arity=1,Qa)),":next7days":l(this,"lambda",[],(Sa=function(Ra){null==Ra&&(Ra=d);return a.regexp(["(",kb.$join("|"),")"]).$match(Ra["$[]"]("due"))},Sa.$$s=this,Sa.$$arity=1,Sa))})},ja.$$arity=0);a.def(I,"$load_tasks",da=function(pa){var ea,F=d,V=d,ka=d,va=d;null==pa&&(pa=d);F=0;V=m([],{});ka=function(){var ia=require("fs");return ia.existsSync(x(L, -"TODO_FILE"))?ia.readFileSync(x(L,"TODO_FILE"),"utf8"):""}.call();u(ka["$empty?"]()["$!"]())&&l(ka.$split("\n"),"each",[],(ea=function(ia){null==ia&&(ia=d);if(ia.$strip()["$=="](""))return d;F=y(F,1);ia=[F,x(L,"JSON").$parse(ia.$chomp(),m(["symbolize_names"],{symbolize_names:!0}))];l(V,"[]=",a.to_a(ia));return ia[w(ia.length,1)]},ea.$$s=this,ea.$$arity=1,ea));u(u(va=pa)?V["$has_key?"](pa)["$!"]():va)&&this.$raise(""+pa+": No such todo");return V},da.$$arity=-1);a.def(I,"$write_tasks",ma=function(pa){var ea, -F=d;F=y(l(pa.$keys().$sort(),"map",[],(ea=function(V){null==V&&(V=d);return x(L,"JSON").$generate(pa["$[]"](V))},ea.$$s=this,ea.$$arity=1,ea)).$join("\n"),"\n");return require("fs").writeFileSync(x(L,"TODO_FILE"),F,"utf8")},ma.$$arity=1);a.def(I,"$postprocess_tags",b=function(pa){var ea=pa["$[]"]("title").$match(x(L,"DUE_DATE_TAG_PATTERN"));if(u(ea)){var F=["title",pa["$[]"]("title").$gsub(x(L,"DUE_DATE_TAG_PATTERN"),"")];l(pa,"[]=",a.to_a(F));F[w(F.length,1)];F=["due",this.$convert_due_date(ea["$[]"](2))]; -l(pa,"[]=",a.to_a(F));F[w(F.length,1)]}return u(pa["$[]"]("title")["$empty?"]())?this.$raise("title must not be empty"):d},b.$$arity=1);a.def(I,"$add",h=function(pa){pa=m(["state","title","modified"],{state:"new",title:pa,modified:this.today.$strftime(x(L,"DATE_FORMAT"))});this.$postprocess_tags(pa);var ea=require("fs");var F=ea.existsSync(x(L,"TODO_FILE"))?ea.readFileSync(x(L,"TODO_FILE"),"utf8"):"";F+=x(L,"JSON").$generate(pa)+"\n";ea.writeFileSync(x(L,"TODO_FILE"),F,"utf8");return this.$list()}, -h.$$arity=1);a.def(I,"$update_task",f=function(pa,ea,F){var V=this.$load_tasks(pa);F.$call(V["$[]"](pa));F=["modified",this.today.$strftime(x(L,"DATE_FORMAT"))];l(V["$[]"](pa),"[]=",a.to_a(F));F[w(F.length,1)];this.$write_tasks(V);return"show"["$==="](ea)?this.$show(pa,V):"list"["$==="](ea)?this.$list(V):d},f.$$arity=3);a.def(I,"$append",q=function(pa,ea){var F;null==ea&&(ea="");return this.$update_task(pa,"list",l(this,"lambda",[],(F=function(V){var ka=null==F.$$s?this:F.$$s;null==V&&(V=d);var va= -["title",[V["$[]"]("title"),ea].$join(" ")];l(V,"[]=",a.to_a(va));va[w(va.length,1)];return ka.$postprocess_tags(V)},F.$$s=this,F.$$arity=1,F)))},q.$$arity=-2);a.def(I,"$rename",A=function(pa,ea){var F;return this.$update_task(pa,"list",l(this,"lambda",[],(F=function(V){var ka=null==F.$$s?this:F.$$s;null==V&&(V=d);var va=["title",ea];l(V,"[]=",a.to_a(va));va[w(va.length,1)];return ka.$postprocess_tags(V)},F.$$s=this,F.$$arity=1,F)))},A.$$arity=2);a.def(I,"$delete",E=function(pa){var ea=this.$load_tasks(pa); -ea.$delete(pa);this.$write_tasks(ea);return this.$list()},E.$$arity=1);a.def(I,"$change_state",G=function(pa,ea,F){var V;null==F&&(F=d);return this.$update_task(pa,"list",l(this,"lambda",[],(V=function(ka){var va=d;null==ka&&(ka=d);var ia=["state",ea];l(ka,"[]=",a.to_a(ia));ia[w(ia.length,1)];return u(u(va=F["$nil?"]()["$!"]())?F["$empty?"]()["$!"]():va)?(u(ia=ka["$[]"]("note"))?ia:(ia=["note",[]],l(ka,"[]=",a.to_a(ia)),ia[w(ia.length,1)]),ka["$[]"]("note").$push(F)):d},V.$$s=this,V.$$arity=1,V)))}, -G.$$arity=-3);a.def(I,"$set_priority",M=function(pa,ea){var F;null==ea&&(ea=d);return this.$update_task(pa,"list",l(this,"lambda",[],(F=function(V){var ka=d;null==V&&(V=d);var va=["priority",V["$[]"]("priority")["$!"]()];l(V,"[]=",a.to_a(va));va[w(va.length,1)];u(V["$[]"]("priority")["$!"]())&&V.$delete("priority");return u(u(ka=ea["$nil?"]()["$!"]())?ea["$empty?"]()["$!"]():ka)?(u(va=V["$[]"]("note"))?va:(va=["note",[]],l(V,"[]=",a.to_a(va)),va[w(va.length,1)]),V["$[]"]("note").$push(ea)):d},F.$$s= -this,F.$$arity=1,F)))},M.$$arity=-2);a.def(I,"$due_date",ba=function(pa,ea){var F;null==ea&&(ea="");return this.$update_task(pa,"list",l(this,"lambda",[],(F=function(V){var ka=null==F.$$s?this:F.$$s;null==V&&(V=d);ka=["due",ka.$convert_due_date(ea)];l(V,"[]=",a.to_a(ka));ka[w(ka.length,1)];return u(V["$[]"]("due")["$nil?"]())?V.$delete("due"):d},F.$$s=this,F.$$arity=1,F)))},ba.$$arity=-2);a.def(I,"$list",ua=function(pa,ea){var F,V,ka=d,va=d,ia=d,wa=d;null==pa&&(pa=d);null==ea&&(ea=d);pa=u(ka=pa)? -ka:this.$load_tasks();va=[pa.$keys().$max().$to_s().$size(),4].$max();ea=u(u(ia=ea["$nil?"]())?ia:ea["$empty?"]())?[":active"]:ea;wa=this.$filter_tasks(pa,ea);wa=l(wa,"sort_by",[],(F=function(Ha,Ea){var Qa=d,Sa=d,Ia=d;null==Ha&&(Ha=d);null==Ea&&(Ea=d);return[u(u(Qa=Ea["$[]"]("priority"))?Ea["$[]"]("state")["$!="]("done"):Qa)?0:1,x(L,"ORDER")["$[]"](u(Sa=Ea["$[]"]("state"))?Sa:"default"),u(Ia=Ea["$[]"]("due"))?Ia:"n/a",Ha]},F.$$s=this,F.$$arity=2,F));l(wa,"each",[],(V=function(Ha,Ea){var Qa=null== -V.$$s?this:V.$$s,Sa,Ia=d,kb=d,Ra=d,W=Ra=d,za=d,Ca=d,Va=d,ib=Ia=d,db=d;null==Qa.today&&(Qa.today=d);null==Qa.due_date_days&&(Qa.due_date_days=d);null==Ha&&(Ha=d);null==Ea&&(Ea=d);Ia=u(kb=Ea["$[]"]("state"))?kb:"default";Ra=x(L,"COLORS")["$[]"](Ia);Ra=Qa.$colorize(x(L,"STATES")["$[]"](Ia),Ra);W=l(Ea["$[]"]("title"),"gsub",[x(L,"CONTEXT_TAG_PATTERN")],(Sa=function(Xa){var bb=null==Sa.$$s?this:Sa.$$s;null==Xa&&(Xa=d);return y(u(Xa["$start_with?"](" "))?" ":"",bb.$colorize(Xa.$strip(),"cyan"))},Sa.$$s= -Qa,Sa.$$arity=1,Sa));za=u(Ea["$[]"]("priority"))?Qa.$colorize(x(L,"PRIORITY_FLAG"),"red"):" ";Ca="";u(u(Va=Ea["$[]"]("due"))?Ia["$!="]("done"):Va)&&(Ia=w(x(L,"Date").$parse(Ea["$[]"]("due")),Qa.today).$to_i(),u(t(Ia,0))?Ca=Qa.$colorize("("+Ia.$abs()+"d overdue)","red"):u(u(ib=Ia["$=="](0))?ib:Ia["$=="](1))?Ca=Qa.$colorize("("+x(L,"DUE_DATE_DAYS_SIMPLE")["$[]"](Ia)+")","yellow"):u(J(Ia,1))&&(Ca=Qa.$colorize("("+(u(db=Qa.due_date_days["$[]"](Ia))?db:Ea["$[]"]("due"))+")","magenta")),Ca=y(" ",Ca));return Qa.$puts(""+ -Ha.$to_s().$rjust(va," ")+":"+za+Ra+" "+W+Ca)},V.$$s=this,V.$$arity=2,V));return u(wa["$empty?"]())?this.$puts("No todos found"):d},ua.$$arity=-1);a.def(I,"$add_note",Oa=function(pa,ea){var F;return this.$update_task(pa,"show",l(this,"lambda",[],(F=function(V){var ka;null==V&&(V=d);u(ka=V["$[]"]("note"))?ka:(ka=["note",[]],l(V,"[]=",a.to_a(ka)),ka[w(ka.length,1)]);return V["$[]"]("note").$push(ea)},F.$$s=this,F.$$arity=1,F)))},Oa.$$arity=2);a.def(I,"$delete_note",xa=function(pa){var ea;return this.$update_task(pa, -"show",l(this,"lambda",[],(ea=function(F){null==F&&(F=d);return F.$delete("note")},ea.$$s=this,ea.$$arity=1,ea)))},xa.$$arity=1);a.def(I,"$show",Ba=function(pa,ea){var F,V=d;null==ea&&(ea=d);ea=u(V=ea)?V:this.$load_tasks(pa);return l(ea["$[]"](pa),"each",[],(F=function(ka,va){var ia=null==F.$$s?this:F.$$s;null==ka&&(ka=d);null==va&&(va=d);va=u(va["$kind_of?"](x(L,"Array")))?y("\n",va.$join("\n")):va;return ia.$puts(""+ia.$colorize(y(ka.$to_s().$rjust(10," "),":"),"cyan")+" "+va)},F.$$s=this,F.$$arity= -2,F))},Ba.$$arity=-2);a.def(I,"$start_repl",La=function(){function pa(){V.question("\ntodo> ",function(ka){try{ka=ka.trim(),["exit","quit"].includes(ka)?V.close():(["clear","cls"].includes(ka)?process.stdout.write("\u001b[H\u001b[2J"):F(ka),pa())}catch(va){throw V.close(),va;}})}var ea,F=d;F=l(this,"lambda",[],(ea=function(ka){var va=null==ea.$$s?this:ea.$$s;null==ka&&(ka=d);return va.$execute(ka["$=="]("repl")?[]:ka.$split(/\s+/))},ea.$$s=this,ea.$$arity=1,ea));var V=require("readline").createInterface({input:process.stdin, -output:process.stdout});F("");pa()},La.$$arity=0);a.def(I,"$cleanup",na=function(pa){var ea,F=d,V=d;F=this.$load_tasks();pa=y([":done"],pa.$to_a());V=this.$filter_tasks(F,pa);l(V.$keys(),"each",[],(ea=function(ka){null==ka&&(ka=d);return F.$delete(ka)},ea.$$s=this,ea.$$arity=1,ea));this.$write_tasks(F);return this.$puts("Deleted "+V.$size()+" todo(s)")},na.$$arity=1);a.def(I,"$filter_tasks",S=function(pa,ea){var F,V=d;V=m([],{});l(pa,"each",[],(F=function(ka,va){var ia=null==F.$$s?this:F.$$s,wa,Ha= -d,Ea=d;null==ka&&(ka=d);null==va&&(va=d);Ha=!0;l(ea,"each",[],(wa=function(Qa){var Sa=null==wa.$$s?this:wa.$$s;null==Sa.queries&&(Sa.queries=d);null==Qa&&(Qa=d);return u(u(Sa.queries["$[]"](Qa))?Sa.queries["$[]"](Qa).$call(va):a.regexp([Qa],"i").$match(va["$[]"]("title")))?d:Ha=!1},wa.$$s=ia,wa.$$arity=1,wa));return u(Ha)?(Ea=[ka,va],l(V,"[]=",a.to_a(Ea)),Ea[w(Ea.length,1)]):d},F.$$s=this,F.$$arity=2,F));return V},S.$$arity=2);a.def(I,"$colorize",sa=function(pa,ea){return"\u001b["+x(L,"COLOR_CODES")["$[]"](ea)+ -"m"+pa+"\u001b[0m"},sa.$$arity=2);return(a.def(I,"$convert_due_date",ya=function(pa){var ea,F=this,V=d,ka=V=d,va=d,ia=d;V=d;V=function(){return u(ka=u(va=F.due_date_days.$index(pa.$to_s().$downcase()))?va:x(L,"DUE_DATE_DAYS_SIMPLE").$index(pa.$to_s().$downcase()))?ka:l(F.due_date_days,"map",[],(ea=function(wa){null==wa&&(wa=d);return wa["$[]"](c(0,2,!1))},ea.$$s=F,ea.$$arity=1,ea)).$index(pa.$to_s().$downcase())}();return V=u(V)?y(F.today,V).$strftime(x(L,"DATE_FORMAT")):u(u(ia=pa["$nil?"]())?ia: -pa["$empty?"]())?d:x(L,"Date").$parse(pa).$strftime(x(L,"DATE_FORMAT"))},ya.$$arity=1),d)&&"convert_due_date"})(p[0],null,p);return x(p,"Todo").$new().$execute(process.argv.slice(2))})(Opal);var Qb=Opal.$$;Opal.add_stubs(["$exit"]);Qb([],"Kernel").$exit();}).call(this); +"CONTEXT_TAG_PATTERN",/(^| )[@+][\w-]+/);a.const_set(L[0],"PRIORITY_FLAG","*");a.const_set(L[0],"TODO_FILE",require("path").join(require("os").homedir(),"/todo.jsonl"));a.def(I,"$execute",D=function(pa){var ha=d,F=d,V=d,ka=d,va=d,ja=d,xa=d,Ha=d,Ea=d,Qa=d,Ra=d,Ia=d;try{this.$setup(),ha=pa.$first(),F=u(V=pa["$[]"](c(1,-1,!1)))?V:[],ka=ha,"add"["$==="](ka)?(u(u(va=F["$nil?"]())?va:F["$empty?"]())&&this.$raise(y(ha," command requires at least one parameter")),this.$add(F.$join(" "))):"start"["$==="](ka)? +u(J(F.$length(),0))?this.$change_state(F.$first().$to_i(),"started",(u(ja=F["$[]"](c(1,-1,!1)))?ja:[]).$join(" ")):this.$list(d,[":started"]):"done"["$==="](ka)?u(J(F.$length(),0))?this.$change_state(F.$first().$to_i(),"done",(u(xa=F["$[]"](c(1,-1,!1)))?xa:[]).$join(" ")):this.$list(d,[":done"]):"block"["$==="](ka)?u(J(F.$length(),0))?this.$change_state(F.$first().$to_i(),"blocked",(u(Ha=F["$[]"](c(1,-1,!1)))?Ha:[]).$join(" ")):this.$list(d,[":blocked"]):"reset"["$==="](ka)?u(J(F.$length(),0))?this.$change_state(F.$first().$to_i(), +"new",(u(Ea=F["$[]"](c(1,-1,!1)))?Ea:[]).$join(" ")):this.$list(d,[":new"]):"prio"["$==="](ka)?(u(t(F.$length(),1))&&this.$raise(y(ha," command requires at least one parameter")),this.$set_priority(F.$first().$to_i(),(u(Qa=F["$[]"](c(1,-1,!1)))?Qa:[]).$join(" "))):"due"["$==="](ka)?(u(t(F.$length(),1))&&this.$raise(y(ha," command requires at least one parameter")),this.$due_date(F.$first().$to_i(),(u(Ra=F["$[]"](c(1,-1,!1)))?Ra:[]).$join(" "))):"append"["$==="](ka)?(u(t(F.$length(),2))&&this.$raise(y(ha, +" command requires at least two parameters")),this.$append(F.$first().$to_i(),F["$[]"](c(1,-1,!1)).$join(" "))):"rename"["$==="](ka)?(u(t(F.$length(),2))&&this.$raise(y(ha," command requires at least two parameters")),this.$rename(F.$first().$to_i(),F["$[]"](c(1,-1,!1)).$join(" "))):"del"["$==="](ka)?(u(F.$length()["$!="](1))&&this.$raise(y(ha," command requires exactly one parameter")),this.$delete(F.$first().$to_i())):"note"["$==="](ka)?(u(t(F.$length(),2))&&this.$raise(y(ha," command requires at least two parameters")), +this.$add_note(F.$first().$to_i(),F["$[]"](c(1,-1,!1)).$join(" "))):"delnote"["$==="](ka)?(u(F.$length()["$!="](1))&&this.$raise(y(ha," command requires exactly one parameter")),this.$delete_note(F.$first().$to_i())):"list"["$==="](ka)?this.$list(d,F):"show"["$==="](ka)?(u(F.$length()["$!="](1))&&this.$raise(y(ha," command requires exactly one parameter")),this.$show(F.$first().$to_i())):"help"["$==="](ka)?(u(J(F.$length(),0))&&this.$raise(y(ha," command has no parameters")),this.$puts(this.$usage())): +"repl"["$==="](ka)?(u(J(F.$length(),0))&&this.$raise(y(ha," command has no parameters")),this.$start_repl()):"cleanup"["$==="](ka)?(u(u(Ia=F["$nil?"]())?Ia:F["$empty?"]())&&this.$raise(y(ha," command requires at least one parameter")),this.$cleanup(F)):this.$list(d,pa)}catch(kb){if(a.rescue(kb,[H(x(L,"JS"),"Error"),x(L,"RuntimeError")])){pa=kb;try{this.$puts(""+this.$colorize("ERROR:","red")+" "+pa)}finally{a.pop_exception()}}else throw kb;}return this},D.$$arity=1);I.$private();a.def(I,"$usage", +R=function(){var pa,ha;return"Usage: todo \n\nCommands:\n* add add new task\n* start [text] mark task as started, with optional note\n* done [text] mark task as completed, with optional note\n* block [text] mark task as blocked, with optional note\n* reset [text] reset task to new state, with optional note\n* prio [text] toggle high priority flag, with optional note\n* due [date] set/unset due date (in YYYY-MM-DD format)\n\n* append append text to task title\n* rename rename task\n* del delete task\n* note add note to task\n* delnote delete all notes from task\n\n* list [regex...] list tasks (only active tasks by default)\n* show show all task details\n* repl enter read-eval-print loop mode\n* cleanup [regex...] cleanup completed tasks by regex\n* help this help screen\n\nWith list command the following pre-defined regex patterns can be also used:\n"+ +this.queries.$keys().$join(", ")+'\n\nDue dates can be also added via tags in task title: "due:YYYY-MM-DD"\n\nLegend:\n'+l(l(x(L,"STATES"),"select",[],(pa=function(F){null==F&&(F=d);return F["$!="]("default")},pa.$$s=this,pa.$$arity=2,pa)),"map",[],(ha=function(F,V){null==F&&(F=d);null==V&&(V=d);return""+F+" "+V},ha.$$s=this,ha.$$arity=2,ha)).$join(", ")+", priority "+x(L,"PRIORITY_FLAG")+"\n\nTodo file: "+x(L,"TODO_FILE")+"\n"},R.$$arity=0);a.def(I,"$setup",ia=function(){var pa,ha,F,V,ka,va,ja,xa, +Ha,Ea,Qa,Ra,Ia=d,kb=d;this.today=x(L,"Date").$parse(x(L,"Date").$today().$strftime(x(L,"DATE_FORMAT")));Ia=l(c(0,6,!1),"map",[],(pa=function(Sa){var W=null==pa.$$s?this:pa.$$s;null==W.today&&(W.today=d);null==Sa&&(Sa=d);return y(W.today,Sa)},pa.$$s=this,pa.$$arity=1,pa));this.due_date_days=l(Ia,"map",[],(ha=function(Sa){null==Sa&&(Sa=d);return Sa.$strftime("%A").$downcase()},ha.$$s=this,ha.$$arity=1,ha));kb=l(Ia,"map",[],(F=function(Sa){null==Sa&&(Sa=d);return Sa.$strftime(x(L,"DATE_FORMAT"))},F.$$s= +this,F.$$arity=1,F));return this.queries=m(":active :done :blocked :started :new :all :today :tomorrow :next7days".split(" "),{":active":l(this,"lambda",[],(V=function(Sa){null==Sa&&(Sa=d);return/(new|started|blocked)/.$match(Sa["$[]"]("state"))},V.$$s=this,V.$$arity=1,V)),":done":l(this,"lambda",[],(ka=function(Sa){null==Sa&&(Sa=d);return"done"["$=="](Sa["$[]"]("state"))},ka.$$s=this,ka.$$arity=1,ka)),":blocked":l(this,"lambda",[],(va=function(Sa){null==Sa&&(Sa=d);return"blocked"["$=="](Sa["$[]"]("state"))}, +va.$$s=this,va.$$arity=1,va)),":started":l(this,"lambda",[],(ja=function(Sa){null==Sa&&(Sa=d);return"started"["$=="](Sa["$[]"]("state"))},ja.$$s=this,ja.$$arity=1,ja)),":new":l(this,"lambda",[],(xa=function(Sa){null==Sa&&(Sa=d);return"new"["$=="](Sa["$[]"]("state"))},xa.$$s=this,xa.$$arity=1,xa)),":all":l(this,"lambda",[],(Ha=function(Sa){null==Sa&&(Sa=d);return/\w+/.$match(Sa["$[]"]("state"))},Ha.$$s=this,Ha.$$arity=1,Ha)),":today":l(this,"lambda",[],(Ea=function(Sa){null==Sa&&(Sa=d);return kb["$[]"](0)["$=="](Sa["$[]"]("due"))}, +Ea.$$s=this,Ea.$$arity=1,Ea)),":tomorrow":l(this,"lambda",[],(Qa=function(Sa){null==Sa&&(Sa=d);return kb["$[]"](1)["$=="](Sa["$[]"]("due"))},Qa.$$s=this,Qa.$$arity=1,Qa)),":next7days":l(this,"lambda",[],(Ra=function(Sa){null==Sa&&(Sa=d);return a.regexp(["(",kb.$join("|"),")"]).$match(Sa["$[]"]("due"))},Ra.$$s=this,Ra.$$arity=1,Ra))})},ia.$$arity=0);a.def(I,"$load_tasks",da=function(pa){var ha,F=d,V=d,ka=d,va=d;null==pa&&(pa=d);F=0;V=m([],{});ka=require("fs").existsSync(x(L,"TODO_FILE"))?require("fs").readFileSync(x(L, +"TODO_FILE"),"utf8"):"";u(ka["$empty?"]()["$!"]())&&l(ka.$split("\n"),"each",[],(ha=function(ja){null==ja&&(ja=d);if(ja.$strip()["$=="](""))return d;F=y(F,1);ja=[F,x(L,"JSON").$parse(ja.$chomp(),m(["symbolize_names"],{symbolize_names:!0}))];l(V,"[]=",a.to_a(ja));return ja[w(ja.length,1)]},ha.$$s=this,ha.$$arity=1,ha));u(u(va=pa)?V["$has_key?"](pa)["$!"]():va)&&this.$raise(""+pa+": No such todo");return V},da.$$arity=-1);a.def(I,"$write_tasks",ma=function(pa){var ha,F=d;F=y(l(pa.$keys().$sort(),"map", +[],(ha=function(V){null==V&&(V=d);return x(L,"JSON").$generate(pa["$[]"](V))},ha.$$s=this,ha.$$arity=1,ha)).$join("\n"),"\n");return require("fs").writeFileSync(x(L,"TODO_FILE"),F,"utf8")},ma.$$arity=1);a.def(I,"$postprocess_tags",b=function(pa){var ha=pa["$[]"]("title").$match(x(L,"DUE_DATE_TAG_PATTERN"));if(u(ha)){var F=["title",pa["$[]"]("title").$gsub(x(L,"DUE_DATE_TAG_PATTERN"),"")];l(pa,"[]=",a.to_a(F));F[w(F.length,1)];F=["due",this.$convert_due_date(ha["$[]"](2))];l(pa,"[]=",a.to_a(F));F[w(F.length, +1)]}return u(pa["$[]"]("title")["$empty?"]())?this.$raise("title must not be empty"):d},b.$$arity=1);a.def(I,"$add",h=function(pa){pa=m(["state","title","modified"],{state:"new",title:pa,modified:this.today.$strftime(x(L,"DATE_FORMAT"))});this.$postprocess_tags(pa);require("fs").appendFileSync(x(L,"TODO_FILE"),y(x(L,"JSON").$generate(pa),"\n"),"utf8");return this.$list()},h.$$arity=1);a.def(I,"$update_task",f=function(pa,ha,F){var V=this.$load_tasks(pa);F.$call(V["$[]"](pa));F=["modified",this.today.$strftime(x(L, +"DATE_FORMAT"))];l(V["$[]"](pa),"[]=",a.to_a(F));F[w(F.length,1)];this.$write_tasks(V);return"show"["$==="](ha)?this.$show(pa,V):"list"["$==="](ha)?this.$list(V):d},f.$$arity=3);a.def(I,"$append",q=function(pa,ha){var F;null==ha&&(ha="");return this.$update_task(pa,"list",l(this,"lambda",[],(F=function(V){var ka=null==F.$$s?this:F.$$s;null==V&&(V=d);var va=["title",[V["$[]"]("title"),ha].$join(" ")];l(V,"[]=",a.to_a(va));va[w(va.length,1)];return ka.$postprocess_tags(V)},F.$$s=this,F.$$arity=1,F)))}, +q.$$arity=-2);a.def(I,"$rename",A=function(pa,ha){var F;return this.$update_task(pa,"list",l(this,"lambda",[],(F=function(V){var ka=null==F.$$s?this:F.$$s;null==V&&(V=d);var va=["title",ha];l(V,"[]=",a.to_a(va));va[w(va.length,1)];return ka.$postprocess_tags(V)},F.$$s=this,F.$$arity=1,F)))},A.$$arity=2);a.def(I,"$delete",E=function(pa){var ha=this.$load_tasks(pa);ha.$delete(pa);this.$write_tasks(ha);return this.$list()},E.$$arity=1);a.def(I,"$change_state",G=function(pa,ha,F){var V;null==F&&(F=d); +return this.$update_task(pa,"list",l(this,"lambda",[],(V=function(ka){var va=d;null==ka&&(ka=d);var ja=["state",ha];l(ka,"[]=",a.to_a(ja));ja[w(ja.length,1)];return u(u(va=F["$nil?"]()["$!"]())?F["$empty?"]()["$!"]():va)?(u(ja=ka["$[]"]("note"))?ja:(ja=["note",[]],l(ka,"[]=",a.to_a(ja)),ja[w(ja.length,1)]),ka["$[]"]("note").$push(F)):d},V.$$s=this,V.$$arity=1,V)))},G.$$arity=-3);a.def(I,"$set_priority",M=function(pa,ha){var F;null==ha&&(ha=d);return this.$update_task(pa,"list",l(this,"lambda",[], +(F=function(V){var ka=d;null==V&&(V=d);var va=["priority",V["$[]"]("priority")["$!"]()];l(V,"[]=",a.to_a(va));va[w(va.length,1)];u(V["$[]"]("priority")["$!"]())&&V.$delete("priority");return u(u(ka=ha["$nil?"]()["$!"]())?ha["$empty?"]()["$!"]():ka)?(u(va=V["$[]"]("note"))?va:(va=["note",[]],l(V,"[]=",a.to_a(va)),va[w(va.length,1)]),V["$[]"]("note").$push(ha)):d},F.$$s=this,F.$$arity=1,F)))},M.$$arity=-2);a.def(I,"$due_date",ba=function(pa,ha){var F;null==ha&&(ha="");return this.$update_task(pa,"list", +l(this,"lambda",[],(F=function(V){var ka=null==F.$$s?this:F.$$s;null==V&&(V=d);ka=["due",ka.$convert_due_date(ha)];l(V,"[]=",a.to_a(ka));ka[w(ka.length,1)];return u(V["$[]"]("due")["$nil?"]())?V.$delete("due"):d},F.$$s=this,F.$$arity=1,F)))},ba.$$arity=-2);a.def(I,"$list",ua=function(pa,ha){var F,V,ka=d,va=d,ja=d,xa=d;null==pa&&(pa=d);null==ha&&(ha=d);pa=u(ka=pa)?ka:this.$load_tasks();va=[pa.$keys().$max().$to_s().$size(),4].$max();ha=u(u(ja=ha["$nil?"]())?ja:ha["$empty?"]())?[":active"]:ha;xa=l(this.$filter_tasks(pa, +ha),"sort_by",[],(F=function(Ha,Ea){var Qa=d,Ra=d,Ia=d;null==Ha&&(Ha=d);null==Ea&&(Ea=d);return[u(u(Qa=Ea["$[]"]("priority"))?Ea["$[]"]("state")["$!="]("done"):Qa)?0:1,x(L,"ORDER")["$[]"](u(Ra=Ea["$[]"]("state"))?Ra:"default"),u(Ia=Ea["$[]"]("due"))?Ia:"n/a",Ha]},F.$$s=this,F.$$arity=2,F));l(xa,"each",[],(V=function(Ha,Ea){var Qa=null==V.$$s?this:V.$$s,Ra,Ia=d,kb=d,Sa=d,W=d,za=d,Da=d,Va=d,ib=d,db=Ia=d,bb=d;null==Qa.today&&(Qa.today=d);null==Qa.due_date_days&&(Qa.due_date_days=d);null==Ha&&(Ha=d); +null==Ea&&(Ea=d);Ia=u(kb=Ea["$[]"]("state"))?kb:"default";Sa=Qa.$colorize(x(L,"STATES")["$[]"](Ia),x(L,"COLORS")["$[]"](Ia));W=l(Ea["$[]"]("title"),"gsub",[x(L,"CONTEXT_TAG_PATTERN")],(Ra=function(Xa){var Aa=null==Ra.$$s?this:Ra.$$s;null==Xa&&(Xa=d);return y(u(Xa["$start_with?"](" "))?" ":"",Aa.$colorize(Xa.$strip(),"cyan"))},Ra.$$s=Qa,Ra.$$arity=1,Ra));za=u(u(Da=Ea["$[]"]("priority"))?Ia["$!="]("done"):Da)?Qa.$colorize(x(L,"PRIORITY_FLAG"),"red"):" ";Va="";u(u(ib=Ea["$[]"]("due"))?Ia["$!="]("done"): +ib)&&(Ia=w(x(L,"Date").$parse(Ea["$[]"]("due")),Qa.today).$to_i(),u(t(Ia,0))?Va=Qa.$colorize("("+Ia.$abs()+"d overdue)","red"):u(u(db=Ia["$=="](0))?db:Ia["$=="](1))?Va=Qa.$colorize("("+x(L,"DUE_DATE_DAYS_SIMPLE")["$[]"](Ia)+")","yellow"):u(J(Ia,1))&&(Va=Qa.$colorize("("+(u(bb=Qa.due_date_days["$[]"](Ia))?bb:Ea["$[]"]("due"))+")","magenta")),Va=y(" ",Va));return Qa.$puts(""+Ha.$to_s().$rjust(va," ")+":"+za+Sa+" "+W+Va)},V.$$s=this,V.$$arity=2,V));return u(xa["$empty?"]())?this.$puts("No todos found"): +d},ua.$$arity=-1);a.def(I,"$add_note",Oa=function(pa,ha){var F;return this.$update_task(pa,"show",l(this,"lambda",[],(F=function(V){var ka;null==V&&(V=d);u(ka=V["$[]"]("note"))?ka:(ka=["note",[]],l(V,"[]=",a.to_a(ka)),ka[w(ka.length,1)]);return V["$[]"]("note").$push(ha)},F.$$s=this,F.$$arity=1,F)))},Oa.$$arity=2);a.def(I,"$delete_note",wa=function(pa){var ha;return this.$update_task(pa,"show",l(this,"lambda",[],(ha=function(F){null==F&&(F=d);return F.$delete("note")},ha.$$s=this,ha.$$arity=1,ha)))}, +wa.$$arity=1);a.def(I,"$show",Ba=function(pa,ha){var F,V=d;null==ha&&(ha=d);ha=u(V=ha)?V:this.$load_tasks(pa);return l(ha["$[]"](pa),"each",[],(F=function(ka,va){var ja=null==F.$$s?this:F.$$s;null==ka&&(ka=d);null==va&&(va=d);va=u(va["$kind_of?"](x(L,"Array")))?y("\n",va.$join("\n")):va;return ja.$puts(""+ja.$colorize(y(ka.$to_s().$rjust(10," "),":"),"cyan")+" "+va)},F.$$s=this,F.$$arity=2,F))},Ba.$$arity=-2);a.def(I,"$start_repl",La=function(){function pa(){V.question("\ntodo> ",function(ka){try{ka= +ka.trim(),["exit","quit"].includes(ka)?V.close():(["clear","cls"].includes(ka)?process.stdout.write("\u001b[H\u001b[2J"):F(ka),pa())}catch(va){throw V.close(),va;}})}var ha,F=d;F=l(this,"lambda",[],(ha=function(ka){var va=null==ha.$$s?this:ha.$$s;null==ka&&(ka=d);return va.$execute(ka["$=="]("repl")?[]:ka.$split(/\s+/))},ha.$$s=this,ha.$$arity=1,ha));var V=require("readline").createInterface({input:process.stdin,output:process.stdout});F("");pa()},La.$$arity=0);a.def(I,"$cleanup",na=function(pa){var ha, +F=d,V=d;F=this.$load_tasks();pa=y([":done"],pa.$to_a());V=this.$filter_tasks(F,pa);l(V.$keys(),"each",[],(ha=function(ka){null==ka&&(ka=d);return F.$delete(ka)},ha.$$s=this,ha.$$arity=1,ha));this.$write_tasks(F);return this.$puts("Deleted "+V.$size()+" todo(s)")},na.$$arity=1);a.def(I,"$filter_tasks",S=function(pa,ha){var F,V=d;V=m([],{});l(pa,"each",[],(F=function(ka,va){var ja=null==F.$$s?this:F.$$s,xa,Ha=d,Ea=d;null==ka&&(ka=d);null==va&&(va=d);Ha=!0;l(ha,"each",[],(xa=function(Qa){var Ra=null== +xa.$$s?this:xa.$$s;null==Ra.queries&&(Ra.queries=d);null==Qa&&(Qa=d);return u(u(Ra.queries["$[]"](Qa))?Ra.queries["$[]"](Qa).$call(va):a.regexp([Qa],"i").$match(va["$[]"]("title")))?d:Ha=!1},xa.$$s=ja,xa.$$arity=1,xa));return u(Ha)?(Ea=[ka,va],l(V,"[]=",a.to_a(Ea)),Ea[w(Ea.length,1)]):d},F.$$s=this,F.$$arity=2,F));return V},S.$$arity=2);a.def(I,"$colorize",sa=function(pa,ha){var F=d;return"\u001b["+(u(F=x(L,"COLOR_CODES")["$[]"](ha))?F:37)+"m"+pa+"\u001b[0m"},sa.$$arity=2);return(a.def(I,"$convert_due_date", +ya=function(pa){var ha,F=this,V=d,ka=V=d,va=d,ja=d;V=d;V=function(){return u(ka=u(va=F.due_date_days.$index(pa.$to_s().$downcase()))?va:x(L,"DUE_DATE_DAYS_SIMPLE").$index(pa.$to_s().$downcase()))?ka:l(F.due_date_days,"map",[],(ha=function(xa){null==xa&&(xa=d);return xa["$[]"](c(0,2,!1))},ha.$$s=F,ha.$$arity=1,ha)).$index(pa.$to_s().$downcase())}();return V=u(V)?y(F.today,V).$strftime(x(L,"DATE_FORMAT")):u(u(ja=pa["$nil?"]())?ja:pa["$empty?"]())?d:x(L,"Date").$parse(pa).$strftime(x(L,"DATE_FORMAT"))}, +ya.$$arity=1),d)&&"convert_due_date"})(p[0],null,p);return x(p,"Todo").$new().$execute(process.argv.slice(2))})(Opal);var Qb=Opal.$$;Opal.add_stubs(["$exit"]);Qb([],"Kernel").$exit();}).call(this); diff --git a/node/todo.js.rb b/node/todo.js.rb index 0fd5dac..4b86515 100644 --- a/node/todo.js.rb +++ b/node/todo.js.rb @@ -193,14 +193,7 @@ def setup def load_tasks(item_to_check = nil) count = 0 tasks = {} - todo_jsonl = `function() { - var fs = require('fs'); - if (fs.existsSync(#{TODO_FILE})) { - return fs.readFileSync(#{TODO_FILE}, 'utf8'); - } else { - return ''; - } - }.call()` + todo_jsonl = `require('fs').existsSync(#{TODO_FILE}) ? require('fs').readFileSync(#{TODO_FILE}, 'utf8') : ''` if !todo_jsonl.empty? todo_jsonl.split("\n").each do |line| next if line.strip == '' @@ -233,17 +226,7 @@ def add(text) modified: @today.strftime(DATE_FORMAT) } postprocess_tags(task) - ` - var fs = require('fs'); - var todo_jsonl; - if (fs.existsSync(#{TODO_FILE})) { - todo_jsonl = fs.readFileSync(#{TODO_FILE}, 'utf8'); - } else { - todo_jsonl = ''; - } - todo_jsonl += #{JSON.generate(task)} + "\n"; - fs.writeFileSync(#{TODO_FILE}, todo_jsonl, 'utf8'); - ` + `require('fs').appendFileSync(#{TODO_FILE}, #{JSON.generate(task) + "\n"}, 'utf8')` list end @@ -311,18 +294,16 @@ def list(tasks = nil, patterns = nil) tasks = tasks || load_tasks task_indent = [tasks.keys.max.to_s.size, 4].max patterns = patterns.nil? || patterns.empty? ? [':active'] : patterns - items = filter_tasks(tasks, patterns) - items = items.sort_by do |num, task| + items = filter_tasks(tasks, patterns).sort_by do |num, task| [task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num] end items.each do |num, task| state = task[:state] || 'default' - color = COLORS[state] - display_state = colorize(STATES[state], color) + display_state = colorize(STATES[state], COLORS[state]) title = task[:title].gsub(CONTEXT_TAG_PATTERN) do |tag| (tag.start_with?(' ') ? ' ' : '') + colorize(tag.strip, :cyan) end - priority_flag = task[:priority] ? colorize(PRIORITY_FLAG, :red) : ' ' + priority_flag = task[:priority] && state != 'done' ? colorize(PRIORITY_FLAG, :red) : ' ' due_date = '' if task[:due] && state != 'done' date_diff = (Date.parse(task[:due]) - @today).to_i @@ -417,7 +398,7 @@ def filter_tasks(tasks, patterns) end def colorize(text, color) - `'\u001b[' + #{COLOR_CODES[color]} + 'm' + #{text} + '\u001b[0m'` + `'\u001b[' + #{COLOR_CODES[color] || 37} + 'm' + #{text} + '\u001b[0m'` end def convert_due_date(date) diff --git a/todo.gemspec b/todo.gemspec index 5132fba..eff3c6f 100644 --- a/todo.gemspec +++ b/todo.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'todo-jsonl' - s.version = '0.1.30' - s.date = '2021-03-11' + s.version = '0.1.31' + s.date = '2021-03-16' s.summary = 'todo list manager inspired by todo.txt using the jsonl format' s.authors = ['Gabor Bata'] s.homepage = 'https://github.com/gaborbata/todo' diff --git a/web/app.js b/web/app.js index 72869ff..51065b3 100644 --- a/web/app.js +++ b/web/app.js @@ -1,23 +1,23 @@ -(function(){var Va=Va||{};Va.scope={};Va.createTemplateTagFirstArg=function(a){return a.raw=a};Va.createTemplateTagFirstArgWithRaw=function(a,w){a.raw=w;return a};Va.arrayIteratorImpl=function(a){var w=0;return function(){return wF&&(F=Math.max(F+t,0));Ft||56319w||57343F&&(F=Math.max(F+t,0));Ft||56319w||57343>>0;if(0===p)return!1;w|=0;for(w=Math.max(0<=w?w:p-Math.abs(w),0);wVanilla terminal.':y.welcome,G=void 0===y.prompt?"":y.prompt,z=void 0===y.separator?">":y.separator;this.commands=Object.assign({},void 0===y.commands?{}:y.commands,F);this.defaultCallback=q;this.history=[];this.historyCursor=this.history.length;this.welcome=d;this.shell={prompt:G,separator:z}; this.state={prompt:void 0,idle:void 0};this.cacheDOM=function(f){f.classList.add("VanillaTerm");var h=t.shell;f.insertAdjacentHTML.call(f,"beforeEnd",'\n
\n \n
\n
'+h.prompt+h.separator+'
\n \n \n
\n ');f=f.querySelector(".container");t.DOM={container:f,output:f.querySelector("output"),command:f.querySelector(".command"), input:f.querySelector(".command .input"),prompt:f.querySelector(".command .prompt")}};this.addListeners=function(){var f=t.DOM;f.output.addEventListener("DOMSubtreeModified",function(){setTimeout(function(){return f.input.scrollIntoView()},10)},!1);w("click",function(){return f.input.focus()},!1);f.output.addEventListener("click",function(h){return h.stopPropagation()},!1);f.input.addEventListener("keyup",t.onKeyUp,!1);f.input.addEventListener("keydown",t.onKeyDown,!1);f.command.addEventListener("click", function(){return f.input.focus()},!1);w("keyup",function(h){f.input.focus();h.stopPropagation();h.preventDefault()},!1)};this.onKeyUp=function(f){var h=f.keyCode,v=t.DOM,c=void 0===t.history?[]:t.history,l=t.historyCursor;27===h?(v.input.value="",f.stopPropagation(),f.preventDefault()):[38,40].includes(h)&&(38===h&&0"+h+": command not found.")}}};this.resetCommand=function(){var f=t.DOM;f.input.value="";f.command.classList.remove("input");f.command.classList.remove("hidden");f.input.scrollIntoView&&f.input.scrollIntoView()};if(y=document.getElementById(p))this.cacheDOM(y),this.addListeners(),d&&this.output(d); else throw Error("Container #"+p+" doesn't exists.");}var w=window.addEventListener,F={clear:function(p){return p.clear()},commands:function(p){p.output("These shell commands are defined internally:");p.output(Object.keys(p.commands).join(", "))}};a.prototype.clear=function(){this.DOM.output.innerHTML="";this.resetCommand()};a.prototype.idle=function(){var p=this.DOM;p.command.classList.add("idle");p.prompt.innerHTML='
'};a.prototype.prompt=function(p,t){this.state.prompt= !0;this.onAskCallback=void 0===t?function(){}:t;this.DOM.prompt.innerHTML=p+":";this.resetCommand();this.DOM.command.classList.add("input")};a.prototype.onInput=function(p){this.onInputCallback=p};a.prototype.output=function(p){this.DOM.output.insertAdjacentHTML("beforeEnd",""+(void 0===p?" ":p)+"");this.resetCommand()};a.prototype.setPrompt=function(p){p=void 0===p?this.shell.prompt:p;var t=this.DOM,y=this.shell.separator;this.shell={prompt:p,separator:y};t.command.classList.remove("idle"); @@ -77,7 +77,7 @@ this.$raise(t(da,ma,b,g));return g},v.$$arity=-4);a.defs(G,"$coerce_to?",c=funct "String"),"to_str");d(/^@[a-zA-Z_][a-zA-Z0-9_]*?$/.test(da))||this.$raise(p(f,"NameError").$new("'"+da+"' is not allowed as an instance variable name",da));return da},J.$$arity=1);a.defs(G,"$class_variable_name!",D=function(da){da=p(f,"Opal")["$coerce_to!"](da,p(f,"String"),"to_str");d(3>da.length||"@@"!==da.slice(0,2))&&this.$raise(p(f,"NameError").$new("`"+da+"' is not allowed as a class variable name",da));return da},D.$$arity=1);a.defs(G,"$const_name!",T=function(da){da=p(f,"Opal")["$coerce_to!"](da, p(f,"String"),"to_str");d(da["$[]"](0)["$!="](da["$[]"](0).$upcase()))&&this.$raise(p(f,"NameError"),"wrong constant name "+da);return da},T.$$arity=1);a.defs(G,"$pristine",ia=function(da,ma){var b=a.slice.call(arguments,1,arguments.length);for(var m,g=b.length-1;0<=g;g--)m=b[g],(m=da.$$prototype["$"+m])&&!m.$$stub&&(m.$$pristine=!0);return F},ia.$$arity=-2)}(w[0],w)}; Opal.modules["corelib/module"]=function(a){function w(l,H){return"number"===typeof l&&"number"===typeof H?l $nil? $attr_reader $attr_writer $warn $attr_accessor $class_variable_name! $new $const_name! $=~ $inject $split $const_get $== $!~ $start_with? $bind $call $class $append_features $included $name $cover? $size $merge $compile $proc $any? $prepend_features $prepended $to_s $__id__ $constants $include? $copy_class_variables $copy_constants".split(" ")); -return function(l,$super,e){l=G(l,$super,"Module");var n=[l].concat(e),J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Da,Ga,Ra,Pa,Ha,eb,kb,R,ya,Ca,Ua,ib,cb,ab,Xa,za,ta,Ma,Sa,Za,Ea,Y,S,Z,V,fa,la;a.defs(l,"$allocate",J=function(){var k=a.allocate_module(p,function(){});this!==a.Module&&Object.setPrototypeOf(k,this.$$prototype);return k},J.$$arity=0);a.def(l,"$initialize",D=function(){var k=D.$$p,C=k||p;k&&(D.$$p=null);k&&(D.$$p=null);return C!==p?z(this,"module_eval", +return function(l,$super,e){l=G(l,$super,"Module");var n=[l].concat(e),J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Fa,Ga,Ra,Pa,Ha,fb,kb,S,ya,Ca,Va,cb,db,ab,Ya,za,ta,Ma,Sa,Za,Da,Y,R,Z,V,fa,la;a.defs(l,"$allocate",J=function(){var k=a.allocate_module(p,function(){});this!==a.Module&&Object.setPrototypeOf(k,this.$$prototype);return k},J.$$arity=0);a.def(l,"$initialize",D=function(){var k=D.$$p,C=k||p;k&&(D.$$p=null);k&&(D.$$p=null);return C!==p?z(this,"module_eval", [],C.$to_proc()):p},D.$$arity=0);a.def(l,"$===",T=function(k){return q(null==k)?!1:a.is_a(k,this)},T.$$arity=1);a.def(l,"$<",ia=function(k){q(y(n,"Module")["$==="](k))||this.$raise(y(n,"TypeError"),"compared with non class/module");var C;if(this===k)return!1;var O=0;var aa=a.ancestors(this);for(C=aa.length;O",ma=function(k){q(y(n,"Module")["$==="](k))||this.$raise(y(n,"TypeError"),"compared with non class/module");return w(k,this)},ma.$$arity=1);a.def(l,"$>=",b=function(k){var C;return q(C=this["$equal?"](k))?C:"number"===typeof this&&"number"===typeof k?this>k:this["$>"](k)},b.$$arity=1);a.def(l,"$<=>",m=function(k){if(this===k)return 0;if(!q(y(n,"Module")["$==="](k)))return p;k=w(this,k);return q(k["$nil?"]())?p:q(k)?-1:1},m.$$arity=1);a.def(l,"$alias_method",g= function(k,C){k=d(k,y(n,"String"),"to_str");C=d(C,y(n,"String"),"to_str");a.alias(this,k,C);return this},g.$$arity=2);a.def(l,"$alias_native",r=function(k,C){null==C&&(C=k);a.alias_native(this,k,C);return this},r.$$arity=-2);a.def(l,"$ancestors",A=function(){return a.ancestors(this)},A.$$arity=0);a.def(l,"$append_features",E=function(k){a.append_features(this,k);return this},E.$$arity=1);a.def(l,"$attr_accessor",I=function(k){var C=a.slice.call(arguments,0,arguments.length);z(this,"attr_reader",a.to_a(C)); @@ -90,16 +90,16 @@ ka=function(k,C){null==C&&(C=!0);k=y(n,"Opal")["$const_name!"](k);q(k["$=~"](t(y "::"!==k&&(k=k.slice(2));if(q(-1!=k.indexOf("::")&&"::"!=k))return z(k.$split("::"),"inject",[this],(O=function(aa,x){null==aa&&(aa=p);null==x&&(x=p);return aa.$const_get(x)},O.$$s=this,O.$$arity=2,O));q(k["$=~"](t(y(n,"Opal"),"CONST_NAME_REGEXP")))||this.$raise(y(n,"NameError").$new("wrong constant name "+k,k));return C?y([this],k):a.const_get_local(this,k)},N.$$arity=-2);a.def(l,"$const_missing",M=function(k){var C;if(this.$$autoload&&(C=this.$$autoload[k]))return this.$require(C),this.$const_get(k); C=this["$=="](y(n,"Object"))?k:""+this+"::"+k;return this.$raise(y(n,"NameError").$new("uninitialized constant "+C,k))},M.$$arity=1);a.def(l,"$const_set",ja=function(k,C){var O=p;k=y(n,"Opal")["$const_name!"](k);q(q(O=k["$!~"](t(y(n,"Opal"),"CONST_NAME_REGEXP")))?O:k["$start_with?"]("::"))&&this.$raise(y(n,"NameError").$new("wrong constant name "+k,k));a.const_set(this,k,C);return C},ja.$$arity=2);a.def(l,"$public_constant",sa=function(){return p},sa.$$arity=1);a.def(l,"$define_method",ea=function(k, C){var O=ea.$$p,aa=O||p,x,W=this,oa=p,Ka=p;O&&(ea.$$p=null);O&&(ea.$$p=null);q(void 0===C&&aa===p)&&W.$raise(y(n,"ArgumentError"),"tried to create a Proc object without a block");aa=function(){return q(oa=aa)?oa:function(){Ka=C;return y(n,"Proc")["$==="](Ka)?C:y(n,"Method")["$==="](Ka)?C.$to_proc().$$unbound:y(n,"UnboundMethod")["$==="](Ka)?h((x=function(jb){var ob=null==x.$$s?this:x.$$s;var mb=a.slice.call(arguments,0,arguments.length);ob=C.$bind(ob);return z(ob,"call",a.to_a(mb))},x.$$s=W,x.$$arity= --1,x)):W.$raise(y(n,"TypeError"),"wrong argument type "+aa.$class()+" (expected Proc/Method)")}()}();aa.$$jsid=k;aa.$$s=null;aa.$$def=aa;aa.$$define_meth=!0;a.defn(W,"$"+k,aa);return k},ea.$$arity=-2);a.def(l,"$remove_method",ua=function(k){var C=a.slice.call(arguments,0,arguments.length);for(var O=0,aa=C.length;O"},Y.$$arity=0);a.def(l,"$undef_method",S=function(k){var C=a.slice.call(arguments,0,arguments.length);for(var O=0,aa=C.length;O"},Y.$$arity=0);a.def(l,"$undef_method",R=function(k){var C=a.slice.call(arguments,0,arguments.length);for(var O=0,aa=C.length;O",T=function(x){this.$$comparable=!0;return(x=this["$=="](x))&&x!==p?0:p},T.$$arity=1);a.def(c,"$method",ia=function(x){var W=this["$"+x];W&&!W.$$stub||this.$raise(y(H,"NameError").$new("undefined method `"+x+"' for class `"+this.$class()+"'",x));return y(H,"Method").$new(this,W.$$owner||this.$class(), W,x)},ia.$$arity=1);a.def(c,"$methods",da=function(x){null==x&&(x=!0);return q(x)?a.methods(this):a.own_methods(this)},da.$$arity=-1);a.def(c,"$public_methods",ma=function(x){null==x&&(x=!0);return q(x)?a.methods(this):a.receiver_methods(this)},ma.$$arity=-1);a.def(c,"$Array",b=function(x){if(x===p)return[];if(x.$$is_array)return x;var W=y(H,"Opal")["$coerce_to?"](x,y(H,"Array"),"to_ary");if(W!==p)return W;W=y(H,"Opal")["$coerce_to?"](x,y(H,"Array"),"to_a");return W!==p?W:[x]},b.$$arity=1);a.def(c, "$at_exit",m=function(){var x=m.$$p,W=x||p,oa=p;null==z.__at_exit__&&(z.__at_exit__=p);x&&(m.$$p=null);x&&(m.$$p=null);z.__at_exit__=q(oa=z.__at_exit__)?oa:[];z.__at_exit__["$<<"](W);return W},m.$$arity=0);a.def(c,"$caller",g=function(x,W){null==W&&(W=p);x=(Error().stack||"").split("\n");var oa=[];for(var Ka=3,jb=x.length;KaW||36=W?W-1:"9a-"+String.fromCharCode(97+(W-11)));(new RegExp("^\\s*[+-]?["+jb+"]+\\s*$")).test(Ka)||oa.$raise(y(H,"ArgumentError"),'invalid value for Integer(): "'+x+'"');Ka=parseInt(Ka,W);isNaN(Ka)&&oa.$raise(y(H,"ArgumentError"),'invalid value for Integer(): "'+ x+'"');return Ka},ea.$$arity=-2);a.def(c,"$Float",ua=function(x){x===p&&this.$raise(y(H,"TypeError"),"can't convert nil into Float");if(x.$$is_string){var W=x.toString();W=W.replace(/(\d)_(?=\d)/g,"$1");if(/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(W))return this.$Integer(W);/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(W)||this.$raise(y(H,"ArgumentError"),'invalid value for Float(): "'+x+'"');return parseFloat(W)}return y(H,"Opal")["$coerce_to!"](x,y(H,"Float"),"to_f")},ua.$$arity=1);a.def(c, -"$Hash",Da=function(x){var W=p;return q(q(W=x["$nil?"]())?W:x["$=="]([]))?f([],{}):q(y(H,"Hash")["$==="](x))?x:y(H,"Opal")["$coerce_to!"](x,y(H,"Hash"),"to_hash")},Da.$$arity=1);a.def(c,"$is_a?",Ga=function(x){x.$$is_class||x.$$is_module||this.$raise(y(H,"TypeError"),"class or module required");return a.is_a(this,x)},Ga.$$arity=1);a.def(c,"$itself",Ra=function(){return this},Ra.$$arity=0);a.alias(c,"kind_of?","is_a?");a.def(c,"$lambda",Pa=function(){var x=Pa.$$p,W=x||p;x&&(Pa.$$p=null);x&&(Pa.$$p= -null);return a.lambda(W)},Pa.$$arity=0);a.def(c,"$load",Ha=function(x){x=y(H,"Opal")["$coerce_to!"](x,y(H,"String"),"to_str");return a.load(x)},Ha.$$arity=1);a.def(c,"$loop",eb=function(){var x,W=eb.$$p,oa=W||p,Ka=p;W&&(eb.$$p=null);if(oa===p)return h(this,"enum_for",["loop"],(x=function(){return t(y(H,"Float"),"INFINITY")},x.$$s=this,x.$$arity=0,x));for(;q(!0);)try{a.yieldX(oa,[])}catch(jb){if(a.rescue(jb,[y(H,"StopIteration")])){Ka=jb;try{return Ka.$result()}finally{a.pop_exception()}}else throw jb; -}return this},eb.$$arity=0);a.def(c,"$nil?",kb=function(){return!1},kb.$$arity=0);a.alias(c,"object_id","__id__");a.def(c,"$printf",R=function(x){var W=a.slice.call(arguments,0,arguments.length);q(W["$any?"]())&&this.$print(h(this,"format",a.to_a(W)));return p},R.$$arity=-1);a.def(c,"$proc",ya=function(){var x=ya.$$p,W=x||p;x&&(ya.$$p=null);x&&(ya.$$p=null);q(W)||this.$raise(y(H,"ArgumentError"),"tried to create Proc object without a block");W.$$is_lambda=!1;return W},ya.$$arity=0);a.def(c,"$puts", -Ca=function(x){null==z.stdout&&(z.stdout=p);var W=a.slice.call(arguments,0,arguments.length);return h(z.stdout,"puts",a.to_a(W))},Ca.$$arity=-1);a.def(c,"$p",Ua=function(x){var W;var oa=a.slice.call(arguments,0,arguments.length);h(oa,"each",[],(W=function(Ka){null==z.stdout&&(z.stdout=p);null==Ka&&(Ka=p);return z.stdout.$puts(Ka.$inspect())},W.$$s=this,W.$$arity=1,W));return q(w(oa.$length(),1))?oa["$[]"](0):oa},Ua.$$arity=-1);a.def(c,"$print",ib=function(x){null==z.stdout&&(z.stdout=p);var W=a.slice.call(arguments, -0,arguments.length);return h(z.stdout,"print",a.to_a(W))},ib.$$arity=-1);a.def(c,"$warn",cb=function(x,W){var oa,Ka=p,jb=p;null==z.VERBOSE&&(z.VERBOSE=p);null==z.stderr&&(z.stderr=p);var ob=a.slice.call(arguments,0,arguments.length);var mb=a.extract_kwargs(ob);if(null==mb)mb=f([],{});else if(!mb.$$is_hash)throw a.ArgumentError.$new("expected kwargs");mb=mb.$$smap.uplevel;null==mb&&(mb=p);q(mb)&&(mb=y(H,"Opal")["$coerce_to!"](mb,y(H,"Integer"),"to_str"),q("number"===typeof mb?0>mb:mb["$<"](0))&&this.$raise(y(H, -"ArgumentError"),"negative level ("+mb+")"),Ka=this.$caller("number"===typeof mb?mb+2:mb["$+"](2),1).$first(),q(Ka)&&(Ka=""+Ka+": "),ob=h(ob,"map",[],(oa=function(sb){null==sb&&(sb=p);return""+Ka+"warning: "+sb},oa.$$s=this,oa.$$arity=1,oa)));return q(q(jb=z.VERBOSE["$nil?"]())?jb:ob["$empty?"]())?p:h(z.stderr,"puts",a.to_a(ob))},cb.$$arity=-1);a.def(c,"$raise",ab=function(x,W){null==z["!"]&&(z["!"]=p);null==W&&(W=p);if(null==x&&z["!"]!==p)throw z["!"];null==x?x=y(H,"RuntimeError").$new():x.$$is_string? -x=y(H,"RuntimeError").$new(x):x.$$is_class&&x["$respond_to?"]("exception")?x=x.$exception(W):x["$is_a?"](y(H,"Exception"))||(x=y(H,"TypeError").$new("exception class/object expected"));z["!"]!==p&&a.exceptions.push(z["!"]);z["!"]=x;throw x;},ab.$$arity=-1);a.alias(c,"fail","raise");a.def(c,"$rand",Xa=function(x){if(void 0===x)return t(y(H,"Random"),"DEFAULT").$rand();x.$$is_number&&(0>x&&(x=Math.abs(x)),0!==x%1&&(x=x.$to_i()),0===x&&(x=void 0));return t(y(H,"Random"),"DEFAULT").$rand(x)},Xa.$$arity= +"$Hash",Fa=function(x){var W=p;return q(q(W=x["$nil?"]())?W:x["$=="]([]))?f([],{}):q(y(H,"Hash")["$==="](x))?x:y(H,"Opal")["$coerce_to!"](x,y(H,"Hash"),"to_hash")},Fa.$$arity=1);a.def(c,"$is_a?",Ga=function(x){x.$$is_class||x.$$is_module||this.$raise(y(H,"TypeError"),"class or module required");return a.is_a(this,x)},Ga.$$arity=1);a.def(c,"$itself",Ra=function(){return this},Ra.$$arity=0);a.alias(c,"kind_of?","is_a?");a.def(c,"$lambda",Pa=function(){var x=Pa.$$p,W=x||p;x&&(Pa.$$p=null);x&&(Pa.$$p= +null);return a.lambda(W)},Pa.$$arity=0);a.def(c,"$load",Ha=function(x){x=y(H,"Opal")["$coerce_to!"](x,y(H,"String"),"to_str");return a.load(x)},Ha.$$arity=1);a.def(c,"$loop",fb=function(){var x,W=fb.$$p,oa=W||p,Ka=p;W&&(fb.$$p=null);if(oa===p)return h(this,"enum_for",["loop"],(x=function(){return t(y(H,"Float"),"INFINITY")},x.$$s=this,x.$$arity=0,x));for(;q(!0);)try{a.yieldX(oa,[])}catch(jb){if(a.rescue(jb,[y(H,"StopIteration")])){Ka=jb;try{return Ka.$result()}finally{a.pop_exception()}}else throw jb; +}return this},fb.$$arity=0);a.def(c,"$nil?",kb=function(){return!1},kb.$$arity=0);a.alias(c,"object_id","__id__");a.def(c,"$printf",S=function(x){var W=a.slice.call(arguments,0,arguments.length);q(W["$any?"]())&&this.$print(h(this,"format",a.to_a(W)));return p},S.$$arity=-1);a.def(c,"$proc",ya=function(){var x=ya.$$p,W=x||p;x&&(ya.$$p=null);x&&(ya.$$p=null);q(W)||this.$raise(y(H,"ArgumentError"),"tried to create Proc object without a block");W.$$is_lambda=!1;return W},ya.$$arity=0);a.def(c,"$puts", +Ca=function(x){null==z.stdout&&(z.stdout=p);var W=a.slice.call(arguments,0,arguments.length);return h(z.stdout,"puts",a.to_a(W))},Ca.$$arity=-1);a.def(c,"$p",Va=function(x){var W;var oa=a.slice.call(arguments,0,arguments.length);h(oa,"each",[],(W=function(Ka){null==z.stdout&&(z.stdout=p);null==Ka&&(Ka=p);return z.stdout.$puts(Ka.$inspect())},W.$$s=this,W.$$arity=1,W));return q(w(oa.$length(),1))?oa["$[]"](0):oa},Va.$$arity=-1);a.def(c,"$print",cb=function(x){null==z.stdout&&(z.stdout=p);var W=a.slice.call(arguments, +0,arguments.length);return h(z.stdout,"print",a.to_a(W))},cb.$$arity=-1);a.def(c,"$warn",db=function(x,W){var oa,Ka=p,jb=p;null==z.VERBOSE&&(z.VERBOSE=p);null==z.stderr&&(z.stderr=p);var ob=a.slice.call(arguments,0,arguments.length);var mb=a.extract_kwargs(ob);if(null==mb)mb=f([],{});else if(!mb.$$is_hash)throw a.ArgumentError.$new("expected kwargs");mb=mb.$$smap.uplevel;null==mb&&(mb=p);q(mb)&&(mb=y(H,"Opal")["$coerce_to!"](mb,y(H,"Integer"),"to_str"),q("number"===typeof mb?0>mb:mb["$<"](0))&&this.$raise(y(H, +"ArgumentError"),"negative level ("+mb+")"),Ka=this.$caller("number"===typeof mb?mb+2:mb["$+"](2),1).$first(),q(Ka)&&(Ka=""+Ka+": "),ob=h(ob,"map",[],(oa=function(sb){null==sb&&(sb=p);return""+Ka+"warning: "+sb},oa.$$s=this,oa.$$arity=1,oa)));return q(q(jb=z.VERBOSE["$nil?"]())?jb:ob["$empty?"]())?p:h(z.stderr,"puts",a.to_a(ob))},db.$$arity=-1);a.def(c,"$raise",ab=function(x,W){null==z["!"]&&(z["!"]=p);null==W&&(W=p);if(null==x&&z["!"]!==p)throw z["!"];null==x?x=y(H,"RuntimeError").$new():x.$$is_string? +x=y(H,"RuntimeError").$new(x):x.$$is_class&&x["$respond_to?"]("exception")?x=x.$exception(W):x["$is_a?"](y(H,"Exception"))||(x=y(H,"TypeError").$new("exception class/object expected"));z["!"]!==p&&a.exceptions.push(z["!"]);z["!"]=x;throw x;},ab.$$arity=-1);a.alias(c,"fail","raise");a.def(c,"$rand",Ya=function(x){if(void 0===x)return t(y(H,"Random"),"DEFAULT").$rand();x.$$is_number&&(0>x&&(x=Math.abs(x)),0!==x%1&&(x=x.$to_i()),0===x&&(x=void 0));return t(y(H,"Random"),"DEFAULT").$rand(x)},Ya.$$arity= -1);a.def(c,"$respond_to?",za=function(x,W){null==W&&(W=!1);var oa=this["$"+x];return"function"!==typeof oa||oa.$$stub?!0===this["$respond_to_missing?"].$$pristine?!1:this["$respond_to_missing?"](x,W):!0},za.$$arity=-2);a.def(c,"$respond_to_missing?",ta=function(){return!1},ta.$$arity=-2);y(H,"Opal").$pristine(c,"respond_to?","respond_to_missing?");a.def(c,"$require",Ma=function(x){x=y(H,"Opal")["$coerce_to!"](x,y(H,"String"),"to_str");return a.require(x)},Ma.$$arity=1);a.def(c,"$require_relative", -Sa=function(x){y(H,"Opal")["$try_convert!"](x,y(H,"String"),"to_str");x=y(H,"File").$expand_path(y(H,"File").$join(a.current_file,"..",x));return a.require(x)},Sa.$$arity=1);a.def(c,"$require_tree",Za=function(x){var W=[];x=y(H,"File").$expand_path(x);x=a.normalize(x);"."===x&&(x="");for(var oa in a.modules)oa["$start_with?"](x)&&W.push([oa,a.require(oa)]);return W},Za.$$arity=1);a.alias(c,"send","__send__");a.alias(c,"public_send","__send__");a.def(c,"$singleton_class",Ea=function(){return a.get_singleton_class(this)}, -Ea.$$arity=0);a.def(c,"$sleep",Y=function(x){null==x&&(x=p);x===p&&this.$raise(y(H,"TypeError"),"can't convert NilClass into time interval");x.$$is_number||this.$raise(y(H,"TypeError"),"can't convert "+x.$class()+" into time interval");0>x&&this.$raise(y(H,"ArgumentError"),"time interval must be positive");for(var W=a.global.performance?function(){return performance.now()}:function(){return new Date},oa=W();W()-oa<=1E3*x;);return Math.round(x)},Y.$$arity=-1);a.def(c,"$srand",S=function(x){null==x&& -(x=y(H,"Random").$new_seed());return y(H,"Random").$srand(x)},S.$$arity=-1);a.def(c,"$String",Z=function(x){var W;return q(W=y(H,"Opal")["$coerce_to?"](x,y(H,"String"),"to_str"))?W:y(H,"Opal")["$coerce_to!"](x,y(H,"String"),"to_s")},Z.$$arity=1);a.def(c,"$tap",V=function(){var x=V.$$p,W=x||p;x&&(V.$$p=null);x&&(V.$$p=null);a.yield1(W,this);return this},V.$$arity=0);a.def(c,"$to_proc",fa=function(){return this},fa.$$arity=0);a.def(c,"$to_s",la=function(){return"#<"+this.$class()+":0x"+this.$__id__().$to_s(16)+ +Sa=function(x){y(H,"Opal")["$try_convert!"](x,y(H,"String"),"to_str");x=y(H,"File").$expand_path(y(H,"File").$join(a.current_file,"..",x));return a.require(x)},Sa.$$arity=1);a.def(c,"$require_tree",Za=function(x){var W=[];x=y(H,"File").$expand_path(x);x=a.normalize(x);"."===x&&(x="");for(var oa in a.modules)oa["$start_with?"](x)&&W.push([oa,a.require(oa)]);return W},Za.$$arity=1);a.alias(c,"send","__send__");a.alias(c,"public_send","__send__");a.def(c,"$singleton_class",Da=function(){return a.get_singleton_class(this)}, +Da.$$arity=0);a.def(c,"$sleep",Y=function(x){null==x&&(x=p);x===p&&this.$raise(y(H,"TypeError"),"can't convert NilClass into time interval");x.$$is_number||this.$raise(y(H,"TypeError"),"can't convert "+x.$class()+" into time interval");0>x&&this.$raise(y(H,"ArgumentError"),"time interval must be positive");for(var W=a.global.performance?function(){return performance.now()}:function(){return new Date},oa=W();W()-oa<=1E3*x;);return Math.round(x)},Y.$$arity=-1);a.def(c,"$srand",R=function(x){null==x&& +(x=y(H,"Random").$new_seed());return y(H,"Random").$srand(x)},R.$$arity=-1);a.def(c,"$String",Z=function(x){var W;return q(W=y(H,"Opal")["$coerce_to?"](x,y(H,"String"),"to_str"))?W:y(H,"Opal")["$coerce_to!"](x,y(H,"String"),"to_s")},Z.$$arity=1);a.def(c,"$tap",V=function(){var x=V.$$p,W=x||p;x&&(V.$$p=null);x&&(V.$$p=null);a.yield1(W,this);return this},V.$$arity=0);a.def(c,"$to_proc",fa=function(){return this},fa.$$arity=0);a.def(c,"$to_s",la=function(){return"#<"+this.$class()+":0x"+this.$__id__().$to_s(16)+ ">"},la.$$arity=0);a.def(c,"$catch",k=function(x){var W=k.$$p,oa=W||p;W&&(k.$$p=null);try{return a.yieldX(oa,[])}catch(Ka){if(a.rescue(Ka,[y(H,"UncaughtThrowError")])){W=Ka;try{return W.$sym()["$=="](x)?W.$arg():this.$raise()}finally{a.pop_exception()}}else throw Ka;}},k.$$arity=1);a.def(c,"$throw",C=function(x){var W=a.slice.call(arguments,0,arguments.length);return this.$raise(y(H,"UncaughtThrowError"),W)},C.$$arity=-1);a.def(c,"$open",O=function(x){var W=O.$$p,oa=W||p;W&&(O.$$p=null);W&&(O.$$p= null);W=a.slice.call(arguments,0,arguments.length);return h(y(H,"File"),"open",a.to_a(W),oa.$to_proc())},O.$$arity=-1);a.def(c,"$yield_self",aa=function(){var x,W=aa.$$p,oa=W||p;W&&(aa.$$p=null);return oa===p?h(this,"enum_for",["yield_self"],(x=function(){return 1},x.$$s=this,x.$$arity=0,x)):a.yield1(oa,this)},aa.$$arity=0);a.alias(c,"then","yield_self");y(H,"Opal").$pristine(c,"method_missing")})(F[0],F);return function(c,$super,H){c=v(c,$super,"Object");H=[c].concat(H);return c.$include(y(H,"Kernel"))}(F[0], null,F)}; @@ -186,13 +186,13 @@ g.begin:r:!1},n.$$arity=1);a.alias(f,"eql?","==");a.def(f,"$begin",J=function(g) r=1,A=this.matches.length;r"},ia.$$arity=0);a.def(f,"$length",da=function(){return this.matches.length},da.$$arity=0);a.alias(f,"size","length");a.def(f,"$to_a",ma=function(){return this.matches},ma.$$arity=0);a.def(f,"$to_s",b=function(){return this.matches[0]},b.$$arity=0);return(a.def(f,"$values_at",m=function(g){var r=a.slice.call(arguments,0,arguments.length);var A,E=[];for(A=0;AI&&(I+=this.matches.length,0>I)){E.push(F);continue}E.push(this.matches[I])}return E},m.$$arity=-1),F)&&"values_at"}(w[0],null,w)}; Opal.modules["corelib/string"]=function(a){function w(l,H){return"number"===typeof l&&"number"===typeof H?l/H:l["$/"](H)}function F(l,H){return"number"===typeof l&&"number"===typeof H?l+H:l["$+"](H)}var p=a.top,t=[],y=a.nil,q=a.$$$,d=a.$$,G=a.coerce_to,z=a.respond_to,f=a.klass,h=a.truthy,v=a.send,c=a.gvars;a.add_stubs("$require $include $coerce_to? $raise $=== $format $to_s $respond_to? $to_str $<=> $== $=~ $new $force_encoding $casecmp $empty? $ljust $ceil $/ $+ $rjust $floor $to_a $each_char $to_proc $coerce_to! $copy_singleton_methods $initialize_clone $initialize_dup $enum_for $size $chomp $[] $to_i $each_line $encoding $class $match $match? $captures $proc $succ $escape $include? $upcase $unicode_normalize".split(" ")); -p.$require("corelib/comparable");p.$require("corelib/regexp");(function(l,$super,e){function n(B){function P(Ta){var Ya="",gb,qb=Ta.length;for(gb=0;gbnb&&J.$raise(d(D,"ArgumentError"),'invalid range "'+pb+"-"+nb+'" in string transliteration');for(pb+=1;pbnb&&J.$raise(d(D,"ArgumentError"),'invalid range "'+pb+"-"+nb+'" in string transliteration');for(pb+=1;pbB&&this.$raise(d(D,"ArgumentError"),"negative argument");if(0===B)return this.$$cast("");var P="",qa=this.toString();for(268435456<=qa.length*B&&this.$raise(d(D,"RangeError"),"multiply count must not overflow maximum string size");;){1===(B&1)&&(P+=qa);B>>>=1;if(0===B)break;qa+=qa}return this.$$cast(P)},m.$$arity=1);a.def(J,"$+",g=function(B){B=G(B,d(D,"String"), "to_str");return this+B.$to_s()},g.$$arity=1);a.def(J,"$<=>",r=function(B){if(h(B["$respond_to?"]("to_str")))return B=B.$to_str().$to_s(),this>B?1:this"](this);return B===y?y:0B?1:0},r.$$arity=1);a.def(J,"$==",A=function(B){return B.$$is_string?this.toString()===B.toString():z(B,"$to_str")?B["$=="](this):!1},A.$$arity=1);a.alias(J,"eql?","==");a.alias(J,"===","==");a.def(J,"$=~",E=function(B){B.$$is_string&&this.$raise(d(D,"TypeError"),"type mismatch: String given");return B["$=~"](this)}, -E.$$arity=1);a.def(J,"$[]",I=function(B,P){var qa=this.length;if(B.$$is_range){var Fa=B.excl;P=G(B.end,d(D,"Integer"),"to_int");B=G(B.begin,d(D,"Integer"),"to_int");if(Math.abs(B)>qa)return y;0>B&&(B+=qa);0>P&&(P+=qa);Fa||(P+=1);P-=B;0>P&&(P=0);return this.$$cast(this.substr(B,P))}if(B.$$is_string)return null!=P&&this.$raise(d(D,"TypeError")),-1!==this.indexOf(B)?this.$$cast(B):y;if(B.$$is_regexp){qa=this.match(B);if(null===qa)return c["~"]=y;c["~"]=d(D,"MatchData").$new(B,qa);if(null==P)return this.$$cast(qa[0]); +E.$$arity=1);a.def(J,"$[]",I=function(B,P){var qa=this.length;if(B.$$is_range){var Ea=B.excl;P=G(B.end,d(D,"Integer"),"to_int");B=G(B.begin,d(D,"Integer"),"to_int");if(Math.abs(B)>qa)return y;0>B&&(B+=qa);0>P&&(P+=qa);Ea||(P+=1);P-=B;0>P&&(P=0);return this.$$cast(this.substr(B,P))}if(B.$$is_string)return null!=P&&this.$raise(d(D,"TypeError")),-1!==this.indexOf(B)?this.$$cast(B):y;if(B.$$is_regexp){qa=this.match(B);if(null===qa)return c["~"]=y;c["~"]=d(D,"MatchData").$new(B,qa);if(null==P)return this.$$cast(qa[0]); P=G(P,d(D,"Integer"),"to_int");return 0>P&&-PB&&(B+=qa);if(null==P)return B>=qa||0>B?y:this.$$cast(this.substr(B,1));P=G(P,d(D,"Integer"),"to_int");return 0>P||B>qa||0>B?y:this.$$cast(this.substr(B,P))},I.$$arity=-2);a.alias(J,"byteslice","[]");a.def(J,"$b",L=function(){return this.$force_encoding("binary")},L.$$arity=0);a.def(J,"$capitalize",ba=function(){return this.$$cast(this.charAt(0).toUpperCase()+ this.substr(1).toLowerCase())},ba.$$arity=0);a.def(J,"$casecmp",va=function(B){var P=this;if(!h(B["$respond_to?"]("to_str")))return y;B=G(B,d(D,"String"),"to_str").$to_s();var qa=/^[\x00-\x7F]*$/;qa.test(P)&&qa.test(B)&&(P=P.toLowerCase(),B=B.toLowerCase());return P["$<=>"](B)},va.$$arity=1);a.def(J,"$casecmp?",Oa=function(B){B=this.$casecmp(B);return B===y?y:0===B},Oa.$$arity=1);a.def(J,"$center",wa=function(B,P){null==P&&(P=" ");B=G(B,d(D,"Integer"),"to_int");P=G(P,d(D,"String"),"to_str").$to_s(); h(P["$empty?"]())&&this.$raise(d(D,"ArgumentError"),"zero width padding");if(h(B<=this.length))return this;var qa=this.$ljust(w(F(B,this.length),2).$ceil(),P);B=this.$rjust(w(F(B,this.length),2).$floor(),P);return this.$$cast(B+qa.slice(this.length))},wa.$$arity=-2);a.def(J,"$chars",Aa=function(){var B=Aa.$$p,P=B||y;B&&(Aa.$$p=null);B&&(Aa.$$p=null);return h(P)?v(this,"each_char",[],P.$to_proc()):this.$each_char().$to_a()},Aa.$$arity=0);a.def(J,"$chomp",La=function(B){null==c["/"]&&(c["/"]=y);null== @@ -200,90 +200,90 @@ B&&(B=c["/"]);if(h(B===y||0===this.length))return this;B=d(D,"Opal")["$coerce_to B-1);return this.$$cast(B)},na.$$arity=0);a.def(J,"$chr",U=function(){return this.charAt(0)},U.$$arity=0);a.def(J,"$clone",ra=function(){var B=new String(this);B.$copy_singleton_methods(this);B.$initialize_clone(this);return B},ra.$$arity=0);a.def(J,"$dup",xa=function(){var B=new String(this);B.$initialize_dup(this);return B},xa.$$arity=0);a.def(J,"$count",Ja=function(B){var P=a.slice.call(arguments,0,arguments.length);0===P.length&&this.$raise(d(D,"ArgumentError"),"ArgumentError: wrong number of arguments (0 for 1+)"); P=n(P);return null===P?0:this.length-this.replace(new RegExp(P,"g"),"").length},Ja.$$arity=-1);a.def(J,"$delete",ka=function(B){var P=a.slice.call(arguments,0,arguments.length);0===P.length&&this.$raise(d(D,"ArgumentError"),"ArgumentError: wrong number of arguments (0 for 1+)");P=n(P);return null===P?this:this.$$cast(this.replace(new RegExp(P,"g"),""))},ka.$$arity=-1);a.def(J,"$delete_prefix",N=function(B){B.$$is_string||(B=G(B,d(D,"String"),"to_str"));return this.slice(0,B.length)===B?this.$$cast(this.slice(B.length)): this},N.$$arity=1);a.def(J,"$delete_suffix",M=function(B){B.$$is_string||(B=G(B,d(D,"String"),"to_str"));return this.slice(this.length-B.length)===B?this.$$cast(this.slice(0,this.length-B.length)):this},M.$$arity=1);a.def(J,"$downcase",ja=function(){return this.$$cast(this.toLowerCase())},ja.$$arity=0);a.def(J,"$each_char",sa=function(){var B=sa.$$p,P=B||y,qa;B&&(sa.$$p=null);B&&(sa.$$p=null);if(P===y)return v(this,"enum_for",["each_char"],(qa=function(){return(null==qa.$$s?this:qa.$$s).$size()}, -qa.$$s=this,qa.$$arity=0,qa));B=0;for(var Fa=this.length;B=Ba.length&&this.substr(this.length- -Ba.length,Ba.length)==Ba)return!0}return!1},Da.$$arity=-1);a.alias(J,"equal?","===");a.def(J,"$gsub",Ga=function(B,P){var qa=Ga.$$p,Fa=qa||y,Ba=this;qa&&(Ga.$$p=null);qa&&(Ga.$$p=null);if(void 0===P&&Fa===y)return Ba.$enum_for("gsub",B);qa="";var Ia=y,Wa=0;B.$$is_regexp?B=a.global_multiline_regexp(B):(B=G(B,d(D,"String"),"to_str"),B=new RegExp(B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gm"));for(var hb;;){var db=B.exec(Ba);if(null===db){c["~"]=y;qa+=Ba.slice(Wa);break}Ia=d(D,"MatchData").$new(B,db); -if(void 0===P){hb=B.lastIndex;var Ta=Fa(db[0]);B.lastIndex=hb}else P.$$is_hash?Ta=P["$[]"](db[0]).$to_s():(P.$$is_string||(P=G(P,d(D,"String"),"to_str")),Ta=P.replace(/([\\]+)([0-9+&`'])/g,function(Ya,gb,qb){if(0===gb.length%2)return Ya;switch(qb){case "+":for(Ya=db.length-1;0P&&(P+=this.length,0>P))return y;if(B.$$is_regexp)for(qa=a.global_multiline_regexp(B);;){B=qa.exec(this);if(null===B){c["~"]=y;P=-1;break}if(B.index>=P){c["~"]=d(D,"MatchData").$new(qa,B);P=B.index;break}qa.lastIndex=B.index+1}else B=G(B,d(D,"String"),"to_str"),P=0===B.length&&P>this.length?-1:this.indexOf(B,P);return-1===P?y:P},eb.$$arity=-2);a.def(J,"$inspect",kb=function(){var B={"\u0007":"\\a","\u001b":"\\e","\b":"\\b","\t":"\\t", -"\n":"\\n","\f":"\\f","\r":"\\r","\x0B":"\\v",'"':'\\"',"\\":"\\\\"};return'"'+this.replace(/[\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(P){return B[P]||"\\u"+("0000"+P.charCodeAt(0).toString(16).toUpperCase()).slice(-4)}).replace(/#[\$@\{]/g,"\\$&")+'"'},kb.$$arity=0);a.def(J,"$intern",R=function(){return this.toString()},R.$$arity=0);a.def(J,"$lines",ya=function(B){var P=ya.$$p,qa=P||y;null==c["/"]&&(c["/"]=y);P&& -(ya.$$p=null);P&&(ya.$$p=null);null==B&&(B=c["/"]);B=v(this,"each_line",[B],qa.$to_proc());return h(qa)?this:B.$to_a()},ya.$$arity=-1);a.def(J,"$length",Ca=function(){return this.length},Ca.$$arity=0);a.def(J,"$ljust",Ua=function(B,P){null==P&&(P=" ");B=G(B,d(D,"Integer"),"to_int");P=G(P,d(D,"String"),"to_str").$to_s();h(P["$empty?"]())&&this.$raise(d(D,"ArgumentError"),"zero width padding");if(h(B<=this.length))return this;var qa=-1,Fa="";for(B-=this.length;++qa=Ba||65<=Ba&&90>=Ba||97<=Ba&&122>=Ba)switch(Ba){case 57:Fa=!0;Ba=48;break;case 90:Fa=!0;Ba=65;break;case 122:Fa=!0;Ba=97;break;default:Fa=!1,Ba+=1}else-1===qa?255===Ba?(Fa=!0,Ba=0):(Fa=!1,Ba+=1):Fa=!0;P=P.slice(0,B)+String.fromCharCode(Ba)+P.slice(B+1);if(Fa&&(0===B||B===qa)){switch(Ba){case 65:break;case 97:break;default:Ba+=1}P=0===B?String.fromCharCode(Ba)+P:P.slice(0,B)+String.fromCharCode(Ba)+P.slice(B);Fa=!1}if(!Fa)break}return this.$$cast(P)}, -za.$$arity=0);a.def(J,"$oct",ta=function(){var B=this;var P=8;if(/^\s*_/.test(B))return 0;B=B.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i,function(qa,Fa,Ba,Ia){switch(Ia.charAt(0)){case "+":case "-":return qa;case "0":if("x"===Ia.charAt(1)&&"0x"===Ba)return qa}switch(Ba){case "0b":P=2;break;case "0":case "0o":P=8;break;case "0d":P=10;break;case "0x":P=16}return Fa+Ia});B=parseInt(B.replace(/_(?!_)/g,""),P);return isNaN(B)?0:B},ta.$$arity=0);a.def(J,"$ord",Ma=function(){return this.charCodeAt(0)},Ma.$$arity= -0);a.def(J,"$partition",Sa=function(B){if(B.$$is_regexp){var P=B.exec(this);null===P?P=-1:(d(D,"MatchData").$new(B,P),B=P[0],P=P.index)}else B=G(B,d(D,"String"),"to_str"),P=this.indexOf(B);return-1===P?[this,"",""]:[this.slice(0,P),this.slice(P,P+B.length),this.slice(P+B.length)]},Sa.$$arity=1);a.def(J,"$reverse",Za=function(){return this.split("").reverse().join("")},Za.$$arity=0);a.def(J,"$rindex",Ea=function(B,P){if(void 0===P)P=this.length;else if(P=G(P,d(D,"Integer"),"to_int"),0>P&&(P+=this.length, -0>P))return y;if(B.$$is_regexp){var qa=null;for(B=a.global_multiline_regexp(B);;){var Fa=B.exec(this);if(null===Fa||Fa.index>P)break;qa=Fa;B.lastIndex=qa.index+1}null===qa?(c["~"]=y,P=-1):(d(D,"MatchData").$new(B,qa),P=qa.index)}else B=G(B,d(D,"String"),"to_str"),P=this.lastIndexOf(B,P);return-1===P?y:P},Ea.$$arity=-2);a.def(J,"$rjust",Y=function(B,P){null==P&&(P=" ");B=G(B,d(D,"Integer"),"to_int");P=G(P,d(D,"String"),"to_str").$to_s();h(P["$empty?"]())&&this.$raise(d(D,"ArgumentError"),"zero width padding"); -if(h(B<=this.length))return this;B=Math.floor(B-this.length);var qa=Array(Math.floor(B/P.length)+1).join(P);return this.$$cast(qa+P.slice(0,B-qa.length)+this)},Y.$$arity=-2);a.def(J,"$rpartition",S=function(B){var P;if(B.$$is_regexp){var qa=null;for(P=a.global_multiline_regexp(B);;){var Fa=P.exec(this);if(null===Fa)break;qa=Fa;P.lastIndex=qa.index+1}null===qa?qa=-1:(d(D,"MatchData").$new(P,qa),B=qa[0],qa=qa.index)}else B=G(B,d(D,"String"),"to_str"),qa=this.lastIndexOf(B);return-1===qa?["","",this]: -[this.slice(0,qa),this.slice(qa,qa+B.length),this.slice(qa+B.length)]},S.$$arity=1);a.def(J,"$rstrip",Z=function(){return this.replace(/[\s\u0000]*$/,"")},Z.$$arity=0);a.def(J,"$scan",V=function(B){var P=V.$$p,qa=P||y;P&&(V.$$p=null);P&&(V.$$p=null);P=[];var Fa=y,Ba;B.$$is_regexp?B=a.global_multiline_regexp(B):(B=G(B,d(D,"String"),"to_str"),B=new RegExp(B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gm"));for(;null!=(Ba=B.exec(this));)Fa=d(D,"MatchData").$new(B,Ba),qa===y?1==Ba.length?P.push(Ba[0]):P.push(Fa.$captures()): -1==Ba.length?qa(Ba[0]):qa.call(this,Fa.$captures()),B.lastIndex===Ba.index&&(B.lastIndex+=1);c["~"]=Fa;return qa!==y?this:P},V.$$arity=1);a.alias(J,"size","length");a.alias(J,"slice","[]");a.def(J,"$split",fa=function(B,P){function qa(){for(hb=0;hbP){if(null!==db&&""===db[0]&&-1===B.source.indexOf("(?="))for(hb=0,B=db.length;hb< -B;hb++)Ia.push("");qa();return Ia}if(null!==db&&""===db[0])return Ia.splice(P-1,Ia.length-1,Ia.slice(P-1).join("")),qa(),Ia;if(P>=Ia.length)return qa(),Ia;for(hb=0;null!==db;){hb++;Wa=B.lastIndex;if(hb+1===P)break;db=B.exec(Ba)}Ia.splice(P-1,Ia.length-1,Ba.slice(Wa));qa();return Ia},fa.$$arity=-1);a.def(J,"$squeeze",la=function(B){var P=a.slice.call(arguments,0,arguments.length);if(0===P.length)return this.$$cast(this.replace(/(.)\1+/g,"$1"));P=n(P);return null===P?this:this.$$cast(this.replace(new RegExp("("+ -P+")\\1+","g"),"$1"))},la.$$arity=-1);a.def(J,"$start_with?",k=function(B){var P=a.slice.call(arguments,0,arguments.length);for(var qa=0,Fa=P.length;qa=B?P:P&Math.pow(2,B)-1},aa.$$arity=-1);a.def(J,"$swapcase",x=function(){var B=this.replace(/([a-z]+)|([A-Z]+)/g,function(P,qa){return qa?P.toUpperCase():P.toLowerCase()});return this.constructor===String?B:this.$class().$new(B)},x.$$arity=0);a.def(J,"$to_f",W=function(){if("_"===this.charAt(0))return 0;var B=parseFloat(this.replace(/_/g,""));return isNaN(B)||Infinity==B||-Infinity==B?0:B},W.$$arity=0);a.def(J,"$to_i",oa=function(B){null==B&&(B=10);var P= -this.toLowerCase(),qa=G(B,d(D,"Integer"),"to_int");(1===qa||0>qa||36Ya&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ta)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ta+=1;TaYa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ta)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ta+=1;TaYa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ta)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ta+=1;TaYa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ta)+"-"+String.fromCharCode(Ya)+'" in string transliteration');for(Ta+=1;Ta=Ba.length&&this.substr(this.length- +Ba.length,Ba.length)==Ba)return!0}return!1},Fa.$$arity=-1);a.alias(J,"equal?","===");a.def(J,"$gsub",Ga=function(B,P){var qa=Ga.$$p,Ea=qa||y,Ba=this;qa&&(Ga.$$p=null);qa&&(Ga.$$p=null);if(void 0===P&&Ea===y)return Ba.$enum_for("gsub",B);qa="";var Ia=y,Wa=0;B.$$is_regexp?B=a.global_multiline_regexp(B):(B=G(B,d(D,"String"),"to_str"),B=new RegExp(B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gm"));for(var ib;;){var eb=B.exec(Ba);if(null===eb){c["~"]=y;qa+=Ba.slice(Wa);break}Ia=d(D,"MatchData").$new(B,eb); +if(void 0===P){ib=B.lastIndex;var Ta=Ea(eb[0]);B.lastIndex=ib}else P.$$is_hash?Ta=P["$[]"](eb[0]).$to_s():(P.$$is_string||(P=G(P,d(D,"String"),"to_str")),Ta=P.replace(/([\\]+)([0-9+&`'])/g,function(Xa,hb,qb){if(0===hb.length%2)return Xa;switch(qb){case "+":for(Xa=eb.length-1;0P&&(P+=this.length,0>P))return y;if(B.$$is_regexp)for(qa=a.global_multiline_regexp(B);;){B=qa.exec(this);if(null===B){c["~"]=y;P=-1;break}if(B.index>=P){c["~"]=d(D,"MatchData").$new(qa,B);P=B.index;break}qa.lastIndex=B.index+1}else B=G(B,d(D,"String"),"to_str"),P=0===B.length&&P>this.length?-1:this.indexOf(B,P);return-1===P?y:P},fb.$$arity=-2);a.def(J,"$inspect",kb=function(){var B={"\u0007":"\\a","\u001b":"\\e","\b":"\\b","\t":"\\t", +"\n":"\\n","\f":"\\f","\r":"\\r","\x0B":"\\v",'"':'\\"',"\\":"\\\\"};return'"'+this.replace(/[\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(P){return B[P]||"\\u"+("0000"+P.charCodeAt(0).toString(16).toUpperCase()).slice(-4)}).replace(/#[\$@\{]/g,"\\$&")+'"'},kb.$$arity=0);a.def(J,"$intern",S=function(){return this.toString()},S.$$arity=0);a.def(J,"$lines",ya=function(B){var P=ya.$$p,qa=P||y;null==c["/"]&&(c["/"]=y);P&& +(ya.$$p=null);P&&(ya.$$p=null);null==B&&(B=c["/"]);B=v(this,"each_line",[B],qa.$to_proc());return h(qa)?this:B.$to_a()},ya.$$arity=-1);a.def(J,"$length",Ca=function(){return this.length},Ca.$$arity=0);a.def(J,"$ljust",Va=function(B,P){null==P&&(P=" ");B=G(B,d(D,"Integer"),"to_int");P=G(P,d(D,"String"),"to_str").$to_s();h(P["$empty?"]())&&this.$raise(d(D,"ArgumentError"),"zero width padding");if(h(B<=this.length))return this;var qa=-1,Ea="";for(B-=this.length;++qa=Ba||65<=Ba&&90>=Ba||97<=Ba&&122>=Ba)switch(Ba){case 57:Ea=!0;Ba=48;break;case 90:Ea=!0;Ba=65;break;case 122:Ea=!0;Ba=97;break;default:Ea=!1,Ba+=1}else-1===qa?255===Ba?(Ea=!0,Ba=0):(Ea=!1,Ba+=1):Ea=!0;P=P.slice(0,B)+String.fromCharCode(Ba)+P.slice(B+1);if(Ea&&(0===B||B===qa)){switch(Ba){case 65:break;case 97:break;default:Ba+=1}P=0===B?String.fromCharCode(Ba)+P:P.slice(0,B)+String.fromCharCode(Ba)+P.slice(B);Ea=!1}if(!Ea)break}return this.$$cast(P)}, +za.$$arity=0);a.def(J,"$oct",ta=function(){var B=this;var P=8;if(/^\s*_/.test(B))return 0;B=B.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i,function(qa,Ea,Ba,Ia){switch(Ia.charAt(0)){case "+":case "-":return qa;case "0":if("x"===Ia.charAt(1)&&"0x"===Ba)return qa}switch(Ba){case "0b":P=2;break;case "0":case "0o":P=8;break;case "0d":P=10;break;case "0x":P=16}return Ea+Ia});B=parseInt(B.replace(/_(?!_)/g,""),P);return isNaN(B)?0:B},ta.$$arity=0);a.def(J,"$ord",Ma=function(){return this.charCodeAt(0)},Ma.$$arity= +0);a.def(J,"$partition",Sa=function(B){if(B.$$is_regexp){var P=B.exec(this);null===P?P=-1:(d(D,"MatchData").$new(B,P),B=P[0],P=P.index)}else B=G(B,d(D,"String"),"to_str"),P=this.indexOf(B);return-1===P?[this,"",""]:[this.slice(0,P),this.slice(P,P+B.length),this.slice(P+B.length)]},Sa.$$arity=1);a.def(J,"$reverse",Za=function(){return this.split("").reverse().join("")},Za.$$arity=0);a.def(J,"$rindex",Da=function(B,P){if(void 0===P)P=this.length;else if(P=G(P,d(D,"Integer"),"to_int"),0>P&&(P+=this.length, +0>P))return y;if(B.$$is_regexp){var qa=null;for(B=a.global_multiline_regexp(B);;){var Ea=B.exec(this);if(null===Ea||Ea.index>P)break;qa=Ea;B.lastIndex=qa.index+1}null===qa?(c["~"]=y,P=-1):(d(D,"MatchData").$new(B,qa),P=qa.index)}else B=G(B,d(D,"String"),"to_str"),P=this.lastIndexOf(B,P);return-1===P?y:P},Da.$$arity=-2);a.def(J,"$rjust",Y=function(B,P){null==P&&(P=" ");B=G(B,d(D,"Integer"),"to_int");P=G(P,d(D,"String"),"to_str").$to_s();h(P["$empty?"]())&&this.$raise(d(D,"ArgumentError"),"zero width padding"); +if(h(B<=this.length))return this;B=Math.floor(B-this.length);var qa=Array(Math.floor(B/P.length)+1).join(P);return this.$$cast(qa+P.slice(0,B-qa.length)+this)},Y.$$arity=-2);a.def(J,"$rpartition",R=function(B){var P;if(B.$$is_regexp){var qa=null;for(P=a.global_multiline_regexp(B);;){var Ea=P.exec(this);if(null===Ea)break;qa=Ea;P.lastIndex=qa.index+1}null===qa?qa=-1:(d(D,"MatchData").$new(P,qa),B=qa[0],qa=qa.index)}else B=G(B,d(D,"String"),"to_str"),qa=this.lastIndexOf(B);return-1===qa?["","",this]: +[this.slice(0,qa),this.slice(qa,qa+B.length),this.slice(qa+B.length)]},R.$$arity=1);a.def(J,"$rstrip",Z=function(){return this.replace(/[\s\u0000]*$/,"")},Z.$$arity=0);a.def(J,"$scan",V=function(B){var P=V.$$p,qa=P||y;P&&(V.$$p=null);P&&(V.$$p=null);P=[];var Ea=y,Ba;B.$$is_regexp?B=a.global_multiline_regexp(B):(B=G(B,d(D,"String"),"to_str"),B=new RegExp(B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gm"));for(;null!=(Ba=B.exec(this));)Ea=d(D,"MatchData").$new(B,Ba),qa===y?1==Ba.length?P.push(Ba[0]):P.push(Ea.$captures()): +1==Ba.length?qa(Ba[0]):qa.call(this,Ea.$captures()),B.lastIndex===Ba.index&&(B.lastIndex+=1);c["~"]=Ea;return qa!==y?this:P},V.$$arity=1);a.alias(J,"size","length");a.alias(J,"slice","[]");a.def(J,"$split",fa=function(B,P){function qa(){for(ib=0;ibP){if(null!==eb&&""===eb[0]&&-1===B.source.indexOf("(?="))for(ib=0,B=eb.length;ib< +B;ib++)Ia.push("");qa();return Ia}if(null!==eb&&""===eb[0])return Ia.splice(P-1,Ia.length-1,Ia.slice(P-1).join("")),qa(),Ia;if(P>=Ia.length)return qa(),Ia;for(ib=0;null!==eb;){ib++;Wa=B.lastIndex;if(ib+1===P)break;eb=B.exec(Ba)}Ia.splice(P-1,Ia.length-1,Ba.slice(Wa));qa();return Ia},fa.$$arity=-1);a.def(J,"$squeeze",la=function(B){var P=a.slice.call(arguments,0,arguments.length);if(0===P.length)return this.$$cast(this.replace(/(.)\1+/g,"$1"));P=n(P);return null===P?this:this.$$cast(this.replace(new RegExp("("+ +P+")\\1+","g"),"$1"))},la.$$arity=-1);a.def(J,"$start_with?",k=function(B){var P=a.slice.call(arguments,0,arguments.length);for(var qa=0,Ea=P.length;qa=B?P:P&Math.pow(2,B)-1},aa.$$arity=-1);a.def(J,"$swapcase",x=function(){var B=this.replace(/([a-z]+)|([A-Z]+)/g,function(P,qa){return qa?P.toUpperCase():P.toLowerCase()});return this.constructor===String?B:this.$class().$new(B)},x.$$arity=0);a.def(J,"$to_f",W=function(){if("_"===this.charAt(0))return 0;var B=parseFloat(this.replace(/_/g,""));return isNaN(B)||Infinity==B||-Infinity==B?0:B},W.$$arity=0);a.def(J,"$to_i",oa=function(B){null==B&&(B=10);var P= +this.toLowerCase(),qa=G(B,d(D,"Integer"),"to_int");(1===qa||0>qa||36Xa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ta)+"-"+String.fromCharCode(Xa)+'" in string transliteration');for(Ta+=1;TaXa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ta)+"-"+String.fromCharCode(Xa)+'" in string transliteration');for(Ta+=1;TaXa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ta)+"-"+String.fromCharCode(Xa)+'" in string transliteration');for(Ta+=1;TaXa&&this.$raise(d(D,"ArgumentError"),'invalid range "'+String.fromCharCode(Ta)+"-"+String.fromCharCode(Xa)+'" in string transliteration');for(Ta+=1;Tan:e["$>"](n)}function F(e,n){return"number"===typeof e&&"number"===typeof n?e+n:e["$+"](n)}function p(e,n){return"number"===typeof e&&"number"===typeof n?e-n:e["$-"](n)}function t(e,n){return"number"===typeof e&&"number"===typeof n?e<=n:e["$<="](n)}var y=[],q=a.nil,d=a.$$$,G=a.$$,z=a.falsy,f=a.truthy,h=a.coerce_to,v=a.module,c=a.send,l=a.hash2,H=a.lambda;a.add_stubs("$each $public_send $destructure $to_enum $enumerator_size $new $yield $raise $slice_when $! $enum_for $flatten $map $warn $proc $== $nil? $respond_to? $coerce_to! $> $* $try_convert $< $+ $- $ceil $/ $size $select $to_proc $__send__ $length $<= $[] $push $<< $[]= $=== $inspect $<=> $first $reverse $sort $take $sort_by $compare $call $dup $to_a $sort! $map! $key? $values $transform_values $group_by $to_h $coerce_to? $class $zip".split(" ")); -return function(e,n){function J(Y){0===Y.length&&(Y=[q]);1=Y)))return q;var fa=[],la;this.$each.$$p=function(){var k=G(D,"Opal").$destructure(arguments);a.yield1(Z,k);fa.push(k)};this.$each();if(0===fa.length)return q;if(Y===q)for(;;)for(S=0,la=fa.length;SY)&&this.$raise(G(D,"ArgumentError"),"attempt to drop negative size");var S=[],Z=0;this.$each.$$p=function(){Y<=Z&&S.push(G(D,"Opal").$destructure(arguments));Z++};this.$each();return S},E.$$arity=1);a.def(e,"$drop_while",I=function(){var Y=I.$$p,S=Y||q;Y&&(I.$$p=null);Y&&(I.$$p=null);if(S===q)return this.$enum_for("drop_while");var Z=[],V=!0;this.$each.$$p=function(){var fa=G(D,"Opal").$destructure(arguments); -if(V){var la=a.yield1(S,fa);z(la)&&(V=!1,Z.push(fa))}else Z.push(fa)};this.$each();return Z},I.$$arity=0);a.def(e,"$each_cons",L=function(Y){var S=L.$$p,Z=S||q,V;S&&(L.$$p=null);S&&(L.$$p=null);f(1!=arguments.length)&&this.$raise(G(D,"ArgumentError"),"wrong number of arguments ("+arguments.length+" for 1)");Y=G(D,"Opal").$try_convert(Y,G(D,"Integer"),"to_int");f(0>=Y)&&this.$raise(G(D,"ArgumentError"),"invalid size");if(Z===q)return c(this,"enum_for",["each_cons",Y],(V=function(){var la=q;var k=(null== -V.$$s?this:V.$$s).$enumerator_size();return f(k["$nil?"]())?q:f(f(la=k["$=="](0))?la:"number"===typeof k&&"number"===typeof Y?kY&&fa.shift();fa.length==Y&&a.yield1(Z,fa.slice(0,Y))};this.$each();return q},L.$$arity=1);a.def(e,"$each_entry",ba=function(Y){var S=ba.$$p,Z=S||q,V;S&&(ba.$$p=null);S&&(ba.$$p=null);S=a.slice.call(arguments,0,arguments.length); -if(Z===q)return c(this,"to_enum",["each_entry"].concat(a.to_a(S)),(V=function(){return(null==V.$$s?this:V.$$s).$enumerator_size()},V.$$s=this,V.$$arity=0,V));this.$each.$$p=function(){var fa=G(D,"Opal").$destructure(arguments);a.yield1(Z,fa)};this.$each.apply(this,S);return this},ba.$$arity=-1);a.def(e,"$each_slice",va=function(Y){var S=va.$$p,Z=S||q,V;S&&(va.$$p=null);S&&(va.$$p=null);Y=h(Y,G(D,"Integer"),"to_int");f(0>=Y)&&this.$raise(G(D,"ArgumentError"),"invalid slice size");if(Z===q)return c(this, -"enum_for",["each_slice",Y],(V=function(){var la=null==V.$$s?this:V.$$s;return f(la["$respond_to?"]("size"))?(la=la.$size(),("number"===typeof la&&"number"===typeof Y?la/Y:la["$/"](Y)).$ceil()):q},V.$$s=this,V.$$arity=0,V));var fa=[];this.$each.$$p=function(){var la=G(D,"Opal").$destructure(arguments);fa.push(la);fa.length===Y&&(a.yield1(Z,fa),fa=[])};this.$each();0Y)&&this.$raise(G(D,"ArgumentError"),"attempt to take negative size");if(f(0==Y))return[];fa=0;c(this,"each",[],(Z=function(la){var k=a.slice.call(arguments,0,arguments.length);V.push(G(D,"Opal").$destructure(k));if(f(Y<=++fa))a.ret(V);else return q},Z.$$s=this,Z.$$arity=-1,Z));return V}catch(la){if(la===a.returner)return la.$v;throw la;}},ra.$$arity=-1);a.alias(e,"flat_map","collect_concat");a.def(e,"$grep",xa=function(Y){var S=xa.$$p,Z=S||q,V,fa=q;S&&(xa.$$p=null);S&& -(xa.$$p=null);fa=[];c(this,"each",[],(V=function(la){var k=a.slice.call(arguments,0,arguments.length);var C=J(k);if(!f(c(Y,"__send__",["==="].concat(a.to_a(C)))))return q;Z!==q?(f(w(k.$length(),1))&&(k=[k]),k=a.yieldX(Z,a.to_a(k))):f(t(k.$length(),1))&&(k=k["$[]"](0));return fa.$push(k)},V.$$s=this,V.$$arity=-1,V));return fa},xa.$$arity=1);a.def(e,"$grep_v",Ja=function(Y){var S=Ja.$$p,Z=S||q,V,fa=q;S&&(Ja.$$p=null);S&&(Ja.$$p=null);fa=[];c(this,"each",[],(V=function(la){var k=a.slice.call(arguments, -0,arguments.length);var C=J(k);if(f(c(Y,"__send__",["==="].concat(a.to_a(C)))))return q;Z!==q?(f(w(k.$length(),1))&&(k=[k]),k=a.yieldX(Z,a.to_a(k))):f(t(k.$length(),1))&&(k=k["$[]"](0));return fa.$push(k)},V.$$s=this,V.$$arity=-1,V));return fa},Ja.$$arity=1);a.def(e,"$group_by",ka=function(){var Y=ka.$$p,S=Y||q,Z,V=q,fa=q,la=q;Y&&(ka.$$p=null);Y&&(ka.$$p=null);if(S===q)return c(this,"enum_for",["group_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z)); -V=l([],{});this.$each.$$p=function(){var k=G(D,"Opal").$destructure(arguments),C=a.yield1(S,k);f(fa=V["$[]"](C))?C=fa:(la=[C,[]],c(V,"[]=",a.to_a(la)),C=la[p(la.length,1)]);C["$<<"](k)};this.$each();return V},ka.$$arity=0);a.def(e,"$include?",N=function(Y){try{var S;c(this,"each",[],(S=function(Z){var V=a.slice.call(arguments,0,arguments.length);if(G(D,"Opal").$destructure(V)["$=="](Y))a.ret(!0);else return q},S.$$s=this,S.$$arity=-1,S));return!1}catch(Z){if(Z===a.returner)return Z.$v;throw Z;}}, -N.$$arity=1);a.def(e,"$inject",M=function(Y,S){var Z=M.$$p,V=Z||q;Z&&(M.$$p=null);Z&&(M.$$p=null);var fa=Y;V!==q&&void 0===S?this.$each.$$p=function(){var la=G(D,"Opal").$destructure(arguments);void 0!==fa&&(la=a.yieldX(V,[fa,la]));fa=la}:(void 0===S&&(G(D,"Symbol")["$==="](Y)||this.$raise(G(D,"TypeError"),""+Y.$inspect()+" is not a Symbol"),S=Y,fa=void 0),this.$each.$$p=function(){var la=G(D,"Opal").$destructure(arguments);fa=void 0===fa?la:fa.$__send__(S,la)});this.$each();return void 0==fa?q:fa}, -M.$$arity=-1);a.def(e,"$lazy",ja=function(){var Y;return c(d(G(D,"Enumerator"),"Lazy"),"new",[this,this.$enumerator_size()],(Y=function(S,Z){null==S&&(S=q);var V=a.slice.call(arguments,1,arguments.length);return c(S,"yield",a.to_a(V))},Y.$$s=this,Y.$$arity=-2,Y))},ja.$$arity=0);a.def(e,"$enumerator_size",sa=function(){return f(this["$respond_to?"]("size"))?this.$size():q},sa.$$arity=0);a.alias(e,"map","collect");a.def(e,"$max",ea=function(Y){var S=ea.$$p,Z=S||q,V=this;S&&(ea.$$p=null);S&&(ea.$$p= -null);if(void 0===Y||Y===q){var fa,la;V.$each.$$p=function(){var k=G(D,"Opal").$destructure(arguments);void 0===fa?fa=k:(la=Z!==q?a.yieldX(Z,[k,fa]):k["$<=>"](fa),la===q&&V.$raise(G(D,"ArgumentError"),"comparison failed"),0"](la)&&(fa=k,la=C)};this.$each();return void 0===fa?q:fa},ua.$$arity=-1);a.alias(e,"member?","include?");a.def(e,"$min",Da=function(Y){var S=Da.$$p,Z=S||q,V,fa=this;S&&(Da.$$p= -null);S&&(Da.$$p=null);null==Y&&(Y=q);if(!f(Y["$nil?"]()))return Z!==q?c(fa,"sort",[],(V=function(k,C){null==k&&(k=q);null==C&&(C=q);return a.yieldX(Z,[k,C])},V.$$s=fa,V.$$arity=2,V)).$take(Y):fa.$sort().$take(Y);var la;fa.$each.$$p=Z!==q?function(){var k=G(D,"Opal").$destructure(arguments);if(void 0===la)la=k;else{var C=Z(k,la);C===q&&fa.$raise(G(D,"ArgumentError"),"comparison failed");0>C&&(la=k)}}:function(){var k=G(D,"Opal").$destructure(arguments);void 0===la?la=k:0>G(D,"Opal").$compare(k,la)&& -(la=k)};fa.$each();return void 0===la?q:la},Da.$$arity=-1);a.def(e,"$min_by",Ga=function(Y){var S=Ga.$$p,Z=S||q,V;S&&(Ga.$$p=null);S&&(Ga.$$p=null);null==Y&&(Y=q);if(!f(Z))return c(this,"enum_for",["min_by",Y],(V=function(){return(null==V.$$s?this:V.$$s).$enumerator_size()},V.$$s=this,V.$$arity=0,V));if(!f(Y["$nil?"]()))return c(this,"sort_by",[],Z.$to_proc()).$take(Y);var fa,la;this.$each.$$p=function(){var k=G(D,"Opal").$destructure(arguments),C=a.yield1(Z,k);void 0===fa?(fa=k,la=C):0>C["$<=>"](la)&& -(fa=k,la=C)};this.$each();return void 0===fa?q:fa},Ga.$$arity=-1);a.def(e,"$minmax",Ra=function(){var Y=Ra.$$p,S=Y||q,Z,V=this,fa=q;Y&&(Ra.$$p=null);Y&&(Ra.$$p=null);S=function(){return f(fa=S)?fa:c(V,"proc",[],(Z=function(O,aa){null==O&&(O=q);null==aa&&(aa=q);return O["$<=>"](aa)},Z.$$s=V,Z.$$arity=2,Z))}();var la=q,k=q,C=!0;V.$each.$$p=function(){var O=G(D,"Opal").$destructure(arguments);if(C)la=k=O,C=!1;else{var aa=S.$call(la,O);aa===q?V.$raise(G(D,"ArgumentError"),"comparison failed"):0aa&&(k=O)}};V.$each();return[la,k]},Ra.$$arity=0);a.def(e,"$minmax_by",Pa=function(){var Y=Pa.$$p,S=Y||q,Z;Y&&(Pa.$$p=null);Y&&(Pa.$$p=null);if(!f(S))return c(this,"enum_for",["minmax_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var V=q,fa=q,la,k;this.$each.$$p=function(){var C=G(D,"Opal").$destructure(arguments),O=a.yield1(S,C);if(void 0===la||0>O["$<=>"](la))V=C,la= -O;if(void 0===k||0"](k))fa=C,k=O};this.$each();return[V,fa]},Pa.$$arity=0);a.def(e,"$none?",Ha=function(Y){try{var S=Ha.$$p,Z=S||q,V,fa,la;S&&(Ha.$$p=null);S&&(Ha.$$p=null);f(void 0!==Y)?c(this,"each",[],(V=function(k){var C=a.slice.call(arguments,0,arguments.length);C=J(C);if(f(c(Y,"public_send",["==="].concat(a.to_a(C)))))a.ret(!1);else return q},V.$$s=this,V.$$arity=-1,V)):Z!==q?c(this,"each",[],(fa=function(k){var C=a.slice.call(arguments,0,arguments.length);if(f(a.yieldX(Z,a.to_a(C))))a.ret(!1); -else return q},fa.$$s=this,fa.$$arity=-1,fa)):c(this,"each",[],(la=function(k){var C=a.slice.call(arguments,0,arguments.length);C=G(D,"Opal").$destructure(C);if(f(C))a.ret(!1);else return q},la.$$s=this,la.$$arity=-1,la));return!0}catch(k){if(k===a.returner)return k.$v;throw k;}},Ha.$$arity=-1);a.def(e,"$one?",eb=function(Y){try{var S=eb.$$p,Z=S||q,V,fa,la,k=q;S&&(eb.$$p=null);S&&(eb.$$p=null);k=0;f(void 0!==Y)?c(this,"each",[],(V=function(C){var O=a.slice.call(arguments,0,arguments.length);O=J(O); +return function(e,n){function J(Y){0===Y.length&&(Y=[q]);1=Y)))return q;var fa=[],la;this.$each.$$p=function(){var k=G(D,"Opal").$destructure(arguments);a.yield1(Z,k);fa.push(k)};this.$each();if(0===fa.length)return q;if(Y===q)for(;;)for(R=0,la=fa.length;RY)&&this.$raise(G(D,"ArgumentError"),"attempt to drop negative size");var R=[],Z=0;this.$each.$$p=function(){Y<=Z&&R.push(G(D,"Opal").$destructure(arguments));Z++};this.$each();return R},E.$$arity=1);a.def(e,"$drop_while",I=function(){var Y=I.$$p,R=Y||q;Y&&(I.$$p=null);Y&&(I.$$p=null);if(R===q)return this.$enum_for("drop_while");var Z=[],V=!0;this.$each.$$p=function(){var fa=G(D,"Opal").$destructure(arguments); +if(V){var la=a.yield1(R,fa);z(la)&&(V=!1,Z.push(fa))}else Z.push(fa)};this.$each();return Z},I.$$arity=0);a.def(e,"$each_cons",L=function(Y){var R=L.$$p,Z=R||q,V;R&&(L.$$p=null);R&&(L.$$p=null);f(1!=arguments.length)&&this.$raise(G(D,"ArgumentError"),"wrong number of arguments ("+arguments.length+" for 1)");Y=G(D,"Opal").$try_convert(Y,G(D,"Integer"),"to_int");f(0>=Y)&&this.$raise(G(D,"ArgumentError"),"invalid size");if(Z===q)return c(this,"enum_for",["each_cons",Y],(V=function(){var la=q;var k=(null== +V.$$s?this:V.$$s).$enumerator_size();return f(k["$nil?"]())?q:f(f(la=k["$=="](0))?la:"number"===typeof k&&"number"===typeof Y?kY&&fa.shift();fa.length==Y&&a.yield1(Z,fa.slice(0,Y))};this.$each();return q},L.$$arity=1);a.def(e,"$each_entry",ba=function(Y){var R=ba.$$p,Z=R||q,V;R&&(ba.$$p=null);R&&(ba.$$p=null);R=a.slice.call(arguments,0,arguments.length); +if(Z===q)return c(this,"to_enum",["each_entry"].concat(a.to_a(R)),(V=function(){return(null==V.$$s?this:V.$$s).$enumerator_size()},V.$$s=this,V.$$arity=0,V));this.$each.$$p=function(){var fa=G(D,"Opal").$destructure(arguments);a.yield1(Z,fa)};this.$each.apply(this,R);return this},ba.$$arity=-1);a.def(e,"$each_slice",va=function(Y){var R=va.$$p,Z=R||q,V;R&&(va.$$p=null);R&&(va.$$p=null);Y=h(Y,G(D,"Integer"),"to_int");f(0>=Y)&&this.$raise(G(D,"ArgumentError"),"invalid slice size");if(Z===q)return c(this, +"enum_for",["each_slice",Y],(V=function(){var la=null==V.$$s?this:V.$$s;return f(la["$respond_to?"]("size"))?(la=la.$size(),("number"===typeof la&&"number"===typeof Y?la/Y:la["$/"](Y)).$ceil()):q},V.$$s=this,V.$$arity=0,V));var fa=[];this.$each.$$p=function(){var la=G(D,"Opal").$destructure(arguments);fa.push(la);fa.length===Y&&(a.yield1(Z,fa),fa=[])};this.$each();0Y)&&this.$raise(G(D,"ArgumentError"),"attempt to take negative size");if(f(0==Y))return[];fa=0;c(this,"each",[],(Z=function(la){var k=a.slice.call(arguments,0,arguments.length);V.push(G(D,"Opal").$destructure(k));if(f(Y<=++fa))a.ret(V);else return q},Z.$$s=this,Z.$$arity=-1,Z));return V}catch(la){if(la===a.returner)return la.$v;throw la;}},ra.$$arity=-1);a.alias(e,"flat_map","collect_concat");a.def(e,"$grep",xa=function(Y){var R=xa.$$p,Z=R||q,V,fa=q;R&&(xa.$$p=null);R&& +(xa.$$p=null);fa=[];c(this,"each",[],(V=function(la){var k=a.slice.call(arguments,0,arguments.length);var C=J(k);if(!f(c(Y,"__send__",["==="].concat(a.to_a(C)))))return q;Z!==q?(f(w(k.$length(),1))&&(k=[k]),k=a.yieldX(Z,a.to_a(k))):f(t(k.$length(),1))&&(k=k["$[]"](0));return fa.$push(k)},V.$$s=this,V.$$arity=-1,V));return fa},xa.$$arity=1);a.def(e,"$grep_v",Ja=function(Y){var R=Ja.$$p,Z=R||q,V,fa=q;R&&(Ja.$$p=null);R&&(Ja.$$p=null);fa=[];c(this,"each",[],(V=function(la){var k=a.slice.call(arguments, +0,arguments.length);var C=J(k);if(f(c(Y,"__send__",["==="].concat(a.to_a(C)))))return q;Z!==q?(f(w(k.$length(),1))&&(k=[k]),k=a.yieldX(Z,a.to_a(k))):f(t(k.$length(),1))&&(k=k["$[]"](0));return fa.$push(k)},V.$$s=this,V.$$arity=-1,V));return fa},Ja.$$arity=1);a.def(e,"$group_by",ka=function(){var Y=ka.$$p,R=Y||q,Z,V=q,fa=q,la=q;Y&&(ka.$$p=null);Y&&(ka.$$p=null);if(R===q)return c(this,"enum_for",["group_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z)); +V=l([],{});this.$each.$$p=function(){var k=G(D,"Opal").$destructure(arguments),C=a.yield1(R,k);f(fa=V["$[]"](C))?C=fa:(la=[C,[]],c(V,"[]=",a.to_a(la)),C=la[p(la.length,1)]);C["$<<"](k)};this.$each();return V},ka.$$arity=0);a.def(e,"$include?",N=function(Y){try{var R;c(this,"each",[],(R=function(Z){var V=a.slice.call(arguments,0,arguments.length);if(G(D,"Opal").$destructure(V)["$=="](Y))a.ret(!0);else return q},R.$$s=this,R.$$arity=-1,R));return!1}catch(Z){if(Z===a.returner)return Z.$v;throw Z;}}, +N.$$arity=1);a.def(e,"$inject",M=function(Y,R){var Z=M.$$p,V=Z||q;Z&&(M.$$p=null);Z&&(M.$$p=null);var fa=Y;V!==q&&void 0===R?this.$each.$$p=function(){var la=G(D,"Opal").$destructure(arguments);void 0!==fa&&(la=a.yieldX(V,[fa,la]));fa=la}:(void 0===R&&(G(D,"Symbol")["$==="](Y)||this.$raise(G(D,"TypeError"),""+Y.$inspect()+" is not a Symbol"),R=Y,fa=void 0),this.$each.$$p=function(){var la=G(D,"Opal").$destructure(arguments);fa=void 0===fa?la:fa.$__send__(R,la)});this.$each();return void 0==fa?q:fa}, +M.$$arity=-1);a.def(e,"$lazy",ja=function(){var Y;return c(d(G(D,"Enumerator"),"Lazy"),"new",[this,this.$enumerator_size()],(Y=function(R,Z){null==R&&(R=q);var V=a.slice.call(arguments,1,arguments.length);return c(R,"yield",a.to_a(V))},Y.$$s=this,Y.$$arity=-2,Y))},ja.$$arity=0);a.def(e,"$enumerator_size",sa=function(){return f(this["$respond_to?"]("size"))?this.$size():q},sa.$$arity=0);a.alias(e,"map","collect");a.def(e,"$max",ea=function(Y){var R=ea.$$p,Z=R||q,V=this;R&&(ea.$$p=null);R&&(ea.$$p= +null);if(void 0===Y||Y===q){var fa,la;V.$each.$$p=function(){var k=G(D,"Opal").$destructure(arguments);void 0===fa?fa=k:(la=Z!==q?a.yieldX(Z,[k,fa]):k["$<=>"](fa),la===q&&V.$raise(G(D,"ArgumentError"),"comparison failed"),0"](la)&&(fa=k,la=C)};this.$each();return void 0===fa?q:fa},ua.$$arity=-1);a.alias(e,"member?","include?");a.def(e,"$min",Fa=function(Y){var R=Fa.$$p,Z=R||q,V,fa=this;R&&(Fa.$$p= +null);R&&(Fa.$$p=null);null==Y&&(Y=q);if(!f(Y["$nil?"]()))return Z!==q?c(fa,"sort",[],(V=function(k,C){null==k&&(k=q);null==C&&(C=q);return a.yieldX(Z,[k,C])},V.$$s=fa,V.$$arity=2,V)).$take(Y):fa.$sort().$take(Y);var la;fa.$each.$$p=Z!==q?function(){var k=G(D,"Opal").$destructure(arguments);if(void 0===la)la=k;else{var C=Z(k,la);C===q&&fa.$raise(G(D,"ArgumentError"),"comparison failed");0>C&&(la=k)}}:function(){var k=G(D,"Opal").$destructure(arguments);void 0===la?la=k:0>G(D,"Opal").$compare(k,la)&& +(la=k)};fa.$each();return void 0===la?q:la},Fa.$$arity=-1);a.def(e,"$min_by",Ga=function(Y){var R=Ga.$$p,Z=R||q,V;R&&(Ga.$$p=null);R&&(Ga.$$p=null);null==Y&&(Y=q);if(!f(Z))return c(this,"enum_for",["min_by",Y],(V=function(){return(null==V.$$s?this:V.$$s).$enumerator_size()},V.$$s=this,V.$$arity=0,V));if(!f(Y["$nil?"]()))return c(this,"sort_by",[],Z.$to_proc()).$take(Y);var fa,la;this.$each.$$p=function(){var k=G(D,"Opal").$destructure(arguments),C=a.yield1(Z,k);void 0===fa?(fa=k,la=C):0>C["$<=>"](la)&& +(fa=k,la=C)};this.$each();return void 0===fa?q:fa},Ga.$$arity=-1);a.def(e,"$minmax",Ra=function(){var Y=Ra.$$p,R=Y||q,Z,V=this,fa=q;Y&&(Ra.$$p=null);Y&&(Ra.$$p=null);R=function(){return f(fa=R)?fa:c(V,"proc",[],(Z=function(O,aa){null==O&&(O=q);null==aa&&(aa=q);return O["$<=>"](aa)},Z.$$s=V,Z.$$arity=2,Z))}();var la=q,k=q,C=!0;V.$each.$$p=function(){var O=G(D,"Opal").$destructure(arguments);if(C)la=k=O,C=!1;else{var aa=R.$call(la,O);aa===q?V.$raise(G(D,"ArgumentError"),"comparison failed"):0aa&&(k=O)}};V.$each();return[la,k]},Ra.$$arity=0);a.def(e,"$minmax_by",Pa=function(){var Y=Pa.$$p,R=Y||q,Z;Y&&(Pa.$$p=null);Y&&(Pa.$$p=null);if(!f(R))return c(this,"enum_for",["minmax_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var V=q,fa=q,la,k;this.$each.$$p=function(){var C=G(D,"Opal").$destructure(arguments),O=a.yield1(R,C);if(void 0===la||0>O["$<=>"](la))V=C,la= +O;if(void 0===k||0"](k))fa=C,k=O};this.$each();return[V,fa]},Pa.$$arity=0);a.def(e,"$none?",Ha=function(Y){try{var R=Ha.$$p,Z=R||q,V,fa,la;R&&(Ha.$$p=null);R&&(Ha.$$p=null);f(void 0!==Y)?c(this,"each",[],(V=function(k){var C=a.slice.call(arguments,0,arguments.length);C=J(C);if(f(c(Y,"public_send",["==="].concat(a.to_a(C)))))a.ret(!1);else return q},V.$$s=this,V.$$arity=-1,V)):Z!==q?c(this,"each",[],(fa=function(k){var C=a.slice.call(arguments,0,arguments.length);if(f(a.yieldX(Z,a.to_a(C))))a.ret(!1); +else return q},fa.$$s=this,fa.$$arity=-1,fa)):c(this,"each",[],(la=function(k){var C=a.slice.call(arguments,0,arguments.length);C=G(D,"Opal").$destructure(C);if(f(C))a.ret(!1);else return q},la.$$s=this,la.$$arity=-1,la));return!0}catch(k){if(k===a.returner)return k.$v;throw k;}},Ha.$$arity=-1);a.def(e,"$one?",fb=function(Y){try{var R=fb.$$p,Z=R||q,V,fa,la,k=q;R&&(fb.$$p=null);R&&(fb.$$p=null);k=0;f(void 0!==Y)?c(this,"each",[],(V=function(C){var O=a.slice.call(arguments,0,arguments.length);O=J(O); if(f(c(Y,"public_send",["==="].concat(a.to_a(O)))))if(k=F(k,1),f(w(k,1)))a.ret(!1);else return q;else return q},V.$$s=this,V.$$arity=-1,V)):Z!==q?c(this,"each",[],(fa=function(C){var O=a.slice.call(arguments,0,arguments.length);if(!f(a.yieldX(Z,a.to_a(O))))return q;k=F(k,1);if(f(w(k,1)))a.ret(!1);else return q},fa.$$s=this,fa.$$arity=-1,fa)):c(this,"each",[],(la=function(C){var O=a.slice.call(arguments,0,arguments.length);if(!f(G(D,"Opal").$destructure(O)))return q;k=F(k,1);if(f(w(k,1)))a.ret(!1); -else return q},la.$$s=this,la.$$arity=-1,la));return k["$=="](1)}catch(C){if(C===a.returner)return C.$v;throw C;}},eb.$$arity=-1);a.def(e,"$partition",kb=function(){var Y=kb.$$p,S=Y||q,Z;Y&&(kb.$$p=null);Y&&(kb.$$p=null);if(S===q)return c(this,"enum_for",["partition"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var V=[],fa=[];this.$each.$$p=function(){var la=G(D,"Opal").$destructure(arguments),k=a.yield1(S,la);f(k)?V.push(la):fa.push(la)};this.$each(); -return[V,fa]},kb.$$arity=0);a.alias(e,"reduce","inject");a.def(e,"$reject",R=function(){var Y=R.$$p,S=Y||q,Z;Y&&(R.$$p=null);Y&&(R.$$p=null);if(S===q)return c(this,"enum_for",["reject"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var V=[];this.$each.$$p=function(){var fa=G(D,"Opal").$destructure(arguments),la=a.yield1(S,fa);z(la)&&V.push(fa)};this.$each();return V},R.$$arity=0);a.def(e,"$reverse_each",ya=function(){var Y=ya.$$p,S=Y||q,Z;Y&&(ya.$$p=null); -Y&&(ya.$$p=null);if(S===q)return c(this,"enum_for",["reverse_each"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var V=[];this.$each.$$p=function(){V.push(arguments)};this.$each();for(Y=V.length-1;0<=Y;Y--)a.yieldX(S,V[Y]);return V},ya.$$arity=0);a.alias(e,"select","find_all");a.def(e,"$slice_before",Ca=function(Y){var S=Ca.$$p,Z=S||q,V;S&&(Ca.$$p=null);S&&(Ca.$$p=null);f(void 0===Y&&Z===q)&&this.$raise(G(D,"ArgumentError"),"both pattern and block are given"); +else return q},la.$$s=this,la.$$arity=-1,la));return k["$=="](1)}catch(C){if(C===a.returner)return C.$v;throw C;}},fb.$$arity=-1);a.def(e,"$partition",kb=function(){var Y=kb.$$p,R=Y||q,Z;Y&&(kb.$$p=null);Y&&(kb.$$p=null);if(R===q)return c(this,"enum_for",["partition"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var V=[],fa=[];this.$each.$$p=function(){var la=G(D,"Opal").$destructure(arguments),k=a.yield1(R,la);f(k)?V.push(la):fa.push(la)};this.$each(); +return[V,fa]},kb.$$arity=0);a.alias(e,"reduce","inject");a.def(e,"$reject",S=function(){var Y=S.$$p,R=Y||q,Z;Y&&(S.$$p=null);Y&&(S.$$p=null);if(R===q)return c(this,"enum_for",["reject"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var V=[];this.$each.$$p=function(){var fa=G(D,"Opal").$destructure(arguments),la=a.yield1(R,fa);z(la)&&V.push(fa)};this.$each();return V},S.$$arity=0);a.def(e,"$reverse_each",ya=function(){var Y=ya.$$p,R=Y||q,Z;Y&&(ya.$$p=null); +Y&&(ya.$$p=null);if(R===q)return c(this,"enum_for",["reverse_each"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()},Z.$$s=this,Z.$$arity=0,Z));var V=[];this.$each.$$p=function(){V.push(arguments)};this.$each();for(Y=V.length-1;0<=Y;Y--)a.yieldX(R,V[Y]);return V},ya.$$arity=0);a.alias(e,"select","find_all");a.def(e,"$slice_before",Ca=function(Y){var R=Ca.$$p,Z=R||q,V;R&&(Ca.$$p=null);R&&(Ca.$$p=null);f(void 0===Y&&Z===q)&&this.$raise(G(D,"ArgumentError"),"both pattern and block are given"); f(void 0!==Y&&Z!==q||1"](la)},Z.$$s=this,Z.$$arity=2,Z)));return c(V,"sort",[],S.$to_proc())},cb.$$arity=0);a.def(e,"$sort_by",ab=function(){var Y=ab.$$p,S=Y||q,Z,V,fa,la,k=q;Y&&(ab.$$p=null);Y&&(ab.$$p=null);if(S===q)return c(this,"enum_for",["sort_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()}, -Z.$$s=this,Z.$$arity=0,Z));k=c(this,"map",[],(V=function(){var C=G(D,"Opal").$destructure(arguments);return[a.yield1(S,C),C]},V.$$s=this,V.$$arity=0,V));c(k,"sort!",[],(fa=function(C,O){null==C&&(C=q);null==O&&(O=q);return C[0]["$<=>"](O[0])},fa.$$s=this,fa.$$arity=2,fa));return c(k,"map!",[],(la=function(C){null==C&&(C=q);return C[1]},la.$$s=this,la.$$arity=1,la))},ab.$$arity=0);a.def(e,"$sum",Xa=function(Y){var S,Z=Xa.$$p,V=Z||q,fa=q;Z&&(Xa.$$p=null);null==Y&&(Y=0);fa=Y;c(this,"each",[],(S=function(la){var k= -a.slice.call(arguments,0,arguments.length);k=V!==q?a.yieldX(V,a.to_a(k)):G(D,"Opal").$destructure(k);return fa=F(fa,k)},S.$$s=this,S.$$arity=-1,S));return fa},Xa.$$arity=-1);a.def(e,"$take",za=function(Y){return this.$first(Y)},za.$$arity=1);a.def(e,"$take_while",ta=function(){try{var Y=ta.$$p,S=Y||q,Z,V=q;Y&&(ta.$$p=null);Y&&(ta.$$p=null);if(!f(S))return this.$enum_for("take_while");V=[];return c(this,"each",[],(Z=function(fa){var la=a.slice.call(arguments,0,arguments.length);la=G(D,"Opal").$destructure(la); -f(a.yield1(S,la))||a.ret(V);return V.push(la)},Z.$$s=this,Z.$$arity=-1,Z))}catch(fa){if(fa===a.returner)return fa.$v;throw fa;}},ta.$$arity=0);a.def(e,"$uniq",Ma=function(){var Y=Ma.$$p,S=Y||q,Z,V=q;Y&&(Ma.$$p=null);Y&&(Ma.$$p=null);V=l([],{});c(this,"each",[],(Z=function(fa){var la=a.slice.call(arguments,0,arguments.length);la=G(D,"Opal").$destructure(la);var k=S!==q?a.yield1(S,la):la;if(f(V["$key?"](k)))return q;la=[k,la];c(V,"[]=",a.to_a(la));return la[p(la.length,1)]},Z.$$s=this,Z.$$arity=-1, -Z));return V.$values()},Ma.$$arity=0);a.def(e,"$tally",Sa=function(){return c(c(this,"group_by",[],"itself".$to_proc()),"transform_values",[],"count".$to_proc())},Sa.$$arity=0);a.alias(e,"to_a","entries");a.def(e,"$to_h",Za=function(Y){var S=Za.$$p,Z=S||q,V=this;S&&(Za.$$p=null);S&&(Za.$$p=null);S=a.slice.call(arguments,0,arguments.length);if(Z!==q)return c(c(V,"map",[],Z.$to_proc()),"to_h",a.to_a(S));var fa=l([],{});V.$each.$$p=function(){var la=G(D,"Opal").$destructure(arguments);la=G(D,"Opal")["$coerce_to?"](la, -G(D,"Array"),"to_ary");la.$$is_array||V.$raise(G(D,"TypeError"),"wrong element type "+la.$class()+" (expected array)");2!==la.length&&V.$raise(G(D,"ArgumentError"),"wrong array length (expected 2, was "+la.$length()+")");a.hash_put(fa,la[0],la[1])};V.$each.apply(V,S);return fa},Za.$$arity=-1);a.def(e,"$zip",Ea=function(Y){var S=Ea.$$p;S&&(Ea.$$p=null);S&&(Ea.$$p=null);S=a.slice.call(arguments,0,arguments.length);return c(this.$to_a(),"zip",a.to_a(S))},Ea.$$arity=-1)}(y[0],y)}; +k.push(C)}:function(){var C=G(D,"Opal").$destructure(arguments),O=Y["$==="](C);f(O)&&0"](la)},Z.$$s=this,Z.$$arity=2,Z)));return c(V,"sort",[],R.$to_proc())},db.$$arity=0);a.def(e,"$sort_by",ab=function(){var Y=ab.$$p,R=Y||q,Z,V,fa,la,k=q;Y&&(ab.$$p=null);Y&&(ab.$$p=null);if(R===q)return c(this,"enum_for",["sort_by"],(Z=function(){return(null==Z.$$s?this:Z.$$s).$enumerator_size()}, +Z.$$s=this,Z.$$arity=0,Z));k=c(this,"map",[],(V=function(){var C=G(D,"Opal").$destructure(arguments);return[a.yield1(R,C),C]},V.$$s=this,V.$$arity=0,V));c(k,"sort!",[],(fa=function(C,O){null==C&&(C=q);null==O&&(O=q);return C[0]["$<=>"](O[0])},fa.$$s=this,fa.$$arity=2,fa));return c(k,"map!",[],(la=function(C){null==C&&(C=q);return C[1]},la.$$s=this,la.$$arity=1,la))},ab.$$arity=0);a.def(e,"$sum",Ya=function(Y){var R,Z=Ya.$$p,V=Z||q,fa=q;Z&&(Ya.$$p=null);null==Y&&(Y=0);fa=Y;c(this,"each",[],(R=function(la){var k= +a.slice.call(arguments,0,arguments.length);k=V!==q?a.yieldX(V,a.to_a(k)):G(D,"Opal").$destructure(k);return fa=F(fa,k)},R.$$s=this,R.$$arity=-1,R));return fa},Ya.$$arity=-1);a.def(e,"$take",za=function(Y){return this.$first(Y)},za.$$arity=1);a.def(e,"$take_while",ta=function(){try{var Y=ta.$$p,R=Y||q,Z,V=q;Y&&(ta.$$p=null);Y&&(ta.$$p=null);if(!f(R))return this.$enum_for("take_while");V=[];return c(this,"each",[],(Z=function(fa){var la=a.slice.call(arguments,0,arguments.length);la=G(D,"Opal").$destructure(la); +f(a.yield1(R,la))||a.ret(V);return V.push(la)},Z.$$s=this,Z.$$arity=-1,Z))}catch(fa){if(fa===a.returner)return fa.$v;throw fa;}},ta.$$arity=0);a.def(e,"$uniq",Ma=function(){var Y=Ma.$$p,R=Y||q,Z,V=q;Y&&(Ma.$$p=null);Y&&(Ma.$$p=null);V=l([],{});c(this,"each",[],(Z=function(fa){var la=a.slice.call(arguments,0,arguments.length);la=G(D,"Opal").$destructure(la);var k=R!==q?a.yield1(R,la):la;if(f(V["$key?"](k)))return q;la=[k,la];c(V,"[]=",a.to_a(la));return la[p(la.length,1)]},Z.$$s=this,Z.$$arity=-1, +Z));return V.$values()},Ma.$$arity=0);a.def(e,"$tally",Sa=function(){return c(c(this,"group_by",[],"itself".$to_proc()),"transform_values",[],"count".$to_proc())},Sa.$$arity=0);a.alias(e,"to_a","entries");a.def(e,"$to_h",Za=function(Y){var R=Za.$$p,Z=R||q,V=this;R&&(Za.$$p=null);R&&(Za.$$p=null);R=a.slice.call(arguments,0,arguments.length);if(Z!==q)return c(c(V,"map",[],Z.$to_proc()),"to_h",a.to_a(R));var fa=l([],{});V.$each.$$p=function(){var la=G(D,"Opal").$destructure(arguments);la=G(D,"Opal")["$coerce_to?"](la, +G(D,"Array"),"to_ary");la.$$is_array||V.$raise(G(D,"TypeError"),"wrong element type "+la.$class()+" (expected array)");2!==la.length&&V.$raise(G(D,"ArgumentError"),"wrong array length (expected 2, was "+la.$length()+")");a.hash_put(fa,la[0],la[1])};V.$each.apply(V,R);return fa},Za.$$arity=-1);a.def(e,"$zip",Da=function(Y){var R=Da.$$p;R&&(Da.$$p=null);R&&(Da.$$p=null);R=a.slice.call(arguments,0,arguments.length);return c(this.$to_a(),"zip",a.to_a(R))},Da.$$arity=-1)}(y[0],y)}; Opal.modules["corelib/enumerator"]=function(a){function w(H,e){return"number"===typeof H&&"number"===typeof e?H+e:H["$+"](e)}function F(H,e){return"number"===typeof H&&"number"===typeof e?H")},m.$$arity=0);(function(g,$super,A){g=v(g,$super,"Generator");var E=[g].concat(A),I,L;g.$$prototype.block=y;g.$include(q(E,"Enumerable"));a.def(g,"$initialize",I=function(){var ba=I.$$p,va=ba||y;ba&&(I.$$p=null);ba&&(I.$$p=null);f(va)||this.$raise(q(E,"LocalJumpError"),"no block given");return this.block=va},I.$$arity=0);return(a.def(g,"$each",L=function(ba){var va=L.$$p, Oa=va||y;va&&(L.$$p=null);va&&(L.$$p=null);va=a.slice.call(arguments,0,arguments.length);Oa=c(q(E,"Yielder"),"new",[],Oa.$to_proc());try{va.unshift(Oa),a.yieldX(this.block,va)}catch(wa){if(wa===d)return d.$v;throw wa;}return this},L.$$arity=-1),y)&&"each"})(J[0],null,J);(function(g,$super,A){g=v(g,$super,"Yielder");[g].concat(A);var E,I,L;g.$$prototype.block=y;a.def(g,"$initialize",E=function(){var ba=E.$$p,va=ba||y;ba&&(E.$$p=null);ba&&(E.$$p=null);return this.block=va},E.$$arity=0);a.def(g,"$yield", I=function(ba){var va=a.slice.call(arguments,0,arguments.length);va=a.yieldX(this.block,va);if(va===d)throw d;return va},I.$$arity=-1);return(a.def(g,"$<<",L=function(ba){var va=a.slice.call(arguments,0,arguments.length);c(this,"yield",a.to_a(va));return this},L.$$arity=-1),y)&&"<<"})(J[0],null,J);(function(g,$super,A){g=v(g,$super,"Lazy");var E=[g].concat(A),I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja;g.$$prototype.enumerator=y;(function(ka,$super,M){[v(ka,$super,"StopLazyError")].concat(M);return y})(E[0], -q(E,"Exception"),E);a.def(g,"$initialize",I=function(ka,N){var M=I.$$p,ja=M||y,sa;M&&(I.$$p=null);M&&(I.$$p=null);null==N&&(N=y);ja===y&&this.$raise(q(E,"ArgumentError"),"tried to call lazy new without a block");this.enumerator=ka;return l(this,a.find_super_dispatcher(this,"initialize",I,!1,!0),"initialize",[N],(sa=function(ea,ua){var Da=null==sa.$$s?this:sa.$$s,Ga;null==ea&&(ea=y);var Ra=a.slice.call(arguments,1,arguments.length);try{return c(ka,"each",a.to_a(Ra),(Ga=function(Pa){var Ha=a.slice.call(arguments, -0,arguments.length);Ha.unshift(ea);a.yieldX(ja,Ha)},Ga.$$s=Da,Ga.$$arity=-1,Ga))}catch(Pa){if(a.rescue(Pa,[q(E,"Exception")]))try{return y}finally{a.pop_exception()}else throw Pa;}},sa.$$s=this,sa.$$arity=-2,sa))},I.$$arity=-2);a.alias(g,"force","to_a");a.def(g,"$lazy",L=function(){return this},L.$$arity=0);a.def(g,"$collect",ba=function(){var ka=ba.$$p,N=ka||y,M;ka&&(ba.$$p=null);ka&&(ba.$$p=null);f(N)||this.$raise(q(E,"ArgumentError"),"tried to call lazy map without a block");return c(q(E,"Lazy"), -"new",[this,this.$enumerator_size()],(M=function(ja,sa){null==ja&&(ja=y);var ea=a.slice.call(arguments,1,arguments.length);ea=a.yieldX(N,ea);ja.$yield(ea)},M.$$s=this,M.$$arity=-2,M))},ba.$$arity=0);a.def(g,"$collect_concat",va=function(){var ka=va.$$p,N=ka||y,M;ka&&(va.$$p=null);ka&&(va.$$p=null);f(N)||this.$raise(q(E,"ArgumentError"),"tried to call lazy map without a block");return c(q(E,"Lazy"),"new",[this,y],(M=function(ja,sa){var ea=null==M.$$s?this:M.$$s,ua,Da;null==ja&&(ja=y);var Ga=a.slice.call(arguments, -1,arguments.length);Ga=a.yieldX(N,Ga);Ga["$respond_to?"]("force")&&Ga["$respond_to?"]("each")?c(Ga,"each",[],(ua=function(Ra){null==Ra&&(Ra=y);return ja.$yield(Ra)},ua.$$s=ea,ua.$$arity=1,ua)):q(E,"Opal").$try_convert(Ga,q(E,"Array"),"to_ary")===y?ja.$yield(Ga):c(Ga,"each",[],(Da=function(Ra){null==Ra&&(Ra=y);return ja.$yield(Ra)},Da.$$s=ea,Da.$$arity=1,Da))},M.$$s=this,M.$$arity=-2,M))},va.$$arity=0);a.def(g,"$drop",Oa=function(ka){var N,M=y,ja=M=y;ka=h(ka,q(E,"Integer"),"to_int");f(F(ka,0))&&this.$raise(q(E, +q(E,"Exception"),E);a.def(g,"$initialize",I=function(ka,N){var M=I.$$p,ja=M||y,sa;M&&(I.$$p=null);M&&(I.$$p=null);null==N&&(N=y);ja===y&&this.$raise(q(E,"ArgumentError"),"tried to call lazy new without a block");this.enumerator=ka;return l(this,a.find_super_dispatcher(this,"initialize",I,!1,!0),"initialize",[N],(sa=function(ea,ua){var Fa=null==sa.$$s?this:sa.$$s,Ga;null==ea&&(ea=y);var Ra=a.slice.call(arguments,1,arguments.length);try{return c(ka,"each",a.to_a(Ra),(Ga=function(Pa){var Ha=a.slice.call(arguments, +0,arguments.length);Ha.unshift(ea);a.yieldX(ja,Ha)},Ga.$$s=Fa,Ga.$$arity=-1,Ga))}catch(Pa){if(a.rescue(Pa,[q(E,"Exception")]))try{return y}finally{a.pop_exception()}else throw Pa;}},sa.$$s=this,sa.$$arity=-2,sa))},I.$$arity=-2);a.alias(g,"force","to_a");a.def(g,"$lazy",L=function(){return this},L.$$arity=0);a.def(g,"$collect",ba=function(){var ka=ba.$$p,N=ka||y,M;ka&&(ba.$$p=null);ka&&(ba.$$p=null);f(N)||this.$raise(q(E,"ArgumentError"),"tried to call lazy map without a block");return c(q(E,"Lazy"), +"new",[this,this.$enumerator_size()],(M=function(ja,sa){null==ja&&(ja=y);var ea=a.slice.call(arguments,1,arguments.length);ea=a.yieldX(N,ea);ja.$yield(ea)},M.$$s=this,M.$$arity=-2,M))},ba.$$arity=0);a.def(g,"$collect_concat",va=function(){var ka=va.$$p,N=ka||y,M;ka&&(va.$$p=null);ka&&(va.$$p=null);f(N)||this.$raise(q(E,"ArgumentError"),"tried to call lazy map without a block");return c(q(E,"Lazy"),"new",[this,y],(M=function(ja,sa){var ea=null==M.$$s?this:M.$$s,ua,Fa;null==ja&&(ja=y);var Ga=a.slice.call(arguments, +1,arguments.length);Ga=a.yieldX(N,Ga);Ga["$respond_to?"]("force")&&Ga["$respond_to?"]("each")?c(Ga,"each",[],(ua=function(Ra){null==Ra&&(Ra=y);return ja.$yield(Ra)},ua.$$s=ea,ua.$$arity=1,ua)):q(E,"Opal").$try_convert(Ga,q(E,"Array"),"to_ary")===y?ja.$yield(Ga):c(Ga,"each",[],(Fa=function(Ra){null==Ra&&(Ra=y);return ja.$yield(Ra)},Fa.$$s=ea,Fa.$$arity=1,Fa))},M.$$s=this,M.$$arity=-2,M))},va.$$arity=0);a.def(g,"$drop",Oa=function(ka){var N,M=y,ja=M=y;ka=h(ka,q(E,"Integer"),"to_int");f(F(ka,0))&&this.$raise(q(E, "ArgumentError"),"attempt to drop negative size");M=this.$enumerator_size();M=f(q(E,"Integer")["$==="](M))?f(F(ka,M))?ka:M:M;ja=0;return c(q(E,"Lazy"),"new",[this,M],(N=function(sa,ea){null==sa&&(sa=y);var ua=a.slice.call(arguments,1,arguments.length);return f(F(ja,ka))?ja=w(ja,1):c(sa,"yield",a.to_a(ua))},N.$$s=this,N.$$arity=-2,N))},Oa.$$arity=1);a.def(g,"$drop_while",wa=function(){var ka=wa.$$p,N=ka||y,M,ja=y;ka&&(wa.$$p=null);ka&&(wa.$$p=null);f(N)||this.$raise(q(E,"ArgumentError"),"tried to call lazy drop_while without a block"); -ja=!0;return c(q(E,"Lazy"),"new",[this,y],(M=function(sa,ea){null==sa&&(sa=y);var ua=a.slice.call(arguments,1,arguments.length);if(f(ja)){var Da=a.yieldX(N,ua);z(Da)&&(ja=!1,c(sa,"yield",a.to_a(ua)))}else return c(sa,"yield",a.to_a(ua))},M.$$s=this,M.$$arity=-2,M))},wa.$$arity=0);a.def(g,"$enum_for",Aa=function(ka,N){var M=Aa.$$p,ja=M||y;M&&(Aa.$$p=null);M&&(Aa.$$p=null);M=a.slice.call(arguments,0,arguments.length);if(0"},Ja.$$arity=0),y)&&"inspect"})(J[0],H,J);return function(g,$super,A){[v(g,$super,"ArithmeticSequence")].concat(A);return y}(J[0],H,J)}(t[0],null,t)}; Opal.modules["corelib/numeric"]=function(a){function w(c,l){return"number"===typeof c&&"number"===typeof l?c-l:c["$-"](l)}function F(c,l){return"number"===typeof c&&"number"===typeof l?c*l:c["$*"](l)}function p(c,l){return"number"===typeof c&&"number"===typeof l?c".split(" ")); -y.$require("corelib/comparable");return function(c,$super,H){c=f(c,$super,"Numeric");var e=[c].concat(H),n,J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Da,Ga,Ra,Pa;c.$include(z(e,"Comparable"));a.def(c,"$coerce",n=function(Ha){return h(Ha["$instance_of?"](this.$class()))?[Ha,this]:[this.$Float(Ha),this.$Float(this)]},n.$$arity=1);a.def(c,"$__coerced__",J=function(Ha,eb){if(h(eb["$respond_to?"]("coerce"))){eb=eb.$coerce(this);var kb=a.to_ary(eb);var R=null==kb[0]? -d:kb[0];kb=null==kb[1]?d:kb[1];eb;return R.$__send__(Ha,kb)}return"+"["$==="](Ha)||"-"["$==="](Ha)||"*"["$==="](Ha)||"/"["$==="](Ha)||"%"["$==="](Ha)||"&"["$==="](Ha)||"|"["$==="](Ha)||"^"["$==="](Ha)||"**"["$==="](Ha)?this.$raise(z(e,"TypeError"),""+eb.$class()+" can't be coerced into Numeric"):">"["$==="](Ha)||">="["$==="](Ha)||"<"["$==="](Ha)||"<="["$==="](Ha)||"<=>"["$==="](Ha)?this.$raise(z(e,"ArgumentError"),"comparison of "+this.$class()+" with "+eb.$class()+" failed"):d},J.$$arity=2);a.def(c, +y.$require("corelib/comparable");return function(c,$super,H){c=f(c,$super,"Numeric");var e=[c].concat(H),n,J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Fa,Ga,Ra,Pa;c.$include(z(e,"Comparable"));a.def(c,"$coerce",n=function(Ha){return h(Ha["$instance_of?"](this.$class()))?[Ha,this]:[this.$Float(Ha),this.$Float(this)]},n.$$arity=1);a.def(c,"$__coerced__",J=function(Ha,fb){if(h(fb["$respond_to?"]("coerce"))){fb=fb.$coerce(this);var kb=a.to_ary(fb);var S=null==kb[0]? +d:kb[0];kb=null==kb[1]?d:kb[1];fb;return S.$__send__(Ha,kb)}return"+"["$==="](Ha)||"-"["$==="](Ha)||"*"["$==="](Ha)||"/"["$==="](Ha)||"%"["$==="](Ha)||"&"["$==="](Ha)||"|"["$==="](Ha)||"^"["$==="](Ha)||"**"["$==="](Ha)?this.$raise(z(e,"TypeError"),""+fb.$class()+" can't be coerced into Numeric"):">"["$==="](Ha)||">="["$==="](Ha)||"<"["$==="](Ha)||"<="["$==="](Ha)||"<=>"["$==="](Ha)?this.$raise(z(e,"ArgumentError"),"comparison of "+this.$class()+" with "+fb.$class()+" failed"):d},J.$$arity=2);a.def(c, "$<=>",D=function(Ha){return h(this["$equal?"](Ha))?0:d},D.$$arity=1);a.def(c,"$+@",T=function(){return this},T.$$arity=0);a.def(c,"$-@",ia=function(){return w(0,this)},ia.$$arity=0);a.def(c,"$%",da=function(Ha){return w(this,F(Ha,this.$div(Ha)))},da.$$arity=1);a.def(c,"$abs",ma=function(){return p(this,0)?this["$-@"]():this},ma.$$arity=0);a.def(c,"$abs2",b=function(){return F(this,this)},b.$$arity=0);a.def(c,"$angle",m=function(){return p(this,0)?G(z(e,"Math"),"PI"):0},m.$$arity=0);a.alias(c,"arg", "angle");a.def(c,"$ceil",g=function(Ha){null==Ha&&(Ha=0);return this.$to_f().$ceil(Ha)},g.$$arity=-1);a.def(c,"$conj",r=function(){return this},r.$$arity=0);a.alias(c,"conjugate","conj");a.def(c,"$denominator",A=function(){return this.$to_r().$denominator()},A.$$arity=0);a.def(c,"$div",E=function(Ha){Ha["$=="](0)&&this.$raise(z(e,"ZeroDivisionError"),"divided by o");return t(this,Ha).$floor()},E.$$arity=1);a.def(c,"$divmod",I=function(Ha){return[this.$div(Ha),this["$%"](Ha)]},I.$$arity=1);a.def(c, "$fdiv",L=function(Ha){return t(this.$to_f(),Ha)},L.$$arity=1);a.def(c,"$floor",ba=function(Ha){null==Ha&&(Ha=0);return this.$to_f().$floor(Ha)},ba.$$arity=-1);a.def(c,"$i",va=function(){return this.$Complex(0,this)},va.$$arity=0);a.def(c,"$imag",Oa=function(){return 0},Oa.$$arity=0);a.alias(c,"imaginary","imag");a.def(c,"$integer?",wa=function(){return!1},wa.$$arity=0);a.alias(c,"magnitude","abs");a.alias(c,"modulo","%");a.def(c,"$nonzero?",Aa=function(){return h(this["$zero?"]())?d:this},Aa.$$arity= 0);a.def(c,"$numerator",La=function(){return this.$to_r().$numerator()},La.$$arity=0);a.alias(c,"phase","arg");a.def(c,"$polar",na=function(){return[this.$abs(),this.$arg()]},na.$$arity=0);a.def(c,"$quo",U=function(Ha){return t(z(e,"Opal")["$coerce_to!"](this,z(e,"Rational"),"to_r"),Ha)},U.$$arity=1);a.def(c,"$real",ra=function(){return this},ra.$$arity=0);a.def(c,"$real?",xa=function(){return!0},xa.$$arity=0);a.def(c,"$rect",Ja=function(){return[this,0]},Ja.$$arity=0);a.alias(c,"rectangular","rect"); a.def(c,"$round",ka=function(Ha){return this.$to_f().$round(Ha)},ka.$$arity=-1);a.def(c,"$to_c",N=function(){return this.$Complex(this,0)},N.$$arity=0);a.def(c,"$to_int",M=function(){return this.$to_i()},M.$$arity=0);a.def(c,"$truncate",ja=function(Ha){null==Ha&&(Ha=0);return this.$to_f().$truncate(Ha)},ja.$$arity=-1);a.def(c,"$zero?",sa=function(){return this["$=="](0)},sa.$$arity=0);a.def(c,"$positive?",ea=function(){return"number"===typeof this?0"](0)},ea.$$arity=0);a.def(c,"$negative?", -ua=function(){return p(this,0)},ua.$$arity=0);a.def(c,"$dup",Da=function(){return this},Da.$$arity=0);a.def(c,"$clone",Ga=function(Ha){if(null==Ha)v([],{});else if(!Ha.$$is_hash)throw a.ArgumentError.$new("expected kwargs");return this},Ga.$$arity=-1);a.def(c,"$finite?",Ra=function(){return!0},Ra.$$arity=0);return(a.def(c,"$infinite?",Pa=function(){return d},Pa.$$arity=0),d)&&"infinite?"}(q[0],null,q)}; +ua=function(){return p(this,0)},ua.$$arity=0);a.def(c,"$dup",Fa=function(){return this},Fa.$$arity=0);a.def(c,"$clone",Ga=function(Ha){if(null==Ha)v([],{});else if(!Ha.$$is_hash)throw a.ArgumentError.$new("expected kwargs");return this},Ga.$$arity=-1);a.def(c,"$finite?",Ra=function(){return!0},Ra.$$arity=0);return(a.def(c,"$infinite?",Pa=function(){return d},Pa.$$arity=0),d)&&"infinite?"}(q[0],null,q)}; Opal.modules["corelib/array"]=function(a){function w(ia,da){return"number"===typeof ia&&"number"===typeof da?ia>da:ia["$>"](da)}var F=a.top,p=[],t=a.nil,y=a.$$$,q=a.$$,d=a.truthy,G=a.falsy,z=a.hash_ids,f=a.yield1,h=a.hash_get,v=a.hash_put,c=a.hash_delete,l=a.coerce_to,H=a.respond_to,e=a.klass,n=a.hash2,J=a.send2,D=a.send,T=a.gvars;a.add_stubs("$require $include $to_a $warn $raise $replace $respond_to? $to_ary $coerce_to? $=== $join $to_str $class $hash $<=> $== $object_id $inspect $enum_for $bsearch_index $to_proc $nil? $coerce_to! $> $* $enumerator_size $empty? $size $map $equal? $dup $each $[] $dig $eql? $length $exclude_end? $flatten $__id__ $to_s $new $max $min $! $>= $** $delete_if $reverse $rotate $rand $at $keep_if $shuffle! $< $sort $sort_by $!= $times $[]= $- $<< $values $is_a? $last $first $upto $reject $pristine $singleton_class".split(" ")); -F.$require("corelib/enumerable");F.$require("corelib/numeric");return function(ia,$super,ma){function b(u,K){return K.$$name===a.Array?u:K.$allocate().$replace(u.$to_a())}function m(u,K,Q){for(var ca,ha=null,pa=Array(u.length),Qa=0,fb=0,$a=u.length;Qa<$a;Qa++){if(!ha)try{ca=f(Q,u[Qa])}catch(lb){ha=lb}if(ha||K(ca))pa[fb]=u[Qa],fb+=1}fb!==Qa&&(u.splice.apply(u,[0,pa.length].concat(pa)),u.splice(fb,pa.length));if(ha)throw ha;}function g(u,K){var Q=u.length;var ca=K.excl;var ha=l(K.begin,a.Integer,"to_int"); +F.$require("corelib/enumerable");F.$require("corelib/numeric");return function(ia,$super,ma){function b(u,K){return K.$$name===a.Array?u:K.$allocate().$replace(u.$to_a())}function m(u,K,Q){for(var ca,ha=null,pa=Array(u.length),Qa=0,gb=0,$a=u.length;Qa<$a;Qa++){if(!ha)try{ca=f(Q,u[Qa])}catch(lb){ha=lb}if(ha||K(ca))pa[gb]=u[Qa],gb+=1}gb!==Qa&&(u.splice.apply(u,[0,pa.length].concat(pa)),u.splice(gb,pa.length));if(ha)throw ha;}function g(u,K){var Q=u.length;var ca=K.excl;var ha=l(K.begin,a.Integer,"to_int"); K=l(K.end,a.Integer,"to_int");if(0>ha&&(ha+=Q,0>ha)||ha>Q)return t;if(0>K&&(K+=Q,0>K))return[];ca||(K+=1);Q=u.slice(ha,K);return b(Q,u.$class())}function r(u,K,Q){var ca=u.length;K=l(K,a.Integer,"to_int");if(0>K&&(K+=ca,0>K))return t;if(void 0===Q)return K>=ca||0>K?t:u[K];Q=l(Q,a.Integer,"to_int");if(0>Q||K>ca||0>K)return t;K=u.slice(K,K+Q);return b(K,u.$class())}function A(u,K){return u===K||0===K?1:0K?A(u-1,K-1)+A(u-1,K):0}var E=e(ia,$super,"Array"),I=[E].concat(ma),L,ba,va,Oa,wa,Aa,La,na, -U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Da,Ga,Ra,Pa,Ha,eb,kb,R,ya,Ca,Ua,ib,cb,ab,Xa,za,ta,Ma,Sa,Za,Ea,Y,S,Z,V,fa,la,k,C,O,aa,x,W,oa,Ka,jb,ob,mb,sb,tb,wb,xb,ub,X,Na,bb,B,P,qa,Fa,Ba,Ia,Wa,hb,db,Ta,Ya,gb,qb,nb,pb,Gb,Ab,Jb,Bb,Kb,Cb,Db,Lb,Mb,Eb,Nb,Fb,Ob;E.$include(q(I,"Enumerable"));a.defineProperty(E.$$prototype,"$$is_array",!0);a.defs(E,"$[]",L=function(u){var K=a.slice.call(arguments,0,arguments.length);return b(K,this)},L.$$arity=-1);a.def(E,"$initialize",ba=function(u,K){var Q=ba.$$p,ca=Q||t;Q&&(ba.$$p=null); +U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Fa,Ga,Ra,Pa,Ha,fb,kb,S,ya,Ca,Va,cb,db,ab,Ya,za,ta,Ma,Sa,Za,Da,Y,R,Z,V,fa,la,k,C,O,aa,x,W,oa,Ka,jb,ob,mb,sb,tb,wb,xb,ub,X,Na,bb,B,P,qa,Ea,Ba,Ia,Wa,ib,eb,Ta,Xa,hb,qb,nb,pb,Gb,Ab,Jb,Bb,Kb,Cb,Db,Lb,Mb,Eb,Nb,Fb,Ob;E.$include(q(I,"Enumerable"));a.defineProperty(E.$$prototype,"$$is_array",!0);a.defs(E,"$[]",L=function(u){var K=a.slice.call(arguments,0,arguments.length);return b(K,this)},L.$$arity=-1);a.def(E,"$initialize",ba=function(u,K){var Q=ba.$$p,ca=Q||t;Q&&(ba.$$p=null); Q&&(ba.$$p=null);null==u&&(u=t);null==K&&(K=t);K!==t&&ca!==t&&this.$warn("warning: block supersedes default value argument");u>y(q(I,"Integer"),"MAX")&&this.$raise(q(I,"ArgumentError"),"array size too big");2u&&this.$raise(q(I,"ArgumentError"),"negative array size");this.splice(0,this.length);if(ca===t)for(Q=0;Qu)&&this.$raise(q(I, "ArgumentError"),"negative argument");for(var K=[],Q=this.$to_a(),ca=0;ca",ra=function(u){if(d(q(I,"Array")["$==="](u)))u=u.$to_a();else if(d(u["$respond_to?"]("to_ary")))u=u.$to_ary().$to_a();else return t;if(this.$hash()===u.$hash())return 0;for(var K=Math.min(this.length,u.length),Q=0;Q"](u[Q]);if(0!==ca)return ca}return this.length["$<=>"](u.length)},ra.$$arity= -1);a.def(E,"$==",xa=function(u){function K(ca,ha){var pa;if(ca===ha)return!0;if(!ha.$$is_array)return H(ha,"$to_ary")?ha["$=="](ca):!1;ca.$$constructor!==Array&&(ca=ca.$to_a());ha.$$constructor!==Array&&(ha=ha.$to_a());if(ca.length!==ha.length)return!1;Q[ca.$object_id()]=!0;var Qa=0;for(pa=ca.length;QaQ&&(Q+=ha,0>Q&&this.$raise(q(I,"RangeError"),""+u.$inspect()+" out of range"));0>Qa&&(Qa+=ha);pa|| (Qa+=1);if(Q>ha)for(;haQa?this.splice.apply(this,[Q,0].concat(ca)):this.splice.apply(this,[Q,Qa-Q].concat(ca))}else{d(void 0===Q)?Qa=1:(Qa=K,K=Q,ca=d(q(I,"Array")["$==="](K))?K.$to_a():d(K["$respond_to?"]("to_ary"))?K.$to_ary().$to_a():[K]);u=l(u,q(I,"Integer"),"to_int");Qa=l(Qa,q(I,"Integer"),"to_int");0>u&&(pa=u,u+=ha,0>u&&this.$raise(q(I,"IndexError"),"index "+pa+" too small for array; minimum "+-this.length));0>Qa&&this.$raise(q(I,"IndexError"),"negative length ("+Qa+")"); if(u>ha)for(;hau&&(u+=this.length);return 0>u||u>=this.length?t:this[u]},ja.$$arity=1);a.def(E,"$bsearch_index",sa=function(){var u=sa.$$p,K=u||t;u&&(sa.$$p=null);u&&(sa.$$p=null);if(K===t)return this.$enum_for("bsearch_index");u=0;for(var Q=this.length,ca,ha,pa=!1,Qa=t;uha}else this.$raise(q(I, "TypeError"),"wrong argument type "+ha.$class()+" (must be numeric, true, false or nil)");pa?Q=ca:u=ca+1}return Qa},sa.$$arity=0);a.def(E,"$bsearch",ea=function(){var u=ea.$$p,K=u||t;u&&(ea.$$p=null);u&&(ea.$$p=null);if(K===t)return this.$enum_for("bsearch");u=D(this,"bsearch_index",[],K.$to_proc());return null!=u&&u.$$is_number?this[u]:u},ea.$$arity=0);a.def(E,"$cycle",ua=function(u){var K=ua.$$p,Q=K||t,ca,ha=t;K&&(ua.$$p=null);K&&(ua.$$p=null);null==u&&(u=t);if(Q===t)return D(this,"enum_for",["cycle", u],(ca=function(){var pa=null==ca.$$s?this:ca.$$s;if(d(u["$nil?"]()))return y(q(I,"Float"),"INFINITY");u=q(I,"Opal")["$coerce_to!"](u,q(I,"Integer"),"to_int");return d(w(u,0))?(pa=pa.$enumerator_size(),"number"===typeof pa&&"number"===typeof u?pa*u:pa["$*"](u)):0},ca.$$s=this,ca.$$arity=0,ca));if(d(d(ha=this["$empty?"]())?ha:u["$=="](0)))return t;if(u===t)for(;;)for(K=0,ha=this.length;K=u)return this;for(;0u&&(u+=this.length);if(0>u||u>= -this.length)return t;var K=this[u];this.splice(u,1);return K},ib.$$arity=1);a.def(E,"$delete_if",cb=function(){var u=cb.$$p,K=u||t,Q;u&&(cb.$$p=null);u&&(cb.$$p=null);if(K===t)return D(this,"enum_for",["delete_if"],(Q=function(){return(null==Q.$$s?this:Q.$$s).$size()},Q.$$s=this,Q.$$arity=0,Q));m(this,G,K);return this},cb.$$arity=0);a.alias(E,"difference","-");a.def(E,"$dig",ab=function(u,K){var Q=a.slice.call(arguments,1,arguments.length);var ca=this["$[]"](u);if(ca===t||0===Q.length)return ca;d(ca["$respond_to?"]("dig"))|| -this.$raise(q(I,"TypeError"),""+ca.$class()+" does not have #dig method");return D(ca,"dig",a.to_a(Q))},ab.$$arity=-2);a.def(E,"$drop",Xa=function(u){0>u&&this.$raise(q(I,"ArgumentError"));return this.slice(u)},Xa.$$arity=1);a.def(E,"$dup",za=function(){var u=za.$$p,K;u&&(za.$$p=null);var Q=0;var ca=arguments.length;for(K=Array(ca);Qu&&(u+=this.length);if(0>u||u>= +this.length)return t;var K=this[u];this.splice(u,1);return K},cb.$$arity=1);a.def(E,"$delete_if",db=function(){var u=db.$$p,K=u||t,Q;u&&(db.$$p=null);u&&(db.$$p=null);if(K===t)return D(this,"enum_for",["delete_if"],(Q=function(){return(null==Q.$$s?this:Q.$$s).$size()},Q.$$s=this,Q.$$arity=0,Q));m(this,G,K);return this},db.$$arity=0);a.alias(E,"difference","-");a.def(E,"$dig",ab=function(u,K){var Q=a.slice.call(arguments,1,arguments.length);var ca=this["$[]"](u);if(ca===t||0===Q.length)return ca;d(ca["$respond_to?"]("dig"))|| +this.$raise(q(I,"TypeError"),""+ca.$class()+" does not have #dig method");return D(ca,"dig",a.to_a(Q))},ab.$$arity=-2);a.def(E,"$drop",Ya=function(u){0>u&&this.$raise(q(I,"ArgumentError"));return this.slice(u)},Ya.$$arity=1);a.def(E,"$dup",za=function(){var u=za.$$p,K;u&&(za.$$p=null);var Q=0;var ca=arguments.length;for(K=Array(ca);Qu&&(u+=this.length);if(0<=u&&uu&&(u+=this.length);if(0<=u&&uha)&&(ha+=this.length),d(0>ha)&&this.$raise(q(I,"RangeError"),""+K.$inspect()+" out of range"), pa=l(K.end,q(I,"Integer"),"to_int"),d(0>pa)&&(pa+=this.length),d(K["$exclude_end?"]())||(pa+=1),d(pa<=ha))return this}else if(d(K))if(ha=l(K,q(I,"Integer"),"to_int"),d(0>ha)&&(ha+=this.length),d(0>ha)&&(ha=0),d(pa)){pa=l(pa,q(I,"Integer"),"to_int");if(d(0==pa))return this;pa+=ha}else pa=this.length;else ha=0,pa=this.length;if(d(ha>this.length))for(K=this.length;Kthis.length)&&(this.length=pa);if(d(Q))for(;hau&&this.$raise(q(I,"ArgumentError"),"negative array size");return this.slice(0,u)},S.$$arity=-1);a.def(E,"$flatten",Z=function(u){function K(ca,ha){var pa=[],Qa;ca=ca.$to_a();var fb=0;for(Qa=ca.length;fbu&&this.$raise(q(I,"ArgumentError"),"negative array size");return this.slice(0,u)},R.$$arity=-1);a.def(E,"$flatten",Z=function(u){function K(ca,ha){var pa=[],Qa;ca=ca.$to_a();var gb=0;for(Qa=ca.length;gbu&&(u+=this.length+1,0>u&&this.$raise(q(I,"IndexError"),""+u+" is out of bounds"));if(u>this.length)for(var ca=this.length;cau&&this.$raise(q(I,"ArgumentError"),"negative array size");u>this.length&&(u=this.length);return this.slice(this.length-u,this.length)},W.$$arity=-1);a.def(E,"$length",oa=function(){return this.length}, oa.$$arity=0);a.alias(E,"map","collect");a.alias(E,"map!","collect!");a.def(E,"$max",Ka=function(u){var K=Ka.$$p,Q=K||t;K&&(Ka.$$p=null);K&&(Ka.$$p=null);return D(this.$each(),"max",[u],Q.$to_proc())},Ka.$$arity=-1);a.def(E,"$min",jb=function(){var u=jb.$$p,K=u||t;u&&(jb.$$p=null);u&&(jb.$$p=null);return D(this.$each(),"min",[],K.$to_proc())},jb.$$arity=0);a.def(E,"$permutation",ob=function(u){var K=ob.$$p,Q=K||t,ca,ha=this,pa=t,Qa=t;K&&(ob.$$p=null);K&&(ob.$$p=null);if(Q===t)return D(ha,"enum_for", -["permutation",u],(ca=function(){var lb=null==ca.$$s?this:ca.$$s,vb=lb.length;lb=void 0===u?lb.length:u;for(var yb=0<=lb?1:0;lb;)yb*=vb,vb--,lb--;return yb},ca.$$s=ha,ca.$$arity=0,ca));var fb;u=void 0===u?ha.length:l(u,q(I,"Integer"),"to_int");if(!(0>u||ha.lengthu||ha.length="](0))?Qa.$size()["$**"](pa):0},Q.$$s=this,Q.$$arity=0,Q));K(pa,[],this.slice());return this},mb.$$arity=1);a.def(E,"$pop",sb=function(u){if(d(void 0===u))return d(0===this.length)?t:this.pop();u=l(u,q(I,"Integer"),"to_int");d(0>u)&&this.$raise(q(I,"ArgumentError"),"negative array size");return d(0===this.length)?[]:d(1===u)?[this.pop()]:d(u> -this.length)?this.splice(0,this.length):this.splice(this.length-u,this.length)},sb.$$arity=-1);a.def(E,"$product",tb=function(u){var K=tb.$$p,Q=K||t;K&&(tb.$$p=null);K&&(tb.$$p=null);var ca=a.slice.call(arguments,0,arguments.length);K=Q!==t?null:[];var ha=ca.length+1,pa=Array(ha),Qa=Array(ha),fb=Array(ha),$a;var lb=1;fb[0]=this;for($a=1;$a--$a)break a;pa[$a]++}}return K||this},tb.$$arity=-1);a.def(E,"$push",wb=function(u){var K=a.slice.call(arguments,0,arguments.length);for(var Q=0,ca=K.length;Q--$a)break a;pa[$a]++}}return K||this},tb.$$arity=-1);a.def(E,"$push",wb=function(u){var K=a.slice.call(arguments,0,arguments.length);for(var Q=0,ca=K.length;Q=this.length);K--){if(this[K]["$=="](u))return K}else if(Q!==t)for(K=this.length-1;0<=K&&!(K>=this.length);K--){if(u=Q(this[K]),!1!==u&&u!==t)return K}else if(null==u)return this.$enum_for("rindex");return t},qa.$$arity=-1);a.def(E,"$rotate",Fa=function(u){null==u&&(u=1);u=l(u,q(I,"Integer"),"to_int");if(1===this.length)return this.slice();if(0===this.length)return[];var K=this.slice();var Q=u%K.length;u=K.slice(Q);K=K.slice(0,Q);return u.concat(K)},Fa.$$arity=-1); -a.def(E,"$rotate!",Ba=function(u){null==u&&(u=1);if(0===this.length||1===this.length)return this;u=l(u,q(I,"Integer"),"to_int");u=this.$rotate(u);return this.$replace(u)},Ba.$$arity=-1);(function(u,$super,Q){u=e(u,$super,"SampleRandom");var ca=[u].concat(Q),ha,pa;u.$$prototype.rng=t;a.def(u,"$initialize",ha=function(Qa){return this.rng=Qa},ha.$$arity=1);return(a.def(u,"$rand",pa=function(Qa){var fb=l(this.rng.$rand(Qa),q(ca,"Integer"),"to_int");d(0>fb)&&this.$raise(q(ca,"RangeError"),"random value must be >= 0"); -d(fbu:Q)&&this.$raise(q(I,"ArgumentError"),"count must be greater than 0"); -d(K)&&(ca=K["$[]"]("random"));ca=d(d(ha=ca)?ca["$respond_to?"]("rand"):ha)?q(I,"SampleRandom").$new(ca):q(I,"Kernel");if(!d(u))return this[ca.$rand(this.length)];u>this.length&&(u=this.length);switch(u){case 0:return[];case 1:return[this[ca.$rand(this.length)]];case 2:var pa=ca.$rand(this.length);var Qa=ca.$rand(this.length);pa===Qa&&(Qa=0===pa?pa+1:pa-1);return[this[pa],this[Qa]];default:if(3u)&&this.$raise(q(I,"ArgumentError"),"negative array size");return d(0===this.length)?[]:this.splice(0,u)},db.$$arity=-1);a.alias(E,"size","length");a.def(E,"$shuffle",Ta=function(u){return this.$dup().$to_a()["$shuffle!"](u)},Ta.$$arity=-1);a.def(E,"$shuffle!",Ya=function(u){var K,Q=this.length;void 0!== -u&&(u=q(I,"Opal")["$coerce_to?"](u,q(I,"Hash"),"to_hash"),u!==t&&(u=u["$[]"]("random"),u!==t&&u["$respond_to?"]("rand")&&(K=u)));for(;Q;){K?(u=K.$rand(Q).$to_int(),0>u&&this.$raise(q(I,"RangeError"),"random number too small "+u),u>=Q&&this.$raise(q(I,"RangeError"),"random number too big "+u)):u=this.$rand(Q);var ca=this[--Q];this[Q]=this[u];this[u]=ca}return this},Ya.$$arity=-1);a.alias(E,"slice","[]");a.def(E,"$slice!",gb=function(u,K){if(d(void 0===K))if(d(q(I,"Range")["$==="](u))){var Q=this["$[]"](u); +u)for(K=this.length-1;0<=K&&!(K>=this.length);K--){if(this[K]["$=="](u))return K}else if(Q!==t)for(K=this.length-1;0<=K&&!(K>=this.length);K--){if(u=Q(this[K]),!1!==u&&u!==t)return K}else if(null==u)return this.$enum_for("rindex");return t},qa.$$arity=-1);a.def(E,"$rotate",Ea=function(u){null==u&&(u=1);u=l(u,q(I,"Integer"),"to_int");if(1===this.length)return this.slice();if(0===this.length)return[];var K=this.slice();var Q=u%K.length;u=K.slice(Q);K=K.slice(0,Q);return u.concat(K)},Ea.$$arity=-1); +a.def(E,"$rotate!",Ba=function(u){null==u&&(u=1);if(0===this.length||1===this.length)return this;u=l(u,q(I,"Integer"),"to_int");u=this.$rotate(u);return this.$replace(u)},Ba.$$arity=-1);(function(u,$super,Q){u=e(u,$super,"SampleRandom");var ca=[u].concat(Q),ha,pa;u.$$prototype.rng=t;a.def(u,"$initialize",ha=function(Qa){return this.rng=Qa},ha.$$arity=1);return(a.def(u,"$rand",pa=function(Qa){var gb=l(this.rng.$rand(Qa),q(ca,"Integer"),"to_int");d(0>gb)&&this.$raise(q(ca,"RangeError"),"random value must be >= 0"); +d(gbu:Q)&&this.$raise(q(I,"ArgumentError"),"count must be greater than 0"); +d(K)&&(ca=K["$[]"]("random"));ca=d(d(ha=ca)?ca["$respond_to?"]("rand"):ha)?q(I,"SampleRandom").$new(ca):q(I,"Kernel");if(!d(u))return this[ca.$rand(this.length)];u>this.length&&(u=this.length);switch(u){case 0:return[];case 1:return[this[ca.$rand(this.length)]];case 2:var pa=ca.$rand(this.length);var Qa=ca.$rand(this.length);pa===Qa&&(Qa=0===pa?pa+1:pa-1);return[this[pa],this[Qa]];default:if(3u)&&this.$raise(q(I,"ArgumentError"),"negative array size");return d(0===this.length)?[]:this.splice(0,u)},eb.$$arity=-1);a.alias(E,"size","length");a.def(E,"$shuffle",Ta=function(u){return this.$dup().$to_a()["$shuffle!"](u)},Ta.$$arity=-1);a.def(E,"$shuffle!",Xa=function(u){var K,Q=this.length;void 0!== +u&&(u=q(I,"Opal")["$coerce_to?"](u,q(I,"Hash"),"to_hash"),u!==t&&(u=u["$[]"]("random"),u!==t&&u["$respond_to?"]("rand")&&(K=u)));for(;Q;){K?(u=K.$rand(Q).$to_int(),0>u&&this.$raise(q(I,"RangeError"),"random number too small "+u),u>=Q&&this.$raise(q(I,"RangeError"),"random number too big "+u)):u=this.$rand(Q);var ca=this[--Q];this[Q]=this[u];this[u]=ca}return this},Xa.$$arity=-1);a.alias(E,"slice","[]");a.def(E,"$slice!",hb=function(u,K){if(d(void 0===K))if(d(q(I,"Range")["$==="](u))){var Q=this["$[]"](u); K=l(u.begin,q(I,"Integer"),"to_int");var ca=l(u.end,q(I,"Integer"),"to_int");0>K&&(K+=this.length);0>ca?ca+=this.length:ca>=this.length&&(ca=this.length-1,u.excl&&(ca+=1));var ha=ca-K;u.excl?--ca:ha+=1;Ku&&(u+=this.length);if(0>u||u>=this.length)return t;Q=this[u];0===u?this.shift():this.splice(u,1)}else{u=l(u,q(I,"Integer"),"to_int");K=l(K,q(I,"Integer"),"to_int");if(0>K)return t;Q=this["$[]"](u, -K);0>u&&(u+=this.length);u+K>this.length&&(K=this.length-u);u"](ha)});return Q.slice().sort(function(ca,ha){var pa=K(ca,ha);pa===t&&Q.$raise(q(I,"ArgumentError"),"comparison of "+ca.$inspect()+" with "+ha.$inspect()+" failed");return w(pa,0)?1:("number"===typeof pa?0>pa:pa["$<"](0))? +K);0>u&&(u+=this.length);u+K>this.length&&(K=this.length-u);u"](ha)});return Q.slice().sort(function(ca,ha){var pa=K(ca,ha);pa===t&&Q.$raise(q(I,"ArgumentError"),"comparison of "+ca.$inspect()+" with "+ha.$inspect()+" failed");return w(pa,0)?1:("number"===typeof pa?0>pa:pa["$<"](0))? -1:0})},qb.$$arity=0);a.def(E,"$sort!",nb=function(){var u=nb.$$p,K=u||t;u&&(nb.$$p=null);u&&(nb.$$p=null);u=K!==t?D(this.slice(),"sort",[],K.$to_proc()):this.slice().$sort();K=this.length=0;for(var Q=u.length;Ku&&this.$raise(q(I,"ArgumentError"));return this.slice(0,u)},Gb.$$arity=1);a.def(E,"$take_while",Ab=function(){var u=Ab.$$p,K=u||t;u&&(Ab.$$p=null);u&&(Ab.$$p=null);u=[];for(var Q=0,ca=this.length,ha,pa;Q$a)return $a+=pa.length,t;0>fb&&(fb+=pa.length);ha["$exclude_end?"]()&&fb--;return fb<$a?t:D($a,"upto",[fb],(Qa=function(lb){var vb=null==Qa.$$s?this:Qa.$$s;null==lb&&(lb=t);return Q["$<<"](vb.$at(lb))}, -Qa.$$s=pa,Qa.$$arity=1,Qa))}fb=l(ha,q(I,"Integer"),"to_int");return Q["$<<"](pa.$at(fb))},K.$$s=this,K.$$arity=1,K));return Q},Mb.$$arity=-1);a.def(E,"$zip",Eb=function(u){var K=Eb.$$p,Q=K||t,ca=t;K&&(Eb.$$p=null);K&&(Eb.$$p=null);K=a.slice.call(arguments,0,arguments.length);var ha=[],pa=this.length,Qa,fb;var $a=0;for(fb=K.length;$a$a)return $a+=pa.length,t;0>gb&&(gb+=pa.length);ha["$exclude_end?"]()&&gb--;return gb<$a?t:D($a,"upto",[gb],(Qa=function(lb){var vb=null==Qa.$$s?this:Qa.$$s;null==lb&&(lb=t);return Q["$<<"](vb.$at(lb))}, +Qa.$$s=pa,Qa.$$arity=1,Qa))}gb=l(ha,q(I,"Integer"),"to_int");return Q["$<<"](pa.$at(gb))},K.$$s=this,K.$$arity=1,K));return Q},Mb.$$arity=-1);a.def(E,"$zip",Eb=function(u){var K=Eb.$$p,Q=K||t,ca=t;K&&(Eb.$$p=null);K&&(Eb.$$p=null);K=a.slice.call(arguments,0,arguments.length);var ha=[],pa=this.length,Qa,gb;var $a=0;for(gb=K.length;$a=h:f["$>="](h)}var F=a.top,p=[],t=a.nil,y=a.$$,q=a.klass,d=a.send,G=a.hash2,z=a.truthy;a.add_stubs("$require $include $coerce_to? $[] $merge! $allocate $raise $coerce_to! $each $fetch $>= $> $== $compare_by_identity $lambda? $abs $arity $enum_for $size $respond_to? $class $dig $new $inspect $map $to_proc $flatten $eql? $default $dup $default_proc $default_proc= $- $default= $to_h $proc".split(" "));F.$require("corelib/enumerable"); -return function(f,$super,v){f=q(f,$super,"Hash");var c=[f].concat(v),l,H,e,n,J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Da,Ga,Ra,Pa,Ha,eb,kb,R,ya,Ca,Ua,ib,cb,ab,Xa,za,ta,Ma,Sa,Za,Ea,Y,S,Z,V,fa;f.$include(y(c,"Enumerable"));f.$$prototype.$$is_hash=!0;a.defs(f,"$[]",l=function(k){var C=a.slice.call(arguments,0,arguments.length);var O=C.length,aa;if(1===O){var x=y(c,"Opal")["$coerce_to?"](C["$[]"](0),y(c,"Hash"),"to_hash");if(x!==t)return this.$allocate()["$merge!"](x); +return function(f,$super,v){f=q(f,$super,"Hash");var c=[f].concat(v),l,H,e,n,J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Fa,Ga,Ra,Pa,Ha,fb,kb,S,ya,Ca,Va,cb,db,ab,Ya,za,ta,Ma,Sa,Za,Da,Y,R,Z,V,fa;f.$include(y(c,"Enumerable"));f.$$prototype.$$is_hash=!0;a.defs(f,"$[]",l=function(k){var C=a.slice.call(arguments,0,arguments.length);var O=C.length,aa;if(1===O){var x=y(c,"Opal")["$coerce_to?"](C["$[]"](0),y(c,"Hash"),"to_hash");if(x!==t)return this.$allocate()["$merge!"](x); C=y(c,"Opal")["$coerce_to?"](C["$[]"](0),y(c,"Array"),"to_ary");C===t&&this.$raise(y(c,"ArgumentError"),"odd number of arguments for Hash");O=C.length;x=this.$allocate();for(aa=0;aa=",D=function(k){var C,O=t;k=y(c,"Opal")["$coerce_to!"](k,y(c,"Hash"),"to_hash");if(this.$$keys.length"+oa.$inspect());return"{"+O.join(", ")+"}"}finally{k&&(la=void 0)}},Ga.$$arity=0);a.def(f,"$invert",Ra=function(){for(var k=a.hash(),C=0,O=this.$$keys,aa=O.length,x,W;CJ:n["$>"](J)}function F(n,J){return"number"===typeof n&&"number"===typeof J?n $** $new $< $to_f $== $nan? $infinite? $enum_for $+ $- $gcd $lcm $% $/ $frexp $to_i $ldexp $rationalize $* $<< $to_r $truncate $-@ $size $<= $>= $<=> $compare $any?".split(" "));d.$require("corelib/numeric");(function(n,$super,D){n=v(n,$super,"Number");var T=[n].concat(D),ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa, -wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Da,Ga,Ra,Pa,Ha,eb,kb,R,ya,Ca,Ua,ib,cb,ab,Xa,za,ta,Ma,Sa,Za,Ea,Y,S,Z,V,fa,la,k,C,O,aa,x,W,oa,Ka,jb,ob,mb,sb,tb,wb,xb,ub;h(T,"Opal").$bridge(Number,n);a.defineProperty(n.$$prototype,"$$is_number",!0);n.$$is_number_class=!0;(function(X,Na){var bb=[X].concat(Na),B;a.def(X,"$allocate",B=function(){return this.$raise(h(bb,"TypeError"),"allocator undefined for "+this.$name())},B.$$arity=0);a.udef(X,"$new");return z})(a.get_singleton_class(n),T);a.def(n,"$coerce", +wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Fa,Ga,Ra,Pa,Ha,fb,kb,S,ya,Ca,Va,cb,db,ab,Ya,za,ta,Ma,Sa,Za,Da,Y,R,Z,V,fa,la,k,C,O,aa,x,W,oa,Ka,jb,ob,mb,sb,tb,wb,xb,ub;h(T,"Opal").$bridge(Number,n);a.defineProperty(n.$$prototype,"$$is_number",!0);n.$$is_number_class=!0;(function(X,Na){var bb=[X].concat(Na),B;a.def(X,"$allocate",B=function(){return this.$raise(h(bb,"TypeError"),"allocator undefined for "+this.$name())},B.$$arity=0);a.udef(X,"$new");return z})(a.get_singleton_class(n),T);a.def(n,"$coerce", ia=function(X){if(X!==z){if(X.$$is_string)return[this.$Float(X),this];if(X["$respond_to?"]("to_f"))return[h(T,"Opal")["$coerce_to!"](X,h(T,"Float"),"to_f"),this];if(X.$$is_number)return[X,this]}this.$raise(h(T,"TypeError"),"can't convert "+X.$class()+" into Float")},ia.$$arity=1);a.def(n,"$__id__",da=function(){return 2*this+1},da.$$arity=0);a.alias(n,"object_id","__id__");a.def(n,"$+",ma=function(X){return X.$$is_number?this+X:this.$__coerced__("+",X)},ma.$$arity=1);a.def(n,"$-",b=function(X){return X.$$is_number? this-X:this.$__coerced__("-",X)},b.$$arity=1);a.def(n,"$*",m=function(X){return X.$$is_number?this*X:this.$__coerced__("*",X)},m.$$arity=1);a.def(n,"$/",g=function(X){return X.$$is_number?this/X:this.$__coerced__("/",X)},g.$$arity=1);a.alias(n,"fdiv","/");a.def(n,"$%",r=function(X){if(X.$$is_number){if(-Infinity==X)return X;if(0==X)this.$raise(h(T,"ZeroDivisionError"),"divided by 0");else return 0>X||0>this?(this%X+X)%X:this%X}else return this.$__coerced__("%",X)},r.$$arity=1);a.def(n,"$&",A=function(X){return X.$$is_number? this&X:this.$__coerced__("&",X)},A.$$arity=1);a.def(n,"$|",E=function(X){return X.$$is_number?this|X:this.$__coerced__("|",X)},E.$$arity=1);a.def(n,"$^",I=function(X){return X.$$is_number?this^X:this.$__coerced__("^",X)},I.$$arity=1);a.def(n,"$<",L=function(X){return X.$$is_number?this",va=function(X){return X.$$is_number?this>X:this.$__coerced__(">", @@ -426,25 +426,25 @@ X)},va.$$arity=1);a.def(n,"$>=",Oa=function(X){return X.$$is_number?this>=X:this La=function(X){X=h(T,"Opal")["$coerce_to!"](X,h(T,"Integer"),"to_int");return 0>X:this<<-X},La.$$arity=1);a.def(n,"$[]",na=function(X){X=h(T,"Opal")["$coerce_to!"](X,h(T,"Integer"),"to_int");return 0>X?0:32<=X?0>this?1:0:this>>X&1},na.$$arity=1);a.def(n,"$+@",U=function(){return+this},U.$$arity=0);a.def(n,"$-@",ra=function(){return-this},ra.$$arity=0);a.def(n,"$~",xa=function(){return~this},xa.$$arity=0);a.def(n,"$**",Ja=function(X){var Na=z,bb=z,B=z;return c(h(T,"Integer")["$==="](X))?c(c(Na= h(T,"Integer")["$==="](this)["$!"]())?Na:w(X,0))?Math.pow(this,X):h(T,"Rational").$new(this,1)["$**"](X):c(c(bb=F(this,0))?c(B=h(T,"Float")["$==="](X))?B:h(T,"Rational")["$==="](X):bb)?h(T,"Complex").$new(this,0)["$**"](X.$to_f()):c(null!=X.$$is_number)?Math.pow(this,X):this.$__coerced__("**",X)},Ja.$$arity=1);a.def(n,"$===",ka=function(X){return X.$$is_number?this.valueOf()===X.valueOf():X["$respond_to?"]("==")?X["$=="](this):!1},ka.$$arity=1);a.def(n,"$==",N=function(X){return X.$$is_number?this.valueOf()=== X.valueOf():X["$respond_to?"]("==")?X["$=="](this):!1},N.$$arity=1);a.def(n,"$abs",M=function(){return Math.abs(this)},M.$$arity=0);a.def(n,"$abs2",ja=function(){return Math.abs(this*this)},ja.$$arity=0);a.def(n,"$allbits?",sa=function(X){X=h(T,"Opal")["$coerce_to!"](X,h(T,"Integer"),"to_int");return(this&X)==X},sa.$$arity=1);a.def(n,"$anybits?",ea=function(X){X=h(T,"Opal")["$coerce_to!"](X,h(T,"Integer"),"to_int");return 0!==(this&X)},ea.$$arity=1);a.def(n,"$angle",ua=function(){return c(this["$nan?"]())? -this:0==this?0<1/this?0:Math.PI:0>this?Math.PI:0},ua.$$arity=0);a.alias(n,"arg","angle");a.alias(n,"phase","angle");a.def(n,"$bit_length",Da=function(){c(h(T,"Integer")["$==="](this))||this.$raise(h(T,"NoMethodError").$new("undefined method `bit_length` for "+this+":Float","bit_length"));if(0===this||-1===this)return 0;for(var X=0,Na=0>this?~this:this;0!=Na;)X+=1,Na>>>=1;return X},Da.$$arity=0);a.def(n,"$ceil",Ga=function(X){null==X&&(X=0);var Na=this.$to_f();if(0===Na%1&&0<=X)return Na;X=Math.pow(10, +this:0==this?0<1/this?0:Math.PI:0>this?Math.PI:0},ua.$$arity=0);a.alias(n,"arg","angle");a.alias(n,"phase","angle");a.def(n,"$bit_length",Fa=function(){c(h(T,"Integer")["$==="](this))||this.$raise(h(T,"NoMethodError").$new("undefined method `bit_length` for "+this+":Float","bit_length"));if(0===this||-1===this)return 0;for(var X=0,Na=0>this?~this:this;0!=Na;)X+=1,Na>>>=1;return X},Fa.$$arity=0);a.def(n,"$ceil",Ga=function(X){null==X&&(X=0);var Na=this.$to_f();if(0===Na%1&&0<=X)return Na;X=Math.pow(10, X);X=Math.ceil(Na*X)/X;0===Na%1&&(X=Math.round(X));return X},Ga.$$arity=-1);a.def(n,"$chr",Ra=function(){return String.fromCharCode(this)},Ra.$$arity=-1);a.def(n,"$denominator",Pa=function(){var X=Pa.$$p,Na=z,bb;X&&(Pa.$$p=null);var B=0;var P=arguments.length;for(bb=Array(P);B=X;Na--)bb(Na);return this},Ha.$$arity=1);a.alias(n,"eql?","=="); -a.def(n,"$equal?",eb=function(X){var Na;return c(Na=this["$=="](X))?Na:isNaN(this)&&isNaN(X)},eb.$$arity=1);a.def(n,"$even?",kb=function(){return 0===this%2},kb.$$arity=0);a.def(n,"$floor",R=function(X){null==X&&(X=0);var Na=this.$to_f();if(0===Na%1&&0<=X)return Na;X=Math.pow(10,X);X=Math.floor(Na*X)/X;0===Na%1&&(X=Math.round(X));return X},R.$$arity=-1);a.def(n,"$gcd",ya=function(X){c(h(T,"Integer")["$==="](X))||this.$raise(h(T,"TypeError"),"not an integer");var Na=Math.abs(this);for(X=Math.abs(X);0< -Na;){var bb=Na;Na=X%Na;X=bb}return X},ya.$$arity=1);a.def(n,"$gcdlcm",Ca=function(X){return[this.$gcd(X),this.$lcm(X)]},Ca.$$arity=1);a.def(n,"$integer?",Ua=function(){return 0===this%1},Ua.$$arity=0);a.def(n,"$is_a?",ib=function(X){var Na=ib.$$p,bb=z,B=z,P=z,qa;Na&&(ib.$$p=null);var Fa=0;var Ba=arguments.length;for(qa=Array(Ba);FaX&&this.$raise(h(T,"TypeError"),"Integer#pow() 1st argument cannot be negative when 2nd argument specified");h(T,"Integer")["$==="](Na)||this.$raise(h(T,"TypeError"),"Integer#pow() 2nd argument not allowed unless all arguments are integers"); -0===Na&&this.$raise(h(T,"ZeroDivisionError"),"divided by 0");return this["$**"](X)["$%"](Na)},Ea.$$arity=-2);a.def(n,"$pred",Y=function(){return this-1},Y.$$arity=0);a.def(n,"$quo",S=function(X){var Na=S.$$p,bb;Na&&(S.$$p=null);var B=0;var P=arguments.length;for(bb=Array(P);BX&&this.$raise(h(T,"TypeError"),"Integer#pow() 1st argument cannot be negative when 2nd argument specified");h(T,"Integer")["$==="](Na)||this.$raise(h(T,"TypeError"),"Integer#pow() 2nd argument not allowed unless all arguments are integers"); +0===Na&&this.$raise(h(T,"ZeroDivisionError"),"divided by 0");return this["$**"](X)["$%"](Na)},Da.$$arity=-2);a.def(n,"$pred",Y=function(){return this-1},Y.$$arity=0);a.def(n,"$quo",R=function(X){var Na=R.$$p,bb;Na&&(R.$$p=null);var B=0;var P=arguments.length;for(bb=Array(P);Bthis.$size())return 0;X=Math.pow(10,X);X*=Math.floor((Math.abs(this)+X/2)/X);return 0>this?-X:X}c(c(bb=this["$nan?"]())?null==X:bb)&&this.$raise(h(T,"FloatDomainError"),"NaN");X=h(T,"Opal")["$coerce_to!"](X||0,h(T,"Integer"),"to_int");if(c("number"===typeof X?0>=X:X["$<="](0)))c(this["$nan?"]())?this.$raise(h(T,"RangeError"),"NaN"):c(this["$infinite?"]())&& this.$raise(h(T,"FloatDomainError"),"Infinity");else{if(X["$=="](0))return Math.round(this);if(c(c(B=this["$nan?"]())?B:this["$infinite?"]()))return this}bb=h(T,"Math").$frexp(this);Na=a.to_ary(bb);Na=null==Na[1]?z:Na[1];bb;bb=t(p(f(h(T,"Float"),"DIG"),2),c(w(Na,0))?y(Na,4):t(y(Na,3),1));bb="number"===typeof X&&"number"===typeof bb?X>=bb:X["$>="](bb);return c(bb)?this:c(F(X,(c(w(Na,0))?p(y(Na,3),1):y(Na,4))["$-@"]()))?0:Math.round(this*Math.pow(10,X))/Math.pow(10,X)},fa.$$arity=-1);a.def(n,"$step", -la=function(X,Na,bb){function B(){void 0!==gb&&(Ta=gb);void 0===Ta&&(Ta=z);Ya===z&&hb.$raise(h(T,"TypeError"),"step must be numeric");0===Ya&&hb.$raise(h(T,"ArgumentError"),"step can't be 0");void 0!==qb&&(Ya=qb);if(Ya===z||null==Ya)Ya=1;var nb=Ya["$<=>"](0);nb===z&&hb.$raise(h(T,"ArgumentError"),"0 can't be coerced into "+Ya.$class());if(Ta===z||null==Ta)Ta=0Ta||0>Ya&&hbTa||0>Ya&&hbIa&&(Ia=Ta),Ba(Ia),Fa+=1}else if(Wa=hb,0= -Ta;)Ba(Wa),Wa+=Ya;return hb},la.$$arity=-1);a.alias(n,"succ","next");a.def(n,"$times",k=function(){var X=k.$$p,Na=X||z,bb;X&&(k.$$p=null);X&&(k.$$p=null);if(!c(Na))return H(this,"enum_for",["times"],(bb=function(){return null==bb.$$s?this:bb.$$s},bb.$$s=this,bb.$$arity=0,bb));for(X=0;X"](0);nb===z&&ib.$raise(h(T,"ArgumentError"),"0 can't be coerced into "+Xa.$class());if(Ta===z||null==Ta)Ta=0Ta||0>Xa&&ibTa||0>Xa&&ibIa&&(Ia=Ta),Ba(Ia),Ea+=1}else if(Wa=ib,0= +Ta;)Ba(Wa),Wa+=Xa;return ib},la.$$arity=-1);a.alias(n,"succ","next");a.def(n,"$times",k=function(){var X=k.$$p,Na=X||z,bb;X&&(k.$$p=null);X&&(k.$$p=null);if(!c(Na))return H(this,"enum_for",["times"],(bb=function(){return null==bb.$$s?this:bb.$$s},bb.$$s=this,bb.$$arity=0,bb));for(X=0;X $!= $divmod $** $hypot $atan2 $lcm $denominator $finite? $infinite? $numerator $abs $arg $rationalize $to_f $to_i $to_r $inspect $positive? $zero? $Rational".split(" ")); -y.$require("corelib/numeric");(function(c,$super,H){c=f(c,$super,"Complex");var e=[c].concat(H),n,J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa;c.$$prototype.real=c.$$prototype.imag=d;a.defs(c,"$rect",n=function(ea,ua){var Da=d,Ga=d,Ra=d;null==ua&&(ua=0);h(h(Da=h(Ga=h(Ra=z(e,"Numeric")["$==="](ea))?ea["$real?"]():Ra)?z(e,"Numeric")["$==="](ua):Ga)?ua["$real?"]():Da)||this.$raise(z(e,"TypeError"),"not a real");return this.$new(ea,ua)},n.$$arity=-2);(function(ea,ua){[ea].concat(ua); -return a.alias(ea,"rectangular","rect")})(a.get_singleton_class(c),e);a.defs(c,"$polar",J=function(ea,ua){var Da=d,Ga=d,Ra=d;null==ua&&(ua=0);h(h(Da=h(Ga=h(Ra=z(e,"Numeric")["$==="](ea))?ea["$real?"]():Ra)?z(e,"Numeric")["$==="](ua):Ga)?ua["$real?"]():Da)||this.$raise(z(e,"TypeError"),"not a real");return this.$new(w(ea,z(e,"Math").$cos(ua)),w(ea,z(e,"Math").$sin(ua)))},J.$$arity=-2);c.$attr_reader("real","imag");a.def(c,"$initialize",D=function(ea,ua){null==ua&&(ua=0);this.real=ea;return this.imag= -ua},D.$$arity=-2);a.def(c,"$coerce",T=function(ea){var ua=d;return h(z(e,"Complex")["$==="](ea))?[ea,this]:h(h(ua=z(e,"Numeric")["$==="](ea))?ea["$real?"]():ua)?[z(e,"Complex").$new(ea,0),this]:this.$raise(z(e,"TypeError"),""+ea.$class()+" can't be coerced into Complex")},T.$$arity=1);a.def(c,"$==",ia=function(ea){var ua=d,Da=d,Ga=d;return h(z(e,"Complex")["$==="](ea))?h(ua=this.real["$=="](ea.$real()))?this.imag["$=="](ea.$imag()):ua:h(h(Da=z(e,"Numeric")["$==="](ea))?ea["$real?"]():Da)?h(Ga=this.real["$=="](ea))? +y.$require("corelib/numeric");(function(c,$super,H){c=f(c,$super,"Complex");var e=[c].concat(H),n,J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa;c.$$prototype.real=c.$$prototype.imag=d;a.defs(c,"$rect",n=function(ea,ua){var Fa=d,Ga=d,Ra=d;null==ua&&(ua=0);h(h(Fa=h(Ga=h(Ra=z(e,"Numeric")["$==="](ea))?ea["$real?"]():Ra)?z(e,"Numeric")["$==="](ua):Ga)?ua["$real?"]():Fa)||this.$raise(z(e,"TypeError"),"not a real");return this.$new(ea,ua)},n.$$arity=-2);(function(ea,ua){[ea].concat(ua); +return a.alias(ea,"rectangular","rect")})(a.get_singleton_class(c),e);a.defs(c,"$polar",J=function(ea,ua){var Fa=d,Ga=d,Ra=d;null==ua&&(ua=0);h(h(Fa=h(Ga=h(Ra=z(e,"Numeric")["$==="](ea))?ea["$real?"]():Ra)?z(e,"Numeric")["$==="](ua):Ga)?ua["$real?"]():Fa)||this.$raise(z(e,"TypeError"),"not a real");return this.$new(w(ea,z(e,"Math").$cos(ua)),w(ea,z(e,"Math").$sin(ua)))},J.$$arity=-2);c.$attr_reader("real","imag");a.def(c,"$initialize",D=function(ea,ua){null==ua&&(ua=0);this.real=ea;return this.imag= +ua},D.$$arity=-2);a.def(c,"$coerce",T=function(ea){var ua=d;return h(z(e,"Complex")["$==="](ea))?[ea,this]:h(h(ua=z(e,"Numeric")["$==="](ea))?ea["$real?"]():ua)?[z(e,"Complex").$new(ea,0),this]:this.$raise(z(e,"TypeError"),""+ea.$class()+" can't be coerced into Complex")},T.$$arity=1);a.def(c,"$==",ia=function(ea){var ua=d,Fa=d,Ga=d;return h(z(e,"Complex")["$==="](ea))?h(ua=this.real["$=="](ea.$real()))?this.imag["$=="](ea.$imag()):ua:h(h(Fa=z(e,"Numeric")["$==="](ea))?ea["$real?"]():Fa)?h(Ga=this.real["$=="](ea))? this.imag["$=="](0):Ga:ea["$=="](this)},ia.$$arity=1);a.def(c,"$-@",da=function(){return this.$Complex(this.real["$-@"](),this.imag["$-@"]())},da.$$arity=0);a.def(c,"$+",ma=function(ea){var ua=d;return h(z(e,"Complex")["$==="](ea))?this.$Complex(F(this.real,ea.$real()),F(this.imag,ea.$imag())):h(h(ua=z(e,"Numeric")["$==="](ea))?ea["$real?"]():ua)?this.$Complex(F(this.real,ea),this.imag):this.$__coerced__("+",ea)},ma.$$arity=1);a.def(c,"$-",b=function(ea){var ua=d;return h(z(e,"Complex")["$==="](ea))? this.$Complex(p(this.real,ea.$real()),p(this.imag,ea.$imag())):h(h(ua=z(e,"Numeric")["$==="](ea))?ea["$real?"]():ua)?this.$Complex(p(this.real,ea),this.imag):this.$__coerced__("-",ea)},b.$$arity=1);a.def(c,"$*",m=function(ea){var ua=d;return h(z(e,"Complex")["$==="](ea))?this.$Complex(p(w(this.real,ea.$real()),w(this.imag,ea.$imag())),F(w(this.real,ea.$imag()),w(this.imag,ea.$real()))):h(h(ua=z(e,"Numeric")["$==="](ea))?ea["$real?"]():ua)?this.$Complex(w(this.real,ea),w(this.imag,ea)):this.$__coerced__("*", -ea)},m.$$arity=1);a.def(c,"$/",g=function(ea){var ua=d,Da=d,Ga=d,Ra=d,Pa=d,Ha=d,eb=d,kb=d;return h(z(e,"Complex")["$==="](ea))?h(h(ua=h(Da=h(Ga=h(Ra=z(e,"Number")["$==="](this.real))?this.real["$nan?"]():Ra)?Ga:h(Pa=z(e,"Number")["$==="](this.imag))?this.imag["$nan?"]():Pa)?Da:h(Ha=z(e,"Number")["$==="](ea.$real()))?ea.$real()["$nan?"]():Ha)?ua:h(eb=z(e,"Number")["$==="](ea.$imag()))?ea.$imag()["$nan?"]():eb)?z(e,"Complex").$new(G(z(e,"Float"),"NAN"),G(z(e,"Float"),"NAN")):t(w(this,ea.$conj()),ea.$abs2()): -h(h(kb=z(e,"Numeric")["$==="](ea))?ea["$real?"]():kb)?this.$Complex(this.real.$quo(ea),this.imag.$quo(ea)):this.$__coerced__("/",ea)},g.$$arity=1);a.def(c,"$**",r=function(ea){var ua=d;if(ea["$=="](0))return z(e,"Complex").$new(1,0);if(h(z(e,"Complex")["$==="](ea))){ua=this.$polar();var Da=a.to_ary(ua);var Ga=null==Da[0]?d:Da[0];Da=null==Da[1]?d:Da[1];ua;ua=ea.$real();var Ra=ea.$imag();ea=z(e,"Math").$exp(p(w(ua,z(e,"Math").$log(Ga)),w(Ra,Da)));ua=F(w(Da,ua),w(Ra,z(e,"Math").$log(Ga)));return z(e, -"Complex").$polar(ea,ua)}if(h(z(e,"Integer")["$==="](ea))){if(h("number"===typeof ea?0"](0))){Da=Ga=this;for(Ra=p(ea,1);h(Ra["$!="](0));){ea=Ra.$divmod(2);ua=a.to_ary(ea);var Pa=null==ua[0]?d:ua[0];var Ha=null==ua[1]?d:ua[1];for(ea;Ha["$=="](0);)Ga=this.$Complex(p(w(Ga.$real(),Ga.$real()),w(Ga.$imag(),Ga.$imag())),w(w(2,Ga.$real()),Ga.$imag())),Ra=Pa,ua=Ra.$divmod(2),ea=a.to_ary(ua),Pa=null==ea[0]?d:ea[0],Ha=null==ea[1]?d:ea[1],ua;Da=w(Da,Ga);Ra=p(Ra,1)}return Da}return t(z(e,"Rational").$new(1, -1),this)["$**"](ea["$-@"]())}return h(h(ua=z(e,"Float")["$==="](ea))?ua:z(e,"Rational")["$==="](ea))?(ua=this.$polar(),Da=a.to_ary(ua),Ga=null==Da[0]?d:Da[0],Da=null==Da[1]?d:Da[1],ua,z(e,"Complex").$polar(Ga["$**"](ea),w(Da,ea))):this.$__coerced__("**",ea)},r.$$arity=1);a.def(c,"$abs",A=function(){return z(e,"Math").$hypot(this.real,this.imag)},A.$$arity=0);a.def(c,"$abs2",E=function(){return F(w(this.real,this.real),w(this.imag,this.imag))},E.$$arity=0);a.def(c,"$angle",I=function(){return z(e, -"Math").$atan2(this.imag,this.real)},I.$$arity=0);a.alias(c,"arg","angle");a.def(c,"$conj",L=function(){return this.$Complex(this.real,this.imag["$-@"]())},L.$$arity=0);a.alias(c,"conjugate","conj");a.def(c,"$denominator",ba=function(){return this.real.$denominator().$lcm(this.imag.$denominator())},ba.$$arity=0);a.alias(c,"divide","/");a.def(c,"$eql?",va=function(ea){var ua=d,Da=d;return h(ua=h(Da=z(e,"Complex")["$==="](ea))?this.real.$class()["$=="](this.imag.$class()):Da)?this["$=="](ea):ua},va.$$arity= +ea)},m.$$arity=1);a.def(c,"$/",g=function(ea){var ua=d,Fa=d,Ga=d,Ra=d,Pa=d,Ha=d,fb=d,kb=d;return h(z(e,"Complex")["$==="](ea))?h(h(ua=h(Fa=h(Ga=h(Ra=z(e,"Number")["$==="](this.real))?this.real["$nan?"]():Ra)?Ga:h(Pa=z(e,"Number")["$==="](this.imag))?this.imag["$nan?"]():Pa)?Fa:h(Ha=z(e,"Number")["$==="](ea.$real()))?ea.$real()["$nan?"]():Ha)?ua:h(fb=z(e,"Number")["$==="](ea.$imag()))?ea.$imag()["$nan?"]():fb)?z(e,"Complex").$new(G(z(e,"Float"),"NAN"),G(z(e,"Float"),"NAN")):t(w(this,ea.$conj()),ea.$abs2()): +h(h(kb=z(e,"Numeric")["$==="](ea))?ea["$real?"]():kb)?this.$Complex(this.real.$quo(ea),this.imag.$quo(ea)):this.$__coerced__("/",ea)},g.$$arity=1);a.def(c,"$**",r=function(ea){var ua=d;if(ea["$=="](0))return z(e,"Complex").$new(1,0);if(h(z(e,"Complex")["$==="](ea))){ua=this.$polar();var Fa=a.to_ary(ua);var Ga=null==Fa[0]?d:Fa[0];Fa=null==Fa[1]?d:Fa[1];ua;ua=ea.$real();var Ra=ea.$imag();ea=z(e,"Math").$exp(p(w(ua,z(e,"Math").$log(Ga)),w(Ra,Fa)));ua=F(w(Fa,ua),w(Ra,z(e,"Math").$log(Ga)));return z(e, +"Complex").$polar(ea,ua)}if(h(z(e,"Integer")["$==="](ea))){if(h("number"===typeof ea?0"](0))){Fa=Ga=this;for(Ra=p(ea,1);h(Ra["$!="](0));){ea=Ra.$divmod(2);ua=a.to_ary(ea);var Pa=null==ua[0]?d:ua[0];var Ha=null==ua[1]?d:ua[1];for(ea;Ha["$=="](0);)Ga=this.$Complex(p(w(Ga.$real(),Ga.$real()),w(Ga.$imag(),Ga.$imag())),w(w(2,Ga.$real()),Ga.$imag())),Ra=Pa,ua=Ra.$divmod(2),ea=a.to_ary(ua),Pa=null==ea[0]?d:ea[0],Ha=null==ea[1]?d:ea[1],ua;Fa=w(Fa,Ga);Ra=p(Ra,1)}return Fa}return t(z(e,"Rational").$new(1, +1),this)["$**"](ea["$-@"]())}return h(h(ua=z(e,"Float")["$==="](ea))?ua:z(e,"Rational")["$==="](ea))?(ua=this.$polar(),Fa=a.to_ary(ua),Ga=null==Fa[0]?d:Fa[0],Fa=null==Fa[1]?d:Fa[1],ua,z(e,"Complex").$polar(Ga["$**"](ea),w(Fa,ea))):this.$__coerced__("**",ea)},r.$$arity=1);a.def(c,"$abs",A=function(){return z(e,"Math").$hypot(this.real,this.imag)},A.$$arity=0);a.def(c,"$abs2",E=function(){return F(w(this.real,this.real),w(this.imag,this.imag))},E.$$arity=0);a.def(c,"$angle",I=function(){return z(e, +"Math").$atan2(this.imag,this.real)},I.$$arity=0);a.alias(c,"arg","angle");a.def(c,"$conj",L=function(){return this.$Complex(this.real,this.imag["$-@"]())},L.$$arity=0);a.alias(c,"conjugate","conj");a.def(c,"$denominator",ba=function(){return this.real.$denominator().$lcm(this.imag.$denominator())},ba.$$arity=0);a.alias(c,"divide","/");a.def(c,"$eql?",va=function(ea){var ua=d,Fa=d;return h(ua=h(Fa=z(e,"Complex")["$==="](ea))?this.real.$class()["$=="](this.imag.$class()):Fa)?this["$=="](ea):ua},va.$$arity= 1);a.def(c,"$fdiv",Oa=function(ea){h(z(e,"Numeric")["$==="](ea))||this.$raise(z(e,"TypeError"),""+ea.$class()+" can't be coerced into Complex");return t(this,ea)},Oa.$$arity=1);a.def(c,"$finite?",wa=function(){var ea;return h(ea=this.real["$finite?"]())?this.imag["$finite?"]():ea},wa.$$arity=0);a.def(c,"$hash",Aa=function(){return"Complex:"+this.real+":"+this.imag},Aa.$$arity=0);a.alias(c,"imaginary","imag");a.def(c,"$infinite?",La=function(){var ea;return h(ea=this.real["$infinite?"]())?ea:this.imag["$infinite?"]()}, La.$$arity=0);a.def(c,"$inspect",na=function(){return"("+this+")"},na.$$arity=0);a.alias(c,"magnitude","abs");a.udef(c,"$negative?");a.def(c,"$numerator",U=function(){var ea=this.$denominator();return this.$Complex(w(this.real.$numerator(),t(ea,this.real.$denominator())),w(this.imag.$numerator(),t(ea,this.imag.$denominator())))},U.$$arity=0);a.alias(c,"phase","arg");a.def(c,"$polar",ra=function(){return[this.$abs(),this.$arg()]},ra.$$arity=0);a.udef(c,"$positive?");a.alias(c,"quo","/");a.def(c,"$rationalize", xa=function(ea){1 $- $* $__coerced__ $+ $Rational $> $** $abs $ceil $with_precision $floor $<= $truncate $send $convert".split(" "));q.$require("corelib/numeric");(function(l,$super,e){l=h(l,$super,"Rational");var n=[l].concat(e),J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka;l.$$prototype.num=l.$$prototype.den=G;a.defs(l,"$reduce",J=function(N,M){N=N.$to_i(); -M=M.$to_i();if(M["$=="](0))this.$raise(f(n,"ZeroDivisionError"),"divided by 0");else if(v(w(M,0)))N=N["$-@"](),M=M["$-@"]();else if(M["$=="](1))return this.$new(N,M);var ja=N.$gcd(M);return this.$new(F(N,ja),F(M,ja))},J.$$arity=2);a.defs(l,"$convert",D=function(N,M){var ja=G,sa=G,ea=G,ua=G,Da=G,Ga=G,Ra=G,Pa=G;v(v(ja=N["$nil?"]())?ja:M["$nil?"]())&&this.$raise(f(n,"TypeError"),"cannot convert nil into Rational");if(v(v(sa=f(n,"Integer")["$==="](N))?f(n,"Integer")["$==="](M):sa))return this.$reduce(N, -M);v(v(ea=v(ua=f(n,"Float")["$==="](N))?ua:f(n,"String")["$==="](N))?ea:f(n,"Complex")["$==="](N))&&(N=N.$to_r());v(v(Da=v(Ga=f(n,"Float")["$==="](M))?Ga:f(n,"String")["$==="](M))?Da:f(n,"Complex")["$==="](M))&&(M=M.$to_r());return v(v(Ra=M["$equal?"](1))?f(n,"Integer")["$==="](N)["$!"]():Ra)?f(n,"Opal")["$coerce_to!"](N,f(n,"Rational"),"to_r"):v(v(Pa=f(n,"Numeric")["$==="](N))?f(n,"Numeric")["$==="](M):Pa)?F(N,M):this.$reduce(N,M)},D.$$arity=2);a.def(l,"$initialize",T=function(N,M){this.num=N;return this.den= +M=M.$to_i();if(M["$=="](0))this.$raise(f(n,"ZeroDivisionError"),"divided by 0");else if(v(w(M,0)))N=N["$-@"](),M=M["$-@"]();else if(M["$=="](1))return this.$new(N,M);var ja=N.$gcd(M);return this.$new(F(N,ja),F(M,ja))},J.$$arity=2);a.defs(l,"$convert",D=function(N,M){var ja=G,sa=G,ea=G,ua=G,Fa=G,Ga=G,Ra=G,Pa=G;v(v(ja=N["$nil?"]())?ja:M["$nil?"]())&&this.$raise(f(n,"TypeError"),"cannot convert nil into Rational");if(v(v(sa=f(n,"Integer")["$==="](N))?f(n,"Integer")["$==="](M):sa))return this.$reduce(N, +M);v(v(ea=v(ua=f(n,"Float")["$==="](N))?ua:f(n,"String")["$==="](N))?ea:f(n,"Complex")["$==="](N))&&(N=N.$to_r());v(v(Fa=v(Ga=f(n,"Float")["$==="](M))?Ga:f(n,"String")["$==="](M))?Fa:f(n,"Complex")["$==="](M))&&(M=M.$to_r());return v(v(Ra=M["$equal?"](1))?f(n,"Integer")["$==="](N)["$!"]():Ra)?f(n,"Opal")["$coerce_to!"](N,f(n,"Rational"),"to_r"):v(v(Pa=f(n,"Numeric")["$==="](N))?f(n,"Numeric")["$==="](M):Pa)?F(N,M):this.$reduce(N,M)},D.$$arity=2);a.def(l,"$initialize",T=function(N,M){this.num=N;return this.den= M},T.$$arity=2);a.def(l,"$numerator",ia=function(){return this.num},ia.$$arity=0);a.def(l,"$denominator",da=function(){return this.den},da.$$arity=0);a.def(l,"$coerce",ma=function(N){return f(n,"Rational")["$==="](N)?[N,this]:f(n,"Integer")["$==="](N)?[N.$to_r(),this]:f(n,"Float")["$==="](N)?[N,this.$to_f()]:G},ma.$$arity=1);a.def(l,"$==",b=function(N){var M=G,ja=G;return f(n,"Rational")["$==="](N)?v(M=this.num["$=="](N.$numerator()))?this.den["$=="](N.$denominator()):M:f(n,"Integer")["$==="](N)? v(ja=this.num["$=="](N))?this.den["$=="](1):ja:f(n,"Float")["$==="](N)?this.$to_f()["$=="](N):N["$=="](this)},b.$$arity=1);a.def(l,"$<=>",m=function(N){return f(n,"Rational")["$==="](N)?p(t(this.num,N.$denominator()),t(this.den,N.$numerator()))["$<=>"](0):f(n,"Integer")["$==="](N)?p(this.num,t(this.den,N))["$<=>"](0):f(n,"Float")["$==="](N)?this.$to_f()["$<=>"](N):this.$__coerced__("<=>",N)},m.$$arity=1);a.def(l,"$+",g=function(N){if(f(n,"Rational")["$==="](N)){var M=y(t(this.num,N.$denominator()), t(this.den,N.$numerator()));N=t(this.den,N.$denominator());M=this.$Rational(M,N)}else M=f(n,"Integer")["$==="](N)?this.$Rational(y(this.num,t(N,this.den)),this.den):f(n,"Float")["$==="](N)?y(this.$to_f(),N):this.$__coerced__("+",N);return M},g.$$arity=1);a.def(l,"$-",r=function(N){if(f(n,"Rational")["$==="](N)){var M=p(t(this.num,N.$denominator()),t(this.den,N.$numerator()));N=t(this.den,N.$denominator());M=this.$Rational(M,N)}else M=f(n,"Integer")["$==="](N)?this.$Rational(p(this.num,t(N,this.den)), @@ -564,39 +564,39 @@ this.den):f(n,"Float")["$==="](N)?p(this.$to_f(),N):this.$__coerced__("-",N);ret t(this.den,N.$numerator());M=this.$Rational(M,N)}else M=f(n,"Integer")["$==="](N)?N["$=="](0)?F(this.$to_f(),0):this.$Rational(this.num,t(this.den,N)):f(n,"Float")["$==="](N)?F(this.$to_f(),N):this.$__coerced__("/",N);return M},E.$$arity=1);a.def(l,"$**",I=function(N){var M=G,ja=G;return f(n,"Integer")["$==="](N)?v(v(M=this["$=="](0))?w(N,0):M)?z(f(n,"Float"),"INFINITY"):v("number"===typeof N?0"](0))?this.$Rational(this.num["$**"](N),this.den["$**"](N)):v(w(N,0))?this.$Rational(this.den["$**"](N["$-@"]()), this.num["$**"](N["$-@"]())):this.$Rational(1,1):f(n,"Float")["$==="](N)?this.$to_f()["$**"](N):f(n,"Rational")["$==="](N)?N["$=="](0)?this.$Rational(1,1):N.$denominator()["$=="](1)?v(w(N,0))?this.$Rational(this.den["$**"](N.$numerator().$abs()),this.num["$**"](N.$numerator().$abs())):this.$Rational(this.num["$**"](N.$numerator()),this.den["$**"](N.$numerator())):v(v(ja=this["$=="](0))?w(N,0):ja)?this.$raise(f(n,"ZeroDivisionError"),"divided by 0"):this.$to_f()["$**"](N):this.$__coerced__("**",N)}, I.$$arity=1);a.def(l,"$abs",L=function(){return this.$Rational(this.num.$abs(),this.den.$abs())},L.$$arity=0);a.def(l,"$ceil",ba=function(N){null==N&&(N=0);return N["$=="](0)?F(this.num["$-@"](),this.den)["$-@"]().$ceil():this.$with_precision("ceil",N)},ba.$$arity=-1);a.alias(l,"divide","/");a.def(l,"$floor",va=function(N){null==N&&(N=0);return N["$=="](0)?F(this.num["$-@"](),this.den)["$-@"]().$floor():this.$with_precision("floor",N)},va.$$arity=-1);a.def(l,"$hash",Oa=function(){return"Rational:"+ -this.num+":"+this.den},Oa.$$arity=0);a.def(l,"$inspect",wa=function(){return"("+this+")"},wa.$$arity=0);a.alias(l,"quo","/");a.def(l,"$rationalize",Aa=function(N){1 $to_f $nil? $> $< $strftime $year $month $day $+ $round $/ $- $copy_instance_variables $initialize_dup $is_a? $zero? $wday $utc? $mon $yday $hour $min $sec $rjust $ljust $zone $to_s $[] $cweek_cyear $isdst $<= $!= $== $ceil".split(" ")); -y.$require("corelib/comparable");return function(c,$super,H){function e(za,ta,Ma,Sa,Za,Ea){za=za.$$is_string?parseInt(za,10):G(J,"Opal")["$coerce_to!"](za,G(J,"Integer"),"to_int");if(ta===d)ta=1;else if(!ta.$$is_number)if(ta["$respond_to?"]("to_str"))switch(ta=ta.$to_str(),ta.toLowerCase()){case "jan":ta=1;break;case "feb":ta=2;break;case "mar":ta=3;break;case "apr":ta=4;break;case "may":ta=5;break;case "jun":ta=6;break;case "jul":ta=7;break;case "aug":ta=8;break;case "sep":ta=9;break;case "oct":ta= +y.$require("corelib/comparable");return function(c,$super,H){function e(za,ta,Ma,Sa,Za,Da){za=za.$$is_string?parseInt(za,10):G(J,"Opal")["$coerce_to!"](za,G(J,"Integer"),"to_int");if(ta===d)ta=1;else if(!ta.$$is_number)if(ta["$respond_to?"]("to_str"))switch(ta=ta.$to_str(),ta.toLowerCase()){case "jan":ta=1;break;case "feb":ta=2;break;case "mar":ta=3;break;case "apr":ta=4;break;case "may":ta=5;break;case "jun":ta=6;break;case "jul":ta=7;break;case "aug":ta=8;break;case "sep":ta=9;break;case "oct":ta= 10;break;case "nov":ta=11;break;case "dec":ta=12;break;default:ta=ta.$to_i()}else ta=G(J,"Opal")["$coerce_to!"](ta,G(J,"Integer"),"to_int");(1>ta||12Ma||31Sa||24Za||59Ea||60za&&ta.setFullYear(za);return ta},T.$$arity=-1);a.defs(n,"$local",ia=function(za,ta,Ma,Sa,Za,Ea,Y,S,Z,V){null==ta&&(ta=d);null==Ma&&(Ma=d);null==Sa&&(Sa=d);null==Za&&(Za=d);null==Ea&&(Ea=d);null==Y&&(Y=d);null==S&&(S=d);null==Z&&(Z=d);null==V&&(V=d);if(10===arguments.length){var fa= -z.call(arguments);za=fa[5];ta=fa[4];Ma=fa[3];Sa=fa[2];Za=fa[1];Ea=fa[0]}fa=e(za,ta,Ma,Sa,Za,Ea);za=fa[0];ta=fa[1];Ma=fa[2];Sa=fa[3];Za=fa[4];Ea=fa[5];fa=new Date(za,ta,Ma,Sa,Za,0,1E3*Ea);100>za&&fa.setFullYear(za);return fa},ia.$$arity=-2);a.defs(n,"$gm",da=function(za,ta,Ma,Sa,Za,Ea,Y,S,Z,V){null==ta&&(ta=d);null==Ma&&(Ma=d);null==Sa&&(Sa=d);null==Za&&(Za=d);null==Ea&&(Ea=d);null==Y&&(Y=d);null==S&&(S=d);null==Z&&(Z=d);null==V&&(V=d);if(10===arguments.length){var fa=z.call(arguments);za=fa[5];ta= -fa[4];Ma=fa[3];Sa=fa[2];Za=fa[1];Ea=fa[0]}fa=e(za,ta,Ma,Sa,Za,Ea);za=fa[0];ta=fa[1];Ma=fa[2];Sa=fa[3];Za=fa[4];Ea=fa[5];fa=new Date(Date.UTC(za,ta,Ma,Sa,Za,0,1E3*Ea));100>za&&fa.setUTCFullYear(za);fa.is_utc=!0;return fa},da.$$arity=-2);(function(za,ta){[za].concat(ta);a.alias(za,"mktime","local");return a.alias(za,"utc","gm")})(a.get_singleton_class(n),J);a.defs(n,"$now",ma=function(){return this.$new()},ma.$$arity=0);a.def(n,"$+",b=function(za){h(G(J,"Time")["$==="](za))&&this.$raise(G(J,"TypeError"), +"ArgumentError"),"hour out of range: "+Sa);Za=Za===d?0:Za.$$is_string?parseInt(Za,10):G(J,"Opal")["$coerce_to!"](Za,G(J,"Integer"),"to_int");(0>Za||59Da||60za&&ta.setFullYear(za);return ta},T.$$arity=-1);a.defs(n,"$local",ia=function(za,ta,Ma,Sa,Za,Da,Y,R,Z,V){null==ta&&(ta=d);null==Ma&&(Ma=d);null==Sa&&(Sa=d);null==Za&&(Za=d);null==Da&&(Da=d);null==Y&&(Y=d);null==R&&(R=d);null==Z&&(Z=d);null==V&&(V=d);if(10===arguments.length){var fa= +z.call(arguments);za=fa[5];ta=fa[4];Ma=fa[3];Sa=fa[2];Za=fa[1];Da=fa[0]}fa=e(za,ta,Ma,Sa,Za,Da);za=fa[0];ta=fa[1];Ma=fa[2];Sa=fa[3];Za=fa[4];Da=fa[5];fa=new Date(za,ta,Ma,Sa,Za,0,1E3*Da);100>za&&fa.setFullYear(za);return fa},ia.$$arity=-2);a.defs(n,"$gm",da=function(za,ta,Ma,Sa,Za,Da,Y,R,Z,V){null==ta&&(ta=d);null==Ma&&(Ma=d);null==Sa&&(Sa=d);null==Za&&(Za=d);null==Da&&(Da=d);null==Y&&(Y=d);null==R&&(R=d);null==Z&&(Z=d);null==V&&(V=d);if(10===arguments.length){var fa=z.call(arguments);za=fa[5];ta= +fa[4];Ma=fa[3];Sa=fa[2];Za=fa[1];Da=fa[0]}fa=e(za,ta,Ma,Sa,Za,Da);za=fa[0];ta=fa[1];Ma=fa[2];Sa=fa[3];Za=fa[4];Da=fa[5];fa=new Date(Date.UTC(za,ta,Ma,Sa,Za,0,1E3*Da));100>za&&fa.setUTCFullYear(za);fa.is_utc=!0;return fa},da.$$arity=-2);(function(za,ta){[za].concat(ta);a.alias(za,"mktime","local");return a.alias(za,"utc","gm")})(a.get_singleton_class(n),J);a.defs(n,"$now",ma=function(){return this.$new()},ma.$$arity=0);a.def(n,"$+",b=function(za){h(G(J,"Time")["$==="](za))&&this.$raise(G(J,"TypeError"), "time + time?");za.$$is_number||(za=G(J,"Opal")["$coerce_to!"](za,G(J,"Integer"),"to_int"));za=new Date(this.getTime()+1E3*za);za.is_utc=this.is_utc;return za},b.$$arity=1);a.def(n,"$-",m=function(za){if(h(G(J,"Time")["$==="](za)))return(this.getTime()-za.getTime())/1E3;za.$$is_number||(za=G(J,"Opal")["$coerce_to!"](za,G(J,"Integer"),"to_int"));za=new Date(this.getTime()-1E3*za);za.is_utc=this.is_utc;return za},m.$$arity=1);a.def(n,"$<=>",g=function(za){if(h(G(J,"Time")["$==="](za)))return this.$to_f()["$<=>"](za.$to_f()); za=za["$<=>"](this);return h(za["$nil?"]())?d:h("number"===typeof za?0"](0))?-1:h("number"===typeof za?0>za:za["$<"](0))?1:0},g.$$arity=1);a.def(n,"$==",r=function(za){var ta;return h(ta=G(J,"Time")["$==="](za))?this.$to_f()===za.$to_f():ta},r.$$arity=1);a.def(n,"$asctime",A=function(){return this.$strftime("%a %b %e %H:%M:%S %Y")},A.$$arity=0);a.alias(n,"ctime","asctime");a.def(n,"$day",E=function(){return this.is_utc?this.getUTCDate():this.getDate()},E.$$arity=0);a.def(n,"$yday",I=function(){var za= G(J,"Time").$new(this.$year()).$to_i();var ta=G(J,"Time").$new(this.$year(),this.$month(),this.$day()).$to_i();return w(F(p(ta,za),86400).$round(),1)},I.$$arity=0);a.def(n,"$isdst",L=function(){var za=new Date(this.getFullYear(),0,1),ta=new Date(this.getFullYear(),6,1);return this.getTimezoneOffset()"](za)["$zero?"]():ta},va.$$arity=1);a.def(n,"$friday?",Oa=function(){return 5==this.$wday()},Oa.$$arity=0);a.def(n,"$hash",wa=function(){return"Time:"+this.getTime()},wa.$$arity=0);a.def(n,"$hour",Aa=function(){return this.is_utc?this.getUTCHours():this.getHours()},Aa.$$arity=0);a.def(n,"$inspect",La=function(){return h(this["$utc?"]())?this.$strftime("%Y-%m-%d %H:%M:%S UTC"):this.$strftime("%Y-%m-%d %H:%M:%S %z")}, La.$$arity=0);a.alias(n,"mday","day");a.def(n,"$min",na=function(){return this.is_utc?this.getUTCMinutes():this.getMinutes()},na.$$arity=0);a.def(n,"$mon",U=function(){return(this.is_utc?this.getUTCMonth():this.getMonth())+1},U.$$arity=0);a.def(n,"$monday?",ra=function(){return 1==this.$wday()},ra.$$arity=0);a.alias(n,"month","mon");a.def(n,"$saturday?",xa=function(){return 6==this.$wday()},xa.$$arity=0);a.def(n,"$sec",Ja=function(){return this.is_utc?this.getUTCSeconds():this.getSeconds()},Ja.$$arity= 0);a.def(n,"$succ",ka=function(){var za=new Date(this.getTime()+1E3);za.is_utc=this.is_utc;return za},ka.$$arity=0);a.def(n,"$usec",N=function(){return 1E3*this.getMilliseconds()},N.$$arity=0);a.def(n,"$zone",M=function(){var za=this.toString();var ta=-1==za.indexOf("(")?za.match(/[A-Z]{3,4}/)[0]:za.match(/\((.+)\)(?:\s|$)/)[1];return"GMT"==ta&&/(GMT\W*\d{4})/.test(za)?RegExp.$1:ta},M.$$arity=0);a.def(n,"$getgm",ja=function(){var za=new Date(this.getTime());za.is_utc=!0;return za},ja.$$arity=0);a.alias(n, -"getutc","getgm");a.def(n,"$gmtime",sa=function(){this.is_utc=!0;return this},sa.$$arity=0);a.alias(n,"utc","gmtime");a.def(n,"$gmt?",ea=function(){return!0===this.is_utc},ea.$$arity=0);a.def(n,"$gmt_offset",ua=function(){return this.is_utc?0:60*-this.getTimezoneOffset()},ua.$$arity=0);a.def(n,"$strftime",Da=function(za){var ta=this;return za.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g,function(Ma,Sa,Za,Ea,Y){Ea="";var S=-1!==Sa.indexOf("0"),Z=-1===Sa.indexOf("-"),V=-1!==Sa.indexOf("_"),fa=-1!== -Sa.indexOf("^"),la=-1!==Sa.indexOf("#"),k=(Sa.match(":")||[]).length;Za=parseInt(Za,10);S&&V&&(Sa.indexOf("0")Ma?"+":"-")+(10>Sa?"0":"")+Sa;0Y?"0":"";Ea+=Y;1Ma?"+":"-")+(10>Sa?"0":"")+Sa;0Y?"0":"";Da+=Y;1H:l["$>"](H)}function F(l,H){return"number"===typeof l&&"number"===typeof H?l-H:l["$-"](H)}function p(l,H){return"number"===typeof l&&"number"===typeof H?l=H:l["$>="](H)}function y(l,H){return"number"===typeof l&&"number"===typeof H?l+H:l["$+"](H)}var q=a.top,d=[],G=a.nil,z=a.$$,f=a.klass,h=a.hash2,v=a.truthy,c=a.send; a.add_stubs("$require $include $const_name! $unshift $map $coerce_to! $new $each $define_struct_attribute $allocate $initialize $alias_method $module_eval $to_proc $const_set $== $raise $<< $members $define_method $instance_eval $class $last $> $length $- $keys $any? $join $[] $[]= $each_with_index $hash $=== $< $-@ $size $>= $include? $to_sym $instance_of? $__id__ $eql? $enum_for $name $+ $each_pair $inspect $to_h $args $each_with_object $flatten $to_a $respond_to? $dig".split(" "));q.$require("corelib/enumerable"); return function(l,$super,e){l=f(l,$super,"Struct");var n=[l].concat(e),J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La;l.$include(z(n,"Enumerable"));a.defs(l,"$new",J=function(na,U,ra){var xa=J.$$p,Ja=xa||G,ka,N;var M=G;xa&&(J.$$p=null);xa&&(J.$$p=null);var ja=a.slice.call(arguments,1,arguments.length);M=a.extract_kwargs(ja);if(null==M)M=h([],{});else if(!M.$$is_hash)throw a.ArgumentError.$new("expected kwargs");xa=M.$$smap.keyword_init;null==xa&&(xa=!1);if(v(na))try{na=z(n,"Opal")["$const_name!"](na)}catch(sa){if(a.rescue(sa, -[z(n,"TypeError"),z(n,"NameError")]))try{ja.$unshift(na),na=G}finally{a.pop_exception()}else throw sa;}c(ja,"map",[],(ka=function(sa){null==sa&&(sa=G);return z(n,"Opal")["$coerce_to!"](sa,z(n,"String"),"to_str")},ka.$$s=this,ka.$$arity=1,ka));M=c(z(n,"Class"),"new",[this],(N=function(){var sa=null==N.$$s?this:N.$$s,ea;c(ja,"each",[],(ea=function(ua){var Da=null==ea.$$s?this:ea.$$s;null==ua&&(ua=G);return Da.$define_struct_attribute(ua)},ea.$$s=sa,ea.$$arity=1,ea));return function(ua,Da){[ua].concat(Da); +[z(n,"TypeError"),z(n,"NameError")]))try{ja.$unshift(na),na=G}finally{a.pop_exception()}else throw sa;}c(ja,"map",[],(ka=function(sa){null==sa&&(sa=G);return z(n,"Opal")["$coerce_to!"](sa,z(n,"String"),"to_str")},ka.$$s=this,ka.$$arity=1,ka));M=c(z(n,"Class"),"new",[this],(N=function(){var sa=null==N.$$s?this:N.$$s,ea;c(ja,"each",[],(ea=function(ua){var Fa=null==ea.$$s?this:ea.$$s;null==ua&&(ua=G);return Fa.$define_struct_attribute(ua)},ea.$$s=sa,ea.$$arity=1,ea));return function(ua,Fa){[ua].concat(Fa); var Ga;a.def(ua,"$new",Ga=function(Ra){var Pa=a.slice.call(arguments,0,arguments.length);var Ha=this.$allocate();Ha.$$data={};c(Ha,"initialize",a.to_a(Pa));return Ha},Ga.$$arity=-1);return ua.$alias_method("[]","new")}(a.get_singleton_class(sa),n)},N.$$s=this,N.$$arity=0,N));v(Ja)&&c(M,"module_eval",[],Ja.$to_proc());M.$$keyword_init=xa;v(na)&&z(n,"Struct").$const_set(na,M);return M},J.$$arity=-2);a.defs(l,"$define_struct_attribute",D=function(na){var U,ra;this["$=="](z(n,"Struct"))&&this.$raise(z(n, "ArgumentError"),"you cannot define attributes to the Struct class");this.$members()["$<<"](na);c(this,"define_method",[na],(U=function(){return(null==U.$$s?this:U.$$s).$$data[na]},U.$$s=this,U.$$arity=0,U));return c(this,"define_method",[""+na+"="],(ra=function(xa){var Ja=null==ra.$$s?this:ra.$$s;null==xa&&(xa=G);return Ja.$$data[na]=xa},ra.$$s=this,ra.$$arity=1,ra))},D.$$arity=1);a.defs(l,"$members",T=function(){var na=G;null==this.members&&(this.members=G);this["$=="](z(n,"Struct"))&&this.$raise(z(n, "ArgumentError"),"the Struct class has no members");return this.members=v(na=this.members)?na:[]},T.$$arity=0);a.defs(l,"$inherited",ia=function(na){var U,ra=G;null==this.members&&(this.members=G);ra=this.members;return c(na,"instance_eval",[],(U=function(){return(null==U.$$s?this:U.$$s).members=ra},U.$$s=this,U.$$arity=0,U))},ia.$$arity=1);a.def(l,"$initialize",da=function(na){var U,ra,xa=G,Ja=G,ka=G,N=G;var M=a.slice.call(arguments,0,arguments.length);if(v(this.$class().$$keyword_init))return xa= @@ -656,29 +656,29 @@ null,y);(function(h,v){h=z(h,"Kernel");[h].concat(v);var c;a.def(h,"$private_met (d(c,"RUBY_ENGINE_VERSION")+"/docs/opal_parser.md for details."))},l.$$arity=-1)})(y[0],y);a.defs(t,"$public",F=function(h){a.slice.call(arguments,0,arguments.length);return q},F.$$arity=-1);return(a.defs(t,"$private",p=function(h){a.slice.call(arguments,0,arguments.length);return q},p.$$arity=-1),q)&&"private"};var rb=Opal.top;Opal.add_stubs(["$require"]);rb.$require("opal/base");rb.$require("opal/mini");rb.$require("corelib/kernel/format");rb.$require("corelib/string/encoding");rb.$require("corelib/math"); rb.$require("corelib/complex");rb.$require("corelib/rational");rb.$require("corelib/time");rb.$require("corelib/struct");rb.$require("corelib/io");rb.$require("corelib/main");rb.$require("corelib/dir");rb.$require("corelib/file");rb.$require("corelib/process");rb.$require("corelib/random");rb.$require("corelib/random/mersenne_twister");rb.$require("corelib/unsupported"); (function(a){function w(v,c){return"number"===typeof v&&"number"===typeof c?v+c:v["$+"](c)}function F(v,c){return"number"===typeof v&&"number"===typeof c?v-c:v["$-"](c)}function p(v,c){return"number"===typeof v&&"number"===typeof c?v $attr_reader $nonzero? $d $zero? $new $class $-@ $+@ $=== $coerce $== $> $+ $allocate $join $compact $map $to_proc $downcase $wrap $raise $clone $jd $>> $wday $year $month $day $- $to_s $to_i $< $* $reverse $step $abs $each".split(" ")); -return function(v,$super,l){function H(R,ya){return[31,0===R%4&&0!==R%100||0===R%400?29:28,31,30,31,30,31,31,30,31,30,31][ya]}v=G(v,$super,"Date");var e=[v].concat(l),n,J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Da,Ga,Ra,Pa,Ha,eb,kb;v.$$prototype.date=y;v.$include(d(e,"Comparable"));(function(R,$super,Ca){R=G(R,$super,"Infinity");var Ua=[R].concat(Ca),ib,cb,ab,Xa,za,ta,Ma,Sa,Za,Ea,Y;R.$$prototype.d=y;R.$include(d(Ua,"Comparable"));a.def(R,"$initialize",ib=function(S){null== -S&&(S=1);return this.d=S["$<=>"](0)},ib.$$arity=-1);R.$attr_reader("d");a.def(R,"$zero?",cb=function(){return!1},cb.$$arity=0);a.def(R,"$finite?",ab=function(){return!1},ab.$$arity=0);a.def(R,"$infinite?",Xa=function(){return this.$d()["$nonzero?"]()},Xa.$$arity=0);a.def(R,"$nan?",za=function(){return this.$d()["$zero?"]()},za.$$arity=0);a.def(R,"$abs",ta=function(){return this.$class().$new()},ta.$$arity=0);a.def(R,"$-@",Ma=function(){return this.$class().$new(this.$d()["$-@"]())},Ma.$$arity=0); -a.def(R,"$+@",Sa=function(){return this.$class().$new(this.$d()["$+@"]())},Sa.$$arity=0);a.def(R,"$<=>",Za=function(S){var Z,V,fa=this,la=y,k=y,C=y;return function(){la=S;if(d(Ua,"Infinity")["$==="](la))return fa.$d()["$<=>"](S.$d());if(d(Ua,"Numeric")["$==="](la))return fa.$d();try{return V=S.$coerce(fa),Z=a.to_ary(V),k=null==Z[0]?y:Z[0],C=null==Z[1]?y:Z[1],V,k["$<=>"](C)}catch(O){if(a.rescue(O,[d(Ua,"NoMethodError")]))try{return y}finally{a.pop_exception()}else throw O;}}()},Za.$$arity=1);a.def(R, -"$coerce",Ea=function(S){var Z=Ea.$$p,V;Z&&(Ea.$$p=null);var fa=0;var la=arguments.length;for(V=Array(la);fa"](0);return f(S)?q(d(Ua,"Float"),"INFINITY"):q(d(Ua,"Float"),"INFINITY")["$-@"]()},Y.$$arity=0),y)&&"to_f"})(e[0], +return function(v,$super,l){function H(S,ya){return[31,0===S%4&&0!==S%100||0===S%400?29:28,31,30,31,30,31,31,30,31,30,31][ya]}v=G(v,$super,"Date");var e=[v].concat(l),n,J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Fa,Ga,Ra,Pa,Ha,fb,kb;v.$$prototype.date=y;v.$include(d(e,"Comparable"));(function(S,$super,Ca){S=G(S,$super,"Infinity");var Va=[S].concat(Ca),cb,db,ab,Ya,za,ta,Ma,Sa,Za,Da,Y;S.$$prototype.d=y;S.$include(d(Va,"Comparable"));a.def(S,"$initialize",cb=function(R){null== +R&&(R=1);return this.d=R["$<=>"](0)},cb.$$arity=-1);S.$attr_reader("d");a.def(S,"$zero?",db=function(){return!1},db.$$arity=0);a.def(S,"$finite?",ab=function(){return!1},ab.$$arity=0);a.def(S,"$infinite?",Ya=function(){return this.$d()["$nonzero?"]()},Ya.$$arity=0);a.def(S,"$nan?",za=function(){return this.$d()["$zero?"]()},za.$$arity=0);a.def(S,"$abs",ta=function(){return this.$class().$new()},ta.$$arity=0);a.def(S,"$-@",Ma=function(){return this.$class().$new(this.$d()["$-@"]())},Ma.$$arity=0); +a.def(S,"$+@",Sa=function(){return this.$class().$new(this.$d()["$+@"]())},Sa.$$arity=0);a.def(S,"$<=>",Za=function(R){var Z,V,fa=this,la=y,k=y,C=y;return function(){la=R;if(d(Va,"Infinity")["$==="](la))return fa.$d()["$<=>"](R.$d());if(d(Va,"Numeric")["$==="](la))return fa.$d();try{return V=R.$coerce(fa),Z=a.to_ary(V),k=null==Z[0]?y:Z[0],C=null==Z[1]?y:Z[1],V,k["$<=>"](C)}catch(O){if(a.rescue(O,[d(Va,"NoMethodError")]))try{return y}finally{a.pop_exception()}else throw O;}}()},Za.$$arity=1);a.def(S, +"$coerce",Da=function(R){var Z=Da.$$p,V;Z&&(Da.$$p=null);var fa=0;var la=arguments.length;for(V=Array(la);fa"](0);return f(R)?q(d(Va,"Float"),"INFINITY"):q(d(Va,"Float"),"INFINITY")["$-@"]()},Y.$$arity=0),y)&&"to_f"})(e[0], d(e,"Numeric"),e);a.const_set(e[0],"JULIAN",d(e,"Infinity").$new());a.const_set(e[0],"GREGORIAN",d(e,"Infinity").$new()["$-@"]());a.const_set(e[0],"ITALY",2299161);a.const_set(e[0],"ENGLAND",2361222);a.const_set(e[0],"MONTHNAMES",w([y],"January February March April May June July August September October November December".split(" ")));a.const_set(e[0],"ABBR_MONTHNAMES","jan feb mar apr may jun jul aug sep oct nov dec".split(" "));a.const_set(e[0],"DAYNAMES","Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ")); -a.const_set(e[0],"ABBR_DAYNAMES","Sun Mon Tue Wed Thu Fri Sat".split(" "));(function(R,ya){var Ca=[R].concat(ya),Ua,ib,cb,ab;a.alias(R,"civil","new");a.def(R,"$wrap",Ua=function(Xa){var za=this.$allocate();za.date=Xa;return za},Ua.$$arity=1);a.def(R,"$parse",ib=function(Xa,za){function ta(aa){return aa[1]}function Ma(aa){return aa[2]}function Sa(aa){return aa[3]}function Za(aa){return aa[4]}function Ea(aa){return function(x){x=aa(x);return 69<=x?x+1900:x+2E3}}function Y(aa){return function(x){x=aa(x).toLowerCase(); -return d(Ca,"ABBR_MONTHNAMES").indexOf(x)+1}}function S(aa){return function(x){x=aa(x);return parseInt(x,10)}}function Z(aa){return function(x){x=aa(x);return h(d(Ca,"MONTHNAMES").$compact(),"map",[],"downcase".$to_proc()).indexOf(x.$downcase())+1}}null==za&&(za=!0);var V=new Date,fa=V.getDate(),la=V.getMonth(),k=V.getFullYear(),C=V.getDay();V=d(Ca,"MONTHNAMES").$compact().$join("|");V=[{regexp:/^(\d{2})$/,year:k,month:la,day:S(ta)},{regexp:/^(\d{3})$/,year:k,month:0,day:S(ta)},{regexp:/^(\d{2})(\d{2})$/, -year:k,month:S(ta),day:S(Ma)},{regexp:/^(\d{2})(\d{3})$/,year:Ea(S(ta)),month:0,day:S(Ma)},{regexp:/^(\d{2})(\d{2})(\d{2})$/,year:Ea(S(ta)),month:S(Ma),day:S(Sa)},{regexp:/^(\d{4})(\d{3})$/,year:S(ta),month:0,day:S(Ma)},{regexp:/^(\d{4})(\d{2})(\d{2})$/,year:S(ta),month:S(Ma),day:S(Sa)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{3,4})$/,year:S(Ma),month:Y(ta),day:1},{regexp:/^(\d{1,2})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{3,4})$/i,year:S(Sa),month:Y(Ma),day:S(ta)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{3,4})$/i, -year:S(Sa),month:Y(ta),day:S(Ma)},{regexp:/^(\d{3,4})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{1,2})$/i,year:S(ta),month:Y(Ma),day:S(Sa)},{regexp:/^(\-?\d{3,4})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:S(ta),month:S(Ma),day:S(Sa)},{regexp:/^(\d{2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:function(aa){return function(x){x=aa(x);return za?x+2E3:x}}(S(ta)),month:S(Ma),day:S(Sa)},{regexp:/^(\d{1,2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\-?\d{3,4})$/,year:S(Sa),month:S(Ma),day:S(ta)},{regexp:new RegExp("^("+ -d(Ca,"DAYNAMES").$join("|")+")$","i"),year:k,month:la,day:function(aa){return function(x){x=aa(x);x=h(d(Ca,"DAYNAMES"),"map",[],"downcase".$to_proc()).indexOf(x.$downcase());return fa-C+x}}(ta)},{regexp:new RegExp("^("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-](\\-?\\d{3,4})$","i"),year:S(Za),month:Z(ta),day:S(Ma)},{regexp:new RegExp("^("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)","i"),year:k,month:Z(ta),day:S(Ma)},{regexp:new RegExp("^(\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-]("+V+")[\\s\\.\\/\\-](\\-?\\d{3,4})$", -"i"),year:S(Za),month:Z(Sa),day:S(ta)},{regexp:new RegExp("^(\\-?\\d{3,4})[\\s\\.\\/\\-]("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)$","i"),year:S(ta),month:Z(Ma),day:S(Sa)}];var O;for(O=0;O=Xa&&la.setFullYear(Xa),this.$wrap(la);return this.$raise(d(Ca,"ArgumentError"),"invalid date")},ib.$$arity= --2);a.def(R,"$today",cb=function(){return this.$wrap(new Date)},cb.$$arity=0);return(a.def(R,"$gregorian_leap?",ab=function(Xa){return 0===(new Date(Xa,1,29)).getMonth()-1},ab.$$arity=1),y)&&"gregorian_leap?"})(a.get_singleton_class(v),e);a.def(v,"$initialize",n=function(R,ya,Ca,Ua){null==R&&(R=-4712);null==ya&&(ya=1);null==Ca&&(Ca=1);null==Ua&&d(e,"ITALY");1582===R&&10===ya&&4Ca&&(Ca=4);return this.date=new Date(R,ya-1,Ca)},n.$$arity=-1);a.def(v,"$-",J=function(R){if(R.$$is_number){var ya= -this.$clone();ya.date.setDate(this.date.getDate()-R);return ya}if(R.date)return Math.round((this.date-R.date)/864E5);this.$raise(d(e,"TypeError"))},J.$$arity=1);a.def(v,"$+",D=function(R){if(R.$$is_number){var ya=this.$clone();ya.date.setDate(this.date.getDate()+R);return ya}this.$raise(d(e,"TypeError"))},D.$$arity=1);a.def(v,"$<",T=function(R){var ya=this.date;R=R.date;ya.setHours(0,0,0,0);R.setHours(0,0,0,0);return ya",da=function(R){var ya=this.date;R=R.date;ya.setHours(0,0,0,0);R.setHours(0,0,0,0);return ya>R},da.$$arity=1);a.def(v,"$>=",ma=function(R){var ya=this.date;R=R.date;ya.setHours(0,0,0,0);R.setHours(0,0,0,0);return ya>=R},ma.$$arity=1);a.def(v,"$<=>",b=function(R){if(R.$$is_number)return this.$jd()["$<=>"](R);if(d(e,"Date")["$==="](R)){var ya=this.date;R=R.date;ya.setHours(0,0,0,0);R.setHours(0,0,0,0);return yaR?1:0}return y}, -b.$$arity=1);a.def(v,"$>>",m=function(R){R.$$is_number||this.$raise(d(e,"TypeError"));var ya=this.$clone(),Ca=ya.date,Ua=Ca.getDate();Ca.setDate(1);Ca.setMonth(Ca.getMonth()+R);Ca.setDate(Math.min(Ua,H(Ca.getFullYear(),Ca.getMonth())));return ya},m.$$arity=1);a.def(v,"$<<",g=function(R){R.$$is_number||this.$raise(d(e,"TypeError"));return this["$>>"](-R)},g.$$arity=1);a.alias(v,"eql?","==");a.def(v,"$clone",r=function(){return d(e,"Date").$wrap(new Date(this.date.getTime()))},r.$$arity=0);a.def(v, -"$day",A=function(){return this.date.getDate()},A.$$arity=0);a.def(v,"$friday?",E=function(){return this.$wday()["$=="](5)},E.$$arity=0);a.def(v,"$jd",I=function(){var R=this.date.getMonth()+1,ya=this.date.getDate(),Ca=this.date.getFullYear();var Ua=1;1585>=Ca&&(Ua=0);var ib=-1*Math.floor(7*(Math.floor((R+9)/12)+Ca)/4);var cb=1;0>R-9&&(cb=-1);cb=Math.floor(Ca+cb*Math.floor(Math.abs(R-9)/7));cb=-1*Math.floor(3*(Math.floor(cb/100)+1)/4);ib=ib+Math.floor(275*R/9)+ya+Ua*cb;return ib+1721027+2*Ua+367* -Ca-.5+.5},I.$$arity=0);a.def(v,"$julian?",L=function(){return this.dateCa&&(Ca="0"+Ca);10>R&&(R="0"+R);return ya+"-"+Ca+"-"+R},M.$$arity=0);a.def(v,"$to_time",ja=function(){return d(e,"Time").$new(this.$year(),this.$month(),this.$day())},ja.$$arity=0);a.def(v,"$to_n",sa=function(){return this.date},sa.$$arity=0);a.def(v,"$tuesday?",ea=function(){return this.$wday()["$=="](2)},ea.$$arity=0);a.def(v,"$step", -ua=function(R,ya){var Ca=ua.$$p,Ua=Ca||y,ib,cb,ab=y;ab=ab=y;Ca&&(ua.$$p=null);Ca&&(ua.$$p=null);null==ya&&(ya=1);ab=F(R,this).$to_i();ab=f(p("number"===typeof ab&&"number"===typeof ya?ab*ya:ab["$*"](ya),0))?[]:f(p(ab,0))?h(a.Range.$new(0,ab["$-@"](),!1).$step(ya.$abs()),"map",[],"-@".$to_proc()).$reverse():a.Range.$new(0,ab,!1).$step(ya.$abs());ab=h(ab,"map",[],(ib=function(Xa){var za=null==ib.$$s?this:ib.$$s;null==Xa&&(Xa=y);return w(za,Xa)},ib.$$s=this,ib.$$arity=1,ib));return Ua!==y?(h(ab,"each", -[],(cb=function(Xa){null==Xa&&(Xa=y);return a.yield1(Ua,Xa)},cb.$$s=this,cb.$$arity=1,cb)),this):ab},ua.$$arity=-2);a.def(v,"$upto",Da=function(R){var ya=Da.$$p,Ca=ya||y;ya&&(Da.$$p=null);ya&&(Da.$$p=null);return h(this,"step",[R,1],Ca.$to_proc())},Da.$$arity=1);a.def(v,"$downto",Ga=function(R){var ya=Ga.$$p,Ca=ya||y;ya&&(Ga.$$p=null);ya&&(Ga.$$p=null);return h(this,"step",[R,-1],Ca.$to_proc())},Ga.$$arity=1);a.def(v,"$wday",Ra=function(){return this.date.getDay()},Ra.$$arity=0);a.def(v,"$wednesday?", -Pa=function(){return this.$wday()["$=="](3)},Pa.$$arity=0);a.def(v,"$year",Ha=function(){return this.date.getFullYear()},Ha.$$arity=0);a.def(v,"$cwday",eb=function(){return this.date.getDay()||7},eb.$$arity=0);a.def(v,"$cweek",kb=function(){var R=new Date(this.date);R.setHours(0,0,0);R.setDate(R.getDate()+4-(R.getDay()||7));return Math.ceil(((R-new Date(R.getFullYear(),0,1))/864E5+1)/7)},kb.$$arity=0)}(t[0],null,t)})(Opal); +a.const_set(e[0],"ABBR_DAYNAMES","Sun Mon Tue Wed Thu Fri Sat".split(" "));(function(S,ya){var Ca=[S].concat(ya),Va,cb,db,ab;a.alias(S,"civil","new");a.def(S,"$wrap",Va=function(Ya){var za=this.$allocate();za.date=Ya;return za},Va.$$arity=1);a.def(S,"$parse",cb=function(Ya,za){function ta(aa){return aa[1]}function Ma(aa){return aa[2]}function Sa(aa){return aa[3]}function Za(aa){return aa[4]}function Da(aa){return function(x){x=aa(x);return 69<=x?x+1900:x+2E3}}function Y(aa){return function(x){x=aa(x).toLowerCase(); +return d(Ca,"ABBR_MONTHNAMES").indexOf(x)+1}}function R(aa){return function(x){x=aa(x);return parseInt(x,10)}}function Z(aa){return function(x){x=aa(x);return h(d(Ca,"MONTHNAMES").$compact(),"map",[],"downcase".$to_proc()).indexOf(x.$downcase())+1}}null==za&&(za=!0);var V=new Date,fa=V.getDate(),la=V.getMonth(),k=V.getFullYear(),C=V.getDay();V=d(Ca,"MONTHNAMES").$compact().$join("|");V=[{regexp:/^(\d{2})$/,year:k,month:la,day:R(ta)},{regexp:/^(\d{3})$/,year:k,month:0,day:R(ta)},{regexp:/^(\d{2})(\d{2})$/, +year:k,month:R(ta),day:R(Ma)},{regexp:/^(\d{2})(\d{3})$/,year:Da(R(ta)),month:0,day:R(Ma)},{regexp:/^(\d{2})(\d{2})(\d{2})$/,year:Da(R(ta)),month:R(Ma),day:R(Sa)},{regexp:/^(\d{4})(\d{3})$/,year:R(ta),month:0,day:R(Ma)},{regexp:/^(\d{4})(\d{2})(\d{2})$/,year:R(ta),month:R(Ma),day:R(Sa)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{3,4})$/,year:R(Ma),month:Y(ta),day:1},{regexp:/^(\d{1,2})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{3,4})$/i,year:R(Sa),month:Y(Ma),day:R(ta)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{3,4})$/i, +year:R(Sa),month:Y(ta),day:R(Ma)},{regexp:/^(\d{3,4})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{1,2})$/i,year:R(ta),month:Y(Ma),day:R(Sa)},{regexp:/^(\-?\d{3,4})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:R(ta),month:R(Ma),day:R(Sa)},{regexp:/^(\d{2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:function(aa){return function(x){x=aa(x);return za?x+2E3:x}}(R(ta)),month:R(Ma),day:R(Sa)},{regexp:/^(\d{1,2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\-?\d{3,4})$/,year:R(Sa),month:R(Ma),day:R(ta)},{regexp:new RegExp("^("+ +d(Ca,"DAYNAMES").$join("|")+")$","i"),year:k,month:la,day:function(aa){return function(x){x=aa(x);x=h(d(Ca,"DAYNAMES"),"map",[],"downcase".$to_proc()).indexOf(x.$downcase());return fa-C+x}}(ta)},{regexp:new RegExp("^("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-](\\-?\\d{3,4})$","i"),year:R(Za),month:Z(ta),day:R(Ma)},{regexp:new RegExp("^("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)","i"),year:k,month:Z(ta),day:R(Ma)},{regexp:new RegExp("^(\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-]("+V+")[\\s\\.\\/\\-](\\-?\\d{3,4})$", +"i"),year:R(Za),month:Z(Sa),day:R(ta)},{regexp:new RegExp("^(\\-?\\d{3,4})[\\s\\.\\/\\-]("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)$","i"),year:R(ta),month:Z(Ma),day:R(Sa)}];var O;for(O=0;O=Ya&&la.setFullYear(Ya),this.$wrap(la);return this.$raise(d(Ca,"ArgumentError"),"invalid date")},cb.$$arity= +-2);a.def(S,"$today",db=function(){return this.$wrap(new Date)},db.$$arity=0);return(a.def(S,"$gregorian_leap?",ab=function(Ya){return 0===(new Date(Ya,1,29)).getMonth()-1},ab.$$arity=1),y)&&"gregorian_leap?"})(a.get_singleton_class(v),e);a.def(v,"$initialize",n=function(S,ya,Ca,Va){null==S&&(S=-4712);null==ya&&(ya=1);null==Ca&&(Ca=1);null==Va&&d(e,"ITALY");1582===S&&10===ya&&4Ca&&(Ca=4);return this.date=new Date(S,ya-1,Ca)},n.$$arity=-1);a.def(v,"$-",J=function(S){if(S.$$is_number){var ya= +this.$clone();ya.date.setDate(this.date.getDate()-S);return ya}if(S.date)return Math.round((this.date-S.date)/864E5);this.$raise(d(e,"TypeError"))},J.$$arity=1);a.def(v,"$+",D=function(S){if(S.$$is_number){var ya=this.$clone();ya.date.setDate(this.date.getDate()+S);return ya}this.$raise(d(e,"TypeError"))},D.$$arity=1);a.def(v,"$<",T=function(S){var ya=this.date;S=S.date;ya.setHours(0,0,0,0);S.setHours(0,0,0,0);return ya",da=function(S){var ya=this.date;S=S.date;ya.setHours(0,0,0,0);S.setHours(0,0,0,0);return ya>S},da.$$arity=1);a.def(v,"$>=",ma=function(S){var ya=this.date;S=S.date;ya.setHours(0,0,0,0);S.setHours(0,0,0,0);return ya>=S},ma.$$arity=1);a.def(v,"$<=>",b=function(S){if(S.$$is_number)return this.$jd()["$<=>"](S);if(d(e,"Date")["$==="](S)){var ya=this.date;S=S.date;ya.setHours(0,0,0,0);S.setHours(0,0,0,0);return yaS?1:0}return y}, +b.$$arity=1);a.def(v,"$>>",m=function(S){S.$$is_number||this.$raise(d(e,"TypeError"));var ya=this.$clone(),Ca=ya.date,Va=Ca.getDate();Ca.setDate(1);Ca.setMonth(Ca.getMonth()+S);Ca.setDate(Math.min(Va,H(Ca.getFullYear(),Ca.getMonth())));return ya},m.$$arity=1);a.def(v,"$<<",g=function(S){S.$$is_number||this.$raise(d(e,"TypeError"));return this["$>>"](-S)},g.$$arity=1);a.alias(v,"eql?","==");a.def(v,"$clone",r=function(){return d(e,"Date").$wrap(new Date(this.date.getTime()))},r.$$arity=0);a.def(v, +"$day",A=function(){return this.date.getDate()},A.$$arity=0);a.def(v,"$friday?",E=function(){return this.$wday()["$=="](5)},E.$$arity=0);a.def(v,"$jd",I=function(){var S=this.date.getMonth()+1,ya=this.date.getDate(),Ca=this.date.getFullYear();var Va=1;1585>=Ca&&(Va=0);var cb=-1*Math.floor(7*(Math.floor((S+9)/12)+Ca)/4);var db=1;0>S-9&&(db=-1);db=Math.floor(Ca+db*Math.floor(Math.abs(S-9)/7));db=-1*Math.floor(3*(Math.floor(db/100)+1)/4);cb=cb+Math.floor(275*S/9)+ya+Va*db;return cb+1721027+2*Va+367* +Ca-.5+.5},I.$$arity=0);a.def(v,"$julian?",L=function(){return this.dateCa&&(Ca="0"+Ca);10>S&&(S="0"+S);return ya+"-"+Ca+"-"+S},M.$$arity=0);a.def(v,"$to_time",ja=function(){return d(e,"Time").$new(this.$year(),this.$month(),this.$day())},ja.$$arity=0);a.def(v,"$to_n",sa=function(){return this.date},sa.$$arity=0);a.def(v,"$tuesday?",ea=function(){return this.$wday()["$=="](2)},ea.$$arity=0);a.def(v,"$step", +ua=function(S,ya){var Ca=ua.$$p,Va=Ca||y,cb,db,ab=y;ab=ab=y;Ca&&(ua.$$p=null);Ca&&(ua.$$p=null);null==ya&&(ya=1);ab=F(S,this).$to_i();ab=f(p("number"===typeof ab&&"number"===typeof ya?ab*ya:ab["$*"](ya),0))?[]:f(p(ab,0))?h(a.Range.$new(0,ab["$-@"](),!1).$step(ya.$abs()),"map",[],"-@".$to_proc()).$reverse():a.Range.$new(0,ab,!1).$step(ya.$abs());ab=h(ab,"map",[],(cb=function(Ya){var za=null==cb.$$s?this:cb.$$s;null==Ya&&(Ya=y);return w(za,Ya)},cb.$$s=this,cb.$$arity=1,cb));return Va!==y?(h(ab,"each", +[],(db=function(Ya){null==Ya&&(Ya=y);return a.yield1(Va,Ya)},db.$$s=this,db.$$arity=1,db)),this):ab},ua.$$arity=-2);a.def(v,"$upto",Fa=function(S){var ya=Fa.$$p,Ca=ya||y;ya&&(Fa.$$p=null);ya&&(Fa.$$p=null);return h(this,"step",[S,1],Ca.$to_proc())},Fa.$$arity=1);a.def(v,"$downto",Ga=function(S){var ya=Ga.$$p,Ca=ya||y;ya&&(Ga.$$p=null);ya&&(Ga.$$p=null);return h(this,"step",[S,-1],Ca.$to_proc())},Ga.$$arity=1);a.def(v,"$wday",Ra=function(){return this.date.getDay()},Ra.$$arity=0);a.def(v,"$wednesday?", +Pa=function(){return this.$wday()["$=="](3)},Pa.$$arity=0);a.def(v,"$year",Ha=function(){return this.date.getFullYear()},Ha.$$arity=0);a.def(v,"$cwday",fb=function(){return this.date.getDay()||7},fb.$$arity=0);a.def(v,"$cweek",kb=function(){var S=new Date(this.date);S.setHours(0,0,0);S.setDate(S.getDate()+4-(S.getDay()||7));return Math.ceil(((S-new Date(S.getFullYear(),0,1))/864E5+1)/7)},kb.$$arity=0)}(t[0],null,t)})(Opal); (function(a){function w(h,v){return"number"===typeof h&&"number"===typeof v?h-v:h["$-"](v)}var F=[],p=a.nil,t=a.$$$,y=a.$$,q=a.module,d=a.klass,G=a.send,z=a.hash2,f=a.truthy;a.add_stubs("$raise $new $push $[]= $- $[] $create_id $json_create $const_get $attr_accessor $create_id= $=== $parse $generate $from_object $merge $to_json $responds_to? $to_io $write $to_s $to_a $strftime".split(" "));(function(h,v){function c(g){try{return JSON.parse(g)}catch(r){H.$raise(t(y(e,"JSON"),"ParserError"),r.message)}} function l(g,r){var A;switch(typeof g){case "string":return g;case "number":return g;case "boolean":return!!g;case "null":return p;case "object":if(!g)return p;if(g.$$is_array){var E=r.array_class.$new();var I=0;for(A=g.length;I $attr_reader $nonzero? $d $zero? $new $class $-@ $+@ $=== $coerce $== $> $+ $allocate $join $compact $map $to_proc $downcase $wrap $raise $clone $jd $>> $wday $year $month $day $- $to_s $to_i $< $* $reverse $step $abs $each".split(" ")); -return function(v,$super,l){function H(R,ya){return[31,0===R%4&&0!==R%100||0===R%400?29:28,31,30,31,30,31,31,30,31,30,31][ya]}v=G(v,$super,"Date");var e=[v].concat(l),n,J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Da,Ga,Ra,Pa,Ha,eb,kb;v.$$prototype.date=y;v.$include(d(e,"Comparable"));(function(R,$super,Ca){R=G(R,$super,"Infinity");var Ua=[R].concat(Ca),ib,cb,ab,Xa,za,ta,Ma,Sa,Za,Ea,Y;R.$$prototype.d=y;R.$include(d(Ua,"Comparable"));a.def(R,"$initialize",ib=function(S){null== -S&&(S=1);return this.d=S["$<=>"](0)},ib.$$arity=-1);R.$attr_reader("d");a.def(R,"$zero?",cb=function(){return!1},cb.$$arity=0);a.def(R,"$finite?",ab=function(){return!1},ab.$$arity=0);a.def(R,"$infinite?",Xa=function(){return this.$d()["$nonzero?"]()},Xa.$$arity=0);a.def(R,"$nan?",za=function(){return this.$d()["$zero?"]()},za.$$arity=0);a.def(R,"$abs",ta=function(){return this.$class().$new()},ta.$$arity=0);a.def(R,"$-@",Ma=function(){return this.$class().$new(this.$d()["$-@"]())},Ma.$$arity=0); -a.def(R,"$+@",Sa=function(){return this.$class().$new(this.$d()["$+@"]())},Sa.$$arity=0);a.def(R,"$<=>",Za=function(S){var Z,V,fa=this,la=y,k=y,C=y;return function(){la=S;if(d(Ua,"Infinity")["$==="](la))return fa.$d()["$<=>"](S.$d());if(d(Ua,"Numeric")["$==="](la))return fa.$d();try{return V=S.$coerce(fa),Z=a.to_ary(V),k=null==Z[0]?y:Z[0],C=null==Z[1]?y:Z[1],V,k["$<=>"](C)}catch(O){if(a.rescue(O,[d(Ua,"NoMethodError")]))try{return y}finally{a.pop_exception()}else throw O;}}()},Za.$$arity=1);a.def(R, -"$coerce",Ea=function(S){var Z=Ea.$$p,V;Z&&(Ea.$$p=null);var fa=0;var la=arguments.length;for(V=Array(la);fa"](0);return f(S)?q(d(Ua,"Float"),"INFINITY"):q(d(Ua,"Float"),"INFINITY")["$-@"]()},Y.$$arity=0),y)&&"to_f"})(e[0], +return function(v,$super,l){function H(S,ya){return[31,0===S%4&&0!==S%100||0===S%400?29:28,31,30,31,30,31,31,30,31,30,31][ya]}v=G(v,$super,"Date");var e=[v].concat(l),n,J,D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja,ka,N,M,ja,sa,ea,ua,Fa,Ga,Ra,Pa,Ha,fb,kb;v.$$prototype.date=y;v.$include(d(e,"Comparable"));(function(S,$super,Ca){S=G(S,$super,"Infinity");var Va=[S].concat(Ca),cb,db,ab,Ya,za,ta,Ma,Sa,Za,Da,Y;S.$$prototype.d=y;S.$include(d(Va,"Comparable"));a.def(S,"$initialize",cb=function(R){null== +R&&(R=1);return this.d=R["$<=>"](0)},cb.$$arity=-1);S.$attr_reader("d");a.def(S,"$zero?",db=function(){return!1},db.$$arity=0);a.def(S,"$finite?",ab=function(){return!1},ab.$$arity=0);a.def(S,"$infinite?",Ya=function(){return this.$d()["$nonzero?"]()},Ya.$$arity=0);a.def(S,"$nan?",za=function(){return this.$d()["$zero?"]()},za.$$arity=0);a.def(S,"$abs",ta=function(){return this.$class().$new()},ta.$$arity=0);a.def(S,"$-@",Ma=function(){return this.$class().$new(this.$d()["$-@"]())},Ma.$$arity=0); +a.def(S,"$+@",Sa=function(){return this.$class().$new(this.$d()["$+@"]())},Sa.$$arity=0);a.def(S,"$<=>",Za=function(R){var Z,V,fa=this,la=y,k=y,C=y;return function(){la=R;if(d(Va,"Infinity")["$==="](la))return fa.$d()["$<=>"](R.$d());if(d(Va,"Numeric")["$==="](la))return fa.$d();try{return V=R.$coerce(fa),Z=a.to_ary(V),k=null==Z[0]?y:Z[0],C=null==Z[1]?y:Z[1],V,k["$<=>"](C)}catch(O){if(a.rescue(O,[d(Va,"NoMethodError")]))try{return y}finally{a.pop_exception()}else throw O;}}()},Za.$$arity=1);a.def(S, +"$coerce",Da=function(R){var Z=Da.$$p,V;Z&&(Da.$$p=null);var fa=0;var la=arguments.length;for(V=Array(la);fa"](0);return f(R)?q(d(Va,"Float"),"INFINITY"):q(d(Va,"Float"),"INFINITY")["$-@"]()},Y.$$arity=0),y)&&"to_f"})(e[0], d(e,"Numeric"),e);a.const_set(e[0],"JULIAN",d(e,"Infinity").$new());a.const_set(e[0],"GREGORIAN",d(e,"Infinity").$new()["$-@"]());a.const_set(e[0],"ITALY",2299161);a.const_set(e[0],"ENGLAND",2361222);a.const_set(e[0],"MONTHNAMES",w([y],"January February March April May June July August September October November December".split(" ")));a.const_set(e[0],"ABBR_MONTHNAMES","jan feb mar apr may jun jul aug sep oct nov dec".split(" "));a.const_set(e[0],"DAYNAMES","Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ")); -a.const_set(e[0],"ABBR_DAYNAMES","Sun Mon Tue Wed Thu Fri Sat".split(" "));(function(R,ya){var Ca=[R].concat(ya),Ua,ib,cb,ab;a.alias(R,"civil","new");a.def(R,"$wrap",Ua=function(Xa){var za=this.$allocate();za.date=Xa;return za},Ua.$$arity=1);a.def(R,"$parse",ib=function(Xa,za){function ta(aa){return aa[1]}function Ma(aa){return aa[2]}function Sa(aa){return aa[3]}function Za(aa){return aa[4]}function Ea(aa){return function(x){x=aa(x);return 69<=x?x+1900:x+2E3}}function Y(aa){return function(x){x=aa(x).toLowerCase(); -return d(Ca,"ABBR_MONTHNAMES").indexOf(x)+1}}function S(aa){return function(x){x=aa(x);return parseInt(x,10)}}function Z(aa){return function(x){x=aa(x);return h(d(Ca,"MONTHNAMES").$compact(),"map",[],"downcase".$to_proc()).indexOf(x.$downcase())+1}}null==za&&(za=!0);var V=new Date,fa=V.getDate(),la=V.getMonth(),k=V.getFullYear(),C=V.getDay();V=d(Ca,"MONTHNAMES").$compact().$join("|");V=[{regexp:/^(\d{2})$/,year:k,month:la,day:S(ta)},{regexp:/^(\d{3})$/,year:k,month:0,day:S(ta)},{regexp:/^(\d{2})(\d{2})$/, -year:k,month:S(ta),day:S(Ma)},{regexp:/^(\d{2})(\d{3})$/,year:Ea(S(ta)),month:0,day:S(Ma)},{regexp:/^(\d{2})(\d{2})(\d{2})$/,year:Ea(S(ta)),month:S(Ma),day:S(Sa)},{regexp:/^(\d{4})(\d{3})$/,year:S(ta),month:0,day:S(Ma)},{regexp:/^(\d{4})(\d{2})(\d{2})$/,year:S(ta),month:S(Ma),day:S(Sa)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{3,4})$/,year:S(Ma),month:Y(ta),day:1},{regexp:/^(\d{1,2})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{3,4})$/i,year:S(Sa),month:Y(Ma),day:S(ta)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{3,4})$/i, -year:S(Sa),month:Y(ta),day:S(Ma)},{regexp:/^(\d{3,4})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{1,2})$/i,year:S(ta),month:Y(Ma),day:S(Sa)},{regexp:/^(\-?\d{3,4})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:S(ta),month:S(Ma),day:S(Sa)},{regexp:/^(\d{2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:function(aa){return function(x){x=aa(x);return za?x+2E3:x}}(S(ta)),month:S(Ma),day:S(Sa)},{regexp:/^(\d{1,2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\-?\d{3,4})$/,year:S(Sa),month:S(Ma),day:S(ta)},{regexp:new RegExp("^("+ -d(Ca,"DAYNAMES").$join("|")+")$","i"),year:k,month:la,day:function(aa){return function(x){x=aa(x);x=h(d(Ca,"DAYNAMES"),"map",[],"downcase".$to_proc()).indexOf(x.$downcase());return fa-C+x}}(ta)},{regexp:new RegExp("^("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-](\\-?\\d{3,4})$","i"),year:S(Za),month:Z(ta),day:S(Ma)},{regexp:new RegExp("^("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)","i"),year:k,month:Z(ta),day:S(Ma)},{regexp:new RegExp("^(\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-]("+V+")[\\s\\.\\/\\-](\\-?\\d{3,4})$", -"i"),year:S(Za),month:Z(Sa),day:S(ta)},{regexp:new RegExp("^(\\-?\\d{3,4})[\\s\\.\\/\\-]("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)$","i"),year:S(ta),month:Z(Ma),day:S(Sa)}];var O;for(O=0;O=Xa&&la.setFullYear(Xa),this.$wrap(la);return this.$raise(d(Ca,"ArgumentError"),"invalid date")},ib.$$arity= --2);a.def(R,"$today",cb=function(){return this.$wrap(new Date)},cb.$$arity=0);return(a.def(R,"$gregorian_leap?",ab=function(Xa){return 0===(new Date(Xa,1,29)).getMonth()-1},ab.$$arity=1),y)&&"gregorian_leap?"})(a.get_singleton_class(v),e);a.def(v,"$initialize",n=function(R,ya,Ca,Ua){null==R&&(R=-4712);null==ya&&(ya=1);null==Ca&&(Ca=1);null==Ua&&d(e,"ITALY");1582===R&&10===ya&&4Ca&&(Ca=4);return this.date=new Date(R,ya-1,Ca)},n.$$arity=-1);a.def(v,"$-",J=function(R){if(R.$$is_number){var ya= -this.$clone();ya.date.setDate(this.date.getDate()-R);return ya}if(R.date)return Math.round((this.date-R.date)/864E5);this.$raise(d(e,"TypeError"))},J.$$arity=1);a.def(v,"$+",D=function(R){if(R.$$is_number){var ya=this.$clone();ya.date.setDate(this.date.getDate()+R);return ya}this.$raise(d(e,"TypeError"))},D.$$arity=1);a.def(v,"$<",T=function(R){var ya=this.date;R=R.date;ya.setHours(0,0,0,0);R.setHours(0,0,0,0);return ya",da=function(R){var ya=this.date;R=R.date;ya.setHours(0,0,0,0);R.setHours(0,0,0,0);return ya>R},da.$$arity=1);a.def(v,"$>=",ma=function(R){var ya=this.date;R=R.date;ya.setHours(0,0,0,0);R.setHours(0,0,0,0);return ya>=R},ma.$$arity=1);a.def(v,"$<=>",b=function(R){if(R.$$is_number)return this.$jd()["$<=>"](R);if(d(e,"Date")["$==="](R)){var ya=this.date;R=R.date;ya.setHours(0,0,0,0);R.setHours(0,0,0,0);return yaR?1:0}return y}, -b.$$arity=1);a.def(v,"$>>",m=function(R){R.$$is_number||this.$raise(d(e,"TypeError"));var ya=this.$clone(),Ca=ya.date,Ua=Ca.getDate();Ca.setDate(1);Ca.setMonth(Ca.getMonth()+R);Ca.setDate(Math.min(Ua,H(Ca.getFullYear(),Ca.getMonth())));return ya},m.$$arity=1);a.def(v,"$<<",g=function(R){R.$$is_number||this.$raise(d(e,"TypeError"));return this["$>>"](-R)},g.$$arity=1);a.alias(v,"eql?","==");a.def(v,"$clone",r=function(){return d(e,"Date").$wrap(new Date(this.date.getTime()))},r.$$arity=0);a.def(v, -"$day",A=function(){return this.date.getDate()},A.$$arity=0);a.def(v,"$friday?",E=function(){return this.$wday()["$=="](5)},E.$$arity=0);a.def(v,"$jd",I=function(){var R=this.date.getMonth()+1,ya=this.date.getDate(),Ca=this.date.getFullYear();var Ua=1;1585>=Ca&&(Ua=0);var ib=-1*Math.floor(7*(Math.floor((R+9)/12)+Ca)/4);var cb=1;0>R-9&&(cb=-1);cb=Math.floor(Ca+cb*Math.floor(Math.abs(R-9)/7));cb=-1*Math.floor(3*(Math.floor(cb/100)+1)/4);ib=ib+Math.floor(275*R/9)+ya+Ua*cb;return ib+1721027+2*Ua+367* -Ca-.5+.5},I.$$arity=0);a.def(v,"$julian?",L=function(){return this.dateCa&&(Ca="0"+Ca);10>R&&(R="0"+R);return ya+"-"+Ca+"-"+R},M.$$arity=0);a.def(v,"$to_time",ja=function(){return d(e,"Time").$new(this.$year(),this.$month(),this.$day())},ja.$$arity=0);a.def(v,"$to_n",sa=function(){return this.date},sa.$$arity=0);a.def(v,"$tuesday?",ea=function(){return this.$wday()["$=="](2)},ea.$$arity=0);a.def(v,"$step", -ua=function(R,ya){var Ca=ua.$$p,Ua=Ca||y,ib,cb,ab=y;ab=ab=y;Ca&&(ua.$$p=null);Ca&&(ua.$$p=null);null==ya&&(ya=1);ab=F(R,this).$to_i();ab=f(p("number"===typeof ab&&"number"===typeof ya?ab*ya:ab["$*"](ya),0))?[]:f(p(ab,0))?h(a.Range.$new(0,ab["$-@"](),!1).$step(ya.$abs()),"map",[],"-@".$to_proc()).$reverse():a.Range.$new(0,ab,!1).$step(ya.$abs());ab=h(ab,"map",[],(ib=function(Xa){var za=null==ib.$$s?this:ib.$$s;null==Xa&&(Xa=y);return w(za,Xa)},ib.$$s=this,ib.$$arity=1,ib));return Ua!==y?(h(ab,"each", -[],(cb=function(Xa){null==Xa&&(Xa=y);return a.yield1(Ua,Xa)},cb.$$s=this,cb.$$arity=1,cb)),this):ab},ua.$$arity=-2);a.def(v,"$upto",Da=function(R){var ya=Da.$$p,Ca=ya||y;ya&&(Da.$$p=null);ya&&(Da.$$p=null);return h(this,"step",[R,1],Ca.$to_proc())},Da.$$arity=1);a.def(v,"$downto",Ga=function(R){var ya=Ga.$$p,Ca=ya||y;ya&&(Ga.$$p=null);ya&&(Ga.$$p=null);return h(this,"step",[R,-1],Ca.$to_proc())},Ga.$$arity=1);a.def(v,"$wday",Ra=function(){return this.date.getDay()},Ra.$$arity=0);a.def(v,"$wednesday?", -Pa=function(){return this.$wday()["$=="](3)},Pa.$$arity=0);a.def(v,"$year",Ha=function(){return this.date.getFullYear()},Ha.$$arity=0);a.def(v,"$cwday",eb=function(){return this.date.getDay()||7},eb.$$arity=0);a.def(v,"$cweek",kb=function(){var R=new Date(this.date);R.setHours(0,0,0);R.setDate(R.getDate()+4-(R.getDay()||7));return Math.ceil(((R-new Date(R.getFullYear(),0,1))/864E5+1)/7)},kb.$$arity=0)}(t[0],null,t)}; -Opal.modules.todo=function(a){function w(H,e){return"number"===typeof H&&"number"===typeof e?H+e:H["$+"](e)}function F(H,e){return"number"===typeof H&&"number"===typeof e?H>e:H["$>"](e)}function p(H,e){return"number"===typeof H&&"number"===typeof e?H $length $change_state $to_i $list $< $set_priority $due_date $append $rename $!= $delete $add_note $delete_note $show $push $strip $usage $cleanup $colorize $gsub $to_s $private $keys $map $select $parse $strftime $today $downcase $lambda $match $== $! $each $split $chomp $[]= $- $has_key? $sort $generate $convert_due_date $postprocess_tags $load_tasks $call $write_tasks $update_task $max $size $filter_tasks $sort_by $start_with? $abs $rjust $kind_of? $to_a $index".split(" ")); +a.const_set(e[0],"ABBR_DAYNAMES","Sun Mon Tue Wed Thu Fri Sat".split(" "));(function(S,ya){var Ca=[S].concat(ya),Va,cb,db,ab;a.alias(S,"civil","new");a.def(S,"$wrap",Va=function(Ya){var za=this.$allocate();za.date=Ya;return za},Va.$$arity=1);a.def(S,"$parse",cb=function(Ya,za){function ta(aa){return aa[1]}function Ma(aa){return aa[2]}function Sa(aa){return aa[3]}function Za(aa){return aa[4]}function Da(aa){return function(x){x=aa(x);return 69<=x?x+1900:x+2E3}}function Y(aa){return function(x){x=aa(x).toLowerCase(); +return d(Ca,"ABBR_MONTHNAMES").indexOf(x)+1}}function R(aa){return function(x){x=aa(x);return parseInt(x,10)}}function Z(aa){return function(x){x=aa(x);return h(d(Ca,"MONTHNAMES").$compact(),"map",[],"downcase".$to_proc()).indexOf(x.$downcase())+1}}null==za&&(za=!0);var V=new Date,fa=V.getDate(),la=V.getMonth(),k=V.getFullYear(),C=V.getDay();V=d(Ca,"MONTHNAMES").$compact().$join("|");V=[{regexp:/^(\d{2})$/,year:k,month:la,day:R(ta)},{regexp:/^(\d{3})$/,year:k,month:0,day:R(ta)},{regexp:/^(\d{2})(\d{2})$/, +year:k,month:R(ta),day:R(Ma)},{regexp:/^(\d{2})(\d{3})$/,year:Da(R(ta)),month:0,day:R(Ma)},{regexp:/^(\d{2})(\d{2})(\d{2})$/,year:Da(R(ta)),month:R(Ma),day:R(Sa)},{regexp:/^(\d{4})(\d{3})$/,year:R(ta),month:0,day:R(Ma)},{regexp:/^(\d{4})(\d{2})(\d{2})$/,year:R(ta),month:R(Ma),day:R(Sa)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{3,4})$/,year:R(Ma),month:Y(ta),day:1},{regexp:/^(\d{1,2})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{3,4})$/i,year:R(Sa),month:Y(Ma),day:R(ta)},{regexp:/^([a-z]{3})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{3,4})$/i, +year:R(Sa),month:Y(ta),day:R(Ma)},{regexp:/^(\d{3,4})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{1,2})$/i,year:R(ta),month:Y(Ma),day:R(Sa)},{regexp:/^(\-?\d{3,4})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:R(ta),month:R(Ma),day:R(Sa)},{regexp:/^(\d{2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/,year:function(aa){return function(x){x=aa(x);return za?x+2E3:x}}(R(ta)),month:R(Ma),day:R(Sa)},{regexp:/^(\d{1,2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\-?\d{3,4})$/,year:R(Sa),month:R(Ma),day:R(ta)},{regexp:new RegExp("^("+ +d(Ca,"DAYNAMES").$join("|")+")$","i"),year:k,month:la,day:function(aa){return function(x){x=aa(x);x=h(d(Ca,"DAYNAMES"),"map",[],"downcase".$to_proc()).indexOf(x.$downcase());return fa-C+x}}(ta)},{regexp:new RegExp("^("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-](\\-?\\d{3,4})$","i"),year:R(Za),month:Z(ta),day:R(Ma)},{regexp:new RegExp("^("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)","i"),year:k,month:Z(ta),day:R(Ma)},{regexp:new RegExp("^(\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-]("+V+")[\\s\\.\\/\\-](\\-?\\d{3,4})$", +"i"),year:R(Za),month:Z(Sa),day:R(ta)},{regexp:new RegExp("^(\\-?\\d{3,4})[\\s\\.\\/\\-]("+V+")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)$","i"),year:R(ta),month:Z(Ma),day:R(Sa)}];var O;for(O=0;O=Ya&&la.setFullYear(Ya),this.$wrap(la);return this.$raise(d(Ca,"ArgumentError"),"invalid date")},cb.$$arity= +-2);a.def(S,"$today",db=function(){return this.$wrap(new Date)},db.$$arity=0);return(a.def(S,"$gregorian_leap?",ab=function(Ya){return 0===(new Date(Ya,1,29)).getMonth()-1},ab.$$arity=1),y)&&"gregorian_leap?"})(a.get_singleton_class(v),e);a.def(v,"$initialize",n=function(S,ya,Ca,Va){null==S&&(S=-4712);null==ya&&(ya=1);null==Ca&&(Ca=1);null==Va&&d(e,"ITALY");1582===S&&10===ya&&4Ca&&(Ca=4);return this.date=new Date(S,ya-1,Ca)},n.$$arity=-1);a.def(v,"$-",J=function(S){if(S.$$is_number){var ya= +this.$clone();ya.date.setDate(this.date.getDate()-S);return ya}if(S.date)return Math.round((this.date-S.date)/864E5);this.$raise(d(e,"TypeError"))},J.$$arity=1);a.def(v,"$+",D=function(S){if(S.$$is_number){var ya=this.$clone();ya.date.setDate(this.date.getDate()+S);return ya}this.$raise(d(e,"TypeError"))},D.$$arity=1);a.def(v,"$<",T=function(S){var ya=this.date;S=S.date;ya.setHours(0,0,0,0);S.setHours(0,0,0,0);return ya",da=function(S){var ya=this.date;S=S.date;ya.setHours(0,0,0,0);S.setHours(0,0,0,0);return ya>S},da.$$arity=1);a.def(v,"$>=",ma=function(S){var ya=this.date;S=S.date;ya.setHours(0,0,0,0);S.setHours(0,0,0,0);return ya>=S},ma.$$arity=1);a.def(v,"$<=>",b=function(S){if(S.$$is_number)return this.$jd()["$<=>"](S);if(d(e,"Date")["$==="](S)){var ya=this.date;S=S.date;ya.setHours(0,0,0,0);S.setHours(0,0,0,0);return yaS?1:0}return y}, +b.$$arity=1);a.def(v,"$>>",m=function(S){S.$$is_number||this.$raise(d(e,"TypeError"));var ya=this.$clone(),Ca=ya.date,Va=Ca.getDate();Ca.setDate(1);Ca.setMonth(Ca.getMonth()+S);Ca.setDate(Math.min(Va,H(Ca.getFullYear(),Ca.getMonth())));return ya},m.$$arity=1);a.def(v,"$<<",g=function(S){S.$$is_number||this.$raise(d(e,"TypeError"));return this["$>>"](-S)},g.$$arity=1);a.alias(v,"eql?","==");a.def(v,"$clone",r=function(){return d(e,"Date").$wrap(new Date(this.date.getTime()))},r.$$arity=0);a.def(v, +"$day",A=function(){return this.date.getDate()},A.$$arity=0);a.def(v,"$friday?",E=function(){return this.$wday()["$=="](5)},E.$$arity=0);a.def(v,"$jd",I=function(){var S=this.date.getMonth()+1,ya=this.date.getDate(),Ca=this.date.getFullYear();var Va=1;1585>=Ca&&(Va=0);var cb=-1*Math.floor(7*(Math.floor((S+9)/12)+Ca)/4);var db=1;0>S-9&&(db=-1);db=Math.floor(Ca+db*Math.floor(Math.abs(S-9)/7));db=-1*Math.floor(3*(Math.floor(db/100)+1)/4);cb=cb+Math.floor(275*S/9)+ya+Va*db;return cb+1721027+2*Va+367* +Ca-.5+.5},I.$$arity=0);a.def(v,"$julian?",L=function(){return this.dateCa&&(Ca="0"+Ca);10>S&&(S="0"+S);return ya+"-"+Ca+"-"+S},M.$$arity=0);a.def(v,"$to_time",ja=function(){return d(e,"Time").$new(this.$year(),this.$month(),this.$day())},ja.$$arity=0);a.def(v,"$to_n",sa=function(){return this.date},sa.$$arity=0);a.def(v,"$tuesday?",ea=function(){return this.$wday()["$=="](2)},ea.$$arity=0);a.def(v,"$step", +ua=function(S,ya){var Ca=ua.$$p,Va=Ca||y,cb,db,ab=y;ab=ab=y;Ca&&(ua.$$p=null);Ca&&(ua.$$p=null);null==ya&&(ya=1);ab=F(S,this).$to_i();ab=f(p("number"===typeof ab&&"number"===typeof ya?ab*ya:ab["$*"](ya),0))?[]:f(p(ab,0))?h(a.Range.$new(0,ab["$-@"](),!1).$step(ya.$abs()),"map",[],"-@".$to_proc()).$reverse():a.Range.$new(0,ab,!1).$step(ya.$abs());ab=h(ab,"map",[],(cb=function(Ya){var za=null==cb.$$s?this:cb.$$s;null==Ya&&(Ya=y);return w(za,Ya)},cb.$$s=this,cb.$$arity=1,cb));return Va!==y?(h(ab,"each", +[],(db=function(Ya){null==Ya&&(Ya=y);return a.yield1(Va,Ya)},db.$$s=this,db.$$arity=1,db)),this):ab},ua.$$arity=-2);a.def(v,"$upto",Fa=function(S){var ya=Fa.$$p,Ca=ya||y;ya&&(Fa.$$p=null);ya&&(Fa.$$p=null);return h(this,"step",[S,1],Ca.$to_proc())},Fa.$$arity=1);a.def(v,"$downto",Ga=function(S){var ya=Ga.$$p,Ca=ya||y;ya&&(Ga.$$p=null);ya&&(Ga.$$p=null);return h(this,"step",[S,-1],Ca.$to_proc())},Ga.$$arity=1);a.def(v,"$wday",Ra=function(){return this.date.getDay()},Ra.$$arity=0);a.def(v,"$wednesday?", +Pa=function(){return this.$wday()["$=="](3)},Pa.$$arity=0);a.def(v,"$year",Ha=function(){return this.date.getFullYear()},Ha.$$arity=0);a.def(v,"$cwday",fb=function(){return this.date.getDay()||7},fb.$$arity=0);a.def(v,"$cweek",kb=function(){var S=new Date(this.date);S.setHours(0,0,0);S.setDate(S.getDate()+4-(S.getDay()||7));return Math.ceil(((S-new Date(S.getFullYear(),0,1))/864E5+1)/7)},kb.$$arity=0)}(t[0],null,t)}; +Opal.modules.todo=function(a){function w(H,e){return"number"===typeof H&&"number"===typeof e?H+e:H["$+"](e)}function F(H,e){return"number"===typeof H&&"number"===typeof e?H>e:H["$>"](e)}function p(H,e){return"number"===typeof H&&"number"===typeof e?H $length $change_state $to_i $list $< $set_priority $due_date $append $rename $!= $delete $add_note $delete_note $show $push $strip $usage $cleanup $colorize $gsub $to_s $private $keys $map $select $parse $strftime $today $downcase $lambda $match $== $! $each $split $chomp $[]= $- $has_key? $sort $generate $convert_due_date $postprocess_tags $load_tasks $call $write_tasks $update_task $max $size $sort_by $filter_tasks $start_with? $abs $rjust $kind_of? $to_a $index".split(" ")); y.$require("json");y.$require("date");return function(H,$super,n){H=f(H,$super,"Todo");var J=[H].concat(n),D,T,ia,da,ma,b,m,g,r,A,E,I,L,ba,va,Oa,wa,Aa,La,na,U,ra,xa,Ja;H.$$prototype.text_buffer=H.$$prototype.queries=H.$$prototype.today=H.$$prototype.due_date_days=d;a.const_set(J[0],"COLOR_CODES",h("black red green yellow blue magenta cyan white".split(" "),{black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37}));a.const_set(J[0],"STATES",h(["new","done","started","blocked","default"], {"new":"[ ]",done:"[x]",started:"[>]",blocked:"[!]","default":"[?]"}));a.const_set(J[0],"ORDER",h(["new","done","started","blocked","default"],{"new":3,done:4,started:2,blocked:1,"default":100}));a.const_set(J[0],"COLORS",h(["new","done","started","blocked","default"],{"new":"white",done:"blue",started:"green",blocked:"yellow","default":"magenta"}));a.const_set(J[0],"DATE_FORMAT","%Y-%m-%d");a.const_set(J[0],"DUE_DATE_DAYS_SIMPLE",["today","tomorrow"]);a.const_set(J[0],"DUE_DATE_TAG_PATTERN",/(^| )due:([a-zA-Z0-9-]+)/); -a.const_set(J[0],"CONTEXT_TAG_PATTERN",/(^| )[@+][\w-]+/);a.const_set(J[0],"PRIORITY_FLAG","*");a.const_set(J[0],"TODO_FILE","todo.jsonl");a.def(H,"$execute",D=function(ka){var N=d,M=d,ja=d,sa=d,ea=d,ua=d,Da=d,Ga=d,Ra=d,Pa=d,Ha=d,eb=d;this.text_buffer=[];try{this.$setup(),N=ka.$first(),M=v(ja=ka["$[]"](c(1,-1,!1)))?ja:[],sa=N,"add"["$==="](sa)?(v(v(ea=M["$nil?"]())?ea:M["$empty?"]())&&this.$raise(w(N," command requires at least one parameter")),this.$add(M.$join(" "))):"start"["$==="](sa)?v(F(M.$length(), -0))?this.$change_state(M.$first().$to_i(),"started",(v(ua=M["$[]"](c(1,-1,!1)))?ua:[]).$join(" ")):this.$list(d,[":started"]):"done"["$==="](sa)?v(F(M.$length(),0))?this.$change_state(M.$first().$to_i(),"done",(v(Da=M["$[]"](c(1,-1,!1)))?Da:[]).$join(" ")):this.$list(d,[":done"]):"block"["$==="](sa)?v(F(M.$length(),0))?this.$change_state(M.$first().$to_i(),"blocked",(v(Ga=M["$[]"](c(1,-1,!1)))?Ga:[]).$join(" ")):this.$list(d,[":blocked"]):"reset"["$==="](sa)?v(F(M.$length(),0))?this.$change_state(M.$first().$to_i(), +a.const_set(J[0],"CONTEXT_TAG_PATTERN",/(^| )[@+][\w-]+/);a.const_set(J[0],"PRIORITY_FLAG","*");a.const_set(J[0],"TODO_FILE","todo.jsonl");a.def(H,"$execute",D=function(ka){var N=d,M=d,ja=d,sa=d,ea=d,ua=d,Fa=d,Ga=d,Ra=d,Pa=d,Ha=d,fb=d;this.text_buffer=[];try{this.$setup(),N=ka.$first(),M=v(ja=ka["$[]"](c(1,-1,!1)))?ja:[],sa=N,"add"["$==="](sa)?(v(v(ea=M["$nil?"]())?ea:M["$empty?"]())&&this.$raise(w(N," command requires at least one parameter")),this.$add(M.$join(" "))):"start"["$==="](sa)?v(F(M.$length(), +0))?this.$change_state(M.$first().$to_i(),"started",(v(ua=M["$[]"](c(1,-1,!1)))?ua:[]).$join(" ")):this.$list(d,[":started"]):"done"["$==="](sa)?v(F(M.$length(),0))?this.$change_state(M.$first().$to_i(),"done",(v(Fa=M["$[]"](c(1,-1,!1)))?Fa:[]).$join(" ")):this.$list(d,[":done"]):"block"["$==="](sa)?v(F(M.$length(),0))?this.$change_state(M.$first().$to_i(),"blocked",(v(Ga=M["$[]"](c(1,-1,!1)))?Ga:[]).$join(" ")):this.$list(d,[":blocked"]):"reset"["$==="](sa)?v(F(M.$length(),0))?this.$change_state(M.$first().$to_i(), "new",(v(Ra=M["$[]"](c(1,-1,!1)))?Ra:[]).$join(" ")):this.$list(d,[":new"]):"prio"["$==="](sa)?(v(p(M.$length(),1))&&this.$raise(w(N," command requires at least one parameter")),this.$set_priority(M.$first().$to_i(),(v(Pa=M["$[]"](c(1,-1,!1)))?Pa:[]).$join(" "))):"due"["$==="](sa)?(v(p(M.$length(),1))&&this.$raise(w(N," command requires at least one parameter")),this.$due_date(M.$first().$to_i(),(v(Ha=M["$[]"](c(1,-1,!1)))?Ha:[]).$join(" "))):"append"["$==="](sa)?(v(p(M.$length(),2))&&this.$raise(w(N, " command requires at least two parameters")),this.$append(M.$first().$to_i(),M["$[]"](c(1,-1,!1)).$join(" "))):"rename"["$==="](sa)?(v(p(M.$length(),2))&&this.$raise(w(N," command requires at least two parameters")),this.$rename(M.$first().$to_i(),M["$[]"](c(1,-1,!1)).$join(" "))):"del"["$==="](sa)?(v(M.$length()["$!="](1))&&this.$raise(w(N," command requires exactly one parameter")),this.$delete(M.$first().$to_i())):"note"["$==="](sa)?(v(p(M.$length(),2))&&this.$raise(w(N," command requires at least two parameters")), this.$add_note(M.$first().$to_i(),M["$[]"](c(1,-1,!1)).$join(" "))):"delnote"["$==="](sa)?(v(M.$length()["$!="](1))&&this.$raise(w(N," command requires exactly one parameter")),this.$delete_note(M.$first().$to_i())):"list"["$==="](sa)?this.$list(d,M):"show"["$==="](sa)?(v(M.$length()["$!="](1))&&this.$raise(w(N," command requires exactly one parameter")),this.$show(M.$first().$to_i())):"help"["$==="](sa)?(v(F(M.$length(),0))&&this.$raise(w(N," command has no parameters")),this.text_buffer.$push(this.$usage().$strip())): -"cleanup"["$==="](sa)?(v(v(eb=M["$nil?"]())?eb:M["$empty?"]())&&this.$raise(w(N," command requires at least one parameter")),this.$cleanup(M)):this.$list(d,ka)}catch(kb){if(a.rescue(kb,[G(z(J,"JS"),"Error"),z(J,"RuntimeError")])){ka=kb;try{this.text_buffer.$push(""+this.$colorize("ERROR:","red")+" "+ka)}finally{a.pop_exception()}}else throw kb;}return this},D.$$arity=1);a.def(H,"$to_s",T=function(){var ka=d;return w((v(ka=this.text_buffer)?ka:[]).$join("\n"),"\n")},T.$$arity=0);a.def(H,"$to_html", +"cleanup"["$==="](sa)?(v(v(fb=M["$nil?"]())?fb:M["$empty?"]())&&this.$raise(w(N," command requires at least one parameter")),this.$cleanup(M)):this.$list(d,ka)}catch(kb){if(a.rescue(kb,[G(z(J,"JS"),"Error"),z(J,"RuntimeError")])){ka=kb;try{this.text_buffer.$push(""+this.$colorize("ERROR:","red")+" "+ka)}finally{a.pop_exception()}}else throw kb;}return this},D.$$arity=1);a.def(H,"$to_s",T=function(){var ka=d;return w((v(ka=this.text_buffer)?ka:[]).$join("\n"),"\n")},T.$$arity=0);a.def(H,"$to_html", ia=function(){return w(w('',this.$to_s().$gsub("&","&").$gsub("<","<").$gsub(">",">").$gsub(" "," ").$gsub("\n","
").$gsub(/e\[0m/,"
").$gsub(/e\[(\d+)m/,'')),"")},ia.$$arity=0);H.$private();a.def(H,"$usage",da=function(){var ka,N;return"Usage: todo \n\nCommands:\n* add add new task\n* start [text] mark task as started, with optional note\n* done [text] mark task as completed, with optional note\n* block [text] mark task as blocked, with optional note\n* reset [text] reset task to new state, with optional note\n* prio [text] toggle high priority flag, with optional note\n* due [date] set/unset due date (in YYYY-MM-DD format)\n\n* append append text to task title\n* rename rename task\n* del delete task\n* note add note to task\n* delnote delete all notes from task\n\n* list [regex...] list tasks (only active tasks by default)\n* show show all task details\n* cleanup [regex...] cleanup completed tasks by regex\n* help this help screen\n\nWith list command the following pre-defined regex patterns can be also used:\n"+ this.queries.$keys().$join(", ")+'\n\nDue dates can be also added via tags in task title: "due:YYYY-MM-DD"\n\nLegend:\n'+l(l(z(J,"STATES"),"select",[],(ka=function(M){null==M&&(M=d);return M["$!="]("default")},ka.$$s=this,ka.$$arity=2,ka)),"map",[],(N=function(M,ja){null==M&&(M=d);null==ja&&(ja=d);return""+M+" "+ja},N.$$s=this,N.$$arity=2,N)).$join(", ")+", priority "+z(J,"PRIORITY_FLAG")+"\n\nLocal storage: "+z(J,"TODO_FILE")+"\n"},da.$$arity=0);a.def(H,"$setup",ma=function(){var ka,N,M,ja,sa,ea, -ua,Da,Ga,Ra,Pa,Ha,eb=d,kb=d;this.today=z(J,"Date").$parse(z(J,"Date").$today().$strftime(z(J,"DATE_FORMAT")));eb=l(c(0,6,!1),"map",[],(ka=function(R){var ya=null==ka.$$s?this:ka.$$s;null==ya.today&&(ya.today=d);null==R&&(R=d);return w(ya.today,R)},ka.$$s=this,ka.$$arity=1,ka));this.due_date_days=l(eb,"map",[],(N=function(R){null==R&&(R=d);return R.$strftime("%A").$downcase()},N.$$s=this,N.$$arity=1,N));kb=l(eb,"map",[],(M=function(R){null==R&&(R=d);return R.$strftime(z(J,"DATE_FORMAT"))},M.$$s=this, -M.$$arity=1,M));return this.queries=h(":active :done :blocked :started :new :all :today :tomorrow :next7days".split(" "),{":active":l(this,"lambda",[],(ja=function(R){null==R&&(R=d);return/(new|started|blocked)/.$match(R["$[]"]("state"))},ja.$$s=this,ja.$$arity=1,ja)),":done":l(this,"lambda",[],(sa=function(R){null==R&&(R=d);return"done"["$=="](R["$[]"]("state"))},sa.$$s=this,sa.$$arity=1,sa)),":blocked":l(this,"lambda",[],(ea=function(R){null==R&&(R=d);return"blocked"["$=="](R["$[]"]("state"))}, -ea.$$s=this,ea.$$arity=1,ea)),":started":l(this,"lambda",[],(ua=function(R){null==R&&(R=d);return"started"["$=="](R["$[]"]("state"))},ua.$$s=this,ua.$$arity=1,ua)),":new":l(this,"lambda",[],(Da=function(R){null==R&&(R=d);return"new"["$=="](R["$[]"]("state"))},Da.$$s=this,Da.$$arity=1,Da)),":all":l(this,"lambda",[],(Ga=function(R){null==R&&(R=d);return/\w+/.$match(R["$[]"]("state"))},Ga.$$s=this,Ga.$$arity=1,Ga)),":today":l(this,"lambda",[],(Ra=function(R){null==R&&(R=d);return kb["$[]"](0)["$=="](R["$[]"]("due"))}, -Ra.$$s=this,Ra.$$arity=1,Ra)),":tomorrow":l(this,"lambda",[],(Pa=function(R){null==R&&(R=d);return kb["$[]"](1)["$=="](R["$[]"]("due"))},Pa.$$s=this,Pa.$$arity=1,Pa)),":next7days":l(this,"lambda",[],(Ha=function(R){null==R&&(R=d);return a.regexp(["(",kb.$join("|"),")"]).$match(R["$[]"]("due"))},Ha.$$s=this,Ha.$$arity=1,Ha))})},ma.$$arity=0);a.def(H,"$load_tasks",b=function(ka){var N,M=d,ja=d,sa=d,ea=d;null==ka&&(ka=d);M=0;ja=h([],{});sa=window.localStorage.getItem(z(J,"TODO_FILE"))||"";v(sa["$empty?"]()["$!"]())&& +ua,Fa,Ga,Ra,Pa,Ha,fb=d,kb=d;this.today=z(J,"Date").$parse(z(J,"Date").$today().$strftime(z(J,"DATE_FORMAT")));fb=l(c(0,6,!1),"map",[],(ka=function(S){var ya=null==ka.$$s?this:ka.$$s;null==ya.today&&(ya.today=d);null==S&&(S=d);return w(ya.today,S)},ka.$$s=this,ka.$$arity=1,ka));this.due_date_days=l(fb,"map",[],(N=function(S){null==S&&(S=d);return S.$strftime("%A").$downcase()},N.$$s=this,N.$$arity=1,N));kb=l(fb,"map",[],(M=function(S){null==S&&(S=d);return S.$strftime(z(J,"DATE_FORMAT"))},M.$$s=this, +M.$$arity=1,M));return this.queries=h(":active :done :blocked :started :new :all :today :tomorrow :next7days".split(" "),{":active":l(this,"lambda",[],(ja=function(S){null==S&&(S=d);return/(new|started|blocked)/.$match(S["$[]"]("state"))},ja.$$s=this,ja.$$arity=1,ja)),":done":l(this,"lambda",[],(sa=function(S){null==S&&(S=d);return"done"["$=="](S["$[]"]("state"))},sa.$$s=this,sa.$$arity=1,sa)),":blocked":l(this,"lambda",[],(ea=function(S){null==S&&(S=d);return"blocked"["$=="](S["$[]"]("state"))}, +ea.$$s=this,ea.$$arity=1,ea)),":started":l(this,"lambda",[],(ua=function(S){null==S&&(S=d);return"started"["$=="](S["$[]"]("state"))},ua.$$s=this,ua.$$arity=1,ua)),":new":l(this,"lambda",[],(Fa=function(S){null==S&&(S=d);return"new"["$=="](S["$[]"]("state"))},Fa.$$s=this,Fa.$$arity=1,Fa)),":all":l(this,"lambda",[],(Ga=function(S){null==S&&(S=d);return/\w+/.$match(S["$[]"]("state"))},Ga.$$s=this,Ga.$$arity=1,Ga)),":today":l(this,"lambda",[],(Ra=function(S){null==S&&(S=d);return kb["$[]"](0)["$=="](S["$[]"]("due"))}, +Ra.$$s=this,Ra.$$arity=1,Ra)),":tomorrow":l(this,"lambda",[],(Pa=function(S){null==S&&(S=d);return kb["$[]"](1)["$=="](S["$[]"]("due"))},Pa.$$s=this,Pa.$$arity=1,Pa)),":next7days":l(this,"lambda",[],(Ha=function(S){null==S&&(S=d);return a.regexp(["(",kb.$join("|"),")"]).$match(S["$[]"]("due"))},Ha.$$s=this,Ha.$$arity=1,Ha))})},ma.$$arity=0);a.def(H,"$load_tasks",b=function(ka){var N,M=d,ja=d,sa=d,ea=d;null==ka&&(ka=d);M=0;ja=h([],{});sa=window.localStorage.getItem(z(J,"TODO_FILE"))||"";v(sa["$empty?"]()["$!"]())&& l(sa.$split("\n"),"each",[],(N=function(ua){null==ua&&(ua=d);if(ua.$strip()["$=="](""))return d;M=w(M,1);ua=[M,z(J,"JSON").$parse(ua.$chomp(),h(["symbolize_names"],{symbolize_names:!0}))];l(ja,"[]=",a.to_a(ua));return ua[t(ua.length,1)]},N.$$s=this,N.$$arity=1,N));v(v(ea=ka)?ja["$has_key?"](ka)["$!"]():ea)&&this.$raise(""+ka+": No such todo");return ja},b.$$arity=-1);a.def(H,"$write_tasks",m=function(ka){var N,M=d;M=w(l(ka.$keys().$sort(),"map",[],(N=function(ja){null==ja&&(ja=d);return z(J,"JSON").$generate(ka["$[]"](ja))}, N.$$s=this,N.$$arity=1,N)).$join("\n"),"\n");return window.localStorage.setItem(z(J,"TODO_FILE"),M)},m.$$arity=1);a.def(H,"$postprocess_tags",g=function(ka){var N=ka["$[]"]("title").$match(z(J,"DUE_DATE_TAG_PATTERN"));if(v(N)){var M=["title",ka["$[]"]("title").$gsub(z(J,"DUE_DATE_TAG_PATTERN"),"")];l(ka,"[]=",a.to_a(M));M[t(M.length,1)];M=["due",this.$convert_due_date(N["$[]"](2))];l(ka,"[]=",a.to_a(M));M[t(M.length,1)]}return v(ka["$[]"]("title")["$empty?"]())?this.$raise("title must not be empty"): d},g.$$arity=1);a.def(H,"$add",r=function(ka){ka=h(["state","title","modified"],{state:"new",title:ka,modified:this.today.$strftime(z(J,"DATE_FORMAT"))});this.$postprocess_tags(ka);var N=window.localStorage.getItem(z(J,"TODO_FILE"))||"";N=w(N,w(z(J,"JSON").$generate(ka),"\n"));window.localStorage.setItem(z(J,"TODO_FILE"),N);return this.$list()},r.$$arity=1);a.def(H,"$update_task",A=function(ka,N,M){var ja=this.$load_tasks(ka);M.$call(ja["$[]"](ka));M=["modified",this.today.$strftime(z(J,"DATE_FORMAT"))]; @@ -743,16 +743,16 @@ l(ja["$[]"](ka),"[]=",a.to_a(M));M[t(M.length,1)];this.$write_tasks(ja);return"s -2);a.def(H,"$rename",I=function(ka,N){var M;return this.$update_task(ka,"list",l(this,"lambda",[],(M=function(ja){var sa=null==M.$$s?this:M.$$s;null==ja&&(ja=d);var ea=["title",N];l(ja,"[]=",a.to_a(ea));ea[t(ea.length,1)];return sa.$postprocess_tags(ja)},M.$$s=this,M.$$arity=1,M)))},I.$$arity=2);a.def(H,"$delete",L=function(ka){var N=this.$load_tasks(ka);N.$delete(ka);this.$write_tasks(N);return this.$list()},L.$$arity=1);a.def(H,"$change_state",ba=function(ka,N,M){var ja;null==M&&(M=d);return this.$update_task(ka, "list",l(this,"lambda",[],(ja=function(sa){var ea=d;null==sa&&(sa=d);var ua=["state",N];l(sa,"[]=",a.to_a(ua));ua[t(ua.length,1)];return v(v(ea=M["$nil?"]()["$!"]())?M["$empty?"]()["$!"]():ea)?(v(ua=sa["$[]"]("note"))?ua:(ua=["note",[]],l(sa,"[]=",a.to_a(ua)),ua[t(ua.length,1)]),sa["$[]"]("note").$push(M)):d},ja.$$s=this,ja.$$arity=1,ja)))},ba.$$arity=-3);a.def(H,"$set_priority",va=function(ka,N){var M;null==N&&(N=d);return this.$update_task(ka,"list",l(this,"lambda",[],(M=function(ja){var sa=d;null== ja&&(ja=d);var ea=["priority",ja["$[]"]("priority")["$!"]()];l(ja,"[]=",a.to_a(ea));ea[t(ea.length,1)];v(ja["$[]"]("priority")["$!"]())&&ja.$delete("priority");return v(v(sa=N["$nil?"]()["$!"]())?N["$empty?"]()["$!"]():sa)?(v(ea=ja["$[]"]("note"))?ea:(ea=["note",[]],l(ja,"[]=",a.to_a(ea)),ea[t(ea.length,1)]),ja["$[]"]("note").$push(N)):d},M.$$s=this,M.$$arity=1,M)))},va.$$arity=-2);a.def(H,"$due_date",Oa=function(ka,N){var M;null==N&&(N="");return this.$update_task(ka,"list",l(this,"lambda",[],(M= -function(ja){var sa=null==M.$$s?this:M.$$s;null==ja&&(ja=d);sa=["due",sa.$convert_due_date(N)];l(ja,"[]=",a.to_a(sa));sa[t(sa.length,1)];return v(ja["$[]"]("due")["$nil?"]())?ja.$delete("due"):d},M.$$s=this,M.$$arity=1,M)))},Oa.$$arity=-2);a.def(H,"$list",wa=function(ka,N){var M,ja,sa=d,ea=d,ua=d,Da=d;null==ka&&(ka=d);null==N&&(N=d);ka=v(sa=ka)?sa:this.$load_tasks();ea=[ka.$keys().$max().$to_s().$size(),4].$max();N=v(v(ua=N["$nil?"]())?ua:N["$empty?"]())?[":active"]:N;Da=this.$filter_tasks(ka,N); -Da=l(Da,"sort_by",[],(M=function(Ga,Ra){var Pa=d,Ha=d,eb=d;null==Ga&&(Ga=d);null==Ra&&(Ra=d);return[v(v(Pa=Ra["$[]"]("priority"))?Ra["$[]"]("state")["$!="]("done"):Pa)?0:1,z(J,"ORDER")["$[]"](v(Ha=Ra["$[]"]("state"))?Ha:"default"),v(eb=Ra["$[]"]("due"))?eb:"n/a",Ga]},M.$$s=this,M.$$arity=2,M));l(Da,"each",[],(ja=function(Ga,Ra){var Pa=null==ja.$$s?this:ja.$$s,Ha,eb=d,kb=d,R=d,ya=R=d,Ca=d,Ua=d,ib=d,cb=eb=d,ab=d;null==Pa.today&&(Pa.today=d);null==Pa.due_date_days&&(Pa.due_date_days=d);null==Pa.text_buffer&& -(Pa.text_buffer=d);null==Ga&&(Ga=d);null==Ra&&(Ra=d);eb=v(kb=Ra["$[]"]("state"))?kb:"default";R=z(J,"COLORS")["$[]"](eb);R=Pa.$colorize(z(J,"STATES")["$[]"](eb),R);ya=l(Ra["$[]"]("title"),"gsub",[z(J,"CONTEXT_TAG_PATTERN")],(Ha=function(Xa){var za=null==Ha.$$s?this:Ha.$$s;null==Xa&&(Xa=d);return w(v(Xa["$start_with?"](" "))?" ":"",za.$colorize(Xa.$strip(),"cyan"))},Ha.$$s=Pa,Ha.$$arity=1,Ha));Ca=v(Ra["$[]"]("priority"))?Pa.$colorize(z(J,"PRIORITY_FLAG"),"red"):" ";Ua="";v(v(ib=Ra["$[]"]("due"))?eb["$!="]("done"): -ib)&&(eb=t(z(J,"Date").$parse(Ra["$[]"]("due")),Pa.today).$to_i(),v(p(eb,0))?Ua=Pa.$colorize("("+eb.$abs()+"d overdue)","red"):v(v(cb=eb["$=="](0))?cb:eb["$=="](1))?Ua=Pa.$colorize("("+z(J,"DUE_DATE_DAYS_SIMPLE")["$[]"](eb)+")","yellow"):v(F(eb,1))&&(Ua=Pa.$colorize("("+(v(ab=Pa.due_date_days["$[]"](eb))?ab:Ra["$[]"]("due"))+")","magenta")),Ua=w(" ",Ua));return Pa.text_buffer.$push(""+Ga.$to_s().$rjust(ea," ")+":"+Ca+R+" "+ya+Ua)},ja.$$s=this,ja.$$arity=2,ja));return v(Da["$empty?"]())?this.text_buffer.$push("No todos found"): -d},wa.$$arity=-1);a.def(H,"$add_note",Aa=function(ka,N){var M;return this.$update_task(ka,"show",l(this,"lambda",[],(M=function(ja){var sa;null==ja&&(ja=d);v(sa=ja["$[]"]("note"))?sa:(sa=["note",[]],l(ja,"[]=",a.to_a(sa)),sa[t(sa.length,1)]);return ja["$[]"]("note").$push(N)},M.$$s=this,M.$$arity=1,M)))},Aa.$$arity=2);a.def(H,"$delete_note",La=function(ka){var N;return this.$update_task(ka,"show",l(this,"lambda",[],(N=function(M){null==M&&(M=d);return M.$delete("note")},N.$$s=this,N.$$arity=1,N)))}, -La.$$arity=1);a.def(H,"$show",na=function(ka,N){var M,ja=d;null==N&&(N=d);N=v(ja=N)?ja:this.$load_tasks(ka);return l(N["$[]"](ka),"each",[],(M=function(sa,ea){var ua=null==M.$$s?this:M.$$s;null==ua.text_buffer&&(ua.text_buffer=d);null==sa&&(sa=d);null==ea&&(ea=d);ea=v(ea["$kind_of?"](z(J,"Array")))?w("\n",ea.$join("\n")):ea;return ua.text_buffer.$push(""+ua.$colorize(w(sa.$to_s().$rjust(10," "),":"),"cyan")+" "+ea)},M.$$s=this,M.$$arity=2,M))},na.$$arity=-2);a.def(H,"$cleanup",U=function(ka){var N, -M=d,ja=d;M=this.$load_tasks();ka=w([":done"],ka.$to_a());ja=this.$filter_tasks(M,ka);l(ja.$keys(),"each",[],(N=function(sa){null==sa&&(sa=d);return M.$delete(sa)},N.$$s=this,N.$$arity=1,N));this.$write_tasks(M);return this.text_buffer.$push("Deleted "+ja.$size()+" todo(s)")},U.$$arity=1);a.def(H,"$filter_tasks",ra=function(ka,N){var M,ja=d;ja=h([],{});l(ka,"each",[],(M=function(sa,ea){var ua=null==M.$$s?this:M.$$s,Da,Ga=d,Ra=d;null==sa&&(sa=d);null==ea&&(ea=d);Ga=!0;l(N,"each",[],(Da=function(Pa){var Ha= -null==Da.$$s?this:Da.$$s;null==Ha.queries&&(Ha.queries=d);null==Pa&&(Pa=d);return v(v(Ha.queries["$[]"](Pa))?Ha.queries["$[]"](Pa).$call(ea):a.regexp([Pa],"i").$match(ea["$[]"]("title")))?d:Ga=!1},Da.$$s=ua,Da.$$arity=1,Da));return v(Ga)?(Ra=[sa,ea],l(ja,"[]=",a.to_a(Ra)),Ra[t(Ra.length,1)]):d},M.$$s=this,M.$$arity=2,M));return ja},ra.$$arity=2);a.def(H,"$colorize",xa=function(ka,N){return"e["+z(J,"COLOR_CODES")["$[]"](N)+"m"+ka+"e[0m"},xa.$$arity=2);return(a.def(H,"$convert_due_date",Ja=function(ka){var N, -M=this,ja=d,sa=ja=d,ea=d,ua=d;ja=d;ja=function(){return v(sa=v(ea=M.due_date_days.$index(ka.$to_s().$downcase()))?ea:z(J,"DUE_DATE_DAYS_SIMPLE").$index(ka.$to_s().$downcase()))?sa:l(M.due_date_days,"map",[],(N=function(Da){null==Da&&(Da=d);return Da["$[]"](c(0,2,!1))},N.$$s=M,N.$$arity=1,N)).$index(ka.$to_s().$downcase())}();return ja=v(ja)?w(M.today,ja).$strftime(z(J,"DATE_FORMAT")):v(v(ua=ka["$nil?"]())?ua:ka["$empty?"]())?d:z(J,"Date").$parse(ka).$strftime(z(J,"DATE_FORMAT"))},Ja.$$arity=1),d)&& -"convert_due_date"}(q[0],null,q)}; -(function(a){var w,F=a.top,p=[],t=a.nil,y=a.$$$,q=a.$$,d=a.send,G=t,z=t;a.add_stubs("$require $new $lambda $to_html $execute $+".split(" "));F.$require("./todo.js.rb");G=q(p,"Todo").$new();z=d(F,"lambda",[],(w=function(f,h,v){null==f&&(f=t);null==h&&(h=t);null==v&&(v=t);var c=f.output,l=G,H=l.$execute;h=[h];v="number"===typeof h&&"number"===typeof v?h+v:h["$+"](v);return c.call(f,H.call(l,v).$to_html())},w.$$s=F,w.$$arity=3,w));(new VanillaTerminal({welcome:'todo list manager REPL v0.1.30
Type "help" or "copyright" for more information.

',defaultCallback:z, -prompt:"todo",commands:{cls:function(f){f.clear()},copyright:function(f){f.output('todo-jsonl - Copyright (c) 2020-2021 Gabor Bata
opal - Copyright (c) 2013-2021 Adam Beynon and the Opal contributors
vanilla-terminal - Copyright (c) 2018 Javier Jimenez Villar
')},wipe:function(f){f.prompt("Are you sure remove all your todo data? y/n",function(h){"Y"===h.trim().toUpperCase()&&(localStorage.removeItem(y(q(p,"Todo"),"TODO_FILE")),f.history=[],f.historyCursor=0,f.output("todo data wiped"))})}}})).output(G.$execute(["list"]).$to_html())})(Opal); -var Qb=Opal.$$;Opal.add_stubs(["$exit"]);Qb([],"Kernel").$exit();}).call(this); +function(ja){var sa=null==M.$$s?this:M.$$s;null==ja&&(ja=d);sa=["due",sa.$convert_due_date(N)];l(ja,"[]=",a.to_a(sa));sa[t(sa.length,1)];return v(ja["$[]"]("due")["$nil?"]())?ja.$delete("due"):d},M.$$s=this,M.$$arity=1,M)))},Oa.$$arity=-2);a.def(H,"$list",wa=function(ka,N){var M,ja,sa=d,ea=d,ua=d,Fa=d;null==ka&&(ka=d);null==N&&(N=d);ka=v(sa=ka)?sa:this.$load_tasks();ea=[ka.$keys().$max().$to_s().$size(),4].$max();N=v(v(ua=N["$nil?"]())?ua:N["$empty?"]())?[":active"]:N;Fa=l(this.$filter_tasks(ka,N), +"sort_by",[],(M=function(Ga,Ra){var Pa=d,Ha=d,fb=d;null==Ga&&(Ga=d);null==Ra&&(Ra=d);return[v(v(Pa=Ra["$[]"]("priority"))?Ra["$[]"]("state")["$!="]("done"):Pa)?0:1,z(J,"ORDER")["$[]"](v(Ha=Ra["$[]"]("state"))?Ha:"default"),v(fb=Ra["$[]"]("due"))?fb:"n/a",Ga]},M.$$s=this,M.$$arity=2,M));l(Fa,"each",[],(ja=function(Ga,Ra){var Pa=null==ja.$$s?this:ja.$$s,Ha,fb=d,kb=d,S=d,ya=d,Ca=d,Va=d,cb=d,db=d,ab=fb=d,Ya=d;null==Pa.today&&(Pa.today=d);null==Pa.due_date_days&&(Pa.due_date_days=d);null==Pa.text_buffer&& +(Pa.text_buffer=d);null==Ga&&(Ga=d);null==Ra&&(Ra=d);fb=v(kb=Ra["$[]"]("state"))?kb:"default";S=Pa.$colorize(z(J,"STATES")["$[]"](fb),z(J,"COLORS")["$[]"](fb));ya=l(Ra["$[]"]("title"),"gsub",[z(J,"CONTEXT_TAG_PATTERN")],(Ha=function(za){var ta=null==Ha.$$s?this:Ha.$$s;null==za&&(za=d);return w(v(za["$start_with?"](" "))?" ":"",ta.$colorize(za.$strip(),"cyan"))},Ha.$$s=Pa,Ha.$$arity=1,Ha));Ca=v(v(Va=Ra["$[]"]("priority"))?fb["$!="]("done"):Va)?Pa.$colorize(z(J,"PRIORITY_FLAG"),"red"):" ";cb="";v(v(db= +Ra["$[]"]("due"))?fb["$!="]("done"):db)&&(fb=t(z(J,"Date").$parse(Ra["$[]"]("due")),Pa.today).$to_i(),v(p(fb,0))?cb=Pa.$colorize("("+fb.$abs()+"d overdue)","red"):v(v(ab=fb["$=="](0))?ab:fb["$=="](1))?cb=Pa.$colorize("("+z(J,"DUE_DATE_DAYS_SIMPLE")["$[]"](fb)+")","yellow"):v(F(fb,1))&&(cb=Pa.$colorize("("+(v(Ya=Pa.due_date_days["$[]"](fb))?Ya:Ra["$[]"]("due"))+")","magenta")),cb=w(" ",cb));return Pa.text_buffer.$push(""+Ga.$to_s().$rjust(ea," ")+":"+Ca+S+" "+ya+cb)},ja.$$s=this,ja.$$arity=2,ja)); +return v(Fa["$empty?"]())?this.text_buffer.$push("No todos found"):d},wa.$$arity=-1);a.def(H,"$add_note",Aa=function(ka,N){var M;return this.$update_task(ka,"show",l(this,"lambda",[],(M=function(ja){var sa;null==ja&&(ja=d);v(sa=ja["$[]"]("note"))?sa:(sa=["note",[]],l(ja,"[]=",a.to_a(sa)),sa[t(sa.length,1)]);return ja["$[]"]("note").$push(N)},M.$$s=this,M.$$arity=1,M)))},Aa.$$arity=2);a.def(H,"$delete_note",La=function(ka){var N;return this.$update_task(ka,"show",l(this,"lambda",[],(N=function(M){null== +M&&(M=d);return M.$delete("note")},N.$$s=this,N.$$arity=1,N)))},La.$$arity=1);a.def(H,"$show",na=function(ka,N){var M,ja=d;null==N&&(N=d);N=v(ja=N)?ja:this.$load_tasks(ka);return l(N["$[]"](ka),"each",[],(M=function(sa,ea){var ua=null==M.$$s?this:M.$$s;null==ua.text_buffer&&(ua.text_buffer=d);null==sa&&(sa=d);null==ea&&(ea=d);ea=v(ea["$kind_of?"](z(J,"Array")))?w("\n",ea.$join("\n")):ea;return ua.text_buffer.$push(""+ua.$colorize(w(sa.$to_s().$rjust(10," "),":"),"cyan")+" "+ea)},M.$$s=this,M.$$arity= +2,M))},na.$$arity=-2);a.def(H,"$cleanup",U=function(ka){var N,M=d,ja=d;M=this.$load_tasks();ka=w([":done"],ka.$to_a());ja=this.$filter_tasks(M,ka);l(ja.$keys(),"each",[],(N=function(sa){null==sa&&(sa=d);return M.$delete(sa)},N.$$s=this,N.$$arity=1,N));this.$write_tasks(M);return this.text_buffer.$push("Deleted "+ja.$size()+" todo(s)")},U.$$arity=1);a.def(H,"$filter_tasks",ra=function(ka,N){var M,ja=d;ja=h([],{});l(ka,"each",[],(M=function(sa,ea){var ua=null==M.$$s?this:M.$$s,Fa,Ga=d,Ra=d;null==sa&& +(sa=d);null==ea&&(ea=d);Ga=!0;l(N,"each",[],(Fa=function(Pa){var Ha=null==Fa.$$s?this:Fa.$$s;null==Ha.queries&&(Ha.queries=d);null==Pa&&(Pa=d);return v(v(Ha.queries["$[]"](Pa))?Ha.queries["$[]"](Pa).$call(ea):a.regexp([Pa],"i").$match(ea["$[]"]("title")))?d:Ga=!1},Fa.$$s=ua,Fa.$$arity=1,Fa));return v(Ga)?(Ra=[sa,ea],l(ja,"[]=",a.to_a(Ra)),Ra[t(Ra.length,1)]):d},M.$$s=this,M.$$arity=2,M));return ja},ra.$$arity=2);a.def(H,"$colorize",xa=function(ka,N){var M=d;return"e["+(v(M=z(J,"COLOR_CODES")["$[]"](N))? +M:37)+"m"+ka+"e[0m"},xa.$$arity=2);return(a.def(H,"$convert_due_date",Ja=function(ka){var N,M=this,ja=d,sa=ja=d,ea=d,ua=d;ja=d;ja=function(){return v(sa=v(ea=M.due_date_days.$index(ka.$to_s().$downcase()))?ea:z(J,"DUE_DATE_DAYS_SIMPLE").$index(ka.$to_s().$downcase()))?sa:l(M.due_date_days,"map",[],(N=function(Fa){null==Fa&&(Fa=d);return Fa["$[]"](c(0,2,!1))},N.$$s=M,N.$$arity=1,N)).$index(ka.$to_s().$downcase())}();return ja=v(ja)?w(M.today,ja).$strftime(z(J,"DATE_FORMAT")):v(v(ua=ka["$nil?"]())? +ua:ka["$empty?"]())?d:z(J,"Date").$parse(ka).$strftime(z(J,"DATE_FORMAT"))},Ja.$$arity=1),d)&&"convert_due_date"}(q[0],null,q)}; +(function(a){var w,F=a.top,p=[],t=a.nil,y=a.$$$,q=a.$$,d=a.send,G=t,z=t;a.add_stubs("$require $new $lambda $to_html $execute $+".split(" "));F.$require("./todo.js.rb");G=q(p,"Todo").$new();z=d(F,"lambda",[],(w=function(f,h,v){null==f&&(f=t);null==h&&(h=t);null==v&&(v=t);var c=f.output,l=G,H=l.$execute;h=[h];v="number"===typeof h&&"number"===typeof v?h+v:h["$+"](v);return c.call(f,H.call(l,v).$to_html())},w.$$s=F,w.$$arity=3,w));(new VanillaTerminal({welcome:'todo list manager REPL v0.1.31
Type "help" or "copyright" for more information.

', +defaultCallback:z,prompt:"todo",commands:{cls:function(f){f.clear()},copyright:function(f){f.output('todo-jsonl - Copyright (c) 2020-2021 Gabor Bata
opal - Copyright (c) 2013-2021 Adam Beynon and the Opal contributors
vanilla-terminal - Copyright (c) 2018 Javier Jimenez Villar
')},wipe:function(f){f.prompt("Are you sure remove all your todo data? y/n",function(h){"Y"===h.trim().toUpperCase()&&(localStorage.removeItem(y(q(p,"Todo"),"TODO_FILE")),f.history=[],f.historyCursor= +0,f.output("todo data wiped"))})}}})).output(G.$execute(["list"]).$to_html())})(Opal);var Qb=Opal.$$;Opal.add_stubs(["$exit"]);Qb([],"Kernel").$exit();}).call(this); diff --git a/web/app.js.rb b/web/app.js.rb index 17df833..303e8f0 100644 --- a/web/app.js.rb +++ b/web/app.js.rb @@ -8,7 +8,7 @@ ` var term = new VanillaTerminal({ - 'welcome': 'todo list manager REPL v0.1.30
Type "help" or "copyright" for more information.

', + 'welcome': 'todo list manager REPL v0.1.31
Type "help" or "copyright" for more information.

', 'defaultCallback': default_callback, 'prompt': 'todo', 'commands': { diff --git a/web/todo.js.rb b/web/todo.js.rb index c19e3d7..968ede9 100644 --- a/web/todo.js.rb +++ b/web/todo.js.rb @@ -310,18 +310,16 @@ def list(tasks = nil, patterns = nil) tasks = tasks || load_tasks task_indent = [tasks.keys.max.to_s.size, 4].max patterns = patterns.nil? || patterns.empty? ? [':active'] : patterns - items = filter_tasks(tasks, patterns) - items = items.sort_by do |num, task| + items = filter_tasks(tasks, patterns).sort_by do |num, task| [task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num] end items.each do |num, task| state = task[:state] || 'default' - color = COLORS[state] - display_state = colorize(STATES[state], color) + display_state = colorize(STATES[state], COLORS[state]) title = task[:title].gsub(CONTEXT_TAG_PATTERN) do |tag| (tag.start_with?(' ') ? ' ' : '') + colorize(tag.strip, :cyan) end - priority_flag = task[:priority] ? colorize(PRIORITY_FLAG, :red) : ' ' + priority_flag = task[:priority] && state != 'done' ? colorize(PRIORITY_FLAG, :red) : ' ' due_date = '' if task[:due] && state != 'done' date_diff = (Date.parse(task[:due]) - @today).to_i @@ -382,7 +380,7 @@ def filter_tasks(tasks, patterns) end def colorize(text, color) - "\e[#{COLOR_CODES[color]}m#{text}\e[0m" + "\e[#{COLOR_CODES[color] || 37}m#{text}\e[0m" end def convert_due_date(date)