<commit_before>;(function($$){ 'use strict';

  var borderWidthMultiplier = 2 * 0.5;
  var borderWidthAdjustment = 0;

  $$.fn.eles({

    // fully updates (recalculates) the style for the elements
    updateStyle: function( notifyRenderer ){
      var cy = this._private.cy;
      var style = cy.style();
      notifyRenderer = notifyRenderer || notifyRenderer === undefined ? true : false;

      style.apply( this );

      var updatedCompounds = this.updateCompoundBounds();

      if( notifyRenderer ){
        this.add( updatedCompounds ).rtrigger('style'); // let renderer know we changed style
      } else {
        this.add( updatedCompounds ).trigger('style'); // just fire the event
      }
      return this; // chaining
    },

    // just update the mappers in the elements' styles; cheaper than eles.updateStyle()
    updateMappers: function( notifyRenderer ){
      var cy = this._private.cy;
      var style = cy.style();
      notifyRenderer = notifyRenderer || notifyRenderer === undefined ? true : false;

      style.updateMappers( this );

      var updatedCompounds = this.updateCompoundBounds();

      if( notifyRenderer ){
        this.add( updatedCompounds ).rtrigger('style'); // let renderer know we changed style
      } else {
        this.add( updatedCompounds ).trigger('style'); // just fire the event
      }
      return this; // chaining
    },

    // get the specified css property as a rendered value (i.e. on-screen value)
    // or get the whole rendered style if no property specified (NB doesn't allow setting)
    renderedCss: function( property ){
      var ele = this[0];

      if( ele ){
        var renstyle = ele.cy().style().getRenderedStyle( ele );

        if( property === undefined ){
          return renstyle;
        } else {
          return renstyle[ property ];
        }
      }
    },

    // read the calculated css style of the element or override the style (via a bypass)
    css: function( name, value ){
      var style = this.cy().style();

      if( $$.is.plainObject(name) ){ // then extend the bypass
        var props = name;
        style.applyBypass( this, props );
        this.rtrigger('style'); // let the renderer know we've updated style

      } else if( $$.is.string(name) ){

        if( value === undefined ){ // then get the property from the style
          var ele = this[0];

          if( ele ){
            return ele._private.style[ name ].strValue;
          } else { // empty collection => can't get any value
            return;
          }

        } else { // then set the bypass with the property value
          style.applyBypass( this, name, value );
          this.rtrigger('style'); // let the renderer know we've updated style
        }

      } else if( name === undefined ){
        var ele = this[0];

        if( ele ){
          return style.getRawStyle( ele );
        } else { // empty collection => can't get any value
          return;
        }
      }

      return this; // chaining
    },

    removeCss: function(){
      var style = this.cy().style();
      var eles = this;

      for( var i = 0; i < eles.length; i++ ){
        var ele = eles[i];

        style.removeAllBypasses( ele );
      }

      this.rtrigger('style');
    },

    show: function(){
      this.css('display', 'element');
      return this; // chaining
    },

    hide: function(){
      this.css('display', 'none');
      return this; // chaining
    },

    visible: function(){
      var ele = this[0];

      if( ele ){
        if(
          ele.css('visibility') !== 'visible'
        ||  ele.css('display') !== 'element'
        // ||  parseFloat( ele.css('opacity') ) === 0
        ){
          return false;
        }

        if( ele.isNode() ){
          var parents = ele.parents();
          for( var i = 0; i < parents.length; i++ ){
            var parent = parents[i];
            var pVis = parent.css('visibility');
            var pDis = parent.css('display');
            var pOpac = parseFloat( parent.css('opacity') );

            if( pVis !== 'visible' || pDis !== 'element' ){
              return false;
            }
          }

          return true;
        } else if( ele.isEdge() ){
          var src = ele.source();
          var tgt = ele.target();

          return src.visible() && tgt.visible();
        }

      }
    },

    hidden: function(){
      var ele = this[0];

      if( ele ){
        return !ele.visible();
      }
    },

    effectiveOpacity: function(){
      var ele = this[0];

      if( ele ){
        var parentOpacity = ele._private.style.opacity.value;
        var parents = ele.parents();

        for( var i = 0; i < parents.length; i++ ){
          var parent = parents[i];
          var opacity = parent._private.style.opacity.value;

          parentOpacity = opacity * parentOpacity;
        }

        return parentOpacity;
      }
    },

    transparent: function(){
      var ele = this[0];

      if( ele ){
        return ele.effectiveOpacity() === 0;
      }
    },

    isFullAutoParent: function(){
      var ele = this[0];

      if( ele ){
        var autoW = ele._private.style['width'].value === 'auto';
        var autoH = ele._private.style['height'].value === 'auto';

        return ele.isParent() && autoW && autoH;
      }
    }

  });

  $$.elesfn.style = $$.elesfn.css;
  $$.elesfn.renderedStyle = $$.elesfn.renderedCss;
  $$.elesfn.removeStyle = $$.elesfn.removeCss;

})( cytoscape );<commit_msg>add #427 fix to 2.2. branch<commit_after>;(function($$){ 'use strict';

  var borderWidthMultiplier = 2 * 0.5;
  var borderWidthAdjustment = 0;

  $$.fn.eles({

    // fully updates (recalculates) the style for the elements
    updateStyle: function( notifyRenderer ){
      var cy = this._private.cy;
      var style = cy.style();
      notifyRenderer = notifyRenderer || notifyRenderer === undefined ? true : false;

      style.apply( this );

      var updatedCompounds = this.updateCompoundBounds();

      if( notifyRenderer ){
        this.add( updatedCompounds ).rtrigger('style'); // let renderer know we changed style
      } else {
        this.add( updatedCompounds ).trigger('style'); // just fire the event
      }
      return this; // chaining
    },

    // just update the mappers in the elements' styles; cheaper than eles.updateStyle()
    updateMappers: function( notifyRenderer ){
      var cy = this._private.cy;
      var style = cy.style();
      notifyRenderer = notifyRenderer || notifyRenderer === undefined ? true : false;

      style.updateMappers( this );

      var updatedCompounds = this.updateCompoundBounds();

      if( notifyRenderer ){
        this.add( updatedCompounds ).rtrigger('style'); // let renderer know we changed style
      } else {
        this.add( updatedCompounds ).trigger('style'); // just fire the event
      }
      return this; // chaining
    },

    // get the specified css property as a rendered value (i.e. on-screen value)
    // or get the whole rendered style if no property specified (NB doesn't allow setting)
    renderedCss: function( property ){
      var ele = this[0];

      if( ele ){
        var renstyle = ele.cy().style().getRenderedStyle( ele );

        if( property === undefined ){
          return renstyle;
        } else {
          return renstyle[ property ];
        }
      }
    },

    // read the calculated css style of the element or override the style (via a bypass)
    css: function( name, value ){
      var style = this.cy().style();

      if( $$.is.plainObject(name) ){ // then extend the bypass
        var props = name;
        style.applyBypass( this, props );

        var updatedCompounds = this.updateCompoundBounds();
        this.add( updatedCompounds ).rtrigger('style'); // let the renderer know we've updated style

      } else if( $$.is.string(name) ){

        if( value === undefined ){ // then get the property from the style
          var ele = this[0];

          if( ele ){
            return ele._private.style[ name ].strValue;
          } else { // empty collection => can't get any value
            return;
          }

        } else { // then set the bypass with the property value
          style.applyBypass( this, name, value );

          var updatedCompounds = this.updateCompoundBounds();
        	this.add( updatedCompounds ).rtrigger('style'); // let the renderer know we've updated style
        }

      } else if( name === undefined ){
        var ele = this[0];

        if( ele ){
          return style.getRawStyle( ele );
        } else { // empty collection => can't get any value
          return;
        }
      }

      return this; // chaining
    },

    removeCss: function(){
      var style = this.cy().style();
      var eles = this;

      for( var i = 0; i < eles.length; i++ ){
        var ele = eles[i];

        style.removeAllBypasses( ele );
      }

      var updatedCompounds = this.updateCompoundBounds();
      this.add( updatedCompounds ).rtrigger('style');
    },

    show: function(){
      this.css('display', 'element');
      return this; // chaining
    },

    hide: function(){
      this.css('display', 'none');
      return this; // chaining
    },

    visible: function(){
      var ele = this[0];

      if( ele ){
        if(
          ele.css('visibility') !== 'visible'
        ||  ele.css('display') !== 'element'
        // ||  parseFloat( ele.css('opacity') ) === 0
        ){
          return false;
        }

        if( ele.isNode() ){
          var parents = ele.parents();
          for( var i = 0; i < parents.length; i++ ){
            var parent = parents[i];
            var pVis = parent.css('visibility');
            var pDis = parent.css('display');
            var pOpac = parseFloat( parent.css('opacity') );

            if( pVis !== 'visible' || pDis !== 'element' ){
              return false;
            }
          }

          return true;
        } else if( ele.isEdge() ){
          var src = ele.source();
          var tgt = ele.target();

          return src.visible() && tgt.visible();
        }

      }
    },

    hidden: function(){
      var ele = this[0];

      if( ele ){
        return !ele.visible();
      }
    },

    effectiveOpacity: function(){
      var ele = this[0];

      if( ele ){
        var parentOpacity = ele._private.style.opacity.value;
        var parents = ele.parents();

        for( var i = 0; i < parents.length; i++ ){
          var parent = parents[i];
          var opacity = parent._private.style.opacity.value;

          parentOpacity = opacity * parentOpacity;
        }

        return parentOpacity;
      }
    },

    transparent: function(){
      var ele = this[0];

      if( ele ){
        return ele.effectiveOpacity() === 0;
      }
    },

    isFullAutoParent: function(){
      var ele = this[0];

      if( ele ){
        var autoW = ele._private.style['width'].value === 'auto';
        var autoH = ele._private.style['height'].value === 'auto';

        return ele.isParent() && autoW && autoH;
      }
    }

  });

  $$.elesfn.style = $$.elesfn.css;
  $$.elesfn.renderedStyle = $$.elesfn.renderedCss;
  $$.elesfn.removeStyle = $$.elesfn.removeCss;

})( cytoscape );<|endoftext|>


<commit_before>function isFunction(o){
	return typeof o === "function";
}
function isObject(o){
    return typeof o === "object";
}

var isArray = function(a){	return a instanceof Array; };

function toString(obj, stack){
	if(stack && (stack.length > 15 || stack.indexOf(obj) >= 0)){ return '...'; }
	if(obj == null){ return String(obj); }
	if(typeof obj == "string"){ return '"'+obj+'"'; }
	stack = [obj].concat(stack);
	if(isFunction(obj)){ return obj.name || obj.toString(stack); }
	if(isArray(obj)){
		return '[' + obj.map(function(item) {
				return toString(item, stack);
			}).join(', ') + ']';
	}
	if(obj && isObject(obj)){
		var indent = (new Array(stack.length)).join('\t');
		return '{' + Object.keys(obj).map(function(key){
				return '\n\t' + indent + key + ': ' + toString(obj[key], stack);
			}).join(',') + '\n' + indent + '}';
	}
	return String(obj)
}

function bettertypeof(obj){
	return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1];
}

function cloneArray(arr){
	return Array.prototype.slice.call(arr);
}

function merge(base, ext, replace){
	if(ext instanceof Object){
		for(var p in ext){
			if(ext.hasOwnProperty(p)){
				if(base.hasOwnProperty(p)){
					if(base[p] instanceof Object){
						merge(base[p], ext[p], replace);
					} else if(replace){
						base[p] = ext[p];
					}
				} else {
					base[p] = ext[p];
				}
			}
		}
	}
	return base
}

var canSetProto = !!Object.setPrototypeOf || {__proto__:[]} instanceof Array;
Object.setPrototypeOf = Object.setPrototypeOf || (canSetProto
    ? function(o, p){ o.__proto__ = p; }
    : function(o, p){ for(var k in p){ o[k] = p[k]; } ensureProto(o, p); });

Object.getPrototypeOf = Object.getPrototypeOf && canSetProto ? Object.getPrototypeOf : function(o){
    return o.__proto__ || (o.constructor ? o.constructor.prototype : null);
};

function ensureProto(o, p){
	if(!canSetProto){
		Object.defineProperty(o, "__proto__", { enumerable: false, writable: true, value: p });
	}
}

function setProto(constructor, proto, protoConstructor){
	constructor.prototype = Object.create(proto);
	constructor.prototype.constructor = protoConstructor || constructor;
	ensureProto(constructor.prototype, proto);
}

function setConstructor(model, constructor){
	Object.setPrototypeOf(model, constructor.prototype);
	Object.defineProperty(model, "constructor", {enumerable: false, writable: true, value: constructor});
}

var isProxySupported = (typeof Proxy === "function");<commit_msg>review of deep merge function<commit_after>function isFunction(o){
	return typeof o === "function";
}
function isObject(o){
    return typeof o === "object";
}

var isArray = function(a){	return a instanceof Array; };

function toString(obj, stack){
	if(stack && (stack.length > 15 || stack.indexOf(obj) >= 0)){ return '...'; }
	if(obj == null){ return String(obj); }
	if(typeof obj == "string"){ return '"'+obj+'"'; }
	stack = [obj].concat(stack);
	if(isFunction(obj)){ return obj.name || obj.toString(stack); }
	if(isArray(obj)){
		return '[' + obj.map(function(item) {
				return toString(item, stack);
			}).join(', ') + ']';
	}
	if(obj && isObject(obj)){
		var indent = (new Array(stack.length)).join('\t');
		return '{' + Object.keys(obj).map(function(key){
				return '\n\t' + indent + key + ': ' + toString(obj[key], stack);
			}).join(',') + '\n' + indent + '}';
	}
	return String(obj)
}

function bettertypeof(obj){
	return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1];
}

function cloneArray(arr){
	return Array.prototype.slice.call(arr);
}

function merge(target, src, deep) {
	Object.keys(src || {}).forEach(function(key){
		if(deep && bettertypeof(src[key]) === "Object"){
			var o = {};
			merge(o, target[key], deep);
			merge(o, src[key], deep);
			target[key] = o;
		} else {
			target[key] = src[key]
		}
	});
}

var canSetProto = !!Object.setPrototypeOf || {__proto__:[]} instanceof Array;
Object.setPrototypeOf = Object.setPrototypeOf || (canSetProto
    ? function(o, p){ o.__proto__ = p; }
    : function(o, p){ for(var k in p){ o[k] = p[k]; } ensureProto(o, p); });

Object.getPrototypeOf = Object.getPrototypeOf && canSetProto ? Object.getPrototypeOf : function(o){
    return o.__proto__ || (o.constructor ? o.constructor.prototype : null);
};

function ensureProto(o, p){
	if(!canSetProto){
		Object.defineProperty(o, "__proto__", { enumerable: false, writable: true, value: p });
	}
}

function setProto(constructor, proto, protoConstructor){
	constructor.prototype = Object.create(proto);
	constructor.prototype.constructor = protoConstructor || constructor;
	ensureProto(constructor.prototype, proto);
}

function setConstructor(model, constructor){
	Object.setPrototypeOf(model, constructor.prototype);
	Object.defineProperty(model, "constructor", {enumerable: false, writable: true, value: constructor});
}

var isProxySupported = (typeof Proxy === "function");<|endoftext|>


<commit_before>(function() {
    'use strict'
    angular.module('application').controller('HomeController', ['$scope', 'HomeServices', HomeController]);

    function HomeController($scope, HomeServices) {
        self = this;
        self.message = '';
        self.messageInput = '';

        // Auth0
        self.id = process.env.Client_Id;
        self.secret = process.env.Client_Secret;
        self.token = {};

        // Values
        self.values = {};

        self.askToken = function() {
            HomeServices.askToken(self.id,self.secret).then(
            function(result) {
                self.token = result;
            },
            function(err) {
                console.log('Error retrieving from endpoint: ', err);
            });
        }

        self.getValues = function() {
          HomeServices.getValues(self.token).then(
          function(result) {
              self.values = result;
          },
          function(err) {
              console.log('Error retrieving from endpoint: ', err);
          });
        }

        self.clickSetPair = function(key, value) {
            console.log(key);
            console.log(value);

            HomeServices.setValues(self.token,key,value).then(
            function(result) {
                self.message = result;
            },
            function(err) {
                console.log('Error retrieving from endpoint: ', err);
            });
        }

        self.updateMessage = function() {

          HomeServices.sayHello(self.token,self.messageInput).then(
          function(result) {
              self.message = result;
          },
          function(err) {
              console.log('Error retrieving from endpoint: ', err);
          });
        }

        HomeServices.sayHello(self.token).then(
        function(result) {
            self.message = result;
        },
        function(err) {
            console.log('Error retrieving from endpoint: ', err);
        });

    };

})();
<commit_msg>Environment variables must be CAPS<commit_after>(function() {
    'use strict'
    angular.module('application').controller('HomeController', ['$scope', 'HomeServices', HomeController]);

    function HomeController($scope, HomeServices) {
        self = this;
        self.message = '';
        self.messageInput = '';

        // Auth0
        self.id = process.env.CLIENT_ID;
        self.secret = process.env.CLIENT_SECRET;
        self.token = {};

        // Values
        self.values = {};

        self.askToken = function() {
            HomeServices.askToken(self.id,self.secret).then(
            function(result) {
                self.token = result;
            },
            function(err) {
                console.log('Error retrieving from endpoint: ', err);
            });
        }

        self.getValues = function() {
          HomeServices.getValues(self.token).then(
          function(result) {
              self.values = result;
          },
          function(err) {
              console.log('Error retrieving from endpoint: ', err);
          });
        }

        self.clickSetPair = function(key, value) {
            console.log(key);
            console.log(value);

            HomeServices.setValues(self.token,key,value).then(
            function(result) {
                self.message = result;
            },
            function(err) {
                console.log('Error retrieving from endpoint: ', err);
            });
        }

        self.updateMessage = function() {

          HomeServices.sayHello(self.token,self.messageInput).then(
          function(result) {
              self.message = result;
          },
          function(err) {
              console.log('Error retrieving from endpoint: ', err);
          });
        }

        HomeServices.sayHello(self.token).then(
        function(result) {
            self.message = result;
        },
        function(err) {
            console.log('Error retrieving from endpoint: ', err);
        });

    };

})();
<|endoftext|>


<commit_before>function baseselect(widget_id, url, skin, parameters)
{
    // Will be using "self" throughout for the various flavors of "this"
    // so for consistency ...

    self = this

    // Initialization

    self.widget_id = widget_id

    // Store on brightness or fallback to a default

    // Parameters may come in useful later on

    self.parameters = parameters

    self.onChange = onChange

    var callbacks = [
        {"observable": "selectedoption", "action": "change", "callback": self.onChange}
                    ]

            // Define callbacks for entities - this model allows a widget to monitor multiple entities if needed
    // Initial will be called when the dashboard loads and state has been gathered for the entity
    // Update will be called every time an update occurs for that entity

    self.OnStateAvailable = OnStateAvailable
    self.OnStateUpdate = OnStateUpdate

    if ("entity" in parameters)
    {
        var monitored_entities =
            [
                {"entity": parameters.entity, "initial": self.OnStateAvailable, "update": self.OnStateUpdate}
            ]
    }
    else
    {
        var monitored_entities =  []
    }
    // Finally, call the parent constructor to get things moving

    WidgetBase.call(self, widget_id, url, skin, parameters, monitored_entities, callbacks)

    // Function Definitions

    // The StateAvailable function will be called when
    // self.state[<entity>] has valid information for the requested entity
    // state is the initial state
    // Methods

    function OnStateAvailable(self, state)
    {
        self.state = state.state
        set_options(self, state.attributes.options, state)
        set_value(self, state)
    }

    function OnStateUpdate(self, state)
    {
        self.state = state.state
        set_value(self, state)
    }

    function set_value(self, state)
    {
        value = self.map_state(self, state.state)
        self.set_field(self, "selectedoption", value)
    }

    function onChange(self, state)
    {
        if (self.state != self.ViewModel.selectedoption())
        {
            self.state = self.ViewModel.selectedoption()
	        args = self.parameters.post_service
            args["option"] = self.state
	        self.call_service(self, args)
        }
    }

    function set_options(self, options, state)
    {
        self.set_field(self, "inputoptions", options)
    }

}<commit_msg>Fix race condition in input_select<commit_after>function baseselect(widget_id, url, skin, parameters)
{
    // Will be using "self" throughout for the various flavors of "this"
    // so for consistency ...

    self = this;

    // Initialization

    self.widget_id = widget_id;

    // Store on brightness or fallback to a default

    // Parameters may come in useful later on

    self.parameters = parameters;

    self.initial = 1

    self.onChange = onChange;

    var callbacks = [
        {"observable": "selectedoption", "action": "change", "callback": self.onChange}
                    ];

    // Define callbacks for entities - this model allows a widget to monitor multiple entities if needed
    // Initial will be called when the dashboard loads and state has been gathered for the entity
    // Update will be called every time an update occurs for that entity

    self.OnStateAvailable = OnStateAvailable;
    self.OnStateUpdate = OnStateUpdate;

    if ("entity" in parameters)
    {
        var monitored_entities =
            [
                {"entity": parameters.entity, "initial": self.OnStateAvailable, "update": self.OnStateUpdate}
            ]
    }
    else
    {
        var monitored_entities =  []
    }
    // Finally, call the parent constructor to get things moving

    WidgetBase.call(self, widget_id, url, skin, parameters, monitored_entities, callbacks);

    // Function Definitions

    // The StateAvailable function will be called when
    // self.state[<entity>] has valid information for the requested entity
    // state is the initial state
    // Methods

    function OnStateAvailable(self, state)
    {
        self.state = state;
        set_options(self, state.attributes.options, state);
        set_value(self, state)
    }

    function OnStateUpdate(self, state)
    {
        self.state = state.state;
        set_value(self, state)
    }

    function set_value(self, state)
    {
        value = self.map_state(self, state.state);
        self.set_field(self, "selectedoption", value)
    }

    function onChange(self, state)
    {
        if (self.state != self.ViewModel.selectedoption())
        {
            self.state = self.ViewModel.selectedoption();
            if (self.initial != 1)
            {
                args = self.parameters.post_service;
                args["option"] = self.state;
                self.call_service(self, args)
            }
            else
            {
                self.initial = 0
            }
        }
    }

    function set_options(self, options, state)
    {
        self.set_field(self, "inputoptions", options)
    }

}<|endoftext|>


<commit_before>import * as utils from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';

const BIDDER_CODE = 'admixer';
const ALIASES = ['go2net'];
const ENDPOINT_URL = 'https://inv-nets.admixer.net/prebid.1.0.aspx';
export const spec = {
  code: BIDDER_CODE,
  aliases: ALIASES,
  supportedMediaTypes: ['banner', 'video'],
  /**
   * Determines whether or not the given bid request is valid.
   */
  isBidRequestValid: function (bid) {
    return !!bid.params.zone;
  },
  /**
   * Make a server request from the list of BidRequests.
   */
  buildRequests: function (validRequest, bidderRequest) {
    const payload = {
      imps: [],
      referrer: encodeURIComponent(bidderRequest.refererInfo.referer),
    };
    validRequest.forEach((bid) => {
      payload.imps.push(bid);
    });
    const payloadString = JSON.stringify(payload);
    return {
      method: 'GET',
      url: ENDPOINT_URL,
      data: `data=${payloadString}`,
    };
  },
  /**
   * Unpack the response from the server into a list of bids.
   */
  interpretResponse: function (serverResponse, bidRequest) {
    const bidResponses = [];
    // loop through serverResponses {
    try {
      serverResponse = serverResponse.body;
      serverResponse.forEach((bidResponse) => {
        const bidResp = {
          requestId: bidResponse.bidId,
          cpm: bidResponse.cpm,
          width: bidResponse.width,
          height: bidResponse.height,
          ad: bidResponse.ad,
          ttl: bidResponse.ttl,
          creativeId: bidResponse.creativeId,
          netRevenue: bidResponse.netRevenue,
          currency: bidResponse.currency,
          vastUrl: bidResponse.vastUrl,
        };
        bidResponses.push(bidResp);
      });
    } catch (e) {
      utils.logError(e);
    }
    return bidResponses;
  }
};
registerBidder(spec);
<commit_msg>Admixer Bid Adapter add consent support (#5169)<commit_after>import * as utils from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';

const BIDDER_CODE = 'admixer';
const ALIASES = ['go2net'];
const ENDPOINT_URL = 'https://inv-nets.admixer.net/prebid.1.0.aspx';
export const spec = {
  code: BIDDER_CODE,
  aliases: ALIASES,
  supportedMediaTypes: ['banner', 'video'],
  /**
   * Determines whether or not the given bid request is valid.
   */
  isBidRequestValid: function (bid) {
    return !!bid.params.zone;
  },
  /**
   * Make a server request from the list of BidRequests.
   */
  buildRequests: function (validRequest, bidderRequest) {
    const payload = {
      imps: [],
    };
    if (bidderRequest) {
      if (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
        payload.referrer = encodeURIComponent(bidderRequest.refererInfo.referer);
      }
      if (bidderRequest.gdprConsent) {
        payload.gdprConsent = {
          consentString: bidderRequest.gdprConsent.consentString,
          // will check if the gdprApplies field was populated with a boolean value (ie from page config).  If it's undefined, then default to true
          gdprApplies: (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? bidderRequest.gdprConsent.gdprApplies : true
        }
      }
      if (bidderRequest.uspConsent) {
        payload.uspConsent = bidderRequest.uspConsent;
      }
    }
    validRequest.forEach((bid) => {
      payload.imps.push(bid);
    });
    const payloadString = JSON.stringify(payload);
    return {
      method: 'GET',
      url: ENDPOINT_URL,
      data: `data=${payloadString}`,
    };
  },
  /**
   * Unpack the response from the server into a list of bids.
   */
  interpretResponse: function (serverResponse, bidRequest) {
    const bidResponses = [];
    // loop through serverResponses {
    try {
      serverResponse = serverResponse.body;
      serverResponse.forEach((bidResponse) => {
        const bidResp = {
          requestId: bidResponse.bidId,
          cpm: bidResponse.cpm,
          width: bidResponse.width,
          height: bidResponse.height,
          ad: bidResponse.ad,
          ttl: bidResponse.ttl,
          creativeId: bidResponse.creativeId,
          netRevenue: bidResponse.netRevenue,
          currency: bidResponse.currency,
          vastUrl: bidResponse.vastUrl,
        };
        bidResponses.push(bidResp);
      });
    } catch (e) {
      utils.logError(e);
    }
    return bidResponses;
  }
};
registerBidder(spec);
<|endoftext|>


<commit_before>/**
 * @file MaterialTextArea component
 * @author liangxiaojun(liangxiaojun@derbysoft.com)
 */

import React, {Component} from 'react';
import PropTypes from 'prop-types';

import TextArea from '../TextArea';
import MaterialFieldSeparator from '../_MaterialFieldSeparator';
import Theme from '../Theme';

import Util from '../_vendors/Util';

export default class MaterialTextArea extends Component {

    static Type = TextArea.Type;

    constructor(props, ...restArgs) {

        super(props, ...restArgs);

        this.state = {
            value: '',
            isFocus: false,
            isHover: false
        };

        this.triggerFocusHandler = ::this.triggerFocusHandler;
        this.triggerBlurHandler = ::this.triggerBlurHandler;
        this.triggerChangeHandler = ::this.triggerChangeHandler;
        this.triggerMouseOverHandler = ::this.triggerMouseOverHandler;
        this.triggerMouseOutHandler = ::this.triggerMouseOutHandler;

    }

    triggerFocusHandler(...args) {
        this.setState({
            isFocus: true
        }, () => {
            const {onFocus} = this.props;
            onFocus && onFocus(...args);
        });
    }

    triggerBlurHandler(...args) {
        this.setState({
            isFocus: false
        }, () => {
            const {onBlur} = this.props;
            onBlur && onBlur(...args);
        });
    }

    triggerChangeHandler(value) {
        this.setState({
            value
        }, () => {
            const {onChange} = this.props;
            onChange && onChange(value);
        });
    }

    triggerMouseOverHandler(...args) {
        this.setState({
            isHover: true
        }, () => {
            const {onMouseOver} = this.props;
            onMouseOver && onMouseOver(...args);
        });
    }

    triggerMouseOutHandler(...args) {
        this.setState({
            isHover: false
        }, () => {
            const {onMouseOut} = this.props;
            onMouseOut && onMouseOut(...args);
        });
    }

    componentWillReceiveProps(nextProps) {
        if (nextProps.value !== this.state.value) {
            this.setState({
                value: nextProps.value
            });
        }
    }

    componentDidMount() {
        this.setState({
            value: this.props.value
        });
    }

    render() {

        const {
                className, style, theme, label, isLabelAnimate, wordCountVisible,
                ...restProps
            } = this.props,
            {isFocus, isHover, value} = this.state,

            wrapperClassName = (isLabelAnimate ? ' animated' : '') + (label ? ' has-label' : '')
                + (isFocus ? ' focused' : '') + (value ? ' has-value' : '')
                + (wordCountVisible ? ' has-word-count' : '') + (className ? ' ' + className : '');

        return (

                {
                    label ?

                            {label}

                        :
                        null
                }

                <TextArea {...restProps}
                          theme={theme}
                          value={value}
                          wordCountVisible={wordCountVisible}
                          onFocus={this.triggerFocusHandler}
                          onBlur={this.triggerBlurHandler}
                          onMouseOver={this.triggerMouseOverHandler}
                          onMouseOut={this.triggerMouseOutHandler}
                          onChange={this.triggerChangeHandler}/>

                <MaterialFieldSeparator theme={theme}
                                        isHover={isHover}
                                        isFocus={isFocus}/>

        );

    }
};

MaterialTextArea.propTypes = {

    /**
     * The CSS class name of the root element.
     */
    className: PropTypes.string,

    /**
     * Override the styles of the root element.
     */
    style: PropTypes.object,

    /**
     * The TextArea theme.
     */
    theme: PropTypes.oneOf(Util.enumerateValue(Theme)),

    /**
     * Specifies the type of input to display such as "password" or "text".
     */
    type: PropTypes.oneOf(Util.enumerateValue(TextArea.Type)),

    /**
     * The name of the text area.
     */
    name: PropTypes.string,

    /**
     * The label of the text field.
     */
    label: PropTypes.string,

    /**
     * The animate of the text field.
     */
    isLabelAnimate: PropTypes.bool,

    /**
     * The placeholder of the text area.
     */
    placeholder: PropTypes.string,

    /**
     * The value of the text area. Type can be string or number.
     */
    value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),

    /**
     * Use this property to display an icon.
     */
    iconCls: PropTypes.string,

    /**
     * Disables the textField if set to true.
     */
    disabled: PropTypes.bool,

    /**
     * If true,the textField will can't editable.
     */
    readOnly: PropTypes.bool,

    /**
     * If true,the textField will autoFocus.
     */
    autoFocus: PropTypes.bool,

    /**
     * The message of the textField.
     */
    infoMsg: PropTypes.string,

    /**
     * If true,clearButton will display when the textField is not empty.
     */
    clearButtonVisible: PropTypes.bool,

    /**
     * Use this property to display an icon.
     */
    rightIconCls: PropTypes.string,

    /**
     * If true, passwordButton will display.
     */
    passwordButtonVisible: PropTypes.bool,

    autoHeight: PropTypes.bool,

    wordCountVisible: PropTypes.bool,

    // valid
    /**
     * If true,the textField must be required.
     */
    required: PropTypes.bool,

    /**
     * The maximum length of textField to enter.
     */
    maxLength: PropTypes.number,

    /**
     * Maximum number of textField that can be entered.
     */
    max: PropTypes.number,

    /**
     * Minimum number of textField that can be entered.
     */
    min: PropTypes.number,

    /**
     * The matching rule of textField.
     */
    pattern: PropTypes.object,

    /**
     * The invalid message of textField.
     */
    patternInvalidMsg: PropTypes.string,

    fieldMsgVisible: PropTypes.bool,

    /**
     * Callback function fired when the textField is changed.
     */
    onChange: PropTypes.func,

    /**
     * Callback function fired when the press enter.
     */
    onPressEnter: PropTypes.func,

    /**
     * Callback function fired when textField valid.
     */
    onValid: PropTypes.func,

    /**
     * Callback function fired when textField invalid.
     */
    onInvalid: PropTypes.func,

    /**
     * Callback function fired when textField focus.
     */
    onFocus: PropTypes.func,

    /**
     * Callback function fired when textField blur.
     */
    onBlur: PropTypes.func,

    /**
     * Callback function fired when textField clear.
     */
    onClear: PropTypes.func,

    /**
     * Callback function fired when password visible.
     */
    onPasswordVisible: PropTypes.func,

    /**
     * Callback function fired when password invisible.
     */
    onPasswordInvisible: PropTypes.func,

    onIconTouchTap: PropTypes.func,
    onRightIconTouchTap: PropTypes.func,

    onMouseOver: PropTypes.func,
    onMouseOut: PropTypes.func

};

MaterialTextArea.defaultProps = {

    className: '',
    style: null,
    theme: Theme.DEFAULT,

    type: 'text',
    name: '',
    label: '',
    isLabelAnimate: true,
    placeholder: '',
    value: '',
    iconCls: '',
    rightIconCls: '',
    disabled: false,
    readOnly: false,
    autoFocus: false,
    infoMsg: '',
    autoHeight: false,
    wordCountVisible: false,

    clearButtonVisible: false,
    passwordButtonVisible: false,

    // valid
    required: false,
    patternInvalidMsg: '',
    preventInvalidInput: false,

    autoComplete: 'off',
    autoCorrect: 'off',
    autoCapitalize: 'off',
    spellCheck: 'false',

    fieldMsgVisible: false

};<commit_msg>update MaterialTextArea<commit_after>/**
 * @file MaterialTextArea component
 * @author liangxiaojun(liangxiaojun@derbysoft.com)
 */

import React, {Component} from 'react';
import PropTypes from 'prop-types';

import TextArea from '../TextArea';
import MaterialFieldSeparator from '../_MaterialFieldSeparator';
import Theme from '../Theme';

import Util from '../_vendors/Util';

export default class MaterialTextArea extends Component {

    static Type = TextArea.Type;

    constructor(props, ...restArgs) {

        super(props, ...restArgs);

        this.state = {
            value: '',
            isFocus: false,
            isHover: false
        };

        this.triggerFocusHandler = ::this.triggerFocusHandler;
        this.triggerBlurHandler = ::this.triggerBlurHandler;
        this.triggerChangeHandler = ::this.triggerChangeHandler;
        this.triggerMouseOverHandler = ::this.triggerMouseOverHandler;
        this.triggerMouseOutHandler = ::this.triggerMouseOutHandler;

    }

    triggerFocusHandler(...args) {
        this.setState({
            isFocus: true
        }, () => {
            const {onFocus} = this.props;
            onFocus && onFocus(...args);
        });
    }

    triggerBlurHandler(...args) {
        this.setState({
            isFocus: false
        }, () => {
            const {onBlur} = this.props;
            onBlur && onBlur(...args);
        });
    }

    triggerChangeHandler(value) {
        this.setState({
            value
        }, () => {
            const {onChange} = this.props;
            onChange && onChange(value);
        });
    }

    triggerMouseOverHandler(...args) {
        this.setState({
            isHover: true
        }, () => {
            const {onMouseOver} = this.props;
            onMouseOver && onMouseOver(...args);
        });
    }

    triggerMouseOutHandler(...args) {
        this.setState({
            isHover: false
        }, () => {
            const {onMouseOut} = this.props;
            onMouseOut && onMouseOut(...args);
        });
    }

    componentWillReceiveProps(nextProps) {
        if (nextProps.value !== this.state.value) {
            this.setState({
                value: nextProps.value
            });
        }
    }

    componentDidMount() {
        this.setState({
            value: this.props.value
        });
    }

    render() {

        const {
                className, style, theme, label, isLabelAnimate, wordCountVisible,
                ...restProps
            } = this.props,
            {isFocus, isHover, value} = this.state,

            wrapperClassName = (isLabelAnimate ? ' animated' : '') + (label ? ' has-label' : '')
                + (isFocus ? ' focused' : '') + (value ? ' has-value' : '')
                + (wordCountVisible ? ' has-word-count' : '') + (className ? ' ' + className : '');

        return (

                {
                    label ?

                            {label}

                        :
                        null
                }

                <TextArea {...restProps}
                          theme={theme}
                          value={value}
                          wordCountVisible={wordCountVisible}
                          onFocus={this.triggerFocusHandler}
                          onBlur={this.triggerBlurHandler}
                          onMouseOver={this.triggerMouseOverHandler}
                          onMouseOut={this.triggerMouseOutHandler}
                          onChange={this.triggerChangeHandler}/>

                <MaterialFieldSeparator theme={theme}
                                        isHover={isHover}
                                        isFocus={isFocus}/>

        );

    }
};

MaterialTextArea.propTypes = {

    /**
     * The CSS class name of the root element.
     */
    className: PropTypes.string,

    /**
     * Override the styles of the root element.
     */
    style: PropTypes.object,

    /**
     * The TextArea theme.
     */
    theme: PropTypes.oneOf(Util.enumerateValue(Theme)),

    /**
     * Specifies the type of input to display such as "password" or "text".
     */
    type: PropTypes.oneOf(Util.enumerateValue(TextArea.Type)),

    /**
     * The name of the text area.
     */
    name: PropTypes.string,

    /**
     * The label of the text field.
     */
    label: PropTypes.string,

    /**
     * The animate of the text field.
     */
    isLabelAnimate: PropTypes.bool,

    /**
     * The placeholder of the text area.
     */
    placeholder: PropTypes.string,

    /**
     * The value of the text area. Type can be string or number.
     */
    value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),

    /**
     * Use this property to display an icon.
     */
    iconCls: PropTypes.string,

    /**
     * Disables the textField if set to true.
     */
    disabled: PropTypes.bool,

    /**
     * If true,the textField will can't editable.
     */
    readOnly: PropTypes.bool,

    /**
     * If true,the textField will autoFocus.
     */
    autoFocus: PropTypes.bool,

    /**
     * The message of the textField.
     */
    infoMsg: PropTypes.string,

    /**
     * If true,clearButton will display when the textField is not empty.
     */
    clearButtonVisible: PropTypes.bool,

    /**
     * Use this property to display an icon.
     */
    rightIconCls: PropTypes.string,

    /**
     * If true, passwordButton will display.
     */
    passwordButtonVisible: PropTypes.bool,

    autoHeight: PropTypes.bool,

    wordCountVisible: PropTypes.bool,

    // valid
    /**
     * If true,the textField must be required.
     */
    required: PropTypes.bool,

    /**
     * The maximum length of textField to enter.
     */
    maxLength: PropTypes.number,

    /**
     * Maximum number of textField that can be entered.
     */
    max: PropTypes.number,

    /**
     * Minimum number of textField that can be entered.
     */
    min: PropTypes.number,

    /**
     * The matching rule of textField.
     */
    pattern: PropTypes.object,

    /**
     * The invalid message of textField.
     */
    patternInvalidMsg: PropTypes.string,

    fieldMsgVisible: PropTypes.bool,

    /**
     * Callback function fired when the textField is changed.
     */
    onChange: PropTypes.func,

    /**
     * Callback function fired when the press enter.
     */
    onPressEnter: PropTypes.func,

    /**
     * Callback function fired when textField valid.
     */
    onValid: PropTypes.func,

    /**
     * Callback function fired when textField invalid.
     */
    onInvalid: PropTypes.func,

    /**
     * Callback function fired when textField focus.
     */
    onFocus: PropTypes.func,

    /**
     * Callback function fired when textField blur.
     */
    onBlur: PropTypes.func,

    /**
     * Callback function fired when textField clear.
     */
    onClear: PropTypes.func,

    /**
     * Callback function fired when password visible.
     */
    onPasswordVisible: PropTypes.func,

    /**
     * Callback function fired when password invisible.
     */
    onPasswordInvisible: PropTypes.func,

    onIconTouchTap: PropTypes.func,
    onRightIconTouchTap: PropTypes.func,

    onMouseOver: PropTypes.func,
    onMouseOut: PropTypes.func

};

MaterialTextArea.defaultProps = {

    className: '',
    style: null,
    theme: Theme.DEFAULT,

    type: 'text',
    name: '',
    label: '',
    isLabelAnimate: true,
    placeholder: '',
    value: '',
    iconCls: '',
    rightIconCls: '',
    disabled: false,
    readOnly: false,
    autoFocus: false,
    infoMsg: '',
    autoHeight: false,
    wordCountVisible: false,

    clearButtonVisible: false,
    passwordButtonVisible: false,

    // valid
    required: false,
    patternInvalidMsg: '',
    preventInvalidInput: false,

    fieldMsgVisible: false

};<|endoftext|>


<commit_before>// ==UserScript==
// @name         Fastmail Interceptor
// @namespace    http://your.homepage/
// @version      0.1
// @description  enter something useful
// @author       You
// @match        https://www.fastmail.com/*
// @grant        none
// ==/UserScript==
"permissions": [
  "https://*.keybase.io",
  "http://*.keybase.io",
  "http://keybase.io"
]
var oldXMLHttpRequest = XMLHttpRequest;
XMLHttpRequest = function() {
  var request = new oldXMLHttpRequest();
  var facade = {
    addEventListener: function(type, listener) {
      return request.addEventListener(type, listener);
    },
    setRequestHeader: function() {
      return request.setRequestHeader.apply(request, arguments);
    },
    getAllResponseHeaders: function() {
      return request.getAllResponseHeaders.apply(request, arguments);
    },
    getResponseHeader: function() {
      return request.getResponseHeader.apply(request, arguments);
    },
    abort: function() {
      return request.abort.apply(request, arguments);
    },
    open: function(method, url, async, user, password) {
      facade.__url = url;
      request.open(method, url, async, user, password);
    },
    send: function(data) {
      request.onreadystatechange = function(event) {
        facade.readyState = request.readyState;
        facade.status = request.status;
        //                facade.response = request.response;
        if (request.responseText) {
          facade.responseText = transform(request.responseText);
        }
        facade.responseType = request.responseType;
        if (facade.onreadystatechange) {
          return facade.onreadystatechange(event);
        }
      };
      return request.send(data);
    }
  };
  return facade;
};

//Components.utils.import("resource://app/window.openpgp");

var transform = function(data) {
  var resp = JSON.parse(data);
  for (var i = resp.length; i--;) {
    if (resp[i][0] === "messageDetails") {
      var detailsList = resp[i][1].detailsList;
      for (var j = detailsList.length; j--;) {
        detailsList[j].body = decrypt(detailsList[j].body);
      }
    }
  }
  return JSON.stringify(resp);
};

var decrypt = function(s) {
    var openpgp = require('openpgp');

    var options = {
      numBits: 2048,
      userId: 'Jon Smith <jon.smith@example.org>',
      passphrase: 'super long and hard to guess secret'
    };

    openpgp.generateKeyPair(options).then(function(keypair) {
      // success
      var privkey = keypair.privateKeyArmored;
      var pubkey = keypair.publicKeyArmored;
    }).catch(function(error) {
      // failure
    });

    var keypair = openpgp.generateKeyPair(1, 1024, "testUser");
    var privKeys = openpgp.key.readArmored(keypair.privateKeyArmored);
    var publicKeys = openpgp.key.readArmored(keypair.publicKeyArmored);
    var privKey = privKeys.keys[0];
    var pubKey = publicKeys.keys[0];
    privKey.decrypt();
    var clearSignedArmor = openpgp.signClearMessage(privKey, "test text");
    console.log("clearSignedArmor " + clearSignedArmor);
    console.log("verify " + openpgp.verifyClearSignedMessage([pubKey], clearSignedArmor));

    /*var options = {
      numBits: 2048,
      function generateTrueUser = (user) {
        var keybaseCaller = new XMLHttpRequest();
        keybaseCaller("GET", chrome.extension.getURL('https://keybase.io/_/api/1.0/user/lookup.json' + 'user'), true);
        keybaseCaller.onreadystatechange = function(){
        if (keybaseCaller.readyState == 4){
        var resp = JSON.parse(keybaseCaller.responseText);
      }
      }
        keybaseCaller.send();
        )
        var actualUser = them.username;
      }
      userId: actualUser,
      passphrase: password,
    };
*/

    //Decrypting the body.
    var openpgp = require('openpgp');
    var key = '-----BEGIN PGP PRIVATE KEY BLOCK ... END PGP PRIVATE KEY BLOCK-----';
    var privateKey = openpgp.key.readArmored(key).keys[0];
    privateKey.decrypt('passphrase');

    var pgpMessage = '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----';
    pgpMessage = openpgp.message.readArmored(pgpMessage);

    return openpgp.decryptMessage(privateKey, pgpMessage).then(function(plaintext) {
      // success
    }).catch(function(error) {
      // failure
    });
  }
  /*
  var oldWindowEventSource = window.EventSource;
  window.EventSource = function(url) {
      console.log(url);
      var source = new oldWindowEventSource(url);
      return {
          addEventListener: function(n, f, b) {
              source.addEventListener(n, new function(e) {
                  console.log(arguments);
              }, b);
          }
      };
  };
  */
<commit_msg>Updating permissions request as well as the encryption function.<commit_after>// ==UserScript==
// @name         Fastmail Interceptor
// @namespace    http://your.homepage/
// @version      0.1
// @description  enter something useful
// @author       You
// @match        https://www.fastmail.com/*
// @grant        none
// ==/UserScript==
chrome.permissions.request({
  permissions: [
  "https://*.keybase.io",
  "http://*.keybase.io",
  "http://keybase.io"
]});
var oldXMLHttpRequest = XMLHttpRequest;
XMLHttpRequest = function() {
  var request = new oldXMLHttpRequest();
  var facade = {
    addEventListener: function(type, listener) {
      return request.addEventListener(type, listener);
    },
    setRequestHeader: function() {
      return request.setRequestHeader.apply(request, arguments);
    },
    getAllResponseHeaders: function() {
      return request.getAllResponseHeaders.apply(request, arguments);
    },
    getResponseHeader: function() {
      return request.getResponseHeader.apply(request, arguments);
    },
    abort: function() {
      return request.abort.apply(request, arguments);
    },
    open: function(method, url, async, user, password) {
      facade.__url = url;
      request.open(method, url, async, user, password);
    },
    send: function(data) {
      request.onreadystatechange = function(event) {
        facade.readyState = request.readyState;
        facade.status = request.status;
        //                facade.response = request.response;
        if (request.responseText) {
          facade.responseText = transform(request.responseText);
        }
        facade.responseType = request.responseType;
        if (facade.onreadystatechange) {
          return facade.onreadystatechange(event);
        }
      };
      return request.send(data);
    }
  };
  return facade;
};

//Components.utils.import("resource://app/window.openpgp");

var transform = function(data) {
  var resp = JSON.parse(data);
  for (var i = resp.length; i--;) {
    if (resp[i][0] === "messageDetails") {
      var detailsList = resp[i][1].detailsList;
      for (var j = detailsList.length; j--;) {
        detailsList[j].body = decrypt(detailsList[j].body);
      }
    }
  }
  return JSON.stringify(resp);
};

var decrypt = function(s) {
    var openpgp = require('openpgp');

    var options = {
      numBits: 2048,
      userId: 'Jon Smith <jon.smith@example.org>',
      passphrase: 'super long and hard to guess secret'
    };

    openpgp.generateKeyPair(options).then(function(keypair) {
      // success
      var privkey = keypair.privateKeyArmored;
      var pubkey = keypair.publicKeyArmored;
    }).catch(function(error) {
      // failure
    });

    var keypair = openpgp.generateKeyPair(1, 1024, "testUser");
    var privKeys = openpgp.key.readArmored(keypair.privateKeyArmored);
    var publicKeys = openpgp.key.readArmored(keypair.publicKeyArmored);
    var privKey = privKeys.keys[0];
    var pubKey = publicKeys.keys[0];
    privKey.decrypt();
    var clearSignedArmor = openpgp.signClearMessage(privKey, "test text");
    openpgp.encryptMessage(publicKey.keys, 'body').then(function(pgpMessage));
    console.log("clearSignedArmor " + clearSignedArmor);
    console.log("verify " + openpgp.verifyClearSignedMessage([pubKey], clearSignedArmor));

    /*var options = {
      numBits: 2048,
      function generateTrueUser = (user) {
        var keybaseCaller = new XMLHttpRequest();
        keybaseCaller("GET", chrome.extension.getURL('https://keybase.io/_/api/1.0/user/lookup.json' + 'user'), true);
        keybaseCaller.onreadystatechange = function(){
        if (keybaseCaller.readyState == 4){
        var resp = JSON.parse(keybaseCaller.responseText);
      }
      }
        keybaseCaller.send();
        )
        var actualUser = them.username;
      }
      userId: actualUser,
      passphrase: password,
    };
*/

    //Decrypting the body.
    var openpgp = require('openpgp');
    var key = '-----BEGIN PGP PRIVATE KEY BLOCK ... END PGP PRIVATE KEY BLOCK-----';
    var privateKey = openpgp.key.readArmored(key).keys[0];
    privateKey.decrypt('passphrase');

    var pgpMessage = '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----';
    pgpMessage = openpgp.message.readArmored(pgpMessage);

    return openpgp.decryptMessage(privateKey, pgpMessage).then(function(plaintext) {
      // success
    }).catch(function(error) {
      // failure
    });
  }
  /*
  var oldWindowEventSource = window.EventSource;
  window.EventSource = function(url) {
      console.log(url);
      var source = new oldWindowEventSource(url);
      return {
          addEventListener: function(n, f, b) {
              source.addEventListener(n, new function(e) {
                  console.log(arguments);
              }, b);
          }
      };
  };
  */
<|endoftext|>


<commit_before>/*! echo.js v1.7.0 | (c) 2015 @toddmotto | https://github.com/toddmotto/echo */
/* modified for use with lazyloading resrc images */
(function (root, factory) {
	if (typeof define === 'function' && define.amd) {
		define(function() {
			return factory(root);
		});
	} else if (typeof exports === 'object') {
		module.exports = factory;
	} else {
		root.echo = factory(root);
	}
})(this, function (root) {

	'use strict';

	var echo = {};

	var callback = function () {};

	var offset, poll, delay, useDebounce, unload, selector;

	var inView = function (element, view) {
		var box = element.getBoundingClientRect();
		return (box.right >= view.l && box.bottom >= view.t && box.left <= view.r && box.top <= view.b);
	};

	var debounceOrThrottle = function () {
		if(!useDebounce && !!poll) {
			return;
		}
		clearTimeout(poll);
		poll = setTimeout(function(){
			echo.render();
			poll = null;
		}, delay);
	};

	echo.init = function (opts) {
		opts = opts || {};
		var offsetAll = opts.offset || 0;
		var offsetVertical = opts.offsetVertical || offsetAll;
		var offsetHorizontal = opts.offsetHorizontal || offsetAll;
		var optionToInt = function (opt, fallback) {
			return parseInt(opt || fallback, 10);
		};
		offset = {
			t: optionToInt(opts.offsetTop, offsetVertical),
			b: optionToInt(opts.offsetBottom, offsetVertical),
			l: optionToInt(opts.offsetLeft, offsetHorizontal),
			r: optionToInt(opts.offsetRight, offsetHorizontal)
		};
		delay = optionToInt(opts.throttle, 250);
		useDebounce = opts.debounce !== false;
		unload = !!opts.unload;
		callback = opts.callback || callback;
		selector = opts.selector || 'data-src';
		echo.render();
		if (document.addEventListener) {
			root.addEventListener('scroll', debounceOrThrottle, false);
			root.addEventListener('load', debounceOrThrottle, false);
		} else {
			root.attachEvent('onscroll', debounceOrThrottle);
			root.attachEvent('onload', debounceOrThrottle);
		}
	};

	echo.render = function () {
		var nodes = document.querySelectorAll('img['+selector+'], [data-src-background]');
		var length = nodes.length;
		var src, elem;
		var view = {
			l: 0 - offset.l,
			t: 0 - offset.t,
			b: (root.innerHeight || document.documentElement.clientHeight) + offset.b,
			r: (root.innerWidth || document.documentElement.clientWidth) + offset.r
		};
		for (var i = 0; i < length; i++) {
			elem = nodes[i];
			if (inView(elem, view)) {

				if (unload) {
					elem.setAttribute(selector+'-placeholder', elem.src);
				}

				if (elem.getAttribute('data-src-background') !== null) {
					elem.style.backgroundImage = 'url(' + elem.getAttribute('data-src-background') + ')';
				}
				else {
					if(elem.classList.contains('resrc-lazy') === false) { // If there is no resrc, do normal echo stuff
						elem.src = elem.getAttribute('data-src');
					}
				}

				if (!unload) {
					if(elem.classList.contains('resrc-lazy') === false) { // If there is no resrc, do normal echo stuff
						elem.removeAttribute('data-src');
						elem.removeAttribute('data-src-background');
					}
				}

				callback(elem, 'load');
			}
			else if (unload && !!(src = elem.getAttribute(selector+'-placeholder'))) {

				if (elem.getAttribute('data-src-background') !== null) {
					elem.style.backgroundImage = 'url(' + src + ')';
				}
				else {
					elem.src = src;
				}

				if(elem.classList.contains('resrc-lazy') === false) { // If there is no resrc, do normal echo stuffelem.src = src;
					elem.removeAttribute(selector+'-placeholder');
				}
				callback(elem, 'unload');
			}
		}
		if (!length) {
			echo.detach();
		}
	};

	echo.detach = function () {
		if (document.removeEventListener) {
			root.removeEventListener('scroll', debounceOrThrottle);
		} else {
			root.detachEvent('onscroll', debounceOrThrottle);
		}
		clearTimeout(poll);
	};

	return echo;

});
<commit_msg>Fix handling of hidden images (echo.js).<commit_after>/*! echo.js v1.7.0 | (c) 2015 @toddmotto | https://github.com/toddmotto/echo */
/* modified for use with lazyloading resrc images */
(function (root, factory) {
	if (typeof define === 'function' && define.amd) {
		define(function() {
			return factory(root);
		});
	} else if (typeof exports === 'object') {
		module.exports = factory;
	} else {
		root.echo = factory(root);
	}
})(this, function (root) {

	'use strict';

	var echo = {};

	var callback = function () {};

	var offset, poll, delay, useDebounce, unload, selector;

	var isHidden = function (element) {
		return (element.offsetParent === null);
	};

	var inView = function (element, view) {
		if (isHidden(element)) {
			return false;
		}

		var box = element.getBoundingClientRect();
		return (box.right >= view.l && box.bottom >= view.t && box.left <= view.r && box.top <= view.b);
	};

	var debounceOrThrottle = function () {
		if(!useDebounce && !!poll) {
			return;
		}
		clearTimeout(poll);
		poll = setTimeout(function(){
			echo.render();
			poll = null;
		}, delay);
	};

	echo.init = function (opts) {
		opts = opts || {};
		var offsetAll = opts.offset || 0;
		var offsetVertical = opts.offsetVertical || offsetAll;
		var offsetHorizontal = opts.offsetHorizontal || offsetAll;
		var optionToInt = function (opt, fallback) {
			return parseInt(opt || fallback, 10);
		};
		offset = {
			t: optionToInt(opts.offsetTop, offsetVertical),
			b: optionToInt(opts.offsetBottom, offsetVertical),
			l: optionToInt(opts.offsetLeft, offsetHorizontal),
			r: optionToInt(opts.offsetRight, offsetHorizontal)
		};
		delay = optionToInt(opts.throttle, 250);
		useDebounce = opts.debounce !== false;
		unload = !!opts.unload;
		callback = opts.callback || callback;
		selector = opts.selector || 'data-src';
		echo.render();
		if (document.addEventListener) {
			root.addEventListener('scroll', debounceOrThrottle, false);
			root.addEventListener('load', debounceOrThrottle, false);
		} else {
			root.attachEvent('onscroll', debounceOrThrottle);
			root.attachEvent('onload', debounceOrThrottle);
		}
	};

	echo.render = function () {
		var nodes = document.querySelectorAll('img['+selector+'], [data-src-background]');
		var length = nodes.length;
		var src, elem;
		var view = {
			l: 0 - offset.l,
			t: 0 - offset.t,
			b: (root.innerHeight || document.documentElement.clientHeight) + offset.b,
			r: (root.innerWidth || document.documentElement.clientWidth) + offset.r
		};
		for (var i = 0; i < length; i++) {
			elem = nodes[i];
			if (inView(elem, view)) {

				if (unload) {
					elem.setAttribute(selector+'-placeholder', elem.src);
				}

				if (elem.getAttribute('data-src-background') !== null) {
					elem.style.backgroundImage = 'url(' + elem.getAttribute('data-src-background') + ')';
				}
				else {
					if(elem.classList.contains('resrc-lazy') === false) { // If there is no resrc, do normal echo stuff
						elem.src = elem.getAttribute('data-src');
					}
				}

				if (!unload) {
					if(elem.classList.contains('resrc-lazy') === false) { // If there is no resrc, do normal echo stuff
						elem.removeAttribute('data-src');
						elem.removeAttribute('data-src-background');
					}
				}

				callback(elem, 'load');
			}
			else if (unload && !!(src = elem.getAttribute(selector+'-placeholder'))) {

				if (elem.getAttribute('data-src-background') !== null) {
					elem.style.backgroundImage = 'url(' + src + ')';
				}
				else {
					elem.src = src;
				}

				if(elem.classList.contains('resrc-lazy') === false) { // If there is no resrc, do normal echo stuffelem.src = src;
					elem.removeAttribute(selector+'-placeholder');
				}
				callback(elem, 'unload');
			}
		}
		if (!length) {
			echo.detach();
		}
	};

	echo.detach = function () {
		if (document.removeEventListener) {
			root.removeEventListener('scroll', debounceOrThrottle);
		} else {
			root.detachEvent('onscroll', debounceOrThrottle);
		}
		clearTimeout(poll);
	};

	return echo;

});
<|endoftext|>


<commit_before>// @flow

import hslToRgb from '../internalHelpers/_hslToRgb'
import nameToHex from '../internalHelpers/_nameToHex'
import type { RgbColor, RgbaColor } from '../types/color'

const hexRegex = /^#[a-fA-F0-9]{6}$/
const reducedHexRegex = /^#[a-fA-F0-9]{3}$/
const rgbRegex = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/
const rgbaRegex = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/
const hslRegex = /^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/
const hslaRegex = /^hsla\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/

/**
 * Returns an RgbColor or RgbaColor object. This utility function is only useful
 * if want to extract a color component. With the color util `toColorString` you
 * can convert a RgbColor or RgbaColor object back to a string.
 *
 * @example
 * // Assigns `{ red: 255, green: 0, blue: 0 }` to color1
 * const color1 = 'rgb(255, 0, 0)';
 * // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
 * const color2 = 'hsla(210, 10%, 40%, 0.75)';
 */
function parseToRgb(color: string): RgbColor | RgbaColor {
  if (typeof color !== 'string') throw new Error('Passed an incorrect argument to a color function, please pass a string representation of a color.')
  const normalizedColor = nameToHex(color)
  if (normalizedColor.match(hexRegex)) {
    return {
      red: parseInt(`${normalizedColor[1]}${normalizedColor[2]}`, 16),
      green: parseInt(`${normalizedColor[3]}${normalizedColor[4]}`, 16),
      blue: parseInt(`${normalizedColor[5]}${normalizedColor[6]}`, 16),
    }
  }
  if (normalizedColor.match(reducedHexRegex)) {
    return {
      red: parseInt(`${normalizedColor[1]}${normalizedColor[1]}`, 16),
      green: parseInt(`${normalizedColor[2]}${normalizedColor[2]}`, 16),
      blue: parseInt(`${normalizedColor[3]}${normalizedColor[3]}`, 16),
    }
  }
  const rgbMatched = rgbRegex.exec(normalizedColor)
  if (rgbMatched) {
    return {
      red: parseInt(`${rgbMatched[1]}`, 10),
      green: parseInt(`${rgbMatched[2]}`, 10),
      blue: parseInt(`${rgbMatched[3]}`, 10),
    }
  }
  const rgbaMatched = rgbaRegex.exec(normalizedColor)
  if (rgbaMatched) {
    return {
      red: parseInt(`${rgbaMatched[1]}`, 10),
      green: parseInt(`${rgbaMatched[2]}`, 10),
      blue: parseInt(`${rgbaMatched[3]}`, 10),
      alpha: parseFloat(`${rgbaMatched[4]}`, 10),
    }
  }
  const hslMatched = hslRegex.exec(normalizedColor)
  if (hslMatched) {
    const hue = parseInt(`${hslMatched[1]}`, 10)
    const saturation = parseInt(`${hslMatched[2]}`, 10) / 100
    const lightness = parseInt(`${hslMatched[3]}`, 10) / 100
    const rgbColorString = `rgb(${hslToRgb(hue, saturation, lightness)})`
    const hslRgbMatched = rgbRegex.exec(rgbColorString)
    return {
      red: parseInt(`${hslRgbMatched[1]}`, 10),
      green: parseInt(`${hslRgbMatched[2]}`, 10),
      blue: parseInt(`${hslRgbMatched[3]}`, 10),
    }
  }
  const hslaMatched = hslaRegex.exec(normalizedColor)
  if (hslaMatched) {
    const hue = parseInt(`${hslaMatched[1]}`, 10)
    const saturation = parseInt(`${hslaMatched[2]}`, 10) / 100
    const lightness = parseInt(`${hslaMatched[3]}`, 10) / 100
    const rgbColorString = `rgb(${hslToRgb(hue, saturation, lightness)})`
    const hslRgbMatched = rgbRegex.exec(rgbColorString)
    return {
      red: parseInt(`${hslRgbMatched[1]}`, 10),
      green: parseInt(`${hslRgbMatched[2]}`, 10),
      blue: parseInt(`${hslRgbMatched[3]}`, 10),
      alpha: parseFloat(`${hslaMatched[4]}`, 10),
    }
  }
  throw new Error('Couldn\'t parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.')
}

export default parseToRgb
<commit_msg>chore(Color): Remove unused argument from 'parseFloat'. (#219)<commit_after>// @flow

import hslToRgb from '../internalHelpers/_hslToRgb'
import nameToHex from '../internalHelpers/_nameToHex'
import type { RgbColor, RgbaColor } from '../types/color'

const hexRegex = /^#[a-fA-F0-9]{6}$/
const reducedHexRegex = /^#[a-fA-F0-9]{3}$/
const rgbRegex = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/
const rgbaRegex = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/
const hslRegex = /^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/
const hslaRegex = /^hsla\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/

/**
 * Returns an RgbColor or RgbaColor object. This utility function is only useful
 * if want to extract a color component. With the color util `toColorString` you
 * can convert a RgbColor or RgbaColor object back to a string.
 *
 * @example
 * // Assigns `{ red: 255, green: 0, blue: 0 }` to color1
 * const color1 = 'rgb(255, 0, 0)';
 * // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
 * const color2 = 'hsla(210, 10%, 40%, 0.75)';
 */
function parseToRgb(color: string): RgbColor | RgbaColor {
  if (typeof color !== 'string') throw new Error('Passed an incorrect argument to a color function, please pass a string representation of a color.')
  const normalizedColor = nameToHex(color)
  if (normalizedColor.match(hexRegex)) {
    return {
      red: parseInt(`${normalizedColor[1]}${normalizedColor[2]}`, 16),
      green: parseInt(`${normalizedColor[3]}${normalizedColor[4]}`, 16),
      blue: parseInt(`${normalizedColor[5]}${normalizedColor[6]}`, 16),
    }
  }
  if (normalizedColor.match(reducedHexRegex)) {
    return {
      red: parseInt(`${normalizedColor[1]}${normalizedColor[1]}`, 16),
      green: parseInt(`${normalizedColor[2]}${normalizedColor[2]}`, 16),
      blue: parseInt(`${normalizedColor[3]}${normalizedColor[3]}`, 16),
    }
  }
  const rgbMatched = rgbRegex.exec(normalizedColor)
  if (rgbMatched) {
    return {
      red: parseInt(`${rgbMatched[1]}`, 10),
      green: parseInt(`${rgbMatched[2]}`, 10),
      blue: parseInt(`${rgbMatched[3]}`, 10),
    }
  }
  const rgbaMatched = rgbaRegex.exec(normalizedColor)
  if (rgbaMatched) {
    return {
      red: parseInt(`${rgbaMatched[1]}`, 10),
      green: parseInt(`${rgbaMatched[2]}`, 10),
      blue: parseInt(`${rgbaMatched[3]}`, 10),
      alpha: parseFloat(`${rgbaMatched[4]}`),
    }
  }
  const hslMatched = hslRegex.exec(normalizedColor)
  if (hslMatched) {
    const hue = parseInt(`${hslMatched[1]}`, 10)
    const saturation = parseInt(`${hslMatched[2]}`, 10) / 100
    const lightness = parseInt(`${hslMatched[3]}`, 10) / 100
    const rgbColorString = `rgb(${hslToRgb(hue, saturation, lightness)})`
    const hslRgbMatched = rgbRegex.exec(rgbColorString)
    return {
      red: parseInt(`${hslRgbMatched[1]}`, 10),
      green: parseInt(`${hslRgbMatched[2]}`, 10),
      blue: parseInt(`${hslRgbMatched[3]}`, 10),
    }
  }
  const hslaMatched = hslaRegex.exec(normalizedColor)
  if (hslaMatched) {
    const hue = parseInt(`${hslaMatched[1]}`, 10)
    const saturation = parseInt(`${hslaMatched[2]}`, 10) / 100
    const lightness = parseInt(`${hslaMatched[3]}`, 10) / 100
    const rgbColorString = `rgb(${hslToRgb(hue, saturation, lightness)})`
    const hslRgbMatched = rgbRegex.exec(rgbColorString)
    return {
      red: parseInt(`${hslRgbMatched[1]}`, 10),
      green: parseInt(`${hslRgbMatched[2]}`, 10),
      blue: parseInt(`${hslRgbMatched[3]}`, 10),
      alpha: parseFloat(`${hslaMatched[4]}`),
    }
  }
  throw new Error('Couldn\'t parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.')
}

export default parseToRgb
<|endoftext|>


<commit_before>/**
 * Copyright (c) 2013-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 * @flow
 * @providesModule GraphQLCompilerPublic
 * @format
 */

'use strict';

const ASTConvert = require('ASTConvert');
const AutoAliasTransform = require('AutoAliasTransform');
const CodegenDirectory = require('CodegenDirectory');
const CodegenRunner = require('RelayCodegenRunner');
const FileParser = require('FileParser');
const FilterDirectivesTransform = require('FilterDirectivesTransform');
const GraphQLFileParser = require('GraphQLFileParser');
const GraphQLIRTransforms = require('GraphQLIRTransforms');
const GraphQLTextParser = require('GraphQLTextParser');
const GraphQLValidator = require('GraphQLValidator');
const RelayCompiler = require('RelayCompiler');
const RelayCompilerContext = require('RelayCompilerContext');
const RelayConsoleReporter = require('RelayConsoleReporter');
const RelayFlattenTransform = require('RelayFlattenTransform');
const RelayIRTransformer = require('RelayIRTransformer');
const RelayIRVisitor = require('RelayIRVisitor');
const RelayMultiReporter = require('RelayMultiReporter');
const RelayParser = require('RelayParser');
const RelayPrinter = require('RelayPrinter');
const SkipClientFieldTransform = require('SkipClientFieldTransform');
const SkipRedundantNodesTransform = require('SkipRedundantNodesTransform');
const SkipUnreachableNodeTransform = require('SkipUnreachableNodeTransform');
const StripUnusedVariablesTransform = require('StripUnusedVariablesTransform');

const filterContextForNode = require('filterContextForNode');
const getIdentifierForRelayArgumentValue = require('getIdentifierForRelayArgumentValue');

export type {
  CompiledNode,
  CompiledDocumentMap,
  CompilerTransforms,
} from 'RelayCompiler';
export type {File, FileWriterInterface, CompileResult} from 'RelayCodegenTypes';
export type {FileFilter, WatchmanExpression} from 'RelayCodegenWatcher';
export type {IRTransform} from 'GraphQLIRTransforms';
export type {FlattenOptions} from 'RelayFlattenTransform';
export type {
  Argument,
  ArgumentDefinition,
  ArgumentValue,
  Condition,
  Directive,
  Field,
  Fragment,
  FragmentSpread,
  IR,
  RootArgumentDefinition,
  InlineFragment,
  Handle,
  LinkedField,
  ListValue,
  Literal,
  LocalArgumentDefinition,
  Node,
  ObjectFieldValue,
  ObjectValue,
  Root,
  ScalarFieldType,
  ScalarField,
  Selection,
  Variable,
} from 'RelayIR';

module.exports = {
  ASTConvert: ASTConvert,
  CodegenDirectory: CodegenDirectory,
  CodegenRunner: CodegenRunner,
  Compiler: RelayCompiler,
  CompilerContext: RelayCompilerContext,
  ConsoleReporter: RelayConsoleReporter,
  FileParser: FileParser,
  filterContextForNode: filterContextForNode,
  GraphQLFileParser: GraphQLFileParser,
  GraphQLIRTransforms: GraphQLIRTransforms,
  getIdentifierForRelayArgumentValue: getIdentifierForRelayArgumentValue,
  GraphQLTextParser: GraphQLTextParser,
  GraphQLValidator: GraphQLValidator,
  IRTransformer: RelayIRTransformer,
  IRVisitor: RelayIRVisitor,
  MultiReporter: RelayMultiReporter,
  RelayParser: RelayParser,
  Printer: RelayPrinter,

  AutoAliasTransform: AutoAliasTransform,
  FilterDirectivesTransform: FilterDirectivesTransform,
  FlattenTransform: RelayFlattenTransform,
  SkipClientFieldTransform: SkipClientFieldTransform,
  SkipRedundantNodesTransform: SkipRedundantNodesTransform,
  SkipUnreachableNodeTransform: SkipUnreachableNodeTransform,
  StripUnusedVariablesTransform: StripUnusedVariablesTransform,
};
<commit_msg>Make GraphQLCompilerPublic Common-JS style<commit_after>/**
 * Copyright (c) 2013-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 * @flow
 * @providesModule GraphQLCompilerPublic
 * @format
 */

'use strict';

const ASTConvert = require('./core/ASTConvert');
const AutoAliasTransform = require('./transforms/AutoAliasTransform');
const CodegenDirectory = require('./codegen/CodegenDirectory');
const CodegenRunner = require('./codegen/RelayCodegenRunner');
const FileParser = require('./core/FileParser');
const FilterDirectivesTransform = require('./transforms/FilterDirectivesTransform');
const GraphQLFileParser = require('./core/GraphQLFileParser');
const GraphQLIRTransforms = require('./core/GraphQLIRTransforms');
const GraphQLTextParser = require('./core/GraphQLTextParser');
const GraphQLValidator = require('./core/GraphQLValidator');
const RelayCompiler = require('./core/RelayCompiler');
const RelayCompilerContext = require('./core/RelayCompilerContext');
const RelayConsoleReporter = require('./reporters/RelayConsoleReporter');
const RelayFlattenTransform = require('./transforms/RelayFlattenTransform');
const RelayIRTransformer = require('./core/RelayIRTransformer');
const RelayIRVisitor = require('./core/RelayIRVisitor');
const RelayMultiReporter = require('./reporters/RelayMultiReporter');
const RelayParser = require('./core/RelayParser');
const RelayPrinter = require('./core/RelayPrinter');
const SkipClientFieldTransform = require('./transforms/SkipClientFieldTransform');
const SkipRedundantNodesTransform = require('./transforms/SkipRedundantNodesTransform');
const SkipUnreachableNodeTransform = require('./transforms/SkipUnreachableNodeTransform');
const StripUnusedVariablesTransform = require('./transforms/StripUnusedVariablesTransform');

const filterContextForNode = require('./core/filterContextForNode');
const getIdentifierForRelayArgumentValue = require('./core/getIdentifierForRelayArgumentValue');

export type {
  CompiledNode,
  CompiledDocumentMap,
  CompilerTransforms,
} from './core/RelayCompiler';
export type {
  File,
  FileWriterInterface,
  CompileResult,
} from './codegen/RelayCodegenTypes';
export type {
  FileFilter,
  WatchmanExpression,
} from './codegen/RelayCodegenWatcher';
export type {IRTransform} from './core/GraphQLIRTransforms';
export type {FlattenOptions} from './transforms/RelayFlattenTransform';
export type {
  Argument,
  ArgumentDefinition,
  ArgumentValue,
  Condition,
  Directive,
  Field,
  Fragment,
  FragmentSpread,
  IR,
  RootArgumentDefinition,
  InlineFragment,
  Handle,
  LinkedField,
  ListValue,
  Literal,
  LocalArgumentDefinition,
  Node,
  ObjectFieldValue,
  ObjectValue,
  Root,
  ScalarFieldType,
  ScalarField,
  Selection,
  Variable,
} from './core/RelayIR';

module.exports = {
  ASTConvert: ASTConvert,
  CodegenDirectory: CodegenDirectory,
  CodegenRunner: CodegenRunner,
  Compiler: RelayCompiler,
  CompilerContext: RelayCompilerContext,
  ConsoleReporter: RelayConsoleReporter,
  FileParser: FileParser,
  filterContextForNode: filterContextForNode,
  GraphQLFileParser: GraphQLFileParser,
  GraphQLIRTransforms: GraphQLIRTransforms,
  getIdentifierForRelayArgumentValue: getIdentifierForRelayArgumentValue,
  GraphQLTextParser: GraphQLTextParser,
  GraphQLValidator: GraphQLValidator,
  IRTransformer: RelayIRTransformer,
  IRVisitor: RelayIRVisitor,
  MultiReporter: RelayMultiReporter,
  RelayParser: RelayParser,
  Printer: RelayPrinter,

  AutoAliasTransform: AutoAliasTransform,
  FilterDirectivesTransform: FilterDirectivesTransform,
  FlattenTransform: RelayFlattenTransform,
  SkipClientFieldTransform: SkipClientFieldTransform,
  SkipRedundantNodesTransform: SkipRedundantNodesTransform,
  SkipUnreachableNodeTransform: SkipUnreachableNodeTransform,
  StripUnusedVariablesTransform: StripUnusedVariablesTransform,
};
<|endoftext|>


<commit_before>"use strict";

module.exports = function (t) {
    return {
        "name": "OAuthClientApplication",
        "base": "Application",
        "properties": {
            "id": {
                "type": String
            },
            "clientType": {
                "type": String // enum ["public", "confidential"]
            },
            "redirectURIs": t.JSON, // [String]
            "tokenEndpointAuthMethod": {
                "type": String // ["none", "client_secret_post", "client_secret_basic"]
            },
            "grantTypes": t.JSON,   // {Array} enum ["authorization_code", "implicit", "client_credentials",
                                    // "password", "urn:ietf:params:oauth:grant-type:jwt-bearer",
                                    // "urn:ietf:params:oauth:grant-type:saml2-bearer"]
            "responseTypes": t.JSON, // {Array} enum ["code", "token"]
            "tokenType": String, // enum ["bearer", "jwt", "mac"]
            "clientSecret": String,
            "clientName": String,
            "clientURI": String,
            "logoURI": String,
            "scopes": t.JSON,
            "contacts": t.JSON,
            "tosURI": String,
            "policyURI": String,
            "jwksURI": String,
            "jwks": {
                "type": t.JSON
                //"mysql": {
                //    "dataLength": 4096,
                //    "dataType": "TEXT"
                //}
            },
            "softwareId": String,
            "softwareVersion": String,

            "callbackUrls": t.JSON,
            "permissions": t.JSON,
            "authenticationEnabled": t.JSON,
            "anonymousAllowed": t.JSON,
            "authenticationSchemes": t.JSON,
            "icon": t.JSON,
            "url": t.JSON
        },
        "comments": "https://tools.ietf.org/html/draft-ietf-oauth-dyn-reg-24"
    }
};<commit_msg>update jwks types<commit_after>"use strict";

module.exports = function (t) {
    return {
        "name": "OAuthClientApplication",
        "base": "Application",
        "properties": {
            "id": {
                "type": String
            },
            "clientType": {
                "type": String // enum ["public", "confidential"]
            },
            "redirectURIs": t.JSON, // [String]
            "tokenEndpointAuthMethod": {
                "type": String // ["none", "client_secret_post", "client_secret_basic"]
            },
            "grantTypes": t.JSON,   // {Array} enum ["authorization_code", "implicit", "client_credentials",
                                    // "password", "urn:ietf:params:oauth:grant-type:jwt-bearer",
                                    // "urn:ietf:params:oauth:grant-type:saml2-bearer"]
            "responseTypes": t.JSON, // {Array} enum ["code", "token"]
            "tokenType": String, // enum ["bearer", "jwt", "mac"]
            "clientSecret": String,
            "clientName": String,
            "clientURI": String,
            "logoURI": String,
            "scopes": t.JSON,
            "contacts": t.JSON,
            "tosURI": String,
            "policyURI": String,
            "jwksURI": String,
            "jwks": {
                "type": String,
                "length": 4096,
                "dataType": "TEXT"
                //"mysql": {
                //    "dataLength": 4096,
                //    "dataType": "TEXT"
                //}
            },
            "softwareId": String,
            "softwareVersion": String,

            "callbackUrls": t.JSON,
            "permissions": t.JSON,
            "authenticationEnabled": t.JSON,
            "anonymousAllowed": t.JSON,
            "authenticationSchemes": t.JSON,
            "icon": t.JSON,
            "url": t.JSON
        },
        "comments": "https://tools.ietf.org/html/draft-ietf-oauth-dyn-reg-24"
    }
};<|endoftext|>


<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import Relay from 'react-relay/classic';
import { commitMutation, createFragmentContainer, graphql } from 'react-relay/compat';
import { FormattedMessage } from 'react-intl';
import Button from '@material-ui/core/Button';
import { MultiSelector } from '@meedan/check-ui';
import { withSetFlashMessage } from '../FlashMessage';
import GenericUnknownErrorMessage from '../GenericUnknownErrorMessage';
import { getErrorMessageForRelayModernProblem } from '../../helpers';
import globalStrings from '../../globalStrings';

const BulkActionsTag = ({
  onDismiss,
  selectedMedia,
  setFlashMessage,
  team,
}) => {
  const [searchValue, setSearchValue] = React.useState(null);
  const selected = [];
  const options = team.tag_texts.edges.map(tt => ({ label: tt.node.text, value: tt.node.text }));

  const onFailure = (error) => {
    const errorMessage = getErrorMessageForRelayModernProblem(error) || <GenericUnknownErrorMessage />;
    setFlashMessage(errorMessage, 'error');
    onDismiss();
  };

  const handleAddNew = (value) => {
    commitMutation(Relay.Store, {
      mutation: graphql`
        mutation BulkActionsTagCreateTagTextMutation($input: CreateTagTextInput!) {
          createTagText(input: $input) {
            team {
              id
              tag_texts(first: 10000) {
                edges {
                  node {
                    id
                    text
                  }
                }
              }
            }
          }
        }
      `,
      variables: {
        input: {
          team_id: team.dbid,
          text: value,
        },
      },
      onError: onFailure,
    });
  };

  const actionButton = searchValue && !options.includes(searchValue) ? (
    <Button
      id="bulk-actions-tag__create-button"
      color="primary"
      onClick={() => handleAddNew(searchValue)}
    >
      <FormattedMessage id="tagMenu.create" defaultMessage="+ Create this tag" />
    </Button>
  ) : null;

  const handleSubmit = (value) => {
    const onSuccess = () => {
      setFlashMessage((
        <FormattedMessage
          id="bulkActionsTag.success"
          defaultMessage="Items tagged successfully"
          description="Success message for bulk tagging actions"
        />
      ), 'success');
      onDismiss();
    };

    const inputs = [];

    value.forEach((v) => {
      selectedMedia.forEach((m) => {
        inputs.push({
          tag: v,
          annotated_type: 'ProjectMedia',
          annotated_id: `${m}`,
        });
      });
    });

    commitMutation(Relay.Store, {
      mutation: graphql`
        mutation BulkActionsTagCreateTagsMutation($input: CreateTagsInput!) {
          createTags(input: $input) {
            team {
              dbid
              tag_texts(first: 10000) {
                edges {
                  node {
                    id
                    dbid
                    text
                  }
                }
              }
            }
          }
        }
      `,
      variables: {
        input: {
          inputs,
        },
      },
      onCompleted: ({ response, error }) => {
        if (error) {
          return onFailure(error);
        }
        return onSuccess(response);
      },
      onError: onFailure,
    });
  };

  return (
    <FormattedMessage id="tagMenu.search" defaultMessage="Search…">
      {placeholder => (
        <MultiSelector
          allowSearch
          actionButton={actionButton}
          cancelLabel={<FormattedMessage {...globalStrings.cancel} />}
          inputPlaceholder={placeholder}
          selected={selected}
          onDismiss={onDismiss}
          onSearchChange={value => setSearchValue(value)}
          options={options}
          onSubmit={handleSubmit}
          notFoundLabel={
            <FormattedMessage
              id="tagMenu.notFound"
              defaultMessage="No tags found"
            />
          }
          submitLabel={
            <FormattedMessage
              id="bulkActionsTag.submitLabel"
              defaultMessage="{numItems, plural, one {Tag 1 item} other {Tag # items}}"
              values={{ numItems: selectedMedia.length }}
              description="Button for commiting the action of tagging of a number of items in bulk"
            />
          }
        />
      )}
    </FormattedMessage>
  );
};

BulkActionsTag.propTypes = {
  onDismiss: PropTypes.func.isRequired,
  selectedMedia: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired,
  setFlashMessage: PropTypes.func.isRequired,
  team: PropTypes.shape({
    dbid: PropTypes.number.isRequired,
    tag_texts: PropTypes.object.isRequired,
  }).isRequired,
};

export default createFragmentContainer(withSetFlashMessage(BulkActionsTag), graphql`
  fragment BulkActionsTag_team on Team {
    dbid
    tag_texts(first: 10000) {
      edges {
        node {
          text
        }
      }
    }
  }
`);
<commit_msg>CHECK-1042: update project media tags after bulk-tagging (#937)<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import Relay from 'react-relay/classic';
import { commitMutation, createFragmentContainer, graphql } from 'react-relay/compat';
import { FormattedMessage } from 'react-intl';
import Button from '@material-ui/core/Button';
import { MultiSelector } from '@meedan/check-ui';
import { withSetFlashMessage } from '../FlashMessage';
import GenericUnknownErrorMessage from '../GenericUnknownErrorMessage';
import { getErrorMessageForRelayModernProblem } from '../../helpers';
import globalStrings from '../../globalStrings';

const BulkActionsTag = ({
  onDismiss,
  selectedMedia,
  setFlashMessage,
  team,
}) => {
  const [searchValue, setSearchValue] = React.useState(null);
  const selected = [];
  const options = team.tag_texts.edges.map(tt => ({ label: tt.node.text, value: tt.node.text }));

  const onFailure = (error) => {
    const errorMessage = getErrorMessageForRelayModernProblem(error) || <GenericUnknownErrorMessage />;
    setFlashMessage(errorMessage, 'error');
    onDismiss();
  };

  const handleAddNew = (value) => {
    commitMutation(Relay.Store, {
      mutation: graphql`
        mutation BulkActionsTagCreateTagTextMutation($input: CreateTagTextInput!) {
          createTagText(input: $input) {
            team {
              id
              tag_texts(first: 10000) {
                edges {
                  node {
                    id
                    text
                  }
                }
              }
            }
          }
        }
      `,
      variables: {
        input: {
          team_id: team.dbid,
          text: value,
        },
      },
      onError: onFailure,
    });
  };

  const actionButton = searchValue && !options.includes(searchValue) ? (
    <Button
      id="bulk-actions-tag__create-button"
      color="primary"
      onClick={() => handleAddNew(searchValue)}
    >
      <FormattedMessage id="tagMenu.create" defaultMessage="+ Create this tag" />
    </Button>
  ) : null;

  const handleSubmit = (value) => {
    const onSuccess = () => {
      setFlashMessage((
        <FormattedMessage
          id="bulkActionsTag.success"
          defaultMessage="Items tagged successfully"
          description="Success message for bulk tagging actions"
        />
      ), 'success');
      onDismiss();
    };

    const inputs = [];

    value.forEach((v) => {
      selectedMedia.forEach((m) => {
        inputs.push({
          tag: v,
          annotated_type: 'ProjectMedia',
          annotated_id: `${m}`,
        });
      });
    });

    commitMutation(Relay.Store, {
      mutation: graphql`
        mutation BulkActionsTagCreateTagsMutation($input: CreateTagsInput!) {
          createTags(input: $input) {
            check_search_team {
              medias(first: 50) {
                edges {
                  node {
                    id
                    list_columns_values
                  }
                }
              }
            }
            team {
              dbid
              tag_texts(first: 10000) {
                edges {
                  node {
                    id
                    dbid
                    text
                  }
                }
              }
            }
          }
        }
      `,
      variables: {
        input: {
          inputs,
        },
      },
      onCompleted: ({ response, error }) => {
        if (error) {
          return onFailure(error);
        }
        return onSuccess(response);
      },
      onError: onFailure,
    });
  };

  return (
    <FormattedMessage id="tagMenu.search" defaultMessage="Search…">
      {placeholder => (
        <MultiSelector
          allowSearch
          actionButton={actionButton}
          cancelLabel={<FormattedMessage {...globalStrings.cancel} />}
          inputPlaceholder={placeholder}
          selected={selected}
          onDismiss={onDismiss}
          onSearchChange={value => setSearchValue(value)}
          options={options}
          onSubmit={handleSubmit}
          notFoundLabel={
            <FormattedMessage
              id="tagMenu.notFound"
              defaultMessage="No tags found"
            />
          }
          submitLabel={
            <FormattedMessage
              id="bulkActionsTag.submitLabel"
              defaultMessage="{numItems, plural, one {Tag 1 item} other {Tag # items}}"
              values={{ numItems: selectedMedia.length }}
              description="Button for commiting the action of tagging of a number of items in bulk"
            />
          }
        />
      )}
    </FormattedMessage>
  );
};

BulkActionsTag.propTypes = {
  onDismiss: PropTypes.func.isRequired,
  selectedMedia: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired,
  setFlashMessage: PropTypes.func.isRequired,
  team: PropTypes.shape({
    dbid: PropTypes.number.isRequired,
    tag_texts: PropTypes.object.isRequired,
  }).isRequired,
};

export default createFragmentContainer(withSetFlashMessage(BulkActionsTag), graphql`
  fragment BulkActionsTag_team on Team {
    dbid
    tag_texts(first: 10000) {
      edges {
        node {
          text
        }
      }
    }
  }
`);
<|endoftext|>


<commit_before>import SPELLS from 'common/SPELLS';

export const ABILITIES_AFFECTED_BY_HEALING_INCREASES = [
  SPELLS.HEALING_WAVE.id,
  SPELLS.CHAIN_HEAL.id,
  SPELLS.HEALING_SURGE_RESTORATION.id,
  SPELLS.HEALING_STREAM_TOTEM_HEAL.id,
  SPELLS.HEALING_TIDE_TOTEM_HEAL.id,
  SPELLS.RIPTIDE.id,
  SPELLS.HEALING_RAIN_HEAL.id,
  SPELLS.WELLSPRING_HEAL.id,
  SPELLS.UNLEASH_LIFE_TALENT.id,
  SPELLS.EARTH_SHIELD_HEAL.id,
  // While the following spells don't double dip in healing increases, they gain the same percentual bonus from the transfer
  SPELLS.CLOUDBURST_TOTEM_HEAL.id,
  SPELLS.ASCENDANCE_HEAL.id,
];

export const ABILITIES_AFFECTED_BY_MASTERY = [
  SPELLS.WELLSPRING_HEAL.id,
  SPELLS.CHAIN_HEAL.id,
  SPELLS.HEALING_WAVE.id,
  SPELLS.RIPTIDE.id,
  SPELLS.HEALING_SURGE_RESTORATION.id,
  SPELLS.HEALING_TIDE_TOTEM_HEAL.id,
  SPELLS.HEALING_STREAM_TOTEM_HEAL.id,
  SPELLS.HEALING_RAIN_HEAL.id,
  SPELLS.UNLEASH_LIFE_TALENT.id,
  SPELLS.EARTH_SHIELD_HEAL.id,
  // While the following spells don't double dip in healing increases, they gain the same percentual bonus from the transfer
  SPELLS.CLOUDBURST_TOTEM_HEAL.id,
  SPELLS.ASCENDANCE_HEAL.id,
];

export const ABILITIES_NOT_FEEDING_INTO_CBT = [
  SPELLS.CLOUDBURST_TOTEM_HEAL.id,
  SPELLS.HEALING_TIDE_TOTEM_HEAL.id,
  SPELLS.HEALING_STREAM_TOTEM_HEAL.id,
  SPELLS.SPIRIT_LINK_TOTEM_REDISTRIBUTE.id,
  SPELLS.LEECH.id,
];

export const ABILITIES_NOT_FEEDING_INTO_ASCENDANCE = [
  SPELLS.HEALING_TIDE_TOTEM_HEAL.id,
  SPELLS.HEALING_STREAM_TOTEM_HEAL.id,
  SPELLS.SPIRIT_LINK_TOTEM_REDISTRIBUTE.id,
  SPELLS.LEECH.id,
  SPELLS.ASCENDANCE_HEAL.id,
  SPELLS.CLOUDBURST_TOTEM_HEAL.id,
];
<commit_msg>added leech back<commit_after>import SPELLS from 'common/SPELLS';

export const ABILITIES_AFFECTED_BY_HEALING_INCREASES = [
  SPELLS.HEALING_WAVE.id,
  SPELLS.CHAIN_HEAL.id,
  SPELLS.HEALING_SURGE_RESTORATION.id,
  SPELLS.HEALING_STREAM_TOTEM_HEAL.id,
  SPELLS.HEALING_TIDE_TOTEM_HEAL.id,
  SPELLS.RIPTIDE.id,
  SPELLS.HEALING_RAIN_HEAL.id,
  SPELLS.WELLSPRING_HEAL.id,
  SPELLS.UNLEASH_LIFE_TALENT.id,
  SPELLS.EARTH_SHIELD_HEAL.id,
  // While the following spells don't double dip in healing increases, they gain the same percentual bonus from the transfer
  SPELLS.CLOUDBURST_TOTEM_HEAL.id,
  SPELLS.ASCENDANCE_HEAL.id,
  SPELLS.LEECH.id,
];

export const ABILITIES_AFFECTED_BY_MASTERY = [
  SPELLS.WELLSPRING_HEAL.id,
  SPELLS.CHAIN_HEAL.id,
  SPELLS.HEALING_WAVE.id,
  SPELLS.RIPTIDE.id,
  SPELLS.HEALING_SURGE_RESTORATION.id,
  SPELLS.HEALING_TIDE_TOTEM_HEAL.id,
  SPELLS.HEALING_STREAM_TOTEM_HEAL.id,
  SPELLS.HEALING_RAIN_HEAL.id,
  SPELLS.UNLEASH_LIFE_TALENT.id,
  SPELLS.EARTH_SHIELD_HEAL.id,
  // While the following spells don't double dip in healing increases, they gain the same percentual bonus from the transfer
  SPELLS.CLOUDBURST_TOTEM_HEAL.id,
  SPELLS.ASCENDANCE_HEAL.id,
  SPELLS.LEECH.id,
];

export const ABILITIES_NOT_FEEDING_INTO_CBT = [
  SPELLS.CLOUDBURST_TOTEM_HEAL.id,
  SPELLS.HEALING_TIDE_TOTEM_HEAL.id,
  SPELLS.HEALING_STREAM_TOTEM_HEAL.id,
  SPELLS.SPIRIT_LINK_TOTEM_REDISTRIBUTE.id,
  SPELLS.LEECH.id,
];

export const ABILITIES_NOT_FEEDING_INTO_ASCENDANCE = [
  SPELLS.HEALING_TIDE_TOTEM_HEAL.id,
  SPELLS.HEALING_STREAM_TOTEM_HEAL.id,
  SPELLS.SPIRIT_LINK_TOTEM_REDISTRIBUTE.id,
  SPELLS.LEECH.id,
  SPELLS.ASCENDANCE_HEAL.id,
  SPELLS.CLOUDBURST_TOTEM_HEAL.id,
];
<|endoftext|>