text:
import Ember from "ember-metal/core";
import DOMHelper from "dom-helper";
import o_create from 'ember-metal/platform/create';

var HTMLBarsAttrMorph = DOMHelper.prototype.AttrMorphClass;

export var styleWarning = '' +
  'Binding style attributes may introduce cross-site scripting vulnerabilities; ' +
  'please ensure that values being bound are properly escaped. For more information, ' +
  'including how to disable this warning, see ' +
  'http://emberjs.com/deprecations/v1.x/#toc_binding-style-attributes.';

function EmberAttrMorph(element, attrName, domHelper, namespace) {
  HTMLBarsAttrMorph.call(this, element, attrName, domHelper, namespace);
}

var proto = EmberAttrMorph.prototype = o_create(HTMLBarsAttrMorph.prototype);
proto.HTMLBarsAttrMorph$setContent = HTMLBarsAttrMorph.prototype.setContent;

proto._deprecateEscapedStyle = function EmberAttrMorph_deprecateEscapedStyle(value) {
  Ember.warn(
    styleWarning,
    (function(name, value, escaped) {
      // SafeString
      if (value && value.toHTML) {
        return true;
      }

      if (name !== 'style') {
        return true;
      }

      return !escaped;
    }(this.attrName, value, this.escaped))
  );
};

proto.setContent = function EmberAttrMorph_setContent(value) {
  this._deprecateEscapedStyle(value);
  this.HTMLBarsAttrMorph$setContent(value);
};

export default EmberAttrMorph;


text:
import * as _        from './utils/utils';
import {version}     from '../../package';
import {parseToHSVA} from './utils/color';
import {HSVaColor}   from './utils/hsvacolor';
import Moveable      from './libs/moveable';
import Selectable    from './libs/selectable';
import Nanopop       from './libs/nanopop';
import buildPickr    from './template';

class Pickr {

    // Expose pickr utils
    static utils = _;

    // Expose libraries for easier integration in things build on top of it
    static libs = {
        HSVaColor,
        Moveable,
        Nanopop,
        Selectable
    };

    // Assign version and export
    static version = version;

    // Default strings
    static I18N_DEFAULTS = {

        // Strings visible in the UI
        'ui:dialog': 'color picker dialog',
        'btn:toggle': 'toggle color picker dialog',
        'btn:swatch': 'color swatch',
        'btn:last-color': 'use previous color',
        'btn:save': 'Save',
        'btn:cancel': 'Cancel',
        'btn:clear': 'Clear',

        // Strings used for aria-labels
        'aria:btn:save': 'save and close',
        'aria:btn:cancel': 'cancel and close',
        'aria:btn:clear': 'clear and close',
        'aria:input': 'color input field',
        'aria:palette': 'color selection area',
        'aria:hue': 'hue selection slider',
        'aria:opacity': 'selection slider'
    };

    // Will be used to prevent specific actions during initilization
    _initializingActive = true;

    // If the current color value should be recalculated
    _recalc = true;

    // Positioning engine and DOM-Tree
    _nanopop = null;
    _root = null;

    // Current and last color for comparison
    _color = HSVaColor();
    _lastColor = HSVaColor();
    _swatchColors = [];

    // Evenlistener name: [callbacks]
    _eventListener = {
        init: [],
        save: [],
        hide: [],
        show: [],
        clear: [],
        change: [],
        changestop: [],
        cancel: [],
        swatchselect: []
    };

    constructor(opt) {

        // Assign default values
        this.options = opt = Object.assign({
            appClass: null,
            theme: 'classic',
            useAsButton: false,
            padding: 8,
            disabled: false,
            comparison: true,
            closeOnScroll: false,
            outputPrecision: 0,
            lockOpacity: false,
            autoReposition: true,
            container: 'body',
            document,
            elementInstance: Element,

            components: {
                interaction: {}
            },

            i18n: {},
            swatches: null,
            inline: false,
            sliders: null,

            default: '#42445a',
            defaultRepresentation: null,
            position: 'bottom-middle',
            adjustableNumbers: true,
            showAlways: false,

            closeWithKey: 'Escape'
        }, opt);

        const {swatches, components, theme, sliders, lockOpacity, padding} = opt;

        if (['nano', 'monolith'].includes(theme) && !sliders) {
            opt.sliders = 'h';
        }

        // Check interaction section
        if (!components.interaction) {
            components.interaction = {};
        }

        // Overwrite palette if preview, opacity or hue are true
        const {preview, opacity, hue, palette} = components;
        components.opacity = (!lockOpacity && opacity);
        components.palette = palette || preview || opacity || hue;

        // Initialize picker
        this._preBuild();
        this._buildComponents();
        this._bindEvents();
        this._finalBuild();

        // Append pre-defined swatch colors
        if (swatches && swatches.length) {
            swatches.forEach(color => this.addSwatch(color));
        }

        // Initialize positioning engine
        const {button, app} = this._root;
        this._nanopop = Nanopop({
            reference: button,
            padding,
            el: app
        });

        // Initialize accessibility
        button.setAttribute('role', 'button');
        button.setAttribute('aria-label', this._t('btn:toggle'));

        // Initilization is finish, pickr is visible and ready for usage
        const that = this;
        requestAnimationFrame((function cb() {

            if (!app.offsetWidth && app.parentElement !== opt.container) {
                return requestAnimationFrame(cb);
            }

            // Apply default color
            that.setColor(opt.default);
            that._rePositioningPicker();

            // Initialize color representation
            if (opt.defaultRepresentation) {
                that._representation = opt.defaultRepresentation;
                that.setColorRepresentation(that._representation);
            }

            // Show pickr if locked
            if (opt.showAlways) {
                that.show();
            }

            // Initialization is done - pickr is usable, fire init event
            that._initializingActive = false;
            that._emit('init');
        }));
    }

    // Create instance via method
    static create = options => new Pickr(options);

    // Does only the absolutly basic thing to initialize the components
    _preBuild() {
        const {options} = this;

        // Resolve elements
        for (const type of ['el', 'container']) {
            options[type] = _.resolveElement(options[type],options.document, options.elementInstance);
        }

        // Create element and append it to body to
        // Prevent initialization errors
        this._root = buildPickr(this);

        // Check if a custom button is used
        if (options.useAsButton) {
            this._root.button = options.el; // Replace button with customized button
        }

        options.container.appendChild(this._root.root);
    }

    _finalBuild() {
        const opt = this.options;
        const root = this._root;

        // Remove from body
        opt.container.removeChild(root.root);

        if (opt.inline) {
            const parent = opt.el.parentElement;

            if (opt.el.nextSibling) {
                parent.insertBefore(root.app, opt.el.nextSibling);
            } else {
                parent.appendChild(root.app);
            }
        } else {
            opt.container.appendChild(root.app);
        }

        // Don't replace the the element if a custom button is used
        if (!opt.useAsButton) {
            // Replace element with actual color-picker
            opt.el.parentNode.replaceChild(root.root, opt.el);
        } else if (opt.inline) {
            opt.el.remove();
        }

        // Check if it should be immediatly disabled
        if (opt.disabled) {
            this.disable();
        }

        // Check if color comparison is disabled, if yes - remove transitions so everything keeps smoothly
        if (!opt.comparison) {
            root.button.style.transition = 'none';

            if (!opt.useAsButton) {
                root.preview.lastColor.style.transition = 'none';
            }
        }

        this.hide();
    }

    _buildComponents() {

        // Instance reference
        const inst = this;
        const cs = this.options.components;
        const sliders = (inst.options.sliders || 'v').repeat(2);
        const [so, sh] = sliders.match(/^[vh]+$/g) ? sliders : [];

        // Re-assign if null
        const getColor = () =>
            this._color || (this._color = this._lastColor.clone());

        const components = {

            palette: Moveable({
                element: inst._root.palette.picker,
                wrapper: inst._root.palette.palette,
                document: this.options.document,
                onstop: () => inst._emit('changestop', inst),
                onchange(x, y) {
                    if (!cs.palette) {
                        return;
                    }

                    const color = getColor();
                    const {_root, options} = inst;
                    const {lastColor, currentColor} = _root.preview;

                    // Update the input field only if the user is currently not typing
                    if (inst._recalc) {

                        // Calculate saturation based on the position
                        color.s = x * 100;

                        // Calculate the value
                        color.v = 100 - y * 100;

                        // Prevent falling under zero
                        color.v < 0 ? color.v = 0 : 0;
                        inst._updateOutput();
                    }

                    // Set picker and gradient color
                    const cssRGBaString = color.toRGBA().toString(0);
                    this.element.style.background = cssRGBaString;
                    this.wrapper.style.background = `
                        linear-gradient(to top, rgba(0, 0, 0, ${color.a}), transparent),
                        linear-gradient(to left, hsla(${color.h}, 100%, 50%, ${color.a}), rgba(255, 255, 255, ${color.a}))
                    `;

                    // Check if color is locked
                    if (!options.comparison) {
                        _root.button.style.color = cssRGBaString;

                        // If the user changes the color, remove the cleared icon
                        _root.button.classList.remove('clear');
                    } else if (!options.useAsButton && !inst._lastColor) {

                        // Apply color to both the last and current color since the current state is cleared
                        lastColor.style.color = cssRGBaString;
                    }

                    // Check if there's a swatch which color matches the current one
                    const hexa = color.toHEXA().toString();
                    for (const {el, color} of inst._swatchColors) {
                        el.classList[hexa === color.toHEXA().toString() ? 'add' : 'remove']('pcr-active');
                    }

                    // Change current color
                    currentColor.style.color = cssRGBaString;
                }
            }),

            hue: Moveable({
                lock: sh === 'v' ? 'h' : 'v',
                element: inst._root.hue.picker,
                wrapper: inst._root.hue.slider,
                document: this.options.document,

                onstop: () => inst._emit('changestop', inst),
                onchange(v) {
                    if (!cs.hue || !cs.palette) {
                        return;
                    }

                    const color = getColor();

                    // Calculate hue
                    if (inst._recalc) {
                        color.h = v * 360;
                    }

                    // Update color
                    this.element.style.backgroundColor = `hsl(${color.h}, 100%, 50%)`;
                    components.palette.trigger();
                }
            }),

            opacity: Moveable({
                lock: so === 'v' ? 'h' : 'v',
                element: inst._root.opacity.picker,
                wrapper: inst._root.opacity.slider,
                document: this.options.document,

                onstop: () => inst._emit('changestop', inst),
                onchange(v) {
                    if (!cs.opacity || !cs.palette) {
                        return;
                    }

                    const color = getColor();

                    // Calculate opacity
                    if (inst._recalc) {
                        color.a = Math.round(v * 1e2) / 100;
                    }

                    // Update color
                    this.element.style.background = `rgba(0, 0, 0, ${color.a})`;
                    components.palette.trigger();
                }
            }),

            selectable: Selectable({
                elements: inst._root.interaction.options,
                className: 'active',

                onchange(e) {
                    inst._representation = e.target.getAttribute('data-type').toUpperCase();
                    inst._recalc && inst._updateOutput();
                }
            })
        };

        this._components = components;
    }

    _bindEvents() {
        const {_root, options} = this;

        const eventBindings = [

            // Clear color
            _.on(_root.interaction.clear, 'click', () => this._clearColor()),

            // Select last color on click
            _.on([
                _root.interaction.cancel,
                _root.preview.lastColor
            ], 'click', () => {
                this._emit('cancel', this);
                this.setHSVA(...(this._lastColor || this._color).toHSVA(), true);
            }),

            // Save color
            _.on(_root.interaction.save, 'click', () => {
                !this.applyColor() && !options.showAlways && this.hide();
            }),

            // User input
            _.on(_root.interaction.result, ['keyup', 'input'], e => {

                // Fire listener if initialization is finish and changed color was valid
                if (this.setColor(e.target.value, true) && !this._initializingActive) {
                    this._emit('change', this._color);
                }

                e.stopImmediatePropagation();
            }),

            // Detect user input and disable auto-recalculation
            _.on(_root.interaction.result, ['focus', 'blur'], e => {
                this._recalc = e.type === 'blur';
                this._recalc && this._updateOutput();
            }),

            // Cancel input detection on color change
            _.on([
                _root.palette.palette,
                _root.palette.picker,
                _root.hue.slider,
                _root.hue.picker,
                _root.opacity.slider,
                _root.opacity.picker
            ], ['mousedown', 'touchstart'], () => this._recalc = true)
        ];

        // Provide hiding / showing abilities only if showAlways is false
        if (!options.showAlways) {
            const ck = options.closeWithKey;

            eventBindings.push(
                // Save and hide / show picker
                _.on(_root.button, 'click', () => this.isOpen() ? this.hide() : this.show()),

                // Close with escape key
                _.on(this.options.document, 'keyup', e => this.isOpen() && (e.key === ck || e.code === ck) && this.hide()),

                // Cancel selecting if the user taps behind the color picker
                _.on(this.options.document, ['touchstart', 'mousedown'], e => {
                    if (this.isOpen() && !_.eventPath(e, this.options.document).some(el => el === _root.app || el === _root.button)) {
                        this.hide();
                    }
                }, {capture: true})
            );
        }

        // Make input adjustable if enabled
        if (options.adjustableNumbers) {
            const ranges = {
                rgba: [255, 255, 255, 1],
                hsva: [360, 100, 100, 1],
                hsla: [360, 100, 100, 1],
                cmyk: [100, 100, 100, 100]
            };

            _.adjustableInputNumbers(_root.interaction.result, (o, step, index) => {
                const range = ranges[this.getColorRepresentation().toLowerCase()];

                if (range) {
                    const max = range[index];

                    // Calculate next reasonable number
                    const nv = o + (max >= 100 ? step * 1000 : step);

                    // Apply range of zero up to max, fix floating-point issues
                    return nv <= 0 ? 0 : Number((nv < max ? nv : max).toPrecision(3));
                }

                return o;
            });
        }

        if (options.autoReposition && !options.inline) {
            let timeout = null;
            const that = this;

            // Re-calc position on window resize, scroll and wheel
            eventBindings.push(
                _.on(window, ['scroll', 'resize'], () => {
                    if (that.isOpen()) {

                        if (options.closeOnScroll) {
                            that.hide();
                        }

                        if (timeout === null) {
                            timeout = setTimeout(() => timeout = null, 100);

                            // Update position on every frame
                            requestAnimationFrame(function rs() {
                                that._rePositioningPicker();
                                (timeout !== null) && requestAnimationFrame(rs);
                            });
                        } else {
                            clearTimeout(timeout);
                            timeout = setTimeout(() => timeout = null, 100);
                        }
                    }
                }, {capture: true})
            );
        }

        // Save bindings
        this._eventBindings = eventBindings;
    }

    _rePositioningPicker() {
        const {options} = this;

        // No repositioning needed if inline
        if (!options.inline) {
            this._nanopop.update(options.position, !this._recalc);
        }
    }

    _updateOutput() {
        const {_root, _color, options} = this;

        // Check if component is present
        if (_root.interaction.type()) {

            // Construct function name and call if present
            const method = `to${_root.interaction.type().getAttribute('data-type')}`;
            _root.interaction.result.value = typeof _color[method] === 'function' ?
                _color[method]().toString(options.outputPrecision) : '';
        }

        // Fire listener if initialization is finish
        if (!this._initializingActive && this._recalc) {
            this._emit('change', _color);
        }
    }

    _clearColor(silent = false) {
        const {_root, options} = this;

        // Change only the button color if it isn't customized
        if (!options.useAsButton) {
            _root.button.style.color = 'rgba(0, 0, 0, 0.15)';
        }

        _root.button.classList.add('clear');

        if (!options.showAlways) {
            this.hide();
        }

        this._lastColor = null;
        if (!this._initializingActive && !silent) {

            // Fire listener
            this._emit('save', null);
            this._emit('clear', this);
        }
    }

    _parseLocalColor(str) {
        const {values, type, a} = parseToHSVA(str);
        const {lockOpacity} = this.options;
        const alphaMakesAChange = a !== undefined && a !== 1;

        // If no opacity is applied, add undefined at the very end which gets
        // Set to 1 in setHSVA
        if (values && values.length === 3) {
            values[3] = undefined;
        }

        return {
            values: (!values || (lockOpacity && alphaMakesAChange)) ? null : values,
            type
        };
    }

    _emit(event, ...args) {
        this._eventListener[event].forEach(cb => cb(...args, this));
    }

    _t(key) {
        return this.options.i18n[key] || Pickr.I18N_DEFAULTS[key];
    }

    on(event, cb) {

        // Validate
        if (typeof cb === 'function' && typeof event === 'string' && event in this._eventListener) {
            this._eventListener[event].push(cb);
        }

        return this;
    }

    off(event, cb) {
        const callBacks = this._eventListener[event];

        if (callBacks) {
            const index = callBacks.indexOf(cb);

            if (~index) {
                callBacks.splice(index, 1);
            }
        }

        return this;
    }

    /**
     * Appends a color to the swatch palette
     * @param color
     * @returns {boolean}
     */
    addSwatch(color) {
        const {values} = this._parseLocalColor(color);

        if (values) {
            const {_swatchColors, _root} = this;
            const color = HSVaColor(...values);

            // Create new swatch HTMLElement
            const el = _.createElementFromString(

domain: javascript


text:
/*global angular*/
(function () {
    'use strict';

    angular
        .module('giccoAdmin.pricing', [])
        .config(['$stateProvider',
            function ($stateProvider) {
                $stateProvider
                    .state('app.promotions', {
                        url: "/promotions",
                        abstract: true,
                        template: '<ui-view></ui-view>',
                        ncyBreadcrumb: {
                            label: 'Promotion'
                        }
                    })
                    .state('app.promotions.cart-rules', {
                        url: '/cart-rules',
                        templateUrl: 'modules/pricing/admin/cart-rule/cart-rule-list.html',
                        controller: 'CartRuleListCtrl as vm',
                        ncyBreadcrumb: {
                            label: '{{ ::vm.translate.get("Cart Price Rules")}}'
                        }
                    })
                    .state('app.promotions.cart-rule-create', {
                        url: '/cart-rule/create',
                        templateUrl: 'modules/pricing/admin/cart-rule/cart-rule-form.html',
                        controller: 'CartRuleFormCtrl as vm',
                        ncyBreadcrumb: {
                            label: '{{ ::vm.translate.get("Create Cart Price Rule")}}'
                        }
                    })
                    .state('app.promotions.cart-rule-edit', {
                        url: '/cart-rule/edit/:id',
                        templateUrl: 'modules/pricing/admin/cart-rule/cart-rule-form.html',
                        controller: 'CartRuleFormCtrl as vm',
                        ncyBreadcrumb: {
                            label: '{{ ::vm.translate.get("Edit Cart Price Rule")}}'
                        }
                    })
                    .state('app.promotions.cart-rule-usages', {
                        url: '/cart-rule-usages',
                        templateUrl: 'modules/pricing/admin/cart-rule-usage/cart-rule-usage-list.html',
                        controller: 'CartRuleUsageListCtrl as vm',
                        ncyBreadcrumb: {
                            label: '{{ ::vm.translate.get("Usages Cart Price Rule")}}'
                        }
                    });
            }
        ]);
})();


text:
'use strict';

var assert = require('assert');
var http = require('http');
var querystring = require('querystring');
var urlutil = require('url');
var pedding = require('pedding');
var fs = require('fs');
var path = require('path');
var formstream = require('formstream');
var coffee = require('coffee');
var tar = require('tar');
var zlib = require('zlib');
var os = require('os');
var through = require('through2');
var Stream = require('stream');
var muk = require('muk'); // muk support more node versions than mm
var dns = require('dns');
var server = require('./fixtures/server');
var config = require('./config');
var urllib = require('../');

describe('test/urllib.test.js', function () {
  var host = 'http://127.0.0.1:';
  var port = null;

  before(function (done) {
    server.listen(0, function () {
      port = server.address().port;
      host += port;
      done();
    });
  });

  afterEach(muk.restore);

  after(function (done) {
    setTimeout(function () {
      server.close();
      done();
    }, 1000);
  });

  it('should assert exports', function() {
    assert(urllib.USER_AGENT);
    assert(urllib.agent);
    assert(urllib.httpsAgent);
    assert(urllib.TIMEOUT);
    assert(urllib.TIMEOUTS);
    assert(urllib.request);
    assert(urllib.requestWithCallback);
    assert(urllib.curl);
    assert(urllib.requestThunk);
    assert(urllib.HttpClient);
    assert(urllib.HttpClient2);
    assert(urllib.create);
  });

  it('should_mocked_http_service_works_fine', function (done) {
    urllib.request(host + '/?a=12&code=200', function (error, data, res) {
      assert(!error);
      assert(data instanceof Buffer);
      assert(res.statusCode === 200);
      assert(res.statusMessage === 'OK');
      done();
    });
  });

  describe('requestThunk()', function() {
    it('should mock request error', function(done) {
      urllib.requestThunk('localhost-mock-error:' + (port + 101))(function(err) {
        assert(err);
        done();
      });
    });
  });

  describe('request()', function () {
    it('should request(host-only) work', function(done) {
      urllib.request('127.0.0.1:' + port, function(err, data, res) {
        assert(!err);
        assert(data instanceof Buffer);
        assert(res.statusCode === 200);
        done();
      });
    });

    it('should request(undefined) thrown', function() {
      assert.throws(function () {
        urllib.requestWithCallback(undefined, function() {});
      }, /expect request url to be a string or a http request options, but got undefined/);
    });

    it('should request(1) thrown', function() {
      assert.throws(function () {
        urllib.requestWithCallback(1, function() {});
      }, /expect request url to be a string or a http request options, but got 1/);
    });

    it('should request(localhost:port) work', function(done) {
      urllib.requestWithCallback('localhost:' + port, function(err, data, res) {
        assert(!err);
        assert(data instanceof Buffer);
        assert(res.statusCode === 200);
        done();
      });
    });

    it('should request https success', function (done) {
      var headers = {};
      urllib.request(config.npmRegistry + '/pedding/latest', {
        timeout: 25000,
        headers: headers,
      },
      function (err, data, res) {
        assert(!err);
        assert(Buffer.isBuffer(data));
        assert(res.statusCode === 200);
        assert(res.statusMessage === 'OK');
        // don't touch headers
        assert.deepEqual(headers, {});
        done();
      });
    });

    it('should request https with port success', function (done) {
      urllib.request(config.npmRegistry + ':443/pedding/latest', {
        timeout: 25000,
      },
      function (err, data, res) {
        assert(!err);
        assert(Buffer.isBuffer(data));
        assert(res.statusCode === 200);
        done();
      });
    });

    it('should request https with rejectUnauthorized:false success', function (done) {
      urllib.request(config.npmRegistry + '/pedding/latest', {
        timeout: 25000,
        rejectUnauthorized: false,
      },
      function (err, data, res) {
        assert(!err);
        assert(Buffer.isBuffer(data));
        assert(res.statusCode === 200);
        done();
      });
    });

    it('should request https disable httpsAgent work', function (done) {
      done = pedding(2, done);
      urllib.request(config.npmRegistry + '/pedding/latest', {
        httpsAgent: false,
        timeout: 25000,
      },
      function (err, data, res) {
        assert(!err);
        assert(Buffer.isBuffer(data));
        assert(res.statusCode === 200);
        done();
      });

      urllib.request(config.npmRegistry + '/pedding/latest', {
        agent: false,
        timeout: 25000,
      },
      function (err, data, res) {
        assert(!err);
        assert(Buffer.isBuffer(data));
        assert(res.statusCode === 200);
        done();
      });
    });

    it('should include res.data', function (done) {
      urllib.request(config.npmRegistry + '/pedding/latest', {timeout: 25000},
      function (err, data, res) {
        assert(!err);
        assert(Buffer.isBuffer(data));
        assert(res.statusCode === 200);
        assert(data === res.data);
        done();
      });
    });

    it('should alias curl() work', function (done) {
      urllib.curl(config.npmRegistry + '/pedding/1.0.0', {timeout: 25000},
      function (err, data, res) {
        assert(!err);
        assert(Buffer.isBuffer(data));
        console.log(res.headers);
        assert(res.statusCode === 200);
        done();
      });
    });

    it('should 301', function (done) {
      urllib.request(host + '/301', function (err, data, res) {
        assert(res.statusCode === 301);
        assert(data.toString() === 'I am 301 body');
        done();
      });
    });

    it('should 302', function (done) {
      urllib.request(host + '/302', {followRedirect: false}, function (err, data, res) {
        assert(res.statusCode === 302);
        assert(res.headers.location === '/204');
        done();
      });
    });

    it('should redirect from 302 to 204', function (done) {
      urllib.request(host + '/302', {followRedirect: true}, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 204);
        done();
      });
    });

    it('should redirect from 307 to 204', function (done) {
      urllib.request(host + '/307', {followRedirect: true}, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 204);
        done();
      });
    });

    it('should redirect from 303 to 204', function (done) {
      urllib.request(host + '/303', {followRedirect: true}, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 204);
        done();
      });
    });

    it('should redirect to a full url and clean up the Host header', function (done) {
      var hostname = urlutil.parse(config.npmRegistry).hostname;
      urllib.request(config.npmRegistry + '/pedding/-/pedding-1.0.0.tgz', {
        followRedirect: true,
        timeout: 30000,
        headers: {
          Host: hostname,
        }
      }, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        // size should be 2107
        assert(res.size === 2107);
        done();
      });
    });

    it('should omit any header that is explicitly set to null', function (done) {
      urllib.request(host + '/headers', {
        headers: {
          DNT: null
        },
        dataType: 'json'
      }, function(err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        assert(!data.dnt);
        assert(!data.DNT);
        done();
      });
    });

    it('should omit accept-encoding header that is explicitly set to null even if option gzip is set to true', function (done) {
      urllib.request(host + '/headers', {
        headers: {
          'Accept-Encoding': null
        },
        gzip: true,
        dataType: 'json'
      }, function(err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        assert(!data['accept-encoding']);
        assert(!data['Accept-Encoding']);
        done();
      });
    });

    if (process.platform !== 'win32') {
      it('should redirect with writeStream and make sure res resume', function (done) {
        coffee.fork(path.join(__dirname, 'redirect.js'))
        .expect('stdout', '404')
        .expect('code', 0)
        .end(done);
      });
    }

    it('should FollowRedirectError', function (done) {
      urllib.request(host + '/redirect_no_location', {followRedirect: true}, function (err, data) {
        assert(err);
        assert(err.name === 'FollowRedirectError');
        assert(err.message.indexOf('Got statusCode 302 but cannot resolve next location from headers, GET http://127.0.0.1:') >= 0);
        assert(data.toString() === 'I am 302 body');
        done();
      });
    });

    it('should MaxRedirectError', function (done) {
      urllib.request(host + '/loop_redirect', {followRedirect: true}, function (err, data) {
        assert(err);
        assert(err.name === 'MaxRedirectError');
        assert(err.message.indexOf('Exceeded maxRedirects. Probably stuck in a redirect loop ') >= 0);
        assert(data.toString() === 'Redirect to /loop_redirect');
        done();
      });
    });

    describe('ConnectionTimeoutError and ResponseTimeoutError', function () {
      it('should connection timeout', function (done) {
        urllib.request('http://npm.taobao.org', { timeout: 1 }, function (err, data, res) {
          assert(err);
          assert(err.name === 'ConnectionTimeoutError');
          assert(err.message.match(/^Connect timeout for 1ms\, GET http/));
          assert(typeof err.requestId === 'number');
          assert(err.status === -2);
          assert(!data);
          assert(res);
          assert(res.status === -2);
          done();
        });
      });

      it('should response timeout', function (done) {
        urllib.request(host + '/response_timeout', { timeout: 450 }, function (err, data, res) {
          assert(err);
          assert(err.name === 'ResponseTimeoutError');
          assert(err.message.match(/^Response timeout for 450ms\, GET http/));
          assert(typeof err.requestId === 'number');
          assert(data);
          assert(data.toString() === 'foo');
          assert(res);
          assert(res.statusCode === 200);
          done();
        });
      });

      it('can pass two timeout seperately and get connect error', function (done) {
        urllib.request('http://npm.taobao.net', { timeout: [1, 10000] }, function (err, data, res) {
          assert(err);
          assert(err.name === 'ConnectionTimeoutError');
          assert(err.message.match(/^Connect timeout for 1ms\, GET http/));
          assert(typeof err.requestId === 'number');
          assert(!data);
          assert(res);
          done();
        });
      });

      it('can pass two timeout seperately and get response error', function(done) {
        urllib.request(host + '/response_timeout', { timeout: [1000, 450] }, function (err, data, res) {
          assert(err);
          assert(err.name === 'ResponseTimeoutError');
          assert(err.message.match(/^Response timeout for 450ms\, GET http/));
          assert(typeof err.requestId === 'number');
          assert(data);
          assert(data.toString() === 'foo');
          assert(res);
          assert(res.statusCode === 200);
          done();
        });
      });
    });

    it('should socket hang up by res.socket.destroy() before `response` event emit', function (done) {
      urllib.request(host + '/error', function (err, data, res) {
        assert(err);
        assert(err.name === 'ResponseError');
        assert(err.stack.indexOf('socket hang up') >= 0);
        assert(err.code === 'ECONNRESET');
        assert(!data);
        assert(res);
        done();
      });
    });

    it('should socket hang up by req.abort() before `response` event emit', function (done) {
      var req = urllib.request(host + '/timeout', {timeout: 500}, function (err, data, res) {
        assert(err);
        assert(err.stack.indexOf('socket hang up') >= 0);
        assert(err.code === 'ECONNRESET');
        assert(!data);
        assert(res);
        done();
      });
      setTimeout(function () {
        req.abort();
      }, 1);
    });

    it('should handle server socket end("balabal") will error', function (done) {
      urllib.request(host + '/socket.end.error', function (err, data) {
        assert(err);
        assert(err.name === 'ResponseError');
        err.code && assert(err.code === 'HPE_INVALID_CHUNK_SIZE');
        assert(err.message.indexOf('Parse Error, GET http://127.0.0.1:') >= 0);
        assert(err.bytesParsed === 2);
        assert(!data);
        done();
      });
    });

    it('should get data', function (done) {
      var params = {
        type: 'get',
        data: {
          sql: 'SELECT * from table',
          data: '呵呵',
        }
      };
      urllib.request(host + '/get', params, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        var info = urlutil.parse(data.toString(), true);
        assert(info.pathname === '/get');
        assert(info.query.sql === params.data.sql);
        assert(info.query.data === params.data.data);
        done();
      });
    });

    it('should get data with options', function (done) {
      var params = {
        data: {
          sql: 'SELECT * from table',
          data: '呵呵',
        }
      };
      var options = {
        path: '/get',
        port: port,
      };
      urllib.request(options, params, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        var info = urlutil.parse(data.toString(), true);
        assert(info.pathname === '/get');
        assert(info.query.sql === params.data.sql);
        assert(info.query.data === params.data.data);
        done();
      });
    });

    it('should get data with args.beforeRequest(options) to change query string', function (done) {
      var params = {
        data: {
          sql: 'SELECT * from table',
          data: '呵呵',
        },
        beforeRequest: function (options) {
          options.path += '&foo=bar';
        }
      };
      var options = {
        path: '/get',
        port: port,
      };
      urllib.request(options, params, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        var info = urlutil.parse(data.toString(), true);
        assert(info.pathname === '/get');
        assert(info.query.sql === params.data.sql);
        assert(info.query.data === params.data.data);
        assert(info.query.foo === 'bar');
        done();
      });
    });

    it('should concat query string and data correctly when GET', function (done) {
      urllib.request(host + '/get?that=in_path', {
        type: 'get',
        data: {
          'should_not': 'be_covered',
          'by': 'data',
        }
      }, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        assert(data.toString() === '/get?that=in_path&should_not=be_covered&by=data');
        done();
      });
    });

    it('should post data with options', function (done) {
      var params = {
        data: {
          sql: 'SELECT * from table',
          data: '哈哈',
        }
      };
      var options = {
        path: '/post',
        method: 'post',
        port: port,
      };
      urllib.request(options, params, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        data = querystring.parse(data.toString());
        assert(data.sql === params.data.sql);
        assert(data.data === params.data.data);
        done();
      });
    });

    it('should post/put/patch data and auto add "application/x-www-form-urlencoded" Content-Type header',
    function (done) {
      done = pedding(3, done);
      var params1 = {
        type: 'POST',
        data: {
          sql: 'SELECT * from table',
          data: '哈哈',
        }
      };
      var check = function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        assert(res.headers['x-request-content-type'] === 'application/x-www-form-urlencoded');
        data = querystring.parse(data.toString());
        assert(data.sql === params1.data.sql);
        assert(data.data === params1.data.data);
        done();
      };

      urllib.request(host + '/post', params1, check);
      var params2 = {
        type: 'put',
        data: {
          sql: 'SELECT * from table',
          data: '哈哈',
        }
      };
      urllib.request(host + '/post', params2, check);
      var params3 = {
        type: 'patch',
        data: {
          sql: 'SELECT * from table',
          data: '哈哈',
        }
      };
      urllib.request(host + '/post', params3, check);
    });

    it('should post data don\'t support nested object', function (done) {
      var params = {
        type: 'POST',
        data: {
          foo: { bar: 'foo' },
        },
      };
      urllib.request(host + '/post', params, function (err, data) {
        assert(!err);
        assert(data.toString() === 'foo=');
        done();
      });
    });

    it('should post data with form type support nested with nestedQuerystring', function (done) {
      var params = {
        type: 'POST',
        data: {
          foo: { bar: 'foo' },
        },
        nestedQuerystring: true,
      };
      urllib.request(host + '/post', params, function (err, data) {
        assert(!err);
        assert(data.toString() === 'foo%5Bbar%5D=foo');
        done();
      });
    });

    it('should post data with custom Content-Type "test-foo-encode"',
    function (done) {
      var params = {
        type: 'POST',
        data: {
          sql: 'SELECT * from table',
          data: '哈哈',
        },
        headers: {
          'Content-Type': 'test-foo-encode',
        }
      };
      urllib.request(host + '/post', params, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        assert(res.headers['x-request-content-type'] === 'test-foo-encode');
        data = querystring.parse(data.toString());
        assert(data.sql === params.data.sql);
        assert(data.data === params.data.data);
        done();
      });
    });

    it('should trust lower-case header keys and not covered by auto-added headers', function (done) {
      var params = {
        type: 'POST',
        data: {
          sql: 'SELECT * from table',
          data: '哈哈',
        },
        headers: {
          'content-type': 'test-foo-encode',
        }
      };
      urllib.request(host + '/post', params, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        assert(res.headers['x-request-content-type'] === 'test-foo-encode');
        data = querystring.parse(data.toString());
        assert(data.sql === params.data.sql);
        assert(data.data === params.data.data);
        done();
      });
    });

    it('should post big data with params.content', function (done) {
      var bigdata = new Buffer(1024 * 1024);
      urllib.request(host + '/post', {
        type: 'post',
        content: bigdata,
      }, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        assert(data.length === bigdata.length);
        done();
      });
    });

    it('should post big data with params.data', function (done) {
      var bigdata = new Buffer(1024 * 1024);
      urllib.request(host + '/post', {
        type: 'post',
        data: bigdata,
      }, function (err, data, res) {
        assert(!err);
        assert(res.statusCode === 200);
        assert(data.length === bigdata.length);
        done();
      });
    });


text:
import React from "react";
import { Link } from "react-router-dom";
import { useState } from "react";

import "./MainNavigation.css";
import MainHeader from "./MainHeader";
import NavLinks from "./NavLinks";
import SideDrawer from "./SideDrawer";
import BackDrop from "../UIElements/Backdrop/Backdrop";
const MainNavigation = (props) => {
  const [sideDrawerIsOpen, setSideDrawer] = useState(false);

  const openDrawerHandler = () => {
    setSideDrawer(true);
  };

  const closeDrawerHandler = () => {
    setSideDrawer(false);
  };
  return (
    <React.Fragment>
      {sideDrawerIsOpen && <BackDrop onClick={closeDrawerHandler} />}
      <SideDrawer show={sideDrawerIsOpen} onClick={closeDrawerHandler}>

          <NavLinks accounts={props.accounts} />

      </SideDrawer>
      <MainHeader>
        <button
          className="main-navigation__menu-btn"
          onClick={openDrawerHandler}
        >

        </button>

          <Link to="/">Registration</Link>

          <NavLinks accounts={props.accounts} />

      </MainHeader>
    </React.Fragment>
  );
};
export default MainNavigation;


text:
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var router_1 = require("@angular/router");
var localstorage_service_1 = require("./Servicios/localstorage.service");
var AppComponent = (function () {
    function AppComponent(localStorageService, router) {
        var _this = this;
        this.localStorageService = localStorageService;
        this.router = router;
        this.name = 'Angular';
        this.subscription = localStorageService.loginAnnounced$.subscribe(function (currentUser) {
            _this.currentUser = currentUser;
        });
        this.roleSubscription = localStorageService.roleAnnounced$.subscribe(function (currentRole) {
            _this.currentRole = currentRole;
        });
        this.subscription = localStorageService.logoutAnnounced$.subscribe(function (empty) {
            _this.currentUser = null;
        });
    }
    AppComponent.prototype.ngOnInit = function () {
        this.logout();
    };
    AppComponent.prototype.logout = function () {
        this.localStorageService.announceLogout();
        this.router.navigate(['/login'], {});
    };
    return AppComponent;
}());
AppComponent = __decorate([
    core_1.Component({
        moduleId: module.id,
        selector: 'my-app',
        templateUrl: 'views/navbar.html'
    }),
    __metadata("design:paramtypes", [localstorage_service_1.LocalStorageService, router_1.Router])
], AppComponent);
exports.AppComponent = AppComponent;
//# sourceMappingURL=app.component.js.map


text:
const db = require("../models");

module.exports = {
  findByUserID: function (req, res) {
    db.Holdings
      .findOne({ userId: req.user.id })
      .then(holdings => res.json(holdings.holdings))
      .catch(err => res.json(err));
  },
  updateOrCreate: function (req, res) {
    const newHoldings = req.body;
    db.Holdings
      .findOneAndUpdate({ userId: req.user.id }, { "$push": { "holdings": { "currency": newHoldings.currency, "base": newHoldings.base, "exchange": newHoldings.exchange, "amount": newHoldings.amount, "date": Date.now() } } }, { upsert: true, new: true, })
      .then(holdings => res.json(holdings.holdings))
      .catch(err => res.status(422).json(err));
  },
  remove: function (req, res) {
    const deleteHold = req.params["date"];
    db.Holdings
      .findOneAndUpdate({ userId: req.user.id }, { "$pull": { "holdings": { "date": parseInt(deleteHold) } } }, {upsert: true, new: true,})
      .then(holdings => res.json(holdings.holdings))
      .catch(err => res.status(422).json(err));
  }
};


text:
import * as React from 'react';
import wrapIcon from '../utils/wrapIcon';
const rawSvg = (iconProps) => {
    const { className, primaryFill } = iconProps;
    return React.createElement("svg", { width: 20, height: 20, viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg", className: className },
        React.createElement("path", { d: "M2 6c0-1.1.9-2 2-2h12a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V6zm6.5 6a.5.5 0 000 1h3a.5.5 0 000-1h-3z", fill: primaryFill }));
};
const Tablet20Filled = wrapIcon(rawSvg({}), 'Tablet20Filled');
export default Tablet20Filled;


text:
import React, {Component} from 'react';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import FloatingActionButton from 'material-ui/FloatingActionButton';
import ContentAdd from 'material-ui/svg-icons/content/add';

// App component - represents the whole app
import getMuiTheme from 'material-ui/styles/getMuiTheme';
const muiTheme = getMuiTheme({

        palette: {
            primary1Color: "#149CDB",
            primary2Color: "#304057",
            accent1Color: "#FF8E0B",
            textColor: "#424242",
        }
    });

export default class AddButton extends Component {

    render() {
        const background={
            backgroundColor: '#1498D5',
            height: '50',
            width: '50'
        };

        return (
            <MuiThemeProvider muiTheme={muiTheme}>
                <FloatingActionButton onClick={this.props.adding} style={background} secondary={true} className="floatingButton" aria-label="Button to add participants or actions">
                    <ContentAdd/>
                </FloatingActionButton>
            </MuiThemeProvider>

        );

    }

}


text:
import toInteger from '../_lib/toInteger/index.js'
import toDate from '../toDate/index.js'

/**
 * @name setSeconds
 * @category Second Helpers
 * @summary Set the seconds to the given date.
 *
 * @description
 * Set the seconds to the given date.
 *
 *
 * ### v2.0.0 breaking changes:
 *
 * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
 *
 * @param {Date|String|Number} date - the date to be changed
 * @param {Number} seconds - the seconds of the new date
 * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
 * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
 * @returns {Date} the new date with the seconds set
 * @throws {TypeError} 2 arguments required
 * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
 *
 * @example
 * // Set 45 seconds to 1 September 2014 11:30:40:
 * var result = setSeconds(new Date(2014, 8, 1, 11, 30, 40), 45)
 * //=> Mon Sep 01 2014 11:30:45
 */
export default function setSeconds (dirtyDate, dirtySeconds, dirtyOptions) {
  if (arguments.length < 2) {
    throw new TypeError('2 arguments required, but only ' + arguments.length + ' present')
  }

  var date = toDate(dirtyDate, dirtyOptions)
  var seconds = toInteger(dirtySeconds)
  date.setSeconds(seconds)
  return date
}


text:
/**
 * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */

/* global Event */

import preventDefault from '../../src/bindings/preventdefault';
import View from '../../src/view';

describe( 'preventDefault', () => {
	it( 'prevents default of a native DOM event', () => {
		const view = new View();

		view.setTemplate( {
			tag: 'div',

			on: {
				foo: preventDefault( view )
			}
		} );

		const evt = new Event( 'foo', { bubbles: true } );
		const spy = sinon.spy( evt, 'preventDefault' );

		// Render to enable bubbling.
		view.render();

		view.element.dispatchEvent( evt );
		sinon.assert.calledOnce( spy );
	} );

	it( 'prevents only when target is view#element', () => {
		const view = new View();
		const child = new View();

		child.setTemplate( {
			tag: 'a'
		} );

		view.setTemplate( {
			tag: 'div',

			on: {
				foo: preventDefault( view )
			},

			children: [
				child
			]
		} );

		const evt = new Event( 'foo', { bubbles: true } );
		const spy = sinon.spy( evt, 'preventDefault' );

		// Render to enable bubbling.
		view.render();

		child.element.dispatchEvent( evt );
		sinon.assert.notCalled( spy );
	} );
} );


text:
const React = require('react')

const {
  default: styled
} = require('styled-components')

const BaseComponent = props => {
  return <svg width='100%' height='100%' viewBox='0 0 16 16' preserveAspectRatio='xMidYMid meet' {...props}><rect width='100%' height='100%' id='icon-bound' fill='none' /><path d='M3,10L3,1L0,1L0,10L3,10ZM15,11C15.265,11 15.52,10.895 15.707,10.707C15.895,10.52 16,10.265 16,10C16,8.833 16,6.975 16,6.277C16,6.096 15.951,5.918 15.857,5.762C15.455,5.092 14.295,3.158 13.583,1.971C13.221,1.369 12.57,1 11.868,1C10.397,1 7.805,1 6,1C5.47,1 4.961,1.211 4.586,1.586C4.211,1.961 4,2.47 4,3C4,5.255 4,8.803 4,10.298C4,10.753 4.155,11.193 4.438,11.548C5.477,12.846 8,16 8,16C8,16 8,16 8,16C8.552,16 9,15.552 9,15L9,11L15,11Z' /></svg>
}

const HandThumbsDown = styled(BaseComponent)`
  display: inline-block;
  vertical-align: ${props => props.verticalAlign || 'top'};
  overflow: hidden;
  width: ${props => props.width || props.size || '1em'};
`
module.exports = HandThumbsDown


text:
import { Set } from 'immutable'
// import { render } from './d3Render'
import * as _ from 'lodash'
import $ from 'jquery'
import FlatCore from './flatten/core'
import BABYLON from 'babylonjs/babylon.max'
import { HexGround, HexMarker, TreeGround, UnitBase } from './flatten/entities'
import ClientCore from './ClientCore'
import { store } from './ServerStore'
import dat from 'dat.gui/build/dat.gui'

store.subscribe(_.debounce(function () {
//  render(store, store.getState())
  render(store, store.getState())
}, 200))

function getIdForPosition (x, y) {
  if (y === undefined) {
    y = x.y
    x = x.x
  }
  return x + '#' + y
}

var $output = $('#output')
var core = new FlatCore($output)
var clientCore = new ClientCore(store)
var renderedLand = {}
var renderedUnits = {}
var renderedMarkers = {}
var positionMarkersSet = Set()

function convertPosition (position) {
  return {
    x: position.y % 2 === 0 ? position.x * 1.35 : (position.x * 1.35) + 0.675,
    y: position.y * 0.389711
  }
}

function render (store, state, clientState) {
  state.map.forEach(function (land) {
    land = land.toJS()
    var hg = renderedLand[land.id]
    let position = convertPosition(land.position)
    if (!hg) {
      hg = new HexGround(
        core.scene,
        new BABYLON.Vector3(
          position.x, 0, position.y
        )
      )
      hg.init()
      hg.metadata = land
      var marker = new HexMarker(
      core.scene,
        new BABYLON.Vector3(
          position.x, 0, position.y
        )
      )
      marker.init()
      marker.color = '#ff0000'
      marker.metadata = land
      marker.hide()
      renderedMarkers[land.id] = marker
      positionMarkersSet = positionMarkersSet.add(land.id)
    }
    hg.color = land.color
    renderedLand[land.id] = hg
  })

  state.units.forEach(function (unit) {
    unit = unit.toJS()
    let position = convertPosition(
      state.map.getIn([unit.land, 'position']).toJS()
    )
    var unit3d = renderedUnits[unit.id]
    if (!unit3d) {
      unit3d = new UnitBase(
        core.scene,
        new BABYLON.Vector3(
          position.x, 0, position.y
        )
      )
      unit3d.init()
      unit3d.color = unit.color
    }
    unit3d.position = new BABYLON.Vector3(
      position.x, 0, position.y
    )
    renderedUnits[unit.id] = unit3d
  })
}

$output.on('click', function () {
  let pickResult = core.scene.pick(
    core.scene.pointerX,
    core.scene.pointerY
  )
  if (pickResult.hit) {
    let pickedPoint = pickResult.pickedPoint.clone()
    let mesh = pickResult.pickedMesh
    console.log(pickedPoint)
    while (mesh.parent) {
      mesh = mesh.parent
    }
    if (mesh.metadata) {
      // let position = convertPosition(mesh.metadata.position)
      // let land = store.getState().map.get(
        // getIdForPosition(mesh.metadata.position)
      // )
      clientCore.clickPosition(getIdForPosition(mesh.metadata.position))
      updateClientRender()
    }
  }
})

function updateClientRender () {
  if (clientCore.availableToMoveTo.length > 0) {
    var hidePositions = positionMarkersSet.subtract(
      Set(clientCore.availableToMoveTo)
    )
    hidePositions.forEach(function (landID) {
      renderedMarkers[landID].hide()
    })
    clientCore.availableToMoveTo.forEach(function (landID) {
      renderedMarkers[landID].show()
    })
  } else {
    positionMarkersSet.forEach(function (landID) {
      renderedMarkers[landID].hide()
    })
  }
}

var gui = new dat.GUI()
var lightFolder = gui.addFolder('Light Direction')
lightFolder.add(core.light.direction, 'x', null, { min: -10, max: 10, step: 0.1 })
lightFolder.add(core.light.direction, 'y', { min: -10, max: 10, step: 0.1 })
lightFolder.add(core.light.direction, 'z', { min: -10, max: 10, step: 0.1 })

var cameraFolder = gui.addFolder('Camera')
cameraFolder.add(core.camera.camera.position, 'x', -100, 100).listen()
cameraFolder.add(core.camera.camera.position, 'y', -100, 100).listen()
cameraFolder.add(core.camera.camera.position, 'z', -100, 100).listen()
cameraFolder.add(core.camera.camera.position, 'z', -100, 100).listen()
cameraFolder.add(core.camera, 'distance', -100, 100).listen()


text:
const app = require('./app');
const { createServer } = require('http');
const { Server } = require('socket.io');
const { emitTwitchEventsOnSocket } = require('./tau-socket')
const { emitChatCommandsOnSocket } = require('./twitch-chat')

const expressPort = process.env.PORT || 5000;
const httpServer = createServer(app);
const io = new Server(httpServer);

// socket.io connection used to send events to client
io.on("connection", async (socket) => {
  console.log("Socket.io Client Connected", socket.id)

  // import is an esmodule thing
  const obsOverlaysConfig = await import('./pages/obs-overlays/config/config.mjs');

  emitTwitchEventsOnSocket(obsOverlaysConfig.eventCommands, socket);
  emitChatCommandsOnSocket(obsOverlaysConfig.chatCommands, socket, obsOverlaysConfig.twitchChatConfig);
});

// express server
httpServer.listen(expressPort, async () => {
  console.log(`Express Listening: http://localhost:${expressPort}`);
});


text:
/*!
Copyright (C) 2013 by WebReflection

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
define({});


text:
/*
 *
 * 评论数据状态
 *
 */

import service from '../api';

export const state = () => {
  return {
    fetching: false,
    posting: false,
    data: {
      data: {}
    }
  };
};

export const mutations = {
  // 获取评论
  REQUEST_LIST(state) {
    state.fetching = true;
  },

  // 清空评论
  CLEAR_LIST(state) {
    state.data = {
      data: {}
    };
  },

  GET_LIST_SUCCESS(state, action) {
    state.fetching = false;
    state.data = action;
  },

  GET_LIST_FAILURE(state) {
    state.fetching = false;
    state.data = {
      data: [],
      pagination: {}
    };
  },

  // 发布评论
  POST_ITEM(state) {
    state.posting = true;
  },

  POST_ITEM_SUCCESS(state, action) {
    state.posting = false;
    state.data.data.size += 1;
    state.data.data.list.unshift(action);
  },

  POST_ITEM_FAILURE(state) {
    state.posting = false;
  },

  // 喜欢某条评论
  LIKE_ITEM(state, action) {
    const comment = state.data.data.list.find(comment => Object.is(comment.id, action.id));
    if (comment) comment.likeCount++;
  }
};

export const actions = {
  // 提交留言墙
  async postHero({ commit }, data) {
    commit('POST_ITEM');
    const res = await service.postHero(data);
    commit('POST_ITEM_FINAL');
    return res;
  },

  // 发布评论
  async postComment({ commit }, comment) {
    commit('POST_ITEM');
    const res = await service.postComment(comment);
    if (res && res.status === 1) {
      commit('POST_ITEM_SUCCESS', res.data);
      if (!comment.parentId) commit('article/ADD_COMMENT', null, { root: true });
    } else commit('POST_ITEM_FAILURE');
    return res;
  },

  // 为某条回复点赞
  async likeComment({ commit }, data) {
    const res = await service.likeComment(data);
    if (res && res.status === 1) commit('LIKE_ITEM', data);
    return res;
  },

  // 根据ref-id获取评论列表
  async loadCommentsByRefId({ commit, state }, data) {
    data.sort = data.sort || -1;
    data.currentPage = data.currentPage || 1;
    data.pageSize = data.pageSize || 60;
    commit('REQUEST_LIST');

    setTimeout(async () => {

      const res = await service.getComments(data);

      if (res && res.status === 1) {
        var resultData = res.data
        if (resultData.pageNum > 1)
          resultData.list = [...state.data.data.list, ...resultData.list];
        // if (Object.is(data.sort, -1)) res.result.data.reverse()
        commit('GET_LIST_SUCCESS', {
          data: resultData
        });
      } else commit('GET_LIST_FAILURE');
      return res;
    }, 500);
  }
};


text:
import { moduleFor } from '../../utils/test-case';
import { TogglingHelperConditionalsTest } from '../../utils/shared-conditional-tests';

moduleFor('Helpers test: inline {{if}}', class extends TogglingHelperConditionalsTest {

  templateFor({ cond, truthy, falsy }) {
    return `{{if ${cond} ${truthy} ${falsy}}}`;
  }

  ['@test it raises when there are more than three arguments']() {
    expectAssertion(() => {
      this.render(`{{if condition 'a' 'b' 'c'}}`, { condition: true });
    }, /The inline form of the `if` and `unless` helpers expect two or three arguments/);
  }

  ['@test it raises when there are less than two arguments']() {
    expectAssertion(() => {
      this.render(`{{if condition}}`, { condition: true });
    }, /The inline form of the `if` and `unless` helpers expect two or three arguments/);
  }

});

moduleFor('@glimmer Helpers test: nested {{if}} helpers (returning truthy values)', class extends TogglingHelperConditionalsTest {

  templateFor({ cond, truthy, falsy }) {
    return `{{if (if ${cond} ${cond} false) ${truthy} ${falsy}}}`;
  }

});

moduleFor('@glimmer Helpers test: nested {{if}} helpers (returning falsy values)', class extends TogglingHelperConditionalsTest {

  templateFor({ cond, truthy, falsy }) {
    return `{{if (if ${cond} true ${cond}) ${truthy} ${falsy}}}`;
  }

});

moduleFor('@glimmer Helpers test: {{if}} used with another helper', class extends TogglingHelperConditionalsTest {

  wrapperFor(templates) {
    return `{{concat ${templates.join(' ')}}}`;
  }

  templateFor({ cond, truthy, falsy }) {
    return `(if ${cond} ${truthy} ${falsy})`;
  }

});

moduleFor('@glimmer Helpers test: {{if}} used in attribute position', class extends TogglingHelperConditionalsTest {

  wrapperFor(templates) {
    return `<div data-foo="${templates.join('')}" />`;
  }

  templateFor({ cond, truthy, falsy }) {
    return `{{if ${cond} ${truthy} ${falsy}}}`;
  }

  textValue() {
    return this.$('div').attr('data-foo');
  }

});

moduleFor('Helpers test: inline {{if}} and {{unless}} without the inverse argument', class extends TogglingHelperConditionalsTest {

  templateFor({ cond, truthy, falsy }) {
    return `{{if ${cond} ${truthy}}}{{unless ${cond} ${falsy}}}`;
  }

});

moduleFor('Helpers test: inline {{unless}}', class extends TogglingHelperConditionalsTest {

  templateFor({ cond, truthy, falsy }) {
    return `{{unless ${cond} ${falsy} ${truthy}}}`;
  }

  ['@test it raises when there are more than three arguments']() {
    expectAssertion(() => {
      this.render(`{{unless condition 'a' 'b' 'c'}}`, { condition: true });
    }, /The inline form of the `if` and `unless` helpers expect two or three arguments/);
  }

  ['@test it raises when there are less than two arguments']() {
    expectAssertion(() => {
      this.render(`{{unless condition}}`, { condition: true });
    }, /The inline form of the `if` and `unless` helpers expect two or three arguments/);
  }

});

moduleFor('@glimmer Helpers test: nested {{unless}} helpers (returning truthy values)', class extends TogglingHelperConditionalsTest {

  templateFor({ cond, truthy, falsy }) {
    return `{{unless (unless ${cond} false ${cond}) ${falsy} ${truthy}}}`;
  }

});

moduleFor('@glimmer Helpers test: nested {{unless}} helpers (returning falsy values)', class extends TogglingHelperConditionalsTest {

  templateFor({ cond, truthy, falsy }) {
    return `{{unless (unless ${cond} ${cond} true) ${falsy} ${truthy}}}`;
  }

});

moduleFor('@glimmer Helpers test: {{unless}} used with another helper', class extends TogglingHelperConditionalsTest {

  wrapperFor(templates) {
    return `{{concat ${templates.join(' ')}}}`;
  }

  templateFor({ cond, truthy, falsy }) {
    return `(unless ${cond} ${falsy} ${truthy})`;
  }

});

moduleFor('@glimmer Helpers test: {{unless}} used in attribute position', class extends TogglingHelperConditionalsTest {

  wrapperFor(templates) {
    return `<div data-foo="${templates.join('')}" />`;
  }

  templateFor({ cond, truthy, falsy }) {
    return `{{unless ${cond} ${falsy} ${truthy}}}`;
  }

  textValue() {
    return this.$('div').attr('data-foo');
  }

});


text:
import blockToImage from './block-to-image';
import jpegThumbnail from './jpeg-thumbnail';
import {Base64} from 'js-base64';

const codePayload = ({blockObjects, topBlockId}) => {
    const payload = {
        type: 'script', // Needs to match backpack-server type name
        name: 'code', // All code currently gets the same name
        mime: 'application/json',
        // Backpack expects a base64 encoded string to store. Cannot use btoa because
        // the code can contain characters outside the 0-255 code-point range supported by btoa
        body: Base64.encode(JSON.stringify(blockObjects)) // Base64 encode the json
    };

    return blockToImage(topBlockId)
        .then(jpegThumbnail)
        .then(thumbnail => {
            payload.thumbnail = thumbnail.replace('data:image/jpeg;base64,', '');
            return payload;
        });
};

export default codePayload;


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.matchTemplate = exports.beASupersetOfTemplate = exports.exactlyMatchTemplate = exports.MatchStyle = void 0;
const cfnDiff = require("@aws-cdk/cloudformation-diff");
const assertion_1 = require("../assertion");
var MatchStyle;
(function (MatchStyle) {
    /** Requires an exact match */
    MatchStyle["EXACT"] = "exactly";
    /** Allows any change that does not cause a resource replacement */
    MatchStyle["NO_REPLACES"] = "no replaces";
    /** Allows additions, but no updates */
    MatchStyle["SUPERSET"] = "superset";
})(MatchStyle = exports.MatchStyle || (exports.MatchStyle = {}));
function exactlyMatchTemplate(template) {
    return matchTemplate(template, MatchStyle.EXACT);
}
exports.exactlyMatchTemplate = exactlyMatchTemplate;
function beASupersetOfTemplate(template) {
    return matchTemplate(template, MatchStyle.SUPERSET);
}
exports.beASupersetOfTemplate = beASupersetOfTemplate;
function matchTemplate(template, matchStyle = MatchStyle.EXACT) {
    return new StackMatchesTemplateAssertion(template, matchStyle);
}
exports.matchTemplate = matchTemplate;
class StackMatchesTemplateAssertion extends assertion_1.Assertion {
    constructor(template, matchStyle) {
        super();
        this.template = template;
        this.matchStyle = matchStyle;
    }
    assertOrThrow(inspector) {
        if (!this.assertUsing(inspector)) {
            // The details have already been printed, so don't generate a huge error message
            throw new Error('Template comparison produced unacceptable match');
        }
    }
    assertUsing(inspector) {
        const diff = cfnDiff.diffTemplate(this.template, inspector.value);
        const acceptable = this.isDiffAcceptable(diff);
        if (!acceptable) {
            // Print the diff
            cfnDiff.formatDifferences(process.stderr, diff);
            // Print the actual template
            process.stdout.write('--------------------------------------------------------------------------------------\n');
            process.stdout.write(JSON.stringify(inspector.value, undefined, 2) + '\n');
        }
        return acceptable;
    }
    isDiffAcceptable(diff) {
        switch (this.matchStyle) {
            case MatchStyle.EXACT:
                return diff.differenceCount === 0;
            case MatchStyle.NO_REPLACES:
                for (const change of Object.values(diff.resources.changes)) {
                    if (change.changeImpact === cfnDiff.ResourceImpact.MAY_REPLACE) {
                        return false;
                    }
                    if (change.changeImpact === cfnDiff.ResourceImpact.WILL_REPLACE) {
                        return false;
                    }
                }
                for (const change of Object.values(diff.parameters.changes)) {
                    if (change.isUpdate) {
                        return false;
                    }
                }
                for (const change of Object.values(diff.outputs.changes)) {
                    if (change.isUpdate) {
                        return false;
                    }
                }
                return true;
            case MatchStyle.SUPERSET:
                for (const change of Object.values(diff.resources.changes)) {
                    if (change.changeImpact !== cfnDiff.ResourceImpact.WILL_CREATE) {
                        return false;
                    }
                }
                for (const change of Object.values(diff.parameters.changes)) {
                    if (change.isAddition) {
                        return false;
                    }
                }
                for (const change of Object.values(diff.outputs.changes)) {
                    if (change.isAddition || change.isUpdate) {
                        return false;
                    }
                }
                return true;
        }
        throw new Error(`Unsupported match style: ${this.matchStyle}`);
    }
    get description() {
        return `template (${this.matchStyle}): ${JSON.stringify(this.template, null, 2)}`;
    }
}
//# sourceMappingURL=data:application/json;base64,[encoded data, 8524 characters]


text:
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports["default"] = void 0;

var _crAdapterRouter = _interopRequireDefault(require("../crAdapterRouter"));

var _toKline = _interopRequireDefault(require("./toKline"));

var _toOrderBook = _interopRequireDefault(require("./toOrderBook"));

var _rAdapter = {
  DF: _toKline["default"],
  OB: _toOrderBook["default"]
},
    BnAdapter = (0, _crAdapterRouter["default"])(_rAdapter);
var _default = BnAdapter;
exports["default"] = _default;
//# sourceMappingURL=BnAdapter.js.map


text:
/*!
{
  "name": "History API",
  "property": "history",
  "caniuse": "history",
  "tags": ["history"],
  "authors": ["Hay Kranen", "Alexander Farkas"],
  "notes": [{
    "name": "W3C Spec",
    "href": "http://www.w3.org/TR/html51/browsers.html#the-history-interface"
  }, {
    "name": "MDN documentation",
    "href": "https://developer.mozilla.org/en-US/docs/Web/API/window.history"
  }],
  "polyfills": ["historyjs", "html5historyapi"]
}
!*/
/* DOC

Detects support for the History API for manipulating the browser session history.

*/
define(['Modernizr'], function( Modernizr ) {
  Modernizr.addTest('history', function() {
    // Issue #733
    // The stock browser on Android 2.2 & 2.3 returns positive on history support
    // Unfortunately support is really buggy and there is no clean way to detect
    // these bugs, so we fall back to a user agent sniff :(
    var ua = navigator.userAgent;

    // We only want Android 2, stock browser, and not Chrome which identifies
    // itself as 'Mobile Safari' as well
    if (ua.indexOf('Android 2') !== -1 &&
        ua.indexOf('Mobile Safari') !== -1 &&
          ua.indexOf('Chrome') === -1) {
      return false;
    }

    // Return the regular check
    return (window.history && 'pushState' in history);
  });
});


text:
/*!
* Bootstrap v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@popperjs/core")):"function"==typeof define&&define.amd?define(["@popperjs/core"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e(t.Popper)}(this,(function(t){"use strict";function e(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var n=e(t);function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function o(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function s(){return(s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function r(t,e){var n,i;t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n=t,i=e,(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(n,i)}var a,l,c=function(t){do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t},u=function(t){var e=t.getAttribute("data-bs-target");if(!e||"#"===e){var n=t.getAttribute("href");if(!n||!n.includes("#")&&!n.startsWith("."))return null;n.includes("#")&&!n.startsWith("#")&&(n="#"+n.split("#")[1]),e=n&&"#"!==n?n.trim():null}return e},h=function(t){var e=u(t);return e&&document.querySelector(e)?e:null},d=function(t){var e=u(t);return e?document.querySelector(e):null},f=function(t){if(!t)return 0;var e=window.getComputedStyle(t),n=e.transitionDuration,i=e.transitionDelay,o=Number.parseFloat(n),s=Number.parseFloat(i);return o||s?(n=n.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(n)+Number.parseFloat(i))):0},p=function(t){t.dispatchEvent(new Event("transitionend"))},g=function(t){return(t[0]||t).nodeType},m=function(t,e){var n=!1,i=e+5;t.addEventListener("transitionend",(function e(){n=!0,t.removeEventListener("transitionend",e)})),setTimeout((function(){n||p(t)}),i)},_=function(t,e,n){Object.keys(n).forEach((function(i){var o,s=n[i],r=e[i],a=r&&g(r)?"element":null==(o=r)?""+o:{}.toString.call(o).match(/\s([a-z]+)/i)[1].toLowerCase();if(!new RegExp(s).test(a))throw new TypeError(t.toUpperCase()+': Option "'+i+'" provided type "'+a+'" but expected type "'+s+'".')}))},v=function(t){if(!t)return!1;if(t.style&&t.parentNode&&t.parentNode.style){var e=getComputedStyle(t),n=getComputedStyle(t.parentNode);return"none"!==e.display&&"none"!==n.display&&"hidden"!==e.visibility}return!1},b=function(){return function(){}},y=function(t){return t.offsetHeight},w=function(){var t=window.jQuery;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null},E="rtl"===document.documentElement.dir,T=function(t,e){var n;n=function(){var n=w();if(n){var i=n.fn[t];n.fn[t]=e.jQueryInterface,n.fn[t].Constructor=e,n.fn[t].noConflict=function(){return n.fn[t]=i,e.jQueryInterface}}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",n):n()},A=(a={},l=1,{set:function(t,e,n){void 0===t.bsKey&&(t.bsKey={key:e,id:l},l++),a[t.bsKey.id]=n},get:function(t,e){if(!t||void 0===t.bsKey)return null;var n=t.bsKey;return n.key===e?a[n.id]:null},delete:function(t,e){if(void 0!==t.bsKey){var n=t.bsKey;n.key===e&&(delete a[n.id],delete t.bsKey)}}}),k=function(t,e,n){A.set(t,e,n)},L=function(t,e){return A.get(t,e)},C=/[^.]*(?=\..*)\.|.*/,D=/\..*/,S=/::\d+$/,N={},O=1,I={mouseenter:"mouseover",mouseleave:"mouseout"},j=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function P(t,e){return e&&e+"::"+O++||t.uidEvent||O++}function x(t){var e=P(t);return t.uidEvent=e,N[e]=N[e]||{},N[e]}function H(t,e,n){void 0===n&&(n=null);for(var i=Object.keys(t),o=0,s=i.length;o<s;o++){var r=t[i[o]];if(r.originalHandler===e&&r.delegationSelector===n)return r}return null}function B(t,e,n){var i="string"==typeof e,o=i?n:e,s=t.replace(D,""),r=I[s];return r&&(s=r),j.has(s)||(s=t),[i,o,s]}function M(t,e,n,i,o){if("string"==typeof e&&t){n||(n=i,i=null);var s=B(e,n,i),r=s[0],a=s[1],l=s[2],c=x(t),u=c[l]||(c[l]={}),h=H(u,a,r?n:null);if(h)h.oneOff=h.oneOff&&o;else{var d=P(a,e.replace(C,"")),f=r?function(t,e,n){return function i(o){for(var s=t.querySelectorAll(e),r=o.target;r&&r!==this;r=r.parentNode)for(var a=s.length;a--;)if(s[a]===r)return o.delegateTarget=r,i.oneOff&&K.off(t,o.type,n),n.apply(r,[o]);return null}}(t,n,i):function(t,e){return function n(i){return i.delegateTarget=t,n.oneOff&&K.off(t,i.type,e),e.apply(t,[i])}}(t,n);f.delegationSelector=r?n:null,f.originalHandler=a,f.oneOff=o,f.uidEvent=d,u[d]=f,t.addEventListener(l,f,r)}}}function R(t,e,n,i,o){var s=H(e[n],i,o);s&&(t.removeEventListener(n,s,Boolean(o)),delete e[n][s.uidEvent])}var K={on:function(t,e,n,i){M(t,e,n,i,!1)},one:function(t,e,n,i){M(t,e,n,i,!0)},off:function(t,e,n,i){if("string"==typeof e&&t){var o=B(e,n,i),s=o[0],r=o[1],a=o[2],l=a!==e,c=x(t),u=e.startsWith(".");if(void 0===r){u&&Object.keys(c).forEach((function(n){!function(t,e,n,i){var o=e[n]||{};Object.keys(o).forEach((function(s){if(s.includes(i)){var r=o[s];R(t,e,n,r.originalHandler,r.delegationSelector)}}))}(t,c,n,e.slice(1))}));var h=c[a]||{};Object.keys(h).forEach((function(n){var i=n.replace(S,"");if(!l||e.includes(i)){var o=h[n];R(t,c,a,o.originalHandler,o.delegationSelector)}}))}else{if(!c||!c[a])return;R(t,c,a,r,s?n:null)}}},trigger:function(t,e,n){if("string"!=typeof e||!t)return null;var i,o=w(),s=e.replace(D,""),r=e!==s,a=j.has(s),l=!0,c=!0,u=!1,h=null;return r&&o&&(i=o.Event(e,n),o(t).trigger(i),l=!i.isPropagationStopped(),c=!i.isImmediatePropagationStopped(),u=i.isDefaultPrevented()),a?(h=document.createEvent("HTMLEvents")).initEvent(s,l,!0):h=new CustomEvent(e,{bubbles:l,cancelable:!0}),void 0!==n&&Object.keys(n).forEach((function(t){Object.defineProperty(h,t,{get:function(){return n[t]}})})),u&&h.preventDefault(),c&&t.dispatchEvent(h),h.defaultPrevented&&void 0!==i&&i.preventDefault(),h}},W=function(){function t(t){t&&(this._element=t,k(t,this.constructor.DATA_KEY,this))}return t.prototype.dispose=function(){var t,e;t=this._element,e=this.constructor.DATA_KEY,A.delete(t,e),this._element=null},t.getInstance=function(t){return L(t,this.DATA_KEY)},o(t,null,[{key:"VERSION",get:function(){return"5.0.0-beta2"}}]),t}(),U=function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.close=function(t){var e=t?this._getRootElement(t):this._element,n=this._triggerCloseEvent(e);null===n||n.defaultPrevented||this._removeElement(e)},n._getRootElement=function(t){return d(t)||t.closest(".alert")},n._triggerCloseEvent=function(t){return K.trigger(t,"close.bs.alert")},n._removeElement=function(t){var e=this;if(t.classList.remove("show"),t.classList.contains("fade")){var n=f(t);K.one(t,"transitionend",(function(){return e._destroyElement(t)})),m(t,n)}else this._destroyElement(t)},n._destroyElement=function(t){t.parentNode&&t.parentNode.removeChild(t),K.trigger(t,"closed.bs.alert")},e.jQueryInterface=function(t){return this.each((function(){var n=L(this,"bs.alert");n||(n=new e(this)),"close"===t&&n[t](this)}))},e.handleDismiss=function(t){return function(e){e&&e.preventDefault(),t.close(this)}},o(e,null,[{key:"DATA_KEY",get:function(){return"bs.alert"}}]),e}(W);K.on(document,"click.bs.alert.data-api",'[data-bs-dismiss="alert"]',U.handleDismiss(new U)),T("alert",U);var F=function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e.prototype.toggle=function(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))},e.jQueryInterface=function(t){return this.each((function(){var n=L(this,"bs.button");n||(n=new e(this)),"toggle"===t&&n[t]()}))},o(e,null,[{key:"DATA_KEY",get:function(){return"bs.button"}}]),e}(W);function z(t){return"true"===t||"false"!==t&&(t===Number(t).toString()?Number(t):""===t||"null"===t?null:t)}function Y(t){return t.replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}))}K.on(document,"click.bs.button.data-api",'[data-bs-toggle="button"]',(function(t){t.preventDefault();var e=t.target.closest('[data-bs-toggle="button"]'),n=L(e,"bs.button");n||(n=new F(e)),n.toggle()})),T("button",F);var X={setDataAttribute:function(t,e,n){t.setAttribute("data-bs-"+Y(e),n)},removeDataAttribute:function(t,e){t.removeAttribute("data-bs-"+Y(e))},getDataAttributes:function(t){if(!t)return{};var e={};return Object.keys(t.dataset).filter((function(t){return t.startsWith("bs")})).forEach((function(n){var i=n.replace(/^bs/,"");i=i.charAt(0).toLowerCase()+i.slice(1,i.length),e[i]=z(t.dataset[n])})),e},getDataAttribute:function(t,e){return z(t.getAttribute("data-bs-"+Y(e)))},offset:function(t){var e=t.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}},position:function(t){return{top:t.offsetTop,left:t.offsetLeft}}},q=function(t,e){var n;return void 0===e&&(e=document.documentElement),(n=[]).concat.apply(n,Element.prototype.querySelectorAll.call(e,t))},Q=function(t,e){return void 0===e&&(e=document.documentElement),Element.prototype.querySelector.call(e,t)},V=function(t,e){var n;return(n=[]).concat.apply(n,t.children).filter((function(t){return t.matches(e)}))},$=function(t,e){for(var n=t.previousElementSibling;n;){if(n.matches(e))return[n];n=n.previousElementSibling}return[]},G={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},Z={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},J=function(t){function e(e,n){var i;return(i=t.call(this,e)||this)._items=null,i._interval=null,i._activeElement=null,i._isPaused=!1,i._isSliding=!1,i.touchTimeout=null,i.touchStartX=0,i.touchDeltaX=0,i._config=i._getConfig(n),i._indicatorsElement=Q(".carousel-indicators",i._element),i._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,i._pointerEvent=Boolean(window.PointerEvent),i._addEventListeners(),i}r(e,t);var n=e.prototype;return n.next=function(){this._isSliding||this._slide("next")},n.nextWhenVisible=function(){!document.hidden&&v(this._element)&&this.next()},n.prev=function(){this._isSliding||this._slide("prev")},n.pause=function(t){t||(this._isPaused=!0),Q(".carousel-item-next, .carousel-item-prev",this._element)&&(p(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},n.cycle=function(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},n.to=function(t){var e=this;this._activeElement=Q(".active.carousel-item",this._element);var n=this._getItemIndex(this._activeElement);if(!(t>this._items.length-1||t<0))if(this._isSliding)K.one(this._element,"slid.bs.carousel",(function(){return e.to(t)}));else{if(n===t)return this.pause(),void this.cycle();var i=t>n?"next":"prev";this._slide(i,this._items[t])}},n.dispose=function(){t.prototype.dispose.call(this),K.off(this._element,".bs.carousel"),this._items=null,this._config=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},n._getConfig=function(t){return t=s({},G,t),_("carousel",t,Z),t},n._handleSwipe=function(){var t=Math.abs(this.touchDeltaX);if(!(t<=40)){var e=t/this.touchDeltaX;this.touchDeltaX=0,e>0&&(E?this.next():this.prev()),e<0&&(E?this.prev():this.next())}},n._addEventListeners=function(){var t=this;this._config.keyboard&&K.on(this._element,"keydown.bs.carousel",(function(e){return t._keydown(e)})),"hover"===this._config.pause&&(K.on(this._element,"mouseenter.bs.carousel",(function(e){return t.pause(e)})),K.on(this._element,"mouseleave.bs.carousel",(function(e){return t.cycle(e)}))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners()},n._addTouchEventListeners=function(){var t=this,e=function(e){!t._pointerEvent||"pen"!==e.pointerType&&"touch"!==e.pointerType?t._pointerEvent||(t.touchStartX=e.touches[0].clientX):t.touchStartX=e.clientX},n=function(e){!t._pointerEvent||"pen"!==e.pointerType&&"touch"!==e.pointerType||(t.touchDeltaX=e.clientX-t.touchStartX),t._handleSwipe(),"hover"===t._config.pause&&(t.pause(),t.touchTimeout&&clearTimeout(t.touchTimeout),t.touchTimeout=setTimeout((function(e){return t.cycle(e)}),500+t._config.interval))};q(".carousel-item img",this._element).forEach((function(t){K.on(t,"dragstart.bs.carousel",(function(t){return t.preventDefault()}))})),this._pointerEvent?(K.on(this._element,"pointerdown.bs.carousel",(function(t){return e(t)})),K.on(this._element,"pointerup.bs.carousel",(function(t){return n(t)})),this._element.classList.add("pointer-event")):(K.on(this._element,"touchstart.bs.carousel",(function(t){return e(t)})),K.on(this._element,"touchmove.bs.carousel",(function(e){return function(e){e.touches&&e.touches.length>1?t.touchDeltaX=0:t.touchDeltaX=e.touches[0].clientX-t.touchStartX}(e)})),K.on(this._element,"touchend.bs.carousel",(function(t){return n(t)})))},n._keydown=function(t){/input|textarea/i.test(t.target.tagName)||("ArrowLeft"===t.key?(t.preventDefault(),E?this.next():this.prev()):"ArrowRight"===t.key&&(t.preventDefault(),E?this.prev():this.next()))},n._getItemIndex=function(t){return this._items=t&&t.parentNode?q(".carousel-item",t.parentNode):[],this._items.indexOf(t)},n._getItemByDirection=function(t,e){var n="next"===t,i="prev"===t,o=this._getItemIndex(e),s=this._items.length-1;if((i&&0===o||n&&o===s)&&!this._config.wrap)return e;var r=(o+("prev"===t?-1:1))%this._items.length;return-1===r?this._items[this._items.length-1]:this._items[r]},n._triggerSlideEvent=function(t,e){var n=this._getItemIndex(t),i=this._getItemIndex(Q(".active.carousel-item",this._element));return K.trigger(this._element,"slide.bs.carousel",{relatedTarget:t,direction:e,from:i,to:n})},n._setActiveIndicatorElement=function(t){if(this._indicatorsElement){var e=Q(".active",this._indicatorsElement);e.classList.remove("active"),e.removeAttribute("aria-current");for(var n=q("[data-bs-target]",this._indicatorsElement),i=0;i<n.length;i++)if(Number.parseInt(n[i].getAttribute("data-bs-slide-to"),10)===this._getItemIndex(t)){n[i].classList.add("active"),n[i].setAttribute("aria-current","true");break}}},n._updateInterval=function(){var t=this._activeElement||Q(".active.carousel-item",this._element);if(t){var e=Number.parseInt(t.getAttribute("data-bs-interval"),10);e?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,this._config.interval=e):this._config.interval=this._config.defaultInterval||this._config.interval}},n._slide=function(t,e){var n=this,i=Q(".active.carousel-item",this._element),o=this._getItemIndex(i),s=e||i&&this._getItemByDirection(t,i),r=this._getItemIndex(s),a=Boolean(this._interval),l="next"===t?"carousel-item-start":"carousel-item-end",c="next"===t?"carousel-item-next":"carousel-item-prev",u="next"===t?"left":"right";if(s&&s.classList.contains("active"))this._isSliding=!1;else if(!this._triggerSlideEvent(s,u).defaultPrevented&&i&&s){if(this._isSliding=!0,a&&this.pause(),this._setActiveIndicatorElement(s),this._activeElement=s,this._element.classList.contains("slide")){s.classList.add(c),y(s),i.classList.add(l),s.classList.add(l);var h=f(i);K.one(i,"transitionend",(function(){s.classList.remove(l,c),s.classList.add("active"),i.classList.remove("active",c,l),n._isSliding=!1,setTimeout((function(){K.trigger(n._element,"slid.bs.carousel",{relatedTarget:s,direction:u,from:o,to:r})}),0)})),m(i,h)}else i.classList.remove("active"),s.classList.add("active"),this._isSliding=!1,K.trigger(this._element,"slid.bs.carousel",{relatedTarget:s,direction:u,from:o,to:r});a&&this.cycle()}},e.carouselInterface=function(t,n){var i=L(t,"bs.carousel"),o=s({},G,X.getDataAttributes(t));"object"==typeof n&&(o=s({},o,n));var r="string"==typeof n?n:o.slide;if(i||(i=new e(t,o)),"number"==typeof n)i.to(n);else if("string"==typeof r){if(void 0===i[r])throw new TypeError('No method named "'+r+'"');i[r]()}else o.interval&&o.ride&&(i.pause(),i.cycle())},e.jQueryInterface=function(t){return this.each((function(){e.carouselInterface(this,t)}))},e.dataApiClickHandler=function(t){var n=d(this);if(n&&n.classList.contains("carousel")){var i=s({},X.getDataAttributes(n),X.getDataAttributes(this)),o=this.getAttribute("data-bs-slide-to");o&&(i.interval=!1),e.carouselInterface(n,i),o&&L(n,"bs.carousel").to(o),t.preventDefault()}},o(e,null,[{key:"Default",get:function(){return G}},{key:"DATA_KEY",get:function(){return"bs.carousel"}}]),e}(W);K.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",J.dataApiClickHandler),K.on(window,"load.bs.carousel.data-api",(function(){for(var t=q('[data-bs-ride="carousel"]'),e=0,n=t.length;e<n;e++)J.carouselInterface(t[e],L(t[e],"bs.carousel"))})),T("carousel",J);var tt={toggle:!0,parent:""},et={toggle:"boolean",parent:"(string|element)"},nt=function(t){function e(e,n){var i;(i=t.call(this,e)||this)._isTransitioning=!1,i._config=i._getConfig(n),i._triggerArray=q('[data-bs-toggle="collapse"][href="#'+e.id+'"],[data-bs-toggle="collapse"][data-bs-target="#'+e.id+'"]');for(var o=q('[data-bs-toggle="collapse"]'),s=0,r=o.length;s<r;s++){var a=o[s],l=h(a),c=q(l).filter((function(t){return t===e}));null!==l&&c.length&&(i._selector=l,i._triggerArray.push(a))}return i._parent=i._config.parent?i._getParent():null,i._config.parent||i._addAriaAndCollapsedClass(i._element,i._triggerArray),i._config.toggle&&i.toggle(),i}r(e,t);var n=e.prototype;return n.toggle=function(){this._element.classList.contains("show")?this.hide():this.show()},n.show=function(){var t=this;if(!this._isTransitioning&&!this._element.classList.contains("show")){var n,i;this._parent&&0===(n=q(".show, .collapsing",this._parent).filter((function(e){return"string"==typeof t._config.parent?e.getAttribute("data-bs-parent")===t._config.parent:e.classList.contains("collapse")}))).length&&(n=null);var o=Q(this._selector);if(n){var s=n.find((function(t){return o!==t}));if((i=s?L(s,"bs.collapse"):null)&&i._isTransitioning)return}if(!K.trigger(this._element,"show.bs.collapse").defaultPrevented){n&&n.forEach((function(t){o!==t&&e.collapseInterface(t,"hide"),i||k(t,"bs.collapse",null)}));var r=this._getDimension();this._element.classList.remove("collapse"),this._element.classList.add("collapsing"),this._element.style[r]=0,this._triggerArray.length&&this._triggerArray.forEach((function(t){t.classList.remove("collapsed"),t.setAttribute("aria-expanded",!0)})),this.setTransitioning(!0);var a="scroll"+(r[0].toUpperCase()+r.slice(1)),l=f(this._element);K.one(this._element,"transitionend",(function(){t._element.classList.remove("collapsing"),t._element.classList.add("collapse","show"),t._element.style[r]="",t.setTransitioning(!1),K.trigger(t._element,"shown.bs.collapse")})),m(this._element,l),this._element.style[r]=this._element[a]+"px"}}},n.hide=function(){var t=this;if(!this._isTransitioning&&this._element.classList.contains("show")&&!K.trigger(this._element,"hide.bs.collapse").defaultPrevented){var


text:
layui.config({
	base : "js/"
}).use(['form','layer','jquery'],function(){
	var form = layui.form,
		layer = parent.layer === undefined ? layui.layer : parent.layer,
		$ = layui.jquery;
		var url = ["<?= yii\helpers\Url::to(['/tools/ico']); ?>",'yes'];

		$('.open-icon').click(function(){
			layer.open({title:'图标选择', type: 2, area: ['580px', '530px'], fix: true, maxmin: false, content: url});
		});

});

$('#parent_name').autocomplete({
    source: function (request, response) {
        var result = [];
        var limit = 10;
        var term = request.term.toLowerCase();
        $.each(_opts.menus, function () {
            var menu = this;
            if (term == '' || menu.name.toLowerCase().indexOf(term) >= 0 ||
                (menu.parent_name && menu.parent_name.toLowerCase().indexOf(term) >= 0) ||
                (menu.route && menu.route.toLowerCase().indexOf(term) >= 0)) {
                result.push(menu);
                limit--;
                if (limit <= 0) {
                    return false;
                }
            }
        });
        response(result);
    },
    focus: function (event, ui) {
        $('#parent_name').val(ui.item.name);
        return false;
    },
    select: function (event, ui) {
        $('#parent_name').val(ui.item.name);
        $('#parent_id').val(ui.item.id);
        return false;
    },
    search: function () {
        $('#parent_id').val('');
    }
}).autocomplete("instance")._renderItem = function (ul, item) {
    if(item.parent_name == null || item.route == null){
        return $("
").append('
'+item.name+'
').appendTo(ul);
    }
    return $("
").append('
'+item.name+'

'+item.parent_name + ' | ' + item.route+'
').appendTo(ul);
};

$('#route').autocomplete({
    source: _opts.routes,
});


text:
const fs = require('fs');

const TRAVEL_CODE = 'G0';
const MOVE_CODE = 'G1';

module.exports = class Gcode {
  constructor({laserOnCode, laserOffCode, laserPrecision, laserSpeed, travelSpeed, xOffset, yOffset, zOffset}) {
    this.code = [];
    this.laserOnCode = laserOnCode;
    this.laserOffCode = laserOffCode;
    this.laserPrecision = laserPrecision;
    this.laserSpeed = laserSpeed * 60;
    this.travelSpeed = travelSpeed * 60;
    this.xOffset = xOffset;
    this.yOffset = yOffset;
    this.zOffset = zOffset;
    this.currentXPosition = 0;
    this.laserStatus = undefined;
  }

  async initialise() {
    this.turnLaserOff();
    this.autoHome();
    this.setUnitMM();
    this.relativePositioning();
    this.initialPosition();
    return Promise.resolve();
  }

  autoHome() {
    this.append('G28');
  }

  relativePositioning() {
    this.append('G91');
  }

  initialPosition() {
    this.move(TRAVEL_CODE, { x: this.xOffset, y: this.yOffset, z: this.zOffset });
  }

  move(code, {x, y, z, fr}) {
    let params = '';

    if (x !== undefined) {
      this.currentXPosition = this.currentXPosition + x;
      params = params + ` X${x}`;
    }

    if (y) { params = params + ` Y${y}`; }
    if (z) { params = params + ` Z${z}`; }

    if (!fr) {
      if (code === TRAVEL_CODE) {
        fr = this.travelSpeed;
      } else if (code === MOVE_CODE) {
        fr = this.laserSpeed;
      }
    }

    params = params + ` F${fr}`;

    this.append(`${code}${params}`);
  }

  setUnitMM() {
    this.append(`G21`);
  }

  movePixels(n) {
    if (!this.laserStatus) {
      this.move(TRAVEL_CODE,  { x: this.laserPrecision * n } );
    } else {
      this.move(MOVE_CODE,  { x: this.laserPrecision * n } )
    }
  }

  moveLine(n, reset) {
    const params = { y: this.laserPrecision * n }
    if (reset) {
      params.x = (-1 * this.currentXPosition) + this.xOffset;
    }
    this.move(TRAVEL_CODE, params);
  }

  append(line) {
    this.code.push(line);
  }

  getLaserStatus() {
    return this.laserStatus;
  }

  turnLaser(status) {
    if (status) {
      this.turnLaserOn();
    } else {
      this.turnLaserOff();
    }
  }

  turnLaserOn() {
    if (!this.laserStatus || this.laserStatus === undefined) {
      this.laserStatus = true;
      this.code.push(`${this.laserOnCode} S255`);
    }
  }

  turnLaserOff() {
    if (this.laserStatus || this.laserStatus === undefined) {
      this.laserStatus = false;
      this.code.push(`${this.laserOffCode} S0`);
    }
  }

  async build({outputFilename, filename}) {
    const file = outputFilename ? outputFilename : `./${filename}.gcode`;
    fs.writeFileSync(file, this.code.join("\n"));
    return Promise.resolve();
  }
};


text:
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));

var _jsxRuntime = require("react/jsx-runtime");

var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
  d: "M1.94 11.79c-.6.57-.94 1.35-.94 2.18V20c0 1.66 1.34 3 3 3h13.68c.65 0 1.25-.47 1.32-1.12.08-.75-.51-1.38-1.24-1.38H12.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5h7.18c.65 0 1.25-.47 1.32-1.12.08-.75-.51-1.38-1.24-1.38H12.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5h8.18c.65 0 1.25-.47 1.32-1.12.08-.75-.51-1.38-1.24-1.38H12.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5h6.18c.65 0 1.25-.47 1.32-1.12.08-.75-.51-1.38-1.24-1.38h-9.9l1.49-2.61c.09-.16.14-.33.14-.53 0-.26-.09-.5-.26-.7l-.42-.45c-.38-.39-1.01-.41-1.41-.03l-6.46 6.11zm15.05-3.72c0 .52-.42.93-.93.93-.52 0-.93-.42-.93-.93.03-.67-.22-1.33-.71-1.86l-.07-.06c-.9-.89-1.38-2.03-1.34-3.22-.01-.51.41-.93.92-.93s.93.42.93.93c-.03.67.22 1.33.71 1.86l.07.07c.91.88 1.39 2.02 1.35 3.21zm4.01 0c0 .51-.42.93-.94.93s-.93-.42-.93-.93c.03-.67-.22-1.33-.71-1.86l-.07-.06c-.9-.89-1.38-2.03-1.34-3.22 0-.51.42-.93.93-.93s.93.42.93.93c-.03.67.22 1.33.71 1.86l.07.07c.9.88 1.38 2.02 1.35 3.21z"
}), 'DryRounded');

exports.default = _default;