<commit_before>'use strict';

module.exports = {

    /**
     * Locations of JavaScript source files. This array is used in
     * conjunction with linting and jscs tasks (keeping things DRY).
     * Paths should be relative to the top-level gulpfile.
     *
     * @type {Array}
     */
    scriptSourcePaths: ['./js/src/**/*.js'],

    /**
     * Settings for sourcemaps across JS and CSS bundles.
     *
     * @type {Object}
     */
    sourcemapOptions: {

        /**
         * Sourcemaps are built externally but there is two choices.
         * Source files can be embedded inside the map itself, or,
         * the source files can be referenced by the map and loaded
         * whenever you try to click line numbers in your dev tools.
         *
         * If your source files are not being served via a web server
         * then stick to using `External_EmbeddedFiles`.
         *
         * Potential Values:
         * 'External_EmbeddedFiles'
         * 'External_ReferencedFiles'
         *
         * @type {String}
         */
        type: 'External_EmbeddedFiles',

        /**
         * Sets the root path of where source files are hosted. This
         * path is relative to the source map. If you have sources in
         * different subpaths, an absolute path (from the domain root)
         * pointing to the source file root is recommended.
         *
         * NOTE: Only needs to be set for 'External_ReferencedFiles'.
         *
         * @type {String}
         */
        sourceRoot: '/'

    },

    /**
     * Where built output (CSS, JS, HTML, fonts, images) should be
     * stored on the filesystem. Can either be an absolute path or
     * relative path to the location of the gulpfile.
     *
     * @type {String}
     */
    destPath: './dist/',

    /**
     * Configuration settings for any task which needs them.
     * Keys should match the task name for consistency.
     *
     * @type {Object}
     */
    taskConfiguration: {
        build: {
            sourcePaths: ['./fonts/**/!(dir.txt)']
        },
        html: {
            sourcePaths: ['./html/**/*.html']
        },
        images: {
            sourcePaths: ['./img/**/!(dir.txt)'],
            imageminOptions: {
                svgoPlugins: [
                    { removeViewBox: false },
                    { removeUselessStrokeAndFill: false },
                    { convertPathData: { straightCurves: false } },
                    { cleanupIDs: false }
                ]
            }
        },
        server: {
            webserverSettings: {
                port: 4321,
                https: false,
                open: true
            }
        },
        styles: {
            /**
             * A folder path that is prefixed with the global `destPath` to give a
             * standard destination for CSS bundles. This can be overridden per
             * bundle if for example some bundles need to go somewhere else.
             *
             * @type {String}
             */
            genericOutputFolder: './css/',

            /**
             * A manifest of CSS bundles needing to be created and output
             *
             * Bundle Object Keys:
             * `sourceFilePath` - The path to the SCSS entry file (relative to `gulpfile.js`).
             * `outputFileName` - The extensionless name of the output file.
             * `outputFolder` (Optional) - Overrides `genericOutputFolder`. Is relative to `gulpfile.js`.
             *
             * Example Bundles:
             * { sourceFilePath: './css/src/homepage.scss', outputFileName: 'homepage' },
             * { sourceFilePath: './css/src/about.scss', outputFileName: 'main', outputFolder: './modules/about-page/css/' }
             *
             * @type {Array}
             */
            bundles: [
            ],

            /**
             * Settings to be passed through to `gulp-sass` and `node-sass`.
             * NOTE: `compact` used instead of `compressed` to due sourcemap bug.
             *
             * @type {Object}
             */
            sassSettings: {
                outputStyle: 'compact'
            },

            /**
             * Settings to be passed through to `gulp-autoprefixer`.
             *
             * @type {Object}
             */
            autoPrefixSettings: {
                browsers: ['last 2 versions', 'iOS >= 7.1', 'Android >= 4'],
                cascade: false
            }
        },
        scripts: {
            /**
             * A folder path that is prefixed with the global `destPath` to give a
             * standard destination for JS bundles.
             *
             * @type {String}
             */
            genericOutputFolder: './js/',

            /**
             * Settings for webpacks uglify plugin.
             *
             * @type {Object}
             */
            uglifySettings: {
                compress: {
                    drop_console: false,
                    drop_debugger: false,
                    warnings: false
                }
            },

            /**
             * Base settings for webpack.
             *
             * NOTE: For a full list of options, please visit:
             * https://webpack.github.io/docs/configuration.html
             *
             * @type {Object}
             */
            webpackSettings: {
                watch: false,
                entry: {
                },
                output: {
                },
                module: {
                    loaders: [
                        { test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: 'babel?presets[]=es2015' }
                    ]
                },
                plugins: [
                ]
            }
        },
        test: {
            configPath: __dirname + '/../karma.conf.js'
        },
        watch: {
            sourcePaths: {
                html: ['./html/**/*.html'],
                styles: ['./css/libs/**/*.scss', './css/src/**/*.scss'],
                scripts: ['./js/libs/**/*.js', './js/src/**/*.js']
            }
        }
    }

};
<commit_msg>Adding default property for bundle names.<commit_after>'use strict';

module.exports = {

    /**
     * Locations of JavaScript source files. This array is used in
     * conjunction with linting and jscs tasks (keeping things DRY).
     * Paths should be relative to the top-level gulpfile.
     *
     * @type {Array}
     */
    scriptSourcePaths: ['./js/src/**/*.js'],

    /**
     * Settings for sourcemaps across JS and CSS bundles.
     *
     * @type {Object}
     */
    sourcemapOptions: {

        /**
         * Sourcemaps are built externally but there is two choices.
         * Source files can be embedded inside the map itself, or,
         * the source files can be referenced by the map and loaded
         * whenever you try to click line numbers in your dev tools.
         *
         * If your source files are not being served via a web server
         * then stick to using `External_EmbeddedFiles`.
         *
         * Potential Values:
         * 'External_EmbeddedFiles'
         * 'External_ReferencedFiles'
         *
         * @type {String}
         */
        type: 'External_EmbeddedFiles',

        /**
         * Sets the root path of where source files are hosted. This
         * path is relative to the source map. If you have sources in
         * different subpaths, an absolute path (from the domain root)
         * pointing to the source file root is recommended.
         *
         * NOTE: Only needs to be set for 'External_ReferencedFiles'.
         *
         * @type {String}
         */
        sourceRoot: '/'

    },

    /**
     * Where built output (CSS, JS, HTML, fonts, images) should be
     * stored on the filesystem. Can either be an absolute path or
     * relative path to the location of the gulpfile.
     *
     * @type {String}
     */
    destPath: './dist/',

    /**
     * Configuration settings for any task which needs them.
     * Keys should match the task name for consistency.
     *
     * @type {Object}
     */
    taskConfiguration: {
        build: {
            sourcePaths: ['./fonts/**/!(dir.txt)']
        },
        html: {
            sourcePaths: ['./html/**/*.html']
        },
        images: {
            sourcePaths: ['./img/**/!(dir.txt)'],
            imageminOptions: {
                svgoPlugins: [
                    { removeViewBox: false },
                    { removeUselessStrokeAndFill: false },
                    { convertPathData: { straightCurves: false } },
                    { cleanupIDs: false }
                ]
            }
        },
        server: {
            webserverSettings: {
                port: 4321,
                https: false,
                open: true
            }
        },
        styles: {
            /**
             * A folder path that is prefixed with the global `destPath` to give a
             * standard destination for CSS bundles. This can be overridden per
             * bundle if for example some bundles need to go somewhere else.
             *
             * @type {String}
             */
            genericOutputFolder: './css/',

            /**
             * A manifest of CSS bundles needing to be created and output
             *
             * Bundle Object Keys:
             * `sourceFilePath` - The path to the SCSS entry file (relative to `gulpfile.js`).
             * `outputFileName` - The extensionless name of the output file.
             * `outputFolder` (Optional) - Overrides `genericOutputFolder`. Is relative to `gulpfile.js`.
             *
             * Example Bundles:
             * { sourceFilePath: './css/src/homepage.scss', outputFileName: 'homepage' },
             * { sourceFilePath: './css/src/about.scss', outputFileName: 'main', outputFolder: './modules/about-page/css/' }
             *
             * @type {Array}
             */
            bundles: [
            ],

            /**
             * Settings to be passed through to `gulp-sass` and `node-sass`.
             * NOTE: `compact` used instead of `compressed` to due sourcemap bug.
             *
             * @type {Object}
             */
            sassSettings: {
                outputStyle: 'compact'
            },

            /**
             * Settings to be passed through to `gulp-autoprefixer`.
             *
             * @type {Object}
             */
            autoPrefixSettings: {
                browsers: ['last 2 versions', 'iOS >= 7.1', 'Android >= 4'],
                cascade: false
            }
        },
        scripts: {
            /**
             * A folder path that is prefixed with the global `destPath` to give a
             * standard destination for JS bundles.
             *
             * @type {String}
             */
            genericOutputFolder: './js/',

            /**
             * Settings for webpacks uglify plugin.
             *
             * @type {Object}
             */
            uglifySettings: {
                compress: {
                    drop_console: false,
                    drop_debugger: false,
                    warnings: false
                }
            },

            /**
             * Base settings for webpack.
             *
             * NOTE: For a full list of options, please visit:
             * https://webpack.github.io/docs/configuration.html
             *
             * @type {Object}
             */
            webpackSettings: {
                watch: false,
                entry: {
                },
                output: {
                    filename: '[name].js'
                },
                module: {
                    loaders: [
                        { test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: 'babel?presets[]=es2015' }
                    ]
                },
                plugins: [
                ]
            }
        },
        test: {
            configPath: __dirname + '/../karma.conf.js'
        },
        watch: {
            sourcePaths: {
                html: ['./html/**/*.html'],
                styles: ['./css/libs/**/*.scss', './css/src/**/*.scss'],
                scripts: ['./js/libs/**/*.js', './js/src/**/*.js']
            }
        }
    }

};
<|endoftext|>


<commit_before>Modules.VERSION = '1.0.0';

this.api = {
	onDOMContentLoaded: function(e) {
		// this is the content document of the loaded page.
		var doc = e.originalTarget;
		if(doc instanceof content.HTMLDocument) {
			// is this an inner frame?
			// Find the root document:
			while(doc.defaultView.frameElement) {
				doc = doc.defaultView.frameElement.ownerDocument;
			}

			if(doc == document) {
				this.checkPage();
			}
		}
	},

	checkPage: function() {
		if(document.documentURI.startsWith(addonUris.development)) {
			var unwrap = XPCNativeWrapper.unwrap(content);
			if(unwrap.enable) {
				unwrap.enable(objPathString);
			}
		}
	}
};

Modules.LOADMODULE = function() {
	DOMContentLoaded.add(api);

	api.checkPage();
};

Modules.UNLOADMODULE = function() {
	DOMContentLoaded.remove(api);
};
<commit_msg>update backbone<commit_after>Modules.VERSION = '1.0.1';

this.api = {
	onDOMContentLoaded: function(e) {
		// this is the content document of the loaded page.
		var doc = e.originalTarget;
		if(doc instanceof content.HTMLDocument) {
			// is this an inner frame?
			// Find the root document:
			while(doc.defaultView.frameElement) {
				doc = doc.defaultView.frameElement.ownerDocument;
			}

			if(doc == document) {
				this.checkPage();
			}
		}
	},

	checkPage: function() {
		if(document.readyState != 'complete') {
			var waiting = () => {
				content.removeEventListener('load', waiting);
				this.checkPage();
			};
			content.addEventListener('load', waiting);
			return;
		}

		if(document.documentURI.startsWith(addonUris.development)) {
			var unwrap = XPCNativeWrapper.unwrap(content);
			if(unwrap.enable) {
				unwrap.enable(objPathString);
			}
		}
	}
};

Modules.LOADMODULE = function() {
	DOMContentLoaded.add(api);

	api.checkPage();
};

Modules.UNLOADMODULE = function() {
	DOMContentLoaded.remove(api);
};
<|endoftext|>


<commit_before>(function (global) {
  'use strict'

  // Constructor
  function MenuButton (button) {
    // Save a reference to the element
    this.button = button

    // Add (initial) button semantics
    this.button.setAttribute('aria-haspopup', true)
    this.button.setAttribute('aria-expanded', false)

    // Get the menu
    this.menuId = this.button.getAttribute('data-inclusive-menu-opens')
    this.menu = document.getElementById(this.menuId)

    // If the menu doesn't exist
    // exit with an error referencing the missing
    // menu's id
    if (!this.menu) {
      throw new Error('#' + this.menuId + ' menu missing')
    }

    // Add menu semantics
    this.menu.setAttribute('role', 'menu')

    // Hide menu initially
    this.menu.hidden = true

    // Get the menu items
    this.menuItems = this.menu.querySelectorAll('button')

    if (this.menuItems.length === 0) {
      throw new Error('The #' + this.menuId + ' menu has no menu items')
    }

    this.firstItem = this.menuItems[0]
    this.lastItem = this.menuItems[this.menuItems.length - 1]

    var focusNext = function (currentItem, startItem) {
      // Determine which item is the startItem (first or last)
      var goingDown = startItem === this.firstItem

      // helper function for getting next legitimate element
      function move (elem) {
        return (goingDown ? elem.nextElementSibling : elem.previousElementSibling) || startItem
      }

      // make first move
      var nextItem = move(currentItem)

      // if the menuitem is disabled move on
      while (nextItem.disabled) {
        nextItem = move(nextItem)
      }

      // focus the first one that's not disabled
      nextItem.focus()
    }.bind(this)

    Array.prototype.forEach.call(this.menuItems, function (menuItem) {
      // Add menu item semantics
      menuItem.setAttribute('role', 'menuitem')

      // Prevent tab focus on menu items
      menuItem.setAttribute('tabindex', '-1')

      // Handle key presses for menuItem
      menuItem.addEventListener('keydown', function (e) {
        // Go to next/previous item if it exists
        // or loop around

        if (e.keyCode === 40) {
          e.preventDefault()
          focusNext(menuItem, this.firstItem)
        }

        if (e.keyCode === 38) {
          e.preventDefault()
          focusNext(menuItem, this.lastItem)
        }

        // Close on escape or tab
        if (e.keyCode === 27 || e.keyCode === 9) {
          this.toggle()
        }

        // If escape, refocus menu button
        if (e.keyCode === 27) {
          e.preventDefault()
          this.button.focus()
        }
      }.bind(this))

      menuItem.addEventListener('click', function (e) {
        // pass menu item node to select method
        this.select(menuItem)

        // close menu and focus menu button
        this.close()
        this.button.focus()
      }.bind(this))
    }.bind(this))

    // Handle button click
    this.button.addEventListener('click', function () {
      this.toggle()
    }.bind(this))

    // Also toggle on down arrow
    this.button.addEventListener('keydown', function (e) {
      if (e.keyCode === 40) {
        if (this.menu.hidden) {
          this.open()
        } else {
          this.menu.querySelector(':not([disabled])').focus()
        }
      }

      // close menu on up arrow
      if (e.keyCode === 38) {
        this.close()
      }
    }.bind(this))

    // initiate listeners object for public events
    this._listeners = {}
  }

  // Open method
  MenuButton.prototype.open = function () {
    this.button.setAttribute('aria-expanded', true)
    this.menu.hidden = false
    this.menu.querySelector(':not([disabled])').focus()

    // fire open event
    this._fire('open')

    return this
  }

  // Close method
  MenuButton.prototype.close = function () {
    this.button.setAttribute('aria-expanded', false)
    this.menu.hidden = true

    // fire open event
    this._fire('close')

    return this
  }

  // Toggle method
  MenuButton.prototype.toggle = function () {
    var expanded = this.button.getAttribute('aria-expanded') === 'true'
    return expanded ? this.close() : this.open()
  }

  MenuButton.prototype.select = function (choice) {
    // fire open event
    this._fire('choose', choice)

    return this
  }

  MenuButton.prototype._fire = function (type, data) {
    var listeners = this._listeners[type] || []

    listeners.forEach(function (listener) {
      listener(data)
    })
  }

  MenuButton.prototype.on = function (type, handler) {
    if (typeof this._listeners[type] === 'undefined') {
      this._listeners[type] = []
    }

    this._listeners[type].push(handler)

    return this
  }

  // Export MenuButton
  if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
    module.exports = MenuButton
  } else if (typeof define === 'function' && define.amd) {
    define('MenuButton', [], function () {
      return MenuButton
    })
  } else if (typeof global === 'object') {
    // attach to window
    global.MenuButton = MenuButton
  }
}(this))
<commit_msg>Prevented standard from choking on global `define`<commit_after>/* global define */

(function (global) {
  'use strict'

  // Constructor
  function MenuButton (button) {
    // Save a reference to the element
    this.button = button

    // Add (initial) button semantics
    this.button.setAttribute('aria-haspopup', true)
    this.button.setAttribute('aria-expanded', false)

    // Get the menu
    this.menuId = this.button.getAttribute('data-inclusive-menu-opens')
    this.menu = document.getElementById(this.menuId)

    // If the menu doesn't exist
    // exit with an error referencing the missing
    // menu's id
    if (!this.menu) {
      throw new Error('#' + this.menuId + ' menu missing')
    }

    // Add menu semantics
    this.menu.setAttribute('role', 'menu')

    // Hide menu initially
    this.menu.hidden = true

    // Get the menu items
    this.menuItems = this.menu.querySelectorAll('button')

    if (this.menuItems.length === 0) {
      throw new Error('The #' + this.menuId + ' menu has no menu items')
    }

    this.firstItem = this.menuItems[0]
    this.lastItem = this.menuItems[this.menuItems.length - 1]

    var focusNext = function (currentItem, startItem) {
      // Determine which item is the startItem (first or last)
      var goingDown = startItem === this.firstItem

      // helper function for getting next legitimate element
      function move (elem) {
        return (goingDown ? elem.nextElementSibling : elem.previousElementSibling) || startItem
      }

      // make first move
      var nextItem = move(currentItem)

      // if the menuitem is disabled move on
      while (nextItem.disabled) {
        nextItem = move(nextItem)
      }

      // focus the first one that's not disabled
      nextItem.focus()
    }.bind(this)

    Array.prototype.forEach.call(this.menuItems, function (menuItem) {
      // Add menu item semantics
      menuItem.setAttribute('role', 'menuitem')

      // Prevent tab focus on menu items
      menuItem.setAttribute('tabindex', '-1')

      // Handle key presses for menuItem
      menuItem.addEventListener('keydown', function (e) {
        // Go to next/previous item if it exists
        // or loop around

        if (e.keyCode === 40) {
          e.preventDefault()
          focusNext(menuItem, this.firstItem)
        }

        if (e.keyCode === 38) {
          e.preventDefault()
          focusNext(menuItem, this.lastItem)
        }

        // Close on escape or tab
        if (e.keyCode === 27 || e.keyCode === 9) {
          this.toggle()
        }

        // If escape, refocus menu button
        if (e.keyCode === 27) {
          e.preventDefault()
          this.button.focus()
        }
      }.bind(this))

      menuItem.addEventListener('click', function (e) {
        // pass menu item node to select method
        this.select(menuItem)

        // close menu and focus menu button
        this.close()
        this.button.focus()
      }.bind(this))
    }.bind(this))

    // Handle button click
    this.button.addEventListener('click', function () {
      this.toggle()
    }.bind(this))

    // Also toggle on down arrow
    this.button.addEventListener('keydown', function (e) {
      if (e.keyCode === 40) {
        if (this.menu.hidden) {
          this.open()
        } else {
          this.menu.querySelector(':not([disabled])').focus()
        }
      }

      // close menu on up arrow
      if (e.keyCode === 38) {
        this.close()
      }
    }.bind(this))

    // initiate listeners object for public events
    this._listeners = {}
  }

  // Open method
  MenuButton.prototype.open = function () {
    this.button.setAttribute('aria-expanded', true)
    this.menu.hidden = false
    this.menu.querySelector(':not([disabled])').focus()

    // fire open event
    this._fire('open')

    return this
  }

  // Close method
  MenuButton.prototype.close = function () {
    this.button.setAttribute('aria-expanded', false)
    this.menu.hidden = true

    // fire open event
    this._fire('close')

    return this
  }

  // Toggle method
  MenuButton.prototype.toggle = function () {
    var expanded = this.button.getAttribute('aria-expanded') === 'true'
    return expanded ? this.close() : this.open()
  }

  MenuButton.prototype.select = function (choice) {
    // fire open event
    this._fire('choose', choice)

    return this
  }

  MenuButton.prototype._fire = function (type, data) {
    var listeners = this._listeners[type] || []

    listeners.forEach(function (listener) {
      listener(data)
    })
  }

  MenuButton.prototype.on = function (type, handler) {
    if (typeof this._listeners[type] === 'undefined') {
      this._listeners[type] = []
    }

    this._listeners[type].push(handler)

    return this
  }

  // Export MenuButton
  if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
    module.exports = MenuButton
  } else if (typeof define === 'function' && define.amd) {
    define('MenuButton', [], function () {
      return MenuButton
    })
  } else if (typeof global === 'object') {
    // attach to window
    global.MenuButton = MenuButton
  }
}(this))
<|endoftext|>


<commit_before>'use strict';

var fs = require('fs');
var path = require('path');
var _ = require('lodash');
var glob = require('glob');

// parses imports from sass
function parseImports(content) {
  var re = /\@import (["'])(.+?)\1;/g, match = {}, results = [];
  // strip comments
  content = new String(content).replace(/\/\*.+?\*\/|\/\/.*(?=[\n\r])/g, '');
  // extract imports
  while (match = re.exec(content)) {
    results.push(match[2]);
  }

  return results;
}

// resolve a sass module to a path
function resolveSassPath(sassPath, loadPaths) {
  // trim any file extensions
  sassPath = sassPath.replace(/\.\w+$/, '');
  // check all load paths
  for(var p in loadPaths) {
    var scssPath = path.normalize(loadPaths[p] + "/" + sassPath + ".scss");
    if (fs.existsSync(scssPath)) {
      return scssPath;
    }
    // special case for _partials
    var partialPath = scssPath.replace(/\/([^\/]*)$/, '/_$1');
    if (fs.existsSync(partialPath)) {
      return partialPath
    }
  }

  throw "Failed to resolve " + path + " in [" + loadPaths + "]";
}

function Graph(loadPaths, dir) {
  this.dir = dir;
  this.loadPaths = loadPaths;
  this.index = {};

  if(dir) {
    var graph = this;
    _(glob.sync(dir+"/**/*.scss", {})).forEach(function(file) {
      graph.addFile(file);
    });
  }
}

// add a sass file to the graph
Graph.prototype.addFile = function(filepath, parent) {
  var entry = this.index[filepath] = this.index[filepath] || {
    imports: [],
    importedBy: [],
    modified: fs.statSync(filepath).mtime
  };

  var imports = parseImports(fs.readFileSync(filepath, 'utf-8'));
  var cwd = path.dirname(filepath)

  for (var i in imports) {
    var resolved = resolveSassPath(imports[i], this.loadPaths.concat([this.dir, cwd]));
    if (!resolved) return false;

    // recurse into dependencies if not already enumerated
    if(!_.contains(entry.imports, resolved)) {
      entry.imports.push(resolved);
      this.addFile(resolved, filepath);
    }
  }

  // add link back to parent
  if(parent != null) {
    entry.importedBy.push(parent);
  }
};

// visits all files that are ancestors of the provided file
Graph.prototype.visitAncestors = function(filepath, callback) {
  this.visit(filepath, callback, function(node) {
    return node.importedBy;
  });
};

// visits all files that are descendents of the provided file
Graph.prototype.visitDescendents = function(filepath, callback) {
  this.visit(filepath, callback, function(node) {
    return node.imports;
  });
};

// a generic visitor that uses an edgeCallback to find the edges to traverse for a node
Graph.prototype.visit = function(filepath, callback, edgeCallback, visited) {
  var visited = visited || [];
  if(!this.index.hasOwnProperty(filepath)) {
    throw "Graph doesn't contain "+filepath;
  }
  var edges = edgeCallback(this.index[filepath]);
  for(var i in edges) {
    if(!_.contains(visited, edges[i])) {
      visited.push(edges[i]);
      callback(edges[i], this.index[edges[i]]);
      this.visit(edges[i], callback, edgeCallback, visited);
    }
  }
};

function processOptions(options) {
  options = options || {};
  if(!options.hasOwnProperty('loadPaths')) options['loadPaths'] = [];
  return options;
}

module.exports.parseFile = function(filepath, options) {
  var filepath = path.resolve(filepath);
  var options = processOptions(options);
  var graph = new Graph(options.loadPaths);
  graph.addFile(filepath);
  return graph;
};

module.exports.parseDir = function(dirpath, options) {
  var dirpath = path.resolve(dirpath);
  var options = processOptions(options);
  var graph = new Graph(options.loadPaths, dirpath);
  return graph;
};
<commit_msg>Fix for mixins failing to load in Windows<commit_after>'use strict';

var fs = require('fs');
var path = require('path');
var _ = require('lodash');
var glob = require('glob');

// parses imports from sass
function parseImports(content) {
  var re = /\@import (["'])(.+?)\1;/g, match = {}, results = [];
  // strip comments
  content = new String(content).replace(/\/\*.+?\*\/|\/\/.*(?=[\n\r])/g, '');
  // extract imports
  while (match = re.exec(content)) {
    results.push(match[2]);
  }

  return results;
}

// resolve a sass module to a path
function resolveSassPath(sassPath, loadPaths) {
  // trim any file extensions
  sassPath = sassPath.replace(/\.\w+$/, '');
  // check all load paths
  for(var p in loadPaths) {
    var scssPath = path.normalize(loadPaths[p] + "/" + sassPath + ".scss");
    if (fs.existsSync(scssPath)) {
      return scssPath;
    }
    // special case for _partials
    var partialPath = path.join(path.dirname(scssPath), "_" + path.basename(scssPath));
    if (fs.existsSync(partialPath)) {
      return partialPath
    }
  }

  throw "Failed to resolve " + path + " in [" + loadPaths + "]";
}

function Graph(loadPaths, dir) {
  this.dir = dir;
  this.loadPaths = loadPaths;
  this.index = {};

  if(dir) {
    var graph = this;
    _(glob.sync(dir+"/**/*.scss", {})).forEach(function(file) {
      graph.addFile(file);
    });
  }
}

// add a sass file to the graph
Graph.prototype.addFile = function(filepath, parent) {
  var entry = this.index[filepath] = this.index[filepath] || {
    imports: [],
    importedBy: [],
    modified: fs.statSync(filepath).mtime
  };

  var imports = parseImports(fs.readFileSync(filepath, 'utf-8'));
  var cwd = path.dirname(filepath)

  for (var i in imports) {
    var resolved = resolveSassPath(imports[i], this.loadPaths.concat([this.dir, cwd]));
    if (!resolved) return false;

    // recurse into dependencies if not already enumerated
    if(!_.contains(entry.imports, resolved)) {
      entry.imports.push(resolved);
      this.addFile(resolved, filepath);
    }
  }

  // add link back to parent
  if(parent != null) {
    entry.importedBy.push(parent);
  }
};

// visits all files that are ancestors of the provided file
Graph.prototype.visitAncestors = function(filepath, callback) {
  this.visit(filepath, callback, function(node) {
    return node.importedBy;
  });
};

// visits all files that are descendents of the provided file
Graph.prototype.visitDescendents = function(filepath, callback) {
  this.visit(filepath, callback, function(node) {
    return node.imports;
  });
};

// a generic visitor that uses an edgeCallback to find the edges to traverse for a node
Graph.prototype.visit = function(filepath, callback, edgeCallback, visited) {
  var visited = visited || [];
  if(!this.index.hasOwnProperty(filepath)) {
    throw "Graph doesn't contain "+filepath;
  }
  var edges = edgeCallback(this.index[filepath]);
  for(var i in edges) {
    if(!_.contains(visited, edges[i])) {
      visited.push(edges[i]);
      callback(edges[i], this.index[edges[i]]);
      this.visit(edges[i], callback, edgeCallback, visited);
    }
  }
};

function processOptions(options) {
  options = options || {};
  if(!options.hasOwnProperty('loadPaths')) options['loadPaths'] = [];
  return options;
}

module.exports.parseFile = function(filepath, options) {
  var filepath = path.resolve(filepath);
  var options = processOptions(options);
  var graph = new Graph(options.loadPaths);
  graph.addFile(filepath);
  return graph;
};

module.exports.parseDir = function(dirpath, options) {
  var dirpath = path.resolve(dirpath);
  var options = processOptions(options);
  var graph = new Graph(options.loadPaths, dirpath);
  return graph;
};
<|endoftext|>


<commit_before>nb.define('dialog', {
    events: {}
})
<commit_msg>удаление dialog из мастера<commit_after><|endoftext|>


<commit_before>
'use strict';

var SwaggerUtils = require('./SwaggerUtils'),
	Utils = require('./Utils'),
	extend = require('util')._extend;

/**
 *
 * @class SwaggerDefinition
 * @namespace SwaggerImport
 * @param {string} name
 * @param {object} definition
 * @param {object} options
 * @constructor
 *
 * Swagger importer
 */
function SwaggerDefinition(name, definition, options) {
	this.init(name, definition, options);
}

SwaggerDefinition.prototype = extend(SwaggerDefinition.prototype, Utils.prototype);
SwaggerDefinition.prototype = extend(SwaggerDefinition.prototype, SwaggerUtils.prototype);
SwaggerDefinition.prototype = extend(SwaggerDefinition.prototype, {

	constructor : SwaggerDefinition,

	/**
	 *
	 * @method init
	 * called by constructor
	 * @param {string} name
	 * @param {object} definition
	 * @param {object} options
	 * @returns void
	 * @public
	 */
	init: function (name, definition, options) {

		this._name = name;
		this._str = '';
		this._def = {};
		this._defOriginal = definition;
		this._options = options;

		if (typeof definition === 'object') {
			this._def = this._formatDefinition(definition);
			this._str = JSON.stringify(this._def);
		}
	},

	/**
	 * @method mapReferences
	 * @returns {void}
	 * @public
	 */
	mapReferences: function () {
		this._str = this._mapReference(this._str, 0);
		this._def = JSON.parse(this._str);
	},

	/**
	 *
	 * @method setSwaggerDefinitions
	 * @param {object} swaggerDefinitions
	 * @public
	 */
	setSwaggerDefinitions: function (swaggerDefinitions) {
		this._swaggerDefinitions = swaggerDefinitions;
	},

	/**
	 *
	 * @method get
	 * @returns {object} definition
	 */
	get: function () {
		return this._def;
	},

	/**
	 *
	 * @method getString
	 * @returns {string} definitionString
	 */
	getString: function () {
		return this._str;
	},

	/**
	 * @method _mapReference
	 * @param {string} str
	 * @param {number} deep
	 * @returns {string} definitionString
	 * @private
	 */
	_mapReference: function (str, deep) {

		var _this = this,
			strSpl = str.split('{"$ref":'),
			out,
			outStr = [],
			regStr = '(^"#/definitions/)([^"}]*)("})',
			reg = new RegExp(regStr);

		/**
		 * @function _getSchemaString
		 * @param {Array} result
		 * @param {string} originalStrPart
		 * @returns {string} schemaString
		 * @private
		 */
		function _getSchemaString (result, originalStrPart) {

			if (!(result instanceof Array) || result.length < 3) {
				return originalStrPart;
			}

			var swaggerDefinition = _this._getDefinition(result[2]),
				out = originalStrPart,
				replaceStr = result[1] + result[2] + result[3];

			if (!swaggerDefinition) {
				out = out.replace(replaceStr, '{"type":"object","properties":{}}');
			} else {
				out = out.replace(replaceStr, swaggerDefinition.getString());
			}

			return out;
		}

		/**
		 * @function _mapItem
		 * @param {string} part
		 * @param {number} index
		 * @private
		 */
		function _mapItem (part, index) {
			if (index !== 0) {
				outStr.push(_getSchemaString(reg.exec(part), part));
			} else {
				outStr.push(strSpl[0]);
			}
		}

		if (strSpl.length > 0) {
			strSpl.map(_mapItem);
		}

		out = outStr.join('');

		// performance issue
		if (out.search(/\$ref/g) >= 0 && deep <= this._options.maxRefDeep) {
			out = this._mapReference(out, (deep + 1));
		}

		return out;
	},

	/**
	 *
	 * @method _getDefinition
	 * @param {string} name
	 * @returns {SwaggerPathMethod|boolean}
	 * @private
	 */
	_getDefinition: function (name) {
		if (!this._swaggerDefinitions.hasOwnProperty(name)) {
			return false;
		}

		return this._swaggerDefinitions[name];
	},

	/**
	 *
	 * @method _formatDefinition
	 * @param {object} def
	 * @returns {*}
	 * @private
	 */
	_formatDefinition: function (def) {

		this.forIn(def, function (key, value) {
			if (value.type) {
				def[key] = value.type;
			}
		});

		return def;
	},

	/**
	 *
	 * @method write
	 * @returns {void}
	 * @public
	 */
	write: function () {
		var dir = this._options.dest + '/_DTO',
			file = dir + '/' + this._name + '.json';

		this.writeDir(dir);
		this.writeFile(file, JSON.stringify(this.restructureSchema(this._defOriginal), null, 2));
	}

});

module.exports = SwaggerDefinition;<commit_msg>[change] #1: update SwaggerDefinition class<commit_after>
'use strict';

var SwaggerUtils = require('./SwaggerUtils'),
	Utils = require('./Utils'),
	extend = require('util')._extend;

/**
 *
 * @class SwaggerDefinition
 * @namespace SwaggerImport
 * @param {string} name
 * @param {object} definition
 * @param {object} options
 * @constructor
 *
 * Swagger importer
 */
function SwaggerDefinition(name, definition, options) {
	this.init(name, definition, options);
}

SwaggerDefinition.prototype = extend(SwaggerDefinition.prototype, Utils.prototype);
SwaggerDefinition.prototype = extend(SwaggerDefinition.prototype, SwaggerUtils.prototype);
SwaggerDefinition.prototype = extend(SwaggerDefinition.prototype, {

	constructor : SwaggerDefinition,

	/**
	 *
	 * @method init
	 * called by constructor
	 * @param {string} name
	 * @param {object} definition
	 * @param {object} options
	 * @returns void
	 * @public
	 */
	init: function (name, definition, options) {

		this._name = name;
		this._str = '';
		this._def = {};
		this._options = options;

		if (typeof definition === 'object') {
			this._def = this.restructureSchema(definition);
			this._str = JSON.stringify(this._def);
		}
	},

	/**
	 * @method mapReferences
	 * @returns {void}
	 * @public
	 */
	mapReferences: function () {
		this._def = JSON.parse(this._str);
	},

	/**
	 *
	 * @method setSwaggerDefinitions
	 * @param {object} swaggerDefinitions
	 * @public
	 */
	setSwaggerDefinitions: function (swaggerDefinitions) {
		this._swaggerDefinitions = swaggerDefinitions;
	},

	/**
	 *
	 * @method get
	 * @returns {object} definition
	 */
	get: function () {
		return this._def;
	},

	/**
	 *
	 * @method getString
	 * @returns {string} definitionString
	 */
	getString: function () {
		return this._str;
	},

	/**
	 *
	 * @method _getDefinition
	 * @param {string} name
	 * @returns {SwaggerPathMethod|boolean}
	 * @private
	 */
	_getDefinition: function (name) {
		if (!this._swaggerDefinitions.hasOwnProperty(name)) {
			return false;
		}

		return this._swaggerDefinitions[name];
	},

	/**
	 *
	 * @method write
	 * @returns {void}
	 * @public
	 */
	write: function () {
		var dir = this._options.dest + '/_DTO',
			file = dir + '/' + this._name + '.json';

		this.writeDir(dir);
		this.writeFile(file, JSON.stringify(this._def, null, 2));
	}

});

module.exports = SwaggerDefinition;<|endoftext|>


<commit_before>/** Change dwell times */

import React, { Component, PropTypes } from 'react'
import uuid from 'uuid'

import SelectRouteAndPatterns from './select-route-and-patterns'
import SelectStops from './select-stops'

export default class AdjustDwellTime extends Component {
  static propTypes = {
    addControl: PropTypes.func,
    addLayer: PropTypes.func,
    data: PropTypes.object.isRequired,
    modification: PropTypes.object.isRequired,
    removeControl: PropTypes.func,
    removeLayer: PropTypes.func,
    replaceModification: PropTypes.func.isRequired,
    setMapState: PropTypes.func
  };

  constructor (props) {
    super(props)

    this.onNameChange = this.onNameChange.bind(this)
    this.onPatternSelectorChange = this.onPatternSelectorChange.bind(this)
    this.onStopSelectorChange = this.onStopSelectorChange.bind(this)
    this.setScale = this.setScale.bind(this)
    this.setSpeed = this.setSpeed.bind(this)
    this.setValue = this.setValue.bind(this)
  }

  onNameChange (e) {
    this.props.replaceModification(Object.assign({}, this.props.modification, { name: e.target.value }))
  }

  onPatternSelectorChange (value) {
    let { feed, routes, trips } = value
    let modification = Object.assign({}, this.props.modification, { feed, routes, trips, stops: null })
    this.props.replaceModification(modification)
  }

  onStopSelectorChange (stops) {
    this.props.replaceModification(Object.assign({}, this.props.modification, { stops }))
  }

  /** we are setting a scale for existing speeds, not an actual speed */
  setScale (e) {
    if (e.target.checked) this.props.replaceModification(Object.assign({}, this.props.modification, { scale: true }))
  }

  /** we are setting a brand-new speed, throwing out any existing variation in speed */
  setSpeed (e) {
    if (e.target.checked) this.props.replaceModification(Object.assign({}, this.props.modification, { scale: false }))
  }

  /** set the factor by which we are scaling, or the speed which we are replacing */
  setValue (e) {
    this.props.replaceModification(Object.assign({}, this.props.modification, { value: e.target.value }))
  }

  render () {
    return

      <input type='text' placeholder='name' value={this.props.modification.name} onChange={this.onNameChange} />

      <SelectRouteAndPatterns routes={this.props.modification.routes} feed={this.props.modification.feed} trips={this.props.modification.trips} onChange={this.onPatternSelectorChange}
        addLayer={this.props.addLayer} removeLayer={this.props.removeLayer} addControl={this.props.addControl} removeControl={this.props.removeControl} data={this.props.data} />

      {(() => {
        if (this.props.modification.routes != null) {
          return <SelectStops modification={this.props.modification} nullIsWildcard onChange={this.onStopSelectorChange} data={this.props.data} setMapState={this.props.setMapState} />
        } else return
      })()}

      <input type='radio' value='scale' checked={this.props.modification.scale} onChange={this.setScale} />Scale existing dwell times by
      <input type='radio' value='speed' checked={!this.props.modification.scale} onChange={this.setSpeed} />Set new dwell time to

      <input type='number' step='any' value={this.props.modification.value} onChange={this.setValue} />{this.props.modification.scale ? 'x' : 'seconds'}

  }
}

export function create () {
  return {
    id: uuid.v4(),
    type: 'adjust-dwell-time',
    feed: null,
    routes: null,
    trips: null,
    stops: null,
    value: 30,
    scale: false,
    name: '',
    expanded: true,
    showOnMap: true
  }
}
<commit_msg>Style adjust-dwell-time<commit_after>/** Change dwell times */

import React, { Component, PropTypes } from 'react'
import uuid from 'uuid'

import {Number as InputNumber, Text} from './components/input'
import SelectRouteAndPatterns from './select-route-and-patterns'
import SelectStops from './select-stops'

export default class AdjustDwellTime extends Component {
  static propTypes = {
    addControl: PropTypes.func,
    addLayer: PropTypes.func,
    data: PropTypes.object.isRequired,
    modification: PropTypes.object.isRequired,
    removeControl: PropTypes.func,
    removeLayer: PropTypes.func,
    replaceModification: PropTypes.func.isRequired,
    setMapState: PropTypes.func
  }

  onNameChange = (e) => {
    this.props.replaceModification(Object.assign({}, this.props.modification, { name: e.target.value }))
  }

  onPatternSelectorChange = (value) => {
    let { feed, routes, trips } = value
    let modification = Object.assign({}, this.props.modification, { feed, routes, trips, stops: null })
    this.props.replaceModification(modification)
  }

  onStopSelectorChange = (stops) => {
    this.props.replaceModification(Object.assign({}, this.props.modification, { stops }))
  }

  /** we are setting a scale for existing speeds, not an actual speed */
  setScale = (e) => {
    if (e.target.checked) this.props.replaceModification(Object.assign({}, this.props.modification, { scale: true }))
  }

  /** we are setting a brand-new speed, throwing out any existing variation in speed */
  setSpeed = (e) => {
    if (e.target.checked) this.props.replaceModification(Object.assign({}, this.props.modification, { scale: false }))
  }

  /** set the factor by which we are scaling, or the speed which we are replacing */
  setValue = (e) => {
    this.props.replaceModification(Object.assign({}, this.props.modification, { value: e.target.value }))
  }

  render () {
    const {modification} = this.props
    return (

        <Text
          name='Name'
          onChange={this.onNameChange}
          value={modification.name}
          />

        <SelectRouteAndPatterns
          addControl={this.props.addControl}
          addLayer={this.props.addLayer}
          data={this.props.data}
          feed={modification.feed}
          onChange={this.onPatternSelectorChange}
          removeControl={this.props.removeControl}
          removeLayer={this.props.removeLayer}
          routes={modification.routes}
          trips={modification.trips}
          />

        {this.renderSelectStops()}

          <input type='radio' value='scale' checked={this.props.modification.scale} onChange={this.setScale} />Scale existing dwell times by
          <input type='radio' value='speed' checked={!this.props.modification.scale} onChange={this.setSpeed} />Set new dwell time to

        <InputNumber
          onChange={this.setValue}
          value={modification.value}
          />

    )
  }

  renderSelectStops () {
    if (this.props.modification.routes != null) {
      return <SelectStops
        data={this.props.data}
        modification={this.props.modification}
        nullIsWildcard
        onChange={this.onStopSelectorChange}
        setMapState={this.props.setMapState}
        />
    }
  }
}

export function create () {
  return {
    id: uuid.v4(),
    type: 'adjust-dwell-time',
    feed: null,
    routes: null,
    trips: null,
    stops: null,
    value: 30,
    scale: false,
    name: '',
    expanded: true,
    showOnMap: true
  }
}
<|endoftext|>


<commit_before>// export public API
function oboe(firstArg) {

   if (firstArg.url) {

      // method signature is:
      //    .doMethod({url:u, body:b, complete:c, headers:{...}})

      return wire(
          (firstArg.method || 'GET'),
          firstArg.url,
          firstArg.body,
          firstArg.headers
      );
   } else {

      // parameters specified as arguments
      //
      //  if (mayHaveContext == true) method signature is:
      //     .doMethod( url, content )
      //
      //  else it is:
      //     .doMethod( url )
      //
      return wire(
          'GET',
          firstArg // url
      );
   }
}
<commit_msg>update comment to new version of api<commit_after>// export public API
function oboe(firstArg) {

   if (firstArg.url) {

      // method signature is:
      //    .oboe({method:m, url:u, body:b, complete:c, headers:{...}})

      return wire(
          (firstArg.method || 'GET'),
          firstArg.url,
          firstArg.body,
          firstArg.headers
      );
   } else {

      // parameters specified as arguments
      //
      //  if (mayHaveContext == true) method signature is:
      //     .doMethod( url, content )
      //
      //  else it is:
      //     .doMethod( url )
      //
      return wire(
          'GET',
          firstArg // url
      );
   }
}
<|endoftext|>


<commit_before>export const AllQuestions = [
  {
    question: "Relative minor of C",
    answer: ['a']
  },
  {
    question: "Relative minor of A",
    answer: ['f#', 'fs']
  },
  {
    question: "Relative minor of B",
    answer: ['gs', 'g#', 'A♭', 'af']
  },
  {
    question: "Relative minor of D",
    answer: ['b']
  },
  {
    question: "Relative minor of E",
    answer: ['c#', 'cs']
  },
  {
    question: "Relative minor of F",
    answer: ['d']
  },
  {
    question: "Relative minor of G",
    answer: ['e']
  },
  {
    question: "Relative minor of B♭",
    answer: ['g']
  },
  {
    question: "Relative minor of E♭",
    answer: ['c']
  },
  {
    question: "Relative minor of A♭",
    answer: ['f']
  },
  {
    question: "Relative minor of D♭",
    answer: ['bf', 'b♭']
  },
  {
    question: "Relative minor of F#",
    answer: ['e♭', 'ef', 'ds', 'd#']
  },
  // {

  //   question: "Relative major of C",
  //   answer: ['ef', 'e♭']
  // },
  // {

  //   question: "Relative major of G",
  //   answer: ['bf', 'b♭']
  // },
  // {

  //   question: "Relative major of F",
  //   answer: ['af', 'a♭']
  // },
  // {

  //   question: "Relative major of E",
  //   answer: ['g']
  // },
  // {

  //   question: "Relative major of A",
  //   answer: ['c']
  // },
  // {

  //   question: "Relative major of D",
  //   answer: ['f']
  // },
  // {

  //   question: "Relative major of F#",
  //   answer: ['a']
  // },
  // {

  //   question: "Relative major of B♭",
  //   answer: ['df', 'd♭']
  // },
  // {

  //   question: "Relative major of E♭/d#",
  //   answer: ['gf', 'g♭', 'fs', 'f#']
  // },
  // {

  //   question: "Relative major of g#",
  //   answer: ['b']
  // },
  // {

  //   question: "Relative major of c#",
  //   answer: ['e']
  // },
  // {

  //   question: "Relative major of B",
  //   answer: ['d']
  // }
  {
    question: "V of C",
    answer: ['g']
  },
  {
    question: "V of A",
    answer: ['e']
  },
  {
    question: "V of B",
    answer: ['fs', 'f#', 'gf', 'g♭']
  },
  {
    question: "V of D",
    answer: ['a']
  },
  {
    question: "V of E",
    answer: ['b']
  },
  {
    question: "V of F",
    answer: ['c']
  },
  {
    question: "V of G",
    answer: ['d']
  },
  {
    question: "V of B♭",
    answer: ['f']
  },
  {
    question: "V of E♭",
    answer: ['bf', 'b♭']
  },
  {
    question: "V of A♭",
    answer: ['ef', 'e♭']
  },
  {
    question: "V of D♭",
    answer: ['af', 'a♭']
  },
  {
    question: "V of F#",
    answer: ['cs', 'c#']
  },
  {
    question: "IV of C",
    answer: ['f']
  },
  {
    question: "IV of A",
    answer: ['d']
  },
  {
    question: "IV of B",
    answer: ['e']
  },
  {
    question: "IV of D",
    answer: ['g']
  },
  {
    question: "IV of E",
    answer: ['a']
  },
  {
    question: "IV of F",
    answer: ['b♭', 'bf']
  },
  {
    question: "IV of G",
    answer: ['c']
  },
  {
    question: "IV of B♭",
    answer: ['e♭', 'ef']
  },
  {
    question: "IV of E♭",
    answer: ['a♭', 'af']
  },
  {
    question: "IV of A♭",
    answer: ['d♭', 'df']
  },
  {
    question: "IV of D♭",
    answer: ['f#', 'fs', 'g♭', 'gf']
  },
  {
    question: "IV of F#",
    answer: ['b']
  }
];<commit_msg>more correcter<commit_after>export const AllQuestions = [
  {
    question: "Relative minor of C",
    answer: ['a']
  },
  {
    question: "Relative minor of A",
    answer: ['f#', 'fs']
  },
  {
    question: "Relative minor of B",
    answer: ['gs', 'g#', 'A♭', 'af']
  },
  {
    question: "Relative minor of D",
    answer: ['b']
  },
  {
    question: "Relative minor of E",
    answer: ['c#', 'cs']
  },
  {
    question: "Relative minor of F",
    answer: ['d']
  },
  {
    question: "Relative minor of G",
    answer: ['e']
  },
  {
    question: "Relative minor of B♭",
    answer: ['g']
  },
  {
    question: "Relative minor of E♭",
    answer: ['c']
  },
  {
    question: "Relative minor of A♭",
    answer: ['f']
  },
  {
    question: "Relative minor of D♭",
    answer: ['bf', 'b♭']
  },
  {
    question: "Relative minor of F#",
    answer: ['ds', 'd#']
  },
  // {

  //   question: "Relative major of C",
  //   answer: ['ef', 'e♭']
  // },
  // {

  //   question: "Relative major of G",
  //   answer: ['bf', 'b♭']
  // },
  // {

  //   question: "Relative major of F",
  //   answer: ['af', 'a♭']
  // },
  // {

  //   question: "Relative major of E",
  //   answer: ['g']
  // },
  // {

  //   question: "Relative major of A",
  //   answer: ['c']
  // },
  // {

  //   question: "Relative major of D",
  //   answer: ['f']
  // },
  // {

  //   question: "Relative major of F#",
  //   answer: ['a']
  // },
  // {

  //   question: "Relative major of B♭",
  //   answer: ['df', 'd♭']
  // },
  // {

  //   question: "Relative major of E♭/d#",
  //   answer: ['gf', 'g♭', 'fs', 'f#']
  // },
  // {

  //   question: "Relative major of g#",
  //   answer: ['b']
  // },
  // {

  //   question: "Relative major of c#",
  //   answer: ['e']
  // },
  // {

  //   question: "Relative major of B",
  //   answer: ['d']
  // }
  {
    question: "V of C",
    answer: ['g']
  },
  {
    question: "V of A",
    answer: ['e']
  },
  {
    question: "V of B",
    answer: ['fs', 'f#', 'gf', 'g♭']
  },
  {
    question: "V of D",
    answer: ['a']
  },
  {
    question: "V of E",
    answer: ['b']
  },
  {
    question: "V of F",
    answer: ['c']
  },
  {
    question: "V of G",
    answer: ['d']
  },
  {
    question: "V of B♭",
    answer: ['f']
  },
  {
    question: "V of E♭",
    answer: ['bf', 'b♭']
  },
  {
    question: "V of A♭",
    answer: ['ef', 'e♭']
  },
  {
    question: "V of D♭",
    answer: ['af', 'a♭']
  },
  {
    question: "V of F#",
    answer: ['cs', 'c#']
  },
  {
    question: "IV of C",
    answer: ['f']
  },
  {
    question: "IV of A",
    answer: ['d']
  },
  {
    question: "IV of B",
    answer: ['e']
  },
  {
    question: "IV of D",
    answer: ['g']
  },
  {
    question: "IV of E",
    answer: ['a']
  },
  {
    question: "IV of F",
    answer: ['b♭', 'bf']
  },
  {
    question: "IV of G",
    answer: ['c']
  },
  {
    question: "IV of B♭",
    answer: ['e♭', 'ef']
  },
  {
    question: "IV of E♭",
    answer: ['a♭', 'af']
  },
  {
    question: "IV of A♭",
    answer: ['d♭', 'df']
  },
  {
    question: "IV of D♭",
    answer: ['f#', 'fs', 'g♭', 'gf']
  },
  {
    question: "IV of F#",
    answer: ['b']
  }
];<|endoftext|>


<commit_before>// Much of this is adapted from https://github.com/arkenfox/user.js/blob/master/user.js

// Disable warning for about:config
user_pref("browser.aboutConfig.showWarning", false);

// Annoying when using both Default Release and Dev Edition or Nightly
user_pref("browser.shell.checkDefaultBrowser", false);

// Restore the previous session on startup
user_pref("browser.startup.page", 3);

// Don't open links from clipboard when using the middle mouse button
user_pref("middlemouse.contentLoadURL", false);

// Disable paste using middle mouse button
user_pref("middlemouse.paste", false);

// Enable middle mouse button scrolling
user_pref("general.autoScroll", true);

// Don't sort ctrl-tab by recently used
user_pref("browser.ctrlTab.recentlyUsedOrder", false);

// Enable the new tab page
user_pref("browser.newtabpage.enabled", true);
user_pref("browser.newtab.preload", true);

// Set new page preferences
user_pref("browser.newtabpage.activity-stream.feeds.telemetry", false);
user_pref("browser.newtabpage.activity-stream.telemetry", false);
user_pref("browser.newtabpage.activity-stream.feeds.snippets", false);
user_pref("browser.newtabpage.activity-stream.feeds.section.topstories", false);
user_pref("browser.newtabpage.activity-stream.section.highlights.includePocket", false);
user_pref("browser.newtabpage.activity-stream.feeds.discoverystreamfeed", false);
user_pref("browser.newtabpage.activity-stream.showSponsored", false);
user_pref("browser.newtabpage.activity-stream.showSponsoredTopSites", false);

// Remove default "top sites"
user_pref("browser.newtabpage.activity-stream.default.sites", "");

// Disable browser region updates
user_pref("browser.region.network.url", "");
user_pref("browser.region.update.enabled", false);

// Set my preferred languages
user_pref("intl.accept_languages", "en-US, en");

// Disable addon recommendations
user_pref("extensions.getAddons.showPane", false);
user_pref("extensions.htmlaboutaddons.recommendations.enabled", false);
user_pref("browser.discovery.enabled", false);

// Helps prevent spoofed domain names
user_pref("network.IDN_show_punycode", true);

// Disable location tracking
user_pref("permissions.default.geo", 2);
user_pref("geo.enabled", false);
user_pref("geo.wifi.url", "");
user_pref("browser.search.geoip.url", "");

// Disable battery api
user_pref("dom.battery.enabled", false);

// Disable pocket
user_pref("extensions.pocket.enabled", false);
user_pref("extensions.pocket.site", "");
user_pref("extensions.pocket.oAuthConsumerKey", "");
user_pref("extensions.pocket.api", "");

// Disable telemetry
user_pref("datareporting.policy.dataSubmissionEnabled", false);
user_pref("datareporting.healthreport.uploadEnabled", false);
user_pref("toolkit.telemetry.unified", false);
user_pref("toolkit.telemetry.enabled", false);
user_pref("toolkit.telemetry.server", "data:,");
user_pref("toolkit.telemetry.archive.enabled", false);
user_pref("toolkit.telemetry.newProfilePing.enabled", false);
user_pref("toolkit.telemetry.shutdownPingSender.enabled", false);
user_pref("toolkit.telemetry.updatePing.enabled", false);
user_pref("toolkit.telemetry.bhrPing.enabled", false);
user_pref("toolkit.telemetry.firstShutdownPing.enabled", false);
user_pref("toolkit.telemetry.coverage.opt-out", true);
user_pref("toolkit.coverage.opt-out", true);
user_pref("toolkit.coverage.endpoint.base", "");
user_pref("browser.ping-centre.telemetry", false);

// Disable studies
user_pref("app.shield.optoutstudies.enabled", false);
user_pref("app.normandy.enabled", false);
user_pref("app.normandy.api_url", "");

// Disable crash reports
user_pref("breakpad.reportURL", "");
user_pref("browser.tabs.crashReporting.sendReport", false);
user_pref("browser.crashReports.unsubmittedCheck.enabled", false);
user_pref("browser.crashReports.unsubmittedCheck.autoSubmit2", false);

// Disable safebrowsing for downloads
user_pref("browser.safebrowsing.downloads.remote.enabled", false);

// Disable prefetching
// user_pref("network.prefetch-next", false);
// user_pref("network.dns.disablePrefetch", true);
// Disable link-mouseover opening connection to linked server
user_pref("network.http.speculative-parallel-limit", 0);
// user_pref("browser.places.speculativeConnect.enabled", false);

// Route dns queries through the proxy if a proxy is being used
user_pref("network.proxy.socks_remote_dns", true);

// Disable gvfs/gio protocols
user_pref("network.gio.supported-protocols", "");

// Disable DNS-over-HTTPS
user_pref("network.trr.mode", 5);

// Disable uploading of screenshots
user_pref("extensions.screenshots.upload-disabled", true);

// Don't store credit/debit cards for autofill
user_pref("extensions.formautofill.creditCards.enabled", false);

// Disable location bar search suggestions
user_pref("browser.search.suggest.enabled", false);
user_pref("browser.urlbar.suggest.searches", false);
// Don't open connections preemptively
user_pref("browser.urlbar.speculativeConnect.enabled", false);
user_pref("browser.urlbar.dnsResolveSingleWordsAfterSearch", 0);

// Don't autofill on non-secure HTTP pages
user_pref("signon.autofillForms.http", false);
user_pref("security.insecure_field_warning.contextual.enabled", true);

// * 0 = don't allow sub-resources to open HTTP authentication credentials dialogs
// * 1 = don't allow cross-origin sub-resources to open HTTP authentication credentials dialogs
// * 2 = allow sub-resources to open HTTP authentication credentials dialogs (default)
user_pref("network.auth.subresource-http-auth-allow", 1);

// Don't report SSL errors
user_pref("security.ssl.errorReporting.automatic", false);
user_pref("security.ssl.errorReporting.enabled", false);
user_pref("security.ssl.errorReporting.url", "");

// Harden OCSP settings
user_pref("security.ssl.enable_ocsp_stapling", true);
user_pref("security.OCSP.enabled", 1);
user_pref("security.OCSP.require", true);

// Only support SSL/TLS connections with servers which implement RFC 5746
user_pref("security.ssl.require_safe_negotiation", true);

// Disable SHA-1 certs
user_pref("security.pki.sha1_enforcement_level", 1);

user_pref("security.family_safety.mode", 0);
// user_pref("security.cert_pinning.enforcement_level", 2);

/* enable CRLite
 * 0 = disabled
 * 1 = consult CRLite but only collect telemetry (default)
 * 2 = consult CRLite and enforce both "Revoked" and "Not Revoked" results
 * 3 = consult CRLite and enforce "Not Revoked" results, but defer to OCSP for "Revoked" */
user_pref("security.remote_settings.crlite_filters.enabled", true);
user_pref("security.pki.crlite_mode", 2);

// Don't show HTTP content on HTTPS pages
user_pref("security.mixed_content.block_display_content", true);
// Enable HTTPS-only mode
user_pref("dom.security.https_only_mode", true);

// Show more information on cert errors
user_pref("browser.xul.error_pages.expert_bad_cert", true);

// Send less information in the referer header
user_pref("network.http.referer.XOriginTrimmingPolicy", 2);

// Enable container tabs
user_pref("privacy.userContext.enabled", true);
user_pref("privacy.userContext.ui.enabled", true);

// Disable auto-play for videos with audio
// 0=Allow all, 1=Block non-muted media (default), 5=Block all
user_pref("media.autoplay.default", 1);

// Don't allow accessibility services to access browser
user_pref("accessibility.force_disabled", 1);

// Disable some additional analytics
user_pref("beacon.enabled", false);

// Delete temp files after use
user_pref("browser.helperApps.deleteTempFileOnExit", true);

// Don't generate thumbnails for pages
user_pref("browser.pagethumbnails.capturing_disabled", true);

// Disable UITour
user_pref("browser.uitour.enabled", false);
user_pref("browser.uitour.url", "");

// Ask where to save downloads
user_pref("browser.download.useDownloadDir", false);
// Don't show the download panel after every download
user_pref("browser.download.alwaysOpenPanel", false);
// Don't add downloads to "recent files" type lists
user_pref("browser.download.manager.addToRecentDocs", false);

// Don't allow extensions from outside of the profile/application directories
user_pref("extensions.enabledScopes", 5);
user_pref("extensions.autoDisableScopes", 15);
user_pref("extensions.postDownloadThirdPartyPrompt", false);

// Disable automatic addition of www. and .com to bare domain names
user_pref("browser.fixup.alternate.enabled", false);

user_pref("gfx.webrender.program-binary", true);
user_pref("gfx.webrender.program-binary-disk", true);

user_pref("browser.contentblocking.enabled", true);
user_pref("browser.contentblocking.category", "strict");
// Partition service workers
user_pref("privacy.partition.serviceWorkers", true);
// Enable tracking protection
// user_pref("privacy.trackingprotection.enabled", true);
// user_pref("privacy.trackingprotection.cryptomining.enabled", true);
// user_pref("privacy.trackingprotection.fingerprinting.enabled", true);
// Enable blocking of tracker cookies
// user_pref("network.cookie.cookieBehavior", 4);
// user_pref("network.http.referer.disallowCrossSiteRelaxingDefault", true);

// Don't save cookies set on HTTP between sessions
user_pref("network.cookie.thirdparty.sessionOnly", false);
user_pref("network.cookie.thirdparty.nonsecureSessionOnly", true);

user_pref("privacy.clearOnShutdown.downloads", true);

// Enable RFP (Resist Fingerprinting)
// user_pref("privacy.resistFingerprinting", true);

// Remove some suggestions from the location bar
user_pref("browser.urlbar.suggest.openpage", false);
user_pref("browser.urlbar.suggest.topsites", false);

user_pref("ui.systemUsesDarkTheme", 1);

// Disable autocopy on Linux
user_pref("clipboard.autocopy", false);

// Don't let the backspace navigate to the previous page
user_pref("browser.backspace_action", 2);

user_pref("browser.bookmarks.max_backups", 2);

// Don't recommend features or extensions while browsings
user_pref("browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons", false);
user_pref("browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features", false);
<commit_msg>firefox: enable GTK overlay scrollbars<commit_after>// Much of this is adapted from https://github.com/arkenfox/user.js/blob/master/user.js

// Disable warning for about:config
user_pref("browser.aboutConfig.showWarning", false);

// Annoying when using both Default Release and Dev Edition or Nightly
user_pref("browser.shell.checkDefaultBrowser", false);

// Restore the previous session on startup
user_pref("browser.startup.page", 3);

// Don't open links from clipboard when using the middle mouse button
user_pref("middlemouse.contentLoadURL", false);

// Disable paste using middle mouse button
user_pref("middlemouse.paste", false);

// Enable middle mouse button scrolling
user_pref("general.autoScroll", true);

// Don't sort ctrl-tab by recently used
user_pref("browser.ctrlTab.recentlyUsedOrder", false);

// Enable the new tab page
user_pref("browser.newtabpage.enabled", true);
user_pref("browser.newtab.preload", true);

// Set new page preferences
user_pref("browser.newtabpage.activity-stream.feeds.telemetry", false);
user_pref("browser.newtabpage.activity-stream.telemetry", false);
user_pref("browser.newtabpage.activity-stream.feeds.snippets", false);
user_pref("browser.newtabpage.activity-stream.feeds.section.topstories", false);
user_pref(
    "browser.newtabpage.activity-stream.section.highlights.includePocket",
    false
);
user_pref(
    "browser.newtabpage.activity-stream.feeds.discoverystreamfeed",
    false
);
user_pref("browser.newtabpage.activity-stream.showSponsored", false);
user_pref("browser.newtabpage.activity-stream.showSponsoredTopSites", false);

// Remove default "top sites"
user_pref("browser.newtabpage.activity-stream.default.sites", "");

// Disable browser region updates
user_pref("browser.region.network.url", "");
user_pref("browser.region.update.enabled", false);

// Set my preferred languages
user_pref("intl.accept_languages", "en-US, en");

// Disable addon recommendations
user_pref("extensions.getAddons.showPane", false);
user_pref("extensions.htmlaboutaddons.recommendations.enabled", false);
user_pref("browser.discovery.enabled", false);

// Helps prevent spoofed domain names
user_pref("network.IDN_show_punycode", true);

// Disable location tracking
user_pref("permissions.default.geo", 2);
user_pref("geo.enabled", false);
user_pref("geo.wifi.url", "");
user_pref("browser.search.geoip.url", "");

// Disable battery api
user_pref("dom.battery.enabled", false);

// Disable pocket
user_pref("extensions.pocket.enabled", false);
user_pref("extensions.pocket.site", "");
user_pref("extensions.pocket.oAuthConsumerKey", "");
user_pref("extensions.pocket.api", "");

// Disable telemetry
user_pref("datareporting.policy.dataSubmissionEnabled", false);
user_pref("datareporting.healthreport.uploadEnabled", false);
user_pref("toolkit.telemetry.unified", false);
user_pref("toolkit.telemetry.enabled", false);
user_pref("toolkit.telemetry.server", "data:,");
user_pref("toolkit.telemetry.archive.enabled", false);
user_pref("toolkit.telemetry.newProfilePing.enabled", false);
user_pref("toolkit.telemetry.shutdownPingSender.enabled", false);
user_pref("toolkit.telemetry.updatePing.enabled", false);
user_pref("toolkit.telemetry.bhrPing.enabled", false);
user_pref("toolkit.telemetry.firstShutdownPing.enabled", false);
user_pref("toolkit.telemetry.coverage.opt-out", true);
user_pref("toolkit.coverage.opt-out", true);
user_pref("toolkit.coverage.endpoint.base", "");
user_pref("browser.ping-centre.telemetry", false);

// Disable studies
user_pref("app.shield.optoutstudies.enabled", false);
user_pref("app.normandy.enabled", false);
user_pref("app.normandy.api_url", "");

// Disable crash reports
user_pref("breakpad.reportURL", "");
user_pref("browser.tabs.crashReporting.sendReport", false);
user_pref("browser.crashReports.unsubmittedCheck.enabled", false);
user_pref("browser.crashReports.unsubmittedCheck.autoSubmit2", false);

// Disable safebrowsing for downloads
user_pref("browser.safebrowsing.downloads.remote.enabled", false);

// Disable prefetching
// user_pref("network.prefetch-next", false);
// user_pref("network.dns.disablePrefetch", true);
// Disable link-mouseover opening connection to linked server
user_pref("network.http.speculative-parallel-limit", 0);
// user_pref("browser.places.speculativeConnect.enabled", false);

// Route dns queries through the proxy if a proxy is being used
user_pref("network.proxy.socks_remote_dns", true);

// Disable gvfs/gio protocols
user_pref("network.gio.supported-protocols", "");

// Disable DNS-over-HTTPS
user_pref("network.trr.mode", 5);

// Disable uploading of screenshots
user_pref("extensions.screenshots.upload-disabled", true);

// Don't store credit/debit cards for autofill
user_pref("extensions.formautofill.creditCards.enabled", false);

// Disable location bar search suggestions
user_pref("browser.search.suggest.enabled", false);
user_pref("browser.urlbar.suggest.searches", false);
// Don't open connections preemptively
user_pref("browser.urlbar.speculativeConnect.enabled", false);
user_pref("browser.urlbar.dnsResolveSingleWordsAfterSearch", 0);

// Don't autofill on non-secure HTTP pages
user_pref("signon.autofillForms.http", false);
user_pref("security.insecure_field_warning.contextual.enabled", true);

// * 0 = don't allow sub-resources to open HTTP authentication credentials dialogs
// * 1 = don't allow cross-origin sub-resources to open HTTP authentication credentials dialogs
// * 2 = allow sub-resources to open HTTP authentication credentials dialogs (default)
user_pref("network.auth.subresource-http-auth-allow", 1);

// Don't report SSL errors
user_pref("security.ssl.errorReporting.automatic", false);
user_pref("security.ssl.errorReporting.enabled", false);
user_pref("security.ssl.errorReporting.url", "");

// Harden OCSP settings
user_pref("security.ssl.enable_ocsp_stapling", true);
user_pref("security.OCSP.enabled", 1);
user_pref("security.OCSP.require", true);

// Only support SSL/TLS connections with servers which implement RFC 5746
user_pref("security.ssl.require_safe_negotiation", true);

// Disable SHA-1 certs
user_pref("security.pki.sha1_enforcement_level", 1);

user_pref("security.family_safety.mode", 0);
// user_pref("security.cert_pinning.enforcement_level", 2);

/* enable CRLite
 * 0 = disabled
 * 1 = consult CRLite but only collect telemetry (default)
 * 2 = consult CRLite and enforce both "Revoked" and "Not Revoked" results
 * 3 = consult CRLite and enforce "Not Revoked" results, but defer to OCSP for "Revoked" */
user_pref("security.remote_settings.crlite_filters.enabled", true);
user_pref("security.pki.crlite_mode", 2);

// Don't show HTTP content on HTTPS pages
user_pref("security.mixed_content.block_display_content", true);
// Enable HTTPS-only mode
user_pref("dom.security.https_only_mode", true);

// Show more information on cert errors
user_pref("browser.xul.error_pages.expert_bad_cert", true);

// Send less information in the referer header
user_pref("network.http.referer.XOriginTrimmingPolicy", 2);

// Enable container tabs
user_pref("privacy.userContext.enabled", true);
user_pref("privacy.userContext.ui.enabled", true);

// Disable auto-play for videos with audio
// 0=Allow all, 1=Block non-muted media (default), 5=Block all
user_pref("media.autoplay.default", 1);

// Don't allow accessibility services to access browser
user_pref("accessibility.force_disabled", 1);

// Disable some additional analytics
user_pref("beacon.enabled", false);

// Delete temp files after use
user_pref("browser.helperApps.deleteTempFileOnExit", true);

// Don't generate thumbnails for pages
user_pref("browser.pagethumbnails.capturing_disabled", true);

// Disable UITour
user_pref("browser.uitour.enabled", false);
user_pref("browser.uitour.url", "");

// Ask where to save downloads
user_pref("browser.download.useDownloadDir", false);
// Don't show the download panel after every download
user_pref("browser.download.alwaysOpenPanel", false);
// Don't add downloads to "recent files" type lists
user_pref("browser.download.manager.addToRecentDocs", false);

// Don't allow extensions from outside of the profile/application directories
user_pref("extensions.enabledScopes", 5);
user_pref("extensions.autoDisableScopes", 15);
user_pref("extensions.postDownloadThirdPartyPrompt", false);

// Disable automatic addition of www. and .com to bare domain names
user_pref("browser.fixup.alternate.enabled", false);

user_pref("gfx.webrender.program-binary", true);
user_pref("gfx.webrender.program-binary-disk", true);

user_pref("browser.contentblocking.enabled", true);
user_pref("browser.contentblocking.category", "strict");
// Partition service workers
user_pref("privacy.partition.serviceWorkers", true);
// Enable tracking protection
// user_pref("privacy.trackingprotection.enabled", true);
// user_pref("privacy.trackingprotection.cryptomining.enabled", true);
// user_pref("privacy.trackingprotection.fingerprinting.enabled", true);
// Enable blocking of tracker cookies
// user_pref("network.cookie.cookieBehavior", 4);
// user_pref("network.http.referer.disallowCrossSiteRelaxingDefault", true);

// Don't save cookies set on HTTP between sessions
user_pref("network.cookie.thirdparty.sessionOnly", false);
user_pref("network.cookie.thirdparty.nonsecureSessionOnly", true);

user_pref("privacy.clearOnShutdown.downloads", true);

// Enable RFP (Resist Fingerprinting)
// user_pref("privacy.resistFingerprinting", true);

// Remove some suggestions from the location bar
user_pref("browser.urlbar.suggest.openpage", false);
user_pref("browser.urlbar.suggest.topsites", false);

user_pref("ui.systemUsesDarkTheme", 1);

// Disable autocopy on Linux
user_pref("clipboard.autocopy", false);

// Don't let the backspace navigate to the previous page
user_pref("browser.backspace_action", 2);

user_pref("browser.bookmarks.max_backups", 2);

// Don't recommend features or extensions while browsings
user_pref(
    "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons",
    false
);
user_pref(
    "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features",
    false
);

// Enable GTK overlay scrollbar
user_pref("widget.gtk.overlay-scrollbars.enabled", true);
<|endoftext|>


<commit_before>const fs = require('fs');
const path = require('path');

const USER_WEBPACK_CONFIG_NAMES = ['webpack.config.js', 'webpackfile.js'];

const absolutize = filePath => path.resolve(process.cwd(), filePath);

/**
 * Find user’s Webpack config and return its path.
 * Fixed location for Create React App or webpack.config.js in the root directory.
 * Returns false if config not found.
 *
 * @return {string|boolean}
 */
module.exports = function findUserWebpackConfig() {
	// Check in the root folder
	for (const configFile of USER_WEBPACK_CONFIG_NAMES) {
		const absoluteConfigFile = absolutize(configFile);
		if (fs.existsSync(absoluteConfigFile)) {
			return absoluteConfigFile;
		}
	}

	return false;
};
<commit_msg>automatically find the webpack config in vue cli 3<commit_after>const fs = require('fs');
const path = require('path');

const USER_WEBPACK_CONFIG_NAMES = [
	'node_modules/@vue/cli-service/webpack.config.js',
	'webpack.config.js',
	'webpackfile.js',
];

const absolutize = filePath => path.resolve(process.cwd(), filePath);

/**
 * Find user’s Webpack config and return its path.
 * Fixed location for Create React App or webpack.config.js in the root directory.
 * Returns false if config not found.
 *
 * @return {string|boolean}
 */
module.exports = function findUserWebpackConfig() {
	// Check in the root folder
	for (const configFile of USER_WEBPACK_CONFIG_NAMES) {
		const absoluteConfigFile = absolutize(configFile);
		if (fs.existsSync(absoluteConfigFile)) {
			return absoluteConfigFile;
		}
	}

	return false;
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function() {
   return {
      x: 0,
      y: 0,
      width: 0,
      height: 0
   }
};<commit_msg>Refactored rectangle object<commit_after>'use strict';

module.exports = function() {
   var _x;
   var _y;
   var _width;
   var _height;

   _x = 0;
   _y = 0;
   _width = 0;
   _height = 0;

   return Object.defineProperties({},
      {
         x: {
            get: function() {
               return _x;
            },
            set: function(value) {
               _x = value;
            }
         },
         y: {
            get: function() {
               return _y;
            },
            set: function(value) {
               _y = value;
            }
         },
         width: {
            get: function() {
               return _width;
            },
            set: function(value) {
               _width = value;
            }
         },
         height: {
            get: function() {
               return _height;
            },
            set: function(value) {
               _height = value;
            }
         }
      }
   );
};<|endoftext|>


<commit_before>/**
 * Copyright (c) 2011 Bruno Jouhier <bruno.jouhier@sage.com>
 * MIT License
 */
(function(exports) {
	var __g = exports.globals || require("../globals");

	exports.runtime = function(filename) {
		var __srcName = filename.replace(/\.js$/, '_.js');

		function __func(_, __this, __arguments, fn, index, frame, body) {
			if (!_) {
				return __future.call(__this, fn, __arguments, index);
			}
			frame.file = __srcName;
			frame.prev = __g.frame;
			__g.frame = frame;
			try {
				body();
			} catch (e) {
				__setEF(e, frame.prev);
				__propagate(_, e);
			} finally {
				__g.frame = frame.prev;
			}
		}

		return {
			__g: __g,
			__srcName: __srcName,
			__func: __func,
			__cb: __cb,
			__future: __future,
			__propagate: __propagate,
			__trap: __trap,
			__tryCatch: __tryCatch,
			__forIn: __forIn,
			__apply: __apply,
			__setEF: __setEF
		};
	}

	function __cb(_, frame, offset, col, fn) {
		frame.offset = offset;
		frame.col = col;
		var ctx = __g.context;
		return function ___(err, result) {
			var oldFrame = __g.frame;
			__g.frame = frame;
			__g.context = ctx;
			try {
				if (err) {
					__setEF(err, frame);
					return _(err);
				}
				return fn(null, result);
			} catch (ex) {
				__setEF(ex, frame);
				return __propagate(_, ex);
			} finally {
				__g.frame = oldFrame;
			}
		}
	}

	// unfortunately callee is gone. So we need to pass a function

	function __future(fn, args, i) {
		var err, result, done, q = [];
		args = Array.prototype.slice.call(args);
		args[i] = function(e, r) {
			err = e, result = r, done = true;
			q && q.forEach(function(f) {
				try {
					f(e, r);
				} catch (ex) {
					__trap(ex);
				}
			});
			q = null;
		};
		fn.apply(this, args);
		return function ___(_) {
			if (!_) return ___;
			if (done) _(err, result);
			else q.push(_)
		}
	}

	function __propagate(_, err) {
		try {
			_(err);
		} catch (ex) {
			__trap(ex);
		}
	}

	function __trap(err) {
		if (err) {
			if (__g.context && __g.context.errorHandler) __g.context.errorHandler(err);
			else console.error("UNCAUGHT EXCEPTION: " + err.message + "\\n" + err.stack);
		}
	}

	__tryCatch: function __tryCatch(_, fn) {
		try {
			fn();
		} catch (e) {
			try {
				_(e);
			} catch (ex) {
				__trap(ex);
			}
		}
	}

	function __forIn(object) {
		var array = [];
		for (var obj in object) {
			array.push(obj);
		}
		return array;
	}

	function __apply(cb, fn, thisObj, args, index) {
		if (cb == null) return __future(__apply, arguments, 0);
		args[index != null ? index : args.length] = cb;
		return fn.apply(thisObj, args);
	}

	function __setEF(e, f) {
		function formatStack(e, raw) {
			var s = raw,
				f, skip, skipFunc = 0;
			if (s) {
				var ff;
				s = s.split('\n').map(function(l) {
					// try to map firefox format to V8 format
					// ffOffset takes care of lines difference introduced by require.js script.
					var ffOffset = typeof navigator === 'object' ? 12 : 0;
					var m = /(^[^(]+)\([^@]*\@(.*)\:(\d+)$/.exec(l);
					l = m ? "    at " + m[1] + " (" + m[2] + ":" + (parseInt(m[3]) - ffOffset) + ":0)" : l;
					ff = ff || (m != null);
					var i = l.indexOf('__$');
					if (i >= 0 && !skip) {
						skip = true;
						return l.substring(0, i) + l.substring(i + 3) + '\n';
					}
					return skip ? '' : l + '\n';
				}).join('');
				if (ff) // firefox does not include message
				s = "Error: " + e.message + '\n' + s;
				for (var f = e.__frame; f; f = f.prev) {
					if (f.offset >= 0) s += "    at " + f.name + " (" + f.file + ":" + (f.line + f.offset) + ":" + f.col + ")\n"
				}
			}
			return s;
		};
		e.__frame = e.__frame || f;
		if (exports.stackTraceEnabled && e.__lookupGetter__("rawStack") == null) {
			var getter = e.__lookupGetter__("stack");
			if (!getter) { // FF case
				var raw = e.stack;
				getter = function() {
					return raw;
				}
			}
			e.__defineGetter__("rawStack", getter);
			e.__defineGetter__("stack", function() {
				return formatStack(e, getter());
			});
		}
	}

	/// * `runtime.stackTraceEnabled = true/false;`
	///   If true, `err.stack` returns the reconstructed _sync_ stack trace.
	///   Otherwise, it returns the _raw_ stack trace.
	///   The default is true, but you must require the flows module
	///   at least once to enable sync stack traces.
	exports.stackTraceEnabled = true;
})(typeof exports !== 'undefined' ? exports : (window.StreamlineRuntime = window.StreamlineRuntime || {
	globals: {}
}));<commit_msg>fixed filenames in stack traces<commit_after>/**
 * Copyright (c) 2011 Bruno Jouhier <bruno.jouhier@sage.com>
 * MIT License
 */
(function(exports) {
	var __g = exports.globals || require("../globals");

	exports.runtime = function(filename) {
		function __func(_, __this, __arguments, fn, index, frame, body) {
			if (!_) {
				return __future.call(__this, fn, __arguments, index);
			}
			frame.file = filename;
			frame.prev = __g.frame;
			__g.frame = frame;
			try {
				body();
			} catch (e) {
				__setEF(e, frame.prev);
				__propagate(_, e);
			} finally {
				__g.frame = frame.prev;
			}
		}

		return {
			__g: __g,
			__func: __func,
			__cb: __cb,
			__future: __future,
			__propagate: __propagate,
			__trap: __trap,
			__tryCatch: __tryCatch,
			__forIn: __forIn,
			__apply: __apply,
			__setEF: __setEF
		};
	}

	function __cb(_, frame, offset, col, fn) {
		frame.offset = offset;
		frame.col = col;
		var ctx = __g.context;
		return function ___(err, result) {
			var oldFrame = __g.frame;
			__g.frame = frame;
			__g.context = ctx;
			try {
				if (err) {
					__setEF(err, frame);
					return _(err);
				}
				return fn(null, result);
			} catch (ex) {
				__setEF(ex, frame);
				return __propagate(_, ex);
			} finally {
				__g.frame = oldFrame;
			}
		}
	}

	// unfortunately callee is gone. So we need to pass a function

	function __future(fn, args, i) {
		var err, result, done, q = [];
		args = Array.prototype.slice.call(args);
		args[i] = function(e, r) {
			err = e, result = r, done = true;
			q && q.forEach(function(f) {
				try {
					f(e, r);
				} catch (ex) {
					__trap(ex);
				}
			});
			q = null;
		};
		fn.apply(this, args);
		return function ___(_) {
			if (!_) return ___;
			if (done) _(err, result);
			else q.push(_)
		}
	}

	function __propagate(_, err) {
		try {
			_(err);
		} catch (ex) {
			__trap(ex);
		}
	}

	function __trap(err) {
		if (err) {
			if (__g.context && __g.context.errorHandler) __g.context.errorHandler(err);
			else console.error("UNCAUGHT EXCEPTION: " + err.message + "\\n" + err.stack);
		}
	}

	__tryCatch: function __tryCatch(_, fn) {
		try {
			fn();
		} catch (e) {
			try {
				_(e);
			} catch (ex) {
				__trap(ex);
			}
		}
	}

	function __forIn(object) {
		var array = [];
		for (var obj in object) {
			array.push(obj);
		}
		return array;
	}

	function __apply(cb, fn, thisObj, args, index) {
		if (cb == null) return __future(__apply, arguments, 0);
		args[index != null ? index : args.length] = cb;
		return fn.apply(thisObj, args);
	}

	function __setEF(e, f) {
		function formatStack(e, raw) {
			var s = raw,
				f, skip, skipFunc = 0;
			if (s) {
				var ff;
				s = s.split('\n').map(function(l) {
					// try to map firefox format to V8 format
					// ffOffset takes care of lines difference introduced by require.js script.
					var ffOffset = typeof navigator === 'object' ? 12 : 0;
					var m = /(^[^(]+)\([^@]*\@(.*)\:(\d+)$/.exec(l);
					l = m ? "    at " + m[1] + " (" + m[2] + ":" + (parseInt(m[3]) - ffOffset) + ":0)" : l;
					ff = ff || (m != null);
					var i = l.indexOf('__$');
					if (i >= 0 && !skip) {
						skip = true;
						return l.substring(0, i) + l.substring(i + 3) + '\n';
					}
					return skip ? '' : l + '\n';
				}).join('');
				if (ff) // firefox does not include message
				s = "Error: " + e.message + '\n' + s;
				for (var f = e.__frame; f; f = f.prev) {
					if (f.offset >= 0) s += "    at " + f.name + " (" + f.file + ":" + (f.line + f.offset) + ":" + f.col + ")\n"
				}
			}
			return s;
		};
		e.__frame = e.__frame || f;
		if (exports.stackTraceEnabled && e.__lookupGetter__("rawStack") == null) {
			var getter = e.__lookupGetter__("stack");
			if (!getter) { // FF case
				var raw = e.stack;
				getter = function() {
					return raw;
				}
			}
			e.__defineGetter__("rawStack", getter);
			e.__defineGetter__("stack", function() {
				return formatStack(e, getter());
			});
		}
	}

	/// * `runtime.stackTraceEnabled = true/false;`
	///   If true, `err.stack` returns the reconstructed _sync_ stack trace.
	///   Otherwise, it returns the _raw_ stack trace.
	///   The default is true, but you must require the flows module
	///   at least once to enable sync stack traces.
	exports.stackTraceEnabled = true;
})(typeof exports !== 'undefined' ? exports : (window.StreamlineRuntime = window.StreamlineRuntime || {
	globals: {}
}));<|endoftext|>


<commit_before>/*!
  * klass: a classical JS OOP façade
  * https://github.com/ded/klass
  * http://www.dustindiaz.com/klass
  *
  * License MIT (c) Dustin Diaz & Jacob Thornton
  */
(function(exports){

  var KadOH = exports;
  KadOH.core = KadOH.core || {};

  KadOH.core.Class  = function () {
    var context = this
      , old = context.klass
      , f = 'function'
      , fnTest = /xyz/.test(function () {xyz}) ? /\bsupr\b/ : /.*/
      , proto = 'prototype'

    function klass(o) {
      return extend.call(isFn(o) ? o : function () {}, o, 1)
    }

    function isFn(o) {
      return typeof o === f
    }

    function wrap(k, fn, supr) {
      return function () {
        var tmp = this.supr
        this.supr = supr[proto][k]
        var ret = fn.apply(this, arguments)
        this.supr = tmp
        return ret
      }
    }

    function process(what, o, supr) {
      for (var k in o) {
        if (o.hasOwnProperty(k)) {
          what[k] = isFn(o[k])
            && isFn(supr[proto][k])
            && fnTest.test(o[k])
            ? wrap(k, o[k], supr) : o[k]
        }
      }
    }

    function extend(o, fromSub) {
      // must redefine noop each time so it doesn't inherit from previous arbitrary classes
      function noop() {}
      noop[proto] = this[proto]
      var supr = this
        , prototype = new noop()
        , isFunction = isFn(o)
        , _constructor = isFunction ? o : this
        , _methods = isFunction ? {} : o
      function fn() {
        if (this.initialize) this.initialize.apply(this, arguments)
        else {
          fromSub || isFunction && supr.apply(this, arguments)
          _constructor.apply(this, arguments)
        }
      }

      fn.methods = function (o) {
        process(prototype, o, supr)
        fn[proto] = prototype
        return this
      }

      fn.methods.call(fn, _methods).prototype.constructor = fn

      fn.extend = arguments.callee
      fn[proto].implement = fn.statics = function (o, optFn) {
        o = typeof o == 'string' ? (function () {
          var obj = {}
          obj[o] = optFn
          return obj
        }()) : o
        process(this, o, supr)
        return this
      }

      return fn
    }

    klass.noConflict = function () {
      context.klass = old
      return this
    }
    context.klass = klass

    return klass
  }();

})('object' === typeof module ? module.exports : (this.KadOH = this.KadOH || {}));
<commit_msg>jshinting class.js<commit_after>/*!
  * klass: a classical JS OOP façade
  * https://github.com/ded/klass
  * http://www.dustindiaz.com/klass
  *
  * License MIT (c) Dustin Diaz & Jacob Thornton
  */
(function(exports){

  var KadOH = exports;
  KadOH.core = KadOH.core || {};

  KadOH.core.Class  = function () {
    var context = this,
        old = context.klass,
        f = 'function',
        fnTest = /xyz/.test(function () {xyz;}) ? /\bsupr\b/ : /.*/,
        proto = 'prototype';

    function klass(o) {
      return extend.call(isFn(o) ? o : function () {}, o, 1);
    }

    function isFn(o) {
      return typeof o === f;
    }

    function wrap(k, fn, supr) {
      return function () {
        var tmp = this.supr;
        this.supr = supr[proto][k];
        var ret = fn.apply(this, arguments);
        this.supr = tmp;
        return ret;
      };
    }

    function process(what, o, supr) {
      for (var k in o) {
        if (o.hasOwnProperty(k)) {
          what[k] = isFn(o[k]) && isFn(supr[proto][k]) && fnTest.test(o[k]) ? wrap(k, o[k], supr) : o[k];
        }
      }
    }

    function extend(o, fromSub) {
      // must redefine noop each time so it doesn't inherit from previous arbitrary classes
      function noop() {}
      noop[proto] = this[proto];
      var supr = this,
          prototype = new noop(),
          isFunction = isFn(o),
          _constructor = isFunction ? o : this,
          _methods = isFunction ? {} : o;
      function fn() {
        if (this.initialize) this.initialize.apply(this, arguments);
        else {
          fromSub || isFunction && supr.apply(this, arguments);
          _constructor.apply(this, arguments);
        }
      }

      fn.methods = function (o) {
        process(prototype, o, supr);
        fn[proto] = prototype;
        return this;
      };

      fn.methods.call(fn, _methods).prototype.constructor = fn;

      fn.extend = arguments.callee;
      fn[proto].implement = fn.statics = function (o, optFn) {
        o = typeof o == 'string' ? (function () {
          var obj = {};
          obj[o] = optFn;
          return obj;
        }()) : o;
        process(this, o, supr);
        return this;
      };

      return fn;
    }

    klass.noConflict = function () {
      context.klass = old;
      return this;
    };
    context.klass = klass;

    return klass;
  }();

})('object' === typeof module ? module.exports : (this.KadOH = this.KadOH || {}));
<|endoftext|>