This constructor should probably never be called manually. It is used internally by
<code>$firebase.$asArray()</code>.

@param {Firebase} ref
@returns {Array}
@constructor
513515
function FirebaseArray(ref) {
        if( !(this instanceof FirebaseArray) ) {
          return new FirebaseArray(ref);
        }
        var self = this;
        this._observers = [];
        this.$list = [];
        this._ref = ref;
        this._sync = new ArraySyncManager(this);

        $firebaseUtils.assertValidRef(ref, 'Must pass a valid Firebase reference ' +
        'to $firebaseArray (not a string or URL)');

        // indexCache is a weak hashmap (a lazy list) of keys to array indices,
        // items are not guaranteed to stay up to date in this list (since the data
        // array can be manually edited without calling the $ methods) and it should
        // always be used with skepticism regarding whether it is accurate
        // (see $indexFor() below for proper usage)
        this._indexCache = {};

        // Array.isArray will not work on objects which extend the Array class.
        // So instead of extending the Array class, we just return an actual array.
        // However, it's still possible to extend FirebaseArray and have the public methods
        // appear on the array object. We do this by iterating the prototype and binding
        // any method that is not prefixed with an underscore onto the final array.
        $firebaseUtils.getPublicMethods(self, function(fn, key) {
          self.$list[key] = fn.bind(self);
        });

        this._sync.init(this.$list);

        // $resolved provides quick access to the current state of the $loaded() promise.
        // This is useful in data-binding when needing to delay the rendering or visibilty
        // of the data until is has been loaded from firebase.
        this.$list.$resolved = false;
        this.$loaded().finally(function() {
          self.$list.$resolved = true;
        });

        return this.$list;
      }
618634
@Override
  public ServiceRefAmp ref()
  {
    if (_isForeign) {
      return null;
    }

    if (workers() > 1) {
      return buildWorkers();
    }
    
    if (_worker != null) {
      return buildWorker();
    }
    else {
      //throw new IllegalStateException(L.l("build() requires a worker or resource."));
      return buildService();
    }
  }
666194
public JsonNode getRefSchemaNode(String ref) {
        JsonSchema schema = findAncestor();
        JsonNode node = schema.getSchemaNode();

        if (ref.startsWith("#/")) {
            // handle local ref
            String[] keys = ref.substring(2).split("/");
            for (String key : keys) {
                try {
                    key = URLDecoder.decode(key, "utf-8");
                } catch (UnsupportedEncodingException e) {
                }
                Matcher matcher = intPattern.matcher(key);
                if (matcher.matches()) {
                    node = node.get(Integer.parseInt(key));
                } else {
                    node = node.get(key);
                }
                if (node == null){
                    JsonSchema subSchema = schema.fetchSubSchemaNode(validationContext);
                    if (subSchema != null) {
                        node = subSchema.getRefSchemaNode(ref);
                    }
                }
                if (node == null){
                    break;
                }
            }
        }
        return node;
    }
126810
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof PlaceReference)){
    return new PlaceReference(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(GedcomX.ExtensibleData.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
579204
function (schema, refResolver) {

                logger.debug("Creating reader for schema", schema);

                if (!refResolver) {
                    refResolver = new AmdResolver({path: "", altSeparator: "\\.", synchronous: true}).resolver;
                }

                this.smd = schema;

                //finds all $ref instances and replaces with the actual object
                //similar to dojox.json.ref.resolveJson, but doesn't get hung up on circular references
                //TODO: should we assume all schemas have been resolved prior, and remove this step?
                function resolveRef(subobj, parent, parentKey) {
                    if (!subobj.resolved) {
                        Object.keys(subobj).forEach(function (key) {
                            var Ref, value = subobj[key];
                            if (key === "$ref") {
                                logger.debug("Resolving $ref: " + value);
                                Ref = refResolver(value);
                                value = typeof Ref === 'function' ? new Ref() : Ref;
                                if (!util.isUndefined(value) && !value.resolved) {
                                    subobj.resolved = true;
                                    resolveRef(value, subobj, key);
                                }
                                parent[parentKey] = value;
                            } else if (typeof value === "object") {
                                resolveRef(value, subobj, key);
                            }
                        });
                    }
                }

                function getExtendedProperties(obj, props) {
                    var parent = (obj && obj["extends"]), propsObj = [], items = [], itemProps;

                    if (typeof parent !== "undefined") {

                        items = util.isArray(parent) ? parent : [parent]; //can be multiple-inheritance

                        items.forEach(function (item) {
                            itemProps = item.properties || {};
                            Object.keys(itemProps).forEach(function (key) {
                                var value = item.properties[key];
                                if (key !== "__parent") {
                                    propsObj.push({
                                        parentId: item.id,
                                        key: key,
                                        value: value
                                    });
                                }
                            });

                        }, this); // jshint ignore:line

                        props.push(propsObj);
                        props = getExtendedProperties(parent, props);
                    }

                    return props;

                }

                //looks in JSONSchema objects for "extends" and copies properties to children
            function resolveExtensions(schema) {

                var xprops, props;

                xprops = getExtendedProperties(schema, []);

                //unwind the property stack so that the earliest gets inheritance link
                schema.properties = schema.properties || {};
                function copyprop(item) { //util to get around jslint complaints about doing this directly in loop
                    schema.properties[item.key] = item.val;
                }

                while (xprops.length > 0) {
                    props = xprops.pop();
                    props.forEach(copyprop);
                }
            }

            // mix-in parameters for extended schemas
            function resolveExtendedParameters(obj) {

                // assume all references are resolved, just copy parameters down the
                // inheritence chain. If I am derived check base first.
                if (obj["extends"]) {
                    resolveExtendedParameters(obj["extends"]);
                    obj.parameters = obj.parameters || [];
                    obj.parameters = obj.parameters.concat(obj["extends"].parameters);
                }
            }

            //copies properties from parent as defaults, as well as extensions for params
            function resolveProperties(schema) {

                logger.debug("Resolving sub-properties for " + schema.id);

                // resolve inherited global parameters
                resolveExtendedParameters(schema);

                Object.keys(schema.services || {}).forEach(function (key) {
                    var value = schema.services[key];
                    //value.target = value.target ? schema.target + value.target : schema.target; //TODO: should this build concat paths? that is currently handled in getServiceUrl function
                    value.returns = value.returns || schema.returns;
                    value.transport = value.transport || schema.transport;
                    value.contentType = value.contentType || schema.contentType;
                    value.envelope = value.envelope || schema.envelope || "URL";
                    value.description = value.description || "";

                    if (value.returns) {
                        resolveExtensions(value.returns);
                    }

                    if (value.parameters) {
                        value.parameters.forEach(function (item) {
                            item.envelope = item.envelope || value.envelope;
                            item.description = item.description || "";
                        });
                    }


                    var ext = value["extends"];

                    if (ext) {

                        //resolution hasn't been completed or extends object isn't proper JSONSchema
                        if (!ext.id) {
                            throw new Error("Parent schema for method [" + key + "] in schema " + schema.id + " is invalid.");
                        }

                        //TODO: resolveExtensions for params object properties? not really needed yet (the name is fine for now...)
                        if (!value.parameters) {
                            value.parameters = ext.parameters;
                        } else {
                            value.parameters = value.parameters.concat(ext.parameters);
                        }
                    }
                });

                if (!schema.tag) {
                    schema.tag = {};
                }
                schema.tag.resolved = true;
                schema.resolvedProperties = true;
            }

            //if a schema has already been resolved, don't do it again - we can get into endless recursion
            if (!schema.resolved) {
                resolveRef(schema, null, null);
                schema.resolved = true;
            }

            //only resolve these once, or else our concats will be a problem
            if (!schema.resolvedProperties) {
                resolveProperties(schema);
            }

            var hash = {};

            //index params array by name for lookup
            hash.parameters = {};
            this.getMethodNames().forEach(function (methodName) {
                var service = this.smd.services[methodName];
                if (service.parameters) {
                    service.parameters.forEach(function (parameter) {
                        hash[methodName + "-" + parameter.name] = parameter;
                    });
                }
            }, this);

            this.findParameter = function (methodName, parameterName) {
                return hash[methodName + "-" + parameterName];
            };

        }
366763
function (target) {
  if (target) {
    var args = arguments
    if (target === true) {
      if (args.length > 1) {
        target = isArray(target[1]) ? [] : {}
        return extend(target, args, true)
      }
    } else {
      return objectAssignFns ? objectAssignFns.apply(Object, args) : extend(target, args)
    }
  }
  return target
}
537521
function get(ref){
    if (ref && (isNode(ref) || ref.nodeType))
      return ref;
    else
      return typeof ref == 'string' ? document.getElementById(ref) : null;
  }
257555
public function ref($ref1)
    {
        list($ref, $rest) = explode('/', $ref1, 2);

        if (!isset($this->_references[$ref])) {
            /** @type Field_Base $e */
            $e = $this->hasElement($ref);
            if ($e && $e->hasMethod('ref')) {
                return $e->ref();
            } else {
                throw $this->exception('Reference is not defined')
                    ->addMoreInfo('model', $this)
                    ->addMoreInfo('ref', $ref);
            }
        }

        $class = $this->_references[$ref];
        if (is_array($class)) { // hasMany
            if ($rest) {
                throw $this->exception('Cannot traverse multiple references');
            }
            $m = $this->_ref(
                $class[0],
                $class[1] && $class[1] != UNDEFINED ? $class[1] : $this->table.'_id',
                $class[2] && $class[2] != UNDEFINED ? $this[$class[2]] : $this->id
            );
        } else { // hasOne
            $id = $this->get($ref);
            /** @type Model $m */
            $m = $this->_ref(
                $class,
                null,
                $id
            );
            if ($id) {
                $this->hook('beforeRefLoad', array($m, $id));
                $m->load($id);
            }
        }
        if ($rest) {
            $m = $m->ref($rest);
        }

        return $m;
    }
526085
function( array, type, forceClone ) {

		if ( ! array || // let 'undefined' and 'null' pass
				! forceClone && array.constructor === type ) return array;

		if ( typeof type.BYTES_PER_ELEMENT === 'number' ) {

			return new type( array ); // create typed array

		}

		return Array.prototype.slice.call( array ); // create Array

	}
1253980
function WilddogArray(ref) {
        if( !(this instanceof WilddogArray) ) {
          return new WilddogArray(ref);
        }
        var self = this;
        this._observers = [];
        this.$list = [];
        this._ref = ref;
        this._sync = new ArraySyncManager(this);

        $wilddogUtils.assertValidRef(ref, 'Must pass a valid Wilddog reference ' +
        'to $wilddogArray (not a string or URL)');

        // indexCache is a weak hashmap (a lazy list) of keys to array indices,
        // items are not guaranteed to stay up to date in this list (since the data
        // array can be manually edited without calling the $ methods) and it should
        // always be used with skepticism regarding whether it is accurate
        // (see $indexFor() below for proper usage)
        this._indexCache = {};

        // Array.isArray will not work on objects which extend the Array class.
        // So instead of extending the Array class, we just return an actual array.
        // However, it's still possible to extend WilddogArray and have the public methods
        // appear on the array object. We do this by iterating the prototype and binding
        // any method that is not prefixed with an underscore onto the final array.
        $wilddogUtils.getPublicMethods(self, function(fn, key) {
          self.$list[key] = fn.bind(self);
        });

        this._sync.init(this.$list);

        return this.$list;
      }
859725
function wrapGetterFn(_ref) {
        var _ref2 = slicedToArray(_ref, 2),
            key = _ref2[0],
            originalFn = _ref2[1];

        var newFn = function newFn() {
            var innerFn = originalFn.apply(this, arguments);

            if (typeof innerFn !== 'function') {
                /* istanbul ignore next */
                throw 'The getter ' + key + ' does not return a function. Try using the \'mapGetter\' helper instead';
            }

            return innerFn(this.id);
        };

        return [key, newFn];
    }
1095853
function (value) {
        var result = this.get(value.$ref);
        if (isObj(result) && isStr(value.$tmpl)) {
            result = strTemplate(value.$tmpl, result);
        }
        return result;
    }
874342
function createGetter(_ref) {
        var key = _ref.key,
            namespace = _ref.namespace,
            normalizedMappings = _ref.normalizedMappings,
            vmIdentifierKey = _ref.vmIdentifierKey,
            instanceIdentifierKey = _ref.instanceIdentifierKey,
            stateKey = _ref.stateKey;

        return function () {
            var _this = this;

            // find the state object
            var state = namespace ? resolveObjectPath(this.$store.state, namespace, '/') : this.$store.state;

            // find our container of instances
            var instancesContainer = resolveObjectPath(state, stateKey, '.');

            // find our instance within it
            var instance = instancesContainer.find(function (obj) {
                return obj[instanceIdentifierKey] === _this[vmIdentifierKey];
            });

            // and if all goes well, resolve the piece of state we're looking for
            if (instance) {
                return typeof normalizedMappings[key] === 'function' ? normalizedMappings[key](instance) : resolveObjectPath(instance, normalizedMappings[key]);
            }
        };
    }
2525
function(target) {
		var undef;

		each(arguments, function(arg, i) {
			if (i > 0) {
				each(arg, function(value, key) {
					if (value !== undef) {
						if (typeOf(target[key]) === typeOf(value) && !!~inArray(typeOf(value), ['array', 'object'])) {
							extend(target[key], value);
						} else {
							target[key] = value;
						}
					}
				});
			}
		});
		return target;
	}
749183
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof EvidenceReference)){
    return new EvidenceReference(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(GedcomX.ResourceReference.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
932826
function ref_copy(from) {

	//console.log( 'at ref_copy(): from = ' + JSON.stringify(from) );
	//console.log( 'typeof from = ' + (typeof from) );

	var to;

	// Handle arrays
	if( from && (typeof from === 'object') && (from instanceof Array) ) {
		//console.log( '^ from is Array: ' + JSON.stringify(from) );

		to = ARRAY(from).map(ref_copy).valueOf();

	// Convert objects with a property `$ref` as a function shortcut to `Resource.get(url, opts)`;
	} else if( from && (typeof from === 'object') && (from.$ref !== undefined) ) {
		//console.log( '^ from is $ref-object: ' + JSON.stringify(from) );

		var url = from.$ref;
		to = new Resource.Partial();

		ref_copy_self(to, from);

		if(!is.string(to.$ref)) {
			debug.log('Warning! Partial object from '+ url +' does not have property $ref!');
		}

	// Convert normal objects
	} else if( from && (typeof from === 'object') ) {

		to = {};
		//console.log( '^ from is plain object: ' + JSON.stringify(from) );
		ref_copy_self(to, from);

	// Anything else is passed directly back
	} else {
		//console.log( '^ from is other type: ' + JSON.stringify(from) );
		to = from;
	}

	//console.log('..returning ' + JSON.stringify(to) + ' of type ' + (typeof to));
	return to;
}
472330
function createDefinePropsMethod(_ref) {
  var enumerable = _ref.enumerable;
  var operation = enumerable ? defineEnumProp : defineProp;
  return function (argTuples, target) {
    argTuples.forEach(function (argTuple) {
      var _argTuple = _slicedToArray(argTuple, 3),
          TypeRef = _argTuple[0],
          propName = _argTuple[1],
          defaultValue = _argTuple[2];

      (0, _function.apply)(operation, [TypeRef, target, propName, defaultValue]);
    });
    return target;
  };
}