/*
Trading API wrapper constructor.
16905
function TradingWrapper(apiKeyOrParams, apiSecret, nonceGen) {
    // Assume first parameter (i.e. apiKeyOrParams) is a params package
    let params = apiKeyOrParams;

    // Try to prove this assumption wrong
    if (params === null || typeof params !== "object") {
        // Pack parameters if so
        params = {
            apiKey: apiKeyOrParams,
            apiSecret: apiSecret,
            nonceGen: nonceGen
        };
    }

    // Assert parameter expectations
    ParamUtils.expectParams(params, {
        apiKey: "string",
        apiSecret: "string",
        nonceGen: {type: "function", opt: true}
    });

    this._apiKey = params.apiKey;
    this._apiSecret = params.apiSecret;
    this._nonceGen = params.nonceGen;
}
668516
function wrappingFetch({ url, method, data }, optionsArg) {
    let requestStatus = createRequestStatus();
    // Here we are using destruct to filter properties we do not want to give to fetch.
    // CORS and isCORS are useless legacy code, xhrErrors is used only in error parsing
    // eslint-disable-next-line no-unused-vars
    let { CORS, isCORS, xhrErrors, ...config } = configGetter();
    const { noStringify, ...options } = optionsArg || {};
    const reqOptions = merge({ headers: {} }, config, options, { method, body: noStringify ? data : JSON.stringify(data) });
    //By default, add json content-type
    if (!reqOptions.noContentType && !reqOptions.headers['Content-Type']) {
        reqOptions.headers['Content-Type'] = 'application/json';
    }
    // Set the requesting as pending
    updateRequestStatus({ id: requestStatus.id, status: 'pending' });
    // Do the request
    return fetch(url, reqOptions)
        // Catch the possible TypeError from fetch
        .catch(error => {
            updateRequestStatus({ id: requestStatus.id, status: 'error' });
            return Promise.reject({ globalErrors: [error] });
        }).then(response => {
            updateRequestStatus({ id: requestStatus.id, status: response.ok ? 'success' : 'error' });
            const contentType = response.headers.get('content-type');
            return getResponseContent(response, reqOptions.dataType ? reqOptions.dataType : contentType && contentType.includes('application/json') ? 'json' : 'text');
        }).catch(data => {
            checkErrors(data, xhrErrors);
            return Promise.reject(data);
        });
}
85213
function createPropertyProvider(getValue, onchange) {
			var ret = new Object();
			ret.getValue = getValue;
			ret.onchange = onchange;
			return ret;
		}
176775
public OkCoinTradeResult trade(String symbol, String type, String price, String amount)
      throws IOException {
    OkCoinTradeResult tradeResult =
        okCoin.trade(apikey, symbol, type, price, amount, signatureCreator());
    return returnOrThrow(tradeResult);
  }
309485
function apivalueFromValue(value) {
  const composedValue = (componentKind) => {
    const elements = value[componentKind].map((it) => {
      const apiValue = apivalueFromValue(it);
      const value = apiValue && apiValue.value;

      return value;
    });

    return {
      type: value.type().toString(),
      value: elements
    };
  };

  if (value === null) {
    return null;
  }
  if (value.isInteger()) {
    return {
      type: i18n('TYPE:Integer'),
      value: value.asNumber()
    };
  } else if (value.isBoolean()) {
    return {
      type: i18n('TYPE:Bool'),
      value: boolFromValue(value)
    };
  } else if (value.isString()) {
    return {
      type: i18n('TYPE:String'),
      value: value.string
    };
  } else if (value.isTuple()) {
    return composedValue('components');
  } else if (value.isList()) {
    return composedValue('elements');
  } else if (value.isStructure()) {
    return {
      type: value.typeName,
      value: value.toString()
    };
  } else {
    return {
      type: value.type().toString(),
      value: value.toString()
    };
  }
}
364981
function createCreateStreamWrap(api) {
  return function createStreamWrap(create_stream) {
    return function create_stream_trace() {
      if (!this.stream) {
        Object.defineProperty(this, 'stream', {
          get: function () { return this._google_trace_stream; },
          set: function (val) {
            api.wrapEmitter(val);
            this._google_trace_stream = val;
          }
        });
      }
      return create_stream.apply(this, arguments);
    };
  };
}
373755
function Broker(options) {
  EventEmitter.call(this);
  this._exchange = null;
  this._queues = {};
  this._ctags = {};
  
  this._options = options;
}
43404
function RequestApi(constructorOptions) {

    LOG.debug('Instantiating new Request object');
    LOG.debug('Validating options');

    try {

        this.options =
            new requestOptions.Constructor().validate(constructorOptions);

    } catch (err) {

        LOG.error('Received error: %s', err);

        throw(
            err
        );

    }

    this.requests = [];
    this.batchId = 1;

}
1119649
function wrapGetOrSet(inherits, key, descriptor, gs, publicStatic) {
    if (hOP.call(descriptor, gs) && trustSuper(descriptor[gs])) {
      descriptor[gs] = wrap(
        gOPD(inherits, key),
        gs,
        descriptor[gs],
        publicStatic
      );
    }
  }
989270
function API(method, url, data, callback) {
    if (typeof callback === 'undefined') {
        callback  = data;
        data  = {};
    }

    url             = this.prepareUrl(url);
    this.callback   = callback || noop;
    this.data       = data;

    this.options          = extend({}, requestOptions);
    this.options.encoding = this.options.encoding || 'utf-8';

    // these particular set of options should be immutable
    this.options.method         = method;
    this.options.uri            = url;
    this.options.followRedirect = false;

    this[method.toLowerCase()]();

    return this;
}
800404
function wrapClass(Controller) {
  let proto = Controller.prototype;
  const ret = {};
  // tracing the prototype chain
  while (proto !== Object.prototype) {
    const keys = Object.getOwnPropertyNames(proto);
    for (const key of keys) {
      // getOwnPropertyNames will return constructor
      // that should be ignored
      if (key === 'constructor') {
        continue;
      }
      // skip getter, setter & non-function properties
      const d = Object.getOwnPropertyDescriptor(proto, key);
      // prevent to override sub method
      if (is.function(d.value) && !ret.hasOwnProperty(key)) {
        ret[key] = methodToMiddleware(Controller, key);
        ret[key][FULLPATH] = Controller.prototype.fullPath + '#' + Controller.name + '.' + key + '()';
      }
    }
    proto = Object.getPrototypeOf(proto);
  }
  return ret;

  function methodToMiddleware(Controller, key) {
    return function classControllerMiddleware(...args) {
      const controller = new Controller(this);
      if (!this.app.config.controller || !this.app.config.controller.supportParams) {
        args = [ this ];
      }
      return utils.callFn(controller[key], args, controller);
    };
  }
}
48786
function Class(parent, api) {
    if ( !api) {
      parent = (api = parent, 0); // !api means there's no parent
    }

    // TODO remove $statics, use $static instead
    var clazz, constructor, singleton, statics, key, bindTo, len, i = 0, p,
        ignoredKeys = { constructor: 1, $singleton: 1, $static:1, $statics: 1, prototype: 1, $super: 1, $superp: 1, main: 1, toString: 0 },
        plugins     = Class.plugins,
        rootParent, parentClass, Stub, descriptor;

    api         = (typeof api === "function" ? api() : api) || {};             // execute api if it's a function
    constructor = api.hasOwnProperty("constructor") ? api.constructor : null;  // hasOwnProperty is a must, constructor is special
    singleton   = api.$singleton;
    statics     = api.$statics || api.$static;

    // add plugins' keys into ignoredKeys
    for (key in plugins) { ignoredKeys[key] = 1; }

    // make sure parent be always an array
    parent = !parent || parent instanceof Array ? parent : [ parent ];
    len = parent && parent.length;
    rootParent = parent[0];

    // construct constructor
    clazz = singleton ? function(){} : (constructor ? constructor : function(){
      if (rootParent) {
        rootParent.apply(this, arguments);
      }
    });

    if ( !singleton && len) {
      parentClass = rootParent.prototype && rootParent === rootParent.prototype.constructor && rootParent;

      if ( !parentClass) {
        clazz.prototype = rootParent;
      } else {
        // Constributed by Freddy Snijder (https://github.com/tnhu/jsface/issues/26)
        Stub = function(){};

        Stub.prototype                    = parentClass.prototype;
        Stub.prototype.constructor        = Stub;
        clazz.prototype                   = new Stub();
        clazz.prototype.constructor       = clazz;       // restoring proper constructor for child class
        parentClass.prototype.constructor = parentClass; // restoring proper constructor for parent class
      }
    }

    // determine bindTo: where api should be bound
    bindTo = singleton ? clazz : clazz.prototype;

    // do inherit static properties and extentions (parents other than the first one)
    while (i < len) {
      p = parent[i++];

      // copy static properties
      for (key in p) {
        if ( !ignoredKeys[key]) {
          clazz[key] = p[key];
        }
      }
      if ( !singleton && i !== 0) {
        for (key in p.prototype) {
          if ( !ignoredKeys[key]) {
            descriptor = Object.getOwnPropertyDescriptor(p.prototype, key);                                    // Fix #37
            bindTo[key] = (descriptor && (descriptor.get || descriptor.set)) ? descriptor : p.prototype[key]; 
          }
        }
      }
    }

    // copy properties from api to bindTo
    for (key in api) {
      if ( !ignoredKeys[key]) {
        var prop = api[key];

        if (prop && (prop.get || prop.set)) {                 // check if it is a property descriptor
          prop.enumerable = true;
          Object.defineProperty(bindTo, key, prop);
        } else {
          bindTo[key] = prop;
        }
      }
    }

    // copy static properties from statics to clazz
    for (key in statics) {
      clazz[key] = statics[key];
    }

    // add $super and $superp to refer to parent class and parent.prototype (if applied)
    p = parent && rootParent || parent;
    clazz.$super  = p;
    clazz.$superp = p && p.prototype || p;

    for (key in plugins) { plugins[key](clazz, parent, api); }            // pass control to plugins
    if (typeof api.main === "function") { api.main.call(clazz, clazz); }  // execute main()

    return clazz;
  }
658447
function Requester() {
		// setup abstract layer
		core.RequesterAbstract.apply(this, arguments);

		// parse the argument
		if (typeof this.object === 'number' || typeof this.object === 'string') {
			this.object = net.createConnection(this.object);
		} else if (!(this.object instanceof net.Server)) {
			this.object = net.createConnection(this.object.port, this.object.host);
		}

		// relay errors
		this.object.on('error', this.emit.bind(this, 'error'));

		// when socket is closed we will emit the close event
		this.object.on('close', this.emit.bind(this, 'close'));

		// setup a json stream handler there rescive data from the TCP socket
		jsonStream(this, this.object);
	}
1256491
function(obj) {
                if (!obj.constructor.Bind) {
                    try {
                        var descr = {};
                        Bind.each(obj, function(name, method) {
                            descr[name] = {
                                get : function() {
                                    return this[name] = method.bind(this.self);
                                },
                                set : function(val) {
                                    Object.defineProperty(this, name, {
                                        value : val
                                    });
                                },
                                configurable : true
                            };
                        });
                        obj.constructor.Bind = Bind.Object.inherit(descr);
                    } catch (e) {
                        obj.constructor.Bind = Bind.Object.inherit({});
                    }
                }

                return new obj.constructor.Bind(obj);
            }
1087982
function(wrapper, name, options){
    function createLocalId(id){
      if (typeof id == 'string')
        return function(data, item){
          return data[id] == item.data[id];
        };

      if (typeof id == 'function')
        return id;
    }

    if (this instanceof )
    {
      if (!wrapper)
        wrapper = $self;

      if (!name || getTypeByNameIfDefined(name))
      {
        /** @cut */ if (getTypeByNameIfDefined(name)) basis.dev.warn(namespace + ': Duplicate entity set type name `' + this.name + '`, name ignored');
        name = getUntitledName('UntitledEntitySetType');
      }

      var entitySetType = new EntitySetConstructor({
        entitySetClass: {
          /** @cut */ className: namespace + '.EntitySet(' + (typeof wrapper == 'string' ? wrapper : (wrapper.type || wrapper).name || 'UnknownType') + ')',
          /** @cut */ name: 'Set of {' + (typeof wrapper == 'string' ? wrapper : (wrapper.type || wrapper).name || 'UnknownType') + '}',
          wrapper: wrapper,
          localId: createLocalId(options && options.localId)
        }
      });

      var EntitySetClass = entitySetType.entitySetClass;
      var result = function(data, entitySet){
        if (data != null)
        {
          if (entitySet instanceof EntitySet == false)
            entitySet = entitySetType.createEntitySet();

          entitySet.set(data instanceof Dataset ? data.getItems() : arrayFrom(data));

          return entitySet;
        }
        else
          return null;
      };

      // if wrapper is string resolve it by named type map
      if (typeof wrapper == 'string')
        EntitySetClass.prototype.wrapper = getTypeByName(wrapper, EntitySetClass.prototype, 'wrapper');

      // resolve type name
      defineType(name, result);

      // extend result with additional properties
      extend(result, {
        type: entitySetType,
        typeName: name,

        toString: function(){
          return name + '()';
        },

        reader: function(data){
          if (Array.isArray(data))
          {
            var wrapper = EntitySetClass.prototype.wrapper;
            return data.map(wrapper.reader || wrapper);
          }

          return data;
        },

        extendClass: function(source){
          EntitySetClass.extend.call(EntitySetClass, source);
          return result;
        },
        extendReader: function(extReader){
          var reader = result.reader;

          result.reader = function(data){
            if (Array.isArray(data))
              extReader(data);
            return reader(data);
          };

          return result;
        },

        // deprecated in 1.3.0
        entitySetType: entitySetType,
        extend: function(){
          /** @cut */ basis.dev.warn('basis.entity: EntitySetType.extend() is deprecated, use EntitySetType.extendClass() instead.');
          return EntitySetClass.extend.apply(EntitySetClass, arguments);
        }
      });

      // deprecated in 1.3.0
      /** @cut */ basis.dev.warnPropertyAccess(result, 'entitySetType', entitySetType,
      /** @cut */   'basis.entity: EntitySetType.entitySetType is deprecated, use EntitySetType.type instead.'
      /** @cut */ );

      return result;
    }
  }
26432
function buildHandler(overrides) {
  const parseError = buildHandler.parseError;
  const buildError = buildHandler.buildError;

  /**
   * .
   */
  return function handler(error) {
    const found = parseError.apply(this, arguments);
    if (!found) {
      if (error instanceof Error) {
        Error.captureStackTrace(error, handler);
        throw error;
      }
      return sliced(arguments);
    }
    error = buildError.apply(this, found);
    if (notEmptyObject(overrides)) {
      Object.assign(error, overrides);
    }
    Error.captureStackTrace(error, handler);
    throw error;
  };
}
460333
function(httpAdapter, options) {
  if (!this.constructor.name) {
    throw new Error('The Constructor must be named');
  }

  this.name = formatGeocoderName(this.constructor.name);

  if (!httpAdapter || httpAdapter == 'undefined') {
    throw new Error(this.constructor.name + ' need an httpAdapter');
  }
  this.httpAdapter = httpAdapter;

  if (!options || options == 'undefined') {
    options = {};
  }

  if (this.options) {
    this.options.forEach(function(option) {
      if (!options[option] || options[option] == 'undefined') {
        options[option] = null;
      }
    });
  }

  this.options = options;
}