text:
(function() {
//Going sloppy to avoid 'use strict' string cost, but strict practices should
//be followed.
/*jslint sloppy: true */
/*global setTimeout: false */

var requirejs, require, define;
(function (undef) {
    var main, req, makeMap, handlers,
        defined = {},
        waiting = {},
        config = {},
        defining = {},
        hasOwn = Object.prototype.hasOwnProperty,
        aps = [].slice,
        jsSuffixRegExp = /\.js$/;

    function hasProp(obj, prop) {
        return hasOwn.call(obj, prop);
    }

    /**
     * Given a relative module name, like ./something, normalize it to
     * a real name that can be mapped to a path.
     * @param {String} name the relative name
     * @param {String} baseName a real name that the name arg is relative
     * to.
     * @returns {String} normalized name
     */
    function normalize(name, baseName) {
        var nameParts, nameSegment, mapValue, foundMap, lastIndex,
            foundI, foundStarMap, starI, i, j, part,
            baseParts = baseName && baseName.split("/"),
            map = config.map,
            starMap = (map && map['*']) || {};

        //Adjust any relative paths.
        if (name && name.charAt(0) === ".") {
            //If have a base name, try to normalize against it,
            //otherwise, assume it is a top-level require that will
            //be relative to baseUrl in the end.
            if (baseName) {
                //Convert baseName to array, and lop off the last part,
                //so that . matches that "directory" and not name of the baseName's
                //module. For instance, baseName of "one/two/three", maps to
                //"one/two/three.js", but we want the directory, "one/two" for
                //this normalization.
                baseParts = baseParts.slice(0, baseParts.length - 1);
                name = name.split('/');
                lastIndex = name.length - 1;

                // Node .js allowance:
                if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
                    name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
                }

                name = baseParts.concat(name);

                //start trimDots
                for (i = 0; i < name.length; i += 1) {
                    part = name[i];
                    if (part === ".") {
                        name.splice(i, 1);
                        i -= 1;
                    } else if (part === "..") {
                        if (i === 1 && (name[2] === '..' || name[0] === '..')) {
                            //End of the line. Keep at least one non-dot
                            //path segment at the front so it can be mapped
                            //correctly to disk. Otherwise, there is likely
                            //no path mapping for a path starting with '..'.
                            //This can still fail, but catches the most reasonable
                            //uses of ..
                            break;
                        } else if (i > 0) {
                            name.splice(i - 1, 2);
                            i -= 2;
                        }
                    }
                }
                //end trimDots

                name = name.join("/");
            } else if (name.indexOf('./') === 0) {
                // No baseName, so this is ID is resolved relative
                // to baseUrl, pull off the leading dot.
                name = name.substring(2);
            }
        }

        //Apply map config if available.
        if ((baseParts || starMap) && map) {
            nameParts = name.split('/');

            for (i = nameParts.length; i > 0; i -= 1) {
                nameSegment = nameParts.slice(0, i).join("/");

                if (baseParts) {
                    //Find the longest baseName segment match in the config.
                    //So, do joins on the biggest to smallest lengths of baseParts.
                    for (j = baseParts.length; j > 0; j -= 1) {
                        mapValue = map[baseParts.slice(0, j).join('/')];

                        //baseName segment has  config, find if it has one for
                        //this name.
                        if (mapValue) {
                            mapValue = mapValue[nameSegment];
                            if (mapValue) {
                                //Match, update name to the new value.
                                foundMap = mapValue;
                                foundI = i;
                                break;
                            }
                        }
                    }
                }

                if (foundMap) {
                    break;
                }

                //Check for a star map match, but just hold on to it,
                //if there is a shorter segment match later in a matching
                //config, then favor over this star map.
                if (!foundStarMap && starMap && starMap[nameSegment]) {
                    foundStarMap = starMap[nameSegment];
                    starI = i;
                }
            }

            if (!foundMap && foundStarMap) {
                foundMap = foundStarMap;
                foundI = starI;
            }

            if (foundMap) {
                nameParts.splice(0, foundI, foundMap);
                name = nameParts.join('/');
            }
        }

        return name;
    }

    function makeRequire(relName, forceSync) {
        return function () {
            //A version of a require function that passes a moduleName
            //value for items that may need to
            //look up paths relative to the moduleName
            return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
        };
    }

    function makeNormalize(relName) {
        return function (name) {
            return normalize(name, relName);
        };
    }

    function makeLoad(depName) {
        return function (value) {
            defined[depName] = value;
        };
    }

    function callDep(name) {
        if (hasProp(waiting, name)) {
            var args = waiting[name];
            delete waiting[name];
            defining[name] = true;
            main.apply(undef, args);
        }

        if (!hasProp(defined, name) && !hasProp(defining, name)) {
            throw new Error('No ' + name);
        }
        return defined[name];
    }

    //Turns a plugin!resource to [plugin, resource]
    //with the plugin being undefined if the name
    //did not have a plugin prefix.
    function splitPrefix(name) {
        var prefix,
            index = name ? name.indexOf('!') : -1;
        if (index > -1) {
            prefix = name.substring(0, index);
            name = name.substring(index + 1, name.length);
        }
        return [prefix, name];
    }

    /**
     * Makes a name map, normalizing the name, and using a plugin
     * for normalization if necessary. Grabs a ref to plugin
     * too, as an optimization.
     */
    makeMap = function (name, relName) {
        var plugin,
            parts = splitPrefix(name),
            prefix = parts[0];

        name = parts[1];

        if (prefix) {
            prefix = normalize(prefix, relName);
            plugin = callDep(prefix);
        }

        //Normalize according
        if (prefix) {
            if (plugin && plugin.normalize) {
                name = plugin.normalize(name, makeNormalize(relName));
            } else {
                name = normalize(name, relName);
            }
        } else {
            name = normalize(name, relName);
            parts = splitPrefix(name);
            prefix = parts[0];
            name = parts[1];
            if (prefix) {
                plugin = callDep(prefix);
            }
        }

        //Using ridiculous property names for space reasons
        return {
            f: prefix ? prefix + '!' + name : name, //fullName
            n: name,
            pr: prefix,
            p: plugin
        };
    };

    function makeConfig(name) {
        return function () {
            return (config && config.config && config.config[name]) || {};
        };
    }

    handlers = {
        require: function (name) {
            return makeRequire(name);
        },
        exports: function (name) {
            var e = defined[name];
            if (typeof e !== 'undefined') {
                return e;
            } else {
                return (defined[name] = {});
            }
        },
        module: function (name) {
            return {
                id: name,
                uri: '',
                exports: defined[name],
                config: makeConfig(name)
            };
        }
    };

    main = function (name, deps, callback, relName) {
        var cjsModule, depName, ret, map, i,
            args = [],
            callbackType = typeof callback,
            usingExports;

        //Use name if no relName
        relName = relName || name;

        //Call the callback to define the module, if necessary.
        if (callbackType === 'undefined' || callbackType === 'function') {
            //Pull out the defined dependencies and pass the ordered
            //values to the callback.
            //Default to [require, exports, module] if no deps
            deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
            for (i = 0; i < deps.length; i += 1) {
                map = makeMap(deps[i], relName);
                depName = map.f;

                //Fast path CommonJS standard dependencies.
                if (depName === "require") {
                    args[i] = handlers.require(name);
                } else if (depName === "exports") {
                    //CommonJS module spec 1.1
                    args[i] = handlers.exports(name);
                    usingExports = true;
                } else if (depName === "module") {
                    //CommonJS module spec 1.1
                    cjsModule = args[i] = handlers.module(name);
                } else if (hasProp(defined, depName) ||
                           hasProp(waiting, depName) ||
                           hasProp(defining, depName)) {
                    args[i] = callDep(depName);
                } else if (map.p) {
                    map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
                    args[i] = defined[depName];
                } else {
                    throw new Error(name + ' missing ' + depName);
                }
            }

            ret = callback ? callback.apply(defined[name], args) : undefined;

            if (name) {
                //If setting exports via "module" is in play,
                //favor that over return value and exports. After that,
                //favor a non-undefined return value over exports use.
                if (cjsModule && cjsModule.exports !== undef &&
                        cjsModule.exports !== defined[name]) {
                    defined[name] = cjsModule.exports;
                } else if (ret !== undef || !usingExports) {
                    //Use the return value from the function.
                    defined[name] = ret;
                }
            }
        } else if (name) {
            //May just be an object definition for the module. Only
            //worry about defining if have a module name.
            defined[name] = callback;
        }
    };

    requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
        if (typeof deps === "string") {
            if (handlers[deps]) {
                //callback in this case is really relName
                return handlers[deps](callback);
            }
            //Just return the module wanted. In this scenario, the
            //deps arg is the module name, and second arg (if passed)
            //is just the relName.
            //Normalize module name, if it contains . or ..
            return callDep(makeMap(deps, callback).f);
        } else if (!deps.splice) {
            //deps is a config object, not an array.
            config = deps;
            if (config.deps) {
                req(config.deps, config.callback);
            }
            if (!callback) {
                return;
            }

            if (callback.splice) {
                //callback is an array, which means it is a dependency list.
                //Adjust args if there are dependencies
                deps = callback;
                callback = relName;
                relName = null;
            } else {
                deps = undef;
            }
        }

        //Support require(['a'])
        callback = callback || function () {};

        //If relName is a function, it is an errback handler,
        //so remove it.
        if (typeof relName === 'function') {
            relName = forceSync;
            forceSync = alt;
        }

        //Simulate async callback;
        if (forceSync) {
            main(undef, deps, callback, relName);
        } else {
            //Using a non-zero value because of concern for what old browsers
            //do, and latest browsers "upgrade" to 4 if lower value is used:
            //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
            //If want a value immediately, use require('id') instead -- something
            //that works in almond on the global level, but not guaranteed and
            //unlikely to work in other AMD implementations.
            setTimeout(function () {
                main(undef, deps, callback, relName);
            }, 4);
        }

        return req;
    };

    /**
     * Just drops the config on the floor, but returns req in case
     * the config return value is used.
     */
    req.config = function (cfg) {
        return req(cfg);
    };

    /**
     * Expose module registry for debugging and tooling
     */
    requirejs._defined = defined;

    define = function (name, deps, callback) {

        //This module may not have dependencies
        if (!deps.splice) {
            //deps is not an array, so probably means
            //an object literal or factory function for
            //the value. Adjust args.
            callback = deps;
            deps = [];
        }

        if (!hasProp(defined, name) && !hasProp(waiting, name)) {
            waiting[name] = [name, deps, callback];
        }
    };

    define.amd = {
        jQuery: true
    };
}());
define("../tools/almond", function(){});

define('utils/GuiUtils',[], function () {

  var GuiUtils = {};

  GuiUtils.makeProxy = function (source, proxy, wrapFunc) {
    var sourceProto = source.prototype;
    var proxyProto = proxy.prototype;
    var protos = Object.keys(sourceProto);
    for (var i = 0, l = protos.length; i < l; ++i) {
      var proto = protos[i];
      if (!proxyProto[proto])
        proxyProto[proto] = wrapFunc ? wrapFunc(sourceProto[proto]) : sourceProto[proto];
    }
  };
  GuiUtils.rgbToHsv = function (rgb) {
    var r = rgb[0];
    var g = rgb[1];
    var b = rgb[2];
    var maxRGB = Math.max(r, g, b);
    var minRGB = Math.min(r, g, b);
    if (minRGB === maxRGB) return [0, 0, minRGB];
    var d = (r === minRGB) ? g - b : ((b === minRGB) ? r - g : b - r);
    var h = (r === minRGB) ? 3 : ((b === minRGB) ? 1 : 5);
    return [(h - d / (maxRGB - minRGB)) / 6, (maxRGB - minRGB) / maxRGB, maxRGB];
  };
  GuiUtils.hsvToRgb = function (hsv) {
    var h = hsv[0] * 6;
    var s = hsv[1];
    var v = hsv[2];
    var i = Math.floor(h);
    var f = h - i;
    var p = v * (1.0 - s);
    var q = v * (1.0 - f * s);
    var t = v * (1.0 - (1.0 - f) * s);
    var mod = i % 6;
    if (mod === 0) return [v, t, p];
    else if (mod === 1) return [q, v, p];
    else if (mod === 2) return [p, v, t];
    else if (mod === 3) return [p, q, v];
    else if (mod === 4) return [t, p, v];
    else return [v, p, q];
  };
  GuiUtils.getValidColor = function (color) {
    for (var i = 0, len = color.length; i < len; ++i) color[i] = Math.max(0.0, Math.min(1.0, color[i]));
    return color;
  };
  GuiUtils.getStrColor = function (color) {
    if (color.length === 3) return GuiUtils.rgbToHex(color);
    return 'rgba(' + Math.round(color[0] * 255) + ',' + Math.round(color[1] * 255) + ',' + Math.round(color[2] * 255) + ',' + color[3] + ')';
  };
  GuiUtils.getColorMult = function (color, fac) {
    var out = [color[0] * fac, color[1] * fac, color[2] * fac];
    if (color.length === 4) out.push(color[3]);
    return GuiUtils.getValidColor(out);
  };
  GuiUtils.getColorAdd = function (color, add) {
    var out = [color[0] + add, color[1] + add, color[2] + add];
    if (color.length === 4) out.push(color[3]);
    return GuiUtils.getValidColor(out);
  };
  GuiUtils.rgbToHex = function (rgb) {
    var h = '#';
    for (var i = 0; i < 3; ++i) {
      var c = Math.round(rgb[i] * 255).toString(16);
      h += c.length === 1 ? '0' + c : c;
    }
    return h;
  };
  GuiUtils.hexToRgb = function (hex) {
    var i = 0;
    if (hex[0] === '#') hex = hex.slice(1);
    var h = hex;
    if (hex.length > 6) h = hex.slice(0, 6);
    else if (hex.length < 6) {
      h = '';
      for (i = 0; i < 3; ++i)
        h += hex[i] ? hex[i] + hex[i] : '00';
    }
    var col = [0, 0, 0];
    for (i = 0; i < 3; ++i) {
      var c = parseInt(h[i * 2] + h[i * 2 + 1], 16);
      col[i] = (c !== c ? 0 : c) / 255;
    }
    return col;
  };

  return GuiUtils;
});
define('widgets/BaseWidget',[], function () {

  var BaseWidget = function () {};

  BaseWidget.prototype = {
    _getInitialValue: function (valOrObject, callbackOrKey) {
      if (typeof callbackOrKey !== 'string') return valOrObject;
      return valOrObject[callbackOrKey];
    },
    _getCheckCallback: function (valOrObject, callbackOrKey) {
      if (typeof callbackOrKey !== 'string') return callbackOrKey;
      return function (val) {
        valOrObject[callbackOrKey] = val;
      };
    },
    _setDomContainer: function (container) {
      this.domContainer = container;
    },
    setCallback: function (callback) {
      this.callback = callback;
    },
    setVisibility: function (visible) {
      if (!this.domContainer) return;
      this.domContainer.hidden = !visible;
    }
  };

  return BaseWidget;
});
define('widgets/Button',[
  'utils/GuiUtils',
  'widgets/BaseWidget'
], function (GuiUtils, BaseWidget) {

  var Button = function (name, callbackOrObject, key) {
    var callback = key ? callbackOrObject[key].bind(callbackOrObject) : callbackOrObject;

    this.domButton = document.createElement('button');
    this.domButton.className = 'gui-button';
    this.domButton.innerHTML = name || '';
    this.domButton.addEventListener('click', this._onClick.bind(this));

    this.setCallback(callback);
  };

  Button.prototype = {
    setEnable: function (bool) {
      this.domButton.disabled = bool === undefined ? false : !bool;
    },
    _onClick: function () {
      if (this.callback) this.callback();
    }
  };

  GuiUtils.makeProxy(BaseWidget, Button);

  return Button;
});
define('widgets/Checkbox',[
  'utils/GuiUtils',
  'widgets/BaseWidget'
], function (GuiUtils, BaseWidget) {

  var Checkbox = function (valOrObject, callbackOrKey) {
    var value = this._getInitialValue(valOrObject, callbackOrKey);
    var callback = this._getCheckCallback(valOrObject, callbackOrKey);
    this.domCheckbox = document.createElement('input');
    this.domCheckbox.className = 'gui-input-checkbox';
    this.domCheckbox.type = 'checkbox';

    this.domLabelCheckbox = document.createElement('label');

    this.setValue(value === undefined ? true : value);
    this.setCallback(callback);
  };

  Checkbox.prototype = {
    _onMouseDown: function () {
      this.setValue(!this.domCheckbox.checked);
    },
    setValue: function (val, ignoreCB) {
      this.domCheckbox.checked = val;
      if (!ignoreCB && this.callback) this.callback(val);
    },
    getValue: function () {
      return this.domCheckbox.checked;
    }
  };

  GuiUtils.makeProxy(BaseWidget, Checkbox);

  return Checkbox;
});
define('widgets/Color',[
  'utils/GuiUtils',
  'widgets/BaseWidget'
], function (GuiUtils, BaseWidget) {

  var vendors = ['-moz-', '-o-', '-webkit-', '-ms-', ''];
  var urlAlpha = 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAChJREFUeNpiPHPmDAMMGBsbw9lMDDgA6RKM%2F%2F%2F%2Fh3POnj1LCzsAAgwAQtYIcFfEyzkAAAAASUVORK5CYII%3D")';

  var Color = function (valOrObject, callbackOrKey) {
    var value = this._getInitialValue(valOrObject, callbackOrKey);
    var callback = this._getCheckCallback(valOrObject, callbackOrKey);
    if (value) value = GuiUtils.getValidColor(value);
    else value = [1.0, 0.0, 0.0];

    // container
    this.domColor = document.createElement('div');
    this.domColor.className = 'gui-widget-color';

    // input text
    this.domInputColor = document.createElement('input');
    this.domPopup = document.createElement('div');

    // hue picker
    this.domHue = document.createElement('div');
    this.domHue.className = 'gui-color-hue';
    this.domHueKnob = document.createElement('div');
    this.domHueKnob.className = 'gui-knob-hue';

    // saturation picker
    this.domSaturation = document.createElement('div');
    this.domSaturation.className = 'gui-color-saturation';
    var zAlphaSat = document.createElement('div');
    this.domSaturation.appendChild(zAlphaSat);
    this.domSaturationKnob = document.createElement('div');
    this.domSaturationKnob.className = 'gui-knob-saturation';

    this.domHue.appendChild(this.domHueKnob);
    this.domPopup.appendChild(this.domSaturationKnob);
    this.domPopup.appendChild(this.domSaturation);
    this.domPopup.appendChild(this.domHue);
    this.domColor.appendChild(this.domInputColor);
    this.domColor.appendChild(this.domPopup);

    this._hueGradient(this.domHue);
    this._linearGradient(zAlphaSat, 'top', 'rgba(0,0,0,0)', '#000');

    this.domColor.addEventListener('keydown', this._onInputDown.bind(this));
    this.domSaturation.addEventListener('mousedown', this._onSaturationDown.bind(this));
    this.domHue.addEventListener('mousedown', this._onHueDown.bind(this));
    window.addEventListener('mouseup', this._onMouseUp.bind(this));
    window.addEventListener('mouseout', this._onMouseUp.bind(this));
    window.addEventListener('mousemove', this._onMouseMove.bind(this));

    // alpha picker
    this.hasAlpha = value.length === 4;
    this.alpha = 1.0;
    if (this.hasAlpha) {
      this.domPopup.style.width = '142px';
      this.domAlpha = document.createElement('div');
      this.domAlpha.className = 'gui-color-alpha';
      this.domAlphaKnob = document.createElement('div');
      this.domAlphaKnob.className = 'gui-knob-alpha';

      this._alphaGradient(this.domAlpha, 'top', 'rgba(0,0,0,1.0)', 'rgba(0,0,0,0.0)');

      this.domAlpha.addEventListener('mousedown', this._onAlphaDown.bind(this));
      this.domAlpha.appendChild(this.domAlphaKnob);
      this.domPopup.appendChild(this.domAlpha);
    }

    this.editHue = this.editSaturation = this.editAlpha = false;
    this.widgetHeight = this.widgetWidth = 100;
    this.setValue(value);
    this.setCallback(callback);
  };

  Color.prototype = {
    _onInputDown: function (ev) {
      ev.stopPropagation();
      if (ev.keyCode === 13)
        this.setValue(GuiUtils.hexToRgb(ev.target.value));
    },
    _onUpdateSaturation: function (ev) {
      var rect = this.domSaturation.getBoundingClientRect();
      var hsv = GuiUtils.rgbToHsv(this.getValue());
      hsv[1] = Math.min(1.0, Math.max(0.0, (ev.clientX - rect.left) / rect.width));
      hsv[2] = Math.min(1.0, Math.max(0.0, 1.0 - (ev.clientY - rect.top) / rect.width));
      this.setValue(GuiUtils.hsvToRgb(hsv), false, true);
      this._updateGui();
    },
    _onUpdateHue: function (ev) {
      var rect = this.domHue.getBoundingClientRect();
      var hsv = GuiUtils.rgbToHsv(this.getValue());
      hsv[0] = Math.min(1.0, Math.max(0.0, 1.0 - (ev.clientY - rect.top) / rect.height));
      this.setValue(GuiUtils.hsvToRgb(hsv), false, true);
      this._updateGui();
    },
    _onUpdateAlpha: function (ev) {
      var rect = this.domAlpha.getBoundingClientRect();
      var col = this.getValue();
      col[3] = this.alpha = Math.min(1.0, Math.max(0.0, 1.0 - (ev.clientY - rect.top) / rect.height));
      this.setValue(col, false, true);
      this._updateGui();
    },
    _updateGui: function () {
      var color = this.getValue();
      var hsv = GuiUtils.rgbToHsv(color);

      this.domSaturationKnob.style.marginLeft = this.widgetWidth * hsv[1] - 7 + 'px';
      this.domSaturationKnob.style.marginTop = this.widgetHeight * (1.0 - hsv[2]) - 7 + 'px';

      hsv[1] = hsv[2] = 1.0;
      this._linearGradient(this.domSaturation, 'left', '#fff', GuiUtils.getStrColor(GuiUtils.hsvToRgb(hsv)));

      this.domHueKnob.style.marginTop = (1.0 - hsv[0]) * this.widgetHeight + 'px';

      if (this.hasAlpha && color[3] !== undefined)
        this.domAlphaKnob.style.marginTop = (1.0 - this.alpha) * this.widgetHeight + 'px';
    },
    _onMouseMove: function (ev) {
      if (!this.editSaturation && !this.editHue && !this.editAlpha) return;
      if (this.editSaturation) return this._onUpdateSaturation(ev);
      if (this.editHue) return this._onUpdateHue(ev);
      if (this.editAlpha) return this._onUpdateAlpha(ev);
    },
    _onSaturationDown: function (ev) {
      this.editSaturation = true;
      this._onMouseMove(ev);
    },
    _onHueDown: function (ev) {
      this.editHue = true;
      this._onMouseMove(ev);
    },
    _onAlphaDown: function (ev) {
      this.editAlpha = true;
      this._onMouseMove(ev);
    },
    _onMouseUp: function () {
      this.editHue = this.editSaturation = this.editAlpha = false;
    },
    _hueGradient: function (dom) {
      dom.style.background = '';
      for (var i = 0, l = vendors.length; i < l; ++i)
        dom.style.cssText += 'background: ' + vendors[i] + 'linear-gradient(top,  #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);';
    },
    _alphaGradient: function (dom, dir, col1, col2) {
      dom.style.background = '';
      for (var i = 0, l = vendors.length; i < l; ++i)
        dom.style.cssText += 'background: ' + vendors[i] + 'linear-gradient(' + dir + ', ' + col1 + ',' + col2 + '),' + urlAlpha + ';';
    },
    _linearGradient: function (dom, dir, col1, col2) {
      dom.style.background = '';
      for (var i = 0, l = vendors.length; i < l; ++i)
        dom.style.cssText += 'background: ' + vendors[i] + 'linear-gradient(' + dir + ', ' + col1 + ' 0%, ' + col2 + ' 100%);';
    },
    setValue: function (color, ignoreCB, ignoreUI) {
      var hex = GuiUtils.rgbToHex(color);
      this.domInputColor.value = hex;
      if (this.hasAlpha) {
        if (color.length >= 4) this.alpha = color[3];
        else color.push(this.alpha);
        var col = 'rgba(' + parseInt(color[0] * 255, 10) + ',' + parseInt(color[1] * 255, 10) + ',' + parseInt(color[2] * 255, 10) + ',' + this.alpha + ')';
        this._alphaGradient(this.domInputColor, '0deg', col, col);
      } else {
        this.domInputColor.style.background = hex;
      }

      // color of text
      var hsv = GuiUtils.rgbToHsv(color);
      this.domSaturationKnob.style.borderColor = (hsv[2] < 0.5 || hsv[1] > 0.5) ? '#fff' : '#000';
      this.domInputColor.style.color = (this.alpha > 0.2 && (hsv[2] < 0.5 || hsv[1] > 0.5)) ? '#fff' : '#000';
      if (!ignoreUI) this._updateGui();
      if (!ignoreCB && this.callback) this.callback(color);
    },
    getValue: function () {
      var col = GuiUtils.hexToRgb(this.domInputColor.value);
      if (this.hasAlpha)
        col.push(this.alpha);
      return col;
    }
  };

  GuiUtils.makeProxy(BaseWidget, Color);

  return Color;
});
define('widgets/Combobox',[
  'utils/GuiUtils',
  'widgets/BaseWidget'
], function (GuiUtils, BaseWidget) {

  var Combobox = function (valOrObject, callbackOrKey, options) {
    var value = this._getInitialValue(valOrObject, callbackOrKey);
    var callback = this._getCheckCallback(valOrObject, callbackOrKey);
    options = options || {};
    value = value || options[0];

    this.domSelect = document.createElement('select');
    this.domSelect.className = 'gui-select';
    this.addOptions(options);

    this.domSelect.addEventListener('change', this._onChange.bind(this));
    this.setValue(value);
    this.setCallback(callback);
  };

  Combobox.prototype = {
    _onChange: function (ev) {
      this.setValue(ev.target.value);
    },
    addOptions: function (options) {
      var keys = Object.keys(options);
      for (var i = 0; i < keys.length; ++i) {
        var opt = document.createElement('option');
        opt.innerHTML = options[keys[i]];
        opt.value = keys[i];
        this.domSelect.appendChild(opt);
      }
    },
    setValue: function (val, ignoreCB) {
      this.domSelect.value = val;
      if (!ignoreCB && this.callback) this.callback(val);
    },
    getValue: function () {
      return this.domSelect.value;
    }
  };

  GuiUtils.makeProxy(BaseWidget, Combobox);

  return Combobox;
});
define('widgets/Slider',[
  'utils/GuiUtils',
  'widgets/BaseWidget'
], function (GuiUtils, BaseWidget) {

  var Slider = function (valOrObject, callbackOrKey, min, max, step) {
    var value = this._getInitialValue(valOrObject, callbackOrKey);
    var callback = this._getCheckCallback(valOrObject, callbackOrKey);
    value = value !== undefined ? value : 100;
    min = min !== undefined ? min : 0;
    max = max !== undefined ? max : 200;
    step = step !== undefined ? step : 1;

    // slider
    this.domSlider = document.createElement('div');
    this.domSlider.className = 'gui-slider';
    this.domSliderFill = document.createElement('div');
    this.domSlider.appendChild(this.domSliderFill);

    // text input
    this.domInputText = document.createElement('input');
    this.domInputText.className = 'gui-input-number';
    this.domInputText.type = 'number';
    this.min = this.domInputText.min = min;
    this.max = this.domInputText.max = max;
    this.step = this.domInputText.step = step;

    this.domInputText.addEventListener('keydown', this._onKeyDown.bind(this));
    this.domInputText.addEventListener('change', this._onInputText.bind(this));
    this.domInputText.addEventListener('blur', this._onInputText.bind(this));
    this.domSlider.addEventListener('mousedown', this._onMouseDown.bind(this));
    window.addEventListener('mouseup', this._onMouseUp.bind(this), true);
    window.addEventListener('mousemove', this._onMouseMove.bind(this));

    this.lastValue = value;
    this.isDown = false;
    this.setValue(value);
    this.setCallback(callback);
  };

  Slider.prototype = {
    _onInputText: function (ev) {
      var val = parseFloat(ev.target.value);
      if (val !== val || val === this.lastValue) return;
      this.setValue(val);
    },
    _onKeyDown: function (ev) {
      ev.stopPropagation();
      if (ev.which === 13) // enter
        this.domInputText.blur();
    },
    _onMouseMove: function (ev) {
      ev.preventDefault();
      if (!this.isDown)
        return;
      var rect = this.domSlider.getBoundingClientRect();
      var val = this.min + (this.max - this.min) * ((ev.clientX - rect.left) / rect.width);
      this.setValue(val);
    },
    _onMouseDown: function (ev) {
      this.isDown = true;
      this._onMouseMove(ev);
    },
    _onMouseUp: function () {
      this.isDown = false;
    },
    _setDomContainer: function (container) {
      this.domContainer = container;
    },
    getValue: function () {
      return parseFloat(this.domInputText.value);
    },
    setValue: function (val, ignoreCB) {
      this.lastValue = val;
      val = Math.max(Math.min(val, this.max), this.min);
      val = Math.round(val / this.step) * this.step;
      this.domInputText.value = val;
      var per = this.min;
      if (this.max !== this.min) per = (val - this.min) / (this.max - this.min);
      this.domSliderFill.style.width = 100 * per + '%';
      if (!ignoreCB && this.callback) this.callback(val);
    },
    setMax: function (max) {
      this.domInputText.max = this.max = max;
      return this;
    },
    setMin: function (min) {
      this.min = min;
      return this;
    }
  };

  GuiUtils.makeProxy(BaseWidget, Slider);

  return Slider;
});
define('widgets/Title',[
  'utils/GuiUtils',
  'widgets/BaseWidget'
], function (GuiUtils, BaseWidget) {

  var Title = function (name) {
    this.domText = document.createElement('div');
    this.domText.innerHTML = name || '';
    this.domText.className = 'group-title';
  };

  Title.prototype = {
    setText: function (text) {
      this.domText.innerHTML = text;
    },
    setVisibility: function (visible) {
      this.domText.hidden = !visible;
    }
  };

  GuiUtils.makeProxy(BaseWidget, Title);

  return Title;
});
define('containers/BaseContainer',[
  'widgets/BaseWidget',
  'widgets/Button',
  'widgets/Checkbox',
  'widgets/Color',
  'widgets/Combobox',
  'widgets/Slider',
  'widgets/Title'
], function (BaseWidget, Button, Checkbox, Color, Combobox, Slider, Title) {

  var BaseContainer = function () {};

  // label : 36%
  // slider : bar 52% + margin 2% + input 10%
  // combobox : 64%
  // color : 64%
  BaseContainer.prototype = {
    _addLine: function (name) {
      var domLine = document.createElement('li');
      domLine.innerHTML = name || '';
      this.domUl.appendChild(domLine);
      return domLine;
    },
    _createLabel: function (name) {
      var domLabel = document.createElement('label');
      domLabel.className = 'gui-label-side';
      domLabel.innerHTML = name || '';
      return domLabel;
    },
    _setDomContainer: function (container) {
      this.domContainer = container;
    },
    addTitle: function (name) {
      var widget = new Title(name);
      this.domUl.appendChild(widget.domText);
      return widget;
    },
    addCheckbox: function (name, valOrObject, callbackOrKey) {
      var widget = new Checkbox(valOrObject, callbackOrKey);
      var domLine = this._addLine();
      domLine.className += ' gui-pointerOnHover gui-glowOnHover';
      var domLabel = this._createLabel(name);
      domLabel.style.overflow = 'visible';
      domLabel.className += ' gui-pointerOnHover';
      domLine.appendChild(domLabel);
      domLine.appendChild(widget.domCheckbox);
      domLine.appendChild(widget.domLabelCheckbox);
      domLine.addEventListener('mousedown', widget._onMouseDown.bind(widget));
      widget._setDomContainer(domLine);
      return widget;
    },
    addCombobox: function (name, valOrObject, callbackOrKey, options) {
      var widget = new Combobox(valOrObject, callbackOrKey, options);
      var domLine = this._addLine();
      if (name) domLine.appendChild(this._createLabel(name));
      else widget.domSelect.style.width = '100%';
      domLine.appendChild(widget.domSelect);
      widget._setDomContainer(domLine);
      return widget;
    },
    addSlider: function (name, valOrObject, callbackOrKey, min, max, step) {
      var widget = new Slider(valOrObject, callbackOrKey, min, max, step);
      var domLine = this._addLine();
      if (name) domLine.appendChild(this._createLabel(name));
      domLine.appendChild(widget.domInputText);
      domLine.appendChild(widget.domSlider);
      widget._setDomContainer(domLine);
      return widget;
    },
    addColor: function (name, valOrObject, callbackOrKey) {
      var widget = new Color(valOrObject, callbackOrKey);
      var domLine = this._addLine();
      if (name) domLine.appendChild(this._createLabel(name));
      else widget.domColor.style.width = '100%';
      domLine.appendChild(widget.domColor);
      widget._setDomContainer(domLine);
      return widget;
    },
    addButton: function (name, callbackOrObject, key) {
      var widget = new Button(name, callbackOrObject, key);
      var domLine = this._addLine();
      domLine.appendChild(widget.domButton);
      widget._setDomContainer(domLine);
      return widget;
    },
    addDualButton: function (name1, name2, callbackOrObject1, callbackOrObject2, key1, key2) {
      var widget1 = new Button(name1, callbackOrObject1, key1);
      var widget2 = new Button(name2, callbackOrObject2, key2);
      var domLine = this._addLine();
      domLine.appendChild(widget2.domButton);
      domLine.appendChild(widget1.domButton);
      var style1 = widget1.domButton.style;
      var style2 = widget2.domButton.style;
      style1.width = style2.width = '49%';
      style1.marginRight = style2.marginLeft = '1%';
      widget1._setDomContainer(domLine);
      widget2._setDomContainer(domLine);
      return [widget1, widget2];
    },
    setVisibility: function (visible) {
      if (!this.domContainer) return;
      this.domContainer.hidden = !visible;
    }
  };

  return BaseContainer;
});
define('containers/Folder',[
  'utils/GuiUtils',
  'containers/BaseContainer'
], function (GuiUtils, BaseContainer) {

  var Folder = function (name) {
    this.domUl = document.createElement('ul');
    this.domUl.setAttribute('opened', true);

    var domTitle = document.createElement('label');
    domTitle.innerHTML = name || '';

    domTitle.addEventListener('mousedown', this._onMouseDown.bind(this));

    this.domUl.appendChild(domTitle);
    this.isOpen = true;
  };

  Folder.prototype = {
    _onMouseDown: function () {
      this.isOpen = !this.isOpen;
      this.domUl.setAttribute('opened', this.isOpen);
    },
    open: function () {
      this.isOpen = true;
      this.domUl.setAttribute('opened', true);
    },
    close: function () {
      this.isOpen = false;
      this.domUl.setAttribute('opened', false);
    },
    setVisibility: function (visible) {
      if (!visible) this.domUl.setAttribute('opened', false);
      else if (this.isOpen) this.domUl.setAttribute('opened', true);
      this.domUl.style.height = visible ? 'auto' : '0px';
    }
  };

  GuiUtils.makeProxy(BaseContainer, Folder);

  return Folder;
});
define('containers/Sidebar',[
  'containers/Folder'
], function (Folder) {

  var Sidebar = function (callbackResize) {
    this.domSidebar = document.createElement('div');
    this.domSidebar.className = 'gui-sidebar';

    this.domResize = document.createElement('div');
    this.domResize.className = 'gui-resize';

    this.isDragging = false;
    this.mouseX = 0;
    this.domResize.addEventListener('mousedown', this._onMouseDown.bind(this));
    window.addEventListener('mousemove', this._onMouseMove.bind(this));
    window.addEventListener('mouseup', this._onMouseUp.bind(this));

    this.callbackResize = callbackResize;
    this.isOnTheRight = false;
  };

  Sidebar.prototype = {
    _setTop: function (nb) {
      this.domSidebar.style.top = this.domResize.style.top = nb + 'px';
    },
    _onTheRight: function () {
      this.isOnTheRight = true;
      this.domSidebar.style.right = 0;
      this.domSidebar.style.borderRight = 0;
      this.domSidebar.style.borderLeft = 'double';
      this.domSidebar.style.borderColor = 'rgba(255,255,255,0.3)';
      this.domResize.style.left = 'auto';
      this.domResize.style.right = this.domSidebar.offsetWidth + 'px';
      this.domResize.style.marginRight = '-3px';
    },
    _onMouseDown: function (ev) {
      this.isDragging = true;
      this.mouseX = ev.clientX;
    },
    _updateCanvasPosition: function (canvas) {
      var w = this.domSidebar.hidden ? 0 : this.domSidebar.offsetWidth;
      if (this.isOnTheRight) {
        canvas.width -= w;
      } else {
        canvas.style.left = this.domSidebar.offsetLeft + w + 'px';
        canvas.width -= w;
      }
    },
    _onMouseMove: function (ev) {
      if (this.isDragging === false) return;
      var mouseX = ev.clientX;
      var delta = mouseX - this.mouseX;
      if (this.isOnTheRight) delta = -delta;
      var widthBar = Math.max(50, this.domSidebar.offsetWidth + delta);

      var val = widthBar + 'px';
      this.domSidebar.style.width = val;
      if (this.isOnTheRight) this.domResize.style.right = this.domSidebar.offsetWidth + 'px';
      else this.domResize.style.left = val;

      this.mouseX = mouseX;
      this.callbackResize();
    },
    _onMouseUp: function () {
      this.isDragging = false;
    },
    addMenu: function (name) {
      var folder = new Folder(name);
      this.domSidebar.appendChild(folder.domUl);
      return folder;
    },
    setVisibility: function (visible) {
      this.domSidebar.hidden = !visible;
      this.domResize.hidden = !visible;
      this.callbackResize();
    }
  };

  return Sidebar;
});
define('widgets/MenuButton',[
  'utils/GuiUtils',
  'widgets/BaseWidget'
], function (GuiUtils, BaseWidget) {

  var MenuButton = function (callbackOrObject, shortcutOrKey, shortcut) {
    var callback = callbackOrObject;
    if (callback && typeof callback !== 'function') callback = callbackOrObject[shortcutOrKey].bind(callbackOrObject);
    else shortcut = shortcutOrKey;

    this.domSpan = document.createElement('span');
    this.domSpan.className = 'shortcut';
    this.domSpan.innerHTML = shortcut || '';

    this.setCallback(callback);
  };

  MenuButton.prototype = {
    _setDomContainer: function (container) {
      this.domContainer = container;
      container.addEventListener('click', this._onClick.bind(this));
    },
    _onClick: function () {
      if (this.callback) this.callback();
    }
  };

  GuiUtils.makeProxy(BaseWidget, MenuButton);

  return MenuButton;
});
define('containers/Menu',[
  'utils/GuiUtils',
  'containers/BaseContainer',
  'widgets/MenuButton'
], function (GuiUtils, BaseContainer, MenuButton) {

  var Menu = function () {
    this.domUl = document.createElement('ul');
  };

  Menu.prototype = {
    addButton: function (name, callbackOrObject, shortcutOrKey, shortcut) {
      var widget = new MenuButton(callbackOrObject, shortcutOrKey, shortcut);
      var domLine = this._addLine(name);
      domLine.appendChild(widget.domSpan);
      widget._setDomContainer(domLine);
      return widget;
    },
    addSlider: function (name, valOrObject, callbackOrKey, min, max, step) {
      var wid = BaseContainer.prototype.addSlider.call(this, name, valOrObject, callbackOrKey, min, max, step);
      // label 36% + slider ?% + 2% + input 18%
      wid.domInputText.style.width = '18%';
      wid.domSlider.style.width = name ? '44%' : '80%';
      return wid;
    }
  };

  GuiUtils.makeProxy(BaseContainer, Menu);

  return Menu;
});
define('utils/EditStyle',[
  'utils/GuiUtils'
], function (GuiUtils) {

  var EditStyle = {};

  EditStyle.refRules = {};

  var yaguiSheet;
  var findSheet = function () {
    if (yaguiSheet) return yaguiSheet;
    var sheets = document.styleSheets;
    for (var i = 0, nb = sheets.length; i < nb; ++i) {
      var href = sheets[i].href;
      if (href && href.indexOf('yagui.css') !== -1) {
        yaguiSheet = sheets[i];
        return yaguiSheet;
      }
    }
    return;
  };

  var editStyle = function (selector, key, value) {
    var sheet = findSheet();
    if (!sheet)
      return;
    var rules = sheet.cssRules || sheet.rules;
    var rule = EditStyle.refRules[selector];
    if (!rule) {
      var i = 0;
      var len = rules.length;
      for (i = 0; i < len; ++i) {
        if (rules[i].selectorText === selector) break;
      }
      if (i === len) return false;
      rule = EditStyle.refRules[selector] = rules[i];
    }
    if (rule)
      rule.style[key] = value;
  };

  EditStyle.changeWidgetsColor = function (color) {
    var str = GuiUtils.getStrColor(color);
    // button
    editStyle('.gui-button', 'background', str);
    // select
    editStyle('.gui-select', 'background', str);
    // slider
    editStyle('.gui-slider > div', 'background', str);
    EditStyle._curWidgetColor = color;
  };

  EditStyle.changeDisplayBoorder = function (bool) {
    var str = bool ? '1px solid #000' : '0';
    editStyle('.gui-button', 'border', str);
    // select
    editStyle('.gui-select', 'border', str);
    // slider
    editStyle('.gui-slider', 'border', str);
    editStyle('.gui-input-number', 'border', str);
    // folder
    editStyle('.gui-sidebar > ul > label', 'borderTop', str);
    editStyle('.gui-sidebar > ul > label', 'borderBottom', str);
    // side bar
    editStyle('.gui-sidebar', 'borderLeft', str);
    editStyle('.gui-sidebar', 'borderRight', str);
    // top bar
    editStyle('.gui-topbar', 'borderBottom', str);
    EditStyle._curShowBorder = bool;
  };

  EditStyle.changeBackgroundColor = function (color) {
    // side bar
    editStyle('.gui-sidebar', 'background', GuiUtils.getStrColor(color));
    // top bar
    var colTop = GuiUtils.getStrColor(GuiUtils.getColorMult(color, 0.5));
    editStyle('.gui-topbar', 'background', colTop);
    editStyle('.gui-topbar ul > li > ul', 'background', colTop);
    EditStyle._curBackgroundColor = color;
  };

  EditStyle.changeTextColor = function (color) {
    var strColor = GuiUtils.getStrColor(color);
    editStyle('*', 'color', strColor);
    editStyle('.gui-sidebar > ul > label', 'color', strColor);
    EditStyle._curTextColor = color;
  };

  EditStyle.changeOverallColor = function (color) {
    EditStyle.changeWidgetsColor(color);
    var bgCol = GuiUtils.getColorMult(color, 0.5);
    bgCol.length = 3;
    EditStyle.changeBackgroundColor(bgCol);

    var texCol = GuiUtils.getColorAdd(color, 0.5);
    for (var i = 0; i < 3; ++i) texCol[i] = Math.min(0.8, texCol[i]);
    EditStyle.changeTextColor(texCol);

    EditStyle._curWidgetColor = color;
    EditStyle._curBackgroundColor = bgCol;
    EditStyle._curTextColor = texCol;
  };

  // init value
  EditStyle._curTextColor = [0.73, 0.73, 0.73, 1.0];
  EditStyle._curWidgetColor = [0.32, 0.37, 0.39, 1.0];
  EditStyle._curBackgroundColor = [0.24, 0.24, 0.24];
  EditStyle._curShowBorder = false;

  EditStyle.changeOverallColor([0.3, 0.34, 0.4, 1.0]);
  return EditStyle;
});
define('containers/Topbar',[
  'containers/Menu',
  'utils/EditStyle'
], function (Menu, EditStyle) {

  var Topbar = function (callbackResize) {
    this.domTopbar = document.createElement('div');
    this.domTopbar.className = 'gui-topbar';

    this.domUl = document.createElement('ul');
    this.domTopbar.appendChild(this.domUl);

    this.callbackResize = callbackResize;
    this.uiExtra = {};
  };

  Topbar.prototype = {
    _updateCanvasPosition: function (canvas) {
      var h = this.domTopbar.hidden ? 0 : this.domTopbar.offsetHeight;
      canvas.style.top = h + 'px';
      canvas.height -= h;
    },
    _onChangeColor: function (callback, color) {
      callback(color);
      this.uiExtra.overallColor.setValue(EditStyle._curWidgetColor, true);
      this.uiExtra.widgetColor.setValue(EditStyle._curWidgetColor, true);
      this.uiExtra.backColor.setValue(EditStyle._curBackgroundColor, true);
      this.uiExtra.textColor.setValue(EditStyle._curTextColor, true);
    },
    addMenu: function (name) {
      var menu = new Menu();
      var li = document.createElement('li');
      li.innerHTML = name || '';
      this.domUl.appendChild(li);
      li.appendChild(menu.domUl);
      menu._setDomContainer(li);
      return menu;
    },
    addExtra: function () {
      var cb = this._onChangeColor;
      var menu = this.addMenu('Extra UI');
      var ext = this.uiExtra;
      menu.addTitle('Overall');
      ext.overallColor = menu.addColor('', EditStyle._curWidgetColor, cb.bind(this, EditStyle.changeOverallColor));

      menu.addTitle('Advanced');
      ext.widgetColor = menu.addColor('Widget', EditStyle._curWidgetColor, cb.bind(this, EditStyle.changeWidgetsColor));
      ext.backColor = menu.addColor('Back', EditStyle._curBackgroundColor, cb.bind(this, EditStyle.changeBackgroundColor));
      ext.textColor = menu.addColor('Text', EditStyle._curTextColor, cb.bind(this, EditStyle.changeTextColor));
      ext.showBorder = menu.addCheckbox('Border', EditStyle._curShowBorder, EditStyle.changeDisplayBoorder);
      return menu;
    },
    setVisibility: function (visible) {
      this.domTopbar.hidden = !visible;
      this.callbackResize();
    }
  };

  return Topbar;
});
define('GuiMain',[
  'containers/Sidebar',
  'containers/Topbar'
], function (Sidebar, Topbar) {

  var GuiMain = function (canvas, callbackResize) {
    this.domMain = document.createElement('div');
    this.domCanvas = canvas;

    this.callbackResize = callbackResize;
    if (this.domCanvas) {
      this.domCanvas.width = window.innerWidth;
      this.domCanvas.height = window.innerHeight;
    }
    this.cbResize_ = this._onWindowResize.bind(this);

    document.body.appendChild(this.domMain);
    this.leftSidebar = undefined;
    this.rightSidebar = undefined;
    this.topbar = undefined;

    window.addEventListener('resize', this._onWindowResize.bind(this), false);
  };

  GuiMain.prototype = {
    _onWindowResize: function () {
      if (this.domCanvas) {
        this.domCanvas.width = window.innerWidth;
        this.domCanvas.height = window.innerHeight;
        this.domCanvas.left = 0;
        this.domCanvas.top = 0;
        if (this.leftSidebar)
          this.leftSidebar._updateCanvasPosition(this.domCanvas);
        if (this.rightSidebar)
          this.rightSidebar._updateCanvasPosition(this.domCanvas);
        if (this.topbar)
          this.topbar._updateCanvasPosition(this.domCanvas);
      }
      this._updateSidebarsPosition();
      if (this.callbackResize)
        this.callbackResize();
    },
    _updateSidebarsPosition: function () {
      if (!this.topbar) return;
      var off = this.topbar.domTopbar.offsetHeight;
      if (this.leftSidebar)
        this.leftSidebar._setTop(off);
      if (this.rightSidebar)
        this.rightSidebar._setTop(off);
    },
    addLeftSidebar: function () {
      this.leftSidebar = new Sidebar(this.cbResize_);
      var domSide = this.leftSidebar.domSidebar;
      this.domMain.appendChild(domSide);
      this.domMain.appendChild(this.leftSidebar.domResize);

      this._updateSidebarsPosition();
      this.leftSidebar._updateCanvasPosition(this.domCanvas);
      return this.leftSidebar;
    },
    addRightSidebar: function () {
      this.rightSidebar = new Sidebar(this.cbResize_);
      var domSide = this.rightSidebar.domSidebar;
      this.domMain.appendChild(domSide);
      this.domMain.appendChild(this.rightSidebar.domResize);

      this.rightSidebar._onTheRight();
      this._updateSidebarsPosition();
      this.rightSidebar._updateCanvasPosition(this.domCanvas);
      return this.rightSidebar;
    },
    addTopbar: function () {
      this.topbar = new Topbar(this.cbResize_);
      this.domMain.appendChild(this.topbar.domTopbar);

      this._updateSidebarsPosition();
      this.topbar._updateCanvasPosition(this.domCanvas);
      return this.topbar;
    },
    setVisibility: function (visible) {
      this.domMain.hidden = !visible;
      this._onWindowResize();
    }
  };

  return GuiMain;
});
define('yagui',[
  'GuiMain',
], function (GuiMain) {

  var yagui = {};
  yagui.GuiMain = GuiMain;
  window.yagui = yagui;

  return yagui;
});
return require("yagui");}());


text:
using MatterHackers.Agg.UI;
using MatterHackers.VectorMath;

namespace MatterHackers.Agg
{
	public class WindowPage : TabPage
	{
		public WindowPage()
			: base("Window")
		{
			WindowWidget widow = new WindowWidget(new RectangleDouble(20, 20, 400, 400));
			AddChild(widow);

			GroupBox groupBox = new GroupBox("Radio Group");
			groupBox.LocalBounds = new RectangleDouble(0, 0, 300, 100);
			groupBox.OriginRelativeParent = new Vector2(0, 0);
			groupBox.AddChild(new RadioButton(0, 40, "Simple Radio Button 1"));
			groupBox.AddChild(new RadioButton(0, 20, "Simple Radio Button 2"));
			groupBox.AddChild(new RadioButton(0, 0, "Simple Radio Button 3"));
			widow.AddChild(groupBox);
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

/**
 * dynamicInput
 * directive that provides an input field of a dynamic type
 */
objectClassModule.directive('dynamicInput', function() {
    return {
        restrict:       'E',
        scope:          {
            type:        '=',
            ngModel:     '=',
            ngRequired:  '=',
            name:        '@',
            id:          '@',
            placeholder: '@',
            inline:      '='
        },
        templateUrl:    '/angular/modules/objectClass/dynamicInput.html'
    };
});


text:
from collections import namedtuple
from datetime import timedelta
from inspect import getdoc, isclass
from typing import Optional, List

from robot.api import logger
from robot.errors import DataError
from robot.libraries.BuiltIn import BuiltIn
from robot.utils import is_string
from robot.utils.importer import Importer

from robotlibcore import DynamicCore
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.remote.webelement import WebElement

from SeleniumLibrary.base import LibraryComponent
from SeleniumLibrary.errors import NoOpenBrowser, PluginError
from SeleniumLibrary.keywords import (
    AlertKeywords,
    BrowserManagementKeywords,
    CookieKeywords,
    ElementKeywords,
    FormElementKeywords,
    FrameKeywords,
    JavaScriptKeywords,
    RunOnFailureKeywords,
    ScreenshotKeywords,
    SelectElementKeywords,
    TableElementKeywords,
    WaitingKeywords,
    WebDriverCache,
    WindowKeywords,
)
from SeleniumLibrary.keywords.screenshot import EMBED
from SeleniumLibrary.locators import ElementFinder
from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout

__version__ = "6.1.0.dev1"

class SeleniumLibrary(DynamicCore):
    """SeleniumLibrary is a web testing library for Robot Framework.

    This document explains how to use keywords provided by SeleniumLibrary.
    For information about installation, support, and more, please visit the
    [https://github.com/robotframework/SeleniumLibrary|project pages].
    For more information about Robot Framework, see http://robotframework.org.

    SeleniumLibrary uses the Selenium WebDriver modules internally to
    control a web browser. See http://seleniumhq.org for more information
    about Selenium in general and SeleniumLibrary README.rst
    [https://github.com/robotframework/SeleniumLibrary#browser-drivers|Browser drivers chapter]
    for more details about WebDriver binary installation.

    %TOC%

    = Locating elements =

    All keywords in SeleniumLibrary that need to interact with an element
    on a web page take an argument typically named ``locator`` that specifies
    how to find the element. Most often the locator is given as a string
    using the locator syntax described below, but `using WebElements` is
    possible too.

    == Locator syntax ==

    SeleniumLibrary supports finding elements based on different strategies
    such as the element id, XPath expressions, or CSS selectors. The strategy
    can either be explicitly specified with a prefix or the strategy can be
    implicit.

    === Default locator strategy ===

    By default, locators are considered to use the keyword specific default
    locator strategy. All keywords support finding elements based on ``id``
    and ``name`` attributes, but some keywords support additional attributes
    or other values that make sense in their context. For example, `Click
    Link` supports the ``href`` attribute and the link text and addition
    to the normal ``id`` and ``name``.

    Examples:

    | `Click Element` | example | # Match based on ``id`` or ``name``.            |
    | `Click Link`    | example | # Match also based on link text and ``href``.   |
    | `Click Button`  | example | # Match based on ``id``, ``name`` or ``value``. |

    If a locator accidentally starts with a prefix recognized as `explicit
    locator strategy` or `implicit XPath strategy`, it is possible to use
    the explicit ``default`` prefix to enable the default strategy.

    Examples:

    | `Click Element` | name:foo         | # Find element with name ``foo``.               |
    | `Click Element` | default:name:foo | # Use default strategy with value ``name:foo``. |
    | `Click Element` | //foo            | # Find element using XPath ``//foo``.           |
    | `Click Element` | default: //foo   | # Use default strategy with value ``//foo``.    |

    === Explicit locator strategy ===

    The explicit locator strategy is specified with a prefix using either
    syntax ``strategy:value`` or ``strategy=value``. The former syntax
    is preferred because the latter is identical to Robot Framework's
    [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#named-argument-syntax|
    named argument syntax] and that can cause problems. Spaces around
    the separator are ignored, so ``id:foo``, ``id: foo`` and ``id : foo``
    are all equivalent.

    Locator strategies that are supported by default are listed in the table
    below. In addition to them, it is possible to register `custom locators`.

    | = Strategy = |          = Match based on =         |         = Example =            |
    | id           | Element ``id``.                     | ``id:example``                 |
    | name         | ``name`` attribute.                 | ``name:example``               |
    | identifier   | Either ``id`` or ``name``.          | ``identifier:example``         |
    | class        | Element ``class``.                  | ``class:example``              |
    | tag          | Tag name.                           | ``tag:div``                    |
    | xpath        | XPath expression.                   | ``xpath://div[@id="example"]`` |
    | css          | CSS selector.                       | ``css:div#example``            |
    | dom          | DOM expression.                     | ``dom:document.images[5]``     |
    | link         | Exact text a link has.              | ``link:The example``           |
    | partial link | Partial link text.                  | ``partial link:he ex``         |
    | sizzle       | Sizzle selector deprecated.         | ``sizzle:div.example``         |
    | data         | Element ``data-*`` attribute        | ``data:id:my_id``              |
    | jquery       | jQuery expression.                  | ``jquery:div.example``         |
    | default      | Keyword specific default behavior.  | ``default:example``            |

    See the `Default locator strategy` section below for more information
    about how the default strategy works. Using the explicit ``default``
    prefix is only necessary if the locator value itself accidentally
    matches some of the explicit strategies.

    Different locator strategies have different pros and cons. Using ids,
    either explicitly like ``id:foo`` or by using the `default locator
    strategy` simply like ``foo``, is recommended when possible, because
    the syntax is simple and locating elements by id is fast for browsers.
    If an element does not have an id or the id is not stable, other
    solutions need to be used. If an element has a unique tag name or class,
    using ``tag``, ``class`` or ``css`` strategy like ``tag:h1``,
    ``class:example`` or ``css:h1.example`` is often an easy solution. In
    more complex cases using XPath expressions is typically the best
    approach. They are very powerful but a downside is that they can also
    get complex.

    Examples:

    | `Click Element` | id:foo                      | # Element with id 'foo'. |
    | `Click Element` | css:div#foo h1              | # h1 element under div with id 'foo'. |
    | `Click Element` | xpath: //div[@id="foo"]//h1 | # Same as the above using XPath, not CSS. |
    | `Click Element` | xpath: //*[contains(text(), "example")] | # Element containing text 'example'. |

    *NOTE:*

    - The ``strategy:value`` syntax is only supported by SeleniumLibrary 3.0
      and newer.
    - Using the ``sizzle`` strategy or its alias ``jquery`` requires that
      the system under test contains the jQuery library.
    - Prior to SeleniumLibrary 3.0, table related keywords only supported
      ``xpath``, ``css`` and ``sizzle/jquery`` strategies.
    - ``data`` strategy is conveniance locator that will construct xpath from the parameters.
      If you have element like `<div data-automation="automation-id-2">`, you locate the element via
      ``data:automation:automation-id-2``. This feature was added in SeleniumLibrary 5.2.0

    === Implicit XPath strategy ===

    If the locator starts with ``//``  or multiple opening parenthesis in front
    of the ``//``, the locator is considered to be an XPath expression. In other
    words, using ``//div`` is equivalent to using explicit ``xpath://div`` and
    ``((//div))`` is equivalent to using explicit ``xpath:((//div))``

    Examples:

    | `Click Element` | //div[@id="foo"]//h1 |
    | `Click Element` | (//div)[2]           |

    The support for the ``(//`` prefix is new in SeleniumLibrary 3.0.
    Supporting multiple opening parenthesis is new in SeleniumLibrary 5.0.

    === Chaining locators ===

    It is possible chain multiple locators together as single locator. Each chained locator must start with locator
    strategy. Chained locators must be separated with single space, two greater than characters and followed with
    space. It is also possible mix different locator strategies, example css or xpath. Also a list can also be
    used to specify multiple locators. This is useful, is some part of locator would match as the locator separator
    but it should not. Or if there is need to existing WebElement as locator.

    Although all locators support chaining, some locator strategies do not abey the chaining. This is because
    some locator strategies use JavaScript to find elements and JavaScript is executed for the whole browser context
    and not for the element found be the previous locator. Chaining is supported by locator strategies which
    are based on Selenium API, like `xpath` or `css`, but example chaining is not supported by `sizzle` or `jquery

    Examples:
    | `Click Element` | css:.bar >> xpath://a | # To find a link which is present after an element with class "bar" |

    List examples:
    | ${locator_list} =             | `Create List`   | css:div#div_id            | xpath://*[text(), " >> "] |
    | `Page Should Contain Element` | ${locator_list} |                           |                           |
    | ${element} =                  | Get WebElement  | xpath://*[text(), " >> "] |                           |
    | ${locator_list} =             | `Create List`   | css:div#div_id            | ${element}                |
    | `Page Should Contain Element` | ${locator_list} |                           |                           |

    Chaining locators in new in SeleniumLibrary 5.0

    == Using WebElements ==

    In addition to specifying a locator as a string, it is possible to use
    Selenium's WebElement objects. This requires first getting a WebElement,
    for example, by using the `Get WebElement` keyword.

    | ${elem} =       | `Get WebElement` | id:example |
    | `Click Element` | ${elem}          |            |

    == Custom locators ==

    If more complex lookups are required than what is provided through the
    default locators, custom lookup strategies can be created. Using custom
    locators is a two part process. First, create a keyword that returns
    a WebElement that should be acted on:

    | Custom Locator Strategy | [Arguments] | ${browser} | ${locator} | ${tag} | ${constraints} |
    |   | ${element}= | Execute Javascript | return window.document.getElementById('${locator}'); |
    |   | [Return] | ${element} |

    This keyword is a reimplementation of the basic functionality of the
    ``id`` locator where ``${browser}`` is a reference to a WebDriver
    instance and ``${locator}`` is the name of the locator strategy. To use
    this locator, it must first be registered by using the
    `Add Location Strategy` keyword:

    | `Add Location Strategy` | custom | Custom Locator Strategy |

    The first argument of `Add Location Strategy` specifies the name of
    the strategy and it must be unique. After registering the strategy,
    the usage is the same as with other locators:

    | `Click Element` | custom:example |

    See the `Add Location Strategy` keyword for more details.

    = Browser and Window =

    There is different conceptual meaning when SeleniumLibrary talks
    about windows or browsers. This chapter explains those differences.

    == Browser ==

    When `Open Browser` or `Create WebDriver` keyword is called, it
    will create a new Selenium WebDriver instance by using the
    [https://www.seleniumhq.org/docs/03_webdriver.jsp|Selenium WebDriver]
    API. In SeleniumLibrary terms, a new browser is created. It is
    possible to start multiple independent browsers (Selenium Webdriver
    instances) at the same time, by calling `Open Browser` or
    `Create WebDriver` multiple times. These browsers are usually
    independent of each other and do not share data like cookies,
    sessions or profiles. Typically when the browser starts, it
    creates a single window which is shown to the user.

    == Window ==

    Windows are the part of a browser that loads the web site and presents
    it to the user. All content of the site is the content of the window.
    Windows are children of a browser. In SeleniumLibrary browser is a
    synonym for WebDriver instance. One browser may have multiple
    windows. Windows can appear as tabs, as separate windows or pop-ups with
    different position and size. Windows belonging to the same browser
    typically share the sessions detail, like cookies. If there is a
    need to separate sessions detail, example login with two different
    users, two browsers (Selenium WebDriver instances) must be created.
    New windows can be opened example by the application under test or
    by example `Execute Javascript` keyword:

    | `Execute Javascript`    window.open()    # Opens a new window with location about:blank

    The example below opens multiple browsers and windows,
    to demonstrate how the different keywords can be used to interact
    with browsers, and windows attached to these browsers.

    Structure:
    | BrowserA
    |            Window 1  (location=https://robotframework.org/)
    |            Window 2  (location=https://robocon.io/)
    |            Window 3  (location=https://github.com/robotframework/)
    |
    | BrowserB
    |            Window 1  (location=https://github.com/)

    Example:
    | `Open Browser`       | https://robotframework.org         | ${BROWSER}       | alias=BrowserA   | # BrowserA with first window is opened.                                       |
    | `Execute Javascript` | window.open()                      |                  |                  | # In BrowserA second window is opened.                                        |
    | `Switch Window`      | locator=NEW                        |                  |                  | # Switched to second window in BrowserA                                       |
    | `Go To`              | https://robocon.io                 |                  |                  | # Second window navigates to robocon site.                                    |
    | `Execute Javascript` | window.open()                      |                  |                  | # In BrowserA third window is opened.                                         |
    | ${handle}            | `Switch Window`                    | locator=NEW      |                  | # Switched to third window in BrowserA                                        |
    | `Go To`              | https://github.com/robotframework/ |                  |                  | # Third windows goes to robot framework github site.                          |
    | `Open Browser`       | https://github.com                 | ${BROWSER}       | alias=BrowserB   | # BrowserB with first windows is opened.                                      |
    | ${location}          | `Get Location`                     |                  |                  | # ${location} is: https://www.github.com                                      |
    | `Switch Window`      | ${handle}                          | browser=BrowserA |                  | # BrowserA second windows is selected.                                        |
    | ${location}          | `Get Location`                     |                  |                  | # ${location} = https://robocon.io/                                           |
    | @{locations 1}       | `Get Locations`                    |                  |                  | # By default, lists locations under the currectly active browser (BrowserA).   |
    | @{locations 2}       | `Get Locations`                    |  browser=ALL     |                  | # By using browser=ALL argument keyword list all locations from all browsers. |

    The above example, @{locations 1} contains the following items:
    https://robotframework.org/, https://robocon.io/ and
    https://github.com/robotframework/'. The @{locations 2}
    contains the following items: https://robotframework.org/,
    https://robocon.io/, https://github.com/robotframework/'
    and 'https://github.com/.

    = Timeouts, waits, and delays =

    This section discusses different ways how to wait for elements to
    appear on web pages and to slow down execution speed otherwise.
    It also explains the `time format` that can be used when setting various
    timeouts, waits, and delays.

    == Timeout ==

    SeleniumLibrary contains various keywords that have an optional
    ``timeout`` argument that specifies how long these keywords should
    wait for certain events or actions. These keywords include, for example,
    ``Wait ...`` keywords and keywords related to alerts. Additionally
    `Execute Async Javascript`. Although it does not have ``timeout``,
    argument, uses a timeout to define how long asynchronous JavaScript
    can run.

    The default timeout these keywords use can be set globally either by
    using the `Set Selenium Timeout` keyword or with the ``timeout`` argument
    when `importing` the library. If no default timeout is set globally, the
    default is 5 seconds. If None is specified for the timeout argument in the
    keywords, the default is used. See `time format` below for supported
    timeout syntax.

    == Implicit wait ==

    Implicit wait specifies the maximum time how long Selenium waits when
    searching for elements. It can be set by using the `Set Selenium Implicit
    Wait` keyword or with the ``implicit_wait`` argument when `importing`
    the library. See [https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp|
    Selenium documentation] for more information about this functionality.

    See `time format` below for supported syntax.

    == Selenium speed ==

    Selenium execution speed can be slowed down globally by using `Set
    Selenium speed` keyword. This functionality is designed to be used for
    demonstrating or debugging purposes. Using it to make sure that elements
    appear on a page is not a good idea. The above-explained timeouts
    and waits should be used instead.

    See `time format` below for supported syntax.

    == Time format ==

    All timeouts and waits can be given as numbers considered seconds
    (e.g. ``0.5`` or ``42``) or in Robot Framework's time syntax
    (e.g. ``1.5 seconds`` or ``1 min 30 s``). For more information about
    the time syntax see the
    [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#time-format|Robot Framework User Guide].

    = Run-on-failure functionality =

    SeleniumLibrary has a handy feature that it can automatically execute
    a keyword if any of its own keywords fails. By default, it uses the
    `Capture Page Screenshot` keyword, but this can be changed either by
    using the `Register Keyword To Run On Failure` keyword or with the
    ``run_on_failure`` argument when `importing` the library. It is
    possible to use any keyword from any imported library or resource file.

    The run-on-failure functionality can be disabled by using a special value
    ``NOTHING`` or anything considered false (see `Boolean arguments`)
    such as ``NONE``.

    = Boolean arguments =

    Starting from 5.0 SeleniumLibrary relies on Robot Framework to perform the
    boolean conversion based on keyword arguments [https://docs.python.org/3/library/typing.html|type hint].
    More details in Robot Framework
    [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#supported-conversions|user guide]

    Please note SeleniumLibrary 3 and 4 did have own custom methods to covert
    arguments to boolean values.

    = EventFiringWebDriver =

    The SeleniumLibrary offers support for
    [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver].
    See the Selenium and SeleniumLibrary
    [https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst#EventFiringWebDriver|EventFiringWebDriver support]
    documentation for further details.

    EventFiringWebDriver is new in SeleniumLibrary 4.0

    = Thread support =

    SeleniumLibrary is not thread-safe. This is mainly due because the underlying
    [https://github.com/SeleniumHQ/selenium/wiki/Frequently-Asked-Questions#q-is-webdriver-thread-safe|
    Selenium tool is not thread-safe] within one browser/driver instance.
    Because of the limitation in the Selenium side, the keywords or the
    API provided by the SeleniumLibrary is not thread-safe.

    = Plugins =

    SeleniumLibrary offers plugins as a way to modify and add library keywords and modify some of the internal
    functionality without creating a new library or hacking the source code. See
    [https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst#Plugins|plugin API]
    documentation for further details.

    Plugin API is new SeleniumLibrary 4.0
    """

    ROBOT_LIBRARY_SCOPE = "GLOBAL"
    ROBOT_LIBRARY_VERSION = __version__

    def __init__(
        self,
        timeout=timedelta(seconds=5),
        implicit_wait=timedelta(seconds=0),
        run_on_failure="Capture Page Screenshot",
        screenshot_root_directory: Optional[str] = None,
        plugins: Optional[str] = None,
        event_firing_webdriver: Optional[str] = None,
    ):
        """SeleniumLibrary can be imported with several optional arguments.

        - ``timeout``:
          Default value for `timeouts` used with ``Wait ...`` keywords.
        - ``implicit_wait``:
          Default value for `implicit wait` used when locating elements.
        - ``run_on_failure``:
          Default action for the `run-on-failure functionality`.
        - ``screenshot_root_directory``:
          Path to folder where possible screenshots are created or EMBED.
          See `Set Screenshot Directory` keyword for further details about EMBED.
          If not given, the directory where the log file is written is used.
        - ``plugins``:
          Allows extending the SeleniumLibrary with external Python classes.
        - ``event_firing_webdriver``:
          Class for wrapping Selenium with
          [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver]
        """
        self.timeout = _convert_timeout(timeout)
        self.implicit_wait = _convert_timeout(implicit_wait)
        self.speed = 0.0
        self.run_on_failure_keyword = RunOnFailureKeywords.resolve_keyword(
            run_on_failure
        )
        self._running_on_failure_keyword = False
        self.screenshot_root_directory = screenshot_root_directory
        self._resolve_screenshot_root_directory()
        self._element_finder = ElementFinder(self)
        self._plugin_keywords = []
        libraries = [
            AlertKeywords(self),
            BrowserManagementKeywords(self),
            CookieKeywords(self),
            ElementKeywords(self),
            FormElementKeywords(self),
            FrameKeywords(self),
            JavaScriptKeywords(self),
            RunOnFailureKeywords(self),
            ScreenshotKeywords(self),
            SelectElementKeywords(self),
            TableElementKeywords(self),
            WaitingKeywords(self),
            WindowKeywords(self),
        ]
        self.ROBOT_LIBRARY_LISTENER = LibraryListener()
        self._running_keyword = None
        self.event_firing_webdriver = None
        if is_truthy(event_firing_webdriver):
            self.event_firing_webdriver = self._parse_listener(event_firing_webdriver)
        self._plugins = []
        if is_truthy(plugins):
            plugin_libs = self._parse_plugins(plugins)
            self._plugins = plugin_libs
            libraries = libraries + plugin_libs
        self._drivers = WebDriverCache()
        DynamicCore.__init__(self, libraries)

    def run_keyword(self, name: str, args: tuple, kwargs: dict):
        try:
            return DynamicCore.run_keyword(self, name, args, kwargs)
        except Exception:
            self.failure_occurred()
            raise

    def get_keyword_tags(self, name: str) -> list:
        tags = list(DynamicCore.get_keyword_tags(self, name))
        if name in self._plugin_keywords:
            tags.append("plugin")
        return tags

    def get_keyword_documentation(self, name: str) -> str:
        if name == "__intro__":
            return self._get_intro_documentation()
        return DynamicCore.get_keyword_documentation(self, name)

    def _parse_plugin_doc(self):
        Doc = namedtuple("Doc", "doc, name")
        for plugin in self._plugins:
            yield Doc(
                doc=getdoc(plugin) or "No plugin documentation found.",
                name=plugin.__class__.__name__,
            )

    def _get_intro_documentation(self):
        intro = DynamicCore.get_keyword_documentation(self, "__intro__")
        for plugin_doc in self._parse_plugin_doc():
            intro = f"{intro}\n\n"
            intro = f"{intro}= Plugin: {plugin_doc.name} =\n\n"
            intro = f"{intro}{plugin_doc.doc}"
        return intro

    def register_driver(self, driver: WebDriver, alias: str):
        """Add's a `driver` to the library WebDriverCache.

        :param driver: Instance of the Selenium `WebDriver`.
        :type driver: selenium.webdriver.remote.webdriver.WebDriver
        :param alias: Alias given for this `WebDriver` instance.
        :type alias: str
        :return: The index of the `WebDriver` instance.
        :rtype: int
        """
        return self._drivers.register(driver, alias)

    def failure_occurred(self):
        """Method that is executed when a SeleniumLibrary keyword fails.

        By default, executes the registered run-on-failure keyword.
        Libraries extending SeleniumLibrary can overwrite this hook
        method if they want to provide custom functionality instead.
        """
        if self._running_on_failure_keyword or not self.run_on_failure_keyword:
            return
        try:
            self._running_on_failure_keyword = True
            if self.run_on_failure_keyword.lower() == "capture page screenshot":
                self.capture_page_screenshot()
            else:
                BuiltIn().run_keyword(self.run_on_failure_keyword)
        except Exception as err:
            logger.warn(
                f"Keyword '{self.run_on_failure_keyword}' could not be run on failure: {err}"
            )
        finally:
            self._running_on_failure_keyword = False

    @property
    def driver(self) -> WebDriver:
        """Current active driver.

        :rtype: selenium.webdriver.remote.webdriver.WebDriver
        :raises SeleniumLibrary.errors.NoOpenBrowser: If browser is not open.
        """
        if not self._drivers.current:
            raise NoOpenBrowser("No browser is open.")
        return self._drivers.current

    def find_element(
        self, locator: str, parent: Optional[WebElement] = None
    ) -> WebElement:
        """Find element matching `locator`.

        :param locator: Locator to use when searching the element.
            See library documentation for the supported locator syntax.
        :type locator: str or selenium.webdriver.remote.webelement.WebElement
        :param parent: Optional parent `WebElememt` to search child elements
            from. By default, search starts from the root using `WebDriver`.
        :type parent: selenium.webdriver.remote.webelement.WebElement
        :return: Found `WebElement`.
        :rtype: selenium.webdriver.remote.webelement.WebElement
        :raises SeleniumLibrary.errors.ElementNotFound: If element not found.
        """
        return self._element_finder.find(locator, parent=parent)

    def find_elements(
        self, locator: str, parent: WebElement = None
    ) -> List[WebElement]:
        """Find all elements matching `locator`.

        :param locator: Locator to use when searching the element.
            See library documentation for the supported locator syntax.
        :type locator: str or selenium.webdriver.remote.webelement.WebElement
        :param parent: Optional parent `WebElememt` to search child elements
            from. By default, search starts from the root using `WebDriver`.
        :type parent: selenium.webdriver.remote.webelement.WebElement
        :return: list of found `WebElement` or e,mpty if elements are not found.
        :rtype: list[selenium.webdriver.remote.webelement.WebElement]
        """
        return self._element_finder.find(
            locator, first_only=False, required=False, parent=parent
        )

    def _parse_plugins(self, plugins):
        libraries = []
        importer = Importer("test library")
        for parsed_plugin in self._string_to_modules(plugins):
            plugin = importer.import_class_or_module(parsed_plugin.module)
            if not isclass(plugin):
                message = f"Importing test library: '{parsed_plugin.module}' failed."
                raise DataError(message)
            plugin = plugin(self, *parsed_plugin.args, **parsed_plugin.kw_args)
            if not isinstance(plugin, LibraryComponent):
                message = (
                    "Plugin does not inherit SeleniumLibrary.base.LibraryComponent"
                )
                raise PluginError(message)
            self._store_plugin_keywords(plugin)
            libraries.append(plugin)
        return libraries

    def _parse_listener(self, event_firing_webdriver):
        listener_module = self._string_to_modules(event_firing_webdriver)
        listener_count = len(listener_module)
        if listener_count > 1:
            message = f"Is is possible import only one listener but there was {listener_count} listeners."
            raise ValueError(message)
        listener_module = listener_module[0]
        importer = Importer("test library")
        listener = importer.import_class_or_module(listener_module.module)
        if not isclass(listener):
            message = f"Importing test Selenium lister class '{listener_module.module}' failed."
            raise DataError(message)
        return listener

    def _string_to_modules(self, modules):
        Module = namedtuple("Module", "module, args, kw_args")
        parsed_modules = []
        for module in modules.split(","):
            module = module.strip()
            module_and_args = module.split(";")
            module_name = module_and_args.pop(0)
            kw_args = {}
            args = []
            for argument in module_and_args:
                if "=" in argument:
                    key, value = argument.split("=")
                    kw_args[key] = value
                else:
                    args.append(argument)
            module = Module(module=module_name, args=args, kw_args=kw_args)
            parsed_modules.append(module)
        return parsed_modules

    def _store_plugin_keywords(self, plugin):
        dynamic_core = DynamicCore([plugin])
        self._plugin_keywords.extend(dynamic_core.get_keyword_names())

    def _resolve_screenshot_root_directory(self):
        screenshot_root_directory = self.screenshot_root_directory
        if is_string(screenshot_root_directory):
            if screenshot_root_directory.upper() == EMBED:
                self.screenshot_root_directory = EMBED


text:
using namespace std;
using namespace fps_mapper;

int main(int argc, char** argv) {
  if (argc<4) {
    cerr << "usage: " << argv[0] << "<model1.dat> <model2.dat> <output.dat>" << endl;
    return 0;
  }

  ifstream is1(argv[1]);
  if(! is1) {
    cerr << "unable to load file " << argv[1] << endl;
    return 0;
  }

  ifstream is2(argv[2]);
  if(! is2) {
    cerr << "unable to load file " << argv[2] << endl;
    return 0;
  }

  cerr << "loading models" << endl;
  Cloud reference;
  reference.read(is1);
  cerr << "reference has " << reference.size() << " points" << endl;

  voxelize(reference, 0.05);
  Cloud current;
  current.read(is2);
  cerr << "current has " << current.size() << " points" << endl;
  voxelize(current, 0.05);

  NNAligner aligner;
  aligner.setReferenceModel(&reference);
  aligner.setCurrentModel(&current);
  aligner.setIterations(100);
  aligner.align();

  current.transformInPlace(aligner.T());
  reference.add(current);
  ofstream os(argv[3]);
  reference.write(os);

  return 0;

}


text:
<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
        <struct>
  <member><name>4</name><value><array><data>
  <value><string>testlink-java-api</string></value>
  <value><string>suite001</string></value>
</data></array></value></member>
</struct>
      </value>
    </param>
  </params>
</methodResponse>


text:
/*
 * Complex.h
 *
 *  Created on: Oct 16, 2012
 *      Author: se312002
 */

#ifndef COMPLEX_H_
#define COMPLEX_H_

class Complex {
public:
	Complex(double num1,double num2);
	Complex();
	Complex Add(const Complex &z);
	Complex Subtract(const Complex &z);
	Complex Multiply(const Complex &z);
	void print();
	virtual ~Complex();

protected:
	double num1_;
	double num2_;

};

#endif /* COMPLEX_H_ */


text:
package com.github.jsonj.plist;

import com.dd.plist.Base64;
import com.dd.plist.BinaryPropertyListParser;
import com.dd.plist.NSObject;
import com.dd.plist.PropertyListFormatException;
import com.github.jsonj.JsonArray;
import com.github.jsonj.JsonElement;
import com.github.jsonj.JsonObject;

import java.io.IOException;
import java.io.InputStream;
import java.time.Instant;
import java.util.Date;
import java.util.Map;
import java.util.Set;

import static com.github.jsonj.tools.JsonBuilder.array;
import static com.github.jsonj.tools.JsonBuilder.nullValue;
import static com.github.jsonj.tools.JsonBuilder.primitive;

public class JsonJPlistParser {
    public static JsonElement parse(InputStream is) throws IOException {
        try {
            return parse(BinaryPropertyListParser.parse(is));
        } catch (PropertyListFormatException e) {
            throw new IllegalArgumentException("not a plist");
        }
    }

    public static JsonElement parse(byte[] bytes) {
        try {
            return parse(BinaryPropertyListParser.parse(bytes));
        } catch (IOException | PropertyListFormatException e) {
            throw new IllegalArgumentException("not a plist");
        }
    }

    public static JsonElement parse(NSObject object) {
        return fromObject(object.toJavaObject());
    }

    private static JsonElement fromObject(Object v) {
        Class<?> clazz = v.getClass();
        if(Map.class.isAssignableFrom(clazz)) {
            return convert(convert((Map<?,?>)v));
        } else if(clazz.isAssignableFrom(byte[].class)) {
            return convert((byte[])v);
        } else if(clazz.isAssignableFrom(Object[].class)) {
            return convert((Object[])v);
        } else if(Set.class.isAssignableFrom(clazz)) {
            return convert((Set<?>)v);
        } else if(clazz.isAssignableFrom(Long.class)) {
            return convert((long)v);
        } else if(clazz.isAssignableFrom(Integer.class)) {
            return convert((int)v);
        } else if(clazz.isAssignableFrom(Double.class)) {
            return convert((double)v);
        } else if(clazz.isAssignableFrom(Boolean.class)) {
            return convert((boolean)v);
        } else if(clazz.isAssignableFrom(String.class)) {
            return convert((String)v);
        } else if(clazz.isAssignableFrom(Date.class)) {
            return convert((Date)v);
        } else if(JsonElement.class.isAssignableFrom(clazz)) {
            return (JsonElement) v;
        } else {
            // default to null
            return nullValue();
        }
    }

    private static JsonElement convert(double v) {
        return primitive(v);
    }

    private static JsonArray convert(Object[] os) {
        JsonArray a = array();
        for(Object o:os) {
            a.add(fromObject(o));
        }
        return a;

    }

    private static JsonArray convert(Set<?> v) {
        JsonArray a = array();
        for(Object o:v) {
            a.add(fromObject(o));
        }
        return a;
    }

    private static JsonObject convert(Map<?,?> m) {
        JsonObject object = new JsonObject();
        m.forEach((k,v) -> {
                object.put(k.toString(),fromObject(v));
        });
        return object;
    }

    private static JsonElement convert(Date v) {
        return primitive(Instant.ofEpochMilli(v.getTime()));
    }

    private static JsonElement convert(String v) {
        return primitive(v);
    }

    private static JsonElement convert(boolean v) {
        return primitive(v);
    }

    private static JsonElement convert(long v) {
        return primitive(v);
    }

    private static JsonElement convert(byte[] v) {
        String encoded = Base64.encodeBytes(v);
        return primitive(encoded);
    }
}


text:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
             android:layout_height="match_parent" android:background="#0099cc"
             tools:context="com.yokmama.learn10.chapter09.lesson41.android.GameActivity">

    <FrameLayout
        android:id="@+id/fullscreen_content"
        android:keepScreenOn="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_pause_game"
        android:id="@+id/pauseButton"
        android:background="@android:color/transparent"
        android:textColor="@drawable/main_menu_button"
        android:textSize="25dp"
        android:textStyle="bold"
        android:layout_gravity="right|top"
        android:layout_marginRight="@dimen/game_item_margin" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_exit_game"
        android:id="@+id/exitButton"
        android:background="@android:color/transparent"
        android:textColor="@drawable/main_menu_button"
        android:textSize="25dp"
        android:textStyle="bold"
        android:layout_gravity="left|top"
        android:layout_marginLeft="@dimen/game_item_margin" />

</FrameLayout>


text:
/**
 * Created at 3:26:14 AM Jan 11, 2011
 */
package org.jbox2d.pooling.normal;

import java.util.HashMap;

import org.jbox2d.collision.AABB;
import org.jbox2d.collision.Collision;
import org.jbox2d.collision.Distance;
import org.jbox2d.collision.TimeOfImpact;
import org.jbox2d.common.Mat22;
import org.jbox2d.common.Settings;
import org.jbox2d.common.Vec2;
import org.jbox2d.common.Vec3;
import org.jbox2d.dynamics.contacts.CircleContact;
import org.jbox2d.dynamics.contacts.Contact;
import org.jbox2d.dynamics.contacts.PolygonAndCircleContact;
import org.jbox2d.dynamics.contacts.PolygonContact;
import org.jbox2d.pooling.IDynamicStack;
import org.jbox2d.pooling.IWorldPool;

/**
 * Provides object pooling for all objects used in the engine. Objects retrieved from here should
 * only be used temporarily, and then pushed back (with the exception of arrays).
 *
 * @author Daniel Murphy
 */
public class DefaultWorldPool implements IWorldPool {

  private final OrderedStack<Vec2> vecs;
  private final OrderedStack<Vec3> vec3s;
  private final OrderedStack<Mat22> mats;
  private final OrderedStack<AABB> aabbs;

  private final HashMap<Integer, float[]> afloats = new HashMap<Integer, float[]>();
  private final HashMap<Integer, int[]> aints = new HashMap<Integer, int[]>();
  private final HashMap<Integer, Vec2[]> avecs = new HashMap<Integer, Vec2[]>();

  private final Class<?>[] classes = new Class<?>[] { IWorldPool.class };
  private final Object[] args = new Object[] { this };

  private final MutableStack<Contact, PolygonContact> pcstack = new MutableStack<Contact, PolygonContact>(
      PolygonContact.class, Settings.CONTACT_STACK_INIT_SIZE, classes, args);

  private final MutableStack<Contact, CircleContact> ccstack = new MutableStack<Contact, CircleContact>(
      CircleContact.class, Settings.CONTACT_STACK_INIT_SIZE, classes, args);

  private final MutableStack<Contact, PolygonAndCircleContact> cpstack = new MutableStack<Contact, PolygonAndCircleContact>(
      PolygonAndCircleContact.class, Settings.CONTACT_STACK_INIT_SIZE, classes, args);

  private final Collision collision;
  private final TimeOfImpact toi;
  private final Distance dist;

  public DefaultWorldPool(int argSize, int argContainerSize) {
    vecs = new OrderedStack<Vec2>(Vec2.class, argSize, argContainerSize);
    vec3s = new OrderedStack<Vec3>(Vec3.class, argSize, argContainerSize);
    mats = new OrderedStack<Mat22>(Mat22.class, argSize, argContainerSize);
    aabbs = new OrderedStack<AABB>(AABB.class, argSize, argContainerSize);

    dist = new Distance();
    collision = new Collision(this);
    toi = new TimeOfImpact(this);
  }

  public final IDynamicStack<Contact> getPolyContactStack() {
    return pcstack;
  }

  public final IDynamicStack<Contact> getCircleContactStack() {
    return ccstack;
  }

  public final IDynamicStack<Contact> getPolyCircleContactStack() {
    return cpstack;
  }

  public final Vec2 popVec2() {
    return vecs.pop();
  }

  public final Vec2[] popVec2(int argNum) {
    return vecs.pop(argNum);
  }

  public final void pushVec2(int argNum) {
    vecs.push(argNum);
  }

  public final Vec3 popVec3() {
    return vec3s.pop();
  }

  public final Vec3[] popVec3(int argNum) {
    return vec3s.pop(argNum);
  }

  public final void pushVec3(int argNum) {
    vec3s.push(argNum);
  }

  public final Mat22 popMat22() {
    return mats.pop();
  }

  public final Mat22[] popMat22(int argNum) {
    return mats.pop(argNum);
  }

  public final void pushMat22(int argNum) {
    mats.push(argNum);
  }

  public final AABB popAABB() {
    return aabbs.pop();
  }

  public final AABB[] popAABB(int argNum) {
    return aabbs.pop(argNum);
  }

  public final void pushAABB(int argNum) {
    aabbs.push(argNum);
  }

  public final Collision getCollision() {
    return collision;
  }

  public final TimeOfImpact getTimeOfImpact() {
    return toi;
  }

  public final Distance getDistance() {
    return dist;
  }

  public final float[] getFloatArray(int argLength) {
    if (!afloats.containsKey(argLength)) {
      afloats.put(argLength, new float[argLength]);
    }

    assert (afloats.get(argLength).length == argLength) : "Array not built with correct length";
    return afloats.get(argLength);
  }

  public final int[] getIntArray(int argLength) {
    if (!aints.containsKey(argLength)) {
      aints.put(argLength, new int[argLength]);
    }

    assert (aints.get(argLength).length == argLength) : "Array not built with correct length";
    return aints.get(argLength);
  }

  public final Vec2[] getVec2Array(int argLength) {
    if (!avecs.containsKey(argLength)) {
      Vec2[] ray = new Vec2[argLength];
      for (int i = 0; i < argLength; i++) {
        ray[i] = new Vec2();
      }
      avecs.put(argLength, ray);
    }

    assert (avecs.get(argLength).length == argLength) : "Array not built with correct length";
    return avecs.get(argLength);
  }
}


text:
<?php
  echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

	<title>JSON Schema validator | Datalysator</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
  <link rel="stylesheet" type="text/css" href="css/validator_style.css" />

  <?php include_once("analyticstracking.php") ?>

JSON Schema Validator


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

{% block head %}
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>{% block head_title %}{% end %}Oplog</title>

    <link rel="stylesheet" href="/static/css/blueprint/screen.css" type="text/css" media="screen, projection">
    <link rel="stylesheet" href="/static/css/blueprint/print.css" type="text/css" media="print">

    <link rel="stylesheet" href="/static/lib/mootools-datepicker/datepicker_vista/datepicker_vista.css" type="text/css" media="screen, projection">
    <link rel="stylesheet" href="/static/css/screen.css" type="text/css" media="screen, projection">
    <link rel="stylesheet" href="/static/css/print.css" type="text/css" media="print">

{% end %}

{% block body %}

Logout

      {% include "header.html" %}

{% block content %}{% end %}

{% end %}