(function(undefined) { // @note // A few conventions for the documentation of this file: // 1. Always use "//" (in contrast with "/**/") // 2. The syntax used is Yardoc (yardoc.org), which is intended for Ruby (se below) // 3. `@param` and `@return` types should be preceded by `JS.` when referring to // JavaScript constructors (e.g. `JS.Function`) otherwise Ruby is assumed. // 4. `nil` and `null` being unambiguous refer to the respective // objects/values in Ruby and JavaScript // 5. This is still WIP :) so please give feedback and suggestions on how // to improve or for alternative solutions // // The way the code is digested before going through Yardoc is a secret kept // in the docs repo (https://github.com/opal/docs/tree/master). if (typeof(this.Opal) !== 'undefined') { console.warn('Opal already loaded. Loading twice can cause troubles, please fix your setup.'); return this.Opal; } var nil; // The actual class for BasicObject var BasicObject; // The actual Object class. // The leading underscore is to avoid confusion with window.Object() var _Object; // The actual Module class var Module; // The actual Class class var Class; // Constructor for instances of BasicObject function BasicObject_alloc(){} // Constructor for instances of Object function Object_alloc(){} // Constructor for instances of Class function Class_alloc(){} // Constructor for instances of Module function Module_alloc(){} // Constructor for instances of NilClass (nil) function NilClass_alloc(){} // The Opal object that is exposed globally var Opal = this.Opal = {}; // All bridged classes - keep track to donate methods from Object var bridges = {}; // TopScope is used for inheriting constants from the top scope var TopScope = function(){}; // Opal just acts as the top scope TopScope.prototype = Opal; // To inherit scopes Opal.constructor = TopScope; // List top scope constants Opal.constants = []; // This is a useful reference to global object inside ruby files Opal.global = this; // Configure runtime behavior with regards to require and unsupported fearures Opal.config = { missing_require_severity: 'error', // error, warning, ignore unsupported_features_severity: 'warning' // error, warning, ignore } // Minify common function calls var $hasOwn = Opal.hasOwnProperty; var $slice = Opal.slice = Array.prototype.slice; // Nil object id is always 4 var nil_id = 4; // Generates even sequential numbers greater than 4 // (nil_id) to serve as unique ids for ruby objects var unique_id = nil_id; // Return next unique id Opal.uid = function() { unique_id += 2; return unique_id; }; // Table holds all class variables Opal.cvars = {}; // Globals table Opal.gvars = {}; // Exit function, this should be replaced by platform specific implementation // (See nodejs and phantom for examples) Opal.exit = function(status) { if (Opal.gvars.DEBUG) console.log('Exited with status '+status); }; // keeps track of exceptions for $! Opal.exceptions = []; // @private // Pops an exception from the stack and updates `$!`. Opal.pop_exception = function() { Opal.gvars["!"] = Opal.exceptions.pop() || nil; } // Constants // --------- // Get a constant on the given scope. Every class and module in Opal has a // scope used to store, and inherit, constants. For example, the top level // `Object` in ruby has a scope accessible as `Opal.Object.$$scope`. // // To get the `Array` class using this scope, you could use: // // Opal.Object.$$scope.get("Array") // // If a constant with the given name cannot be found, then a dispatch to the // class/module's `#const_method` is called, which by default will raise an // error. // // @param name [String] the name of the constant to lookup // @return [Object] // Opal.get = function(name) { var constant = this[name]; if (constant == null) { return this.base.$const_get(name); } return constant; }; // Create a new constants scope for the given class with the given // base. Constants are looked up through their parents, so the base // scope will be the outer scope of the new klass. // // @param base_scope [$$scope] the scope in which the new scope should be created // @param klass [Class] // @param id [String, null] the name of the newly created scope // Opal.create_scope = function(base_scope, klass, id) { var const_alloc = function() {}; var const_scope = const_alloc.prototype = new base_scope.constructor(); klass.$$scope = const_scope; klass.$$base_module = base_scope.base; const_scope.base = klass; const_scope.constructor = const_alloc; const_scope.constants = []; if (id) { Opal.cdecl(base_scope, id, klass); const_alloc.displayName = id+"_scope_alloc"; } }; // Constant assignment, see also `Opal.cdecl` // // @param base_module [Module, Class] the constant namespace // @param name [String] the name of the constant // @param value [Object] the value of the constant // // @example Assigning a namespaced constant // self::FOO = 'bar' // // @example Assigning with Module#const_set // Foo.const_set :BAR, 123 // Opal.casgn = function(base_module, name, value) { function update(klass, name) { klass.$$name = name; for (name in klass.$$scope) { var value = klass.$$scope[name]; if (value.$$name === nil && (value.$$is_class || value.$$is_module)) { update(value, name) } } } var scope = base_module.$$scope; if (value.$$is_class || value.$$is_module) { // Only checking _Object prevents setting a const on an anonymous class // that has a superclass that's not Object if (value.$$is_class || value.$$base_module === _Object) { value.$$base_module = base_module; } if (value.$$name === nil && value.$$base_module.$$name !== nil) { update(value, name); } } scope.constants.push(name); scope[name] = value; // If we dynamically declare a constant in a module, // we should populate all the classes that include this module // with the same constant if (base_module.$$is_module && base_module.$$dep) { for (var i = 0; i < base_module.$$dep.length; i++) { var dep = base_module.$$dep[i]; Opal.casgn(dep, name, value); } } return value; }; // Constant declaration // // @example // FOO = :bar // // @param base_scope [$$scope] the current scope // @param name [String] the name of the constant // @param value [Object] the value of the constant Opal.cdecl = function(base_scope, name, value) { if ((value.$$is_class || value.$$is_module) && value.$$orig_scope == null) { value.$$name = name; value.$$orig_scope = base_scope; // Here we should explicitly set a base module // (a module where the constant was initially defined) value.$$base_module = base_scope.base; base_scope.constructor[name] = value; } base_scope.constants.push(name); return base_scope[name] = value; }; // Modules & Classes // ----------------- // A `class Foo; end` expression in ruby is compiled to call this runtime // method which either returns an existing class of the given name, or creates // a new class in the given `base` scope. // // If a constant with the given name exists, then we check to make sure that // it is a class and also that the superclasses match. If either of these // fail, then we raise a `TypeError`. Note, `superclass` may be null if one // was not specified in the ruby code. // // We pass a constructor to this method of the form `function ClassName() {}` // simply so that classes show up with nicely formatted names inside debuggers // in the web browser (or node/sprockets). // // The `base` is the current `self` value where the class is being created // from. We use this to get the scope for where the class should be created. // If `base` is an object (not a class/module), we simple get its class and // use that as the base instead. // // @param base [Object] where the class is being created // @param superclass [Class,null] superclass of the new class (may be null) // @param id [String] the name of the class to be created // @param constructor [JS.Function] function to use as constructor // // @return new [Class] or existing ruby class // Opal.klass = function(base, superclass, name, constructor) { var klass, bridged, alloc; // If base is an object, use its class if (!base.$$is_class && !base.$$is_module) { base = base.$$class; } // If the superclass is a function then we're bridging a native JS class if (typeof(superclass) === 'function') { bridged = superclass; superclass = _Object; } // Try to find the class in the current scope klass = base.$$scope[name]; // If the class exists in the scope, then we must use that if (klass && klass.$$orig_scope === base.$$scope) { // Make sure the existing constant is a class, or raise error if (!klass.$$is_class) { throw Opal.TypeError.$new(name + " is not a class"); } // Make sure existing class has same superclass if (superclass && klass.$$super !== superclass) { throw Opal.TypeError.$new("superclass mismatch for class " + name); } return klass; } // Class doesnt exist, create a new one with given superclass... // Not specifying a superclass means we can assume it to be Object if (superclass == null) { superclass = _Object; } // If bridged the JS class will also be the alloc function alloc = bridged || Opal.boot_class_alloc(name, constructor, superclass); // Create the class object (instance of Class) klass = Opal.setup_class_object(name, alloc, superclass.$$name, superclass.constructor); // @property $$super the superclass, doesn't get changed by module inclusions klass.$$super = superclass; // @property $$parent direct parent class // starts with the superclass, after klass inclusion is // the last included klass klass.$$parent = superclass; // Every class gets its own constant scope, inherited from current scope Opal.create_scope(base.$$scope, klass, name); // Name new class directly onto current scope (Opal.Foo.Baz = klass) base[name] = klass; if (bridged) { Opal.bridge(klass, alloc); } else { // Copy all parent constants to child, unless parent is Object if (superclass !== _Object && superclass !== BasicObject) { Opal.donate_constants(superclass, klass); } // Call .inherited() hook with new class on the superclass if (superclass.$inherited) { superclass.$inherited(klass); } } return klass; }; // Boot a base class (makes instances). // // @param name [String,null] the class name // @param constructor [JS.Function] the class' instances constructor/alloc function // @param superclass [Class,null] the superclass object // @return [JS.Function] the consturctor holding the prototype for the class' instances Opal.boot_class_alloc = function(name, constructor, superclass) { if (superclass) { var alloc_proxy = function() {}; alloc_proxy.prototype = superclass.$$proto || superclass.prototype; constructor.prototype = new alloc_proxy(); } if (name) { constructor.displayName = name+'_alloc'; } constructor.prototype.constructor = constructor; return constructor; }; // Adds common/required properties to class object (as in `Class.new`) // // @param name [String,null] The name of the class // // @param alloc [JS.Function] The constructor of the class' instances // // @param superclass_name [String,null] // The name of the super class, this is // usefule to build the `.displayName` of the singleton class // // @param superclass_alloc [JS.Function] // The constructor of the superclass from which the singleton_class is // derived. // // @return [Class] Opal.setup_class_object = function(name, alloc, superclass_name, superclass_alloc) { // Grab the superclass prototype and use it to build an intermediary object // in the prototype chain. var superclass_alloc_proxy = function() {}; superclass_alloc_proxy.prototype = superclass_alloc.prototype; superclass_alloc_proxy.displayName = superclass_name; var singleton_class_alloc = function() {} singleton_class_alloc.prototype = new superclass_alloc_proxy(); // The built class is the only instance of its singleton_class var klass = new singleton_class_alloc(); // @property $$alloc This is the constructor of instances of the current // class. Its prototype will be used for method lookup klass.$$alloc = alloc; klass.$$name = name || nil; // @property $$id Each class is assigned a unique `id` that helps // comparation and implementation of `#object_id` klass.$$id = Opal.uid(); // Set a displayName for the singleton_class singleton_class_alloc.displayName = "#"))+">"; // @property $$proto This is the prototype on which methods will be defined klass.$$proto = alloc.prototype; // @property $$proto.$$class Make available to instances a reference to the // class they belong to. klass.$$proto.$$class = klass; // @property constructor keeps a ref to the constructor, but apparently the // constructor is already set on: // // `var klass = new constructor` is called. // // Maybe there are some browsers not abiding (IE6?) klass.constructor = singleton_class_alloc; // @property $$is_class Clearly mark this as a class klass.$$is_class = true; // @property $$class Classes are instances of the class Class klass.$$class = Class; // @property $$inc included modules klass.$$inc = []; return klass; }; // Define new module (or return existing module). The given `base` is basically // the current `self` value the `module` statement was defined in. If this is // a ruby module or class, then it is used, otherwise if the base is a ruby // object then that objects real ruby class is used (e.g. if the base is the // main object, then the top level `Object` class is used as the base). // // If a module of the given name is already defined in the base, then that // instance is just returned. // // If there is a class of the given name in the base, then an error is // generated instead (cannot have a class and module of same name in same base). // // Otherwise, a new module is created in the base with the given name, and that // new instance is returned back (to be referenced at runtime). // // @param base [Module, Class] class or module this definition is inside // @param id [String] the name of the new (or existing) module // // @return [Module] Opal.module = function(base, name) { var module; if (!base.$$is_class && !base.$$is_module) { base = base.$$class; } if ($hasOwn.call(base.$$scope, name)) { module = base.$$scope[name]; if (!module.$$is_module && module !== _Object) { throw Opal.TypeError.$new(name + " is not a module"); } } else { module = Opal.module_allocate(Module); Opal.create_scope(base.$$scope, module, name); } return module; }; // The implementation for Module#initialize // @param module [Module] // @param block [Proc,nil] // @return nil Opal.module_initialize = function(module, block) { if (block !== nil) { var block_self = block.$$s; block.$$s = null; block.call(module); block.$$s = block_self; } return nil; }; // Internal function to create a new module instance. This simply sets up // the prototype hierarchy and method tables. // Opal.module_allocate = function(superclass) { var mtor = function() {}; mtor.prototype = superclass.$$alloc.prototype; function module_constructor() {} module_constructor.prototype = new mtor(); var module = new module_constructor(); var module_prototype = {}; // @property $$id Each class is assigned a unique `id` that helps // comparation and implementation of `#object_id` module.$$id = Opal.uid(); // Set the display name of the singleton prototype holder module_constructor.displayName = "#>" // @property $$proto This is the prototype on which methods will be defined module.$$proto = module_prototype; // @property constructor // keeps a ref to the constructor, but apparently the // constructor is already set on: // // `var module = new constructor` is called. // // Maybe there are some browsers not abiding (IE6?) module.constructor = module_constructor; // @property $$is_module Clearly mark this as a module module.$$is_module = true; module.$$class = Module; // @property $$super // the superclass, doesn't get changed by module inclusions module.$$super = superclass; // @property $$parent // direct parent class or module // starts with the superclass, after module inclusion is // the last included module module.$$parent = superclass; // @property $$inc included modules module.$$inc = []; // mark the object as a module module.$$is_module = true; // initialize dependency tracking module.$$dep = []; // initialize the name with nil module.$$name = nil; return module; }; // Return the singleton class for the passed object. // // If the given object alredy has a singleton class, then it will be stored on // the object as the `$$meta` property. If this exists, then it is simply // returned back. // // Otherwise, a new singleton object for the class or object is created, set on // the object at `$$meta` for future use, and then returned. // // @param object [Object] the ruby object // @return [Class] the singleton class for object Opal.get_singleton_class = function(object) { if (object.$$meta) { return object.$$meta; } if (object.$$is_class || object.$$is_module) { return Opal.build_class_singleton_class(object); } return Opal.build_object_singleton_class(object); }; // Build the singleton class for an existing class. Class object are built // with their singleton class already in the prototype chain and inheriting // from their superclass object (up to `Class` itself). // // NOTE: Actually in MRI a class' singleton class inherits from its // superclass' singleton class which in turn inherits from Class. // // @param klass [Class] // @return [Class] Opal.build_class_singleton_class = function(object) { var alloc, superclass, klass; if (object.$$meta) { return object.$$meta; } // The constructor and prototype of the singleton_class instances is the // current class constructor and prototype. alloc = object.constructor; // The singleton_class superclass is the singleton_class of its superclass; // but BasicObject has no superclass (its `$$super` is null), thus we // fallback on `Class`. superclass = object === BasicObject ? Class : Opal.build_class_singleton_class(object.$$super); klass = Opal.setup_class_object(null, alloc, superclass.$$name, superclass.constructor); klass.$$super = superclass; klass.$$parent = superclass; // The singleton_class retains the same scope as the original class Opal.create_scope(object.$$scope, klass); klass.$$is_singleton = true; klass.$$singleton_of = object; return object.$$meta = klass; }; // Build the singleton class for a Ruby (non class) Object. // // @param object [Object] // @return [Class] Opal.build_object_singleton_class = function(object) { var superclass = object.$$class, name = "#>"; var alloc = Opal.boot_class_alloc(name, function(){}, superclass) var klass = Opal.setup_class_object(name, alloc, superclass.$$name, superclass.constructor); klass.$$super = superclass; klass.$$parent = superclass; klass.$$class = superclass.$$class; klass.$$scope = superclass.$$scope; klass.$$proto = object; klass.$$is_singleton = true; klass.$$singleton_of = object; return object.$$meta = klass; }; // Bridges a single method. Opal.bridge_method = function(target, from, name, body) { var ancestors, i, ancestor, length; ancestors = target.$$bridge.$ancestors(); // order important here, we have to check for method presence in // ancestors from the bridged class to the last ancestor for (i = 0, length = ancestors.length; i < length; i++) { ancestor = ancestors[i]; if ($hasOwn.call(ancestor.$$proto, name) && ancestor.$$proto[name] && !ancestor.$$proto[name].$$donated && !ancestor.$$proto[name].$$stub && ancestor !== from) { break; } if (ancestor === from) { target.prototype[name] = body break; } } }; // Bridges from *donator* to a *target*. Opal._bridge = function(target, donator) { var id, methods, method, i, bridged; if (typeof(target) === "function") { id = donator.$__id__(); methods = donator.$instance_methods(); for (i = methods.length - 1; i >= 0; i--) { method = '$' + methods[i]; Opal.bridge_method(target, donator, method, donator.$$proto[method]); } if (!bridges[id]) { bridges[id] = []; } bridges[id].push(target); } else { bridged = bridges[target.$__id__()]; if (bridged) { for (i = bridged.length - 1; i >= 0; i--) { Opal._bridge(bridged[i], donator); } bridges[donator.$__id__()] = bridged.slice(); } } }; // The actual inclusion of a module into a class. // // ## Class `$$parent` and `iclass` // // To handle `super` calls, every class has a `$$parent`. This parent is // used to resolve the next class for a super call. A normal class would // have this point to its superclass. However, if a class includes a module // then this would need to take into account the module. The module would // also have to then point its `$$parent` to the actual superclass. We // cannot modify modules like this, because it might be included in more // then one class. To fix this, we actually insert an `iclass` as the class' // `$$parent` which can then point to the superclass. The `iclass` acts as // a proxy to the actual module, so the `super` chain can then search it for // the required method. // // @param module [Module] the module to include // @param klass [Class] the target class to include module into // @return [null] Opal.append_features = function(module, klass) { var iclass, donator, prototype, methods, id, i; // check if this module is already included in the class for (i = klass.$$inc.length - 1; i >= 0; i--) { if (klass.$$inc[i] === module) { return; } } klass.$$inc.push(module); module.$$dep.push(klass); Opal._bridge(klass, module); // iclass iclass = { $$name: module.$$name, $$proto: module.$$proto, $$parent: klass.$$parent, $$module: module, $$iclass: true }; klass.$$parent = iclass; donator = module.$$proto; prototype = klass.$$proto; methods = module.$instance_methods(); for (i = methods.length - 1; i >= 0; i--) { id = '$' + methods[i]; // if the target class already has a method of the same name defined // and that method was NOT donated, then it must be a method defined // by the class so we do not want to override it if ( prototype.hasOwnProperty(id) && !prototype[id].$$donated && !prototype[id].$$stub) { continue; } prototype[id] = donator[id]; prototype[id].$$donated = module; } Opal.donate_constants(module, klass); }; // Table that holds all methods that have been defined on all objects // It is used for defining method stubs for new coming native classes Opal.stubs = {}; // For performance, some core Ruby classes are toll-free bridged to their // native JavaScript counterparts (e.g. a Ruby Array is a JavaScript Array). // // This method is used to setup a native constructor (e.g. Array), to have // its prototype act like a normal Ruby class. Firstly, a new Ruby class is // created using the native constructor so that its prototype is set as the // target for th new class. Note: all bridged classes are set to inherit // from Object. // // Example: // // Opal.bridge(self, Function); // // @param klass [Class] the Ruby class to bridge // @param constructor [JS.Function] native JavaScript constructor to use // @return [Class] returns the passed Ruby class // Opal.bridge = function(klass, constructor) { if (constructor.$$bridge) { throw Opal.ArgumentError.$new("already bridged"); } Opal.stub_subscribers.push(constructor.prototype); // Populate constructor with previously stored stubs for (var method_name in Opal.stubs) { if (!(method_name in constructor.prototype)) { constructor.prototype[method_name] = Opal.stub_for(method_name); } } constructor.prototype.$$class = klass; constructor.$$bridge = klass; var ancestors = klass.$ancestors(); // order important here, we have to bridge from the last ancestor to the // bridged class for (var i = ancestors.length - 1; i >= 0; i--) { Opal._bridge(constructor, ancestors[i]); } for (var name in BasicObject_alloc.prototype) { var method = BasicObject_alloc.prototype[method]; if (method && method.$$stub && !(name in constructor.prototype)) { constructor.prototype[name] = method; } } return klass; }; // When a source module is included into the target module, we must also copy // its constants to the target. // Opal.donate_constants = function(source_mod, target_mod) { var source_constants = source_mod.$$scope.constants, target_scope = target_mod.$$scope, target_constants = target_scope.constants; for (var i = 0, length = source_constants.length; i < length; i++) { target_constants.push(source_constants[i]); target_scope[source_constants[i]] = source_mod.$$scope[source_constants[i]]; } }; // Donate methods for a module. Opal.donate = function(module, jsid) { var included_in = module.$$dep, body = module.$$proto[jsid], i, length, includee, dest, current, klass_includees, j, jj, current_owner_index, module_index; if (!included_in) { return; } for (i = 0, length = included_in.length; i < length; i++) { includee = included_in[i]; dest = includee.$$proto; current = dest[jsid]; if (dest.hasOwnProperty(jsid) && !current.$$donated && !current.$$stub) { // target class has already defined the same method name - do nothing } else if (dest.hasOwnProperty(jsid) && !current.$$stub) { // target class includes another module that has defined this method klass_includees = includee.$$inc; for (j = 0, jj = klass_includees.length; j < jj; j++) { if (klass_includees[j] === current.$$donated) { current_owner_index = j; } if (klass_includees[j] === module) { module_index = j; } } // only redefine method on class if the module was included AFTER // the module which defined the current method body. Also make sure // a module can overwrite a method it defined before if (current_owner_index <= module_index) { dest[jsid] = body; dest[jsid].$$donated = module; } } else { // neither a class, or module included by class, has defined method dest[jsid] = body; dest[jsid].$$donated = module; } if (includee.$$dep) { Opal.donate(includee, jsid); } } }; // The Array of ancestors for a given module/class Opal.ancestors = function(module_or_class) { var parent = module_or_class, result = [], modules; while (parent) { result.push(parent); for (var i=0; i < parent.$$inc.length; i++) { modules = Opal.ancestors(parent.$$inc[i]); for(var j = 0; j < modules.length; j++) { result.push(modules[j]); } } // only the actual singleton class gets included in its ancestry // after that, traverse the normal class hierarchy if (parent.$$is_singleton && parent.$$singleton_of.$$is_module) { parent = parent.$$singleton_of.$$super; } else { parent = parent.$$is_class ? parent.$$super : null; } } return result; }; // Method Missing // -------------- // Methods stubs are used to facilitate method_missing in opal. A stub is a // placeholder function which just calls `method_missing` on the receiver. // If no method with the given name is actually defined on an object, then it // is obvious to say that the stub will be called instead, and then in turn // method_missing will be called. // // When a file in ruby gets compiled to javascript, it includes a call to // this function which adds stubs for every method name in the compiled file. // It should then be safe to assume that method_missing will work for any // method call detected. // // Method stubs are added to the BasicObject prototype, which every other // ruby object inherits, so all objects should handle method missing. A stub // is only added if the given property name (method name) is not already // defined. // // Note: all ruby methods have a `$` prefix in javascript, so all stubs will // have this prefix as well (to make this method more performant). // // Opal.add_stubs(["$foo", "$bar", "$baz="]); // // All stub functions will have a private `$$stub` property set to true so // that other internal methods can detect if a method is just a stub or not. // `Kernel#respond_to?` uses this property to detect a methods presence. // // @param stubs [Array] an array of method stubs to add // @return [undefined] Opal.add_stubs = function(stubs) { var subscriber, subscribers = Opal.stub_subscribers, i, ilength = stubs.length, j, jlength = subscribers.length, method_name, stub; for (i = 0; i < ilength; i++) { method_name = stubs[i]; // Save method name to populate other subscribers with this stub Opal.stubs[method_name] = true; stub = Opal.stub_for(method_name); for (j = 0; j < jlength; j++) { subscriber = subscribers[j]; if (!(method_name in subscriber)) { subscriber[method_name] = stub; } } } }; // Keep a list of prototypes that want method_missing stubs to be added. // // @default [Prototype List] BasicObject_alloc.prototype // Opal.stub_subscribers = [BasicObject_alloc.prototype]; // Add a method_missing stub function to the given prototype for the // given name. // // @param prototype [Prototype] the target prototype // @param stub [String] stub name to add (e.g. "$foo") // @return [undefined] Opal.add_stub_for = function(prototype, stub) { var method_missing_stub = Opal.stub_for(stub); prototype[stub] = method_missing_stub; }; // Generate the method_missing stub for a given method name. // // @param method_name [String] The js-name of the method to stub (e.g. "$foo") // @return [undefined] Opal.stub_for = function(method_name) { function method_missing_stub() { // Copy any given block onto the method_missing dispatcher this.$method_missing.$$p = method_missing_stub.$$p; // Set block property to null ready for the next call (stop false-positives) method_missing_stub.$$p = null; // call method missing with correct args (remove '$' prefix on method name) var args_ary = new Array(arguments.length); for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = arguments[i]; } return this.$method_missing.apply(this, [method_name.slice(1)].concat(args_ary)); } method_missing_stub.$$stub = true; return method_missing_stub; }; // Methods // ------- // Arity count error dispatcher for methods // // @param actual [Fixnum] number of arguments given to method // @param expected [Fixnum] expected number of arguments // @param object [Object] owner of the method +meth+ // @param meth [String] method name that got wrong number of arguments // @raise [ArgumentError] Opal.ac = function(actual, expected, object, meth) { var inspect = ''; if (object.$$is_class || object.$$is_module) { inspect += object.$$name + '.'; } else { inspect += object.$$class.$$name + '#'; } inspect += meth; throw Opal.ArgumentError.$new('[' + inspect + '] wrong number of arguments(' + actual + ' for ' + expected + ')'); }; // Arity count error dispatcher for blocks // // @param actual [Fixnum] number of arguments given to block // @param expected [Fixnum] expected number of arguments // @param context [Object] context of the block definition // @raise [ArgumentError] Opal.block_ac = function(actual, expected, context) { var inspect = "`block in " + context + "'"; throw Opal.ArgumentError.$new(inspect + ': wrong number of arguments (' + actual + ' for ' + expected + ')'); } // Super dispatcher Opal.find_super_dispatcher = function(obj, jsid, current_func, defcheck, defs) { var dispatcher; if (defs) { if (obj.$$is_class || obj.$$is_module) { dispatcher = defs.$$super; } else { dispatcher = obj.$$class.$$proto; } } else { dispatcher = Opal.find_obj_super_dispatcher(obj, jsid, current_func); } dispatcher = dispatcher['$' + jsid]; if (!defcheck && dispatcher.$$stub && Opal.Kernel.$method_missing === obj.$method_missing) { // method_missing hasn't been explicitly defined throw Opal.NoMethodError.$new('super: no superclass method `'+jsid+"' for "+obj, jsid); } return dispatcher; }; // Iter dispatcher for super in a block Opal.find_iter_super_dispatcher = function(obj, jsid, current_func, defcheck, implicit) { var call_jsid = jsid; if (!current_func) { throw Opal.RuntimeError.$new("super called outside of method"); } if (implicit && current_func.$$define_meth) { throw Opal.RuntimeError.$new("implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly"); } if (current_func.$$def) { call_jsid = current_func.$$jsid; } return Opal.find_super_dispatcher(obj, call_jsid, current_func, defcheck); }; Opal.find_obj_super_dispatcher = function(obj, jsid, current_func) { var klass = obj.$$meta || obj.$$class; // first we need to find the class/module current_func is located on klass = Opal.find_owning_class(klass, current_func); if (!klass) { throw new Error("could not find current class for super()"); } jsid = '$' + jsid; return Opal.find_super_func(klass, jsid, current_func); }; Opal.find_owning_class = function(klass, current_func) { var owner = current_func.$$owner; while (klass) { // repeating for readability if (klass.$$iclass && klass.$$module === current_func.$$donated) { // this klass was the last one the module donated to // case is also hit with multiple module includes break; } else if (klass.$$iclass && klass.$$module === owner) { // module has donated to other classes but klass isn't one of those break; } else if (owner.$$is_singleton && klass === owner.$$singleton_of.$$class) { // cases like stdlib `Singleton::included` that use a singleton of a singleton break; } else if (klass === owner) { // no modules, pure class inheritance break; } klass = klass.$$parent; } return klass; }; Opal.find_super_func = function(owning_klass, jsid, current_func) { var klass = owning_klass.$$parent; // now we can find the super while (klass) { var working = klass.$$proto[jsid]; if (working && working !== current_func) { // ok break; } klass = klass.$$parent; } return klass.$$proto; }; // Used to return as an expression. Sometimes, we can't simply return from // a javascript function as if we were a method, as the return is used as // an expression, or even inside a block which must "return" to the outer // method. This helper simply throws an error which is then caught by the // method. This approach is expensive, so it is only used when absolutely // needed. // Opal.ret = function(val) { Opal.returner.$v = val; throw Opal.returner; }; // Used to break out of a block. Opal.brk = function(val, breaker) { breaker.$v = val; throw breaker; }; // Builds a new unique breaker, this is to avoid multiple nested breaks to get // in the way of each other. Opal.new_brk = function() { return new Error('unexpected break'); }; // handles yield calls for 1 yielded arg Opal.yield1 = function(block, arg) { if (typeof(block) !== "function") { throw Opal.LocalJumpError.$new("no block given"); } var has_mlhs = block.$$has_top_level_mlhs_arg, has_trailing_comma = block.$$has_trailing_comma_in_args; if (block.length > 1 || ((has_mlhs || has_trailing_comma) && block.length === 1)) { arg = Opal.to_ary(arg); } if ((block.length > 1 || (has_trailing_comma && block.length === 1)) && arg.$$is_array) { return block.apply(null, arg); } else { return block(arg); } }; // handles yield for > 1 yielded arg Opal.yieldX = function(block, args) { if (typeof(block) !== "function") { throw Opal.LocalJumpError.$new("no block given"); } if (block.length > 1 && args.length === 1) { if (args[0].$$is_array) { return block.apply(null, args[0]); } } if (!args.$$is_array) { var args_ary = new Array(args.length); for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } return block.apply(null, args_ary); } return block.apply(null, args); }; // Finds the corresponding exception match in candidates. Each candidate can // be a value, or an array of values. Returns null if not found. Opal.rescue = function(exception, candidates) { for (var i = 0; i < candidates.length; i++) { var candidate = candidates[i]; if (candidate.$$is_array) { var result = Opal.rescue(exception, candidate); if (result) { return result; } } else if (candidate['$==='](exception)) { return candidate; } } return null; }; Opal.is_a = function(object, klass) { if (object.$$meta === klass) { return true; } var i, length, ancestors = Opal.ancestors(object.$$class); for (i = 0, length = ancestors.length; i < length; i++) { if (ancestors[i] === klass) { return true; } } ancestors = Opal.ancestors(object.$$meta); for (i = 0, length = ancestors.length; i < length; i++) { if (ancestors[i] === klass) { return true; } } return false; }; // Helpers for extracting kwsplats // Used for: { **h } Opal.to_hash = function(value) { if (value.$$is_hash) { return value; } else if (value['$respond_to?']('to_hash', true)) { var hash = value.$to_hash(); if (hash.$$is_hash) { return hash; } else { throw Opal.TypeError.$new("Can't convert " + value.$$class + " to Hash (" + value.$$class + "#to_hash gives " + hash.$$class + ")"); } } else { throw Opal.TypeError.$new("no implicit conversion of " + value.$$class + " into Hash"); } }; // Helpers for implementing multiple assignment // Our code for extracting the values and assigning them only works if the // return value is a JS array. // So if we get an Array subclass, extract the wrapped JS array from it // Used for: a, b = something (no splat) Opal.to_ary = function(value) { if (value.$$is_array) { return value; } else if (value['$respond_to?']('to_ary', true)) { var ary = value.$to_ary(); if (ary === nil) { return [value]; } else if (ary.$$is_array) { return ary; } else { throw Opal.TypeError.$new("Can't convert " + value.$$class + " to Array (" + value.$$class + "#to_ary gives " + ary.$$class + ")"); } } else { return [value]; } }; // Used for: a, b = *something (with splat) Opal.to_a = function(value) { if (value.$$is_array) { // A splatted array must be copied return value.slice(); } else if (value['$respond_to?']('to_a', true)) { var ary = value.$to_a(); if (ary === nil) { return [value]; } else if (ary.$$is_array) { return ary; } else { throw Opal.TypeError.$new("Can't convert " + value.$$class + " to Array (" + value.$$class + "#to_a gives " + ary.$$class + ")"); } } else { return [value]; } }; // Used for extracting keyword arguments from arguments passed to // JS function. If provided +arguments+ list doesn't have a Hash // as a last item, returns a blank Hash. // // @param parameters [Array] // @return [Hash] // Opal.extract_kwargs = function(parameters) { var kwargs = parameters[parameters.length - 1]; if (kwargs != null && kwargs['$respond_to?']('to_hash', true)) { Array.prototype.splice.call(parameters, parameters.length - 1, 1); return kwargs.$to_hash(); } else { return Opal.hash2([], {}); } } // Used to get a list of rest keyword arguments. Method takes the given // keyword args, i.e. the hash literal passed to the method containing all // keyword arguemnts passed to method, as well as the used args which are // the names of required and optional arguments defined. This method then // just returns all key/value pairs which have not been used, in a new // hash literal. // // @param given_args [Hash] all kwargs given to method // @param used_args [Object] all keys used as named kwargs // @return [Hash] // Opal.kwrestargs = function(given_args, used_args) { var keys = [], map = {}, key = null, given_map = given_args.$$smap; for (key in given_map) { if (!used_args[key]) { keys.push(key); map[key] = given_map[key]; } } return Opal.hash2(keys, map); }; // Call a ruby method on a ruby object with some arguments: // // @example // var my_array = [1, 2, 3, 4] // Opal.send(my_array, 'length') # => 4 // Opal.send(my_array, 'reverse!') # => [4, 3, 2, 1] // // A missing method will be forwarded to the object via // method_missing. // // The result of either call with be returned. // // @param recv [Object] the ruby object // @param mid [String] ruby method to call // @return [Object] forwards the return value of the method (or of method_missing) Opal.send = function(recv, mid) { var args_ary = new Array(Math.max(arguments.length - 2, 0)); for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = arguments[i + 2]; } var func = recv['$' + mid]; if (func) { return func.apply(recv, args_ary); } return recv.$method_missing.apply(recv, [mid].concat(args_ary)); }; Opal.block_send = function(recv, mid, block) { var args_ary = new Array(Math.max(arguments.length - 3, 0)); for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = arguments[i + 3]; } var func = recv['$' + mid]; if (func) { func.$$p = block; return func.apply(recv, args_ary); } return recv.$method_missing.apply(recv, [mid].concat(args_ary)); }; // Used to define methods on an object. This is a helper method, used by the // compiled source to define methods on special case objects when the compiler // can not determine the destination object, or the object is a Module // instance. This can get called by `Module#define_method` as well. // // ## Modules // // Any method defined on a module will come through this runtime helper. // The method is added to the module body, and the owner of the method is // set to be the module itself. This is used later when choosing which // method should show on a class if more than 1 included modules define // the same method. Finally, if the module is in `module_function` mode, // then the method is also defined onto the module itself. // // ## Classes // // This helper will only be called for classes when a method is being // defined indirectly; either through `Module#define_method`, or by a // literal `def` method inside an `instance_eval` or `class_eval` body. In // either case, the method is simply added to the class' prototype. A special // exception exists for `BasicObject` and `Object`. These two classes are // special because they are used in toll-free bridged classes. In each of // these two cases, extra work is required to define the methods on toll-free // bridged class' prototypes as well. // // ## Objects // // If a simple ruby object is the object, then the method is simply just // defined on the object as a singleton method. This would be the case when // a method is defined inside an `instance_eval` block. // // @param obj [Object, Class] the actual obj to define method for // @param jsid [String] the JavaScript friendly method name (e.g. '$foo') // @param body [JS.Function] the literal JavaScript function used as method // @return [null] // Opal.defn = function(obj, jsid, body) { obj.$$proto[jsid] = body; // for super dispatcher, etc. body.$$owner = obj; if (obj.$$is_module) { Opal.donate(obj, jsid); if (obj.$$module_function) { Opal.defs(obj, jsid, body); } } if (obj.$__id__ && !obj.$__id__.$$stub) { var bridged = bridges[obj.$__id__()]; if (bridged) { for (var i = bridged.length - 1; i >= 0; i--) { Opal.bridge_method(bridged[i], obj, jsid, body); } } } var singleton_of = obj.$$singleton_of; if (obj.$method_added && !obj.$method_added.$$stub && !singleton_of) { obj.$method_added(jsid.substr(1)); } else if (singleton_of && singleton_of.$singleton_method_added && !singleton_of.$singleton_method_added.$$stub) { singleton_of.$singleton_method_added(jsid.substr(1)); } return nil; }; // Define a singleton method on the given object. Opal.defs = function(obj, jsid, body) { Opal.defn(Opal.get_singleton_class(obj), jsid, body) }; Opal.def = function(obj, jsid, body) { // if instance_eval is invoked on a module/class, it sets inst_eval_mod if (!obj.$$eval && (obj.$$is_class || obj.$$is_module)) { Opal.defn(obj, jsid, body); } else { Opal.defs(obj, jsid, body); } }; // Called from #remove_method. Opal.rdef = function(obj, jsid) { // TODO: remove from bridges as well if (!$hasOwn.call(obj.$$proto, jsid)) { throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name()); } delete obj.$$proto[jsid]; if (obj.$$is_singleton) { if (obj.$$proto.$singleton_method_removed && !obj.$$proto.$singleton_method_removed.$$stub) { obj.$$proto.$singleton_method_removed(jsid.substr(1)); } } else { if (obj.$method_removed && !obj.$method_removed.$$stub) { obj.$method_removed(jsid.substr(1)); } } }; // Called from #undef_method. Opal.udef = function(obj, jsid) { if (!obj.$$proto[jsid] || obj.$$proto[jsid].$$stub) { throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name()); } Opal.add_stub_for(obj.$$proto, jsid); if (obj.$$is_singleton) { if (obj.$$proto.$singleton_method_undefined && !obj.$$proto.$singleton_method_undefined.$$stub) { obj.$$proto.$singleton_method_undefined(jsid.substr(1)); } } else { if (obj.$method_undefined && !obj.$method_undefined.$$stub) { obj.$method_undefined(jsid.substr(1)); } } }; Opal.alias = function(obj, name, old) { var id = '$' + name, old_id = '$' + old, body = obj.$$proto['$' + old]; // instance_eval is being run on a class/module, so that need to alias class methods if (obj.$$eval) { return Opal.alias(Opal.get_singleton_class(obj), name, old); } if (typeof(body) !== "function" || body.$$stub) { var ancestor = obj.$$super; while (typeof(body) !== "function" && ancestor) { body = ancestor[old_id]; ancestor = ancestor.$$super; } if (typeof(body) !== "function" || body.$$stub) { throw Opal.NameError.$new("undefined method `" + old + "' for class `" + obj.$name() + "'") } } Opal.defn(obj, id, body); return obj; }; Opal.alias_native = function(obj, name, native_name) { var id = '$' + name, body = obj.$$proto[native_name]; if (typeof(body) !== "function" || body.$$stub) { throw Opal.NameError.$new("undefined native method `" + native_name + "' for class `" + obj.$name() + "'") } Opal.defn(obj, id, body); return obj; }; // Hashes // ------ Opal.hash_init = function(hash) { hash.$$smap = {}; hash.$$map = {}; hash.$$keys = []; }; Opal.hash_clone = function(from_hash, to_hash) { to_hash.$$none = from_hash.$$none; to_hash.$$proc = from_hash.$$proc; for (var i = 0, keys = from_hash.$$keys, length = keys.length, key, value; i < length; i++) { key = from_hash.$$keys[i]; if (key.$$is_string) { value = from_hash.$$smap[key]; } else { value = key.value; key = key.key; } Opal.hash_put(to_hash, key, value); } }; Opal.hash_put = function(hash, key, value) { if (key.$$is_string) { if (!hash.$$smap.hasOwnProperty(key)) { hash.$$keys.push(key); } hash.$$smap[key] = value; return; } var key_hash = key.$hash(), bucket, last_bucket; if (!hash.$$map.hasOwnProperty(key_hash)) { bucket = {key: key, key_hash: key_hash, value: value}; hash.$$keys.push(bucket); hash.$$map[key_hash] = bucket; return; } bucket = hash.$$map[key_hash]; while (bucket) { if (key === bucket.key || key['$eql?'](bucket.key)) { last_bucket = undefined; bucket.value = value; break; } last_bucket = bucket; bucket = bucket.next; } if (last_bucket) { bucket = {key: key, key_hash: key_hash, value: value}; hash.$$keys.push(bucket); last_bucket.next = bucket; } }; Opal.hash_get = function(hash, key) { if (key.$$is_string) { if (hash.$$smap.hasOwnProperty(key)) { return hash.$$smap[key]; } return; } var key_hash = key.$hash(), bucket; if (hash.$$map.hasOwnProperty(key_hash)) { bucket = hash.$$map[key_hash]; while (bucket) { if (key === bucket.key || key['$eql?'](bucket.key)) { return bucket.value; } bucket = bucket.next; } } }; Opal.hash_delete = function(hash, key) { var i, keys = hash.$$keys, length = keys.length, value; if (key.$$is_string) { if (!hash.$$smap.hasOwnProperty(key)) { return; } for (i = 0; i < length; i++) { if (keys[i] === key) { keys.splice(i, 1); break; } } value = hash.$$smap[key]; delete hash.$$smap[key]; return value; } var key_hash = key.$hash(); if (!hash.$$map.hasOwnProperty(key_hash)) { return; } var bucket = hash.$$map[key_hash], last_bucket; while (bucket) { if (key === bucket.key || key['$eql?'](bucket.key)) { value = bucket.value; for (i = 0; i < length; i++) { if (keys[i] === bucket) { keys.splice(i, 1); break; } } if (last_bucket && bucket.next) { last_bucket.next = bucket.next; } else if (last_bucket) { delete last_bucket.next; } else if (bucket.next) { hash.$$map[key_hash] = bucket.next; } else { delete hash.$$map[key_hash]; } return value; } last_bucket = bucket; bucket = bucket.next; } }; Opal.hash_rehash = function(hash) { for (var i = 0, length = hash.$$keys.length, key_hash, bucket, last_bucket; i < length; i++) { if (hash.$$keys[i].$$is_string) { continue; } key_hash = hash.$$keys[i].key.$hash(); if (key_hash === hash.$$keys[i].key_hash) { continue; } bucket = hash.$$map[hash.$$keys[i].key_hash]; last_bucket = undefined; while (bucket) { if (bucket === hash.$$keys[i]) { if (last_bucket && bucket.next) { last_bucket.next = bucket.next; } else if (last_bucket) { delete last_bucket.next; } else if (bucket.next) { hash.$$map[hash.$$keys[i].key_hash] = bucket.next; } else { delete hash.$$map[hash.$$keys[i].key_hash]; } break; } last_bucket = bucket; bucket = bucket.next; } hash.$$keys[i].key_hash = key_hash; if (!hash.$$map.hasOwnProperty(key_hash)) { hash.$$map[key_hash] = hash.$$keys[i]; continue; } bucket = hash.$$map[key_hash]; last_bucket = undefined; while (bucket) { if (bucket === hash.$$keys[i]) { last_bucket = undefined; break; } last_bucket = bucket; bucket = bucket.next; } if (last_bucket) { last_bucket.next = hash.$$keys[i]; } } }; Opal.hash = function() { var arguments_length = arguments.length, args, hash, i, length, key, value; if (arguments_length === 1 && arguments[0].$$is_hash) { return arguments[0]; } hash = new Opal.Hash.$$alloc(); Opal.hash_init(hash); if (arguments_length === 1 && arguments[0].$$is_array) { args = arguments[0]; length = args.length; for (i = 0; i < length; i++) { if (args[i].length !== 2) { throw Opal.ArgumentError.$new("value not of length 2: " + args[i].$inspect()); } key = args[i][0]; value = args[i][1]; Opal.hash_put(hash, key, value); } return hash; } if (arguments_length === 1) { args = arguments[0]; for (key in args) { if (args.hasOwnProperty(key)) { value = args[key]; Opal.hash_put(hash, key, value); } } return hash; } if (arguments_length % 2 !== 0) { throw Opal.ArgumentError.$new("odd number of arguments for Hash"); } for (i = 0; i < arguments_length; i += 2) { key = arguments[i]; value = arguments[i + 1]; Opal.hash_put(hash, key, value); } return hash; }; // hash2 is a faster creator for hashes that just use symbols and // strings as keys. The map and keys array can be constructed at // compile time, so they are just added here by the constructor // function // Opal.hash2 = function(keys, smap) { var hash = new Opal.Hash.$$alloc(); hash.$$smap = smap; hash.$$map = {}; hash.$$keys = keys; return hash; }; // Create a new range instance with first and last values, and whether the // range excludes the last value. // Opal.range = function(first, last, exc) { var range = new Opal.Range.$$alloc(); range.begin = first; range.end = last; range.exclude = exc; return range; }; Opal.ivar = function(name) { if ( // properties name === "constructor" || name === "displayName" || name === "__count__" || name === "__noSuchMethod__" || name === "__parent__" || name === "__proto__" || // methods name === "hasOwnProperty" || name === "valueOf" ) { return name + "$"; } return name; }; // Require system // -------------- Opal.modules = {}; Opal.loaded_features = ['corelib/runtime']; Opal.current_dir = '.' Opal.require_table = {'corelib/runtime': true}; Opal.normalize = function(path) { var parts, part, new_parts = [], SEPARATOR = '/'; if (Opal.current_dir !== '.') { path = Opal.current_dir.replace(/\/*$/, '/') + path; } path = path.replace(/\.(rb|opal|js)$/, ''); parts = path.split(SEPARATOR); for (var i = 0, ii = parts.length; i < ii; i++) { part = parts[i]; if (part === '') continue; (part === '..') ? new_parts.pop() : new_parts.push(part) } return new_parts.join(SEPARATOR); }; Opal.loaded = function(paths) { var i, l, path; for (i = 0, l = paths.length; i < l; i++) { path = Opal.normalize(paths[i]); if (Opal.require_table[path]) { return; } Opal.loaded_features.push(path); Opal.require_table[path] = true; } }; Opal.load = function(path) { path = Opal.normalize(path); Opal.loaded([path]); var module = Opal.modules[path]; if (module) { module(Opal); } else { var severity = Opal.config.missing_require_severity; var message = 'cannot load such file -- ' + path; if (severity === "error") { Opal.LoadError ? Opal.LoadError.$new(message) : function(){throw message}(); } else if (severity === "warning") { console.warn('WARNING: LoadError: ' + message); } } return true; }; Opal.require = function(path) { path = Opal.normalize(path); if (Opal.require_table[path]) { return false; } return Opal.load(path); }; // Initialization // -------------- // Constructors for *instances* of core objects Opal.boot_class_alloc('BasicObject', BasicObject_alloc); Opal.boot_class_alloc('Object', Object_alloc, BasicObject_alloc); Opal.boot_class_alloc('Module', Module_alloc, Object_alloc); Opal.boot_class_alloc('Class', Class_alloc, Module_alloc); // Constructors for *classes* of core objects Opal.BasicObject = BasicObject = Opal.setup_class_object('BasicObject', BasicObject_alloc, 'Class', Class_alloc); Opal.Object = _Object = Opal.setup_class_object('Object', Object_alloc, 'BasicObject', BasicObject.constructor); Opal.Module = Module = Opal.setup_class_object('Module', Module_alloc, 'Object', _Object.constructor); Opal.Class = Class = Opal.setup_class_object('Class', Class_alloc, 'Module', Module.constructor); Opal.constants.push("BasicObject"); Opal.constants.push("Object"); Opal.constants.push("Module"); Opal.constants.push("Class"); // Fix booted classes to use their metaclass BasicObject.$$class = Class; _Object.$$class = Class; Module.$$class = Class; Class.$$class = Class; // Fix superclasses of booted classes BasicObject.$$super = null; _Object.$$super = BasicObject; Module.$$super = _Object; Class.$$super = Module; BasicObject.$$parent = null; _Object.$$parent = BasicObject; Module.$$parent = _Object; Class.$$parent = Module; Opal.base = _Object; BasicObject.$$scope = _Object.$$scope = Opal; BasicObject.$$orig_scope = _Object.$$orig_scope = Opal; Module.$$scope = _Object.$$scope; Module.$$orig_scope = _Object.$$orig_scope; Class.$$scope = _Object.$$scope; Class.$$orig_scope = _Object.$$orig_scope; // Forward .toString() to #to_s _Object.$$proto.toString = function() { return this.$to_s(); }; // Make Kernel#require immediately available as it's needed to require all the // other corelib files. _Object.$$proto.$require = Opal.require; // Instantiate the top object Opal.top = new _Object.$$alloc(); // Nil Opal.klass(_Object, _Object, 'NilClass', NilClass_alloc); nil = Opal.nil = new NilClass_alloc(); nil.$$id = nil_id; nil.call = nil.apply = function() { throw Opal.LocalJumpError.$new('no block given'); }; Opal.breaker = new Error('unexpected break (old)'); Opal.returner = new Error('unexpected return'); TypeError.$$super = Error; }).call(this); if (typeof(global) !== 'undefined') { global.Opal = this.Opal; Opal.global = global; } if (typeof(window) !== 'undefined') { window.Opal = this.Opal; Opal.global = window; } Opal.loaded(["corelib/runtime"]); /* Generated by Opal 0.10.4 */ Opal.modules["corelib/helpers"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$new', '$class', '$===', '$respond_to?', '$raise', '$type_error', '$__send__', '$coerce_to', '$nil?', '$<=>', '$inspect', '$coerce_to!', '$!=', '$[]', '$upcase']); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13; Opal.defs(self, '$bridge', TMP_1 = function $$bridge(klass, constructor) { var self = this; return Opal.bridge(klass, constructor); }, TMP_1.$$arity = 2); Opal.defs(self, '$type_error', TMP_2 = function $$type_error(object, type, method, coerced) { var $a, $b, self = this; if (method == null) { method = nil; } if (coerced == null) { coerced = nil; } if ((($a = (($b = method !== false && method !== nil && method != null) ? coerced : method)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('TypeError').$new("can't convert " + (object.$class()) + " into " + (type) + " (" + (object.$class()) + "#" + (method) + " gives " + (coerced.$class())) } else { return $scope.get('TypeError').$new("no implicit conversion of " + (object.$class()) + " into " + (type)) }; }, TMP_2.$$arity = -3); Opal.defs(self, '$coerce_to', TMP_3 = function $$coerce_to(object, type, method) { var $a, self = this; if ((($a = type['$==='](object)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return object}; if ((($a = object['$respond_to?'](method)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise(self.$type_error(object, type)) }; return object.$__send__(method); }, TMP_3.$$arity = 3); Opal.defs(self, '$coerce_to!', TMP_4 = function(object, type, method) { var $a, self = this, coerced = nil; coerced = self.$coerce_to(object, type, method); if ((($a = type['$==='](coerced)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise(self.$type_error(object, type, method, coerced)) }; return coerced; }, TMP_4.$$arity = 3); Opal.defs(self, '$coerce_to?', TMP_5 = function(object, type, method) { var $a, self = this, coerced = nil; if ((($a = object['$respond_to?'](method)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; coerced = self.$coerce_to(object, type, method); if ((($a = coerced['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; if ((($a = type['$==='](coerced)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise(self.$type_error(object, type, method, coerced)) }; return coerced; }, TMP_5.$$arity = 3); Opal.defs(self, '$try_convert', TMP_6 = function $$try_convert(object, type, method) { var $a, self = this; if ((($a = type['$==='](object)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return object}; if ((($a = object['$respond_to?'](method)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return object.$__send__(method) } else { return nil }; }, TMP_6.$$arity = 3); Opal.defs(self, '$compare', TMP_7 = function $$compare(a, b) { var $a, self = this, compare = nil; compare = a['$<=>'](b); if ((($a = compare === nil) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "comparison of " + (a.$class()) + " with " + (b.$class()) + " failed")}; return compare; }, TMP_7.$$arity = 2); Opal.defs(self, '$destructure', TMP_8 = function $$destructure(args) { var self = this; if (args.length == 1) { return args[0]; } else if (args.$$is_array) { return args; } else { var args_ary = new Array(args.length); for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } return args_ary; } }, TMP_8.$$arity = 1); Opal.defs(self, '$respond_to?', TMP_9 = function(obj, method) { var self = this; if (obj == null || !obj.$$class) { return false; } return obj['$respond_to?'](method); }, TMP_9.$$arity = 2); Opal.defs(self, '$inspect', TMP_10 = function $$inspect(obj) { var self = this; if (obj === undefined) { return "undefined"; } else if (obj === null) { return "null"; } else if (!obj.$$class) { return obj.toString(); } else { return obj.$inspect(); } }, TMP_10.$$arity = 1); Opal.defs(self, '$instance_variable_name!', TMP_11 = function(name) { var $a, self = this; name = $scope.get('Opal')['$coerce_to!'](name, $scope.get('String'), "to_str"); if ((($a = /^@[a-zA-Z_][a-zA-Z0-9_]*?$/.test(name)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('NameError').$new("'" + (name) + "' is not allowed as an instance variable name", name)) }; return name; }, TMP_11.$$arity = 1); Opal.defs(self, '$const_name!', TMP_12 = function(const_name) { var $a, self = this; const_name = $scope.get('Opal')['$coerce_to!'](const_name, $scope.get('String'), "to_str"); if ((($a = const_name['$[]'](0)['$!='](const_name['$[]'](0).$upcase())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('NameError'), "wrong constant name " + (const_name))}; return const_name; }, TMP_12.$$arity = 1); Opal.defs(self, '$pristine', TMP_13 = function $$pristine(owner_class, $a_rest) { var self = this, method_names; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } method_names = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { method_names[$arg_idx - 1] = arguments[$arg_idx]; } var method_name; for (var i = method_names.length - 1; i >= 0; i--) { method_name = method_names[i]; owner_class.$$proto['$'+method_name].$$pristine = true } return nil; }, TMP_13.$$arity = -2); })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/module"] = function(Opal) { function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $range = Opal.range, $hash2 = Opal.hash2; Opal.add_stubs(['$===', '$raise', '$equal?', '$<', '$>', '$nil?', '$attr_reader', '$attr_writer', '$coerce_to!', '$new', '$const_name!', '$=~', '$inject', '$const_get', '$split', '$const_missing', '$==', '$!', '$start_with?', '$to_proc', '$lambda', '$bind', '$call', '$class', '$append_features', '$included', '$name', '$cover?', '$size', '$merge', '$compile', '$proc', '$to_s', '$__id__', '$constants', '$include?']); return (function($base, $super) { function $Module(){}; var self = $Module = $klass($base, $super, 'Module', $Module); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_22, TMP_23, TMP_24, TMP_25, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_41, TMP_42, TMP_43, TMP_44, TMP_45, TMP_46, TMP_47, TMP_48, TMP_49; Opal.defs(self, '$allocate', TMP_1 = function $$allocate() { var self = this; var module; module = Opal.module_allocate(self); Opal.create_scope(Opal.Module.$$scope, module, null); return module; }, TMP_1.$$arity = 0); Opal.defn(self, '$initialize', TMP_2 = function $$initialize() { var self = this, $iter = TMP_2.$$p, block = $iter || nil; TMP_2.$$p = null; return Opal.module_initialize(self, block); }, TMP_2.$$arity = 0); Opal.defn(self, '$===', TMP_3 = function(object) { var $a, self = this; if ((($a = object == null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return false}; return Opal.is_a(object, self); }, TMP_3.$$arity = 1); Opal.defn(self, '$<', TMP_4 = function(other) { var $a, self = this; if ((($a = $scope.get('Module')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('TypeError'), "compared with non class/module") }; var working = self, ancestors, i, length; if (working === other) { return false; } for (i = 0, ancestors = Opal.ancestors(self), length = ancestors.length; i < length; i++) { if (ancestors[i] === other) { return true; } } for (i = 0, ancestors = Opal.ancestors(other), length = ancestors.length; i < length; i++) { if (ancestors[i] === self) { return false; } } return nil; }, TMP_4.$$arity = 1); Opal.defn(self, '$<=', TMP_5 = function(other) { var $a, self = this; return ((($a = self['$equal?'](other)) !== false && $a !== nil && $a != null) ? $a : $rb_lt(self, other)); }, TMP_5.$$arity = 1); Opal.defn(self, '$>', TMP_6 = function(other) { var $a, self = this; if ((($a = $scope.get('Module')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('TypeError'), "compared with non class/module") }; return $rb_lt(other, self); }, TMP_6.$$arity = 1); Opal.defn(self, '$>=', TMP_7 = function(other) { var $a, self = this; return ((($a = self['$equal?'](other)) !== false && $a !== nil && $a != null) ? $a : $rb_gt(self, other)); }, TMP_7.$$arity = 1); Opal.defn(self, '$<=>', TMP_8 = function(other) { var $a, self = this, lt = nil; if (self === other) { return 0; } if ((($a = $scope.get('Module')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; lt = $rb_lt(self, other); if ((($a = lt['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; if (lt !== false && lt !== nil && lt != null) { return -1 } else { return 1 }; }, TMP_8.$$arity = 1); Opal.defn(self, '$alias_method', TMP_9 = function $$alias_method(newname, oldname) { var self = this; Opal.alias(self, newname, oldname); return self; }, TMP_9.$$arity = 2); Opal.defn(self, '$alias_native', TMP_10 = function $$alias_native(mid, jsid) { var self = this; if (jsid == null) { jsid = mid; } Opal.alias_native(self, mid, jsid); return self; }, TMP_10.$$arity = -2); Opal.defn(self, '$ancestors', TMP_11 = function $$ancestors() { var self = this; return Opal.ancestors(self); }, TMP_11.$$arity = 0); Opal.defn(self, '$append_features', TMP_12 = function $$append_features(klass) { var self = this; Opal.append_features(self, klass); return self; }, TMP_12.$$arity = 1); Opal.defn(self, '$attr_accessor', TMP_13 = function $$attr_accessor($a_rest) { var $b, $c, self = this, names; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } names = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { names[$arg_idx - 0] = arguments[$arg_idx]; } ($b = self).$attr_reader.apply($b, Opal.to_a(names)); return ($c = self).$attr_writer.apply($c, Opal.to_a(names)); }, TMP_13.$$arity = -1); Opal.alias(self, 'attr', 'attr_accessor'); Opal.defn(self, '$attr_reader', TMP_14 = function $$attr_reader($a_rest) { var self = this, names; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } names = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { names[$arg_idx - 0] = arguments[$arg_idx]; } var proto = self.$$proto; for (var i = names.length - 1; i >= 0; i--) { var name = names[i], id = '$' + name, ivar = Opal.ivar(name); // the closure here is needed because name will change at the next // cycle, I wish we could use let. var body = (function(ivar) { return function() { if (this[ivar] == null) { return nil; } else { return this[ivar]; } }; })(ivar); // initialize the instance variable as nil proto[ivar] = nil; body.$$parameters = []; body.$$arity = 0; if (self.$$is_singleton) { proto.constructor.prototype[id] = body; } else { Opal.defn(self, id, body); } } return nil; }, TMP_14.$$arity = -1); Opal.defn(self, '$attr_writer', TMP_15 = function $$attr_writer($a_rest) { var self = this, names; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } names = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { names[$arg_idx - 0] = arguments[$arg_idx]; } var proto = self.$$proto; for (var i = names.length - 1; i >= 0; i--) { var name = names[i], id = '$' + name + '=', ivar = Opal.ivar(name); // the closure here is needed because name will change at the next // cycle, I wish we could use let. var body = (function(ivar){ return function(value) { return this[ivar] = value; } })(ivar); body.$$parameters = [['req']]; body.$$arity = 1; // initialize the instance variable as nil proto[ivar] = nil; if (self.$$is_singleton) { proto.constructor.prototype[id] = body; } else { Opal.defn(self, id, body); } } return nil; }, TMP_15.$$arity = -1); Opal.defn(self, '$autoload', TMP_16 = function $$autoload(const$, path) { var self = this; var autoloaders; if (!(autoloaders = self.$$autoload)) { autoloaders = self.$$autoload = {}; } autoloaders[const$] = path; return nil; ; }, TMP_16.$$arity = 2); Opal.defn(self, '$class_variable_get', TMP_17 = function $$class_variable_get(name) { var $a, self = this; name = $scope.get('Opal')['$coerce_to!'](name, $scope.get('String'), "to_str"); if ((($a = name.length < 3 || name.slice(0,2) !== '@@') !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('NameError').$new("class vars should start with @@", name))}; var value = Opal.cvars[name.slice(2)]; (function() {if ((($a = value == null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise($scope.get('NameError').$new("uninitialized class variable @@a in", name)) } else { return nil }; return nil; })() return value; }, TMP_17.$$arity = 1); Opal.defn(self, '$class_variable_set', TMP_18 = function $$class_variable_set(name, value) { var $a, self = this; name = $scope.get('Opal')['$coerce_to!'](name, $scope.get('String'), "to_str"); if ((($a = name.length < 3 || name.slice(0,2) !== '@@') !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('NameError'))}; Opal.cvars[name.slice(2)] = value; return value; }, TMP_18.$$arity = 2); Opal.defn(self, '$constants', TMP_19 = function $$constants() { var self = this; return self.$$scope.constants.slice(0); }, TMP_19.$$arity = 0); Opal.defn(self, '$const_defined?', TMP_20 = function(name, inherit) { var $a, self = this; if (inherit == null) { inherit = true; } name = $scope.get('Opal')['$const_name!'](name); if ((($a = name['$=~']((($scope.get('Opal')).$$scope.get('CONST_NAME_REGEXP')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('NameError').$new("wrong constant name " + (name), name)) }; var scopes = [self.$$scope]; if (inherit || self === Opal.Object) { var parent = self.$$super; while (parent !== Opal.BasicObject) { scopes.push(parent.$$scope); parent = parent.$$super; } } for (var i = 0, length = scopes.length; i < length; i++) { if (scopes[i].hasOwnProperty(name)) { return true; } } return false; }, TMP_20.$$arity = -2); Opal.defn(self, '$const_get', TMP_22 = function $$const_get(name, inherit) { var $a, $b, TMP_21, self = this; if (inherit == null) { inherit = true; } name = $scope.get('Opal')['$const_name!'](name); if (name.indexOf('::') === 0 && name !== '::'){ name = name.slice(2); } if ((($a = name.indexOf('::') != -1 && name != '::') !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = name.$split("::")).$inject, $a.$$p = (TMP_21 = function(o, c){var self = TMP_21.$$s || this; if (o == null) o = nil;if (c == null) c = nil; return o.$const_get(c)}, TMP_21.$$s = self, TMP_21.$$arity = 2, TMP_21), $a).call($b, self)}; if ((($a = name['$=~']((($scope.get('Opal')).$$scope.get('CONST_NAME_REGEXP')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('NameError').$new("wrong constant name " + (name), name)) }; var scopes = [self.$$scope]; if (inherit || self == Opal.Object) { var parent = self.$$super; while (parent !== Opal.BasicObject) { scopes.push(parent.$$scope); parent = parent.$$super; } } for (var i = 0, length = scopes.length; i < length; i++) { if (scopes[i].hasOwnProperty(name)) { return scopes[i][name]; } } return self.$const_missing(name); }, TMP_22.$$arity = -2); Opal.defn(self, '$const_missing', TMP_23 = function $$const_missing(name) { var self = this, full_const_name = nil; if (self.$$autoload) { var file = self.$$autoload[name]; if (file) { self.$require(file); return self.$const_get(name); } } full_const_name = (function() {if (self['$==']($scope.get('Object'))) { return name } else { return "" + (self) + "::" + (name) }; return nil; })(); return self.$raise($scope.get('NameError').$new("uninitialized constant " + (full_const_name), name)); }, TMP_23.$$arity = 1); Opal.defn(self, '$const_set', TMP_24 = function $$const_set(name, value) { var $a, $b, self = this; name = $scope.get('Opal')['$const_name!'](name); if ((($a = ((($b = (name['$=~']((($scope.get('Opal')).$$scope.get('CONST_NAME_REGEXP'))))['$!']()) !== false && $b !== nil && $b != null) ? $b : name['$start_with?']("::"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('NameError').$new("wrong constant name " + (name), name))}; Opal.casgn(self, name, value); return value; }, TMP_24.$$arity = 2); Opal.defn(self, '$define_method', TMP_25 = function $$define_method(name, method) { var $a, $b, $c, TMP_26, self = this, $iter = TMP_25.$$p, block = $iter || nil, $case = nil; TMP_25.$$p = null; if ((($a = method === undefined && block === nil) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "tried to create a Proc object without a block")}; ((($a = block) !== false && $a !== nil && $a != null) ? $a : block = (function() {$case = method;if ($scope.get('Proc')['$===']($case)) {return method}else if ($scope.get('Method')['$===']($case)) {return method.$to_proc().$$unbound;}else if ($scope.get('UnboundMethod')['$===']($case)) {return ($b = ($c = self).$lambda, $b.$$p = (TMP_26 = function($d_rest){var self = TMP_26.$$s || this, args, $e, bound = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } bound = method.$bind(self); return ($e = bound).$call.apply($e, Opal.to_a(args));}, TMP_26.$$s = self, TMP_26.$$arity = -1, TMP_26), $b).call($c)}else {return self.$raise($scope.get('TypeError'), "wrong argument type " + (block.$class()) + " (expected Proc/Method)")}})()); var id = '$' + name; block.$$jsid = name; block.$$s = null; block.$$def = block; block.$$define_meth = true; Opal.defn(self, id, block); return name; }, TMP_25.$$arity = -2); Opal.defn(self, '$remove_method', TMP_27 = function $$remove_method($a_rest) { var self = this, names; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } names = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { names[$arg_idx - 0] = arguments[$arg_idx]; } for (var i = 0, length = names.length; i < length; i++) { Opal.rdef(self, "$" + names[i]); } return self; }, TMP_27.$$arity = -1); Opal.defn(self, '$singleton_class?', TMP_28 = function() { var self = this; return !!self.$$is_singleton; }, TMP_28.$$arity = 0); Opal.defn(self, '$include', TMP_29 = function $$include($a_rest) { var self = this, mods; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } mods = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { mods[$arg_idx - 0] = arguments[$arg_idx]; } for (var i = mods.length - 1; i >= 0; i--) { var mod = mods[i]; if (mod === self) { continue; } if (!mod.$$is_module) { self.$raise($scope.get('TypeError'), "wrong argument type " + ((mod).$class()) + " (expected Module)"); } (mod).$append_features(self); (mod).$included(self); } return self; }, TMP_29.$$arity = -1); Opal.defn(self, '$included_modules', TMP_30 = function $$included_modules() { var self = this; var results; var module_chain = function(klass) { var included = []; for (var i = 0; i != klass.$$inc.length; i++) { var mod_or_class = klass.$$inc[i]; included.push(mod_or_class); included = included.concat(module_chain(mod_or_class)); } return included; }; results = module_chain(self); // need superclass's modules if (self.$$is_class) { for (var cls = self; cls; cls = cls.$$super) { results = results.concat(module_chain(cls)); } } return results; }, TMP_30.$$arity = 0); Opal.defn(self, '$include?', TMP_31 = function(mod) { var self = this; for (var cls = self; cls; cls = cls.$$super) { for (var i = 0; i != cls.$$inc.length; i++) { var mod2 = cls.$$inc[i]; if (mod === mod2) { return true; } } } return false; }, TMP_31.$$arity = 1); Opal.defn(self, '$instance_method', TMP_32 = function $$instance_method(name) { var self = this; var meth = self.$$proto['$' + name]; if (!meth || meth.$$stub) { self.$raise($scope.get('NameError').$new("undefined method `" + (name) + "' for class `" + (self.$name()) + "'", name)); } return $scope.get('UnboundMethod').$new(self, meth, name); }, TMP_32.$$arity = 1); Opal.defn(self, '$instance_methods', TMP_33 = function $$instance_methods(include_super) { var self = this; if (include_super == null) { include_super = true; } var methods = [], proto = self.$$proto; for (var prop in proto) { if (prop.charAt(0) !== '$') { continue; } if (typeof(proto[prop]) !== "function") { continue; } if (proto[prop].$$stub) { continue; } if (!self.$$is_module) { if (self !== Opal.BasicObject && proto[prop] === Opal.BasicObject.$$proto[prop]) { continue; } if (!include_super && !proto.hasOwnProperty(prop)) { continue; } if (!include_super && proto[prop].$$donated) { continue; } } methods.push(prop.substr(1)); } return methods; }, TMP_33.$$arity = -1); Opal.defn(self, '$included', TMP_34 = function $$included(mod) { var self = this; return nil; }, TMP_34.$$arity = 1); Opal.defn(self, '$extended', TMP_35 = function $$extended(mod) { var self = this; return nil; }, TMP_35.$$arity = 1); Opal.defn(self, '$method_added', TMP_36 = function $$method_added($a_rest) { var self = this; return nil; }, TMP_36.$$arity = -1); Opal.defn(self, '$method_removed', TMP_37 = function $$method_removed($a_rest) { var self = this; return nil; }, TMP_37.$$arity = -1); Opal.defn(self, '$method_undefined', TMP_38 = function $$method_undefined($a_rest) { var self = this; return nil; }, TMP_38.$$arity = -1); Opal.defn(self, '$module_eval', TMP_39 = function $$module_eval($a_rest) { var $b, $c, TMP_40, self = this, args, $iter = TMP_39.$$p, block = $iter || nil, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_39.$$p = null; if ((($b = ($c = block['$nil?'](), $c !== false && $c !== nil && $c != null ?!!Opal.compile : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = ($range(1, 3, false))['$cover?'](args.$size())) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { $scope.get('Kernel').$raise($scope.get('ArgumentError'), "wrong number of arguments (0 for 1..3)") }; $b = Opal.to_a(args), string = ($b[0] == null ? nil : $b[0]), file = ($b[1] == null ? nil : $b[1]), _lineno = ($b[2] == null ? nil : $b[2]), $b; default_eval_options = $hash2(["file", "eval"], {"file": (((($b = file) !== false && $b !== nil && $b != null) ? $b : "(eval)")), "eval": true}); compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); compiled = $scope.get('Opal').$compile(string, compiling_options); block = ($b = ($c = $scope.get('Kernel')).$proc, $b.$$p = (TMP_40 = function(){var self = TMP_40.$$s || this; return (function(self) { return eval(compiled); })(self) }, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40), $b).call($c); } else if ((($b = $rb_gt(args.$size(), 0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { $scope.get('Kernel').$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (args.$size()) + " for 0)")}; var old = block.$$s, result; block.$$s = null; result = block.apply(self, [self]); block.$$s = old; return result; }, TMP_39.$$arity = -1); Opal.alias(self, 'class_eval', 'module_eval'); Opal.defn(self, '$module_exec', TMP_41 = function $$module_exec($a_rest) { var self = this, args, $iter = TMP_41.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_41.$$p = null; if (block === nil) { self.$raise($scope.get('LocalJumpError'), "no block given") } var block_self = block.$$s, result; block.$$s = null; result = block.apply(self, args); block.$$s = block_self; return result; ; }, TMP_41.$$arity = -1); Opal.alias(self, 'class_exec', 'module_exec'); Opal.defn(self, '$method_defined?', TMP_42 = function(method) { var self = this; var body = self.$$proto['$' + method]; return (!!body) && !body.$$stub; }, TMP_42.$$arity = 1); Opal.defn(self, '$module_function', TMP_43 = function $$module_function($a_rest) { var self = this, methods; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } methods = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { methods[$arg_idx - 0] = arguments[$arg_idx]; } if (methods.length === 0) { self.$$module_function = true; } else { for (var i = 0, length = methods.length; i < length; i++) { var meth = methods[i], id = '$' + meth, func = self.$$proto[id]; Opal.defs(self, id, func); } } return self; }, TMP_43.$$arity = -1); Opal.defn(self, '$name', TMP_44 = function $$name() { var self = this; if (self.$$full_name) { return self.$$full_name; } var result = [], base = self; while (base) { if (base.$$name === nil) { return result.length === 0 ? nil : result.join('::'); } result.unshift(base.$$name); base = base.$$base_module; if (base === Opal.Object) { break; } } if (result.length === 0) { return nil; } return self.$$full_name = result.join('::'); }, TMP_44.$$arity = 0); Opal.defn(self, '$remove_class_variable', TMP_45 = function $$remove_class_variable($a_rest) { var self = this; return nil; }, TMP_45.$$arity = -1); Opal.defn(self, '$remove_const', TMP_46 = function $$remove_const(name) { var self = this; var old = self.$$scope[name]; delete self.$$scope[name]; return old; }, TMP_46.$$arity = 1); Opal.defn(self, '$to_s', TMP_47 = function $$to_s() { var $a, self = this; return ((($a = Opal.Module.$name.call(self)) !== false && $a !== nil && $a != null) ? $a : "#<" + (self.$$is_module ? 'Module' : 'Class') + ":0x" + (self.$__id__().$to_s(16)) + ">"); }, TMP_47.$$arity = 0); Opal.defn(self, '$undef_method', TMP_48 = function $$undef_method($a_rest) { var self = this, names; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } names = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { names[$arg_idx - 0] = arguments[$arg_idx]; } for (var i = 0, length = names.length; i < length; i++) { Opal.udef(self, "$" + names[i]); } return self; }, TMP_48.$$arity = -1); return (Opal.defn(self, '$instance_variables', TMP_49 = function $$instance_variables() { var self = this, consts = nil; consts = self.$constants(); var result = []; for (var name in self) { if (self.hasOwnProperty(name) && name.charAt(0) !== '$' && name !== 'constructor' && !consts['$include?'](name)) { result.push('@' + name); } } return result; }, TMP_49.$$arity = 0), nil) && 'instance_variables'; })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/class"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$allocate', '$name', '$to_s']); self.$require("corelib/module"); return (function($base, $super) { function $Class(){}; var self = $Class = $klass($base, $super, 'Class', $Class); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6; Opal.defs(self, '$new', TMP_1 = function(superclass) { var self = this, $iter = TMP_1.$$p, block = $iter || nil; if (superclass == null) { superclass = $scope.get('Object'); } TMP_1.$$p = null; if (!superclass.$$is_class) { throw Opal.TypeError.$new("superclass must be a Class"); } var alloc = Opal.boot_class_alloc(null, function(){}, superclass) var klass = Opal.setup_class_object(null, alloc, superclass.$$name, superclass.constructor); klass.$$super = superclass; klass.$$parent = superclass; // inherit scope from parent Opal.create_scope(superclass.$$scope, klass); superclass.$inherited(klass); Opal.module_initialize(klass, block); return klass; }, TMP_1.$$arity = -1); Opal.defn(self, '$allocate', TMP_2 = function $$allocate() { var self = this; var obj = new self.$$alloc(); obj.$$id = Opal.uid(); return obj; }, TMP_2.$$arity = 0); Opal.defn(self, '$inherited', TMP_3 = function $$inherited(cls) { var self = this; return nil; }, TMP_3.$$arity = 1); Opal.defn(self, '$new', TMP_4 = function($a_rest) { var self = this, args, $iter = TMP_4.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_4.$$p = null; var obj = self.$allocate(); obj.$initialize.$$p = block; obj.$initialize.apply(obj, args); return obj; ; }, TMP_4.$$arity = -1); Opal.defn(self, '$superclass', TMP_5 = function $$superclass() { var self = this; return self.$$super || nil; }, TMP_5.$$arity = 0); return (Opal.defn(self, '$to_s', TMP_6 = function $$to_s() { var $a, $b, self = this, $iter = TMP_6.$$p, $yield = $iter || nil; TMP_6.$$p = null; var singleton_of = self.$$singleton_of; if (singleton_of && (singleton_of.$$is_class || singleton_of.$$is_module)) { return "#"; } else if (singleton_of) { // a singleton class created from an object return "#>"; } return ($a = ($b = self, Opal.find_super_dispatcher(self, 'to_s', TMP_6, false)), $a.$$p = null, $a).call($b); }, TMP_6.$$arity = 0), nil) && 'to_s'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/basic_object"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $range = Opal.range, $hash2 = Opal.hash2; Opal.add_stubs(['$==', '$!', '$nil?', '$cover?', '$size', '$raise', '$merge', '$compile', '$proc', '$>', '$new', '$inspect']); return (function($base, $super) { function $BasicObject(){}; var self = $BasicObject = $klass($base, $super, 'BasicObject', $BasicObject); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14; Opal.defn(self, '$initialize', TMP_1 = function $$initialize($a_rest) { var self = this; return nil; }, TMP_1.$$arity = -1); Opal.defn(self, '$==', TMP_2 = function(other) { var self = this; return self === other; }, TMP_2.$$arity = 1); Opal.defn(self, '$eql?', TMP_3 = function(other) { var self = this; return self['$=='](other); }, TMP_3.$$arity = 1); Opal.alias(self, 'equal?', '=='); Opal.defn(self, '$__id__', TMP_4 = function $$__id__() { var self = this; return self.$$id || (self.$$id = Opal.uid()); }, TMP_4.$$arity = 0); Opal.defn(self, '$__send__', TMP_5 = function $$__send__(symbol, $a_rest) { var self = this, args, $iter = TMP_5.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_5.$$p = null; var func = self['$' + symbol] if (func) { if (block !== nil) { func.$$p = block; } return func.apply(self, args); } if (block !== nil) { self.$method_missing.$$p = block; } return self.$method_missing.apply(self, [symbol].concat(args)); }, TMP_5.$$arity = -2); Opal.defn(self, '$!', TMP_6 = function() { var self = this; return false; }, TMP_6.$$arity = 0); Opal.defn(self, '$!=', TMP_7 = function(other) { var self = this; return (self['$=='](other))['$!'](); }, TMP_7.$$arity = 1); Opal.alias(self, 'equal?', '=='); Opal.defn(self, '$instance_eval', TMP_8 = function $$instance_eval($a_rest) { var $b, $c, TMP_9, self = this, args, $iter = TMP_8.$$p, block = $iter || nil, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_8.$$p = null; if ((($b = ($c = block['$nil?'](), $c !== false && $c !== nil && $c != null ?!!Opal.compile : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = ($range(1, 3, false))['$cover?'](args.$size())) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { $scope.get('Kernel').$raise($scope.get('ArgumentError'), "wrong number of arguments (0 for 1..3)") }; $b = Opal.to_a(args), string = ($b[0] == null ? nil : $b[0]), file = ($b[1] == null ? nil : $b[1]), _lineno = ($b[2] == null ? nil : $b[2]), $b; default_eval_options = $hash2(["file", "eval"], {"file": (((($b = file) !== false && $b !== nil && $b != null) ? $b : "(eval)")), "eval": true}); compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); compiled = $scope.get('Opal').$compile(string, compiling_options); block = ($b = ($c = $scope.get('Kernel')).$proc, $b.$$p = (TMP_9 = function(){var self = TMP_9.$$s || this; return (function(self) { return eval(compiled); })(self) }, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9), $b).call($c); } else if ((($b = $rb_gt(args.$size(), 0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { $scope.get('Kernel').$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (args.$size()) + " for 0)")}; var old = block.$$s, result; block.$$s = null; // Need to pass $$eval so that method definitions know if this is // being done on a class/module. Cannot be compiler driven since // send(:instance_eval) needs to work. if (self.$$is_class || self.$$is_module) { self.$$eval = true; try { result = block.call(self, self); } finally { self.$$eval = false; } } else { result = block.call(self, self); } block.$$s = old; return result; }, TMP_8.$$arity = -1); Opal.defn(self, '$instance_exec', TMP_10 = function $$instance_exec($a_rest) { var self = this, args, $iter = TMP_10.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_10.$$p = null; if (block !== false && block !== nil && block != null) { } else { $scope.get('Kernel').$raise($scope.get('ArgumentError'), "no block given") }; var block_self = block.$$s, result; block.$$s = null; if (self.$$is_class || self.$$is_module) { self.$$eval = true; try { result = block.apply(self, args); } finally { self.$$eval = false; } } else { result = block.apply(self, args); } block.$$s = block_self; return result; }, TMP_10.$$arity = -1); Opal.defn(self, '$singleton_method_added', TMP_11 = function $$singleton_method_added($a_rest) { var self = this; return nil; }, TMP_11.$$arity = -1); Opal.defn(self, '$singleton_method_removed', TMP_12 = function $$singleton_method_removed($a_rest) { var self = this; return nil; }, TMP_12.$$arity = -1); Opal.defn(self, '$singleton_method_undefined', TMP_13 = function $$singleton_method_undefined($a_rest) { var self = this; return nil; }, TMP_13.$$arity = -1); return (Opal.defn(self, '$method_missing', TMP_14 = function $$method_missing(symbol, $a_rest) { var $b, self = this, args, $iter = TMP_14.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_14.$$p = null; return $scope.get('Kernel').$raise($scope.get('NoMethodError').$new((function() {if ((($b = self.$inspect && !self.$inspect.$$stub) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return "undefined method `" + (symbol) + "' for " + (self.$inspect()) + ":" + (self.$$class) } else { return "undefined method `" + (symbol) + "' for " + (self.$$class) }; return nil; })(), symbol)); }, TMP_14.$$arity = -2), nil) && 'method_missing'; })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/kernel"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_le(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $gvars = Opal.gvars, $hash2 = Opal.hash2, $klass = Opal.klass; Opal.add_stubs(['$raise', '$new', '$inspect', '$!', '$=~', '$==', '$object_id', '$class', '$coerce_to?', '$<<', '$allocate', '$copy_instance_variables', '$copy_singleton_methods', '$initialize_clone', '$initialize_copy', '$define_method', '$to_proc', '$singleton_class', '$initialize_dup', '$for', '$>', '$size', '$pop', '$call', '$append_features', '$extended', '$length', '$respond_to?', '$[]', '$nil?', '$to_a', '$to_int', '$fetch', '$Integer', '$Float', '$to_ary', '$to_str', '$coerce_to', '$to_s', '$__id__', '$instance_variable_name!', '$coerce_to!', '$===', '$enum_for', '$print', '$format', '$puts', '$each', '$<=', '$empty?', '$exception', '$kind_of?', '$respond_to_missing?', '$try_convert!', '$expand_path', '$join', '$start_with?', '$sym', '$arg', '$open', '$include']); (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_40, TMP_41, TMP_42, TMP_43, TMP_45, TMP_46, TMP_47, TMP_48, TMP_49, TMP_50, TMP_51, TMP_52, TMP_53, TMP_54, TMP_55, TMP_56, TMP_57, TMP_58, TMP_59, TMP_60, TMP_61, TMP_62, TMP_63; Opal.defn(self, '$method_missing', TMP_1 = function $$method_missing(symbol, $a_rest) { var self = this, args, $iter = TMP_1.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_1.$$p = null; return self.$raise($scope.get('NoMethodError').$new("undefined method `" + (symbol) + "' for " + (self.$inspect()), symbol, args)); }, TMP_1.$$arity = -2); Opal.defn(self, '$=~', TMP_2 = function(obj) { var self = this; return false; }, TMP_2.$$arity = 1); Opal.defn(self, '$!~', TMP_3 = function(obj) { var self = this; return (self['$=~'](obj))['$!'](); }, TMP_3.$$arity = 1); Opal.defn(self, '$===', TMP_4 = function(other) { var $a, self = this; return ((($a = self.$object_id()['$=='](other.$object_id())) !== false && $a !== nil && $a != null) ? $a : self['$=='](other)); }, TMP_4.$$arity = 1); Opal.defn(self, '$<=>', TMP_5 = function(other) { var self = this; // set guard for infinite recursion self.$$comparable = true; var x = self['$=='](other); if (x && x !== nil) { return 0; } return nil; }, TMP_5.$$arity = 1); Opal.defn(self, '$method', TMP_6 = function $$method(name) { var self = this; var meth = self['$' + name]; if (!meth || meth.$$stub) { self.$raise($scope.get('NameError').$new("undefined method `" + (name) + "' for class `" + (self.$class()) + "'", name)); } return $scope.get('Method').$new(self, meth, name); }, TMP_6.$$arity = 1); Opal.defn(self, '$methods', TMP_7 = function $$methods(all) { var self = this; if (all == null) { all = true; } var methods = []; for (var key in self) { if (key[0] == "$" && typeof(self[key]) === "function") { if (all == false || all === nil) { if (!Opal.hasOwnProperty.call(self, key)) { continue; } } if (self[key].$$stub === undefined) { methods.push(key.substr(1)); } } } return methods; }, TMP_7.$$arity = -1); Opal.alias(self, 'public_methods', 'methods'); Opal.defn(self, '$Array', TMP_8 = function $$Array(object) { var self = this; var coerced; if (object === nil) { return []; } if (object.$$is_array) { return object; } coerced = $scope.get('Opal')['$coerce_to?'](object, $scope.get('Array'), "to_ary"); if (coerced !== nil) { return coerced; } coerced = $scope.get('Opal')['$coerce_to?'](object, $scope.get('Array'), "to_a"); if (coerced !== nil) { return coerced; } return [object]; }, TMP_8.$$arity = 1); Opal.defn(self, '$at_exit', TMP_9 = function $$at_exit() { var $a, self = this, $iter = TMP_9.$$p, block = $iter || nil; if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; TMP_9.$$p = null; ((($a = $gvars.__at_exit__) !== false && $a !== nil && $a != null) ? $a : $gvars.__at_exit__ = []); return $gvars.__at_exit__['$<<'](block); }, TMP_9.$$arity = 0); Opal.defn(self, '$caller', TMP_10 = function $$caller() { var self = this; return []; }, TMP_10.$$arity = 0); Opal.defn(self, '$class', TMP_11 = function() { var self = this; return self.$$class; }, TMP_11.$$arity = 0); Opal.defn(self, '$copy_instance_variables', TMP_12 = function $$copy_instance_variables(other) { var self = this; for (var name in other) { if (other.hasOwnProperty(name) && name.charAt(0) !== '$') { self[name] = other[name]; } } }, TMP_12.$$arity = 1); Opal.defn(self, '$copy_singleton_methods', TMP_13 = function $$copy_singleton_methods(other) { var self = this; var name; if (other.hasOwnProperty('$$meta')) { var other_singleton_class_proto = Opal.get_singleton_class(other).$$proto; var self_singleton_class_proto = Opal.get_singleton_class(self).$$proto; for (name in other_singleton_class_proto) { if (name.charAt(0) === '$' && other_singleton_class_proto.hasOwnProperty(name)) { self_singleton_class_proto[name] = other_singleton_class_proto[name]; } } } for (name in other) { if (name.charAt(0) === '$' && name.charAt(1) !== '$' && other.hasOwnProperty(name)) { self[name] = other[name]; } } }, TMP_13.$$arity = 1); Opal.defn(self, '$clone', TMP_14 = function $$clone() { var self = this, copy = nil; copy = self.$class().$allocate(); copy.$copy_instance_variables(self); copy.$copy_singleton_methods(self); copy.$initialize_clone(self); return copy; }, TMP_14.$$arity = 0); Opal.defn(self, '$initialize_clone', TMP_15 = function $$initialize_clone(other) { var self = this; return self.$initialize_copy(other); }, TMP_15.$$arity = 1); Opal.defn(self, '$define_singleton_method', TMP_16 = function $$define_singleton_method(name, method) { var $a, $b, self = this, $iter = TMP_16.$$p, block = $iter || nil; TMP_16.$$p = null; return ($a = ($b = self.$singleton_class()).$define_method, $a.$$p = block.$to_proc(), $a).call($b, name, method); }, TMP_16.$$arity = -2); Opal.defn(self, '$dup', TMP_17 = function $$dup() { var self = this, copy = nil; copy = self.$class().$allocate(); copy.$copy_instance_variables(self); copy.$initialize_dup(self); return copy; }, TMP_17.$$arity = 0); Opal.defn(self, '$initialize_dup', TMP_18 = function $$initialize_dup(other) { var self = this; return self.$initialize_copy(other); }, TMP_18.$$arity = 1); Opal.defn(self, '$enum_for', TMP_19 = function $$enum_for(method, $a_rest) { var $b, $c, self = this, args, $iter = TMP_19.$$p, block = $iter || nil; if (method == null) { method = "each"; } var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_19.$$p = null; return ($b = ($c = $scope.get('Enumerator')).$for, $b.$$p = block.$to_proc(), $b).apply($c, [self, method].concat(Opal.to_a(args))); }, TMP_19.$$arity = -1); Opal.alias(self, 'to_enum', 'enum_for'); Opal.defn(self, '$equal?', TMP_20 = function(other) { var self = this; return self === other; }, TMP_20.$$arity = 1); Opal.defn(self, '$exit', TMP_21 = function $$exit(status) { var $a, $b, self = this, block = nil; if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; if (status == null) { status = true; } ((($a = $gvars.__at_exit__) !== false && $a !== nil && $a != null) ? $a : $gvars.__at_exit__ = []); while ((($b = $rb_gt($gvars.__at_exit__.$size(), 0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { block = $gvars.__at_exit__.$pop(); block.$call();}; if ((($a = status === true) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { status = 0}; Opal.exit(status); return nil; }, TMP_21.$$arity = -1); Opal.defn(self, '$extend', TMP_22 = function $$extend($a_rest) { var self = this, mods; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } mods = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { mods[$arg_idx - 0] = arguments[$arg_idx]; } var singleton = self.$singleton_class(); for (var i = mods.length - 1; i >= 0; i--) { var mod = mods[i]; if (!mod.$$is_module) { self.$raise($scope.get('TypeError'), "wrong argument type " + ((mod).$class()) + " (expected Module)"); } (mod).$append_features(singleton); (mod).$extended(self); } ; return self; }, TMP_22.$$arity = -1); Opal.defn(self, '$format', TMP_23 = function $$format(format_string, $a_rest) { var $b, $c, self = this, args, ary = nil; if ($gvars.DEBUG == null) $gvars.DEBUG = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } if ((($b = (($c = args.$length()['$=='](1)) ? args['$[]'](0)['$respond_to?']("to_ary") : args.$length()['$=='](1))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { ary = $scope.get('Opal')['$coerce_to?'](args['$[]'](0), $scope.get('Array'), "to_ary"); if ((($b = ary['$nil?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { args = ary.$to_a() };}; var result = '', //used for slicing: begin_slice = 0, end_slice, //used for iterating over the format string: i, len = format_string.length, //used for processing field values: arg, str, //used for processing %g and %G fields: exponent, //used for keeping track of width and precision: width, precision, //used for holding temporary values: tmp_num, //used for processing %{} and %<> fileds: hash_parameter_key, closing_brace_char, //used for processing %b, %B, %o, %x, and %X fields: base_number, base_prefix, base_neg_zero_regex, base_neg_zero_digit, //used for processing arguments: next_arg, seq_arg_num = 1, pos_arg_num = 0, //used for keeping track of flags: flags, FNONE = 0, FSHARP = 1, FMINUS = 2, FPLUS = 4, FZERO = 8, FSPACE = 16, FWIDTH = 32, FPREC = 64, FPREC0 = 128; function CHECK_FOR_FLAGS() { if (flags&FWIDTH) { self.$raise($scope.get('ArgumentError'), "flag after width") } if (flags&FPREC0) { self.$raise($scope.get('ArgumentError'), "flag after precision") } } function CHECK_FOR_WIDTH() { if (flags&FWIDTH) { self.$raise($scope.get('ArgumentError'), "width given twice") } if (flags&FPREC0) { self.$raise($scope.get('ArgumentError'), "width after precision") } } function GET_NTH_ARG(num) { if (num >= args.length) { self.$raise($scope.get('ArgumentError'), "too few arguments") } return args[num]; } function GET_NEXT_ARG() { switch (pos_arg_num) { case -1: self.$raise($scope.get('ArgumentError'), "unnumbered(" + (seq_arg_num) + ") mixed with numbered") case -2: self.$raise($scope.get('ArgumentError'), "unnumbered(" + (seq_arg_num) + ") mixed with named") } pos_arg_num = seq_arg_num++; return GET_NTH_ARG(pos_arg_num - 1); } function GET_POS_ARG(num) { if (pos_arg_num > 0) { self.$raise($scope.get('ArgumentError'), "numbered(" + (num) + ") after unnumbered(" + (pos_arg_num) + ")") } if (pos_arg_num === -2) { self.$raise($scope.get('ArgumentError'), "numbered(" + (num) + ") after named") } if (num < 1) { self.$raise($scope.get('ArgumentError'), "invalid index - " + (num) + "$") } pos_arg_num = -1; return GET_NTH_ARG(num - 1); } function GET_ARG() { return (next_arg === undefined ? GET_NEXT_ARG() : next_arg); } function READ_NUM(label) { var num, str = ''; for (;; i++) { if (i === len) { self.$raise($scope.get('ArgumentError'), "malformed format string - %*[0-9]") } if (format_string.charCodeAt(i) < 48 || format_string.charCodeAt(i) > 57) { i--; num = parseInt(str, 10) || 0; if (num > 2147483647) { self.$raise($scope.get('ArgumentError'), "" + (label) + " too big") } return num; } str += format_string.charAt(i); } } function READ_NUM_AFTER_ASTER(label) { var arg, num = READ_NUM(label); if (format_string.charAt(i + 1) === '$') { i++; arg = GET_POS_ARG(num); } else { arg = GET_NEXT_ARG(); } return (arg).$to_int(); } for (i = format_string.indexOf('%'); i !== -1; i = format_string.indexOf('%', i)) { str = undefined; flags = FNONE; width = -1; precision = -1; next_arg = undefined; end_slice = i; i++; switch (format_string.charAt(i)) { case '%': begin_slice = i; case '': case '\n': case '\0': i++; continue; } format_sequence: for (; i < len; i++) { switch (format_string.charAt(i)) { case ' ': CHECK_FOR_FLAGS(); flags |= FSPACE; continue format_sequence; case '#': CHECK_FOR_FLAGS(); flags |= FSHARP; continue format_sequence; case '+': CHECK_FOR_FLAGS(); flags |= FPLUS; continue format_sequence; case '-': CHECK_FOR_FLAGS(); flags |= FMINUS; continue format_sequence; case '0': CHECK_FOR_FLAGS(); flags |= FZERO; continue format_sequence; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': tmp_num = READ_NUM('width'); if (format_string.charAt(i + 1) === '$') { if (i + 2 === len) { str = '%'; i++; break format_sequence; } if (next_arg !== undefined) { self.$raise($scope.get('ArgumentError'), "value given twice - %" + (tmp_num) + "$") } next_arg = GET_POS_ARG(tmp_num); i++; } else { CHECK_FOR_WIDTH(); flags |= FWIDTH; width = tmp_num; } continue format_sequence; case '<': case '\{': closing_brace_char = (format_string.charAt(i) === '<' ? '>' : '\}'); hash_parameter_key = ''; i++; for (;; i++) { if (i === len) { self.$raise($scope.get('ArgumentError'), "malformed name - unmatched parenthesis") } if (format_string.charAt(i) === closing_brace_char) { if (pos_arg_num > 0) { self.$raise($scope.get('ArgumentError'), "named " + (hash_parameter_key) + " after unnumbered(" + (pos_arg_num) + ")") } if (pos_arg_num === -1) { self.$raise($scope.get('ArgumentError'), "named " + (hash_parameter_key) + " after numbered") } pos_arg_num = -2; if (args[0] === undefined || !args[0].$$is_hash) { self.$raise($scope.get('ArgumentError'), "one hash required") } next_arg = (args[0]).$fetch(hash_parameter_key); if (closing_brace_char === '>') { continue format_sequence; } else { str = next_arg.toString(); if (precision !== -1) { str = str.slice(0, precision); } if (flags&FMINUS) { while (str.length < width) { str = str + ' '; } } else { while (str.length < width) { str = ' ' + str; } } break format_sequence; } } hash_parameter_key += format_string.charAt(i); } case '*': i++; CHECK_FOR_WIDTH(); flags |= FWIDTH; width = READ_NUM_AFTER_ASTER('width'); if (width < 0) { flags |= FMINUS; width = -width; } continue format_sequence; case '.': if (flags&FPREC0) { self.$raise($scope.get('ArgumentError'), "precision given twice") } flags |= FPREC|FPREC0; precision = 0; i++; if (format_string.charAt(i) === '*') { i++; precision = READ_NUM_AFTER_ASTER('precision'); if (precision < 0) { flags &= ~FPREC; } continue format_sequence; } precision = READ_NUM('precision'); continue format_sequence; case 'd': case 'i': case 'u': arg = self.$Integer(GET_ARG()); if (arg >= 0) { str = arg.toString(); while (str.length < precision) { str = '0' + str; } if (flags&FMINUS) { if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } while (str.length < width) { str = str + ' '; } } else { if (flags&FZERO && precision === -1) { while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } } else { if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } while (str.length < width) { str = ' ' + str; } } } } else { str = (-arg).toString(); while (str.length < precision) { str = '0' + str; } if (flags&FMINUS) { str = '-' + str; while (str.length < width) { str = str + ' '; } } else { if (flags&FZERO && precision === -1) { while (str.length < width - 1) { str = '0' + str; } str = '-' + str; } else { str = '-' + str; while (str.length < width) { str = ' ' + str; } } } } break format_sequence; case 'b': case 'B': case 'o': case 'x': case 'X': switch (format_string.charAt(i)) { case 'b': case 'B': base_number = 2; base_prefix = '0b'; base_neg_zero_regex = /^1+/; base_neg_zero_digit = '1'; break; case 'o': base_number = 8; base_prefix = '0'; base_neg_zero_regex = /^3?7+/; base_neg_zero_digit = '7'; break; case 'x': case 'X': base_number = 16; base_prefix = '0x'; base_neg_zero_regex = /^f+/; base_neg_zero_digit = 'f'; break; } arg = self.$Integer(GET_ARG()); if (arg >= 0) { str = arg.toString(base_number); while (str.length < precision) { str = '0' + str; } if (flags&FMINUS) { if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } while (str.length < width) { str = str + ' '; } } else { if (flags&FZERO && precision === -1) { while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0) - ((flags&FSHARP && arg !== 0) ? base_prefix.length : 0)) { str = '0' + str; } if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } } else { if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } while (str.length < width) { str = ' ' + str; } } } } else { if (flags&FPLUS || flags&FSPACE) { str = (-arg).toString(base_number); while (str.length < precision) { str = '0' + str; } if (flags&FMINUS) { if (flags&FSHARP) { str = base_prefix + str; } str = '-' + str; while (str.length < width) { str = str + ' '; } } else { if (flags&FZERO && precision === -1) { while (str.length < width - 1 - (flags&FSHARP ? 2 : 0)) { str = '0' + str; } if (flags&FSHARP) { str = base_prefix + str; } str = '-' + str; } else { if (flags&FSHARP) { str = base_prefix + str; } str = '-' + str; while (str.length < width) { str = ' ' + str; } } } } else { str = (arg >>> 0).toString(base_number).replace(base_neg_zero_regex, base_neg_zero_digit); while (str.length < precision - 2) { str = base_neg_zero_digit + str; } if (flags&FMINUS) { str = '..' + str; if (flags&FSHARP) { str = base_prefix + str; } while (str.length < width) { str = str + ' '; } } else { if (flags&FZERO && precision === -1) { while (str.length < width - 2 - (flags&FSHARP ? base_prefix.length : 0)) { str = base_neg_zero_digit + str; } str = '..' + str; if (flags&FSHARP) { str = base_prefix + str; } } else { str = '..' + str; if (flags&FSHARP) { str = base_prefix + str; } while (str.length < width) { str = ' ' + str; } } } } } if (format_string.charAt(i) === format_string.charAt(i).toUpperCase()) { str = str.toUpperCase(); } break format_sequence; case 'f': case 'e': case 'E': case 'g': case 'G': arg = self.$Float(GET_ARG()); if (arg >= 0 || isNaN(arg)) { if (arg === Infinity) { str = 'Inf'; } else { switch (format_string.charAt(i)) { case 'f': str = arg.toFixed(precision === -1 ? 6 : precision); break; case 'e': case 'E': str = arg.toExponential(precision === -1 ? 6 : precision); break; case 'g': case 'G': str = arg.toExponential(); exponent = parseInt(str.split('e')[1], 10); if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { str = arg.toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); } break; } } if (flags&FMINUS) { if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } while (str.length < width) { str = str + ' '; } } else { if (flags&FZERO && arg !== Infinity && !isNaN(arg)) { while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } } else { if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } while (str.length < width) { str = ' ' + str; } } } } else { if (arg === -Infinity) { str = 'Inf'; } else { switch (format_string.charAt(i)) { case 'f': str = (-arg).toFixed(precision === -1 ? 6 : precision); break; case 'e': case 'E': str = (-arg).toExponential(precision === -1 ? 6 : precision); break; case 'g': case 'G': str = (-arg).toExponential(); exponent = parseInt(str.split('e')[1], 10); if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { str = (-arg).toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); } break; } } if (flags&FMINUS) { str = '-' + str; while (str.length < width) { str = str + ' '; } } else { if (flags&FZERO && arg !== -Infinity) { while (str.length < width - 1) { str = '0' + str; } str = '-' + str; } else { str = '-' + str; while (str.length < width) { str = ' ' + str; } } } } if (format_string.charAt(i) === format_string.charAt(i).toUpperCase() && arg !== Infinity && arg !== -Infinity && !isNaN(arg)) { str = str.toUpperCase(); } str = str.replace(/([eE][-+]?)([0-9])$/, '$10$2'); break format_sequence; case 'a': case 'A': // Not implemented because there are no specs for this field type. self.$raise($scope.get('NotImplementedError'), "`A` and `a` format field types are not implemented in Opal yet") case 'c': arg = GET_ARG(); if ((arg)['$respond_to?']("to_ary")) { arg = (arg).$to_ary()[0]; } if ((arg)['$respond_to?']("to_str")) { str = (arg).$to_str(); } else { str = String.fromCharCode($scope.get('Opal').$coerce_to(arg, $scope.get('Integer'), "to_int")); } if (str.length !== 1) { self.$raise($scope.get('ArgumentError'), "%c requires a character") } if (flags&FMINUS) { while (str.length < width) { str = str + ' '; } } else { while (str.length < width) { str = ' ' + str; } } break format_sequence; case 'p': str = (GET_ARG()).$inspect(); if (precision !== -1) { str = str.slice(0, precision); } if (flags&FMINUS) { while (str.length < width) { str = str + ' '; } } else { while (str.length < width) { str = ' ' + str; } } break format_sequence; case 's': str = (GET_ARG()).$to_s(); if (precision !== -1) { str = str.slice(0, precision); } if (flags&FMINUS) { while (str.length < width) { str = str + ' '; } } else { while (str.length < width) { str = ' ' + str; } } break format_sequence; default: self.$raise($scope.get('ArgumentError'), "malformed format string - %" + (format_string.charAt(i))) } } if (str === undefined) { self.$raise($scope.get('ArgumentError'), "malformed format string - %") } result += format_string.slice(begin_slice, end_slice) + str; begin_slice = i + 1; } if ($gvars.DEBUG && pos_arg_num >= 0 && seq_arg_num < args.length) { self.$raise($scope.get('ArgumentError'), "too many arguments for format string") } return result + format_string.slice(begin_slice); ; }, TMP_23.$$arity = -2); Opal.defn(self, '$hash', TMP_24 = function $$hash() { var self = this; return self.$__id__(); }, TMP_24.$$arity = 0); Opal.defn(self, '$initialize_copy', TMP_25 = function $$initialize_copy(other) { var self = this; return nil; }, TMP_25.$$arity = 1); Opal.defn(self, '$inspect', TMP_26 = function $$inspect() { var self = this; return self.$to_s(); }, TMP_26.$$arity = 0); Opal.defn(self, '$instance_of?', TMP_27 = function(klass) { var self = this; if (!klass.$$is_class && !klass.$$is_module) { self.$raise($scope.get('TypeError'), "class or module required"); } return self.$$class === klass; ; }, TMP_27.$$arity = 1); Opal.defn(self, '$instance_variable_defined?', TMP_28 = function(name) { var self = this; name = $scope.get('Opal')['$instance_variable_name!'](name); return Opal.hasOwnProperty.call(self, name.substr(1)); }, TMP_28.$$arity = 1); Opal.defn(self, '$instance_variable_get', TMP_29 = function $$instance_variable_get(name) { var self = this; name = $scope.get('Opal')['$instance_variable_name!'](name); var ivar = self[Opal.ivar(name.substr(1))]; return ivar == null ? nil : ivar; }, TMP_29.$$arity = 1); Opal.defn(self, '$instance_variable_set', TMP_30 = function $$instance_variable_set(name, value) { var self = this; name = $scope.get('Opal')['$instance_variable_name!'](name); return self[Opal.ivar(name.substr(1))] = value; }, TMP_30.$$arity = 2); Opal.defn(self, '$remove_instance_variable', TMP_31 = function $$remove_instance_variable(name) { var self = this; name = $scope.get('Opal')['$instance_variable_name!'](name); var key = Opal.ivar(name.substr(1)), val; if (self.hasOwnProperty(key)) { val = self[key]; delete self[key]; return val; } return self.$raise($scope.get('NameError'), "instance variable " + (name) + " not defined"); }, TMP_31.$$arity = 1); Opal.defn(self, '$instance_variables', TMP_32 = function $$instance_variables() { var self = this; var result = [], ivar; for (var name in self) { if (self.hasOwnProperty(name) && name.charAt(0) !== '$') { if (name.substr(-1) === '$') { ivar = name.slice(0, name.length - 1); } else { ivar = name; } result.push('@' + ivar); } } return result; }, TMP_32.$$arity = 0); Opal.defn(self, '$Integer', TMP_33 = function $$Integer(value, base) { var self = this; var i, str, base_digits; if (!value.$$is_string) { if (base !== undefined) { self.$raise($scope.get('ArgumentError'), "base specified for non string value") } if (value === nil) { self.$raise($scope.get('TypeError'), "can't convert nil into Integer") } if (value.$$is_number) { if (value === Infinity || value === -Infinity || isNaN(value)) { self.$raise($scope.get('FloatDomainError'), value) } return Math.floor(value); } if (value['$respond_to?']("to_int")) { i = value.$to_int(); if (i !== nil) { return i; } } return $scope.get('Opal')['$coerce_to!'](value, $scope.get('Integer'), "to_i"); } if (base === undefined) { base = 0; } else { base = $scope.get('Opal').$coerce_to(base, $scope.get('Integer'), "to_int"); if (base === 1 || base < 0 || base > 36) { self.$raise($scope.get('ArgumentError'), "invalid radix " + (base)) } } str = value.toLowerCase(); str = str.replace(/(\d)_(?=\d)/g, '$1'); str = str.replace(/^(\s*[+-]?)(0[bodx]?)/, function (_, head, flag) { switch (flag) { case '0b': if (base === 0 || base === 2) { base = 2; return head; } case '0': case '0o': if (base === 0 || base === 8) { base = 8; return head; } case '0d': if (base === 0 || base === 10) { base = 10; return head; } case '0x': if (base === 0 || base === 16) { base = 16; return head; } } self.$raise($scope.get('ArgumentError'), "invalid value for Integer(): \"" + (value) + "\"") }); base = (base === 0 ? 10 : base); base_digits = '0-' + (base <= 10 ? base - 1 : '9a-' + String.fromCharCode(97 + (base - 11))); if (!(new RegExp('^\\s*[+-]?[' + base_digits + ']+\\s*$')).test(str)) { self.$raise($scope.get('ArgumentError'), "invalid value for Integer(): \"" + (value) + "\"") } i = parseInt(str, base); if (isNaN(i)) { self.$raise($scope.get('ArgumentError'), "invalid value for Integer(): \"" + (value) + "\"") } return i; ; }, TMP_33.$$arity = -2); Opal.defn(self, '$Float', TMP_34 = function $$Float(value) { var self = this; var str; if (value === nil) { self.$raise($scope.get('TypeError'), "can't convert nil into Float") } if (value.$$is_string) { str = value.toString(); str = str.replace(/(\d)_(?=\d)/g, '$1'); //Special case for hex strings only: if (/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(str)) { return self.$Integer(str); } if (!/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(str)) { self.$raise($scope.get('ArgumentError'), "invalid value for Float(): \"" + (value) + "\"") } return parseFloat(str); } return $scope.get('Opal')['$coerce_to!'](value, $scope.get('Float'), "to_f"); }, TMP_34.$$arity = 1); Opal.defn(self, '$Hash', TMP_35 = function $$Hash(arg) { var $a, $b, self = this; if ((($a = ((($b = arg['$nil?']()) !== false && $b !== nil && $b != null) ? $b : arg['$==']([]))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $hash2([], {})}; if ((($a = $scope.get('Hash')['$==='](arg)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return arg}; return $scope.get('Opal')['$coerce_to!'](arg, $scope.get('Hash'), "to_hash"); }, TMP_35.$$arity = 1); Opal.defn(self, '$is_a?', TMP_36 = function(klass) { var self = this; if (!klass.$$is_class && !klass.$$is_module) { self.$raise($scope.get('TypeError'), "class or module required"); } return Opal.is_a(self, klass); ; }, TMP_36.$$arity = 1); Opal.alias(self, 'kind_of?', 'is_a?'); Opal.defn(self, '$lambda', TMP_37 = function $$lambda() { var self = this, $iter = TMP_37.$$p, block = $iter || nil; TMP_37.$$p = null; block.$$is_lambda = true; return block; }, TMP_37.$$arity = 0); Opal.defn(self, '$load', TMP_38 = function $$load(file) { var self = this; file = $scope.get('Opal')['$coerce_to!'](file, $scope.get('String'), "to_str"); return Opal.load(file); }, TMP_38.$$arity = 1); Opal.defn(self, '$loop', TMP_39 = function $$loop() { var self = this, $iter = TMP_39.$$p, $yield = $iter || nil; TMP_39.$$p = null; if (($yield !== nil)) { } else { return self.$enum_for("loop") }; while (true) { Opal.yieldX($yield, []) } ; return self; }, TMP_39.$$arity = 0); Opal.defn(self, '$nil?', TMP_40 = function() { var self = this; return false; }, TMP_40.$$arity = 0); Opal.alias(self, 'object_id', '__id__'); Opal.defn(self, '$printf', TMP_41 = function $$printf($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($b = $rb_gt(args.$length(), 0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$print(($b = self).$format.apply($b, Opal.to_a(args)))}; return nil; }, TMP_41.$$arity = -1); Opal.defn(self, '$proc', TMP_42 = function $$proc() { var self = this, $iter = TMP_42.$$p, block = $iter || nil; TMP_42.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "tried to create Proc object without a block") }; block.$$is_lambda = false; return block; }, TMP_42.$$arity = 0); Opal.defn(self, '$puts', TMP_43 = function $$puts($a_rest) { var $b, self = this, strs; if ($gvars.stdout == null) $gvars.stdout = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } strs = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { strs[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = $gvars.stdout).$puts.apply($b, Opal.to_a(strs)); }, TMP_43.$$arity = -1); Opal.defn(self, '$p', TMP_45 = function $$p($a_rest) { var $b, $c, TMP_44, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } ($b = ($c = args).$each, $b.$$p = (TMP_44 = function(obj){var self = TMP_44.$$s || this; if ($gvars.stdout == null) $gvars.stdout = nil; if (obj == null) obj = nil; return $gvars.stdout.$puts(obj.$inspect())}, TMP_44.$$s = self, TMP_44.$$arity = 1, TMP_44), $b).call($c); if ((($b = $rb_le(args.$length(), 1)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return args['$[]'](0) } else { return args }; }, TMP_45.$$arity = -1); Opal.defn(self, '$print', TMP_46 = function $$print($a_rest) { var $b, self = this, strs; if ($gvars.stdout == null) $gvars.stdout = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } strs = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { strs[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = $gvars.stdout).$print.apply($b, Opal.to_a(strs)); }, TMP_46.$$arity = -1); Opal.defn(self, '$warn', TMP_47 = function $$warn($a_rest) { var $b, $c, self = this, strs; if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; if ($gvars.stderr == null) $gvars.stderr = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } strs = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { strs[$arg_idx - 0] = arguments[$arg_idx]; } if ((($b = ((($c = $gvars.VERBOSE['$nil?']()) !== false && $c !== nil && $c != null) ? $c : strs['$empty?']())) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return nil } else { return ($b = $gvars.stderr).$puts.apply($b, Opal.to_a(strs)) }; }, TMP_47.$$arity = -1); Opal.defn(self, '$raise', TMP_48 = function $$raise(exception, string, _backtrace) { var self = this; if ($gvars["!"] == null) $gvars["!"] = nil; if (string == null) { string = nil; } if (_backtrace == null) { _backtrace = nil; } if (exception == null && $gvars["!"] !== nil) { throw $gvars["!"]; } if (exception == null) { exception = $scope.get('RuntimeError').$new(); } else if (exception.$$is_string) { exception = $scope.get('RuntimeError').$new(exception); } // using respond_to? and not an undefined check to avoid method_missing matching as true else if (exception.$$is_class && exception['$respond_to?']("exception")) { exception = exception.$exception(string); } else if (exception['$kind_of?']($scope.get('Exception'))) { // exception is fine } else { exception = $scope.get('TypeError').$new("exception class/object expected"); } if ($gvars["!"] !== nil) { Opal.exceptions.push($gvars["!"]); } $gvars["!"] = exception; throw exception; ; }, TMP_48.$$arity = -1); Opal.alias(self, 'fail', 'raise'); Opal.defn(self, '$rand', TMP_49 = function $$rand(max) { var self = this; if (max === undefined) { return Math.random(); } else if (max.$$is_range) { var min = max.begin, range = max.end - min; if(!max.exclude) range++; return self.$rand(range) + min; } else { return Math.floor(Math.random() * Math.abs($scope.get('Opal').$coerce_to(max, $scope.get('Integer'), "to_int"))); } }, TMP_49.$$arity = -1); Opal.defn(self, '$respond_to?', TMP_50 = function(name, include_all) { var $a, self = this; if (include_all == null) { include_all = false; } if ((($a = self['$respond_to_missing?'](name, include_all)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return true}; var body = self['$' + name]; if (typeof(body) === "function" && !body.$$stub) { return true; } return false; }, TMP_50.$$arity = -2); Opal.defn(self, '$respond_to_missing?', TMP_51 = function(method_name, include_all) { var self = this; if (include_all == null) { include_all = false; } return false; }, TMP_51.$$arity = -2); Opal.defn(self, '$require', TMP_52 = function $$require(file) { var self = this; file = $scope.get('Opal')['$coerce_to!'](file, $scope.get('String'), "to_str"); return Opal.require(file); }, TMP_52.$$arity = 1); Opal.defn(self, '$require_relative', TMP_53 = function $$require_relative(file) { var self = this; $scope.get('Opal')['$try_convert!'](file, $scope.get('String'), "to_str"); file = $scope.get('File').$expand_path($scope.get('File').$join(Opal.current_file, "..", file)); return Opal.require(file); }, TMP_53.$$arity = 1); Opal.defn(self, '$require_tree', TMP_54 = function $$require_tree(path) { var self = this; path = $scope.get('File').$expand_path(path); if (path['$=='](".")) { path = ""}; for (var name in Opal.modules) { if ((name)['$start_with?'](path)) { Opal.require(name); } } ; return nil; }, TMP_54.$$arity = 1); Opal.alias(self, 'send', '__send__'); Opal.alias(self, 'public_send', '__send__'); Opal.defn(self, '$singleton_class', TMP_55 = function $$singleton_class() { var self = this; return Opal.get_singleton_class(self); }, TMP_55.$$arity = 0); Opal.defn(self, '$sleep', TMP_56 = function $$sleep(seconds) { var self = this; if (seconds == null) { seconds = nil; } if (seconds === nil) { self.$raise($scope.get('TypeError'), "can't convert NilClass into time interval") } if (!seconds.$$is_number) { self.$raise($scope.get('TypeError'), "can't convert " + (seconds.$class()) + " into time interval") } if (seconds < 0) { self.$raise($scope.get('ArgumentError'), "time interval must be positive") } var t = new Date(); while (new Date() - t <= seconds * 1000); return seconds; ; }, TMP_56.$$arity = -1); Opal.alias(self, 'sprintf', 'format'); Opal.alias(self, 'srand', 'rand'); Opal.defn(self, '$String', TMP_57 = function $$String(str) { var $a, self = this; return ((($a = $scope.get('Opal')['$coerce_to?'](str, $scope.get('String'), "to_str")) !== false && $a !== nil && $a != null) ? $a : $scope.get('Opal')['$coerce_to!'](str, $scope.get('String'), "to_s")); }, TMP_57.$$arity = 1); Opal.defn(self, '$tap', TMP_58 = function $$tap() { var self = this, $iter = TMP_58.$$p, block = $iter || nil; TMP_58.$$p = null; Opal.yield1(block, self); return self; }, TMP_58.$$arity = 0); Opal.defn(self, '$to_proc', TMP_59 = function $$to_proc() { var self = this; return self; }, TMP_59.$$arity = 0); Opal.defn(self, '$to_s', TMP_60 = function $$to_s() { var self = this; return "#<" + (self.$class()) + ":0x" + (self.$__id__().$to_s(16)) + ">"; }, TMP_60.$$arity = 0); Opal.defn(self, '$catch', TMP_61 = function(sym) { var self = this, $iter = TMP_61.$$p, $yield = $iter || nil, e = nil; TMP_61.$$p = null; try { return Opal.yieldX($yield, []); } catch ($err) { if (Opal.rescue($err, [$scope.get('UncaughtThrowError')])) {e = $err; try { if (e.$sym()['$=='](sym)) { return e.$arg()}; return self.$raise(); } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_61.$$arity = 1); Opal.defn(self, '$throw', TMP_62 = function($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return self.$raise($scope.get('UncaughtThrowError').$new(args)); }, TMP_62.$$arity = -1); Opal.defn(self, '$open', TMP_63 = function $$open($a_rest) { var $b, $c, self = this, args, $iter = TMP_63.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_63.$$p = null; return ($b = ($c = $scope.get('File')).$open, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_63.$$arity = -1); })($scope.base); return (function($base, $super) { function $Object(){}; var self = $Object = $klass($base, $super, 'Object', $Object); var def = self.$$proto, $scope = self.$$scope; return self.$include($scope.get('Kernel')) })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/error"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module; Opal.add_stubs(['$new', '$clone', '$to_s', '$empty?', '$class', '$attr_reader', '$[]', '$>', '$length', '$inspect']); (function($base, $super) { function $Exception(){}; var self = $Exception = $klass($base, $super, 'Exception', $Exception); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8; def.message = nil; Opal.defs(self, '$new', TMP_1 = function($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } var message = (args.length > 0) ? args[0] : nil; var err = new self.$$alloc(message); if (Error.captureStackTrace) { Error.captureStackTrace(err); } err.name = self.$$name; err.$initialize.apply(err, args); return err; }, TMP_1.$$arity = -1); Opal.defs(self, '$exception', TMP_2 = function $$exception($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = self).$new.apply($b, Opal.to_a(args)); }, TMP_2.$$arity = -1); Opal.defn(self, '$initialize', TMP_3 = function $$initialize($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return self.message = (args.length > 0) ? args[0] : nil; }, TMP_3.$$arity = -1); Opal.defn(self, '$backtrace', TMP_4 = function $$backtrace() { var self = this; var backtrace = self.stack; if (typeof(backtrace) === 'string') { return backtrace.split("\n").slice(0, 15); } else if (backtrace) { return backtrace.slice(0, 15); } return []; }, TMP_4.$$arity = 0); Opal.defn(self, '$exception', TMP_5 = function $$exception(str) { var self = this; if (str == null) { str = nil; } if (str === nil || self === str) { return self; } var cloned = self.$clone(); cloned.message = str; return cloned; }, TMP_5.$$arity = -1); Opal.defn(self, '$message', TMP_6 = function $$message() { var self = this; return self.$to_s(); }, TMP_6.$$arity = 0); Opal.defn(self, '$inspect', TMP_7 = function $$inspect() { var $a, self = this, as_str = nil; as_str = self.$to_s(); if ((($a = as_str['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$class().$to_s() } else { return "#<" + (self.$class().$to_s()) + ": " + (self.$to_s()) + ">" }; }, TMP_7.$$arity = 0); return (Opal.defn(self, '$to_s', TMP_8 = function $$to_s() { var $a, $b, self = this; return ((($a = (($b = self.message, $b !== false && $b !== nil && $b != null ?self.message.$to_s() : $b))) !== false && $a !== nil && $a != null) ? $a : self.$class().$to_s()); }, TMP_8.$$arity = 0), nil) && 'to_s'; })($scope.base, Error); (function($base, $super) { function $ScriptError(){}; var self = $ScriptError = $klass($base, $super, 'ScriptError', $ScriptError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('Exception')); (function($base, $super) { function $SyntaxError(){}; var self = $SyntaxError = $klass($base, $super, 'SyntaxError', $SyntaxError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('ScriptError')); (function($base, $super) { function $LoadError(){}; var self = $LoadError = $klass($base, $super, 'LoadError', $LoadError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('ScriptError')); (function($base, $super) { function $NotImplementedError(){}; var self = $NotImplementedError = $klass($base, $super, 'NotImplementedError', $NotImplementedError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('ScriptError')); (function($base, $super) { function $SystemExit(){}; var self = $SystemExit = $klass($base, $super, 'SystemExit', $SystemExit); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('Exception')); (function($base, $super) { function $NoMemoryError(){}; var self = $NoMemoryError = $klass($base, $super, 'NoMemoryError', $NoMemoryError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('Exception')); (function($base, $super) { function $SignalException(){}; var self = $SignalException = $klass($base, $super, 'SignalException', $SignalException); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('Exception')); (function($base, $super) { function $Interrupt(){}; var self = $Interrupt = $klass($base, $super, 'Interrupt', $Interrupt); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('Exception')); (function($base, $super) { function $SecurityError(){}; var self = $SecurityError = $klass($base, $super, 'SecurityError', $SecurityError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('Exception')); (function($base, $super) { function $StandardError(){}; var self = $StandardError = $klass($base, $super, 'StandardError', $StandardError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('Exception')); (function($base, $super) { function $ZeroDivisionError(){}; var self = $ZeroDivisionError = $klass($base, $super, 'ZeroDivisionError', $ZeroDivisionError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); (function($base, $super) { function $NameError(){}; var self = $NameError = $klass($base, $super, 'NameError', $NameError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); (function($base, $super) { function $NoMethodError(){}; var self = $NoMethodError = $klass($base, $super, 'NoMethodError', $NoMethodError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('NameError')); (function($base, $super) { function $RuntimeError(){}; var self = $RuntimeError = $klass($base, $super, 'RuntimeError', $RuntimeError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); (function($base, $super) { function $LocalJumpError(){}; var self = $LocalJumpError = $klass($base, $super, 'LocalJumpError', $LocalJumpError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); (function($base, $super) { function $TypeError(){}; var self = $TypeError = $klass($base, $super, 'TypeError', $TypeError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); (function($base, $super) { function $ArgumentError(){}; var self = $ArgumentError = $klass($base, $super, 'ArgumentError', $ArgumentError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); (function($base, $super) { function $IndexError(){}; var self = $IndexError = $klass($base, $super, 'IndexError', $IndexError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); (function($base, $super) { function $StopIteration(){}; var self = $StopIteration = $klass($base, $super, 'StopIteration', $StopIteration); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('IndexError')); (function($base, $super) { function $KeyError(){}; var self = $KeyError = $klass($base, $super, 'KeyError', $KeyError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('IndexError')); (function($base, $super) { function $RangeError(){}; var self = $RangeError = $klass($base, $super, 'RangeError', $RangeError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); (function($base, $super) { function $FloatDomainError(){}; var self = $FloatDomainError = $klass($base, $super, 'FloatDomainError', $FloatDomainError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('RangeError')); (function($base, $super) { function $IOError(){}; var self = $IOError = $klass($base, $super, 'IOError', $IOError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); (function($base, $super) { function $SystemCallError(){}; var self = $SystemCallError = $klass($base, $super, 'SystemCallError', $SystemCallError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); (function($base) { var $Errno, self = $Errno = $module($base, 'Errno'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $EINVAL(){}; var self = $EINVAL = $klass($base, $super, 'EINVAL', $EINVAL); var def = self.$$proto, $scope = self.$$scope, TMP_9; return (Opal.defs(self, '$new', TMP_9 = function() { var $a, $b, self = this, $iter = TMP_9.$$p, $yield = $iter || nil; TMP_9.$$p = null; return ($a = ($b = self, Opal.find_super_dispatcher(self, 'new', TMP_9, false, $EINVAL)), $a.$$p = null, $a).call($b, "Invalid argument"); }, TMP_9.$$arity = 0), nil) && 'new' })($scope.base, $scope.get('SystemCallError')) })($scope.base); (function($base, $super) { function $UncaughtThrowError(){}; var self = $UncaughtThrowError = $klass($base, $super, 'UncaughtThrowError', $UncaughtThrowError); var def = self.$$proto, $scope = self.$$scope, TMP_10; def.sym = nil; self.$attr_reader("sym", "arg"); return (Opal.defn(self, '$initialize', TMP_10 = function $$initialize(args) { var $a, $b, self = this, $iter = TMP_10.$$p, $yield = $iter || nil; TMP_10.$$p = null; self.sym = args['$[]'](0); if ((($a = $rb_gt(args.$length(), 1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.arg = args['$[]'](1)}; return ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_10, false)), $a.$$p = null, $a).call($b, "uncaught throw " + (self.sym.$inspect())); }, TMP_10.$$arity = 1), nil) && 'initialize'; })($scope.base, $scope.get('ArgumentError')); (function($base, $super) { function $NameError(){}; var self = $NameError = $klass($base, $super, 'NameError', $NameError); var def = self.$$proto, $scope = self.$$scope, TMP_11; self.$attr_reader("name"); return (Opal.defn(self, '$initialize', TMP_11 = function $$initialize(message, name) { var $a, $b, self = this, $iter = TMP_11.$$p, $yield = $iter || nil; if (name == null) { name = nil; } TMP_11.$$p = null; ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_11, false)), $a.$$p = null, $a).call($b, message); return self.name = name; }, TMP_11.$$arity = -2), nil) && 'initialize'; })($scope.base, null); return (function($base, $super) { function $NoMethodError(){}; var self = $NoMethodError = $klass($base, $super, 'NoMethodError', $NoMethodError); var def = self.$$proto, $scope = self.$$scope, TMP_12; self.$attr_reader("args"); return (Opal.defn(self, '$initialize', TMP_12 = function $$initialize(message, name, args) { var $a, $b, self = this, $iter = TMP_12.$$p, $yield = $iter || nil; if (name == null) { name = nil; } if (args == null) { args = []; } TMP_12.$$p = null; ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_12, false)), $a.$$p = null, $a).call($b, message, name); return self.args = args; }, TMP_12.$$arity = -2), nil) && 'initialize'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/constants"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.cdecl($scope, 'RUBY_PLATFORM', "opal"); Opal.cdecl($scope, 'RUBY_ENGINE', "opal"); Opal.cdecl($scope, 'RUBY_VERSION', "2.2.6"); Opal.cdecl($scope, 'RUBY_ENGINE_VERSION', "0.10.4"); Opal.cdecl($scope, 'RUBY_RELEASE_DATE', "2017-05-06"); Opal.cdecl($scope, 'RUBY_PATCHLEVEL', 0); Opal.cdecl($scope, 'RUBY_REVISION', 0); Opal.cdecl($scope, 'RUBY_COPYRIGHT', "opal - Copyright (C) 2013-2015 Adam Beynon"); return Opal.cdecl($scope, 'RUBY_DESCRIPTION', "opal " + ($scope.get('RUBY_ENGINE_VERSION')) + " (" + ($scope.get('RUBY_RELEASE_DATE')) + " revision " + ($scope.get('RUBY_REVISION')) + ")"); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/base"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); self.$require("corelib/runtime"); self.$require("corelib/helpers"); self.$require("corelib/module"); self.$require("corelib/class"); self.$require("corelib/basic_object"); self.$require("corelib/kernel"); self.$require("corelib/error"); return self.$require("corelib/constants"); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/nil"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$raise', '$class', '$new', '$>', '$length', '$Rational']); (function($base, $super) { function $NilClass(){}; var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18; def.$$meta = self; Opal.defn(self, '$!', TMP_1 = function() { var self = this; return true; }, TMP_1.$$arity = 0); Opal.defn(self, '$&', TMP_2 = function(other) { var self = this; return false; }, TMP_2.$$arity = 1); Opal.defn(self, '$|', TMP_3 = function(other) { var self = this; return other !== false && other !== nil; }, TMP_3.$$arity = 1); Opal.defn(self, '$^', TMP_4 = function(other) { var self = this; return other !== false && other !== nil; }, TMP_4.$$arity = 1); Opal.defn(self, '$==', TMP_5 = function(other) { var self = this; return other === nil; }, TMP_5.$$arity = 1); Opal.defn(self, '$dup', TMP_6 = function $$dup() { var self = this; return self.$raise($scope.get('TypeError'), "can't dup " + (self.$class())); }, TMP_6.$$arity = 0); Opal.defn(self, '$clone', TMP_7 = function $$clone() { var self = this; return self.$raise($scope.get('TypeError'), "can't clone " + (self.$class())); }, TMP_7.$$arity = 0); Opal.defn(self, '$inspect', TMP_8 = function $$inspect() { var self = this; return "nil"; }, TMP_8.$$arity = 0); Opal.defn(self, '$nil?', TMP_9 = function() { var self = this; return true; }, TMP_9.$$arity = 0); Opal.defn(self, '$singleton_class', TMP_10 = function $$singleton_class() { var self = this; return $scope.get('NilClass'); }, TMP_10.$$arity = 0); Opal.defn(self, '$to_a', TMP_11 = function $$to_a() { var self = this; return []; }, TMP_11.$$arity = 0); Opal.defn(self, '$to_h', TMP_12 = function $$to_h() { var self = this; return Opal.hash(); }, TMP_12.$$arity = 0); Opal.defn(self, '$to_i', TMP_13 = function $$to_i() { var self = this; return 0; }, TMP_13.$$arity = 0); Opal.alias(self, 'to_f', 'to_i'); Opal.defn(self, '$to_s', TMP_14 = function $$to_s() { var self = this; return ""; }, TMP_14.$$arity = 0); Opal.defn(self, '$to_c', TMP_15 = function $$to_c() { var self = this; return $scope.get('Complex').$new(0, 0); }, TMP_15.$$arity = 0); Opal.defn(self, '$rationalize', TMP_16 = function $$rationalize($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($b = $rb_gt(args.$length(), 1)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$raise($scope.get('ArgumentError'))}; return self.$Rational(0, 1); }, TMP_16.$$arity = -1); Opal.defn(self, '$to_r', TMP_17 = function $$to_r() { var self = this; return self.$Rational(0, 1); }, TMP_17.$$arity = 0); return (Opal.defn(self, '$instance_variables', TMP_18 = function $$instance_variables() { var self = this; return []; }, TMP_18.$$arity = 0), nil) && 'instance_variables'; })($scope.base, null); return Opal.cdecl($scope, 'NIL', nil); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/boolean"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$raise', '$class']); (function($base, $super) { function $Boolean(){}; var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10; def.$$is_boolean = true; def.$$meta = self; Opal.defn(self, '$__id__', TMP_1 = function $$__id__() { var self = this; return self.valueOf() ? 2 : 0; }, TMP_1.$$arity = 0); Opal.alias(self, 'object_id', '__id__'); Opal.defn(self, '$!', TMP_2 = function() { var self = this; return self != true; }, TMP_2.$$arity = 0); Opal.defn(self, '$&', TMP_3 = function(other) { var self = this; return (self == true) ? (other !== false && other !== nil) : false; }, TMP_3.$$arity = 1); Opal.defn(self, '$|', TMP_4 = function(other) { var self = this; return (self == true) ? true : (other !== false && other !== nil); }, TMP_4.$$arity = 1); Opal.defn(self, '$^', TMP_5 = function(other) { var self = this; return (self == true) ? (other === false || other === nil) : (other !== false && other !== nil); }, TMP_5.$$arity = 1); Opal.defn(self, '$==', TMP_6 = function(other) { var self = this; return (self == true) === other.valueOf(); }, TMP_6.$$arity = 1); Opal.alias(self, 'equal?', '=='); Opal.alias(self, 'eql?', '=='); Opal.defn(self, '$singleton_class', TMP_7 = function $$singleton_class() { var self = this; return $scope.get('Boolean'); }, TMP_7.$$arity = 0); Opal.defn(self, '$to_s', TMP_8 = function $$to_s() { var self = this; return (self == true) ? 'true' : 'false'; }, TMP_8.$$arity = 0); Opal.defn(self, '$dup', TMP_9 = function $$dup() { var self = this; return self.$raise($scope.get('TypeError'), "can't dup " + (self.$class())); }, TMP_9.$$arity = 0); return (Opal.defn(self, '$clone', TMP_10 = function $$clone() { var self = this; return self.$raise($scope.get('TypeError'), "can't clone " + (self.$class())); }, TMP_10.$$arity = 0), nil) && 'clone'; })($scope.base, Boolean); Opal.cdecl($scope, 'TrueClass', $scope.get('Boolean')); Opal.cdecl($scope, 'FalseClass', $scope.get('Boolean')); Opal.cdecl($scope, 'TRUE', true); return Opal.cdecl($scope, 'FALSE', false); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/comparable"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$===', '$>', '$<', '$equal?', '$<=>', '$normalize', '$raise', '$class']); return (function($base) { var $Comparable, self = $Comparable = $module($base, 'Comparable'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7; Opal.defs(self, '$normalize', TMP_1 = function $$normalize(what) { var $a, self = this; if ((($a = $scope.get('Integer')['$==='](what)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return what}; if ((($a = $rb_gt(what, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return 1}; if ((($a = $rb_lt(what, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return -1}; return 0; }, TMP_1.$$arity = 1); Opal.defn(self, '$==', TMP_2 = function(other) { var $a, self = this, cmp = nil; try { if ((($a = self['$equal?'](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return true}; if (self["$<=>"] == Opal.Kernel["$<=>"]) { return false; } // check for infinite recursion if (self.$$comparable) { delete self.$$comparable; return false; } if ((($a = cmp = (self['$<=>'](other))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return false }; return $scope.get('Comparable').$normalize(cmp) == 0; } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { try { return false } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_2.$$arity = 1); Opal.defn(self, '$>', TMP_3 = function(other) { var $a, self = this, cmp = nil; if ((($a = cmp = (self['$<=>'](other))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError'), "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") }; return $scope.get('Comparable').$normalize(cmp) > 0; }, TMP_3.$$arity = 1); Opal.defn(self, '$>=', TMP_4 = function(other) { var $a, self = this, cmp = nil; if ((($a = cmp = (self['$<=>'](other))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError'), "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") }; return $scope.get('Comparable').$normalize(cmp) >= 0; }, TMP_4.$$arity = 1); Opal.defn(self, '$<', TMP_5 = function(other) { var $a, self = this, cmp = nil; if ((($a = cmp = (self['$<=>'](other))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError'), "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") }; return $scope.get('Comparable').$normalize(cmp) < 0; }, TMP_5.$$arity = 1); Opal.defn(self, '$<=', TMP_6 = function(other) { var $a, self = this, cmp = nil; if ((($a = cmp = (self['$<=>'](other))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError'), "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") }; return $scope.get('Comparable').$normalize(cmp) <= 0; }, TMP_6.$$arity = 1); Opal.defn(self, '$between?', TMP_7 = function(min, max) { var self = this; if ($rb_lt(self, min)) { return false}; if ($rb_gt(self, max)) { return false}; return true; }, TMP_7.$$arity = 2); })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/regexp"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $gvars = Opal.gvars; Opal.add_stubs(['$nil?', '$[]', '$raise', '$escape', '$options', '$to_str', '$new', '$join', '$coerce_to!', '$!', '$match', '$coerce_to?', '$begin', '$coerce_to', '$call', '$=~', '$attr_reader', '$===', '$inspect', '$to_a']); (function($base, $super) { function $RegexpError(){}; var self = $RegexpError = $klass($base, $super, 'RegexpError', $RegexpError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); (function($base, $super) { function $Regexp(){}; var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); var def = self.$$proto, $scope = self.$$scope, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15; Opal.cdecl($scope, 'IGNORECASE', 1); Opal.cdecl($scope, 'MULTILINE', 4); def.$$is_regexp = true; (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5; Opal.defn(self, '$allocate', TMP_1 = function $$allocate() { var $a, $b, self = this, $iter = TMP_1.$$p, $yield = $iter || nil, allocated = nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_1.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } allocated = ($a = ($b = self, Opal.find_super_dispatcher(self, 'allocate', TMP_1, false)), $a.$$p = $iter, $a).apply($b, $zuper); allocated.uninitialized = true; return allocated; }, TMP_1.$$arity = 0); Opal.defn(self, '$escape', TMP_2 = function $$escape(string) { var self = this; return string.replace(/([-[\]\/{}()*+?.^$\\| ])/g, '\\$1') .replace(/[\n]/g, '\\n') .replace(/[\r]/g, '\\r') .replace(/[\f]/g, '\\f') .replace(/[\t]/g, '\\t'); }, TMP_2.$$arity = 1); Opal.defn(self, '$last_match', TMP_3 = function $$last_match(n) { var $a, self = this; if ($gvars["~"] == null) $gvars["~"] = nil; if (n == null) { n = nil; } if ((($a = n['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $gvars["~"] } else { return $gvars["~"]['$[]'](n) }; }, TMP_3.$$arity = -1); Opal.alias(self, 'quote', 'escape'); Opal.defn(self, '$union', TMP_4 = function $$union($a_rest) { var self = this, parts; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } parts = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { parts[$arg_idx - 0] = arguments[$arg_idx]; } var is_first_part_array, quoted_validated, part, options, each_part_options; if (parts.length == 0) { return /(?!)/; } // cover the 2 arrays passed as arguments case is_first_part_array = parts[0].$$is_array; if (parts.length > 1 && is_first_part_array) { self.$raise($scope.get('TypeError'), "no implicit conversion of Array into String") } // deal with splat issues (related to https://github.com/opal/opal/issues/858) if (is_first_part_array) { parts = parts[0]; } options = undefined; quoted_validated = []; for (var i=0; i < parts.length; i++) { part = parts[i]; if (part.$$is_string) { quoted_validated.push(self.$escape(part)); } else if (part.$$is_regexp) { each_part_options = (part).$options(); if (options != undefined && options != each_part_options) { self.$raise($scope.get('TypeError'), "All expressions must use the same options") } options = each_part_options; quoted_validated.push('('+part.source+')'); } else { quoted_validated.push(self.$escape((part).$to_str())); } } return self.$new((quoted_validated).$join("|"), options); }, TMP_4.$$arity = -1); return (Opal.defn(self, '$new', TMP_5 = function(regexp, options) { var self = this; if (regexp.$$is_regexp) { return new RegExp(regexp); } regexp = $scope.get('Opal')['$coerce_to!'](regexp, $scope.get('String'), "to_str"); if (regexp.charAt(regexp.length - 1) === '\\' && regexp.charAt(regexp.length - 2) !== '\\') { self.$raise($scope.get('RegexpError'), "too short escape sequence: /" + (regexp) + "/") } if (options === undefined || options['$!']()) { return new RegExp(regexp); } if (options.$$is_number) { var temp = ''; if ($scope.get('IGNORECASE') & options) { temp += 'i'; } if ($scope.get('MULTILINE') & options) { temp += 'm'; } options = temp; } else { options = 'i'; } return new RegExp(regexp, options); ; }, TMP_5.$$arity = -2), nil) && 'new'; })(Opal.get_singleton_class(self)); Opal.defn(self, '$==', TMP_6 = function(other) { var self = this; return other.constructor == RegExp && self.toString() === other.toString(); }, TMP_6.$$arity = 1); Opal.defn(self, '$===', TMP_7 = function(string) { var self = this; return self.$match($scope.get('Opal')['$coerce_to?'](string, $scope.get('String'), "to_str")) !== nil; }, TMP_7.$$arity = 1); Opal.defn(self, '$=~', TMP_8 = function(string) { var $a, self = this; if ($gvars["~"] == null) $gvars["~"] = nil; return ($a = self.$match(string), $a !== false && $a !== nil && $a != null ?$gvars["~"].$begin(0) : $a); }, TMP_8.$$arity = 1); Opal.alias(self, 'eql?', '=='); Opal.defn(self, '$inspect', TMP_9 = function $$inspect() { var self = this; return self.toString(); }, TMP_9.$$arity = 0); Opal.defn(self, '$match', TMP_10 = function $$match(string, pos) { var self = this, $iter = TMP_10.$$p, block = $iter || nil; if ($gvars["~"] == null) $gvars["~"] = nil; TMP_10.$$p = null; if (self.uninitialized) { self.$raise($scope.get('TypeError'), "uninitialized Regexp") } if (pos === undefined) { pos = 0; } else { pos = $scope.get('Opal').$coerce_to(pos, $scope.get('Integer'), "to_int"); } if (string === nil) { return $gvars["~"] = nil; } string = $scope.get('Opal').$coerce_to(string, $scope.get('String'), "to_str"); if (pos < 0) { pos += string.length; if (pos < 0) { return $gvars["~"] = nil; } } var source = self.source; var flags = 'g'; // m flag + a . in Ruby will match white space, but in JS, it only matches beginning/ending of lines, so we get the equivalent here if (self.multiline) { source = source.replace('.', "[\\s\\S]"); flags += 'm'; } // global RegExp maintains state, so not using self/this var md, re = new RegExp(source, flags + (self.ignoreCase ? 'i' : '')); while (true) { md = re.exec(string); if (md === null) { return $gvars["~"] = nil; } if (md.index >= pos) { $gvars["~"] = $scope.get('MatchData').$new(re, md) return block === nil ? $gvars["~"] : block.$call($gvars["~"]); } re.lastIndex = md.index + 1; } ; }, TMP_10.$$arity = -2); Opal.defn(self, '$~', TMP_11 = function() { var self = this; if ($gvars._ == null) $gvars._ = nil; return self['$=~']($gvars._); }, TMP_11.$$arity = 0); Opal.defn(self, '$source', TMP_12 = function $$source() { var self = this; return self.source; }, TMP_12.$$arity = 0); Opal.defn(self, '$options', TMP_13 = function $$options() { var self = this; if (self.uninitialized) { self.$raise($scope.get('TypeError'), "uninitialized Regexp") } var result = 0; // should be supported in IE6 according to https://msdn.microsoft.com/en-us/library/7f5z26w4(v=vs.94).aspx if (self.multiline) { result |= $scope.get('MULTILINE'); } if (self.ignoreCase) { result |= $scope.get('IGNORECASE'); } return result; ; }, TMP_13.$$arity = 0); Opal.defn(self, '$casefold?', TMP_14 = function() { var self = this; return self.ignoreCase; }, TMP_14.$$arity = 0); Opal.alias(self, 'to_s', 'source'); return (Opal.defs(self, '$_load', TMP_15 = function $$_load(args) { var $a, self = this; return ($a = self).$new.apply($a, Opal.to_a(args)); }, TMP_15.$$arity = 1), nil) && '_load'; })($scope.base, RegExp); return (function($base, $super) { function $MatchData(){}; var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); var def = self.$$proto, $scope = self.$$scope, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27; def.matches = nil; self.$attr_reader("post_match", "pre_match", "regexp", "string"); Opal.defn(self, '$initialize', TMP_16 = function $$initialize(regexp, match_groups) { var self = this; $gvars["~"] = self; self.regexp = regexp; self.begin = match_groups.index; self.string = match_groups.input; self.pre_match = match_groups.input.slice(0, match_groups.index); self.post_match = match_groups.input.slice(match_groups.index + match_groups[0].length); self.matches = []; for (var i = 0, length = match_groups.length; i < length; i++) { var group = match_groups[i]; if (group == null) { self.matches.push(nil); } else { self.matches.push(group); } } }, TMP_16.$$arity = 2); Opal.defn(self, '$[]', TMP_17 = function($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = self.matches)['$[]'].apply($b, Opal.to_a(args)); }, TMP_17.$$arity = -1); Opal.defn(self, '$offset', TMP_18 = function $$offset(n) { var self = this; if (n !== 0) { self.$raise($scope.get('ArgumentError'), "MatchData#offset only supports 0th element") } return [self.begin, self.begin + self.matches[n].length]; ; }, TMP_18.$$arity = 1); Opal.defn(self, '$==', TMP_19 = function(other) { var $a, $b, $c, $d, self = this; if ((($a = $scope.get('MatchData')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return false }; return ($a = ($b = ($c = ($d = self.string == other.string, $d !== false && $d !== nil && $d != null ?self.regexp.toString() == other.regexp.toString() : $d), $c !== false && $c !== nil && $c != null ?self.pre_match == other.pre_match : $c), $b !== false && $b !== nil && $b != null ?self.post_match == other.post_match : $b), $a !== false && $a !== nil && $a != null ?self.begin == other.begin : $a); }, TMP_19.$$arity = 1); Opal.alias(self, 'eql?', '=='); Opal.defn(self, '$begin', TMP_20 = function $$begin(n) { var self = this; if (n !== 0) { self.$raise($scope.get('ArgumentError'), "MatchData#begin only supports 0th element") } return self.begin; ; }, TMP_20.$$arity = 1); Opal.defn(self, '$end', TMP_21 = function $$end(n) { var self = this; if (n !== 0) { self.$raise($scope.get('ArgumentError'), "MatchData#end only supports 0th element") } return self.begin + self.matches[n].length; ; }, TMP_21.$$arity = 1); Opal.defn(self, '$captures', TMP_22 = function $$captures() { var self = this; return self.matches.slice(1); }, TMP_22.$$arity = 0); Opal.defn(self, '$inspect', TMP_23 = function $$inspect() { var self = this; var str = "#"; ; }, TMP_23.$$arity = 0); Opal.defn(self, '$length', TMP_24 = function $$length() { var self = this; return self.matches.length; }, TMP_24.$$arity = 0); Opal.alias(self, 'size', 'length'); Opal.defn(self, '$to_a', TMP_25 = function $$to_a() { var self = this; return self.matches; }, TMP_25.$$arity = 0); Opal.defn(self, '$to_s', TMP_26 = function $$to_s() { var self = this; return self.matches[0]; }, TMP_26.$$arity = 0); return (Opal.defn(self, '$values_at', TMP_27 = function $$values_at($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } var i, a, index, values = []; for (i = 0; i < args.length; i++) { if (args[i].$$is_range) { a = (args[i]).$to_a(); a.unshift(i, 1); Array.prototype.splice.apply(args, a); } index = $scope.get('Opal')['$coerce_to!'](args[i], $scope.get('Integer'), "to_int"); if (index < 0) { index += self.matches.length; if (index < 0) { values.push(nil); continue; } } values.push(self.matches[index]); } return values; }, TMP_27.$$arity = -1), nil) && 'values_at'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/string"] = function(Opal) { function $rb_divide(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $gvars = Opal.gvars; Opal.add_stubs(['$require', '$include', '$coerce_to?', '$coerce_to', '$raise', '$===', '$format', '$to_s', '$respond_to?', '$to_str', '$<=>', '$==', '$=~', '$new', '$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', '$class', '$match', '$captures', '$proc', '$shift', '$__send__', '$succ', '$escape']); self.$require("corelib/comparable"); self.$require("corelib/regexp"); (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_40, TMP_41, TMP_42, TMP_43, TMP_44, TMP_45, TMP_46, TMP_47, TMP_48, TMP_49, TMP_50, TMP_51, TMP_52, TMP_53, TMP_54, TMP_55, TMP_56, TMP_57, TMP_58, TMP_59, TMP_61, TMP_62, TMP_63, TMP_64, TMP_65, TMP_66, TMP_67, TMP_68; def.length = nil; self.$include($scope.get('Comparable')); def.$$is_string = true; Opal.defn(self, '$__id__', TMP_1 = function $$__id__() { var self = this; return self.toString(); }, TMP_1.$$arity = 0); Opal.alias(self, 'object_id', '__id__'); Opal.defs(self, '$try_convert', TMP_2 = function $$try_convert(what) { var self = this; return $scope.get('Opal')['$coerce_to?'](what, $scope.get('String'), "to_str"); }, TMP_2.$$arity = 1); Opal.defs(self, '$new', TMP_3 = function(str) { var self = this; if (str == null) { str = ""; } str = $scope.get('Opal').$coerce_to(str, $scope.get('String'), "to_str"); return new String(str); }, TMP_3.$$arity = -1); Opal.defn(self, '$initialize', TMP_4 = function $$initialize(str) { var self = this; if (str === undefined) { return self; } return self.$raise($scope.get('NotImplementedError'), "Mutable strings are not supported in Opal."); }, TMP_4.$$arity = -1); Opal.defn(self, '$%', TMP_5 = function(data) { var $a, self = this; if ((($a = $scope.get('Array')['$==='](data)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = self).$format.apply($a, [self].concat(Opal.to_a(data))) } else { return self.$format(self, data) }; }, TMP_5.$$arity = 1); Opal.defn(self, '$*', TMP_6 = function(count) { var self = this; count = $scope.get('Opal').$coerce_to(count, $scope.get('Integer'), "to_int"); if (count < 0) { self.$raise($scope.get('ArgumentError'), "negative argument") } if (count === 0) { return ''; } var result = '', string = self.toString(); // All credit for the bit-twiddling magic code below goes to Mozilla // polyfill implementation of String.prototype.repeat() posted here: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat if (string.length * count >= 1 << 28) { self.$raise($scope.get('RangeError'), "multiply count must not overflow maximum string size") } for (;;) { if ((count & 1) === 1) { result += string; } count >>>= 1; if (count === 0) { break; } string += string; } return result; ; }, TMP_6.$$arity = 1); Opal.defn(self, '$+', TMP_7 = function(other) { var self = this; other = $scope.get('Opal').$coerce_to(other, $scope.get('String'), "to_str"); return self + other.$to_s(); }, TMP_7.$$arity = 1); Opal.defn(self, '$<=>', TMP_8 = function(other) { var $a, self = this; if ((($a = other['$respond_to?']("to_str")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { other = other.$to_str().$to_s(); return self > other ? 1 : (self < other ? -1 : 0); } else { var cmp = other['$<=>'](self); if (cmp === nil) { return nil; } else { return cmp > 0 ? -1 : (cmp < 0 ? 1 : 0); } ; }; }, TMP_8.$$arity = 1); Opal.defn(self, '$==', TMP_9 = function(other) { var self = this; if (other.$$is_string) { return self.toString() === other.toString(); } if ($scope.get('Opal')['$respond_to?'](other, "to_str")) { return other['$=='](self); } return false; ; }, TMP_9.$$arity = 1); Opal.alias(self, 'eql?', '=='); Opal.alias(self, '===', '=='); Opal.defn(self, '$=~', TMP_10 = function(other) { var self = this; if (other.$$is_string) { self.$raise($scope.get('TypeError'), "type mismatch: String given"); } return other['$=~'](self); ; }, TMP_10.$$arity = 1); Opal.defn(self, '$[]', TMP_11 = function(index, length) { var self = this; var size = self.length, exclude; if (index.$$is_range) { exclude = index.exclude; length = $scope.get('Opal').$coerce_to(index.end, $scope.get('Integer'), "to_int"); index = $scope.get('Opal').$coerce_to(index.begin, $scope.get('Integer'), "to_int"); if (Math.abs(index) > size) { return nil; } if (index < 0) { index += size; } if (length < 0) { length += size; } if (!exclude) { length += 1; } length = length - index; if (length < 0) { length = 0; } return self.substr(index, length); } if (index.$$is_string) { if (length != null) { self.$raise($scope.get('TypeError')) } return self.indexOf(index) !== -1 ? index : nil; } if (index.$$is_regexp) { var match = self.match(index); if (match === null) { $gvars["~"] = nil return nil; } $gvars["~"] = $scope.get('MatchData').$new(index, match) if (length == null) { return match[0]; } length = $scope.get('Opal').$coerce_to(length, $scope.get('Integer'), "to_int"); if (length < 0 && -length < match.length) { return match[length += match.length]; } if (length >= 0 && length < match.length) { return match[length]; } return nil; } index = $scope.get('Opal').$coerce_to(index, $scope.get('Integer'), "to_int"); if (index < 0) { index += size; } if (length == null) { if (index >= size || index < 0) { return nil; } return self.substr(index, 1); } length = $scope.get('Opal').$coerce_to(length, $scope.get('Integer'), "to_int"); if (length < 0) { return nil; } if (index > size || index < 0) { return nil; } return self.substr(index, length); }, TMP_11.$$arity = -2); Opal.alias(self, 'byteslice', '[]'); Opal.defn(self, '$capitalize', TMP_12 = function $$capitalize() { var self = this; return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase(); }, TMP_12.$$arity = 0); Opal.defn(self, '$casecmp', TMP_13 = function $$casecmp(other) { var self = this; other = $scope.get('Opal').$coerce_to(other, $scope.get('String'), "to_str").$to_s(); var ascii_only = /^[\x00-\x7F]*$/; if (ascii_only.test(self) && ascii_only.test(other)) { self = self.toLowerCase(); other = other.toLowerCase(); } return self['$<=>'](other); }, TMP_13.$$arity = 1); Opal.defn(self, '$center', TMP_14 = function $$center(width, padstr) { var $a, self = this; if (padstr == null) { padstr = " "; } width = $scope.get('Opal').$coerce_to(width, $scope.get('Integer'), "to_int"); padstr = $scope.get('Opal').$coerce_to(padstr, $scope.get('String'), "to_str").$to_s(); if ((($a = padstr['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "zero width padding")}; if ((($a = width <= self.length) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self}; var ljustified = self.$ljust($rb_divide(($rb_plus(width, self.length)), 2).$ceil(), padstr), rjustified = self.$rjust($rb_divide(($rb_plus(width, self.length)), 2).$floor(), padstr); return rjustified + ljustified.slice(self.length); ; }, TMP_14.$$arity = -2); Opal.defn(self, '$chars', TMP_15 = function $$chars() { var $a, $b, self = this, $iter = TMP_15.$$p, block = $iter || nil; TMP_15.$$p = null; if (block !== false && block !== nil && block != null) { } else { return self.$each_char().$to_a() }; return ($a = ($b = self).$each_char, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_15.$$arity = 0); Opal.defn(self, '$chomp', TMP_16 = function $$chomp(separator) { var $a, self = this; if ($gvars["/"] == null) $gvars["/"] = nil; if (separator == null) { separator = $gvars["/"]; } if ((($a = separator === nil || self.length === 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self}; separator = $scope.get('Opal')['$coerce_to!'](separator, $scope.get('String'), "to_str").$to_s(); if (separator === "\n") { return self.replace(/\r?\n?$/, ''); } else if (separator === "") { return self.replace(/(\r?\n)+$/, ''); } else if (self.length > separator.length) { var tail = self.substr(self.length - separator.length, separator.length); if (tail === separator) { return self.substr(0, self.length - separator.length); } } return self; }, TMP_16.$$arity = -1); Opal.defn(self, '$chop', TMP_17 = function $$chop() { var self = this; var length = self.length; if (length <= 1) { return ""; } if (self.charAt(length - 1) === "\n" && self.charAt(length - 2) === "\r") { return self.substr(0, length - 2); } else { return self.substr(0, length - 1); } }, TMP_17.$$arity = 0); Opal.defn(self, '$chr', TMP_18 = function $$chr() { var self = this; return self.charAt(0); }, TMP_18.$$arity = 0); Opal.defn(self, '$clone', TMP_19 = function $$clone() { var self = this, copy = nil; copy = self.slice(); copy.$copy_singleton_methods(self); copy.$initialize_clone(self); return copy; }, TMP_19.$$arity = 0); Opal.defn(self, '$dup', TMP_20 = function $$dup() { var self = this, copy = nil; copy = self.slice(); copy.$initialize_dup(self); return copy; }, TMP_20.$$arity = 0); Opal.defn(self, '$count', TMP_21 = function $$count($a_rest) { var self = this, sets; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } sets = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { sets[$arg_idx - 0] = arguments[$arg_idx]; } if (sets.length === 0) { self.$raise($scope.get('ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)") } var char_class = char_class_from_char_sets(sets); if (char_class === null) { return 0; } return self.length - self.replace(new RegExp(char_class, 'g'), '').length; ; }, TMP_21.$$arity = -1); Opal.defn(self, '$delete', TMP_22 = function($a_rest) { var self = this, sets; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } sets = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { sets[$arg_idx - 0] = arguments[$arg_idx]; } if (sets.length === 0) { self.$raise($scope.get('ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)") } var char_class = char_class_from_char_sets(sets); if (char_class === null) { return self; } return self.replace(new RegExp(char_class, 'g'), ''); ; }, TMP_22.$$arity = -1); Opal.defn(self, '$downcase', TMP_23 = function $$downcase() { var self = this; return self.toLowerCase(); }, TMP_23.$$arity = 0); Opal.defn(self, '$each_char', TMP_24 = function $$each_char() { var $a, $b, TMP_25, self = this, $iter = TMP_24.$$p, block = $iter || nil; TMP_24.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_25 = function(){var self = TMP_25.$$s || this; return self.$size()}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25), $a).call($b, "each_char") }; for (var i = 0, length = self.length; i < length; i++) { Opal.yield1(block, self.charAt(i)); } return self; }, TMP_24.$$arity = 0); Opal.defn(self, '$each_line', TMP_26 = function $$each_line(separator) { var self = this, $iter = TMP_26.$$p, block = $iter || nil; if ($gvars["/"] == null) $gvars["/"] = nil; if (separator == null) { separator = $gvars["/"]; } TMP_26.$$p = null; if ((block !== nil)) { } else { return self.$enum_for("each_line", separator) }; if (separator === nil) { Opal.yield1(block, self); return self; } separator = $scope.get('Opal').$coerce_to(separator, $scope.get('String'), "to_str") var a, i, n, length, chomped, trailing, splitted; if (separator.length === 0) { for (a = self.split(/(\n{2,})/), i = 0, n = a.length; i < n; i += 2) { if (a[i] || a[i + 1]) { Opal.yield1(block, (a[i] || "") + (a[i + 1] || "")); } } return self; } chomped = self.$chomp(separator); trailing = self.length != chomped.length; splitted = chomped.split(separator); for (i = 0, length = splitted.length; i < length; i++) { if (i < length - 1 || trailing) { Opal.yield1(block, splitted[i] + separator); } else { Opal.yield1(block, splitted[i]); } } return self; }, TMP_26.$$arity = -1); Opal.defn(self, '$empty?', TMP_27 = function() { var self = this; return self.length === 0; }, TMP_27.$$arity = 0); Opal.defn(self, '$end_with?', TMP_28 = function($a_rest) { var self = this, suffixes; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } suffixes = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { suffixes[$arg_idx - 0] = arguments[$arg_idx]; } for (var i = 0, length = suffixes.length; i < length; i++) { var suffix = $scope.get('Opal').$coerce_to(suffixes[i], $scope.get('String'), "to_str").$to_s(); if (self.length >= suffix.length && self.substr(self.length - suffix.length, suffix.length) == suffix) { return true; } } return false; }, TMP_28.$$arity = -1); Opal.alias(self, 'eql?', '=='); Opal.alias(self, 'equal?', '==='); Opal.defn(self, '$gsub', TMP_29 = function $$gsub(pattern, replacement) { var self = this, $iter = TMP_29.$$p, block = $iter || nil; TMP_29.$$p = null; if (replacement === undefined && block === nil) { return self.$enum_for("gsub", pattern); } var result = '', match_data = nil, index = 0, match, _replacement; if (pattern.$$is_regexp) { pattern = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : '')); } else { pattern = $scope.get('Opal').$coerce_to(pattern, $scope.get('String'), "to_str"); pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); } while (true) { match = pattern.exec(self); if (match === null) { $gvars["~"] = nil result += self.slice(index); break; } match_data = $scope.get('MatchData').$new(pattern, match); if (replacement === undefined) { _replacement = block(match[0]); } else if (replacement.$$is_hash) { _replacement = (replacement)['$[]'](match[0]).$to_s(); } else { if (!replacement.$$is_string) { replacement = $scope.get('Opal').$coerce_to(replacement, $scope.get('String'), "to_str"); } _replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { if (slashes.length % 2 === 0) { return original; } switch (command) { case "+": for (var i = match.length - 1; i > 0; i--) { if (match[i] !== undefined) { return slashes.slice(1) + match[i]; } } return ''; case "&": return slashes.slice(1) + match[0]; case "`": return slashes.slice(1) + self.slice(0, match.index); case "'": return slashes.slice(1) + self.slice(match.index + match[0].length); default: return slashes.slice(1) + (match[command] || ''); } }).replace(/\\\\/g, '\\'); } if (pattern.lastIndex === match.index) { result += (_replacement + self.slice(index, match.index + 1)) pattern.lastIndex += 1; } else { result += (self.slice(index, match.index) + _replacement) } index = pattern.lastIndex; } $gvars["~"] = match_data return result; ; }, TMP_29.$$arity = -2); Opal.defn(self, '$hash', TMP_30 = function $$hash() { var self = this; return self.toString(); }, TMP_30.$$arity = 0); Opal.defn(self, '$hex', TMP_31 = function $$hex() { var self = this; return self.$to_i(16); }, TMP_31.$$arity = 0); Opal.defn(self, '$include?', TMP_32 = function(other) { var self = this; if (!other.$$is_string) { other = $scope.get('Opal').$coerce_to(other, $scope.get('String'), "to_str") } return self.indexOf(other) !== -1; ; }, TMP_32.$$arity = 1); Opal.defn(self, '$index', TMP_33 = function $$index(search, offset) { var self = this; var index, match, regex; if (offset === undefined) { offset = 0; } else { offset = $scope.get('Opal').$coerce_to(offset, $scope.get('Integer'), "to_int"); if (offset < 0) { offset += self.length; if (offset < 0) { return nil; } } } if (search.$$is_regexp) { regex = new RegExp(search.source, 'gm' + (search.ignoreCase ? 'i' : '')); while (true) { match = regex.exec(self); if (match === null) { $gvars["~"] = nil; index = -1; break; } if (match.index >= offset) { $gvars["~"] = $scope.get('MatchData').$new(regex, match) index = match.index; break; } regex.lastIndex = match.index + 1; } } else { search = $scope.get('Opal').$coerce_to(search, $scope.get('String'), "to_str"); if (search.length === 0 && offset > self.length) { index = -1; } else { index = self.indexOf(search, offset); } } return index === -1 ? nil : index; }, TMP_33.$$arity = -2); Opal.defn(self, '$inspect', TMP_34 = function $$inspect() { var self = this; var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, meta = { '\u0007': '\\a', '\u001b': '\\e', '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '\v': '\\v', '"' : '\\"', '\\': '\\\\' }, escaped = self.replace(escapable, function (chr) { return meta[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16).toUpperCase()).slice(-4); }); return '"' + escaped.replace(/\#[\$\@\{]/g, '\\$&') + '"'; }, TMP_34.$$arity = 0); Opal.defn(self, '$intern', TMP_35 = function $$intern() { var self = this; return self; }, TMP_35.$$arity = 0); Opal.defn(self, '$lines', TMP_36 = function $$lines(separator) { var $a, $b, self = this, $iter = TMP_36.$$p, block = $iter || nil, e = nil; if ($gvars["/"] == null) $gvars["/"] = nil; if (separator == null) { separator = $gvars["/"]; } TMP_36.$$p = null; e = ($a = ($b = self).$each_line, $a.$$p = block.$to_proc(), $a).call($b, separator); if (block !== false && block !== nil && block != null) { return self } else { return e.$to_a() }; }, TMP_36.$$arity = -1); Opal.defn(self, '$length', TMP_37 = function $$length() { var self = this; return self.length; }, TMP_37.$$arity = 0); Opal.defn(self, '$ljust', TMP_38 = function $$ljust(width, padstr) { var $a, self = this; if (padstr == null) { padstr = " "; } width = $scope.get('Opal').$coerce_to(width, $scope.get('Integer'), "to_int"); padstr = $scope.get('Opal').$coerce_to(padstr, $scope.get('String'), "to_str").$to_s(); if ((($a = padstr['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "zero width padding")}; if ((($a = width <= self.length) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self}; var index = -1, result = ""; width -= self.length; while (++index < width) { result += padstr; } return self + result.slice(0, width); }, TMP_38.$$arity = -2); Opal.defn(self, '$lstrip', TMP_39 = function $$lstrip() { var self = this; return self.replace(/^\s*/, ''); }, TMP_39.$$arity = 0); Opal.defn(self, '$match', TMP_40 = function $$match(pattern, pos) { var $a, $b, self = this, $iter = TMP_40.$$p, block = $iter || nil; TMP_40.$$p = null; if ((($a = ((($b = $scope.get('String')['$==='](pattern)) !== false && $b !== nil && $b != null) ? $b : pattern['$respond_to?']("to_str"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { pattern = $scope.get('Regexp').$new(pattern.$to_str())}; if ((($a = $scope.get('Regexp')['$==='](pattern)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('TypeError'), "wrong argument type " + (pattern.$class()) + " (expected Regexp)") }; return ($a = ($b = pattern).$match, $a.$$p = block.$to_proc(), $a).call($b, self, pos); }, TMP_40.$$arity = -2); Opal.defn(self, '$next', TMP_41 = function $$next() { var self = this; var i = self.length; if (i === 0) { return ''; } var result = self; var first_alphanum_char_index = self.search(/[a-zA-Z0-9]/); var carry = false; var code; while (i--) { code = self.charCodeAt(i); if ((code >= 48 && code <= 57) || (code >= 65 && code <= 90) || (code >= 97 && code <= 122)) { switch (code) { case 57: carry = true; code = 48; break; case 90: carry = true; code = 65; break; case 122: carry = true; code = 97; break; default: carry = false; code += 1; } } else { if (first_alphanum_char_index === -1) { if (code === 255) { carry = true; code = 0; } else { carry = false; code += 1; } } else { carry = true; } } result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i + 1); if (carry && (i === 0 || i === first_alphanum_char_index)) { switch (code) { case 65: break; case 97: break; default: code += 1; } if (i === 0) { result = String.fromCharCode(code) + result; } else { result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i); } carry = false; } if (!carry) { break; } } return result; }, TMP_41.$$arity = 0); Opal.defn(self, '$oct', TMP_42 = function $$oct() { var self = this; var result, string = self, radix = 8; if (/^\s*_/.test(string)) { return 0; } string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i, function (original, head, flag, tail) { switch (tail.charAt(0)) { case '+': case '-': return original; case '0': if (tail.charAt(1) === 'x' && flag === '0x') { return original; } } switch (flag) { case '0b': radix = 2; break; case '0': case '0o': radix = 8; break; case '0d': radix = 10; break; case '0x': radix = 16; break; } return head + tail; }); result = parseInt(string.replace(/_(?!_)/g, ''), radix); return isNaN(result) ? 0 : result; }, TMP_42.$$arity = 0); Opal.defn(self, '$ord', TMP_43 = function $$ord() { var self = this; return self.charCodeAt(0); }, TMP_43.$$arity = 0); Opal.defn(self, '$partition', TMP_44 = function $$partition(sep) { var self = this; var i, m; if (sep.$$is_regexp) { m = sep.exec(self); if (m === null) { i = -1; } else { $scope.get('MatchData').$new(sep, m); sep = m[0]; i = m.index; } } else { sep = $scope.get('Opal').$coerce_to(sep, $scope.get('String'), "to_str"); i = self.indexOf(sep); } if (i === -1) { return [self, '', '']; } return [ self.slice(0, i), self.slice(i, i + sep.length), self.slice(i + sep.length) ]; }, TMP_44.$$arity = 1); Opal.defn(self, '$reverse', TMP_45 = function $$reverse() { var self = this; return self.split('').reverse().join(''); }, TMP_45.$$arity = 0); Opal.defn(self, '$rindex', TMP_46 = function $$rindex(search, offset) { var self = this; var i, m, r, _m; if (offset === undefined) { offset = self.length; } else { offset = $scope.get('Opal').$coerce_to(offset, $scope.get('Integer'), "to_int"); if (offset < 0) { offset += self.length; if (offset < 0) { return nil; } } } if (search.$$is_regexp) { m = null; r = new RegExp(search.source, 'gm' + (search.ignoreCase ? 'i' : '')); while (true) { _m = r.exec(self); if (_m === null || _m.index > offset) { break; } m = _m; r.lastIndex = m.index + 1; } if (m === null) { $gvars["~"] = nil i = -1; } else { $scope.get('MatchData').$new(r, m); i = m.index; } } else { search = $scope.get('Opal').$coerce_to(search, $scope.get('String'), "to_str"); i = self.lastIndexOf(search, offset); } return i === -1 ? nil : i; }, TMP_46.$$arity = -2); Opal.defn(self, '$rjust', TMP_47 = function $$rjust(width, padstr) { var $a, self = this; if (padstr == null) { padstr = " "; } width = $scope.get('Opal').$coerce_to(width, $scope.get('Integer'), "to_int"); padstr = $scope.get('Opal').$coerce_to(padstr, $scope.get('String'), "to_str").$to_s(); if ((($a = padstr['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "zero width padding")}; if ((($a = width <= self.length) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self}; var chars = Math.floor(width - self.length), patterns = Math.floor(chars / padstr.length), result = Array(patterns + 1).join(padstr), remaining = chars - result.length; return result + padstr.slice(0, remaining) + self; }, TMP_47.$$arity = -2); Opal.defn(self, '$rpartition', TMP_48 = function $$rpartition(sep) { var self = this; var i, m, r, _m; if (sep.$$is_regexp) { m = null; r = new RegExp(sep.source, 'gm' + (sep.ignoreCase ? 'i' : '')); while (true) { _m = r.exec(self); if (_m === null) { break; } m = _m; r.lastIndex = m.index + 1; } if (m === null) { i = -1; } else { $scope.get('MatchData').$new(r, m); sep = m[0]; i = m.index; } } else { sep = $scope.get('Opal').$coerce_to(sep, $scope.get('String'), "to_str"); i = self.lastIndexOf(sep); } if (i === -1) { return ['', '', self]; } return [ self.slice(0, i), self.slice(i, i + sep.length), self.slice(i + sep.length) ]; }, TMP_48.$$arity = 1); Opal.defn(self, '$rstrip', TMP_49 = function $$rstrip() { var self = this; return self.replace(/[\s\u0000]*$/, ''); }, TMP_49.$$arity = 0); Opal.defn(self, '$scan', TMP_50 = function $$scan(pattern) { var self = this, $iter = TMP_50.$$p, block = $iter || nil; TMP_50.$$p = null; var result = [], match_data = nil, match; if (pattern.$$is_regexp) { pattern = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : '')); } else { pattern = $scope.get('Opal').$coerce_to(pattern, $scope.get('String'), "to_str"); pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); } while ((match = pattern.exec(self)) != null) { match_data = $scope.get('MatchData').$new(pattern, match); if (block === nil) { match.length == 1 ? result.push(match[0]) : result.push((match_data).$captures()); } else { match.length == 1 ? block(match[0]) : block.call(self, (match_data).$captures()); } if (pattern.lastIndex === match.index) { pattern.lastIndex += 1; } } $gvars["~"] = match_data return (block !== nil ? self : result); }, TMP_50.$$arity = 1); Opal.alias(self, 'size', 'length'); Opal.alias(self, 'slice', '[]'); Opal.defn(self, '$split', TMP_51 = function $$split(pattern, limit) { var $a, self = this; if ($gvars[";"] == null) $gvars[";"] = nil; if (self.length === 0) { return []; } if (limit === undefined) { limit = 0; } else { limit = $scope.get('Opal')['$coerce_to!'](limit, $scope.get('Integer'), "to_int"); if (limit === 1) { return [self]; } } if (pattern === undefined || pattern === nil) { pattern = ((($a = $gvars[";"]) !== false && $a !== nil && $a != null) ? $a : " "); } var result = [], string = self.toString(), index = 0, match, i; if (pattern.$$is_regexp) { pattern = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : '')); } else { pattern = $scope.get('Opal').$coerce_to(pattern, $scope.get('String'), "to_str").$to_s(); if (pattern === ' ') { pattern = /\s+/gm; string = string.replace(/^\s+/, ''); } else { pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); } } result = string.split(pattern); if (result.length === 1 && result[0] === string) { return result; } while ((i = result.indexOf(undefined)) !== -1) { result.splice(i, 1); } if (limit === 0) { while (result[result.length - 1] === '') { result.length -= 1; } return result; } match = pattern.exec(string); if (limit < 0) { if (match !== null && match[0] === '' && pattern.source.indexOf('(?=') === -1) { for (i = 0; i < match.length; i++) { result.push(''); } } return result; } if (match !== null && match[0] === '') { result.splice(limit - 1, result.length - 1, result.slice(limit - 1).join('')); return result; } if (limit >= result.length) { return result; } i = 0; while (match !== null) { i++; index = pattern.lastIndex; if (i + 1 === limit) { break; } match = pattern.exec(string); } result.splice(limit - 1, result.length - 1, string.slice(index)); return result; }, TMP_51.$$arity = -1); Opal.defn(self, '$squeeze', TMP_52 = function $$squeeze($a_rest) { var self = this, sets; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } sets = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { sets[$arg_idx - 0] = arguments[$arg_idx]; } if (sets.length === 0) { return self.replace(/(.)\1+/g, '$1'); } var char_class = char_class_from_char_sets(sets); if (char_class === null) { return self; } return self.replace(new RegExp('(' + char_class + ')\\1+', 'g'), '$1'); }, TMP_52.$$arity = -1); Opal.defn(self, '$start_with?', TMP_53 = function($a_rest) { var self = this, prefixes; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } prefixes = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { prefixes[$arg_idx - 0] = arguments[$arg_idx]; } for (var i = 0, length = prefixes.length; i < length; i++) { var prefix = $scope.get('Opal').$coerce_to(prefixes[i], $scope.get('String'), "to_str").$to_s(); if (self.indexOf(prefix) === 0) { return true; } } return false; }, TMP_53.$$arity = -1); Opal.defn(self, '$strip', TMP_54 = function $$strip() { var self = this; return self.replace(/^\s*/, '').replace(/[\s\u0000]*$/, ''); }, TMP_54.$$arity = 0); Opal.defn(self, '$sub', TMP_55 = function $$sub(pattern, replacement) { var self = this, $iter = TMP_55.$$p, block = $iter || nil; TMP_55.$$p = null; if (!pattern.$$is_regexp) { pattern = $scope.get('Opal').$coerce_to(pattern, $scope.get('String'), "to_str"); pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')); } var result = pattern.exec(self); if (result === null) { $gvars["~"] = nil return self.toString(); } $scope.get('MatchData').$new(pattern, result) if (replacement === undefined) { if (block === nil) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (1 for 2)") } return self.slice(0, result.index) + block(result[0]) + self.slice(result.index + result[0].length); } if (replacement.$$is_hash) { return self.slice(0, result.index) + (replacement)['$[]'](result[0]).$to_s() + self.slice(result.index + result[0].length); } replacement = $scope.get('Opal').$coerce_to(replacement, $scope.get('String'), "to_str"); replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { if (slashes.length % 2 === 0) { return original; } switch (command) { case "+": for (var i = result.length - 1; i > 0; i--) { if (result[i] !== undefined) { return slashes.slice(1) + result[i]; } } return ''; case "&": return slashes.slice(1) + result[0]; case "`": return slashes.slice(1) + self.slice(0, result.index); case "'": return slashes.slice(1) + self.slice(result.index + result[0].length); default: return slashes.slice(1) + (result[command] || ''); } }).replace(/\\\\/g, '\\'); return self.slice(0, result.index) + replacement + self.slice(result.index + result[0].length); ; }, TMP_55.$$arity = -2); Opal.alias(self, 'succ', 'next'); Opal.defn(self, '$sum', TMP_56 = function $$sum(n) { var self = this; if (n == null) { n = 16; } n = $scope.get('Opal').$coerce_to(n, $scope.get('Integer'), "to_int"); var result = 0, length = self.length, i = 0; for (; i < length; i++) { result += self.charCodeAt(i); } if (n <= 0) { return result; } return result & (Math.pow(2, n) - 1); ; }, TMP_56.$$arity = -1); Opal.defn(self, '$swapcase', TMP_57 = function $$swapcase() { var self = this; var str = self.replace(/([a-z]+)|([A-Z]+)/g, function($0,$1,$2) { return $1 ? $0.toUpperCase() : $0.toLowerCase(); }); if (self.constructor === String) { return str; } return self.$class().$new(str); }, TMP_57.$$arity = 0); Opal.defn(self, '$to_f', TMP_58 = function $$to_f() { var self = this; if (self.charAt(0) === '_') { return 0; } var result = parseFloat(self.replace(/_/g, '')); if (isNaN(result) || result == Infinity || result == -Infinity) { return 0; } else { return result; } }, TMP_58.$$arity = 0); Opal.defn(self, '$to_i', TMP_59 = function $$to_i(base) { var self = this; if (base == null) { base = 10; } var result, string = self.toLowerCase(), radix = $scope.get('Opal').$coerce_to(base, $scope.get('Integer'), "to_int"); if (radix === 1 || radix < 0 || radix > 36) { self.$raise($scope.get('ArgumentError'), "invalid radix " + (radix)) } if (/^\s*_/.test(string)) { return 0; } string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/, function (original, head, flag, tail) { switch (tail.charAt(0)) { case '+': case '-': return original; case '0': if (tail.charAt(1) === 'x' && flag === '0x' && (radix === 0 || radix === 16)) { return original; } } switch (flag) { case '0b': if (radix === 0 || radix === 2) { radix = 2; return head + tail; } break; case '0': case '0o': if (radix === 0 || radix === 8) { radix = 8; return head + tail; } break; case '0d': if (radix === 0 || radix === 10) { radix = 10; return head + tail; } break; case '0x': if (radix === 0 || radix === 16) { radix = 16; return head + tail; } break; } return original }); result = parseInt(string.replace(/_(?!_)/g, ''), radix); return isNaN(result) ? 0 : result; ; }, TMP_59.$$arity = -1); Opal.defn(self, '$to_proc', TMP_61 = function $$to_proc() { var $a, $b, TMP_60, self = this, sym = nil; sym = self; return ($a = ($b = self).$proc, $a.$$p = (TMP_60 = function($c_rest){var self = TMP_60.$$s || this, block, args, $d, $e, obj = nil; block = TMP_60.$$p || nil, TMP_60.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($d = args['$empty?']()) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { self.$raise($scope.get('ArgumentError'), "no receiver given")}; obj = args.$shift(); return ($d = ($e = obj).$__send__, $d.$$p = block.$to_proc(), $d).apply($e, [sym].concat(Opal.to_a(args)));}, TMP_60.$$s = self, TMP_60.$$arity = -1, TMP_60), $a).call($b); }, TMP_61.$$arity = 0); Opal.defn(self, '$to_s', TMP_62 = function $$to_s() { var self = this; return self.toString(); }, TMP_62.$$arity = 0); Opal.alias(self, 'to_str', 'to_s'); Opal.alias(self, 'to_sym', 'intern'); Opal.defn(self, '$tr', TMP_63 = function $$tr(from, to) { var self = this; from = $scope.get('Opal').$coerce_to(from, $scope.get('String'), "to_str").$to_s(); to = $scope.get('Opal').$coerce_to(to, $scope.get('String'), "to_str").$to_s(); if (from.length == 0 || from === to) { return self; } var i, in_range, c, ch, start, end, length; var subs = {}; var from_chars = from.split(''); var from_length = from_chars.length; var to_chars = to.split(''); var to_length = to_chars.length; var inverse = false; var global_sub = null; if (from_chars[0] === '^' && from_chars.length > 1) { inverse = true; from_chars.shift(); global_sub = to_chars[to_length - 1] from_length -= 1; } var from_chars_expanded = []; var last_from = null; in_range = false; for (i = 0; i < from_length; i++) { ch = from_chars[i]; if (last_from == null) { last_from = ch; from_chars_expanded.push(ch); } else if (ch === '-') { if (last_from === '-') { from_chars_expanded.push('-'); from_chars_expanded.push('-'); } else if (i == from_length - 1) { from_chars_expanded.push('-'); } else { in_range = true; } } else if (in_range) { start = last_from.charCodeAt(0); end = ch.charCodeAt(0); if (start > end) { self.$raise($scope.get('ArgumentError'), "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") } for (c = start + 1; c < end; c++) { from_chars_expanded.push(String.fromCharCode(c)); } from_chars_expanded.push(ch); in_range = null; last_from = null; } else { from_chars_expanded.push(ch); } } from_chars = from_chars_expanded; from_length = from_chars.length; if (inverse) { for (i = 0; i < from_length; i++) { subs[from_chars[i]] = true; } } else { if (to_length > 0) { var to_chars_expanded = []; var last_to = null; in_range = false; for (i = 0; i < to_length; i++) { ch = to_chars[i]; if (last_to == null) { last_to = ch; to_chars_expanded.push(ch); } else if (ch === '-') { if (last_to === '-') { to_chars_expanded.push('-'); to_chars_expanded.push('-'); } else if (i == to_length - 1) { to_chars_expanded.push('-'); } else { in_range = true; } } else if (in_range) { start = last_to.charCodeAt(0); end = ch.charCodeAt(0); if (start > end) { self.$raise($scope.get('ArgumentError'), "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") } for (c = start + 1; c < end; c++) { to_chars_expanded.push(String.fromCharCode(c)); } to_chars_expanded.push(ch); in_range = null; last_to = null; } else { to_chars_expanded.push(ch); } } to_chars = to_chars_expanded; to_length = to_chars.length; } var length_diff = from_length - to_length; if (length_diff > 0) { var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); for (i = 0; i < length_diff; i++) { to_chars.push(pad_char); } } for (i = 0; i < from_length; i++) { subs[from_chars[i]] = to_chars[i]; } } var new_str = '' for (i = 0, length = self.length; i < length; i++) { ch = self.charAt(i); var sub = subs[ch]; if (inverse) { new_str += (sub == null ? global_sub : ch); } else { new_str += (sub != null ? sub : ch); } } return new_str; }, TMP_63.$$arity = 2); Opal.defn(self, '$tr_s', TMP_64 = function $$tr_s(from, to) { var self = this; from = $scope.get('Opal').$coerce_to(from, $scope.get('String'), "to_str").$to_s(); to = $scope.get('Opal').$coerce_to(to, $scope.get('String'), "to_str").$to_s(); if (from.length == 0) { return self; } var i, in_range, c, ch, start, end, length; var subs = {}; var from_chars = from.split(''); var from_length = from_chars.length; var to_chars = to.split(''); var to_length = to_chars.length; var inverse = false; var global_sub = null; if (from_chars[0] === '^' && from_chars.length > 1) { inverse = true; from_chars.shift(); global_sub = to_chars[to_length - 1] from_length -= 1; } var from_chars_expanded = []; var last_from = null; in_range = false; for (i = 0; i < from_length; i++) { ch = from_chars[i]; if (last_from == null) { last_from = ch; from_chars_expanded.push(ch); } else if (ch === '-') { if (last_from === '-') { from_chars_expanded.push('-'); from_chars_expanded.push('-'); } else if (i == from_length - 1) { from_chars_expanded.push('-'); } else { in_range = true; } } else if (in_range) { start = last_from.charCodeAt(0); end = ch.charCodeAt(0); if (start > end) { self.$raise($scope.get('ArgumentError'), "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") } for (c = start + 1; c < end; c++) { from_chars_expanded.push(String.fromCharCode(c)); } from_chars_expanded.push(ch); in_range = null; last_from = null; } else { from_chars_expanded.push(ch); } } from_chars = from_chars_expanded; from_length = from_chars.length; if (inverse) { for (i = 0; i < from_length; i++) { subs[from_chars[i]] = true; } } else { if (to_length > 0) { var to_chars_expanded = []; var last_to = null; in_range = false; for (i = 0; i < to_length; i++) { ch = to_chars[i]; if (last_from == null) { last_from = ch; to_chars_expanded.push(ch); } else if (ch === '-') { if (last_to === '-') { to_chars_expanded.push('-'); to_chars_expanded.push('-'); } else if (i == to_length - 1) { to_chars_expanded.push('-'); } else { in_range = true; } } else if (in_range) { start = last_from.charCodeAt(0); end = ch.charCodeAt(0); if (start > end) { self.$raise($scope.get('ArgumentError'), "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") } for (c = start + 1; c < end; c++) { to_chars_expanded.push(String.fromCharCode(c)); } to_chars_expanded.push(ch); in_range = null; last_from = null; } else { to_chars_expanded.push(ch); } } to_chars = to_chars_expanded; to_length = to_chars.length; } var length_diff = from_length - to_length; if (length_diff > 0) { var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); for (i = 0; i < length_diff; i++) { to_chars.push(pad_char); } } for (i = 0; i < from_length; i++) { subs[from_chars[i]] = to_chars[i]; } } var new_str = '' var last_substitute = null for (i = 0, length = self.length; i < length; i++) { ch = self.charAt(i); var sub = subs[ch] if (inverse) { if (sub == null) { if (last_substitute == null) { new_str += global_sub; last_substitute = true; } } else { new_str += ch; last_substitute = null; } } else { if (sub != null) { if (last_substitute == null || last_substitute !== sub) { new_str += sub; last_substitute = sub; } } else { new_str += ch; last_substitute = null; } } } return new_str; }, TMP_64.$$arity = 2); Opal.defn(self, '$upcase', TMP_65 = function $$upcase() { var self = this; return self.toUpperCase(); }, TMP_65.$$arity = 0); Opal.defn(self, '$upto', TMP_66 = function $$upto(stop, excl) { var self = this, $iter = TMP_66.$$p, block = $iter || nil; if (excl == null) { excl = false; } TMP_66.$$p = null; if ((block !== nil)) { } else { return self.$enum_for("upto", stop, excl) }; stop = $scope.get('Opal').$coerce_to(stop, $scope.get('String'), "to_str"); var a, b, s = self.toString(); if (s.length === 1 && stop.length === 1) { a = s.charCodeAt(0); b = stop.charCodeAt(0); while (a <= b) { if (excl && a === b) { break; } block(String.fromCharCode(a)); a += 1; } } else if (parseInt(s, 10).toString() === s && parseInt(stop, 10).toString() === stop) { a = parseInt(s, 10); b = parseInt(stop, 10); while (a <= b) { if (excl && a === b) { break; } block(a.toString()); a += 1; } } else { while (s.length <= stop.length && s <= stop) { if (excl && s === stop) { break; } block(s); s = (s).$succ(); } } return self; }, TMP_66.$$arity = -2); function char_class_from_char_sets(sets) { function explode_sequences_in_character_set(set) { var result = '', i, len = set.length, curr_char, skip_next_dash, char_code_from, char_code_upto, char_code; for (i = 0; i < len; i++) { curr_char = set.charAt(i); if (curr_char === '-' && i > 0 && i < (len - 1) && !skip_next_dash) { char_code_from = set.charCodeAt(i - 1); char_code_upto = set.charCodeAt(i + 1); if (char_code_from > char_code_upto) { self.$raise($scope.get('ArgumentError'), "invalid range \"" + (char_code_from) + "-" + (char_code_upto) + "\" in string transliteration") } for (char_code = char_code_from + 1; char_code < char_code_upto + 1; char_code++) { result += String.fromCharCode(char_code); } skip_next_dash = true; i++; } else { skip_next_dash = (curr_char === '\\'); result += curr_char; } } return result; } function intersection(setA, setB) { if (setA.length === 0) { return setB; } var result = '', i, len = setA.length, chr; for (i = 0; i < len; i++) { chr = setA.charAt(i); if (setB.indexOf(chr) !== -1) { result += chr; } } return result; } var i, len, set, neg, chr, tmp, pos_intersection = '', neg_intersection = ''; for (i = 0, len = sets.length; i < len; i++) { set = $scope.get('Opal').$coerce_to(sets[i], $scope.get('String'), "to_str"); neg = (set.charAt(0) === '^' && set.length > 1); set = explode_sequences_in_character_set(neg ? set.slice(1) : set); if (neg) { neg_intersection = intersection(neg_intersection, set); } else { pos_intersection = intersection(pos_intersection, set); } } if (pos_intersection.length > 0 && neg_intersection.length > 0) { tmp = ''; for (i = 0, len = pos_intersection.length; i < len; i++) { chr = pos_intersection.charAt(i); if (neg_intersection.indexOf(chr) === -1) { tmp += chr; } } pos_intersection = tmp; neg_intersection = ''; } if (pos_intersection.length > 0) { return '[' + $scope.get('Regexp').$escape(pos_intersection) + ']'; } if (neg_intersection.length > 0) { return '[^' + $scope.get('Regexp').$escape(neg_intersection) + ']'; } return null; } Opal.defn(self, '$instance_variables', TMP_67 = function $$instance_variables() { var self = this; return []; }, TMP_67.$$arity = 0); return (Opal.defs(self, '$_load', TMP_68 = function $$_load($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = self).$new.apply($b, Opal.to_a(args)); }, TMP_68.$$arity = -1), nil) && '_load'; })($scope.base, String); return Opal.cdecl($scope, 'Symbol', $scope.get('String')); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/enumerable"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_divide(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$each', '$destructure', '$raise', '$new', '$yield', '$dup', '$enum_for', '$enumerator_size', '$flatten', '$map', '$proc', '$==', '$nil?', '$respond_to?', '$coerce_to!', '$>', '$*', '$coerce_to', '$try_convert', '$<', '$+', '$-', '$to_enum', '$ceil', '$/', '$size', '$===', '$<<', '$[]', '$[]=', '$inspect', '$__send__', '$<=>', '$first', '$reverse', '$sort', '$to_proc', '$compare', '$call', '$to_a', '$lambda', '$sort!', '$map!', '$zip']); return (function($base) { var $Enumerable, self = $Enumerable = $module($base, 'Enumerable'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_4, TMP_7, TMP_10, TMP_12, TMP_15, TMP_19, TMP_21, TMP_23, TMP_24, TMP_25, TMP_27, TMP_29, TMP_31, TMP_33, TMP_35, TMP_36, TMP_38, TMP_43, TMP_44, TMP_45, TMP_48, TMP_49, TMP_51, TMP_52, TMP_53, TMP_54, TMP_56, TMP_57, TMP_59, TMP_61, TMP_62, TMP_65, TMP_68, TMP_70, TMP_72, TMP_74, TMP_76, TMP_78, TMP_83, TMP_84, TMP_86; Opal.defn(self, '$all?', TMP_1 = function() {try { var $a, $b, TMP_2, $c, TMP_3, self = this, $iter = TMP_1.$$p, block = $iter || nil; TMP_1.$$p = null; if ((block !== nil)) { ($a = ($b = self).$each, $a.$$p = (TMP_2 = function($c_rest){var self = TMP_2.$$s || this, value, $d; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } value = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { value[$arg_idx - 0] = arguments[$arg_idx]; } if ((($d = Opal.yieldX(block, Opal.to_a(value))) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return nil } else { Opal.ret(false) }}, TMP_2.$$s = self, TMP_2.$$arity = -1, TMP_2), $a).call($b) } else { ($a = ($c = self).$each, $a.$$p = (TMP_3 = function($d_rest){var self = TMP_3.$$s || this, value, $e; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } value = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { value[$arg_idx - 0] = arguments[$arg_idx]; } if ((($e = $scope.get('Opal').$destructure(value)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { return nil } else { Opal.ret(false) }}, TMP_3.$$s = self, TMP_3.$$arity = -1, TMP_3), $a).call($c) }; return true; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_1.$$arity = 0); Opal.defn(self, '$any?', TMP_4 = function() {try { var $a, $b, TMP_5, $c, TMP_6, self = this, $iter = TMP_4.$$p, block = $iter || nil; TMP_4.$$p = null; if ((block !== nil)) { ($a = ($b = self).$each, $a.$$p = (TMP_5 = function($c_rest){var self = TMP_5.$$s || this, value, $d; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } value = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { value[$arg_idx - 0] = arguments[$arg_idx]; } if ((($d = Opal.yieldX(block, Opal.to_a(value))) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { Opal.ret(true) } else { return nil }}, TMP_5.$$s = self, TMP_5.$$arity = -1, TMP_5), $a).call($b) } else { ($a = ($c = self).$each, $a.$$p = (TMP_6 = function($d_rest){var self = TMP_6.$$s || this, value, $e; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } value = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { value[$arg_idx - 0] = arguments[$arg_idx]; } if ((($e = $scope.get('Opal').$destructure(value)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { Opal.ret(true) } else { return nil }}, TMP_6.$$s = self, TMP_6.$$arity = -1, TMP_6), $a).call($c) }; return false; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_4.$$arity = 0); Opal.defn(self, '$chunk', TMP_7 = function $$chunk(state) { var $a, $b, TMP_8, self = this, $iter = TMP_7.$$p, original_block = $iter || nil; TMP_7.$$p = null; if (original_block !== false && original_block !== nil && original_block != null) { } else { $scope.get('Kernel').$raise($scope.get('ArgumentError'), "no block given") }; return ($a = ($b = Opal.get('Enumerator')).$new, $a.$$p = (TMP_8 = function(yielder){var self = TMP_8.$$s || this, $c, $d, TMP_9; if (yielder == null) yielder = nil; var block, previous = nil, accumulate = []; if (state == undefined || state === nil) { block = original_block; } else { block = ($c = ($d = $scope.get('Proc')).$new, $c.$$p = (TMP_9 = function(val){var self = TMP_9.$$s || this; if (val == null) val = nil; return original_block.$yield(val, state.$dup())}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9), $c).call($d) } function releaseAccumulate() { if (accumulate.length > 0) { yielder.$yield(previous, accumulate) } } self.$each.$$p = function(value) { var key = Opal.yield1(block, value); if (key === nil) { releaseAccumulate(); accumulate = []; previous = nil; } else { if (previous === nil || previous === key) { accumulate.push(value); } else { releaseAccumulate(); accumulate = [value]; } previous = key; } } self.$each(); releaseAccumulate(); ;}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8), $a).call($b); }, TMP_7.$$arity = -1); Opal.defn(self, '$collect', TMP_10 = function $$collect() { var $a, $b, TMP_11, self = this, $iter = TMP_10.$$p, block = $iter || nil; TMP_10.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_11 = function(){var self = TMP_11.$$s || this; return self.$enumerator_size()}, TMP_11.$$s = self, TMP_11.$$arity = 0, TMP_11), $a).call($b, "collect") }; var result = []; self.$each.$$p = function() { var value = Opal.yieldX(block, arguments); result.push(value); }; self.$each(); return result; }, TMP_10.$$arity = 0); Opal.defn(self, '$collect_concat', TMP_12 = function $$collect_concat() { var $a, $b, TMP_13, $c, TMP_14, self = this, $iter = TMP_12.$$p, block = $iter || nil; TMP_12.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_13 = function(){var self = TMP_13.$$s || this; return self.$enumerator_size()}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13), $a).call($b, "collect_concat") }; return ($a = ($c = self).$map, $a.$$p = (TMP_14 = function(item){var self = TMP_14.$$s || this; if (item == null) item = nil; return Opal.yield1(block, item);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($c).$flatten(1); }, TMP_12.$$arity = 0); Opal.defn(self, '$count', TMP_15 = function $$count(object) { var $a, $b, TMP_16, $c, TMP_17, $d, TMP_18, self = this, $iter = TMP_15.$$p, block = $iter || nil, result = nil; TMP_15.$$p = null; result = 0; if ((($a = object != null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { block = ($a = ($b = self).$proc, $a.$$p = (TMP_16 = function($c_rest){var self = TMP_16.$$s || this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return $scope.get('Opal').$destructure(args)['$=='](object)}, TMP_16.$$s = self, TMP_16.$$arity = -1, TMP_16), $a).call($b) } else if ((($a = block['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { block = ($a = ($c = self).$proc, $a.$$p = (TMP_17 = function(){var self = TMP_17.$$s || this; return true}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17), $a).call($c)}; ($a = ($d = self).$each, $a.$$p = (TMP_18 = function($e_rest){var self = TMP_18.$$s || this, args, $f; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($f = Opal.yieldX(block, args)) !== nil && $f != null && (!$f.$$is_boolean || $f == true))) { return result++; } else { return nil }}, TMP_18.$$s = self, TMP_18.$$arity = -1, TMP_18), $a).call($d); return result; }, TMP_15.$$arity = -1); Opal.defn(self, '$cycle', TMP_19 = function $$cycle(n) { var $a, $b, TMP_20, self = this, $iter = TMP_19.$$p, block = $iter || nil; if (n == null) { n = nil; } TMP_19.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_20 = function(){var self = TMP_20.$$s || this, $c; if (n['$=='](nil)) { if ((($c = self['$respond_to?']("size")) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return (($scope.get('Float')).$$scope.get('INFINITY')) } else { return nil } } else { n = $scope.get('Opal')['$coerce_to!'](n, $scope.get('Integer'), "to_int"); if ((($c = $rb_gt(n, 0)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return $rb_times(self.$enumerator_size(), n) } else { return 0 }; }}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20), $a).call($b, "cycle", n) }; if ((($a = n['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { n = $scope.get('Opal')['$coerce_to!'](n, $scope.get('Integer'), "to_int"); if ((($a = n <= 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; }; var result, all = [], i, length, value; self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = Opal.yield1(block, param); all.push(param); } self.$each(); if (result !== undefined) { return result; } if (all.length === 0) { return nil; } if (n === nil) { while (true) { for (i = 0, length = all.length; i < length; i++) { value = Opal.yield1(block, all[i]); } } } else { while (n > 1) { for (i = 0, length = all.length; i < length; i++) { value = Opal.yield1(block, all[i]); } n--; } } }, TMP_19.$$arity = -1); Opal.defn(self, '$detect', TMP_21 = function $$detect(ifnone) {try { var $a, $b, TMP_22, self = this, $iter = TMP_21.$$p, block = $iter || nil; TMP_21.$$p = null; if ((block !== nil)) { } else { return self.$enum_for("detect", ifnone) }; ($a = ($b = self).$each, $a.$$p = (TMP_22 = function($c_rest){var self = TMP_22.$$s || this, args, $d, value = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } value = $scope.get('Opal').$destructure(args); if ((($d = Opal.yield1(block, value)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { Opal.ret(value) } else { return nil };}, TMP_22.$$s = self, TMP_22.$$arity = -1, TMP_22), $a).call($b); if (ifnone !== undefined) { if (typeof(ifnone) === 'function') { return ifnone(); } else { return ifnone; } } return nil; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_21.$$arity = -1); Opal.defn(self, '$drop', TMP_23 = function $$drop(number) { var $a, self = this; number = $scope.get('Opal').$coerce_to(number, $scope.get('Integer'), "to_int"); if ((($a = number < 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "attempt to drop negative size")}; var result = [], current = 0; self.$each.$$p = function() { if (number <= current) { result.push($scope.get('Opal').$destructure(arguments)); } current++; }; self.$each() return result; }, TMP_23.$$arity = 1); Opal.defn(self, '$drop_while', TMP_24 = function $$drop_while() { var $a, self = this, $iter = TMP_24.$$p, block = $iter || nil; TMP_24.$$p = null; if ((block !== nil)) { } else { return self.$enum_for("drop_while") }; var result = [], dropping = true; self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments); if (dropping) { var value = Opal.yield1(block, param); if ((($a = value) === nil || $a == null || ($a.$$is_boolean && $a == false))) { dropping = false; result.push(param); } } else { result.push(param); } }; self.$each(); return result; }, TMP_24.$$arity = 0); Opal.defn(self, '$each_cons', TMP_25 = function $$each_cons(n) { var $a, $b, TMP_26, self = this, $iter = TMP_25.$$p, block = $iter || nil; TMP_25.$$p = null; if ((($a = arguments.length != 1) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " for 1)")}; n = $scope.get('Opal').$try_convert(n, $scope.get('Integer'), "to_int"); if ((($a = n <= 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "invalid size")}; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_26 = function(){var self = TMP_26.$$s || this, $c, $d, enum_size = nil; enum_size = self.$enumerator_size(); if ((($c = enum_size['$nil?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return nil } else if ((($c = ((($d = enum_size['$=='](0)) !== false && $d !== nil && $d != null) ? $d : $rb_lt(enum_size, n))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return 0 } else { return $rb_plus($rb_minus(enum_size, n), 1) };}, TMP_26.$$s = self, TMP_26.$$arity = 0, TMP_26), $a).call($b, "each_cons", n) }; var buffer = [], result = nil; self.$each.$$p = function() { var element = $scope.get('Opal').$destructure(arguments); buffer.push(element); if (buffer.length > n) { buffer.shift(); } if (buffer.length == n) { Opal.yield1(block, buffer.slice(0, n)); } } self.$each(); return result; }, TMP_25.$$arity = 1); Opal.defn(self, '$each_entry', TMP_27 = function $$each_entry($a_rest) { var $b, $c, TMP_28, self = this, data, $iter = TMP_27.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } data = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { data[$arg_idx - 0] = arguments[$arg_idx]; } TMP_27.$$p = null; if ((block !== nil)) { } else { return ($b = ($c = self).$to_enum, $b.$$p = (TMP_28 = function(){var self = TMP_28.$$s || this; return self.$enumerator_size()}, TMP_28.$$s = self, TMP_28.$$arity = 0, TMP_28), $b).apply($c, ["each_entry"].concat(Opal.to_a(data))) }; self.$each.$$p = function() { var item = $scope.get('Opal').$destructure(arguments); Opal.yield1(block, item); } self.$each.apply(self, data); return self; ; }, TMP_27.$$arity = -1); Opal.defn(self, '$each_slice', TMP_29 = function $$each_slice(n) { var $a, $b, TMP_30, self = this, $iter = TMP_29.$$p, block = $iter || nil; TMP_29.$$p = null; n = $scope.get('Opal').$coerce_to(n, $scope.get('Integer'), "to_int"); if ((($a = n <= 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "invalid slice size")}; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_30 = function(){var self = TMP_30.$$s || this, $c; if ((($c = self['$respond_to?']("size")) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return ($rb_divide(self.$size(), n)).$ceil() } else { return nil }}, TMP_30.$$s = self, TMP_30.$$arity = 0, TMP_30), $a).call($b, "each_slice", n) }; var result, slice = [] self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments); slice.push(param); if (slice.length === n) { Opal.yield1(block, slice); slice = []; } }; self.$each(); if (result !== undefined) { return result; } // our "last" group, if smaller than n then won't have been yielded if (slice.length > 0) { Opal.yield1(block, slice); } ; return nil; }, TMP_29.$$arity = 1); Opal.defn(self, '$each_with_index', TMP_31 = function $$each_with_index($a_rest) { var $b, $c, TMP_32, self = this, args, $iter = TMP_31.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_31.$$p = null; if ((block !== nil)) { } else { return ($b = ($c = self).$enum_for, $b.$$p = (TMP_32 = function(){var self = TMP_32.$$s || this; return self.$enumerator_size()}, TMP_32.$$s = self, TMP_32.$$arity = 0, TMP_32), $b).apply($c, ["each_with_index"].concat(Opal.to_a(args))) }; var result, index = 0; self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments); block(param, index); index++; }; self.$each.apply(self, args); if (result !== undefined) { return result; } return self; }, TMP_31.$$arity = -1); Opal.defn(self, '$each_with_object', TMP_33 = function $$each_with_object(object) { var $a, $b, TMP_34, self = this, $iter = TMP_33.$$p, block = $iter || nil; TMP_33.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_34 = function(){var self = TMP_34.$$s || this; return self.$enumerator_size()}, TMP_34.$$s = self, TMP_34.$$arity = 0, TMP_34), $a).call($b, "each_with_object", object) }; var result; self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments); block(param, object); }; self.$each(); if (result !== undefined) { return result; } return object; }, TMP_33.$$arity = 1); Opal.defn(self, '$entries', TMP_35 = function $$entries($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } var result = []; self.$each.$$p = function() { result.push($scope.get('Opal').$destructure(arguments)); }; self.$each.apply(self, args); return result; }, TMP_35.$$arity = -1); Opal.alias(self, 'find', 'detect'); Opal.defn(self, '$find_all', TMP_36 = function $$find_all() { var $a, $b, TMP_37, self = this, $iter = TMP_36.$$p, block = $iter || nil; TMP_36.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_37 = function(){var self = TMP_37.$$s || this; return self.$enumerator_size()}, TMP_37.$$s = self, TMP_37.$$arity = 0, TMP_37), $a).call($b, "find_all") }; var result = []; self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = Opal.yield1(block, param); if ((($a = value) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result.push(param); } }; self.$each(); return result; }, TMP_36.$$arity = 0); Opal.defn(self, '$find_index', TMP_38 = function $$find_index(object) {try { var $a, $b, TMP_39, $c, TMP_40, self = this, $iter = TMP_38.$$p, block = $iter || nil, index = nil; TMP_38.$$p = null; if ((($a = object === undefined && block === nil) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$enum_for("find_index")}; index = 0; if ((($a = object != null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { ($a = ($b = self).$each, $a.$$p = (TMP_39 = function($c_rest){var self = TMP_39.$$s || this, value; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } value = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { value[$arg_idx - 0] = arguments[$arg_idx]; } if ($scope.get('Opal').$destructure(value)['$=='](object)) { Opal.ret(index)}; return index += 1;}, TMP_39.$$s = self, TMP_39.$$arity = -1, TMP_39), $a).call($b) } else { ($a = ($c = self).$each, $a.$$p = (TMP_40 = function($d_rest){var self = TMP_40.$$s || this, value, $e; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } value = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { value[$arg_idx - 0] = arguments[$arg_idx]; } if ((($e = Opal.yieldX(block, Opal.to_a(value))) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { Opal.ret(index)}; return index += 1;}, TMP_40.$$s = self, TMP_40.$$arity = -1, TMP_40), $a).call($c) }; return nil; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_38.$$arity = -1); Opal.defn(self, '$first', TMP_43 = function $$first(number) {try { var $a, $b, TMP_41, $c, TMP_42, self = this, result = nil, current = nil; if ((($a = number === undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self).$each, $a.$$p = (TMP_41 = function(value){var self = TMP_41.$$s || this; if (value == null) value = nil; Opal.ret(value)}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41), $a).call($b) } else { result = []; number = $scope.get('Opal').$coerce_to(number, $scope.get('Integer'), "to_int"); if ((($a = number < 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "attempt to take negative size")}; if ((($a = number == 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return []}; current = 0; ($a = ($c = self).$each, $a.$$p = (TMP_42 = function($d_rest){var self = TMP_42.$$s || this, args, $e; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } result.push($scope.get('Opal').$destructure(args)); if ((($e = number <= ++current) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { Opal.ret(result) } else { return nil };}, TMP_42.$$s = self, TMP_42.$$arity = -1, TMP_42), $a).call($c); return result; }; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_43.$$arity = -1); Opal.alias(self, 'flat_map', 'collect_concat'); Opal.defn(self, '$grep', TMP_44 = function $$grep(pattern) { var $a, self = this, $iter = TMP_44.$$p, block = $iter || nil; TMP_44.$$p = null; var result = []; if (block !== nil) { self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = pattern['$==='](param); if ((($a = value) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { value = Opal.yield1(block, param); result.push(value); } }; } else { self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = pattern['$==='](param); if ((($a = value) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result.push(param); } }; } self.$each(); return result; ; }, TMP_44.$$arity = 1); Opal.defn(self, '$group_by', TMP_45 = function $$group_by() { var $a, $b, TMP_46, $c, $d, self = this, $iter = TMP_45.$$p, block = $iter || nil, hash = nil; TMP_45.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_46 = function(){var self = TMP_46.$$s || this; return self.$enumerator_size()}, TMP_46.$$s = self, TMP_46.$$arity = 0, TMP_46), $a).call($b, "group_by") }; hash = $scope.get('Hash').$new(); var result; self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = Opal.yield1(block, param); (($a = value, $c = hash, ((($d = $c['$[]']($a)) !== false && $d !== nil && $d != null) ? $d : $c['$[]=']($a, []))))['$<<'](param); } self.$each(); if (result !== undefined) { return result; } return hash; }, TMP_45.$$arity = 0); Opal.defn(self, '$include?', TMP_48 = function(obj) {try { var $a, $b, TMP_47, self = this; ($a = ($b = self).$each, $a.$$p = (TMP_47 = function($c_rest){var self = TMP_47.$$s || this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ($scope.get('Opal').$destructure(args)['$=='](obj)) { Opal.ret(true) } else { return nil }}, TMP_47.$$s = self, TMP_47.$$arity = -1, TMP_47), $a).call($b); return false; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_48.$$arity = 1); Opal.defn(self, '$inject', TMP_49 = function $$inject(object, sym) { var self = this, $iter = TMP_49.$$p, block = $iter || nil; TMP_49.$$p = null; var result = object; if (block !== nil && sym === undefined) { self.$each.$$p = function() { var value = $scope.get('Opal').$destructure(arguments); if (result === undefined) { result = value; return; } value = Opal.yieldX(block, [result, value]); result = value; }; } else { if (sym === undefined) { if (!$scope.get('Symbol')['$==='](object)) { self.$raise($scope.get('TypeError'), "" + (object.$inspect()) + " is not a Symbol"); } sym = object; result = undefined; } self.$each.$$p = function() { var value = $scope.get('Opal').$destructure(arguments); if (result === undefined) { result = value; return; } result = (result).$__send__(sym, value); }; } self.$each(); return result == undefined ? nil : result; ; }, TMP_49.$$arity = -1); Opal.defn(self, '$lazy', TMP_51 = function $$lazy() { var $a, $b, TMP_50, self = this; return ($a = ($b = (($scope.get('Enumerator')).$$scope.get('Lazy'))).$new, $a.$$p = (TMP_50 = function(enum$, $c_rest){var self = TMP_50.$$s || this, args, $d; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; }if (enum$ == null) enum$ = nil; return ($d = enum$).$yield.apply($d, Opal.to_a(args))}, TMP_50.$$s = self, TMP_50.$$arity = -2, TMP_50), $a).call($b, self, self.$enumerator_size()); }, TMP_51.$$arity = 0); Opal.defn(self, '$enumerator_size', TMP_52 = function $$enumerator_size() { var $a, self = this; if ((($a = self['$respond_to?']("size")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$size() } else { return nil }; }, TMP_52.$$arity = 0); Opal.alias(self, 'map', 'collect'); Opal.defn(self, '$max', TMP_53 = function $$max(n) { var $a, $b, self = this, $iter = TMP_53.$$p, block = $iter || nil; TMP_53.$$p = null; if (n === undefined || n === nil) { var result, value; self.$each.$$p = function() { var item = $scope.get('Opal').$destructure(arguments); if (result === undefined) { result = item; return; } if (block !== nil) { value = Opal.yieldX(block, [item, result]); } else { value = (item)['$<=>'](result); } if (value === nil) { self.$raise($scope.get('ArgumentError'), "comparison failed"); } if (value > 0) { result = item; } } self.$each(); if (result === undefined) { return nil; } else { return result; } } n = $scope.get('Opal').$coerce_to(n, $scope.get('Integer'), "to_int"); return ($a = ($b = self).$sort, $a.$$p = block.$to_proc(), $a).call($b).$reverse().$first(n); }, TMP_53.$$arity = -1); Opal.defn(self, '$max_by', TMP_54 = function $$max_by() { var $a, $b, TMP_55, self = this, $iter = TMP_54.$$p, block = $iter || nil; TMP_54.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_55 = function(){var self = TMP_55.$$s || this; return self.$enumerator_size()}, TMP_55.$$s = self, TMP_55.$$arity = 0, TMP_55), $a).call($b, "max_by") }; var result, by; self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = Opal.yield1(block, param); if (result === undefined) { result = param; by = value; return; } if ((value)['$<=>'](by) > 0) { result = param by = value; } }; self.$each(); return result === undefined ? nil : result; }, TMP_54.$$arity = 0); Opal.alias(self, 'member?', 'include?'); Opal.defn(self, '$min', TMP_56 = function $$min() { var self = this, $iter = TMP_56.$$p, block = $iter || nil; TMP_56.$$p = null; var result; if (block !== nil) { self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments); if (result === undefined) { result = param; return; } var value = block(param, result); if (value === nil) { self.$raise($scope.get('ArgumentError'), "comparison failed"); } if (value < 0) { result = param; } }; } else { self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments); if (result === undefined) { result = param; return; } if ($scope.get('Opal').$compare(param, result) < 0) { result = param; } }; } self.$each(); return result === undefined ? nil : result; }, TMP_56.$$arity = 0); Opal.defn(self, '$min_by', TMP_57 = function $$min_by() { var $a, $b, TMP_58, self = this, $iter = TMP_57.$$p, block = $iter || nil; TMP_57.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_58 = function(){var self = TMP_58.$$s || this; return self.$enumerator_size()}, TMP_58.$$s = self, TMP_58.$$arity = 0, TMP_58), $a).call($b, "min_by") }; var result, by; self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = Opal.yield1(block, param); if (result === undefined) { result = param; by = value; return; } if ((value)['$<=>'](by) < 0) { result = param by = value; } }; self.$each(); return result === undefined ? nil : result; }, TMP_57.$$arity = 0); Opal.defn(self, '$minmax', TMP_59 = function $$minmax() { var $a, $b, $c, TMP_60, self = this, $iter = TMP_59.$$p, block = $iter || nil; TMP_59.$$p = null; ((($a = block) !== false && $a !== nil && $a != null) ? $a : block = ($b = ($c = self).$proc, $b.$$p = (TMP_60 = function(a, b){var self = TMP_60.$$s || this; if (a == null) a = nil;if (b == null) b = nil; return a['$<=>'](b)}, TMP_60.$$s = self, TMP_60.$$arity = 2, TMP_60), $b).call($c)); var min = nil, max = nil, first_time = true; self.$each.$$p = function() { var element = $scope.get('Opal').$destructure(arguments); if (first_time) { min = max = element; first_time = false; } else { var min_cmp = block.$call(min, element); if (min_cmp === nil) { self.$raise($scope.get('ArgumentError'), "comparison failed") } else if (min_cmp > 0) { min = element; } var max_cmp = block.$call(max, element); if (max_cmp === nil) { self.$raise($scope.get('ArgumentError'), "comparison failed") } else if (max_cmp < 0) { max = element; } } } self.$each(); return [min, max]; }, TMP_59.$$arity = 0); Opal.defn(self, '$minmax_by', TMP_61 = function $$minmax_by() { var self = this, $iter = TMP_61.$$p, block = $iter || nil; TMP_61.$$p = null; return self.$raise($scope.get('NotImplementedError')); }, TMP_61.$$arity = 0); Opal.defn(self, '$none?', TMP_62 = function() {try { var $a, $b, TMP_63, $c, TMP_64, self = this, $iter = TMP_62.$$p, block = $iter || nil; TMP_62.$$p = null; if ((block !== nil)) { ($a = ($b = self).$each, $a.$$p = (TMP_63 = function($c_rest){var self = TMP_63.$$s || this, value, $d; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } value = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { value[$arg_idx - 0] = arguments[$arg_idx]; } if ((($d = Opal.yieldX(block, Opal.to_a(value))) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { Opal.ret(false) } else { return nil }}, TMP_63.$$s = self, TMP_63.$$arity = -1, TMP_63), $a).call($b) } else { ($a = ($c = self).$each, $a.$$p = (TMP_64 = function($d_rest){var self = TMP_64.$$s || this, value, $e; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } value = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { value[$arg_idx - 0] = arguments[$arg_idx]; } if ((($e = $scope.get('Opal').$destructure(value)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { Opal.ret(false) } else { return nil }}, TMP_64.$$s = self, TMP_64.$$arity = -1, TMP_64), $a).call($c) }; return true; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_62.$$arity = 0); Opal.defn(self, '$one?', TMP_65 = function() {try { var $a, $b, TMP_66, $c, TMP_67, self = this, $iter = TMP_65.$$p, block = $iter || nil, count = nil; TMP_65.$$p = null; count = 0; if ((block !== nil)) { ($a = ($b = self).$each, $a.$$p = (TMP_66 = function($c_rest){var self = TMP_66.$$s || this, value, $d; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } value = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { value[$arg_idx - 0] = arguments[$arg_idx]; } if ((($d = Opal.yieldX(block, Opal.to_a(value))) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { count = $rb_plus(count, 1); if ((($d = $rb_gt(count, 1)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { Opal.ret(false) } else { return nil }; } else { return nil }}, TMP_66.$$s = self, TMP_66.$$arity = -1, TMP_66), $a).call($b) } else { ($a = ($c = self).$each, $a.$$p = (TMP_67 = function($d_rest){var self = TMP_67.$$s || this, value, $e; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } value = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { value[$arg_idx - 0] = arguments[$arg_idx]; } if ((($e = $scope.get('Opal').$destructure(value)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { count = $rb_plus(count, 1); if ((($e = $rb_gt(count, 1)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { Opal.ret(false) } else { return nil }; } else { return nil }}, TMP_67.$$s = self, TMP_67.$$arity = -1, TMP_67), $a).call($c) }; return count['$=='](1); } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_65.$$arity = 0); Opal.defn(self, '$partition', TMP_68 = function $$partition() { var $a, $b, TMP_69, self = this, $iter = TMP_68.$$p, block = $iter || nil; TMP_68.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_69 = function(){var self = TMP_69.$$s || this; return self.$enumerator_size()}, TMP_69.$$s = self, TMP_69.$$arity = 0, TMP_69), $a).call($b, "partition") }; var truthy = [], falsy = [], result; self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = Opal.yield1(block, param); if ((($a = value) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { truthy.push(param); } else { falsy.push(param); } }; self.$each(); return [truthy, falsy]; }, TMP_68.$$arity = 0); Opal.alias(self, 'reduce', 'inject'); Opal.defn(self, '$reject', TMP_70 = function $$reject() { var $a, $b, TMP_71, self = this, $iter = TMP_70.$$p, block = $iter || nil; TMP_70.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_71 = function(){var self = TMP_71.$$s || this; return self.$enumerator_size()}, TMP_71.$$s = self, TMP_71.$$arity = 0, TMP_71), $a).call($b, "reject") }; var result = []; self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = Opal.yield1(block, param); if ((($a = value) === nil || $a == null || ($a.$$is_boolean && $a == false))) { result.push(param); } }; self.$each(); return result; }, TMP_70.$$arity = 0); Opal.defn(self, '$reverse_each', TMP_72 = function $$reverse_each() { var $a, $b, TMP_73, self = this, $iter = TMP_72.$$p, block = $iter || nil; TMP_72.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_73 = function(){var self = TMP_73.$$s || this; return self.$enumerator_size()}, TMP_73.$$s = self, TMP_73.$$arity = 0, TMP_73), $a).call($b, "reverse_each") }; var result = []; self.$each.$$p = function() { result.push(arguments); }; self.$each(); for (var i = result.length - 1; i >= 0; i--) { Opal.yieldX(block, result[i]); } return result; }, TMP_72.$$arity = 0); Opal.alias(self, 'select', 'find_all'); Opal.defn(self, '$slice_before', TMP_74 = function $$slice_before(pattern) { var $a, $b, TMP_75, self = this, $iter = TMP_74.$$p, block = $iter || nil; TMP_74.$$p = null; if ((($a = pattern === undefined && block === nil || arguments.length > 1) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " for 1)")}; return ($a = ($b = $scope.get('Enumerator')).$new, $a.$$p = (TMP_75 = function(e){var self = TMP_75.$$s || this, $c; if (e == null) e = nil; var slice = []; if (block !== nil) { if (pattern === undefined) { self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = Opal.yield1(block, param); if ((($c = value) !== nil && $c != null && (!$c.$$is_boolean || $c == true)) && slice.length > 0) { e['$<<'](slice); slice = []; } slice.push(param); }; } else { self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = block(param, pattern.$dup()); if ((($c = value) !== nil && $c != null && (!$c.$$is_boolean || $c == true)) && slice.length > 0) { e['$<<'](slice); slice = []; } slice.push(param); }; } } else { self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = pattern['$==='](param); if ((($c = value) !== nil && $c != null && (!$c.$$is_boolean || $c == true)) && slice.length > 0) { e['$<<'](slice); slice = []; } slice.push(param); }; } self.$each(); if (slice.length > 0) { e['$<<'](slice); } ;}, TMP_75.$$s = self, TMP_75.$$arity = 1, TMP_75), $a).call($b); }, TMP_74.$$arity = -1); Opal.defn(self, '$sort', TMP_76 = function $$sort() { var $a, $b, TMP_77, $c, self = this, $iter = TMP_76.$$p, block = $iter || nil, ary = nil; TMP_76.$$p = null; ary = self.$to_a(); if ((block !== nil)) { } else { block = ($a = ($b = self).$lambda, $a.$$p = (TMP_77 = function(a, b){var self = TMP_77.$$s || this; if (a == null) a = nil;if (b == null) b = nil; return a['$<=>'](b)}, TMP_77.$$s = self, TMP_77.$$arity = 2, TMP_77), $a).call($b) }; return ($a = ($c = ary).$sort, $a.$$p = block.$to_proc(), $a).call($c); }, TMP_76.$$arity = 0); Opal.defn(self, '$sort_by', TMP_78 = function $$sort_by() { var $a, $b, TMP_79, $c, TMP_80, $d, TMP_81, $e, TMP_82, self = this, $iter = TMP_78.$$p, block = $iter || nil, dup = nil; TMP_78.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_79 = function(){var self = TMP_79.$$s || this; return self.$enumerator_size()}, TMP_79.$$s = self, TMP_79.$$arity = 0, TMP_79), $a).call($b, "sort_by") }; dup = ($a = ($c = self).$map, $a.$$p = (TMP_80 = function(){var self = TMP_80.$$s || this, $yielded, arg = nil; arg = $scope.get('Opal').$destructure(arguments); ($yielded = Opal.yield1(block, arg));return [$yielded, arg];}, TMP_80.$$s = self, TMP_80.$$arity = 0, TMP_80), $a).call($c); ($a = ($d = dup)['$sort!'], $a.$$p = (TMP_81 = function(a, b){var self = TMP_81.$$s || this; if (a == null) a = nil;if (b == null) b = nil; return (a[0])['$<=>'](b[0])}, TMP_81.$$s = self, TMP_81.$$arity = 2, TMP_81), $a).call($d); return ($a = ($e = dup)['$map!'], $a.$$p = (TMP_82 = function(i){var self = TMP_82.$$s || this; if (i == null) i = nil; return i[1];}, TMP_82.$$s = self, TMP_82.$$arity = 1, TMP_82), $a).call($e); }, TMP_78.$$arity = 0); Opal.defn(self, '$take', TMP_83 = function $$take(num) { var self = this; return self.$first(num); }, TMP_83.$$arity = 1); Opal.defn(self, '$take_while', TMP_84 = function $$take_while() {try { var $a, $b, TMP_85, self = this, $iter = TMP_84.$$p, block = $iter || nil, result = nil; TMP_84.$$p = null; if (block !== false && block !== nil && block != null) { } else { return self.$enum_for("take_while") }; result = []; return ($a = ($b = self).$each, $a.$$p = (TMP_85 = function($c_rest){var self = TMP_85.$$s || this, args, $d, value = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } value = $scope.get('Opal').$destructure(args); if ((($d = Opal.yield1(block, value)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { } else { Opal.ret(result) }; return result.push(value);}, TMP_85.$$s = self, TMP_85.$$arity = -1, TMP_85), $a).call($b); } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_84.$$arity = 0); Opal.alias(self, 'to_a', 'entries'); Opal.defn(self, '$zip', TMP_86 = function $$zip($a_rest) { var $b, self = this, others, $iter = TMP_86.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } others = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { others[$arg_idx - 0] = arguments[$arg_idx]; } TMP_86.$$p = null; return ($b = self.$to_a()).$zip.apply($b, Opal.to_a(others)); }, TMP_86.$$arity = -1); })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/enumerator"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$include', '$allocate', '$new', '$to_proc', '$coerce_to', '$nil?', '$empty?', '$+', '$class', '$__send__', '$===', '$call', '$enum_for', '$size', '$destructure', '$inspect', '$[]', '$raise', '$yield', '$each', '$enumerator_size', '$respond_to?', '$try_convert', '$<', '$for']); self.$require("corelib/enumerable"); return (function($base, $super) { function $Enumerator(){}; var self = $Enumerator = $klass($base, $super, 'Enumerator', $Enumerator); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_7; def.size = def.args = def.object = def.method = nil; self.$include($scope.get('Enumerable')); def.$$is_enumerator = true; Opal.defs(self, '$for', TMP_1 = function(object, method, $a_rest) { var self = this, args, $iter = TMP_1.$$p, block = $iter || nil; if (method == null) { method = "each"; } var $args_len = arguments.length, $rest_len = $args_len - 2; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 2; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 2] = arguments[$arg_idx]; } TMP_1.$$p = null; var obj = self.$allocate(); obj.object = object; obj.size = block; obj.method = method; obj.args = args; return obj; ; }, TMP_1.$$arity = -2); Opal.defn(self, '$initialize', TMP_2 = function $$initialize($a_rest) { var $b, $c, self = this, $iter = TMP_2.$$p, block = $iter || nil; TMP_2.$$p = null; if (block !== false && block !== nil && block != null) { self.object = ($b = ($c = $scope.get('Generator')).$new, $b.$$p = block.$to_proc(), $b).call($c); self.method = "each"; self.args = []; self.size = arguments[0] || nil; if ((($b = self.size) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.size = $scope.get('Opal').$coerce_to(self.size, $scope.get('Integer'), "to_int") } else { return nil }; } else { self.object = arguments[0]; self.method = arguments[1] || "each"; self.args = $slice.call(arguments, 2); return self.size = nil; }; }, TMP_2.$$arity = -1); Opal.defn(self, '$each', TMP_3 = function $$each($a_rest) { var $b, $c, $d, self = this, args, $iter = TMP_3.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_3.$$p = null; if ((($b = ($c = block['$nil?'](), $c !== false && $c !== nil && $c != null ?args['$empty?']() : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self}; args = $rb_plus(self.args, args); if ((($b = block['$nil?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return ($b = self.$class()).$new.apply($b, [self.object, self.method].concat(Opal.to_a(args)))}; return ($c = ($d = self.object).$__send__, $c.$$p = block.$to_proc(), $c).apply($d, [self.method].concat(Opal.to_a(args))); }, TMP_3.$$arity = -1); Opal.defn(self, '$size', TMP_4 = function $$size() { var $a, self = this; if ((($a = $scope.get('Proc')['$==='](self.size)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = self.size).$call.apply($a, Opal.to_a(self.args)) } else { return self.size }; }, TMP_4.$$arity = 0); Opal.defn(self, '$with_index', TMP_5 = function $$with_index(offset) { var $a, $b, TMP_6, self = this, $iter = TMP_5.$$p, block = $iter || nil; if (offset == null) { offset = 0; } TMP_5.$$p = null; if (offset !== false && offset !== nil && offset != null) { offset = $scope.get('Opal').$coerce_to(offset, $scope.get('Integer'), "to_int") } else { offset = 0 }; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_6 = function(){var self = TMP_6.$$s || this; return self.$size()}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6), $a).call($b, "with_index", offset) }; var result, index = offset; self.$each.$$p = function() { var param = $scope.get('Opal').$destructure(arguments), value = block(param, index); index++; return value; } return self.$each(); }, TMP_5.$$arity = -1); Opal.alias(self, 'with_object', 'each_with_object'); Opal.defn(self, '$inspect', TMP_7 = function $$inspect() { var $a, self = this, result = nil; result = "#<" + (self.$class()) + ": " + (self.object.$inspect()) + ":" + (self.method); if ((($a = self.args['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { result = $rb_plus(result, "(" + (self.args.$inspect()['$[]']($scope.get('Range').$new(1, -2))) + ")") }; return $rb_plus(result, ">"); }, TMP_7.$$arity = 0); (function($base, $super) { function $Generator(){}; var self = $Generator = $klass($base, $super, 'Generator', $Generator); var def = self.$$proto, $scope = self.$$scope, TMP_8, TMP_9; def.block = nil; self.$include($scope.get('Enumerable')); Opal.defn(self, '$initialize', TMP_8 = function $$initialize() { var self = this, $iter = TMP_8.$$p, block = $iter || nil; TMP_8.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('LocalJumpError'), "no block given") }; return self.block = block; }, TMP_8.$$arity = 0); return (Opal.defn(self, '$each', TMP_9 = function $$each($a_rest) { var $b, $c, self = this, args, $iter = TMP_9.$$p, block = $iter || nil, yielder = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_9.$$p = null; yielder = ($b = ($c = $scope.get('Yielder')).$new, $b.$$p = block.$to_proc(), $b).call($c); try { args.unshift(yielder); Opal.yieldX(self.block, args); } catch (e) { if (e === $breaker) { return $breaker.$v; } else { throw e; } } ; return self; }, TMP_9.$$arity = -1), nil) && 'each'; })($scope.base, null); (function($base, $super) { function $Yielder(){}; var self = $Yielder = $klass($base, $super, 'Yielder', $Yielder); var def = self.$$proto, $scope = self.$$scope, TMP_10, TMP_11, TMP_12; def.block = nil; Opal.defn(self, '$initialize', TMP_10 = function $$initialize() { var self = this, $iter = TMP_10.$$p, block = $iter || nil; TMP_10.$$p = null; return self.block = block; }, TMP_10.$$arity = 0); Opal.defn(self, '$yield', TMP_11 = function($a_rest) { var self = this, values; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } values = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { values[$arg_idx - 0] = arguments[$arg_idx]; } var value = Opal.yieldX(self.block, values); if (value === $breaker) { throw $breaker; } return value; ; }, TMP_11.$$arity = -1); return (Opal.defn(self, '$<<', TMP_12 = function($a_rest) { var $b, self = this, values; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } values = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { values[$arg_idx - 0] = arguments[$arg_idx]; } ($b = self).$yield.apply($b, Opal.to_a(values)); return self; }, TMP_12.$$arity = -1), nil) && '<<'; })($scope.base, null); return (function($base, $super) { function $Lazy(){}; var self = $Lazy = $klass($base, $super, 'Lazy', $Lazy); var def = self.$$proto, $scope = self.$$scope, TMP_13, TMP_16, TMP_17, TMP_19, TMP_24, TMP_25, TMP_27, TMP_28, TMP_30, TMP_33, TMP_36, TMP_37, TMP_39; def.enumerator = nil; (function($base, $super) { function $StopLazyError(){}; var self = $StopLazyError = $klass($base, $super, 'StopLazyError', $StopLazyError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('Exception')); Opal.defn(self, '$initialize', TMP_13 = function $$initialize(object, size) { var $a, $b, TMP_14, self = this, $iter = TMP_13.$$p, block = $iter || nil; if (size == null) { size = nil; } TMP_13.$$p = null; if ((block !== nil)) { } else { self.$raise($scope.get('ArgumentError'), "tried to call lazy new without a block") }; self.enumerator = object; return ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_13, false)), $a.$$p = (TMP_14 = function(yielder, $c_rest){var self = TMP_14.$$s || this, each_args, $d, $e, TMP_15; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } each_args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { each_args[$arg_idx - 1] = arguments[$arg_idx]; }if (yielder == null) yielder = nil; try { return ($d = ($e = object).$each, $d.$$p = (TMP_15 = function($c_rest){var self = TMP_15.$$s || this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } args.unshift(yielder); Opal.yieldX(block, args); ;}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15), $d).apply($e, Opal.to_a(each_args)) } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) { try { return nil } finally { Opal.pop_exception() } } else { throw $err; } }}, TMP_14.$$s = self, TMP_14.$$arity = -2, TMP_14), $a).call($b, size); }, TMP_13.$$arity = -2); Opal.alias(self, 'force', 'to_a'); Opal.defn(self, '$lazy', TMP_16 = function $$lazy() { var self = this; return self; }, TMP_16.$$arity = 0); Opal.defn(self, '$collect', TMP_17 = function $$collect() { var $a, $b, TMP_18, self = this, $iter = TMP_17.$$p, block = $iter || nil; TMP_17.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "tried to call lazy map without a block") }; return ($a = ($b = $scope.get('Lazy')).$new, $a.$$p = (TMP_18 = function(enum$, $c_rest){var self = TMP_18.$$s || this, args; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; }if (enum$ == null) enum$ = nil; var value = Opal.yieldX(block, args); enum$.$yield(value); }, TMP_18.$$s = self, TMP_18.$$arity = -2, TMP_18), $a).call($b, self, self.$enumerator_size()); }, TMP_17.$$arity = 0); Opal.defn(self, '$collect_concat', TMP_19 = function $$collect_concat() { var $a, $b, TMP_20, self = this, $iter = TMP_19.$$p, block = $iter || nil; TMP_19.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "tried to call lazy map without a block") }; return ($a = ($b = $scope.get('Lazy')).$new, $a.$$p = (TMP_20 = function(enum$, $c_rest){var self = TMP_20.$$s || this, args, $d, $e, TMP_21, $f, TMP_22; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; }if (enum$ == null) enum$ = nil; var value = Opal.yieldX(block, args); if ((value)['$respond_to?']("force") && (value)['$respond_to?']("each")) { ($d = ($e = (value)).$each, $d.$$p = (TMP_21 = function(v){var self = TMP_21.$$s || this; if (v == null) v = nil; return enum$.$yield(v)}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21), $d).call($e) } else { var array = $scope.get('Opal').$try_convert(value, $scope.get('Array'), "to_ary"); if (array === nil) { enum$.$yield(value); } else { ($d = ($f = (value)).$each, $d.$$p = (TMP_22 = function(v){var self = TMP_22.$$s || this; if (v == null) v = nil; return enum$.$yield(v)}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22), $d).call($f); } } ;}, TMP_20.$$s = self, TMP_20.$$arity = -2, TMP_20), $a).call($b, self, nil); }, TMP_19.$$arity = 0); Opal.defn(self, '$drop', TMP_24 = function $$drop(n) { var $a, $b, TMP_23, self = this, current_size = nil, set_size = nil, dropped = nil; n = $scope.get('Opal').$coerce_to(n, $scope.get('Integer'), "to_int"); if ((($a = $rb_lt(n, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "attempt to drop negative size")}; current_size = self.$enumerator_size(); set_size = (function() {if ((($a = $scope.get('Integer')['$==='](current_size)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $rb_lt(n, current_size)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return n } else { return current_size } } else { return current_size }; return nil; })(); dropped = 0; return ($a = ($b = $scope.get('Lazy')).$new, $a.$$p = (TMP_23 = function(enum$, $c_rest){var self = TMP_23.$$s || this, args, $d; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; }if (enum$ == null) enum$ = nil; if ((($d = $rb_lt(dropped, n)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return dropped = $rb_plus(dropped, 1) } else { return ($d = enum$).$yield.apply($d, Opal.to_a(args)) }}, TMP_23.$$s = self, TMP_23.$$arity = -2, TMP_23), $a).call($b, self, set_size); }, TMP_24.$$arity = 1); Opal.defn(self, '$drop_while', TMP_25 = function $$drop_while() { var $a, $b, TMP_26, self = this, $iter = TMP_25.$$p, block = $iter || nil, succeeding = nil; TMP_25.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "tried to call lazy drop_while without a block") }; succeeding = true; return ($a = ($b = $scope.get('Lazy')).$new, $a.$$p = (TMP_26 = function(enum$, $c_rest){var self = TMP_26.$$s || this, args, $d, $e; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; }if (enum$ == null) enum$ = nil; if (succeeding !== false && succeeding !== nil && succeeding != null) { var value = Opal.yieldX(block, args); if ((($d = value) === nil || $d == null || ($d.$$is_boolean && $d == false))) { succeeding = false; ($d = enum$).$yield.apply($d, Opal.to_a(args)); } } else { return ($e = enum$).$yield.apply($e, Opal.to_a(args)) }}, TMP_26.$$s = self, TMP_26.$$arity = -2, TMP_26), $a).call($b, self, nil); }, TMP_25.$$arity = 0); Opal.defn(self, '$enum_for', TMP_27 = function $$enum_for(method, $a_rest) { var $b, $c, self = this, args, $iter = TMP_27.$$p, block = $iter || nil; if (method == null) { method = "each"; } var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_27.$$p = null; return ($b = ($c = self.$class()).$for, $b.$$p = block.$to_proc(), $b).apply($c, [self, method].concat(Opal.to_a(args))); }, TMP_27.$$arity = -1); Opal.defn(self, '$find_all', TMP_28 = function $$find_all() { var $a, $b, TMP_29, self = this, $iter = TMP_28.$$p, block = $iter || nil; TMP_28.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "tried to call lazy select without a block") }; return ($a = ($b = $scope.get('Lazy')).$new, $a.$$p = (TMP_29 = function(enum$, $c_rest){var self = TMP_29.$$s || this, args, $d; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; }if (enum$ == null) enum$ = nil; var value = Opal.yieldX(block, args); if ((($d = value) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { ($d = enum$).$yield.apply($d, Opal.to_a(args)); } ;}, TMP_29.$$s = self, TMP_29.$$arity = -2, TMP_29), $a).call($b, self, nil); }, TMP_28.$$arity = 0); Opal.alias(self, 'flat_map', 'collect_concat'); Opal.defn(self, '$grep', TMP_30 = function $$grep(pattern) { var $a, $b, TMP_31, $c, TMP_32, self = this, $iter = TMP_30.$$p, block = $iter || nil; TMP_30.$$p = null; if (block !== false && block !== nil && block != null) { return ($a = ($b = $scope.get('Lazy')).$new, $a.$$p = (TMP_31 = function(enum$, $c_rest){var self = TMP_31.$$s || this, args, $d; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; }if (enum$ == null) enum$ = nil; var param = $scope.get('Opal').$destructure(args), value = pattern['$==='](param); if ((($d = value) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { value = Opal.yield1(block, param); enum$.$yield(Opal.yield1(block, param)); } ;}, TMP_31.$$s = self, TMP_31.$$arity = -2, TMP_31), $a).call($b, self, nil) } else { return ($a = ($c = $scope.get('Lazy')).$new, $a.$$p = (TMP_32 = function(enum$, $d_rest){var self = TMP_32.$$s || this, args, $e; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; }if (enum$ == null) enum$ = nil; var param = $scope.get('Opal').$destructure(args), value = pattern['$==='](param); if ((($e = value) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { enum$.$yield(param); } ;}, TMP_32.$$s = self, TMP_32.$$arity = -2, TMP_32), $a).call($c, self, nil) }; }, TMP_30.$$arity = 1); Opal.alias(self, 'map', 'collect'); Opal.alias(self, 'select', 'find_all'); Opal.defn(self, '$reject', TMP_33 = function $$reject() { var $a, $b, TMP_34, self = this, $iter = TMP_33.$$p, block = $iter || nil; TMP_33.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "tried to call lazy reject without a block") }; return ($a = ($b = $scope.get('Lazy')).$new, $a.$$p = (TMP_34 = function(enum$, $c_rest){var self = TMP_34.$$s || this, args, $d; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; }if (enum$ == null) enum$ = nil; var value = Opal.yieldX(block, args); if ((($d = value) === nil || $d == null || ($d.$$is_boolean && $d == false))) { ($d = enum$).$yield.apply($d, Opal.to_a(args)); } ;}, TMP_34.$$s = self, TMP_34.$$arity = -2, TMP_34), $a).call($b, self, nil); }, TMP_33.$$arity = 0); Opal.defn(self, '$take', TMP_36 = function $$take(n) { var $a, $b, TMP_35, self = this, current_size = nil, set_size = nil, taken = nil; n = $scope.get('Opal').$coerce_to(n, $scope.get('Integer'), "to_int"); if ((($a = $rb_lt(n, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "attempt to take negative size")}; current_size = self.$enumerator_size(); set_size = (function() {if ((($a = $scope.get('Integer')['$==='](current_size)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $rb_lt(n, current_size)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return n } else { return current_size } } else { return current_size }; return nil; })(); taken = 0; return ($a = ($b = $scope.get('Lazy')).$new, $a.$$p = (TMP_35 = function(enum$, $c_rest){var self = TMP_35.$$s || this, args, $d; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; }if (enum$ == null) enum$ = nil; if ((($d = $rb_lt(taken, n)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { ($d = enum$).$yield.apply($d, Opal.to_a(args)); return taken = $rb_plus(taken, 1); } else { return self.$raise($scope.get('StopLazyError')) }}, TMP_35.$$s = self, TMP_35.$$arity = -2, TMP_35), $a).call($b, self, set_size); }, TMP_36.$$arity = 1); Opal.defn(self, '$take_while', TMP_37 = function $$take_while() { var $a, $b, TMP_38, self = this, $iter = TMP_37.$$p, block = $iter || nil; TMP_37.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "tried to call lazy take_while without a block") }; return ($a = ($b = $scope.get('Lazy')).$new, $a.$$p = (TMP_38 = function(enum$, $c_rest){var self = TMP_38.$$s || this, args, $d; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; }if (enum$ == null) enum$ = nil; var value = Opal.yieldX(block, args); if ((($d = value) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { ($d = enum$).$yield.apply($d, Opal.to_a(args)); } else { self.$raise($scope.get('StopLazyError')); } ;}, TMP_38.$$s = self, TMP_38.$$arity = -2, TMP_38), $a).call($b, self, nil); }, TMP_37.$$arity = 0); Opal.alias(self, 'to_enum', 'enum_for'); return (Opal.defn(self, '$inspect', TMP_39 = function $$inspect() { var self = this; return "#<" + (self.$class()) + ": " + (self.enumerator.$inspect()) + ">"; }, TMP_39.$$arity = 0), nil) && 'inspect'; })($scope.base, self); })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/numeric"] = function(Opal) { function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_divide(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$include', '$instance_of?', '$class', '$Float', '$coerce', '$===', '$raise', '$__send__', '$equal?', '$coerce_to!', '$-@', '$**', '$-', '$*', '$div', '$<', '$ceil', '$to_f', '$denominator', '$to_r', '$==', '$floor', '$/', '$%', '$Complex', '$zero?', '$numerator', '$abs', '$arg', '$round', '$to_i', '$truncate', '$>']); self.$require("corelib/comparable"); return (function($base, $super) { function $Numeric(){}; var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36; self.$include($scope.get('Comparable')); Opal.defn(self, '$coerce', TMP_1 = function $$coerce(other) { var $a, self = this; if ((($a = other['$instance_of?'](self.$class())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [other, self]}; return [self.$Float(other), self.$Float(self)]; }, TMP_1.$$arity = 1); Opal.defn(self, '$__coerced__', TMP_2 = function $$__coerced__(method, other) { var $a, $b, self = this, a = nil, b = nil, $case = nil; try { $b = other.$coerce(self), $a = Opal.to_ary($b), a = ($a[0] == null ? nil : $a[0]), b = ($a[1] == null ? nil : $a[1]), $b } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { try { $case = method;if ("+"['$===']($case) || "-"['$===']($case) || "*"['$===']($case) || "/"['$===']($case) || "%"['$===']($case) || "&"['$===']($case) || "|"['$===']($case) || "^"['$===']($case) || "**"['$===']($case)) {self.$raise($scope.get('TypeError'), "" + (other.$class()) + " can't be coerce into Numeric")}else if (">"['$===']($case) || ">="['$===']($case) || "<"['$===']($case) || "<="['$===']($case) || "<=>"['$===']($case)) {self.$raise($scope.get('ArgumentError'), "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")} } finally { Opal.pop_exception() } } else { throw $err; } }; return a.$__send__(method, b); }, TMP_2.$$arity = 2); Opal.defn(self, '$<=>', TMP_3 = function(other) { var $a, self = this; if ((($a = self['$equal?'](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return 0}; return nil; }, TMP_3.$$arity = 1); Opal.defn(self, '$[]', TMP_4 = function(bit) { var self = this, min = nil, max = nil; bit = $scope.get('Opal')['$coerce_to!'](bit, $scope.get('Integer'), "to_int"); min = ((2)['$**'](30))['$-@'](); max = $rb_minus(((2)['$**'](30)), 1); return (bit < min || bit > max) ? 0 : (self >> bit) % 2; }, TMP_4.$$arity = 1); Opal.defn(self, '$+@', TMP_5 = function() { var self = this; return self; }, TMP_5.$$arity = 0); Opal.defn(self, '$-@', TMP_6 = function() { var self = this; return $rb_minus(0, self); }, TMP_6.$$arity = 0); Opal.defn(self, '$%', TMP_7 = function(other) { var self = this; return $rb_minus(self, $rb_times(other, self.$div(other))); }, TMP_7.$$arity = 1); Opal.defn(self, '$abs', TMP_8 = function $$abs() { var self = this; if ($rb_lt(self, 0)) { return self['$-@']() } else { return self }; }, TMP_8.$$arity = 0); Opal.defn(self, '$abs2', TMP_9 = function $$abs2() { var self = this; return $rb_times(self, self); }, TMP_9.$$arity = 0); Opal.defn(self, '$angle', TMP_10 = function $$angle() { var self = this; if ($rb_lt(self, 0)) { return (($scope.get('Math')).$$scope.get('PI')) } else { return 0 }; }, TMP_10.$$arity = 0); Opal.alias(self, 'arg', 'angle'); Opal.defn(self, '$ceil', TMP_11 = function $$ceil() { var self = this; return self.$to_f().$ceil(); }, TMP_11.$$arity = 0); Opal.defn(self, '$conj', TMP_12 = function $$conj() { var self = this; return self; }, TMP_12.$$arity = 0); Opal.alias(self, 'conjugate', 'conj'); Opal.defn(self, '$denominator', TMP_13 = function $$denominator() { var self = this; return self.$to_r().$denominator(); }, TMP_13.$$arity = 0); Opal.defn(self, '$div', TMP_14 = function $$div(other) { var self = this; if (other['$=='](0)) { self.$raise($scope.get('ZeroDivisionError'), "divided by o")}; return ($rb_divide(self, other)).$floor(); }, TMP_14.$$arity = 1); Opal.defn(self, '$divmod', TMP_15 = function $$divmod(other) { var self = this; return [self.$div(other), self['$%'](other)]; }, TMP_15.$$arity = 1); Opal.defn(self, '$fdiv', TMP_16 = function $$fdiv(other) { var self = this; return $rb_divide(self.$to_f(), other); }, TMP_16.$$arity = 1); Opal.defn(self, '$floor', TMP_17 = function $$floor() { var self = this; return self.$to_f().$floor(); }, TMP_17.$$arity = 0); Opal.defn(self, '$i', TMP_18 = function $$i() { var self = this; return self.$Complex(0, self); }, TMP_18.$$arity = 0); Opal.defn(self, '$imag', TMP_19 = function $$imag() { var self = this; return 0; }, TMP_19.$$arity = 0); Opal.alias(self, 'imaginary', 'imag'); Opal.defn(self, '$integer?', TMP_20 = function() { var self = this; return false; }, TMP_20.$$arity = 0); Opal.alias(self, 'magnitude', 'abs'); Opal.alias(self, 'modulo', '%'); Opal.defn(self, '$nonzero?', TMP_21 = function() { var $a, self = this; if ((($a = self['$zero?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return self }; }, TMP_21.$$arity = 0); Opal.defn(self, '$numerator', TMP_22 = function $$numerator() { var self = this; return self.$to_r().$numerator(); }, TMP_22.$$arity = 0); Opal.alias(self, 'phase', 'arg'); Opal.defn(self, '$polar', TMP_23 = function $$polar() { var self = this; return [self.$abs(), self.$arg()]; }, TMP_23.$$arity = 0); Opal.defn(self, '$quo', TMP_24 = function $$quo(other) { var self = this; return $rb_divide($scope.get('Opal')['$coerce_to!'](self, $scope.get('Rational'), "to_r"), other); }, TMP_24.$$arity = 1); Opal.defn(self, '$real', TMP_25 = function $$real() { var self = this; return self; }, TMP_25.$$arity = 0); Opal.defn(self, '$real?', TMP_26 = function() { var self = this; return true; }, TMP_26.$$arity = 0); Opal.defn(self, '$rect', TMP_27 = function $$rect() { var self = this; return [self, 0]; }, TMP_27.$$arity = 0); Opal.alias(self, 'rectangular', 'rect'); Opal.defn(self, '$round', TMP_28 = function $$round(digits) { var self = this; return self.$to_f().$round(digits); }, TMP_28.$$arity = -1); Opal.defn(self, '$to_c', TMP_29 = function $$to_c() { var self = this; return self.$Complex(self, 0); }, TMP_29.$$arity = 0); Opal.defn(self, '$to_int', TMP_30 = function $$to_int() { var self = this; return self.$to_i(); }, TMP_30.$$arity = 0); Opal.defn(self, '$truncate', TMP_31 = function $$truncate() { var self = this; return self.$to_f().$truncate(); }, TMP_31.$$arity = 0); Opal.defn(self, '$zero?', TMP_32 = function() { var self = this; return self['$=='](0); }, TMP_32.$$arity = 0); Opal.defn(self, '$positive?', TMP_33 = function() { var self = this; return $rb_gt(self, 0); }, TMP_33.$$arity = 0); Opal.defn(self, '$negative?', TMP_34 = function() { var self = this; return $rb_lt(self, 0); }, TMP_34.$$arity = 0); Opal.defn(self, '$dup', TMP_35 = function $$dup() { var self = this; return self.$raise($scope.get('TypeError'), "can't dup " + (self.$class())); }, TMP_35.$$arity = 0); return (Opal.defn(self, '$clone', TMP_36 = function $$clone() { var self = this; return self.$raise($scope.get('TypeError'), "can't clone " + (self.$class())); }, TMP_36.$$arity = 0), nil) && 'clone'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/array"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } function $rb_ge(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); } function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $gvars = Opal.gvars; Opal.add_stubs(['$require', '$include', '$to_a', '$raise', '$===', '$replace', '$respond_to?', '$to_ary', '$coerce_to', '$coerce_to?', '$join', '$to_str', '$class', '$clone', '$hash', '$<=>', '$==', '$object_id', '$inspect', '$enum_for', '$coerce_to!', '$>', '$*', '$enumerator_size', '$empty?', '$size', '$eql?', '$length', '$begin', '$end', '$exclude_end?', '$flatten', '$__id__', '$[]', '$to_s', '$new', '$!', '$>=', '$**', '$delete_if', '$to_proc', '$each', '$reverse', '$rotate', '$rand', '$at', '$keep_if', '$shuffle!', '$dup', '$<', '$sort', '$sort_by', '$!=', '$times', '$[]=', '$<<', '$values', '$kind_of?', '$last', '$first', '$upto', '$reject', '$pristine']); self.$require("corelib/enumerable"); self.$require("corelib/numeric"); return (function($base, $super) { function $Array(){}; var self = $Array = $klass($base, $super, 'Array', $Array); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_19, TMP_20, TMP_21, TMP_22, TMP_24, TMP_26, TMP_28, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_37, TMP_38, TMP_39, TMP_41, TMP_43, TMP_44, TMP_45, TMP_46, TMP_47, TMP_48, TMP_49, TMP_50, TMP_51, TMP_52, TMP_53, TMP_54, TMP_55, TMP_56, TMP_58, TMP_59, TMP_60, TMP_62, TMP_64, TMP_65, TMP_66, TMP_67, TMP_68, TMP_70, TMP_72, TMP_73, TMP_74, TMP_75, TMP_77, TMP_78, TMP_79, TMP_82, TMP_83, TMP_85, TMP_87, TMP_88, TMP_89, TMP_90, TMP_91, TMP_92, TMP_93, TMP_95, TMP_96, TMP_97, TMP_98, TMP_101, TMP_102, TMP_103, TMP_104, TMP_107, TMP_108, TMP_109, TMP_111; def.length = nil; self.$include($scope.get('Enumerable')); def.$$is_array = true; function toArraySubclass(obj, klass) { if (klass.$$name === Opal.Array) { return obj; } else { return klass.$allocate().$replace((obj).$to_a()); } } Opal.defs(self, '$[]', TMP_1 = function($a_rest) { var self = this, objects; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } objects = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { objects[$arg_idx - 0] = arguments[$arg_idx]; } return toArraySubclass(objects, self); }, TMP_1.$$arity = -1); Opal.defn(self, '$initialize', TMP_2 = function $$initialize(size, obj) { var $a, self = this, $iter = TMP_2.$$p, block = $iter || nil; if (size == null) { size = nil; } if (obj == null) { obj = nil; } TMP_2.$$p = null; if ((($a = arguments.length > 2) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " for 0..2)")}; if (arguments.length === 0) { self.splice(0, self.length); return self; } if ((($a = arguments.length === 1) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $scope.get('Array')['$==='](size)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$replace(size.$to_a()); return self; } else if ((($a = size['$respond_to?']("to_ary")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$replace(size.$to_ary()); return self;}}; size = $scope.get('Opal').$coerce_to(size, $scope.get('Integer'), "to_int"); if ((($a = size < 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "negative array size")}; self.splice(0, self.length); var i, value; if (block === nil) { for (i = 0; i < size; i++) { self.push(obj); } } else { for (i = 0, value; i < size; i++) { value = block(i); self[i] = value; } } return self; }, TMP_2.$$arity = -1); Opal.defs(self, '$try_convert', TMP_3 = function $$try_convert(obj) { var self = this; return $scope.get('Opal')['$coerce_to?'](obj, $scope.get('Array'), "to_ary"); }, TMP_3.$$arity = 1); Opal.defn(self, '$&', TMP_4 = function(other) { var $a, self = this; if ((($a = $scope.get('Array')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { other = other.$to_a() } else { other = $scope.get('Opal').$coerce_to(other, $scope.get('Array'), "to_ary").$to_a() }; var result = [], hash = $hash2([], {}), i, length, item; for (i = 0, length = other.length; i < length; i++) { Opal.hash_put(hash, other[i], true); } for (i = 0, length = self.length; i < length; i++) { item = self[i]; if (Opal.hash_delete(hash, item) !== undefined) { result.push(item); } } return result; ; }, TMP_4.$$arity = 1); Opal.defn(self, '$|', TMP_5 = function(other) { var $a, self = this; if ((($a = $scope.get('Array')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { other = other.$to_a() } else { other = $scope.get('Opal').$coerce_to(other, $scope.get('Array'), "to_ary").$to_a() }; var hash = $hash2([], {}), i, length, item; for (i = 0, length = self.length; i < length; i++) { Opal.hash_put(hash, self[i], true); } for (i = 0, length = other.length; i < length; i++) { Opal.hash_put(hash, other[i], true); } return hash.$keys(); ; }, TMP_5.$$arity = 1); Opal.defn(self, '$*', TMP_6 = function(other) { var $a, self = this; if ((($a = other['$respond_to?']("to_str")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$join(other.$to_str())}; other = $scope.get('Opal').$coerce_to(other, $scope.get('Integer'), "to_int"); if ((($a = other < 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "negative argument")}; var result = [], converted = self.$to_a(); for (var i = 0; i < other; i++) { result = result.concat(converted); } return toArraySubclass(result, self.$class()); ; }, TMP_6.$$arity = 1); Opal.defn(self, '$+', TMP_7 = function(other) { var $a, self = this; if ((($a = $scope.get('Array')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { other = other.$to_a() } else { other = $scope.get('Opal').$coerce_to(other, $scope.get('Array'), "to_ary").$to_a() }; return self.concat(other); }, TMP_7.$$arity = 1); Opal.defn(self, '$-', TMP_8 = function(other) { var $a, self = this; if ((($a = $scope.get('Array')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { other = other.$to_a() } else { other = $scope.get('Opal').$coerce_to(other, $scope.get('Array'), "to_ary").$to_a() }; if ((($a = self.length === 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return []}; if ((($a = other.length === 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$clone().$to_a()}; var result = [], hash = $hash2([], {}), i, length, item; for (i = 0, length = other.length; i < length; i++) { Opal.hash_put(hash, other[i], true); } for (i = 0, length = self.length; i < length; i++) { item = self[i]; if (Opal.hash_get(hash, item) === undefined) { result.push(item); } } return result; ; }, TMP_8.$$arity = 1); Opal.defn(self, '$<<', TMP_9 = function(object) { var self = this; self.push(object); return self; }, TMP_9.$$arity = 1); Opal.defn(self, '$<=>', TMP_10 = function(other) { var $a, self = this; if ((($a = $scope.get('Array')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { other = other.$to_a() } else if ((($a = other['$respond_to?']("to_ary")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { other = other.$to_ary().$to_a() } else { return nil }; if (self.$hash() === other.$hash()) { return 0; } var count = Math.min(self.length, other.length); for (var i = 0; i < count; i++) { var tmp = (self[i])['$<=>'](other[i]); if (tmp !== 0) { return tmp; } } return (self.length)['$<=>'](other.length); ; }, TMP_10.$$arity = 1); Opal.defn(self, '$==', TMP_11 = function(other) { var self = this; var recursed = {}; function _eqeq(array, other) { var i, length, a, b; if (array === other) return true; if (!other.$$is_array) { if ($scope.get('Opal')['$respond_to?'](other, "to_ary")) { return (other)['$=='](array); } else { return false; } } if (array.constructor !== Array) array = (array).$to_a(); if (other.constructor !== Array) other = (other).$to_a(); if (array.length !== other.length) { return false; } recursed[(array).$object_id()] = true; for (i = 0, length = array.length; i < length; i++) { a = array[i]; b = other[i]; if (a.$$is_array) { if (b.$$is_array && b.length !== a.length) { return false; } if (!recursed.hasOwnProperty((a).$object_id())) { if (!_eqeq(a, b)) { return false; } } } else { if (!(a)['$=='](b)) { return false; } } } return true; } return _eqeq(self, other); ; }, TMP_11.$$arity = 1); Opal.defn(self, '$[]', TMP_12 = function(index, length) { var self = this; var size = self.length, exclude, from, to, result; if (index.$$is_range) { exclude = index.exclude; from = $scope.get('Opal').$coerce_to(index.begin, $scope.get('Integer'), "to_int"); to = $scope.get('Opal').$coerce_to(index.end, $scope.get('Integer'), "to_int"); if (from < 0) { from += size; if (from < 0) { return nil; } } if (from > size) { return nil; } if (to < 0) { to += size; if (to < 0) { return []; } } if (!exclude) { to += 1; } result = self.slice(from, to) } else { index = $scope.get('Opal').$coerce_to(index, $scope.get('Integer'), "to_int"); if (index < 0) { index += size; if (index < 0) { return nil; } } if (length === undefined) { if (index >= size || index < 0) { return nil; } return self[index]; } else { length = $scope.get('Opal').$coerce_to(length, $scope.get('Integer'), "to_int"); if (length < 0 || index > size || index < 0) { return nil; } result = self.slice(index, index + length); } } return toArraySubclass(result, self.$class()) ; }, TMP_12.$$arity = -2); Opal.defn(self, '$[]=', TMP_13 = function(index, value, extra) { var $a, self = this, data = nil, length = nil; var i, size = self.length; if ((($a = $scope.get('Range')['$==='](index)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $scope.get('Array')['$==='](value)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = value.$to_a() } else if ((($a = value['$respond_to?']("to_ary")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = value.$to_ary().$to_a() } else { data = [value] }; var exclude = index.exclude, from = $scope.get('Opal').$coerce_to(index.begin, $scope.get('Integer'), "to_int"), to = $scope.get('Opal').$coerce_to(index.end, $scope.get('Integer'), "to_int"); if (from < 0) { from += size; if (from < 0) { self.$raise($scope.get('RangeError'), "" + (index.$inspect()) + " out of range"); } } if (to < 0) { to += size; } if (!exclude) { to += 1; } if (from > size) { for (i = size; i < from; i++) { self[i] = nil; } } if (to < 0) { self.splice.apply(self, [from, 0].concat(data)); } else { self.splice.apply(self, [from, to - from].concat(data)); } return value; ; } else { if ((($a = extra === undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { length = 1 } else { length = value; value = extra; if ((($a = $scope.get('Array')['$==='](value)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = value.$to_a() } else if ((($a = value['$respond_to?']("to_ary")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = value.$to_ary().$to_a() } else { data = [value] }; }; var old; index = $scope.get('Opal').$coerce_to(index, $scope.get('Integer'), "to_int"); length = $scope.get('Opal').$coerce_to(length, $scope.get('Integer'), "to_int"); if (index < 0) { old = index; index += size; if (index < 0) { self.$raise($scope.get('IndexError'), "index " + (old) + " too small for array; minimum " + (-self.length)); } } if (length < 0) { self.$raise($scope.get('IndexError'), "negative length (" + (length) + ")") } if (index > size) { for (i = size; i < index; i++) { self[i] = nil; } } if (extra === undefined) { self[index] = value; } else { self.splice.apply(self, [index, length].concat(data)); } return value; }; }, TMP_13.$$arity = -3); Opal.defn(self, '$assoc', TMP_14 = function $$assoc(object) { var self = this; for (var i = 0, length = self.length, item; i < length; i++) { if (item = self[i], item.length && (item[0])['$=='](object)) { return item; } } return nil; }, TMP_14.$$arity = 1); Opal.defn(self, '$at', TMP_15 = function $$at(index) { var self = this; index = $scope.get('Opal').$coerce_to(index, $scope.get('Integer'), "to_int"); if (index < 0) { index += self.length; } if (index < 0 || index >= self.length) { return nil; } return self[index]; }, TMP_15.$$arity = 1); Opal.defn(self, '$bsearch', TMP_16 = function $$bsearch() { var self = this, $iter = TMP_16.$$p, block = $iter || nil; TMP_16.$$p = null; if ((block !== nil)) { } else { return self.$enum_for("bsearch") }; var min = 0, max = self.length, mid, val, ret, smaller = false, satisfied = nil; while (min < max) { mid = min + Math.floor((max - min) / 2); val = self[mid]; ret = block(val); if (ret === true) { satisfied = val; smaller = true; } else if (ret === false || ret === nil) { smaller = false; } else if (ret.$$is_number) { if (ret === 0) { return val; } smaller = (ret < 0); } else { self.$raise($scope.get('TypeError'), "wrong argument type " + ((ret).$class()) + " (must be numeric, true, false or nil)") } if (smaller) { max = mid; } else { min = mid + 1; } } return satisfied; }, TMP_16.$$arity = 0); Opal.defn(self, '$cycle', TMP_17 = function $$cycle(n) { var $a, $b, TMP_18, $c, self = this, $iter = TMP_17.$$p, block = $iter || nil; if (n == null) { n = nil; } TMP_17.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_18 = function(){var self = TMP_18.$$s || this, $c; if (n['$=='](nil)) { return (($scope.get('Float')).$$scope.get('INFINITY')) } else { n = $scope.get('Opal')['$coerce_to!'](n, $scope.get('Integer'), "to_int"); if ((($c = $rb_gt(n, 0)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return $rb_times(self.$enumerator_size(), n) } else { return 0 }; }}, TMP_18.$$s = self, TMP_18.$$arity = 0, TMP_18), $a).call($b, "cycle", n) }; if ((($a = ((($c = self['$empty?']()) !== false && $c !== nil && $c != null) ? $c : n['$=='](0))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; var i, length, value; if (n === nil) { while (true) { for (i = 0, length = self.length; i < length; i++) { value = Opal.yield1(block, self[i]); } } } else { n = $scope.get('Opal')['$coerce_to!'](n, $scope.get('Integer'), "to_int"); if (n <= 0) { return self; } while (n > 0) { for (i = 0, length = self.length; i < length; i++) { value = Opal.yield1(block, self[i]); } n--; } } return self; }, TMP_17.$$arity = -1); Opal.defn(self, '$clear', TMP_19 = function $$clear() { var self = this; self.splice(0, self.length); return self; }, TMP_19.$$arity = 0); Opal.defn(self, '$count', TMP_20 = function $$count(object) { var $a, $b, self = this, $iter = TMP_20.$$p, block = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; if (object == null) { object = nil; } TMP_20.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = ((($b = object) !== false && $b !== nil && $b != null) ? $b : block)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self, Opal.find_super_dispatcher(self, 'count', TMP_20, false)), $a.$$p = $iter, $a).apply($b, $zuper) } else { return self.$size() }; }, TMP_20.$$arity = -1); Opal.defn(self, '$initialize_copy', TMP_21 = function $$initialize_copy(other) { var self = this; return self.$replace(other); }, TMP_21.$$arity = 1); Opal.defn(self, '$collect', TMP_22 = function $$collect() { var $a, $b, TMP_23, self = this, $iter = TMP_22.$$p, block = $iter || nil; TMP_22.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_23 = function(){var self = TMP_23.$$s || this; return self.$size()}, TMP_23.$$s = self, TMP_23.$$arity = 0, TMP_23), $a).call($b, "collect") }; var result = []; for (var i = 0, length = self.length; i < length; i++) { var value = Opal.yield1(block, self[i]); result.push(value); } return result; }, TMP_22.$$arity = 0); Opal.defn(self, '$collect!', TMP_24 = function() { var $a, $b, TMP_25, self = this, $iter = TMP_24.$$p, block = $iter || nil; TMP_24.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_25 = function(){var self = TMP_25.$$s || this; return self.$size()}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25), $a).call($b, "collect!") }; for (var i = 0, length = self.length; i < length; i++) { var value = Opal.yield1(block, self[i]); self[i] = value; } return self; }, TMP_24.$$arity = 0); function binomial_coefficient(n, k) { if (n === k || k === 0) { return 1; } if (k > 0 && n > k) { return binomial_coefficient(n - 1, k - 1) + binomial_coefficient(n - 1, k); } return 0; } Opal.defn(self, '$combination', TMP_26 = function $$combination(n) { var $a, $b, TMP_27, self = this, $iter = TMP_26.$$p, $yield = $iter || nil, num = nil; TMP_26.$$p = null; num = $scope.get('Opal')['$coerce_to!'](n, $scope.get('Integer'), "to_int"); if (($yield !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_27 = function(){var self = TMP_27.$$s || this; return binomial_coefficient(self.length, num);}, TMP_27.$$s = self, TMP_27.$$arity = 0, TMP_27), $a).call($b, "combination", num) }; var i, length, stack, chosen, lev, done, next; if (num === 0) { Opal.yield1($yield, []) } else if (num === 1) { for (i = 0, length = self.length; i < length; i++) { Opal.yield1($yield, [self[i]]) } } else if (num === self.length) { Opal.yield1($yield, self.slice()) } else if (num >= 0 && num < self.length) { stack = []; for (i = 0; i <= num + 1; i++) { stack.push(0); } chosen = []; lev = 0; done = false; stack[0] = -1; while (!done) { chosen[lev] = self[stack[lev+1]]; while (lev < num - 1) { lev++; next = stack[lev+1] = stack[lev] + 1; chosen[lev] = self[next]; } Opal.yield1($yield, chosen.slice()) lev++; do { done = (lev === 0); stack[lev]++; lev--; } while ( stack[lev+1] + num === self.length + lev + 1 ); } } ; return self; }, TMP_26.$$arity = 1); Opal.defn(self, '$repeated_combination', TMP_28 = function $$repeated_combination(n) { var $a, $b, TMP_29, self = this, $iter = TMP_28.$$p, $yield = $iter || nil, num = nil; TMP_28.$$p = null; num = $scope.get('Opal')['$coerce_to!'](n, $scope.get('Integer'), "to_int"); if (($yield !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_29 = function(){var self = TMP_29.$$s || this; return binomial_coefficient(self.length + num - 1, num);}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29), $a).call($b, "repeated_combination", num) }; function iterate(max, from, buffer, self) { if (buffer.length == max) { var copy = buffer.slice(); Opal.yield1($yield, copy) return; } for (var i = from; i < self.length; i++) { buffer.push(self[i]); iterate(max, i, buffer, self); buffer.pop(); } } if (num >= 0) { iterate(num, 0, [], self); } return self; }, TMP_28.$$arity = 1); Opal.defn(self, '$compact', TMP_30 = function $$compact() { var self = this; var result = []; for (var i = 0, length = self.length, item; i < length; i++) { if ((item = self[i]) !== nil) { result.push(item); } } return result; }, TMP_30.$$arity = 0); Opal.defn(self, '$compact!', TMP_31 = function() { var self = this; var original = self.length; for (var i = 0, length = self.length; i < length; i++) { if (self[i] === nil) { self.splice(i, 1); length--; i--; } } return self.length === original ? nil : self; }, TMP_31.$$arity = 0); Opal.defn(self, '$concat', TMP_32 = function $$concat(other) { var $a, self = this; if ((($a = $scope.get('Array')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { other = other.$to_a() } else { other = $scope.get('Opal').$coerce_to(other, $scope.get('Array'), "to_ary").$to_a() }; for (var i = 0, length = other.length; i < length; i++) { self.push(other[i]); } return self; }, TMP_32.$$arity = 1); Opal.defn(self, '$delete', TMP_33 = function(object) { var self = this, $iter = TMP_33.$$p, $yield = $iter || nil; TMP_33.$$p = null; var original = self.length; for (var i = 0, length = original; i < length; i++) { if ((self[i])['$=='](object)) { self.splice(i, 1); length--; i--; } } if (self.length === original) { if (($yield !== nil)) { return Opal.yieldX($yield, []); } return nil; } return object; ; }, TMP_33.$$arity = 1); Opal.defn(self, '$delete_at', TMP_34 = function $$delete_at(index) { var self = this; index = $scope.get('Opal').$coerce_to(index, $scope.get('Integer'), "to_int"); if (index < 0) { index += self.length; } if (index < 0 || index >= self.length) { return nil; } var result = self[index]; self.splice(index, 1); return result; ; }, TMP_34.$$arity = 1); Opal.defn(self, '$delete_if', TMP_35 = function $$delete_if() { var $a, $b, TMP_36, self = this, $iter = TMP_35.$$p, block = $iter || nil; TMP_35.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_36 = function(){var self = TMP_36.$$s || this; return self.$size()}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36), $a).call($b, "delete_if") }; for (var i = 0, length = self.length, value; i < length; i++) { value = block(self[i]); if (value !== false && value !== nil) { self.splice(i, 1); length--; i--; } } return self; }, TMP_35.$$arity = 0); Opal.defn(self, '$drop', TMP_37 = function $$drop(number) { var self = this; if (number < 0) { self.$raise($scope.get('ArgumentError')) } return self.slice(number); ; }, TMP_37.$$arity = 1); Opal.defn(self, '$dup', TMP_38 = function $$dup() { var $a, $b, self = this, $iter = TMP_38.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_38.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ( self.$$class === Opal.Array && self.$allocate.$$pristine && self.$copy_instance_variables.$$pristine && self.$initialize_dup.$$pristine ) return self.slice(0); return ($a = ($b = self, Opal.find_super_dispatcher(self, 'dup', TMP_38, false)), $a.$$p = $iter, $a).apply($b, $zuper); }, TMP_38.$$arity = 0); Opal.defn(self, '$each', TMP_39 = function $$each() { var $a, $b, TMP_40, self = this, $iter = TMP_39.$$p, block = $iter || nil; TMP_39.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_40 = function(){var self = TMP_40.$$s || this; return self.$size()}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40), $a).call($b, "each") }; for (var i = 0, length = self.length; i < length; i++) { var value = Opal.yield1(block, self[i]); } return self; }, TMP_39.$$arity = 0); Opal.defn(self, '$each_index', TMP_41 = function $$each_index() { var $a, $b, TMP_42, self = this, $iter = TMP_41.$$p, block = $iter || nil; TMP_41.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_42 = function(){var self = TMP_42.$$s || this; return self.$size()}, TMP_42.$$s = self, TMP_42.$$arity = 0, TMP_42), $a).call($b, "each_index") }; for (var i = 0, length = self.length; i < length; i++) { var value = Opal.yield1(block, i); } return self; }, TMP_41.$$arity = 0); Opal.defn(self, '$empty?', TMP_43 = function() { var self = this; return self.length === 0; }, TMP_43.$$arity = 0); Opal.defn(self, '$eql?', TMP_44 = function(other) { var self = this; var recursed = {}; function _eql(array, other) { var i, length, a, b; if (!other.$$is_array) { return false; } other = other.$to_a(); if (array.length !== other.length) { return false; } recursed[(array).$object_id()] = true; for (i = 0, length = array.length; i < length; i++) { a = array[i]; b = other[i]; if (a.$$is_array) { if (b.$$is_array && b.length !== a.length) { return false; } if (!recursed.hasOwnProperty((a).$object_id())) { if (!_eql(a, b)) { return false; } } } else { if (!(a)['$eql?'](b)) { return false; } } } return true; } return _eql(self, other); }, TMP_44.$$arity = 1); Opal.defn(self, '$fetch', TMP_45 = function $$fetch(index, defaults) { var self = this, $iter = TMP_45.$$p, block = $iter || nil; TMP_45.$$p = null; var original = index; index = $scope.get('Opal').$coerce_to(index, $scope.get('Integer'), "to_int"); if (index < 0) { index += self.length; } if (index >= 0 && index < self.length) { return self[index]; } if (block !== nil) { return block(original); } if (defaults != null) { return defaults; } if (self.length === 0) { self.$raise($scope.get('IndexError'), "index " + (original) + " outside of array bounds: 0...0") } else { self.$raise($scope.get('IndexError'), "index " + (original) + " outside of array bounds: -" + (self.length) + "..." + (self.length)); } ; }, TMP_45.$$arity = -2); Opal.defn(self, '$fill', TMP_46 = function $$fill($a_rest) { var $b, $c, self = this, args, $iter = TMP_46.$$p, block = $iter || nil, one = nil, two = nil, obj = nil, left = nil, right = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_46.$$p = null; var i, length, value; if (block !== false && block !== nil && block != null) { if ((($b = args.length > 2) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (args.$length()) + " for 0..2)")}; $c = args, $b = Opal.to_ary($c), one = ($b[0] == null ? nil : $b[0]), two = ($b[1] == null ? nil : $b[1]), $c; } else { if ((($b = args.length == 0) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (0 for 1..3)") } else if ((($b = args.length > 3) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (args.$length()) + " for 1..3)")}; $c = args, $b = Opal.to_ary($c), obj = ($b[0] == null ? nil : $b[0]), one = ($b[1] == null ? nil : $b[1]), two = ($b[2] == null ? nil : $b[2]), $c; }; if ((($b = $scope.get('Range')['$==='](one)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if (two !== false && two !== nil && two != null) { self.$raise($scope.get('TypeError'), "length invalid with range")}; left = $scope.get('Opal').$coerce_to(one.$begin(), $scope.get('Integer'), "to_int"); if ((($b = left < 0) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { left += self.length;}; if ((($b = left < 0) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$raise($scope.get('RangeError'), "" + (one.$inspect()) + " out of range")}; right = $scope.get('Opal').$coerce_to(one.$end(), $scope.get('Integer'), "to_int"); if ((($b = right < 0) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { right += self.length;}; if ((($b = one['$exclude_end?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { right += 1; }; if ((($b = right <= left) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self}; } else if (one !== false && one !== nil && one != null) { left = $scope.get('Opal').$coerce_to(one, $scope.get('Integer'), "to_int"); if ((($b = left < 0) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { left += self.length;}; if ((($b = left < 0) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { left = 0}; if (two !== false && two !== nil && two != null) { right = $scope.get('Opal').$coerce_to(two, $scope.get('Integer'), "to_int"); if ((($b = right == 0) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self}; right += left; } else { right = self.length }; } else { left = 0; right = self.length; }; if ((($b = left > self.length) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { for (i = self.length; i < right; i++) { self[i] = nil; } ;}; if ((($b = right > self.length) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.length = right}; if (block !== false && block !== nil && block != null) { for (length = self.length; left < right; left++) { value = block(left); self[left] = value; } ; } else { for (length = self.length; left < right; left++) { self[left] = obj; } ; }; return self; }, TMP_46.$$arity = -1); Opal.defn(self, '$first', TMP_47 = function $$first(count) { var self = this; if (count == null) { return self.length === 0 ? nil : self[0]; } count = $scope.get('Opal').$coerce_to(count, $scope.get('Integer'), "to_int"); if (count < 0) { self.$raise($scope.get('ArgumentError'), "negative array size"); } return self.slice(0, count); }, TMP_47.$$arity = -1); Opal.defn(self, '$flatten', TMP_48 = function $$flatten(level) { var self = this; function _flatten(array, level) { var result = [], i, length, item, ary; array = (array).$to_a(); for (i = 0, length = array.length; i < length; i++) { item = array[i]; if (!$scope.get('Opal')['$respond_to?'](item, "to_ary")) { result.push(item); continue; } ary = (item).$to_ary(); if (ary === nil) { result.push(item); continue; } if (!ary.$$is_array) { self.$raise($scope.get('TypeError')); } if (ary === self) { self.$raise($scope.get('ArgumentError')); } switch (level) { case undefined: result = result.concat(_flatten(ary)); break; case 0: result.push(ary); break; default: result.push.apply(result, _flatten(ary, level - 1)); } } return result; } if (level !== undefined) { level = $scope.get('Opal').$coerce_to(level, $scope.get('Integer'), "to_int"); } return toArraySubclass(_flatten(self, level), self.$class()); }, TMP_48.$$arity = -1); Opal.defn(self, '$flatten!', TMP_49 = function(level) { var self = this; var flattened = self.$flatten(level); if (self.length == flattened.length) { for (var i = 0, length = self.length; i < length; i++) { if (self[i] !== flattened[i]) { break; } } if (i == length) { return nil; } } self.$replace(flattened); ; return self; }, TMP_49.$$arity = -1); Opal.defn(self, '$hash', TMP_50 = function $$hash() { var self = this; var top = (Opal.hash_ids == undefined), result = ['A'], hash_id = self.$object_id(), item, i, key; try { if (top) { Opal.hash_ids = {}; } if (Opal.hash_ids.hasOwnProperty(hash_id)) { return 'self'; } for (key in Opal.hash_ids) { if (Opal.hash_ids.hasOwnProperty(key)) { item = Opal.hash_ids[key]; if (self['$eql?'](item)) { return 'self'; } } } Opal.hash_ids[hash_id] = self; for (i = 0; i < self.length; i++) { item = self[i]; result.push(item.$hash()); } return result.join(','); } finally { if (top) { delete Opal.hash_ids; } } }, TMP_50.$$arity = 0); Opal.defn(self, '$include?', TMP_51 = function(member) { var self = this; for (var i = 0, length = self.length; i < length; i++) { if ((self[i])['$=='](member)) { return true; } } return false; }, TMP_51.$$arity = 1); Opal.defn(self, '$index', TMP_52 = function $$index(object) { var self = this, $iter = TMP_52.$$p, block = $iter || nil; TMP_52.$$p = null; var i, length, value; if (object != null) { for (i = 0, length = self.length; i < length; i++) { if ((self[i])['$=='](object)) { return i; } } } else if (block !== nil) { for (i = 0, length = self.length; i < length; i++) { value = block(self[i]); if (value !== false && value !== nil) { return i; } } } else { return self.$enum_for("index"); } return nil; }, TMP_52.$$arity = -1); Opal.defn(self, '$insert', TMP_53 = function $$insert(index, $a_rest) { var self = this, objects; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } objects = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { objects[$arg_idx - 1] = arguments[$arg_idx]; } index = $scope.get('Opal').$coerce_to(index, $scope.get('Integer'), "to_int"); if (objects.length > 0) { if (index < 0) { index += self.length + 1; if (index < 0) { self.$raise($scope.get('IndexError'), "" + (index) + " is out of bounds"); } } if (index > self.length) { for (var i = self.length; i < index; i++) { self.push(nil); } } self.splice.apply(self, [index, 0].concat(objects)); } ; return self; }, TMP_53.$$arity = -2); Opal.defn(self, '$inspect', TMP_54 = function $$inspect() { var self = this; var result = [], id = self.$__id__(); for (var i = 0, length = self.length; i < length; i++) { var item = self['$[]'](i); if ((item).$__id__() === id) { result.push('[...]'); } else { result.push((item).$inspect()); } } return '[' + result.join(', ') + ']'; ; }, TMP_54.$$arity = 0); Opal.defn(self, '$join', TMP_55 = function $$join(sep) { var $a, self = this; if ($gvars[","] == null) $gvars[","] = nil; if (sep == null) { sep = nil; } if ((($a = self.length === 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ""}; if ((($a = sep === nil) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { sep = $gvars[","]}; var result = []; var i, length, item, tmp; for (i = 0, length = self.length; i < length; i++) { item = self[i]; if ($scope.get('Opal')['$respond_to?'](item, "to_str")) { tmp = (item).$to_str(); if (tmp !== nil) { result.push((tmp).$to_s()); continue; } } if ($scope.get('Opal')['$respond_to?'](item, "to_ary")) { tmp = (item).$to_ary(); if (tmp === self) { self.$raise($scope.get('ArgumentError')); } if (tmp !== nil) { result.push((tmp).$join(sep)); continue; } } if ($scope.get('Opal')['$respond_to?'](item, "to_s")) { tmp = (item).$to_s(); if (tmp !== nil) { result.push(tmp); continue; } } self.$raise($scope.get('NoMethodError').$new("" + ($scope.get('Opal').$inspect(item)) + " doesn't respond to #to_str, #to_ary or #to_s", "to_str")); } if (sep === nil) { return result.join(''); } else { return result.join($scope.get('Opal')['$coerce_to!'](sep, $scope.get('String'), "to_str").$to_s()); } ; }, TMP_55.$$arity = -1); Opal.defn(self, '$keep_if', TMP_56 = function $$keep_if() { var $a, $b, TMP_57, self = this, $iter = TMP_56.$$p, block = $iter || nil; TMP_56.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_57 = function(){var self = TMP_57.$$s || this; return self.$size()}, TMP_57.$$s = self, TMP_57.$$arity = 0, TMP_57), $a).call($b, "keep_if") }; for (var i = 0, length = self.length, value; i < length; i++) { value = block(self[i]); if (value === false || value === nil) { self.splice(i, 1); length--; i--; } } return self; }, TMP_56.$$arity = 0); Opal.defn(self, '$last', TMP_58 = function $$last(count) { var self = this; if (count == null) { return self.length === 0 ? nil : self[self.length - 1]; } count = $scope.get('Opal').$coerce_to(count, $scope.get('Integer'), "to_int"); if (count < 0) { self.$raise($scope.get('ArgumentError'), "negative array size"); } if (count > self.length) { count = self.length; } return self.slice(self.length - count, self.length); }, TMP_58.$$arity = -1); Opal.defn(self, '$length', TMP_59 = function $$length() { var self = this; return self.length; }, TMP_59.$$arity = 0); Opal.alias(self, 'map', 'collect'); Opal.alias(self, 'map!', 'collect!'); // Returns the product of from, from-1, ..., from - how_many + 1. function descending_factorial(from, how_many) { var count = how_many >= 0 ? 1 : 0; while (how_many) { count *= from; from--; how_many--; } return count; } Opal.defn(self, '$permutation', TMP_60 = function $$permutation(num) { var $a, $b, TMP_61, self = this, $iter = TMP_60.$$p, block = $iter || nil, perm = nil, used = nil; TMP_60.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_61 = function(){var self = TMP_61.$$s || this; return descending_factorial(self.length, num === undefined ? self.length : num);}, TMP_61.$$s = self, TMP_61.$$arity = 0, TMP_61), $a).call($b, "permutation", num) }; var permute, offensive, output; if (num === undefined) { num = self.length; } else { num = $scope.get('Opal').$coerce_to(num, $scope.get('Integer'), "to_int") } if (num < 0 || self.length < num) { // no permutations, yield nothing } else if (num === 0) { // exactly one permutation: the zero-length array Opal.yield1(block, []) } else if (num === 1) { // this is a special, easy case for (var i = 0; i < self.length; i++) { Opal.yield1(block, [self[i]]) } } else { // this is the general case perm = $scope.get('Array').$new(num) used = $scope.get('Array').$new(self.length, false) permute = function(num, perm, index, used, blk) { self = this; for(var i = 0; i < self.length; i++){ if(used['$[]'](i)['$!']()) { perm[index] = i; if(index < num - 1) { used[i] = true; permute.call(self, num, perm, index + 1, used, blk); used[i] = false; } else { output = []; for (var j = 0; j < perm.length; j++) { output.push(self[perm[j]]); } Opal.yield1(blk, output); } } } } if ((block !== nil)) { // offensive (both definitions) copy. offensive = self.slice(); permute.call(offensive, num, perm, 0, used, block); } else { permute.call(self, num, perm, 0, used, block); } } ; return self; }, TMP_60.$$arity = -1); Opal.defn(self, '$repeated_permutation', TMP_62 = function $$repeated_permutation(n) { var $a, $b, TMP_63, self = this, $iter = TMP_62.$$p, $yield = $iter || nil, num = nil; TMP_62.$$p = null; num = $scope.get('Opal')['$coerce_to!'](n, $scope.get('Integer'), "to_int"); if (($yield !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_63 = function(){var self = TMP_63.$$s || this, $c; if ((($c = $rb_ge(num, 0)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.$size()['$**'](num) } else { return 0 }}, TMP_63.$$s = self, TMP_63.$$arity = 0, TMP_63), $a).call($b, "repeated_permutation", num) }; function iterate(max, buffer, self) { if (buffer.length == max) { var copy = buffer.slice(); Opal.yield1($yield, copy) return; } for (var i = 0; i < self.length; i++) { buffer.push(self[i]); iterate(max, buffer, self); buffer.pop(); } } iterate(num, [], self.slice()); return self; }, TMP_62.$$arity = 1); Opal.defn(self, '$pop', TMP_64 = function $$pop(count) { var $a, self = this; if ((($a = count === undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.length === 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; return self.pop();}; count = $scope.get('Opal').$coerce_to(count, $scope.get('Integer'), "to_int"); if ((($a = count < 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "negative array size")}; if ((($a = self.length === 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return []}; if ((($a = count > self.length) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.splice(0, self.length); } else { return self.splice(self.length - count, self.length); }; }, TMP_64.$$arity = -1); Opal.defn(self, '$product', TMP_65 = function $$product($a_rest) { var self = this, args, $iter = TMP_65.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_65.$$p = null; var result = (block !== nil) ? null : [], n = args.length + 1, counters = new Array(n), lengths = new Array(n), arrays = new Array(n), i, m, subarray, len, resultlen = 1; arrays[0] = self; for (i = 1; i < n; i++) { arrays[i] = $scope.get('Opal').$coerce_to(args[i - 1], $scope.get('Array'), "to_ary"); } for (i = 0; i < n; i++) { len = arrays[i].length; if (len === 0) { return result || self; } resultlen *= len; if (resultlen > 2147483647) { self.$raise($scope.get('RangeError'), "too big to product") } lengths[i] = len; counters[i] = 0; } outer_loop: for (;;) { subarray = []; for (i = 0; i < n; i++) { subarray.push(arrays[i][counters[i]]); } if (result) { result.push(subarray); } else { Opal.yield1(block, subarray) } m = n - 1; counters[m]++; while (counters[m] === lengths[m]) { counters[m] = 0; if (--m < 0) break outer_loop; counters[m]++; } } return result || self; ; }, TMP_65.$$arity = -1); Opal.defn(self, '$push', TMP_66 = function $$push($a_rest) { var self = this, objects; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } objects = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { objects[$arg_idx - 0] = arguments[$arg_idx]; } for (var i = 0, length = objects.length; i < length; i++) { self.push(objects[i]); } return self; }, TMP_66.$$arity = -1); Opal.defn(self, '$rassoc', TMP_67 = function $$rassoc(object) { var self = this; for (var i = 0, length = self.length, item; i < length; i++) { item = self[i]; if (item.length && item[1] !== undefined) { if ((item[1])['$=='](object)) { return item; } } } return nil; }, TMP_67.$$arity = 1); Opal.defn(self, '$reject', TMP_68 = function $$reject() { var $a, $b, TMP_69, self = this, $iter = TMP_68.$$p, block = $iter || nil; TMP_68.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_69 = function(){var self = TMP_69.$$s || this; return self.$size()}, TMP_69.$$s = self, TMP_69.$$arity = 0, TMP_69), $a).call($b, "reject") }; var result = []; for (var i = 0, length = self.length, value; i < length; i++) { value = block(self[i]); if (value === false || value === nil) { result.push(self[i]); } } return result; }, TMP_68.$$arity = 0); Opal.defn(self, '$reject!', TMP_70 = function() { var $a, $b, TMP_71, $c, self = this, $iter = TMP_70.$$p, block = $iter || nil, original = nil; TMP_70.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_71 = function(){var self = TMP_71.$$s || this; return self.$size()}, TMP_71.$$s = self, TMP_71.$$arity = 0, TMP_71), $a).call($b, "reject!") }; original = self.$length(); ($a = ($c = self).$delete_if, $a.$$p = block.$to_proc(), $a).call($c); if (self.$length()['$=='](original)) { return nil } else { return self }; }, TMP_70.$$arity = 0); Opal.defn(self, '$replace', TMP_72 = function $$replace(other) { var $a, self = this; if ((($a = $scope.get('Array')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { other = other.$to_a() } else { other = $scope.get('Opal').$coerce_to(other, $scope.get('Array'), "to_ary").$to_a() }; self.splice(0, self.length); self.push.apply(self, other); return self; }, TMP_72.$$arity = 1); Opal.defn(self, '$reverse', TMP_73 = function $$reverse() { var self = this; return self.slice(0).reverse(); }, TMP_73.$$arity = 0); Opal.defn(self, '$reverse!', TMP_74 = function() { var self = this; return self.reverse(); }, TMP_74.$$arity = 0); Opal.defn(self, '$reverse_each', TMP_75 = function $$reverse_each() { var $a, $b, TMP_76, $c, self = this, $iter = TMP_75.$$p, block = $iter || nil; TMP_75.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_76 = function(){var self = TMP_76.$$s || this; return self.$size()}, TMP_76.$$s = self, TMP_76.$$arity = 0, TMP_76), $a).call($b, "reverse_each") }; ($a = ($c = self.$reverse()).$each, $a.$$p = block.$to_proc(), $a).call($c); return self; }, TMP_75.$$arity = 0); Opal.defn(self, '$rindex', TMP_77 = function $$rindex(object) { var self = this, $iter = TMP_77.$$p, block = $iter || nil; TMP_77.$$p = null; var i, value; if (object != null) { for (i = self.length - 1; i >= 0; i--) { if (i >= self.length) { break; } if ((self[i])['$=='](object)) { return i; } } } else if (block !== nil) { for (i = self.length - 1; i >= 0; i--) { if (i >= self.length) { break; } value = block(self[i]); if (value !== false && value !== nil) { return i; } } } else if (object == null) { return self.$enum_for("rindex"); } return nil; }, TMP_77.$$arity = -1); Opal.defn(self, '$rotate', TMP_78 = function $$rotate(n) { var self = this; if (n == null) { n = 1; } n = $scope.get('Opal').$coerce_to(n, $scope.get('Integer'), "to_int"); var ary, idx, firstPart, lastPart; if (self.length === 1) { return self.slice(); } if (self.length === 0) { return []; } ary = self.slice(); idx = n % ary.length; firstPart = ary.slice(idx); lastPart = ary.slice(0, idx); return firstPart.concat(lastPart); }, TMP_78.$$arity = -1); Opal.defn(self, '$rotate!', TMP_79 = function(cnt) { var self = this, ary = nil; if (cnt == null) { cnt = 1; } if (self.length === 0 || self.length === 1) { return self; } cnt = $scope.get('Opal').$coerce_to(cnt, $scope.get('Integer'), "to_int"); ary = self.$rotate(cnt); return self.$replace(ary); }, TMP_79.$$arity = -1); (function($base, $super) { function $SampleRandom(){}; var self = $SampleRandom = $klass($base, $super, 'SampleRandom', $SampleRandom); var def = self.$$proto, $scope = self.$$scope, TMP_80, TMP_81; def.rng = nil; Opal.defn(self, '$initialize', TMP_80 = function $$initialize(rng) { var self = this; return self.rng = rng; }, TMP_80.$$arity = 1); return (Opal.defn(self, '$rand', TMP_81 = function $$rand(size) { var $a, self = this, random = nil; random = $scope.get('Opal').$coerce_to(self.rng.$rand(size), $scope.get('Integer'), "to_int"); if ((($a = random < 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('RangeError'), "random value must be >= 0")}; if ((($a = random < size) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('RangeError'), "random value must be less than Array size") }; return random; }, TMP_81.$$arity = 1), nil) && 'rand'; })($scope.base, null); Opal.defn(self, '$sample', TMP_82 = function $$sample(count, options) { var $a, $b, self = this, o = nil, rng = nil; if ((($a = count === undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$at($scope.get('Kernel').$rand(self.length))}; if ((($a = options === undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = (o = $scope.get('Opal')['$coerce_to?'](count, $scope.get('Hash'), "to_hash"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { options = o; count = nil; } else { options = nil; count = $scope.get('Opal').$coerce_to(count, $scope.get('Integer'), "to_int"); } } else { count = $scope.get('Opal').$coerce_to(count, $scope.get('Integer'), "to_int"); options = $scope.get('Opal').$coerce_to(options, $scope.get('Hash'), "to_hash"); }; if ((($a = (($b = count !== false && count !== nil && count != null) ? count < 0 : count)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "count must be greater than 0")}; if (options !== false && options !== nil && options != null) { rng = options['$[]']("random")}; if ((($a = (($b = rng !== false && rng !== nil && rng != null) ? rng['$respond_to?']("rand") : rng)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { rng = $scope.get('SampleRandom').$new(rng) } else { rng = $scope.get('Kernel') }; if (count !== false && count !== nil && count != null) { } else { return self[rng.$rand(self.length)] }; var abandon, spin, result, i, j, k, targetIndex, oldValue; if (count > self.length) { count = self.length; } switch (count) { case 0: return []; break; case 1: return [self[rng.$rand(self.length)]]; break; case 2: i = rng.$rand(self.length); j = rng.$rand(self.length); if (i === j) { j = i === 0 ? i + 1 : i - 1; } return [self[i], self[j]]; break; default: if (self.length / count > 3) { abandon = false; spin = 0; result = $scope.get('Array').$new(count); i = 1; result[0] = rng.$rand(self.length); while (i < count) { k = rng.$rand(self.length); j = 0; while (j < i) { while (k === result[j]) { spin++; if (spin > 100) { abandon = true; break; } k = rng.$rand(self.length); } if (abandon) { break; } j++; } if (abandon) { break; } result[i] = k; i++; } if (!abandon) { i = 0; while (i < count) { result[i] = self[result[i]]; i++; } return result; } } result = self.slice(); for (var c = 0; c < count; c++) { targetIndex = rng.$rand(self.length); oldValue = result[c]; result[c] = result[targetIndex]; result[targetIndex] = oldValue; } return count === self.length ? result : (result)['$[]'](0, count); } }, TMP_82.$$arity = -1); Opal.defn(self, '$select', TMP_83 = function $$select() { var $a, $b, TMP_84, self = this, $iter = TMP_83.$$p, block = $iter || nil; TMP_83.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_84 = function(){var self = TMP_84.$$s || this; return self.$size()}, TMP_84.$$s = self, TMP_84.$$arity = 0, TMP_84), $a).call($b, "select") }; var result = []; for (var i = 0, length = self.length, item, value; i < length; i++) { item = self[i]; value = Opal.yield1(block, item); if (value !== false && value !== nil) { result.push(item); } } return result; }, TMP_83.$$arity = 0); Opal.defn(self, '$select!', TMP_85 = function() { var $a, $b, TMP_86, $c, self = this, $iter = TMP_85.$$p, block = $iter || nil; TMP_85.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_86 = function(){var self = TMP_86.$$s || this; return self.$size()}, TMP_86.$$s = self, TMP_86.$$arity = 0, TMP_86), $a).call($b, "select!") }; var original = self.length; ($a = ($c = self).$keep_if, $a.$$p = block.$to_proc(), $a).call($c); return self.length === original ? nil : self; }, TMP_85.$$arity = 0); Opal.defn(self, '$shift', TMP_87 = function $$shift(count) { var $a, self = this; if ((($a = count === undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.length === 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; return self.shift();}; count = $scope.get('Opal').$coerce_to(count, $scope.get('Integer'), "to_int"); if ((($a = count < 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "negative array size")}; if ((($a = self.length === 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return []}; return self.splice(0, count); }, TMP_87.$$arity = -1); Opal.alias(self, 'size', 'length'); Opal.defn(self, '$shuffle', TMP_88 = function $$shuffle(rng) { var self = this; return self.$dup().$to_a()['$shuffle!'](rng); }, TMP_88.$$arity = -1); Opal.defn(self, '$shuffle!', TMP_89 = function(rng) { var self = this; var randgen, i = self.length, j, tmp; if (rng !== undefined) { rng = $scope.get('Opal')['$coerce_to?'](rng, $scope.get('Hash'), "to_hash"); if (rng !== nil) { rng = rng['$[]']("random"); if (rng !== nil && rng['$respond_to?']("rand")) { randgen = rng; } } } while (i) { if (randgen) { j = randgen.$rand(i).$to_int(); if (j < 0) { self.$raise($scope.get('RangeError'), "random number too small " + (j)) } if (j >= i) { self.$raise($scope.get('RangeError'), "random number too big " + (j)) } } else { j = Math.floor(Math.random() * i); } tmp = self[--i]; self[i] = self[j]; self[j] = tmp; } return self; ; }, TMP_89.$$arity = -1); Opal.alias(self, 'slice', '[]'); Opal.defn(self, '$slice!', TMP_90 = function(index, length) { var $a, self = this, result = nil, range = nil, range_start = nil, range_end = nil, start = nil; result = nil; if ((($a = length === undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $scope.get('Range')['$==='](index)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { range = index; result = self['$[]'](range); range_start = $scope.get('Opal').$coerce_to(range.$begin(), $scope.get('Integer'), "to_int"); range_end = $scope.get('Opal').$coerce_to(range.$end(), $scope.get('Integer'), "to_int"); if (range_start < 0) { range_start += self.length; } if (range_end < 0) { range_end += self.length; } else if (range_end >= self.length) { range_end = self.length - 1; if (range.exclude) { range_end += 1; } } var range_length = range_end - range_start; if (range.exclude) { range_end -= 1; } else { range_length += 1; } if (range_start < self.length && range_start >= 0 && range_end < self.length && range_end >= 0 && range_length > 0) { self.splice(range_start, range_length); } } else { start = $scope.get('Opal').$coerce_to(index, $scope.get('Integer'), "to_int"); if (start < 0) { start += self.length; } if (start < 0 || start >= self.length) { return nil; } result = self[start]; if (start === 0) { self.shift(); } else { self.splice(start, 1); } } } else { start = $scope.get('Opal').$coerce_to(index, $scope.get('Integer'), "to_int"); length = $scope.get('Opal').$coerce_to(length, $scope.get('Integer'), "to_int"); if (length < 0) { return nil; } var end = start + length; result = self['$[]'](start, length); if (start < 0) { start += self.length; } if (start + length > self.length) { length = self.length - start; } if (start < self.length && start >= 0) { self.splice(start, length); } }; return result; }, TMP_90.$$arity = -2); Opal.defn(self, '$sort', TMP_91 = function $$sort() { var $a, self = this, $iter = TMP_91.$$p, block = $iter || nil; TMP_91.$$p = null; if ((($a = self.length > 1) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return self }; if (block === nil) { block = function(a, b) { return (a)['$<=>'](b); }; } return self.slice().sort(function(x, y) { var ret = block(x, y); if (ret === nil) { self.$raise($scope.get('ArgumentError'), "comparison of " + ((x).$inspect()) + " with " + ((y).$inspect()) + " failed"); } return $rb_gt(ret, 0) ? 1 : ($rb_lt(ret, 0) ? -1 : 0); }); ; }, TMP_91.$$arity = 0); Opal.defn(self, '$sort!', TMP_92 = function() { var $a, $b, self = this, $iter = TMP_92.$$p, block = $iter || nil; TMP_92.$$p = null; var result; if ((block !== nil)) { result = ($a = ($b = (self.slice())).$sort, $a.$$p = block.$to_proc(), $a).call($b); } else { result = (self.slice()).$sort(); } self.length = 0; for(var i = 0, length = result.length; i < length; i++) { self.push(result[i]); } return self; ; }, TMP_92.$$arity = 0); Opal.defn(self, '$sort_by!', TMP_93 = function() { var $a, $b, TMP_94, $c, self = this, $iter = TMP_93.$$p, block = $iter || nil; TMP_93.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_94 = function(){var self = TMP_94.$$s || this; return self.$size()}, TMP_94.$$s = self, TMP_94.$$arity = 0, TMP_94), $a).call($b, "sort_by!") }; return self.$replace(($a = ($c = self).$sort_by, $a.$$p = block.$to_proc(), $a).call($c)); }, TMP_93.$$arity = 0); Opal.defn(self, '$take', TMP_95 = function $$take(count) { var self = this; if (count < 0) { self.$raise($scope.get('ArgumentError')); } return self.slice(0, count); ; }, TMP_95.$$arity = 1); Opal.defn(self, '$take_while', TMP_96 = function $$take_while() { var self = this, $iter = TMP_96.$$p, block = $iter || nil; TMP_96.$$p = null; var result = []; for (var i = 0, length = self.length, item, value; i < length; i++) { item = self[i]; value = block(item); if (value === false || value === nil) { return result; } result.push(item); } return result; }, TMP_96.$$arity = 0); Opal.defn(self, '$to_a', TMP_97 = function $$to_a() { var self = this; return self; }, TMP_97.$$arity = 0); Opal.alias(self, 'to_ary', 'to_a'); Opal.defn(self, '$to_h', TMP_98 = function $$to_h() { var self = this; var i, len = self.length, ary, key, val, hash = $hash2([], {}); for (i = 0; i < len; i++) { ary = $scope.get('Opal')['$coerce_to?'](self[i], $scope.get('Array'), "to_ary"); if (!ary.$$is_array) { self.$raise($scope.get('TypeError'), "wrong element type " + ((ary).$class()) + " at " + (i) + " (expected array)") } if (ary.length !== 2) { self.$raise($scope.get('ArgumentError'), "wrong array length at " + (i) + " (expected 2, was " + ((ary).$length()) + ")") } key = ary[0]; val = ary[1]; Opal.hash_put(hash, key, val); } return hash; ; }, TMP_98.$$arity = 0); Opal.alias(self, 'to_s', 'inspect'); Opal.defn(self, '$transpose', TMP_101 = function $$transpose() { var $a, $b, TMP_99, self = this, result = nil, max = nil; if ((($a = self['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return []}; result = []; max = nil; ($a = ($b = self).$each, $a.$$p = (TMP_99 = function(row){var self = TMP_99.$$s || this, $c, $d, TMP_100; if (row == null) row = nil; if ((($c = $scope.get('Array')['$==='](row)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { row = row.$to_a() } else { row = $scope.get('Opal').$coerce_to(row, $scope.get('Array'), "to_ary").$to_a() }; ((($c = max) !== false && $c !== nil && $c != null) ? $c : max = row.length); if ((($c = (row.length)['$!='](max)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$raise($scope.get('IndexError'), "element size differs (" + (row.length) + " should be " + (max))}; return ($c = ($d = (row.length)).$times, $c.$$p = (TMP_100 = function(i){var self = TMP_100.$$s || this, $e, $f, $g, entry = nil; if (i == null) i = nil; entry = (($e = i, $f = result, ((($g = $f['$[]']($e)) !== false && $g !== nil && $g != null) ? $g : $f['$[]=']($e, [])))); return entry['$<<'](row.$at(i));}, TMP_100.$$s = self, TMP_100.$$arity = 1, TMP_100), $c).call($d);}, TMP_99.$$s = self, TMP_99.$$arity = 1, TMP_99), $a).call($b); return result; }, TMP_101.$$arity = 0); Opal.defn(self, '$uniq', TMP_102 = function $$uniq() { var self = this, $iter = TMP_102.$$p, block = $iter || nil; TMP_102.$$p = null; var hash = $hash2([], {}), i, length, item, key; if (block === nil) { for (i = 0, length = self.length; i < length; i++) { item = self[i]; if (Opal.hash_get(hash, item) === undefined) { Opal.hash_put(hash, item, item); } } } else { for (i = 0, length = self.length; i < length; i++) { item = self[i]; key = Opal.yield1(block, item); if (Opal.hash_get(hash, key) === undefined) { Opal.hash_put(hash, key, item); } } } return toArraySubclass((hash).$values(), self.$class()); ; }, TMP_102.$$arity = 0); Opal.defn(self, '$uniq!', TMP_103 = function() { var self = this, $iter = TMP_103.$$p, block = $iter || nil; TMP_103.$$p = null; var original_length = self.length, hash = $hash2([], {}), i, length, item, key; for (i = 0, length = original_length; i < length; i++) { item = self[i]; key = (block === nil ? item : Opal.yield1(block, item)); if (Opal.hash_get(hash, key) === undefined) { Opal.hash_put(hash, key, item); continue; } self.splice(i, 1); length--; i--; } return self.length === original_length ? nil : self; ; }, TMP_103.$$arity = 0); Opal.defn(self, '$unshift', TMP_104 = function $$unshift($a_rest) { var self = this, objects; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } objects = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { objects[$arg_idx - 0] = arguments[$arg_idx]; } for (var i = objects.length - 1; i >= 0; i--) { self.unshift(objects[i]); } return self; }, TMP_104.$$arity = -1); Opal.defn(self, '$values_at', TMP_107 = function $$values_at($a_rest) { var $b, $c, TMP_105, self = this, args, out = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } out = []; ($b = ($c = args).$each, $b.$$p = (TMP_105 = function(elem){var self = TMP_105.$$s || this, $a, $d, TMP_106, finish = nil, start = nil, i = nil; if (elem == null) elem = nil; if ((($a = elem['$kind_of?']($scope.get('Range'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { finish = $scope.get('Opal').$coerce_to(elem.$last(), $scope.get('Integer'), "to_int"); start = $scope.get('Opal').$coerce_to(elem.$first(), $scope.get('Integer'), "to_int"); if (start < 0) { start = start + self.length; return nil;; } if (finish < 0) { finish = finish + self.length; } if (elem['$exclude_end?']()) { finish--; } if (finish < start) { return nil;; } return ($a = ($d = start).$upto, $a.$$p = (TMP_106 = function(i){var self = TMP_106.$$s || this; if (i == null) i = nil; return out['$<<'](self.$at(i))}, TMP_106.$$s = self, TMP_106.$$arity = 1, TMP_106), $a).call($d, finish); } else { i = $scope.get('Opal').$coerce_to(elem, $scope.get('Integer'), "to_int"); return out['$<<'](self.$at(i)); }}, TMP_105.$$s = self, TMP_105.$$arity = 1, TMP_105), $b).call($c); return out; }, TMP_107.$$arity = -1); Opal.defn(self, '$zip', TMP_108 = function $$zip($a_rest) { var $b, self = this, others, $iter = TMP_108.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } others = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { others[$arg_idx - 0] = arguments[$arg_idx]; } TMP_108.$$p = null; var result = [], size = self.length, part, o, i, j, jj; for (j = 0, jj = others.length; j < jj; j++) { o = others[j]; if (o.$$is_array) { continue; } if (o.$$is_enumerator) { if (o.$size() === Infinity) { others[j] = o.$take(size); } else { others[j] = o.$to_a(); } continue; } others[j] = (((($b = $scope.get('Opal')['$coerce_to?'](o, $scope.get('Array'), "to_ary")) !== false && $b !== nil && $b != null) ? $b : $scope.get('Opal')['$coerce_to!'](o, $scope.get('Enumerator'), "each"))).$to_a(); } for (i = 0; i < size; i++) { part = [self[i]]; for (j = 0, jj = others.length; j < jj; j++) { o = others[j][i]; if (o == null) { o = nil; } part[j + 1] = o; } result[i] = part; } if (block !== nil) { for (i = 0; i < size; i++) { block(result[i]); } return nil; } return result; }, TMP_108.$$arity = -1); Opal.defs(self, '$inherited', TMP_109 = function $$inherited(klass) { var self = this; klass.$$proto.$to_a = function() { return this.slice(0, this.length); } }, TMP_109.$$arity = 1); Opal.defn(self, '$instance_variables', TMP_111 = function $$instance_variables() { var $a, $b, TMP_110, $c, $d, self = this, $iter = TMP_111.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_111.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } return ($a = ($b = ($c = ($d = self, Opal.find_super_dispatcher(self, 'instance_variables', TMP_111, false)), $c.$$p = $iter, $c).apply($d, $zuper)).$reject, $a.$$p = (TMP_110 = function(ivar){var self = TMP_110.$$s || this, $c; if (ivar == null) ivar = nil; return ((($c = /^@\d+$/.test(ivar)) !== false && $c !== nil && $c != null) ? $c : ivar['$==']("@length"))}, TMP_110.$$s = self, TMP_110.$$arity = 1, TMP_110), $a).call($b); }, TMP_111.$$arity = 0); return $scope.get('Opal').$pristine(self, "allocate", "copy_instance_variables", "initialize_dup"); })($scope.base, Array); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/hash"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$include', '$coerce_to?', '$[]', '$merge!', '$allocate', '$raise', '$==', '$coerce_to!', '$lambda?', '$abs', '$arity', '$call', '$enum_for', '$size', '$inspect', '$flatten', '$eql?', '$default', '$to_proc', '$dup', '$===', '$default_proc', '$default_proc=', '$default=', '$alias_method']); self.$require("corelib/enumerable"); return (function($base, $super) { function $Hash(){}; var self = $Hash = $klass($base, $super, 'Hash', $Hash); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_18, TMP_20, TMP_22, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_36, TMP_37, TMP_38, TMP_39, TMP_40, TMP_41, TMP_42, TMP_44, TMP_46, TMP_47, TMP_49, TMP_51, TMP_52, TMP_53, TMP_54, TMP_55; self.$include($scope.get('Enumerable')); def.$$is_hash = true; Opal.defs(self, '$[]', TMP_1 = function($a_rest) { var self = this, argv; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } argv = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { argv[$arg_idx - 0] = arguments[$arg_idx]; } var hash, argc = argv.length, i; if (argc === 1) { hash = $scope.get('Opal')['$coerce_to?'](argv['$[]'](0), $scope.get('Hash'), "to_hash"); if (hash !== nil) { return self.$allocate()['$merge!'](hash); } argv = $scope.get('Opal')['$coerce_to?'](argv['$[]'](0), $scope.get('Array'), "to_ary"); if (argv === nil) { self.$raise($scope.get('ArgumentError'), "odd number of arguments for Hash") } argc = argv.length; hash = self.$allocate(); for (i = 0; i < argc; i++) { if (!argv[i].$$is_array) continue; switch(argv[i].length) { case 1: hash.$store(argv[i][0], nil); break; case 2: hash.$store(argv[i][0], argv[i][1]); break; default: self.$raise($scope.get('ArgumentError'), "invalid number of elements (" + (argv[i].length) + " for 1..2)") } } return hash; } if (argc % 2 !== 0) { self.$raise($scope.get('ArgumentError'), "odd number of arguments for Hash") } hash = self.$allocate(); for (i = 0; i < argc; i += 2) { hash.$store(argv[i], argv[i + 1]); } return hash; ; }, TMP_1.$$arity = -1); Opal.defs(self, '$allocate', TMP_2 = function $$allocate() { var self = this; var hash = new self.$$alloc(); Opal.hash_init(hash); hash.$$none = nil; hash.$$proc = nil; return hash; }, TMP_2.$$arity = 0); Opal.defs(self, '$try_convert', TMP_3 = function $$try_convert(obj) { var self = this; return $scope.get('Opal')['$coerce_to?'](obj, $scope.get('Hash'), "to_hash"); }, TMP_3.$$arity = 1); Opal.defn(self, '$initialize', TMP_4 = function $$initialize(defaults) { var self = this, $iter = TMP_4.$$p, block = $iter || nil; TMP_4.$$p = null; if (defaults !== undefined && block !== nil) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (1 for 0)") } self.$$none = (defaults === undefined ? nil : defaults); self.$$proc = block; ; return self; }, TMP_4.$$arity = -1); Opal.defn(self, '$==', TMP_5 = function(other) { var self = this; if (self === other) { return true; } if (!other.$$is_hash) { return false; } if (self.$$keys.length !== other.$$keys.length) { return false; } for (var i = 0, keys = self.$$keys, length = keys.length, key, value, other_value; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; other_value = other.$$smap[key]; } else { value = key.value; other_value = Opal.hash_get(other, key.key); } if (other_value === undefined || !value['$eql?'](other_value)) { return false; } } return true; }, TMP_5.$$arity = 1); Opal.defn(self, '$[]', TMP_6 = function(key) { var self = this; var value = Opal.hash_get(self, key); if (value !== undefined) { return value; } return self.$default(key); }, TMP_6.$$arity = 1); Opal.defn(self, '$[]=', TMP_7 = function(key, value) { var self = this; Opal.hash_put(self, key, value); return value; }, TMP_7.$$arity = 2); Opal.defn(self, '$assoc', TMP_8 = function $$assoc(object) { var self = this; for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { key = keys[i]; if (key.$$is_string) { if ((key)['$=='](object)) { return [key, self.$$smap[key]]; } } else { if ((key.key)['$=='](object)) { return [key.key, key.value]; } } } return nil; }, TMP_8.$$arity = 1); Opal.defn(self, '$clear', TMP_9 = function $$clear() { var self = this; Opal.hash_init(self); return self; }, TMP_9.$$arity = 0); Opal.defn(self, '$clone', TMP_10 = function $$clone() { var self = this; var hash = new self.$$class.$$alloc(); Opal.hash_init(hash); Opal.hash_clone(self, hash); return hash; }, TMP_10.$$arity = 0); Opal.defn(self, '$default', TMP_11 = function(key) { var self = this; if (key !== undefined && self.$$proc !== nil && self.$$proc !== undefined) { return self.$$proc.$call(self, key); } if (self.$$none === undefined) { return nil; } return self.$$none; }, TMP_11.$$arity = -1); Opal.defn(self, '$default=', TMP_12 = function(object) { var self = this; self.$$proc = nil; self.$$none = object; return object; }, TMP_12.$$arity = 1); Opal.defn(self, '$default_proc', TMP_13 = function $$default_proc() { var self = this; if (self.$$proc !== undefined) { return self.$$proc; } return nil; }, TMP_13.$$arity = 0); Opal.defn(self, '$default_proc=', TMP_14 = function(proc) { var self = this; if (proc !== nil) { proc = $scope.get('Opal')['$coerce_to!'](proc, $scope.get('Proc'), "to_proc"); if (proc['$lambda?']() && proc.$arity().$abs() !== 2) { self.$raise($scope.get('TypeError'), "default_proc takes two arguments"); } } self.$$none = nil; self.$$proc = proc; return proc; ; }, TMP_14.$$arity = 1); Opal.defn(self, '$delete', TMP_15 = function(key) { var self = this, $iter = TMP_15.$$p, block = $iter || nil; TMP_15.$$p = null; var value = Opal.hash_delete(self, key); if (value !== undefined) { return value; } if (block !== nil) { return block.$call(key); } return nil; }, TMP_15.$$arity = 1); Opal.defn(self, '$delete_if', TMP_16 = function $$delete_if() { var $a, $b, TMP_17, self = this, $iter = TMP_16.$$p, block = $iter || nil; TMP_16.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_17 = function(){var self = TMP_17.$$s || this; return self.$size()}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17), $a).call($b, "delete_if") }; for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } obj = block(key, value); if (obj !== false && obj !== nil) { if (Opal.hash_delete(self, key) !== undefined) { length--; i--; } } } return self; }, TMP_16.$$arity = 0); Opal.alias(self, 'dup', 'clone'); Opal.defn(self, '$each', TMP_18 = function $$each() { var $a, $b, TMP_19, self = this, $iter = TMP_18.$$p, block = $iter || nil; TMP_18.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_19 = function(){var self = TMP_19.$$s || this; return self.$size()}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19), $a).call($b, "each") }; for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } Opal.yield1(block, [key, value]); } return self; }, TMP_18.$$arity = 0); Opal.defn(self, '$each_key', TMP_20 = function $$each_key() { var $a, $b, TMP_21, self = this, $iter = TMP_20.$$p, block = $iter || nil; TMP_20.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_21 = function(){var self = TMP_21.$$s || this; return self.$size()}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21), $a).call($b, "each_key") }; for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { key = keys[i]; block(key.$$is_string ? key : key.key); } return self; }, TMP_20.$$arity = 0); Opal.alias(self, 'each_pair', 'each'); Opal.defn(self, '$each_value', TMP_22 = function $$each_value() { var $a, $b, TMP_23, self = this, $iter = TMP_22.$$p, block = $iter || nil; TMP_22.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_23 = function(){var self = TMP_23.$$s || this; return self.$size()}, TMP_23.$$s = self, TMP_23.$$arity = 0, TMP_23), $a).call($b, "each_value") }; for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { key = keys[i]; block(key.$$is_string ? self.$$smap[key] : key.value); } return self; }, TMP_22.$$arity = 0); Opal.defn(self, '$empty?', TMP_24 = function() { var self = this; return self.$$keys.length === 0; }, TMP_24.$$arity = 0); Opal.alias(self, 'eql?', '=='); Opal.defn(self, '$fetch', TMP_25 = function $$fetch(key, defaults) { var self = this, $iter = TMP_25.$$p, block = $iter || nil; TMP_25.$$p = null; var value = Opal.hash_get(self, key); if (value !== undefined) { return value; } if (block !== nil) { return block(key); } if (defaults !== undefined) { return defaults; } return self.$raise($scope.get('KeyError'), "key not found: " + (key.$inspect())); }, TMP_25.$$arity = -2); Opal.defn(self, '$flatten', TMP_26 = function $$flatten(level) { var self = this; if (level == null) { level = 1; } level = $scope.get('Opal')['$coerce_to!'](level, $scope.get('Integer'), "to_int"); var result = []; for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } result.push(key); if (value.$$is_array) { if (level === 1) { result.push(value); continue; } result = result.concat((value).$flatten(level - 2)); continue; } result.push(value); } return result; }, TMP_26.$$arity = -1); Opal.defn(self, '$has_key?', TMP_27 = function(key) { var self = this; return Opal.hash_get(self, key) !== undefined; }, TMP_27.$$arity = 1); Opal.defn(self, '$has_value?', TMP_28 = function(value) { var self = this; for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { key = keys[i]; if (((key.$$is_string ? self.$$smap[key] : key.value))['$=='](value)) { return true; } } return false; }, TMP_28.$$arity = 1); Opal.defn(self, '$hash', TMP_29 = function $$hash() { var self = this; var top = (Opal.hash_ids === undefined), hash_id = self.$object_id(), result = ['Hash'], key, item; try { if (top) { Opal.hash_ids = {}; } if (Opal.hash_ids.hasOwnProperty(hash_id)) { return 'self'; } for (key in Opal.hash_ids) { if (Opal.hash_ids.hasOwnProperty(key)) { item = Opal.hash_ids[key]; if (self['$eql?'](item)) { return 'self'; } } } Opal.hash_ids[hash_id] = self; for (var i = 0, keys = self.$$keys, length = keys.length; i < length; i++) { key = keys[i]; if (key.$$is_string) { result.push([key, self.$$smap[key].$hash()]); } else { result.push([key.key_hash, key.value.$hash()]); } } return result.sort().join(); } finally { if (top) { delete Opal.hash_ids; } } }, TMP_29.$$arity = 0); Opal.alias(self, 'include?', 'has_key?'); Opal.defn(self, '$index', TMP_30 = function $$index(object) { var self = this; for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } if ((value)['$=='](object)) { return key; } } return nil; }, TMP_30.$$arity = 1); Opal.defn(self, '$indexes', TMP_31 = function $$indexes($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } var result = []; for (var i = 0, length = args.length, key, value; i < length; i++) { key = args[i]; value = Opal.hash_get(self, key); if (value === undefined) { result.push(self.$default()); continue; } result.push(value); } return result; }, TMP_31.$$arity = -1); Opal.alias(self, 'indices', 'indexes'); var inspect_ids; Opal.defn(self, '$inspect', TMP_32 = function $$inspect() { var self = this; var top = (inspect_ids === undefined), hash_id = self.$object_id(), result = []; try { if (top) { inspect_ids = {}; } if (inspect_ids.hasOwnProperty(hash_id)) { return '{...}'; } inspect_ids[hash_id] = true; for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } result.push(key.$inspect() + '=>' + value.$inspect()); } return '{' + result.join(', ') + '}'; } finally { if (top) { inspect_ids = undefined; } } }, TMP_32.$$arity = 0); Opal.defn(self, '$invert', TMP_33 = function $$invert() { var self = this; var hash = Opal.hash(); for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } Opal.hash_put(hash, value, key); } return hash; }, TMP_33.$$arity = 0); Opal.defn(self, '$keep_if', TMP_34 = function $$keep_if() { var $a, $b, TMP_35, self = this, $iter = TMP_34.$$p, block = $iter || nil; TMP_34.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_35 = function(){var self = TMP_35.$$s || this; return self.$size()}, TMP_35.$$s = self, TMP_35.$$arity = 0, TMP_35), $a).call($b, "keep_if") }; for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } obj = block(key, value); if (obj === false || obj === nil) { if (Opal.hash_delete(self, key) !== undefined) { length--; i--; } } } return self; }, TMP_34.$$arity = 0); Opal.alias(self, 'key', 'index'); Opal.alias(self, 'key?', 'has_key?'); Opal.defn(self, '$keys', TMP_36 = function $$keys() { var self = this; var result = []; for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { key = keys[i]; if (key.$$is_string) { result.push(key); } else { result.push(key.key); } } return result; }, TMP_36.$$arity = 0); Opal.defn(self, '$length', TMP_37 = function $$length() { var self = this; return self.$$keys.length; }, TMP_37.$$arity = 0); Opal.alias(self, 'member?', 'has_key?'); Opal.defn(self, '$merge', TMP_38 = function $$merge(other) { var $a, $b, self = this, $iter = TMP_38.$$p, block = $iter || nil; TMP_38.$$p = null; return ($a = ($b = self.$dup())['$merge!'], $a.$$p = block.$to_proc(), $a).call($b, other); }, TMP_38.$$arity = 1); Opal.defn(self, '$merge!', TMP_39 = function(other) { var self = this, $iter = TMP_39.$$p, block = $iter || nil; TMP_39.$$p = null; if (!$scope.get('Hash')['$==='](other)) { other = $scope.get('Opal')['$coerce_to!'](other, $scope.get('Hash'), "to_hash"); } var i, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; if (block === nil) { for (i = 0; i < length; i++) { key = other_keys[i]; if (key.$$is_string) { other_value = other.$$smap[key]; } else { other_value = key.value; key = key.key; } Opal.hash_put(self, key, other_value); } return self; } for (i = 0; i < length; i++) { key = other_keys[i]; if (key.$$is_string) { other_value = other.$$smap[key]; } else { other_value = key.value; key = key.key; } value = Opal.hash_get(self, key); if (value === undefined) { Opal.hash_put(self, key, other_value); continue; } Opal.hash_put(self, key, block(key, value, other_value)); } return self; ; }, TMP_39.$$arity = 1); Opal.defn(self, '$rassoc', TMP_40 = function $$rassoc(object) { var self = this; for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } if ((value)['$=='](object)) { return [key, value]; } } return nil; }, TMP_40.$$arity = 1); Opal.defn(self, '$rehash', TMP_41 = function $$rehash() { var self = this; Opal.hash_rehash(self); return self; }, TMP_41.$$arity = 0); Opal.defn(self, '$reject', TMP_42 = function $$reject() { var $a, $b, TMP_43, self = this, $iter = TMP_42.$$p, block = $iter || nil; TMP_42.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_43 = function(){var self = TMP_43.$$s || this; return self.$size()}, TMP_43.$$s = self, TMP_43.$$arity = 0, TMP_43), $a).call($b, "reject") }; var hash = Opal.hash(); for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } obj = block(key, value); if (obj === false || obj === nil) { Opal.hash_put(hash, key, value); } } return hash; }, TMP_42.$$arity = 0); Opal.defn(self, '$reject!', TMP_44 = function() { var $a, $b, TMP_45, self = this, $iter = TMP_44.$$p, block = $iter || nil; TMP_44.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_45 = function(){var self = TMP_45.$$s || this; return self.$size()}, TMP_45.$$s = self, TMP_45.$$arity = 0, TMP_45), $a).call($b, "reject!") }; var changes_were_made = false; for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } obj = block(key, value); if (obj !== false && obj !== nil) { if (Opal.hash_delete(self, key) !== undefined) { changes_were_made = true; length--; i--; } } } return changes_were_made ? self : nil; }, TMP_44.$$arity = 0); Opal.defn(self, '$replace', TMP_46 = function $$replace(other) { var $a, $b, self = this; other = $scope.get('Opal')['$coerce_to!'](other, $scope.get('Hash'), "to_hash"); Opal.hash_init(self); for (var i = 0, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; i < length; i++) { key = other_keys[i]; if (key.$$is_string) { other_value = other.$$smap[key]; } else { other_value = key.value; key = key.key; } Opal.hash_put(self, key, other_value); } if ((($a = other.$default_proc()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = [other.$default_proc()]), $b = self, $b['$default_proc='].apply($b, $a), $a[$a.length-1]) } else { (($a = [other.$default()]), $b = self, $b['$default='].apply($b, $a), $a[$a.length-1]) }; return self; }, TMP_46.$$arity = 1); Opal.defn(self, '$select', TMP_47 = function $$select() { var $a, $b, TMP_48, self = this, $iter = TMP_47.$$p, block = $iter || nil; TMP_47.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_48 = function(){var self = TMP_48.$$s || this; return self.$size()}, TMP_48.$$s = self, TMP_48.$$arity = 0, TMP_48), $a).call($b, "select") }; var hash = Opal.hash(); for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } obj = block(key, value); if (obj !== false && obj !== nil) { Opal.hash_put(hash, key, value); } } return hash; }, TMP_47.$$arity = 0); Opal.defn(self, '$select!', TMP_49 = function() { var $a, $b, TMP_50, self = this, $iter = TMP_49.$$p, block = $iter || nil; TMP_49.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_50 = function(){var self = TMP_50.$$s || this; return self.$size()}, TMP_50.$$s = self, TMP_50.$$arity = 0, TMP_50), $a).call($b, "select!") }; var result = nil; for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } obj = block(key, value); if (obj === false || obj === nil) { if (Opal.hash_delete(self, key) !== undefined) { length--; i--; } result = self; } } return result; }, TMP_49.$$arity = 0); Opal.defn(self, '$shift', TMP_51 = function $$shift() { var self = this; var keys = self.$$keys, key; if (keys.length > 0) { key = keys[0]; key = key.$$is_string ? key : key.key; return [key, Opal.hash_delete(self, key)]; } return self.$default(nil); }, TMP_51.$$arity = 0); Opal.alias(self, 'size', 'length'); self.$alias_method("store", "[]="); Opal.defn(self, '$to_a', TMP_52 = function $$to_a() { var self = this; var result = []; for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } result.push([key, value]); } return result; }, TMP_52.$$arity = 0); Opal.defn(self, '$to_h', TMP_53 = function $$to_h() { var self = this; if (self.$$class === Opal.Hash) { return self; } var hash = new Opal.Hash.$$alloc(); Opal.hash_init(hash); Opal.hash_clone(self, hash); return hash; }, TMP_53.$$arity = 0); Opal.defn(self, '$to_hash', TMP_54 = function $$to_hash() { var self = this; return self; }, TMP_54.$$arity = 0); Opal.alias(self, 'to_s', 'inspect'); Opal.alias(self, 'update', 'merge!'); Opal.alias(self, 'value?', 'has_value?'); Opal.alias(self, 'values_at', 'indexes'); return (Opal.defn(self, '$values', TMP_55 = function $$values() { var self = this; var result = []; for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { key = keys[i]; if (key.$$is_string) { result.push(self.$$smap[key]); } else { result.push(key.value); } } return result; }, TMP_55.$$arity = 0), nil) && 'values'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/number"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_divide(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); } function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } function $rb_le(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); } function $rb_ge(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$bridge', '$raise', '$class', '$Float', '$respond_to?', '$coerce_to!', '$__coerced__', '$===', '$!', '$>', '$**', '$new', '$<', '$to_f', '$==', '$nan?', '$infinite?', '$enum_for', '$+', '$-', '$gcd', '$lcm', '$/', '$frexp', '$to_i', '$ldexp', '$rationalize', '$*', '$<<', '$to_r', '$-@', '$size', '$<=', '$>=']); self.$require("corelib/numeric"); (function($base, $super) { function $Number(){}; var self = $Number = $klass($base, $super, 'Number', $Number); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_40, TMP_41, TMP_42, TMP_43, TMP_44, TMP_45, TMP_46, TMP_47, TMP_48, TMP_49, TMP_50, TMP_51, TMP_52, TMP_54, TMP_55, TMP_56, TMP_57, TMP_58, TMP_59, TMP_61, TMP_62, TMP_63, TMP_64, TMP_65, TMP_66, TMP_67; $scope.get('Opal').$bridge(self, Number); Number.prototype.$$is_number = true; Opal.defn(self, '$coerce', TMP_1 = function $$coerce(other) { var self = this; if (other === nil) { self.$raise($scope.get('TypeError'), "can't convert " + (other.$class()) + " into Float"); } else if (other.$$is_string) { return [self.$Float(other), self]; } else if (other['$respond_to?']("to_f")) { return [$scope.get('Opal')['$coerce_to!'](other, $scope.get('Float'), "to_f"), self]; } else if (other.$$is_number) { return [other, self]; } else { self.$raise($scope.get('TypeError'), "can't convert " + (other.$class()) + " into Float"); } ; }, TMP_1.$$arity = 1); Opal.defn(self, '$__id__', TMP_2 = function $$__id__() { var self = this; return (self * 2) + 1; }, TMP_2.$$arity = 0); Opal.alias(self, 'object_id', '__id__'); Opal.defn(self, '$+', TMP_3 = function(other) { var self = this; if (other.$$is_number) { return self + other; } else { return self.$__coerced__("+", other); } }, TMP_3.$$arity = 1); Opal.defn(self, '$-', TMP_4 = function(other) { var self = this; if (other.$$is_number) { return self - other; } else { return self.$__coerced__("-", other); } }, TMP_4.$$arity = 1); Opal.defn(self, '$*', TMP_5 = function(other) { var self = this; if (other.$$is_number) { return self * other; } else { return self.$__coerced__("*", other); } }, TMP_5.$$arity = 1); Opal.defn(self, '$/', TMP_6 = function(other) { var self = this; if (other.$$is_number) { return self / other; } else { return self.$__coerced__("/", other); } }, TMP_6.$$arity = 1); Opal.alias(self, 'fdiv', '/'); Opal.defn(self, '$%', TMP_7 = function(other) { var self = this; if (other.$$is_number) { if (other == -Infinity) { return other; } else if (other == 0) { self.$raise($scope.get('ZeroDivisionError'), "divided by 0"); } else if (other < 0 || self < 0) { return (self % other + other) % other; } else { return self % other; } } else { return self.$__coerced__("%", other); } }, TMP_7.$$arity = 1); Opal.defn(self, '$&', TMP_8 = function(other) { var self = this; if (other.$$is_number) { return self & other; } else { return self.$__coerced__("&", other); } }, TMP_8.$$arity = 1); Opal.defn(self, '$|', TMP_9 = function(other) { var self = this; if (other.$$is_number) { return self | other; } else { return self.$__coerced__("|", other); } }, TMP_9.$$arity = 1); Opal.defn(self, '$^', TMP_10 = function(other) { var self = this; if (other.$$is_number) { return self ^ other; } else { return self.$__coerced__("^", other); } }, TMP_10.$$arity = 1); Opal.defn(self, '$<', TMP_11 = function(other) { var self = this; if (other.$$is_number) { return self < other; } else { return self.$__coerced__("<", other); } }, TMP_11.$$arity = 1); Opal.defn(self, '$<=', TMP_12 = function(other) { var self = this; if (other.$$is_number) { return self <= other; } else { return self.$__coerced__("<=", other); } }, TMP_12.$$arity = 1); Opal.defn(self, '$>', TMP_13 = function(other) { var self = this; if (other.$$is_number) { return self > other; } else { return self.$__coerced__(">", other); } }, TMP_13.$$arity = 1); Opal.defn(self, '$>=', TMP_14 = function(other) { var self = this; if (other.$$is_number) { return self >= other; } else { return self.$__coerced__(">=", other); } }, TMP_14.$$arity = 1); var spaceship_operator = function(self, other) { if (other.$$is_number) { if (isNaN(self) || isNaN(other)) { return nil; } if (self > other) { return 1; } else if (self < other) { return -1; } else { return 0; } } else { return self.$__coerced__("<=>", other); } } Opal.defn(self, '$<=>', TMP_15 = function(other) { var self = this; try { return spaceship_operator(self, other); } catch ($err) { if (Opal.rescue($err, [$scope.get('ArgumentError')])) { try { return nil } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_15.$$arity = 1); Opal.defn(self, '$<<', TMP_16 = function(count) { var self = this; count = $scope.get('Opal')['$coerce_to!'](count, $scope.get('Integer'), "to_int"); return count > 0 ? self << count : self >> -count; }, TMP_16.$$arity = 1); Opal.defn(self, '$>>', TMP_17 = function(count) { var self = this; count = $scope.get('Opal')['$coerce_to!'](count, $scope.get('Integer'), "to_int"); return count > 0 ? self >> count : self << -count; }, TMP_17.$$arity = 1); Opal.defn(self, '$[]', TMP_18 = function(bit) { var self = this; bit = $scope.get('Opal')['$coerce_to!'](bit, $scope.get('Integer'), "to_int"); if (bit < 0) { return 0; } if (bit >= 32) { return self < 0 ? 1 : 0; } return (self >> bit) & 1; ; }, TMP_18.$$arity = 1); Opal.defn(self, '$+@', TMP_19 = function() { var self = this; return +self; }, TMP_19.$$arity = 0); Opal.defn(self, '$-@', TMP_20 = function() { var self = this; return -self; }, TMP_20.$$arity = 0); Opal.defn(self, '$~', TMP_21 = function() { var self = this; return ~self; }, TMP_21.$$arity = 0); Opal.defn(self, '$**', TMP_22 = function(other) { var $a, $b, $c, self = this; if ((($a = $scope.get('Integer')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = ((($b = ($scope.get('Integer')['$==='](self))['$!']()) !== false && $b !== nil && $b != null) ? $b : $rb_gt(other, 0))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return Math.pow(self, other); } else { return $scope.get('Rational').$new(self, 1)['$**'](other) } } else if ((($a = (($b = $rb_lt(self, 0)) ? (((($c = $scope.get('Float')['$==='](other)) !== false && $c !== nil && $c != null) ? $c : $scope.get('Rational')['$==='](other))) : $rb_lt(self, 0))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('Complex').$new(self, 0)['$**'](other.$to_f()) } else if ((($a = other.$$is_number != null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return Math.pow(self, other); } else { return self.$__coerced__("**", other) }; }, TMP_22.$$arity = 1); Opal.defn(self, '$==', TMP_23 = function(other) { var self = this; if (other.$$is_number) { return self == Number(other); } else if (other['$respond_to?']("==")) { return other['$=='](self); } else { return false; } ; }, TMP_23.$$arity = 1); Opal.defn(self, '$abs', TMP_24 = function $$abs() { var self = this; return Math.abs(self); }, TMP_24.$$arity = 0); Opal.defn(self, '$abs2', TMP_25 = function $$abs2() { var self = this; return Math.abs(self * self); }, TMP_25.$$arity = 0); Opal.defn(self, '$angle', TMP_26 = function $$angle() { var $a, self = this; if ((($a = self['$nan?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self}; if (self == 0) { if (1 / self > 0) { return 0; } else { return Math.PI; } } else if (self < 0) { return Math.PI; } else { return 0; } }, TMP_26.$$arity = 0); Opal.alias(self, 'arg', 'angle'); Opal.alias(self, 'phase', 'angle'); Opal.defn(self, '$bit_length', TMP_27 = function $$bit_length() { var $a, self = this; if ((($a = $scope.get('Integer')['$==='](self)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('NoMethodError').$new("undefined method `bit_length` for " + (self) + ":Float", "bit_length")) }; if (self === 0 || self === -1) { return 0; } var result = 0, value = self < 0 ? ~self : self; while (value != 0) { result += 1; value >>>= 1; } return result; }, TMP_27.$$arity = 0); Opal.defn(self, '$ceil', TMP_28 = function $$ceil() { var self = this; return Math.ceil(self); }, TMP_28.$$arity = 0); Opal.defn(self, '$chr', TMP_29 = function $$chr(encoding) { var self = this; return String.fromCharCode(self); }, TMP_29.$$arity = -1); Opal.defn(self, '$denominator', TMP_30 = function $$denominator() { var $a, $b, self = this, $iter = TMP_30.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_30.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = ((($b = self['$nan?']()) !== false && $b !== nil && $b != null) ? $b : self['$infinite?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return 1 } else { return ($a = ($b = self, Opal.find_super_dispatcher(self, 'denominator', TMP_30, false)), $a.$$p = $iter, $a).apply($b, $zuper) }; }, TMP_30.$$arity = 0); Opal.defn(self, '$downto', TMP_31 = function $$downto(stop) { var $a, $b, TMP_32, self = this, $iter = TMP_31.$$p, block = $iter || nil; TMP_31.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_32 = function(){var self = TMP_32.$$s || this, $c; if ((($c = $scope.get('Numeric')['$==='](stop)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { self.$raise($scope.get('ArgumentError'), "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") }; if ((($c = $rb_gt(stop, self)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return 0 } else { return $rb_plus($rb_minus(self, stop), 1) };}, TMP_32.$$s = self, TMP_32.$$arity = 0, TMP_32), $a).call($b, "downto", stop) }; if (!stop.$$is_number) { self.$raise($scope.get('ArgumentError'), "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") } for (var i = self; i >= stop; i--) { block(i); } ; return self; }, TMP_31.$$arity = 1); Opal.alias(self, 'eql?', '=='); Opal.defn(self, '$equal?', TMP_33 = function(other) { var $a, self = this; return ((($a = self['$=='](other)) !== false && $a !== nil && $a != null) ? $a : isNaN(self) && isNaN(other)); }, TMP_33.$$arity = 1); Opal.defn(self, '$even?', TMP_34 = function() { var self = this; return self % 2 === 0; }, TMP_34.$$arity = 0); Opal.defn(self, '$floor', TMP_35 = function $$floor() { var self = this; return Math.floor(self); }, TMP_35.$$arity = 0); Opal.defn(self, '$gcd', TMP_36 = function $$gcd(other) { var $a, self = this; if ((($a = $scope.get('Integer')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('TypeError'), "not an integer") }; var min = Math.abs(self), max = Math.abs(other); while (min > 0) { var tmp = min; min = max % min; max = tmp; } return max; }, TMP_36.$$arity = 1); Opal.defn(self, '$gcdlcm', TMP_37 = function $$gcdlcm(other) { var self = this; return [self.$gcd(), self.$lcm()]; }, TMP_37.$$arity = 1); Opal.defn(self, '$integer?', TMP_38 = function() { var self = this; return self % 1 === 0; }, TMP_38.$$arity = 0); Opal.defn(self, '$is_a?', TMP_39 = function(klass) { var $a, $b, self = this, $iter = TMP_39.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_39.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = (($b = klass['$==']($scope.get('Fixnum'))) ? $scope.get('Integer')['$==='](self) : klass['$==']($scope.get('Fixnum')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return true}; if ((($a = (($b = klass['$==']($scope.get('Integer'))) ? $scope.get('Integer')['$==='](self) : klass['$==']($scope.get('Integer')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return true}; if ((($a = (($b = klass['$==']($scope.get('Float'))) ? $scope.get('Float')['$==='](self) : klass['$==']($scope.get('Float')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return true}; return ($a = ($b = self, Opal.find_super_dispatcher(self, 'is_a?', TMP_39, false)), $a.$$p = $iter, $a).apply($b, $zuper); }, TMP_39.$$arity = 1); Opal.alias(self, 'kind_of?', 'is_a?'); Opal.defn(self, '$instance_of?', TMP_40 = function(klass) { var $a, $b, self = this, $iter = TMP_40.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_40.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = (($b = klass['$==']($scope.get('Fixnum'))) ? $scope.get('Integer')['$==='](self) : klass['$==']($scope.get('Fixnum')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return true}; if ((($a = (($b = klass['$==']($scope.get('Integer'))) ? $scope.get('Integer')['$==='](self) : klass['$==']($scope.get('Integer')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return true}; if ((($a = (($b = klass['$==']($scope.get('Float'))) ? $scope.get('Float')['$==='](self) : klass['$==']($scope.get('Float')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return true}; return ($a = ($b = self, Opal.find_super_dispatcher(self, 'instance_of?', TMP_40, false)), $a.$$p = $iter, $a).apply($b, $zuper); }, TMP_40.$$arity = 1); Opal.defn(self, '$lcm', TMP_41 = function $$lcm(other) { var $a, self = this; if ((($a = $scope.get('Integer')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('TypeError'), "not an integer") }; if (self == 0 || other == 0) { return 0; } else { return Math.abs(self * other / self.$gcd(other)); } }, TMP_41.$$arity = 1); Opal.alias(self, 'magnitude', 'abs'); Opal.alias(self, 'modulo', '%'); Opal.defn(self, '$next', TMP_42 = function $$next() { var self = this; return self + 1; }, TMP_42.$$arity = 0); Opal.defn(self, '$nonzero?', TMP_43 = function() { var self = this; return self == 0 ? nil : self; }, TMP_43.$$arity = 0); Opal.defn(self, '$numerator', TMP_44 = function $$numerator() { var $a, $b, self = this, $iter = TMP_44.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_44.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = ((($b = self['$nan?']()) !== false && $b !== nil && $b != null) ? $b : self['$infinite?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self } else { return ($a = ($b = self, Opal.find_super_dispatcher(self, 'numerator', TMP_44, false)), $a.$$p = $iter, $a).apply($b, $zuper) }; }, TMP_44.$$arity = 0); Opal.defn(self, '$odd?', TMP_45 = function() { var self = this; return self % 2 !== 0; }, TMP_45.$$arity = 0); Opal.defn(self, '$ord', TMP_46 = function $$ord() { var self = this; return self; }, TMP_46.$$arity = 0); Opal.defn(self, '$pred', TMP_47 = function $$pred() { var self = this; return self - 1; }, TMP_47.$$arity = 0); Opal.defn(self, '$quo', TMP_48 = function $$quo(other) { var $a, $b, self = this, $iter = TMP_48.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_48.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = $scope.get('Integer')['$==='](self)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self, Opal.find_super_dispatcher(self, 'quo', TMP_48, false)), $a.$$p = $iter, $a).apply($b, $zuper) } else { return $rb_divide(self, other) }; }, TMP_48.$$arity = 1); Opal.defn(self, '$rationalize', TMP_49 = function $$rationalize(eps) { var $a, $b, self = this, f = nil, n = nil; if (arguments.length > 1) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " for 0..1)"); } ; if ((($a = $scope.get('Integer')['$==='](self)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('Rational').$new(self, 1) } else if ((($a = self['$infinite?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise($scope.get('FloatDomainError'), "Infinity") } else if ((($a = self['$nan?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise($scope.get('FloatDomainError'), "NaN") } else if ((($a = eps == null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { $b = $scope.get('Math').$frexp(self), $a = Opal.to_ary($b), f = ($a[0] == null ? nil : $a[0]), n = ($a[1] == null ? nil : $a[1]), $b; f = $scope.get('Math').$ldexp(f, (($scope.get('Float')).$$scope.get('MANT_DIG'))).$to_i(); n = $rb_minus(n, (($scope.get('Float')).$$scope.get('MANT_DIG'))); return $scope.get('Rational').$new($rb_times(2, f), (1)['$<<'](($rb_minus(1, n)))).$rationalize($scope.get('Rational').$new(1, (1)['$<<'](($rb_minus(1, n))))); } else { return self.$to_r().$rationalize(eps) }; }, TMP_49.$$arity = -1); Opal.defn(self, '$round', TMP_50 = function $$round(ndigits) { var $a, $b, self = this, _ = nil, exp = nil; if ((($a = $scope.get('Integer')['$==='](self)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = ndigits == null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self}; if ((($a = ($b = $scope.get('Float')['$==='](ndigits), $b !== false && $b !== nil && $b != null ?ndigits['$infinite?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('RangeError'), "Infinity")}; ndigits = $scope.get('Opal')['$coerce_to!'](ndigits, $scope.get('Integer'), "to_int"); if ((($a = $rb_lt(ndigits, (($scope.get('Integer')).$$scope.get('MIN')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('RangeError'), "out of bounds")}; if ((($a = ndigits >= 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self}; ndigits = ndigits['$-@'](); if (0.415241 * ndigits - 0.125 > self.$size()) { return 0; } var f = Math.pow(10, ndigits), x = Math.floor((Math.abs(x) + f / 2) / f) * f; return self < 0 ? -x : x; ; } else { if ((($a = ($b = self['$nan?'](), $b !== false && $b !== nil && $b != null ?ndigits == null : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('FloatDomainError'), "NaN")}; ndigits = $scope.get('Opal')['$coerce_to!'](ndigits || 0, $scope.get('Integer'), "to_int"); if ((($a = $rb_le(ndigits, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self['$nan?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('RangeError'), "NaN") } else if ((($a = self['$infinite?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('FloatDomainError'), "Infinity")} } else if (ndigits['$=='](0)) { return Math.round(self) } else if ((($a = ((($b = self['$nan?']()) !== false && $b !== nil && $b != null) ? $b : self['$infinite?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self}; $b = $scope.get('Math').$frexp(self), $a = Opal.to_ary($b), _ = ($a[0] == null ? nil : $a[0]), exp = ($a[1] == null ? nil : $a[1]), $b; if ((($a = $rb_ge(ndigits, $rb_minus(($rb_plus((($scope.get('Float')).$$scope.get('DIG')), 2)), ((function() {if ((($b = $rb_gt(exp, 0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return $rb_divide(exp, 4) } else { return $rb_minus($rb_divide(exp, 3), 1) }; return nil; })())))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self}; if ((($a = $rb_lt(ndigits, ((function() {if ((($b = $rb_gt(exp, 0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return $rb_plus($rb_divide(exp, 3), 1) } else { return $rb_divide(exp, 4) }; return nil; })())['$-@']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return 0}; return Math.round(self * Math.pow(10, ndigits)) / Math.pow(10, ndigits); }; }, TMP_50.$$arity = -1); Opal.defn(self, '$step', TMP_51 = function $$step(limit, step) { var $a, self = this, $iter = TMP_51.$$p, block = $iter || nil; if (step == null) { step = 1; } TMP_51.$$p = null; if (block !== false && block !== nil && block != null) { } else { return self.$enum_for("step", limit, step) }; if ((($a = step == 0) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "step cannot be 0")}; var value = self; if (limit === Infinity || limit === -Infinity) { block(value); return self; } if (step > 0) { while (value <= limit) { block(value); value += step; } } else { while (value >= limit) { block(value); value += step; } } return self; }, TMP_51.$$arity = -2); Opal.alias(self, 'succ', 'next'); Opal.defn(self, '$times', TMP_52 = function $$times() { var $a, $b, TMP_53, self = this, $iter = TMP_52.$$p, block = $iter || nil; TMP_52.$$p = null; if (block !== false && block !== nil && block != null) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_53 = function(){var self = TMP_53.$$s || this; return self}, TMP_53.$$s = self, TMP_53.$$arity = 0, TMP_53), $a).call($b, "times") }; for (var i = 0; i < self; i++) { block(i); } return self; }, TMP_52.$$arity = 0); Opal.defn(self, '$to_f', TMP_54 = function $$to_f() { var self = this; return self; }, TMP_54.$$arity = 0); Opal.defn(self, '$to_i', TMP_55 = function $$to_i() { var self = this; return parseInt(self, 10); }, TMP_55.$$arity = 0); Opal.alias(self, 'to_int', 'to_i'); Opal.defn(self, '$to_r', TMP_56 = function $$to_r() { var $a, $b, self = this, f = nil, e = nil; if ((($a = $scope.get('Integer')['$==='](self)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('Rational').$new(self, 1) } else { $b = $scope.get('Math').$frexp(self), $a = Opal.to_ary($b), f = ($a[0] == null ? nil : $a[0]), e = ($a[1] == null ? nil : $a[1]), $b; f = $scope.get('Math').$ldexp(f, (($scope.get('Float')).$$scope.get('MANT_DIG'))).$to_i(); e = $rb_minus(e, (($scope.get('Float')).$$scope.get('MANT_DIG'))); return ($rb_times(f, ((($scope.get('Float')).$$scope.get('RADIX'))['$**'](e)))).$to_r(); }; }, TMP_56.$$arity = 0); Opal.defn(self, '$to_s', TMP_57 = function $$to_s(base) { var $a, $b, self = this; if (base == null) { base = 10; } if ((($a = ((($b = $rb_lt(base, 2)) !== false && $b !== nil && $b != null) ? $b : $rb_gt(base, 36))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "base must be between 2 and 36")}; return self.toString(base); }, TMP_57.$$arity = -1); Opal.alias(self, 'truncate', 'to_i'); Opal.alias(self, 'inspect', 'to_s'); Opal.defn(self, '$divmod', TMP_58 = function $$divmod(other) { var $a, $b, self = this, $iter = TMP_58.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_58.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = ((($b = self['$nan?']()) !== false && $b !== nil && $b != null) ? $b : other['$nan?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise($scope.get('FloatDomainError'), "NaN") } else if ((($a = self['$infinite?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise($scope.get('FloatDomainError'), "Infinity") } else { return ($a = ($b = self, Opal.find_super_dispatcher(self, 'divmod', TMP_58, false)), $a.$$p = $iter, $a).apply($b, $zuper) }; }, TMP_58.$$arity = 1); Opal.defn(self, '$upto', TMP_59 = function $$upto(stop) { var $a, $b, TMP_60, self = this, $iter = TMP_59.$$p, block = $iter || nil; TMP_59.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_60 = function(){var self = TMP_60.$$s || this, $c; if ((($c = $scope.get('Numeric')['$==='](stop)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { self.$raise($scope.get('ArgumentError'), "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") }; if ((($c = $rb_lt(stop, self)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return 0 } else { return $rb_plus($rb_minus(stop, self), 1) };}, TMP_60.$$s = self, TMP_60.$$arity = 0, TMP_60), $a).call($b, "upto", stop) }; if (!stop.$$is_number) { self.$raise($scope.get('ArgumentError'), "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") } for (var i = self; i <= stop; i++) { block(i); } ; return self; }, TMP_59.$$arity = 1); Opal.defn(self, '$zero?', TMP_61 = function() { var self = this; return self == 0; }, TMP_61.$$arity = 0); Opal.defn(self, '$size', TMP_62 = function $$size() { var self = this; return 4; }, TMP_62.$$arity = 0); Opal.defn(self, '$nan?', TMP_63 = function() { var self = this; return isNaN(self); }, TMP_63.$$arity = 0); Opal.defn(self, '$finite?', TMP_64 = function() { var self = this; return self != Infinity && self != -Infinity && !isNaN(self); }, TMP_64.$$arity = 0); Opal.defn(self, '$infinite?', TMP_65 = function() { var self = this; if (self == Infinity) { return +1; } else if (self == -Infinity) { return -1; } else { return nil; } }, TMP_65.$$arity = 0); Opal.defn(self, '$positive?', TMP_66 = function() { var self = this; return self == Infinity || 1 / self > 0; }, TMP_66.$$arity = 0); return (Opal.defn(self, '$negative?', TMP_67 = function() { var self = this; return self == -Infinity || 1 / self < 0; }, TMP_67.$$arity = 0), nil) && 'negative?'; })($scope.base, $scope.get('Numeric')); Opal.cdecl($scope, 'Fixnum', $scope.get('Number')); (function($base, $super) { function $Integer(){}; var self = $Integer = $klass($base, $super, 'Integer', $Integer); var def = self.$$proto, $scope = self.$$scope, TMP_68; Opal.defs(self, '$===', TMP_68 = function(other) { var self = this; if (!other.$$is_number) { return false; } return (other % 1) === 0; }, TMP_68.$$arity = 1); Opal.cdecl($scope, 'MAX', Math.pow(2, 30) - 1); return Opal.cdecl($scope, 'MIN', -Math.pow(2, 30)); })($scope.base, $scope.get('Numeric')); return (function($base, $super) { function $Float(){}; var self = $Float = $klass($base, $super, 'Float', $Float); var def = self.$$proto, $scope = self.$$scope, TMP_69, $a; Opal.defs(self, '$===', TMP_69 = function(other) { var self = this; return !!other.$$is_number; }, TMP_69.$$arity = 1); Opal.cdecl($scope, 'INFINITY', Infinity); Opal.cdecl($scope, 'MAX', Number.MAX_VALUE); Opal.cdecl($scope, 'MIN', Number.MIN_VALUE); Opal.cdecl($scope, 'NAN', NaN); Opal.cdecl($scope, 'DIG', 15); Opal.cdecl($scope, 'MANT_DIG', 53); Opal.cdecl($scope, 'RADIX', 2); if ((($a = (typeof(Number.EPSILON) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return Opal.cdecl($scope, 'EPSILON', Number.EPSILON) } else { return Opal.cdecl($scope, 'EPSILON', 2.2204460492503130808472633361816E-16) }; })($scope.base, $scope.get('Numeric')); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/range"] = function(Opal) { function $rb_le(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); } function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$include', '$attr_reader', '$<=>', '$raise', '$include?', '$<=', '$<', '$enum_for', '$upto', '$to_proc', '$succ', '$!', '$==', '$===', '$exclude_end?', '$eql?', '$begin', '$end', '$-', '$abs', '$to_i', '$inspect', '$[]']); self.$require("corelib/enumerable"); return (function($base, $super) { function $Range(){}; var self = $Range = $klass($base, $super, 'Range', $Range); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13; def.begin = def.exclude = def.end = nil; self.$include($scope.get('Enumerable')); def.$$is_range = true; self.$attr_reader("begin", "end"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(first, last, exclude) { var $a, self = this; if (exclude == null) { exclude = false; } if ((($a = first['$<=>'](last)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError')) }; self.begin = first; self.end = last; return self.exclude = exclude; }, TMP_1.$$arity = -3); Opal.defn(self, '$==', TMP_2 = function(other) { var self = this; if (!other.$$is_range) { return false; } return self.exclude === other.exclude && self.begin == other.begin && self.end == other.end; }, TMP_2.$$arity = 1); Opal.defn(self, '$===', TMP_3 = function(value) { var self = this; return self['$include?'](value); }, TMP_3.$$arity = 1); Opal.defn(self, '$cover?', TMP_4 = function(value) { var $a, $b, self = this; return ($a = $rb_le(self.begin, value), $a !== false && $a !== nil && $a != null ?((function() {if ((($b = self.exclude) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return $rb_lt(value, self.end) } else { return $rb_le(value, self.end) }; return nil; })()) : $a); }, TMP_4.$$arity = 1); Opal.defn(self, '$each', TMP_5 = function $$each() { var $a, $b, $c, self = this, $iter = TMP_5.$$p, block = $iter || nil, current = nil, last = nil; TMP_5.$$p = null; if ((block !== nil)) { } else { return self.$enum_for("each") }; var i, limit; if (self.begin.$$is_number && self.end.$$is_number) { if (self.begin % 1 !== 0 || self.end % 1 !== 0) { self.$raise($scope.get('TypeError'), "can't iterate from Float") } for (i = self.begin, limit = self.end + (function() {if ((($a = self.exclude) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return 0 } else { return 1 }; return nil; })(); i < limit; i++) { block(i); } return self; } if (self.begin.$$is_string && self.end.$$is_string) { ($a = ($b = self.begin).$upto, $a.$$p = block.$to_proc(), $a).call($b, self.end, self.exclude) return self; } ; current = self.begin; last = self.end; while ((($c = $rb_lt(current, last)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { Opal.yield1(block, current); current = current.$succ();}; if ((($a = ($c = self.exclude['$!'](), $c !== false && $c !== nil && $c != null ?current['$=='](last) : $c)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { Opal.yield1(block, current)}; return self; }, TMP_5.$$arity = 0); Opal.defn(self, '$eql?', TMP_6 = function(other) { var $a, $b, self = this; if ((($a = $scope.get('Range')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return false }; return ($a = ($b = self.exclude['$==='](other['$exclude_end?']()), $b !== false && $b !== nil && $b != null ?self.begin['$eql?'](other.$begin()) : $b), $a !== false && $a !== nil && $a != null ?self.end['$eql?'](other.$end()) : $a); }, TMP_6.$$arity = 1); Opal.defn(self, '$exclude_end?', TMP_7 = function() { var self = this; return self.exclude; }, TMP_7.$$arity = 0); Opal.alias(self, 'first', 'begin'); Opal.alias(self, 'include?', 'cover?'); Opal.alias(self, 'last', 'end'); Opal.defn(self, '$max', TMP_8 = function $$max() { var $a, $b, self = this, $iter = TMP_8.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_8.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if (($yield !== nil)) { return ($a = ($b = self, Opal.find_super_dispatcher(self, 'max', TMP_8, false)), $a.$$p = $iter, $a).apply($b, $zuper) } else { return self.exclude ? self.end - 1 : self.end; }; }, TMP_8.$$arity = 0); Opal.alias(self, 'member?', 'cover?'); Opal.defn(self, '$min', TMP_9 = function $$min() { var $a, $b, self = this, $iter = TMP_9.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_9.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if (($yield !== nil)) { return ($a = ($b = self, Opal.find_super_dispatcher(self, 'min', TMP_9, false)), $a.$$p = $iter, $a).apply($b, $zuper) } else { return self.begin }; }, TMP_9.$$arity = 0); Opal.alias(self, 'member?', 'include?'); Opal.defn(self, '$size', TMP_10 = function $$size() { var $a, $b, self = this, _begin = nil, _end = nil, infinity = nil; _begin = self.begin; _end = self.end; if ((($a = self.exclude) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { _end = $rb_minus(_end, 1)}; if ((($a = ($b = $scope.get('Numeric')['$==='](_begin), $b !== false && $b !== nil && $b != null ?$scope.get('Numeric')['$==='](_end) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; if ((($a = $rb_lt(_end, _begin)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return 0}; infinity = (($scope.get('Float')).$$scope.get('INFINITY')); if ((($a = ((($b = infinity['$=='](_begin.$abs())) !== false && $b !== nil && $b != null) ? $b : _end.$abs()['$=='](infinity))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return infinity}; return ((Math.abs(_end - _begin) + 1)).$to_i(); }, TMP_10.$$arity = 0); Opal.defn(self, '$step', TMP_11 = function $$step(n) { var self = this; if (n == null) { n = 1; } return self.$raise($scope.get('NotImplementedError')); }, TMP_11.$$arity = -1); Opal.defn(self, '$to_s', TMP_12 = function $$to_s() { var self = this; return self.begin.$inspect() + (self.exclude ? '...' : '..') + self.end.$inspect(); }, TMP_12.$$arity = 0); Opal.alias(self, 'inspect', 'to_s'); return (Opal.defn(self, '$marshal_load', TMP_13 = function $$marshal_load(args) { var self = this; self.begin = args['$[]']("begin"); self.end = args['$[]']("end"); return self.exclude = args['$[]']("excl"); }, TMP_13.$$arity = 1), nil) && 'marshal_load'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/proc"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$raise', '$coerce_to!']); return (function($base, $super) { function $Proc(){}; var self = $Proc = $klass($base, $super, 'Proc', $Proc); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10; def.$$is_proc = true; def.$$is_lambda = false; Opal.defs(self, '$new', TMP_1 = function() { var self = this, $iter = TMP_1.$$p, block = $iter || nil; TMP_1.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "tried to create a Proc object without a block") }; return block; }, TMP_1.$$arity = 0); Opal.defn(self, '$call', TMP_2 = function $$call($a_rest) { var self = this, args, $iter = TMP_2.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_2.$$p = null; if (block !== nil) { self.$$p = block; } var result, $brk = self.$$brk; if ($brk) { try { if (self.$$is_lambda) { result = self.apply(null, args); } else { result = Opal.yieldX(self, args); } } catch (err) { if (err === $brk) { return $brk.$v } else { throw err } } } else { if (self.$$is_lambda) { result = self.apply(null, args); } else { result = Opal.yieldX(self, args); } } return result; }, TMP_2.$$arity = -1); Opal.alias(self, '[]', 'call'); Opal.alias(self, '===', 'call'); Opal.alias(self, 'yield', 'call'); Opal.defn(self, '$to_proc', TMP_3 = function $$to_proc() { var self = this; return self; }, TMP_3.$$arity = 0); Opal.defn(self, '$lambda?', TMP_4 = function() { var self = this; return !!self.$$is_lambda; }, TMP_4.$$arity = 0); Opal.defn(self, '$arity', TMP_5 = function $$arity() { var self = this; if (self.$$is_curried) { return -1; } else { return self.$$arity; } }, TMP_5.$$arity = 0); Opal.defn(self, '$source_location', TMP_6 = function $$source_location() { var self = this; if (self.$$is_curried) { return nil; } return nil; }, TMP_6.$$arity = 0); Opal.defn(self, '$binding', TMP_7 = function $$binding() { var self = this; if (self.$$is_curried) { self.$raise($scope.get('ArgumentError'), "Can't create Binding") }; return nil; }, TMP_7.$$arity = 0); Opal.defn(self, '$parameters', TMP_8 = function $$parameters() { var self = this; if (self.$$is_curried) { return [["rest"]]; } else if (self.$$parameters) { if (self.$$is_lambda) { return self.$$parameters; } else { var result = [], i, length; for (i = 0, length = self.$$parameters.length; i < length; i++) { var parameter = self.$$parameters[i]; if (parameter[0] === 'req') { // required arguments always have name parameter = ['opt', parameter[1]]; } result.push(parameter); } return result; } } else { return []; } ; }, TMP_8.$$arity = 0); Opal.defn(self, '$curry', TMP_9 = function $$curry(arity) { var self = this; if (arity === undefined) { arity = self.length; } else { arity = $scope.get('Opal')['$coerce_to!'](arity, $scope.get('Integer'), "to_int"); if (self.$$is_lambda && arity !== self.length) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (arity) + " for " + (self.length) + ")") } } function curried () { var args = $slice.call(arguments), length = args.length, result; if (length > arity && self.$$is_lambda && !self.$$is_curried) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (length) + " for " + (arity) + ")") } if (length >= arity) { return self.$call.apply(self, args); } result = function () { return curried.apply(null, args.concat($slice.call(arguments))); } result.$$is_lambda = self.$$is_lambda; result.$$is_curried = true; return result; }; curried.$$is_lambda = self.$$is_lambda; curried.$$is_curried = true; return curried; }, TMP_9.$$arity = -1); Opal.defn(self, '$dup', TMP_10 = function $$dup() { var self = this; var original_proc = self.$$original_proc || self, proc = function () { return original_proc.apply(this, arguments); }; for (var prop in self) { if (self.hasOwnProperty(prop)) { proc[prop] = self[prop]; } } return proc; }, TMP_10.$$arity = 0); return Opal.alias(self, 'clone', 'dup'); })($scope.base, Function) }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/method"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$attr_reader', '$class', '$arity', '$new', '$name']); (function($base, $super) { function $Method(){}; var self = $Method = $klass($base, $super, 'Method', $Method); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7; def.method = def.receiver = def.owner = def.name = nil; self.$attr_reader("owner", "receiver", "name"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(receiver, method, name) { var self = this; self.receiver = receiver; self.owner = receiver.$class(); self.name = name; return self.method = method; }, TMP_1.$$arity = 3); Opal.defn(self, '$arity', TMP_2 = function $$arity() { var self = this; return self.method.$arity(); }, TMP_2.$$arity = 0); Opal.defn(self, '$parameters', TMP_3 = function $$parameters() { var self = this; return self.method.$$parameters; }, TMP_3.$$arity = 0); Opal.defn(self, '$call', TMP_4 = function $$call($a_rest) { var self = this, args, $iter = TMP_4.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_4.$$p = null; self.method.$$p = block; return self.method.apply(self.receiver, args); ; }, TMP_4.$$arity = -1); Opal.alias(self, '[]', 'call'); Opal.defn(self, '$unbind', TMP_5 = function $$unbind() { var self = this; return $scope.get('UnboundMethod').$new(self.owner, self.method, self.name); }, TMP_5.$$arity = 0); Opal.defn(self, '$to_proc', TMP_6 = function $$to_proc() { var self = this; var proc = function () { return self.$call.apply(self, $slice.call(arguments)); }; proc.$$unbound = self.method; proc.$$is_lambda = true; return proc; }, TMP_6.$$arity = 0); return (Opal.defn(self, '$inspect', TMP_7 = function $$inspect() { var self = this; return "#"; }, TMP_7.$$arity = 0), nil) && 'inspect'; })($scope.base, null); return (function($base, $super) { function $UnboundMethod(){}; var self = $UnboundMethod = $klass($base, $super, 'UnboundMethod', $UnboundMethod); var def = self.$$proto, $scope = self.$$scope, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12; def.method = def.name = def.owner = nil; self.$attr_reader("owner", "name"); Opal.defn(self, '$initialize', TMP_8 = function $$initialize(owner, method, name) { var self = this; self.owner = owner; self.method = method; return self.name = name; }, TMP_8.$$arity = 3); Opal.defn(self, '$arity', TMP_9 = function $$arity() { var self = this; return self.method.$arity(); }, TMP_9.$$arity = 0); Opal.defn(self, '$parameters', TMP_10 = function $$parameters() { var self = this; return self.method.$$parameters; }, TMP_10.$$arity = 0); Opal.defn(self, '$bind', TMP_11 = function $$bind(object) { var self = this; return $scope.get('Method').$new(object, self.method, self.name); }, TMP_11.$$arity = 1); return (Opal.defn(self, '$inspect', TMP_12 = function $$inspect() { var self = this; return "#"; }, TMP_12.$$arity = 0), nil) && 'inspect'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/variables"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $gvars = Opal.gvars, $hash2 = Opal.hash2; Opal.add_stubs(['$new']); $gvars["&"] = $gvars["~"] = $gvars["`"] = $gvars["'"] = nil; $gvars.LOADED_FEATURES = $gvars["\""] = Opal.loaded_features; $gvars.LOAD_PATH = $gvars[":"] = []; $gvars["/"] = "\n"; $gvars[","] = nil; Opal.cdecl($scope, 'ARGV', []); Opal.cdecl($scope, 'ARGF', $scope.get('Object').$new()); Opal.cdecl($scope, 'ENV', $hash2([], {})); $gvars.VERBOSE = false; $gvars.DEBUG = false; return $gvars.SAFE = 0; }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/regexp_anchors"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$==', '$new']); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; Opal.cdecl($scope, 'REGEXP_START', (function() {if ($scope.get('RUBY_ENGINE')['$==']("opal")) { return "^"}; return nil; })()); Opal.cdecl($scope, 'REGEXP_END', (function() {if ($scope.get('RUBY_ENGINE')['$==']("opal")) { return "$"}; return nil; })()); Opal.cdecl($scope, 'FORBIDDEN_STARTING_IDENTIFIER_CHARS', "\\u0001-\\u002F\\u003A-\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); Opal.cdecl($scope, 'FORBIDDEN_ENDING_IDENTIFIER_CHARS', "\\u0001-\\u0020\\u0022-\\u002F\\u003A-\\u003E\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); Opal.cdecl($scope, 'INLINE_IDENTIFIER_REGEXP', $scope.get('Regexp').$new("[^" + ($scope.get('FORBIDDEN_STARTING_IDENTIFIER_CHARS')) + "]*[^" + ($scope.get('FORBIDDEN_ENDING_IDENTIFIER_CHARS')) + "]")); Opal.cdecl($scope, 'FORBIDDEN_CONST_NAME_CHARS', "\\u0001-\\u0020\\u0021-\\u002F\\u003B-\\u003F\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); Opal.cdecl($scope, 'CONST_NAME_REGEXP', $scope.get('Regexp').$new("" + ($scope.get('REGEXP_START')) + "(::)?[A-Z][^" + ($scope.get('FORBIDDEN_CONST_NAME_CHARS')) + "]*" + ($scope.get('REGEXP_END')))); })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/mini"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); self.$require("opal/base"); self.$require("corelib/nil"); self.$require("corelib/boolean"); self.$require("corelib/string"); self.$require("corelib/comparable"); self.$require("corelib/enumerable"); self.$require("corelib/enumerator"); self.$require("corelib/array"); self.$require("corelib/hash"); self.$require("corelib/number"); self.$require("corelib/range"); self.$require("corelib/proc"); self.$require("corelib/method"); self.$require("corelib/regexp"); self.$require("corelib/variables"); return self.$require("opal/regexp_anchors"); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/string/inheritance"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $gvars = Opal.gvars; Opal.add_stubs(['$require', '$new', '$allocate', '$initialize', '$to_proc', '$__send__', '$class', '$clone', '$respond_to?', '$==', '$inspect', '$+', '$*', '$map', '$split', '$enum_for', '$each_line', '$to_a', '$%', '$-']); self.$require("corelib/string"); (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); var def = self.$$proto, $scope = self.$$scope, TMP_1; return (Opal.defs(self, '$inherited', TMP_1 = function $$inherited(klass) { var self = this, replace = nil; replace = $scope.get('Class').$new((($scope.get('String')).$$scope.get('Wrapper'))); klass.$$proto = replace.$$proto; klass.$$proto.$$class = klass; klass.$$alloc = replace.$$alloc; klass.$$parent = (($scope.get('String')).$$scope.get('Wrapper')); klass.$allocate = replace.$allocate; klass.$new = replace.$new; }, TMP_1.$$arity = 1), nil) && 'inherited' })($scope.base, null); return (function($base, $super) { function $Wrapper(){}; var self = $Wrapper = $klass($base, $super, 'Wrapper', $Wrapper); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_15, TMP_16, TMP_17, TMP_19, TMP_20, TMP_21; def.literal = nil; def.$$is_string = true; Opal.defs(self, '$allocate', TMP_2 = function $$allocate(string) { var $a, $b, self = this, $iter = TMP_2.$$p, $yield = $iter || nil, obj = nil; if (string == null) { string = ""; } TMP_2.$$p = null; obj = ($a = ($b = self, Opal.find_super_dispatcher(self, 'allocate', TMP_2, false, $Wrapper)), $a.$$p = null, $a).call($b); obj.literal = string; return obj; }, TMP_2.$$arity = -1); Opal.defs(self, '$new', TMP_3 = function($a_rest) { var $b, $c, self = this, args, $iter = TMP_3.$$p, block = $iter || nil, obj = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_3.$$p = null; obj = self.$allocate(); ($b = ($c = obj).$initialize, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); return obj; }, TMP_3.$$arity = -1); Opal.defs(self, '$[]', TMP_4 = function($a_rest) { var self = this, objects; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } objects = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { objects[$arg_idx - 0] = arguments[$arg_idx]; } return self.$allocate(objects); }, TMP_4.$$arity = -1); Opal.defn(self, '$initialize', TMP_5 = function $$initialize(string) { var self = this; if (string == null) { string = ""; } return self.literal = string; }, TMP_5.$$arity = -1); Opal.defn(self, '$method_missing', TMP_6 = function $$method_missing($a_rest) { var $b, $c, self = this, args, $iter = TMP_6.$$p, block = $iter || nil, result = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_6.$$p = null; result = ($b = ($c = self.literal).$__send__, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); if ((($b = result.$$is_string != null) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = result == self.literal) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self } else { return self.$class().$allocate(result) } } else { return result }; }, TMP_6.$$arity = -1); Opal.defn(self, '$initialize_copy', TMP_7 = function $$initialize_copy(other) { var self = this; return self.literal = (other.literal).$clone(); }, TMP_7.$$arity = 1); Opal.defn(self, '$respond_to?', TMP_8 = function(name, $a_rest) { var $b, $c, $d, self = this, $iter = TMP_8.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_8.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } return ((($b = ($c = ($d = self, Opal.find_super_dispatcher(self, 'respond_to?', TMP_8, false)), $c.$$p = $iter, $c).apply($d, $zuper)) !== false && $b !== nil && $b != null) ? $b : self.literal['$respond_to?'](name)); }, TMP_8.$$arity = -2); Opal.defn(self, '$==', TMP_9 = function(other) { var self = this; return self.literal['$=='](other); }, TMP_9.$$arity = 1); Opal.alias(self, 'eql?', '=='); Opal.alias(self, '===', '=='); Opal.defn(self, '$to_s', TMP_10 = function $$to_s() { var self = this; return self.literal; }, TMP_10.$$arity = 0); Opal.alias(self, 'to_str', 'to_s'); Opal.defn(self, '$inspect', TMP_11 = function $$inspect() { var self = this; return self.literal.$inspect(); }, TMP_11.$$arity = 0); Opal.defn(self, '$+', TMP_12 = function(other) { var self = this; return $rb_plus(self.literal, other); }, TMP_12.$$arity = 1); Opal.defn(self, '$*', TMP_13 = function(other) { var self = this; var result = $rb_times(self.literal, other); if (result.$$is_string) { return self.$class().$allocate(result) } else { return result; } ; }, TMP_13.$$arity = 1); Opal.defn(self, '$split', TMP_15 = function $$split(pattern, limit) { var $a, $b, TMP_14, self = this; return ($a = ($b = self.literal.$split(pattern, limit)).$map, $a.$$p = (TMP_14 = function(str){var self = TMP_14.$$s || this; if (str == null) str = nil; return self.$class().$allocate(str)}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($b); }, TMP_15.$$arity = -1); Opal.defn(self, '$replace', TMP_16 = function $$replace(string) { var self = this; return self.literal = string; }, TMP_16.$$arity = 1); Opal.defn(self, '$each_line', TMP_17 = function $$each_line(separator) { var $a, $b, TMP_18, self = this, $iter = TMP_17.$$p, $yield = $iter || nil; if ($gvars["/"] == null) $gvars["/"] = nil; if (separator == null) { separator = $gvars["/"]; } TMP_17.$$p = null; if (($yield !== nil)) { } else { return self.$enum_for("each_line", separator) }; return ($a = ($b = self.literal).$each_line, $a.$$p = (TMP_18 = function(str){var self = TMP_18.$$s || this; if (str == null) str = nil; return Opal.yield1($yield, self.$class().$allocate(str));}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18), $a).call($b, separator); }, TMP_17.$$arity = -1); Opal.defn(self, '$lines', TMP_19 = function $$lines(separator) { var $a, $b, self = this, $iter = TMP_19.$$p, block = $iter || nil, e = nil; if ($gvars["/"] == null) $gvars["/"] = nil; if (separator == null) { separator = $gvars["/"]; } TMP_19.$$p = null; e = ($a = ($b = self).$each_line, $a.$$p = block.$to_proc(), $a).call($b, separator); if (block !== false && block !== nil && block != null) { return self } else { return e.$to_a() }; }, TMP_19.$$arity = -1); Opal.defn(self, '$%', TMP_20 = function(data) { var self = this; return self.literal['$%'](data); }, TMP_20.$$arity = 1); return (Opal.defn(self, '$instance_variables', TMP_21 = function $$instance_variables() { var $a, $b, self = this, $iter = TMP_21.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_21.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } return $rb_minus(($a = ($b = self, Opal.find_super_dispatcher(self, 'instance_variables', TMP_21, false)), $a.$$p = $iter, $a).apply($b, $zuper), ["@literal"]); }, TMP_21.$$arity = 0), nil) && 'instance_variables'; })($scope.get('String'), null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/string/encoding"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var $a, $b, TMP_13, $c, TMP_16, $d, TMP_19, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$require', '$+', '$[]', '$new', '$to_proc', '$each', '$const_set', '$sub', '$upcase', '$const_get', '$===', '$==', '$name', '$include?', '$names', '$constants', '$raise', '$attr_accessor', '$attr_reader', '$register', '$length', '$bytes', '$to_a', '$each_byte', '$bytesize', '$enum_for', '$force_encoding', '$dup', '$coerce_to!', '$find', '$nil?', '$getbyte']); self.$require("corelib/string"); (function($base, $super) { function $Encoding(){}; var self = $Encoding = $klass($base, $super, 'Encoding', $Encoding); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12; def.ascii = def.dummy = def.name = nil; Opal.defs(self, '$register', TMP_1 = function $$register(name, options) { var $a, $b, $c, TMP_2, self = this, $iter = TMP_1.$$p, block = $iter || nil, names = nil, encoding = nil; if (options == null) { options = $hash2([], {}); } TMP_1.$$p = null; names = $rb_plus([name], (((($a = options['$[]']("aliases")) !== false && $a !== nil && $a != null) ? $a : []))); encoding = ($a = ($b = $scope.get('Class')).$new, $a.$$p = block.$to_proc(), $a).call($b, self).$new(name, names, ((($a = options['$[]']("ascii")) !== false && $a !== nil && $a != null) ? $a : false), ((($a = options['$[]']("dummy")) !== false && $a !== nil && $a != null) ? $a : false)); return ($a = ($c = names).$each, $a.$$p = (TMP_2 = function(name){var self = TMP_2.$$s || this; if (name == null) name = nil; return self.$const_set(name.$sub("-", "_"), encoding)}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($c); }, TMP_1.$$arity = -2); Opal.defs(self, '$find', TMP_4 = function $$find(name) {try { var $a, $b, TMP_3, self = this, upcase = nil; upcase = name.$upcase(); ($a = ($b = self.$constants()).$each, $a.$$p = (TMP_3 = function(const$){var self = TMP_3.$$s || this, $c, $d, encoding = nil; if (const$ == null) const$ = nil; encoding = self.$const_get(const$); if ((($c = $scope.get('Encoding')['$==='](encoding)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { return nil; }; if ((($c = ((($d = encoding.$name()['$=='](upcase)) !== false && $d !== nil && $d != null) ? $d : encoding.$names()['$include?'](upcase))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { Opal.ret(encoding) } else { return nil };}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $a).call($b); return self.$raise($scope.get('ArgumentError'), "unknown encoding name - " + (name)); } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_4.$$arity = 1); (function(self) { var $scope = self.$$scope, def = self.$$proto; return self.$attr_accessor("default_external") })(Opal.get_singleton_class(self)); self.$attr_reader("name", "names"); Opal.defn(self, '$initialize', TMP_5 = function $$initialize(name, names, ascii, dummy) { var self = this; self.name = name; self.names = names; self.ascii = ascii; return self.dummy = dummy; }, TMP_5.$$arity = 4); Opal.defn(self, '$ascii_compatible?', TMP_6 = function() { var self = this; return self.ascii; }, TMP_6.$$arity = 0); Opal.defn(self, '$dummy?', TMP_7 = function() { var self = this; return self.dummy; }, TMP_7.$$arity = 0); Opal.defn(self, '$to_s', TMP_8 = function $$to_s() { var self = this; return self.name; }, TMP_8.$$arity = 0); Opal.defn(self, '$inspect', TMP_9 = function $$inspect() { var $a, self = this; return "#"; }, TMP_9.$$arity = 0); Opal.defn(self, '$each_byte', TMP_10 = function $$each_byte($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError')); }, TMP_10.$$arity = -1); Opal.defn(self, '$getbyte', TMP_11 = function $$getbyte($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError')); }, TMP_11.$$arity = -1); Opal.defn(self, '$bytesize', TMP_12 = function $$bytesize($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError')); }, TMP_12.$$arity = -1); (function($base, $super) { function $EncodingError(){}; var self = $EncodingError = $klass($base, $super, 'EncodingError', $EncodingError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); return (function($base, $super) { function $CompatibilityError(){}; var self = $CompatibilityError = $klass($base, $super, 'CompatibilityError', $CompatibilityError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('EncodingError')); })($scope.base, null); ($a = ($b = $scope.get('Encoding')).$register, $a.$$p = (TMP_13 = function(){var self = TMP_13.$$s || this, TMP_14, TMP_15; Opal.def(self, '$each_byte', TMP_14 = function $$each_byte(string) { var self = this, $iter = TMP_14.$$p, block = $iter || nil; TMP_14.$$p = null; for (var i = 0, length = string.length; i < length; i++) { var code = string.charCodeAt(i); if (code <= 0x7f) { Opal.yield1(block, code); } else { var encoded = encodeURIComponent(string.charAt(i)).substr(1).split('%'); for (var j = 0, encoded_length = encoded.length; j < encoded_length; j++) { Opal.yield1(block, parseInt(encoded[j], 16)); } } } }, TMP_14.$$arity = 1); return (Opal.def(self, '$bytesize', TMP_15 = function $$bytesize() { var self = this; return self.$bytes().$length(); }, TMP_15.$$arity = 0), nil) && 'bytesize';}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13), $a).call($b, "UTF-8", $hash2(["aliases", "ascii"], {"aliases": ["CP65001"], "ascii": true})); ($a = ($c = $scope.get('Encoding')).$register, $a.$$p = (TMP_16 = function(){var self = TMP_16.$$s || this, TMP_17, TMP_18; Opal.def(self, '$each_byte', TMP_17 = function $$each_byte(string) { var self = this, $iter = TMP_17.$$p, block = $iter || nil; TMP_17.$$p = null; for (var i = 0, length = string.length; i < length; i++) { var code = string.charCodeAt(i); Opal.yield1(block, code & 0xff); Opal.yield1(block, code >> 8); } }, TMP_17.$$arity = 1); return (Opal.def(self, '$bytesize', TMP_18 = function $$bytesize() { var self = this; return self.$bytes().$length(); }, TMP_18.$$arity = 0), nil) && 'bytesize';}, TMP_16.$$s = self, TMP_16.$$arity = 0, TMP_16), $a).call($c, "UTF-16LE"); ($a = ($d = $scope.get('Encoding')).$register, $a.$$p = (TMP_19 = function(){var self = TMP_19.$$s || this, TMP_20, TMP_21; Opal.def(self, '$each_byte', TMP_20 = function $$each_byte(string) { var self = this, $iter = TMP_20.$$p, block = $iter || nil; TMP_20.$$p = null; for (var i = 0, length = string.length; i < length; i++) { Opal.yield1(block, string.charCodeAt(i) & 0xff); } }, TMP_20.$$arity = 1); return (Opal.def(self, '$bytesize', TMP_21 = function $$bytesize() { var self = this; return self.$bytes().$length(); }, TMP_21.$$arity = 0), nil) && 'bytesize';}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19), $a).call($d, "ASCII-8BIT", $hash2(["aliases", "ascii"], {"aliases": ["BINARY"], "ascii": true})); return (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); var def = self.$$proto, $scope = self.$$scope, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28; def.encoding = nil; String.prototype.encoding = (($scope.get('Encoding')).$$scope.get('UTF_16LE')); Opal.defn(self, '$bytes', TMP_22 = function $$bytes() { var self = this; return self.$each_byte().$to_a(); }, TMP_22.$$arity = 0); Opal.defn(self, '$bytesize', TMP_23 = function $$bytesize() { var self = this; return self.encoding.$bytesize(self); }, TMP_23.$$arity = 0); Opal.defn(self, '$each_byte', TMP_24 = function $$each_byte() { var $a, $b, self = this, $iter = TMP_24.$$p, block = $iter || nil; TMP_24.$$p = null; if ((block !== nil)) { } else { return self.$enum_for("each_byte") }; ($a = ($b = self.encoding).$each_byte, $a.$$p = block.$to_proc(), $a).call($b, self); return self; }, TMP_24.$$arity = 0); Opal.defn(self, '$encode', TMP_25 = function $$encode(encoding) { var self = this; return self.$dup().$force_encoding(encoding); }, TMP_25.$$arity = 1); Opal.defn(self, '$encoding', TMP_26 = function $$encoding() { var self = this; return self.encoding; }, TMP_26.$$arity = 0); Opal.defn(self, '$force_encoding', TMP_27 = function $$force_encoding(encoding) { var $a, self = this; encoding = $scope.get('Opal')['$coerce_to!'](encoding, $scope.get('String'), "to_str"); encoding = $scope.get('Encoding').$find(encoding); if (encoding['$=='](self.encoding)) { return self}; if ((($a = encoding['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "unknown encoding name - " + (encoding))}; var result = new String(self); result.encoding = encoding; return result; }, TMP_27.$$arity = 1); return (Opal.defn(self, '$getbyte', TMP_28 = function $$getbyte(idx) { var self = this; return self.encoding.$getbyte(self, idx); }, TMP_28.$$arity = 1), nil) && 'getbyte'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/math"] = function(Opal) { function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_divide(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$new', '$raise', '$Float', '$type_error', '$Integer', '$module_function', '$checked', '$float!', '$===', '$gamma', '$-', '$integer!', '$/', '$infinite?']); return (function($base) { var $Math, self = $Math = $module($base, 'Math'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, $a, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29; Opal.cdecl($scope, 'E', Math.E); Opal.cdecl($scope, 'PI', Math.PI); Opal.cdecl($scope, 'DomainError', $scope.get('Class').$new($scope.get('StandardError'))); Opal.defs(self, '$checked', TMP_1 = function $$checked(method, $a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } if (isNaN(args[0]) || (args.length == 2 && isNaN(args[1]))) { return NaN; } var result = Math[method].apply(null, args); if (isNaN(result)) { self.$raise($scope.get('DomainError'), "Numerical argument is out of domain - \"" + (method) + "\""); } return result; }, TMP_1.$$arity = -2); Opal.defs(self, '$float!', TMP_2 = function(value) { var self = this; try { return self.$Float(value) } catch ($err) { if (Opal.rescue($err, [$scope.get('ArgumentError')])) { try { return self.$raise($scope.get('Opal').$type_error(value, $scope.get('Float'))) } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_2.$$arity = 1); Opal.defs(self, '$integer!', TMP_3 = function(value) { var self = this; try { return self.$Integer(value) } catch ($err) { if (Opal.rescue($err, [$scope.get('ArgumentError')])) { try { return self.$raise($scope.get('Opal').$type_error(value, $scope.get('Integer'))) } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_3.$$arity = 1); self.$module_function(); Opal.defn(self, '$acos', TMP_4 = function $$acos(x) { var self = this; return $scope.get('Math').$checked("acos", $scope.get('Math')['$float!'](x)); }, TMP_4.$$arity = 1); if ((($a = (typeof(Math.acosh) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.acosh = function(x) { return Math.log(x + Math.sqrt(x * x - 1)); } }; Opal.defn(self, '$acosh', TMP_5 = function $$acosh(x) { var self = this; return $scope.get('Math').$checked("acosh", $scope.get('Math')['$float!'](x)); }, TMP_5.$$arity = 1); Opal.defn(self, '$asin', TMP_6 = function $$asin(x) { var self = this; return $scope.get('Math').$checked("asin", $scope.get('Math')['$float!'](x)); }, TMP_6.$$arity = 1); if ((($a = (typeof(Math.asinh) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.asinh = function(x) { return Math.log(x + Math.sqrt(x * x + 1)) } ; }; Opal.defn(self, '$asinh', TMP_7 = function $$asinh(x) { var self = this; return $scope.get('Math').$checked("asinh", $scope.get('Math')['$float!'](x)); }, TMP_7.$$arity = 1); Opal.defn(self, '$atan', TMP_8 = function $$atan(x) { var self = this; return $scope.get('Math').$checked("atan", $scope.get('Math')['$float!'](x)); }, TMP_8.$$arity = 1); Opal.defn(self, '$atan2', TMP_9 = function $$atan2(y, x) { var self = this; return $scope.get('Math').$checked("atan2", $scope.get('Math')['$float!'](y), $scope.get('Math')['$float!'](x)); }, TMP_9.$$arity = 2); if ((($a = (typeof(Math.atanh) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.atanh = function(x) { return 0.5 * Math.log((1 + x) / (1 - x)); } }; Opal.defn(self, '$atanh', TMP_10 = function $$atanh(x) { var self = this; return $scope.get('Math').$checked("atanh", $scope.get('Math')['$float!'](x)); }, TMP_10.$$arity = 1); if ((($a = (typeof(Math.cbrt) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.cbrt = function(x) { if (x == 0) { return 0; } if (x < 0) { return -Math.cbrt(-x); } var r = x, ex = 0; while (r < 0.125) { r *= 8; ex--; } while (r > 1.0) { r *= 0.125; ex++; } r = (-0.46946116 * r + 1.072302) * r + 0.3812513; while (ex < 0) { r *= 0.5; ex++; } while (ex > 0) { r *= 2; ex--; } r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); return r; } }; Opal.defn(self, '$cbrt', TMP_11 = function $$cbrt(x) { var self = this; return $scope.get('Math').$checked("cbrt", $scope.get('Math')['$float!'](x)); }, TMP_11.$$arity = 1); Opal.defn(self, '$cos', TMP_12 = function $$cos(x) { var self = this; return $scope.get('Math').$checked("cos", $scope.get('Math')['$float!'](x)); }, TMP_12.$$arity = 1); if ((($a = (typeof(Math.cosh) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.cosh = function(x) { return (Math.exp(x) + Math.exp(-x)) / 2; } }; Opal.defn(self, '$cosh', TMP_13 = function $$cosh(x) { var self = this; return $scope.get('Math').$checked("cosh", $scope.get('Math')['$float!'](x)); }, TMP_13.$$arity = 1); if ((($a = (typeof(Math.erf) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.erf = function(x) { var A1 = 0.254829592, A2 = -0.284496736, A3 = 1.421413741, A4 = -1.453152027, A5 = 1.061405429, P = 0.3275911; var sign = 1; if (x < 0) { sign = -1; } x = Math.abs(x); var t = 1.0 / (1.0 + P * x); var y = 1.0 - (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * Math.exp(-x * x); return sign * y; } }; Opal.defn(self, '$erf', TMP_14 = function $$erf(x) { var self = this; return $scope.get('Math').$checked("erf", $scope.get('Math')['$float!'](x)); }, TMP_14.$$arity = 1); if ((($a = (typeof(Math.erfc) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.erfc = function(x) { var z = Math.abs(x), t = 1.0 / (0.5 * z + 1.0); var A1 = t * 0.17087277 + -0.82215223, A2 = t * A1 + 1.48851587, A3 = t * A2 + -1.13520398, A4 = t * A3 + 0.27886807, A5 = t * A4 + -0.18628806, A6 = t * A5 + 0.09678418, A7 = t * A6 + 0.37409196, A8 = t * A7 + 1.00002368, A9 = t * A8, A10 = -z * z - 1.26551223 + A9; var a = t * Math.exp(A10); if (x < 0.0) { return 2.0 - a; } else { return a; } } }; Opal.defn(self, '$erfc', TMP_15 = function $$erfc(x) { var self = this; return $scope.get('Math').$checked("erfc", $scope.get('Math')['$float!'](x)); }, TMP_15.$$arity = 1); Opal.defn(self, '$exp', TMP_16 = function $$exp(x) { var self = this; return $scope.get('Math').$checked("exp", $scope.get('Math')['$float!'](x)); }, TMP_16.$$arity = 1); Opal.defn(self, '$frexp', TMP_17 = function $$frexp(x) { var self = this; x = $scope.get('Math')['$float!'](x); if (isNaN(x)) { return [NaN, 0]; } var ex = Math.floor(Math.log(Math.abs(x)) / Math.log(2)) + 1, frac = x / Math.pow(2, ex); return [frac, ex]; }, TMP_17.$$arity = 1); Opal.defn(self, '$gamma', TMP_18 = function $$gamma(n) { var self = this; n = $scope.get('Math')['$float!'](n); var i, t, x, value, result, twoN, threeN, fourN, fiveN; var G = 4.7421875; var P = [ 0.99999999999999709182, 57.156235665862923517, -59.597960355475491248, 14.136097974741747174, -0.49191381609762019978, 0.33994649984811888699e-4, 0.46523628927048575665e-4, -0.98374475304879564677e-4, 0.15808870322491248884e-3, -0.21026444172410488319e-3, 0.21743961811521264320e-3, -0.16431810653676389022e-3, 0.84418223983852743293e-4, -0.26190838401581408670e-4, 0.36899182659531622704e-5 ]; if (isNaN(n)) { return NaN; } if (n === 0 && 1 / n < 0) { return -Infinity; } if (n === -1 || n === -Infinity) { self.$raise($scope.get('DomainError'), "Numerical argument is out of domain - \"gamma\""); } if ($scope.get('Integer')['$==='](n)) { if (n <= 0) { return isFinite(n) ? Infinity : NaN; } if (n > 171) { return Infinity; } value = n - 2; result = n - 1; while (value > 1) { result *= value; value--; } if (result == 0) { result = 1; } return result; } if (n < 0.5) { return Math.PI / (Math.sin(Math.PI * n) * $scope.get('Math').$gamma($rb_minus(1, n))); } if (n >= 171.35) { return Infinity; } if (n > 85.0) { twoN = n * n; threeN = twoN * n; fourN = threeN * n; fiveN = fourN * n; return Math.sqrt(2 * Math.PI / n) * Math.pow((n / Math.E), n) * (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + 5246819 / (75246796800 * fiveN * n)); } n -= 1; x = P[0]; for (i = 1; i < P.length; ++i) { x += P[i] / (n + i); } t = n + G + 0.5; return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x; }, TMP_18.$$arity = 1); if ((($a = (typeof(Math.hypot) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.hypot = function(x, y) { return Math.sqrt(x * x + y * y) } ; }; Opal.defn(self, '$hypot', TMP_19 = function $$hypot(x, y) { var self = this; return $scope.get('Math').$checked("hypot", $scope.get('Math')['$float!'](x), $scope.get('Math')['$float!'](y)); }, TMP_19.$$arity = 2); Opal.defn(self, '$ldexp', TMP_20 = function $$ldexp(mantissa, exponent) { var self = this; mantissa = $scope.get('Math')['$float!'](mantissa); exponent = $scope.get('Math')['$integer!'](exponent); if (isNaN(exponent)) { self.$raise($scope.get('RangeError'), "float NaN out of range of integer"); } return mantissa * Math.pow(2, exponent); ; }, TMP_20.$$arity = 2); Opal.defn(self, '$lgamma', TMP_21 = function $$lgamma(n) { var self = this; if (n == -1) { return [Infinity, 1]; } else { return [Math.log(Math.abs($scope.get('Math').$gamma(n))), $scope.get('Math').$gamma(n) < 0 ? -1 : 1]; } ; }, TMP_21.$$arity = 1); Opal.defn(self, '$log', TMP_22 = function $$log(x, base) { var $a, self = this; if ((($a = $scope.get('String')['$==='](x)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('Opal').$type_error(x, $scope.get('Float')))}; if ((($a = base == null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('Math').$checked("log", $scope.get('Math')['$float!'](x)) } else { if ((($a = $scope.get('String')['$==='](base)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('Opal').$type_error(base, $scope.get('Float')))}; return $rb_divide($scope.get('Math').$checked("log", $scope.get('Math')['$float!'](x)), $scope.get('Math').$checked("log", $scope.get('Math')['$float!'](base))); }; }, TMP_22.$$arity = -2); if ((($a = (typeof(Math.log10) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.log10 = function(x) { return Math.log(x) / Math.LN10; } }; Opal.defn(self, '$log10', TMP_23 = function $$log10(x) { var $a, self = this; if ((($a = $scope.get('String')['$==='](x)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('Opal').$type_error(x, $scope.get('Float')))}; return $scope.get('Math').$checked("log10", $scope.get('Math')['$float!'](x)); }, TMP_23.$$arity = 1); if ((($a = (typeof(Math.log2) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.log2 = function(x) { return Math.log(x) / Math.LN2; } }; Opal.defn(self, '$log2', TMP_24 = function $$log2(x) { var $a, self = this; if ((($a = $scope.get('String')['$==='](x)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('Opal').$type_error(x, $scope.get('Float')))}; return $scope.get('Math').$checked("log2", $scope.get('Math')['$float!'](x)); }, TMP_24.$$arity = 1); Opal.defn(self, '$sin', TMP_25 = function $$sin(x) { var self = this; return $scope.get('Math').$checked("sin", $scope.get('Math')['$float!'](x)); }, TMP_25.$$arity = 1); if ((($a = (typeof(Math.sinh) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.sinh = function(x) { return (Math.exp(x) - Math.exp(-x)) / 2; } }; Opal.defn(self, '$sinh', TMP_26 = function $$sinh(x) { var self = this; return $scope.get('Math').$checked("sinh", $scope.get('Math')['$float!'](x)); }, TMP_26.$$arity = 1); Opal.defn(self, '$sqrt', TMP_27 = function $$sqrt(x) { var self = this; return $scope.get('Math').$checked("sqrt", $scope.get('Math')['$float!'](x)); }, TMP_27.$$arity = 1); Opal.defn(self, '$tan', TMP_28 = function $$tan(x) { var $a, self = this; x = $scope.get('Math')['$float!'](x); if ((($a = x['$infinite?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($scope.get('Float')).$$scope.get('NAN'))}; return $scope.get('Math').$checked("tan", $scope.get('Math')['$float!'](x)); }, TMP_28.$$arity = 1); if ((($a = (typeof(Math.tanh) !== "undefined")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Math.tanh = function(x) { if (x == Infinity) { return 1; } else if (x == -Infinity) { return -1; } else { return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x)); } } }; Opal.defn(self, '$tanh', TMP_29 = function $$tanh(x) { var self = this; return $scope.get('Math').$checked("tanh", $scope.get('Math')['$float!'](x)); }, TMP_29.$$arity = 1); })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/complex"] = function(Opal) { function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_divide(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module; Opal.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', '$to_s', '$numerator', '$abs', '$arg', '$rationalize', '$to_f', '$to_i', '$to_r', '$inspect', '$positive?', '$infinite?']); self.$require("corelib/numeric"); (function($base, $super) { function $Complex(){}; var self = $Complex = $klass($base, $super, 'Complex', $Complex); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29; def.real = def.imag = nil; Opal.defs(self, '$rect', TMP_1 = function $$rect(real, imag) { var $a, $b, $c, $d, self = this; if (imag == null) { imag = 0; } if ((($a = ($b = ($c = ($d = $scope.get('Numeric')['$==='](real), $d !== false && $d !== nil && $d != null ?real['$real?']() : $d), $c !== false && $c !== nil && $c != null ?$scope.get('Numeric')['$==='](imag) : $c), $b !== false && $b !== nil && $b != null ?imag['$real?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('TypeError'), "not a real") }; return self.$new(real, imag); }, TMP_1.$$arity = -2); (function(self) { var $scope = self.$$scope, def = self.$$proto; return Opal.alias(self, 'rectangular', 'rect') })(Opal.get_singleton_class(self)); Opal.defs(self, '$polar', TMP_2 = function $$polar(r, theta) { var $a, $b, $c, $d, self = this; if (theta == null) { theta = 0; } if ((($a = ($b = ($c = ($d = $scope.get('Numeric')['$==='](r), $d !== false && $d !== nil && $d != null ?r['$real?']() : $d), $c !== false && $c !== nil && $c != null ?$scope.get('Numeric')['$==='](theta) : $c), $b !== false && $b !== nil && $b != null ?theta['$real?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('TypeError'), "not a real") }; return self.$new($rb_times(r, $scope.get('Math').$cos(theta)), $rb_times(r, $scope.get('Math').$sin(theta))); }, TMP_2.$$arity = -2); self.$attr_reader("real", "imag"); Opal.defn(self, '$initialize', TMP_3 = function $$initialize(real, imag) { var self = this; if (imag == null) { imag = 0; } self.real = real; return self.imag = imag; }, TMP_3.$$arity = -2); Opal.defn(self, '$coerce', TMP_4 = function $$coerce(other) { var $a, $b, self = this; if ((($a = $scope.get('Complex')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [other, self] } else if ((($a = ($b = $scope.get('Numeric')['$==='](other), $b !== false && $b !== nil && $b != null ?other['$real?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [$scope.get('Complex').$new(other, 0), self] } else { return self.$raise($scope.get('TypeError'), "" + (other.$class()) + " can't be coerced into Complex") }; }, TMP_4.$$arity = 1); Opal.defn(self, '$==', TMP_5 = function(other) { var $a, $b, self = this; if ((($a = $scope.get('Complex')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($a = self.real['$=='](other.$real())) ? self.imag['$=='](other.$imag()) : self.real['$=='](other.$real())) } else if ((($a = ($b = $scope.get('Numeric')['$==='](other), $b !== false && $b !== nil && $b != null ?other['$real?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($a = self.real['$=='](other)) ? self.imag['$=='](0) : self.real['$=='](other)) } else { return other['$=='](self) }; }, TMP_5.$$arity = 1); Opal.defn(self, '$-@', TMP_6 = function() { var self = this; return self.$Complex(self.real['$-@'](), self.imag['$-@']()); }, TMP_6.$$arity = 0); Opal.defn(self, '$+', TMP_7 = function(other) { var $a, $b, self = this; if ((($a = $scope.get('Complex')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$Complex($rb_plus(self.real, other.$real()), $rb_plus(self.imag, other.$imag())) } else if ((($a = ($b = $scope.get('Numeric')['$==='](other), $b !== false && $b !== nil && $b != null ?other['$real?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$Complex($rb_plus(self.real, other), self.imag) } else { return self.$__coerced__("+", other) }; }, TMP_7.$$arity = 1); Opal.defn(self, '$-', TMP_8 = function(other) { var $a, $b, self = this; if ((($a = $scope.get('Complex')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$Complex($rb_minus(self.real, other.$real()), $rb_minus(self.imag, other.$imag())) } else if ((($a = ($b = $scope.get('Numeric')['$==='](other), $b !== false && $b !== nil && $b != null ?other['$real?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$Complex($rb_minus(self.real, other), self.imag) } else { return self.$__coerced__("-", other) }; }, TMP_8.$$arity = 1); Opal.defn(self, '$*', TMP_9 = function(other) { var $a, $b, self = this; if ((($a = $scope.get('Complex')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$Complex($rb_minus($rb_times(self.real, other.$real()), $rb_times(self.imag, other.$imag())), $rb_plus($rb_times(self.real, other.$imag()), $rb_times(self.imag, other.$real()))) } else if ((($a = ($b = $scope.get('Numeric')['$==='](other), $b !== false && $b !== nil && $b != null ?other['$real?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$Complex($rb_times(self.real, other), $rb_times(self.imag, other)) } else { return self.$__coerced__("*", other) }; }, TMP_9.$$arity = 1); Opal.defn(self, '$/', TMP_10 = function(other) { var $a, $b, $c, $d, $e, self = this; if ((($a = $scope.get('Complex')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = ((($b = ((($c = ((($d = (($e = $scope.get('Number')['$==='](self.real), $e !== false && $e !== nil && $e != null ?self.real['$nan?']() : $e))) !== false && $d !== nil && $d != null) ? $d : (($e = $scope.get('Number')['$==='](self.imag), $e !== false && $e !== nil && $e != null ?self.imag['$nan?']() : $e)))) !== false && $c !== nil && $c != null) ? $c : (($d = $scope.get('Number')['$==='](other.$real()), $d !== false && $d !== nil && $d != null ?other.$real()['$nan?']() : $d)))) !== false && $b !== nil && $b != null) ? $b : (($c = $scope.get('Number')['$==='](other.$imag()), $c !== false && $c !== nil && $c != null ?other.$imag()['$nan?']() : $c)))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('Complex').$new((($scope.get('Float')).$$scope.get('NAN')), (($scope.get('Float')).$$scope.get('NAN'))) } else { return $rb_divide($rb_times(self, other.$conj()), other.$abs2()) } } else if ((($a = ($b = $scope.get('Numeric')['$==='](other), $b !== false && $b !== nil && $b != null ?other['$real?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$Complex(self.real.$quo(other), self.imag.$quo(other)) } else { return self.$__coerced__("/", other) }; }, TMP_10.$$arity = 1); Opal.defn(self, '$**', TMP_11 = function(other) { var $a, $b, $c, $d, $e, self = this, r = nil, theta = nil, ore = nil, oim = nil, nr = nil, ntheta = nil, x = nil, z = nil, n = nil, div = nil, mod = nil; if (other['$=='](0)) { return $scope.get('Complex').$new(1, 0)}; if ((($a = $scope.get('Complex')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { $b = self.$polar(), $a = Opal.to_ary($b), r = ($a[0] == null ? nil : $a[0]), theta = ($a[1] == null ? nil : $a[1]), $b; ore = other.$real(); oim = other.$imag(); nr = $scope.get('Math').$exp($rb_minus($rb_times(ore, $scope.get('Math').$log(r)), $rb_times(oim, theta))); ntheta = $rb_plus($rb_times(theta, ore), $rb_times(oim, $scope.get('Math').$log(r))); return $scope.get('Complex').$polar(nr, ntheta); } else if ((($a = $scope.get('Integer')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $rb_gt(other, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { x = self; z = x; n = $rb_minus(other, 1); while ((($b = n['$!='](0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { while ((($c = ($e = n.$divmod(2), $d = Opal.to_ary($e), div = ($d[0] == null ? nil : $d[0]), mod = ($d[1] == null ? nil : $d[1]), $e, mod['$=='](0))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { x = self.$Complex($rb_minus($rb_times(x.$real(), x.$real()), $rb_times(x.$imag(), x.$imag())), $rb_times($rb_times(2, x.$real()), x.$imag())); n = div;}; z = $rb_times(z, x); n = $rb_minus(n, 1);}; return z; } else { return ($rb_divide($scope.get('Rational').$new(1, 1), self))['$**'](other['$-@']()) } } else if ((($a = ((($b = $scope.get('Float')['$==='](other)) !== false && $b !== nil && $b != null) ? $b : $scope.get('Rational')['$==='](other))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { $b = self.$polar(), $a = Opal.to_ary($b), r = ($a[0] == null ? nil : $a[0]), theta = ($a[1] == null ? nil : $a[1]), $b; return $scope.get('Complex').$polar(r['$**'](other), $rb_times(theta, other)); } else { return self.$__coerced__("**", other) }; }, TMP_11.$$arity = 1); Opal.defn(self, '$abs', TMP_12 = function $$abs() { var self = this; return $scope.get('Math').$hypot(self.real, self.imag); }, TMP_12.$$arity = 0); Opal.defn(self, '$abs2', TMP_13 = function $$abs2() { var self = this; return $rb_plus($rb_times(self.real, self.real), $rb_times(self.imag, self.imag)); }, TMP_13.$$arity = 0); Opal.defn(self, '$angle', TMP_14 = function $$angle() { var self = this; return $scope.get('Math').$atan2(self.imag, self.real); }, TMP_14.$$arity = 0); Opal.alias(self, 'arg', 'angle'); Opal.defn(self, '$conj', TMP_15 = function $$conj() { var self = this; return self.$Complex(self.real, self.imag['$-@']()); }, TMP_15.$$arity = 0); Opal.alias(self, 'conjugate', 'conj'); Opal.defn(self, '$denominator', TMP_16 = function $$denominator() { var self = this; return self.real.$denominator().$lcm(self.imag.$denominator()); }, TMP_16.$$arity = 0); Opal.alias(self, 'divide', '/'); Opal.defn(self, '$eql?', TMP_17 = function(other) { var $a, $b, self = this; return ($a = ($b = $scope.get('Complex')['$==='](other), $b !== false && $b !== nil && $b != null ?self.real.$class()['$=='](self.imag.$class()) : $b), $a !== false && $a !== nil && $a != null ?self['$=='](other) : $a); }, TMP_17.$$arity = 1); Opal.defn(self, '$fdiv', TMP_18 = function $$fdiv(other) { var $a, self = this; if ((($a = $scope.get('Numeric')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('TypeError'), "" + (other.$class()) + " can't be coerced into Complex") }; return $rb_divide(self, other); }, TMP_18.$$arity = 1); Opal.defn(self, '$hash', TMP_19 = function $$hash() { var self = this; return "Complex:" + (self.real) + ":" + (self.imag); }, TMP_19.$$arity = 0); Opal.alias(self, 'imaginary', 'imag'); Opal.defn(self, '$inspect', TMP_20 = function $$inspect() { var self = this; return "(" + (self.$to_s()) + ")"; }, TMP_20.$$arity = 0); Opal.alias(self, 'magnitude', 'abs'); Opal.defn(self, '$numerator', TMP_21 = function $$numerator() { var self = this, d = nil; d = self.$denominator(); return self.$Complex($rb_times(self.real.$numerator(), ($rb_divide(d, self.real.$denominator()))), $rb_times(self.imag.$numerator(), ($rb_divide(d, self.imag.$denominator())))); }, TMP_21.$$arity = 0); Opal.alias(self, 'phase', 'arg'); Opal.defn(self, '$polar', TMP_22 = function $$polar() { var self = this; return [self.$abs(), self.$arg()]; }, TMP_22.$$arity = 0); Opal.alias(self, 'quo', '/'); Opal.defn(self, '$rationalize', TMP_23 = function $$rationalize(eps) { var $a, self = this; if (arguments.length > 1) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " for 0..1)"); } ; if ((($a = self.imag['$!='](0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('RangeError'), "can't' convert " + (self) + " into Rational")}; return self.$real().$rationalize(eps); }, TMP_23.$$arity = -1); Opal.defn(self, '$real?', TMP_24 = function() { var self = this; return false; }, TMP_24.$$arity = 0); Opal.defn(self, '$rect', TMP_25 = function $$rect() { var self = this; return [self.real, self.imag]; }, TMP_25.$$arity = 0); Opal.alias(self, 'rectangular', 'rect'); Opal.defn(self, '$to_f', TMP_26 = function $$to_f() { var self = this; if (self.imag['$=='](0)) { } else { self.$raise($scope.get('RangeError'), "can't convert " + (self) + " into Float") }; return self.real.$to_f(); }, TMP_26.$$arity = 0); Opal.defn(self, '$to_i', TMP_27 = function $$to_i() { var self = this; if (self.imag['$=='](0)) { } else { self.$raise($scope.get('RangeError'), "can't convert " + (self) + " into Integer") }; return self.real.$to_i(); }, TMP_27.$$arity = 0); Opal.defn(self, '$to_r', TMP_28 = function $$to_r() { var self = this; if (self.imag['$=='](0)) { } else { self.$raise($scope.get('RangeError'), "can't convert " + (self) + " into Rational") }; return self.real.$to_r(); }, TMP_28.$$arity = 0); Opal.defn(self, '$to_s', TMP_29 = function $$to_s() { var $a, $b, $c, self = this, result = nil; result = self.real.$inspect(); if ((($a = ((($b = (($c = $scope.get('Number')['$==='](self.imag), $c !== false && $c !== nil && $c != null ?self.imag['$nan?']() : $c))) !== false && $b !== nil && $b != null) ? $b : self.imag['$positive?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = $rb_plus(result, "+") } else { result = $rb_plus(result, "-") }; result = $rb_plus(result, self.imag.$abs().$inspect()); if ((($a = ($b = $scope.get('Number')['$==='](self.imag), $b !== false && $b !== nil && $b != null ?(((($c = self.imag['$nan?']()) !== false && $c !== nil && $c != null) ? $c : self.imag['$infinite?']())) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = $rb_plus(result, "*")}; return $rb_plus(result, "i"); }, TMP_29.$$arity = 0); return Opal.cdecl($scope, 'I', self.$new(0, 1)); })($scope.base, $scope.get('Numeric')); return (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_30; Opal.defn(self, '$Complex', TMP_30 = function $$Complex(real, imag) { var self = this; if (imag == null) { imag = nil; } if (imag !== false && imag !== nil && imag != null) { return $scope.get('Complex').$new(real, imag) } else { return $scope.get('Complex').$new(real, 0) }; }, TMP_30.$$arity = -2) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/rational"] = function(Opal) { function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_divide(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_le(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module; Opal.add_stubs(['$require', '$to_i', '$==', '$raise', '$<', '$-@', '$new', '$gcd', '$/', '$nil?', '$===', '$reduce', '$to_r', '$equal?', '$!', '$coerce_to!', '$attr_reader', '$to_f', '$numerator', '$denominator', '$<=>', '$-', '$*', '$__coerced__', '$+', '$Rational', '$>', '$**', '$abs', '$ceil', '$with_precision', '$floor', '$to_s', '$<=', '$truncate', '$send', '$convert']); self.$require("corelib/numeric"); (function($base, $super) { function $Rational(){}; var self = $Rational = $klass($base, $super, 'Rational', $Rational); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26; def.num = def.den = nil; Opal.defs(self, '$reduce', TMP_1 = function $$reduce(num, den) { var $a, self = this, gcd = nil; num = num.$to_i(); den = den.$to_i(); if (den['$=='](0)) { self.$raise($scope.get('ZeroDivisionError'), "divided by 0") } else if ((($a = $rb_lt(den, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { num = num['$-@'](); den = den['$-@'](); } else if (den['$=='](1)) { return self.$new(num, den)}; gcd = num.$gcd(den); return self.$new($rb_divide(num, gcd), $rb_divide(den, gcd)); }, TMP_1.$$arity = 2); Opal.defs(self, '$convert', TMP_2 = function $$convert(num, den) { var $a, $b, $c, self = this; if ((($a = ((($b = num['$nil?']()) !== false && $b !== nil && $b != null) ? $b : den['$nil?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('TypeError'), "cannot convert nil into Rational")}; if ((($a = ($b = $scope.get('Integer')['$==='](num), $b !== false && $b !== nil && $b != null ?$scope.get('Integer')['$==='](den) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$reduce(num, den)}; if ((($a = ((($b = ((($c = $scope.get('Float')['$==='](num)) !== false && $c !== nil && $c != null) ? $c : $scope.get('String')['$==='](num))) !== false && $b !== nil && $b != null) ? $b : $scope.get('Complex')['$==='](num))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { num = num.$to_r()}; if ((($a = ((($b = ((($c = $scope.get('Float')['$==='](den)) !== false && $c !== nil && $c != null) ? $c : $scope.get('String')['$==='](den))) !== false && $b !== nil && $b != null) ? $b : $scope.get('Complex')['$==='](den))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { den = den.$to_r()}; if ((($a = ($b = den['$equal?'](1), $b !== false && $b !== nil && $b != null ?($scope.get('Integer')['$==='](num))['$!']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('Opal')['$coerce_to!'](num, $scope.get('Rational'), "to_r") } else if ((($a = ($b = $scope.get('Numeric')['$==='](num), $b !== false && $b !== nil && $b != null ?$scope.get('Numeric')['$==='](den) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $rb_divide(num, den) } else { return self.$reduce(num, den) }; }, TMP_2.$$arity = 2); self.$attr_reader("numerator", "denominator"); Opal.defn(self, '$initialize', TMP_3 = function $$initialize(num, den) { var self = this; self.num = num; return self.den = den; }, TMP_3.$$arity = 2); Opal.defn(self, '$numerator', TMP_4 = function $$numerator() { var self = this; return self.num; }, TMP_4.$$arity = 0); Opal.defn(self, '$denominator', TMP_5 = function $$denominator() { var self = this; return self.den; }, TMP_5.$$arity = 0); Opal.defn(self, '$coerce', TMP_6 = function $$coerce(other) { var self = this, $case = nil; return (function() {$case = other;if ($scope.get('Rational')['$===']($case)) {return [other, self]}else if ($scope.get('Integer')['$===']($case)) {return [other.$to_r(), self]}else if ($scope.get('Float')['$===']($case)) {return [other, self.$to_f()]}else { return nil }})(); }, TMP_6.$$arity = 1); Opal.defn(self, '$==', TMP_7 = function(other) { var $a, self = this, $case = nil; return (function() {$case = other;if ($scope.get('Rational')['$===']($case)) {return (($a = self.num['$=='](other.$numerator())) ? self.den['$=='](other.$denominator()) : self.num['$=='](other.$numerator()))}else if ($scope.get('Integer')['$===']($case)) {return (($a = self.num['$=='](other)) ? self.den['$=='](1) : self.num['$=='](other))}else if ($scope.get('Float')['$===']($case)) {return self.$to_f()['$=='](other)}else {return other['$=='](self)}})(); }, TMP_7.$$arity = 1); Opal.defn(self, '$<=>', TMP_8 = function(other) { var self = this, $case = nil; return (function() {$case = other;if ($scope.get('Rational')['$===']($case)) {return $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator()))['$<=>'](0)}else if ($scope.get('Integer')['$===']($case)) {return $rb_minus(self.num, $rb_times(self.den, other))['$<=>'](0)}else if ($scope.get('Float')['$===']($case)) {return self.$to_f()['$<=>'](other)}else {return self.$__coerced__("<=>", other)}})(); }, TMP_8.$$arity = 1); Opal.defn(self, '$+', TMP_9 = function(other) { var self = this, $case = nil, num = nil, den = nil; return (function() {$case = other;if ($scope.get('Rational')['$===']($case)) {num = $rb_plus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); den = $rb_times(self.den, other.$denominator()); return self.$Rational(num, den);}else if ($scope.get('Integer')['$===']($case)) {return self.$Rational($rb_plus(self.num, $rb_times(other, self.den)), self.den)}else if ($scope.get('Float')['$===']($case)) {return $rb_plus(self.$to_f(), other)}else {return self.$__coerced__("+", other)}})(); }, TMP_9.$$arity = 1); Opal.defn(self, '$-', TMP_10 = function(other) { var self = this, $case = nil, num = nil, den = nil; return (function() {$case = other;if ($scope.get('Rational')['$===']($case)) {num = $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); den = $rb_times(self.den, other.$denominator()); return self.$Rational(num, den);}else if ($scope.get('Integer')['$===']($case)) {return self.$Rational($rb_minus(self.num, $rb_times(other, self.den)), self.den)}else if ($scope.get('Float')['$===']($case)) {return $rb_minus(self.$to_f(), other)}else {return self.$__coerced__("-", other)}})(); }, TMP_10.$$arity = 1); Opal.defn(self, '$*', TMP_11 = function(other) { var self = this, $case = nil, num = nil, den = nil; return (function() {$case = other;if ($scope.get('Rational')['$===']($case)) {num = $rb_times(self.num, other.$numerator()); den = $rb_times(self.den, other.$denominator()); return self.$Rational(num, den);}else if ($scope.get('Integer')['$===']($case)) {return self.$Rational($rb_times(self.num, other), self.den)}else if ($scope.get('Float')['$===']($case)) {return $rb_times(self.$to_f(), other)}else {return self.$__coerced__("*", other)}})(); }, TMP_11.$$arity = 1); Opal.defn(self, '$/', TMP_12 = function(other) { var self = this, $case = nil, num = nil, den = nil; return (function() {$case = other;if ($scope.get('Rational')['$===']($case)) {num = $rb_times(self.num, other.$denominator()); den = $rb_times(self.den, other.$numerator()); return self.$Rational(num, den);}else if ($scope.get('Integer')['$===']($case)) {if (other['$=='](0)) { return $rb_divide(self.$to_f(), 0.0) } else { return self.$Rational(self.num, $rb_times(self.den, other)) }}else if ($scope.get('Float')['$===']($case)) {return $rb_divide(self.$to_f(), other)}else {return self.$__coerced__("/", other)}})(); }, TMP_12.$$arity = 1); Opal.defn(self, '$**', TMP_13 = function(other) { var $a, $b, self = this, $case = nil; return (function() {$case = other;if ($scope.get('Integer')['$===']($case)) {if ((($a = (($b = self['$=='](0)) ? $rb_lt(other, 0) : self['$=='](0))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($scope.get('Float')).$$scope.get('INFINITY')) } else if ((($a = $rb_gt(other, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$Rational(self.num['$**'](other), self.den['$**'](other)) } else if ((($a = $rb_lt(other, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$Rational(self.den['$**'](other['$-@']()), self.num['$**'](other['$-@']())) } else { return self.$Rational(1, 1) }}else if ($scope.get('Float')['$===']($case)) {return self.$to_f()['$**'](other)}else if ($scope.get('Rational')['$===']($case)) {if (other['$=='](0)) { return self.$Rational(1, 1) } else if (other.$denominator()['$=='](1)) { if ((($a = $rb_lt(other, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$Rational(self.den['$**'](other.$numerator().$abs()), self.num['$**'](other.$numerator().$abs())) } else { return self.$Rational(self.num['$**'](other.$numerator()), self.den['$**'](other.$numerator())) } } else if ((($a = (($b = self['$=='](0)) ? $rb_lt(other, 0) : self['$=='](0))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise($scope.get('ZeroDivisionError'), "divided by 0") } else { return self.$to_f()['$**'](other) }}else {return self.$__coerced__("**", other)}})(); }, TMP_13.$$arity = 1); Opal.defn(self, '$abs', TMP_14 = function $$abs() { var self = this; return self.$Rational(self.num.$abs(), self.den.$abs()); }, TMP_14.$$arity = 0); Opal.defn(self, '$ceil', TMP_15 = function $$ceil(precision) { var self = this; if (precision == null) { precision = 0; } if (precision['$=='](0)) { return (($rb_divide(self.num['$-@'](), self.den))['$-@']()).$ceil() } else { return self.$with_precision("ceil", precision) }; }, TMP_15.$$arity = -1); Opal.alias(self, 'divide', '/'); Opal.defn(self, '$floor', TMP_16 = function $$floor(precision) { var self = this; if (precision == null) { precision = 0; } if (precision['$=='](0)) { return (($rb_divide(self.num['$-@'](), self.den))['$-@']()).$floor() } else { return self.$with_precision("floor", precision) }; }, TMP_16.$$arity = -1); Opal.defn(self, '$hash', TMP_17 = function $$hash() { var self = this; return "Rational:" + (self.num) + ":" + (self.den); }, TMP_17.$$arity = 0); Opal.defn(self, '$inspect', TMP_18 = function $$inspect() { var self = this; return "(" + (self.$to_s()) + ")"; }, TMP_18.$$arity = 0); Opal.alias(self, 'quo', '/'); Opal.defn(self, '$rationalize', TMP_19 = function $$rationalize(eps) { var self = this; if (arguments.length > 1) { self.$raise($scope.get('ArgumentError'), "wrong number of arguments (" + (arguments.length) + " for 0..1)"); } if (eps == null) { return self; } var e = eps.$abs(), a = $rb_minus(self, e), b = $rb_plus(self, e); var p0 = 0, p1 = 1, q0 = 1, q1 = 0, p2, q2; var c, k, t; while (true) { c = (a).$ceil(); if ($rb_le(c, b)) { break; } k = c - 1; p2 = k * p1 + p0; q2 = k * q1 + q0; t = $rb_divide(1, ($rb_minus(b, k))); b = $rb_divide(1, ($rb_minus(a, k))); a = t; p0 = p1; q0 = q1; p1 = p2; q1 = q2; } return self.$Rational(c * p1 + p0, c * q1 + q0); ; }, TMP_19.$$arity = -1); Opal.defn(self, '$round', TMP_20 = function $$round(precision) { var $a, self = this, num = nil, den = nil, approx = nil; if (precision == null) { precision = 0; } if (precision['$=='](0)) { } else { return self.$with_precision("round", precision) }; if (self.num['$=='](0)) { return 0}; if (self.den['$=='](1)) { return self.num}; num = $rb_plus($rb_times(self.num.$abs(), 2), self.den); den = $rb_times(self.den, 2); approx = ($rb_divide(num, den)).$truncate(); if ((($a = $rb_lt(self.num, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return approx['$-@']() } else { return approx }; }, TMP_20.$$arity = -1); Opal.defn(self, '$to_f', TMP_21 = function $$to_f() { var self = this; return $rb_divide(self.num, self.den); }, TMP_21.$$arity = 0); Opal.defn(self, '$to_i', TMP_22 = function $$to_i() { var self = this; return self.$truncate(); }, TMP_22.$$arity = 0); Opal.defn(self, '$to_r', TMP_23 = function $$to_r() { var self = this; return self; }, TMP_23.$$arity = 0); Opal.defn(self, '$to_s', TMP_24 = function $$to_s() { var self = this; return "" + (self.num) + "/" + (self.den); }, TMP_24.$$arity = 0); Opal.defn(self, '$truncate', TMP_25 = function $$truncate(precision) { var $a, self = this; if (precision == null) { precision = 0; } if (precision['$=='](0)) { if ((($a = $rb_lt(self.num, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$ceil() } else { return self.$floor() } } else { return self.$with_precision("truncate", precision) }; }, TMP_25.$$arity = -1); return (Opal.defn(self, '$with_precision', TMP_26 = function $$with_precision(method, precision) { var $a, self = this, p = nil, s = nil; if ((($a = $scope.get('Integer')['$==='](precision)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('TypeError'), "not an Integer") }; p = (10)['$**'](precision); s = $rb_times(self, p); if ((($a = $rb_lt(precision, 1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($rb_divide(s.$send(method), p)).$to_i() } else { return self.$Rational(s.$send(method), p) }; }, TMP_26.$$arity = 2), nil) && 'with_precision'; })($scope.base, $scope.get('Numeric')); return (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_27; Opal.defn(self, '$Rational', TMP_27 = function $$Rational(numerator, denominator) { var self = this; if (denominator == null) { denominator = 1; } return $scope.get('Rational').$convert(numerator, denominator); }, TMP_27.$$arity = -2) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/time"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_divide(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_le(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$require', '$include', '$===', '$raise', '$coerce_to!', '$respond_to?', '$to_str', '$to_i', '$new', '$<=>', '$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']); self.$require("corelib/comparable"); return (function($base, $super) { function $Time(){}; var self = $Time = $klass($base, $super, 'Time', $Time); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_40, TMP_41, TMP_42; self.$include($scope.get('Comparable')); var days_of_week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], short_days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], short_months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], long_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; ; Opal.defs(self, '$at', TMP_1 = function $$at(seconds, frac) { var self = this; var result; if ($scope.get('Time')['$==='](seconds)) { if (frac !== undefined) { self.$raise($scope.get('TypeError'), "can't convert Time into an exact number") } result = new Date(seconds.getTime()); result.is_utc = seconds.is_utc; return result; } if (!seconds.$$is_number) { seconds = $scope.get('Opal')['$coerce_to!'](seconds, $scope.get('Integer'), "to_int"); } if (frac === undefined) { return new Date(seconds * 1000); } if (!frac.$$is_number) { frac = $scope.get('Opal')['$coerce_to!'](frac, $scope.get('Integer'), "to_int"); } return new Date(seconds * 1000 + (frac / 1000)); ; }, TMP_1.$$arity = -2); function time_params(year, month, day, hour, min, sec) { if (year.$$is_string) { year = parseInt(year, 10); } else { year = $scope.get('Opal')['$coerce_to!'](year, $scope.get('Integer'), "to_int"); } if (month === nil) { month = 1; } else if (!month.$$is_number) { if ((month)['$respond_to?']("to_str")) { month = (month).$to_str(); switch (month.toLowerCase()) { case 'jan': month = 1; break; case 'feb': month = 2; break; case 'mar': month = 3; break; case 'apr': month = 4; break; case 'may': month = 5; break; case 'jun': month = 6; break; case 'jul': month = 7; break; case 'aug': month = 8; break; case 'sep': month = 9; break; case 'oct': month = 10; break; case 'nov': month = 11; break; case 'dec': month = 12; break; default: month = (month).$to_i(); } } else { month = $scope.get('Opal')['$coerce_to!'](month, $scope.get('Integer'), "to_int"); } } if (month < 1 || month > 12) { self.$raise($scope.get('ArgumentError'), "month out of range: " + (month)) } month = month - 1; if (day === nil) { day = 1; } else if (day.$$is_string) { day = parseInt(day, 10); } else { day = $scope.get('Opal')['$coerce_to!'](day, $scope.get('Integer'), "to_int"); } if (day < 1 || day > 31) { self.$raise($scope.get('ArgumentError'), "day out of range: " + (day)) } if (hour === nil) { hour = 0; } else if (hour.$$is_string) { hour = parseInt(hour, 10); } else { hour = $scope.get('Opal')['$coerce_to!'](hour, $scope.get('Integer'), "to_int"); } if (hour < 0 || hour > 24) { self.$raise($scope.get('ArgumentError'), "hour out of range: " + (hour)) } if (min === nil) { min = 0; } else if (min.$$is_string) { min = parseInt(min, 10); } else { min = $scope.get('Opal')['$coerce_to!'](min, $scope.get('Integer'), "to_int"); } if (min < 0 || min > 59) { self.$raise($scope.get('ArgumentError'), "min out of range: " + (min)) } if (sec === nil) { sec = 0; } else if (!sec.$$is_number) { if (sec.$$is_string) { sec = parseInt(sec, 10); } else { sec = $scope.get('Opal')['$coerce_to!'](sec, $scope.get('Integer'), "to_int"); } } if (sec < 0 || sec > 60) { self.$raise($scope.get('ArgumentError'), "sec out of range: " + (sec)) } return [year, month, day, hour, min, sec]; } ; Opal.defs(self, '$new', TMP_2 = function(year, month, day, hour, min, sec, utc_offset) { var self = this; if (month == null) { month = nil; } if (day == null) { day = nil; } if (hour == null) { hour = nil; } if (min == null) { min = nil; } if (sec == null) { sec = nil; } if (utc_offset == null) { utc_offset = nil; } var args, result; if (year === undefined) { return new Date(); } if (utc_offset !== nil) { self.$raise($scope.get('ArgumentError'), "Opal does not support explicitly specifying UTC offset for Time") } args = time_params(year, month, day, hour, min, sec); year = args[0]; month = args[1]; day = args[2]; hour = args[3]; min = args[4]; sec = args[5]; result = new Date(year, month, day, hour, min, 0, sec * 1000); if (year < 100) { result.setFullYear(year); } return result; }, TMP_2.$$arity = -1); Opal.defs(self, '$local', TMP_3 = function $$local(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { var self = this; if (month == null) { month = nil; } if (day == null) { day = nil; } if (hour == null) { hour = nil; } if (min == null) { min = nil; } if (sec == null) { sec = nil; } if (millisecond == null) { millisecond = nil; } if (_dummy1 == null) { _dummy1 = nil; } if (_dummy2 == null) { _dummy2 = nil; } if (_dummy3 == null) { _dummy3 = nil; } var args, result; if (arguments.length === 10) { args = $slice.call(arguments); year = args[5]; month = args[4]; day = args[3]; hour = args[2]; min = args[1]; sec = args[0]; } args = time_params(year, month, day, hour, min, sec); year = args[0]; month = args[1]; day = args[2]; hour = args[3]; min = args[4]; sec = args[5]; result = new Date(year, month, day, hour, min, 0, sec * 1000); if (year < 100) { result.setFullYear(year); } return result; }, TMP_3.$$arity = -2); Opal.defs(self, '$gm', TMP_4 = function $$gm(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { var self = this; if (month == null) { month = nil; } if (day == null) { day = nil; } if (hour == null) { hour = nil; } if (min == null) { min = nil; } if (sec == null) { sec = nil; } if (millisecond == null) { millisecond = nil; } if (_dummy1 == null) { _dummy1 = nil; } if (_dummy2 == null) { _dummy2 = nil; } if (_dummy3 == null) { _dummy3 = nil; } var args, result; if (arguments.length === 10) { args = $slice.call(arguments); year = args[5]; month = args[4]; day = args[3]; hour = args[2]; min = args[1]; sec = args[0]; } args = time_params(year, month, day, hour, min, sec); year = args[0]; month = args[1]; day = args[2]; hour = args[3]; min = args[4]; sec = args[5]; result = new Date(Date.UTC(year, month, day, hour, min, 0, sec * 1000)); if (year < 100) { result.setUTCFullYear(year); } result.is_utc = true; return result; }, TMP_4.$$arity = -2); (function(self) { var $scope = self.$$scope, def = self.$$proto; Opal.alias(self, 'mktime', 'local'); return Opal.alias(self, 'utc', 'gm'); })(Opal.get_singleton_class(self)); Opal.defs(self, '$now', TMP_5 = function $$now() { var self = this; return self.$new(); }, TMP_5.$$arity = 0); Opal.defn(self, '$+', TMP_6 = function(other) { var $a, self = this; if ((($a = $scope.get('Time')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('TypeError'), "time + time?")}; if (!other.$$is_number) { other = $scope.get('Opal')['$coerce_to!'](other, $scope.get('Integer'), "to_int"); } var result = new Date(self.getTime() + (other * 1000)); result.is_utc = self.is_utc; return result; ; }, TMP_6.$$arity = 1); Opal.defn(self, '$-', TMP_7 = function(other) { var $a, self = this; if ((($a = $scope.get('Time')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (self.getTime() - other.getTime()) / 1000}; if (!other.$$is_number) { other = $scope.get('Opal')['$coerce_to!'](other, $scope.get('Integer'), "to_int"); } var result = new Date(self.getTime() - (other * 1000)); result.is_utc = self.is_utc; return result; ; }, TMP_7.$$arity = 1); Opal.defn(self, '$<=>', TMP_8 = function(other) { var $a, self = this, r = nil; if ((($a = $scope.get('Time')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$to_f()['$<=>'](other.$to_f()) } else { r = other['$<=>'](self); if ((($a = r['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else if ((($a = $rb_gt(r, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return -1 } else if ((($a = $rb_lt(r, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return 1 } else { return 0 }; }; }, TMP_8.$$arity = 1); Opal.defn(self, '$==', TMP_9 = function(other) { var self = this; return self.$to_f() === other.$to_f(); }, TMP_9.$$arity = 1); Opal.defn(self, '$asctime', TMP_10 = function $$asctime() { var self = this; return self.$strftime("%a %b %e %H:%M:%S %Y"); }, TMP_10.$$arity = 0); Opal.alias(self, 'ctime', 'asctime'); Opal.defn(self, '$day', TMP_11 = function $$day() { var self = this; return self.is_utc ? self.getUTCDate() : self.getDate(); }, TMP_11.$$arity = 0); Opal.defn(self, '$yday', TMP_12 = function $$yday() { var self = this, start_of_year = nil, start_of_day = nil, one_day = nil; start_of_year = $scope.get('Time').$new(self.$year()).$to_i(); start_of_day = $scope.get('Time').$new(self.$year(), self.$month(), self.$day()).$to_i(); one_day = 86400; return $rb_plus(($rb_divide(($rb_minus(start_of_day, start_of_year)), one_day)).$round(), 1); }, TMP_12.$$arity = 0); Opal.defn(self, '$isdst', TMP_13 = function $$isdst() { var self = this; var jan = new Date(self.getFullYear(), 0, 1), jul = new Date(self.getFullYear(), 6, 1); return self.getTimezoneOffset() < Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()); }, TMP_13.$$arity = 0); Opal.alias(self, 'dst?', 'isdst'); Opal.defn(self, '$dup', TMP_14 = function $$dup() { var self = this, copy = nil; copy = new Date(self.getTime()); copy.$copy_instance_variables(self); copy.$initialize_dup(self); return copy; }, TMP_14.$$arity = 0); Opal.defn(self, '$eql?', TMP_15 = function(other) { var $a, self = this; return ($a = other['$is_a?']($scope.get('Time')), $a !== false && $a !== nil && $a != null ?(self['$<=>'](other))['$zero?']() : $a); }, TMP_15.$$arity = 1); Opal.defn(self, '$friday?', TMP_16 = function() { var self = this; return self.$wday() == 5; }, TMP_16.$$arity = 0); Opal.defn(self, '$hash', TMP_17 = function $$hash() { var self = this; return 'Time:' + self.getTime(); }, TMP_17.$$arity = 0); Opal.defn(self, '$hour', TMP_18 = function $$hour() { var self = this; return self.is_utc ? self.getUTCHours() : self.getHours(); }, TMP_18.$$arity = 0); Opal.defn(self, '$inspect', TMP_19 = function $$inspect() { var $a, self = this; if ((($a = self['$utc?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$strftime("%Y-%m-%d %H:%M:%S UTC") } else { return self.$strftime("%Y-%m-%d %H:%M:%S %z") }; }, TMP_19.$$arity = 0); Opal.alias(self, 'mday', 'day'); Opal.defn(self, '$min', TMP_20 = function $$min() { var self = this; return self.is_utc ? self.getUTCMinutes() : self.getMinutes(); }, TMP_20.$$arity = 0); Opal.defn(self, '$mon', TMP_21 = function $$mon() { var self = this; return (self.is_utc ? self.getUTCMonth() : self.getMonth()) + 1; }, TMP_21.$$arity = 0); Opal.defn(self, '$monday?', TMP_22 = function() { var self = this; return self.$wday() == 1; }, TMP_22.$$arity = 0); Opal.alias(self, 'month', 'mon'); Opal.defn(self, '$saturday?', TMP_23 = function() { var self = this; return self.$wday() == 6; }, TMP_23.$$arity = 0); Opal.defn(self, '$sec', TMP_24 = function $$sec() { var self = this; return self.is_utc ? self.getUTCSeconds() : self.getSeconds(); }, TMP_24.$$arity = 0); Opal.defn(self, '$succ', TMP_25 = function $$succ() { var self = this; var result = new Date(self.getTime() + 1000); result.is_utc = self.is_utc; return result; }, TMP_25.$$arity = 0); Opal.defn(self, '$usec', TMP_26 = function $$usec() { var self = this; return self.getMilliseconds() * 1000; }, TMP_26.$$arity = 0); Opal.defn(self, '$zone', TMP_27 = function $$zone() { var self = this; var string = self.toString(), result; if (string.indexOf('(') == -1) { result = string.match(/[A-Z]{3,4}/)[0]; } else { result = string.match(/\([^)]+\)/)[0].match(/[A-Z]/g).join(''); } if (result == "GMT" && /(GMT\W*\d{4})/.test(string)) { return RegExp.$1; } else { return result; } }, TMP_27.$$arity = 0); Opal.defn(self, '$getgm', TMP_28 = function $$getgm() { var self = this; var result = new Date(self.getTime()); result.is_utc = true; return result; }, TMP_28.$$arity = 0); Opal.alias(self, 'getutc', 'getgm'); Opal.defn(self, '$gmtime', TMP_29 = function $$gmtime() { var self = this; self.is_utc = true; return self; }, TMP_29.$$arity = 0); Opal.alias(self, 'utc', 'gmtime'); Opal.defn(self, '$gmt?', TMP_30 = function() { var self = this; return self.is_utc === true; }, TMP_30.$$arity = 0); Opal.defn(self, '$gmt_offset', TMP_31 = function $$gmt_offset() { var self = this; return -self.getTimezoneOffset() * 60; }, TMP_31.$$arity = 0); Opal.defn(self, '$strftime', TMP_32 = function $$strftime(format) { var self = this; return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) { var result = "", zero = flags.indexOf('0') !== -1, pad = flags.indexOf('-') === -1, blank = flags.indexOf('_') !== -1, upcase = flags.indexOf('^') !== -1, invert = flags.indexOf('#') !== -1, colons = (flags.match(':') || []).length; width = parseInt(width, 10); if (zero && blank) { if (flags.indexOf('0') < flags.indexOf('_')) { zero = false; } else { blank = false; } } switch (conv) { case 'Y': result += self.$year(); break; case 'C': zero = !blank; result += Math.round(self.$year() / 100); break; case 'y': zero = !blank; result += (self.$year() % 100); break; case 'm': zero = !blank; result += self.$mon(); break; case 'B': result += long_months[self.$mon() - 1]; break; case 'b': case 'h': blank = !zero; result += short_months[self.$mon() - 1]; break; case 'd': zero = !blank result += self.$day(); break; case 'e': blank = !zero result += self.$day(); break; case 'j': result += self.$yday(); break; case 'H': zero = !blank; result += self.$hour(); break; case 'k': blank = !zero; result += self.$hour(); break; case 'I': zero = !blank; result += (self.$hour() % 12 || 12); break; case 'l': blank = !zero; result += (self.$hour() % 12 || 12); break; case 'P': result += (self.$hour() >= 12 ? "pm" : "am"); break; case 'p': result += (self.$hour() >= 12 ? "PM" : "AM"); break; case 'M': zero = !blank; result += self.$min(); break; case 'S': zero = !blank; result += self.$sec() break; case 'L': zero = !blank; width = isNaN(width) ? 3 : width; result += self.getMilliseconds(); break; case 'N': width = isNaN(width) ? 9 : width; result += (self.getMilliseconds().toString()).$rjust(3, "0"); result = (result).$ljust(width, "0"); break; case 'z': var offset = self.getTimezoneOffset(), hours = Math.floor(Math.abs(offset) / 60), minutes = Math.abs(offset) % 60; result += offset < 0 ? "+" : "-"; result += hours < 10 ? "0" : ""; result += hours; if (colons > 0) { result += ":"; } result += minutes < 10 ? "0" : ""; result += minutes; if (colons > 1) { result += ":00"; } break; case 'Z': result += self.$zone(); break; case 'A': result += days_of_week[self.$wday()]; break; case 'a': result += short_days[self.$wday()]; break; case 'u': result += (self.$wday() + 1); break; case 'w': result += self.$wday(); break; case 'V': result += self.$cweek_cyear()['$[]'](0).$to_s().$rjust(2, "0"); break; case 'G': result += self.$cweek_cyear()['$[]'](1); break; case 'g': result += self.$cweek_cyear()['$[]'](1)['$[]']($range(-2, -1, false)); break; case 's': result += self.$to_i(); break; case 'n': result += "\n"; break; case 't': result += "\t"; break; case '%': result += "%"; break; case 'c': result += self.$strftime("%a %b %e %T %Y"); break; case 'D': case 'x': result += self.$strftime("%m/%d/%y"); break; case 'F': result += self.$strftime("%Y-%m-%d"); break; case 'v': result += self.$strftime("%e-%^b-%4Y"); break; case 'r': result += self.$strftime("%I:%M:%S %p"); break; case 'R': result += self.$strftime("%H:%M"); break; case 'T': case 'X': result += self.$strftime("%H:%M:%S"); break; default: return full; } if (upcase) { result = result.toUpperCase(); } if (invert) { result = result.replace(/[A-Z]/, function(c) { c.toLowerCase() }). replace(/[a-z]/, function(c) { c.toUpperCase() }); } if (pad && (zero || blank)) { result = (result).$rjust(isNaN(width) ? 2 : width, blank ? " " : "0"); } return result; }); }, TMP_32.$$arity = 1); Opal.defn(self, '$sunday?', TMP_33 = function() { var self = this; return self.$wday() == 0; }, TMP_33.$$arity = 0); Opal.defn(self, '$thursday?', TMP_34 = function() { var self = this; return self.$wday() == 4; }, TMP_34.$$arity = 0); Opal.defn(self, '$to_a', TMP_35 = function $$to_a() { var self = this; return [self.$sec(), self.$min(), self.$hour(), self.$day(), self.$month(), self.$year(), self.$wday(), self.$yday(), self.$isdst(), self.$zone()]; }, TMP_35.$$arity = 0); Opal.defn(self, '$to_f', TMP_36 = function $$to_f() { var self = this; return self.getTime() / 1000; }, TMP_36.$$arity = 0); Opal.defn(self, '$to_i', TMP_37 = function $$to_i() { var self = this; return parseInt(self.getTime() / 1000, 10); }, TMP_37.$$arity = 0); Opal.alias(self, 'to_s', 'inspect'); Opal.defn(self, '$tuesday?', TMP_38 = function() { var self = this; return self.$wday() == 2; }, TMP_38.$$arity = 0); Opal.alias(self, 'tv_sec', 'sec'); Opal.alias(self, 'tv_usec', 'usec'); Opal.alias(self, 'utc?', 'gmt?'); Opal.alias(self, 'gmtoff', 'gmt_offset'); Opal.alias(self, 'utc_offset', 'gmt_offset'); Opal.defn(self, '$wday', TMP_39 = function $$wday() { var self = this; return self.is_utc ? self.getUTCDay() : self.getDay(); }, TMP_39.$$arity = 0); Opal.defn(self, '$wednesday?', TMP_40 = function() { var self = this; return self.$wday() == 3; }, TMP_40.$$arity = 0); Opal.defn(self, '$year', TMP_41 = function $$year() { var self = this; return self.is_utc ? self.getUTCFullYear() : self.getFullYear(); }, TMP_41.$$arity = 0); return (Opal.defn(self, '$cweek_cyear', TMP_42 = function $$cweek_cyear() { var $a, $b, self = this, jan01 = nil, jan01_wday = nil, first_monday = nil, year = nil, offset = nil, week = nil, dec31 = nil, dec31_wday = nil; jan01 = $scope.get('Time').$new(self.$year(), 1, 1); jan01_wday = jan01.$wday(); first_monday = 0; year = self.$year(); if ((($a = ($b = $rb_le(jan01_wday, 4), $b !== false && $b !== nil && $b != null ?jan01_wday['$!='](0) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { offset = $rb_minus(jan01_wday, 1) } else { offset = $rb_minus($rb_minus(jan01_wday, 7), 1); if (offset['$=='](-8)) { offset = -1}; }; week = ($rb_divide(($rb_plus(self.$yday(), offset)), 7.0)).$ceil(); if ((($a = $rb_le(week, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('Time').$new($rb_minus(self.$year(), 1), 12, 31).$cweek_cyear() } else if (week['$=='](53)) { dec31 = $scope.get('Time').$new(self.$year(), 12, 31); dec31_wday = dec31.$wday(); if ((($a = ($b = $rb_le(dec31_wday, 3), $b !== false && $b !== nil && $b != null ?dec31_wday['$!='](0) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { week = 1; year = $rb_plus(year, 1);};}; return [week, year]; }, TMP_42.$$arity = 0), nil) && 'cweek_cyear'; })($scope.base, Date); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/struct"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_ge(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$require', '$include', '$const_name!', '$unshift', '$map', '$coerce_to!', '$new', '$each', '$define_struct_attribute', '$allocate', '$initialize', '$module_eval', '$to_proc', '$const_set', '$==', '$raise', '$<<', '$members', '$define_method', '$instance_eval', '$>', '$length', '$class', '$each_with_index', '$[]=', '$[]', '$hash', '$===', '$<', '$-@', '$size', '$>=', '$include?', '$to_sym', '$instance_of?', '$__id__', '$eql?', '$enum_for', '$name', '$+', '$join', '$inspect', '$each_pair', '$inject', '$flatten', '$to_a', '$values_at']); self.$require("corelib/enumerable"); return (function($base, $super) { function $Struct(){}; var self = $Struct = $klass($base, $super, 'Struct', $Struct); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_8, TMP_9, TMP_11, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_23, TMP_26, TMP_28, TMP_30, TMP_32, TMP_34, TMP_35; self.$include($scope.get('Enumerable')); Opal.defs(self, '$new', TMP_1 = function(const_name, $a_rest) { var $b, $c, TMP_2, $d, TMP_3, $e, self = this, args, $iter = TMP_1.$$p, block = $iter || nil, klass = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_1.$$p = null; if (const_name !== false && const_name !== nil && const_name != null) { try { const_name = $scope.get('Opal')['$const_name!'](const_name) } catch ($err) { if (Opal.rescue($err, [$scope.get('TypeError'), $scope.get('NameError')])) { try { args.$unshift(const_name); const_name = nil; } finally { Opal.pop_exception() } } else { throw $err; } }}; ($b = ($c = args).$map, $b.$$p = (TMP_2 = function(arg){var self = TMP_2.$$s || this; if (arg == null) arg = nil; return $scope.get('Opal')['$coerce_to!'](arg, $scope.get('String'), "to_str")}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $b).call($c); klass = ($b = ($d = $scope.get('Class')).$new, $b.$$p = (TMP_3 = function(){var self = TMP_3.$$s || this, $a, $e, TMP_4; ($a = ($e = args).$each, $a.$$p = (TMP_4 = function(arg){var self = TMP_4.$$s || this; if (arg == null) arg = nil; return self.$define_struct_attribute(arg)}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $a).call($e); return (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_5; Opal.defn(self, '$new', TMP_5 = function($a_rest) { var $b, self = this, args, instance = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } instance = self.$allocate(); instance.$$data = {};; ($b = instance).$initialize.apply($b, Opal.to_a(args)); return instance; }, TMP_5.$$arity = -1); return Opal.alias(self, '[]', 'new'); })(Opal.get_singleton_class(self));}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3), $b).call($d, self); if (block !== false && block !== nil && block != null) { ($b = ($e = klass).$module_eval, $b.$$p = block.$to_proc(), $b).call($e)}; if (const_name !== false && const_name !== nil && const_name != null) { $scope.get('Struct').$const_set(const_name, klass)}; return klass; }, TMP_1.$$arity = -2); Opal.defs(self, '$define_struct_attribute', TMP_8 = function $$define_struct_attribute(name) { var $a, $b, TMP_6, $c, TMP_7, self = this; if (self['$==']($scope.get('Struct'))) { self.$raise($scope.get('ArgumentError'), "you cannot define attributes to the Struct class")}; self.$members()['$<<'](name); ($a = ($b = self).$define_method, $a.$$p = (TMP_6 = function(){var self = TMP_6.$$s || this; return self.$$data[name];}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6), $a).call($b, name); return ($a = ($c = self).$define_method, $a.$$p = (TMP_7 = function(value){var self = TMP_7.$$s || this; if (value == null) value = nil; return self.$$data[name] = value;}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $a).call($c, "" + (name) + "="); }, TMP_8.$$arity = 1); Opal.defs(self, '$members', TMP_9 = function $$members() { var $a, self = this; if (self.members == null) self.members = nil; if (self['$==']($scope.get('Struct'))) { self.$raise($scope.get('ArgumentError'), "the Struct class has no members")}; return ((($a = self.members) !== false && $a !== nil && $a != null) ? $a : self.members = []); }, TMP_9.$$arity = 0); Opal.defs(self, '$inherited', TMP_11 = function $$inherited(klass) { var $a, $b, TMP_10, self = this, members = nil; if (self.members == null) self.members = nil; members = self.members; return ($a = ($b = klass).$instance_eval, $a.$$p = (TMP_10 = function(){var self = TMP_10.$$s || this; return self.members = members}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10), $a).call($b); }, TMP_11.$$arity = 1); Opal.defn(self, '$initialize', TMP_13 = function $$initialize($a_rest) { var $b, $c, TMP_12, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($b = $rb_gt(args.$length(), self.$class().$members().$length())) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$raise($scope.get('ArgumentError'), "struct size differs")}; return ($b = ($c = self.$class().$members()).$each_with_index, $b.$$p = (TMP_12 = function(name, index){var self = TMP_12.$$s || this; if (name == null) name = nil;if (index == null) index = nil; return self['$[]='](name, args['$[]'](index))}, TMP_12.$$s = self, TMP_12.$$arity = 2, TMP_12), $b).call($c); }, TMP_13.$$arity = -1); Opal.defn(self, '$members', TMP_14 = function $$members() { var self = this; return self.$class().$members(); }, TMP_14.$$arity = 0); Opal.defn(self, '$hash', TMP_15 = function $$hash() { var self = this; return $scope.get('Hash').$new(self.$$data).$hash(); }, TMP_15.$$arity = 0); Opal.defn(self, '$[]', TMP_16 = function(name) { var $a, self = this; if ((($a = $scope.get('Integer')['$==='](name)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $rb_lt(name, self.$class().$members().$size()['$-@']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('IndexError'), "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")}; if ((($a = $rb_ge(name, self.$class().$members().$size())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('IndexError'), "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")}; name = self.$class().$members()['$[]'](name); } else if ((($a = $scope.get('String')['$==='](name)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if(!self.$$data.hasOwnProperty(name)) { self.$raise($scope.get('NameError').$new("no member '" + (name) + "' in struct", name)) } ; } else { self.$raise($scope.get('TypeError'), "no implicit conversion of " + (name.$class()) + " into Integer") }; name = $scope.get('Opal')['$coerce_to!'](name, $scope.get('String'), "to_str"); return self.$$data[name]; }, TMP_16.$$arity = 1); Opal.defn(self, '$[]=', TMP_17 = function(name, value) { var $a, self = this; if ((($a = $scope.get('Integer')['$==='](name)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $rb_lt(name, self.$class().$members().$size()['$-@']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('IndexError'), "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")}; if ((($a = $rb_ge(name, self.$class().$members().$size())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('IndexError'), "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")}; name = self.$class().$members()['$[]'](name); } else if ((($a = $scope.get('String')['$==='](name)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$class().$members()['$include?'](name.$to_sym())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('NameError').$new("no member '" + (name) + "' in struct", name)) } } else { self.$raise($scope.get('TypeError'), "no implicit conversion of " + (name.$class()) + " into Integer") }; name = $scope.get('Opal')['$coerce_to!'](name, $scope.get('String'), "to_str"); return self.$$data[name] = value; }, TMP_17.$$arity = 2); Opal.defn(self, '$==', TMP_18 = function(other) { var $a, self = this; if ((($a = other['$instance_of?'](self.$class())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return false }; var recursed1 = {}, recursed2 = {}; function _eqeq(struct, other) { var key, a, b; recursed1[(struct).$__id__()] = true; recursed2[(other).$__id__()] = true; for (key in struct.$$data) { a = struct.$$data[key]; b = other.$$data[key]; if ($scope.get('Struct')['$==='](a)) { if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { if (!_eqeq(a, b)) { return false; } } } else { if (!(a)['$=='](b)) { return false; } } } return true; } return _eqeq(self, other); ; }, TMP_18.$$arity = 1); Opal.defn(self, '$eql?', TMP_19 = function(other) { var $a, self = this; if ((($a = other['$instance_of?'](self.$class())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return false }; var recursed1 = {}, recursed2 = {}; function _eqeq(struct, other) { var key, a, b; recursed1[(struct).$__id__()] = true; recursed2[(other).$__id__()] = true; for (key in struct.$$data) { a = struct.$$data[key]; b = other.$$data[key]; if ($scope.get('Struct')['$==='](a)) { if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { if (!_eqeq(a, b)) { return false; } } } else { if (!(a)['$eql?'](b)) { return false; } } } return true; } return _eqeq(self, other); ; }, TMP_19.$$arity = 1); Opal.defn(self, '$each', TMP_20 = function $$each() { var $a, $b, TMP_21, $c, TMP_22, self = this, $iter = TMP_20.$$p, $yield = $iter || nil; TMP_20.$$p = null; if (($yield !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_21 = function(){var self = TMP_21.$$s || this; return self.$size()}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21), $a).call($b, "each") }; ($a = ($c = self.$class().$members()).$each, $a.$$p = (TMP_22 = function(name){var self = TMP_22.$$s || this; if (name == null) name = nil; return Opal.yield1($yield, self['$[]'](name));}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22), $a).call($c); return self; }, TMP_20.$$arity = 0); Opal.defn(self, '$each_pair', TMP_23 = function $$each_pair() { var $a, $b, TMP_24, $c, TMP_25, self = this, $iter = TMP_23.$$p, $yield = $iter || nil; TMP_23.$$p = null; if (($yield !== nil)) { } else { return ($a = ($b = self).$enum_for, $a.$$p = (TMP_24 = function(){var self = TMP_24.$$s || this; return self.$size()}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24), $a).call($b, "each_pair") }; ($a = ($c = self.$class().$members()).$each, $a.$$p = (TMP_25 = function(name){var self = TMP_25.$$s || this; if (name == null) name = nil; return Opal.yield1($yield, [name, self['$[]'](name)]);}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25), $a).call($c); return self; }, TMP_23.$$arity = 0); Opal.defn(self, '$length', TMP_26 = function $$length() { var self = this; return self.$class().$members().$length(); }, TMP_26.$$arity = 0); Opal.alias(self, 'size', 'length'); Opal.defn(self, '$to_a', TMP_28 = function $$to_a() { var $a, $b, TMP_27, self = this; return ($a = ($b = self.$class().$members()).$map, $a.$$p = (TMP_27 = function(name){var self = TMP_27.$$s || this; if (name == null) name = nil; return self['$[]'](name)}, TMP_27.$$s = self, TMP_27.$$arity = 1, TMP_27), $a).call($b); }, TMP_28.$$arity = 0); Opal.alias(self, 'values', 'to_a'); Opal.defn(self, '$inspect', TMP_30 = function $$inspect() { var $a, $b, TMP_29, self = this, result = nil; result = "#"); return result; }, TMP_30.$$arity = 0); Opal.alias(self, 'to_s', 'inspect'); Opal.defn(self, '$to_h', TMP_32 = function $$to_h() { var $a, $b, TMP_31, self = this; return ($a = ($b = self.$class().$members()).$inject, $a.$$p = (TMP_31 = function(h, name){var self = TMP_31.$$s || this; if (h == null) h = nil;if (name == null) name = nil; h['$[]='](name, self['$[]'](name)); return h;}, TMP_31.$$s = self, TMP_31.$$arity = 2, TMP_31), $a).call($b, $hash2([], {})); }, TMP_32.$$arity = 0); Opal.defn(self, '$values_at', TMP_34 = function $$values_at($a_rest) { var $b, $c, TMP_33, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } args = ($b = ($c = args).$map, $b.$$p = (TMP_33 = function(arg){var self = TMP_33.$$s || this; if (arg == null) arg = nil; return arg.$$is_range ? arg.$to_a() : arg;}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33), $b).call($c).$flatten(); var result = []; for (var i = 0, len = args.length; i < len; i++) { if (!args[i].$$is_number) { self.$raise($scope.get('TypeError'), "no implicit conversion of " + ((args[i]).$class()) + " into Integer") } result.push(self['$[]'](args[i])); } return result; ; }, TMP_34.$$arity = -1); return (Opal.defs(self, '$_load', TMP_35 = function $$_load(args) { var $a, $b, self = this, attributes = nil; attributes = ($a = args).$values_at.apply($a, Opal.to_a(self.$members())); return ($b = self).$new.apply($b, Opal.to_a(attributes)); }, TMP_35.$$arity = 1), nil) && '_load'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/io"] = function(Opal) { var $a, $b, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module, $gvars = Opal.gvars; Opal.add_stubs(['$attr_accessor', '$size', '$write', '$join', '$map', '$String', '$empty?', '$concat', '$chomp', '$getbyte', '$getc', '$raise', '$new', '$write_proc=', '$extend']); (function($base, $super) { function $IO(){}; var self = $IO = $klass($base, $super, 'IO', $IO); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4; def.tty = def.closed = nil; Opal.cdecl($scope, 'SEEK_SET', 0); Opal.cdecl($scope, 'SEEK_CUR', 1); Opal.cdecl($scope, 'SEEK_END', 2); Opal.defn(self, '$tty?', TMP_1 = function() { var self = this; return self.tty; }, TMP_1.$$arity = 0); Opal.defn(self, '$closed?', TMP_2 = function() { var self = this; return self.closed; }, TMP_2.$$arity = 0); self.$attr_accessor("write_proc"); Opal.defn(self, '$write', TMP_3 = function $$write(string) { var self = this; self.write_proc(string); return string.$size(); }, TMP_3.$$arity = 1); self.$attr_accessor("sync", "tty"); Opal.defn(self, '$flush', TMP_4 = function $$flush() { var self = this; return nil; }, TMP_4.$$arity = 0); (function($base) { var $Writable, self = $Writable = $module($base, 'Writable'); var def = self.$$proto, $scope = self.$$scope, TMP_5, TMP_7, TMP_9; Opal.defn(self, '$<<', TMP_5 = function(string) { var self = this; self.$write(string); return self; }, TMP_5.$$arity = 1); Opal.defn(self, '$print', TMP_7 = function $$print($a_rest) { var $b, $c, TMP_6, self = this, args; if ($gvars[","] == null) $gvars[","] = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } self.$write(($b = ($c = args).$map, $b.$$p = (TMP_6 = function(arg){var self = TMP_6.$$s || this; if (arg == null) arg = nil; return self.$String(arg)}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $b).call($c).$join($gvars[","])); return nil; }, TMP_7.$$arity = -1); Opal.defn(self, '$puts', TMP_9 = function $$puts($a_rest) { var $b, $c, TMP_8, self = this, args, newline = nil; if ($gvars["/"] == null) $gvars["/"] = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } newline = $gvars["/"]; if ((($b = args['$empty?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$write($gvars["/"]) } else { self.$write(($b = ($c = args).$map, $b.$$p = (TMP_8 = function(arg){var self = TMP_8.$$s || this; if (arg == null) arg = nil; return self.$String(arg).$chomp()}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8), $b).call($c).$concat([nil]).$join(newline)) }; return nil; }, TMP_9.$$arity = -1); })($scope.base); return (function($base) { var $Readable, self = $Readable = $module($base, 'Readable'); var def = self.$$proto, $scope = self.$$scope, TMP_10, TMP_11, TMP_12, TMP_13; Opal.defn(self, '$readbyte', TMP_10 = function $$readbyte() { var self = this; return self.$getbyte(); }, TMP_10.$$arity = 0); Opal.defn(self, '$readchar', TMP_11 = function $$readchar() { var self = this; return self.$getc(); }, TMP_11.$$arity = 0); Opal.defn(self, '$readline', TMP_12 = function $$readline(sep) { var self = this; if ($gvars["/"] == null) $gvars["/"] = nil; if (sep == null) { sep = $gvars["/"]; } return self.$raise($scope.get('NotImplementedError')); }, TMP_12.$$arity = -1); Opal.defn(self, '$readpartial', TMP_13 = function $$readpartial(integer, outbuf) { var self = this; if (outbuf == null) { outbuf = nil; } return self.$raise($scope.get('NotImplementedError')); }, TMP_13.$$arity = -2); })($scope.base); })($scope.base, null); Opal.cdecl($scope, 'STDERR', $gvars.stderr = $scope.get('IO').$new()); Opal.cdecl($scope, 'STDIN', $gvars.stdin = $scope.get('IO').$new()); Opal.cdecl($scope, 'STDOUT', $gvars.stdout = $scope.get('IO').$new()); (($a = [typeof(process) === 'object' ? function(s){process.stdout.write(s)} : function(s){console.log(s)}]), $b = $scope.get('STDOUT'), $b['$write_proc='].apply($b, $a), $a[$a.length-1]); (($a = [typeof(process) === 'object' ? function(s){process.stderr.write(s)} : function(s){console.warn(s)}]), $b = $scope.get('STDERR'), $b['$write_proc='].apply($b, $a), $a[$a.length-1]); $scope.get('STDOUT').$extend((($scope.get('IO')).$$scope.get('Writable'))); return $scope.get('STDERR').$extend((($scope.get('IO')).$$scope.get('Writable'))); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/main"] = function(Opal) { var TMP_1, TMP_2, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$include']); Opal.defs(self, '$to_s', TMP_1 = function $$to_s() { var self = this; return "main"; }, TMP_1.$$arity = 0); return (Opal.defs(self, '$include', TMP_2 = function $$include(mod) { var self = this; return $scope.get('Object').$include(mod); }, TMP_2.$$arity = 1), nil) && 'include'; }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/dir"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$[]']); return (function($base, $super) { function $Dir(){}; var self = $Dir = $klass($base, $super, 'Dir', $Dir); var def = self.$$proto, $scope = self.$$scope; return (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_1, TMP_2, TMP_3; Opal.defn(self, '$chdir', TMP_1 = function $$chdir(dir) { var self = this, $iter = TMP_1.$$p, $yield = $iter || nil, prev_cwd = nil; TMP_1.$$p = null; try { prev_cwd = Opal.current_dir; Opal.current_dir = dir; return Opal.yieldX($yield, []);; } finally { Opal.current_dir = prev_cwd; }; }, TMP_1.$$arity = 1); Opal.defn(self, '$pwd', TMP_2 = function $$pwd() { var self = this; return Opal.current_dir || '.'; }, TMP_2.$$arity = 0); Opal.alias(self, 'getwd', 'pwd'); return (Opal.defn(self, '$home', TMP_3 = function $$home() { var $a, self = this; return ((($a = $scope.get('ENV')['$[]']("HOME")) !== false && $a !== nil && $a != null) ? $a : "."); }, TMP_3.$$arity = 0), nil) && 'home'; })(Opal.get_singleton_class(self)) })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/file"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$join', '$compact', '$split', '$==', '$first', '$[]=', '$home', '$pwd', '$each', '$pop', '$<<', '$raise', '$respond_to?', '$to_path', '$class', '$nil?', '$is_a?', '$basename', '$empty?', '$rindex', '$[]', '$+', '$-', '$length', '$gsub', '$find', '$=~']); return (function($base, $super) { function $File(){}; var self = $File = $klass($base, $super, 'File', $File); var def = self.$$proto, $scope = self.$$scope; Opal.cdecl($scope, 'Separator', Opal.cdecl($scope, 'SEPARATOR', "/")); Opal.cdecl($scope, 'ALT_SEPARATOR', nil); Opal.cdecl($scope, 'PATH_SEPARATOR', ":"); Opal.cdecl($scope, 'FNM_SYSCASE', 0); return (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_8, TMP_9, TMP_10; Opal.defn(self, '$expand_path', TMP_2 = function $$expand_path(path, basedir) { var $a, $b, TMP_1, self = this, parts = nil, new_parts = nil; if (basedir == null) { basedir = nil; } path = [basedir, path].$compact().$join($scope.get('SEPARATOR')); parts = path.$split($scope.get('SEPARATOR')); new_parts = []; if (parts.$first()['$==']("~")) { parts['$[]='](0, $scope.get('Dir').$home())}; if (parts.$first()['$=='](".")) { parts['$[]='](0, $scope.get('Dir').$pwd())}; ($a = ($b = parts).$each, $a.$$p = (TMP_1 = function(part){var self = TMP_1.$$s || this; if (part == null) part = nil; if (part['$==']("..")) { return new_parts.$pop() } else { return new_parts['$<<'](part) }}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); return new_parts.$join($scope.get('SEPARATOR')); }, TMP_2.$$arity = -2); Opal.alias(self, 'realpath', 'expand_path'); function chompdirsep(path) { var last; while (path.length > 0) { if (isDirSep(path)) { last = path; path = path.substring(1, path.length); while (path.length > 0 && isDirSep(path)) { path = inc(path); } if (path.length == 0) { return last; } } else { path = inc(path); } } return path; } function inc(a) { return a.substring(1, a.length); } function skipprefix(path) { return path; } function lastSeparator(path) { var tmp, last; while (path.length > 0) { if (isDirSep(path)) { tmp = path; path = inc(path); while (path.length > 0 && isDirSep(path)) { path = inc(path); } if (!path) { break; } last = tmp; } else { path = inc(path); } } return last; } function isDirSep(sep) { return sep.charAt(0) === $scope.get('SEPARATOR'); } function skipRoot(path) { while (path.length > 0 && isDirSep(path)) { path = inc(path); } return path; } function pointerSubtract(a, b) { if (a.length == 0) { return b.length; } return b.indexOf(a); } function handleSuffix(n, f, p, suffix, name, origName) { var suffixMatch; if (n >= 0) { if (suffix === nil) { f = n; } else { suffixMatch = suffix === '.*' ? '\\.\\w+' : suffix.replace(/\?/g, '\\?'); suffixMatch = new RegExp(suffixMatch + $scope.get('Separator') + '*$').exec(p); if (suffixMatch) { f = suffixMatch.index; } else { f = n; } } if (f === origName.length) { return name; } } return p.substring(0, f); } Opal.defn(self, '$dirname', TMP_3 = function $$dirname(path) { var self = this; if (path === nil) { self.$raise($scope.get('TypeError'), "no implicit conversion of nil into String") } if (path['$respond_to?']("to_path")) { path = path.$to_path(); } if (!path.$$is_string) { self.$raise($scope.get('TypeError'), "no implicit conversion of " + (path.$class()) + " into String") } var root, p; root = skipRoot(path); // if (root > name + 1) in the C code if (root.length == 0) { path = path.substring(path.length - 1, path.length); } else if (root.length - path.length < 0) { path = path.substring(path.indexOf(root)-1, path.length); } p = lastSeparator(root); if (!p) { p = root; } if (p === path) { return '.'; } return path.substring(0, path.length - p.length); ; }, TMP_3.$$arity = 1); Opal.defn(self, '$basename', TMP_4 = function $$basename(name, suffix) { var self = this; if (suffix == null) { suffix = nil; } var p, q, e, f = 0, n = -1, tmp, pointerMath, origName; if (name === nil) { self.$raise($scope.get('TypeError'), "no implicit conversion of nil into String") } if (name['$respond_to?']("to_path")) { name = name.$to_path(); } if (!name.$$is_string) { self.$raise($scope.get('TypeError'), "no implicit conversion of " + (name.$class()) + " into String") } if (suffix !== nil && !suffix.$$is_string) { self.$raise($scope.get('TypeError'), "no implicit conversion of " + (suffix.$class()) + " into String") } if (name.length == 0) { return name; } origName = name; name = skipprefix(name); while (isDirSep(name)) { tmp = name; name = inc(name); } if (!name) { p = tmp; f = 1; } else { if (!(p = lastSeparator(name))) { p = name; } else { while (isDirSep(p)) { p = inc(p); } } n = pointerSubtract(chompdirsep(p), p); for (q = p; pointerSubtract(q, p) < n && q.charAt(0) === '.'; q = inc(q)) { } for (e = null; pointerSubtract(q, p) < n; q = inc(q)) { if (q.charAt(0) === '.') { e = q; } } if (e) { f = pointerSubtract(e, p); } else { f = n; } } return handleSuffix(n, f, p, suffix, name, origName); ; }, TMP_4.$$arity = -2); Opal.defn(self, '$extname', TMP_5 = function $$extname(path) { var $a, $b, self = this, filename = nil, last_dot_idx = nil; if ((($a = path['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('TypeError'), "no implicit conversion of nil into String")}; if ((($a = path['$respond_to?']("to_path")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { path = path.$to_path()}; if ((($a = path['$is_a?']($scope.get('String'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('TypeError'), "no implicit conversion of " + (path.$class()) + " into String") }; filename = self.$basename(path); if ((($a = filename['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ""}; last_dot_idx = filename['$[]']($range(1, -1, false)).$rindex("."); if ((($a = (((($b = last_dot_idx['$nil?']()) !== false && $b !== nil && $b != null) ? $b : $rb_plus(last_dot_idx, 1)['$==']($rb_minus(filename.$length(), 1))))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "" } else { return filename['$[]']($range(($rb_plus(last_dot_idx, 1)), -1, false)) }; }, TMP_5.$$arity = 1); Opal.defn(self, '$exist?', TMP_6 = function(path) { var self = this; return Opal.modules[path] != null; }, TMP_6.$$arity = 1); Opal.alias(self, 'exists?', 'exist?'); Opal.defn(self, '$directory?', TMP_8 = function(path) { var $a, $b, TMP_7, self = this, files = nil, file = nil; files = []; for (var key in Opal.modules) { files.push(key) } ; path = path.$gsub((new RegExp("(^." + $scope.get('SEPARATOR') + "+|" + $scope.get('SEPARATOR') + "+$)"))); file = ($a = ($b = files).$find, $a.$$p = (TMP_7 = function(file){var self = TMP_7.$$s || this; if (file == null) file = nil; return file['$=~']((new RegExp("^" + path)))}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $a).call($b); return file; }, TMP_8.$$arity = 1); Opal.defn(self, '$join', TMP_9 = function $$join($a_rest) { var self = this, paths; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } paths = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { paths[$arg_idx - 0] = arguments[$arg_idx]; } return paths.$join($scope.get('SEPARATOR')).$gsub((new RegExp("" + $scope.get('SEPARATOR') + "+")), $scope.get('SEPARATOR')); }, TMP_9.$$arity = -1); return (Opal.defn(self, '$split', TMP_10 = function $$split(path) { var self = this; return path.$split($scope.get('SEPARATOR')); }, TMP_10.$$arity = 1), nil) && 'split'; })(Opal.get_singleton_class(self)); })($scope.base, $scope.get('IO')) }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/process"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$to_f', '$now', '$new']); (function($base, $super) { function $Process(){}; var self = $Process = $klass($base, $super, 'Process', $Process); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3; Opal.cdecl($scope, 'CLOCK_REALTIME', 0); Opal.cdecl($scope, 'CLOCK_MONOTONIC', 1); Opal.defs(self, '$pid', TMP_1 = function $$pid() { var self = this; return 0; }, TMP_1.$$arity = 0); Opal.defs(self, '$times', TMP_2 = function $$times() { var self = this, t = nil; t = $scope.get('Time').$now().$to_f(); return (($scope.get('Benchmark')).$$scope.get('Tms')).$new(t, t, t, t, t); }, TMP_2.$$arity = 0); return (Opal.defs(self, '$clock_gettime', TMP_3 = function $$clock_gettime(clock_id, unit) { var self = this; if (unit == null) { unit = nil; } return $scope.get('Time').$now().$to_f(); }, TMP_3.$$arity = -2), nil) && 'clock_gettime'; })($scope.base, null); (function($base, $super) { function $Signal(){}; var self = $Signal = $klass($base, $super, 'Signal', $Signal); var def = self.$$proto, $scope = self.$$scope, TMP_4; return (Opal.defs(self, '$trap', TMP_4 = function $$trap($a_rest) { var self = this; return nil; }, TMP_4.$$arity = -1), nil) && 'trap' })($scope.base, null); return (function($base, $super) { function $GC(){}; var self = $GC = $klass($base, $super, 'GC', $GC); var def = self.$$proto, $scope = self.$$scope, TMP_5; return (Opal.defs(self, '$start', TMP_5 = function $$start() { var self = this; return nil; }, TMP_5.$$arity = 0), nil) && 'start' })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["corelib/unsupported"] = function(Opal) { var TMP_30, TMP_31, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module; Opal.add_stubs(['$raise', '$warn', '$%']); var warnings = {}; function handle_unsupported_feature(message) { switch (Opal.config.unsupported_features_severity) { case 'error': $scope.get('Kernel').$raise($scope.get('NotImplementedError'), message) break; case 'warning': warn(message) break; default: // ignore // noop } } function warn(string) { if (warnings[string]) { return; } warnings[string] = true; self.$warn(string); } (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18; var ERROR = "String#%s not supported. Mutable String methods are not supported in Opal."; Opal.defn(self, '$<<', TMP_1 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("<<")); }, TMP_1.$$arity = -1); Opal.defn(self, '$capitalize!', TMP_2 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("capitalize!")); }, TMP_2.$$arity = -1); Opal.defn(self, '$chomp!', TMP_3 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("chomp!")); }, TMP_3.$$arity = -1); Opal.defn(self, '$chop!', TMP_4 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("chop!")); }, TMP_4.$$arity = -1); Opal.defn(self, '$downcase!', TMP_5 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("downcase!")); }, TMP_5.$$arity = -1); Opal.defn(self, '$gsub!', TMP_6 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("gsub!")); }, TMP_6.$$arity = -1); Opal.defn(self, '$lstrip!', TMP_7 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("lstrip!")); }, TMP_7.$$arity = -1); Opal.defn(self, '$next!', TMP_8 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("next!")); }, TMP_8.$$arity = -1); Opal.defn(self, '$reverse!', TMP_9 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("reverse!")); }, TMP_9.$$arity = -1); Opal.defn(self, '$slice!', TMP_10 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("slice!")); }, TMP_10.$$arity = -1); Opal.defn(self, '$squeeze!', TMP_11 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("squeeze!")); }, TMP_11.$$arity = -1); Opal.defn(self, '$strip!', TMP_12 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("strip!")); }, TMP_12.$$arity = -1); Opal.defn(self, '$sub!', TMP_13 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("sub!")); }, TMP_13.$$arity = -1); Opal.defn(self, '$succ!', TMP_14 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("succ!")); }, TMP_14.$$arity = -1); Opal.defn(self, '$swapcase!', TMP_15 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("swapcase!")); }, TMP_15.$$arity = -1); Opal.defn(self, '$tr!', TMP_16 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("tr!")); }, TMP_16.$$arity = -1); Opal.defn(self, '$tr_s!', TMP_17 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("tr_s!")); }, TMP_17.$$arity = -1); return (Opal.defn(self, '$upcase!', TMP_18 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), (ERROR)['$%']("upcase!")); }, TMP_18.$$arity = -1), nil) && 'upcase!'; })($scope.base, null); (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_19, TMP_20; var ERROR = "Object freezing is not supported by Opal"; Opal.defn(self, '$freeze', TMP_19 = function $$freeze() { var self = this; handle_unsupported_feature(ERROR); return self; }, TMP_19.$$arity = 0); Opal.defn(self, '$frozen?', TMP_20 = function() { var self = this; handle_unsupported_feature(ERROR); return false; }, TMP_20.$$arity = 0); })($scope.base); (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_21, TMP_22, TMP_23; var ERROR = "Object tainting is not supported by Opal"; Opal.defn(self, '$taint', TMP_21 = function $$taint() { var self = this; handle_unsupported_feature(ERROR); return self; }, TMP_21.$$arity = 0); Opal.defn(self, '$untaint', TMP_22 = function $$untaint() { var self = this; handle_unsupported_feature(ERROR); return self; }, TMP_22.$$arity = 0); Opal.defn(self, '$tainted?', TMP_23 = function() { var self = this; handle_unsupported_feature(ERROR); return false; }, TMP_23.$$arity = 0); })($scope.base); (function($base, $super) { function $Module(){}; var self = $Module = $klass($base, $super, 'Module', $Module); var def = self.$$proto, $scope = self.$$scope, TMP_24, TMP_25, TMP_26, TMP_27; Opal.defn(self, '$public', TMP_24 = function($a_rest) { var self = this, methods; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } methods = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { methods[$arg_idx - 0] = arguments[$arg_idx]; } if (methods.length === 0) { self.$$module_function = false; } return nil; }, TMP_24.$$arity = -1); Opal.alias(self, 'private', 'public'); Opal.alias(self, 'protected', 'public'); Opal.alias(self, 'nesting', 'public'); Opal.defn(self, '$private_class_method', TMP_25 = function $$private_class_method($a_rest) { var self = this; return self; }, TMP_25.$$arity = -1); Opal.alias(self, 'public_class_method', 'private_class_method'); Opal.defn(self, '$private_method_defined?', TMP_26 = function(obj) { var self = this; return false; }, TMP_26.$$arity = 1); Opal.defn(self, '$private_constant', TMP_27 = function $$private_constant($a_rest) { var self = this; return nil; }, TMP_27.$$arity = -1); Opal.alias(self, 'protected_method_defined?', 'private_method_defined?'); Opal.alias(self, 'public_instance_methods', 'instance_methods'); return Opal.alias(self, 'public_method_defined?', 'method_defined?'); })($scope.base, null); (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_28; Opal.defn(self, '$private_methods', TMP_28 = function $$private_methods($a_rest) { var self = this; return []; }, TMP_28.$$arity = -1); Opal.alias(self, 'private_instance_methods', 'private_methods'); })($scope.base); (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_29; Opal.defn(self, '$eval', TMP_29 = function($a_rest) { var self = this; return self.$raise($scope.get('NotImplementedError'), "To use Kernel#eval, you must first require 'opal-parser'. " + ("See https://github.com/opal/opal/blob/" + ($scope.get('RUBY_ENGINE_VERSION')) + "/docs/opal_parser.md for details.")); }, TMP_29.$$arity = -1) })($scope.base); Opal.defs(self, '$public', TMP_30 = function($a_rest) { var self = this; return nil; }, TMP_30.$$arity = -1); return (Opal.defs(self, '$private', TMP_31 = function($a_rest) { var self = this; return nil; }, TMP_31.$$arity = -1), nil) && 'private'; }; /* Generated by Opal 0.10.4 */ Opal.modules["opal"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); self.$require("opal/base"); self.$require("opal/mini"); self.$require("corelib/string/inheritance"); self.$require("corelib/string/encoding"); self.$require("corelib/math"); self.$require("corelib/complex"); self.$require("corelib/rational"); self.$require("corelib/time"); self.$require("corelib/struct"); self.$require("corelib/io"); self.$require("corelib/main"); self.$require("corelib/dir"); self.$require("corelib/file"); self.$require("corelib/process"); return self.$require("corelib/unsupported"); }; /* Generated by Opal 0.10.4 */ Opal.modules["browser/interval"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $gvars = Opal.gvars; Opal.add_stubs(['$attr_reader', '$convert', '$nil?', '$stopped?', '$aborted?', '$raise', '$call', '$tap', '$to_proc', '$new', '$every', '$every!']); (function($base) { var $Browser, self = $Browser = $module($base, 'Browser'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Interval(){}; var self = $Interval = $klass($base, $super, 'Interval', $Interval); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7; def.id = def.aborted = def.window = def.block = def.every = nil; self.$attr_reader("every"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(window, time) { var self = this, $iter = TMP_1.$$p, block = $iter || nil; TMP_1.$$p = null; self.window = $scope.get('Native').$convert(window); self.every = time; self.block = block; return self.aborted = false; }, TMP_1.$$arity = 2); Opal.defn(self, '$stopped?', TMP_2 = function() { var self = this; return self.id['$nil?'](); }, TMP_2.$$arity = 0); Opal.defn(self, '$aborted?', TMP_3 = function() { var self = this; return self.aborted; }, TMP_3.$$arity = 0); Opal.defn(self, '$abort', TMP_4 = function $$abort() { var self = this; self.window.clearInterval(self.id); self.aborted = true; return self.id = nil; }, TMP_4.$$arity = 0); Opal.defn(self, '$stop', TMP_5 = function $$stop() { var $a, self = this; if ((($a = self['$stopped?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; self.window.clearInterval(self.id); self.stopped = true; return self.id = nil; }, TMP_5.$$arity = 0); Opal.defn(self, '$start', TMP_6 = function $$start() { var $a, self = this; if ((($a = self['$aborted?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise("the interval has been aborted")}; if ((($a = self['$stopped?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; return self.id = self.window.setInterval(self.block, self.every * 1000); }, TMP_6.$$arity = 0); return (Opal.defn(self, '$call', TMP_7 = function $$call() { var self = this; return self.block.$call(); }, TMP_7.$$arity = 0), nil) && 'call'; })($scope.base, null); (function($base, $super) { function $Window(){}; var self = $Window = $klass($base, $super, 'Window', $Window); var def = self.$$proto, $scope = self.$$scope, TMP_8, TMP_9; def["native"] = nil; Opal.defn(self, '$every', TMP_8 = function $$every(time) { var $a, $b, $c, $d, self = this, $iter = TMP_8.$$p, block = $iter || nil; TMP_8.$$p = null; return ($a = ($b = ($c = ($d = $scope.get('Interval')).$new, $c.$$p = block.$to_proc(), $c).call($d, self["native"], time)).$tap, $a.$$p = "start".$to_proc(), $a).call($b); }, TMP_8.$$arity = 1); return (Opal.defn(self, '$every!', TMP_9 = function(time) { var $a, $b, self = this, $iter = TMP_9.$$p, block = $iter || nil; TMP_9.$$p = null; return ($a = ($b = $scope.get('Interval')).$new, $a.$$p = block.$to_proc(), $a).call($b, self["native"], time); }, TMP_9.$$arity = 1), nil) && 'every!'; })($scope.base, null); })($scope.base); (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_10, TMP_11; Opal.defn(self, '$every', TMP_10 = function $$every(time) { var $a, $b, self = this, $iter = TMP_10.$$p, block = $iter || nil; if ($gvars.window == null) $gvars.window = nil; TMP_10.$$p = null; return ($a = ($b = $gvars.window).$every, $a.$$p = block.$to_proc(), $a).call($b, time); }, TMP_10.$$arity = 1); Opal.defn(self, '$every!', TMP_11 = function(time) { var $a, $b, self = this, $iter = TMP_11.$$p, block = $iter || nil; if ($gvars.window == null) $gvars.window = nil; TMP_11.$$p = null; return ($a = ($b = $gvars.window)['$every!'], $a.$$p = block.$to_proc(), $a).call($b, time); }, TMP_11.$$arity = 1); })($scope.base); return (function($base, $super) { function $Proc(){}; var self = $Proc = $klass($base, $super, 'Proc', $Proc); var def = self.$$proto, $scope = self.$$scope, TMP_12, TMP_13; Opal.defn(self, '$every', TMP_12 = function $$every(time) { var $a, $b, self = this; if ($gvars.window == null) $gvars.window = nil; return ($a = ($b = $gvars.window).$every, $a.$$p = self.$to_proc(), $a).call($b, time); }, TMP_12.$$arity = 1); return (Opal.defn(self, '$every!', TMP_13 = function(time) { var $a, $b, self = this; if ($gvars.window == null) $gvars.window = nil; return ($a = ($b = $gvars.window)['$every!'], $a.$$p = self.$to_proc(), $a).call($b, time); }, TMP_13.$$arity = 1), nil) && 'every!'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["browser/delay"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $gvars = Opal.gvars; Opal.add_stubs(['$attr_reader', '$convert', '$to_n', '$tap', '$to_proc', '$new', '$after', '$after!']); (function($base) { var $Browser, self = $Browser = $module($base, 'Browser'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Delay(){}; var self = $Delay = $klass($base, $super, 'Delay', $Delay); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3; def.window = def.id = def.block = def.after = nil; self.$attr_reader("after"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(window, time) { var self = this, $iter = TMP_1.$$p, block = $iter || nil; TMP_1.$$p = null; self.window = $scope.get('Native').$convert(window); self.after = time; return self.block = block; }, TMP_1.$$arity = 2); Opal.defn(self, '$abort', TMP_2 = function $$abort() { var self = this; return self.window.clearTimeout(self.id); }, TMP_2.$$arity = 0); return (Opal.defn(self, '$start', TMP_3 = function $$start() { var self = this; return self.id = self.window.setTimeout(self.block.$to_n(), self.after * 1000); }, TMP_3.$$arity = 0), nil) && 'start'; })($scope.base, null); (function($base, $super) { function $Window(){}; var self = $Window = $klass($base, $super, 'Window', $Window); var def = self.$$proto, $scope = self.$$scope, TMP_4, TMP_5; def["native"] = nil; Opal.defn(self, '$after', TMP_4 = function $$after(time) { var $a, $b, $c, $d, self = this, $iter = TMP_4.$$p, block = $iter || nil; TMP_4.$$p = null; return ($a = ($b = ($c = ($d = $scope.get('Delay')).$new, $c.$$p = block.$to_proc(), $c).call($d, self["native"], time)).$tap, $a.$$p = "start".$to_proc(), $a).call($b); }, TMP_4.$$arity = 1); return (Opal.defn(self, '$after!', TMP_5 = function(time) { var $a, $b, self = this, $iter = TMP_5.$$p, block = $iter || nil; TMP_5.$$p = null; return ($a = ($b = $scope.get('Delay')).$new, $a.$$p = block.$to_proc(), $a).call($b, self["native"], time); }, TMP_5.$$arity = 1), nil) && 'after!'; })($scope.base, null); })($scope.base); (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_6, TMP_7; Opal.defn(self, '$after', TMP_6 = function $$after(time) { var $a, $b, self = this, $iter = TMP_6.$$p, block = $iter || nil; if ($gvars.window == null) $gvars.window = nil; TMP_6.$$p = null; return ($a = ($b = $gvars.window).$after, $a.$$p = block.$to_proc(), $a).call($b, time); }, TMP_6.$$arity = 1); Opal.defn(self, '$after!', TMP_7 = function(time) { var $a, $b, self = this, $iter = TMP_7.$$p, block = $iter || nil; if ($gvars.window == null) $gvars.window = nil; TMP_7.$$p = null; return ($a = ($b = $gvars.window)['$after!'], $a.$$p = block.$to_proc(), $a).call($b, time); }, TMP_7.$$arity = 1); })($scope.base); return (function($base, $super) { function $Proc(){}; var self = $Proc = $klass($base, $super, 'Proc', $Proc); var def = self.$$proto, $scope = self.$$scope, TMP_8, TMP_9; Opal.defn(self, '$after', TMP_8 = function $$after(time) { var $a, $b, self = this; if ($gvars.window == null) $gvars.window = nil; return ($a = ($b = $gvars.window).$after, $a.$$p = self.$to_proc(), $a).call($b, time); }, TMP_8.$$arity = 1); return (Opal.defn(self, '$after!', TMP_9 = function(time) { var $a, $b, self = this; if ($gvars.window == null) $gvars.window = nil; return ($a = ($b = $gvars.window)['$after!'], $a.$$p = self.$to_proc(), $a).call($b, time); }, TMP_9.$$arity = 1), nil) && 'after!'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["native"] = function(Opal) { function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_ge(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $range = Opal.range, $hash2 = Opal.hash2, $klass = Opal.klass, $gvars = Opal.gvars; Opal.add_stubs(['$try_convert', '$native?', '$respond_to?', '$to_n', '$raise', '$inspect', '$Native', '$proc', '$map!', '$end_with?', '$define_method', '$[]', '$convert', '$call', '$to_proc', '$new', '$each', '$native_reader', '$native_writer', '$extend', '$is_a?', '$map', '$alias_method', '$to_a', '$_Array', '$include', '$method_missing', '$bind', '$instance_method', '$[]=', '$slice', '$-', '$length', '$enum_for', '$===', '$>=', '$<<', '$each_pair', '$_initialize', '$name', '$exiting_mid', '$native_module']); (function($base) { var $Native, self = $Native = $module($base, 'Native'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_19, TMP_20, TMP_21; Opal.defs(self, '$is_a?', TMP_1 = function(object, klass) { var self = this; try { return object instanceof self.$try_convert(klass); } catch (e) { return false; } ; }, TMP_1.$$arity = 2); Opal.defs(self, '$try_convert', TMP_2 = function $$try_convert(value, default$) { var self = this; if (default$ == null) { default$ = nil; } if (self['$native?'](value)) { return value; } else if (value['$respond_to?']("to_n")) { return value.$to_n(); } else { return default$; } ; }, TMP_2.$$arity = -2); Opal.defs(self, '$convert', TMP_3 = function $$convert(value) { var self = this; if (self['$native?'](value)) { return value; } else if (value['$respond_to?']("to_n")) { return value.$to_n(); } else { self.$raise($scope.get('ArgumentError'), "" + (value.$inspect()) + " isn't native"); } ; }, TMP_3.$$arity = 1); Opal.defs(self, '$call', TMP_4 = function $$call(obj, key, $a_rest) { var self = this, args, $iter = TMP_4.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 2; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 2; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 2] = arguments[$arg_idx]; } TMP_4.$$p = null; var prop = obj[key]; if (prop instanceof Function) { var converted = new Array(args.length); for (var i = 0, l = args.length; i < l; i++) { var item = args[i], conv = self.$try_convert(item); converted[i] = conv === nil ? item : conv; } if (block !== nil) { converted.push(block); } return self.$Native(prop.apply(obj, converted)); } else { return self.$Native(prop); } ; }, TMP_4.$$arity = -3); Opal.defs(self, '$proc', TMP_5 = function $$proc() { var $a, $b, TMP_6, self = this, $iter = TMP_5.$$p, block = $iter || nil; TMP_5.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('LocalJumpError'), "no block given") }; return ($a = ($b = $scope.get('Kernel')).$proc, $a.$$p = (TMP_6 = function($c_rest){var self = TMP_6.$$s || this, args, $d, $e, TMP_7, instance = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } ($d = ($e = args)['$map!'], $d.$$p = (TMP_7 = function(arg){var self = TMP_7.$$s || this; if (arg == null) arg = nil; return self.$Native(arg)}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $d).call($e); instance = self.$Native(this); // if global is current scope, run the block in the scope it was defined if (this === Opal.global) { return block.apply(self, args); } var self_ = block.$$s; block.$$s = null; try { return block.apply(instance, args); } finally { block.$$s = self_; } ;}, TMP_6.$$s = self, TMP_6.$$arity = -1, TMP_6), $a).call($b); }, TMP_5.$$arity = 0); (function($base) { var $Helpers, self = $Helpers = $module($base, 'Helpers'); var def = self.$$proto, $scope = self.$$scope, TMP_11, TMP_14, TMP_17, TMP_18; Opal.defn(self, '$alias_native', TMP_11 = function $$alias_native(new$, $old, $kwargs) { var $a, $b, TMP_8, $c, TMP_9, $d, TMP_10, self = this, $post_args, as, old; $post_args = Opal.slice.call(arguments, 1, arguments.length); $kwargs = Opal.extract_kwargs($post_args); if ($kwargs == null || !$kwargs.$$is_hash) { if ($kwargs == null) { $kwargs = $hash2([], {}); } else { throw Opal.ArgumentError.$new('expected kwargs'); } } if ((as = $kwargs.$$smap['as']) == null) { as = nil } if (0 < $post_args.length) { old = $post_args.splice(0,1)[0]; } if (old == null) { old = new$; } if ((($a = old['$end_with?']("=")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self).$define_method, $a.$$p = (TMP_8 = function(value){var self = TMP_8.$$s || this; if (self["native"] == null) self["native"] = nil; if (value == null) value = nil; self["native"][old['$[]']($range(0, -2, false))] = $scope.get('Native').$convert(value); return value;}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8), $a).call($b, new$) } else if (as !== false && as !== nil && as != null) { return ($a = ($c = self).$define_method, $a.$$p = (TMP_9 = function($d_rest){var self = TMP_9.$$s || this, block, args, $e, $f, $g, value = nil; if (self["native"] == null) self["native"] = nil; block = TMP_9.$$p || nil, TMP_9.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($e = value = ($f = ($g = $scope.get('Native')).$call, $f.$$p = block.$to_proc(), $f).apply($g, [self["native"], old].concat(Opal.to_a(args)))) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { return as.$new(value.$to_n()) } else { return nil }}, TMP_9.$$s = self, TMP_9.$$arity = -1, TMP_9), $a).call($c, new$) } else { return ($a = ($d = self).$define_method, $a.$$p = (TMP_10 = function($e_rest){var self = TMP_10.$$s || this, block, args, $f, $g; if (self["native"] == null) self["native"] = nil; block = TMP_10.$$p || nil, TMP_10.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($f = ($g = $scope.get('Native')).$call, $f.$$p = block.$to_proc(), $f).apply($g, [self["native"], old].concat(Opal.to_a(args)))}, TMP_10.$$s = self, TMP_10.$$arity = -1, TMP_10), $a).call($d, new$) }; }, TMP_11.$$arity = -2); Opal.defn(self, '$native_reader', TMP_14 = function $$native_reader($a_rest) { var $b, $c, TMP_12, self = this, names; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } names = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { names[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = ($c = names).$each, $b.$$p = (TMP_12 = function(name){var self = TMP_12.$$s || this, $a, $d, TMP_13; if (name == null) name = nil; return ($a = ($d = self).$define_method, $a.$$p = (TMP_13 = function(){var self = TMP_13.$$s || this; if (self["native"] == null) self["native"] = nil; return self.$Native(self["native"][name])}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13), $a).call($d, name)}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12), $b).call($c); }, TMP_14.$$arity = -1); Opal.defn(self, '$native_writer', TMP_17 = function $$native_writer($a_rest) { var $b, $c, TMP_15, self = this, names; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } names = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { names[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = ($c = names).$each, $b.$$p = (TMP_15 = function(name){var self = TMP_15.$$s || this, $a, $d, TMP_16; if (name == null) name = nil; return ($a = ($d = self).$define_method, $a.$$p = (TMP_16 = function(value){var self = TMP_16.$$s || this; if (self["native"] == null) self["native"] = nil; if (value == null) value = nil; return self.$Native(self["native"][name] = value)}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16), $a).call($d, "" + (name) + "=")}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15), $b).call($c); }, TMP_17.$$arity = -1); Opal.defn(self, '$native_accessor', TMP_18 = function $$native_accessor($a_rest) { var $b, $c, self = this, names; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } names = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { names[$arg_idx - 0] = arguments[$arg_idx]; } ($b = self).$native_reader.apply($b, Opal.to_a(names)); return ($c = self).$native_writer.apply($c, Opal.to_a(names)); }, TMP_18.$$arity = -1); })($scope.base); Opal.defs(self, '$included', TMP_19 = function $$included(klass) { var self = this; return klass.$extend($scope.get('Helpers')); }, TMP_19.$$arity = 1); Opal.defn(self, '$initialize', TMP_20 = function $$initialize(native$) { var $a, self = this; if ((($a = $scope.get('Kernel')['$native?'](native$)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { $scope.get('Kernel').$raise($scope.get('ArgumentError'), "" + (native$.$inspect()) + " isn't native") }; return self["native"] = native$; }, TMP_20.$$arity = 1); Opal.defn(self, '$to_n', TMP_21 = function $$to_n() { var self = this; if (self["native"] == null) self["native"] = nil; return self["native"]; }, TMP_21.$$arity = 0); })($scope.base); (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_22, TMP_25, TMP_26; Opal.defn(self, '$native?', TMP_22 = function(value) { var self = this; return value == null || !value.$$class; }, TMP_22.$$arity = 1); Opal.defn(self, '$Native', TMP_25 = function $$Native(obj) { var $a, $b, TMP_23, $c, TMP_24, self = this; if ((($a = obj == null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else if ((($a = self['$native?'](obj)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($scope.get('Native')).$$scope.get('Object')).$new(obj) } else if ((($a = obj['$is_a?']($scope.get('Array'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = obj).$map, $a.$$p = (TMP_23 = function(o){var self = TMP_23.$$s || this; if (o == null) o = nil; return self.$Native(o)}, TMP_23.$$s = self, TMP_23.$$arity = 1, TMP_23), $a).call($b) } else if ((($a = obj['$is_a?']($scope.get('Proc'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($c = self).$proc, $a.$$p = (TMP_24 = function($d_rest){var self = TMP_24.$$s || this, block, args, $e, $f; block = TMP_24.$$p || nil, TMP_24.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return self.$Native(($e = ($f = obj).$call, $e.$$p = block.$to_proc(), $e).apply($f, Opal.to_a(args)))}, TMP_24.$$s = self, TMP_24.$$arity = -1, TMP_24), $a).call($c) } else { return obj }; }, TMP_25.$$arity = 1); self.$alias_method("_Array", "Array"); Opal.defn(self, '$Array', TMP_26 = function $$Array(object, $a_rest) { var $b, $c, self = this, args, $iter = TMP_26.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_26.$$p = null; if ((($b = self['$native?'](object)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return ($b = ($c = (($scope.get('Native')).$$scope.get('Array'))).$new, $b.$$p = block.$to_proc(), $b).apply($c, [object].concat(Opal.to_a(args))).$to_a()}; return self.$_Array(object); }, TMP_26.$$arity = -2); })($scope.base); (function($base, $super) { function $Object(){}; var self = $Object = $klass($base, $super, 'Object', $Object); var def = self.$$proto, $scope = self.$$scope, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_40, TMP_41; def["native"] = nil; self.$include(Opal.get('Native')); Opal.defn(self, '$==', TMP_27 = function(other) { var self = this; return self["native"] === $scope.get('Native').$try_convert(other); }, TMP_27.$$arity = 1); Opal.defn(self, '$has_key?', TMP_28 = function(name) { var self = this; return Opal.hasOwnProperty.call(self["native"], name); }, TMP_28.$$arity = 1); Opal.alias(self, 'key?', 'has_key?'); Opal.alias(self, 'include?', 'has_key?'); Opal.alias(self, 'member?', 'has_key?'); Opal.defn(self, '$each', TMP_29 = function $$each($a_rest) { var $b, self = this, args, $iter = TMP_29.$$p, $yield = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_29.$$p = null; if (($yield !== nil)) { for (var key in self["native"]) { Opal.yieldX($yield, [key, self["native"][key]]) } ; return self; } else { return ($b = self).$method_missing.apply($b, ["each"].concat(Opal.to_a(args))) }; }, TMP_29.$$arity = -1); Opal.defn(self, '$[]', TMP_30 = function(key) { var self = this; var prop = self["native"][key]; if (prop instanceof Function) { return prop; } else { return Opal.get('Native').$call(self["native"], key) } ; }, TMP_30.$$arity = 1); Opal.defn(self, '$[]=', TMP_31 = function(key, value) { var $a, self = this, native$ = nil; native$ = $scope.get('Native').$try_convert(value); if ((($a = native$ === nil) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self["native"][key] = value; } else { return self["native"][key] = native$; }; }, TMP_31.$$arity = 2); Opal.defn(self, '$merge!', TMP_32 = function(other) { var self = this; other = $scope.get('Native').$convert(other); for (var prop in other) { self["native"][prop] = other[prop]; } ; return self; }, TMP_32.$$arity = 1); Opal.defn(self, '$respond_to?', TMP_33 = function(name, include_all) { var self = this; if (include_all == null) { include_all = false; } return $scope.get('Kernel').$instance_method("respond_to?").$bind(self).$call(name, include_all); }, TMP_33.$$arity = -2); Opal.defn(self, '$respond_to_missing?', TMP_34 = function(name, include_all) { var self = this; if (include_all == null) { include_all = false; } return Opal.hasOwnProperty.call(self["native"], name); }, TMP_34.$$arity = -2); Opal.defn(self, '$method_missing', TMP_35 = function $$method_missing(mid, $a_rest) { var $b, $c, self = this, args, $iter = TMP_35.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_35.$$p = null; if (mid.charAt(mid.length - 1) === '=') { return self['$[]='](mid.$slice(0, $rb_minus(mid.$length(), 1)), args['$[]'](0)); } else { return ($b = ($c = Opal.get('Native')).$call, $b.$$p = block.$to_proc(), $b).apply($c, [self["native"], mid].concat(Opal.to_a(args))); } ; }, TMP_35.$$arity = -2); Opal.defn(self, '$nil?', TMP_36 = function() { var self = this; return false; }, TMP_36.$$arity = 0); Opal.defn(self, '$is_a?', TMP_37 = function(klass) { var self = this; return Opal.is_a(self, klass); }, TMP_37.$$arity = 1); Opal.alias(self, 'kind_of?', 'is_a?'); Opal.defn(self, '$instance_of?', TMP_38 = function(klass) { var self = this; return self.$$class === klass; }, TMP_38.$$arity = 1); Opal.defn(self, '$class', TMP_39 = function() { var self = this; return self.$$class; }, TMP_39.$$arity = 0); Opal.defn(self, '$to_a', TMP_40 = function $$to_a(options) { var $a, $b, self = this, $iter = TMP_40.$$p, block = $iter || nil; if (options == null) { options = $hash2([], {}); } TMP_40.$$p = null; return ($a = ($b = (($scope.get('Native')).$$scope.get('Array'))).$new, $a.$$p = block.$to_proc(), $a).call($b, self["native"], options).$to_a(); }, TMP_40.$$arity = -1); return (Opal.defn(self, '$inspect', TMP_41 = function $$inspect() { var self = this; return "#"; }, TMP_41.$$arity = 0), nil) && 'inspect'; })($scope.get('Native'), $scope.get('BasicObject')); (function($base, $super) { function $Array(){}; var self = $Array = $klass($base, $super, 'Array', $Array); var def = self.$$proto, $scope = self.$$scope, TMP_42, TMP_43, TMP_44, TMP_45, TMP_46, TMP_47, TMP_48; def.named = def["native"] = def.get = def.block = def.set = def.length = nil; self.$include($scope.get('Native')); self.$include($scope.get('Enumerable')); Opal.defn(self, '$initialize', TMP_42 = function $$initialize(native$, options) { var $a, $b, self = this, $iter = TMP_42.$$p, block = $iter || nil; if (options == null) { options = $hash2([], {}); } TMP_42.$$p = null; ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_42, false)), $a.$$p = null, $a).call($b, native$); self.get = ((($a = options['$[]']("get")) !== false && $a !== nil && $a != null) ? $a : options['$[]']("access")); self.named = options['$[]']("named"); self.set = ((($a = options['$[]']("set")) !== false && $a !== nil && $a != null) ? $a : options['$[]']("access")); self.length = ((($a = options['$[]']("length")) !== false && $a !== nil && $a != null) ? $a : "length"); self.block = block; if ((($a = self.$length() == null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise($scope.get('ArgumentError'), "no length found on the array-like object") } else { return nil }; }, TMP_42.$$arity = -2); Opal.defn(self, '$each', TMP_43 = function $$each() { var self = this, $iter = TMP_43.$$p, block = $iter || nil; TMP_43.$$p = null; if (block !== false && block !== nil && block != null) { } else { return self.$enum_for("each") }; for (var i = 0, length = self.$length(); i < length; i++) { Opal.yield1(block, self['$[]'](i)); } ; return self; }, TMP_43.$$arity = 0); Opal.defn(self, '$[]', TMP_44 = function(index) { var $a, self = this, result = nil, $case = nil; result = (function() {$case = index;if ($scope.get('String')['$===']($case) || $scope.get('Symbol')['$===']($case)) {if ((($a = self.named) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self["native"][self.named](index); } else { return self["native"][index]; }}else if ($scope.get('Integer')['$===']($case)) {if ((($a = self.get) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self["native"][self.get](index); } else { return self["native"][index]; }}else { return nil }})(); if (result !== false && result !== nil && result != null) { if ((($a = self.block) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.block.$call(result) } else { return self.$Native(result) } } else { return nil }; }, TMP_44.$$arity = 1); Opal.defn(self, '$[]=', TMP_45 = function(index, value) { var $a, self = this; if ((($a = self.set) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self["native"][self.set](index, $scope.get('Native').$convert(value)); } else { return self["native"][index] = $scope.get('Native').$convert(value); }; }, TMP_45.$$arity = 2); Opal.defn(self, '$last', TMP_46 = function $$last(count) { var $a, $b, self = this, index = nil, result = nil; if (count == null) { count = nil; } if (count !== false && count !== nil && count != null) { index = $rb_minus(self.$length(), 1); result = []; while ((($b = $rb_ge(index, 0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { result['$<<'](self['$[]'](index)); index = $rb_minus(index, 1);}; return result; } else { return self['$[]']($rb_minus(self.$length(), 1)) }; }, TMP_46.$$arity = -1); Opal.defn(self, '$length', TMP_47 = function $$length() { var self = this; return self["native"][self.length]; }, TMP_47.$$arity = 0); Opal.alias(self, 'to_ary', 'to_a'); return (Opal.defn(self, '$inspect', TMP_48 = function $$inspect() { var self = this; return self.$to_a().$inspect(); }, TMP_48.$$arity = 0), nil) && 'inspect'; })($scope.get('Native'), null); (function($base, $super) { function $Numeric(){}; var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); var def = self.$$proto, $scope = self.$$scope, TMP_49; return (Opal.defn(self, '$to_n', TMP_49 = function $$to_n() { var self = this; return self.valueOf(); }, TMP_49.$$arity = 0), nil) && 'to_n' })($scope.base, null); (function($base, $super) { function $Proc(){}; var self = $Proc = $klass($base, $super, 'Proc', $Proc); var def = self.$$proto, $scope = self.$$scope, TMP_50; return (Opal.defn(self, '$to_n', TMP_50 = function $$to_n() { var self = this; return self; }, TMP_50.$$arity = 0), nil) && 'to_n' })($scope.base, null); (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); var def = self.$$proto, $scope = self.$$scope, TMP_51; return (Opal.defn(self, '$to_n', TMP_51 = function $$to_n() { var self = this; return self.valueOf(); }, TMP_51.$$arity = 0), nil) && 'to_n' })($scope.base, null); (function($base, $super) { function $Regexp(){}; var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); var def = self.$$proto, $scope = self.$$scope, TMP_52; return (Opal.defn(self, '$to_n', TMP_52 = function $$to_n() { var self = this; return self.valueOf(); }, TMP_52.$$arity = 0), nil) && 'to_n' })($scope.base, null); (function($base, $super) { function $MatchData(){}; var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); var def = self.$$proto, $scope = self.$$scope, TMP_53; def.matches = nil; return (Opal.defn(self, '$to_n', TMP_53 = function $$to_n() { var self = this; return self.matches; }, TMP_53.$$arity = 0), nil) && 'to_n' })($scope.base, null); (function($base, $super) { function $Struct(){}; var self = $Struct = $klass($base, $super, 'Struct', $Struct); var def = self.$$proto, $scope = self.$$scope, TMP_55; return (Opal.defn(self, '$to_n', TMP_55 = function $$to_n() { var $a, $b, TMP_54, self = this, result = nil; result = {}; ($a = ($b = self).$each_pair, $a.$$p = (TMP_54 = function(name, value){var self = TMP_54.$$s || this; if (name == null) name = nil;if (value == null) value = nil; return result[name] = $scope.get('Native').$try_convert(value, value);}, TMP_54.$$s = self, TMP_54.$$arity = 2, TMP_54), $a).call($b); return result; }, TMP_55.$$arity = 0), nil) && 'to_n' })($scope.base, null); (function($base, $super) { function $Array(){}; var self = $Array = $klass($base, $super, 'Array', $Array); var def = self.$$proto, $scope = self.$$scope, TMP_56; return (Opal.defn(self, '$to_n', TMP_56 = function $$to_n() { var self = this; var result = []; for (var i = 0, length = self.length; i < length; i++) { var obj = self[i]; result.push($scope.get('Native').$try_convert(obj, obj)); } return result; }, TMP_56.$$arity = 0), nil) && 'to_n' })($scope.base, null); (function($base, $super) { function $Boolean(){}; var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean); var def = self.$$proto, $scope = self.$$scope, TMP_57; return (Opal.defn(self, '$to_n', TMP_57 = function $$to_n() { var self = this; return self.valueOf(); }, TMP_57.$$arity = 0), nil) && 'to_n' })($scope.base, null); (function($base, $super) { function $Time(){}; var self = $Time = $klass($base, $super, 'Time', $Time); var def = self.$$proto, $scope = self.$$scope, TMP_58; return (Opal.defn(self, '$to_n', TMP_58 = function $$to_n() { var self = this; return self; }, TMP_58.$$arity = 0), nil) && 'to_n' })($scope.base, null); (function($base, $super) { function $NilClass(){}; var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); var def = self.$$proto, $scope = self.$$scope, TMP_59; return (Opal.defn(self, '$to_n', TMP_59 = function $$to_n() { var self = this; return null; }, TMP_59.$$arity = 0), nil) && 'to_n' })($scope.base, null); (function($base, $super) { function $Hash(){}; var self = $Hash = $klass($base, $super, 'Hash', $Hash); var def = self.$$proto, $scope = self.$$scope, TMP_60, TMP_61; self.$alias_method("_initialize", "initialize"); Opal.defn(self, '$initialize', TMP_60 = function $$initialize(defaults) { var $a, $b, self = this, $iter = TMP_60.$$p, block = $iter || nil; TMP_60.$$p = null; if (defaults != null && defaults.constructor === Object) { var smap = self.$$smap, keys = self.$$keys, key, value; for (key in defaults) { value = defaults[key]; if (value && value.constructor === Object) { smap[key] = $scope.get('Hash').$new(value); } else if (value && value.$$is_array) { value = value.map(function(item) { if (item && item.constructor === Object) { return $scope.get('Hash').$new(item); } return item; }); smap[key] = value } else { smap[key] = self.$Native(value); } keys.push(key); } return self; } return ($a = ($b = self).$_initialize, $a.$$p = block.$to_proc(), $a).call($b, defaults); }, TMP_60.$$arity = -1); return (Opal.defn(self, '$to_n', TMP_61 = function $$to_n() { var self = this; var result = {}, keys = self.$$keys, smap = self.$$smap, key, value; for (var i = 0, length = keys.length; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = smap[key]; } else { key = key.key; value = key.value; } result[key] = $scope.get('Native').$try_convert(value, value); } return result; }, TMP_61.$$arity = 0), nil) && 'to_n'; })($scope.base, null); (function($base, $super) { function $Module(){}; var self = $Module = $klass($base, $super, 'Module', $Module); var def = self.$$proto, $scope = self.$$scope, TMP_62; return (Opal.defn(self, '$native_module', TMP_62 = function $$native_module() { var self = this; return Opal.global[self.$name()] = self; }, TMP_62.$$arity = 0), nil) && 'native_module' })($scope.base, null); (function($base, $super) { function $Class(){}; var self = $Class = $klass($base, $super, 'Class', $Class); var def = self.$$proto, $scope = self.$$scope, TMP_63, TMP_64; Opal.defn(self, '$native_alias', TMP_63 = function $$native_alias(new_jsid, existing_mid) { var self = this; var aliased = self.$$proto['$' + existing_mid]; if (!aliased) { self.$raise($scope.get('NameError').$new("undefined method `" + (existing_mid) + "' for class `" + (self.$inspect()) + "'", self.$exiting_mid())); } self.$$proto[new_jsid] = aliased; ; }, TMP_63.$$arity = 2); return (Opal.defn(self, '$native_class', TMP_64 = function $$native_class() { var self = this; self.$native_module(); self["new"] = self.$new; }, TMP_64.$$arity = 0), nil) && 'native_class'; })($scope.base, null); return $gvars.$ = $gvars.global = self.$Native(Opal.global); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/jquery/constants"] = function(Opal) { var $a, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require', '$raise']); self.$require("native"); if ((($a = ($scope.JQUERY_CLASS != null)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return (function() {if ((($a = !!Opal.global.jQuery) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {return Opal.cdecl($scope, 'JQUERY_CLASS', Opal.cdecl($scope, 'JQUERY_SELECTOR', Opal.global.jQuery))}else if ((($a = !!Opal.global.Zepto) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {Opal.cdecl($scope, 'JQUERY_SELECTOR', Opal.global.Zepto); return Opal.cdecl($scope, 'JQUERY_CLASS', Opal.global.Zepto.zepto.Z);}else {return self.$raise($scope.get('NameError'), "Can't find jQuery or Zepto. jQuery must be included before opal-jquery")}})() }; }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/jquery/element"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$to_n', '$include', '$each', '$alias_native', '$attr_reader', '$nil?', '$[]', '$[]=', '$raise', '$is_a?', '$has_key?', '$delete', '$call', '$gsub', '$upcase', '$compact', '$map', '$respond_to?', '$<<', '$Native', '$new']); self.$require("native"); self.$require("opal/jquery/constants"); return (function($base, $super) { function $Element(){}; var self = $Element = $klass($base, $super, 'Element', $Element); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_41, TMP_42, TMP_43, TMP_44, TMP_45; var $ = $scope.get('JQUERY_SELECTOR').$to_n(); self.$include($scope.get('Enumerable')); Opal.defs(self, '$find', TMP_1 = function $$find(selector) { var self = this; return $(selector); }, TMP_1.$$arity = 1); Opal.defs(self, '$[]', TMP_2 = function(selector) { var self = this; return $(selector); }, TMP_2.$$arity = 1); Opal.defs(self, '$id', TMP_3 = function $$id(id) { var self = this; var el = document.getElementById(id); if (!el) { return nil; } return $(el); }, TMP_3.$$arity = 1); Opal.defs(self, '$new', TMP_4 = function(tag) { var self = this; if (tag == null) { tag = "div"; } return $(document.createElement(tag)); }, TMP_4.$$arity = -1); Opal.defs(self, '$parse', TMP_5 = function $$parse(str) { var self = this; return $.parseHTML ? $($.parseHTML(str)) : $(str); }, TMP_5.$$arity = 1); Opal.defs(self, '$expose', TMP_7 = function $$expose($a_rest) { var $b, $c, TMP_6, self = this, methods; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } methods = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { methods[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = ($c = methods).$each, $b.$$p = (TMP_6 = function(method){var self = TMP_6.$$s || this; if (method == null) method = nil; return self.$alias_native(method)}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $b).call($c); }, TMP_7.$$arity = -1); self.$attr_reader("selector"); self.$alias_native("after"); self.$alias_native("before"); self.$alias_native("parent"); self.$alias_native("parents"); self.$alias_native("prev"); self.$alias_native("remove"); self.$alias_native("hide"); self.$alias_native("show"); self.$alias_native("toggle"); self.$alias_native("children"); self.$alias_native("blur"); self.$alias_native("closest"); self.$alias_native("detach"); self.$alias_native("focus"); self.$alias_native("find"); self.$alias_native("next"); self.$alias_native("siblings"); self.$alias_native("text"); self.$alias_native("trigger"); self.$alias_native("append"); self.$alias_native("prepend"); self.$alias_native("serialize"); self.$alias_native("is"); self.$alias_native("filter"); self.$alias_native("not"); self.$alias_native("last"); self.$alias_native("wrap"); self.$alias_native("stop"); self.$alias_native("clone"); self.$alias_native("empty"); self.$alias_native("get"); self.$alias_native("prop"); Opal.alias(self, 'succ', 'next'); Opal.alias(self, '<<', 'append'); self.$alias_native("add_class", "addClass"); self.$alias_native("append_to", "appendTo"); self.$alias_native("has_class?", "hasClass"); self.$alias_native("html=", "html"); self.$alias_native("index"); self.$alias_native("is?", "is"); self.$alias_native("remove_attr", "removeAttr"); self.$alias_native("remove_class", "removeClass"); self.$alias_native("submit"); self.$alias_native("text=", "text"); self.$alias_native("toggle_class", "toggleClass"); self.$alias_native("value=", "val"); self.$alias_native("scroll_top=", "scrollTop"); self.$alias_native("scroll_top", "scrollTop"); self.$alias_native("scroll_left=", "scrollLeft"); self.$alias_native("scroll_left", "scrollLeft"); self.$alias_native("remove_attribute", "removeAttr"); self.$alias_native("slide_down", "slideDown"); self.$alias_native("slide_up", "slideUp"); self.$alias_native("slide_toggle", "slideToggle"); self.$alias_native("fade_toggle", "fadeToggle"); self.$alias_native("height=", "height"); self.$alias_native("width=", "width"); self.$alias_native("outer_width", "outerWidth"); self.$alias_native("outer_height", "outerHeight"); Opal.defn(self, '$to_n', TMP_8 = function $$to_n() { var self = this; return self; }, TMP_8.$$arity = 0); Opal.defn(self, '$[]', TMP_9 = function(name) { var self = this; var value = self.attr(name); if(value === undefined) return nil; return value; }, TMP_9.$$arity = 1); Opal.defn(self, '$[]=', TMP_10 = function(name, value) { var $a, self = this; if ((($a = value['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.removeAttr(name);}; return self.attr(name, value); }, TMP_10.$$arity = 2); Opal.defn(self, '$attr', TMP_11 = function $$attr($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } var size = args.length; switch (size) { case 1: return self['$[]'](args[0]); break; case 2: return self['$[]='](args[0], args[1]); break; default: self.$raise($scope.get('ArgumentError'), "#attr only accepts 1 or 2 arguments") } ; }, TMP_11.$$arity = -1); Opal.defn(self, '$has_attribute?', TMP_12 = function(name) { var self = this; return self.attr(name) !== undefined; }, TMP_12.$$arity = 1); Opal.defn(self, '$append_to_body', TMP_13 = function $$append_to_body() { var self = this; return self.appendTo(document.body); }, TMP_13.$$arity = 0); Opal.defn(self, '$append_to_head', TMP_14 = function $$append_to_head() { var self = this; return self.appendTo(document.head); }, TMP_14.$$arity = 0); Opal.defn(self, '$at', TMP_15 = function $$at(index) { var self = this; var length = self.length; if (index < 0) { index += length; } if (index < 0 || index >= length) { return nil; } return $(self[index]); }, TMP_15.$$arity = 1); Opal.defn(self, '$class_name', TMP_16 = function $$class_name() { var self = this; var first = self[0]; return (first && first.className) || ""; }, TMP_16.$$arity = 0); Opal.defn(self, '$class_name=', TMP_17 = function(name) { var self = this; for (var i = 0, length = self.length; i < length; i++) { self[i].className = name; } return self; }, TMP_17.$$arity = 1); Opal.defn(self, '$css', TMP_18 = function $$css(name, value) { var $a, $b, self = this; if (value == null) { value = nil; } if ((($a = ($b = value['$nil?'](), $b !== false && $b !== nil && $b != null ?name['$is_a?']($scope.get('String')) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.css(name) } else if ((($a = name['$is_a?']($scope.get('Hash'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.css(name.$to_n()); } else { self.css(name, value); }; return self; }, TMP_18.$$arity = -2); Opal.defn(self, '$animate', TMP_19 = function $$animate(params) { var $a, self = this, $iter = TMP_19.$$p, block = $iter || nil, speed = nil; TMP_19.$$p = null; speed = (function() {if ((($a = params['$has_key?']("speed")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return params.$delete("speed") } else { return 400 }; return nil; })(); self.animate(params.$to_n(), speed, function() { (function() {if ((block !== nil)) { return block.$call() } else { return nil }; return nil; })() }) ; }, TMP_19.$$arity = 1); Opal.defn(self, '$data', TMP_20 = function $$data($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } var result = self.data.apply(self, args); return result == null ? nil : result; }, TMP_20.$$arity = -1); Opal.defn(self, '$effect', TMP_21 = function $$effect(name, $a_rest) { var $b, $c, TMP_22, $d, TMP_23, self = this, args, $iter = TMP_21.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_21.$$p = null; name = ($b = ($c = name).$gsub, $b.$$p = (TMP_22 = function(match){var self = TMP_22.$$s || this; if (match == null) match = nil; return match['$[]'](1).$upcase()}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22), $b).call($c, /_\w/); args = ($b = ($d = args).$map, $b.$$p = (TMP_23 = function(a){var self = TMP_23.$$s || this, $a; if (a == null) a = nil; if ((($a = a['$respond_to?']("to_n")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return a.$to_n() } else { return nil }}, TMP_23.$$s = self, TMP_23.$$arity = 1, TMP_23), $b).call($d).$compact(); args['$<<'](function() { (function() {if ((block !== nil)) { return block.$call() } else { return nil }; return nil; })() }); return self[name].apply(self, args); }, TMP_21.$$arity = -2); Opal.defn(self, '$visible?', TMP_24 = function() { var self = this; return self.is(':visible'); }, TMP_24.$$arity = 0); Opal.defn(self, '$offset', TMP_25 = function $$offset() { var self = this; return self.$Native(self.offset()); }, TMP_25.$$arity = 0); Opal.defn(self, '$each', TMP_26 = function $$each() { var self = this, $iter = TMP_26.$$p, $yield = $iter || nil; TMP_26.$$p = null; for (var i = 0, length = self.length; i < length; i++) { Opal.yield1($yield, $(self[i])); }; return self; }, TMP_26.$$arity = 0); Opal.defn(self, '$first', TMP_27 = function $$first() { var self = this; return self.length ? self.first() : nil; }, TMP_27.$$arity = 0); Opal.defn(self, '$html', TMP_28 = function $$html(content) { var self = this; if (content != null) { return self.html(content); } return self.html() || ''; }, TMP_28.$$arity = -1); Opal.defn(self, '$id', TMP_29 = function $$id() { var self = this; var first = self[0]; return (first && first.id) || ""; }, TMP_29.$$arity = 0); Opal.defn(self, '$id=', TMP_30 = function(id) { var self = this; var first = self[0]; if (first) { first.id = id; } return self; }, TMP_30.$$arity = 1); Opal.defn(self, '$tag_name', TMP_31 = function $$tag_name() { var self = this; return self.length > 0 ? self[0].tagName.toLowerCase() : nil; }, TMP_31.$$arity = 0); Opal.defn(self, '$inspect', TMP_32 = function $$inspect() { var self = this; if (self[0] === document) return '#' else if (self[0] === window ) return '#' var val, el, str, result = []; for (var i = 0, length = self.length; i < length; i++) { el = self[i]; if (!el.tagName) { return '#'); } return '#'; }, TMP_32.$$arity = 0); Opal.defn(self, '$to_s', TMP_33 = function $$to_s() { var self = this; var val, el, result = []; for (var i = 0, length = self.length; i < length; i++) { el = self[i]; result.push(el.outerHTML) } return result.join(', '); }, TMP_33.$$arity = 0); Opal.defn(self, '$length', TMP_34 = function $$length() { var self = this; return self.length; }, TMP_34.$$arity = 0); Opal.defn(self, '$any?', TMP_35 = function() { var self = this; return self.length > 0; }, TMP_35.$$arity = 0); Opal.defn(self, '$empty?', TMP_36 = function() { var self = this; return self.length === 0; }, TMP_36.$$arity = 0); Opal.alias(self, 'empty?', 'none?'); Opal.defn(self, '$on', TMP_37 = function $$on(name, sel) { var self = this, $iter = TMP_37.$$p, block = $iter || nil; if (sel == null) { sel = nil; } TMP_37.$$p = null; var wrapper = function(evt) { if (evt.preventDefault) { evt = $scope.get('Event').$new(evt); } return block.apply(null, arguments); }; block._jq_wrap = wrapper; if (sel == nil) { self.on(name, wrapper); } else { self.on(name, sel, wrapper); } ; return block; }, TMP_37.$$arity = -2); Opal.defn(self, '$one', TMP_38 = function $$one(name, sel) { var self = this, $iter = TMP_38.$$p, block = $iter || nil; if (sel == null) { sel = nil; } TMP_38.$$p = null; var wrapper = function(evt) { if (evt.preventDefault) { evt = $scope.get('Event').$new(evt); } return block.apply(null, arguments); }; block._jq_wrap = wrapper; if (sel == nil) { self.one(name, wrapper); } else { self.one(name, sel, wrapper); } ; return block; }, TMP_38.$$arity = -2); Opal.defn(self, '$off', TMP_39 = function $$off(name, sel, block) { var self = this; if (block == null) { block = nil; } if (sel == null) { return self.off(name); } else if (block === nil) { return self.off(name, sel._jq_wrap); } else { return self.off(name, sel, block._jq_wrap); } }, TMP_39.$$arity = -3); Opal.defn(self, '$serialize_array', TMP_41 = function $$serialize_array() { var $a, $b, TMP_40, self = this; return ($a = ($b = (self.serializeArray())).$map, $a.$$p = (TMP_40 = function(e){var self = TMP_40.$$s || this; if (e == null) e = nil; return $scope.get('Hash').$new(e)}, TMP_40.$$s = self, TMP_40.$$arity = 1, TMP_40), $a).call($b); }, TMP_41.$$arity = 0); Opal.alias(self, 'size', 'length'); Opal.defn(self, '$value', TMP_42 = function $$value() { var self = this; return self.val() || ""; }, TMP_42.$$arity = 0); Opal.defn(self, '$height', TMP_43 = function $$height() { var self = this; return self.height() || nil; }, TMP_43.$$arity = 0); Opal.defn(self, '$width', TMP_44 = function $$width() { var self = this; return self.width() || nil; }, TMP_44.$$arity = 0); return (Opal.defn(self, '$position', TMP_45 = function $$position() { var self = this; return self.$Native(self.position()); }, TMP_45.$$arity = 0), nil) && 'position'; })($scope.base, $scope.get('JQUERY_CLASS').$to_n()); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/jquery/window"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $gvars = Opal.gvars; Opal.add_stubs(['$require', '$include', '$find', '$on', '$to_proc', '$element', '$off', '$trigger', '$new']); self.$require("opal/jquery/element"); (function($base) { var $Browser, self = $Browser = $module($base, 'Browser'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Window(){}; var self = $Window = $klass($base, $super, 'Window', $Window); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4; def.element = nil; self.$include($scope.get('Native')); Opal.defn(self, '$element', TMP_1 = function $$element() { var $a, self = this; return ((($a = self.element) !== false && $a !== nil && $a != null) ? $a : self.element = $scope.get('Element').$find(window)); }, TMP_1.$$arity = 0); Opal.defn(self, '$on', TMP_2 = function $$on($a_rest) { var $b, $c, self = this, args, $iter = TMP_2.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_2.$$p = null; return ($b = ($c = self.$element()).$on, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_2.$$arity = -1); Opal.defn(self, '$off', TMP_3 = function $$off($a_rest) { var $b, $c, self = this, args, $iter = TMP_3.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_3.$$p = null; return ($b = ($c = self.$element()).$off, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_3.$$arity = -1); return (Opal.defn(self, '$trigger', TMP_4 = function $$trigger($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = self.$element()).$trigger.apply($b, Opal.to_a(args)); }, TMP_4.$$arity = -1), nil) && 'trigger'; })($scope.base, null) })($scope.base); Opal.cdecl($scope, 'Window', (($scope.get('Browser')).$$scope.get('Window')).$new(window)); return $gvars.window = $scope.get('Window'); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/jquery/document"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $gvars = Opal.gvars; Opal.add_stubs(['$require', '$to_n', '$call', '$new', '$ready?', '$resolve', '$module_function', '$find', '$extend']); self.$require("opal/jquery/constants"); self.$require("opal/jquery/element"); (function($base) { var $Browser, self = $Browser = $module($base, 'Browser'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $DocumentMethods, self = $DocumentMethods = $module($base, 'DocumentMethods'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_3, $a, $b, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8; var $ = $scope.get('JQUERY_SELECTOR').$to_n(); Opal.defn(self, '$ready?', TMP_1 = function() { var $a, $b, self = this, $iter = TMP_1.$$p, block = $iter || nil; TMP_1.$$p = null; if ((block !== nil)) { if ((($a = (($b = Opal.cvars['@@__isReady']) == null ? nil : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return block.$call() } else { return $(block); } } else { return nil }; }, TMP_1.$$arity = 0); Opal.defn(self, '$ready', TMP_3 = function $$ready() { var $a, $b, TMP_2, self = this, promise = nil; promise = $scope.get('Promise').$new(); ($a = ($b = $scope.get('Document'))['$ready?'], $a.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this; return promise.$resolve()}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $a).call($b); return promise; }, TMP_3.$$arity = 0); self.$module_function("ready?"); ($a = ($b = self)['$ready?'], $a.$$p = (TMP_4 = function(){var self = TMP_4.$$s || this; return (Opal.cvars['@@__isReady'] = true)}, TMP_4.$$s = self, TMP_4.$$arity = 0, TMP_4), $a).call($b); Opal.defn(self, '$title', TMP_5 = function $$title() { var self = this; return document.title; }, TMP_5.$$arity = 0); Opal.defn(self, '$title=', TMP_6 = function(title) { var self = this; return document.title = title; }, TMP_6.$$arity = 1); Opal.defn(self, '$head', TMP_7 = function $$head() { var self = this; return $scope.get('Element').$find(document.head); }, TMP_7.$$arity = 0); Opal.defn(self, '$body', TMP_8 = function $$body() { var self = this; return $scope.get('Element').$find(document.body); }, TMP_8.$$arity = 0); })($scope.base) })($scope.base); Opal.cdecl($scope, 'Document', $scope.get('Element').$find(document)); $scope.get('Document').$extend((($scope.get('Browser')).$$scope.get('DocumentMethods'))); return $gvars.document = $scope.get('Document'); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/jquery/event"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$to_n', '$stop', '$prevent']); self.$require("opal/jquery/constants"); return (function($base, $super) { function $Event(){}; var self = $Event = $klass($base, $super, 'Event', $Event); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22; def["native"] = nil; var $ = $scope.get('JQUERY_SELECTOR').$to_n(); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(native$) { var self = this; return self["native"] = native$; }, TMP_1.$$arity = 1); Opal.defn(self, '$to_n', TMP_2 = function $$to_n() { var self = this; return self["native"]; }, TMP_2.$$arity = 0); Opal.defn(self, '$[]', TMP_3 = function(name) { var self = this; return self["native"][name]; }, TMP_3.$$arity = 1); Opal.defn(self, '$type', TMP_4 = function $$type() { var self = this; return self["native"].type; }, TMP_4.$$arity = 0); Opal.defn(self, '$element', TMP_5 = function $$element() { var self = this; return $(self["native"].currentTarget); }, TMP_5.$$arity = 0); Opal.alias(self, 'current_target', 'element'); Opal.defn(self, '$target', TMP_6 = function $$target() { var self = this; return $(self["native"].target); }, TMP_6.$$arity = 0); Opal.defn(self, '$prevented?', TMP_7 = function() { var self = this; return self["native"].isDefaultPrevented(); }, TMP_7.$$arity = 0); Opal.defn(self, '$prevent', TMP_8 = function $$prevent() { var self = this; return self["native"].preventDefault(); }, TMP_8.$$arity = 0); Opal.defn(self, '$stopped?', TMP_9 = function() { var self = this; return self["native"].isPropagationStopped(); }, TMP_9.$$arity = 0); Opal.defn(self, '$stop', TMP_10 = function $$stop() { var self = this; return self["native"].stopPropagation(); }, TMP_10.$$arity = 0); Opal.defn(self, '$stop_immediate', TMP_11 = function $$stop_immediate() { var self = this; return self["native"].stopImmediatePropagation(); }, TMP_11.$$arity = 0); Opal.defn(self, '$kill', TMP_12 = function $$kill() { var self = this; self.$stop(); return self.$prevent(); }, TMP_12.$$arity = 0); Opal.defn(self, '$page_x', TMP_13 = function $$page_x() { var self = this; return self["native"].pageX; }, TMP_13.$$arity = 0); Opal.defn(self, '$page_y', TMP_14 = function $$page_y() { var self = this; return self["native"].pageY; }, TMP_14.$$arity = 0); Opal.defn(self, '$touch_x', TMP_15 = function $$touch_x() { var self = this; return self["native"].originalEvent.touches[0].pageX; }, TMP_15.$$arity = 0); Opal.defn(self, '$touch_y', TMP_16 = function $$touch_y() { var self = this; return self["native"].originalEvent.touches[0].pageY; }, TMP_16.$$arity = 0); Opal.defn(self, '$ctrl_key', TMP_17 = function $$ctrl_key() { var self = this; return self["native"].ctrlKey; }, TMP_17.$$arity = 0); Opal.defn(self, '$meta_key', TMP_18 = function $$meta_key() { var self = this; return self["native"].metaKey; }, TMP_18.$$arity = 0); Opal.defn(self, '$alt_key', TMP_19 = function $$alt_key() { var self = this; return self["native"].altKey; }, TMP_19.$$arity = 0); Opal.defn(self, '$shift_key', TMP_20 = function $$shift_key() { var self = this; return self["native"].shiftKey; }, TMP_20.$$arity = 0); Opal.defn(self, '$key_code', TMP_21 = function $$key_code() { var self = this; return self["native"].keyCode; }, TMP_21.$$arity = 0); Opal.defn(self, '$which', TMP_22 = function $$which() { var self = this; return self["native"].which; }, TMP_22.$$arity = 0); Opal.alias(self, 'default_prevented?', 'prevented?'); Opal.alias(self, 'prevent_default', 'prevent'); Opal.alias(self, 'propagation_stopped?', 'stopped?'); Opal.alias(self, 'stop_propagation', 'stop'); return Opal.alias(self, 'stop_immediate_propagation', 'stop_immediate'); })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["json"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2, $klass = Opal.klass; Opal.add_stubs(['$new', '$push', '$[]=', '$[]', '$create_id', '$json_create', '$attr_accessor', '$create_id=', '$===', '$parse', '$generate', '$from_object', '$merge', '$to_json', '$responds_to?', '$to_io', '$write', '$to_s', '$to_a', '$strftime']); (function($base) { var $JSON, self = $JSON = $module($base, 'JSON'); var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7; var $parse = JSON.parse, $hasOwn = Opal.hasOwnProperty; function to_opal(value, options) { var klass, arr, hash, i, ii, k; switch (typeof value) { case 'string': return value; case 'number': return value; case 'boolean': return !!value; case 'null': return nil; case 'object': if (!value) return nil; if (value.$$is_array) { arr = (options.array_class).$new(); for (i = 0, ii = value.length; i < ii; i++) { (arr).$push(to_opal(value[i], options)); } return arr; } else { hash = (options.object_class).$new(); for (k in value) { if ($hasOwn.call(value, k)) { (hash)['$[]='](k, to_opal(value[k], options)); } } if (!options.parse && (klass = (hash)['$[]']($scope.get('JSON').$create_id())) != nil) { klass = Opal.get(klass); return (klass).$json_create(hash); } else { return hash; } } } }; (function(self) { var $scope = self.$$scope, def = self.$$proto; return self.$attr_accessor("create_id") })(Opal.get_singleton_class(self)); (($a = ["json_class"]), $b = self, $b['$create_id='].apply($b, $a), $a[$a.length-1]); Opal.defs(self, '$[]', TMP_1 = function(value, options) { var $a, self = this; if (options == null) { options = $hash2([], {}); } if ((($a = $scope.get('String')['$==='](value)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$parse(value, options) } else { return self.$generate(value, options) }; }, TMP_1.$$arity = -2); Opal.defs(self, '$parse', TMP_2 = function $$parse(source, options) { var self = this; if (options == null) { options = $hash2([], {}); } return self.$from_object($parse(source), options.$merge($hash2(["parse"], {"parse": true}))); }, TMP_2.$$arity = -2); Opal.defs(self, '$parse!', TMP_3 = function(source, options) { var self = this; if (options == null) { options = $hash2([], {}); } return self.$parse(source, options); }, TMP_3.$$arity = -2); Opal.defs(self, '$load', TMP_4 = function $$load(source, options) { var self = this; if (options == null) { options = $hash2([], {}); } return self.$from_object($parse(source), options); }, TMP_4.$$arity = -2); Opal.defs(self, '$from_object', TMP_5 = function $$from_object(js_object, options) { var $a, $b, $c, self = this; if (options == null) { options = $hash2([], {}); } ($a = "object_class", $b = options, ((($c = $b['$[]']($a)) !== false && $c !== nil && $c != null) ? $c : $b['$[]=']($a, $scope.get('Hash')))); ($a = "array_class", $b = options, ((($c = $b['$[]']($a)) !== false && $c !== nil && $c != null) ? $c : $b['$[]=']($a, $scope.get('Array')))); return to_opal(js_object, options.$$smap); }, TMP_5.$$arity = -2); Opal.defs(self, '$generate', TMP_6 = function $$generate(obj, options) { var self = this; if (options == null) { options = $hash2([], {}); } return obj.$to_json(options); }, TMP_6.$$arity = -2); Opal.defs(self, '$dump', TMP_7 = function $$dump(obj, io, limit) { var $a, self = this, string = nil; if (io == null) { io = nil; } if (limit == null) { limit = nil; } string = self.$generate(obj); if (io !== false && io !== nil && io != null) { if ((($a = io['$responds_to?']("to_io")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { io = io.$to_io()}; io.$write(string); return io; } else { return string }; }, TMP_7.$$arity = -2); })($scope.base); (function($base, $super) { function $Object(){}; var self = $Object = $klass($base, $super, 'Object', $Object); var def = self.$$proto, $scope = self.$$scope, TMP_8; return (Opal.defn(self, '$to_json', TMP_8 = function $$to_json() { var self = this; return self.$to_s().$to_json(); }, TMP_8.$$arity = 0), nil) && 'to_json' })($scope.base, null); (function($base) { var $Enumerable, self = $Enumerable = $module($base, 'Enumerable'); var def = self.$$proto, $scope = self.$$scope, TMP_9; Opal.defn(self, '$to_json', TMP_9 = function $$to_json() { var self = this; return self.$to_a().$to_json(); }, TMP_9.$$arity = 0) })($scope.base); (function($base, $super) { function $Array(){}; var self = $Array = $klass($base, $super, 'Array', $Array); var def = self.$$proto, $scope = self.$$scope, TMP_10; return (Opal.defn(self, '$to_json', TMP_10 = function $$to_json() { var self = this; var result = []; for (var i = 0, length = self.length; i < length; i++) { result.push((self[i]).$to_json()); } return '[' + result.join(', ') + ']'; }, TMP_10.$$arity = 0), nil) && 'to_json' })($scope.base, null); (function($base, $super) { function $Boolean(){}; var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean); var def = self.$$proto, $scope = self.$$scope, TMP_11; return (Opal.defn(self, '$to_json', TMP_11 = function $$to_json() { var self = this; return (self == true) ? 'true' : 'false'; }, TMP_11.$$arity = 0), nil) && 'to_json' })($scope.base, null); (function($base, $super) { function $Hash(){}; var self = $Hash = $klass($base, $super, 'Hash', $Hash); var def = self.$$proto, $scope = self.$$scope, TMP_12; return (Opal.defn(self, '$to_json', TMP_12 = function $$to_json() { var self = this; var result = []; for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { key = keys[i]; if (key.$$is_string) { value = self.$$smap[key]; } else { value = key.value; key = key.key; } result.push((key).$to_s().$to_json() + ':' + (value).$to_json()); } return '{' + result.join(', ') + '}'; ; }, TMP_12.$$arity = 0), nil) && 'to_json' })($scope.base, null); (function($base, $super) { function $NilClass(){}; var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); var def = self.$$proto, $scope = self.$$scope, TMP_13; return (Opal.defn(self, '$to_json', TMP_13 = function $$to_json() { var self = this; return "null"; }, TMP_13.$$arity = 0), nil) && 'to_json' })($scope.base, null); (function($base, $super) { function $Numeric(){}; var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); var def = self.$$proto, $scope = self.$$scope, TMP_14; return (Opal.defn(self, '$to_json', TMP_14 = function $$to_json() { var self = this; return self.toString(); }, TMP_14.$$arity = 0), nil) && 'to_json' })($scope.base, null); (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); var def = self.$$proto, $scope = self.$$scope; return Opal.alias(self, 'to_json', 'inspect') })($scope.base, null); (function($base, $super) { function $Time(){}; var self = $Time = $klass($base, $super, 'Time', $Time); var def = self.$$proto, $scope = self.$$scope, TMP_15; return (Opal.defn(self, '$to_json', TMP_15 = function $$to_json() { var self = this; return self.$strftime("%FT%T%z").$to_json(); }, TMP_15.$$arity = 0), nil) && 'to_json' })($scope.base, null); return (function($base, $super) { function $Date(){}; var self = $Date = $klass($base, $super, 'Date', $Date); var def = self.$$proto, $scope = self.$$scope, TMP_16, TMP_17; Opal.defn(self, '$to_json', TMP_16 = function $$to_json() { var self = this; return self.$to_s().$to_json(); }, TMP_16.$$arity = 0); return (Opal.defn(self, '$as_json', TMP_17 = function $$as_json() { var self = this; return self.$to_s(); }, TMP_17.$$arity = 0), nil) && 'as_json'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["promise"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_le(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$resolve', '$new', '$reject', '$attr_reader', '$===', '$value', '$has_key?', '$keys', '$!', '$==', '$<<', '$>>', '$exception?', '$[]', '$resolved?', '$rejected?', '$error', '$include?', '$action', '$realized?', '$raise', '$^', '$call', '$resolve!', '$exception!', '$any?', '$each', '$reject!', '$there_can_be_only_one!', '$then', '$to_proc', '$fail', '$always', '$trace', '$class', '$object_id', '$+', '$inspect', '$act?', '$nil?', '$prev', '$push', '$concat', '$it', '$proc', '$reverse', '$pop', '$<=', '$length', '$shift', '$-', '$wait', '$map', '$reduce', '$try', '$tap', '$all?', '$find']); return (function($base, $super) { function $Promise(){}; var self = $Promise = $klass($base, $super, 'Promise', $Promise); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_17, TMP_18, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31; def.value = def.action = def.exception = def.realized = def.next = def.delayed = def.error = def.prev = nil; Opal.defs(self, '$value', TMP_1 = function $$value(value) { var self = this; return self.$new().$resolve(value); }, TMP_1.$$arity = 1); Opal.defs(self, '$error', TMP_2 = function $$error(value) { var self = this; return self.$new().$reject(value); }, TMP_2.$$arity = 1); Opal.defs(self, '$when', TMP_3 = function $$when($a_rest) { var self = this, promises; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } promises = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { promises[$arg_idx - 0] = arguments[$arg_idx]; } return $scope.get('When').$new(promises); }, TMP_3.$$arity = -1); self.$attr_reader("error", "prev", "next"); Opal.defn(self, '$initialize', TMP_4 = function $$initialize(action) { var self = this; if (action == null) { action = $hash2([], {}); } self.action = action; self.realized = false; self.exception = false; self.value = nil; self.error = nil; self.delayed = false; self.prev = nil; return self.next = []; }, TMP_4.$$arity = -1); Opal.defn(self, '$value', TMP_5 = function $$value() { var $a, self = this; if ((($a = $scope.get('Promise')['$==='](self.value)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.value.$value() } else { return self.value }; }, TMP_5.$$arity = 0); Opal.defn(self, '$act?', TMP_6 = function() { var $a, self = this; return ((($a = self.action['$has_key?']("success")) !== false && $a !== nil && $a != null) ? $a : self.action['$has_key?']("always")); }, TMP_6.$$arity = 0); Opal.defn(self, '$action', TMP_7 = function $$action() { var self = this; return self.action.$keys(); }, TMP_7.$$arity = 0); Opal.defn(self, '$exception?', TMP_8 = function() { var self = this; return self.exception; }, TMP_8.$$arity = 0); Opal.defn(self, '$realized?', TMP_9 = function() { var self = this; return self.realized['$!']()['$!'](); }, TMP_9.$$arity = 0); Opal.defn(self, '$resolved?', TMP_10 = function() { var self = this; return self.realized['$==']("resolve"); }, TMP_10.$$arity = 0); Opal.defn(self, '$rejected?', TMP_11 = function() { var self = this; return self.realized['$==']("reject"); }, TMP_11.$$arity = 0); Opal.defn(self, '$^', TMP_12 = function(promise) { var self = this; promise['$<<'](self); self['$>>'](promise); return promise; }, TMP_12.$$arity = 1); Opal.defn(self, '$<<', TMP_13 = function(promise) { var self = this; self.prev = promise; return self; }, TMP_13.$$arity = 1); Opal.defn(self, '$>>', TMP_14 = function(promise) { var $a, $b, $c, self = this; self.next['$<<'](promise); if ((($a = self['$exception?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { promise.$reject(self.delayed['$[]'](0)) } else if ((($a = self['$resolved?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { promise.$resolve((function() {if ((($a = self.delayed) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.delayed['$[]'](0) } else { return self.$value() }; return nil; })()) } else if ((($a = self['$rejected?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = ((($b = self.action['$has_key?']("failure")['$!']()) !== false && $b !== nil && $b != null) ? $b : $scope.get('Promise')['$==='](((function() {if ((($c = self.delayed) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.delayed['$[]'](0) } else { return self.error }; return nil; })())))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { promise.$reject((function() {if ((($a = self.delayed) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.delayed['$[]'](0) } else { return self.$error() }; return nil; })()) } else if ((($a = promise.$action()['$include?']("always")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { promise.$reject((function() {if ((($a = self.delayed) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.delayed['$[]'](0) } else { return self.$error() }; return nil; })())}}; return self; }, TMP_14.$$arity = 1); Opal.defn(self, '$resolve', TMP_15 = function $$resolve(value) { var $a, $b, self = this, block = nil, e = nil; if (value == null) { value = nil; } if ((($a = self['$realized?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "the promise has already been realized")}; if ((($a = $scope.get('Promise')['$==='](value)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (value['$<<'](self.prev))['$^'](self)}; try { if ((($a = block = ((($b = self.action['$[]']("success")) !== false && $b !== nil && $b != null) ? $b : self.action['$[]']("always"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { value = block.$call(value)}; self['$resolve!'](value); } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { self['$exception!'](e) } finally { Opal.pop_exception() } } else { throw $err; } }; return self; }, TMP_15.$$arity = -1); Opal.defn(self, '$resolve!', TMP_17 = function(value) { var $a, $b, TMP_16, self = this; self.realized = "resolve"; self.value = value; if ((($a = self.next['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self.next).$each, $a.$$p = (TMP_16 = function(p){var self = TMP_16.$$s || this; if (p == null) p = nil; return p.$resolve(value)}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16), $a).call($b) } else { return self.delayed = [value] }; }, TMP_17.$$arity = 1); Opal.defn(self, '$reject', TMP_18 = function $$reject(value) { var $a, $b, self = this, block = nil, e = nil; if (value == null) { value = nil; } if ((($a = self['$realized?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "the promise has already been realized")}; if ((($a = $scope.get('Promise')['$==='](value)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (value['$<<'](self.prev))['$^'](self)}; try { if ((($a = block = ((($b = self.action['$[]']("failure")) !== false && $b !== nil && $b != null) ? $b : self.action['$[]']("always"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { value = block.$call(value)}; if ((($a = self.action['$has_key?']("always")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self['$resolve!'](value) } else { self['$reject!'](value) }; } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { self['$exception!'](e) } finally { Opal.pop_exception() } } else { throw $err; } }; return self; }, TMP_18.$$arity = -1); Opal.defn(self, '$reject!', TMP_20 = function(value) { var $a, $b, TMP_19, self = this; self.realized = "reject"; self.error = value; if ((($a = self.next['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self.next).$each, $a.$$p = (TMP_19 = function(p){var self = TMP_19.$$s || this; if (p == null) p = nil; return p.$reject(value)}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19), $a).call($b) } else { return self.delayed = [value] }; }, TMP_20.$$arity = 1); Opal.defn(self, '$exception!', TMP_21 = function(error) { var self = this; self.exception = true; return self['$reject!'](error); }, TMP_21.$$arity = 1); Opal.defn(self, '$then', TMP_22 = function $$then() { var self = this, $iter = TMP_22.$$p, block = $iter || nil; TMP_22.$$p = null; return self['$^']($scope.get('Promise').$new($hash2(["success"], {"success": block}))); }, TMP_22.$$arity = 0); Opal.defn(self, '$then!', TMP_23 = function() { var $a, $b, self = this, $iter = TMP_23.$$p, block = $iter || nil; TMP_23.$$p = null; self['$there_can_be_only_one!'](); return ($a = ($b = self).$then, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_23.$$arity = 0); Opal.alias(self, 'do', 'then'); Opal.alias(self, 'do!', 'then!'); Opal.defn(self, '$fail', TMP_24 = function $$fail() { var self = this, $iter = TMP_24.$$p, block = $iter || nil; TMP_24.$$p = null; return self['$^']($scope.get('Promise').$new($hash2(["failure"], {"failure": block}))); }, TMP_24.$$arity = 0); Opal.defn(self, '$fail!', TMP_25 = function() { var $a, $b, self = this, $iter = TMP_25.$$p, block = $iter || nil; TMP_25.$$p = null; self['$there_can_be_only_one!'](); return ($a = ($b = self).$fail, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_25.$$arity = 0); Opal.alias(self, 'rescue', 'fail'); Opal.alias(self, 'catch', 'fail'); Opal.alias(self, 'rescue!', 'fail!'); Opal.alias(self, 'catch!', 'fail!'); Opal.defn(self, '$always', TMP_26 = function $$always() { var self = this, $iter = TMP_26.$$p, block = $iter || nil; TMP_26.$$p = null; return self['$^']($scope.get('Promise').$new($hash2(["always"], {"always": block}))); }, TMP_26.$$arity = 0); Opal.defn(self, '$always!', TMP_27 = function() { var $a, $b, self = this, $iter = TMP_27.$$p, block = $iter || nil; TMP_27.$$p = null; self['$there_can_be_only_one!'](); return ($a = ($b = self).$always, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_27.$$arity = 0); Opal.alias(self, 'finally', 'always'); Opal.alias(self, 'ensure', 'always'); Opal.alias(self, 'finally!', 'always!'); Opal.alias(self, 'ensure!', 'always!'); Opal.defn(self, '$trace', TMP_28 = function $$trace(depth) { var self = this, $iter = TMP_28.$$p, block = $iter || nil; if (depth == null) { depth = nil; } TMP_28.$$p = null; return self['$^']($scope.get('Trace').$new(depth, block)); }, TMP_28.$$arity = -1); Opal.defn(self, '$trace!', TMP_29 = function($a_rest) { var $b, $c, self = this, args, $iter = TMP_29.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_29.$$p = null; self['$there_can_be_only_one!'](); return ($b = ($c = self).$trace, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_29.$$arity = -1); Opal.defn(self, '$there_can_be_only_one!', TMP_30 = function() { var $a, self = this; if ((($a = self.next['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise($scope.get('ArgumentError'), "a promise has already been chained") } else { return nil }; }, TMP_30.$$arity = 0); Opal.defn(self, '$inspect', TMP_31 = function $$inspect() { var $a, self = this, result = nil; result = "#<" + (self.$class()) + "(" + (self.$object_id()) + ")"; if ((($a = self.next['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = $rb_plus(result, " >> " + (self.next.$inspect()))}; if ((($a = self['$realized?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = $rb_plus(result, ": " + ((((($a = self.value) !== false && $a !== nil && $a != null) ? $a : self.error)).$inspect()) + ">") } else { result = $rb_plus(result, ">") }; return result; }, TMP_31.$$arity = 0); (function($base, $super) { function $Trace(){}; var self = $Trace = $klass($base, $super, 'Trace', $Trace); var def = self.$$proto, $scope = self.$$scope, TMP_32, TMP_33; Opal.defs(self, '$it', TMP_32 = function $$it(promise) { var $a, $b, self = this, current = nil, prev = nil; current = []; if ((($a = ((($b = promise['$act?']()) !== false && $b !== nil && $b != null) ? $b : promise.$prev()['$nil?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { current.$push(promise.$value())}; if ((($a = prev = promise.$prev()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return current.$concat(self.$it(prev)) } else { return current }; }, TMP_32.$$arity = 1); return (Opal.defn(self, '$initialize', TMP_33 = function $$initialize(depth, block) { var $a, $b, $c, $d, TMP_34, self = this, $iter = TMP_33.$$p, $yield = $iter || nil; TMP_33.$$p = null; self.depth = depth; return ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_33, false)), $a.$$p = null, $a).call($b, $hash2(["success"], {"success": ($c = ($d = self).$proc, $c.$$p = (TMP_34 = function(){var self = TMP_34.$$s || this, $e, $f, trace = nil; trace = $scope.get('Trace').$it(self).$reverse(); trace.$pop(); if ((($e = (($f = depth !== false && depth !== nil && depth != null) ? $rb_le(depth, trace.$length()) : depth)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { trace.$shift($rb_minus(trace.$length(), depth))}; return ($e = block).$call.apply($e, Opal.to_a(trace));}, TMP_34.$$s = self, TMP_34.$$arity = 0, TMP_34), $c).call($d)})); }, TMP_33.$$arity = 2), nil) && 'initialize'; })($scope.base, self); return (function($base, $super) { function $When(){}; var self = $When = $klass($base, $super, 'When', $When); var def = self.$$proto, $scope = self.$$scope, TMP_35, TMP_37, TMP_39, TMP_41, TMP_44, TMP_46, TMP_47; def.wait = nil; Opal.defn(self, '$initialize', TMP_35 = function $$initialize(promises) { var $a, $b, $c, TMP_36, self = this, $iter = TMP_35.$$p, $yield = $iter || nil; if (promises == null) { promises = []; } TMP_35.$$p = null; ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_35, false)), $a.$$p = null, $a).call($b); self.wait = []; return ($a = ($c = promises).$each, $a.$$p = (TMP_36 = function(promise){var self = TMP_36.$$s || this; if (promise == null) promise = nil; return self.$wait(promise)}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36), $a).call($c); }, TMP_35.$$arity = -1); Opal.defn(self, '$each', TMP_37 = function $$each() { var $a, $b, TMP_38, self = this, $iter = TMP_37.$$p, block = $iter || nil; TMP_37.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "no block given") }; return ($a = ($b = self).$then, $a.$$p = (TMP_38 = function(values){var self = TMP_38.$$s || this, $c, $d; if (values == null) values = nil; return ($c = ($d = values).$each, $c.$$p = block.$to_proc(), $c).call($d)}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38), $a).call($b); }, TMP_37.$$arity = 0); Opal.defn(self, '$collect', TMP_39 = function $$collect() { var $a, $b, TMP_40, self = this, $iter = TMP_39.$$p, block = $iter || nil; TMP_39.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "no block given") }; return ($a = ($b = self).$then, $a.$$p = (TMP_40 = function(values){var self = TMP_40.$$s || this, $c, $d; if (values == null) values = nil; return $scope.get('When').$new(($c = ($d = values).$map, $c.$$p = block.$to_proc(), $c).call($d))}, TMP_40.$$s = self, TMP_40.$$arity = 1, TMP_40), $a).call($b); }, TMP_39.$$arity = 0); Opal.defn(self, '$inject', TMP_41 = function $$inject($a_rest) { var $b, $c, TMP_42, self = this, args, $iter = TMP_41.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_41.$$p = null; return ($b = ($c = self).$then, $b.$$p = (TMP_42 = function(values){var self = TMP_42.$$s || this, $a, $d; if (values == null) values = nil; return ($a = ($d = values).$reduce, $a.$$p = block.$to_proc(), $a).apply($d, Opal.to_a(args))}, TMP_42.$$s = self, TMP_42.$$arity = 1, TMP_42), $b).call($c); }, TMP_41.$$arity = -1); Opal.alias(self, 'map', 'collect'); Opal.alias(self, 'reduce', 'inject'); Opal.defn(self, '$wait', TMP_44 = function $$wait(promise) { var $a, $b, TMP_43, self = this; if ((($a = $scope.get('Promise')['$==='](promise)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { promise = $scope.get('Promise').$value(promise) }; if ((($a = promise['$act?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { promise = promise.$then()}; self.wait['$<<'](promise); ($a = ($b = promise).$always, $a.$$p = (TMP_43 = function(){var self = TMP_43.$$s || this, $c; if (self.next == null) self.next = nil; if ((($c = self.next['$any?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.$try() } else { return nil }}, TMP_43.$$s = self, TMP_43.$$arity = 0, TMP_43), $a).call($b); return self; }, TMP_44.$$arity = 1); Opal.alias(self, 'and', 'wait'); Opal.defn(self, '$>>', TMP_46 = function($a_rest) { var $b, $c, TMP_45, $d, $e, self = this, $iter = TMP_46.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_46.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } return ($b = ($c = ($d = ($e = self, Opal.find_super_dispatcher(self, '>>', TMP_46, false)), $d.$$p = $iter, $d).apply($e, $zuper)).$tap, $b.$$p = (TMP_45 = function(){var self = TMP_45.$$s || this; return self.$try()}, TMP_45.$$s = self, TMP_45.$$arity = 0, TMP_45), $b).call($c); }, TMP_46.$$arity = -1); return (Opal.defn(self, '$try', TMP_47 = function() { var $a, $b, $c, $d, self = this, promise = nil; if ((($a = ($b = ($c = self.wait)['$all?'], $b.$$p = "realized?".$to_proc(), $b).call($c)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = promise = ($b = ($d = self.wait).$find, $b.$$p = "rejected?".$to_proc(), $b).call($d)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$reject(promise.$error()) } else { return self.$resolve(($a = ($b = self.wait).$map, $a.$$p = "value".$to_proc(), $a).call($b)) } } else { return nil }; }, TMP_47.$$arity = 0), nil) && 'try'; })($scope.base, self); })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/jquery/http"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$require', '$to_n', '$each', '$define_singleton_method', '$send', '$new', '$define_method', '$attr_reader', '$delete', '$update', '$upcase', '$succeed', '$fail', '$promise', '$parse', '$private', '$tap', '$proc', '$ok?', '$resolve', '$reject', '$from_object', '$call']); self.$require("json"); self.$require("native"); self.$require("promise"); self.$require("opal/jquery/constants"); return (function($base, $super) { function $HTTP(){}; var self = $HTTP = $klass($base, $super, 'HTTP', $HTTP); var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_1, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_13, TMP_14, TMP_15; def.settings = def.payload = def.url = def.method = def.handler = def.json = def.body = def.ok = def.xhr = def.promise = def.status_code = nil; var $ = $scope.get('JQUERY_SELECTOR').$to_n(); Opal.cdecl($scope, 'ACTIONS', ["get", "post", "put", "delete", "patch", "head"]); ($a = ($b = $scope.get('ACTIONS')).$each, $a.$$p = (TMP_1 = function(action){var self = TMP_1.$$s || this, $c, $d, TMP_2, $e, TMP_3; if (action == null) action = nil; ($c = ($d = self).$define_singleton_method, $c.$$p = (TMP_2 = function(url, options){var self = TMP_2.$$s || this, block; block = TMP_2.$$p || nil, TMP_2.$$p = null; if (options == null) { options = $hash2([], {}); }if (url == null) url = nil; return self.$new().$send(action, url, options, block)}, TMP_2.$$s = self, TMP_2.$$arity = -2, TMP_2), $c).call($d, action); return ($c = ($e = self).$define_method, $c.$$p = (TMP_3 = function(url, options){var self = TMP_3.$$s || this, block; block = TMP_3.$$p || nil, TMP_3.$$p = null; if (options == null) { options = $hash2([], {}); }if (url == null) url = nil; return self.$send(action, url, options, block)}, TMP_3.$$s = self, TMP_3.$$arity = -2, TMP_3), $c).call($e, action);}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); Opal.defs(self, '$setup', TMP_4 = function $$setup() { var self = this; return $scope.get('Hash').$new($.ajaxSetup()); }, TMP_4.$$arity = 0); Opal.defs(self, '$setup=', TMP_5 = function(settings) { var self = this; return $.ajaxSetup(settings.$to_n()); }, TMP_5.$$arity = 1); self.$attr_reader("body", "error_message", "method", "status_code", "url", "xhr"); Opal.defn(self, '$initialize', TMP_6 = function $$initialize() { var self = this; self.settings = $hash2([], {}); return self.ok = true; }, TMP_6.$$arity = 0); Opal.defn(self, '$send', TMP_7 = function $$send(method, url, options, block) { var $a, self = this, settings = nil, payload = nil; self.method = method; self.url = url; self.payload = options.$delete("payload"); self.handler = block; self.settings.$update(options); $a = [self.settings.$to_n(), self.payload], settings = $a[0], payload = $a[1], $a; if (typeof(payload) === 'string') { settings.data = payload; } else if (payload != nil) { settings.data = payload.$to_json(); settings.contentType = 'application/json'; } settings.url = self.url; settings.type = self.method.$upcase(); settings.success = function(data, status, xhr) { return self.$succeed(data, status, xhr); }; settings.error = function(xhr, status, error) { return self.$fail(xhr, status, error); }; $.ajax(settings); ; if ((($a = self.handler) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self } else { return self.$promise() }; }, TMP_7.$$arity = 4); Opal.defn(self, '$json', TMP_8 = function $$json() { var $a, self = this; return ((($a = self.json) !== false && $a !== nil && $a != null) ? $a : self.json = $scope.get('JSON').$parse(self.body)); }, TMP_8.$$arity = 0); Opal.defn(self, '$ok?', TMP_9 = function() { var self = this; return self.ok; }, TMP_9.$$arity = 0); Opal.defn(self, '$get_header', TMP_10 = function $$get_header(key) { var self = this; var value = self.xhr.getResponseHeader(key); return (value === null) ? nil : value; ; }, TMP_10.$$arity = 1); self.$private(); Opal.defn(self, '$promise', TMP_13 = function $$promise() { var $a, $b, TMP_11, self = this; if ((($a = self.promise) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.promise}; return self.promise = ($a = ($b = $scope.get('Promise').$new()).$tap, $a.$$p = (TMP_11 = function(promise){var self = TMP_11.$$s || this, $c, $d, TMP_12; if (promise == null) promise = nil; return self.handler = ($c = ($d = self).$proc, $c.$$p = (TMP_12 = function(res){var self = TMP_12.$$s || this, $e; if (res == null) res = nil; if ((($e = res['$ok?']()) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { return promise.$resolve(res) } else { return promise.$reject(res) }}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12), $c).call($d)}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11), $a).call($b); }, TMP_13.$$arity = 0); Opal.defn(self, '$succeed', TMP_14 = function $$succeed(data, status, xhr) { var $a, self = this; self.body = data; self.xhr = xhr; self.status_code = xhr.status; if (typeof(data) === 'object') { self.json = $scope.get('JSON').$from_object(data); } ; if ((($a = self.handler) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.handler.$call(self) } else { return nil }; }, TMP_14.$$arity = 3); return (Opal.defn(self, '$fail', TMP_15 = function $$fail(xhr, status, error) { var $a, self = this; self.body = xhr.responseText; self.xhr = xhr; self.status_code = xhr.status; ; self.ok = false; if ((($a = self.handler) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.handler.$call(self) } else { return nil }; }, TMP_15.$$arity = 3), nil) && 'fail'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/jquery/kernel"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; return (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_1; Opal.defn(self, '$alert', TMP_1 = function $$alert(msg) { var self = this; alert(msg); return nil; }, TMP_1.$$arity = 1) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/jquery"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$==', '$require']); if ($scope.get('RUBY_ENGINE')['$==']("opal")) { self.$require("opal/jquery/window"); self.$require("opal/jquery/document"); self.$require("opal/jquery/element"); self.$require("opal/jquery/event"); self.$require("opal/jquery/http"); return self.$require("opal/jquery/kernel");} }; /* Generated by Opal 0.10.4 */ Opal.modules["opal-jquery"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); return self.$require("opal/jquery") }; /* Generated by Opal 0.10.4 */ Opal.modules["hyperloop/component/version"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Component(){}; var self = $Component = $klass($base, $super, 'Component', $Component); var def = self.$$proto, $scope = self.$$scope; return Opal.cdecl($scope, 'VERSION', "0.12.3") })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyperloop/client_stubs"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_1, TMP_2, TMP_3; Opal.defn(self, '$import', TMP_1 = function($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return nil; }, TMP_1.$$arity = -1); Opal.defn(self, '$imports', TMP_2 = function $$imports($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return nil; }, TMP_2.$$arity = -1); return (Opal.defn(self, '$import_tree', TMP_3 = function $$import_tree($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return nil; }, TMP_3.$$arity = -1), nil) && 'import_tree'; })(Opal.get_singleton_class(self)) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyperloop/context"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2; Opal.add_stubs(['$instance_variable_get', '$!', '$key?', '$[]', '$[]=', '$dup', '$instance_variable_set', '$each', '$run', '$new']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Context, self = $Context = $module($base, 'Context'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_5; Opal.defs(self, '$set_var', TMP_1 = function $$set_var(ctx, var$, $kwargs) { var $a, $b, $c, self = this, force, $iter = TMP_1.$$p, $yield = $iter || nil, inst_value_b4 = nil; if (self.context == null) self.context = nil; if ($kwargs == null || !$kwargs.$$is_hash) { if ($kwargs == null) { $kwargs = $hash2([], {}); } else { throw Opal.ArgumentError.$new('expected kwargs'); } } if ((force = $kwargs.$$smap['force']) == null) { force = nil } TMP_1.$$p = null; inst_value_b4 = ctx.$instance_variable_get(var$); if ((($a = ($b = ($c = self.context, $c !== false && $c !== nil && $c != null ?self.context['$[]'](ctx)['$key?'](var$)['$!']() : $c), $b !== false && $b !== nil && $b != null ?(((($c = force) !== false && $c !== nil && $c != null) ? $c : inst_value_b4['$!']())) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.context['$[]'](ctx)['$[]='](var$, ((($a = inst_value_b4 !== false && inst_value_b4 !== nil && inst_value_b4 != null) ? inst_value_b4.$dup() : inst_value_b4)))}; return ((($a = inst_value_b4) !== false && $a !== nil && $a != null) ? $a : ctx.$instance_variable_set(var$, Opal.yieldX($yield, []))); }, TMP_1.$$arity = -3); Opal.defs(self, '$reset!', TMP_5 = function(reboot) { var $a, $b, TMP_2, $c, TMP_4, self = this; if (self.context == null) self.context = nil; if (reboot == null) { reboot = true; } if ((($a = self.context) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { ($a = ($b = self.context).$each, $a.$$p = (TMP_2 = function(ctx, vars){var self = TMP_2.$$s || this, $c, $d, TMP_3; if (ctx == null) ctx = nil;if (vars == null) vars = nil; return ($c = ($d = vars).$each, $c.$$p = (TMP_3 = function(var$, init){var self = TMP_3.$$s || this; if (var$ == null) var$ = nil;if (init == null) init = nil; return ctx.$instance_variable_set(var$, init)}, TMP_3.$$s = self, TMP_3.$$arity = 2, TMP_3), $c).call($d)}, TMP_2.$$s = self, TMP_2.$$arity = 2, TMP_2), $a).call($b); if (reboot !== false && reboot !== nil && reboot != null) { return (((($scope.get('Hyperloop')).$$scope.get('Application'))).$$scope.get('Boot')).$run() } else { return nil }; } else { return self.context = ($a = ($c = $scope.get('Hash')).$new, $a.$$p = (TMP_4 = function(h, k){var self = TMP_4.$$s || this; if (h == null) h = nil;if (k == null) k = nil; return h['$[]='](k, $hash2([], {}))}, TMP_4.$$s = self, TMP_4.$$arity = 2, TMP_4), $a).call($c) }; }, TMP_5.$$arity = -1); })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyperloop/on_client"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$==', '$!']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope, TMP_1; Opal.defs(self, '$on_client?', TMP_1 = function() { var self = this; if ($scope.get('RUBY_ENGINE')['$==']("opal")) { return ((typeof Opal.global.document === 'undefined'))['$!']()}; }, TMP_1.$$arity = 0) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyperloop-config"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$==', '$require']); if ($scope.get('RUBY_ENGINE')['$==']("opal")) { self.$require("hyperloop/client_stubs"); self.$require("hyperloop/context"); return self.$require("hyperloop/on_client");} }; /* Generated by Opal 0.10.4 */ Opal.modules["react/hash"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$alias_method', '$_pre_react_patch_initialize', '$to_proc']); return (function($base, $super) { function $Hash(){}; var self = $Hash = $klass($base, $super, 'Hash', $Hash); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.$alias_method("_pre_react_patch_initialize", "initialize"); return (Opal.defn(self, '$initialize', TMP_1 = function $$initialize(defaults) { var $a, $b, $c, self = this, $iter = TMP_1.$$p, block = $iter || nil; TMP_1.$$p = null; if ((($a = (defaults===null)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self).$_pre_react_patch_initialize, $a.$$p = block.$to_proc(), $a).call($b) } else { return ($a = ($c = self).$_pre_react_patch_initialize, $a.$$p = block.$to_proc(), $a).call($c, defaults) }; }, TMP_1.$$arity = -1), nil) && 'initialize'; })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/object/try"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$empty?', '$respond_to?', '$first', '$try!', '$to_proc', '$zero?', '$arity', '$instance_eval', '$public_send']); (function($base, $super) { function $Object(){}; var self = $Object = $klass($base, $super, 'Object', $Object); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2; Opal.defn(self, '$try', TMP_1 = function($a_rest) { var $b, $c, self = this, a, $iter = TMP_1.$$p, b = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } a = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { a[$arg_idx - 0] = arguments[$arg_idx]; } TMP_1.$$p = null; if ((($b = ((($c = a['$empty?']()) !== false && $c !== nil && $c != null) ? $c : self['$respond_to?'](a.$first()))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return ($b = ($c = self)['$try!'], $b.$$p = b.$to_proc(), $b).apply($c, Opal.to_a(a)) } else { return nil }; }, TMP_1.$$arity = -1); return (Opal.defn(self, '$try!', TMP_2 = function($a_rest) { var $b, $c, $d, self = this, a, $iter = TMP_2.$$p, b = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } a = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { a[$arg_idx - 0] = arguments[$arg_idx]; } TMP_2.$$p = null; if ((($b = ($c = a['$empty?'](), $c !== false && $c !== nil && $c != null ?(b !== nil) : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = b.$arity()['$zero?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return ($b = ($c = self).$instance_eval, $b.$$p = b.$to_proc(), $b).call($c) } else { return Opal.yield1(b, self); } } else { return ($b = ($d = self).$public_send, $b.$$p = b.$to_proc(), $b).apply($d, Opal.to_a(a)) }; }, TMP_2.$$arity = -1), nil) && 'try!'; })($scope.base, null); return (function($base, $super) { function $NilClass(){}; var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); var def = self.$$proto, $scope = self.$$scope, TMP_3, TMP_4; Opal.defn(self, '$try', TMP_3 = function($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return nil; }, TMP_3.$$arity = -1); return (Opal.defn(self, '$try!', TMP_4 = function($a_rest) { var self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return nil; }, TMP_4.$$arity = -1), nil) && 'try!'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["react/component/tags"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$+', '$render', '$to_proc', '$each', '$define_method', '$==', '$count', '$is_a?', '$first', '$p', '$!=', '$alias_method', '$upcase', '$const_set', '$downcase', '$=~', '$include?', '$create_element', '$find_component', '$method_missing', '$find_name_and_parent', '$new', '$build_only', '$extend', '$private', '$name', '$split', '$>', '$length', '$last', '$[]', '$inject', '$const_get', '$lookup_const', '$!', '$method_defined?', '$raise', '$reverse', '$to_s', '$class', '$detect', '$const_defined?']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Component, self = $Component = $module($base, 'Component'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Tags, self = $Tags = $module($base, 'Tags'); var def = self.$$proto, $scope = self.$$scope, TMP_1, $a, $b, TMP_2, TMP_4, TMP_5, TMP_12, TMP_15; Opal.cdecl($scope, 'HTML_TAGS', $rb_plus(["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr"], ["circle", "clipPath", "defs", "ellipse", "g", "line", "linearGradient", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"])); Opal.defn(self, '$present', TMP_1 = function $$present(component, $a_rest) { var $b, $c, self = this, params, $iter = TMP_1.$$p, children = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } params = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { params[$arg_idx - 1] = arguments[$arg_idx]; } TMP_1.$$p = null; return ($b = ($c = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $b.$$p = children.$to_proc(), $b).apply($c, [component].concat(Opal.to_a(params))); }, TMP_1.$$arity = -2); ($a = ($b = $scope.get('HTML_TAGS')).$each, $a.$$p = (TMP_2 = function(tag){var self = TMP_2.$$s || this, $c, $d, TMP_3; if (tag == null) tag = nil; ($c = ($d = self).$define_method, $c.$$p = (TMP_3 = function($e_rest){var self = TMP_3.$$s || this, children, params, $f, $g, $h, $i; children = TMP_3.$$p || nil, TMP_3.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } params = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { params[$arg_idx - 0] = arguments[$arg_idx]; } if (tag['$==']("p")) { if ((($f = ((($g = ((($h = children) !== false && $h !== nil && $h != null) ? $h : params.$count()['$=='](0))) !== false && $g !== nil && $g != null) ? $g : ((($h = params.$count()['$=='](1)) ? params.$first()['$is_a?']($scope.get('Hash')) : params.$count()['$=='](1))))) !== nil && $f != null && (!$f.$$is_boolean || $f == true))) { return ($f = ($g = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $f.$$p = children.$to_proc(), $f).apply($g, [tag].concat(Opal.to_a(params))) } else { return ($f = $scope.get('Kernel')).$p.apply($f, Opal.to_a(params)) } } else { return ($h = ($i = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $h.$$p = children.$to_proc(), $h).apply($i, [tag].concat(Opal.to_a(params))) }}, TMP_3.$$s = self, TMP_3.$$arity = -1, TMP_3), $c).call($d, tag); if ((($c = tag['$!=']("div")) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$alias_method(tag.$upcase(), tag); return self.$const_set(tag.$upcase(), tag); } else { return self.$alias_method(tag.$upcase(), tag) };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($b); Opal.defs(self, '$html_tag_class_for', TMP_4 = function $$html_tag_class_for(tag) { var $a, $b, self = this, downcased_tag = nil; downcased_tag = tag.$downcase(); if ((($a = ($b = tag['$=~'](/[A-Z]+/), $b !== false && $b !== nil && $b != null ?$scope.get('HTML_TAGS')['$include?'](downcased_tag) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('Object').$const_set(tag, $scope.get('React').$create_element(downcased_tag)) } else { return nil }; }, TMP_4.$$arity = 1); Opal.defn(self, '$method_missing', TMP_5 = function $$method_missing(name, $a_rest) { var $b, $c, $d, self = this, params, $iter = TMP_5.$$p, children = $iter || nil, component = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } params = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { params[$arg_idx - 1] = arguments[$arg_idx]; } TMP_5.$$p = null; component = self.$find_component(name); if (component !== false && component !== nil && component != null) { return ($b = ($c = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $b.$$p = children.$to_proc(), $b).apply($c, [component].concat(Opal.to_a(params)))}; return ($b = ($d = $scope.get('Object')).$method_missing, $b.$$p = children.$to_proc(), $b).apply($d, [name].concat(Opal.to_a(params))); }, TMP_5.$$arity = -2); (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_9, TMP_11; Opal.defn(self, '$included', TMP_9 = function $$included(component) { var $a, $b, TMP_6, self = this, name = nil, parent = nil, tag_names_module = nil; $b = self.$find_name_and_parent(component), $a = Opal.to_ary($b), name = ($a[0] == null ? nil : $a[0]), parent = ($a[1] == null ? nil : $a[1]), $b; tag_names_module = ($a = ($b = $scope.get('Module')).$new, $a.$$p = (TMP_6 = function(){var self = TMP_6.$$s || this, $c, $d, TMP_7, $e, TMP_8; ($c = ($d = self).$define_method, $c.$$p = (TMP_7 = function($e_rest){var self = TMP_7.$$s || this, children, params, $f, $g; children = TMP_7.$$p || nil, TMP_7.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } params = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { params[$arg_idx - 0] = arguments[$arg_idx]; } return ($f = ($g = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $f.$$p = children.$to_proc(), $f).apply($g, [component].concat(Opal.to_a(params)))}, TMP_7.$$s = self, TMP_7.$$arity = -1, TMP_7), $c).call($d, name); return ($c = ($e = self).$define_method, $c.$$p = (TMP_8 = function($f_rest){var self = TMP_8.$$s || this, children, params, $g, $h; children = TMP_8.$$p || nil, TMP_8.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } params = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { params[$arg_idx - 0] = arguments[$arg_idx]; } return ($g = ($h = (($scope.get('React')).$$scope.get('RenderingContext'))).$build_only, $g.$$p = children.$to_proc(), $g).apply($h, [component].concat(Opal.to_a(params)))}, TMP_8.$$s = self, TMP_8.$$arity = -1, TMP_8), $c).call($e, "" + (name) + "_as_node");}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6), $a).call($b); return parent.$extend(tag_names_module); }, TMP_9.$$arity = 1); self.$private(); return (Opal.defn(self, '$find_name_and_parent', TMP_11 = function $$find_name_and_parent(component) { var $a, $b, TMP_10, self = this, split_name = nil; split_name = ($a = component.$name(), $a !== false && $a !== nil && $a != null ?component.$name().$split("::") : $a); if ((($a = (($b = split_name !== false && split_name !== nil && split_name != null) ? $rb_gt(split_name.$length(), 1) : split_name)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [split_name.$last(), ($a = ($b = split_name).$inject, $a.$$p = (TMP_10 = function(a, e){var self = TMP_10.$$s || this; if (a == null) a = nil;if (e == null) e = nil; return $rb_plus(a, [a.$last().$const_get(e)])}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10), $a).call($b, [$scope.get('Module')])['$[]'](-2)] } else { return nil }; }, TMP_11.$$arity = 1), nil) && 'find_name_and_parent'; })(Opal.get_singleton_class(self)); self.$private(); Opal.defn(self, '$find_component', TMP_12 = function $$find_component(name) { var $a, $b, self = this, component = nil; component = self.$lookup_const(name); if ((($a = (($b = component !== false && component !== nil && component != null) ? component['$method_defined?']("render")['$!']() : component)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise("" + (name) + " does not appear to be a react component.")}; return component; }, TMP_12.$$arity = 1); Opal.defn(self, '$lookup_const', TMP_15 = function $$lookup_const(name) { var $a, $b, TMP_13, $c, TMP_14, self = this, scopes = nil, scope = nil; if ((($a = name['$=~'](/^[A-Z]/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; scopes = ($a = ($b = self.$class().$name().$to_s().$split("::")).$inject, $a.$$p = (TMP_13 = function(nesting, next_const){var self = TMP_13.$$s || this; if (nesting == null) nesting = nil;if (next_const == null) next_const = nil; return $rb_plus(nesting, [nesting.$last().$const_get(next_const)])}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13), $a).call($b, [$scope.get('Module')]).$reverse(); scope = ($a = ($c = scopes).$detect, $a.$$p = (TMP_14 = function(s){var self = TMP_14.$$s || this; if (s == null) s = nil; return s['$const_defined?'](name)}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($c); if (scope !== false && scope !== nil && scope != null) { return scope.$const_get(name) } else { return nil }; }, TMP_15.$$arity = 1); })($scope.base) })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/component/base"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$==', '$to_s', '$deprecation_warning', '$include']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Component, self = $Component = $module($base, 'Component'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Base(){}; var self = $Base = $klass($base, $super, 'Base', $Base); var def = self.$$proto, $scope = self.$$scope, TMP_1; return (Opal.defs(self, '$inherited', TMP_1 = function $$inherited(child) { var self = this; if (child.$to_s()['$==']("React::Component::HyperTestDummy")) { } else { (($scope.get('React')).$$scope.get('Component')).$deprecation_warning(child, "The class name React::Component::Base has been deprecated. Use Hyperloop::Component instead.") }; return child.$include($scope.get('ComponentNoNotice')); }, TMP_1.$$arity = 1), nil) && 'inherited' })($scope.base, null) })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/top_level"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2; Opal.add_stubs(['$require', '$+', '$create_element', '$to_proc', '$!', '$Native', '$to_n', '$raise', '$include', '$class', '$kind_of?', '$build']); self.$require("native"); self.$require("active_support/core_ext/object/try"); self.$require("react/component/tags"); self.$require("react/component/base"); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_9, TMP_12, TMP_13; Opal.cdecl($scope, 'ATTRIBUTES', $rb_plus(["accept", "acceptCharset", "accessKey", "action", "allowFullScreen", "allowTransparency", "alt", "async", "autoComplete", "autoPlay", "cellPadding", "cellSpacing", "charSet", "checked", "classID", "className", "cols", "colSpan", "content", "contentEditable", "contextMenu", "controls", "coords", "crossOrigin", "data", "dateTime", "defer", "dir", "disabled", "download", "draggable", "encType", "form", "formAction", "formEncType", "formMethod", "formNoValidate", "formTarget", "frameBorder", "height", "hidden", "href", "hrefLang", "htmlFor", "httpEquiv", "icon", "id", "label", "lang", "list", "loop", "manifest", "marginHeight", "marginWidth", "max", "maxLength", "media", "mediaGroup", "method", "min", "multiple", "muted", "name", "noValidate", "open", "pattern", "placeholder", "poster", "preload", "radioGroup", "readOnly", "rel", "required", "role", "rows", "rowSpan", "sandbox", "scope", "scrolling", "seamless", "selected", "shape", "size", "sizes", "span", "spellCheck", "src", "srcDoc", "srcSet", "start", "step", "style", "tabIndex", "target", "title", "type", "useMap", "value", "width", "wmode", "dangerouslySetInnerHTML"], ["clipPath", "cx", "cy", "d", "dx", "dy", "fill", "fillOpacity", "fontFamily", "fontSize", "fx", "fy", "gradientTransform", "gradientUnits", "markerEnd", "markerMid", "markerStart", "offset", "opacity", "patternContentUnits", "patternUnits", "points", "preserveAspectRatio", "r", "rx", "ry", "spreadMethod", "stopColor", "stopOpacity", "stroke", "strokeDasharray", "strokeLinecap", "strokeOpacity", "strokeWidth", "textAnchor", "transform", "version", "viewBox", "x1", "x2", "x", "xlinkActuate", "xlinkArcrole", "xlinkHref", "xlinkRole", "xlinkShow", "xlinkTitle", "xlinkType", "xmlBase", "xmlLang", "xmlSpace", "y1", "y2", "y"])); Opal.cdecl($scope, 'HASH_ATTRIBUTES', ["data", "aria"]); Opal.cdecl($scope, 'HTML_TAGS', (((((($scope.get('React')).$$scope.get('Component'))).$$scope.get('Tags'))).$$scope.get('HTML_TAGS'))); Opal.defs(self, '$html_tag?', TMP_1 = function(name) { var self = this, tags = nil; tags = $scope.get('HTML_TAGS'); for(var i = 0; i < tags.length; i++) { if(tags[i] === name) return true; } return false; }, TMP_1.$$arity = 1); Opal.defs(self, '$html_attr?', TMP_2 = function(name) { var self = this, attrs = nil; attrs = $scope.get('ATTRIBUTES'); for(var i = 0; i < attrs.length; i++) { if(attrs[i] === name) return true; } return false; }, TMP_2.$$arity = 1); Opal.defs(self, '$create_element', TMP_3 = function $$create_element(type, properties) { var $a, $b, self = this, $iter = TMP_3.$$p, block = $iter || nil; if (properties == null) { properties = $hash2([], {}); } TMP_3.$$p = null; return ($a = ($b = (($scope.get('React')).$$scope.get('API'))).$create_element, $a.$$p = block.$to_proc(), $a).call($b, type, properties); }, TMP_3.$$arity = -2); Opal.defs(self, '$render', TMP_4 = function $$render(element, container) { var $a, self = this, $iter = TMP_4.$$p, $yield = $iter || nil, component = nil; TMP_4.$$p = null; console.error( "Warning: Using deprecated behavior of `React.render`,", "require \"react/top_level_render\" to get the correct behavior." ); container = container.$$class ? container[0] : container; if ((($a = ((typeof ReactDOM === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { component = self.$Native(ReactDOM.render(element.$to_n(), container, function(){(function() {if (($yield !== nil)) { return Opal.yieldX($yield, []); } else { return nil }; return nil; })()})) } else if ((($a = ((typeof React.renderToString === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { component = self.$Native(React.render(element.$to_n(), container, function(){(function() {if (($yield !== nil)) { return Opal.yieldX($yield, []); } else { return nil }; return nil; })()})) } else { self.$raise("render is not defined. In React >= v15 you must import it with ReactDOM") }; component.$class().$include((((($scope.get('React')).$$scope.get('Component'))).$$scope.get('API'))); return component; }, TMP_4.$$arity = 2); Opal.defs(self, '$is_valid_element', TMP_5 = function $$is_valid_element(element) { var $a, self = this; console.error("Warning: `is_valid_element` is deprecated in favor of `is_valid_element?`."); return ($a = element['$kind_of?']((($scope.get('React')).$$scope.get('Element'))), $a !== false && $a !== nil && $a != null ?React.isValidElement(element.$to_n()) : $a); }, TMP_5.$$arity = 1); Opal.defs(self, '$is_valid_element?', TMP_6 = function(element) { var $a, self = this; return ($a = element['$kind_of?']((($scope.get('React')).$$scope.get('Element'))), $a !== false && $a !== nil && $a != null ?React.isValidElement(element.$to_n()) : $a); }, TMP_6.$$arity = 1); Opal.defs(self, '$render_to_string', TMP_9 = function $$render_to_string(element) { var $a, $b, TMP_7, $c, TMP_8, self = this; console.error("Warning: `React.render_to_string` is deprecated in favor of `React::Server.render_to_string`."); if ((($a = ((typeof ReactDOMServer === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = (($scope.get('React')).$$scope.get('RenderingContext'))).$build, $a.$$p = (TMP_7 = function(){var self = TMP_7.$$s || this; return ReactDOMServer.renderToString(element.$to_n());}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7), $a).call($b) } else if ((($a = ((typeof React.renderToString === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($c = (($scope.get('React')).$$scope.get('RenderingContext'))).$build, $a.$$p = (TMP_8 = function(){var self = TMP_8.$$s || this; return React.renderToString(element.$to_n());}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8), $a).call($c) } else { return self.$raise("renderToString is not defined. In React >= v15 you must import it with ReactDOMServer") }; }, TMP_9.$$arity = 1); Opal.defs(self, '$render_to_static_markup', TMP_12 = function $$render_to_static_markup(element) { var $a, $b, TMP_10, $c, TMP_11, self = this; console.error("Warning: `React.render_to_static_markup` is deprecated in favor of `React::Server.render_to_static_markup`."); if ((($a = ((typeof ReactDOMServer === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = (($scope.get('React')).$$scope.get('RenderingContext'))).$build, $a.$$p = (TMP_10 = function(){var self = TMP_10.$$s || this; return ReactDOMServer.renderToStaticMarkup(element.$to_n());}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10), $a).call($b) } else if ((($a = ((typeof React.renderToString === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($c = (($scope.get('React')).$$scope.get('RenderingContext'))).$build, $a.$$p = (TMP_11 = function(){var self = TMP_11.$$s || this; return React.renderToStaticMarkup(element.$to_n());}, TMP_11.$$s = self, TMP_11.$$arity = 0, TMP_11), $a).call($c) } else { return self.$raise("renderToStaticMarkup is not defined. In React >= v15 you must import it with ReactDOMServer") }; }, TMP_12.$$arity = 1); Opal.defs(self, '$unmount_component_at_node', TMP_13 = function $$unmount_component_at_node(node) { var $a, self = this; if ((($a = ((typeof ReactDOM === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ReactDOM.unmountComponentAtNode(node.$$class ? node[0] : node); } else if ((($a = ((typeof React.renderToString === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return React.unmountComponentAtNode(node.$$class ? node[0] : node); } else { return self.$raise("unmountComponentAtNode is not defined. In React >= v15 you must import it with ReactDOM") }; }, TMP_13.$$arity = 1); })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["react/observable"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$tap', '$call', '$send', '$to_proc', '$include?', '$respond_to?', '$lambda']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Observable(){}; var self = $Observable = $klass($base, $super, 'Observable', $Observable); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_4, TMP_5, TMP_7; def.value = def.on_change = nil; Opal.defn(self, '$initialize', TMP_1 = function $$initialize(value, on_change) { var $a, self = this, $iter = TMP_1.$$p, block = $iter || nil; if (on_change == null) { on_change = nil; } TMP_1.$$p = null; self.value = value; return self.on_change = ((($a = on_change) !== false && $a !== nil && $a != null) ? $a : block); }, TMP_1.$$arity = -2); Opal.defn(self, '$method_missing', TMP_2 = function $$method_missing(method_sym, $a_rest) { var $b, $c, TMP_3, $d, $e, self = this, args, $iter = TMP_2.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_2.$$p = null; return ($b = ($c = ($d = ($e = self.value).$send, $d.$$p = block.$to_proc(), $d).apply($e, [method_sym].concat(Opal.to_a(args)))).$tap, $b.$$p = (TMP_3 = function(result){var self = TMP_3.$$s || this; if (self.on_change == null) self.on_change = nil; if (self.value == null) self.value = nil; if (result == null) result = nil; return self.on_change.$call(self.value)}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $b).call($c); }, TMP_2.$$arity = -2); Opal.defn(self, '$respond_to?', TMP_4 = function(method, $a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } if ((($b = ["call", "to_proc"]['$include?'](method)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return true } else { return ($b = self.value)['$respond_to?'].apply($b, [method].concat(Opal.to_a(args))) }; }, TMP_4.$$arity = -2); Opal.defn(self, '$call', TMP_5 = function $$call(new_value) { var self = this; self.on_change.$call(new_value); return self.value = new_value; }, TMP_5.$$arity = 1); return (Opal.defn(self, '$to_proc', TMP_7 = function $$to_proc() { var $a, $b, TMP_6, self = this; return ($a = ($b = self).$lambda, $a.$$p = (TMP_6 = function(arg){var self = TMP_6.$$s || this; if (self.value == null) self.value = nil; if (self.on_change == null) self.on_change = nil; if (arg == null) { arg = self.value; } return self.on_change.$call(arg)}, TMP_6.$$s = self, TMP_6.$$arity = -1, TMP_6), $a).call($b); }, TMP_7.$$arity = 0), nil) && 'to_proc'; })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/validator"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$attr_accessor', '$attr_reader', '$private', '$new', '$build', '$to_proc', '$instance_eval', '$[]=', '$define_rule', '$allow_undefined_props=', '$reject', '$[]', '$rules', '$errors=', '$allow_undefined_props?', '$validate_undefined', '$coerce_native_hash_values', '$defined_props', '$validate_required', '$each', '$validate_types', '$validate_allowed', '$errors', '$inject', '$select', '$include?', '$keys', '$!', '$define_param', '$props_wrapper', '$is_a?', '$type_check', '$>', '$length', '$validate_value_array', '$nil?', '$respond_to?', '$_react_param_conversion', '$<<', '$-', '$each_with_index', '$Native']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Validator(){}; var self = $Validator = $klass($base, $super, 'Validator', $Validator); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_8, TMP_10, TMP_13, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_24, TMP_26, TMP_28, TMP_30; def.allow_undefined_props = def.rules = def.errors = nil; self.$attr_accessor("errors"); self.$attr_reader("props_wrapper"); self.$private("errors", "props_wrapper"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(props_wrapper) { var self = this; if (props_wrapper == null) { props_wrapper = $scope.get('Class').$new((($scope.get('Component')).$$scope.get('PropsWrapper'))); } return self.props_wrapper = props_wrapper; }, TMP_1.$$arity = -1); Opal.defs(self, '$build', TMP_2 = function $$build() { var $a, $b, self = this, $iter = TMP_2.$$p, block = $iter || nil; TMP_2.$$p = null; return ($a = ($b = self.$new()).$build, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_2.$$arity = 0); Opal.defn(self, '$build', TMP_3 = function $$build() { var $a, $b, self = this, $iter = TMP_3.$$p, block = $iter || nil; TMP_3.$$p = null; ($a = ($b = self).$instance_eval, $a.$$p = block.$to_proc(), $a).call($b); return self; }, TMP_3.$$arity = 0); Opal.defn(self, '$requires', TMP_4 = function $$requires(name, options) { var self = this; if (options == null) { options = $hash2([], {}); } options['$[]=']("required", true); return self.$define_rule(name, options); }, TMP_4.$$arity = -2); Opal.defn(self, '$optional', TMP_5 = function $$optional(name, options) { var self = this; if (options == null) { options = $hash2([], {}); } options['$[]=']("required", false); return self.$define_rule(name, options); }, TMP_5.$$arity = -2); Opal.defn(self, '$allow_undefined_props=', TMP_6 = function(allow) { var self = this; return self.allow_undefined_props = allow; }, TMP_6.$$arity = 1); Opal.defn(self, '$undefined_props', TMP_8 = function $$undefined_props(props) { var $a, $b, TMP_7, self = this; (($a = [true]), $b = self, $b['$allow_undefined_props='].apply($b, $a), $a[$a.length-1]); return ($a = ($b = props).$reject, $a.$$p = (TMP_7 = function(name, value){var self = TMP_7.$$s || this; if (name == null) name = nil;if (value == null) value = nil; return self.$rules()['$[]'](name)}, TMP_7.$$s = self, TMP_7.$$arity = 2, TMP_7), $a).call($b); }, TMP_8.$$arity = 1); Opal.defn(self, '$validate', TMP_10 = function $$validate(props) { var $a, $b, TMP_9, self = this; (($a = [[]]), $b = self, $b['$errors='].apply($b, $a), $a[$a.length-1]); if ((($a = self['$allow_undefined_props?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$validate_undefined(props) }; props = self.$coerce_native_hash_values(self.$defined_props(props)); self.$validate_required(props); ($a = ($b = props).$each, $a.$$p = (TMP_9 = function(name, value){var self = TMP_9.$$s || this; if (name == null) name = nil;if (value == null) value = nil; self.$validate_types(name, value); return self.$validate_allowed(name, value);}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9), $a).call($b); return self.$errors(); }, TMP_10.$$arity = 1); Opal.defn(self, '$default_props', TMP_13 = function $$default_props() { var $a, $b, TMP_11, $c, $d, TMP_12, self = this; return ($a = ($b = ($c = ($d = self.$rules()).$select, $c.$$p = (TMP_12 = function(key, value){var self = TMP_12.$$s || this; if (key == null) key = nil;if (value == null) value = nil; return value.$keys()['$include?']("default")}, TMP_12.$$s = self, TMP_12.$$arity = 2, TMP_12), $c).call($d)).$inject, $a.$$p = (TMP_11 = function(memo, $c){var self = TMP_11.$$s || this, $c_args, k, v; if ($c == null) { $c = nil; } $c = Opal.to_ary($c); $c_args = Opal.slice.call($c, 0, $c.length); k = $c_args.splice(0,1)[0]; if (k == null) { k = nil; } v = $c_args.splice(0,1)[0]; if (v == null) { v = nil; }if (memo == null) memo = nil; memo['$[]='](k, v['$[]']("default")); return memo;}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11.$$has_top_level_mlhs_arg = true, TMP_11), $a).call($b, $hash2([], {})); }, TMP_13.$$arity = 0); self.$private(); Opal.defn(self, '$defined_props', TMP_15 = function $$defined_props(props) { var $a, $b, TMP_14, self = this; return ($a = ($b = props).$select, $a.$$p = (TMP_14 = function(name){var self = TMP_14.$$s || this; if (name == null) name = nil; return self.$rules().$keys()['$include?'](name)}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($b); }, TMP_15.$$arity = 1); Opal.defn(self, '$allow_undefined_props?', TMP_16 = function() { var self = this; return self.allow_undefined_props['$!']()['$!'](); }, TMP_16.$$arity = 0); Opal.defn(self, '$rules', TMP_17 = function $$rules() { var $a, self = this; return ((($a = self.rules) !== false && $a !== nil && $a != null) ? $a : self.rules = $hash2(["children"], {"children": $hash2(["required"], {"required": false})})); }, TMP_17.$$arity = 0); Opal.defn(self, '$define_rule', TMP_18 = function $$define_rule(name, options) { var self = this; if (options == null) { options = $hash2([], {}); } self.$rules()['$[]='](name, self.$coerce_native_hash_values(options)); return self.$props_wrapper().$define_param(name, options['$[]']("type")); }, TMP_18.$$arity = -2); Opal.defn(self, '$errors', TMP_19 = function $$errors() { var $a, self = this; return ((($a = self.errors) !== false && $a !== nil && $a != null) ? $a : self.errors = []); }, TMP_19.$$arity = 0); Opal.defn(self, '$validate_types', TMP_20 = function $$validate_types(prop_name, value) { var $a, self = this, klass = nil, allow_nil = nil; if ((($a = klass = self.$rules()['$[]'](prop_name)['$[]']("type")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; if ((($a = klass['$is_a?']($scope.get('Array'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { allow_nil = self.$rules()['$[]'](prop_name)['$[]']("allow_nil")['$!']()['$!'](); return self.$type_check("`" + (prop_name) + "`", value, klass, allow_nil); } else if ((($a = $rb_gt(klass.$length(), 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$validate_value_array(prop_name, value) } else { allow_nil = self.$rules()['$[]'](prop_name)['$[]']("allow_nil")['$!']()['$!'](); return self.$type_check("`" + (prop_name) + "`", value, $scope.get('Array'), allow_nil); }; }, TMP_20.$$arity = 2); Opal.defn(self, '$type_check', TMP_21 = function $$type_check(prop_name, value, klass, allow_nil) { var $a, $b, self = this; if ((($a = (($b = allow_nil !== false && allow_nil !== nil && allow_nil != null) ? value['$nil?']() : allow_nil)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; if ((($a = value['$is_a?'](klass)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; if ((($a = ($b = klass['$respond_to?']("_react_param_conversion"), $b !== false && $b !== nil && $b != null ?klass.$_react_param_conversion(value, "validate_only") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; return self.$errors()['$<<']("Provided prop " + (prop_name) + " could not be converted to " + (klass)); }, TMP_21.$$arity = 4); Opal.defn(self, '$validate_allowed', TMP_22 = function $$validate_allowed(prop_name, value) { var $a, self = this, values = nil; if ((($a = values = self.$rules()['$[]'](prop_name)['$[]']("values")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; if ((($a = values['$include?'](value)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; return self.$errors()['$<<']("Value `" + (value) + "` for prop `" + (prop_name) + "` is not an allowed value"); }, TMP_22.$$arity = 2); Opal.defn(self, '$validate_required', TMP_24 = function $$validate_required(props) { var $a, $b, TMP_23, self = this; return ($a = ($b = ($rb_minus(self.$rules().$keys(), props.$keys()))).$each, $a.$$p = (TMP_23 = function(name){var self = TMP_23.$$s || this, $c; if (name == null) name = nil; if ((($c = self.$rules()['$[]'](name)['$[]']("required")) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { return nil; }; return self.$errors()['$<<']("Required prop `" + (name) + "` was not specified");}, TMP_23.$$s = self, TMP_23.$$arity = 1, TMP_23), $a).call($b); }, TMP_24.$$arity = 1); Opal.defn(self, '$validate_undefined', TMP_26 = function $$validate_undefined(props) { var $a, $b, TMP_25, self = this; return ($a = ($b = ($rb_minus(props.$keys(), self.$rules().$keys()))).$each, $a.$$p = (TMP_25 = function(prop_name){var self = TMP_25.$$s || this; if (prop_name == null) prop_name = nil; return self.$errors()['$<<']("Provided prop `" + (prop_name) + "` not specified in spec")}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25), $a).call($b); }, TMP_26.$$arity = 1); Opal.defn(self, '$validate_value_array', TMP_28 = function $$validate_value_array(name, value) { var $a, $b, TMP_27, self = this, klass = nil, allow_nil = nil; try { klass = self.$rules()['$[]'](name)['$[]']("type"); allow_nil = self.$rules()['$[]'](name)['$[]']("allow_nil")['$!']()['$!'](); return ($a = ($b = value).$each_with_index, $a.$$p = (TMP_27 = function(item, index){var self = TMP_27.$$s || this; if (item == null) item = nil;if (index == null) index = nil; return self.$type_check("`" + (name) + "`[" + (index) + "]", self.$Native(item), klass['$[]'](0), allow_nil)}, TMP_27.$$s = self, TMP_27.$$arity = 2, TMP_27), $a).call($b); } catch ($err) { if (Opal.rescue($err, [$scope.get('NoMethodError')])) { try { return self.$errors()['$<<']("Provided prop `" + (name) + "` was not an Array") } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_28.$$arity = 2); return (Opal.defn(self, '$coerce_native_hash_values', TMP_30 = function $$coerce_native_hash_values(hash) { var $a, $b, TMP_29, self = this; return ($a = ($b = hash).$each, $a.$$p = (TMP_29 = function(key, value){var self = TMP_29.$$s || this; if (key == null) key = nil;if (value == null) value = nil; return hash['$[]='](key, self.$Native(value))}, TMP_29.$$s = self, TMP_29.$$arity = 2, TMP_29), $a).call($b); }, TMP_30.$$arity = 1), nil) && 'coerce_native_hash_values'; })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/ext/string"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; return (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); var def = self.$$proto, $scope = self.$$scope, TMP_1; return (Opal.defn(self, '$event_camelize', TMP_1 = function $$event_camelize() { var self = this; return self.replace(/(^|_)([^_]+)/g, function(match, pre, word, index) { var capitalize = true; return capitalize ? word.substr(0,1).toUpperCase()+word.substr(1) : word; }); }, TMP_1.$$arity = 0), nil) && 'event_camelize' })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/ext/hash"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$map']); return (function($base, $super) { function $Hash(){}; var self = $Hash = $klass($base, $super, 'Hash', $Hash); var def = self.$$proto, $scope = self.$$scope, TMP_2; return (Opal.defn(self, '$shallow_to_n', TMP_2 = function $$shallow_to_n() { var $a, $b, TMP_1, self = this, hash = nil; hash = {}; ($a = ($b = self).$map, $a.$$p = (TMP_1 = function(key, value){var self = TMP_1.$$s || this; if (key == null) key = nil;if (value == null) value = nil; return hash[key] = value;}, TMP_1.$$s = self, TMP_1.$$arity = 2, TMP_1), $a).call($b); return hash; }, TMP_2.$$arity = 0), nil) && 'shallow_to_n' })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/kernel/singleton_class"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$class_eval', '$to_proc', '$singleton_class']); return (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_1; Opal.defn(self, '$class_eval', TMP_1 = function $$class_eval($a_rest) { var $b, $c, self = this, args, $iter = TMP_1.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_1.$$p = null; return ($b = ($c = self.$singleton_class()).$class_eval, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_1.$$arity = -1) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/module/remove_method"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$method_defined?', '$private_method_defined?', '$undef_method', '$remove_possible_method', '$define_method', '$to_proc']); return (function($base, $super) { function $Module(){}; var self = $Module = $klass($base, $super, 'Module', $Module); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2; Opal.defn(self, '$remove_possible_method', TMP_1 = function $$remove_possible_method(method) { var $a, $b, self = this; if ((($a = ((($b = self['$method_defined?'](method)) !== false && $b !== nil && $b != null) ? $b : self['$private_method_defined?'](method))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$undef_method(method) } else { return nil }; }, TMP_1.$$arity = 1); return (Opal.defn(self, '$redefine_method', TMP_2 = function $$redefine_method(method) { var $a, $b, self = this, $iter = TMP_2.$$p, block = $iter || nil; TMP_2.$$p = null; self.$remove_possible_method(method); return ($a = ($b = self).$define_method, $a.$$p = block.$to_proc(), $a).call($b, method); }, TMP_2.$$arity = 1), nil) && 'redefine_method'; })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/array/extract_options"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$instance_of?', '$is_a?', '$last', '$extractable_options?', '$pop']); (function($base, $super) { function $Hash(){}; var self = $Hash = $klass($base, $super, 'Hash', $Hash); var def = self.$$proto, $scope = self.$$scope, TMP_1; return (Opal.defn(self, '$extractable_options?', TMP_1 = function() { var self = this; return self['$instance_of?']($scope.get('Hash')); }, TMP_1.$$arity = 0), nil) && 'extractable_options?' })($scope.base, null); return (function($base, $super) { function $Array(){}; var self = $Array = $klass($base, $super, 'Array', $Array); var def = self.$$proto, $scope = self.$$scope, TMP_2; return (Opal.defn(self, '$extract_options!', TMP_2 = function() { var $a, $b, self = this; if ((($a = ($b = self.$last()['$is_a?']($scope.get('Hash')), $b !== false && $b !== nil && $b != null ?self.$last()['$extractable_options?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$pop() } else { return $hash2([], {}) }; }, TMP_2.$$arity = 0), nil) && 'extract_options!' })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/class/attribute"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$extract_options!', '$fetch', '$each', '$define_singleton_method', '$!', '$public_send', '$class_eval', '$remove_possible_method', '$define_method', '$singleton_class', '$singleton_class?', '$instance_variable_defined?', '$instance_variable_get', '$send', '$class', '$attr_writer', '$private', '$respond_to?', '$!=', '$first', '$ancestors']); self.$require("active_support/core_ext/kernel/singleton_class"); self.$require("active_support/core_ext/module/remove_method"); self.$require("active_support/core_ext/array/extract_options"); return (function($base, $super) { function $Class(){}; var self = $Class = $klass($base, $super, 'Class', $Class); var def = self.$$proto, $scope = self.$$scope, TMP_11, $a, TMP_12; Opal.defn(self, '$class_attribute', TMP_11 = function $$class_attribute($a_rest) { var $b, $c, TMP_1, self = this, attrs, options = nil, instance_reader = nil, instance_writer = nil, instance_predicate = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } attrs = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { attrs[$arg_idx - 0] = arguments[$arg_idx]; } options = attrs['$extract_options!'](); instance_reader = ($b = options.$fetch("instance_accessor", true), $b !== false && $b !== nil && $b != null ?options.$fetch("instance_reader", true) : $b); instance_writer = ($b = options.$fetch("instance_accessor", true), $b !== false && $b !== nil && $b != null ?options.$fetch("instance_writer", true) : $b); instance_predicate = options.$fetch("instance_predicate", true); return ($b = ($c = attrs).$each, $b.$$p = (TMP_1 = function(name){var self = TMP_1.$$s || this, $a, $d, TMP_2, $e, TMP_3, $f, TMP_4, $g, TMP_9, $h, TMP_10, ivar = nil; if (name == null) name = nil; ($a = ($d = self).$define_singleton_method, $a.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this; return nil}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $a).call($d, name); if (instance_predicate !== false && instance_predicate !== nil && instance_predicate != null) { ($a = ($e = self).$define_singleton_method, $a.$$p = (TMP_3 = function(){var self = TMP_3.$$s || this; return self.$public_send(name)['$!']()['$!']()}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3), $a).call($e, "" + (name) + "?")}; ivar = "@" + (name); ($a = ($f = self).$define_singleton_method, $a.$$p = (TMP_4 = function(val){var self = TMP_4.$$s || this, $g, $h, TMP_5, $i, TMP_7; if (val == null) val = nil; ($g = ($h = self.$singleton_class()).$class_eval, $g.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this, $i, $j, TMP_6; self.$remove_possible_method(name); return ($i = ($j = self).$define_method, $i.$$p = (TMP_6 = function(){var self = TMP_6.$$s || this; return val}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6), $i).call($j, name);}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $g).call($h); if ((($g = self['$singleton_class?']()) !== nil && $g != null && (!$g.$$is_boolean || $g == true))) { ($g = ($i = self).$class_eval, $g.$$p = (TMP_7 = function(){var self = TMP_7.$$s || this, $j, $k, TMP_8; self.$remove_possible_method(name); return ($j = ($k = self).$define_method, $j.$$p = (TMP_8 = function(){var self = TMP_8.$$s || this, $l; if ((($l = self['$instance_variable_defined?'](ivar)) !== nil && $l != null && (!$l.$$is_boolean || $l == true))) { return self.$instance_variable_get(ivar) } else { return self.$singleton_class().$send(name) }}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8), $j).call($k, name);}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7), $g).call($i)}; return val;}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $a).call($f, "" + (name) + "="); if (instance_reader !== false && instance_reader !== nil && instance_reader != null) { self.$remove_possible_method(name); ($a = ($g = self).$define_method, $a.$$p = (TMP_9 = function(){var self = TMP_9.$$s || this, $h; if ((($h = self['$instance_variable_defined?'](ivar)) !== nil && $h != null && (!$h.$$is_boolean || $h == true))) { return self.$instance_variable_get(ivar) } else { return self.$class().$public_send(name) }}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9), $a).call($g, name); if (instance_predicate !== false && instance_predicate !== nil && instance_predicate != null) { ($a = ($h = self).$define_method, $a.$$p = (TMP_10 = function(){var self = TMP_10.$$s || this; return self.$public_send(name)['$!']()['$!']()}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10), $a).call($h, "" + (name) + "?")};}; if (instance_writer !== false && instance_writer !== nil && instance_writer != null) { return self.$attr_writer(name) } else { return nil };}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $b).call($c); }, TMP_11.$$arity = -1); self.$private(); if ((($a = self['$respond_to?']("singleton_class?")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return (Opal.defn(self, '$singleton_class?', TMP_12 = function() { var $a, self = this; return ((($a = true) !== false && $a !== nil && $a != null) ? $a : self.$ancestors().$first()['$!='](self)); }, TMP_12.$$arity = 0), nil) && 'singleton_class?' }; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["react/callbacks"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2; Opal.add_stubs(['$require', '$extend', '$each', '$is_a?', '$instance_exec', '$to_proc', '$send', '$callbacks_for', '$class', '$define_singleton_method', '$set_var', '$concat', '$push', '$+', '$respond_to?', '$superclass']); self.$require("hyperloop-config"); (($scope.get('Hyperloop')).$$scope.get('Context')); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Callbacks, self = $Callbacks = $module($base, 'Callbacks'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_3; Opal.defs(self, '$included', TMP_1 = function $$included(base) { var self = this; return base.$extend($scope.get('ClassMethods')); }, TMP_1.$$arity = 1); Opal.defn(self, '$run_callback', TMP_3 = function $$run_callback(name, $a_rest) { var $b, $c, TMP_2, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } return ($b = ($c = self.$class().$callbacks_for(name)).$each, $b.$$p = (TMP_2 = function(callback){var self = TMP_2.$$s || this, $a, $d; if (callback == null) callback = nil; if ((($a = callback['$is_a?']($scope.get('Proc'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($d = self).$instance_exec, $a.$$p = callback.$to_proc(), $a).apply($d, Opal.to_a(args)) } else { return ($a = self).$send.apply($a, [callback].concat(Opal.to_a(args))) }}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $b).call($c); }, TMP_3.$$arity = -2); (function($base) { var $ClassMethods, self = $ClassMethods = $module($base, 'ClassMethods'); var def = self.$$proto, $scope = self.$$scope, TMP_7, TMP_8; Opal.defn(self, '$define_callback', TMP_7 = function $$define_callback(callback_name) { var $a, $b, TMP_4, $c, TMP_6, self = this, $iter = TMP_7.$$p, $yield = $iter || nil, wrapper_name = nil; TMP_7.$$p = null; wrapper_name = "_" + (callback_name) + "_callbacks"; ($a = ($b = self).$define_singleton_method, $a.$$p = (TMP_4 = function(){var self = TMP_4.$$s || this, $c, $d, TMP_5; return ($c = ($d = (($scope.get('Hyperloop')).$$scope.get('Context'))).$set_var, $c.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this; return []}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $c).call($d, self, "@" + (wrapper_name), $hash2(["force"], {"force": true}))}, TMP_4.$$s = self, TMP_4.$$arity = 0, TMP_4), $a).call($b, wrapper_name); return ($a = ($c = self).$define_singleton_method, $a.$$p = (TMP_6 = function($d_rest){var self = TMP_6.$$s || this, block, args; block = TMP_6.$$p || nil, TMP_6.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } self.$send(wrapper_name).$concat(args); if ((block !== nil)) { return self.$send(wrapper_name).$push(block) } else { return nil };}, TMP_6.$$s = self, TMP_6.$$arity = -1, TMP_6), $a).call($c, callback_name); }, TMP_7.$$arity = 1); Opal.defn(self, '$callbacks_for', TMP_8 = function $$callbacks_for(callback_name) { var $a, self = this, wrapper_name = nil; wrapper_name = "_" + (callback_name) + "_callbacks"; return $rb_plus((function() {if ((($a = self.$superclass()['$respond_to?']("callbacks_for")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$superclass().$callbacks_for(callback_name) } else { return [] }; return nil; })(), self.$send(wrapper_name)); }, TMP_8.$$arity = 1); })($scope.base); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["react/rendering_context"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$attr_accessor', '$!', '$remove_nodes_from_args', '$build', '$waiting_on_resources', '$waiting_on_resources=', '$run_child_block', '$to_proc', '$nil?', '$dup', '$tap', '$detect', '$respond_to?', '$is_a?', '$last', '$create_element', '$span', '$to_s', '$<<', '$delete', '$include?', '$[]=', '$index', '$[]', '$each', '$as_node', '$try', '$empty?', '$!=', '$raise_render_error', '$==', '$count', '$improper_render', '$>', '$class', '$raise', '$define_method', '$unshift', '$send', '$render']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $RenderingContext(){}; var self = $RenderingContext = $klass($base, $super, 'RenderingContext', $RenderingContext); var def = self.$$proto, $scope = self.$$scope; return (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_1, TMP_8, TMP_9, TMP_10, TMP_11, TMP_13, TMP_14, TMP_15, TMP_16; self.$attr_accessor("waiting_on_resources"); Opal.defn(self, '$render', TMP_1 = function $$render(name, $a_rest) { var $b, $c, TMP_2, $d, $e, self = this, args, $iter = TMP_1.$$p, block = $iter || nil, was_outer_most = nil, element = nil; if (self.not_outer_most == null) self.not_outer_most = nil; if (self.buffer == null) self.buffer = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_1.$$p = null; try { was_outer_most = self.not_outer_most['$!'](); self.not_outer_most = true; self.$remove_nodes_from_args(args); if ((($b = self.buffer) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { ((($b = self.buffer) !== false && $b !== nil && $b != null) ? $b : self.buffer = []) }; if (block !== false && block !== nil && block != null) { element = ($b = ($c = self).$build, $b.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this, $a, $d, $e, TMP_3, $f, $g, TMP_5, TMP_6, $h, TMP_7, saved_waiting_on_resources = nil, buffer = nil; if (self.buffer == null) self.buffer = nil; saved_waiting_on_resources = self.$waiting_on_resources(); (($a = [nil]), $d = self, $d['$waiting_on_resources='].apply($d, $a), $a[$a.length-1]); ($a = ($d = self).$run_child_block, $a.$$p = block.$to_proc(), $a).call($d, name['$nil?']()); if (name !== false && name !== nil && name != null) { buffer = self.buffer.$dup(); return ($a = ($e = ($f = ($g = $scope.get('React')).$create_element, $f.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this; return buffer}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $f).apply($g, [name].concat(Opal.to_a(args)))).$tap, $a.$$p = (TMP_3 = function(element){var self = TMP_3.$$s || this, $f, $g, $h, $i, $j, TMP_4; if (element == null) element = nil; (($f = [((($h = saved_waiting_on_resources) !== false && $h !== nil && $h != null) ? $h : ($i = ($j = buffer).$detect, $i.$$p = (TMP_4 = function(e){var self = TMP_4.$$s || this, $k; if (e == null) e = nil; if ((($k = e['$respond_to?']("waiting_on_resources")) !== nil && $k != null && (!$k.$$is_boolean || $k == true))) { return e.$waiting_on_resources() } else { return nil }}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $i).call($j)['$!']()['$!']())]), $g = element, $g['$waiting_on_resources='].apply($g, $f), $f[$f.length-1]); return ($f = element, ((($g = $f.$waiting_on_resources()) !== false && $g !== nil && $g != null) ? $g : $f['$waiting_on_resources='](($h = buffer.$last()['$is_a?']($scope.get('String')), $h !== false && $h !== nil && $h != null ?self.$waiting_on_resources() : $h))));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $a).call($e); } else if ((($a = self.buffer.$last()['$is_a?']((($scope.get('React')).$$scope.get('Element')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($f = self.buffer.$last()).$tap, $a.$$p = (TMP_6 = function(element){var self = TMP_6.$$s || this, $h, $i; if (element == null) element = nil; return ($h = element, ((($i = $h.$waiting_on_resources()) !== false && $i !== nil && $i != null) ? $i : $h['$waiting_on_resources='](saved_waiting_on_resources)))}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $a).call($f) } else { return ($a = ($h = self.buffer.$last().$to_s().$span()).$tap, $a.$$p = (TMP_7 = function(element){var self = TMP_7.$$s || this, $i, $j; if (element == null) element = nil; return (($i = [saved_waiting_on_resources]), $j = element, $j['$waiting_on_resources='].apply($j, $i), $i[$i.length-1])}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $a).call($h) };}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $b).call($c) } else if ((($b = name['$is_a?']((($scope.get('React')).$$scope.get('Element')))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { element = name } else { element = ($b = $scope.get('React')).$create_element.apply($b, [name].concat(Opal.to_a(args))); (($d = [self.$waiting_on_resources()]), $e = element, $e['$waiting_on_resources='].apply($e, $d), $d[$d.length-1]); }; self.buffer['$<<'](element); (($d = [nil]), $e = self, $e['$waiting_on_resources='].apply($e, $d), $d[$d.length-1]); return element; } finally { if (was_outer_most !== false && was_outer_most !== nil && was_outer_most != null) { self.not_outer_most = self.buffer = nil} }; }, TMP_1.$$arity = -2); Opal.defn(self, '$build', TMP_8 = function $$build() { var self = this, $iter = TMP_8.$$p, $yield = $iter || nil, current = nil, return_val = nil; if (self.buffer == null) self.buffer = nil; TMP_8.$$p = null; current = self.buffer; self.buffer = []; return_val = Opal.yield1($yield, self.buffer); self.buffer = current; return return_val; }, TMP_8.$$arity = 0); Opal.defn(self, '$as_node', TMP_9 = function $$as_node(element) { var self = this; if (self.buffer == null) self.buffer = nil; self.buffer.$delete(element); return element; }, TMP_9.$$arity = 1); Opal.alias(self, 'delete', 'as_node'); Opal.defn(self, '$rendered?', TMP_10 = function(element) { var self = this; if (self.buffer == null) self.buffer = nil; return self.buffer['$include?'](element); }, TMP_10.$$arity = 1); Opal.defn(self, '$replace', TMP_11 = function $$replace(e1, e2) { var self = this; if (self.buffer == null) self.buffer = nil; return self.buffer['$[]='](self.buffer.$index(e1), e2); }, TMP_11.$$arity = 2); Opal.defn(self, '$remove_nodes_from_args', TMP_13 = function $$remove_nodes_from_args(args) { var $a, $b, TMP_12, self = this; if ((($a = ($b = args['$[]'](0), $b !== false && $b !== nil && $b != null ?args['$[]'](0)['$is_a?']($scope.get('Hash')) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = args['$[]'](0)).$each, $a.$$p = (TMP_12 = function(key, value){var self = TMP_12.$$s || this, $c; if (key == null) key = nil;if (value == null) value = nil; try { if ((($c = value['$is_a?']($scope.get('Element'))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return value.$as_node() } else { return nil } } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) { try { return nil } finally { Opal.pop_exception() } } else { throw $err; } }}, TMP_12.$$s = self, TMP_12.$$arity = 2, TMP_12), $a).call($b) } else { return nil }; }, TMP_13.$$arity = 1); Opal.defn(self, '$run_child_block', TMP_14 = function $$run_child_block(is_outer_scope) { var $a, $b, $c, self = this, $iter = TMP_14.$$p, $yield = $iter || nil, result = nil; if (self.buffer == null) self.buffer = nil; TMP_14.$$p = null; result = Opal.yieldX($yield, []); if ((($a = result.$try(((($b = "acts_as_string?") !== false && $b !== nil && $b != null) ? $b : result['$is_a?']($scope.get('String'))))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = result.$to_s().$span()}; if ((($a = ((($b = result['$is_a?']($scope.get('String'))) !== false && $b !== nil && $b != null) ? $b : (($c = result['$is_a?']((($scope.get('React')).$$scope.get('Element'))), $c !== false && $c !== nil && $c != null ?self.buffer['$empty?']() : $c)))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.buffer['$<<'](result)}; if ((($a = (($b = is_outer_scope !== false && is_outer_scope !== nil && is_outer_scope != null) ? self.buffer['$!=']([result]) : is_outer_scope)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise_render_error(result) } else { return nil }; }, TMP_14.$$arity = 1); Opal.defn(self, '$raise_render_error', TMP_15 = function $$raise_render_error(result) { var $a, self = this; if (self.buffer == null) self.buffer = nil; if (self.buffer.$count()['$=='](1)) { self.$improper_render("A different element was returned than was generated within the DSL.", "Possibly improper use of Element#delete.")}; if ((($a = $rb_gt(self.buffer.$count(), 1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$improper_render("Instead " + (self.buffer.$count()) + " elements were generated.", "Do you want to wrap your elements in a div?")}; if ((($a = result.$try("reactrb_component?")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$improper_render("Instead the component " + (result) + " was returned.", "Did you mean " + (result) + "()?")}; return self.$improper_render("Instead the " + (result.$class()) + " " + (result) + " was returned.", "You may need to convert this to a string."); }, TMP_15.$$arity = 1); return (Opal.defn(self, '$improper_render', TMP_16 = function $$improper_render(message, solution) { var self = this; return self.$raise("a component's render method must generate and return exactly 1 element or a string.\n" + (" " + (message) + " " + (solution))); }, TMP_16.$$arity = 2), nil) && 'improper_render'; })(Opal.get_singleton_class(self)) })($scope.base, null); (function($base, $super) { function $Object(){}; var self = $Object = $klass($base, $super, 'Object', $Object); var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_17, TMP_20, TMP_23; ($a = ($b = ["span", "td", "th", "while_loading"]).$each, $a.$$p = (TMP_17 = function(tag){var self = TMP_17.$$s || this, $c, $d, TMP_18; if (tag == null) tag = nil; return ($c = ($d = self).$define_method, $c.$$p = (TMP_18 = function($e_rest){var self = TMP_18.$$s || this, block, args, $f, $g, $h, TMP_19; block = TMP_18.$$p || nil, TMP_18.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } args.$unshift(tag); if ((($f = self['$is_a?']((($scope.get('React')).$$scope.get('Component')))) !== nil && $f != null && (!$f.$$is_boolean || $f == true))) { return ($f = ($g = self).$send, $f.$$p = block.$to_proc(), $f).apply($g, Opal.to_a(args))}; return ($f = ($h = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $f.$$p = (TMP_19 = function(){var self = TMP_19.$$s || this; return self.$to_s()}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19), $f).apply($h, Opal.to_a(args));}, TMP_18.$$s = self, TMP_18.$$arity = -1, TMP_18), $c).call($d, tag)}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17), $a).call($b); Opal.defn(self, '$para', TMP_20 = function $$para($a_rest) { var $b, $c, $d, TMP_21, self = this, args, $iter = TMP_20.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_20.$$p = null; args.$unshift("p"); if ((($b = self['$is_a?']((($scope.get('React')).$$scope.get('Component')))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return ($b = ($c = self).$send, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args))}; return ($b = ($d = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $b.$$p = (TMP_21 = function(){var self = TMP_21.$$s || this; return self.$to_s()}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21), $b).apply($d, Opal.to_a(args)); }, TMP_20.$$arity = -1); return (Opal.defn(self, '$br', TMP_23 = function $$br() { var $a, $b, TMP_22, self = this; if ((($a = self['$is_a?']((($scope.get('React')).$$scope.get('Component')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$send("br")}; return ($a = ($b = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $a.$$p = (TMP_22 = function(){var self = TMP_22.$$s || this; (($scope.get('React')).$$scope.get('RenderingContext')).$render(self.$to_s()); return (($scope.get('React')).$$scope.get('RenderingContext')).$render("br");}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22), $a).call($b, "span"); }, TMP_23.$$arity = 0), nil) && 'br'; })(Opal.Object, null); })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["set"] = function(Opal) { function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_le(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module; Opal.add_stubs(['$include', '$new', '$nil?', '$===', '$raise', '$each', '$add', '$call', '$merge', '$class', '$respond_to?', '$subtract', '$dup', '$join', '$to_a', '$equal?', '$instance_of?', '$==', '$instance_variable_get', '$is_a?', '$size', '$all?', '$include?', '$[]=', '$enum_for', '$[]', '$<<', '$replace', '$delete', '$select', '$each_key', '$to_proc', '$empty?', '$eql?', '$instance_eval', '$clear', '$<', '$<=', '$keys']); (function($base, $super) { function $Set(){}; var self = $Set = $klass($base, $super, 'Set', $Set); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_4, TMP_5, TMP_6, TMP_8, TMP_9, TMP_10, TMP_13, TMP_15, TMP_16, TMP_17, TMP_20, TMP_21, TMP_22, TMP_24, TMP_25, TMP_26, TMP_28, TMP_29, TMP_30, TMP_32, TMP_33, TMP_35, TMP_37, TMP_39, TMP_41, TMP_42; def.hash = nil; self.$include($scope.get('Enumerable')); Opal.defs(self, '$[]', TMP_1 = function($a_rest) { var self = this, ary; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } ary = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { ary[$arg_idx - 0] = arguments[$arg_idx]; } return self.$new(ary); }, TMP_1.$$arity = -1); Opal.defn(self, '$initialize', TMP_2 = function $$initialize(enum$) { var $a, $b, TMP_3, self = this, $iter = TMP_2.$$p, block = $iter || nil; if (enum$ == null) { enum$ = nil; } TMP_2.$$p = null; self.hash = $scope.get('Hash').$new(); if ((($a = enum$['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; if ((($a = $scope.get('Enumerable')['$==='](enum$)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError'), "value must be enumerable") }; if (block !== false && block !== nil && block != null) { return ($a = ($b = enum$).$each, $a.$$p = (TMP_3 = function(item){var self = TMP_3.$$s || this; if (item == null) item = nil; return self.$add(block.$call(item))}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $a).call($b) } else { return self.$merge(enum$) }; }, TMP_2.$$arity = -1); Opal.defn(self, '$dup', TMP_4 = function $$dup() { var self = this, result = nil; result = self.$class().$new(); return result.$merge(self); }, TMP_4.$$arity = 0); Opal.defn(self, '$-', TMP_5 = function(enum$) { var $a, self = this; if ((($a = enum$['$respond_to?']("each")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError'), "value must be enumerable") }; return self.$dup().$subtract(enum$); }, TMP_5.$$arity = 1); Opal.alias(self, 'difference', '-'); Opal.defn(self, '$inspect', TMP_6 = function $$inspect() { var self = this; return "#"; }, TMP_6.$$arity = 0); Opal.defn(self, '$==', TMP_8 = function(other) { var $a, $b, TMP_7, self = this; if ((($a = self['$equal?'](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return true } else if ((($a = other['$instance_of?'](self.$class())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.hash['$=='](other.$instance_variable_get("@hash")) } else if ((($a = ($b = other['$is_a?']($scope.get('Set')), $b !== false && $b !== nil && $b != null ?self.$size()['$=='](other.$size()) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = other)['$all?'], $a.$$p = (TMP_7 = function(o){var self = TMP_7.$$s || this; if (self.hash == null) self.hash = nil; if (o == null) o = nil; return self.hash['$include?'](o)}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $a).call($b) } else { return false }; }, TMP_8.$$arity = 1); Opal.defn(self, '$add', TMP_9 = function $$add(o) { var self = this; self.hash['$[]='](o, true); return self; }, TMP_9.$$arity = 1); Opal.alias(self, '<<', 'add'); Opal.defn(self, '$classify', TMP_10 = function $$classify() { var $a, $b, TMP_11, $c, TMP_12, self = this, $iter = TMP_10.$$p, block = $iter || nil, result = nil; TMP_10.$$p = null; if ((block !== nil)) { } else { return self.$enum_for("classify") }; result = ($a = ($b = $scope.get('Hash')).$new, $a.$$p = (TMP_11 = function(h, k){var self = TMP_11.$$s || this; if (h == null) h = nil;if (k == null) k = nil; return h['$[]='](k, self.$class().$new())}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11), $a).call($b); ($a = ($c = self).$each, $a.$$p = (TMP_12 = function(item){var self = TMP_12.$$s || this; if (item == null) item = nil; return result['$[]'](Opal.yield1(block, item)).$add(item)}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12), $a).call($c); return result; }, TMP_10.$$arity = 0); Opal.defn(self, '$collect!', TMP_13 = function() { var $a, $b, TMP_14, self = this, $iter = TMP_13.$$p, block = $iter || nil, result = nil; TMP_13.$$p = null; if ((block !== nil)) { } else { return self.$enum_for("collect!") }; result = self.$class().$new(); ($a = ($b = self).$each, $a.$$p = (TMP_14 = function(item){var self = TMP_14.$$s || this; if (item == null) item = nil; return result['$<<'](Opal.yield1(block, item))}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($b); return self.$replace(result); }, TMP_13.$$arity = 0); Opal.alias(self, 'map!', 'collect!'); Opal.defn(self, '$delete', TMP_15 = function(o) { var self = this; self.hash.$delete(o); return self; }, TMP_15.$$arity = 1); Opal.defn(self, '$delete?', TMP_16 = function(o) { var $a, self = this; if ((($a = self['$include?'](o)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$delete(o); return self; } else { return nil }; }, TMP_16.$$arity = 1); Opal.defn(self, '$delete_if', TMP_17 = function $$delete_if() {try { var $a, $b, TMP_18, $c, $d, TMP_19, self = this, $iter = TMP_17.$$p, $yield = $iter || nil; TMP_17.$$p = null; ((($a = ($yield !== nil)) !== false && $a !== nil && $a != null) ? $a : Opal.ret(self.$enum_for("delete_if"))); ($a = ($b = ($c = ($d = self).$select, $c.$$p = (TMP_19 = function(o){var self = TMP_19.$$s || this; if (o == null) o = nil; return Opal.yield1($yield, o);}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19), $c).call($d)).$each, $a.$$p = (TMP_18 = function(o){var self = TMP_18.$$s || this; if (self.hash == null) self.hash = nil; if (o == null) o = nil; return self.hash.$delete(o)}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18), $a).call($b); return self; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_17.$$arity = 0); Opal.defn(self, '$add?', TMP_20 = function(o) { var $a, self = this; if ((($a = self['$include?'](o)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return self.$add(o) }; }, TMP_20.$$arity = 1); Opal.defn(self, '$each', TMP_21 = function $$each() { var $a, $b, self = this, $iter = TMP_21.$$p, block = $iter || nil; TMP_21.$$p = null; if ((block !== nil)) { } else { return self.$enum_for("each") }; ($a = ($b = self.hash).$each_key, $a.$$p = block.$to_proc(), $a).call($b); return self; }, TMP_21.$$arity = 0); Opal.defn(self, '$empty?', TMP_22 = function() { var self = this; return self.hash['$empty?'](); }, TMP_22.$$arity = 0); Opal.defn(self, '$eql?', TMP_24 = function(other) { var $a, $b, TMP_23, self = this; return self.hash['$eql?'](($a = ($b = other).$instance_eval, $a.$$p = (TMP_23 = function(){var self = TMP_23.$$s || this; if (self.hash == null) self.hash = nil; return self.hash}, TMP_23.$$s = self, TMP_23.$$arity = 0, TMP_23), $a).call($b)); }, TMP_24.$$arity = 1); Opal.defn(self, '$clear', TMP_25 = function $$clear() { var self = this; self.hash.$clear(); return self; }, TMP_25.$$arity = 0); Opal.defn(self, '$include?', TMP_26 = function(o) { var self = this; return self.hash['$include?'](o); }, TMP_26.$$arity = 1); Opal.alias(self, 'member?', 'include?'); Opal.defn(self, '$merge', TMP_28 = function $$merge(enum$) { var $a, $b, TMP_27, self = this; ($a = ($b = enum$).$each, $a.$$p = (TMP_27 = function(item){var self = TMP_27.$$s || this; if (item == null) item = nil; return self.$add(item)}, TMP_27.$$s = self, TMP_27.$$arity = 1, TMP_27), $a).call($b); return self; }, TMP_28.$$arity = 1); Opal.defn(self, '$replace', TMP_29 = function $$replace(enum$) { var self = this; self.$clear(); self.$merge(enum$); return self; }, TMP_29.$$arity = 1); Opal.defn(self, '$size', TMP_30 = function $$size() { var self = this; return self.hash.$size(); }, TMP_30.$$arity = 0); Opal.alias(self, 'length', 'size'); Opal.defn(self, '$subtract', TMP_32 = function $$subtract(enum$) { var $a, $b, TMP_31, self = this; ($a = ($b = enum$).$each, $a.$$p = (TMP_31 = function(item){var self = TMP_31.$$s || this; if (item == null) item = nil; return self.$delete(item)}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31), $a).call($b); return self; }, TMP_32.$$arity = 1); Opal.defn(self, '$|', TMP_33 = function(enum$) { var $a, self = this; if ((($a = enum$['$respond_to?']("each")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError'), "value must be enumerable") }; return self.$dup().$merge(enum$); }, TMP_33.$$arity = 1); Opal.defn(self, '$superset?', TMP_35 = function(set) { var $a, $b, TMP_34, self = this; ((($a = set['$is_a?']($scope.get('Set'))) !== false && $a !== nil && $a != null) ? $a : self.$raise($scope.get('ArgumentError'), "value must be a set")); if ((($a = $rb_lt(self.$size(), set.$size())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return false}; return ($a = ($b = set)['$all?'], $a.$$p = (TMP_34 = function(o){var self = TMP_34.$$s || this; if (o == null) o = nil; return self['$include?'](o)}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34), $a).call($b); }, TMP_35.$$arity = 1); Opal.alias(self, '>=', 'superset?'); Opal.defn(self, '$proper_superset?', TMP_37 = function(set) { var $a, $b, TMP_36, self = this; ((($a = set['$is_a?']($scope.get('Set'))) !== false && $a !== nil && $a != null) ? $a : self.$raise($scope.get('ArgumentError'), "value must be a set")); if ((($a = $rb_le(self.$size(), set.$size())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return false}; return ($a = ($b = set)['$all?'], $a.$$p = (TMP_36 = function(o){var self = TMP_36.$$s || this; if (o == null) o = nil; return self['$include?'](o)}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36), $a).call($b); }, TMP_37.$$arity = 1); Opal.alias(self, '>', 'proper_superset?'); Opal.defn(self, '$subset?', TMP_39 = function(set) { var $a, $b, TMP_38, self = this; ((($a = set['$is_a?']($scope.get('Set'))) !== false && $a !== nil && $a != null) ? $a : self.$raise($scope.get('ArgumentError'), "value must be a set")); if ((($a = $rb_lt(set.$size(), self.$size())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return false}; return ($a = ($b = self)['$all?'], $a.$$p = (TMP_38 = function(o){var self = TMP_38.$$s || this; if (o == null) o = nil; return set['$include?'](o)}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38), $a).call($b); }, TMP_39.$$arity = 1); Opal.alias(self, '<=', 'subset?'); Opal.defn(self, '$proper_subset?', TMP_41 = function(set) { var $a, $b, TMP_40, self = this; ((($a = set['$is_a?']($scope.get('Set'))) !== false && $a !== nil && $a != null) ? $a : self.$raise($scope.get('ArgumentError'), "value must be a set")); if ((($a = $rb_le(set.$size(), self.$size())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return false}; return ($a = ($b = self)['$all?'], $a.$$p = (TMP_40 = function(o){var self = TMP_40.$$s || this; if (o == null) o = nil; return set['$include?'](o)}, TMP_40.$$s = self, TMP_40.$$arity = 1, TMP_40), $a).call($b); }, TMP_41.$$arity = 1); Opal.alias(self, '<', 'proper_subset?'); Opal.alias(self, '+', '|'); Opal.alias(self, 'union', '|'); return (Opal.defn(self, '$to_a', TMP_42 = function $$to_a() { var self = this; return self.hash.$keys(); }, TMP_42.$$arity = 0), nil) && 'to_a'; })($scope.base, null); return (function($base) { var $Enumerable, self = $Enumerable = $module($base, 'Enumerable'); var def = self.$$proto, $scope = self.$$scope, TMP_43; Opal.defn(self, '$to_set', TMP_43 = function $$to_set(klass, $a_rest) { var $b, $c, self = this, args, $iter = TMP_43.$$p, block = $iter || nil; if (klass == null) { klass = $scope.get('Set'); } var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_43.$$p = null; return ($b = ($c = klass).$new, $b.$$p = block.$to_proc(), $b).apply($c, [self].concat(Opal.to_a(args))); }, TMP_43.$$arity = -1) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-store/class_methods"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$attr_accessor', '$>', '$count', '$define_state_methods', '$to_proc', '$class_state_wrapper', '$__state_wrapper', '$singleton_class', '$new', '$class_mutator_wrapper']); return (function($base) { var $HyperStore, self = $HyperStore = $module($base, 'HyperStore'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $ClassMethods, self = $ClassMethods = $module($base, 'ClassMethods'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5; self.$attr_accessor("__shared_states", "__class_states", "__instance_states"); Opal.defn(self, '$state', TMP_1 = function $$state($a_rest) { var $b, $c, self = this, args, $iter = TMP_1.$$p, block = $iter || nil; if (self.state == null) self.state = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_1.$$p = null; if ((($b = $rb_gt(args.$count(), 0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return ($b = ($c = self.$singleton_class().$__state_wrapper().$class_state_wrapper()).$define_state_methods, $b.$$p = block.$to_proc(), $b).apply($c, [self].concat(Opal.to_a(args))) } else { return ((($b = self.state) !== false && $b !== nil && $b != null) ? $b : self.state = self.$singleton_class().$__state_wrapper().$class_state_wrapper().$new(self)) }; }, TMP_1.$$arity = -1); Opal.defn(self, '$mutate', TMP_2 = function $$mutate() { var $a, self = this; if (self.mutate == null) self.mutate = nil; return ((($a = self.mutate) !== false && $a !== nil && $a != null) ? $a : self.mutate = self.$singleton_class().$__state_wrapper().$class_mutator_wrapper().$new(self)); }, TMP_2.$$arity = 0); Opal.defn(self, '$__shared_states', TMP_3 = function $$__shared_states() { var $a, self = this; if (self.__shared_states == null) self.__shared_states = nil; return ((($a = self.__shared_states) !== false && $a !== nil && $a != null) ? $a : self.__shared_states = []); }, TMP_3.$$arity = 0); Opal.defn(self, '$__class_states', TMP_4 = function $$__class_states() { var $a, self = this; if (self.__class_states == null) self.__class_states = nil; return ((($a = self.__class_states) !== false && $a !== nil && $a != null) ? $a : self.__class_states = []); }, TMP_4.$$arity = 0); Opal.defn(self, '$__instance_states', TMP_5 = function $$__instance_states() { var $a, self = this; if (self.__instance_states == null) self.__instance_states = nil; return ((($a = self.__instance_states) !== false && $a !== nil && $a != null) ? $a : self.__instance_states = []); }, TMP_5.$$arity = 0); })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-store/dispatch_receiver"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$attr_accessor', '$format_callback', '$empty?', '$raise', '$each', '$on_dispatch', '$call', '$private', '$is_a?', '$last', '$pop', '$lambda', '$send', '$to_s']); return (function($base) { var $HyperStore, self = $HyperStore = $module($base, 'HyperStore'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $DispatchReceiver, self = $DispatchReceiver = $module($base, 'DispatchReceiver'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_5; (function($base, $super) { function $InvalidOperationError(){}; var self = $InvalidOperationError = $klass($base, $super, 'InvalidOperationError', $InvalidOperationError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); self.$attr_accessor("params"); Opal.defn(self, '$receives', TMP_1 = function $$receives($a_rest) { var $b, $c, TMP_2, self = this, args, $iter = TMP_1.$$p, block = $iter || nil, callback = nil, message = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_1.$$p = null; callback = self.$format_callback(args); if ((($b = args['$empty?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { message = "At least one operation must be passed in to the 'receives' macro"; self.$raise($scope.get('InvalidOperationError'), message);}; return ($b = ($c = args).$each, $b.$$p = (TMP_2 = function(operation){var self = TMP_2.$$s || this, $a, $d, TMP_3; if (operation == null) operation = nil; return ($a = ($d = operation).$on_dispatch, $a.$$p = (TMP_3 = function(params){var self = TMP_3.$$s || this; if (params == null) params = nil; self.params = params; if (callback !== false && callback !== nil && callback != null) { callback.$call()}; if (block !== false && block !== nil && block != null) { return Opal.yield1(block, params); } else { return nil };}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $a).call($d)}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $b).call($c); }, TMP_1.$$arity = -1); self.$private(); Opal.defn(self, '$format_callback', TMP_5 = function $$format_callback(args) { var $a, $b, TMP_4, self = this, method_name = nil; if ((($a = args.$last()['$is_a?']($scope.get('Symbol'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { method_name = args.$pop(); return ($a = ($b = self).$lambda, $a.$$p = (TMP_4 = function(){var self = TMP_4.$$s || this; return self.$send((method_name.$to_s()))}, TMP_4.$$s = self, TMP_4.$$arity = 0, TMP_4), $a).call($b); } else if ((($a = args.$last()['$is_a?']($scope.get('Proc'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return args.$pop() } else { return nil }; }, TMP_5.$$arity = 1); })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-store/instance_methods"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$each', '$==', '$[]', '$initializer_value', '$__send__', '$mutate', '$to_s', '$instance_eval', '$to_proc', '$__instance_states', '$class', '$new', '$instance_state_wrapper', '$__state_wrapper', '$singleton_class', '$instance_mutator_wrapper', '$private', '$>', '$arity', '$call']); return (function($base) { var $HyperStore, self = $HyperStore = $module($base, 'HyperStore'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $InstanceMethods, self = $InstanceMethods = $module($base, 'InstanceMethods'); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_3, TMP_4, TMP_5; Opal.defn(self, '$init_store', TMP_2 = function $$init_store() { var $a, $b, TMP_1, self = this; return ($a = ($b = self.$class().$__instance_states()).$each, $a.$$p = (TMP_1 = function(instance_state){var self = TMP_1.$$s || this, $c, $d, proc_value = nil, block_value = nil; if (instance_state == null) instance_state = nil; if (instance_state['$[]'](1)['$[]']("scope")['$==']("shared")) { return nil;}; proc_value = self.$initializer_value(instance_state['$[]'](1)['$[]']("initializer")); self.$mutate().$__send__((instance_state['$[]'](0).$to_s()), proc_value); if ((($c = instance_state['$[]'](1)['$[]']("block")) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { return nil; }; block_value = ($c = ($d = self).$instance_eval, $c.$$p = instance_state['$[]'](1)['$[]']("block").$to_proc(), $c).call($d); return self.$mutate().$__send__((instance_state['$[]'](0).$to_s()), block_value);}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); }, TMP_2.$$arity = 0); Opal.defn(self, '$state', TMP_3 = function $$state() { var $a, self = this; if (self.state == null) self.state = nil; return ((($a = self.state) !== false && $a !== nil && $a != null) ? $a : self.state = self.$class().$singleton_class().$__state_wrapper().$instance_state_wrapper().$new(self)); }, TMP_3.$$arity = 0); Opal.defn(self, '$mutate', TMP_4 = function $$mutate() { var $a, self = this; if (self.mutate == null) self.mutate = nil; return ((($a = self.mutate) !== false && $a !== nil && $a != null) ? $a : self.mutate = self.$class().$singleton_class().$__state_wrapper().$instance_mutator_wrapper().$new(self)); }, TMP_4.$$arity = 0); self.$private(); Opal.defn(self, '$initializer_value', TMP_5 = function $$initializer_value(initializer) { var $a, self = this; if ((($a = $rb_gt(initializer.$arity(), 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return initializer.$call(self) } else { return initializer.$call() }; }, TMP_5.$$arity = 1); })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-store/mutator_wrapper"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$define_method', '$==', '$[]', '$__from__', '$state', '$get_state', '$to_s', '$>', '$count', '$set_state', '$new', '$initialize_values?', '$initialize_values', '$include?', '$initializer_proc', '$receives', '$__send__', '$mutate', '$call', '$private', '$arity', '$lambda', '$attr_accessor', '$allocate', '$__from__=', '$add_method', '$to_proc']); return (function($base) { var $HyperStore, self = $HyperStore = $module($base, 'HyperStore'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $MutatorWrapper(){}; var self = $MutatorWrapper = $klass($base, $super, 'MutatorWrapper', $MutatorWrapper); var def = self.$$proto, $scope = self.$$scope, TMP_11, TMP_12; (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_3, TMP_4, TMP_7, TMP_10; Opal.defn(self, '$add_method', TMP_3 = function $$add_method(klass, method_name, opts) { var $a, $b, TMP_1, self = this; if (opts == null) { opts = $hash2([], {}); } ($a = ($b = self).$define_method, $a.$$p = (TMP_1 = function($c_rest){var self = TMP_1.$$s || this, args, $d, $e, TMP_2, from = nil, current_value = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } from = (function() {if (opts['$[]']("scope")['$==']("shared")) { return klass.$state().$__from__() } else { return self.$__from__() }; return nil; })(); current_value = (($scope.get('React')).$$scope.get('State')).$get_state(from, method_name.$to_s()); if ((($d = $rb_gt(args.$count(), 0)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { (($scope.get('React')).$$scope.get('State')).$set_state(from, method_name.$to_s(), args['$[]'](0)); return current_value; } else { (($scope.get('React')).$$scope.get('State')).$set_state(from, method_name.$to_s(), current_value); return ($d = ($e = (($scope.get('React')).$$scope.get('Observable'))).$new, $d.$$p = (TMP_2 = function(update){var self = TMP_2.$$s || this; if (update == null) update = nil; return (($scope.get('React')).$$scope.get('State')).$set_state(from, method_name.$to_s(), update)}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $d).call($e, current_value); };}, TMP_1.$$s = self, TMP_1.$$arity = -1, TMP_1), $a).call($b, (method_name.$to_s())); if ((($a = self['$initialize_values?'](opts)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$initialize_values(klass, method_name, opts) } else { return nil }; }, TMP_3.$$arity = -3); Opal.defn(self, '$initialize_values?', TMP_4 = function(opts) { var $a, $b, self = this; return ($a = ["class", "shared"]['$include?'](opts['$[]']("scope")), $a !== false && $a !== nil && $a != null ?(((($b = opts['$[]']("initializer")) !== false && $b !== nil && $b != null) ? $b : opts['$[]']("block"))) : $a); }, TMP_4.$$arity = 1); Opal.defn(self, '$initialize_values', TMP_7 = function $$initialize_values(klass, name, opts) { var $a, $b, TMP_5, $c, TMP_6, self = this, initializer = nil; if ((($a = opts['$[]']("initializer")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { initializer = self.$initializer_proc(opts['$[]']("initializer"), klass, name)}; if ((($a = (($b = initializer !== false && initializer !== nil && initializer != null) ? opts['$[]']("block") : initializer)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = klass).$receives, $a.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this; return klass.$mutate().$__send__((name.$to_s()), opts['$[]']("block").$call())}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $a).call($b, (((($scope.get('Hyperloop')).$$scope.get('Application'))).$$scope.get('Boot')), initializer) } else if (initializer !== false && initializer !== nil && initializer != null) { return klass.$receives((((($scope.get('Hyperloop')).$$scope.get('Application'))).$$scope.get('Boot')), initializer) } else if ((($a = opts['$[]']("block")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($c = klass).$receives, $a.$$p = (TMP_6 = function(){var self = TMP_6.$$s || this; return klass.$mutate().$__send__((name.$to_s()), opts['$[]']("block").$call())}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6), $a).call($c, (((($scope.get('Hyperloop')).$$scope.get('Application'))).$$scope.get('Boot'))) } else { return nil }; }, TMP_7.$$arity = 3); self.$private(); return (Opal.defn(self, '$initializer_proc', TMP_10 = function $$initializer_proc(initializer, klass, name) { var $a, $b, TMP_8, $c, TMP_9, self = this; if ((($a = $rb_gt(initializer.$arity(), 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self).$lambda, $a.$$p = (TMP_8 = function(){var self = TMP_8.$$s || this; return klass.$mutate().$__send__((name.$to_s()), initializer.$call(klass))}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8), $a).call($b) } else { return ($a = ($c = self).$lambda, $a.$$p = (TMP_9 = function(){var self = TMP_9.$$s || this; return klass.$mutate().$__send__((name.$to_s()), initializer.$call())}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9), $a).call($c) }; }, TMP_10.$$arity = 3), nil) && 'initializer_proc'; })(Opal.get_singleton_class(self)); self.$attr_accessor("__from__"); Opal.defs(self, '$new', TMP_11 = function(from) { var $a, $b, self = this, instance = nil; instance = self.$allocate(); (($a = [from]), $b = instance, $b['$__from__='].apply($b, $a), $a[$a.length-1]); return instance; }, TMP_11.$$arity = 1); return (Opal.defn(self, '$method_missing', TMP_12 = function $$method_missing(name, $a_rest) { var $b, $c, self = this, args, $iter = TMP_12.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_12.$$p = null; ((function(self) { var $scope = self.$$scope, def = self.$$proto; return self })(Opal.get_singleton_class(self))).$add_method(nil, name); return ($b = ($c = self).$__send__, $b.$$p = block.$to_proc(), $b).apply($c, [name].concat(Opal.to_a(args))); }, TMP_12.$$arity = -2), nil) && 'method_missing'; })($scope.base, $scope.get('BaseStoreClass')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-store/state_wrapper/argument_validator"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$parse_arguments', '$to_proc', '$[]', '$[]=', '$default_scope', '$validate_initializer', '$==', '$private', '$raise', '$is_a?', '$first', '$include?', '$to_sym', '$keys', '$invalid_option', '$shift', '$dup_or_return_intial_value', '$class', '$lambda', '$send', '$to_s', '$dup']); return (function($base) { var $HyperStore, self = $HyperStore = $module($base, 'HyperStore'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $StateWrapper(){}; var self = $StateWrapper = $klass($base, $super, 'StateWrapper', $StateWrapper); var def = self.$$proto, $scope = self.$$scope; return (function($base) { var $ArgumentValidator, self = $ArgumentValidator = $module($base, 'ArgumentValidator'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_8, TMP_10; (function($base, $super) { function $InvalidOptionError(){}; var self = $InvalidOptionError = $klass($base, $super, 'InvalidOptionError', $InvalidOptionError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')); Opal.defn(self, '$validate_args!', TMP_1 = function(klass, $a_rest) { var $b, $c, $d, $e, self = this, args, $iter = TMP_1.$$p, block = $iter || nil, name = nil, initial_value = nil, opts = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_1.$$p = null; $c = ($d = ($e = self).$parse_arguments, $d.$$p = block.$to_proc(), $d).apply($e, Opal.to_a(args)), $b = Opal.to_ary($c), name = ($b[0] == null ? nil : $b[0]), initial_value = ($b[1] == null ? nil : $b[1]), opts = ($b[2] == null ? nil : $b[2]), $c; ($b = "scope", $c = opts, ((($d = $c['$[]']($b)) !== false && $d !== nil && $d != null) ? $d : $c['$[]=']($b, self.$default_scope(klass)))); opts['$[]=']("initializer", self.$validate_initializer(initial_value, klass, opts)); if (block !== false && block !== nil && block != null) { opts['$[]=']("block", block)}; if ((($b = opts['$[]']("reader")) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { opts['$[]=']("reader", (function() {if (opts['$[]']("reader")['$=='](true)) { return name } else { return opts['$[]']("reader") }; return nil; })())}; return [name, opts]; }, TMP_1.$$arity = -2); self.$private(); Opal.defn(self, '$invalid_option', TMP_2 = function $$invalid_option(message) { var self = this; return self.$raise($scope.get('InvalidOptionError'), message); }, TMP_2.$$arity = 1); Opal.defn(self, '$parse_arguments', TMP_3 = function $$parse_arguments($a_rest) { var $b, $c, self = this, args, message = nil, name = nil, initial_value = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($b = args.$first()['$is_a?']($scope.get('Hash'))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = ["reader", "initializer", "scope"]['$include?'](args.$first().$keys().$first().$to_sym())) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { message = "The name of the state must be specified first as " + "either 'state :name' or 'state name: nil'"; self.$invalid_option(message);}; $c = args['$[]'](0).$shift(), $b = Opal.to_ary($c), name = ($b[0] == null ? nil : $b[0]), initial_value = ($b[1] == null ? nil : $b[1]), $c; } else { name = args.$shift() }; return [name, initial_value, ((($b = args['$[]'](0)) !== false && $b !== nil && $b != null) ? $b : $hash2([], {}))]; }, TMP_3.$$arity = -1); Opal.defn(self, '$validate_initializer', TMP_8 = function $$validate_initializer(initial_value, klass, opts) { var $a, $b, TMP_4, $c, TMP_5, $d, TMP_6, $e, TMP_7, self = this, method_name = nil; if (initial_value !== false && initial_value !== nil && initial_value != null) { return self.$dup_or_return_intial_value(initial_value) } else if ((($a = opts['$[]']("initializer")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = [$scope.get('Symbol'), $scope.get('String')]['$include?'](opts['$[]']("initializer").$class())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { method_name = opts['$[]']("initializer"); if ((($a = ["class", "shared"]['$include?'](opts['$[]']("scope"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self).$lambda, $a.$$p = (TMP_4 = function(){var self = TMP_4.$$s || this; return klass.$send((method_name.$to_s()))}, TMP_4.$$s = self, TMP_4.$$arity = 0, TMP_4), $a).call($b) } else { return ($a = ($c = self).$lambda, $a.$$p = (TMP_5 = function(instance){var self = TMP_5.$$s || this; if (instance == null) instance = nil; return instance.$send((method_name.$to_s()))}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $a).call($c) }; } else if ((($a = opts['$[]']("initializer")['$is_a?']($scope.get('Proc'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return opts['$[]']("initializer") } else { self.$invalid_option("'state' option 'initialize' must either be a Symbol or a Proc"); return ($a = ($d = self).$lambda, $a.$$p = (TMP_6 = function(){var self = TMP_6.$$s || this; return nil}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6), $a).call($d); } } else { return ($a = ($e = self).$lambda, $a.$$p = (TMP_7 = function(){var self = TMP_7.$$s || this; return nil}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7), $a).call($e) }; }, TMP_8.$$arity = 3); Opal.defn(self, '$dup_or_return_intial_value', TMP_10 = function $$dup_or_return_intial_value(value) { var $a, $b, TMP_9, self = this; value = (function() { try { return value.$dup() } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { try { return value } finally { Opal.pop_exception() } } else { throw $err; } }})(); return ($a = ($b = self).$lambda, $a.$$p = (TMP_9 = function(){var self = TMP_9.$$s || this; return value}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9), $a).call($b); }, TMP_10.$$arity = 1); })($scope.base) })($scope.base, $scope.get('BaseStoreClass')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-store/state_wrapper"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $gvars = Opal.gvars; Opal.add_stubs(['$extend', '$attr_reader', '$==', '$add_class_instance_vars', '$new', '$empty?', '$validate_args!', '$to_proc', '$add_readers', '$add_error_methods', '$state', '$singleton_class', '$add_methods', '$remove_methods', '$<<', '$send', '$to_s', '$[]', '$include?', '$class_eval', '$define_method', '$__send__', '$define_singleton_method', '$each', '$add_method', '$instance_variable_get', '$__from__', '$get_state', '$respond_to?', '$wrappers', '$class_state_wrapper', '$__state_wrapper', '$attr_accessor', '$allocate', '$__from__=']); return (function($base) { var $HyperStore, self = $HyperStore = $module($base, 'HyperStore'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $StateWrapper(){}; var self = $StateWrapper = $klass($base, $super, 'StateWrapper', $StateWrapper); var def = self.$$proto, $scope = self.$$scope, TMP_17, TMP_18; self.$extend($scope.get('ArgumentValidator')); (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_1, TMP_2, TMP_3, TMP_7, TMP_10, TMP_11, TMP_13, TMP_15, TMP_16; self.$attr_reader("instance_state_wrapper", "class_state_wrapper", "instance_mutator_wrapper", "class_mutator_wrapper", "wrappers"); Opal.defn(self, '$inherited', TMP_1 = function $$inherited(subclass) { var self = this; if (self['$==']($scope.get('StateWrapper'))) { return subclass.$add_class_instance_vars(subclass) } else { return nil }; }, TMP_1.$$arity = 1); Opal.defn(self, '$add_class_instance_vars', TMP_2 = function $$add_class_instance_vars(subclass) { var self = this; if (self.shared_state_wrapper == null) self.shared_state_wrapper = nil; if (self.shared_mutator_wrapper == null) self.shared_mutator_wrapper = nil; if (self.instance_state_wrapper == null) self.instance_state_wrapper = nil; if (self.instance_mutator_wrapper == null) self.instance_mutator_wrapper = nil; if (self.class_state_wrapper == null) self.class_state_wrapper = nil; if (self.class_mutator_wrapper == null) self.class_mutator_wrapper = nil; self.shared_state_wrapper = subclass; self.instance_state_wrapper = $scope.get('Class').$new(self.shared_state_wrapper); self.class_state_wrapper = $scope.get('Class').$new(self.shared_state_wrapper); self.shared_mutator_wrapper = $scope.get('Class').$new($scope.get('MutatorWrapper')); self.instance_mutator_wrapper = $scope.get('Class').$new(self.shared_mutator_wrapper); self.class_mutator_wrapper = $scope.get('Class').$new(self.shared_mutator_wrapper); return self.wrappers = [self.instance_state_wrapper, self.instance_mutator_wrapper, self.class_state_wrapper, self.class_mutator_wrapper]; }, TMP_2.$$arity = 1); Opal.defn(self, '$define_state_methods', TMP_3 = function $$define_state_methods(klass, $a_rest) { var $b, $c, $d, $e, self = this, args, $iter = TMP_3.$$p, block = $iter || nil, name = nil, opts = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_3.$$p = null; if ((($b = args['$empty?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self}; $c = ($d = ($e = self)['$validate_args!'], $d.$$p = block.$to_proc(), $d).apply($e, [klass].concat(Opal.to_a(args))), $b = Opal.to_ary($c), name = ($b[0] == null ? nil : $b[0]), opts = ($b[1] == null ? nil : $b[1]), $c; self.$add_readers(klass, name, opts); klass.$singleton_class().$state().$add_error_methods(name, opts); klass.$singleton_class().$state().$add_methods(klass, name, opts); klass.$singleton_class().$state().$remove_methods(name, opts); return klass.$send(("__" + opts['$[]']("scope").$to_s() + "_states"))['$<<']([name, opts]); }, TMP_3.$$arity = -2); Opal.defn(self, '$add_readers', TMP_7 = function $$add_readers(klass, name, opts) { var $a, $b, TMP_4, $c, TMP_6, self = this; if ((($a = opts['$[]']("reader")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; if ((($a = ["instance", "shared"]['$include?'](opts['$[]']("scope"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { ($a = ($b = klass).$class_eval, $a.$$p = (TMP_4 = function(){var self = TMP_4.$$s || this, $c, $d, TMP_5; return ($c = ($d = self).$define_method, $c.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this; return self.$state().$__send__((name.$to_s()))}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $c).call($d, (opts['$[]']("reader").$to_s()))}, TMP_4.$$s = self, TMP_4.$$arity = 0, TMP_4), $a).call($b)}; if ((($a = ["class", "shared"]['$include?'](opts['$[]']("scope"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($c = klass).$define_singleton_method, $a.$$p = (TMP_6 = function(){var self = TMP_6.$$s || this; return self.$state().$__send__((name.$to_s()))}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6), $a).call($c, (opts['$[]']("reader").$to_s())) } else { return nil }; }, TMP_7.$$arity = 3); Opal.defn(self, '$add_error_methods', TMP_10 = function $$add_error_methods(name, opts) { var $a, $b, TMP_8, self = this; if (self.shared_state_wrapper == null) self.shared_state_wrapper = nil; if (self.shared_mutator_wrapper == null) self.shared_mutator_wrapper = nil; if (opts['$[]']("scope")['$==']("shared")) { return nil}; return ($a = ($b = [self.shared_state_wrapper, self.shared_mutator_wrapper]).$each, $a.$$p = (TMP_8 = function(klass){var self = TMP_8.$$s || this, $c, $d, TMP_9; if (klass == null) klass = nil; return ($c = ($d = klass).$define_singleton_method, $c.$$p = (TMP_9 = function(){var self = TMP_9.$$s || this; return "nope!"}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9), $c).call($d, (name.$to_s()))}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8), $a).call($b); }, TMP_10.$$arity = 2); Opal.defn(self, '$add_methods', TMP_11 = function $$add_methods(klass, name, opts) { var self = this; self.$instance_variable_get("@" + (opts['$[]']("scope")) + "_state_wrapper").$add_method(klass, name, opts); return self.$instance_variable_get("@" + (opts['$[]']("scope")) + "_mutator_wrapper").$add_method(klass, name, opts); }, TMP_11.$$arity = 3); Opal.defn(self, '$add_method', TMP_13 = function $$add_method(klass, method_name, opts) { var $a, $b, TMP_12, self = this; if (opts == null) { opts = $hash2([], {}); } return ($a = ($b = self).$define_method, $a.$$p = (TMP_12 = function(){var self = TMP_12.$$s || this, from = nil; if (self.__from__ == null) self.__from__ = nil; from = (function() {if (opts['$[]']("scope")['$==']("shared")) { return klass.$state().$__from__() } else { return self.__from__ }; return nil; })(); return (($scope.get('React')).$$scope.get('State')).$get_state(from, method_name.$to_s());}, TMP_12.$$s = self, TMP_12.$$arity = 0, TMP_12), $a).call($b, (method_name.$to_s())); }, TMP_13.$$arity = -3); Opal.defn(self, '$remove_methods', TMP_15 = function $$remove_methods(name, opts) { var $a, $b, TMP_14, self = this; if (opts['$[]']("scope")['$==']("shared")) { } else { return nil }; return ($a = ($b = self.$wrappers()).$each, $a.$$p = (TMP_14 = function(wrapper){var self = TMP_14.$$s || this, $c; if (wrapper == null) wrapper = nil; if ((($c = wrapper['$respond_to?']((name.$to_s()))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return wrapper.$send("remove_method", (name.$to_s())) } else { return nil }}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($b); }, TMP_15.$$arity = 2); return (Opal.defn(self, '$default_scope', TMP_16 = function $$default_scope(klass) { var self = this; if (self['$=='](klass.$singleton_class().$__state_wrapper().$class_state_wrapper())) { return "instance" } else { return "class" }; }, TMP_16.$$arity = 1), nil) && 'default_scope'; })(Opal.get_singleton_class(self)); self.$attr_accessor("__from__"); Opal.defs(self, '$new', TMP_17 = function(from) { var $a, $b, self = this, instance = nil; instance = self.$allocate(); (($a = [from]), $b = instance, $b['$__from__='].apply($b, $a), $a[$a.length-1]); return instance; }, TMP_17.$$arity = 1); return (Opal.defn(self, '$method_missing', TMP_18 = function $$method_missing(name, $a_rest) { var $b, $c, self = this, args, $iter = TMP_18.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_18.$$p = null; $gvars.method_missing = [name].concat(Opal.to_a(args)); ((function(self) { var $scope = self.$$scope, def = self.$$proto; return self })(Opal.get_singleton_class(self))).$add_method(nil, name); return ($b = ($c = self).$__send__, $b.$$p = block.$to_proc(), $b).apply($c, [name].concat(Opal.to_a(args))); }, TMP_18.$$arity = -2), nil) && 'method_missing'; })($scope.base, $scope.get('BaseStoreClass')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-store/version"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; return (function($base) { var $HyperStore, self = $HyperStore = $module($base, 'HyperStore'); var def = self.$$proto, $scope = self.$$scope; Opal.cdecl($scope, 'VERSION', "0.2.3") })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyperloop/store"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$include', '$init_store']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Store(){}; var self = $Store = $klass($base, $super, 'Store', $Store); var def = self.$$proto, $scope = self.$$scope, TMP_2; (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_1; return (Opal.defn(self, '$inherited', TMP_1 = function $$inherited(child) { var self = this; return child.$include($scope.get('Mixin')); }, TMP_1.$$arity = 1), nil) && 'inherited' })(Opal.get_singleton_class(self)); return (Opal.defn(self, '$initialize', TMP_2 = function $$initialize() { var self = this; return self.$init_store(); }, TMP_2.$$arity = 0), nil) && 'initialize'; })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyperloop/application/boot"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$method_defined?', '$<<', '$receivers', '$set_var', '$attr_reader', '$new', '$each', '$call']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Operation(){}; var self = $Operation = $klass($base, $super, 'Operation', $Operation); var def = self.$$proto, $scope = self.$$scope; return (function(self) { var $scope = self.$$scope, def = self.$$proto, $a, TMP_1, TMP_3; if ((($a = self['$method_defined?']("on_dispatch")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Opal.defn(self, '$on_dispatch', TMP_1 = function $$on_dispatch() { var self = this, $iter = TMP_1.$$p, block = $iter || nil; TMP_1.$$p = null; return self.$receivers()['$<<'](block); }, TMP_1.$$arity = 0) }; if ((($a = self['$method_defined?']("receivers")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return (Opal.defn(self, '$receivers', TMP_3 = function $$receivers() { var $a, $b, TMP_2, self = this; return ($a = ($b = (($scope.get('Hyperloop')).$$scope.get('Context'))).$set_var, $a.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this; return []}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $a).call($b, self, "@receivers", $hash2(["force"], {"force": true})); }, TMP_3.$$arity = 0), nil) && 'receivers' }; })(Opal.get_singleton_class(self)) })($scope.base, null); (function($base, $super) { function $Application(){}; var self = $Application = $klass($base, $super, 'Application', $Application); var def = self.$$proto, $scope = self.$$scope, $a; if ((($a = ($scope.Boot != null)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return (function($base, $super) { function $Boot(){}; var self = $Boot = $klass($base, $super, 'Boot', $Boot); var def = self.$$proto, $scope = self.$$scope, TMP_6; (function($base, $super) { function $ReactDummyParams(){}; var self = $ReactDummyParams = $klass($base, $super, 'ReactDummyParams', $ReactDummyParams); var def = self.$$proto, $scope = self.$$scope, TMP_4; self.$attr_reader("context"); return (Opal.defn(self, '$initialize', TMP_4 = function $$initialize(context) { var self = this; return self.context = context; }, TMP_4.$$arity = 1), nil) && 'initialize'; })($scope.base, null); return (Opal.defs(self, '$run', TMP_6 = function $$run($kwargs) { var $a, $b, TMP_5, self = this, context, params = nil; if ($kwargs == null || !$kwargs.$$is_hash) { if ($kwargs == null) { $kwargs = $hash2([], {}); } else { throw Opal.ArgumentError.$new('expected kwargs'); } } if ((context = $kwargs.$$smap['context']) == null) { context = nil } params = $scope.get('ReactDummyParams').$new(context); return ($a = ($b = self.$receivers()).$each, $a.$$p = (TMP_5 = function(receiver){var self = TMP_5.$$s || this; if (receiver == null) receiver = nil; return receiver.$call(params)}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $a).call($b); }, TMP_6.$$arity = -1), nil) && 'run'; })($scope.base, $scope.get('Operation')) } })($scope.base, null); })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyperloop/store/mixin"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$include', '$extend', '$define_singleton_method', '$new', '$singleton_class', '$define_state_methods', '$to_proc', '$__state_wrapper']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Store(){}; var self = $Store = $klass($base, $super, 'Store', $Store); var def = self.$$proto, $scope = self.$$scope; return (function($base) { var $Mixin, self = $Mixin = $module($base, 'Mixin'); var def = self.$$proto, $scope = self.$$scope; (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_3; return (Opal.defn(self, '$included', TMP_3 = function $$included(base) { var $a, $b, TMP_1, $c, TMP_2, self = this; base.$include((($scope.get('HyperStore')).$$scope.get('InstanceMethods'))); base.$extend((($scope.get('HyperStore')).$$scope.get('ClassMethods'))); base.$extend((($scope.get('HyperStore')).$$scope.get('DispatchReceiver'))); ($a = ($b = base.$singleton_class()).$define_singleton_method, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this, $c; if (self.__state_wrapper == null) self.__state_wrapper = nil; return ((($c = self.__state_wrapper) !== false && $c !== nil && $c != null) ? $c : self.__state_wrapper = $scope.get('Class').$new((($scope.get('HyperStore')).$$scope.get('StateWrapper'))))}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b, "__state_wrapper"); return ($a = ($c = base.$singleton_class()).$define_singleton_method, $a.$$p = (TMP_2 = function($d_rest){var self = TMP_2.$$s || this, block, args, $e, $f; block = TMP_2.$$p || nil, TMP_2.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($e = ($f = self.$__state_wrapper()).$define_state_methods, $e.$$p = block.$to_proc(), $e).apply($f, [base].concat(Opal.to_a(args)))}, TMP_2.$$s = self, TMP_2.$$arity = -1, TMP_2), $a).call($c, "state"); }, TMP_3.$$arity = 1), nil) && 'included' })(Opal.get_singleton_class(self)) })($scope.base) })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/state"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$on_client?', '$attr_reader', '$!', '$empty?', '$[]', '$observers_by_name', '$respond_to?', '$each', '$include?', '$[]=', '$+', '$==', '$dup', '$merge!', '$states', '$new_observers', '$<<', '$new', '$after', '$set_state2', '$update_react_js_state', '$notify_observers', '$raise', '$delete', '$current_observers', '$to_f', '$now', '$class', '$name', '$to_s', '$object_id', '$-', '$max', '$define_method', '$instance_variable_get', '$instance_variable_set']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $State(){}; var self = $State = $klass($base, $super, 'State', $State); var def = self.$$proto, $scope = self.$$scope; Opal.cdecl($scope, 'ALWAYS_UPDATE_STATE_AFTER_RENDER', $scope.get('Hyperloop')['$on_client?']()); self.rendering_level = 0; return (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_1, TMP_2, TMP_4, TMP_5, TMP_6, TMP_16, TMP_18, TMP_21, TMP_22, TMP_23, TMP_28, TMP_31, TMP_32, TMP_34, $a, $b, TMP_35; self.$attr_reader("current_observer"); Opal.defn(self, '$has_observers?', TMP_1 = function(object, name) { var self = this; return self.$observers_by_name()['$[]'](object)['$[]'](name)['$empty?']()['$!'](); }, TMP_1.$$arity = 2); Opal.defn(self, '$bulk_update', TMP_2 = function $$bulk_update() { var self = this, $iter = TMP_2.$$p, $yield = $iter || nil, saved_bulk_update_flag = nil; if (self.bulk_update_flag == null) self.bulk_update_flag = nil; TMP_2.$$p = null; try { saved_bulk_update_flag = self.bulk_update_flag; self.bulk_update_flag = true; return Opal.yieldX($yield, []);; } finally { self.bulk_update_flag = saved_bulk_update_flag }; }, TMP_2.$$arity = 0); Opal.defn(self, '$set_state2', TMP_4 = function $$set_state2(object, name, value, updates, exclusions) { var $a, $b, TMP_3, $c, self = this, object_needs_notification = nil; if (exclusions == null) { exclusions = nil; } object_needs_notification = object['$respond_to?']("update_react_js_state"); ($a = ($b = self.$observers_by_name()['$[]'](object)['$[]'](name).$dup()).$each, $a.$$p = (TMP_3 = function(observer){var self = TMP_3.$$s || this, $c, $d; if (observer == null) observer = nil; if ((($c = (($d = exclusions !== false && exclusions !== nil && exclusions != null) ? exclusions['$include?'](observer) : exclusions)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return nil;}; ($c = observer, $d = updates, $d['$[]=']($c, $rb_plus($d['$[]']($c), [object, name, value]))); if (object['$=='](observer)) { return object_needs_notification = false } else { return nil };}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $a).call($b); if (object_needs_notification !== false && object_needs_notification !== nil && object_needs_notification != null) { return ($a = object, $c = updates, $c['$[]=']($a, $rb_plus($c['$[]']($a), [nil, name, value]))) } else { return nil }; }, TMP_4.$$arity = -5); Opal.defn(self, '$initialize_states', TMP_5 = function $$initialize_states(object, initial_values) { var $a, self = this; return self.$states()['$[]'](object)['$merge!'](((($a = initial_values) !== false && $a !== nil && $a != null) ? $a : $hash2([], {}))); }, TMP_5.$$arity = 2); Opal.defn(self, '$get_state', TMP_6 = function $$get_state(object, name, current_observer) { var $a, $b, self = this; if (self.delayed_updates == null) self.delayed_updates = nil; if (self.current_observer == null) self.current_observer = nil; if (current_observer == null) { current_observer = self.current_observer; } if ((($a = (($b = current_observer !== false && current_observer !== nil && current_observer != null) ? self.$new_observers()['$[]'](current_observer)['$[]'](object)['$include?'](name)['$!']() : current_observer)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$new_observers()['$[]'](current_observer)['$[]'](object)['$<<'](name)}; if ((($a = ($b = self.delayed_updates, $b !== false && $b !== nil && $b != null ?self.delayed_updates['$[]'](object)['$[]'](name) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.delayed_updates['$[]'](object)['$[]'](name)['$[]'](1)['$<<'](current_observer)}; return self.$states()['$[]'](object)['$[]'](name); }, TMP_6.$$arity = -3); Opal.defn(self, '$set_state', TMP_16 = function $$set_state(object, name, value, delay) { var $a, $b, $c, TMP_7, $d, TMP_8, TMP_14, $e, TMP_15, self = this, updates = nil; if (self.bulk_update_flag == null) self.bulk_update_flag = nil; if (self.delayed_updates == null) self.delayed_updates = nil; if (self.delayed_updater == null) self.delayed_updater = nil; if (self.rendering_level == null) self.rendering_level = nil; if (delay == null) { delay = $scope.get('ALWAYS_UPDATE_STATE_AFTER_RENDER'); } self.$states()['$[]'](object)['$[]='](name, value); if ((($a = ((($b = delay) !== false && $b !== nil && $b != null) ? $b : self.bulk_update_flag)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { ((($a = self.delayed_updates) !== false && $a !== nil && $a != null) ? $a : self.delayed_updates = ($b = ($c = $scope.get('Hash')).$new, $b.$$p = (TMP_7 = function(h, k){var self = TMP_7.$$s || this; if (h == null) h = nil;if (k == null) k = nil; return h['$[]='](k, $hash2([], {}))}, TMP_7.$$s = self, TMP_7.$$arity = 2, TMP_7), $b).call($c)); self.delayed_updates['$[]'](object)['$[]='](name, [value, $scope.get('Set').$new()]); ((($a = self.delayed_updater) !== false && $a !== nil && $a != null) ? $a : self.delayed_updater = ($b = ($d = self).$after, $b.$$p = (TMP_8 = function(){var self = TMP_8.$$s || this, $e, $f, TMP_9, $g, TMP_10, $h, TMP_11, $i, TMP_13, delayed_updates = nil, updates = nil; if (self.delayed_updates == null) self.delayed_updates = nil; delayed_updates = self.delayed_updates; self.delayed_updates = ($e = ($f = $scope.get('Hash')).$new, $e.$$p = (TMP_9 = function(h, k){var self = TMP_9.$$s || this; if (h == null) h = nil;if (k == null) k = nil; return h['$[]='](k, $hash2([], {}))}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9), $e).call($f); self.delayed_updater = nil; updates = ($e = ($g = $scope.get('Hash')).$new, $e.$$p = (TMP_10 = function(hash, key){var self = TMP_10.$$s || this; if (hash == null) hash = nil;if (key == null) key = nil; return hash['$[]='](key, $scope.get('Array').$new())}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10), $e).call($g); ($e = ($h = delayed_updates).$each, $e.$$p = (TMP_11 = function(object, name_hash){var self = TMP_11.$$s || this, $i, $j, TMP_12; if (object == null) object = nil;if (name_hash == null) name_hash = nil; return ($i = ($j = name_hash).$each, $i.$$p = (TMP_12 = function(name, value_and_set){var self = TMP_12.$$s || this; if (name == null) name = nil;if (value_and_set == null) value_and_set = nil; return self.$set_state2(object, name, value_and_set['$[]'](0), updates, value_and_set['$[]'](1))}, TMP_12.$$s = self, TMP_12.$$arity = 2, TMP_12), $i).call($j)}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11), $e).call($h); return ($e = ($i = updates).$each, $e.$$p = (TMP_13 = function(observer, args){var self = TMP_13.$$s || this, $j; if (observer == null) observer = nil;if (args == null) args = nil; return ($j = observer).$update_react_js_state.apply($j, Opal.to_a(args))}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13), $e).call($i);}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8), $b).call($d, 0.001)); } else if (self.rendering_level['$=='](0)) { updates = ($a = ($b = $scope.get('Hash')).$new, $a.$$p = (TMP_14 = function(hash, key){var self = TMP_14.$$s || this; if (hash == null) hash = nil;if (key == null) key = nil; return hash['$[]='](key, $scope.get('Array').$new())}, TMP_14.$$s = self, TMP_14.$$arity = 2, TMP_14), $a).call($b); self.$set_state2(object, name, value, updates); ($a = ($e = updates).$each, $a.$$p = (TMP_15 = function(observer, args){var self = TMP_15.$$s || this, $f; if (observer == null) observer = nil;if (args == null) args = nil; return ($f = observer).$update_react_js_state.apply($f, Opal.to_a(args))}, TMP_15.$$s = self, TMP_15.$$arity = 2, TMP_15), $a).call($e);}; return value; }, TMP_16.$$arity = -4); Opal.defn(self, '$notify_observers', TMP_18 = function $$notify_observers(object, name, value) { var $a, $b, TMP_17, self = this, object_needs_notification = nil; object_needs_notification = object['$respond_to?']("update_react_js_state"); ($a = ($b = self.$observers_by_name()['$[]'](object)['$[]'](name).$dup()).$each, $a.$$p = (TMP_17 = function(observer){var self = TMP_17.$$s || this; if (observer == null) observer = nil; observer.$update_react_js_state(object, name, value); if (object['$=='](observer)) { return object_needs_notification = false } else { return nil };}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17), $a).call($b); if (object_needs_notification !== false && object_needs_notification !== nil && object_needs_notification != null) { return object.$update_react_js_state(nil, name, value) } else { return nil }; }, TMP_18.$$arity = 3); Opal.defn(self, '$notify_observers_after_thread_completes', TMP_21 = function $$notify_observers_after_thread_completes(object, name, value) { var $a, $b, $c, TMP_19, self = this; if (self.delayed_updates == null) self.delayed_updates = nil; if (self.delayed_updater == null) self.delayed_updater = nil; (((($a = self.delayed_updates) !== false && $a !== nil && $a != null) ? $a : self.delayed_updates = []))['$<<']([object, name, value]); return ((($a = self.delayed_updater) !== false && $a !== nil && $a != null) ? $a : self.delayed_updater = ($b = ($c = self).$after, $b.$$p = (TMP_19 = function(){var self = TMP_19.$$s || this, $d, $e, TMP_20, delayed_updates = nil; if (self.delayed_updates == null) self.delayed_updates = nil; delayed_updates = self.delayed_updates; self.delayed_updates = []; self.delayed_updater = nil; return ($d = ($e = delayed_updates).$each, $d.$$p = (TMP_20 = function(args){var self = TMP_20.$$s || this, $f; if (args == null) args = nil; return ($f = self).$notify_observers.apply($f, Opal.to_a(args))}, TMP_20.$$s = self, TMP_20.$$arity = 1, TMP_20), $d).call($e);}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19), $b).call($c, 0)); }, TMP_21.$$arity = 3); Opal.defn(self, '$will_be_observing?', TMP_22 = function(object, name, current_observer) { var $a, self = this; return (($a = current_observer !== false && current_observer !== nil && current_observer != null) ? self.$new_observers()['$[]'](current_observer)['$[]'](object)['$include?'](name) : current_observer); }, TMP_22.$$arity = 3); Opal.defn(self, '$is_observing?', TMP_23 = function(object, name, current_observer) { var $a, self = this; return (($a = current_observer !== false && current_observer !== nil && current_observer != null) ? self.$observers_by_name()['$[]'](object)['$[]'](name)['$include?'](current_observer) : current_observer); }, TMP_23.$$arity = 3); Opal.defn(self, '$update_states_to_observe', TMP_28 = function $$update_states_to_observe(current_observer) { var $a, $b, TMP_24, $c, TMP_26, self = this, observers = nil; if (self.current_observer == null) self.current_observer = nil; if (current_observer == null) { current_observer = self.current_observer; } if (current_observer !== false && current_observer !== nil && current_observer != null) { } else { self.$raise("update_states_to_observer called outside of watch block") }; ($a = ($b = self.$current_observers()['$[]'](current_observer)).$each, $a.$$p = (TMP_24 = function(object, names){var self = TMP_24.$$s || this, $c, $d, TMP_25; if (object == null) object = nil;if (names == null) names = nil; return ($c = ($d = names).$each, $c.$$p = (TMP_25 = function(name){var self = TMP_25.$$s || this; if (name == null) name = nil; return self.$observers_by_name()['$[]'](object)['$[]'](name).$delete(current_observer)}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25), $c).call($d)}, TMP_24.$$s = self, TMP_24.$$arity = 2, TMP_24), $a).call($b); observers = self.$current_observers()['$[]='](current_observer, self.$new_observers()['$[]'](current_observer)); self.$new_observers().$delete(current_observer); return ($a = ($c = observers).$each, $a.$$p = (TMP_26 = function(object, names){var self = TMP_26.$$s || this, $d, $e, TMP_27; if (object == null) object = nil;if (names == null) names = nil; return ($d = ($e = names).$each, $d.$$p = (TMP_27 = function(name){var self = TMP_27.$$s || this; if (name == null) name = nil; return self.$observers_by_name()['$[]'](object)['$[]'](name)['$<<'](current_observer)}, TMP_27.$$s = self, TMP_27.$$arity = 1, TMP_27), $d).call($e)}, TMP_26.$$s = self, TMP_26.$$arity = 2, TMP_26), $a).call($c); }, TMP_28.$$arity = -1); Opal.defn(self, '$remove', TMP_31 = function $$remove() { var $a, $b, TMP_29, self = this; if (self.current_observer == null) self.current_observer = nil; if ((($a = self.current_observer) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise("remove called outside of watch block") }; ($a = ($b = self.$current_observers()['$[]'](self.current_observer)).$each, $a.$$p = (TMP_29 = function(object, names){var self = TMP_29.$$s || this, $c, $d, TMP_30; if (object == null) object = nil;if (names == null) names = nil; return ($c = ($d = names).$each, $c.$$p = (TMP_30 = function(name){var self = TMP_30.$$s || this; if (self.current_observer == null) self.current_observer = nil; if (name == null) name = nil; return self.$observers_by_name()['$[]'](object)['$[]'](name).$delete(self.current_observer)}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30), $c).call($d)}, TMP_29.$$s = self, TMP_29.$$arity = 2, TMP_29), $a).call($b); return self.$current_observers().$delete(self.current_observer); }, TMP_31.$$arity = 0); Opal.defn(self, '$set_state_context_to', TMP_32 = function $$set_state_context_to(observer, rendering) { var $a, self = this, $iter = TMP_32.$$p, $yield = $iter || nil, start_time = nil, observer_name = nil, saved_current_observer = nil, return_value = nil; if (self.nesting_level == null) self.nesting_level = nil; if (self.current_observer == null) self.current_observer = nil; if (self.rendering_level == null) self.rendering_level = nil; if (rendering == null) { rendering = nil; } TMP_32.$$p = null; try { if ((($a = typeof Opal.global.reactive_ruby_timing !== 'undefined') !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.nesting_level = $rb_plus((((($a = self.nesting_level) !== false && $a !== nil && $a != null) ? $a : 0)), 1); start_time = $scope.get('Time').$now().$to_f(); observer_name = (function() { try {return ((function() {if ((($a = observer.$class()['$respond_to?']("name")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return observer.$class().$name() } else { return observer.$to_s() }; return nil; })()) } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { return "object:" + (observer.$object_id()) } else { throw $err; } }})();}; saved_current_observer = self.current_observer; self.current_observer = observer; if (rendering !== false && rendering !== nil && rendering != null) { self.rendering_level = $rb_plus(self.rendering_level, 1)}; return_value = Opal.yieldX($yield, []); return return_value; } finally { self.current_observer = saved_current_observer; if (rendering !== false && rendering !== nil && rendering != null) { self.rendering_level = $rb_minus(self.rendering_level, 1)}; if ((($a = typeof Opal.global.reactive_ruby_timing !== 'undefined') !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.nesting_level = [0, $rb_minus(self.nesting_level, 1)].$max()}; return_value; }; }, TMP_32.$$arity = -2); Opal.defn(self, '$states', TMP_34 = function $$states() { var $a, $b, $c, TMP_33, self = this; if (self.states == null) self.states = nil; return ((($a = self.states) !== false && $a !== nil && $a != null) ? $a : self.states = ($b = ($c = $scope.get('Hash')).$new, $b.$$p = (TMP_33 = function(h, k){var self = TMP_33.$$s || this; if (h == null) h = nil;if (k == null) k = nil; return h['$[]='](k, $hash2([], {}))}, TMP_33.$$s = self, TMP_33.$$arity = 2, TMP_33), $b).call($c)); }, TMP_34.$$arity = 0); return ($a = ($b = ["new_observers", "current_observers", "observers_by_name"]).$each, $a.$$p = (TMP_35 = function(method_name){var self = TMP_35.$$s || this, $c, $d, TMP_36; if (method_name == null) method_name = nil; return ($c = ($d = self).$define_method, $c.$$p = (TMP_36 = function(){var self = TMP_36.$$s || this, $e, $f, $g, TMP_37; return ((($e = self.$instance_variable_get("@" + (method_name))) !== false && $e !== nil && $e != null) ? $e : self.$instance_variable_set("@" + (method_name), ($f = ($g = $scope.get('Hash')).$new, $f.$$p = (TMP_37 = function(h, k){var self = TMP_37.$$s || this, $h, $i, TMP_38; if (h == null) h = nil;if (k == null) k = nil; return h['$[]='](k, ($h = ($i = $scope.get('Hash')).$new, $h.$$p = (TMP_38 = function(h, k){var self = TMP_38.$$s || this; if (h == null) h = nil;if (k == null) k = nil; return h['$[]='](k, [])}, TMP_38.$$s = self, TMP_38.$$arity = 2, TMP_38), $h).call($i))}, TMP_37.$$s = self, TMP_37.$$arity = 2, TMP_37), $f).call($g)))}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36), $c).call($d, method_name)}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35), $a).call($b); })(Opal.get_singleton_class(self)); })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-store"] = function(Opal) { var $a, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$import', '$!=']); self.$require("set"); self.$require("hyperloop-config"); $scope.get('Hyperloop').$import("hyper-store"); (function($base) { var $HyperStore, self = $HyperStore = $module($base, 'HyperStore'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $BaseStoreClass(){}; var self = $BaseStoreClass = $klass($base, $super, 'BaseStoreClass', $BaseStoreClass); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('BasicObject')) })($scope.base); self.$require("hyper-store/class_methods"); self.$require("hyper-store/dispatch_receiver"); self.$require("hyper-store/instance_methods"); self.$require("hyper-store/mutator_wrapper"); self.$require("hyper-store/state_wrapper/argument_validator"); self.$require("hyper-store/state_wrapper"); self.$require("hyper-store/version"); self.$require("hyperloop/store"); self.$require("hyperloop/application/boot"); self.$require("hyperloop/store/mixin"); self.$require("react/state"); if ((($a = $scope.get('RUBY_ENGINE')['$!=']("opal")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; }; /* Generated by Opal 0.10.4 */ Opal.modules["react/state_wrapper"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$instance_variable_get', '$__from__', '$=~', '$respond_to?', '$deprecation_warning', '$gsub', '$__send__', '$mutate', '$pre_component_method_missing']); return (function($base) { var $HyperStore, self = $HyperStore = $module($base, 'HyperStore'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $StateWrapper(){}; var self = $StateWrapper = $klass($base, $super, 'StateWrapper', $StateWrapper); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3; Opal.defn(self, '$[]', TMP_1 = function(state) { var self = this; return self.$__from__().$instance_variable_get("@native").state[state] || nil; }, TMP_1.$$arity = 1); Opal.defn(self, '$[]=', TMP_2 = function(state, new_value) { var self = this; return self.$__from__().$instance_variable_get("@native").state[state] = new_value; }, TMP_2.$$arity = 2); Opal.alias(self, 'pre_component_method_missing', 'method_missing'); return (Opal.defn(self, '$method_missing', TMP_3 = function $$method_missing(method, $a_rest) { var $b, $c, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } if ((($b = ($c = method['$=~'](/\!$/), $c !== false && $c !== nil && $c != null ?self.$__from__()['$respond_to?']("deprecation_warning") : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$__from__().$deprecation_warning("The mutator 'state." + (method) + "' has been deprecated. Use 'mutate." + (method.$gsub(/\!$/, "")) + "' instead."); return ($b = self.$__from__().$mutate()).$__send__.apply($b, [method.$gsub(/\!$/, "")].concat(Opal.to_a(args))); } else { return ($c = self).$pre_component_method_missing.apply($c, [method].concat(Opal.to_a(args))) }; }, TMP_3.$$arity = -2), nil) && 'method_missing'; })($scope.base, $scope.get('BaseStoreClass')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/component/api"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$!', '$set_or_replace_state_or_prop', '$to_proc', '$private', '$raise', '$shallow_to_n', '$call']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Component, self = $Component = $module($base, 'Component'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $API, self = $API = $module($base, 'API'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8; Opal.defn(self, '$dom_node', TMP_1 = function $$dom_node() { var $a, self = this; if ((($a = ((typeof ReactDOM === 'undefined' || typeof ReactDOM.findDOMNode === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ReactDOM.findDOMNode(self.native); } else if ((($a = ((typeof React.findDOMNode === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return React.findDOMNode(self.native); } else { return self.native.getDOMNode; }; }, TMP_1.$$arity = 0); Opal.defn(self, '$mounted?', TMP_2 = function() { var self = this; return self.native.isMounted(); }, TMP_2.$$arity = 0); Opal.defn(self, '$force_update!', TMP_3 = function() { var self = this; return self.native.forceUpdate(); }, TMP_3.$$arity = 0); Opal.defn(self, '$set_props', TMP_4 = function $$set_props(prop) { var $a, $b, self = this, $iter = TMP_4.$$p, block = $iter || nil; TMP_4.$$p = null; return ($a = ($b = self).$set_or_replace_state_or_prop, $a.$$p = block.$to_proc(), $a).call($b, prop, "setProps"); }, TMP_4.$$arity = 1); Opal.defn(self, '$set_props!', TMP_5 = function(prop) { var $a, $b, self = this, $iter = TMP_5.$$p, block = $iter || nil; TMP_5.$$p = null; return ($a = ($b = self).$set_or_replace_state_or_prop, $a.$$p = block.$to_proc(), $a).call($b, prop, "replaceProps"); }, TMP_5.$$arity = 1); Opal.defn(self, '$set_state', TMP_6 = function $$set_state(state) { var $a, $b, self = this, $iter = TMP_6.$$p, block = $iter || nil; TMP_6.$$p = null; return ($a = ($b = self).$set_or_replace_state_or_prop, $a.$$p = block.$to_proc(), $a).call($b, state, "setState"); }, TMP_6.$$arity = 1); Opal.defn(self, '$set_state!', TMP_7 = function(state) { var $a, $b, self = this, $iter = TMP_7.$$p, block = $iter || nil; TMP_7.$$p = null; return ($a = ($b = self).$set_or_replace_state_or_prop, $a.$$p = block.$to_proc(), $a).call($b, state, "replaceState"); }, TMP_7.$$arity = 1); self.$private(); Opal.defn(self, '$set_or_replace_state_or_prop', TMP_8 = function $$set_or_replace_state_or_prop(state_or_prop, method) { var $a, self = this, $iter = TMP_8.$$p, block = $iter || nil; if (self["native"] == null) self["native"] = nil; TMP_8.$$p = null; if ((($a = self["native"]) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise("No native ReactComponent associated") }; self["native"][method](state_or_prop.$shallow_to_n(), function(){ (function() {if (block !== false && block !== nil && block != null) { return block.$call() } else { return nil }; return nil; })() }); ; }, TMP_8.$$arity = 2); })($scope.base) })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/component/class_methods"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $range = Opal.range, $hash2 = Opal.hash2, $hash = Opal.hash; Opal.add_stubs(['$deprecation_warning', '$==', '$[]', '$message', '$backtrace', '$>', '$length', '$!', '$append_backtrace', '$join', '$raise', '$<<', '$each', '$is_a?', '$type', '$define_method', '$render', '$instance_eval', '$to_proc', '$empty?', '$method_missing', '$haml_class_name', '$new', '$props_wrapper', '$validator', '$validate', '$+', '$name', '$count', '$default_props', '$build', '$first', '$delete', '$merge!', '$optional', '$requires', '$allow_undefined_props=', '$undefined_props', '$props', '$arity', '$last', '$pop', '$state', '$[]=', '$__send__', '$mutate', '$singleton_class', '$native_mixins', '$static_call_backs', '$split', '$Native', '$to_n', '$add_item_to_tree', '$create_native_react_class', '$reverse', '$import_native_component', '$eval_native_react_component', '$!=', '$class', '$inject']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Component, self = $Component = $module($base, 'Component'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $ClassMethods, self = $ClassMethods = $module($base, 'ClassMethods'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_6, TMP_7, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_20, TMP_21, TMP_24, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_34, TMP_36; Opal.defn(self, '$deprecation_warning', TMP_1 = function $$deprecation_warning(message) { var self = this; return (($scope.get('React')).$$scope.get('Component')).$deprecation_warning(self, message); }, TMP_1.$$arity = 1); Opal.defn(self, '$reactrb_component?', TMP_2 = function() { var self = this; return true; }, TMP_2.$$arity = 0); Opal.defn(self, '$backtrace', TMP_3 = function $$backtrace($a_rest) { var $b, self = this, args; if (self.dont_catch_exceptions == null) self.dont_catch_exceptions = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } self.dont_catch_exceptions = (args['$[]'](0)['$==']("none")); return self.backtrace_off = ((($b = self.dont_catch_exceptions) !== false && $b !== nil && $b != null) ? $b : (args['$[]'](0)['$==']("off"))); }, TMP_3.$$arity = -1); Opal.defn(self, '$process_exception', TMP_4 = function $$process_exception(e, component, reraise) { var $a, $b, $c, self = this, message = nil; if (self.dont_catch_exceptions == null) self.dont_catch_exceptions = nil; if (self.backtrace_off == null) self.backtrace_off = nil; if (reraise == null) { reraise = self.dont_catch_exceptions; } if ((($a = self.dont_catch_exceptions) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { message = ["Exception raised while rendering " + (component) + ": " + (e.$message())]; if ((($a = ($b = ($c = e.$backtrace(), $c !== false && $c !== nil && $c != null ?$rb_gt(e.$backtrace().$length(), 1) : $c), $b !== false && $b !== nil && $b != null ?self.backtrace_off['$!']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$append_backtrace(message, e.$backtrace())}; console.error(message.$join("\n")); }; if (reraise !== false && reraise !== nil && reraise != null) { return self.$raise(e) } else { return nil }; }, TMP_4.$$arity = -3); Opal.defn(self, '$append_backtrace', TMP_6 = function $$append_backtrace(message_array, backtrace) { var $a, $b, TMP_5, self = this; message_array['$<<'](" " + (backtrace['$[]'](0))); return ($a = ($b = backtrace['$[]']($range(1, -1, false))).$each, $a.$$p = (TMP_5 = function(line){var self = TMP_5.$$s || this; if (line == null) line = nil; return message_array['$<<'](line)}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $a).call($b); }, TMP_6.$$arity = 2); Opal.defn(self, '$render', TMP_7 = function $$render(container, params) { var $a, $b, TMP_8, $c, TMP_10, self = this, $iter = TMP_7.$$p, block = $iter || nil; if (container == null) { container = nil; } if (params == null) { params = $hash2([], {}); } TMP_7.$$p = null; if (container !== false && container !== nil && container != null) { if ((($a = container['$is_a?']((($scope.get('React')).$$scope.get('Element')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { container = container.$type()}; return ($a = ($b = self).$define_method, $a.$$p = (TMP_8 = function(){var self = TMP_8.$$s || this, $c, $d, TMP_9; return ($c = ($d = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $c.$$p = (TMP_9 = function(){var self = TMP_9.$$s || this, $e, $f; if (block !== false && block !== nil && block != null) { return ($e = ($f = self).$instance_eval, $e.$$p = block.$to_proc(), $e).call($f) } else { return nil }}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9), $c).call($d, container, params)}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8), $a).call($b, "render"); } else { return ($a = ($c = self).$define_method, $a.$$p = (TMP_10 = function(){var self = TMP_10.$$s || this, $d, $e; return ($d = ($e = self).$instance_eval, $d.$$p = block.$to_proc(), $d).call($e)}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10), $a).call($c, "render") }; }, TMP_7.$$arity = -1); Opal.defn(self, '$method_missing', TMP_11 = function $$method_missing(name, $a_rest) { var $b, $c, $d, self = this, args, $iter = TMP_11.$$p, children = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_11.$$p = null; if ((($b = args['$empty?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { ($b = ($c = $scope.get('Object')).$method_missing, $b.$$p = children.$to_proc(), $b).apply($c, [name].concat(Opal.to_a(args))) }; return ($b = ($d = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $b.$$p = children.$to_proc(), $b).call($d, self, $hash2(["class"], {"class": (($scope.get('React')).$$scope.get('Element')).$haml_class_name(name)})); }, TMP_11.$$arity = -2); Opal.defn(self, '$validator', TMP_12 = function $$validator() { var $a, self = this; if (self.validator == null) self.validator = nil; return ((($a = self.validator) !== false && $a !== nil && $a != null) ? $a : self.validator = $scope.get('Validator').$new(self.$props_wrapper())); }, TMP_12.$$arity = 0); Opal.defn(self, '$prop_types', TMP_13 = function $$prop_types() { var $a, self = this; if ((($a = self.$validator()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $hash2(["_componentValidator"], {"_componentValidator": function(props, propName, componentName) { var errors = self.$validator().$validate($scope.get('Hash').$new(props)); var error = new Error($rb_plus("In component `" + (self.$name()) + "`\n", (errors).$join("\n"))); return (function() {if ((($a = $rb_gt((errors).$count(), 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return error; } else { return undefined; }; return nil; })(); } }) } else { return $hash2([], {}) }; }, TMP_13.$$arity = 0); Opal.defn(self, '$default_props', TMP_14 = function $$default_props() { var self = this; return self.$validator().$default_props(); }, TMP_14.$$arity = 0); Opal.defn(self, '$params', TMP_15 = function $$params() { var $a, $b, self = this, $iter = TMP_15.$$p, block = $iter || nil; TMP_15.$$p = null; return ($a = ($b = self.$validator()).$build, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_15.$$arity = 0); Opal.defn(self, '$props_wrapper', TMP_16 = function $$props_wrapper() { var $a, self = this; if (self.props_wrapper == null) self.props_wrapper = nil; return ((($a = self.props_wrapper) !== false && $a !== nil && $a != null) ? $a : self.props_wrapper = $scope.get('Class').$new($scope.get('PropsWrapper'))); }, TMP_16.$$arity = 0); Opal.defn(self, '$param', TMP_17 = function $$param($a_rest) { var $b, self = this, args, options = nil, name = nil, default$ = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($b = args['$[]'](0)['$is_a?']($scope.get('Hash'))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { options = args['$[]'](0); name = options.$first()['$[]'](0); default$ = options.$first()['$[]'](1); options.$delete(name); options['$merge!']($hash2(["default"], {"default": default$})); } else { name = args['$[]'](0); options = ((($b = args['$[]'](1)) !== false && $b !== nil && $b != null) ? $b : $hash2([], {})); }; if ((($b = options['$[]']("default")) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$validator().$optional(name, options) } else { return self.$validator().$requires(name, options) }; }, TMP_17.$$arity = -1); Opal.defn(self, '$collect_other_params_as', TMP_20 = function $$collect_other_params_as(name) { var $a, $b, TMP_18, $c, TMP_19, self = this, validator_in_lexical_scope = nil, validator_in_lexial_scope = nil; (($a = [true]), $b = self.$validator(), $b['$allow_undefined_props='].apply($b, $a), $a[$a.length-1]); validator_in_lexical_scope = self.$validator(); ($a = ($b = self.$props_wrapper()).$define_method, $a.$$p = (TMP_18 = function(){var self = TMP_18.$$s || this, $c; if (self._all_others == null) self._all_others = nil; return ((($c = self._all_others) !== false && $c !== nil && $c != null) ? $c : self._all_others = validator_in_lexical_scope.$undefined_props(self.$props()))}, TMP_18.$$s = self, TMP_18.$$arity = 0, TMP_18), $a).call($b, name); validator_in_lexial_scope = self.$validator(); return ($a = ($c = self.$props_wrapper()).$define_method, $a.$$p = (TMP_19 = function(){var self = TMP_19.$$s || this, $d; if (self._all_others == null) self._all_others = nil; return ((($d = self._all_others) !== false && $d !== nil && $d != null) ? $d : self._all_others = validator_in_lexial_scope.$undefined_props(self.$props()))}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19), $a).call($c, name); }, TMP_20.$$arity = 1); Opal.defn(self, '$define_state', TMP_21 = function $$define_state($a_rest) { var $b, $c, TMP_22, $d, TMP_23, self = this, states, $iter = TMP_21.$$p, block = $iter || nil, default_initial_value = nil, states_hash = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } states = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { states[$arg_idx - 0] = arguments[$arg_idx]; } TMP_21.$$p = null; self.$deprecation_warning("'define_state' is deprecated. Use the 'state' macro to declare states."); default_initial_value = (function() {if ((($b = ((($c = block !== false && block !== nil && block != null) ? block.$arity()['$=='](0) : block))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return Opal.yieldX(block, []); } else { return nil }; return nil; })(); states_hash = (function() {if ((($b = (states.$last()['$is_a?']($scope.get('Hash')))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return states.$pop() } else { return $hash2([], {}) }; return nil; })(); ($b = ($c = states).$each, $b.$$p = (TMP_22 = function(name){var self = TMP_22.$$s || this; if (name == null) name = nil; return self.$state($hash(name, default_initial_value))}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22), $b).call($c); return ($b = ($d = states_hash).$each, $b.$$p = (TMP_23 = function(name, value){var self = TMP_23.$$s || this; if (name == null) name = nil;if (value == null) value = nil; return self.$state($hash(name, value))}, TMP_23.$$s = self, TMP_23.$$arity = 2, TMP_23), $b).call($d); }, TMP_21.$$arity = -1); Opal.defn(self, '$export_state', TMP_24 = function $$export_state($a_rest) { var $b, $c, TMP_25, $d, TMP_26, self = this, states, $iter = TMP_24.$$p, block = $iter || nil, default_initial_value = nil, states_hash = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } states = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { states[$arg_idx - 0] = arguments[$arg_idx]; } TMP_24.$$p = null; self.$deprecation_warning("'export_state' is deprecated. Use the 'state' macro to declare states."); default_initial_value = (function() {if ((($b = ((($c = block !== false && block !== nil && block != null) ? block.$arity()['$=='](0) : block))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return Opal.yieldX(block, []); } else { return nil }; return nil; })(); states_hash = (function() {if ((($b = (states.$last()['$is_a?']($scope.get('Hash')))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return states.$pop() } else { return $hash2([], {}) }; return nil; })(); ($b = ($c = states).$each, $b.$$p = (TMP_25 = function(name){var self = TMP_25.$$s || this; if (name == null) name = nil; return states_hash['$[]='](name, default_initial_value)}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25), $b).call($c); return ($b = ($d = states_hash).$each, $b.$$p = (TMP_26 = function(name, value){var self = TMP_26.$$s || this, $a, $e, TMP_27; if (name == null) name = nil;if (value == null) value = nil; self.$state($hash(name, value, "scope", "class", "reader", true)); return ($a = ($e = self.$singleton_class()).$define_method, $a.$$p = (TMP_27 = function($f_rest){var self = TMP_27.$$s || this, args, $g; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($g = self.$mutate()).$__send__.apply($g, [name].concat(Opal.to_a(args)))}, TMP_27.$$s = self, TMP_27.$$arity = -1, TMP_27), $a).call($e, "" + (name) + "!");}, TMP_26.$$s = self, TMP_26.$$arity = 2, TMP_26), $b).call($d); }, TMP_24.$$arity = -1); Opal.defn(self, '$native_mixin', TMP_28 = function $$native_mixin(item) { var self = this; return self.$native_mixins()['$<<'](item); }, TMP_28.$$arity = 1); Opal.defn(self, '$native_mixins', TMP_29 = function $$native_mixins() { var $a, self = this; if (self.native_mixins == null) self.native_mixins = nil; return ((($a = self.native_mixins) !== false && $a !== nil && $a != null) ? $a : self.native_mixins = []); }, TMP_29.$$arity = 0); Opal.defn(self, '$static_call_back', TMP_30 = function $$static_call_back(name) { var self = this, $iter = TMP_30.$$p, block = $iter || nil; TMP_30.$$p = null; return self.$static_call_backs()['$[]='](name, block); }, TMP_30.$$arity = 1); Opal.defn(self, '$static_call_backs', TMP_31 = function $$static_call_backs() { var $a, self = this; if (self.static_call_backs == null) self.static_call_backs = nil; return ((($a = self.static_call_backs) !== false && $a !== nil && $a != null) ? $a : self.static_call_backs = $hash2([], {})); }, TMP_31.$$arity = 0); Opal.defn(self, '$export_component', TMP_32 = function $$export_component(opts) { var $a, self = this, export_name = nil, first_name = nil; if (opts == null) { opts = $hash2([], {}); } export_name = (((($a = opts['$[]']("as")) !== false && $a !== nil && $a != null) ? $a : self.$name())).$split("::"); first_name = export_name.$first(); return self.$Native(Opal.global)['$[]='](first_name, self.$add_item_to_tree(self.$Native(Opal.global)['$[]'](first_name), $rb_plus([(($scope.get('React')).$$scope.get('API')).$create_native_react_class(self)], export_name['$[]']($range(1, -1, false)).$reverse())).$to_n()); }, TMP_32.$$arity = -1); Opal.defn(self, '$imports', TMP_34 = function $$imports(component_name) { var $a, $b, TMP_33, self = this, e = nil; try { try { (($scope.get('React')).$$scope.get('API')).$import_native_component(self, (($scope.get('React')).$$scope.get('API')).$eval_native_react_component(component_name)); return ($a = ($b = self).$define_method, $a.$$p = (TMP_33 = function(){var self = TMP_33.$$s || this; return nil}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33), $a).call($b, "render"); } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { return self.$raise("" + (self) + " cannot import '" + (component_name) + "': " + (e.$message()) + ".") } finally { Opal.pop_exception() } } else { throw $err; } } } finally { self }; }, TMP_34.$$arity = 1); Opal.defn(self, '$add_item_to_tree', TMP_36 = function $$add_item_to_tree(current_tree, new_item) { var $a, $b, TMP_35, self = this; if ((($a = ((($b = self.$Native(current_tree).$class()['$!=']((($scope.get('Native')).$$scope.get('Object')))) !== false && $b !== nil && $b != null) ? $b : new_item.$length()['$=='](1))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = new_item).$inject, $a.$$p = (TMP_35 = function(a, e){var self = TMP_35.$$s || this; if (a == null) a = nil;if (e == null) e = nil; return $hash(e, a)}, TMP_35.$$s = self, TMP_35.$$arity = 2, TMP_35), $a).call($b) } else { self.$Native(current_tree)['$[]='](new_item.$last(), self.$add_item_to_tree(self.$Native(current_tree)['$[]'](new_item.$last()), new_item['$[]']($range(0, -2, false)))); return current_tree; }; }, TMP_36.$$arity = 2); })($scope.base) })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/component/props_wrapper"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$attr_reader', '$==', '$define_method', '$value_for', '$>', '$count', '$call', '$[]', '$props', '$to_proc', '$fetch_from_cache', '$respond_to?', '$_react_param_conversion', '$is_a?', '$collect', '$private', '$cache', '$equal?', '$tap', '$[]=', '$new', '$component', '$instance_variable_get']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Component, self = $Component = $module($base, 'Component'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $PropsWrapper(){}; var self = $PropsWrapper = $klass($base, $super, 'PropsWrapper', $PropsWrapper); var def = self.$$proto, $scope = self.$$scope, TMP_7, TMP_8, TMP_9, TMP_11, TMP_13, TMP_14, TMP_15; def.cache = nil; self.$attr_reader("component"); Opal.defs(self, '$define_param', TMP_7 = function $$define_param(name, param_type) { var $a, $b, TMP_1, $c, TMP_2, $d, TMP_3, $e, TMP_4, self = this; if (param_type['$==']($scope.get('Observable'))) { ($a = ($b = self).$define_method, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this; return self.$value_for(name)}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b, "" + (name)); return ($a = ($c = self).$define_method, $a.$$p = (TMP_2 = function($d_rest){var self = TMP_2.$$s || this, args, $e, current_value = nil; if (self.dont_update_state == null) self.dont_update_state = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } current_value = self.$value_for(name); if ((($e = $rb_gt(args.$count(), 0)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { self.$props()['$[]'](name).$call(args['$[]'](0)); return current_value; } else { try {(function() {if ((($e = self.dont_update_state) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { return nil } else { return self.$props()['$[]'](name).$call(current_value) }; return nil; })() } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { nil } else { throw $err; } }; return self.$props()['$[]'](name); };}, TMP_2.$$s = self, TMP_2.$$arity = -1, TMP_2), $a).call($c, "" + (name) + "!"); } else if (param_type['$==']($scope.get('Proc'))) { return ($a = ($d = self).$define_method, $a.$$p = (TMP_3 = function($e_rest){var self = TMP_3.$$s || this, block, args, $f, $g; block = TMP_3.$$p || nil, TMP_3.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($f = self.$props()['$[]'](name)) !== nil && $f != null && (!$f.$$is_boolean || $f == true))) { return ($f = ($g = self.$props()['$[]'](name)).$call, $f.$$p = block.$to_proc(), $f).apply($g, Opal.to_a(args)) } else { return nil }}, TMP_3.$$s = self, TMP_3.$$arity = -1, TMP_3), $a).call($d, "" + (name)) } else { return ($a = ($e = self).$define_method, $a.$$p = (TMP_4 = function(){var self = TMP_4.$$s || this, $f, $g, TMP_5; return ($f = ($g = self).$fetch_from_cache, $f.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this, $h, $i, TMP_6; if ((($h = param_type['$respond_to?']("_react_param_conversion")) !== nil && $h != null && (!$h.$$is_boolean || $h == true))) { return param_type.$_react_param_conversion(self.$props()['$[]'](name), nil) } else if ((($h = ($i = param_type['$is_a?']($scope.get('Array')), $i !== false && $i !== nil && $i != null ?param_type['$[]'](0)['$respond_to?']("_react_param_conversion") : $i)) !== nil && $h != null && (!$h.$$is_boolean || $h == true))) { return ($h = ($i = self.$props()['$[]'](name)).$collect, $h.$$p = (TMP_6 = function(param){var self = TMP_6.$$s || this; if (param == null) param = nil; return param_type['$[]'](0).$_react_param_conversion(param, nil)}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $h).call($i) } else { return self.$props()['$[]'](name) }}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $f).call($g, name)}, TMP_4.$$s = self, TMP_4.$$arity = 0, TMP_4), $a).call($e, "" + (name)) }; }, TMP_7.$$arity = 2); Opal.defn(self, '$initialize', TMP_8 = function $$initialize(component) { var self = this; return self.component = component; }, TMP_8.$$arity = 1); Opal.defn(self, '$[]', TMP_9 = function(prop) { var self = this; return self.$props()['$[]'](prop); }, TMP_9.$$arity = 1); self.$private(); Opal.defn(self, '$fetch_from_cache', TMP_11 = function $$fetch_from_cache(name) { var $a, $b, TMP_10, self = this, $iter = TMP_11.$$p, $yield = $iter || nil, last = nil, value = nil; TMP_11.$$p = null; $b = self.$cache()['$[]'](name), $a = Opal.to_ary($b), last = ($a[0] == null ? nil : $a[0]), value = ($a[1] == null ? nil : $a[1]), $b; if ((($a = last['$equal?'](self.$props()['$[]'](name))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return value}; return ($a = ($b = Opal.yieldX($yield, [])).$tap, $a.$$p = (TMP_10 = function(value){var self = TMP_10.$$s || this; if (value == null) value = nil; return self.$cache()['$[]='](name, [self.$props()['$[]'](name), value])}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10), $a).call($b); }, TMP_11.$$arity = 1); Opal.defn(self, '$cache', TMP_13 = function $$cache() { var $a, $b, $c, TMP_12, self = this; return ((($a = self.cache) !== false && $a !== nil && $a != null) ? $a : self.cache = ($b = ($c = $scope.get('Hash')).$new, $b.$$p = (TMP_12 = function(h, k){var self = TMP_12.$$s || this; if (h == null) h = nil;if (k == null) k = nil; return h['$[]='](k, [])}, TMP_12.$$s = self, TMP_12.$$arity = 2, TMP_12), $b).call($c)); }, TMP_13.$$arity = 0); Opal.defn(self, '$props', TMP_14 = function $$props() { var self = this; return self.$component().$props(); }, TMP_14.$$arity = 0); return (Opal.defn(self, '$value_for', TMP_15 = function $$value_for(name) { var $a, self = this; if ((($a = self['$[]'](name)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self['$[]'](name).$instance_variable_get("@value") } else { return nil }; }, TMP_15.$$arity = 1), nil) && 'value_for'; })($scope.base, null) })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/component"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash = Opal.hash; Opal.add_stubs(['$require', '$include', '$class_eval', '$class_attribute', '$define_callback', '$extend', '$deprecation_warning', '$name', '$class', '$init_store', '$call', '$[]', '$params', '$event_camelize', '$to_s', '$on_opal_client?', '$load_context', '$set_state_context_to', '$run_callback', '$process_exception', '$update_states_to_observe', '$new', '$remove', '$attr_reader', '$==', '$set_state', '$to_f', '$now', '$method_defined?', '$raise', '$render', '$respond_to?', '$waiting_on_resources', '$initialize_states', '$define_state', '$to_proc', '$include?', '$<<', '$log']); self.$require("react/ext/string"); self.$require("react/ext/hash"); self.$require("active_support/core_ext/class/attribute"); self.$require("react/callbacks"); self.$require("react/rendering_context"); self.$require("hyper-store"); self.$require("react/state_wrapper"); self.$require("react/component/api"); self.$require("react/component/class_methods"); self.$require("react/component/props_wrapper"); self.$require("native"); (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Component(){}; var self = $Component = $klass($base, $super, 'Component', $Component); var def = self.$$proto, $scope = self.$$scope; return (function($base) { var $Mixin, self = $Mixin = $module($base, 'Mixin'); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_8, TMP_10, TMP_12, TMP_14, TMP_16, TMP_18, TMP_19, $a, TMP_20, TMP_23, TMP_24, TMP_25; Opal.defs(self, '$included', TMP_2 = function $$included(base) { var $a, $b, TMP_1, self = this; base.$include((($scope.get('Store')).$$scope.get('Mixin'))); base.$include((((($scope.get('React')).$$scope.get('Component'))).$$scope.get('API'))); base.$include((((($scope.get('React')).$$scope.get('Component'))).$$scope.get('Callbacks'))); base.$include((((($scope.get('React')).$$scope.get('Component'))).$$scope.get('Tags'))); base.$include((((($scope.get('React')).$$scope.get('Component'))).$$scope.get('DslInstanceMethods'))); base.$include((((($scope.get('React')).$$scope.get('Component'))).$$scope.get('ShouldComponentUpdate'))); ($a = ($b = base).$class_eval, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this; self.$class_attribute("initial_state"); self.$define_callback("before_mount"); self.$define_callback("after_mount"); self.$define_callback("before_receive_props"); self.$define_callback("before_update"); self.$define_callback("after_update"); return self.$define_callback("before_unmount");}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b); return base.$extend((((($scope.get('React')).$$scope.get('Component'))).$$scope.get('ClassMethods'))); }, TMP_2.$$arity = 1); Opal.defs(self, '$deprecation_warning', TMP_3 = function $$deprecation_warning(message) { var self = this; return (($scope.get('React')).$$scope.get('Component')).$deprecation_warning(self.$name(), message); }, TMP_3.$$arity = 1); Opal.defn(self, '$deprecation_warning', TMP_4 = function $$deprecation_warning(message) { var self = this; return (($scope.get('React')).$$scope.get('Component')).$deprecation_warning(self.$class().$name(), message); }, TMP_4.$$arity = 1); Opal.defn(self, '$initialize', TMP_5 = function $$initialize(native_element) { var self = this; self["native"] = native_element; return self.$init_store(); }, TMP_5.$$arity = 1); Opal.defn(self, '$emit', TMP_6 = function $$emit(event_name, $a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } return ($b = self.$params()['$[]']("_on" + (event_name.$to_s().$event_camelize()))).$call.apply($b, Opal.to_a(args)); }, TMP_6.$$arity = -2); Opal.defn(self, '$component_will_mount', TMP_8 = function $$component_will_mount() { var $a, $b, TMP_7, self = this, e = nil; try { if ((($a = (($scope.get('React')).$$scope.get('IsomorphicHelpers'))['$on_opal_client?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($scope.get('React')).$$scope.get('IsomorphicHelpers')).$load_context(true)}; return ($a = ($b = (($scope.get('React')).$$scope.get('State'))).$set_state_context_to, $a.$$p = (TMP_7 = function(){var self = TMP_7.$$s || this; return self.$run_callback("before_mount")}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7), $a).call($b, self); } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { return self.$class().$process_exception(e, self) } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_8.$$arity = 0); Opal.defn(self, '$component_did_mount', TMP_10 = function $$component_did_mount() { var $a, $b, TMP_9, self = this, e = nil; try { return ($a = ($b = (($scope.get('React')).$$scope.get('State'))).$set_state_context_to, $a.$$p = (TMP_9 = function(){var self = TMP_9.$$s || this; self.$run_callback("after_mount"); return (($scope.get('React')).$$scope.get('State')).$update_states_to_observe();}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9), $a).call($b, self) } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { return self.$class().$process_exception(e, self) } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_10.$$arity = 0); Opal.defn(self, '$component_will_receive_props', TMP_12 = function $$component_will_receive_props(next_props) { var $a, $b, TMP_11, self = this, e = nil; try { return ($a = ($b = (($scope.get('React')).$$scope.get('State'))).$set_state_context_to, $a.$$p = (TMP_11 = function(){var self = TMP_11.$$s || this; return self.$run_callback("before_receive_props", $scope.get('Hash').$new(next_props))}, TMP_11.$$s = self, TMP_11.$$arity = 0, TMP_11), $a).call($b, self) } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { return self.$class().$process_exception(e, self) } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_12.$$arity = 1); Opal.defn(self, '$component_will_update', TMP_14 = function $$component_will_update(next_props, next_state) { var $a, $b, TMP_13, self = this, e = nil; try { return ($a = ($b = (($scope.get('React')).$$scope.get('State'))).$set_state_context_to, $a.$$p = (TMP_13 = function(){var self = TMP_13.$$s || this; return self.$run_callback("before_update", $scope.get('Hash').$new(next_props), $scope.get('Hash').$new(next_state))}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13), $a).call($b, self) } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { return self.$class().$process_exception(e, self) } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_14.$$arity = 2); Opal.defn(self, '$component_did_update', TMP_16 = function $$component_did_update(prev_props, prev_state) { var $a, $b, TMP_15, self = this, e = nil; try { return ($a = ($b = (($scope.get('React')).$$scope.get('State'))).$set_state_context_to, $a.$$p = (TMP_15 = function(){var self = TMP_15.$$s || this; self.$run_callback("after_update", $scope.get('Hash').$new(prev_props), $scope.get('Hash').$new(prev_state)); return (($scope.get('React')).$$scope.get('State')).$update_states_to_observe();}, TMP_15.$$s = self, TMP_15.$$arity = 0, TMP_15), $a).call($b, self) } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { return self.$class().$process_exception(e, self) } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_16.$$arity = 2); Opal.defn(self, '$component_will_unmount', TMP_18 = function $$component_will_unmount() { var $a, $b, TMP_17, self = this, e = nil; try { return ($a = ($b = (($scope.get('React')).$$scope.get('State'))).$set_state_context_to, $a.$$p = (TMP_17 = function(){var self = TMP_17.$$s || this; self.$run_callback("before_unmount"); return (($scope.get('React')).$$scope.get('State')).$remove();}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17), $a).call($b, self) } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { return self.$class().$process_exception(e, self) } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_18.$$arity = 0); self.$attr_reader("waiting_on_resources"); Opal.defn(self, '$update_react_js_state', TMP_19 = function $$update_react_js_state(object, name, value) { var self = this; if (object !== false && object !== nil && object != null) { if (object['$=='](self)) { } else { name = "" + (object.$class()) + "." + (name) }; return self.$set_state($hash("***_state_updated_at-***", $scope.get('Time').$now().$to_f(), name, value)); } else { return self.$set_state($hash(name, value)) }; }, TMP_19.$$arity = 3); if ((($a = self['$method_defined?']("render")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Opal.defn(self, '$render', TMP_20 = function $$render() { var self = this; return self.$raise("no render defined"); }, TMP_20.$$arity = 0) }; Opal.defn(self, '$_render_wrapper', TMP_23 = function $$_render_wrapper() { var $a, $b, TMP_21, self = this, e = nil; try { return ($a = ($b = (($scope.get('React')).$$scope.get('State'))).$set_state_context_to, $a.$$p = (TMP_21 = function(){var self = TMP_21.$$s || this, $c, $d, TMP_22, element = nil; element = ($c = ($d = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $c.$$p = (TMP_22 = function(){var self = TMP_22.$$s || this, $e; return ((($e = self.$render()) !== false && $e !== nil && $e != null) ? $e : "")}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22), $c).call($d, nil); if ((($c = element['$respond_to?']("waiting_on_resources")) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.waiting_on_resources = element.$waiting_on_resources()}; return element;}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21), $a).call($b, self, true) } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { return self.$class().$process_exception(e, self) } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_23.$$arity = 0); Opal.defn(self, '$watch', TMP_24 = function $$watch(value) { var self = this, $iter = TMP_24.$$p, on_change = $iter || nil; TMP_24.$$p = null; return $scope.get('Observable').$new(value, on_change); }, TMP_24.$$arity = 1); Opal.defn(self, '$define_state', TMP_25 = function $$define_state($a_rest) { var $b, $c, self = this, args, $iter = TMP_25.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_25.$$p = null; return (($scope.get('React')).$$scope.get('State')).$initialize_states(self, ($b = ($c = self.$class()).$define_state, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args))); }, TMP_25.$$arity = -1); })($scope.base) })($scope.base, null) })($scope.base); (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Component, self = $Component = $module($base, 'Component'); var def = self.$$proto, $scope = self.$$scope, TMP_26, TMP_27; Opal.defs(self, '$included', TMP_26 = function $$included(base) { var self = this; self.$deprecation_warning(base, "The module name React::Component has been deprecated. Use Hyperloop::Component::Mixin instead."); return base.$include((((($scope.get('Hyperloop')).$$scope.get('Component'))).$$scope.get('Mixin'))); }, TMP_26.$$arity = 1); Opal.defs(self, '$deprecation_warning', TMP_27 = function $$deprecation_warning(name, message) { var $a, self = this; if (self.deprecation_messages == null) self.deprecation_messages = nil; ((($a = self.deprecation_messages) !== false && $a !== nil && $a != null) ? $a : self.deprecation_messages = []); message = "Warning: Deprecated feature used in " + (name) + ". " + (message); if ((($a = self.deprecation_messages['$include?'](message)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { self.deprecation_messages['$<<'](message); return (($scope.get('React')).$$scope.get('IsomorphicHelpers')).$log(message, "warning"); }; }, TMP_27.$$arity = 2); })($scope.base); (function($base) { var $ComponentNoNotice, self = $ComponentNoNotice = $module($base, 'ComponentNoNotice'); var def = self.$$proto, $scope = self.$$scope, TMP_28; Opal.defs(self, '$included', TMP_28 = function $$included(base) { var self = this; return base.$include((((($scope.get('Hyperloop')).$$scope.get('Component'))).$$scope.get('Mixin'))); }, TMP_28.$$arity = 1) })($scope.base); })($scope.base); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; nil })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["react/children"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$include', '$to_enum', '$length', '$>', '$new', '$call', '$<<', '$alias_method']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Children(){}; var self = $Children = $klass($base, $super, 'Children', $Children); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_4; def.children = def.length = nil; self.$include($scope.get('Enumerable')); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(children) { var self = this; return self.children = children; }, TMP_1.$$arity = 1); Opal.defn(self, '$each', TMP_2 = function $$each() { var $a, $b, TMP_3, self = this, $iter = TMP_2.$$p, block = $iter || nil, collection = nil, element = nil; TMP_2.$$p = null; if ((block !== nil)) { } else { return ($a = ($b = self).$to_enum, $a.$$p = (TMP_3 = function(){var self = TMP_3.$$s || this; return self.$length()}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3), $a).call($b, "each") }; if ((($a = $rb_gt(self.$length(), 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return [] }; collection = []; React.Children.forEach(self.children, function(context){ element = (($scope.get('React')).$$scope.get('Element')).$new(context) block.$call(element) collection['$<<'](element) }) ; return collection; }, TMP_2.$$arity = 0); Opal.defn(self, '$length', TMP_4 = function $$length() { var $a, self = this; return ((($a = self.length) !== false && $a !== nil && $a != null) ? $a : self.length = React.Children.count(self.children)); }, TMP_4.$$arity = 0); return self.$alias_method("size", "length"); })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/component/dsl_instance_methods"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$require', '$new', '$props_wrapper', '$class']); self.$require("react/children"); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Component, self = $Component = $module($base, 'Component'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $DslInstanceMethods, self = $DslInstanceMethods = $module($base, 'DslInstanceMethods'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4; Opal.defn(self, '$children', TMP_1 = function $$children() { var self = this; if (self["native"] == null) self["native"] = nil; return $scope.get('Children').$new(self["native"].props.children); }, TMP_1.$$arity = 0); Opal.defn(self, '$params', TMP_2 = function $$params() { var $a, self = this; if (self.params == null) self.params = nil; return ((($a = self.params) !== false && $a !== nil && $a != null) ? $a : self.params = self.$class().$props_wrapper().$new(self)); }, TMP_2.$$arity = 0); Opal.defn(self, '$props', TMP_3 = function $$props() { var self = this; if (self["native"] == null) self["native"] = nil; return $scope.get('Hash').$new(self["native"].props); }, TMP_3.$$arity = 0); Opal.defn(self, '$refs', TMP_4 = function $$refs() { var self = this; if (self["native"] == null) self["native"] = nil; return $scope.get('Hash').$new(self["native"].refs); }, TMP_4.$$arity = 0); })($scope.base) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["react/component/should_component_update"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$set_state_context_to', '$new', '$respond_to?', '$!', '$call_needs_update', '$props_changed?', '$native_state_changed?', '$define_singleton_method', '$needs_update?', '$!=', '$sort', '$keys', '$props', '$detect']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Component, self = $Component = $module($base, 'Component'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $ShouldComponentUpdate, self = $ShouldComponentUpdate = $module($base, 'ShouldComponentUpdate'); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_5, TMP_6, TMP_8; Opal.defn(self, '$should_component_update?', TMP_2 = function(native_next_props, native_next_state) { var $a, $b, TMP_1, self = this; return ($a = ($b = $scope.get('State')).$set_state_context_to, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this, $c, next_params = nil; next_params = $scope.get('Hash').$new(native_next_props); if ((($c = self['$respond_to?']("needs_update?")) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.$call_needs_update(next_params, native_next_state)['$!']()['$!']() } else { return (((($c = self['$props_changed?'](next_params)) !== false && $c !== nil && $c != null) ? $c : self['$native_state_changed?'](native_next_state)))['$!']()['$!']() };}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b, self, false); }, TMP_2.$$arity = 2); Opal.defn(self, '$call_needs_update', TMP_5 = function $$call_needs_update(next_params, native_next_state) { var $a, $b, TMP_3, $c, TMP_4, self = this, component = nil, next_state = nil; component = self; ($a = ($b = next_params).$define_singleton_method, $a.$$p = (TMP_3 = function(){var self = TMP_3.$$s || this; return component['$props_changed?'](self)}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3), $a).call($b, "changed?"); next_state = $scope.get('Hash').$new(native_next_state); ($a = ($c = next_state).$define_singleton_method, $a.$$p = (TMP_4 = function(){var self = TMP_4.$$s || this; return component['$native_state_changed?'](native_next_state)}, TMP_4.$$s = self, TMP_4.$$arity = 0, TMP_4), $a).call($c, "changed?"); return self['$needs_update?'](next_params, next_state); }, TMP_5.$$arity = 2); Opal.defn(self, '$native_state_changed?', TMP_6 = function(next_state) { var self = this; if (self["native"] == null) self["native"] = nil; var current_state = self["native"].state var normalized_next_state = !next_state || Object.keys(next_state).length === 0 || nil == next_state ? false : next_state var normalized_current_state = !current_state || Object.keys(current_state).length === 0 || nil == current_state ? false : current_state if (!normalized_current_state != !normalized_next_state) return(true) if (!normalized_current_state && !normalized_next_state) return(false) if (!normalized_current_state['***_state_updated_at-***'] || !normalized_next_state['***_state_updated_at-***']) return(true) return (normalized_current_state['***_state_updated_at-***'] != normalized_next_state['***_state_updated_at-***']) ; }, TMP_6.$$arity = 1); Opal.defn(self, '$props_changed?', TMP_8 = function(next_params) { var $a, $b, $c, TMP_7, self = this; return ((($a = (self.$props().$keys().$sort()['$!='](next_params.$keys().$sort()))) !== false && $a !== nil && $a != null) ? $a : ($b = ($c = next_params).$detect, $b.$$p = (TMP_7 = function(k, v){var self = TMP_7.$$s || this; if (self["native"] == null) self["native"] = nil; if (k == null) k = nil;if (v == null) v = nil; return v != self["native"].props[k];}, TMP_7.$$s = self, TMP_7.$$arity = 2, TMP_7), $b).call($c)); }, TMP_8.$$arity = 1); })($scope.base) })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/element"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $hash = Opal.hash; Opal.add_stubs(['$require', '$include', '$alias_native', '$attr_reader', '$attr_accessor', '$each', '$merge_event_prop!', '$to_proc', '$to_n', '$shallow_to_n', '$properties', '$empty?', '$render', '$convert_props', '$new', '$type', '$merge', '$block', '$delete', '$as_node', '$rendered?', '$method_missing', '$dup', '$replace', '$build', '$build_new_properties', '$gsub', '$private', '$haml_class_name', '$class', '$[]=', '$join', '$uniq', '$split', '$[]', '$merge!', '$=~', '$merge_component_event_prop!', '$include?', '$event_camelize', '$merge_built_in_event_prop!', '$instance_variable_get', '$merge_deprecated_component_event_prop!', '$Array', '$deprecation_warning']); self.$require("react/ext/string"); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Element(){}; var self = $Element = $klass($base, $super, 'Element', $Element); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_4, TMP_5, TMP_6, TMP_7, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15; def.type = def.properties = nil; self.$include($scope.get('Native')); self.$alias_native("element_type", "type"); self.$alias_native("props", "props"); self.$attr_reader("type"); self.$attr_reader("properties"); self.$attr_reader("block"); self.$attr_accessor("waiting_on_resources"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(native_element, type, properties, block) { var $a, $b, self = this; if (type == null) { type = nil; } if (properties == null) { properties = $hash2([], {}); } if (block == null) { block = nil; } self.type = type; self.properties = ((($a = ((function() {if ((($b = typeof properties === 'undefined') !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return nil } else { return properties }; return nil; })())) !== false && $a !== nil && $a != null) ? $a : $hash2([], {})); self.block = block; return self["native"] = native_element; }, TMP_1.$$arity = -2); Opal.defn(self, '$on', TMP_2 = function $$on($a_rest) { var $b, $c, TMP_3, self = this, event_names, $iter = TMP_2.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } event_names = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { event_names[$arg_idx - 0] = arguments[$arg_idx]; } TMP_2.$$p = null; ($b = ($c = event_names).$each, $b.$$p = (TMP_3 = function(event_name){var self = TMP_3.$$s || this, $a, $d; if (event_name == null) event_name = nil; return ($a = ($d = self)['$merge_event_prop!'], $a.$$p = block.$to_proc(), $a).call($d, event_name)}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $b).call($c); self["native"] = React.cloneElement(self.$to_n(), self.$properties().$shallow_to_n()); return self; }, TMP_2.$$arity = -1); Opal.defn(self, '$render', TMP_4 = function $$render(props) { var $a, self = this, $iter = TMP_4.$$p, new_block = $iter || nil; if (props == null) { props = $hash2([], {}); } TMP_4.$$p = null; if ((($a = props['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($scope.get('React')).$$scope.get('RenderingContext')).$render(self) } else { props = $scope.get('API').$convert_props(props); return (($scope.get('React')).$$scope.get('RenderingContext')).$render($scope.get('Element').$new(React.cloneElement(self.$to_n(), props.$shallow_to_n()), self.$type(), self.$properties().$merge(props), self.$block())); }; }, TMP_4.$$arity = -1); Opal.defn(self, '$delete', TMP_5 = function() { var self = this; return (($scope.get('React')).$$scope.get('RenderingContext')).$delete(self); }, TMP_5.$$arity = 0); Opal.defn(self, '$as_node', TMP_6 = function $$as_node() { var self = this; return (($scope.get('React')).$$scope.get('RenderingContext')).$as_node(self); }, TMP_6.$$arity = 0); Opal.defn(self, '$method_missing', TMP_7 = function $$method_missing(class_name, args) { var $a, $b, $c, TMP_8, self = this, $iter = TMP_7.$$p, new_block = $iter || nil; if (args == null) { args = $hash2([], {}); } TMP_7.$$p = null; if ((($a = self['$rendered?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return ($a = ($b = self.$dup().$render()).$method_missing, $a.$$p = new_block.$to_proc(), $a).call($b, class_name, args) }; return (($scope.get('React')).$$scope.get('RenderingContext')).$replace(self, ($a = ($c = $scope.get('RenderingContext')).$build, $a.$$p = (TMP_8 = function(){var self = TMP_8.$$s || this, $d, $e; return ($d = ($e = $scope.get('RenderingContext')).$render, $d.$$p = new_block.$to_proc(), $d).call($e, self.$type(), self.$build_new_properties(class_name, args))}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8), $a).call($c)); }, TMP_7.$$arity = -2); Opal.defn(self, '$rendered?', TMP_9 = function() { var self = this; return (($scope.get('React')).$$scope.get('RenderingContext'))['$rendered?'](self); }, TMP_9.$$arity = 0); Opal.defs(self, '$haml_class_name', TMP_10 = function $$haml_class_name(class_name) { var self = this; return class_name.$gsub(/__|_/, $hash2(["__", "_"], {"__": "_", "_": "-"})); }, TMP_10.$$arity = 1); self.$private(); Opal.defn(self, '$build_new_properties', TMP_11 = function $$build_new_properties(class_name, args) { var self = this, new_props = nil; class_name = self.$class().$haml_class_name(class_name); new_props = self.$properties().$dup(); new_props['$[]=']("className", (((((((((" ") + (class_name)) + " ") + (new_props['$[]']("className"))) + " ") + (args.$delete("class"))) + " ") + (args.$delete("className"))) + " ").$split(" ").$uniq().$join(" ")); return new_props['$merge!'](args); }, TMP_11.$$arity = 2); Opal.defn(self, '$merge_event_prop!', TMP_12 = function(event_name) { var $a, $b, $c, $d, $e, $f, self = this, $iter = TMP_12.$$p, block = $iter || nil, name = nil; TMP_12.$$p = null; if ((($a = event_name['$=~'](/^<(.+)>$/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self)['$merge_component_event_prop!'], $a.$$p = block.$to_proc(), $a).call($b, event_name.$gsub(/^<(.+)>$/, "\\1")) } else if ((($a = (((($scope.get('React')).$$scope.get('Event'))).$$scope.get('BUILT_IN_EVENTS'))['$include?'](name = "on" + (event_name.$event_camelize()))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($c = self)['$merge_built_in_event_prop!'], $a.$$p = block.$to_proc(), $a).call($c, name) } else if ((($a = self.type.$instance_variable_get("@native_import")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($d = self)['$merge_component_event_prop!'], $a.$$p = block.$to_proc(), $a).call($d, name) } else { ($a = ($e = self)['$merge_deprecated_component_event_prop!'], $a.$$p = block.$to_proc(), $a).call($e, event_name); return ($a = ($f = self)['$merge_component_event_prop!'], $a.$$p = block.$to_proc(), $a).call($f, "on_" + (event_name)); }; }, TMP_12.$$arity = 1); Opal.defn(self, '$merge_built_in_event_prop!', TMP_13 = function(prop_name) { var self = this, $iter = TMP_13.$$p, $yield = $iter || nil; TMP_13.$$p = null; return self.properties['$merge!']($hash(prop_name, function(event){ return Opal.yield1($yield, (($scope.get('React')).$$scope.get('Event')).$new(event)) } )); }, TMP_13.$$arity = 1); Opal.defn(self, '$merge_component_event_prop!', TMP_14 = function(prop_name) { var self = this, $iter = TMP_14.$$p, $yield = $iter || nil; TMP_14.$$p = null; return self.properties['$merge!']($hash(prop_name, function(){ return Opal.yieldX($yield, Opal.to_a(self.$Array(arguments))) } )); }, TMP_14.$$arity = 1); return (Opal.defn(self, '$merge_deprecated_component_event_prop!', TMP_15 = function(event_name) { var self = this, $iter = TMP_15.$$p, $yield = $iter || nil, prop_name = nil, fn = nil; TMP_15.$$p = null; prop_name = "_on" + (event_name.$event_camelize()); fn = function(){(($scope.get('React')).$$scope.get('Component')).$deprecation_warning(self.$type(), "In future releases React::Element#on('" + (event_name) + "') will no longer respond " + ("to the '" + (prop_name) + "' emitter.\n") + ("Rename your emitter param to 'on_" + (event_name) + "' or use .on('<" + (prop_name) + ">')")) return Opal.yieldX($yield, Opal.to_a(self.$Array(arguments))) }; return self.properties['$merge!']($hash(prop_name, fn)); }, TMP_15.$$arity = 1), nil) && 'merge_deprecated_component_event_prop!'; })($scope.base, null) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["react/event"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$include', '$alias_native']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Event(){}; var self = $Event = $klass($base, $super, 'Event', $Event); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.$include($scope.get('Native')); self.$alias_native("bubbles", "bubbles"); self.$alias_native("cancelable", "cancelable"); self.$alias_native("current_target", "currentTarget"); self.$alias_native("default_prevented", "defaultPrevented"); self.$alias_native("event_phase", "eventPhase"); self.$alias_native("is_trusted?", "isTrusted"); self.$alias_native("native_event", "nativeEvent"); self.$alias_native("target", "target"); self.$alias_native("timestamp", "timeStamp"); self.$alias_native("event_type", "type"); self.$alias_native("prevent_default", "preventDefault"); self.$alias_native("stop_propagation", "stopPropagation"); self.$alias_native("clipboard_data", "clipboardData"); self.$alias_native("alt_key", "altKey"); self.$alias_native("char_code", "charCode"); self.$alias_native("ctrl_key", "ctrlKey"); self.$alias_native("get_modifier_state", "getModifierState"); self.$alias_native("key", "key"); self.$alias_native("key_code", "keyCode"); self.$alias_native("locale", "locale"); self.$alias_native("location", "location"); self.$alias_native("meta_key", "metaKey"); self.$alias_native("repeat", "repeat"); self.$alias_native("shift_key", "shiftKey"); self.$alias_native("which", "which"); self.$alias_native("related_target", "relatedTarget"); self.$alias_native("alt_key", "altKey"); self.$alias_native("button", "button"); self.$alias_native("buttons", "buttons"); self.$alias_native("client_x", "clientX"); self.$alias_native("client_y", "clientY"); self.$alias_native("ctrl_key", "ctrlKey"); self.$alias_native("get_modifier_state", "getModifierState"); self.$alias_native("meta_key", "metaKey"); self.$alias_native("page_x", "pageX"); self.$alias_native("page_y", "pageY"); self.$alias_native("related_target", "relatedTarget"); self.$alias_native("screen_x", "screen_x"); self.$alias_native("screen_y", "screen_y"); self.$alias_native("shift_key", "shift_key"); self.$alias_native("alt_key", "altKey"); self.$alias_native("changed_touches", "changedTouches"); self.$alias_native("ctrl_key", "ctrlKey"); self.$alias_native("get_modifier_state", "getModifierState"); self.$alias_native("meta_key", "metaKey"); self.$alias_native("shift_key", "shiftKey"); self.$alias_native("target_touches", "targetTouches"); self.$alias_native("touches", "touches"); self.$alias_native("detail", "detail"); self.$alias_native("view", "view"); self.$alias_native("delta_mode", "deltaMode"); self.$alias_native("delta_x", "deltaX"); self.$alias_native("delta_y", "deltaY"); self.$alias_native("delta_z", "deltaZ"); Opal.cdecl($scope, 'BUILT_IN_EVENTS', ["onCopy", "onCut", "onPaste", "onKeyDown", "onKeyPress", "onKeyUp", "onFocus", "onBlur", "onChange", "onInput", "onSubmit", "onClick", "onDoubleClick", "onDrag", "onDragEnd", "onDragEnter", "onDragExit", "onDragLeave", "onDragOver", "onDragStart", "onDrop", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseOut", "onMouseOver", "onMouseUp", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "onScroll"]); return (Opal.defn(self, '$initialize', TMP_1 = function $$initialize(native_element) { var self = this; return self["native"] = native_element; }, TMP_1.$$arity = 1), nil) && 'initialize'; })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/native_library"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$each', '$lookup_native_name', '$create_component_wrapper', '$create_library_wrapper', '$raise', '$name', '$scope_native_name', '$+', '$downcase', '$[]', '$import_const_from_native', '$const_defined?', '$get_const', '$render', '$to_proc', '$private', '$native_react_component?', '$const_set', '$new', '$class_eval', '$include', '$imports']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $NativeLibrary(){}; var self = $NativeLibrary = $klass($base, $super, 'NativeLibrary', $NativeLibrary); var def = self.$$proto, $scope = self.$$scope; return (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_1, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_10, TMP_11; Opal.defn(self, '$imports', TMP_1 = function $$imports(native_name) { var self = this; self.native_prefix = "" + (native_name) + "."; return self; }, TMP_1.$$arity = 1); Opal.defn(self, '$rename', TMP_3 = function $$rename(rename_list) { var $a, $b, TMP_2, self = this; return ($a = ($b = rename_list).$each, $a.$$p = (TMP_2 = function(js_name, ruby_name){var self = TMP_2.$$s || this, $c, native_name = nil; if (js_name == null) js_name = nil;if (ruby_name == null) ruby_name = nil; native_name = self.$lookup_native_name(js_name); if ((($c = self.$lookup_native_name(js_name)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return ((($c = self.$create_component_wrapper(self, native_name, ruby_name)) !== false && $c !== nil && $c != null) ? $c : self.$create_library_wrapper(self, native_name, ruby_name)) } else { return self.$raise("class " + (self.$name()) + " < React::NativeLibrary could not import " + (js_name) + ". " + ("Native value " + (self.$scope_native_name(js_name)) + " is undefined.")) };}, TMP_2.$$s = self, TMP_2.$$arity = 2, TMP_2), $a).call($b); }, TMP_3.$$arity = 1); Opal.defn(self, '$import_const_from_native', TMP_4 = function $$import_const_from_native(klass, const_name, create_library) { var $a, $b, $c, self = this, native_name = nil; native_name = ((($a = self.$lookup_native_name(const_name)) !== false && $a !== nil && $a != null) ? $a : self.$lookup_native_name($rb_plus(const_name['$[]'](0).$downcase(), const_name['$[]']($range(1, -1, false))))); return (($a = native_name !== false && native_name !== nil && native_name != null) ? (((($b = self.$create_component_wrapper(klass, native_name, const_name)) !== false && $b !== nil && $b != null) ? $b : ((($c = create_library !== false && create_library !== nil && create_library != null) ? self.$create_library_wrapper(klass, native_name, const_name) : create_library)))) : native_name); }, TMP_4.$$arity = 3); Opal.defn(self, '$const_missing', TMP_5 = function $$const_missing(const_name) { var $a, $b, $c, self = this, $iter = TMP_5.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_5.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } return ((($a = self.$import_const_from_native(self, const_name, true)) !== false && $a !== nil && $a != null) ? $a : ($b = ($c = self, Opal.find_super_dispatcher(self, 'const_missing', TMP_5, false)), $b.$$p = $iter, $b).apply($c, $zuper)); }, TMP_5.$$arity = 1); Opal.defn(self, '$method_missing', TMP_6 = function $$method_missing(method, $a_rest) { var $b, $c, self = this, args, $iter = TMP_6.$$p, block = $iter || nil, component_class = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_6.$$p = null; if ((($b = self['$const_defined?'](method)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { component_class = self.$get_const(method)}; ((($b = component_class) !== false && $b !== nil && $b != null) ? $b : component_class = self.$import_const_from_native(self, method, false)); if (component_class !== false && component_class !== nil && component_class != null) { } else { self.$raise("could not import a react component named: " + (self.$scope_native_name(method))) }; return ($b = ($c = (($scope.get('React')).$$scope.get('RenderingContext'))).$render, $b.$$p = block.$to_proc(), $b).apply($c, [component_class].concat(Opal.to_a(args))); }, TMP_6.$$arity = -2); self.$private(); Opal.defn(self, '$lookup_native_name', TMP_7 = function $$lookup_native_name(js_name) { var self = this, native_name = nil; try { native_name = self.$scope_native_name(js_name); return eval(native_name) !== undefined && native_name; } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) { try { return nil } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_7.$$arity = 1); Opal.defn(self, '$scope_native_name', TMP_8 = function $$scope_native_name(js_name) { var self = this; if (self.native_prefix == null) self.native_prefix = nil; return "" + (self.native_prefix) + (js_name); }, TMP_8.$$arity = 1); Opal.defn(self, '$create_component_wrapper', TMP_10 = function $$create_component_wrapper(klass, native_name, ruby_name) { var $a, $b, TMP_9, self = this, new_klass = nil; if ((($a = (($scope.get('React')).$$scope.get('API'))['$native_react_component?'](native_name)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { new_klass = klass.$const_set(ruby_name, $scope.get('Class').$new()); ($a = ($b = new_klass).$class_eval, $a.$$p = (TMP_9 = function(){var self = TMP_9.$$s || this; self.$include((((($scope.get('Hyperloop')).$$scope.get('Component'))).$$scope.get('Mixin'))); return self.$imports(native_name);}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9), $a).call($b); return new_klass; } else { return nil }; }, TMP_10.$$arity = 3); return (Opal.defn(self, '$create_library_wrapper', TMP_11 = function $$create_library_wrapper(klass, native_name, ruby_name) { var self = this; return klass.$const_set(ruby_name, $scope.get('Class').$new((($scope.get('React')).$$scope.get('NativeLibrary'))).$imports(native_name)); }, TMP_11.$$arity = 3), nil) && 'create_library_wrapper'; })(Opal.get_singleton_class(self)) })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/api"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $range = Opal.range; Opal.add_stubs(['$require', '$instance_variable_set', '$[]=', '$raise', '$eval_native_react_component', '$!', '$method_defined?', '$[]', '$name', '$respond_to?', '$to_n', '$prop_types', '$default_props', '$native_mixins', '$static_call_backs', '$component_will_mount', '$component_did_mount', '$component_will_receive_props', '$new', '$should_component_update?', '$component_will_update', '$component_did_update', '$component_will_unmount', '$send', '$<<', '$kind_of?', '$create_native_react_class', '$include?', '$is_a?', '$convert_props', '$shallow_to_n', '$each', '$flatten', '$map', '$==', '$lower_camelize', '$const_defined?', '$tr', '$html_attr?', '$private', '$split', '$first', '$concat', '$+', '$upcase', '$join']); self.$require("react/native_library"); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $API(){}; var self = $API = $klass($base, $super, 'API', $API); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_7, TMP_10, TMP_12; (Opal.cvars['@@component_classes'] = $hash2([], {})); Opal.defs(self, '$import_native_component', TMP_1 = function $$import_native_component(opal_class, native_class) { var $a, self = this; opal_class.$instance_variable_set("@native_import", true); return (($a = Opal.cvars['@@component_classes']) == null ? nil : $a)['$[]='](opal_class, native_class); }, TMP_1.$$arity = 2); Opal.defs(self, '$eval_native_react_component', TMP_2 = function $$eval_native_react_component(name) { var $a, $b, $c, self = this, component = nil, is_component_class = nil, is_functional_component = nil, is_not_using_react_v13 = nil; component = eval(name); if ((($a = component === undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise("" + (name) + " is not defined")}; is_component_class = ($a = component.prototype !== undefined, $a !== false && $a !== nil && $a != null ?(((($b = !!component.prototype.isReactComponent) !== false && $b !== nil && $b != null) ? $b : !!component.prototype.render)) : $a); is_functional_component = typeof component === "function"; is_not_using_react_v13 = !Opal.global.React.version.match(/0\.13/); if ((($a = ((($b = is_component_class) !== false && $b !== nil && $b != null) ? $b : ((($c = is_not_using_react_v13 !== false && is_not_using_react_v13 !== nil && is_not_using_react_v13 != null) ? is_functional_component : is_not_using_react_v13)))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise("does not appear to be a native react component") }; return component; }, TMP_2.$$arity = 1); Opal.defs(self, '$native_react_component?', TMP_3 = function(name) { var self = this; if (name == null) { name = nil; } try { if (name !== false && name !== nil && name != null) { } else { return false }; return self.$eval_native_react_component(name); } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { try { return nil } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_3.$$arity = -1); Opal.defs(self, '$create_native_react_class', TMP_4 = function $$create_native_react_class(type) { var $a, $b, $c, $d, self = this, render_fn = nil; if ((($a = (type['$method_defined?']("render"))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise("Provided class should define `render` method")}; render_fn = (function() {if ((($a = (type['$method_defined?']("_render_wrapper"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "_render_wrapper" } else { return "render" }; return nil; })(); return ($a = type, $b = (($c = Opal.cvars['@@component_classes']) == null ? nil : $c), ((($c = $b['$[]']($a)) !== false && $c !== nil && $c != null) ? $c : $b['$[]=']($a, React.createClass({ displayName: type.$name(), propTypes: (function() {if ((($d = type['$respond_to?']("prop_types")) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return type.$prop_types().$to_n() } else { return {}; }; return nil; })(), getDefaultProps: function(){ return (function() {if ((($d = type['$respond_to?']("default_props")) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return type.$default_props().$to_n() } else { return {}; }; return nil; })(); }, mixins: (function() {if ((($d = type['$respond_to?']("native_mixins")) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return type.$native_mixins() } else { return []; }; return nil; })(), statics: (function() {if ((($d = type['$respond_to?']("static_call_backs")) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return type.$static_call_backs().$to_n() } else { return {}; }; return nil; })(), componentWillMount: function() { var instance = this._getOpalInstance.apply(this); return (function() {if ((($d = type['$method_defined?']("component_will_mount")) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return (instance).$component_will_mount() } else { return nil }; return nil; })(); }, componentDidMount: function() { var instance = this._getOpalInstance.apply(this); return (function() {if ((($d = type['$method_defined?']("component_did_mount")) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return (instance).$component_did_mount() } else { return nil }; return nil; })(); }, componentWillReceiveProps: function(next_props) { var instance = this._getOpalInstance.apply(this); return (function() {if ((($d = type['$method_defined?']("component_will_receive_props")) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return (instance).$component_will_receive_props($scope.get('Hash').$new(next_props)) } else { return nil }; return nil; })(); }, shouldComponentUpdate: function(next_props, next_state) { var instance = this._getOpalInstance.apply(this); return (function() {if ((($d = type['$method_defined?']("should_component_update?")) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return (instance)['$should_component_update?']($scope.get('Hash').$new(next_props), $scope.get('Hash').$new(next_state)) } else { return nil }; return nil; })(); }, componentWillUpdate: function(next_props, next_state) { var instance = this._getOpalInstance.apply(this); return (function() {if ((($d = type['$method_defined?']("component_will_update")) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return (instance).$component_will_update($scope.get('Hash').$new(next_props), $scope.get('Hash').$new(next_state)) } else { return nil }; return nil; })(); }, componentDidUpdate: function(prev_props, prev_state) { var instance = this._getOpalInstance.apply(this); return (function() {if ((($d = type['$method_defined?']("component_did_update")) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return (instance).$component_did_update($scope.get('Hash').$new(prev_props), $scope.get('Hash').$new(prev_state)) } else { return nil }; return nil; })(); }, componentWillUnmount: function() { var instance = this._getOpalInstance.apply(this); return (function() {if ((($d = type['$method_defined?']("component_will_unmount")) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return (instance).$component_will_unmount() } else { return nil }; return nil; })(); }, _getOpalInstance: function() { if (this.__opalInstance == undefined) { var instance = type.$new(this); } else { var instance = this.__opalInstance; } this.__opalInstance = instance; return instance; }, render: function() { var instance = this._getOpalInstance.apply(this); return (instance).$send(render_fn).$to_n(); } }) ))); }, TMP_4.$$arity = 1); Opal.defs(self, '$create_element', TMP_5 = function $$create_element(type, properties) { var $a, $b, TMP_6, self = this, $iter = TMP_5.$$p, block = $iter || nil, params = nil; if (properties == null) { properties = $hash2([], {}); } TMP_5.$$p = null; params = []; if ((($a = (($b = Opal.cvars['@@component_classes']) == null ? nil : $b)['$[]'](type)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { params['$<<']((($a = Opal.cvars['@@component_classes']) == null ? nil : $a)['$[]'](type)) } else if ((($a = type['$kind_of?']($scope.get('Class'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { params['$<<'](self.$create_native_react_class(type)) } else if ((($a = (((((($scope.get('React')).$$scope.get('Component'))).$$scope.get('Tags'))).$$scope.get('HTML_TAGS'))['$include?'](type)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { params['$<<'](type) } else if ((($a = type['$is_a?']($scope.get('String'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($scope.get('React')).$$scope.get('Element')).$new(type) } else { self.$raise("" + (type) + " not implemented") }; properties = self.$convert_props(properties); params['$<<'](properties.$shallow_to_n()); if ((block !== nil)) { ($a = ($b = [Opal.yieldX(block, [])].$flatten()).$each, $a.$$p = (TMP_6 = function(ele){var self = TMP_6.$$s || this; if (ele == null) ele = nil; return params['$<<'](ele.$to_n())}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $a).call($b)}; return (($scope.get('React')).$$scope.get('Element')).$new(React.createElement.apply(null, params), type, properties, block); }, TMP_5.$$arity = -2); Opal.defs(self, '$clear_component_class_cache', TMP_7 = function $$clear_component_class_cache() { var self = this; return (Opal.cvars['@@component_classes'] = $hash2([], {})); }, TMP_7.$$arity = 0); Opal.defs(self, '$convert_props', TMP_10 = function $$convert_props(properties) { var $a, $b, TMP_8, self = this, props = nil; if ((($a = properties['$is_a?']($scope.get('Hash'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise("Component parameters must be a hash. Instead you sent " + (properties)) }; props = $hash2([], {}); ($a = ($b = properties).$map, $a.$$p = (TMP_8 = function(key, value){var self = TMP_8.$$s || this, $c, $d, TMP_9; if (key == null) key = nil;if (value == null) value = nil; if ((($c = (($d = key['$==']("class_name")) ? value['$is_a?']($scope.get('Hash')) : key['$==']("class_name"))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return props['$[]='](self.$lower_camelize(key), React.addons.classSet(value.$to_n())) } else if (key['$==']("class")) { return props['$[]=']("className", value) } else if ((($c = ["style", "dangerously_set_inner_HTML"]['$include?'](key)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return props['$[]='](self.$lower_camelize(key), value.$to_n()) } else if ((($c = (($d = key['$==']("ref")) ? value['$is_a?']($scope.get('Proc')) : key['$==']("ref"))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { if ((($c = $scope.get('React')['$const_defined?']("RefsCallbackExtension")) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { console.error( "Warning: Using deprecated behavior of ref callback,", "require \"react/ref_callback\" to get the correct behavior." ); }; return props['$[]='](key, value); } else if ((($c = ($d = (($scope.get('React')).$$scope.get('HASH_ATTRIBUTES'))['$include?'](key), $d !== false && $d !== nil && $d != null ?value['$is_a?']($scope.get('Hash')) : $d)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return ($c = ($d = value).$each, $c.$$p = (TMP_9 = function(k, v){var self = TMP_9.$$s || this; if (k == null) k = nil;if (v == null) v = nil; return props['$[]=']("" + (key) + "-" + (k.$tr("_", "-")), v.$to_n())}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9), $c).call($d) } else { return props['$[]=']((function() {if ((($c = $scope.get('React')['$html_attr?'](self.$lower_camelize(key))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.$lower_camelize(key) } else { return key }; return nil; })(), value) }}, TMP_8.$$s = self, TMP_8.$$arity = 2, TMP_8), $a).call($b); return props; }, TMP_10.$$arity = 1); self.$private(); return (Opal.defs(self, '$lower_camelize', TMP_12 = function $$lower_camelize(snake_cased_word) { var $a, $b, TMP_11, self = this, words = nil, result = nil; words = snake_cased_word.$split("_"); result = [words.$first()]; result.$concat(($a = ($b = words['$[]']($range(1, -1, false))).$map, $a.$$p = (TMP_11 = function(word){var self = TMP_11.$$s || this; if (word == null) word = nil; return $rb_plus(word['$[]'](0).$upcase(), word['$[]']($range(1, -1, false)))}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11), $a).call($b)); return result.$join(""); }, TMP_12.$$arity = 1), nil) && 'lower_camelize'; })($scope.base, null) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["react/object"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$_reactrb_tag_original_const_missing', '$html_tag_class_for', '$raise']); return (function($base, $super) { function $Object(){}; var self = $Object = $klass($base, $super, 'Object', $Object); var def = self.$$proto, $scope = self.$$scope; return (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_1; Opal.alias(self, '_reactrb_tag_original_const_missing', 'const_missing'); return (Opal.defn(self, '$const_missing', TMP_1 = function $$const_missing(const_name) { var $a, self = this, e = nil; try { return self.$_reactrb_tag_original_const_missing(const_name) } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) {e = $err; try { return ((($a = (((($scope.get('React')).$$scope.get('Component'))).$$scope.get('Tags')).$html_tag_class_for(const_name)) !== false && $a !== nil && $a != null) ? $a : self.$raise(e)) } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_1.$$arity = 1), nil) && 'const_missing'; })(Opal.get_singleton_class(self)) })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/ext/opal-jquery/element"] = function(Opal) { var $a, $b, TMP_1, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $hash2 = Opal.hash2; Opal.add_stubs(['$const_defined?', '$instance_eval', '$dom_node', '$find', '$define_method', '$to_n', '$new', '$class_eval', '$render', '$to_proc', '$create_element']); if ((($a = $scope.get('Object')['$const_defined?']("Element")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = $scope.get('Element')).$instance_eval, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this, TMP_2, TMP_3, $c, $d, TMP_4; Opal.defs(self, '$find', TMP_2 = function $$find(selector) { var $a, self = this; if ((($a = selector.$dom_node !== undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { selector = (function() { try { return selector.$dom_node() } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { try { return selector } finally { Opal.pop_exception() } } else { throw $err; } }})()}; return $(selector); }, TMP_2.$$arity = 1); Opal.defs(self, '$[]', TMP_3 = function(selector) { var self = this; return self.$find(selector); }, TMP_3.$$arity = 1); return ($c = ($d = self).$define_method, $c.$$p = (TMP_4 = function(container, params){var self = TMP_4.$$s || this, block, $e, $f, TMP_5, klass = nil; block = TMP_4.$$p || nil, TMP_4.$$p = null; if (container == null) { container = nil; } if (params == null) { params = $hash2([], {}); } if ((($e = self.$to_n()._reactrb_component_class === undefined) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { self.$to_n()._reactrb_component_class = $scope.get('Class').$new((($scope.get('Hyperloop')).$$scope.get('Component')));}; klass = self.$to_n()._reactrb_component_class; ($e = ($f = klass).$class_eval, $e.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this, $g, $h; return ($g = ($h = self).$render, $g.$$p = block.$to_proc(), $g).call($h, container, params)}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $e).call($f); return $scope.get('React').$render($scope.get('React').$create_element(self.$to_n()._reactrb_component_class), self);}, TMP_4.$$s = self, TMP_4.$$arity = -1, TMP_4), $c).call($d, "render");}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b) } else { return nil } }; /* Generated by Opal 0.10.4 */ Opal.modules["react/config/client"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2; Opal.add_stubs(['$extend', '$[]=', '$config', '$default_config']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Config, self = $Config = $module($base, 'Config'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3; self.$extend(self); Opal.defn(self, '$environment=', TMP_1 = function(value) { var self = this; return self.$config()['$[]=']("environment", value); }, TMP_1.$$arity = 1); Opal.defn(self, '$config', TMP_2 = function $$config() { var $a, self = this; if (self.config == null) self.config = nil; return ((($a = self.config) !== false && $a !== nil && $a != null) ? $a : self.config = self.$default_config()); }, TMP_2.$$arity = 0); Opal.defn(self, '$default_config', TMP_3 = function $$default_config() { var self = this; return $hash2(["environment"], {"environment": "express"}); }, TMP_3.$$arity = 0); })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["react/config"] = function(Opal) { var $a, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$!=', '$require']); if ((($a = $scope.get('RUBY_ENGINE')['$!=']("opal")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return self.$require("react/config/client") } }; /* Generated by Opal 0.10.4 */ Opal.modules["reactive-ruby/isomorphic_helpers"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $range = Opal.range, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$require', '$extend', '$!=', '$!', '$unique_id', '$on_opal_server?', '$log', '$new', '$is_a?', '$==', '$[]', '$config', '$+', '$class', '$on_opal_client?', '$join', '$collect', '$call', '$prerender_footer_blocks', '$attr_reader', '$run', '$each', '$before_first_mount_blocks', '$eval', '$length', '$load!', '$<<', '$first', '$send_to_server', '$to_json', '$parse', '$controller', '$context', '$register_before_first_mount_block', '$to_proc', '$register_prerender_footer_block', '$send', '$result']); self.$require("react/config"); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $IsomorphicHelpers, self = $IsomorphicHelpers = $module($base, 'IsomorphicHelpers'); var def = self.$$proto, $scope = self.$$scope, TMP_1, $a, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_10; Opal.defs(self, '$included', TMP_1 = function $$included(base) { var self = this; return base.$extend($scope.get('ClassMethods')); }, TMP_1.$$arity = 1); if ((($a = $scope.get('RUBY_ENGINE')['$!=']("opal")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Opal.defs(self, '$load_context', TMP_2 = function $$load_context(unique_id, name) { var $a, $b, $c, self = this, message = nil; if (self.context == null) self.context = nil; if (unique_id == null) { unique_id = nil; } if (name == null) { name = nil; } if ((($a = ((($b = ((($c = unique_id['$!']()) !== false && $c !== nil && $c != null) ? $c : self.context['$!']())) !== false && $b !== nil && $b != null) ? $b : self.context.$unique_id()['$!='](unique_id))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self['$on_opal_server?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { try {console.history = [] } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { nil } else { throw $err; } }; message = "************************ React Prerendering Context Initialized " + (name) + " ***********************"; } else { message = "************************ React Browser Context Initialized ****************************" }; self.$log(message); self.context = $scope.get('Context').$new(unique_id);}; return self.context; }, TMP_2.$$arity = -1) }; Opal.defs(self, '$log', TMP_3 = function $$log(message, message_type) { var $a, $b, $c, self = this, is_production = nil, style = nil; if (message_type == null) { message_type = "info"; } if ((($a = message['$is_a?']($scope.get('Array'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { message = [message] }; is_production = (($scope.get('React')).$$scope.get('Config')).$config()['$[]']("environment")['$==']("production"); if ((($a = ($b = (((($c = message_type['$==']("info")) !== false && $c !== nil && $c != null) ? $c : message_type['$==']("warning"))), $b !== false && $b !== nil && $b != null ?is_production : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; if (message_type['$==']("info")) { if ((($a = self['$on_opal_server?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { style = "background: #00FFFF; color: red" } else { style = "background: #222; color: #bada55" }; message = $rb_plus([$rb_plus("%c", message['$[]'](0)), style], message['$[]']($range(1, -1, false))); return console.log.apply(console, message); } else if (message_type['$==']("warning")) { return console.warn.apply(console, message); } else { return console.error.apply(console, message); }; }, TMP_3.$$arity = -2); if ((($a = $scope.get('RUBY_ENGINE')['$!=']("opal")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Opal.defs(self, '$on_opal_server?', TMP_4 = function() { var self = this; return typeof Opal.global.document === 'undefined'; }, TMP_4.$$arity = 0); Opal.defs(self, '$on_opal_client?', TMP_5 = function() { var self = this; return self['$on_opal_server?']()['$!'](); }, TMP_5.$$arity = 0); }; Opal.defn(self, '$log', TMP_6 = function $$log($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = $scope.get('IsomorphicHelpers')).$log.apply($b, Opal.to_a(args)); }, TMP_6.$$arity = -1); Opal.defn(self, '$on_opal_server?', TMP_7 = function() { var self = this; return self.$class()['$on_opal_server?'](); }, TMP_7.$$arity = 0); Opal.defn(self, '$on_opal_client?', TMP_8 = function() { var self = this; return self.$class()['$on_opal_client?'](); }, TMP_8.$$arity = 0); Opal.defs(self, '$prerender_footers', TMP_10 = function $$prerender_footers(controller) { var $a, $b, TMP_9, self = this, footer = nil; if (controller == null) { controller = nil; } footer = ($a = ($b = $scope.get('Context').$prerender_footer_blocks()).$collect, $a.$$p = (TMP_9 = function(block){var self = TMP_9.$$s || this; if (block == null) block = nil; return block.$call(controller)}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9), $a).call($b).$join("\n"); if ((($a = $scope.get('RUBY_ENGINE')['$!=']("opal")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {}; return footer; }, TMP_10.$$arity = -1); (function($base, $super) { function $Context(){}; var self = $Context = $klass($base, $super, 'Context', $Context); var def = self.$$proto, $scope = self.$$scope, TMP_11, TMP_12, TMP_14, TMP_15, TMP_17, TMP_18, TMP_19; def.ctx = nil; self.$attr_reader("controller"); self.$attr_reader("unique_id"); Opal.defs(self, '$before_first_mount_blocks', TMP_11 = function $$before_first_mount_blocks() { var $a, self = this; if (self.before_first_mount_blocks == null) self.before_first_mount_blocks = nil; return ((($a = self.before_first_mount_blocks) !== false && $a !== nil && $a != null) ? $a : self.before_first_mount_blocks = []); }, TMP_11.$$arity = 0); Opal.defs(self, '$prerender_footer_blocks', TMP_12 = function $$prerender_footer_blocks() { var $a, self = this; if (self.prerender_footer_blocks == null) self.prerender_footer_blocks = nil; return ((($a = self.prerender_footer_blocks) !== false && $a !== nil && $a != null) ? $a : self.prerender_footer_blocks = []); }, TMP_12.$$arity = 0); Opal.defn(self, '$initialize', TMP_14 = function $$initialize(unique_id, ctx, controller, name) { var $a, $b, TMP_13, self = this; if (ctx == null) { ctx = nil; } if (controller == null) { controller = nil; } if (name == null) { name = nil; } self.unique_id = unique_id; if ((($a = $scope.get('RUBY_ENGINE')['$!=']("opal")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {}; (((($scope.get('Hyperloop')).$$scope.get('Application'))).$$scope.get('Boot')).$run($hash2(["context"], {"context": self})); return ($a = ($b = self.$class().$before_first_mount_blocks()).$each, $a.$$p = (TMP_13 = function(block){var self = TMP_13.$$s || this; if (block == null) block = nil; return block.$call(self)}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13), $a).call($b); }, TMP_14.$$arity = -2); Opal.defn(self, '$eval', TMP_15 = function(js) { var $a, self = this; if ((($a = self.ctx) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.ctx.$eval(js) } else { return nil }; }, TMP_15.$$arity = 1); Opal.defn(self, '$send_to_opal', TMP_17 = function $$send_to_opal(method, $a_rest) { var $b, $c, TMP_16, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } if ((($b = self.ctx) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { return nil }; if (args.$length()['$=='](0)) { args = [1]}; ((Opal.get('ReactiveRuby')).$$scope.get('ComponentLoader')).$new(self.ctx)['$load!'](); return self.ctx.$eval("Opal.React.$const_get('IsomorphicHelpers').$" + (method) + "(" + (($b = ($c = args).$collect, $b.$$p = (TMP_16 = function(arg){var self = TMP_16.$$s || this; if (arg == null) arg = nil; return "'" + (arg) + "'"}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16), $b).call($c).$join(", ")) + ")"); }, TMP_17.$$arity = -2); Opal.defs(self, '$register_before_first_mount_block', TMP_18 = function $$register_before_first_mount_block() { var self = this, $iter = TMP_18.$$p, block = $iter || nil; TMP_18.$$p = null; return self.$before_first_mount_blocks()['$<<'](block); }, TMP_18.$$arity = 0); return (Opal.defs(self, '$register_prerender_footer_block', TMP_19 = function $$register_prerender_footer_block() { var self = this, $iter = TMP_19.$$p, block = $iter || nil; TMP_19.$$p = null; return self.$prerender_footer_blocks()['$<<'](block); }, TMP_19.$$arity = 0), nil) && 'register_prerender_footer_block'; })($scope.base, null); (function($base, $super) { function $IsomorphicProcCall(){}; var self = $IsomorphicProcCall = $klass($base, $super, 'IsomorphicProcCall', $IsomorphicProcCall); var def = self.$$proto, $scope = self.$$scope, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24; def.result = def.name = nil; self.$attr_reader("context"); Opal.defn(self, '$result', TMP_20 = function $$result() { var $a, self = this; if ((($a = self.result) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.result.$first() } else { return nil }; }, TMP_20.$$arity = 0); Opal.defn(self, '$initialize', TMP_21 = function $$initialize(name, block, context, $a_rest) { var $b, $c, $d, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 3; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 3; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 3] = arguments[$arg_idx]; } self.name = name; self.context = context; ($b = block).$call.apply($b, [self].concat(Opal.to_a(args))); if ((($c = $scope.get('IsomorphicHelpers')['$on_opal_server?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return ((($c = self.result) !== false && $c !== nil && $c != null) ? $c : self.result = ($d = self).$send_to_server.apply($d, Opal.to_a(args))) } else { return nil }; }, TMP_21.$$arity = -4); Opal.defn(self, '$when_on_client', TMP_22 = function $$when_on_client() { var $a, self = this, $iter = TMP_22.$$p, block = $iter || nil; TMP_22.$$p = null; if ((($a = $scope.get('IsomorphicHelpers')['$on_opal_client?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.result = [block.$call()] } else { return nil }; }, TMP_22.$$arity = 0); Opal.defn(self, '$send_to_server', TMP_23 = function $$send_to_server($a_rest) { var $b, self = this, args, args_as_json = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($b = $scope.get('IsomorphicHelpers')['$on_opal_server?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { args_as_json = args.$to_json(); return self.result = [$scope.get('JSON').$parse(Opal.global.ServerSideIsomorphicMethods[self.name](args_as_json))]; } else { return nil }; }, TMP_23.$$arity = -1); return (Opal.defn(self, '$when_on_server', TMP_24 = function $$when_on_server() { var $a, $b, self = this, $iter = TMP_24.$$p, block = $iter || nil; TMP_24.$$p = null; if ((($a = ((($b = $scope.get('IsomorphicHelpers')['$on_opal_client?']()) !== false && $b !== nil && $b != null) ? $b : $scope.get('IsomorphicHelpers')['$on_opal_server?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return self.result = [block.$call().$to_json()] }; }, TMP_24.$$arity = 0), nil) && 'when_on_server'; })($scope.base, null); (function($base) { var $ClassMethods, self = $ClassMethods = $module($base, 'ClassMethods'); var def = self.$$proto, $scope = self.$$scope, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, $a, TMP_31; Opal.defn(self, '$on_opal_server?', TMP_25 = function() { var self = this; return $scope.get('IsomorphicHelpers')['$on_opal_server?'](); }, TMP_25.$$arity = 0); Opal.defn(self, '$on_opal_client?', TMP_26 = function() { var self = this; return $scope.get('IsomorphicHelpers')['$on_opal_client?'](); }, TMP_26.$$arity = 0); Opal.defn(self, '$log', TMP_27 = function $$log($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = $scope.get('IsomorphicHelpers')).$log.apply($b, Opal.to_a(args)); }, TMP_27.$$arity = -1); Opal.defn(self, '$controller', TMP_28 = function $$controller() { var self = this; return $scope.get('IsomorphicHelpers').$context().$controller(); }, TMP_28.$$arity = 0); Opal.defn(self, '$before_first_mount', TMP_29 = function $$before_first_mount() { var $a, $b, self = this, $iter = TMP_29.$$p, block = $iter || nil; TMP_29.$$p = null; return ($a = ($b = (((($scope.get('React')).$$scope.get('IsomorphicHelpers'))).$$scope.get('Context'))).$register_before_first_mount_block, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_29.$$arity = 0); Opal.defn(self, '$prerender_footer', TMP_30 = function $$prerender_footer() { var $a, $b, self = this, $iter = TMP_30.$$p, block = $iter || nil; TMP_30.$$p = null; return ($a = ($b = (((($scope.get('React')).$$scope.get('IsomorphicHelpers'))).$$scope.get('Context'))).$register_prerender_footer_block, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_30.$$arity = 0); if ((($a = $scope.get('RUBY_ENGINE')['$!=']("opal")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$require("json"); Opal.defn(self, '$isomorphic_method', TMP_31 = function $$isomorphic_method(name) { var $a, $b, TMP_32, self = this, $iter = TMP_31.$$p, block = $iter || nil; TMP_31.$$p = null; return ($a = ($b = self.$class()).$send, $a.$$p = (TMP_32 = function($c_rest){var self = TMP_32.$$s || this, args, $d; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($d = (((($scope.get('React')).$$scope.get('IsomorphicHelpers'))).$$scope.get('IsomorphicProcCall'))).$new.apply($d, [name, block, self].concat(Opal.to_a(args))).$result()}, TMP_32.$$s = self, TMP_32.$$arity = -1, TMP_32), $a).call($b, "define_method", name); }, TMP_31.$$arity = 1); }; })($scope.base); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["rails-helpers/top_level_rails_component"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$include', '$export_component', '$param', '$backtrace', '$start_with?', '$component_name', '$params', '$<<', '$gsub', '$inject', '$const_get', '$split', '$method_defined?', '$present', '$render_params', '$each', '$==', '$+', '$name', '$controller', '$search_path', '$class', '$raise', '$join', '$search_path=', '$!', '$include?', '$add_to_react_search_path']); (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $TopLevelRailsComponent(){}; var self = $TopLevelRailsComponent = $klass($base, $super, 'TopLevelRailsComponent', $TopLevelRailsComponent); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_7; self.$include((((($scope.get('Hyperloop')).$$scope.get('Component'))).$$scope.get('Mixin'))); Opal.defs(self, '$search_path', TMP_1 = function $$search_path() { var $a, self = this; if (self.search_path == null) self.search_path = nil; return ((($a = self.search_path) !== false && $a !== nil && $a != null) ? $a : self.search_path = [$scope.get('Module')]); }, TMP_1.$$arity = 0); self.$export_component(); self.$param("component_name"); self.$param("controller"); self.$param("render_params"); self.$backtrace("off"); return (Opal.defn(self, '$render', TMP_7 = function $$render() {try { var $a, $b, TMP_2, $c, TMP_3, $d, TMP_5, self = this, paths_searched = nil, component = nil; paths_searched = []; if ((($a = self.$params().$component_name()['$start_with?']("::")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { paths_searched['$<<'](self.$params().$component_name().$gsub(/^\:\:/, "")); component = (function() { try {return ($a = ($b = self.$params().$component_name().$gsub(/^\:\:/, "").$split("::")).$inject, $a.$$p = (TMP_2 = function(scope, next_const){var self = TMP_2.$$s || this; if (scope == null) scope = nil;if (next_const == null) next_const = nil; return scope.$const_get(next_const, false)}, TMP_2.$$s = self, TMP_2.$$arity = 2, TMP_2), $a).call($b, $scope.get('Module')) } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { return nil } else { throw $err; } }})(); if ((($a = (($c = component !== false && component !== nil && component != null) ? component['$method_defined?']("render") : component)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$present(component, self.$params().$render_params())}; } else { ($a = ($c = self.$class().$search_path()).$each, $a.$$p = (TMP_3 = function(path){var self = TMP_3.$$s || this, $d, $e, TMP_4, $f; if (path == null) path = nil; paths_searched['$<<']("" + ((function() {if (path['$==']($scope.get('Module'))) { return nil } else { return $rb_plus(path.$name(), "::") }; return nil; })()) + (self.$params().$controller()) + "::" + (self.$params().$component_name())); component = (function() { try {return ($d = ($e = (((("") + (self.$params().$controller())) + "::") + (self.$params().$component_name())).$split("::")).$inject, $d.$$p = (TMP_4 = function(scope, next_const){var self = TMP_4.$$s || this; if (scope == null) scope = nil;if (next_const == null) next_const = nil; return scope.$const_get(next_const, false)}, TMP_4.$$s = self, TMP_4.$$arity = 2, TMP_4), $d).call($e, path) } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { return nil } else { throw $err; } }})(); if ((($d = (($f = component !== false && component !== nil && component != null) ? component['$method_defined?']("render") : component)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { Opal.ret(self.$present(component, self.$params().$render_params())) } else { return nil };}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $a).call($c); ($a = ($d = self.$class().$search_path()).$each, $a.$$p = (TMP_5 = function(path){var self = TMP_5.$$s || this, $e, $f, TMP_6, $g; if (path == null) path = nil; paths_searched['$<<']("" + ((function() {if (path['$==']($scope.get('Module'))) { return nil } else { return $rb_plus(path.$name(), "::") }; return nil; })()) + (self.$params().$component_name())); component = (function() { try {return ($e = ($f = (("") + (self.$params().$component_name())).$split("::")).$inject, $e.$$p = (TMP_6 = function(scope, next_const){var self = TMP_6.$$s || this; if (scope == null) scope = nil;if (next_const == null) next_const = nil; return scope.$const_get(next_const, false)}, TMP_6.$$s = self, TMP_6.$$arity = 2, TMP_6), $e).call($f, path) } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { return nil } else { throw $err; } }})(); if ((($e = (($g = component !== false && component !== nil && component != null) ? component['$method_defined?']("render") : component)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { Opal.ret(self.$present(component, self.$params().$render_params())) } else { return nil };}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $a).call($d); }; return self.$raise("Could not find component class '" + (self.$params().$component_name()) + "' for params.controller '" + (self.$params().$controller()) + "' in any component directory. Tried [" + (paths_searched.$join(", ")) + "]"); } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_7.$$arity = 0), nil) && 'render'; })($scope.base, null) })($scope.base); (function($base, $super) { function $Module(){}; var self = $Module = $klass($base, $super, 'Module', $Module); var def = self.$$proto, $scope = self.$$scope, TMP_8; return (Opal.defn(self, '$add_to_react_search_path', TMP_8 = function $$add_to_react_search_path(replace_search_path) { var $a, $b, self = this; if (replace_search_path == null) { replace_search_path = nil; } if (replace_search_path !== false && replace_search_path !== nil && replace_search_path != null) { return (($a = [[self]]), $b = (($scope.get('React')).$$scope.get('TopLevelRailsComponent')), $b['$search_path='].apply($b, $a), $a[$a.length-1]) } else if ((($a = (($scope.get('React')).$$scope.get('TopLevelRailsComponent')).$search_path()['$include?'](self)['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($scope.get('React')).$$scope.get('TopLevelRailsComponent')).$search_path()['$<<'](self) } else { return nil }; }, TMP_8.$$arity = -1), nil) && 'add_to_react_search_path' })($scope.base, null); return (function($base) { var $Components, self = $Components = $module($base, 'Components'); var def = self.$$proto, $scope = self.$$scope; self.$add_to_react_search_path() })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["reactive-ruby/version"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; Opal.cdecl($scope, 'VERSION', "0.12.7") })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-react"] = function(Opal) { var $a, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $hash2 = Opal.hash2, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$import', '$==', '$raise', '$join', '$include', '$deprecation_warning']); self.$require("hyperloop-config"); $scope.get('Hyperloop').$import("hyper-store"); $scope.get('Hyperloop').$import("react/react-source-browser"); $scope.get('Hyperloop').$import("react/react-source-server", $hash2(["server_only"], {"server_only": true})); $scope.get('Hyperloop').$import("opal-jquery", $hash2(["client_only"], {"client_only": true})); $scope.get('Hyperloop').$import("browser/delay", $hash2(["client_only"], {"client_only": true})); $scope.get('Hyperloop').$import("react_ujs", $hash2(["client_only"], {"client_only": true})); $scope.get('Hyperloop').$import("hyper-react"); if ($scope.get('RUBY_ENGINE')['$==']("opal")) { (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Component(){}; var self = $Component = $klass($base, $super, 'Component', $Component); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, null) })($scope.base); if ((($a = Opal.global.React === undefined || Opal.global.React.version === undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise(["No React.js Available", "", "A global `React` must be defined before requiring 'hyper-react'", "", "To USE THE BUILT-IN SOURCE: ", " add 'require \"react/react-source-browser\"' immediately before the 'require \"hyper-react\" directive.", "IF USING WEBPACK:", " add 'react' to your webpack manifest."].$join("\n"))}; self.$require("react/hash"); self.$require("react/top_level"); self.$require("react/observable"); self.$require("react/validator"); self.$require("react/component"); self.$require("react/component/dsl_instance_methods"); self.$require("react/component/should_component_update"); self.$require("react/component/tags"); self.$require("react/component/base"); self.$require("react/element"); self.$require("react/event"); self.$require("react/api"); self.$require("react/rendering_context"); self.$require("react/state"); self.$require("react/object"); self.$require("react/ext/opal-jquery/element"); self.$require("reactive-ruby/isomorphic_helpers"); self.$require("rails-helpers/top_level_rails_component"); self.$require("reactive-ruby/version"); (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Component(){}; var self = $Component = $klass($base, $super, 'Component', $Component); var def = self.$$proto, $scope = self.$$scope, TMP_1; return (Opal.defs(self, '$inherited', TMP_1 = function $$inherited(child) { var self = this; return child.$include($scope.get('Mixin')); }, TMP_1.$$arity = 1), nil) && 'inherited' })($scope.base, null) })($scope.base); if ((($a = (function(){ try { return (((((($scope.get('Hyperloop')).$$scope.get('Component'))).$$scope.get('VERSION'))) != null ? 'constant' : nil); } catch (err) { if (err.$$class === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return (($scope.get('React')).$$scope.get('Component')).$deprecation_warning("components.rb", "Requiring 'hyper-react' is deprecated. Use gem 'hyper-component', and require 'hyper-component' instead.") };}; }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-component"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$import', '$==']); self.$require("hyperloop/component/version"); self.$require("hyperloop-config"); $scope.get('Hyperloop').$import("hyper-component"); if ($scope.get('RUBY_ENGINE')['$==']("opal")) { (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Component(){}; var self = $Component = $klass($base, $super, 'Component', $Component); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, null) })($scope.base); return self.$require("hyper-react");}; }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/version"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Operation(){}; var self = $Operation = $klass($base, $super, 'Operation', $Operation); var def = self.$$proto, $scope = self.$$scope; return Opal.cdecl($scope, 'VERSION', "0.5.6") })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/inflector/inflections"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$extend', '$instance', '$split', '$empty?', '$const_get', '$>', '$size', '$first', '$shift', '$inject', '$==', '$const_defined?', '$ancestors', '$apply_inflections', '$plurals', '$inflections', '$singulars', '$to_s', '$include?', '$uncountables', '$downcase', '$each', '$sub', '$new', '$attr_reader', '$unshift', '$<<']); self.$require("set"); return (function($base) { var $ActiveSupport, self = $ActiveSupport = $module($base, 'ActiveSupport'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Inflector, self = $Inflector = $module($base, 'Inflector'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_4, TMP_5, TMP_6, TMP_8; self.$extend(self); Opal.defn(self, '$inflections', TMP_1 = function $$inflections() { var self = this, $iter = TMP_1.$$p, $yield = $iter || nil; TMP_1.$$p = null; if (($yield !== nil)) { return Opal.yield1($yield, $scope.get('Inflections').$instance()); } else { return $scope.get('Inflections').$instance() }; }, TMP_1.$$arity = 0); Opal.defn(self, '$constantize', TMP_4 = function $$constantize(camel_cased_word) { var $a, $b, TMP_2, self = this, names = nil; names = camel_cased_word.$split("::"); if ((($a = names['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { $scope.get('Object').$const_get(camel_cased_word)}; if ((($a = ($b = $rb_gt(names.$size(), 1), $b !== false && $b !== nil && $b != null ?names.$first()['$empty?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { names.$shift()}; return ($a = ($b = names).$inject, $a.$$p = (TMP_2 = function(constant, name){var self = TMP_2.$$s || this, $c, $d, TMP_3, candidate = nil; if (constant == null) constant = nil;if (name == null) name = nil; if (constant['$==']($scope.get('Object'))) { return constant.$const_get(name) } else { candidate = constant.$const_get(name); if ((($c = constant['$const_defined?'](name, false)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return candidate;}; if ((($c = $scope.get('Object')['$const_defined?'](name)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { return candidate; }; constant = (function(){var $brk = Opal.new_brk(); try {return ($c = ($d = constant.$ancestors()).$inject, $c.$$p = (TMP_3 = function(const$, ancestor){var self = TMP_3.$$s || this, $e; if (const$ == null) const$ = nil;if (ancestor == null) ancestor = nil; if (ancestor['$==']($scope.get('Object'))) { Opal.brk(const$, $brk)}; if ((($e = ancestor['$const_defined?'](name, false)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { Opal.brk(ancestor, $brk)}; return const$;}, TMP_3.$$s = self, TMP_3.$$brk = $brk, TMP_3.$$arity = 2, TMP_3), $c).call($d) } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); return constant.$const_get(name, false); }}, TMP_2.$$s = self, TMP_2.$$arity = 2, TMP_2), $a).call($b, $scope.get('Object')); }, TMP_4.$$arity = 1); Opal.defn(self, '$pluralize', TMP_5 = function $$pluralize(word) { var self = this; return self.$apply_inflections(word, self.$inflections().$plurals()); }, TMP_5.$$arity = 1); Opal.defn(self, '$singularize', TMP_6 = function $$singularize(word) { var self = this; return self.$apply_inflections(word, self.$inflections().$singulars()); }, TMP_6.$$arity = 1); Opal.defn(self, '$apply_inflections', TMP_8 = function $$apply_inflections(word, rules) { var $a, $b, TMP_7, self = this, result = nil; result = word.$to_s(); if ((($a = self.$inflections().$uncountables()['$include?'](result.$downcase())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return result } else { (function(){var $brk = Opal.new_brk(); try {return ($a = ($b = rules).$each, $a.$$p = (TMP_7 = function(rule, replacement){var self = TMP_7.$$s || this, changed = nil; if (rule == null) rule = nil;if (replacement == null) replacement = nil; changed = result.$sub(rule, replacement); if (changed['$=='](result)) { return nil } else { result = changed; Opal.brk(nil, $brk); };}, TMP_7.$$s = self, TMP_7.$$brk = $brk, TMP_7.$$arity = 2, TMP_7), $a).call($b) } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); return result; }; }, TMP_8.$$arity = 2); (function($base, $super) { function $Inflections(){}; var self = $Inflections = $klass($base, $super, 'Inflections', $Inflections); var def = self.$$proto, $scope = self.$$scope, TMP_9, TMP_10, TMP_11, TMP_12, TMP_14, TMP_15; def.plurals = def.singulars = nil; Opal.defs(self, '$instance', TMP_9 = function $$instance() { var $a, self = this; if (self.__instance__ == null) self.__instance__ = nil; return ((($a = self.__instance__) !== false && $a !== nil && $a != null) ? $a : self.__instance__ = self.$new()); }, TMP_9.$$arity = 0); self.$attr_reader("plurals", "singulars", "uncountables"); Opal.defn(self, '$initialize', TMP_10 = function $$initialize() { var $a, self = this; return $a = [[], [], $scope.get('Set').$new()], self.plurals = $a[0], self.singulars = $a[1], self.uncountables = $a[2], $a; }, TMP_10.$$arity = 0); Opal.defn(self, '$plural', TMP_11 = function $$plural(rule, replacement) { var self = this; return self.plurals.$unshift([rule, replacement]); }, TMP_11.$$arity = 2); Opal.defn(self, '$singular', TMP_12 = function $$singular(rule, replacement) { var self = this; return self.singulars.$unshift([rule, replacement]); }, TMP_12.$$arity = 2); Opal.defn(self, '$uncountable', TMP_14 = function $$uncountable(words) { var $a, $b, TMP_13, self = this; return ($a = ($b = words).$each, $a.$$p = (TMP_13 = function(w){var self = TMP_13.$$s || this; if (self.uncountables == null) self.uncountables = nil; if (w == null) w = nil; return self.uncountables['$<<'](w.$downcase())}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13), $a).call($b); }, TMP_14.$$arity = 1); return (Opal.defn(self, '$irregular', TMP_15 = function $$irregular() { var self = this; return nil; }, TMP_15.$$arity = 0), nil) && 'irregular'; })($scope.base, null); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/inflections"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$inflections', '$plural', '$singular', '$irregular', '$uncountable']); return (function($base) { var $ActiveSupport, self = $ActiveSupport = $module($base, 'ActiveSupport'); var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_1; ($a = ($b = $scope.get('Inflector')).$inflections, $a.$$p = (TMP_1 = function(inflect){var self = TMP_1.$$s || this; if (inflect == null) inflect = nil; inflect.$plural(/$/, "s"); inflect.$plural(/s$/i, "s"); inflect.$plural(/^(ax|test)is$/i, "\\1es"); inflect.$plural(/(octop|vir)us$/i, "\\1i"); inflect.$plural(/(octop|vir)i$/i, "\\1i"); inflect.$plural(/(alias|status)$/i, "\\1es"); inflect.$plural(/(bu)s$/i, "\\1ses"); inflect.$plural(/(buffal|tomat)o$/i, "\\1oes"); inflect.$plural(/([ti])um$/i, "\\1a"); inflect.$plural(/([ti])a$/i, "\\1a"); inflect.$plural(/sis$/i, "ses"); inflect.$plural(/(?:([^f])fe|([lr])f)$/i, "\\1\\2ves"); inflect.$plural(/(hive)$/i, "\\1s"); inflect.$plural(/([^aeiouy]|qu)y$/i, "\\1ies"); inflect.$plural(/(x|ch|ss|sh)$/i, "\\1es"); inflect.$plural(/(matr|vert|ind)(?:ix|ex)$/i, "\\1ices"); inflect.$plural(/^(m|l)ouse$/i, "\\1ice"); inflect.$plural(/^(m|l)ice$/i, "\\1ice"); inflect.$plural(/^(ox)$/i, "\\1en"); inflect.$plural(/^(oxen)$/i, "\\1"); inflect.$plural(/(quiz)$/i, "\\1zes"); inflect.$singular(/s$/i, ""); inflect.$singular(/(ss)$/i, "\\1"); inflect.$singular(/(n)ews$/i, "\\1ews"); inflect.$singular(/([ti])a$/i, "\\1um"); inflect.$singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, "\\1sis"); inflect.$singular(/(^analy)(sis|ses)$/i, "\\1sis"); inflect.$singular(/([^f])ves$/i, "\\1fe"); inflect.$singular(/(hive)s$/i, "\\1"); inflect.$singular(/(tive)s$/i, "\\1"); inflect.$singular(/([lr])ves$/i, "\\1f"); inflect.$singular(/([^aeiouy]|qu)ies$/i, "\\1y"); inflect.$singular(/(s)eries$/i, "\\1eries"); inflect.$singular(/(m)ovies$/i, "\\1ovie"); inflect.$singular(/(x|ch|ss|sh)es$/i, "\\1"); inflect.$singular(/^(m|l)ice$/i, "\\1ouse"); inflect.$singular(/(bus)(es)?$/i, "\\1"); inflect.$singular(/(o)es$/i, "\\1"); inflect.$singular(/(shoe)s$/i, "\\1"); inflect.$singular(/(cris|test)(is|es)$/i, "\\1is"); inflect.$singular(/^(a)x[ie]s$/i, "\\1xis"); inflect.$singular(/(octop|vir)(us|i)$/i, "\\1us"); inflect.$singular(/(alias|status)(es)?$/i, "\\1"); inflect.$singular(/^(ox)en/i, "\\1"); inflect.$singular(/(vert|ind)ices$/i, "\\1ex"); inflect.$singular(/(matr)ices$/i, "\\1ix"); inflect.$singular(/(quiz)zes$/i, "\\1"); inflect.$singular(/(database)s$/i, "\\1"); inflect.$irregular("person", "people"); inflect.$irregular("man", "men"); inflect.$irregular("child", "children"); inflect.$irregular("sex", "sexes"); inflect.$irregular("move", "moves"); inflect.$irregular("zombie", "zombies"); return inflect.$uncountable(["equipment", "information", "rice", "money", "species", "series", "fish", "sheep", "jeans", "police"]);}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b, "en") })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/inflector"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); self.$require("active_support/inflector/inflections"); return self.$require("active_support/inflections"); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/string/inflections"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$pluralize', '$singularize', '$constantize']); self.$require("active_support/inflector"); return (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3; Opal.defn(self, '$pluralize', TMP_1 = function $$pluralize() { var self = this; return (($scope.get('ActiveSupport')).$$scope.get('Inflector')).$pluralize(self); }, TMP_1.$$arity = 0); Opal.defn(self, '$singularize', TMP_2 = function $$singularize() { var self = this; return (($scope.get('ActiveSupport')).$$scope.get('Inflector')).$singularize(self); }, TMP_2.$$arity = 0); return (Opal.defn(self, '$constantize', TMP_3 = function $$constantize() { var self = this; return (($scope.get('ActiveSupport')).$$scope.get('Inflector')).$constantize(self); }, TMP_3.$$arity = 0), nil) && 'constantize'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/string"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$gsub', '$strip', '$downcase', '$underscore', '$alias_method']); self.$require("active_support/core_ext/string/inflections"); return (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5; Opal.defn(self, '$parameterize', TMP_1 = function $$parameterize() { var self = this; return self.$downcase().$strip().$gsub(/\W+/, "-"); }, TMP_1.$$arity = 0); Opal.defn(self, '$dasherize', TMP_2 = function $$dasherize() { var self = this; return self.replace(/[-_\s]+/g, '-') .replace(/([A-Z\d]+)([A-Z][a-z])/g, '$1-$2') .replace(/([a-z\d])([A-Z])/g, '$1-$2') .toLowerCase(); }, TMP_2.$$arity = 0); Opal.defn(self, '$demodulize', TMP_3 = function $$demodulize() { var self = this; var idx = self.lastIndexOf('::'); if (idx > -1) { return self.substr(idx + 2); } return self; ; }, TMP_3.$$arity = 0); Opal.defn(self, '$underscore', TMP_4 = function $$underscore() { var self = this; return self.replace(/[-\s]+/g, '_') .replace(/([A-Z\d]+)([A-Z][a-z])/g, '$1_$2') .replace(/([a-z\d])([A-Z])/g, '$1_$2') .replace(/-/g, '_') .toLowerCase(); }, TMP_4.$$arity = 0); Opal.defn(self, '$camelize', TMP_5 = function $$camelize(first_letter) { var self = this; if (first_letter == null) { first_letter = "upper"; } return self.$underscore().replace(/(^|_)([^_]+)/g, function(match, pre, word, index) { var capitalize = first_letter === "upper" || index > 0; return capitalize ? word.substr(0,1).toUpperCase()+word.substr(1) : word; }); }, TMP_5.$$arity = -1); return self.$alias_method("camelcase", "camelize"); })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/hash_with_indifferent_access"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$dup', '$respond_to?', '$update', '$to_hash', '$tap', '$default=', '$default', '$default_proc', '$default_proc=', '$new']); return (function($base) { var $ActiveSupport, self = $ActiveSupport = $module($base, 'ActiveSupport'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $HashWithIndifferentAccess(){}; var self = $HashWithIndifferentAccess = $klass($base, $super, 'HashWithIndifferentAccess', $HashWithIndifferentAccess); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_6; Opal.defn(self, '$extractable_options?', TMP_1 = function() { var self = this; return true; }, TMP_1.$$arity = 0); Opal.defn(self, '$with_indifferent_access', TMP_2 = function $$with_indifferent_access() { var self = this; return self.$dup(); }, TMP_2.$$arity = 0); Opal.defn(self, '$nested_under_indifferent_access', TMP_3 = function $$nested_under_indifferent_access() { var self = this; return self; }, TMP_3.$$arity = 0); Opal.defn(self, '$initialize', TMP_4 = function $$initialize(constructor) { var $a, $b, $c, self = this, $iter = TMP_4.$$p, $yield = $iter || nil; if (constructor == null) { constructor = $hash2([], {}); } TMP_4.$$p = null; if ((($a = constructor['$respond_to?']("to_hash")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_4, false)), $a.$$p = null, $a).call($b); return self.$update(constructor); } else { return ($a = ($c = self, Opal.find_super_dispatcher(self, 'initialize', TMP_4, false)), $a.$$p = null, $a).call($c, constructor) }; }, TMP_4.$$arity = -1); return (Opal.defs(self, '$new_from_hash_copying_default', TMP_6 = function $$new_from_hash_copying_default(hash) { var $a, $b, TMP_5, self = this; hash = hash.$to_hash(); return ($a = ($b = self.$new(hash)).$tap, $a.$$p = (TMP_5 = function(new_hash){var self = TMP_5.$$s || this, $c, $d; if (new_hash == null) new_hash = nil; (($c = [hash.$default()]), $d = new_hash, $d['$default='].apply($d, $c), $c[$c.length-1]); if ((($c = hash.$default_proc()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return (($c = [hash.$default_proc()]), $d = new_hash, $d['$default_proc='].apply($d, $c), $c[$c.length-1]) } else { return nil };}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $a).call($b); }, TMP_6.$$arity = 1), nil) && 'new_from_hash_copying_default'; })($scope.base, $scope.get('Hash')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/hash/indifferent_access"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$new_from_hash_copying_default']); self.$require("active_support/hash_with_indifferent_access"); return (function($base, $super) { function $Hash(){}; var self = $Hash = $klass($base, $super, 'Hash', $Hash); var def = self.$$proto, $scope = self.$$scope, TMP_1; Opal.defn(self, '$with_indifferent_access', TMP_1 = function $$with_indifferent_access() { var self = this; return (($scope.get('ActiveSupport')).$$scope.get('HashWithIndifferentAccess')).$new_from_hash_copying_default(self); }, TMP_1.$$arity = 0); return Opal.alias(self, 'nested_under_indifferent_access', 'with_indifferent_access'); })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["date"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$include', '$<=>', '$nonzero?', '$d', '$zero?', '$new', '$class', '$-@', '$+@', '$===', '$coerce', '$==', '$>', '$+', '$allocate', '$join', '$compact', '$map', '$to_proc', '$downcase', '$wrap', '$raise', '$clone', '$jd', '$>>', '$wday', '$-', '$to_s', '$alias_method']); return (function($base, $super) { function $Date(){}; var self = $Date = $klass($base, $super, 'Date', $Date); var def = self.$$proto, $scope = self.$$scope, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_40, TMP_41, TMP_42, TMP_43, TMP_44, TMP_45, TMP_46, TMP_47, TMP_48, TMP_49, TMP_50; def.date = nil; (function($base, $super) { function $Infinity(){}; var self = $Infinity = $klass($base, $super, 'Infinity', $Infinity); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12; def.d = nil; self.$include($scope.get('Comparable')); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(d) { var self = this; if (d == null) { d = 1; } return self.d = d['$<=>'](0); }, TMP_1.$$arity = -1); Opal.defn(self, '$d', TMP_2 = function $$d() { var self = this; return self.d; }, TMP_2.$$arity = 0); Opal.defn(self, '$zero?', TMP_3 = function() { var self = this; return false; }, TMP_3.$$arity = 0); Opal.defn(self, '$finite?', TMP_4 = function() { var self = this; return false; }, TMP_4.$$arity = 0); Opal.defn(self, '$infinite?', TMP_5 = function() { var self = this; return self.$d()['$nonzero?'](); }, TMP_5.$$arity = 0); Opal.defn(self, '$nan?', TMP_6 = function() { var self = this; return self.$d()['$zero?'](); }, TMP_6.$$arity = 0); Opal.defn(self, '$abs', TMP_7 = function $$abs() { var self = this; return self.$class().$new(); }, TMP_7.$$arity = 0); Opal.defn(self, '$-@', TMP_8 = function() { var self = this; return self.$class().$new(self.$d()['$-@']()); }, TMP_8.$$arity = 0); Opal.defn(self, '$+@', TMP_9 = function() { var self = this; return self.$class().$new(self.$d()['$+@']()); }, TMP_9.$$arity = 0); Opal.defn(self, '$<=>', TMP_10 = function(other) { var $a, $b, self = this, $case = nil, l = nil, r = nil; $case = other;if ($scope.get('Infinity')['$===']($case)) {return self.$d()['$<=>'](other.$d())}else if ($scope.get('Numeric')['$===']($case)) {return self.$d()}else {try { $b = other.$coerce(self), $a = Opal.to_ary($b), l = ($a[0] == null ? nil : $a[0]), r = ($a[1] == null ? nil : $a[1]), $b; return l['$<=>'](r); } catch ($err) { if (Opal.rescue($err, [$scope.get('NoMethodError')])) { try { nil } finally { Opal.pop_exception() } } else { throw $err; } }}; return nil; }, TMP_10.$$arity = 1); Opal.defn(self, '$coerce', TMP_11 = function $$coerce(other) { var $a, $b, self = this, $iter = TMP_11.$$p, $yield = $iter || nil, $case = nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_11.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } return (function() {$case = other;if ($scope.get('Numeric')['$===']($case)) {return [self.$d()['$-@'](), self.$d()]}else {return ($a = ($b = self, Opal.find_super_dispatcher(self, 'coerce', TMP_11, false)), $a.$$p = $iter, $a).apply($b, $zuper)}})(); }, TMP_11.$$arity = 1); return (Opal.defn(self, '$to_f', TMP_12 = function $$to_f() { var $a, self = this; if (self.d['$=='](0)) { return 0}; if ((($a = $rb_gt(self.d, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($scope.get('Float')).$$scope.get('INFINITY')) } else { return (($scope.get('Float')).$$scope.get('INFINITY'))['$-@']() }; }, TMP_12.$$arity = 0), nil) && 'to_f'; })($scope.base, $scope.get('Numeric')); Opal.cdecl($scope, 'JULIAN', $scope.get('Infinity').$new()); Opal.cdecl($scope, 'GREGORIAN', $scope.get('Infinity').$new()['$-@']()); Opal.cdecl($scope, 'ITALY', 2299161); Opal.cdecl($scope, 'ENGLAND', 2361222); Opal.cdecl($scope, 'MONTHNAMES', $rb_plus([nil], ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"])); Opal.cdecl($scope, 'ABBR_MONTHNAMES', ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"]); Opal.cdecl($scope, 'DAYNAMES', ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]); Opal.cdecl($scope, 'ABBR_DAYNAMES', ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]); (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_13, TMP_14, TMP_15, TMP_16; Opal.alias(self, 'civil', 'new'); Opal.defn(self, '$wrap', TMP_13 = function $$wrap(native$) { var self = this, instance = nil; instance = self.$allocate(); instance.date = native$; return instance; }, TMP_13.$$arity = 1); Opal.defn(self, '$parse', TMP_14 = function $$parse(string, comp) { var $a, $b, $c, self = this; if (comp == null) { comp = true; } var current_date = new Date(); var current_day = current_date.getDate(), current_month = current_date.getMonth(), current_year = current_date.getFullYear(), current_wday = current_date.getDay(), full_month_name_regexp = $scope.get('MONTHNAMES').$compact().$join("|"); function match1(match) { return match[1]; } function match2(match) { return match[2]; } function match3(match) { return match[3]; } function match4(match) { return match[4]; } // Converts passed short year (0..99) // to a 4-digits year in the range (1969..2068) function fromShortYear(fn) { return function(match) { var short_year = fn(match); if (short_year >= 69) { short_year += 1900; } else { short_year += 2000; } return short_year; } } // Converts month abbr (nov) to a month number function fromMonthAbbr(fn) { return function(match) { var abbr = fn(match); return $scope.get('ABBR_MONTHNAMES').indexOf(abbr) + 1; } } function toInt(fn) { return function(match) { var value = fn(match); return parseInt(value, 10); } } // Depending on the 'comp' value appends 20xx to a passed year function to2000(fn) { return function(match) { var value = fn(match); if (comp) { return value + 2000; } else { return value; } } } // Converts passed week day name to a day number function fromDayName(fn) { return function(match) { var dayname = fn(match), wday = ($a = ($b = $scope.get('DAYNAMES')).$map, $a.$$p = "downcase".$to_proc(), $a).call($b).indexOf((dayname).$downcase()); return current_day - current_wday + wday; } } // Converts passed month name to a month number function fromFullMonthName(fn) { return function(match) { var month_name = fn(match); return ($a = ($c = $scope.get('MONTHNAMES').$compact()).$map, $a.$$p = "downcase".$to_proc(), $a).call($c).indexOf((month_name).$downcase()) + 1; } } var rules = [ { // DD as month day number regexp: /^(\d{2})$/, year: current_year, month: current_month, day: toInt(match1) }, { // DDD as year day number regexp: /^(\d{3})$/, year: current_year, month: 0, day: toInt(match1) }, { // MMDD as month and day regexp: /^(\d{2})(\d{2})$/, year: current_year, month: toInt(match1), day: toInt(match2) }, { // YYDDD as year and day number in 1969--2068 regexp: /^(\d{2})(\d{3})$/, year: fromShortYear(toInt(match1)), month: 0, day: toInt(match2) }, { // YYMMDD as year, month and day in 1969--2068 regexp: /^(\d{2})(\d{2})(\d{2})$/, year: fromShortYear(toInt(match1)), month: toInt(match2), day: toInt(match3) }, { // YYYYDDD as year and day number regexp: /^(\d{4})(\d{3})$/, year: toInt(match1), month: 0, day: toInt(match2) }, { // YYYYMMDD as year, month and day number regexp: /^(\d{4})(\d{2})(\d{2})$/, year: toInt(match1), month: toInt(match2), day: toInt(match3) }, { // mmm YYYY regexp: /^([a-z]{3})[\s\.\/\-](\d{3,4})$/, year: toInt(match2), month: fromMonthAbbr(match1), day: 1 }, { // DD mmm YYYY regexp: /^(\d{1,2})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{3,4})$/i, year: toInt(match3), month: fromMonthAbbr(match2), day: toInt(match1) }, { // mmm DD YYYY regexp: /^([a-z]{3})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{3,4})$/i, year: toInt(match3), month: fromMonthAbbr(match1), day: toInt(match2) }, { // YYYY mmm DD regexp: /^(\d{3,4})[\s\.\/\-]([a-z]{3})[\s\.\/\-](\d{1,2})$/i, year: toInt(match1), month: fromMonthAbbr(match2), day: toInt(match3) }, { // YYYY-MM-DD YYYY/MM/DD YYYY.MM.DD regexp: /^(\-?\d{3,4})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/, year: toInt(match1), month: toInt(match2), day: toInt(match3) }, { // YY-MM-DD regexp: /^(\d{2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\d{1,2})$/, year: to2000(toInt(match1)), month: toInt(match2), day: toInt(match3) }, { // DD-MM-YYYY regexp: /^(\d{1,2})[\s\.\/\-](\d{1,2})[\s\.\/\-](\-?\d{3,4})$/, year: toInt(match3), month: toInt(match2), day: toInt(match1) }, { // ddd regexp: new RegExp("^(" + $scope.get('DAYNAMES').$join("|") + ")$", 'i'), year: current_year, month: current_month, day: fromDayName(match1) }, { // monthname daynumber YYYY regexp: new RegExp("^(" + full_month_name_regexp + ")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-](\\-?\\d{3,4})$", "i"), year: toInt(match4), month: fromFullMonthName(match1), day: toInt(match2) }, { // monthname daynumber regexp: new RegExp("^(" + full_month_name_regexp + ")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)", "i"), year: current_year, month: fromFullMonthName(match1), day: toInt(match2) }, { // daynumber monthname YYYY regexp: new RegExp("^(\\d{1,2})(th|nd|rd)[\\s\\.\\/\\-](" + full_month_name_regexp + ")[\\s\\.\\/\\-](\\-?\\d{3,4})$", "i"), year: toInt(match4), month: fromFullMonthName(match3), day: toInt(match1) }, { // YYYY monthname daynumber regexp: new RegExp("^(\\-?\\d{3,4})[\\s\\.\\/\\-](" + full_month_name_regexp + ")[\\s\\.\\/\\-](\\d{1,2})(th|nd|rd)$", "i"), year: toInt(match1), month: fromFullMonthName(match2), day: toInt(match3) } ] var rule, i, match; for (i = 0; i < rules.length; i++) { rule = rules[i]; match = rule.regexp.exec(string); if (match) { var year = rule.year; if (typeof(year) === 'function') { year = year(match); } var month = rule.month; if (typeof(month) === 'function') { month = month(match) - 1 } var day = rule.day; if (typeof(day) === 'function') { day = day(match); } var result = new Date(year, month, day); // an edge case, JS can't handle 'new Date(1)', minimal year is 1970 if (year >= 0 && year <= 1970) { result.setFullYear(year); } return self.$wrap(result); } } ; return self.$raise($scope.get('ArgumentError'), "invalid date"); }, TMP_14.$$arity = -2); Opal.defn(self, '$today', TMP_15 = function $$today() { var self = this; return self.$wrap(new Date()); }, TMP_15.$$arity = 0); return (Opal.defn(self, '$gregorian_leap?', TMP_16 = function(year) { var self = this; return (new Date(year, 1, 29).getMonth()-1) === 0; }, TMP_16.$$arity = 1), nil) && 'gregorian_leap?'; })(Opal.get_singleton_class(self)); Opal.defn(self, '$initialize', TMP_17 = function $$initialize(year, month, day, start) { var self = this; if (year == null) { year = -4712; } if (month == null) { month = 1; } if (day == null) { day = 1; } if (start == null) { start = $scope.get('ITALY'); } return self.date = new Date(year, month - 1, day); }, TMP_17.$$arity = -1); Opal.defn(self, '$-', TMP_18 = function(date) { var self = this; if (date.$$is_number) { var result = self.$clone(); result.date.setDate(self.date.getDate() - date); return result; } else if (date.date) { return Math.round((self.date - date.date) / (1000 * 60 * 60 * 24)); } else { self.$raise($scope.get('TypeError')); } ; }, TMP_18.$$arity = 1); Opal.defn(self, '$+', TMP_19 = function(date) { var self = this; if (date.$$is_number) { var result = self.$clone(); result.date.setDate(self.date.getDate() + date); return result; } else { self.$raise($scope.get('TypeError')); } ; }, TMP_19.$$arity = 1); Opal.defn(self, '$<', TMP_20 = function(other) { var self = this; var a = self.date, b = other.date; a.setHours(0, 0, 0, 0); b.setHours(0, 0, 0, 0); return a < b; ; }, TMP_20.$$arity = 1); Opal.defn(self, '$<=', TMP_21 = function(other) { var self = this; var a = self.date, b = other.date; a.setHours(0, 0, 0, 0); b.setHours(0, 0, 0, 0); return a <= b; ; }, TMP_21.$$arity = 1); Opal.defn(self, '$>', TMP_22 = function(other) { var self = this; var a = self.date, b = other.date; a.setHours(0, 0, 0, 0); b.setHours(0, 0, 0, 0); return a > b; ; }, TMP_22.$$arity = 1); Opal.defn(self, '$>=', TMP_23 = function(other) { var self = this; var a = self.date, b = other.date; a.setHours(0, 0, 0, 0); b.setHours(0, 0, 0, 0); return a >= b; ; }, TMP_23.$$arity = 1); Opal.defn(self, '$<=>', TMP_24 = function(other) { var self = this; if (other.$$is_number) { return self.$jd()['$<=>'](other) } var a = self.date, b = other.date; a.setHours(0, 0, 0, 0); b.setHours(0, 0, 0, 0); if (a < b) { return -1; } else if (a > b) { return 1; } else { return 0; } ; }, TMP_24.$$arity = 1); Opal.defn(self, '$==', TMP_25 = function(other) { var self = this; var a = self.date, b = other.date; return (a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate()); ; }, TMP_25.$$arity = 1); Opal.defn(self, '$>>', TMP_26 = function(n) { var self = this; if (!n.$$is_number) { self.$raise($scope.get('TypeError')); } var result = self.$clone(), date = result.date, cur = date.getDate(); date.setDate(1); date.setMonth(date.getMonth() + n); date.setDate(Math.min(cur, days_in_month(date.getFullYear(), date.getMonth()))); return result; ; }, TMP_26.$$arity = 1); Opal.defn(self, '$<<', TMP_27 = function(n) { var self = this; if (!n.$$is_number) { self.$raise($scope.get('TypeError')); } return self['$>>'](-n); ; }, TMP_27.$$arity = 1); Opal.alias(self, 'eql?', '=='); Opal.defn(self, '$clone', TMP_28 = function $$clone() { var self = this; return $scope.get('Date').$wrap(new Date(self.date.getTime())); }, TMP_28.$$arity = 0); Opal.defn(self, '$day', TMP_29 = function $$day() { var self = this; return self.date.getDate(); }, TMP_29.$$arity = 0); Opal.defn(self, '$friday?', TMP_30 = function() { var self = this; return self.$wday()['$=='](5); }, TMP_30.$$arity = 0); Opal.defn(self, '$jd', TMP_31 = function $$jd() { var self = this; //Adapted from http://www.physics.sfasu.edu/astro/javascript/julianday.html var mm = self.date.getMonth() + 1, dd = self.date.getDate(), yy = self.date.getFullYear(), hr = 12, mn = 0, sc = 0, ggg, s, a, j1, jd; hr = hr + (mn / 60) + (sc/3600); ggg = 1; if (yy <= 1585) { ggg = 0; } jd = -1 * Math.floor(7 * (Math.floor((mm + 9) / 12) + yy) / 4); s = 1; if ((mm - 9) < 0) { s =- 1; } a = Math.abs(mm - 9); j1 = Math.floor(yy + s * Math.floor(a / 7)); j1 = -1 * Math.floor((Math.floor(j1 / 100) + 1) * 3 / 4); jd = jd + Math.floor(275 * mm / 9) + dd + (ggg * j1); jd = jd + 1721027 + 2 * ggg + 367 * yy - 0.5; jd = jd + (hr / 24); return jd; ; }, TMP_31.$$arity = 0); Opal.defn(self, '$julian?', TMP_32 = function() { var self = this; return self.date < new Date(1582, 10 - 1, 15, 12); }, TMP_32.$$arity = 0); Opal.defn(self, '$monday?', TMP_33 = function() { var self = this; return self.$wday()['$=='](1); }, TMP_33.$$arity = 0); Opal.defn(self, '$month', TMP_34 = function $$month() { var self = this; return self.date.getMonth() + 1; }, TMP_34.$$arity = 0); Opal.defn(self, '$next', TMP_35 = function $$next() { var self = this; return $rb_plus(self, 1); }, TMP_35.$$arity = 0); Opal.defn(self, '$next_day', TMP_36 = function $$next_day(n) { var self = this; if (n == null) { n = 1; } return $rb_plus(self, n); }, TMP_36.$$arity = -1); Opal.defn(self, '$next_month', TMP_37 = function $$next_month() { var self = this; var result = self.$clone(), date = result.date, cur = date.getDate(); date.setDate(1); date.setMonth(date.getMonth() + 1); date.setDate(Math.min(cur, days_in_month(date.getFullYear(), date.getMonth()))); return result; ; }, TMP_37.$$arity = 0); Opal.defn(self, '$prev_day', TMP_38 = function $$prev_day(n) { var self = this; if (n == null) { n = 1; } return $rb_minus(self, n); }, TMP_38.$$arity = -1); Opal.defn(self, '$prev_month', TMP_39 = function $$prev_month() { var self = this; var result = self.$clone(), date = result.date, cur = date.getDate(); date.setDate(1); date.setMonth(date.getMonth() - 1); date.setDate(Math.min(cur, days_in_month(date.getFullYear(), date.getMonth()))); return result; ; }, TMP_39.$$arity = 0); Opal.defn(self, '$saturday?', TMP_40 = function() { var self = this; return self.$wday()['$=='](6); }, TMP_40.$$arity = 0); Opal.defn(self, '$strftime', TMP_41 = function $$strftime(format) { var self = this; if (format == null) { format = ""; } if (format == '') { return self.$to_s(); } return self.date.$strftime(format); ; }, TMP_41.$$arity = -1); self.$alias_method("succ", "next"); Opal.defn(self, '$sunday?', TMP_42 = function() { var self = this; return self.$wday()['$=='](0); }, TMP_42.$$arity = 0); Opal.defn(self, '$thursday?', TMP_43 = function() { var self = this; return self.$wday()['$=='](4); }, TMP_43.$$arity = 0); Opal.defn(self, '$to_s', TMP_44 = function $$to_s() { var self = this; var d = self.date, year = d.getFullYear(), month = d.getMonth() + 1, day = d.getDate(); if (month < 10) { month = '0' + month; } if (day < 10) { day = '0' + day; } return year + '-' + month + '-' + day; ; }, TMP_44.$$arity = 0); Opal.defn(self, '$tuesday?', TMP_45 = function() { var self = this; return self.$wday()['$=='](2); }, TMP_45.$$arity = 0); Opal.defn(self, '$wday', TMP_46 = function $$wday() { var self = this; return self.date.getDay(); }, TMP_46.$$arity = 0); Opal.defn(self, '$wednesday?', TMP_47 = function() { var self = this; return self.$wday()['$=='](3); }, TMP_47.$$arity = 0); Opal.defn(self, '$year', TMP_48 = function $$year() { var self = this; return self.date.getFullYear(); }, TMP_48.$$arity = 0); Opal.defn(self, '$cwday', TMP_49 = function $$cwday() { var self = this; return self.date.getDay() || 7;; }, TMP_49.$$arity = 0); Opal.defn(self, '$cweek', TMP_50 = function $$cweek() { var self = this; var d = new Date(self.date); d.setHours(0,0,0); d.setDate(d.getDate()+4-(d.getDay()||7)); return Math.ceil((((d-new Date(d.getFullYear(),0,1))/8.64e7)+1)/7); ; }, TMP_50.$$arity = 0); function days_in_month(year, month) { var leap = ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0); return [31, (leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] } })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["time"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$strftime']); return (function($base, $super) { function $Time(){}; var self = $Time = $klass($base, $super, 'Time', $Time); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2; Opal.defs(self, '$parse', TMP_1 = function $$parse(str) { var self = this; return new Date(Date.parse(str)); }, TMP_1.$$arity = 1); return (Opal.defn(self, '$iso8601', TMP_2 = function $$iso8601() { var self = this; return self.$strftime("%FT%T%z"); }, TMP_2.$$arity = 0), nil) && 'iso8601'; })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["js"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$insert', '$<<', '$global', '$extend']); return (function($base) { var $JS, self = $JS = $module($base, 'JS'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, $a, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9; Opal.defn(self, '$delete', TMP_1 = function(object, property) { var self = this; return delete object[property]; }, TMP_1.$$arity = 2); Opal.defn(self, '$global', TMP_2 = function $$global() { var self = this; return Opal.global; }, TMP_2.$$arity = 0); Opal.defn(self, '$in', TMP_3 = function(property, object) { var self = this; return property in object; }, TMP_3.$$arity = 2); Opal.defn(self, '$instanceof', TMP_4 = function(value, func) { var self = this; return value instanceof func; }, TMP_4.$$arity = 2); if ((($a = typeof Function.prototype.bind == 'function') !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { Opal.defn(self, '$new', TMP_5 = function(func, $a_rest) { var self = this, args, $iter = TMP_5.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_5.$$p = null; args.$insert(0, this); if (block !== false && block !== nil && block != null) { args['$<<'](block)}; return new (func.bind.apply(func, args))(); }, TMP_5.$$arity = -2) } else { Opal.defn(self, '$new', TMP_6 = function(func, $a_rest) { var self = this, args, $iter = TMP_6.$$p, block = $iter || nil, f = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_6.$$p = null; if (block !== false && block !== nil && block != null) { args['$<<'](block)}; f = function(){return func.apply(this, args)}; f["prototype"]=func["prototype"]; return new f(); }, TMP_6.$$arity = -2) }; Opal.defn(self, '$typeof', TMP_7 = function(value) { var self = this; return typeof value; }, TMP_7.$$arity = 1); Opal.defn(self, '$void', TMP_8 = function(expr) { var self = this; return void expr; }, TMP_8.$$arity = 1); Opal.defn(self, '$call', TMP_9 = function $$call(func, $a_rest) { var self = this, args, $iter = TMP_9.$$p, block = $iter || nil, g = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_9.$$p = null; g = self.$global(); if (block !== false && block !== nil && block != null) { args['$<<'](block)}; return g[func].apply(g, args); }, TMP_9.$$arity = -2); Opal.alias(self, 'method_missing', 'call'); self.$extend(self); })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["bigdecimal/kernel"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$new']); return (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_1; Opal.defn(self, '$BigDecimal', TMP_1 = function $$BigDecimal(initial, digits) { var self = this; if (digits == null) { digits = 0; } return $scope.get('BigDecimal').$new(initial, digits); }, TMP_1.$$arity = -2) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["bigdecimal/bignumber"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; return (function($base, $super) { function $BigDecimal(){}; var self = $BigDecimal = $klass($base, $super, 'BigDecimal', $BigDecimal); var def = self.$$proto, $scope = self.$$scope; var define = function (f) { Opal.casgn(self, 'BigNumber', f()); }; define.amd = true; /* jshint ignore:start */ /* bignumber.js v2.1.4 https://github.com/MikeMcl/bignumber.js/LICENCE */ !function(e){"use strict";function n(e){function E(e,n){var t,r,i,o,u,s,f=this;if(!(f instanceof E))return j&&L(26,"constructor call without new",e),new E(e,n);if(null!=n&&H(n,2,64,M,"base")){if(n=0|n,s=e+"",10==n)return f=new E(e instanceof E?e:s),U(f,P+f.e+1,k);if((o="number"==typeof e)&&0*e!=0||!new RegExp("^-?"+(t="["+N.slice(0,n)+"]+")+"(?:\\."+t+")?$",37>n?"i":"").test(s))return h(f,s,o,n);o?(f.s=0>1/e?(s=s.slice(1),-1):1,j&&s.replace(/^0\.0*|\./,"").length>15&&L(M,v,e),o=!1):f.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1,s=D(s,10,n,f.s)}else{if(e instanceof E)return f.s=e.s,f.e=e.e,f.c=(e=e.c)?e.slice():e,void(M=0);if((o="number"==typeof e)&&0*e==0){if(f.s=0>1/e?(e=-e,-1):1,e===~~e){for(r=0,i=e;i>=10;i/=10,r++);return f.e=r,f.c=[e],void(M=0)}s=e+""}else{if(!g.test(s=e+""))return h(f,s,o);f.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1}}for((r=s.indexOf("."))>-1&&(s=s.replace(".","")),(i=s.search(/e/i))>0?(0>r&&(r=i),r+=+s.slice(i+1),s=s.substring(0,i)):0>r&&(r=s.length),i=0;48===s.charCodeAt(i);i++);for(u=s.length;48===s.charCodeAt(--u););if(s=s.slice(i,u+1))if(u=s.length,o&&j&&u>15&&L(M,v,f.s*e),r=r-i-1,r>z)f.c=f.e=null;else if(G>r)f.c=[f.e=0];else{if(f.e=r,f.c=[],i=(r+1)%O,0>r&&(i+=O),u>i){for(i&&f.c.push(+s.slice(0,i)),u-=O;u>i;)f.c.push(+s.slice(i,i+=O));s=s.slice(i),i=O-s.length}else i-=u;for(;i--;s+="0");f.c.push(+s)}else f.c=[f.e=0];M=0}function D(e,n,t,i){var o,u,f,c,a,h,g,p=e.indexOf("."),d=P,m=k;for(37>t&&(e=e.toLowerCase()),p>=0&&(f=J,J=0,e=e.replace(".",""),g=new E(t),a=g.pow(e.length-p),J=f,g.c=s(l(r(a.c),a.e),10,n),g.e=g.c.length),h=s(e,t,n),u=f=h.length;0==h[--f];h.pop());if(!h[0])return"0";if(0>p?--u:(a.c=h,a.e=u,a.s=i,a=C(a,g,d,m,n),h=a.c,c=a.r,u=a.e),o=u+d+1,p=h[o],f=n/2,c=c||0>o||null!=h[o+1],c=4>m?(null!=p||c)&&(0==m||m==(a.s<0?3:2)):p>f||p==f&&(4==m||c||6==m&&1&h[o-1]||m==(a.s<0?8:7)),1>o||!h[0])e=c?l("1",-d):"0";else{if(h.length=o,c)for(--n;++h[--o]>n;)h[o]=0,o||(++u,h.unshift(1));for(f=h.length;!h[--f];);for(p=0,e="";f>=p;e+=N.charAt(h[p++]));e=l(e,u)}return e}function F(e,n,t,i){var o,u,s,c,a;if(t=null!=t&&H(t,0,8,i,w)?0|t:k,!e.c)return e.toString();if(o=e.c[0],s=e.e,null==n)a=r(e.c),a=19==i||24==i&&B>=s?f(a,s):l(a,s);else if(e=U(new E(e),n,t),u=e.e,a=r(e.c),c=a.length,19==i||24==i&&(u>=n||B>=u)){for(;n>c;a+="0",c++);a=f(a,u)}else if(n-=s,a=l(a,u),u+1>c){if(--n>0)for(a+=".";n--;a+="0");}else if(n+=u-c,n>0)for(u+1==c&&(a+=".");n--;a+="0");return e.s<0&&o?"-"+a:a}function _(e,n){var t,r,i=0;for(u(e[0])&&(e=e[0]),t=new E(e[0]);++ie||e>t||e!=c(e))&&L(r,(i||"decimal places")+(n>e||e>t?" out of range":" not an integer"),e),!0}function I(e,n,t){for(var r=1,i=n.length;!n[--i];n.pop());for(i=n[0];i>=10;i/=10,r++);return(t=r+t*O-1)>z?e.c=e.e=null:G>t?e.c=[e.e=0]:(e.e=t,e.c=n),e}function L(e,n,t){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][e]+"() "+n+": "+t);throw r.name="BigNumber Error",M=0,r}function U(e,n,t,r){var i,o,u,s,f,l,c,a=e.c,h=S;if(a){e:{for(i=1,s=a[0];s>=10;s/=10,i++);if(o=n-i,0>o)o+=O,u=n,f=a[l=0],c=f/h[i-u-1]%10|0;else if(l=p((o+1)/O),l>=a.length){if(!r)break e;for(;a.length<=l;a.push(0));f=c=0,i=1,o%=O,u=o-O+1}else{for(f=s=a[l],i=1;s>=10;s/=10,i++);o%=O,u=o-O+i,c=0>u?0:f/h[i-u-1]%10|0}if(r=r||0>n||null!=a[l+1]||(0>u?f:f%h[i-u-1]),r=4>t?(c||r)&&(0==t||t==(e.s<0?3:2)):c>5||5==c&&(4==t||r||6==t&&(o>0?u>0?f/h[i-u]:0:a[l-1])%10&1||t==(e.s<0?8:7)),1>n||!a[0])return a.length=0,r?(n-=e.e+1,a[0]=h[(O-n%O)%O],e.e=-n||0):a[0]=e.e=0,e;if(0==o?(a.length=l,s=1,l--):(a.length=l+1,s=h[O-o],a[l]=u>0?d(f/h[i-u]%h[u])*s:0),r)for(;;){if(0==l){for(o=1,u=a[0];u>=10;u/=10,o++);for(u=a[0]+=s,s=1;u>=10;u/=10,s++);o!=s&&(e.e++,a[0]==b&&(a[0]=1));break}if(a[l]+=s,a[l]!=b)break;a[l--]=0,s=1}for(o=a.length;0===a[--o];a.pop());}e.e>z?e.c=e.e=null:e.et?null!=(e=i[t++]):void 0};return f(n="DECIMAL_PLACES")&&H(e,0,A,2,n)&&(P=0|e),r[n]=P,f(n="ROUNDING_MODE")&&H(e,0,8,2,n)&&(k=0|e),r[n]=k,f(n="EXPONENTIAL_AT")&&(u(e)?H(e[0],-A,0,2,n)&&H(e[1],0,A,2,n)&&(B=0|e[0],$=0|e[1]):H(e,-A,A,2,n)&&(B=-($=0|(0>e?-e:e)))),r[n]=[B,$],f(n="RANGE")&&(u(e)?H(e[0],-A,-1,2,n)&&H(e[1],1,A,2,n)&&(G=0|e[0],z=0|e[1]):H(e,-A,A,2,n)&&(0|e?G=-(z=0|(0>e?-e:e)):j&&L(2,n+" cannot be zero",e))),r[n]=[G,z],f(n="ERRORS")&&(e===!!e||1===e||0===e?(M=0,H=(j=!!e)?x:o):j&&L(2,n+m,e)),r[n]=j,f(n="CRYPTO")&&(e===!!e||1===e||0===e?(V=!(!e||!a),e&&!V&&j&&L(2,"crypto unavailable",a)):j&&L(2,n+m,e)),r[n]=V,f(n="MODULO_MODE")&&H(e,0,9,2,n)&&(W=0|e),r[n]=W,f(n="POW_PRECISION")&&H(e,0,A,2,n)&&(J=0|e),r[n]=J,f(n="FORMAT")&&("object"==typeof e?X=e:j&&L(2,n+" not an object",e)),r[n]=X,r},E.max=function(){return _(arguments,T.lt)},E.min=function(){return _(arguments,T.gt)},E.random=function(){var e=9007199254740992,n=Math.random()*e&2097151?function(){return d(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var t,r,i,o,u,s=0,f=[],l=new E(q);if(e=null!=e&&H(e,0,A,14)?0|e:P,o=p(e/O),V)if(a&&a.getRandomValues){for(t=a.getRandomValues(new Uint32Array(o*=2));o>s;)u=131072*t[s]+(t[s+1]>>>11),u>=9e15?(r=a.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(f.push(u%1e14),s+=2);s=o/2}else if(a&&a.randomBytes){for(t=a.randomBytes(o*=7);o>s;)u=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6],u>=9e15?a.randomBytes(7).copy(t,s):(f.push(u%1e14),s+=7);s=o/7}else j&&L(14,"crypto unavailable",a);if(!s)for(;o>s;)u=n(),9e15>u&&(f[s++]=u%1e14);for(o=f[--s],e%=O,o&&e&&(u=S[O-e],f[s]=d(o/u)*u);0===f[s];f.pop(),s--);if(0>s)f=[i=0];else{for(i=-1;0===f[0];f.shift(),i-=O);for(s=1,u=f[0];u>=10;u/=10,s++);O>s&&(i-=O-s)}return l.e=i,l.c=f,l}}(),C=function(){function e(e,n,t){var r,i,o,u,s=0,f=e.length,l=n%R,c=n/R|0;for(e=e.slice();f--;)o=e[f]%R,u=e[f]/R|0,r=c*o+u*l,i=l*o+r%R*R+s,s=(i/t|0)+(r/R|0)+c*u,e[f]=i%t;return s&&e.unshift(s),e}function n(e,n,t,r){var i,o;if(t!=r)o=t>r?1:-1;else for(i=o=0;t>i;i++)if(e[i]!=n[i]){o=e[i]>n[i]?1:-1;break}return o}function r(e,n,t,r){for(var i=0;t--;)e[t]-=i,i=e[t]1;e.shift());}return function(i,o,u,s,f){var l,c,a,h,g,p,m,w,v,N,y,S,R,A,D,F,_,x=i.s==o.s?1:-1,I=i.c,L=o.c;if(!(I&&I[0]&&L&&L[0]))return new E(i.s&&o.s&&(I?!L||I[0]!=L[0]:L)?I&&0==I[0]||!L?0*x:x/0:NaN);for(w=new E(x),v=w.c=[],c=i.e-o.e,x=u+c+1,f||(f=b,c=t(i.e/O)-t(o.e/O),x=x/O|0),a=0;L[a]==(I[a]||0);a++);if(L[a]>(I[a]||0)&&c--,0>x)v.push(1),h=!0;else{for(A=I.length,F=L.length,a=0,x+=2,g=d(f/(L[0]+1)),g>1&&(L=e(L,g,f),I=e(I,g,f),F=L.length,A=I.length),R=F,N=I.slice(0,F),y=N.length;F>y;N[y++]=0);_=L.slice(),_.unshift(0),D=L[0],L[1]>=f/2&&D++;do{if(g=0,l=n(L,N,F,y),0>l){if(S=N[0],F!=y&&(S=S*f+(N[1]||0)),g=d(S/D),g>1)for(g>=f&&(g=f-1),p=e(L,g,f),m=p.length,y=N.length;1==n(p,N,m,y);)g--,r(p,m>F?_:L,m,f),m=p.length,l=1;else 0==g&&(l=g=1),p=L.slice(),m=p.length;if(y>m&&p.unshift(0),r(N,p,y,f),y=N.length,-1==l)for(;n(L,N,F,y)<1;)g++,r(N,y>F?_:L,y,f),y=N.length}else 0===l&&(g++,N=[0]);v[a++]=g,N[0]?N[y++]=I[R]||0:(N=[I[R]],y=1)}while((R++=10;x/=10,a++);U(w,u+(w.e=a+c*O-1)+1,s,h)}else w.e=c,w.r=+h;return w}}(),h=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,n=/^([^.]+)\.$/,t=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,u,s,f){var l,c=s?u:u.replace(i,"");if(r.test(c))o.s=isNaN(c)?null:0>c?-1:1;else{if(!s&&(c=c.replace(e,function(e,n,t){return l="x"==(t=t.toLowerCase())?16:"b"==t?2:8,f&&f!=l?e:n}),f&&(l=f,c=c.replace(n,"$1").replace(t,"0.$1")),u!=c))return new E(c,l);j&&L(M,"not a"+(f?" base "+f:"")+" number",u),o.s=null}o.c=o.e=null,M=0}}(),T.absoluteValue=T.abs=function(){var e=new E(this);return e.s<0&&(e.s=1),e},T.ceil=function(){return U(new E(this),this.e+1,2)},T.comparedTo=T.cmp=function(e,n){return M=1,i(this,new E(e,n))},T.decimalPlaces=T.dp=function(){var e,n,r=this.c;if(!r)return null;if(e=((n=r.length-1)-t(this.e/O))*O,n=r[n])for(;n%10==0;n/=10,e--);return 0>e&&(e=0),e},T.dividedBy=T.div=function(e,n){return M=3,C(this,new E(e,n),P,k)},T.dividedToIntegerBy=T.divToInt=function(e,n){return M=4,C(this,new E(e,n),0,1)},T.equals=T.eq=function(e,n){return M=5,0===i(this,new E(e,n))},T.floor=function(){return U(new E(this),this.e+1,3)},T.greaterThan=T.gt=function(e,n){return M=6,i(this,new E(e,n))>0},T.greaterThanOrEqualTo=T.gte=function(e,n){return M=7,1===(n=i(this,new E(e,n)))||0===n},T.isFinite=function(){return!!this.c},T.isInteger=T.isInt=function(){return!!this.c&&t(this.e/O)>this.c.length-2},T.isNaN=function(){return!this.s},T.isNegative=T.isNeg=function(){return this.s<0},T.isZero=function(){return!!this.c&&0==this.c[0]},T.lessThan=T.lt=function(e,n){return M=8,i(this,new E(e,n))<0},T.lessThanOrEqualTo=T.lte=function(e,n){return M=9,-1===(n=i(this,new E(e,n)))||0===n},T.minus=T.sub=function(e,n){var r,i,o,u,s=this,f=s.s;if(M=10,e=new E(e,n),n=e.s,!f||!n)return new E(NaN);if(f!=n)return e.s=-n,s.plus(e);var l=s.e/O,c=e.e/O,a=s.c,h=e.c;if(!l||!c){if(!a||!h)return a?(e.s=-n,e):new E(h?s:NaN);if(!a[0]||!h[0])return h[0]?(e.s=-n,e):new E(a[0]?s:3==k?-0:0)}if(l=t(l),c=t(c),a=a.slice(),f=l-c){for((u=0>f)?(f=-f,o=a):(c=l,o=h),o.reverse(),n=f;n--;o.push(0));o.reverse()}else for(i=(u=(f=a.length)<(n=h.length))?f:n,f=n=0;i>n;n++)if(a[n]!=h[n]){u=a[n]0)for(;n--;a[r++]=0);for(n=b-1;i>f;){if(a[--i]0?(s=u,r=l):(o=-o,r=f),r.reverse();o--;r.push(0));r.reverse()}for(o=f.length,n=l.length,0>o-n&&(r=l,l=f,f=r,n=o),o=0;n;)o=(f[--n]=f[n]+l[n]+o)/b|0,f[n]%=b;return o&&(f.unshift(o),++s),I(e,f,s)},T.precision=T.sd=function(e){var n,t,r=this,i=r.c;if(null!=e&&e!==!!e&&1!==e&&0!==e&&(j&&L(13,"argument"+m,e),e!=!!e&&(e=null)),!i)return null;if(t=i.length-1,n=t*O+1,t=i[t]){for(;t%10==0;t/=10,n--);for(t=i[0];t>=10;t/=10,n++);}return e&&r.e+1>n&&(n=r.e+1),n},T.round=function(e,n){var t=new E(this);return(null==e||H(e,0,A,15))&&U(t,~~e+this.e+1,null!=n&&H(n,0,8,15,w)?0|n:k),t},T.shift=function(e){var n=this;return H(e,-y,y,16,"argument")?n.times("1e"+c(e)):new E(n.c&&n.c[0]&&(-y>e||e>y)?n.s*(0>e?0:1/0):n)},T.squareRoot=T.sqrt=function(){var e,n,i,o,u,s=this,f=s.c,l=s.s,c=s.e,a=P+4,h=new E("0.5");if(1!==l||!f||!f[0])return new E(!l||0>l&&(!f||f[0])?NaN:f?s:1/0);if(l=Math.sqrt(+s),0==l||l==1/0?(n=r(f),(n.length+c)%2==0&&(n+="0"),l=Math.sqrt(n),c=t((c+1)/2)-(0>c||c%2),l==1/0?n="1e"+c:(n=l.toExponential(),n=n.slice(0,n.indexOf("e")+1)+c),i=new E(n)):i=new E(l+""),i.c[0])for(c=i.e,l=c+a,3>l&&(l=0);;)if(u=i,i=h.times(u.plus(C(s,u,a,1))),r(u.c).slice(0,l)===(n=r(i.c)).slice(0,l)){if(i.el&&(d=N,N=y,y=d,o=l,l=h,h=o),o=l+h,d=[];o--;d.push(0));for(m=b,w=R,o=h;--o>=0;){for(r=0,g=y[o]%w,p=y[o]/w|0,s=l,u=o+s;u>o;)c=N[--s]%w,a=N[s]/w|0,f=p*c+a*g,c=g*c+f%w*w+d[u]+r,r=(c/m|0)+(f/w|0)+p*a,d[u--]=c%m;d[u]=r}return r?++i:d.shift(),I(e,d,i)},T.toDigits=function(e,n){var t=new E(this);return e=null!=e&&H(e,1,A,18,"precision")?0|e:null,n=null!=n&&H(n,0,8,18,w)?0|n:k,e?U(t,e,n):t},T.toExponential=function(e,n){return F(this,null!=e&&H(e,0,A,19)?~~e+1:null,n,19)},T.toFixed=function(e,n){return F(this,null!=e&&H(e,0,A,20)?~~e+this.e+1:null,n,20)},T.toFormat=function(e,n){var t=F(this,null!=e&&H(e,0,A,21)?~~e+this.e+1:null,n,21);if(this.c){var r,i=t.split("."),o=+X.groupSize,u=+X.secondaryGroupSize,s=X.groupSeparator,f=i[0],l=i[1],c=this.s<0,a=c?f.slice(1):f,h=a.length;if(u&&(r=o,o=u,u=r,h-=r),o>0&&h>0){for(r=h%o||o,f=a.substr(0,r);h>r;r+=o)f+=s+a.substr(r,o);u>0&&(f+=s+a.slice(r)),c&&(f="-"+f)}t=l?f+X.decimalSeparator+((u=+X.fractionGroupSize)?l.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+X.fractionGroupSeparator):l):f}return t},T.toFraction=function(e){var n,t,i,o,u,s,f,l,c,a=j,h=this,g=h.c,p=new E(q),d=t=new E(q),m=f=new E(q);if(null!=e&&(j=!1,s=new E(e),j=a,(!(a=s.isInt())||s.lt(q))&&(j&&L(22,"max denominator "+(a?"out of range":"not an integer"),e),e=!a&&s.c&&U(s,s.e+1,1).gte(q)?s:null)),!g)return h.toString();for(c=r(g),o=p.e=c.length-h.e-1,p.c[0]=S[(u=o%O)<0?O+u:u],e=!e||s.cmp(p)>0?o>0?p:d:s,u=z,z=1/0,s=new E(c),f.c[0]=0;l=C(s,p,0,1),i=t.plus(l.times(m)),1!=i.cmp(e);)t=m,m=i,d=f.plus(l.times(i=d)),f=i,p=s.minus(l.times(i=p)),s=i;return i=C(e.minus(t),m,0,1),f=f.plus(i.times(d)),t=t.plus(i.times(m)),f.s=d.s=h.s,o*=2,n=C(d,m,o,k).minus(h).abs().cmp(C(f,t,o,k).minus(h).abs())<1?[d.toString(),m.toString()]:[f.toString(),t.toString()],z=u,n},T.toNumber=function(){return+this},T.toPower=T.pow=function(e){var n,t,r=d(0>e?-e:+e),i=this;if(!H(e,-y,y,23,"exponent")&&(!isFinite(e)||r>y&&(e/=0)||parseFloat(e)!=e&&!(e=NaN)))return new E(Math.pow(+i,e));for(n=J?p(J/O+2):0,t=new E(q);;){if(r%2){if(t=t.times(i),!t.c)break;n&&t.c.length>n&&(t.c.length=n)}if(r=d(r/2),!r)break;i=i.times(i),n&&i.c&&i.c.length>n&&(i.c.length=n)}return 0>e&&(t=q.div(t)),n?U(t,J,k):t},T.toPrecision=function(e,n){return F(this,null!=e&&H(e,1,A,24,"precision")?0|e:null,n,24)},T.toString=function(e){var n,t=this,i=t.s,o=t.e;return null===o?i?(n="Infinity",0>i&&(n="-"+n)):n="NaN":(n=r(t.c),n=null!=e&&H(e,2,64,25,"base")?D(l(n,o),0|e,10,i):B>=o||o>=$?f(n,o):l(n,o),0>i&&t.c[0]&&(n="-"+n)),n},T.truncated=T.trunc=function(){return U(new E(this),this.e+1,1)},T.valueOf=T.toJSON=function(){var e,n=this,t=n.e;return null===t?n.toString():(e=r(n.c),e=B>=t||t>=$?f(e,t):l(e,t),n.s<0?"-"+e:e)},null!=e&&E.config(e),E}function t(e){var n=0|e;return e>0||e===n?n:n-1}function r(e){for(var n,t,r=1,i=e.length,o=e[0]+"";i>r;){for(n=e[r++]+"",t=O-n.length;t--;n="0"+n);o+=n}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function i(e,n){var t,r,i=e.c,o=n.c,u=e.s,s=n.s,f=e.e,l=n.e;if(!u||!s)return null;if(t=i&&!i[0],r=o&&!o[0],t||r)return t?r?0:-s:u;if(u!=s)return u;if(t=0>u,r=f==l,!i||!o)return r?0:!i^t?1:-1;if(!r)return f>l^t?1:-1;for(s=(f=i.length)<(l=o.length)?f:l,u=0;s>u;u++)if(i[u]!=o[u])return i[u]>o[u]^t?1:-1;return f==l?0:f>l^t?1:-1}function o(e,n,t){return(e=c(e))>=n&&t>=e}function u(e){return"[object Array]"==Object.prototype.toString.call(e)}function s(e,n,t){for(var r,i,o=[0],u=0,s=e.length;s>u;){for(i=o.length;i--;o[i]*=n);for(o[r=0]+=N.indexOf(e.charAt(u++));rt-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/t|0,o[r]%=t)}return o.reverse()}function f(e,n){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(0>n?"e":"e+")+n}function l(e,n){var t,r;if(0>n){for(r="0.";++n;r+="0");e=r+e}else if(t=e.length,++n>t){for(r="0",n-=t;--n;r+="0");e+=r}else t>n&&(e=e.slice(0,n)+"."+e.slice(n));return e}function c(e){return e=parseFloat(e),0>e?p(e):d(e)}var a,h,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,p=Math.ceil,d=Math.floor,m=" not a boolean or binary digit",w="rounding mode",v="number type has more than 15 significant digits",N="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",b=1e14,O=14,y=9007199254740991,S=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],R=1e7,A=1e9;if("undefined"!=typeof crypto&&(a=crypto),"function"==typeof define&&define.amd)define(function(){return n()});else if("undefined"!=typeof module&&module.exports){if(module.exports=n(),!a)try{a=require("crypto")}catch(E){}}else e||(e="undefined"!=typeof self?self:Function("return this")()),e.BigNumber=n()}(this); /* jshint ignore:end */ })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["bigdecimal"] = function(Opal) { function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_ge(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); } function $rb_divide(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$===', '$attr_reader', '$new', '$class', '$bignumber', '$nan?', '$==', '$raise', '$<', '$coerce', '$>', '$mode', '$>=', '$/', '$zero?', '$infinite?', '$finite?']); (function($base, $super) { function $BigDecimal(){}; var self = $BigDecimal = $klass($base, $super, 'BigDecimal', $BigDecimal); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('Numeric')); self.$require("js"); self.$require("bigdecimal/kernel"); self.$require("bigdecimal/bignumber.js"); return (function($base, $super) { function $BigDecimal(){}; var self = $BigDecimal = $klass($base, $super, 'BigDecimal', $BigDecimal); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25; Opal.cdecl($scope, 'ROUND_MODE', 256); Opal.cdecl($scope, 'ROUND_UP', 0); Opal.cdecl($scope, 'ROUND_DOWN', 1); Opal.cdecl($scope, 'ROUND_CEILING', 2); Opal.cdecl($scope, 'ROUND_FLOOR', 3); Opal.cdecl($scope, 'ROUND_HALF_UP', 4); Opal.cdecl($scope, 'ROUND_HALF_DOWN', 5); Opal.cdecl($scope, 'ROUND_HALF_EVEN', 6); Opal.cdecl($scope, 'SIGN_NaN', 0); Opal.cdecl($scope, 'SIGN_POSITIVE_ZERO', 1); Opal.cdecl($scope, 'SIGN_NEGATIVE_ZERO', -1); Opal.cdecl($scope, 'SIGN_POSITIVE_FINITE', 2); Opal.cdecl($scope, 'SIGN_NEGATIVE_FINITE', -2); Opal.cdecl($scope, 'SIGN_POSITIVE_INFINITE', 3); Opal.cdecl($scope, 'SIGN_NEGATIVE_INFINITE', -3); Opal.defs(self, '$limit', TMP_1 = function $$limit(digits) { var self = this; if (self.digits == null) self.digits = nil; if (digits == null) { digits = nil; } if (digits !== false && digits !== nil && digits != null) { self.digits = digits}; return self.digits; }, TMP_1.$$arity = -1); Opal.defs(self, '$mode', TMP_2 = function $$mode(mode, value) { var $a, self = this, $case = nil; if (self.round_mode == null) self.round_mode = nil; if (value == null) { value = nil; } return (function() {$case = mode;if ($scope.get('ROUND_MODE')['$===']($case)) {if (value !== false && value !== nil && value != null) { self.round_mode = value}; return ((($a = self.round_mode) !== false && $a !== nil && $a != null) ? $a : $scope.get('ROUND_HALF_UP'));}else { return nil }})(); }, TMP_2.$$arity = -2); self.$attr_reader("bignumber"); Opal.defn(self, '$initialize', TMP_3 = function $$initialize(initial, digits) { var self = this; if (digits == null) { digits = 0; } return self.bignumber = $scope.get('JS').$new($scope.get('BigNumber'), initial); }, TMP_3.$$arity = -2); Opal.defn(self, '$==', TMP_4 = function(other) { var self = this, $case = nil; return (function() {$case = other;if (self.$class()['$===']($case)) {return self.$bignumber().equals(other.$bignumber())}else if ($scope.get('Number')['$===']($case)) {return self.$bignumber().equals(other)}else {return false}})(); }, TMP_4.$$arity = 1); Opal.alias(self, '===', '=='); Opal.defn(self, '$<=>', TMP_5 = function(other) { var self = this, $case = nil, result = nil; $case = other;if (self.$class()['$===']($case)) {result = self.$bignumber().comparedTo(other.$bignumber())}else if ($scope.get('Number')['$===']($case)) {result = self.$bignumber().comparedTo(other)}else {result = nil}; return result === null ? nil : result; }, TMP_5.$$arity = 1); Opal.defn(self, '$<', TMP_6 = function(other) { var $a, $b, $c, self = this, $iter = TMP_6.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_6.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = ((($b = self['$nan?']()) !== false && $b !== nil && $b != null) ? $b : (($c = other !== false && other !== nil && other != null) ? other['$nan?']() : other))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return false}; return ($a = ($b = self, Opal.find_super_dispatcher(self, '<', TMP_6, false)), $a.$$p = $iter, $a).apply($b, $zuper); }, TMP_6.$$arity = 1); Opal.defn(self, '$<=', TMP_7 = function(other) { var $a, $b, $c, self = this, $iter = TMP_7.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_7.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = ((($b = self['$nan?']()) !== false && $b !== nil && $b != null) ? $b : (($c = other !== false && other !== nil && other != null) ? other['$nan?']() : other))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return false}; return ($a = ($b = self, Opal.find_super_dispatcher(self, '<=', TMP_7, false)), $a.$$p = $iter, $a).apply($b, $zuper); }, TMP_7.$$arity = 1); Opal.defn(self, '$>', TMP_8 = function(other) { var $a, $b, $c, self = this, $iter = TMP_8.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_8.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = ((($b = self['$nan?']()) !== false && $b !== nil && $b != null) ? $b : (($c = other !== false && other !== nil && other != null) ? other['$nan?']() : other))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return false}; return ($a = ($b = self, Opal.find_super_dispatcher(self, '>', TMP_8, false)), $a.$$p = $iter, $a).apply($b, $zuper); }, TMP_8.$$arity = 1); Opal.defn(self, '$>=', TMP_9 = function(other) { var $a, $b, $c, self = this, $iter = TMP_9.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_9.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = ((($b = self['$nan?']()) !== false && $b !== nil && $b != null) ? $b : (($c = other !== false && other !== nil && other != null) ? other['$nan?']() : other))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return false}; return ($a = ($b = self, Opal.find_super_dispatcher(self, '>=', TMP_9, false)), $a.$$p = $iter, $a).apply($b, $zuper); }, TMP_9.$$arity = 1); Opal.defn(self, '$abs', TMP_10 = function $$abs() { var self = this; return self.$class().$new(self.$bignumber().abs()); }, TMP_10.$$arity = 0); Opal.defn(self, '$add', TMP_11 = function $$add(other, digits) { var $a, $b, self = this, _ = nil, result = nil; if (digits == null) { digits = 0; } if (digits['$=='](nil)) { self.$raise($scope.get('TypeError'), "wrong argument type nil (expected Fixnum)")}; if ((($a = $rb_lt(digits, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "argument must be positive")}; $b = self.$coerce(other), $a = Opal.to_ary($b), other = ($a[0] == null ? nil : $a[0]), _ = ($a[1] == null ? nil : $a[1]), $b; result = self.$bignumber().plus(other.$bignumber()); if ((($a = $rb_gt(digits, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = result.toDigits(digits, self.$class().$mode($scope.get('ROUND_MODE')))}; return self.$class().$new(result); }, TMP_11.$$arity = -2); Opal.alias(self, '+', 'add'); Opal.defn(self, '$ceil', TMP_12 = function $$ceil(n) { var $a, self = this; if (n == null) { n = nil; } if ((($a = self.$bignumber().isFinite()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('FloatDomainError'), "Computation results to 'Infinity'") }; if (n['$=='](nil)) { return self.$bignumber().round(0, $scope.get('ROUND_CEILING')).toNumber() } else if ((($a = $rb_ge(n, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$class().$new(self.$bignumber().round(n, $scope.get('ROUND_CEILING'))) } else { return self.$class().$new(self.$bignumber().round(0, $scope.get('ROUND_CEILING'))) }; }, TMP_12.$$arity = -1); Opal.defn(self, '$coerce', TMP_13 = function $$coerce(other) { var self = this, $case = nil; return (function() {$case = other;if (self.$class()['$===']($case)) {return [other, self]}else if ($scope.get('Number')['$===']($case)) {return [self.$class().$new(other), self]}else {return self.$raise($scope.get('TypeError'), "" + (other.$class()) + " can't be coerced into " + (self.$class()))}})(); }, TMP_13.$$arity = 1); Opal.defn(self, '$div', TMP_14 = function $$div(other, digits) { var $a, $b, self = this, _ = nil; if (digits == null) { digits = nil; } if (digits['$=='](0)) { return $rb_divide(self, other)}; $b = self.$coerce(other), $a = Opal.to_ary($b), other = ($a[0] == null ? nil : $a[0]), _ = ($a[1] == null ? nil : $a[1]), $b; if ((($a = ((($b = self['$nan?']()) !== false && $b !== nil && $b != null) ? $b : other['$nan?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('FloatDomainError'), "Computation results to 'NaN'(Not a Number)")}; if (digits['$=='](nil)) { if ((($a = other['$zero?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ZeroDivisionError'), "divided by 0")}; if ((($a = self['$infinite?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('FloatDomainError'), "Computation results to 'Infinity'")}; return self.$class().$new(self.$bignumber().dividedToIntegerBy(other.$bignumber()));}; return self.$class().$new(self.$bignumber().dividedBy(other.$bignumber()).round(digits, self.$class().$mode($scope.get('ROUND_MODE')))); }, TMP_14.$$arity = -2); Opal.defn(self, '$finite?', TMP_15 = function() { var self = this; return self.$bignumber().isFinite(); }, TMP_15.$$arity = 0); Opal.defn(self, '$infinite?', TMP_16 = function() { var $a, $b, self = this; if ((($a = ((($b = self['$finite?']()) !== false && $b !== nil && $b != null) ? $b : self['$nan?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; if ((($a = self.$bignumber().isNegative()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return -1 } else { return 1 }; }, TMP_16.$$arity = 0); Opal.defn(self, '$minus', TMP_17 = function $$minus(other) { var $a, $b, self = this, _ = nil; $b = self.$coerce(other), $a = Opal.to_ary($b), other = ($a[0] == null ? nil : $a[0]), _ = ($a[1] == null ? nil : $a[1]), $b; return self.$class().$new(self.$bignumber().minus(other.$bignumber())); }, TMP_17.$$arity = 1); Opal.alias(self, '-', 'minus'); Opal.defn(self, '$mult', TMP_18 = function $$mult(other, digits) { var $a, $b, self = this, _ = nil; if (digits == null) { digits = nil; } $b = self.$coerce(other), $a = Opal.to_ary($b), other = ($a[0] == null ? nil : $a[0]), _ = ($a[1] == null ? nil : $a[1]), $b; if (digits['$=='](nil)) { return self.$class().$new(self.$bignumber().times(other.$bignumber()))}; return self.$class().$new(self.$bignumber().times(other.$bignumber()).round(digits, self.$class().$mode($scope.get('ROUND_MODE')))); }, TMP_18.$$arity = -2); Opal.alias(self, '*', 'mult'); Opal.defn(self, '$nan?', TMP_19 = function() { var self = this; return self.$bignumber().isNaN(); }, TMP_19.$$arity = 0); Opal.defn(self, '$quo', TMP_20 = function $$quo(other) { var $a, $b, self = this, _ = nil; $b = self.$coerce(other), $a = Opal.to_ary($b), other = ($a[0] == null ? nil : $a[0]), _ = ($a[1] == null ? nil : $a[1]), $b; return self.$class().$new(self.$bignumber().dividedBy(other.$bignumber())); }, TMP_20.$$arity = 1); Opal.alias(self, '/', 'quo'); Opal.defn(self, '$sign', TMP_21 = function $$sign() { var $a, self = this; if ((($a = self.$bignumber().isNaN()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('SIGN_NaN')}; if ((($a = self.$bignumber().isZero()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (function() {if ((($a = self.$bignumber().isNegative()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('SIGN_NEGATIVE_ZERO') } else { return $scope.get('SIGN_POSITIVE_ZERO') }; return nil; })() } else { return nil }; }, TMP_21.$$arity = 0); Opal.defn(self, '$sub', TMP_22 = function $$sub(other, precision) { var $a, $b, self = this, _ = nil; $b = self.$coerce(other), $a = Opal.to_ary($b), other = ($a[0] == null ? nil : $a[0]), _ = ($a[1] == null ? nil : $a[1]), $b; return self.$class().$new(self.$bignumber().minus(other.$bignumber())); }, TMP_22.$$arity = 2); Opal.defn(self, '$to_f', TMP_23 = function $$to_f() { var self = this; return self.$bignumber().toNumber(); }, TMP_23.$$arity = 0); Opal.defn(self, '$to_s', TMP_24 = function $$to_s(s) { var self = this; if (s == null) { s = ""; } return self.$bignumber().toString(); }, TMP_24.$$arity = -1); return (Opal.defn(self, '$zero?', TMP_25 = function() { var self = this; return self.$bignumber().isZero(); }, TMP_25.$$arity = 0), nil) && 'zero?'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/version"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; Opal.cdecl($scope, 'VERSION', "0.8.1") })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/exception"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$attr_accessor', '$errors=', '$join', '$message_list', '$errors']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ValidationException(){}; var self = $ValidationException = $klass($base, $super, 'ValidationException', $ValidationException); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2; self.$attr_accessor("errors"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(errors) { var $a, $b, self = this; return (($a = [errors]), $b = self, $b['$errors='].apply($b, $a), $a[$a.length-1]); }, TMP_1.$$arity = 1); return (Opal.defn(self, '$to_s', TMP_2 = function $$to_s() { var self = this; return "" + (self.$errors().$message_list().$join("; ")); }, TMP_2.$$arity = 0), nil) && 'to_s'; })($scope.base, Opal.get('StandardError')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/errors"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$tap', '$merge!', '$new', '$[]', '$titleize', '$to_s', '$message', '$error_message_creator', '$Array', '$each', '$[]=', '$symbolic', '$concat', '$message_list', '$map', '$flatten', '$compact']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $DefaultErrorMessageCreator(){}; var self = $DefaultErrorMessageCreator = $klass($base, $super, 'DefaultErrorMessageCreator', $DefaultErrorMessageCreator); var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_1, TMP_2; Opal.cdecl($scope, 'MESSAGES', ($a = ($b = $scope.get('Hash').$new("is invalid")).$tap, $a.$$p = (TMP_1 = function(h){var self = TMP_1.$$s || this; if (h == null) h = nil; return h['$merge!']($hash2(["nils", "required", "string", "integer", "boolean", "hash", "array", "model", "date", "before", "after", "empty", "max_length", "min_length", "matches", "in", "class", "min", "max", "new_records"], {"nils": "can't be nil", "required": "is required", "string": "isn't a string", "integer": "isn't an integer", "boolean": "isn't a boolean", "hash": "isn't a hash", "array": "isn't an array", "model": "isn't the right class", "date": "date doesn't exist", "before": "isn't before given date", "after": "isn't after given date", "empty": "can't be blank", "max_length": "is too long", "min_length": "is too short", "matches": "isn't in the right format", "in": "isn't an option", "class": "isn't the right class", "min": "is too small", "max": "is too big", "new_records": "isn't a saved model"}))}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b)); return (Opal.defn(self, '$message', TMP_2 = function $$message(key, error_symbol, options) { var $a, self = this; if (options == null) { options = $hash2([], {}); } if ((($a = options['$[]']("index")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "" + ((((($a = key) !== false && $a !== nil && $a != null) ? $a : "array")).$to_s().$titleize()) + "[" + (options['$[]']("index")) + "] " + ($scope.get('MESSAGES')['$[]'](error_symbol)) } else { return "" + (key.$to_s().$titleize()) + " " + ($scope.get('MESSAGES')['$[]'](error_symbol)) }; }, TMP_2.$$arity = -3), nil) && 'message'; })($scope.base, null); (function($base, $super) { function $ErrorAtom(){}; var self = $ErrorAtom = $klass($base, $super, 'ErrorAtom', $ErrorAtom); var def = self.$$proto, $scope = self.$$scope, TMP_3, TMP_4, TMP_5, TMP_6; def.symbol = def.message = def.key = def.index = nil; Opal.defn(self, '$initialize', TMP_3 = function $$initialize(key, error_symbol, options) { var self = this; if (options == null) { options = $hash2([], {}); } self.key = key; self.symbol = error_symbol; self.message = options['$[]']("message"); return self.index = options['$[]']("index"); }, TMP_3.$$arity = -3); Opal.defn(self, '$symbolic', TMP_4 = function $$symbolic() { var self = this; return self.symbol; }, TMP_4.$$arity = 0); Opal.defn(self, '$message', TMP_5 = function $$message() { var $a, self = this; return ((($a = self.message) !== false && $a !== nil && $a != null) ? $a : self.message = $scope.get('Mutations').$error_message_creator().$message(self.key, self.symbol, $hash2(["index"], {"index": self.index}))); }, TMP_5.$$arity = 0); return (Opal.defn(self, '$message_list', TMP_6 = function $$message_list() { var self = this; return self.$Array(self.$message()); }, TMP_6.$$arity = 0), nil) && 'message_list'; })($scope.base, null); (function($base, $super) { function $ErrorHash(){}; var self = $ErrorHash = $klass($base, $super, 'ErrorHash', $ErrorHash); var def = self.$$proto, $scope = self.$$scope, TMP_9, TMP_12, TMP_14; Opal.defn(self, '$symbolic', TMP_9 = function $$symbolic() { var $a, $b, TMP_7, self = this; return ($a = ($b = $scope.get('HashWithIndifferentAccess').$new()).$tap, $a.$$p = (TMP_7 = function(hash){var self = TMP_7.$$s || this, $c, $d, TMP_8; if (hash == null) hash = nil; return ($c = ($d = self).$each, $c.$$p = (TMP_8 = function(k, v){var self = TMP_8.$$s || this; if (k == null) k = nil;if (v == null) v = nil; return hash['$[]='](k, v.$symbolic())}, TMP_8.$$s = self, TMP_8.$$arity = 2, TMP_8), $c).call($d)}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $a).call($b); }, TMP_9.$$arity = 0); Opal.defn(self, '$message', TMP_12 = function $$message() { var $a, $b, TMP_10, self = this; return ($a = ($b = $scope.get('HashWithIndifferentAccess').$new()).$tap, $a.$$p = (TMP_10 = function(hash){var self = TMP_10.$$s || this, $c, $d, TMP_11; if (hash == null) hash = nil; return ($c = ($d = self).$each, $c.$$p = (TMP_11 = function(k, v){var self = TMP_11.$$s || this; if (k == null) k = nil;if (v == null) v = nil; return hash['$[]='](k, v.$message())}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11), $c).call($d)}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10), $a).call($b); }, TMP_12.$$arity = 0); return (Opal.defn(self, '$message_list', TMP_14 = function $$message_list() { var $a, $b, TMP_13, self = this, list = nil; list = []; ($a = ($b = self).$each, $a.$$p = (TMP_13 = function(k, v){var self = TMP_13.$$s || this; if (k == null) k = nil;if (v == null) v = nil; return list.$concat(v.$message_list())}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13), $a).call($b); return list; }, TMP_14.$$arity = 0), nil) && 'message_list'; })($scope.base, $scope.get('Hash')); (function($base, $super) { function $ErrorArray(){}; var self = $ErrorArray = $klass($base, $super, 'ErrorArray', $ErrorArray); var def = self.$$proto, $scope = self.$$scope, TMP_16, TMP_18, TMP_20; Opal.defn(self, '$symbolic', TMP_16 = function $$symbolic() { var $a, $b, TMP_15, self = this; return ($a = ($b = self).$map, $a.$$p = (TMP_15 = function(e){var self = TMP_15.$$s || this, $c; if (e == null) e = nil; return (($c = e !== false && e !== nil && e != null) ? e.$symbolic() : e)}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15), $a).call($b); }, TMP_16.$$arity = 0); Opal.defn(self, '$message', TMP_18 = function $$message() { var $a, $b, TMP_17, self = this; return ($a = ($b = self).$map, $a.$$p = (TMP_17 = function(e){var self = TMP_17.$$s || this, $c; if (e == null) e = nil; return (($c = e !== false && e !== nil && e != null) ? e.$message() : e)}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17), $a).call($b); }, TMP_18.$$arity = 0); return (Opal.defn(self, '$message_list', TMP_20 = function $$message_list() { var $a, $b, TMP_19, self = this; return ($a = ($b = self.$compact()).$map, $a.$$p = (TMP_19 = function(e){var self = TMP_19.$$s || this; if (e == null) e = nil; return e.$message_list()}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19), $a).call($b).$flatten(); }, TMP_20.$$arity = 0), nil) && 'message_list'; })($scope.base, $scope.get('Array')); })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/input_filter"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$attr_accessor', '$options=', '$merge', '$default_options', '$class', '$has_key?', '$options', '$[]', '$!']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $InputFilter(){}; var self = $InputFilter = $klass($base, $super, 'InputFilter', $InputFilter); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8; Opal.defs(self, '$default_options', TMP_1 = function $$default_options() { var $a, self = this; if (self.default_options == null) self.default_options = nil; return ((($a = self.default_options) !== false && $a !== nil && $a != null) ? $a : self.default_options = $hash2([], {})); }, TMP_1.$$arity = 0); self.$attr_accessor("options"); Opal.defn(self, '$initialize', TMP_2 = function $$initialize(opts) { var $a, $b, $c, self = this; if (opts == null) { opts = $hash2([], {}); } return (($a = [(((($c = self.$class().$default_options()) !== false && $c !== nil && $c != null) ? $c : $hash2([], {}))).$merge(opts)]), $b = self, $b['$options='].apply($b, $a), $a[$a.length-1]); }, TMP_2.$$arity = -1); Opal.defn(self, '$filter', TMP_3 = function $$filter(data) { var self = this; return [data, nil]; }, TMP_3.$$arity = 1); Opal.defn(self, '$has_default?', TMP_4 = function() { var self = this; return self.$options()['$has_key?']("default"); }, TMP_4.$$arity = 0); Opal.defn(self, '$default', TMP_5 = function() { var self = this; return self.$options()['$[]']("default"); }, TMP_5.$$arity = 0); Opal.defn(self, '$discard_nils?', TMP_6 = function() { var self = this; return self.$options()['$[]']("nils")['$!'](); }, TMP_6.$$arity = 0); Opal.defn(self, '$discard_empty?', TMP_7 = function() { var self = this; return self.$options()['$[]']("discard_empty"); }, TMP_7.$$arity = 0); return (Opal.defn(self, '$discard_invalid?', TMP_8 = function() { var self = this; return self.$options()['$[]']("discard_invalid"); }, TMP_8.$$arity = 0), nil) && 'discard_invalid?'; })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/hash_filter"] = function(Opal) { function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$define_method', '$[]', '$[]=', '$to_sym', '$new', '$to_proc', '$attr_accessor', '$instance_eval', '$each_pair', '$optional_inputs', '$required_inputs', '$keys', '$nil?', '$options', '$is_a?', '$with_indifferent_access', '$each', '$==', '$has_key?', '$filter', '$!', '$discard_invalid?', '$delete', '$discard_empty?', '$discard_nils?', '$has_default?', '$default', '$-', '$any?']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $HashFilter(){}; var self = $HashFilter = $klass($base, $super, 'HashFilter', $HashFilter); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_3, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_17; def.required_inputs = def.optional_inputs = def.current_inputs = nil; Opal.defs(self, '$register_additional_filter', TMP_2 = function $$register_additional_filter(type_class, type_name) { var $a, $b, TMP_1, self = this; return ($a = ($b = self).$define_method, $a.$$p = (TMP_1 = function($c_rest){var self = TMP_1.$$s || this, block, args, $d, $e, name = nil, options = nil; if (self.current_inputs == null) self.current_inputs = nil; block = TMP_1.$$p || nil, TMP_1.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } name = args['$[]'](0); options = ((($d = args['$[]'](1)) !== false && $d !== nil && $d != null) ? $d : $hash2([], {})); return self.current_inputs['$[]='](name.$to_sym(), ($d = ($e = type_class).$new, $d.$$p = block.$to_proc(), $d).call($e, options));}, TMP_1.$$s = self, TMP_1.$$arity = -1, TMP_1), $a).call($b, type_name); }, TMP_2.$$arity = 2); self.default_options = $hash2(["nils"], {"nils": false}); self.$attr_accessor("optional_inputs"); self.$attr_accessor("required_inputs"); Opal.defn(self, '$initialize', TMP_3 = function $$initialize(opts) { var $a, $b, $c, self = this, $iter = TMP_3.$$p, block = $iter || nil; if (opts == null) { opts = $hash2([], {}); } TMP_3.$$p = null; ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_3, false)), $a.$$p = null, $a).call($b, opts); self.optional_inputs = $hash2([], {}); self.required_inputs = $hash2([], {}); self.current_inputs = self.required_inputs; if ((block !== nil)) { return ($a = ($c = self).$instance_eval, $a.$$p = block.$to_proc(), $a).call($c) } else { return nil }; }, TMP_3.$$arity = -1); Opal.defn(self, '$dup', TMP_6 = function $$dup() { var $a, $b, TMP_4, $c, TMP_5, self = this, dupped = nil; dupped = $scope.get('HashFilter').$new(); ($a = ($b = self.optional_inputs).$each_pair, $a.$$p = (TMP_4 = function(k, v){var self = TMP_4.$$s || this; if (k == null) k = nil;if (v == null) v = nil; return dupped.$optional_inputs()['$[]='](k, v)}, TMP_4.$$s = self, TMP_4.$$arity = 2, TMP_4), $a).call($b); ($a = ($c = self.required_inputs).$each_pair, $a.$$p = (TMP_5 = function(k, v){var self = TMP_5.$$s || this; if (k == null) k = nil;if (v == null) v = nil; return dupped.$required_inputs()['$[]='](k, v)}, TMP_5.$$s = self, TMP_5.$$arity = 2, TMP_5), $a).call($c); return dupped; }, TMP_6.$$arity = 0); Opal.defn(self, '$required', TMP_7 = function $$required() { var $a, $b, self = this, $iter = TMP_7.$$p, block = $iter || nil; TMP_7.$$p = null; self.current_inputs = self.required_inputs; return ($a = ($b = self).$instance_eval, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_7.$$arity = 0); Opal.defn(self, '$optional', TMP_8 = function $$optional() { var $a, $b, self = this, $iter = TMP_8.$$p, block = $iter || nil; TMP_8.$$p = null; self.current_inputs = self.optional_inputs; return ($a = ($b = self).$instance_eval, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_8.$$arity = 0); Opal.defn(self, '$required_keys', TMP_9 = function $$required_keys() { var self = this; return self.required_inputs.$keys(); }, TMP_9.$$arity = 0); Opal.defn(self, '$optional_keys', TMP_10 = function $$optional_keys() { var self = this; return self.optional_inputs.$keys(); }, TMP_10.$$arity = 0); Opal.defn(self, '$hash', TMP_11 = function $$hash(name, options) { var $a, $b, self = this, $iter = TMP_11.$$p, block = $iter || nil; if (options == null) { options = $hash2([], {}); } TMP_11.$$p = null; return self.current_inputs['$[]='](name.$to_sym(), ($a = ($b = $scope.get('HashFilter')).$new, $a.$$p = block.$to_proc(), $a).call($b, options)); }, TMP_11.$$arity = -2); Opal.defn(self, '$model', TMP_12 = function $$model(name, options) { var self = this; if (options == null) { options = $hash2([], {}); } return self.current_inputs['$[]='](name.$to_sym(), $scope.get('ModelFilter').$new(name.$to_sym(), options)); }, TMP_12.$$arity = -2); Opal.defn(self, '$array', TMP_13 = function $$array(name, options) { var $a, $b, self = this, $iter = TMP_13.$$p, block = $iter || nil, name_sym = nil; if (options == null) { options = $hash2([], {}); } TMP_13.$$p = null; name_sym = name.$to_sym(); return self.current_inputs['$[]='](name.$to_sym(), ($a = ($b = $scope.get('ArrayFilter')).$new, $a.$$p = block.$to_proc(), $a).call($b, name_sym, options)); }, TMP_13.$$arity = -2); return (Opal.defn(self, '$filter', TMP_17 = function $$filter(data) { var $a, $b, TMP_14, $c, TMP_16, self = this, errors = nil, filtered_data = nil, wildcard_filterer = nil, filtered_keys = nil; if ((($a = data['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$options()['$[]']("nils")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, nil]}; return [nil, "nils"];}; if ((($a = data['$is_a?']($scope.get('Hash'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return [data, "hash"] }; if ((($a = data['$is_a?']($scope.get('HashWithIndifferentAccess'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { data = data.$with_indifferent_access() }; errors = $scope.get('ErrorHash').$new(); filtered_data = $scope.get('HashWithIndifferentAccess').$new(); wildcard_filterer = nil; ($a = ($b = [[self.required_inputs, true], [self.optional_inputs, false]]).$each, $a.$$p = (TMP_14 = function($c){var self = TMP_14.$$s || this, $c_args, inputs, is_required, $d, $e, TMP_15; if ($c == null) { $c = nil; } $c = Opal.to_ary($c); $c_args = Opal.slice.call($c, 0, $c.length); inputs = $c_args.splice(0,1)[0]; if (inputs == null) { inputs = nil; } is_required = $c_args.splice(0,1)[0]; if (is_required == null) { is_required = nil; } return ($d = ($e = inputs).$each_pair, $d.$$p = (TMP_15 = function(key, filterer){var self = TMP_15.$$s || this, $c, $f, $g, data_element = nil, sub_data = nil, sub_error = nil; if (key == null) key = nil;if (filterer == null) filterer = nil; if (key['$==']("*")) { wildcard_filterer = filterer; return nil;;}; data_element = data['$[]'](key); if ((($c = data['$has_key?'](key)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { $f = filterer.$filter(data_element), $c = Opal.to_ary($f), sub_data = ($c[0] == null ? nil : $c[0]), sub_error = ($c[1] == null ? nil : $c[1]), $f; if ((($c = sub_error['$nil?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { filtered_data['$[]='](key, sub_data) } else if ((($c = ($f = is_required['$!'](), $f !== false && $f !== nil && $f != null ?filterer['$discard_invalid?']() : $f)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { data.$delete(key) } else if ((($c = ($f = ($g = is_required['$!'](), $g !== false && $g !== nil && $g != null ?sub_error['$==']("empty") : $g), $f !== false && $f !== nil && $f != null ?filterer['$discard_empty?']() : $f)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { data.$delete(key) } else if ((($c = ($f = ($g = is_required['$!'](), $g !== false && $g !== nil && $g != null ?sub_error['$==']("nils") : $g), $f !== false && $f !== nil && $f != null ?filterer['$discard_nils?']() : $f)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { data.$delete(key) } else { if ((($c = sub_error['$is_a?']($scope.get('Symbol'))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { sub_error = $scope.get('ErrorAtom').$new(key, sub_error)}; errors['$[]='](key, sub_error); };}; if ((($c = data['$has_key?'](key)['$!']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { if ((($c = filterer['$has_default?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return filtered_data['$[]='](key, filterer.$default()) } else if (is_required !== false && is_required !== nil && is_required != null) { return errors['$[]='](key, $scope.get('ErrorAtom').$new(key, "required")) } else { return nil } } else { return nil };}, TMP_15.$$s = self, TMP_15.$$arity = 2, TMP_15), $d).call($e)}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14.$$has_top_level_mlhs_arg = true, TMP_14), $a).call($b); if (wildcard_filterer !== false && wildcard_filterer !== nil && wildcard_filterer != null) { filtered_keys = $rb_minus(data.$keys(), filtered_data.$keys()); ($a = ($c = filtered_keys).$each, $a.$$p = (TMP_16 = function(key){var self = TMP_16.$$s || this, $d, $e, data_element = nil, sub_data = nil, sub_error = nil; if (key == null) key = nil; data_element = data['$[]'](key); $e = wildcard_filterer.$filter(data_element), $d = Opal.to_ary($e), sub_data = ($d[0] == null ? nil : $d[0]), sub_error = ($d[1] == null ? nil : $d[1]), $e; if ((($d = sub_error['$nil?']()) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return filtered_data['$[]='](key, sub_data) } else if ((($d = wildcard_filterer['$discard_invalid?']()) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return data.$delete(key) } else if ((($d = (($e = sub_error['$==']("empty")) ? wildcard_filterer['$discard_empty?']() : sub_error['$==']("empty"))) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return data.$delete(key) } else if ((($d = (($e = sub_error['$==']("nils")) ? wildcard_filterer['$discard_nils?']() : sub_error['$==']("nils"))) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return data.$delete(key) } else { if ((($d = sub_error['$is_a?']($scope.get('Symbol'))) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { sub_error = $scope.get('ErrorAtom').$new(key, sub_error)}; return errors['$[]='](key, sub_error); };}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16), $a).call($c);}; if ((($a = errors['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, errors] } else { return [filtered_data, nil] }; }, TMP_17.$$arity = 1), nil) && 'filter'; })($scope.base, $scope.get('InputFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/array_filter"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$define_method', '$[]', '$new', '$to_proc', '$instance_eval', '$options', '$raise', '$to_sym', '$nil?', '$!', '$is_a?', '$==', '$Array', '$each_with_index', '$filter_element', '$<<', '$discard_invalid?', '$filter', '$constantize']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ArrayFilter(){}; var self = $ArrayFilter = $klass($base, $super, 'ArrayFilter', $ArrayFilter); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_8, TMP_9; def.element_filter = nil; Opal.defs(self, '$register_additional_filter', TMP_2 = function $$register_additional_filter(type_class, type_name) { var $a, $b, TMP_1, self = this; return ($a = ($b = self).$define_method, $a.$$p = (TMP_1 = function($c_rest){var self = TMP_1.$$s || this, block, args, $d, $e, options = nil; block = TMP_1.$$p || nil, TMP_1.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } options = ((($d = args['$[]'](0)) !== false && $d !== nil && $d != null) ? $d : $hash2([], {})); return self.element_filter = ($d = ($e = type_class).$new, $d.$$p = block.$to_proc(), $d).call($e, options);}, TMP_1.$$s = self, TMP_1.$$arity = -1, TMP_1), $a).call($b, type_name); }, TMP_2.$$arity = 2); self.default_options = $hash2(["nils", "class", "arrayize"], {"nils": false, "class": nil, "arrayize": false}); Opal.defn(self, '$initialize', TMP_3 = function $$initialize(name, opts) { var $a, $b, $c, $d, self = this, $iter = TMP_3.$$p, block = $iter || nil; if (opts == null) { opts = $hash2([], {}); } TMP_3.$$p = null; ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_3, false)), $a.$$p = null, $a).call($b, opts); self.name = name; self.element_filter = nil; if ((block !== nil)) { ($a = ($c = self).$instance_eval, $a.$$p = block.$to_proc(), $a).call($c)}; if ((($a = ($d = self.element_filter, $d !== false && $d !== nil && $d != null ?self.$options()['$[]']("class") : $d)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise($scope.get('ArgumentError').$new("Can't supply both a class and a filter")) } else { return nil }; }, TMP_3.$$arity = -2); Opal.defn(self, '$hash', TMP_4 = function $$hash(options) { var $a, $b, self = this, $iter = TMP_4.$$p, block = $iter || nil; if (options == null) { options = $hash2([], {}); } TMP_4.$$p = null; return self.element_filter = ($a = ($b = $scope.get('HashFilter')).$new, $a.$$p = block.$to_proc(), $a).call($b, options); }, TMP_4.$$arity = -1); Opal.defn(self, '$model', TMP_5 = function $$model(name, options) { var self = this; if (options == null) { options = $hash2([], {}); } return self.element_filter = $scope.get('ModelFilter').$new(name.$to_sym(), options); }, TMP_5.$$arity = -2); Opal.defn(self, '$array', TMP_6 = function $$array(options) { var $a, $b, self = this, $iter = TMP_6.$$p, block = $iter || nil; if (options == null) { options = $hash2([], {}); } TMP_6.$$p = null; return self.element_filter = ($a = ($b = $scope.get('ArrayFilter')).$new, $a.$$p = block.$to_proc(), $a).call($b, nil, options); }, TMP_6.$$arity = -1); Opal.defn(self, '$filter', TMP_8 = function $$filter(data) { var $a, $b, TMP_7, $c, $d, self = this, errors = nil, filtered_data = nil, found_error = nil; if ((($a = data['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$options()['$[]']("nils")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, nil]}; return [nil, "nils"];}; if ((($a = ($b = data['$is_a?']($scope.get('Array'))['$!'](), $b !== false && $b !== nil && $b != null ?self.$options()['$[]']("arrayize") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if (data['$==']("")) { return [[], nil]}; data = self.$Array(data);}; if ((($a = data['$is_a?']($scope.get('Array'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { errors = $scope.get('ErrorArray').$new(); filtered_data = []; found_error = false; ($a = ($b = data).$each_with_index, $a.$$p = (TMP_7 = function(el, i){var self = TMP_7.$$s || this, $c, $d, el_filtered = nil, el_error = nil; if (self.name == null) self.name = nil; if (el == null) el = nil;if (i == null) i = nil; $d = self.$filter_element(el), $c = Opal.to_ary($d), el_filtered = ($c[0] == null ? nil : $c[0]), el_error = ($c[1] == null ? nil : $c[1]), $d; if ((($c = el_error['$is_a?']($scope.get('Symbol'))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { el_error = $scope.get('ErrorAtom').$new(self.name, el_error, $hash2(["index"], {"index": i}))}; errors['$<<'](el_error); if (el_error !== false && el_error !== nil && el_error != null) { return found_error = true } else { return filtered_data['$<<'](el_filtered) };}, TMP_7.$$s = self, TMP_7.$$arity = 2, TMP_7), $a).call($b); if ((($a = (($c = found_error !== false && found_error !== nil && found_error != null) ? (($d = self.element_filter, $d !== false && $d !== nil && $d != null ?self.element_filter['$discard_invalid?']() : $d))['$!']() : found_error)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, errors] } else { return [filtered_data, nil] }; } else { return [data, "array"] }; }, TMP_8.$$arity = 1); return (Opal.defn(self, '$filter_element', TMP_9 = function $$filter_element(data) { var $a, $b, self = this, el_errors = nil, class_const = nil; if ((($a = self.element_filter) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { $b = self.element_filter.$filter(data), $a = Opal.to_ary($b), data = ($a[0] == null ? nil : $a[0]), el_errors = ($a[1] == null ? nil : $a[1]), $b; if (el_errors !== false && el_errors !== nil && el_errors != null) { return [data, el_errors]}; } else if ((($a = self.$options()['$[]']("class")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { class_const = self.$options()['$[]']("class"); if ((($a = class_const['$is_a?']($scope.get('String'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { class_const = class_const.$constantize()}; if ((($a = data['$is_a?'](class_const)['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "class"]};}; return [data, nil]; }, TMP_9.$$arity = 1), nil) && 'filter_element'; })($scope.base, $scope.get('InputFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/additional_filter"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$underscore', '$[]', '$name', '$register_additional_filter']); self.$require("mutations/hash_filter"); self.$require("mutations/array_filter"); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $AdditionalFilter(){}; var self = $AdditionalFilter = $klass($base, $super, 'AdditionalFilter', $AdditionalFilter); var def = self.$$proto, $scope = self.$$scope, TMP_1; return (Opal.defs(self, '$inherited', TMP_1 = function $$inherited(subclass) { var self = this, type_name = nil; type_name = subclass.$name()['$[]'](/^Mutations::([a-zA-Z]*)Filter$/, 1).$underscore(); (($scope.get('Mutations')).$$scope.get('HashFilter')).$register_additional_filter(subclass, type_name); return (($scope.get('Mutations')).$$scope.get('ArrayFilter')).$register_additional_filter(subclass, type_name); }, TMP_1.$$arity = 1), nil) && 'inherited' })($scope.base, $scope.get('InputFilter')) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/string_filter"] = function(Opal) { function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$nil?', '$[]', '$options', '$!', '$any?', '$is_a?', '$to_s', '$gsub', '$strip', '$==', '$<', '$length', '$>', '$include?', '$!~']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $StringFilter(){}; var self = $StringFilter = $klass($base, $super, 'StringFilter', $StringFilter); var def = self.$$proto, $scope = self.$$scope, TMP_2; self.default_options = $hash2(["strip", "strict", "nils", "empty", "min_length", "max_length", "matches", "in", "discard_empty", "allow_control_characters"], {"strip": true, "strict": false, "nils": false, "empty": false, "min_length": nil, "max_length": nil, "matches": nil, "in": nil, "discard_empty": false, "allow_control_characters": false}); return (Opal.defn(self, '$filter', TMP_2 = function $$filter(data) { var $a, $b, $c, $d, TMP_1, self = this; if ((($a = data['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$options()['$[]']("nils")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, nil]}; return [nil, "nils"];}; if ((($a = ($b = self.$options()['$[]']("strict")['$!'](), $b !== false && $b !== nil && $b != null ?($c = ($d = [$scope.get('TrueClass'), $scope.get('FalseClass'), $scope.get('Integer'), $scope.get('Float'), $scope.get('BigDecimal'), $scope.get('Symbol')])['$any?'], $c.$$p = (TMP_1 = function(klass){var self = TMP_1.$$s || this; if (klass == null) klass = nil; return data['$is_a?'](klass)}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $c).call($d) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = data.$to_s()}; if ((($a = data['$is_a?']($scope.get('String'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return [data, "string"] }; if ((($a = self.$options()['$[]']("allow_control_characters")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { data = data.$gsub(/[^[:print:]\t\r\n]+/, " ") }; if ((($a = self.$options()['$[]']("strip")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = data.$strip()}; if (data['$==']("")) { if ((($a = self.$options()['$[]']("empty")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, nil] } else { return [data, "empty"] }}; if ((($a = ($b = self.$options()['$[]']("min_length"), $b !== false && $b !== nil && $b != null ?$rb_lt(data.$length(), self.$options()['$[]']("min_length")) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "min_length"]}; if ((($a = ($b = self.$options()['$[]']("max_length"), $b !== false && $b !== nil && $b != null ?$rb_gt(data.$length(), self.$options()['$[]']("max_length")) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "max_length"]}; if ((($a = ($b = self.$options()['$[]']("in"), $b !== false && $b !== nil && $b != null ?self.$options()['$[]']("in")['$include?'](data)['$!']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "in"]}; if ((($a = ($b = self.$options()['$[]']("matches"), $b !== false && $b !== nil && $b != null ?(self.$options()['$[]']("matches")['$!~'](data)) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "matches"]}; return [data, nil]; }, TMP_2.$$arity = 1), nil) && 'filter'; })($scope.base, $scope.get('AdditionalFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/integer_filter"] = function(Opal) { function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$[]', '$options', '$==', '$nil?', '$!', '$is_a?', '$=~', '$to_i', '$<', '$>', '$include?']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $IntegerFilter(){}; var self = $IntegerFilter = $klass($base, $super, 'IntegerFilter', $IntegerFilter); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.default_options = $hash2(["nils", "empty_is_nil", "min", "max", "in"], {"nils": false, "empty_is_nil": false, "min": nil, "max": nil, "in": nil}); return (Opal.defn(self, '$filter', TMP_1 = function $$filter(data) { var $a, $b, self = this; if ((($a = ($b = self.$options()['$[]']("empty_is_nil"), $b !== false && $b !== nil && $b != null ?data['$==']("") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = nil}; if ((($a = data['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$options()['$[]']("nils")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, nil]}; return [nil, "nils"];}; if (data['$==']("")) { return [data, "empty"]}; if ((($a = data['$is_a?']($scope.get('Integer'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = ($b = data['$is_a?']($scope.get('String')), $b !== false && $b !== nil && $b != null ?data['$=~'](/^-?\d/) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = data.$to_i() } else { return [data, "integer"] }}; if ((($a = ($b = self.$options()['$[]']("min"), $b !== false && $b !== nil && $b != null ?$rb_lt(data, self.$options()['$[]']("min")) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "min"]}; if ((($a = ($b = self.$options()['$[]']("max"), $b !== false && $b !== nil && $b != null ?$rb_gt(data, self.$options()['$[]']("max")) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "max"]}; if ((($a = ($b = self.$options()['$[]']("in"), $b !== false && $b !== nil && $b != null ?self.$options()['$[]']("in")['$include?'](data)['$!']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "in"]}; return [data, nil]; }, TMP_1.$$arity = 1), nil) && 'filter'; })($scope.base, $scope.get('AdditionalFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/float_filter"] = function(Opal) { function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$nil?', '$[]', '$options', '$==', '$!', '$is_a?', '$=~', '$to_f', '$<', '$>']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $FloatFilter(){}; var self = $FloatFilter = $klass($base, $super, 'FloatFilter', $FloatFilter); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.default_options = $hash2(["nils", "min", "max"], {"nils": false, "min": nil, "max": nil}); return (Opal.defn(self, '$filter', TMP_1 = function $$filter(data) { var $a, $b, self = this; if ((($a = data['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$options()['$[]']("nils")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, nil]}; return [nil, "nils"];}; if (data['$==']("")) { return [data, "empty"]}; if ((($a = data['$is_a?']($scope.get('Float'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = ($b = data['$is_a?']($scope.get('String')), $b !== false && $b !== nil && $b != null ?data['$=~'](/^[-+]?\d*\.?\d+/) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = data.$to_f() } else if ((($a = data['$is_a?']($scope.get('Integer'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = data.$to_f() } else { return [data, "float"] }}; if ((($a = ($b = self.$options()['$[]']("min"), $b !== false && $b !== nil && $b != null ?$rb_lt(data, self.$options()['$[]']("min")) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "min"]}; if ((($a = ($b = self.$options()['$[]']("max"), $b !== false && $b !== nil && $b != null ?$rb_gt(data, self.$options()['$[]']("max")) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "max"]}; return [data, nil]; }, TMP_1.$$arity = 1), nil) && 'filter'; })($scope.base, $scope.get('AdditionalFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/boolean_filter"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$nil?', '$[]', '$options', '$==', '$is_a?', '$to_s', '$downcase']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $BooleanFilter(){}; var self = $BooleanFilter = $klass($base, $super, 'BooleanFilter', $BooleanFilter); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.default_options = $hash2(["nils"], {"nils": false}); Opal.cdecl($scope, 'BOOL_MAP', $hash2(["true", "1", "false", "0"], {"true": true, "1": true, "false": false, "0": false})); return (Opal.defn(self, '$filter', TMP_1 = function $$filter(data) { var $a, $b, self = this, res = nil; if ((($a = data['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$options()['$[]']("nils")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, nil]}; return [nil, "nils"];}; if (data['$==']("")) { return [data, "empty"]}; if ((($a = ((($b = data['$=='](true)) !== false && $b !== nil && $b != null) ? $b : data['$=='](false))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, nil]}; if ((($a = data['$is_a?']($scope.get('Integer'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = data.$to_s()}; if ((($a = data['$is_a?']($scope.get('String'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { res = $scope.get('BOOL_MAP')['$[]'](data.$downcase()); if ((($a = res['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return [res, nil] }; return [data, "boolean"]; } else { return [data, "boolean"] }; }, TMP_1.$$arity = 1), nil) && 'filter'; })($scope.base, $scope.get('AdditionalFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/duck_filter"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$nil?', '$[]', '$options', '$each', '$respond_to?', '$Array']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $DuckFilter(){}; var self = $DuckFilter = $klass($base, $super, 'DuckFilter', $DuckFilter); var def = self.$$proto, $scope = self.$$scope, TMP_2; self.default_options = $hash2(["nils", "methods"], {"nils": false, "methods": nil}); return (Opal.defn(self, '$filter', TMP_2 = function $$filter(data) {try { var $a, $b, TMP_1, self = this; if ((($a = data['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$options()['$[]']("nils")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, nil]}; return [nil, "nils"];}; ($a = ($b = self.$Array(self.$options()['$[]']("methods"))).$each, $a.$$p = (TMP_1 = function(method){var self = TMP_1.$$s || this, $c; if (method == null) method = nil; if ((($c = data['$respond_to?'](method)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return nil } else { Opal.ret([data, "duck"]) }}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); return [data, nil]; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_2.$$arity = 1), nil) && 'filter'; })($scope.base, $scope.get('AdditionalFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/date_filter"] = function(Opal) { function $rb_le(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); } function $rb_ge(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$nil?', '$[]', '$options', '$==', '$is_a?', '$strptime', '$parse', '$respond_to?', '$to_date', '$<=', '$>=']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $DateFilter(){}; var self = $DateFilter = $klass($base, $super, 'DateFilter', $DateFilter); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.default_options = $hash2(["nils", "format", "after", "before"], {"nils": false, "format": nil, "after": nil, "before": nil}); return (Opal.defn(self, '$filter', TMP_1 = function $$filter(data) { var $a, self = this, actual_date = nil; if ((($a = data['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$options()['$[]']("nils")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, nil]}; return [nil, "nils"];}; if (""['$=='](data)) { return [data, "empty"]}; if ((($a = data['$is_a?']($scope.get('Date'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { actual_date = data } else if ((($a = data['$is_a?']($scope.get('String'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { try { actual_date = (function() {if ((($a = self.$options()['$[]']("format")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('Date').$strptime(data, self.$options()['$[]']("format")) } else { return $scope.get('Date').$parse(data) }; return nil; })() } catch ($err) { if (Opal.rescue($err, [$scope.get('ArgumentError')])) { try { return [nil, "date"] } finally { Opal.pop_exception() } } else { throw $err; } } } else if ((($a = data['$respond_to?']("to_date")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { actual_date = data.$to_date() } else { return [nil, "date"] }; if ((($a = self.$options()['$[]']("after")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $rb_le(actual_date, self.$options()['$[]']("after"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, "after"]}}; if ((($a = self.$options()['$[]']("before")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $rb_ge(actual_date, self.$options()['$[]']("before"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, "before"]}}; return [actual_date, nil]; }, TMP_1.$$arity = 1), nil) && 'filter'; })($scope.base, $scope.get('AdditionalFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/time_filter"] = function(Opal) { function $rb_le(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); } function $rb_ge(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$nil?', '$[]', '$options', '$==', '$is_a?', '$strptime', '$parse', '$respond_to?', '$to_time', '$<=', '$>=']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $TimeFilter(){}; var self = $TimeFilter = $klass($base, $super, 'TimeFilter', $TimeFilter); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.default_options = $hash2(["nils", "format", "after", "before"], {"nils": false, "format": nil, "after": nil, "before": nil}); return (Opal.defn(self, '$filter', TMP_1 = function $$filter(data) { var $a, self = this, actual_time = nil; if ((($a = data['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$options()['$[]']("nils")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, nil]}; return [nil, "nils"];}; if (""['$=='](data)) { return [data, "empty"]}; if ((($a = data['$is_a?']($scope.get('Time'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { actual_time = data } else if ((($a = data['$is_a?']($scope.get('String'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { try { actual_time = (function() {if ((($a = self.$options()['$[]']("format")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('Time').$strptime(data, self.$options()['$[]']("format")) } else { return $scope.get('Time').$parse(data) }; return nil; })() } catch ($err) { if (Opal.rescue($err, [$scope.get('ArgumentError')])) { try { return [nil, "time"] } finally { Opal.pop_exception() } } else { throw $err; } } } else if ((($a = data['$respond_to?']("to_time")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { actual_time = data.$to_time() } else { return [nil, "time"] }; if ((($a = self.$options()['$[]']("after")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $rb_le(actual_time, self.$options()['$[]']("after"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, "after"]}}; if ((($a = self.$options()['$[]']("before")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $rb_ge(actual_time, self.$options()['$[]']("before"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, "before"]}}; return [actual_time, nil]; }, TMP_1.$$arity = 1), nil) && 'filter'; })($scope.base, $scope.get('AdditionalFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/file_filter"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$nil?', '$[]', '$options', '$==', '$concat', '$each', '$respond_to?', '$is_a?', '$>', '$size']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $FileFilter(){}; var self = $FileFilter = $klass($base, $super, 'FileFilter', $FileFilter); var def = self.$$proto, $scope = self.$$scope, TMP_2; self.default_options = $hash2(["nils", "upload", "size"], {"nils": false, "upload": false, "size": nil}); return (Opal.defn(self, '$filter', TMP_2 = function $$filter(data) {try { var $a, $b, TMP_1, self = this, methods = nil; if ((($a = data['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$options()['$[]']("nils")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, nil]}; return [nil, "nils"];}; if (data['$==']("")) { return [data, "empty"]}; methods = ["read", "size"]; if ((($a = self.$options()['$[]']("upload")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { methods.$concat(["original_filename", "content_type"])}; ($a = ($b = methods).$each, $a.$$p = (TMP_1 = function(method){var self = TMP_1.$$s || this, $c; if (method == null) method = nil; if ((($c = data['$respond_to?'](method)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return nil } else { Opal.ret([data, "file"]) }}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); if ((($a = self.$options()['$[]']("size")['$is_a?']($scope.get('Integer'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $rb_gt(data.$size(), self.$options()['$[]']("size"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "size"]}}; return [data, nil]; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_2.$$arity = 1), nil) && 'filter'; })($scope.base, $scope.get('AdditionalFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/model_filter"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$[]', '$options', '$camelize', '$to_s', '$is_a?', '$constantize', '$[]=', '$cache_constants?', '$initialize_constants!', '$nil?', '$run', '$success?', '$result', '$errors', '$!', '$respond_to?', '$new_record?']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ModelFilter(){}; var self = $ModelFilter = $klass($base, $super, 'ModelFilter', $ModelFilter); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3; def.initialize_constants = def.name = nil; self.default_options = $hash2(["nils", "class", "builder", "new_records"], {"nils": false, "class": nil, "builder": nil, "new_records": false}); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(name, opts) { var $a, $b, self = this, $iter = TMP_1.$$p, $yield = $iter || nil; if (opts == null) { opts = $hash2([], {}); } TMP_1.$$p = null; ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_1, false)), $a.$$p = null, $a).call($b, opts); return self.name = name; }, TMP_1.$$arity = -2); Opal.defn(self, '$initialize_constants!', TMP_2 = function() { var $a, $b, self = this, class_const = nil; ((($a = self.initialize_constants) !== false && $a !== nil && $a != null) ? $a : self.initialize_constants = (function() {class_const = ((($b = self.$options()['$[]']("class")) !== false && $b !== nil && $b != null) ? $b : self.name.$to_s().$camelize()); if ((($b = class_const['$is_a?']($scope.get('String'))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { class_const = class_const.$constantize()}; self.$options()['$[]=']("class", class_const); if ((($b = self.$options()['$[]']("builder")) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.$options()['$[]']("builder")['$is_a?']($scope.get('String'))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$options()['$[]=']("builder", self.$options()['$[]']("builder").$constantize())}}; return true;})()); if ((($a = $scope.get('Mutations')['$cache_constants?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { if ((($a = self.$options()['$[]']("class")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$options()['$[]=']("class", self.$options()['$[]']("class").$to_s().$constantize())}; if ((($a = self.$options()['$[]']("builder")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$options()['$[]=']("builder", self.$options()['$[]']("builder").$to_s().$constantize()) } else { return nil }; }; }, TMP_2.$$arity = 0); return (Opal.defn(self, '$filter', TMP_3 = function $$filter(data) { var $a, $b, $c, self = this, ret = nil; self['$initialize_constants!'](); if ((($a = data['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self.$options()['$[]']("nils")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [nil, nil]}; return [nil, "nils"];}; if ((($a = ($b = data['$is_a?']($scope.get('Hash')), $b !== false && $b !== nil && $b != null ?self.$options()['$[]']("builder") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { ret = self.$options()['$[]']("builder").$run(data); if ((($a = ret['$success?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { data = ret.$result() } else { return [data, ret.$errors()] };}; if ((($a = data['$is_a?'](self.$options()['$[]']("class"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = ($b = self.$options()['$[]']("new_records")['$!'](), $b !== false && $b !== nil && $b != null ?(($c = data['$respond_to?']("new_record?"), $c !== false && $c !== nil && $c != null ?data['$new_record?']() : $c)) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [data, "new_records"]}; return [data, nil];}; return [data, "model"]; }, TMP_3.$$arity = 1), nil) && 'filter'; })($scope.base, $scope.get('InputFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/outcome"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$attr_reader']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Outcome(){}; var self = $Outcome = $klass($base, $super, 'Outcome', $Outcome); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2; def.success = nil; self.$attr_reader("result", "errors", "inputs"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(is_success, result, errors, inputs) { var $a, self = this; return $a = [is_success, result, errors, inputs], self.success = $a[0], self.result = $a[1], self.errors = $a[2], self.inputs = $a[3], $a; }, TMP_1.$$arity = 4); return (Opal.defn(self, '$success?', TMP_2 = function() { var self = this; return self.success; }, TMP_2.$$arity = 0), nil) && 'success?'; })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations/command"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$send', '$to_proc', '$input_filters', '$each', '$define_method', '$[]', '$has_key?', '$[]=', '$private', '$create_attr_methods', '$run', '$new', '$run!', '$validation_outcome', '$==', '$superclass', '$dup', '$inject', '$is_a?', '$raise', '$merge!', '$with_indifferent_access', '$filter', '$has_errors?', '$validate', '$class', '$!', '$nil?', '$execute', '$success?', '$result', '$errors', '$protected', '$attr_reader', '$tap', '$split', '$to_s', '$pop', '$to_sym', '$any?']); return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Command(){}; var self = $Command = $klass($base, $super, 'Command', $Command); var def = self.$$proto, $scope = self.$$scope, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_23, TMP_24; def.raw_inputs = def.errors = def.inputs = nil; (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_1, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11; Opal.defn(self, '$create_attr_methods', TMP_1 = function $$create_attr_methods(meth) { var $a, $b, $c, TMP_2, self = this, $iter = TMP_1.$$p, block = $iter || nil, keys = nil; TMP_1.$$p = null; ($a = ($b = self.$input_filters()).$send, $a.$$p = block.$to_proc(), $a).call($b, meth); keys = self.$input_filters().$send("" + (meth) + "_keys"); return ($a = ($c = keys).$each, $a.$$p = (TMP_2 = function(key){var self = TMP_2.$$s || this, $d, $e, TMP_3, $f, TMP_4, $g, TMP_5; if (key == null) key = nil; ($d = ($e = self).$define_method, $d.$$p = (TMP_3 = function(){var self = TMP_3.$$s || this; if (self.inputs == null) self.inputs = nil; return self.inputs['$[]'](key)}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3), $d).call($e, key); ($d = ($f = self).$define_method, $d.$$p = (TMP_4 = function(){var self = TMP_4.$$s || this; if (self.inputs == null) self.inputs = nil; return self.inputs['$has_key?'](key)}, TMP_4.$$s = self, TMP_4.$$arity = 0, TMP_4), $d).call($f, "" + (key) + "_present?"); return ($d = ($g = self).$define_method, $d.$$p = (TMP_5 = function(v){var self = TMP_5.$$s || this; if (self.inputs == null) self.inputs = nil; if (v == null) v = nil; return self.inputs['$[]='](key, v)}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $d).call($g, "" + (key) + "=");}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($c); }, TMP_1.$$arity = 1); self.$private("create_attr_methods"); Opal.defn(self, '$required', TMP_6 = function $$required() { var $a, $b, self = this, $iter = TMP_6.$$p, block = $iter || nil; TMP_6.$$p = null; return ($a = ($b = self).$create_attr_methods, $a.$$p = block.$to_proc(), $a).call($b, "required"); }, TMP_6.$$arity = 0); Opal.defn(self, '$optional', TMP_7 = function $$optional() { var $a, $b, self = this, $iter = TMP_7.$$p, block = $iter || nil; TMP_7.$$p = null; return ($a = ($b = self).$create_attr_methods, $a.$$p = block.$to_proc(), $a).call($b, "optional"); }, TMP_7.$$arity = 0); Opal.defn(self, '$run', TMP_8 = function $$run($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = self).$new.apply($b, Opal.to_a(args)).$run(); }, TMP_8.$$arity = -1); Opal.defn(self, '$run!', TMP_9 = function($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = self).$new.apply($b, Opal.to_a(args))['$run!'](); }, TMP_9.$$arity = -1); Opal.defn(self, '$validate', TMP_10 = function $$validate($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = self).$new.apply($b, Opal.to_a(args)).$validation_outcome(); }, TMP_10.$$arity = -1); return (Opal.defn(self, '$input_filters', TMP_11 = function $$input_filters() { var $a, self = this; if (self.input_filters == null) self.input_filters = nil; return ((($a = self.input_filters) !== false && $a !== nil && $a != null) ? $a : self.input_filters = (function() {if ($scope.get('Command')['$=='](self.$superclass())) { return $scope.get('HashFilter').$new() } else { return self.$superclass().$input_filters().$dup() }; return nil; })()); }, TMP_11.$$arity = 0), nil) && 'input_filters'; })(Opal.get_singleton_class(self)); Opal.defn(self, '$initialize', TMP_13 = function $$initialize($a_rest) { var $b, $c, TMP_12, $d, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } self.raw_inputs = ($b = ($c = args).$inject, $b.$$p = (TMP_12 = function(h, arg){var self = TMP_12.$$s || this, $a; if (h == null) h = nil;if (arg == null) arg = nil; if ((($a = arg['$is_a?']($scope.get('Hash'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError').$new("All arguments must be hashes")) }; return h['$merge!'](arg);}, TMP_12.$$s = self, TMP_12.$$arity = 2, TMP_12), $b).call($c, $hash2([], {}).$with_indifferent_access()); $d = self.$input_filters().$filter(self.raw_inputs), $b = Opal.to_ary($d), self.inputs = ($b[0] == null ? nil : $b[0]), self.errors = ($b[1] == null ? nil : $b[1]), $d; if ((($b = self['$has_errors?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return nil } else { return self.$validate() }; }, TMP_13.$$arity = -1); Opal.defn(self, '$input_filters', TMP_14 = function $$input_filters() { var self = this; return self.$class().$input_filters(); }, TMP_14.$$arity = 0); Opal.defn(self, '$has_errors?', TMP_15 = function() { var self = this; return self.errors['$nil?']()['$!'](); }, TMP_15.$$arity = 0); Opal.defn(self, '$run', TMP_16 = function $$run() { var $a, self = this; if ((($a = self['$has_errors?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$validation_outcome()}; return self.$validation_outcome(self.$execute()); }, TMP_16.$$arity = 0); Opal.defn(self, '$run!', TMP_17 = function() { var $a, self = this, outcome = nil; outcome = self.$run(); if ((($a = outcome['$success?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return outcome.$result() } else { return self.$raise($scope.get('ValidationException').$new(outcome.$errors())) }; }, TMP_17.$$arity = 0); Opal.defn(self, '$validation_outcome', TMP_18 = function $$validation_outcome(result) { var $a, self = this; if (result == null) { result = nil; } return $scope.get('Outcome').$new(self['$has_errors?']()['$!'](), (function() {if ((($a = self['$has_errors?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return result }; return nil; })(), self.errors, self.inputs); }, TMP_18.$$arity = -1); self.$protected(); self.$attr_reader("inputs", "raw_inputs"); Opal.defn(self, '$validate', TMP_19 = function $$validate() { var self = this; return nil; }, TMP_19.$$arity = 0); Opal.defn(self, '$execute', TMP_20 = function $$execute() { var self = this; return nil; }, TMP_20.$$arity = 0); Opal.defn(self, '$add_error', TMP_23 = function $$add_error(key, kind, message) { var $a, $b, TMP_21, self = this; if (message == null) { message = nil; } if ((($a = kind['$is_a?']($scope.get('Symbol'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError').$new("Invalid kind")) }; ((($a = self.errors) !== false && $a !== nil && $a != null) ? $a : self.errors = $scope.get('ErrorHash').$new()); return ($a = ($b = self.errors).$tap, $a.$$p = (TMP_21 = function(errs){var self = TMP_21.$$s || this, $c, $d, TMP_22, path = nil, last = nil, inner = nil; if (errs == null) errs = nil; path = key.$to_s().$split("."); last = path.$pop(); inner = ($c = ($d = path).$inject, $c.$$p = (TMP_22 = function(cur_errors, part){var self = TMP_22.$$s || this, $e, $f, $g; if (cur_errors == null) cur_errors = nil;if (part == null) part = nil; return ($e = part.$to_sym(), $f = cur_errors, ((($g = $f['$[]']($e)) !== false && $g !== nil && $g != null) ? $g : $f['$[]=']($e, $scope.get('ErrorHash').$new())))}, TMP_22.$$s = self, TMP_22.$$arity = 2, TMP_22), $c).call($d, errs); return inner['$[]='](last, $scope.get('ErrorAtom').$new(key, kind, $hash2(["message"], {"message": message})));}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21), $a).call($b); }, TMP_23.$$arity = -3); return (Opal.defn(self, '$merge_errors', TMP_24 = function $$merge_errors(hash) { var $a, self = this; if ((($a = hash['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { ((($a = self.errors) !== false && $a !== nil && $a != null) ? $a : self.errors = $scope.get('ErrorHash').$new()); return self.errors['$merge!'](hash); } else { return nil }; }, TMP_24.$$arity = 1), nil) && 'merge_errors'; })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["mutations"] = function(Opal) { var $a, $b, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$require', '$new', '$cache_constants=']); self.$require("active_support/core_ext/hash/indifferent_access"); self.$require("active_support/core_ext/string/inflections"); self.$require("date"); self.$require("time"); self.$require("bigdecimal"); self.$require("mutations/version"); self.$require("mutations/exception"); self.$require("mutations/errors"); self.$require("mutations/input_filter"); self.$require("mutations/additional_filter"); self.$require("mutations/string_filter"); self.$require("mutations/integer_filter"); self.$require("mutations/float_filter"); self.$require("mutations/boolean_filter"); self.$require("mutations/duck_filter"); self.$require("mutations/date_filter"); self.$require("mutations/time_filter"); self.$require("mutations/file_filter"); self.$require("mutations/model_filter"); self.$require("mutations/array_filter"); self.$require("mutations/hash_filter"); self.$require("mutations/outcome"); self.$require("mutations/command"); (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_1, TMP_2, TMP_3, TMP_4; Opal.defn(self, '$error_message_creator', TMP_1 = function $$error_message_creator() { var $a, self = this; if (self.error_message_creator == null) self.error_message_creator = nil; return ((($a = self.error_message_creator) !== false && $a !== nil && $a != null) ? $a : self.error_message_creator = $scope.get('DefaultErrorMessageCreator').$new()); }, TMP_1.$$arity = 0); Opal.defn(self, '$error_message_creator=', TMP_2 = function(creator) { var self = this; return self.error_message_creator = creator; }, TMP_2.$$arity = 1); Opal.defn(self, '$cache_constants=', TMP_3 = function(val) { var self = this; return self.cache_constants = val; }, TMP_3.$$arity = 1); return (Opal.defn(self, '$cache_constants?', TMP_4 = function() { var self = this; if (self.cache_constants == null) self.cache_constants = nil; return self.cache_constants; }, TMP_4.$$arity = 0), nil) && 'cache_constants?'; })(Opal.get_singleton_class(self)) })($scope.base); return (($a = [true]), $b = $scope.get('Mutations'), $b['$cache_constants='].apply($b, $a), $a[$a.length-1]); }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/filters/outbound_filter"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; return (function($base) { var $Mutations, self = $Mutations = $module($base, 'Mutations'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $OutboundFilter(){}; var self = $OutboundFilter = $klass($base, $super, 'OutboundFilter', $OutboundFilter); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.default_options = $hash2([], {}); return (Opal.defn(self, '$filter', TMP_1 = function $$filter(data) { var self = this; return [data, "outbound"]; }, TMP_1.$$arity = 1), nil) && 'filter'; })($scope.base, $scope.get('AdditionalFilter')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/call_by_class_name"] = function(Opal) { function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$private', '$lookup_const', '$<', '$!', '$method_defined?', '$raise', '$=~', '$reverse', '$inject', '$+', '$const_get', '$last', '$split', '$to_s', '$name', '$detect', '$is_a?', '$_hyper_operation_original_method_missing', '$to_proc', '$send', '$class']); (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Operation(){}; var self = $Operation = $klass($base, $super, 'Operation', $Operation); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, null) })($scope.base); (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Component, self = $Component = $module($base, 'Component'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Tags, self = $Tags = $module($base, 'Tags'); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.$private(); Opal.defn(self, '$find_component', TMP_1 = function $$find_component(name) { var $a, $b, self = this, component = nil; component = self.$lookup_const(name); if ((($a = (($b = component !== false && component !== nil && component != null) ? $rb_lt(component, (($scope.get('Hyperloop')).$$scope.get('Operation'))) : component)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; if ((($a = (($b = component !== false && component !== nil && component != null) ? component['$method_defined?']("render")['$!']() : component)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise("" + (name) + " does not appear to be a react component.")}; return component; }, TMP_1.$$arity = 1); })($scope.base) })($scope.base) })($scope.base); return (function($base, $super) { function $Object(){}; var self = $Object = $klass($base, $super, 'Object', $Object); var def = self.$$proto, $scope = self.$$scope, TMP_5; (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_2; Opal.alias(self, '_hyper_operation_original_method_missing', 'method_missing'); return (Opal.defn(self, '$method_missing', TMP_2 = function $$method_missing(name, $a_rest) { var $b, $c, TMP_3, $d, TMP_4, $e, self = this, args, $iter = TMP_2.$$p, block = $iter || nil, scopes = nil, scope = nil, const$ = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_2.$$p = null; if ((($b = name['$=~'](/^[A-Z]/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { scopes = ($b = ($c = self.$name().$to_s().$split("::")).$inject, $b.$$p = (TMP_3 = function(nesting, next_const){var self = TMP_3.$$s || this; if (nesting == null) nesting = nil;if (next_const == null) next_const = nil; return $rb_plus(nesting, [nesting.$last().$const_get(next_const)])}, TMP_3.$$s = self, TMP_3.$$arity = 2, TMP_3), $b).call($c, [$scope.get('Module')]).$reverse(); scope = ($b = ($d = scopes).$detect, $b.$$p = (TMP_4 = function(s){var self = TMP_4.$$s || this; if (s == null) s = nil; try {return s.$const_get(name) } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { return nil } else { throw $err; } }}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $b).call($d); if (scope !== false && scope !== nil && scope != null) { const$ = scope.$const_get(name)};}; if ((($b = ($e = const$['$is_a?']($scope.get('Class')), $e !== false && $e !== nil && $e != null ?$rb_lt(const$, (($scope.get('Hyperloop')).$$scope.get('Operation'))) : $e)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { ($b = ($e = self).$_hyper_operation_original_method_missing, $b.$$p = block.$to_proc(), $b).apply($e, [name].concat(Opal.to_a(args))) }; return ($b = const$).$send.apply($b, ["run"].concat(Opal.to_a(args))); }, TMP_2.$$arity = -2), nil) && 'method_missing'; })(Opal.get_singleton_class(self)); Opal.alias(self, '_hyper_operation_original_method_missing', 'method_missing'); return (Opal.defn(self, '$method_missing', TMP_5 = function $$method_missing(name, $a_rest) { var $b, $c, TMP_6, $d, TMP_7, $e, self = this, args, $iter = TMP_5.$$p, block = $iter || nil, first = nil, scopes = nil, scope = nil, const$ = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_5.$$p = null; if ((($b = name['$=~'](/^[A-Z]/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { first = (function() {if ((($b = ((($c = self['$is_a?']($scope.get('Module'))) !== false && $c !== nil && $c != null) ? $c : self['$is_a?']($scope.get('Class')))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$name() } else { return self.$class().$name() }; return nil; })(); scopes = ($b = ($c = first.$to_s().$split("::")).$inject, $b.$$p = (TMP_6 = function(nesting, next_const){var self = TMP_6.$$s || this; if (nesting == null) nesting = nil;if (next_const == null) next_const = nil; return $rb_plus(nesting, [nesting.$last().$const_get(next_const)])}, TMP_6.$$s = self, TMP_6.$$arity = 2, TMP_6), $b).call($c, [$scope.get('Module')]).$reverse(); scope = ($b = ($d = scopes).$detect, $b.$$p = (TMP_7 = function(s){var self = TMP_7.$$s || this; if (s == null) s = nil; try {return s.$const_get(name) } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) { return nil } else { throw $err; } }}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $b).call($d); if (scope !== false && scope !== nil && scope != null) { const$ = scope.$const_get(name)};}; if ((($b = ($e = const$['$is_a?']($scope.get('Class')), $e !== false && $e !== nil && $e != null ?$rb_lt(const$, (($scope.get('Hyperloop')).$$scope.get('Operation'))) : $e)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { ($b = ($e = self).$_hyper_operation_original_method_missing, $b.$$p = block.$to_proc(), $b).apply($e, [name].concat(Opal.to_a(args))) }; return ($b = const$).$send.apply($b, ["run"].concat(Opal.to_a(args))); }, TMP_5.$$arity = -2), nil) && 'method_missing'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/transport/client_drivers"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$[]', '$opts', '$==', '$each', '$is_a?', '$connect_to', '$name', '$id', '$class', '$raise', '$new', '$+', '$to_s', '$<<', '$open_channels', '$add_connection', '$gsub', '$lambda', '$get_queued_data', '$then', '$action_cable_consumer', '$json', '$sync_dispatch', '$parse', '$post', '$polling_path', '$get', '$include', '$dispatch_from_server', '$constantize', '$!=', '$attr_reader', '$on_opal_client?', '$[]=', '$connect', '$every']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope, TMP_3, TMP_4; (function($base, $super) { function $Application(){}; var self = $Application = $klass($base, $super, 'Application', $Application); var def = self.$$proto, $scope = self.$$scope, TMP_1; return (Opal.defs(self, '$acting_user_id', TMP_1 = function $$acting_user_id() { var self = this; return $scope.get('ClientDrivers').$opts()['$[]']("acting_user_id"); }, TMP_1.$$arity = 0), nil) && 'acting_user_id' })($scope.base, null); if ($scope.get('RUBY_ENGINE')['$==']("opal")) { Opal.defs(self, '$connect', TMP_3 = function $$connect($a_rest) { var $b, $c, TMP_2, self = this, channels; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } channels = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { channels[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = ($c = channels).$each, $b.$$p = (TMP_2 = function(channel){var self = TMP_2.$$s || this, $a, $d; if (channel == null) channel = nil; if ((($a = channel['$is_a?']($scope.get('Class'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('IncomingBroadcast').$connect_to(channel.$name()) } else if ((($a = ((($d = channel['$is_a?']($scope.get('String'))) !== false && $d !== nil && $d != null) ? $d : channel['$is_a?']($scope.get('Array')))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = $scope.get('IncomingBroadcast')).$connect_to.apply($a, Opal.to_a(channel)) } else if ((($d = channel.$id()) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { return $scope.get('IncomingBroadcast').$connect_to(channel.$class().$name(), channel.$id()) } else { return self.$raise("cannot connect to model before it has been saved") }}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $b).call($c); }, TMP_3.$$arity = -1); Opal.defs(self, '$action_cable_consumer', TMP_4 = function $$action_cable_consumer() { var self = this; return $scope.get('ClientDrivers').$opts()['$[]']("action_cable_consumer"); }, TMP_4.$$arity = 0); (function($base, $super) { function $IncomingBroadcast(){}; var self = $IncomingBroadcast = $klass($base, $super, 'IncomingBroadcast', $IncomingBroadcast); var def = self.$$proto, $scope = self.$$scope, TMP_5, TMP_6, TMP_9; Opal.defs(self, '$open_channels', TMP_5 = function $$open_channels() { var $a, self = this; if (self.open_channels == null) self.open_channels = nil; return ((($a = self.open_channels) !== false && $a !== nil && $a != null) ? $a : self.open_channels = $scope.get('Set').$new()); }, TMP_5.$$arity = 0); Opal.defs(self, '$add_connection', TMP_6 = function $$add_connection(channel_name, id) { var self = this, channel_string = nil; if (id == null) { id = nil; } channel_string = "" + (channel_name) + ((function() {if (id !== false && id !== nil && id != null) { return $rb_plus("-", id.$to_s()) } else { return nil }; return nil; })()); self.$open_channels()['$<<'](channel_string); return channel_string; }, TMP_6.$$arity = -2); return (Opal.defs(self, '$connect_to', TMP_9 = function $$connect_to(channel_name, id) { var $a, $b, TMP_7, $c, TMP_8, self = this, channel_string = nil, channel = nil; if (id == null) { id = nil; } channel_string = self.$add_connection(channel_name, id); if ($scope.get('ClientDrivers').$opts()['$[]']("transport")['$==']("pusher")) { channel = "" + ($scope.get('ClientDrivers').$opts()['$[]']("channel")) + "-" + (channel_string); var channel = $scope.get('ClientDrivers').$opts()['$[]']("pusher_api").subscribe(channel.$gsub("::", "==")); channel.bind('dispatch', $scope.get('ClientDrivers').$opts()['$[]']("dispatch")) channel.bind('pusher:subscription_succeeded', ($a = ($b = self).$lambda, $a.$$p = (TMP_7 = function(){var self = TMP_7.$$s || this; return $scope.get('ClientDrivers').$get_queued_data("connect-to-transport", channel_string)}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7), $a).call($b)) ; } else if ($scope.get('ClientDrivers').$opts()['$[]']("transport")['$==']("action_cable")) { channel = "" + ($scope.get('ClientDrivers').$opts()['$[]']("channel")) + "-" + (channel_string); return ($a = ($c = $scope.get('HTTP').$post($scope.get('ClientDrivers').$polling_path("action-cable-auth", channel))).$then, $a.$$p = (TMP_8 = function(response){var self = TMP_8.$$s || this; if (response == null) response = nil; $scope.get('Hyperloop').$action_cable_consumer().subscriptions.create( { channel: "Hyperloop::ActionCableChannel", client_id: $scope.get('ClientDrivers').$opts()['$[]']("id"), hyperloop_channel: channel_string, authorization: response.$json()['$[]']("authorization"), salt: response.$json()['$[]']("salt") }, { connected: function() { $scope.get('ClientDrivers').$get_queued_data("connect-to-transport", channel_string) }, received: function(data) { $scope.get('ClientDrivers').$sync_dispatch($scope.get('JSON').$parse(JSON.stringify(data))['$[]']("data")) } } ) ;}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8), $a).call($c); } else { return $scope.get('HTTP').$get($scope.get('ClientDrivers').$polling_path("subscribe", channel_string)) }; }, TMP_9.$$arity = -2), nil) && 'connect_to'; })($scope.base, null);}; (function($base, $super) { function $ClientDrivers(){}; var self = $ClientDrivers = $klass($base, $super, 'ClientDrivers', $ClientDrivers); var def = self.$$proto, $scope = self.$$scope, TMP_10, $a, TMP_13, TMP_17, TMP_18; self.$include((($scope.get('React')).$$scope.get('IsomorphicHelpers'))); Opal.defs(self, '$sync_dispatch', TMP_10 = function $$sync_dispatch(data) { var self = this; return data['$[]']("operation").$constantize().$dispatch_from_server(data['$[]']("params")); }, TMP_10.$$arity = 1); if ((($a = $scope.get('RUBY_ENGINE')['$!=']("opal")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {}; (function(self) { var $scope = self.$$scope, def = self.$$proto; return self.$attr_reader("opts") })(Opal.get_singleton_class(self)); Opal.defs(self, '$get_queued_data', TMP_13 = function $$get_queued_data(operation, channel, opts) { var $a, $b, TMP_11, self = this; if (channel == null) { channel = nil; } if (opts == null) { opts = $hash2([], {}); } return ($a = ($b = $scope.get('HTTP').$get(self.$polling_path(operation, channel), opts)).$then, $a.$$p = (TMP_11 = function(response){var self = TMP_11.$$s || this, $c, $d, TMP_12; if (response == null) response = nil; return ($c = ($d = response.$json()).$each, $c.$$p = (TMP_12 = function(data){var self = TMP_12.$$s || this; if (data == null) data = nil; return self.$sync_dispatch(data['$[]'](1))}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12), $c).call($d)}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11), $a).call($b); }, TMP_13.$$arity = -2); Opal.defs(self, '$initialize_client_drivers_on_boot', TMP_17 = function $$initialize_client_drivers_on_boot() { var $a, $b, TMP_14, $c, $d, $e, TMP_15, $f, TMP_16, self = this, h = nil, pusher_api = nil; if ($scope.get('RUBY_ENGINE')['$==']("opal")) { self.opts = $scope.get('Hash').$new(window.HyperloopOpts)}; if ((($a = self['$on_opal_client?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if (self.$opts()['$[]']("transport")['$==']("pusher")) { self.$opts()['$[]=']("dispatch", ($a = ($b = self).$lambda, $a.$$p = (TMP_14 = function(data){var self = TMP_14.$$s || this; if (data == null) data = nil; return self.$sync_dispatch($scope.get('JSON').$parse(JSON.stringify(data)))}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($b)); if ((($a = ($c = self.$opts()['$[]']("client_logging"), $c !== false && $c !== nil && $c != null ?window.console && window.console.log : $c)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { Pusher.log = function(message) {window.console.log(message);}}; if ((($a = self.$opts()['$[]']("pusher_fake_js")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$opts()['$[]=']("pusher_api", eval(self.$opts()['$[]']("pusher_fake_js"))) } else { h = nil; pusher_api = nil; h = { encrypted: self.$opts()['$[]']("encrypted"), authEndpoint: window.HyperloopEnginePath+'/hyperloop-pusher-auth', auth: {headers: {'X-CSRF-Token': self.$opts()['$[]']("form_authenticity_token")}} }; pusher_api = new Pusher(self.$opts()['$[]']("key"), h) ; self.$opts()['$[]=']("pusher_api", pusher_api); }; return ($a = $scope.get('Hyperloop')).$connect.apply($a, Opal.to_a(self.$opts()['$[]']("auto_connect"))); } else if (self.$opts()['$[]']("transport")['$==']("action_cable")) { self.$opts()['$[]=']("action_cable_consumer", ActionCable.createConsumer.apply(ActionCable, [].concat(Opal.to_a(self.$opts()['$[]']("action_cable_consumer_url"))))); return ($c = $scope.get('Hyperloop')).$connect.apply($c, Opal.to_a(self.$opts()['$[]']("auto_connect"))); } else if (self.$opts()['$[]']("transport")['$==']("simple_poller")) { ($d = ($e = self.$opts()['$[]']("auto_connect")).$each, $d.$$p = (TMP_15 = function(channel){var self = TMP_15.$$s || this, $f; if (channel == null) channel = nil; return ($f = $scope.get('IncomingBroadcast')).$add_connection.apply($f, Opal.to_a(channel))}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15), $d).call($e); return ($d = ($f = self).$every, $d.$$p = (TMP_16 = function(){var self = TMP_16.$$s || this; return self.$get_queued_data("read", nil, $hash2(["headers"], {"headers": $hash2(["X-HYPERLOOP-SILENT-REQUEST"], {"X-HYPERLOOP-SILENT-REQUEST": true})}))}, TMP_16.$$s = self, TMP_16.$$arity = 0, TMP_16), $d).call($f, self.$opts()['$[]']("seconds_between_poll")); } else { return nil } } else { return nil }; }, TMP_17.$$arity = 0); return (Opal.defs(self, '$polling_path', TMP_18 = function $$polling_path(to, id) { var self = this, s = nil; if (id == null) { id = nil; } s = "" + (window.HyperloopEnginePath) + "/hyperloop-" + (to) + "/" + (self.$opts()['$[]']("id")); if (id !== false && id !== nil && id != null) { s = "" + (s) + "/" + (id)}; return s; }, TMP_18.$$arity = -2), nil) && 'polling_path'; })($scope.base, null); })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/exception"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $AccessViolation(){}; var self = $AccessViolation = $klass($base, $super, 'AccessViolation', $AccessViolation); var def = self.$$proto, $scope = self.$$scope, TMP_1; return (Opal.defn(self, '$message', TMP_1 = function $$message() { var $a, $b, self = this, $iter = TMP_1.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_1.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } return "Hyperloop::Operation::AccessViolation: " + (($a = ($b = self, Opal.find_super_dispatcher(self, 'message', TMP_1, false)), $a.$$p = $iter, $a).apply($b, $zuper)); }, TMP_1.$$arity = 0), nil) && 'message' })($scope.base, $scope.get('StandardError')); (function($base, $super) { function $Operation(){}; var self = $Operation = $klass($base, $super, 'Operation', $Operation); var def = self.$$proto, $scope = self.$$scope; return (function($base, $super) { function $ValidationException(){}; var self = $ValidationException = $klass($base, $super, 'ValidationException', $ValidationException); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, (($scope.get('Mutations')).$$scope.get('ValidationException'))) })($scope.base, null); })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/promise"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_le(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$resolve', '$new', '$reject', '$attr_reader', '$===', '$value', '$has_key?', '$keys', '$!', '$==', '$realized?', '$<<', '$>>', '$exception?', '$[]', '$resolved?', '$rejected?', '$error', '$include?', '$action', '$raise', '$^', '$call', '$resolve!', '$exception!', '$any?', '$each', '$reject!', '$there_can_be_only_one!', '$then', '$to_proc', '$fail', '$always', '$trace', '$class', '$object_id', '$+', '$inspect', '$act?', '$nil?', '$prev', '$push', '$concat', '$it', '$proc', '$reverse', '$pop', '$<=', '$length', '$shift', '$-', '$wait', '$map', '$reduce', '$try', '$tap', '$all?', '$find']); return (function($base, $super) { function $Promise(){}; var self = $Promise = $klass($base, $super, 'Promise', $Promise); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_18, TMP_19, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32; def.value = def.action = def.exception = def.realized = def.next = def.delayed = def.error = def.prev = nil; Opal.defs(self, '$value', TMP_1 = function $$value(value) { var self = this; return self.$new().$resolve(value); }, TMP_1.$$arity = 1); Opal.defs(self, '$error', TMP_2 = function $$error(value) { var self = this; return self.$new().$reject(value); }, TMP_2.$$arity = 1); Opal.defs(self, '$when', TMP_3 = function $$when($a_rest) { var self = this, promises; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } promises = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { promises[$arg_idx - 0] = arguments[$arg_idx]; } return $scope.get('When').$new(promises); }, TMP_3.$$arity = -1); self.$attr_reader("error", "prev", "next"); Opal.defn(self, '$initialize', TMP_4 = function $$initialize(action) { var self = this; if (action == null) { action = $hash2([], {}); } self.action = action; self.realized = false; self.exception = false; self.value = nil; self.error = nil; self.delayed = false; self.prev = nil; return self.next = []; }, TMP_4.$$arity = -1); Opal.defn(self, '$value', TMP_5 = function $$value() { var $a, self = this; if ((($a = $scope.get('Promise')['$==='](self.value)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.value.$value() } else { return self.value }; }, TMP_5.$$arity = 0); Opal.defn(self, '$act?', TMP_6 = function() { var $a, self = this; return ((($a = self.action['$has_key?']("success")) !== false && $a !== nil && $a != null) ? $a : self.action['$has_key?']("always")); }, TMP_6.$$arity = 0); Opal.defn(self, '$action', TMP_7 = function $$action() { var self = this; return self.action.$keys(); }, TMP_7.$$arity = 0); Opal.defn(self, '$exception?', TMP_8 = function() { var self = this; return self.exception; }, TMP_8.$$arity = 0); Opal.defn(self, '$realized?', TMP_9 = function() { var self = this; return self.realized['$!']()['$!'](); }, TMP_9.$$arity = 0); Opal.defn(self, '$resolved?', TMP_10 = function() { var self = this; return self.realized['$==']("resolve"); }, TMP_10.$$arity = 0); Opal.defn(self, '$rejected?', TMP_11 = function() { var self = this; return self.realized['$==']("reject"); }, TMP_11.$$arity = 0); Opal.defn(self, '$pending?', TMP_12 = function() { var self = this; return self['$realized?']()['$!'](); }, TMP_12.$$arity = 0); Opal.defn(self, '$^', TMP_13 = function(promise) { var self = this; promise['$<<'](self); self['$>>'](promise); return promise; }, TMP_13.$$arity = 1); Opal.defn(self, '$<<', TMP_14 = function(promise) { var self = this; self.prev = promise; return self; }, TMP_14.$$arity = 1); Opal.defn(self, '$>>', TMP_15 = function(promise) { var $a, $b, $c, self = this; self.next['$<<'](promise); if ((($a = self['$exception?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { promise.$reject(self.delayed['$[]'](0)) } else if ((($a = self['$resolved?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { promise.$resolve((function() {if ((($a = self.delayed) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.delayed['$[]'](0) } else { return self.$value() }; return nil; })()) } else if ((($a = self['$rejected?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = ((($b = self.action['$has_key?']("failure")['$!']()) !== false && $b !== nil && $b != null) ? $b : $scope.get('Promise')['$==='](((function() {if ((($c = self.delayed) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.delayed['$[]'](0) } else { return self.error }; return nil; })())))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { promise.$reject((function() {if ((($a = self.delayed) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.delayed['$[]'](0) } else { return self.$error() }; return nil; })()) } else if ((($a = promise.$action()['$include?']("always")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { promise.$reject((function() {if ((($a = self.delayed) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.delayed['$[]'](0) } else { return self.$error() }; return nil; })())}}; return self; }, TMP_15.$$arity = 1); Opal.defn(self, '$resolve', TMP_16 = function $$resolve(value) { var $a, $b, self = this, block = nil, e = nil; if (value == null) { value = nil; } if ((($a = self['$realized?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "the promise has already been realized")}; if ((($a = $scope.get('Promise')['$==='](value)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (value['$<<'](self.prev))['$^'](self)}; try { if ((($a = block = ((($b = self.action['$[]']("success")) !== false && $b !== nil && $b != null) ? $b : self.action['$[]']("always"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { value = block.$call(value)}; self['$resolve!'](value); } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { self['$exception!'](e) } finally { Opal.pop_exception() } } else { throw $err; } }; return self; }, TMP_16.$$arity = -1); Opal.defn(self, '$resolve!', TMP_18 = function(value) { var $a, $b, TMP_17, self = this; self.realized = "resolve"; self.value = value; if ((($a = self.next['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self.next).$each, $a.$$p = (TMP_17 = function(p){var self = TMP_17.$$s || this; if (p == null) p = nil; return p.$resolve(value)}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17), $a).call($b) } else { return self.delayed = [value] }; }, TMP_18.$$arity = 1); Opal.defn(self, '$reject', TMP_19 = function $$reject(value) { var $a, $b, self = this, block = nil, e = nil; if (value == null) { value = nil; } if ((($a = self['$realized?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "the promise has already been realized")}; if ((($a = $scope.get('Promise')['$==='](value)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (value['$<<'](self.prev))['$^'](self)}; try { if ((($a = block = ((($b = self.action['$[]']("failure")) !== false && $b !== nil && $b != null) ? $b : self.action['$[]']("always"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { value = block.$call(value)}; if ((($a = self.action['$has_key?']("always")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self['$resolve!'](value) } else { self['$reject!'](value) }; } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { self['$exception!'](e) } finally { Opal.pop_exception() } } else { throw $err; } }; return self; }, TMP_19.$$arity = -1); Opal.defn(self, '$reject!', TMP_21 = function(value) { var $a, $b, TMP_20, self = this; self.realized = "reject"; self.error = value; if ((($a = self.next['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self.next).$each, $a.$$p = (TMP_20 = function(p){var self = TMP_20.$$s || this; if (p == null) p = nil; return p.$reject(value)}, TMP_20.$$s = self, TMP_20.$$arity = 1, TMP_20), $a).call($b) } else { return self.delayed = [value] }; }, TMP_21.$$arity = 1); Opal.defn(self, '$exception!', TMP_22 = function(error) { var self = this; self.exception = true; return self['$reject!'](error); }, TMP_22.$$arity = 1); Opal.defn(self, '$then', TMP_23 = function $$then() { var self = this, $iter = TMP_23.$$p, block = $iter || nil; TMP_23.$$p = null; return self['$^']($scope.get('Promise').$new($hash2(["success"], {"success": block}))); }, TMP_23.$$arity = 0); Opal.defn(self, '$then!', TMP_24 = function() { var $a, $b, self = this, $iter = TMP_24.$$p, block = $iter || nil; TMP_24.$$p = null; self['$there_can_be_only_one!'](); return ($a = ($b = self).$then, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_24.$$arity = 0); Opal.alias(self, 'do', 'then'); Opal.alias(self, 'do!', 'then!'); Opal.defn(self, '$fail', TMP_25 = function $$fail() { var self = this, $iter = TMP_25.$$p, block = $iter || nil; TMP_25.$$p = null; return self['$^']($scope.get('Promise').$new($hash2(["failure"], {"failure": block}))); }, TMP_25.$$arity = 0); Opal.defn(self, '$fail!', TMP_26 = function() { var $a, $b, self = this, $iter = TMP_26.$$p, block = $iter || nil; TMP_26.$$p = null; self['$there_can_be_only_one!'](); return ($a = ($b = self).$fail, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_26.$$arity = 0); Opal.alias(self, 'rescue', 'fail'); Opal.alias(self, 'catch', 'fail'); Opal.alias(self, 'rescue!', 'fail!'); Opal.alias(self, 'catch!', 'fail!'); Opal.defn(self, '$always', TMP_27 = function $$always() { var self = this, $iter = TMP_27.$$p, block = $iter || nil; TMP_27.$$p = null; return self['$^']($scope.get('Promise').$new($hash2(["always"], {"always": block}))); }, TMP_27.$$arity = 0); Opal.defn(self, '$always!', TMP_28 = function() { var $a, $b, self = this, $iter = TMP_28.$$p, block = $iter || nil; TMP_28.$$p = null; self['$there_can_be_only_one!'](); return ($a = ($b = self).$always, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_28.$$arity = 0); Opal.alias(self, 'finally', 'always'); Opal.alias(self, 'ensure', 'always'); Opal.alias(self, 'finally!', 'always!'); Opal.alias(self, 'ensure!', 'always!'); Opal.defn(self, '$trace', TMP_29 = function $$trace(depth) { var self = this, $iter = TMP_29.$$p, block = $iter || nil; if (depth == null) { depth = nil; } TMP_29.$$p = null; return self['$^']($scope.get('Trace').$new(depth, block)); }, TMP_29.$$arity = -1); Opal.defn(self, '$trace!', TMP_30 = function($a_rest) { var $b, $c, self = this, args, $iter = TMP_30.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_30.$$p = null; self['$there_can_be_only_one!'](); return ($b = ($c = self).$trace, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_30.$$arity = -1); Opal.defn(self, '$there_can_be_only_one!', TMP_31 = function() { var $a, self = this; if ((($a = self.next['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise($scope.get('ArgumentError'), "a promise has already been chained") } else { return nil }; }, TMP_31.$$arity = 0); Opal.defn(self, '$inspect', TMP_32 = function $$inspect() { var $a, self = this, result = nil; result = "#<" + (self.$class()) + "(" + (self.$object_id()) + ")"; if ((($a = self.next['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = $rb_plus(result, " >> " + (self.next.$inspect()))}; if ((($a = self['$realized?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = $rb_plus(result, ": " + ((((($a = self.value) !== false && $a !== nil && $a != null) ? $a : self.error)).$inspect()) + ">") } else { result = $rb_plus(result, ">") }; return result; }, TMP_32.$$arity = 0); (function($base, $super) { function $Trace(){}; var self = $Trace = $klass($base, $super, 'Trace', $Trace); var def = self.$$proto, $scope = self.$$scope, TMP_33, TMP_34; Opal.defs(self, '$it', TMP_33 = function $$it(promise) { var $a, $b, self = this, current = nil, prev = nil; current = []; if ((($a = ((($b = promise['$act?']()) !== false && $b !== nil && $b != null) ? $b : promise.$prev()['$nil?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { current.$push(promise.$value())}; if ((($a = prev = promise.$prev()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return current.$concat(self.$it(prev)) } else { return current }; }, TMP_33.$$arity = 1); return (Opal.defn(self, '$initialize', TMP_34 = function $$initialize(depth, block) { var $a, $b, $c, $d, TMP_35, self = this, $iter = TMP_34.$$p, $yield = $iter || nil; TMP_34.$$p = null; self.depth = depth; return ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_34, false)), $a.$$p = null, $a).call($b, $hash2(["success"], {"success": ($c = ($d = self).$proc, $c.$$p = (TMP_35 = function(){var self = TMP_35.$$s || this, $e, $f, trace = nil; trace = $scope.get('Trace').$it(self).$reverse(); trace.$pop(); if ((($e = (($f = depth !== false && depth !== nil && depth != null) ? $rb_le(depth, trace.$length()) : depth)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { trace.$shift($rb_minus(trace.$length(), depth))}; return ($e = block).$call.apply($e, Opal.to_a(trace));}, TMP_35.$$s = self, TMP_35.$$arity = 0, TMP_35), $c).call($d)})); }, TMP_34.$$arity = 2), nil) && 'initialize'; })($scope.base, self); return (function($base, $super) { function $When(){}; var self = $When = $klass($base, $super, 'When', $When); var def = self.$$proto, $scope = self.$$scope, TMP_36, TMP_38, TMP_40, TMP_42, TMP_45, TMP_47, TMP_48; def.wait = nil; Opal.defn(self, '$initialize', TMP_36 = function $$initialize(promises) { var $a, $b, $c, TMP_37, self = this, $iter = TMP_36.$$p, $yield = $iter || nil; if (promises == null) { promises = []; } TMP_36.$$p = null; ($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_36, false)), $a.$$p = null, $a).call($b); self.wait = []; return ($a = ($c = promises).$each, $a.$$p = (TMP_37 = function(promise){var self = TMP_37.$$s || this; if (promise == null) promise = nil; return self.$wait(promise)}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37), $a).call($c); }, TMP_36.$$arity = -1); Opal.defn(self, '$each', TMP_38 = function $$each() { var $a, $b, TMP_39, self = this, $iter = TMP_38.$$p, block = $iter || nil; TMP_38.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "no block given") }; return ($a = ($b = self).$then, $a.$$p = (TMP_39 = function(values){var self = TMP_39.$$s || this, $c, $d; if (values == null) values = nil; return ($c = ($d = values).$each, $c.$$p = block.$to_proc(), $c).call($d)}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39), $a).call($b); }, TMP_38.$$arity = 0); Opal.defn(self, '$collect', TMP_40 = function $$collect() { var $a, $b, TMP_41, self = this, $iter = TMP_40.$$p, block = $iter || nil; TMP_40.$$p = null; if (block !== false && block !== nil && block != null) { } else { self.$raise($scope.get('ArgumentError'), "no block given") }; return ($a = ($b = self).$then, $a.$$p = (TMP_41 = function(values){var self = TMP_41.$$s || this, $c, $d; if (values == null) values = nil; return $scope.get('When').$new(($c = ($d = values).$map, $c.$$p = block.$to_proc(), $c).call($d))}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41), $a).call($b); }, TMP_40.$$arity = 0); Opal.defn(self, '$inject', TMP_42 = function $$inject($a_rest) { var $b, $c, TMP_43, self = this, args, $iter = TMP_42.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_42.$$p = null; return ($b = ($c = self).$then, $b.$$p = (TMP_43 = function(values){var self = TMP_43.$$s || this, $a, $d; if (values == null) values = nil; return ($a = ($d = values).$reduce, $a.$$p = block.$to_proc(), $a).apply($d, Opal.to_a(args))}, TMP_43.$$s = self, TMP_43.$$arity = 1, TMP_43), $b).call($c); }, TMP_42.$$arity = -1); Opal.alias(self, 'map', 'collect'); Opal.alias(self, 'reduce', 'inject'); Opal.defn(self, '$wait', TMP_45 = function $$wait(promise) { var $a, $b, TMP_44, self = this; if ((($a = $scope.get('Promise')['$==='](promise)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { promise = $scope.get('Promise').$value(promise) }; if ((($a = promise['$act?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { promise = promise.$then()}; self.wait['$<<'](promise); ($a = ($b = promise).$always, $a.$$p = (TMP_44 = function(){var self = TMP_44.$$s || this, $c; if (self.next == null) self.next = nil; if ((($c = self.next['$any?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.$try() } else { return nil }}, TMP_44.$$s = self, TMP_44.$$arity = 0, TMP_44), $a).call($b); return self; }, TMP_45.$$arity = 1); Opal.alias(self, 'and', 'wait'); Opal.defn(self, '$>>', TMP_47 = function($a_rest) { var $b, $c, TMP_46, $d, $e, self = this, $iter = TMP_47.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_47.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } return ($b = ($c = ($d = ($e = self, Opal.find_super_dispatcher(self, '>>', TMP_47, false)), $d.$$p = $iter, $d).apply($e, $zuper)).$tap, $b.$$p = (TMP_46 = function(){var self = TMP_46.$$s || this; return self.$try()}, TMP_46.$$s = self, TMP_46.$$arity = 0, TMP_46), $b).call($c); }, TMP_47.$$arity = -1); return (Opal.defn(self, '$try', TMP_48 = function() { var $a, $b, $c, $d, self = this, promise = nil; if ((($a = ($b = ($c = self.wait)['$all?'], $b.$$p = "realized?".$to_proc(), $b).call($c)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = promise = ($b = ($d = self.wait).$find, $b.$$p = "rejected?".$to_proc(), $b).call($d)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$reject(promise.$error()) } else { return self.$resolve(($a = ($b = self.wait).$map, $a.$$p = "value".$to_proc(), $a).call($b)) } } else { return nil }; }, TMP_48.$$arity = 0), nil) && 'try'; })($scope.base, self); })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/railway"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Operation(){}; var self = $Operation = $klass($base, $super, 'Operation', $Operation); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/api"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $hash = Opal.hash; Opal.add_stubs(['$is_a?', '$raise', '$new', '$tap', '$split', '$to_s', '$pop', '$inject', '$to_sym', '$[]', '$[]=', '$!', '$nil?', '$abort!', '$succeed!', '$_Railway', '$class', '$_run', '$instance_eval', '$process_params', '$process_validations', '$run', '$dispatch', '$result', '$then', '$to_proc', '$fail', '$add_param', '$each', '$add_validation', '$add_error', '$add_step', '$add_failed', '$add_async', '$add_receiver', '$singleton_class', '$define_singleton_method', '$set_var', '$superclass', '$==', '$instance_variable_get', '$instance_variable_set', '$dup']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Operation(){}; var self = $Operation = $klass($base, $super, 'Operation', $Operation); var def = self.$$proto, $scope = self.$$scope, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8; def.errors = def.params = nil; Opal.defn(self, '$add_error', TMP_3 = function $$add_error(key, kind, message) { var $a, $b, TMP_1, self = this; if (message == null) { message = nil; } if ((($a = kind['$is_a?']($scope.get('Symbol'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError').$new("Invalid kind")) }; ((($a = self.errors) !== false && $a !== nil && $a != null) ? $a : self.errors = (($scope.get('Mutations')).$$scope.get('ErrorHash')).$new()); return ($a = ($b = self.errors).$tap, $a.$$p = (TMP_1 = function(errs){var self = TMP_1.$$s || this, $c, $d, TMP_2, path = nil, last = nil, inner = nil; if (errs == null) errs = nil; path = key.$to_s().$split("."); last = path.$pop(); inner = ($c = ($d = path).$inject, $c.$$p = (TMP_2 = function(cur_errors, part){var self = TMP_2.$$s || this, $e, $f, $g; if (cur_errors == null) cur_errors = nil;if (part == null) part = nil; return ($e = part.$to_sym(), $f = cur_errors, ((($g = $f['$[]']($e)) !== false && $g !== nil && $g != null) ? $g : $f['$[]=']($e, (($scope.get('Mutations')).$$scope.get('ErrorHash')).$new())))}, TMP_2.$$s = self, TMP_2.$$arity = 2, TMP_2), $c).call($d, errs); return inner['$[]='](last, (($scope.get('Mutations')).$$scope.get('ErrorAtom')).$new(key, kind, $hash2(["message"], {"message": message})));}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); }, TMP_3.$$arity = -3); Opal.defn(self, '$has_errors?', TMP_4 = function() { var self = this; return self.errors['$nil?']()['$!'](); }, TMP_4.$$arity = 0); Opal.defn(self, '$params', TMP_5 = function $$params() { var self = this; return self.params; }, TMP_5.$$arity = 0); Opal.defn(self, '$abort!', TMP_6 = function(arg) { var self = this; if (arg == null) { arg = nil; } return $scope.get('Railway')['$abort!'](arg); }, TMP_6.$$arity = -1); Opal.defn(self, '$succeed!', TMP_7 = function(arg) { var self = this; if (arg == null) { arg = nil; } return $scope.get('Railway')['$succeed!'](arg); }, TMP_7.$$arity = -1); Opal.defn(self, '$initialize', TMP_8 = function $$initialize() { var self = this; return self._railway = self.$class().$_Railway().$new(self); }, TMP_8.$$arity = 0); (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_9, TMP_11, TMP_12, TMP_13, TMP_14, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_36; Opal.defn(self, '$run', TMP_9 = function $$run($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = self).$_run.apply($b, Opal.to_a(args)); }, TMP_9.$$arity = -1); Opal.defn(self, '$_run', TMP_11 = function $$_run($a_rest) { var $b, $c, TMP_10, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = ($c = self.$new()).$instance_eval, $b.$$p = (TMP_10 = function(){var self = TMP_10.$$s || this; if (self._railway == null) self._railway = nil; self._railway.$process_params(args); self._railway.$process_validations(); self._railway.$run(); self._railway.$dispatch(); return self._railway.$result();}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10), $b).call($c); }, TMP_11.$$arity = -1); Opal.defn(self, '$then', TMP_12 = function $$then($a_rest) { var $b, $c, $d, self = this, args, $iter = TMP_12.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_12.$$p = null; return ($b = ($c = ($d = self).$run.apply($d, Opal.to_a(args))).$then, $b.$$p = block.$to_proc(), $b).call($c); }, TMP_12.$$arity = -1); Opal.defn(self, '$fail', TMP_13 = function $$fail($a_rest) { var $b, $c, $d, self = this, args, $iter = TMP_13.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_13.$$p = null; return ($b = ($c = ($d = self).$run.apply($d, Opal.to_a(args))).$fail, $b.$$p = block.$to_proc(), $b).call($c); }, TMP_13.$$arity = -1); Opal.defn(self, '$param', TMP_14 = function $$param($a_rest) { var $b, $c, self = this, args, $iter = TMP_14.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_14.$$p = null; return ($b = ($c = self.$_Railway()).$add_param, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_14.$$arity = -1); Opal.defn(self, '$outbound', TMP_16 = function $$outbound($a_rest) { var $b, $c, TMP_15, self = this, keys; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } keys = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { keys[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = ($c = keys).$each, $b.$$p = (TMP_15 = function(key){var self = TMP_15.$$s || this; if (key == null) key = nil; return self.$_Railway().$add_param($hash(key, nil, "type", "outbound"))}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15), $b).call($c); }, TMP_16.$$arity = -1); Opal.defn(self, '$validate', TMP_17 = function $$validate($a_rest) { var $b, $c, self = this, args, $iter = TMP_17.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_17.$$p = null; return ($b = ($c = self.$_Railway()).$add_validation, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_17.$$arity = -1); Opal.defn(self, '$add_error', TMP_18 = function $$add_error(param, symbol, message, $a_rest) { var $b, $c, self = this, args, $iter = TMP_18.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 3; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 3; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 3] = arguments[$arg_idx]; } TMP_18.$$p = null; return ($b = ($c = self.$_Railway()).$add_error, $b.$$p = block.$to_proc(), $b).apply($c, [param, symbol, message].concat(Opal.to_a(args))); }, TMP_18.$$arity = -4); Opal.defn(self, '$step', TMP_19 = function $$step($a_rest) { var $b, $c, self = this, args, $iter = TMP_19.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_19.$$p = null; return ($b = ($c = self.$_Railway()).$add_step, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_19.$$arity = -1); Opal.defn(self, '$failed', TMP_20 = function $$failed($a_rest) { var $b, $c, self = this, args, $iter = TMP_20.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_20.$$p = null; return ($b = ($c = self.$_Railway()).$add_failed, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_20.$$arity = -1); Opal.defn(self, '$async', TMP_21 = function $$async($a_rest) { var $b, $c, self = this, args, $iter = TMP_21.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_21.$$p = null; return ($b = ($c = self.$_Railway()).$add_async, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_21.$$arity = -1); Opal.defn(self, '$on_dispatch', TMP_22 = function $$on_dispatch() { var $a, $b, self = this, $iter = TMP_22.$$p, block = $iter || nil; TMP_22.$$p = null; return ($a = ($b = self.$_Railway()).$add_receiver, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_22.$$arity = 0); Opal.defn(self, '$_Railway', TMP_23 = function $$_Railway() { var self = this; return self.$singleton_class().$_Railway(); }, TMP_23.$$arity = 0); return (Opal.defn(self, '$inherited', TMP_36 = function $$inherited(child) { var $a, $b, TMP_24, $c, TMP_25, $d, TMP_27, $e, TMP_28, $f, TMP_29, $g, TMP_30, $h, TMP_31, $i, TMP_32, self = this; ($a = ($b = child.$singleton_class()).$define_singleton_method, $a.$$p = (TMP_24 = function($c_rest){var self = TMP_24.$$s || this, block, args, $d, $e; block = TMP_24.$$p || nil, TMP_24.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($d = ($e = self.$_Railway()).$add_param, $d.$$p = block.$to_proc(), $d).apply($e, Opal.to_a(args))}, TMP_24.$$s = self, TMP_24.$$arity = -1, TMP_24), $a).call($b, "param"); ($a = ($c = child.$singleton_class()).$define_singleton_method, $a.$$p = (TMP_25 = function($d_rest){var self = TMP_25.$$s || this, keys, $e, $f, TMP_26; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } keys = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { keys[$arg_idx - 0] = arguments[$arg_idx]; } return ($e = ($f = keys).$each, $e.$$p = (TMP_26 = function(key){var self = TMP_26.$$s || this; if (key == null) key = nil; return self.$_Railway().$add_param($hash(key, nil, "type", "outbound"))}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26), $e).call($f)}, TMP_25.$$s = self, TMP_25.$$arity = -1, TMP_25), $a).call($c, "outbound"); ($a = ($d = child.$singleton_class()).$define_singleton_method, $a.$$p = (TMP_27 = function($e_rest){var self = TMP_27.$$s || this, block, args, $f, $g; block = TMP_27.$$p || nil, TMP_27.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($f = ($g = self.$_Railway()).$add_validation, $f.$$p = block.$to_proc(), $f).apply($g, Opal.to_a(args))}, TMP_27.$$s = self, TMP_27.$$arity = -1, TMP_27), $a).call($d, "validate"); ($a = ($e = child.$singleton_class()).$define_singleton_method, $a.$$p = (TMP_28 = function(param, symbol, message, $f_rest){var self = TMP_28.$$s || this, block, args, $g, $h; block = TMP_28.$$p || nil, TMP_28.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 3; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 3; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 3] = arguments[$arg_idx]; }if (param == null) param = nil;if (symbol == null) symbol = nil;if (message == null) message = nil; return ($g = ($h = self.$_Railway()).$add_error, $g.$$p = block.$to_proc(), $g).apply($h, [param, symbol, message].concat(Opal.to_a(args)))}, TMP_28.$$s = self, TMP_28.$$arity = -4, TMP_28), $a).call($e, "add_error"); ($a = ($f = child.$singleton_class()).$define_singleton_method, $a.$$p = (TMP_29 = function($g_rest){var self = TMP_29.$$s || this, block, args, $h, $i; block = TMP_29.$$p || nil, TMP_29.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($h = ($i = self.$_Railway()).$add_step, $h.$$p = block.$to_proc(), $h).apply($i, [$hash2(["scope"], {"scope": "class"})].concat(Opal.to_a(args)))}, TMP_29.$$s = self, TMP_29.$$arity = -1, TMP_29), $a).call($f, "step"); ($a = ($g = child.$singleton_class()).$define_singleton_method, $a.$$p = (TMP_30 = function($h_rest){var self = TMP_30.$$s || this, block, args, $i, $j; block = TMP_30.$$p || nil, TMP_30.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($i = ($j = self.$_Railway()).$add_failed, $i.$$p = block.$to_proc(), $i).apply($j, [$hash2(["scope"], {"scope": "class"})].concat(Opal.to_a(args)))}, TMP_30.$$s = self, TMP_30.$$arity = -1, TMP_30), $a).call($g, "failed"); ($a = ($h = child.$singleton_class()).$define_singleton_method, $a.$$p = (TMP_31 = function($i_rest){var self = TMP_31.$$s || this, block, args, $j, $k; block = TMP_31.$$p || nil, TMP_31.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($j = ($k = self.$_Railway()).$add_async, $j.$$p = block.$to_proc(), $j).apply($k, [$hash2(["scope"], {"scope": "class"})].concat(Opal.to_a(args)))}, TMP_31.$$s = self, TMP_31.$$arity = -1, TMP_31), $a).call($h, "async"); return ($a = ($i = child.$singleton_class()).$define_singleton_method, $a.$$p = (TMP_32 = function(){var self = TMP_32.$$s || this, $j, $k, TMP_33; return ($j = ($k = (($scope.get('Hyperloop')).$$scope.get('Context'))).$set_var, $j.$$p = (TMP_33 = function(){var self = TMP_33.$$s || this, $l, $m, TMP_34, my_super = nil; my_super = ((($l = self.$superclass()) !== false && $l !== nil && $l != null) ? $l : (self.$$singleton_of).$superclass().$singleton_class()); if (my_super['$==']($scope.get('Operation').$singleton_class())) { return $scope.get('Class').$new($scope.get('Railway')) } else { return ($l = ($m = $scope.get('Class').$new(my_super.$_Railway())).$tap, $l.$$p = (TMP_34 = function(wrapper){var self = TMP_34.$$s || this, $n, $o, TMP_35; if (wrapper == null) wrapper = nil; return ($n = ($o = ["@validations", "@tracks", "@receivers"]).$each, $n.$$p = (TMP_35 = function(var$){var self = TMP_35.$$s || this, $p, value = nil; if (var$ == null) var$ = nil; value = my_super.$_Railway().$instance_variable_get(var$); return wrapper.$instance_variable_set(var$, (($p = value !== false && value !== nil && value != null) ? value.$dup() : value));}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35), $n).call($o)}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34), $l).call($m) };}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33), $j).call($k, self, "@_railway")}, TMP_32.$$s = self, TMP_32.$$arity = 0, TMP_32), $a).call($i, "_Railway"); }, TMP_36.$$arity = 1), nil) && 'inherited'; })(Opal.get_singleton_class(self)); return (function($base, $super) { function $Railway(){}; var self = $Railway = $klass($base, $super, 'Railway', $Railway); var def = self.$$proto, $scope = self.$$scope, TMP_37; return (Opal.defn(self, '$initialize', TMP_37 = function $$initialize(operation) { var self = this; return self.operation = operation; }, TMP_37.$$arity = 1), nil) && 'initialize' })($scope.base, null); })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/railway/dispatcher"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$receivers', '$class', '$set_var', '$<<', '$then', '$each', '$call', '$dispatch_params', '$params_wrapper', '$params', '$result']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Operation(){}; var self = $Operation = $klass($base, $super, 'Operation', $Operation); var def = self.$$proto, $scope = self.$$scope; return (function($base, $super) { function $Railway(){}; var self = $Railway = $klass($base, $super, 'Railway', $Railway); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_7; Opal.defn(self, '$receivers', TMP_1 = function $$receivers() { var self = this; return self.$class().$receivers(); }, TMP_1.$$arity = 0); (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_3, TMP_4; Opal.defn(self, '$receivers', TMP_3 = function $$receivers() { var $a, $b, TMP_2, self = this; return ($a = ($b = (($scope.get('Hyperloop')).$$scope.get('Context'))).$set_var, $a.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this; return []}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $a).call($b, self, "@receivers", $hash2(["force"], {"force": true})); }, TMP_3.$$arity = 0); return (Opal.defn(self, '$add_receiver', TMP_4 = function $$add_receiver() { var self = this, $iter = TMP_4.$$p, block = $iter || nil; TMP_4.$$p = null; return self.$receivers()['$<<'](block); }, TMP_4.$$arity = 0), nil) && 'add_receiver'; })(Opal.get_singleton_class(self)); return (Opal.defn(self, '$dispatch', TMP_7 = function $$dispatch() { var $a, $b, TMP_5, self = this; return ($a = ($b = self.$result()).$then, $a.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this, $c, $d, TMP_6; return ($c = ($d = self.$receivers()).$each, $c.$$p = (TMP_6 = function(receiver){var self = TMP_6.$$s || this; if (self.operation == null) self.operation = nil; if (receiver == null) receiver = nil; return receiver.$call(self.$class().$params_wrapper().$dispatch_params(self.operation.$params()), self.operation)}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $c).call($d)}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $a).call($b); }, TMP_7.$$arity = 0), nil) && 'dispatch'; })($scope.base, null) })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/railway/params_wrapper"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$with_indifferent_access', '$to_s', '$to_h', '$inject', '$respond_to?', '$raise', '$new', '$merge!', '$combine_arg_array', '$filter', '$hash_filter', '$instance_eval', '$translate_args', '$to_proc', '$key?', '$optional', '$send', '$required', '$define_method', '$[]', '$method_missing', '$[]=', '$dup', '$each', '$lock', '$get_name_and_opts', '$delete', '$is_a?', '$>', '$count', '$first', '$==', '$proc', '$duck', '$underscore', '$last', '$process_params', '$params_wrapper', '$class', '$add_param', '$set_var', '$superclass', '$tap', '$instance_variable_set']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Operation(){}; var self = $Operation = $klass($base, $super, 'Operation', $Operation); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ParamsWrapper(){}; var self = $ParamsWrapper = $klass($base, $super, 'ParamsWrapper', $ParamsWrapper); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4; def.inputs = nil; Opal.defn(self, '$initialize', TMP_1 = function $$initialize(inputs) { var self = this; return self.inputs = inputs; }, TMP_1.$$arity = 1); Opal.defn(self, '$lock', TMP_2 = function $$lock() { var self = this; self.locked = true; return self; }, TMP_2.$$arity = 0); Opal.defn(self, '$to_h', TMP_3 = function $$to_h() { var self = this; return self.inputs.$with_indifferent_access(); }, TMP_3.$$arity = 0); Opal.defn(self, '$to_s', TMP_4 = function $$to_s() { var self = this; return self.$to_h().$to_s(); }, TMP_4.$$arity = 0); return (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_6, TMP_8, TMP_9, TMP_16, TMP_17, TMP_18, TMP_21; Opal.defn(self, '$combine_arg_array', TMP_6 = function $$combine_arg_array(args) { var $a, $b, TMP_5, self = this, hash = nil; return hash = ($a = ($b = args).$inject, $a.$$p = (TMP_5 = function(h, arg){var self = TMP_5.$$s || this, $c; if (h == null) h = nil;if (arg == null) arg = nil; if ((($c = arg['$respond_to?']("to_h")) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { self.$raise($scope.get('ArgumentError').$new("All arguments must be hashes")) }; return h['$merge!'](arg.$to_h());}, TMP_5.$$s = self, TMP_5.$$arity = 2, TMP_5), $a).call($b, $hash2([], {}).$with_indifferent_access()); }, TMP_6.$$arity = 1); Opal.defn(self, '$process_params', TMP_8 = function $$process_params(operation, args) { var $a, $b, TMP_7, self = this, raw_inputs = nil, inputs = nil, errors = nil, params_wrapper = nil; raw_inputs = self.$combine_arg_array(args); $b = self.$hash_filter().$filter(raw_inputs), $a = Opal.to_ary($b), inputs = ($a[0] == null ? nil : $a[0]), errors = ($a[1] == null ? nil : $a[1]), $b; params_wrapper = self.$new(inputs); return ($a = ($b = operation).$instance_eval, $a.$$p = (TMP_7 = function(){var self = TMP_7.$$s || this, $c, $d; return $d = [raw_inputs, params_wrapper, errors], $c = Opal.to_ary($d), self.raw_inputs = ($c[0] == null ? nil : $c[0]), self.params = ($c[1] == null ? nil : $c[1]), self.errors = ($c[2] == null ? nil : $c[2]), $d}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7), $a).call($b); }, TMP_8.$$arity = 2); Opal.defn(self, '$add_param', TMP_9 = function $$add_param($a_rest) { var $b, $c, $d, $e, TMP_10, TMP_11, $f, TMP_12, $g, TMP_13, self = this, args, $iter = TMP_9.$$p, block = $iter || nil, type_method = nil, name = nil, opts = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_9.$$p = null; $c = ($d = ($e = self).$translate_args, $d.$$p = block.$to_proc(), $d).apply($e, Opal.to_a(args)), $b = Opal.to_ary($c), type_method = ($b[0] == null ? nil : $b[0]), name = ($b[1] == null ? nil : $b[1]), opts = ($b[2] == null ? nil : $b[2]), block = ($b[3] == null ? nil : $b[3]), $c; if ((($b = opts['$key?']("default")) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { ($b = ($c = self.$hash_filter()).$optional, $b.$$p = (TMP_10 = function(){var self = TMP_10.$$s || this, $a, $f; return ($a = ($f = self).$send, $a.$$p = block.$to_proc(), $a).call($f, type_method, name, opts)}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10), $b).call($c) } else { ($b = ($d = self.$hash_filter()).$required, $b.$$p = (TMP_11 = function(){var self = TMP_11.$$s || this, $a, $f; return ($a = ($f = self).$send, $a.$$p = block.$to_proc(), $a).call($f, type_method, name, opts)}, TMP_11.$$s = self, TMP_11.$$arity = 0, TMP_11), $b).call($d) }; ($b = ($f = self).$define_method, $b.$$p = (TMP_12 = function(){var self = TMP_12.$$s || this; if (self.inputs == null) self.inputs = nil; return self.inputs['$[]'](name)}, TMP_12.$$s = self, TMP_12.$$arity = 0, TMP_12), $b).call($f, name); return ($b = ($g = self).$define_method, $b.$$p = (TMP_13 = function(x){var self = TMP_13.$$s || this, $a; if (self.locked == null) self.locked = nil; if (self.inputs == null) self.inputs = nil; if (x == null) x = nil; if ((($a = self.locked) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$method_missing(("" + name.$to_s() + "="), x)}; return self.inputs['$[]='](name, x);}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13), $b).call($g, ("" + name.$to_s() + "=")); }, TMP_9.$$arity = -1); Opal.defn(self, '$dispatch_params', TMP_16 = function $$dispatch_params(params, hashes) { var $a, $b, TMP_14, self = this; if (hashes == null) { hashes = $hash2([], {}); } params = params.$dup(); ($a = ($b = hashes).$each, $a.$$p = (TMP_14 = function(hash){var self = TMP_14.$$s || this, $c, $d, TMP_15; if (hash == null) hash = nil; return ($c = ($d = hash).$each, $c.$$p = (TMP_15 = function(k, v){var self = TMP_15.$$s || this; if (k == null) k = nil;if (v == null) v = nil; return params.$send(("" + k.$to_s() + "="), v)}, TMP_15.$$s = self, TMP_15.$$arity = 2, TMP_15), $c).call($d)}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($b); return params.$lock(); }, TMP_16.$$arity = -2); Opal.defn(self, '$hash_filter', TMP_17 = function $$hash_filter() { var $a, self = this; if (self.hash_filter == null) self.hash_filter = nil; return ((($a = self.hash_filter) !== false && $a !== nil && $a != null) ? $a : self.hash_filter = (($scope.get('Mutations')).$$scope.get('HashFilter')).$new()); }, TMP_17.$$arity = 0); Opal.defn(self, '$translate_args', TMP_18 = function $$translate_args($a_rest) { var $b, $c, $d, $e, TMP_19, $f, TMP_20, self = this, args, $iter = TMP_18.$$p, block = $iter || nil, name = nil, opts = nil, type_method = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_18.$$p = null; $c = ($d = self).$get_name_and_opts.apply($d, Opal.to_a(args)), $b = Opal.to_ary($c), name = ($b[0] == null ? nil : $b[0]), opts = ($b[1] == null ? nil : $b[1]), $c; if ((($b = opts['$key?']("type")) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { type_method = opts.$delete("type"); if ((($b = type_method['$is_a?']($scope.get('Array'))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = $rb_gt(type_method.$count(), 0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { opts['$[]=']("class", type_method.$first())}; type_method = $scope.get('Array'); } else if ((($b = ((($c = type_method['$is_a?']($scope.get('Hash'))) !== false && $c !== nil && $c != null) ? $c : type_method['$==']($scope.get('Hash')))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { type_method = $scope.get('Hash'); ((($b = block) !== false && $b !== nil && $b != null) ? $b : block = ($c = ($e = self).$proc, $c.$$p = (TMP_19 = function(){var self = TMP_19.$$s || this; return self.$duck("*")}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19), $c).call($e));}; type_method = type_method.$to_s().$underscore(); } else { type_method = "duck" }; return [type_method, name, opts, ((($b = block) !== false && $b !== nil && $b != null) ? $b : ($c = ($f = self).$proc, $c.$$p = (TMP_20 = function(){var self = TMP_20.$$s || this; return nil}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20), $c).call($f))]; }, TMP_18.$$arity = -1); return (Opal.defn(self, '$get_name_and_opts', TMP_21 = function $$get_name_and_opts($a_rest) { var $b, self = this, args, opts = nil, name = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($b = args['$[]'](0)['$is_a?']($scope.get('Hash'))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { opts = args['$[]'](0); name = opts.$first().$first(); opts['$[]=']("default", opts.$first().$last()); opts.$delete(name); } else { name = args['$[]'](0); opts = ((($b = args['$[]'](1)) !== false && $b !== nil && $b != null) ? $b : $hash2([], {})); }; return [name, opts]; }, TMP_21.$$arity = -1), nil) && 'get_name_and_opts'; })(Opal.get_singleton_class(self)); })($scope.base, null); return (function($base, $super) { function $Railway(){}; var self = $Railway = $klass($base, $super, 'Railway', $Railway); var def = self.$$proto, $scope = self.$$scope, TMP_22, TMP_23, TMP_26; def.operation = nil; Opal.defn(self, '$process_params', TMP_22 = function $$process_params(args) { var self = this; return self.$class().$params_wrapper().$process_params(self.operation, args); }, TMP_22.$$arity = 1); Opal.defs(self, '$add_param', TMP_23 = function $$add_param($a_rest) { var $b, $c, self = this, args, $iter = TMP_23.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_23.$$p = null; return ($b = ($c = self.$params_wrapper()).$add_param, $b.$$p = block.$to_proc(), $b).apply($c, Opal.to_a(args)); }, TMP_23.$$arity = -1); return (Opal.defs(self, '$params_wrapper', TMP_26 = function $$params_wrapper() { var $a, $b, TMP_24, self = this; return ($a = ($b = (($scope.get('Hyperloop')).$$scope.get('Context'))).$set_var, $a.$$p = (TMP_24 = function(){var self = TMP_24.$$s || this, $c, $d, TMP_25; if ($scope.get('Railway')['$=='](self.$superclass())) { return $scope.get('Class').$new($scope.get('ParamsWrapper')) } else { return ($c = ($d = $scope.get('Class').$new(self.$superclass().$params_wrapper())).$tap, $c.$$p = (TMP_25 = function(wrapper){var self = TMP_25.$$s || this, $e, hash_filter = nil; if (wrapper == null) wrapper = nil; hash_filter = self.$superclass().$params_wrapper().$hash_filter(); return wrapper.$instance_variable_set("@hash_filter", (($e = hash_filter !== false && hash_filter !== nil && hash_filter != null) ? hash_filter.$dup() : hash_filter));}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25), $c).call($d) }}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24), $a).call($b, self, "@params_wrapper"); }, TMP_26.$$arity = 0), nil) && 'params_wrapper'; })($scope.base, null); })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/railway/run"] = function(Opal) { function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$attr_reader', '$tracks', '$class', '$merge', '$zero?', '$count', '$is_a?', '$[]', '$==', '$<', '$proc', '$run', '$params', '$instance_method', '$each', '$define_method', '$<<', '$to_opts', '$to_s', '$raise', '$new', '$then', '$apply', '$fail', '$!=', '$method', '$arity', '$instance_exec', '$to_proc', '$rejected?', '$error', '$resolved?', '$value', '$state', '$result', '$has_errors?', '$instance_variable_get', '$call', '$bind', '$resolve', '$reject']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Operation(){}; var self = $Operation = $klass($base, $super, 'Operation', $Operation); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Exit(){}; var self = $Exit = $klass($base, $super, 'Exit', $Exit); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.$attr_reader("state"); self.$attr_reader("result"); return (Opal.defn(self, '$initialize', TMP_1 = function $$initialize(state, result) { var self = this; self.state = state; return self.result = result; }, TMP_1.$$arity = 2), nil) && 'initialize'; })($scope.base, $scope.get('StandardError')); return (function($base, $super) { function $Railway(){}; var self = $Railway = $klass($base, $super, 'Railway', $Railway); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_11, TMP_13, TMP_14, TMP_15, TMP_17, TMP_18; def.last_result = def.state = def.operation = nil; Opal.defn(self, '$tracks', TMP_2 = function $$tracks() { var self = this; return self.$class().$tracks(); }, TMP_2.$$arity = 0); (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_3, TMP_5, $a, $b, TMP_6, TMP_8, TMP_9; Opal.defn(self, '$tracks', TMP_3 = function $$tracks() { var $a, self = this; if (self.tracks == null) self.tracks = nil; return ((($a = self.tracks) !== false && $a !== nil && $a != null) ? $a : self.tracks = []); }, TMP_3.$$arity = 0); Opal.defn(self, '$to_opts', TMP_5 = function $$to_opts(tie, args, block) { var $a, $b, TMP_4, self = this, scope = nil; return (function() {if ((($a = args.$count()['$zero?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $hash2(["run"], {"run": block}) } else if ((($a = args['$[]'](0)['$is_a?']($scope.get('Hash'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $hash2(["scope", "run"], {"scope": (function() {if ((($a = args['$[]'](0)['$[]']("class")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "class" } else { return args['$[]'](0)['$[]']("scope") }; return nil; })(), "run": ((($a = ((($b = args['$[]'](0)['$[]']("class")) !== false && $b !== nil && $b != null) ? $b : args['$[]'](0)['$[]']("run"))) !== false && $a !== nil && $a != null) ? $a : block)}) } else if ((($a = (($b = args['$[]'](0)['$==']("class")) ? block : args['$[]'](0)['$==']("class"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $hash2(["run", "scope"], {"run": block, "scope": "class"}) } else if ((($a = ($b = args['$[]'](0)['$is_a?']($scope.get('Class')), $b !== false && $b !== nil && $b != null ?$rb_lt(args['$[]'](0), $scope.get('Operation')) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $hash2(["run"], {"run": ($a = ($b = self).$proc, $a.$$p = (TMP_4 = function(){var self = TMP_4.$$s || this; return args['$[]'](0).$run(self.$params())}, TMP_4.$$s = self, TMP_4.$$arity = 0, TMP_4), $a).call($b)}) } else { if ((($a = args['$[]'](1)['$is_a?']($scope.get('Hash'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { scope = args['$[]'](1)['$[]']("scope")}; return $hash2(["run", "scope"], {"run": args['$[]'](0), "scope": scope}); }; return nil; })().$merge($hash2(["tie"], {"tie": self.$instance_method(tie)})); }, TMP_5.$$arity = 3); ($a = ($b = ["step", "failed", "async"]).$each, $a.$$p = (TMP_6 = function(tie){var self = TMP_6.$$s || this, $c, $d, TMP_7; if (tie == null) tie = nil; return ($c = ($d = self).$define_method, $c.$$p = (TMP_7 = function($e_rest){var self = TMP_7.$$s || this, block, args; block = TMP_7.$$p || nil, TMP_7.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return self.$tracks()['$<<'](self.$to_opts(tie, args, block))}, TMP_7.$$s = self, TMP_7.$$arity = -1, TMP_7), $c).call($d, ("add_" + tie.$to_s()))}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $a).call($b); Opal.defn(self, '$abort!', TMP_8 = function(arg) { var self = this; return self.$raise($scope.get('Exit').$new("failed", arg)); }, TMP_8.$$arity = 1); return (Opal.defn(self, '$succeed!', TMP_9 = function(arg) { var self = this; return self.$raise($scope.get('Exit').$new("success", arg)); }, TMP_9.$$arity = 1), nil) && 'succeed!'; })(Opal.get_singleton_class(self)); Opal.defn(self, '$step', TMP_11 = function $$step(opts) { var $a, $b, TMP_10, self = this; if ((($a = self.last_result['$is_a?']($scope.get('Promise'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.last_result = ($a = ($b = self.last_result).$then, $a.$$p = (TMP_10 = function($c_rest){var self = TMP_10.$$s || this, result; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } result = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { result[$arg_idx - 0] = arguments[$arg_idx]; } self.last_result = result; return self.$apply(opts, "in_promise");}, TMP_10.$$s = self, TMP_10.$$arity = -1, TMP_10), $a).call($b) } else if (self.state['$==']("success")) { return self.$apply(opts) } else { return nil }; }, TMP_11.$$arity = 1); Opal.defn(self, '$failed', TMP_13 = function $$failed(opts) { var $a, $b, TMP_12, self = this; if ((($a = self.last_result['$is_a?']($scope.get('Promise'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.last_result = ($a = ($b = self.last_result).$fail, $a.$$p = (TMP_12 = function(e){var self = TMP_12.$$s || this, $c; if (self.last_result == null) self.last_result = nil; if (e == null) e = nil; self.last_result = e; self.$apply(opts, "in_promise"); if ((($c = self.last_result['$is_a?']($scope.get('Exception'))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$raise(self.last_result)}; return self.$raise(e);}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12), $a).call($b) } else if (self.state['$==']("failed")) { return self.$apply(opts) } else { return nil }; }, TMP_13.$$arity = 1); Opal.defn(self, '$async', TMP_14 = function $$async(opts) { var $a, self = this; if ((($a = self.state['$!=']("failed")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$apply(opts) } else { return nil }; }, TMP_14.$$arity = 1); Opal.defn(self, '$apply', TMP_15 = function $$apply(opts, in_promise) { var $a, $b, $c, $d, $e, self = this, args = nil, instance = nil, block = nil, e = nil; if (in_promise == null) { in_promise = nil; } try { if (opts['$[]']("scope")['$==']("class")) { args = [self.operation].concat(Opal.to_a(self.last_result)); instance = self.operation.$class(); } else { args = self.last_result; instance = self.operation; }; block = opts['$[]']("run"); if ((($a = block['$is_a?']($scope.get('Symbol'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { block = instance.$method(block)}; self.last_result = (function() {if ((($a = block.$arity()['$zero?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = instance).$instance_exec, $a.$$p = block.$to_proc(), $a).call($b) } else if ((($a = ($c = args['$is_a?']($scope.get('Array')), $c !== false && $c !== nil && $c != null ?block.$arity()['$=='](args.$count()) : $c)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($c = instance).$instance_exec, $a.$$p = block.$to_proc(), $a).apply($c, Opal.to_a(args)) } else { return ($a = ($d = instance).$instance_exec, $a.$$p = block.$to_proc(), $a).call($d, args) }; return nil; })(); if ((($a = self.last_result['$is_a?']($scope.get('Promise'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return self.last_result }; if ((($a = self.last_result['$rejected?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise(self.last_result.$error())}; if ((($a = self.last_result['$resolved?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.last_result = self.last_result.$value()}; return self.last_result; } catch ($err) { if (Opal.rescue($err, [$scope.get('Exit')])) {e = $err; try { self.state = e.$state(); self.last_result = (function() {if ((($a = (((($e = e.$state()['$!=']("failed")) !== false && $e !== nil && $e != null) ? $e : e.$result()['$is_a?']($scope.get('Exception'))))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return e.$result() } else { return e }; return nil; })(); return self.$raise(e); } finally { Opal.pop_exception() } } else if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { self.state = "failed"; self.last_result = e; if (in_promise !== false && in_promise !== nil && in_promise != null) { self.$raise(e)}; } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_15.$$arity = -2); Opal.defn(self, '$run', TMP_17 = function $$run() { var $a, $b, TMP_16, self = this; try { if ((($a = ((($b = self.operation['$has_errors?']()) !== false && $b !== nil && $b != null) ? $b : self.state)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { ((($a = self.last_result) !== false && $a !== nil && $a != null) ? $a : self.last_result = $scope.get('ValidationException').$new(self.operation.$instance_variable_get("@errors"))); if ((($a = self.state) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; self.state = "failed"; } else { self.state = "success" }; return ($a = ($b = self.$tracks()).$each, $a.$$p = (TMP_16 = function(opts){var self = TMP_16.$$s || this; if (opts == null) opts = nil; return opts['$[]']("tie").$bind(self).$call(opts)}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16), $a).call($b); } catch ($err) { if (Opal.rescue($err, [$scope.get('Exit')])) { try { return nil } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_17.$$arity = 0); return (Opal.defn(self, '$result', TMP_18 = function $$result() { var $a, self = this; if ((($a = self.last_result['$is_a?']($scope.get('Promise'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.last_result}; return self.last_result = (function() {if (self.state['$==']("success")) { return $scope.get('Promise').$new().$resolve(self.last_result) } else { return $scope.get('Promise').$new().$reject(self.last_result) }; return nil; })(); }, TMP_18.$$arity = 0), nil) && 'result'; })($scope.base, null); })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/railway/validations"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$validations', '$class', '$add_error', '$+', '$to_s', '$[]', '$<<', '$add_validation', '$instance_eval', '$to_proc', '$==', '$state', '$raise', '$new', '$result', '$each_with_index', '$is_a?', '$method', '$instance_exec', '$add_validation_error', '$===']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Operation(){}; var self = $Operation = $klass($base, $super, 'Operation', $Operation); var def = self.$$proto, $scope = self.$$scope; return (function($base, $super) { function $Railway(){}; var self = $Railway = $klass($base, $super, 'Railway', $Railway); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_8; def.operation = nil; Opal.defn(self, '$validations', TMP_1 = function $$validations() { var self = this; return self.$class().$validations(); }, TMP_1.$$arity = 0); Opal.defn(self, '$add_validation_error', TMP_2 = function $$add_validation_error(i, e) { var self = this; return self.operation.$add_error("param validation " + ($rb_plus(i, 1)), "validation_error", e.$to_s()); }, TMP_2.$$arity = 2); (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_3, TMP_4, TMP_5; Opal.defn(self, '$validations', TMP_3 = function $$validations() { var $a, self = this; if (self.validations == null) self.validations = nil; return ((($a = self.validations) !== false && $a !== nil && $a != null) ? $a : self.validations = []); }, TMP_3.$$arity = 0); Opal.defn(self, '$add_validation', TMP_4 = function $$add_validation($a_rest) { var $b, self = this, args, $iter = TMP_4.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_4.$$p = null; if ((($b = args['$[]'](0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { block = args['$[]'](0)}; return self.$validations()['$<<'](block); }, TMP_4.$$arity = -1); return (Opal.defn(self, '$add_error', TMP_5 = function $$add_error(param, symbol, message, $a_rest) { var $b, $c, TMP_6, self = this, args, $iter = TMP_5.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 3; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 3; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 3] = arguments[$arg_idx]; } TMP_5.$$p = null; return ($b = ($c = self).$add_validation, $b.$$p = (TMP_6 = function(){var self = TMP_6.$$s || this, $a, $d, $e, e = nil; try { if ((($a = ($d = ($e = self).$instance_eval, $d.$$p = block.$to_proc(), $d).call($e)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$add_error(param, symbol, message) } else { return nil } } catch ($err) { if (Opal.rescue($err, [$scope.get('Exit')])) {e = $err; try { if (e.$state()['$==']("failed")) { } else { self.$raise(e) }; self.$add_error(param, symbol, message); return self.$raise($scope.get('Exit').$new("abort_from_add_error", e.$result())); } finally { Opal.pop_exception() } } else { throw $err; } }}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6), $b).call($c); }, TMP_5.$$arity = -4), nil) && 'add_error'; })(Opal.get_singleton_class(self)); return (Opal.defn(self, '$process_validations', TMP_8 = function $$process_validations() {try { var $a, $b, TMP_7, self = this; return ($a = ($b = self.$validations()).$each_with_index, $a.$$p = (TMP_7 = function(validator, i){var self = TMP_7.$$s || this, $c, $d, $e, e = nil, $case = nil; if (self.operation == null) self.operation = nil; if (validator == null) validator = nil;if (i == null) i = nil; try { if ((($c = validator['$is_a?']($scope.get('Symbol'))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { validator = self.operation.$method(validator)}; if ((($c = ($d = ($e = self.operation).$instance_exec, $d.$$p = validator.$to_proc(), $d).call($e)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return nil;}; return self.$add_validation_error(i, "param validation " + ($rb_plus(i, 1)) + " failed"); } catch ($err) { if (Opal.rescue($err, [$scope.get('Exit')])) {e = $err; try { $case = e.$state();if ("success"['$===']($case)) {self.$add_validation_error(i, "illegal use of succeed! in validation")}else if ("failed"['$===']($case)) {self.$add_validation_error(i, "param validation " + ($rb_plus(i, 1)) + " aborted")}; self.state = "failed"; Opal.ret(nil); } finally { Opal.pop_exception() } } else if (Opal.rescue($err, [$scope.get('AccessViolation')])) {e = $err; try { self.$add_validation_error(i, e); self.state = "failed"; self.last_result = e; Opal.ret(nil); } finally { Opal.pop_exception() } } else if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { self.$add_validation_error(i, e) } finally { Opal.pop_exception() } } else { throw $err; } }}, TMP_7.$$s = self, TMP_7.$$arity = 2, TMP_7), $a).call($b); } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_8.$$arity = 0), nil) && 'process_validations'; })($scope.base, null) })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/server_op"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$==', '$combine_arg_array', '$params_wrapper', '$_Railway', '$serialize_params', '$fail', '$new', '$[]', '$json', '$then', '$deserialize_response', '$post', '$to_json', '$name', '$opts', '$class_eval', '$method_defined?', '$raise', '$serialize_response', '$run', '$constantize', '$URI', '$host', '$port', '$path', '$scheme', '$use_ssl=', '$verify_mode=', '$body=', '$resolve', '$request', '$reject', '$!=', '$lock', '$deserialize_dispatch', '$each', '$call', '$receivers']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ServerOp(){}; var self = $ServerOp = $klass($base, $super, 'ServerOp', $ServerOp); var def = self.$$proto, $scope = self.$$scope; return (function(self) { var $scope = self.$$scope, def = self.$$proto, TMP_3, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, $a, TMP_17; if ($scope.get('RUBY_ENGINE')['$==']("opal")) { Opal.defn(self, '$run', TMP_3 = function $$run($a_rest) { var $b, $c, TMP_1, $d, $e, TMP_2, self = this, args, hash = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } hash = self.$_Railway().$params_wrapper().$combine_arg_array(args); hash = self.$serialize_params(hash); return ($b = ($c = ($d = ($e = $scope.get('HTTP').$post("" + (window.HyperloopEnginePath) + "/execute_remote", $hash2(["payload", "headers"], {"payload": $hash2(["json"], {"json": $hash2(["operation", "params"], {"operation": self.$name(), "params": hash}).$to_json()}), "headers": $hash2(["X-CSRF-Token"], {"X-CSRF-Token": (($scope.get('Hyperloop')).$$scope.get('ClientDrivers')).$opts()['$[]']("form_authenticity_token")})}))).$then, $d.$$p = (TMP_2 = function(response){var self = TMP_2.$$s || this; if (response == null) response = nil; return self.$deserialize_response(response.$json()['$[]']("response"))}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $d).call($e)).$fail, $b.$$p = (TMP_1 = function(response){var self = TMP_1.$$s || this; if (response == null) response = nil; return $scope.get('Exception').$new(response.$json()['$[]']("error"))}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $b).call($c); }, TMP_3.$$arity = -1)}; Opal.defn(self, '$run_from_client', TMP_7 = function $$run_from_client(security_param, operation, params) {try { var $a, $b, TMP_4, self = this, e = nil; try { return ($a = ($b = operation.$constantize()).$class_eval, $a.$$p = (TMP_4 = function(){var self = TMP_4.$$s || this, $c, $d, TMP_5, $e, $f, TMP_6; if ((($c = self.$_Railway().$params_wrapper()['$method_defined?'](security_param)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { self.$raise($scope.get('AccessViolation')) }; return ($c = ($d = ($e = ($f = self.$run(params)).$then, $e.$$p = (TMP_6 = function(r){var self = TMP_6.$$s || this; if (r == null) r = nil; Opal.ret($hash2(["json"], {"json": $hash2(["response"], {"response": self.$serialize_response(r)})}))}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $e).call($f)).$fail, $c.$$p = (TMP_5 = function(e){var self = TMP_5.$$s || this; if (e == null) e = nil; Opal.ret($hash2(["json", "status"], {"json": $hash2(["error"], {"error": e}), "status": 500}))}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $c).call($d);}, TMP_4.$$s = self, TMP_4.$$arity = 0, TMP_4), $a).call($b) } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { return $hash2(["json", "status"], {"json": $hash2(["error"], {"error": e}), "status": 500}) } finally { Opal.pop_exception() } } else { throw $err; } }; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_7.$$arity = 3); Opal.defn(self, '$remote', TMP_8 = function $$remote(path, $a_rest) { var $b, $c, self = this, args, promise = nil, uri = nil, http = nil, request = nil, e = nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } try { promise = $scope.get('Promise').$new(); uri = self.$URI("" + (path) + "execute_remote_api"); http = (($scope.get('Net')).$$scope.get('HTTP')).$new(uri.$host(), uri.$port()); request = (((($scope.get('Net')).$$scope.get('HTTP'))).$$scope.get('Post')).$new(uri.$path(), $hash2(["Content-Type"], {"Content-Type": "application/json"})); if (uri.$scheme()['$==']("https")) { (($b = [true]), $c = http, $c['$use_ssl='].apply($c, $b), $b[$b.length-1]); (($b = [(((($scope.get('OpenSSL')).$$scope.get('SSL'))).$$scope.get('VERIFY_NONE'))]), $c = http, $c['$verify_mode='].apply($c, $b), $b[$b.length-1]);}; (($b = [$hash2(["operation", "params"], {"operation": self.$name(), "params": (((($scope.get('Hyperloop')).$$scope.get('Operation'))).$$scope.get('ParamsWrapper')).$combine_arg_array(args)}).$to_json()]), $c = request, $c['$body='].apply($c, $b), $b[$b.length-1]); return promise.$resolve(http.$request(request)); } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err; try { return promise.$reject(e) } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_8.$$arity = -2); Opal.defn(self, '$serialize_params', TMP_9 = function $$serialize_params(hash) { var self = this; return hash; }, TMP_9.$$arity = 1); Opal.defn(self, '$deserialize_params', TMP_10 = function $$deserialize_params(hash) { var self = this; return hash; }, TMP_10.$$arity = 1); Opal.defn(self, '$serialize_response', TMP_11 = function $$serialize_response(hash) { var self = this; return hash; }, TMP_11.$$arity = 1); Opal.defn(self, '$deserialize_response', TMP_12 = function $$deserialize_response(hash) { var self = this; return hash; }, TMP_12.$$arity = 1); Opal.defn(self, '$serialize_dispatch', TMP_13 = function $$serialize_dispatch(hash) { var self = this; return hash; }, TMP_13.$$arity = 1); Opal.defn(self, '$deserialize_dispatch', TMP_14 = function $$deserialize_dispatch(hash) { var self = this; return hash; }, TMP_14.$$arity = 1); Opal.defn(self, '$dispatch_to', TMP_15 = function $$dispatch_to($a_rest) { var $b, self = this, args, $iter = TMP_15.$$p, regulation = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } TMP_15.$$p = null; if ((($b = $scope.get('RUBY_ENGINE')['$!=']("opal")) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { return nil }; }, TMP_15.$$arity = -1); if ((($a = $scope.get('RUBY_ENGINE')['$!=']("opal")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {}; return (Opal.defn(self, '$dispatch_from_server', TMP_17 = function $$dispatch_from_server(params_hash) { var $a, $b, TMP_16, self = this, params = nil; params = self.$_Railway().$params_wrapper().$new(self.$deserialize_dispatch(params_hash)).$lock(); return ($a = ($b = self.$_Railway().$receivers()).$each, $a.$$p = (TMP_16 = function(receiver){var self = TMP_16.$$s || this; if (receiver == null) receiver = nil; return receiver.$call(params)}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16), $a).call($b); }, TMP_17.$$arity = 1), nil) && 'dispatch_from_server'; })(Opal.get_singleton_class(self)) })($scope.base, $scope.get('Operation')) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation/boot"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$inherited', '$add_receiver', '$to_proc', '$_Railway', '$initialize_client_drivers_on_boot', '$_run', '$respond_to?', '$each', '$on_dispatch', '$receivers']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Application(){}; var self = $Application = $klass($base, $super, 'Application', $Application); var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_3; if ((($a = ($scope.Boot != null)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { $scope.get('Operation').$inherited($scope.get('Boot'))}; (function($base, $super) { function $Boot(){}; var self = $Boot = $klass($base, $super, 'Boot', $Boot); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2; Opal.defs(self, '$on_dispatch', TMP_1 = function $$on_dispatch() { var $a, $b, self = this, $iter = TMP_1.$$p, block = $iter || nil; TMP_1.$$p = null; return ($a = ($b = self.$_Railway()).$add_receiver, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_1.$$arity = 0); return (Opal.defs(self, '$run', TMP_2 = function $$run($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } $scope.get('ClientDrivers').$initialize_client_drivers_on_boot(); return ($b = self).$_run.apply($b, Opal.to_a(args)); }, TMP_2.$$arity = -1), nil) && 'run'; })($scope.base, $scope.get('Operation')); if ((($a = $scope.get('Boot')['$respond_to?']("receivers")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = $scope.get('Boot').$receivers()).$each, $a.$$p = (TMP_3 = function(r){var self = TMP_3.$$s || this, $c, $d; if (r == null) r = nil; return ($c = ($d = $scope.get('Boot')).$on_dispatch, $c.$$p = r.$to_proc(), $c).call($d)}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $a).call($b) } else { return nil }; })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyper-operation"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $hash2 = Opal.hash2, $klass = Opal.klass; Opal.add_stubs(['$require', '$import', '$==']); self.$require("hyper-operation/version"); self.$require("hyperloop-config"); $scope.get('Hyperloop').$import("browser/interval", $hash2(["client_only"], {"client_only": true})); $scope.get('Hyperloop').$import("hyper-operation"); if ($scope.get('RUBY_ENGINE')['$==']("opal")) { self.$require("active_support/core_ext/string"); self.$require("mutations"); self.$require("hyper-operation/filters/outbound_filter"); self.$require("hyper-component"); self.$require("hyper-operation/call_by_class_name"); self.$require("hyper-operation/transport/client_drivers"); (function($base, $super) { function $HashWithIndifferentAccess(){}; var self = $HashWithIndifferentAccess = $klass($base, $super, 'HashWithIndifferentAccess', $HashWithIndifferentAccess); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('Hash')); (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); var def = self.$$proto, $scope = self.$$scope, TMP_1; return (Opal.defn(self, '$titleize', TMP_1 = function $$titleize() { var self = this; return self; }, TMP_1.$$arity = 0), nil) && 'titleize' })($scope.base, null); self.$require("hyper-operation/exception"); self.$require("hyper-operation/promise"); self.$require("hyper-operation/railway"); self.$require("hyper-operation/api"); self.$require("hyper-operation/railway/dispatcher"); self.$require("hyper-operation/railway/params_wrapper"); self.$require("hyper-operation/railway/run"); self.$require("hyper-operation/railway/validations"); self.$require("hyper-operation/server_op"); return self.$require("hyper-operation/boot");}; }; /* Generated by Opal 0.10.4 */ Opal.modules["react/top_level_render"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$!', '$to_n', '$raise']); return (function($base) { var $React, self = $React = $module($base, 'React'); var def = self.$$proto, $scope = self.$$scope, TMP_1; Opal.defs(self, '$render', TMP_1 = function $$render(element, container) { var $a, self = this, $iter = TMP_1.$$p, $yield = $iter || nil, cb = nil, native$ = nil; TMP_1.$$p = null; container = container.$$class ? container[0] : container; cb = function(){ setTimeout(function(){ (function() {if (($yield !== nil)) { return Opal.yieldX($yield, []); } else { return nil }; return nil; })() }, 0) } ; if ((($a = ((typeof ReactDOM === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { native$ = ReactDOM.render(element.$to_n(), container, cb) } else if ((($a = ((typeof React.renderToString === 'undefined'))['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { native$ = React.render(element.$to_n(), container, cb) } else { self.$raise("render is not defined. In React >= v15 you must import it with ReactDOM") }; if ((($a = native$._getOpalInstance !== undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return native$._getOpalInstance(); } else if ((($a = React.findDOMNode !== undefined && native$.nodeType === undefined) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return React.findDOMNode(native$); } else { return native$ }; }, TMP_1.$$arity = 2) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/parser/sexp"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $range = Opal.range, $hash2 = Opal.hash2; Opal.add_stubs(['$attr_reader', '$attr_accessor', '$[]', '$[]=', '$send', '$to_proc', '$<<', '$push', '$concat', '$new', '$dup', '$is_a?', '$==', '$array', '$join', '$map', '$inspect', '$line']); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Sexp(){}; var self = $Sexp = $klass($base, $super, 'Sexp', $Sexp); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_16, TMP_18; def.array = def.meta = def.source = nil; self.$attr_reader("array"); self.$attr_accessor("source"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(args) { var self = this; return self.array = args; }, TMP_1.$$arity = 1); Opal.defn(self, '$type', TMP_2 = function $$type() { var self = this; return self.array['$[]'](0); }, TMP_2.$$arity = 0); Opal.defn(self, '$type=', TMP_3 = function(type) { var self = this; return self.array['$[]='](0, type); }, TMP_3.$$arity = 1); Opal.defn(self, '$children', TMP_4 = function $$children() { var self = this; return self.array['$[]']($range(1, -1, false)); }, TMP_4.$$arity = 0); Opal.defn(self, '$meta', TMP_5 = function $$meta() { var $a, self = this; return ((($a = self.meta) !== false && $a !== nil && $a != null) ? $a : self.meta = $hash2([], {})); }, TMP_5.$$arity = 0); Opal.defn(self, '$method_missing', TMP_6 = function $$method_missing(sym, $a_rest) { var $b, $c, self = this, args, $iter = TMP_6.$$p, block = $iter || nil; var $args_len = arguments.length, $rest_len = $args_len - 1; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 1] = arguments[$arg_idx]; } TMP_6.$$p = null; return ($b = ($c = self.array).$send, $b.$$p = block.$to_proc(), $b).apply($c, [sym].concat(Opal.to_a(args))); }, TMP_6.$$arity = -2); Opal.defn(self, '$<<', TMP_7 = function(other) { var self = this; self.array['$<<'](other); return self; }, TMP_7.$$arity = 1); Opal.defn(self, '$push', TMP_8 = function $$push($a_rest) { var $b, self = this, parts; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } parts = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { parts[$arg_idx - 0] = arguments[$arg_idx]; } ($b = self.array).$push.apply($b, Opal.to_a(parts)); return self; }, TMP_8.$$arity = -1); Opal.defn(self, '$concat', TMP_9 = function $$concat(children) { var self = this; self.array.$concat(children); return self; }, TMP_9.$$arity = 1); Opal.defn(self, '$to_ary', TMP_10 = function $$to_ary() { var self = this; return self.array; }, TMP_10.$$arity = 0); Opal.defn(self, '$dup', TMP_11 = function $$dup() { var self = this; return $scope.get('Sexp').$new(self.array.$dup()); }, TMP_11.$$arity = 0); Opal.defn(self, '$==', TMP_12 = function(other) { var $a, self = this; if ((($a = other['$is_a?']($scope.get('Sexp'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.array['$=='](other.$array()) } else { return self.array['$=='](other) }; }, TMP_12.$$arity = 1); Opal.alias(self, 'eql?', '=='); Opal.defn(self, '$line', TMP_13 = function $$line() { var $a, self = this; return ($a = self.source, $a !== false && $a !== nil && $a != null ?self.source['$[]'](0) : $a); }, TMP_13.$$arity = 0); Opal.defn(self, '$column', TMP_14 = function $$column() { var $a, self = this; return ($a = self.source, $a !== false && $a !== nil && $a != null ?self.source['$[]'](1) : $a); }, TMP_14.$$arity = 0); Opal.defn(self, '$inspect', TMP_16 = function $$inspect() { var $a, $b, TMP_15, self = this; return "(" + (($a = ($b = self.array).$map, $a.$$p = (TMP_15 = function(e){var self = TMP_15.$$s || this; if (e == null) e = nil; return e.$inspect()}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15), $a).call($b).$join(", ")) + ")"; }, TMP_16.$$arity = 0); Opal.defn(self, '$pretty_inspect', TMP_18 = function $$pretty_inspect() { var $a, $b, TMP_17, self = this; return "(" + ((function() {if ((($a = self.$line()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "" + (self.$line()) + " " } else { return "" }; return nil; })()) + (($a = ($b = self.array).$map, $a.$$p = (TMP_17 = function(e){var self = TMP_17.$$s || this; if (e == null) e = nil; return e.$inspect()}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17), $a).call($b).$join(", ")) + ")"; }, TMP_18.$$arity = 0); return Opal.alias(self, 'to_s', 'inspect'); })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["strscan"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$attr_reader', '$anchor', '$scan_until', '$length', '$size', '$rest', '$pos=', '$private']); return (function($base, $super) { function $StringScanner(){}; var self = $StringScanner = $klass($base, $super, 'StringScanner', $StringScanner); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24; def.pos = def.string = def.working = def.matched = def.prev_pos = def.match = nil; self.$attr_reader("pos"); self.$attr_reader("matched"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(string) { var self = this; self.string = string; self.pos = 0; self.matched = nil; self.working = string; return self.match = []; }, TMP_1.$$arity = 1); self.$attr_reader("string"); Opal.defn(self, '$beginning_of_line?', TMP_2 = function() { var self = this; return self.pos === 0 || self.string.charAt(self.pos - 1) === "\n"; }, TMP_2.$$arity = 0); Opal.alias(self, 'bol?', 'beginning_of_line?'); Opal.defn(self, '$scan', TMP_3 = function $$scan(pattern) { var self = this; pattern = self.$anchor(pattern); var result = pattern.exec(self.working); if (result == null) { return self.matched = nil; } else if (typeof(result) === 'object') { self.prev_pos = self.pos; self.pos += result[0].length; self.working = self.working.substring(result[0].length); self.matched = result[0]; self.match = result; return result[0]; } else if (typeof(result) === 'string') { self.pos += result.length; self.working = self.working.substring(result.length); return result; } else { return nil; } ; }, TMP_3.$$arity = 1); Opal.defn(self, '$scan_until', TMP_4 = function $$scan_until(pattern) { var self = this; pattern = self.$anchor(pattern); var pos = self.pos, working = self.working, result; while (true) { result = pattern.exec(working); pos += 1; working = working.substr(1); if (result == null) { if (working.length === 0) { return self.matched = nil; } continue; } self.matched = self.string.substr(self.pos, pos - self.pos - 1 + result[0].length); self.prev_pos = pos - 1; self.pos = pos; self.working = working.substr(result[0].length); return self.matched; } ; }, TMP_4.$$arity = 1); Opal.defn(self, '$[]', TMP_5 = function(idx) { var self = this; var match = self.match; if (idx < 0) { idx += match.length; } if (idx < 0 || idx >= match.length) { return nil; } if (match[idx] == null) { return nil; } return match[idx]; ; }, TMP_5.$$arity = 1); Opal.defn(self, '$check', TMP_6 = function $$check(pattern) { var self = this; pattern = self.$anchor(pattern); var result = pattern.exec(self.working); if (result == null) { return self.matched = nil; } return self.matched = result[0]; ; }, TMP_6.$$arity = 1); Opal.defn(self, '$check_until', TMP_7 = function $$check_until(pattern) { var self = this; var prev_pos = self.prev_pos, pos = self.pos; var result = self.$scan_until(pattern); if (result !== nil) { self.matched = result.substr(-1); self.working = self.string.substr(pos); } self.prev_pos = prev_pos; self.pos = pos; return result; ; }, TMP_7.$$arity = 1); Opal.defn(self, '$peek', TMP_8 = function $$peek(length) { var self = this; return self.working.substring(0, length); }, TMP_8.$$arity = 1); Opal.defn(self, '$eos?', TMP_9 = function() { var self = this; return self.working.length === 0; }, TMP_9.$$arity = 0); Opal.defn(self, '$exist?', TMP_10 = function(pattern) { var self = this; var result = pattern.exec(self.working); if (result == null) { return nil; } else if (result.index == 0) { return 0; } else { return result.index + 1; } ; }, TMP_10.$$arity = 1); Opal.defn(self, '$skip', TMP_11 = function $$skip(pattern) { var self = this; pattern = self.$anchor(pattern); var result = pattern.exec(self.working); if (result == null) { return self.matched = nil; } else { var match_str = result[0]; var match_len = match_str.length; self.matched = match_str; self.prev_pos = self.pos; self.pos += match_len; self.working = self.working.substring(match_len); return match_len; } ; }, TMP_11.$$arity = 1); Opal.defn(self, '$skip_until', TMP_12 = function $$skip_until(pattern) { var self = this; var result = self.$scan_until(pattern); if (result === nil) { return nil; } else { self.matched = result.substr(-1); return result.length; } ; }, TMP_12.$$arity = 1); Opal.defn(self, '$get_byte', TMP_13 = function $$get_byte() { var self = this; var result = nil; if (self.pos < self.string.length) { self.prev_pos = self.pos; self.pos += 1; result = self.matched = self.working.substring(0, 1); self.working = self.working.substring(1); } else { self.matched = nil; } return result; ; }, TMP_13.$$arity = 0); Opal.alias(self, 'getch', 'get_byte'); Opal.defn(self, '$match?', TMP_14 = function(pattern) { var self = this; pattern = self.$anchor(pattern); var result = pattern.exec(self.working); if (result == null) { return nil; } else { self.prev_pos = self.pos; return result[0].length; } ; }, TMP_14.$$arity = 1); Opal.defn(self, '$pos=', TMP_15 = function(pos) { var self = this; if (pos < 0) { pos += self.string.$length(); } ; self.pos = pos; return self.working = self.string.slice(pos); }, TMP_15.$$arity = 1); Opal.defn(self, '$post_match', TMP_16 = function $$post_match() { var self = this; if (self.matched === nil) { return nil; } return self.string.substr(self.pos); ; }, TMP_16.$$arity = 0); Opal.defn(self, '$pre_match', TMP_17 = function $$pre_match() { var self = this; if (self.matched === nil) { return nil; } return self.string.substr(0, self.prev_pos); ; }, TMP_17.$$arity = 0); Opal.defn(self, '$reset', TMP_18 = function $$reset() { var self = this; self.working = self.string; self.matched = nil; return self.pos = 0; }, TMP_18.$$arity = 0); Opal.defn(self, '$rest', TMP_19 = function $$rest() { var self = this; return self.working; }, TMP_19.$$arity = 0); Opal.defn(self, '$rest?', TMP_20 = function() { var self = this; return self.working.length !== 0; }, TMP_20.$$arity = 0); Opal.defn(self, '$rest_size', TMP_21 = function $$rest_size() { var self = this; return self.$rest().$size(); }, TMP_21.$$arity = 0); Opal.defn(self, '$terminate', TMP_22 = function $$terminate() { var $a, $b, self = this; self.match = nil; return (($a = [self.string.$length()]), $b = self, $b['$pos='].apply($b, $a), $a[$a.length-1]); }, TMP_22.$$arity = 0); Opal.defn(self, '$unscan', TMP_23 = function $$unscan() { var self = this; self.pos = self.prev_pos; self.prev_pos = nil; self.match = nil; return self; }, TMP_23.$$arity = 0); self.$private(); return (Opal.defn(self, '$anchor', TMP_24 = function $$anchor(pattern) { var self = this; return new RegExp('^(?:' + pattern.toString().substr(1, pattern.toString().length - 2) + ')'); }, TMP_24.$$arity = 1), nil) && 'anchor'; })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/parser/keywords"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$attr_accessor', '$map', '$new', '$each', '$[]=', '$name', '$[]']); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Keywords, self = $Keywords = $module($base, 'Keywords'); var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_2, TMP_4, TMP_5; (function($base, $super) { function $KeywordTable(){}; var self = $KeywordTable = $klass($base, $super, 'KeywordTable', $KeywordTable); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.$attr_accessor("name", "id", "state"); return (Opal.defn(self, '$initialize', TMP_1 = function $$initialize(name, id, state) { var self = this; self.name = name; self.id = id; return self.state = state; }, TMP_1.$$arity = 3), nil) && 'initialize'; })($scope.base, null); Opal.cdecl($scope, 'KEYWORDS', ($a = ($b = [["__LINE__", ["k__LINE__", "k__LINE__"], "expr_end"], ["__FILE__", ["k__FILE__", "k__FILE__"], "expr_end"], ["alias", ["kALIAS", "kALIAS"], "expr_fname"], ["and", ["kAND", "kAND"], "expr_beg"], ["begin", ["kBEGIN", "kBEGIN"], "expr_beg"], ["break", ["kBREAK", "kBREAK"], "expr_mid"], ["case", ["kCASE", "kCASE"], "expr_beg"], ["class", ["kCLASS", "kCLASS"], "expr_class"], ["def", ["kDEF", "kDEF"], "expr_fname"], ["defined?", ["kDEFINED", "kDEFINED"], "expr_arg"], ["do", ["kDO", "kDO"], "expr_beg"], ["else", ["kELSE", "kELSE"], "expr_beg"], ["elsif", ["kELSIF", "kELSIF"], "expr_beg"], ["end", ["kEND", "kEND"], "expr_end"], ["ensure", ["kENSURE", "kENSURE"], "expr_beg"], ["false", ["kFALSE", "kFALSE"], "expr_end"], ["for", ["kFOR", "kFOR"], "expr_beg"], ["if", ["kIF", "kIF_MOD"], "expr_beg"], ["in", ["kIN", "kIN"], "expr_beg"], ["module", ["kMODULE", "kMODULE"], "expr_beg"], ["nil", ["kNIL", "kNIL"], "expr_end"], ["next", ["kNEXT", "kNEXT"], "expr_mid"], ["not", ["kNOT", "kNOT"], "expr_beg"], ["or", ["kOR", "kOR"], "expr_beg"], ["redo", ["kREDO", "kREDO"], "expr_end"], ["rescue", ["kRESCUE", "kRESCUE_MOD"], "expr_mid"], ["return", ["kRETURN", "kRETURN"], "expr_mid"], ["self", ["kSELF", "kSELF"], "expr_end"], ["super", ["kSUPER", "kSUPER"], "expr_arg"], ["then", ["kTHEN", "kTHEN"], "expr_beg"], ["true", ["kTRUE", "kTRUE"], "expr_end"], ["undef", ["kUNDEF", "kUNDEF"], "expr_fname"], ["unless", ["kUNLESS", "kUNLESS_MOD"], "expr_beg"], ["until", ["kUNTIL", "kUNTIL_MOD"], "expr_beg"], ["when", ["kWHEN", "kWHEN"], "expr_beg"], ["while", ["kWHILE", "kWHILE_MOD"], "expr_beg"], ["yield", ["kYIELD", "kYIELD"], "expr_arg"]]).$map, $a.$$p = (TMP_2 = function(decl){var self = TMP_2.$$s || this, $c; if (decl == null) decl = nil; return ($c = $scope.get('KeywordTable')).$new.apply($c, Opal.to_a(decl))}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($b)); Opal.defs(self, '$map', TMP_4 = function $$map() { var $a, $b, TMP_3, self = this; if (self.map == null) self.map = nil; if ((($a = self.map) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.map = $hash2([], {}); ($a = ($b = $scope.get('KEYWORDS')).$each, $a.$$p = (TMP_3 = function(k){var self = TMP_3.$$s || this; if (self.map == null) self.map = nil; if (k == null) k = nil; return self.map['$[]='](k.$name(), k)}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $a).call($b); }; return self.map; }, TMP_4.$$arity = 0); Opal.defs(self, '$keyword', TMP_5 = function $$keyword(kw) { var self = this; return self.$map()['$[]'](kw); }, TMP_5.$$arity = 1); })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/parser/lexer"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$require', '$|', '$attr_reader', '$attr_accessor', '$new', '$yylex', '$yylval', '$has_local?', '$scope', '$parser', '$to_sym', '$<<', '$&', '$>>', '$!=', '$include?', '$arg?', '$!', '$space?', '$check', '$after_operator?', '$scan', '$+', '$length', '$matched', '$pos=', '$-', '$pos', '$new_strterm', '$merge', '$yylval=', '$to_f', '$gsub', '$scanner', '$to_i', '$raise', '$peek', '$chr', '$%', '$[]', '$ord', '$downcase', '$escape', '$peek_variable_name', '$bol?', '$eos?', '$read_escape', '$join', '$count', '$lines', '$min', '$map', '$strterm', '$[]=', '$pushback', '$==', '$cond?', '$strterm=', '$match', '$add_string_content', '$line=', '$line', '$label_state?', '$end_with?', '$=~', '$keyword', '$state', '$name', '$id', '$last', '$pop', '$cmdarg?', '$here_document', '$parse_string', '$skip', '$empty?', '$new_op_asgn', '$set_arg_state', '$spcarg?', '$beg?', '$===', '$new_strterm2', '$cond_push', '$cmdarg_push', '$cond_lexpop', '$cmdarg_lexpop', '$end?', '$heredoc_identifier', '$push', '$sub', '$inspect', '$process_numeric', '$process_identifier', '$size']); self.$require("opal/regexp_anchors"); self.$require("strscan"); self.$require("opal/parser/keywords"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Lexer(){}; var self = $Lexer = $klass($base, $super, 'Lexer', $Lexer); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39; def.scanner = def.tok_line = def.tok_column = def.column = def.line = def.cond = def.lparen_arg_seen = def.cmdarg = def.lex_state = def.space_seen = def.yylval = def.scanner_stack = def.lambda_stack = def.paren_nest = def.file = nil; Opal.cdecl($scope, 'STR_FUNC_ESCAPE', 1); Opal.cdecl($scope, 'STR_FUNC_EXPAND', 2); Opal.cdecl($scope, 'STR_FUNC_REGEXP', 4); Opal.cdecl($scope, 'STR_FUNC_QWORDS', 8); Opal.cdecl($scope, 'STR_FUNC_SYMBOL', 16); Opal.cdecl($scope, 'STR_FUNC_INDENT', 32); Opal.cdecl($scope, 'STR_FUNC_XQUOTE', 64); Opal.cdecl($scope, 'STR_SQUOTE', 0); Opal.cdecl($scope, 'STR_DQUOTE', $scope.get('STR_FUNC_EXPAND')); Opal.cdecl($scope, 'STR_XQUOTE', $scope.get('STR_FUNC_EXPAND')['$|']($scope.get('STR_FUNC_XQUOTE'))); Opal.cdecl($scope, 'STR_REGEXP', $scope.get('STR_FUNC_REGEXP')['$|']($scope.get('STR_FUNC_ESCAPE'))['$|']($scope.get('STR_FUNC_EXPAND'))); Opal.cdecl($scope, 'STR_SWORD', $scope.get('STR_FUNC_QWORDS')); Opal.cdecl($scope, 'STR_DWORD', $scope.get('STR_FUNC_QWORDS')['$|']($scope.get('STR_FUNC_EXPAND'))); Opal.cdecl($scope, 'STR_SSYM', $scope.get('STR_FUNC_SYMBOL')); Opal.cdecl($scope, 'STR_DSYM', $scope.get('STR_FUNC_SYMBOL')['$|']($scope.get('STR_FUNC_EXPAND'))); self.$attr_reader("line", "column"); self.$attr_reader("scope"); self.$attr_reader("eof_content"); self.$attr_accessor("lex_state"); self.$attr_accessor("strterm"); self.$attr_accessor("scanner"); self.$attr_accessor("yylval"); self.$attr_accessor("parser"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(source, file) { var self = this; self.lex_state = "expr_beg"; self.cond = 0; self.cmdarg = 0; self.line = 1; self.tok_line = 1; self.column = 0; self.tok_column = 0; self.file = file; self.scanner = $scope.get('StringScanner').$new(source); self.scanner_stack = [self.scanner]; self.case_stmt = nil; self.paren_nest = 0; return self.lambda_stack = []; }, TMP_1.$$arity = 2); Opal.defn(self, '$next_token', TMP_2 = function $$next_token() { var self = this, token = nil, value = nil, location = nil; token = self.$yylex(); value = self.$yylval(); location = [self.tok_line, self.tok_column]; self.tok_column = self.column; self.tok_line = self.line; return [token, [value, location]]; }, TMP_2.$$arity = 0); Opal.defn(self, '$has_local?', TMP_3 = function(local) { var self = this; return self.$parser().$scope()['$has_local?'](local.$to_sym()); }, TMP_3.$$arity = 1); Opal.defn(self, '$cond_push', TMP_4 = function $$cond_push(n) { var self = this; return self.cond = (self.cond['$<<'](1))['$|']((n['$&'](1))); }, TMP_4.$$arity = 1); Opal.defn(self, '$cond_pop', TMP_5 = function $$cond_pop() { var self = this; return self.cond = self.cond['$>>'](1); }, TMP_5.$$arity = 0); Opal.defn(self, '$cond_lexpop', TMP_6 = function $$cond_lexpop() { var self = this; return self.cond = (self.cond['$>>'](1))['$|']((self.cond['$&'](1))); }, TMP_6.$$arity = 0); Opal.defn(self, '$cond?', TMP_7 = function() { var self = this; return (self.cond['$&'](1))['$!='](0); }, TMP_7.$$arity = 0); Opal.defn(self, '$cmdarg_push', TMP_8 = function $$cmdarg_push(n) { var $a, self = this; if ((($a = self.lparen_arg_seen) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return self.cmdarg = (self.cmdarg['$<<'](1))['$|']((n['$&'](1))) }; }, TMP_8.$$arity = 1); Opal.defn(self, '$cmdarg_pop', TMP_9 = function $$cmdarg_pop() { var self = this; return self.cmdarg = self.cmdarg['$>>'](1); }, TMP_9.$$arity = 0); Opal.defn(self, '$cmdarg_lexpop', TMP_10 = function $$cmdarg_lexpop() { var self = this; return self.cmdarg = (self.cmdarg['$>>'](1))['$|']((self.cmdarg['$&'](1))); }, TMP_10.$$arity = 0); Opal.defn(self, '$cmdarg?', TMP_11 = function() { var self = this; return (self.cmdarg['$&'](1))['$!='](0); }, TMP_11.$$arity = 0); Opal.defn(self, '$arg?', TMP_12 = function() { var self = this; return ["expr_arg", "expr_cmdarg"]['$include?'](self.lex_state); }, TMP_12.$$arity = 0); Opal.defn(self, '$end?', TMP_13 = function() { var self = this; return ["expr_end", "expr_endarg", "expr_endfn"]['$include?'](self.lex_state); }, TMP_13.$$arity = 0); Opal.defn(self, '$beg?', TMP_14 = function() { var self = this; return ["expr_beg", "expr_value", "expr_mid", "expr_class"]['$include?'](self.lex_state); }, TMP_14.$$arity = 0); Opal.defn(self, '$after_operator?', TMP_15 = function() { var self = this; return ["expr_fname", "expr_dot"]['$include?'](self.lex_state); }, TMP_15.$$arity = 0); Opal.defn(self, '$label_state?', TMP_16 = function() { var $a, self = this; return ((($a = ["expr_beg", "expr_endfn"]['$include?'](self.lex_state)) !== false && $a !== nil && $a != null) ? $a : self['$arg?']()); }, TMP_16.$$arity = 0); Opal.defn(self, '$spcarg?', TMP_17 = function() { var $a, $b, self = this; return ($a = ($b = self['$arg?'](), $b !== false && $b !== nil && $b != null ?self.space_seen : $b), $a !== false && $a !== nil && $a != null ?self['$space?']()['$!']() : $a); }, TMP_17.$$arity = 0); Opal.defn(self, '$space?', TMP_18 = function() { var self = this; return self.scanner.$check(/\s/); }, TMP_18.$$arity = 0); Opal.defn(self, '$set_arg_state', TMP_19 = function $$set_arg_state() { var $a, self = this; return self.lex_state = (function() {if ((($a = self['$after_operator?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "expr_arg" } else { return "expr_beg" }; return nil; })(); }, TMP_19.$$arity = 0); Opal.defn(self, '$scan', TMP_20 = function $$scan(regexp) { var $a, self = this, result = nil; if ((($a = result = self.scanner.$scan(regexp)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.column = $rb_plus(self.column, result.$length()); self.yylval = $rb_plus(self.yylval, self.scanner.$matched());}; return result; }, TMP_20.$$arity = 1); Opal.defn(self, '$skip', TMP_21 = function $$skip(regexp) { var $a, self = this, result = nil; if ((($a = result = self.scanner.$scan(regexp)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.column = $rb_plus(self.column, result.$length()); self.tok_column = self.column;}; return result; }, TMP_21.$$arity = 1); Opal.defn(self, '$check', TMP_22 = function $$check(regexp) { var self = this; return self.scanner.$check(regexp); }, TMP_22.$$arity = 1); Opal.defn(self, '$pushback', TMP_23 = function $$pushback(n) { var $a, self = this; return ($a = self.scanner, $a['$pos=']($rb_minus($a.$pos(), n))); }, TMP_23.$$arity = 1); Opal.defn(self, '$matched', TMP_24 = function $$matched() { var self = this; return self.scanner.$matched(); }, TMP_24.$$arity = 0); Opal.defn(self, '$line=', TMP_25 = function(line) { var self = this; self.column = self.tok_column = 0; return self.line = self.tok_line = line; }, TMP_25.$$arity = 1); Opal.defn(self, '$new_strterm', TMP_26 = function $$new_strterm(func, term, paren) { var self = this; return $hash2(["type", "func", "term", "paren"], {"type": "string", "func": func, "term": term, "paren": paren}); }, TMP_26.$$arity = 3); Opal.defn(self, '$new_strterm2', TMP_27 = function $$new_strterm2(func, term, paren) { var self = this; term = self.$new_strterm(func, term, paren); return term.$merge($hash2(["balance", "nesting"], {"balance": true, "nesting": 0})); }, TMP_27.$$arity = 3); Opal.defn(self, '$new_op_asgn', TMP_28 = function $$new_op_asgn(value) { var $a, $b, self = this; (($a = [value]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); self.lex_state = "expr_beg"; return "tOP_ASGN"; }, TMP_28.$$arity = 1); Opal.defn(self, '$process_numeric', TMP_29 = function $$process_numeric() { var $a, $b, self = this; self.lex_state = "expr_end"; if ((($a = self.$scan(/[\d_]+\.[\d_]+\b|[\d_]+(\.[\d_]+)?[eE][-+]?[\d_]+\b/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = [self.$scanner().$matched().$gsub(/_/, "").$to_f()]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tFLOAT"; } else if ((($a = self.$scan(/([^0][\d_]*|0)\b/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = [self.$scanner().$matched().$gsub(/_/, "").$to_i()]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tINTEGER"; } else if ((($a = self.$scan(/0[bB](0|1|_)+/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = [self.$scanner().$matched().$to_i(2)]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tINTEGER"; } else if ((($a = self.$scan(/0[xX](\d|[a-f]|[A-F]|_)+/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = [self.$scanner().$matched().$to_i(16)]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tINTEGER"; } else if ((($a = self.$scan(/0[oO]?([0-7]|_)+/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = [self.$scanner().$matched().$to_i(8)]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tINTEGER"; } else if ((($a = self.$scan(/0[dD]([0-9]|_)+/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = [self.$scanner().$matched().$gsub(/_/, "").$to_i()]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tINTEGER"; } else { return self.$raise("Lexing error on numeric type: `" + (self.$scanner().$peek(5)) + "`") }; }, TMP_29.$$arity = 0); Opal.defn(self, '$read_escape', TMP_30 = function $$read_escape() { var $a, self = this; if ((($a = self.$scan(/\\/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "\\" } else if ((($a = self.$scan(/n/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "\n" } else if ((($a = self.$scan(/t/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "\t" } else if ((($a = self.$scan(/r/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "\r" } else if ((($a = self.$scan(/f/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "\f" } else if ((($a = self.$scan(/v/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "\v" } else if ((($a = self.$scan(/a/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "\u0007" } else if ((($a = self.$scan(/b/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "\b" } else if ((($a = self.$scan(/e/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "\u001b" } else if ((($a = self.$scan(/s/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return " " } else if ((($a = self.$scan(/[0-7]{1,3}/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (self.$matched().$to_i(8)['$%'](256)).$chr() } else if ((($a = self.$scan(/x([0-9a-fA-F]{1,2})/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$scanner()['$[]'](1).$to_i(16).$chr() } else if ((($a = self.$scan(/u([0-9a-zA-Z]{1,4})/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$scanner()['$[]'](1).$to_i(16).$chr((($scope.get('Encoding')).$$scope.get('UTF_8'))) } else if ((($a = self.$scan(/C-([a-zA-Z])/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($rb_plus($rb_minus(self.$scanner()['$[]'](1).$downcase().$ord(), "a".$ord()), "1".$to_i(16))).$chr((($scope.get('Encoding')).$$scope.get('UTF_8'))) } else if ((($a = self.$scan(/C-([0-9])/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($rb_plus($rb_minus(self.$scanner()['$[]'](1).$ord(), "0".$ord()), "10".$to_i(16))).$chr((($scope.get('Encoding')).$$scope.get('UTF_8'))) } else if ((($a = self.$scan(/M-\\C-([a-zA-Z])/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($rb_plus($rb_minus(self.$scanner()['$[]'](1).$downcase().$ord(), "a".$ord()), "81".$to_i(16))).$chr((($scope.get('Encoding')).$$scope.get('UTF_8'))) } else if ((($a = self.$scan(/M-\\C-([0-9])/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($rb_plus($rb_minus(self.$scanner()['$[]'](1).$ord(), "0".$ord()), "90".$to_i(16))).$chr((($scope.get('Encoding')).$$scope.get('UTF_8'))) } else { return self.$scan(/./) }; }, TMP_30.$$arity = 0); Opal.defn(self, '$peek_variable_name', TMP_31 = function $$peek_variable_name() { var $a, self = this; if ((($a = self.$check(/[@$]/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "tSTRING_DVAR" } else if ((($a = self.$scan(/\{/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "tSTRING_DBEG" } else { return nil }; }, TMP_31.$$arity = 0); Opal.defn(self, '$here_document', TMP_34 = function $$here_document(str_parse) { var $a, $b, $c, TMP_32, TMP_33, $d, self = this, eos_regx = nil, expand = nil, escape = nil, str_buffer = nil, tok = nil, reg = nil, complete_str = nil, lines = nil, min_indent = nil; eos_regx = (new RegExp("[ \\t]*" + $scope.get('Regexp').$escape(str_parse['$[]']("term")) + "(\\r*\\n|$)")); expand = (str_parse['$[]']("func")['$&']($scope.get('STR_FUNC_EXPAND')))['$!='](0); escape = str_parse['$[]']("func")['$!=']($scope.get('STR_SQUOTE')); if ((($a = self.$check(eos_regx)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$scan((new RegExp("[ \\t]*" + $scope.get('Regexp').$escape(str_parse['$[]']("term"))))); if ((($a = str_parse['$[]']("scanner")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.scanner_stack['$<<'](str_parse['$[]']("scanner")); self.scanner = str_parse['$[]']("scanner");}; return "tSTRING_END";}; str_buffer = []; if ((($a = self.$scan(/#/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = tok = self.$peek_variable_name()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return tok}; str_buffer['$<<']("#");}; while (!((($b = ($c = self.$check(eos_regx), $c !== false && $c !== nil && $c != null ?self.$scanner()['$bol?']() : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true)))) { if ((($b = self.$scanner()['$eos?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$raise("reached EOF while in heredoc")}; if ((($b = self.$scan(/\n/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { str_buffer['$<<'](self.$scanner().$matched()) } else if ((($b = (($c = expand !== false && expand !== nil && expand != null) ? self.$check(/#(?=[\$\@\{])/) : expand)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { break; } else if ((($b = self.$scan(/\\/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { str_buffer['$<<'](((function() {if (escape !== false && escape !== nil && escape != null) { return self.$read_escape() } else { return self.$scanner().$matched() }; return nil; })())) } else { reg = $scope.get('Regexp').$new("[^#\u0000\\\\\n]+|."); self.$scan(reg); str_buffer['$<<'](self.$scanner().$matched()); };}; complete_str = str_buffer.$join(""); self.line = $rb_plus(self.line, complete_str.$count("\n")); if ((($a = str_parse['$[]']("squiggly_heredoc")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { lines = complete_str.$lines(); min_indent = ($a = ($b = lines).$map, $a.$$p = (TMP_32 = function(line){var self = TMP_32.$$s || this; if (line == null) line = nil; return line.$scan((new RegExp("" + $scope.get('REGEXP_START') + "\\s+")))['$[]'](0).$length()}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32), $a).call($b).$min(); complete_str = ($a = ($c = lines).$map, $a.$$p = (TMP_33 = function(line){var self = TMP_33.$$s || this; if (line == null) line = nil; return line['$[]'](min_indent, line.$length())}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33), $a).call($c).$join();}; (($a = [complete_str]), $d = self, $d['$yylval='].apply($d, $a), $a[$a.length-1]); return "tSTRING_CONTENT"; }, TMP_34.$$arity = 1); Opal.defn(self, '$parse_string', TMP_35 = function $$parse_string() { var $a, $b, self = this, str_parse = nil, func = nil, space = nil, qwords = nil, expand = nil, regexp = nil, str_buffer = nil, complete_str = nil; str_parse = self.$strterm(); func = str_parse['$[]']("func"); space = false; qwords = (func['$&']($scope.get('STR_FUNC_QWORDS')))['$!='](0); expand = (func['$&']($scope.get('STR_FUNC_EXPAND')))['$!='](0); regexp = (func['$&']($scope.get('STR_FUNC_REGEXP')))['$!='](0); if ((($a = (($b = qwords !== false && qwords !== nil && qwords != null) ? self.$scan(/\s+/) : qwords)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { space = true}; str_buffer = []; if ((($a = self.$scan($scope.get('Regexp').$new($scope.get('Regexp').$escape(str_parse['$[]']("term"))))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = (($b = qwords !== false && qwords !== nil && qwords != null) ? str_parse['$[]']("done_last_space")['$!']() : qwords)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { str_parse['$[]=']("done_last_space", true); self.$pushback(1); (($a = [" "]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tSPACE";}; if ((($a = str_parse['$[]']("balance")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if (str_parse['$[]']("nesting")['$=='](0)) { if (regexp !== false && regexp !== nil && regexp != null) { (($a = [self.$scan(/\w+/)]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tREGEXP_END";}; return (function() {if ((($a = ($b = self['$cond?']()['$!'](), $b !== false && $b !== nil && $b != null ?self.$scan(/:[^:]/) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "tLABEL_END" } else { return "tSTRING_END" }; return nil; })(); } else { str_buffer['$<<'](self.$scanner().$matched()); ($a = "nesting", $b = str_parse, $b['$[]=']($a, $rb_minus($b['$[]']($a), 1))); (($a = [str_parse]), $b = self, $b['$strterm='].apply($b, $a), $a[$a.length-1]); } } else if (regexp !== false && regexp !== nil && regexp != null) { self.lex_state = "expr_end"; (($a = [self.$scan(/\w+/)]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tREGEXP_END"; } else { if ((($a = str_parse['$[]']("scanner")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.scanner_stack['$<<'](str_parse['$[]']("scanner")); self.scanner = str_parse['$[]']("scanner");}; return (function() {if ((($a = ($b = self['$cond?']()['$!'](), $b !== false && $b !== nil && $b != null ?self.$scan(/:[^:]/) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "tLABEL_END" } else { return "tSTRING_END" }; return nil; })(); };}; if (space !== false && space !== nil && space != null) { (($a = [" "]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tSPACE";}; if ((($a = ($b = str_parse['$[]']("balance"), $b !== false && $b !== nil && $b != null ?self.$scan($scope.get('Regexp').$new($scope.get('Regexp').$escape(str_parse['$[]']("paren")))) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { str_buffer['$<<'](self.$scanner().$matched()); ($a = "nesting", $b = str_parse, $b['$[]=']($a, $rb_plus($b['$[]']($a), 1))); } else if ((($a = self.$check(/#[@$]/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$scan(/#/); if (expand !== false && expand !== nil && expand != null) { return "tSTRING_DVAR" } else { str_buffer['$<<'](self.$scanner().$matched()) }; } else if ((($a = self.$scan(/#\{/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if (expand !== false && expand !== nil && expand != null) { return "tSTRING_DBEG" } else { str_buffer['$<<'](self.$scanner().$matched()); if ((($a = (($b = qwords !== false && qwords !== nil && qwords != null) ? self.$scanner().$matched().$match($scope.get('Regexp').$new($scope.get('Regexp').$escape(str_parse['$[]']("paren")))) : qwords)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { ($a = "nesting", $b = str_parse, $b['$[]=']($a, $rb_plus($b['$[]']($a), 1)))}; } } else if ((($a = self.$scan(/\#/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { str_buffer['$<<']("#")}; self.$add_string_content(str_buffer, str_parse); complete_str = str_buffer.$join(""); self.line = $rb_plus(self.line, complete_str.$count("\n")); (($a = [complete_str]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tSTRING_CONTENT"; }, TMP_35.$$arity = 0); Opal.defn(self, '$add_string_content', TMP_36 = function $$add_string_content(str_buffer, str_parse) { var $a, $b, $c, self = this, func = nil, end_str_re = nil, qwords = nil, expand = nil, regexp = nil, escape = nil, xquote = nil, c = nil, handled = nil, reg = nil; func = str_parse['$[]']("func"); end_str_re = $scope.get('Regexp').$new($scope.get('Regexp').$escape(str_parse['$[]']("term"))); qwords = (func['$&']($scope.get('STR_FUNC_QWORDS')))['$!='](0); expand = (func['$&']($scope.get('STR_FUNC_EXPAND')))['$!='](0); regexp = (func['$&']($scope.get('STR_FUNC_REGEXP')))['$!='](0); escape = (func['$&']($scope.get('STR_FUNC_ESCAPE')))['$!='](0); xquote = (func['$==']($scope.get('STR_XQUOTE'))); while (!((($b = self.$scanner()['$eos?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true)))) { c = nil; handled = true; if ((($b = self.$check(end_str_re)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = ($c = str_parse['$[]']("balance"), $c !== false && $c !== nil && $c != null ?(str_parse['$[]']("nesting")['$!='](0)) : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$scan(end_str_re); c = self.$scanner().$matched(); ($b = "nesting", $c = str_parse, $c['$[]=']($b, $rb_minus($c['$[]']($b), 1))); } else { break; } } else if ((($b = ($c = str_parse['$[]']("balance"), $c !== false && $c !== nil && $c != null ?self.$scan($scope.get('Regexp').$new($scope.get('Regexp').$escape(str_parse['$[]']("paren")))) : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { ($b = "nesting", $c = str_parse, $c['$[]=']($b, $rb_plus($c['$[]']($b), 1))); c = self.$scanner().$matched(); } else if ((($b = (($c = qwords !== false && qwords !== nil && qwords != null) ? self.$scan(/\s/) : qwords)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$pushback(1); break;; } else if ((($b = (($c = expand !== false && expand !== nil && expand != null) ? self.$check(/#(?=[\$\@\{])/) : expand)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { break; } else if ((($b = (($c = qwords !== false && qwords !== nil && qwords != null) ? self.$scan(/\s/) : qwords)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$pushback(1); break;; } else if ((($b = self.$scan(/\\/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if (xquote !== false && xquote !== nil && xquote != null) { c = $rb_plus("\\", self.$scan(/./)) } else if ((($b = (($c = qwords !== false && qwords !== nil && qwords != null) ? self.$scan(/\n/) : qwords)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { str_buffer['$<<']("\n"); continue;; } else if ((($b = (($c = expand !== false && expand !== nil && expand != null) ? self.$scan(/\n/) : expand)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { continue; } else if ((($b = (($c = qwords !== false && qwords !== nil && qwords != null) ? self.$scan(/\s/) : qwords)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { c = " " } else if (regexp !== false && regexp !== nil && regexp != null) { if ((($b = self.$scan(/(.)/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { c = $rb_plus("\\", self.$scanner().$matched())} } else if (expand !== false && expand !== nil && expand != null) { c = self.$read_escape() } else if ((($b = self.$scan(/\n/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else if ((($b = self.$scan(/\\/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if (escape !== false && escape !== nil && escape != null) { c = "\\\\" } else { c = self.$scanner().$matched() } } else if ((($b = self.$scan(end_str_re)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { str_buffer['$<<']("\\") } } else { handled = false }; if (handled !== false && handled !== nil && handled != null) { } else { reg = (function() {if (qwords !== false && qwords !== nil && qwords != null) { return $scope.get('Regexp').$new("[^" + ($scope.get('Regexp').$escape(str_parse['$[]']("term"))) + "#\u0000\n \\\\]+|.") } else if ((($b = str_parse['$[]']("balance")) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return $scope.get('Regexp').$new("[^" + ($scope.get('Regexp').$escape(str_parse['$[]']("term"))) + ($scope.get('Regexp').$escape(str_parse['$[]']("paren"))) + "#\u0000\\\\]+|.") } else { return $scope.get('Regexp').$new("[^" + ($scope.get('Regexp').$escape(str_parse['$[]']("term"))) + "#\u0000\\\\]+|.") }; return nil; })(); self.$scan(reg); c = self.$scanner().$matched(); }; ((($b = c) !== false && $b !== nil && $b != null) ? $b : c = self.$scanner().$matched()); str_buffer['$<<'](c);}; if ((($a = self.$scanner()['$eos?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$raise("reached EOF while in string") } else { return nil }; }, TMP_36.$$arity = 2); Opal.defn(self, '$heredoc_identifier', TMP_37 = function $$heredoc_identifier() { var $a, $b, self = this, starts_with_minus = nil, squiggly_heredoc = nil, escape_char = nil, regexp = nil, escape_method = nil, heredoc = nil, end_of_line = nil; starts_with_minus = self.$scan(/-/)['$!']()['$!'](); squiggly_heredoc = ($a = starts_with_minus['$!'](), $a !== false && $a !== nil && $a != null ?self.$scan(/~/)['$!']()['$!']() : $a); self.$scan(/(['"]?)/); escape_char = self.scanner['$[]'](0); if ((($a = escape_char['$!=']("")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { regexp = $scope.get('Regexp').$new("([^" + (escape_char) + "]+)") } else { regexp = /\w+/ }; if ((($a = self.$scan(regexp)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { escape_method = (function() {if ((($a = (escape_char['$==']("'"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('STR_SQUOTE') } else { return $scope.get('STR_DQUOTE') }; return nil; })(); heredoc = self.scanner['$[]'](0); (($a = [self.$new_strterm(escape_method, heredoc, heredoc)]), $b = self, $b['$strterm='].apply($b, $a), $a[$a.length-1]); self.$strterm()['$[]=']("type", "heredoc"); self.$strterm()['$[]=']("squiggly_heredoc", squiggly_heredoc); if (escape_char !== false && escape_char !== nil && escape_char != null) { self.$scan($scope.get('Regexp').$new(escape_char))}; end_of_line = self.$scan(/.*\n/); if ((($a = end_of_line['$!=']("\n")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$strterm()['$[]=']("scanner", $scope.get('StringScanner').$new(end_of_line))}; ($a = self, $a['$line=']($rb_plus($a.$line(), 1))); (($a = [heredoc]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tSTRING_BEG"; } else { return nil }; }, TMP_37.$$arity = 0); Opal.defn(self, '$process_identifier', TMP_38 = function $$process_identifier(matched, cmd_start) { var $a, $b, $c, self = this, last_state = nil, result = nil, kw = nil, old_state = nil; last_state = self.lex_state; if ((($a = ($b = ($c = self['$label_state?'](), $c !== false && $c !== nil && $c != null ?self.$check(/::/)['$!']() : $c), $b !== false && $b !== nil && $b != null ?self.$scan(/:/) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.lex_state = "expr_beg"; (($a = [matched]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return "tLABEL";}; if (matched['$==']("defined?")) { if ((($a = self['$after_operator?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.lex_state = "expr_end"; return "tIDENTIFIER";}; self.lex_state = "expr_arg"; return "kDEFINED";}; if ((($a = matched['$end_with?']("?", "!")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = "tIDENTIFIER" } else if (self.lex_state['$==']("expr_fname")) { if ((($a = ($b = self.$check(/\=\>/)['$!'](), $b !== false && $b !== nil && $b != null ?self.$scan(/\=/) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = "tIDENTIFIER"; matched = $rb_plus(matched, self.$scanner().$matched());} } else if ((($a = matched['$=~']((new RegExp("" + $scope.get('REGEXP_START') + "[A-Z]")))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = "tCONSTANT" } else { result = "tIDENTIFIER" }; if ((($a = ($b = self.lex_state['$!=']("expr_dot"), $b !== false && $b !== nil && $b != null ?kw = $scope.get('Keywords').$keyword(matched) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { old_state = self.lex_state; self.lex_state = kw.$state(); if (old_state['$==']("expr_fname")) { (($a = [kw.$name()]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return kw.$id()['$[]'](0);}; if (self.lex_state['$==']("expr_beg")) { cmd_start = true}; if (matched['$==']("do")) { if ((($a = self['$after_operator?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.lex_state = "expr_end"; return "tIDENTIFIER";}; if (self.lambda_stack.$last()['$=='](self.paren_nest)) { self.lambda_stack.$pop(); self.lex_state = "expr_beg"; return "kDO_LAMBDA"; } else if ((($a = self['$cond?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.lex_state = "expr_beg"; return "kDO_COND"; } else if ((($a = ($b = self['$cmdarg?'](), $b !== false && $b !== nil && $b != null ?self.lex_state['$!=']("expr_cmdarg") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.lex_state = "expr_beg"; return "kDO_BLOCK"; } else if (last_state['$==']("expr_endarg")) { return "kDO_BLOCK" } else { self.lex_state = "expr_beg"; return "kDO"; }; } else if ((($a = ((($b = old_state['$==']("expr_beg")) !== false && $b !== nil && $b != null) ? $b : old_state['$==']("expr_value"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = [matched]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return kw.$id()['$[]'](0); } else { if ((($a = kw.$id()['$[]'](0)['$!='](kw.$id()['$[]'](1))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.lex_state = "expr_beg"}; (($a = [matched]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return kw.$id()['$[]'](1); };}; if ((($a = ["expr_beg", "expr_dot", "expr_mid", "expr_arg", "expr_cmdarg"]['$include?'](self.lex_state)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.lex_state = (function() {if (cmd_start !== false && cmd_start !== nil && cmd_start != null) { return "expr_cmdarg" } else { return "expr_arg" }; return nil; })() } else if (self.lex_state['$==']("expr_fname")) { self.lex_state = "expr_endfn" } else { self.lex_state = "expr_end" }; if ((($a = ($b = ["expr_dot", "expr_fname"]['$include?'](last_state)['$!'](), $b !== false && $b !== nil && $b != null ?self['$has_local?'](matched) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.lex_state = "expr_end"}; (($a = [matched]), $b = self, $b['$yylval='].apply($b, $a), $a[$a.length-1]); return (function() {if ((($a = matched['$=~']((new RegExp("" + $scope.get('REGEXP_START') + "[A-Z]")))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "tCONSTANT" } else { return "tIDENTIFIER" }; return nil; })(); }, TMP_38.$$arity = 2); return (Opal.defn(self, '$yylex', TMP_39 = function $$yylex() {try { var $a, $b, $c, $d, $e, self = this, cmd_start = nil, c = nil, token = nil, line_count = nil, result = nil, str_type = nil, paren = nil, term = nil, $case = nil, func = nil, matched = nil, sign = nil, utype = nil; self.yylval = ""; self.space_seen = false; cmd_start = false; c = ""; if ((($a = self.$strterm()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if (self.$strterm()['$[]']("type")['$==']("heredoc")) { token = self.$here_document(self.$strterm()) } else { token = self.$parse_string() }; if ((($a = ((($b = ((($c = token['$==']("tSTRING_END")) !== false && $c !== nil && $c != null) ? $c : token['$==']("tREGEXP_END"))) !== false && $b !== nil && $b != null) ? $b : token['$==']("tLABEL_END"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = [nil]), $b = self, $b['$strterm='].apply($b, $a), $a[$a.length-1]); self.lex_state = "expr_end";}; return token;}; while ((($b = true) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.$skip(/\ |\t|\r/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.space_seen = true; continue;; } else if ((($b = self.$skip(/(\n|#)/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { c = self.$scanner().$matched(); if (c['$==']("#")) { self.$skip(/(.*)/) } else { ($b = self, $b['$line=']($rb_plus($b.$line(), 1))) }; self.$skip(/(\n+)/); if ((($b = self.$scanner().$matched()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { ($b = self, $b['$line=']($rb_plus($b.$line(), self.$scanner().$matched().$length())))}; if ((($b = ["expr_beg", "expr_dot"]['$include?'](self.lex_state)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { continue;}; if ((($b = self.$skip(/([\ \t\r\f\v]*)\./)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.$scanner()['$[]'](1)['$empty?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { self.space_seen = true }; self.$pushback(1); if ((($b = self.$check(/\.\./)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { continue; };}; cmd_start = true; self.lex_state = "expr_beg"; (($b = ["\\n"]), $c = self, $c['$yylval='].apply($c, $b), $b[$b.length-1]); return "tNL"; } else if ((($b = self.$scan(/\;/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; return "tSEMI"; } else if ((($b = self.$check(/\*/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.$scan(/\*\*\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$new_op_asgn("**") } else if ((($b = self.$scan(/\*\*/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = ["expr_beg", "expr_mid"]['$include?'](self.lex_state)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return "tDSTAR" } else { self.$set_arg_state(); return "tPOW"; } } else if ((($b = self.$scan(/\*\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$new_op_asgn("*") } else { self.$scan(/\*/); if ((($b = self['$after_operator?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_arg"; return "tSTAR2"; } else if ((($b = ($c = self.space_seen, $c !== false && $c !== nil && $c != null ?self.$check(/\S/) : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; return "tSTAR"; } else if ((($b = ["expr_beg", "expr_mid"]['$include?'](self.lex_state)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; return "tSTAR"; } else { self.lex_state = "expr_beg"; return "tSTAR2"; }; } } else if ((($b = self.$scan(/\!/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self['$after_operator?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_arg"; if ((($b = self.$scan(/@/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return ["tBANG", "!"]}; } else { self.lex_state = "expr_beg" }; if ((($b = self.$scan(/\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return "tNEQ" } else if ((($b = self.$scan(/\~/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return "tNMATCH"}; return "tBANG"; } else if ((($b = self.$scan(/\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = (($c = self.lex_state['$==']("expr_beg")) ? self.space_seen['$!']() : self.lex_state['$==']("expr_beg"))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = ($c = self.$scan(/begin/), $c !== false && $c !== nil && $c != null ?self['$space?']() : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$scan(/(.*)/); line_count = 0; while ((($c = true) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { if ((($c = self.$scanner()['$eos?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$raise("embedded document meets end of file")}; if ((($c = ($d = self.$scan(/\=end/), $d !== false && $d !== nil && $d != null ?self['$space?']() : $d)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.line = $rb_plus(self.line, line_count); return self.$yylex();}; if ((($c = self.$scan(/\n/)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { line_count = $rb_plus(line_count, 1); continue;;}; self.$scan(/(.*)/);};}}; self.$set_arg_state(); if ((($b = self.$scan(/\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.$scan(/\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return "tEQQ"}; return "tEQ";}; if ((($b = self.$scan(/\~/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return "tMATCH" } else if ((($b = self.$scan(/\>/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return "tASSOC"}; return "tEQL"; } else if ((($b = self.$scan(/\"/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { (($b = [self.$new_strterm($scope.get('STR_DQUOTE'), "\"", "\x00")]), $c = self, $c['$strterm='].apply($c, $b), $b[$b.length-1]); return "tSTRING_BEG"; } else if ((($b = self.$scan(/\'/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { (($b = [self.$new_strterm($scope.get('STR_SQUOTE'), "'", "\x00")]), $c = self, $c['$strterm='].apply($c, $b), $b[$b.length-1]); return "tSTRING_BEG"; } else if ((($b = self.$scan(/\`/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { (($b = [self.$new_strterm($scope.get('STR_XQUOTE'), "`", "\x00")]), $c = self, $c['$strterm='].apply($c, $b), $b[$b.length-1]); return "tXSTRING_BEG"; } else if ((($b = self.$scan(/\&/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.$scan(/\&/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; if ((($b = self.$scan(/\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$new_op_asgn("&&")}; return "tANDOP"; } else if ((($b = self.$scan(/\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$new_op_asgn("&")}; if ((($b = self['$spcarg?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { result = "tAMPER" } else if ((($b = self['$beg?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { result = "tAMPER" } else { result = "tAMPER2" }; self.$set_arg_state(); return result; } else if ((($b = self.$scan(/\|/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.$scan(/\|/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; if ((($b = self.$scan(/\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$new_op_asgn("||")}; return "tOROP"; } else if ((($b = self.$scan(/\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$new_op_asgn("|")}; self.$set_arg_state(); return "tPIPE"; } else if ((($b = self.$scan(/\%[QqWwIixrs]/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { str_type = self.$scanner().$matched()['$[]'](1, 1); paren = term = self.$scan(/./); $case = term;if ("("['$===']($case)) {term = ")"}else if ("["['$===']($case)) {term = "]"}else if ("{"['$===']($case)) {term = "}"}else if ("<"['$===']($case)) {term = ">"}else {paren = "\x00"}; $c = (function() {$case = str_type;if ("Q"['$===']($case)) {return ["tSTRING_BEG", $scope.get('STR_DQUOTE')]}else if ("q"['$===']($case)) {return ["tSTRING_BEG", $scope.get('STR_SQUOTE')]}else if ("W"['$===']($case) || "I"['$===']($case)) {self.$skip(/\s*/); return ["tWORDS_BEG", $scope.get('STR_DWORD')];}else if ("w"['$===']($case) || "i"['$===']($case)) {self.$skip(/\s*/); return ["tAWORDS_BEG", $scope.get('STR_SWORD')];}else if ("x"['$===']($case)) {return ["tXSTRING_BEG", $scope.get('STR_XQUOTE')]}else if ("r"['$===']($case)) {return ["tREGEXP_BEG", $scope.get('STR_REGEXP')]}else if ("s"['$===']($case)) {return ["tSTRING_BEG", $scope.get('STR_SQUOTE')]}else { return nil }})(), $b = Opal.to_ary($c), token = ($b[0] == null ? nil : $b[0]), func = ($b[1] == null ? nil : $b[1]), $c; (($b = [self.$new_strterm2(func, term, paren)]), $c = self, $c['$strterm='].apply($c, $b), $b[$b.length-1]); return token; } else if ((($b = self.$scan(/\//)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self['$beg?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { (($b = [self.$new_strterm($scope.get('STR_REGEXP'), "/", "/")]), $c = self, $c['$strterm='].apply($c, $b), $b[$b.length-1]); return "tREGEXP_BEG"; } else if ((($b = self.$scan(/\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$new_op_asgn("/")}; if ((($b = self['$arg?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = ($c = self.$check(/\s/)['$!'](), $c !== false && $c !== nil && $c != null ?self.space_seen : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { (($b = [self.$new_strterm($scope.get('STR_REGEXP'), "/", "/")]), $c = self, $c['$strterm='].apply($c, $b), $b[$b.length-1]); return "tREGEXP_BEG";}}; if ((($b = self['$after_operator?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_arg" } else { self.lex_state = "expr_beg" }; return "tDIVIDE"; } else if ((($b = self.$scan(/\%/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = ($c = self.$check(/\=/), $c !== false && $c !== nil && $c != null ?self.lex_state['$!=']("expr_beg") : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$scan(/\=/); return self.$new_op_asgn("%"); } else if ((($b = self.$check(/[^\s]/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = ((($c = ((($d = self.lex_state['$==']("expr_beg")) !== false && $d !== nil && $d != null) ? $d : (($e = self.lex_state['$==']("expr_arg")) ? self.space_seen : self.lex_state['$==']("expr_arg")))) !== false && $c !== nil && $c != null) ? $c : self.lex_state['$==']("expr_mid"))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { paren = term = self.$scan(/./); $case = term;if ("("['$===']($case)) {term = ")"}else if ("["['$===']($case)) {term = "]"}else if ("{"['$===']($case)) {term = "}"}else if ("<"['$===']($case)) {term = ">"}else {paren = "\x00"}; (($b = [self.$new_strterm2($scope.get('STR_DQUOTE'), term, paren)]), $c = self, $c['$strterm='].apply($c, $b), $b[$b.length-1]); return "tSTRING_BEG";}}; self.$set_arg_state(); return "tPERCENT"; } else if ((($b = self.$scan(/\\/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.$scan(/\r?\n/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.space_seen = true; continue;;}; self.$raise($scope.get('SyntaxError'), "backslash must appear before newline :" + (self.file) + ":" + (self.line)); } else if ((($b = self.$scan(/\(/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { result = self.$scanner().$matched(); if ((($b = self['$beg?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { result = "tLPAREN" } else if ((($b = ($c = self.space_seen, $c !== false && $c !== nil && $c != null ?self['$arg?']() : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lparen_arg_seen = true; result = "tLPAREN_ARG"; } else { result = "tLPAREN2" }; self.lex_state = "expr_beg"; self.$cond_push(0); self.$cmdarg_push(0); self.paren_nest = $rb_plus(self.paren_nest, 1); return result; } else if ((($b = self.$scan(/\)/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$cond_lexpop(); self.$cmdarg_lexpop(); self.paren_nest = $rb_minus(self.paren_nest, 1); self.lex_state = "expr_end"; self.lparen_arg_seen = false; return "tRPAREN"; } else if ((($b = self.$scan(/\[/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { result = self.$scanner().$matched(); if ((($b = self['$after_operator?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_arg"; if ((($b = self.$scan(/\]=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return "tASET" } else if ((($b = self.$scan(/\]/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return "tAREF" } else { self.$raise("Unexpected '[' token") }; } else if ((($b = self['$beg?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { result = "tLBRACK" } else if ((($b = ($c = self['$arg?'](), $c !== false && $c !== nil && $c != null ?self.space_seen : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { result = "tLBRACK" } else { result = "tLBRACK2" }; self.lex_state = "expr_beg"; self.$cond_push(0); self.$cmdarg_push(0); return result; } else if ((($b = self.$scan(/\]/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$cond_lexpop(); self.$cmdarg_lexpop(); self.lex_state = "expr_end"; return "tRBRACK"; } else if ((($b = self.$scan(/\}/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$cond_lexpop(); self.$cmdarg_lexpop(); self.lex_state = "expr_end"; return "tRCURLY"; } else if ((($b = self.$scan(/\.\.\./)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; return "tDOT3"; } else if ((($b = self.$scan(/\.\./)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; return "tDOT2"; } else if ((($b = ($c = self.lex_state['$!=']("expr_fname"), $c !== false && $c !== nil && $c != null ?self.$scan(/\.JS\[/) : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; self.$cond_push(0); self.$cmdarg_push(0); return "tJSLBRACK"; } else if ((($b = ($c = self.lex_state['$!=']("expr_fname"), $c !== false && $c !== nil && $c != null ?self.$scan(/\.JS\./) : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_dot"; return "tJSDOT"; } else if ((($b = self.$scan(/\./)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if (self.lex_state['$==']("expr_fname")) { } else { self.lex_state = "expr_dot" }; return "tDOT"; } else if ((($b = self.$scan(/\:\:/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self['$beg?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; return "tCOLON3"; } else if ((($b = self['$spcarg?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; return "tCOLON3";}; self.lex_state = "expr_dot"; return "tCOLON2"; } else if ((($b = self.$scan(/\:/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = ((($c = self['$end?']()) !== false && $c !== nil && $c != null) ? $c : self.$check(/\s/))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.$check(/\w/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { self.lex_state = "expr_beg"; return "tCOLON"; }; self.lex_state = "expr_fname"; return "tSYMBEG";}; if ((($b = self.$scan(/\'/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { (($b = [self.$new_strterm($scope.get('STR_SSYM'), "'", "\x00")]), $c = self, $c['$strterm='].apply($c, $b), $b[$b.length-1]) } else if ((($b = self.$scan(/\"/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { (($b = [self.$new_strterm($scope.get('STR_DSYM'), "\"", "\x00")]), $c = self, $c['$strterm='].apply($c, $b), $b[$b.length-1])}; self.lex_state = "expr_fname"; return "tSYMBEG"; } else if ((($b = self.$scan(/\^\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$new_op_asgn("^") } else if ((($b = self.$scan(/\^/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$set_arg_state(); return "tCARET"; } else if ((($b = self.$check(//)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self['$after_operator?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_arg" } else { if (self.lex_state['$==']("expr_class")) { cmd_start = true}; self.lex_state = "expr_beg"; }; return "tCMP"; } else if ((($b = self.$scan(/<\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$set_arg_state(); return "tLEQ"; } else if ((($b = self.$scan(//)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.$scan(/\>\>\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$new_op_asgn(">>") } else if ((($b = self.$scan(/\>\>/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$set_arg_state(); return "tRSHFT"; } else if ((($b = self.$scan(/\>\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$set_arg_state(); return "tGEQ"; } else if ((($b = self.$scan(/\>/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$set_arg_state(); return "tGT";} } else if ((($b = self.$scan(/->/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_end"; self.lambda_stack.$push(self.paren_nest); return "tLAMBDA"; } else if ((($b = self.$scan(/[+-]/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { matched = self.$scanner().$matched(); $c = (function() {if (matched['$==']("+")) { return ["tPLUS", "tUPLUS"] } else { return ["tMINUS", "tUMINUS"] }; return nil; })(), $b = Opal.to_ary($c), sign = ($b[0] == null ? nil : $b[0]), utype = ($b[1] == null ? nil : $b[1]), $c; if ((($b = self['$beg?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_mid"; (($b = [matched]), $c = self, $c['$yylval='].apply($c, $b), $b[$b.length-1]); if ((($b = ($c = self.$scanner().$peek(1)['$=~'](/\d/), $c !== false && $c !== nil && $c != null ?Opal.ret((function() {if (utype['$==']("tUMINUS")) { return "-@NUM" } else { return "+@NUM" }; return nil; })()) : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { return utype }; } else if ((($b = self['$after_operator?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_arg"; if ((($b = self.$scan(/@/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { (($b = [$rb_plus(matched, "@")]), $c = self, $c['$yylval='].apply($c, $b), $b[$b.length-1]); return "tIDENTIFIER";}; (($b = [matched]), $c = self, $c['$yylval='].apply($c, $b), $b[$b.length-1]); return sign;}; if ((($b = self.$scan(/\=/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$new_op_asgn(matched)}; if ((($b = self['$spcarg?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_mid"; (($b = [matched]), $c = self, $c['$yylval='].apply($c, $b), $b[$b.length-1]); if ((($b = ($c = self.$scanner().$peek(1)['$=~'](/\d/), $c !== false && $c !== nil && $c != null ?Opal.ret((function() {if (utype['$==']("tUMINUS")) { return "-@NUM" } else { return "+@NUM" }; return nil; })()) : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { return utype };}; self.lex_state = "expr_beg"; (($b = [matched]), $c = self, $c['$yylval='].apply($c, $b), $b[$b.length-1]); return sign; } else if ((($b = self.$scan(/\?/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self['$end?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; return "tEH";}; if ((($b = self.$check(/\ |\t|\r|\s/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; return "tEH"; } else if ((($b = self.$scan(/\\/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_end"; (($b = [self.$read_escape()]), $c = self, $c['$yylval='].apply($c, $b), $b[$b.length-1]); return "tSTRING";}; self.lex_state = "expr_end"; (($b = [self.$scan(/./)]), $c = self, $c['$yylval='].apply($c, $b), $b[$b.length-1]); return "tSTRING"; } else if ((($b = self.$scan(/\~/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$set_arg_state(); return "tTILDE"; } else if ((($b = self.$check(/\$/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.$scan(/\$([1-9]\d*)/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_end"; (($b = [self.$scanner().$matched().$sub("$", "")]), $c = self, $c['$yylval='].apply($c, $b), $b[$b.length-1]); return "tNTH_REF"; } else if ((($b = self.$scan(/(\$_)(\w+)/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_end"; return "tGVAR"; } else if ((($b = self.$scan(/\$[\+\'\`\&!@\"~*$?\/\\:;=.,<>_]/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_end"; return "tGVAR"; } else if ((($b = self.$scan(/\$\w+/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_end"; return "tGVAR"; } else if ((($b = self.$scan(/\$-[0-9a-zA-Z]/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_end"; return "tGVAR"; } else { self.$raise("Bad gvar name: " + (self.$scanner().$peek(5).$inspect())) } } else if ((($b = self.$scan(/\$\w+/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_end"; return "tGVAR"; } else if ((($b = self.$scan(/\@\@\w*/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_end"; return "tCVAR"; } else if ((($b = self.$scan(/\@\w*/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_end"; return "tIVAR"; } else if ((($b = self.$scan(/\,/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lex_state = "expr_beg"; return "tCOMMA"; } else if ((($b = self.$scan(/\{/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if (self.lambda_stack.$last()['$=='](self.paren_nest)) { self.lambda_stack.$pop(); self.lex_state = "expr_beg"; self.$cond_push(0); self.$cmdarg_push(0); return "tLAMBEG"; } else if ((($b = ((($c = self['$arg?']()) !== false && $c !== nil && $c != null) ? $c : self.lex_state['$==']("expr_end"))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = self.lparen_arg_seen) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.lparen_arg_seen = false; result = "tLBRACE_ARG"; } else { result = "tLCURLY" } } else if (self.lex_state['$==']("expr_endarg")) { result = "tLBRACE_ARG" } else { result = "tLBRACE" }; self.lex_state = "expr_beg"; self.$cond_push(0); self.$cmdarg_push(0); return result; } else if ((($b = ($c = self.$scanner()['$bol?'](), $c !== false && $c !== nil && $c != null ?self.$skip(/\__END__(\n|$)/) : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { while ((($c = true) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { if ((($c = self.$scanner()['$eos?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.eof_content = self.$yylval(); return false;}; self.$scan(/(.*)/); self.$scan(/\n/);} } else if ((($b = self.$check(/[0-9]/)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$process_numeric() } else if ((($b = self.$scan($scope.get('INLINE_IDENTIFIER_REGEXP'))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$process_identifier(self.$scanner().$matched(), cmd_start)}; if ((($b = self.$scanner()['$eos?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if (self.scanner_stack.$size()['$=='](1)) { (($b = [false]), $c = self, $c['$yylval='].apply($c, $b), $b[$b.length-1]); return false; } else { self.scanner_stack.$pop(); self.scanner = self.scanner_stack.$last(); return self.$yylex(); }}; self.$raise("Unexpected content in parsing stream `" + (self.$scanner().$peek(5)) + "` :" + (self.file) + ":" + (self.line));}; } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_39.$$arity = 0), nil) && 'yylex'; })($scope.base, null) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["racc/parser"] = function(Opal) { function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_ge(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_le(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); } function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } var $a, self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $gvars = Opal.gvars; Opal.add_stubs(['$[]', '$class', '$<', '$size', '$[]=', '$__send__', '$_racc_setup', '$raise', '$_racc_init_sysvars', '$catch', '$!=', '$next_token', '$racc_read_token', '$+', '$>=', '$==', '$_racc_evalact', '$!', '$>', '$-', '$push', '$racc_shift', '$-@', '$_racc_do_reduce', '$===', '$racc_accept', '$throw', '$on_error', '$<=', '$pop', '$racc_e_pop', '$inspect', '$racc_next_state', '$*', '$racc_reduce', '$sprintf', '$token_to_str', '$print', '$racc_token2str', '$puts', '$racc_print_stacks', '$empty?', '$each', '$racc_print_states', '$each_index']); (function($base) { var $Racc, self = $Racc = $module($base, 'Racc'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ParseError(){}; var self = $ParseError = $klass($base, $super, 'ParseError', $ParseError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('StandardError')) })($scope.base); if ((($a = (Opal.Object.$$scope.ParseError == null ? nil : 'constant')) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Opal.cdecl($scope, 'ParseError', (($scope.get('Racc')).$$scope.get('ParseError'))) }; return (function($base) { var $Racc, self = $Racc = $module($base, 'Racc'); var def = self.$$proto, $scope = self.$$scope, $a; if ((($a = ($scope.Racc_No_Extensions != null)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { Opal.cdecl($scope, 'Racc_No_Extensions', false) }; (function($base, $super) { function $Parser(){}; var self = $Parser = $klass($base, $super, 'Parser', $Parser); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_7, TMP_8, TMP_11, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_22, TMP_23, TMP_24, TMP_25, TMP_27, TMP_29, TMP_30, TMP_31; def.yydebug = def.racc_debug_out = def.racc_error_status = def.racc_t = def.racc_vstack = def.racc_val = def.racc_state = def.racc_tstack = nil; Opal.cdecl($scope, 'Racc_Runtime_Version', "1.4.6"); Opal.cdecl($scope, 'Racc_Runtime_Revision', ["originalRevision:", "1.8"]['$[]'](1)); Opal.cdecl($scope, 'Racc_Runtime_Core_Version_R', "1.4.6"); Opal.cdecl($scope, 'Racc_Runtime_Core_Revision_R', ["originalRevision:", "1.8"]['$[]'](1)); Opal.cdecl($scope, 'Racc_Main_Parsing_Routine', "_racc_do_parse_rb"); Opal.cdecl($scope, 'Racc_YY_Parse_Method', "_racc_yyparse_rb"); Opal.cdecl($scope, 'Racc_Runtime_Core_Version', $scope.get('Racc_Runtime_Core_Version_R')); Opal.cdecl($scope, 'Racc_Runtime_Core_Revision', $scope.get('Racc_Runtime_Core_Revision_R')); Opal.cdecl($scope, 'Racc_Runtime_Type', "ruby"); Opal.defs($scope.get('Parser'), '$racc_runtime_type', TMP_1 = function $$racc_runtime_type() { var self = this; return $scope.get('Racc_Runtime_Type'); }, TMP_1.$$arity = 0); Opal.defn(self, '$_racc_setup', TMP_2 = function $$_racc_setup() { var $a, $b, self = this, arg = nil; if ($gvars.stderr == null) $gvars.stderr = nil; if ((($a = ((self.$class()).$$scope.get('Racc_debug_parser'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.yydebug = false }; if ((($a = (($b = self['yydebug'], $b != null && $b !== nil) ? 'instance-variable' : nil)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.yydebug = false }; if ((($a = self.yydebug) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = (($b = self['racc_debug_out'], $b != null && $b !== nil) ? 'instance-variable' : nil)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.racc_debug_out = $gvars.stderr }; ((($a = self.racc_debug_out) !== false && $a !== nil && $a != null) ? $a : self.racc_debug_out = $gvars.stderr);}; arg = ((self.$class()).$$scope.get('Racc_arg')); if ((($a = $rb_lt(arg.$size(), 14)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { arg['$[]='](13, true)}; return arg; }, TMP_2.$$arity = 0); Opal.defn(self, '$_racc_init_sysvars', TMP_3 = function $$_racc_init_sysvars() { var self = this; self.racc_state = [0]; self.racc_tstack = []; self.racc_vstack = []; self.racc_t = nil; self.racc_val = nil; self.racc_read_next = true; self.racc_user_yyerror = false; return self.racc_error_status = 0; }, TMP_3.$$arity = 0); Opal.defn(self, '$do_parse', TMP_4 = function $$do_parse() { var self = this; return self.$__send__($scope.get('Racc_Main_Parsing_Routine'), self.$_racc_setup(), false); }, TMP_4.$$arity = 0); Opal.defn(self, '$next_token', TMP_5 = function $$next_token() { var self = this; return self.$raise($scope.get('NotImplementedError'), "" + (self.$class()) + "#next_token is not defined"); }, TMP_5.$$arity = 0); Opal.defn(self, '$_racc_do_parse_rb', TMP_7 = function $$_racc_do_parse_rb(arg, in_debug) { var $a, $b, TMP_6, self = this, action_table = nil, action_check = nil, action_default = nil, action_pointer = nil, _ = nil, token_table = nil, tok = nil, act = nil, i = nil; $b = arg, $a = Opal.to_ary($b), action_table = ($a[0] == null ? nil : $a[0]), action_check = ($a[1] == null ? nil : $a[1]), action_default = ($a[2] == null ? nil : $a[2]), action_pointer = ($a[3] == null ? nil : $a[3]), _ = ($a[4] == null ? nil : $a[4]), _ = ($a[5] == null ? nil : $a[5]), _ = ($a[6] == null ? nil : $a[6]), _ = ($a[7] == null ? nil : $a[7]), _ = ($a[8] == null ? nil : $a[8]), _ = ($a[9] == null ? nil : $a[9]), token_table = ($a[10] == null ? nil : $a[10]), _ = ($a[11] == null ? nil : $a[11]), _ = ($a[12] == null ? nil : $a[12]), _ = ($a[13] == null ? nil : $a[13]), $b; self.$_racc_init_sysvars(); tok = act = i = nil; return ($a = ($b = self).$catch, $a.$$p = (TMP_6 = function(){var self = TMP_6.$$s || this, $c, $d, $e, $f; if (self.racc_state == null) self.racc_state = nil; if (self.racc_read_next == null) self.racc_read_next = nil; if (self.racc_t == null) self.racc_t = nil; if (self.yydebug == null) self.yydebug = nil; if (self.racc_val == null) self.racc_val = nil; while ((($d = true) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { if ((($d = i = action_pointer['$[]'](self.racc_state['$[]'](-1))) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { if ((($d = self.racc_read_next) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { if ((($d = self.racc_t['$!='](0)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { $e = self.$next_token(), $d = Opal.to_ary($e), tok = ($d[0] == null ? nil : $d[0]), self.racc_val = ($d[1] == null ? nil : $d[1]), $e; if (tok !== false && tok !== nil && tok != null) { self.racc_t = (((($d = token_table['$[]'](tok)) !== false && $d !== nil && $d != null) ? $d : 1)) } else { self.racc_t = 0 }; if ((($d = self.yydebug) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { self.$racc_read_token(self.racc_t, tok, self.racc_val)}; self.racc_read_next = false;}}; i = $rb_plus(i, self.racc_t); if ((($d = ($e = ($f = $rb_ge(i, 0), $f !== false && $f !== nil && $f != null ?act = action_table['$[]'](i) : $f), $e !== false && $e !== nil && $e != null ?action_check['$[]'](i)['$=='](self.racc_state['$[]'](-1)) : $e)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { } else { act = action_default['$[]'](self.racc_state['$[]'](-1)) }; } else { act = action_default['$[]'](self.racc_state['$[]'](-1)) }; while ((($e = act = self.$_racc_evalact(act, arg)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { };}}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6), $a).call($b, "racc_end_parse"); }, TMP_7.$$arity = 2); Opal.defn(self, '$yyparse', TMP_8 = function $$yyparse(recv, mid) { var self = this; return self.$__send__($scope.get('Racc_YY_Parse_Method'), recv, mid, self.$_racc_setup(), true); }, TMP_8.$$arity = 2); Opal.defn(self, '$_racc_yyparse_rb', TMP_11 = function $$_racc_yyparse_rb(recv, mid, arg, c_debug) { var $a, $b, TMP_9, self = this, action_table = nil, action_check = nil, action_default = nil, action_pointer = nil, _ = nil, token_table = nil, act = nil, i = nil; $b = arg, $a = Opal.to_ary($b), action_table = ($a[0] == null ? nil : $a[0]), action_check = ($a[1] == null ? nil : $a[1]), action_default = ($a[2] == null ? nil : $a[2]), action_pointer = ($a[3] == null ? nil : $a[3]), _ = ($a[4] == null ? nil : $a[4]), _ = ($a[5] == null ? nil : $a[5]), _ = ($a[6] == null ? nil : $a[6]), _ = ($a[7] == null ? nil : $a[7]), _ = ($a[8] == null ? nil : $a[8]), _ = ($a[9] == null ? nil : $a[9]), token_table = ($a[10] == null ? nil : $a[10]), _ = ($a[11] == null ? nil : $a[11]), _ = ($a[12] == null ? nil : $a[12]), _ = ($a[13] == null ? nil : $a[13]), $b; self.$_racc_init_sysvars(); act = nil; i = nil; return ($a = ($b = self).$catch, $a.$$p = (TMP_9 = function(){var self = TMP_9.$$s || this, $c, $d, $e, TMP_10; if (self.racc_state == null) self.racc_state = nil; while (!((($d = i = action_pointer['$[]'](self.racc_state['$[]'](-1))) !== nil && $d != null && (!$d.$$is_boolean || $d == true)))) { while ((($e = act = self.$_racc_evalact(action_default['$[]'](self.racc_state['$[]'](-1)), arg)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { }}; return ($c = ($d = recv).$__send__, $c.$$p = (TMP_10 = function(tok, val){var self = TMP_10.$$s || this, $f, $g, $h, $i, $j, $k; if (self.racc_t == null) self.racc_t = nil; if (self.racc_state == null) self.racc_state = nil; if (self.racc_read_next == null) self.racc_read_next = nil; if (tok == null) tok = nil;if (val == null) val = nil; if (tok !== false && tok !== nil && tok != null) { self.racc_t = (((($f = token_table['$[]'](tok)) !== false && $f !== nil && $f != null) ? $f : 1)) } else { self.racc_t = 0 }; self.racc_val = val; self.racc_read_next = false; i = $rb_plus(i, self.racc_t); if ((($f = ($g = ($h = $rb_ge(i, 0), $h !== false && $h !== nil && $h != null ?act = action_table['$[]'](i) : $h), $g !== false && $g !== nil && $g != null ?action_check['$[]'](i)['$=='](self.racc_state['$[]'](-1)) : $g)) !== nil && $f != null && (!$f.$$is_boolean || $f == true))) { } else { act = action_default['$[]'](self.racc_state['$[]'](-1)) }; while ((($g = act = self.$_racc_evalact(act, arg)) !== nil && $g != null && (!$g.$$is_boolean || $g == true))) { }; while ((($g = ((($h = ((($i = ((i = action_pointer['$[]'](self.racc_state['$[]'](-1))))['$!']()) !== false && $i !== nil && $i != null) ? $i : self.racc_read_next['$!']())) !== false && $h !== nil && $h != null) ? $h : self.racc_t['$=='](0))) !== nil && $g != null && (!$g.$$is_boolean || $g == true))) { if ((($g = ($h = ($i = ($j = (($k = i !== false && i !== nil && i != null) ? i = $rb_plus(i, self.racc_t) : i), $j !== false && $j !== nil && $j != null ?$rb_ge(i, 0) : $j), $i !== false && $i !== nil && $i != null ?act = action_table['$[]'](i) : $i), $h !== false && $h !== nil && $h != null ?action_check['$[]'](i)['$=='](self.racc_state['$[]'](-1)) : $h)) !== nil && $g != null && (!$g.$$is_boolean || $g == true))) { } else { act = action_default['$[]'](self.racc_state['$[]'](-1)) }; while ((($h = act = self.$_racc_evalact(act, arg)) !== nil && $h != null && (!$h.$$is_boolean || $h == true))) { };};}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10), $c).call($d, mid);}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9), $a).call($b, "racc_end_parse"); }, TMP_11.$$arity = 4); Opal.defn(self, '$_racc_evalact', TMP_13 = function $$_racc_evalact(act, arg) { var $a, $b, TMP_12, $c, $d, $e, self = this, action_table = nil, action_check = nil, _ = nil, action_pointer = nil, shift_n = nil, reduce_n = nil, code = nil, $case = nil, i = nil; $b = arg, $a = Opal.to_ary($b), action_table = ($a[0] == null ? nil : $a[0]), action_check = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]), action_pointer = ($a[3] == null ? nil : $a[3]), _ = ($a[4] == null ? nil : $a[4]), _ = ($a[5] == null ? nil : $a[5]), _ = ($a[6] == null ? nil : $a[6]), _ = ($a[7] == null ? nil : $a[7]), _ = ($a[8] == null ? nil : $a[8]), _ = ($a[9] == null ? nil : $a[9]), _ = ($a[10] == null ? nil : $a[10]), shift_n = ($a[11] == null ? nil : $a[11]), reduce_n = ($a[12] == null ? nil : $a[12]), _ = ($a[13] == null ? nil : $a[13]), _ = ($a[14] == null ? nil : $a[14]), $b; if ((($a = ($b = $rb_gt(act, 0), $b !== false && $b !== nil && $b != null ?$rb_lt(act, shift_n) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = $rb_gt(self.racc_error_status, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if (self.racc_t['$=='](1)) { } else { self.racc_error_status = $rb_minus(self.racc_error_status, 1) }}; self.racc_vstack.$push(self.racc_val); self.racc_state.$push(act); self.racc_read_next = true; if ((($a = self.yydebug) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.racc_tstack.$push(self.racc_t); self.$racc_shift(self.racc_t, self.racc_tstack, self.racc_vstack);}; } else if ((($a = ($b = $rb_lt(act, 0), $b !== false && $b !== nil && $b != null ?$rb_gt(act, reduce_n['$-@']()) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { code = ($a = ($b = self).$catch, $a.$$p = (TMP_12 = function(){var self = TMP_12.$$s || this; if (self.racc_state == null) self.racc_state = nil; self.racc_state.$push(self.$_racc_do_reduce(arg, act)); return false;}, TMP_12.$$s = self, TMP_12.$$arity = 0, TMP_12), $a).call($b, "racc_jump"); if (code !== false && code !== nil && code != null) { $case = code;if ((1)['$===']($case)) {self.racc_user_yyerror = true; return reduce_n['$-@']();}else if ((2)['$===']($case)) {return shift_n}else {self.$raise("[Racc Bug] unknown jump code")}}; } else if (act['$=='](shift_n)) { if ((($a = self.yydebug) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$racc_accept()}; self.$throw("racc_end_parse", self.racc_vstack['$[]'](0)); } else if (act['$=='](reduce_n['$-@']())) { $case = self.racc_error_status;if ((0)['$===']($case)) {if ((($a = arg['$[]'](21)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$on_error(self.racc_t, self.racc_val, self.racc_vstack) }}else if ((3)['$===']($case)) {if (self.racc_t['$=='](0)) { self.$throw("racc_end_parse", nil)}; self.racc_read_next = true;}; self.racc_user_yyerror = false; self.racc_error_status = 3; while ((($c = true) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { if ((($c = i = action_pointer['$[]'](self.racc_state['$[]'](-1))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { i = $rb_plus(i, 1); if ((($c = ($d = ($e = $rb_ge(i, 0), $e !== false && $e !== nil && $e != null ?(act = action_table['$[]'](i)) : $e), $d !== false && $d !== nil && $d != null ?action_check['$[]'](i)['$=='](self.racc_state['$[]'](-1)) : $d)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { break;};}; if ((($c = $rb_le(self.racc_state.$size(), 1)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$throw("racc_end_parse", nil)}; self.racc_state.$pop(); self.racc_vstack.$pop(); if ((($c = self.yydebug) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.racc_tstack.$pop(); self.$racc_e_pop(self.racc_state, self.racc_tstack, self.racc_vstack);};}; return act; } else { self.$raise("[Racc Bug] unknown action " + (act.$inspect())) }; if ((($a = self.yydebug) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$racc_next_state(self.racc_state['$[]'](-1), self.racc_state)}; return nil; }, TMP_13.$$arity = 2); Opal.defn(self, '$_racc_do_reduce', TMP_14 = function $$_racc_do_reduce(arg, act) { var $a, $b, $c, self = this, _ = nil, goto_table = nil, goto_check = nil, goto_default = nil, goto_pointer = nil, nt_base = nil, reduce_table = nil, use_result = nil, state = nil, vstack = nil, tstack = nil, i = nil, len = nil, reduce_to = nil, method_id = nil, void_array = nil, tmp_t = nil, tmp_v = nil, k1 = nil, curstate = nil; $b = arg, $a = Opal.to_ary($b), _ = ($a[0] == null ? nil : $a[0]), _ = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]), _ = ($a[3] == null ? nil : $a[3]), goto_table = ($a[4] == null ? nil : $a[4]), goto_check = ($a[5] == null ? nil : $a[5]), goto_default = ($a[6] == null ? nil : $a[6]), goto_pointer = ($a[7] == null ? nil : $a[7]), nt_base = ($a[8] == null ? nil : $a[8]), reduce_table = ($a[9] == null ? nil : $a[9]), _ = ($a[10] == null ? nil : $a[10]), _ = ($a[11] == null ? nil : $a[11]), _ = ($a[12] == null ? nil : $a[12]), use_result = ($a[13] == null ? nil : $a[13]), $b; state = self.racc_state; vstack = self.racc_vstack; tstack = self.racc_tstack; i = $rb_times(act, -3); len = reduce_table['$[]'](i); reduce_to = reduce_table['$[]']($rb_plus(i, 1)); method_id = reduce_table['$[]']($rb_plus(i, 2)); void_array = []; if ((($a = self.yydebug) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { tmp_t = tstack['$[]'](len['$-@'](), len)}; tmp_v = vstack['$[]'](len['$-@'](), len); if ((($a = self.yydebug) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { tstack['$[]='](len['$-@'](), len, void_array)}; vstack['$[]='](len['$-@'](), len, void_array); state['$[]='](len['$-@'](), len, void_array); if (use_result !== false && use_result !== nil && use_result != null) { vstack.$push(self.$__send__(method_id, tmp_v, vstack, tmp_v['$[]'](0))) } else { vstack.$push(self.$__send__(method_id, tmp_v, vstack)) }; tstack.$push(reduce_to); if ((($a = self.yydebug) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$racc_reduce(tmp_t, reduce_to, tstack, vstack)}; k1 = $rb_minus(reduce_to, nt_base); if ((($a = i = goto_pointer['$[]'](k1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { i = $rb_plus(i, state['$[]'](-1)); if ((($a = ($b = ($c = $rb_ge(i, 0), $c !== false && $c !== nil && $c != null ?(curstate = goto_table['$[]'](i)) : $c), $b !== false && $b !== nil && $b != null ?goto_check['$[]'](i)['$=='](k1) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return curstate};}; return goto_default['$[]'](k1); }, TMP_14.$$arity = 2); Opal.defn(self, '$on_error', TMP_15 = function $$on_error(t, val, vstack) { var $a, self = this; return self.$raise($scope.get('ParseError'), self.$sprintf("\nparse error on value %s (%s)", val.$inspect(), ((($a = self.$token_to_str(t)) !== false && $a !== nil && $a != null) ? $a : "?"))); }, TMP_15.$$arity = 3); Opal.defn(self, '$yyerror', TMP_16 = function $$yyerror() { var self = this; return self.$throw("racc_jump", 1); }, TMP_16.$$arity = 0); Opal.defn(self, '$yyaccept', TMP_17 = function $$yyaccept() { var self = this; return self.$throw("racc_jump", 2); }, TMP_17.$$arity = 0); Opal.defn(self, '$yyerrok', TMP_18 = function $$yyerrok() { var self = this; return self.racc_error_status = 0; }, TMP_18.$$arity = 0); Opal.defn(self, '$racc_read_token', TMP_19 = function $$racc_read_token(t, tok, val) { var self = this; self.racc_debug_out.$print("read "); self.racc_debug_out.$print(tok.$inspect(), "(", self.$racc_token2str(t), ") "); self.racc_debug_out.$puts(val.$inspect()); return self.racc_debug_out.$puts(); }, TMP_19.$$arity = 3); Opal.defn(self, '$racc_shift', TMP_20 = function $$racc_shift(tok, tstack, vstack) { var self = this; self.racc_debug_out.$puts("shift " + (self.$racc_token2str(tok))); self.$racc_print_stacks(tstack, vstack); return self.racc_debug_out.$puts(); }, TMP_20.$$arity = 3); Opal.defn(self, '$racc_reduce', TMP_22 = function $$racc_reduce(toks, sim, tstack, vstack) { var $a, $b, TMP_21, self = this, out = nil; out = self.racc_debug_out; out.$print("reduce "); if ((($a = toks['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { out.$print(" ") } else { ($a = ($b = toks).$each, $a.$$p = (TMP_21 = function(t){var self = TMP_21.$$s || this; if (t == null) t = nil; return out.$print(" ", self.$racc_token2str(t))}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21), $a).call($b) }; out.$puts(" --> " + (self.$racc_token2str(sim))); self.$racc_print_stacks(tstack, vstack); return self.racc_debug_out.$puts(); }, TMP_22.$$arity = 4); Opal.defn(self, '$racc_accept', TMP_23 = function $$racc_accept() { var self = this; self.racc_debug_out.$puts("accept"); return self.racc_debug_out.$puts(); }, TMP_23.$$arity = 0); Opal.defn(self, '$racc_e_pop', TMP_24 = function $$racc_e_pop(state, tstack, vstack) { var self = this; self.racc_debug_out.$puts("error recovering mode: pop token"); self.$racc_print_states(state); self.$racc_print_stacks(tstack, vstack); return self.racc_debug_out.$puts(); }, TMP_24.$$arity = 3); Opal.defn(self, '$racc_next_state', TMP_25 = function $$racc_next_state(curstate, state) { var self = this; self.racc_debug_out.$puts("goto " + (curstate)); self.$racc_print_states(state); return self.racc_debug_out.$puts(); }, TMP_25.$$arity = 2); Opal.defn(self, '$racc_print_stacks', TMP_27 = function $$racc_print_stacks(t, v) { var $a, $b, TMP_26, self = this, out = nil; out = self.racc_debug_out; out.$print(" ["); ($a = ($b = t).$each_index, $a.$$p = (TMP_26 = function(i){var self = TMP_26.$$s || this; if (i == null) i = nil; return out.$print(" (", self.$racc_token2str(t['$[]'](i)), " ", v['$[]'](i).$inspect(), ")")}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26), $a).call($b); return out.$puts(" ]"); }, TMP_27.$$arity = 2); Opal.defn(self, '$racc_print_states', TMP_29 = function $$racc_print_states(s) { var $a, $b, TMP_28, self = this, out = nil; out = self.racc_debug_out; out.$print(" ["); ($a = ($b = s).$each, $a.$$p = (TMP_28 = function(st){var self = TMP_28.$$s || this; if (st == null) st = nil; return out.$print(" ", st)}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28), $a).call($b); return out.$puts(" ]"); }, TMP_29.$$arity = 1); Opal.defn(self, '$racc_token2str', TMP_30 = function $$racc_token2str(tok) { var $a, self = this; return ((($a = ((self.$class()).$$scope.get('Racc_token_to_s_table'))['$[]'](tok)) !== false && $a !== nil && $a != null) ? $a : self.$raise("[Racc Bug] can't convert token " + (tok) + " to string")); }, TMP_30.$$arity = 1); return (Opal.defn(self, '$token_to_str', TMP_31 = function $$token_to_str(t) { var self = this; return ((self.$class()).$$scope.get('Racc_token_to_s_table'))['$[]'](t); }, TMP_31.$$arity = 1), nil) && 'token_to_str'; })($scope.base, null); })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/parser/grammar"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash = Opal.hash, $range = Opal.range; Opal.add_stubs(['$require', '$new', '$each', '$empty?', '$[]=', '$to_i', '$+', '$split', '$new_compstmt', '$[]', '$new_block', '$<<', '$new_body', '$lex_state=', '$lexer', '$new_alias', '$s', '$to_sym', '$value', '$new_if', '$new_while', '$new_until', '$new_rescue_mod', '$new_op_asgn', '$op_to_setter', '$new_assign', '$new_unary_call', '$new_iter', '$new_call', '$new_js_call', '$new_super', '$new_yield', '$new_return', '$new_break', '$new_next', '$concat', '$children', '$new_assignable', '$new_js_attrasgn', '$new_attrasgn', '$new_colon2', '$new_colon3', '$new_const', '$new_sym', '$new_op_asgn1', '$raise', '$new_irange', '$new_erange', '$new_binary_call', '$new_int', '$new_float', '$include?', '$type', '$==', '$-@', '$to_f', '$new_and', '$new_or', '$cond_push', '$cond_pop', '$new_hash', '$add_block_pass', '$cmdarg_push', '$cmdarg_pop', '$new_block_pass', '$new_splat', '$line', '$new_nil', '$new_paren', '$new_array', '$new_method_call_with_block', '$new_class', '$new_sclass', '$new_module', '$push_scope', '$new_def', '$pop_scope', '$new_shadowarg', '$new_block_args', '$new_ident', '$new_optarg', '$new_restarg', '$push', '$intern', '$nil?', '$new_str', '$str_append', '$new_xstr', '$new_regexp', '$new_str_content', '$strterm', '$strterm=', '$new_evstr', '$cond_lexpop', '$cmdarg_lexpop', '$new_gvar', '$new_ivar', '$new_cvar', '$new_dsym', '$negate_num', '$new_self', '$new_true', '$new_false', '$new___FILE__', '$new___LINE__', '$new_var_ref', '$new_kwrestarg', '$new_kwoptarg', '$new_kwarg', '$new_args_tail', '$new_args', '$add_local', '$scope', '$insert', '$source', '$new_kwsplat']); self.$require("racc/parser.rb"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Parser(){}; var self = $Parser = $klass($base, $super, 'Parser', $Parser); var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_1, $c, TMP_3, $d, TMP_5, $e, TMP_7, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_40, TMP_41, TMP_42, TMP_43, TMP_44, TMP_45, TMP_46, TMP_47, TMP_48, TMP_49, TMP_50, TMP_51, TMP_52, TMP_53, TMP_54, TMP_55, TMP_56, TMP_57, TMP_58, TMP_59, TMP_60, TMP_61, TMP_62, TMP_63, TMP_64, TMP_65, TMP_66, TMP_67, TMP_68, TMP_69, TMP_70, TMP_71, TMP_72, TMP_73, TMP_74, TMP_75, TMP_76, TMP_77, TMP_78, TMP_79, TMP_80, TMP_81, TMP_82, TMP_83, TMP_84, TMP_85, TMP_86, TMP_87, TMP_88, TMP_89, TMP_90, TMP_91, TMP_92, TMP_93, TMP_94, TMP_95, TMP_96, TMP_97, TMP_98, TMP_99, TMP_100, TMP_101, TMP_102, TMP_103, TMP_104, TMP_105, TMP_106, TMP_107, TMP_108, TMP_109, TMP_110, TMP_111, TMP_112, TMP_113, TMP_114, TMP_115, TMP_116, TMP_117, TMP_118, TMP_119, TMP_120, TMP_121, TMP_122, TMP_123, TMP_124, TMP_125, TMP_126, TMP_127, TMP_128, TMP_129, TMP_130, TMP_131, TMP_132, TMP_133, TMP_134, TMP_135, TMP_136, TMP_137, TMP_138, TMP_139, TMP_140, TMP_141, TMP_142, TMP_143, TMP_144, TMP_145, TMP_146, TMP_147, TMP_148, TMP_149, TMP_150, TMP_151, TMP_152, TMP_153, TMP_154, TMP_155, TMP_156, TMP_157, TMP_158, TMP_159, TMP_160, TMP_161, TMP_162, TMP_163, TMP_164, TMP_165, TMP_166, TMP_167, TMP_168, TMP_169, TMP_170, TMP_171, TMP_172, TMP_173, TMP_174, TMP_175, TMP_176, TMP_177, TMP_178, TMP_179, TMP_180, TMP_181, TMP_182, TMP_183, TMP_184, TMP_185, TMP_186, TMP_187, TMP_188, TMP_189, TMP_190, TMP_191, TMP_192, TMP_193, TMP_194, TMP_195, TMP_196, TMP_197, TMP_198, TMP_199, TMP_200, TMP_201, TMP_202, TMP_203, TMP_204, TMP_205, TMP_206, TMP_207, TMP_208, TMP_209, TMP_210, TMP_211, TMP_212, TMP_213, TMP_214, TMP_215, TMP_216, TMP_217, TMP_218, TMP_219, TMP_220, TMP_221, TMP_222, TMP_223, TMP_224, TMP_225, TMP_226, TMP_227, TMP_228, TMP_229, TMP_230, TMP_231, TMP_232, TMP_233, TMP_234, TMP_235, TMP_236, TMP_237, TMP_238, TMP_239, TMP_240, TMP_241, TMP_242, TMP_243, TMP_244, TMP_245, TMP_246, TMP_247, TMP_248, TMP_249, TMP_250, TMP_251, TMP_252, TMP_253, TMP_254, TMP_255, TMP_256, TMP_257, TMP_258, TMP_259, TMP_260, TMP_261, TMP_262, TMP_263, TMP_264, TMP_265, TMP_266, TMP_267, TMP_268, TMP_269, TMP_270, TMP_271, TMP_272, TMP_273, TMP_274, TMP_275, TMP_276, TMP_277, TMP_278, TMP_279, TMP_280, TMP_281, TMP_282, TMP_283, TMP_284, TMP_285, TMP_286, TMP_287, TMP_288, TMP_289, TMP_290, TMP_291, TMP_292, TMP_293, TMP_294, TMP_295, TMP_296, TMP_297, TMP_298, TMP_299, TMP_300, TMP_301, TMP_302, TMP_303, TMP_304, TMP_305, TMP_306, TMP_307, TMP_308, TMP_309, TMP_310, TMP_311, TMP_312, TMP_313, TMP_314, TMP_315, TMP_316, TMP_317, TMP_318, TMP_319, TMP_320, TMP_321, TMP_322, TMP_323, TMP_324, TMP_325, TMP_326, TMP_327, TMP_328, TMP_329, TMP_330, TMP_331, TMP_332, TMP_333, TMP_334, TMP_335, TMP_336, TMP_337, TMP_338, TMP_339, TMP_340, TMP_341, TMP_342, TMP_343, TMP_344, TMP_345, TMP_346, TMP_347, TMP_348, TMP_349, TMP_350, TMP_351, TMP_352, TMP_353, TMP_354, TMP_355, TMP_356, TMP_357, TMP_358, TMP_359, TMP_360, TMP_361, TMP_362, TMP_363, TMP_364, TMP_365, TMP_366, TMP_367, TMP_368, TMP_369, TMP_370, TMP_371, TMP_372, TMP_373, TMP_374, TMP_375, TMP_376, TMP_377, TMP_378, TMP_379, TMP_380, TMP_381, TMP_382, TMP_383, TMP_384, TMP_385, TMP_386, TMP_387, TMP_388, TMP_389, TMP_390, TMP_391, TMP_392, TMP_393, TMP_394, TMP_395, TMP_396, TMP_397, TMP_398, TMP_399, TMP_400, TMP_401, TMP_402, TMP_403, TMP_404, TMP_405, TMP_406, TMP_407, TMP_408, TMP_409, TMP_410, clist = nil, racc_action_table = nil, arr = nil, idx = nil, racc_action_check = nil, racc_action_pointer = nil, racc_action_default = nil, racc_goto_table = nil, racc_goto_check = nil, racc_goto_pointer = nil, racc_goto_default = nil, racc_reduce_table = nil, racc_reduce_n = nil, racc_shift_n = nil, racc_token_table = nil, racc_nt_base = nil, racc_use_result_var = nil; clist = ["64,65,66,8,52,598,258,568,58,59,258,258,598,62,98,60,61,63,28,29,67", "68,-95,-477,-103,109,642,27,26,25,91,90,92,93,560,468,18,559,677,677", "-102,-87,7,42,6,9,95,94,85,51,87,86,88,-98,89,96,97,598,82,83,196,39", "40,-94,-100,-70,677,206,207,620,253,676,676,-95,-97,253,560,102,197", "562,206,207,101,37,598,-103,31,641,598,53,257,55,-95,33,257,257,-103", "41,74,676,-102,-82,206,207,-99,19,75,-87,-98,567,80,74,76,77,78,79,102", "198,597,75,81,101,-100,102,-87,597,-94,57,101,-94,54,64,65,66,673,52", "38,84,205,58,59,-97,-93,-87,62,-101,60,61,63,28,29,67,68,-87,311,-89", "835,247,27,26,25,91,90,92,93,-94,-91,18,102,-569,597,938,619,101,42", "-94,-88,95,94,85,51,87,86,88,546,89,96,97,-99,82,83,102,39,40,-93,102", "101,597,302,102,101,597,303,-95,101,-95,-90,-103,-95,-103,-570,-102", "-103,-102,211,311,-102,215,216,-98,53,-98,55,-101,-98,-465,630,400,41", "755,755,-89,-465,-100,-102,-100,19,560,-100,677,562,80,74,76,77,78,79", "-92,206,207,75,81,-97,-91,-97,755,-88,-97,57,403,-93,54,64,65,66,-569", "52,38,84,102,58,59,676,414,101,62,-90,60,61,63,28,29,67,68,-92,632,631", "628,801,27,26,25,91,90,92,93,-93,-89,220,-99,-570,-99,699,630,-99,42", "-93,427,95,94,85,51,87,86,88,467,89,96,97,-91,82,83,-88,39,40,228,102", "102,754,754,204,101,101,-89,-101,102,-101,469,-96,-101,101,-569,-90", "-89,630,211,206,207,215,-570,-92,53,102,55,754,-91,225,101,-88,41,227", "226,632,631,604,-91,605,219,-88,813,-94,795,80,74,76,77,78,79,-90,470", "-103,75,81,814,-468,907,-92,-477,-90,57,216,-468,54,64,65,66,-92,52", "38,84,-475,58,59,632,631,628,62,-475,60,61,63,28,29,67,68,560,-567,503", "562,-98,27,26,25,91,90,92,93,-87,516,220,249,250,518,-100,665,-96,42", "-95,251,95,94,85,51,87,86,88,274,89,96,97,630,82,83,520,39,40,228,232", "237,238,239,234,236,244,245,240,241,-468,-468,221,222,908,102,242,243", "-468,211,101,630,215,-567,635,53,228,55,-69,271,225,269,231,41,227,226", "223,224,235,233,229,219,230,-567,304,305,80,272,76,77,78,79,632,631", "633,75,81,225,246,546,-238,227,226,57,-97,-468,54,-468,275,341,-474", "528,38,84,64,65,66,-474,52,338,632,631,58,59,838,311,605,62,998,60,61", "63,28,29,67,68,412,413,529,-93,530,27,26,25,91,90,92,93,424,-102,220", "356,355,426,425,665,539,42,541,542,95,94,85,51,87,86,88,274,89,96,97", "630,82,83,262,39,40,228,232,237,238,239,234,236,244,245,240,241,339", "311,221,222,-473,253,242,243,341,211,630,-473,215,206,207,53,543,55", "338,271,225,269,231,41,227,226,223,224,235,233,229,219,230,206,207,547", "80,272,76,77,78,79,632,631,637,75,81,-470,246,652,356,355,-471,57,-470", "548,54,228,275,-471,-472,311,38,84,64,65,66,-472,52,632,631,643,58,59", "356,355,311,62,563,60,61,63,28,29,67,68,564,339,520,-89,571,27,26,25", "91,90,92,93,625,-98,220,203,201,102,653,626,574,42,101,202,95,94,85", "51,87,86,88,274,89,96,97,575,82,83,578,39,40,102,579,228,800,586,101", "348,346,345,586,347,348,346,345,102,347,581,-91,583,101,211,865,838", "215,865,838,53,-100,55,199,271,200,269,225,41,593,594,227,226,223,224", "416,219,-88,610,611,612,80,272,76,77,78,79,-97,636,640,75,81,-335,-335", "644,647,-264,649,57,650,-335,54,651,275,253,664,228,38,84,64,65,66,8", "52,748,228,228,58,59,930,228,311,62,688,60,61,63,28,29,67,68,104,105", "106,107,108,27,26,25,91,90,92,93,689,692,18,701,-335,-82,-335,702,7", "42,704,9,95,94,85,51,87,86,88,552,89,96,97,715,82,83,721,39,40,722,586", "311,348,346,345,586,347,348,346,345,341,347,897,898,724,729,899,96,97", "37,338,743,281,228,744,53,746,55,961,33,348,346,345,41,347,750,203,463", "589,605,758,19,797,350,464,592,80,74,76,77,78,79,356,355,225,75,81,-265", "227,226,223,224,503,57,503,503,54,64,65,66,816,52,38,84,817,58,59,824", "518,520,62,715,60,61,63,295,296,67,68,339,832,466,253,465,291,292,298", "91,90,92,93,253,833,220,538,535,253,715,228,228,293,838,536,95,94,85", "51,87,86,88,843,89,96,97,845,82,83,846,331,847,348,346,345,341,347,849", "538,549,104,105,106,107,108,338,550,586,578,348,346,345,289,347,852", "286,854,849,53,858,55,534,285,537,861,838,869,870,350,326,104,105,106", "107,108,353,352,356,355,80,74,76,77,78,79,589,872,873,75,81,-569,875", "592,466,884,465,57,578,887,54,64,65,66,889,52,299,84,891,58,59,893,895", "-266,62,339,60,61,63,295,296,67,68,910,911,311,913,914,291,292,298,91", "90,92,93,915,916,220,538,607,917,715,919,-264,293,923,608,95,94,85,51", "87,86,88,-570,89,96,97,932,82,83,933,331,935,348,346,345,341,347,941", "943,944,538,616,311,957,-267,338,963,586,614,348,346,345,289,347,849", "215,972,849,53,849,55,606,976,609,932,979,980,985,350,578,570,987,989", "991,993,353,352,356,355,80,74,76,77,78,79,589,993,1003,75,81,932,1011", "860,301,721,615,57,537,849,54,64,65,66,932,52,299,84,1026,58,59,1027", "993,993,62,339,60,61,63,295,296,67,68,993,1032,1033,993,,291,292,298", "91,90,92,93,,,220,538,616,,,,,42,,742,95,94,85,51,87,86,88,,89,96,97", ",82,83,,39,40,,586,,348,346,345,586,347,348,346,345,341,347,961,,348", "346,345,,347,211,338,,215,,,53,,55,615,,537,,,41,,,-288,-288,589,,,219", ",350,-288,,80,74,76,77,78,79,356,355,,75,81,,,,,,,57,,,54,64,65,66,", "52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,339,,-288,,-288,291,292", "298,91,90,92,93,,,220,538,616,,,,,42,,742,95,94,85,51,87,86,88,,89,96", "97,,82,83,,39,40,,586,,348,346,345,586,347,348,346,345,341,347,,,,,", ",,211,338,,215,,,53,,55,615,,537,,,41,,,-290,-290,589,,,219,,350,-290", ",80,74,76,77,78,79,356,355,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,", "58,59,,,,62,,60,61,63,295,296,67,68,339,,-290,,-290,291,292,298,91,90", "92,93,,,220,538,1001,,,,,42,,1002,95,94,85,51,87,86,88,,89,96,97,,82", "83,,39,40,,228,,,,,586,,348,346,345,341,347,,,,,,242,243,211,338,,215", ",,53,,55,1000,,609,225,,41,,227,226,223,224,,,219,,350,,,80,74,76,77", "78,79,356,355,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,", "60,61,63,28,29,67,68,339,,,,,27,26,25,91,90,92,93,,,18,,586,,348,346", "345,42,347,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,228,586,,348", "346,345,586,347,348,346,345,341,347,589,,,,242,243,,211,338,,215,,,53", ",55,,,225,,231,41,227,226,223,224,589,,229,19,230,350,,,80,74,76,77", "78,79,356,355,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,", "60,61,63,28,29,67,68,339,,,,,27,26,25,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,274,89,96,97,,82,83,,39,40,228,232,237,238,239,234", "236,244,245,240,241,-287,-287,221,222,,,242,243,-287,211,,,215,-570", ",53,,55,,271,225,,231,41,227,226,223,224,235,233,229,219,230,,,,80,272", "76,77,78,79,,,,75,81,,246,818,,,,57,,-287,54,-287,275,,,,38,84,64,65", "66,,52,,,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90", "92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96,97,,82,83,,39", "40,228,232,237,238,239,234,236,244,245,240,241,,,221,222,,,242,243,", "211,,,215,,,53,,55,,,225,,231,41,227,226,223,224,235,233,229,219,230", ",,,80,272,76,77,78,79,,,,75,81,,246,,,,,57,,,54,,275,,,,38,84,64,65", "66,,52,,,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93", ",,18,,586,,348,346,345,42,347,,95,94,85,51,87,86,88,,89,96,97,,82,83", ",39,40,228,,,,,,586,,348,346,345,341,347,589,,,,242,243,,211,338,,215", ",,53,,55,,,225,,231,41,227,226,223,224,,,229,19,230,350,,,80,74,76,77", "78,79,356,355,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,", "60,61,63,28,29,67,68,339,,,,,27,26,25,91,90,92,93,,,18,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,228,,,,,,586,,348,346,345", "341,347,,,,,242,243,,211,338,,215,,,53,,55,,,225,,231,41,227,226,223", "224,,,229,19,230,350,,,80,74,76,77,78,79,356,355,,75,81,,,,,,,57,,,54", "64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,339,,,,,27,26", "25,91,90,92,93,,,18,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83", ",39,40,228,,,,,,586,,348,346,345,341,347,,,,,242,243,,211,338,,215,", ",53,,55,,,225,,231,41,227,226,223,224,,,229,19,230,350,,,80,74,76,77", "78,79,356,355,,75,81,102,,,,,101,57,,,54,64,65,66,,52,38,84,,58,59,", ",,62,,60,61,63,295,296,67,68,339,,,,,291,292,298,91,90,92,93,,,220,", ",,,,,293,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,331,,348,346,345,341", "347,,,,,,,,,338,,,,,,,368,,,31,,,53,,55,,33,,,,,,350,,,,,,,353,352,356", "355,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,299,84,,58", "59,,,,62,339,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220", ",,,,,,293,,,95,94,85,51,87,86,373,,89,96,97,228,82,83,,331,,348,346", "345,341,347,,,,,,,242,243,338,,,,379,,,374,,,215,,225,53,231,55,227", "226,223,224,,,,350,,,,,,,353,352,356,355,80,74,76,77,78,79,,,,75,81", ",,,,,,57,,,54,-566,-566,-566,,-566,299,84,,-566,-566,,,,-566,339,-566", "-566,-566,-566,-566,-566,-566,,-566,,,,-566,-566,-566,-566,-566,-566", "-566,,,-566,,,,,,,-566,,,-566,-566,-566,-566,-566,-566,-566,-566,-566", "-566,-566,,-566,-566,,-566,-566,228,232,237,238,239,234,236,244,245", "240,241,,,221,222,,,242,243,,-566,,,-566,-566,,-566,,-566,,-566,225", "-566,231,-566,227,226,223,224,235,233,229,-566,230,-566,,,-566,-566", "-566,-566,-566,-566,,,,-566,-566,,246,,,,,-566,,,-566,,-566,,,,-566", "-566,-567,-567,-567,,-567,,,,-567,-567,,,,-567,,-567,-567,-567,-567", "-567,-567,-567,,-567,,,,-567,-567,-567,-567,-567,-567,-567,,,-567,,", ",,,,-567,,,-567,-567,-567,-567,-567,-567,-567,-567,-567,-567,-567,,-567", "-567,,-567,-567,228,232,237,238,239,234,236,244,245,240,241,,,221,222", ",,242,243,,-567,,,-567,-567,,-567,,-567,,-567,225,-567,231,-567,227", "226,223,224,235,233,229,-567,230,-567,,,-567,-567,-567,-567,-567,-567", ",,,-567,-567,,246,,,,,-567,,,-567,,-567,,,,-567,-567,64,65,66,8,52,", ",,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,", ",,,,7,42,6,9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,228,,,,,,586", ",348,346,345,341,347,,,,,242,243,,37,338,,31,,,53,,55,,33,225,,231,41", "227,226,223,224,,,,19,,350,,,80,74,76,77,78,79,356,355,,75,81,,,,,,416", "57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,339,,", ",,27,26,25,91,90,92,93,,,18,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97", ",82,83,,39,40,,,,,,,586,,348,346,345,341,347,,,,,,,,211,338,,215,,,53", ",55,,,,,,41,,,,,,,,19,,350,,,80,74,76,77,78,79,356,355,,75,81,,,,,,", "57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,339,,", ",,27,26,25,91,90,92,93,,,18,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97", ",82,83,,39,40,228,232,237,238,239,234,236,244,245,240,241,,,221,222", ",,242,243,,211,,,215,,,53,,55,,,225,,231,41,227,226,223,224,235,233", "229,19,230,,,,80,74,76,77,78,79,,,,75,81,,246,,,,,57,,,54,64,65,66,", "52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93", ",,18,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,228,232", "237,238,239,234,236,244,245,240,241,,,221,222,,,242,243,,211,,,215,", ",53,,55,,,225,,231,41,227,226,223,224,235,233,229,19,230,,,,80,74,76", "77,78,79,,,,75,81,,246,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,", "60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,,42,,,95,94", "85,51,87,86,88,,89,96,97,,82,83,,39,40,228,232,237,238,239,234,236,244", "245,240,241,,,221,222,,,242,243,,211,,,215,,,53,,55,,,225,,231,41,227", "226,223,224,235,233,229,19,230,,,,80,74,76,77,78,79,,,,75,81,,246,,", ",,57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,", ",,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89,96", "97,,82,83,,39,40,228,232,237,238,239,234,236,244,245,240,241,,,221,222", ",,242,243,,37,,,31,,,53,,55,,33,225,,231,41,227,226,223,224,235,233", "229,19,230,,,,80,74,76,77,78,79,,,,75,81,,246,,,,,57,,,54,64,65,66,8", "52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93", ",,18,,,,,,7,42,6,9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,228", "232,237,238,239,234,236,244,245,240,241,,,221,222,,,242,243,,37,,,31", ",,53,,55,,33,225,,231,41,227,226,223,224,235,233,229,19,230,,,,80,74", "76,77,78,79,,,,75,81,,246,,,,,57,,,54,64,65,66,8,52,38,84,,58,59,,,", "62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9", "95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,228,232,237,238,239,234", "236,244,245,240,241,,,221,222,,,242,243,,37,,,31,,,53,,55,,33,225,,231", "41,227,226,223,224,235,233,229,19,230,,,,80,74,76,77,78,79,,,,75,81", ",246,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67", "68,,,,,,27,26,25,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,", "89,96,97,,82,83,,39,40,228,232,237,238,239,234,236,244,245,240,241,", ",221,222,,,242,243,,211,,,215,,,53,,55,,432,225,,231,41,227,226,223", "224,235,233,229,219,230,,,,80,74,76,77,78,79,,,,75,81,,246,,,,,57,,", "54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26", "25,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83", ",39,40,228,232,237,238,239,234,236,244,245,240,241,,,221,222,,,242,243", ",211,,,215,,,53,,55,,,225,,231,41,227,226,223,224,235,233,229,219,230", ",,,80,74,76,77,78,79,,,,75,81,,246,,,,,57,,,54,64,65,66,,52,38,84,,58", "59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,220,,,,,", ",42,,,95,94,85,51,87,86,88,274,89,96,97,,82,83,,39,40,228,232,237,238", "239,234,236,244,245,240,241,,,221,222,,,242,243,,211,,,215,,,53,,55", ",271,225,,231,41,227,226,223,224,235,233,229,219,230,,,,80,272,76,77", "78,79,,,,75,81,,246,,,,,57,,,54,,275,,,,38,84,64,65,66,,52,,,,58,59", ",,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,220,,,,,,,42", ",,95,94,85,51,87,86,88,274,89,96,97,,82,83,,39,40,228,232,237,238,239", "234,236,244,245,240,241,,,221,222,,,242,243,,211,,,215,,,53,,55,,271", "225,,231,41,227,226,223,224,235,233,229,219,230,,,,80,272,76,77,78,79", ",,,75,81,,246,,,,,57,,,54,,275,,,,38,84,64,65,66,,52,,,,58,59,,,,62", ",60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,228,232,237,238,239,234,236", "244,245,240,241,,,221,222,,,242,243,,211,,,215,,,53,,55,,,225,,231,41", "227,226,223,224,235,233,229,219,230,,,,80,74,76,77,78,79,,,,75,81,,246", ",,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,", ",,,27,26,25,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96", "97,,82,83,,39,40,228,232,237,238,239,234,236,244,245,240,241,,,-590", "-590,,,242,243,,211,,,215,,,53,,55,,432,225,,231,41,227,226,223,224", "235,233,229,219,230,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65", "66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90", "92,93,,,18,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,228", "232,237,238,239,234,236,244,245,240,241,,,-590,-590,,,242,243,,211,", ",215,,,53,,55,,,225,,231,41,227,226,223,224,235,233,229,19,230,,,,80", "74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62", ",60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,,42,,,95,94", "85,51,87,86,88,,89,96,97,,82,83,,39,40,228,-590,-590,-590,-590,234,236", ",,-590,-590,,,,,,,242,243,,211,,,215,,,53,,55,,,225,,231,41,227,226", "223,224,235,233,229,19,230,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,", "54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26", "25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89,96,97,,82", "83,,39,40,228,-590,-590,-590,-590,234,236,,,-590,-590,,,,,,,242,243", ",37,,,31,,,53,,55,,33,225,,231,41,227,226,223,224,235,233,229,19,230", ",,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59", ",,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,,42", ",,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,228,-590,-590,-590,-590", "234,236,,,-590,-590,,,,,,,242,243,,211,,,215,,472,53,,55,,,225,,231", "41,227,226,223,224,235,233,229,19,230,,,,80,74,76,77,78,79,,,,75,81", ",,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68", ",,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,", "89,96,97,,82,83,,39,40,228,-590,-590,-590,-590,234,236,,,-590,-590,", ",,,,,242,243,,211,,,215,,,53,,55,,,225,,231,41,227,226,223,224,235,233", "229,219,230,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,228", "-590,-590,-590,-590,234,236,,,-590,-590,,,,,,,242,243,,211,,,215,,,53", ",55,,,225,,231,41,227,226,223,224,235,233,229,219,230,,,,80,74,76,77", "78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61", "63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94", "85,51,87,86,88,,89,96,97,,82,83,,39,40,228,-590,-590,-590,-590,234,236", ",,-590,-590,,,,,,,242,243,,211,,,215,,,53,,55,,,225,,231,41,227,226", "223,224,235,233,229,219,230,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,", ",54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291", "292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97", ",82,83,,39,40,228,232,237,238,239,234,236,,,240,241,,,,,,,242,243,,211", ",,215,,,53,,55,,,225,,231,41,227,226,223,224,235,233,229,219,230,,,", "80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,", ",,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,", ",,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,228,232,237,238", "239,234,236,244,,240,241,,,,,,,242,243,,211,,,215,,,53,,55,,,225,,231", "41,227,226,223,224,235,233,229,219,230,,,,80,74,76,77,78,79,,,,75,81", ",,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68", ",,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,", "89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41", ",,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,", ",,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76", "77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60", "61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,", "215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,", ",57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,", ",,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,", ",,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,", ",,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76", "77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60", "61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,", "215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,", ",57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,", ",,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,", ",,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,", ",,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76", "77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60", "61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,", "215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,", ",57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,", ",,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,", ",,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,", ",,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76", "77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60", "61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,", "215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,", ",57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,", ",,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,", ",,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,", ",,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76", "77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60", "61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,", "215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,", ",57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,", ",,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,", ",,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,", ",,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76", "77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60", "61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,", "215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,", ",57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,", ",,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,", ",,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,", ",,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76", "77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60", "61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,", "215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,", ",57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,", "27,26,25,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96", "97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,271,,269,,41", ",,,,,,,219,,,,,80,272,76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38", "84,64,65,66,,52,,,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91", "90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96,97,,82,83,", "39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,271,,269,,41,,,,,,,,219", ",,,,80,272,76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38,84,64,65,66", ",52,,,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,", ",220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96,97,,82,83,,39,40,,,,", ",,,,,,,,,,,,,,,,211,,,215,,514,53,,55,,271,,269,,41,,,,,,,,219,,,,,80", "272,76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38,84,64,65,66,,52,,", ",58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,", "220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,", ",,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78", "79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63", "295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85", "51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,", "53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,", "54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291", "292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97", ",82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,", "219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84", ",58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,", "220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,", ",,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78", "79,,,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63", "28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51", "87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,281,,,53,", "55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54", "64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292", "298,91,90,92,93,,,220,,,,,,,293,,,95,94,85,51,87,86,88,,89,96,97,,82", "83,,789,,348,346,345,341,347,,,,,,,,,338,,,,,,,289,,,215,,,53,,55,,", ",,,,,350,778,,,,,,353,352,356,355,80,74,76,77,78,79,,,,75,81,,,,532", ",,57,,,54,64,65,66,8,52,299,84,,58,59,,,,62,339,60,61,63,28,29,67,68", ",,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,281,,,53,,55,,33,,,,41", ",,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,293,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,331,,348", "346,345,341,347,,,,,,,,,338,,,,,,,289,,,286,,,53,,55,,,,,,,,350,,,,", ",,353,352,356,355,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66", "311,52,299,84,,58,59,,,,62,339,60,61,63,295,296,67,68,,,,,,291,292,298", "91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,", "39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,552,,53,,55,,,,,,41,,,,,,,,219,", ",,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58", "59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7", "42,,9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,", ",,,37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75", "81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67", "68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,293,,,95,94,85,51,87,86", "88,,89,96,97,,82,83,,789,,348,346,345,341,347,,,,,,,,,338,,,,,,,585", ",,215,,,53,,55,,,,,,,,350,,,,,,,353,352,356,355,80,74,76,77,78,79,,", ",75,81,,,,,,,57,,,54,64,65,66,,52,299,84,,58,59,,,,62,339,60,61,63,28", "29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,,42,,,95,94,85,51,87,86", "88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,", ",,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66", ",52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92", "93,,,18,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,", ",,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,19,,,,,80,74,76,77", "78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61", "63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,293,,,95,94", "85,51,87,86,373,,89,96,97,,82,83,,331,,348,346,345,341,347,,,,,,,,,338", ",,,,,,374,,,215,,,53,,55,,,,,,,,350,,,,,,,353,352,356,355,80,74,76,77", "78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,299,84,,58,59,,,,62,339,60", "61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,,42,,,95,94,85", "51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,", "53,,55,,,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54", "64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292", "298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82", "83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219", ",,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,-571,-571,-571,,-571,38", "84,,-571,-571,,,,-571,,-571,-571,-571,-571,-571,-571,-571,,,,,,-571", "-571,-571,-571,-571,-571,-571,,,-571,,,,,,,-571,,,-571,-571,-571,-571", "-571,-571,-571,-571,-571,-571,-571,,-571,-571,,-571,-571,,,,,,,,,,,", ",,,,,,,,,-571,,,-571,-571,,-571,,-571,,-571,,-571,,-571,,,,,,,,-571", ",,,,-571,-571,-571,-571,-571,-571,,,,-571,-571,,,,,,,-571,,,-571,,-571", ",,,-571,-571,-572,-572,-572,,-572,,,,-572,-572,,,,-572,,-572,-572,-572", "-572,-572,-572,-572,,,,,,-572,-572,-572,-572,-572,-572,-572,,,-572,", ",,,,,-572,,,-572,-572,-572,-572,-572,-572,-572,-572,-572,-572,-572,", "-572,-572,,-572,-572,,,,,,,,,,,,,,,,,,,,,-572,,,-572,-572,,-572,,-572", ",-572,,-572,,-572,,,,,,,,-572,,,,,-572,-572,-572,-572,-572,-572,,,,-572", "-572,,,,,,,-572,,,-572,,-572,,,,-572,-572,64,65,66,,52,,,,58,59,,,,62", ",60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,274,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211", ",,215,,,53,,55,,271,,,,41,,,,,,,,219,,,,,80,272,76,77,78,79,,,,75,81", ",,,,,,57,,,54,,275,,,,38,84,64,65,66,,52,,,,58,59,,,,62,,60,61,63,28", "29,67,68,,,,,,27,26,25,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86", "88,274,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55", ",271,,,,41,,,,,,,,219,,,,,80,272,76,77,78,79,,,,75,81,,,,,,,57,,,54", ",275,,,,38,84,64,65,66,,52,,,,58,59,,,,62,,60,61,63,295,296,67,68,,", ",,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,", ",,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,", ",,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76", "77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60", "61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,", "215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,", ",57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,", ",,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,", ",,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96,97,,82,83,,39,40", ",,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,696,,269,,41,,,,,,,,219,,,,", "80,272,76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38,84,64,65,66,,52", ",,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93", ",,220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96,97,,82,83,,39,40,,,", ",,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,269,,41,,,,,,,,219,,,,,80,272", "76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38,84,64,65,66,,52,,,,58", "59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220", ",,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,", ",,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79", ",,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63,28", "29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87", "86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,", "33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,416,57,,,54,64", "65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298", "91,90,92,93,,,220,,,,,,,293,,,95,94,85,51,87,86,88,,89,96,97,,82,83", ",789,,348,346,345,341,347,,,,,,,,,338,,,,,,,289,,,286,,,53,,55,,,,,", ",,350,,,,,,,353,352,356,355,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54", "64,65,66,,52,299,84,,58,59,,,,62,339,60,61,63,28,29,67,68,,,,,,27,26", "25,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96,97,,82", "83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,271,,,,41,,,,,,,,219", ",,,,80,272,76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38,84,64,65,66", ",52,,,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,", ",220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96,97,,82,83,,39,40,,,,", ",,,,,,,,,,,,,,,,211,,,215,,,53,,55,,271,,,,41,,,,,,,,219,,,,,80,272", "76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38,84,64,65,66,,52,,,,58", "59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220", ",,,,,,293,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,789,,348,346,345", "341,347,,,,,,,,,338,,,,,,,289,,,286,,,53,,55,,,,,,,,350,,,,,,,353,352", "356,355,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,299,84", ",58,59,,,,62,339,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93", ",,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,", ",,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77", "78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61", "63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94", "85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215", ",,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57", ",,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291", "292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97", ",82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,", "219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84", ",58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,", ",,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,", ",,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,", "75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296", "67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86", "88,274,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55", ",696,,269,,41,,,,,,,,219,,,,,80,272,76,77,78,79,,,,75,81,,,,,,,57,,", "54,,275,,,,38,84,64,65,66,,52,,,,58,59,,,,62,,60,61,63,295,296,67,68", ",,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,274", "89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41", ",,,,,,,219,,,,,80,272,76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38", "84,64,65,66,8,52,,,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25", "91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89,96,97,,82,83", ",39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,", "80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58,59", ",,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42", ",9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,", "37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81", ",,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68", ",,,,,291,292,298,91,90,92,93,,,220,,,,,,,293,,,95,94,85,51,87,86,88", ",89,96,97,,82,83,,789,,348,346,345,341,347,,,,,,,,,338,,,,,,,585,,,215", ",,53,,55,,,,,,,,350,778,,,,,,353,352,356,355,80,74,76,77,78,79,,,,75", "81,,,,,,,57,,,54,64,65,66,8,52,299,84,,58,59,,,,62,339,60,61,63,28,29", "67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86", "88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,,33", ",,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66", "8,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92", "93,,,18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,", ",,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76", "77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60", "61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94", "85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,", ",53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57", ",,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26", "25,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96,97,,82", "83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,271,,,,41,,,,,,,,219", ",,,,80,272,76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38,84,64,65,66", ",52,,,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,", ",220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96,97,,82,83,,39,40,,,,", ",,,,,,,,,,,,,,,,211,,,215,,,53,,55,,271,,,,41,,,,,,,,219,,,,,80,272", "76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38,84,64,65,66,,52,,,,58", "59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,220,,,,,", ",42,,,95,94,85,51,87,86,88,274,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,", ",,,,,,211,,,215,,,53,,55,,271,,,,41,,,,,,,,219,,,,,80,272,76,77,78,79", ",,,75,81,,,,,,,57,,,54,,275,,,,38,84,64,65,66,,52,,,,58,59,,,,62,,60", "61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,,42,,,95,94,85", "51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,", "53,,55,,,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54", "64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25", "91,90,92,93,,,18,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39", "40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,19,,,,,80,74", "76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,", "60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,", ",95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211", ",,215,,,53,,55,,799,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81", ",,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68", ",,,,,27,26,25,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,", ",,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,", ",220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,", ",,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78", "79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63", "28,29,67,68,,,,,,27,26,25,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87", "86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55", ",,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65", "66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91", "90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39", "40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80", "74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62", ",60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,", "215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,", ",57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,", ",,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,", ",,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,8,52", "38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,", ",18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,", ",,,,,,,,,,,,,,37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77,78", "79,,,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63", "28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51", "87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55", ",33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64", "65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298", "91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96,97,,82,83", ",39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,696,,269,,41,,,,,,,,219", ",,,,80,272,76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38,84,64,65,66", ",52,,,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,274,89,96,97,,82,83,,39,40", ",,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,269,,41,,,,,,,,219,,,,,80", "272,76,77,78,79,,,,75,81,,,,,,,57,,,54,,275,,,,38,84,64,65,66,8,52,", ",,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,", ",,,,7,42,,9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,", ",,,,,,,,,37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79", ",,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63,28", "29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87", "86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,", "33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65", "66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91", "90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39", "40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80", "74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62", ",60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42", ",,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211", ",,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,", ",,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,", ",,,,291,292,298,91,90,92,93,,,220,,,,,,,293,,,95,94,85,51,87,86,88,", "89,96,97,,82,83,,789,,348,346,345,341,347,,,,,,,,,338,,,,,,,289,,,286", ",,53,,55,,,,,,,,350,,,,,,,353,352,356,355,80,74,76,77,78,79,,,,75,81", ",,,,,,57,,,54,64,65,66,,52,299,84,,58,59,,,,62,339,60,61,63,295,296", "67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,293,,,95,94,85,51,87", "86,88,,89,96,97,,82,83,,,,,,,,,,,,,,,,,,,,,,,,289,,,286,,,53,,55,,,", ",,,,,,,,,,,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "299,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,", ",,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,432,,,,41,,,,,,,,219,,,,,80,74", "76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,", "60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,", ",95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211", ",,215,,,53,,55,,271,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81", ",,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68", ",,,,,27,26,25,91,90,92,93,,,18,,,,,,,42,,,95,94,85,51,87,86,88,,89,96", "97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,", ",,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,8,52,38", "84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18", ",,,,,7,42,,9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,", ",,,,,,,,,,37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79", ",,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63,28", "29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87", "86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,", "33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65", "66,8,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90", "92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40", ",,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76", "77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60", "61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95", "94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,", "215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,", ",57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,", ",27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89,96", "97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,,33,,,,41,,,,", ",,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84", ",58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,", "220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,", ",,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78", "79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63", "28,29,67,68,,,,,,27,26,25,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87", "86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55", ",,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65", "66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90", "92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40", ",,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74", "76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,", "60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,", ",95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211", ",,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,", ",,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,", ",,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,", ",,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52", "38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92", "93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,", ",,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76", "77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60", "61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94", "85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,", ",53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57", ",,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26", "25,91,90,92,93,,,18,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83", ",39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,19,,,,", "80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58,59", ",,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42", ",9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,", "37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81", ",,,,,,57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68", ",,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89", "96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,,33,,,,41,", ",,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38", "84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93", ",,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,", ",,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77", "78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61", "63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94", "85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215", ",,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57", ",,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291", "292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97", ",82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,", "219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84", ",58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90,92,93,,", "220,,,,,,,42,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,", ",,,,,,,,,,,,211,,,215,,,53,,55,,,,,,41,,,,,,,,219,,,,,80,74,76,77,78", "79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,,,,62,,60,61,63", "295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85", "51,87,86,88,274,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215", ",,53,,55,,,,269,,41,,,,,,,,219,,,,,80,272,76,77,78,79,,,,75,81,,,,,", ",57,,,54,,275,,,,38,84,64,65,66,8,52,,,,58,59,,,,62,,60,61,63,28,29", "67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86", "88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,,33", ",,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66", ",52,38,84,,58,59,,,,62,,60,61,63,295,296,67,68,,,,,,291,292,298,91,90", "92,93,,,220,,,,,,,293,,,95,94,85,51,87,86,88,,89,96,97,,82,83,,,,,,", ",,,,,,,,,,,,,,,,,968,,,215,,,53,,55,,,,,,,,,,,,,,,,,,,80,74,76,77,78", "79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,299,84,,58,59,,,,62,,60,61,63", "295,296,67,68,,,,,,291,292,298,91,90,92,93,,,220,,,,,,,42,,,95,94,85", "51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,211,,,215,,", "53,,55,,696,,,,41,,,,,,,,219,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57", ",,54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27", "26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89,96,97,", "82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,,33,,,,41,,,,,,,,19", ",,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58", "59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7", "42,,9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,", ",,,37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75", "81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63,28,29,67", "68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86,88", ",89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,,33,,,", "41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,8", "52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93", ",,18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89,96,97,,82,83,,39,40,,,,,", ",,,,,,,,,,,,,,,37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77", "78,79,,,,75,81,,,,,,,57,,,54,64,65,66,8,52,38,84,,58,59,,,,62,,60,61", "63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,18,,,,,,7,42,,9,95,94,85", "51,87,86,88,,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53", ",55,,33,,,,41,,,,,,,,19,,,,,80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54", "64,65,66,8,52,38,84,,58,59,,,,62,,60,61,63,28,29,67,68,,,,,,27,26,25", "91,90,92,93,,,18,,,,,,7,42,,9,95,94,85,51,87,86,88,,89,96,97,,82,83", ",39,40,,,,,,,,,,,,,,,,,,,,,37,,,31,,,53,,55,,33,,,,41,,,,,,,,19,,,,", "80,74,76,77,78,79,,,,75,81,,,,,,,57,,,54,64,65,66,,52,38,84,,58,59,", ",,62,,60,61,63,28,29,67,68,,,,,,27,26,25,91,90,92,93,,,220,,,,,,,42", ",,95,94,85,51,87,86,88,274,89,96,97,,82,83,,39,40,,,,,,,,,,,,,,,,,,", ",,211,,,215,,,53,,55,,271,,,,41,,,,,,,,219,,,,-573,80,272,76,77,78,79", "-573,-573,-573,75,81,,-573,-573,,-573,,57,,,54,,275,,-573,,38,84,,,", ",,,,-573,-573,,-573,-573,-573,-573,-573,,,,,,,,,,,,,,,,,,,,,,-573,-573", "-573,-573,-573,-573,-573,-573,-573,-573,-573,-573,-573,-573,-573,,,-573", "-573,-573,,658,,,,-573,,,,,,-573,,-573,,-573,-573,-573,-573,-573,-573", "-573,,-573,-573,-573,,,,,,,,,,,,,-573,-573,,-90,,-573,,-287,-573,,-573", ",,-99,-287,-287,-287,,,,-287,-287,,-287,,,,,,,,,,,,,,,,,,,,-287,-287", ",-287,-287,-287,-287,-287,,,,,,,,,,,,,,,,,,,,,,-287,-287,-287,-287,-287", "-287,-287,-287,-287,-287,-287,-287,-287,-287,-287,,,-287,-287,-287,", "661,,,,-287,,,,,,-287,,-287,,-287,-287,-287,-287,-287,-287,-287,,-287", ",-287,,,,,,,,,,,,,-287,-287,,-92,,-287,,-573,-287,,-287,,,-101,-573", "-573,-573,,,-573,-573,-573,,-573,,,,,,,,,-573,-573,-573,,,,,,,,,-573", "-573,,-573,-573,-573,-573,-573,,,,,,,,,,,,,,,,,,,,,,-573,-573,-573,-573", "-573,-573,-573,-573,-573,-573,-573,-573,-573,-573,-573,,,-573,-573,-573", ",815,-573,,,-573,,-573,,-573,,-573,,-573,,-573,-573,-573,-573,-573,-573", "-573,,-573,-573,-573,,,,,,,,,,,,,-573,-573,-573,-573,,-573,,-287,-573", ",-573,,,-99,-287,-287,-287,,,-287,-287,-287,,-287,,,,,,,,,,-287,-287", ",,,,,,,,-287,-287,,-287,-287,-287,-287,-287,,,,,,,,,,,,,,,,,,,,,,-287", "-287,-287,-287,-287,-287,-287,-287,-287,-287,-287,-287,-287,-287,-287", ",,-287,-287,-287,,661,-287,,,-287,,-287,,-287,,-287,,-287,,-287,-287", "-287,-287,-287,-287,-287,,-287,,-287,,,,,,,,,,,,,-287,-287,-287,-287", ",-287,,-401,-287,,-287,,,-101,-401,-401,-401,,,-401,-401,-401,,-401", ",,,,,,,,-401,-401,-401,,,,,,,,,-401,-401,,-401,-401,-401,-401,-401,", ",,,,,,,,,,,,,,,,,,,,-401,-401,-401,-401,-401,-401,-401,-401,-401,-401", "-401,-401,-401,-401,-401,,,-401,-401,-401,,,-401,,253,-401,,-401,,-401", ",-401,,-401,,-401,-401,-401,-401,-401,-401,-401,,-401,-401,-401,,,,", ",,,,,,,,-401,-401,-401,-401,-296,-401,,,-401,,-401,-296,-296,-296,,", "-296,-296,-296,,-296,,,,,,,,,,-296,-296,,,,,,,,,-296,-296,,-296,-296", "-296,-296,-296,,,,,,,,,,,,,,,,,,,,,,-296,-296,-296,-296,-296,-296,-296", "-296,-296,-296,-296,-296,-296,-296,-296,,,-296,-296,-296,,,-296,,262", "-296,,-296,,-296,,-296,,-296,,-296,-296,-296,-296,-296,-296,-296,,-296", ",-296,,,,,,,,,,,,,-296,-296,-296,-296,-279,-296,,,-296,,-296,-279,-279", "-279,,,-279,-279,-279,,-279,,,,,,,,,,-279,-279,-279,,,,,,,,-279,-279", ",-279,-279,-279,-279,-279,,,,,,,,,,,,,,,,,,,,,,-279,-279,-279,-279,-279", "-279,-279,-279,-279,-279,-279,-279,-279,-279,-279,,,-279,-279,-279,", ",-279,,,-279,,-279,,-279,,-279,,-279,,-279,-279,-279,-279,-279,-279", "-279,,-279,,-279,,,,,,,,,,,,,-279,-279,-279,-279,-589,-279,,-279,-279", ",-279,-589,-589,-589,,,-589,-589,-589,,-589,,,,,,,,,-589,-589,-589,", ",,,,,,,-589,-589,,-589,-589,-589,-589,-589,,,,,,,,,,,,,,,,,,,,,,-589", "-589,-589,-589,-589,-589,-589,-589,-589,-589,-589,-589,-589,-589,-589", ",,-589,-589,-589,,,-589,,253,-589,,-589,,-589,,-589,,-589,,-589,-589", "-589,-589,-589,-589,-589,,-589,-589,-589,,,,,,,,,,,,,-589,-589,-589", "-589,-589,-589,,,-589,,-589,-589,-589,-589,,,-589,-589,-589,,-589,,", ",,,,,,-589,-589,-589,,,,,,,,,-589,-589,,-589,-589,-589,-589,-589,,,", ",,,,,,,,,,,,,,,,,,-589,-589,-589,-589,-589,-589,-589,-589,-589,-589", "-589,-589,-589,-589,-589,,,-589,-589,-589,,,-589,,253,-589,,-589,,-589", ",-589,,-589,,-589,-589,-589,-589,-589,-589,-589,,-589,-589,-589,,,,", ",,,,,,,,-589,-589,-589,-589,-589,-589,,,-589,,-589,-589,-589,-589,,", "-589,-589,-589,,-589,,,,,,,,,,-589,,,,,,,,,,-589,-589,,-589,-589,-589", "-589,-589,,,,,,,,,,,,-589,,,,,,,-589,-589,-589,,,-589,-589,-589,,-589", ",,,,-589,-589,,,,-589,,,-589,,,,,253,-589,-589,-589,,-589,-589,-589", "-589,-589,,,,,,,,,,,,-589,,,,,,,,,,,,,-589,,-589,,,-589,,,-589,-589", ",-589,,,,,-589,,-589,-589,-589,253,-589,-589,-589,-589,,-589,,,,,,,", ",,-589,,,,,-589,,,,,-589,-589,,-589,-589,-589,-589,-589,-589,,-589,", ",-589,444,448,,,446,,,,,,,,,143,144,140,122,123,124,131,128,130,,,125", "126,-589,-589,,,145,146,132,133,-589,,,,,253,-589,,,,,137,136,,121,142", "139,138,134,135,129,127,119,141,120,,-589,147,,,,,,,,,,,,-589,,-589", ",,-589,157,168,158,181,154,174,164,163,189,192,179,162,161,156,182,190", "191,166,155,169,173,175,167,160,,,,176,183,178,177,170,180,165,153,172", "171,184,185,186,187,188,152,159,150,151,148,149,112,114,111,,113,,,", ",,,,,143,144,140,122,123,124,131,128,130,,,125,126,,,,,145,146,132,133", ",,,,,,,,,,,137,136,,121,142,139,138,134,135,129,127,119,141,120,,,147", "193,,,,,,,,,,81,157,168,158,181,154,174,164,163,189,192,179,162,161", "156,182,190,191,166,155,169,173,175,167,160,,,,176,183,178,177,170,180", "165,153,172,171,184,185,186,187,188,152,159,150,151,148,149,112,114", ",,113,,,,,,,,,143,144,140,122,123,124,131,128,130,,,125,126,,,,,145", "146,132,133,,,,,,,,,,,,137,136,,121,142,139,138,134,135,129,127,119", "141,120,,,147,193,,,,,,,,,,81,157,168,158,181,154,174,164,163,189,192", "179,162,161,156,182,190,191,166,155,169,173,175,167,160,,,,176,183,178", "177,170,180,165,153,172,171,184,185,186,187,188,152,159,150,151,148", "149,112,114,,,113,,,,,,,,,143,144,140,122,123,124,131,128,130,,,125", "126,,,,,145,146,132,133,,,,,,,,,,,,137,136,,121,142,139,138,134,135", "129,127,119,141,120,,,147,193,,,,,,,,,,81,157,168,158,181,154,174,164", "163,189,192,179,162,161,156,182,190,191,166,155,169,173,175,167,160", ",,,176,183,178,177,170,180,165,153,172,171,184,185,186,187,188,152,159", "150,151,148,149,112,114,,,113,,,,,,,,,143,144,140,122,123,124,131,128", "130,,,125,126,,,,,145,146,132,133,,,,,,,,,,,,137,136,,121,142,139,138", "134,135,129,127,119,141,120,,,147,193,,,,,,,,,,81,157,168,158,181,154", "174,164,163,189,192,179,162,161,156,182,190,191,166,155,169,173,175", "167,160,,,,176,183,178,388,387,389,386,153,172,171,184,185,186,187,188", "152,159,150,151,384,385,382,114,87,86,383,,89,,,,,,,143,144,140,122", "123,124,131,128,130,,,125,126,,,,,145,146,132,133,,,,,,393,,,,,,137", "136,,121,142,139,138,134,135,129,127,119,141,120,,,147,157,168,158,181", "154,174,164,163,189,192,179,162,161,156,182,190,191,166,155,169,173", "175,167,160,,,,176,183,178,177,170,180,165,153,172,171,184,185,186,187", "188,152,159,150,151,148,149,112,114,410,409,113,,411,,,,,,,143,144,140", "122,123,124,131,128,130,,,125,126,,,,,145,146,132,133,,,,,,,,,,,,137", "136,,121,142,139,138,134,135,129,127,119,141,120,,,147,157,168,158,181", "154,174,164,163,189,192,179,162,161,156,182,190,191,166,155,169,173", "175,167,160,,,,176,183,178,177,170,180,165,153,172,171,184,185,186,187", "188,152,159,150,151,148,149,112,114,410,409,113,,411,,,,,,,143,144,140", "122,123,124,131,128,130,,,125,126,,,,,145,146,132,133,,,,,,,,,,,,137", "136,,121,142,139,138,134,135,129,127,119,141,120,,,147,157,168,158,181", "154,174,164,163,189,192,179,162,161,156,182,190,191,166,155,169,173", "175,167,160,,,,176,183,178,177,170,180,165,153,172,171,184,185,186,187", "188,152,159,150,151,148,149,112,114,,,113,,,,,,,,,143,144,140,122,123", "124,131,128,130,,,125,126,,,,,145,146,132,133,,,,,,,,,,,,137,136,,121", "142,139,138,134,135,129,127,119,141,120,438,442,147,,439,,,,,,,,,143", "144,140,122,123,124,131,128,130,,,125,126,,,,,145,146,132,133,,,,,,253", ",,,,,137,136,,121,142,139,138,134,135,129,127,119,141,120,451,442,147", ",452,,,,,,,,,143,144,140,122,123,124,131,128,130,,,125,126,,,,,145,146", "132,133,,,,,,,,,,,,137,136,,121,142,139,138,134,135,129,127,119,141", "120,451,442,147,,452,,,,,,,,,143,144,140,122,123,124,131,128,130,,,125", "126,,,,,145,146,132,133,,,,,,,,,,,,137,136,,121,142,139,138,134,135", "129,127,119,141,120,451,442,147,,452,,,,,,,,,143,144,140,122,123,124", "131,128,130,,,125,126,,,,,145,146,132,133,,,,,,,,,,,,137,136,,121,142", "139,138,134,135,129,127,119,141,120,451,442,147,,452,,,,,,,,,143,144", "140,122,123,124,131,128,130,,,125,126,,,,,145,146,132,133,,,,,,,,,,", ",137,136,,121,142,139,138,134,135,129,127,119,141,120,666,442,147,,667", ",,,,,,,,143,144,140,122,123,124,131,128,130,,,125,126,,,,,145,146,132", "133,,,,,,253,,,,,,137,136,,121,142,139,138,134,135,129,127,119,141,120", "668,448,147,,669,,,,,,,,,143,144,140,122,123,124,131,128,130,,,125,126", ",,,,145,146,132,133,,,,,,,,,,,,137,136,,121,142,139,138,134,135,129", "127,119,141,120,706,442,147,,707,,,,,,,,,143,144,140,122,123,124,131", "128,130,,,125,126,,,,,145,146,132,133,,,,,,253,,,,,,137,136,,121,142", "139,138,134,135,129,127,119,141,120,709,448,147,,710,,,,,,,,,143,144", "140,122,123,124,131,128,130,,,125,126,,,,,145,146,132,133,,,,,,,,,,", ",137,136,,121,142,139,138,134,135,129,127,119,141,120,451,442,147,,452", ",,,,,,,,143,144,140,122,123,124,131,128,130,,,125,126,,,,,145,146,132", "133,,,,,,,,,,,,137,136,,121,142,139,138,134,135,129,127,119,141,120", "666,442,147,,667,,,,,,,,,143,144,140,122,123,124,131,128,130,,,125,126", ",,,,145,146,132,133,,,,,,253,,,,,,137,136,,121,142,139,138,134,135,129", "127,119,141,120,668,448,147,,669,,,,,,,,,143,144,140,122,123,124,131", "128,130,,,125,126,,,,,145,146,132,133,,,,,,,,,,,,137,136,,121,142,139", "138,134,135,129,127,119,141,120,762,442,147,,763,,,,,,,,,143,144,140", "122,123,124,131,128,130,,,125,126,,,,,145,146,132,133,,,,,,253,,,,,", "137,136,,121,142,139,138,134,135,129,127,119,141,120,764,448,147,,765", ",,,,,,,,143,144,140,122,123,124,131,128,130,,,125,126,,,,,145,146,132", "133,,,,,,,,,,,,137,136,,121,142,139,138,134,135,129,127,119,141,120", "770,448,147,,768,,,,,,,,,143,144,140,122,123,124,131,128,130,,,125,126", ",,,,145,146,132,133,,,,,,,,,,,,137,136,,121,142,139,138,134,135,129", "127,119,141,120,451,442,147,,452,,,,,,,,,143,144,140,122,123,124,131", "128,130,,,125,126,,,,,145,146,132,133,,,,,,253,,,,,,137,136,,121,142", "139,138,134,135,129,127,119,141,120,770,448,147,,857,,,,,,,,,143,144", "140,122,123,124,131,128,130,,,125,126,,,,,145,146,132,133,,,,,,,,,,", ",137,136,,121,142,139,138,134,135,129,127,119,141,120,1020,442,147,", "1021,,,,,,,,,143,144,140,122,123,124,131,128,130,,,125,126,,,,,145,146", "132,133,,,,,,253,,,,,,137,136,,121,142,139,138,134,135,129,127,119,141", "120,1022,448,147,,1023,,,,,,,,,143,144,140,122,123,124,131,128,130,", ",125,126,,,,,145,146,132,133,,,,,,,,,,,,137,136,,121,142,139,138,134", "135,129,127,119,141,120,,,147"]; racc_action_table = arr = Opal.get('Array').$new(25645, nil); idx = 0; ($a = ($b = clist).$each, $a.$$p = (TMP_1 = function(str){var self = TMP_1.$$s || this, $c, $d, TMP_2; if (str == null) str = nil; return ($c = ($d = str.$split(",", -1)).$each, $c.$$p = (TMP_2 = function(i){var self = TMP_2.$$s || this, $e; if (i == null) i = nil; if ((($e = i['$empty?']()) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { } else { arr['$[]='](idx, i.$to_i()) }; return idx = $rb_plus(idx, 1);}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $c).call($d)}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); clist = ["0,0,0,0,0,359,24,325,0,0,56,294,360,0,1,0,0,0,0,0,0,0,366,210,369,6", "404,0,0,0,0,0,0,0,317,212,0,317,499,503,610,287,0,0,0,0,0,0,0,0,0,0", "0,762,0,0,0,871,0,0,9,0,0,290,763,701,511,627,627,378,24,499,503,210", "872,294,318,3,11,318,471,471,3,0,922,212,0,404,934,0,24,0,966,0,56,294", "969,0,72,511,1003,701,719,719,764,0,72,287,1020,325,0,0,0,0,0,0,359", "12,359,0,0,359,1021,360,366,360,369,0,360,290,0,18,18,18,471,18,0,0", "15,18,18,1033,610,287,18,765,18,18,18,18,18,18,18,287,627,762,719,21", "18,18,18,18,18,18,18,290,763,18,871,764,871,871,378,871,18,290,872,18", "18,18,18,18,18,18,467,18,18,18,1022,18,18,378,18,18,539,922,378,922", "35,934,922,934,37,966,934,966,764,969,966,969,765,1003,969,1003,18,42", "1003,18,18,1020,18,1020,18,1023,1020,382,522,78,18,600,601,706,382,1021", "467,1021,18,321,1021,512,321,18,18,18,18,18,18,765,775,775,18,18,1033", "707,1033,874,832,1033,18,79,539,18,19,19,19,1022,19,18,18,278,19,19", "512,98,278,19,709,19,19,19,19,19,19,19,710,522,522,522,651,19,19,19", "19,19,19,19,539,706,19,1022,1023,1022,522,638,1022,19,539,194,19,19", "19,19,19,19,19,211,19,19,19,707,19,19,832,19,19,475,600,601,600,601", "14,600,601,706,1023,775,1023,213,651,1023,775,709,709,706,395,19,16", "16,19,710,710,19,874,19,874,707,475,874,832,19,475,475,638,638,364,707", "364,19,832,666,14,638,19,19,19,19,19,19,709,214,14,19,19,667,383,816", "710,36,709,19,220,383,19,27,27,27,710,27,19,19,384,27,27,395,395,395", "27,384,27,27,27,27,27,27,27,725,373,252,725,666,27,27,27,27,27,27,27", "36,266,27,23,23,267,667,459,816,27,36,23,27,27,27,27,27,27,27,27,27", "27,27,397,27,27,270,27,27,459,459,459,459,459,459,459,459,459,459,459", "373,373,459,459,817,363,459,459,373,27,363,399,27,373,399,27,476,27", "280,27,459,27,459,27,459,459,459,459,459,459,459,27,459,373,38,38,27", "27,27,27,27,27,397,397,397,27,27,476,459,303,459,476,476,27,817,373", "27,373,27,575,385,282,27,27,28,28,28,385,28,575,399,399,28,28,982,959", "982,28,959,28,28,28,28,28,28,28,84,84,283,303,284,28,28,28,28,28,28", "28,111,303,28,575,575,111,111,672,289,28,299,299,28,28,28,28,28,28,28", "28,28,28,28,401,28,28,292,28,28,672,672,672,672,672,672,672,672,672", "672,672,575,293,672,672,386,298,672,672,884,28,406,386,28,313,313,28", "300,28,884,28,672,28,672,28,672,672,672,672,672,672,672,28,672,358,358", "304,28,28,28,28,28,28,401,401,401,28,28,387,672,438,884,884,388,28,387", "305,28,308,28,388,389,314,28,28,29,29,29,389,29,406,406,406,29,29,578", "578,316,29,319,29,29,29,29,29,29,29,320,884,322,438,330,29,29,29,29", "29,29,29,391,438,29,13,13,620,439,391,331,29,620,13,29,29,29,29,29,29", "29,29,29,29,29,332,29,29,333,29,29,773,335,494,650,592,773,592,592,592", "860,592,860,860,860,779,860,336,439,340,779,29,749,749,29,1006,1006", "29,439,29,13,29,13,29,494,29,354,357,494,494,494,494,365,29,650,368", "370,374,29,29,29,29,29,29,650,400,403,29,29,43,43,422,428,430,433,29", "436,43,29,437,29,445,456,477,29,29,31,31,31,31,31,592,478,479,31,31", "860,480,505,31,508,31,31,31,31,31,31,31,5,5,5,5,5,31,31,31,31,31,31", "31,509,513,31,527,43,528,43,531,31,31,533,31,31,31,31,31,31,31,31,540", "31,31,31,544,31,31,553,31,31,554,350,555,350,350,350,581,350,581,581", "581,581,581,793,793,556,569,793,793,793,31,581,585,31,495,587,31,591", "31,910,31,910,910,910,31,910,596,209,209,350,602,603,31,642,581,209", "350,31,31,31,31,31,31,581,581,495,31,31,648,495,495,495,495,654,31,659", "662,31,32,32,32,670,32,31,31,671,32,32,687,693,695,32,703,32,32,32,32", "32,32,32,581,705,209,708,209,32,32,32,32,32,32,32,711,712,32,288,288", "713,714,717,718,32,720,288,32,32,32,32,32,32,32,723,32,32,32,727,32", "32,728,57,732,57,57,57,57,57,733,306,306,279,279,279,279,279,57,306", "589,735,589,589,589,32,589,738,32,739,741,32,745,32,288,32,288,747,751", "757,759,57,57,700,700,700,700,700,57,57,57,57,32,32,32,32,32,32,589", "761,766,32,32,770,771,589,306,782,306,32,783,785,32,33,33,33,786,33", "32,32,787,33,33,789,792,798,33,57,33,33,33,33,33,33,33,819,820,821,822", "823,33,33,33,33,33,33,33,825,826,33,367,367,827,831,836,839,33,840,367", "33,33,33,33,33,33,33,857,33,33,33,862,33,33,863,326,866,326,326,326", "326,326,876,879,880,376,376,881,901,902,326,912,746,376,746,746,746", "33,746,925,33,926,927,33,928,33,367,929,367,931,936,937,945,326,947", "326,949,950,951,952,326,326,326,326,33,33,33,33,33,33,746,954,968,33", "33,977,984,746,33,999,376,33,376,1004,33,39,39,39,1005,39,33,33,1010", "39,39,1012,1013,1014,39,326,39,39,39,39,39,39,39,1015,1016,1019,1034", ",39,39,39,39,39,39,39,,,39,584,584,,,,,39,,584,39,39,39,39,39,39,39", ",39,39,39,,39,39,,39,39,,748,,748,748,748,847,748,847,847,847,847,847", "998,,998,998,998,,998,39,847,,39,,,39,,39,584,,584,,,39,,,612,612,748", ",,39,,847,612,,39,39,39,39,39,39,847,847,,39,39,,,,,,,39,,,39,40,40", "40,,40,39,39,,40,40,,,,40,,40,40,40,40,40,40,40,847,,612,,612,40,40", "40,40,40,40,40,,,40,734,734,,,,,40,,734,40,40,40,40,40,40,40,,40,40", "40,,40,40,,40,40,,861,,861,861,861,849,861,849,849,849,849,849,,,,,", ",,40,849,,40,,,40,,40,734,,734,,,40,,,873,873,861,,,40,,849,873,,40", "40,40,40,40,40,849,849,,40,40,,,,,,,40,,,40,41,41,41,,41,40,40,,41,41", ",,,41,,41,41,41,41,41,41,41,849,,873,,873,41,41,41,41,41,41,41,,,41", "967,967,,,,,41,,967,41,41,41,41,41,41,41,,41,41,41,,41,41,,41,41,,483", ",,,,854,,854,854,854,854,854,,,,,,483,483,41,854,,41,,,41,,41,967,,967", "483,,41,,483,483,483,483,,,41,,854,,,41,41,41,41,41,41,854,854,,41,41", ",,,,,,41,,,41,53,53,53,,53,41,41,,53,53,,,,53,,53,53,53,53,53,53,53", "854,,,,,53,53,53,53,53,53,53,,,53,,930,,930,930,930,53,930,,53,53,53", "53,53,53,53,,53,53,53,,53,53,,53,53,485,932,,932,932,932,891,932,891", "891,891,891,891,930,,,,485,485,,53,891,,53,,,53,,53,,,485,,485,53,485", "485,485,485,932,,485,53,485,891,,,53,53,53,53,53,53,891,891,,53,53,", ",,,,,53,,,53,54,54,54,,54,53,53,,54,54,,,,54,,54,54,54,54,54,54,54,891", ",,,,54,54,54,54,54,54,54,,,54,,,,,,,54,,,54,54,54,54,54,54,54,54,54", "54,54,,54,54,,54,54,674,674,674,674,674,674,674,674,674,674,674,768", "768,674,674,,,674,674,768,54,,,54,768,,54,,54,,54,674,,674,54,674,674", "674,674,674,674,674,54,674,,,,54,54,54,54,54,54,,,,54,54,,674,674,,", ",54,,768,54,768,54,,,,54,54,55,55,55,,55,,,,55,55,,,,55,,55,55,55,55", "55,55,55,,,,,,55,55,55,55,55,55,55,,,55,,,,,,,55,,,55,55,55,55,55,55", "55,55,55,55,55,,55,55,,55,55,20,20,20,20,20,20,20,20,20,20,20,,,20,20", ",,20,20,,55,,,55,,,55,,55,,,20,,20,55,20,20,20,20,20,20,20,55,20,,,", "55,55,55,55,55,55,,,,55,55,,20,,,,,55,,,55,,55,,,,55,55,58,58,58,,58", ",,,58,58,,,,58,,58,58,58,58,58,58,58,,,,,,58,58,58,58,58,58,58,,,58", ",976,,976,976,976,58,976,,58,58,58,58,58,58,58,,58,58,58,,58,58,,58", "58,486,,,,,,972,,972,972,972,972,972,976,,,,486,486,,58,972,,58,,,58", ",58,,,486,,486,58,486,486,486,486,,,486,58,486,972,,,58,58,58,58,58", "58,972,972,,58,58,,,,,,,58,,,58,59,59,59,,59,58,58,,59,59,,,,59,,59", "59,59,59,59,59,59,972,,,,,59,59,59,59,59,59,59,,,59,,,,,,,59,,,59,59", "59,59,59,59,59,,59,59,59,,59,59,,59,59,487,,,,,,989,,989,989,989,989", "989,,,,,487,487,,59,989,,59,,,59,,59,,,487,,487,59,487,487,487,487,", ",487,59,487,989,,,59,59,59,59,59,59,989,989,,59,59,,,,,,,59,,,59,62", "62,62,,62,59,59,,62,62,,,,62,,62,62,62,62,62,62,62,989,,,,,62,62,62", "62,62,62,62,,,62,,,,,,,62,,,62,62,62,62,62,62,62,,62,62,62,,62,62,,62", "62,488,,,,,,991,,991,991,991,991,991,,,,,488,488,,62,991,,62,,,62,,62", ",,488,,488,62,488,488,488,488,,,488,62,488,991,,,62,62,62,62,62,62,991", "991,,62,62,62,,,,,62,62,,,62,63,63,63,,63,62,62,,63,63,,,,63,,63,63", "63,63,63,63,63,991,,,,,63,63,63,63,63,63,63,,,63,,,,,,,63,,,63,63,63", "63,63,63,63,,63,63,63,,63,63,,571,,571,571,571,571,571,,,,,,,,,571,", ",,,,,63,,,63,,,63,,63,,63,,,,,,571,,,,,,,571,571,571,571,63,63,63,63", "63,63,,,,63,63,,,,,,,63,,,63,64,64,64,,64,63,63,,64,64,,,,64,571,64", "64,64,64,64,64,64,,,,,,64,64,64,64,64,64,64,,,64,,,,,,,64,,,64,64,64", "64,64,64,64,,64,64,64,481,64,64,,579,,579,579,579,579,579,,,,,,,481", "481,579,,,,64,,,64,,,64,,481,64,481,64,481,481,481,481,,,,579,,,,,,", "579,579,579,579,64,64,64,64,64,64,,,,64,64,,,,,,,64,,,64,85,85,85,,85", "64,64,,85,85,,,,85,579,85,85,85,85,85,85,85,,85,,,,85,85,85,85,85,85", "85,,,85,,,,,,,85,,,85,85,85,85,85,85,85,85,85,85,85,,85,85,,85,85,264", "264,264,264,264,264,264,264,264,264,264,,,264,264,,,264,264,,85,,,85", "85,,85,,85,,85,264,85,264,85,264,264,264,264,264,264,264,85,264,85,", ",85,85,85,85,85,85,,,,85,85,,264,,,,,85,,,85,,85,,,,85,85,88,88,88,", "88,,,,88,88,,,,88,,88,88,88,88,88,88,88,,88,,,,88,88,88,88,88,88,88", ",,88,,,,,,,88,,,88,88,88,88,88,88,88,88,88,88,88,,88,88,,88,88,435,435", "435,435,435,435,435,435,435,435,435,,,435,435,,,435,435,,88,,,88,88", ",88,,88,,88,435,88,435,88,435,435,435,435,435,435,435,88,435,88,,,88", "88,88,88,88,88,,,,88,88,,435,,,,,88,,,88,,88,,,,88,88,100,100,100,100", "100,,,,100,100,,,,100,,100,100,100,100,100,100,100,,,,,,100,100,100", "100,100,100,100,,,100,,,,,,100,100,100,100,100,100,100,100,100,100,100", ",100,100,100,,100,100,,100,100,482,,,,,,993,,993,993,993,993,993,,,", ",482,482,,100,993,,100,,,100,,100,,100,482,,482,100,482,482,482,482", ",,,100,,993,,,100,100,100,100,100,100,993,993,,100,100,,,,,,100,100", ",,100,104,104,104,,104,100,100,,104,104,,,,104,,104,104,104,104,104", "104,104,993,,,,,104,104,104,104,104,104,104,,,104,,,,,,,104,,,104,104", "104,104,104,104,104,,104,104,104,,104,104,,104,104,,,,,,,1027,,1027", "1027,1027,1027,1027,,,,,,,,104,1027,,104,,,104,,104,,,,,,104,,,,,,,", "104,,1027,,,104,104,104,104,104,104,1027,1027,,104,104,,,,,,,104,,,104", "105,105,105,,105,104,104,,105,105,,,,105,,105,105,105,105,105,105,105", "1027,,,,,105,105,105,105,105,105,105,,,105,,,,,,,105,,,105,105,105,105", "105,105,105,,105,105,105,,105,105,,105,105,454,454,454,454,454,454,454", "454,454,454,454,,,454,454,,,454,454,,105,,,105,,,105,,105,,,454,,454", "105,454,454,454,454,454,454,454,105,454,,,,105,105,105,105,105,105,", ",,105,105,,454,,,,,105,,,105,106,106,106,,106,105,105,,106,106,,,,106", ",106,106,106,106,106,106,106,,,,,,106,106,106,106,106,106,106,,,106", ",,,,,,106,,,106,106,106,106,106,106,106,,106,106,106,,106,106,,106,106", "551,551,551,551,551,551,551,551,551,551,551,,,551,551,,,551,551,,106", ",,106,,,106,,106,,,551,,551,106,551,551,551,551,551,551,551,106,551", ",,,106,106,106,106,106,106,,,,106,106,,551,,,,,106,,,106,107,107,107", ",107,106,106,,107,107,,,,107,,107,107,107,107,107,107,107,,,,,,107,107", "107,107,107,107,107,,,107,,,,,,,107,,,107,107,107,107,107,107,107,,107", "107,107,,107,107,,107,107,716,716,716,716,716,716,716,716,716,716,716", ",,716,716,,,716,716,,107,,,107,,,107,,107,,,716,,716,107,716,716,716", "716,716,716,716,107,716,,,,107,107,107,107,107,107,,,,107,107,,716,", ",,,107,,,107,108,108,108,108,108,107,107,,108,108,,,,108,,108,108,108", "108,108,108,108,,,,,,108,108,108,108,108,108,108,,,108,,,,,,108,108", ",108,108,108,108,108,108,108,108,,108,108,108,,108,108,,108,108,803", "803,803,803,803,803,803,803,803,803,803,,,803,803,,,803,803,,108,,,108", ",,108,,108,,108,803,,803,108,803,803,803,803,803,803,803,108,803,,,", "108,108,108,108,108,108,,,,108,108,,803,,,,,108,,,108,109,109,109,109", "109,108,108,,109,109,,,,109,,109,109,109,109,109,109,109,,,,,,109,109", "109,109,109,109,109,,,109,,,,,,109,109,109,109,109,109,109,109,109,109", "109,,109,109,109,,109,109,,109,109,805,805,805,805,805,805,805,805,805", "805,805,,,805,805,,,805,805,,109,,,109,,,109,,109,,109,805,,805,109", "805,805,805,805,805,805,805,109,805,,,,109,109,109,109,109,109,,,,109", "109,,805,,,,,109,,,109,196,196,196,196,196,109,109,,196,196,,,,196,", "196,196,196,196,196,196,196,,,,,,196,196,196,196,196,196,196,,,196,", ",,,,196,196,,196,196,196,196,196,196,196,196,,196,196,196,,196,196,", "196,196,808,808,808,808,808,808,808,808,808,808,808,,,808,808,,,808", "808,,196,,,196,,,196,,196,,196,808,,808,196,808,808,808,808,808,808", "808,196,808,,,,196,196,196,196,196,196,,,,196,196,,808,,,,,196,,,196", "197,197,197,,197,196,196,,197,197,,,,197,,197,197,197,197,197,197,197", ",,,,,197,197,197,197,197,197,197,,,197,,,,,,,197,,,197,197,197,197,197", "197,197,,197,197,197,,197,197,,197,197,810,810,810,810,810,810,810,810", "810,810,810,,,810,810,,,810,810,,197,,,197,,,197,,197,,197,810,,810", "197,810,810,810,810,810,810,810,197,810,,,,197,197,197,197,197,197,", ",,197,197,,810,,,,,197,,,197,198,198,198,,198,197,197,,198,198,,,,198", ",198,198,198,198,198,198,198,,,,,,198,198,198,198,198,198,198,,,198", ",,,,,,198,,,198,198,198,198,198,198,198,,198,198,198,,198,198,,198,198", "812,812,812,812,812,812,812,812,812,812,812,,,812,812,,,812,812,,198", ",,198,,,198,,198,,,812,,812,198,812,812,812,812,812,812,812,198,812", ",,,198,198,198,198,198,198,,,,198,198,,812,,,,,198,,,198,199,199,199", ",199,198,198,,199,199,,,,199,,199,199,199,199,199,199,199,,,,,,199,199", "199,199,199,199,199,,,199,,,,,,,199,,,199,199,199,199,199,199,199,199", "199,199,199,,199,199,,199,199,904,904,904,904,904,904,904,904,904,904", "904,,,904,904,,,904,904,,199,,,199,,,199,,199,,199,904,,904,199,904", "904,904,904,904,904,904,199,904,,,,199,199,199,199,199,199,,,,199,199", ",904,,,,,199,,,199,,199,,,,199,199,200,200,200,,200,,,,200,200,,,,200", ",200,200,200,200,200,200,200,,,,,,200,200,200,200,200,200,200,,,200", ",,,,,,200,,,200,200,200,200,200,200,200,200,200,200,200,,200,200,,200", "200,906,906,906,906,906,906,906,906,906,906,906,,,906,906,,,906,906", ",200,,,200,,,200,,200,,200,906,,906,200,906,906,906,906,906,906,906", "200,906,,,,200,200,200,200,200,200,,,,200,200,,906,,,,,200,,,200,,200", ",,,200,200,204,204,204,,204,,,,204,204,,,,204,,204,204,204,204,204,204", "204,,,,,,204,204,204,204,204,204,204,,,204,,,,,,,204,,,204,204,204,204", "204,204,204,,204,204,204,,204,204,,204,204,958,958,958,958,958,958,958", "958,958,958,958,,,958,958,,,958,958,,204,,,204,,,204,,204,,,958,,958", "204,958,958,958,958,958,958,958,204,958,,,,204,204,204,204,204,204,", ",,204,204,,958,,,,,204,,,204,205,205,205,,205,204,204,,205,205,,,,205", ",205,205,205,205,205,205,205,,,,,,205,205,205,205,205,205,205,,,205", ",,,,,,205,,,205,205,205,205,205,205,205,,205,205,205,,205,205,,205,205", "473,473,473,473,473,473,473,473,473,473,473,,,473,473,,,473,473,,205", ",,205,,,205,,205,,205,473,,473,205,473,473,473,473,473,473,473,205,473", ",,,205,205,205,205,205,205,,,,205,205,,,,,,,205,,,205,206,206,206,,206", "205,205,,206,206,,,,206,,206,206,206,206,206,206,206,,,,,,206,206,206", "206,206,206,206,,,206,,,,,,,206,,,206,206,206,206,206,206,206,,206,206", "206,,206,206,,206,206,474,474,474,474,474,474,474,474,474,474,474,,", "474,474,,,474,474,,206,,,206,,,206,,206,,,474,,474,206,474,474,474,474", "474,474,474,206,474,,,,206,206,206,206,206,206,,,,206,206,,,,,,,206", ",,206,207,207,207,,207,206,206,,207,207,,,,207,,207,207,207,207,207", "207,207,,,,,,207,207,207,207,207,207,207,,,207,,,,,,,207,,,207,207,207", "207,207,207,207,,207,207,207,,207,207,,207,207,484,484,484,484,484,484", "484,,,484,484,,,,,,,484,484,,207,,,207,,,207,,207,,,484,,484,207,484", "484,484,484,484,484,484,207,484,,,,207,207,207,207,207,207,,,,207,207", ",,,,,,207,,,207,215,215,215,215,215,207,207,,215,215,,,,215,,215,215", "215,215,215,215,215,,,,,,215,215,215,215,215,215,215,,,215,,,,,,215", "215,,215,215,215,215,215,215,215,215,,215,215,215,,215,215,,215,215", "489,489,489,489,489,489,489,,,489,489,,,,,,,489,489,,215,,,215,,,215", ",215,,215,489,,489,215,489,489,489,489,489,489,489,215,489,,,,215,215", "215,215,215,215,,,,215,215,,,,,,,215,,,215,216,216,216,,216,215,215", ",216,216,,,,216,,216,216,216,216,216,216,216,,,,,,216,216,216,216,216", "216,216,,,216,,,,,,,216,,,216,216,216,216,216,216,216,,216,216,216,", "216,216,,216,216,490,490,490,490,490,490,490,,,490,490,,,,,,,490,490", ",216,,,216,,216,216,,216,,,490,,490,216,490,490,490,490,490,490,490", "216,490,,,,216,216,216,216,216,216,,,,216,216,,,,,,,216,,,216,219,219", "219,,219,216,216,,219,219,,,,219,,219,219,219,219,219,219,219,,,,,,219", "219,219,219,219,219,219,,,219,,,,,,,219,,,219,219,219,219,219,219,219", ",219,219,219,,219,219,,219,219,491,491,491,491,491,491,491,,,491,491", ",,,,,,491,491,,219,,,219,,,219,,219,,,491,,491,219,491,491,491,491,491", "491,491,219,491,,,,219,219,219,219,219,219,,,,219,219,,,,,,,219,,,219", "221,221,221,,221,219,219,,221,221,,,,221,,221,221,221,221,221,221,221", ",,,,,221,221,221,221,221,221,221,,,221,,,,,,,221,,,221,221,221,221,221", "221,221,,221,221,221,,221,221,,221,221,492,492,492,492,492,492,492,", ",492,492,,,,,,,492,492,,221,,,221,,,221,,221,,,492,,492,221,492,492", "492,492,492,492,492,221,492,,,,221,221,221,221,221,221,,,,221,221,,", ",,,,221,,,221,222,222,222,,222,221,221,,222,222,,,,222,,222,222,222", "222,222,222,222,,,,,,222,222,222,222,222,222,222,,,222,,,,,,,222,,,222", "222,222,222,222,222,222,,222,222,222,,222,222,,222,222,493,493,493,493", "493,493,493,,,493,493,,,,,,,493,493,,222,,,222,,,222,,222,,,493,,493", "222,493,493,493,493,493,493,493,222,493,,,,222,222,222,222,222,222,", ",,222,222,,,,,,,222,,,222,223,223,223,,223,222,222,,223,223,,,,223,", "223,223,223,223,223,223,223,,,,,,223,223,223,223,223,223,223,,,223,", ",,,,,223,,,223,223,223,223,223,223,223,,223,223,223,,223,223,,223,223", "496,496,496,496,496,496,496,,,496,496,,,,,,,496,496,,223,,,223,,,223", ",223,,,496,,496,223,496,496,496,496,496,496,496,223,496,,,,223,223,223", "223,223,223,,,,223,223,,,,,,,223,,,223,224,224,224,,224,223,223,,224", "224,,,,224,,224,224,224,224,224,224,224,,,,,,224,224,224,224,224,224", "224,,,224,,,,,,,224,,,224,224,224,224,224,224,224,,224,224,224,,224", "224,,224,224,497,497,497,497,497,497,497,497,,497,497,,,,,,,497,497", ",224,,,224,,,224,,224,,,497,,497,224,497,497,497,497,497,497,497,224", "497,,,,224,224,224,224,224,224,,,,224,224,,,,,,,224,,,224,225,225,225", ",225,224,224,,225,225,,,,225,,225,225,225,225,225,225,225,,,,,,225,225", "225,225,225,225,225,,,225,,,,,,,225,,,225,225,225,225,225,225,225,,225", "225,225,,225,225,,225,225,,,,,,,,,,,,,,,,,,,,,225,,,225,,,225,,225,", ",,,,225,,,,,,,,225,,,,,225,225,225,225,225,225,,,,225,225,,,,,,,225", ",,225,226,226,226,,226,225,225,,226,226,,,,226,,226,226,226,226,226", "226,226,,,,,,226,226,226,226,226,226,226,,,226,,,,,,,226,,,226,226,226", "226,226,226,226,,226,226,226,,226,226,,226,226,,,,,,,,,,,,,,,,,,,,,226", ",,226,,,226,,226,,,,,,226,,,,,,,,226,,,,,226,226,226,226,226,226,,,", "226,226,,,,,,,226,,,226,227,227,227,,227,226,226,,227,227,,,,227,,227", "227,227,227,227,227,227,,,,,,227,227,227,227,227,227,227,,,227,,,,,", ",227,,,227,227,227,227,227,227,227,,227,227,227,,227,227,,227,227,,", ",,,,,,,,,,,,,,,,,,227,,,227,,,227,,227,,,,,,227,,,,,,,,227,,,,,227,227", "227,227,227,227,,,,227,227,,,,,,,227,,,227,228,228,228,,228,227,227", ",228,228,,,,228,,228,228,228,228,228,228,228,,,,,,228,228,228,228,228", "228,228,,,228,,,,,,,228,,,228,228,228,228,228,228,228,,228,228,228,", "228,228,,228,228,,,,,,,,,,,,,,,,,,,,,228,,,228,,,228,,228,,,,,,228,", ",,,,,,228,,,,,228,228,228,228,228,228,,,,228,228,,,,,,,228,,,228,229", "229,229,,229,228,228,,229,229,,,,229,,229,229,229,229,229,229,229,,", ",,,229,229,229,229,229,229,229,,,229,,,,,,,229,,,229,229,229,229,229", "229,229,,229,229,229,,229,229,,229,229,,,,,,,,,,,,,,,,,,,,,229,,,229", ",,229,,229,,,,,,229,,,,,,,,229,,,,,229,229,229,229,229,229,,,,229,229", ",,,,,,229,,,229,230,230,230,,230,229,229,,230,230,,,,230,,230,230,230", "230,230,230,230,,,,,,230,230,230,230,230,230,230,,,230,,,,,,,230,,,230", "230,230,230,230,230,230,,230,230,230,,230,230,,230,230,,,,,,,,,,,,,", ",,,,,,,230,,,230,,,230,,230,,,,,,230,,,,,,,,230,,,,,230,230,230,230", "230,230,,,,230,230,,,,,,,230,,,230,231,231,231,,231,230,230,,231,231", ",,,231,,231,231,231,231,231,231,231,,,,,,231,231,231,231,231,231,231", ",,231,,,,,,,231,,,231,231,231,231,231,231,231,,231,231,231,,231,231", ",231,231,,,,,,,,,,,,,,,,,,,,,231,,,231,,,231,,231,,,,,,231,,,,,,,,231", ",,,,231,231,231,231,231,231,,,,231,231,,,,,,,231,,,231,232,232,232,", "232,231,231,,232,232,,,,232,,232,232,232,232,232,232,232,,,,,,232,232", "232,232,232,232,232,,,232,,,,,,,232,,,232,232,232,232,232,232,232,,232", "232,232,,232,232,,232,232,,,,,,,,,,,,,,,,,,,,,232,,,232,,,232,,232,", ",,,,232,,,,,,,,232,,,,,232,232,232,232,232,232,,,,232,232,,,,,,,232", ",,232,233,233,233,,233,232,232,,233,233,,,,233,,233,233,233,233,233", "233,233,,,,,,233,233,233,233,233,233,233,,,233,,,,,,,233,,,233,233,233", "233,233,233,233,,233,233,233,,233,233,,233,233,,,,,,,,,,,,,,,,,,,,,233", ",,233,,,233,,233,,,,,,233,,,,,,,,233,,,,,233,233,233,233,233,233,,,", "233,233,,,,,,,233,,,233,234,234,234,,234,233,233,,234,234,,,,234,,234", "234,234,234,234,234,234,,,,,,234,234,234,234,234,234,234,,,234,,,,,", ",234,,,234,234,234,234,234,234,234,,234,234,234,,234,234,,234,234,,", ",,,,,,,,,,,,,,,,,,234,,,234,,,234,,234,,,,,,234,,,,,,,,234,,,,,234,234", "234,234,234,234,,,,234,234,,,,,,,234,,,234,235,235,235,,235,234,234", ",235,235,,,,235,,235,235,235,235,235,235,235,,,,,,235,235,235,235,235", "235,235,,,235,,,,,,,235,,,235,235,235,235,235,235,235,,235,235,235,", "235,235,,235,235,,,,,,,,,,,,,,,,,,,,,235,,,235,,,235,,235,,,,,,235,", ",,,,,,235,,,,,235,235,235,235,235,235,,,,235,235,,,,,,,235,,,235,236", "236,236,,236,235,235,,236,236,,,,236,,236,236,236,236,236,236,236,,", ",,,236,236,236,236,236,236,236,,,236,,,,,,,236,,,236,236,236,236,236", "236,236,,236,236,236,,236,236,,236,236,,,,,,,,,,,,,,,,,,,,,236,,,236", ",,236,,236,,,,,,236,,,,,,,,236,,,,,236,236,236,236,236,236,,,,236,236", ",,,,,,236,,,236,237,237,237,,237,236,236,,237,237,,,,237,,237,237,237", "237,237,237,237,,,,,,237,237,237,237,237,237,237,,,237,,,,,,,237,,,237", "237,237,237,237,237,237,,237,237,237,,237,237,,237,237,,,,,,,,,,,,,", ",,,,,,,237,,,237,,,237,,237,,,,,,237,,,,,,,,237,,,,,237,237,237,237", "237,237,,,,237,237,,,,,,,237,,,237,238,238,238,,238,237,237,,238,238", ",,,238,,238,238,238,238,238,238,238,,,,,,238,238,238,238,238,238,238", ",,238,,,,,,,238,,,238,238,238,238,238,238,238,,238,238,238,,238,238", ",238,238,,,,,,,,,,,,,,,,,,,,,238,,,238,,,238,,238,,,,,,238,,,,,,,,238", ",,,,238,238,238,238,238,238,,,,238,238,,,,,,,238,,,238,239,239,239,", "239,238,238,,239,239,,,,239,,239,239,239,239,239,239,239,,,,,,239,239", "239,239,239,239,239,,,239,,,,,,,239,,,239,239,239,239,239,239,239,,239", "239,239,,239,239,,239,239,,,,,,,,,,,,,,,,,,,,,239,,,239,,,239,,239,", ",,,,239,,,,,,,,239,,,,,239,239,239,239,239,239,,,,239,239,,,,,,,239", ",,239,240,240,240,,240,239,239,,240,240,,,,240,,240,240,240,240,240", "240,240,,,,,,240,240,240,240,240,240,240,,,240,,,,,,,240,,,240,240,240", "240,240,240,240,,240,240,240,,240,240,,240,240,,,,,,,,,,,,,,,,,,,,,240", ",,240,,,240,,240,,,,,,240,,,,,,,,240,,,,,240,240,240,240,240,240,,,", "240,240,,,,,,,240,,,240,241,241,241,,241,240,240,,241,241,,,,241,,241", "241,241,241,241,241,241,,,,,,241,241,241,241,241,241,241,,,241,,,,,", ",241,,,241,241,241,241,241,241,241,,241,241,241,,241,241,,241,241,,", ",,,,,,,,,,,,,,,,,,241,,,241,,,241,,241,,,,,,241,,,,,,,,241,,,,,241,241", "241,241,241,241,,,,241,241,,,,,,,241,,,241,242,242,242,,242,241,241", ",242,242,,,,242,,242,242,242,242,242,242,242,,,,,,242,242,242,242,242", "242,242,,,242,,,,,,,242,,,242,242,242,242,242,242,242,,242,242,242,", "242,242,,242,242,,,,,,,,,,,,,,,,,,,,,242,,,242,,,242,,242,,,,,,242,", ",,,,,,242,,,,,242,242,242,242,242,242,,,,242,242,,,,,,,242,,,242,243", "243,243,,243,242,242,,243,243,,,,243,,243,243,243,243,243,243,243,,", ",,,243,243,243,243,243,243,243,,,243,,,,,,,243,,,243,243,243,243,243", "243,243,,243,243,243,,243,243,,243,243,,,,,,,,,,,,,,,,,,,,,243,,,243", ",,243,,243,,,,,,243,,,,,,,,243,,,,,243,243,243,243,243,243,,,,243,243", ",,,,,,243,,,243,244,244,244,,244,243,243,,244,244,,,,244,,244,244,244", "244,244,244,244,,,,,,244,244,244,244,244,244,244,,,244,,,,,,,244,,,244", "244,244,244,244,244,244,,244,244,244,,244,244,,244,244,,,,,,,,,,,,,", ",,,,,,,244,,,244,,,244,,244,,,,,,244,,,,,,,,244,,,,,244,244,244,244", "244,244,,,,244,244,,,,,,,244,,,244,245,245,245,,245,244,244,,245,245", ",,,245,,245,245,245,245,245,245,245,,,,,,245,245,245,245,245,245,245", ",,245,,,,,,,245,,,245,245,245,245,245,245,245,,245,245,245,,245,245", ",245,245,,,,,,,,,,,,,,,,,,,,,245,,,245,,,245,,245,,,,,,245,,,,,,,,245", ",,,,245,245,245,245,245,245,,,,245,245,,,,,,,245,,,245,253,253,253,", "253,245,245,,253,253,,,,253,,253,253,253,253,253,253,253,,,,,,253,253", "253,253,253,253,253,,,253,,,,,,,253,,,253,253,253,253,253,253,253,253", "253,253,253,,253,253,,253,253,,,,,,,,,,,,,,,,,,,,,253,,,253,,,253,,253", ",253,,253,,253,,,,,,,,253,,,,,253,253,253,253,253,253,,,,253,253,,,", ",,,253,,,253,,253,,,,253,253,254,254,254,,254,,,,254,254,,,,254,,254", "254,254,254,254,254,254,,,,,,254,254,254,254,254,254,254,,,254,,,,,", ",254,,,254,254,254,254,254,254,254,254,254,254,254,,254,254,,254,254", ",,,,,,,,,,,,,,,,,,,,254,,,254,,,254,,254,,254,,254,,254,,,,,,,,254,", ",,,254,254,254,254,254,254,,,,254,254,,,,,,,254,,,254,,254,,,,254,254", "262,262,262,,262,,,,262,262,,,,262,,262,262,262,262,262,262,262,,,,", ",262,262,262,262,262,262,262,,,262,,,,,,,262,,,262,262,262,262,262,262", "262,262,262,262,262,,262,262,,262,262,,,,,,,,,,,,,,,,,,,,,262,,,262", ",262,262,,262,,262,,262,,262,,,,,,,,262,,,,,262,262,262,262,262,262", ",,,262,262,,,,,,,262,,,262,,262,,,,262,262,269,269,269,,269,,,,269,269", ",,,269,,269,269,269,269,269,269,269,,,,,,269,269,269,269,269,269,269", ",,269,,,,,,,269,,,269,269,269,269,269,269,269,,269,269,269,,269,269", ",269,269,,,,,,,,,,,,,,,,,,,,,269,,,269,,,269,,269,,,,,,269,,,,,,,,269", ",,,,269,269,269,269,269,269,,,,269,269,,,,,,,269,,,269,271,271,271,", "271,269,269,,271,271,,,,271,,271,271,271,271,271,271,271,,,,,,271,271", "271,271,271,271,271,,,271,,,,,,,271,,,271,271,271,271,271,271,271,,271", "271,271,,271,271,,271,271,,,,,,,,,,,,,,,,,,,,,271,,,271,,,271,,271,", ",,,,271,,,,,,,,271,,,,,271,271,271,271,271,271,,,,271,271,,,,,,,271", ",,271,274,274,274,,274,271,271,,274,274,,,,274,,274,274,274,274,274", "274,274,,,,,,274,274,274,274,274,274,274,,,274,,,,,,,274,,,274,274,274", "274,274,274,274,,274,274,274,,274,274,,274,274,,,,,,,,,,,,,,,,,,,,,274", ",,274,,,274,,274,,,,,,274,,,,,,,,274,,,,,274,274,274,274,274,274,,,", "274,274,,,,,,,274,,,274,275,275,275,,275,274,274,,275,275,,,,275,,275", "275,275,275,275,275,275,,,,,,275,275,275,275,275,275,275,,,275,,,,,", ",275,,,275,275,275,275,275,275,275,,275,275,275,,275,275,,275,275,,", ",,,,,,,,,,,,,,,,,,275,,,275,,,275,,275,,,,,,275,,,,,,,,275,,,,,275,275", "275,275,275,275,,,,275,275,,,,,,,275,,,275,281,281,281,281,281,275,275", ",281,281,,,,281,,281,281,281,281,281,281,281,,,,,,281,281,281,281,281", "281,281,,,281,,,,,,281,281,,281,281,281,281,281,281,281,281,,281,281", "281,,281,281,,281,281,,,,,,,,,,,,,,,,,,,,,281,,,281,,,281,,281,,281", ",,,281,,,,,,,,281,,,,,281,281,281,281,281,281,,,,281,281,,,,,,,281,", ",281,285,285,285,,285,281,281,,285,285,,,,285,,285,285,285,285,285,285", "285,,,,,,285,285,285,285,285,285,285,,,285,,,,,,,285,,,285,285,285,285", "285,285,285,,285,285,285,,285,285,,623,,623,623,623,623,623,,,,,,,,", "623,,,,,,,285,,,285,,,285,,285,,,,,,,,623,623,,,,,,623,623,623,623,285", "285,285,285,285,285,,,,285,285,,,,285,,,285,,,285,286,286,286,286,286", "285,285,,286,286,,,,286,623,286,286,286,286,286,286,286,,,,,,286,286", "286,286,286,286,286,,,286,,,,,,286,286,,286,286,286,286,286,286,286", "286,,286,286,286,,286,286,,286,286,,,,,,,,,,,,,,,,,,,,,286,,,286,,,286", ",286,,286,,,,286,,,,,,,,286,,,,,286,286,286,286,286,286,,,,286,286,", ",,,,,286,,,286,301,301,301,,301,286,286,,301,301,,,,301,,301,301,301", "301,301,301,301,,,,,,301,301,301,301,301,301,301,,,301,,,,,,,301,,,301", "301,301,301,301,301,301,,301,301,301,,301,301,,676,,676,676,676,676", "676,,,,,,,,,676,,,,,,,301,,,301,,,301,,301,,,,,,,,676,,,,,,,676,676", "676,676,301,301,301,301,301,301,,,,301,301,,,,,,,301,,,301,310,310,310", "676,310,301,301,,310,310,,,,310,676,310,310,310,310,310,310,310,,,,", ",310,310,310,310,310,310,310,,,310,,,,,,,310,,,310,310,310,310,310,310", "310,,310,310,310,,310,310,,310,310,,,,,,,,,,,,,,,,,,,,,310,,,310,310", ",310,,310,,,,,,310,,,,,,,,310,,,,,310,310,310,310,310,310,,,,310,310", ",,,,,,310,,,310,312,312,312,312,312,310,310,,312,312,,,,312,,312,312", "312,312,312,312,312,,,,,,312,312,312,312,312,312,312,,,312,,,,,,312", "312,,312,312,312,312,312,312,312,312,,312,312,312,,312,312,,312,312", ",,,,,,,,,,,,,,,,,,,,312,,,312,,,312,,312,,312,,,,312,,,,,,,,312,,,,", "312,312,312,312,312,312,,,,312,312,,,,,,,312,,,312,342,342,342,,342", "312,312,,342,342,,,,342,,342,342,342,342,342,342,342,,,,,,342,342,342", "342,342,342,342,,,342,,,,,,,342,,,342,342,342,342,342,342,342,,342,342", "342,,342,342,,778,,778,778,778,778,778,,,,,,,,,778,,,,,,,342,,,342,", ",342,,342,,,,,,,,778,,,,,,,778,778,778,778,342,342,342,342,342,342,", ",,342,342,,,,,,,342,,,342,361,361,361,,361,342,342,,361,361,,,,361,778", "361,361,361,361,361,361,361,,,,,,361,361,361,361,361,361,361,,,361,", ",,,,,361,,,361,361,361,361,361,361,361,,361,361,361,,361,361,,361,361", ",,,,,,,,,,,,,,,,,,,,361,,,361,,,361,,361,,,,,,361,,,,,,,,361,,,,,361", "361,361,361,361,361,,,,361,361,,,,,,,361,,,361,362,362,362,,362,361", "361,,362,362,,,,362,,362,362,362,362,362,362,362,,,,,,362,362,362,362", "362,362,362,,,362,,,,,,,362,,,362,362,362,362,362,362,362,,362,362,362", ",362,362,,362,362,,,,,,,,,,,,,,,,,,,,,362,,,362,,,362,,362,,,,,,362", ",,,,,,,362,,,,,362,362,362,362,362,362,,,,362,362,,,,,,,362,,,362,381", "381,381,,381,362,362,,381,381,,,,381,,381,381,381,381,381,381,381,,", ",,,381,381,381,381,381,381,381,,,381,,,,,,,381,,,381,381,381,381,381", "381,381,,381,381,381,,381,381,,852,,852,852,852,852,852,,,,,,,,,852", ",,,,,,381,,,381,,,381,,381,,,,,,,,852,,,,,,,852,852,852,852,381,381", "381,381,381,381,,,,381,381,,,,,,,381,,,381,393,393,393,,393,381,381", ",393,393,,,,393,852,393,393,393,393,393,393,393,,,,,,393,393,393,393", "393,393,393,,,393,,,,,,,393,,,393,393,393,393,393,393,393,,393,393,393", ",393,393,,393,393,,,,,,,,,,,,,,,,,,,,,393,,,393,,,393,,393,,,,,,393", ",,,,,,,393,,,,,393,393,393,393,393,393,,,,393,393,,,,,,,393,,,393,432", "432,432,,432,393,393,,432,432,,,,432,,432,432,432,432,432,432,432,,", ",,,432,432,432,432,432,432,432,,,432,,,,,,,432,,,432,432,432,432,432", "432,432,,432,432,432,,432,432,,432,432,,,,,,,,,,,,,,,,,,,,,432,,,432", ",,432,,432,,,,,,432,,,,,,,,432,,,,,432,432,432,432,432,432,,,,432,432", ",,,,,,432,,,432,448,448,448,,448,432,432,,448,448,,,,448,,448,448,448", "448,448,448,448,,,,,,448,448,448,448,448,448,448,,,448,,,,,,,448,,,448", "448,448,448,448,448,448,448,448,448,448,,448,448,,448,448,,,,,,,,,,", ",,,,,,,,,,448,,,448,448,,448,,448,,448,,448,,448,,,,,,,,448,,,,,448", "448,448,448,448,448,,,,448,448,,,,,,,448,,,448,,448,,,,448,448,449,449", "449,,449,,,,449,449,,,,449,,449,449,449,449,449,449,449,,,,,,449,449", "449,449,449,449,449,,,449,,,,,,,449,,,449,449,449,449,449,449,449,449", "449,449,449,,449,449,,449,449,,,,,,,,,,,,,,,,,,,,,449,,,449,449,,449", ",449,,449,,449,,449,,,,,,,,449,,,,,449,449,449,449,449,449,,,,449,449", ",,,,,,449,,,449,,449,,,,449,449,465,465,465,,465,,,,465,465,,,,465,", "465,465,465,465,465,465,465,,,,,,465,465,465,465,465,465,465,,,465,", ",,,,,465,,,465,465,465,465,465,465,465,465,465,465,465,,465,465,,465", "465,,,,,,,,,,,,,,,,,,,,,465,,,465,,,465,,465,,465,,,,465,,,,,,,,465", ",,,,465,465,465,465,465,465,,,,465,465,,,,,,,465,,,465,,465,,,,465,465", "466,466,466,,466,,,,466,466,,,,466,,466,466,466,466,466,466,466,,,,", ",466,466,466,466,466,466,466,,,466,,,,,,,466,,,466,466,466,466,466,466", "466,466,466,466,466,,466,466,,466,466,,,,,,,,,,,,,,,,,,,,,466,,,466", ",,466,,466,,466,,,,466,,,,,,,,466,,,,,466,466,466,466,466,466,,,,466", "466,,,,,,,466,,,466,,466,,,,466,466,468,468,468,,468,,,,468,468,,,,468", ",468,468,468,468,468,468,468,,,,,,468,468,468,468,468,468,468,,,468", ",,,,,,468,,,468,468,468,468,468,468,468,,468,468,468,,468,468,,468,468", ",,,,,,,,,,,,,,,,,,,,468,,,468,,,468,,468,,,,,,468,,,,,,,,468,,,,,468", "468,468,468,468,468,,,,468,468,,,,,,,468,,,468,469,469,469,,469,468", "468,,469,469,,,,469,,469,469,469,469,469,469,469,,,,,,469,469,469,469", "469,469,469,,,469,,,,,,,469,,,469,469,469,469,469,469,469,,469,469,469", ",469,469,,469,469,,,,,,,,,,,,,,,,,,,,,469,,,469,,,469,,469,,,,,,469", ",,,,,,,469,,,,,469,469,469,469,469,469,,,,469,469,,,,,,,469,,,469,470", "470,470,,470,469,469,,470,470,,,,470,,470,470,470,470,470,470,470,,", ",,,470,470,470,470,470,470,470,,,470,,,,,,,470,,,470,470,470,470,470", "470,470,,470,470,470,,470,470,,470,470,,,,,,,,,,,,,,,,,,,,,470,,,470", ",,470,,470,,,,,,470,,,,,,,,470,,,,,470,470,470,470,470,470,,,,470,470", ",,,,,,470,,,470,498,498,498,,498,470,470,,498,498,,,,498,,498,498,498", "498,498,498,498,,,,,,498,498,498,498,498,498,498,,,498,,,,,,,498,,,498", "498,498,498,498,498,498,,498,498,498,,498,498,,498,498,,,,,,,,,,,,,", ",,,,,,,498,,,498,,,498,,498,,,,,,498,,,,,,,,498,,,,,498,498,498,498", "498,498,,,,498,498,,,,,,,498,,,498,516,516,516,,516,498,498,,516,516", ",,,516,,516,516,516,516,516,516,516,,,,,,516,516,516,516,516,516,516", ",,516,,,,,,,516,,,516,516,516,516,516,516,516,516,516,516,516,,516,516", ",516,516,,,,,,,,,,,,,,,,,,,,,516,,,516,,,516,,516,,516,,516,,516,,,", ",,,,516,,,,,516,516,516,516,516,516,,,,516,516,,,,,,,516,,,516,,516", ",,,516,516,518,518,518,,518,,,,518,518,,,,518,,518,518,518,518,518,518", "518,,,,,,518,518,518,518,518,518,518,,,518,,,,,,,518,,,518,518,518,518", "518,518,518,518,518,518,518,,518,518,,518,518,,,,,,,,,,,,,,,,,,,,,518", ",,518,,,518,,518,,,,518,,518,,,,,,,,518,,,,,518,518,518,518,518,518", ",,,518,518,,,,,,,518,,,518,,518,,,,518,518,520,520,520,,520,,,,520,520", ",,,520,,520,520,520,520,520,520,520,,,,,,520,520,520,520,520,520,520", ",,520,,,,,,,520,,,520,520,520,520,520,520,520,,520,520,520,,520,520", ",520,520,,,,,,,,,,,,,,,,,,,,,520,,,520,,,520,,520,,,,,,520,,,,,,,,520", ",,,,520,520,520,520,520,520,,,,520,520,,,,,,,520,,,520,526,526,526,526", "526,520,520,,526,526,,,,526,,526,526,526,526,526,526,526,,,,,,526,526", "526,526,526,526,526,,,526,,,,,,526,526,,526,526,526,526,526,526,526", "526,,526,526,526,,526,526,,526,526,,,,,,,,,,,,,,,,,,,,,526,,,526,,,526", ",526,,526,,,,526,,,,,,,,526,,,,,526,526,526,526,526,526,,,,526,526,", ",,,,526,526,,,526,532,532,532,,532,526,526,,532,532,,,,532,,532,532", "532,532,532,532,532,,,,,,532,532,532,532,532,532,532,,,532,,,,,,,532", ",,532,532,532,532,532,532,532,,532,532,532,,532,532,,887,,887,887,887", "887,887,,,,,,,,,887,,,,,,,532,,,532,,,532,,532,,,,,,,,887,,,,,,,887", "887,887,887,532,532,532,532,532,532,,,,532,532,,,,,,,532,,,532,534,534", "534,,534,532,532,,534,534,,,,534,887,534,534,534,534,534,534,534,,,", ",,534,534,534,534,534,534,534,,,534,,,,,,,534,,,534,534,534,534,534", "534,534,534,534,534,534,,534,534,,534,534,,,,,,,,,,,,,,,,,,,,,534,,", "534,,,534,,534,,534,,,,534,,,,,,,,534,,,,,534,534,534,534,534,534,,", ",534,534,,,,,,,534,,,534,,534,,,,534,534,537,537,537,,537,,,,537,537", ",,,537,,537,537,537,537,537,537,537,,,,,,537,537,537,537,537,537,537", ",,537,,,,,,,537,,,537,537,537,537,537,537,537,537,537,537,537,,537,537", ",537,537,,,,,,,,,,,,,,,,,,,,,537,,,537,,,537,,537,,537,,,,537,,,,,,", ",537,,,,,537,537,537,537,537,537,,,,537,537,,,,,,,537,,,537,,537,,,", "537,537,543,543,543,,543,,,,543,543,,,,543,,543,543,543,543,543,543", "543,,,,,,543,543,543,543,543,543,543,,,543,,,,,,,543,,,543,543,543,543", "543,543,543,,543,543,543,,543,543,,889,,889,889,889,889,889,,,,,,,,", "889,,,,,,,543,,,543,,,543,,543,,,,,,,,889,,,,,,,889,889,889,889,543", "543,543,543,543,543,,,,543,543,,,,,,,543,,,543,546,546,546,,546,543", "543,,546,546,,,,546,889,546,546,546,546,546,546,546,,,,,,546,546,546", "546,546,546,546,,,546,,,,,,,546,,,546,546,546,546,546,546,546,,546,546", "546,,546,546,,546,546,,,,,,,,,,,,,,,,,,,,,546,,,546,,,546,,546,,,,,", "546,,,,,,,,546,,,,,546,546,546,546,546,546,,,,546,546,,,,,,,546,,,546", "547,547,547,,547,546,546,,547,547,,,,547,,547,547,547,547,547,547,547", ",,,,,547,547,547,547,547,547,547,,,547,,,,,,,547,,,547,547,547,547,547", "547,547,,547,547,547,,547,547,,547,547,,,,,,,,,,,,,,,,,,,,,547,,,547", ",,547,,547,,,,,,547,,,,,,,,547,,,,,547,547,547,547,547,547,,,,547,547", ",,,,,,547,,,547,548,548,548,,548,547,547,,548,548,,,,548,,548,548,548", "548,548,548,548,,,,,,548,548,548,548,548,548,548,,,548,,,,,,,548,,,548", "548,548,548,548,548,548,,548,548,548,,548,548,,548,548,,,,,,,,,,,,,", ",,,,,,,548,,,548,,,548,,548,,,,,,548,,,,,,,,548,,,,,548,548,548,548", "548,548,,,,548,548,,,,,,,548,,,548,552,552,552,,552,548,548,,552,552", ",,,552,,552,552,552,552,552,552,552,,,,,,552,552,552,552,552,552,552", ",,552,,,,,,,552,,,552,552,552,552,552,552,552,,552,552,552,,552,552", ",552,552,,,,,,,,,,,,,,,,,,,,,552,,,552,,,552,,552,,,,,,552,,,,,,,,552", ",,,,552,552,552,552,552,552,,,,552,552,,,,,,,552,,,552,559,559,559,", "559,552,552,,559,559,,,,559,,559,559,559,559,559,559,559,,,,,,559,559", "559,559,559,559,559,,,559,,,,,,,559,,,559,559,559,559,559,559,559,559", "559,559,559,,559,559,,559,559,,,,,,,,,,,,,,,,,,,,,559,,,559,,,559,,559", ",559,,559,,559,,,,,,,,559,,,,,559,559,559,559,559,559,,,,559,559,,,", ",,,559,,,559,,559,,,,559,559,562,562,562,,562,,,,562,562,,,,562,,562", "562,562,562,562,562,562,,,,,,562,562,562,562,562,562,562,,,562,,,,,", ",562,,,562,562,562,562,562,562,562,562,562,562,562,,562,562,,562,562", ",,,,,,,,,,,,,,,,,,,,562,,,562,,,562,,562,,,,,,562,,,,,,,,562,,,,,562", "562,562,562,562,562,,,,562,562,,,,,,,562,,,562,,562,,,,562,562,567,567", "567,567,567,,,,567,567,,,,567,,567,567,567,567,567,567,567,,,,,,567", "567,567,567,567,567,567,,,567,,,,,,567,567,,567,567,567,567,567,567", "567,567,,567,567,567,,567,567,,567,567,,,,,,,,,,,,,,,,,,,,,567,,,567", ",,567,,567,,567,,,,567,,,,,,,,567,,,,,567,567,567,567,567,567,,,,567", "567,,,,,,,567,,,567,568,568,568,568,568,567,567,,568,568,,,,568,,568", "568,568,568,568,568,568,,,,,,568,568,568,568,568,568,568,,,568,,,,,", "568,568,,568,568,568,568,568,568,568,568,,568,568,568,,568,568,,568", "568,,,,,,,,,,,,,,,,,,,,,568,,,568,,,568,,568,,568,,,,568,,,,,,,,568", ",,,,568,568,568,568,568,568,,,,568,568,,,,,,,568,,,568,574,574,574,", "574,568,568,,574,574,,,,574,,574,574,574,574,574,574,574,,,,,,574,574", "574,574,574,574,574,,,574,,,,,,,574,,,574,574,574,574,574,574,574,,574", "574,574,,574,574,,956,,956,956,956,956,956,,,,,,,,,956,,,,,,,574,,,574", ",,574,,574,,,,,,,,956,956,,,,,,956,956,956,956,574,574,574,574,574,574", ",,,574,574,,,,,,,574,,,574,595,595,595,595,595,574,574,,595,595,,,,595", "956,595,595,595,595,595,595,595,,,,,,595,595,595,595,595,595,595,,,595", ",,,,,595,595,,595,595,595,595,595,595,595,595,,595,595,595,,595,595", ",595,595,,,,,,,,,,,,,,,,,,,,,595,,,595,,,595,,595,,595,,,,595,,,,,,", ",595,,,,,595,595,595,595,595,595,,,,595,595,,,,,,,595,,,595,599,599", "599,599,599,595,595,,599,599,,,,599,,599,599,599,599,599,599,599,,,", ",,599,599,599,599,599,599,599,,,599,,,,,,599,599,,599,599,599,599,599", "599,599,599,,599,599,599,,599,599,,599,599,,,,,,,,,,,,,,,,,,,,,599,", ",599,,,599,,599,,599,,,,599,,,,,,,,599,,,,,599,599,599,599,599,599,", ",,599,599,,,,,,,599,,,599,604,604,604,604,604,599,599,,604,604,,,,604", ",604,604,604,604,604,604,604,,,,,,604,604,604,604,604,604,604,,,604", ",,,,,604,604,,604,604,604,604,604,604,604,604,,604,604,604,,604,604", ",604,604,,,,,,,,,,,,,,,,,,,,,604,,,604,,,604,,604,,604,,,,604,,,,,,", ",604,,,,,604,604,604,604,604,604,,,,604,604,,,,,,,604,,,604,606,606", "606,,606,604,604,,606,606,,,,606,,606,606,606,606,606,606,606,,,,,,606", "606,606,606,606,606,606,,,606,,,,,,,606,,,606,606,606,606,606,606,606", "606,606,606,606,,606,606,,606,606,,,,,,,,,,,,,,,,,,,,,606,,,606,,,606", ",606,,606,,,,606,,,,,,,,606,,,,,606,606,606,606,606,606,,,,606,606,", ",,,,,606,,,606,,606,,,,606,606,609,609,609,,609,,,,609,609,,,,609,,609", "609,609,609,609,609,609,,,,,,609,609,609,609,609,609,609,,,609,,,,,", ",609,,,609,609,609,609,609,609,609,609,609,609,609,,609,609,,609,609", ",,,,,,,,,,,,,,,,,,,,609,,,609,,,609,,609,,609,,,,609,,,,,,,,609,,,,", "609,609,609,609,609,609,,,,609,609,,,,,,,609,,,609,,609,,,,609,609,615", "615,615,,615,,,,615,615,,,,615,,615,615,615,615,615,615,615,,,,,,615", "615,615,615,615,615,615,,,615,,,,,,,615,,,615,615,615,615,615,615,615", "615,615,615,615,,615,615,,615,615,,,,,,,,,,,,,,,,,,,,,615,,,615,,,615", ",615,,615,,,,615,,,,,,,,615,,,,,615,615,615,615,615,615,,,,615,615,", ",,,,,615,,,615,,615,,,,615,615,619,619,619,,619,,,,619,619,,,,619,,619", "619,619,619,619,619,619,,,,,,619,619,619,619,619,619,619,,,619,,,,,", ",619,,,619,619,619,619,619,619,619,,619,619,619,,619,619,,619,619,,", ",,,,,,,,,,,,,,,,,,619,,,619,,,619,,619,,,,,,619,,,,,,,,619,,,,,619,619", "619,619,619,619,,,,619,619,,,,,,,619,,,619,621,621,621,,621,619,619", ",621,621,,,,621,,621,621,621,621,621,621,621,,,,,,621,621,621,621,621", "621,621,,,621,,,,,,,621,,,621,621,621,621,621,621,621,,621,621,621,", "621,621,,621,621,,,,,,,,,,,,,,,,,,,,,621,,,621,,,621,,621,,,,,,621,", ",,,,,,621,,,,,621,621,621,621,621,621,,,,621,621,,,,,,,621,,,621,649", "649,649,,649,621,621,,649,649,,,,649,,649,649,649,649,649,649,649,,", ",,,649,649,649,649,649,649,649,,,649,,,,,,,649,,,649,649,649,649,649", "649,649,,649,649,649,,649,649,,649,649,,,,,,,,,,,,,,,,,,,,,649,,,649", ",,649,,649,,649,,,,649,,,,,,,,649,,,,,649,649,649,649,649,649,,,,649", "649,,,,,,,649,,,649,652,652,652,,652,649,649,,652,652,,,,652,,652,652", "652,652,652,652,652,,,,,,652,652,652,652,652,652,652,,,652,,,,,,,652", ",,652,652,652,652,652,652,652,,652,652,652,,652,652,,652,652,,,,,,,", ",,,,,,,,,,,,,652,,,652,,,652,,652,,,,,,652,,,,,,,,652,,,,,652,652,652", "652,652,652,,,,652,652,,,,,,,652,,,652,653,653,653,,653,652,652,,653", "653,,,,653,,653,653,653,653,653,653,653,,,,,,653,653,653,653,653,653", "653,,,653,,,,,,,653,,,653,653,653,653,653,653,653,,653,653,653,,653", "653,,653,653,,,,,,,,,,,,,,,,,,,,,653,,,653,,,653,,653,,,,,,653,,,,,", ",,653,,,,,653,653,653,653,653,653,,,,653,653,,,,,,,653,,,653,658,658", "658,,658,653,653,,658,658,,,,658,,658,658,658,658,658,658,658,,,,,,658", "658,658,658,658,658,658,,,658,,,,,,,658,,,658,658,658,658,658,658,658", ",658,658,658,,658,658,,658,658,,,,,,,,,,,,,,,,,,,,,658,,,658,,,658,", "658,,,,,,658,,,,,,,,658,,,,,658,658,658,658,658,658,,,,658,658,,,,,", ",658,,,658,661,661,661,,661,658,658,,661,661,,,,661,,661,661,661,661", "661,661,661,,,,,,661,661,661,661,661,661,661,,,661,,,,,,,661,,,661,661", "661,661,661,661,661,,661,661,661,,661,661,,661,661,,,,,,,,,,,,,,,,,", ",,,661,,,661,,,661,,661,,,,,,661,,,,,,,,661,,,,,661,661,661,661,661", "661,,,,661,661,,,,,,,661,,,661,664,664,664,,664,661,661,,664,664,,,", "664,,664,664,664,664,664,664,664,,,,,,664,664,664,664,664,664,664,,", "664,,,,,,,664,,,664,664,664,664,664,664,664,,664,664,664,,664,664,,664", "664,,,,,,,,,,,,,,,,,,,,,664,,,664,,,664,,664,,,,,,664,,,,,,,,664,,,", ",664,664,664,664,664,664,,,,664,664,,,,,,,664,,,664,665,665,665,,665", "664,664,,665,665,,,,665,,665,665,665,665,665,665,665,,,,,,665,665,665", "665,665,665,665,,,665,,,,,,,665,,,665,665,665,665,665,665,665,,665,665", "665,,665,665,,665,665,,,,,,,,,,,,,,,,,,,,,665,,,665,,,665,,665,,,,,", "665,,,,,,,,665,,,,,665,665,665,665,665,665,,,,665,665,,,,,,,665,,,665", "678,678,678,678,678,665,665,,678,678,,,,678,,678,678,678,678,678,678", "678,,,,,,678,678,678,678,678,678,678,,,678,,,,,,678,678,,678,678,678", "678,678,678,678,678,,678,678,678,,678,678,,678,678,,,,,,,,,,,,,,,,,", ",,,678,,,678,,,678,,678,,678,,,,678,,,,,,,,678,,,,,678,678,678,678,678", "678,,,,678,678,,,,,,,678,,,678,685,685,685,685,685,678,678,,685,685", ",,,685,,685,685,685,685,685,685,685,,,,,,685,685,685,685,685,685,685", ",,685,,,,,,685,685,,685,685,685,685,685,685,685,685,,685,685,685,,685", "685,,685,685,,,,,,,,,,,,,,,,,,,,,685,,,685,,,685,,685,,685,,,,685,,", ",,,,,685,,,,,685,685,685,685,685,685,,,,685,685,,,,,,,685,,,685,688", "688,688,,688,685,685,,688,688,,,,688,,688,688,688,688,688,688,688,,", ",,,688,688,688,688,688,688,688,,,688,,,,,,,688,,,688,688,688,688,688", "688,688,688,688,688,688,,688,688,,688,688,,,,,,,,,,,,,,,,,,,,,688,,", "688,,,688,,688,,688,,688,,688,,,,,,,,688,,,,,688,688,688,688,688,688", ",,,688,688,,,,,,,688,,,688,,688,,,,688,688,689,689,689,,689,,,,689,689", ",,,689,,689,689,689,689,689,689,689,,,,,,689,689,689,689,689,689,689", ",,689,,,,,,,689,,,689,689,689,689,689,689,689,689,689,689,689,,689,689", ",689,689,,,,,,,,,,,,,,,,,,,,,689,,,689,,,689,,689,,,,689,,689,,,,,,", ",689,,,,,689,689,689,689,689,689,,,,689,689,,,,,,,689,,,689,,689,,,", "689,689,690,690,690,690,690,,,,690,690,,,,690,,690,690,690,690,690,690", "690,,,,,,690,690,690,690,690,690,690,,,690,,,,,,690,690,,690,690,690", "690,690,690,690,690,,690,690,690,,690,690,,690,690,,,,,,,,,,,,,,,,,", ",,,690,,,690,,,690,,690,,690,,,,690,,,,,,,,690,,,,,690,690,690,690,690", "690,,,,690,690,,,,,,,690,,,690,691,691,691,691,691,690,690,,691,691", ",,,691,,691,691,691,691,691,691,691,,,,,,691,691,691,691,691,691,691", ",,691,,,,,,691,691,,691,691,691,691,691,691,691,691,,691,691,691,,691", "691,,691,691,,,,,,,,,,,,,,,,,,,,,691,,,691,,,691,,691,,691,,,,691,,", ",,,,,691,,,,,691,691,691,691,691,691,,,,691,691,,,,,,,691,,,691,696", "696,696,,696,691,691,,696,696,,,,696,,696,696,696,696,696,696,696,,", ",,,696,696,696,696,696,696,696,,,696,,,,,,,696,,,696,696,696,696,696", "696,696,,696,696,696,,696,696,,696,696,,,,,,,,,,,,,,,,,,,,,696,,,696", ",,696,,696,,,,,,696,,,,,,,,696,,,,,696,696,696,696,696,696,,,,696,696", ",,,,,,696,,,696,699,699,699,,699,696,696,,699,699,,,,699,,699,699,699", "699,699,699,699,,,,,,699,699,699,699,699,699,699,,,699,,,,,,,699,,,699", "699,699,699,699,699,699,,699,699,699,,699,699,,699,699,,,,,,,,,,,,,", ",,,,,,,699,,,699,,,699,,699,,,,,,699,,,,,,,,699,,,,,699,699,699,699", "699,699,,,,699,699,,,,,,,699,,,699,702,702,702,,702,699,699,,702,702", ",,,702,,702,702,702,702,702,702,702,,,,,,702,702,702,702,702,702,702", ",,702,,,,,,,702,,,702,702,702,702,702,702,702,,702,702,702,,702,702", ",987,,987,987,987,987,987,,,,,,,,,987,,,,,,,702,,,702,,,702,,702,,,", ",,,,987,,,,,,,987,987,987,987,702,702,702,702,702,702,,,,702,702,,,", ",,,702,,,702,715,715,715,,715,702,702,,715,715,,,,715,987,715,715,715", "715,715,715,715,,,,,,715,715,715,715,715,715,715,,,715,,,,,,,715,,,715", "715,715,715,715,715,715,,715,715,715,,715,715,,,,,,,,,,,,,,,,,,,,,,", ",715,,,715,,,715,,715,,,,,,,,,,,,,,,,,,,715,715,715,715,715,715,,,,715", "715,,,,,,,715,,,715,721,721,721,,721,715,715,,721,721,,,,721,,721,721", "721,721,721,721,721,,,,,,721,721,721,721,721,721,721,,,721,,,,,,,721", ",,721,721,721,721,721,721,721,,721,721,721,,721,721,,721,721,,,,,,,", ",,,,,,,,,,,,,721,,,721,,,721,,721,,721,,,,721,,,,,,,,721,,,,,721,721", "721,721,721,721,,,,721,721,,,,,,,721,,,721,760,760,760,,760,721,721", ",760,760,,,,760,,760,760,760,760,760,760,760,,,,,,760,760,760,760,760", "760,760,,,760,,,,,,,760,,,760,760,760,760,760,760,760,,760,760,760,", "760,760,,760,760,,,,,,,,,,,,,,,,,,,,,760,,,760,,,760,,760,,760,,,,760", ",,,,,,,760,,,,,760,760,760,760,760,760,,,,760,760,,,,,,,760,,,760,767", "767,767,,767,760,760,,767,767,,,,767,,767,767,767,767,767,767,767,,", ",,,767,767,767,767,767,767,767,,,767,,,,,,,767,,,767,767,767,767,767", "767,767,,767,767,767,,767,767,,767,767,,,,,,,,,,,,,,,,,,,,,767,,,767", ",,767,,767,,,,,,767,,,,,,,,767,,,,,767,767,767,767,767,767,,,,767,767", ",,,,,,767,,,767,772,772,772,772,772,767,767,,772,772,,,,772,,772,772", "772,772,772,772,772,,,,,,772,772,772,772,772,772,772,,,772,,,,,,772", "772,,772,772,772,772,772,772,772,772,,772,772,772,,772,772,,772,772", ",,,,,,,,,,,,,,,,,,,,772,,,772,,,772,,772,,772,,,,772,,,,,,,,772,,,,", "772,772,772,772,772,772,,,,772,772,,,,,,,772,,,772,776,776,776,776,776", "772,772,,776,776,,,,776,,776,776,776,776,776,776,776,,,,,,776,776,776", "776,776,776,776,,,776,,,,,,776,776,,776,776,776,776,776,776,776,776", ",776,776,776,,776,776,,776,776,,,,,,,,,,,,,,,,,,,,,776,,,776,,,776,", "776,,776,,,,776,,,,,,,,776,,,,,776,776,776,776,776,776,,,,776,776,,", ",,,,776,,,776,777,777,777,777,777,776,776,,777,777,,,,777,,777,777,777", "777,777,777,777,,,,,,777,777,777,777,777,777,777,,,777,,,,,,777,777", ",777,777,777,777,777,777,777,777,,777,777,777,,777,777,,777,777,,,,", ",,,,,,,,,,,,,,,,777,,,777,,,777,,777,,777,,,,777,,,,,,,,777,,,,,777", "777,777,777,777,777,,,,777,777,,,,,,,777,,,777,780,780,780,,780,777", "777,,780,780,,,,780,,780,780,780,780,780,780,780,,,,,,780,780,780,780", "780,780,780,,,780,,,,,,,780,,,780,780,780,780,780,780,780,,780,780,780", ",780,780,,780,780,,,,,,,,,,,,,,,,,,,,,780,,,780,,,780,,780,,,,,,780", ",,,,,,,780,,,,,780,780,780,780,780,780,,,,780,780,,,,,,,780,,,780,794", "794,794,794,794,780,780,,794,794,,,,794,,794,794,794,794,794,794,794", ",,,,,794,794,794,794,794,794,794,,,794,,,,,,794,794,,794,794,794,794", "794,794,794,794,,794,794,794,,794,794,,794,794,,,,,,,,,,,,,,,,,,,,,794", ",,794,,,794,,794,,794,,,,794,,,,,,,,794,,,,,794,794,794,794,794,794", ",,,794,794,,,,,,,794,,,794,799,799,799,,799,794,794,,799,799,,,,799", ",799,799,799,799,799,799,799,,,,,,799,799,799,799,799,799,799,,,799", ",,,,,,799,,,799,799,799,799,799,799,799,,799,799,799,,799,799,,799,799", ",,,,,,,,,,,,,,,,,,,,799,,,799,,,799,,799,,,,,,799,,,,,,,,799,,,,,799", "799,799,799,799,799,,,,799,799,,,,,,,799,,,799,800,800,800,,800,799", "799,,800,800,,,,800,,800,800,800,800,800,800,800,,,,,,800,800,800,800", "800,800,800,,,800,,,,,,,800,,,800,800,800,800,800,800,800,,800,800,800", ",800,800,,800,800,,,,,,,,,,,,,,,,,,,,,800,,,800,,,800,,800,,,,,,800", ",,,,,,,800,,,,,800,800,800,800,800,800,,,,800,800,,,,,,,800,,,800,801", "801,801,,801,800,800,,801,801,,,,801,,801,801,801,801,801,801,801,,", ",,,801,801,801,801,801,801,801,,,801,,,,,,,801,,,801,801,801,801,801", "801,801,,801,801,801,,801,801,,801,801,,,,,,,,,,,,,,,,,,,,,801,,,801", ",,801,,801,,,,,,801,,,,,,,,801,,,,,801,801,801,801,801,801,,,,801,801", ",,,,,,801,,,801,813,813,813,,813,801,801,,813,813,,,,813,,813,813,813", "813,813,813,813,,,,,,813,813,813,813,813,813,813,,,813,,,,,,,813,,,813", "813,813,813,813,813,813,,813,813,813,,813,813,,813,813,,,,,,,,,,,,,", ",,,,,,,813,,,813,,,813,,813,,,,,,813,,,,,,,,813,,,,,813,813,813,813", "813,813,,,,813,813,,,,,,,813,,,813,814,814,814,,814,813,813,,814,814", ",,,814,,814,814,814,814,814,814,814,,,,,,814,814,814,814,814,814,814", ",,814,,,,,,,814,,,814,814,814,814,814,814,814,,814,814,814,,814,814", ",814,814,,,,,,,,,,,,,,,,,,,,,814,,,814,,,814,,814,,,,,,814,,,,,,,,814", ",,,,814,814,814,814,814,814,,,,814,814,,,,,,,814,,,814,815,815,815,", "815,814,814,,815,815,,,,815,,815,815,815,815,815,815,815,,,,,,815,815", "815,815,815,815,815,,,815,,,,,,,815,,,815,815,815,815,815,815,815,,815", "815,815,,815,815,,815,815,,,,,,,,,,,,,,,,,,,,,815,,,815,,,815,,815,", ",,,,815,,,,,,,,815,,,,,815,815,815,815,815,815,,,,815,815,,,,,,,815", ",,815,838,838,838,838,838,815,815,,838,838,,,,838,,838,838,838,838,838", "838,838,,,,,,838,838,838,838,838,838,838,,,838,,,,,,838,838,,838,838", "838,838,838,838,838,838,,838,838,838,,838,838,,838,838,,,,,,,,,,,,,", ",,,,,,,838,,,838,,,838,,838,,838,,,,838,,,,,,,,838,,,,,838,838,838,838", "838,838,,,,838,838,,,,,,,838,,,838,865,865,865,,865,838,838,,865,865", ",,,865,,865,865,865,865,865,865,865,,,,,,865,865,865,865,865,865,865", ",,865,,,,,,,865,,,865,865,865,865,865,865,865,,865,865,865,,865,865", ",865,865,,,,,,,,,,,,,,,,,,,,,865,,,865,,,865,,865,,,,,,865,,,,,,,,865", ",,,,865,865,865,865,865,865,,,,865,865,,,,,,,865,,,865,867,867,867,867", "867,865,865,,867,867,,,,867,,867,867,867,867,867,867,867,,,,,,867,867", "867,867,867,867,867,,,867,,,,,,867,867,,867,867,867,867,867,867,867", "867,,867,867,867,,867,867,,867,867,,,,,,,,,,,,,,,,,,,,,867,,,867,,,867", ",867,,867,,,,867,,,,,,,,867,,,,,867,867,867,867,867,867,,,,867,867,", ",,,,,867,,,867,868,868,868,868,868,867,867,,868,868,,,,868,,868,868", "868,868,868,868,868,,,,,,868,868,868,868,868,868,868,,,868,,,,,,868", "868,,868,868,868,868,868,868,868,868,,868,868,868,,868,868,,868,868", ",,,,,,,,,,,,,,,,,,,,868,,,868,,,868,,868,,868,,,,868,,,,,,,,868,,,,", "868,868,868,868,868,868,,,,868,868,,,,,,,868,,,868,893,893,893,,893", "868,868,,893,893,,,,893,,893,893,893,893,893,893,893,,,,,,893,893,893", "893,893,893,893,,,893,,,,,,,893,,,893,893,893,893,893,893,893,,893,893", "893,,893,893,,893,893,,,,,,,,,,,,,,,,,,,,,893,,,893,,,893,,893,,,,,", "893,,,,,,,,893,,,,,893,893,893,893,893,893,,,,893,893,,,,,,,893,,,893", "907,907,907,,907,893,893,,907,907,,,,907,,907,907,907,907,907,907,907", ",,,,,907,907,907,907,907,907,907,,,907,,,,,,,907,,,907,907,907,907,907", "907,907,,907,907,907,,907,907,,907,907,,,,,,,,,,,,,,,,,,,,,907,,,907", ",,907,,907,,,,,,907,,,,,,,,907,,,,,907,907,907,907,907,907,,,,907,907", ",,,,,,907,,,907,908,908,908,,908,907,907,,908,908,,,,908,,908,908,908", "908,908,908,908,,,,,,908,908,908,908,908,908,908,,,908,,,,,,,908,,,908", "908,908,908,908,908,908,,908,908,908,,908,908,,908,908,,,,,,,,,,,,,", ",,,,,,,908,,,908,,,908,,908,,,,,,908,,,,,,,,908,,,,,908,908,908,908", "908,908,,,,908,908,,,,,,,908,,,908,909,909,909,,909,908,908,,909,909", ",,,909,,909,909,909,909,909,909,909,,,,,,909,909,909,909,909,909,909", ",,909,,,,,,,909,,,909,909,909,909,909,909,909,,909,909,909,,909,909", ",909,909,,,,,,,,,,,,,,,,,,,,,909,,,909,,,909,,909,,,,,,909,,,,,,,,909", ",,,,909,909,909,909,909,909,,,,909,909,,,,,,,909,,,909,915,915,915,", "915,909,909,,915,915,,,,915,,915,915,915,915,915,915,915,,,,,,915,915", "915,915,915,915,915,,,915,,,,,,,915,,,915,915,915,915,915,915,915,915", "915,915,915,,915,915,,915,915,,,,,,,,,,,,,,,,,,,,,915,,,915,,,915,,915", ",,,915,,915,,,,,,,,915,,,,,915,915,915,915,915,915,,,,915,915,,,,,,", "915,,,915,,915,,,,915,915,919,919,919,919,919,,,,919,919,,,,919,,919", "919,919,919,919,919,919,,,,,,919,919,919,919,919,919,919,,,919,,,,,", "919,919,,919,919,919,919,919,919,919,919,,919,919,919,,919,919,,919", "919,,,,,,,,,,,,,,,,,,,,,919,,,919,,,919,,919,,919,,,,919,,,,,,,,919", ",,,,919,919,919,919,919,919,,,,919,919,,,,,,,919,,,919,923,923,923,", "923,919,919,,923,923,,,,923,,923,923,923,923,923,923,923,,,,,,923,923", "923,923,923,923,923,,,923,,,,,,,923,,,923,923,923,923,923,923,923,,923", "923,923,,923,923,,,,,,,,,,,,,,,,,,,,,,,,923,,,923,,,923,,923,,,,,,,", ",,,,,,,,,,,923,923,923,923,923,923,,,,923,923,,,,,,,923,,,923,938,938", "938,,938,923,923,,938,938,,,,938,,938,938,938,938,938,938,938,,,,,,938", "938,938,938,938,938,938,,,938,,,,,,,938,,,938,938,938,938,938,938,938", ",938,938,938,,938,938,,938,938,,,,,,,,,,,,,,,,,,,,,938,,,938,,,938,", "938,,938,,,,938,,,,,,,,938,,,,,938,938,938,938,938,938,,,,938,938,,", ",,,,938,,,938,939,939,939,939,939,938,938,,939,939,,,,939,,939,939,939", "939,939,939,939,,,,,,939,939,939,939,939,939,939,,,939,,,,,,939,939", ",939,939,939,939,939,939,939,939,,939,939,939,,939,939,,939,939,,,,", ",,,,,,,,,,,,,,,,939,,,939,,,939,,939,,939,,,,939,,,,,,,,939,,,,,939", "939,939,939,939,939,,,,939,939,,,,,,,939,,,939,942,942,942,942,942,939", "939,,942,942,,,,942,,942,942,942,942,942,942,942,,,,,,942,942,942,942", "942,942,942,,,942,,,,,,942,942,,942,942,942,942,942,942,942,942,,942", "942,942,,942,942,,942,942,,,,,,,,,,,,,,,,,,,,,942,,,942,,,942,,942,", "942,,,,942,,,,,,,,942,,,,,942,942,942,942,942,942,,,,942,942,,,,,,,942", ",,942,965,965,965,965,965,942,942,,965,965,,,,965,,965,965,965,965,965", "965,965,,,,,,965,965,965,965,965,965,965,,,965,,,,,,965,965,,965,965", "965,965,965,965,965,965,,965,965,965,,965,965,,965,965,,,,,,,,,,,,,", ",,,,,,,965,,,965,,,965,,965,,965,,,,965,,,,,,,,965,,,,,965,965,965,965", "965,965,,,,965,965,,,,,,,965,,,965,978,978,978,978,978,965,965,,978", "978,,,,978,,978,978,978,978,978,978,978,,,,,,978,978,978,978,978,978", "978,,,978,,,,,,978,978,,978,978,978,978,978,978,978,978,,978,978,978", ",978,978,,978,978,,,,,,,,,,,,,,,,,,,,,978,,,978,,,978,,978,,978,,,,978", ",,,,,,,978,,,,,978,978,978,978,978,978,,,,978,978,,,,,,,978,,,978,983", "983,983,983,983,978,978,,983,983,,,,983,,983,983,983,983,983,983,983", ",,,,,983,983,983,983,983,983,983,,,983,,,,,,983,983,,983,983,983,983", "983,983,983,983,,983,983,983,,983,983,,983,983,,,,,,,,,,,,,,,,,,,,,983", ",,983,,,983,,983,,983,,,,983,,,,,,,,983,,,,,983,983,983,983,983,983", ",,,983,983,,,,,,,983,,,983,996,996,996,996,996,983,983,,996,996,,,,996", ",996,996,996,996,996,996,996,,,,,,996,996,996,996,996,996,996,,,996", ",,,,,996,996,,996,996,996,996,996,996,996,996,,996,996,996,,996,996", ",996,996,,,,,,,,,,,,,,,,,,,,,996,,,996,,,996,,996,,996,,,,996,,,,,,", ",996,,,,,996,996,996,996,996,996,,,,996,996,,,,,,,996,,,996,1000,1000", "1000,,1000,996,996,,1000,1000,,,,1000,,1000,1000,1000,1000,1000,1000", "1000,,,,,,1000,1000,1000,1000,1000,1000,1000,,,1000,,,,,,,1000,,,1000", "1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,,1000,1000,,1000,1000", ",,,,,,,,,,,,,,,,,,,,1000,,,1000,,,1000,,1000,,1000,,,,1000,,,,,,,,1000", ",,,444,1000,1000,1000,1000,1000,1000,444,444,444,1000,1000,,444,444", ",444,,1000,,,1000,,1000,,444,,1000,1000,,,,,,,,444,444,,444,444,444", "444,444,,,,,,,,,,,,,,,,,,,,,,444,444,444,444,444,444,444,444,444,444", "444,444,444,444,444,,,444,444,444,,444,,,,444,,,,,,444,,444,,444,444", "444,444,444,444,444,,444,444,444,,,,,,,,,,,,,444,444,,444,,444,,446", "444,,444,,,444,446,446,446,,,,446,446,,446,,,,,,,,,,,,,,,,,,,,446,446", ",446,446,446,446,446,,,,,,,,,,,,,,,,,,,,,,446,446,446,446,446,446,446", "446,446,446,446,446,446,446,446,,,446,446,446,,446,,,,446,,,,,,446,", "446,,446,446,446,446,446,446,446,,446,,446,,,,,,,,,,,,,446,446,,446", ",446,,668,446,,446,,,446,668,668,668,,,668,668,668,,668,,,,,,,,,668", "668,668,,,,,,,,,668,668,,668,668,668,668,668,,,,,,,,,,,,,,,,,,,,,,668", "668,668,668,668,668,668,668,668,668,668,668,668,668,668,,,668,668,668", ",668,668,,,668,,668,,668,,668,,668,,668,668,668,668,668,668,668,,668", "668,668,,,,,,,,,,,,,668,668,668,668,,668,,669,668,,668,,,668,669,669", "669,,,669,669,669,,669,,,,,,,,,,669,669,,,,,,,,,669,669,,669,669,669", "669,669,,,,,,,,,,,,,,,,,,,,,,669,669,669,669,669,669,669,669,669,669", "669,669,669,669,669,,,669,669,669,,669,669,,,669,,669,,669,,669,,669", ",669,669,669,669,669,669,669,,669,,669,,,,,,,,,,,,,669,669,669,669,", "669,,25,669,,669,,,669,25,25,25,,,25,25,25,,25,,,,,,,,,25,25,25,,,,", ",,,,25,25,,25,25,25,25,25,,,,,,,,,,,,,,,,,,,,,,25,25,25,25,25,25,25", "25,25,25,25,25,25,25,25,,,25,25,25,,,25,,25,25,,25,,25,,25,,25,,25,25", "25,25,25,25,25,,25,25,25,,,,,,,,,,,,,25,25,25,25,26,25,,,25,,25,26,26", "26,,,26,26,26,,26,,,,,,,,,,26,26,,,,,,,,,26,26,,26,26,26,26,26,,,,,", ",,,,,,,,,,,,,,,,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,,,26,26", "26,,,26,,26,26,,26,,26,,26,,26,,26,26,26,26,26,26,26,,26,,26,,,,,,,", ",,,,,26,26,26,26,51,26,,,26,,26,51,51,51,,,51,51,51,,51,,,,,,,,,,51", "51,51,,,,,,,,51,51,,51,51,51,51,51,,,,,,,,,,,,,,,,,,,,,,51,51,51,51", "51,51,51,51,51,51,51,51,51,51,51,,,51,51,51,,,51,,,51,,51,,51,,51,,51", ",51,51,51,51,51,51,51,,51,,51,,,,,,,,,,,,,51,51,51,51,440,51,,51,51", ",51,440,440,440,,,440,440,440,,440,,,,,,,,,440,440,440,,,,,,,,,440,440", ",440,440,440,440,440,,,,,,,,,,,,,,,,,,,,,,440,440,440,440,440,440,440", "440,440,440,440,440,440,440,440,,,440,440,440,,,440,,440,440,,440,,440", ",440,,440,,440,440,440,440,440,440,440,,440,440,440,,,,,,,,,,,,,440", "440,440,440,450,440,,,440,,440,450,450,450,,,450,450,450,,450,,,,,,", ",,450,450,450,,,,,,,,,450,450,,450,450,450,450,450,,,,,,,,,,,,,,,,,", ",,,,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,,,450", "450,450,,,450,,450,450,,450,,450,,450,,450,,450,450,450,450,450,450", "450,,450,450,450,,,,,,,,,,,,,450,450,450,450,500,450,,,450,,450,500", "500,500,,,500,500,500,,500,,,,,,,,,,500,,,,,,,,,,500,500,,500,500,500", "500,500,,,,,,,,,,,,501,,,,,,,501,501,501,,,501,501,501,,501,,,,,500", "500,,,,501,,,500,,,,,500,500,501,501,,501,501,501,501,501,,,,,,,,,,", ",500,,,,,,,,,,,,,500,,500,,,500,,,501,501,,502,,,,,501,,502,502,502", "501,501,502,502,502,,502,,,,,,,,,,502,,,,,501,,,,,502,502,,502,502,502", "502,502,501,,501,,,501,202,202,,,202,,,,,,,,,202,202,202,202,202,202", "202,202,202,,,202,202,502,502,,,202,202,202,202,502,,,,,502,502,,,,", "202,202,,202,202,202,202,202,202,202,202,202,202,202,,502,202,,,,,,", ",,,,,502,,502,,,502,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7", ",,,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,,7,,,,,,,,,7,7,7", "7,7,7,7,7,7,,,7,7,,,,,7,7,7,7,,,,,,,,,,,,7,7,,7,7,7,7,7,7,7,7,7,7,7", ",,7,7,,,,,,,,,,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,,,", "8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,,,8,,,,,,,,,8,8,8,8,8", "8,8,8,8,,,8,8,,,,,8,8,8,8,,,,,,,,,,,,8,8,,8,8,8,8,8,8,8,8,8,8,8,,,8", "8,,,,,,,,,,8,423,423,423,423,423,423,423,423,423,423,423,423,423,423", "423,423,423,423,423,423,423,423,423,423,,,,423,423,423,423,423,423,423", "423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,,,423", ",,,,,,,,423,423,423,423,423,423,423,423,423,,,423,423,,,,,423,423,423", "423,,,,,,,,,,,,423,423,,423,423,423,423,423,423,423,423,423,423,423", ",,423,423,,,,,,,,,,423,427,427,427,427,427,427,427,427,427,427,427,427", "427,427,427,427,427,427,427,427,427,427,427,427,,,,427,427,427,427,427", "427,427,427,427,427,427,427,427,427,427,427,427,427,427,427,427,427", "427,,,427,,,,,,,,,427,427,427,427,427,427,427,427,427,,,427,427,,,,", "427,427,427,427,,,,,,,,,,,,427,427,,427,427,427,427,427,427,427,427", "427,427,427,,,427,427,,,,,,,,,,427,66,66,66,66,66,66,66,66,66,66,66", "66,66,66,66,66,66,66,66,66,66,66,66,66,,,,66,66,66,66,66,66,66,66,66", "66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,,66,,,,,,,66,66,66", "66,66,66,66,66,66,,,66,66,,,,,66,66,66,66,,,,,,66,,,,,,66,66,,66,66", "66,66,66,66,66,66,66,66,66,,,66,80,80,80,80,80,80,80,80,80,80,80,80", "80,80,80,80,80,80,80,80,80,80,80,80,,,,80,80,80,80,80,80,80,80,80,80", "80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,,80,,,,,,,80,80,80,80", "80,80,80,80,80,,,80,80,,,,,80,80,80,80,,,,,,,,,,,,80,80,,80,80,80,80", "80,80,80,80,80,80,80,,,80,193,193,193,193,193,193,193,193,193,193,193", "193,193,193,193,193,193,193,193,193,193,193,193,193,,,,193,193,193,193", "193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193", "193,193,193,193,193,,193,,,,,,,193,193,193,193,193,193,193,193,193,", ",193,193,,,,,193,193,193,193,,,,,,,,,,,,193,193,,193,193,193,193,193", "193,193,193,193,193,193,,,193,791,791,791,791,791,791,791,791,791,791", "791,791,791,791,791,791,791,791,791,791,791,791,791,791,,,,791,791,791", "791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,791", "791,791,791,,,791,,,,,,,,,791,791,791,791,791,791,791,791,791,,,791", "791,,,,,791,791,791,791,,,,,,,,,,,,791,791,,791,791,791,791,791,791", "791,791,791,791,791,201,201,791,,201,,,,,,,,,201,201,201,201,201,201", "201,201,201,,,201,201,,,,,201,201,201,201,,,,,,201,,,,,,201,201,,201", "201,201,201,201,201,201,201,201,201,201,203,203,201,,203,,,,,,,,,203", "203,203,203,203,203,203,203,203,,,203,203,,,,,203,203,203,203,,,,,,", ",,,,,203,203,,203,203,203,203,203,203,203,203,203,203,203,249,249,203", ",249,,,,,,,,,249,249,249,249,249,249,249,249,249,,,249,249,,,,,249,249", "249,249,,,,,,,,,,,,249,249,,249,249,249,249,249,249,249,249,249,249", "249,250,250,249,,250,,,,,,,,,250,250,250,250,250,250,250,250,250,,,250", "250,,,,,250,250,250,250,,,,,,,,,,,,250,250,,250,250,250,250,250,250", "250,250,250,250,250,251,251,250,,251,,,,,,,,,251,251,251,251,251,251", "251,251,251,,,251,251,,,,,251,251,251,251,,,,,,,,,,,,251,251,,251,251", "251,251,251,251,251,251,251,251,251,463,463,251,,463,,,,,,,,,463,463", "463,463,463,463,463,463,463,,,463,463,,,,,463,463,463,463,,,,,,463,", ",,,,463,463,,463,463,463,463,463,463,463,463,463,463,463,464,464,463", ",464,,,,,,,,,464,464,464,464,464,464,464,464,464,,,464,464,,,,,464,464", "464,464,,,,,,,,,,,,464,464,,464,464,464,464,464,464,464,464,464,464", "464,535,535,464,,535,,,,,,,,,535,535,535,535,535,535,535,535,535,,,535", "535,,,,,535,535,535,535,,,,,,535,,,,,,535,535,,535,535,535,535,535,535", "535,535,535,535,535,536,536,535,,536,,,,,,,,,536,536,536,536,536,536", "536,536,536,,,536,536,,,,,536,536,536,536,,,,,,,,,,,,536,536,,536,536", "536,536,536,536,536,536,536,536,536,538,538,536,,538,,,,,,,,,538,538", "538,538,538,538,538,538,538,,,538,538,,,,,538,538,538,538,,,,,,,,,,", ",538,538,,538,538,538,538,538,538,538,538,538,538,538,549,549,538,,549", ",,,,,,,,549,549,549,549,549,549,549,549,549,,,549,549,,,,,549,549,549", "549,,,,,,549,,,,,,549,549,,549,549,549,549,549,549,549,549,549,549,549", "550,550,549,,550,,,,,,,,,550,550,550,550,550,550,550,550,550,,,550,550", ",,,,550,550,550,550,,,,,,,,,,,,550,550,,550,550,550,550,550,550,550", "550,550,550,550,607,607,550,,607,,,,,,,,,607,607,607,607,607,607,607", "607,607,,,607,607,,,,,607,607,607,607,,,,,,607,,,,,,607,607,,607,607", "607,607,607,607,607,607,607,607,607,608,608,607,,608,,,,,,,,,608,608", "608,608,608,608,608,608,608,,,608,608,,,,,608,608,608,608,,,,,,,,,,", ",608,608,,608,608,608,608,608,608,608,608,608,608,608,614,614,608,,614", ",,,,,,,,614,614,614,614,614,614,614,614,614,,,614,614,,,,,614,614,614", "614,,,,,,,,,,,,614,614,,614,614,614,614,614,614,614,614,614,614,614", "616,616,614,,616,,,,,,,,,616,616,616,616,616,616,616,616,616,,,616,616", ",,,,616,616,616,616,,,,,,616,,,,,,616,616,,616,616,616,616,616,616,616", "616,616,616,616,742,742,616,,742,,,,,,,,,742,742,742,742,742,742,742", "742,742,,,742,742,,,,,742,742,742,742,,,,,,,,,,,,742,742,,742,742,742", "742,742,742,742,742,742,742,742,1001,1001,742,,1001,,,,,,,,,1001,1001", "1001,1001,1001,1001,1001,1001,1001,,,1001,1001,,,,,1001,1001,1001,1001", ",,,,,1001,,,,,,1001,1001,,1001,1001,1001,1001,1001,1001,1001,1001,1001", "1001,1001,1002,1002,1001,,1002,,,,,,,,,1002,1002,1002,1002,1002,1002", "1002,1002,1002,,,1002,1002,,,,,1002,1002,1002,1002,,,,,,,,,,,,1002,1002", ",1002,1002,1002,1002,1002,1002,1002,1002,1002,1002,1002,,,1002"]; racc_action_check = arr = Opal.get('Array').$new(25645, nil); idx = 0; ($a = ($c = clist).$each, $a.$$p = (TMP_3 = function(str){var self = TMP_3.$$s || this, $d, $e, TMP_4; if (str == null) str = nil; return ($d = ($e = str.$split(",", -1)).$each, $d.$$p = (TMP_4 = function(i){var self = TMP_4.$$s || this, $f; if (i == null) i = nil; if ((($f = i['$empty?']()) !== nil && $f != null && (!$f.$$is_boolean || $f == true))) { } else { arr['$[]='](idx, i.$to_i()) }; return idx = $rb_plus(idx, 1);}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $d).call($e)}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $a).call($c); racc_action_pointer = [-2, 14, nil, -46, nil, 790, -84, 23598, 23719, -49, nil, -58, 31, 630, 244, 2, 310, nil, 129, 260, 1860, 130, nil, 354, -19, 22702, 22829, 391, 529, 667, nil, 805, 936, 1067, nil, 72, 301, 148, 441, 1198, 1329, 1460, 92, 714, nil, nil, nil, nil, nil, nil, nil, 22956, nil, 1591, 1722, 1860, -15, 949, 1998, 2129, nil, nil, 2260, 2391, 2522, nil, 24082, nil, nil, nil, nil, nil, -15, nil, nil, nil, nil, nil, 100, 132, 24192, nil, nil, nil, 493, 2653, nil, nil, 2791, nil, nil, nil, nil, nil, nil, nil, nil, nil, 273, nil, 2929, nil, nil, nil, 3060, 3191, 3322, 3453, 3584, 3715, nil, 513, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 24302, 181, nil, 3846, 3977, 4108, 4239, 4377, 24471, 23471, 24530, 4515, 4646, 4777, 4908, nil, 831, -63, 261, -51, 201, 293, 5039, 5170, nil, nil, 5301, 301, 5432, 5563, 5694, 5825, 5956, 6087, 6218, 6349, 6480, 6611, 6742, 6873, 7004, 7135, 7266, 7397, 7528, 7659, 7790, 7921, 8052, 8183, 8314, 8445, 8576, nil, nil, nil, 24589, 24648, 24707, 323, 8707, 8845, nil, nil, nil, nil, nil, nil, nil, 8983, nil, 2653, nil, 302, 306, nil, 9121, 366, 9252, nil, nil, 9383, 9514, nil, nil, 146, 970, 395, 9645, 438, 465, 431, 9776, 9907, 17, 899, 519, 39, nil, 502, 483, -14, nil, nil, nil, 521, 515, 495, 10038, nil, 430, 575, 595, 931, nil, 597, nil, 10169, nil, 10300, 582, 543, nil, 558, -89, -47, 591, 581, 114, 606, nil, nil, -21, 1080, nil, nil, nil, 569, 575, 600, 603, nil, 607, 622, nil, nil, nil, 700, nil, 10431, nil, nil, nil, nil, nil, nil, nil, 821, nil, nil, nil, 717, nil, nil, 718, 602, -7, 0, 10562, 10693, 349, 350, 645, -2, 1030, 722, 0, 753, nil, nil, 391, 724, nil, 1064, nil, 68, nil, nil, 10824, 148, 307, 323, 450, 532, 575, 580, 588, nil, 626, nil, 10955, nil, 285, nil, 391, nil, 419, 666, 529, nil, 667, -33, nil, 556, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 682, 23840, nil, nil, nil, 23961, 683, nil, 668, nil, 11086, 669, nil, 2791, 705, 708, 568, 623, 23083, nil, nil, nil, 22182, 713, 22312, nil, 11217, 11355, 23210, nil, nil, nil, 3191, nil, 667, nil, nil, 391, nil, nil, nil, 24766, 24825, 11493, 11631, 98, 11769, 11900, 12031, 44, nil, 4646, 4777, 260, 418, 739, 748, 749, 753, 2516, 2929, 1461, 4908, 1591, 1998, 2129, 2260, 5039, 5170, 5301, 5432, 5563, 669, 829, 5694, 5825, 12162, -35, 23337, 23392, 23471, -34, nil, 696, nil, nil, 695, 715, nil, -7, 166, 752, nil, nil, 12293, nil, 12431, nil, 12569, nil, 167, nil, nil, nil, 12700, 754, 720, nil, nil, 722, 12831, 761, 12962, 24884, 24943, 13100, 25002, 170, 771, nil, nil, 13238, 738, nil, 13369, 13500, 13631, 25061, 25120, 3322, 13762, 860, 861, 749, 795, nil, nil, 13893, nil, nil, 14031, nil, nil, nil, nil, 14169, 14300, 796, nil, 2404, nil, nil, 14431, 471, nil, nil, 582, 2535, nil, 826, nil, nil, 1161, 838, nil, 805, nil, 966, nil, 771, 686, nil, nil, 14562, 894, nil, nil, 14693, 203, 204, 894, 902, 14824, nil, 14955, 25179, 25238, 15093, 16, nil, 1224, nil, 25297, 15231, 25356, nil, nil, 15369, 585, 15500, nil, 9789, nil, nil, nil, 31, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 244, nil, nil, nil, 786, nil, nil, nil, nil, nil, 802, 15631, 649, 202, 15762, 15893, 839, nil, nil, nil, 16024, 841, nil, 16155, 842, nil, 16286, 16417, 283, 297, 22442, 22572, 849, 853, 529, nil, 1722, nil, 10051, nil, 16548, nil, nil, nil, nil, nil, nil, 16679, nil, 858, 16810, 16948, 17086, 17217, nil, 823, nil, 863, 17348, nil, nil, 17479, 1000, -25, 17610, 826, nil, 869, 207, 229, 874, 252, 260, 883, 881, 888, 852, 17741, 3453, 914, 915, 66, 968, 17872, nil, 901, nil, 292, nil, 885, 989, nil, nil, nil, 874, 880, 1292, 891, nil, nil, 897, 899, nil, 900, 25415, nil, nil, 938, 1097, 907, 1214, 740, nil, 1020, nil, nil, nil, nil, nil, 1026, nil, 1027, 18003, 963, 29, 40, 80, 121, 964, 18134, 1722, nil, 970, 968, 18265, 609, nil, 212, 18396, 18527, 10444, 623, 18658, nil, 937, 940, nil, 941, 946, 950, nil, 943, nil, 24412, 990, 831, 18789, nil, nil, nil, 955, 18920, 19051, 19182, nil, 3584, nil, 3715, nil, nil, 3846, nil, 3977, nil, 4108, 19313, 19444, 19575, 299, 385, nil, 963, 986, 970, 1085, 985, nil, 977, 994, 1099, nil, nil, nil, 983, 232, nil, nil, nil, 1102, nil, 19706, 985, 1026, nil, nil, nil, nil, nil, nil, 1219, nil, 1350, nil, nil, 10837, nil, 1481, nil, nil, 1033, nil, nil, 691, 1345, 1000, 1120, nil, 19837, 1122, 19968, 20099, nil, nil, 45, 50, 1355, 229, nil, 1128, nil, nil, 1129, 1130, 1019, nil, nil, 558, nil, nil, 12844, nil, 13251, nil, 1612, nil, 20230, nil, nil, nil, nil, nil, nil, nil, 1033, 1018, nil, 4239, nil, 4377, 20361, 20492, 20623, 849, nil, 1040, nil, nil, 20754, nil, nil, nil, 20892, nil, nil, 72, 21023, nil, 1028, 1030, 1031, 1033, 1036, 1581, 1038, 1607, nil, 76, nil, 1156, 1157, 21154, 21285, nil, nil, 21416, nil, nil, 1077, nil, 1043, nil, 1045, 1046, 1047, 1048, nil, 1060, nil, 14444, nil, 4515, 419, nil, nil, nil, nil, nil, 21547, 80, 1423, 1133, 84, nil, nil, 2019, nil, nil, nil, 1988, 1064, 21678, nil, nil, nil, 527, 21809, 1182, nil, nil, 17623, nil, 2150, nil, 2281, nil, 2950, nil, nil, 21940, nil, 1226, 1187, 22071, 25474, 25533, 88, 1072, 1077, 743, nil, nil, nil, 1198, nil, 1084, 1085, 1086, 1096, 1214, nil, nil, 1132, 96, 110, 176, 211, nil, nil, nil, 3081, nil, nil, nil, nil, nil, 129, 1099, nil]; racc_action_default = [-3, -590, -1, -578, -4, -6, -590, -590, -590, -590, -25, -590, -590, -590, -278, -590, -37, -40, -590, -590, -45, -47, -48, -49, -259, -259, -259, -293, -331, -332, -67, -10, -71, -79, -81, -590, -476, -590, -590, -590, -590, -590, -580, -237, -271, -272, -273, -274, -275, -276, -277, -568, -280, -284, -589, -558, -301, -589, -590, -590, -306, -309, -578, -590, -590, -323, -590, -333, -334, -419, -420, -421, -422, -423, -589, -426, -589, -589, -589, -589, -589, -453, -459, -460, -590, -465, -466, -467, -468, -469, -470, -471, -472, -473, -474, -475, -478, -479, -590, -2, -579, -585, -586, -587, -590, -590, -590, -590, -590, -3, -13, -590, -108, -109, -110, -111, -112, -113, -114, -117, -118, -119, -120, -121, -122, -123, -124, -125, -126, -127, -128, -129, -130, -131, -132, -133, -134, -135, -136, -137, -138, -139, -140, -141, -142, -143, -144, -145, -146, -147, -148, -149, -150, -151, -152, -153, -154, -155, -156, -157, -158, -159, -160, -161, -162, -163, -164, -165, -166, -167, -168, -169, -170, -171, -172, -173, -174, -175, -176, -177, -178, -179, -180, -181, -182, -183, -184, -185, -186, -187, -188, -189, -190, -590, -18, -115, -10, -590, -590, -589, -589, -590, -590, -590, -590, -590, -590, -590, -43, -590, -476, -590, -278, -590, -590, -10, -590, -44, -227, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -234, -388, -390, -590, -590, -590, -54, -589, -590, -300, -394, -402, -404, -62, -400, -63, -590, -64, -238, -254, -263, -263, -258, -590, -264, -590, -589, -560, -590, -590, -65, -66, -578, -11, -67, -10, -590, -590, -72, -75, -10, -476, -590, -590, -278, -293, -296, -580, -590, -331, -332, -335, -401, -590, -77, -590, -83, -288, -461, -462, -590, -212, -213, -228, -590, -581, -10, -282, -580, -239, -580, -582, -582, -590, -590, -582, -590, -302, -303, -590, -590, -352, -353, -360, -589, -520, -555, -555, -370, -589, -589, -387, -485, -486, -488, -489, -493, -494, -519, -521, -522, -523, -524, -525, -590, -542, -547, -548, -550, -551, -552, -590, -46, -590, -590, -590, -590, -578, -590, -579, -476, -590, -590, -278, -590, -527, -528, -104, -590, -106, -590, -278, -590, -320, -476, -590, -108, -109, -146, -147, -163, -168, -175, -178, -326, -590, -556, -590, -424, -590, -439, -590, -441, -590, -590, -590, -431, -590, -590, -437, -590, -452, -454, -455, -456, -457, -463, -464, 1036, -5, -588, -19, -20, -21, -22, -23, -590, -590, -15, -16, -17, -590, -590, -26, -35, -36, -590, -590, -27, -193, -590, -590, -569, -570, -259, -397, -571, -572, -569, -259, -570, -399, -574, -575, -259, -569, -570, -33, -201, -34, -590, -38, -39, -191, -264, -41, -42, -590, -590, -589, -589, -288, -590, -590, -590, -590, -299, -202, -203, -204, -205, -206, -207, -208, -209, -214, -215, -216, -217, -218, -219, -220, -221, -222, -223, -224, -225, -226, -229, -230, -231, -232, -590, -589, -259, -259, -259, -589, -55, -580, -249, -250, -263, -263, -260, -589, -589, -590, -295, -255, -590, -256, -590, -261, -590, -265, -590, -563, -565, -9, -579, -590, -68, -286, -84, -73, -590, -590, -589, -590, -590, -589, -590, -288, -590, -461, -462, -590, -80, -85, -590, -590, -590, -590, -590, -233, -590, -411, -590, -580, -590, -240, -241, -584, -583, -243, -584, -291, -292, -559, -349, -10, -10, -590, -351, -590, -372, -383, -590, -590, -368, -369, -590, -378, -380, -590, -385, -487, -492, -590, -520, -590, -529, -590, -531, -533, -540, -549, -553, -10, -336, -337, -338, -10, -590, -590, -590, -590, -10, -406, -589, -590, -590, -589, -288, -315, -104, -105, -590, -589, -590, -318, -480, -590, -590, -590, -324, -518, -328, -576, -577, -580, -425, -440, -443, -444, -446, -427, -442, -428, -429, -430, -590, -433, -435, -436, -590, -458, -7, -14, -116, -24, -270, -590, -289, -290, -590, -590, -58, -247, -248, -395, -590, -60, -398, -590, -56, -396, -590, -590, -569, -570, -569, -570, -590, -590, -191, -298, -590, -363, -580, -365, -10, -50, -391, -51, -392, -52, -393, -10, -245, -590, -251, -253, -10, -10, -294, -263, -262, -266, -590, -561, -562, -590, -12, -68, -590, -76, -82, -590, -569, -570, -589, -573, -287, -590, -590, -589, -78, -590, -200, -210, -211, -590, -589, -589, -281, -590, -285, -582, -244, -590, -590, -350, -361, -371, -589, -589, -362, -555, -495, -554, -589, -589, -543, -589, -590, -288, -526, -590, -590, -538, -590, -589, -339, -589, -307, -340, -341, -342, -310, -590, -313, -590, -590, -590, -569, -570, -573, -287, -590, -590, -104, -107, -573, -590, -10, -590, -482, -590, -10, -10, -518, -590, -491, -496, -555, -555, -501, -503, -503, -503, -517, -520, -545, -590, -590, -590, -10, -432, -434, -438, -268, -590, -590, -590, -30, -196, -31, -197, -59, -32, -198, -61, -199, -57, -192, -590, -590, -590, -290, -289, -235, -343, -590, -580, -590, -590, -246, -263, -590, -590, -257, -267, -564, -74, -289, -290, -86, -297, -589, -358, -10, -412, -589, -413, -414, -283, -242, -354, -355, -590, -381, -590, -384, -367, -590, -375, -590, -377, -386, -287, -530, -532, -536, -590, -541, -590, -356, -590, -590, -10, -10, -312, -314, -590, -289, -96, -590, -289, -590, -481, -321, -590, -590, -580, -484, -490, -590, -499, -500, -590, -510, -590, -513, -590, -515, -590, -329, -557, -445, -448, -449, -450, -451, -590, -269, -28, -194, -29, -195, -590, -590, -590, -590, -364, -590, -389, -53, -252, -403, -405, -8, -10, -418, -359, -590, -590, -416, -589, -589, -589, -589, -534, -590, -539, -590, -304, -590, -305, -590, -590, -590, -10, -316, -319, -10, -325, -327, -590, -497, -555, -502, -503, -503, -503, -503, -546, -503, -544, -518, -447, -236, -580, -345, -347, -348, -366, -417, -10, -476, -590, -590, -278, -415, -382, -590, -373, -376, -379, -590, -537, -10, -308, -311, -266, -589, -10, -590, -483, -498, -590, -506, -590, -508, -590, -511, -590, -514, -516, -10, -344, -590, -411, -589, -590, -590, -288, -589, -535, -589, -407, -408, -409, -590, -322, -503, -503, -503, -503, -590, -346, -410, -590, -569, -570, -573, -287, -374, -357, -317, -590, -504, -507, -509, -512, -330, -289, -503, -505]; clist = ["13,390,5,265,265,265,603,115,115,256,260,554,504,327,720,408,310,544", "209,209,319,12,284,337,297,297,378,209,209,209,316,13,288,288,100,359", "360,458,103,363,863,431,517,440,445,450,777,576,577,455,730,300,12,209", "209,297,297,99,209,209,740,280,209,367,376,836,115,752,756,266,266,266", "110,195,395,595,599,788,613,2,115,417,418,419,420,118,118,587,859,953", "217,500,501,502,558,561,866,103,565,282,13,960,5,962,209,209,209,209", "13,13,421,5,663,629,14,820,364,1,862,639,415,12,918,697,267,267,267", "194,408,12,12,397,399,372,423,406,678,263,276,277,685,498,694,909,694", "14,290,290,690,691,505,686,321,573,392,320,323,324,580,582,370,617,680", "682,684,436,437,697,391,624,312,555,314,361,867,316,316,369,377,362", "868,767,983,772,621,726,942,953,422,1017,381,962,776,115,623,791,13", "209,209,209,209,956,449,959,209,209,209,209,325,566,738,248,499,511", "14,13,209,12,888,890,892,512,14,14,1007,760,840,922,394,265,265,931", "788,401,638,404,12,896,265,433,629,793,794,881,757,946,736,433,703,949", ",588,,209,209,,,,15,714,912,,209,252,259,261,,540,429,434,,,522,,859", "453,457,297,,256,,13,569,260,517,288,13,,556,15,557,545,337,297,697", "508,266,1025,,,977,288,12,531,266,440,445,12,,526,14,280,13,103,694", "694,280,,769,,945,371,,,,,745,1008,,14,740,730,525,12,297,,,,600,601", ",940,584,622,,,1005,,,527,509,267,732,,533,,796,322,15,267,739,209,209", "507,510,,15,15,740,,,,513,297,,663,,708,,996,713,376,988,990,992,994", ",995,,,,708,,209,,14,,,103,290,14,,,,787,,,,,,788,,,618,806,290,,602", "831,809,,283,811,115,,656,14,115,,,660,670,671,,,656,,,,,,316,316,,", "1028,1029,1030,1031,708,851,,,,15,,377,,708,,1018,,,456,449,209,209", "1035,828,,,876,,15,740,879,880,,,687,,,,,,656,656,656,645,,588,,646", "747,,377,458,885,886,430,705,118,844,712,,118,,460,,,316,,,316,,,,,", ",697,,545,,297,,13,,700,723,,,288,545,209,297,449,209,,15,,694,,288", "15,,,12,,,449,,209,,,848,850,,,787,,853,855,,856,841,297,13,13,,15,519", "761,521,734,766,523,524,,,,771,316,,,316,428,939,12,12,,316,,,,13,773", ",,13,828,792,,,13,283,209,,449,209,,,,693,449,209,12,,,209,12,209,,", "1009,12,,,,,,,821,926,,753,753,,965,,14,984,337,,,,290,588,,588,978", ",209,209,,774,725,290,209,,,,986,,209,,,,950,,951,283,,,,,283,,13,654", ",14,14,,659,13,,,377,662,13,13,545,656,297,1016,660,,656,12,,,288,,", "834,12,297,,14,,12,12,14,,288,,,14,,,,,802,804,,894,,,807,,,,,648,457", ",787,,679,681,683,449,,874,,,,971,973,974,975,,,,,,,,,,929,588,433,", ",,209,1012,,,,13,,,,13,13,,,,,,,15,825,,,,,,115,14,12,13,,,12,12,14", "209,209,871,,14,14,,,877,,878,,,,882,12,290,36,695,,322,,698,,,15,15", "1024,,290,,588,,588,,,,,13,,,,934,708,,,,,36,287,287,,,15,,,,15,,12", ",695,15,,322,209,,13,13,,,903,905,,,,,588,,,366,380,,380,,,14,735,12", "12,14,14,733,,,,,,,,,,741,,,,,900,14,753,780,,,,,297,,36,,13,,,456,967", ",36,36,,,,,,,997,,783,15,,,13,12,,13,15,785,,,,15,15,,798,14,,,,,727", "728,,12,,,12,,13,1019,,,,,,,,,,316,,13,,,14,14,13,,749,12,,,751,695", "322,,,759,,13,,829,12,209,830,449,,12,,,,,,,,,36,,,,12,,,208,,,839,", ",,,,,15,,36,14,15,15,,969,,,,,,,,,,,,,,,15,14,,313,14,,,,358,358,460", ",358,780,,,822,,,,,,,823,,,,14,826,827,883,,,737,,,737,,783,,14,,,,15", "14,36,785,,902,287,36,,,358,358,358,358,14,,,,,,,,287,,,,,,,15,15,315", ",36,328,,,784,,,,,,,,,,,,,,396,,398,398,402,405,398,,,,,,380,,,,,,,", ",925,,,780,,927,780,928,780,15,780,,,970,,,901,,,,,,,,,,,955,947,15", "380,783,15,783,,783,,,,,461,462,952,,954,,,,,322,471,,,,,15,218,,,,921", ",,,264,264,264,,15,,,,981,15,,780,307,308,309,,,,,,,,15,,,936,937,264", "264,,,,,,,,783,,,,315,315,780,,780,785,780,,780,,,,,,,,784,,,,,1004", ",,,,,783,,783,,783,,783,,,1013,964,1014,,1015,,780,,,,,,,,,,,,506,,", "982,,,,,,,,,,783,,,,36,,396,,,1034,287,,,,,,999,,,,,287,,,358,358,,", ",1006,,,,,1010,,,,,,,,,,,36,36,,,,,,380,,,737,627,,784,,784,,784,264", "435,264,264,,,,454,459,,36,,,,36,,,,,36,,,218,,473,474,475,476,477,478", "479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495", "496,497,,,,,,,,264,264,,,,,,,784,264,,,,,,,264,,264,,,264,264,,,,,,", ",,,,,,,,36,,784,,784,,784,36,784,,,,36,36,,,,,655,,551,,,,287,,,,655", ",,,,,,,,287,,,,,784,315,315,,,,,,,,,,,,,,,719,,,,,,,,,,,,,,,,,,675,655", "655,655,675,,,,,,,,675,675,,,,36,,,,36,36,,,,,,,,,,,,,315,,,315,36,", ",,,,,,,,358,,775,,,,,,,,,,,,,,264,,,,,,,,,,,,,,,,,,36,,,,,,,,,,,,,,", "264,264,,454,672,435,,,,315,,,315,,36,36,,,315,,,,,,,,,,,,,,,674,,,", ",,,,,,,,,,,,,,264,,264,,264,,,,,,,,,,,36,,,264,966,,264,,,,,,,,,716", "717,718,,,36,,,36,,,,,264,,,264,,358,,,,,,,,,,,,655,36,,,,655,,,,,,", "837,842,36,,,,,36,,,,,,,,,,,264,,36,264,,,,,,264,,837,,837,,,,,,,,,", ",,,,,,,294,294,,,,,,294,294,294,,,,264,,,803,805,,,,,808,294,,810,358", ",672,812,,294,294,,,,,,,,,,,,,,,,,,,,264,264,,,,,,,264,,,264,,,,,920", ",,,924,,,,,,,,,,,,,264,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,264,,,", ",,,,,,,,,,,,,,,,264,,,,,,,,,,,,,,,,,,,264,904,906,,,,,,,,,,,,803,805", "808,,,,,,,,294,,294,294,294,294,294,294,294,294,294,294,294,294,294", "294,294,294,294,294,294,294,294,294,294,294,294,837,,,,,,,,,,,,,,,,", ",315,,,,,294,837,294,,,294,294,,,,,,,,,,294,,,,264,,,,,,,,,,,,294,,906", "904,958,,,,,294,264,,,,,,,,,,,,,,,,,,,,,,,264,,,,,,,,294,,,,,,,,,,,", ",,,,,,,,,,,,,,,,,,,,,,,,,,,294,,,,,,,,,,,,,,,264,,,,,,,,,,,,,,,,,,,", ",,,,,,,,,,,,,,,,294,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,294,294,294,", ",,,,,,,,,,,,,,,,,,,,,,,,,,294,,,,,,,,,,,,,,,,,,294,,294,,294,,,,,,,", ",,,,294,,,,,,,,,,,294,,,294,294,294,,,,,,,,,,,294,,,294,,,,,,,,,,,,294", ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", ",,,,,,294,,,,,,,,,,,,294,,,,294,,,,,,,,,,,,,,,,,,,,,,,294,294,,,,,,", "294,,,294,,,294,,,,,,,,,,,,,294,,,,,,294,,,,,,,,,,,,,,,,,,,,,,,,,,,", ",,,,,,,,,,,294,,,,,,,,,,,,,,,,,,,,294,,,,,,,,,,,,,,,,,,,294,,,,,,,,", ",,,,,294,294,294,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", ",,,,,,,,,,,,,,,,,,,,,,,,,,294,,,,,,,,,,,,,,294,294,294,,,,,,294,,,,", ",,,294,,,,,,,,,,,,,,,294"]; racc_goto_table = arr = Opal.get('Array').$new(2748, nil); idx = 0; ($a = ($d = clist).$each, $a.$$p = (TMP_5 = function(str){var self = TMP_5.$$s || this, $e, $f, TMP_6; if (str == null) str = nil; return ($e = ($f = str.$split(",", -1)).$each, $e.$$p = (TMP_6 = function(i){var self = TMP_6.$$s || this, $g; if (i == null) i = nil; if ((($g = i['$empty?']()) !== nil && $g != null && (!$g.$$is_boolean || $g == true))) { } else { arr['$[]='](idx, i.$to_i()) }; return idx = $rb_plus(idx, 1);}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $e).call($f)}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $a).call($d); clist = ["21,48,7,30,30,30,81,49,49,61,61,8,35,111,10,48,52,44,21,21,22,20,42", "114,53,53,47,21,21,21,30,21,21,21,6,16,16,17,84,16,79,25,65,33,33,33", "85,117,117,25,113,43,20,21,21,53,53,4,21,21,155,39,21,21,21,11,49,80", "80,57,57,57,14,14,135,78,78,151,46,2,49,16,16,16,16,51,51,156,157,159", "19,33,33,33,58,58,11,84,58,40,21,107,7,108,21,21,21,21,21,21,7,7,64", "139,23,105,4,1,158,139,5,20,12,162,59,59,59,15,48,20,20,136,136,18,28", "136,36,38,38,38,36,54,60,55,60,23,23,23,36,36,62,63,59,119,73,74,75", "77,119,119,82,83,64,64,64,22,22,162,86,87,88,89,90,91,92,30,30,23,23", "93,94,95,96,97,98,60,99,159,2,107,100,108,101,49,102,103,21,21,21,21", "21,104,49,106,21,21,21,21,109,110,112,122,123,125,23,21,21,20,152,152", "152,126,23,23,127,128,129,130,134,30,30,158,151,137,138,140,20,141,30", "57,139,142,143,145,81,148,149,57,44,153,,154,,21,21,,,,24,44,105,,21", "34,34,34,,52,19,19,,,135,,157,19,19,53,,61,,21,111,61,65,21,21,,52,24", "52,42,114,53,162,57,57,79,,,158,21,20,43,57,33,33,20,,6,23,39,21,84", "60,60,39,,46,,105,24,,,,,156,11,,23,155,113,4,20,53,,,,16,16,,80,21", "47,,,158,,,40,59,59,121,,40,,139,26,24,59,121,21,21,38,38,,24,24,155", ",,,38,53,,64,,33,,85,33,21,152,152,152,152,,152,,,,33,,21,,23,,,84,23", "23,,,,121,,,,,,151,,,84,35,23,,4,44,35,,9,35,49,,61,23,49,,,61,22,22", ",,61,,,,,,30,30,,,152,152,152,152,33,117,,,,24,,23,,33,,10,,,24,49,21", "21,152,65,,,8,,24,155,8,8,,,52,,,,,,61,61,61,14,,154,,14,154,,23,17", "117,117,26,22,51,58,22,,51,,26,,,30,,,30,,,,,,,162,,42,,53,,21,,7,52", ",,21,42,21,53,49,21,,24,,60,,21,24,,,20,,,49,,21,,,119,119,,,121,,119", "119,,119,25,53,21,21,,24,26,22,26,21,22,26,26,,,,22,30,,,30,9,78,20", "20,,30,,,,21,16,,,21,65,52,,,21,9,21,,49,21,,,,59,49,21,20,,,21,20,21", ",,81,20,,,,,,,111,121,,84,84,,78,,23,8,114,,,,23,154,,154,78,,21,21", ",84,59,23,21,,,,117,,21,,,,121,,121,9,,,,,9,,21,34,,23,23,,34,21,,,23", "34,21,21,42,61,53,8,61,,61,20,,,21,,,42,20,53,,23,,20,20,23,,21,,,23", ",,,,19,19,,48,,,19,,,,,26,19,,121,,34,34,34,49,,16,,,,119,119,119,119", ",,,,,,,,,154,154,57,,,,21,121,,,,21,,,,21,21,,,,,,,24,59,,,,,,49,23", "20,21,,,20,20,23,21,21,57,,23,23,,,84,,84,,,,84,20,23,45,26,,26,,26", ",,24,24,119,,23,,154,,154,,,,,21,,,,16,33,,,,,45,45,45,,,24,,,,24,,20", ",26,24,,26,21,,21,21,,,19,19,,,,,154,,,45,45,,45,,,23,116,20,20,23,23", "120,,,,,,,,,,120,,,,,23,23,84,147,,,,,53,,45,,21,,,24,21,,45,45,,,,", ",,52,,116,24,,,21,20,,21,24,120,,,,24,24,,26,23,,,,,9,9,,20,,,20,,21", "22,,,,,,,,,,30,,21,,,23,23,21,,9,20,,,9,26,26,,,9,,21,,26,20,21,26,49", ",20,,,,,,,,,45,,,,20,,,27,,,26,,,,,,,24,,45,23,24,24,,23,,,,,,,,,,,", ",,,24,23,,27,23,,,,27,27,26,,27,147,,,9,,,,,,,9,,,,23,9,9,26,,,118,", ",118,,116,,23,,,,24,23,45,120,,26,45,45,,,27,27,27,27,23,,,,,,,,45,", ",,,,,24,24,56,,45,56,,,118,,,,,,,,,,,,,,56,,56,56,56,56,56,,,,,,45,", ",,,,,,,120,,,147,,120,147,120,147,24,147,,,24,,,9,,,,,,,,,,,26,116,24", "45,116,24,116,,116,,,,,27,27,120,,120,,,,,26,27,,,,,24,29,,,,9,,,,29", "29,29,,24,,,,26,24,,147,29,29,29,,,,,,,,24,,,9,9,29,29,,,,,,,,116,,", ",56,56,147,,147,120,147,,147,,,,,,,,118,,,,,120,,,,,,116,,116,,116,", "116,,,120,9,120,,120,,147,,,,,,,,,,,,56,,,9,,,,,,,,,,116,,,,45,,56,", ",120,45,,,,,,9,,,,,45,,,27,27,,,,9,,,,,9,,,,,,,,,,,45,45,,,,,,45,,,118", "27,,118,,118,,118,29,29,29,29,,,,29,29,,45,,,,45,,,,,45,,,29,,29,29", "29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29", ",,,,,,,29,29,,,,,,,118,29,,,,,,,29,,29,,,29,29,,,,,,,,,,,,,,,45,,118", ",118,,118,45,118,,,,45,45,,,,,56,,29,,,,45,,,,56,,,,,,,,,45,,,,,118", "56,56,,,,,,,,,,,,,,,27,,,,,,,,,,,,,,,,,,56,56,56,56,56,,,,,,,,56,56", ",,,45,,,,45,45,,,,,,,,,,,,,56,,,56,45,,,,,,,,,,27,,27,,,,,,,,,,,,,,29", ",,,,,,,,,,,,,,,,,45,,,,,,,,,,,,,,,29,29,,29,29,29,,,,56,,,56,,45,45", ",,56,,,,,,,,,,,,,,,29,,,,,,,,,,,,,,,,,,29,,29,,29,,,,,,,,,,,45,,,29", "45,,29,,,,,,,,,29,29,29,,,45,,,45,,,,,29,,,29,,27,,,,,,,,,,,,56,45,", ",,56,,,,,,,56,56,45,,,,,45,,,,,,,,,,,29,,45,29,,,,,,29,,56,,56,,,,,", ",,,,,,,,,,,37,37,,,,,,37,37,37,,,,29,,,29,29,,,,,29,37,,29,27,,29,29", ",37,37,,,,,,,,,,,,,,,,,,,,29,29,,,,,,,29,,,29,,,,,56,,,,56,,,,,,,,,", ",,,29,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,29,,,,,,,,,,,,,,,,,,,,29", ",,,,,,,,,,,,,,,,,,29,29,29,,,,,,,,,,,,29,29,29,,,,,,,,37,,37,37,37,37", "37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,56,,", ",,,,,,,,,,,,,,,56,,,,,37,56,37,,,37,37,,,,,,,,,,37,,,,29,,,,,,,,,,,", "37,,29,29,29,,,,,37,29,,,,,,,,,,,,,,,,,,,,,,,29,,,,,,,,37,,,,,,,,,,", ",,,,,,,,,,,,,,,,,,,,,,,,,,,,37,,,,,,,,,,,,,,,29,,,,,,,,,,,,,,,,,,,,", ",,,,,,,,,,,,,,,37,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,37,37,37,,,,,,", ",,,,,,,,,,,,,,,,,,,,,37,,,,,,,,,,,,,,,,,,37,,37,,37,,,,,,,,,,,,37,,", ",,,,,,,,37,,,37,37,37,,,,,,,,,,,37,,,37,,,,,,,,,,,,37,,,,,,,,,,,,,,", ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,37,,,,,", ",,,,,,37,,,,37,,,,,,,,,,,,,,,,,,,,,,,37,37,,,,,,,37,,,37,,,37,,,,,,", ",,,,,,37,,,,,,37,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,37,,,,,,,,,,", ",,,,,,,,,37,,,,,,,,,,,,,,,,,,,37,,,,,,,,,,,,,,37,37,37,,,,,,,,,,,,,", ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,37,", ",,,,,,,,,,,,37,37,37,,,,,,37,,,,,,,,37,,,,,,,,,,,,,,,37"]; racc_goto_check = arr = Opal.get('Array').$new(2748, nil); idx = 0; ($a = ($e = clist).$each, $a.$$p = (TMP_7 = function(str){var self = TMP_7.$$s || this, $f, $g, TMP_8; if (str == null) str = nil; return ($f = ($g = str.$split(",", -1)).$each, $f.$$p = (TMP_8 = function(i){var self = TMP_8.$$s || this, $h; if (i == null) i = nil; if ((($h = i['$empty?']()) !== nil && $h != null && (!$h.$$is_boolean || $h == true))) { } else { arr['$[]='](idx, i.$to_i()) }; return idx = $rb_plus(idx, 1);}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8), $f).call($g)}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $a).call($e); racc_goto_pointer = [nil, 117, 79, nil, 54, 20, 31, 2, -301, 390, -539, -655, -714, nil, 65, 119, -23, -168, 70, 71, 21, 0, -34, 114, 258, -156, 302, 1002, 24, 1205, -24, nil, nil, -158, 239, -240, -363, 1809, 110, 30, 68, nil, -10, 18, -284, 817, -296, -38, -65, 0, nil, 78, -26, -8, -105, -675, 1073, 42, -223, 97, -374, -15, -103, -354, -338, -225, nil, nil, nil, nil, nil, nil, nil, 88, 100, 100, nil, 100, -284, -709, -533, -358, 97, -217, 35, -577, 102, -222, 118, -142, 119, 113, -578, 118, -576, -430, -758, -434, -195, -692, 125, -430, -196, -429, -693, -561, -707, -809, -807, 151, -116, -44, -369, -521, -34, nil, 312, -285, 510, -177, 321, -219, 190, -35, nil, -44, -37, -758, -380, -495, -613, nil, nil, nil, 156, 0, 55, 155, -167, -282, 156, -556, -390, -390, nil, -535, nil, 287, -639, -329, nil, -546, -567, -638, -99, -519, -263, -658, -630, -800, nil, nil, -395]; racc_goto_default = [nil, nil, nil, 3, nil, 4, 365, 279, nil, 553, nil, 864, nil, 278, nil, nil, nil, 10, 11, 17, 214, 306, nil, 212, 213, nil, 270, 16, nil, 20, 21, 22, 23, 711, nil, nil, nil, 24, nil, 30, nil, 32, 35, 34, nil, 210, 375, nil, 117, 443, 116, 70, 819, 43, nil, nil, 572, 317, nil, 318, 268, 441, nil, nil, 657, 515, 254, 44, 45, 46, 47, 48, 49, 50, nil, 255, 56, nil, nil, nil, nil, nil, nil, nil, 596, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 344, nil, nil, nil, 330, 329, 731, 332, 333, nil, 334, nil, 335, 336, nil, nil, 447, nil, nil, nil, nil, nil, nil, 69, 71, 72, 73, nil, nil, nil, nil, 634, nil, nil, nil, nil, 407, 779, 340, 342, 781, 343, 782, 948, nil, 786, 349, 351, nil, 590, 591, 790, 354, 357, 273]; racc_reduce_table = [0, 0, "racc_error", 1, 141, "_reduce_none", 2, 142, "_reduce_2", 0, 143, "_reduce_3", 1, 143, "_reduce_4", 3, 143, "_reduce_5", 1, 145, "_reduce_none", 4, 145, "_reduce_7", 4, 148, "_reduce_8", 2, 149, "_reduce_9", 0, 153, "_reduce_10", 1, 153, "_reduce_11", 3, 153, "_reduce_12", 0, 168, "_reduce_13", 4, 147, "_reduce_14", 3, 147, "_reduce_15", 3, 147, "_reduce_none", 3, 147, "_reduce_17", 2, 147, "_reduce_18", 3, 147, "_reduce_19", 3, 147, "_reduce_20", 3, 147, "_reduce_21", 3, 147, "_reduce_22", 3, 147, "_reduce_23", 4, 147, "_reduce_none", 1, 147, "_reduce_none", 3, 147, "_reduce_26", 3, 147, "_reduce_27", 6, 147, "_reduce_none", 6, 147, "_reduce_none", 5, 147, "_reduce_30", 5, 147, "_reduce_none", 5, 147, "_reduce_none", 3, 147, "_reduce_none", 3, 147, "_reduce_34", 3, 147, "_reduce_35", 3, 147, "_reduce_36", 1, 147, "_reduce_none", 3, 157, "_reduce_38", 3, 157, "_reduce_39", 1, 167, "_reduce_none", 3, 167, "_reduce_41", 3, 167, "_reduce_42", 2, 167, "_reduce_43", 2, 167, "_reduce_44", 1, 167, "_reduce_none", 1, 156, "_reduce_none", 1, 159, "_reduce_none", 1, 159, "_reduce_none", 1, 171, "_reduce_none", 4, 171, "_reduce_none", 4, 171, "_reduce_none", 4, 171, "_reduce_none", 4, 175, "_reduce_53", 2, 170, "_reduce_54", 3, 170, "_reduce_55", 4, 170, "_reduce_56", 5, 170, "_reduce_57", 4, 170, "_reduce_58", 5, 170, "_reduce_59", 4, 170, "_reduce_60", 5, 170, "_reduce_61", 2, 170, "_reduce_62", 2, 170, "_reduce_63", 2, 170, "_reduce_64", 2, 170, "_reduce_65", 2, 170, "_reduce_66", 1, 158, "_reduce_67", 3, 158, "_reduce_68", 1, 180, "_reduce_69", 3, 180, "_reduce_70", 1, 179, "_reduce_71", 2, 179, "_reduce_72", 3, 179, "_reduce_73", 5, 179, "_reduce_74", 2, 179, "_reduce_75", 4, 179, "_reduce_76", 2, 179, "_reduce_77", 4, 179, "_reduce_78", 1, 179, "_reduce_79", 3, 179, "_reduce_80", 1, 182, "_reduce_81", 3, 182, "_reduce_82", 2, 181, "_reduce_83", 3, 181, "_reduce_84", 1, 184, "_reduce_85", 3, 184, "_reduce_86", 1, 183, "_reduce_87", 4, 183, "_reduce_88", 3, 183, "_reduce_89", 3, 183, "_reduce_none", 3, 183, "_reduce_none", 3, 183, "_reduce_none", 2, 183, "_reduce_none", 1, 183, "_reduce_none", 1, 164, "_reduce_95", 4, 164, "_reduce_96", 4, 164, "_reduce_97", 3, 164, "_reduce_98", 3, 164, "_reduce_99", 3, 164, "_reduce_100", 3, 164, "_reduce_101", 2, 164, "_reduce_102", 1, 164, "_reduce_none", 1, 186, "_reduce_none", 2, 187, "_reduce_105", 1, 187, "_reduce_106", 3, 187, "_reduce_107", 1, 188, "_reduce_none", 1, 188, "_reduce_none", 1, 188, "_reduce_none", 1, 188, "_reduce_111", 1, 188, "_reduce_112", 1, 154, "_reduce_113", 1, 154, "_reduce_none", 1, 155, "_reduce_115", 3, 155, "_reduce_116", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 189, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 1, 190, "_reduce_none", 3, 169, "_reduce_191", 5, 169, "_reduce_192", 3, 169, "_reduce_193", 6, 169, "_reduce_194", 6, 169, "_reduce_195", 5, 169, "_reduce_196", 5, 169, "_reduce_none", 5, 169, "_reduce_none", 5, 169, "_reduce_none", 4, 169, "_reduce_none", 3, 169, "_reduce_none", 3, 169, "_reduce_202", 3, 169, "_reduce_203", 3, 169, "_reduce_204", 3, 169, "_reduce_205", 3, 169, "_reduce_206", 3, 169, "_reduce_207", 3, 169, "_reduce_208", 3, 169, "_reduce_209", 4, 169, "_reduce_210", 4, 169, "_reduce_211", 2, 169, "_reduce_212", 2, 169, "_reduce_213", 3, 169, "_reduce_214", 3, 169, "_reduce_215", 3, 169, "_reduce_216", 3, 169, "_reduce_217", 3, 169, "_reduce_218", 3, 169, "_reduce_219", 3, 169, "_reduce_220", 3, 169, "_reduce_221", 3, 169, "_reduce_222", 3, 169, "_reduce_223", 3, 169, "_reduce_224", 3, 169, "_reduce_225", 3, 169, "_reduce_226", 2, 169, "_reduce_227", 2, 169, "_reduce_228", 3, 169, "_reduce_229", 3, 169, "_reduce_230", 3, 169, "_reduce_231", 3, 169, "_reduce_232", 3, 169, "_reduce_233", 0, 194, "_reduce_234", 0, 195, "_reduce_235", 7, 169, "_reduce_236", 1, 169, "_reduce_none", 1, 166, "_reduce_none", 1, 162, "_reduce_239", 2, 162, "_reduce_240", 2, 162, "_reduce_241", 4, 162, "_reduce_242", 2, 162, "_reduce_243", 3, 162, "_reduce_244", 3, 201, "_reduce_245", 2, 203, "_reduce_none", 1, 204, "_reduce_247", 1, 204, "_reduce_none", 1, 202, "_reduce_249", 1, 202, "_reduce_none", 2, 202, "_reduce_251", 4, 202, "_reduce_252", 2, 202, "_reduce_253", 1, 178, "_reduce_254", 2, 178, "_reduce_255", 2, 178, "_reduce_256", 4, 178, "_reduce_257", 1, 178, "_reduce_258", 0, 206, "_reduce_259", 2, 174, "_reduce_260", 2, 200, "_reduce_261", 2, 205, "_reduce_262", 0, 205, "_reduce_263", 1, 197, "_reduce_264", 2, 197, "_reduce_265", 3, 197, "_reduce_266", 4, 197, "_reduce_267", 3, 165, "_reduce_268", 4, 165, "_reduce_269", 2, 165, "_reduce_270", 1, 193, "_reduce_none", 1, 193, "_reduce_none", 1, 193, "_reduce_none", 1, 193, "_reduce_none", 1, 193, "_reduce_none", 1, 193, "_reduce_none", 1, 193, "_reduce_none", 1, 193, "_reduce_none", 1, 193, "_reduce_none", 0, 228, "_reduce_280", 4, 193, "_reduce_281", 0, 229, "_reduce_282", 5, 193, "_reduce_283", 0, 230, "_reduce_284", 4, 193, "_reduce_285", 3, 193, "_reduce_286", 3, 193, "_reduce_287", 2, 193, "_reduce_288", 4, 193, "_reduce_289", 4, 193, "_reduce_290", 3, 193, "_reduce_291", 3, 193, "_reduce_292", 1, 193, "_reduce_293", 4, 193, "_reduce_294", 3, 193, "_reduce_295", 1, 193, "_reduce_296", 5, 193, "_reduce_297", 4, 193, "_reduce_298", 3, 193, "_reduce_299", 2, 193, "_reduce_300", 1, 193, "_reduce_none", 2, 193, "_reduce_302", 2, 193, "_reduce_303", 6, 193, "_reduce_304", 6, 193, "_reduce_305", 0, 231, "_reduce_306", 0, 232, "_reduce_307", 7, 193, "_reduce_308", 0, 233, "_reduce_309", 0, 234, "_reduce_310", 7, 193, "_reduce_311", 5, 193, "_reduce_312", 4, 193, "_reduce_313", 5, 193, "_reduce_314", 0, 235, "_reduce_315", 0, 236, "_reduce_316", 9, 193, "_reduce_317", 0, 237, "_reduce_318", 6, 193, "_reduce_319", 0, 238, "_reduce_320", 0, 239, "_reduce_321", 8, 193, "_reduce_322", 0, 240, "_reduce_323", 0, 241, "_reduce_324", 6, 193, "_reduce_325", 0, 242, "_reduce_326", 6, 193, "_reduce_327", 0, 243, "_reduce_328", 0, 244, "_reduce_329", 9, 193, "_reduce_330", 1, 193, "_reduce_331", 1, 193, "_reduce_332", 1, 193, "_reduce_333", 1, 193, "_reduce_none", 1, 161, "_reduce_none", 1, 218, "_reduce_none", 1, 218, "_reduce_none", 1, 218, "_reduce_none", 2, 218, "_reduce_none", 1, 220, "_reduce_none", 1, 220, "_reduce_none", 1, 220, "_reduce_none", 1, 245, "_reduce_343", 4, 245, "_reduce_344", 1, 246, "_reduce_345", 3, 246, "_reduce_346", 1, 247, "_reduce_347", 1, 247, "_reduce_none", 2, 217, "_reduce_349", 3, 249, "_reduce_350", 2, 249, "_reduce_351", 1, 249, "_reduce_352", 1, 249, "_reduce_none", 3, 250, "_reduce_354", 3, 250, "_reduce_355", 1, 219, "_reduce_356", 5, 219, "_reduce_357", 1, 151, "_reduce_none", 2, 151, "_reduce_359", 1, 252, "_reduce_360", 3, 252, "_reduce_361", 3, 253, "_reduce_362", 1, 176, "_reduce_none", 3, 176, "_reduce_364", 1, 176, "_reduce_365", 4, 176, "_reduce_366", 4, 254, "_reduce_367", 2, 254, "_reduce_368", 2, 254, "_reduce_369", 1, 254, "_reduce_370", 2, 259, "_reduce_371", 1, 259, "_reduce_372", 6, 251, "_reduce_373", 8, 251, "_reduce_374", 4, 251, "_reduce_375", 6, 251, "_reduce_376", 4, 251, "_reduce_377", 2, 251, "_reduce_378", 6, 251, "_reduce_379", 2, 251, "_reduce_380", 4, 251, "_reduce_381", 6, 251, "_reduce_382", 2, 251, "_reduce_383", 4, 251, "_reduce_384", 2, 251, "_reduce_385", 4, 251, "_reduce_386", 1, 251, "_reduce_387", 0, 263, "_reduce_388", 5, 262, "_reduce_389", 2, 172, "_reduce_390", 4, 172, "_reduce_none", 4, 172, "_reduce_none", 4, 172, "_reduce_none", 2, 216, "_reduce_394", 4, 216, "_reduce_395", 4, 216, "_reduce_396", 3, 216, "_reduce_397", 4, 216, "_reduce_398", 3, 216, "_reduce_399", 2, 216, "_reduce_400", 1, 216, "_reduce_401", 0, 265, "_reduce_402", 5, 215, "_reduce_403", 0, 266, "_reduce_404", 5, 215, "_reduce_405", 0, 268, "_reduce_406", 6, 221, "_reduce_407", 1, 267, "_reduce_408", 1, 267, "_reduce_none", 6, 150, "_reduce_410", 0, 150, "_reduce_411", 1, 269, "_reduce_412", 1, 269, "_reduce_none", 1, 269, "_reduce_none", 2, 270, "_reduce_415", 1, 270, "_reduce_416", 2, 152, "_reduce_417", 1, 152, "_reduce_none", 1, 207, "_reduce_none", 1, 207, "_reduce_none", 1, 207, "_reduce_none", 1, 208, "_reduce_422", 1, 273, "_reduce_none", 2, 273, "_reduce_424", 3, 274, "_reduce_425", 1, 274, "_reduce_426", 3, 209, "_reduce_427", 3, 210, "_reduce_428", 3, 211, "_reduce_429", 3, 211, "_reduce_430", 1, 277, "_reduce_431", 3, 277, "_reduce_432", 1, 278, "_reduce_433", 2, 278, "_reduce_434", 3, 212, "_reduce_435", 3, 212, "_reduce_436", 1, 280, "_reduce_437", 3, 280, "_reduce_438", 1, 275, "_reduce_439", 2, 275, "_reduce_440", 1, 276, "_reduce_441", 2, 276, "_reduce_442", 1, 279, "_reduce_443", 0, 282, "_reduce_444", 3, 279, "_reduce_445", 0, 283, "_reduce_446", 4, 279, "_reduce_447", 1, 281, "_reduce_448", 1, 281, "_reduce_449", 1, 281, "_reduce_450", 1, 281, "_reduce_none", 2, 191, "_reduce_452", 1, 191, "_reduce_453", 1, 284, "_reduce_none", 1, 284, "_reduce_none", 1, 284, "_reduce_none", 1, 284, "_reduce_none", 3, 272, "_reduce_458", 1, 271, "_reduce_459", 1, 271, "_reduce_460", 2, 271, "_reduce_461", 2, 271, "_reduce_462", 2, 271, "_reduce_463", 2, 271, "_reduce_464", 1, 185, "_reduce_465", 1, 185, "_reduce_466", 1, 185, "_reduce_467", 1, 185, "_reduce_468", 1, 185, "_reduce_469", 1, 185, "_reduce_470", 1, 185, "_reduce_471", 1, 185, "_reduce_472", 1, 185, "_reduce_473", 1, 185, "_reduce_474", 1, 185, "_reduce_475", 1, 213, "_reduce_476", 1, 160, "_reduce_477", 1, 163, "_reduce_478", 1, 163, "_reduce_none", 1, 223, "_reduce_480", 3, 223, "_reduce_481", 2, 223, "_reduce_482", 4, 225, "_reduce_483", 2, 225, "_reduce_484", 1, 286, "_reduce_none", 1, 286, "_reduce_none", 2, 256, "_reduce_487", 1, 256, "_reduce_488", 1, 287, "_reduce_489", 2, 288, "_reduce_490", 1, 288, "_reduce_491", 2, 289, "_reduce_492", 1, 289, "_reduce_493", 1, 255, "_reduce_494", 3, 255, "_reduce_495", 1, 290, "_reduce_496", 3, 290, "_reduce_497", 4, 291, "_reduce_498", 2, 291, "_reduce_499", 2, 291, "_reduce_500", 1, 291, "_reduce_501", 2, 292, "_reduce_502", 0, 292, "_reduce_503", 6, 285, "_reduce_504", 8, 285, "_reduce_505", 4, 285, "_reduce_506", 6, 285, "_reduce_507", 4, 285, "_reduce_508", 6, 285, "_reduce_509", 2, 285, "_reduce_510", 4, 285, "_reduce_511", 6, 285, "_reduce_512", 2, 285, "_reduce_513", 4, 285, "_reduce_514", 2, 285, "_reduce_515", 4, 285, "_reduce_516", 1, 285, "_reduce_517", 0, 285, "_reduce_518", 1, 294, "_reduce_none", 1, 294, "_reduce_520", 1, 248, "_reduce_521", 1, 248, "_reduce_522", 1, 248, "_reduce_523", 1, 248, "_reduce_524", 1, 295, "_reduce_525", 3, 295, "_reduce_526", 1, 222, "_reduce_none", 1, 222, "_reduce_none", 1, 297, "_reduce_529", 3, 297, "_reduce_530", 1, 298, "_reduce_531", 3, 298, "_reduce_532", 1, 296, "_reduce_none", 4, 296, "_reduce_534", 6, 296, "_reduce_535", 3, 296, "_reduce_536", 5, 296, "_reduce_537", 2, 296, "_reduce_538", 4, 296, "_reduce_539", 1, 296, "_reduce_540", 3, 296, "_reduce_541", 1, 260, "_reduce_542", 3, 260, "_reduce_543", 3, 299, "_reduce_544", 1, 293, "_reduce_545", 3, 293, "_reduce_546", 1, 300, "_reduce_none", 1, 300, "_reduce_none", 2, 261, "_reduce_549", 1, 261, "_reduce_550", 1, 301, "_reduce_none", 1, 301, "_reduce_none", 2, 258, "_reduce_553", 2, 257, "_reduce_554", 0, 257, "_reduce_555", 1, 226, "_reduce_556", 4, 226, "_reduce_557", 0, 214, "_reduce_558", 2, 214, "_reduce_559", 1, 199, "_reduce_560", 3, 199, "_reduce_561", 3, 302, "_reduce_562", 2, 302, "_reduce_563", 4, 302, "_reduce_564", 2, 302, "_reduce_565", 1, 177, "_reduce_none", 1, 177, "_reduce_none", 1, 177, "_reduce_none", 1, 173, "_reduce_none", 1, 173, "_reduce_none", 1, 173, "_reduce_none", 1, 173, "_reduce_none", 1, 264, "_reduce_none", 1, 264, "_reduce_none", 1, 264, "_reduce_none", 1, 227, "_reduce_none", 1, 227, "_reduce_none", 0, 144, "_reduce_none", 1, 144, "_reduce_none", 0, 192, "_reduce_none", 1, 192, "_reduce_none", 0, 198, "_reduce_none", 1, 198, "_reduce_none", 1, 198, "_reduce_none", 1, 224, "_reduce_none", 1, 224, "_reduce_none", 1, 146, "_reduce_none", 2, 146, "_reduce_none", 0, 196, "_reduce_589"]; racc_reduce_n = 590; racc_shift_n = 1036; racc_token_table = $hash(false, 0, "error", 1, "kCLASS", 2, "kMODULE", 3, "kDEF", 4, "kUNDEF", 5, "kBEGIN", 6, "kRESCUE", 7, "kENSURE", 8, "kEND", 9, "kIF", 10, "kUNLESS", 11, "kTHEN", 12, "kELSIF", 13, "kELSE", 14, "kCASE", 15, "kWHEN", 16, "kWHILE", 17, "kUNTIL", 18, "kFOR", 19, "kBREAK", 20, "kNEXT", 21, "kREDO", 22, "kRETRY", 23, "kIN", 24, "kDO", 25, "kDO_COND", 26, "kDO_BLOCK", 27, "kDO_LAMBDA", 28, "kRETURN", 29, "kYIELD", 30, "kSUPER", 31, "kSELF", 32, "kNIL", 33, "kTRUE", 34, "kFALSE", 35, "kAND", 36, "kOR", 37, "kNOT", 38, "kIF_MOD", 39, "kUNLESS_MOD", 40, "kWHILE_MOD", 41, "kUNTIL_MOD", 42, "kRESCUE_MOD", 43, "kALIAS", 44, "kDEFINED", 45, "klBEGIN", 46, "klEND", 47, "k__LINE__", 48, "k__FILE__", 49, "tIDENTIFIER", 50, "tFID", 51, "tGVAR", 52, "tIVAR", 53, "tCONSTANT", 54, "tLABEL", 55, "tCVAR", 56, "tNTH_REF", 57, "tBACK_REF", 58, "tSTRING_CONTENT", 59, "tINTEGER", 60, "tFLOAT", 61, "tREGEXP_END", 62, "tUPLUS", 63, "tUMINUS", 64, "tPOW", 65, "tCMP", 66, "tEQ", 67, "tEQQ", 68, "tNEQ", 69, "tGEQ", 70, "tLEQ", 71, "tANDOP", 72, "tOROP", 73, "tMATCH", 74, "tNMATCH", 75, "tJSDOT", 76, "tDOT", 77, "tDOT2", 78, "tDOT3", 79, "tAREF", 80, "tASET", 81, "tLSHFT", 82, "tRSHFT", 83, "tCOLON2", 84, "tCOLON3", 85, "tOP_ASGN", 86, "tASSOC", 87, "tLPAREN", 88, "tLPAREN2", 89, "tRPAREN", 90, "tLPAREN_ARG", 91, "tRBRACK", 92, "tLBRACE", 93, "tLBRACE_ARG", 94, "tSTAR", 95, "tSTAR2", 96, "tAMPER", 97, "tAMPER2", 98, "tTILDE", 99, "tPERCENT", 100, "tDIVIDE", 101, "tPLUS", 102, "tMINUS", 103, "tLT", 104, "tGT", 105, "tPIPE", 106, "tBANG", 107, "tCARET", 108, "tLCURLY", 109, "tRCURLY", 110, "tBACK_REF2", 111, "tSYMBEG", 112, "tSTRING_BEG", 113, "tXSTRING_BEG", 114, "tREGEXP_BEG", 115, "tWORDS_BEG", 116, "tAWORDS_BEG", 117, "tSTRING_DBEG", 118, "tSTRING_DVAR", 119, "tSTRING_END", 120, "tSTRING", 121, "tSYMBOL", 122, "tNL", 123, "tEH", 124, "tCOLON", 125, "tCOMMA", 126, "tSPACE", 127, "tSEMI", 128, "tLAMBDA", 129, "tLAMBEG", 130, "tLBRACK2", 131, "tLBRACK", 132, "tJSLBRACK", 133, "tDSTAR", 134, "tLABEL_END", 135, "tEQL", 136, "tLOWEST", 137, "-@NUM", 138, "+@NUM", 139); racc_nt_base = 140; racc_use_result_var = true; Opal.cdecl($scope, 'Racc_arg', [racc_action_table, racc_action_check, racc_action_default, racc_action_pointer, racc_goto_table, racc_goto_check, racc_goto_default, racc_goto_pointer, racc_nt_base, racc_reduce_table, racc_token_table, racc_shift_n, racc_reduce_n, racc_use_result_var]); Opal.cdecl($scope, 'Racc_token_to_s_table', ["$end", "error", "kCLASS", "kMODULE", "kDEF", "kUNDEF", "kBEGIN", "kRESCUE", "kENSURE", "kEND", "kIF", "kUNLESS", "kTHEN", "kELSIF", "kELSE", "kCASE", "kWHEN", "kWHILE", "kUNTIL", "kFOR", "kBREAK", "kNEXT", "kREDO", "kRETRY", "kIN", "kDO", "kDO_COND", "kDO_BLOCK", "kDO_LAMBDA", "kRETURN", "kYIELD", "kSUPER", "kSELF", "kNIL", "kTRUE", "kFALSE", "kAND", "kOR", "kNOT", "kIF_MOD", "kUNLESS_MOD", "kWHILE_MOD", "kUNTIL_MOD", "kRESCUE_MOD", "kALIAS", "kDEFINED", "klBEGIN", "klEND", "k__LINE__", "k__FILE__", "tIDENTIFIER", "tFID", "tGVAR", "tIVAR", "tCONSTANT", "tLABEL", "tCVAR", "tNTH_REF", "tBACK_REF", "tSTRING_CONTENT", "tINTEGER", "tFLOAT", "tREGEXP_END", "tUPLUS", "tUMINUS", "tPOW", "tCMP", "tEQ", "tEQQ", "tNEQ", "tGEQ", "tLEQ", "tANDOP", "tOROP", "tMATCH", "tNMATCH", "tJSDOT", "tDOT", "tDOT2", "tDOT3", "tAREF", "tASET", "tLSHFT", "tRSHFT", "tCOLON2", "tCOLON3", "tOP_ASGN", "tASSOC", "tLPAREN", "tLPAREN2", "tRPAREN", "tLPAREN_ARG", "tRBRACK", "tLBRACE", "tLBRACE_ARG", "tSTAR", "tSTAR2", "tAMPER", "tAMPER2", "tTILDE", "tPERCENT", "tDIVIDE", "tPLUS", "tMINUS", "tLT", "tGT", "tPIPE", "tBANG", "tCARET", "tLCURLY", "tRCURLY", "tBACK_REF2", "tSYMBEG", "tSTRING_BEG", "tXSTRING_BEG", "tREGEXP_BEG", "tWORDS_BEG", "tAWORDS_BEG", "tSTRING_DBEG", "tSTRING_DVAR", "tSTRING_END", "tSTRING", "tSYMBOL", "tNL", "tEH", "tCOLON", "tCOMMA", "tSPACE", "tSEMI", "tLAMBDA", "tLAMBEG", "tLBRACK2", "tLBRACK", "tJSLBRACK", "tDSTAR", "tLABEL_END", "tEQL", "tLOWEST", "\"-@NUM\"", "\"+@NUM\"", "$start", "program", "top_compstmt", "top_stmts", "opt_terms", "top_stmt", "terms", "stmt", "bodystmt", "compstmt", "opt_rescue", "opt_else", "opt_ensure", "stmts", "fitem", "undef_list", "expr_value", "command_asgn", "mlhs", "command_call", "var_lhs", "primary_value", "aref_args", "backref", "lhs", "mrhs", "arg_value", "expr", "@1", "arg", "command", "block_command", "block_call", "operation2", "command_args", "cmd_brace_block", "opt_block_var", "operation", "call_args", "mlhs_basic", "mlhs_entry", "mlhs_head", "mlhs_item", "mlhs_node", "mlhs_post", "variable", "cname", "cpath", "fname", "op", "reswords", "symbol", "opt_nl", "primary", "@2", "@3", "none", "args", "trailer", "assocs", "block_arg", "paren_args", "opt_call_args", "rparen", "opt_paren_args", "opt_block_arg", "@4", "literal", "strings", "xstring", "regexp", "words", "awords", "var_ref", "assoc_list", "brace_block", "method_call", "lambda", "then", "if_tail", "do", "case_body", "for_var", "superclass", "term", "f_arglist", "singleton", "dot_or_colon", "@5", "@6", "@7", "@8", "@9", "@10", "@11", "@12", "@13", "@14", "@15", "@16", "@17", "@18", "@19", "@20", "@21", "opt_bv_decl", "bv_decls", "bvar", "f_bad_arg", "f_larglist", "lambda_body", "block_param", "f_block_optarg", "f_block_opt", "block_args_tail", "f_block_kwarg", "f_kwrest", "opt_f_block_arg", "f_block_arg", "opt_block_args_tail", "f_arg", "f_rest_arg", "do_block", "@22", "operation3", "@23", "@24", "cases", "@25", "exc_list", "exc_var", "numeric", "dsym", "string", "string1", "string_contents", "xstring_contents", "word_list", "word", "string_content", "qword_list", "string_dvar", "@26", "@27", "sym", "f_args", "kwrest_mark", "f_label", "f_kw", "f_block_kw", "f_kwarg", "args_tail", "opt_args_tail", "f_optarg", "f_norm_arg", "f_arg_item", "f_margs", "f_marg", "f_marg_list", "f_opt", "restarg_mark", "blkarg_mark", "assoc"]); Opal.cdecl($scope, 'Racc_debug_parser', false); Opal.defn(self, '$_reduce_2', TMP_9 = function $$_reduce_2(val, _values, result) { var self = this; result = self.$new_compstmt(val['$[]'](0)); return result; }, TMP_9.$$arity = 3); Opal.defn(self, '$_reduce_3', TMP_10 = function $$_reduce_3(val, _values, result) { var self = this; result = self.$new_block(); return result; }, TMP_10.$$arity = 3); Opal.defn(self, '$_reduce_4', TMP_11 = function $$_reduce_4(val, _values, result) { var self = this; result = self.$new_block(val['$[]'](0)); return result; }, TMP_11.$$arity = 3); Opal.defn(self, '$_reduce_5', TMP_12 = function $$_reduce_5(val, _values, result) { var self = this; val['$[]'](0)['$<<'](val['$[]'](2)); result = val['$[]'](0); return result; }, TMP_12.$$arity = 3); Opal.defn(self, '$_reduce_7', TMP_13 = function $$_reduce_7(val, _values, result) { var self = this; result = val['$[]'](2); return result; }, TMP_13.$$arity = 3); Opal.defn(self, '$_reduce_8', TMP_14 = function $$_reduce_8(val, _values, result) { var self = this; result = self.$new_body(val['$[]'](0), val['$[]'](1), val['$[]'](2), val['$[]'](3)); return result; }, TMP_14.$$arity = 3); Opal.defn(self, '$_reduce_9', TMP_15 = function $$_reduce_9(val, _values, result) { var self = this; result = self.$new_compstmt(val['$[]'](0)); return result; }, TMP_15.$$arity = 3); Opal.defn(self, '$_reduce_10', TMP_16 = function $$_reduce_10(val, _values, result) { var self = this; result = self.$new_block(); return result; }, TMP_16.$$arity = 3); Opal.defn(self, '$_reduce_11', TMP_17 = function $$_reduce_11(val, _values, result) { var self = this; result = self.$new_block(val['$[]'](0)); return result; }, TMP_17.$$arity = 3); Opal.defn(self, '$_reduce_12', TMP_18 = function $$_reduce_12(val, _values, result) { var self = this; val['$[]'](0)['$<<'](val['$[]'](2)); result = val['$[]'](0); return result; }, TMP_18.$$arity = 3); Opal.defn(self, '$_reduce_13', TMP_19 = function $$_reduce_13(val, _values, result) { var $a, $b, self = this; (($a = ["expr_fname"]), $b = self.$lexer(), $b['$lex_state='].apply($b, $a), $a[$a.length-1]); return result; }, TMP_19.$$arity = 3); Opal.defn(self, '$_reduce_14', TMP_20 = function $$_reduce_14(val, _values, result) { var self = this; result = self.$new_alias(val['$[]'](0), val['$[]'](1), val['$[]'](3)); return result; }, TMP_20.$$arity = 3); Opal.defn(self, '$_reduce_15', TMP_21 = function $$_reduce_15(val, _values, result) { var self = this; result = self.$s("valias", self.$value(val['$[]'](1)).$to_sym(), self.$value(val['$[]'](2)).$to_sym()); return result; }, TMP_21.$$arity = 3); Opal.defn(self, '$_reduce_17', TMP_22 = function $$_reduce_17(val, _values, result) { var self = this; result = self.$s("valias", self.$value(val['$[]'](1)).$to_sym(), self.$value(val['$[]'](2)).$to_sym()); return result; }, TMP_22.$$arity = 3); Opal.defn(self, '$_reduce_18', TMP_23 = function $$_reduce_18(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_23.$$arity = 3); Opal.defn(self, '$_reduce_19', TMP_24 = function $$_reduce_19(val, _values, result) { var self = this; result = self.$new_if(val['$[]'](1), val['$[]'](2), val['$[]'](0), nil); return result; }, TMP_24.$$arity = 3); Opal.defn(self, '$_reduce_20', TMP_25 = function $$_reduce_20(val, _values, result) { var self = this; result = self.$new_if(val['$[]'](1), val['$[]'](2), nil, val['$[]'](0)); return result; }, TMP_25.$$arity = 3); Opal.defn(self, '$_reduce_21', TMP_26 = function $$_reduce_21(val, _values, result) { var self = this; result = self.$new_while(val['$[]'](1), val['$[]'](2), val['$[]'](0)); return result; }, TMP_26.$$arity = 3); Opal.defn(self, '$_reduce_22', TMP_27 = function $$_reduce_22(val, _values, result) { var self = this; result = self.$new_until(val['$[]'](1), val['$[]'](2), val['$[]'](0)); return result; }, TMP_27.$$arity = 3); Opal.defn(self, '$_reduce_23', TMP_28 = function $$_reduce_23(val, _values, result) { var self = this; result = self.$new_rescue_mod(val['$[]'](1), val['$[]'](0), val['$[]'](2)); return result; }, TMP_28.$$arity = 3); Opal.defn(self, '$_reduce_26', TMP_29 = function $$_reduce_26(val, _values, result) { var self = this; result = self.$s("masgn", val['$[]'](0), self.$s("to_ary", val['$[]'](2))); return result; }, TMP_29.$$arity = 3); Opal.defn(self, '$_reduce_27', TMP_30 = function $$_reduce_27(val, _values, result) { var self = this; result = self.$new_op_asgn(val['$[]'](1), val['$[]'](0), val['$[]'](2)); return result; }, TMP_30.$$arity = 3); Opal.defn(self, '$_reduce_30', TMP_31 = function $$_reduce_30(val, _values, result) { var self = this; result = self.$s("op_asgn2", val['$[]'](0), self.$op_to_setter(val['$[]'](2)), self.$value(val['$[]'](3)).$to_sym(), val['$[]'](4)); return result; }, TMP_31.$$arity = 3); Opal.defn(self, '$_reduce_34', TMP_32 = function $$_reduce_34(val, _values, result) { var self = this; result = self.$new_assign(val['$[]'](0), val['$[]'](1), self.$s("svalue", val['$[]'](2))); return result; }, TMP_32.$$arity = 3); Opal.defn(self, '$_reduce_35', TMP_33 = function $$_reduce_35(val, _values, result) { var self = this; result = self.$s("masgn", val['$[]'](0), self.$s("to_ary", val['$[]'](2))); return result; }, TMP_33.$$arity = 3); Opal.defn(self, '$_reduce_36', TMP_34 = function $$_reduce_36(val, _values, result) { var self = this; result = self.$s("masgn", val['$[]'](0), val['$[]'](2)); return result; }, TMP_34.$$arity = 3); Opal.defn(self, '$_reduce_38', TMP_35 = function $$_reduce_38(val, _values, result) { var self = this; result = self.$new_assign(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_35.$$arity = 3); Opal.defn(self, '$_reduce_39', TMP_36 = function $$_reduce_39(val, _values, result) { var self = this; result = self.$new_assign(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_36.$$arity = 3); Opal.defn(self, '$_reduce_41', TMP_37 = function $$_reduce_41(val, _values, result) { var self = this; result = self.$s("and", val['$[]'](0), val['$[]'](2)); return result; }, TMP_37.$$arity = 3); Opal.defn(self, '$_reduce_42', TMP_38 = function $$_reduce_42(val, _values, result) { var self = this; result = self.$s("or", val['$[]'](0), val['$[]'](2)); return result; }, TMP_38.$$arity = 3); Opal.defn(self, '$_reduce_43', TMP_39 = function $$_reduce_43(val, _values, result) { var self = this; result = self.$new_unary_call(["!", []], val['$[]'](1)); return result; }, TMP_39.$$arity = 3); Opal.defn(self, '$_reduce_44', TMP_40 = function $$_reduce_44(val, _values, result) { var self = this; result = self.$new_unary_call(val['$[]'](0), val['$[]'](1)); return result; }, TMP_40.$$arity = 3); Opal.defn(self, '$_reduce_53', TMP_41 = function $$_reduce_53(val, _values, result) { var self = this; result = self.$new_iter(val['$[]'](1), val['$[]'](2)); return result; }, TMP_41.$$arity = 3); Opal.defn(self, '$_reduce_54', TMP_42 = function $$_reduce_54(val, _values, result) { var self = this; result = self.$new_call(nil, val['$[]'](0), val['$[]'](1)); return result; }, TMP_42.$$arity = 3); Opal.defn(self, '$_reduce_55', TMP_43 = function $$_reduce_55(val, _values, result) { var self = this; result = self.$new_call(nil, val['$[]'](0), val['$[]'](1))['$<<'](val['$[]'](2)); return result; }, TMP_43.$$arity = 3); Opal.defn(self, '$_reduce_56', TMP_44 = function $$_reduce_56(val, _values, result) { var self = this; result = self.$new_js_call(val['$[]'](0), val['$[]'](2), val['$[]'](3)); return result; }, TMP_44.$$arity = 3); Opal.defn(self, '$_reduce_57', TMP_45 = function $$_reduce_57(val, _values, result) { var self = this; result = self.$new_js_call(val['$[]'](0), val['$[]'](2), val['$[]'](3))['$<<'](val['$[]'](4)); return result; }, TMP_45.$$arity = 3); Opal.defn(self, '$_reduce_58', TMP_46 = function $$_reduce_58(val, _values, result) { var self = this; result = self.$new_call(val['$[]'](0), val['$[]'](2), val['$[]'](3)); return result; }, TMP_46.$$arity = 3); Opal.defn(self, '$_reduce_59', TMP_47 = function $$_reduce_59(val, _values, result) { var self = this; result = self.$new_call(val['$[]'](0), val['$[]'](2), val['$[]'](3))['$<<'](val['$[]'](4)); return result; }, TMP_47.$$arity = 3); Opal.defn(self, '$_reduce_60', TMP_48 = function $$_reduce_60(val, _values, result) { var self = this; result = self.$new_call(val['$[]'](0), val['$[]'](2), val['$[]'](3)); return result; }, TMP_48.$$arity = 3); Opal.defn(self, '$_reduce_61', TMP_49 = function $$_reduce_61(val, _values, result) { var self = this; result = self.$new_call(val['$[]'](0), val['$[]'](2), val['$[]'](3))['$<<'](val['$[]'](4)); return result; }, TMP_49.$$arity = 3); Opal.defn(self, '$_reduce_62', TMP_50 = function $$_reduce_62(val, _values, result) { var self = this; result = self.$new_super(val['$[]'](0), val['$[]'](1)); return result; }, TMP_50.$$arity = 3); Opal.defn(self, '$_reduce_63', TMP_51 = function $$_reduce_63(val, _values, result) { var self = this; result = self.$new_yield(val['$[]'](1)); return result; }, TMP_51.$$arity = 3); Opal.defn(self, '$_reduce_64', TMP_52 = function $$_reduce_64(val, _values, result) { var self = this; result = self.$new_return(val['$[]'](0), val['$[]'](1)); return result; }, TMP_52.$$arity = 3); Opal.defn(self, '$_reduce_65', TMP_53 = function $$_reduce_65(val, _values, result) { var self = this; result = self.$new_break(val['$[]'](0), val['$[]'](1)); return result; }, TMP_53.$$arity = 3); Opal.defn(self, '$_reduce_66', TMP_54 = function $$_reduce_66(val, _values, result) { var self = this; result = self.$new_next(val['$[]'](0), val['$[]'](1)); return result; }, TMP_54.$$arity = 3); Opal.defn(self, '$_reduce_67', TMP_55 = function $$_reduce_67(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_55.$$arity = 3); Opal.defn(self, '$_reduce_68', TMP_56 = function $$_reduce_68(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_56.$$arity = 3); Opal.defn(self, '$_reduce_69', TMP_57 = function $$_reduce_69(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_57.$$arity = 3); Opal.defn(self, '$_reduce_70', TMP_58 = function $$_reduce_70(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_58.$$arity = 3); Opal.defn(self, '$_reduce_71', TMP_59 = function $$_reduce_71(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_59.$$arity = 3); Opal.defn(self, '$_reduce_72', TMP_60 = function $$_reduce_72(val, _values, result) { var self = this; result = val['$[]'](0)['$<<'](val['$[]'](1)); return result; }, TMP_60.$$arity = 3); Opal.defn(self, '$_reduce_73', TMP_61 = function $$_reduce_73(val, _values, result) { var self = this; result = val['$[]'](0)['$<<'](self.$s("splat", val['$[]'](2))); return result; }, TMP_61.$$arity = 3); Opal.defn(self, '$_reduce_74', TMP_62 = function $$_reduce_74(val, _values, result) { var self = this; result = (val['$[]'](0)['$<<'](self.$s("splat", val['$[]'](2)))).$concat(val['$[]'](4).$children()); return result; }, TMP_62.$$arity = 3); Opal.defn(self, '$_reduce_75', TMP_63 = function $$_reduce_75(val, _values, result) { var self = this; result = val['$[]'](0)['$<<'](self.$s("splat")); return result; }, TMP_63.$$arity = 3); Opal.defn(self, '$_reduce_76', TMP_64 = function $$_reduce_76(val, _values, result) { var self = this; result = (val['$[]'](0)['$<<'](self.$s("splat"))).$concat(val['$[]'](3).$children()); return result; }, TMP_64.$$arity = 3); Opal.defn(self, '$_reduce_77', TMP_65 = function $$_reduce_77(val, _values, result) { var self = this; result = self.$s("array", self.$s("splat", val['$[]'](1))); return result; }, TMP_65.$$arity = 3); Opal.defn(self, '$_reduce_78', TMP_66 = function $$_reduce_78(val, _values, result) { var self = this; result = self.$s("array", self.$s("splat", val['$[]'](1))).$concat(val['$[]'](3).$children()); return result; }, TMP_66.$$arity = 3); Opal.defn(self, '$_reduce_79', TMP_67 = function $$_reduce_79(val, _values, result) { var self = this; result = self.$s("array", self.$s("splat")); return result; }, TMP_67.$$arity = 3); Opal.defn(self, '$_reduce_80', TMP_68 = function $$_reduce_80(val, _values, result) { var self = this; result = self.$s("array", self.$s("splat")).$concat(val['$[]'](2).$children()); return result; }, TMP_68.$$arity = 3); Opal.defn(self, '$_reduce_81', TMP_69 = function $$_reduce_81(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_69.$$arity = 3); Opal.defn(self, '$_reduce_82', TMP_70 = function $$_reduce_82(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_70.$$arity = 3); Opal.defn(self, '$_reduce_83', TMP_71 = function $$_reduce_83(val, _values, result) { var self = this; result = self.$s("array", val['$[]'](0)); return result; }, TMP_71.$$arity = 3); Opal.defn(self, '$_reduce_84', TMP_72 = function $$_reduce_84(val, _values, result) { var self = this; result = val['$[]'](0)['$<<'](val['$[]'](1)); return result; }, TMP_72.$$arity = 3); Opal.defn(self, '$_reduce_85', TMP_73 = function $$_reduce_85(val, _values, result) { var self = this; result = self.$s("array", val['$[]'](0)); return result; }, TMP_73.$$arity = 3); Opal.defn(self, '$_reduce_86', TMP_74 = function $$_reduce_86(val, _values, result) { var self = this; result = val['$[]'](0)['$<<'](val['$[]'](2)); return result; }, TMP_74.$$arity = 3); Opal.defn(self, '$_reduce_87', TMP_75 = function $$_reduce_87(val, _values, result) { var self = this; result = self.$new_assignable(val['$[]'](0)); return result; }, TMP_75.$$arity = 3); Opal.defn(self, '$_reduce_88', TMP_76 = function $$_reduce_88(val, _values, result) { var $a, self = this, args = nil; args = (function() {if ((($a = val['$[]'](2)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return val['$[]'](2) } else { return [] }; return nil; })(); result = self.$s("attrasgn", val['$[]'](0), "[]=", ($a = self).$s.apply($a, ["arglist"].concat(Opal.to_a(args)))); return result; }, TMP_76.$$arity = 3); Opal.defn(self, '$_reduce_89', TMP_77 = function $$_reduce_89(val, _values, result) { var self = this; result = self.$new_call(val['$[]'](0), val['$[]'](2), []); return result; }, TMP_77.$$arity = 3); Opal.defn(self, '$_reduce_95', TMP_78 = function $$_reduce_95(val, _values, result) { var self = this; result = self.$new_assignable(val['$[]'](0)); return result; }, TMP_78.$$arity = 3); Opal.defn(self, '$_reduce_96', TMP_79 = function $$_reduce_96(val, _values, result) { var self = this; result = self.$new_js_attrasgn(val['$[]'](0), val['$[]'](2)); return result; }, TMP_79.$$arity = 3); Opal.defn(self, '$_reduce_97', TMP_80 = function $$_reduce_97(val, _values, result) { var self = this; result = self.$new_attrasgn(val['$[]'](0), "[]=", val['$[]'](2)); return result; }, TMP_80.$$arity = 3); Opal.defn(self, '$_reduce_98', TMP_81 = function $$_reduce_98(val, _values, result) { var self = this; result = self.$new_attrasgn(val['$[]'](0), self.$op_to_setter(val['$[]'](2))); return result; }, TMP_81.$$arity = 3); Opal.defn(self, '$_reduce_99', TMP_82 = function $$_reduce_99(val, _values, result) { var self = this; result = self.$new_attrasgn(val['$[]'](0), self.$op_to_setter(val['$[]'](2))); return result; }, TMP_82.$$arity = 3); Opal.defn(self, '$_reduce_100', TMP_83 = function $$_reduce_100(val, _values, result) { var self = this; result = self.$new_attrasgn(val['$[]'](0), self.$op_to_setter(val['$[]'](2))); return result; }, TMP_83.$$arity = 3); Opal.defn(self, '$_reduce_101', TMP_84 = function $$_reduce_101(val, _values, result) { var self = this; result = self.$new_colon2(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_84.$$arity = 3); Opal.defn(self, '$_reduce_102', TMP_85 = function $$_reduce_102(val, _values, result) { var self = this; result = self.$new_colon3(val['$[]'](0), val['$[]'](1)); return result; }, TMP_85.$$arity = 3); Opal.defn(self, '$_reduce_105', TMP_86 = function $$_reduce_105(val, _values, result) { var self = this; result = self.$new_colon3(val['$[]'](0), val['$[]'](1)); return result; }, TMP_86.$$arity = 3); Opal.defn(self, '$_reduce_106', TMP_87 = function $$_reduce_106(val, _values, result) { var self = this; result = self.$new_const(val['$[]'](0)); return result; }, TMP_87.$$arity = 3); Opal.defn(self, '$_reduce_107', TMP_88 = function $$_reduce_107(val, _values, result) { var self = this; result = self.$new_colon2(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_88.$$arity = 3); Opal.defn(self, '$_reduce_111', TMP_89 = function $$_reduce_111(val, _values, result) { var $a, $b, self = this; (($a = ["expr_end"]), $b = self.$lexer(), $b['$lex_state='].apply($b, $a), $a[$a.length-1]); result = val['$[]'](0); return result; }, TMP_89.$$arity = 3); Opal.defn(self, '$_reduce_112', TMP_90 = function $$_reduce_112(val, _values, result) { var $a, $b, self = this; (($a = ["expr_end"]), $b = self.$lexer(), $b['$lex_state='].apply($b, $a), $a[$a.length-1]); result = val['$[]'](0); return result; }, TMP_90.$$arity = 3); Opal.defn(self, '$_reduce_113', TMP_91 = function $$_reduce_113(val, _values, result) { var self = this; result = self.$new_sym(val['$[]'](0)); return result; }, TMP_91.$$arity = 3); Opal.defn(self, '$_reduce_115', TMP_92 = function $$_reduce_115(val, _values, result) { var self = this; result = self.$s("undef", val['$[]'](0)); return result; }, TMP_92.$$arity = 3); Opal.defn(self, '$_reduce_116', TMP_93 = function $$_reduce_116(val, _values, result) { var self = this; result = val['$[]'](0)['$<<'](val['$[]'](2)); return result; }, TMP_93.$$arity = 3); Opal.defn(self, '$_reduce_191', TMP_94 = function $$_reduce_191(val, _values, result) { var self = this; result = self.$new_assign(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_94.$$arity = 3); Opal.defn(self, '$_reduce_192', TMP_95 = function $$_reduce_192(val, _values, result) { var self = this; result = self.$new_assign(val['$[]'](0), val['$[]'](1), self.$s("rescue_mod", val['$[]'](2), val['$[]'](4))); return result; }, TMP_95.$$arity = 3); Opal.defn(self, '$_reduce_193', TMP_96 = function $$_reduce_193(val, _values, result) { var self = this; result = self.$new_op_asgn(val['$[]'](1), val['$[]'](0), val['$[]'](2)); return result; }, TMP_96.$$arity = 3); Opal.defn(self, '$_reduce_194', TMP_97 = function $$_reduce_194(val, _values, result) { var self = this; result = self.$new_op_asgn1(val['$[]'](0), val['$[]'](2), val['$[]'](4), val['$[]'](5)); return result; }, TMP_97.$$arity = 3); Opal.defn(self, '$_reduce_195', TMP_98 = function $$_reduce_195(val, _values, result) { var self = this; self.$raise(".JS[...] " + (val['$[]'](4)) + " is not supported"); return result; }, TMP_98.$$arity = 3); Opal.defn(self, '$_reduce_196', TMP_99 = function $$_reduce_196(val, _values, result) { var self = this; result = self.$s("op_asgn2", val['$[]'](0), self.$op_to_setter(val['$[]'](2)), self.$value(val['$[]'](3)).$to_sym(), val['$[]'](4)); return result; }, TMP_99.$$arity = 3); Opal.defn(self, '$_reduce_202', TMP_100 = function $$_reduce_202(val, _values, result) { var self = this; result = self.$new_irange(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_100.$$arity = 3); Opal.defn(self, '$_reduce_203', TMP_101 = function $$_reduce_203(val, _values, result) { var self = this; result = self.$new_erange(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_101.$$arity = 3); Opal.defn(self, '$_reduce_204', TMP_102 = function $$_reduce_204(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_102.$$arity = 3); Opal.defn(self, '$_reduce_205', TMP_103 = function $$_reduce_205(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_103.$$arity = 3); Opal.defn(self, '$_reduce_206', TMP_104 = function $$_reduce_206(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_104.$$arity = 3); Opal.defn(self, '$_reduce_207', TMP_105 = function $$_reduce_207(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_105.$$arity = 3); Opal.defn(self, '$_reduce_208', TMP_106 = function $$_reduce_208(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_106.$$arity = 3); Opal.defn(self, '$_reduce_209', TMP_107 = function $$_reduce_209(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_107.$$arity = 3); Opal.defn(self, '$_reduce_210', TMP_108 = function $$_reduce_210(val, _values, result) { var self = this; result = self.$new_call(self.$new_binary_call(self.$new_int(val['$[]'](1)), val['$[]'](2), val['$[]'](3)), ["-@", []], []); return result; }, TMP_108.$$arity = 3); Opal.defn(self, '$_reduce_211', TMP_109 = function $$_reduce_211(val, _values, result) { var self = this; result = self.$new_call(self.$new_binary_call(self.$new_float(val['$[]'](1)), val['$[]'](2), val['$[]'](3)), ["-@", []], []); return result; }, TMP_109.$$arity = 3); Opal.defn(self, '$_reduce_212', TMP_110 = function $$_reduce_212(val, _values, result) { var $a, self = this; result = self.$new_call(val['$[]'](1), ["+@", []], []); if ((($a = ["int", "float"]['$include?'](val['$[]'](1).$type())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = val['$[]'](1)}; return result; }, TMP_110.$$arity = 3); Opal.defn(self, '$_reduce_213', TMP_111 = function $$_reduce_213(val, _values, result) { var self = this; result = self.$new_call(val['$[]'](1), ["-@", []], []); if (val['$[]'](1).$type()['$==']("int")) { val['$[]'](1)['$[]='](1, val['$[]'](1)['$[]'](1)['$-@']()); result = val['$[]'](1); } else if (val['$[]'](1).$type()['$==']("float")) { val['$[]'](1)['$[]='](1, val['$[]'](1)['$[]'](1).$to_f()['$-@']()); result = val['$[]'](1);}; return result; }, TMP_111.$$arity = 3); Opal.defn(self, '$_reduce_214', TMP_112 = function $$_reduce_214(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_112.$$arity = 3); Opal.defn(self, '$_reduce_215', TMP_113 = function $$_reduce_215(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_113.$$arity = 3); Opal.defn(self, '$_reduce_216', TMP_114 = function $$_reduce_216(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_114.$$arity = 3); Opal.defn(self, '$_reduce_217', TMP_115 = function $$_reduce_217(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_115.$$arity = 3); Opal.defn(self, '$_reduce_218', TMP_116 = function $$_reduce_218(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_116.$$arity = 3); Opal.defn(self, '$_reduce_219', TMP_117 = function $$_reduce_219(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_117.$$arity = 3); Opal.defn(self, '$_reduce_220', TMP_118 = function $$_reduce_220(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_118.$$arity = 3); Opal.defn(self, '$_reduce_221', TMP_119 = function $$_reduce_221(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_119.$$arity = 3); Opal.defn(self, '$_reduce_222', TMP_120 = function $$_reduce_222(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_120.$$arity = 3); Opal.defn(self, '$_reduce_223', TMP_121 = function $$_reduce_223(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_121.$$arity = 3); Opal.defn(self, '$_reduce_224', TMP_122 = function $$_reduce_224(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_122.$$arity = 3); Opal.defn(self, '$_reduce_225', TMP_123 = function $$_reduce_225(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_123.$$arity = 3); Opal.defn(self, '$_reduce_226', TMP_124 = function $$_reduce_226(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_124.$$arity = 3); Opal.defn(self, '$_reduce_227', TMP_125 = function $$_reduce_227(val, _values, result) { var self = this; result = self.$new_unary_call(val['$[]'](0), val['$[]'](1)); return result; }, TMP_125.$$arity = 3); Opal.defn(self, '$_reduce_228', TMP_126 = function $$_reduce_228(val, _values, result) { var self = this; result = self.$new_unary_call(val['$[]'](0), val['$[]'](1)); return result; }, TMP_126.$$arity = 3); Opal.defn(self, '$_reduce_229', TMP_127 = function $$_reduce_229(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_127.$$arity = 3); Opal.defn(self, '$_reduce_230', TMP_128 = function $$_reduce_230(val, _values, result) { var self = this; result = self.$new_binary_call(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_128.$$arity = 3); Opal.defn(self, '$_reduce_231', TMP_129 = function $$_reduce_231(val, _values, result) { var self = this; result = self.$new_and(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_129.$$arity = 3); Opal.defn(self, '$_reduce_232', TMP_130 = function $$_reduce_232(val, _values, result) { var self = this; result = self.$new_or(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_130.$$arity = 3); Opal.defn(self, '$_reduce_233', TMP_131 = function $$_reduce_233(val, _values, result) { var self = this; result = self.$s("defined", val['$[]'](2)); return result; }, TMP_131.$$arity = 3); Opal.defn(self, '$_reduce_234', TMP_132 = function $$_reduce_234(val, _values, result) { var self = this; self.$lexer().$cond_push(1); return result; }, TMP_132.$$arity = 3); Opal.defn(self, '$_reduce_235', TMP_133 = function $$_reduce_235(val, _values, result) { var self = this; self.$lexer().$cond_pop(); return result; }, TMP_133.$$arity = 3); Opal.defn(self, '$_reduce_236', TMP_134 = function $$_reduce_236(val, _values, result) { var self = this; result = self.$new_if(val['$[]'](1), val['$[]'](0), val['$[]'](3), val['$[]'](6)); return result; }, TMP_134.$$arity = 3); Opal.defn(self, '$_reduce_239', TMP_135 = function $$_reduce_239(val, _values, result) { var self = this; result = nil; return result; }, TMP_135.$$arity = 3); Opal.defn(self, '$_reduce_240', TMP_136 = function $$_reduce_240(val, _values, result) { var self = this; result = [val['$[]'](0)]; return result; }, TMP_136.$$arity = 3); Opal.defn(self, '$_reduce_241', TMP_137 = function $$_reduce_241(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_137.$$arity = 3); Opal.defn(self, '$_reduce_242', TMP_138 = function $$_reduce_242(val, _values, result) { var $a, self = this; val['$[]'](0)['$<<'](($a = self).$s.apply($a, ["hash"].concat(Opal.to_a(val['$[]'](2))))); result = val['$[]'](0); return result; }, TMP_138.$$arity = 3); Opal.defn(self, '$_reduce_243', TMP_139 = function $$_reduce_243(val, _values, result) { var $a, self = this; result = [($a = self).$s.apply($a, ["hash"].concat(Opal.to_a(val['$[]'](0))))]; return result; }, TMP_139.$$arity = 3); Opal.defn(self, '$_reduce_244', TMP_140 = function $$_reduce_244(val, _values, result) { var self = this; result = val['$[]'](0)['$<<'](val['$[]'](2)); return result; }, TMP_140.$$arity = 3); Opal.defn(self, '$_reduce_245', TMP_141 = function $$_reduce_245(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_141.$$arity = 3); Opal.defn(self, '$_reduce_247', TMP_142 = function $$_reduce_247(val, _values, result) { var self = this; result = []; return result; }, TMP_142.$$arity = 3); Opal.defn(self, '$_reduce_249', TMP_143 = function $$_reduce_249(val, _values, result) { var self = this; result = []; return result; }, TMP_143.$$arity = 3); Opal.defn(self, '$_reduce_251', TMP_144 = function $$_reduce_251(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_144.$$arity = 3); Opal.defn(self, '$_reduce_252', TMP_145 = function $$_reduce_252(val, _values, result) { var self = this; result = val['$[]'](0); result['$<<'](self.$new_hash(nil, val['$[]'](2), nil)); return result; }, TMP_145.$$arity = 3); Opal.defn(self, '$_reduce_253', TMP_146 = function $$_reduce_253(val, _values, result) { var self = this; result = [self.$new_hash(nil, val['$[]'](0), nil)]; return result; }, TMP_146.$$arity = 3); Opal.defn(self, '$_reduce_254', TMP_147 = function $$_reduce_254(val, _values, result) { var self = this; result = [val['$[]'](0)]; return result; }, TMP_147.$$arity = 3); Opal.defn(self, '$_reduce_255', TMP_148 = function $$_reduce_255(val, _values, result) { var self = this; result = val['$[]'](0); self.$add_block_pass(val['$[]'](0), val['$[]'](1)); return result; }, TMP_148.$$arity = 3); Opal.defn(self, '$_reduce_256', TMP_149 = function $$_reduce_256(val, _values, result) { var self = this; result = [self.$new_hash(nil, val['$[]'](0), nil)]; self.$add_block_pass(result, val['$[]'](1)); return result; }, TMP_149.$$arity = 3); Opal.defn(self, '$_reduce_257', TMP_150 = function $$_reduce_257(val, _values, result) { var $a, self = this; result = val['$[]'](0); result['$<<'](self.$new_hash(nil, val['$[]'](2), nil)); if ((($a = val['$[]'](3)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result['$<<'](val['$[]'](3))}; return result; }, TMP_150.$$arity = 3); Opal.defn(self, '$_reduce_258', TMP_151 = function $$_reduce_258(val, _values, result) { var self = this; result = []; self.$add_block_pass(result, val['$[]'](0)); return result; }, TMP_151.$$arity = 3); Opal.defn(self, '$_reduce_259', TMP_152 = function $$_reduce_259(val, _values, result) { var self = this; self.$lexer().$cmdarg_push(1); return result; }, TMP_152.$$arity = 3); Opal.defn(self, '$_reduce_260', TMP_153 = function $$_reduce_260(val, _values, result) { var self = this; self.$lexer().$cmdarg_pop(); result = val['$[]'](1); return result; }, TMP_153.$$arity = 3); Opal.defn(self, '$_reduce_261', TMP_154 = function $$_reduce_261(val, _values, result) { var self = this; result = self.$new_block_pass(val['$[]'](0), val['$[]'](1)); return result; }, TMP_154.$$arity = 3); Opal.defn(self, '$_reduce_262', TMP_155 = function $$_reduce_262(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_155.$$arity = 3); Opal.defn(self, '$_reduce_263', TMP_156 = function $$_reduce_263(val, _values, result) { var self = this; result = nil; return result; }, TMP_156.$$arity = 3); Opal.defn(self, '$_reduce_264', TMP_157 = function $$_reduce_264(val, _values, result) { var self = this; result = [val['$[]'](0)]; return result; }, TMP_157.$$arity = 3); Opal.defn(self, '$_reduce_265', TMP_158 = function $$_reduce_265(val, _values, result) { var self = this; result = [self.$new_splat(val['$[]'](0), val['$[]'](1))]; return result; }, TMP_158.$$arity = 3); Opal.defn(self, '$_reduce_266', TMP_159 = function $$_reduce_266(val, _values, result) { var self = this; result = val['$[]'](0)['$<<'](val['$[]'](2)); return result; }, TMP_159.$$arity = 3); Opal.defn(self, '$_reduce_267', TMP_160 = function $$_reduce_267(val, _values, result) { var self = this; result = val['$[]'](0)['$<<'](self.$new_splat(val['$[]'](2), val['$[]'](3))); return result; }, TMP_160.$$arity = 3); Opal.defn(self, '$_reduce_268', TMP_161 = function $$_reduce_268(val, _values, result) { var $a, self = this; val['$[]'](0)['$<<'](val['$[]'](2)); result = ($a = self).$s.apply($a, ["array"].concat(Opal.to_a(val['$[]'](0)))); return result; }, TMP_161.$$arity = 3); Opal.defn(self, '$_reduce_269', TMP_162 = function $$_reduce_269(val, _values, result) { var $a, self = this; val['$[]'](0)['$<<'](self.$s("splat", val['$[]'](3))); result = ($a = self).$s.apply($a, ["array"].concat(Opal.to_a(val['$[]'](0)))); return result; }, TMP_162.$$arity = 3); Opal.defn(self, '$_reduce_270', TMP_163 = function $$_reduce_270(val, _values, result) { var self = this; result = self.$s("splat", val['$[]'](1)); return result; }, TMP_163.$$arity = 3); Opal.defn(self, '$_reduce_280', TMP_164 = function $$_reduce_280(val, _values, result) { var self = this; result = self.$lexer().$line(); return result; }, TMP_164.$$arity = 3); Opal.defn(self, '$_reduce_281', TMP_165 = function $$_reduce_281(val, _values, result) { var self = this; result = self.$s("begin", val['$[]'](2)); return result; }, TMP_165.$$arity = 3); Opal.defn(self, '$_reduce_282', TMP_166 = function $$_reduce_282(val, _values, result) { var $a, $b, self = this; (($a = ["expr_endarg"]), $b = self.$lexer(), $b['$lex_state='].apply($b, $a), $a[$a.length-1]); return result; }, TMP_166.$$arity = 3); Opal.defn(self, '$_reduce_283', TMP_167 = function $$_reduce_283(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_167.$$arity = 3); Opal.defn(self, '$_reduce_284', TMP_168 = function $$_reduce_284(val, _values, result) { var $a, $b, self = this; (($a = ["expr_endarg"]), $b = self.$lexer(), $b['$lex_state='].apply($b, $a), $a[$a.length-1]); return result; }, TMP_168.$$arity = 3); Opal.defn(self, '$_reduce_285', TMP_169 = function $$_reduce_285(val, _values, result) { var self = this; result = self.$new_nil(val['$[]'](0)); return result; }, TMP_169.$$arity = 3); Opal.defn(self, '$_reduce_286', TMP_170 = function $$_reduce_286(val, _values, result) { var self = this; result = self.$new_paren(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_170.$$arity = 3); Opal.defn(self, '$_reduce_287', TMP_171 = function $$_reduce_287(val, _values, result) { var self = this; result = self.$new_colon2(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_171.$$arity = 3); Opal.defn(self, '$_reduce_288', TMP_172 = function $$_reduce_288(val, _values, result) { var self = this; result = self.$new_colon3(val['$[]'](0), val['$[]'](1)); return result; }, TMP_172.$$arity = 3); Opal.defn(self, '$_reduce_289', TMP_173 = function $$_reduce_289(val, _values, result) { var self = this; result = self.$new_call(val['$[]'](0), ["[]", []], val['$[]'](2)); return result; }, TMP_173.$$arity = 3); Opal.defn(self, '$_reduce_290', TMP_174 = function $$_reduce_290(val, _values, result) { var self = this; result = self.$new_js_call(val['$[]'](0), ["[]", []], val['$[]'](2)); return result; }, TMP_174.$$arity = 3); Opal.defn(self, '$_reduce_291', TMP_175 = function $$_reduce_291(val, _values, result) { var self = this; result = self.$new_array(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_175.$$arity = 3); Opal.defn(self, '$_reduce_292', TMP_176 = function $$_reduce_292(val, _values, result) { var self = this; result = self.$new_hash(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_176.$$arity = 3); Opal.defn(self, '$_reduce_293', TMP_177 = function $$_reduce_293(val, _values, result) { var self = this; result = self.$new_return(val['$[]'](0)); return result; }, TMP_177.$$arity = 3); Opal.defn(self, '$_reduce_294', TMP_178 = function $$_reduce_294(val, _values, result) { var self = this; result = self.$new_yield(val['$[]'](2)); return result; }, TMP_178.$$arity = 3); Opal.defn(self, '$_reduce_295', TMP_179 = function $$_reduce_295(val, _values, result) { var self = this; result = self.$s("yield"); return result; }, TMP_179.$$arity = 3); Opal.defn(self, '$_reduce_296', TMP_180 = function $$_reduce_296(val, _values, result) { var self = this; result = self.$s("yield"); return result; }, TMP_180.$$arity = 3); Opal.defn(self, '$_reduce_297', TMP_181 = function $$_reduce_297(val, _values, result) { var self = this; result = self.$s("defined", val['$[]'](3)); return result; }, TMP_181.$$arity = 3); Opal.defn(self, '$_reduce_298', TMP_182 = function $$_reduce_298(val, _values, result) { var self = this; result = self.$new_unary_call(["!", []], val['$[]'](2)); return result; }, TMP_182.$$arity = 3); Opal.defn(self, '$_reduce_299', TMP_183 = function $$_reduce_299(val, _values, result) { var self = this; result = self.$new_unary_call(["!", []], self.$new_nil(val['$[]'](0))); return result; }, TMP_183.$$arity = 3); Opal.defn(self, '$_reduce_300', TMP_184 = function $$_reduce_300(val, _values, result) { var self = this; result = self.$new_call(nil, val['$[]'](0), []); result['$<<'](val['$[]'](1)); return result; }, TMP_184.$$arity = 3); Opal.defn(self, '$_reduce_302', TMP_185 = function $$_reduce_302(val, _values, result) { var self = this; result = self.$new_method_call_with_block(val['$[]'](0), val['$[]'](1)); return result; }, TMP_185.$$arity = 3); Opal.defn(self, '$_reduce_303', TMP_186 = function $$_reduce_303(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_186.$$arity = 3); Opal.defn(self, '$_reduce_304', TMP_187 = function $$_reduce_304(val, _values, result) { var self = this; result = self.$new_if(val['$[]'](0), val['$[]'](1), val['$[]'](3), val['$[]'](4)); return result; }, TMP_187.$$arity = 3); Opal.defn(self, '$_reduce_305', TMP_188 = function $$_reduce_305(val, _values, result) { var self = this; result = self.$new_if(val['$[]'](0), val['$[]'](1), val['$[]'](4), val['$[]'](3)); return result; }, TMP_188.$$arity = 3); Opal.defn(self, '$_reduce_306', TMP_189 = function $$_reduce_306(val, _values, result) { var self = this; self.$lexer().$cond_push(1); result = self.$lexer().$line(); return result; }, TMP_189.$$arity = 3); Opal.defn(self, '$_reduce_307', TMP_190 = function $$_reduce_307(val, _values, result) { var self = this; self.$lexer().$cond_pop(); return result; }, TMP_190.$$arity = 3); Opal.defn(self, '$_reduce_308', TMP_191 = function $$_reduce_308(val, _values, result) { var self = this; result = self.$s("while", val['$[]'](2), val['$[]'](5)); return result; }, TMP_191.$$arity = 3); Opal.defn(self, '$_reduce_309', TMP_192 = function $$_reduce_309(val, _values, result) { var self = this; self.$lexer().$cond_push(1); result = self.$lexer().$line(); return result; }, TMP_192.$$arity = 3); Opal.defn(self, '$_reduce_310', TMP_193 = function $$_reduce_310(val, _values, result) { var self = this; self.$lexer().$cond_pop(); return result; }, TMP_193.$$arity = 3); Opal.defn(self, '$_reduce_311', TMP_194 = function $$_reduce_311(val, _values, result) { var self = this; result = self.$s("until", val['$[]'](2), val['$[]'](5)); return result; }, TMP_194.$$arity = 3); Opal.defn(self, '$_reduce_312', TMP_195 = function $$_reduce_312(val, _values, result) { var $a, self = this; result = ($a = self).$s.apply($a, ["case", val['$[]'](1)].concat(Opal.to_a(val['$[]'](3)))); return result; }, TMP_195.$$arity = 3); Opal.defn(self, '$_reduce_313', TMP_196 = function $$_reduce_313(val, _values, result) { var $a, self = this; result = ($a = self).$s.apply($a, ["case", nil].concat(Opal.to_a(val['$[]'](2)))); return result; }, TMP_196.$$arity = 3); Opal.defn(self, '$_reduce_314', TMP_197 = function $$_reduce_314(val, _values, result) { var self = this; result = self.$s("case", nil, val['$[]'](3)); return result; }, TMP_197.$$arity = 3); Opal.defn(self, '$_reduce_315', TMP_198 = function $$_reduce_315(val, _values, result) { var self = this; self.$lexer().$cond_push(1); result = self.$lexer().$line(); return result; }, TMP_198.$$arity = 3); Opal.defn(self, '$_reduce_316', TMP_199 = function $$_reduce_316(val, _values, result) { var self = this; self.$lexer().$cond_pop(); return result; }, TMP_199.$$arity = 3); Opal.defn(self, '$_reduce_317', TMP_200 = function $$_reduce_317(val, _values, result) { var self = this; result = self.$s("for", val['$[]'](4), val['$[]'](1), val['$[]'](7)); return result; }, TMP_200.$$arity = 3); Opal.defn(self, '$_reduce_318', TMP_201 = function $$_reduce_318(val, _values, result) { var self = this; return result; }, TMP_201.$$arity = 3); Opal.defn(self, '$_reduce_319', TMP_202 = function $$_reduce_319(val, _values, result) { var self = this; result = self.$new_class(val['$[]'](0), val['$[]'](1), val['$[]'](2), val['$[]'](4), val['$[]'](5)); return result; }, TMP_202.$$arity = 3); Opal.defn(self, '$_reduce_320', TMP_203 = function $$_reduce_320(val, _values, result) { var self = this; result = self.$lexer().$line(); return result; }, TMP_203.$$arity = 3); Opal.defn(self, '$_reduce_321', TMP_204 = function $$_reduce_321(val, _values, result) { var self = this; return result; }, TMP_204.$$arity = 3); Opal.defn(self, '$_reduce_322', TMP_205 = function $$_reduce_322(val, _values, result) { var self = this; result = self.$new_sclass(val['$[]'](0), val['$[]'](3), val['$[]'](6), val['$[]'](7)); return result; }, TMP_205.$$arity = 3); Opal.defn(self, '$_reduce_323', TMP_206 = function $$_reduce_323(val, _values, result) { var self = this; result = self.$lexer().$line(); return result; }, TMP_206.$$arity = 3); Opal.defn(self, '$_reduce_324', TMP_207 = function $$_reduce_324(val, _values, result) { var self = this; return result; }, TMP_207.$$arity = 3); Opal.defn(self, '$_reduce_325', TMP_208 = function $$_reduce_325(val, _values, result) { var self = this; result = self.$new_module(val['$[]'](0), val['$[]'](2), val['$[]'](4), val['$[]'](5)); return result; }, TMP_208.$$arity = 3); Opal.defn(self, '$_reduce_326', TMP_209 = function $$_reduce_326(val, _values, result) { var self = this; self.$push_scope(); return result; }, TMP_209.$$arity = 3); Opal.defn(self, '$_reduce_327', TMP_210 = function $$_reduce_327(val, _values, result) { var self = this; result = self.$new_def(val['$[]'](0), nil, val['$[]'](1), val['$[]'](3), val['$[]'](4), val['$[]'](5)); self.$pop_scope(); return result; }, TMP_210.$$arity = 3); Opal.defn(self, '$_reduce_328', TMP_211 = function $$_reduce_328(val, _values, result) { var $a, $b, self = this; (($a = ["expr_fname"]), $b = self.$lexer(), $b['$lex_state='].apply($b, $a), $a[$a.length-1]); return result; }, TMP_211.$$arity = 3); Opal.defn(self, '$_reduce_329', TMP_212 = function $$_reduce_329(val, _values, result) { var $a, $b, self = this; self.$push_scope(); (($a = ["expr_endfn"]), $b = self.$lexer(), $b['$lex_state='].apply($b, $a), $a[$a.length-1]); return result; }, TMP_212.$$arity = 3); Opal.defn(self, '$_reduce_330', TMP_213 = function $$_reduce_330(val, _values, result) { var self = this; result = self.$new_def(val['$[]'](0), val['$[]'](1), val['$[]'](4), val['$[]'](6), val['$[]'](7), val['$[]'](8)); self.$pop_scope(); return result; }, TMP_213.$$arity = 3); Opal.defn(self, '$_reduce_331', TMP_214 = function $$_reduce_331(val, _values, result) { var self = this; result = self.$new_break(val['$[]'](0)); return result; }, TMP_214.$$arity = 3); Opal.defn(self, '$_reduce_332', TMP_215 = function $$_reduce_332(val, _values, result) { var self = this; result = self.$s("next"); return result; }, TMP_215.$$arity = 3); Opal.defn(self, '$_reduce_333', TMP_216 = function $$_reduce_333(val, _values, result) { var self = this; result = self.$s("redo"); return result; }, TMP_216.$$arity = 3); Opal.defn(self, '$_reduce_343', TMP_217 = function $$_reduce_343(val, _values, result) { var self = this; result = []; return result; }, TMP_217.$$arity = 3); Opal.defn(self, '$_reduce_344', TMP_218 = function $$_reduce_344(val, _values, result) { var self = this; result = val['$[]'](2); return result; }, TMP_218.$$arity = 3); Opal.defn(self, '$_reduce_345', TMP_219 = function $$_reduce_345(val, _values, result) { var self = this; result = [val['$[]'](0)]; return result; }, TMP_219.$$arity = 3); Opal.defn(self, '$_reduce_346', TMP_220 = function $$_reduce_346(val, _values, result) { var self = this; result = val['$[]'](0)['$<<'](val['$[]'](2)); return result; }, TMP_220.$$arity = 3); Opal.defn(self, '$_reduce_347', TMP_221 = function $$_reduce_347(val, _values, result) { var self = this; result = self.$new_shadowarg(val['$[]'](0)); return result; }, TMP_221.$$arity = 3); Opal.defn(self, '$_reduce_349', TMP_222 = function $$_reduce_349(val, _values, result) { var self = this; result = self.$new_call(nil, ["lambda", []], []); result['$<<'](self.$new_iter(val['$[]'](0), val['$[]'](1))); return result; }, TMP_222.$$arity = 3); Opal.defn(self, '$_reduce_350', TMP_223 = function $$_reduce_350(val, _values, result) { var $a, self = this; result = ($a = self).$new_block_args.apply($a, Opal.to_a(val['$[]'](1))); return result; }, TMP_223.$$arity = 3); Opal.defn(self, '$_reduce_351', TMP_224 = function $$_reduce_351(val, _values, result) { var self = this; result = nil; return result; }, TMP_224.$$arity = 3); Opal.defn(self, '$_reduce_352', TMP_225 = function $$_reduce_352(val, _values, result) { var $a, self = this; result = ($a = self).$new_block_args.apply($a, Opal.to_a(val['$[]'](0))); return result; }, TMP_225.$$arity = 3); Opal.defn(self, '$_reduce_354', TMP_226 = function $$_reduce_354(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_226.$$arity = 3); Opal.defn(self, '$_reduce_355', TMP_227 = function $$_reduce_355(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_227.$$arity = 3); Opal.defn(self, '$_reduce_356', TMP_228 = function $$_reduce_356(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_228.$$arity = 3); Opal.defn(self, '$_reduce_357', TMP_229 = function $$_reduce_357(val, _values, result) { var self = this; result = self.$new_if(val['$[]'](0), val['$[]'](1), val['$[]'](3), val['$[]'](4)); return result; }, TMP_229.$$arity = 3); Opal.defn(self, '$_reduce_359', TMP_230 = function $$_reduce_359(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_230.$$arity = 3); Opal.defn(self, '$_reduce_360', TMP_231 = function $$_reduce_360(val, _values, result) { var self = this; result = self.$s("block", val['$[]'](0)); return result; }, TMP_231.$$arity = 3); Opal.defn(self, '$_reduce_361', TMP_232 = function $$_reduce_361(val, _values, result) { var self = this; val['$[]'](0)['$<<'](val['$[]'](2)); result = val['$[]'](0); return result; }, TMP_232.$$arity = 3); Opal.defn(self, '$_reduce_362', TMP_233 = function $$_reduce_362(val, _values, result) { var self = this; result = self.$new_assign(self.$new_assignable(self.$new_ident(val['$[]'](0))), val['$[]'](1), val['$[]'](2)); return result; }, TMP_233.$$arity = 3); Opal.defn(self, '$_reduce_364', TMP_234 = function $$_reduce_364(val, _values, result) { var self = this; result = self.$new_block_args(nil, [val['$[]'](1)]); return result; }, TMP_234.$$arity = 3); Opal.defn(self, '$_reduce_365', TMP_235 = function $$_reduce_365(val, _values, result) { var self = this; result = nil; return result; }, TMP_235.$$arity = 3); Opal.defn(self, '$_reduce_366', TMP_236 = function $$_reduce_366(val, _values, result) { var $a, self = this; val['$[]'](1)['$<<'](val['$[]'](2)); result = ($a = self).$new_block_args.apply($a, Opal.to_a(val['$[]'](1))); return result; }, TMP_236.$$arity = 3); Opal.defn(self, '$_reduce_367', TMP_237 = function $$_reduce_367(val, _values, result) { var self = this; result = [val['$[]'](0), val['$[]'](2), val['$[]'](3)]; return result; }, TMP_237.$$arity = 3); Opal.defn(self, '$_reduce_368', TMP_238 = function $$_reduce_368(val, _values, result) { var self = this; result = [val['$[]'](0), nil, val['$[]'](1)]; return result; }, TMP_238.$$arity = 3); Opal.defn(self, '$_reduce_369', TMP_239 = function $$_reduce_369(val, _values, result) { var self = this; result = [nil, val['$[]'](0), val['$[]'](1)]; return result; }, TMP_239.$$arity = 3); Opal.defn(self, '$_reduce_370', TMP_240 = function $$_reduce_370(val, _values, result) { var self = this; result = [nil, nil, val['$[]'](0)]; return result; }, TMP_240.$$arity = 3); Opal.defn(self, '$_reduce_371', TMP_241 = function $$_reduce_371(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_241.$$arity = 3); Opal.defn(self, '$_reduce_372', TMP_242 = function $$_reduce_372(val, _values, result) { var self = this; nil; return result; }, TMP_242.$$arity = 3); Opal.defn(self, '$_reduce_373', TMP_243 = function $$_reduce_373(val, _values, result) { var self = this, optarg = nil, restarg = nil; optarg = self.$new_optarg(val['$[]'](2)); restarg = self.$new_restarg(val['$[]'](4)); result = [$rb_plus($rb_plus(val['$[]'](0), optarg), restarg), val['$[]'](5)]; return result; }, TMP_243.$$arity = 3); Opal.defn(self, '$_reduce_374', TMP_244 = function $$_reduce_374(val, _values, result) { var self = this, optarg = nil, restarg = nil; optarg = self.$new_optarg(val['$[]'](2)); restarg = self.$new_restarg(val['$[]'](4)); result = [$rb_plus($rb_plus($rb_plus(val['$[]'](0), optarg), restarg), val['$[]'](6)), val['$[]'](7)]; return result; }, TMP_244.$$arity = 3); Opal.defn(self, '$_reduce_375', TMP_245 = function $$_reduce_375(val, _values, result) { var self = this, optarg = nil; optarg = self.$new_optarg(val['$[]'](2)); result = [$rb_plus(val['$[]'](0), optarg), val['$[]'](3)]; return result; }, TMP_245.$$arity = 3); Opal.defn(self, '$_reduce_376', TMP_246 = function $$_reduce_376(val, _values, result) { var self = this, optarg = nil; optarg = self.$new_optarg(val['$[]'](2)); result = [$rb_plus($rb_plus(val['$[]'](0), optarg), val['$[]'](4)), val['$[]'](5)]; return result; }, TMP_246.$$arity = 3); Opal.defn(self, '$_reduce_377', TMP_247 = function $$_reduce_377(val, _values, result) { var self = this, restarg = nil; restarg = self.$new_restarg(val['$[]'](2)); result = [$rb_plus(val['$[]'](0), restarg), val['$[]'](3)]; return result; }, TMP_247.$$arity = 3); Opal.defn(self, '$_reduce_378', TMP_248 = function $$_reduce_378(val, _values, result) { var self = this; val['$[]'](0)['$<<'](nil); result = [val['$[]'](0), nil]; return result; }, TMP_248.$$arity = 3); Opal.defn(self, '$_reduce_379', TMP_249 = function $$_reduce_379(val, _values, result) { var self = this, restarg = nil; restarg = self.$new_restarg(val['$[]'](2)); result = [$rb_plus($rb_plus(val['$[]'](0), restarg), val['$[]'](4)), val['$[]'](5)]; return result; }, TMP_249.$$arity = 3); Opal.defn(self, '$_reduce_380', TMP_250 = function $$_reduce_380(val, _values, result) { var self = this; result = [val['$[]'](0), val['$[]'](1)]; return result; }, TMP_250.$$arity = 3); Opal.defn(self, '$_reduce_381', TMP_251 = function $$_reduce_381(val, _values, result) { var self = this, optarg = nil, restarg = nil; optarg = self.$new_optarg(val['$[]'](0)); restarg = self.$new_restarg(val['$[]'](2)); result = [$rb_plus(optarg, restarg), val['$[]'](3)]; return result; }, TMP_251.$$arity = 3); Opal.defn(self, '$_reduce_382', TMP_252 = function $$_reduce_382(val, _values, result) { var self = this, optarg = nil, restarg = nil; optarg = self.$new_optarg(val['$[]'](0)); restarg = self.$new_restarg(val['$[]'](2)); result = [$rb_plus($rb_plus(optarg, restarg), val['$[]'](4)), val['$[]'](5)]; return result; }, TMP_252.$$arity = 3); Opal.defn(self, '$_reduce_383', TMP_253 = function $$_reduce_383(val, _values, result) { var self = this, optarg = nil; optarg = self.$new_optarg(val['$[]'](0)); result = [optarg, val['$[]'](1)]; return result; }, TMP_253.$$arity = 3); Opal.defn(self, '$_reduce_384', TMP_254 = function $$_reduce_384(val, _values, result) { var self = this, optarg = nil; optarg = self.$new_optarg(val['$[]'](0)); result = [$rb_plus(optarg, val['$[]'](2)), val['$[]'](3)]; return result; }, TMP_254.$$arity = 3); Opal.defn(self, '$_reduce_385', TMP_255 = function $$_reduce_385(val, _values, result) { var self = this, restarg = nil; restarg = self.$new_restarg(val['$[]'](0)); result = [restarg, val['$[]'](1)]; return result; }, TMP_255.$$arity = 3); Opal.defn(self, '$_reduce_386', TMP_256 = function $$_reduce_386(val, _values, result) { var self = this, restarg = nil; restarg = self.$new_restarg(val['$[]'](0)); result = [$rb_plus(restarg, val['$[]'](2)), val['$[]'](3)]; return result; }, TMP_256.$$arity = 3); Opal.defn(self, '$_reduce_387', TMP_257 = function $$_reduce_387(val, _values, result) { var self = this; result = [nil, val['$[]'](0)]; return result; }, TMP_257.$$arity = 3); Opal.defn(self, '$_reduce_388', TMP_258 = function $$_reduce_388(val, _values, result) { var self = this; self.$push_scope("block"); result = self.$lexer().$line(); return result; }, TMP_258.$$arity = 3); Opal.defn(self, '$_reduce_389', TMP_259 = function $$_reduce_389(val, _values, result) { var self = this; result = self.$new_iter(val['$[]'](2), val['$[]'](3)); self.$pop_scope(); return result; }, TMP_259.$$arity = 3); Opal.defn(self, '$_reduce_390', TMP_260 = function $$_reduce_390(val, _values, result) { var self = this; val['$[]'](0)['$<<'](val['$[]'](1)); result = val['$[]'](0); return result; }, TMP_260.$$arity = 3); Opal.defn(self, '$_reduce_394', TMP_261 = function $$_reduce_394(val, _values, result) { var self = this; result = self.$new_call(nil, val['$[]'](0), val['$[]'](1)); return result; }, TMP_261.$$arity = 3); Opal.defn(self, '$_reduce_395', TMP_262 = function $$_reduce_395(val, _values, result) { var self = this; result = self.$new_call(val['$[]'](0), val['$[]'](2), val['$[]'](3)); return result; }, TMP_262.$$arity = 3); Opal.defn(self, '$_reduce_396', TMP_263 = function $$_reduce_396(val, _values, result) { var self = this; result = self.$new_js_call(val['$[]'](0), val['$[]'](2), val['$[]'](3)); return result; }, TMP_263.$$arity = 3); Opal.defn(self, '$_reduce_397', TMP_264 = function $$_reduce_397(val, _values, result) { var self = this; result = self.$new_call(val['$[]'](0), ["call", []], val['$[]'](2)); return result; }, TMP_264.$$arity = 3); Opal.defn(self, '$_reduce_398', TMP_265 = function $$_reduce_398(val, _values, result) { var self = this; result = self.$new_call(val['$[]'](0), val['$[]'](2), val['$[]'](3)); return result; }, TMP_265.$$arity = 3); Opal.defn(self, '$_reduce_399', TMP_266 = function $$_reduce_399(val, _values, result) { var self = this; result = self.$new_call(val['$[]'](0), val['$[]'](2)); return result; }, TMP_266.$$arity = 3); Opal.defn(self, '$_reduce_400', TMP_267 = function $$_reduce_400(val, _values, result) { var self = this; result = self.$new_super(val['$[]'](0), val['$[]'](1)); return result; }, TMP_267.$$arity = 3); Opal.defn(self, '$_reduce_401', TMP_268 = function $$_reduce_401(val, _values, result) { var self = this; result = self.$new_super(val['$[]'](0), nil); return result; }, TMP_268.$$arity = 3); Opal.defn(self, '$_reduce_402', TMP_269 = function $$_reduce_402(val, _values, result) { var self = this; self.$push_scope("block"); result = self.$lexer().$line(); return result; }, TMP_269.$$arity = 3); Opal.defn(self, '$_reduce_403', TMP_270 = function $$_reduce_403(val, _values, result) { var self = this; result = self.$new_iter(val['$[]'](2), val['$[]'](3)); self.$pop_scope(); return result; }, TMP_270.$$arity = 3); Opal.defn(self, '$_reduce_404', TMP_271 = function $$_reduce_404(val, _values, result) { var self = this; self.$push_scope("block"); result = self.$lexer().$line(); return result; }, TMP_271.$$arity = 3); Opal.defn(self, '$_reduce_405', TMP_272 = function $$_reduce_405(val, _values, result) { var self = this; result = self.$new_iter(val['$[]'](2), val['$[]'](3)); self.$pop_scope(); return result; }, TMP_272.$$arity = 3); Opal.defn(self, '$_reduce_406', TMP_273 = function $$_reduce_406(val, _values, result) { var self = this; result = self.$lexer().$line(); return result; }, TMP_273.$$arity = 3); Opal.defn(self, '$_reduce_407', TMP_274 = function $$_reduce_407(val, _values, result) { var $a, $b, self = this, part = nil; part = self.$s("when", ($a = self).$s.apply($a, ["array"].concat(Opal.to_a(val['$[]'](2)))), val['$[]'](4)); result = [part]; if ((($b = val['$[]'](5)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { ($b = result).$push.apply($b, Opal.to_a(val['$[]'](5)))}; return result; }, TMP_274.$$arity = 3); Opal.defn(self, '$_reduce_408', TMP_275 = function $$_reduce_408(val, _values, result) { var self = this; result = [val['$[]'](0)]; return result; }, TMP_275.$$arity = 3); Opal.defn(self, '$_reduce_410', TMP_276 = function $$_reduce_410(val, _values, result) { var $a, self = this, exc = nil; exc = ((($a = val['$[]'](1)) !== false && $a !== nil && $a != null) ? $a : self.$s("array")); if ((($a = val['$[]'](2)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { exc['$<<'](self.$new_assign(val['$[]'](2), val['$[]'](2), self.$s("gvar", "$!".$intern())))}; result = [self.$s("resbody", exc, val['$[]'](4))]; if ((($a = val['$[]'](5)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result.$concat(val['$[]'](5))}; return result; }, TMP_276.$$arity = 3); Opal.defn(self, '$_reduce_411', TMP_277 = function $$_reduce_411(val, _values, result) { var self = this; result = nil; return result; }, TMP_277.$$arity = 3); Opal.defn(self, '$_reduce_412', TMP_278 = function $$_reduce_412(val, _values, result) { var self = this; result = self.$s("array", val['$[]'](0)); return result; }, TMP_278.$$arity = 3); Opal.defn(self, '$_reduce_415', TMP_279 = function $$_reduce_415(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_279.$$arity = 3); Opal.defn(self, '$_reduce_416', TMP_280 = function $$_reduce_416(val, _values, result) { var self = this; result = nil; return result; }, TMP_280.$$arity = 3); Opal.defn(self, '$_reduce_417', TMP_281 = function $$_reduce_417(val, _values, result) { var $a, self = this; result = (function() {if ((($a = val['$[]'](1)['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$s("nil") } else { return val['$[]'](1) }; return nil; })(); return result; }, TMP_281.$$arity = 3); Opal.defn(self, '$_reduce_422', TMP_282 = function $$_reduce_422(val, _values, result) { var self = this; result = self.$new_str(val['$[]'](0)); return result; }, TMP_282.$$arity = 3); Opal.defn(self, '$_reduce_424', TMP_283 = function $$_reduce_424(val, _values, result) { var self = this; result = self.$str_append(val['$[]'](0), val['$[]'](1)); return result; }, TMP_283.$$arity = 3); Opal.defn(self, '$_reduce_425', TMP_284 = function $$_reduce_425(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_284.$$arity = 3); Opal.defn(self, '$_reduce_426', TMP_285 = function $$_reduce_426(val, _values, result) { var self = this; result = self.$s("str", self.$value(val['$[]'](0))); return result; }, TMP_285.$$arity = 3); Opal.defn(self, '$_reduce_427', TMP_286 = function $$_reduce_427(val, _values, result) { var self = this; result = self.$new_xstr(val['$[]'](0), val['$[]'](1), val['$[]'](2)); return result; }, TMP_286.$$arity = 3); Opal.defn(self, '$_reduce_428', TMP_287 = function $$_reduce_428(val, _values, result) { var self = this; result = self.$new_regexp(val['$[]'](1), val['$[]'](2)); return result; }, TMP_287.$$arity = 3); Opal.defn(self, '$_reduce_429', TMP_288 = function $$_reduce_429(val, _values, result) { var self = this; result = self.$s("array"); return result; }, TMP_288.$$arity = 3); Opal.defn(self, '$_reduce_430', TMP_289 = function $$_reduce_430(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_289.$$arity = 3); Opal.defn(self, '$_reduce_431', TMP_290 = function $$_reduce_431(val, _values, result) { var self = this; result = self.$s("array"); return result; }, TMP_290.$$arity = 3); Opal.defn(self, '$_reduce_432', TMP_291 = function $$_reduce_432(val, _values, result) { var self = this, part = nil; part = val['$[]'](1); if (part.$type()['$==']("evstr")) { part = self.$s("dstr", "", val['$[]'](1))}; result = val['$[]'](0)['$<<'](part); return result; }, TMP_291.$$arity = 3); Opal.defn(self, '$_reduce_433', TMP_292 = function $$_reduce_433(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_292.$$arity = 3); Opal.defn(self, '$_reduce_434', TMP_293 = function $$_reduce_434(val, _values, result) { var self = this; result = val['$[]'](0).$concat([val['$[]'](1)]); return result; }, TMP_293.$$arity = 3); Opal.defn(self, '$_reduce_435', TMP_294 = function $$_reduce_435(val, _values, result) { var self = this; result = self.$s("array"); return result; }, TMP_294.$$arity = 3); Opal.defn(self, '$_reduce_436', TMP_295 = function $$_reduce_436(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_295.$$arity = 3); Opal.defn(self, '$_reduce_437', TMP_296 = function $$_reduce_437(val, _values, result) { var self = this; result = self.$s("array"); return result; }, TMP_296.$$arity = 3); Opal.defn(self, '$_reduce_438', TMP_297 = function $$_reduce_438(val, _values, result) { var self = this; result = val['$[]'](0)['$<<'](self.$s("str", self.$value(val['$[]'](1)))); return result; }, TMP_297.$$arity = 3); Opal.defn(self, '$_reduce_439', TMP_298 = function $$_reduce_439(val, _values, result) { var self = this; result = nil; return result; }, TMP_298.$$arity = 3); Opal.defn(self, '$_reduce_440', TMP_299 = function $$_reduce_440(val, _values, result) { var self = this; result = self.$str_append(val['$[]'](0), val['$[]'](1)); return result; }, TMP_299.$$arity = 3); Opal.defn(self, '$_reduce_441', TMP_300 = function $$_reduce_441(val, _values, result) { var self = this; result = nil; return result; }, TMP_300.$$arity = 3); Opal.defn(self, '$_reduce_442', TMP_301 = function $$_reduce_442(val, _values, result) { var self = this; result = self.$str_append(val['$[]'](0), val['$[]'](1)); return result; }, TMP_301.$$arity = 3); Opal.defn(self, '$_reduce_443', TMP_302 = function $$_reduce_443(val, _values, result) { var self = this; result = self.$new_str_content(val['$[]'](0)); return result; }, TMP_302.$$arity = 3); Opal.defn(self, '$_reduce_444', TMP_303 = function $$_reduce_444(val, _values, result) { var $a, $b, self = this; result = self.$lexer().$strterm(); (($a = [nil]), $b = self.$lexer(), $b['$strterm='].apply($b, $a), $a[$a.length-1]); return result; }, TMP_303.$$arity = 3); Opal.defn(self, '$_reduce_445', TMP_304 = function $$_reduce_445(val, _values, result) { var $a, $b, self = this; (($a = [val['$[]'](1)]), $b = self.$lexer(), $b['$strterm='].apply($b, $a), $a[$a.length-1]); result = self.$new_evstr(val['$[]'](2)); return result; }, TMP_304.$$arity = 3); Opal.defn(self, '$_reduce_446', TMP_305 = function $$_reduce_446(val, _values, result) { var $a, $b, self = this; self.$lexer().$cond_push(0); self.$lexer().$cmdarg_push(0); result = self.$lexer().$strterm(); (($a = [nil]), $b = self.$lexer(), $b['$strterm='].apply($b, $a), $a[$a.length-1]); (($a = ["expr_beg"]), $b = self.$lexer(), $b['$lex_state='].apply($b, $a), $a[$a.length-1]); return result; }, TMP_305.$$arity = 3); Opal.defn(self, '$_reduce_447', TMP_306 = function $$_reduce_447(val, _values, result) { var $a, $b, self = this; (($a = [val['$[]'](1)]), $b = self.$lexer(), $b['$strterm='].apply($b, $a), $a[$a.length-1]); self.$lexer().$cond_lexpop(); self.$lexer().$cmdarg_lexpop(); result = self.$new_evstr(val['$[]'](2)); return result; }, TMP_306.$$arity = 3); Opal.defn(self, '$_reduce_448', TMP_307 = function $$_reduce_448(val, _values, result) { var self = this; result = self.$new_gvar(val['$[]'](0)); return result; }, TMP_307.$$arity = 3); Opal.defn(self, '$_reduce_449', TMP_308 = function $$_reduce_449(val, _values, result) { var self = this; result = self.$new_ivar(val['$[]'](0)); return result; }, TMP_308.$$arity = 3); Opal.defn(self, '$_reduce_450', TMP_309 = function $$_reduce_450(val, _values, result) { var self = this; result = self.$new_cvar(val['$[]'](0)); return result; }, TMP_309.$$arity = 3); Opal.defn(self, '$_reduce_452', TMP_310 = function $$_reduce_452(val, _values, result) { var $a, $b, self = this; result = self.$new_sym(val['$[]'](1)); (($a = ["expr_end"]), $b = self.$lexer(), $b['$lex_state='].apply($b, $a), $a[$a.length-1]); return result; }, TMP_310.$$arity = 3); Opal.defn(self, '$_reduce_453', TMP_311 = function $$_reduce_453(val, _values, result) { var self = this; result = self.$new_sym(val['$[]'](0)); return result; }, TMP_311.$$arity = 3); Opal.defn(self, '$_reduce_458', TMP_312 = function $$_reduce_458(val, _values, result) { var self = this; result = self.$new_dsym(val['$[]'](1)); return result; }, TMP_312.$$arity = 3); Opal.defn(self, '$_reduce_459', TMP_313 = function $$_reduce_459(val, _values, result) { var self = this; result = self.$new_int(val['$[]'](0)); return result; }, TMP_313.$$arity = 3); Opal.defn(self, '$_reduce_460', TMP_314 = function $$_reduce_460(val, _values, result) { var self = this; result = self.$new_float(val['$[]'](0)); return result; }, TMP_314.$$arity = 3); Opal.defn(self, '$_reduce_461', TMP_315 = function $$_reduce_461(val, _values, result) { var self = this; result = self.$negate_num(self.$new_int(val['$[]'](1))); return result; }, TMP_315.$$arity = 3); Opal.defn(self, '$_reduce_462', TMP_316 = function $$_reduce_462(val, _values, result) { var self = this; result = self.$negate_num(self.$new_float(val['$[]'](1))); return result; }, TMP_316.$$arity = 3); Opal.defn(self, '$_reduce_463', TMP_317 = function $$_reduce_463(val, _values, result) { var self = this; result = self.$new_int(val['$[]'](1)); return result; }, TMP_317.$$arity = 3); Opal.defn(self, '$_reduce_464', TMP_318 = function $$_reduce_464(val, _values, result) { var self = this; result = self.$new_float(val['$[]'](1)); return result; }, TMP_318.$$arity = 3); Opal.defn(self, '$_reduce_465', TMP_319 = function $$_reduce_465(val, _values, result) { var self = this; result = self.$new_ident(val['$[]'](0)); return result; }, TMP_319.$$arity = 3); Opal.defn(self, '$_reduce_466', TMP_320 = function $$_reduce_466(val, _values, result) { var self = this; result = self.$new_ivar(val['$[]'](0)); return result; }, TMP_320.$$arity = 3); Opal.defn(self, '$_reduce_467', TMP_321 = function $$_reduce_467(val, _values, result) { var self = this; result = self.$new_gvar(val['$[]'](0)); return result; }, TMP_321.$$arity = 3); Opal.defn(self, '$_reduce_468', TMP_322 = function $$_reduce_468(val, _values, result) { var self = this; result = self.$new_const(val['$[]'](0)); return result; }, TMP_322.$$arity = 3); Opal.defn(self, '$_reduce_469', TMP_323 = function $$_reduce_469(val, _values, result) { var self = this; result = self.$new_cvar(val['$[]'](0)); return result; }, TMP_323.$$arity = 3); Opal.defn(self, '$_reduce_470', TMP_324 = function $$_reduce_470(val, _values, result) { var self = this; result = self.$new_nil(val['$[]'](0)); return result; }, TMP_324.$$arity = 3); Opal.defn(self, '$_reduce_471', TMP_325 = function $$_reduce_471(val, _values, result) { var self = this; result = self.$new_self(val['$[]'](0)); return result; }, TMP_325.$$arity = 3); Opal.defn(self, '$_reduce_472', TMP_326 = function $$_reduce_472(val, _values, result) { var self = this; result = self.$new_true(val['$[]'](0)); return result; }, TMP_326.$$arity = 3); Opal.defn(self, '$_reduce_473', TMP_327 = function $$_reduce_473(val, _values, result) { var self = this; result = self.$new_false(val['$[]'](0)); return result; }, TMP_327.$$arity = 3); Opal.defn(self, '$_reduce_474', TMP_328 = function $$_reduce_474(val, _values, result) { var self = this; result = self.$new___FILE__(val['$[]'](0)); return result; }, TMP_328.$$arity = 3); Opal.defn(self, '$_reduce_475', TMP_329 = function $$_reduce_475(val, _values, result) { var self = this; result = self.$new___LINE__(val['$[]'](0)); return result; }, TMP_329.$$arity = 3); Opal.defn(self, '$_reduce_476', TMP_330 = function $$_reduce_476(val, _values, result) { var self = this; result = self.$new_var_ref(val['$[]'](0)); return result; }, TMP_330.$$arity = 3); Opal.defn(self, '$_reduce_477', TMP_331 = function $$_reduce_477(val, _values, result) { var self = this; result = self.$new_assignable(val['$[]'](0)); return result; }, TMP_331.$$arity = 3); Opal.defn(self, '$_reduce_478', TMP_332 = function $$_reduce_478(val, _values, result) { var self = this; result = self.$s("nth_ref", self.$value(val['$[]'](0))); return result; }, TMP_332.$$arity = 3); Opal.defn(self, '$_reduce_480', TMP_333 = function $$_reduce_480(val, _values, result) { var self = this; result = nil; return result; }, TMP_333.$$arity = 3); Opal.defn(self, '$_reduce_481', TMP_334 = function $$_reduce_481(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_334.$$arity = 3); Opal.defn(self, '$_reduce_482', TMP_335 = function $$_reduce_482(val, _values, result) { var self = this; result = nil; return result; }, TMP_335.$$arity = 3); Opal.defn(self, '$_reduce_483', TMP_336 = function $$_reduce_483(val, _values, result) { var $a, $b, self = this; result = val['$[]'](1); (($a = ["expr_beg"]), $b = self.$lexer(), $b['$lex_state='].apply($b, $a), $a[$a.length-1]); return result; }, TMP_336.$$arity = 3); Opal.defn(self, '$_reduce_484', TMP_337 = function $$_reduce_484(val, _values, result) { var $a, $b, self = this; result = val['$[]'](0); (($a = ["expr_beg"]), $b = self.$lexer(), $b['$lex_state='].apply($b, $a), $a[$a.length-1]); return result; }, TMP_337.$$arity = 3); Opal.defn(self, '$_reduce_487', TMP_338 = function $$_reduce_487(val, _values, result) { var self = this; result = self.$new_kwrestarg(val['$[]'](1)); return result; }, TMP_338.$$arity = 3); Opal.defn(self, '$_reduce_488', TMP_339 = function $$_reduce_488(val, _values, result) { var self = this; result = self.$new_kwrestarg(); return result; }, TMP_339.$$arity = 3); Opal.defn(self, '$_reduce_489', TMP_340 = function $$_reduce_489(val, _values, result) { var self = this; result = self.$new_sym(val['$[]'](0)); return result; }, TMP_340.$$arity = 3); Opal.defn(self, '$_reduce_490', TMP_341 = function $$_reduce_490(val, _values, result) { var self = this; result = self.$new_kwoptarg(val['$[]'](0), val['$[]'](1)); return result; }, TMP_341.$$arity = 3); Opal.defn(self, '$_reduce_491', TMP_342 = function $$_reduce_491(val, _values, result) { var self = this; result = self.$new_kwarg(val['$[]'](0)); return result; }, TMP_342.$$arity = 3); Opal.defn(self, '$_reduce_492', TMP_343 = function $$_reduce_492(val, _values, result) { var self = this; result = self.$new_kwoptarg(val['$[]'](0), val['$[]'](1)); return result; }, TMP_343.$$arity = 3); Opal.defn(self, '$_reduce_493', TMP_344 = function $$_reduce_493(val, _values, result) { var self = this; result = self.$new_kwarg(val['$[]'](0)); return result; }, TMP_344.$$arity = 3); Opal.defn(self, '$_reduce_494', TMP_345 = function $$_reduce_494(val, _values, result) { var self = this; result = [val['$[]'](0)]; return result; }, TMP_345.$$arity = 3); Opal.defn(self, '$_reduce_495', TMP_346 = function $$_reduce_495(val, _values, result) { var self = this; result = val['$[]'](0); result['$<<'](val['$[]'](2)); return result; }, TMP_346.$$arity = 3); Opal.defn(self, '$_reduce_496', TMP_347 = function $$_reduce_496(val, _values, result) { var self = this; result = [val['$[]'](0)]; return result; }, TMP_347.$$arity = 3); Opal.defn(self, '$_reduce_497', TMP_348 = function $$_reduce_497(val, _values, result) { var self = this; result = val['$[]'](0); result['$<<'](val['$[]'](2)); return result; }, TMP_348.$$arity = 3); Opal.defn(self, '$_reduce_498', TMP_349 = function $$_reduce_498(val, _values, result) { var self = this; result = self.$new_args_tail(val['$[]'](0), val['$[]'](2), val['$[]'](3)); return result; }, TMP_349.$$arity = 3); Opal.defn(self, '$_reduce_499', TMP_350 = function $$_reduce_499(val, _values, result) { var self = this; result = self.$new_args_tail(val['$[]'](0), nil, val['$[]'](1)); return result; }, TMP_350.$$arity = 3); Opal.defn(self, '$_reduce_500', TMP_351 = function $$_reduce_500(val, _values, result) { var self = this; result = self.$new_args_tail(nil, val['$[]'](0), val['$[]'](1)); return result; }, TMP_351.$$arity = 3); Opal.defn(self, '$_reduce_501', TMP_352 = function $$_reduce_501(val, _values, result) { var self = this; result = self.$new_args_tail(nil, nil, val['$[]'](0)); return result; }, TMP_352.$$arity = 3); Opal.defn(self, '$_reduce_502', TMP_353 = function $$_reduce_502(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_353.$$arity = 3); Opal.defn(self, '$_reduce_503', TMP_354 = function $$_reduce_503(val, _values, result) { var self = this; result = self.$new_args_tail(nil, nil, nil); return result; }, TMP_354.$$arity = 3); Opal.defn(self, '$_reduce_504', TMP_355 = function $$_reduce_504(val, _values, result) { var self = this, optarg = nil, restarg = nil; optarg = self.$new_optarg(val['$[]'](2)); restarg = self.$new_restarg(val['$[]'](4)); result = self.$new_args($rb_plus($rb_plus(val['$[]'](0), optarg), restarg), val['$[]'](5)); return result; }, TMP_355.$$arity = 3); Opal.defn(self, '$_reduce_505', TMP_356 = function $$_reduce_505(val, _values, result) { var self = this, optarg = nil, restarg = nil; optarg = self.$new_optarg(val['$[]'](2)); restarg = self.$new_restarg(val['$[]'](4)); result = self.$new_args($rb_plus($rb_plus($rb_plus(val['$[]'](0), optarg), restarg), val['$[]'](6)), val['$[]'](7)); return result; }, TMP_356.$$arity = 3); Opal.defn(self, '$_reduce_506', TMP_357 = function $$_reduce_506(val, _values, result) { var self = this, optarg = nil; optarg = self.$new_optarg(val['$[]'](2)); result = self.$new_args($rb_plus(val['$[]'](0), optarg), val['$[]'](3)); return result; }, TMP_357.$$arity = 3); Opal.defn(self, '$_reduce_507', TMP_358 = function $$_reduce_507(val, _values, result) { var self = this, optarg = nil; optarg = self.$new_optarg(val['$[]'](2)); result = self.$new_args($rb_plus($rb_plus(val['$[]'](0), optarg), val['$[]'](4)), val['$[]'](5)); return result; }, TMP_358.$$arity = 3); Opal.defn(self, '$_reduce_508', TMP_359 = function $$_reduce_508(val, _values, result) { var self = this, restarg = nil; restarg = self.$new_restarg(val['$[]'](2)); result = self.$new_args($rb_plus(val['$[]'](0), restarg), val['$[]'](3)); return result; }, TMP_359.$$arity = 3); Opal.defn(self, '$_reduce_509', TMP_360 = function $$_reduce_509(val, _values, result) { var self = this, restarg = nil; restarg = self.$new_restarg(val['$[]'](2)); result = self.$new_args($rb_plus($rb_plus(val['$[]'](0), restarg), val['$[]'](4)), val['$[]'](5)); return result; }, TMP_360.$$arity = 3); Opal.defn(self, '$_reduce_510', TMP_361 = function $$_reduce_510(val, _values, result) { var self = this; result = self.$new_args(val['$[]'](0), val['$[]'](1)); return result; }, TMP_361.$$arity = 3); Opal.defn(self, '$_reduce_511', TMP_362 = function $$_reduce_511(val, _values, result) { var self = this, optarg = nil, restarg = nil; optarg = self.$new_optarg(val['$[]'](0)); restarg = self.$new_restarg(val['$[]'](2)); result = self.$new_args($rb_plus(optarg, restarg), val['$[]'](3)); return result; }, TMP_362.$$arity = 3); Opal.defn(self, '$_reduce_512', TMP_363 = function $$_reduce_512(val, _values, result) { var self = this, optarg = nil, restarg = nil; optarg = self.$new_optarg(val['$[]'](0)); restarg = self.$new_restarg(val['$[]'](2)); result = self.$new_args($rb_plus($rb_plus(optarg, restarg), val['$[]'](4)), val['$[]'](5)); return result; }, TMP_363.$$arity = 3); Opal.defn(self, '$_reduce_513', TMP_364 = function $$_reduce_513(val, _values, result) { var self = this, optarg = nil; optarg = self.$new_optarg(val['$[]'](0)); result = self.$new_args(optarg, val['$[]'](1)); return result; }, TMP_364.$$arity = 3); Opal.defn(self, '$_reduce_514', TMP_365 = function $$_reduce_514(val, _values, result) { var self = this, optarg = nil; optarg = self.$new_optarg(val['$[]'](0)); result = self.$new_args($rb_plus(optarg, val['$[]'](2)), val['$[]'](3)); return result; }, TMP_365.$$arity = 3); Opal.defn(self, '$_reduce_515', TMP_366 = function $$_reduce_515(val, _values, result) { var self = this, optarg = nil; optarg = self.$new_restarg(val['$[]'](0)); result = self.$new_args(optarg, val['$[]'](1)); return result; }, TMP_366.$$arity = 3); Opal.defn(self, '$_reduce_516', TMP_367 = function $$_reduce_516(val, _values, result) { var self = this, restarg = nil; restarg = self.$new_restarg(val['$[]'](0)); result = self.$new_args($rb_plus(restarg, val['$[]'](2)), val['$[]'](3)); return result; }, TMP_367.$$arity = 3); Opal.defn(self, '$_reduce_517', TMP_368 = function $$_reduce_517(val, _values, result) { var self = this; result = self.$new_args(nil, val['$[]'](0)); return result; }, TMP_368.$$arity = 3); Opal.defn(self, '$_reduce_518', TMP_369 = function $$_reduce_518(val, _values, result) { var self = this; result = self.$new_args(nil, nil); return result; }, TMP_369.$$arity = 3); Opal.defn(self, '$_reduce_520', TMP_370 = function $$_reduce_520(val, _values, result) { var self = this; result = self.$value(val['$[]'](0)).$to_sym(); self.$scope().$add_local(result); return result; }, TMP_370.$$arity = 3); Opal.defn(self, '$_reduce_521', TMP_371 = function $$_reduce_521(val, _values, result) { var self = this; self.$raise("formal argument cannot be a constant"); return result; }, TMP_371.$$arity = 3); Opal.defn(self, '$_reduce_522', TMP_372 = function $$_reduce_522(val, _values, result) { var self = this; self.$raise("formal argument cannot be an instance variable"); return result; }, TMP_372.$$arity = 3); Opal.defn(self, '$_reduce_523', TMP_373 = function $$_reduce_523(val, _values, result) { var self = this; self.$raise("formal argument cannot be a class variable"); return result; }, TMP_373.$$arity = 3); Opal.defn(self, '$_reduce_524', TMP_374 = function $$_reduce_524(val, _values, result) { var self = this; self.$raise("formal argument cannot be a global variable"); return result; }, TMP_374.$$arity = 3); Opal.defn(self, '$_reduce_525', TMP_375 = function $$_reduce_525(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_375.$$arity = 3); Opal.defn(self, '$_reduce_526', TMP_376 = function $$_reduce_526(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_376.$$arity = 3); Opal.defn(self, '$_reduce_529', TMP_377 = function $$_reduce_529(val, _values, result) { var self = this; result = self.$s("arg", val['$[]'](0)); return result; }, TMP_377.$$arity = 3); Opal.defn(self, '$_reduce_530', TMP_378 = function $$_reduce_530(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_378.$$arity = 3); Opal.defn(self, '$_reduce_531', TMP_379 = function $$_reduce_531(val, _values, result) { var self = this; result = self.$s("mlhs", val['$[]'](0)); return result; }, TMP_379.$$arity = 3); Opal.defn(self, '$_reduce_532', TMP_380 = function $$_reduce_532(val, _values, result) { var self = this; val['$[]'](0)['$<<'](val['$[]'](2)); result = val['$[]'](0); return result; }, TMP_380.$$arity = 3); Opal.defn(self, '$_reduce_534', TMP_381 = function $$_reduce_534(val, _values, result) { var self = this; result = val['$[]'](0).$push(self.$s("restarg", val['$[]'](3))); return result; }, TMP_381.$$arity = 3); Opal.defn(self, '$_reduce_535', TMP_382 = function $$_reduce_535(val, _values, result) { var self = this; result = val['$[]'](0).$push(self.$s("restarg", val['$[]'](3))).$concat(val['$[]'](5)['$[]']($range(1, -1, false))); return result; }, TMP_382.$$arity = 3); Opal.defn(self, '$_reduce_536', TMP_383 = function $$_reduce_536(val, _values, result) { var self = this; result = val['$[]'](0).$push(self.$s("restarg")); return result; }, TMP_383.$$arity = 3); Opal.defn(self, '$_reduce_537', TMP_384 = function $$_reduce_537(val, _values, result) { var self = this; result = val['$[]'](0).$push(self.$s("restarg")).$concat(val['$[]'](4)['$[]']($range(1, -1, false))); return result; }, TMP_384.$$arity = 3); Opal.defn(self, '$_reduce_538', TMP_385 = function $$_reduce_538(val, _values, result) { var self = this; result = self.$s("mlhs", self.$s("restarg", val['$[]'](1))); return result; }, TMP_385.$$arity = 3); Opal.defn(self, '$_reduce_539', TMP_386 = function $$_reduce_539(val, _values, result) { var self = this; val['$[]'](3).$insert(1, self.$s("restarg", val['$[]'](1))); result = val['$[]'](3); return result; }, TMP_386.$$arity = 3); Opal.defn(self, '$_reduce_540', TMP_387 = function $$_reduce_540(val, _values, result) { var self = this; result = self.$s("mlhs", self.$s("restarg")); return result; }, TMP_387.$$arity = 3); Opal.defn(self, '$_reduce_541', TMP_388 = function $$_reduce_541(val, _values, result) { var self = this; val['$[]'](2).$insert(1, self.$s("restarg")); result = val['$[]'](2); return result; }, TMP_388.$$arity = 3); Opal.defn(self, '$_reduce_542', TMP_389 = function $$_reduce_542(val, _values, result) { var self = this; result = [val['$[]'](0)]; return result; }, TMP_389.$$arity = 3); Opal.defn(self, '$_reduce_543', TMP_390 = function $$_reduce_543(val, _values, result) { var self = this; val['$[]'](0)['$<<'](val['$[]'](2)); result = val['$[]'](0); return result; }, TMP_390.$$arity = 3); Opal.defn(self, '$_reduce_544', TMP_391 = function $$_reduce_544(val, _values, result) { var self = this; result = self.$new_assign(self.$new_assignable(self.$new_ident(val['$[]'](0))), val['$[]'](1), val['$[]'](2)); return result; }, TMP_391.$$arity = 3); Opal.defn(self, '$_reduce_545', TMP_392 = function $$_reduce_545(val, _values, result) { var self = this; result = self.$s("block", val['$[]'](0)); return result; }, TMP_392.$$arity = 3); Opal.defn(self, '$_reduce_546', TMP_393 = function $$_reduce_546(val, _values, result) { var self = this; result = val['$[]'](0); val['$[]'](0)['$<<'](val['$[]'](2)); return result; }, TMP_393.$$arity = 3); Opal.defn(self, '$_reduce_549', TMP_394 = function $$_reduce_549(val, _values, result) { var self = this; result = (("*") + (self.$value(val['$[]'](1)))).$to_sym(); return result; }, TMP_394.$$arity = 3); Opal.defn(self, '$_reduce_550', TMP_395 = function $$_reduce_550(val, _values, result) { var self = this; result = "*"; return result; }, TMP_395.$$arity = 3); Opal.defn(self, '$_reduce_553', TMP_396 = function $$_reduce_553(val, _values, result) { var self = this; result = (("&") + (self.$value(val['$[]'](1)))).$to_sym(); return result; }, TMP_396.$$arity = 3); Opal.defn(self, '$_reduce_554', TMP_397 = function $$_reduce_554(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_397.$$arity = 3); Opal.defn(self, '$_reduce_555', TMP_398 = function $$_reduce_555(val, _values, result) { var self = this; result = nil; return result; }, TMP_398.$$arity = 3); Opal.defn(self, '$_reduce_556', TMP_399 = function $$_reduce_556(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_399.$$arity = 3); Opal.defn(self, '$_reduce_557', TMP_400 = function $$_reduce_557(val, _values, result) { var self = this; result = val['$[]'](1); return result; }, TMP_400.$$arity = 3); Opal.defn(self, '$_reduce_558', TMP_401 = function $$_reduce_558(val, _values, result) { var self = this; result = []; return result; }, TMP_401.$$arity = 3); Opal.defn(self, '$_reduce_559', TMP_402 = function $$_reduce_559(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_402.$$arity = 3); Opal.defn(self, '$_reduce_560', TMP_403 = function $$_reduce_560(val, _values, result) { var self = this; result = val['$[]'](0); return result; }, TMP_403.$$arity = 3); Opal.defn(self, '$_reduce_561', TMP_404 = function $$_reduce_561(val, _values, result) { var self = this; result = val['$[]'](0).$concat(val['$[]'](2)); return result; }, TMP_404.$$arity = 3); Opal.defn(self, '$_reduce_562', TMP_405 = function $$_reduce_562(val, _values, result) { var self = this; result = [val['$[]'](0), val['$[]'](2)]; return result; }, TMP_405.$$arity = 3); Opal.defn(self, '$_reduce_563', TMP_406 = function $$_reduce_563(val, _values, result) { var self = this; result = [self.$new_sym(val['$[]'](0)), val['$[]'](1)]; return result; }, TMP_406.$$arity = 3); Opal.defn(self, '$_reduce_564', TMP_407 = function $$_reduce_564(val, _values, result) { var self = this; result = [self.$s("sym", self.$source(val['$[]'](1)).$to_sym()), val['$[]'](3)]; return result; }, TMP_407.$$arity = 3); Opal.defn(self, '$_reduce_565', TMP_408 = function $$_reduce_565(val, _values, result) { var self = this; result = [self.$new_kwsplat(val['$[]'](1))]; return result; }, TMP_408.$$arity = 3); Opal.defn(self, '$_reduce_589', TMP_409 = function $$_reduce_589(val, _values, result) { var self = this; result = nil; return result; }, TMP_409.$$arity = 3); return (Opal.defn(self, '$_reduce_none', TMP_410 = function $$_reduce_none(val, _values, result) { var self = this; return val['$[]'](0); }, TMP_410.$$arity = 3), nil) && '_reduce_none'; })($scope.base, (($scope.get('Racc')).$$scope.get('Parser'))) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/parser/parser_scope"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$attr_reader', '$attr_accessor', '$==', '$<<', '$include?', '$has_local?']); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ParserScope(){}; var self = $ParserScope = $klass($base, $super, 'ParserScope', $ParserScope); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3; def.locals = def.parent = def.block = nil; self.$attr_reader("locals"); self.$attr_accessor("parent"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(type) { var self = this; self.block = type['$==']("block"); self.locals = []; return self.parent = nil; }, TMP_1.$$arity = 1); Opal.defn(self, '$add_local', TMP_2 = function $$add_local(local) { var self = this; return self.locals['$<<'](local); }, TMP_2.$$arity = 1); return (Opal.defn(self, '$has_local?', TMP_3 = function(local) { var $a, $b, self = this; if ((($a = self.locals['$include?'](local)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return true}; if ((($a = ($b = self.parent, $b !== false && $b !== nil && $b != null ?self.block : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.parent['$has_local?'](local)}; return false; }, TMP_3.$$arity = 1), nil) && 'has_local?'; })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/parser"] = function(Opal) { function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$require', '$attr_reader', '$!', '$[]', '$new', '$parser=', '$parse_to_sexp', '$join', '$message', '$line', '$lexer', '$column', '$split', '$-', '$+', '$*', '$>', '$raise', '$class', '$backtrace', '$push_scope', '$do_parse', '$pop_scope', '$next_token', '$last', '$parent=', '$<<', '$pop', '$inspect', '$value', '$token_to_str', '$s', '$source=', '$s0', '$source', '$s1', '$file', '$to_sym', '$nil?', '$==', '$length', '$size', '$type', '$each', '$!=', '$empty?', '$add_local', '$scope', '$map', '$is_a?', '$to_s', '$children', '$===', '$new_splat', '$[]=', '$meta', '$concat', '$new_call', '$array', '$-@', '$new_gettable', '$type=', '$has_local?']); self.$require("opal/parser/sexp"); self.$require("opal/parser/lexer"); self.$require("opal/parser/grammar"); self.$require("opal/parser/parser_scope"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Parser(){}; var self = $Parser = $klass($base, $super, 'Parser', $Parser); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_40, TMP_41, TMP_42, TMP_43, TMP_44, TMP_45, TMP_46, TMP_47, TMP_48, TMP_49, TMP_50, TMP_52, TMP_53, TMP_56, TMP_57, TMP_58, TMP_59, TMP_60, TMP_61, TMP_62, TMP_65, TMP_66, TMP_67, TMP_68, TMP_69, TMP_70, TMP_71, TMP_72, TMP_73, TMP_74, TMP_75, TMP_76, TMP_77, TMP_78, TMP_79, TMP_80, TMP_81, TMP_82, TMP_83, TMP_84, TMP_85, TMP_86, TMP_87, TMP_88, TMP_89, TMP_90, TMP_91, TMP_92, TMP_93, TMP_94, TMP_95; def.lexer = def.file = def.scopes = nil; self.$attr_reader("lexer", "file", "scope"); Opal.defn(self, '$parse', TMP_1 = function $$parse(source, file) { var $a, $b, self = this, error = nil, message = nil; if (file == null) { file = "(string)"; } try { if ((($a = $scope.get('ENV')['$[]']("RACC_DEBUG")['$!']()['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.yydebug = true}; self.file = file; self.scopes = []; self.lexer = $scope.get('Lexer').$new(source, file); (($a = [self]), $b = self.lexer, $b['$parser='].apply($b, $a), $a[$a.length-1]); return self.$parse_to_sexp(); } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) {error = $err; try { message = [nil, error.$message(), "Source: " + (self.file) + ":" + (self.$lexer().$line()) + ":" + (self.$lexer().$column()), source.$split("\n")['$[]']($rb_minus(self.$lexer().$line(), 1)), $rb_plus($rb_times("~", ((function() {if ((($a = $rb_gt($rb_minus(self.$lexer().$column(), 1), 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $rb_minus(self.$lexer().$column(), 1) } else { return 0 }; return nil; })())), "^")].$join("\n"); return self.$raise(error.$class(), message, error.$backtrace()); } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_1.$$arity = -2); Opal.defn(self, '$parse_to_sexp', TMP_2 = function $$parse_to_sexp() { var self = this, result = nil; self.$push_scope(); result = self.$do_parse(); self.$pop_scope(); return result; }, TMP_2.$$arity = 0); Opal.defn(self, '$next_token', TMP_3 = function $$next_token() { var self = this; return self.lexer.$next_token(); }, TMP_3.$$arity = 0); Opal.defn(self, '$s', TMP_4 = function $$s($a_rest) { var self = this, parts; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } parts = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { parts[$arg_idx - 0] = arguments[$arg_idx]; } return $scope.get('Sexp').$new(parts); }, TMP_4.$$arity = -1); Opal.defn(self, '$push_scope', TMP_5 = function $$push_scope(type) { var $a, $b, self = this, top = nil, scope = nil; if (type == null) { type = nil; } top = self.scopes.$last(); scope = $scope.get('ParserScope').$new(type); (($a = [top]), $b = scope, $b['$parent='].apply($b, $a), $a[$a.length-1]); self.scopes['$<<'](scope); return self.scope = scope; }, TMP_5.$$arity = -1); Opal.defn(self, '$pop_scope', TMP_6 = function $$pop_scope() { var self = this; self.scopes.$pop(); return self.scope = self.scopes.$last(); }, TMP_6.$$arity = 0); Opal.defn(self, '$on_error', TMP_7 = function $$on_error(t, val, vstack) { var $a, self = this; return self.$raise("parse error on value " + (self.$value(val).$inspect()) + " (" + (((($a = self.$token_to_str(t)) !== false && $a !== nil && $a != null) ? $a : "?")) + ") :" + (self.file) + ":" + (self.$lexer().$line())); }, TMP_7.$$arity = 3); Opal.defn(self, '$value', TMP_8 = function $$value(tok) { var self = this; return tok['$[]'](0); }, TMP_8.$$arity = 1); Opal.defn(self, '$source', TMP_9 = function $$source(tok) { var self = this; if (tok !== false && tok !== nil && tok != null) { return tok['$[]'](1) } else { return nil }; }, TMP_9.$$arity = 1); Opal.defn(self, '$s0', TMP_10 = function $$s0(type, source) { var $a, $b, self = this, sexp = nil; sexp = self.$s(type); (($a = [source]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_10.$$arity = 2); Opal.defn(self, '$s1', TMP_11 = function $$s1(type, first, source) { var $a, $b, self = this, sexp = nil; sexp = self.$s(type, first); (($a = [source]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_11.$$arity = 3); Opal.defn(self, '$new_nil', TMP_12 = function $$new_nil(tok) { var self = this; return self.$s0("nil", self.$source(tok)); }, TMP_12.$$arity = 1); Opal.defn(self, '$new_self', TMP_13 = function $$new_self(tok) { var self = this; return self.$s0("self", self.$source(tok)); }, TMP_13.$$arity = 1); Opal.defn(self, '$new_true', TMP_14 = function $$new_true(tok) { var self = this; return self.$s0("true", self.$source(tok)); }, TMP_14.$$arity = 1); Opal.defn(self, '$new_false', TMP_15 = function $$new_false(tok) { var self = this; return self.$s0("false", self.$source(tok)); }, TMP_15.$$arity = 1); Opal.defn(self, '$new___FILE__', TMP_16 = function $$new___FILE__(tok) { var self = this; return self.$s1("str", self.$file(), self.$source(tok)); }, TMP_16.$$arity = 1); Opal.defn(self, '$new___LINE__', TMP_17 = function $$new___LINE__(tok) { var self = this; return self.$s1("int", self.$lexer().$line(), self.$source(tok)); }, TMP_17.$$arity = 1); Opal.defn(self, '$new_ident', TMP_18 = function $$new_ident(tok) { var self = this; return self.$s1("identifier", self.$value(tok).$to_sym(), self.$source(tok)); }, TMP_18.$$arity = 1); Opal.defn(self, '$new_int', TMP_19 = function $$new_int(tok) { var self = this; return self.$s1("int", self.$value(tok), self.$source(tok)); }, TMP_19.$$arity = 1); Opal.defn(self, '$new_float', TMP_20 = function $$new_float(tok) { var self = this; return self.$s1("float", self.$value(tok), self.$source(tok)); }, TMP_20.$$arity = 1); Opal.defn(self, '$new_ivar', TMP_21 = function $$new_ivar(tok) { var self = this; return self.$s1("ivar", self.$value(tok).$to_sym(), self.$source(tok)); }, TMP_21.$$arity = 1); Opal.defn(self, '$new_gvar', TMP_22 = function $$new_gvar(tok) { var self = this; return self.$s1("gvar", self.$value(tok).$to_sym(), self.$source(tok)); }, TMP_22.$$arity = 1); Opal.defn(self, '$new_cvar', TMP_23 = function $$new_cvar(tok) { var self = this; return self.$s1("cvar", self.$value(tok).$to_sym(), self.$source(tok)); }, TMP_23.$$arity = 1); Opal.defn(self, '$new_const', TMP_24 = function $$new_const(tok) { var self = this; return self.$s1("const", self.$value(tok).$to_sym(), self.$source(tok)); }, TMP_24.$$arity = 1); Opal.defn(self, '$new_colon2', TMP_25 = function $$new_colon2(lhs, tok, name) { var $a, $b, self = this, sexp = nil; sexp = self.$s("colon2", lhs, self.$value(name).$to_sym()); (($a = [self.$source(tok)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_25.$$arity = 3); Opal.defn(self, '$new_colon3', TMP_26 = function $$new_colon3(tok, name) { var self = this; return self.$s1("colon3", self.$value(name).$to_sym(), self.$source(name)); }, TMP_26.$$arity = 2); Opal.defn(self, '$new_sym', TMP_27 = function $$new_sym(tok) { var self = this; return self.$s1("sym", self.$value(tok).$to_sym(), self.$source(tok)); }, TMP_27.$$arity = 1); Opal.defn(self, '$new_alias', TMP_28 = function $$new_alias(kw, new$, old) { var $a, $b, self = this, sexp = nil; sexp = self.$s("alias", new$, old); (($a = [self.$source(kw)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_28.$$arity = 3); Opal.defn(self, '$new_break', TMP_29 = function $$new_break(kw, args) { var $a, self = this, sexp = nil; if (args == null) { args = nil; } if ((($a = args['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { sexp = self.$s("break") } else if (args.$length()['$=='](1)) { sexp = self.$s("break", args['$[]'](0)) } else { sexp = self.$s("break", ($a = self).$s.apply($a, ["array"].concat(Opal.to_a(args)))) }; return sexp; }, TMP_29.$$arity = -2); Opal.defn(self, '$new_return', TMP_30 = function $$new_return(kw, args) { var $a, self = this, sexp = nil; if (args == null) { args = nil; } if ((($a = args['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { sexp = self.$s("return") } else if (args.$length()['$=='](1)) { sexp = self.$s("return", args['$[]'](0)) } else { sexp = self.$s("return", ($a = self).$s.apply($a, ["array"].concat(Opal.to_a(args)))) }; return sexp; }, TMP_30.$$arity = -2); Opal.defn(self, '$new_next', TMP_31 = function $$new_next(kw, args) { var $a, self = this, sexp = nil; if (args == null) { args = []; } if (args.$length()['$=='](1)) { sexp = self.$s("next", args['$[]'](0)) } else { sexp = self.$s("next", ($a = self).$s.apply($a, ["array"].concat(Opal.to_a(args)))) }; return sexp; }, TMP_31.$$arity = -2); Opal.defn(self, '$new_block', TMP_32 = function $$new_block(stmt) { var self = this, sexp = nil; if (stmt == null) { stmt = nil; } sexp = self.$s("block"); if (stmt !== false && stmt !== nil && stmt != null) { sexp['$<<'](stmt)}; return sexp; }, TMP_32.$$arity = -1); Opal.defn(self, '$new_compstmt', TMP_33 = function $$new_compstmt(block) { var $a, $b, $c, self = this, comp = nil, result = nil; comp = (function() {if (block.$size()['$=='](1)) { return nil } else if (block.$size()['$=='](2)) { return block['$[]'](1) } else { return block }; return nil; })(); if ((($a = ($b = (($c = comp !== false && comp !== nil && comp != null) ? comp.$type()['$==']("begin") : comp), $b !== false && $b !== nil && $b != null ?comp.$size()['$=='](2) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = comp['$[]'](1) } else { result = comp }; return result; }, TMP_33.$$arity = 1); Opal.defn(self, '$new_body', TMP_35 = function $$new_body(compstmt, res, els, ens) { var $a, $b, TMP_34, self = this, s = nil; s = ((($a = compstmt) !== false && $a !== nil && $a != null) ? $a : self.$s("block")); if (res !== false && res !== nil && res != null) { s = self.$s("rescue", s); ($a = ($b = res).$each, $a.$$p = (TMP_34 = function(r){var self = TMP_34.$$s || this; if (r == null) r = nil; return s['$<<'](r)}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34), $a).call($b); if (els !== false && els !== nil && els != null) { s['$<<'](els)};}; if (ens !== false && ens !== nil && ens != null) { return self.$s("ensure", s, ens) } else { return s }; }, TMP_35.$$arity = 4); Opal.defn(self, '$new_def', TMP_36 = function $$new_def(kw, recv, name, args, body, end_tok) { var $a, $b, self = this, sexp = nil; if ((($a = body.$type()['$!=']("block")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { body = self.$s("block", body)}; if (body.$size()['$=='](1)) { body['$<<'](self.$s("nil"))}; sexp = self.$s("def", recv, self.$value(name).$to_sym(), args, body); (($a = [self.$source(kw)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_36.$$arity = 6); Opal.defn(self, '$new_class', TMP_37 = function $$new_class(start, path, sup, body, endt) { var $a, $b, self = this, sexp = nil; sexp = self.$s("class", path, sup, body); (($a = [self.$source(start)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_37.$$arity = 5); Opal.defn(self, '$new_sclass', TMP_38 = function $$new_sclass(kw, expr, body, end_tok) { var $a, $b, self = this, sexp = nil; sexp = self.$s("sclass", expr, body); (($a = [self.$source(kw)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_38.$$arity = 4); Opal.defn(self, '$new_module', TMP_39 = function $$new_module(kw, path, body, end_tok) { var $a, $b, self = this, sexp = nil; sexp = self.$s("module", path, body); (($a = [self.$source(kw)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_39.$$arity = 4); Opal.defn(self, '$new_iter', TMP_40 = function $$new_iter(args, body) { var $a, self = this, s = nil; ((($a = args) !== false && $a !== nil && $a != null) ? $a : args = nil); s = self.$s("iter", args); if (body !== false && body !== nil && body != null) { s['$<<'](body)}; return s; }, TMP_40.$$arity = 2); Opal.defn(self, '$new_if', TMP_41 = function $$new_if(if_tok, expr, stmt, tail) { var $a, $b, self = this, sexp = nil; sexp = self.$s("if", expr, stmt, tail); (($a = [self.$source(if_tok)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_41.$$arity = 4); Opal.defn(self, '$new_while', TMP_42 = function $$new_while(kw, test, body) { var $a, $b, self = this, sexp = nil; sexp = self.$s("while", test, body); (($a = [self.$source(kw)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_42.$$arity = 3); Opal.defn(self, '$new_until', TMP_43 = function $$new_until(kw, test, body) { var $a, $b, self = this, sexp = nil; sexp = self.$s("until", test, body); (($a = [self.$source(kw)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_43.$$arity = 3); Opal.defn(self, '$new_rescue_mod', TMP_44 = function $$new_rescue_mod(kw, expr, resc) { var $a, $b, self = this, sexp = nil; sexp = self.$s("rescue_mod", expr, resc); (($a = [self.$source(kw)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_44.$$arity = 3); Opal.defn(self, '$new_array', TMP_45 = function $$new_array(start, args, finish) { var $a, $b, $c, self = this, sexp = nil; ((($a = args) !== false && $a !== nil && $a != null) ? $a : args = []); sexp = ($a = self).$s.apply($a, ["array"].concat(Opal.to_a(args))); (($b = [self.$source(start)]), $c = sexp, $c['$source='].apply($c, $b), $b[$b.length-1]); return sexp; }, TMP_45.$$arity = 3); Opal.defn(self, '$new_hash', TMP_46 = function $$new_hash(open, assocs, close) { var $a, $b, $c, self = this, sexp = nil; sexp = ($a = self).$s.apply($a, ["hash"].concat(Opal.to_a(assocs))); (($b = [self.$source(open)]), $c = sexp, $c['$source='].apply($c, $b), $b[$b.length-1]); return sexp; }, TMP_46.$$arity = 3); Opal.defn(self, '$new_not', TMP_47 = function $$new_not(kw, expr) { var self = this; return self.$s1("not", expr, self.$source(kw)); }, TMP_47.$$arity = 2); Opal.defn(self, '$new_paren', TMP_48 = function $$new_paren(open, expr, close) { var $a, $b, self = this; if ((($a = ((($b = expr['$nil?']()) !== false && $b !== nil && $b != null) ? $b : expr['$=='](["block"]))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$s1("paren", self.$s0("nil", self.$source(open)), self.$source(open)) } else { return self.$s1("paren", expr, self.$source(open)) }; }, TMP_48.$$arity = 3); Opal.defn(self, '$new_args_tail', TMP_49 = function $$new_args_tail(kwarg, kwrest, block) { var self = this; return [kwarg, kwrest, block]; }, TMP_49.$$arity = 3); Opal.defn(self, '$new_restarg', TMP_50 = function $$new_restarg(rest) { var $a, self = this, restname = nil; restname = rest['$[]']($range(1, -1, false)); if ((($a = restname['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [self.$s("restarg")] } else { self.$scope().$add_local(restname.$to_sym()); return [self.$s("restarg", restname.$to_sym())]; }; }, TMP_50.$$arity = 1); Opal.defn(self, '$new_optarg', TMP_52 = function $$new_optarg(opt) { var $a, $b, TMP_51, self = this; if (opt !== false && opt !== nil && opt != null) { return ($a = ($b = opt['$[]']($range(1, -1, false))).$map, $a.$$p = (TMP_51 = function(_opt){var self = TMP_51.$$s || this; if (_opt == null) _opt = nil; return self.$s("optarg", _opt['$[]'](1), _opt['$[]'](2))}, TMP_51.$$s = self, TMP_51.$$arity = 1, TMP_51), $a).call($b) } else { return nil }; }, TMP_52.$$arity = 1); Opal.defn(self, '$new_shadowarg', TMP_53 = function $$new_shadowarg(shadowarg) { var self = this, shadowname = nil; if (shadowarg !== false && shadowarg !== nil && shadowarg != null) { shadowname = self.$value(shadowarg).$to_sym(); self.$scope().$add_local(shadowname); return self.$s("shadowarg", shadowname); } else { return nil }; }, TMP_53.$$arity = 1); Opal.defn(self, '$new_args', TMP_56 = function $$new_args(norm, tail) { var $a, $b, TMP_54, $c, TMP_55, $d, self = this, res = nil, blockname = nil; res = self.$s("args"); if (norm !== false && norm !== nil && norm != null) { ($a = ($b = norm).$each, $a.$$p = (TMP_54 = function(arg){var self = TMP_54.$$s || this, $c; if (arg == null) arg = nil; if ((($c = arg['$is_a?']($scope.get('Sexp'))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return res['$<<'](arg) } else { self.$scope().$add_local(arg); return res['$<<'](self.$s("arg", arg)); }}, TMP_54.$$s = self, TMP_54.$$arity = 1, TMP_54), $a).call($b)}; if ((($a = (($c = tail !== false && tail !== nil && tail != null) ? tail['$[]'](0) : tail)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { ($a = ($c = tail['$[]'](0)).$each, $a.$$p = (TMP_55 = function(kwarg){var self = TMP_55.$$s || this; if (kwarg == null) kwarg = nil; return res['$<<'](kwarg)}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55), $a).call($c)}; if ((($a = (($d = tail !== false && tail !== nil && tail != null) ? tail['$[]'](1) : tail)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { res['$<<'](tail['$[]'](1))}; if ((($a = (($d = tail !== false && tail !== nil && tail != null) ? tail['$[]'](2) : tail)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { blockname = tail['$[]'](2).$to_s()['$[]']($range(1, -1, false)).$to_sym(); self.$scope().$add_local(blockname); res['$<<'](self.$s("blockarg", blockname));}; return res; }, TMP_56.$$arity = 2); Opal.defn(self, '$new_kwarg', TMP_57 = function $$new_kwarg(name) { var self = this; self.$scope().$add_local(name['$[]'](1)); return self.$s("kwarg", name['$[]'](1)); }, TMP_57.$$arity = 1); Opal.defn(self, '$new_kwoptarg', TMP_58 = function $$new_kwoptarg(name, val) { var self = this; self.$scope().$add_local(name['$[]'](1)); return self.$s("kwoptarg", name['$[]'](1), val); }, TMP_58.$$arity = 2); Opal.defn(self, '$new_kwrestarg', TMP_59 = function $$new_kwrestarg(name) { var self = this, result = nil; if (name == null) { name = nil; } result = self.$s("kwrestarg"); if (name !== false && name !== nil && name != null) { self.$scope().$add_local(name['$[]'](0).$to_sym()); result['$<<'](name['$[]'](0).$to_sym());}; return result; }, TMP_59.$$arity = -1); Opal.defn(self, '$new_kwsplat', TMP_60 = function $$new_kwsplat(hash) { var self = this; return self.$s("kwsplat", hash); }, TMP_60.$$arity = 1); Opal.defn(self, '$new_method_call_with_block', TMP_61 = function $$new_method_call_with_block(method_call, block_arg) { var $a, $b, self = this, receiver = nil, method_name = nil, call_args = nil, last_arg = nil; $a = Opal.to_a(method_call.$children()), receiver = ($a[0] == null ? nil : $a[0]), method_name = ($a[1] == null ? nil : $a[1]), call_args = ($a[2] == null ? nil : $a[2]), $a; if ((($a = (($b = call_args !== false && call_args !== nil && call_args != null) ? block_arg : call_args)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { last_arg = call_args.$last(); if ((($a = ($b = $scope.get('Sexp')['$==='](last_arg), $b !== false && $b !== nil && $b != null ?last_arg.$type()['$==']("block_pass") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise("both block argument and literal block are passed")};}; return method_call['$<<'](block_arg); }, TMP_61.$$arity = 2); Opal.defn(self, '$new_block_arg_splat', TMP_62 = function $$new_block_arg_splat(rest) { var self = this, r = nil; if (rest !== false && rest !== nil && rest != null) { r = rest.$to_s()['$[]']($range(1, -1, false)).$to_sym(); self.$scope().$add_local(r); return self.$new_splat(nil, self.$s("lasgn", r)); } else { return nil }; }, TMP_62.$$arity = 1); Opal.defn(self, '$new_block_args', TMP_65 = function $$new_block_args(norm, tail, shadow_args) { var $a, $b, TMP_63, $c, TMP_64, $d, self = this, res = nil, block = nil; if (shadow_args == null) { shadow_args = nil; } res = self.$s("args"); if (norm !== false && norm !== nil && norm != null) { ($a = ($b = norm).$each, $a.$$p = (TMP_63 = function(arg){var self = TMP_63.$$s || this, $c; if (arg == null) arg = nil; if ((($c = arg['$is_a?']($scope.get('Symbol'))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$scope().$add_local(arg); return res['$<<'](self.$s("arg", arg)); } else if ((($c = arg['$is_a?']($scope.get('Sexp'))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return res['$<<'](arg) } else if ((($c = arg['$nil?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return res.$meta()['$[]=']("has_trailing_comma", true) } else { return nil }}, TMP_63.$$s = self, TMP_63.$$arity = 1, TMP_63), $a).call($b)}; if ((($a = (($c = tail !== false && tail !== nil && tail != null) ? tail['$[]'](0) : tail)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { ($a = ($c = tail['$[]'](0)).$each, $a.$$p = (TMP_64 = function(kwarg){var self = TMP_64.$$s || this; if (kwarg == null) kwarg = nil; return res['$<<'](kwarg)}, TMP_64.$$s = self, TMP_64.$$arity = 1, TMP_64), $a).call($c)}; if ((($a = (($d = tail !== false && tail !== nil && tail != null) ? tail['$[]'](1) : tail)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { res['$<<'](tail['$[]'](1))}; if ((($a = (($d = tail !== false && tail !== nil && tail != null) ? tail['$[]'](2) : tail)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { block = tail['$[]'](2).$to_s()['$[]']($range(1, -1, false)).$to_sym(); res['$<<'](self.$s("block_pass", self.$s("lasgn", block))); self.$scope().$add_local(block);}; if (shadow_args !== false && shadow_args !== nil && shadow_args != null) { res.$concat(shadow_args)}; return self.$s("masgn", res); }, TMP_65.$$arity = -3); Opal.defn(self, '$new_call', TMP_66 = function $$new_call(recv, meth, args) { var $a, $b, $c, self = this, sexp = nil; if (args == null) { args = nil; } ((($a = args) !== false && $a !== nil && $a != null) ? $a : args = []); sexp = self.$s("call", recv, self.$value(meth).$to_sym(), ($a = self).$s.apply($a, ["arglist"].concat(Opal.to_a(args)))); (($b = [self.$source(meth)]), $c = sexp, $c['$source='].apply($c, $b), $b[$b.length-1]); return sexp; }, TMP_66.$$arity = -3); Opal.defn(self, '$new_js_call', TMP_67 = function $$new_js_call(recv, meth, args) { var $a, $b, $c, self = this, sexp = nil; if (args == null) { args = nil; } if (args !== false && args !== nil && args != null) { sexp = self.$s("jscall", recv, self.$value(meth).$to_sym(), ($a = self).$s.apply($a, ["arglist"].concat(Opal.to_a(args)))); (($b = [self.$source(meth)]), $c = sexp, $c['$source='].apply($c, $b), $b[$b.length-1]); } else { sexp = self.$s("jscall", recv, self.$value(meth).$to_sym(), nil); (($b = [self.$source(meth)]), $c = sexp, $c['$source='].apply($c, $b), $b[$b.length-1]); }; return sexp; }, TMP_67.$$arity = -3); Opal.defn(self, '$new_binary_call', TMP_68 = function $$new_binary_call(recv, meth, arg) { var self = this; return self.$new_call(recv, meth, [arg]); }, TMP_68.$$arity = 3); Opal.defn(self, '$new_unary_call', TMP_69 = function $$new_unary_call(op, recv) { var self = this; return self.$new_call(recv, op, []); }, TMP_69.$$arity = 2); Opal.defn(self, '$new_and', TMP_70 = function $$new_and(lhs, tok, rhs) { var $a, $b, self = this, sexp = nil; sexp = self.$s("and", lhs, rhs); (($a = [self.$source(tok)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_70.$$arity = 3); Opal.defn(self, '$new_or', TMP_71 = function $$new_or(lhs, tok, rhs) { var $a, $b, self = this, sexp = nil; sexp = self.$s("or", lhs, rhs); (($a = [self.$source(tok)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_71.$$arity = 3); Opal.defn(self, '$new_irange', TMP_72 = function $$new_irange(beg, op, finish) { var $a, $b, self = this, sexp = nil; sexp = self.$s("irange", beg, finish); (($a = [self.$source(op)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_72.$$arity = 3); Opal.defn(self, '$new_erange', TMP_73 = function $$new_erange(beg, op, finish) { var $a, $b, self = this, sexp = nil; sexp = self.$s("erange", beg, finish); (($a = [self.$source(op)]), $b = sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return sexp; }, TMP_73.$$arity = 3); Opal.defn(self, '$negate_num', TMP_74 = function $$negate_num(sexp) { var self = this; sexp.$array()['$[]='](1, sexp.$array()['$[]'](1)['$-@']()); return sexp; }, TMP_74.$$arity = 1); Opal.defn(self, '$add_block_pass', TMP_75 = function $$add_block_pass(arglist, block) { var self = this; if (block !== false && block !== nil && block != null) { arglist['$<<'](block)}; return arglist; }, TMP_75.$$arity = 2); Opal.defn(self, '$new_block_pass', TMP_76 = function $$new_block_pass(amper_tok, val) { var self = this; return self.$s1("block_pass", val, self.$source(amper_tok)); }, TMP_76.$$arity = 2); Opal.defn(self, '$new_splat', TMP_77 = function $$new_splat(tok, value) { var self = this; return self.$s1("splat", value, self.$source(tok)); }, TMP_77.$$arity = 2); Opal.defn(self, '$new_op_asgn', TMP_78 = function $$new_op_asgn(op, lhs, rhs) { var self = this, $case = nil, result = nil; $case = self.$value(op).$to_sym();if ("||"['$===']($case)) {result = self.$s("op_asgn_or", self.$new_gettable(lhs)); result['$<<']((lhs['$<<'](rhs)));}else if ("&&"['$===']($case)) {result = self.$s("op_asgn_and", self.$new_gettable(lhs)); result['$<<']((lhs['$<<'](rhs)));}else {result = lhs; result['$<<'](self.$new_call(self.$new_gettable(lhs), op, [rhs]));}; return result; }, TMP_78.$$arity = 3); Opal.defn(self, '$new_op_asgn1', TMP_79 = function $$new_op_asgn1(lhs, args, op, rhs) { var $a, $b, $c, self = this, arglist = nil, sexp = nil; arglist = ($a = self).$s.apply($a, ["arglist"].concat(Opal.to_a(args))); sexp = self.$s("op_asgn1", lhs, arglist, self.$value(op), rhs); (($b = [self.$source(op)]), $c = sexp, $c['$source='].apply($c, $b), $b[$b.length-1]); return sexp; }, TMP_79.$$arity = 4); Opal.defn(self, '$op_to_setter', TMP_80 = function $$op_to_setter(op) { var self = this; return ((("") + (self.$value(op))) + "=").$to_sym(); }, TMP_80.$$arity = 1); Opal.defn(self, '$new_attrasgn', TMP_81 = function $$new_attrasgn(recv, op, args) { var $a, self = this, arglist = nil, sexp = nil; if (args == null) { args = []; } arglist = ($a = self).$s.apply($a, ["arglist"].concat(Opal.to_a(args))); sexp = self.$s("attrasgn", recv, op, arglist); return sexp; }, TMP_81.$$arity = -3); Opal.defn(self, '$new_js_attrasgn', TMP_82 = function $$new_js_attrasgn(recv, args) { var $a, self = this, arglist = nil, sexp = nil; arglist = ($a = self).$s.apply($a, ["arglist"].concat(Opal.to_a(args))); sexp = self.$s("jsattrasgn", recv, nil, arglist); return sexp; }, TMP_82.$$arity = 2); Opal.defn(self, '$new_assign', TMP_83 = function $$new_assign(lhs, tok, rhs) { var $a, $b, self = this, $case = nil; return (function() {$case = lhs.$type();if ("iasgn"['$===']($case) || "cdecl"['$===']($case) || "lasgn"['$===']($case) || "gasgn"['$===']($case) || "cvdecl"['$===']($case) || "nth_ref"['$===']($case)) {lhs['$<<'](rhs); return lhs;}else if ("call"['$===']($case) || "attrasgn"['$===']($case) || "jsattrasgn"['$===']($case)) {lhs.$last()['$<<'](rhs); return lhs;}else if ("colon2"['$===']($case)) {lhs['$<<'](rhs); (($a = ["casgn"]), $b = lhs, $b['$type='].apply($b, $a), $a[$a.length-1]); return lhs;}else if ("colon3"['$===']($case)) {lhs['$<<'](rhs); (($a = ["casgn3"]), $b = lhs, $b['$type='].apply($b, $a), $a[$a.length-1]); return lhs;}else {return self.$raise("Bad lhs for new_assign: " + (lhs.$type()))}})(); }, TMP_83.$$arity = 3); Opal.defn(self, '$new_assignable', TMP_84 = function $$new_assignable(ref) { var $a, $b, self = this, $case = nil; $case = ref.$type();if ("ivar"['$===']($case)) {(($a = ["iasgn"]), $b = ref, $b['$type='].apply($b, $a), $a[$a.length-1])}else if ("const"['$===']($case)) {(($a = ["cdecl"]), $b = ref, $b['$type='].apply($b, $a), $a[$a.length-1])}else if ("identifier"['$===']($case)) {if ((($a = self.$scope()['$has_local?'](ref['$[]'](1))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$scope().$add_local(ref['$[]'](1)) }; (($a = ["lasgn"]), $b = ref, $b['$type='].apply($b, $a), $a[$a.length-1]);}else if ("gvar"['$===']($case)) {(($a = ["gasgn"]), $b = ref, $b['$type='].apply($b, $a), $a[$a.length-1])}else if ("cvar"['$===']($case)) {(($a = ["cvdecl"]), $b = ref, $b['$type='].apply($b, $a), $a[$a.length-1])}else {self.$raise($scope.get('SyntaxError'), "Bad new_assignable type: " + (ref.$type()))}; return ref; }, TMP_84.$$arity = 1); Opal.defn(self, '$new_gettable', TMP_85 = function $$new_gettable(ref) { var $a, $b, self = this, res = nil, $case = nil; res = (function() {$case = ref.$type();if ("lasgn"['$===']($case)) {return self.$s("lvar", ref['$[]'](1))}else if ("iasgn"['$===']($case)) {return self.$s("ivar", ref['$[]'](1))}else if ("gasgn"['$===']($case)) {return self.$s("gvar", ref['$[]'](1))}else if ("cvdecl"['$===']($case)) {return self.$s("cvar", ref['$[]'](1))}else if ("cdecl"['$===']($case)) {return self.$s("const", ref['$[]'](1))}else {return self.$raise("Bad new_gettable ref: " + (ref.$type()))}})(); (($a = [ref.$source()]), $b = res, $b['$source='].apply($b, $a), $a[$a.length-1]); return res; }, TMP_85.$$arity = 1); Opal.defn(self, '$new_var_ref', TMP_86 = function $$new_var_ref(ref) { var $a, $b, self = this, $case = nil, result = nil; return (function() {$case = ref.$type();if ("self"['$===']($case) || "nil"['$===']($case) || "true"['$===']($case) || "false"['$===']($case) || "line"['$===']($case) || "file"['$===']($case)) {return ref}else if ("const"['$===']($case)) {return ref}else if ("ivar"['$===']($case) || "gvar"['$===']($case) || "cvar"['$===']($case)) {return ref}else if ("int"['$===']($case)) {return ref}else if ("str"['$===']($case)) {return ref}else if ("identifier"['$===']($case)) {result = (function() {if ((($a = self.$scope()['$has_local?'](ref['$[]'](1))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$s("lvar", ref['$[]'](1)) } else { return self.$s("call", nil, ref['$[]'](1), self.$s("arglist")) }; return nil; })(); (($a = [ref.$source()]), $b = result, $b['$source='].apply($b, $a), $a[$a.length-1]); return result;}else {return self.$raise("Bad var_ref type: " + (ref.$type()))}})(); }, TMP_86.$$arity = 1); Opal.defn(self, '$new_super', TMP_87 = function $$new_super(kw, args) { var $a, $b, $c, self = this, sexp = nil; if ((($a = args['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { sexp = self.$s("super", nil) } else { sexp = self.$s("super", ($a = self).$s.apply($a, ["arglist"].concat(Opal.to_a(args)))) }; (($b = [self.$source(kw)]), $c = sexp, $c['$source='].apply($c, $b), $b[$b.length-1]); return sexp; }, TMP_87.$$arity = 2); Opal.defn(self, '$new_yield', TMP_88 = function $$new_yield(args) { var $a, self = this; ((($a = args) !== false && $a !== nil && $a != null) ? $a : args = []); return ($a = self).$s.apply($a, ["yield"].concat(Opal.to_a(args))); }, TMP_88.$$arity = 1); Opal.defn(self, '$new_xstr', TMP_89 = function $$new_xstr(start_t, str, end_t) { var $a, $b, self = this, $case = nil; if (str !== false && str !== nil && str != null) { } else { return self.$s("xstr", "") }; $case = str.$type();if ("str"['$===']($case)) {(($a = ["xstr"]), $b = str, $b['$type='].apply($b, $a), $a[$a.length-1])}else if ("dstr"['$===']($case)) {(($a = ["dxstr"]), $b = str, $b['$type='].apply($b, $a), $a[$a.length-1])}else if ("evstr"['$===']($case)) {str = self.$s("dxstr", "", str)}; (($a = [self.$source(start_t)]), $b = str, $b['$source='].apply($b, $a), $a[$a.length-1]); return str; }, TMP_89.$$arity = 3); Opal.defn(self, '$new_dsym', TMP_90 = function $$new_dsym(str) { var $a, $b, self = this, $case = nil; if (str !== false && str !== nil && str != null) { } else { return self.$s("sym", "") }; $case = str.$type();if ("str"['$===']($case)) {(($a = ["sym"]), $b = str, $b['$type='].apply($b, $a), $a[$a.length-1]); str['$[]='](1, str['$[]'](1).$to_sym());}else if ("dstr"['$===']($case)) {(($a = ["dsym"]), $b = str, $b['$type='].apply($b, $a), $a[$a.length-1])}else if ("evstr"['$===']($case)) {str = self.$s("dsym", str)}; return str; }, TMP_90.$$arity = 1); Opal.defn(self, '$new_evstr', TMP_91 = function $$new_evstr(str) { var self = this; return self.$s("evstr", str); }, TMP_91.$$arity = 1); Opal.defn(self, '$new_str', TMP_92 = function $$new_str(str) { var $a, $b, $c, self = this; if (str !== false && str !== nil && str != null) { } else { return self.$s("str", "") }; if ((($a = ($b = (($c = str.$size()['$=='](3)) ? str['$[]'](1)['$==']("") : str.$size()['$=='](3)), $b !== false && $b !== nil && $b != null ?str.$type()['$==']("str") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return str['$[]'](2) } else if ((($a = (($b = str.$type()['$==']("str")) ? $rb_gt(str.$size(), 3) : str.$type()['$==']("str"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = ["dstr"]), $b = str, $b['$type='].apply($b, $a), $a[$a.length-1]); return str; } else if (str.$type()['$==']("evstr")) { return self.$s("dstr", "", str) } else { return str }; }, TMP_92.$$arity = 1); Opal.defn(self, '$new_regexp', TMP_93 = function $$new_regexp(reg, ending) { var $a, $b, self = this, $case = nil; if (reg !== false && reg !== nil && reg != null) { } else { return self.$s("regexp", "") }; return (function() {$case = reg.$type();if ("str"['$===']($case)) {return self.$s("regexp", reg['$[]'](1), self.$value(ending))}else if ("evstr"['$===']($case)) {return self.$s("dregx", "", reg)}else if ("dstr"['$===']($case)) {(($a = ["dregx"]), $b = reg, $b['$type='].apply($b, $a), $a[$a.length-1]); return reg;}else { return nil }})(); }, TMP_93.$$arity = 2); Opal.defn(self, '$str_append', TMP_94 = function $$str_append(str, str2) { var self = this; if (str !== false && str !== nil && str != null) { } else { return str2 }; if (str2 !== false && str2 !== nil && str2 != null) { } else { return str }; if (str.$type()['$==']("evstr")) { str = self.$s("dstr", "", str) } else if (str.$type()['$==']("str")) { str = self.$s("dstr", str['$[]'](1))}; str['$<<'](str2); return str; }, TMP_94.$$arity = 2); return (Opal.defn(self, '$new_str_content', TMP_95 = function $$new_str_content(tok) { var self = this; return self.$s1("str", self.$value(tok), self.$source(tok)); }, TMP_95.$$arity = 1), nil) && 'new_str_content'; })($scope.base, (($scope.get('Racc')).$$scope.get('Parser'))) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/fragment"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$attr_reader', '$to_s', '$inspect', '$def?', '$find_parent_def', '$mid', '$line', '$column']); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Fragment(){}; var self = $Fragment = $klass($base, $super, 'Fragment', $Fragment); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5; def.code = def.scope = def.sexp = nil; self.$attr_reader("code"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(code, scope, sexp) { var self = this; if (sexp == null) { sexp = nil; } self.code = code.$to_s(); self.sexp = sexp; return self.scope = scope; }, TMP_1.$$arity = -3); Opal.defn(self, '$inspect', TMP_2 = function $$inspect() { var self = this; return "f(" + (self.code.$inspect()) + ")"; }, TMP_2.$$arity = 0); Opal.defn(self, '$source_map_name', TMP_3 = function $$source_map_name() { var $a, self = this, def_node = nil; if ((($a = self.scope) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; def_node = (function() {if ((($a = self.scope['$def?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.scope } else { return self.scope.$find_parent_def() }; return nil; })(); return (($a = def_node !== false && def_node !== nil && def_node != null) ? def_node.$mid() : def_node); }, TMP_3.$$arity = 0); Opal.defn(self, '$line', TMP_4 = function $$line() { var $a, self = this; if ((($a = self.sexp) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.sexp.$line() } else { return nil }; }, TMP_4.$$arity = 0); return (Opal.defn(self, '$column', TMP_5 = function $$column() { var $a, self = this; if ((($a = self.sexp) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.sexp.$column() } else { return nil }; }, TMP_5.$$arity = 0), nil) && 'column'; })($scope.base, null) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/helpers"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$require', '$valid_name?', '$inspect', '$=~', '$!', '$to_s', '$valid_ivar_name?', '$to_sym', '$+', '$indent', '$to_proc', '$compiler', '$parser_indent', '$push', '$current_indent', '$js_truthy_optimize', '$with_temp', '$fragment', '$expr', '$==', '$type', '$[]', '$uses_block!', '$scope', '$block_name', '$handlers', '$include?', '$truthy_optimize?', '$dup']); self.$require("opal/regexp_anchors"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Helpers, self = $Helpers = $module($base, 'Helpers'); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_13, TMP_15, TMP_16; Opal.cdecl($scope, 'ES51_RESERVED_WORD', (new RegExp("" + $scope.get('REGEXP_START') + "(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)" + $scope.get('REGEXP_END')))); Opal.cdecl($scope, 'ES3_RESERVED_WORD_EXCLUSIVE', (new RegExp("" + $scope.get('REGEXP_START') + "(?:int|byte|char|goto|long|final|float|short|double|native|throws|boolean|abstract|volatile|transient|synchronized)" + $scope.get('REGEXP_END')))); Opal.cdecl($scope, 'PROTO_SPECIAL_PROPS', (new RegExp("" + $scope.get('REGEXP_START') + "(?:constructor|displayName|__proto__|__parent__|__noSuchMethod__|__count__)" + $scope.get('REGEXP_END')))); Opal.cdecl($scope, 'PROTO_SPECIAL_METHODS', (new RegExp("" + $scope.get('REGEXP_START') + "(?:hasOwnProperty|valueOf)" + $scope.get('REGEXP_END')))); Opal.cdecl($scope, 'IMMUTABLE_PROPS', (new RegExp("" + $scope.get('REGEXP_START') + "(?:NaN|Infinity|undefined)" + $scope.get('REGEXP_END')))); Opal.cdecl($scope, 'BASIC_IDENTIFIER_RULES', (new RegExp("" + $scope.get('REGEXP_START') + "[$_a-z][$_a-z\\d]*" + $scope.get('REGEXP_END')))); Opal.cdecl($scope, 'RESERVED_FUNCTION_NAMES', (new RegExp("" + $scope.get('REGEXP_START') + "(?:Array)" + $scope.get('REGEXP_END')))); Opal.defn(self, '$property', TMP_1 = function $$property(name) { var $a, self = this; if ((($a = self['$valid_name?'](name)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "." + (name) } else { return "[" + (name.$inspect()) + "]" }; }, TMP_1.$$arity = 1); Opal.defn(self, '$valid_name?', TMP_2 = function(name) { var $a, $b, $c, self = this; return ($a = $scope.get('BASIC_IDENTIFIER_RULES')['$=~'](name), $a !== false && $a !== nil && $a != null ?(((($b = ((($c = $scope.get('ES51_RESERVED_WORD')['$=~'](name)) !== false && $c !== nil && $c != null) ? $c : $scope.get('ES3_RESERVED_WORD_EXCLUSIVE')['$=~'](name))) !== false && $b !== nil && $b != null) ? $b : $scope.get('IMMUTABLE_PROPS')['$=~'](name)))['$!']() : $a); }, TMP_2.$$arity = 1); Opal.defn(self, '$variable', TMP_3 = function $$variable(name) { var $a, self = this; if ((($a = self['$valid_name?'](name.$to_s())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return name } else { return "" + (name) + "$" }; }, TMP_3.$$arity = 1); Opal.defn(self, '$valid_ivar_name?', TMP_4 = function(name) { var $a, self = this; return (((($a = $scope.get('PROTO_SPECIAL_PROPS')['$=~'](name)) !== false && $a !== nil && $a != null) ? $a : $scope.get('PROTO_SPECIAL_METHODS')['$=~'](name)))['$!'](); }, TMP_4.$$arity = 1); Opal.defn(self, '$ivar', TMP_5 = function $$ivar(name) { var $a, self = this; if ((($a = self['$valid_ivar_name?'](name.$to_s())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return name } else { return "" + (name) + "$" }; }, TMP_5.$$arity = 1); Opal.defn(self, '$lvar_to_js', TMP_6 = function $$lvar_to_js(var$) { var $a, self = this, var$ = nil; if ((($a = self['$valid_name?'](var$.$to_s())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { var$ = "" + (var$) + "$" }; return var$.$to_sym(); }, TMP_6.$$arity = 1); Opal.defn(self, '$mid_to_jsid', TMP_7 = function $$mid_to_jsid(mid) { var $a, self = this; if ((($a = /\=|\+|\-|\*|\/|\!|\?|<|\>|\&|\||\^|\%|\~|\[/['$=~'](mid.$to_s())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "['$" + (mid) + "']" } else { return $rb_plus(".$", mid) }; }, TMP_7.$$arity = 1); Opal.defn(self, '$indent', TMP_8 = function $$indent() { var $a, $b, self = this, $iter = TMP_8.$$p, block = $iter || nil; TMP_8.$$p = null; return ($a = ($b = self.$compiler()).$indent, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_8.$$arity = 0); Opal.defn(self, '$current_indent', TMP_9 = function $$current_indent() { var self = this; return self.$compiler().$parser_indent(); }, TMP_9.$$arity = 0); Opal.defn(self, '$line', TMP_10 = function $$line($a_rest) { var $b, self = this, strs; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } strs = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { strs[$arg_idx - 0] = arguments[$arg_idx]; } self.$push("\n" + (self.$current_indent())); return ($b = self).$push.apply($b, Opal.to_a(strs)); }, TMP_10.$$arity = -1); Opal.defn(self, '$empty_line', TMP_11 = function $$empty_line() { var self = this; return self.$push("\n"); }, TMP_11.$$arity = 0); Opal.defn(self, '$js_truthy', TMP_13 = function $$js_truthy(sexp) { var $a, $b, TMP_12, self = this, optimize = nil; if ((($a = optimize = self.$js_truthy_optimize(sexp)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return optimize}; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_12 = function(tmp){var self = TMP_12.$$s || this; if (tmp == null) tmp = nil; return [self.$fragment("((" + (tmp) + " = "), self.$expr(sexp), self.$fragment(") !== nil && " + (tmp) + " != null && (!" + (tmp) + ".$$is_boolean || " + (tmp) + " == true))")]}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12), $a).call($b); }, TMP_13.$$arity = 1); Opal.defn(self, '$js_falsy', TMP_15 = function $$js_falsy(sexp) { var $a, $b, TMP_14, self = this, mid = nil; if (sexp.$type()['$==']("call")) { mid = sexp['$[]'](2); if (mid['$==']("block_given?")) { self.$scope()['$uses_block!'](); return "" + (self.$scope().$block_name()) + " === nil";};}; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_14 = function(tmp){var self = TMP_14.$$s || this; if (tmp == null) tmp = nil; return [self.$fragment("((" + (tmp) + " = "), self.$expr(sexp), self.$fragment(") === nil || " + (tmp) + " == null || (" + (tmp) + ".$$is_boolean && " + (tmp) + " == false))")]}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($b); }, TMP_15.$$arity = 1); Opal.defn(self, '$js_truthy_optimize', TMP_16 = function $$js_truthy_optimize(sexp) { var $a, $b, $c, self = this, mid = nil, receiver_handler_class = nil, receiver = nil, allow_optimization_on_type = nil; if (sexp.$type()['$==']("call")) { mid = sexp['$[]'](2); receiver_handler_class = ($a = (receiver = sexp['$[]'](1)), $a !== false && $a !== nil && $a != null ?self.$compiler().$handlers()['$[]'](receiver.$type()) : $a); allow_optimization_on_type = ($a = ($b = (($scope.get('Compiler')).$$scope.get('COMPARE'))['$include?'](mid.$to_s()), $b !== false && $b !== nil && $b != null ?receiver_handler_class : $b), $a !== false && $a !== nil && $a != null ?receiver_handler_class['$truthy_optimize?']() : $a); if ((($a = ((($b = ((($c = allow_optimization_on_type) !== false && $c !== nil && $c != null) ? $c : mid['$==']("block_given?"))) !== false && $b !== nil && $b != null) ? $b : mid['$==']("=="))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$expr(sexp) } else { return nil }; } else if ((($a = ["lvar", "self"]['$include?'](sexp.$type())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [self.$expr(sexp.$dup()), self.$fragment(" !== false && "), self.$expr(sexp.$dup()), self.$fragment(" !== nil && "), self.$expr(sexp.$dup()), self.$fragment(" != null")] } else { return nil }; }, TMP_16.$$arity = 1); })($scope.base) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/base"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $range = Opal.range; Opal.add_stubs(['$require', '$include', '$each', '$[]=', '$handlers', '$each_with_index', '$define_method', '$[]', '$+', '$attr_reader', '$type', '$compile', '$raise', '$is_a?', '$fragment', '$<<', '$unshift', '$reverse', '$push', '$new', '$scope', '$error', '$s', '$==', '$process', '$expr', '$add_scope_local', '$to_sym', '$add_scope_ivar', '$add_scope_gvar', '$add_scope_temp', '$helper', '$with_temp', '$to_proc', '$in_while?', '$instance_variable_get', '$has_rescue_else?', '$in_ensure', '$in_ensure?']); self.$require("opal/nodes/helpers"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Base(){}; var self = $Base = $klass($base, $super, 'Base', $Base); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_3, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_13, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39; def.sexp = def.fragments = def.compiler = def.level = nil; self.$include($scope.get('Helpers')); Opal.defs(self, '$handlers', TMP_1 = function $$handlers() { var $a, self = this; if (self.handlers == null) self.handlers = nil; return ((($a = self.handlers) !== false && $a !== nil && $a != null) ? $a : self.handlers = $hash2([], {})); }, TMP_1.$$arity = 0); Opal.defs(self, '$handle', TMP_3 = function $$handle($a_rest) { var $b, $c, TMP_2, self = this, types; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } types = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { types[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = ($c = types).$each, $b.$$p = (TMP_2 = function(type){var self = TMP_2.$$s || this; if (type == null) type = nil; return $scope.get('Base').$handlers()['$[]='](type, self)}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $b).call($c); }, TMP_3.$$arity = -1); Opal.defs(self, '$children', TMP_6 = function $$children($a_rest) { var $b, $c, TMP_4, self = this, names; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } names = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { names[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = ($c = names).$each_with_index, $b.$$p = (TMP_4 = function(name, idx){var self = TMP_4.$$s || this, $a, $d, TMP_5; if (name == null) name = nil;if (idx == null) idx = nil; return ($a = ($d = self).$define_method, $a.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this; if (self.sexp == null) self.sexp = nil; return self.sexp['$[]']($rb_plus(idx, 1))}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $a).call($d, name)}, TMP_4.$$s = self, TMP_4.$$arity = 2, TMP_4), $b).call($c); }, TMP_6.$$arity = -1); Opal.defs(self, '$truthy_optimize?', TMP_7 = function() { var self = this; return false; }, TMP_7.$$arity = 0); self.$attr_reader("compiler", "type"); Opal.defn(self, '$initialize', TMP_8 = function $$initialize(sexp, level, compiler) { var self = this; self.sexp = sexp; self.type = sexp.$type(); self.level = level; return self.compiler = compiler; }, TMP_8.$$arity = 3); Opal.defn(self, '$children', TMP_9 = function $$children() { var self = this; return self.sexp['$[]']($range(1, -1, false)); }, TMP_9.$$arity = 0); Opal.defn(self, '$compile_to_fragments', TMP_10 = function $$compile_to_fragments() { var $a, $b, self = this; if ((($a = (($b = self['fragments'], $b != null && $b !== nil) ? 'instance-variable' : nil)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.fragments}; self.fragments = []; self.$compile(); return self.fragments; }, TMP_10.$$arity = 0); Opal.defn(self, '$compile', TMP_11 = function $$compile() { var self = this; return self.$raise("Not Implemented"); }, TMP_11.$$arity = 0); Opal.defn(self, '$push', TMP_13 = function $$push($a_rest) { var $b, $c, TMP_12, self = this, strs; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } strs = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { strs[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = ($c = strs).$each, $b.$$p = (TMP_12 = function(str){var self = TMP_12.$$s || this, $a; if (self.fragments == null) self.fragments = nil; if (str == null) str = nil; if ((($a = str['$is_a?']($scope.get('String'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { str = self.$fragment(str)}; return self.fragments['$<<'](str);}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12), $b).call($c); }, TMP_13.$$arity = -1); Opal.defn(self, '$unshift', TMP_15 = function $$unshift($a_rest) { var $b, $c, TMP_14, self = this, strs; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } strs = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { strs[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = ($c = strs.$reverse()).$each, $b.$$p = (TMP_14 = function(str){var self = TMP_14.$$s || this, $a; if (self.fragments == null) self.fragments = nil; if (str == null) str = nil; if ((($a = str['$is_a?']($scope.get('String'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { str = self.$fragment(str)}; return self.fragments.$unshift(str);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $b).call($c); }, TMP_15.$$arity = -1); Opal.defn(self, '$wrap', TMP_16 = function $$wrap(pre, post) { var self = this; self.$unshift(pre); return self.$push(post); }, TMP_16.$$arity = 2); Opal.defn(self, '$fragment', TMP_17 = function $$fragment(str) { var self = this; return (($scope.get('Opal')).$$scope.get('Fragment')).$new(str, self.$scope(), self.sexp); }, TMP_17.$$arity = 1); Opal.defn(self, '$error', TMP_18 = function $$error(msg) { var self = this; return self.compiler.$error(msg); }, TMP_18.$$arity = 1); Opal.defn(self, '$scope', TMP_19 = function $$scope() { var self = this; return self.compiler.$scope(); }, TMP_19.$$arity = 0); Opal.defn(self, '$s', TMP_20 = function $$s($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return ($b = self.compiler).$s.apply($b, Opal.to_a(args)); }, TMP_20.$$arity = -1); Opal.defn(self, '$expr?', TMP_21 = function() { var self = this; return self.level['$==']("expr"); }, TMP_21.$$arity = 0); Opal.defn(self, '$recv?', TMP_22 = function() { var self = this; return self.level['$==']("recv"); }, TMP_22.$$arity = 0); Opal.defn(self, '$stmt?', TMP_23 = function() { var self = this; return self.level['$==']("stmt"); }, TMP_23.$$arity = 0); Opal.defn(self, '$process', TMP_24 = function $$process(sexp, level) { var self = this; if (level == null) { level = "expr"; } return self.compiler.$process(sexp, level); }, TMP_24.$$arity = -2); Opal.defn(self, '$expr', TMP_25 = function $$expr(sexp) { var self = this; return self.compiler.$process(sexp, "expr"); }, TMP_25.$$arity = 1); Opal.defn(self, '$recv', TMP_26 = function $$recv(sexp) { var self = this; return self.compiler.$process(sexp, "recv"); }, TMP_26.$$arity = 1); Opal.defn(self, '$stmt', TMP_27 = function $$stmt(sexp) { var self = this; return self.compiler.$process(sexp, "stmt"); }, TMP_27.$$arity = 1); Opal.defn(self, '$expr_or_nil', TMP_28 = function $$expr_or_nil(sexp) { var self = this; if (sexp !== false && sexp !== nil && sexp != null) { return self.$expr(sexp) } else { return "nil" }; }, TMP_28.$$arity = 1); Opal.defn(self, '$add_local', TMP_29 = function $$add_local(name) { var self = this; return self.$scope().$add_scope_local(name.$to_sym()); }, TMP_29.$$arity = 1); Opal.defn(self, '$add_ivar', TMP_30 = function $$add_ivar(name) { var self = this; return self.$scope().$add_scope_ivar(name); }, TMP_30.$$arity = 1); Opal.defn(self, '$add_gvar', TMP_31 = function $$add_gvar(name) { var self = this; return self.$scope().$add_scope_gvar(name); }, TMP_31.$$arity = 1); Opal.defn(self, '$add_temp', TMP_32 = function $$add_temp(temp) { var self = this; return self.$scope().$add_scope_temp(temp); }, TMP_32.$$arity = 1); Opal.defn(self, '$helper', TMP_33 = function $$helper(name) { var self = this; return self.compiler.$helper(name); }, TMP_33.$$arity = 1); Opal.defn(self, '$with_temp', TMP_34 = function $$with_temp() { var $a, $b, self = this, $iter = TMP_34.$$p, block = $iter || nil; TMP_34.$$p = null; return ($a = ($b = self.compiler).$with_temp, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_34.$$arity = 0); Opal.defn(self, '$in_while?', TMP_35 = function() { var self = this; return self.compiler['$in_while?'](); }, TMP_35.$$arity = 0); Opal.defn(self, '$while_loop', TMP_36 = function $$while_loop() { var self = this; return self.compiler.$instance_variable_get("@while_loop"); }, TMP_36.$$arity = 0); Opal.defn(self, '$has_rescue_else?', TMP_37 = function() { var self = this; return self.$scope()['$has_rescue_else?'](); }, TMP_37.$$arity = 0); Opal.defn(self, '$in_ensure', TMP_38 = function $$in_ensure() { var $a, $b, self = this, $iter = TMP_38.$$p, block = $iter || nil; TMP_38.$$p = null; return ($a = ($b = self.$scope()).$in_ensure, $a.$$p = block.$to_proc(), $a).call($b); }, TMP_38.$$arity = 0); return (Opal.defn(self, '$in_ensure?', TMP_39 = function() { var self = this; return self.$scope()['$in_ensure?'](); }, TMP_39.$$arity = 0), nil) && 'in_ensure?'; })($scope.base, null) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/literal"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $gvars = Opal.gvars; Opal.add_stubs(['$require', '$handle', '$push', '$to_s', '$type', '$children', '$value', '$recv?', '$wrap', '$join', '$keys', '$gsub', '$even?', '$length', '$+', '$chop', '$[]', '$translate_escape_chars', '$inspect', '$===', '$new', '$flags', '$each_line', '$==', '$s', '$source=', '$line', '$include', '$stmt?', '$!', '$include?', '$compile_split_lines', '$needs_semicolon?', '$each_with_index', '$expr', '$raise', '$last', '$each', '$requires_semicolon', '$helper', '$start', '$finish']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ValueNode(){}; var self = $ValueNode = $klass($base, $super, 'ValueNode', $ValueNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2; self.$handle("true", "false", "self", "nil"); Opal.defn(self, '$compile', TMP_1 = function $$compile() { var self = this; return self.$push(self.$type().$to_s()); }, TMP_1.$$arity = 0); return (Opal.defs(self, '$truthy_optimize?', TMP_2 = function() { var self = this; return true; }, TMP_2.$$arity = 0), nil) && 'truthy_optimize?'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $NumericNode(){}; var self = $NumericNode = $klass($base, $super, 'NumericNode', $NumericNode); var def = self.$$proto, $scope = self.$$scope, TMP_3, TMP_4; self.$handle("int", "float"); self.$children("value"); Opal.defn(self, '$compile', TMP_3 = function $$compile() { var $a, self = this; self.$push(self.$value().$to_s()); if ((($a = self['$recv?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$wrap("(", ")") } else { return nil }; }, TMP_3.$$arity = 0); return (Opal.defs(self, '$truthy_optimize?', TMP_4 = function() { var self = this; return true; }, TMP_4.$$arity = 0), nil) && 'truthy_optimize?'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $StringNode(){}; var self = $StringNode = $klass($base, $super, 'StringNode', $StringNode); var def = self.$$proto, $scope = self.$$scope, TMP_6, TMP_7; self.$handle("str"); self.$children("value"); Opal.cdecl($scope, 'ESCAPE_CHARS', $hash2(["a", "e"], {"a": "\\u0007", "e": "\\u001b"})); Opal.cdecl($scope, 'ESCAPE_REGEX', (new RegExp("(\\\\+)([" + $scope.get('ESCAPE_CHARS').$keys().$join("") + "])"))); Opal.defn(self, '$translate_escape_chars', TMP_6 = function $$translate_escape_chars(inspect_string) { var $a, $b, TMP_5, self = this; return ($a = ($b = inspect_string).$gsub, $a.$$p = (TMP_5 = function(original){var self = TMP_5.$$s || this, $c, $d; if (original == null) original = nil; if ((($c = (($d = $gvars['~']) === nil ? nil : $d['$[]'](1)).$length()['$even?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return original } else { return $rb_plus((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)).$chop(), $scope.get('ESCAPE_CHARS')['$[]']((($c = $gvars['~']) === nil ? nil : $c['$[]'](2)))) }}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $a).call($b, $scope.get('ESCAPE_REGEX')); }, TMP_6.$$arity = 1); return (Opal.defn(self, '$compile', TMP_7 = function $$compile() { var self = this; return self.$push(self.$translate_escape_chars(self.$value().$inspect())); }, TMP_7.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $SymbolNode(){}; var self = $SymbolNode = $klass($base, $super, 'SymbolNode', $SymbolNode); var def = self.$$proto, $scope = self.$$scope, TMP_8; self.$handle("sym"); self.$children("value"); return (Opal.defn(self, '$compile', TMP_8 = function $$compile() { var self = this; return self.$push(self.$value().$to_s().$inspect()); }, TMP_8.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $RegexpNode(){}; var self = $RegexpNode = $klass($base, $super, 'RegexpNode', $RegexpNode); var def = self.$$proto, $scope = self.$$scope, TMP_9; self.$handle("regexp"); self.$children("value", "flags"); return (Opal.defn(self, '$compile', TMP_9 = function $$compile() { var self = this, $case = nil, message = nil; return (function() {$case = self.$value();if (""['$===']($case)) {return self.$push("/(?:)/")}else if (/\?<\w+\>/['$===']($case)) {message = "named captures are not supported in javascript: " + (self.$value().$inspect()); return self.$push("self.$raise(new SyntaxError('" + (message) + "'))");}else {return self.$push("" + ($scope.get('Regexp').$new(self.$value()).$inspect()) + (self.$flags()))}})(); }, TMP_9.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base) { var $XStringLineSplitter, self = $XStringLineSplitter = $module($base, 'XStringLineSplitter'); var def = self.$$proto, $scope = self.$$scope, TMP_11; Opal.defn(self, '$compile_split_lines', TMP_11 = function $$compile_split_lines(value, sexp) { var $a, $b, TMP_10, self = this, idx = nil; idx = 0; return ($a = ($b = value).$each_line, $a.$$p = (TMP_10 = function(line){var self = TMP_10.$$s || this, $c, $d, line_sexp = nil, frag = nil; if (line == null) line = nil; if (idx['$=='](0)) { self.$push(line) } else { line_sexp = self.$s(); (($c = [[$rb_plus(sexp.$line(), idx), 0]]), $d = line_sexp, $d['$source='].apply($d, $c), $c[$c.length-1]); frag = $scope.get('Fragment').$new(line, line_sexp); self.$push(frag); }; return idx = $rb_plus(idx, 1);}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10), $a).call($b); }, TMP_11.$$arity = 2) })($scope.base); (function($base, $super) { function $XStringNode(){}; var self = $XStringNode = $klass($base, $super, 'XStringNode', $XStringNode); var def = self.$$proto, $scope = self.$$scope, TMP_12, TMP_13, TMP_14; def.sexp = nil; self.$include($scope.get('XStringLineSplitter')); self.$handle("xstr"); self.$children("value"); Opal.defn(self, '$needs_semicolon?', TMP_12 = function() { var $a, self = this; return ($a = self['$stmt?'](), $a !== false && $a !== nil && $a != null ?self.$value().$to_s()['$include?'](";")['$!']() : $a); }, TMP_12.$$arity = 0); Opal.defn(self, '$compile', TMP_13 = function $$compile() { var $a, self = this; self.$compile_split_lines(self.$value().$to_s(), self.sexp); if ((($a = self['$needs_semicolon?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push(";")}; if ((($a = self['$recv?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$wrap("(", ")") } else { return nil }; }, TMP_13.$$arity = 0); return (Opal.defn(self, '$start_line', TMP_14 = function $$start_line() { var self = this; return self.sexp.$line(); }, TMP_14.$$arity = 0), nil) && 'start_line'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $DynamicStringNode(){}; var self = $DynamicStringNode = $klass($base, $super, 'DynamicStringNode', $DynamicStringNode); var def = self.$$proto, $scope = self.$$scope, TMP_16; self.$handle("dstr"); return (Opal.defn(self, '$compile', TMP_16 = function $$compile() { var $a, $b, TMP_15, self = this; return ($a = ($b = self.$children()).$each_with_index, $a.$$p = (TMP_15 = function(part, idx){var self = TMP_15.$$s || this, $c; if (part == null) part = nil;if (idx == null) idx = nil; if (idx['$=='](0)) { } else { self.$push(" + ") }; if ((($c = $scope.get('String')['$==='](part)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$push(part.$inspect()) } else if (part.$type()['$==']("evstr")) { self.$push("("); self.$push((function() {if ((($c = part['$[]'](1)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.$expr(part['$[]'](1)) } else { return "\"\"" }; return nil; })()); self.$push(")"); } else if (part.$type()['$==']("str")) { self.$push(part['$[]'](1).$inspect()) } else if (part.$type()['$==']("dstr")) { self.$push("("); self.$push(self.$expr(part)); self.$push(")"); } else { self.$raise("Bad dstr part " + (part.$inspect())) }; if ((($c = self['$recv?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.$wrap("(", ")") } else { return nil };}, TMP_15.$$s = self, TMP_15.$$arity = 2, TMP_15), $a).call($b); }, TMP_16.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $DynamicSymbolNode(){}; var self = $DynamicSymbolNode = $klass($base, $super, 'DynamicSymbolNode', $DynamicSymbolNode); var def = self.$$proto, $scope = self.$$scope, TMP_18; self.$handle("dsym"); return (Opal.defn(self, '$compile', TMP_18 = function $$compile() { var $a, $b, TMP_17, self = this; ($a = ($b = self.$children()).$each_with_index, $a.$$p = (TMP_17 = function(part, idx){var self = TMP_17.$$s || this, $c; if (part == null) part = nil;if (idx == null) idx = nil; if (idx['$=='](0)) { } else { self.$push(" + ") }; if ((($c = $scope.get('String')['$==='](part)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.$push(part.$inspect()) } else if (part.$type()['$==']("evstr")) { return self.$push(self.$expr(self.$s("call", part.$last(), "to_s", self.$s("arglist")))) } else if (part.$type()['$==']("str")) { return self.$push(part.$last().$inspect()) } else { return self.$raise("Bad dsym part") };}, TMP_17.$$s = self, TMP_17.$$arity = 2, TMP_17), $a).call($b); return self.$wrap("(", ")"); }, TMP_18.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $DynamicXStringNode(){}; var self = $DynamicXStringNode = $klass($base, $super, 'DynamicXStringNode', $DynamicXStringNode); var def = self.$$proto, $scope = self.$$scope, TMP_19, TMP_21; self.$include($scope.get('XStringLineSplitter')); self.$handle("dxstr"); Opal.defn(self, '$requires_semicolon', TMP_19 = function $$requires_semicolon(code) { var $a, self = this; return ($a = self['$stmt?'](), $a !== false && $a !== nil && $a != null ?code['$include?'](";")['$!']() : $a); }, TMP_19.$$arity = 1); return (Opal.defn(self, '$compile', TMP_21 = function $$compile() { var $a, $b, TMP_20, self = this, needs_semicolon = nil; needs_semicolon = false; ($a = ($b = self.$children()).$each, $a.$$p = (TMP_20 = function(part){var self = TMP_20.$$s || this, $c; if (self.sexp == null) self.sexp = nil; if (part == null) part = nil; if ((($c = $scope.get('String')['$==='](part)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$compile_split_lines(part.$to_s(), self.sexp); if ((($c = self.$requires_semicolon(part.$to_s())) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return needs_semicolon = true } else { return nil }; } else if (part.$type()['$==']("evstr")) { return self.$push(self.$expr(part['$[]'](1))) } else if (part.$type()['$==']("str")) { self.$compile_split_lines(part.$last().$to_s(), part); if ((($c = self.$requires_semicolon(part.$last().$to_s())) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return needs_semicolon = true } else { return nil }; } else { return self.$raise("Bad dxstr part") }}, TMP_20.$$s = self, TMP_20.$$arity = 1, TMP_20), $a).call($b); if (needs_semicolon !== false && needs_semicolon !== nil && needs_semicolon != null) { self.$push(";")}; if ((($a = self['$recv?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$wrap("(", ")") } else { return nil }; }, TMP_21.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $DynamicRegexpNode(){}; var self = $DynamicRegexpNode = $klass($base, $super, 'DynamicRegexpNode', $DynamicRegexpNode); var def = self.$$proto, $scope = self.$$scope, TMP_23; self.$handle("dregx"); return (Opal.defn(self, '$compile', TMP_23 = function $$compile() { var $a, $b, TMP_22, self = this; ($a = ($b = self.$children()).$each_with_index, $a.$$p = (TMP_22 = function(part, idx){var self = TMP_22.$$s || this, $c; if (part == null) part = nil;if (idx == null) idx = nil; if (idx['$=='](0)) { } else { self.$push(" + ") }; if ((($c = $scope.get('String')['$==='](part)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.$push(part.$inspect()) } else if (part.$type()['$==']("str")) { return self.$push(part['$[]'](1).$inspect()) } else { return self.$push(self.$expr(part['$[]'](1))) };}, TMP_22.$$s = self, TMP_22.$$arity = 2, TMP_22), $a).call($b); return self.$wrap("(new RegExp(", "))"); }, TMP_23.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $InclusiveRangeNode(){}; var self = $InclusiveRangeNode = $klass($base, $super, 'InclusiveRangeNode', $InclusiveRangeNode); var def = self.$$proto, $scope = self.$$scope, TMP_24; self.$handle("irange"); self.$children("start", "finish"); return (Opal.defn(self, '$compile', TMP_24 = function $$compile() { var self = this; self.$helper("range"); return self.$push("$range(", self.$expr(self.$start()), ", ", self.$expr(self.$finish()), ", false)"); }, TMP_24.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $ExclusiveRangeNode(){}; var self = $ExclusiveRangeNode = $klass($base, $super, 'ExclusiveRangeNode', $ExclusiveRangeNode); var def = self.$$proto, $scope = self.$$scope, TMP_25; self.$handle("erange"); self.$children("start", "finish"); return (Opal.defn(self, '$compile', TMP_25 = function $$compile() { var self = this; self.$helper("range"); return self.$push("$range(", self.$expr(self.$start()), ", ", self.$expr(self.$finish()), ", true)"); }, TMP_25.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/variables"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$require', '$handle', '$children', '$irb?', '$compiler', '$top?', '$scope', '$using_irb?', '$push', '$variable', '$to_s', '$var_name', '$with_temp', '$property', '$wrap', '$add_local', '$expr', '$value', '$recv?', '$[]', '$name', '$ivar', '$add_ivar', '$helper', '$==', '$handle_global_match', '$handle_post_match', '$handle_pre_match', '$add_gvar', '$index']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $LocalVariableNode(){}; var self = $LocalVariableNode = $klass($base, $super, 'LocalVariableNode', $LocalVariableNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_3; self.$handle("lvar"); self.$children("var_name"); Opal.defn(self, '$using_irb?', TMP_1 = function() { var $a, self = this; return ($a = self.$compiler()['$irb?'](), $a !== false && $a !== nil && $a != null ?self.$scope()['$top?']() : $a); }, TMP_1.$$arity = 0); return (Opal.defn(self, '$compile', TMP_3 = function $$compile() { var $a, $b, TMP_2, self = this; if ((($a = self['$using_irb?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return self.$push(self.$variable(self.$var_name().$to_s())) }; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_2 = function(tmp){var self = TMP_2.$$s || this; if (tmp == null) tmp = nil; self.$push(self.$property(self.$var_name().$to_s())); return self.$wrap("((" + (tmp) + " = Opal.irb_vars", ") == null ? nil : " + (tmp) + ")");}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($b); }, TMP_3.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $LocalAssignNode(){}; var self = $LocalAssignNode = $klass($base, $super, 'LocalAssignNode', $LocalAssignNode); var def = self.$$proto, $scope = self.$$scope, TMP_4, TMP_5; self.$handle("lasgn"); self.$children("var_name", "value"); Opal.defn(self, '$using_irb?', TMP_4 = function() { var $a, self = this; return ($a = self.$compiler()['$irb?'](), $a !== false && $a !== nil && $a != null ?self.$scope()['$top?']() : $a); }, TMP_4.$$arity = 0); return (Opal.defn(self, '$compile', TMP_5 = function $$compile() { var $a, self = this; if ((($a = self['$using_irb?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push("Opal.irb_vars" + (self.$property(self.$var_name().$to_s())) + " = ") } else { self.$add_local(self.$variable(self.$var_name().$to_s())); self.$push("" + (self.$variable(self.$var_name().$to_s())) + " = "); }; self.$push(self.$expr(self.$value())); if ((($a = self['$recv?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$wrap("(", ")") } else { return nil }; }, TMP_5.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $InstanceVariableNode(){}; var self = $InstanceVariableNode = $klass($base, $super, 'InstanceVariableNode', $InstanceVariableNode); var def = self.$$proto, $scope = self.$$scope, TMP_6, TMP_7; self.$handle("ivar"); self.$children("name"); Opal.defn(self, '$var_name', TMP_6 = function $$var_name() { var self = this; return self.$name().$to_s()['$[]']($range(1, -1, false)); }, TMP_6.$$arity = 0); return (Opal.defn(self, '$compile', TMP_7 = function $$compile() { var self = this, name = nil; name = self.$property(self.$ivar(self.$var_name())); self.$add_ivar(name); return self.$push("self" + (name)); }, TMP_7.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $InstanceAssignNode(){}; var self = $InstanceAssignNode = $klass($base, $super, 'InstanceAssignNode', $InstanceAssignNode); var def = self.$$proto, $scope = self.$$scope, TMP_8, TMP_9; self.$handle("iasgn"); self.$children("name", "value"); Opal.defn(self, '$var_name', TMP_8 = function $$var_name() { var self = this; return self.$name().$to_s()['$[]']($range(1, -1, false)); }, TMP_8.$$arity = 0); return (Opal.defn(self, '$compile', TMP_9 = function $$compile() { var self = this, name = nil; name = self.$property(self.$ivar(self.$var_name())); self.$push("self" + (name) + " = "); return self.$push(self.$expr(self.$value())); }, TMP_9.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $GlobalVariableNode(){}; var self = $GlobalVariableNode = $klass($base, $super, 'GlobalVariableNode', $GlobalVariableNode); var def = self.$$proto, $scope = self.$$scope, TMP_10, TMP_11, TMP_13, TMP_15, TMP_17; self.$handle("gvar"); self.$children("name"); Opal.defn(self, '$var_name', TMP_10 = function $$var_name() { var self = this; return self.$name().$to_s()['$[]']($range(1, -1, false)); }, TMP_10.$$arity = 0); Opal.defn(self, '$compile', TMP_11 = function $$compile() { var self = this, name = nil; self.$helper("gvars"); if (self.$var_name()['$==']("&")) { return self.$handle_global_match() } else if (self.$var_name()['$==']("'")) { return self.$handle_post_match() } else if (self.$var_name()['$==']("`")) { return self.$handle_pre_match()}; name = self.$property(self.$var_name()); self.$add_gvar(name); return self.$push("$gvars" + (name)); }, TMP_11.$$arity = 0); Opal.defn(self, '$handle_global_match', TMP_13 = function $$handle_global_match() { var $a, $b, TMP_12, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_12 = function(tmp){var self = TMP_12.$$s || this; if (tmp == null) tmp = nil; return self.$push("((" + (tmp) + " = $gvars['~']) === nil ? nil : " + (tmp) + "['$[]'](0))")}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12), $a).call($b); }, TMP_13.$$arity = 0); Opal.defn(self, '$handle_pre_match', TMP_15 = function $$handle_pre_match() { var $a, $b, TMP_14, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_14 = function(tmp){var self = TMP_14.$$s || this; if (tmp == null) tmp = nil; return self.$push("((" + (tmp) + " = $gvars['~']) === nil ? nil : " + (tmp) + ".$pre_match())")}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($b); }, TMP_15.$$arity = 0); return (Opal.defn(self, '$handle_post_match', TMP_17 = function $$handle_post_match() { var $a, $b, TMP_16, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_16 = function(tmp){var self = TMP_16.$$s || this; if (tmp == null) tmp = nil; return self.$push("((" + (tmp) + " = $gvars['~']) === nil ? nil : " + (tmp) + ".$post_match())")}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16), $a).call($b); }, TMP_17.$$arity = 0), nil) && 'handle_post_match'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $GlobalAssignNode(){}; var self = $GlobalAssignNode = $klass($base, $super, 'GlobalAssignNode', $GlobalAssignNode); var def = self.$$proto, $scope = self.$$scope, TMP_18, TMP_19; self.$handle("gasgn"); self.$children("name", "value"); Opal.defn(self, '$var_name', TMP_18 = function $$var_name() { var self = this; return self.$name().$to_s()['$[]']($range(1, -1, false)); }, TMP_18.$$arity = 0); return (Opal.defn(self, '$compile', TMP_19 = function $$compile() { var self = this, name = nil; self.$helper("gvars"); name = self.$property(self.$var_name()); self.$push("$gvars" + (name) + " = "); return self.$push(self.$expr(self.$value())); }, TMP_19.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $BackrefNode(){}; var self = $BackrefNode = $klass($base, $super, 'BackrefNode', $BackrefNode); var def = self.$$proto, $scope = self.$$scope, TMP_21; self.$handle("nth_ref"); self.$children("index"); return (Opal.defn(self, '$compile', TMP_21 = function $$compile() { var $a, $b, TMP_20, self = this; self.$helper("gvars"); return ($a = ($b = self).$with_temp, $a.$$p = (TMP_20 = function(tmp){var self = TMP_20.$$s || this; if (tmp == null) tmp = nil; return self.$push("((" + (tmp) + " = $gvars['~']) === nil ? nil : " + (tmp) + "['$[]'](" + (self.$index()) + "))")}, TMP_20.$$s = self, TMP_20.$$arity = 1, TMP_20), $a).call($b); }, TMP_21.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $ClassVariableNode(){}; var self = $ClassVariableNode = $klass($base, $super, 'ClassVariableNode', $ClassVariableNode); var def = self.$$proto, $scope = self.$$scope, TMP_23; self.$handle("cvar"); self.$children("name"); return (Opal.defn(self, '$compile', TMP_23 = function $$compile() { var $a, $b, TMP_22, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_22 = function(tmp){var self = TMP_22.$$s || this; if (tmp == null) tmp = nil; return self.$push("((" + (tmp) + " = Opal.cvars['" + (self.$name()) + "']) == null ? nil : " + (tmp) + ")")}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22), $a).call($b); }, TMP_23.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $ClassVarAssignNode(){}; var self = $ClassVarAssignNode = $klass($base, $super, 'ClassVarAssignNode', $ClassVarAssignNode); var def = self.$$proto, $scope = self.$$scope, TMP_24; self.$handle("casgn"); self.$children("name", "value"); return (Opal.defn(self, '$compile', TMP_24 = function $$compile() { var self = this; self.$push("(Opal.cvars['" + (self.$name()) + "'] = "); self.$push(self.$expr(self.$value())); return self.$push(")"); }, TMP_24.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $ClassVarDeclNode(){}; var self = $ClassVarDeclNode = $klass($base, $super, 'ClassVarDeclNode', $ClassVarDeclNode); var def = self.$$proto, $scope = self.$$scope, TMP_25; self.$handle("cvdecl"); self.$children("name", "value"); return (Opal.defn(self, '$compile', TMP_25 = function $$compile() { var self = this; self.$push("(Opal.cvars['" + (self.$name()) + "'] = "); self.$push(self.$expr(self.$value())); return self.$push(")"); }, TMP_25.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/constants"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$children', '$==', '$name', '$eof_content', '$compiler', '$push', '$expr', '$base', '$wrap', '$value']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ConstNode(){}; var self = $ConstNode = $klass($base, $super, 'ConstNode', $ConstNode); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.$handle("const"); self.$children("name"); return (Opal.defn(self, '$compile', TMP_1 = function $$compile() { var $a, $b, self = this; if ((($a = (($b = self.$name()['$==']("DATA")) ? self.$compiler().$eof_content() : self.$name()['$==']("DATA"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$push("$__END__") } else { return self.$push("$scope.get('" + (self.$name()) + "')") }; }, TMP_1.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $ConstDeclarationNode(){}; var self = $ConstDeclarationNode = $klass($base, $super, 'ConstDeclarationNode', $ConstDeclarationNode); var def = self.$$proto, $scope = self.$$scope, TMP_2; self.$handle("cdecl"); self.$children("name", "base"); return (Opal.defn(self, '$compile', TMP_2 = function $$compile() { var self = this; self.$push(self.$expr(self.$base())); return self.$wrap("Opal.cdecl($scope, '" + (self.$name()) + "', ", ")"); }, TMP_2.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $ConstAssignNode(){}; var self = $ConstAssignNode = $klass($base, $super, 'ConstAssignNode', $ConstAssignNode); var def = self.$$proto, $scope = self.$$scope, TMP_3; self.$handle("casgn"); self.$children("base", "name", "value"); return (Opal.defn(self, '$compile', TMP_3 = function $$compile() { var self = this; self.$push("Opal.casgn("); self.$push(self.$expr(self.$base())); self.$push(", '" + (self.$name()) + "', "); self.$push(self.$expr(self.$value())); return self.$push(")"); }, TMP_3.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $ConstGetNode(){}; var self = $ConstGetNode = $klass($base, $super, 'ConstGetNode', $ConstGetNode); var def = self.$$proto, $scope = self.$$scope, TMP_4; self.$handle("colon2"); self.$children("base", "name"); return (Opal.defn(self, '$compile', TMP_4 = function $$compile() { var self = this; self.$push("(("); self.$push(self.$expr(self.$base())); return self.$push(").$$scope.get('" + (self.$name()) + "'))"); }, TMP_4.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $TopConstNode(){}; var self = $TopConstNode = $klass($base, $super, 'TopConstNode', $TopConstNode); var def = self.$$proto, $scope = self.$$scope, TMP_5; self.$handle("colon3"); self.$children("name"); return (Opal.defn(self, '$compile', TMP_5 = function $$compile() { var self = this; return self.$push("Opal.get('" + (self.$name()) + "')"); }, TMP_5.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $TopConstAssignNode(){}; var self = $TopConstAssignNode = $klass($base, $super, 'TopConstAssignNode', $TopConstAssignNode); var def = self.$$proto, $scope = self.$$scope, TMP_6; self.$handle("casgn3"); self.$children("name", "value"); return (Opal.defn(self, '$compile', TMP_6 = function $$compile() { var self = this; self.$push("Opal.casgn(Opal.Object, '" + (self.$name()) + "', "); self.$push(self.$expr(self.$value())); return self.$push(")"); }, TMP_6.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["pathname"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $range = Opal.range, $module = Opal.module; Opal.add_stubs(['$require', '$include', '$quote', '$===', '$to_s', '$path', '$respond_to?', '$to_path', '$is_a?', '$nil?', '$raise', '$class', '$==', '$attr_reader', '$!', '$relative?', '$chop_basename', '$basename', '$=~', '$new', '$source', '$[]', '$rindex', '$sub', '$absolute?', '$expand_path', '$plus', '$unshift', '$length', '$!=', '$empty?', '$first', '$shift', '$+', '$join', '$dirname', '$pop', '$reverse_each', '$directory?', '$extname', '$<=>', '$nonzero?', '$proc', '$casecmp', '$cleanpath', '$inspect', '$include?', '$fill', '$map', '$entries']); self.$require("corelib/comparable"); (function($base, $super) { function $Pathname(){}; var self = $Pathname = $klass($base, $super, 'Pathname', $Pathname); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, $a, $b, TMP_23, $c, TMP_24, TMP_25, TMP_27; def.path = nil; self.$include($scope.get('Comparable')); Opal.cdecl($scope, 'SEPARATOR_PAT', (new RegExp("" + $scope.get('Regexp').$quote((($scope.get('File')).$$scope.get('SEPARATOR')))))); Opal.defn(self, '$initialize', TMP_1 = function $$initialize(path) { var $a, self = this; if ((($a = $scope.get('Pathname')['$==='](path)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.path = path.$path().$to_s() } else if ((($a = path['$respond_to?']("to_path")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.path = path.$to_path() } else if ((($a = path['$is_a?']($scope.get('String'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.path = path } else if ((($a = path['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('TypeError'), "no implicit conversion of nil into String") } else { self.$raise($scope.get('TypeError'), "no implicit conversion of " + (path.$class()) + " into String") }; if (self.path['$==']("\x00")) { return self.$raise($scope.get('ArgumentError')) } else { return nil }; }, TMP_1.$$arity = 1); self.$attr_reader("path"); Opal.defn(self, '$==', TMP_2 = function(other) { var self = this; return other.$path()['$=='](self.path); }, TMP_2.$$arity = 1); Opal.defn(self, '$absolute?', TMP_3 = function() { var self = this; return self['$relative?']()['$!'](); }, TMP_3.$$arity = 0); Opal.defn(self, '$relative?', TMP_4 = function() { var $a, $b, $c, self = this, path = nil, r = nil; path = self.path; while ((($b = r = self.$chop_basename(path)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { $c = r, $b = Opal.to_ary($c), path = ($b[0] == null ? nil : $b[0]), $c}; return path['$=='](""); }, TMP_4.$$arity = 0); Opal.defn(self, '$chop_basename', TMP_5 = function $$chop_basename(path) { var $a, self = this, base = nil; base = $scope.get('File').$basename(path); if ((($a = $scope.get('Regexp').$new("^" + ((($scope.get('Pathname')).$$scope.get('SEPARATOR_PAT')).$source()) + "?$")['$=~'](base)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return [path['$[]'](0, path.$rindex(base)), base] }; }, TMP_5.$$arity = 1); Opal.defn(self, '$root?', TMP_6 = function() { var self = this; return self.path['$==']("/"); }, TMP_6.$$arity = 0); Opal.defn(self, '$parent', TMP_7 = function $$parent() { var $a, self = this, new_path = nil; new_path = self.path.$sub(/\/([^\/]+\/?$)/, ""); if (new_path['$==']("")) { new_path = (function() {if ((($a = self['$absolute?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "/" } else { return "." }; return nil; })()}; return $scope.get('Pathname').$new(new_path); }, TMP_7.$$arity = 0); Opal.defn(self, '$sub', TMP_8 = function $$sub($a_rest) { var $b, self = this, args; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } return $scope.get('Pathname').$new(($b = self.path).$sub.apply($b, Opal.to_a(args))); }, TMP_8.$$arity = -1); Opal.defn(self, '$cleanpath', TMP_9 = function $$cleanpath() { var self = this; return Opal.normalize(self.path); }, TMP_9.$$arity = 0); Opal.defn(self, '$to_path', TMP_10 = function $$to_path() { var self = this; return self.path; }, TMP_10.$$arity = 0); Opal.defn(self, '$hash', TMP_11 = function $$hash() { var self = this; return self.path; }, TMP_11.$$arity = 0); Opal.defn(self, '$expand_path', TMP_12 = function $$expand_path() { var self = this; return $scope.get('File').$expand_path(self.path); }, TMP_12.$$arity = 0); Opal.defn(self, '$+', TMP_13 = function(other) { var $a, self = this; if ((($a = $scope.get('Pathname')['$==='](other)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { other = $scope.get('Pathname').$new(other) }; return $scope.get('Pathname').$new(self.$plus(self.path, other.$to_s())); }, TMP_13.$$arity = 1); Opal.defn(self, '$plus', TMP_14 = function $$plus(path1, path2) { var $a, $b, $c, $d, self = this, prefix2 = nil, index_list2 = nil, basename_list2 = nil, r2 = nil, basename2 = nil, prefix1 = nil, r1 = nil, basename1 = nil, suffix2 = nil; prefix2 = path2; index_list2 = []; basename_list2 = []; while ((($b = r2 = self.$chop_basename(prefix2)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { $c = r2, $b = Opal.to_ary($c), prefix2 = ($b[0] == null ? nil : $b[0]), basename2 = ($b[1] == null ? nil : $b[1]), $c; index_list2.$unshift(prefix2.$length()); basename_list2.$unshift(basename2);}; if ((($a = prefix2['$!=']("")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return path2}; prefix1 = path1; while ((($b = true) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { while ((($c = ($d = basename_list2['$empty?']()['$!'](), $d !== false && $d !== nil && $d != null ?basename_list2.$first()['$=='](".") : $d)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { index_list2.$shift(); basename_list2.$shift();}; if ((($b = r1 = self.$chop_basename(prefix1)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { break; }; $c = r1, $b = Opal.to_ary($c), prefix1 = ($b[0] == null ? nil : $b[0]), basename1 = ($b[1] == null ? nil : $b[1]), $c; if (basename1['$=='](".")) { continue;}; if ((($b = ((($c = ((($d = basename1['$==']("..")) !== false && $d !== nil && $d != null) ? $d : basename_list2['$empty?']())) !== false && $c !== nil && $c != null) ? $c : basename_list2.$first()['$!='](".."))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { prefix1 = $rb_plus(prefix1, basename1); break;;}; index_list2.$shift(); basename_list2.$shift();}; r1 = self.$chop_basename(prefix1); if ((($a = ($b = r1['$!'](), $b !== false && $b !== nil && $b != null ?(new RegExp("" + $scope.get('SEPARATOR_PAT')))['$=~']($scope.get('File').$basename(prefix1)) : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { while ((($b = ($c = basename_list2['$empty?']()['$!'](), $c !== false && $c !== nil && $c != null ?basename_list2.$first()['$==']("..") : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { index_list2.$shift(); basename_list2.$shift();}}; if ((($a = basename_list2['$empty?']()['$!']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { suffix2 = path2['$[]']($range(index_list2.$first(), -1, false)); if (r1 !== false && r1 !== nil && r1 != null) { return $scope.get('File').$join(prefix1, suffix2) } else { return $rb_plus(prefix1, suffix2) }; } else if (r1 !== false && r1 !== nil && r1 != null) { return prefix1 } else { return $scope.get('File').$dirname(prefix1) }; }, TMP_14.$$arity = 2); Opal.defn(self, '$join', TMP_16 = function $$join($a_rest) {try { var $b, $c, TMP_15, self = this, args, result = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } if ((($b = args['$empty?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self}; result = args.$pop(); if ((($b = $scope.get('Pathname')['$==='](result)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { result = $scope.get('Pathname').$new(result) }; if ((($b = result['$absolute?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return result}; ($b = ($c = args).$reverse_each, $b.$$p = (TMP_15 = function(arg){var self = TMP_15.$$s || this, $a; if (arg == null) arg = nil; if ((($a = $scope.get('Pathname')['$==='](arg)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { arg = $scope.get('Pathname').$new(arg) }; result = $rb_plus(arg, result); if ((($a = result['$absolute?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { Opal.ret(result) } else { return nil };}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15), $b).call($c); return $rb_plus(self, result); } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } }, TMP_16.$$arity = -1); Opal.defn(self, '$split', TMP_17 = function $$split() { var self = this; return [self.$dirname(), self.$basename()]; }, TMP_17.$$arity = 0); Opal.defn(self, '$dirname', TMP_18 = function $$dirname() { var self = this; return $scope.get('Pathname').$new($scope.get('File').$dirname(self.path)); }, TMP_18.$$arity = 0); Opal.defn(self, '$basename', TMP_19 = function $$basename() { var self = this; return $scope.get('Pathname').$new($scope.get('File').$basename(self.path)); }, TMP_19.$$arity = 0); Opal.defn(self, '$directory?', TMP_20 = function() { var self = this; return $scope.get('File')['$directory?'](self.path); }, TMP_20.$$arity = 0); Opal.defn(self, '$extname', TMP_21 = function $$extname() { var self = this; return $scope.get('File').$extname(self.path); }, TMP_21.$$arity = 0); Opal.defn(self, '$<=>', TMP_22 = function(other) { var self = this; return self.$path()['$<=>'](other.$path()); }, TMP_22.$$arity = 1); Opal.alias(self, 'eql?', '=='); Opal.alias(self, '===', '=='); Opal.alias(self, 'to_str', 'to_path'); Opal.alias(self, 'to_s', 'to_path'); Opal.cdecl($scope, 'SAME_PATHS', (function() {if ((($a = (($scope.get('File')).$$scope.get('FNM_SYSCASE'))['$nonzero?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self).$proc, $a.$$p = (TMP_23 = function(a, b){var self = TMP_23.$$s || this; if (a == null) a = nil;if (b == null) b = nil; return a.$casecmp(b)['$=='](0)}, TMP_23.$$s = self, TMP_23.$$arity = 2, TMP_23), $a).call($b) } else { return ($a = ($c = self).$proc, $a.$$p = (TMP_24 = function(a, b){var self = TMP_24.$$s || this; if (a == null) a = nil;if (b == null) b = nil; return a['$=='](b)}, TMP_24.$$s = self, TMP_24.$$arity = 2, TMP_24), $a).call($c) }; return nil; })()); Opal.defn(self, '$relative_path_from', TMP_25 = function $$relative_path_from(base_directory) { var $a, $b, $c, $d, self = this, dest_directory = nil, dest_prefix = nil, dest_names = nil, r = nil, basename = nil, base_prefix = nil, base_names = nil, relpath_names = nil; dest_directory = self.$cleanpath().$to_s(); base_directory = base_directory.$cleanpath().$to_s(); dest_prefix = dest_directory; dest_names = []; while ((($b = r = self.$chop_basename(dest_prefix)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { $c = r, $b = Opal.to_ary($c), dest_prefix = ($b[0] == null ? nil : $b[0]), basename = ($b[1] == null ? nil : $b[1]), $c; if ((($b = basename['$!='](".")) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { dest_names.$unshift(basename)};}; base_prefix = base_directory; base_names = []; while ((($b = r = self.$chop_basename(base_prefix)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { $c = r, $b = Opal.to_ary($c), base_prefix = ($b[0] == null ? nil : $b[0]), basename = ($b[1] == null ? nil : $b[1]), $c; if ((($b = basename['$!='](".")) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { base_names.$unshift(basename)};}; if ((($a = $scope.get('SAME_PATHS')['$[]'](dest_prefix, base_prefix)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$raise($scope.get('ArgumentError'), "different prefix: " + (dest_prefix.$inspect()) + " and " + (base_directory.$inspect())) }; while ((($b = ($c = ($d = dest_names['$empty?']()['$!'](), $d !== false && $d !== nil && $d != null ?base_names['$empty?']()['$!']() : $d), $c !== false && $c !== nil && $c != null ?$scope.get('SAME_PATHS')['$[]'](dest_names.$first(), base_names.$first()) : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { dest_names.$shift(); base_names.$shift();}; if ((($a = base_names['$include?']("..")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$raise($scope.get('ArgumentError'), "base_directory has ..: " + (base_directory.$inspect()))}; base_names.$fill(".."); relpath_names = $rb_plus(base_names, dest_names); if ((($a = relpath_names['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return $scope.get('Pathname').$new(".") } else { return $scope.get('Pathname').$new(($a = $scope.get('File')).$join.apply($a, Opal.to_a(relpath_names))) }; }, TMP_25.$$arity = 1); return (Opal.defn(self, '$entries', TMP_27 = function $$entries() { var $a, $b, TMP_26, self = this; return ($a = ($b = $scope.get('Dir').$entries(self.path)).$map, $a.$$p = (TMP_26 = function(f){var self = TMP_26.$$s || this; if (f == null) f = nil; return self.$class().$new(f)}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26), $a).call($b); }, TMP_27.$$arity = 0), nil) && 'entries'; })($scope.base, null); return (function($base) { var $Kernel, self = $Kernel = $module($base, 'Kernel'); var def = self.$$proto, $scope = self.$$scope, TMP_28; Opal.defn(self, '$Pathname', TMP_28 = function $$Pathname(path) { var self = this; return $scope.get('Pathname').$new(path); }, TMP_28.$$arity = 1) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/runtime_helpers"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$new', '$children', '$==', '$include?', '$to_sym', '$<<', '$define_method', '$to_proc', '$meth', '$__send__', '$raise', '$helper', '$[]', '$arglist', '$js_truthy', '$js_falsy']); self.$require("set"); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $RuntimeHelpers(){}; var self = $RuntimeHelpers = $klass($base, $super, 'RuntimeHelpers', $RuntimeHelpers); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, $a, $b, TMP_4, $c, TMP_5; Opal.cdecl($scope, 'HELPERS', $scope.get('Set').$new()); self.$children("recvr", "meth", "arglist"); Opal.defs(self, '$compatible?', TMP_1 = function(recvr, meth, arglist) { var $a, self = this; return (($a = recvr['$=='](["const", "Opal"])) ? $scope.get('HELPERS')['$include?'](meth.$to_sym()) : recvr['$=='](["const", "Opal"])); }, TMP_1.$$arity = 3); Opal.defs(self, '$helper', TMP_2 = function $$helper(name) { var $a, $b, self = this, $iter = TMP_2.$$p, block = $iter || nil; TMP_2.$$p = null; $scope.get('HELPERS')['$<<'](name); return ($a = ($b = self).$define_method, $a.$$p = block.$to_proc(), $a).call($b, "compile_" + (name)); }, TMP_2.$$arity = 1); Opal.defn(self, '$compile', TMP_3 = function $$compile() { var $a, self = this; if ((($a = $scope.get('HELPERS')['$include?'](self.$meth().$to_sym())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$__send__("compile_" + (self.$meth())) } else { return self.$raise("Helper not supported: " + (self.$meth())) }; }, TMP_3.$$arity = 0); ($a = ($b = self).$helper, $a.$$p = (TMP_4 = function(){var self = TMP_4.$$s || this, $c, sexp = nil; if ((($c = sexp = self.$arglist()['$[]'](1)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { self.$raise("truthy? requires an object") }; return self.$js_truthy(sexp);}, TMP_4.$$s = self, TMP_4.$$arity = 0, TMP_4), $a).call($b, "truthy?"); return ($a = ($c = self).$helper, $a.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this, $d, sexp = nil; if ((($d = sexp = self.$arglist()['$[]'](1)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { } else { self.$raise("falsy? requires an object") }; return self.$js_falsy(sexp);}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $a).call($c, "falsy?"); })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/call"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $range = Opal.range; Opal.add_stubs(['$require', '$handle', '$children', '$[]=', '$define_method', '$to_proc', '$handle_special', '$compile_default?', '$record_method?', '$<<', '$method_calls', '$compiler', '$to_sym', '$meth', '$using_irb?', '$compile_irb_var', '$default_compile', '$private', '$block_being_passed', '$new_temp', '$scope', '$splat?', '$has_break?', '$expr', '$add_method', '$add_block', '$add_invocation', '$unshift', '$line', '$queue_temp', '$!=', '$receiver_fragment', '$arguments_fragment', '$redefine_this?', '$arguments_array?', '$push', '$apply_call_target', '$any?', '$method_jsid', '$==', '$first', '$arguments_without_block', '$recvr', '$s', '$recv', '$recv_sexp', '$arguments_sexp', '$[]', '$arglist', '$===', '$last', '$type', '$pop', '$iter', '$mid_to_jsid', '$to_s', '$=~', '$with_temp', '$variable', '$intern', '$+', '$irb?', '$top?', '$nil?', '$include?', '$__send__', '$compatible?', '$compile', '$new', '$each', '$add_special', '$inline_operators?', '$operator_helpers', '$fragment', '$compile_default!', '$resolve', '$requires', '$file', '$dirname', '$cleanpath', '$join', '$Pathname', '$inspect', '$process', '$class_scope?', '$required_trees', '$handle_block_given_call', '$def?', '$mid', '$arity_check?', '$handle_part', '$map', '$expand_path', '$split', '$dynamic_require_severity', '$error', '$warning', '$inject']); self.$require("set"); self.$require("pathname"); self.$require("opal/nodes/base"); self.$require("opal/nodes/runtime_helpers"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $CallNode(){}; var self = $CallNode = $klass($base, $super, 'CallNode', $CallNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_23, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, $a, $b, TMP_31, $c, TMP_33, $d, TMP_34, $e, TMP_35, $f, TMP_36, $g, TMP_37, $h, TMP_38, $i, TMP_39, $j, TMP_40, $k, TMP_41; def.arguments_without_block = def.block_being_passed = def.assignment = def.compiler = def.sexp = def.level = def.compile_default = nil; self.$handle("call"); self.$children("recvr", "meth", "arglist", "iter"); Opal.cdecl($scope, 'SPECIALS', $hash2([], {})); Opal.cdecl($scope, 'OPERATORS', $hash2(["+", "-", "*", "/", "<", "<=", ">", ">="], {"+": "plus", "-": "minus", "*": "times", "/": "divide", "<": "lt", "<=": "le", ">": "gt", ">=": "ge"})); Opal.defs(self, '$add_special', TMP_1 = function $$add_special(name, options) { var $a, $b, self = this, $iter = TMP_1.$$p, handler = $iter || nil; if (options == null) { options = $hash2([], {}); } TMP_1.$$p = null; $scope.get('SPECIALS')['$[]='](name, options); return ($a = ($b = self).$define_method, $a.$$p = handler.$to_proc(), $a).call($b, "handle_" + (name)); }, TMP_1.$$arity = -2); Opal.defn(self, '$compile', TMP_2 = function $$compile() { var $a, self = this; self.$handle_special(); if ((($a = self['$compile_default?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; if ((($a = self['$record_method?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$compiler().$method_calls()['$<<'](self.$meth().$to_sym())}; if ((($a = self['$using_irb?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$compile_irb_var()}; return self.$default_compile(); }, TMP_2.$$arity = 0); self.$private(); Opal.defn(self, '$default_compile', TMP_4 = function $$default_compile() { var $a, $b, TMP_3, self = this, block_temp = nil, temporary_receiver = nil, has_break = nil; if ((($a = self.$block_being_passed()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { block_temp = self.$scope().$new_temp()}; if ((($a = ((($b = self['$splat?']()) !== false && $b !== nil && $b != null) ? $b : block_temp)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { temporary_receiver = self.$scope().$new_temp()}; if ((($a = self.$block_being_passed()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { has_break = ($a = ($b = self.$compiler())['$has_break?'], $a.$$p = (TMP_3 = function(){var self = TMP_3.$$s || this; if (self.block_being_passed == null) self.block_being_passed = nil; return self.block_being_passed = self.$expr(self.block_being_passed)}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3), $a).call($b)}; self.$add_method(temporary_receiver); if (block_temp !== false && block_temp !== nil && block_temp != null) { self.$add_block(block_temp)}; self.$add_invocation(temporary_receiver); if (has_break !== false && has_break !== nil && has_break != null) { self.$unshift("return "); self.$unshift("(function(){var $brk = Opal.new_brk(); try {"); self.$line("} catch (err) { if (err === $brk) { return err.$v } else { throw err } }})()");}; if (block_temp !== false && block_temp !== nil && block_temp != null) { return self.$scope().$queue_temp(block_temp) } else { return nil }; }, TMP_4.$$arity = 0); Opal.defn(self, '$redefine_this?', TMP_5 = function(temporary_receiver) { var self = this; return temporary_receiver['$!='](nil); }, TMP_5.$$arity = 1); Opal.defn(self, '$apply_call_target', TMP_6 = function $$apply_call_target(temporary_receiver) { var $a, self = this; return ((($a = temporary_receiver) !== false && $a !== nil && $a != null) ? $a : self.$receiver_fragment()); }, TMP_6.$$arity = 1); Opal.defn(self, '$arguments_array?', TMP_7 = function() { var self = this; return self['$splat?'](); }, TMP_7.$$arity = 0); Opal.defn(self, '$add_invocation', TMP_8 = function $$add_invocation(temporary_receiver) { var $a, $b, self = this, args = nil; args = self.$arguments_fragment(); if ((($a = ((($b = self['$redefine_this?'](temporary_receiver)) !== false && $b !== nil && $b != null) ? $b : self['$arguments_array?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = self['$arguments_array?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push(".apply(") } else { self.$push(".call(") }; self.$push(self.$apply_call_target(temporary_receiver)); if ((($a = args['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push(", ", args)}; return self.$push(")"); } else { return self.$push("(", args, ")") }; }, TMP_8.$$arity = 1); Opal.defn(self, '$add_method', TMP_9 = function $$add_method(temporary_receiver) { var self = this; if (temporary_receiver !== false && temporary_receiver !== nil && temporary_receiver != null) { return self.$push("(" + (temporary_receiver) + " = ", self.$receiver_fragment(), ")" + (self.$method_jsid())) } else { return self.$push(self.$receiver_fragment(), self.$method_jsid()) }; }, TMP_9.$$arity = 1); Opal.defn(self, '$add_block', TMP_10 = function $$add_block(block_temp) { var self = this; self.$unshift("(" + (block_temp) + " = "); return self.$push(", " + (block_temp) + ".$$p = ", self.$block_being_passed(), ", " + (block_temp) + ")"); }, TMP_10.$$arity = 1); Opal.defn(self, '$splat?', TMP_12 = function() { var $a, $b, TMP_11, self = this; return ($a = ($b = self.$arguments_without_block())['$any?'], $a.$$p = (TMP_11 = function(a){var self = TMP_11.$$s || this; if (a == null) a = nil; return a.$first()['$==']("splat")}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11), $a).call($b); }, TMP_12.$$arity = 0); Opal.defn(self, '$recv_sexp', TMP_13 = function $$recv_sexp() { var $a, self = this; return ((($a = self.$recvr()) !== false && $a !== nil && $a != null) ? $a : self.$s("self")); }, TMP_13.$$arity = 0); Opal.defn(self, '$receiver_fragment', TMP_14 = function $$receiver_fragment() { var self = this; return self.$recv(self.$recv_sexp()); }, TMP_14.$$arity = 0); Opal.defn(self, '$arguments_fragment', TMP_15 = function $$arguments_fragment() { var self = this; return self.$expr(self.$arguments_sexp()); }, TMP_15.$$arity = 0); Opal.defn(self, '$arguments_sexp', TMP_16 = function $$arguments_sexp() { var $a, self = this, only_args = nil; only_args = self.$arguments_without_block(); return ($a = self).$s.apply($a, ["arglist"].concat(Opal.to_a(only_args))); }, TMP_16.$$arity = 0); Opal.defn(self, '$arguments_without_block', TMP_17 = function $$arguments_without_block() { var $a, self = this; return ((($a = self.arguments_without_block) !== false && $a !== nil && $a != null) ? $a : self.arguments_without_block = self.$arglist()['$[]']($range(1, -1, false))); }, TMP_17.$$arity = 0); Opal.defn(self, '$block_being_passed', TMP_18 = function $$block_being_passed() { var $a, $b, $c, self = this, args = nil; return ((($a = self.block_being_passed) !== false && $a !== nil && $a != null) ? $a : self.block_being_passed = (function() {args = self.$arguments_without_block(); if ((($b = ($c = $scope.get('Sexp')['$==='](args.$last()), $c !== false && $c !== nil && $c != null ?args.$last().$type()['$==']("block_pass") : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return args.$pop() } else { return self.$iter() };})()); }, TMP_18.$$arity = 0); Opal.defn(self, '$method_jsid', TMP_19 = function $$method_jsid() { var self = this; return self.$mid_to_jsid(self.$meth().$to_s()); }, TMP_19.$$arity = 0); Opal.defn(self, '$record_method?', TMP_20 = function() { var self = this; return true; }, TMP_20.$$arity = 0); Opal.defn(self, '$attr_assignment?', TMP_21 = function() { var $a, self = this; return ((($a = self.assignment) !== false && $a !== nil && $a != null) ? $a : self.assignment = self.$meth().$to_s()['$=~']((new RegExp("" + $scope.get('REGEXP_START') + "[\\da-z]+\\=" + $scope.get('REGEXP_END'))))); }, TMP_21.$$arity = 0); Opal.defn(self, '$compile_irb_var', TMP_23 = function $$compile_irb_var() { var $a, $b, TMP_22, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_22 = function(tmp){var self = TMP_22.$$s || this, lvar = nil, call = nil; if (tmp == null) tmp = nil; lvar = self.$variable(self.$meth()); call = self.$s("call", self.$s("self"), self.$meth().$intern(), self.$s("arglist")); return self.$push("((" + (tmp) + " = Opal.irb_vars." + (lvar) + ") == null ? ", self.$expr(call), " : " + (tmp) + ")");}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22), $a).call($b); }, TMP_23.$$arity = 0); Opal.defn(self, '$compile_assignment', TMP_26 = function $$compile_assignment() { var $a, $b, TMP_24, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_24 = function(args_tmp){var self = TMP_24.$$s || this, $c, $d, TMP_25; if (args_tmp == null) args_tmp = nil; return ($c = ($d = self).$with_temp, $c.$$p = (TMP_25 = function(recv_tmp){var self = TMP_25.$$s || this, args = nil, mid = nil; if (recv_tmp == null) recv_tmp = nil; args = self.$expr(self.$arglist()); mid = self.$mid_to_jsid(self.$meth().$to_s()); return self.$push("((" + (args_tmp) + " = [", args, $rb_plus("]), ", "" + (recv_tmp) + " = "), self.$recv(self.$recv_sexp()), ", ", recv_tmp, mid, $rb_plus(".apply(" + (recv_tmp) + ", " + (args_tmp) + "), ", "" + (args_tmp) + "[" + (args_tmp) + ".length-1])"));}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25), $c).call($d)}, TMP_24.$$s = self, TMP_24.$$arity = 1, TMP_24), $a).call($b); }, TMP_26.$$arity = 0); Opal.defn(self, '$using_irb?', TMP_27 = function() { var $a, $b, $c, $d, self = this; return ($a = ($b = ($c = ($d = self.compiler['$irb?'](), $d !== false && $d !== nil && $d != null ?self.$scope()['$top?']() : $d), $c !== false && $c !== nil && $c != null ?self.$arglist()['$=='](self.$s("arglist")) : $c), $b !== false && $b !== nil && $b != null ?self.$recvr()['$nil?']() : $b), $a !== false && $a !== nil && $a != null ?self.$iter()['$nil?']() : $a); }, TMP_27.$$arity = 0); Opal.defn(self, '$handle_special', TMP_28 = function $$handle_special() { var $a, self = this; self.compile_default = true; if ((($a = $scope.get('SPECIALS')['$include?'](self.$meth())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.compile_default = false; return self.$__send__("handle_" + (self.$meth())); } else if ((($a = $scope.get('RuntimeHelpers')['$compatible?'](self.$recvr(), self.$meth(), self.$arglist())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.compile_default = false; return self.$push($scope.get('RuntimeHelpers').$new(self.sexp, self.level, self.compiler).$compile()); } else { return nil }; }, TMP_28.$$arity = 0); Opal.defn(self, '$compile_default!', TMP_29 = function() { var self = this; return self.compile_default = true; }, TMP_29.$$arity = 0); Opal.defn(self, '$compile_default?', TMP_30 = function() { var self = this; return self.compile_default; }, TMP_30.$$arity = 0); ($a = ($b = $scope.get('OPERATORS')).$each, $a.$$p = (TMP_31 = function(operator, name){var self = TMP_31.$$s || this, $c, $d, TMP_32; if (operator == null) operator = nil;if (name == null) name = nil; return ($c = ($d = self).$add_special, $c.$$p = (TMP_32 = function(){var self = TMP_32.$$s || this, $e, lhs = nil, rhs = nil; if ((($e = self.$compiler()['$inline_operators?']()) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { if ((($e = self['$record_method?']()) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { self.$compiler().$method_calls()['$<<'](operator.$to_sym())}; self.$compiler().$operator_helpers()['$<<'](operator.$to_sym()); $e = [self.$expr(self.$recvr()), self.$expr(self.$arglist()['$[]'](1))], lhs = $e[0], rhs = $e[1], $e; self.$push(self.$fragment("$rb_" + (name) + "(")); self.$push(lhs); self.$push(self.$fragment(", ")); self.$push(rhs); return self.$push(self.$fragment(")")); } else { return self['$compile_default!']() }}, TMP_32.$$s = self, TMP_32.$$arity = 0, TMP_32), $c).call($d, operator.$to_sym())}, TMP_31.$$s = self, TMP_31.$$arity = 2, TMP_31), $a).call($b); ($a = ($c = self).$add_special, $a.$$p = (TMP_33 = function(){var self = TMP_33.$$s || this, $d, str = nil; self['$compile_default!'](); str = $scope.get('DependencyResolver').$new(self.$compiler(), self.$arglist()['$[]'](1)).$resolve(); if ((($d = str['$nil?']()) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { } else { self.$compiler().$requires()['$<<'](str) }; return self.$push(self.$fragment(""));}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33), $a).call($c, "require"); ($a = ($d = self).$add_special, $a.$$p = (TMP_34 = function(){var self = TMP_34.$$s || this, arg = nil, file = nil, dir = nil; arg = self.$arglist()['$[]'](1); file = self.$compiler().$file(); if (arg['$[]'](0)['$==']("str")) { dir = $scope.get('File').$dirname(file); self.$compiler().$requires()['$<<'](self.$Pathname(dir).$join(arg['$[]'](1)).$cleanpath().$to_s());}; self.$push(self.$fragment("self.$require(" + (file.$inspect()) + "+ '/../' + ")); self.$push(self.$process(self.$arglist())); return self.$push(self.$fragment(")"));}, TMP_34.$$s = self, TMP_34.$$arity = 0, TMP_34), $a).call($d, "require_relative"); ($a = ($e = self).$add_special, $a.$$p = (TMP_35 = function(){var self = TMP_35.$$s || this, $f, str = nil; if ((($f = self.$scope()['$class_scope?']()) !== nil && $f != null && (!$f.$$is_boolean || $f == true))) { self['$compile_default!'](); str = $scope.get('DependencyResolver').$new(self.$compiler(), self.$arglist()['$[]'](2)).$resolve(); if ((($f = str['$nil?']()) !== nil && $f != null && (!$f.$$is_boolean || $f == true))) { } else { self.$compiler().$requires()['$<<'](str) }; return self.$push(self.$fragment("")); } else { return nil }}, TMP_35.$$s = self, TMP_35.$$arity = 0, TMP_35), $a).call($e, "autoload"); ($a = ($f = self).$add_special, $a.$$p = (TMP_36 = function(){var self = TMP_36.$$s || this, arg = nil, relative_path = nil, dir = nil, full_path = nil; arg = self.$arglist()['$[]'](1); if (arg['$[]'](0)['$==']("str")) { relative_path = arg['$[]'](1); self.$compiler().$required_trees()['$<<'](relative_path); dir = $scope.get('File').$dirname(self.$compiler().$file()); full_path = self.$Pathname(dir).$join(relative_path).$cleanpath().$to_s(); arg['$[]='](1, full_path);}; self['$compile_default!'](); return self.$push(self.$fragment(""));}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36), $a).call($f, "require_tree"); ($a = ($g = self).$add_special, $a.$$p = (TMP_37 = function(){var self = TMP_37.$$s || this; if (self.sexp == null) self.sexp = nil; return self.$push(self.$compiler().$handle_block_given_call(self.sexp))}, TMP_37.$$s = self, TMP_37.$$arity = 0, TMP_37), $a).call($g, "block_given?"); ($a = ($h = self).$add_special, $a.$$p = (TMP_38 = function(){var self = TMP_38.$$s || this, $i; if ((($i = self.$scope()['$def?']()) !== nil && $i != null && (!$i.$$is_boolean || $i == true))) { return self.$push(self.$fragment(self.$scope().$mid().$to_s().$inspect())) } else { return self.$push(self.$fragment("nil")) }}, TMP_38.$$s = self, TMP_38.$$arity = 0, TMP_38), $a).call($h, "__callee__"); ($a = ($i = self).$add_special, $a.$$p = (TMP_39 = function(){var self = TMP_39.$$s || this, $j; if ((($j = self.$scope()['$def?']()) !== nil && $j != null && (!$j.$$is_boolean || $j == true))) { return self.$push(self.$fragment(self.$scope().$mid().$to_s().$inspect())) } else { return self.$push(self.$fragment("nil")) }}, TMP_39.$$s = self, TMP_39.$$arity = 0, TMP_39), $a).call($i, "__method__"); ($a = ($j = self).$add_special, $a.$$p = (TMP_40 = function(){var self = TMP_40.$$s || this; return self.$push(self.$fragment("debugger"))}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40), $a).call($j, "debugger"); ($a = ($k = self).$add_special, $a.$$p = (TMP_41 = function(){var self = TMP_41.$$s || this; return self.$push(self.$fragment("Opal.hash({ arity_check: " + (self.$compiler()['$arity_check?']()) + " })"))}, TMP_41.$$s = self, TMP_41.$$arity = 0, TMP_41), $a).call($k, "__OPAL_COMPILER_CONFIG__"); return (function($base, $super) { function $DependencyResolver(){}; var self = $DependencyResolver = $klass($base, $super, 'DependencyResolver', $DependencyResolver); var def = self.$$proto, $scope = self.$$scope, TMP_42, TMP_43, TMP_45, TMP_47; def.sexp = def.compiler = nil; Opal.defn(self, '$initialize', TMP_42 = function $$initialize(compiler, sexp) { var self = this; self.compiler = compiler; return self.sexp = sexp; }, TMP_42.$$arity = 2); Opal.defn(self, '$resolve', TMP_43 = function $$resolve() { var self = this; return self.$handle_part(self.sexp); }, TMP_43.$$arity = 0); Opal.defn(self, '$handle_part', TMP_45 = function $$handle_part(sexp) { var $a, $b, TMP_44, self = this, type = nil, _ = nil, recv = nil, meth = nil, args = nil, parts = nil, msg = nil, $case = nil; type = sexp.$type(); if (type['$==']("str")) { return sexp['$[]'](1) } else if (type['$==']("call")) { $b = sexp, $a = Opal.to_ary($b), _ = ($a[0] == null ? nil : $a[0]), recv = ($a[1] == null ? nil : $a[1]), meth = ($a[2] == null ? nil : $a[2]), args = ($a[3] == null ? nil : $a[3]), $b; parts = ($a = ($b = args['$[]']($range(1, -1, false))).$map, $a.$$p = (TMP_44 = function(s){var self = TMP_44.$$s || this; if (s == null) s = nil; return self.$handle_part(s)}, TMP_44.$$s = self, TMP_44.$$arity = 1, TMP_44), $a).call($b); if (recv['$=='](["const", "File"])) { if (meth['$==']("expand_path")) { return ($a = self).$expand_path.apply($a, Opal.to_a(parts)) } else if (meth['$==']("join")) { return self.$expand_path(parts.$join("/")) } else if (meth['$==']("dirname")) { return self.$expand_path(parts['$[]'](0).$split("/")['$[]']($range(0, -1, true)).$join("/"))}};}; msg = "Cannot handle dynamic require"; return (function() {$case = self.compiler.$dynamic_require_severity();if ("error"['$===']($case)) {return self.compiler.$error(msg, self.sexp.$line())}else if ("warning"['$===']($case)) {return self.compiler.$warning(msg, self.sexp.$line())}else { return nil }})(); }, TMP_45.$$arity = 1); return (Opal.defn(self, '$expand_path', TMP_47 = function $$expand_path(path, base) { var $a, $b, TMP_46, self = this; if (base == null) { base = ""; } return ($a = ($b = (((("") + (base)) + "/") + (path)).$split("/")).$inject, $a.$$p = (TMP_46 = function(p, part){var self = TMP_46.$$s || this; if (p == null) p = nil;if (part == null) part = nil; if (part['$==']("")) { } else if (part['$==']("..")) { p.$pop() } else { p['$<<'](part) }; return p;}, TMP_46.$$s = self, TMP_46.$$arity = 2, TMP_46), $a).call($b, []).$join("/"); }, TMP_47.$$arity = -2), nil) && 'expand_path'; })($scope.base, null); })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/call_special"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$require', '$handle', '$children', '$!~', '$to_s', '$meth', '$with_temp', '$expr', '$arglist', '$mid_to_jsid', '$push', '$+', '$recv', '$recv_sexp', '$[]', '$==', '$any?', '$first', '$===', '$last', '$type', '$pop', '$iter', '$new_temp', '$scope', '$s', '$unshift', '$queue_temp', '$lhs', '$rhs', '$process', '$recvr', '$args', '$op', '$compile_or', '$compile_and', '$compile_operator', '$to_sym', '$first_arg', '$mid']); self.$require("opal/nodes/base"); self.$require("opal/nodes/call"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $AttrAssignNode(){}; var self = $AttrAssignNode = $klass($base, $super, 'AttrAssignNode', $AttrAssignNode); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.$handle("attrasgn"); self.$children("recvr", "meth", "arglist"); return (Opal.defn(self, '$default_compile', TMP_1 = function $$default_compile() { var $a, $b, $c, TMP_2, self = this, $iter = TMP_1.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_1.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if ((($a = self.$meth().$to_s()['$!~']((new RegExp("" + $scope.get('REGEXP_START') + "\\w+=" + $scope.get('REGEXP_END'))))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self, Opal.find_super_dispatcher(self, 'default_compile', TMP_1, false)), $a.$$p = $iter, $a).apply($b, $zuper)}; return ($a = ($c = self).$with_temp, $a.$$p = (TMP_2 = function(args_tmp){var self = TMP_2.$$s || this, $d, $e, TMP_3; if (args_tmp == null) args_tmp = nil; return ($d = ($e = self).$with_temp, $d.$$p = (TMP_3 = function(recv_tmp){var self = TMP_3.$$s || this, args = nil, mid = nil; if (recv_tmp == null) recv_tmp = nil; args = self.$expr(self.$arglist()); mid = self.$mid_to_jsid(self.$meth().$to_s()); return self.$push("((" + (args_tmp) + " = [", args, $rb_plus("]), ", "" + (recv_tmp) + " = "), self.$recv(self.$recv_sexp()), ", ", recv_tmp, mid, $rb_plus(".apply(" + (recv_tmp) + ", " + (args_tmp) + "), ", "" + (args_tmp) + "[" + (args_tmp) + ".length-1])"));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $d).call($e)}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($c); }, TMP_1.$$arity = 0), nil) && 'default_compile'; })($scope.base, $scope.get('CallNode')); (function($base, $super) { function $JsAttrAssignNode(){}; var self = $JsAttrAssignNode = $klass($base, $super, 'JsAttrAssignNode', $JsAttrAssignNode); var def = self.$$proto, $scope = self.$$scope, TMP_4, TMP_5; self.$handle("jsattrasgn"); Opal.defn(self, '$record_method?', TMP_4 = function() { var self = this; return false; }, TMP_4.$$arity = 0); return (Opal.defn(self, '$default_compile', TMP_5 = function $$default_compile() { var self = this; return self.$push(self.$recv(self.$recv_sexp()), "[", self.$expr(self.$arglist()['$[]'](1)), "]", "=", self.$expr(self.$arglist()['$[]'](2))); }, TMP_5.$$arity = 0), nil) && 'default_compile'; })($scope.base, $scope.get('CallNode')); (function($base, $super) { function $JsCallNode(){}; var self = $JsCallNode = $klass($base, $super, 'JsCallNode', $JsCallNode); var def = self.$$proto, $scope = self.$$scope, TMP_6, TMP_8; self.$handle("jscall"); Opal.defn(self, '$record_method?', TMP_6 = function() { var self = this; return false; }, TMP_6.$$arity = 0); return (Opal.defn(self, '$default_compile', TMP_8 = function $$default_compile() { var $a, $b, TMP_7, $c, self = this, mid = nil, splat = nil, block = nil, blktmp = nil, tmprecv = nil, recv_code = nil, call_recv = nil, args = nil; if (self.$meth()['$==']("[]")) { return self.$push(self.$recv(self.$recv_sexp()), "[", self.$expr(self.$arglist()), "]") } else { mid = "." + (self.$meth()); splat = ($a = ($b = self.$arglist()['$[]']($range(1, -1, false)))['$any?'], $a.$$p = (TMP_7 = function(a){var self = TMP_7.$$s || this; if (a == null) a = nil; return a.$first()['$==']("splat")}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $a).call($b); if ((($a = ($c = $scope.get('Sexp')['$==='](self.$arglist().$last()), $c !== false && $c !== nil && $c != null ?self.$arglist().$last().$type()['$==']("block_pass") : $c)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { block = self.$arglist().$pop() } else if ((($a = self.$iter()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { block = self.$iter()}; if (block !== false && block !== nil && block != null) { blktmp = self.$scope().$new_temp()}; if (splat !== false && splat !== nil && splat != null) { tmprecv = self.$scope().$new_temp()}; if (block !== false && block !== nil && block != null) { block = self.$expr(block)}; recv_code = self.$recv(self.$recv_sexp()); call_recv = self.$s("js_tmp", ((($a = blktmp) !== false && $a !== nil && $a != null) ? $a : recv_code)); if (blktmp !== false && blktmp !== nil && blktmp != null) { self.$arglist().$push(call_recv)}; args = self.$expr(self.$arglist()); if (tmprecv !== false && tmprecv !== nil && tmprecv != null) { self.$push("(" + (tmprecv) + " = ", recv_code, ")" + (mid)) } else { self.$push(recv_code, mid) }; if (blktmp !== false && blktmp !== nil && blktmp != null) { self.$unshift("(" + (blktmp) + " = ", block, ", "); self.$push(")");}; if (splat !== false && splat !== nil && splat != null) { self.$push(".apply(", tmprecv, ", ", args, ")") } else { self.$push("(", args, ")") }; if (blktmp !== false && blktmp !== nil && blktmp != null) { return self.$scope().$queue_temp(blktmp) } else { return nil }; }; }, TMP_8.$$arity = 0), nil) && 'default_compile'; })($scope.base, $scope.get('CallNode')); (function($base, $super) { function $Match3Node(){}; var self = $Match3Node = $klass($base, $super, 'Match3Node', $Match3Node); var def = self.$$proto, $scope = self.$$scope, TMP_9; def.level = nil; self.$handle("match3"); self.$children("lhs", "rhs"); return (Opal.defn(self, '$compile', TMP_9 = function $$compile() { var self = this, sexp = nil; sexp = self.$s("call", self.$lhs(), "=~", self.$s("arglist", self.$rhs())); return self.$push(self.$process(sexp, self.level)); }, TMP_9.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $OpAsgnOrNode(){}; var self = $OpAsgnOrNode = $klass($base, $super, 'OpAsgnOrNode', $OpAsgnOrNode); var def = self.$$proto, $scope = self.$$scope, TMP_10; self.$handle("op_asgn_or"); self.$children("recvr", "rhs"); return (Opal.defn(self, '$compile', TMP_10 = function $$compile() { var self = this, sexp = nil; sexp = self.$s("or", self.$recvr(), self.$rhs()); return self.$push(self.$expr(sexp)); }, TMP_10.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $OpAsgnAndNode(){}; var self = $OpAsgnAndNode = $klass($base, $super, 'OpAsgnAndNode', $OpAsgnAndNode); var def = self.$$proto, $scope = self.$$scope, TMP_11; self.$handle("op_asgn_and"); self.$children("recvr", "rhs"); return (Opal.defn(self, '$compile', TMP_11 = function $$compile() { var self = this, sexp = nil; sexp = self.$s("and", self.$recvr(), self.$rhs()); return self.$push(self.$expr(sexp)); }, TMP_11.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $OpAsgn1Node(){}; var self = $OpAsgn1Node = $klass($base, $super, 'OpAsgn1Node', $OpAsgn1Node); var def = self.$$proto, $scope = self.$$scope, TMP_12, TMP_13, TMP_16, TMP_19, TMP_22; self.$handle("op_asgn1"); self.$children("lhs", "args", "op", "rhs"); Opal.defn(self, '$first_arg', TMP_12 = function $$first_arg() { var self = this; return self.$args()['$[]'](1); }, TMP_12.$$arity = 0); Opal.defn(self, '$compile', TMP_13 = function $$compile() { var self = this, $case = nil; return (function() {$case = self.$op().$to_s();if ("||"['$===']($case)) {return self.$compile_or()}else if ("&&"['$===']($case)) {return self.$compile_and()}else {return self.$compile_operator()}})(); }, TMP_13.$$arity = 0); Opal.defn(self, '$compile_operator', TMP_16 = function $$compile_operator() { var $a, $b, TMP_14, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_14 = function(a){var self = TMP_14.$$s || this, $c, $d, TMP_15; if (a == null) a = nil; return ($c = ($d = self).$with_temp, $c.$$p = (TMP_15 = function(r){var self = TMP_15.$$s || this, cur = nil, rhs = nil, call = nil; if (r == null) r = nil; cur = self.$s("call", self.$s("js_tmp", r), "[]", self.$s("arglist", self.$s("js_tmp", a))); rhs = self.$s("call", cur, self.$op().$to_sym(), self.$s("arglist", self.$rhs())); call = self.$s("call", self.$s("js_tmp", r), "[]=", self.$s("arglist", self.$s("js_tmp", a), rhs)); self.$push("(" + (a) + " = ", self.$expr(self.$first_arg()), ", " + (r) + " = ", self.$expr(self.$lhs())); return self.$push(", ", self.$expr(call), ")");}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15), $c).call($d)}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($b); }, TMP_16.$$arity = 0); Opal.defn(self, '$compile_or', TMP_19 = function $$compile_or() { var $a, $b, TMP_17, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_17 = function(a){var self = TMP_17.$$s || this, $c, $d, TMP_18; if (a == null) a = nil; return ($c = ($d = self).$with_temp, $c.$$p = (TMP_18 = function(r){var self = TMP_18.$$s || this, aref = nil, aset = nil, orop = nil; if (r == null) r = nil; aref = self.$s("call", self.$s("js_tmp", r), "[]", self.$s("arglist", self.$s("js_tmp", a))); aset = self.$s("call", self.$s("js_tmp", r), "[]=", self.$s("arglist", self.$s("js_tmp", a), self.$rhs())); orop = self.$s("or", aref, aset); self.$push("(" + (a) + " = ", self.$expr(self.$first_arg()), ", " + (r) + " = ", self.$expr(self.$lhs())); return self.$push(", ", self.$expr(orop), ")");}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18), $c).call($d)}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17), $a).call($b); }, TMP_19.$$arity = 0); return (Opal.defn(self, '$compile_and', TMP_22 = function $$compile_and() { var $a, $b, TMP_20, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_20 = function(a){var self = TMP_20.$$s || this, $c, $d, TMP_21; if (a == null) a = nil; return ($c = ($d = self).$with_temp, $c.$$p = (TMP_21 = function(r){var self = TMP_21.$$s || this, aref = nil, aset = nil, andop = nil; if (r == null) r = nil; aref = self.$s("call", self.$s("js_tmp", r), "[]", self.$s("arglist", self.$s("js_tmp", a))); aset = self.$s("call", self.$s("js_tmp", r), "[]=", self.$s("arglist", self.$s("js_tmp", a), self.$rhs())); andop = self.$s("and", aref, aset); self.$push("(" + (a) + " = ", self.$expr(self.$first_arg()), ", " + (r) + " = ", self.$expr(self.$lhs())); return self.$push(", ", self.$expr(andop), ")");}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21), $c).call($d)}, TMP_20.$$s = self, TMP_20.$$arity = 1, TMP_20), $a).call($b); }, TMP_22.$$arity = 0), nil) && 'compile_and'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $OpAsgn2Node(){}; var self = $OpAsgn2Node = $klass($base, $super, 'OpAsgn2Node', $OpAsgn2Node); var def = self.$$proto, $scope = self.$$scope, TMP_23, TMP_24, TMP_26, TMP_28, TMP_30; self.$handle("op_asgn2"); self.$children("lhs", "mid", "op", "rhs"); Opal.defn(self, '$meth', TMP_23 = function $$meth() { var self = this; return self.$mid().$to_s()['$[]']($range(0, -2, false)); }, TMP_23.$$arity = 0); Opal.defn(self, '$compile', TMP_24 = function $$compile() { var self = this, $case = nil; return (function() {$case = self.$op().$to_s();if ("||"['$===']($case)) {return self.$compile_or()}else if ("&&"['$===']($case)) {return self.$compile_and()}else {return self.$compile_operator()}})(); }, TMP_24.$$arity = 0); Opal.defn(self, '$compile_or', TMP_26 = function $$compile_or() { var $a, $b, TMP_25, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_25 = function(tmp){var self = TMP_25.$$s || this, getr = nil, asgn = nil, orop = nil; if (tmp == null) tmp = nil; getr = self.$s("call", self.$s("js_tmp", tmp), self.$meth(), self.$s("arglist")); asgn = self.$s("call", self.$s("js_tmp", tmp), self.$mid(), self.$s("arglist", self.$rhs())); orop = self.$s("or", getr, asgn); return self.$push("(" + (tmp) + " = ", self.$expr(self.$lhs()), ", ", self.$expr(orop), ")");}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25), $a).call($b); }, TMP_26.$$arity = 0); Opal.defn(self, '$compile_and', TMP_28 = function $$compile_and() { var $a, $b, TMP_27, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_27 = function(tmp){var self = TMP_27.$$s || this, getr = nil, asgn = nil, andop = nil; if (tmp == null) tmp = nil; getr = self.$s("call", self.$s("js_tmp", tmp), self.$meth(), self.$s("arglist")); asgn = self.$s("call", self.$s("js_tmp", tmp), self.$mid(), self.$s("arglist", self.$rhs())); andop = self.$s("and", getr, asgn); return self.$push("(" + (tmp) + " = ", self.$expr(self.$lhs()), ", ", self.$expr(andop), ")");}, TMP_27.$$s = self, TMP_27.$$arity = 1, TMP_27), $a).call($b); }, TMP_28.$$arity = 0); return (Opal.defn(self, '$compile_operator', TMP_30 = function $$compile_operator() { var $a, $b, TMP_29, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_29 = function(tmp){var self = TMP_29.$$s || this, getr = nil, oper = nil, asgn = nil; if (tmp == null) tmp = nil; getr = self.$s("call", self.$s("js_tmp", tmp), self.$meth(), self.$s("arglist")); oper = self.$s("call", getr, self.$op(), self.$s("arglist", self.$rhs())); asgn = self.$s("call", self.$s("js_tmp", tmp), self.$mid(), self.$s("arglist", oper)); return self.$push("(" + (tmp) + " = ", self.$expr(self.$lhs()), ", ", self.$expr(asgn), ")");}, TMP_29.$$s = self, TMP_29.$$arity = 1, TMP_29), $a).call($b); }, TMP_30.$$arity = 0), nil) && 'compile_operator'; })($scope.base, $scope.get('Base')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/scope"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$require', '$attr_accessor', '$attr_reader', '$indent', '$scope', '$compiler', '$scope=', '$call', '$==', '$!', '$class?', '$dup', '$push', '$map', '$ivars', '$gvars', '$parser_indent', '$empty?', '$join', '$+', '$proto', '$%', '$fragment', '$def_in_class?', '$add_proto_ivar', '$include?', '$<<', '$has_local?', '$has_temp?', '$pop', '$next_temp', '$succ', '$uses_block!', '$identify!', '$unique_temp', '$add_scope_temp', '$parent', '$def?', '$type', '$mid', '$rescue_else_sexp']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ScopeNode(){}; var self = $ScopeNode = $klass($base, $super, 'ScopeNode', $ScopeNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_40; def.type = def.defs = def.parent = def.temps = def.locals = def.compiler = def.proto_ivars = def.ivars = def.gvars = def.args = def.queue = def.unique = def.while_stack = def.identity = def.uses_block = def.in_ensure = nil; self.$attr_accessor("parent"); self.$attr_accessor("name"); self.$attr_accessor("block_name"); self.$attr_reader("scope_name"); self.$attr_reader("locals"); self.$attr_reader("ivars"); self.$attr_reader("gvars"); self.$attr_accessor("mid"); self.$attr_accessor("defs"); self.$attr_reader("methods"); self.$attr_accessor("uses_super"); self.$attr_accessor("uses_zuper"); self.$attr_accessor("catch_return", "has_break"); self.$attr_accessor("rescue_else_sexp"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize($a_rest) { var $b, $c, self = this, $iter = TMP_1.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_1.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } ($b = ($c = self, Opal.find_super_dispatcher(self, 'initialize', TMP_1, false)), $b.$$p = $iter, $b).apply($c, $zuper); self.locals = []; self.temps = []; self.args = []; self.ivars = []; self.gvars = []; self.parent = nil; self.queue = []; self.unique = "a"; self.while_stack = []; self.identity = nil; self.defs = nil; self.methods = []; self.uses_block = false; return self.proto_ivars = []; }, TMP_1.$$arity = -1); Opal.defn(self, '$in_scope', TMP_2 = function $$in_scope() { var $a, $b, TMP_3, self = this, $iter = TMP_2.$$p, block = $iter || nil; TMP_2.$$p = null; return ($a = ($b = self).$indent, $a.$$p = (TMP_3 = function(){var self = TMP_3.$$s || this, $c, $d; if (self.parent == null) self.parent = nil; self.parent = self.$compiler().$scope(); (($c = [self]), $d = self.$compiler(), $d['$scope='].apply($d, $c), $c[$c.length-1]); block.$call(self); return (($c = [self.parent]), $d = self.$compiler(), $d['$scope='].apply($d, $c), $c[$c.length-1]);}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3), $a).call($b); }, TMP_2.$$arity = 0); Opal.defn(self, '$class_scope?', TMP_4 = function() { var $a, self = this; return ((($a = self.type['$==']("class")) !== false && $a !== nil && $a != null) ? $a : self.type['$==']("module")); }, TMP_4.$$arity = 0); Opal.defn(self, '$class?', TMP_5 = function() { var self = this; return self.type['$==']("class"); }, TMP_5.$$arity = 0); Opal.defn(self, '$module?', TMP_6 = function() { var self = this; return self.type['$==']("module"); }, TMP_6.$$arity = 0); Opal.defn(self, '$sclass?', TMP_7 = function() { var self = this; return self.type['$==']("sclass"); }, TMP_7.$$arity = 0); Opal.defn(self, '$top?', TMP_8 = function() { var self = this; return self.type['$==']("top"); }, TMP_8.$$arity = 0); Opal.defn(self, '$iter?', TMP_9 = function() { var self = this; return self.type['$==']("iter"); }, TMP_9.$$arity = 0); Opal.defn(self, '$def?', TMP_10 = function() { var self = this; return self.type['$==']("def"); }, TMP_10.$$arity = 0); Opal.defn(self, '$def_in_class?', TMP_11 = function() { var $a, $b, $c, self = this; return ($a = ($b = ($c = self.defs['$!'](), $c !== false && $c !== nil && $c != null ?self.type['$==']("def") : $c), $b !== false && $b !== nil && $b != null ?self.parent : $b), $a !== false && $a !== nil && $a != null ?self.parent['$class?']() : $a); }, TMP_11.$$arity = 0); Opal.defn(self, '$proto', TMP_12 = function $$proto() { var self = this; return "def"; }, TMP_12.$$arity = 0); Opal.defn(self, '$to_vars', TMP_17 = function $$to_vars() { var $a, $b, $c, TMP_13, $d, TMP_14, $e, TMP_15, $f, TMP_16, self = this, vars = nil, iv = nil, gv = nil, indent = nil, str = nil, pvars = nil, result = nil; vars = self.temps.$dup(); ($a = vars).$push.apply($a, Opal.to_a(($b = ($c = self.locals).$map, $b.$$p = (TMP_13 = function(l){var self = TMP_13.$$s || this; if (l == null) l = nil; return "" + (l) + " = nil"}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13), $b).call($c))); iv = ($b = ($d = self.$ivars()).$map, $b.$$p = (TMP_14 = function(ivar){var self = TMP_14.$$s || this; if (ivar == null) ivar = nil; return "if (self" + (ivar) + " == null) self" + (ivar) + " = nil;\n"}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $b).call($d); gv = ($b = ($e = self.$gvars()).$map, $b.$$p = (TMP_15 = function(gvar){var self = TMP_15.$$s || this; if (gvar == null) gvar = nil; return "if ($gvars" + (gvar) + " == null) $gvars" + (gvar) + " = nil;\n"}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15), $b).call($e); indent = self.compiler.$parser_indent(); str = (function() {if ((($b = vars['$empty?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return "" } else { return "var " + (vars.$join(", ")) + ";\n" }; return nil; })(); if ((($b = self.$ivars()['$empty?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { str = $rb_plus(str, "" + (indent) + (iv.$join(indent))) }; if ((($b = self.$gvars()['$empty?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { str = $rb_plus(str, "" + (indent) + (gv.$join(indent))) }; if ((($b = ($f = self['$class?'](), $f !== false && $f !== nil && $f != null ?self.proto_ivars['$empty?']()['$!']() : $f)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { pvars = ($b = ($f = self.proto_ivars).$map, $b.$$p = (TMP_16 = function(i){var self = TMP_16.$$s || this; if (i == null) i = nil; return "" + (self.$proto()) + (i)}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16), $b).call($f).$join(" = "); result = "%s\n%s%s = nil;"['$%']([str, indent, pvars]); } else { result = str }; return self.$fragment(result); }, TMP_17.$$arity = 0); Opal.defn(self, '$add_scope_ivar', TMP_18 = function $$add_scope_ivar(ivar) { var $a, self = this; if ((($a = self['$def_in_class?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.parent.$add_proto_ivar(ivar) } else if ((($a = self.ivars['$include?'](ivar)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return self.ivars['$<<'](ivar) }; }, TMP_18.$$arity = 1); Opal.defn(self, '$add_scope_gvar', TMP_19 = function $$add_scope_gvar(gvar) { var $a, self = this; if ((($a = self.gvars['$include?'](gvar)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return self.gvars['$<<'](gvar) }; }, TMP_19.$$arity = 1); Opal.defn(self, '$add_proto_ivar', TMP_20 = function $$add_proto_ivar(ivar) { var $a, self = this; if ((($a = self.proto_ivars['$include?'](ivar)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return self.proto_ivars['$<<'](ivar) }; }, TMP_20.$$arity = 1); Opal.defn(self, '$add_arg', TMP_21 = function $$add_arg(arg) { var $a, self = this; if ((($a = self.args['$include?'](arg)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.args['$<<'](arg) }; return arg; }, TMP_21.$$arity = 1); Opal.defn(self, '$add_scope_local', TMP_22 = function $$add_scope_local(local) { var $a, self = this; if ((($a = self['$has_local?'](local)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; return self.locals['$<<'](local); }, TMP_22.$$arity = 1); Opal.defn(self, '$has_local?', TMP_23 = function(local) { var $a, $b, $c, self = this; if ((($a = ((($b = ((($c = self.locals['$include?'](local)) !== false && $c !== nil && $c != null) ? $c : self.args['$include?'](local))) !== false && $b !== nil && $b != null) ? $b : self.temps['$include?'](local))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return true}; if ((($a = ($b = self.parent, $b !== false && $b !== nil && $b != null ?self.type['$==']("iter") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.parent['$has_local?'](local)}; return false; }, TMP_23.$$arity = 1); Opal.defn(self, '$add_scope_temp', TMP_24 = function $$add_scope_temp(tmp) { var $a, self = this; if ((($a = self['$has_temp?'](tmp)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; return self.temps.$push(tmp); }, TMP_24.$$arity = 1); Opal.defn(self, '$has_temp?', TMP_25 = function(tmp) { var self = this; return self.temps['$include?'](tmp); }, TMP_25.$$arity = 1); Opal.defn(self, '$new_temp', TMP_26 = function $$new_temp() { var $a, self = this, tmp = nil; if ((($a = self.queue['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return self.queue.$pop() }; tmp = self.$next_temp(); self.temps['$<<'](tmp); return tmp; }, TMP_26.$$arity = 0); Opal.defn(self, '$next_temp', TMP_27 = function $$next_temp() { var $a, $b, self = this, tmp = nil; while ((($b = true) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { tmp = "$" + (self.unique); self.unique = self.unique.$succ(); if ((($b = self['$has_local?'](tmp)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { break; };}; return tmp; }, TMP_27.$$arity = 0); Opal.defn(self, '$queue_temp', TMP_28 = function $$queue_temp(name) { var self = this; return self.queue['$<<'](name); }, TMP_28.$$arity = 1); Opal.defn(self, '$push_while', TMP_29 = function $$push_while() { var self = this, info = nil; info = $hash2([], {}); self.while_stack.$push(info); return info; }, TMP_29.$$arity = 0); Opal.defn(self, '$pop_while', TMP_30 = function $$pop_while() { var self = this; return self.while_stack.$pop(); }, TMP_30.$$arity = 0); Opal.defn(self, '$in_while?', TMP_31 = function() { var self = this; return self.while_stack['$empty?']()['$!'](); }, TMP_31.$$arity = 0); Opal.defn(self, '$uses_block!', TMP_32 = function() { var $a, $b, self = this; if ((($a = (($b = self.type['$==']("iter")) ? self.parent : self.type['$==']("iter"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.parent['$uses_block!']() } else { self.uses_block = true; return self['$identify!'](); }; }, TMP_32.$$arity = 0); Opal.defn(self, '$identify!', TMP_33 = function() { var $a, self = this; if ((($a = self.identity) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.identity}; self.identity = self.compiler.$unique_temp(); if ((($a = self.parent) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.parent.$add_scope_temp(self.identity)}; return self.identity; }, TMP_33.$$arity = 0); Opal.defn(self, '$identity', TMP_34 = function $$identity() { var self = this; return self.identity; }, TMP_34.$$arity = 0); Opal.defn(self, '$find_parent_def', TMP_35 = function $$find_parent_def() { var $a, $b, self = this, scope = nil; scope = self; while ((($b = scope = scope.$parent()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { if ((($b = scope['$def?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return scope}}; return nil; }, TMP_35.$$arity = 0); Opal.defn(self, '$get_super_chain', TMP_36 = function $$get_super_chain() { var $a, $b, self = this, chain = nil, scope = nil, defn = nil, mid = nil; $a = [[], self, "null", "null"], chain = $a[0], scope = $a[1], defn = $a[2], mid = $a[3], $a; while (scope !== false && scope !== nil && scope != null) { if (scope.$type()['$==']("iter")) { chain['$<<'](scope['$identify!']()); if ((($b = scope.$parent()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { scope = scope.$parent()}; } else if (scope.$type()['$==']("def")) { defn = scope['$identify!'](); mid = "'" + (scope.$mid()) + "'"; break;; } else { break; }}; return [chain, defn, mid]; }, TMP_36.$$arity = 0); Opal.defn(self, '$uses_block?', TMP_37 = function() { var self = this; return self.uses_block; }, TMP_37.$$arity = 0); Opal.defn(self, '$has_rescue_else?', TMP_38 = function() { var self = this; return self.$rescue_else_sexp()['$!']()['$!'](); }, TMP_38.$$arity = 0); Opal.defn(self, '$in_ensure', TMP_39 = function $$in_ensure() { var self = this, $iter = TMP_39.$$p, $yield = $iter || nil, result = nil; TMP_39.$$p = null; if (($yield !== nil)) { } else { return nil }; self.in_ensure = true; result = Opal.yieldX($yield, []); return self.in_ensure = false; }, TMP_39.$$arity = 0); return (Opal.defn(self, '$in_ensure?', TMP_40 = function() { var self = this; return self.in_ensure['$!']()['$!'](); }, TMP_40.$$arity = 0), nil) && 'in_ensure?'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/module"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$children', '$name_and_base', '$helper', '$push', '$line', '$in_scope', '$name=', '$scope', '$add_temp', '$proto', '$stmt', '$body', '$s', '$empty_line', '$to_vars', '$==', '$type', '$cid', '$to_s', '$[]', '$expr', '$raise']); self.$require("opal/nodes/scope"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ModuleNode(){}; var self = $ModuleNode = $klass($base, $super, 'ModuleNode', $ModuleNode); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_3; self.$handle("module"); self.$children("cid", "body"); Opal.defn(self, '$compile', TMP_2 = function $$compile() { var $a, $b, TMP_1, self = this, name = nil, base = nil; $b = self.$name_and_base(), $a = Opal.to_ary($b), name = ($a[0] == null ? nil : $a[0]), base = ($a[1] == null ? nil : $a[1]), $b; self.$helper("module"); self.$push("(function($base) {"); self.$line(" var $" + (name) + ", self = $" + (name) + " = $module($base, '" + (name) + "');"); ($a = ($b = self).$in_scope, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this, $c, $d, body_code = nil; (($c = [name]), $d = self.$scope(), $d['$name='].apply($d, $c), $c[$c.length-1]); self.$add_temp("" + (self.$scope().$proto()) + " = self.$$proto"); self.$add_temp("$scope = self.$$scope"); body_code = self.$stmt(((($c = self.$body()) !== false && $c !== nil && $c != null) ? $c : self.$s("nil"))); self.$empty_line(); self.$line(self.$scope().$to_vars()); return self.$line(body_code);}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b); return self.$line("})(", base, ")"); }, TMP_2.$$arity = 0); return (Opal.defn(self, '$name_and_base', TMP_3 = function $$name_and_base() { var self = this; if (self.$cid().$type()['$==']("const")) { return [self.$cid()['$[]'](1).$to_s(), "$scope.base"] } else if (self.$cid().$type()['$==']("colon2")) { return [self.$cid()['$[]'](2).$to_s(), self.$expr(self.$cid()['$[]'](1))] } else if (self.$cid().$type()['$==']("colon3")) { return [self.$cid()['$[]'](1).$to_s(), "Opal.Object"] } else { return self.$raise("Bad receiver in module") }; }, TMP_3.$$arity = 0), nil) && 'name_and_base'; })($scope.base, $scope.get('ScopeNode')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/class"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$children', '$name_and_base', '$helper', '$push', '$line', '$in_scope', '$name=', '$scope', '$add_temp', '$proto', '$body_code', '$empty_line', '$to_vars', '$super_code', '$sup', '$expr', '$stmt', '$returns', '$compiler', '$body', '$s']); self.$require("opal/nodes/module"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ClassNode(){}; var self = $ClassNode = $klass($base, $super, 'ClassNode', $ClassNode); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_3, TMP_4; self.$handle("class"); self.$children("cid", "sup", "body"); Opal.defn(self, '$compile', TMP_2 = function $$compile() { var $a, $b, TMP_1, self = this, name = nil, base = nil; $b = self.$name_and_base(), $a = Opal.to_ary($b), name = ($a[0] == null ? nil : $a[0]), base = ($a[1] == null ? nil : $a[1]), $b; self.$helper("klass"); self.$push("(function($base, $super) {"); self.$line(" function $" + (name) + "(){};"); self.$line(" var self = $" + (name) + " = $klass($base, $super, '" + (name) + "', $" + (name) + ");"); ($a = ($b = self).$in_scope, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this, $c, $d, body_code = nil; (($c = [name]), $d = self.$scope(), $d['$name='].apply($d, $c), $c[$c.length-1]); self.$add_temp("" + (self.$scope().$proto()) + " = self.$$proto"); self.$add_temp("$scope = self.$$scope"); body_code = self.$body_code(); self.$empty_line(); self.$line(self.$scope().$to_vars()); return self.$line(body_code);}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b); return self.$line("})(", base, ", ", self.$super_code(), ")"); }, TMP_2.$$arity = 0); Opal.defn(self, '$super_code', TMP_3 = function $$super_code() { var $a, self = this; if ((($a = self.$sup()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$expr(self.$sup()) } else { return "null" }; }, TMP_3.$$arity = 0); return (Opal.defn(self, '$body_code', TMP_4 = function $$body_code() { var $a, self = this; return self.$stmt(self.$compiler().$returns(((($a = self.$body()) !== false && $a !== nil && $a != null) ? $a : self.$s("nil")))); }, TMP_4.$$arity = 0), nil) && 'body_code'; })($scope.base, $scope.get('ModuleNode')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/singleton_class"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$children', '$push', '$in_scope', '$add_temp', '$stmt', '$returns', '$compiler', '$body', '$line', '$to_vars', '$scope', '$recv', '$object']); self.$require("opal/nodes/scope"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $SingletonClassNode(){}; var self = $SingletonClassNode = $klass($base, $super, 'SingletonClassNode', $SingletonClassNode); var def = self.$$proto, $scope = self.$$scope, TMP_2; self.$handle("sclass"); self.$children("object", "body"); return (Opal.defn(self, '$compile', TMP_2 = function $$compile() { var $a, $b, TMP_1, self = this; self.$push("(function(self) {"); ($a = ($b = self).$in_scope, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this, body_stmt = nil; self.$add_temp("$scope = self.$$scope"); self.$add_temp("def = self.$$proto"); body_stmt = self.$stmt(self.$compiler().$returns(self.$body())); self.$line(self.$scope().$to_vars()); return self.$line(body_stmt);}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b); return self.$line("})(Opal.get_singleton_class(", self.$recv(self.$object()), "))"); }, TMP_2.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('ScopeNode')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/inline_args"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$push', '$join', '$arg_names', '$inject', '$type', '$===', '$<<', '$add_arg', '$next_temp', '$scope', '$[]=', '$mlhs_mapping', '$to_s', '$variable', '$[]', '$!', '$meta', '$!=', '$+', '$raise', '$inspect', '$children', '$to_sym']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $InlineArgs(){}; var self = $InlineArgs = $klass($base, $super, 'InlineArgs', $InlineArgs); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_3, TMP_4; self.$handle("inline_args"); Opal.defn(self, '$compile', TMP_1 = function $$compile() { var self = this; return self.$push(self.$arg_names().$join(", ")); }, TMP_1.$$arity = 0); Opal.defn(self, '$arg_names', TMP_3 = function $$arg_names() { var $a, $b, TMP_2, self = this, done_kwargs = nil; done_kwargs = false; return ($a = ($b = self.$children()).$inject, $a.$$p = (TMP_2 = function(result, child){var self = TMP_2.$$s || this, $c, $d, $case = nil, tmp = nil, arg_name = nil, tmp_arg_name = nil; if (result == null) result = nil;if (child == null) child = nil; $case = child.$type();if ("kwarg"['$===']($case) || "kwoptarg"['$===']($case) || "kwrestarg"['$===']($case)) {if (done_kwargs !== false && done_kwargs !== nil && done_kwargs != null) { } else { done_kwargs = true; result['$<<']("$kwargs"); }; self.$add_arg(child);}else if ("mlhs"['$===']($case)) {tmp = self.$scope().$next_temp(); result['$<<'](tmp); self.$scope().$mlhs_mapping()['$[]='](child, tmp);}else if ("arg"['$===']($case) || "optarg"['$===']($case)) {arg_name = self.$variable(child['$[]'](1)).$to_s(); if ((($c = ($d = child.$meta()['$[]']("inline")['$!'](), $d !== false && $d !== nil && $d != null ?arg_name['$[]'](0)['$!=']("$") : $d)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { arg_name = "$" + (arg_name)}; result['$<<'](arg_name); self.$add_arg(child);}else if ("restarg"['$===']($case)) {tmp_arg_name = $rb_plus(self.$scope().$next_temp(), "_rest"); result['$<<'](tmp_arg_name); self.$add_arg(child);}else {self.$raise("Unknown argument type " + (child.$inspect()))}; return result;}, TMP_2.$$s = self, TMP_2.$$arity = 2, TMP_2), $a).call($b, []); }, TMP_3.$$arity = 0); return (Opal.defn(self, '$add_arg', TMP_4 = function $$add_arg(arg) { var $a, self = this, arg_name = nil; if ((($a = arg['$[]'](1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { arg_name = self.$variable(arg['$[]'](1).$to_sym()); return self.$scope().$add_arg(arg_name); } else { return nil }; }, TMP_4.$$arity = 1), nil) && 'add_arg'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/args/normarg"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$to_sym', '$[]', '$variable', '$meta', '$add_temp', '$line', '$working_arguments', '$scope', '$in_mlhs?']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $NormargNode(){}; var self = $NormargNode = $klass($base, $super, 'NormargNode', $NormargNode); var def = self.$$proto, $scope = self.$$scope, TMP_1; def.sexp = nil; self.$handle("arg"); return (Opal.defn(self, '$compile', TMP_1 = function $$compile() { var $a, self = this, arg_name = nil, var_name = nil; arg_name = self.sexp['$[]'](1).$to_sym(); var_name = self.$variable(arg_name); if ((($a = self.sexp.$meta()['$[]']("post")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$add_temp(var_name); self.$line("" + (var_name) + " = " + (self.$scope().$working_arguments()) + ".splice(0,1)[0];");}; if ((($a = self.$scope()['$in_mlhs?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$line("if (" + (var_name) + " == null) {"); self.$line(" " + (var_name) + " = nil;"); return self.$line("}"); } else { return nil }; }, TMP_1.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/args/optarg"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$to_sym', '$[]', '$variable', '$==', '$line', '$expr', '$push']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $OptargNode(){}; var self = $OptargNode = $klass($base, $super, 'OptargNode', $OptargNode); var def = self.$$proto, $scope = self.$$scope, TMP_1; def.sexp = nil; self.$handle("optarg"); return (Opal.defn(self, '$compile', TMP_1 = function $$compile() { var self = this, optarg_name = nil, default_value = nil, var_name = nil; optarg_name = self.sexp['$[]'](1).$to_sym(); default_value = self.sexp['$[]'](2); var_name = self.$variable(optarg_name); if (default_value['$[]'](2)['$==']("undefined")) { return nil}; self.$line("if (" + (var_name) + " == null) {"); self.$line(" " + (var_name) + " = ", self.$expr(default_value)); self.$push(";"); return self.$line("}"); }, TMP_1.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/args/mlhsarg"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$s', '$children', '$[]', '$meta', '$mlhs_name', '$[]=', '$with_inline_args', '$push', '$process', '$scope', '$mlhs_mapping', '$line', '$in_mlhs', '$each', '$type', '$===', '$<<', '$join', '$to_s', '$take_while', '$!=']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $MlhsArgNode(){}; var self = $MlhsArgNode = $klass($base, $super, 'MlhsArgNode', $MlhsArgNode); var def = self.$$proto, $scope = self.$$scope, TMP_4, TMP_6, TMP_8; def.sexp = def.mlhs_name = def.inline_args = nil; self.$handle("mlhs"); Opal.defn(self, '$compile', TMP_4 = function $$compile() { var $a, $b, $c, TMP_1, $d, TMP_2, self = this, args_sexp = nil, mlhs_sexp = nil, var_name = nil; args_sexp = ($a = self).$s.apply($a, ["post_args"].concat(Opal.to_a(self.$children()))); if ((($b = self.sexp.$meta()['$[]']("post")) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { mlhs_sexp = self.$s("arg", self.$mlhs_name()); mlhs_sexp.$meta()['$[]=']("post", true); ($b = ($c = self.$scope()).$with_inline_args, $b.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this; return self.$push(self.$process(mlhs_sexp))}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $b).call($c, []); var_name = args_sexp.$meta()['$[]=']("js_source", self.$mlhs_name()); } else { var_name = args_sexp.$meta()['$[]=']("js_source", self.$scope().$mlhs_mapping()['$[]'](self.sexp)) }; self.$line("if (" + (var_name) + " == null) {"); self.$line(" " + (var_name) + " = nil;"); self.$line("}"); self.$line("" + (var_name) + " = Opal.to_ary(" + (var_name) + ");"); return ($b = ($d = self.$scope()).$with_inline_args, $b.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this, $e, $f, TMP_3; return ($e = ($f = self.$scope()).$in_mlhs, $e.$$p = (TMP_3 = function(){var self = TMP_3.$$s || this; return self.$push(self.$process(args_sexp))}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3), $e).call($f)}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $b).call($d, []); }, TMP_4.$$arity = 0); Opal.defn(self, '$mlhs_name', TMP_6 = function $$mlhs_name() { var $a, $b, $c, TMP_5, self = this, result = nil; return ((($a = self.mlhs_name) !== false && $a !== nil && $a != null) ? $a : self.mlhs_name = (function() {if ((($b = self.sexp.$meta()['$[]']("post")) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { result = ["$mlhs_of"]; ($b = ($c = self.$children()).$each, $b.$$p = (TMP_5 = function(child){var self = TMP_5.$$s || this, $case = nil; if (child == null) child = nil; return (function() {$case = child.$type();if ("arg"['$===']($case)) {return result['$<<'](child['$[]'](1))}else if ("mlhs"['$===']($case)) {return result['$<<']("mlhs")}else { return nil }})()}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $b).call($c); return result.$join("_"); } else { return self.sexp['$[]'](1).$to_s() }; return nil; })()); }, TMP_6.$$arity = 0); return (Opal.defn(self, '$inline_args', TMP_8 = function $$inline_args() { var $a, $b, $c, TMP_7, self = this; return ((($a = self.inline_args) !== false && $a !== nil && $a != null) ? $a : self.inline_args = ($b = ($c = self.$children()).$take_while, $b.$$p = (TMP_7 = function(arg){var self = TMP_7.$$s || this, $d; if (arg == null) arg = nil; return ($d = arg.$type()['$!=']("restarg"), $d !== false && $d !== nil && $d != null ?arg.$type()['$!=']("optarg") : $d)}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $b).call($c)); }, TMP_8.$$arity = 0), nil) && 'inline_args'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/args/restarg"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$[]', '$variable', '$to_sym', '$add_temp', '$meta', '$line', '$working_arguments', '$scope']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $RestargNode(){}; var self = $RestargNode = $klass($base, $super, 'RestargNode', $RestargNode); var def = self.$$proto, $scope = self.$$scope, TMP_1; def.sexp = nil; self.$handle("restarg"); return (Opal.defn(self, '$compile', TMP_1 = function $$compile() { var $a, self = this, restarg_name = nil, var_name = nil, offset = nil; restarg_name = self.sexp['$[]'](1); if (restarg_name !== false && restarg_name !== nil && restarg_name != null) { } else { return nil }; var_name = self.$variable(restarg_name.$to_sym()); self.$add_temp(var_name); if ((($a = self.sexp.$meta()['$[]']("post")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$line("" + (var_name) + " = " + (self.$scope().$working_arguments()) + ";") } else { offset = self.sexp.$meta()['$[]']("offset"); self.$line("var $args_len = arguments.length, $rest_len = $args_len - " + (offset) + ";"); self.$line("if ($rest_len < 0) { $rest_len = 0; }"); self.$line("" + (var_name) + " = new Array($rest_len);"); self.$line("for (var $arg_idx = " + (offset) + "; $arg_idx < $args_len; $arg_idx++) {"); self.$line(" " + (var_name) + "[$arg_idx - " + (offset) + "] = arguments[$arg_idx];"); return self.$line("}"); }; }, TMP_1.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/args/initialize_kwargs"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$kwargs_initialized', '$scope', '$helper', '$line', '$kwargs_initialized=']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $InitializeKwargsNode(){}; var self = $InitializeKwargsNode = $klass($base, $super, 'InitializeKwargsNode', $InitializeKwargsNode); var def = self.$$proto, $scope = self.$$scope, TMP_1; return (Opal.defn(self, '$initialize_kw_args_if_needed', TMP_1 = function $$initialize_kw_args_if_needed() { var $a, $b, self = this; if ((($a = self.$scope().$kwargs_initialized()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; self.$helper("hash2"); self.$line("if ($kwargs == null || !$kwargs.$$is_hash) {"); self.$line(" if ($kwargs == null) {"); self.$line(" $kwargs = $hash2([], {});"); self.$line(" } else {"); self.$line(" throw Opal.ArgumentError.$new('expected kwargs');"); self.$line(" }"); self.$line("}"); return (($a = [true]), $b = self.$scope(), $b['$kwargs_initialized='].apply($b, $a), $a[$a.length-1]); }, TMP_1.$$arity = 0), nil) && 'initialize_kw_args_if_needed' })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/args/kwarg"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$initialize_kw_args_if_needed', '$to_sym', '$[]', '$variable', '$add_temp', '$line', '$<<', '$used_kwargs', '$scope']); self.$require("opal/nodes/args/initialize_kwargs"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $KwargNode(){}; var self = $KwargNode = $klass($base, $super, 'KwargNode', $KwargNode); var def = self.$$proto, $scope = self.$$scope, TMP_1; def.sexp = nil; self.$handle("kwarg"); return (Opal.defn(self, '$compile', TMP_1 = function $$compile() { var self = this, kwarg_name = nil, var_name = nil; self.$initialize_kw_args_if_needed(); kwarg_name = self.sexp['$[]'](1).$to_sym(); var_name = self.$variable(kwarg_name); self.$add_temp(var_name); self.$line("if (!$kwargs.$$smap.hasOwnProperty('" + (kwarg_name) + "')) {"); self.$line(" throw Opal.ArgumentError.$new('missing keyword: " + (kwarg_name) + "');"); self.$line("}"); self.$line("" + (var_name) + " = $kwargs.$$smap['" + (kwarg_name) + "'];"); return self.$scope().$used_kwargs()['$<<'](kwarg_name); }, TMP_1.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('InitializeKwargsNode')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/args/kwoptarg"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$initialize_kw_args_if_needed', '$to_sym', '$[]', '$variable', '$add_temp', '$line', '$expr', '$<<', '$used_kwargs', '$scope']); self.$require("opal/nodes/args/initialize_kwargs"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $KwoptArgNode(){}; var self = $KwoptArgNode = $klass($base, $super, 'KwoptArgNode', $KwoptArgNode); var def = self.$$proto, $scope = self.$$scope, TMP_1; def.sexp = nil; self.$handle("kwoptarg"); return (Opal.defn(self, '$compile', TMP_1 = function $$compile() { var self = this, kwoptarg_name = nil, default_value = nil, var_name = nil; self.$initialize_kw_args_if_needed(); kwoptarg_name = self.sexp['$[]'](1).$to_sym(); default_value = self.sexp['$[]'](2); var_name = self.$variable(kwoptarg_name); self.$add_temp(var_name); self.$line("if ((" + (var_name) + " = $kwargs.$$smap['" + (kwoptarg_name) + "']) == null) {"); self.$line(" " + (var_name) + " = ", self.$expr(default_value)); self.$line("}"); return self.$scope().$used_kwargs()['$<<'](kwoptarg_name); }, TMP_1.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('InitializeKwargsNode')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/args/kwrestarg"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$initialize_kw_args_if_needed', '$[]', '$used_kwargs', '$variable', '$to_sym', '$add_temp', '$line', '$map', '$scope', '$join']); self.$require("opal/nodes/args/initialize_kwargs"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $KwrestArgNode(){}; var self = $KwrestArgNode = $klass($base, $super, 'KwrestArgNode', $KwrestArgNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_3; def.sexp = nil; self.$handle("kwrestarg"); Opal.defn(self, '$compile', TMP_1 = function $$compile() { var self = this, kwrestarg_name = nil, extract_code = nil, var_name = nil; self.$initialize_kw_args_if_needed(); kwrestarg_name = self.sexp['$[]'](1); extract_code = "Opal.kwrestargs($kwargs, " + (self.$used_kwargs()) + ");"; if (kwrestarg_name !== false && kwrestarg_name !== nil && kwrestarg_name != null) { var_name = self.$variable(kwrestarg_name.$to_sym()); self.$add_temp(var_name); return self.$line("" + (var_name) + " = " + (extract_code)); } else { return nil }; }, TMP_1.$$arity = 0); return (Opal.defn(self, '$used_kwargs', TMP_3 = function $$used_kwargs() { var $a, $b, TMP_2, self = this, args = nil; args = ($a = ($b = self.$scope().$used_kwargs()).$map, $a.$$p = (TMP_2 = function(arg_name){var self = TMP_2.$$s || this; if (arg_name == null) arg_name = nil; return "'" + (arg_name) + "': true"}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($b); return "{" + (args.$join(",")) + "}"; }, TMP_3.$$arity = 0), nil) && 'used_kwargs'; })($scope.base, $scope.get('InitializeKwargsNode')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/args/post_kwargs"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$empty?', '$children', '$initialize_kw_args', '$each', '$push', '$process', '$line', '$working_arguments', '$scope']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $PostKwargsNode(){}; var self = $PostKwargsNode = $klass($base, $super, 'PostKwargsNode', $PostKwargsNode); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_3; self.$handle("post_kwargs"); Opal.defn(self, '$compile', TMP_2 = function $$compile() { var $a, $b, TMP_1, self = this; if ((($a = self.$children()['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; self.$initialize_kw_args(); return ($a = ($b = self.$children()).$each, $a.$$p = (TMP_1 = function(arg){var self = TMP_1.$$s || this; if (arg == null) arg = nil; return self.$push(self.$process(arg))}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); }, TMP_2.$$arity = 0); return (Opal.defn(self, '$initialize_kw_args', TMP_3 = function $$initialize_kw_args() { var self = this; return self.$line("$kwargs = Opal.extract_kwargs(" + (self.$scope().$working_arguments()) + ");"); }, TMP_3.$$arity = 0), nil) && 'initialize_kw_args'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/args/post_args"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$attr_reader', '$each', '$[]=', '$meta', '$type', '$===', '$<<', '$children', '$empty?', '$working_arguments', '$scope', '$[]', '$working_arguments=', '$add_temp', '$line', '$size', '$inline_args', '$extract_arguments', '$push', '$process', '$kwargs_sexp', '$compile_required_arg', '$required_left_args', '$compile_optarg', '$optargs', '$compile_restarg', '$required_right_args', '$variable', '$to_sym', '$indent', '$restarg', '$extract_restarg', '$extract_blank_restarg', '$s', '$kwargs']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $PostArgsNode(){}; var self = $PostArgsNode = $klass($base, $super, 'PostArgsNode', $PostArgsNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_3, TMP_7, TMP_9, TMP_10, TMP_13, TMP_14, TMP_15, TMP_16; def.sexp = nil; self.$handle("post_args"); self.$attr_reader("kwargs"); self.$attr_reader("required_left_args"); self.$attr_reader("optargs"); self.$attr_reader("restarg"); self.$attr_reader("required_right_args"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize($a_rest) { var $b, $c, self = this, $iter = TMP_1.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_1.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } ($b = ($c = self, Opal.find_super_dispatcher(self, 'initialize', TMP_1, false)), $b.$$p = $iter, $b).apply($c, $zuper); self.kwargs = []; self.required_left_args = []; self.optargs = []; self.restarg = nil; return self.required_right_args = []; }, TMP_1.$$arity = -1); Opal.defn(self, '$extract_arguments', TMP_3 = function $$extract_arguments() { var $a, $b, TMP_2, self = this, found_opt_or_rest = nil; found_opt_or_rest = false; return ($a = ($b = self.$children()).$each, $a.$$p = (TMP_2 = function(arg){var self = TMP_2.$$s || this, $case = nil; if (self.kwargs == null) self.kwargs = nil; if (self.optargs == null) self.optargs = nil; if (self.required_right_args == null) self.required_right_args = nil; if (self.required_left_args == null) self.required_left_args = nil; if (arg == null) arg = nil; arg.$meta()['$[]=']("post", true); return (function() {$case = arg.$type();if ("kwarg"['$===']($case) || "kwoptarg"['$===']($case) || "kwrestarg"['$===']($case)) {return self.kwargs['$<<'](arg)}else if ("restarg"['$===']($case)) {self.restarg = arg; return found_opt_or_rest = true;}else if ("optarg"['$===']($case)) {self.optargs['$<<'](arg); return found_opt_or_rest = true;}else if ("arg"['$===']($case) || "mlhs"['$===']($case)) {if (found_opt_or_rest !== false && found_opt_or_rest !== nil && found_opt_or_rest != null) { return self.required_right_args['$<<'](arg) } else { return self.required_left_args['$<<'](arg) }}else { return nil }})();}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($b); }, TMP_3.$$arity = 0); Opal.defn(self, '$compile', TMP_7 = function $$compile() { var $a, $b, TMP_4, $c, TMP_5, $d, TMP_6, $e, self = this, old_working_arguments = nil, js_source = nil; if ((($a = self.$children()['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil}; old_working_arguments = self.$scope().$working_arguments(); if ((($a = self.sexp.$meta()['$[]']("js_source")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { js_source = self.sexp.$meta()['$[]']("js_source"); (($a = ["" + (js_source) + "_args"]), $b = self.$scope(), $b['$working_arguments='].apply($b, $a), $a[$a.length-1]); } else { js_source = "arguments"; (($a = ["$post_args"]), $b = self.$scope(), $b['$working_arguments='].apply($b, $a), $a[$a.length-1]); }; self.$add_temp("" + (self.$scope().$working_arguments())); self.$line("" + (self.$scope().$working_arguments()) + " = Opal.slice.call(" + (js_source) + ", " + (self.$scope().$inline_args().$size()) + ", " + (js_source) + ".length);"); self.$extract_arguments(); self.$push(self.$process(self.$kwargs_sexp())); ($a = ($b = self.$required_left_args()).$each, $a.$$p = (TMP_4 = function(arg){var self = TMP_4.$$s || this; if (arg == null) arg = nil; return self.$compile_required_arg(arg)}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $a).call($b); ($a = ($c = self.$optargs()).$each, $a.$$p = (TMP_5 = function(optarg){var self = TMP_5.$$s || this; if (optarg == null) optarg = nil; return self.$compile_optarg(optarg)}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $a).call($c); self.$compile_restarg(); ($a = ($d = self.$required_right_args()).$each, $a.$$p = (TMP_6 = function(arg){var self = TMP_6.$$s || this; if (arg == null) arg = nil; return self.$compile_required_arg(arg)}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $a).call($d); return (($a = [old_working_arguments]), $e = self.$scope(), $e['$working_arguments='].apply($e, $a), $a[$a.length-1]); }, TMP_7.$$arity = 0); Opal.defn(self, '$compile_optarg', TMP_9 = function $$compile_optarg(optarg) { var $a, $b, TMP_8, self = this, var_name = nil; var_name = self.$variable(optarg['$[]'](1).$to_sym()); self.$add_temp(var_name); self.$line("if (" + (self.$required_right_args().$size()) + " < " + (self.$scope().$working_arguments()) + ".length) {"); ($a = ($b = self).$indent, $a.$$p = (TMP_8 = function(){var self = TMP_8.$$s || this; return self.$line("" + (var_name) + " = " + (self.$scope().$working_arguments()) + ".splice(0,1)[0];")}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8), $a).call($b); self.$line("}"); return self.$push(self.$process(optarg)); }, TMP_9.$$arity = 1); Opal.defn(self, '$compile_required_arg', TMP_10 = function $$compile_required_arg(arg) { var self = this; return self.$push(self.$process(arg)); }, TMP_10.$$arity = 1); Opal.defn(self, '$compile_restarg', TMP_13 = function $$compile_restarg() { var $a, $b, TMP_11, $c, TMP_12, self = this; if ((($a = self.$restarg()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { return nil }; self.$line("if (" + (self.$required_right_args().$size()) + " < " + (self.$scope().$working_arguments()) + ".length) {"); ($a = ($b = self).$indent, $a.$$p = (TMP_11 = function(){var self = TMP_11.$$s || this; return self.$extract_restarg()}, TMP_11.$$s = self, TMP_11.$$arity = 0, TMP_11), $a).call($b); self.$line("} else {"); ($a = ($c = self).$indent, $a.$$p = (TMP_12 = function(){var self = TMP_12.$$s || this; return self.$extract_blank_restarg()}, TMP_12.$$s = self, TMP_12.$$arity = 0, TMP_12), $a).call($c); return self.$line("}"); }, TMP_13.$$arity = 0); Opal.defn(self, '$extract_restarg', TMP_14 = function $$extract_restarg() { var $a, self = this, extract_code = nil, var_name = nil; extract_code = "" + (self.$scope().$working_arguments()) + ".splice(0, " + (self.$scope().$working_arguments()) + ".length - " + (self.$required_right_args().$size()) + ");"; if ((($a = self.$restarg()['$[]'](1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { var_name = self.$variable(self.$restarg()['$[]'](1).$to_sym()); self.$add_temp(var_name); return self.$line("" + (var_name) + " = " + (extract_code)); } else { return self.$line(extract_code) }; }, TMP_14.$$arity = 0); Opal.defn(self, '$extract_blank_restarg', TMP_15 = function $$extract_blank_restarg() { var $a, self = this, var_name = nil; if ((($a = self.$restarg()['$[]'](1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { var_name = self.$variable(self.$restarg()['$[]'](1).$to_sym()); self.$add_temp(var_name); return self.$line("" + (var_name) + " = [];"); } else { return nil }; }, TMP_15.$$arity = 0); return (Opal.defn(self, '$kwargs_sexp', TMP_16 = function $$kwargs_sexp() { var $a, self = this; return ($a = self).$s.apply($a, ["post_kwargs"].concat(Opal.to_a(self.$kwargs()))); }, TMP_16.$$arity = 0), nil) && 'kwargs_sexp'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/node_with_args"] = function(Opal) { function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_lt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $range = Opal.range; Opal.add_stubs(['$require', '$attr_accessor', '$attr_writer', '$attr_reader', '$[]', '$args', '$each_with_index', '$==', '$-', '$length', '$type', '$===', '$<<', '$any?', '$!=', '$each', '$[]=', '$meta', '$inline_args', '$optimize_args!', '$select', '$first', '$find', '$include?', '$s', '$post_args', '$push', '$process', '$post_args_sexp', '$uses_block?', '$scope', '$identity', '$block_name', '$add_temp', '$line', '$inline_args=', '$pop', '$keyword_args', '$all?', '$rest_arg', '$opt_args', '$has_only_optional_kwargs?', '$negative_arity', '$positive_arity', '$children', '$size', '$has_required_kwargs?', '$+', '$-@', '$map', '$build_parameter', '$block_arg', '$join', '$!', '$empty?', '$<', '$>']); self.$require("opal/nodes/scope"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $NodeWithArgs(){}; var self = $NodeWithArgs = $klass($base, $super, 'NodeWithArgs', $NodeWithArgs); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_5, TMP_7, TMP_9, TMP_11, TMP_12, TMP_13, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_23, TMP_25, TMP_26, TMP_28, TMP_29, TMP_30, TMP_32, TMP_33; def.opt_args = def.rest_arg = def.keyword_args = def.in_mlhs = def.arity_checks = nil; self.$attr_accessor("mlhs_args"); self.$attr_accessor("used_kwargs"); self.$attr_accessor("mlhs_mapping"); self.$attr_accessor("working_arguments"); self.$attr_writer("inline_args"); self.$attr_accessor("kwargs_initialized"); self.$attr_reader("inline_args", "post_args"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize($a_rest) { var $b, $c, self = this, $iter = TMP_1.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_1.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } ($b = ($c = self, Opal.find_super_dispatcher(self, 'initialize', TMP_1, false)), $b.$$p = $iter, $b).apply($c, $zuper); self.mlhs_args = $hash2([], {}); self.used_kwargs = []; self.mlhs_mapping = $hash2([], {}); self.working_arguments = nil; self.in_mlhs = false; self.kwargs_initialized = false; self.inline_args = []; self.post_args = []; return self.post_args_started = false; }, TMP_1.$$arity = -1); Opal.defn(self, '$split_args', TMP_5 = function $$split_args() { var $a, $b, TMP_2, $c, TMP_4, self = this, args = nil; args = self.$args()['$[]']($range(1, -1, false)); ($a = ($b = args).$each_with_index, $a.$$p = (TMP_2 = function(arg, idx){var self = TMP_2.$$s || this, $c, $d, $e, TMP_3, last_argument = nil, $case = nil; if (self.post_args_started == null) self.post_args_started = nil; if (self.post_args == null) self.post_args = nil; if (self.inline_args == null) self.inline_args = nil; if (arg == null) arg = nil;if (idx == null) idx = nil; last_argument = (idx['$==']($rb_minus(args.$length(), 1))); return (function() {$case = arg.$type();if ("arg"['$===']($case) || "mlhs"['$===']($case) || "kwarg"['$===']($case) || "kwoptarg"['$===']($case) || "kwrestarg"['$===']($case)) {if ((($c = self.post_args_started) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.post_args['$<<'](arg) } else { return self.inline_args['$<<'](arg) }}else if ("restarg"['$===']($case)) {self.post_args_started = true; return self.post_args['$<<'](arg);}else if ("optarg"['$===']($case)) {if ((($c = ($d = ($e = args['$[]'](idx, args.$length()))['$any?'], $d.$$p = (TMP_3 = function(next_arg){var self = TMP_3.$$s || this, $f; if (next_arg == null) next_arg = nil; return ($f = next_arg.$type()['$!=']("optarg"), $f !== false && $f !== nil && $f != null ?next_arg.$type()['$!=']("restarg") : $f)}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $d).call($e)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.post_args_started = true}; if ((($c = self.post_args_started) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.post_args['$<<'](arg) } else { return self.inline_args['$<<'](arg) };}else { return nil }})();}, TMP_2.$$s = self, TMP_2.$$arity = 2, TMP_2), $a).call($b); ($a = ($c = self.$inline_args()).$each, $a.$$p = (TMP_4 = function(inline_arg){var self = TMP_4.$$s || this; if (inline_arg == null) inline_arg = nil; return inline_arg.$meta()['$[]=']("inline", true)}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $a).call($c); return self['$optimize_args!'](); }, TMP_5.$$arity = 0); Opal.defn(self, '$opt_args', TMP_7 = function $$opt_args() { var $a, $b, $c, TMP_6, self = this; return ((($a = self.opt_args) !== false && $a !== nil && $a != null) ? $a : self.opt_args = ($b = ($c = self.$args()['$[]']($range(1, -1, false))).$select, $b.$$p = (TMP_6 = function(arg){var self = TMP_6.$$s || this; if (arg == null) arg = nil; return arg.$first()['$==']("optarg")}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $b).call($c)); }, TMP_7.$$arity = 0); Opal.defn(self, '$rest_arg', TMP_9 = function $$rest_arg() { var $a, $b, $c, TMP_8, self = this; return ((($a = self.rest_arg) !== false && $a !== nil && $a != null) ? $a : self.rest_arg = ($b = ($c = self.$args()['$[]']($range(1, -1, false))).$find, $b.$$p = (TMP_8 = function(arg){var self = TMP_8.$$s || this; if (arg == null) arg = nil; return arg.$first()['$==']("restarg")}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8), $b).call($c)); }, TMP_9.$$arity = 0); Opal.defn(self, '$keyword_args', TMP_11 = function $$keyword_args() { var $a, $b, $c, TMP_10, self = this; return ((($a = self.keyword_args) !== false && $a !== nil && $a != null) ? $a : self.keyword_args = ($b = ($c = self.$args()['$[]']($range(1, -1, false))).$select, $b.$$p = (TMP_10 = function(arg){var self = TMP_10.$$s || this; if (arg == null) arg = nil; return ["kwarg", "kwoptarg", "kwrestarg"]['$include?'](arg.$first())}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10), $b).call($c)); }, TMP_11.$$arity = 0); Opal.defn(self, '$inline_args_sexp', TMP_12 = function $$inline_args_sexp() { var $a, self = this; return ($a = self).$s.apply($a, ["inline_args"].concat(Opal.to_a(self.$args()['$[]']($range(1, -1, false))))); }, TMP_12.$$arity = 0); Opal.defn(self, '$post_args_sexp', TMP_13 = function $$post_args_sexp() { var $a, self = this; return ($a = self).$s.apply($a, ["post_args"].concat(Opal.to_a(self.$post_args()))); }, TMP_13.$$arity = 0); Opal.defn(self, '$compile_inline_args', TMP_15 = function $$compile_inline_args() { var $a, $b, TMP_14, self = this; return ($a = ($b = self.$inline_args()).$each, $a.$$p = (TMP_14 = function(inline_arg){var self = TMP_14.$$s || this; if (inline_arg == null) inline_arg = nil; return self.$push(self.$process(inline_arg))}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($b); }, TMP_15.$$arity = 0); Opal.defn(self, '$compile_post_args', TMP_16 = function $$compile_post_args() { var self = this; return self.$push(self.$process(self.$post_args_sexp())); }, TMP_16.$$arity = 0); Opal.defn(self, '$compile_block_arg', TMP_17 = function $$compile_block_arg() { var $a, self = this, scope_name = nil, yielder = nil; if ((($a = self.$scope()['$uses_block?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { scope_name = self.$scope().$identity(); yielder = self.$scope().$block_name(); self.$add_temp("$iter = " + (scope_name) + ".$$p"); self.$add_temp("" + (yielder) + " = $iter || nil"); return self.$line("" + (scope_name) + ".$$p = null;"); } else { return nil }; }, TMP_17.$$arity = 0); Opal.defn(self, '$with_inline_args', TMP_18 = function $$with_inline_args(args) { var $a, $b, self = this, $iter = TMP_18.$$p, $yield = $iter || nil, old_inline_args = nil; TMP_18.$$p = null; old_inline_args = self.$inline_args(); (($a = [args]), $b = self, $b['$inline_args='].apply($b, $a), $a[$a.length-1]); Opal.yieldX($yield, []); return (($a = [old_inline_args]), $b = self, $b['$inline_args='].apply($b, $a), $a[$a.length-1]); }, TMP_18.$$arity = 1); Opal.defn(self, '$in_mlhs', TMP_19 = function $$in_mlhs() { var self = this, $iter = TMP_19.$$p, $yield = $iter || nil, old_mlhs = nil; TMP_19.$$p = null; old_mlhs = self.in_mlhs; self.in_mlhs = true; Opal.yieldX($yield, []); return self.in_mlhs = old_mlhs; }, TMP_19.$$arity = 0); Opal.defn(self, '$in_mlhs?', TMP_20 = function() { var self = this; return self.in_mlhs; }, TMP_20.$$arity = 0); Opal.defn(self, '$optimize_args!', TMP_21 = function() { var $a, $b, self = this, rest_arg = nil; if ((($a = (($b = self.$post_args().$length()['$=='](1)) ? self.$post_args().$first().$type()['$==']("restarg") : self.$post_args().$length()['$=='](1))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { rest_arg = self.$post_args().$pop(); rest_arg.$meta()['$[]=']("offset", self.$inline_args().$length()); return self.$inline_args()['$<<'](rest_arg); } else { return nil }; }, TMP_21.$$arity = 0); Opal.defn(self, '$has_only_optional_kwargs?', TMP_23 = function() { var $a, $b, $c, TMP_22, self = this; return ($a = self.$keyword_args()['$any?'](), $a !== false && $a !== nil && $a != null ?($b = ($c = self.$keyword_args())['$all?'], $b.$$p = (TMP_22 = function(arg){var self = TMP_22.$$s || this; if (arg == null) arg = nil; return ["kwoptarg", "kwrestarg"]['$include?'](arg.$type())}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22), $b).call($c) : $a); }, TMP_23.$$arity = 0); Opal.defn(self, '$has_required_kwargs?', TMP_25 = function() { var $a, $b, TMP_24, self = this; return ($a = ($b = self.$keyword_args())['$any?'], $a.$$p = (TMP_24 = function(arg){var self = TMP_24.$$s || this; if (arg == null) arg = nil; return arg.$type()['$==']("kwarg")}, TMP_24.$$s = self, TMP_24.$$arity = 1, TMP_24), $a).call($b); }, TMP_25.$$arity = 0); Opal.defn(self, '$arity', TMP_26 = function $$arity() { var $a, $b, $c, self = this; if ((($a = ((($b = ((($c = self.$rest_arg()) !== false && $c !== nil && $c != null) ? $c : self.$opt_args()['$any?']())) !== false && $b !== nil && $b != null) ? $b : self['$has_only_optional_kwargs?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$negative_arity() } else { return self.$positive_arity() }; }, TMP_26.$$arity = 0); Opal.defn(self, '$negative_arity', TMP_28 = function $$negative_arity() { var $a, $b, TMP_27, self = this, required_plain_args = nil, result = nil; required_plain_args = ($a = ($b = self.$args().$children()).$select, $a.$$p = (TMP_27 = function(arg){var self = TMP_27.$$s || this; if (arg == null) arg = nil; return ["arg", "mlhs"]['$include?'](arg.$type())}, TMP_27.$$s = self, TMP_27.$$arity = 1, TMP_27), $a).call($b); result = required_plain_args.$size(); if ((($a = self['$has_required_kwargs?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = $rb_plus(result, 1)}; result = $rb_minus(result['$-@'](), 1); return result; }, TMP_28.$$arity = 0); Opal.defn(self, '$positive_arity', TMP_29 = function $$positive_arity() { var $a, self = this, result = nil; result = $rb_minus(self.$args().$size(), 1); result = $rb_minus(result, self.$keyword_args().$size()); if ((($a = self.$keyword_args()['$any?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { result = $rb_plus(result, 1)}; return result; }, TMP_29.$$arity = 0); Opal.defn(self, '$build_parameter', TMP_30 = function $$build_parameter(parameter_type, parameter_name) { var self = this; if (parameter_name !== false && parameter_name !== nil && parameter_name != null) { return "['" + (parameter_type) + "', '" + (parameter_name) + "']" } else { return "['" + (parameter_type) + "']" }; }, TMP_30.$$arity = 2); Opal.cdecl($scope, 'SEXP_TO_PARAMETERS', $hash2(["arg", "mlhs", "optarg", "restarg", "kwarg", "kwoptarg", "kwrestarg"], {"arg": "req", "mlhs": "req", "optarg": "opt", "restarg": "rest", "kwarg": "keyreq", "kwoptarg": "key", "kwrestarg": "keyrest"})); Opal.defn(self, '$parameters_code', TMP_32 = function $$parameters_code() { var $a, $b, TMP_31, self = this, stringified_parameters = nil; stringified_parameters = ($a = ($b = self.$args().$children()).$map, $a.$$p = (TMP_31 = function(arg){var self = TMP_31.$$s || this, value = nil; if (arg == null) arg = nil; value = (function() {if (arg.$type()['$==']("mlhs")) { return nil } else { return arg['$[]'](1) }; return nil; })(); return self.$build_parameter($scope.get('SEXP_TO_PARAMETERS')['$[]'](arg.$type()), value);}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31), $a).call($b); if ((($a = self.$block_arg()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { stringified_parameters['$<<']("['block', '" + (self.$block_arg()) + "']")}; return "[" + (stringified_parameters.$join(", ")) + "]"; }, TMP_32.$$arity = 0); return (Opal.defn(self, '$arity_checks', TMP_33 = function $$arity_checks() { var $a, $b, $c, self = this, arity = nil, aritycode = nil, min_arity = nil, max_arity = nil; if ((($a = self.arity_checks) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.arity_checks}; arity = $rb_minus(self.$args().$size(), 1); arity = $rb_minus(arity, (self.$opt_args().$size())); if ((($a = self.$rest_arg()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { arity = $rb_minus(arity, 1)}; arity = $rb_minus(arity, (self.$keyword_args().$size())); if ((($a = ((($b = ((($c = self.$opt_args()['$empty?']()['$!']()) !== false && $c !== nil && $c != null) ? $c : self.$keyword_args()['$empty?']()['$!']())) !== false && $b !== nil && $b != null) ? $b : self.$rest_arg())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { arity = $rb_minus(arity['$-@'](), 1)}; aritycode = "var $arity = arguments.length;"; self.arity_checks = []; if ((($a = $rb_lt(arity, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { min_arity = ($rb_plus(arity, 1))['$-@'](); max_arity = $rb_minus(self.$args().$size(), 1); if ((($a = $rb_gt(min_arity, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.arity_checks['$<<']("$arity < " + (min_arity))}; if ((($a = (($b = max_arity !== false && max_arity !== nil && max_arity != null) ? (self.$rest_arg())['$!']() : max_arity)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.arity_checks['$<<']("$arity > " + (max_arity))}; } else { self.arity_checks['$<<']("$arity !== " + (arity)) }; return self.arity_checks; }, TMP_33.$$arity = 0), nil) && 'arity_checks'; })($scope.base, $scope.get('ScopeNode')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/iter"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$require', '$handle', '$children', '$attr_accessor', '$extract_block_arg', '$extract_shadow_args', '$split_args', '$in_scope', '$process', '$inline_args_sexp', '$identify!', '$scope', '$add_temp', '$compile_block_arg', '$compile_shadow_args', '$compile_inline_args', '$compile_post_args', '$compile_norm_args', '$arity_check?', '$compiler', '$compile_arity_check', '$stmt', '$body', '$to_vars', '$line', '$unshift', '$push', '$has_break?', '$arity', '$parameters_code', '$has_top_level_mlhs_arg?', '$has_trailing_comma_in_args?', '$select', '$==', '$type', '$[]', '$args', '$each', '$variable', '$norm_args', '$block_arg', '$to_s', '$block_name=', '$is_a?', '$last', '$block_arg=', '$to_sym', '$pop', '$add_local', '$shadow_args', '$each_with_index', '$<<', '$delete', '$===', '$args_sexp', '$nil?', '$s', '$delete_at', '$returns', '$body_sexp', '$keys', '$mlhs_mapping', '$any?', '$meta', '$>', '$size', '$arity_checks', '$!', '$top?', '$def?', '$class_scope?', '$parent', '$mid', '$class?', '$name', '$module?', '$identity', '$join']); self.$require("opal/nodes/node_with_args"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $IterNode(){}; var self = $IterNode = $klass($base, $super, 'IterNode', $IterNode); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_4, TMP_6, TMP_7, TMP_8, TMP_10, TMP_12, TMP_14, TMP_15, TMP_16, TMP_18, TMP_19, TMP_20; def.norm_args = nil; self.$handle("iter"); self.$children("args_sexp", "body_sexp"); self.$attr_accessor("block_arg", "shadow_args"); Opal.defn(self, '$compile', TMP_2 = function $$compile() { var $a, $b, TMP_1, self = this, inline_params = nil, to_vars = nil, identity = nil, body_code = nil; inline_params = nil; self.$extract_block_arg(); self.$extract_shadow_args(); self.$split_args(); to_vars = identity = body_code = nil; ($a = ($b = self).$in_scope, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this, $c; inline_params = self.$process(self.$inline_args_sexp()); identity = self.$scope()['$identify!'](); self.$add_temp("self = " + (identity) + ".$$s || this"); self.$compile_block_arg(); self.$compile_shadow_args(); self.$compile_inline_args(); self.$compile_post_args(); self.$compile_norm_args(); if ((($c = self.$compiler()['$arity_check?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$compile_arity_check()}; body_code = self.$stmt(self.$body()); return to_vars = self.$scope().$to_vars();}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b); self.$line(body_code); self.$unshift(to_vars); self.$unshift("(" + (identity) + " = function(", inline_params, "){"); self.$push("}, " + (identity) + ".$$s = self,"); if ((($a = self.$compiler()['$has_break?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push(" " + (identity) + ".$$brk = $brk,")}; self.$push(" " + (identity) + ".$$arity = " + (self.$arity()) + ","); if ((($a = self.$compiler()['$arity_check?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push(" " + (identity) + ".$$parameters = " + (self.$parameters_code()) + ",")}; if ((($a = self['$has_top_level_mlhs_arg?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push(" " + (identity) + ".$$has_top_level_mlhs_arg = true,")}; if ((($a = self['$has_trailing_comma_in_args?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push(" " + (identity) + ".$$has_trailing_comma_in_args = true,")}; return self.$push(" " + (identity) + ")"); }, TMP_2.$$arity = 0); Opal.defn(self, '$norm_args', TMP_4 = function $$norm_args() { var $a, $b, $c, TMP_3, self = this; return ((($a = self.norm_args) !== false && $a !== nil && $a != null) ? $a : self.norm_args = ($b = ($c = self.$args()['$[]']($range(1, -1, false))).$select, $b.$$p = (TMP_3 = function(arg){var self = TMP_3.$$s || this; if (arg == null) arg = nil; return arg.$type()['$==']("arg")}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $b).call($c)); }, TMP_4.$$arity = 0); Opal.defn(self, '$compile_norm_args', TMP_6 = function $$compile_norm_args() { var $a, $b, TMP_5, self = this; return ($a = ($b = self.$norm_args()).$each, $a.$$p = (TMP_5 = function(arg){var self = TMP_5.$$s || this; if (arg == null) arg = nil; arg = self.$variable(arg['$[]'](1)); return self.$push("if (" + (arg) + " == null) " + (arg) + " = nil;");}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $a).call($b); }, TMP_6.$$arity = 0); Opal.defn(self, '$compile_block_arg', TMP_7 = function $$compile_block_arg() { var $a, $b, self = this, block_arg = nil, scope_name = nil; if ((($a = self.$block_arg()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { block_arg = self.$variable(self.$block_arg().$to_s()); (($a = [block_arg]), $b = self.$scope(), $b['$block_name='].apply($b, $a), $a[$a.length-1]); self.$scope().$add_temp(block_arg); scope_name = self.$scope()['$identify!'](); return self.$line("" + (block_arg) + " = " + (scope_name) + ".$$p || nil, " + (scope_name) + ".$$p = null;"); } else { return nil }; }, TMP_7.$$arity = 0); Opal.defn(self, '$extract_block_arg', TMP_8 = function $$extract_block_arg() { var $a, $b, $c, self = this; if ((($a = ($b = ($c = self.$args()['$is_a?']($scope.get('Sexp')), $c !== false && $c !== nil && $c != null ?self.$args().$last()['$is_a?']($scope.get('Sexp')) : $c), $b !== false && $b !== nil && $b != null ?self.$args().$last().$type()['$==']("block_pass") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($a = [self.$args().$pop()['$[]'](1)['$[]'](1).$to_sym()]), $b = self, $b['$block_arg='].apply($b, $a), $a[$a.length-1]) } else { return nil }; }, TMP_8.$$arity = 0); Opal.defn(self, '$compile_shadow_args', TMP_10 = function $$compile_shadow_args() { var $a, $b, TMP_9, self = this; return ($a = ($b = self.$shadow_args()).$each, $a.$$p = (TMP_9 = function(shadow_arg){var self = TMP_9.$$s || this; if (shadow_arg == null) shadow_arg = nil; return self.$scope().$add_local(shadow_arg.$last())}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9), $a).call($b); }, TMP_10.$$arity = 0); Opal.defn(self, '$extract_shadow_args', TMP_12 = function $$extract_shadow_args() { var $a, $b, TMP_11, self = this; if ((($a = self.$args()['$is_a?']($scope.get('Sexp'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.shadow_args = []; return ($a = ($b = self.$args().$children()).$each_with_index, $a.$$p = (TMP_11 = function(arg, idx){var self = TMP_11.$$s || this; if (self.shadow_args == null) self.shadow_args = nil; if (arg == null) arg = nil;if (idx == null) idx = nil; if (arg.$type()['$==']("shadowarg")) { return self.shadow_args['$<<'](self.$args().$delete(arg)) } else { return nil }}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11), $a).call($b); } else { return nil }; }, TMP_12.$$arity = 0); Opal.defn(self, '$args', TMP_14 = function $$args() { var $a, $b, $c, TMP_13, self = this, sexp = nil, caught_blank_argument = nil; sexp = (function() {if ((($a = ((($b = $scope.get('Fixnum')['$==='](self.$args_sexp())) !== false && $b !== nil && $b != null) ? $b : self.$args_sexp()['$nil?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$s("args") } else if ((($a = ($b = self.$args_sexp()['$is_a?']($scope.get('Sexp')), $b !== false && $b !== nil && $b != null ?self.$args_sexp().$type()['$==']("lasgn") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$s("args", ($a = self).$s.apply($a, ["arg"].concat(Opal.to_a(self.$args_sexp()['$[]'](1))))) } else { return self.$args_sexp()['$[]'](1) }; return nil; })(); caught_blank_argument = false; ($b = ($c = sexp).$each_with_index, $b.$$p = (TMP_13 = function(part, idx){var self = TMP_13.$$s || this, $d, $e; if (part == null) part = nil;if (idx == null) idx = nil; if ((($d = ($e = part['$is_a?']($scope.get('Sexp')), $e !== false && $e !== nil && $e != null ?part.$last()['$==']("_") : $e)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { if (caught_blank_argument !== false && caught_blank_argument !== nil && caught_blank_argument != null) { sexp.$delete_at(idx)}; return caught_blank_argument = true; } else { return nil }}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13), $b).call($c); return sexp; }, TMP_14.$$arity = 0); Opal.defn(self, '$body', TMP_15 = function $$body() { var $a, self = this; return self.$compiler().$returns(((($a = self.$body_sexp()) !== false && $a !== nil && $a != null) ? $a : self.$s("nil"))); }, TMP_15.$$arity = 0); Opal.defn(self, '$mlhs_args', TMP_16 = function $$mlhs_args() { var self = this; return self.$scope().$mlhs_mapping().$keys(); }, TMP_16.$$arity = 0); Opal.defn(self, '$has_top_level_mlhs_arg?', TMP_18 = function() { var $a, $b, TMP_17, self = this; return ($a = ($b = self.$args().$children())['$any?'], $a.$$p = (TMP_17 = function(arg){var self = TMP_17.$$s || this; if (arg == null) arg = nil; return arg.$type()['$==']("mlhs")}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17), $a).call($b); }, TMP_18.$$arity = 0); Opal.defn(self, '$has_trailing_comma_in_args?', TMP_19 = function() { var self = this; return self.$args().$meta()['$[]']("has_trailing_comma"); }, TMP_19.$$arity = 0); return (Opal.defn(self, '$compile_arity_check', TMP_20 = function $$compile_arity_check() { var $a, $b, $c, $d, self = this, parent_scope = nil, context = nil, identity = nil; if ((($a = $rb_gt(self.$arity_checks().$size(), 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { parent_scope = self.$scope(); while ((($b = (((($c = ((($d = parent_scope['$top?']()) !== false && $d !== nil && $d != null) ? $d : parent_scope['$def?']())) !== false && $c !== nil && $c != null) ? $c : parent_scope['$class_scope?']()))['$!']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { parent_scope = parent_scope.$parent()}; context = (function() {if ((($a = parent_scope['$top?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "'
'" } else if ((($a = parent_scope['$def?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "'" + (parent_scope.$mid()) + "'" } else if ((($a = parent_scope['$class?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "''" } else if ((($a = parent_scope['$module?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "''" } else { return nil }; return nil; })(); identity = self.$scope().$identity(); self.$line("if (" + (identity) + ".$$is_lambda || " + (identity) + ".$$define_meth) {"); self.$line(" var $arity = arguments.length;"); self.$line(" if (" + (self.$arity_checks().$join(" || ")) + ") { Opal.block_ac($arity, " + (self.$arity()) + ", " + (context) + "); }"); return self.$line("}"); } else { return nil }; }, TMP_20.$$arity = 0), nil) && 'compile_arity_check'; })($scope.base, $scope.get('NodeWithArgs')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/def"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$children', '$attr_accessor', '$is_a?', '$last', '$args', '$==', '$type', '$[]', '$pop', '$extract_block_arg', '$split_args', '$block_arg', '$to_sym', '$variable', '$in_scope', '$mid=', '$mid', '$scope', '$recvr', '$defs=', '$uses_block!', '$add_arg', '$block_name=', '$process', '$inline_args_sexp', '$stmt', '$returns', '$compiler', '$stmts', '$add_temp', '$compile_inline_args', '$compile_post_args', '$identify!', '$identity', '$compile_block_arg', '$arity_check?', '$compile_arity_check', '$uses_zuper', '$add_local', '$line', '$unshift', '$current_indent', '$to_vars', '$catch_return', '$push', '$valid_name?', '$arity', '$parameters_code', '$recv', '$iter?', '$module?', '$class?', '$sclass?', '$defs', '$eval?', '$top?', '$def?', '$raise', '$expr?', '$wrap', '$>', '$size', '$arity_checks', '$inspect', '$to_s', '$join']); self.$require("opal/nodes/node_with_args"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $DefNode(){}; var self = $DefNode = $klass($base, $super, 'DefNode', $DefNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_3, TMP_4; self.$handle("def"); self.$children("recvr", "mid", "args", "stmts"); self.$attr_accessor("block_arg"); Opal.defn(self, '$extract_block_arg', TMP_1 = function $$extract_block_arg() { var $a, $b, self = this; if ((($a = ($b = self.$args().$last()['$is_a?']($scope.get('Sexp')), $b !== false && $b !== nil && $b != null ?self.$args().$last().$type()['$==']("blockarg") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.block_arg = self.$args().$pop()['$[]'](1) } else { return nil }; }, TMP_1.$$arity = 0); Opal.defn(self, '$compile', TMP_3 = function $$compile() { var $a, $b, TMP_2, $c, self = this, inline_params = nil, scope_name = nil, block_name = nil, function_name = nil; self.$extract_block_arg(); self.$split_args(); inline_params = nil; scope_name = nil; if ((($a = self.$block_arg()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { block_name = self.$variable(self.$block_arg()).$to_sym()}; ($a = ($b = self).$in_scope, $a.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this, $c, $d, $e, stmt_code = nil; (($c = [self.$mid()]), $d = self.$scope(), $d['$mid='].apply($d, $c), $c[$c.length-1]); if ((($c = self.$recvr()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { (($c = [true]), $d = self.$scope(), $d['$defs='].apply($d, $c), $c[$c.length-1])}; if (block_name !== false && block_name !== nil && block_name != null) { self.$scope()['$uses_block!'](); self.$scope().$add_arg(block_name);}; (($c = [((($e = block_name) !== false && $e !== nil && $e != null) ? $e : "$yield")]), $d = self.$scope(), $d['$block_name='].apply($d, $c), $c[$c.length-1]); inline_params = self.$process(self.$inline_args_sexp()); stmt_code = self.$stmt(self.$compiler().$returns(self.$stmts())); self.$add_temp("self = this"); self.$compile_inline_args(); self.$compile_post_args(); self.$scope()['$identify!'](); scope_name = self.$scope().$identity(); self.$compile_block_arg(); if ((($c = self.$compiler()['$arity_check?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$compile_arity_check()}; if ((($c = self.$scope().$uses_zuper()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$add_local("$zuper"); self.$add_local("$zuper_index"); self.$add_local("$zuper_length"); self.$line("$zuper = [];"); self.$line(); self.$line("for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) {"); self.$line(" $zuper[$zuper_index] = arguments[$zuper_index];"); self.$line("}");}; self.$unshift("\n" + (self.$current_indent()), self.$scope().$to_vars()); self.$line(stmt_code); if ((($c = self.$scope().$catch_return()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$unshift("try {\n"); self.$line("} catch ($returner) { if ($returner === Opal.returner) { return $returner.$v }"); return self.$push(" throw $returner; }"); } else { return nil };}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $a).call($b); function_name = (function() {if ((($a = self['$valid_name?'](self.$mid())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return " $$" + (self.$mid()) } else { return "" }; return nil; })(); self.$unshift(") {"); self.$unshift(inline_params); self.$unshift("function" + (function_name) + "("); if (scope_name !== false && scope_name !== nil && scope_name != null) { self.$unshift("" + (scope_name) + " = ")}; self.$line("}"); self.$push(", " + (scope_name) + ".$$arity = " + (self.$arity())); if ((($a = self.$compiler()['$arity_check?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push(", " + (scope_name) + ".$$parameters = " + (self.$parameters_code()))}; if ((($a = self.$recvr()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$unshift("Opal.defs(", self.$recv(self.$recvr()), ", '$" + (self.$mid()) + "', ") } else if ((($a = self.$scope()['$iter?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$unshift("Opal.def(self, '$" + (self.$mid()) + "', ") } else if ((($a = ((($c = self.$scope()['$module?']()) !== false && $c !== nil && $c != null) ? $c : self.$scope()['$class?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$unshift("Opal.defn(self, '$" + (self.$mid()) + "', ") } else if ((($a = ($c = self.$scope()['$sclass?'](), $c !== false && $c !== nil && $c != null ?self.$scope().$defs() : $c)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$unshift("Opal.defs(self, '$" + (self.$mid()) + "', ") } else if ((($a = self.$scope()['$sclass?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$unshift("Opal.defn(self, '$" + (self.$mid()) + "', ") } else if ((($a = self.$compiler()['$eval?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$unshift("Opal.def(self, '$" + (self.$mid()) + "', ") } else if ((($a = self.$scope()['$top?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$unshift("Opal.defn(Opal.Object, '$" + (self.$mid()) + "', ") } else if ((($a = self.$scope()['$def?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$unshift("Opal.def(self, '$" + (self.$mid()) + "', ") } else { self.$raise("Unsupported use of `def`; please file a bug at https://github.com/opal/opal/issues/new reporting this message.") }; self.$push(")"); if ((($a = self['$expr?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$wrap("(", ", nil) && '" + (self.$mid()) + "'") } else { return nil }; }, TMP_3.$$arity = 0); return (Opal.defn(self, '$compile_arity_check', TMP_4 = function $$compile_arity_check() { var $a, self = this, meth = nil; if ((($a = $rb_gt(self.$arity_checks().$size(), 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { meth = self.$scope().$mid().$to_s().$inspect(); self.$line("var $arity = arguments.length;"); return self.$push(" if (" + (self.$arity_checks().$join(" || ")) + ") { Opal.ac($arity, " + (self.$arity()) + ", this, " + (meth) + "); }"); } else { return nil }; }, TMP_4.$$arity = 0), nil) && 'compile_arity_check'; })($scope.base, $scope.get('NodeWithArgs')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/if"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$children', '$truthy', '$falsy', '$skip_check_present?', '$skip_check_present_not?', '$push', '$js_truthy', '$test', '$indent', '$line', '$stmt', '$==', '$type', '$needs_wrapper?', '$wrap', '$returns', '$compiler', '$true_body', '$s', '$false_body', '$expr?', '$recv?']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $IfNode(){}; var self = $IfNode = $klass($base, $super, 'IfNode', $IfNode); var def = self.$$proto, $scope = self.$$scope, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8; self.$handle("if"); self.$children("test", "true_body", "false_body"); Opal.cdecl($scope, 'RUBY_ENGINE_CHECK', ["call", ["const", "RUBY_ENGINE"], "==", ["arglist", ["str", "opal"]]]); Opal.cdecl($scope, 'RUBY_ENGINE_CHECK_NOT', ["call", ["const", "RUBY_ENGINE"], "!=", ["arglist", ["str", "opal"]]]); Opal.cdecl($scope, 'RUBY_PLATFORM_CHECK', ["call", ["const", "RUBY_PLATFORM"], "==", ["arglist", ["str", "opal"]]]); Opal.cdecl($scope, 'RUBY_PLATFORM_CHECK_NOT', ["call", ["const", "RUBY_PLATFORM"], "!=", ["arglist", ["str", "opal"]]]); Opal.defn(self, '$compile', TMP_3 = function $$compile() { var $a, $b, TMP_1, $c, TMP_2, self = this, truthy = nil, falsy = nil; $a = [self.$truthy(), self.$falsy()], truthy = $a[0], falsy = $a[1], $a; if ((($a = self['$skip_check_present?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { falsy = nil}; if ((($a = self['$skip_check_present_not?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { truthy = nil}; self.$push("if (", self.$js_truthy(self.$test()), ") {"); if (truthy !== false && truthy !== nil && truthy != null) { ($a = ($b = self).$indent, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this; return self.$line(self.$stmt(truthy))}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b)}; if (falsy !== false && falsy !== nil && falsy != null) { if (falsy.$type()['$==']("if")) { self.$line("} else ", self.$stmt(falsy)) } else { ($a = ($c = self).$indent, $a.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this; self.$line("} else {"); return self.$line(self.$stmt(falsy));}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $a).call($c); self.$line("}"); } } else { self.$push("}") }; if ((($a = self['$needs_wrapper?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$wrap("(function() {", "; return nil; })()") } else { return nil }; }, TMP_3.$$arity = 0); Opal.defn(self, '$skip_check_present?', TMP_4 = function() { var $a, self = this; return ((($a = self.$test()['$==']($scope.get('RUBY_ENGINE_CHECK'))) !== false && $a !== nil && $a != null) ? $a : self.$test()['$==']($scope.get('RUBY_PLATFORM_CHECK'))); }, TMP_4.$$arity = 0); Opal.defn(self, '$skip_check_present_not?', TMP_5 = function() { var $a, self = this; return ((($a = self.$test()['$==']($scope.get('RUBY_ENGINE_CHECK_NOT'))) !== false && $a !== nil && $a != null) ? $a : self.$test()['$==']($scope.get('RUBY_PLATFORM_CHECK_NOT'))); }, TMP_5.$$arity = 0); Opal.defn(self, '$truthy', TMP_6 = function $$truthy() { var $a, self = this; if ((($a = self['$needs_wrapper?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$compiler().$returns(((($a = self.$true_body()) !== false && $a !== nil && $a != null) ? $a : self.$s("nil"))) } else { return self.$true_body() }; }, TMP_6.$$arity = 0); Opal.defn(self, '$falsy', TMP_7 = function $$falsy() { var $a, self = this; if ((($a = self['$needs_wrapper?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$compiler().$returns(((($a = self.$false_body()) !== false && $a !== nil && $a != null) ? $a : self.$s("nil"))) } else { return self.$false_body() }; }, TMP_7.$$arity = 0); return (Opal.defn(self, '$needs_wrapper?', TMP_8 = function() { var $a, self = this; return ((($a = self['$expr?']()) !== false && $a !== nil && $a != null) ? $a : self['$recv?']()); }, TMP_8.$$arity = 0), nil) && 'needs_wrapper?'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/logic"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$children', '$in_while?', '$push', '$expr_or_nil', '$value', '$wrap', '$compile_while', '$iter?', '$scope', '$compile_iter', '$error', '$[]', '$while_loop', '$stmt?', '$has_break!', '$compiler', '$line', '$break_val', '$nil?', '$expr', '$s', '$>', '$size', '$[]=', '$identity', '$with_temp', '$==', '$empty_splat?', '$type', '$recv', '$rhs', '$compile_if', '$compile_ternary', '$raise', '$lhs', '$indent', '$js_truthy_optimize', '$find_parent_def', '$expr?', '$def?', '$return_in_iter?', '$return_expr_in_def?', '$scope_to_catch_return', '$catch_return=', '$return_val', '$to_s']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $NextNode(){}; var self = $NextNode = $klass($base, $super, 'NextNode', $NextNode); var def = self.$$proto, $scope = self.$$scope, TMP_1; self.$handle("next"); self.$children("value"); return (Opal.defn(self, '$compile', TMP_1 = function $$compile() { var $a, self = this; if ((($a = self['$in_while?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$push("continue;")}; self.$push(self.$expr_or_nil(self.$value())); return self.$wrap("return ", ";"); }, TMP_1.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $BreakNode(){}; var self = $BreakNode = $klass($base, $super, 'BreakNode', $BreakNode); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_3, TMP_4, TMP_5; self.$handle("break"); self.$children("value"); Opal.defn(self, '$compile', TMP_2 = function $$compile() { var $a, self = this; if ((($a = self['$in_while?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$compile_while() } else if ((($a = self.$scope()['$iter?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$compile_iter() } else { return self.$error("void value expression: cannot use break outside of iter/while") }; }, TMP_2.$$arity = 0); Opal.defn(self, '$compile_while', TMP_3 = function $$compile_while() { var $a, self = this; if ((($a = self.$while_loop()['$[]']("closure")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$push("return ", self.$expr_or_nil(self.$value())) } else { return self.$push("break;") }; }, TMP_3.$$arity = 0); Opal.defn(self, '$compile_iter', TMP_4 = function $$compile_iter() { var $a, self = this; if ((($a = self['$stmt?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$error("break must be used as a statement") }; self.$compiler()['$has_break!'](); return self.$line("Opal.brk(", self.$break_val(), ", $brk)"); }, TMP_4.$$arity = 0); return (Opal.defn(self, '$break_val', TMP_5 = function $$break_val() { var $a, self = this; if ((($a = self.$value()['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$expr(self.$s("nil")) } else if ((($a = $rb_gt(self.$children().$size(), 1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$expr(($a = self).$s.apply($a, ["array"].concat(Opal.to_a(self.$children())))) } else { return self.$expr(self.$value()) }; }, TMP_5.$$arity = 0), nil) && 'break_val'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $RedoNode(){}; var self = $RedoNode = $klass($base, $super, 'RedoNode', $RedoNode); var def = self.$$proto, $scope = self.$$scope, TMP_6, TMP_7, TMP_8; self.$handle("redo"); Opal.defn(self, '$compile', TMP_6 = function $$compile() { var $a, self = this; if ((($a = self['$in_while?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$compile_while() } else if ((($a = self.$scope()['$iter?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$compile_iter() } else { return self.$push("REDO()") }; }, TMP_6.$$arity = 0); Opal.defn(self, '$compile_while', TMP_7 = function $$compile_while() { var self = this; self.$while_loop()['$[]=']("use_redo", true); return self.$push("" + (self.$while_loop()['$[]']("redo_var")) + " = true"); }, TMP_7.$$arity = 0); return (Opal.defn(self, '$compile_iter', TMP_8 = function $$compile_iter() { var self = this; return self.$push("return " + (self.$scope().$identity()) + ".apply(null, $slice.call(arguments))"); }, TMP_8.$$arity = 0), nil) && 'compile_iter'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $NotNode(){}; var self = $NotNode = $klass($base, $super, 'NotNode', $NotNode); var def = self.$$proto, $scope = self.$$scope, TMP_10; self.$handle("not"); self.$children("value"); return (Opal.defn(self, '$compile', TMP_10 = function $$compile() { var $a, $b, TMP_9, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_9 = function(tmp){var self = TMP_9.$$s || this; if (tmp == null) tmp = nil; self.$push(self.$expr(self.$value())); return self.$wrap("(" + (tmp) + " = ", ", (" + (tmp) + " === nil || " + (tmp) + " === false || " + (tmp) + " == null))");}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9), $a).call($b); }, TMP_10.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $SplatNode(){}; var self = $SplatNode = $klass($base, $super, 'SplatNode', $SplatNode); var def = self.$$proto, $scope = self.$$scope, TMP_11, TMP_12; self.$handle("splat"); self.$children("value"); Opal.defn(self, '$empty_splat?', TMP_11 = function() { var $a, self = this; return ((($a = self.$value()['$=='](["nil"])) !== false && $a !== nil && $a != null) ? $a : self.$value()['$=='](["paren", ["nil"]])); }, TMP_11.$$arity = 0); return (Opal.defn(self, '$compile', TMP_12 = function $$compile() { var $a, self = this; if ((($a = self['$empty_splat?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$push("[]") } else if (self.$value().$type()['$==']("sym")) { return self.$push("[", self.$expr(self.$value()), "]") } else { return self.$push("Opal.to_a(", self.$recv(self.$value()), ")") }; }, TMP_12.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $BinaryOp(){}; var self = $BinaryOp = $klass($base, $super, 'BinaryOp', $BinaryOp); var def = self.$$proto, $scope = self.$$scope, TMP_13, TMP_14, TMP_15; Opal.defn(self, '$compile', TMP_13 = function $$compile() { var self = this; if (self.$rhs().$type()['$==']("break")) { return self.$compile_if() } else { return self.$compile_ternary() }; }, TMP_13.$$arity = 0); Opal.defn(self, '$compile_ternary', TMP_14 = function $$compile_ternary() { var self = this; return self.$raise($scope.get('NotImplementedError')); }, TMP_14.$$arity = 0); return (Opal.defn(self, '$compile_if', TMP_15 = function $$compile_if() { var self = this; return self.$raise($scope.get('NotImplementedError')); }, TMP_15.$$arity = 0), nil) && 'compile_if'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $OrNode(){}; var self = $OrNode = $klass($base, $super, 'OrNode', $OrNode); var def = self.$$proto, $scope = self.$$scope, TMP_17, TMP_21; self.$handle("or"); self.$children("lhs", "rhs"); Opal.defn(self, '$compile_ternary', TMP_17 = function $$compile_ternary() { var $a, $b, TMP_16, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_16 = function(tmp){var self = TMP_16.$$s || this; if (tmp == null) tmp = nil; self.$push("(((" + (tmp) + " = "); self.$push(self.$expr(self.$lhs())); self.$push(") !== false && " + (tmp) + " !== nil && " + (tmp) + " != null) ? " + (tmp) + " : "); self.$push(self.$expr(self.$rhs())); return self.$push(")");}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16), $a).call($b); }, TMP_17.$$arity = 0); return (Opal.defn(self, '$compile_if', TMP_21 = function $$compile_if() { var $a, $b, TMP_18, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_18 = function(tmp){var self = TMP_18.$$s || this, $c, $d, TMP_19, $e, TMP_20; if (tmp == null) tmp = nil; self.$push("if (" + (tmp) + " = ", self.$expr(self.$lhs()), ", " + (tmp) + " !== false && " + (tmp) + " !== nil && " + (tmp) + " != null) {"); ($c = ($d = self).$indent, $c.$$p = (TMP_19 = function(){var self = TMP_19.$$s || this; return self.$line(tmp)}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19), $c).call($d); self.$line("} else {"); ($c = ($e = self).$indent, $c.$$p = (TMP_20 = function(){var self = TMP_20.$$s || this; return self.$line(self.$expr(self.$rhs()))}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20), $c).call($e); return self.$line("}");}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18), $a).call($b); }, TMP_21.$$arity = 0), nil) && 'compile_if'; })($scope.base, $scope.get('BinaryOp')); (function($base, $super) { function $AndNode(){}; var self = $AndNode = $klass($base, $super, 'AndNode', $AndNode); var def = self.$$proto, $scope = self.$$scope, TMP_23, TMP_27; self.$handle("and"); self.$children("lhs", "rhs"); Opal.defn(self, '$compile_ternary', TMP_23 = function $$compile_ternary() { var $a, $b, TMP_22, self = this, truthy_opt = nil; truthy_opt = nil; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_22 = function(tmp){var self = TMP_22.$$s || this, $c; if (tmp == null) tmp = nil; if ((($c = truthy_opt = self.$js_truthy_optimize(self.$lhs())) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$push("((" + (tmp) + " = ", truthy_opt); self.$push(") ? "); self.$push(self.$expr(self.$rhs())); return self.$push(" : ", self.$expr(self.$lhs()), ")"); } else { self.$push("(" + (tmp) + " = "); self.$push(self.$expr(self.$lhs())); self.$push(", " + (tmp) + " !== false && " + (tmp) + " !== nil && " + (tmp) + " != null ?"); self.$push(self.$expr(self.$rhs())); return self.$push(" : " + (tmp) + ")"); }}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22), $a).call($b); }, TMP_23.$$arity = 0); return (Opal.defn(self, '$compile_if', TMP_27 = function $$compile_if() { var $a, $b, TMP_24, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_24 = function(tmp){var self = TMP_24.$$s || this, $c, $d, TMP_25, $e, TMP_26, truthy_opt = nil; if (tmp == null) tmp = nil; if ((($c = truthy_opt = self.$js_truthy_optimize(self.$lhs())) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$push("if (" + (tmp) + " = ", truthy_opt, ") {") } else { self.$push("if (" + (tmp) + " = ", self.$expr(self.$lhs()), ", " + (tmp) + " !== false && " + (tmp) + " !== nil && " + (tmp) + " != null) {") }; ($c = ($d = self).$indent, $c.$$p = (TMP_25 = function(){var self = TMP_25.$$s || this; return self.$line(self.$expr(self.$rhs()))}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25), $c).call($d); self.$line("} else {"); ($c = ($e = self).$indent, $c.$$p = (TMP_26 = function(){var self = TMP_26.$$s || this; return self.$line(self.$expr(self.$lhs()))}, TMP_26.$$s = self, TMP_26.$$arity = 0, TMP_26), $c).call($e); return self.$line("}");}, TMP_24.$$s = self, TMP_24.$$arity = 1, TMP_24), $a).call($b); }, TMP_27.$$arity = 0), nil) && 'compile_if'; })($scope.base, $scope.get('BinaryOp')); (function($base, $super) { function $ReturnNode(){}; var self = $ReturnNode = $klass($base, $super, 'ReturnNode', $ReturnNode); var def = self.$$proto, $scope = self.$$scope, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32; self.$handle("return"); self.$children("value"); Opal.defn(self, '$return_val', TMP_28 = function $$return_val() { var $a, self = this; if ((($a = self.$value()['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$expr(self.$s("nil")) } else if ((($a = $rb_gt(self.$children().$size(), 1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$expr(($a = self).$s.apply($a, ["array"].concat(Opal.to_a(self.$children())))) } else { return self.$expr(self.$value()) }; }, TMP_28.$$arity = 0); Opal.defn(self, '$return_in_iter?', TMP_29 = function() { var $a, $b, self = this, parent_def = nil; if ((($a = ($b = self.$scope()['$iter?'](), $b !== false && $b !== nil && $b != null ?parent_def = self.$scope().$find_parent_def() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return parent_def } else { return nil }; }, TMP_29.$$arity = 0); Opal.defn(self, '$return_expr_in_def?', TMP_30 = function() { var $a, $b, self = this; if ((($a = ($b = self['$expr?'](), $b !== false && $b !== nil && $b != null ?self.$scope()['$def?']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$scope() } else { return nil }; }, TMP_30.$$arity = 0); Opal.defn(self, '$scope_to_catch_return', TMP_31 = function $$scope_to_catch_return() { var $a, self = this; return ((($a = self['$return_in_iter?']()) !== false && $a !== nil && $a != null) ? $a : self['$return_expr_in_def?']()); }, TMP_31.$$arity = 0); return (Opal.defn(self, '$compile', TMP_32 = function $$compile() { var $a, $b, self = this, def_scope = nil; if ((($a = def_scope = self.$scope_to_catch_return()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = [true]), $b = def_scope, $b['$catch_return='].apply($b, $a), $a[$a.length-1]); return self.$push("Opal.ret(", self.$return_val(), ")"); } else if ((($a = self['$stmt?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$push("return ", self.$return_val()) } else { return self.$raise($scope.get('SyntaxError'), "void value expression: cannot return as an expression") }; }, TMP_32.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $JSReturnNode(){}; var self = $JSReturnNode = $klass($base, $super, 'JSReturnNode', $JSReturnNode); var def = self.$$proto, $scope = self.$$scope, TMP_33; self.$handle("js_return"); self.$children("value"); return (Opal.defn(self, '$compile', TMP_33 = function $$compile() { var self = this; self.$push("return "); return self.$push(self.$expr(self.$value())); }, TMP_33.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $JSTempNode(){}; var self = $JSTempNode = $klass($base, $super, 'JSTempNode', $JSTempNode); var def = self.$$proto, $scope = self.$$scope, TMP_34; self.$handle("js_tmp"); self.$children("value"); return (Opal.defn(self, '$compile', TMP_34 = function $$compile() { var self = this; return self.$push(self.$value().$to_s()); }, TMP_34.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $BlockPassNode(){}; var self = $BlockPassNode = $klass($base, $super, 'BlockPassNode', $BlockPassNode); var def = self.$$proto, $scope = self.$$scope, TMP_35; self.$handle("block_pass"); self.$children("value"); return (Opal.defn(self, '$compile', TMP_35 = function $$compile() { var self = this; return self.$push(self.$expr(self.$s("call", self.$value(), "to_proc", self.$s("arglist")))); }, TMP_35.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/definitions"] = function(Opal) { function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$require', '$handle', '$children', '$push', '$process', '$value', '$each', '$[]', '$==', '$<<', '$expr', '$s', '$to_s', '$>', '$length', '$!=', '$first', '$line', '$mid_to_jsid', '$new_name', '$old_name', '$class?', '$scope', '$module?', '$methods', '$!', '$stmt?', '$type', '$body', '$stmt', '$returns', '$compiler', '$wrap', '$each_with_index', '$empty?', '$stmt_join', '$find_inline_yield', '$child_is_expr?', '$class_scope?', '$current_indent', '$raw_expression?', '$include?', '$===', '$[]=', '$+', '$has_temp?', '$add_temp']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $SvalueNode(){}; var self = $SvalueNode = $klass($base, $super, 'SvalueNode', $SvalueNode); var def = self.$$proto, $scope = self.$$scope, TMP_1; def.level = nil; self.$handle("svalue"); self.$children("value"); return (Opal.defn(self, '$compile', TMP_1 = function $$compile() { var self = this; return self.$push(self.$process(self.$value(), self.level)); }, TMP_1.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $UndefNode(){}; var self = $UndefNode = $klass($base, $super, 'UndefNode', $UndefNode); var def = self.$$proto, $scope = self.$$scope, TMP_3; self.$handle("undef"); return (Opal.defn(self, '$compile', TMP_3 = function $$compile() { var $a, $b, TMP_2, self = this; return ($a = ($b = self.$children()).$each, $a.$$p = (TMP_2 = function(child){var self = TMP_2.$$s || this, $c, $d, value = nil, statements = nil; if (child == null) child = nil; value = child['$[]'](1); statements = []; if (child['$[]'](0)['$==']("js_return")) { value = value['$[]'](1); statements['$<<'](self.$expr(self.$s("js_return")));}; statements['$<<']("Opal.udef(self, '$" + (value.$to_s()) + "');"); if ((($c = ($d = $rb_gt(self.$children().$length(), 1), $d !== false && $d !== nil && $d != null ?child['$!='](self.$children().$first()) : $d)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return ($c = self).$line.apply($c, Opal.to_a(statements)) } else { return ($d = self).$push.apply($d, Opal.to_a(statements)) };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($b); }, TMP_3.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $AliasNode(){}; var self = $AliasNode = $klass($base, $super, 'AliasNode', $AliasNode); var def = self.$$proto, $scope = self.$$scope, TMP_4, TMP_5, TMP_6; self.$handle("alias"); self.$children("new_name", "old_name"); Opal.defn(self, '$new_mid', TMP_4 = function $$new_mid() { var self = this; return self.$mid_to_jsid(self.$new_name()['$[]'](1).$to_s()); }, TMP_4.$$arity = 0); Opal.defn(self, '$old_mid', TMP_5 = function $$old_mid() { var self = this; return self.$mid_to_jsid(self.$old_name()['$[]'](1).$to_s()); }, TMP_5.$$arity = 0); return (Opal.defn(self, '$compile', TMP_6 = function $$compile() { var $a, $b, self = this; if ((($a = ((($b = self.$scope()['$class?']()) !== false && $b !== nil && $b != null) ? $b : self.$scope()['$module?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$scope().$methods()['$<<']("$" + (self.$new_name()['$[]'](1)))}; return self.$push("Opal.alias(self, '" + (self.$new_name()['$[]'](1)) + "', '" + (self.$old_name()['$[]'](1)) + "')"); }, TMP_6.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $BeginNode(){}; var self = $BeginNode = $klass($base, $super, 'BeginNode', $BeginNode); var def = self.$$proto, $scope = self.$$scope, TMP_7; def.level = nil; self.$handle("begin"); self.$children("body"); return (Opal.defn(self, '$compile', TMP_7 = function $$compile() { var $a, $b, self = this; if ((($a = ($b = self['$stmt?']()['$!'](), $b !== false && $b !== nil && $b != null ?self.$body().$type()['$==']("block") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push(self.$stmt(self.$compiler().$returns(self.$body()))); return self.$wrap("(function() {", "})()"); } else { return self.$push(self.$process(self.$body(), self.level)) }; }, TMP_7.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $ParenNode(){}; var self = $ParenNode = $klass($base, $super, 'ParenNode', $ParenNode); var def = self.$$proto, $scope = self.$$scope, TMP_9; def.level = nil; self.$handle("paren"); self.$children("body"); return (Opal.defn(self, '$compile', TMP_9 = function $$compile() { var $a, $b, TMP_8, self = this; if (self.$body().$type()['$==']("block")) { ($a = ($b = self.$body().$children()).$each_with_index, $a.$$p = (TMP_8 = function(child, idx){var self = TMP_8.$$s || this; if (child == null) child = nil;if (idx == null) idx = nil; if (idx['$=='](0)) { } else { self.$push(", ") }; return self.$push(self.$expr(child));}, TMP_8.$$s = self, TMP_8.$$arity = 2, TMP_8), $a).call($b); return self.$wrap("(", ")"); } else { self.$push(self.$process(self.$body(), self.level)); if ((($a = self['$stmt?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return self.$wrap("(", ")") }; }; }, TMP_9.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $BlockNode(){}; var self = $BlockNode = $klass($base, $super, 'BlockNode', $BlockNode); var def = self.$$proto, $scope = self.$$scope, TMP_11, TMP_12, TMP_13, TMP_14, TMP_17; def.level = nil; self.$handle("block"); Opal.defn(self, '$compile', TMP_11 = function $$compile() { var $a, $b, TMP_10, self = this; if ((($a = self.$children()['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$push("nil")}; return ($a = ($b = self.$children()).$each_with_index, $a.$$p = (TMP_10 = function(child, idx){var self = TMP_10.$$s || this, $c, yasgn = nil; if (self.level == null) self.level = nil; if (child == null) child = nil;if (idx == null) idx = nil; if (idx['$=='](0)) { } else { self.$push(self.$stmt_join()) }; if ((($c = yasgn = self.$find_inline_yield(child)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$push(self.$compiler().$process(yasgn, self.level)); self.$push(";");}; self.$push(self.$compiler().$process(child, self.level)); if ((($c = self['$child_is_expr?'](child)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.$push(";") } else { return nil };}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10), $a).call($b); }, TMP_11.$$arity = 0); Opal.defn(self, '$stmt_join', TMP_12 = function $$stmt_join() { var $a, self = this; if ((($a = self.$scope()['$class_scope?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "\n\n" + (self.$current_indent()) } else { return "\n" + (self.$current_indent()) }; }, TMP_12.$$arity = 0); Opal.defn(self, '$child_is_expr?', TMP_13 = function(child) { var $a, self = this; return ($a = self['$raw_expression?'](child), $a !== false && $a !== nil && $a != null ?["stmt", "stmt_closure"]['$include?'](self.level) : $a); }, TMP_13.$$arity = 1); Opal.defn(self, '$raw_expression?', TMP_14 = function(child) { var self = this; return ["xstr", "dxstr"]['$include?'](child.$type())['$!'](); }, TMP_14.$$arity = 1); return (Opal.defn(self, '$find_inline_yield', TMP_17 = function $$find_inline_yield(stmt) { var $a, $b, TMP_15, $c, TMP_16, self = this, found = nil, $case = nil, arglist = nil; found = nil; $case = stmt.$first();if ("js_return"['$===']($case)) {if ((($a = found = self.$find_inline_yield(stmt['$[]'](1))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { found = found['$[]'](2)}}else if ("array"['$===']($case)) {($a = ($b = stmt['$[]']($range(1, -1, false))).$each_with_index, $a.$$p = (TMP_15 = function(el, idx){var self = TMP_15.$$s || this; if (el == null) el = nil;if (idx == null) idx = nil; if (el.$first()['$==']("yield")) { found = el; return stmt['$[]=']($rb_plus(idx, 1), self.$s("js_tmp", "$yielded")); } else { return nil }}, TMP_15.$$s = self, TMP_15.$$arity = 2, TMP_15), $a).call($b)}else if ("call"['$===']($case)) {arglist = stmt['$[]'](3); ($a = ($c = arglist['$[]']($range(1, -1, false))).$each_with_index, $a.$$p = (TMP_16 = function(el, idx){var self = TMP_16.$$s || this; if (el == null) el = nil;if (idx == null) idx = nil; if (el.$first()['$==']("yield")) { found = el; return arglist['$[]=']($rb_plus(idx, 1), self.$s("js_tmp", "$yielded")); } else { return nil }}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16), $a).call($c);}; if (found !== false && found !== nil && found != null) { if ((($a = self.$scope()['$has_temp?']("$yielded")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { self.$scope().$add_temp("$yielded") }; return self.$s("yasgn", "$yielded", found); } else { return nil }; }, TMP_17.$$arity = 1), nil) && 'find_inline_yield'; })($scope.base, $scope.get('Base')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/yield"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$require', '$find_yielding_scope', '$uses_block!', '$block_name', '$yields_single_arg?', '$push', '$expr', '$first', '$wrap', '$s', '$uses_splat?', '$scope', '$def?', '$parent', '$!', '$==', '$size', '$any?', '$type', '$handle', '$compile_call', '$children', '$[]', '$yield_args', '$var_name']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $BaseYieldNode(){}; var self = $BaseYieldNode = $klass($base, $super, 'BaseYieldNode', $BaseYieldNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_5; Opal.defn(self, '$compile_call', TMP_1 = function $$compile_call(children, level) { var $a, $b, self = this, yielding_scope = nil, block_name = nil; yielding_scope = self.$find_yielding_scope(); yielding_scope['$uses_block!'](); block_name = ((($a = yielding_scope.$block_name()) !== false && $a !== nil && $a != null) ? $a : "$yield"); if ((($a = self['$yields_single_arg?'](children)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push(self.$expr(children.$first())); return self.$wrap("Opal.yield1(" + (block_name) + ", ", ")"); } else { self.$push(self.$expr(($a = self).$s.apply($a, ["arglist"].concat(Opal.to_a(children))))); if ((($b = self['$uses_splat?'](children)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$wrap("Opal.yieldX(" + (block_name) + ", ", ")") } else { return self.$wrap("Opal.yieldX(" + (block_name) + ", [", "])") }; }; }, TMP_1.$$arity = 2); Opal.defn(self, '$find_yielding_scope', TMP_2 = function $$find_yielding_scope() { var $a, $b, $c, self = this, working = nil; working = self.$scope(); while (working !== false && working !== nil && working != null) { if ((($b = ((($c = working.$block_name()) !== false && $c !== nil && $c != null) ? $c : working['$def?']())) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { break;}; working = working.$parent();}; return working; }, TMP_2.$$arity = 0); Opal.defn(self, '$yields_single_arg?', TMP_3 = function(children) { var $a, self = this; return ($a = self['$uses_splat?'](children)['$!'](), $a !== false && $a !== nil && $a != null ?children.$size()['$=='](1) : $a); }, TMP_3.$$arity = 1); return (Opal.defn(self, '$uses_splat?', TMP_5 = function(children) { var $a, $b, TMP_4, self = this; return ($a = ($b = children)['$any?'], $a.$$p = (TMP_4 = function(child){var self = TMP_4.$$s || this; if (child == null) child = nil; return child.$type()['$==']("splat")}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $a).call($b); }, TMP_5.$$arity = 1), nil) && 'uses_splat?'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $YieldNode(){}; var self = $YieldNode = $klass($base, $super, 'YieldNode', $YieldNode); var def = self.$$proto, $scope = self.$$scope, TMP_6; def.level = nil; self.$handle("yield"); return (Opal.defn(self, '$compile', TMP_6 = function $$compile() { var self = this; return self.$compile_call(self.$children(), self.level); }, TMP_6.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('BaseYieldNode')); (function($base, $super) { function $YasgnNode(){}; var self = $YasgnNode = $klass($base, $super, 'YasgnNode', $YasgnNode); var def = self.$$proto, $scope = self.$$scope, TMP_7; self.$handle("yasgn"); self.$children("var_name", "yield_args"); return (Opal.defn(self, '$compile', TMP_7 = function $$compile() { var $a, self = this; self.$compile_call(($a = self).$s.apply($a, Opal.to_a(self.$yield_args()['$[]']($range(1, -1, false)))), "stmt"); return self.$wrap("(" + (self.$var_name()) + " = ", ")"); }, TMP_7.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('BaseYieldNode')); (function($base, $super) { function $ReturnableYieldNode(){}; var self = $ReturnableYieldNode = $klass($base, $super, 'ReturnableYieldNode', $ReturnableYieldNode); var def = self.$$proto, $scope = self.$$scope, TMP_8; def.level = nil; self.$handle("returnable_yield"); return (Opal.defn(self, '$compile', TMP_8 = function $$compile() { var self = this; self.$compile_call(self.$children(), self.level); return self.$wrap("return ", ";"); }, TMP_8.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('BaseYieldNode')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/rescue"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$require', '$handle', '$children', '$stmt?', '$lhs', '$returns', '$compiler', '$rhs', '$line', '$expr', '$body', '$indent', '$new', '$rescue_val', '$wrap', '$push', '$in_ensure', '$process', '$body_sexp', '$has_rescue_else?', '$unshift', '$rescue_else_sexp', '$scope', '$ensr_sexp', '$wrap_in_closure?', '$begn', '$==', '$type', '$s', '$ensr', '$recv?', '$expr?', '$rescue_else_sexp=', '$detect', '$!=', '$[]', '$handle_rescue_else_manually?', '$body_code', '$each_with_index', '$!', '$in_ensure?', '$empty?', '$rescue_exprs', '$rescue_variable', '$[]=', '$rescue_body', '$===', '$include?', '$rescue_variable?', '$last', '$args', '$dup', '$pop']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $RescueModNode(){}; var self = $RescueModNode = $klass($base, $super, 'RescueModNode', $RescueModNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_4; self.$handle("rescue_mod"); self.$children("lhs", "rhs"); Opal.defn(self, '$body', TMP_1 = function $$body() { var $a, self = this; if ((($a = self['$stmt?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$lhs() } else { return self.$compiler().$returns(self.$lhs()) }; }, TMP_1.$$arity = 0); Opal.defn(self, '$rescue_val', TMP_2 = function $$rescue_val() { var $a, self = this; if ((($a = self['$stmt?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$rhs() } else { return self.$compiler().$returns(self.$rhs()) }; }, TMP_2.$$arity = 0); return (Opal.defn(self, '$compile', TMP_4 = function $$compile() { var $a, $b, TMP_3, self = this; self.$line("try {", self.$expr(self.$body()), " } catch ($err) { "); ($a = ($b = self).$indent, $a.$$p = (TMP_3 = function(){var self = TMP_3.$$s || this; self.$line("if (Opal.rescue($err, [", self.$expr($scope.get('Sexp').$new(["const", "StandardError"])), "])) {"); self.$line(self.$expr(self.$rescue_val())); return self.$line("} else { throw $err; } }");}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3), $a).call($b); if ((($a = self['$stmt?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return self.$wrap("(function() {", "})()") }; }, TMP_4.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $EnsureNode(){}; var self = $EnsureNode = $klass($base, $super, 'EnsureNode', $EnsureNode); var def = self.$$proto, $scope = self.$$scope, TMP_9, TMP_10, TMP_11, TMP_12; self.$handle("ensure"); self.$children("begn", "ensr"); Opal.defn(self, '$compile', TMP_9 = function $$compile() { var $a, $b, TMP_5, $c, TMP_6, self = this; self.$push("try {"); ($a = ($b = self).$in_ensure, $a.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this; if (self.level == null) self.level = nil; return self.$line(self.$compiler().$process(self.$body_sexp(), self.level))}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $a).call($b); self.$line("} finally {"); ($a = ($c = self).$indent, $a.$$p = (TMP_6 = function(){var self = TMP_6.$$s || this, $d, $e, TMP_7; if (self.level == null) self.level = nil; if ((($d = self['$has_rescue_else?']()) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { self.$unshift("var $no_errors = true; "); self.$line("var $rescue_else_result;"); self.$line("if ($no_errors) { "); ($d = ($e = self).$indent, $d.$$p = (TMP_7 = function(){var self = TMP_7.$$s || this, $f, $g, TMP_8; self.$line("$rescue_else_result = (function() {"); ($f = ($g = self).$indent, $f.$$p = (TMP_8 = function(){var self = TMP_8.$$s || this; if (self.level == null) self.level = nil; return self.$line(self.$compiler().$process(self.$compiler().$returns(self.$scope().$rescue_else_sexp()), self.level))}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8), $f).call($g); return self.$line("})();");}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7), $d).call($e); self.$line("}"); self.$line(self.$compiler().$process(self.$ensr_sexp(), self.level)); return self.$line("if ($no_errors) { return $rescue_else_result; }"); } else { return self.$line(self.$compiler().$process(self.$ensr_sexp(), self.level)) }}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6), $a).call($c); self.$line("}"); if ((($a = self['$wrap_in_closure?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$wrap("(function() { ", "; })()") } else { return nil }; }, TMP_9.$$arity = 0); Opal.defn(self, '$body_sexp', TMP_10 = function $$body_sexp() { var $a, self = this, sexp = nil; if ((($a = self['$wrap_in_closure?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { sexp = self.$compiler().$returns(self.$begn()); if (sexp.$type()['$==']("rescue")) { return self.$s("js_return", sexp) } else { return sexp }; } else { return sexp = self.$begn() }; }, TMP_10.$$arity = 0); Opal.defn(self, '$ensr_sexp', TMP_11 = function $$ensr_sexp() { var $a, self = this; return ((($a = self.$ensr()) !== false && $a !== nil && $a != null) ? $a : self.$s("nil")); }, TMP_11.$$arity = 0); return (Opal.defn(self, '$wrap_in_closure?', TMP_12 = function() { var $a, $b, self = this; return ((($a = ((($b = self['$recv?']()) !== false && $b !== nil && $b != null) ? $b : self['$expr?']())) !== false && $a !== nil && $a != null) ? $a : self['$has_rescue_else?']()); }, TMP_12.$$arity = 0), nil) && 'wrap_in_closure?'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $RescueNode(){}; var self = $RescueNode = $klass($base, $super, 'RescueNode', $RescueNode); var def = self.$$proto, $scope = self.$$scope, TMP_20, TMP_21, TMP_22; self.$handle("rescue"); self.$children("body"); Opal.defn(self, '$compile', TMP_20 = function $$compile() { var $a, $b, $c, $d, TMP_13, TMP_14, TMP_15, $e, TMP_17, $f, self = this, has_rescue_handlers = nil; (($a = [($c = ($d = self.$children()['$[]']($range(1, -1, false))).$detect, $c.$$p = (TMP_13 = function(sexp){var self = TMP_13.$$s || this; if (sexp == null) sexp = nil; return sexp.$type()['$!=']("resbody")}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13), $c).call($d)]), $b = self.$scope(), $b['$rescue_else_sexp='].apply($b, $a), $a[$a.length-1]); has_rescue_handlers = false; if ((($a = self['$handle_rescue_else_manually?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$line("var $no_errors = true;")}; self.$push("try {"); ($a = ($b = self).$indent, $a.$$p = (TMP_14 = function(){var self = TMP_14.$$s || this; if (self.level == null) self.level = nil; return self.$line(self.$process(self.$body_code(), self.level))}, TMP_14.$$s = self, TMP_14.$$arity = 0, TMP_14), $a).call($b); self.$line("} catch ($err) {"); ($a = ($c = self).$indent, $a.$$p = (TMP_15 = function(){var self = TMP_15.$$s || this, $e, $f, TMP_16; if ((($e = self['$has_rescue_else?']()) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { self.$line("$no_errors = false;")}; ($e = ($f = self.$children()['$[]']($range(1, -1, false))).$each_with_index, $e.$$p = (TMP_16 = function(child, idx){var self = TMP_16.$$s || this; if (self.level == null) self.level = nil; if (child == null) child = nil;if (idx == null) idx = nil; if (child.$type()['$==']("resbody")) { has_rescue_handlers = true; if (idx['$=='](0)) { } else { self.$push(" else ") }; return self.$line(self.$process(child, self.level)); } else { return nil }}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16), $e).call($f); return self.$push(" else { throw $err; }");}, TMP_15.$$s = self, TMP_15.$$arity = 0, TMP_15), $a).call($c); self.$line("}"); if ((($a = self['$handle_rescue_else_manually?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push("finally {"); ($a = ($e = self).$indent, $a.$$p = (TMP_17 = function(){var self = TMP_17.$$s || this, $f, $g, TMP_18; self.$line("if ($no_errors) { "); ($f = ($g = self).$indent, $f.$$p = (TMP_18 = function(){var self = TMP_18.$$s || this, $h, $i, TMP_19; self.$line("return (function() {"); ($h = ($i = self).$indent, $h.$$p = (TMP_19 = function(){var self = TMP_19.$$s || this; if (self.level == null) self.level = nil; return self.$line(self.$compiler().$process(self.$compiler().$returns(self.$scope().$rescue_else_sexp()), self.level))}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19), $h).call($i); return self.$line("})();");}, TMP_18.$$s = self, TMP_18.$$arity = 0, TMP_18), $f).call($g); return self.$line("}");}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17), $a).call($e); self.$push("}");}; if ((($a = ((($f = self['$expr?']()) !== false && $f !== nil && $f != null) ? $f : self['$recv?']())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$wrap("(function() { ", "})()") } else { return nil }; }, TMP_20.$$arity = 0); Opal.defn(self, '$body_code', TMP_21 = function $$body_code() { var $a, self = this, body_code = nil; body_code = ((function() {if (self.$body().$type()['$==']("resbody")) { return self.$s("nil") } else { return self.$body() }; return nil; })()); if ((($a = self['$stmt?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { body_code = self.$compiler().$returns(body_code) }; return body_code; }, TMP_21.$$arity = 0); return (Opal.defn(self, '$handle_rescue_else_manually?', TMP_22 = function() { var $a, self = this; return ($a = self.$scope()['$in_ensure?']()['$!'](), $a !== false && $a !== nil && $a != null ?self.$scope()['$has_rescue_else?']() : $a); }, TMP_22.$$arity = 0), nil) && 'handle_rescue_else_manually?'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $ResBodyNode(){}; var self = $ResBodyNode = $klass($base, $super, 'ResBodyNode', $ResBodyNode); var def = self.$$proto, $scope = self.$$scope, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30; self.$handle("resbody"); self.$children("args", "body"); Opal.defn(self, '$compile', TMP_26 = function $$compile() { var $a, $b, TMP_23, $c, TMP_24, self = this; self.$push("if (Opal.rescue($err, ["); if ((($a = self.$rescue_exprs()['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$push(self.$expr($scope.get('Sexp').$new(["const", "StandardError"]))) } else { ($a = ($b = self.$rescue_exprs()).$each_with_index, $a.$$p = (TMP_23 = function(rexpr, idx){var self = TMP_23.$$s || this; if (rexpr == null) rexpr = nil;if (idx == null) idx = nil; if (idx['$=='](0)) { } else { self.$push(", ") }; return self.$push(self.$expr(rexpr));}, TMP_23.$$s = self, TMP_23.$$arity = 2, TMP_23), $a).call($b) }; self.$push("])) {"); ($a = ($c = self).$indent, $a.$$p = (TMP_24 = function(){var self = TMP_24.$$s || this, $d, $e, TMP_25, variable = nil; if ((($d = variable = self.$rescue_variable()) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) { variable['$[]='](2, self.$s("js_tmp", "$err")); self.$push(self.$expr(variable), ";");}; self.$line("try {"); ($d = ($e = self).$indent, $d.$$p = (TMP_25 = function(){var self = TMP_25.$$s || this; if (self.level == null) self.level = nil; return self.$line(self.$process(self.$rescue_body(), self.level))}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25), $d).call($e); return self.$line("} finally { Opal.pop_exception() }");}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24), $a).call($c); return self.$line("}"); }, TMP_26.$$arity = 0); Opal.defn(self, '$rescue_variable?', TMP_27 = function(variable) { var $a, self = this; return ($a = $scope.get('Sexp')['$==='](variable), $a !== false && $a !== nil && $a != null ?["lasgn", "iasgn"]['$include?'](variable.$type()) : $a); }, TMP_27.$$arity = 1); Opal.defn(self, '$rescue_variable', TMP_28 = function $$rescue_variable() { var $a, self = this; if ((($a = self['$rescue_variable?'](self.$args().$last())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$args().$last().$dup() } else { return nil }; }, TMP_28.$$arity = 0); Opal.defn(self, '$rescue_exprs', TMP_29 = function $$rescue_exprs() { var $a, self = this, exprs = nil; exprs = self.$args().$dup(); if ((($a = self['$rescue_variable?'](exprs.$last())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { exprs.$pop()}; return exprs.$children(); }, TMP_29.$$arity = 0); return (Opal.defn(self, '$rescue_body', TMP_30 = function $$rescue_body() { var $a, self = this, body_code = nil; body_code = (((($a = self.$body()) !== false && $a !== nil && $a != null) ? $a : self.$s("nil"))); if ((($a = self['$stmt?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { body_code = self.$compiler().$returns(body_code) }; return body_code; }, TMP_30.$$arity = 0), nil) && 'rescue_body'; })($scope.base, $scope.get('Base')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/case"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$require', '$handle', '$children', '$in_case', '$condition', '$[]=', '$case_stmt', '$add_local', '$push', '$expr', '$each_with_index', '$==', '$type', '$needs_closure?', '$returns', '$compiler', '$stmt', '$case_parts', '$!', '$wrap', '$stmt?', '$[]', '$s', '$js_truthy', '$when_checks', '$process', '$body_code', '$whens', '$body']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $CaseNode(){}; var self = $CaseNode = $klass($base, $super, 'CaseNode', $CaseNode); var def = self.$$proto, $scope = self.$$scope, TMP_3, TMP_4, TMP_5, TMP_6; self.$handle("case"); self.$children("condition"); Opal.defn(self, '$compile', TMP_3 = function $$compile() { var $a, $b, TMP_1, self = this, handled_else = nil; handled_else = false; return ($a = ($b = self.$compiler()).$in_case, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this, $c, $d, TMP_2, $e; if ((($c = self.$condition()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$case_stmt()['$[]=']("cond", true); self.$add_local("$case"); self.$push("$case = ", self.$expr(self.$condition()), ";");}; ($c = ($d = self.$case_parts()).$each_with_index, $c.$$p = (TMP_2 = function(wen, idx){var self = TMP_2.$$s || this, $e, $f; if (wen == null) wen = nil;if (idx == null) idx = nil; if ((($e = (($f = wen !== false && wen !== nil && wen != null) ? wen.$type()['$==']("when") : wen)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { if ((($e = self['$needs_closure?']()) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { self.$compiler().$returns(wen)}; if (idx['$=='](0)) { } else { self.$push("else ") }; return self.$push(self.$stmt(wen)); } else if (wen !== false && wen !== nil && wen != null) { handled_else = true; if ((($e = self['$needs_closure?']()) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { wen = self.$compiler().$returns(wen)}; return self.$push("else {", self.$stmt(wen), "}"); } else { return nil }}, TMP_2.$$s = self, TMP_2.$$arity = 2, TMP_2), $c).call($d); if ((($c = ($e = self['$needs_closure?'](), $e !== false && $e !== nil && $e != null ?handled_else['$!']() : $e)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$push("else { return nil }")}; if ((($c = self['$needs_closure?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return self.$wrap("(function() {", "})()") } else { return nil };}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b); }, TMP_3.$$arity = 0); Opal.defn(self, '$needs_closure?', TMP_4 = function() { var self = this; return self['$stmt?']()['$!'](); }, TMP_4.$$arity = 0); Opal.defn(self, '$case_parts', TMP_5 = function $$case_parts() { var self = this; return self.$children()['$[]']($range(1, -1, false)); }, TMP_5.$$arity = 0); return (Opal.defn(self, '$case_stmt', TMP_6 = function $$case_stmt() { var self = this; return self.$compiler().$case_stmt(); }, TMP_6.$$arity = 0), nil) && 'case_stmt'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $WhenNode(){}; var self = $WhenNode = $klass($base, $super, 'WhenNode', $WhenNode); var def = self.$$proto, $scope = self.$$scope, TMP_8, TMP_9, TMP_10, TMP_11; def.level = nil; self.$handle("when"); self.$children("whens", "body"); Opal.defn(self, '$compile', TMP_8 = function $$compile() { var $a, $b, TMP_7, self = this; self.$push("if ("); ($a = ($b = self.$when_checks()).$each_with_index, $a.$$p = (TMP_7 = function(check, idx){var self = TMP_7.$$s || this, $c, call = nil; if (check == null) check = nil;if (idx == null) idx = nil; if (idx['$=='](0)) { } else { self.$push(" || ") }; if (check.$type()['$==']("splat")) { self.$push("(function($splt) { for (var i = 0; i < $splt.length; i++) {"); self.$push("if ($splt[i]['$===']($case)) { return true; }"); return self.$push("} return false; })(", self.$expr(check['$[]'](1)), ")"); } else if ((($c = self.$case_stmt()['$[]']("cond")) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { call = self.$s("call", check, "===", self.$s("arglist", self.$s("js_tmp", "$case"))); return self.$push(self.$expr(call)); } else { return self.$push(self.$js_truthy(check)) };}, TMP_7.$$s = self, TMP_7.$$arity = 2, TMP_7), $a).call($b); return self.$push(") {", self.$process(self.$body_code(), self.level), "}"); }, TMP_8.$$arity = 0); Opal.defn(self, '$when_checks', TMP_9 = function $$when_checks() { var self = this; return self.$whens().$children(); }, TMP_9.$$arity = 0); Opal.defn(self, '$case_stmt', TMP_10 = function $$case_stmt() { var self = this; return self.$compiler().$case_stmt(); }, TMP_10.$$arity = 0); return (Opal.defn(self, '$body_code', TMP_11 = function $$body_code() { var $a, self = this; return ((($a = self.$body()) !== false && $a !== nil && $a != null) ? $a : self.$s("nil")); }, TMP_11.$$arity = 0), nil) && 'body_code'; })($scope.base, $scope.get('Base')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/super"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$children', '$def?', '$scope', '$uses_block!', '$default_compile', '$private', '$s', '$raw_iter', '$arglist', '$raise', '$find_parent_def', '$containing_def_scope', '$to_s', '$mid', '$identify!', '$defs', '$name', '$parent', '$defined_check_param', '$get_super_chain', '$join', '$map', '$implicit_arguments_param', '$super_method_invocation', '$iter?', '$super_block_invocation', '$push', '$receiver_fragment', '$handle', '$add_method', '$method_missing?', '$compiler', '$wrap', '$==', '$uses_zuper=', '$formal_block_parameter', '$!', '$iter', '$[]', '$<<', '$===', '$extract_block_arg', '$block_arg']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $BaseSuperNode(){}; var self = $BaseSuperNode = $klass($base, $super, 'BaseSuperNode', $BaseSuperNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_12, TMP_13; def.iter = def.implicit_args = nil; self.$children("arglist", "raw_iter"); Opal.defn(self, '$compile', TMP_1 = function $$compile() { var $a, self = this; if ((($a = self.$scope()['$def?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$scope()['$uses_block!']()}; return self.$default_compile(); }, TMP_1.$$arity = 0); self.$private(); Opal.defn(self, '$recvr', TMP_2 = function $$recvr() { var self = this; return self.$s("self"); }, TMP_2.$$arity = 0); Opal.defn(self, '$iter', TMP_3 = function $$iter() { var $a, $b, self = this; return ((($a = self.iter) !== false && $a !== nil && $a != null) ? $a : self.iter = (function() {if ((($b = self.$raw_iter()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$raw_iter() } else if ((($b = self.$arglist()) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { return self.$s("js_tmp", "null") } else { self.$scope()['$uses_block!'](); return self.$s("js_tmp", "$iter"); }; return nil; })()); }, TMP_3.$$arity = 0); Opal.defn(self, '$method_jsid', TMP_4 = function $$method_jsid() { var self = this; return self.$raise("Not implemented, see #add_method"); }, TMP_4.$$arity = 0); Opal.defn(self, '$redefine_this?', TMP_5 = function(temporary_receiver) { var self = this; return true; }, TMP_5.$$arity = 1); Opal.defn(self, '$arguments_array?', TMP_6 = function() { var $a, $b, $c, self = this, $iter = TMP_6.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_6.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } return ((($a = ($b = ($c = self, Opal.find_super_dispatcher(self, 'arguments_array?', TMP_6, false)), $b.$$p = $iter, $b).apply($c, $zuper)) !== false && $a !== nil && $a != null) ? $a : self.implicit_args); }, TMP_6.$$arity = 0); Opal.defn(self, '$containing_def_scope', TMP_7 = function $$containing_def_scope() { var $a, self = this; if ((($a = self.$scope()['$def?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$scope()}; return self.$scope().$find_parent_def(); }, TMP_7.$$arity = 0); Opal.defn(self, '$defined_check_param', TMP_8 = function $$defined_check_param() { var self = this; return "false"; }, TMP_8.$$arity = 0); Opal.defn(self, '$implicit_arguments_param', TMP_9 = function $$implicit_arguments_param() { var $a, self = this; if ((($a = self.implicit_args) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "true" } else { return "false" }; }, TMP_9.$$arity = 0); Opal.defn(self, '$super_method_invocation', TMP_10 = function $$super_method_invocation() { var $a, self = this, def_scope = nil, method_jsid = nil, current_func = nil, class_name = nil; def_scope = self.$containing_def_scope(); method_jsid = def_scope.$mid().$to_s(); current_func = def_scope['$identify!'](); if ((($a = def_scope.$defs()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { class_name = (function() {if ((($a = def_scope.$parent().$name()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return "$" + (def_scope.$parent().$name()) } else { return "self.$$class.$$proto" }; return nil; })(); return "Opal.find_super_dispatcher(self, '" + (method_jsid) + "', " + (current_func) + ", " + (self.$defined_check_param()) + ", " + (class_name) + ")"; } else { return "Opal.find_super_dispatcher(self, '" + (method_jsid) + "', " + (current_func) + ", " + (self.$defined_check_param()) + ")" }; }, TMP_10.$$arity = 0); Opal.defn(self, '$super_block_invocation', TMP_12 = function $$super_block_invocation() { var $a, $b, TMP_11, self = this, chain = nil, cur_defn = nil, mid = nil, trys = nil, implicit = nil; $b = self.$scope().$get_super_chain(), $a = Opal.to_ary($b), chain = ($a[0] == null ? nil : $a[0]), cur_defn = ($a[1] == null ? nil : $a[1]), mid = ($a[2] == null ? nil : $a[2]), $b; trys = ($a = ($b = chain).$map, $a.$$p = (TMP_11 = function(c){var self = TMP_11.$$s || this; if (c == null) c = nil; return "" + (c) + ".$$def"}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11), $a).call($b).$join(" || "); implicit = self.implicit_args.$to_s(); return "Opal.find_iter_super_dispatcher(self, " + (mid) + ", (" + (trys) + " || " + (cur_defn) + "), " + (self.$defined_check_param()) + ", " + (self.$implicit_arguments_param()) + ")"; }, TMP_12.$$arity = 0); return (Opal.defn(self, '$add_method', TMP_13 = function $$add_method(temporary_receiver) { var $a, self = this, super_call = nil; super_call = (function() {if ((($a = self.$scope()['$def?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$super_method_invocation() } else if ((($a = self.$scope()['$iter?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$super_block_invocation() } else { return self.$raise("unexpected compilation error") }; return nil; })(); if (temporary_receiver !== false && temporary_receiver !== nil && temporary_receiver != null) { return self.$push("(" + (temporary_receiver) + " = ", self.$receiver_fragment(), ", ", super_call, ")") } else { return self.$push(super_call) }; }, TMP_13.$$arity = 1), nil) && 'add_method'; })($scope.base, $scope.get('CallNode')); (function($base, $super) { function $DefinedSuperNode(){}; var self = $DefinedSuperNode = $klass($base, $super, 'DefinedSuperNode', $DefinedSuperNode); var def = self.$$proto, $scope = self.$$scope, TMP_14, TMP_15; self.$handle("defined_super"); Opal.defn(self, '$defined_check_param', TMP_14 = function $$defined_check_param() { var self = this; return "true"; }, TMP_14.$$arity = 0); return (Opal.defn(self, '$compile', TMP_15 = function $$compile() { var $a, self = this; self.$add_method(nil); if ((($a = self.$compiler()['$method_missing?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$wrap("(!(", ".$$stub) ? \"super\" : nil)") } else { return self.$wrap("((", ") != null ? \"super\" : nil)") }; }, TMP_15.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('BaseSuperNode')); (function($base, $super) { function $SuperNode(){}; var self = $SuperNode = $klass($base, $super, 'SuperNode', $SuperNode); var def = self.$$proto, $scope = self.$$scope, TMP_16, TMP_17; def.arguments_without_block = nil; self.$handle("super"); Opal.defn(self, '$compile', TMP_16 = function $$compile() { var $a, $b, self = this, $iter = TMP_16.$$p, $yield = $iter || nil, block_arg = nil, expr = nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_16.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } if (self.$arglist()['$=='](nil)) { self.implicit_args = true; if ((($a = self.$containing_def_scope()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { (($a = [true]), $b = self.$containing_def_scope(), $b['$uses_zuper='].apply($b, $a), $a[$a.length-1]); self.arguments_without_block = [self.$s("js_tmp", "$zuper")]; if ((($a = ($b = (block_arg = self.$formal_block_parameter()), $b !== false && $b !== nil && $b != null ?self.$iter()['$!']() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { expr = self.$s("block_pass", self.$s("lvar", block_arg['$[]'](1))); self.arguments_without_block['$<<'](expr);}; } else { self.arguments_without_block = [] };}; return ($a = ($b = self, Opal.find_super_dispatcher(self, 'compile', TMP_16, false)), $a.$$p = $iter, $a).apply($b, $zuper); }, TMP_16.$$arity = 0); self.$private(); return (Opal.defn(self, '$formal_block_parameter', TMP_17 = function $$formal_block_parameter() { var self = this, $case = nil; return (function() {$case = self.$containing_def_scope();if ((((($scope.get('Opal')).$$scope.get('Nodes'))).$$scope.get('IterNode'))['$===']($case)) {return self.$containing_def_scope().$extract_block_arg()}else if ((((($scope.get('Opal')).$$scope.get('Nodes'))).$$scope.get('DefNode'))['$===']($case)) {return self.$containing_def_scope().$block_arg()}else {return self.$raise("Don't know what to do with scope " + (self.$containing_def_scope()))}})(); }, TMP_17.$$arity = 0), nil) && 'formal_block_parameter'; })($scope.base, $scope.get('BaseSuperNode')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/version"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; Opal.cdecl($scope, 'VERSION', "0.10.4") })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/top"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$children', '$push', '$version_comment', '$opening', '$in_scope', '$stmt', '$stmts', '$is_a?', '$eval?', '$compiler', '$add_temp', '$add_used_helpers', '$add_used_operators', '$line', '$to_vars', '$scope', '$compile_method_stubs', '$compile_irb_vars', '$compile_end_construct', '$closing', '$requirable?', '$to_s', '$cleanpath', '$Pathname', '$file', '$inspect', '$returns', '$body', '$irb?', '$to_a', '$helpers', '$each', '$operator_helpers', '$[]', '$method_missing?', '$method_calls', '$join', '$map', '$empty?', '$eof_content']); self.$require("pathname"); self.$require("opal/version"); self.$require("opal/nodes/scope"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $TopNode(){}; var self = $TopNode = $klass($base, $super, 'TopNode', $TopNode); var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_8, TMP_10, TMP_12, TMP_13, TMP_14; self.$handle("top"); self.$children("body"); Opal.defn(self, '$compile', TMP_2 = function $$compile() { var $a, $b, TMP_1, self = this; self.$push(self.$version_comment()); self.$opening(); ($a = ($b = self).$in_scope, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this, $c, body_code = nil; body_code = self.$stmt(self.$stmts()); if ((($c = body_code['$is_a?']($scope.get('Array'))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { body_code = [body_code] }; if ((($c = self.$compiler()['$eval?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { self.$add_temp("self = Opal.top") }; self.$add_temp((function() {if ((($c = self.$compiler()['$eval?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return "$scope = (self.$$scope || self.$$class.$$scope)" } else { return "$scope = Opal" }; return nil; })()); self.$add_temp("nil = Opal.nil"); self.$add_used_helpers(); self.$add_used_operators(); self.$line(self.$scope().$to_vars()); self.$compile_method_stubs(); self.$compile_irb_vars(); self.$compile_end_construct(); return self.$line(body_code);}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b); return self.$closing(); }, TMP_2.$$arity = 0); Opal.defn(self, '$opening', TMP_3 = function $$opening() { var $a, self = this, path = nil; if ((($a = self.$compiler()['$requirable?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { path = self.$Pathname(self.$compiler().$file()).$cleanpath().$to_s(); return self.$line("Opal.modules[" + (path.$inspect()) + "] = function(Opal) {"); } else if ((($a = self.$compiler()['$eval?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$line("(function(Opal, self) {") } else { return self.$line("(function(Opal) {") }; }, TMP_3.$$arity = 0); Opal.defn(self, '$closing', TMP_4 = function $$closing() { var $a, self = this; if ((($a = self.$compiler()['$requirable?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$line("};\n") } else if ((($a = self.$compiler()['$eval?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$line("})(Opal, self)") } else { return self.$line("})(Opal);\n") }; }, TMP_4.$$arity = 0); Opal.defn(self, '$stmts', TMP_5 = function $$stmts() { var self = this; return self.$compiler().$returns(self.$body()); }, TMP_5.$$arity = 0); Opal.defn(self, '$compile_irb_vars', TMP_6 = function $$compile_irb_vars() { var $a, self = this; if ((($a = self.$compiler()['$irb?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$line("if (!Opal.irb_vars) { Opal.irb_vars = {}; }") } else { return nil }; }, TMP_6.$$arity = 0); Opal.defn(self, '$add_used_helpers', TMP_8 = function $$add_used_helpers() { var $a, $b, TMP_7, self = this, helpers = nil; helpers = self.$compiler().$helpers().$to_a(); return ($a = ($b = helpers.$to_a()).$each, $a.$$p = (TMP_7 = function(h){var self = TMP_7.$$s || this; if (h == null) h = nil; return self.$add_temp("$" + (h) + " = Opal." + (h))}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $a).call($b); }, TMP_8.$$arity = 0); Opal.defn(self, '$add_used_operators', TMP_10 = function $$add_used_operators() { var $a, $b, TMP_9, self = this, operators = nil; operators = self.$compiler().$operator_helpers().$to_a(); return ($a = ($b = operators).$each, $a.$$p = (TMP_9 = function(op){var self = TMP_9.$$s || this, name = nil; if (op == null) op = nil; name = (((($scope.get('Nodes')).$$scope.get('CallNode'))).$$scope.get('OPERATORS'))['$[]'](op); self.$line("function $rb_" + (name) + "(lhs, rhs) {"); self.$line(" return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs " + (op) + " rhs : lhs['$" + (op) + "'](rhs);"); return self.$line("}");}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9), $a).call($b); }, TMP_10.$$arity = 0); Opal.defn(self, '$compile_method_stubs', TMP_12 = function $$compile_method_stubs() { var $a, $b, TMP_11, self = this, calls = nil, stubs = nil; if ((($a = self.$compiler()['$method_missing?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { calls = self.$compiler().$method_calls(); stubs = ($a = ($b = calls.$to_a()).$map, $a.$$p = (TMP_11 = function(k){var self = TMP_11.$$s || this; if (k == null) k = nil; return "'$" + (k) + "'"}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11), $a).call($b).$join(", "); if ((($a = stubs['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { return self.$line("Opal.add_stubs([" + (stubs) + "]);") }; } else { return nil }; }, TMP_12.$$arity = 0); Opal.defn(self, '$compile_end_construct', TMP_13 = function $$compile_end_construct() { var $a, self = this, content = nil; if ((($a = content = self.$compiler().$eof_content()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { self.$line("var $__END__ = Opal.Object.$new();"); return self.$line("$__END__.$read = function() { return " + (content.$inspect()) + "; };"); } else { return nil }; }, TMP_13.$$arity = 0); return (Opal.defn(self, '$version_comment', TMP_14 = function $$version_comment() { var self = this; return "/* Generated by Opal " + ((($scope.get('Opal')).$$scope.get('VERSION'))) + " */"; }, TMP_14.$$arity = 0), nil) && 'version_comment'; })($scope.base, $scope.get('ScopeNode')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/while"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$children', '$with_temp', '$js_truthy', '$test', '$in_while', '$wrap_in_closure?', '$[]=', '$while_loop', '$stmt', '$body', '$uses_redo?', '$push', '$while_open', '$while_close', '$line', '$compiler', '$wrap', '$[]', '$expr?', '$recv?']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $WhileNode(){}; var self = $WhileNode = $klass($base, $super, 'WhileNode', $WhileNode); var def = self.$$proto, $scope = self.$$scope, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7; self.$handle("while"); self.$children("test", "body"); Opal.defn(self, '$compile', TMP_3 = function $$compile() { var $a, $b, TMP_1, self = this; ($a = ($b = self).$with_temp, $a.$$p = (TMP_1 = function(redo_var){var self = TMP_1.$$s || this, $c, $d, TMP_2, test_code = nil; if (redo_var == null) redo_var = nil; test_code = self.$js_truthy(self.$test()); return ($c = ($d = self.$compiler()).$in_while, $c.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this, $e, body_code = nil; if ((($e = self['$wrap_in_closure?']()) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { self.$while_loop()['$[]=']("closure", true)}; self.$while_loop()['$[]=']("redo_var", redo_var); body_code = self.$stmt(self.$body()); if ((($e = self['$uses_redo?']()) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { self.$push("" + (redo_var) + " = false; " + (self.$while_open()) + (redo_var) + " || "); self.$push(test_code); self.$push(self.$while_close()); } else { self.$push(self.$while_open(), test_code, self.$while_close()) }; if ((($e = self['$uses_redo?']()) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { self.$push("" + (redo_var) + " = false;")}; return self.$line(body_code, "}");}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $c).call($d);}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); if ((($a = self['$wrap_in_closure?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$wrap("(function() {", "; return nil; })()") } else { return nil }; }, TMP_3.$$arity = 0); Opal.defn(self, '$while_open', TMP_4 = function $$while_open() { var self = this; return "while ("; }, TMP_4.$$arity = 0); Opal.defn(self, '$while_close', TMP_5 = function $$while_close() { var self = this; return ") {"; }, TMP_5.$$arity = 0); Opal.defn(self, '$uses_redo?', TMP_6 = function() { var self = this; return self.$while_loop()['$[]']("use_redo"); }, TMP_6.$$arity = 0); return (Opal.defn(self, '$wrap_in_closure?', TMP_7 = function() { var $a, self = this; return ((($a = self['$expr?']()) !== false && $a !== nil && $a != null) ? $a : self['$recv?']()); }, TMP_7.$$arity = 0), nil) && 'wrap_in_closure?'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $UntilNode(){}; var self = $UntilNode = $klass($base, $super, 'UntilNode', $UntilNode); var def = self.$$proto, $scope = self.$$scope, TMP_8, TMP_9; self.$handle("until"); Opal.defn(self, '$while_open', TMP_8 = function $$while_open() { var self = this; return "while (!("; }, TMP_8.$$arity = 0); return (Opal.defn(self, '$while_close', TMP_9 = function $$while_close() { var self = this; return ")) {"; }, TMP_9.$$arity = 0), nil) && 'while_close'; })($scope.base, $scope.get('WhileNode')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/for"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$children', '$with_temp', '$==', '$type', '$args_sexp', '$s', '$<<', '$body_sexp', '$first', '$insert', '$each', '$[]', '$===', '$add_local', '$value', '$push', '$expr']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ForNode(){}; var self = $ForNode = $klass($base, $super, 'ForNode', $ForNode); var def = self.$$proto, $scope = self.$$scope, TMP_4; self.$handle("for"); self.$children("value", "args_sexp", "body_sexp"); return (Opal.defn(self, '$compile', TMP_4 = function $$compile() { var $a, $b, TMP_1, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_1 = function(loop_var){var self = TMP_1.$$s || this, $c, $d, TMP_2, assign = nil, iter = nil, sexp = nil; if (loop_var == null) loop_var = nil; if (self.$args_sexp().$type()['$==']("array")) { assign = self.$s("masgn", self.$args_sexp()); assign['$<<'](self.$s("to_ary", self.$s("js_tmp", loop_var))); } else { assign = self.$args_sexp()['$<<'](self.$s("js_tmp", loop_var)) }; if ((($c = self.$body_sexp()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { if (self.$body_sexp().$first()['$==']("block")) { self.$body_sexp().$insert(1, assign); assign = self.$body_sexp(); } else { assign = self.$s("block", assign, self.$body_sexp()) }}; ($c = ($d = assign.$children()).$each, $c.$$p = (TMP_2 = function(sexp){var self = TMP_2.$$s || this, $e, $f, TMP_3, $case = nil; if (sexp == null) sexp = nil; return (function() {$case = sexp['$[]'](0);if ("lasgn"['$===']($case)) {return self.$add_local(sexp['$[]'](1))}else if ("masgn"['$===']($case)) {if (sexp['$[]'](1)['$[]'](0)['$==']("array")) { return ($e = ($f = sexp['$[]'](1)['$[]'](1)).$each, $e.$$p = (TMP_3 = function(sexp){var self = TMP_3.$$s || this; if (sexp == null) sexp = nil; if (sexp['$[]'](0)['$==']("lasgn")) { return self.$add_local(sexp['$[]'](1)) } else { return nil }}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $e).call($f) } else { return nil }}else { return nil }})()}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $c).call($d); iter = self.$s("iter", self.$s("lasgn", loop_var), assign); sexp = self.$s("call", self.$value(), "each", self.$s("arglist"), iter); return self.$push(self.$expr(sexp));}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); }, TMP_4.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/hash"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$require', '$handle', '$attr_accessor', '$each', '$==', '$type', '$has_kwsplat=', '$<<', '$values', '$keys', '$children', '$all?', '$include?', '$extract_kv_pairs_and_kwsplats', '$has_kwsplat', '$compile_merge', '$simple_keys?', '$compile_hash2', '$compile_hash', '$helper', '$empty?', '$expr', '$s', '$each_with_index', '$push', '$wrap', '$times', '$inspect', '$to_s', '$[]', '$[]=', '$size', '$join', '$value']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $HashNode(){}; var self = $HashNode = $klass($base, $super, 'HashNode', $HashNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_3, TMP_5, TMP_6, TMP_9, TMP_11, TMP_14; self.$handle("hash"); self.$attr_accessor("has_kwsplat", "keys", "values"); Opal.defn(self, '$initialize', TMP_1 = function $$initialize($a_rest) { var $b, $c, self = this, $iter = TMP_1.$$p, $yield = $iter || nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil; TMP_1.$$p = null; $zuper = []; for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) { $zuper[$zuper_index] = arguments[$zuper_index]; } ($b = ($c = self, Opal.find_super_dispatcher(self, 'initialize', TMP_1, false)), $b.$$p = $iter, $b).apply($c, $zuper); self.has_kwsplat = false; self.keys = []; return self.values = []; }, TMP_1.$$arity = -1); Opal.defn(self, '$extract_kv_pairs_and_kwsplats', TMP_3 = function $$extract_kv_pairs_and_kwsplats() { var $a, $b, TMP_2, self = this, found_key = nil; found_key = false; ($a = ($b = self.$children()).$each, $a.$$p = (TMP_2 = function(obj){var self = TMP_2.$$s || this, $c, $d; if (obj == null) obj = nil; if (obj.$type()['$==']("kwsplat")) { return (($c = [true]), $d = self, $d['$has_kwsplat='].apply($d, $c), $c[$c.length-1]) } else if (found_key !== false && found_key !== nil && found_key != null) { self.$values()['$<<'](obj); return found_key = false; } else { self.$keys()['$<<'](obj); return found_key = true; }}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($b); return [self.$keys(), self.$values()]; }, TMP_3.$$arity = 0); Opal.defn(self, '$simple_keys?', TMP_5 = function() { var $a, $b, TMP_4, self = this; return ($a = ($b = self.$keys())['$all?'], $a.$$p = (TMP_4 = function(key){var self = TMP_4.$$s || this; if (key == null) key = nil; return ["sym", "str"]['$include?'](key.$type())}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $a).call($b); }, TMP_5.$$arity = 0); Opal.defn(self, '$compile', TMP_6 = function $$compile() { var $a, self = this; self.$extract_kv_pairs_and_kwsplats(); if ((($a = self.$has_kwsplat()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$compile_merge() } else if ((($a = self['$simple_keys?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$compile_hash2() } else { return self.$compile_hash() }; }, TMP_6.$$arity = 0); Opal.defn(self, '$compile_merge', TMP_9 = function $$compile_merge() { var $a, $b, TMP_7, $c, $d, TMP_8, self = this, result = nil, seq = nil; self.$helper("hash"); $a = [[], []], result = $a[0], seq = $a[1], $a; ($a = ($b = self.$children()).$each, $a.$$p = (TMP_7 = function(child){var self = TMP_7.$$s || this, $c; if (child == null) child = nil; if (child.$type()['$==']("kwsplat")) { if ((($c = seq['$empty?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { result['$<<'](self.$expr(($c = self).$s.apply($c, ["hash"].concat(Opal.to_a(seq))))) }; result['$<<'](self.$expr(child)); return seq = []; } else { return seq['$<<'](child) }}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $a).call($b); if ((($a = seq['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { result['$<<'](self.$expr(($a = self).$s.apply($a, ["hash"].concat(Opal.to_a(seq))))) }; return ($c = ($d = result).$each_with_index, $c.$$p = (TMP_8 = function(fragment, idx){var self = TMP_8.$$s || this; if (fragment == null) fragment = nil;if (idx == null) idx = nil; if (idx['$=='](0)) { return self.$push(fragment) } else { return self.$push(".$merge(", fragment, ")") }}, TMP_8.$$s = self, TMP_8.$$arity = 2, TMP_8), $c).call($d); }, TMP_9.$$arity = 0); Opal.defn(self, '$compile_hash', TMP_11 = function $$compile_hash() { var $a, $b, TMP_10, self = this; self.$helper("hash"); ($a = ($b = self.$children()).$each_with_index, $a.$$p = (TMP_10 = function(child, idx){var self = TMP_10.$$s || this; if (child == null) child = nil;if (idx == null) idx = nil; if (idx['$=='](0)) { } else { self.$push(", ") }; return self.$push(self.$expr(child));}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10), $a).call($b); return self.$wrap("$hash(", ")"); }, TMP_11.$$arity = 0); return (Opal.defn(self, '$compile_hash2', TMP_14 = function $$compile_hash2() { var $a, $b, TMP_12, $c, TMP_13, self = this, hash_obj = nil, hash_keys = nil; $a = [$hash2([], {}), []], hash_obj = $a[0], hash_keys = $a[1], $a; self.$helper("hash2"); ($a = ($b = self.$keys().$size()).$times, $a.$$p = (TMP_12 = function(idx){var self = TMP_12.$$s || this, $c, key = nil; if (idx == null) idx = nil; key = self.$keys()['$[]'](idx)['$[]'](1).$to_s().$inspect(); if ((($c = hash_obj['$include?'](key)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { hash_keys['$<<'](key) }; return hash_obj['$[]='](key, self.$expr(self.$values()['$[]'](idx)));}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12), $a).call($b); ($a = ($c = hash_keys).$each_with_index, $a.$$p = (TMP_13 = function(key, idx){var self = TMP_13.$$s || this; if (key == null) key = nil;if (idx == null) idx = nil; if (idx['$=='](0)) { } else { self.$push(", ") }; self.$push("" + (key) + ": "); return self.$push(hash_obj['$[]'](key));}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13), $a).call($c); return self.$wrap("$hash2([" + (hash_keys.$join(", ")) + "], {", "})"); }, TMP_14.$$arity = 0), nil) && 'compile_hash2'; })($scope.base, $scope.get('Base')); (function($base, $super) { function $KwSplatNode(){}; var self = $KwSplatNode = $klass($base, $super, 'KwSplatNode', $KwSplatNode); var def = self.$$proto, $scope = self.$$scope, TMP_15; self.$handle("kwsplat"); self.$children("value"); return (Opal.defn(self, '$compile', TMP_15 = function $$compile() { var self = this; return self.$push("Opal.to_hash(", self.$expr(self.$value()), ")"); }, TMP_15.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')); })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/array"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$empty?', '$children', '$push', '$each', '$==', '$type', '$expr', '$<<', '$fragment']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ArrayNode(){}; var self = $ArrayNode = $klass($base, $super, 'ArrayNode', $ArrayNode); var def = self.$$proto, $scope = self.$$scope, TMP_2; self.$handle("array"); return (Opal.defn(self, '$compile', TMP_2 = function $$compile() { var $a, $b, TMP_1, self = this, code = nil, work = nil, join = nil; if ((($a = self.$children()['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$push("[]")}; $a = [[], []], code = $a[0], work = $a[1], $a; ($a = ($b = self.$children()).$each, $a.$$p = (TMP_1 = function(child){var self = TMP_1.$$s || this, $c, splat = nil, part = nil; if (child == null) child = nil; splat = child.$type()['$==']("splat"); part = self.$expr(child); if (splat !== false && splat !== nil && splat != null) { if ((($c = work['$empty?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { if ((($c = code['$empty?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { code['$<<'](self.$fragment("[].concat("))['$<<'](part)['$<<'](self.$fragment(")")) } else { code['$<<'](self.$fragment(".concat("))['$<<'](part)['$<<'](self.$fragment(")")) } } else { if ((($c = code['$empty?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { code['$<<'](self.$fragment("["))['$<<'](work)['$<<'](self.$fragment("]")) } else { code['$<<'](self.$fragment(".concat(["))['$<<'](work)['$<<'](self.$fragment("])")) }; code['$<<'](self.$fragment(".concat("))['$<<'](part)['$<<'](self.$fragment(")")); }; return work = []; } else { if ((($c = work['$empty?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { work['$<<'](self.$fragment(", ")) }; return work['$<<'](part); };}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); if ((($a = work['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { join = [self.$fragment("["), work, self.$fragment("]")]; if ((($a = code['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { code = join } else { code.$push([self.$fragment(".concat("), join, self.$fragment(")")]) }; }; return self.$push(code); }, TMP_2.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/defined"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$require', '$handle', '$children', '$type', '$value', '$===', '$push', '$inspect', '$to_s', '$expr', '$s', '$[]', '$respond_to?', '$__send__', '$mid_to_jsid', '$with_temp', '$handle_block_given_call', '$compiler', '$wrap', '$include?']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $DefinedNode(){}; var self = $DefinedNode = $klass($base, $super, 'DefinedNode', $DefinedNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_3, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_14, TMP_16; def.sexp = nil; self.$handle("defined"); self.$children("value"); Opal.defn(self, '$compile', TMP_1 = function $$compile() { var $a, self = this, type = nil, $case = nil; type = self.$value().$type(); return (function() {$case = type;if ("self"['$===']($case) || "nil"['$===']($case) || "false"['$===']($case) || "true"['$===']($case)) {return self.$push(type.$to_s().$inspect())}else if ("lasgn"['$===']($case) || "iasgn"['$===']($case) || "gasgn"['$===']($case) || "cvdecl"['$===']($case) || "masgn"['$===']($case) || "op_asgn_or"['$===']($case) || "op_asgn_and"['$===']($case)) {return self.$push("'assignment'")}else if ("paren"['$===']($case) || "not"['$===']($case)) {return self.$push(self.$expr(self.$s("defined", self.$value()['$[]'](1))))}else if ("lvar"['$===']($case)) {return self.$push("'local-variable'")}else {if ((($a = self['$respond_to?']("compile_" + (type))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$__send__("compile_" + (type)) } else { return self.$push("'expression'") }}})(); }, TMP_1.$$arity = 0); Opal.defn(self, '$compile_call', TMP_3 = function $$compile_call() { var $a, $b, TMP_2, self = this, mid = nil, recv = nil; mid = self.$mid_to_jsid(self.$value()['$[]'](2).$to_s()); recv = (function() {if ((($a = self.$value()['$[]'](1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$expr(self.$value()['$[]'](1)) } else { return "self" }; return nil; })(); return ($a = ($b = self).$with_temp, $a.$$p = (TMP_2 = function(tmp){var self = TMP_2.$$s || this; if (tmp == null) tmp = nil; self.$push("(((" + (tmp) + " = ", recv, "" + (mid) + ") && !" + (tmp) + ".$$stub) || ", recv); return self.$push("['$respond_to_missing?']('" + (self.$value()['$[]'](2).$to_s()) + "') ? 'method' : nil)");}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($b); }, TMP_3.$$arity = 0); Opal.defn(self, '$compile_ivar', TMP_5 = function $$compile_ivar() { var $a, $b, TMP_4, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_4 = function(tmp){var self = TMP_4.$$s || this, name = nil; if (tmp == null) tmp = nil; name = self.$value()['$[]'](1).$to_s()['$[]']($range(1, -1, false)); self.$push("((" + (tmp) + " = self['" + (name) + "'], " + (tmp) + " != null && " + (tmp) + " !== nil) ? "); return self.$push("'instance-variable' : nil)");}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $a).call($b); }, TMP_5.$$arity = 0); Opal.defn(self, '$compile_super', TMP_6 = function $$compile_super() { var self = this; return self.$push(self.$expr(self.$s("defined_super", self.$value()))); }, TMP_6.$$arity = 0); Opal.defn(self, '$compile_yield', TMP_7 = function $$compile_yield() { var self = this; self.$push(self.$compiler().$handle_block_given_call(self.sexp)); return self.$wrap("((", ") != null ? \"yield\" : nil)"); }, TMP_7.$$arity = 0); Opal.defn(self, '$compile_xstr', TMP_8 = function $$compile_xstr() { var self = this; self.$push(self.$expr(self.$value())); return self.$wrap("(typeof(", ") !== \"undefined\")"); }, TMP_8.$$arity = 0); Opal.alias(self, 'compile_dxstr', 'compile_xstr'); Opal.defn(self, '$compile_const', TMP_9 = function $$compile_const() { var self = this; return self.$push("($scope." + (self.$value()['$[]'](1)) + " != null)"); }, TMP_9.$$arity = 0); Opal.defn(self, '$compile_colon2', TMP_10 = function $$compile_colon2() { var self = this; self.$push("(function(){ try { return (("); self.$push(self.$expr(self.$value())); self.$push(") != null ? 'constant' : nil); } catch (err) { if (err.$$class"); return self.$push(" === Opal.NameError) { return nil; } else { throw(err); }}; })()"); }, TMP_10.$$arity = 0); Opal.defn(self, '$compile_colon3', TMP_11 = function $$compile_colon3() { var self = this; return self.$push("(Opal.Object.$$scope." + (self.$value()['$[]'](1)) + " == null ? nil : 'constant')"); }, TMP_11.$$arity = 0); Opal.defn(self, '$compile_cvar', TMP_12 = function $$compile_cvar() { var self = this; return self.$push("(Opal.cvars['" + (self.$value()['$[]'](1)) + "'] != null ? 'class variable' : nil)"); }, TMP_12.$$arity = 0); Opal.defn(self, '$compile_gvar', TMP_14 = function $$compile_gvar() { var $a, $b, TMP_13, self = this, name = nil; name = self.$value()['$[]'](1).$to_s()['$[]']($range(1, -1, false)); if ((($a = ["~", "!"]['$include?'](name)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$push("'global-variable'") } else if ((($a = ["`", "'", "+", "&"]['$include?'](name)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ($a = ($b = self).$with_temp, $a.$$p = (TMP_13 = function(tmp){var self = TMP_13.$$s || this; if (tmp == null) tmp = nil; self.$push("((" + (tmp) + " = $gvars['~'], " + (tmp) + " != null && " + (tmp) + " !== nil) ? "); return self.$push("'global-variable' : nil)");}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13), $a).call($b) } else { return self.$push("($gvars[" + (name.$inspect()) + "] != null ? 'global-variable' : nil)") }; }, TMP_14.$$arity = 0); return (Opal.defn(self, '$compile_nth_ref', TMP_16 = function $$compile_nth_ref() { var $a, $b, TMP_15, self = this; return ($a = ($b = self).$with_temp, $a.$$p = (TMP_15 = function(tmp){var self = TMP_15.$$s || this; if (tmp == null) tmp = nil; self.$push("((" + (tmp) + " = $gvars['~'], " + (tmp) + " != null && " + (tmp) + " != nil) ? "); return self.$push("'global-variable' : nil)");}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15), $a).call($b); }, TMP_16.$$arity = 0), nil) && 'compile_nth_ref'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/masgn"] = function(Opal) { function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_ge(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$children', '$new_temp', '$scope', '$==', '$type', '$rhs', '$push', '$expr', '$compile_masgn', '$lhs', '$-', '$size', '$[]', '$queue_temp', '$raise', '$take_while', '$!=', '$drop', '$each_with_index', '$compile_assignment', '$empty?', '$shift', '$<<', '$dup', '$s', '$!', '$>=', '$include?', '$[]=', '$to_sym', '$last']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $MassAssignNode(){}; var self = $MassAssignNode = $klass($base, $super, 'MassAssignNode', $MassAssignNode); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_5, TMP_6; Opal.cdecl($scope, 'SIMPLE_ASSIGNMENT', ["lasgn", "iasgn", "lvar", "gasgn", "cdecl"]); self.$handle("masgn"); self.$children("lhs", "rhs"); Opal.defn(self, '$compile', TMP_1 = function $$compile() { var self = this, array = nil, retval = nil; array = self.$scope().$new_temp(); if (self.$rhs().$type()['$==']("array")) { self.$push("" + (array) + " = ", self.$expr(self.$rhs())); self.$compile_masgn(self.$lhs().$children(), array, $rb_minus(self.$rhs().$size(), 1)); self.$push(", " + (array)); } else if (self.$rhs().$type()['$==']("to_ary")) { retval = self.$scope().$new_temp(); self.$push("" + (retval) + " = ", self.$expr(self.$rhs()['$[]'](1))); self.$push(", " + (array) + " = Opal.to_ary(" + (retval) + ")"); self.$compile_masgn(self.$lhs().$children(), array); self.$push(", " + (retval)); self.$scope().$queue_temp(retval); } else if (self.$rhs().$type()['$==']("splat")) { self.$push("" + (array) + " = Opal.to_a(", self.$expr(self.$rhs()['$[]'](1)), ")"); self.$compile_masgn(self.$lhs().$children(), array); self.$push(", " + (array)); } else { self.$raise("unsupported mlhs type") }; return self.$scope().$queue_temp(array); }, TMP_1.$$arity = 0); Opal.defn(self, '$compile_masgn', TMP_5 = function $$compile_masgn(lhs_items, array, len) { var $a, $b, TMP_2, $c, TMP_3, $d, TMP_4, self = this, pre_splat = nil, post_splat = nil, splat = nil, part = nil, tmp = nil; if (len == null) { len = nil; } pre_splat = ($a = ($b = lhs_items).$take_while, $a.$$p = (TMP_2 = function(child){var self = TMP_2.$$s || this; if (child == null) child = nil; return child.$type()['$!=']("splat")}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($b); post_splat = lhs_items.$drop(pre_splat.$size()); ($a = ($c = pre_splat).$each_with_index, $a.$$p = (TMP_3 = function(child, idx){var self = TMP_3.$$s || this; if (child == null) child = nil;if (idx == null) idx = nil; return self.$compile_assignment(child, array, idx, len)}, TMP_3.$$s = self, TMP_3.$$arity = 2, TMP_3), $a).call($c); if ((($a = post_splat['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return nil } else { splat = post_splat.$shift(); if ((($a = post_splat['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = part = splat['$[]'](1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { part = part.$dup()['$<<'](self.$s("js_tmp", "$slice.call(" + (array) + ", " + (pre_splat.$size()) + ")")); self.$push(", "); return self.$push(self.$expr(part)); } else { return nil } } else { tmp = self.$scope().$new_temp(); self.$push(", " + (tmp) + " = " + (array) + ".length - " + (post_splat.$size())); self.$push(", " + (tmp) + " = (" + (tmp) + " < " + (pre_splat.$size()) + ") ? " + (pre_splat.$size()) + " : " + (tmp)); if ((($a = part = splat['$[]'](1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { part = part.$dup()['$<<'](self.$s("js_tmp", "$slice.call(" + (array) + ", " + (pre_splat.$size()) + ", " + (tmp) + ")")); self.$push(", "); self.$push(self.$expr(part));}; ($a = ($d = post_splat).$each_with_index, $a.$$p = (TMP_4 = function(child, idx){var self = TMP_4.$$s || this; if (child == null) child = nil;if (idx == null) idx = nil; if (idx['$=='](0)) { return self.$compile_assignment(child, array, tmp) } else { return self.$compile_assignment(child, array, "" + (tmp) + " + " + (idx)) }}, TMP_4.$$s = self, TMP_4.$$arity = 2, TMP_4), $a).call($d); return self.$scope().$queue_temp(tmp); }; }; }, TMP_5.$$arity = -3); return (Opal.defn(self, '$compile_assignment', TMP_6 = function $$compile_assignment(child, array, idx, len) { var $a, $b, self = this, assign = nil, part = nil, tmp = nil; if (len == null) { len = nil; } if ((($a = ((($b = len['$!']()) !== false && $b !== nil && $b != null) ? $b : $rb_ge(idx, len))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { assign = self.$s("js_tmp", "(" + (array) + "[" + (idx) + "] == null ? nil : " + (array) + "[" + (idx) + "])") } else { assign = self.$s("js_tmp", "" + (array) + "[" + (idx) + "]") }; part = child.$dup(); if ((($a = $scope.get('SIMPLE_ASSIGNMENT')['$include?'](child.$type())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { part['$<<'](assign) } else if (child.$type()['$==']("call")) { part['$[]='](2, ((("") + (part['$[]'](2))) + "=").$to_sym()); part.$last()['$<<'](assign); } else if (child.$type()['$==']("attrasgn")) { part.$last()['$<<'](assign) } else if (child.$type()['$==']("array")) { tmp = self.$scope().$new_temp(); self.$push(", (" + (tmp) + " = Opal.to_ary(" + (assign['$[]'](1)) + ")"); self.$compile_masgn(child.$children(), tmp); self.$push(")"); self.$scope().$queue_temp(tmp); return nil; } else { self.$raise("Bad child node in masgn LHS: " + (child) + ". LHS: " + (self.$lhs())) }; self.$push(", "); return self.$push(self.$expr(part)); }, TMP_6.$$arity = -4), nil) && 'compile_assignment'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes/arglist"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; Opal.add_stubs(['$require', '$handle', '$each', '$==', '$first', '$expr', '$empty?', '$<<', '$fragment', '$children', '$push']); self.$require("opal/nodes/base"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Nodes, self = $Nodes = $module($base, 'Nodes'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $ArglistNode(){}; var self = $ArglistNode = $klass($base, $super, 'ArglistNode', $ArglistNode); var def = self.$$proto, $scope = self.$$scope, TMP_2; self.$handle("arglist"); return (Opal.defn(self, '$compile', TMP_2 = function $$compile() { var $a, $b, TMP_1, self = this, code = nil, work = nil, join = nil; $a = [[], []], code = $a[0], work = $a[1], $a; ($a = ($b = self.$children()).$each, $a.$$p = (TMP_1 = function(current){var self = TMP_1.$$s || this, $c, splat = nil, arg = nil; if (current == null) current = nil; splat = current.$first()['$==']("splat"); arg = self.$expr(current); if (splat !== false && splat !== nil && splat != null) { if ((($c = work['$empty?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { if ((($c = code['$empty?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { code['$<<'](arg) } else { code['$<<'](self.$fragment(".concat("))['$<<'](arg)['$<<'](self.$fragment(")")) } } else { if ((($c = code['$empty?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { code['$<<'](self.$fragment("["))['$<<'](work)['$<<'](self.$fragment("]")) } else { code['$<<'](self.$fragment(".concat(["))['$<<'](work)['$<<'](self.$fragment("])")) }; code['$<<'](self.$fragment(".concat("))['$<<'](arg)['$<<'](self.$fragment(")")); }; return work = []; } else { if ((($c = work['$empty?']()) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { } else { work['$<<'](self.$fragment(", ")) }; return work['$<<'](arg); };}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b); if ((($a = work['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { join = work; if ((($a = code['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { code = join } else { code['$<<'](self.$fragment(".concat("))['$<<'](join)['$<<'](self.$fragment(")")) }; }; return ($a = self).$push.apply($a, Opal.to_a(code)); }, TMP_2.$$arity = 0), nil) && 'compile'; })($scope.base, $scope.get('Base')) })($scope.base) })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/nodes"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); self.$require("opal/nodes/base"); self.$require("opal/nodes/literal"); self.$require("opal/nodes/variables"); self.$require("opal/nodes/constants"); self.$require("opal/nodes/call"); self.$require("opal/nodes/call_special"); self.$require("opal/nodes/module"); self.$require("opal/nodes/class"); self.$require("opal/nodes/singleton_class"); self.$require("opal/nodes/inline_args"); self.$require("opal/nodes/args/normarg"); self.$require("opal/nodes/args/optarg"); self.$require("opal/nodes/args/mlhsarg"); self.$require("opal/nodes/args/restarg"); self.$require("opal/nodes/args/kwarg"); self.$require("opal/nodes/args/kwoptarg"); self.$require("opal/nodes/args/kwrestarg"); self.$require("opal/nodes/args/post_kwargs"); self.$require("opal/nodes/args/post_args"); self.$require("opal/nodes/iter"); self.$require("opal/nodes/def"); self.$require("opal/nodes/if"); self.$require("opal/nodes/logic"); self.$require("opal/nodes/definitions"); self.$require("opal/nodes/yield"); self.$require("opal/nodes/rescue"); self.$require("opal/nodes/case"); self.$require("opal/nodes/super"); self.$require("opal/nodes/top"); self.$require("opal/nodes/while"); self.$require("opal/nodes/for"); self.$require("opal/nodes/hash"); self.$require("opal/nodes/array"); self.$require("opal/nodes/defined"); self.$require("opal/nodes/masgn"); return self.$require("opal/nodes/arglist"); }; /* Generated by Opal 0.10.4 */ Opal.modules["opal/compiler"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2, $klass = Opal.klass; Opal.add_stubs(['$require', '$compile', '$new', '$[]', '$define_method', '$fetch', '$!', '$include?', '$raise', '$+', '$inspect', '$compiler_option', '$attr_reader', '$attr_accessor', '$parse', '$file', '$message', '$backtrace', '$s', '$eof_content', '$lexer', '$flatten', '$process', '$join', '$map', '$to_proc', '$class', '$warn', '$<<', '$helpers', '$new_temp', '$queue_temp', '$push_while', '$pop_while', '$==', '$in_while?', '$fragment', '$scope', '$handlers', '$type', '$compile_to_fragments', '$returns', '$===', '$pop', '$[]=', '$>', '$length', '$=~', '$source=', '$source', '$uses_block!', '$block_name', '$find_parent_def']); self.$require("set"); self.$require("opal/parser"); self.$require("opal/fragment"); self.$require("opal/nodes"); return (function($base) { var $Opal, self = $Opal = $module($base, 'Opal'); var def = self.$$proto, $scope = self.$$scope, TMP_1; Opal.defs(self, '$compile', TMP_1 = function $$compile(source, options) { var self = this; if (options == null) { options = $hash2([], {}); } return $scope.get('Compiler').$new(source, options).$compile(); }, TMP_1.$$arity = -2); (function($base, $super) { function $Compiler(){}; var self = $Compiler = $klass($base, $super, 'Compiler', $Compiler); var def = self.$$proto, $scope = self.$$scope, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32; def.parser = def.source = def.sexp = def.fragments = def.helpers = def.operator_helpers = def.method_calls = def.indent = def.unique = def.scope = def.in_ensure = def.break_detected = def.case_stmt = def.handlers = def.requires = def.required_trees = nil; Opal.cdecl($scope, 'INDENT', " "); Opal.cdecl($scope, 'COMPARE', ["<", ">", "<=", ">="]); Opal.defs(self, '$compiler_option', TMP_4 = function $$compiler_option(name, default_value, options) { var $a, $b, TMP_2, $c, self = this, mid = nil, valid_values = nil; if (options == null) { options = $hash2([], {}); } mid = options['$[]']("as"); valid_values = options['$[]']("valid_values"); return ($a = ($b = self).$define_method, $a.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this, $c, $d, TMP_3, $e, value = nil; if (self.options == null) self.options = nil; value = ($c = ($d = self.options).$fetch, $c.$$p = (TMP_3 = function(){var self = TMP_3.$$s || this; return default_value}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3), $c).call($d, name); if ((($c = (($e = valid_values !== false && valid_values !== nil && valid_values != null) ? (valid_values['$include?'](value))['$!']() : valid_values)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { self.$raise($scope.get('ArgumentError'), $rb_plus("invalid value " + (value.$inspect()) + " for option " + (name.$inspect()) + " ", "(valid values: " + (valid_values.$inspect()) + ")"))}; return value;}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $a).call($b, ((($c = mid) !== false && $c !== nil && $c != null) ? $c : name)); }, TMP_4.$$arity = -3); self.$compiler_option("file", "(file)"); self.$compiler_option("method_missing", true, $hash2(["as"], {"as": "method_missing?"})); self.$compiler_option("arity_check", false, $hash2(["as"], {"as": "arity_check?"})); self.$compiler_option("freezing", true, $hash2(["as"], {"as": "freezing?"})); self.$compiler_option("tainting", true, $hash2(["as"], {"as": "tainting?"})); self.$compiler_option("irb", false, $hash2(["as"], {"as": "irb?"})); self.$compiler_option("dynamic_require_severity", "warning", $hash2(["valid_values"], {"valid_values": ["error", "warning", "ignore"]})); self.$compiler_option("requirable", false, $hash2(["as"], {"as": "requirable?"})); self.$compiler_option("inline_operators", true, $hash2(["as"], {"as": "inline_operators?"})); self.$compiler_option("eval", false, $hash2(["as"], {"as": "eval?"})); self.$attr_reader("result"); self.$attr_reader("fragments"); self.$attr_accessor("scope"); self.$attr_reader("case_stmt"); self.$attr_reader("eof_content"); Opal.defn(self, '$initialize', TMP_5 = function $$initialize(source, options) { var self = this; if (options == null) { options = $hash2([], {}); } self.source = source; self.indent = ""; self.unique = 0; return self.options = options; }, TMP_5.$$arity = -2); Opal.defn(self, '$compile', TMP_6 = function $$compile() { var $a, $b, self = this, parsed = nil, error = nil, message = nil; try { self.parser = $scope.get('Parser').$new(); parsed = (function() { try { return self.parser.$parse(self.source, self.$file()) } catch ($err) { if (Opal.rescue($err, [$scope.get('StandardError')])) {error = $err; try { return self.$raise($scope.get('SyntaxError'), error.$message(), error.$backtrace()) } finally { Opal.pop_exception() } } else { throw $err; } }})(); self.sexp = self.$s("top", ((($a = parsed) !== false && $a !== nil && $a != null) ? $a : self.$s("nil"))); self.eof_content = self.parser.$lexer().$eof_content(); self.fragments = self.$process(self.sexp).$flatten(); return self.result = ($a = ($b = self.fragments).$map, $a.$$p = "code".$to_proc(), $a).call($b).$join(""); } catch ($err) { if (Opal.rescue($err, [$scope.get('Exception')])) {error = $err; try { message = "An error occurred while compiling: " + (self.$file()) + "\n" + (error.$message()); return self.$raise(error.$class(), message, error.$backtrace()); } finally { Opal.pop_exception() } } else { throw $err; } }; }, TMP_6.$$arity = 0); Opal.defn(self, '$source_map', TMP_7 = function $$source_map(source_file) { var $a, self = this; if (source_file == null) { source_file = nil; } return (($scope.get('Opal')).$$scope.get('SourceMap')).$new(self.fragments, ((($a = source_file) !== false && $a !== nil && $a != null) ? $a : self.$file())); }, TMP_7.$$arity = -1); Opal.defn(self, '$helpers', TMP_8 = function $$helpers() { var $a, self = this; return ((($a = self.helpers) !== false && $a !== nil && $a != null) ? $a : self.helpers = $scope.get('Set').$new(["breaker", "slice"])); }, TMP_8.$$arity = 0); Opal.defn(self, '$operator_helpers', TMP_9 = function $$operator_helpers() { var $a, self = this; return ((($a = self.operator_helpers) !== false && $a !== nil && $a != null) ? $a : self.operator_helpers = $scope.get('Set').$new()); }, TMP_9.$$arity = 0); Opal.defn(self, '$method_calls', TMP_10 = function $$method_calls() { var $a, self = this; return ((($a = self.method_calls) !== false && $a !== nil && $a != null) ? $a : self.method_calls = $scope.get('Set').$new()); }, TMP_10.$$arity = 0); Opal.defn(self, '$error', TMP_11 = function $$error(msg, line) { var self = this; if (line == null) { line = nil; } return self.$raise($scope.get('SyntaxError'), "" + (msg) + " :" + (self.$file()) + ":" + (line)); }, TMP_11.$$arity = -2); Opal.defn(self, '$warning', TMP_12 = function $$warning(msg, line) { var self = this; if (line == null) { line = nil; } return self.$warn("WARNING: " + (msg) + " -- " + (self.$file()) + ":" + (line)); }, TMP_12.$$arity = -2); Opal.defn(self, '$parser_indent', TMP_13 = function $$parser_indent() { var self = this; return self.indent; }, TMP_13.$$arity = 0); Opal.defn(self, '$s', TMP_14 = function $$s($a_rest) { var self = this, parts; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } parts = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { parts[$arg_idx - 0] = arguments[$arg_idx]; } return $scope.get('Sexp').$new(parts); }, TMP_14.$$arity = -1); Opal.defn(self, '$fragment', TMP_15 = function $$fragment(str, scope, sexp) { var self = this; if (sexp == null) { sexp = nil; } return $scope.get('Fragment').$new(str, scope, sexp); }, TMP_15.$$arity = -3); Opal.defn(self, '$unique_temp', TMP_16 = function $$unique_temp() { var self = this; return "TMP_" + (self.unique = $rb_plus(self.unique, 1)); }, TMP_16.$$arity = 0); Opal.defn(self, '$helper', TMP_17 = function $$helper(name) { var self = this; return self.$helpers()['$<<'](name); }, TMP_17.$$arity = 1); Opal.defn(self, '$indent', TMP_18 = function $$indent() { var self = this, $iter = TMP_18.$$p, block = $iter || nil, indent = nil, res = nil; TMP_18.$$p = null; indent = self.indent; self.indent = $rb_plus(self.indent, $scope.get('INDENT')); self.space = "\n" + (self.indent); res = Opal.yieldX(block, []); self.indent = indent; self.space = "\n" + (self.indent); return res; }, TMP_18.$$arity = 0); Opal.defn(self, '$with_temp', TMP_19 = function $$with_temp() { var self = this, $iter = TMP_19.$$p, block = $iter || nil, tmp = nil, res = nil; TMP_19.$$p = null; tmp = self.scope.$new_temp(); res = Opal.yield1(block, tmp); self.scope.$queue_temp(tmp); return res; }, TMP_19.$$arity = 0); Opal.defn(self, '$in_while', TMP_20 = function $$in_while() { var self = this, $iter = TMP_20.$$p, $yield = $iter || nil, result = nil; TMP_20.$$p = null; if (($yield !== nil)) { } else { return nil }; self.while_loop = self.scope.$push_while(); result = Opal.yieldX($yield, []); self.scope.$pop_while(); return result; }, TMP_20.$$arity = 0); Opal.defn(self, '$in_ensure', TMP_21 = function $$in_ensure() { var self = this, $iter = TMP_21.$$p, $yield = $iter || nil, result = nil; TMP_21.$$p = null; if (($yield !== nil)) { } else { return nil }; self.in_ensure = true; result = Opal.yieldX($yield, []); self.in_ensure = false; return result; }, TMP_21.$$arity = 0); Opal.defn(self, '$in_ensure?', TMP_22 = function() { var self = this; return self.in_ensure; }, TMP_22.$$arity = 0); Opal.defn(self, '$has_break?', TMP_23 = function() { var self = this, $iter = TMP_23.$$p, $yield = $iter || nil, result = nil, detected = nil; TMP_23.$$p = null; if (($yield !== nil)) { } else { return self.break_detected }; self.break_detected = false; result = Opal.yieldX($yield, []); detected = self.break_detected; self.break_detected = nil; return detected; }, TMP_23.$$arity = 0); Opal.defn(self, '$has_break!', TMP_24 = function() { var self = this; if (self.break_detected['$=='](false)) { return self.break_detected = true } else { return nil }; }, TMP_24.$$arity = 0); Opal.defn(self, '$in_case', TMP_25 = function $$in_case() { var self = this, $iter = TMP_25.$$p, $yield = $iter || nil, old = nil; TMP_25.$$p = null; if (($yield !== nil)) { } else { return nil }; old = self.case_stmt; self.case_stmt = $hash2([], {}); Opal.yieldX($yield, []); return self.case_stmt = old; }, TMP_25.$$arity = 0); Opal.defn(self, '$in_while?', TMP_26 = function() { var self = this; return self.scope['$in_while?'](); }, TMP_26.$$arity = 0); Opal.defn(self, '$process', TMP_27 = function $$process(sexp, level) { var $a, self = this, handler = nil; if (level == null) { level = "expr"; } if (sexp['$=='](nil)) { return self.$fragment("", self.$scope())}; if ((($a = handler = self.$handlers()['$[]'](sexp.$type())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return handler.$new(sexp, level, self).$compile_to_fragments() } else { return self.$raise("Unsupported sexp: " + (sexp.$type())) }; }, TMP_27.$$arity = -2); Opal.defn(self, '$handlers', TMP_28 = function $$handlers() { var $a, self = this; return ((($a = self.handlers) !== false && $a !== nil && $a != null) ? $a : self.handlers = (((($scope.get('Opal')).$$scope.get('Nodes'))).$$scope.get('Base')).$handlers()); }, TMP_28.$$arity = 0); Opal.defn(self, '$requires', TMP_29 = function $$requires() { var $a, self = this; return ((($a = self.requires) !== false && $a !== nil && $a != null) ? $a : self.requires = []); }, TMP_29.$$arity = 0); Opal.defn(self, '$required_trees', TMP_30 = function $$required_trees() { var $a, self = this; return ((($a = self.required_trees) !== false && $a !== nil && $a != null) ? $a : self.required_trees = []); }, TMP_30.$$arity = 0); Opal.defn(self, '$returns', TMP_31 = function $$returns(sexp) { var $a, $b, self = this, $case = nil, last = nil, return_sexp = nil; if (sexp !== false && sexp !== nil && sexp != null) { } else { return self.$returns(self.$s("nil")) }; return (function() {$case = sexp.$type();if ("undef"['$===']($case)) {last = sexp.$pop(); return sexp['$<<'](self.$returns(last));}else if ("break"['$===']($case) || "next"['$===']($case) || "redo"['$===']($case)) {return sexp}else if ("yield"['$===']($case)) {sexp['$[]='](0, "returnable_yield"); return sexp;}else if ("scope"['$===']($case)) {sexp['$[]='](1, self.$returns(sexp['$[]'](1))); return sexp;}else if ("block"['$===']($case)) {if ((($a = $rb_gt(sexp.$length(), 1)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { sexp['$[]='](-1, self.$returns(sexp['$[]'](-1))) } else { sexp['$<<'](self.$returns(self.$s("nil"))) }; return sexp;}else if ("when"['$===']($case)) {sexp['$[]='](2, self.$returns(sexp['$[]'](2))); return sexp;}else if ("rescue"['$===']($case)) {sexp['$[]='](1, self.$returns(sexp['$[]'](1))); if ((($a = ($b = sexp['$[]'](2), $b !== false && $b !== nil && $b != null ?sexp['$[]'](2)['$[]'](0)['$==']("resbody") : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { if ((($a = sexp['$[]'](2)['$[]'](2)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { sexp['$[]'](2)['$[]='](2, self.$returns(sexp['$[]'](2)['$[]'](2))) } else { sexp['$[]'](2)['$[]='](2, self.$returns(self.$s("nil"))) }}; return sexp;}else if ("ensure"['$===']($case)) {sexp['$[]='](1, self.$returns(sexp['$[]'](1))); return sexp;}else if ("begin"['$===']($case)) {sexp['$[]='](1, self.$returns(sexp['$[]'](1))); return sexp;}else if ("rescue_mod"['$===']($case)) {sexp['$[]='](1, self.$returns(sexp['$[]'](1))); sexp['$[]='](2, self.$returns(sexp['$[]'](2))); return sexp;}else if ("while"['$===']($case)) {return sexp}else if ("return"['$===']($case) || "js_return"['$===']($case)) {return sexp}else if ("xstr"['$===']($case)) {if ((($a = /return|;/['$=~'](sexp['$[]'](1))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { sexp['$[]='](1, "return " + (sexp['$[]'](1)) + ";") }; return sexp;}else if ("dxstr"['$===']($case)) {if ((($a = /return|;|\n/['$=~'](sexp['$[]'](1))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { sexp['$[]='](1, "return " + (sexp['$[]'](1))) }; return sexp;}else if ("if"['$===']($case)) {sexp['$[]='](2, self.$returns(((($a = sexp['$[]'](2)) !== false && $a !== nil && $a != null) ? $a : self.$s("nil")))); sexp['$[]='](3, self.$returns(((($a = sexp['$[]'](3)) !== false && $a !== nil && $a != null) ? $a : self.$s("nil")))); return sexp;}else {return_sexp = self.$s("js_return", sexp); (($a = [sexp.$source()]), $b = return_sexp, $b['$source='].apply($b, $a), $a[$a.length-1]); return return_sexp;}})(); }, TMP_31.$$arity = 1); return (Opal.defn(self, '$handle_block_given_call', TMP_32 = function $$handle_block_given_call(sexp) { var $a, $b, self = this, scope = nil; self.scope['$uses_block!'](); if ((($a = self.scope.$block_name()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$fragment("(" + (self.scope.$block_name()) + " !== nil)", self.$scope(), sexp) } else if ((($a = ($b = scope = self.scope.$find_parent_def(), $b !== false && $b !== nil && $b != null ?scope.$block_name() : $b)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.$fragment("(" + (scope.$block_name()) + " !== nil)", scope, sexp) } else { return self.$fragment("false", scope, sexp) }; }, TMP_32.$$arity = 1), nil) && 'handle_block_given_call'; })($scope.base, null); })($scope.base); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/array/wrap"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$nil?', '$respond_to?', '$to_ary']); return (function($base, $super) { function $Array(){}; var self = $Array = $klass($base, $super, 'Array', $Array); var def = self.$$proto, $scope = self.$$scope, TMP_1; return (Opal.defs(self, '$wrap', TMP_1 = function $$wrap(object) { var $a, self = this; if ((($a = object['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return [] } else if ((($a = object['$respond_to?']("to_ary")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return ((($a = object.$to_ary()) !== false && $a !== nil && $a != null) ? $a : [object]) } else { return [object] }; }, TMP_1.$$arity = 1), nil) && 'wrap' })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/array/grouping"] = function(Opal) { function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } function $rb_gt(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$==', '$%', '$-', '$size', '$concat', '$dup', '$*', '$each_slice', '$<<', '$div', '$times', '$+', '$>', '$slice', '$!=', '$each', '$inject', '$call', '$last']); return (function($base, $super) { function $Array(){}; var self = $Array = $klass($base, $super, 'Array', $Array); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_5, TMP_7; Opal.defn(self, '$in_groups_of', TMP_1 = function $$in_groups_of(number, fill_with) { var $a, $b, TMP_2, $c, TMP_3, self = this, $iter = TMP_1.$$p, $yield = $iter || nil, collection = nil, padding = nil, groups = nil; if (fill_with == null) { fill_with = nil; } TMP_1.$$p = null; if (fill_with['$=='](false)) { collection = self } else { padding = ($rb_minus(number, self.$size()['$%'](number)))['$%'](number); collection = self.$dup().$concat($rb_times([fill_with], padding)); }; if (($yield !== nil)) { return ($a = ($b = collection).$each_slice, $a.$$p = (TMP_2 = function(slice){var self = TMP_2.$$s || this; if (slice == null) slice = nil; return Opal.yield1($yield, slice);}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($b, number) } else { groups = []; ($a = ($c = collection).$each_slice, $a.$$p = (TMP_3 = function(group){var self = TMP_3.$$s || this; if (group == null) group = nil; return groups['$<<'](group)}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $a).call($c, number); return groups; }; }, TMP_1.$$arity = -2); Opal.defn(self, '$in_groups', TMP_5 = function $$in_groups(number, fill_with) { var $a, $b, TMP_4, $c, TMP_6, self = this, $iter = TMP_5.$$p, $yield = $iter || nil, division = nil, modulo = nil, groups = nil, start = nil; if (fill_with == null) { fill_with = nil; } TMP_5.$$p = null; division = self.$size().$div(number); modulo = self.$size()['$%'](number); groups = []; start = 0; ($a = ($b = number).$times, $a.$$p = (TMP_4 = function(index){var self = TMP_4.$$s || this, $c, $d, $e, length = nil, last_group = nil; if (index == null) index = nil; length = $rb_plus(division, ((function() {if ((($c = ($d = $rb_gt(modulo, 0), $d !== false && $d !== nil && $d != null ?$rb_gt(modulo, index) : $d)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { return 1 } else { return 0 }; return nil; })())); groups['$<<'](last_group = self.$slice(start, length)); if ((($c = ($d = ($e = fill_with['$!='](false), $e !== false && $e !== nil && $e != null ?$rb_gt(modulo, 0) : $e), $d !== false && $d !== nil && $d != null ?length['$=='](division) : $d)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { last_group['$<<'](fill_with)}; return start = $rb_plus(start, length);}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $a).call($b); if (($yield !== nil)) { return ($a = ($c = groups).$each, $a.$$p = (TMP_6 = function(g){var self = TMP_6.$$s || this; if (g == null) g = nil; return Opal.yield1($yield, g);}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $a).call($c) } else { return groups }; }, TMP_5.$$arity = -2); return (Opal.defn(self, '$split', TMP_7 = function $$split(value) { var $a, $b, TMP_8, self = this, $iter = TMP_7.$$p, block = $iter || nil; if (value == null) { value = nil; } TMP_7.$$p = null; return ($a = ($b = self).$inject, $a.$$p = (TMP_8 = function(results, element){var self = TMP_8.$$s || this, $c, $d, $e; if (results == null) results = nil;if (element == null) element = nil; if ((($c = ((($d = (($e = block !== false && block !== nil && block != null) ? block.$call(element) : block)) !== false && $d !== nil && $d != null) ? $d : value['$=='](element))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { results['$<<']([]) } else { results.$last()['$<<'](element) }; return results;}, TMP_8.$$s = self, TMP_8.$$arity = 2, TMP_8), $a).call($b, [[]]); }, TMP_7.$$arity = -1), nil) && 'split'; })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/array"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); self.$require("active_support/core_ext/array/extract_options"); self.$require("active_support/core_ext/array/wrap"); return self.$require("active_support/core_ext/array/grouping"); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/class"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); return self.$require("active_support/core_ext/class/attribute") }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/enumerable"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$enum_for', '$new', '$destructure', '$[]=']); return (function($base) { var $Enumerable, self = $Enumerable = $module($base, 'Enumerable'); var def = self.$$proto, $scope = self.$$scope, TMP_1; Opal.defn(self, '$index_by', TMP_1 = function $$index_by() { var self = this, $iter = TMP_1.$$p, block = $iter || nil, hash = nil; TMP_1.$$p = null; if ((block !== nil)) { } else { return self.$enum_for("index_by") }; hash = $scope.get('Hash').$new(); var result; self.$each._p = function() { var param = $scope.get('Opal').$destructure(arguments), value = $opal.$yield1(block, param); if (value === $breaker) { result = $breaker.$v; return $breaker; } hash['$[]='](value, param); } self.$each(); if (result !== undefined) { return result; } return hash; }, TMP_1.$$arity = 0) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/hash"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); return self.$require("active_support/core_ext/hash/indifferent_access") }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/numeric/time"] = function(Opal) { function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } function $rb_minus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); } function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$*', '$hours', '$days', '$weeks', '$-', '$current', '$+']); return (function($base, $super) { function $Numeric(){}; var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8; Opal.defn(self, '$seconds', TMP_1 = function $$seconds() { var self = this; return self; }, TMP_1.$$arity = 0); Opal.alias(self, 'second', 'seconds'); Opal.defn(self, '$minutes', TMP_2 = function $$minutes() { var self = this; return $rb_times(self, 60); }, TMP_2.$$arity = 0); Opal.alias(self, 'minute', 'minutes'); Opal.defn(self, '$hours', TMP_3 = function $$hours() { var self = this; return $rb_times(self, 3600); }, TMP_3.$$arity = 0); Opal.alias(self, 'hour', 'hours'); Opal.defn(self, '$days', TMP_4 = function $$days() { var self = this; return $rb_times(self, (24).$hours()); }, TMP_4.$$arity = 0); Opal.alias(self, 'day', 'days'); Opal.defn(self, '$weeks', TMP_5 = function $$weeks() { var self = this; return $rb_times(self, (7).$days()); }, TMP_5.$$arity = 0); Opal.alias(self, 'week', 'weeks'); Opal.defn(self, '$fortnights', TMP_6 = function $$fortnights() { var self = this; return $rb_times(self, (2).$weeks()); }, TMP_6.$$arity = 0); Opal.alias(self, 'fortnight', 'fortnights'); Opal.defn(self, '$ago', TMP_7 = function $$ago(time) { var self = this; if (time == null) { time = Opal.get('Time').$current(); } return $rb_minus(time, self); }, TMP_7.$$arity = -1); Opal.alias(self, 'until', 'ago'); Opal.defn(self, '$since', TMP_8 = function $$since(time) { var self = this; if (time == null) { time = Opal.get('Time').$current(); } return $rb_plus(time, self); }, TMP_8.$$arity = -1); return Opal.alias(self, 'from_now', 'since'); })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/integer/time"] = function(Opal) { function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$require', '$*', '$days']); self.$require("active_support/core_ext/numeric/time"); return (function($base, $super) { function $Numeric(){}; var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2; Opal.defn(self, '$months', TMP_1 = function $$months() { var self = this; return $rb_times(self, (30).$days()); }, TMP_1.$$arity = 0); Opal.alias(self, 'month', 'months'); Opal.defn(self, '$years', TMP_2 = function $$years() { var self = this; return $rb_times(self, (365.25).$days()); }, TMP_2.$$arity = 0); return Opal.alias(self, 'year', 'years'); })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/integer"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); return self.$require("active_support/core_ext/integer/time") }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/kernel"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); return self.$require("active_support/core_ext/kernel/singleton_class") }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/module/introspection"] = function(Opal) { function $rb_times(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $gvars = Opal.gvars; Opal.add_stubs(['$require', '$=~', '$name', '$freeze', '$parent_name', '$constantize', '$split', '$empty?', '$<<', '$*', '$pop', '$include?', '$constants']); self.$require("active_support/inflector"); return (function($base, $super) { function $Module(){}; var self = $Module = $klass($base, $super, 'Module', $Module); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4; def.parent_name = nil; Opal.defn(self, '$parent_name', TMP_1 = function $$parent_name() { var $a, $b, self = this; if ((($a = (($b = self['parent_name'], $b != null && $b !== nil) ? 'instance-variable' : nil)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self.parent_name } else { return self.parent_name = (function() {if ((($a = self.$name()['$=~'](/::[^:]+$/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($a = $gvars['~']) === nil ? nil : $a.$pre_match()).$freeze() } else { return nil }; return nil; })() }; }, TMP_1.$$arity = 0); Opal.defn(self, '$parent', TMP_2 = function $$parent() { var $a, self = this; if ((($a = self.$parent_name()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return (($scope.get('ActiveSupport')).$$scope.get('Inflector')).$constantize(self.$parent_name()) } else { return $scope.get('Object') }; }, TMP_2.$$arity = 0); Opal.defn(self, '$parents', TMP_3 = function $$parents() { var $a, $b, self = this, parents = nil, parts = nil; parents = []; if ((($a = self.$parent_name()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { parts = self.$parent_name().$split("::"); while (!((($b = parts['$empty?']()) !== nil && $b != null && (!$b.$$is_boolean || $b == true)))) { parents['$<<']((($scope.get('ActiveSupport')).$$scope.get('Inflector')).$constantize($rb_times(parts, "::"))); parts.$pop();};}; if ((($a = parents['$include?']($scope.get('Object'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { } else { parents['$<<']($scope.get('Object')) }; return parents; }, TMP_3.$$arity = 0); return (Opal.defn(self, '$local_constants', TMP_4 = function $$local_constants() { var self = this; return self.$constants(false); }, TMP_4.$$arity = 0), nil) && 'local_constants'; })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/module/delegation"] = function(Opal) { function $rb_plus(lhs, rhs) { return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); } var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $range = Opal.range; Opal.add_stubs(['$pop', '$is_a?', '$[]', '$raise', '$values_at', '$==', '$=~', '$to_s', '$each', '$+', '$lambda', '$start_with?', '$__send__', '$new', '$inspect', '$define_method', '$to_proc']); return (function($base, $super) { function $Module(){}; var self = $Module = $klass($base, $super, 'Module', $Module); var def = self.$$proto, $scope = self.$$scope, TMP_6; (function($base, $super) { function $DelegationError(){}; var self = $DelegationError = $klass($base, $super, 'DelegationError', $DelegationError); var def = self.$$proto, $scope = self.$$scope; return nil; })($scope.base, $scope.get('NoMethodError')); return (Opal.defn(self, '$delegate', TMP_6 = function $$delegate($a_rest) { var $b, $c, TMP_1, self = this, methods, options = nil, to = nil, prefix = nil, allow_nil = nil, method_prefix = nil; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } methods = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { methods[$arg_idx - 0] = arguments[$arg_idx]; } options = methods.$pop(); if ((($b = ($c = options['$is_a?']($scope.get('Hash')), $c !== false && $c !== nil && $c != null ?to = options['$[]']("to") : $c)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { } else { self.$raise($scope.get('ArgumentError'), "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, to: :greeter).") }; $c = options.$values_at("prefix", "allow_nil"), $b = Opal.to_ary($c), prefix = ($b[0] == null ? nil : $b[0]), allow_nil = ($b[1] == null ? nil : $b[1]), $c; if ((($b = (($c = prefix['$=='](true)) ? to['$=~'](/^[^a-z_]/) : prefix['$=='](true))) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) { self.$raise($scope.get('ArgumentError'), "Can only automatically set the delegation prefix when delegating to a method.")}; method_prefix = (function() {if (prefix !== false && prefix !== nil && prefix != null) { return "" + ((function() {if (prefix['$=='](true)) { return to } else { return prefix }; return nil; })()) + "_" } else { return "" }; return nil; })(); to = to.$to_s(); return ($b = ($c = methods).$each, $b.$$p = (TMP_1 = function(method){var self = TMP_1.$$s || this, $a, $d, TMP_2, $e, TMP_3, $f, TMP_4, $g, TMP_5, has_block = nil, method_name = nil, resolve_to = nil, exception = nil; if (method == null) method = nil; has_block = (function() {if ((($a = (method['$=~'](/[^\]]=$/))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return false } else { return true }; return nil; })(); method_name = $rb_plus(method_prefix, method); resolve_to = ($a = ($d = self).$lambda, $a.$$p = (TMP_2 = function(scope){var self = TMP_2.$$s || this, $e, ivar_name = nil; if (scope == null) scope = nil; if ((($e = to['$start_with?']("@")) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) { ivar_name = to['$[]']($range(1, -1, false)); return scope[ivar_name]; } else { return scope.$__send__(to) }}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($d); exception = ($a = ($e = self).$lambda, $a.$$p = (TMP_3 = function(scope){var self = TMP_3.$$s || this; if (scope == null) scope = nil; return $scope.get('DelegationError').$new("" + (scope) + (method_name) + " delegated to " + (to) + "." + (method) + " but " + (to) + " is nil: " + (scope.$inspect()), method_name)}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3), $a).call($e); if (has_block !== false && has_block !== nil && has_block != null) { return ($a = ($f = self).$define_method, $a.$$p = (TMP_4 = function($g_rest){var self = TMP_4.$$s || this, block, args, $h, $i, to_resolved = nil; block = TMP_4.$$p || nil, TMP_4.$$p = null; var $args_len = arguments.length, $rest_len = $args_len - 0; if ($rest_len < 0) { $rest_len = 0; } args = new Array($rest_len); for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) { args[$arg_idx - 0] = arguments[$arg_idx]; } to_resolved = resolve_to['$[]'](self); if (to_resolved !== false && to_resolved !== nil && to_resolved != null) { } else { if (allow_nil !== false && allow_nil !== nil && allow_nil != null) { return nil;}; self.$raise(exception['$[]'](self)); }; return ($h = ($i = to_resolved).$__send__, $h.$$p = block.$to_proc(), $h).apply($i, [method].concat(Opal.to_a(args)));}, TMP_4.$$s = self, TMP_4.$$arity = -1, TMP_4), $a).call($f, method_name) } else { return ($a = ($g = self).$define_method, $a.$$p = (TMP_5 = function(arg){var self = TMP_5.$$s || this, to_resolved = nil; if (arg == null) arg = nil; to_resolved = resolve_to['$[]'](self); if (to_resolved !== false && to_resolved !== nil && to_resolved != null) { } else { if (allow_nil !== false && allow_nil !== nil && allow_nil != null) { return nil;}; self.$raise(exception['$[]'](self)); }; return to_resolved.$__send__(method, arg);}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5), $a).call($g, method_name) };}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $b).call($c); }, TMP_6.$$arity = -1), nil) && 'delegate'; })($scope.base, null) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/module"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); self.$require("active_support/core_ext/module/introspection"); self.$require("active_support/core_ext/module/remove_method"); return self.$require("active_support/core_ext/module/delegation"); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/numeric/calculations"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; return (function(self) { var $scope = self.$$scope, def = self.$$proto; return Opal.alias(self, 'current', 'now') })(Opal.get_singleton_class($scope.get('Time'))) }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/numeric"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); self.$require("active_support/core_ext/numeric/time"); return self.$require("active_support/core_ext/numeric/calculations"); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/object/blank"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; Opal.add_stubs(['$respond_to?', '$empty?', '$!', '$blank?', '$present?', '$==', '$alias_method', '$!~']); (function($base, $super) { function $Object(){}; var self = $Object = $klass($base, $super, 'Object', $Object); var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3; Opal.defn(self, '$blank?', TMP_1 = function() { var $a, self = this; if ((($a = self['$respond_to?']("empty?")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self['$empty?']() } else { return self['$!']() }; }, TMP_1.$$arity = 0); Opal.defn(self, '$present?', TMP_2 = function() { var self = this; return self['$blank?']()['$!'](); }, TMP_2.$$arity = 0); return (Opal.defn(self, '$presence', TMP_3 = function $$presence() { var $a, self = this; if ((($a = self['$present?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { return self } else { return nil }; }, TMP_3.$$arity = 0), nil) && 'presence'; })($scope.base, null); (function($base, $super) { function $NilClass(){}; var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); var def = self.$$proto, $scope = self.$$scope, TMP_4; return (Opal.defn(self, '$blank?', TMP_4 = function() { var self = this; return true; }, TMP_4.$$arity = 0), nil) && 'blank?' })($scope.base, null); (function($base, $super) { function $Boolean(){}; var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean); var def = self.$$proto, $scope = self.$$scope, TMP_5; return (Opal.defn(self, '$blank?', TMP_5 = function() { var self = this; return self['$=='](false); }, TMP_5.$$arity = 0), nil) && 'blank?' })($scope.base, null); (function($base, $super) { function $Array(){}; var self = $Array = $klass($base, $super, 'Array', $Array); var def = self.$$proto, $scope = self.$$scope; return self.$alias_method("blank?", "empty?") })($scope.base, null); (function($base, $super) { function $Hash(){}; var self = $Hash = $klass($base, $super, 'Hash', $Hash); var def = self.$$proto, $scope = self.$$scope; return self.$alias_method("blank?", "empty?") })($scope.base, null); (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); var def = self.$$proto, $scope = self.$$scope, TMP_6; return (Opal.defn(self, '$blank?', TMP_6 = function() { var self = this; return self['$!~'](/[^\s ]/); }, TMP_6.$$arity = 0), nil) && 'blank?' })($scope.base, null); return (function($base, $super) { function $Numeric(){}; var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); var def = self.$$proto, $scope = self.$$scope, TMP_7; return (Opal.defn(self, '$blank?', TMP_7 = function() { var self = this; return false; }, TMP_7.$$arity = 0), nil) && 'blank?' })($scope.base, null); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext/object"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); self.$require("active_support/core_ext/object/blank"); return self.$require("active_support/core_ext/object/try"); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support/core_ext"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); self.$require("active_support/core_ext/array"); self.$require("active_support/core_ext/class"); self.$require("active_support/core_ext/enumerable"); self.$require("active_support/core_ext/hash"); self.$require("active_support/core_ext/integer"); self.$require("active_support/core_ext/kernel"); self.$require("active_support/core_ext/module"); self.$require("active_support/core_ext/numeric"); self.$require("active_support/core_ext/object"); return self.$require("active_support/core_ext/string"); }; /* Generated by Opal 0.10.4 */ Opal.modules["active_support"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; Opal.add_stubs(['$require']); return self.$require("active_support/core_ext") }; /* Generated by Opal 0.10.4 */ Opal.modules["securerandom"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; Opal.add_stubs(['$gsub']); return (function($base) { var $SecureRandom, self = $SecureRandom = $module($base, 'SecureRandom'); var def = self.$$proto, $scope = self.$$scope, TMP_2; Opal.defs(self, '$uuid', TMP_2 = function $$uuid() { var $a, $b, TMP_1, self = this; return ($a = ($b = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx").$gsub, $a.$$p = (TMP_1 = function(ch){var self = TMP_1.$$s || this; if (ch == null) ch = nil; var r = Math.random() * 16 | 0, v = ch == "x" ? r : (r & 3 | 8); return v.toString(16); }, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1.$$has_trailing_comma_in_args = true, TMP_1), $a).call($b, /[xy]/); }, TMP_2.$$arity = 0) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyperloop/console/evaluate"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; Opal.add_stubs(['$param', '$dispatch_to']); return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Console, self = $Console = $module($base, 'Console'); var def = self.$$proto, $scope = self.$$scope; (function($base, $super) { function $Evaluate(){}; var self = $Evaluate = $klass($base, $super, 'Evaluate', $Evaluate); var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_1; self.$param($hash2(["acting_user", "nils"], {"acting_user": nil, "nils": true})); self.$param("target_id"); self.$param("sender_id"); self.$param("context"); self.$param($hash2(["string"], {"string": nil})); return ($a = ($b = self).$dispatch_to, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this; return (($scope.get('Hyperloop')).$$scope.get('Application'))}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b); })($scope.base, (($scope.get('Hyperloop')).$$scope.get('ServerOp'))); (function($base, $super) { function $Response(){}; var self = $Response = $klass($base, $super, 'Response', $Response); var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_2; self.$param($hash2(["acting_user", "nils"], {"acting_user": nil, "nils": true})); self.$param("target_id"); self.$param("kind"); self.$param("message"); return ($a = ($b = self).$dispatch_to, $a.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this; return (($scope.get('Hyperloop')).$$scope.get('Application'))}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $a).call($b); })($scope.base, (($scope.get('Hyperloop')).$$scope.get('ServerOp'))); })($scope.base) })($scope.base) }; /* Generated by Opal 0.10.4 */ Opal.modules["hyperloop/console/version"] = function(Opal) { var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; return (function($base) { var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop'); var def = self.$$proto, $scope = self.$$scope; (function($base) { var $Console, self = $Console = $module($base, 'Console'); var def = self.$$proto, $scope = self.$$scope; Opal.cdecl($scope, 'VERSION', "0.1.4") })($scope.base) })($scope.base) }; // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE // This is CodeMirror (http://codemirror.net), a code editor // implemented in JavaScript on top of the browser's DOM. // // You can find some technical background for some of the code below // at http://marijnhaverbeke.nl/blog/#cm-internals . (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.CodeMirror = factory()); }(this, (function () { 'use strict'; // Kludges for bugs and behavior differences that can't be feature // detected are enabled based on userAgent etc sniffing. var userAgent = navigator.userAgent var platform = navigator.platform var gecko = /gecko\/\d/i.test(userAgent) var ie_upto10 = /MSIE \d/.test(userAgent) var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent) var edge = /Edge\/(\d+)/.exec(userAgent) var ie = ie_upto10 || ie_11up || edge var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]) var webkit = !edge && /WebKit\//.test(userAgent) var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent) var chrome = !edge && /Chrome\//.test(userAgent) var presto = /Opera\//.test(userAgent) var safari = /Apple Computer/.test(navigator.vendor) var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent) var phantom = /PhantomJS/.test(userAgent) var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent) // This is woefully incomplete. Suggestions for alternative methods welcome. var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent) var mac = ios || /Mac/.test(platform) var chromeOS = /\bCrOS\b/.test(userAgent) var windows = /win/i.test(platform) var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/) if (presto_version) { presto_version = Number(presto_version[1]) } if (presto_version && presto_version >= 15) { presto = false; webkit = true } // Some browsers use the wrong event properties to signal cmd/ctrl on OS X var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11)) var captureRightClick = gecko || (ie && ie_version >= 9) function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") } var rmClass = function(node, cls) { var current = node.className var match = classTest(cls).exec(current) if (match) { var after = current.slice(match.index + match[0].length) node.className = current.slice(0, match.index) + (after ? match[1] + after : "") } } function removeChildren(e) { for (var count = e.childNodes.length; count > 0; --count) { e.removeChild(e.firstChild) } return e } function removeChildrenAndAdd(parent, e) { return removeChildren(parent).appendChild(e) } function elt(tag, content, className, style) { var e = document.createElement(tag) if (className) { e.className = className } if (style) { e.style.cssText = style } if (typeof content == "string") { e.appendChild(document.createTextNode(content)) } else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]) } } return e } var range if (document.createRange) { range = function(node, start, end, endNode) { var r = document.createRange() r.setEnd(endNode || node, end) r.setStart(node, start) return r } } else { range = function(node, start, end) { var r = document.body.createTextRange() try { r.moveToElementText(node.parentNode) } catch(e) { return r } r.collapse(true) r.moveEnd("character", end) r.moveStart("character", start) return r } } function contains(parent, child) { if (child.nodeType == 3) // Android browser always returns false when child is a textnode { child = child.parentNode } if (parent.contains) { return parent.contains(child) } do { if (child.nodeType == 11) { child = child.host } if (child == parent) { return true } } while (child = child.parentNode) } function activeElt() { // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement. // IE < 10 will throw when accessed while the page is loading or in an iframe. // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable. var activeElement try { activeElement = document.activeElement } catch(e) { activeElement = document.body || null } while (activeElement && activeElement.root && activeElement.root.activeElement) { activeElement = activeElement.root.activeElement } return activeElement } function addClass(node, cls) { var current = node.className if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls } } function joinClasses(a, b) { var as = a.split(" ") for (var i = 0; i < as.length; i++) { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i] } } return b } var selectInput = function(node) { node.select() } if (ios) // Mobile Safari apparently has a bug where select() is broken. { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length } } else if (ie) // Suppress mysterious IE10 errors { selectInput = function(node) { try { node.select() } catch(_e) {} } } function bind(f) { var args = Array.prototype.slice.call(arguments, 1) return function(){return f.apply(null, args)} } function copyObj(obj, target, overwrite) { if (!target) { target = {} } for (var prop in obj) { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop))) { target[prop] = obj[prop] } } return target } // Counts the column offset in a string, taking tabs into account. // Used mostly to find indentation. function countColumn(string, end, tabSize, startIndex, startValue) { if (end == null) { end = string.search(/[^\s\u00a0]/) if (end == -1) { end = string.length } } for (var i = startIndex || 0, n = startValue || 0;;) { var nextTab = string.indexOf("\t", i) if (nextTab < 0 || nextTab >= end) { return n + (end - i) } n += nextTab - i n += tabSize - (n % tabSize) i = nextTab + 1 } } var Delayed = function() {this.id = null}; Delayed.prototype.set = function (ms, f) { clearTimeout(this.id) this.id = setTimeout(f, ms) }; function indexOf(array, elt) { for (var i = 0; i < array.length; ++i) { if (array[i] == elt) { return i } } return -1 } // Number of pixels added to scroller and sizer to hide scrollbar var scrollerGap = 30 // Returned or thrown by various protocols to signal 'I'm not // handling this'. var Pass = {toString: function(){return "CodeMirror.Pass"}} // Reused option objects for setSelection & friends var sel_dontScroll = {scroll: false}; var sel_mouse = {origin: "*mouse"}; var sel_move = {origin: "+move"}; // The inverse of countColumn -- find the offset that corresponds to // a particular column. function findColumn(string, goal, tabSize) { for (var pos = 0, col = 0;;) { var nextTab = string.indexOf("\t", pos) if (nextTab == -1) { nextTab = string.length } var skipped = nextTab - pos if (nextTab == string.length || col + skipped >= goal) { return pos + Math.min(skipped, goal - col) } col += nextTab - pos col += tabSize - (col % tabSize) pos = nextTab + 1 if (col >= goal) { return pos } } } var spaceStrs = [""] function spaceStr(n) { while (spaceStrs.length <= n) { spaceStrs.push(lst(spaceStrs) + " ") } return spaceStrs[n] } function lst(arr) { return arr[arr.length-1] } function map(array, f) { var out = [] for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i) } return out } function insertSorted(array, value, score) { var pos = 0, priority = score(value) while (pos < array.length && score(array[pos]) <= priority) { pos++ } array.splice(pos, 0, value) } function nothing() {} function createObj(base, props) { var inst if (Object.create) { inst = Object.create(base) } else { nothing.prototype = base inst = new nothing() } if (props) { copyObj(props, inst) } return inst } var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/ function isWordCharBasic(ch) { return /\w/.test(ch) || ch > "\x80" && (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)) } function isWordChar(ch, helper) { if (!helper) { return isWordCharBasic(ch) } if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true } return helper.test(ch) } function isEmpty(obj) { for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } } return true } // Extending unicode characters. A series of a non-extending char + // any number of extending chars is treated as a single unit as far // as editing and measuring is concerned. This is not fully correct, // since some scripts/fonts/browsers also treat other configurations // of code points as a group. var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/ function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) } // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range. function skipExtendingChars(str, pos, dir) { while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir } return pos } // Returns the value from the range [`from`; `to`] that satisfies // `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`. function findFirst(pred, from, to) { for (;;) { if (Math.abs(from - to) <= 1) { return pred(from) ? from : to } var mid = Math.floor((from + to) / 2) if (pred(mid)) { to = mid } else { from = mid } } } // The display handles the DOM integration, both for input reading // and content drawing. It holds references to DOM nodes and // display-related state. function Display(place, doc, input) { var d = this this.input = input // Covers bottom-right square when both scrollbars are present. d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler") d.scrollbarFiller.setAttribute("cm-not-content", "true") // Covers bottom of gutter when coverGutterNextToScrollbar is on // and h scrollbar is present. d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler") d.gutterFiller.setAttribute("cm-not-content", "true") // Will contain the actual code, positioned to cover the viewport. d.lineDiv = elt("div", null, "CodeMirror-code") // Elements are added to these to represent selection and cursors. d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1") d.cursorDiv = elt("div", null, "CodeMirror-cursors") // A visibility: hidden element used to find the size of things. d.measure = elt("div", null, "CodeMirror-measure") // When lines outside of the viewport are measured, they are drawn in this. d.lineMeasure = elt("div", null, "CodeMirror-measure") // Wraps everything that needs to exist inside the vertically-padded coordinate system d.lineSpace = elt("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], null, "position: relative; outline: none") // Moved around its parent to cover visible view. d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative") // Set to the height of the document, allowing scrolling. d.sizer = elt("div", [d.mover], "CodeMirror-sizer") d.sizerWidth = null // Behavior of elts with overflow: auto and padding is // inconsistent across browsers. This is used to ensure the // scrollable area is big enough. d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;") // Will contain the gutters, if any. d.gutters = elt("div", null, "CodeMirror-gutters") d.lineGutter = null // Actual scrollable element. d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll") d.scroller.setAttribute("tabIndex", "-1") // The element in which the editor lives. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror") // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0 } if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true } if (place) { if (place.appendChild) { place.appendChild(d.wrapper) } else { place(d.wrapper) } } // Current rendered range (may be bigger than the view window). d.viewFrom = d.viewTo = doc.first d.reportedViewFrom = d.reportedViewTo = doc.first // Information about the rendered lines. d.view = [] d.renderedView = null // Holds info about a single rendered line when it was rendered // for measurement, while not in view. d.externalMeasured = null // Empty space (in pixels) above the view d.viewOffset = 0 d.lastWrapHeight = d.lastWrapWidth = 0 d.updateLineNumbers = null d.nativeBarWidth = d.barHeight = d.barWidth = 0 d.scrollbarsClipped = false // Used to only resize the line number gutter when necessary (when // the amount of lines crosses a boundary that makes its width change) d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null // Set to true when a non-horizontal-scrolling line widget is // added. As an optimization, line widget aligning is skipped when // this is false. d.alignWidgets = false d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null // Tracks the maximum line length so that the horizontal scrollbar // can be kept static when scrolling. d.maxLine = null d.maxLineLength = 0 d.maxLineChanged = false // Used for measuring wheel scrolling granularity d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null // True when shift is held down. d.shift = false // Used to track whether anything happened since the context menu // was opened. d.selForContextMenu = null d.activeTouch = null input.init(d) } // Find the line object corresponding to the given line number. function getLine(doc, n) { n -= doc.first if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") } var chunk = doc while (!chunk.lines) { for (var i = 0;; ++i) { var child = chunk.children[i], sz = child.chunkSize() if (n < sz) { chunk = child; break } n -= sz } } return chunk.lines[n] } // Get the part of a document between two positions, as an array of // strings. function getBetween(doc, start, end) { var out = [], n = start.line doc.iter(start.line, end.line + 1, function (line) { var text = line.text if (n == end.line) { text = text.slice(0, end.ch) } if (n == start.line) { text = text.slice(start.ch) } out.push(text) ++n }) return out } // Get the lines between from and to, as array of strings. function getLines(doc, from, to) { var out = [] doc.iter(from, to, function (line) { out.push(line.text) }) // iter aborts when callback returns truthy value return out } // Update the height of a line, propagating the height change // upwards to parent nodes. function updateLineHeight(line, height) { var diff = height - line.height if (diff) { for (var n = line; n; n = n.parent) { n.height += diff } } } // Given a line object, find its line number by walking up through // its parent links. function lineNo(line) { if (line.parent == null) { return null } var cur = line.parent, no = indexOf(cur.lines, line) for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { for (var i = 0;; ++i) { if (chunk.children[i] == cur) { break } no += chunk.children[i].chunkSize() } } return no + cur.first } // Find the line at the given vertical position, using the height // information in the document tree. function lineAtHeight(chunk, h) { var n = chunk.first outer: do { for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) { var child = chunk.children[i$1], ch = child.height if (h < ch) { chunk = child; continue outer } h -= ch n += child.chunkSize() } return n } while (!chunk.lines) var i = 0 for (; i < chunk.lines.length; ++i) { var line = chunk.lines[i], lh = line.height if (h < lh) { break } h -= lh } return n + i } function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size} function lineNumberFor(options, i) { return String(options.lineNumberFormatter(i + options.firstLineNumber)) } // A Pos instance represents a position within the text. function Pos(line, ch, sticky) { if ( sticky === void 0 ) sticky = null; if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) } this.line = line this.ch = ch this.sticky = sticky } // Compare two positions, return 0 if they are the same, a negative // number when a is less, and a positive number otherwise. function cmp(a, b) { return a.line - b.line || a.ch - b.ch } function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 } function copyPos(x) {return Pos(x.line, x.ch)} function maxPos(a, b) { return cmp(a, b) < 0 ? b : a } function minPos(a, b) { return cmp(a, b) < 0 ? a : b } // Most of the external API clips given positions to make sure they // actually exist within the document. function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))} function clipPos(doc, pos) { if (pos.line < doc.first) { return Pos(doc.first, 0) } var last = doc.first + doc.size - 1 if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) } return clipToLen(pos, getLine(doc, pos.line).text.length) } function clipToLen(pos, linelen) { var ch = pos.ch if (ch == null || ch > linelen) { return Pos(pos.line, linelen) } else if (ch < 0) { return Pos(pos.line, 0) } else { return pos } } function clipPosArray(doc, array) { var out = [] for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]) } return out } // Optimize some code when these features are not used. var sawReadOnlySpans = false; var sawCollapsedSpans = false; function seeReadOnlySpans() { sawReadOnlySpans = true } function seeCollapsedSpans() { sawCollapsedSpans = true } // TEXTMARKER SPANS function MarkedSpan(marker, from, to) { this.marker = marker this.from = from; this.to = to } // Search an array of spans for a span matching the given marker. function getMarkedSpanFor(spans, marker) { if (spans) { for (var i = 0; i < spans.length; ++i) { var span = spans[i] if (span.marker == marker) { return span } } } } // Remove a span from an array, returning undefined if no spans are // left (we don't store arrays for lines without spans). function removeMarkedSpan(spans, span) { var r for (var i = 0; i < spans.length; ++i) { if (spans[i] != span) { (r || (r = [])).push(spans[i]) } } return r } // Add a span to a line. function addMarkedSpan(line, span) { line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span] span.marker.attachLine(line) } // Used for the algorithm that adjusts markers for a change in the // document. These functions cut an array of spans at a given // character position, returning an array of remaining chunks (or // undefined if nothing remains). function markedSpansBefore(old, startCh, isInsert) { var nw if (old) { for (var i = 0; i < old.length; ++i) { var span = old[i], marker = span.marker var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh) if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) { var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh) ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to)) } } } return nw } function markedSpansAfter(old, endCh, isInsert) { var nw if (old) { for (var i = 0; i < old.length; ++i) { var span = old[i], marker = span.marker var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh) if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) { var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh) ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh, span.to == null ? null : span.to - endCh)) } } } return nw } // Given a change object, compute the new set of marker spans that // cover the line in which the change took place. Removes spans // entirely within the change, reconnects spans belonging to the // same marker that appear on both sides of the change, and cuts off // spans partially within the change. Returns an array of span // arrays with one element for each line in (after) the change. function stretchSpansOverChange(doc, change) { if (change.full) { return null } var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans if (!oldFirst && !oldLast) { return null } var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0 // Get the spans that 'stick out' on both sides var first = markedSpansBefore(oldFirst, startCh, isInsert) var last = markedSpansAfter(oldLast, endCh, isInsert) // Next, merge those two ends var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0) if (first) { // Fix up .to properties of first for (var i = 0; i < first.length; ++i) { var span = first[i] if (span.to == null) { var found = getMarkedSpanFor(last, span.marker) if (!found) { span.to = startCh } else if (sameLine) { span.to = found.to == null ? null : found.to + offset } } } } if (last) { // Fix up .from in last (or move them into first in case of sameLine) for (var i$1 = 0; i$1 < last.length; ++i$1) { var span$1 = last[i$1] if (span$1.to != null) { span$1.to += offset } if (span$1.from == null) { var found$1 = getMarkedSpanFor(first, span$1.marker) if (!found$1) { span$1.from = offset if (sameLine) { (first || (first = [])).push(span$1) } } } else { span$1.from += offset if (sameLine) { (first || (first = [])).push(span$1) } } } } // Make sure we didn't create any zero-length spans if (first) { first = clearEmptySpans(first) } if (last && last != first) { last = clearEmptySpans(last) } var newMarkers = [first] if (!sameLine) { // Fill gap with whole-line-spans var gap = change.text.length - 2, gapMarkers if (gap > 0 && first) { for (var i$2 = 0; i$2 < first.length; ++i$2) { if (first[i$2].to == null) { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)) } } } for (var i$3 = 0; i$3 < gap; ++i$3) { newMarkers.push(gapMarkers) } newMarkers.push(last) } return newMarkers } // Remove spans that are empty and don't have a clearWhenEmpty // option of false. function clearEmptySpans(spans) { for (var i = 0; i < spans.length; ++i) { var span = spans[i] if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) { spans.splice(i--, 1) } } if (!spans.length) { return null } return spans } // Used to 'clip' out readOnly ranges when making a change. function removeReadOnlyRanges(doc, from, to) { var markers = null doc.iter(from.line, to.line + 1, function (line) { if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { var mark = line.markedSpans[i].marker if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) { (markers || (markers = [])).push(mark) } } } }) if (!markers) { return null } var parts = [{from: from, to: to}] for (var i = 0; i < markers.length; ++i) { var mk = markers[i], m = mk.find(0) for (var j = 0; j < parts.length; ++j) { var p = parts[j] if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue } var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to) if (dfrom < 0 || !mk.inclusiveLeft && !dfrom) { newParts.push({from: p.from, to: m.from}) } if (dto > 0 || !mk.inclusiveRight && !dto) { newParts.push({from: m.to, to: p.to}) } parts.splice.apply(parts, newParts) j += newParts.length - 3 } } return parts } // Connect or disconnect spans from a line. function detachMarkedSpans(line) { var spans = line.markedSpans if (!spans) { return } for (var i = 0; i < spans.length; ++i) { spans[i].marker.detachLine(line) } line.markedSpans = null } function attachMarkedSpans(line, spans) { if (!spans) { return } for (var i = 0; i < spans.length; ++i) { spans[i].marker.attachLine(line) } line.markedSpans = spans } // Helpers used when computing which overlapping collapsed span // counts as the larger one. function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 } function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 } // Returns a number indicating which of two overlapping collapsed // spans is larger (and thus includes the other). Falls back to // comparing ids when the spans cover exactly the same range. function compareCollapsedMarkers(a, b) { var lenDiff = a.lines.length - b.lines.length if (lenDiff != 0) { return lenDiff } var aPos = a.find(), bPos = b.find() var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b) if (fromCmp) { return -fromCmp } var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b) if (toCmp) { return toCmp } return b.id - a.id } // Find out whether a line ends or starts in a collapsed span. If // so, return the marker for that span. function collapsedSpanAtSide(line, start) { var sps = sawCollapsedSpans && line.markedSpans, found if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { sp = sps[i] if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker } } } return found } function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) } function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) } // Test whether there exists a collapsed span that partially // overlaps (covers the start or end, but not both) of a new span. // Such overlap is not allowed. function conflictingCollapsedRange(doc, lineNo, from, to, marker) { var line = getLine(doc, lineNo) var sps = sawCollapsedSpans && line.markedSpans if (sps) { for (var i = 0; i < sps.length; ++i) { var sp = sps[i] if (!sp.marker.collapsed) { continue } var found = sp.marker.find(0) var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker) var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker) if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue } if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) || fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0)) { return true } } } } // A visual line is a line as drawn on the screen. Folding, for // example, can cause multiple logical lines to appear on the same // visual line. This finds the start of the visual line that the // given line is part of (usually that is the line itself). function visualLine(line) { var merged while (merged = collapsedSpanAtStart(line)) { line = merged.find(-1, true).line } return line } function visualLineEnd(line) { var merged while (merged = collapsedSpanAtEnd(line)) { line = merged.find(1, true).line } return line } // Returns an array of logical lines that continue the visual line // started by the argument, or undefined if there are no such lines. function visualLineContinued(line) { var merged, lines while (merged = collapsedSpanAtEnd(line)) { line = merged.find(1, true).line ;(lines || (lines = [])).push(line) } return lines } // Get the line number of the start of the visual line that the // given line number is part of. function visualLineNo(doc, lineN) { var line = getLine(doc, lineN), vis = visualLine(line) if (line == vis) { return lineN } return lineNo(vis) } // Get the line number of the start of the next visual line after // the given line. function visualLineEndNo(doc, lineN) { if (lineN > doc.lastLine()) { return lineN } var line = getLine(doc, lineN), merged if (!lineIsHidden(doc, line)) { return lineN } while (merged = collapsedSpanAtEnd(line)) { line = merged.find(1, true).line } return lineNo(line) + 1 } // Compute whether a line is hidden. Lines count as hidden when they // are part of a visual line that starts with another line, or when // they are entirely covered by collapsed, non-widget span. function lineIsHidden(doc, line) { var sps = sawCollapsedSpans && line.markedSpans if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) { sp = sps[i] if (!sp.marker.collapsed) { continue } if (sp.from == null) { return true } if (sp.marker.widgetNode) { continue } if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) { return true } } } } function lineIsHiddenInner(doc, line, span) { if (span.to == null) { var end = span.marker.find(1, true) return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker)) } if (span.marker.inclusiveRight && span.to == line.text.length) { return true } for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) { sp = line.markedSpans[i] if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to && (sp.to == null || sp.to != span.from) && (sp.marker.inclusiveLeft || span.marker.inclusiveRight) && lineIsHiddenInner(doc, line, sp)) { return true } } } // Find the height above the given line. function heightAtLine(lineObj) { lineObj = visualLine(lineObj) var h = 0, chunk = lineObj.parent for (var i = 0; i < chunk.lines.length; ++i) { var line = chunk.lines[i] if (line == lineObj) { break } else { h += line.height } } for (var p = chunk.parent; p; chunk = p, p = chunk.parent) { for (var i$1 = 0; i$1 < p.children.length; ++i$1) { var cur = p.children[i$1] if (cur == chunk) { break } else { h += cur.height } } } return h } // Compute the character length of a line, taking into account // collapsed ranges (see markText) that might hide parts, and join // other lines onto it. function lineLength(line) { if (line.height == 0) { return 0 } var len = line.text.length, merged, cur = line while (merged = collapsedSpanAtStart(cur)) { var found = merged.find(0, true) cur = found.from.line len += found.from.ch - found.to.ch } cur = line while (merged = collapsedSpanAtEnd(cur)) { var found$1 = merged.find(0, true) len -= cur.text.length - found$1.from.ch cur = found$1.to.line len += cur.text.length - found$1.to.ch } return len } // Find the longest line in the document. function findMaxLine(cm) { var d = cm.display, doc = cm.doc d.maxLine = getLine(doc, doc.first) d.maxLineLength = lineLength(d.maxLine) d.maxLineChanged = true doc.iter(function (line) { var len = lineLength(line) if (len > d.maxLineLength) { d.maxLineLength = len d.maxLine = line } }) } // BIDI HELPERS function iterateBidiSections(order, from, to, f) { if (!order) { return f(from, to, "ltr") } var found = false for (var i = 0; i < order.length; ++i) { var part = order[i] if (part.from < to && part.to > from || from == to && part.to == from) { f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr") found = true } } if (!found) { f(from, to, "ltr") } } var bidiOther = null function getBidiPartAt(order, ch, sticky) { var found bidiOther = null for (var i = 0; i < order.length; ++i) { var cur = order[i] if (cur.from < ch && cur.to > ch) { return i } if (cur.to == ch) { if (cur.from != cur.to && sticky == "before") { found = i } else { bidiOther = i } } if (cur.from == ch) { if (cur.from != cur.to && sticky != "before") { found = i } else { bidiOther = i } } } return found != null ? found : bidiOther } // Bidirectional ordering algorithm // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm // that this (partially) implements. // One-char codes used for character types: // L (L): Left-to-Right // R (R): Right-to-Left // r (AL): Right-to-Left Arabic // 1 (EN): European Number // + (ES): European Number Separator // % (ET): European Number Terminator // n (AN): Arabic Number // , (CS): Common Number Separator // m (NSM): Non-Spacing Mark // b (BN): Boundary Neutral // s (B): Paragraph Separator // t (S): Segment Separator // w (WS): Whitespace // N (ON): Other Neutrals // Returns null if characters are ordered as they appear // (left-to-right), or an array of sections ({from, to, level} // objects) in the order in which they occur visually. var bidiOrdering = (function() { // Character types for codepoints 0 to 0xff var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN" // Character types for codepoints 0x600 to 0x6f9 var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111" function charType(code) { if (code <= 0xf7) { return lowTypes.charAt(code) } else if (0x590 <= code && code <= 0x5f4) { return "R" } else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) } else if (0x6ee <= code && code <= 0x8ac) { return "r" } else if (0x2000 <= code && code <= 0x200b) { return "w" } else if (code == 0x200c) { return "b" } else { return "L" } } var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/ var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/ // Browsers seem to always treat the boundaries of block elements as being L. var outerType = "L" function BidiSpan(level, from, to) { this.level = level this.from = from; this.to = to } return function(str) { if (!bidiRE.test(str)) { return false } var len = str.length, types = [] for (var i = 0; i < len; ++i) { types.push(charType(str.charCodeAt(i))) } // W1. Examine each non-spacing mark (NSM) in the level run, and // change the type of the NSM to the type of the previous // character. If the NSM is at the start of the level run, it will // get the type of sor. for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) { var type = types[i$1] if (type == "m") { types[i$1] = prev } else { prev = type } } // W2. Search backwards from each instance of a European number // until the first strong type (R, L, AL, or sor) is found. If an // AL is found, change the type of the European number to Arabic // number. // W3. Change all ALs to R. for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) { var type$1 = types[i$2] if (type$1 == "1" && cur == "r") { types[i$2] = "n" } else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R" } } } // W4. A single European separator between two European numbers // changes to a European number. A single common separator between // two numbers of the same type changes to that type. for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) { var type$2 = types[i$3] if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1" } else if (type$2 == "," && prev$1 == types[i$3+1] && (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1 } prev$1 = type$2 } // W5. A sequence of European terminators adjacent to European // numbers changes to all European numbers. // W6. Otherwise, separators and terminators change to Other // Neutral. for (var i$4 = 0; i$4 < len; ++i$4) { var type$3 = types[i$4] if (type$3 == ",") { types[i$4] = "N" } else if (type$3 == "%") { var end = (void 0) for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {} var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N" for (var j = i$4; j < end; ++j) { types[j] = replace } i$4 = end - 1 } } // W7. Search backwards from each instance of a European number // until the first strong type (R, L, or sor) is found. If an L is // found, then change the type of the European number to L. for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) { var type$4 = types[i$5] if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L" } else if (isStrong.test(type$4)) { cur$1 = type$4 } } // N1. A sequence of neutrals takes the direction of the // surrounding strong text if the text on both sides has the same // direction. European and Arabic numbers act as if they were R in // terms of their influence on neutrals. Start-of-level-run (sor) // and end-of-level-run (eor) are used at level run boundaries. // N2. Any remaining neutrals take the embedding direction. for (var i$6 = 0; i$6 < len; ++i$6) { if (isNeutral.test(types[i$6])) { var end$1 = (void 0) for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {} var before = (i$6 ? types[i$6-1] : outerType) == "L" var after = (end$1 < len ? types[end$1] : outerType) == "L" var replace$1 = before || after ? "L" : "R" for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1 } i$6 = end$1 - 1 } } // Here we depart from the documented algorithm, in order to avoid // building up an actual levels array. Since there are only three // levels (0, 1, 2) in an implementation that doesn't take // explicit embedding into account, we can build up the order on // the fly, without following the level-based algorithm. var order = [], m for (var i$7 = 0; i$7 < len;) { if (countsAsLeft.test(types[i$7])) { var start = i$7 for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {} order.push(new BidiSpan(0, start, i$7)) } else { var pos = i$7, at = order.length for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {} for (var j$2 = pos; j$2 < i$7;) { if (countsAsNum.test(types[j$2])) { if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)) } var nstart = j$2 for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {} order.splice(at, 0, new BidiSpan(2, nstart, j$2)) pos = j$2 } else { ++j$2 } } if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)) } } } if (order[0].level == 1 && (m = str.match(/^\s+/))) { order[0].from = m[0].length order.unshift(new BidiSpan(0, 0, m[0].length)) } if (lst(order).level == 1 && (m = str.match(/\s+$/))) { lst(order).to -= m[0].length order.push(new BidiSpan(0, len - m[0].length, len)) } return order } })() // Get the bidi ordering for the given line (and cache it). Returns // false for lines that are fully left-to-right, and an array of // BidiSpan objects otherwise. function getOrder(line) { var order = line.order if (order == null) { order = line.order = bidiOrdering(line.text) } return order } function moveCharLogically(line, ch, dir) { var target = skipExtendingChars(line.text, ch + dir, dir) return target < 0 || target > line.text.length ? null : target } function moveLogically(line, start, dir) { var ch = moveCharLogically(line, start.ch, dir) return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before") } function endOfLine(visually, cm, lineObj, lineNo, dir) { if (visually) { var order = getOrder(lineObj) if (order) { var part = dir < 0 ? lst(order) : order[0] var moveInStorageOrder = (dir < 0) == (part.level == 1) var sticky = moveInStorageOrder ? "after" : "before" var ch // With a wrapped rtl chunk (possibly spanning multiple bidi parts), // it could be that the last bidi part is not on the last visual line, // since visual lines contain content order-consecutive chunks. // Thus, in rtl, we are looking for the first (content-order) character // in the rtl chunk that is on the last line (that is, the same line // as the last (content-order) character). if (part.level > 0) { var prep = prepareMeasureForLine(cm, lineObj) ch = dir < 0 ? lineObj.text.length - 1 : 0 var targetTop = measureCharPrepared(cm, prep, ch).top ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch) if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1, true) } } else { ch = dir < 0 ? part.to : part.from } return new Pos(lineNo, ch, sticky) } } return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after") } function moveVisually(cm, line, start, dir) { var bidi = getOrder(line) if (!bidi) { return moveLogically(line, start, dir) } if (start.ch >= line.text.length) { start.ch = line.text.length start.sticky = "before" } else if (start.ch <= 0) { start.ch = 0 start.sticky = "after" } var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos] if (part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) { // Case 1: We move within an ltr part. Even with wrapped lines, // nothing interesting happens. return moveLogically(line, start, dir) } var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); } var prep var getWrappedLineExtent = function (ch) { if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} } prep = prep || prepareMeasureForLine(cm, line) return wrappedLineExtentChar(cm, line, prep, ch) } var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch) if (part.level % 2 == 1) { var ch = mv(start, -dir) if (ch != null && (dir > 0 ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) { // Case 2: We move within an rtl part on the same visual line var sticky = dir < 0 ? "before" : "after" return new Pos(start.line, ch, sticky) } } // Case 3: Could not move within this bidi part in this visual line, so leave // the current bidi part var searchInVisualLine = function (partPos, dir, wrappedLineExtent) { var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder ? new Pos(start.line, mv(ch, 1), "before") : new Pos(start.line, ch, "after"); } for (; partPos >= 0 && partPos < bidi.length; partPos += dir) { var part = bidi[partPos] var moveInStorageOrder = (dir > 0) == (part.level != 1) var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1) if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) } ch = moveInStorageOrder ? part.from : mv(part.to, -1) if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) } } } // Case 3a: Look for other bidi parts on the same visual line var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent) if (res) { return res } // Case 3b: Look for other bidi parts on the next visual line var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1) if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) { res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh)) if (res) { return res } } // Case 4: Nowhere to move return null } // EVENT HANDLING // Lightweight event framework. on/off also work on DOM nodes, // registering native DOM handlers. var noHandlers = [] var on = function(emitter, type, f) { if (emitter.addEventListener) { emitter.addEventListener(type, f, false) } else if (emitter.attachEvent) { emitter.attachEvent("on" + type, f) } else { var map = emitter._handlers || (emitter._handlers = {}) map[type] = (map[type] || noHandlers).concat(f) } } function getHandlers(emitter, type) { return emitter._handlers && emitter._handlers[type] || noHandlers } function off(emitter, type, f) { if (emitter.removeEventListener) { emitter.removeEventListener(type, f, false) } else if (emitter.detachEvent) { emitter.detachEvent("on" + type, f) } else { var map = emitter._handlers, arr = map && map[type] if (arr) { var index = indexOf(arr, f) if (index > -1) { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)) } } } } function signal(emitter, type /*, values...*/) { var handlers = getHandlers(emitter, type) if (!handlers.length) { return } var args = Array.prototype.slice.call(arguments, 2) for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args) } } // The DOM events that CodeMirror handles can be overridden by // registering a (non-DOM) handler on the editor for the event name, // and preventDefault-ing the event in that handler. function signalDOMEvent(cm, e, override) { if (typeof e == "string") { e = {type: e, preventDefault: function() { this.defaultPrevented = true }} } signal(cm, override || e.type, cm, e) return e_defaultPrevented(e) || e.codemirrorIgnore } function signalCursorActivity(cm) { var arr = cm._handlers && cm._handlers.cursorActivity if (!arr) { return } var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []) for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1) { set.push(arr[i]) } } } function hasHandler(emitter, type) { return getHandlers(emitter, type).length > 0 } // Add on and off methods to a constructor's prototype, to make // registering events on such objects more convenient. function eventMixin(ctor) { ctor.prototype.on = function(type, f) {on(this, type, f)} ctor.prototype.off = function(type, f) {off(this, type, f)} } // Due to the fact that we still support jurassic IE versions, some // compatibility wrappers are needed. function e_preventDefault(e) { if (e.preventDefault) { e.preventDefault() } else { e.returnValue = false } } function e_stopPropagation(e) { if (e.stopPropagation) { e.stopPropagation() } else { e.cancelBubble = true } } function e_defaultPrevented(e) { return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false } function e_stop(e) {e_preventDefault(e); e_stopPropagation(e)} function e_target(e) {return e.target || e.srcElement} function e_button(e) { var b = e.which if (b == null) { if (e.button & 1) { b = 1 } else if (e.button & 2) { b = 3 } else if (e.button & 4) { b = 2 } } if (mac && e.ctrlKey && b == 1) { b = 3 } return b } // Detect drag-and-drop var dragAndDrop = function() { // There is *some* kind of drag-and-drop support in IE6-8, but I // couldn't get it to work yet. if (ie && ie_version < 9) { return false } var div = elt('div') return "draggable" in div || "dragDrop" in div }() var zwspSupported function zeroWidthElement(measure) { if (zwspSupported == null) { var test = elt("span", "\u200b") removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")])) if (measure.firstChild.offsetHeight != 0) { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8) } } var node = zwspSupported ? elt("span", "\u200b") : elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px") node.setAttribute("cm-text", "") return node } // Feature-detect IE's crummy client rect reporting for bidi text var badBidiRects function hasBadBidiRects(measure) { if (badBidiRects != null) { return badBidiRects } var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA")) var r0 = range(txt, 0, 1).getBoundingClientRect() var r1 = range(txt, 1, 2).getBoundingClientRect() removeChildren(measure) if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780) return badBidiRects = (r1.right - r0.right < 3) } // See if "".split is the broken IE version, if so, provide an // alternative way to split lines. var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) { var pos = 0, result = [], l = string.length while (pos <= l) { var nl = string.indexOf("\n", pos) if (nl == -1) { nl = string.length } var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl) var rt = line.indexOf("\r") if (rt != -1) { result.push(line.slice(0, rt)) pos += rt + 1 } else { result.push(line) pos = nl + 1 } } return result } : function (string) { return string.split(/\r\n?|\n/); } var hasSelection = window.getSelection ? function (te) { try { return te.selectionStart != te.selectionEnd } catch(e) { return false } } : function (te) { var range try {range = te.ownerDocument.selection.createRange()} catch(e) {} if (!range || range.parentElement() != te) { return false } return range.compareEndPoints("StartToEnd", range) != 0 } var hasCopyEvent = (function () { var e = elt("div") if ("oncopy" in e) { return true } e.setAttribute("oncopy", "return;") return typeof e.oncopy == "function" })() var badZoomedRects = null function hasBadZoomedRects(measure) { if (badZoomedRects != null) { return badZoomedRects } var node = removeChildrenAndAdd(measure, elt("span", "x")) var normal = node.getBoundingClientRect() var fromRange = range(node, 0, 1).getBoundingClientRect() return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1 } var modes = {}; var mimeModes = {}; // Extra arguments are stored as the mode's dependencies, which is // used by (legacy) mechanisms like loadmode.js to automatically // load a mode. (Preferred mechanism is the require/define calls.) function defineMode(name, mode) { if (arguments.length > 2) { mode.dependencies = Array.prototype.slice.call(arguments, 2) } modes[name] = mode } function defineMIME(mime, spec) { mimeModes[mime] = spec } // Given a MIME type, a {name, ...options} config object, or a name // string, return a mode config object. function resolveMode(spec) { if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) { spec = mimeModes[spec] } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) { var found = mimeModes[spec.name] if (typeof found == "string") { found = {name: found} } spec = createObj(found, spec) spec.name = found.name } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) { return resolveMode("application/xml") } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) { return resolveMode("application/json") } if (typeof spec == "string") { return {name: spec} } else { return spec || {name: "null"} } } // Given a mode spec (anything that resolveMode accepts), find and // initialize an actual mode object. function getMode(options, spec) { spec = resolveMode(spec) var mfactory = modes[spec.name] if (!mfactory) { return getMode(options, "text/plain") } var modeObj = mfactory(options, spec) if (modeExtensions.hasOwnProperty(spec.name)) { var exts = modeExtensions[spec.name] for (var prop in exts) { if (!exts.hasOwnProperty(prop)) { continue } if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop] } modeObj[prop] = exts[prop] } } modeObj.name = spec.name if (spec.helperType) { modeObj.helperType = spec.helperType } if (spec.modeProps) { for (var prop$1 in spec.modeProps) { modeObj[prop$1] = spec.modeProps[prop$1] } } return modeObj } // This can be used to attach properties to mode objects from // outside the actual mode definition. var modeExtensions = {} function extendMode(mode, properties) { var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {}) copyObj(properties, exts) } function copyState(mode, state) { if (state === true) { return state } if (mode.copyState) { return mode.copyState(state) } var nstate = {} for (var n in state) { var val = state[n] if (val instanceof Array) { val = val.concat([]) } nstate[n] = val } return nstate } // Given a mode and a state (for that mode), find the inner mode and // state at the position that the state refers to. function innerMode(mode, state) { var info while (mode.innerMode) { info = mode.innerMode(state) if (!info || info.mode == mode) { break } state = info.state mode = info.mode } return info || {mode: mode, state: state} } function startState(mode, a1, a2) { return mode.startState ? mode.startState(a1, a2) : true } // STRING STREAM // Fed to the mode parsers, provides helper functions to make // parsers more succinct. var StringStream = function(string, tabSize) { this.pos = this.start = 0 this.string = string this.tabSize = tabSize || 8 this.lastColumnPos = this.lastColumnValue = 0 this.lineStart = 0 }; StringStream.prototype.eol = function () {return this.pos >= this.string.length}; StringStream.prototype.sol = function () {return this.pos == this.lineStart}; StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined}; StringStream.prototype.next = function () { if (this.pos < this.string.length) { return this.string.charAt(this.pos++) } }; StringStream.prototype.eat = function (match) { var ch = this.string.charAt(this.pos) var ok if (typeof match == "string") { ok = ch == match } else { ok = ch && (match.test ? match.test(ch) : match(ch)) } if (ok) {++this.pos; return ch} }; StringStream.prototype.eatWhile = function (match) { var start = this.pos while (this.eat(match)){} return this.pos > start }; StringStream.prototype.eatSpace = function () { var this$1 = this; var start = this.pos while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos } return this.pos > start }; StringStream.prototype.skipToEnd = function () {this.pos = this.string.length}; StringStream.prototype.skipTo = function (ch) { var found = this.string.indexOf(ch, this.pos) if (found > -1) {this.pos = found; return true} }; StringStream.prototype.backUp = function (n) {this.pos -= n}; StringStream.prototype.column = function () { if (this.lastColumnPos < this.start) { this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue) this.lastColumnPos = this.start } return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0) }; StringStream.prototype.indentation = function () { return countColumn(this.string, null, this.tabSize) - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0) }; StringStream.prototype.match = function (pattern, consume, caseInsensitive) { if (typeof pattern == "string") { var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; } var substr = this.string.substr(this.pos, pattern.length) if (cased(substr) == cased(pattern)) { if (consume !== false) { this.pos += pattern.length } return true } } else { var match = this.string.slice(this.pos).match(pattern) if (match && match.index > 0) { return null } if (match && consume !== false) { this.pos += match[0].length } return match } }; StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)}; StringStream.prototype.hideFirstChars = function (n, inner) { this.lineStart += n try { return inner() } finally { this.lineStart -= n } }; // Compute a style array (an array starting with a mode generation // -- for invalidation -- followed by pairs of end positions and // style strings), which is used to highlight the tokens on the // line. function highlightLine(cm, line, state, forceToEnd) { // A styles array always starts with a number identifying the // mode/overlays that it is based on (for easy invalidation). var st = [cm.state.modeGen], lineClasses = {} // Compute the base array of styles runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); }, lineClasses, forceToEnd) // Run overlays, adjust style array. var loop = function ( o ) { var overlay = cm.state.overlays[o], i = 1, at = 0 runMode(cm, line.text, overlay.mode, true, function (end, style) { var start = i // Ensure there's a token end at the current position, and that i points at it while (at < end) { var i_end = st[i] if (i_end > end) { st.splice(i, 1, end, st[i+1], i_end) } i += 2 at = Math.min(end, i_end) } if (!style) { return } if (overlay.opaque) { st.splice(start, i - start, end, "overlay " + style) i = start + 2 } else { for (; start < i; start += 2) { var cur = st[start+1] st[start+1] = (cur ? cur + " " : "") + "overlay " + style } } }, lineClasses) }; for (var o = 0; o < cm.state.overlays.length; ++o) loop( o ); return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null} } function getLineStyles(cm, line, updateFrontier) { if (!line.styles || line.styles[0] != cm.state.modeGen) { var state = getStateBefore(cm, lineNo(line)) var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state) line.stateAfter = state line.styles = result.styles if (result.classes) { line.styleClasses = result.classes } else if (line.styleClasses) { line.styleClasses = null } if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++ } } return line.styles } function getStateBefore(cm, n, precise) { var doc = cm.doc, display = cm.display if (!doc.mode.startState) { return true } var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter if (!state) { state = startState(doc.mode) } else { state = copyState(doc.mode, state) } doc.iter(pos, n, function (line) { processLine(cm, line.text, state) var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo line.stateAfter = save ? copyState(doc.mode, state) : null ++pos }) if (precise) { doc.frontier = pos } return state } // Lightweight form of highlight -- proceed over this line and // update state, but don't save a style array. Used for lines that // aren't currently visible. function processLine(cm, text, state, startAt) { var mode = cm.doc.mode var stream = new StringStream(text, cm.options.tabSize) stream.start = stream.pos = startAt || 0 if (text == "") { callBlankLine(mode, state) } while (!stream.eol()) { readToken(mode, stream, state) stream.start = stream.pos } } function callBlankLine(mode, state) { if (mode.blankLine) { return mode.blankLine(state) } if (!mode.innerMode) { return } var inner = innerMode(mode, state) if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) } } function readToken(mode, stream, state, inner) { for (var i = 0; i < 10; i++) { if (inner) { inner[0] = innerMode(mode, state).mode } var style = mode.token(stream, state) if (stream.pos > stream.start) { return style } } throw new Error("Mode " + mode.name + " failed to advance stream.") } // Utility for getTokenAt and getLineTokens function takeToken(cm, pos, precise, asArray) { var getObj = function (copy) { return ({ start: stream.start, end: stream.pos, string: stream.current(), type: style || null, state: copy ? copyState(doc.mode, state) : state }); } var doc = cm.doc, mode = doc.mode, style pos = clipPos(doc, pos) var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise) var stream = new StringStream(line.text, cm.options.tabSize), tokens if (asArray) { tokens = [] } while ((asArray || stream.pos < pos.ch) && !stream.eol()) { stream.start = stream.pos style = readToken(mode, stream, state) if (asArray) { tokens.push(getObj(true)) } } return asArray ? tokens : getObj() } function extractLineClasses(type, output) { if (type) { for (;;) { var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/) if (!lineClass) { break } type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length) var prop = lineClass[1] ? "bgClass" : "textClass" if (output[prop] == null) { output[prop] = lineClass[2] } else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop])) { output[prop] += " " + lineClass[2] } } } return type } // Run the given mode's parser over a line, calling f for each token. function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) { var flattenSpans = mode.flattenSpans if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans } var curStart = 0, curStyle = null var stream = new StringStream(text, cm.options.tabSize), style var inner = cm.options.addModeClass && [null] if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses) } while (!stream.eol()) { if (stream.pos > cm.options.maxHighlightLength) { flattenSpans = false if (forceToEnd) { processLine(cm, text, state, stream.pos) } stream.pos = text.length style = null } else { style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses) } if (inner) { var mName = inner[0].name if (mName) { style = "m-" + (style ? mName + " " + style : mName) } } if (!flattenSpans || curStyle != style) { while (curStart < stream.start) { curStart = Math.min(stream.start, curStart + 5000) f(curStart, curStyle) } curStyle = style } stream.start = stream.pos } while (curStart < stream.pos) { // Webkit seems to refuse to render text nodes longer than 57444 // characters, and returns inaccurate measurements in nodes // starting around 5000 chars. var pos = Math.min(stream.pos, curStart + 5000) f(pos, curStyle) curStart = pos } } // Finds the line to start with when starting a parse. Tries to // find a line with a stateAfter, so that it can start with a // valid state. If that fails, it returns the line with the // smallest indentation, which tends to need the least context to // parse correctly. function findStartLine(cm, n, precise) { var minindent, minline, doc = cm.doc var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100) for (var search = n; search > lim; --search) { if (search <= doc.first) { return doc.first } var line = getLine(doc, search - 1) if (line.stateAfter && (!precise || search <= doc.frontier)) { return search } var indented = countColumn(line.text, null, cm.options.tabSize) if (minline == null || minindent > indented) { minline = search - 1 minindent = indented } } return minline } // LINE DATA STRUCTURE // Line objects. These hold state related to a line, including // highlighting info (the styles array). var Line = function(text, markedSpans, estimateHeight) { this.text = text attachMarkedSpans(this, markedSpans) this.height = estimateHeight ? estimateHeight(this) : 1 }; Line.prototype.lineNo = function () { return lineNo(this) }; eventMixin(Line) // Change the content (text, markers) of a line. Automatically // invalidates cached information and tries to re-estimate the // line's height. function updateLine(line, text, markedSpans, estimateHeight) { line.text = text if (line.stateAfter) { line.stateAfter = null } if (line.styles) { line.styles = null } if (line.order != null) { line.order = null } detachMarkedSpans(line) attachMarkedSpans(line, markedSpans) var estHeight = estimateHeight ? estimateHeight(line) : 1 if (estHeight != line.height) { updateLineHeight(line, estHeight) } } // Detach a line from the document tree and its markers. function cleanUpLine(line) { line.parent = null detachMarkedSpans(line) } // Convert a style as returned by a mode (either null, or a string // containing one or more styles) to a CSS style. This is cached, // and also looks for line-wide styles. var styleToClassCache = {}; var styleToClassCacheWithMode = {}; function interpretTokenStyle(style, options) { if (!style || /^\s*$/.test(style)) { return null } var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache return cache[style] || (cache[style] = style.replace(/\S+/g, "cm-$&")) } // Render the DOM representation of the text of a line. Also builds // up a 'line map', which points at the DOM nodes that represent // specific stretches of text, and is used by the measuring code. // The returned object contains the DOM node, this map, and // information about line-wide styles that were set by the mode. function buildLineContent(cm, lineView) { // The padding-right forces the element to have a 'border', which // is needed on Webkit to be able to get line-level bounding // rectangles for it (in measureChar). var content = elt("span", null, null, webkit ? "padding-right: .1px" : null) var builder = {pre: elt("pre", [content], "CodeMirror-line"), content: content, col: 0, pos: 0, cm: cm, trailingSpace: false, splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")} // hide from accessibility tree content.setAttribute("role", "presentation") builder.pre.setAttribute("role", "presentation") lineView.measure = {} // Iterate over the logical lines that make up this visual line. for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) { var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0) builder.pos = 0 builder.addToken = buildToken // Optionally wire in some hacks into the token-rendering // algorithm, to deal with browser quirks. if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line))) { builder.addToken = buildTokenBadBidi(builder.addToken, order) } builder.map = [] var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line) insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate)) if (line.styleClasses) { if (line.styleClasses.bgClass) { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || "") } if (line.styleClasses.textClass) { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || "") } } // Ensure at least a single node is present, for measuring. if (builder.map.length == 0) { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) } // Store the map and a cache object for the current logical line if (i == 0) { lineView.measure.map = builder.map lineView.measure.cache = {} } else { ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map) ;(lineView.measure.caches || (lineView.measure.caches = [])).push({}) } } // See issue #2901 if (webkit) { var last = builder.content.lastChild if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab"))) { builder.content.className = "cm-tab-wrap-hack" } } signal(cm, "renderLine", cm, lineView.line, builder.pre) if (builder.pre.className) { builder.textClass = joinClasses(builder.pre.className, builder.textClass || "") } return builder } function defaultSpecialCharPlaceholder(ch) { var token = elt("span", "\u2022", "cm-invalidchar") token.title = "\\u" + ch.charCodeAt(0).toString(16) token.setAttribute("aria-label", token.title) return token } // Build up the DOM representation for a single token, and add it to // the line map. Takes care to render special characters separately. function buildToken(builder, text, style, startStyle, endStyle, title, css) { if (!text) { return } var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text var special = builder.cm.state.specialChars, mustWrap = false var content if (!special.test(text)) { builder.col += text.length content = document.createTextNode(displayText) builder.map.push(builder.pos, builder.pos + text.length, content) if (ie && ie_version < 9) { mustWrap = true } builder.pos += text.length } else { content = document.createDocumentFragment() var pos = 0 while (true) { special.lastIndex = pos var m = special.exec(text) var skipped = m ? m.index - pos : text.length - pos if (skipped) { var txt = document.createTextNode(displayText.slice(pos, pos + skipped)) if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])) } else { content.appendChild(txt) } builder.map.push(builder.pos, builder.pos + skipped, txt) builder.col += skipped builder.pos += skipped } if (!m) { break } pos += skipped + 1 var txt$1 = (void 0) if (m[0] == "\t") { var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab")) txt$1.setAttribute("role", "presentation") txt$1.setAttribute("cm-text", "\t") builder.col += tabWidth } else if (m[0] == "\r" || m[0] == "\n") { txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar")) txt$1.setAttribute("cm-text", m[0]) builder.col += 1 } else { txt$1 = builder.cm.options.specialCharPlaceholder(m[0]) txt$1.setAttribute("cm-text", m[0]) if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])) } else { content.appendChild(txt$1) } builder.col += 1 } builder.map.push(builder.pos, builder.pos + 1, txt$1) builder.pos++ } } builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32 if (style || startStyle || endStyle || mustWrap || css) { var fullStyle = style || "" if (startStyle) { fullStyle += startStyle } if (endStyle) { fullStyle += endStyle } var token = elt("span", [content], fullStyle, css) if (title) { token.title = title } return builder.content.appendChild(token) } builder.content.appendChild(content) } function splitSpaces(text, trailingBefore) { if (text.length > 1 && !/ /.test(text)) { return text } var spaceBefore = trailingBefore, result = "" for (var i = 0; i < text.length; i++) { var ch = text.charAt(i) if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32)) { ch = "\u00a0" } result += ch spaceBefore = ch == " " } return result } // Work around nonsense dimensions being reported for stretches of // right-to-left text. function buildTokenBadBidi(inner, order) { return function (builder, text, style, startStyle, endStyle, title, css) { style = style ? style + " cm-force-border" : "cm-force-border" var start = builder.pos, end = start + text.length for (;;) { // Find the part that overlaps with the start of this text var part = (void 0) for (var i = 0; i < order.length; i++) { part = order[i] if (part.to > start && part.from <= start) { break } } if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) } inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css) startStyle = null text = text.slice(part.to - start) start = part.to } } } function buildCollapsedSpan(builder, size, marker, ignoreWidget) { var widget = !ignoreWidget && marker.widgetNode if (widget) { builder.map.push(builder.pos, builder.pos + size, widget) } if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) { if (!widget) { widget = builder.content.appendChild(document.createElement("span")) } widget.setAttribute("cm-marker", marker.id) } if (widget) { builder.cm.display.input.setUneditable(widget) builder.content.appendChild(widget) } builder.pos += size builder.trailingSpace = false } // Outputs a number of spans to make up a line, taking highlighting // and marked text into account. function insertLineContent(line, builder, styles) { var spans = line.markedSpans, allText = line.text, at = 0 if (!spans) { for (var i$1 = 1; i$1 < styles.length; i$1+=2) { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)) } return } var len = allText.length, pos = 0, i = 1, text = "", style, css var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed for (;;) { if (nextChange == pos) { // Update current marker set spanStyle = spanEndStyle = spanStartStyle = title = css = "" collapsed = null; nextChange = Infinity var foundBookmarks = [], endStyles = (void 0) for (var j = 0; j < spans.length; ++j) { var sp = spans[j], m = sp.marker if (m.type == "bookmark" && sp.from == pos && m.widgetNode) { foundBookmarks.push(m) } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) { if (sp.to != null && sp.to != pos && nextChange > sp.to) { nextChange = sp.to spanEndStyle = "" } if (m.className) { spanStyle += " " + m.className } if (m.css) { css = (css ? css + ";" : "") + m.css } if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle } if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to) } if (m.title && !title) { title = m.title } if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) { collapsed = sp } } else if (sp.from > pos && nextChange > sp.from) { nextChange = sp.from } } if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2) { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1] } } } if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2) { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]) } } if (collapsed && (collapsed.from || 0) == pos) { buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, collapsed.marker, collapsed.from == null) if (collapsed.to == null) { return } if (collapsed.to == pos) { collapsed = false } } } if (pos >= len) { break } var upto = Math.min(len, nextChange) while (true) { if (text) { var end = pos + text.length if (!collapsed) { var tokenText = end > upto ? text.slice(0, upto - pos) : text builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css) } if (end >= upto) {text = text.slice(upto - pos); pos = upto; break} pos = end spanStartStyle = "" } text = allText.slice(at, at = styles[i++]) style = interpretTokenStyle(styles[i++], builder.cm.options) } } } // These objects are used to represent the visible (currently drawn) // part of the document. A LineView may correspond to multiple // logical lines, if those are connected by collapsed ranges. function LineView(doc, line, lineN) { // The starting line this.line = line // Continuing lines, if any this.rest = visualLineContinued(line) // Number of logical lines in this visual line this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1 this.node = this.text = null this.hidden = lineIsHidden(doc, line) } // Create a range of LineView objects for the given lines. function buildViewArray(cm, from, to) { var array = [], nextPos for (var pos = from; pos < to; pos = nextPos) { var view = new LineView(cm.doc, getLine(cm.doc, pos), pos) nextPos = pos + view.size array.push(view) } return array } var operationGroup = null function pushOperation(op) { if (operationGroup) { operationGroup.ops.push(op) } else { op.ownsGroup = operationGroup = { ops: [op], delayedCallbacks: [] } } } function fireCallbacksForOps(group) { // Calls delayed callbacks and cursorActivity handlers until no // new ones appear var callbacks = group.delayedCallbacks, i = 0 do { for (; i < callbacks.length; i++) { callbacks[i].call(null) } for (var j = 0; j < group.ops.length; j++) { var op = group.ops[j] if (op.cursorActivityHandlers) { while (op.cursorActivityCalled < op.cursorActivityHandlers.length) { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm) } } } } while (i < callbacks.length) } function finishOperation(op, endCb) { var group = op.ownsGroup if (!group) { return } try { fireCallbacksForOps(group) } finally { operationGroup = null endCb(group) } } var orphanDelayedCallbacks = null // Often, we want to signal events at a point where we are in the // middle of some work, but don't want the handler to start calling // other methods on the editor, which might be in an inconsistent // state or simply not expect any other events to happen. // signalLater looks whether there are any handlers, and schedules // them to be executed when the last operation ends, or, if no // operation is active, when a timeout fires. function signalLater(emitter, type /*, values...*/) { var arr = getHandlers(emitter, type) if (!arr.length) { return } var args = Array.prototype.slice.call(arguments, 2), list if (operationGroup) { list = operationGroup.delayedCallbacks } else if (orphanDelayedCallbacks) { list = orphanDelayedCallbacks } else { list = orphanDelayedCallbacks = [] setTimeout(fireOrphanDelayed, 0) } var loop = function ( i ) { list.push(function () { return arr[i].apply(null, args); }) }; for (var i = 0; i < arr.length; ++i) loop( i ); } function fireOrphanDelayed() { var delayed = orphanDelayedCallbacks orphanDelayedCallbacks = null for (var i = 0; i < delayed.length; ++i) { delayed[i]() } } // When an aspect of a line changes, a string is added to // lineView.changes. This updates the relevant part of the line's // DOM structure. function updateLineForChanges(cm, lineView, lineN, dims) { for (var j = 0; j < lineView.changes.length; j++) { var type = lineView.changes[j] if (type == "text") { updateLineText(cm, lineView) } else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims) } else if (type == "class") { updateLineClasses(lineView) } else if (type == "widget") { updateLineWidgets(cm, lineView, dims) } } lineView.changes = null } // Lines with gutter elements, widgets or a background class need to // be wrapped, and have the extra elements added to the wrapper div function ensureLineWrapped(lineView) { if (lineView.node == lineView.text) { lineView.node = elt("div", null, null, "position: relative") if (lineView.text.parentNode) { lineView.text.parentNode.replaceChild(lineView.node, lineView.text) } lineView.node.appendChild(lineView.text) if (ie && ie_version < 8) { lineView.node.style.zIndex = 2 } } return lineView.node } function updateLineBackground(lineView) { var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass if (cls) { cls += " CodeMirror-linebackground" } if (lineView.background) { if (cls) { lineView.background.className = cls } else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null } } else if (cls) { var wrap = ensureLineWrapped(lineView) lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild) } } // Wrapper around buildLineContent which will reuse the structure // in display.externalMeasured when possible. function getLineContent(cm, lineView) { var ext = cm.display.externalMeasured if (ext && ext.line == lineView.line) { cm.display.externalMeasured = null lineView.measure = ext.measure return ext.built } return buildLineContent(cm, lineView) } // Redraw the line's text. Interacts with the background and text // classes because the mode may output tokens that influence these // classes. function updateLineText(cm, lineView) { var cls = lineView.text.className var built = getLineContent(cm, lineView) if (lineView.text == lineView.node) { lineView.node = built.pre } lineView.text.parentNode.replaceChild(built.pre, lineView.text) lineView.text = built.pre if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) { lineView.bgClass = built.bgClass lineView.textClass = built.textClass updateLineClasses(lineView) } else if (cls) { lineView.text.className = cls } } function updateLineClasses(lineView) { updateLineBackground(lineView) if (lineView.line.wrapClass) { ensureLineWrapped(lineView).className = lineView.line.wrapClass } else if (lineView.node != lineView.text) { lineView.node.className = "" } var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass lineView.text.className = textClass || "" } function updateLineGutter(cm, lineView, lineN, dims) { if (lineView.gutter) { lineView.node.removeChild(lineView.gutter) lineView.gutter = null } if (lineView.gutterBackground) { lineView.node.removeChild(lineView.gutterBackground) lineView.gutterBackground = null } if (lineView.line.gutterClass) { var wrap = ensureLineWrapped(lineView) lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass, ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px")) wrap.insertBefore(lineView.gutterBackground, lineView.text) } var markers = lineView.line.gutterMarkers if (cm.options.lineNumbers || markers) { var wrap$1 = ensureLineWrapped(lineView) var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px")) cm.display.input.setUneditable(gutterWrap) wrap$1.insertBefore(gutterWrap, lineView.text) if (lineView.line.gutterClass) { gutterWrap.className += " " + lineView.line.gutterClass } if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"])) { lineView.lineNumber = gutterWrap.appendChild( elt("div", lineNumberFor(cm.options, lineN), "CodeMirror-linenumber CodeMirror-gutter-elt", ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))) } if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) { var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id] if (found) { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))) } } } } } function updateLineWidgets(cm, lineView, dims) { if (lineView.alignable) { lineView.alignable = null } for (var node = lineView.node.firstChild, next = (void 0); node; node = next) { next = node.nextSibling if (node.className == "CodeMirror-linewidget") { lineView.node.removeChild(node) } } insertLineWidgets(cm, lineView, dims) } // Build a line's DOM representation from scratch function buildLineElement(cm, lineView, lineN, dims) { var built = getLineContent(cm, lineView) lineView.text = lineView.node = built.pre if (built.bgClass) { lineView.bgClass = built.bgClass } if (built.textClass) { lineView.textClass = built.textClass } updateLineClasses(lineView) updateLineGutter(cm, lineView, lineN, dims) insertLineWidgets(cm, lineView, dims) return lineView.node } // A lineView may contain multiple logical lines (when merged by // collapsed spans). The widgets for all of them need to be drawn. function insertLineWidgets(cm, lineView, dims) { insertLineWidgetsFor(cm, lineView.line, lineView, dims, true) if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false) } } } function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) { if (!line.widgets) { return } var wrap = ensureLineWrapped(lineView) for (var i = 0, ws = line.widgets; i < ws.length; ++i) { var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget") if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true") } positionLineWidget(widget, node, lineView, dims) cm.display.input.setUneditable(node) if (allowAbove && widget.above) { wrap.insertBefore(node, lineView.gutter || lineView.text) } else { wrap.appendChild(node) } signalLater(widget, "redraw") } } function positionLineWidget(widget, node, lineView, dims) { if (widget.noHScroll) { ;(lineView.alignable || (lineView.alignable = [])).push(node) var width = dims.wrapperWidth node.style.left = dims.fixedPos + "px" if (!widget.coverGutter) { width -= dims.gutterTotalWidth node.style.paddingLeft = dims.gutterTotalWidth + "px" } node.style.width = width + "px" } if (widget.coverGutter) { node.style.zIndex = 5 node.style.position = "relative" if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px" } } } function widgetHeight(widget) { if (widget.height != null) { return widget.height } var cm = widget.doc.cm if (!cm) { return 0 } if (!contains(document.body, widget.node)) { var parentStyle = "position: relative;" if (widget.coverGutter) { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;" } if (widget.noHScroll) { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;" } removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle)) } return widget.height = widget.node.parentNode.offsetHeight } // Return true when the given mouse event happened in a widget function eventInWidget(display, e) { for (var n = e_target(e); n != display.wrapper; n = n.parentNode) { if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") || (n.parentNode == display.sizer && n != display.mover)) { return true } } } // POSITION MEASUREMENT function paddingTop(display) {return display.lineSpace.offsetTop} function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight} function paddingH(display) { if (display.cachedPaddingH) { return display.cachedPaddingH } var e = removeChildrenAndAdd(display.measure, elt("pre", "x")) var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)} if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data } return data } function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth } function displayWidth(cm) { return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth } function displayHeight(cm) { return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight } // Ensure the lineView.wrapping.heights array is populated. This is // an array of bottom offsets for the lines that make up a drawn // line. When lineWrapping is on, there might be more than one // height. function ensureLineHeights(cm, lineView, rect) { var wrapping = cm.options.lineWrapping var curWidth = wrapping && displayWidth(cm) if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { var heights = lineView.measure.heights = [] if (wrapping) { lineView.measure.width = curWidth var rects = lineView.text.firstChild.getClientRects() for (var i = 0; i < rects.length - 1; i++) { var cur = rects[i], next = rects[i + 1] if (Math.abs(cur.bottom - next.bottom) > 2) { heights.push((cur.bottom + next.top) / 2 - rect.top) } } } heights.push(rect.bottom - rect.top) } } // Find a line map (mapping character offsets to text nodes) and a // measurement cache for the given line number. (A line view might // contain multiple lines when collapsed ranges are present.) function mapFromLineView(lineView, line, lineN) { if (lineView.line == line) { return {map: lineView.measure.map, cache: lineView.measure.cache} } for (var i = 0; i < lineView.rest.length; i++) { if (lineView.rest[i] == line) { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) { if (lineNo(lineView.rest[i$1]) > lineN) { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } } // Render a line into the hidden node display.externalMeasured. Used // when measurement is needed for a line that's not in the viewport. function updateExternalMeasurement(cm, line) { line = visualLine(line) var lineN = lineNo(line) var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN) view.lineN = lineN var built = view.built = buildLineContent(cm, view) view.text = built.pre removeChildrenAndAdd(cm.display.lineMeasure, built.pre) return view } // Get a {top, bottom, left, right} box (in line-local coordinates) // for a given character. function measureChar(cm, line, ch, bias) { return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias) } // Find a line view that corresponds to the given line number. function findViewForLine(cm, lineN) { if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) { return cm.display.view[findViewIndex(cm, lineN)] } var ext = cm.display.externalMeasured if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) { return ext } } // Measurement can be split in two steps, the set-up work that // applies to the whole line, and the measurement of the actual // character. Functions like coordsChar, that need to do a lot of // measurements in a row, can thus ensure that the set-up work is // only done once. function prepareMeasureForLine(cm, line) { var lineN = lineNo(line) var view = findViewForLine(cm, lineN) if (view && !view.text) { view = null } else if (view && view.changes) { updateLineForChanges(cm, view, lineN, getDimensions(cm)) cm.curOp.forceUpdate = true } if (!view) { view = updateExternalMeasurement(cm, line) } var info = mapFromLineView(view, line, lineN) return { line: line, view: view, rect: null, map: info.map, cache: info.cache, before: info.before, hasHeights: false } } // Given a prepared measurement object, measures the position of an // actual character (or fetches it from the cache). function measureCharPrepared(cm, prepared, ch, bias, varHeight) { if (prepared.before) { ch = -1 } var key = ch + (bias || ""), found if (prepared.cache.hasOwnProperty(key)) { found = prepared.cache[key] } else { if (!prepared.rect) { prepared.rect = prepared.view.text.getBoundingClientRect() } if (!prepared.hasHeights) { ensureLineHeights(cm, prepared.view, prepared.rect) prepared.hasHeights = true } found = measureCharInner(cm, prepared, ch, bias) if (!found.bogus) { prepared.cache[key] = found } } return {left: found.left, right: found.right, top: varHeight ? found.rtop : found.top, bottom: varHeight ? found.rbottom : found.bottom} } var nullRect = {left: 0, right: 0, top: 0, bottom: 0} function nodeAndOffsetInLineMap(map, ch, bias) { var node, start, end, collapse, mStart, mEnd // First, search the line map for the text node corresponding to, // or closest to, the target character. for (var i = 0; i < map.length; i += 3) { mStart = map[i] mEnd = map[i + 1] if (ch < mStart) { start = 0; end = 1 collapse = "left" } else if (ch < mEnd) { start = ch - mStart end = start + 1 } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) { end = mEnd - mStart start = end - 1 if (ch >= mEnd) { collapse = "right" } } if (start != null) { node = map[i + 2] if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right")) { collapse = bias } if (bias == "left" && start == 0) { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) { node = map[(i -= 3) + 2] collapse = "left" } } if (bias == "right" && start == mEnd - mStart) { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) { node = map[(i += 3) + 2] collapse = "right" } } break } } return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd} } function getUsefulRect(rects, bias) { var rect = nullRect if (bias == "left") { for (var i = 0; i < rects.length; i++) { if ((rect = rects[i]).left != rect.right) { break } } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) { if ((rect = rects[i$1]).left != rect.right) { break } } } return rect } function measureCharInner(cm, prepared, ch, bias) { var place = nodeAndOffsetInLineMap(prepared.map, ch, bias) var node = place.node, start = place.start, end = place.end, collapse = place.collapse var rect if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates. for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start } while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end } if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) { rect = node.parentNode.getBoundingClientRect() } else { rect = getUsefulRect(range(node, start, end).getClientRects(), bias) } if (rect.left || rect.right || start == 0) { break } end = start start = start - 1 collapse = "right" } if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect) } } else { // If it is a widget, simply get the box for the whole widget. if (start > 0) { collapse = bias = "right" } var rects if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) { rect = rects[bias == "right" ? rects.length - 1 : 0] } else { rect = node.getBoundingClientRect() } } if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) { var rSpan = node.parentNode.getClientRects()[0] if (rSpan) { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom} } else { rect = nullRect } } var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top var mid = (rtop + rbot) / 2 var heights = prepared.view.measure.heights var i = 0 for (; i < heights.length - 1; i++) { if (mid < heights[i]) { break } } var top = i ? heights[i - 1] : 0, bot = heights[i] var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left, right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left, top: top, bottom: bot} if (!rect.left && !rect.right) { result.bogus = true } if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot } return result } // Work around problem with bounding client rects on ranges being // returned incorrectly when zoomed on IE10 and below. function maybeUpdateRectForZooming(measure, rect) { if (!window.screen || screen.logicalXDPI == null || screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) { return rect } var scaleX = screen.logicalXDPI / screen.deviceXDPI var scaleY = screen.logicalYDPI / screen.deviceYDPI return {left: rect.left * scaleX, right: rect.right * scaleX, top: rect.top * scaleY, bottom: rect.bottom * scaleY} } function clearLineMeasurementCacheFor(lineView) { if (lineView.measure) { lineView.measure.cache = {} lineView.measure.heights = null if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) { lineView.measure.caches[i] = {} } } } } function clearLineMeasurementCache(cm) { cm.display.externalMeasure = null removeChildren(cm.display.lineMeasure) for (var i = 0; i < cm.display.view.length; i++) { clearLineMeasurementCacheFor(cm.display.view[i]) } } function clearCaches(cm) { clearLineMeasurementCache(cm) cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true } cm.display.lineNumChars = null } function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft } function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop } // Converts a {top, bottom, left, right} box from line-local // coordinates into another coordinate system. Context may be one of // "line", "div" (display.lineDiv), "local"./null (editor), "window", // or "page". function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) { if (!includeWidgets && lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) { var size = widgetHeight(lineObj.widgets[i]) rect.top += size; rect.bottom += size } } } if (context == "line") { return rect } if (!context) { context = "local" } var yOff = heightAtLine(lineObj) if (context == "local") { yOff += paddingTop(cm.display) } else { yOff -= cm.display.viewOffset } if (context == "page" || context == "window") { var lOff = cm.display.lineSpace.getBoundingClientRect() yOff += lOff.top + (context == "window" ? 0 : pageScrollY()) var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()) rect.left += xOff; rect.right += xOff } rect.top += yOff; rect.bottom += yOff return rect } // Coverts a box from "div" coords to another coordinate system. // Context may be "window", "page", "div", or "local"./null. function fromCoordSystem(cm, coords, context) { if (context == "div") { return coords } var left = coords.left, top = coords.top // First move into "page" coordinate system if (context == "page") { left -= pageScrollX() top -= pageScrollY() } else if (context == "local" || !context) { var localBox = cm.display.sizer.getBoundingClientRect() left += localBox.left top += localBox.top } var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect() return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top} } function charCoords(cm, pos, context, lineObj, bias) { if (!lineObj) { lineObj = getLine(cm.doc, pos.line) } return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context) } // Returns a box for a given cursor position, which may have an // 'other' property containing the position of the secondary cursor // on a bidi boundary. // A cursor Pos(line, char, "before") is on the same visual line as `char - 1` // and after `char - 1` in writing order of `char - 1` // A cursor Pos(line, char, "after") is on the same visual line as `char` // and before `char` in writing order of `char` // Examples (upper-case letters are RTL, lower-case are LTR): // Pos(0, 1, ...) // before after // ab a|b a|b // aB a|B aB| // Ab |Ab A|b // AB B|A B|A // Every position after the last character on a line is considered to stick // to the last character on the line. function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) { lineObj = lineObj || getLine(cm.doc, pos.line) if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj) } function get(ch, right) { var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight) if (right) { m.left = m.right; } else { m.right = m.left } return intoCoordSystem(cm, lineObj, m, context) } var order = getOrder(lineObj), ch = pos.ch, sticky = pos.sticky if (ch >= lineObj.text.length) { ch = lineObj.text.length sticky = "before" } else if (ch <= 0) { ch = 0 sticky = "after" } if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") } function getBidi(ch, partPos, invert) { var part = order[partPos], right = (part.level % 2) != 0 return get(invert ? ch - 1 : ch, right != invert) } var partPos = getBidiPartAt(order, ch, sticky) var other = bidiOther var val = getBidi(ch, partPos, sticky == "before") if (other != null) { val.other = getBidi(ch, other, sticky != "before") } return val } // Used to cheaply estimate the coordinates for a position. Used for // intermediate scroll updates. function estimateCoords(cm, pos) { var left = 0 pos = clipPos(cm.doc, pos) if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch } var lineObj = getLine(cm.doc, pos.line) var top = heightAtLine(lineObj) + paddingTop(cm.display) return {left: left, right: left, top: top, bottom: top + lineObj.height} } // Positions returned by coordsChar contain some extra information. // xRel is the relative x position of the input coordinates compared // to the found position (so xRel > 0 means the coordinates are to // the right of the character position, for example). When outside // is true, that means the coordinates lie outside the line's // vertical range. function PosWithInfo(line, ch, sticky, outside, xRel) { var pos = Pos(line, ch, sticky) pos.xRel = xRel if (outside) { pos.outside = true } return pos } // Compute the character position closest to the given coordinates. // Input must be lineSpace-local ("div" coordinate system). function coordsChar(cm, x, y) { var doc = cm.doc y += cm.display.viewOffset if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) } var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1 if (lineN > last) { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) } if (x < 0) { x = 0 } var lineObj = getLine(doc, lineN) for (;;) { var found = coordsCharInner(cm, lineObj, lineN, x, y) var merged = collapsedSpanAtEnd(lineObj) var mergedPos = merged && merged.find(0, true) if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0)) { lineN = lineNo(lineObj = mergedPos.to.line) } else { return found } } } function wrappedLineExtent(cm, lineObj, preparedMeasure, y) { var measure = function (ch) { return intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); } var end = lineObj.text.length var begin = findFirst(function (ch) { return measure(ch - 1).bottom <= y; }, end, 0) end = findFirst(function (ch) { return measure(ch).top > y; }, begin, end) return {begin: begin, end: end} } function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) { var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop) } function coordsCharInner(cm, lineObj, lineNo, x, y) { y -= heightAtLine(lineObj) var begin = 0, end = lineObj.text.length var preparedMeasure = prepareMeasureForLine(cm, lineObj) var pos var order = getOrder(lineObj) if (order) { if (cm.options.lineWrapping) { ;var assign; ((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign)) } pos = new Pos(lineNo, begin) var beginLeft = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left var dir = beginLeft < x ? 1 : -1 var prevDiff, diff = beginLeft - x, prevPos do { prevDiff = diff prevPos = pos pos = moveVisually(cm, lineObj, pos, dir) if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) { pos = prevPos break } diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x } while ((dir < 0) != (diff < 0) && (Math.abs(diff) <= Math.abs(prevDiff))) if (Math.abs(diff) > Math.abs(prevDiff)) { if ((diff < 0) == (prevDiff < 0)) { throw new Error("Broke out of infinite loop in coordsCharInner") } pos = prevPos } } else { var ch = findFirst(function (ch) { var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line") if (box.top > y) { // For the cursor stickiness end = Math.min(ch, end) return true } else if (box.bottom <= y) { return false } else if (box.left > x) { return true } else if (box.right < x) { return false } else { return (x - box.left < box.right - x) } }, begin, end) ch = skipExtendingChars(lineObj.text, ch, 1) pos = new Pos(lineNo, ch, ch == end ? "before" : "after") } var coords = cursorCoords(cm, pos, "line", lineObj, preparedMeasure) if (y < coords.top || coords.bottom < y) { pos.outside = true } pos.xRel = x < coords.left ? -1 : (x > coords.right ? 1 : 0) return pos } var measureText // Compute the default text height. function textHeight(display) { if (display.cachedTextHeight != null) { return display.cachedTextHeight } if (measureText == null) { measureText = elt("pre") // Measure a bunch of lines, for browsers that compute // fractional heights. for (var i = 0; i < 49; ++i) { measureText.appendChild(document.createTextNode("x")) measureText.appendChild(elt("br")) } measureText.appendChild(document.createTextNode("x")) } removeChildrenAndAdd(display.measure, measureText) var height = measureText.offsetHeight / 50 if (height > 3) { display.cachedTextHeight = height } removeChildren(display.measure) return height || 1 } // Compute the default character width. function charWidth(display) { if (display.cachedCharWidth != null) { return display.cachedCharWidth } var anchor = elt("span", "xxxxxxxxxx") var pre = elt("pre", [anchor]) removeChildrenAndAdd(display.measure, pre) var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10 if (width > 2) { display.cachedCharWidth = width } return width || 10 } // Do a bulk-read of the DOM positions and sizes needed to draw the // view, so that we don't interleave reading and writing to the DOM. function getDimensions(cm) { var d = cm.display, left = {}, width = {} var gutterLeft = d.gutters.clientLeft for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) { left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft width[cm.options.gutters[i]] = n.clientWidth } return {fixedPos: compensateForHScroll(d), gutterTotalWidth: d.gutters.offsetWidth, gutterLeft: left, gutterWidth: width, wrapperWidth: d.wrapper.clientWidth} } // Computes display.scroller.scrollLeft + display.gutters.offsetWidth, // but using getBoundingClientRect to get a sub-pixel-accurate // result. function compensateForHScroll(display) { return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left } // Returns a function that estimates the height of a line, to use as // first approximation until the line becomes visible (and is thus // properly measurable). function estimateHeight(cm) { var th = textHeight(cm.display), wrapping = cm.options.lineWrapping var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3) return function (line) { if (lineIsHidden(cm.doc, line)) { return 0 } var widgetsHeight = 0 if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) { if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height } } } if (wrapping) { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th } else { return widgetsHeight + th } } } function estimateLineHeights(cm) { var doc = cm.doc, est = estimateHeight(cm) doc.iter(function (line) { var estHeight = est(line) if (estHeight != line.height) { updateLineHeight(line, estHeight) } }) } // Given a mouse event, find the corresponding position. If liberal // is false, it checks whether a gutter or scrollbar was clicked, // and returns null if it was. forRect is used by rectangular // selections, and tries to estimate a character position even for // coordinates beyond the right of the text. function posFromMouse(cm, e, liberal, forRect) { var display = cm.display if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null } var x, y, space = display.lineSpace.getBoundingClientRect() // Fails unpredictably on IE[67] when mouse is dragged around quickly. try { x = e.clientX - space.left; y = e.clientY - space.top } catch (e) { return null } var coords = coordsChar(cm, x, y), line if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) { var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff)) } return coords } // Find the view element corresponding to a given line. Return null // when the line isn't visible. function findViewIndex(cm, n) { if (n >= cm.display.viewTo) { return null } n -= cm.display.viewFrom if (n < 0) { return null } var view = cm.display.view for (var i = 0; i < view.length; i++) { n -= view[i].size if (n < 0) { return i } } } function updateSelection(cm) { cm.display.input.showSelection(cm.display.input.prepareSelection()) } function prepareSelection(cm, primary) { var doc = cm.doc, result = {} var curFragment = result.cursors = document.createDocumentFragment() var selFragment = result.selection = document.createDocumentFragment() for (var i = 0; i < doc.sel.ranges.length; i++) { if (primary === false && i == doc.sel.primIndex) { continue } var range = doc.sel.ranges[i] if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue } var collapsed = range.empty() if (collapsed || cm.options.showCursorWhenSelecting) { drawSelectionCursor(cm, range.head, curFragment) } if (!collapsed) { drawSelectionRange(cm, range, selFragment) } } return result } // Draws a cursor for the given range function drawSelectionCursor(cm, head, output) { var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine) var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")) cursor.style.left = pos.left + "px" cursor.style.top = pos.top + "px" cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px" if (pos.other) { // Secondary cursor, shown when on a 'jump' in bi-directional text var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")) otherCursor.style.display = "" otherCursor.style.left = pos.other.left + "px" otherCursor.style.top = pos.other.top + "px" otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px" } } // Draws the given range as a highlighted selection function drawSelectionRange(cm, range, output) { var display = cm.display, doc = cm.doc var fragment = document.createDocumentFragment() var padding = paddingH(cm.display), leftSide = padding.left var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right function add(left, top, width, bottom) { if (top < 0) { top = 0 } top = Math.round(top) bottom = Math.round(bottom) fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px"))) } function drawForLine(line, fromArg, toArg) { var lineObj = getLine(doc, line) var lineLen = lineObj.text.length var start, end function coords(ch, bias) { return charCoords(cm, Pos(line, ch), "div", lineObj, bias) } iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) { var leftPos = coords(from, "left"), rightPos, left, right if (from == to) { rightPos = leftPos left = right = leftPos.left } else { rightPos = coords(to - 1, "right") if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp } left = leftPos.left right = rightPos.right } if (fromArg == null && from == 0) { left = leftSide } if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part add(left, leftPos.top, null, leftPos.bottom) left = leftSide if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top) } } if (toArg == null && to == lineLen) { right = rightSide } if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left) { start = leftPos } if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right) { end = rightPos } if (left < leftSide + 1) { left = leftSide } add(left, rightPos.top, right - left, rightPos.bottom) }) return {start: start, end: end} } var sFrom = range.from(), sTo = range.to() if (sFrom.line == sTo.line) { drawForLine(sFrom.line, sFrom.ch, sTo.ch) } else { var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line) var singleVLine = visualLine(fromLine) == visualLine(toLine) var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start if (singleVLine) { if (leftEnd.top < rightStart.top - 2) { add(leftEnd.right, leftEnd.top, null, leftEnd.bottom) add(leftSide, rightStart.top, rightStart.left, rightStart.bottom) } else { add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom) } } if (leftEnd.bottom < rightStart.top) { add(leftSide, leftEnd.bottom, null, rightStart.top) } } output.appendChild(fragment) } // Cursor-blinking function restartBlink(cm) { if (!cm.state.focused) { return } var display = cm.display clearInterval(display.blinker) var on = true display.cursorDiv.style.visibility = "" if (cm.options.cursorBlinkRate > 0) { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; }, cm.options.cursorBlinkRate) } else if (cm.options.cursorBlinkRate < 0) { display.cursorDiv.style.visibility = "hidden" } } function ensureFocus(cm) { if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) } } function delayBlurEvent(cm) { cm.state.delayingBlurEvent = true setTimeout(function () { if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false onBlur(cm) } }, 100) } function onFocus(cm, e) { if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false } if (cm.options.readOnly == "nocursor") { return } if (!cm.state.focused) { signal(cm, "focus", cm, e) cm.state.focused = true addClass(cm.display.wrapper, "CodeMirror-focused") // This test prevents this from firing when a context // menu is closed (since the input reset would kill the // select-all detection hack) if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) { cm.display.input.reset() if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20) } // Issue #1730 } cm.display.input.receivedFocus() } restartBlink(cm) } function onBlur(cm, e) { if (cm.state.delayingBlurEvent) { return } if (cm.state.focused) { signal(cm, "blur", cm, e) cm.state.focused = false rmClass(cm.display.wrapper, "CodeMirror-focused") } clearInterval(cm.display.blinker) setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false } }, 150) } // Re-align line numbers and gutter marks to compensate for // horizontal scrolling. function alignHorizontally(cm) { var display = cm.display, view = display.view if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return } var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft var gutterW = display.gutters.offsetWidth, left = comp + "px" for (var i = 0; i < view.length; i++) { if (!view[i].hidden) { if (cm.options.fixedGutter) { if (view[i].gutter) { view[i].gutter.style.left = left } if (view[i].gutterBackground) { view[i].gutterBackground.style.left = left } } var align = view[i].alignable if (align) { for (var j = 0; j < align.length; j++) { align[j].style.left = left } } } } if (cm.options.fixedGutter) { display.gutters.style.left = (comp + gutterW) + "px" } } // Used to ensure that the line number gutter is still the right // size for the current document size. Returns true when an update // is needed. function maybeUpdateLineNumberWidth(cm) { if (!cm.options.lineNumbers) { return false } var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display if (last.length != display.lineNumChars) { var test = display.measure.appendChild(elt("div", [elt("div", last)], "CodeMirror-linenumber CodeMirror-gutter-elt")) var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW display.lineGutter.style.width = "" display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1 display.lineNumWidth = display.lineNumInnerWidth + padding display.lineNumChars = display.lineNumInnerWidth ? last.length : -1 display.lineGutter.style.width = display.lineNumWidth + "px" updateGutterSpace(cm) return true } return false } // Read the actual heights of the rendered lines, and update their // stored heights to match. function updateHeightsInViewport(cm) { var display = cm.display var prevBottom = display.lineDiv.offsetTop for (var i = 0; i < display.view.length; i++) { var cur = display.view[i], height = (void 0) if (cur.hidden) { continue } if (ie && ie_version < 8) { var bot = cur.node.offsetTop + cur.node.offsetHeight height = bot - prevBottom prevBottom = bot } else { var box = cur.node.getBoundingClientRect() height = box.bottom - box.top } var diff = cur.line.height - height if (height < 2) { height = textHeight(display) } if (diff > .001 || diff < -.001) { updateLineHeight(cur.line, height) updateWidgetHeight(cur.line) if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) { updateWidgetHeight(cur.rest[j]) } } } } } // Read and store the height of line widgets associated with the // given line. function updateWidgetHeight(line) { if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight } } } // Compute the lines that are visible in a given viewport (defaults // the the current scroll position). viewport may contain top, // height, and ensure (see op.scrollToPos) properties. function visibleLines(display, doc, viewport) { var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop top = Math.floor(top - paddingTop(display)) var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom) // Ensure is a {from: {line, ch}, to: {line, ch}} object, and // forces those lines into the viewport (if possible). if (viewport && viewport.ensure) { var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line if (ensureFrom < from) { from = ensureFrom to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight) } else if (Math.min(ensureTo, doc.lastLine()) >= to) { from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight) to = ensureTo } } return {from: from, to: Math.max(to, from + 1)} } // Sync the scrollable area and scrollbars, ensure the viewport // covers the visible area. function setScrollTop(cm, val) { if (Math.abs(cm.doc.scrollTop - val) < 2) { return } cm.doc.scrollTop = val if (!gecko) { updateDisplaySimple(cm, {top: val}) } if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val } cm.display.scrollbars.setScrollTop(val) if (gecko) { updateDisplaySimple(cm) } startWorker(cm, 100) } // Sync scroller and scrollbar, ensure the gutter elements are // aligned. function setScrollLeft(cm, val, isScroller) { if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) { return } val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth) cm.doc.scrollLeft = val alignHorizontally(cm) if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val } cm.display.scrollbars.setScrollLeft(val) } // Since the delta values reported on mouse wheel events are // unstandardized between browsers and even browser versions, and // generally horribly unpredictable, this code starts by measuring // the scroll effect that the first few mouse wheel events have, // and, from that, detects the way it can convert deltas to pixel // offsets afterwards. // // The reason we want to know the amount a wheel event will scroll // is that it gives us a chance to update the display before the // actual scrolling happens, reducing flickering. var wheelSamples = 0; var wheelPixelsPerUnit = null; // Fill in a browser-detected starting value on browsers where we // know one. These don't have to be accurate -- the result of them // being wrong would just be a slight flicker on the first wheel // scroll (if it is large enough). if (ie) { wheelPixelsPerUnit = -.53 } else if (gecko) { wheelPixelsPerUnit = 15 } else if (chrome) { wheelPixelsPerUnit = -.7 } else if (safari) { wheelPixelsPerUnit = -1/3 } function wheelEventDelta(e) { var dx = e.wheelDeltaX, dy = e.wheelDeltaY if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail } if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail } else if (dy == null) { dy = e.wheelDelta } return {x: dx, y: dy} } function wheelEventPixels(e) { var delta = wheelEventDelta(e) delta.x *= wheelPixelsPerUnit delta.y *= wheelPixelsPerUnit return delta } function onScrollWheel(cm, e) { var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y var display = cm.display, scroll = display.scroller // Quit if there's nothing to scroll here var canScrollX = scroll.scrollWidth > scroll.clientWidth var canScrollY = scroll.scrollHeight > scroll.clientHeight if (!(dx && canScrollX || dy && canScrollY)) { return } // Webkit browsers on OS X abort momentum scrolls when the target // of the scroll event is removed from the scrollable element. // This hack (see related code in patchDisplay) makes sure the // element is kept around. if (dy && mac && webkit) { outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) { for (var i = 0; i < view.length; i++) { if (view[i].node == cur) { cm.display.currentWheelTarget = cur break outer } } } } // On some browsers, horizontal scrolling will cause redraws to // happen before the gutter has been realigned, causing it to // wriggle around in a most unseemly way. When we have an // estimated pixels/delta value, we just handle horizontal // scrolling entirely here. It'll be slightly off from native, but // better than glitching out. if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { if (dy && canScrollY) { setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))) } setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth))) // Only prevent default scrolling if vertical scrolling is // actually possible. Otherwise, it causes vertical scroll // jitter on OSX trackpads when deltaX is small and deltaY // is large (issue #3579) if (!dy || (dy && canScrollY)) { e_preventDefault(e) } display.wheelStartX = null // Abort measurement, if in progress return } // 'Project' the visible viewport to cover the area that is being // scrolled into view (if we know enough to estimate it). if (dy && wheelPixelsPerUnit != null) { var pixels = dy * wheelPixelsPerUnit var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight if (pixels < 0) { top = Math.max(0, top + pixels - 50) } else { bot = Math.min(cm.doc.height, bot + pixels + 50) } updateDisplaySimple(cm, {top: top, bottom: bot}) } if (wheelSamples < 20) { if (display.wheelStartX == null) { display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop display.wheelDX = dx; display.wheelDY = dy setTimeout(function () { if (display.wheelStartX == null) { return } var movedX = scroll.scrollLeft - display.wheelStartX var movedY = scroll.scrollTop - display.wheelStartY var sample = (movedY && display.wheelDY && movedY / display.wheelDY) || (movedX && display.wheelDX && movedX / display.wheelDX) display.wheelStartX = display.wheelStartY = null if (!sample) { return } wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1) ++wheelSamples }, 200) } else { display.wheelDX += dx; display.wheelDY += dy } } } // SCROLLBARS // Prepare DOM reads needed to update the scrollbars. Done in one // shot to minimize update/measure roundtrips. function measureForScrollbars(cm) { var d = cm.display, gutterW = d.gutters.offsetWidth var docH = Math.round(cm.doc.height + paddingVert(cm.display)) return { clientHeight: d.scroller.clientHeight, viewHeight: d.wrapper.clientHeight, scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth, viewWidth: d.wrapper.clientWidth, barLeft: cm.options.fixedGutter ? gutterW : 0, docHeight: docH, scrollHeight: docH + scrollGap(cm) + d.barHeight, nativeBarWidth: d.nativeBarWidth, gutterWidth: gutterW } } var NativeScrollbars = function(place, scroll, cm) { this.cm = cm var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar") var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar") place(vert); place(horiz) on(vert, "scroll", function () { if (vert.clientHeight) { scroll(vert.scrollTop, "vertical") } }) on(horiz, "scroll", function () { if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal") } }) this.checkedZeroWidth = false // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px" } }; NativeScrollbars.prototype.update = function (measure) { var needsH = measure.scrollWidth > measure.clientWidth + 1 var needsV = measure.scrollHeight > measure.clientHeight + 1 var sWidth = measure.nativeBarWidth if (needsV) { this.vert.style.display = "block" this.vert.style.bottom = needsH ? sWidth + "px" : "0" var totalHeight = measure.viewHeight - (needsH ? sWidth : 0) // A bug in IE8 can cause this value to be negative, so guard it. this.vert.firstChild.style.height = Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px" } else { this.vert.style.display = "" this.vert.firstChild.style.height = "0" } if (needsH) { this.horiz.style.display = "block" this.horiz.style.right = needsV ? sWidth + "px" : "0" this.horiz.style.left = measure.barLeft + "px" var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0) this.horiz.firstChild.style.width = Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px" } else { this.horiz.style.display = "" this.horiz.firstChild.style.width = "0" } if (!this.checkedZeroWidth && measure.clientHeight > 0) { if (sWidth == 0) { this.zeroWidthHack() } this.checkedZeroWidth = true } return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0} }; NativeScrollbars.prototype.setScrollLeft = function (pos) { if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos } if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz) } }; NativeScrollbars.prototype.setScrollTop = function (pos) { if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos } if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert) } }; NativeScrollbars.prototype.zeroWidthHack = function () { var w = mac && !mac_geMountainLion ? "12px" : "18px" this.horiz.style.height = this.vert.style.width = w this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none" this.disableHoriz = new Delayed this.disableVert = new Delayed }; NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay) { bar.style.pointerEvents = "auto" function maybeDisable() { // To find out whether the scrollbar is still visible, we // check whether the element under the pixel in the bottom // left corner of the scrollbar box is the scrollbar box // itself (when the bar is still visible) or its filler child // (when the bar is hidden). If it is still visible, we keep // it enabled, if it's hidden, we disable pointer events. var box = bar.getBoundingClientRect() var elt = document.elementFromPoint(box.left + 1, box.bottom - 1) if (elt != bar) { bar.style.pointerEvents = "none" } else { delay.set(1000, maybeDisable) } } delay.set(1000, maybeDisable) }; NativeScrollbars.prototype.clear = function () { var parent = this.horiz.parentNode parent.removeChild(this.horiz) parent.removeChild(this.vert) }; var NullScrollbars = function () {}; NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} }; NullScrollbars.prototype.setScrollLeft = function () {}; NullScrollbars.prototype.setScrollTop = function () {}; NullScrollbars.prototype.clear = function () {}; function updateScrollbars(cm, measure) { if (!measure) { measure = measureForScrollbars(cm) } var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight updateScrollbarsInner(cm, measure) for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) { if (startWidth != cm.display.barWidth && cm.options.lineWrapping) { updateHeightsInViewport(cm) } updateScrollbarsInner(cm, measureForScrollbars(cm)) startWidth = cm.display.barWidth; startHeight = cm.display.barHeight } } // Re-synchronize the fake scrollbars with the actual size of the // content. function updateScrollbarsInner(cm, measure) { var d = cm.display var sizes = d.scrollbars.update(measure) d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px" d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px" d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent" if (sizes.right && sizes.bottom) { d.scrollbarFiller.style.display = "block" d.scrollbarFiller.style.height = sizes.bottom + "px" d.scrollbarFiller.style.width = sizes.right + "px" } else { d.scrollbarFiller.style.display = "" } if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) { d.gutterFiller.style.display = "block" d.gutterFiller.style.height = sizes.bottom + "px" d.gutterFiller.style.width = measure.gutterWidth + "px" } else { d.gutterFiller.style.display = "" } } var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars} function initScrollbars(cm) { if (cm.display.scrollbars) { cm.display.scrollbars.clear() if (cm.display.scrollbars.addClass) { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass) } } cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) { cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller) // Prevent clicks in the scrollbars from killing focus on(node, "mousedown", function () { if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0) } }) node.setAttribute("cm-not-content", "true") }, function (pos, axis) { if (axis == "horizontal") { setScrollLeft(cm, pos) } else { setScrollTop(cm, pos) } }, cm) if (cm.display.scrollbars.addClass) { addClass(cm.display.wrapper, cm.display.scrollbars.addClass) } } // SCROLLING THINGS INTO VIEW // If an editor sits on the top or bottom of the window, partially // scrolled out of view, this ensures that the cursor is visible. function maybeScrollWindow(cm, coords) { if (signalDOMEvent(cm, "scrollCursorIntoView")) { return } var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null if (coords.top + box.top < 0) { doScroll = true } else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false } if (doScroll != null && !phantom) { var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (coords.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (coords.left) + "px; width: 2px;")) cm.display.lineSpace.appendChild(scrollNode) scrollNode.scrollIntoView(doScroll) cm.display.lineSpace.removeChild(scrollNode) } } // Scroll a given position into view (immediately), verifying that // it actually became visible (as line heights are accurately // measured, the position of something may 'drift' during drawing). function scrollPosIntoView(cm, pos, end, margin) { if (margin == null) { margin = 0 } var coords for (var limit = 0; limit < 5; limit++) { var changed = false coords = cursorCoords(cm, pos) var endCoords = !end || end == pos ? coords : cursorCoords(cm, end) var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left), Math.min(coords.top, endCoords.top) - margin, Math.max(coords.left, endCoords.left), Math.max(coords.bottom, endCoords.bottom) + margin) var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop) if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true } } if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft) if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true } } if (!changed) { break } } return coords } // Scroll a given set of coordinates into view (immediately). function scrollIntoView(cm, x1, y1, x2, y2) { var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2) if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop) } if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft) } } // Calculate a new scroll position needed to scroll the given // rectangle into view. Returns an object with scrollTop and // scrollLeft properties. When these are undefined, the // vertical/horizontal position does not need to be adjusted. function calculateScrollPos(cm, x1, y1, x2, y2) { var display = cm.display, snapMargin = textHeight(cm.display) if (y1 < 0) { y1 = 0 } var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop var screen = displayHeight(cm), result = {} if (y2 - y1 > screen) { y2 = y1 + screen } var docBottom = cm.doc.height + paddingVert(display) var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin if (y1 < screentop) { result.scrollTop = atTop ? 0 : y1 } else if (y2 > screentop + screen) { var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen) if (newTop != screentop) { result.scrollTop = newTop } } var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0) var tooWide = x2 - x1 > screenw if (tooWide) { x2 = x1 + screenw } if (x1 < 10) { result.scrollLeft = 0 } else if (x1 < screenleft) { result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10)) } else if (x2 > screenw + screenleft - 3) { result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw } return result } // Store a relative adjustment to the scroll position in the current // operation (to be applied when the operation finishes). function addToScrollPos(cm, left, top) { if (left != null || top != null) { resolveScrollToPos(cm) } if (left != null) { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left } if (top != null) { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top } } // Make sure that at the end of the operation the current cursor is // shown. function ensureCursorVisible(cm) { resolveScrollToPos(cm) var cur = cm.getCursor(), from = cur, to = cur if (!cm.options.lineWrapping) { from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur to = Pos(cur.line, cur.ch + 1) } cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true} } // When an operation has its scrollToPos property set, and another // scroll action is applied before the end of the operation, this // 'simulates' scrolling that position into view in a cheap way, so // that the effect of intermediate scroll commands is not ignored. function resolveScrollToPos(cm) { var range = cm.curOp.scrollToPos if (range) { cm.curOp.scrollToPos = null var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to) var sPos = calculateScrollPos(cm, Math.min(from.left, to.left), Math.min(from.top, to.top) - range.margin, Math.max(from.right, to.right), Math.max(from.bottom, to.bottom) + range.margin) cm.scrollTo(sPos.scrollLeft, sPos.scrollTop) } } // Operations are used to wrap a series of changes to the editor // state in such a way that each change won't have to update the // cursor and display (which would be awkward, slow, and // error-prone). Instead, display updates are batched and then all // combined and executed at once. var nextOpId = 0 // Start a new operation. function startOperation(cm) { cm.curOp = { cm: cm, viewChanged: false, // Flag that indicates that lines might need to be redrawn startHeight: cm.doc.height, // Used to detect need to update scrollbar forceUpdate: false, // Used to force a redraw updateInput: null, // Whether to reset the input textarea typing: false, // Whether this reset should be careful to leave existing text (for compositing) changeObjs: null, // Accumulated changes, for firing change events cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already selectionChanged: false, // Whether the selection needs to be redrawn updateMaxLine: false, // Set when the widest line needs to be determined anew scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet scrollToPos: null, // Used to scroll to a specific position focus: false, id: ++nextOpId // Unique ID } pushOperation(cm.curOp) } // Finish an operation, updating the display and signalling delayed events function endOperation(cm) { var op = cm.curOp finishOperation(op, function (group) { for (var i = 0; i < group.ops.length; i++) { group.ops[i].cm.curOp = null } endOperations(group) }) } // The DOM updates done when an operation finishes are batched so // that the minimum number of relayouts are required. function endOperations(group) { var ops = group.ops for (var i = 0; i < ops.length; i++) // Read DOM { endOperation_R1(ops[i]) } for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe) { endOperation_W1(ops[i$1]) } for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM { endOperation_R2(ops[i$2]) } for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe) { endOperation_W2(ops[i$3]) } for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM { endOperation_finish(ops[i$4]) } } function endOperation_R1(op) { var cm = op.cm, display = cm.display maybeClipScrollbars(cm) if (op.updateMaxLine) { findMaxLine(cm) } op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null || op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom || op.scrollToPos.to.line >= display.viewTo) || display.maxLineChanged && cm.options.lineWrapping op.update = op.mustUpdate && new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate) } function endOperation_W1(op) { op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update) } function endOperation_R2(op) { var cm = op.cm, display = cm.display if (op.updatedDisplay) { updateHeightsInViewport(cm) } op.barMeasure = measureForScrollbars(cm) // If the max line changed since it was last measured, measure it, // and ensure the document's width matches it. // updateDisplay_W2 will use these properties to do the actual resizing if (display.maxLineChanged && !cm.options.lineWrapping) { op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3 cm.display.sizerWidth = op.adjustWidthTo op.barMeasure.scrollWidth = Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth) op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm)) } if (op.updatedDisplay || op.selectionChanged) { op.preparedSelection = display.input.prepareSelection(op.focus) } } function endOperation_W2(op) { var cm = op.cm if (op.adjustWidthTo != null) { cm.display.sizer.style.minWidth = op.adjustWidthTo + "px" if (op.maxScrollLeft < cm.doc.scrollLeft) { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true) } cm.display.maxLineChanged = false } var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus()) if (op.preparedSelection) { cm.display.input.showSelection(op.preparedSelection, takeFocus) } if (op.updatedDisplay || op.startHeight != cm.doc.height) { updateScrollbars(cm, op.barMeasure) } if (op.updatedDisplay) { setDocumentHeight(cm, op.barMeasure) } if (op.selectionChanged) { restartBlink(cm) } if (cm.state.focused && op.updateInput) { cm.display.input.reset(op.typing) } if (takeFocus) { ensureFocus(op.cm) } } function endOperation_finish(op) { var cm = op.cm, display = cm.display, doc = cm.doc if (op.updatedDisplay) { postUpdateDisplay(cm, op.update) } // Abort mouse wheel delta measurement, when scrolling explicitly if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos)) { display.wheelStartX = display.wheelStartY = null } // Propagate the scroll position to the actual DOM scroller if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) { doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop)) display.scrollbars.setScrollTop(doc.scrollTop) display.scroller.scrollTop = doc.scrollTop } if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) { doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft)) display.scrollbars.setScrollLeft(doc.scrollLeft) display.scroller.scrollLeft = doc.scrollLeft alignHorizontally(cm) } // If we need to scroll a specific position into view, do so. if (op.scrollToPos) { var coords = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from), clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin) if (op.scrollToPos.isCursor && cm.state.focused) { maybeScrollWindow(cm, coords) } } // Fire events for markers that are hidden/unidden by editing or // undoing var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers if (hidden) { for (var i = 0; i < hidden.length; ++i) { if (!hidden[i].lines.length) { signal(hidden[i], "hide") } } } if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1) { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide") } } } if (display.wrapper.offsetHeight) { doc.scrollTop = cm.display.scroller.scrollTop } // Fire change events, and delayed event handlers if (op.changeObjs) { signal(cm, "changes", cm, op.changeObjs) } if (op.update) { op.update.finish() } } // Run the given function in an operation function runInOp(cm, f) { if (cm.curOp) { return f() } startOperation(cm) try { return f() } finally { endOperation(cm) } } // Wraps a function in an operation. Returns the wrapped function. function operation(cm, f) { return function() { if (cm.curOp) { return f.apply(cm, arguments) } startOperation(cm) try { return f.apply(cm, arguments) } finally { endOperation(cm) } } } // Used to add methods to editor and doc instances, wrapping them in // operations. function methodOp(f) { return function() { if (this.curOp) { return f.apply(this, arguments) } startOperation(this) try { return f.apply(this, arguments) } finally { endOperation(this) } } } function docMethodOp(f) { return function() { var cm = this.cm if (!cm || cm.curOp) { return f.apply(this, arguments) } startOperation(cm) try { return f.apply(this, arguments) } finally { endOperation(cm) } } } // Updates the display.view data structure for a given change to the // document. From and to are in pre-change coordinates. Lendiff is // the amount of lines added or subtracted by the change. This is // used for changes that span multiple lines, or change the way // lines are divided into visual lines. regLineChange (below) // registers single-line changes. function regChange(cm, from, to, lendiff) { if (from == null) { from = cm.doc.first } if (to == null) { to = cm.doc.first + cm.doc.size } if (!lendiff) { lendiff = 0 } var display = cm.display if (lendiff && to < display.viewTo && (display.updateLineNumbers == null || display.updateLineNumbers > from)) { display.updateLineNumbers = from } cm.curOp.viewChanged = true if (from >= display.viewTo) { // Change after if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) { resetView(cm) } } else if (to <= display.viewFrom) { // Change before if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) { resetView(cm) } else { display.viewFrom += lendiff display.viewTo += lendiff } } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap resetView(cm) } else if (from <= display.viewFrom) { // Top overlap var cut = viewCuttingPoint(cm, to, to + lendiff, 1) if (cut) { display.view = display.view.slice(cut.index) display.viewFrom = cut.lineN display.viewTo += lendiff } else { resetView(cm) } } else if (to >= display.viewTo) { // Bottom overlap var cut$1 = viewCuttingPoint(cm, from, from, -1) if (cut$1) { display.view = display.view.slice(0, cut$1.index) display.viewTo = cut$1.lineN } else { resetView(cm) } } else { // Gap in the middle var cutTop = viewCuttingPoint(cm, from, from, -1) var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1) if (cutTop && cutBot) { display.view = display.view.slice(0, cutTop.index) .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN)) .concat(display.view.slice(cutBot.index)) display.viewTo += lendiff } else { resetView(cm) } } var ext = display.externalMeasured if (ext) { if (to < ext.lineN) { ext.lineN += lendiff } else if (from < ext.lineN + ext.size) { display.externalMeasured = null } } } // Register a change to a single line. Type must be one of "text", // "gutter", "class", "widget" function regLineChange(cm, line, type) { cm.curOp.viewChanged = true var display = cm.display, ext = cm.display.externalMeasured if (ext && line >= ext.lineN && line < ext.lineN + ext.size) { display.externalMeasured = null } if (line < display.viewFrom || line >= display.viewTo) { return } var lineView = display.view[findViewIndex(cm, line)] if (lineView.node == null) { return } var arr = lineView.changes || (lineView.changes = []) if (indexOf(arr, type) == -1) { arr.push(type) } } // Clear the view. function resetView(cm) { cm.display.viewFrom = cm.display.viewTo = cm.doc.first cm.display.view = [] cm.display.viewOffset = 0 } function viewCuttingPoint(cm, oldN, newN, dir) { var index = findViewIndex(cm, oldN), diff, view = cm.display.view if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size) { return {index: index, lineN: newN} } var n = cm.display.viewFrom for (var i = 0; i < index; i++) { n += view[i].size } if (n != oldN) { if (dir > 0) { if (index == view.length - 1) { return null } diff = (n + view[index].size) - oldN index++ } else { diff = n - oldN } oldN += diff; newN += diff } while (visualLineNo(cm.doc, newN) != newN) { if (index == (dir < 0 ? 0 : view.length - 1)) { return null } newN += dir * view[index - (dir < 0 ? 1 : 0)].size index += dir } return {index: index, lineN: newN} } // Force the view to cover a given range, adding empty view element // or clipping off existing ones as needed. function adjustView(cm, from, to) { var display = cm.display, view = display.view if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) { display.view = buildViewArray(cm, from, to) display.viewFrom = from } else { if (display.viewFrom > from) { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view) } else if (display.viewFrom < from) { display.view = display.view.slice(findViewIndex(cm, from)) } display.viewFrom = from if (display.viewTo < to) { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)) } else if (display.viewTo > to) { display.view = display.view.slice(0, findViewIndex(cm, to)) } } display.viewTo = to } // Count the number of lines in the view whose DOM representation is // out of date (or nonexistent). function countDirtyView(cm) { var view = cm.display.view, dirty = 0 for (var i = 0; i < view.length; i++) { var lineView = view[i] if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty } } return dirty } // HIGHLIGHT WORKER function startWorker(cm, time) { if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo) { cm.state.highlight.set(time, bind(highlightWorker, cm)) } } function highlightWorker(cm) { var doc = cm.doc if (doc.frontier < doc.first) { doc.frontier = doc.first } if (doc.frontier >= cm.display.viewTo) { return } var end = +new Date + cm.options.workTime var state = copyState(doc.mode, getStateBefore(cm, doc.frontier)) var changedLines = [] doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) { if (doc.frontier >= cm.display.viewFrom) { // Visible var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true) line.styles = highlighted.styles var oldCls = line.styleClasses, newCls = highlighted.classes if (newCls) { line.styleClasses = newCls } else if (oldCls) { line.styleClasses = null } var ischange = !oldStyles || oldStyles.length != line.styles.length || oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass) for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i] } if (ischange) { changedLines.push(doc.frontier) } line.stateAfter = tooLong ? state : copyState(doc.mode, state) } else { if (line.text.length <= cm.options.maxHighlightLength) { processLine(cm, line.text, state) } line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null } ++doc.frontier if (+new Date > end) { startWorker(cm, cm.options.workDelay) return true } }) if (changedLines.length) { runInOp(cm, function () { for (var i = 0; i < changedLines.length; i++) { regLineChange(cm, changedLines[i], "text") } }) } } // DISPLAY DRAWING var DisplayUpdate = function(cm, viewport, force) { var display = cm.display this.viewport = viewport // Store some values that we'll need later (but don't want to force a relayout for) this.visible = visibleLines(display, cm.doc, viewport) this.editorIsHidden = !display.wrapper.offsetWidth this.wrapperHeight = display.wrapper.clientHeight this.wrapperWidth = display.wrapper.clientWidth this.oldDisplayWidth = displayWidth(cm) this.force = force this.dims = getDimensions(cm) this.events = [] }; DisplayUpdate.prototype.signal = function (emitter, type) { if (hasHandler(emitter, type)) { this.events.push(arguments) } }; DisplayUpdate.prototype.finish = function () { var this$1 = this; for (var i = 0; i < this.events.length; i++) { signal.apply(null, this$1.events[i]) } }; function maybeClipScrollbars(cm) { var display = cm.display if (!display.scrollbarsClipped && display.scroller.offsetWidth) { display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth display.heightForcer.style.height = scrollGap(cm) + "px" display.sizer.style.marginBottom = -display.nativeBarWidth + "px" display.sizer.style.borderRightWidth = scrollGap(cm) + "px" display.scrollbarsClipped = true } } // Does the actual updating of the line display. Bails out // (returning false) when there is nothing to be done and forced is // false. function updateDisplayIfNeeded(cm, update) { var display = cm.display, doc = cm.doc if (update.editorIsHidden) { resetView(cm) return false } // Bail out if the visible area is already rendered and nothing changed. if (!update.force && update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && display.renderedView == display.view && countDirtyView(cm) == 0) { return false } if (maybeUpdateLineNumberWidth(cm)) { resetView(cm) update.dims = getDimensions(cm) } // Compute a suitable new viewport (from & to) var end = doc.first + doc.size var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first) var to = Math.min(end, update.visible.to + cm.options.viewportMargin) if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom) } if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo) } if (sawCollapsedSpans) { from = visualLineNo(cm.doc, from) to = visualLineEndNo(cm.doc, to) } var different = from != display.viewFrom || to != display.viewTo || display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth adjustView(cm, from, to) display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom)) // Position the mover div to align with the current scroll position cm.display.mover.style.top = display.viewOffset + "px" var toUpdate = countDirtyView(cm) if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) { return false } // For big changes, we hide the enclosing element during the // update, since that speeds up the operations on most browsers. var focused = activeElt() if (toUpdate > 4) { display.lineDiv.style.display = "none" } patchDisplay(cm, display.updateLineNumbers, update.dims) if (toUpdate > 4) { display.lineDiv.style.display = "" } display.renderedView = display.view // There might have been a widget with a focused element that got // hidden or updated, if so re-focus it. if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus() } // Prevent selection and cursors from interfering with the scroll // width and height. removeChildren(display.cursorDiv) removeChildren(display.selectionDiv) display.gutters.style.height = display.sizer.style.minHeight = 0 if (different) { display.lastWrapHeight = update.wrapperHeight display.lastWrapWidth = update.wrapperWidth startWorker(cm, 400) } display.updateLineNumbers = null return true } function postUpdateDisplay(cm, update) { var viewport = update.viewport for (var first = true;; first = false) { if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) { // Clip forced viewport to actual scrollable area. if (viewport && viewport.top != null) { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)} } // Updated line heights might result in the drawn area not // actually covering the viewport. Keep looping until it does. update.visible = visibleLines(cm.display, cm.doc, viewport) if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo) { break } } if (!updateDisplayIfNeeded(cm, update)) { break } updateHeightsInViewport(cm) var barMeasure = measureForScrollbars(cm) updateSelection(cm) updateScrollbars(cm, barMeasure) setDocumentHeight(cm, barMeasure) } update.signal(cm, "update", cm) if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) { update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo) cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo } } function updateDisplaySimple(cm, viewport) { var update = new DisplayUpdate(cm, viewport) if (updateDisplayIfNeeded(cm, update)) { updateHeightsInViewport(cm) postUpdateDisplay(cm, update) var barMeasure = measureForScrollbars(cm) updateSelection(cm) updateScrollbars(cm, barMeasure) setDocumentHeight(cm, barMeasure) update.finish() } } // Sync the actual display DOM structure with display.view, removing // nodes for lines that are no longer in view, and creating the ones // that are not there yet, and updating the ones that are out of // date. function patchDisplay(cm, updateNumbersFrom, dims) { var display = cm.display, lineNumbers = cm.options.lineNumbers var container = display.lineDiv, cur = container.firstChild function rm(node) { var next = node.nextSibling // Works around a throw-scroll bug in OS X Webkit if (webkit && mac && cm.display.currentWheelTarget == node) { node.style.display = "none" } else { node.parentNode.removeChild(node) } return next } var view = display.view, lineN = display.viewFrom // Loop over the elements in the view, syncing cur (the DOM nodes // in display.lineDiv) with the view as we go. for (var i = 0; i < view.length; i++) { var lineView = view[i] if (lineView.hidden) { } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet var node = buildLineElement(cm, lineView, lineN, dims) container.insertBefore(node, cur) } else { // Already drawn while (cur != lineView.node) { cur = rm(cur) } var updateNumber = lineNumbers && updateNumbersFrom != null && updateNumbersFrom <= lineN && lineView.lineNumber if (lineView.changes) { if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false } updateLineForChanges(cm, lineView, lineN, dims) } if (updateNumber) { removeChildren(lineView.lineNumber) lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN))) } cur = lineView.node.nextSibling } lineN += lineView.size } while (cur) { cur = rm(cur) } } function updateGutterSpace(cm) { var width = cm.display.gutters.offsetWidth cm.display.sizer.style.marginLeft = width + "px" } function setDocumentHeight(cm, measure) { cm.display.sizer.style.minHeight = measure.docHeight + "px" cm.display.heightForcer.style.top = measure.docHeight + "px" cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px" } // Rebuild the gutter elements, ensure the margin to the left of the // code matches their width. function updateGutters(cm) { var gutters = cm.display.gutters, specs = cm.options.gutters removeChildren(gutters) var i = 0 for (; i < specs.length; ++i) { var gutterClass = specs[i] var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass)) if (gutterClass == "CodeMirror-linenumbers") { cm.display.lineGutter = gElt gElt.style.width = (cm.display.lineNumWidth || 1) + "px" } } gutters.style.display = i ? "" : "none" updateGutterSpace(cm) } // Make sure the gutters options contains the element // "CodeMirror-linenumbers" when the lineNumbers option is true. function setGuttersForLineNumbers(options) { var found = indexOf(options.gutters, "CodeMirror-linenumbers") if (found == -1 && options.lineNumbers) { options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]) } else if (found > -1 && !options.lineNumbers) { options.gutters = options.gutters.slice(0) options.gutters.splice(found, 1) } } // Selection objects are immutable. A new one is created every time // the selection changes. A selection is one or more non-overlapping // (and non-touching) ranges, sorted, and an integer that indicates // which one is the primary selection (the one that's scrolled into // view, that getCursor returns, etc). var Selection = function(ranges, primIndex) { this.ranges = ranges this.primIndex = primIndex }; Selection.prototype.primary = function () { return this.ranges[this.primIndex] }; Selection.prototype.equals = function (other) { var this$1 = this; if (other == this) { return true } if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false } for (var i = 0; i < this.ranges.length; i++) { var here = this$1.ranges[i], there = other.ranges[i] if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false } } return true }; Selection.prototype.deepCopy = function () { var this$1 = this; var out = [] for (var i = 0; i < this.ranges.length; i++) { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)) } return new Selection(out, this.primIndex) }; Selection.prototype.somethingSelected = function () { var this$1 = this; for (var i = 0; i < this.ranges.length; i++) { if (!this$1.ranges[i].empty()) { return true } } return false }; Selection.prototype.contains = function (pos, end) { var this$1 = this; if (!end) { end = pos } for (var i = 0; i < this.ranges.length; i++) { var range = this$1.ranges[i] if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0) { return i } } return -1 }; var Range = function(anchor, head) { this.anchor = anchor; this.head = head }; Range.prototype.from = function () { return minPos(this.anchor, this.head) }; Range.prototype.to = function () { return maxPos(this.anchor, this.head) }; Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch }; // Take an unsorted, potentially overlapping set of ranges, and // build a selection out of it. 'Consumes' ranges array (modifying // it). function normalizeSelection(ranges, primIndex) { var prim = ranges[primIndex] ranges.sort(function (a, b) { return cmp(a.from(), b.from()); }) primIndex = indexOf(ranges, prim) for (var i = 1; i < ranges.length; i++) { var cur = ranges[i], prev = ranges[i - 1] if (cmp(prev.to(), cur.from()) >= 0) { var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to()) var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head if (i <= primIndex) { --primIndex } ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to)) } } return new Selection(ranges, primIndex) } function simpleSelection(anchor, head) { return new Selection([new Range(anchor, head || anchor)], 0) } // Compute the position of the end of a change (its 'to' property // refers to the pre-change end). function changeEnd(change) { if (!change.text) { return change.to } return Pos(change.from.line + change.text.length - 1, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)) } // Adjust a position to refer to the post-change position of the // same text, or the end of the change if the change covers it. function adjustForChange(pos, change) { if (cmp(pos, change.from) < 0) { return pos } if (cmp(pos, change.to) <= 0) { return changeEnd(change) } var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch } return Pos(line, ch) } function computeSelAfterChange(doc, change) { var out = [] for (var i = 0; i < doc.sel.ranges.length; i++) { var range = doc.sel.ranges[i] out.push(new Range(adjustForChange(range.anchor, change), adjustForChange(range.head, change))) } return normalizeSelection(out, doc.sel.primIndex) } function offsetPos(pos, old, nw) { if (pos.line == old.line) { return Pos(nw.line, pos.ch - old.ch + nw.ch) } else { return Pos(nw.line + (pos.line - old.line), pos.ch) } } // Used by replaceSelections to allow moving the selection to the // start or around the replaced test. Hint may be "start" or "around". function computeReplacedSel(doc, changes, hint) { var out = [] var oldPrev = Pos(doc.first, 0), newPrev = oldPrev for (var i = 0; i < changes.length; i++) { var change = changes[i] var from = offsetPos(change.from, oldPrev, newPrev) var to = offsetPos(changeEnd(change), oldPrev, newPrev) oldPrev = change.to newPrev = to if (hint == "around") { var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0 out[i] = new Range(inv ? to : from, inv ? from : to) } else { out[i] = new Range(from, from) } } return new Selection(out, doc.sel.primIndex) } // Used to get the editor into a consistent state again when options change. function loadMode(cm) { cm.doc.mode = getMode(cm.options, cm.doc.modeOption) resetModeState(cm) } function resetModeState(cm) { cm.doc.iter(function (line) { if (line.stateAfter) { line.stateAfter = null } if (line.styles) { line.styles = null } }) cm.doc.frontier = cm.doc.first startWorker(cm, 100) cm.state.modeGen++ if (cm.curOp) { regChange(cm) } } // DOCUMENT DATA STRUCTURE // By default, updates that start and end at the beginning of a line // are treated specially, in order to make the association of line // widgets and marker elements with the text behave more intuitive. function isWholeLineUpdate(doc, change) { return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" && (!doc.cm || doc.cm.options.wholeLineUpdateBefore) } // Perform a change on the document data structure. function updateDoc(doc, change, markedSpans, estimateHeight) { function spansFor(n) {return markedSpans ? markedSpans[n] : null} function update(line, text, spans) { updateLine(line, text, spans, estimateHeight) signalLater(line, "change", line, change) } function linesFor(start, end) { var result = [] for (var i = start; i < end; ++i) { result.push(new Line(text[i], spansFor(i), estimateHeight)) } return result } var from = change.from, to = change.to, text = change.text var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line) var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line // Adjust the line structure if (change.full) { doc.insert(0, linesFor(0, text.length)) doc.remove(text.length, doc.size - text.length) } else if (isWholeLineUpdate(doc, change)) { // This is a whole-line replace. Treated specially to make // sure line objects move the way they are supposed to. var added = linesFor(0, text.length - 1) update(lastLine, lastLine.text, lastSpans) if (nlines) { doc.remove(from.line, nlines) } if (added.length) { doc.insert(from.line, added) } } else if (firstLine == lastLine) { if (text.length == 1) { update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans) } else { var added$1 = linesFor(1, text.length - 1) added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight)) update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)) doc.insert(from.line + 1, added$1) } } else if (text.length == 1) { update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0)) doc.remove(from.line + 1, nlines) } else { update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)) update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans) var added$2 = linesFor(1, text.length - 1) if (nlines > 1) { doc.remove(from.line + 1, nlines - 1) } doc.insert(from.line + 1, added$2) } signalLater(doc, "change", doc, change) } // Call f for all linked documents. function linkedDocs(doc, f, sharedHistOnly) { function propagate(doc, skip, sharedHist) { if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) { var rel = doc.linked[i] if (rel.doc == skip) { continue } var shared = sharedHist && rel.sharedHist if (sharedHistOnly && !shared) { continue } f(rel.doc, shared) propagate(rel.doc, doc, shared) } } } propagate(doc, null, true) } // Attach a document to an editor. function attachDoc(cm, doc) { if (doc.cm) { throw new Error("This document is already in use.") } cm.doc = doc doc.cm = cm estimateLineHeights(cm) loadMode(cm) if (!cm.options.lineWrapping) { findMaxLine(cm) } cm.options.mode = doc.modeOption regChange(cm) } function History(startGen) { // Arrays of change events and selections. Doing something adds an // event to done and clears undo. Undoing moves events from done // to undone, redoing moves them in the other direction. this.done = []; this.undone = [] this.undoDepth = Infinity // Used to track when changes can be merged into a single undo // event this.lastModTime = this.lastSelTime = 0 this.lastOp = this.lastSelOp = null this.lastOrigin = this.lastSelOrigin = null // Used by the isClean() method this.generation = this.maxGeneration = startGen || 1 } // Create a history change event from an updateDoc-style change // object. function historyChangeFromChange(doc, change) { var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)} attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1) linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true) return histChange } // Pop all selection events off the end of a history array. Stop at // a change event. function clearSelectionEvents(array) { while (array.length) { var last = lst(array) if (last.ranges) { array.pop() } else { break } } } // Find the top change event in the history. Pop off selection // events that are in the way. function lastChangeEvent(hist, force) { if (force) { clearSelectionEvents(hist.done) return lst(hist.done) } else if (hist.done.length && !lst(hist.done).ranges) { return lst(hist.done) } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) { hist.done.pop() return lst(hist.done) } } // Register a change in the history. Merges changes that are within // a single operation, or are close together with an origin that // allows merging (starting with "+") into a single event. function addChangeToHistory(doc, change, selAfter, opId) { var hist = doc.history hist.undone.length = 0 var time = +new Date, cur var last if ((hist.lastOp == opId || hist.lastOrigin == change.origin && change.origin && ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) || change.origin.charAt(0) == "*")) && (cur = lastChangeEvent(hist, hist.lastOp == opId))) { // Merge this change into the last event last = lst(cur.changes) if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) { // Optimized case for simple insertion -- don't want to add // new changesets for every character typed last.to = changeEnd(change) } else { // Add new sub-event cur.changes.push(historyChangeFromChange(doc, change)) } } else { // Can not be merged, start a new event. var before = lst(hist.done) if (!before || !before.ranges) { pushSelectionToHistory(doc.sel, hist.done) } cur = {changes: [historyChangeFromChange(doc, change)], generation: hist.generation} hist.done.push(cur) while (hist.done.length > hist.undoDepth) { hist.done.shift() if (!hist.done[0].ranges) { hist.done.shift() } } } hist.done.push(selAfter) hist.generation = ++hist.maxGeneration hist.lastModTime = hist.lastSelTime = time hist.lastOp = hist.lastSelOp = opId hist.lastOrigin = hist.lastSelOrigin = change.origin if (!last) { signal(doc, "historyAdded") } } function selectionEventCanBeMerged(doc, origin, prev, sel) { var ch = origin.charAt(0) return ch == "*" || ch == "+" && prev.ranges.length == sel.ranges.length && prev.somethingSelected() == sel.somethingSelected() && new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500) } // Called whenever the selection changes, sets the new selection as // the pending selection in the history, and pushes the old pending // selection into the 'done' array when it was significantly // different (in number of selected ranges, emptiness, or time). function addSelectionToHistory(doc, sel, opId, options) { var hist = doc.history, origin = options && options.origin // A new event is started when the previous origin does not match // the current, or the origins don't allow matching. Origins // starting with * are always merged, those starting with + are // merged when similar and close together in time. if (opId == hist.lastSelOp || (origin && hist.lastSelOrigin == origin && (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || selectionEventCanBeMerged(doc, origin, lst(hist.done), sel)))) { hist.done[hist.done.length - 1] = sel } else { pushSelectionToHistory(sel, hist.done) } hist.lastSelTime = +new Date hist.lastSelOrigin = origin hist.lastSelOp = opId if (options && options.clearRedo !== false) { clearSelectionEvents(hist.undone) } } function pushSelectionToHistory(sel, dest) { var top = lst(dest) if (!(top && top.ranges && top.equals(sel))) { dest.push(sel) } } // Used to store marked span information in the history. function attachLocalSpans(doc, change, from, to) { var existing = change["spans_" + doc.id], n = 0 doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) { if (line.markedSpans) { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans } ++n }) } // When un/re-doing restores text containing marked spans, those // that have been explicitly cleared should not be restored. function removeClearedSpans(spans) { if (!spans) { return null } var out for (var i = 0; i < spans.length; ++i) { if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i) } } else if (out) { out.push(spans[i]) } } return !out ? spans : out.length ? out : null } // Retrieve and filter the old marked spans stored in a change event. function getOldSpans(doc, change) { var found = change["spans_" + doc.id] if (!found) { return null } var nw = [] for (var i = 0; i < change.text.length; ++i) { nw.push(removeClearedSpans(found[i])) } return nw } // Used for un/re-doing changes from the history. Combines the // result of computing the existing spans with the set of spans that // existed in the history (so that deleting around a span and then // undoing brings back the span). function mergeOldSpans(doc, change) { var old = getOldSpans(doc, change) var stretched = stretchSpansOverChange(doc, change) if (!old) { return stretched } if (!stretched) { return old } for (var i = 0; i < old.length; ++i) { var oldCur = old[i], stretchCur = stretched[i] if (oldCur && stretchCur) { spans: for (var j = 0; j < stretchCur.length; ++j) { var span = stretchCur[j] for (var k = 0; k < oldCur.length; ++k) { if (oldCur[k].marker == span.marker) { continue spans } } oldCur.push(span) } } else if (stretchCur) { old[i] = stretchCur } } return old } // Used both to provide a JSON-safe object in .getHistory, and, when // detaching a document, to split the history in two function copyHistoryArray(events, newGroup, instantiateSel) { var copy = [] for (var i = 0; i < events.length; ++i) { var event = events[i] if (event.ranges) { copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event) continue } var changes = event.changes, newChanges = [] copy.push({changes: newChanges}) for (var j = 0; j < changes.length; ++j) { var change = changes[j], m = (void 0) newChanges.push({from: change.from, to: change.to, text: change.text}) if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) { if (indexOf(newGroup, Number(m[1])) > -1) { lst(newChanges)[prop] = change[prop] delete change[prop] } } } } } } return copy } // The 'scroll' parameter given to many of these indicated whether // the new cursor position should be scrolled into view after // modifying the selection. // If shift is held or the extend flag is set, extends a range to // include a given position (and optionally a second position). // Otherwise, simply returns the range between the given positions. // Used for cursor motion and such. function extendRange(doc, range, head, other) { if (doc.cm && doc.cm.display.shift || doc.extend) { var anchor = range.anchor if (other) { var posBefore = cmp(head, anchor) < 0 if (posBefore != (cmp(other, anchor) < 0)) { anchor = head head = other } else if (posBefore != (cmp(head, other) < 0)) { head = other } } return new Range(anchor, head) } else { return new Range(other || head, head) } } // Extend the primary selection range, discard the rest. function extendSelection(doc, head, other, options) { setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options) } // Extend all selections (pos is an array of selections with length // equal the number of selections) function extendSelections(doc, heads, options) { var out = [] for (var i = 0; i < doc.sel.ranges.length; i++) { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null) } var newSel = normalizeSelection(out, doc.sel.primIndex) setSelection(doc, newSel, options) } // Updates a single range in the selection. function replaceOneSelection(doc, i, range, options) { var ranges = doc.sel.ranges.slice(0) ranges[i] = range setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options) } // Reset the selection to a single range. function setSimpleSelection(doc, anchor, head, options) { setSelection(doc, simpleSelection(anchor, head), options) } // Give beforeSelectionChange handlers a change to influence a // selection update. function filterSelectionChange(doc, sel, options) { var obj = { ranges: sel.ranges, update: function(ranges) { var this$1 = this; this.ranges = [] for (var i = 0; i < ranges.length; i++) { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor), clipPos(doc, ranges[i].head)) } }, origin: options && options.origin } signal(doc, "beforeSelectionChange", doc, obj) if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj) } if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) } else { return sel } } function setSelectionReplaceHistory(doc, sel, options) { var done = doc.history.done, last = lst(done) if (last && last.ranges) { done[done.length - 1] = sel setSelectionNoUndo(doc, sel, options) } else { setSelection(doc, sel, options) } } // Set a new selection. function setSelection(doc, sel, options) { setSelectionNoUndo(doc, sel, options) addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options) } function setSelectionNoUndo(doc, sel, options) { if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) { sel = filterSelectionChange(doc, sel, options) } var bias = options && options.bias || (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1) setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true)) if (!(options && options.scroll === false) && doc.cm) { ensureCursorVisible(doc.cm) } } function setSelectionInner(doc, sel) { if (sel.equals(doc.sel)) { return } doc.sel = sel if (doc.cm) { doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true signalCursorActivity(doc.cm) } signalLater(doc, "cursorActivity", doc) } // Verify that the selection does not partially select any atomic // marked ranges. function reCheckSelection(doc) { setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll) } // Return a selection that does not partially select any atomic // ranges. function skipAtomicInSelection(doc, sel, bias, mayClear) { var out for (var i = 0; i < sel.ranges.length; i++) { var range = sel.ranges[i] var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i] var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear) var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear) if (out || newAnchor != range.anchor || newHead != range.head) { if (!out) { out = sel.ranges.slice(0, i) } out[i] = new Range(newAnchor, newHead) } } return out ? normalizeSelection(out, sel.primIndex) : sel } function skipAtomicInner(doc, pos, oldPos, dir, mayClear) { var line = getLine(doc, pos.line) if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { var sp = line.markedSpans[i], m = sp.marker if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) && (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) { if (mayClear) { signal(m, "beforeCursorEnter") if (m.explicitlyCleared) { if (!line.markedSpans) { break } else {--i; continue} } } if (!m.atomic) { continue } if (oldPos) { var near = m.find(dir < 0 ? 1 : -1), diff = (void 0) if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft) { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null) } if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0)) { return skipAtomicInner(doc, near, pos, dir, mayClear) } } var far = m.find(dir < 0 ? -1 : 1) if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight) { far = movePos(doc, far, dir, far.line == pos.line ? line : null) } return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null } } } return pos } // Ensure a given position is not inside an atomic range. function skipAtomic(doc, pos, oldPos, bias, mayClear) { var dir = bias || 1 var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) || (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) || skipAtomicInner(doc, pos, oldPos, -dir, mayClear) || (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true)) if (!found) { doc.cantEdit = true return Pos(doc.first, 0) } return found } function movePos(doc, pos, dir, line) { if (dir < 0 && pos.ch == 0) { if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) } else { return null } } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) { if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) } else { return null } } else { return new Pos(pos.line, pos.ch + dir) } } function selectAll(cm) { cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll) } // UPDATING // Allow "beforeChange" event handlers to influence a change function filterChange(doc, change, update) { var obj = { canceled: false, from: change.from, to: change.to, text: change.text, origin: change.origin, cancel: function () { return obj.canceled = true; } } if (update) { obj.update = function (from, to, text, origin) { if (from) { obj.from = clipPos(doc, from) } if (to) { obj.to = clipPos(doc, to) } if (text) { obj.text = text } if (origin !== undefined) { obj.origin = origin } } } signal(doc, "beforeChange", doc, obj) if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj) } if (obj.canceled) { return null } return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin} } // Apply a change to a document, and add it to the document's // history, and propagating it to all linked documents. function makeChange(doc, change, ignoreReadOnly) { if (doc.cm) { if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) } if (doc.cm.state.suppressEdits) { return } } if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { change = filterChange(doc, change, true) if (!change) { return } } // Possibly split or suppress the update based on the presence // of read-only spans in its range. var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to) if (split) { for (var i = split.length - 1; i >= 0; --i) { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}) } } else { makeChangeInner(doc, change) } } function makeChangeInner(doc, change) { if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return } var selAfter = computeSelAfterChange(doc, change) addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN) makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change)) var rebased = [] linkedDocs(doc, function (doc, sharedHist) { if (!sharedHist && indexOf(rebased, doc.history) == -1) { rebaseHist(doc.history, change) rebased.push(doc.history) } makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change)) }) } // Revert a change stored in a document's history. function makeChangeFromHistory(doc, type, allowSelectionOnly) { if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return } var hist = doc.history, event, selAfter = doc.sel var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done // Verify that there is a useable event (so that ctrl-z won't // needlessly clear selection events) var i = 0 for (; i < source.length; i++) { event = source[i] if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) { break } } if (i == source.length) { return } hist.lastOrigin = hist.lastSelOrigin = null for (;;) { event = source.pop() if (event.ranges) { pushSelectionToHistory(event, dest) if (allowSelectionOnly && !event.equals(doc.sel)) { setSelection(doc, event, {clearRedo: false}) return } selAfter = event } else { break } } // Build up a reverse change object to add to the opposite history // stack (redo when undoing, and vice versa). var antiChanges = [] pushSelectionToHistory(selAfter, dest) dest.push({changes: antiChanges, generation: hist.generation}) hist.generation = event.generation || ++hist.maxGeneration var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange") var loop = function ( i ) { var change = event.changes[i] change.origin = type if (filter && !filterChange(doc, change, false)) { source.length = 0 return {} } antiChanges.push(historyChangeFromChange(doc, change)) var after = i ? computeSelAfterChange(doc, change) : lst(source) makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change)) if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}) } var rebased = [] // Propagate to the linked documents linkedDocs(doc, function (doc, sharedHist) { if (!sharedHist && indexOf(rebased, doc.history) == -1) { rebaseHist(doc.history, change) rebased.push(doc.history) } makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)) }) }; for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) { var returned = loop( i$1 ); if ( returned ) return returned.v; } } // Sub-views need their line numbers shifted when text is added // above or below them in the parent document. function shiftDoc(doc, distance) { if (distance == 0) { return } doc.first += distance doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range( Pos(range.anchor.line + distance, range.anchor.ch), Pos(range.head.line + distance, range.head.ch) ); }), doc.sel.primIndex) if (doc.cm) { regChange(doc.cm, doc.first, doc.first - distance, distance) for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) { regLineChange(doc.cm, l, "gutter") } } } // More lower-level change function, handling only a single document // (not linked ones). function makeChangeSingleDoc(doc, change, selAfter, spans) { if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) } if (change.to.line < doc.first) { shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)) return } if (change.from.line > doc.lastLine()) { return } // Clip the change to the size of this doc if (change.from.line < doc.first) { var shift = change.text.length - 1 - (doc.first - change.from.line) shiftDoc(doc, shift) change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch), text: [lst(change.text)], origin: change.origin} } var last = doc.lastLine() if (change.to.line > last) { change = {from: change.from, to: Pos(last, getLine(doc, last).text.length), text: [change.text[0]], origin: change.origin} } change.removed = getBetween(doc, change.from, change.to) if (!selAfter) { selAfter = computeSelAfterChange(doc, change) } if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans) } else { updateDoc(doc, change, spans) } setSelectionNoUndo(doc, selAfter, sel_dontScroll) } // Handle the interaction of a change to a document with the editor // that this document is part of. function makeChangeSingleDocInEditor(cm, change, spans) { var doc = cm.doc, display = cm.display, from = change.from, to = change.to var recomputeMaxLength = false, checkWidthStart = from.line if (!cm.options.lineWrapping) { checkWidthStart = lineNo(visualLine(getLine(doc, from.line))) doc.iter(checkWidthStart, to.line + 1, function (line) { if (line == display.maxLine) { recomputeMaxLength = true return true } }) } if (doc.sel.contains(change.from, change.to) > -1) { signalCursorActivity(cm) } updateDoc(doc, change, spans, estimateHeight(cm)) if (!cm.options.lineWrapping) { doc.iter(checkWidthStart, from.line + change.text.length, function (line) { var len = lineLength(line) if (len > display.maxLineLength) { display.maxLine = line display.maxLineLength = len display.maxLineChanged = true recomputeMaxLength = false } }) if (recomputeMaxLength) { cm.curOp.updateMaxLine = true } } // Adjust frontier, schedule worker doc.frontier = Math.min(doc.frontier, from.line) startWorker(cm, 400) var lendiff = change.text.length - (to.line - from.line) - 1 // Remember that these lines changed, for updating the display if (change.full) { regChange(cm) } else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) { regLineChange(cm, from.line, "text") } else { regChange(cm, from.line, to.line + 1, lendiff) } var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change") if (changeHandler || changesHandler) { var obj = { from: from, to: to, text: change.text, removed: change.removed, origin: change.origin } if (changeHandler) { signalLater(cm, "change", cm, obj) } if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj) } } cm.display.selForContextMenu = null } function replaceRange(doc, code, from, to, origin) { if (!to) { to = from } if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp } if (typeof code == "string") { code = doc.splitLines(code) } makeChange(doc, {from: from, to: to, text: code, origin: origin}) } // Rebasing/resetting history to deal with externally-sourced changes function rebaseHistSelSingle(pos, from, to, diff) { if (to < pos.line) { pos.line += diff } else if (from < pos.line) { pos.line = from pos.ch = 0 } } // Tries to rebase an array of history events given a change in the // document. If the change touches the same lines as the event, the // event, and everything 'behind' it, is discarded. If the change is // before the event, the event's positions are updated. Uses a // copy-on-write scheme for the positions, to avoid having to // reallocate them all on every rebase, but also avoid problems with // shared position objects being unsafely updated. function rebaseHistArray(array, from, to, diff) { for (var i = 0; i < array.length; ++i) { var sub = array[i], ok = true if (sub.ranges) { if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true } for (var j = 0; j < sub.ranges.length; j++) { rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff) rebaseHistSelSingle(sub.ranges[j].head, from, to, diff) } continue } for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) { var cur = sub.changes[j$1] if (to < cur.from.line) { cur.from = Pos(cur.from.line + diff, cur.from.ch) cur.to = Pos(cur.to.line + diff, cur.to.ch) } else if (from <= cur.to.line) { ok = false break } } if (!ok) { array.splice(0, i + 1) i = 0 } } } function rebaseHist(hist, change) { var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1 rebaseHistArray(hist.done, from, to, diff) rebaseHistArray(hist.undone, from, to, diff) } // Utility for applying a change to a line by handle or number, // returning the number and optionally registering the line as // changed. function changeLine(doc, handle, changeType, op) { var no = handle, line = handle if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)) } else { no = lineNo(handle) } if (no == null) { return null } if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType) } return line } // The document is represented as a BTree consisting of leaves, with // chunk of lines in them, and branches, with up to ten leaves or // other branch nodes below them. The top node is always a branch // node, and is the document object itself (meaning it has // additional methods and properties). // // All nodes have parent links. The tree is used both to go from // line numbers to line objects, and to go from objects to numbers. // It also indexes by height, and is used to convert between height // and line object, and to find the total height of the document. // // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html var LeafChunk = function(lines) { var this$1 = this; this.lines = lines this.parent = null var height = 0 for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1 height += lines[i].height } this.height = height }; LeafChunk.prototype.chunkSize = function () { return this.lines.length }; // Remove the n lines at offset 'at'. LeafChunk.prototype.removeInner = function (at, n) { var this$1 = this; for (var i = at, e = at + n; i < e; ++i) { var line = this$1.lines[i] this$1.height -= line.height cleanUpLine(line) signalLater(line, "delete") } this.lines.splice(at, n) }; // Helper used to collapse a small branch into a single leaf. LeafChunk.prototype.collapse = function (lines) { lines.push.apply(lines, this.lines) }; // Insert the given array of lines at offset 'at', count them as // having the given height. LeafChunk.prototype.insertInner = function (at, lines, height) { var this$1 = this; this.height += height this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at)) for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1 } }; // Used to iterate over a part of the tree. LeafChunk.prototype.iterN = function (at, n, op) { var this$1 = this; for (var e = at + n; at < e; ++at) { if (op(this$1.lines[at])) { return true } } }; var BranchChunk = function(children) { var this$1 = this; this.children = children var size = 0, height = 0 for (var i = 0; i < children.length; ++i) { var ch = children[i] size += ch.chunkSize(); height += ch.height ch.parent = this$1 } this.size = size this.height = height this.parent = null }; BranchChunk.prototype.chunkSize = function () { return this.size }; BranchChunk.prototype.removeInner = function (at, n) { var this$1 = this; this.size -= n for (var i = 0; i < this.children.length; ++i) { var child = this$1.children[i], sz = child.chunkSize() if (at < sz) { var rm = Math.min(n, sz - at), oldHeight = child.height child.removeInner(at, rm) this$1.height -= oldHeight - child.height if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null } if ((n -= rm) == 0) { break } at = 0 } else { at -= sz } } // If the result is smaller than 25 lines, ensure that it is a // single leaf node. if (this.size - n < 25 && (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) { var lines = [] this.collapse(lines) this.children = [new LeafChunk(lines)] this.children[0].parent = this } }; BranchChunk.prototype.collapse = function (lines) { var this$1 = this; for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines) } }; BranchChunk.prototype.insertInner = function (at, lines, height) { var this$1 = this; this.size += lines.length this.height += height for (var i = 0; i < this.children.length; ++i) { var child = this$1.children[i], sz = child.chunkSize() if (at <= sz) { child.insertInner(at, lines, height) if (child.lines && child.lines.length > 50) { // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced. // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest. var remaining = child.lines.length % 25 + 25 for (var pos = remaining; pos < child.lines.length;) { var leaf = new LeafChunk(child.lines.slice(pos, pos += 25)) child.height -= leaf.height this$1.children.splice(++i, 0, leaf) leaf.parent = this$1 } child.lines = child.lines.slice(0, remaining) this$1.maybeSpill() } break } at -= sz } }; // When a node has grown, check whether it should be split. BranchChunk.prototype.maybeSpill = function () { if (this.children.length <= 10) { return } var me = this do { var spilled = me.children.splice(me.children.length - 5, 5) var sibling = new BranchChunk(spilled) if (!me.parent) { // Become the parent node var copy = new BranchChunk(me.children) copy.parent = me me.children = [copy, sibling] me = copy } else { me.size -= sibling.size me.height -= sibling.height var myIndex = indexOf(me.parent.children, me) me.parent.children.splice(myIndex + 1, 0, sibling) } sibling.parent = me.parent } while (me.children.length > 10) me.parent.maybeSpill() }; BranchChunk.prototype.iterN = function (at, n, op) { var this$1 = this; for (var i = 0; i < this.children.length; ++i) { var child = this$1.children[i], sz = child.chunkSize() if (at < sz) { var used = Math.min(n, sz - at) if (child.iterN(at, used, op)) { return true } if ((n -= used) == 0) { break } at = 0 } else { at -= sz } } }; // Line widgets are block elements displayed above or below a line. var LineWidget = function(doc, node, options) { var this$1 = this; if (options) { for (var opt in options) { if (options.hasOwnProperty(opt)) { this$1[opt] = options[opt] } } } this.doc = doc this.node = node }; LineWidget.prototype.clear = function () { var this$1 = this; var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line) if (no == null || !ws) { return } for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1) } } if (!ws.length) { line.widgets = null } var height = widgetHeight(this) updateLineHeight(line, Math.max(0, line.height - height)) if (cm) { runInOp(cm, function () { adjustScrollWhenAboveVisible(cm, line, -height) regLineChange(cm, no, "widget") }) signalLater(cm, "lineWidgetCleared", cm, this, no) } }; LineWidget.prototype.changed = function () { var this$1 = this; var oldH = this.height, cm = this.doc.cm, line = this.line this.height = null var diff = widgetHeight(this) - oldH if (!diff) { return } updateLineHeight(line, line.height + diff) if (cm) { runInOp(cm, function () { cm.curOp.forceUpdate = true adjustScrollWhenAboveVisible(cm, line, diff) signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line)) }) } }; eventMixin(LineWidget) function adjustScrollWhenAboveVisible(cm, line, diff) { if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop)) { addToScrollPos(cm, null, diff) } } function addLineWidget(doc, handle, node, options) { var widget = new LineWidget(doc, node, options) var cm = doc.cm if (cm && widget.noHScroll) { cm.display.alignWidgets = true } changeLine(doc, handle, "widget", function (line) { var widgets = line.widgets || (line.widgets = []) if (widget.insertAt == null) { widgets.push(widget) } else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget) } widget.line = line if (cm && !lineIsHidden(doc, line)) { var aboveVisible = heightAtLine(line) < doc.scrollTop updateLineHeight(line, line.height + widgetHeight(widget)) if (aboveVisible) { addToScrollPos(cm, null, widget.height) } cm.curOp.forceUpdate = true } return true }) signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)) return widget } // TEXTMARKERS // Created with markText and setBookmark methods. A TextMarker is a // handle that can be used to clear or find a marked position in the // document. Line objects hold arrays (markedSpans) containing // {from, to, marker} object pointing to such marker objects, and // indicating that such a marker is present on that line. Multiple // lines may point to the same marker when it spans across lines. // The spans will have null for their from/to properties when the // marker continues beyond the start/end of the line. Markers have // links back to the lines they currently touch. // Collapsed markers have unique ids, in order to be able to order // them, which is needed for uniquely determining an outer marker // when they overlap (they may nest, but not partially overlap). var nextMarkerId = 0 var TextMarker = function(doc, type) { this.lines = [] this.type = type this.doc = doc this.id = ++nextMarkerId }; // Clear the marker. TextMarker.prototype.clear = function () { var this$1 = this; if (this.explicitlyCleared) { return } var cm = this.doc.cm, withOp = cm && !cm.curOp if (withOp) { startOperation(cm) } if (hasHandler(this, "clear")) { var found = this.find() if (found) { signalLater(this, "clear", found.from, found.to) } } var min = null, max = null for (var i = 0; i < this.lines.length; ++i) { var line = this$1.lines[i] var span = getMarkedSpanFor(line.markedSpans, this$1) if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text") } else if (cm) { if (span.to != null) { max = lineNo(line) } if (span.from != null) { min = lineNo(line) } } line.markedSpans = removeMarkedSpan(line.markedSpans, span) if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm) { updateLineHeight(line, textHeight(cm.display)) } } if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) { var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual) if (len > cm.display.maxLineLength) { cm.display.maxLine = visual cm.display.maxLineLength = len cm.display.maxLineChanged = true } } } if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1) } this.lines.length = 0 this.explicitlyCleared = true if (this.atomic && this.doc.cantEdit) { this.doc.cantEdit = false if (cm) { reCheckSelection(cm.doc) } } if (cm) { signalLater(cm, "markerCleared", cm, this, min, max) } if (withOp) { endOperation(cm) } if (this.parent) { this.parent.clear() } }; // Find the position of the marker in the document. Returns a {from, // to} object by default. Side can be passed to get a specific side // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the // Pos objects returned contain a line object, rather than a line // number (used to prevent looking up the same line twice). TextMarker.prototype.find = function (side, lineObj) { var this$1 = this; if (side == null && this.type == "bookmark") { side = 1 } var from, to for (var i = 0; i < this.lines.length; ++i) { var line = this$1.lines[i] var span = getMarkedSpanFor(line.markedSpans, this$1) if (span.from != null) { from = Pos(lineObj ? line : lineNo(line), span.from) if (side == -1) { return from } } if (span.to != null) { to = Pos(lineObj ? line : lineNo(line), span.to) if (side == 1) { return to } } } return from && {from: from, to: to} }; // Signals that the marker's widget changed, and surrounding layout // should be recomputed. TextMarker.prototype.changed = function () { var this$1 = this; var pos = this.find(-1, true), widget = this, cm = this.doc.cm if (!pos || !cm) { return } runInOp(cm, function () { var line = pos.line, lineN = lineNo(pos.line) var view = findViewForLine(cm, lineN) if (view) { clearLineMeasurementCacheFor(view) cm.curOp.selectionChanged = cm.curOp.forceUpdate = true } cm.curOp.updateMaxLine = true if (!lineIsHidden(widget.doc, line) && widget.height != null) { var oldHeight = widget.height widget.height = null var dHeight = widgetHeight(widget) - oldHeight if (dHeight) { updateLineHeight(line, line.height + dHeight) } } signalLater(cm, "markerChanged", cm, this$1) }) }; TextMarker.prototype.attachLine = function (line) { if (!this.lines.length && this.doc.cm) { var op = this.doc.cm.curOp if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this) } } this.lines.push(line) }; TextMarker.prototype.detachLine = function (line) { this.lines.splice(indexOf(this.lines, line), 1) if (!this.lines.length && this.doc.cm) { var op = this.doc.cm.curOp ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this) } }; eventMixin(TextMarker) // Create a marker, wire it up to the right lines, and function markText(doc, from, to, options, type) { // Shared markers (across linked documents) are handled separately // (markTextShared will call out to this again, once per // document). if (options && options.shared) { return markTextShared(doc, from, to, options, type) } // Ensure we are in an operation. if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) } var marker = new TextMarker(doc, type), diff = cmp(from, to) if (options) { copyObj(options, marker, false) } // Don't connect empty markers unless clearWhenEmpty is false if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false) { return marker } if (marker.replacedWith) { // Showing up as a widget implies collapsed (widget replaces text) marker.collapsed = true marker.widgetNode = elt("span", [marker.replacedWith], "CodeMirror-widget") marker.widgetNode.setAttribute("role", "presentation") // hide from accessibility tree if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true") } if (options.insertLeft) { marker.widgetNode.insertLeft = true } } if (marker.collapsed) { if (conflictingCollapsedRange(doc, from.line, from, to, marker) || from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) { throw new Error("Inserting collapsed marker partially overlapping an existing one") } seeCollapsedSpans() } if (marker.addToHistory) { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN) } var curLine = from.line, cm = doc.cm, updateMaxLine doc.iter(curLine, to.line + 1, function (line) { if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine) { updateMaxLine = true } if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0) } addMarkedSpan(line, new MarkedSpan(marker, curLine == from.line ? from.ch : null, curLine == to.line ? to.ch : null)) ++curLine }) // lineIsHidden depends on the presence of the spans, so needs a second pass if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) { if (lineIsHidden(doc, line)) { updateLineHeight(line, 0) } }) } if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }) } if (marker.readOnly) { seeReadOnlySpans() if (doc.history.done.length || doc.history.undone.length) { doc.clearHistory() } } if (marker.collapsed) { marker.id = ++nextMarkerId marker.atomic = true } if (cm) { // Sync editor state if (updateMaxLine) { cm.curOp.updateMaxLine = true } if (marker.collapsed) { regChange(cm, from.line, to.line + 1) } else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css) { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text") } } if (marker.atomic) { reCheckSelection(cm.doc) } signalLater(cm, "markerAdded", cm, marker) } return marker } // SHARED TEXTMARKERS // A shared marker spans multiple linked documents. It is // implemented as a meta-marker-object controlling multiple normal // markers. var SharedTextMarker = function(markers, primary) { var this$1 = this; this.markers = markers this.primary = primary for (var i = 0; i < markers.length; ++i) { markers[i].parent = this$1 } }; SharedTextMarker.prototype.clear = function () { var this$1 = this; if (this.explicitlyCleared) { return } this.explicitlyCleared = true for (var i = 0; i < this.markers.length; ++i) { this$1.markers[i].clear() } signalLater(this, "clear") }; SharedTextMarker.prototype.find = function (side, lineObj) { return this.primary.find(side, lineObj) }; eventMixin(SharedTextMarker) function markTextShared(doc, from, to, options, type) { options = copyObj(options) options.shared = false var markers = [markText(doc, from, to, options, type)], primary = markers[0] var widget = options.widgetNode linkedDocs(doc, function (doc) { if (widget) { options.widgetNode = widget.cloneNode(true) } markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type)) for (var i = 0; i < doc.linked.length; ++i) { if (doc.linked[i].isParent) { return } } primary = lst(markers) }) return new SharedTextMarker(markers, primary) } function findSharedMarkers(doc) { return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; }) } function copySharedMarkers(doc, markers) { for (var i = 0; i < markers.length; i++) { var marker = markers[i], pos = marker.find() var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to) if (cmp(mFrom, mTo)) { var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type) marker.markers.push(subMark) subMark.parent = marker } } } function detachSharedMarkers(markers) { var loop = function ( i ) { var marker = markers[i], linked = [marker.primary.doc] linkedDocs(marker.primary.doc, function (d) { return linked.push(d); }) for (var j = 0; j < marker.markers.length; j++) { var subMarker = marker.markers[j] if (indexOf(linked, subMarker.doc) == -1) { subMarker.parent = null marker.markers.splice(j--, 1) } } }; for (var i = 0; i < markers.length; i++) loop( i ); } var nextDocId = 0 var Doc = function(text, mode, firstLine, lineSep) { if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep) } if (firstLine == null) { firstLine = 0 } BranchChunk.call(this, [new LeafChunk([new Line("", null)])]) this.first = firstLine this.scrollTop = this.scrollLeft = 0 this.cantEdit = false this.cleanGeneration = 1 this.frontier = firstLine var start = Pos(firstLine, 0) this.sel = simpleSelection(start) this.history = new History(null) this.id = ++nextDocId this.modeOption = mode this.lineSep = lineSep this.extend = false if (typeof text == "string") { text = this.splitLines(text) } updateDoc(this, {from: start, to: start, text: text}) setSelection(this, simpleSelection(start), sel_dontScroll) } Doc.prototype = createObj(BranchChunk.prototype, { constructor: Doc, // Iterate over the document. Supports two forms -- with only one // argument, it calls that for each line in the document. With // three, it iterates over the range given by the first two (with // the second being non-inclusive). iter: function(from, to, op) { if (op) { this.iterN(from - this.first, to - from, op) } else { this.iterN(this.first, this.first + this.size, from) } }, // Non-public interface for adding and removing lines. insert: function(at, lines) { var height = 0 for (var i = 0; i < lines.length; ++i) { height += lines[i].height } this.insertInner(at - this.first, lines, height) }, remove: function(at, n) { this.removeInner(at - this.first, n) }, // From here, the methods are part of the public interface. Most // are also available from CodeMirror (editor) instances. getValue: function(lineSep) { var lines = getLines(this, this.first, this.first + this.size) if (lineSep === false) { return lines } return lines.join(lineSep || this.lineSeparator()) }, setValue: docMethodOp(function(code) { var top = Pos(this.first, 0), last = this.first + this.size - 1 makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length), text: this.splitLines(code), origin: "setValue", full: true}, true) setSelection(this, simpleSelection(top)) }), replaceRange: function(code, from, to, origin) { from = clipPos(this, from) to = to ? clipPos(this, to) : from replaceRange(this, code, from, to, origin) }, getRange: function(from, to, lineSep) { var lines = getBetween(this, clipPos(this, from), clipPos(this, to)) if (lineSep === false) { return lines } return lines.join(lineSep || this.lineSeparator()) }, getLine: function(line) {var l = this.getLineHandle(line); return l && l.text}, getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }}, getLineNumber: function(line) {return lineNo(line)}, getLineHandleVisualStart: function(line) { if (typeof line == "number") { line = getLine(this, line) } return visualLine(line) }, lineCount: function() {return this.size}, firstLine: function() {return this.first}, lastLine: function() {return this.first + this.size - 1}, clipPos: function(pos) {return clipPos(this, pos)}, getCursor: function(start) { var range = this.sel.primary(), pos if (start == null || start == "head") { pos = range.head } else if (start == "anchor") { pos = range.anchor } else if (start == "end" || start == "to" || start === false) { pos = range.to() } else { pos = range.from() } return pos }, listSelections: function() { return this.sel.ranges }, somethingSelected: function() {return this.sel.somethingSelected()}, setCursor: docMethodOp(function(line, ch, options) { setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options) }), setSelection: docMethodOp(function(anchor, head, options) { setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options) }), extendSelection: docMethodOp(function(head, other, options) { extendSelection(this, clipPos(this, head), other && clipPos(this, other), options) }), extendSelections: docMethodOp(function(heads, options) { extendSelections(this, clipPosArray(this, heads), options) }), extendSelectionsBy: docMethodOp(function(f, options) { var heads = map(this.sel.ranges, f) extendSelections(this, clipPosArray(this, heads), options) }), setSelections: docMethodOp(function(ranges, primary, options) { var this$1 = this; if (!ranges.length) { return } var out = [] for (var i = 0; i < ranges.length; i++) { out[i] = new Range(clipPos(this$1, ranges[i].anchor), clipPos(this$1, ranges[i].head)) } if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex) } setSelection(this, normalizeSelection(out, primary), options) }), addSelection: docMethodOp(function(anchor, head, options) { var ranges = this.sel.ranges.slice(0) ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor))) setSelection(this, normalizeSelection(ranges, ranges.length - 1), options) }), getSelection: function(lineSep) { var this$1 = this; var ranges = this.sel.ranges, lines for (var i = 0; i < ranges.length; i++) { var sel = getBetween(this$1, ranges[i].from(), ranges[i].to()) lines = lines ? lines.concat(sel) : sel } if (lineSep === false) { return lines } else { return lines.join(lineSep || this.lineSeparator()) } }, getSelections: function(lineSep) { var this$1 = this; var parts = [], ranges = this.sel.ranges for (var i = 0; i < ranges.length; i++) { var sel = getBetween(this$1, ranges[i].from(), ranges[i].to()) if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()) } parts[i] = sel } return parts }, replaceSelection: function(code, collapse, origin) { var dup = [] for (var i = 0; i < this.sel.ranges.length; i++) { dup[i] = code } this.replaceSelections(dup, collapse, origin || "+input") }, replaceSelections: docMethodOp(function(code, collapse, origin) { var this$1 = this; var changes = [], sel = this.sel for (var i = 0; i < sel.ranges.length; i++) { var range = sel.ranges[i] changes[i] = {from: range.from(), to: range.to(), text: this$1.splitLines(code[i]), origin: origin} } var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse) for (var i$1 = changes.length - 1; i$1 >= 0; i$1--) { makeChange(this$1, changes[i$1]) } if (newSel) { setSelectionReplaceHistory(this, newSel) } else if (this.cm) { ensureCursorVisible(this.cm) } }), undo: docMethodOp(function() {makeChangeFromHistory(this, "undo")}), redo: docMethodOp(function() {makeChangeFromHistory(this, "redo")}), undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true)}), redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true)}), setExtending: function(val) {this.extend = val}, getExtending: function() {return this.extend}, historySize: function() { var hist = this.history, done = 0, undone = 0 for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done } } for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone } } return {undo: done, redo: undone} }, clearHistory: function() {this.history = new History(this.history.maxGeneration)}, markClean: function() { this.cleanGeneration = this.changeGeneration(true) }, changeGeneration: function(forceSplit) { if (forceSplit) { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null } return this.history.generation }, isClean: function (gen) { return this.history.generation == (gen || this.cleanGeneration) }, getHistory: function() { return {done: copyHistoryArray(this.history.done), undone: copyHistoryArray(this.history.undone)} }, setHistory: function(histData) { var hist = this.history = new History(this.history.maxGeneration) hist.done = copyHistoryArray(histData.done.slice(0), null, true) hist.undone = copyHistoryArray(histData.undone.slice(0), null, true) }, setGutterMarker: docMethodOp(function(line, gutterID, value) { return changeLine(this, line, "gutter", function (line) { var markers = line.gutterMarkers || (line.gutterMarkers = {}) markers[gutterID] = value if (!value && isEmpty(markers)) { line.gutterMarkers = null } return true }) }), clearGutter: docMethodOp(function(gutterID) { var this$1 = this; this.iter(function (line) { if (line.gutterMarkers && line.gutterMarkers[gutterID]) { changeLine(this$1, line, "gutter", function () { line.gutterMarkers[gutterID] = null if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null } return true }) } }) }), lineInfo: function(line) { var n if (typeof line == "number") { if (!isLine(this, line)) { return null } n = line line = getLine(this, line) if (!line) { return null } } else { n = lineNo(line) if (n == null) { return null } } return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers, textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass, widgets: line.widgets} }, addLineClass: docMethodOp(function(handle, where, cls) { return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) { var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : where == "gutter" ? "gutterClass" : "wrapClass" if (!line[prop]) { line[prop] = cls } else if (classTest(cls).test(line[prop])) { return false } else { line[prop] += " " + cls } return true }) }), removeLineClass: docMethodOp(function(handle, where, cls) { return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) { var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : where == "gutter" ? "gutterClass" : "wrapClass" var cur = line[prop] if (!cur) { return false } else if (cls == null) { line[prop] = null } else { var found = cur.match(classTest(cls)) if (!found) { return false } var end = found.index + found[0].length line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null } return true }) }), addLineWidget: docMethodOp(function(handle, node, options) { return addLineWidget(this, handle, node, options) }), removeLineWidget: function(widget) { widget.clear() }, markText: function(from, to, options) { return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range") }, setBookmark: function(pos, options) { var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options), insertLeft: options && options.insertLeft, clearWhenEmpty: false, shared: options && options.shared, handleMouseEvents: options && options.handleMouseEvents} pos = clipPos(this, pos) return markText(this, pos, pos, realOpts, "bookmark") }, findMarksAt: function(pos) { pos = clipPos(this, pos) var markers = [], spans = getLine(this, pos.line).markedSpans if (spans) { for (var i = 0; i < spans.length; ++i) { var span = spans[i] if ((span.from == null || span.from <= pos.ch) && (span.to == null || span.to >= pos.ch)) { markers.push(span.marker.parent || span.marker) } } } return markers }, findMarks: function(from, to, filter) { from = clipPos(this, from); to = clipPos(this, to) var found = [], lineNo = from.line this.iter(from.line, to.line + 1, function (line) { var spans = line.markedSpans if (spans) { for (var i = 0; i < spans.length; i++) { var span = spans[i] if (!(span.to != null && lineNo == from.line && from.ch >= span.to || span.from == null && lineNo != from.line || span.from != null && lineNo == to.line && span.from >= to.ch) && (!filter || filter(span.marker))) { found.push(span.marker.parent || span.marker) } } } ++lineNo }) return found }, getAllMarks: function() { var markers = [] this.iter(function (line) { var sps = line.markedSpans if (sps) { for (var i = 0; i < sps.length; ++i) { if (sps[i].from != null) { markers.push(sps[i].marker) } } } }) return markers }, posFromIndex: function(off) { var ch, lineNo = this.first, sepSize = this.lineSeparator().length this.iter(function (line) { var sz = line.text.length + sepSize if (sz > off) { ch = off; return true } off -= sz ++lineNo }) return clipPos(this, Pos(lineNo, ch)) }, indexFromPos: function (coords) { coords = clipPos(this, coords) var index = coords.ch if (coords.line < this.first || coords.ch < 0) { return 0 } var sepSize = this.lineSeparator().length this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value index += line.text.length + sepSize }) return index }, copy: function(copyHistory) { var doc = new Doc(getLines(this, this.first, this.first + this.size), this.modeOption, this.first, this.lineSep) doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft doc.sel = this.sel doc.extend = false if (copyHistory) { doc.history.undoDepth = this.history.undoDepth doc.setHistory(this.getHistory()) } return doc }, linkedDoc: function(options) { if (!options) { options = {} } var from = this.first, to = this.first + this.size if (options.from != null && options.from > from) { from = options.from } if (options.to != null && options.to < to) { to = options.to } var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep) if (options.sharedHist) { copy.history = this.history ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist}) copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}] copySharedMarkers(copy, findSharedMarkers(this)) return copy }, unlinkDoc: function(other) { var this$1 = this; if (other instanceof CodeMirror) { other = other.doc } if (this.linked) { for (var i = 0; i < this.linked.length; ++i) { var link = this$1.linked[i] if (link.doc != other) { continue } this$1.linked.splice(i, 1) other.unlinkDoc(this$1) detachSharedMarkers(findSharedMarkers(this$1)) break } } // If the histories were shared, split them again if (other.history == this.history) { var splitIds = [other.id] linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true) other.history = new History(null) other.history.done = copyHistoryArray(this.history.done, splitIds) other.history.undone = copyHistoryArray(this.history.undone, splitIds) } }, iterLinkedDocs: function(f) {linkedDocs(this, f)}, getMode: function() {return this.mode}, getEditor: function() {return this.cm}, splitLines: function(str) { if (this.lineSep) { return str.split(this.lineSep) } return splitLinesAuto(str) }, lineSeparator: function() { return this.lineSep || "\n" } }) // Public alias. Doc.prototype.eachLine = Doc.prototype.iter // Kludge to work around strange IE behavior where it'll sometimes // re-fire a series of drag-related events right after the drop (#1551) var lastDrop = 0 function onDrop(e) { var cm = this clearDragCursor(cm) if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return } e_preventDefault(e) if (ie) { lastDrop = +new Date } var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files if (!pos || cm.isReadOnly()) { return } // Might be a file drop, in which case we simply extract the text // and insert it. if (files && files.length && window.FileReader && window.File) { var n = files.length, text = Array(n), read = 0 var loadFile = function (file, i) { if (cm.options.allowDropFileTypes && indexOf(cm.options.allowDropFileTypes, file.type) == -1) { return } var reader = new FileReader reader.onload = operation(cm, function () { var content = reader.result if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = "" } text[i] = content if (++read == n) { pos = clipPos(cm.doc, pos) var change = {from: pos, to: pos, text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())), origin: "paste"} makeChange(cm.doc, change) setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change))) } }) reader.readAsText(file) } for (var i = 0; i < n; ++i) { loadFile(files[i], i) } } else { // Normal drop // Don't do a replace if the drop happened inside of the selected text. if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) { cm.state.draggingText(e) // Ensure the editor is re-focused setTimeout(function () { return cm.display.input.focus(); }, 20) return } try { var text$1 = e.dataTransfer.getData("Text") if (text$1) { var selected if (cm.state.draggingText && !cm.state.draggingText.copy) { selected = cm.listSelections() } setSelectionNoUndo(cm.doc, simpleSelection(pos, pos)) if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1) { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag") } } cm.replaceSelection(text$1, "around", "paste") cm.display.input.focus() } } catch(e){} } } function onDragStart(cm, e) { if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return } if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return } e.dataTransfer.setData("Text", cm.getSelection()) e.dataTransfer.effectAllowed = "copyMove" // Use dummy image instead of default browsers image. // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there. if (e.dataTransfer.setDragImage && !safari) { var img = elt("img", null, null, "position: fixed; left: 0; top: 0;") img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" if (presto) { img.width = img.height = 1 cm.display.wrapper.appendChild(img) // Force a relayout, or Opera won't use our image for some obscure reason img._top = img.offsetTop } e.dataTransfer.setDragImage(img, 0, 0) if (presto) { img.parentNode.removeChild(img) } } } function onDragOver(cm, e) { var pos = posFromMouse(cm, e) if (!pos) { return } var frag = document.createDocumentFragment() drawSelectionCursor(cm, pos, frag) if (!cm.display.dragCursor) { cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors") cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv) } removeChildrenAndAdd(cm.display.dragCursor, frag) } function clearDragCursor(cm) { if (cm.display.dragCursor) { cm.display.lineSpace.removeChild(cm.display.dragCursor) cm.display.dragCursor = null } } // These must be handled carefully, because naively registering a // handler for each editor will cause the editors to never be // garbage collected. function forEachCodeMirror(f) { if (!document.body.getElementsByClassName) { return } var byClass = document.body.getElementsByClassName("CodeMirror") for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror if (cm) { f(cm) } } } var globalsRegistered = false function ensureGlobalHandlers() { if (globalsRegistered) { return } registerGlobalHandlers() globalsRegistered = true } function registerGlobalHandlers() { // When the window resizes, we need to refresh active editors. var resizeTimer on(window, "resize", function () { if (resizeTimer == null) { resizeTimer = setTimeout(function () { resizeTimer = null forEachCodeMirror(onResize) }, 100) } }) // When the window loses focus, we want to show the editor as blurred on(window, "blur", function () { return forEachCodeMirror(onBlur); }) } // Called when the window resizes function onResize(cm) { var d = cm.display if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth) { return } // Might be a text scaling operation, clear size caches. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null d.scrollbarsClipped = false cm.setSize() } var keyNames = { 3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt", 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert", 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod", 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete", 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete", 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert" } // Number keys for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i) } // Alphabetic keys for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1) } // Function keys for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2 } var keyMap = {} keyMap.basic = { "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown", "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown", "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore", "Tab": "defaultTab", "Shift-Tab": "indentAuto", "Enter": "newlineAndIndent", "Insert": "toggleOverwrite", "Esc": "singleSelection" } // Note that the save and find-related commands aren't defined by // default. User code or addons can define them. Unknown commands // are simply ignored. keyMap.pcDefault = { "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo", "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown", "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd", "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find", "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll", "Ctrl-[": "indentLess", "Ctrl-]": "indentMore", "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection", fallthrough: "basic" } // Very basic readline/emacs-style bindings, which are standard on Mac. keyMap.emacsy = { "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars", "Ctrl-O": "openLine" } keyMap.macDefault = { "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft", "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore", "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find", "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll", "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight", "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd", fallthrough: ["basic", "emacsy"] } keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault // KEYMAP DISPATCH function normalizeKeyName(name) { var parts = name.split(/-(?!$)/) name = parts[parts.length - 1] var alt, ctrl, shift, cmd for (var i = 0; i < parts.length - 1; i++) { var mod = parts[i] if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true } else if (/^a(lt)?$/i.test(mod)) { alt = true } else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true } else if (/^s(hift)?$/i.test(mod)) { shift = true } else { throw new Error("Unrecognized modifier name: " + mod) } } if (alt) { name = "Alt-" + name } if (ctrl) { name = "Ctrl-" + name } if (cmd) { name = "Cmd-" + name } if (shift) { name = "Shift-" + name } return name } // This is a kludge to keep keymaps mostly working as raw objects // (backwards compatibility) while at the same time support features // like normalization and multi-stroke key bindings. It compiles a // new normalized keymap, and then updates the old object to reflect // this. function normalizeKeyMap(keymap) { var copy = {} for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) { var value = keymap[keyname] if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue } if (value == "...") { delete keymap[keyname]; continue } var keys = map(keyname.split(" "), normalizeKeyName) for (var i = 0; i < keys.length; i++) { var val = (void 0), name = (void 0) if (i == keys.length - 1) { name = keys.join(" ") val = value } else { name = keys.slice(0, i + 1).join(" ") val = "..." } var prev = copy[name] if (!prev) { copy[name] = val } else if (prev != val) { throw new Error("Inconsistent bindings for " + name) } } delete keymap[keyname] } } for (var prop in copy) { keymap[prop] = copy[prop] } return keymap } function lookupKey(key, map, handle, context) { map = getKeyMap(map) var found = map.call ? map.call(key, context) : map[key] if (found === false) { return "nothing" } if (found === "...") { return "multi" } if (found != null && handle(found)) { return "handled" } if (map.fallthrough) { if (Object.prototype.toString.call(map.fallthrough) != "[object Array]") { return lookupKey(key, map.fallthrough, handle, context) } for (var i = 0; i < map.fallthrough.length; i++) { var result = lookupKey(key, map.fallthrough[i], handle, context) if (result) { return result } } } } // Modifier key presses don't count as 'real' key presses for the // purpose of keymap fallthrough. function isModifierKey(value) { var name = typeof value == "string" ? value : keyNames[value.keyCode] return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod" } // Look up the name of a key as indicated by an event object. function keyName(event, noShift) { if (presto && event.keyCode == 34 && event["char"]) { return false } var base = keyNames[event.keyCode], name = base if (name == null || event.altGraphKey) { return false } if (event.altKey && base != "Alt") { name = "Alt-" + name } if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name } if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name } if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name } return name } function getKeyMap(val) { return typeof val == "string" ? keyMap[val] : val } // Helper for deleting text near the selection(s), used to implement // backspace, delete, and similar functionality. function deleteNearSelection(cm, compute) { var ranges = cm.doc.sel.ranges, kill = [] // Build up a set of ranges to kill first, merging overlapping // ranges. for (var i = 0; i < ranges.length; i++) { var toKill = compute(ranges[i]) while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) { var replaced = kill.pop() if (cmp(replaced.from, toKill.from) < 0) { toKill.from = replaced.from break } } kill.push(toKill) } // Next, remove those actual ranges. runInOp(cm, function () { for (var i = kill.length - 1; i >= 0; i--) { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete") } ensureCursorVisible(cm) }) } // Commands are parameter-less actions that can be performed on an // editor, mostly used for keybindings. var commands = { selectAll: selectAll, singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); }, killLine: function (cm) { return deleteNearSelection(cm, function (range) { if (range.empty()) { var len = getLine(cm.doc, range.head.line).text.length if (range.head.ch == len && range.head.line < cm.lastLine()) { return {from: range.head, to: Pos(range.head.line + 1, 0)} } else { return {from: range.head, to: Pos(range.head.line, len)} } } else { return {from: range.from(), to: range.to()} } }); }, deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({ from: Pos(range.from().line, 0), to: clipPos(cm.doc, Pos(range.to().line + 1, 0)) }); }); }, delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({ from: Pos(range.from().line, 0), to: range.from() }); }); }, delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { var top = cm.charCoords(range.head, "div").top + 5 var leftPos = cm.coordsChar({left: 0, top: top}, "div") return {from: leftPos, to: range.from()} }); }, delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) { var top = cm.charCoords(range.head, "div").top + 5 var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div") return {from: range.from(), to: rightPos } }); }, undo: function (cm) { return cm.undo(); }, redo: function (cm) { return cm.redo(); }, undoSelection: function (cm) { return cm.undoSelection(); }, redoSelection: function (cm) { return cm.redoSelection(); }, goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); }, goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); }, goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); }, {origin: "+move", bias: 1} ); }, goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); }, {origin: "+move", bias: 1} ); }, goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); }, {origin: "+move", bias: -1} ); }, goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) { var top = cm.charCoords(range.head, "div").top + 5 return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div") }, sel_move); }, goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) { var top = cm.charCoords(range.head, "div").top + 5 return cm.coordsChar({left: 0, top: top}, "div") }, sel_move); }, goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) { var top = cm.charCoords(range.head, "div").top + 5 var pos = cm.coordsChar({left: 0, top: top}, "div") if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) } return pos }, sel_move); }, goLineUp: function (cm) { return cm.moveV(-1, "line"); }, goLineDown: function (cm) { return cm.moveV(1, "line"); }, goPageUp: function (cm) { return cm.moveV(-1, "page"); }, goPageDown: function (cm) { return cm.moveV(1, "page"); }, goCharLeft: function (cm) { return cm.moveH(-1, "char"); }, goCharRight: function (cm) { return cm.moveH(1, "char"); }, goColumnLeft: function (cm) { return cm.moveH(-1, "column"); }, goColumnRight: function (cm) { return cm.moveH(1, "column"); }, goWordLeft: function (cm) { return cm.moveH(-1, "word"); }, goGroupRight: function (cm) { return cm.moveH(1, "group"); }, goGroupLeft: function (cm) { return cm.moveH(-1, "group"); }, goWordRight: function (cm) { return cm.moveH(1, "word"); }, delCharBefore: function (cm) { return cm.deleteH(-1, "char"); }, delCharAfter: function (cm) { return cm.deleteH(1, "char"); }, delWordBefore: function (cm) { return cm.deleteH(-1, "word"); }, delWordAfter: function (cm) { return cm.deleteH(1, "word"); }, delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); }, delGroupAfter: function (cm) { return cm.deleteH(1, "group"); }, indentAuto: function (cm) { return cm.indentSelection("smart"); }, indentMore: function (cm) { return cm.indentSelection("add"); }, indentLess: function (cm) { return cm.indentSelection("subtract"); }, insertTab: function (cm) { return cm.replaceSelection("\t"); }, insertSoftTab: function (cm) { var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize for (var i = 0; i < ranges.length; i++) { var pos = ranges[i].from() var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize) spaces.push(spaceStr(tabSize - col % tabSize)) } cm.replaceSelections(spaces) }, defaultTab: function (cm) { if (cm.somethingSelected()) { cm.indentSelection("add") } else { cm.execCommand("insertTab") } }, // Swap the two chars left and right of each selection's head. // Move cursor behind the two swapped characters afterwards. // // Doesn't consider line feeds a character. // Doesn't scan more than one line above to find a character. // Doesn't do anything on an empty line. // Doesn't do anything with non-empty selections. transposeChars: function (cm) { return runInOp(cm, function () { var ranges = cm.listSelections(), newSel = [] for (var i = 0; i < ranges.length; i++) { if (!ranges[i].empty()) { continue } var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text if (line) { if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1) } if (cur.ch > 0) { cur = new Pos(cur.line, cur.ch + 1) cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2), Pos(cur.line, cur.ch - 2), cur, "+transpose") } else if (cur.line > cm.doc.first) { var prev = getLine(cm.doc, cur.line - 1).text if (prev) { cur = new Pos(cur.line, 1) cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() + prev.charAt(prev.length - 1), Pos(cur.line - 1, prev.length - 1), cur, "+transpose") } } } newSel.push(new Range(cur, cur)) } cm.setSelections(newSel) }); }, newlineAndIndent: function (cm) { return runInOp(cm, function () { var sels = cm.listSelections() for (var i = sels.length - 1; i >= 0; i--) { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input") } sels = cm.listSelections() for (var i$1 = 0; i$1 < sels.length; i$1++) { cm.indentLine(sels[i$1].from().line, null, true) } ensureCursorVisible(cm) }); }, openLine: function (cm) { return cm.replaceSelection("\n", "start"); }, toggleOverwrite: function (cm) { return cm.toggleOverwrite(); } } function lineStart(cm, lineN) { var line = getLine(cm.doc, lineN) var visual = visualLine(line) if (visual != line) { lineN = lineNo(visual) } return endOfLine(true, cm, visual, lineN, 1) } function lineEnd(cm, lineN) { var line = getLine(cm.doc, lineN) var visual = visualLineEnd(line) if (visual != line) { lineN = lineNo(visual) } return endOfLine(true, cm, line, lineN, -1) } function lineStartSmart(cm, pos) { var start = lineStart(cm, pos.line) var line = getLine(cm.doc, start.line) var order = getOrder(line) if (!order || order[0].level == 0) { var firstNonWS = Math.max(0, line.text.search(/\S/)) var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky) } return start } // Run a handler that was bound to a key. function doHandleBinding(cm, bound, dropShift) { if (typeof bound == "string") { bound = commands[bound] if (!bound) { return false } } // Ensure previous input has been read, so that the handler sees a // consistent view of the document cm.display.input.ensurePolled() var prevShift = cm.display.shift, done = false try { if (cm.isReadOnly()) { cm.state.suppressEdits = true } if (dropShift) { cm.display.shift = false } done = bound(cm) != Pass } finally { cm.display.shift = prevShift cm.state.suppressEdits = false } return done } function lookupKeyForEditor(cm, name, handle) { for (var i = 0; i < cm.state.keyMaps.length; i++) { var result = lookupKey(name, cm.state.keyMaps[i], handle, cm) if (result) { return result } } return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm)) || lookupKey(name, cm.options.keyMap, handle, cm) } var stopSeq = new Delayed function dispatchKey(cm, name, e, handle) { var seq = cm.state.keySeq if (seq) { if (isModifierKey(name)) { return "handled" } stopSeq.set(50, function () { if (cm.state.keySeq == seq) { cm.state.keySeq = null cm.display.input.reset() } }) name = seq + " " + name } var result = lookupKeyForEditor(cm, name, handle) if (result == "multi") { cm.state.keySeq = name } if (result == "handled") { signalLater(cm, "keyHandled", cm, name, e) } if (result == "handled" || result == "multi") { e_preventDefault(e) restartBlink(cm) } if (seq && !result && /\'$/.test(name)) { e_preventDefault(e) return true } return !!result } // Handle a key from the keydown event. function handleKeyBinding(cm, e) { var name = keyName(e, true) if (!name) { return false } if (e.shiftKey && !cm.state.keySeq) { // First try to resolve full name (including 'Shift-'). Failing // that, see if there is a cursor-motion command (starting with // 'go') bound to the keyname without 'Shift-'. return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); }) || dispatchKey(cm, name, e, function (b) { if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) { return doHandleBinding(cm, b) } }) } else { return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); }) } } // Handle a key from the keypress event function handleCharBinding(cm, e, ch) { return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); }) } var lastStoppedKey = null function onKeyDown(e) { var cm = this cm.curOp.focus = activeElt() if (signalDOMEvent(cm, e)) { return } // IE does strange things with escape. if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false } var code = e.keyCode cm.display.shift = code == 16 || e.shiftKey var handled = handleKeyBinding(cm, e) if (presto) { lastStoppedKey = handled ? code : null // Opera has no cut event... we try to at least catch the key combo if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) { cm.replaceSelection("", null, "cut") } } // Turn mouse into crosshair when Alt is held on Mac. if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className)) { showCrossHair(cm) } } function showCrossHair(cm) { var lineDiv = cm.display.lineDiv addClass(lineDiv, "CodeMirror-crosshair") function up(e) { if (e.keyCode == 18 || !e.altKey) { rmClass(lineDiv, "CodeMirror-crosshair") off(document, "keyup", up) off(document, "mouseover", up) } } on(document, "keyup", up) on(document, "mouseover", up) } function onKeyUp(e) { if (e.keyCode == 16) { this.doc.sel.shift = false } signalDOMEvent(this, e) } function onKeyPress(e) { var cm = this if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return } var keyCode = e.keyCode, charCode = e.charCode if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return} if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return } var ch = String.fromCharCode(charCode == null ? keyCode : charCode) // Some browsers fire keypress events for backspace if (ch == "\x08") { return } if (handleCharBinding(cm, e, ch)) { return } cm.display.input.onKeyPress(e) } // A mouse down can be a single click, double click, triple click, // start of selection drag, start of text drag, new cursor // (ctrl-click), rectangle drag (alt-drag), or xwin // middle-click-paste. Or it might be a click on something we should // not interfere with, such as a scrollbar or widget. function onMouseDown(e) { var cm = this, display = cm.display if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return } display.input.ensurePolled() display.shift = e.shiftKey if (eventInWidget(display, e)) { if (!webkit) { // Briefly turn off draggability, to allow widgets to do // normal dragging things. display.scroller.draggable = false setTimeout(function () { return display.scroller.draggable = true; }, 100) } return } if (clickInGutter(cm, e)) { return } var start = posFromMouse(cm, e) window.focus() switch (e_button(e)) { case 1: // #3261: make sure, that we're not starting a second selection if (cm.state.selectingText) { cm.state.selectingText(e) } else if (start) { leftButtonDown(cm, e, start) } else if (e_target(e) == display.scroller) { e_preventDefault(e) } break case 2: if (webkit) { cm.state.lastMiddleDown = +new Date } if (start) { extendSelection(cm.doc, start) } setTimeout(function () { return display.input.focus(); }, 20) e_preventDefault(e) break case 3: if (captureRightClick) { onContextMenu(cm, e) } else { delayBlurEvent(cm) } break } } var lastClick; var lastDoubleClick; function leftButtonDown(cm, e, start) { if (ie) { setTimeout(bind(ensureFocus, cm), 0) } else { cm.curOp.focus = activeElt() } var now = +new Date, type if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) { type = "triple" } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) { type = "double" lastDoubleClick = {time: now, pos: start} } else { type = "single" lastClick = {time: now, pos: start} } var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() && type == "single" && (contained = sel.contains(start)) > -1 && (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) && (cmp(contained.to(), start) > 0 || start.xRel < 0)) { leftButtonStartDrag(cm, e, start, modifier) } else { leftButtonSelect(cm, e, start, type, modifier) } } // Start a text drag. When it ends, see if any dragging actually // happen, and treat as a click if it didn't. function leftButtonStartDrag(cm, e, start, modifier) { var display = cm.display, startTime = +new Date var dragEnd = operation(cm, function (e2) { if (webkit) { display.scroller.draggable = false } cm.state.draggingText = false off(document, "mouseup", dragEnd) off(display.scroller, "drop", dragEnd) if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { e_preventDefault(e2) if (!modifier && +new Date - 200 < startTime) { extendSelection(cm.doc, start) } // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081) if (webkit || ie && ie_version == 9) { setTimeout(function () {document.body.focus(); display.input.focus()}, 20) } else { display.input.focus() } } }) // Let the drag handler handle this. if (webkit) { display.scroller.draggable = true } cm.state.draggingText = dragEnd dragEnd.copy = mac ? e.altKey : e.ctrlKey // IE's approach to draggable if (display.scroller.dragDrop) { display.scroller.dragDrop() } on(document, "mouseup", dragEnd) on(display.scroller, "drop", dragEnd) } // Normal selection, as opposed to text dragging. function leftButtonSelect(cm, e, start, type, addNew) { var display = cm.display, doc = cm.doc e_preventDefault(e) var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges if (addNew && !e.shiftKey) { ourIndex = doc.sel.contains(start) if (ourIndex > -1) { ourRange = ranges[ourIndex] } else { ourRange = new Range(start, start) } } else { ourRange = doc.sel.primary() ourIndex = doc.sel.primIndex } if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) { type = "rect" if (!addNew) { ourRange = new Range(start, start) } start = posFromMouse(cm, e, true, true) ourIndex = -1 } else if (type == "double") { var word = cm.findWordAt(start) if (cm.display.shift || doc.extend) { ourRange = extendRange(doc, ourRange, word.anchor, word.head) } else { ourRange = word } } else if (type == "triple") { var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0))) if (cm.display.shift || doc.extend) { ourRange = extendRange(doc, ourRange, line.anchor, line.head) } else { ourRange = line } } else { ourRange = extendRange(doc, ourRange, start) } if (!addNew) { ourIndex = 0 setSelection(doc, new Selection([ourRange], 0), sel_mouse) startSel = doc.sel } else if (ourIndex == -1) { ourIndex = ranges.length setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex), {scroll: false, origin: "*mouse"}) } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) { setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0), {scroll: false, origin: "*mouse"}) startSel = doc.sel } else { replaceOneSelection(doc, ourIndex, ourRange, sel_mouse) } var lastPos = start function extendTo(pos) { if (cmp(lastPos, pos) == 0) { return } lastPos = pos if (type == "rect") { var ranges = [], tabSize = cm.options.tabSize var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize) var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize) var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol) for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); line <= end; line++) { var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize) if (left == right) { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))) } else if (text.length > leftPos) { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))) } } if (!ranges.length) { ranges.push(new Range(start, start)) } setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), {origin: "*mouse", scroll: false}) cm.scrollIntoView(pos) } else { var oldRange = ourRange var anchor = oldRange.anchor, head = pos if (type != "single") { var range if (type == "double") { range = cm.findWordAt(pos) } else { range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))) } if (cmp(range.anchor, anchor) > 0) { head = range.head anchor = minPos(oldRange.from(), range.anchor) } else { head = range.anchor anchor = maxPos(oldRange.to(), range.head) } } var ranges$1 = startSel.ranges.slice(0) ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head) setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse) } } var editorSize = display.wrapper.getBoundingClientRect() // Used to ensure timeout re-tries don't fire when another extend // happened in the meantime (clearTimeout isn't reliable -- at // least on Chrome, the timeouts still happen even when cleared, // if the clear happens after their scheduled firing time). var counter = 0 function extend(e) { var curCount = ++counter var cur = posFromMouse(cm, e, true, type == "rect") if (!cur) { return } if (cmp(cur, lastPos) != 0) { cm.curOp.focus = activeElt() extendTo(cur) var visible = visibleLines(display, doc) if (cur.line >= visible.to || cur.line < visible.from) { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e) }}), 150) } } else { var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0 if (outside) { setTimeout(operation(cm, function () { if (counter != curCount) { return } display.scroller.scrollTop += outside extend(e) }), 50) } } } function done(e) { cm.state.selectingText = false counter = Infinity e_preventDefault(e) display.input.focus() off(document, "mousemove", move) off(document, "mouseup", up) doc.history.lastSelOrigin = null } var move = operation(cm, function (e) { if (!e_button(e)) { done(e) } else { extend(e) } }) var up = operation(cm, done) cm.state.selectingText = up on(document, "mousemove", move) on(document, "mouseup", up) } // Determines whether an event happened in the gutter, and fires the // handlers for the corresponding event. function gutterEvent(cm, e, type, prevent) { var mX, mY try { mX = e.clientX; mY = e.clientY } catch(e) { return false } if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false } if (prevent) { e_preventDefault(e) } var display = cm.display var lineBox = display.lineDiv.getBoundingClientRect() if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) } mY -= lineBox.top - display.viewOffset for (var i = 0; i < cm.options.gutters.length; ++i) { var g = display.gutters.childNodes[i] if (g && g.getBoundingClientRect().right >= mX) { var line = lineAtHeight(cm.doc, mY) var gutter = cm.options.gutters[i] signal(cm, type, cm, line, gutter, e) return e_defaultPrevented(e) } } } function clickInGutter(cm, e) { return gutterEvent(cm, e, "gutterClick", true) } // CONTEXT MENU HANDLING // To make the context menu work, we need to briefly unhide the // textarea (making it as unobtrusive as possible) to let the // right-click take effect on it. function onContextMenu(cm, e) { if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return } if (signalDOMEvent(cm, e, "contextmenu")) { return } cm.display.input.onContextMenu(e) } function contextMenuInGutter(cm, e) { if (!hasHandler(cm, "gutterContextMenu")) { return false } return gutterEvent(cm, e, "gutterContextMenu", false) } function themeChanged(cm) { cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-") clearCaches(cm) } var Init = {toString: function(){return "CodeMirror.Init"}} var defaults = {} var optionHandlers = {} function defineOptions(CodeMirror) { var optionHandlers = CodeMirror.optionHandlers function option(name, deflt, handle, notOnInit) { CodeMirror.defaults[name] = deflt if (handle) { optionHandlers[name] = notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old) }} : handle } } CodeMirror.defineOption = option // Passed to option handlers when there is no old value. CodeMirror.Init = Init // These two are, on init, called from the constructor because they // have to be initialized before the editor can start at all. option("value", "", function (cm, val) { return cm.setValue(val); }, true) option("mode", null, function (cm, val) { cm.doc.modeOption = val loadMode(cm) }, true) option("indentUnit", 2, loadMode, true) option("indentWithTabs", false) option("smartIndent", true) option("tabSize", 4, function (cm) { resetModeState(cm) clearCaches(cm) regChange(cm) }, true) option("lineSeparator", null, function (cm, val) { cm.doc.lineSep = val if (!val) { return } var newBreaks = [], lineNo = cm.doc.first cm.doc.iter(function (line) { for (var pos = 0;;) { var found = line.text.indexOf(val, pos) if (found == -1) { break } pos = found + val.length newBreaks.push(Pos(lineNo, found)) } lineNo++ }) for (var i = newBreaks.length - 1; i >= 0; i--) { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)) } }) option("specialChars", /[\u0000-\u001f\u007f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) { cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g") if (old != Init) { cm.refresh() } }) option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true) option("electricChars", true) option("inputStyle", mobile ? "contenteditable" : "textarea", function () { throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME }, true) option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true) option("rtlMoveVisually", !windows) option("wholeLineUpdateBefore", true) option("theme", "default", function (cm) { themeChanged(cm) guttersChanged(cm) }, true) option("keyMap", "default", function (cm, val, old) { var next = getKeyMap(val) var prev = old != Init && getKeyMap(old) if (prev && prev.detach) { prev.detach(cm, next) } if (next.attach) { next.attach(cm, prev || null) } }) option("extraKeys", null) option("lineWrapping", false, wrappingChanged, true) option("gutters", [], function (cm) { setGuttersForLineNumbers(cm.options) guttersChanged(cm) }, true) option("fixedGutter", true, function (cm, val) { cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0" cm.refresh() }, true) option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true) option("scrollbarStyle", "native", function (cm) { initScrollbars(cm) updateScrollbars(cm) cm.display.scrollbars.setScrollTop(cm.doc.scrollTop) cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft) }, true) option("lineNumbers", false, function (cm) { setGuttersForLineNumbers(cm.options) guttersChanged(cm) }, true) option("firstLineNumber", 1, guttersChanged, true) option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true) option("showCursorWhenSelecting", false, updateSelection, true) option("resetSelectionOnContextMenu", true) option("lineWiseCopyCut", true) option("readOnly", false, function (cm, val) { if (val == "nocursor") { onBlur(cm) cm.display.input.blur() cm.display.disabled = true } else { cm.display.disabled = false } cm.display.input.readOnlyChanged(val) }) option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset() }}, true) option("dragDrop", true, dragDropChanged) option("allowDropFileTypes", null) option("cursorBlinkRate", 530) option("cursorScrollMargin", 0) option("cursorHeight", 1, updateSelection, true) option("singleCursorHeightPerLine", true, updateSelection, true) option("workTime", 100) option("workDelay", 100) option("flattenSpans", true, resetModeState, true) option("addModeClass", false, resetModeState, true) option("pollInterval", 100) option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; }) option("historyEventDelay", 1250) option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true) option("maxHighlightLength", 10000, resetModeState, true) option("moveInputWithCursor", true, function (cm, val) { if (!val) { cm.display.input.resetPosition() } }) option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; }) option("autofocus", null) } function guttersChanged(cm) { updateGutters(cm) regChange(cm) alignHorizontally(cm) } function dragDropChanged(cm, value, old) { var wasOn = old && old != Init if (!value != !wasOn) { var funcs = cm.display.dragFunctions var toggle = value ? on : off toggle(cm.display.scroller, "dragstart", funcs.start) toggle(cm.display.scroller, "dragenter", funcs.enter) toggle(cm.display.scroller, "dragover", funcs.over) toggle(cm.display.scroller, "dragleave", funcs.leave) toggle(cm.display.scroller, "drop", funcs.drop) } } function wrappingChanged(cm) { if (cm.options.lineWrapping) { addClass(cm.display.wrapper, "CodeMirror-wrap") cm.display.sizer.style.minWidth = "" cm.display.sizerWidth = null } else { rmClass(cm.display.wrapper, "CodeMirror-wrap") findMaxLine(cm) } estimateLineHeights(cm) regChange(cm) clearCaches(cm) setTimeout(function () { return updateScrollbars(cm); }, 100) } // A CodeMirror instance represents an editor. This is the object // that user code is usually dealing with. function CodeMirror(place, options) { var this$1 = this; if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) } this.options = options = options ? copyObj(options) : {} // Determine effective options based on given values and defaults. copyObj(defaults, options, false) setGuttersForLineNumbers(options) var doc = options.value if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator) } this.doc = doc var input = new CodeMirror.inputStyles[options.inputStyle](this) var display = this.display = new Display(place, doc, input) display.wrapper.CodeMirror = this updateGutters(this) themeChanged(this) if (options.lineWrapping) { this.display.wrapper.className += " CodeMirror-wrap" } initScrollbars(this) this.state = { keyMaps: [], // stores maps added by addKeyMap overlays: [], // highlighting overlays, as added by addOverlay modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info overwrite: false, delayingBlurEvent: false, focused: false, suppressEdits: false, // used to disable editing during key handlers when in readOnly mode pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll selectingText: false, draggingText: false, highlight: new Delayed(), // stores highlight worker timeout keySeq: null, // Unfinished key sequence specialChars: null } if (options.autofocus && !mobile) { display.input.focus() } // Override magic textarea content restore that IE sometimes does // on our hidden textarea on reload if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20) } registerEventHandlers(this) ensureGlobalHandlers() startOperation(this) this.curOp.forceUpdate = true attachDoc(this, doc) if ((options.autofocus && !mobile) || this.hasFocus()) { setTimeout(bind(onFocus, this), 20) } else { onBlur(this) } for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt)) { optionHandlers[opt](this$1, options[opt], Init) } } maybeUpdateLineNumberWidth(this) if (options.finishInit) { options.finishInit(this) } for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1) } endOperation(this) // Suppress optimizelegibility in Webkit, since it breaks text // measuring on line wrapping boundaries. if (webkit && options.lineWrapping && getComputedStyle(display.lineDiv).textRendering == "optimizelegibility") { display.lineDiv.style.textRendering = "auto" } } // The default configuration options. CodeMirror.defaults = defaults // Functions to run when options are changed. CodeMirror.optionHandlers = optionHandlers // Attach the necessary event handlers when initializing the editor function registerEventHandlers(cm) { var d = cm.display on(d.scroller, "mousedown", operation(cm, onMouseDown)) // Older IE's will not fire a second mousedown for a double click if (ie && ie_version < 11) { on(d.scroller, "dblclick", operation(cm, function (e) { if (signalDOMEvent(cm, e)) { return } var pos = posFromMouse(cm, e) if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return } e_preventDefault(e) var word = cm.findWordAt(pos) extendSelection(cm.doc, word.anchor, word.head) })) } else { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }) } // Some browsers fire contextmenu *after* opening the menu, at // which point we can't mess with it anymore. Context menu is // handled in onMouseDown for these browsers. if (!captureRightClick) { on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }) } // Used to suppress mouse event handling when a touch happens var touchFinished, prevTouch = {end: 0} function finishTouch() { if (d.activeTouch) { touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000) prevTouch = d.activeTouch prevTouch.end = +new Date } } function isMouseLikeTouchEvent(e) { if (e.touches.length != 1) { return false } var touch = e.touches[0] return touch.radiusX <= 1 && touch.radiusY <= 1 } function farAway(touch, other) { if (other.left == null) { return true } var dx = other.left - touch.left, dy = other.top - touch.top return dx * dx + dy * dy > 20 * 20 } on(d.scroller, "touchstart", function (e) { if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) { d.input.ensurePolled() clearTimeout(touchFinished) var now = +new Date d.activeTouch = {start: now, moved: false, prev: now - prevTouch.end <= 300 ? prevTouch : null} if (e.touches.length == 1) { d.activeTouch.left = e.touches[0].pageX d.activeTouch.top = e.touches[0].pageY } } }) on(d.scroller, "touchmove", function () { if (d.activeTouch) { d.activeTouch.moved = true } }) on(d.scroller, "touchend", function (e) { var touch = d.activeTouch if (touch && !eventInWidget(d, e) && touch.left != null && !touch.moved && new Date - touch.start < 300) { var pos = cm.coordsChar(d.activeTouch, "page"), range if (!touch.prev || farAway(touch, touch.prev)) // Single tap { range = new Range(pos, pos) } else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap { range = cm.findWordAt(pos) } else // Triple tap { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) } cm.setSelection(range.anchor, range.head) cm.focus() e_preventDefault(e) } finishTouch() }) on(d.scroller, "touchcancel", finishTouch) // Sync scrolling between fake scrollbars and real scrollable // area, ensure viewport is updated when scrolling. on(d.scroller, "scroll", function () { if (d.scroller.clientHeight) { setScrollTop(cm, d.scroller.scrollTop) setScrollLeft(cm, d.scroller.scrollLeft, true) signal(cm, "scroll", cm) } }) // Listen to wheel events in order to try and update the viewport on time. on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); }) on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); }) // Prevent wrapper from ever scrolling on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; }) d.dragFunctions = { enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e) }}, over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e) }}, start: function (e) { return onDragStart(cm, e); }, drop: operation(cm, onDrop), leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm) }} } var inp = d.input.getField() on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); }) on(inp, "keydown", operation(cm, onKeyDown)) on(inp, "keypress", operation(cm, onKeyPress)) on(inp, "focus", function (e) { return onFocus(cm, e); }) on(inp, "blur", function (e) { return onBlur(cm, e); }) } var initHooks = [] CodeMirror.defineInitHook = function (f) { return initHooks.push(f); } // Indent the given line. The how parameter can be "smart", // "add"/null, "subtract", or "prev". When aggressive is false // (typically set to true for forced single-line indents), empty // lines are not indented, and places where the mode returns Pass // are left alone. function indentLine(cm, n, how, aggressive) { var doc = cm.doc, state if (how == null) { how = "add" } if (how == "smart") { // Fall back to "prev" when the mode doesn't have an indentation // method. if (!doc.mode.indent) { how = "prev" } else { state = getStateBefore(cm, n) } } var tabSize = cm.options.tabSize var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize) if (line.stateAfter) { line.stateAfter = null } var curSpaceString = line.text.match(/^\s*/)[0], indentation if (!aggressive && !/\S/.test(line.text)) { indentation = 0 how = "not" } else if (how == "smart") { indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text) if (indentation == Pass || indentation > 150) { if (!aggressive) { return } how = "prev" } } if (how == "prev") { if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize) } else { indentation = 0 } } else if (how == "add") { indentation = curSpace + cm.options.indentUnit } else if (how == "subtract") { indentation = curSpace - cm.options.indentUnit } else if (typeof how == "number") { indentation = curSpace + how } indentation = Math.max(0, indentation) var indentString = "", pos = 0 if (cm.options.indentWithTabs) { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t"} } if (pos < indentation) { indentString += spaceStr(indentation - pos) } if (indentString != curSpaceString) { replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input") line.stateAfter = null return true } else { // Ensure that, if the cursor was in the whitespace at the start // of the line, it is moved to the end of that space. for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) { var range = doc.sel.ranges[i$1] if (range.head.line == n && range.head.ch < curSpaceString.length) { var pos$1 = Pos(n, curSpaceString.length) replaceOneSelection(doc, i$1, new Range(pos$1, pos$1)) break } } } } // This will be set to a {lineWise: bool, text: [string]} object, so // that, when pasting, we know what kind of selections the copied // text was made out of. var lastCopied = null function setLastCopied(newLastCopied) { lastCopied = newLastCopied } function applyTextInput(cm, inserted, deleted, sel, origin) { var doc = cm.doc cm.display.shift = false if (!sel) { sel = doc.sel } var paste = cm.state.pasteIncoming || origin == "paste" var textLines = splitLinesAuto(inserted), multiPaste = null // When pasing N lines into N selections, insert one line per selection if (paste && sel.ranges.length > 1) { if (lastCopied && lastCopied.text.join("\n") == inserted) { if (sel.ranges.length % lastCopied.text.length == 0) { multiPaste = [] for (var i = 0; i < lastCopied.text.length; i++) { multiPaste.push(doc.splitLines(lastCopied.text[i])) } } } else if (textLines.length == sel.ranges.length) { multiPaste = map(textLines, function (l) { return [l]; }) } } var updateInput // Normal behavior is to insert the new text into every selection for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) { var range = sel.ranges[i$1] var from = range.from(), to = range.to() if (range.empty()) { if (deleted && deleted > 0) // Handle deletion { from = Pos(from.line, from.ch - deleted) } else if (cm.state.overwrite && !paste) // Handle overwrite { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)) } else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted) { from = to = Pos(from.line, 0) } } updateInput = cm.curOp.updateInput var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines, origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")} makeChange(cm.doc, changeEvent) signalLater(cm, "inputRead", cm, changeEvent) } if (inserted && !paste) { triggerElectric(cm, inserted) } ensureCursorVisible(cm) cm.curOp.updateInput = updateInput cm.curOp.typing = true cm.state.pasteIncoming = cm.state.cutIncoming = false } function handlePaste(e, cm) { var pasted = e.clipboardData && e.clipboardData.getData("Text") if (pasted) { e.preventDefault() if (!cm.isReadOnly() && !cm.options.disableInput) { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }) } return true } } function triggerElectric(cm, inserted) { // When an 'electric' character is inserted, immediately trigger a reindent if (!cm.options.electricChars || !cm.options.smartIndent) { return } var sel = cm.doc.sel for (var i = sel.ranges.length - 1; i >= 0; i--) { var range = sel.ranges[i] if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue } var mode = cm.getModeAt(range.head) var indented = false if (mode.electricChars) { for (var j = 0; j < mode.electricChars.length; j++) { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) { indented = indentLine(cm, range.head.line, "smart") break } } } else if (mode.electricInput) { if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch))) { indented = indentLine(cm, range.head.line, "smart") } } if (indented) { signalLater(cm, "electricInput", cm, range.head.line) } } } function copyableRanges(cm) { var text = [], ranges = [] for (var i = 0; i < cm.doc.sel.ranges.length; i++) { var line = cm.doc.sel.ranges[i].head.line var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)} ranges.push(lineRange) text.push(cm.getRange(lineRange.anchor, lineRange.head)) } return {text: text, ranges: ranges} } function disableBrowserMagic(field, spellcheck) { field.setAttribute("autocorrect", "off") field.setAttribute("autocapitalize", "off") field.setAttribute("spellcheck", !!spellcheck) } function hiddenTextarea() { var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none") var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;") // The textarea is kept positioned near the cursor to prevent the // fact that it'll be scrolled into view on input from scrolling // our fake cursor out of view. On webkit, when wrap=off, paste is // very slow. So make the area wide instead. if (webkit) { te.style.width = "1000px" } else { te.setAttribute("wrap", "off") } // If border: 0; -- iOS fails to open keyboard (issue #1287) if (ios) { te.style.border = "1px solid black" } disableBrowserMagic(te) return div } // The publicly visible API. Note that methodOp(f) means // 'wrap f in an operation, performed on its `this` parameter'. // This is not the complete set of editor methods. Most of the // methods defined on the Doc type are also injected into // CodeMirror.prototype, for backwards compatibility and // convenience. function addEditorMethods(CodeMirror) { var optionHandlers = CodeMirror.optionHandlers var helpers = CodeMirror.helpers = {} CodeMirror.prototype = { constructor: CodeMirror, focus: function(){window.focus(); this.display.input.focus()}, setOption: function(option, value) { var options = this.options, old = options[option] if (options[option] == value && option != "mode") { return } options[option] = value if (optionHandlers.hasOwnProperty(option)) { operation(this, optionHandlers[option])(this, value, old) } signal(this, "optionChange", this, option) }, getOption: function(option) {return this.options[option]}, getDoc: function() {return this.doc}, addKeyMap: function(map, bottom) { this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map)) }, removeKeyMap: function(map) { var maps = this.state.keyMaps for (var i = 0; i < maps.length; ++i) { if (maps[i] == map || maps[i].name == map) { maps.splice(i, 1) return true } } }, addOverlay: methodOp(function(spec, options) { var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec) if (mode.startState) { throw new Error("Overlays may not be stateful.") } insertSorted(this.state.overlays, {mode: mode, modeSpec: spec, opaque: options && options.opaque, priority: (options && options.priority) || 0}, function (overlay) { return overlay.priority; }) this.state.modeGen++ regChange(this) }), removeOverlay: methodOp(function(spec) { var this$1 = this; var overlays = this.state.overlays for (var i = 0; i < overlays.length; ++i) { var cur = overlays[i].modeSpec if (cur == spec || typeof spec == "string" && cur.name == spec) { overlays.splice(i, 1) this$1.state.modeGen++ regChange(this$1) return } } }), indentLine: methodOp(function(n, dir, aggressive) { if (typeof dir != "string" && typeof dir != "number") { if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev" } else { dir = dir ? "add" : "subtract" } } if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive) } }), indentSelection: methodOp(function(how) { var this$1 = this; var ranges = this.doc.sel.ranges, end = -1 for (var i = 0; i < ranges.length; i++) { var range = ranges[i] if (!range.empty()) { var from = range.from(), to = range.to() var start = Math.max(end, from.line) end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1 for (var j = start; j < end; ++j) { indentLine(this$1, j, how) } var newRanges = this$1.doc.sel.ranges if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll) } } else if (range.head.line > end) { indentLine(this$1, range.head.line, how, true) end = range.head.line if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1) } } } }), // Fetch the parser token for a given character. Useful for hacks // that want to inspect the mode state (say, for completion). getTokenAt: function(pos, precise) { return takeToken(this, pos, precise) }, getLineTokens: function(line, precise) { return takeToken(this, Pos(line), precise, true) }, getTokenTypeAt: function(pos) { pos = clipPos(this.doc, pos) var styles = getLineStyles(this, getLine(this.doc, pos.line)) var before = 0, after = (styles.length - 1) / 2, ch = pos.ch var type if (ch == 0) { type = styles[2] } else { for (;;) { var mid = (before + after) >> 1 if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid } else if (styles[mid * 2 + 1] < ch) { before = mid + 1 } else { type = styles[mid * 2 + 2]; break } } } var cut = type ? type.indexOf("overlay ") : -1 return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1) }, getModeAt: function(pos) { var mode = this.doc.mode if (!mode.innerMode) { return mode } return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode }, getHelper: function(pos, type) { return this.getHelpers(pos, type)[0] }, getHelpers: function(pos, type) { var this$1 = this; var found = [] if (!helpers.hasOwnProperty(type)) { return found } var help = helpers[type], mode = this.getModeAt(pos) if (typeof mode[type] == "string") { if (help[mode[type]]) { found.push(help[mode[type]]) } } else if (mode[type]) { for (var i = 0; i < mode[type].length; i++) { var val = help[mode[type][i]] if (val) { found.push(val) } } } else if (mode.helperType && help[mode.helperType]) { found.push(help[mode.helperType]) } else if (help[mode.name]) { found.push(help[mode.name]) } for (var i$1 = 0; i$1 < help._global.length; i$1++) { var cur = help._global[i$1] if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1) { found.push(cur.val) } } return found }, getStateAfter: function(line, precise) { var doc = this.doc line = clipLine(doc, line == null ? doc.first + doc.size - 1: line) return getStateBefore(this, line + 1, precise) }, cursorCoords: function(start, mode) { var pos, range = this.doc.sel.primary() if (start == null) { pos = range.head } else if (typeof start == "object") { pos = clipPos(this.doc, start) } else { pos = start ? range.from() : range.to() } return cursorCoords(this, pos, mode || "page") }, charCoords: function(pos, mode) { return charCoords(this, clipPos(this.doc, pos), mode || "page") }, coordsChar: function(coords, mode) { coords = fromCoordSystem(this, coords, mode || "page") return coordsChar(this, coords.left, coords.top) }, lineAtHeight: function(height, mode) { height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top return lineAtHeight(this.doc, height + this.display.viewOffset) }, heightAtLine: function(line, mode, includeWidgets) { var end = false, lineObj if (typeof line == "number") { var last = this.doc.first + this.doc.size - 1 if (line < this.doc.first) { line = this.doc.first } else if (line > last) { line = last; end = true } lineObj = getLine(this.doc, line) } else { lineObj = line } return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top + (end ? this.doc.height - heightAtLine(lineObj) : 0) }, defaultTextHeight: function() { return textHeight(this.display) }, defaultCharWidth: function() { return charWidth(this.display) }, getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}}, addWidget: function(pos, node, scroll, vert, horiz) { var display = this.display pos = cursorCoords(this, clipPos(this.doc, pos)) var top = pos.bottom, left = pos.left node.style.position = "absolute" node.setAttribute("cm-ignore-events", "true") this.display.input.setUneditable(node) display.sizer.appendChild(node) if (vert == "over") { top = pos.top } else if (vert == "above" || vert == "near") { var vspace = Math.max(display.wrapper.clientHeight, this.doc.height), hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth) // Default to positioning above (if specified and possible); otherwise default to positioning below if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) { top = pos.top - node.offsetHeight } else if (pos.bottom + node.offsetHeight <= vspace) { top = pos.bottom } if (left + node.offsetWidth > hspace) { left = hspace - node.offsetWidth } } node.style.top = top + "px" node.style.left = node.style.right = "" if (horiz == "right") { left = display.sizer.clientWidth - node.offsetWidth node.style.right = "0px" } else { if (horiz == "left") { left = 0 } else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2 } node.style.left = left + "px" } if (scroll) { scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight) } }, triggerOnKeyDown: methodOp(onKeyDown), triggerOnKeyPress: methodOp(onKeyPress), triggerOnKeyUp: onKeyUp, execCommand: function(cmd) { if (commands.hasOwnProperty(cmd)) { return commands[cmd].call(null, this) } }, triggerElectric: methodOp(function(text) { triggerElectric(this, text) }), findPosH: function(from, amount, unit, visually) { var this$1 = this; var dir = 1 if (amount < 0) { dir = -1; amount = -amount } var cur = clipPos(this.doc, from) for (var i = 0; i < amount; ++i) { cur = findPosH(this$1.doc, cur, dir, unit, visually) if (cur.hitSide) { break } } return cur }, moveH: methodOp(function(dir, unit) { var this$1 = this; this.extendSelectionsBy(function (range) { if (this$1.display.shift || this$1.doc.extend || range.empty()) { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) } else { return dir < 0 ? range.from() : range.to() } }, sel_move) }), deleteH: methodOp(function(dir, unit) { var sel = this.doc.sel, doc = this.doc if (sel.somethingSelected()) { doc.replaceSelection("", null, "+delete") } else { deleteNearSelection(this, function (range) { var other = findPosH(doc, range.head, dir, unit, false) return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other} }) } }), findPosV: function(from, amount, unit, goalColumn) { var this$1 = this; var dir = 1, x = goalColumn if (amount < 0) { dir = -1; amount = -amount } var cur = clipPos(this.doc, from) for (var i = 0; i < amount; ++i) { var coords = cursorCoords(this$1, cur, "div") if (x == null) { x = coords.left } else { coords.left = x } cur = findPosV(this$1, coords, dir, unit) if (cur.hitSide) { break } } return cur }, moveV: methodOp(function(dir, unit) { var this$1 = this; var doc = this.doc, goals = [] var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected() doc.extendSelectionsBy(function (range) { if (collapse) { return dir < 0 ? range.from() : range.to() } var headPos = cursorCoords(this$1, range.head, "div") if (range.goalColumn != null) { headPos.left = range.goalColumn } goals.push(headPos.left) var pos = findPosV(this$1, headPos, dir, unit) if (unit == "page" && range == doc.sel.primary()) { addToScrollPos(this$1, null, charCoords(this$1, pos, "div").top - headPos.top) } return pos }, sel_move) if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++) { doc.sel.ranges[i].goalColumn = goals[i] } } }), // Find the word at the given position (as returned by coordsChar). findWordAt: function(pos) { var doc = this.doc, line = getLine(doc, pos.line).text var start = pos.ch, end = pos.ch if (line) { var helper = this.getHelper(pos, "wordChars") if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end } var startChar = line.charAt(start) var check = isWordChar(startChar, helper) ? function (ch) { return isWordChar(ch, helper); } : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); } : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); } while (start > 0 && check(line.charAt(start - 1))) { --start } while (end < line.length && check(line.charAt(end))) { ++end } } return new Range(Pos(pos.line, start), Pos(pos.line, end)) }, toggleOverwrite: function(value) { if (value != null && value == this.state.overwrite) { return } if (this.state.overwrite = !this.state.overwrite) { addClass(this.display.cursorDiv, "CodeMirror-overwrite") } else { rmClass(this.display.cursorDiv, "CodeMirror-overwrite") } signal(this, "overwriteToggle", this, this.state.overwrite) }, hasFocus: function() { return this.display.input.getField() == activeElt() }, isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) }, scrollTo: methodOp(function(x, y) { if (x != null || y != null) { resolveScrollToPos(this) } if (x != null) { this.curOp.scrollLeft = x } if (y != null) { this.curOp.scrollTop = y } }), getScrollInfo: function() { var scroller = this.display.scroller return {left: scroller.scrollLeft, top: scroller.scrollTop, height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight, width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth, clientHeight: displayHeight(this), clientWidth: displayWidth(this)} }, scrollIntoView: methodOp(function(range, margin) { if (range == null) { range = {from: this.doc.sel.primary().head, to: null} if (margin == null) { margin = this.options.cursorScrollMargin } } else if (typeof range == "number") { range = {from: Pos(range, 0), to: null} } else if (range.from == null) { range = {from: range, to: null} } if (!range.to) { range.to = range.from } range.margin = margin || 0 if (range.from.line != null) { resolveScrollToPos(this) this.curOp.scrollToPos = range } else { var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left), Math.min(range.from.top, range.to.top) - range.margin, Math.max(range.from.right, range.to.right), Math.max(range.from.bottom, range.to.bottom) + range.margin) this.scrollTo(sPos.scrollLeft, sPos.scrollTop) } }), setSize: methodOp(function(width, height) { var this$1 = this; var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; } if (width != null) { this.display.wrapper.style.width = interpret(width) } if (height != null) { this.display.wrapper.style.height = interpret(height) } if (this.options.lineWrapping) { clearLineMeasurementCache(this) } var lineNo = this.display.viewFrom this.doc.iter(lineNo, this.display.viewTo, function (line) { if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } } ++lineNo }) this.curOp.forceUpdate = true signal(this, "refresh", this) }), operation: function(f){return runInOp(this, f)}, refresh: methodOp(function() { var oldHeight = this.display.cachedTextHeight regChange(this) this.curOp.forceUpdate = true clearCaches(this) this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop) updateGutterSpace(this) if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5) { estimateLineHeights(this) } signal(this, "refresh", this) }), swapDoc: methodOp(function(doc) { var old = this.doc old.cm = null attachDoc(this, doc) clearCaches(this) this.display.input.reset() this.scrollTo(doc.scrollLeft, doc.scrollTop) this.curOp.forceScroll = true signalLater(this, "swapDoc", this, old) return old }), getInputField: function(){return this.display.input.getField()}, getWrapperElement: function(){return this.display.wrapper}, getScrollerElement: function(){return this.display.scroller}, getGutterElement: function(){return this.display.gutters} } eventMixin(CodeMirror) CodeMirror.registerHelper = function(type, name, value) { if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []} } helpers[type][name] = value } CodeMirror.registerGlobalHelper = function(type, name, predicate, value) { CodeMirror.registerHelper(type, name, value) helpers[type]._global.push({pred: predicate, val: value}) } } // Used for horizontal relative motion. Dir is -1 or 1 (left or // right), unit can be "char", "column" (like char, but doesn't // cross line boundaries), "word" (across next word), or "group" (to // the start of next group of word or non-word-non-whitespace // chars). The visually param controls whether, in right-to-left // text, direction 1 means to move towards the next index in the // string, or towards the character to the right of the current // position. The resulting position will have a hitSide=true // property if it reached the end of the document. function findPosH(doc, pos, dir, unit, visually) { var oldPos = pos var origDir = dir var lineObj = getLine(doc, pos.line) function findNextLine() { var l = pos.line + dir if (l < doc.first || l >= doc.first + doc.size) { return false } pos = new Pos(l, pos.ch, pos.sticky) return lineObj = getLine(doc, l) } function moveOnce(boundToLine) { var next if (visually) { next = moveVisually(doc.cm, lineObj, pos, dir) } else { next = moveLogically(lineObj, pos, dir) } if (next == null) { if (!boundToLine && findNextLine()) { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir) } else { return false } } else { pos = next } return true } if (unit == "char") { moveOnce() } else if (unit == "column") { moveOnce(true) } else if (unit == "word" || unit == "group") { var sawType = null, group = unit == "group" var helper = doc.cm && doc.cm.getHelper(pos, "wordChars") for (var first = true;; first = false) { if (dir < 0 && !moveOnce(!first)) { break } var cur = lineObj.text.charAt(pos.ch) || "\n" var type = isWordChar(cur, helper) ? "w" : group && cur == "\n" ? "n" : !group || /\s/.test(cur) ? null : "p" if (group && !first && !type) { type = "s" } if (sawType && sawType != type) { if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after"} break } if (type) { sawType = type } if (dir > 0 && !moveOnce(!first)) { break } } } var result = skipAtomic(doc, pos, oldPos, origDir, true) if (equalCursorPos(oldPos, result)) { result.hitSide = true } return result } // For relative vertical movement. Dir may be -1 or 1. Unit can be // "page" or "line". The resulting position will have a hitSide=true // property if it reached the end of the document. function findPosV(cm, pos, dir, unit) { var doc = cm.doc, x = pos.left, y if (unit == "page") { var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight) var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3) y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount } else if (unit == "line") { y = dir > 0 ? pos.bottom + 3 : pos.top - 3 } var target for (;;) { target = coordsChar(cm, x, y) if (!target.outside) { break } if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break } y += dir * 5 } return target } // CONTENTEDITABLE INPUT STYLE var ContentEditableInput = function(cm) { this.cm = cm this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null this.polling = new Delayed() this.composing = null this.gracePeriod = false this.readDOMTimeout = null }; ContentEditableInput.prototype.init = function (display) { var this$1 = this; var input = this, cm = input.cm var div = input.div = display.lineDiv disableBrowserMagic(div, cm.options.spellcheck) on(div, "paste", function (e) { if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return } // IE doesn't fire input events, so we schedule a read for the pasted content in this way if (ie_version <= 11) { setTimeout(operation(cm, function () { if (!input.pollContent()) { regChange(cm) } }), 20) } }) on(div, "compositionstart", function (e) { this$1.composing = {data: e.data, done: false} }) on(div, "compositionupdate", function (e) { if (!this$1.composing) { this$1.composing = {data: e.data, done: false} } }) on(div, "compositionend", function (e) { if (this$1.composing) { if (e.data != this$1.composing.data) { this$1.readFromDOMSoon() } this$1.composing.done = true } }) on(div, "touchstart", function () { return input.forceCompositionEnd(); }) on(div, "input", function () { if (!this$1.composing) { this$1.readFromDOMSoon() } }) function onCopyCut(e) { if (signalDOMEvent(cm, e)) { return } if (cm.somethingSelected()) { setLastCopied({lineWise: false, text: cm.getSelections()}) if (e.type == "cut") { cm.replaceSelection("", null, "cut") } } else if (!cm.options.lineWiseCopyCut) { return } else { var ranges = copyableRanges(cm) setLastCopied({lineWise: true, text: ranges.text}) if (e.type == "cut") { cm.operation(function () { cm.setSelections(ranges.ranges, 0, sel_dontScroll) cm.replaceSelection("", null, "cut") }) } } if (e.clipboardData) { e.clipboardData.clearData() var content = lastCopied.text.join("\n") // iOS exposes the clipboard API, but seems to discard content inserted into it e.clipboardData.setData("Text", content) if (e.clipboardData.getData("Text") == content) { e.preventDefault() return } } // Old-fashioned briefly-focus-a-textarea hack var kludge = hiddenTextarea(), te = kludge.firstChild cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild) te.value = lastCopied.text.join("\n") var hadFocus = document.activeElement selectInput(te) setTimeout(function () { cm.display.lineSpace.removeChild(kludge) hadFocus.focus() if (hadFocus == div) { input.showPrimarySelection() } }, 50) } on(div, "copy", onCopyCut) on(div, "cut", onCopyCut) }; ContentEditableInput.prototype.prepareSelection = function () { var result = prepareSelection(this.cm, false) result.focus = this.cm.state.focused return result }; ContentEditableInput.prototype.showSelection = function (info, takeFocus) { if (!info || !this.cm.display.view.length) { return } if (info.focus || takeFocus) { this.showPrimarySelection() } this.showMultipleSelections(info) }; ContentEditableInput.prototype.showPrimarySelection = function () { var sel = window.getSelection(), prim = this.cm.doc.sel.primary() var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset) var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset) if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad && cmp(minPos(curAnchor, curFocus), prim.from()) == 0 && cmp(maxPos(curAnchor, curFocus), prim.to()) == 0) { return } var start = posToDOM(this.cm, prim.from()) var end = posToDOM(this.cm, prim.to()) if (!start && !end) { return } var view = this.cm.display.view var old = sel.rangeCount && sel.getRangeAt(0) if (!start) { start = {node: view[0].measure.map[2], offset: 0} } else if (!end) { // FIXME dangerously hacky var measure = view[view.length - 1].measure var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]} } var rng try { rng = range(start.node, start.offset, end.offset, end.node) } catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible if (rng) { if (!gecko && this.cm.state.focused) { sel.collapse(start.node, start.offset) if (!rng.collapsed) { sel.removeAllRanges() sel.addRange(rng) } } else { sel.removeAllRanges() sel.addRange(rng) } if (old && sel.anchorNode == null) { sel.addRange(old) } else if (gecko) { this.startGracePeriod() } } this.rememberSelection() }; ContentEditableInput.prototype.startGracePeriod = function () { var this$1 = this; clearTimeout(this.gracePeriod) this.gracePeriod = setTimeout(function () { this$1.gracePeriod = false if (this$1.selectionChanged()) { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }) } }, 20) }; ContentEditableInput.prototype.showMultipleSelections = function (info) { removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors) removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection) }; ContentEditableInput.prototype.rememberSelection = function () { var sel = window.getSelection() this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset }; ContentEditableInput.prototype.selectionInEditor = function () { var sel = window.getSelection() if (!sel.rangeCount) { return false } var node = sel.getRangeAt(0).commonAncestorContainer return contains(this.div, node) }; ContentEditableInput.prototype.focus = function () { if (this.cm.options.readOnly != "nocursor") { if (!this.selectionInEditor()) { this.showSelection(this.prepareSelection(), true) } this.div.focus() } }; ContentEditableInput.prototype.blur = function () { this.div.blur() }; ContentEditableInput.prototype.getField = function () { return this.div }; ContentEditableInput.prototype.supportsTouch = function () { return true }; ContentEditableInput.prototype.receivedFocus = function () { var input = this if (this.selectionInEditor()) { this.pollSelection() } else { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }) } function poll() { if (input.cm.state.focused) { input.pollSelection() input.polling.set(input.cm.options.pollInterval, poll) } } this.polling.set(this.cm.options.pollInterval, poll) }; ContentEditableInput.prototype.selectionChanged = function () { var sel = window.getSelection() return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset || sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset }; ContentEditableInput.prototype.pollSelection = function () { if (!this.composing && this.readDOMTimeout == null && !this.gracePeriod && this.selectionChanged()) { var sel = window.getSelection(), cm = this.cm this.rememberSelection() var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset) var head = domToPos(cm, sel.focusNode, sel.focusOffset) if (anchor && head) { runInOp(cm, function () { setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll) if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true } }) } } }; ContentEditableInput.prototype.pollContent = function () { if (this.readDOMTimeout != null) { clearTimeout(this.readDOMTimeout) this.readDOMTimeout = null } var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary() var from = sel.from(), to = sel.to() if (from.ch == 0 && from.line > cm.firstLine()) { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length) } if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine()) { to = Pos(to.line + 1, 0) } if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false } var fromIndex, fromLine, fromNode if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) { fromLine = lineNo(display.view[0].line) fromNode = display.view[0].node } else { fromLine = lineNo(display.view[fromIndex].line) fromNode = display.view[fromIndex - 1].node.nextSibling } var toIndex = findViewIndex(cm, to.line) var toLine, toNode if (toIndex == display.view.length - 1) { toLine = display.viewTo - 1 toNode = display.lineDiv.lastChild } else { toLine = lineNo(display.view[toIndex + 1].line) - 1 toNode = display.view[toIndex + 1].node.previousSibling } if (!fromNode) { return false } var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine)) var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length)) while (newText.length > 1 && oldText.length > 1) { if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine-- } else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++ } else { break } } var cutFront = 0, cutEnd = 0 var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length) while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront)) { ++cutFront } var newBot = lst(newText), oldBot = lst(oldText) var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0), oldBot.length - (oldText.length == 1 ? cutFront : 0)) while (cutEnd < maxCutEnd && newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) { ++cutEnd } newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "") newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "") var chFrom = Pos(fromLine, cutFront) var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0) if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) { replaceRange(cm.doc, newText, chFrom, chTo, "+input") return true } }; ContentEditableInput.prototype.ensurePolled = function () { this.forceCompositionEnd() }; ContentEditableInput.prototype.reset = function () { this.forceCompositionEnd() }; ContentEditableInput.prototype.forceCompositionEnd = function () { if (!this.composing) { return } clearTimeout(this.readDOMTimeout) this.composing = null if (!this.pollContent()) { regChange(this.cm) } this.div.blur() this.div.focus() }; ContentEditableInput.prototype.readFromDOMSoon = function () { var this$1 = this; if (this.readDOMTimeout != null) { return } this.readDOMTimeout = setTimeout(function () { this$1.readDOMTimeout = null if (this$1.composing) { if (this$1.composing.done) { this$1.composing = null } else { return } } if (this$1.cm.isReadOnly() || !this$1.pollContent()) { runInOp(this$1.cm, function () { return regChange(this$1.cm); }) } }, 80) }; ContentEditableInput.prototype.setUneditable = function (node) { node.contentEditable = "false" }; ContentEditableInput.prototype.onKeyPress = function (e) { if (e.charCode == 0) { return } e.preventDefault() if (!this.cm.isReadOnly()) { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0) } }; ContentEditableInput.prototype.readOnlyChanged = function (val) { this.div.contentEditable = String(val != "nocursor") }; ContentEditableInput.prototype.onContextMenu = function () {}; ContentEditableInput.prototype.resetPosition = function () {}; ContentEditableInput.prototype.needsContentAttribute = true function posToDOM(cm, pos) { var view = findViewForLine(cm, pos.line) if (!view || view.hidden) { return null } var line = getLine(cm.doc, pos.line) var info = mapFromLineView(view, line, pos.line) var order = getOrder(line), side = "left" if (order) { var partPos = getBidiPartAt(order, pos.ch) side = partPos % 2 ? "right" : "left" } var result = nodeAndOffsetInLineMap(info.map, pos.ch, side) result.offset = result.collapse == "right" ? result.end : result.start return result } function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos } function domTextBetween(cm, from, to, fromLine, toLine) { var text = "", closing = false, lineSep = cm.doc.lineSeparator() function recognizeMarker(id) { return function (marker) { return marker.id == id; } } function walk(node) { if (node.nodeType == 1) { var cmText = node.getAttribute("cm-text") if (cmText != null) { if (cmText == "") { text += node.textContent.replace(/\u200b/g, "") } else { text += cmText } return } var markerID = node.getAttribute("cm-marker"), range if (markerID) { var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID)) if (found.length && (range = found[0].find())) { text += getBetween(cm.doc, range.from, range.to).join(lineSep) } return } if (node.getAttribute("contenteditable") == "false") { return } for (var i = 0; i < node.childNodes.length; i++) { walk(node.childNodes[i]) } if (/^(pre|div|p)$/i.test(node.nodeName)) { closing = true } } else if (node.nodeType == 3) { var val = node.nodeValue if (!val) { return } if (closing) { text += lineSep closing = false } text += val } } for (;;) { walk(from) if (from == to) { break } from = from.nextSibling } return text } function domToPos(cm, node, offset) { var lineNode if (node == cm.display.lineDiv) { lineNode = cm.display.lineDiv.childNodes[offset] if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) } node = null; offset = 0 } else { for (lineNode = node;; lineNode = lineNode.parentNode) { if (!lineNode || lineNode == cm.display.lineDiv) { return null } if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break } } } for (var i = 0; i < cm.display.view.length; i++) { var lineView = cm.display.view[i] if (lineView.node == lineNode) { return locateNodeInLineView(lineView, node, offset) } } } function locateNodeInLineView(lineView, node, offset) { var wrapper = lineView.text.firstChild, bad = false if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) } if (node == wrapper) { bad = true node = wrapper.childNodes[offset] offset = 0 if (!node) { var line = lineView.rest ? lst(lineView.rest) : lineView.line return badPos(Pos(lineNo(line), line.text.length), bad) } } var textNode = node.nodeType == 3 ? node : null, topNode = node if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) { textNode = node.firstChild if (offset) { offset = textNode.nodeValue.length } } while (topNode.parentNode != wrapper) { topNode = topNode.parentNode } var measure = lineView.measure, maps = measure.maps function find(textNode, topNode, offset) { for (var i = -1; i < (maps ? maps.length : 0); i++) { var map = i < 0 ? measure.map : maps[i] for (var j = 0; j < map.length; j += 3) { var curNode = map[j + 2] if (curNode == textNode || curNode == topNode) { var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]) var ch = map[j] + offset if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)] } return Pos(line, ch) } } } } var found = find(textNode, topNode, offset) if (found) { return badPos(found, bad) } // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) { found = find(after, after.firstChild, 0) if (found) { return badPos(Pos(found.line, found.ch - dist), bad) } else { dist += after.textContent.length } } for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) { found = find(before, before.firstChild, -1) if (found) { return badPos(Pos(found.line, found.ch + dist$1), bad) } else { dist$1 += before.textContent.length } } } // TEXTAREA INPUT STYLE var TextareaInput = function(cm) { this.cm = cm // See input.poll and input.reset this.prevInput = "" // Flag that indicates whether we expect input to appear real soon // now (after some event like 'keypress' or 'input') and are // polling intensively. this.pollingFast = false // Self-resetting timeout for the poller this.polling = new Delayed() // Tracks when input.reset has punted to just putting a short // string into the textarea instead of the full selection. this.inaccurateSelection = false // Used to work around IE issue with selection being forgotten when focus moves away from textarea this.hasSelection = false this.composing = null }; TextareaInput.prototype.init = function (display) { var this$1 = this; var input = this, cm = this.cm // Wraps and hides input textarea var div = this.wrapper = hiddenTextarea() // The semihidden textarea that is focused when the editor is // focused, and receives input. var te = this.textarea = div.firstChild display.wrapper.insertBefore(div, display.wrapper.firstChild) // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore) if (ios) { te.style.width = "0px" } on(te, "input", function () { if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null } input.poll() }) on(te, "paste", function (e) { if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return } cm.state.pasteIncoming = true input.fastPoll() }) function prepareCopyCut(e) { if (signalDOMEvent(cm, e)) { return } if (cm.somethingSelected()) { setLastCopied({lineWise: false, text: cm.getSelections()}) if (input.inaccurateSelection) { input.prevInput = "" input.inaccurateSelection = false te.value = lastCopied.text.join("\n") selectInput(te) } } else if (!cm.options.lineWiseCopyCut) { return } else { var ranges = copyableRanges(cm) setLastCopied({lineWise: true, text: ranges.text}) if (e.type == "cut") { cm.setSelections(ranges.ranges, null, sel_dontScroll) } else { input.prevInput = "" te.value = ranges.text.join("\n") selectInput(te) } } if (e.type == "cut") { cm.state.cutIncoming = true } } on(te, "cut", prepareCopyCut) on(te, "copy", prepareCopyCut) on(display.scroller, "paste", function (e) { if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return } cm.state.pasteIncoming = true input.focus() }) // Prevent normal selection in the editor (we handle our own) on(display.lineSpace, "selectstart", function (e) { if (!eventInWidget(display, e)) { e_preventDefault(e) } }) on(te, "compositionstart", function () { var start = cm.getCursor("from") if (input.composing) { input.composing.range.clear() } input.composing = { start: start, range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"}) } }) on(te, "compositionend", function () { if (input.composing) { input.poll() input.composing.range.clear() input.composing = null } }) }; TextareaInput.prototype.prepareSelection = function () { // Redraw the selection and/or cursor var cm = this.cm, display = cm.display, doc = cm.doc var result = prepareSelection(cm) // Move the hidden textarea near the cursor to prevent scrolling artifacts if (cm.options.moveInputWithCursor) { var headPos = cursorCoords(cm, doc.sel.primary().head, "div") var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect() result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10, headPos.top + lineOff.top - wrapOff.top)) result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10, headPos.left + lineOff.left - wrapOff.left)) } return result }; TextareaInput.prototype.showSelection = function (drawn) { var cm = this.cm, display = cm.display removeChildrenAndAdd(display.cursorDiv, drawn.cursors) removeChildrenAndAdd(display.selectionDiv, drawn.selection) if (drawn.teTop != null) { this.wrapper.style.top = drawn.teTop + "px" this.wrapper.style.left = drawn.teLeft + "px" } }; // Reset the input to correspond to the selection (or to be empty, // when not typing and nothing is selected) TextareaInput.prototype.reset = function (typing) { if (this.contextMenuPending) { return } var minimal, selected, cm = this.cm, doc = cm.doc if (cm.somethingSelected()) { this.prevInput = "" var range = doc.sel.primary() minimal = hasCopyEvent && (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000) var content = minimal ? "-" : selected || cm.getSelection() this.textarea.value = content if (cm.state.focused) { selectInput(this.textarea) } if (ie && ie_version >= 9) { this.hasSelection = content } } else if (!typing) { this.prevInput = this.textarea.value = "" if (ie && ie_version >= 9) { this.hasSelection = null } } this.inaccurateSelection = minimal }; TextareaInput.prototype.getField = function () { return this.textarea }; TextareaInput.prototype.supportsTouch = function () { return false }; TextareaInput.prototype.focus = function () { if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) { try { this.textarea.focus() } catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM } }; TextareaInput.prototype.blur = function () { this.textarea.blur() }; TextareaInput.prototype.resetPosition = function () { this.wrapper.style.top = this.wrapper.style.left = 0 }; TextareaInput.prototype.receivedFocus = function () { this.slowPoll() }; // Poll for input changes, using the normal rate of polling. This // runs as long as the editor is focused. TextareaInput.prototype.slowPoll = function () { var this$1 = this; if (this.pollingFast) { return } this.polling.set(this.cm.options.pollInterval, function () { this$1.poll() if (this$1.cm.state.focused) { this$1.slowPoll() } }) }; // When an event has just come in that is likely to add or change // something in the input textarea, we poll faster, to ensure that // the change appears on the screen quickly. TextareaInput.prototype.fastPoll = function () { var missed = false, input = this input.pollingFast = true function p() { var changed = input.poll() if (!changed && !missed) {missed = true; input.polling.set(60, p)} else {input.pollingFast = false; input.slowPoll()} } input.polling.set(20, p) }; // Read input from the textarea, and update the document to match. // When something is selected, it is present in the textarea, and // selected (unless it is huge, in which case a placeholder is // used). When nothing is selected, the cursor sits after previously // seen text (can be empty), which is stored in prevInput (we must // not reset the textarea when typing, because that breaks IME). TextareaInput.prototype.poll = function () { var this$1 = this; var cm = this.cm, input = this.textarea, prevInput = this.prevInput // Since this is called a *lot*, try to bail out as cheaply as // possible when it is clear that nothing happened. hasSelection // will be the case when there is a lot of text in the textarea, // in which case reading its value would be expensive. if (this.contextMenuPending || !cm.state.focused || (hasSelection(input) && !prevInput && !this.composing) || cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq) { return false } var text = input.value // If nothing changed, bail. if (text == prevInput && !cm.somethingSelected()) { return false } // Work around nonsensical selection resetting in IE9/10, and // inexplicable appearance of private area unicode characters on // some key combos in Mac (#2689). if (ie && ie_version >= 9 && this.hasSelection === text || mac && /[\uf700-\uf7ff]/.test(text)) { cm.display.input.reset() return false } if (cm.doc.sel == cm.display.selForContextMenu) { var first = text.charCodeAt(0) if (first == 0x200b && !prevInput) { prevInput = "\u200b" } if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") } } // Find the part of the input that is actually new var same = 0, l = Math.min(prevInput.length, text.length) while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same } runInOp(cm, function () { applyTextInput(cm, text.slice(same), prevInput.length - same, null, this$1.composing ? "*compose" : null) // Don't leave long text in the textarea, since it makes further polling slow if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = "" } else { this$1.prevInput = text } if (this$1.composing) { this$1.composing.range.clear() this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"), {className: "CodeMirror-composing"}) } }) return true }; TextareaInput.prototype.ensurePolled = function () { if (this.pollingFast && this.poll()) { this.pollingFast = false } }; TextareaInput.prototype.onKeyPress = function () { if (ie && ie_version >= 9) { this.hasSelection = null } this.fastPoll() }; TextareaInput.prototype.onContextMenu = function (e) { var input = this, cm = input.cm, display = cm.display, te = input.textarea var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop if (!pos || presto) { return } // Opera is difficult. // Reset the current text selection only if the click is done outside of the selection // and 'resetSelectionOnContextMenu' option is true. var reset = cm.options.resetSelectionOnContextMenu if (reset && cm.doc.sel.contains(pos) == -1) { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll) } var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText input.wrapper.style.cssText = "position: absolute" var wrapperBox = input.wrapper.getBoundingClientRect() te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);" var oldScrollY if (webkit) { oldScrollY = window.scrollY } // Work around Chrome issue (#2712) display.input.focus() if (webkit) { window.scrollTo(null, oldScrollY) } display.input.reset() // Adds "Select all" to context menu in FF if (!cm.somethingSelected()) { te.value = input.prevInput = " " } input.contextMenuPending = true display.selForContextMenu = cm.doc.sel clearTimeout(display.detectingSelectAll) // Select-all will be greyed out if there's nothing to select, so // this adds a zero-width space so that we can later check whether // it got selected. function prepareSelectAllHack() { if (te.selectionStart != null) { var selected = cm.somethingSelected() var extval = "\u200b" + (selected ? te.value : "") te.value = "\u21da" // Used to catch context-menu undo te.value = extval input.prevInput = selected ? "" : "\u200b" te.selectionStart = 1; te.selectionEnd = extval.length // Re-set this, in case some other handler touched the // selection in the meantime. display.selForContextMenu = cm.doc.sel } } function rehide() { input.contextMenuPending = false input.wrapper.style.cssText = oldWrapperCSS te.style.cssText = oldCSS if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos) } // Try to detect the user choosing select-all if (te.selectionStart != null) { if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack() } var i = 0, poll = function () { if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 && te.selectionEnd > 0 && input.prevInput == "\u200b") { operation(cm, selectAll)(cm) } else if (i++ < 10) { display.detectingSelectAll = setTimeout(poll, 500) } else { display.selForContextMenu = null display.input.reset() } } display.detectingSelectAll = setTimeout(poll, 200) } } if (ie && ie_version >= 9) { prepareSelectAllHack() } if (captureRightClick) { e_stop(e) var mouseup = function () { off(window, "mouseup", mouseup) setTimeout(rehide, 20) } on(window, "mouseup", mouseup) } else { setTimeout(rehide, 50) } }; TextareaInput.prototype.readOnlyChanged = function (val) { if (!val) { this.reset() } }; TextareaInput.prototype.setUneditable = function () {}; TextareaInput.prototype.needsContentAttribute = false function fromTextArea(textarea, options) { options = options ? copyObj(options) : {} options.value = textarea.value if (!options.tabindex && textarea.tabIndex) { options.tabindex = textarea.tabIndex } if (!options.placeholder && textarea.placeholder) { options.placeholder = textarea.placeholder } // Set autofocus to true if this textarea is focused, or if it has // autofocus and no other element is focused. if (options.autofocus == null) { var hasFocus = activeElt() options.autofocus = hasFocus == textarea || textarea.getAttribute("autofocus") != null && hasFocus == document.body } function save() {textarea.value = cm.getValue()} var realSubmit if (textarea.form) { on(textarea.form, "submit", save) // Deplorable hack to make the submit method do the right thing. if (!options.leaveSubmitMethodAlone) { var form = textarea.form realSubmit = form.submit try { var wrappedSubmit = form.submit = function () { save() form.submit = realSubmit form.submit() form.submit = wrappedSubmit } } catch(e) {} } } options.finishInit = function (cm) { cm.save = save cm.getTextArea = function () { return textarea; } cm.toTextArea = function () { cm.toTextArea = isNaN // Prevent this from being ran twice save() textarea.parentNode.removeChild(cm.getWrapperElement()) textarea.style.display = "" if (textarea.form) { off(textarea.form, "submit", save) if (typeof textarea.form.submit == "function") { textarea.form.submit = realSubmit } } } } textarea.style.display = "none" var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); }, options) return cm } function addLegacyProps(CodeMirror) { CodeMirror.off = off CodeMirror.on = on CodeMirror.wheelEventPixels = wheelEventPixels CodeMirror.Doc = Doc CodeMirror.splitLines = splitLinesAuto CodeMirror.countColumn = countColumn CodeMirror.findColumn = findColumn CodeMirror.isWordChar = isWordCharBasic CodeMirror.Pass = Pass CodeMirror.signal = signal CodeMirror.Line = Line CodeMirror.changeEnd = changeEnd CodeMirror.scrollbarModel = scrollbarModel CodeMirror.Pos = Pos CodeMirror.cmpPos = cmp CodeMirror.modes = modes CodeMirror.mimeModes = mimeModes CodeMirror.resolveMode = resolveMode CodeMirror.getMode = getMode CodeMirror.modeExtensions = modeExtensions CodeMirror.extendMode = extendMode CodeMirror.copyState = copyState CodeMirror.startState = startState CodeMirror.innerMode = innerMode CodeMirror.commands = commands CodeMirror.keyMap = keyMap CodeMirror.keyName = keyName CodeMirror.isModifierKey = isModifierKey CodeMirror.lookupKey = lookupKey CodeMirror.normalizeKeyMap = normalizeKeyMap CodeMirror.StringStream = StringStream CodeMirror.SharedTextMarker = SharedTextMarker CodeMirror.TextMarker = TextMarker CodeMirror.LineWidget = LineWidget CodeMirror.e_preventDefault = e_preventDefault CodeMirror.e_stopPropagation = e_stopPropagation CodeMirror.e_stop = e_stop CodeMirror.addClass = addClass CodeMirror.contains = contains CodeMirror.rmClass = rmClass CodeMirror.keyNames = keyNames } // EDITOR CONSTRUCTOR defineOptions(CodeMirror) addEditorMethods(CodeMirror) // Set up methods on CodeMirror's prototype to redirect to the editor's document. var dontDelegate = "iter insert remove copy getEditor constructor".split(" ") for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0) { CodeMirror.prototype[prop] = (function(method) { return function() {return method.apply(this.doc, arguments)} })(Doc.prototype[prop]) } } eventMixin(Doc) // INPUT HANDLING CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput} // MODE DEFINITION AND QUERYING // Extra arguments are stored as the mode's dependencies, which is // used by (legacy) mechanisms like loadmode.js to automatically // load a mode. (Preferred mechanism is the require/define calls.) CodeMirror.defineMode = function(name/*, mode, …*/) { if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name } defineMode.apply(this, arguments) } CodeMirror.defineMIME = defineMIME // Minimal default mode. CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); }) CodeMirror.defineMIME("text/plain", "null") // EXTENSIONS CodeMirror.defineExtension = function (name, func) { CodeMirror.prototype[name] = func } CodeMirror.defineDocExtension = function (name, func) { Doc.prototype[name] = func } CodeMirror.fromTextArea = fromTextArea addLegacyProps(CodeMirror) CodeMirror.version = "5.24.2" return CodeMirror; }))); Opal.loaded(["hyperloop/console/sources/codemirror"]); /*! * jQuery JavaScript Library v2.1.4 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2015-04-28T16:01Z */ (function( global, factory ) { if ( typeof module === "object" && typeof module.exports === "object" ) { // For CommonJS and CommonJS-like environments where a proper `window` // is present, execute the factory and get jQuery. // For environments that do not have a `window` with a `document` // (such as Node.js), expose a factory as module.exports. // This accentuates the need for the creation of a real `window`. // e.g. var jQuery = require("jquery")(window); // See ticket #14549 for more info. module.exports = global.document ? factory( global, true ) : function( w ) { if ( !w.document ) { throw new Error( "jQuery requires a window with a document" ); } return factory( w ); }; } else { factory( global ); } // Pass this if window is not defined yet }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { // Support: Firefox 18+ // Can't be in strict mode, several libs including ASP.NET trace // the stack via arguments.caller.callee and Firefox dies if // you try to trace through "use strict" call chains. (#13335) // var arr = []; var slice = arr.slice; var concat = arr.concat; var push = arr.push; var indexOf = arr.indexOf; var class2type = {}; var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; var support = {}; var // Use the correct document accordingly with window argument (sandbox) document = window.document, version = "2.1.4", // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' // Need init if jQuery is called (just allow error to be thrown if not included) return new jQuery.fn.init( selector, context ); }, // Support: Android<4.1 // Make sure we trim BOM and NBSP rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used jquery: version, constructor: jQuery, // Start with an empty selector selector: "", // The default length of a jQuery object is 0 length: 0, toArray: function() { return slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num != null ? // Return just the one element from the set ( num < 0 ? this[ num + this.length ] : this[ num ] ) : // Return all the elements in a clean array slice.call( this ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, slice: function() { return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: arr.sort, splice: arr.splice }; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; // Skip the boolean and the target target = arguments[ i ] || {}; i++; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // Extend jQuery itself if only one argument is passed if ( i === length ) { target = this; i--; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ // Unique for each copy of jQuery on the page expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), // Assume jQuery is ready without the ready module isReady: true, error: function( msg ) { throw new Error( msg ); }, noop: function() {}, isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray, isWindow: function( obj ) { return obj != null && obj === obj.window; }, isNumeric: function( obj ) { // parseFloat NaNs numeric-cast false positives (null|true|false|"") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN // adding 1 corrects loss of precision from parseFloat (#15100) return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; }, isPlainObject: function( obj ) { // Not plain objects: // - Any object or value whose internal [[Class]] property is not "[object Object]" // - DOM nodes // - window if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } if ( obj.constructor && !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { return false; } // If the function hasn't returned already, we're confident that // |obj| is a plain object, created by {} or constructed with new Object return true; }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, type: function( obj ) { if ( obj == null ) { return obj + ""; } // Support: Android<4.0, iOS<6 (functionish RegExp) return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call(obj) ] || "object" : typeof obj; }, // Evaluates a script in a global context globalEval: function( code ) { var script, indirect = eval; code = jQuery.trim( code ); if ( code ) { // If the code includes a valid, prologue position // strict mode pragma, execute code by injecting a // script tag into the document. if ( code.indexOf("use strict") === 1 ) { script = document.createElement("script"); script.text = code; document.head.appendChild( script ).parentNode.removeChild( script ); } else { // Otherwise, avoid the DOM node creation, insertion // and removal by using an indirect global eval indirect( code ); } } }, // Convert dashed to camelCase; used by the css and data modules // Support: IE9-11+ // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, // args is for internal usage only each: function( obj, callback, args ) { var value, i = 0, length = obj.length, isArray = isArraylike( obj ); if ( args ) { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isArray ) { for ( ; i < length; i++ ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } } return obj; }, // Support: Android<4.1 trim: function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var ret = results || []; if ( arr != null ) { if ( isArraylike( Object(arr) ) ) { jQuery.merge( ret, typeof arr === "string" ? [ arr ] : arr ); } else { push.call( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { return arr == null ? -1 : indexOf.call( arr, elem, i ); }, merge: function( first, second ) { var len = +second.length, j = 0, i = first.length; for ( ; j < len; j++ ) { first[ i++ ] = second[ j ]; } first.length = i; return first; }, grep: function( elems, callback, invert ) { var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { callbackInverse = !callback( elems[ i ], i ); if ( callbackInverse !== callbackExpect ) { matches.push( elems[ i ] ); } } return matches; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, i = 0, length = elems.length, isArray = isArraylike( elems ), ret = []; // Go through the array, translating each of the items to their new values if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } // Go through every key on the object, } else { for ( i in elems ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } } // Flatten any nested arrays return concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var tmp, args, proxy; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = slice.call( arguments, 2 ); proxy = function() { return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, now: Date.now, // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support }); // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); function isArraylike( obj ) { // Support: iOS 8.2 (not reproducible in simulator) // `in` check used to prevent JIT error (gh-2145) // hasOwn isn't used here due to false negatives // regarding Nodelist length in IE var length = "length" in obj && obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } if ( obj.nodeType === 1 && length ) { return true; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } var Sizzle = /*! * Sizzle CSS Selector Engine v2.2.0-pre * http://sizzlejs.com/ * * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2014-12-16 */ (function( window ) { var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, // Local document vars setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, // Instance-specific data expando = "sizzle" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; } return 0; }, // General-purpose constants MAX_NEGATIVE = 1 << 31, // Instance methods hasOwn = ({}).hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf as it's faster than native // http://jsperf.com/thor-indexof-vs-for/5 indexOf = function( list, elem ) { var i = 0, len = list.length; for ( ; i < len; i++ ) { if ( list[i] === elem ) { return i; } } return -1; }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", // Regular expressions // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/css3-syntax/#characters characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // Loosely modeled on CSS identifier characters // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + // Operator (capture 2) "*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + characterEncoding + ")(?:\\((" + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: // 1. quoted (capture 3; capture 4 or capture 5) "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + // 2. simple (capture 6) "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + // 3. anything else (capture 2) ".*" + ")\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rwhitespace = new RegExp( whitespace + "+", "g" ), rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { "ID": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint // Support: Firefox<24 // Workaround erroneous numeric interpretation of +"0x" return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }, // Used for iframes // See setDocument() // Removing the function wrapper causes a "Permission Denied" // error in IE unloadHandler = function() { setDocument(); }; // Optimize for push.apply( _, NodeList ) try { push.apply( (arr = slice.call( preferredDoc.childNodes )), preferredDoc.childNodes ); // Support: Android<4.0 // Detect silently failing push.apply arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { push = { apply: arr.length ? // Leverage slice if possible function( target, els ) { push_native.apply( target, slice.call(els) ); } : // Support: IE<9 // Otherwise append directly function( target, els ) { var j = target.length, i = 0; // Can't trust NodeList.length while ( (target[j++] = els[i++]) ) {} target.length = j - 1; } }; } function Sizzle( selector, context, results, seed ) { var match, elem, m, nodeType, // QSA vars i, groups, old, nid, newContext, newSelector; if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { setDocument( context ); } context = context || document; results = results || []; nodeType = context.nodeType; if ( typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { return results; } if ( !seed && documentIsHTML ) { // Try to shortcut find operations when possible (e.g., not under DocumentFragment) if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document (jQuery #6963) if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { // Context is not a document if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Speed-up: Sizzle("TAG") } else if ( match[2] ) { push.apply( results, context.getElementsByTagName( selector ) ); return results; // Speed-up: Sizzle(".CLASS") } else if ( (m = match[3]) && support.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } // QSA path if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { nid = old = expando; newContext = context; newSelector = nodeType !== 1 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getAttribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + toSelector( groups[i] ); } newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; newSelector = groups.join(","); } if ( newSelector ) { try { push.apply( results, newContext.querySelectorAll( newSelector ) ); return results; } catch(qsaError) { } finally { if ( !old ) { context.removeAttribute("id"); } } } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed ); } /** * Create key-value caches of limited size * @returns {Function(string, Object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ function createCache() { var keys = []; function cache( key, value ) { // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) if ( keys.push( key + " " ) > Expr.cacheLength ) { // Only keep the most recent entries delete cache[ keys.shift() ]; } return (cache[ key + " " ] = value); } return cache; } /** * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ function markFunction( fn ) { fn[ expando ] = true; return fn; } /** * Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result */ function assert( fn ) { var div = document.createElement("div"); try { return !!fn( div ); } catch (e) { return false; } finally { // Remove from its parent by default if ( div.parentNode ) { div.parentNode.removeChild( div ); } // release memory in IE div = null; } } /** * Adds the same handler for all of the specified attrs * @param {String} attrs Pipe-separated list of attributes * @param {Function} handler The method that will be applied */ function addHandle( attrs, handler ) { var arr = attrs.split("|"), i = attrs.length; while ( i-- ) { Expr.attrHandle[ arr[i] ] = handler; } } /** * Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b */ function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; } /** * Returns a function to use in pseudos for input types * @param {String} type */ function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } /** * Returns a function to use in pseudos for buttons * @param {String} type */ function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } /** * Returns a function to use in pseudos for positionals * @param {Function} fn */ function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Checks a node for validity as a Sizzle context * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ function testContext( context ) { return context && typeof context.getElementsByTagName !== "undefined" && context; } // Expose support vars for convenience support = Sizzle.support = {}; /** * Detects XML nodes * @param {Element|Object} elem An element or a document * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc; // If no document and documentElement is available, return if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { return document; } // Set our document document = doc; docElem = doc.documentElement; parent = doc.defaultView; // Support: IE>8 // If iframe document is assigned to "document" variable and if iframe has been reloaded, // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 // IE6-8 do not support the defaultView property so parent will be undefined if ( parent && parent !== parent.top ) { // IE11 does not have attachEvent, so all must suffer if ( parent.addEventListener ) { parent.addEventListener( "unload", unloadHandler, false ); } else if ( parent.attachEvent ) { parent.attachEvent( "onunload", unloadHandler ); } } /* Support tests ---------------------------------------------------------------------- */ documentIsHTML = !isXML( doc ); /* Attributes ---------------------------------------------------------------------- */ // Support: IE<8 // Verify that getAttribute really returns attributes and not properties // (excepting IE8 booleans) support.attributes = assert(function( div ) { div.className = "i"; return !div.getAttribute("className"); }); /* getElement(s)By* ---------------------------------------------------------------------- */ // Check if getElementsByTagName("*") returns only elements support.getElementsByTagName = assert(function( div ) { div.appendChild( doc.createComment("") ); return !div.getElementsByTagName("*").length; }); // Support: IE<9 support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); // Support: IE<10 // Check if getElementById returns elements by name // The broken getElementById methods don't pick up programatically-set names, // so use a roundabout getElementsByName test support.getById = assert(function( div ) { docElem.appendChild( div ).id = expando; return !doc.getElementsByName || !doc.getElementsByName( expando ).length; }); // ID find and filter if ( support.getById ) { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [ m ] : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; } else { // Support: IE6/7 // getElementById is not reliable as a find shortcut delete Expr.find["ID"]; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; } // Tag Expr.find["TAG"] = support.getElementsByTagName ? function( tag, context ) { if ( typeof context.getElementsByTagName !== "undefined" ) { return context.getElementsByTagName( tag ); // DocumentFragment nodes don't have gEBTN } else if ( support.qsa ) { return context.querySelectorAll( tag ); } } : function( tag, context ) { var elem, tmp = [], i = 0, // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { while ( (elem = results[i++]) ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }; // Class Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { if ( documentIsHTML ) { return context.getElementsByClassName( className ); } }; /* QSA/matchesSelector ---------------------------------------------------------------------- */ // QSA and matchesSelector support // matchesSelector(:active) reports false when true (IE9/Opera 11.5) rbuggyMatches = []; // qSa(:focus) reports false when true (Chrome 21) // We allow this because of a bug in IE8/9 that throws an error // whenever `document.activeElement` is accessed on an iframe // So, we allow :focus to pass through QSA all the time to avoid the IE error // See http://bugs.jquery.com/ticket/13378 rbuggyQSA = []; if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explicitly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 docElem.appendChild( div ).innerHTML = "" + ""; // Support: IE8, Opera 11-12.16 // Nothing should be selected when empty strings follow ^= or $= or *= // The test attribute must be unknown in Opera but "safe" for WinRT // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section if ( div.querySelectorAll("[msallowcapture^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } // Support: IE8 // Boolean attributes and "value" are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { rbuggyQSA.push("~="); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } // Support: Safari 8+, iOS 8+ // https://bugs.webkit.org/show_bug.cgi?id=136851 // In-page `selector#id sibing-combinator selector` fails if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { rbuggyQSA.push(".#.+[+~]"); } }); assert(function( div ) { // Support: Windows 8 Native Apps // The type and name attributes are restricted during .innerHTML assignment var input = doc.createElement("input"); input.setAttribute( "type", "hidden" ); div.appendChild( input ).setAttribute( "name", "D" ); // Support: IE8 // Enforce case-sensitivity of name attribute if ( div.querySelectorAll("[name=d]").length ) { rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) support.disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead matches.call( div, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); /* Contains ---------------------------------------------------------------------- */ hasCompare = rnative.test( docElem.compareDocumentPosition ); // Element contains another // Purposefully does not implement inclusive descendent // As in, an element does not contain itself contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; /* Sorting ---------------------------------------------------------------------- */ // Document order sorting sortOrder = hasCompare ? function( a, b ) { // Flag for duplicate removal if ( a === b ) { hasDuplicate = true; return 0; } // Sort on method existence if only one input has compareDocumentPosition var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; if ( compare ) { return compare; } // Calculate position if both inputs belong to the same document compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? a.compareDocumentPosition( b ) : // Otherwise we know they are disconnected 1; // Disconnected nodes if ( compare & 1 || (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { // Choose the first element that is related to our preferred document if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { return -1; } if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { return 1; } // Maintain original order return sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; } : function( a, b ) { // Exit early if the nodes are identical if ( a === b ) { hasDuplicate = true; return 0; } var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ]; // Parentless nodes are either documents or disconnected if ( !aup || !bup ) { return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; // If the nodes are siblings, we can do a quick check } else if ( aup === bup ) { return siblingCheck( a, b ); } // Otherwise we need full lists of their ancestors for comparison cur = a; while ( (cur = cur.parentNode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentNode) ) { bp.unshift( cur ); } // Walk down the tree looking for a discrepancy while ( ap[i] === bp[i] ) { i++; } return i ? // Do a sibling check if the nodes have a common ancestor siblingCheck( ap[i], bp[i] ) : // Otherwise nodes in our document sort first ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; return doc; }; Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); if ( support.matchesSelector && documentIsHTML && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch (e) {} } return Sizzle( expr, document, null, [ elem ] ).length > 0; }; Sizzle.contains = function( context, elem ) { // Set document vars if needed if ( ( context.ownerDocument || context ) !== document ) { setDocument( context ); } return contains( context, elem ); }; Sizzle.attr = function( elem, name ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } var fn = Expr.attrHandle[ name.toLowerCase() ], // Don't get fooled by Object.prototype properties (jQuery #13807) val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? fn( elem, name, !documentIsHTML ) : undefined; return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute( name ) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; /** * Document sorting and removing duplicates * @param {ArrayLike} results */ Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; // Unless we *know* we can detect duplicates, assume their presence hasDuplicate = !support.detectDuplicates; sortInput = !support.sortStable && results.slice( 0 ); results.sort( sortOrder ); if ( hasDuplicate ) { while ( (elem = results[i++]) ) { if ( elem === results[ i ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } // Clear input after sorting to release objects // See https://github.com/jquery/sizzle/pull/225 sortInput = null; return results; }; /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { // If no nodeType, this is expected to be an array while ( (node = elem[i++]) ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (jQuery #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes return ret; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1].slice( 0, 3 ) === "nth" ) { // nth-* requires argument if ( !match[3] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); // other types prohibit arguments } else if ( match[3] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var excess, unquoted = !match[6] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is if ( match[3] ) { match[2] = match[4] || match[5] || ""; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index match[0] = match[0].slice( 0, excess ); match[2] = unquoted.slice( 0, excess ); } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "TAG": function( nodeNameSelector ) { var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, what, argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; return first === 1 && last === 0 ? // Shortcut for :nth-*(n) function( elem ) { return !!elem.parentNode; } : function( elem, context, xml ) { var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType; if ( parent ) { // :(first|last|only)-(child|of-type) if ( simple ) { while ( dir ) { node = elem; while ( (node = node[ dir ]) ) { if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { return false; } } // Reverse direction for :only-* (if we haven't yet done so) start = dir = type === "only" && !start && "nextSibling"; } return true; } start = [ forward ? parent.firstChild : parent.lastChild ]; // non-xml :nth-child(...) stores cache data on `parent` if ( forward && useCache ) { // Seek `elem` from a previously-cached index outerCache = parent[ expando ] || (parent[ expando ] = {}); cache = outerCache[ type ] || []; nodeIndex = cache[0] === dirruns && cache[1]; diff = cache[0] === dirruns && cache[2]; node = nodeIndex && parent.childNodes[ nodeIndex ]; while ( (node = ++nodeIndex && node && node[ dir ] || // Fallback to seeking `elem` from the start (diff = nodeIndex = 0) || start.pop()) ) { // When found, cache indexes on `parent` and break if ( node.nodeType === 1 && ++diff && node === elem ) { outerCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } // Use previously-cached element index if available } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { diff = cache[1]; // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) } else { // Use the same loop as above to seek `elem` from the start while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { // Cache the index of each encountered element if ( useCache ) { (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; } if ( node === elem ) { break; } } } } // Incorporate the offset, then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { // Potentially complex pseudos "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); // Don't keep the element (issue #299) input[0] = null; return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { text = text.replace( runescape, funescape ); return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), // "Whether an element is represented by a :lang() selector // is based solely on the element's language value // being equal to the identifier C, // or beginning with the identifier C immediately followed by "-". // The matching of C against the element's language value is performed case-insensitively. // The identifier C does not have to be a valid language name." // http://www.w3.org/TR/selectors/#lang-pseudo "lang": markFunction( function( lang ) { // lang value must be a valid identifier if ( !ridentifier.test(lang || "") ) { Sizzle.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { var elemLang; do { if ( (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { elemLang = elemLang.toLowerCase(); return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; } } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); return false; }; }), // Miscellaneous "target": function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docElem; }, "focus": function( elem ) { return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, // Boolean properties "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, // Contents "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), // but not by others (comment: 8; processing instruction: 7; etc.) // nodeType < 6 works because attributes (2) do not appear as children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { if ( elem.nodeType < 6 ) { return false; } } return true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, // Element/input types "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && // Support: IE<8 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); }, // Position-in-collection "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); } for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } // Easy API for creating new setFilters function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); tokenize = Sizzle.tokenize = function( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( (tokens = []) ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); tokens.push({ value: matched, // Cast descendant combinators to space type: match[0].replace( rtrim, " " ) }); soFar = soFar.slice( matched.length ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); tokens.push({ value: matched, type: type, matches: match }); soFar = soFar.slice( matched.length ); } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); }; function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var oldCache, outerCache, newCache = [ dirruns, doneName ]; // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); if ( (oldCache = outerCache[ dir ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements return (newCache[ 2 ] = oldCache[ 2 ]); } else { // Reuse newcache so results back-propagate to previous elements outerCache[ dir ] = newCache; // A match means we're done; a fail means we have to keep checking if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { return true; } } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); // Avoid hanging onto element (issue #299) checkContext = null; return ret; } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && toSelector( // If the preceding token was a descendant combinator, insert an implicit any-element `*` tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, // We must always have either seed elements or outermost context elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length; if ( outermost ) { outermostContext = context !== document && context; } // Add elements passing elementMatchers directly to results // Keep `i` a string if there are no elements so `matchedCount` will be "00" below // Support: IE<9, Safari // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // Apply set filters to unmatched elements matchedCount += i; if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !match ) { match = tokenize( selector ); } i = match.length; while ( i-- ) { cached = matcherFromTokens( match[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); // Save selector and tokenization cached.selector = selector; } return cached; }; /** * A low-level selection function that works with Sizzle's compiled * selector functions * @param {String|Function} selector A selector or a pre-compiled * selector function built with Sizzle.compile * @param {Element} context * @param {Array} [results] * @param {Array} [seed] A set of elements to match against */ select = Sizzle.select = function( selector, context, results, seed ) { var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize( (selector = compiled.selector || selector) ); results = results || []; // Try to minimize operations if there is no seed and only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { return results; // Precompiled matchers will still verify ancestry, so step up a level } else if ( compiled ) { context = context.parentNode; } selector = selector.slice( tokens.shift().value.length ); } // Fetch a seed set for right-to-left matching i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, seed ); return results; } break; } } } } // Compile and execute a filtering function if one is not provided // Provide `match` to avoid retokenization if we modified the selector above ( compiled || compile( selector, match ) )( seed, context, !documentIsHTML, results, rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; }; // One-time assignments // Sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; // Support: Chrome 14-35+ // Always assume duplicates if they aren't passed to the comparison function support.detectDuplicates = !!hasDuplicate; // Initialize against the default document setDocument(); // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) // Detached nodes confoundingly follow *each other* support.sortDetached = assert(function( div1 ) { // Should return 1, but returns 4 (following) return div1.compareDocumentPosition( document.createElement("div") ) & 1; }); // Support: IE<8 // Prevent attribute/property "interpolation" // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !assert(function( div ) { div.innerHTML = ""; return div.firstChild.getAttribute("href") === "#" ; }) ) { addHandle( "type|href|height|width", function( elem, name, isXML ) { if ( !isXML ) { return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); } }); } // Support: IE<9 // Use defaultValue in place of getAttribute("value") if ( !support.attributes || !assert(function( div ) { div.innerHTML = ""; div.firstChild.setAttribute( "value", "" ); return div.firstChild.getAttribute( "value" ) === ""; }) ) { addHandle( "value", function( elem, name, isXML ) { if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { return elem.defaultValue; } }); } // Support: IE<9 // Use getAttributeNode to fetch booleans when getAttribute lies if ( !assert(function( div ) { return div.getAttribute("disabled") == null; }) ) { addHandle( booleans, function( elem, name, isXML ) { var val; if ( !isXML ) { return elem[ name ] === true ? name.toLowerCase() : (val = elem.getAttributeNode( name )) && val.specified ? val.value : null; } }); } return Sizzle; })( window ); jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; var rneedsContext = jQuery.expr.match.needsContext; var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); var risSimple = /^.[^:#\[\.,]*$/; // Implement the identical functionality for filter and not function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; }); } if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; }); } if ( typeof qualifier === "string" ) { if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not ); } qualifier = jQuery.filter( qualifier, elements ); } return jQuery.grep( elements, function( elem ) { return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; }); } jQuery.filter = function( expr, elems, not ) { var elem = elems[ 0 ]; if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { return elem.nodeType === 1; })); }; jQuery.fn.extend({ find: function( selector ) { var i, len = this.length, ret = [], self = this; if ( typeof selector !== "string" ) { return this.pushStack( jQuery( selector ).filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } }) ); } for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } // Needed because $( selector, context ) becomes $( context ).find( selector ) ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); ret.selector = this.selector ? this.selector + " " + selector : selector; return ret; }, filter: function( selector ) { return this.pushStack( winnow(this, selector || [], false) ); }, not: function( selector ) { return this.pushStack( winnow(this, selector || [], true) ); }, is: function( selector ) { return !!winnow( this, // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". typeof selector === "string" && rneedsContext.test( selector ) ? jQuery( selector ) : selector || [], false ).length; } }); // Initialize a jQuery object // A central reference to the root jQuery(document) var rootjQuery, // A simple way to check for HTML strings // Prioritize #id over to avoid XSS via location.hash (#9521) // Strict HTML recognition (#11290: must start with <) rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, init = jQuery.fn.init = function( selector, context ) { var match, elem; // HANDLE: $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // Handle HTML strings if ( typeof selector === "string" ) { if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; // Option to run scripts is true for back-compat // Intentionally let the error be thrown if parseHTML is not present jQuery.merge( this, jQuery.parseHTML( match[1], context && context.nodeType ? context.ownerDocument || context : document, true ) ); // HANDLE: $(html, props) if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { for ( match in context ) { // Properties of context are called as methods if possible if ( jQuery.isFunction( this[ match ] ) ) { this[ match ]( context[ match ] ); // ...and otherwise set as attributes } else { this.attr( match, context[ match ] ); } } } return this; // HANDLE: $(#id) } else { elem = document.getElementById( match[2] ); // Support: Blackberry 4.6 // gEBID returns nodes no longer in the document (#6963) if ( elem && elem.parentNode ) { // Inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjQuery ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(DOMElement) } else if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return typeof rootjQuery.ready !== "undefined" ? rootjQuery.ready( selector ) : // Execute immediately if ready is not present selector( jQuery ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }; // Give the init function the jQuery prototype for later instantiation init.prototype = jQuery.fn; // Initialize central reference rootjQuery = jQuery( document ); var rparentsprev = /^(?:parents|prev(?:Until|All))/, // Methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.extend({ dir: function( elem, dir, until ) { var matched = [], truncate = until !== undefined; while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) { if ( elem.nodeType === 1 ) { if ( truncate && jQuery( elem ).is( until ) ) { break; } matched.push( elem ); } } return matched; }, sibling: function( n, elem ) { var matched = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { matched.push( n ); } } return matched; } }); jQuery.fn.extend({ has: function( target ) { var targets = jQuery( target, this ), l = targets.length; return this.filter(function() { var i = 0; for ( ; i < l; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, matched = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { // Always skip document fragments if ( cur.nodeType < 11 && (pos ? pos.index(cur) > -1 : // Don't pass non-elements to Sizzle cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors)) ) { matched.push( cur ); break; } } } return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); }, // Determine the position of an element within the set index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; } // Index in selector if ( typeof elem === "string" ) { return indexOf.call( jQuery( elem ), this[ 0 ] ); } // Locate the position of the desired element return indexOf.call( this, // If it receives a jQuery object, the first element is used elem.jquery ? elem[ 0 ] : elem ); }, add: function( selector, context ) { return this.pushStack( jQuery.unique( jQuery.merge( this.get(), jQuery( selector, context ) ) ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter(selector) ); } }); function sibling( cur, dir ) { while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {} return cur; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return elem.contentDocument || jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var matched = jQuery.map( this, fn, until ); if ( name.slice( -5 ) !== "Until" ) { selector = until; } if ( selector && typeof selector === "string" ) { matched = jQuery.filter( selector, matched ); } if ( this.length > 1 ) { // Remove duplicates if ( !guaranteedUnique[ name ] ) { jQuery.unique( matched ); } // Reverse order for parents* and prev-derivatives if ( rparentsprev.test( name ) ) { matched.reverse(); } } return this.pushStack( matched ); }; }); var rnotwhite = (/\S+/g); // String to Object options format cache var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; }); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? ( optionsCache[ options ] || createOptions( options ) ) : jQuery.extend( {}, options ); var // Last fire value (for non-forgettable lists) memory, // Flag to know if list was already fired fired, // Flag to know if list is currently firing firing, // First callback to fire (used internally by add and fireWith) firingStart, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = !options.once && [], // Fire callbacks fire = function( data ) { memory = options.memory && data; fired = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; firing = true; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { memory = false; // To prevent further calls using add break; } } firing = false; if ( list ) { if ( stack ) { if ( stack.length ) { fire( stack.shift() ); } } else if ( memory ) { list = []; } else { self.disable(); } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // First, we save the current length var start = list.length; (function add( args ) { jQuery.each( args, function( _, arg ) { var type = jQuery.type( arg ); if ( type === "function" ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && type !== "string" ) { // Inspect recursively add( arg ); } }); })( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away } else if ( memory ) { firingStart = start; fire( memory ); } } return this; }, // Remove a callback from the list remove: function() { if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( firing ) { if ( index <= firingLength ) { firingLength--; } if ( index <= firingIndex ) { firingIndex--; } } } }); } return this; }, // Check if a given callback is in the list. // If no argument is given, return whether or not list has callbacks attached. has: function( fn ) { return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); }, // Remove all callbacks from the list empty: function() { list = []; firingLength = 0; return this; }, // Have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function() { return !list; }, // Lock the list in its current state lock: function() { stack = undefined; if ( !memory ) { self.disable(); } return this; }, // Is it locked? locked: function() { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { if ( list && ( !fired || stack ) ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; if ( firing ) { stack.push( args ); } else { fire( args ); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], [ "notify", "progress", jQuery.Callbacks("memory") ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[1] ](function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .done( newDefer.resolve ) .fail( newDefer.reject ) .progress( newDefer.notify ); } else { newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); } }); }); fns = null; }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[1] ] = list.add; // Handle state if ( stateString ) { list.add(function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] deferred[ tuple[0] ] = function() { deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); return this; }; deferred[ tuple[0] + "With" ] = list.fireWith; }); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // Add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ) .progress( updateFunc( i, progressContexts, progressValues ) ); } else { --remaining; } } } // If we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } }); // The deferred used on DOM ready var readyList; jQuery.fn.ready = function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); return this; }; jQuery.extend({ // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.triggerHandler ) { jQuery( document ).triggerHandler( "ready" ); jQuery( document ).off( "ready" ); } } }); /** * The ready event handler and self cleanup method */ function completed() { document.removeEventListener( "DOMContentLoaded", completed, false ); window.removeEventListener( "load", completed, false ); jQuery.ready(); } jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called after the browser event has already occurred. // We once tried to use readyState "interactive" here, but it caused issues like the one // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready ); } else { // Use the handy event callback document.addEventListener( "DOMContentLoaded", completed, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", completed, false ); } } return readyList.promise( obj ); }; // Kick off the DOM ready check even if the user does not jQuery.ready.promise(); // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, len = elems.length, bulk = key == null; // Sets many values if ( jQuery.type( key ) === "object" ) { chainable = true; for ( i in key ) { jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); } // Sets one value } else if ( value !== undefined ) { chainable = true; if ( !jQuery.isFunction( value ) ) { raw = true; } if ( bulk ) { // Bulk operations run against the entire set if ( raw ) { fn.call( elems, value ); fn = null; // ...except when executing function values } else { bulk = fn; fn = function( elem, key, value ) { return bulk.call( jQuery( elem ), value ); }; } } if ( fn ) { for ( ; i < len; i++ ) { fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); } } } return chainable ? elems : // Gets bulk ? fn.call( elems ) : len ? fn( elems[0], key ) : emptyGet; }; /** * Determines whether an object can have data */ jQuery.acceptData = function( owner ) { // Accepts only: // - Node // - Node.ELEMENT_NODE // - Node.DOCUMENT_NODE // - Object // - Any /* jshint -W018 */ return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); }; function Data() { // Support: Android<4, // Old WebKit does not have Object.preventExtensions/freeze method, // return new empty object instead with no [[set]] accessor Object.defineProperty( this.cache = {}, 0, { get: function() { return {}; } }); this.expando = jQuery.expando + Data.uid++; } Data.uid = 1; Data.accepts = jQuery.acceptData; Data.prototype = { key: function( owner ) { // We can accept data for non-element nodes in modern browsers, // but we should not, see #8335. // Always return the key for a frozen object. if ( !Data.accepts( owner ) ) { return 0; } var descriptor = {}, // Check if the owner object already has a cache key unlock = owner[ this.expando ]; // If not, create one if ( !unlock ) { unlock = Data.uid++; // Secure it in a non-enumerable, non-writable property try { descriptor[ this.expando ] = { value: unlock }; Object.defineProperties( owner, descriptor ); // Support: Android<4 // Fallback to a less secure definition } catch ( e ) { descriptor[ this.expando ] = unlock; jQuery.extend( owner, descriptor ); } } // Ensure the cache object if ( !this.cache[ unlock ] ) { this.cache[ unlock ] = {}; } return unlock; }, set: function( owner, data, value ) { var prop, // There may be an unlock assigned to this node, // if there is no entry for this "owner", create one inline // and set the unlock as though an owner entry had always existed unlock = this.key( owner ), cache = this.cache[ unlock ]; // Handle: [ owner, key, value ] args if ( typeof data === "string" ) { cache[ data ] = value; // Handle: [ owner, { properties } ] args } else { // Fresh assignments by object are shallow copied if ( jQuery.isEmptyObject( cache ) ) { jQuery.extend( this.cache[ unlock ], data ); // Otherwise, copy the properties one-by-one to the cache object } else { for ( prop in data ) { cache[ prop ] = data[ prop ]; } } } return cache; }, get: function( owner, key ) { // Either a valid cache is found, or will be created. // New caches will be created and the unlock returned, // allowing direct access to the newly created // empty data object. A valid owner object must be provided. var cache = this.cache[ this.key( owner ) ]; return key === undefined ? cache : cache[ key ]; }, access: function( owner, key, value ) { var stored; // In cases where either: // // 1. No key was specified // 2. A string key was specified, but no value provided // // Take the "read" path and allow the get method to determine // which value to return, respectively either: // // 1. The entire cache object // 2. The data stored at the key // if ( key === undefined || ((key && typeof key === "string") && value === undefined) ) { stored = this.get( owner, key ); return stored !== undefined ? stored : this.get( owner, jQuery.camelCase(key) ); } // [*]When the key is not a string, or both a key and value // are specified, set or extend (existing objects) with either: // // 1. An object of properties // 2. A key and value // this.set( owner, key, value ); // Since the "set" path can have two possible entry points // return the expected data based on which path was taken[*] return value !== undefined ? value : key; }, remove: function( owner, key ) { var i, name, camel, unlock = this.key( owner ), cache = this.cache[ unlock ]; if ( key === undefined ) { this.cache[ unlock ] = {}; } else { // Support array or space separated string of keys if ( jQuery.isArray( key ) ) { // If "name" is an array of keys... // When data is initially created, via ("key", "val") signature, // keys will be converted to camelCase. // Since there is no way to tell _how_ a key was added, remove // both plain key and camelCase key. #12786 // This will only penalize the array argument path. name = key.concat( key.map( jQuery.camelCase ) ); } else { camel = jQuery.camelCase( key ); // Try the string as a key before any manipulation if ( key in cache ) { name = [ key, camel ]; } else { // If a key with the spaces exists, use it. // Otherwise, create an array by matching non-whitespace name = camel; name = name in cache ? [ name ] : ( name.match( rnotwhite ) || [] ); } } i = name.length; while ( i-- ) { delete cache[ name[ i ] ]; } } }, hasData: function( owner ) { return !jQuery.isEmptyObject( this.cache[ owner[ this.expando ] ] || {} ); }, discard: function( owner ) { if ( owner[ this.expando ] ) { delete this.cache[ owner[ this.expando ] ]; } } }; var data_priv = new Data(); var data_user = new Data(); // Implementation Summary // // 1. Enforce API surface and semantic compatibility with 1.9.x branch // 2. Improve the module's maintainability by reducing the storage // paths to a single mechanism. // 3. Use the same single mechanism to support "private" and "user" data. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) // 5. Avoid exposing implementation details on user objects (eg. expando properties) // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /([A-Z])/g; function dataAttr( elem, key, data ) { var name; // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later data_user.set( elem, key, data ); } else { data = undefined; } } return data; } jQuery.extend({ hasData: function( elem ) { return data_user.hasData( elem ) || data_priv.hasData( elem ); }, data: function( elem, name, data ) { return data_user.access( elem, name, data ); }, removeData: function( elem, name ) { data_user.remove( elem, name ); }, // TODO: Now that all calls to _data and _removeData have been replaced // with direct calls to data_priv methods, these can be deprecated. _data: function( elem, name, data ) { return data_priv.access( elem, name, data ); }, _removeData: function( elem, name ) { data_priv.remove( elem, name ); } }); jQuery.fn.extend({ data: function( key, value ) { var i, name, data, elem = this[ 0 ], attrs = elem && elem.attributes; // Gets all values if ( key === undefined ) { if ( this.length ) { data = data_user.get( elem ); if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) { i = attrs.length; while ( i-- ) { // Support: IE11+ // The attrs elements can be null (#14894) if ( attrs[ i ] ) { name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { name = jQuery.camelCase( name.slice(5) ); dataAttr( elem, name, data[ name ] ); } } } data_priv.set( elem, "hasDataAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each(function() { data_user.set( this, key ); }); } return access( this, function( value ) { var data, camelKey = jQuery.camelCase( key ); // The calling jQuery object (element matches) is not empty // (and therefore has an element appears at this[ 0 ]) and the // `value` parameter was not undefined. An empty jQuery object // will result in `undefined` for elem = this[ 0 ] which will // throw an exception if an attempt to read a data cache is made. if ( elem && value === undefined ) { // Attempt to get data from the cache // with the key as-is data = data_user.get( elem, key ); if ( data !== undefined ) { return data; } // Attempt to get data from the cache // with the key camelized data = data_user.get( elem, camelKey ); if ( data !== undefined ) { return data; } // Attempt to "discover" the data in // HTML5 custom data-* attrs data = dataAttr( elem, camelKey, undefined ); if ( data !== undefined ) { return data; } // We tried really hard, but the data doesn't exist. return; } // Set the data... this.each(function() { // First, attempt to store a copy or reference of any // data that might've been store with a camelCased key. var data = data_user.get( this, camelKey ); // For HTML5 data-* attribute interop, we have to // store property names with dashes in a camelCase form. // This might not apply to all properties...* data_user.set( this, camelKey, value ); // *... In the case of properties that might _actually_ // have dashes, we need to also store a copy of that // unchanged property. if ( key.indexOf("-") !== -1 && data !== undefined ) { data_user.set( this, key, value ); } }); }, null, value, arguments.length > 1, null, true ); }, removeData: function( key ) { return this.each(function() { data_user.remove( this, key ); }); } }); jQuery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = data_priv.get( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray( data ) ) { queue = data_priv.access( elem, type, jQuery.makeArray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // Clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // Not public - generate a queueHooks object, or return the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return data_priv.get( elem, key ) || data_priv.access( elem, key, { empty: jQuery.Callbacks("once memory").add(function() { data_priv.remove( elem, [ type + "queue", key ] ); }) }); } }); jQuery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jQuery.queue( this, type, data ); // Ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while ( i-- ) { tmp = data_priv.get( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } }); var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; var isHidden = function( elem, el ) { // isHidden might be called from jQuery#filter function; // in that case, element will be second argument elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); }; var rcheckableType = (/^(?:checkbox|radio)$/i); (function() { var fragment = document.createDocumentFragment(), div = fragment.appendChild( document.createElement( "div" ) ), input = document.createElement( "input" ); // Support: Safari<=5.1 // Check state lost if the name is set (#11217) // Support: Windows Web Apps (WWA) // `name` and `type` must use .setAttribute for WWA (#14901) input.setAttribute( "type", "radio" ); input.setAttribute( "checked", "checked" ); input.setAttribute( "name", "t" ); div.appendChild( input ); // Support: Safari<=5.1, Android<4.2 // Older WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE<=11+ // Make sure textarea (and checkbox) defaultValue is properly cloned div.innerHTML = ""; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; })(); var strundefined = typeof undefined; support.focusinBubbles = "onfocusin" in window; var rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; function returnTrue() { return true; } function returnFalse() { return false; } function safeActiveElement() { try { return document.activeElement; } catch ( err ) { } } /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { global: {}, add: function( elem, types, handler, data, selector ) { var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = data_priv.get( elem ); // Don't attach events to noData or text/comment nodes (but allow plain objects) if ( !elemData ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first if ( !(events = elemData.events) ) { events = elemData.events = {}; } if ( !(eventHandle = elemData.handle) ) { eventHandle = elemData.handle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply( elem, arguments ) : undefined; }; } // Handle multiple events separated by a space types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // There *must* be a type, no attaching namespace-only handlers if ( !type ) { continue; } // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: origType, data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join(".") }, handleObjIn ); // Init the event handler queue if we're the first if ( !(handlers = events[ type ]) ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } }, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = data_priv.hasData( elem ) && data_priv.get( elem ); if ( !elemData || !(events = elemData.events) ) { return; } // Once for each type.namespace in types; type may be omitted types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origType = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector ? special.delegateType : special.bindType ) || type; handlers = events[ type ] || []; tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); // Remove matching events origCount = j = handlers.length; while ( j-- ) { handleObj = handlers[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !tmp || tmp.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { handlers.splice( j, 1 ); if ( handleObj.selector ) { handlers.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( origCount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; data_priv.remove( elem, "events" ); } }, trigger: function( event, data, elem, onlyHandlers ) { var i, cur, tmp, bubbleType, ontype, handle, special, eventPath = [ elem || document ], type = hasOwn.call( event, "type" ) ? event.type : event, namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; cur = tmp = elem = elem || document; // Don't do events on text and comment nodes if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf(".") >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } ontype = type.indexOf(":") < 0 && "on" + type; // Caller can pass in a jQuery.Event object, Object, or just an event type string event = event[ jQuery.expando ] ? event : new jQuery.Event( type, typeof event === "object" && event ); // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) event.isTrigger = onlyHandlers ? 2 : 3; event.namespace = namespaces.join("."); event.namespace_re = event.namespace ? new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : null; // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data == null ? [ event ] : jQuery.makeArray( data, [ event ] ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; if ( !rfocusMorph.test( bubbleType + type ) ) { cur = cur.parentNode; } for ( ; cur; cur = cur.parentNode ) { eventPath.push( cur ); tmp = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( tmp === (elem.ownerDocument || document) ) { eventPath.push( tmp.defaultView || tmp.parentWindow || window ); } } // Fire handlers on the event path i = 0; while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { event.type = i > 1 ? bubbleType : special.bindType || type; // jQuery handler handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Native handler handle = ontype && cur[ ontype ]; if ( handle && handle.apply && jQuery.acceptData( cur ) ) { event.result = handle.apply( cur, data ); if ( event.result === false ) { event.preventDefault(); } } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Don't do default actions on window, that's where global variables be (#6170) if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method tmp = elem[ ontype ]; if ( tmp ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; elem[ type ](); jQuery.event.triggered = undefined; if ( tmp ) { elem[ ontype ] = tmp; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event ); var i, j, ret, matched, handleObj, handlerQueue = [], args = slice.call( arguments ), handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers handlerQueue = jQuery.event.handlers.call( this, event, handlers ); // Run delegates first; they may want to stop propagation beneath us i = 0; while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { event.currentTarget = matched.elem; j = 0; while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { // Triggered event must either 1) have no namespace, or 2) have namespace(s) // a subset or equal to those in the bound event (both can have no namespace). if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { event.handleObj = handleObj; event.data = handleObj.data; ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { if ( (event.result = ret) === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, handlers: function( event, handlers ) { var i, matches, sel, handleObj, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; // Find delegate handlers // Black-hole SVG instance trees (#13180) // Avoid non-left-click bubbling in Firefox (#3861) if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { for ( ; cur !== this; cur = cur.parentNode || this ) { // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if ( cur.disabled !== true || event.type !== "click" ) { matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; if ( matches[ sel ] === undefined ) { matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( matches[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, handlers: matches }); } } } } // Add the remaining (directly-bound) handlers if ( delegateCount < handlers.length ) { handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); } return handlerQueue; }, // Includes some event props shared by KeyEvent and MouseEvent props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var eventDoc, doc, body, button = original.button; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, copy, type = event.type, originalEvent = event, fixHook = this.fixHooks[ type ]; if ( !fixHook ) { this.fixHooks[ type ] = fixHook = rmouseEvent.test( type ) ? this.mouseHooks : rkeyEvent.test( type ) ? this.keyHooks : {}; } copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = new jQuery.Event( originalEvent ); i = copy.length; while ( i-- ) { prop = copy[ i ]; event[ prop ] = originalEvent[ prop ]; } // Support: Cordova 2.5 (WebKit) (#13255) // All events should have a target; Cordova deviceready doesn't if ( !event.target ) { event.target = document; } // Support: Safari 6.0+, Chrome<28 // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { // Fire native event if possible so blur/focus sequence is correct trigger: function() { if ( this !== safeActiveElement() && this.focus ) { this.focus(); return false; } }, delegateType: "focusin" }, blur: { trigger: function() { if ( this === safeActiveElement() && this.blur ) { this.blur(); return false; } }, delegateType: "focusout" }, click: { // For checkbox, fire native event so checked state will be right trigger: function() { if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { this.click(); return false; } }, // For cross-browser consistency, don't fire native .click() on links _default: function( event ) { return jQuery.nodeName( event.target, "a" ); } }, beforeunload: { postDispatch: function( event ) { // Support: Firefox 20+ // Firefox doesn't alert if the returnValue field is not set. if ( event.result !== undefined && event.originalEvent ) { event.originalEvent.returnValue = event.result; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; jQuery.removeEvent = function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && // Support: Android<4.0 src.returnValue === false ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; if ( e && e.preventDefault ) { e.preventDefault(); } }, stopPropagation: function() { var e = this.originalEvent; this.isPropagationStopped = returnTrue; if ( e && e.stopPropagation ) { e.stopPropagation(); } }, stopImmediatePropagation: function() { var e = this.originalEvent; this.isImmediatePropagationStopped = returnTrue; if ( e && e.stopImmediatePropagation ) { e.stopImmediatePropagation(); } this.stopPropagation(); } }; // Create mouseenter/leave events using mouseover/out and event-time checks // Support: Chrome 15+ jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || (related !== target && !jQuery.contains( target, related )) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // Support: Firefox, Chrome, Safari // Create "bubbling" focus and blur events if ( !support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler on the document while someone wants focusin/focusout var handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { var doc = this.ownerDocument || this, attaches = data_priv.access( doc, fix ); if ( !attaches ) { doc.addEventListener( orig, handler, true ); } data_priv.access( doc, fix, ( attaches || 0 ) + 1 ); }, teardown: function() { var doc = this.ownerDocument || this, attaches = data_priv.access( doc, fix ) - 1; if ( !attaches ) { doc.removeEventListener( orig, handler, true ); data_priv.remove( doc, fix ); } else { data_priv.access( doc, fix, attaches ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { var elem = this[0]; if ( elem ) { return jQuery.event.trigger( type, data, elem, true ); } } }); var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rhtml = /<|&#?\w+;/, rnoInnerhtml = /<(?:script|style|link)/i, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /^$|\/(?:java|ecma)script/i, rscriptTypeMasked = /^true\/(.*)/, rcleanScript = /^\s*\s*$/g, // We have to close these tags to support XHTML (#13200) wrapMap = { // Support: IE9 option: [ 1, "" ], thead: [ 1, "", "
" ], col: [ 2, "", "
" ], tr: [ 2, "", "
" ], td: [ 3, "", "
" ], _default: [ 0, "", "" ] }; // Support: IE9 wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; // Support: 1.x compatibility // Manipulating tables requires a tbody function manipulationTarget( elem, content ) { return jQuery.nodeName( elem, "table" ) && jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? elem.getElementsByTagName("tbody")[0] || elem.appendChild( elem.ownerDocument.createElement("tbody") ) : elem; } // Replace/restore the type attribute of script elements for safe DOM manipulation function disableScript( elem ) { elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; return elem; } function restoreScript( elem ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[ 1 ]; } else { elem.removeAttribute("type"); } return elem; } // Mark scripts as having already been evaluated function setGlobalEval( elems, refElements ) { var i = 0, l = elems.length; for ( ; i < l; i++ ) { data_priv.set( elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) ); } } function cloneCopyEvent( src, dest ) { var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; if ( dest.nodeType !== 1 ) { return; } // 1. Copy private data: events, handlers, etc. if ( data_priv.hasData( src ) ) { pdataOld = data_priv.access( src ); pdataCur = data_priv.set( dest, pdataOld ); events = pdataOld.events; if ( events ) { delete pdataCur.handle; pdataCur.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } } // 2. Copy user data if ( data_user.hasData( src ) ) { udataOld = data_user.access( src ); udataCur = jQuery.extend( {}, udataOld ); data_user.set( dest, udataCur ); } } function getAll( context, tag ) { var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : []; return tag === undefined || tag && jQuery.nodeName( context, tag ) ? jQuery.merge( [ context ], ret ) : ret; } // Fix IE bugs, see support tests function fixInput( src, dest ) { var nodeName = dest.nodeName.toLowerCase(); // Fails to persist the checked state of a cloned checkbox or radio button. if ( nodeName === "input" && rcheckableType.test( src.type ) ) { dest.checked = src.checked; // Fails to return the selected option to the default selected state when cloning options } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } } jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { var i, l, srcElements, destElements, clone = elem.cloneNode( true ), inPage = jQuery.contains( elem.ownerDocument, elem ); // Fix IE cloning issues if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); for ( i = 0, l = srcElements.length; i < l; i++ ) { fixInput( srcElements[ i ], destElements[ i ] ); } } // Copy the events from the original to the clone if ( dataAndEvents ) { if ( deepDataAndEvents ) { srcElements = srcElements || getAll( elem ); destElements = destElements || getAll( clone ); for ( i = 0, l = srcElements.length; i < l; i++ ) { cloneCopyEvent( srcElements[ i ], destElements[ i ] ); } } else { cloneCopyEvent( elem, clone ); } } // Preserve script evaluation history destElements = getAll( clone, "script" ); if ( destElements.length > 0 ) { setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); } // Return the cloned set return clone; }, buildFragment: function( elems, context, scripts, selection ) { var elem, tmp, tag, wrap, contains, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l = elems.length; for ( ; i < l; i++ ) { elem = elems[ i ]; if ( elem || elem === 0 ) { // Add nodes directly if ( jQuery.type( elem ) === "object" ) { // Support: QtWebKit, PhantomJS // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); // Convert non-html into a text node } else if ( !rhtml.test( elem ) ) { nodes.push( context.createTextNode( elem ) ); // Convert html into DOM nodes } else { tmp = tmp || fragment.appendChild( context.createElement("div") ); // Deserialize a standard representation tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[ 2 ]; // Descend through wrappers to the right content j = wrap[ 0 ]; while ( j-- ) { tmp = tmp.lastChild; } // Support: QtWebKit, PhantomJS // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, tmp.childNodes ); // Remember the top-level container tmp = fragment.firstChild; // Ensure the created nodes are orphaned (#12392) tmp.textContent = ""; } } } // Remove wrapper from fragment fragment.textContent = ""; i = 0; while ( (elem = nodes[ i++ ]) ) { // #4087 - If origin and destination elements are the same, and this is // that element, do not do anything if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { continue; } contains = jQuery.contains( elem.ownerDocument, elem ); // Append to fragment tmp = getAll( fragment.appendChild( elem ), "script" ); // Preserve script evaluation history if ( contains ) { setGlobalEval( tmp ); } // Capture executables if ( scripts ) { j = 0; while ( (elem = tmp[ j++ ]) ) { if ( rscriptType.test( elem.type || "" ) ) { scripts.push( elem ); } } } } return fragment; }, cleanData: function( elems ) { var data, elem, type, key, special = jQuery.event.special, i = 0; for ( ; (elem = elems[ i ]) !== undefined; i++ ) { if ( jQuery.acceptData( elem ) ) { key = elem[ data_priv.expando ]; if ( key && (data = data_priv.cache[ key ]) ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } if ( data_priv.cache[ key ] ) { // Discard any remaining `private` data delete data_priv.cache[ key ]; } } } // Discard any remaining `user` data delete data_user.cache[ elem[ data_user.expando ] ]; } } }); jQuery.fn.extend({ text: function( value ) { return access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().each(function() { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { this.textContent = value; } }); }, null, value, arguments.length ); }, append: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.appendChild( elem ); } }); }, prepend: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.insertBefore( elem, target.firstChild ); } }); }, before: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } }); }, after: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this.nextSibling ); } }); }, remove: function( selector, keepData /* Internal Use Only */ ) { var elem, elems = selector ? jQuery.filter( selector, this ) : this, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem ) ); } if ( elem.parentNode ) { if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { setGlobalEval( getAll( elem, "script" ) ); } elem.parentNode.removeChild( elem ); } } return this; }, empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { if ( elem.nodeType === 1 ) { // Prevent memory leaks jQuery.cleanData( getAll( elem, false ) ); // Remove any remaining nodes elem.textContent = ""; } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map(function() { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( value ) { return access( this, function( value ) { var elem = this[ 0 ] || {}, i = 0, l = this.length; if ( value === undefined && elem.nodeType === 1 ) { return elem.innerHTML; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { value = value.replace( rxhtmlTag, "<$1>" ); try { for ( ; i < l; i++ ) { elem = this[ i ] || {}; // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch( e ) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function() { var arg = arguments[ 0 ]; // Make the changes, replacing each context element with the new content this.domManip( arguments, function( elem ) { arg = this.parentNode; jQuery.cleanData( getAll( this ) ); if ( arg ) { arg.replaceChild( elem, this ); } }); // Force removal if there was no new content (e.g., from empty arguments) return arg && (arg.length || arg.nodeType) ? this : this.remove(); }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, callback ) { // Flatten any nested arrays args = concat.apply( [], args ); var fragment, first, scripts, hasScripts, node, doc, i = 0, l = this.length, set = this, iNoClone = l - 1, value = args[ 0 ], isFunction = jQuery.isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit if ( isFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return this.each(function( index ) { var self = set.eq( index ); if ( isFunction ) { args[ 0 ] = value.call( this, index, self.html() ); } self.domManip( args, callback ); }); } if ( l ) { fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } if ( first ) { scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); hasScripts = scripts.length; // Use the original fragment for the last item instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). for ( ; i < l; i++ ) { node = fragment; if ( i !== iNoClone ) { node = jQuery.clone( node, true, true ); // Keep references to cloned scripts for later restoration if ( hasScripts ) { // Support: QtWebKit // jQuery.merge because push.apply(_, arraylike) throws jQuery.merge( scripts, getAll( node, "script" ) ); } } callback.call( this[ i ], node, i ); } if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; // Reenable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion for ( i = 0; i < hasScripts; i++ ) { node = scripts[ i ]; if ( rscriptType.test( node.type || "" ) && !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { if ( node.src ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl ) { jQuery._evalUrl( node.src ); } } else { jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); } } } } } } return this; } }); jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, ret = [], insert = jQuery( selector ), last = insert.length - 1, i = 0; for ( ; i <= last; i++ ) { elems = i === last ? this : this.clone( true ); jQuery( insert[ i ] )[ original ]( elems ); // Support: QtWebKit // .get() because push.apply(_, arraylike) throws push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; }); var iframe, elemdisplay = {}; /** * Retrieve the actual display of a element * @param {String} name nodeName of the element * @param {Object} doc Document object */ // Called only from within defaultDisplay function actualDisplay( name, doc ) { var style, elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), // getDefaultComputedStyle might be reliably used only on attached element display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? // Use of this method is a temporary fix (more like optimization) until something better comes along, // since it was removed from specification and supported only in FF style.display : jQuery.css( elem[ 0 ], "display" ); // We don't have any data stored on the element, // so use "detach" method as fast way to get rid of the element elem.detach(); return display; } /** * Try to determine the default display value of an element * @param {String} nodeName */ function defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // Use the already-created iframe if possible iframe = (iframe || jQuery( "