text:
package com.hubspot.jinjava.el.ext.eager;

import com.hubspot.jinjava.el.ext.DeferredParsingException;
import de.odysseus.el.tree.Bindings;
import de.odysseus.el.tree.impl.ast.AstDot;
import de.odysseus.el.tree.impl.ast.AstNode;
import javax.el.ELContext;
import javax.el.ELException;

public class EagerAstDot extends AstDot implements EvalResultHolder {
  protected Object evalResult;
  protected boolean hasEvalResult;
  protected final EvalResultHolder base;
  protected final String property;

  public EagerAstDot(
    AstNode base,
    String property,
    boolean lvalue,
    boolean ignoreReturnType
  ) {
    this(
      EagerAstNodeDecorator.getAsEvalResultHolder(base),
      property,
      lvalue,
      ignoreReturnType
    );
  }

  public EagerAstDot(
    EvalResultHolder base,
    String property,
    boolean lvalue,
    boolean ignoreReturnType
  ) {
    super((AstNode) base, property, lvalue, ignoreReturnType);
    this.base = base;
    this.property = property;
  }

  @Override
  public Object eval(Bindings bindings, ELContext context) throws ELException {
    return EvalResultHolder.super.eval(
      () -> super.eval(bindings, context),
      bindings,
      context
    );
  }

  @Override
  public String getPartiallyResolved(
    Bindings bindings,
    ELContext context,
    DeferredParsingException e,
    boolean preserveIdentifier
  ) {
    return String.format(
      "%s.%s",
      EvalResultHolder.reconstructNode(bindings, context, base, e, preserveIdentifier),
      property
    );
  }

  @Override
  public Object getEvalResult() {
    return evalResult;
  }

  @Override
  public void setEvalResult(Object evalResult) {
    this.evalResult = evalResult;
    hasEvalResult = true;
  }

  @Override
  public boolean hasEvalResult() {
    return hasEvalResult;
  }

  public AstNode getPrefix() {
    return prefix;
  }

  public String getProperty() {
    return property;
  }
}


text:
/**
 * DO NOT EDIT THIS FILE as it will be overwritten by the Pbj compiler.
 * @link https://github.com/gdbots/pbjc-php
 *
 * Returns an array of curies using mixin "triniti:taxonomy:mixin:search-categories-request:v1"
 * @link http://schemas.triniti.io/json-schema/triniti/taxonomy/mixin/search-categories-request/1-0-0.json#
 */

export default [
];

redpajama_set_name: RedPajamaGithub


text:
namespace ash {

// Handles interaction with Active Directory login screen and Active Directory
// password change screen.
class ActiveDirectoryLoginMixin : public InProcessBrowserTestMixin {
 public:
  explicit ActiveDirectoryLoginMixin(InProcessBrowserTestMixinHost* host);

  ActiveDirectoryLoginMixin(const ActiveDirectoryLoginMixin&) = delete;
  ActiveDirectoryLoginMixin& operator=(const ActiveDirectoryLoginMixin&) =
      delete;

  ~ActiveDirectoryLoginMixin() override;

  // InProcessBrowserTestMixin:
  void SetUpInProcessBrowserTestFixture() override;
  void SetUpOnMainThread() override;

  void set_autocomplete_realm(const std::string& autocomplete_realm) {
    autocomplete_realm_ = autocomplete_realm;
  }

  // Checks if Active Directory login is visible.
  void TestLoginVisible();
  // Checks if Active Directory password change screen is shown.
  void TestPasswordChangeVisible();
  // Checks if user input is marked as invalid.
  void TestUserError();
  void SetUserInput(const std::string& value);
  void TestUserInput(const std::string& value);
  // Checks if password input is marked as invalid.
  void TestPasswordError();
  // Checks that machine, password and user inputs are valid.
  void TestNoError();
  // Checks if autocomplete domain is visible for the user input.
  void TestDomainVisible();
  // Checks if autocomplete domain is hidden for the user input.
  void TestDomainHidden();
  // Clicks back button.
  void ClickBackButton();

  void TriggerPasswordChangeScreen();
  void ClosePasswordChangeScreen();
  // Checks if Active Directory password change screen is shown. Also checks if
  // `invalid_element` is invalidated and all the other elements are valid.
  void TestPasswordChangeNoErrors();
  void TestPasswordChangeOldPasswordError();
  void TestPasswordChangeNewPasswordError();
  void TestPasswordChangeConfirmNewPasswordError();

  // Sets username and password for the Active Directory login and submits it.
  void SubmitActiveDirectoryCredentials(const std::string& username,
                                        const std::string& password);

  // Sets old and new passwords for the Active Directory password change and
  // submits it.
  void SubmitActiveDirectoryPasswordChangeCredentials(
      const std::string& old_password,
      const std::string& new_password1,
      const std::string& new_password2);

  // Waits when Active Directory screen been invalidated from inside Chrome.
  void WaitForAuthError();

 private:
  void SetupActiveDirectoryJSNotifications();
  void TestPasswordChangeError(const std::string& invalid_element);

  std::string autocomplete_realm_;
  std::unique_ptr<content::DOMMessageQueue> message_queue_;
};

}  // namespace ash

// TODO(https://crbug.com/1164001): remove after the //chrome/browser/chromeos
// source migration is finished.
namespace chromeos {
using ::ash::ActiveDirectoryLoginMixin;
}

#endif  // CHROME_BROWSER_ASH_LOGIN_TEST_ACTIVE_DIRECTORY_LOGIN_MIXIN_H_


text:
import { Parser, ParserOptions } from 'htmlparser2';
import { LocationTracker, SourceLocation } from './location-tracker';

export type Directive = {
  name: string | RegExp;
  start: string;
  end: string;
};

export type Options = {
  directives?: Directive[];
  sourceLocations?: boolean;
  recognizeNoValueAttribute?: boolean;
} & ParserOptions;

export type Tag = string | boolean;
export type Attributes = Record<string, string | number | boolean>;
export type Content = NodeText | Array<Node | Node[]>;

export type NodeText = string | number;
export type NodeTag = {
  tag?: Tag;
  attrs?: Attributes;
  content?: Content;
  location?: SourceLocation;
};

export type Node = NodeText | NodeTag;

const defaultOptions: ParserOptions = {
  lowerCaseTags: false,
  lowerCaseAttributeNames: false,
  decodeEntities: false
};

const defaultDirectives: Directive[] = [
  {
    name: '!doctype',
    start: '<',
    end: '>'
  }
];

export const parser = (html: string, options: Options = {}): Node[] => {
  const locationTracker = new LocationTracker(html);
  const bufArray: Node[] = [];
  const results: Node[] = [];
  let lastOpenTagEndIndex = 0;
  let noValueAttributes: Record<string, true> = {};

  function bufferArrayLast(): Node {
    return bufArray[bufArray.length - 1];
  }

  function isDirective(directive: Directive, tag: string): boolean {
    if (directive.name instanceof RegExp) {
      const regex = new RegExp(directive.name.source, 'i');

      return regex.test(tag);
    }

    if (tag !== directive.name) {
      return false;
    }

    return true;
  }

  function normalizeArributes(attrs: Attributes): Attributes {
    const result: Attributes = {};
    Object.keys(attrs).forEach((key: string) => {
      const object: Attributes = {};

      object[key] = String(attrs[key]).replace(/"/g, '"');

      if (options.recognizeNoValueAttribute && noValueAttributes[key]) {
        object[key] = true;
      }

      Object.assign(result, object);
    });

    return result;
  }

  function onprocessinginstruction(name: string, data: string) {
    const directives = defaultDirectives.concat(options.directives ?? []);
    const last = bufferArrayLast();

    for (const directive of directives) {
      const directiveText = directive.start + data + directive.end;

      if (isDirective(directive, name.toLowerCase())) {
        if (last === undefined) {
          results.push(directiveText);
          return;
        }

        if (typeof last === 'object') {
          if (last.content === undefined) {
            last.content = [];
          }

          if (Array.isArray(last.content)) {
            last.content.push(directiveText);
          }
        }
      }
    }
  }

  function oncomment(data: string) {
    const last = bufferArrayLast();
    const comment = `<!--${data}-->`;

    if (last === undefined) {
      results.push(comment);
      return;
    }

    if (typeof last === 'object') {
      if (last.content === undefined) {
        last.content = [];
      }

      if (Array.isArray(last.content)) {
        last.content.push(comment);
      }
    }
  }

  function onattribute(name: string, value: string, quote?: string | undefined | null) {
    // Quote: Quotes used around the attribute.
    // `null` if the attribute has no quotes around the value,
    // `undefined` if the attribute has no value.
    if (quote === undefined) {
      // `true` is recognized by posthtml-render as attrubute without value
      // See: https://github.com/posthtml/posthtml-render/blob/master/src/index.ts#L268
      noValueAttributes[name] = true;
    }
  }

  function onopentag(tag: string, attrs: Attributes) {
    const buf: NodeTag = { tag };

    if (options.sourceLocations) {
      buf.location = {
        start: locationTracker.getPosition(parser.startIndex),
        end: locationTracker.getPosition(parser.endIndex)
      };
      lastOpenTagEndIndex = parser.endIndex;
    }

    if (Object.keys(attrs).length > 0) {
      buf.attrs = normalizeArributes(attrs);
    }

    // Always reset after normalizeArributes
    // Reason: onopentag callback will fire after all attrubutes have been processed
    noValueAttributes = {};

    bufArray.push(buf);
  }

  function onclosetag(name: string, isImplied: boolean) {
    const buf: Node | undefined = bufArray.pop();

    if (buf && typeof buf === 'object' && buf.location && parser.endIndex !== null) {
      if (!isImplied) {
        buf.location.end = locationTracker.getPosition(parser.endIndex);
      } else if (lastOpenTagEndIndex < parser.startIndex) {
        buf.location.end = locationTracker.getPosition(parser.startIndex - 1);
      }
    }

    if (buf) {
      const last = bufferArrayLast();

      if (bufArray.length <= 0) {
        results.push(buf);
        return;
      }

      if (typeof last === 'object') {
        if (last.content === undefined) {
          last.content = [];
        }

        if (Array.isArray(last.content)) {
          last.content.push(buf);
        }
      }
    }
  }

  function ontext(text: string) {
    const last: Node = bufferArrayLast();

    if (last === undefined) {
      results.push(text);
      return;
    }

    if (typeof last === 'object') {
      if (last.content && Array.isArray(last.content) && last.content.length > 0) {
        const lastContentNode = last.content[last.content.length - 1];
        if (typeof lastContentNode === 'string' && !lastContentNode.startsWith('<!--')) {
          last.content[last.content.length - 1] = `${lastContentNode}${text}`;
          return;
        }
      }

      if (last.content === undefined) {
        last.content = [];
      }

      if (Array.isArray(last.content)) {
        last.content.push(text);
      }
    }
  }

  const parser = new Parser({
    onprocessinginstruction,
    oncomment,
    onattribute,
    onopentag,
    onclosetag,
    ontext
  }, { ...defaultOptions, ...options });

  parser.write(html);
  parser.end();

  return results;
};


text:
		  Jasmine webOS Test Harness

  You've launched the Jasmine webOS test harness app for running all of its specs. There is either a low-level problem,
  jasmine.js was not included, or you have launched this app from the launcher instead of the command line.

  Check the logs for this app and/or ensure that you are launching the app from your command line via rake.


text:
/*! adapterjs - v0.12.0 - 2015-09-04 */

// Adapter's interface.
var AdapterJS = AdapterJS || {};

// Browserify compatibility
if(typeof exports !== 'undefined') {
  module.exports = AdapterJS;
}

AdapterJS.options = AdapterJS.options || {};

// uncomment to get virtual webcams
// AdapterJS.options.getAllCams = true;

// uncomment to prevent the install prompt when the plugin in not yet installed
// AdapterJS.options.hidePluginInstallPrompt = true;

// AdapterJS version
AdapterJS.VERSION = '0.12.0';

// This function will be called when the WebRTC API is ready to be used
// Whether it is the native implementation (Chrome, Firefox, Opera) or
// the plugin
// You may Override this function to synchronise the start of your application
// with the WebRTC API being ready.
// If you decide not to override use this synchronisation, it may result in
// an extensive CPU usage on the plugin start (once per tab loaded)
// Params:
//    - isUsingPlugin: true is the WebRTC plugin is being used, false otherwise
//
AdapterJS.onwebrtcready = AdapterJS.onwebrtcready || function(isUsingPlugin) {
  // The WebRTC API is ready.
  // Override me and do whatever you want here
};

// Sets a callback function to be called when the WebRTC interface is ready.
// The first argument is the function to callback.\
// Throws an error if the first argument is not a function
AdapterJS.webRTCReady = function (callback) {
  if (typeof callback !== 'function') {
    throw new Error('Callback provided is not a function');
  }

  if (true === AdapterJS.onwebrtcreadyDone) {
    // All WebRTC interfaces are ready, just call the callback
    callback(null !== AdapterJS.WebRTCPlugin.plugin);
  } else {
    // will be triggered automatically when your browser/plugin is ready.
    AdapterJS.onwebrtcready = callback;
  }
};

// Plugin namespace
AdapterJS.WebRTCPlugin = AdapterJS.WebRTCPlugin || {};

// The object to store plugin information
AdapterJS.WebRTCPlugin.pluginInfo = {
  prefix : 'Tem',
  plugName : 'TemWebRTCPlugin',
  pluginId : 'plugin0',
  type : 'application/x-temwebrtcplugin',
  onload : '__TemWebRTCReady0',
  portalLink : 'http://skylink.io/plugin/',
  downloadLink : null, //set below
  companyName: 'Temasys'
};
if(!!navigator.platform.match(/^Mac/i)) {
  AdapterJS.WebRTCPlugin.pluginInfo.downloadLink = 'http://bit.ly/1n77hco';
}
else if(!!navigator.platform.match(/^Win/i)) {
  AdapterJS.WebRTCPlugin.pluginInfo.downloadLink = 'http://bit.ly/1kkS4FN';
}

AdapterJS.WebRTCPlugin.TAGS = {
  NONE  : 'none',
  AUDIO : 'audio',
  VIDEO : 'video'
};

// Unique identifier of each opened page
AdapterJS.WebRTCPlugin.pageId = Math.random().toString(36).slice(2);

// Use this whenever you want to call the plugin.
AdapterJS.WebRTCPlugin.plugin = null;

// Set log level for the plugin once it is ready.
// The different values are
// This is an asynchronous function that will run when the plugin is ready
AdapterJS.WebRTCPlugin.setLogLevel = null;

// Defines webrtc's JS interface according to the plugin's implementation.
// Define plugin Browsers as WebRTC Interface.
AdapterJS.WebRTCPlugin.defineWebRTCInterface = null;

// This function detects whether or not a plugin is installed.
// Checks if Not IE (firefox, for example), else if it's IE,
// we're running IE and do something. If not it is not supported.
AdapterJS.WebRTCPlugin.isPluginInstalled = null;

 // Lets adapter.js wait until the the document is ready before injecting the plugin
AdapterJS.WebRTCPlugin.pluginInjectionInterval = null;

// Inject the HTML DOM object element into the page.
AdapterJS.WebRTCPlugin.injectPlugin = null;

// States of readiness that the plugin goes through when
// being injected and stated
AdapterJS.WebRTCPlugin.PLUGIN_STATES = {
  NONE : 0,           // no plugin use
  INITIALIZING : 1,   // Detected need for plugin
  INJECTING : 2,      // Injecting plugin
  INJECTED: 3,        // Plugin element injected but not usable yet
  READY: 4            // Plugin ready to be used
};

// Current state of the plugin. You cannot use the plugin before this is
// equal to AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY
AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.NONE;

// True is AdapterJS.onwebrtcready was already called, false otherwise
// Used to make sure AdapterJS.onwebrtcready is only called once
AdapterJS.onwebrtcreadyDone = false;

// Log levels for the plugin.
// To be set by calling AdapterJS.WebRTCPlugin.setLogLevel
/*
Log outputs are prefixed in some cases.
  INFO: Information reported by the plugin.
  ERROR: Errors originating from within the plugin.
  WEBRTC: Error originating from within the libWebRTC library
*/
// From the least verbose to the most verbose
AdapterJS.WebRTCPlugin.PLUGIN_LOG_LEVELS = {
  NONE : 'NONE',
  ERROR : 'ERROR',
  WARNING : 'WARNING',
  INFO: 'INFO',
  VERBOSE: 'VERBOSE',
  SENSITIVE: 'SENSITIVE'
};

// Does a waiting check before proceeding to load the plugin.
AdapterJS.WebRTCPlugin.WaitForPluginReady = null;

// This methid will use an interval to wait for the plugin to be ready.
AdapterJS.WebRTCPlugin.callWhenPluginReady = null;

// !!!! WARNING: DO NOT OVERRIDE THIS FUNCTION. !!!
// This function will be called when plugin is ready. It sends necessary
// details to the plugin.
// The function will wait for the document to be ready and the set the
// plugin state to AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY,
// indicating that it can start being requested.
// This function is not in the IE/Safari condition brackets so that
// TemPluginLoaded function might be called on Chrome/Firefox.
// This function is the only private function that is not encapsulated to
// allow the plugin method to be called.
__TemWebRTCReady0 = function () {
  if (document.readyState === 'complete') {
    AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY;

    AdapterJS.maybeThroughWebRTCReady();
  } else {
    AdapterJS.WebRTCPlugin.documentReadyInterval = setInterval(function () {
      if (document.readyState === 'complete') {
        // TODO: update comments, we wait for the document to be ready
        clearInterval(AdapterJS.WebRTCPlugin.documentReadyInterval);
        AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY;

        AdapterJS.maybeThroughWebRTCReady();
      }
    }, 100);
  }
};

AdapterJS.maybeThroughWebRTCReady = function() {
  if (!AdapterJS.onwebrtcreadyDone) {
    AdapterJS.onwebrtcreadyDone = true;

    if (typeof(AdapterJS.onwebrtcready) === 'function') {
      AdapterJS.onwebrtcready(AdapterJS.WebRTCPlugin.plugin !== null);
    }
  }
};

// Text namespace
AdapterJS.TEXT = {
  PLUGIN: {
    REQUIRE_INSTALLATION: 'This website requires you to install a WebRTC-enabling plugin ' +
      'to work on this browser.',
    NOT_SUPPORTED: 'Your browser does not support WebRTC.',
    BUTTON: 'Install Now'
  },
  REFRESH: {
    REQUIRE_REFRESH: 'Please refresh page',
    BUTTON: 'Refresh Page'
  }
};

// The result of ice connection states.
// - starting: Ice connection is starting.
// - checking: Ice connection is checking.
// - connected Ice connection is connected.
// - completed Ice connection is connected.
// - done Ice connection has been completed.
// - disconnected Ice connection has been disconnected.
// - failed Ice connection has failed.
// - closed Ice connection is closed.
AdapterJS._iceConnectionStates = {
  starting : 'starting',
  checking : 'checking',
  connected : 'connected',
  completed : 'connected',
  done : 'completed',
  disconnected : 'disconnected',
  failed : 'failed',
  closed : 'closed'
};

//The IceConnection states that has been fired for each peer.
AdapterJS._iceConnectionFiredStates = [];

// Check if WebRTC Interface is defined.
AdapterJS.isDefined = null;

// This function helps to retrieve the webrtc detected browser information.
// This sets:
// - webrtcDetectedBrowser: The browser agent name.
// - webrtcDetectedVersion: The browser version.
// - webrtcDetectedType: The types of webRTC support.
//   - 'moz': Mozilla implementation of webRTC.
//   - 'webkit': WebKit implementation of webRTC.
//   - 'plugin': Using the plugin implementation.
AdapterJS.parseWebrtcDetectedBrowser = function () {
  var hasMatch, checkMatch = navigator.userAgent.match(
    /(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
  if (/trident/i.test(checkMatch[1])) {
    hasMatch = /\brv[ :]+(\d+)/g.exec(navigator.userAgent) || [];
    webrtcDetectedBrowser = 'IE';
    webrtcDetectedVersion = parseInt(hasMatch[1] || '0', 10);
  } else if (checkMatch[1] === 'Chrome') {
    hasMatch = navigator.userAgent.match(/\bOPR\/(\d+)/);
    if (hasMatch !== null) {
      webrtcDetectedBrowser = 'opera';
      webrtcDetectedVersion = parseInt(hasMatch[1], 10);
    }
  }
  if (navigator.userAgent.indexOf('Safari')) {
    if (typeof InstallTrigger !== 'undefined') {
      webrtcDetectedBrowser = 'firefox';
    } else if (/*@cc_on!@*/ false || !!document.documentMode) {
      webrtcDetectedBrowser = 'IE';
    } else if (
      Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0) {
      webrtcDetectedBrowser = 'safari';
    } else if (!!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) {
      webrtcDetectedBrowser = 'opera';
    } else if (!!window.chrome) {
      webrtcDetectedBrowser = 'chrome';
    }
  }
  if (!webrtcDetectedBrowser) {
    webrtcDetectedVersion = checkMatch[1];
  }
  if (!webrtcDetectedVersion) {
    try {
      checkMatch = (checkMatch[2]) ? [checkMatch[1], checkMatch[2]] :
        [navigator.appName, navigator.appVersion, '-?'];
      if ((hasMatch = navigator.userAgent.match(/version\/(\d+)/i)) !== null) {
        checkMatch.splice(1, 1, hasMatch[1]);
      }
      webrtcDetectedVersion = parseInt(checkMatch[1], 10);
    } catch (error) { }
  }
};

// To fix configuration as some browsers does not support
// the 'urls' attribute.
AdapterJS.maybeFixConfiguration = function (pcConfig) {
  if (pcConfig === null) {
    return;
  }
  for (var i = 0; i < pcConfig.iceServers.length; i++) {
    if (pcConfig.iceServers[i].hasOwnProperty('urls')) {
      pcConfig.iceServers[i].url = pcConfig.iceServers[i].urls;
      delete pcConfig.iceServers[i].urls;
    }
  }
};

AdapterJS.addEvent = function(elem, evnt, func) {
  if (elem.addEventListener) { // W3C DOM
    elem.addEventListener(evnt, func, false);
  } else if (elem.attachEvent) {// OLD IE DOM
    elem.attachEvent('on'+evnt, func);
  } else { // No much to do
    elem[evnt] = func;
  }
};

AdapterJS.renderNotificationBar = function (text, buttonText, buttonLink, openNewTab, displayRefreshBar) {
  // only inject once the page is ready
  if (document.readyState !== 'complete') {
    return;
  }

  var w = window;
  var i = document.createElement('iframe');
  i.style.position = 'fixed';
  i.style.top = '-41px';
  i.style.left = 0;
  i.style.right = 0;
  i.style.width = '100%';
  i.style.height = '40px';
  i.style.backgroundColor = '#ffffe1';
  i.style.border = 'none';
  i.style.borderBottom = '1px solid #888888';
  i.style.zIndex = '9999999';
  if(typeof i.style.webkitTransition === 'string') {
    i.style.webkitTransition = 'all .5s ease-out';
  } else if(typeof i.style.transition === 'string') {
    i.style.transition = 'all .5s ease-out';
  }
  document.body.appendChild(i);
  c = (i.contentWindow) ? i.contentWindow :
    (i.contentDocument.document) ? i.contentDocument.document : i.contentDocument;
  c.document.open();
  c.document.write('' + text + '');
  if(buttonText && buttonLink) {
    c.document.write('<button id="okay">' + buttonText + '</button><button id="cancel">Cancel</button>');
    c.document.close();

    // On click on okay
    AdapterJS.addEvent(c.document.getElementById('okay'), 'click', function(e) {
      if (!!displayRefreshBar) {
        AdapterJS.renderNotificationBar(AdapterJS.TEXT.EXTENSION ?
          AdapterJS.TEXT.EXTENSION.REQUIRE_REFRESH : AdapterJS.TEXT.REFRESH.REQUIRE_REFRESH,
          AdapterJS.TEXT.REFRESH.BUTTON, 'javascript:location.reload()');
      }
      window.open(buttonLink, !!openNewTab ? '_blank' : '_top');

      e.preventDefault();
      try {
        event.cancelBubble = true;
      } catch(error) { }

      var pluginInstallInterval = setInterval(function(){
        if(! isIE) {
          navigator.plugins.refresh(false);
        }
        AdapterJS.WebRTCPlugin.isPluginInstalled(
          AdapterJS.WebRTCPlugin.pluginInfo.prefix,
          AdapterJS.WebRTCPlugin.pluginInfo.plugName,
          function() { // plugin now installed
            clearInterval(pluginInstallInterval);
            AdapterJS.WebRTCPlugin.defineWebRTCInterface();
          },
          function() {
            // still no plugin detected, nothing to do
          });
      } , 500);
    });

    // On click on Cancel
    AdapterJS.addEvent(c.document.getElementById('cancel'), 'click', function(e) {
      w.document.body.removeChild(i);
    });
  } else {
    c.document.close();
  }
  setTimeout(function() {
    if(typeof i.style.webkitTransform === 'string') {
      i.style.webkitTransform = 'translateY(40px)';
    } else if(typeof i.style.transform === 'string') {
      i.style.transform = 'translateY(40px)';
    } else {
      i.style.top = '0px';
    }
  }, 300);
};

// -----------------------------------------------------------
// Detected webrtc implementation. Types are:
// - 'moz': Mozilla implementation of webRTC.
// - 'webkit': WebKit implementation of webRTC.
// - 'plugin': Using the plugin implementation.
webrtcDetectedType = null;

// Detected webrtc datachannel support. Types are:
// - 'SCTP': SCTP datachannel support.
// - 'RTP': RTP datachannel support.
webrtcDetectedDCSupport = null;

// Set the settings for creating DataChannels, MediaStream for
// Cross-browser compability.
// - This is only for SCTP based support browsers.
// the 'urls' attribute.
checkMediaDataChannelSettings =
  function (peerBrowserAgent, peerBrowserVersion, callback, constraints) {
  if (typeof callback !== 'function') {
    return;
  }
  var beOfferer = true;
  var isLocalFirefox = webrtcDetectedBrowser === 'firefox';
  // Nightly version does not require MozDontOfferDataChannel for interop
  var isLocalFirefoxInterop = webrtcDetectedType === 'moz' && webrtcDetectedVersion > 30;
  var isPeerFirefox = peerBrowserAgent === 'firefox';
  var isPeerFirefoxInterop = peerBrowserAgent === 'firefox' &&
    ((peerBrowserVersion) ? (peerBrowserVersion > 30) : false);

  // Resends an updated version of constraints for MozDataChannel to work
  // If other userAgent is firefox and user is firefox, remove MozDataChannel
  if ((isLocalFirefox && isPeerFirefox) || (isLocalFirefoxInterop)) {
    try {
      delete constraints.mandatory.MozDontOfferDataChannel;
    } catch (error) {
      console.error('Failed deleting MozDontOfferDataChannel');
      console.error(error);
    }
  } else if ((isLocalFirefox && !isPeerFirefox)) {
    constraints.mandatory.MozDontOfferDataChannel = true;
  }
  if (!isLocalFirefox) {
    // temporary measure to remove Moz* constraints in non Firefox browsers
    for (var prop in constraints.mandatory) {
      if (constraints.mandatory.hasOwnProperty(prop)) {
        if (prop.indexOf('Moz') !== -1) {
          delete constraints.mandatory[prop];
        }
      }
    }
  }
  // Firefox (not interopable) cannot offer DataChannel as it will cause problems to the
  // interopability of the media stream
  if (isLocalFirefox && !isPeerFirefox && !isLocalFirefoxInterop) {
    beOfferer = false;
  }
  callback(beOfferer, constraints);
};

// Handles the differences for all browsers ice connection state output.
// - Tested outcomes are:
//   - Chrome (offerer)  : 'checking' > 'completed' > 'completed'
//   - Chrome (answerer) : 'checking' > 'connected'
//   - Firefox (offerer) : 'checking' > 'connected'
//   - Firefox (answerer): 'checking' > 'connected'
checkIceConnectionState = function (peerId, iceConnectionState, callback) {
  if (typeof callback !== 'function') {
    console.warn('No callback specified in checkIceConnectionState. Aborted.');
    return;
  }
  peerId = (peerId) ? peerId : 'peer';

  if (!AdapterJS._iceConnectionFiredStates[peerId] ||
    iceConnectionState === AdapterJS._iceConnectionStates.disconnected ||
    iceConnectionState === AdapterJS._iceConnectionStates.failed ||
    iceConnectionState === AdapterJS._iceConnectionStates.closed) {
    AdapterJS._iceConnectionFiredStates[peerId] = [];
  }
  iceConnectionState = AdapterJS._iceConnectionStates[iceConnectionState];
  if (AdapterJS._iceConnectionFiredStates[peerId].indexOf(iceConnectionState) < 0) {
    AdapterJS._iceConnectionFiredStates[peerId].push(iceConnectionState);
    if (iceConnectionState === AdapterJS._iceConnectionStates.connected) {
      setTimeout(function () {
        AdapterJS._iceConnectionFiredStates[peerId]
          .push(AdapterJS._iceConnectionStates.done);
        callback(AdapterJS._iceConnectionStates.done);
      }, 1000);
    }
    callback(iceConnectionState);
  }
  return;
};

// Firefox:
// - Creates iceServer from the url for Firefox.
// - Create iceServer with stun url.
// - Create iceServer with turn url.
//   - Ignore the transport parameter from TURN url for FF version <=27.
//   - Return null for createIceServer if transport=tcp.
// - FF 27 and above supports transport parameters in TURN url,
// - So passing in the full url to create iceServer.
// Chrome:
// - Creates iceServer from the url for Chrome M33 and earlier.
//   - Create iceServer with stun url.
//   - Chrome M28 & above uses below TURN format.
// Plugin:
// - Creates Ice Server for Plugin Browsers
//   - If Stun - Create iceServer with stun url.
//   - Else - Create iceServer with turn url
//   - This is a WebRTC Function
createIceServer = null;

// Firefox:
// - Creates IceServers for Firefox
//   - Use .url for FireFox.
//   - Multiple Urls support
// Chrome:
// - Creates iceServers from the urls for Chrome M34 and above.
//   - .urls is supported since Chrome M34.
//   - Multiple Urls support
// Plugin:
// - Creates Ice Servers for Plugin Browsers
//   - Multiple Urls support
//   - This is a WebRTC Function
createIceServers = null;
//------------------------------------------------------------

//The RTCPeerConnection object.
RTCPeerConnection = null;

// Creates RTCSessionDescription object for Plugin Browsers
RTCSessionDescription = (typeof RTCSessionDescription === 'function') ?
  RTCSessionDescription : null;

// Creates RTCIceCandidate object for Plugin Browsers
RTCIceCandidate = (typeof RTCIceCandidate === 'function') ?
  RTCIceCandidate : null;

// Get UserMedia (only difference is the prefix).
// Code from Adam Barth.
getUserMedia = null;

// Attach a media stream to an element.
attachMediaStream = null;

// Re-attach a media stream to an element.
reattachMediaStream = null;

// Detected browser agent name. Types are:
// - 'firefox': Firefox browser.
// - 'chrome': Chrome browser.
// - 'opera': Opera browser.
// - 'safari': Safari browser.
// - 'IE' - Internet Explorer browser.
webrtcDetectedBrowser = null;

// Detected browser version.
webrtcDetectedVersion = null;

// Check for browser types and react accordingly
if (navigator.mozGetUserMedia) {
  webrtcDetectedBrowser = 'firefox';
  webrtcDetectedVersion = parseInt(navigator
    .userAgent.match(/Firefox\/([0-9]+)\./)[1], 10);
  webrtcDetectedType = 'moz';
  webrtcDetectedDCSupport = 'SCTP';

  RTCPeerConnection = function (pcConfig, pcConstraints) {
    AdapterJS.maybeFixConfiguration(pcConfig);
    return new mozRTCPeerConnection(pcConfig, pcConstraints);
  };

 // The RTCSessionDescription object.
  RTCSessionDescription = mozRTCSessionDescription;
  window.RTCSessionDescription = RTCSessionDescription;

  // The RTCIceCandidate object.
  RTCIceCandidate = mozRTCIceCandidate;
  window.RTCIceCandidate = RTCIceCandidate;

  window.getUserMedia = navigator.mozGetUserMedia.bind(navigator);
  navigator.getUserMedia = window.getUserMedia;

  // Shim for MediaStreamTrack.getSources.
  MediaStreamTrack.getSources = function(successCb) {
    setTimeout(function() {
      var infos = [
        { kind: 'audio', id: 'default', label:'', facing:'' },
        { kind: 'video', id: 'default', label:'', facing:'' }
      ];
      successCb(infos);
    }, 0);
  };

  createIceServer = function (url, username, password) {
    var iceServer = null;
    var url_parts = url.split(':');
    if (url_parts[0].indexOf('stun') === 0) {
      iceServer = { url : url };
    } else if (url_parts[0].indexOf('turn') === 0) {
      if (webrtcDetectedVersion < 27) {
        var turn_url_parts = url.split('?');
        if (turn_url_parts.length === 1 ||
          turn_url_parts[1].indexOf('transport=udp') === 0) {
          iceServer = {
            url : turn_url_parts[0],
            credential : password,
            username : username
          };
        }
      } else {
        iceServer = {
          url : url,
          credential : password,
          username : username
        };
      }
    }
    return iceServer;
  };

  createIceServers = function (urls, username, password) {
    var iceServers = [];
    for (i = 0; i < urls.length; i++) {
      var iceServer = createIceServer(urls[i], username, password);
      if (iceServer !== null) {
        iceServers.push(iceServer);
      }
    }
    return iceServers;
  };

  attachMediaStream = function (element, stream) {
    element.mozSrcObject = stream;
    if (stream !== null)
      element.play();

    return element;
  };

  reattachMediaStream = function (to, from) {
    to.mozSrcObject = from.mozSrcObject;
    to.play();
    return to;
  };

  MediaStreamTrack.getSources = MediaStreamTrack.getSources || function (callback) {
    if (!callback) {
      throw new TypeError('Failed to execute \'getSources\' on \'MediaStreamTrack\'' +
        ': 1 argument required, but only 0 present.');
    }
    return callback([]);
  };

  // Fake get{Video,Audio}Tracks
  if (!MediaStream.prototype.getVideoTracks) {
    MediaStream.prototype.getVideoTracks = function () {
      return [];
    };
  }
  if (!MediaStream.prototype.getAudioTracks) {
    MediaStream.prototype.getAudioTracks = function () {
      return [];
    };
  }

  AdapterJS.maybeThroughWebRTCReady();
} else if (navigator.webkitGetUserMedia) {
  webrtcDetectedBrowser = 'chrome';
  webrtcDetectedType = 'webkit';
  webrtcDetectedVersion = parseInt(navigator
    .userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2], 10);
  // check if browser is opera 20+
  var checkIfOpera = navigator.userAgent.match(/\bOPR\/(\d+)/);
  if (checkIfOpera !== null) {
    webrtcDetectedBrowser = 'opera';
    webrtcDetectedVersion = parseInt(checkIfOpera[1], 10);
  }
  // check browser datachannel support
  if ((webrtcDetectedBrowser === 'chrome' && webrtcDetectedVersion >= 31) ||
    (webrtcDetectedBrowser === 'opera' && webrtcDetectedVersion >= 20)) {
    webrtcDetectedDCSupport = 'SCTP';
  } else if (webrtcDetectedBrowser === 'chrome' && webrtcDetectedVersion < 30 &&
    webrtcDetectedVersion > 24) {
    webrtcDetectedDCSupport = 'RTP';
  } else {
    webrtcDetectedDCSupport = '';
  }

  createIceServer = function (url, username, password) {
    var iceServer = null;
    var url_parts = url.split(':');
    if (url_parts[0].indexOf('stun') === 0) {
      iceServer = { 'url' : url };
    } else if (url_parts[0].indexOf('turn') === 0) {
      iceServer = {
        'url' : url,
        'credential' : password,
        'username' : username
      };
    }
    return iceServer;
  };

  createIceServers = function (urls, username, password) {
    var iceServers = [];
    if (webrtcDetectedVersion >= 34) {
      iceServers = {
        'urls' : urls,
        'credential' : password,
        'username' : username
      };
    } else {
      for (i = 0; i < urls.length; i++) {
        var iceServer = createIceServer(urls[i], username, password);
        if (iceServer !== null) {
          iceServers.push(iceServer);
        }
      }
    }
    return iceServers;
  };

  RTCPeerConnection = function (pcConfig, pcConstraints) {
    if (webrtcDetectedVersion < 34) {
      AdapterJS.maybeFixConfiguration(pcConfig);
    }
    return new webkitRTCPeerConnection(pcConfig, pcConstraints);
  };

  window.getUserMedia = navigator.webkitGetUserMedia.bind(navigator);
  navigator.getUserMedia = window.getUserMedia;

  attachMediaStream = function (element, stream) {
    if (typeof element.srcObject !== 'undefined') {
      element.srcObject = stream;
    } else if (typeof element.mozSrcObject !== 'undefined') {
      element.mozSrcObject = stream;
    } else if (typeof element.src !== 'undefined') {
      element.src = (stream === null ? '' : URL.createObjectURL(stream));
    } else {
      console.log('Error attaching stream to element.');
    }
    return element;
  };

  reattachMediaStream = function (to, from) {
    to.src = from.src;
    return to;
  };

  AdapterJS.maybeThroughWebRTCReady();
} else if (navigator.mediaDevices && navigator.userAgent.match(
    /Edge\/(\d+).(\d+)$/)) {
  webrtcDetectedBrowser = 'edge';

  webrtcDetectedVersion =
    parseInt(navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10);

  // the minimum version still supported by adapter.
  webrtcMinimumVersion = 12;

  window.getUserMedia = navigator.getUserMedia.bind(navigator);

  attachMediaStream = function(element, stream) {
    element.srcObject = stream;
    return element;
  };
  reattachMediaStream = function(to, from) {
    to.srcObject = from.srcObject;
    return to;
  };

  AdapterJS.maybeThroughWebRTCReady();
} else { // TRY TO USE PLUGIN
  // IE 9 is not offering an implementation of console.log until you open a console
  if (typeof console !== 'object' || typeof console.log !== 'function') {
    /* jshint -W020 */
    console = {} || console;
    // Implemented based on console specs from MDN
    // You may override these functions
    console.log = function (arg) {};
    console.info = function (arg) {};
    console.error = function (arg) {};
    console.dir = function (arg) {};
    console.exception = function (arg) {};
    console.trace = function (arg) {};
    console.warn = function (arg) {};
    console.count = function (arg) {};
    console.debug = function (arg) {};
    console.count = function (arg) {};
    console.time = function (arg) {};
    console.timeEnd = function (arg) {};
    console.group = function (arg) {};
    console.groupCollapsed = function (arg) {};
    console.groupEnd = function (arg) {};
    /* jshint +W020 */
  }
  webrtcDetectedType = 'plugin';
  webrtcDetectedDCSupport = 'plugin';
  AdapterJS.parseWebrtcDetectedBrowser();
  isIE = webrtcDetectedBrowser === 'IE';

  /* jshint -W035 */
  AdapterJS.WebRTCPlugin.WaitForPluginReady = function() {
    while (AdapterJS.WebRTCPlugin.pluginState !== AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY) {
      /* empty because it needs to prevent the function from running. */
    }
  };
  /* jshint +W035 */

  AdapterJS.WebRTCPlugin.callWhenPluginReady = function (callback) {
    if (AdapterJS.WebRTCPlugin.pluginState === AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY) {
      // Call immediately if possible
      // Once the plugin is set, the code will always take this path
      callback();
    } else {
      // otherwise start a 100ms interval
      var checkPluginReadyState = setInterval(function () {
        if (AdapterJS.WebRTCPlugin.pluginState === AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY) {
          clearInterval(checkPluginReadyState);
          callback();
        }
      }, 100);
    }
  };

  AdapterJS.WebRTCPlugin.setLogLevel = function(logLevel) {
    AdapterJS.WebRTCPlugin.callWhenPluginReady(function() {
      AdapterJS.WebRTCPlugin.plugin.setLogLevel(logLevel);
    });
  };

  AdapterJS.WebRTCPlugin.injectPlugin = function () {
    // only inject once the page is ready
    if (document.readyState !== 'complete') {
      return;
    }

    // Prevent multiple injections
    if (AdapterJS.WebRTCPlugin.pluginState !== AdapterJS.WebRTCPlugin.PLUGIN_STATES.INITIALIZING) {
      return;
    }

    AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.INJECTING;

    if (webrtcDetectedBrowser === 'IE' && webrtcDetectedVersion <= 10) {
      var frag = document.createDocumentFragment();
      AdapterJS.WebRTCPlugin.plugin = document.createElement('div');
      AdapterJS.WebRTCPlugin.plugin.innerHTML = '<object id="' +
        AdapterJS.WebRTCPlugin.pluginInfo.pluginId + '" type="' +
        AdapterJS.WebRTCPlugin.pluginInfo.type + '" ' + 'width="1" height="1">' +
        '<param name="pluginId" value="' +
        AdapterJS.WebRTCPlugin.pluginInfo.pluginId + '" /> ' +
        '<param name="windowless" value="false" /> ' +
        '<param name="pageId" value="' + AdapterJS.WebRTCPlugin.pageId + '" /> ' +
        '<param name="onload" value="' + AdapterJS.WebRTCPlugin.pluginInfo.onload + '" />' +
        '<param name="tag" value="' + AdapterJS.WebRTCPlugin.TAGS.NONE + '" />' +
        // uncomment to be able to use virtual cams
        (AdapterJS.options.getAllCams ? '<param name="forceGetAllCams" value="True" />':'') +

        '</object>';
      while (AdapterJS.WebRTCPlugin.plugin.firstChild) {
        frag.appendChild(AdapterJS.WebRTCPlugin.plugin.firstChild);
      }
      document.body.appendChild(frag);

      // Need to re-fetch the plugin
      AdapterJS.WebRTCPlugin.plugin =
        document.getElementById(AdapterJS.WebRTCPlugin.pluginInfo.pluginId);
    } else {
      // Load Plugin
      AdapterJS.WebRTCPlugin.plugin = document.createElement('object');
      AdapterJS.WebRTCPlugin.plugin.id =
        AdapterJS.WebRTCPlugin.pluginInfo.pluginId;
      // IE will only start the plugin if it's ACTUALLY visible
      if (isIE) {
        AdapterJS.WebRTCPlugin.plugin.width = '1px';
        AdapterJS.WebRTCPlugin.plugin.height = '1px';
      } else { // The size of the plugin on Safari should be 0x0px
              // so that the autorisation prompt is at the top
        AdapterJS.WebRTCPlugin.plugin.width = '0px';
        AdapterJS.WebRTCPlugin.plugin.height = '0px';
      }
      AdapterJS.WebRTCPlugin.plugin.type = AdapterJS.WebRTCPlugin.pluginInfo.type;
      AdapterJS.WebRTCPlugin.plugin.innerHTML = '<param name="onload" value="' +
        AdapterJS.WebRTCPlugin.pluginInfo.onload + '">' +
        '<param name="pluginId" value="' +
        AdapterJS.WebRTCPlugin.pluginInfo.pluginId + '">' +
        '<param name="windowless" value="false" /> ' +
        (AdapterJS.options.getAllCams ? '<param name="forceGetAllCams" value="True" />':'') +
        '<param name="pageId" value="' + AdapterJS.WebRTCPlugin.pageId + '">' +
        '<param name="tag" value="' + AdapterJS.WebRTCPlugin.TAGS.NONE + '" />';
      document.body.appendChild(AdapterJS.WebRTCPlugin.plugin);
    }

    AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.INJECTED;
  };

  AdapterJS.WebRTCPlugin.isPluginInstalled =
    function (comName, plugName, installedCb, notInstalledCb) {
    if (!isIE) {
      var pluginArray = navigator.plugins;
      for (var i = 0; i < pluginArray.length; i++) {
        if (pluginArray[i].name.indexOf(plugName) >= 0) {
          installedCb();
          return;
        }
      }
      notInstalledCb();
    } else {
      try {
        var axo = new ActiveXObject(comName + '.' + plugName);
      } catch (e) {
        notInstalledCb();
        return;
      }
      installedCb();
    }
  };

  AdapterJS.WebRTCPlugin.defineWebRTCInterface = function () {
    if (AdapterJS.WebRTCPlugin.pluginState ===
        AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY) {
      console.error("AdapterJS - WebRTC interface has already been defined");
      return;
    }

    AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.INITIALIZING;

    AdapterJS.isDefined = function (variable) {
      return variable !== null && variable !== undefined;
    };

    createIceServer = function (url, username, password) {
      var iceServer = null;
      var url_parts = url.split(':');
      if (url_parts[0].indexOf('stun') === 0) {
        iceServer = {
          'url' : url,
          'hasCredentials' : false
        };
      } else if (url_parts[0].indexOf('turn') === 0) {
        iceServer = {
          'url' : url,
          'hasCredentials' : true,
          'credential' : password,
          'username' : username
        };
      }
      return iceServer;
    };

    createIceServers = function (urls, username, password) {
      var iceServers = [];
      for (var i = 0; i < urls.length; ++i) {
        iceServers.push(createIceServer(urls[i], username, password));
      }
      return iceServers;
    };

    RTCSessionDescription = function (info) {
      AdapterJS.WebRTCPlugin.WaitForPluginReady();
      return AdapterJS.WebRTCPlugin.plugin.
        ConstructSessionDescription(info.type, info.sdp);
    };

    RTCPeerConnection = function (servers, constraints) {
      var iceServers = null;
      if (servers) {
        iceServers = servers.iceServers;
        for (var i = 0; i < iceServers.length; i++) {
          if (iceServers[i].urls && !iceServers[i].url) {
            iceServers[i].url = iceServers[i].urls;
          }
          iceServers[i].hasCredentials = AdapterJS.
            isDefined(iceServers[i].username) &&
            AdapterJS.isDefined(iceServers[i].credential);
        }
      }
      var mandatory = (constraints && constraints.mandatory) ?
        constraints.mandatory : null;
      var optional = (constraints && constraints.optional) ?
        constraints.optional : null;

      AdapterJS.WebRTCPlugin.WaitForPluginReady();
      return AdapterJS.WebRTCPlugin.plugin.
        PeerConnection(AdapterJS.WebRTCPlugin.pageId,
        iceServers, mandatory, optional);
    };

    MediaStreamTrack = {};
    MediaStreamTrack.getSources = function (callback) {
      AdapterJS.WebRTCPlugin.callWhenPluginReady(function() {
        AdapterJS.WebRTCPlugin.plugin.GetSources(callback);
      });
    };

    window.getUserMedia = function (constraints, successCallback, failureCallback) {
      constraints.audio = constraints.audio || false;
      constraints.video = constraints.video || false;

      AdapterJS.WebRTCPlugin.callWhenPluginReady(function() {
        AdapterJS.WebRTCPlugin.plugin.
          getUserMedia(constraints, successCallback, failureCallback);
      });
    };
    window.navigator.getUserMedia = window.getUserMedia;

    attachMediaStream = function (element, stream) {
      if (!element || !element.parentNode) {
        return;
      }

      var streamId
      if (stream === null) {
        streamId = '';
      }
      else {
        stream.enableSoundTracks(true); // TODO: remove on 0.12.0
        streamId = stream.id;
      }

      var elementId = element.id.length === 0 ? Math.random().toString(36).slice(2) : element.id;
      var nodeName = element.nodeName.toLowerCase();
      if (nodeName !== 'object') { // not a plugin <object> tag yet
        var tag;
        switch(nodeName) {
          case 'audio':
            tag = AdapterJS.WebRTCPlugin.TAGS.AUDIO;
            break;
          case 'video':
            tag = AdapterJS.WebRTCPlugin.TAGS.VIDEO;
            break;
          default:
            tag = AdapterJS.WebRTCPlugin.TAGS.NONE;
          }

        var frag = document.createDocumentFragment();
        var temp = document.createElement('div');
        var classHTML = '';
        if (element.className) {
          classHTML = 'class="' + element.className + '" ';
        } else if (element.attributes && element.attributes['class']) {
          classHTML = 'class="' + element.attributes['class'].value + '" ';
        }

        temp.innerHTML = '<object id="' + elementId + '" ' + classHTML +
          'type="' + AdapterJS.WebRTCPlugin.pluginInfo.type + '">' +
          '<param name="pluginId" value="' + elementId + '" /> ' +
          '<param name="pageId" value="' + AdapterJS.WebRTCPlugin.pageId + '" /> ' +
          '<param name="windowless" value="true" /> ' +
          '<param name="streamId" value="' + streamId + '" /> ' +
          '<param name="tag" value="' + tag + '" /> ' +
          '</object>';
        while (temp.firstChild) {
          frag.appendChild(temp.firstChild);
        }

        var height = '';
        var width = '';
        if (element.getBoundingClientRect) {
          var rectObject = element.getBoundingClientRect();
          width = rectObject.width + 'px';
          height = rectObject.height + 'px';
        }
        else if (element.width) {
          width = element.width;
          height = element.height;
        } else {
          // TODO: What scenario could bring us here?
        }

        element.parentNode.insertBefore(frag, element);
        frag = document.getElementById(elementId);
        frag.width = width;
        frag.height = height;
        element.parentNode.removeChild(element);
      } else { // already an <object> tag, just change the stream id
        var children = element.children;
        for (var i = 0; i !== children.length; ++i) {
          if (children[i].name === 'streamId') {
            children[i].value = streamId;
            break;
          }
        }
        element.setStreamId(streamId);
      }
      var newElement = document.getElementById(elementId);
      newElement.onplaying = (element.onplaying) ? element.onplaying : function (arg) {};
      newElement.onplay    = (element.onplay)    ? element.onplay    : function (arg) {};
      newElement.onclick   = (element.onclick)   ? element.onclick   : function (arg) {};
      if (isIE) { // on IE the event needs to be plugged manually
        newElement.attachEvent('onplaying', newElement.onplaying);
        newElement.attachEvent('onplay', newElement.onplay);
        newElement._TemOnClick = function (id) {
          var arg = {
            srcElement : document.getElementById(id)
          };
          newElement.onclick(arg);
        };
      }

      return newElement;
    };

    reattachMediaStream = function (to, from) {
      var stream = null;
      var children = from.children;
      for (var i = 0; i !== children.length; ++i) {
        if (children[i].name === 'streamId') {
          AdapterJS.WebRTCPlugin.WaitForPluginReady();
          stream = AdapterJS.WebRTCPlugin.plugin
            .getStreamWithId(AdapterJS.WebRTCPlugin.pageId, children[i].value);
          break;
        }
      }
      if (stream !== null) {
        return attachMediaStream(to, stream);
      } else {
        console.log('Could not find the stream associated with this element');
      }
    };

    RTCIceCandidate = function (candidate) {
      if (!candidate.sdpMid) {
        candidate.sdpMid = '';
      }

      AdapterJS.WebRTCPlugin.WaitForPluginReady();
      return AdapterJS.WebRTCPlugin.plugin.ConstructIceCandidate(
        candidate.sdpMid, candidate.sdpMLineIndex, candidate.candidate
      );
    };

    // inject plugin
    AdapterJS.addEvent(document, 'readystatechange', AdapterJS.WebRTCPlugin.injectPlugin);
    AdapterJS.WebRTCPlugin.injectPlugin();
  };

  // This function will be called if the plugin is needed (browser different
  // from Chrome or Firefox), but the plugin is not installed.
  AdapterJS.WebRTCPlugin.pluginNeededButNotInstalledCb = AdapterJS.WebRTCPlugin.pluginNeededButNotInstalledCb ||
    function() {
      AdapterJS.addEvent(document,
                        'readystatechange',
                         AdapterJS.WebRTCPlugin.pluginNeededButNotInstalledCbPriv);
      AdapterJS.WebRTCPlugin.pluginNeededButNotInstalledCbPriv();
    };

  AdapterJS.WebRTCPlugin.pluginNeededButNotInstalledCbPriv = function () {
    if (AdapterJS.options.hidePluginInstallPrompt) {
      return;
    }

    var downloadLink = AdapterJS.WebRTCPlugin.pluginInfo.downloadLink;
    if(downloadLink) { // if download link
      var popupString;
      if (AdapterJS.WebRTCPlugin.pluginInfo.portalLink) { // is portal link
       popupString = 'This website requires you to install the ' +
        ' ' + AdapterJS.WebRTCPlugin.pluginInfo.companyName +
        ' WebRTC Plugin' +
        ' to work on this browser.';
      } else { // no portal link, just print a generic explanation
       popupString = AdapterJS.TEXT.PLUGIN.REQUIRE_INSTALLATION;
      }

      AdapterJS.renderNotificationBar(popupString, AdapterJS.TEXT.PLUGIN.BUTTON, downloadLink);
    } else { // no download link, just print a generic explanation
      AdapterJS.renderNotificationBar(AdapterJS.TEXT.PLUGIN.NOT_SUPPORTED);
    }
  };

  // Try to detect the plugin and act accordingly
  AdapterJS.WebRTCPlugin.isPluginInstalled(
    AdapterJS.WebRTCPlugin.pluginInfo.prefix,
    AdapterJS.WebRTCPlugin.pluginInfo.plugName,
    AdapterJS.WebRTCPlugin.defineWebRTCInterface,
    AdapterJS.WebRTCPlugin.pluginNeededButNotInstalledCb);
}


text:
<TITLE>Review for Lost in Space (1998)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Lost in Space (1998)

reviewed by
Chad Polenz

Lost In Space

Chad'z rating: * (out of 4 = poor)

1998, PG-13, 130 minutes [2 hours, 10 minutes]
[science fiction]

starring: William Hurt (Prof. John Robinson), Matt Leblanc (Major Don
West), Gary Oldman (Dr. Smith), Heather Graham (Judy Robinson);
written by Akiva Goldsman; produced by Carla Fry, Akiva Goldsman,
Stephen Hopkins, Mark W.  Koch; directed by Stephen Hopkins; based on
the 1965 CBS television series.

Seen May 2, 1998 at 3:40 p.m. at the Crossgates Cinema 18, theater
#13, with Chris Wessell and Sean O'Shea for $5. [Theater rating:
***1/2: very good sound, picture, and seats]

        The big-budget, mega-hype "event" movie is becoming so trendy
now it is becoming a weekly routine instead of a seasonal
one. Gluttony is Hollywood's favorite sin, but it is the movie-goers
who pay the price by being dealt the same things over and over on an
ever-worsening basis. "Lost In Space" is the latest such offering - a
film so poor it would be twice as good if it were mediocre. It's made
up of every element of science fiction, but at no time does it evoke
the slightest amount of wonderment the genre was meant for.

        Audiences' attention spans are rapidly decreasing and as is
the trend with such films, this one opens with a fast-paced space
battle which serves not only as the most interesting scene in the film
(probably because it has "Star Wars" written all over it), but as the
producers' way of showing off their budget through the special
effects. Battle scenes are worthless without tension, and since we
have no idea what the setting is it's impossible to care about
anything that happens. In essence, the entire segment works like a
teaser for an arcade game, not a piece of filmmaking.

        We meet the Robinson family - a family of five that does not
get along but has been chosen to act on Earth's behalf in effort to
find another planet worthy of colonization due to the exhausting of
our natural resources. Each member of the family has a special trait
and personality, and yet none of them seem like actual
people. Professor John Robinson (Hurt) is the intelligent, quiet
leader who has devoted so much time to his work his family and
marriage are suffering without his realizing it (it's obvious what
role this aspect will play). Of course this is all established through
extremely melodramatic scenes such as the children and parents arguing
and bickering among themselves and with each other, while the
necessary problems are "resolved" at the right moments. The only thing
worse than the screenplay is the fact it's presented in a completely
serious manner without a trace of satire, and is so pathetic it's
laughable.

        The first act is not a building of a story, but a
juxtaposition of scenes that serve no purpose other than to plug in
all the required elements (such as plot, conflict, and
characterization - God forbid!). We're provided with the minimum
amount possible of these elements to keep the film from being
completely silent. In fact, it might as well be since the dialogue is
virtually non-existent. Yes, the characters do speak, but they do not
talk.  They say things that only relate to the conflict, but they
never really interact (unless it's the cartoony flirting scenes
between arrogant Major Don West (Leblanc) and uptight, unemotional
Judy Robinson (Graham)).

        It's amazing that after an hour of trite dialogue and generic
plot devices that so little happens. Eventually the pacing rapidly
increases, but the amount of genuine interest does not. The story
finally gains some prospective by living up to its title as the
Robinsons find themselves lost in space after narrowly managing to
defeat Dr. Smith (Oldman), the cartoony villain, and his plans for
sabotage.

        What ensues is a series upon series of completely unrelated
conflicts. The first such scene takes place on an abandoned spaceship
and what ensues could best be described as "Alien"-lite. The story
changes again when the Robinsons crash land on an alien planet and
must act quickly to escape it and survive.  But there's never any real
notion of suspense here because the script constantly wanders
aimlessly. Plotlines are developed, but each becomes totally
irrelevant as the story changes from scenario to scenario. The
atmosphere attempts to be surreal by incorporating time travel and
various time paradoxes, but it's presented in such a ridiculous way
it's utterly boring. By the time the last act rolls around, there is
no sense of a payoff building. The ending does not go out on a high
note with any kind of climax, instead, it seems to come to a sudden
halt (but at least it ends at all).

        "Lost In Space" is major film production at its worst. It's
frightening that a film so poorly written, directed, and acted might
be considered mainstream entertainment.

Please visit Chad'z Movie Page at:
 http://members.aol.com/ChadPolenz - over 190 new and old films
reviewed in depth, not just blind ratings and quick capsules.

e-mail: ChadPolenz@aol.com
(C) 1998 Chad Polenz

Member of:
The Online Film Critics Society (OFCS)
The Internet Movie Critics Association (IMCA)
The Online Movie-Goers Academy (OMGA)

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
/*! \file system/system_error.h
 *  \brief An exception object used to report error conditions that have an
 *         associated error code
 */

#pragma once

#include <thrust/detail/config.h>
#include <stdexcept>
#include <string>

#include <thrust/system/error_code.h>

namespace thrust
{

namespace system
{

// [19.5.5] Class system_error

// [19.5.5.1] Class system_error overview

/*! \addtogroup system_diagnostics System Diagnostics
 *  \ingroup system
 *  \{
 */

/*! \brief The class \p system_error describes an exception object used to report error
 *  conditions that have an associated \p error_code. Such error conditions typically
 *  originate from the operating system or other low-level application program interfaces.
 *
 *  Thrust uses \p system_error to report the error codes returned from device backends
 *  such as the CUDA runtime.
 *
 *  The following code listing demonstrates how to catch a \p system_error to recover
 *  from an error.
 *
 *  \code
 *
 *  #include <thrust/device_vector.h>
 *  #include <thrust/system.h>
 *  #include <thrust/sort.h>
 *
 *  void terminate_gracefully(void)
 *  {
 *    // application-specific termination code here
 *    ...
 *  }
 *
 *  int main(void)
 *  {
 *    try
 *    {
 *      thrust::device_vector<float> vec;
 *      thrust::sort(vec.begin(), vec.end());
 *    }
 *    catch(thrust::system_error e)
 *    {
 *      std::cerr << "Error inside sort: " << e.what() << std::endl;
 *      terminate_gracefully();
 *    }
 *
 *    return 0;
 *  }
 *
 *  \endcode
 *
 *  \note If an error represents an out-of-memory condition, implementations are encouraged
 *  to throw an exception object of type \p std::bad_alloc rather than \p system_error.
 */
class system_error
  : public std::runtime_error
{
  public:
    // [19.5.5.2] Class system_error members

    /*! Constructs an object of class \p system_error.
     *  \param ec The value returned by \p code().
     *  \param what_arg A string to include in the result returned by \p what().
     *  \post <tt>code() == ec</tt>.
     *  \post <tt>std::string(what()).find(what_arg) != string::npos</tt>.
     */
    inline system_error(error_code ec, const std::string &what_arg);

    /*! Constructs an object of class \p system_error.
     *  \param ec The value returned by \p code().
     *  \param what_arg A string to include in the result returned by \p what().
     *  \post <tt>code() == ec</tt>.
     *  \post <tt>std::string(what()).find(what_arg) != string::npos</tt>.
     */
    inline system_error(error_code ec, const char *what_arg);

    /*! Constructs an object of class \p system_error.
     *  \param ec The value returned by \p code().
     *  \post <tt>code() == ec</tt>.
     */
    inline system_error(error_code ec);

    /*! Constructs an object of class \p system_error.
     *  \param ev The error value used to create an \p error_code.
     *  \param ecat The \p error_category used to create an \p error_code.
     *  \param what_arg A string to include in the result returned by \p what().
     *  \post <tt>code() == error_code(ev, ecat)</tt>.
     *  \post <tt>std::string(what()).find(what_arg) != string::npos</tt>.
     */
    inline system_error(int ev, const error_category &ecat, const std::string &what_arg);

    /*! Constructs an object of class \p system_error.
     *  \param ev The error value used to create an \p error_code.
     *  \param ecat The \p error_category used to create an \p error_code.
     *  \param what_arg A string to include in the result returned by \p what().
     *  \post <tt>code() == error_code(ev, ecat)</tt>.
     *  \post <tt>std::string(what()).find(what_arg) != string::npos</tt>.
     */
    inline system_error(int ev, const error_category &ecat, const char *what_arg);

    /*! Constructs an object of class \p system_error.
     *  \param ev The error value used to create an \p error_code.
     *  \param ecat The \p error_category used to create an \p error_code.
     *  \post <tt>code() == error_code(ev, ecat)</tt>.
     */
    inline system_error(int ev, const error_category &ecat);

    /*! Destructor does not throw.
     */
    inline virtual ~system_error(void) throw () {};

    /*! Returns an object encoding the error.
     *  \return <tt>ec</tt> or <tt>error_code(ev, ecat)</tt>, from the
     *          constructor, as appropriate.
     */
    inline const error_code &code(void) const throw();

    /*! Returns a human-readable string indicating the nature of the error.
     *  \return a string incorporating <tt>code().message()</tt> and the
     *          arguments supplied in the constructor.
     */
    inline const char *what(void) const throw();

    /*! \cond
     */
  private:
    error_code          m_error_code;
    mutable std::string m_what;

    /*! \endcond
     */
}; // end system_error

} // end system

/*! \} // end system_diagnostics
 */

// import names into thrust::
using system::system_error;

} // end thrust

#include <thrust/system/detail/system_error.inl>


text:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;

namespace Test.Orm
{
  public class Shop : Sdx.Db.Record
  {
    public static Sdx.Db.TableMeta Meta { get; private set; }

    static Shop()
    {
      Meta = Test.Orm.Table.Shop.Meta;
    }

    public void SetRawPassword(string rawPassword)
    {
      if (rawPassword == "")
      {
        return;
      }
      //本当はhash化するが確認しやすいように文字列追加のみ。
      SetValue("password", "HASH@" + rawPassword);
    }

    public string GetCategoryNames(Sdx.Db.Connection conn = null)
    {
      var categories = GetRecordSet("shop_category", conn);
      return string.Join(" / ", categories.ToStringArray(rec => rec.GetRecord("category", conn).GetString("name")));
    }
  }
}


text:
@interface EvstOfflineTests : EvstKIFMockTestCase

@end


text:
using System;
using System.Linq;
using dotNETBlackJack.Logic;
using dotNETBlackJack.Objects;

namespace dotNETBlackJack.ConsoleApp
{
    internal class Program
    {
        private static readonly GameController _gameController = new GameController();
        private static readonly Game _game = new Game();

        private static void Main(string[] args)
        {
            Start();
            bool running = true;
            while (running)
            {
                ConsoleKeyInfo key = Console.ReadKey();
                if (key.Key == ConsoleKey.Q)
                {
                    running = false;
                }
                else if (key.Key == ConsoleKey.D)
                {
                    Deal(_game);
                    Console.WriteLine("Play again? (D)eal, (Q)uit");
                }
            }
        }

        private static void Deal(Game game)
        {
            Console.WriteLine("");
            _gameController.Deal(game);
            _gameController.CheckWinLossStatus(game);
            ShowUpdatedStatus(game);
            Console.WriteLine("");
            while (game.Status != GameStatus.AllPlayersComplete && game.Status!=GameStatus.Complete)
            {
                WaitForPlayerAction(game);
                ShowUpdatedStatus(game);
            }
            ShowUpdatedStatus(game);

        }

        private static void ShowUpdatedStatus(Game game)
        {
            Console.Clear();
            Console.WriteLine("Game Status: " + game.Status);
            PrintHandDetail(game.Dealer,game.Status.Equals(GameStatus.Complete));
            int playerId = 0;
            Player player = game.Players[playerId];
            PrintHandDetail(player, game.Status.Equals(GameStatus.Complete));
        }

        private static void PrintHandDetail(Player player, bool isComplete)
        {
            if (isComplete || player.GetType() != typeof(Dealer))
            {
                Console.Write("{0}: \t{1}"
                              , player.Name
                              , player.Hand.Cards.Select(card => card.SuitChar.ToString() + " " + card.Value)
                                      .Aggregate((c, c1) => c + "\t" + c1) + "\t");
            }
            else
            {
                //Mask the Dealer's second card
                Console.Write("{0}: \t{1}"
                              , player.Name
                              , player.Hand.Cards.Select(card => card.SuitChar.ToString() + " " + card.Value)
                                      .Aggregate((c, c1) => c + "\t??") + "\t");
            }
            if (isComplete)
            {
                PrintWinLossString(player);
            }
            Console.WriteLine("");
        }

        private static void PrintWinLossString(Player player)
        {
            if (player.Status != Status.Undetermined || player.GetType() == typeof(Dealer))
            {
                Console.ForegroundColor = (player.Status == Status.Win) ? ConsoleColor.Green : ConsoleColor.Red;
                Console.Write("{0} ({1})", player.Status.ToString(), player.Hand.Evaluate());
                Console.ForegroundColor=ConsoleColor.White;
            }
            Console.WriteLine("");
        }

        private static void WaitForPlayerAction(Game game)
        {
            int playerId = 0;
            Player player = game.Players[playerId];
            Console.WriteLine("");
            Console.WriteLine("Player: (S)tand or (H)it?");
            ConsoleKeyInfo key = Console.ReadKey();
            if (key.Key == ConsoleKey.H)
            {
                _gameController.Hit(playerId, game);
            }
            if (key.Key == ConsoleKey.S)
            {
                _gameController.Stand(playerId, game);
            }
        }

        private static void Start()
        {
            _gameController.InitializeGame(_game);
            Console.Clear();
            Console.WriteLine("dotNETBlackJack - Console");
            Console.WriteLine("Available Actions:");
            Console.WriteLine("(D)eal, (Q)uit");
        }
    }
}


text:
angular.module('AcompanhoServices').factory('EntryService', ['Restangular', function(Restangular) {
  'use strict';

  var service = {};

  service.find = function(entryId, read) {
    return Restangular.one('entries', entryId).get({
      read: read
    });
  };

  return service;
}]);


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Login Medicine Automation</title>
    <link rel="stylesheet" href="/login.css" media="screen" title="no title" charset="utf-8">
    <link rel="import" href="/dependencies.html">

          Sign in with Google

      Authorize access to Google Calendar API

      <button id="authorize-button" onclick="handleAuthClick(event)">Authorize</button>

    <button onclick="hhhhh()">
      Add
    </button>


text:
use strict;

package XML::Grove::Sub;

use Data::Grove::Visitor;

sub new {
    my $type = shift;
    return (bless {}, $type);
}

sub visit_document {
    my $self = shift; my $document = shift; my $sub = shift;
    return (&$sub($document, @_),
	    $document->children_accept ($self, $sub, @_));
}

sub visit_element {
    my $self = shift; my $element = shift; my $sub = shift;
    return (&$sub($element, @_),
	    $element->children_accept ($self, $sub, @_));
}

sub visit_entity {
    my $self = shift; my $entity = shift; my $sub = shift;
    return (&$sub($entity, @_));
}

sub visit_pi {
    my $self = shift; my $pi = shift; my $sub = shift;
    return (&$sub($pi, @_));
}

sub visit_comment {
    my $self = shift; my $comment = shift; my $sub = shift;
    return (&$sub($comment, @_));
}

sub visit_characters {
    my $self = shift; my $characters = shift; my $sub = shift;
    return (&$sub($characters, @_));
}

###
### Extend the XML::Grove::Document and XML::Grove::Element packages with our
### new function.
###

package XML::Grove::Document;

sub filter {
    my $self = shift; my $sub = shift;

    return ($self->accept(XML::Grove::Sub->new, $sub, @_));
}

package XML::Grove::Element;

sub filter {
    my $self = shift; my $sub = shift;

    return ($self->accept(XML::Grove::Sub->new, $sub, @_));
}

1;

__END__

=head1 NAME

XML::Grove::Sub - run a filter sub over a grove

=head1 SYNOPSIS

 use XML::Grove::Sub;

 # Using filter method on XML::Grove::Document or XML::Grove::Element:
 @results = $grove_object->filter(\&sub [, ...]);

 # Using an XML::Grove::Sub instance:
 $filterer = XML::Grove::Sub->new();
 @results = $grove_object->accept($filterer, \&sub [, ...]);

=head1 DESCRIPTION

C<XML::Grove::Sub> executes a sub, the filter, over all objects in a
grove and returns a list of all the return values from the sub.  The
sub is called with the grove object as it's first parameter and
passing the rest of the arguments to the call to `C<filter()>' or
`C<accept()>'.

=head1 EXAMPLE

The following filter will return a list of all `C<foo>' or `C<bar>'
elements with an attribute `C<widget-no>' beginning with `C<A>' or
`C<B>'.

  @results = $grove_obj->filter(sub {
      my $obj = shift;

      if ($obj->isa('XML::Grove::Element')
	  && (($obj->{Name} eq 'foo')
	      || ($obj->{Name} eq 'bar'))
	  && ($obj->{Attributes}{'widget-no'} =~ /^[AB]/)) {
	  return ($obj);
      }
      return ();
  });

=head1 AUTHOR

Ken MacLeod, ken@bitsko.slc.ut.us

=head1 SEE ALSO

perl(1), XML::Grove(3), Data::Grove::Visitor(3)

Extensible Markup Language (XML) <http://www.w3c.org/XML>

=cut


text:
require 'test_helper'

class RemoteWorldNetTest < Test::Unit::TestCase
  def setup
    @gateway = WorldNetGateway.new(fixtures(:world_net))

    @amount = 100
    @declined_amount = 101
    @credit_card = credit_card('3779810000000005')
    @options = {
      order_id: generate_order_id,
    }
    @refund_options = {
      operator: 'mr.nobody',
      reason: 'returned'
    }
  end

  def test_successful_purchase_moto
    gateway = WorldNetGateway.new(
      fixtures(:world_net).update(terminal_type: '1', transaction_type: '4')
    )
    response = gateway.purchase(@amount, @credit_card, @options)

    assert_success response
    assert_equal 'APPROVAL', response.message
  end

  def test_successful_purchase
    response = @gateway.purchase(@amount, @credit_card, @options)
    assert_success response
    assert_equal 'APPROVAL', response.message
  end

  def test_successful_purchase_with_more_options
    options = {
      order_id: generate_order_id,
      email: "joe@example.com",
      billing_address: address,
      description: 'Store Purchase',
      ip: "127.0.0.1",
    }

    response = @gateway.purchase(@amount, @credit_card, options)
    assert_success response
    assert_equal 'APPROVAL', response.message
  end

  def test_failed_purchase
    response = @gateway.purchase(@declined_amount, @credit_card, @options)
    assert_failure response
    assert_equal 'DECLINED', response.message
    assert_equal Gateway::STANDARD_ERROR_CODE[:card_declined], response.error_code

    response = @gateway.purchase(103, @credit_card, @options)
    assert_failure response
    assert_equal 'CVV FAILURE', response.message
    assert_equal Gateway::STANDARD_ERROR_CODE[:incorrect_cvc], response.error_code

    response = @gateway.purchase(@amount, credit_card('3779810000000005', month: '13'), @options)
    assert_failure response
    assert_equal 'Invalid CARDEXPIRY field', response.message
    assert_equal Gateway::STANDARD_ERROR_CODE[:invalid_expiry_date], response.error_code
  end

  def test_successful_authorize_and_capture
    auth = @gateway.authorize(@amount, @credit_card, @options)
    assert_success auth

    assert capture = @gateway.capture(@amount, auth.authorization)
    assert_success capture
    assert_equal 'APPROVAL', capture.message
  end

  def test_failed_authorize
    response = @gateway.authorize(@declined_amount, @credit_card, @options)
    assert_failure response
    assert_equal 'DECLINED', response.message
  end

  def test_partial_capture
    auth = @gateway.authorize(@amount, @credit_card, @options)
    assert_success auth

    assert capture = @gateway.capture(@amount-1, auth.authorization)
    assert_success capture
  end

  def test_failed_capture
    response = @gateway.capture(@amount, '')
    assert_failure response
    assert_match %r{not facet-valid with respect to minLength}, response.message
  end

  def test_successful_refund
    purchase = @gateway.purchase(@amount, @credit_card, @options)
    assert_success purchase

    assert refund = @gateway.refund(@amount, purchase.authorization, @refund_options)
    assert_success refund
    assert_equal 'SUCCESS', refund.message
  end

  def test_partial_refund
    purchase = @gateway.purchase(@amount, @credit_card, @options)
    assert_success purchase

    assert refund = @gateway.refund(@amount-1, purchase.authorization, @refund_options)
    assert_success refund
  end

  def test_failed_refund
    response = @gateway.refund(@amount, '', @refund_options)
    assert_failure response
    assert_match %r{not facet-valid with respect to minLength}, response.message
  end

  def test_successful_void
    auth = @gateway.authorize(@amount, @credit_card, @options)
    assert_success auth

    assert void = @gateway.void(auth.authorization)
  # UNSUPPORTED
  #   assert_success void
  #   assert_equal 'REPLACE WITH SUCCESSFUL VOID MESSAGE', response.message
  end

  def test_failed_void
    response = @gateway.void('')
    assert_failure response
    assert_match %r{Cannot find the declaration of element}, response.message
  end

  def test_invalid_login
    gateway = WorldNetGateway.new(terminal_id: '', secret: '')

    response = gateway.purchase(@amount, @credit_card, @options)
    assert_failure response
    assert_match %r{not facet-valid with respect to minLength}, response.message
  end

  def test_successful_store
    store = @gateway.store(@credit_card, @options)
    assert_success store
  end

  def test_unsuccessful_store
    store = @gateway.store(credit_card('3779810000000005', month: '13'), @options)
    assert_failure store
  end

  def test_successful_unstore
    response = @gateway.store(@credit_card, @options)
    assert_success response
    assert_equal nil, response.message
    card_reference = response.authorization

    assert response = @gateway.unstore(card_reference, @options)
    assert_success response

    assert response = @gateway.purchase(@amount, card_reference, @options)
    assert_failure response
  end

  def test_unsuccessful_unstore
    response = @gateway.store(@credit_card, @options)
    assert_success response
    assert_equal nil, response.message
    card_reference = response.authorization

    assert response = @gateway.unstore('123456789', @options)
    assert_failure response
  end

  def test_successful_recurring
    options = {
      order_id: generate_order_id,
      subscription_name: 'Subscription Test',
      subscription_description: 'A test subscription from the remote test in ActiveMerchant',
      period_type: 'MONTHLY',
      length: 0,
      currency: 'EUR',
      recurring_amount: @amount,
      initial_amount: 0,
      type: 'AUTOMATIC',
      start_date: Time.now.gmtime.strftime("%d-%m-%Y")
    }

    response = @gateway.recurring(@credit_card, options)
    assert_success response
  end

  def test_successful_recurring_with_stored_subscription
    options = {
      order_id: generate_order_id,
      subscription_name: 'Stored Subscription Test',
      subscription_description: 'A test stored subscription from the remote test in ActiveMerchant',
      period_type: 'MONTHLY',
      length: 0,
      currency: 'EUR',
      recurring_amount: @amount,
      initial_amount: 0,
      type: 'AUTOMATIC',
      start_date: Time.now.gmtime.strftime("%d-%m-%Y")
    }

    response = @gateway.create_stored_subscription(options)
    options.merge!(stored_subscription_ref: response.authorization)
    response = @gateway.recurring(@credit_card, options)
    assert_success response
  end

  def test_failed_recurring_missing_stored_subscription
    options = {
      order_id: generate_order_id,
      subscription_name: 'Subscription Test',
      subscription_description: 'A test subscription from the remote test in ActiveMerchant',
      period_type: 'MONTHLY',
      length: 0,
      currency: 'EUR',
      recurring_amount: @amount,
      initial_amount: 0,
      type: 'AUTOMATIC',
      start_date: Time.now.gmtime.strftime("%d-%m-%Y"),
      stored_subscription_ref: 'MISSING_SUBSCRIPTION'
    }

    response = @gateway.recurring(@credit_card, options)
    assert_failure response
  end

  def test_failed_recurring
    options = {
      order_id: generate_order_id,
      subscription_name: 'Subscription Test',
      subscription_description: 'A test subscription from the remote test in ActiveMerchant',
      period_type: 'FOOBAR',
      length: 0,
      currency: 'EUR',
      recurring_amount: @amount,
      initial_amount: 0,
      type: 'AUTOMATIC',
      start_date: Time.now.gmtime.strftime("%d-%m-%Y")
    }

    response = @gateway.recurring(@credit_card, options)
    assert_failure response
  end

  def test_purchase_with_stored_card
    response = @gateway.store(@credit_card, @options)
    assert_success response
    assert_equal nil, response.message
    card_reference = response.authorization

    assert response = @gateway.purchase(@amount, card_reference, @options)
    assert_success response
    assert_equal 'APPROVAL', response.message
  end

  def test_transcript_scrubbing
    transcript = capture_transcript(@gateway) do
      @gateway.purchase(@amount, @credit_card, @options)
    end
    transcript = @gateway.scrub(transcript)

    assert_scrubbed(@credit_card.number, transcript)
    assert_scrubbed(@credit_card.verification_value, transcript)
    assert_scrubbed(@gateway.options[:secret], transcript)
  end

  def generate_order_id
    (Time.now.to_f * 100).to_i.to_s
  end
end


text:
using JewelMine.Engine.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JewelMine.Engine
{
	/// <summary>
	/// Represents an object that can provide
	/// the current game state.
	/// </summary>
	public interface IGameStateProvider
	{
		/// <summary>
		/// Gets the state.
		/// </summary>
		/// <value>
		/// The state.
		/// </value>
		GameState State { get; }
	}
}


text:
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Orleans.Concurrency;
using Orleans.Configuration;
using Orleans.Internal;
using Orleans.Runtime.Providers;
using Orleans.Serialization;

namespace Orleans.Runtime.MembershipService
{
    internal class SystemTargetBasedMembershipTable : IMembershipTable
    {
        private readonly IServiceProvider serviceProvider;
        private readonly ILogger logger;
        private IMembershipTableSystemTarget grain;

        public SystemTargetBasedMembershipTable(IServiceProvider serviceProvider, ILogger<SystemTargetBasedMembershipTable> logger)
        {
            this.serviceProvider = serviceProvider;
            this.logger = logger;
        }
        public async Task InitializeMembershipTable(bool tryInitTableVersion)
        {
            this.grain = await GetMembershipTable();
        }

        private async Task<IMembershipTableSystemTarget> GetMembershipTable()
        {
            var options = this.serviceProvider.GetRequiredService<IOptions<DevelopmentClusterMembershipOptions>>().Value;
            if (options.PrimarySiloEndpoint == null)
            {
                throw new OrleansConfigurationException(
                    $"{nameof(DevelopmentClusterMembershipOptions)}.{nameof(options.PrimarySiloEndpoint)} must be set when using development clustering.");
            }

            var siloDetails = this.serviceProvider.GetService<ILocalSiloDetails>();
            bool isPrimarySilo = siloDetails.SiloAddress.Endpoint.Equals(options.PrimarySiloEndpoint);
            if (isPrimarySilo)
            {
                this.logger.Info(ErrorCode.MembershipFactory1, "Creating in-memory membership table");
                var catalog = serviceProvider.GetRequiredService<Catalog>();
                catalog.RegisterSystemTarget(ActivatorUtilities.CreateInstance<MembershipTableSystemTarget>(serviceProvider));
            }

            var grainFactory = this.serviceProvider.GetRequiredService<IInternalGrainFactory>();
            var result = grainFactory.GetSystemTarget<IMembershipTableSystemTarget>(Constants.SystemMembershipTableType, SiloAddress.New(options.PrimarySiloEndpoint, 0));
            if (isPrimarySilo)
            {
                await this.WaitForTableGrainToInit(result);
            }

            return result;
        }

        // Only used with MembershipTableGrain to wait for primary to start.
        private async Task WaitForTableGrainToInit(IMembershipTableSystemTarget membershipTableSystemTarget)
        {
            var timespan = Debugger.IsAttached ? TimeSpan.FromMinutes(5) : TimeSpan.FromSeconds(5);
            // This is a quick temporary solution to enable primary node to start fully before secondaries.
            // Secondary silos waits untill GrainBasedMembershipTable is created.
            for (int i = 0; i < 100; i++)
            {
                try
                {
                    await membershipTableSystemTarget.ReadAll().WithTimeout(timespan, $"MembershipGrain trying to read all content of the membership table, failed due to timeout {timespan}");
                    logger.Info(ErrorCode.MembershipTableGrainInit2, "-Connected to membership table provider.");
                    return;
                }
                catch (Exception exc)
                {
                    var type = exc.GetBaseException().GetType();
                    if (type == typeof(TimeoutException) || type == typeof(OrleansException))
                    {
                        logger.Info(
                            ErrorCode.MembershipTableGrainInit3,
                            "-Waiting for membership table provider to initialize. Going to sleep for {0} and re-try to reconnect.",
                            timespan);
                    }
                    else
                    {
                        logger.Info(ErrorCode.MembershipTableGrainInit4, "-Membership table provider failed to initialize. Giving up.");
                        throw;
                    }
                }

                await Task.Delay(timespan);
            }
        }

        public Task DeleteMembershipTableEntries(string clusterId) => this.grain.DeleteMembershipTableEntries(clusterId);

        public Task<MembershipTableData> ReadRow(SiloAddress key) => this.grain.ReadRow(key);

        public Task<MembershipTableData> ReadAll() => this.grain.ReadAll();

        public Task<bool> InsertRow(MembershipEntry entry, TableVersion tableVersion) => this.grain.InsertRow(entry, tableVersion);

        public Task<bool> UpdateRow(MembershipEntry entry, string etag, TableVersion tableVersion) => this.grain.UpdateRow(entry, etag, tableVersion);

        public Task UpdateIAmAlive(MembershipEntry entry) => this.grain.UpdateIAmAlive(entry);

        public Task CleanupDefunctSiloEntries(DateTimeOffset beforeDate)
        {
            throw new NotImplementedException();
        }
    }

    [Reentrant]
    internal class MembershipTableSystemTarget : SystemTarget, IMembershipTableSystemTarget
    {
        private InMemoryMembershipTable table;
        private readonly ILogger logger;

        public MembershipTableSystemTarget(
            ILocalSiloDetails localSiloDetails,
            ILoggerFactory loggerFactory,
            SerializationManager serializationManager)
            : base(CreateId(localSiloDetails), localSiloDetails.SiloAddress, lowPriority: false, loggerFactory)
        {
            logger = loggerFactory.CreateLogger<MembershipTableSystemTarget>();
            table = new InMemoryMembershipTable(serializationManager);
            logger.Info(ErrorCode.MembershipGrainBasedTable1, "GrainBasedMembershipTable Activated.");
        }

        private static SystemTargetGrainId CreateId(ILocalSiloDetails localSiloDetails)
        {
            return SystemTargetGrainId.Create(Constants.SystemMembershipTableType, SiloAddress.New(localSiloDetails.SiloAddress.Endpoint, 0));
        }

        public Task InitializeMembershipTable(bool tryInitTableVersion)
        {
            logger.Info("InitializeMembershipTable {0}.", tryInitTableVersion);
            return Task.CompletedTask;
        }

        public Task DeleteMembershipTableEntries(string clusterId)
        {
            logger.Info("DeleteMembershipTableEntries {0}", clusterId);
            table = null;
            return Task.CompletedTask;
        }

        public Task<MembershipTableData> ReadRow(SiloAddress key)
        {
            return Task.FromResult(table.Read(key));
        }

        public Task<MembershipTableData> ReadAll()
        {
            var t = table.ReadAll();
            return Task.FromResult(t);
        }

        public Task<bool> InsertRow(MembershipEntry entry, TableVersion tableVersion)
        {
            if (logger.IsEnabled(LogLevel.Debug)) logger.Debug("InsertRow entry = {0}, table version = {1}", entry.ToFullString(), tableVersion);
            bool result = table.Insert(entry, tableVersion);
            if (result == false)
                logger.Info(ErrorCode.MembershipGrainBasedTable2,
                    "Insert of {0} and table version {1} failed. Table now is {2}",
                    entry.ToFullString(), tableVersion, table.ReadAll());

            return Task.FromResult(result);
        }

        public Task<bool> UpdateRow(MembershipEntry entry, string etag, TableVersion tableVersion)
        {
            if (logger.IsEnabled(LogLevel.Debug)) logger.Debug("UpdateRow entry = {0}, etag = {1}, table version = {2}", entry.ToFullString(), etag, tableVersion);
            bool result = table.Update(entry, etag, tableVersion);
            if (result == false)
                logger.Info(ErrorCode.MembershipGrainBasedTable3,
                    "Update of {0}, eTag {1}, table version {2} failed. Table now is {3}",
                    entry.ToFullString(), etag, tableVersion, table.ReadAll());

            return Task.FromResult(result);
        }

        public Task UpdateIAmAlive(MembershipEntry entry)
        {
            if (logger.IsEnabled(LogLevel.Debug)) logger.Debug("UpdateIAmAlive entry = {0}", entry.ToFullString());
            table.UpdateIAmAlive(entry);
            return Task.CompletedTask;
        }

        public Task CleanupDefunctSiloEntries(DateTimeOffset beforeDate)
        {
            throw new NotImplementedException();
        }
    }
}


text:
<dom-module id="structure-creator">>

  <link rel="stylesheet" href="structure-creator.css" />
  <template>

Structure creator

    <input  is="iron-input" type="range" id="num" min="0" max="100" bind-value="{{blockCount}}"></input>
	    You've entered {{blockCount}}
    <button on-click="main">CREATE!</button>

  </template>

</dom-module>


text:
namespace utl {
class Logger;
}  // namespace utl

namespace pdn {

class TechLayer
{
 public:
  TechLayer(odb::dbTechLayer* layer);

  std::string getName() const { return layer_->getName(); }

  odb::dbTechLayer* getLayer() const { return layer_; }

  int getLefUnits() const { return layer_->getTech()->getLefUnits(); }

  int getMinWidth() const { return layer_->getMinWidth(); }
  int getMaxWidth() const { return layer_->getMaxWidth(); }
  odb::Rect adjustToMinArea(const odb::Rect& rect) const;
  // get the spacing by also checking for spacing constraints not normally
  // checked for
  int getSpacing(int width, int length = 0) const;

  void populateGrid(odb::dbBlock* block,
                    odb::dbTechLayerDir dir = odb::dbTechLayerDir::NONE);
  int snapToGrid(int pos, int greater_than = 0) const;
  bool hasGrid() const { return !grid_.empty(); }
  const std::vector<int>& getGrid() const { return grid_; }
  int snapToManufacturingGrid(int pos, bool round_up = false) const;
  static int snapToManufacturingGrid(odb::dbTech* tech,
                                     int pos,
                                     bool round_up = false);
  static bool checkIfManufacturingGrid(odb::dbTech* tech, int value);
  bool checkIfManufacturingGrid(int value,
                                utl::Logger* logger,
                                const std::string& type) const;

  double dbuToMicron(int value) const;

  struct MinCutRule
  {
    odb::dbTechLayerCutClassRule* cut_class;
    bool above;
    bool below;
    int width;
    int cuts;
  };
  std::vector<MinCutRule> getMinCutRules() const;

 private:
  odb::dbTechLayer* layer_;
  std::vector<int> grid_;
};

}  // namespace pdn


text:
Hanami::Model.migration do
  change do
    add_column :blobs, :tags, "jsonb"
  end
end


text:
using System.Linq;
using Xunit;

namespace System.Collections.Specialized.Tests
{
    public class HybridDictionaryAddTests
    {
        [Theory]
        [InlineData(50, false)]
        [InlineData(50, true)]
        public void Add(int count, bool caseInsensitive)
        {
            HybridDictionary hybridDictionary = new HybridDictionary(caseInsensitive);

            for (int i = 0; i < count; i++)
            {
                string key = "Key_" + i;
                string value = "Value_" + i;
                hybridDictionary.Add(key, value);

                Assert.Equal(i + 1, hybridDictionary.Count);
                Assert.Equal(i + 1, hybridDictionary.Keys.Count);
                Assert.Equal(i + 1, hybridDictionary.Values.Count);

                Assert.Contains(key, hybridDictionary.Keys.Cast<object>());
                Assert.Contains(value, hybridDictionary.Values.Cast<object>());

                Assert.Equal(value, hybridDictionary[key]);
                Assert.True(hybridDictionary.Contains(key));

                // Keys should be case insensitive
                Assert.Equal(caseInsensitive, hybridDictionary.Contains(key.ToUpperInvariant()));
                Assert.Equal(caseInsensitive, hybridDictionary.Contains(key.ToLowerInvariant()));

                if (caseInsensitive)
                {
                    Assert.Equal(value, hybridDictionary[key.ToUpperInvariant()]);
                    Assert.Equal(value, hybridDictionary[key.ToLowerInvariant()]);
                }
                else
                {
                    Assert.Null(hybridDictionary[key.ToUpperInvariant()]);
                    Assert.Null(hybridDictionary[key.ToLowerInvariant()]);
                }
            }
        }

        [Theory]
        [InlineData(5)]
        [InlineData(50)]
        public void Add_NullValue(int count)
        {
            HybridDictionary hybridDictionary = Helpers.CreateHybridDictionary(count);
            string nullValueKey = "null-value-key";
            hybridDictionary.Add(nullValueKey, null);

            Assert.Equal(count + 1, hybridDictionary.Count);
            Assert.Null(hybridDictionary[nullValueKey]);
            Assert.True(hybridDictionary.Contains(nullValueKey));
            Assert.Contains(null, hybridDictionary.Values.Cast<object>());
        }

        [Theory]
        [InlineData(5)]
        [InlineData(50)]
        public void Add_SameValue(int count)
        {
            HybridDictionary hybridDictionary = Helpers.CreateHybridDictionary(count);
            hybridDictionary.Add("key1", "value");
            hybridDictionary.Add("key2", "value");

            Assert.Equal(count + 2, hybridDictionary.Count);
            Assert.Equal(count + 2, hybridDictionary.Values.Count);
        }

        [Theory]
        [InlineData(5, true)]
        [InlineData(5, false)]
        [InlineData(50, true)]
        [InlineData(50, false)]
        public void Add_Invalid(int count, bool caseInsensitive)
        {
            HybridDictionary hybridDictionary = Helpers.CreateHybridDictionary(count, caseInsensitive);
            Assert.Throws<ArgumentNullException>("key", () => hybridDictionary.Add(null, "value"));

            hybridDictionary.Add("key", "value");
            Assert.Throws<ArgumentException>(null, () => hybridDictionary.Add("key", "value"));

            if (caseInsensitive)
            {
                Assert.Throws<ArgumentException>(null, () => hybridDictionary.Add("KEY", "value"));
            }
            else
            {
                hybridDictionary.Add("KEY", "value");
                Assert.True(hybridDictionary.Contains("KEY"));
            }
        }
    }
}


text:
<?php

namespace Google\Service\CloudSearch\Resource;

/**
 * The "identitysources" collection of methods.
 * Typical usage is:
 *  <code>
 *   $cloudsearchService = new Google\Service\CloudSearch(...);
 *   $identitysources = $cloudsearchService->identitysources;
 *  </code>
 */
class DebugIdentitysources extends \Google\Service\Resource
{
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(DebugIdentitysources::class, 'Google_Service_CloudSearch_Resource_DebugIdentitysources');