code
stringlengths 2
1.05M
|
---|
// the compile functions which compile a Node into JavaScript are not
// exposed as class methods for security reasons to prevent being able to
// override them or create fake Nodes. Instead, only compile functions of
// registered nodes can be executed
var hasOwnProperty = require('../../utils/object').hasOwnProperty;
function factory () {
// map with node type as key and compile functions as value
var compileFunctions = {}
/**
* Register a compile function for a node
* @param {string} type
* @param {function} compileFunction
* The compile function, invoked as
* compileFunction(node, defs, args)
*/
function register(type, compileFunction) {
if (compileFunctions[type] === undefined) {
compileFunctions[type] = compileFunction;
}
else {
throw new Error('Cannot register type "' + type + '": already exists');
}
}
/**
* Compile a Node into JavaScript
* @param {Node} node
* @param {Object} defs Object which can be used to define functions
* or constants globally available for the compiled
* expression
* @param {Object} args Object with local function arguments, the key is
* the name of the argument, and the value is `true`.
* The object may not be mutated, but must be
* extended instead.
* @return {string} Returns JavaScript code
*/
function compile (node, defs, args) {
if (hasOwnProperty(compileFunctions, node.type)) {
var compileFunction = compileFunctions[node.type];
return compileFunction(node, defs, args);
}
else if (typeof node._compile === 'function' &&
!hasOwnProperty(node, '_compile')) {
// Compatibility for CustomNodes
// TODO: this is a security risk, change it such that you have to register CustomNodes separately in math.js, like math.expression.node.register(MyCustomNode)
return node._compile(defs, args);
}
else {
throw new Error('Cannot compile node: unknown type "' + node.type + '"');
}
}
return {
register: register,
compile: compile
}
}
exports.factory = factory;
|
import { autofill, change } from '../actions';
var describeBlur = function describeBlur(reducer, expect, _ref) {
var fromJS = _ref.fromJS;
return function () {
it('should set value on autofill with empty state', function () {
var state = reducer(undefined, autofill('foo', 'myField', 'myValue'));
expect(state).toEqualMap({
foo: {
values: {
myField: 'myValue'
},
fields: {
myField: {
autofilled: true
}
}
}
});
});
it('should overwrite value on autofill', function () {
var state = reducer(fromJS({
foo: {
anyTouched: true,
values: {
myField: 'before'
},
fields: {
myField: {
touched: true
}
}
}
}), autofill('foo', 'myField', 'after'));
expect(state).toEqualMap({
foo: {
anyTouched: true,
values: {
myField: 'after'
},
fields: {
myField: {
touched: true,
autofilled: true
}
}
}
});
});
it('should set value on change and remove autofilled', function () {
var state = reducer(fromJS({
foo: {
anyTouched: true,
values: {
myField: 'autofilled value'
},
fields: {
myField: {
autofilled: true,
touched: true
}
}
}
}), change('foo', 'myField', 'after change', true));
expect(state).toEqualMap({
foo: {
anyTouched: true,
values: {
myField: 'after change'
},
fields: {
myField: {
touched: true
}
}
}
});
});
};
};
export default describeBlur; |
/**
* Expression
*
* Requires space before `()` or `{}` in function expressions (both [named](#requirespacesinnamedfunctionexpression)
* and [anonymous](#requirespacesinanonymousfunctionexpression)) and function declarations.
*
* Type: `Object`
*
* Values: `"beforeOpeningRoundBrace"` and `"beforeOpeningCurlyBrace"` as child properties.
* Child properties must be set to `true`.
*
* #### Example
*
* ```js
* "requireSpacesInFunction": {
* "beforeOpeningRoundBrace": true,
* "beforeOpeningCurlyBrace": true
* }
* ```
*
* ##### Valid
*
* ```js
* var x = function () {};
* var x = function a () {};
* function a () {}
* ```
*
* ##### Invalid
*
* ```js
* var x = function() {};
* var x = function (){};
* var x = function(){};
* var x = function a() {};
* var x = function a (){};
* var x = function a(){};
* function a() {}
* function a (){}
* function a(){}
* ```
*/
var assert = require('assert');
module.exports = function() {};
module.exports.prototype = {
configure: function(options) {
assert(
typeof options === 'object',
this.getOptionName() + ' option must be the object'
);
if ('beforeOpeningRoundBrace' in options) {
assert(
options.beforeOpeningRoundBrace === true,
this.getOptionName() + '.beforeOpeningRoundBrace ' +
'property requires true value or should be removed'
);
}
if ('beforeOpeningCurlyBrace' in options) {
assert(
options.beforeOpeningCurlyBrace === true,
this.getOptionName() + '.beforeOpeningCurlyBrace ' +
'property requires true value or should be removed'
);
}
assert(
options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace,
this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property'
);
this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace);
this._beforeOpeningCurlyBrace = Boolean(options.beforeOpeningCurlyBrace);
},
getOptionName: function() {
return 'requireSpacesInFunction';
},
check: function(file, errors) {
var beforeOpeningRoundBrace = this._beforeOpeningRoundBrace;
var beforeOpeningCurlyBrace = this._beforeOpeningCurlyBrace;
file.iterateNodesByType(['FunctionDeclaration', 'FunctionExpression'], function(node) {
// for a named function, use node.id
var functionNode = node.id || node;
var parent = node.parentNode;
// Ignore syntactic sugar for getters and setters.
if (parent.type === 'Property' && (parent.kind === 'get' || parent.kind === 'set')) {
return;
}
// shorthand or constructor methods
if (parent.method || parent.type === 'MethodDefinition') {
functionNode = parent.key;
}
if (beforeOpeningRoundBrace) {
var functionToken = file.getFirstNodeToken(functionNode);
errors.assert.whitespaceBetween({
token: functionToken,
nextToken: file.getNextToken(functionToken),
message: 'Missing space before opening round brace'
});
}
if (beforeOpeningCurlyBrace) {
var bodyToken = file.getFirstNodeToken(node.body);
errors.assert.whitespaceBetween({
token: file.getPrevToken(bodyToken),
nextToken: bodyToken,
message: 'Missing space before opening curly brace'
});
}
});
}
};
|
var project
function Project(name, place, config, docs) {
this.name = name
this.docs = Object.create(null)
this.tabs = place.appendChild(document.createElement("ul"))
this.tabs.className = "tabs"
var self = this
CodeMirror.on(this.tabs, "click", function(e) {
var target = e.target || e.srcElement
if (target.nodeName.toLowerCase() != "li") return
var doc = self.findDoc(target.textContent)
if (doc) self.selectDoc(doc)
})
var myConf = {
switchToDoc: function(name) { self.selectDoc(self.findDoc(name)) },
useWorker: false
}
for (var prop in config) myConf[prop] = config[prop]
var server = this.server = new CodeMirror.TernServer(myConf)
var firstDoc
for (var name in docs) {
var data = this.registerDoc(name, new CodeMirror.Doc(docs[name], "javascript"))
if (!firstDoc) firstDoc = data
}
this.curDoc = firstDoc
this.setSelectedTab(firstDoc)
var keyMap = {
"Ctrl-I": function(cm) { server.showType(cm); },
"Ctrl-O": function(cm) { server.showDocs(cm); },
"Ctrl-Space": function(cm) { server.complete(cm); },
"Alt-.": function(cm) { server.jumpToDef(cm); },
"Alt-,": function(cm) { server.jumpBack(cm); },
"Ctrl-Q": function(cm) { server.rename(cm); }
}
this.editor = new CodeMirror(place, {
lineNumbers: true,
extraKeys: keyMap,
matchBrackets: true,
value: firstDoc.doc
})
this.editor.on("cursorActivity", function(cm) { server.updateArgHints(cm); })
}
Project.prototype = {
findDoc: function(name) { return this.docs[name] },
registerDoc: function(name, doc) {
this.server.addDoc(name, doc)
var data = this.docs[name] = {
name: name,
doc: doc,
tab: this.tabs.appendChild(document.createElement("li"))
}
data.tab.textContent = name
return data
},
unregisterDoc: function(doc) {
this.server.delDoc(doc.name)
delete this.docs[doc.name]
this.tabs.removeChild(doc.tab)
if (this.curDoc == doc) for (var n in this.docs) return this.selectDoc(this.docs[n])
},
setSelectedTab: function(doc) {
for (var n = this.tabs.firstChild; n; n = n.nextSibling)
n.className = n.textContent == doc.name ? "selected" : ""
},
selectDoc: function(doc) {
if (doc == this.curDoc) return
this.server.hideDoc(this.curDoc)
this.setSelectedTab(doc)
this.curDoc = doc
this.editor.swapDoc(doc.doc)
}
}
// Initialization
function load(file, c) {
var xhr = new XMLHttpRequest();
xhr.open("get", file, true);
xhr.send();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) c(xhr.responseText, xhr.status);
};
}
CodeMirror.on(window, "load", function() {
var cmds = document.getElementById("commands")
CodeMirror.on(cmds, "change", function() {
if (!project || cmds.selectedIndex == 0) return
var found = commands[cmds.value]
cmds.selectedIndex = 0
project.editor.focus()
if (found) found()
})
var projects = document.getElementById("projects")
var projectNames = []
var projectTags = document.querySelectorAll("project")
for (var i = 0; i < projectTags.length; i++) {
var opt = projects.appendChild(document.createElement("option"))
projectNames.push(opt.textContent = projectTags[i].id)
}
CodeMirror.on(projects, "change", function() {
if (projects.selectedIndex != 0)
initProject(projects.value, function() {
projects.selectedIndex = 0
project.editor.focus()
})
})
function updateFromHash() {
var name = location.hash.slice(1)
if (projectNames.indexOf(name) > -1 &&
(!project || project.name != name)) {
initProject(name)
return true
}
}
CodeMirror.on(window, "hashchange", updateFromHash)
updateFromHash() || initProject("simple")
})
function loadFiles(project, c) {
var found = {}
function inner(node) {
while (node && node.nodeName != "PRE") node = node.nextSibling
if (!node) return c(found)
if (node.hasAttribute("file")) {
load(node.getAttribute("file"), function(data) {
found[node.id] = data
inner(node.nextSibling)
})
} else {
found[node.id] = node.textContent
inner(node.nextSibling)
}
}
inner(project.firstChild)
}
var defsLoaded = Object.create(null)
function loadDefs(defs, c) {
var result = [], loaded = 0
for (var i = 0; i < defs.length; ++i) (function(i) {
var name = defs[i]
if (defsLoaded[name]) {
result[i] = defsLoaded[name]
if (++loaded == defs.length) c(result)
} else {
load("../../defs/" + name + ".json", function(json) {
defsLoaded[name] = result[i] = JSON.parse(json)
if (++loaded == defs.length) c(result)
})
}
})(i)
}
function words(str) {
return str ? str.split(" ") : []
}
function initProject(name, c) {
var node = document.getElementById(name)
loadDefs(words(node.getAttribute("data-libs")), function(defs) {
var plugins = {}
words(node.getAttribute("data-plugins")).forEach(function(name) { plugins[name] = true })
if (plugins.requirejs) plugins.requirejs = {override: {"jquery": "=$"}}
loadFiles(node, function(files) {
var place = document.getElementById("place")
place.textContent = ""
if (project) project.server.destroy()
project = new Project(name, place, {
defs: defs,
plugins: plugins
}, files)
location.hash = "#" + name
c && c()
})
})
}
var commands = {
complete: function() { project.server.complete(project.editor) },
jumptodef: function() { project.server.jumpToDef(project.editor) },
finddocs: function() { project.server.showDocs(project.editor) },
findtype: function() { project.server.showType(project.editor) },
rename: function() { project.server.rename(project.editor) },
addfile: function() {
var name = prompt("Name of the new buffer", "")
if (name == null) return
if (!name) name = "test"
var i = 0
while (project.findDoc(name + (i || ""))) ++i
project.selectDoc(project.registerDoc(name + (i || ""), new CodeMirror.Doc("", "javascript")))
},
delfile: function() {
var hasDoc = false
for (var _ in project.docs) { hasDoc = true; break }
if (hasDoc) project.unregisterDoc(project.curDoc)
}
}
|
/// Copyright (c) 2009 Microsoft Corporation
///
/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
/// that the following conditions are met:
/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// * Neither the name of Microsoft nor the names of its contributors may be used to
/// endorse or promote products derived from this software without specific prior written permission.
///
/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ES5Harness.registerTest( {
id: "15.2.3.2-2-1",
path: "TestCases/chapter15/15.2/15.2.3/15.2.3.2/15.2.3.2-2-1.js",
description: "Object.getPrototypeOf returns the [[Prototype]] of its parameter (Boolean)",
test: function testcase() {
if (Object.getPrototypeOf(Boolean) === Function.prototype) {
return true;
}
},
precondition: function prereq() {
return fnExists(Object.getPrototypeOf);
}
});
|
version https://git-lfs.github.com/spec/v1
oid sha256:c034a971839b26686a757b89747642f1b06f763965765586adffe317fa47510a
size 2851
|
RocketChat.models.Users.rocketMailUnsubscribe = function(_id, createdAt) {
const query = {
_id,
createdAt: new Date(parseInt(createdAt))
};
const update = {
$set: {
'mailer.unsubscribed': true
}
};
const affectedRows = this.update(query, update);
console.log('[Mailer:Unsubscribe]', _id, createdAt, new Date(parseInt(createdAt)), affectedRows);
return affectedRows;
};
|
/**
* @license
* Visual Blocks Language
*
* Copyright 2015 Google Inc.
* https://developers.google.com/blockly/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Generating PHP for text blocks.
* @author [email protected] (Daaron Dwyer)
*/
'use strict';
goog.provide('Blockly.PHP.texts');
goog.require('Blockly.PHP');
Blockly.PHP['text'] = function(block) {
// Text value.
var code = Blockly.PHP.quote_(block.getFieldValue('TEXT'));
return [code, Blockly.PHP.ORDER_ATOMIC];
};
Blockly.PHP['text_join'] = function(block) {
// Create a string made up of any number of elements of any type.
if (block.itemCount_ == 0) {
return ['\'\'', Blockly.PHP.ORDER_ATOMIC];
} else if (block.itemCount_ == 1) {
var element = Blockly.PHP.valueToCode(block, 'ADD0',
Blockly.PHP.ORDER_NONE) || '\'\'';
var code = element;
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
} else if (block.itemCount_ == 2) {
var element0 = Blockly.PHP.valueToCode(block, 'ADD0',
Blockly.PHP.ORDER_NONE) || '\'\'';
var element1 = Blockly.PHP.valueToCode(block, 'ADD1',
Blockly.PHP.ORDER_NONE) || '\'\'';
var code = element0 + ' . ' + element1;
return [code, Blockly.PHP.ORDER_ADDITION];
} else {
var elements = new Array(block.itemCount_);
for (var i = 0; i < block.itemCount_; i++) {
elements[i] = Blockly.PHP.valueToCode(block, 'ADD' + i,
Blockly.PHP.ORDER_COMMA) || '\'\'';
}
var code = 'implode(\'\', array(' + elements.join(',') + '))';
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
}
};
Blockly.PHP['text_append'] = function(block) {
// Append to a variable in place.
var varName = Blockly.PHP.variableDB_.getName(
block.getFieldValue('VAR'), Blockly.Variables.NAME_TYPE);
var value = Blockly.PHP.valueToCode(block, 'TEXT',
Blockly.PHP.ORDER_ASSIGNMENT) || '\'\'';
return varName + ' .= ' + value + ';\n';
};
Blockly.PHP['text_length'] = function(block) {
// String or array length.
var functionName = Blockly.PHP.provideFunction_(
'length',
['function ' + Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_ + '($value) {',
' if (is_string($value)) {',
' return strlen($value);',
' } else {',
' return count($value);',
' }',
'}']);
var text = Blockly.PHP.valueToCode(block, 'VALUE',
Blockly.PHP.ORDER_NONE) || '\'\'';
return [functionName + '(' + text + ')', Blockly.PHP.ORDER_FUNCTION_CALL];
};
Blockly.PHP['text_isEmpty'] = function(block) {
// Is the string null or array empty?
var text = Blockly.PHP.valueToCode(block, 'VALUE',
Blockly.PHP.ORDER_NONE) || '\'\'';
return ['empty(' + text + ')', Blockly.PHP.ORDER_FUNCTION_CALL];
};
Blockly.PHP['text_indexOf'] = function(block) {
// Search the text for a substring.
var operator = block.getFieldValue('END') == 'FIRST' ?
'strpos' : 'strrpos';
var substring = Blockly.PHP.valueToCode(block, 'FIND',
Blockly.PHP.ORDER_NONE) || '\'\'';
var text = Blockly.PHP.valueToCode(block, 'VALUE',
Blockly.PHP.ORDER_NONE) || '\'\'';
if (block.workspace.options.oneBasedIndex) {
var errorIndex = ' 0';
var indexAdjustment = ' + 1';
} else {
var errorIndex = ' -1';
var indexAdjustment = '';
}
var functionName = Blockly.PHP.provideFunction_(
block.getFieldValue('END') == 'FIRST' ?
'text_indexOf' : 'text_lastIndexOf',
['function ' + Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_ +
'($text, $search) {',
' $pos = ' + operator + '($text, $search);',
' return $pos === false ? ' + errorIndex + ' : $pos' +
indexAdjustment + ';',
'}']);
var code = functionName + '(' + text + ', ' + substring + ')';
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
};
Blockly.PHP['text_charAt'] = function(block) {
// Get letter at index.
var where = block.getFieldValue('WHERE') || 'FROM_START';
var textOrder = (where == 'RANDOM') ? Blockly.PHP.ORDER_NONE :
Blockly.PHP.ORDER_COMMA;
var text = Blockly.PHP.valueToCode(block, 'VALUE', textOrder) || '\'\'';
switch (where) {
case 'FIRST':
var code = 'substr(' + text + ', 0, 1)';
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
case 'LAST':
var code = 'substr(' + text + ', -1)';
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
case 'FROM_START':
var at = Blockly.PHP.getAdjusted(block, 'AT');
var code = 'substr(' + text + ', ' + at + ', 1)';
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
case 'FROM_END':
var at = Blockly.PHP.getAdjusted(block, 'AT', 1, true);
var code = 'substr(' + text + ', ' + at + ', 1)';
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
case 'RANDOM':
var functionName = Blockly.PHP.provideFunction_(
'text_random_letter',
['function ' + Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_ + '($text) {',
' return $text[rand(0, strlen($text) - 1)];',
'}']);
code = functionName + '(' + text + ')';
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
}
throw 'Unhandled option (text_charAt).';
};
Blockly.PHP['text_getSubstring'] = function(block) {
// Get substring.
var text = Blockly.PHP.valueToCode(block, 'STRING',
Blockly.PHP.ORDER_FUNCTION_CALL) || '\'\'';
var where1 = block.getFieldValue('WHERE1');
var where2 = block.getFieldValue('WHERE2');
if (where1 == 'FIRST' && where2 == 'LAST') {
var code = text;
} else {
var at1 = Blockly.PHP.getAdjusted(block, 'AT1');
var at2 = Blockly.PHP.getAdjusted(block, 'AT2');
var functionName = Blockly.PHP.provideFunction_(
'text_get_substring',
['function ' + Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_ +
'($text, $where1, $at1, $where2, $at2) {',
' if ($where1 == \'FROM_END\') {',
' $at1 = strlen($text) - 1 - $at1;',
' } else if ($where1 == \'FIRST\') {',
' $at1 = 0;',
' } else if ($where1 != \'FROM_START\'){',
' throw new Exception(\'Unhandled option (text_get_substring).\');',
' }',
' $length = 0;',
' if ($where2 == \'FROM_START\') {',
' $length = $at2 - $at1 + 1;',
' } else if ($where2 == \'FROM_END\') {',
' $length = strlen($text) - $at1 - $at2;',
' } else if ($where2 == \'LAST\') {',
' $length = strlen($text) - $at1;',
' } else {',
' throw new Exception(\'Unhandled option (text_get_substring).\');',
' }',
' return substr($text, $at1, $length);',
'}']);
var code = functionName + '(' + text + ', \'' +
where1 + '\', ' + at1 + ', \'' + where2 + '\', ' + at2 + ')';
}
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
};
Blockly.PHP['text_changeCase'] = function(block) {
// Change capitalization.
var text = Blockly.PHP.valueToCode(block, 'TEXT',
Blockly.PHP.ORDER_NONE) || '\'\'';
if (block.getFieldValue('CASE') == 'UPPERCASE') {
var code = 'strtoupper(' + text + ')';
} else if (block.getFieldValue('CASE') == 'LOWERCASE') {
var code = 'strtolower(' + text + ')';
} else if (block.getFieldValue('CASE') == 'TITLECASE') {
var code = 'ucwords(strtolower(' + text + '))';
}
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
};
Blockly.PHP['text_trim'] = function(block) {
// Trim spaces.
var OPERATORS = {
'LEFT': 'ltrim',
'RIGHT': 'rtrim',
'BOTH': 'trim'
};
var operator = OPERATORS[block.getFieldValue('MODE')];
var text = Blockly.PHP.valueToCode(block, 'TEXT',
Blockly.PHP.ORDER_NONE) || '\'\'';
return [operator + '(' + text + ')', Blockly.PHP.ORDER_FUNCTION_CALL];
};
Blockly.PHP['text_print'] = function(block) {
// Print statement.
var msg = Blockly.PHP.valueToCode(block, 'TEXT',
Blockly.PHP.ORDER_NONE) || '\'\'';
return 'print(' + msg + ');\n';
};
Blockly.PHP['text_prompt_ext'] = function(block) {
// Prompt function.
if (block.getField('TEXT')) {
// Internal message.
var msg = Blockly.PHP.quote_(block.getFieldValue('TEXT'));
} else {
// External message.
var msg = Blockly.PHP.valueToCode(block, 'TEXT',
Blockly.PHP.ORDER_NONE) || '\'\'';
}
var code = 'readline(' + msg + ')';
var toNumber = block.getFieldValue('TYPE') == 'NUMBER';
if (toNumber) {
code = 'floatval(' + code + ')';
}
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
};
Blockly.PHP['text_prompt'] = Blockly.PHP['text_prompt_ext'];
Blockly.PHP['text_count'] = function(block) {
var text = Blockly.PHP.valueToCode(block, 'TEXT',
Blockly.PHP.ORDER_MEMBER) || '\'\'';
var sub = Blockly.PHP.valueToCode(block, 'SUB',
Blockly.PHP.ORDER_NONE) || '\'\'';
var code = 'strlen(' + sub + ') === 0'
+ ' ? strlen(' + text + ') + 1'
+ ' : substr_count(' + text + ', ' + sub + ')';
return [code, Blockly.PHP.ORDER_CONDITIONAL];
};
Blockly.PHP['text_replace'] = function(block) {
var text = Blockly.PHP.valueToCode(block, 'TEXT',
Blockly.PHP.ORDER_MEMBER) || '\'\'';
var from = Blockly.PHP.valueToCode(block, 'FROM',
Blockly.PHP.ORDER_NONE) || '\'\'';
var to = Blockly.PHP.valueToCode(block, 'TO',
Blockly.PHP.ORDER_NONE) || '\'\'';
var code = 'str_replace(' + from + ', ' + to + ', ' + text + ')';
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
};
Blockly.PHP['text_reverse'] = function(block) {
var text = Blockly.PHP.valueToCode(block, 'TEXT',
Blockly.PHP.ORDER_MEMBER) || '\'\'';
var code = 'strrev(' + text + ')';
return [code, Blockly.PHP.ORDER_FUNCTION_CALL];
};
|
var EventEmitter = require('events').EventEmitter;
var assert = require('better-assert');
var fs = require('fs');
var StringDecoder = require('string_decoder').StringDecoder;
var url = require('url');
var request = require('../../');
describe('[node] request', function(){
describe('with an object', function(){
it('should format the url', function(done){
request
.get(url.parse('http://localhost:5000/login'))
.end(function(err, res){
assert(res.ok);
done();
})
})
})
describe('without a schema', function(){
it('should default to http', function(done){
request
.get('localhost:5000/login')
.end(function(err, res){
assert(res.status == 200);
done();
})
})
})
describe('req.toJSON()', function(){
it('should describe the request', function(done){
request
.post(':5000/echo')
.send({ foo: 'baz' })
.end(function(err, res){
var obj = res.request.toJSON();
assert('POST' == obj.method);
assert(':5000/echo' == obj.url);
assert('baz' == obj.data.foo);
done();
});
})
})
describe('should allow the send shorthand', function() {
it('with callback in the method call', function(done) {
request
.get('http://localhost:5000/login', function(err, res) {
assert(res.status == 200);
done();
});
})
it('with data in the method call', function(done) {
request
.post('http://localhost:5000/echo', { foo: 'bar' })
.end(function(err, res) {
assert('{"foo":"bar"}' == res.text);
done();
});
})
it('with callback and data in the method call', function(done) {
request
.post('http://localhost:5000/echo', { foo: 'bar' }, function(err, res) {
assert('{"foo":"bar"}' == res.text);
done();
});
})
})
describe('res.toJSON()', function(){
it('should describe the response', function(done){
request
.post('http://localhost:5000/echo')
.send({ foo: 'baz' })
.end(function(err, res){
var obj = res.toJSON();
assert('object' == typeof obj.header);
assert('object' == typeof obj.req);
assert(200 == obj.status);
assert('{"foo":"baz"}' == obj.text);
done();
});
});
})
describe('res.links', function(){
it('should default to an empty object', function(done){
request
.get('http://localhost:5000/login')
.end(function(err, res){
res.links.should.eql({});
done();
})
})
it('should parse the Link header field', function(done){
request
.get('http://localhost:5000/links')
.end(function(err, res){
res.links.next.should.equal('https://api.github.com/repos/visionmedia/mocha/issues?page=2');
done();
})
})
})
describe('req.unset(field)', function(){
it('should remove the header field', function(done){
request
.post('http://localhost:5000/echo')
.unset('User-Agent')
.end(function(err, res){
assert(void 0 == res.header['user-agent']);
done();
})
})
})
describe('req.write(str)', function(){
it('should write the given data', function(done){
var req = request.post('http://localhost:5000/echo');
req.set('Content-Type', 'application/json');
req.write('{"name"').should.be.a.boolean;
req.write(':"tobi"}').should.be.a.boolean;
req.end(function(err, res){
res.text.should.equal('{"name":"tobi"}');
done();
});
})
})
describe('req.pipe(stream)', function(){
it('should pipe the response to the given stream', function(done){
var stream = new EventEmitter;
stream.buf = '';
stream.writable = true;
stream.write = function(chunk){
this.buf += chunk;
};
stream.end = function(){
this.buf.should.equal('{"name":"tobi"}');
done();
};
request
.post('http://localhost:5000/echo')
.send('{"name":"tobi"}')
.pipe(stream);
})
})
describe('.buffer()', function(){
it('should enable buffering', function(done){
request
.get('http://localhost:5000/custom')
.buffer()
.end(function(err, res){
assert(null == err);
assert('custom stuff' == res.text);
assert(res.buffered);
done();
});
})
})
describe('.buffer(false)', function(){
it('should disable buffering', function(done){
request
.post('http://localhost:5000/echo')
.type('application/x-dog')
.send('hello this is dog')
.buffer(false)
.end(function(err, res){
assert(null == err);
assert(null == res.text);
res.body.should.eql({});
var buf = '';
res.setEncoding('utf8');
res.on('data', function(chunk){ buf += chunk });
res.on('end', function(){
buf.should.equal('hello this is dog');
done();
});
});
})
})
describe('.agent()', function(){
it('should return the defaut agent', function(done){
var req = request.post('http://localhost:5000/echo');
req.agent().should.equal(false);
done();
})
})
describe('.agent(undefined)', function(){
it('should set an agent to undefined and ensure it is chainable', function(done){
var req = request.get('http://localhost:5000/echo');
var ret = req.agent(undefined);
ret.should.equal(req);
assert(req.agent() === undefined);
done();
})
})
describe('.agent(new http.Agent())', function(){
it('should set passed agent', function(done){
var http = require('http');
var req = request.get('http://localhost:5000/echo');
var agent = new http.Agent();
var ret = req.agent(agent);
ret.should.equal(req);
req.agent().should.equal(agent)
done();
})
})
describe('with a content type other than application/json or text/*', function(){
it('should disable buffering', function(done){
request
.post('http://localhost:5000/echo')
.type('application/x-dog')
.send('hello this is dog')
.end(function(err, res){
assert(null == err);
assert(null == res.text);
res.body.should.eql({});
var buf = '';
res.setEncoding('utf8');
res.buffered.should.be.false;
res.on('data', function(chunk){ buf += chunk });
res.on('end', function(){
buf.should.equal('hello this is dog');
done();
});
});
})
})
describe('content-length', function() {
it('should be set to the byte length of a non-buffer object', function (done) {
var decoder = new StringDecoder('utf8');
var img = fs.readFileSync(__dirname + '/fixtures/test.png');
img = decoder.write(img);
request
.post('http://localhost:5000/echo')
.type('application/x-image')
.send(img)
.buffer(false)
.end(function(err, res){
assert(null == err);
assert(!res.buffered);
assert(res.header['content-length'] == Buffer.byteLength(img));
done();
});
})
it('should be set to the length of a buffer object', function(done){
var img = fs.readFileSync(__dirname + '/fixtures/test.png');
request
.post('http://localhost:5000/echo')
.type('application/x-image')
.send(img)
.buffer(true)
.end(function(err, res){
assert(null == err);
assert(res.buffered);
assert(res.header['content-length'] == img.length);
done();
});
})
})
});
|
steal("funcunit/qunit", "jquery/dom/range", "jquery/dom/selection").then(function(){
module("jquery/dom/range");
test("basic range", function(){
$("#qunit-test-area")
.html("<p id='1'>0123456789</p>");
$('#1').selection(1,5);
var range = $.Range.current();
equals(range.start().offset, 1, "start is 1")
equals(range.end().offset, 5, "end is 5")
});
test('jQuery helper', function(){
$("#qunit-test-area").html("<div id='selectMe'>thisTextIsSelected</div>")
var range = $('#selectMe').range();
equals(range.toString(), "thisTextIsSelected")
});
test("constructor with undefined", function(){
var range = $.Range();
equals(document, range.start().container, "start is right");
equals(0, range.start().offset, "start is right");
equals(document, range.end().container, "end is right");
equals(0, range.end().offset, "end is right");
});
test("constructor with element", function(){
$("#qunit-test-area").html("<div id='selectMe'>thisTextIsSelected</div>")
var range = $.Range($('#selectMe')[0]);
equals(range.toString(), "thisTextIsSelected")
});
test('selecting text nodes and parent', function(){
$("#qunit-test-area").html("<div id='selectMe'>this<span>Text</span>Is<span>Sele<span>cted</div>")
var txt = $('#selectMe')[0].childNodes[2]
equals(txt.nodeValue,"Is","text is right")
var range = $.Range();
range.select(txt);
equals( range.parent(), txt, "right parent node" );
})
test('parent', function(){
$("#qunit-test-area").html("<div id='selectMe'>thisTextIsSelected</div>")
var txt = $('#selectMe')[0].childNodes[0]
var range = $.Range(txt);
equals(range.parent(), txt)
});
test("constructor with point", function(){
var floater = $("<div id='floater'>thisTextIsSelected</div>").css({
position: "absolute",
left: "0px",
top: "0px",
border: "solid 1px black"
})
$("#qunit-test-area").html("");
floater.appendTo(document.body);
var range = $.Range({pageX: 5, pageY: 5});
equals(range.start().container.parentNode, floater[0])
floater.remove()
});
test('current', function(){
$("#qunit-test-area").html("<div id='selectMe'>thisTextIsSelected</div>");
$('#selectMe').range().select();
var range = $.Range.current();
equals(range.toString(), "thisTextIsSelected" )
})
test('rangeFromPoint', function(){
});
test('overlaps', function(){});
test('collapse', function(){});
test('get start', function(){});
test('set start to object', function(){});
test('set start to number', function(){});
test('set start to string', function(){});
test('get end', function(){});
test('set end to object', function(){});
test('set end to number', function(){});
test('set end to string', function(){});
test('rect', function(){});
test('rects', function(){});
test('compare', function(){});
test('move', function(){});
test('clone', function(){});
// adding brian's tests
test("nested range", function(){
$("#qunit-test-area")
.html("<div id='2'>012<div>3<span>4</span>5</div></div>");
$('#2').selection(1,5);
var range = $.Range.current();
equals(range.start().container.data, "012", "start is 012")
equals(range.end().container.data, "4", "last char is 4")
});
test("rect", function(){
$("#qunit-test-area")
.html("<p id='1'>0123456789</p>");
$('#1').selection(1,5);
var range = $.Range.current(),
rect = range.rect();
ok(rect.height, "height non-zero")
ok(rect.width, "width non-zero")
ok(rect.left, "left non-zero")
ok(rect.top, "top non-zero")
});
test("collapsed rect", function(){
$("#qunit-test-area")
.html("<p id='1'>0123456789</p>");
$('#1').selection(1,5);
var range = $.Range.current(),
start = range.clone().collapse(),
rect = start.rect();
var r = start.rect();
ok(rect.height, "height non-zero")
ok(rect.width == 0, "width zero")
ok(rect.left, "left non-zero")
ok(rect.top, "top non-zero")
});
test("rects", function(){
$("#qunit-test-area")
.html("<p id='1'>012<span>34</span>56789</p>");
$('#1').selection(1,5);
var range = $.Range.current(),
rects = range.rects();
equals(rects.length, 2, "2 rects found")
});
test("multiline rects", function(){
$("#qunit-test-area")
.html("<pre id='1'><code><script type='text/ejs' id='recipes'>\n"+
"<% for(var i=0; i < recipes.length; i++){ %>\n"+
" <li><%=recipes[i].name %></li>\n"+
"<%} %>\n"+
"</script></code></pre>");
$('#1').selection(3,56);
var range = $.Range.current(),
rects = range.rects();
equals(rects.length, 2, "2 rects found")
ok(rects[1].width, "rect has width")
});
test("compare", function(){
$("#qunit-test-area")
.html("<p id='1'>012<span>34</span>56789</p>");
$('#1').selection(1,5);
var range1 = $.Range.current();
$('#1').selection(2,3);
var range2 = $.Range.current();
var pos = range1.compare("START_TO_START", range2)
equals(pos, -1, "pos works")
});
})
|
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.styles = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var React = _interopRequireWildcard(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _clsx = _interopRequireDefault(require("clsx"));
var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
var styles = function styles(theme) {
return {
/* Styles applied to the root element. */
root: {
display: 'block',
textAlign: 'inherit',
width: '100%',
'&:hover $focusHighlight': {
opacity: theme.palette.action.hoverOpacity
},
'&$focusVisible $focusHighlight': {
opacity: 0.12
}
},
/* Pseudo-class applied to the ButtonBase root element if the action area is keyboard focused. */
focusVisible: {},
/* Styles applied to the overlay that covers the action area when it is keyboard focused. */
focusHighlight: {
overflow: 'hidden',
pointerEvents: 'none',
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0,
borderRadius: 'inherit',
opacity: 0,
backgroundColor: 'currentcolor',
transition: theme.transitions.create('opacity', {
duration: theme.transitions.duration.short
})
}
};
};
exports.styles = styles;
var CardActionArea = /*#__PURE__*/React.forwardRef(function CardActionArea(props, ref) {
var children = props.children,
classes = props.classes,
className = props.className,
focusVisibleClassName = props.focusVisibleClassName,
other = (0, _objectWithoutProperties2.default)(props, ["children", "classes", "className", "focusVisibleClassName"]);
return /*#__PURE__*/React.createElement(_ButtonBase.default, (0, _extends2.default)({
className: (0, _clsx.default)(classes.root, className),
focusVisibleClassName: (0, _clsx.default)(focusVisibleClassName, classes.focusVisible),
ref: ref
}, other), children, /*#__PURE__*/React.createElement("span", {
className: classes.focusHighlight
}));
});
process.env.NODE_ENV !== "production" ? CardActionArea.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The content of the component.
*/
children: _propTypes.default.node,
/**
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: _propTypes.default.object,
/**
* @ignore
*/
className: _propTypes.default.string,
/**
* @ignore
*/
focusVisibleClassName: _propTypes.default.string
} : void 0;
var _default = (0, _withStyles.default)(styles, {
name: 'MuiCardActionArea'
})(CardActionArea);
exports.default = _default; |
(function() {
var FSM, exports;
FSM = {};
FSM.Machine = (function() {
function Machine(context) {
this.context = context;
this._stateTransitions = {};
this._stateTransitionsAny = {};
this._defaultTransition = null;
this._initialState = null;
this._currentState = null;
}
Machine.prototype.addTransition = function(action, state, nextState, callback) {
if (!nextState) {
nextState = state;
}
return this._stateTransitions[[action, state]] = [nextState, callback];
};
Machine.prototype.addTransitions = function(actions, state, nextState, callback) {
var action, _i, _len, _results;
if (!nextState) {
nextState = state;
}
_results = [];
for (_i = 0, _len = actions.length; _i < _len; _i++) {
action = actions[_i];
_results.push(this.addTransition(action, state, nextState, callback));
}
return _results;
};
Machine.prototype.addTransitionAny = function(state, nextState, callback) {
if (!nextState) {
nextState = state;
}
return this._stateTransitionsAny[state] = [nextState, callback];
};
Machine.prototype.setDefaultTransition = function(state, callback) {
return this._defaultTransition = [state, callback];
};
Machine.prototype.getTransition = function(action, state) {
if (this._stateTransitions[[action, state]]) {
return this._stateTransitions[[action, state]];
} else if (this._stateTransitionsAny[state]) {
return this._stateTransitionsAny[state];
} else if (this._defaultTransition) {
return this._defaultTransition;
}
throw new Error("Transition is undefined: (" + action + ", " + state + ")");
};
Machine.prototype.getCurrentState = function() {
return this._currentState;
};
Machine.prototype.setInitialState = function(state) {
this._initialState = state;
if (!this._currentState) {
return this.reset();
}
};
Machine.prototype.reset = function() {
return this._currentState = this._initialState;
};
Machine.prototype.process = function(action) {
var result;
result = this.getTransition(action, this._currentState);
if (result[1]) {
result[1].call(this.context || (this.context = this), action);
}
return this._currentState = result[0];
};
return Machine;
})();
if (typeof window !== 'undefined') {
window.FSM = FSM;
}
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = FSM;
}
}).call(this);
(function() {
var ALPHA_CHARS, ALPHA_NUMERIC_CHARS, ATTR_DELIM, ATTR_ENTITY_DOUBLE_DELIM, ATTR_ENTITY_NO_DELIM, ATTR_ENTITY_SINGLE_DELIM, ATTR_NAME, ATTR_NAME_CHARS, ATTR_NAME_FIND_VALUE, ATTR_OR_TAG_END, ATTR_VALUE_DOUBLE_DELIM, ATTR_VALUE_NO_DELIM, ATTR_VALUE_SINGLE_DELIM, CHAR_OR_ENTITY_OR_TAG, CLOSING_TAG, ENTITY, ENTITY_CHARS, HTMLString, OPENING_TAG, OPENNING_OR_CLOSING_TAG, TAG_NAME_CHARS, TAG_NAME_CLOSING, TAG_NAME_MUST_CLOSE, TAG_NAME_OPENING, TAG_OPENING_SELF_CLOSING, exports, _Parser,
__slice = [].slice,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
HTMLString = {};
if (typeof window !== 'undefined') {
window.HTMLString = HTMLString;
}
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = HTMLString;
}
HTMLString.String = (function() {
String._parser = null;
function String(html, preserveWhitespace) {
if (preserveWhitespace == null) {
preserveWhitespace = false;
}
this._preserveWhitespace = preserveWhitespace;
if (html) {
if (HTMLString.String._parser === null) {
HTMLString.String._parser = new _Parser();
}
this.characters = HTMLString.String._parser.parse(html, this._preserveWhitespace).characters;
} else {
this.characters = [];
}
}
String.prototype.isWhitespace = function() {
var c, _i, _len, _ref;
_ref = this.characters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
if (!c.isWhitespace()) {
return false;
}
}
return true;
};
String.prototype.length = function() {
return this.characters.length;
};
String.prototype.preserveWhitespace = function() {
return this._preserveWhitespace;
};
String.prototype.capitalize = function() {
var c, newString;
newString = this.copy();
if (newString.length()) {
c = newString.characters[0]._c.toUpperCase();
newString.characters[0]._c = c;
}
return newString;
};
String.prototype.charAt = function(index) {
return this.characters[index].copy();
};
String.prototype.concat = function() {
var c, indexChar, inheritFormat, inheritedTags, newString, string, strings, tail, _i, _j, _k, _l, _len, _len1, _len2, _ref, _ref1;
strings = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), inheritFormat = arguments[_i++];
if (!(typeof inheritFormat === 'undefined' || typeof inheritFormat === 'boolean')) {
strings.push(inheritFormat);
inheritFormat = true;
}
newString = this.copy();
for (_j = 0, _len = strings.length; _j < _len; _j++) {
string = strings[_j];
if (string.length === 0) {
continue;
}
tail = string;
if (typeof string === 'string') {
tail = new HTMLString.String(string, this._preserveWhitespace);
}
if (inheritFormat && newString.length()) {
indexChar = newString.charAt(newString.length() - 1);
inheritedTags = indexChar.tags();
if (indexChar.isTag()) {
inheritedTags.shift();
}
if (typeof string !== 'string') {
tail = tail.copy();
}
_ref = tail.characters;
for (_k = 0, _len1 = _ref.length; _k < _len1; _k++) {
c = _ref[_k];
c.addTags.apply(c, inheritedTags);
}
}
_ref1 = tail.characters;
for (_l = 0, _len2 = _ref1.length; _l < _len2; _l++) {
c = _ref1[_l];
newString.characters.push(c);
}
}
return newString;
};
String.prototype.contains = function(substring) {
var c, found, from, i, _i, _len, _ref;
if (typeof substring === 'string') {
return this.text().indexOf(substring) > -1;
}
from = 0;
while (from <= (this.length() - substring.length())) {
found = true;
_ref = substring.characters;
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
c = _ref[i];
if (!c.eq(this.characters[i + from])) {
found = false;
break;
}
}
if (found) {
return true;
}
from++;
}
return false;
};
String.prototype.endsWith = function(substring) {
var c, characters, i, _i, _len, _ref;
if (typeof substring === 'string') {
return substring === '' || this.text().slice(-substring.length) === substring;
}
characters = this.characters.slice().reverse();
_ref = substring.characters.slice().reverse();
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
c = _ref[i];
if (!c.eq(characters[i])) {
return false;
}
}
return true;
};
String.prototype.format = function() {
var c, from, i, newString, tags, to, _i;
from = arguments[0], to = arguments[1], tags = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
if (to < 0) {
to = this.length() + to + 1;
}
if (from < 0) {
from = this.length() + from;
}
newString = this.copy();
for (i = _i = from; from <= to ? _i < to : _i > to; i = from <= to ? ++_i : --_i) {
c = newString.characters[i];
c.addTags.apply(c, tags);
}
return newString;
};
String.prototype.hasTags = function() {
var c, found, strict, tags, _i, _j, _len, _ref;
tags = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), strict = arguments[_i++];
if (!(typeof strict === 'undefined' || typeof strict === 'boolean')) {
tags.push(strict);
strict = false;
}
found = false;
_ref = this.characters;
for (_j = 0, _len = _ref.length; _j < _len; _j++) {
c = _ref[_j];
if (c.hasTags.apply(c, tags)) {
found = true;
} else {
if (strict) {
return false;
}
}
}
return found;
};
String.prototype.html = function() {
var c, closingTag, closingTags, head, html, openHeads, openTag, openTags, tag, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3;
html = '';
openTags = [];
openHeads = [];
closingTags = [];
_ref = this.characters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
closingTags = [];
_ref1 = openTags.slice().reverse();
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
openTag = _ref1[_j];
closingTags.push(openTag);
if (!c.hasTags(openTag)) {
for (_k = 0, _len2 = closingTags.length; _k < _len2; _k++) {
closingTag = closingTags[_k];
html += closingTag.tail();
openTags.pop();
openHeads.pop();
}
closingTags = [];
}
}
_ref2 = c._tags;
for (_l = 0, _len3 = _ref2.length; _l < _len3; _l++) {
tag = _ref2[_l];
if (openHeads.indexOf(tag.head()) === -1) {
if (!tag.selfClosing()) {
head = tag.head();
html += head;
openTags.push(tag);
openHeads.push(head);
}
}
}
if (c._tags.length > 0 && c._tags[0].selfClosing()) {
html += c._tags[0].head();
}
html += c.c();
}
_ref3 = openTags.reverse();
for (_m = 0, _len4 = _ref3.length; _m < _len4; _m++) {
tag = _ref3[_m];
html += tag.tail();
}
return html;
};
String.prototype.indexOf = function(substring, from) {
var c, found, i, _i, _len, _ref;
if (from == null) {
from = 0;
}
if (from < 0) {
from = 0;
}
if (typeof substring === 'string') {
return this.text().indexOf(substring, from);
}
while (from <= (this.length() - substring.length())) {
found = true;
_ref = substring.characters;
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
c = _ref[i];
if (!c.eq(this.characters[i + from])) {
found = false;
break;
}
}
if (found) {
return from;
}
from++;
}
return -1;
};
String.prototype.insert = function(index, substring, inheritFormat) {
var c, head, indexChar, inheritedTags, middle, newString, tail, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
if (inheritFormat == null) {
inheritFormat = true;
}
head = this.slice(0, index);
tail = this.slice(index);
if (index < 0) {
index = this.length() + index;
}
middle = substring;
if (typeof substring === 'string') {
middle = new HTMLString.String(substring, this._preserveWhitespace);
}
if (inheritFormat && index > 0) {
indexChar = this.charAt(index - 1);
inheritedTags = indexChar.tags();
if (indexChar.isTag()) {
inheritedTags.shift();
}
if (typeof substring !== 'string') {
middle = middle.copy();
}
_ref = middle.characters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
c.addTags.apply(c, inheritedTags);
}
}
newString = head;
_ref1 = middle.characters;
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
c = _ref1[_j];
newString.characters.push(c);
}
_ref2 = tail.characters;
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
c = _ref2[_k];
newString.characters.push(c);
}
return newString;
};
String.prototype.lastIndexOf = function(substring, from) {
var c, characters, found, i, skip, _i, _j, _len, _len1;
if (from == null) {
from = 0;
}
if (from < 0) {
from = 0;
}
characters = this.characters.slice(from).reverse();
from = 0;
if (typeof substring === 'string') {
if (!this.contains(substring)) {
return -1;
}
substring = substring.split('').reverse();
while (from <= (characters.length - substring.length)) {
found = true;
skip = 0;
for (i = _i = 0, _len = substring.length; _i < _len; i = ++_i) {
c = substring[i];
if (characters[i + from].isTag()) {
skip += 1;
}
if (c !== characters[skip + i + from].c()) {
found = false;
break;
}
}
if (found) {
return from;
}
from++;
}
return -1;
}
substring = substring.characters.slice().reverse();
while (from <= (characters.length - substring.length)) {
found = true;
for (i = _j = 0, _len1 = substring.length; _j < _len1; i = ++_j) {
c = substring[i];
if (!c.eq(characters[i + from])) {
found = false;
break;
}
}
if (found) {
return from;
}
from++;
}
return -1;
};
String.prototype.optimize = function() {
var c, closingTag, closingTags, head, lastC, len, openHeads, openTag, openTags, runLength, runLengthSort, runLengths, run_length, t, tag, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _len6, _m, _n, _o, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _results;
openTags = [];
openHeads = [];
lastC = null;
_ref = this.characters.slice().reverse();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
c._runLengthMap = {};
c._runLengthMapSize = 0;
closingTags = [];
_ref1 = openTags.slice().reverse();
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
openTag = _ref1[_j];
closingTags.push(openTag);
if (!c.hasTags(openTag)) {
for (_k = 0, _len2 = closingTags.length; _k < _len2; _k++) {
closingTag = closingTags[_k];
openTags.pop();
openHeads.pop();
}
closingTags = [];
}
}
_ref2 = c._tags;
for (_l = 0, _len3 = _ref2.length; _l < _len3; _l++) {
tag = _ref2[_l];
if (openHeads.indexOf(tag.head()) === -1) {
if (!tag.selfClosing()) {
openTags.push(tag);
openHeads.push(tag.head());
}
}
}
for (_m = 0, _len4 = openTags.length; _m < _len4; _m++) {
tag = openTags[_m];
head = tag.head();
if (!lastC) {
c._runLengthMap[head] = [tag, 1];
continue;
}
if (!c._runLengthMap[head]) {
c._runLengthMap[head] = [tag, 0];
}
run_length = 0;
if (lastC._runLengthMap[head]) {
run_length = lastC._runLengthMap[head][1];
}
c._runLengthMap[head][1] = run_length + 1;
}
lastC = c;
}
runLengthSort = function(a, b) {
return b[1] - a[1];
};
_ref3 = this.characters;
_results = [];
for (_n = 0, _len5 = _ref3.length; _n < _len5; _n++) {
c = _ref3[_n];
len = c._tags.length;
if ((len > 0 && c._tags[0].selfClosing() && len < 3) || len < 2) {
continue;
}
runLengths = [];
_ref4 = c._runLengthMap;
for (tag in _ref4) {
runLength = _ref4[tag];
runLengths.push(runLength);
}
runLengths.sort(runLengthSort);
_ref5 = c._tags.slice();
for (_o = 0, _len6 = _ref5.length; _o < _len6; _o++) {
tag = _ref5[_o];
if (!tag.selfClosing()) {
c.removeTags(tag);
}
}
_results.push(c.addTags.apply(c, (function() {
var _len7, _p, _results1;
_results1 = [];
for (_p = 0, _len7 = runLengths.length; _p < _len7; _p++) {
t = runLengths[_p];
_results1.push(t[0]);
}
return _results1;
})()));
}
return _results;
};
String.prototype.slice = function(from, to) {
var c, newString;
newString = new HTMLString.String('', this._preserveWhitespace);
newString.characters = (function() {
var _i, _len, _ref, _results;
_ref = this.characters.slice(from, to);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c.copy());
}
return _results;
}).call(this);
return newString;
};
String.prototype.split = function(separator, limit) {
var count, end, i, index, indexes, lastIndex, start, substrings, _i, _ref;
if (separator == null) {
separator = '';
}
if (limit == null) {
limit = 0;
}
lastIndex = 0;
count = 0;
indexes = [0];
while (true) {
if (limit > 0 && count > limit) {
break;
}
index = this.indexOf(separator, lastIndex);
if (index === -1) {
break;
}
indexes.push(index);
lastIndex = index + 1;
}
indexes.push(this.length());
substrings = [];
for (i = _i = 0, _ref = indexes.length - 2; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {
start = indexes[i];
if (i > 0) {
start += 1;
}
end = indexes[i + 1];
substrings.push(this.slice(start, end));
}
return substrings;
};
String.prototype.startsWith = function(substring) {
var c, i, _i, _len, _ref;
if (typeof substring === 'string') {
return this.text().slice(0, substring.length) === substring;
}
_ref = substring.characters;
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
c = _ref[i];
if (!c.eq(this.characters[i])) {
return false;
}
}
return true;
};
String.prototype.substr = function(from, length) {
if (length <= 0) {
return new HTMLString.String('', this._preserveWhitespace);
}
if (from < 0) {
from = this.length() + from;
}
if (length === void 0) {
length = this.length() - from;
}
return this.slice(from, from + length);
};
String.prototype.substring = function(from, to) {
if (to === void 0) {
to = this.length();
}
return this.slice(from, to);
};
String.prototype.text = function() {
var c, text, _i, _len, _ref;
text = '';
_ref = this.characters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
if (c.isTag()) {
if (c.isTag('br')) {
text += '\n';
}
continue;
}
if (c.c() === ' ') {
text += c.c();
continue;
}
text += c.c();
}
return this.constructor.decode(text);
};
String.prototype.toLowerCase = function() {
var c, newString, _i, _len, _ref;
newString = this.copy();
_ref = newString.characters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
if (c._c.length === 1) {
c._c = c._c.toLowerCase();
}
}
return newString;
};
String.prototype.toUpperCase = function() {
var c, newString, _i, _len, _ref;
newString = this.copy();
_ref = newString.characters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
if (c._c.length === 1) {
c._c = c._c.toUpperCase();
}
}
return newString;
};
String.prototype.trim = function() {
var c, from, newString, to, _i, _j, _len, _len1, _ref, _ref1;
_ref = this.characters;
for (from = _i = 0, _len = _ref.length; _i < _len; from = ++_i) {
c = _ref[from];
if (!c.isWhitespace()) {
break;
}
}
_ref1 = this.characters.slice().reverse();
for (to = _j = 0, _len1 = _ref1.length; _j < _len1; to = ++_j) {
c = _ref1[to];
if (!c.isWhitespace()) {
break;
}
}
to = this.length() - to - 1;
newString = new HTMLString.String('', this._preserveWhitespace);
newString.characters = (function() {
var _k, _len2, _ref2, _results;
_ref2 = this.characters.slice(from, +to + 1 || 9e9);
_results = [];
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
c = _ref2[_k];
_results.push(c.copy());
}
return _results;
}).call(this);
return newString;
};
String.prototype.trimLeft = function() {
var c, from, newString, to, _i, _len, _ref;
to = this.length() - 1;
_ref = this.characters;
for (from = _i = 0, _len = _ref.length; _i < _len; from = ++_i) {
c = _ref[from];
if (!c.isWhitespace()) {
break;
}
}
newString = new HTMLString.String('', this._preserveWhitespace);
newString.characters = (function() {
var _j, _len1, _ref1, _results;
_ref1 = this.characters.slice(from, +to + 1 || 9e9);
_results = [];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
c = _ref1[_j];
_results.push(c.copy());
}
return _results;
}).call(this);
return newString;
};
String.prototype.trimRight = function() {
var c, from, newString, to, _i, _len, _ref;
from = 0;
_ref = this.characters.slice().reverse();
for (to = _i = 0, _len = _ref.length; _i < _len; to = ++_i) {
c = _ref[to];
if (!c.isWhitespace()) {
break;
}
}
to = this.length() - to - 1;
newString = new HTMLString.String('', this._preserveWhitespace);
newString.characters = (function() {
var _j, _len1, _ref1, _results;
_ref1 = this.characters.slice(from, +to + 1 || 9e9);
_results = [];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
c = _ref1[_j];
_results.push(c.copy());
}
return _results;
}).call(this);
return newString;
};
String.prototype.unformat = function() {
var c, from, i, newString, tags, to, _i;
from = arguments[0], to = arguments[1], tags = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
if (to < 0) {
to = this.length() + to + 1;
}
if (from < 0) {
from = this.length() + from;
}
newString = this.copy();
for (i = _i = from; from <= to ? _i < to : _i > to; i = from <= to ? ++_i : --_i) {
c = newString.characters[i];
c.removeTags.apply(c, tags);
}
return newString;
};
String.prototype.copy = function() {
var c, stringCopy;
stringCopy = new HTMLString.String('', this._preserveWhitespace);
stringCopy.characters = (function() {
var _i, _len, _ref, _results;
_ref = this.characters;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c.copy());
}
return _results;
}).call(this);
return stringCopy;
};
String.decode = function(string) {
var textarea;
textarea = document.createElement('textarea');
textarea.innerHTML = string;
return textarea.textContent;
};
String.encode = function(string) {
var textarea;
textarea = document.createElement('textarea');
textarea.textContent = string;
return textarea.innerHTML;
};
String.join = function(separator, strings) {
var joined, s, _i, _len;
joined = strings.shift();
for (_i = 0, _len = strings.length; _i < _len; _i++) {
s = strings[_i];
joined = joined.concat(separator, s);
}
return joined;
};
return String;
})();
ALPHA_CHARS = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-_$'.split('');
ALPHA_NUMERIC_CHARS = ALPHA_CHARS.concat('1234567890'.split(''));
ATTR_NAME_CHARS = ALPHA_NUMERIC_CHARS.concat([':']);
ENTITY_CHARS = ALPHA_NUMERIC_CHARS.concat(['#']);
TAG_NAME_CHARS = ALPHA_NUMERIC_CHARS.concat([':']);
CHAR_OR_ENTITY_OR_TAG = 1;
ENTITY = 2;
OPENNING_OR_CLOSING_TAG = 3;
OPENING_TAG = 4;
CLOSING_TAG = 5;
TAG_NAME_OPENING = 6;
TAG_NAME_CLOSING = 7;
TAG_OPENING_SELF_CLOSING = 8;
TAG_NAME_MUST_CLOSE = 9;
ATTR_OR_TAG_END = 10;
ATTR_NAME = 11;
ATTR_NAME_FIND_VALUE = 12;
ATTR_DELIM = 13;
ATTR_VALUE_SINGLE_DELIM = 14;
ATTR_VALUE_DOUBLE_DELIM = 15;
ATTR_VALUE_NO_DELIM = 16;
ATTR_ENTITY_NO_DELIM = 17;
ATTR_ENTITY_SINGLE_DELIM = 18;
ATTR_ENTITY_DOUBLE_DELIM = 19;
_Parser = (function() {
function _Parser() {
this.fsm = new FSM.Machine(this);
this.fsm.setInitialState(CHAR_OR_ENTITY_OR_TAG);
this.fsm.addTransitionAny(CHAR_OR_ENTITY_OR_TAG, null, function(c) {
return this._pushChar(c);
});
this.fsm.addTransition('<', CHAR_OR_ENTITY_OR_TAG, OPENNING_OR_CLOSING_TAG);
this.fsm.addTransition('&', CHAR_OR_ENTITY_OR_TAG, ENTITY);
this.fsm.addTransitions(ENTITY_CHARS, ENTITY, null, function(c) {
return this.entity += c;
});
this.fsm.addTransition(';', ENTITY, CHAR_OR_ENTITY_OR_TAG, function() {
this._pushChar("&" + this.entity + ";");
return this.entity = '';
});
this.fsm.addTransitions([' ', '\n'], OPENNING_OR_CLOSING_TAG);
this.fsm.addTransitions(ALPHA_CHARS, OPENNING_OR_CLOSING_TAG, OPENING_TAG, function() {
return this._back();
});
this.fsm.addTransition('/', OPENNING_OR_CLOSING_TAG, CLOSING_TAG);
this.fsm.addTransitions([' ', '\n'], OPENING_TAG);
this.fsm.addTransitions(ALPHA_CHARS, OPENING_TAG, TAG_NAME_OPENING, function() {
return this._back();
});
this.fsm.addTransitions([' ', '\n'], CLOSING_TAG);
this.fsm.addTransitions(ALPHA_CHARS, CLOSING_TAG, TAG_NAME_CLOSING, function() {
return this._back();
});
this.fsm.addTransitions(TAG_NAME_CHARS, TAG_NAME_OPENING, null, function(c) {
return this.tagName += c;
});
this.fsm.addTransitions([' ', '\n'], TAG_NAME_OPENING, ATTR_OR_TAG_END);
this.fsm.addTransition('/', TAG_NAME_OPENING, TAG_OPENING_SELF_CLOSING, function() {
return this.selfClosing = true;
});
this.fsm.addTransition('>', TAG_NAME_OPENING, CHAR_OR_ENTITY_OR_TAG, function() {
return this._pushTag();
});
this.fsm.addTransitions([' ', '\n'], TAG_OPENING_SELF_CLOSING);
this.fsm.addTransition('>', TAG_OPENING_SELF_CLOSING, CHAR_OR_ENTITY_OR_TAG, function() {
return this._pushTag();
});
this.fsm.addTransitions([' ', '\n'], ATTR_OR_TAG_END);
this.fsm.addTransition('/', ATTR_OR_TAG_END, TAG_OPENING_SELF_CLOSING, function() {
return this.selfClosing = true;
});
this.fsm.addTransition('>', ATTR_OR_TAG_END, CHAR_OR_ENTITY_OR_TAG, function() {
return this._pushTag();
});
this.fsm.addTransitions(ALPHA_CHARS, ATTR_OR_TAG_END, ATTR_NAME, function() {
return this._back();
});
this.fsm.addTransitions(TAG_NAME_CHARS, TAG_NAME_CLOSING, null, function(c) {
return this.tagName += c;
});
this.fsm.addTransitions([' ', '\n'], TAG_NAME_CLOSING, TAG_NAME_MUST_CLOSE);
this.fsm.addTransition('>', TAG_NAME_CLOSING, CHAR_OR_ENTITY_OR_TAG, function() {
return this._popTag();
});
this.fsm.addTransitions([' ', '\n'], TAG_NAME_MUST_CLOSE);
this.fsm.addTransition('>', TAG_NAME_MUST_CLOSE, CHAR_OR_ENTITY_OR_TAG, function() {
return this._popTag();
});
this.fsm.addTransitions(ATTR_NAME_CHARS, ATTR_NAME, null, function(c) {
return this.attributeName += c;
});
this.fsm.addTransitions([' ', '\n'], ATTR_NAME, ATTR_NAME_FIND_VALUE);
this.fsm.addTransition('=', ATTR_NAME, ATTR_DELIM);
this.fsm.addTransitions([' ', '\n'], ATTR_NAME_FIND_VALUE);
this.fsm.addTransition('=', ATTR_NAME_FIND_VALUE, ATTR_DELIM);
this.fsm.addTransitions('>', ATTR_NAME, ATTR_OR_TAG_END, function() {
this._pushAttribute();
return this._back();
});
this.fsm.addTransitionAny(ATTR_NAME_FIND_VALUE, ATTR_OR_TAG_END, function() {
this._pushAttribute();
return this._back();
});
this.fsm.addTransitions([' ', '\n'], ATTR_DELIM);
this.fsm.addTransition('\'', ATTR_DELIM, ATTR_VALUE_SINGLE_DELIM);
this.fsm.addTransition('"', ATTR_DELIM, ATTR_VALUE_DOUBLE_DELIM);
this.fsm.addTransitions(ALPHA_NUMERIC_CHARS.concat(['&'], ATTR_DELIM, ATTR_VALUE_NO_DELIM, function() {
return this._back();
}));
this.fsm.addTransition(' ', ATTR_VALUE_NO_DELIM, ATTR_OR_TAG_END, function() {
return this._pushAttribute();
});
this.fsm.addTransitions(['/', '>'], ATTR_VALUE_NO_DELIM, ATTR_OR_TAG_END, function() {
this._back();
return this._pushAttribute();
});
this.fsm.addTransition('&', ATTR_VALUE_NO_DELIM, ATTR_ENTITY_NO_DELIM);
this.fsm.addTransitionAny(ATTR_VALUE_NO_DELIM, null, function(c) {
return this.attributeValue += c;
});
this.fsm.addTransition('\'', ATTR_VALUE_SINGLE_DELIM, ATTR_OR_TAG_END, function() {
return this._pushAttribute();
});
this.fsm.addTransition('&', ATTR_VALUE_SINGLE_DELIM, ATTR_ENTITY_SINGLE_DELIM);
this.fsm.addTransitionAny(ATTR_VALUE_SINGLE_DELIM, null, function(c) {
return this.attributeValue += c;
});
this.fsm.addTransition('"', ATTR_VALUE_DOUBLE_DELIM, ATTR_OR_TAG_END, function() {
return this._pushAttribute();
});
this.fsm.addTransition('&', ATTR_VALUE_DOUBLE_DELIM, ATTR_ENTITY_DOUBLE_DELIM);
this.fsm.addTransitionAny(ATTR_VALUE_DOUBLE_DELIM, null, function(c) {
return this.attributeValue += c;
});
this.fsm.addTransitions(ENTITY_CHARS, ATTR_ENTITY_NO_DELIM, null, function(c) {
return this.entity += c;
});
this.fsm.addTransitions(ENTITY_CHARS, ATTR_ENTITY_SINGLE_DELIM, function(c) {
return this.entity += c;
});
this.fsm.addTransitions(ENTITY_CHARS, ATTR_ENTITY_DOUBLE_DELIM, null, function(c) {
return this.entity += c;
});
this.fsm.addTransition(';', ATTR_ENTITY_NO_DELIM, ATTR_VALUE_NO_DELIM, function() {
this.attributeValue += "&" + this.entity + ";";
return this.entity = '';
});
this.fsm.addTransition(';', ATTR_ENTITY_SINGLE_DELIM, ATTR_VALUE_SINGLE_DELIM, function() {
this.attributeValue += "&" + this.entity + ";";
return this.entity = '';
});
this.fsm.addTransition(';', ATTR_ENTITY_DOUBLE_DELIM, ATTR_VALUE_DOUBLE_DELIM, function() {
this.attributeValue += "&" + this.entity + ";";
return this.entity = '';
});
}
_Parser.prototype._back = function() {
return this.head--;
};
_Parser.prototype._pushAttribute = function() {
this.attributes[this.attributeName] = this.attributeValue;
this.attributeName = '';
return this.attributeValue = '';
};
_Parser.prototype._pushChar = function(c) {
var character, lastCharacter;
character = new HTMLString.Character(c, this.tags);
if (this._preserveWhitespace) {
this.string.characters.push(character);
return;
}
if (this.string.length() && !character.isTag() && !character.isEntity() && character.isWhitespace()) {
lastCharacter = this.string.characters[this.string.length() - 1];
if (lastCharacter.isWhitespace() && !lastCharacter.isTag() && !lastCharacter.isEntity()) {
return;
}
}
return this.string.characters.push(character);
};
_Parser.prototype._pushTag = function() {
var tag, _ref;
tag = new HTMLString.Tag(this.tagName, this.attributes);
this.tags.push(tag);
if (tag.selfClosing()) {
this._pushChar('');
this.tags.pop();
if (!this.selfClosed && (_ref = this.tagName, __indexOf.call(HTMLString.Tag.SELF_CLOSING, _ref) >= 0)) {
this.fsm.reset();
}
}
this.tagName = '';
this.selfClosed = false;
return this.attributes = {};
};
_Parser.prototype._popTag = function() {
var character, tag;
while (true) {
tag = this.tags.pop();
if (this.string.length()) {
character = this.string.characters[this.string.length() - 1];
if (!character.isTag() && !character.isEntity() && character.isWhitespace()) {
character.removeTags(tag);
}
}
if (tag.name() === this.tagName.toLowerCase()) {
break;
}
}
return this.tagName = '';
};
_Parser.prototype.parse = function(html, preserveWhitespace) {
var character, error;
this._preserveWhitespace = preserveWhitespace;
this.reset();
html = this.preprocess(html);
this.fsm.parser = this;
while (this.head < html.length) {
character = html[this.head];
try {
this.fsm.process(character);
} catch (_error) {
error = _error;
throw new Error("Error at char " + this.head + " >> " + error);
}
this.head++;
}
return this.string;
};
_Parser.prototype.preprocess = function(html) {
html = html.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
html = html.replace(/<!--[\s\S]*?-->/g, '');
if (!this._preserveWhitespace) {
html = html.replace(/\s+/g, ' ');
}
return html;
};
_Parser.prototype.reset = function() {
this.fsm.reset();
this.head = 0;
this.string = new HTMLString.String();
this.entity = '';
this.tags = [];
this.tagName = '';
this.selfClosing = false;
this.attributes = {};
this.attributeName = '';
return this.attributeValue = '';
};
return _Parser;
})();
HTMLString.Tag = (function() {
function Tag(name, attributes) {
var k, v;
this._name = name.toLowerCase();
this._selfClosing = HTMLString.Tag.SELF_CLOSING[this._name] === true;
this._head = null;
this._attributes = {};
for (k in attributes) {
v = attributes[k];
this._attributes[k] = v;
}
}
Tag.SELF_CLOSING = {
'area': true,
'base': true,
'br': true,
'hr': true,
'img': true,
'input': true,
'link meta': true,
'wbr': true
};
Tag.prototype.head = function() {
var components, k, v, _ref;
if (!this._head) {
components = [];
_ref = this._attributes;
for (k in _ref) {
v = _ref[k];
if (v) {
components.push("" + k + "=\"" + v + "\"");
} else {
components.push("" + k);
}
}
components.sort();
components.unshift(this._name);
this._head = "<" + (components.join(' ')) + ">";
}
return this._head;
};
Tag.prototype.name = function() {
return this._name;
};
Tag.prototype.selfClosing = function() {
return this._selfClosing;
};
Tag.prototype.tail = function() {
if (this._selfClosing) {
return '';
}
return "</" + this._name + ">";
};
Tag.prototype.attr = function(name, value) {
if (value === void 0) {
return this._attributes[name];
}
this._attributes[name] = value;
return this._head = null;
};
Tag.prototype.removeAttr = function(name) {
if (this._attributes[name] === void 0) {
return;
}
delete this._attributes[name];
return this._head = null;
};
Tag.prototype.copy = function() {
return new HTMLString.Tag(this._name, this._attributes);
};
return Tag;
})();
HTMLString.Character = (function() {
function Character(c, tags) {
this._c = c;
if (c.length > 1) {
this._c = c.toLowerCase();
}
this._tags = [];
this.addTags.apply(this, tags);
}
Character.prototype.c = function() {
return this._c;
};
Character.prototype.isEntity = function() {
return this._c.length > 1;
};
Character.prototype.isTag = function(tagName) {
if (this._tags.length === 0 || !this._tags[0].selfClosing()) {
return false;
}
if (tagName && this._tags[0].name() !== tagName) {
return false;
}
return true;
};
Character.prototype.isWhitespace = function() {
var _ref;
return ((_ref = this._c) === ' ' || _ref === '\n' || _ref === ' ') || this.isTag('br');
};
Character.prototype.tags = function() {
var t;
return (function() {
var _i, _len, _ref, _results;
_ref = this._tags;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
t = _ref[_i];
_results.push(t.copy());
}
return _results;
}).call(this);
};
Character.prototype.addTags = function() {
var tag, tags, _i, _len, _results;
tags = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
_results = [];
for (_i = 0, _len = tags.length; _i < _len; _i++) {
tag = tags[_i];
if (Array.isArray(tag)) {
continue;
}
if (tag.selfClosing()) {
if (!this.isTag()) {
this._tags.unshift(tag.copy());
}
continue;
}
_results.push(this._tags.push(tag.copy()));
}
return _results;
};
Character.prototype.eq = function(c) {
var tag, tags, _i, _j, _len, _len1, _ref, _ref1;
if (this.c() !== c.c()) {
return false;
}
if (this._tags.length !== c._tags.length) {
return false;
}
tags = {};
_ref = this._tags;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
tag = _ref[_i];
tags[tag.head()] = true;
}
_ref1 = c._tags;
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
tag = _ref1[_j];
if (!tags[tag.head()]) {
return false;
}
}
return true;
};
Character.prototype.hasTags = function() {
var tag, tagHeads, tagNames, tags, _i, _j, _len, _len1, _ref;
tags = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
tagNames = {};
tagHeads = {};
_ref = this._tags;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
tag = _ref[_i];
tagNames[tag.name()] = true;
tagHeads[tag.head()] = true;
}
for (_j = 0, _len1 = tags.length; _j < _len1; _j++) {
tag = tags[_j];
if (typeof tag === 'string') {
if (tagNames[tag] === void 0) {
return false;
}
} else {
if (tagHeads[tag.head()] === void 0) {
return false;
}
}
}
return true;
};
Character.prototype.removeTags = function() {
var heads, names, newTags, tag, tags, _i, _len;
tags = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
if (tags.length === 0) {
this._tags = [];
return;
}
names = {};
heads = {};
for (_i = 0, _len = tags.length; _i < _len; _i++) {
tag = tags[_i];
if (typeof tag === 'string') {
names[tag] = tag;
} else {
heads[tag.head()] = tag;
}
}
newTags = [];
return this._tags = this._tags.filter(function(tag) {
if (!heads[tag.head()] && !names[tag.name()]) {
return tag;
}
});
};
Character.prototype.copy = function() {
var t;
return new HTMLString.Character(this._c, (function() {
var _i, _len, _ref, _results;
_ref = this._tags;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
t = _ref[_i];
_results.push(t.copy());
}
return _results;
}).call(this));
};
return Character;
})();
}).call(this);
(function() {
var ContentSelect, SELF_CLOSING_NODE_NAMES, exports, _containedBy, _getChildNodeAndOffset, _getNodeRange, _getOffsetOfChildNode,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
ContentSelect = {};
ContentSelect.Range = (function() {
function Range(from, to) {
this.set(from, to);
}
Range.prototype.isCollapsed = function() {
return this._from === this._to;
};
Range.prototype.span = function() {
return this._to - this._from;
};
Range.prototype.collapse = function() {
return this._to = this._from;
};
Range.prototype.eq = function(range) {
return this.get()[0] === range.get()[0] && this.get()[1] === range.get()[1];
};
Range.prototype.get = function() {
return [this._from, this._to];
};
Range.prototype.select = function(element) {
var docRange, endNode, endNodeLen, endOffset, startNode, startNodeLen, startOffset, _ref, _ref1;
ContentSelect.Range.unselectAll();
docRange = document.createRange();
_ref = _getChildNodeAndOffset(element, this._from), startNode = _ref[0], startOffset = _ref[1];
_ref1 = _getChildNodeAndOffset(element, this._to), endNode = _ref1[0], endOffset = _ref1[1];
startNodeLen = startNode.length || 0;
endNodeLen = endNode.length || 0;
docRange.setStart(startNode, Math.min(startOffset, startNodeLen));
docRange.setEnd(endNode, Math.min(endOffset, endNodeLen));
return window.getSelection().addRange(docRange);
};
Range.prototype.set = function(from, to) {
from = Math.max(0, from);
to = Math.max(0, to);
this._from = Math.min(from, to);
return this._to = Math.max(from, to);
};
Range.prepareElement = function(element) {
var i, node, selfClosingNodes, _i, _len, _results;
selfClosingNodes = element.querySelectorAll(SELF_CLOSING_NODE_NAMES.join(', '));
_results = [];
for (i = _i = 0, _len = selfClosingNodes.length; _i < _len; i = ++_i) {
node = selfClosingNodes[i];
node.parentNode.insertBefore(document.createTextNode(''), node);
if (i < selfClosingNodes.length - 1) {
_results.push(node.parentNode.insertBefore(document.createTextNode(''), node.nextSibling));
} else {
_results.push(void 0);
}
}
return _results;
};
Range.query = function(element) {
var docRange, endNode, endOffset, range, startNode, startOffset, _ref;
range = new ContentSelect.Range(0, 0);
try {
docRange = window.getSelection().getRangeAt(0);
} catch (_error) {
return range;
}
if (element.firstChild === null && element.lastChild === null) {
return range;
}
if (!_containedBy(docRange.startContainer, element)) {
return range;
}
if (!_containedBy(docRange.endContainer, element)) {
return range;
}
_ref = _getNodeRange(element, docRange), startNode = _ref[0], startOffset = _ref[1], endNode = _ref[2], endOffset = _ref[3];
range.set(_getOffsetOfChildNode(element, startNode) + startOffset, _getOffsetOfChildNode(element, endNode) + endOffset);
return range;
};
Range.rect = function() {
var docRange, marker, rect;
try {
docRange = window.getSelection().getRangeAt(0);
} catch (_error) {
return null;
}
if (docRange.collapsed) {
marker = document.createElement('span');
docRange.insertNode(marker);
rect = marker.getBoundingClientRect();
marker.parentNode.removeChild(marker);
return rect;
} else {
return docRange.getBoundingClientRect();
}
};
Range.unselectAll = function() {
if (window.getSelection()) {
return window.getSelection().removeAllRanges();
}
};
return Range;
})();
SELF_CLOSING_NODE_NAMES = ['br', 'img', 'input'];
_containedBy = function(nodeA, nodeB) {
while (nodeA) {
if (nodeA === nodeB) {
return true;
}
nodeA = nodeA.parentNode;
}
return false;
};
_getChildNodeAndOffset = function(parentNode, parentOffset) {
var childNode, childOffset, childStack, n, _ref;
if (parentNode.childNodes.length === 0) {
return [parentNode, parentOffset];
}
childNode = null;
childOffset = parentOffset;
childStack = (function() {
var _i, _len, _ref, _results;
_ref = parentNode.childNodes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
n = _ref[_i];
_results.push(n);
}
return _results;
})();
while (childStack.length > 0) {
childNode = childStack.shift();
switch (childNode.nodeType) {
case Node.TEXT_NODE:
if (childNode.textContent.length >= childOffset) {
return [childNode, childOffset];
}
childOffset -= childNode.textContent.length;
break;
case Node.ELEMENT_NODE:
if (_ref = childNode.nodeName.toLowerCase(), __indexOf.call(SELF_CLOSING_NODE_NAMES, _ref) >= 0) {
if (childOffset === 0) {
return [childNode, 0];
} else {
childOffset = Math.max(0, childOffset - 1);
}
} else {
if (childNode.childNodes) {
Array.prototype.unshift.apply(childStack, (function() {
var _i, _len, _ref1, _results;
_ref1 = childNode.childNodes;
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
n = _ref1[_i];
_results.push(n);
}
return _results;
})());
}
}
}
}
return [childNode, childOffset];
};
_getOffsetOfChildNode = function(parentNode, childNode) {
var childStack, n, offset, otherChildNode, _ref, _ref1;
if (parentNode.childNodes.length === 0) {
return 0;
}
offset = 0;
childStack = (function() {
var _i, _len, _ref, _results;
_ref = parentNode.childNodes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
n = _ref[_i];
_results.push(n);
}
return _results;
})();
while (childStack.length > 0) {
otherChildNode = childStack.shift();
if (otherChildNode === childNode) {
if (_ref = otherChildNode.nodeName.toLowerCase(), __indexOf.call(SELF_CLOSING_NODE_NAMES, _ref) >= 0) {
return offset + 1;
}
return offset;
}
switch (otherChildNode.nodeType) {
case Node.TEXT_NODE:
offset += otherChildNode.textContent.length;
break;
case Node.ELEMENT_NODE:
if (_ref1 = otherChildNode.nodeName.toLowerCase(), __indexOf.call(SELF_CLOSING_NODE_NAMES, _ref1) >= 0) {
offset += 1;
} else {
if (otherChildNode.childNodes) {
Array.prototype.unshift.apply(childStack, (function() {
var _i, _len, _ref2, _results;
_ref2 = otherChildNode.childNodes;
_results = [];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
n = _ref2[_i];
_results.push(n);
}
return _results;
})());
}
}
}
}
return offset;
};
_getNodeRange = function(element, docRange) {
var childNode, childNodes, endNode, endOffset, endRange, i, startNode, startOffset, startRange, _i, _j, _len, _len1, _ref;
childNodes = element.childNodes;
startRange = docRange.cloneRange();
startRange.collapse(true);
endRange = docRange.cloneRange();
endRange.collapse(false);
startNode = startRange.startContainer;
startOffset = startRange.startOffset;
endNode = endRange.endContainer;
endOffset = endRange.endOffset;
if (!startRange.comparePoint) {
return [startNode, startOffset, endNode, endOffset];
}
if (startNode === element) {
startNode = childNodes[childNodes.length - 1];
startOffset = startNode.textContent.length;
for (i = _i = 0, _len = childNodes.length; _i < _len; i = ++_i) {
childNode = childNodes[i];
if (startRange.comparePoint(childNode, 0) !== 1) {
continue;
}
if (i === 0) {
startNode = childNode;
startOffset = 0;
} else {
startNode = childNodes[i - 1];
startOffset = childNode.textContent.length;
}
if (_ref = startNode.nodeName.toLowerCase, __indexOf.call(SELF_CLOSING_NODE_NAMES, _ref) >= 0) {
startOffset = 1;
}
break;
}
}
if (docRange.collapsed) {
return [startNode, startOffset, startNode, startOffset];
}
if (endNode === element) {
endNode = childNodes[childNodes.length - 1];
endOffset = endNode.textContent.length;
for (i = _j = 0, _len1 = childNodes.length; _j < _len1; i = ++_j) {
childNode = childNodes[i];
if (endRange.comparePoint(childNode, 0) !== 1) {
continue;
}
if (i === 0) {
endNode = childNode;
} else {
endNode = childNodes[i - 1];
}
endOffset = childNode.textContent.length + 1;
}
}
return [startNode, startOffset, endNode, endOffset];
};
if (typeof window !== 'undefined') {
window.ContentSelect = ContentSelect;
}
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = ContentSelect;
}
}).call(this);
(function() {
var ContentEdit, exports, _Root, _TagNames, _mergers,
__slice = [].slice,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
ContentEdit = {
ALIGNMENT_CLASS_NAMES: {
'left': 'align-left',
'right': 'align-right'
},
DEFAULT_MAX_ELEMENT_WIDTH: 800,
DEFAULT_MIN_ELEMENT_WIDTH: 80,
DRAG_HOLD_DURATION: 500,
DROP_EDGE_SIZE: 50,
HELPER_CHAR_LIMIT: 250,
INDENT: ' ',
LANGUAGE: 'en',
LINE_ENDINGS: '\n',
PREFER_LINE_BREAKS: false,
RESIZE_CORNER_SIZE: 15,
TRIM_WHITESPACE: true,
_translations: {},
_: function(s) {
var lang;
lang = ContentEdit.LANGUAGE;
if (ContentEdit._translations[lang] && ContentEdit._translations[lang][s]) {
return ContentEdit._translations[lang][s];
}
return s;
},
addTranslations: function(language, translations) {
return ContentEdit._translations[language] = translations;
},
addCSSClass: function(domElement, className) {
var c, classAttr, classNames;
if (domElement.classList) {
domElement.classList.add(className);
return;
}
classAttr = domElement.getAttribute('class');
if (classAttr) {
classNames = (function() {
var _i, _len, _ref, _results;
_ref = classAttr.split(' ');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c);
}
return _results;
})();
if (classNames.indexOf(className) === -1) {
return domElement.setAttribute('class', "" + classAttr + " " + className);
}
} else {
return domElement.setAttribute('class', className);
}
},
attributesToString: function(attributes) {
var attributeStrings, name, names, value, _i, _len;
if (!attributes) {
return '';
}
names = (function() {
var _results;
_results = [];
for (name in attributes) {
_results.push(name);
}
return _results;
})();
names.sort();
attributeStrings = [];
for (_i = 0, _len = names.length; _i < _len; _i++) {
name = names[_i];
value = attributes[name];
if (value === '') {
attributeStrings.push(name);
} else {
value = HTMLString.String.encode(value);
value = value.replace(/"/g, '"');
attributeStrings.push("" + name + "=\"" + value + "\"");
}
}
return attributeStrings.join(' ');
},
removeCSSClass: function(domElement, className) {
var c, classAttr, classNameIndex, classNames;
if (domElement.classList) {
domElement.classList.remove(className);
if (domElement.classList.length === 0) {
domElement.removeAttribute('class');
}
return;
}
classAttr = domElement.getAttribute('class');
if (classAttr) {
classNames = (function() {
var _i, _len, _ref, _results;
_ref = classAttr.split(' ');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c);
}
return _results;
})();
classNameIndex = classNames.indexOf(className);
if (classNameIndex > -1) {
classNames.splice(classNameIndex, 1);
if (classNames.length) {
return domElement.setAttribute('class', classNames.join(' '));
} else {
return domElement.removeAttribute('class');
}
}
}
}
};
if (typeof window !== 'undefined') {
window.ContentEdit = ContentEdit;
}
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = ContentEdit;
}
_TagNames = (function() {
function _TagNames() {
this._tagNames = {};
}
_TagNames.prototype.register = function() {
var cls, tagName, tagNames, _i, _len, _results;
cls = arguments[0], tagNames = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
_results = [];
for (_i = 0, _len = tagNames.length; _i < _len; _i++) {
tagName = tagNames[_i];
_results.push(this._tagNames[tagName.toLowerCase()] = cls);
}
return _results;
};
_TagNames.prototype.match = function(tagName) {
tagName = tagName.toLowerCase();
if (this._tagNames[tagName]) {
return this._tagNames[tagName];
}
return ContentEdit.Static;
};
return _TagNames;
})();
ContentEdit.TagNames = (function() {
var instance;
function TagNames() {}
instance = null;
TagNames.get = function() {
return instance != null ? instance : instance = new _TagNames();
};
return TagNames;
})();
ContentEdit.Node = (function() {
function Node() {
this._bindings = {};
this._parent = null;
this._modified = null;
}
Node.prototype.lastModified = function() {
return this._modified;
};
Node.prototype.parent = function() {
return this._parent;
};
Node.prototype.parents = function() {
var parent, parents;
parents = [];
parent = this._parent;
while (parent) {
parents.push(parent);
parent = parent._parent;
}
return parents;
};
Node.prototype.type = function() {
return 'Node';
};
Node.prototype.html = function(indent) {
if (indent == null) {
indent = '';
}
throw new Error('`html` not implemented');
};
Node.prototype.bind = function(eventName, callback) {
if (this._bindings[eventName] === void 0) {
this._bindings[eventName] = [];
}
this._bindings[eventName].push(callback);
return callback;
};
Node.prototype.trigger = function() {
var args, callback, eventName, _i, _len, _ref, _results;
eventName = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
if (!this._bindings[eventName]) {
return;
}
_ref = this._bindings[eventName];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
callback = _ref[_i];
if (!callback) {
continue;
}
_results.push(callback.call.apply(callback, [this].concat(__slice.call(args))));
}
return _results;
};
Node.prototype.unbind = function(eventName, callback) {
var i, suspect, _i, _len, _ref, _results;
if (!eventName) {
this._bindings = {};
return;
}
if (!callback) {
this._bindings[eventName] = void 0;
return;
}
if (!this._bindings[eventName]) {
return;
}
_ref = this._bindings[eventName];
_results = [];
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
suspect = _ref[i];
if (suspect === callback) {
_results.push(this._bindings[eventName].splice(i, 1));
} else {
_results.push(void 0);
}
}
return _results;
};
Node.prototype.commit = function() {
this._modified = null;
return ContentEdit.Root.get().trigger('commit', this);
};
Node.prototype.taint = function() {
var now, parent, root, _i, _len, _ref;
now = Date.now();
this._modified = now;
_ref = this.parents();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
parent = _ref[_i];
parent._modified = now;
}
root = ContentEdit.Root.get();
root._modified = now;
return root.trigger('taint', this);
};
Node.prototype.closest = function(testFunc) {
var parent;
parent = this.parent();
while (parent && !testFunc(parent)) {
if (parent.parent) {
parent = parent.parent();
} else {
parent = null;
}
}
return parent;
};
Node.prototype.next = function() {
var children, index, node, _i, _len, _ref;
if (this.children && this.children.length > 0) {
return this.children[0];
}
_ref = [this].concat(this.parents());
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
node = _ref[_i];
if (!node.parent()) {
return null;
}
children = node.parent().children;
index = children.indexOf(node);
if (index < children.length - 1) {
return children[index + 1];
}
}
};
Node.prototype.nextContent = function() {
return this.nextWithTest(function(node) {
return node.content !== void 0;
});
};
Node.prototype.nextSibling = function() {
var index;
index = this.parent().children.indexOf(this);
if (index === this.parent().children.length - 1) {
return null;
}
return this.parent().children[index + 1];
};
Node.prototype.nextWithTest = function(testFunc) {
var node;
node = this;
while (node) {
node = node.next();
if (node && testFunc(node)) {
return node;
}
}
};
Node.prototype.previous = function() {
var children, node;
if (!this.parent()) {
return null;
}
children = this.parent().children;
if (children[0] === this) {
return this.parent();
}
node = children[children.indexOf(this) - 1];
while (node.children && node.children.length) {
node = node.children[node.children.length - 1];
}
return node;
};
Node.prototype.previousContent = function() {
var node;
return node = this.previousWithTest(function(node) {
return node.content !== void 0;
});
};
Node.prototype.previousSibling = function() {
var index;
index = this.parent().children.indexOf(this);
if (index === 0) {
return null;
}
return this.parent().children[index - 1];
};
Node.prototype.previousWithTest = function(testFunc) {
var node;
node = this;
while (node) {
node = node.previous();
if (node && testFunc(node)) {
return node;
}
}
};
Node.extend = function(cls) {
var key, value, _ref;
_ref = cls.prototype;
for (key in _ref) {
value = _ref[key];
if (key === 'constructor') {
continue;
}
this.prototype[key] = value;
}
for (key in cls) {
value = cls[key];
if (__indexOf.call('__super__', key) >= 0) {
continue;
}
this.prototype[key] = value;
}
return this;
};
Node.fromDOMElement = function(domElement) {
throw new Error('`fromDOMElement` not implemented');
};
return Node;
})();
ContentEdit.NodeCollection = (function(_super) {
__extends(NodeCollection, _super);
function NodeCollection() {
NodeCollection.__super__.constructor.call(this);
this.children = [];
}
NodeCollection.prototype.descendants = function() {
var descendants, node, nodeStack;
descendants = [];
nodeStack = this.children.slice();
while (nodeStack.length > 0) {
node = nodeStack.shift();
descendants.push(node);
if (node.children && node.children.length > 0) {
nodeStack = node.children.slice().concat(nodeStack);
}
}
return descendants;
};
NodeCollection.prototype.isMounted = function() {
return false;
};
NodeCollection.prototype.type = function() {
return 'NodeCollection';
};
NodeCollection.prototype.attach = function(node, index) {
if (node.parent()) {
node.parent().detach(node);
}
node._parent = this;
if (index !== void 0) {
this.children.splice(index, 0, node);
} else {
this.children.push(node);
}
if (node.mount && this.isMounted()) {
node.mount();
}
this.taint();
return ContentEdit.Root.get().trigger('attach', this, node);
};
NodeCollection.prototype.commit = function() {
var descendant, _i, _len, _ref;
_ref = this.descendants();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
descendant = _ref[_i];
descendant._modified = null;
}
this._modified = null;
return ContentEdit.Root.get().trigger('commit', this);
};
NodeCollection.prototype.detach = function(node) {
var nodeIndex;
nodeIndex = this.children.indexOf(node);
if (nodeIndex === -1) {
return;
}
if (node.unmount && this.isMounted() && node.isMounted()) {
node.unmount();
}
this.children.splice(nodeIndex, 1);
node._parent = null;
this.taint();
return ContentEdit.Root.get().trigger('detach', this, node);
};
return NodeCollection;
})(ContentEdit.Node);
ContentEdit.Element = (function(_super) {
__extends(Element, _super);
function Element(tagName, attributes) {
Element.__super__.constructor.call(this);
this._tagName = tagName.toLowerCase();
this._attributes = attributes ? attributes : {};
this._domElement = null;
this._behaviours = {
drag: true,
drop: true,
merge: true,
remove: true,
resize: true,
spawn: true
};
}
Element.prototype.attributes = function() {
var attributes, name, value, _ref;
attributes = {};
_ref = this._attributes;
for (name in _ref) {
value = _ref[name];
attributes[name] = value;
}
return attributes;
};
Element.prototype.cssTypeName = function() {
return 'element';
};
Element.prototype.domElement = function() {
return this._domElement;
};
Element.prototype.isFixed = function() {
return this.parent() && this.parent().type() === 'Fixture';
};
Element.prototype.isFocused = function() {
return ContentEdit.Root.get().focused() === this;
};
Element.prototype.isMounted = function() {
return this._domElement !== null;
};
Element.prototype.type = function() {
return 'Element';
};
Element.prototype.typeName = function() {
return 'Element';
};
Element.prototype.addCSSClass = function(className) {
var modified;
modified = false;
if (!this.hasCSSClass(className)) {
modified = true;
if (this.attr('class')) {
this.attr('class', "" + (this.attr('class')) + " " + className);
} else {
this.attr('class', className);
}
}
this._addCSSClass(className);
if (modified) {
return this.taint();
}
};
Element.prototype.attr = function(name, value) {
name = name.toLowerCase();
if (value === void 0) {
return this._attributes[name];
}
this._attributes[name] = value;
if (this.isMounted() && name.toLowerCase() !== 'class') {
this._domElement.setAttribute(name, value);
}
return this.taint();
};
Element.prototype.blur = function() {
var root;
root = ContentEdit.Root.get();
if (this.isFocused()) {
this._removeCSSClass('ce-element--focused');
root._focused = null;
return root.trigger('blur', this);
}
};
Element.prototype.can = function(behaviour, allowed) {
if (allowed === void 0) {
return (!this.isFixed()) && this._behaviours[behaviour];
}
return this._behaviours[behaviour] = allowed;
};
Element.prototype.createDraggingDOMElement = function() {
var helper;
if (!this.isMounted()) {
return;
}
helper = document.createElement('div');
helper.setAttribute('class', "ce-drag-helper ce-drag-helper--type-" + (this.cssTypeName()));
helper.setAttribute('data-ce-type', ContentEdit._(this.typeName()));
return helper;
};
Element.prototype.drag = function(x, y) {
var root;
if (!(this.isMounted() && this.can('drag'))) {
return;
}
root = ContentEdit.Root.get();
root.startDragging(this, x, y);
return root.trigger('drag', this);
};
Element.prototype.drop = function(element, placement) {
var root;
if (!this.can('drop')) {
return;
}
root = ContentEdit.Root.get();
if (element) {
element._removeCSSClass('ce-element--drop');
element._removeCSSClass("ce-element--drop-" + placement[0]);
element._removeCSSClass("ce-element--drop-" + placement[1]);
if (this.constructor.droppers[element.type()]) {
this.constructor.droppers[element.type()](this, element, placement);
root.trigger('drop', this, element, placement);
return;
} else if (element.constructor.droppers[this.type()]) {
element.constructor.droppers[this.type()](this, element, placement);
root.trigger('drop', this, element, placement);
return;
}
}
return root.trigger('drop', this, null, null);
};
Element.prototype.focus = function(supressDOMFocus) {
var root;
root = ContentEdit.Root.get();
if (this.isFocused()) {
return;
}
if (root.focused()) {
root.focused().blur();
}
this._addCSSClass('ce-element--focused');
root._focused = this;
if (this.isMounted() && !supressDOMFocus) {
this.domElement().focus();
}
return root.trigger('focus', this);
};
Element.prototype.hasCSSClass = function(className) {
var c, classNames;
if (this.attr('class')) {
classNames = (function() {
var _i, _len, _ref, _results;
_ref = this.attr('class').split(' ');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c);
}
return _results;
}).call(this);
if (classNames.indexOf(className) > -1) {
return true;
}
}
return false;
};
Element.prototype.merge = function(element) {
if (!(this.can('merge') && this.can('remove'))) {
return false;
}
if (this.constructor.mergers[element.type()]) {
return this.constructor.mergers[element.type()](element, this);
} else if (element.constructor.mergers[this.type()]) {
return element.constructor.mergers[this.type()](element, this);
}
};
Element.prototype.mount = function() {
var sibling;
if (!this._domElement) {
this._domElement = document.createElement(this.tagName());
}
sibling = this.nextSibling();
if (sibling) {
this.parent().domElement().insertBefore(this._domElement, sibling.domElement());
} else {
if (this.isFixed()) {
this.parent().domElement().parentNode.replaceChild(this._domElement, this.parent().domElement());
this.parent()._domElement = this._domElement;
} else {
this.parent().domElement().appendChild(this._domElement);
}
}
this._addDOMEventListeners();
this._addCSSClass('ce-element');
this._addCSSClass("ce-element--type-" + (this.cssTypeName()));
if (this.isFocused()) {
this._addCSSClass('ce-element--focused');
}
return ContentEdit.Root.get().trigger('mount', this);
};
Element.prototype.removeAttr = function(name) {
name = name.toLowerCase();
if (!this._attributes[name]) {
return;
}
delete this._attributes[name];
if (this.isMounted() && name.toLowerCase() !== 'class') {
this._domElement.removeAttribute(name);
}
return this.taint();
};
Element.prototype.removeCSSClass = function(className) {
var c, classNameIndex, classNames;
if (!this.hasCSSClass(className)) {
return;
}
classNames = (function() {
var _i, _len, _ref, _results;
_ref = this.attr('class').split(' ');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c);
}
return _results;
}).call(this);
classNameIndex = classNames.indexOf(className);
if (classNameIndex > -1) {
classNames.splice(classNameIndex, 1);
}
if (classNames.length) {
this.attr('class', classNames.join(' '));
} else {
this.removeAttr('class');
}
this._removeCSSClass(className);
return this.taint();
};
Element.prototype.tagName = function(name) {
if (name === void 0) {
return this._tagName;
}
this._tagName = name.toLowerCase();
if (this.isMounted()) {
this.unmount();
this.mount();
}
return this.taint();
};
Element.prototype.unmount = function() {
this._removeDOMEventListeners();
if (this.isFixed()) {
this._removeCSSClass('ce-element');
this._removeCSSClass("ce-element--type-" + (this.cssTypeName()));
this._removeCSSClass('ce-element--focused');
return;
}
if (this._domElement.parentNode) {
this._domElement.parentNode.removeChild(this._domElement);
}
this._domElement = null;
return ContentEdit.Root.get().trigger('unmount', this);
};
Element.prototype._addDOMEventListeners = function() {
var eventHandler, eventName, _ref, _results;
this._domEventHandlers = {
'dragstart': (function(_this) {
return function(ev) {
return ev.preventDefault();
};
})(this),
'focus': (function(_this) {
return function(ev) {
return ev.preventDefault();
};
})(this),
'keydown': (function(_this) {
return function(ev) {
return _this._onKeyDown(ev);
};
})(this),
'keyup': (function(_this) {
return function(ev) {
return _this._onKeyUp(ev);
};
})(this),
'mousedown': (function(_this) {
return function(ev) {
if (ev.button === 0) {
return _this._onMouseDown(ev);
}
};
})(this),
'mousemove': (function(_this) {
return function(ev) {
return _this._onMouseMove(ev);
};
})(this),
'mouseover': (function(_this) {
return function(ev) {
return _this._onMouseOver(ev);
};
})(this),
'mouseout': (function(_this) {
return function(ev) {
return _this._onMouseOut(ev);
};
})(this),
'mouseup': (function(_this) {
return function(ev) {
if (ev.button === 0) {
return _this._onMouseUp(ev);
}
};
})(this),
'dragover': (function(_this) {
return function(ev) {
return ev.preventDefault();
};
})(this),
'drop': (function(_this) {
return function(ev) {
return _this._onNativeDrop(ev);
};
})(this),
'paste': (function(_this) {
return function(ev) {
return _this._onPaste(ev);
};
})(this)
};
_ref = this._domEventHandlers;
_results = [];
for (eventName in _ref) {
eventHandler = _ref[eventName];
_results.push(this._domElement.addEventListener(eventName, eventHandler));
}
return _results;
};
Element.prototype._onKeyDown = function(ev) {};
Element.prototype._onKeyUp = function(ev) {};
Element.prototype._onMouseDown = function(ev) {
if (this.focus) {
return this.focus(true);
}
};
Element.prototype._onMouseMove = function(ev) {
return this._onOver(ev);
};
Element.prototype._onMouseOver = function(ev) {
return this._onOver(ev);
};
Element.prototype._onMouseOut = function(ev) {
var dragging, root;
this._removeCSSClass('ce-element--over');
root = ContentEdit.Root.get();
dragging = root.dragging();
if (dragging) {
this._removeCSSClass('ce-element--drop');
this._removeCSSClass('ce-element--drop-above');
this._removeCSSClass('ce-element--drop-below');
this._removeCSSClass('ce-element--drop-center');
this._removeCSSClass('ce-element--drop-left');
this._removeCSSClass('ce-element--drop-right');
return root._dropTarget = null;
}
};
Element.prototype._onMouseUp = function(ev) {
return this._ieMouseDownEchoed = false;
};
Element.prototype._onNativeDrop = function(ev) {
ev.preventDefault();
ev.stopPropagation();
return ContentEdit.Root.get().trigger('native-drop', this, ev);
};
Element.prototype._onPaste = function(ev) {
ev.preventDefault();
ev.stopPropagation();
return ContentEdit.Root.get().trigger('paste', this, ev);
};
Element.prototype._onOver = function(ev) {
var dragging, root;
this._addCSSClass('ce-element--over');
root = ContentEdit.Root.get();
dragging = root.dragging();
if (!dragging) {
return;
}
if (dragging === this) {
return;
}
if (root._dropTarget) {
return;
}
if (!this.can('drop')) {
return;
}
if (!(this.constructor.droppers[dragging.type()] || dragging.constructor.droppers[this.type()])) {
return;
}
this._addCSSClass('ce-element--drop');
return root._dropTarget = this;
};
Element.prototype._removeDOMEventListeners = function() {
var eventHandler, eventName, _ref, _results;
_ref = this._domEventHandlers;
_results = [];
for (eventName in _ref) {
eventHandler = _ref[eventName];
_results.push(this._domElement.removeEventListener(eventName, eventHandler));
}
return _results;
};
Element.prototype._addCSSClass = function(className) {
if (!this.isMounted()) {
return;
}
return ContentEdit.addCSSClass(this._domElement, className);
};
Element.prototype._attributesToString = function() {
if (!(Object.getOwnPropertyNames(this._attributes).length > 0)) {
return '';
}
return ' ' + ContentEdit.attributesToString(this._attributes);
};
Element.prototype._removeCSSClass = function(className) {
if (!this.isMounted()) {
return;
}
return ContentEdit.removeCSSClass(this._domElement, className);
};
Element.droppers = {};
Element.mergers = {};
Element.placements = ['above', 'below'];
Element.getDOMElementAttributes = function(domElement) {
var attribute, attributes, _i, _len, _ref;
if (!domElement.hasAttributes()) {
return {};
}
attributes = {};
_ref = domElement.attributes;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
attribute = _ref[_i];
attributes[attribute.name.toLowerCase()] = attribute.value;
}
return attributes;
};
Element._dropVert = function(element, target, placement) {
var insertIndex;
element.parent().detach(element);
insertIndex = target.parent().children.indexOf(target);
if (placement[0] === 'below') {
insertIndex += 1;
}
return target.parent().attach(element, insertIndex);
};
Element._dropBoth = function(element, target, placement) {
var aClassNames, alignLeft, alignRight, className, insertIndex, _i, _len, _ref;
element.parent().detach(element);
insertIndex = target.parent().children.indexOf(target);
if (placement[0] === 'below' && placement[1] === 'center') {
insertIndex += 1;
}
alignLeft = ContentEdit.ALIGNMENT_CLASS_NAMES['left'];
alignRight = ContentEdit.ALIGNMENT_CLASS_NAMES['right'];
if (element.a) {
element._removeCSSClass(alignLeft);
element._removeCSSClass(alignRight);
if (element.a['class']) {
aClassNames = [];
_ref = element.a['class'].split(' ');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
className = _ref[_i];
if (className === alignLeft || className === alignRight) {
continue;
}
aClassNames.push(className);
}
if (aClassNames.length) {
element.a['class'] = aClassNames.join(' ');
} else {
delete element.a['class'];
}
}
} else {
element.removeCSSClass(alignLeft);
element.removeCSSClass(alignRight);
}
if (placement[1] === 'left') {
if (element.a) {
if (element.a['class']) {
element.a['class'] += ' ' + alignLeft;
} else {
element.a['class'] = alignLeft;
}
element._addCSSClass(alignLeft);
} else {
element.addCSSClass(alignLeft);
}
}
if (placement[1] === 'right') {
if (element.a) {
if (element.a['class']) {
element.a['class'] += ' ' + alignRight;
} else {
element.a['class'] = alignRight;
}
element._addCSSClass(alignRight);
} else {
element.addCSSClass(alignRight);
}
}
return target.parent().attach(element, insertIndex);
};
return Element;
})(ContentEdit.Node);
ContentEdit.ElementCollection = (function(_super) {
__extends(ElementCollection, _super);
ElementCollection.extend(ContentEdit.NodeCollection);
function ElementCollection(tagName, attributes) {
ElementCollection.__super__.constructor.call(this, tagName, attributes);
ContentEdit.NodeCollection.prototype.constructor.call(this);
}
ElementCollection.prototype.cssTypeName = function() {
return 'element-collection';
};
ElementCollection.prototype.isMounted = function() {
return this._domElement !== null;
};
ElementCollection.prototype.type = function() {
return 'ElementCollection';
};
ElementCollection.prototype.createDraggingDOMElement = function() {
var helper, text;
if (!this.isMounted()) {
return;
}
helper = ElementCollection.__super__.createDraggingDOMElement.call(this);
text = this._domElement.textContent;
if (text.length > ContentEdit.HELPER_CHAR_LIMIT) {
text = text.substr(0, ContentEdit.HELPER_CHAR_LIMIT);
}
helper.innerHTML = text;
return helper;
};
ElementCollection.prototype.detach = function(element) {
ContentEdit.NodeCollection.prototype.detach.call(this, element);
if (this.children.length === 0 && this.parent()) {
return this.parent().detach(this);
}
};
ElementCollection.prototype.html = function(indent) {
var attributes, c, children, le;
if (indent == null) {
indent = '';
}
children = (function() {
var _i, _len, _ref, _results;
_ref = this.children;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c.html(indent + ContentEdit.INDENT));
}
return _results;
}).call(this);
le = ContentEdit.LINE_ENDINGS;
if (this.isFixed()) {
return children.join(le);
} else {
attributes = this._attributesToString();
return ("" + indent + "<" + (this.tagName()) + attributes + ">" + le) + ("" + (children.join(le)) + le) + ("" + indent + "</" + (this.tagName()) + ">");
}
};
ElementCollection.prototype.mount = function() {
var child, name, value, _i, _len, _ref, _ref1, _results;
this._domElement = document.createElement(this._tagName);
_ref = this._attributes;
for (name in _ref) {
value = _ref[name];
this._domElement.setAttribute(name, value);
}
ElementCollection.__super__.mount.call(this);
_ref1 = this.children;
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
child = _ref1[_i];
_results.push(child.mount());
}
return _results;
};
ElementCollection.prototype.unmount = function() {
var child, _i, _len, _ref;
_ref = this.children;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
child = _ref[_i];
child.unmount();
}
return ElementCollection.__super__.unmount.call(this);
};
ElementCollection.prototype.blur = void 0;
ElementCollection.prototype.focus = void 0;
return ElementCollection;
})(ContentEdit.Element);
ContentEdit.ResizableElement = (function(_super) {
__extends(ResizableElement, _super);
function ResizableElement(tagName, attributes) {
ResizableElement.__super__.constructor.call(this, tagName, attributes);
this._domSizeInfoElement = null;
this._aspectRatio = 1;
}
ResizableElement.prototype.aspectRatio = function() {
return this._aspectRatio;
};
ResizableElement.prototype.maxSize = function() {
var maxWidth;
maxWidth = parseInt(this.attr('data-ce-max-width') || 0);
if (!maxWidth) {
maxWidth = ContentEdit.DEFAULT_MAX_ELEMENT_WIDTH;
}
maxWidth = Math.max(maxWidth, this.size()[0]);
return [maxWidth, maxWidth * this.aspectRatio()];
};
ResizableElement.prototype.minSize = function() {
var minWidth;
minWidth = parseInt(this.attr('data-ce-min-width') || 0);
if (!minWidth) {
minWidth = ContentEdit.DEFAULT_MIN_ELEMENT_WIDTH;
}
minWidth = Math.min(minWidth, this.size()[0]);
return [minWidth, minWidth * this.aspectRatio()];
};
ResizableElement.prototype.type = function() {
return 'ResizableElement';
};
ResizableElement.prototype.mount = function() {
ResizableElement.__super__.mount.call(this);
return this._domElement.setAttribute('data-ce-size', this._getSizeInfo());
};
ResizableElement.prototype.resize = function(corner, x, y) {
if (!(this.isMounted() && this.can('resize'))) {
return;
}
return ContentEdit.Root.get().startResizing(this, corner, x, y, true);
};
ResizableElement.prototype.size = function(newSize) {
var height, maxSize, minSize, width;
if (!newSize) {
width = parseInt(this.attr('width') || 1);
height = parseInt(this.attr('height') || 1);
return [width, height];
}
newSize[0] = parseInt(newSize[0]);
newSize[1] = parseInt(newSize[1]);
minSize = this.minSize();
newSize[0] = Math.max(newSize[0], minSize[0]);
newSize[1] = Math.max(newSize[1], minSize[1]);
maxSize = this.maxSize();
newSize[0] = Math.min(newSize[0], maxSize[0]);
newSize[1] = Math.min(newSize[1], maxSize[1]);
this.attr('width', parseInt(newSize[0]));
this.attr('height', parseInt(newSize[1]));
if (this.isMounted()) {
this._domElement.style.width = "" + newSize[0] + "px";
this._domElement.style.height = "" + newSize[1] + "px";
return this._domElement.setAttribute('data-ce-size', this._getSizeInfo());
}
};
ResizableElement.prototype._onMouseDown = function(ev) {
var corner;
ResizableElement.__super__._onMouseDown.call(this, ev);
corner = this._getResizeCorner(ev.clientX, ev.clientY);
if (corner) {
return this.resize(corner, ev.clientX, ev.clientY);
} else {
clearTimeout(this._dragTimeout);
return this._dragTimeout = setTimeout((function(_this) {
return function() {
return _this.drag(ev.pageX, ev.pageY);
};
})(this), 150);
}
};
ResizableElement.prototype._onMouseMove = function(ev) {
var corner;
ResizableElement.__super__._onMouseMove.call(this);
if (!this.can('resize')) {
return;
}
this._removeCSSClass('ce-element--resize-top-left');
this._removeCSSClass('ce-element--resize-top-right');
this._removeCSSClass('ce-element--resize-bottom-left');
this._removeCSSClass('ce-element--resize-bottom-right');
corner = this._getResizeCorner(ev.clientX, ev.clientY);
if (corner) {
return this._addCSSClass("ce-element--resize-" + corner[0] + "-" + corner[1]);
}
};
ResizableElement.prototype._onMouseOut = function(ev) {
ResizableElement.__super__._onMouseOut.call(this);
this._removeCSSClass('ce-element--resize-top-left');
this._removeCSSClass('ce-element--resize-top-right');
this._removeCSSClass('ce-element--resize-bottom-left');
return this._removeCSSClass('ce-element--resize-bottom-right');
};
ResizableElement.prototype._onMouseUp = function(ev) {
ResizableElement.__super__._onMouseUp.call(this);
if (this._dragTimeout) {
return clearTimeout(this._dragTimeout);
}
};
ResizableElement.prototype._getResizeCorner = function(x, y) {
var corner, cornerSize, rect, size, _ref;
rect = this._domElement.getBoundingClientRect();
_ref = [x - rect.left, y - rect.top], x = _ref[0], y = _ref[1];
size = this.size();
cornerSize = ContentEdit.RESIZE_CORNER_SIZE;
cornerSize = Math.min(cornerSize, Math.max(parseInt(size[0] / 4), 1));
cornerSize = Math.min(cornerSize, Math.max(parseInt(size[1] / 4), 1));
corner = null;
if (x < cornerSize) {
if (y < cornerSize) {
corner = ['top', 'left'];
} else if (y > rect.height - cornerSize) {
corner = ['bottom', 'left'];
}
} else if (x > rect.width - cornerSize) {
if (y < cornerSize) {
corner = ['top', 'right'];
} else if (y > rect.height - cornerSize) {
corner = ['bottom', 'right'];
}
}
return corner;
};
ResizableElement.prototype._getSizeInfo = function() {
var size;
size = this.size();
return "w " + size[0] + " × h " + size[1];
};
return ResizableElement;
})(ContentEdit.Element);
ContentEdit.Region = (function(_super) {
__extends(Region, _super);
function Region(domElement) {
Region.__super__.constructor.call(this);
this._domElement = domElement;
this.setContent(domElement);
}
Region.prototype.domElement = function() {
return this._domElement;
};
Region.prototype.isMounted = function() {
return true;
};
Region.prototype.type = function() {
return 'Region';
};
Region.prototype.html = function(indent) {
var c, le;
if (indent == null) {
indent = '';
}
le = ContentEdit.LINE_ENDINGS;
return ((function() {
var _i, _len, _ref, _results;
_ref = this.children;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c.html(indent));
}
return _results;
}).call(this)).join(le).trim();
};
Region.prototype.setContent = function(domElementOrHTML) {
var c, child, childNode, childNodes, cls, domElement, element, tagNames, wrapper, _i, _j, _len, _len1, _ref;
domElement = domElementOrHTML;
if (domElementOrHTML.childNodes === void 0) {
wrapper = document.createElement('div');
wrapper.innerHTML = domElementOrHTML;
domElement = wrapper;
}
_ref = this.children.slice();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
child = _ref[_i];
this.detach(child);
}
tagNames = ContentEdit.TagNames.get();
childNodes = (function() {
var _j, _len1, _ref1, _results;
_ref1 = domElement.childNodes;
_results = [];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
c = _ref1[_j];
_results.push(c);
}
return _results;
})();
for (_j = 0, _len1 = childNodes.length; _j < _len1; _j++) {
childNode = childNodes[_j];
if (childNode.nodeType !== 1) {
continue;
}
if (childNode.getAttribute('data-ce-tag')) {
cls = tagNames.match(childNode.getAttribute('data-ce-tag'));
} else {
cls = tagNames.match(childNode.tagName);
}
element = cls.fromDOMElement(childNode);
domElement.removeChild(childNode);
if (element) {
this.attach(element);
}
}
return ContentEdit.Root.get().trigger('ready', this);
};
return Region;
})(ContentEdit.NodeCollection);
ContentEdit.Fixture = (function(_super) {
__extends(Fixture, _super);
function Fixture(domElement) {
var cls, element, tagNames;
Fixture.__super__.constructor.call(this);
this._domElement = domElement;
tagNames = ContentEdit.TagNames.get();
if (this._domElement.getAttribute("data-ce-tag")) {
cls = tagNames.match(this._domElement.getAttribute("data-ce-tag"));
} else {
cls = tagNames.match(this._domElement.tagName);
}
element = cls.fromDOMElement(this._domElement);
this.children = [element];
element._parent = this;
element.mount();
ContentEdit.Root.get().trigger('ready', this);
}
Fixture.prototype.domElement = function() {
return this._domElement;
};
Fixture.prototype.isMounted = function() {
return true;
};
Fixture.prototype.type = function() {
return 'Fixture';
};
Fixture.prototype.html = function(indent) {
var c, le;
if (indent == null) {
indent = '';
}
le = ContentEdit.LINE_ENDINGS;
return ((function() {
var _i, _len, _ref, _results;
_ref = this.children;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c.html(indent));
}
return _results;
}).call(this)).join(le).trim();
};
return Fixture;
})(ContentEdit.NodeCollection);
_Root = (function(_super) {
__extends(_Root, _super);
function _Root() {
this._onStopResizing = __bind(this._onStopResizing, this);
this._onResize = __bind(this._onResize, this);
this._onStopDragging = __bind(this._onStopDragging, this);
this._onDrag = __bind(this._onDrag, this);
_Root.__super__.constructor.call(this);
this._focused = null;
this._dragging = null;
this._dropTarget = null;
this._draggingDOMElement = null;
this._resizing = null;
this._resizingInit = null;
}
_Root.prototype.dragging = function() {
return this._dragging;
};
_Root.prototype.dropTarget = function() {
return this._dropTarget;
};
_Root.prototype.focused = function() {
return this._focused;
};
_Root.prototype.resizing = function() {
return this._resizing;
};
_Root.prototype.type = function() {
return 'Root';
};
_Root.prototype.cancelDragging = function() {
if (!this._dragging) {
return;
}
document.body.removeChild(this._draggingDOMElement);
document.removeEventListener('mousemove', this._onDrag);
document.removeEventListener('mouseup', this._onStopDragging);
this._dragging._removeCSSClass('ce-element--dragging');
this._dragging = null;
this._dropTarget = null;
return ContentEdit.removeCSSClass(document.body, 'ce--dragging');
};
_Root.prototype.startDragging = function(element, x, y) {
if (this._dragging) {
return;
}
this._dragging = element;
this._dragging._addCSSClass('ce-element--dragging');
this._draggingDOMElement = this._dragging.createDraggingDOMElement();
document.body.appendChild(this._draggingDOMElement);
this._draggingDOMElement.style.left = "" + x + "px";
this._draggingDOMElement.style.top = "" + y + "px";
document.addEventListener('mousemove', this._onDrag);
document.addEventListener('mouseup', this._onStopDragging);
return ContentEdit.addCSSClass(document.body, 'ce--dragging');
};
_Root.prototype._getDropPlacement = function(x, y) {
var horz, rect, vert, _ref;
if (!this._dropTarget) {
return null;
}
rect = this._dropTarget.domElement().getBoundingClientRect();
_ref = [x - rect.left, y - rect.top], x = _ref[0], y = _ref[1];
horz = 'center';
if (x < ContentEdit.DROP_EDGE_SIZE) {
horz = 'left';
} else if (x > rect.width - ContentEdit.DROP_EDGE_SIZE) {
horz = 'right';
}
vert = 'above';
if (y > rect.height / 2) {
vert = 'below';
}
return [vert, horz];
};
_Root.prototype._onDrag = function(ev) {
var placement, _ref, _ref1;
ContentSelect.Range.unselectAll();
this._draggingDOMElement.style.left = "" + ev.pageX + "px";
this._draggingDOMElement.style.top = "" + ev.pageY + "px";
if (this._dropTarget) {
placement = this._getDropPlacement(ev.clientX, ev.clientY);
this._dropTarget._removeCSSClass('ce-element--drop-above');
this._dropTarget._removeCSSClass('ce-element--drop-below');
this._dropTarget._removeCSSClass('ce-element--drop-center');
this._dropTarget._removeCSSClass('ce-element--drop-left');
this._dropTarget._removeCSSClass('ce-element--drop-right');
if (_ref = placement[0], __indexOf.call(this._dragging.constructor.placements, _ref) >= 0) {
this._dropTarget._addCSSClass("ce-element--drop-" + placement[0]);
}
if (_ref1 = placement[1], __indexOf.call(this._dragging.constructor.placements, _ref1) >= 0) {
return this._dropTarget._addCSSClass("ce-element--drop-" + placement[1]);
}
}
};
_Root.prototype._onStopDragging = function(ev) {
var placement;
placement = this._getDropPlacement(ev.clientX, ev.clientY);
this._dragging.drop(this._dropTarget, placement);
return this.cancelDragging();
};
_Root.prototype.startResizing = function(element, corner, x, y, fixed) {
var measureDom, parentDom;
if (this._resizing) {
return;
}
this._resizing = element;
this._resizingInit = {
corner: corner,
fixed: fixed,
origin: [x, y],
size: element.size()
};
this._resizing._addCSSClass('ce-element--resizing');
parentDom = this._resizing.parent().domElement();
measureDom = document.createElement('div');
measureDom.setAttribute('class', 'ce-measure');
parentDom.appendChild(measureDom);
this._resizingParentWidth = measureDom.getBoundingClientRect().width;
parentDom.removeChild(measureDom);
document.addEventListener('mousemove', this._onResize);
document.addEventListener('mouseup', this._onStopResizing);
return ContentEdit.addCSSClass(document.body, 'ce--resizing');
};
_Root.prototype._onResize = function(ev) {
var height, width, x, y;
ContentSelect.Range.unselectAll();
x = this._resizingInit.origin[0] - ev.clientX;
if (this._resizingInit.corner[1] === 'right') {
x = -x;
}
width = this._resizingInit.size[0] + x;
width = Math.min(width, this._resizingParentWidth);
if (this._resizingInit.fixed) {
height = width * this._resizing.aspectRatio();
} else {
y = this._resizingInit.origin[1] - ev.clientY;
if (this._resizingInit.corner[0] === 'bottom') {
y = -y;
}
height = this._resizingInit.size[1] + y;
}
return this._resizing.size([width, height]);
};
_Root.prototype._onStopResizing = function(ev) {
document.removeEventListener('mousemove', this._onResize);
document.removeEventListener('mouseup', this._onStopResizing);
this._resizing._removeCSSClass('ce-element--resizing');
this._resizing = null;
this._resizingInit = null;
this._resizingParentWidth = null;
return ContentEdit.removeCSSClass(document.body, 'ce--resizing');
};
return _Root;
})(ContentEdit.Node);
ContentEdit.Root = (function() {
var instance;
function Root() {}
instance = null;
Root.get = function() {
return instance != null ? instance : instance = new _Root();
};
return Root;
})();
ContentEdit.Static = (function(_super) {
__extends(Static, _super);
function Static(tagName, attributes, content) {
Static.__super__.constructor.call(this, tagName, attributes);
this._content = content;
}
Static.prototype.cssTypeName = function() {
return 'static';
};
Static.prototype.type = function() {
return 'Static';
};
Static.prototype.typeName = function() {
return 'Static';
};
Static.prototype.createDraggingDOMElement = function() {
var helper, text;
if (!this.isMounted()) {
return;
}
helper = Static.__super__.createDraggingDOMElement.call(this);
text = this._domElement.textContent;
if (text.length > ContentEdit.HELPER_CHAR_LIMIT) {
text = text.substr(0, ContentEdit.HELPER_CHAR_LIMIT);
}
helper.innerHTML = text;
return helper;
};
Static.prototype.html = function(indent) {
if (indent == null) {
indent = '';
}
if (HTMLString.Tag.SELF_CLOSING[this._tagName]) {
return "" + indent + "<" + this._tagName + (this._attributesToString()) + ">";
}
return ("" + indent + "<" + this._tagName + (this._attributesToString()) + ">") + ("" + this._content) + ("" + indent + "</" + this._tagName + ">");
};
Static.prototype.mount = function() {
var name, value, _ref;
this._domElement = document.createElement(this._tagName);
_ref = this._attributes;
for (name in _ref) {
value = _ref[name];
this._domElement.setAttribute(name, value);
}
this._domElement.innerHTML = this._content;
return Static.__super__.mount.call(this);
};
Static.prototype.blur = void 0;
Static.prototype.focus = void 0;
Static.prototype._onMouseDown = function(ev) {
Static.__super__._onMouseDown.call(this, ev);
if (this.attr('data-ce-moveable') !== void 0) {
clearTimeout(this._dragTimeout);
return this._dragTimeout = setTimeout((function(_this) {
return function() {
return _this.drag(ev.pageX, ev.pageY);
};
})(this), 150);
}
};
Static.prototype._onMouseOver = function(ev) {
Static.__super__._onMouseOver.call(this, ev);
return this._removeCSSClass('ce-element--over');
};
Static.prototype._onMouseUp = function(ev) {
Static.__super__._onMouseUp.call(this, ev);
if (this._dragTimeout) {
return clearTimeout(this._dragTimeout);
}
};
Static.droppers = {
'Static': ContentEdit.Element._dropVert
};
Static.fromDOMElement = function(domElement) {
return new this(domElement.tagName, this.getDOMElementAttributes(domElement), domElement.innerHTML);
};
return Static;
})(ContentEdit.Element);
ContentEdit.TagNames.get().register(ContentEdit.Static, 'static');
ContentEdit.Text = (function(_super) {
__extends(Text, _super);
function Text(tagName, attributes, content) {
Text.__super__.constructor.call(this, tagName, attributes);
if (content instanceof HTMLString.String) {
this.content = content;
} else {
if (ContentEdit.TRIM_WHITESPACE) {
this.content = new HTMLString.String(content).trim();
} else {
this.content = new HTMLString.String(content, true);
}
}
}
Text.prototype.cssTypeName = function() {
return 'text';
};
Text.prototype.type = function() {
return 'Text';
};
Text.prototype.typeName = function() {
return 'Text';
};
Text.prototype.blur = function() {
if (this.isMounted()) {
this._syncContent();
}
if (this.content.isWhitespace() && this.can('remove')) {
if (this.parent()) {
this.parent().detach(this);
}
} else if (this.isMounted()) {
if (!document.documentMode && !/Edge/.test(navigator.userAgent)) {
this._domElement.blur();
}
this._domElement.removeAttribute('contenteditable');
}
return Text.__super__.blur.call(this);
};
Text.prototype.createDraggingDOMElement = function() {
var helper, text;
if (!this.isMounted()) {
return;
}
helper = Text.__super__.createDraggingDOMElement.call(this);
text = HTMLString.String.encode(this._domElement.textContent);
if (text.length > ContentEdit.HELPER_CHAR_LIMIT) {
text = text.substr(0, ContentEdit.HELPER_CHAR_LIMIT);
}
helper.innerHTML = text;
return helper;
};
Text.prototype.drag = function(x, y) {
this.storeState();
this._domElement.removeAttribute('contenteditable');
return Text.__super__.drag.call(this, x, y);
};
Text.prototype.drop = function(element, placement) {
Text.__super__.drop.call(this, element, placement);
return this.restoreState();
};
Text.prototype.focus = function(supressDOMFocus) {
if (this.isMounted()) {
this._domElement.setAttribute('contenteditable', '');
}
return Text.__super__.focus.call(this, supressDOMFocus);
};
Text.prototype.html = function(indent) {
var attributes, content, le;
if (indent == null) {
indent = '';
}
if (!this._lastCached || this._lastCached < this._modified) {
if (ContentEdit.TRIM_WHITESPACE) {
content = this.content.copy().trim();
} else {
content = this.content.copy();
}
content.optimize();
this._lastCached = Date.now();
this._cached = content.html();
}
if (this.isFixed()) {
return this._cached;
} else {
le = ContentEdit.LINE_ENDINGS;
attributes = this._attributesToString();
return ("" + indent + "<" + this._tagName + attributes + ">" + le) + ("" + indent + ContentEdit.INDENT + this._cached + le) + ("" + indent + "</" + this._tagName + ">");
}
};
Text.prototype.mount = function() {
var name, value, _ref;
this._domElement = document.createElement(this._tagName);
_ref = this._attributes;
for (name in _ref) {
value = _ref[name];
this._domElement.setAttribute(name, value);
}
this.updateInnerHTML();
return Text.__super__.mount.call(this);
};
Text.prototype.restoreState = function() {
if (!this._savedSelection) {
return;
}
if (!(this.isMounted() && this.isFocused())) {
this._savedSelection = void 0;
return;
}
this._domElement.setAttribute('contenteditable', '');
this._addCSSClass('ce-element--focused');
if (document.activeElement !== this.domElement()) {
this.domElement().focus();
}
this._savedSelection.select(this._domElement);
return this._savedSelection = void 0;
};
Text.prototype.selection = function(selection) {
if (selection === void 0) {
if (this.isMounted()) {
return ContentSelect.Range.query(this._domElement);
} else {
return new ContentSelect.Range(0, 0);
}
}
return selection.select(this._domElement);
};
Text.prototype.storeState = function() {
if (!(this.isMounted() && this.isFocused())) {
return;
}
return this._savedSelection = ContentSelect.Range.query(this._domElement);
};
Text.prototype.unmount = function() {
this._domElement.removeAttribute('contenteditable');
return Text.__super__.unmount.call(this);
};
Text.prototype.updateInnerHTML = function() {
this._domElement.innerHTML = this.content.html();
ContentSelect.Range.prepareElement(this._domElement);
return this._flagIfEmpty();
};
Text.prototype._onKeyDown = function(ev) {
switch (ev.keyCode) {
case 40:
return this._keyDown(ev);
case 37:
return this._keyLeft(ev);
case 39:
return this._keyRight(ev);
case 38:
return this._keyUp(ev);
case 9:
return this._keyTab(ev);
case 8:
return this._keyBack(ev);
case 46:
return this._keyDelete(ev);
case 13:
return this._keyReturn(ev);
}
};
Text.prototype._onKeyUp = function(ev) {
Text.__super__._onKeyUp.call(this, ev);
return this._syncContent();
};
Text.prototype._onMouseDown = function(ev) {
Text.__super__._onMouseDown.call(this, ev);
clearTimeout(this._dragTimeout);
this._dragTimeout = setTimeout((function(_this) {
return function() {
return _this.drag(ev.pageX, ev.pageY);
};
})(this), ContentEdit.DRAG_HOLD_DURATION);
if (this.content.length() === 0 && ContentEdit.Root.get().focused() === this) {
ev.preventDefault();
if (document.activeElement !== this._domElement) {
this._domElement.focus();
}
return new ContentSelect.Range(0, 0).select(this._domElement);
}
};
Text.prototype._onMouseMove = function(ev) {
if (this._dragTimeout) {
clearTimeout(this._dragTimeout);
}
return Text.__super__._onMouseMove.call(this, ev);
};
Text.prototype._onMouseOut = function(ev) {
if (this._dragTimeout) {
clearTimeout(this._dragTimeout);
}
return Text.__super__._onMouseOut.call(this, ev);
};
Text.prototype._onMouseUp = function(ev) {
if (this._dragTimeout) {
clearTimeout(this._dragTimeout);
}
return Text.__super__._onMouseUp.call(this, ev);
};
Text.prototype._keyBack = function(ev) {
var previous, selection;
selection = ContentSelect.Range.query(this._domElement);
if (!(selection.get()[0] === 0 && selection.isCollapsed())) {
return;
}
ev.preventDefault();
previous = this.previousContent();
this._syncContent();
if (previous) {
return previous.merge(this);
}
};
Text.prototype._keyDelete = function(ev) {
var next, selection;
selection = ContentSelect.Range.query(this._domElement);
if (!(this._atEnd(selection) && selection.isCollapsed())) {
return;
}
ev.preventDefault();
next = this.nextContent();
if (next) {
return this.merge(next);
}
};
Text.prototype._keyDown = function(ev) {
return this._keyRight(ev);
};
Text.prototype._keyLeft = function(ev) {
var previous, selection;
selection = ContentSelect.Range.query(this._domElement);
if (!(selection.get()[0] === 0 && selection.isCollapsed())) {
return;
}
ev.preventDefault();
previous = this.previousContent();
if (previous) {
previous.focus();
selection = new ContentSelect.Range(previous.content.length(), previous.content.length());
return selection.select(previous.domElement());
} else {
return ContentEdit.Root.get().trigger('previous-region', this.closest(function(node) {
return node.type() === 'Fixture' || node.type() === 'Region';
}));
}
};
Text.prototype._keyReturn = function(ev) {
var element, insertAt, lineBreakStr, selection, tail, tip;
ev.preventDefault();
if (this.content.isWhitespace() && !ev.shiftKey ^ ContentEdit.PREFER_LINE_BREAKS) {
return;
}
selection = ContentSelect.Range.query(this._domElement);
tip = this.content.substring(0, selection.get()[0]);
tail = this.content.substring(selection.get()[1]);
if (ev.shiftKey ^ ContentEdit.PREFER_LINE_BREAKS) {
insertAt = selection.get()[0];
lineBreakStr = '<br>';
if (this.content.length() === insertAt) {
if (this.content.length() === 0 || !this.content.characters[insertAt - 1].isTag('br')) {
lineBreakStr = '<br><br>';
}
}
this.content = this.content.insert(insertAt, new HTMLString.String(lineBreakStr, true), true);
this.updateInnerHTML();
insertAt += 1;
selection = new ContentSelect.Range(insertAt, insertAt);
selection.select(this.domElement());
this.taint();
return;
}
if (!this.can('spawn')) {
return;
}
this.content = tip.trim();
this.updateInnerHTML();
element = new this.constructor('p', {}, tail.trim());
this.parent().attach(element, this.parent().children.indexOf(this) + 1);
if (tip.length()) {
element.focus();
selection = new ContentSelect.Range(0, 0);
selection.select(element.domElement());
} else {
selection = new ContentSelect.Range(0, tip.length());
selection.select(this._domElement);
}
return this.taint();
};
Text.prototype._keyRight = function(ev) {
var next, selection;
selection = ContentSelect.Range.query(this._domElement);
if (!(this._atEnd(selection) && selection.isCollapsed())) {
return;
}
ev.preventDefault();
next = this.nextContent();
if (next) {
next.focus();
selection = new ContentSelect.Range(0, 0);
return selection.select(next.domElement());
} else {
return ContentEdit.Root.get().trigger('next-region', this.closest(function(node) {
return node.type() === 'Fixture' || node.type() === 'Region';
}));
}
};
Text.prototype._keyTab = function(ev) {
ev.preventDefault();
if (this.isFixed()) {
if (ev.shiftKey) {
return ContentEdit.Root.get().trigger('previous-region', this.closest(function(node) {
return node.type() === 'Fixture' || node.type() === 'Region';
}));
} else {
return ContentEdit.Root.get().trigger('next-region', this.closest(function(node) {
return node.type() === 'Fixture' || node.type() === 'Region';
}));
}
}
};
Text.prototype._keyUp = function(ev) {
return this._keyLeft(ev);
};
Text.prototype._atEnd = function(selection) {
return selection.get()[0] >= this.content.length();
};
Text.prototype._flagIfEmpty = function() {
if (this.content.length() === 0) {
return this._addCSSClass('ce-element--empty');
} else {
return this._removeCSSClass('ce-element--empty');
}
};
Text.prototype._syncContent = function(ev) {
var newSnapshot, snapshot;
snapshot = this.content.html();
this.content = new HTMLString.String(this._domElement.innerHTML, this.content.preserveWhitespace());
newSnapshot = this.content.html();
if (snapshot !== newSnapshot) {
this.taint();
}
return this._flagIfEmpty();
};
Text.droppers = {
'Static': ContentEdit.Element._dropVert,
'Text': ContentEdit.Element._dropVert
};
Text.mergers = {
'Text': function(element, target) {
var offset;
offset = target.content.length();
if (element.content.length()) {
target.content = target.content.concat(element.content);
}
if (target.isMounted()) {
target.updateInnerHTML();
}
target.focus();
new ContentSelect.Range(offset, offset).select(target._domElement);
if (element.parent()) {
element.parent().detach(element);
}
return target.taint();
}
};
Text.fromDOMElement = function(domElement) {
return new this(domElement.tagName, this.getDOMElementAttributes(domElement), domElement.innerHTML.replace(/^\s+|\s+$/g, ''));
};
return Text;
})(ContentEdit.Element);
ContentEdit.TagNames.get().register(ContentEdit.Text, 'address', 'blockquote', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p');
ContentEdit.PreText = (function(_super) {
__extends(PreText, _super);
PreText.TAB_INDENT = ' ';
function PreText(tagName, attributes, content) {
if (content instanceof HTMLString.String) {
this.content = content;
} else {
this.content = new HTMLString.String(content, true);
}
ContentEdit.Element.call(this, tagName, attributes);
}
PreText.prototype.cssTypeName = function() {
return 'pre-text';
};
PreText.prototype.type = function() {
return 'PreText';
};
PreText.prototype.typeName = function() {
return 'Preformatted';
};
PreText.prototype.blur = function() {
if (this.isMounted()) {
this._domElement.innerHTML = this.content.html();
}
return PreText.__super__.blur.call(this);
};
PreText.prototype.html = function(indent) {
var content;
if (indent == null) {
indent = '';
}
if (!this._lastCached || this._lastCached < this._modified) {
content = this.content.copy();
content.optimize();
this._lastCached = Date.now();
this._cached = content.html();
}
return ("" + indent + "<" + this._tagName + (this._attributesToString()) + ">") + ("" + this._cached + "</" + this._tagName + ">");
};
PreText.prototype.updateInnerHTML = function() {
var html;
html = this.content.html();
this._domElement.innerHTML = html;
this._ensureEndZWS();
ContentSelect.Range.prepareElement(this._domElement);
return this._flagIfEmpty();
};
PreText.prototype._keyBack = function(ev) {
var selection;
selection = ContentSelect.Range.query(this._domElement);
if (selection.get()[0] <= this.content.length()) {
return PreText.__super__._keyBack.call(this, ev);
}
selection.set(this.content.length(), this.content.length());
return selection.select(this._domElement);
};
PreText.prototype._keyReturn = function(ev) {
var cursor, selection, tail, tip;
ev.preventDefault();
selection = ContentSelect.Range.query(this._domElement);
cursor = selection.get()[0] + 1;
if (selection.get()[0] === 0 && selection.isCollapsed()) {
this.content = new HTMLString.String('\n', true).concat(this.content);
} else if (this._atEnd(selection) && selection.isCollapsed()) {
this.content = this.content.concat(new HTMLString.String('\n', true));
} else if (selection.get()[0] === 0 && selection.get()[1] === this.content.length()) {
this.content = new HTMLString.String('\n', true);
cursor = 0;
} else {
tip = this.content.substring(0, selection.get()[0]);
tail = this.content.substring(selection.get()[1]);
this.content = tip.concat(new HTMLString.String('\n', true), tail);
}
this.updateInnerHTML();
selection.set(cursor, cursor);
selection.select(this._domElement);
return this.taint();
};
PreText.prototype._keyTab = function(ev) {
var blockLength, c, charIndex, endLine, firstLineShift, i, indentHTML, indentLength, indentText, j, line, lineLength, lines, selection, selectionLength, selectionOffset, startLine, tail, tip, _i, _j, _k, _l, _len, _len1, _ref;
ev.preventDefault();
blockLength = this.content.length();
indentText = ContentEdit.PreText.TAB_INDENT;
indentLength = indentText.length;
lines = this.content.split('\n');
selection = this.selection().get();
selection[0] = Math.min(selection[0], blockLength);
selection[1] = Math.min(selection[1], blockLength);
charIndex = 0;
startLine = -1;
endLine = -1;
for (i = _i = 0, _len = lines.length; _i < _len; i = ++_i) {
line = lines[i];
lineLength = line.length() + 1;
if (selection[0] < charIndex + lineLength) {
if (startLine === -1) {
startLine = i;
}
}
if (selection[1] < charIndex + lineLength) {
if (endLine === -1) {
endLine = i;
}
}
if (startLine > -1 && endLine > -1) {
break;
}
charIndex += lineLength;
}
if (startLine === endLine) {
indentLength -= (selection[0] - charIndex) % indentLength;
indentHTML = new HTMLString.String(Array(indentLength + 1).join(' '), true);
tip = lines[startLine].substring(0, selection[0] - charIndex);
tail = lines[startLine].substring(selection[1] - charIndex);
lines[startLine] = tip.concat(indentHTML, tail);
selectionOffset = indentLength;
} else {
if (ev.shiftKey) {
firstLineShift = 0;
for (i = _j = startLine; startLine <= endLine ? _j <= endLine : _j >= endLine; i = startLine <= endLine ? ++_j : --_j) {
_ref = lines[i].characters.slice();
for (j = _k = 0, _len1 = _ref.length; _k < _len1; j = ++_k) {
c = _ref[j];
if (j > (indentLength - 1)) {
break;
}
if (!c.isWhitespace()) {
break;
}
lines[i].characters.shift();
}
if (i === startLine) {
firstLineShift = j;
}
}
selectionOffset = Math.max(-indentLength, -firstLineShift);
} else {
indentHTML = new HTMLString.String(indentText, true);
for (i = _l = startLine; startLine <= endLine ? _l <= endLine : _l >= endLine; i = startLine <= endLine ? ++_l : --_l) {
lines[i] = indentHTML.concat(lines[i]);
}
selectionOffset = indentLength;
}
}
this.content = HTMLString.String.join(new HTMLString.String('\n', true), lines);
this.updateInnerHTML();
selectionLength = this.content.length() - blockLength;
return new ContentSelect.Range(selection[0] + selectionOffset, selection[1] + selectionLength).select(this._domElement);
};
PreText.prototype._syncContent = function(ev) {
var newSnapshot, snapshot;
this._ensureEndZWS();
snapshot = this.content.html();
this.content = new HTMLString.String(this._domElement.innerHTML.replace(/\u200B$/g, ''), this.content.preserveWhitespace());
newSnapshot = this.content.html();
if (snapshot !== newSnapshot) {
this.taint();
}
return this._flagIfEmpty();
};
PreText.prototype._ensureEndZWS = function() {
var html, _addZWS;
if (!this._domElement.lastChild) {
return;
}
html = this._domElement.innerHTML;
if (html[html.length - 1] === '\u200B') {
if (html.indexOf('\u200B') < html.length - 1) {
return;
}
}
_addZWS = (function(_this) {
return function() {
if (html.indexOf('\u200B') > -1) {
_this._domElement.innerHTML = html.replace(/\u200B/g, '');
}
return _this._domElement.lastChild.textContent += '\u200B';
};
})(this);
if (this._savedSelection) {
return _addZWS();
} else {
this.storeState();
_addZWS();
return this.restoreState();
}
};
PreText.droppers = {
'PreText': ContentEdit.Element._dropVert,
'Static': ContentEdit.Element._dropVert,
'Text': ContentEdit.Element._dropVert
};
PreText.mergers = {};
PreText.fromDOMElement = function(domElement) {
return new this(domElement.tagName, this.getDOMElementAttributes(domElement), domElement.innerHTML);
};
return PreText;
})(ContentEdit.Text);
ContentEdit.TagNames.get().register(ContentEdit.PreText, 'pre');
ContentEdit.Image = (function(_super) {
__extends(Image, _super);
function Image(attributes, a) {
var size;
Image.__super__.constructor.call(this, 'img', attributes);
this.a = a ? a : null;
size = this.size();
this._aspectRatio = size[1] / size[0];
}
Image.prototype.cssTypeName = function() {
return 'image';
};
Image.prototype.type = function() {
return 'Image';
};
Image.prototype.typeName = function() {
return 'Image';
};
Image.prototype.createDraggingDOMElement = function() {
var helper;
if (!this.isMounted()) {
return;
}
helper = Image.__super__.createDraggingDOMElement.call(this);
helper.style.backgroundImage = "url('" + this._attributes['src'] + "')";
return helper;
};
Image.prototype.html = function(indent) {
var attributes, img, le;
if (indent == null) {
indent = '';
}
img = "" + indent + "<img" + (this._attributesToString()) + ">";
if (this.a) {
le = ContentEdit.LINE_ENDINGS;
attributes = ContentEdit.attributesToString(this.a);
attributes = "" + attributes + " data-ce-tag=\"img\"";
return ("" + indent + "<a " + attributes + ">" + le) + ("" + ContentEdit.INDENT + img + le) + ("" + indent + "</a>");
} else {
return img;
}
};
Image.prototype.mount = function() {
var classes, style;
this._domElement = document.createElement('div');
classes = '';
if (this.a && this.a['class']) {
classes += ' ' + this.a['class'];
}
if (this._attributes['class']) {
classes += ' ' + this._attributes['class'];
}
this._domElement.setAttribute('class', classes);
style = this._attributes['style'] ? this._attributes['style'] : '';
style += "background-image:url('" + this._attributes['src'] + "');";
if (this._attributes['width']) {
style += "width:" + this._attributes['width'] + "px;";
}
if (this._attributes['height']) {
style += "height:" + this._attributes['height'] + "px;";
}
this._domElement.setAttribute('style', style);
return Image.__super__.mount.call(this);
};
Image.prototype.unmount = function() {
var domElement, wrapper;
if (this.isFixed()) {
wrapper = document.createElement('div');
wrapper.innerHTML = this.html();
domElement = wrapper.querySelector('a, img');
this._domElement.parentNode.replaceChild(domElement, this._domElement);
this._domElement = domElement;
}
return Image.__super__.unmount.call(this);
};
Image.droppers = {
'Image': ContentEdit.Element._dropBoth,
'PreText': ContentEdit.Element._dropBoth,
'Static': ContentEdit.Element._dropBoth,
'Text': ContentEdit.Element._dropBoth
};
Image.placements = ['above', 'below', 'left', 'right', 'center'];
Image.fromDOMElement = function(domElement) {
var a, attributes, c, childNode, childNodes, _i, _len;
a = null;
if (domElement.tagName.toLowerCase() === 'a') {
a = this.getDOMElementAttributes(domElement);
childNodes = (function() {
var _i, _len, _ref, _results;
_ref = domElement.childNodes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c);
}
return _results;
})();
for (_i = 0, _len = childNodes.length; _i < _len; _i++) {
childNode = childNodes[_i];
if (childNode.nodeType === 1 && childNode.tagName.toLowerCase() === 'img') {
domElement = childNode;
break;
}
}
if (domElement.tagName.toLowerCase() === 'a') {
domElement = document.createElement('img');
}
}
attributes = this.getDOMElementAttributes(domElement);
if (attributes['width'] === void 0) {
if (attributes['height'] === void 0) {
attributes['width'] = domElement.naturalWidth;
} else {
attributes['width'] = domElement.clientWidth;
}
}
if (attributes['height'] === void 0) {
if (attributes['width'] === void 0) {
attributes['height'] = domElement.naturalHeight;
} else {
attributes['height'] = domElement.clientHeight;
}
}
return new this(attributes, a);
};
return Image;
})(ContentEdit.ResizableElement);
ContentEdit.TagNames.get().register(ContentEdit.Image, 'img');
ContentEdit.Video = (function(_super) {
__extends(Video, _super);
function Video(tagName, attributes, sources) {
var size;
if (sources == null) {
sources = [];
}
Video.__super__.constructor.call(this, tagName, attributes);
this.sources = sources;
size = this.size();
this._aspectRatio = size[1] / size[0];
}
Video.prototype.cssTypeName = function() {
return 'video';
};
Video.prototype.type = function() {
return 'Video';
};
Video.prototype.typeName = function() {
return 'Video';
};
Video.prototype._title = function() {
var src;
src = '';
if (this.attr('src')) {
src = this.attr('src');
} else {
if (this.sources.length) {
src = this.sources[0]['src'];
}
}
if (!src) {
src = 'No video source set';
}
if (src.length > 80) {
src = src.substr(0, 80) + '...';
}
return src;
};
Video.prototype.createDraggingDOMElement = function() {
var helper;
if (!this.isMounted()) {
return;
}
helper = Video.__super__.createDraggingDOMElement.call(this);
helper.innerHTML = this._title();
return helper;
};
Video.prototype.html = function(indent) {
var attributes, le, source, sourceStrings, _i, _len, _ref;
if (indent == null) {
indent = '';
}
le = ContentEdit.LINE_ENDINGS;
if (this.tagName() === 'video') {
sourceStrings = [];
_ref = this.sources;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
source = _ref[_i];
attributes = ContentEdit.attributesToString(source);
sourceStrings.push("" + indent + ContentEdit.INDENT + "<source " + attributes + ">");
}
return ("" + indent + "<video" + (this._attributesToString()) + ">" + le) + sourceStrings.join(le) + ("" + le + indent + "</video>");
} else {
return ("" + indent + "<" + this._tagName + (this._attributesToString()) + ">") + ("</" + this._tagName + ">");
}
};
Video.prototype.mount = function() {
var style;
this._domElement = document.createElement('div');
if (this.a && this.a['class']) {
this._domElement.setAttribute('class', this.a['class']);
} else if (this._attributes['class']) {
this._domElement.setAttribute('class', this._attributes['class']);
}
style = this._attributes['style'] ? this._attributes['style'] : '';
if (this._attributes['width']) {
style += "width:" + this._attributes['width'] + "px;";
}
if (this._attributes['height']) {
style += "height:" + this._attributes['height'] + "px;";
}
this._domElement.setAttribute('style', style);
this._domElement.setAttribute('data-ce-title', this._title());
return Video.__super__.mount.call(this);
};
Video.prototype.unmount = function() {
var domElement, wrapper;
if (this.isFixed()) {
wrapper = document.createElement('div');
wrapper.innerHTML = this.html();
domElement = wrapper.querySelector('iframe');
this._domElement.parentNode.replaceChild(domElement, this._domElement);
this._domElement = domElement;
}
return Video.__super__.unmount.call(this);
};
Video.droppers = {
'Image': ContentEdit.Element._dropBoth,
'PreText': ContentEdit.Element._dropBoth,
'Static': ContentEdit.Element._dropBoth,
'Text': ContentEdit.Element._dropBoth,
'Video': ContentEdit.Element._dropBoth
};
Video.placements = ['above', 'below', 'left', 'right', 'center'];
Video.fromDOMElement = function(domElement) {
var c, childNode, childNodes, sources, _i, _len;
childNodes = (function() {
var _i, _len, _ref, _results;
_ref = domElement.childNodes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c);
}
return _results;
})();
sources = [];
for (_i = 0, _len = childNodes.length; _i < _len; _i++) {
childNode = childNodes[_i];
if (childNode.nodeType === 1 && childNode.tagName.toLowerCase() === 'source') {
sources.push(this.getDOMElementAttributes(childNode));
}
}
return new this(domElement.tagName, this.getDOMElementAttributes(domElement), sources);
};
return Video;
})(ContentEdit.ResizableElement);
ContentEdit.TagNames.get().register(ContentEdit.Video, 'iframe', 'video');
ContentEdit.List = (function(_super) {
__extends(List, _super);
function List(tagName, attributes) {
List.__super__.constructor.call(this, tagName, attributes);
}
List.prototype.cssTypeName = function() {
return 'list';
};
List.prototype.type = function() {
return 'List';
};
List.prototype.typeName = function() {
return 'List';
};
List.prototype._onMouseOver = function(ev) {
if (this.parent().type() === 'ListItem') {
return;
}
List.__super__._onMouseOver.call(this, ev);
return this._removeCSSClass('ce-element--over');
};
List.droppers = {
'Image': ContentEdit.Element._dropBoth,
'List': ContentEdit.Element._dropVert,
'PreText': ContentEdit.Element._dropVert,
'Static': ContentEdit.Element._dropVert,
'Text': ContentEdit.Element._dropVert,
'Video': ContentEdit.Element._dropBoth
};
List.fromDOMElement = function(domElement) {
var c, childNode, childNodes, list, _i, _len;
list = new this(domElement.tagName, this.getDOMElementAttributes(domElement));
childNodes = (function() {
var _i, _len, _ref, _results;
_ref = domElement.childNodes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c);
}
return _results;
})();
for (_i = 0, _len = childNodes.length; _i < _len; _i++) {
childNode = childNodes[_i];
if (childNode.nodeType !== 1) {
continue;
}
if (childNode.tagName.toLowerCase() !== 'li') {
continue;
}
list.attach(ContentEdit.ListItem.fromDOMElement(childNode));
}
if (list.children.length === 0) {
return null;
}
return list;
};
return List;
})(ContentEdit.ElementCollection);
ContentEdit.TagNames.get().register(ContentEdit.List, 'ol', 'ul');
ContentEdit.ListItem = (function(_super) {
__extends(ListItem, _super);
function ListItem(attributes) {
ListItem.__super__.constructor.call(this, 'li', attributes);
this._behaviours['indent'] = true;
}
ListItem.prototype.cssTypeName = function() {
return 'list-item';
};
ListItem.prototype.list = function() {
if (this.children.length === 2) {
return this.children[1];
}
return null;
};
ListItem.prototype.listItemText = function() {
if (this.children.length > 0) {
return this.children[0];
}
return null;
};
ListItem.prototype.type = function() {
return 'ListItem';
};
ListItem.prototype.html = function(indent) {
var lines;
if (indent == null) {
indent = '';
}
lines = ["" + indent + "<li" + (this._attributesToString()) + ">"];
if (this.listItemText()) {
lines.push(this.listItemText().html(indent + ContentEdit.INDENT));
}
if (this.list()) {
lines.push(this.list().html(indent + ContentEdit.INDENT));
}
lines.push("" + indent + "</li>");
return lines.join(ContentEdit.LINE_ENDINGS);
};
ListItem.prototype.indent = function() {
var sibling;
if (!this.can('indent')) {
return;
}
if (this.parent().children.indexOf(this) === 0) {
return;
}
sibling = this.previousSibling();
if (!sibling.list()) {
sibling.attach(new ContentEdit.List(sibling.parent().tagName()));
}
this.listItemText().storeState();
this.parent().detach(this);
sibling.list().attach(this);
return this.listItemText().restoreState();
};
ListItem.prototype.remove = function() {
var child, i, index, _i, _len, _ref;
if (!this.parent()) {
return;
}
index = this.parent().children.indexOf(this);
if (this.list()) {
_ref = this.list().children.slice();
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
child = _ref[i];
child.parent().detach(child);
this.parent().attach(child, i + index);
}
}
return this.parent().detach(this);
};
ListItem.prototype.unindent = function() {
var child, grandParent, i, itemIndex, list, parent, parentIndex, selection, sibling, siblings, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1;
if (!this.can('indent')) {
return;
}
parent = this.parent();
grandParent = parent.parent();
siblings = parent.children.slice(parent.children.indexOf(this) + 1, parent.children.length);
if (grandParent.type() === 'ListItem') {
this.listItemText().storeState();
parent.detach(this);
grandParent.parent().attach(this, grandParent.parent().children.indexOf(grandParent) + 1);
if (siblings.length && !this.list()) {
this.attach(new ContentEdit.List(parent.tagName()));
}
for (_i = 0, _len = siblings.length; _i < _len; _i++) {
sibling = siblings[_i];
sibling.parent().detach(sibling);
this.list().attach(sibling);
}
return this.listItemText().restoreState();
} else {
text = new ContentEdit.Text('p', this.attr('class') ? {
'class': this.attr('class')
} : {}, this.listItemText().content);
selection = null;
if (this.listItemText().isFocused()) {
selection = ContentSelect.Range.query(this.listItemText().domElement());
}
parentIndex = grandParent.children.indexOf(parent);
itemIndex = parent.children.indexOf(this);
if (itemIndex === 0) {
list = null;
if (parent.children.length === 1) {
if (this.list()) {
list = new ContentEdit.List(parent.tagName());
}
grandParent.detach(parent);
} else {
parent.detach(this);
}
grandParent.attach(text, parentIndex);
if (list) {
grandParent.attach(list, parentIndex + 1);
}
if (this.list()) {
_ref = this.list().children.slice();
for (i = _j = 0, _len1 = _ref.length; _j < _len1; i = ++_j) {
child = _ref[i];
child.parent().detach(child);
if (list) {
list.attach(child);
} else {
parent.attach(child, i);
}
}
}
} else if (itemIndex === parent.children.length - 1) {
parent.detach(this);
grandParent.attach(text, parentIndex + 1);
if (this.list()) {
grandParent.attach(this.list(), parentIndex + 2);
}
} else {
parent.detach(this);
grandParent.attach(text, parentIndex + 1);
list = new ContentEdit.List(parent.tagName());
grandParent.attach(list, parentIndex + 2);
if (this.list()) {
_ref1 = this.list().children.slice();
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
child = _ref1[_k];
child.parent().detach(child);
list.attach(child);
}
}
for (_l = 0, _len3 = siblings.length; _l < _len3; _l++) {
sibling = siblings[_l];
sibling.parent().detach(sibling);
list.attach(sibling);
}
}
if (selection) {
text.focus();
return selection.select(text.domElement());
}
}
};
ListItem.prototype._onMouseOver = function(ev) {
ListItem.__super__._onMouseOver.call(this, ev);
return this._removeCSSClass('ce-element--over');
};
ListItem.prototype._addDOMEventListeners = function() {};
ListItem.prototype._removeDOMEventListners = function() {};
ListItem.fromDOMElement = function(domElement) {
var childNode, content, listDOMElement, listElement, listItem, listItemText, _i, _len, _ref, _ref1;
listItem = new this(this.getDOMElementAttributes(domElement));
content = '';
listDOMElement = null;
_ref = domElement.childNodes;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
childNode = _ref[_i];
if (childNode.nodeType === 1) {
if ((_ref1 = childNode.tagName.toLowerCase()) === 'ul' || _ref1 === 'ol' || _ref1 === 'li') {
if (!listDOMElement) {
listDOMElement = childNode;
}
} else {
content += childNode.outerHTML;
}
} else {
content += HTMLString.String.encode(childNode.textContent);
}
}
content = content.replace(/^\s+|\s+$/g, '');
listItemText = new ContentEdit.ListItemText(content);
listItem.attach(listItemText);
if (listDOMElement) {
listElement = ContentEdit.List.fromDOMElement(listDOMElement);
listItem.attach(listElement);
}
return listItem;
};
return ListItem;
})(ContentEdit.ElementCollection);
ContentEdit.ListItemText = (function(_super) {
__extends(ListItemText, _super);
function ListItemText(content) {
ListItemText.__super__.constructor.call(this, 'div', {}, content);
}
ListItemText.prototype.cssTypeName = function() {
return 'list-item-text';
};
ListItemText.prototype.type = function() {
return 'ListItemText';
};
ListItemText.prototype.typeName = function() {
return 'List item';
};
ListItemText.prototype.blur = function() {
if (this.content.isWhitespace() && this.can('remove')) {
this.parent().remove();
} else if (this.isMounted()) {
this._domElement.blur();
this._domElement.removeAttribute('contenteditable');
}
return ContentEdit.Element.prototype.blur.call(this);
};
ListItemText.prototype.can = function(behaviour, allowed) {
if (allowed) {
throw new Error('Cannot set behaviour for ListItemText');
}
return this.parent().can(behaviour);
};
ListItemText.prototype.html = function(indent) {
var content;
if (indent == null) {
indent = '';
}
if (!this._lastCached || this._lastCached < this._modified) {
if (ContentEdit.TRIM_WHITESPACE) {
content = this.content.copy().trim();
} else {
content = this.content.copy();
}
content.optimize();
this._lastCached = Date.now();
this._cached = content.html();
}
return "" + indent + this._cached;
};
ListItemText.prototype._onMouseDown = function(ev) {
var initDrag;
ContentEdit.Element.prototype._onMouseDown.call(this, ev);
initDrag = (function(_this) {
return function() {
var listRoot;
if (ContentEdit.Root.get().dragging() === _this) {
ContentEdit.Root.get().cancelDragging();
listRoot = _this.closest(function(node) {
return node.parent().type() === 'Region';
});
return listRoot.drag(ev.pageX, ev.pageY);
} else {
_this.drag(ev.pageX, ev.pageY);
return _this._dragTimeout = setTimeout(initDrag, ContentEdit.DRAG_HOLD_DURATION * 2);
}
};
})(this);
clearTimeout(this._dragTimeout);
return this._dragTimeout = setTimeout(initDrag, ContentEdit.DRAG_HOLD_DURATION);
};
ListItemText.prototype._onMouseMove = function(ev) {
if (this._dragTimeout) {
clearTimeout(this._dragTimeout);
}
return ContentEdit.Element.prototype._onMouseMove.call(this, ev);
};
ListItemText.prototype._onMouseUp = function(ev) {
if (this._dragTimeout) {
clearTimeout(this._dragTimeout);
}
return ContentEdit.Element.prototype._onMouseUp.call(this, ev);
};
ListItemText.prototype._keyTab = function(ev) {
ev.preventDefault();
if (ev.shiftKey) {
return this.parent().unindent();
} else {
return this.parent().indent();
}
};
ListItemText.prototype._keyReturn = function(ev) {
var grandParent, list, listItem, selection, tail, tip;
ev.preventDefault();
if (this.content.isWhitespace()) {
this.parent().unindent();
return;
}
if (!this.can('spawn')) {
return;
}
ContentSelect.Range.query(this._domElement);
selection = ContentSelect.Range.query(this._domElement);
tip = this.content.substring(0, selection.get()[0]);
tail = this.content.substring(selection.get()[1]);
if (tip.length() + tail.length() === 0) {
this.parent().unindent();
return;
}
this.content = tip.trim();
this.updateInnerHTML();
grandParent = this.parent().parent();
listItem = new ContentEdit.ListItem(this.attr('class') ? {
'class': this.attr('class')
} : {});
grandParent.attach(listItem, grandParent.children.indexOf(this.parent()) + 1);
listItem.attach(new ContentEdit.ListItemText(tail.trim()));
list = this.parent().list();
if (list) {
this.parent().detach(list);
listItem.attach(list);
}
if (tip.length()) {
listItem.listItemText().focus();
selection = new ContentSelect.Range(0, 0);
selection.select(listItem.listItemText().domElement());
} else {
selection = new ContentSelect.Range(0, tip.length());
selection.select(this._domElement);
}
return this.taint();
};
ListItemText.droppers = {
'ListItemText': function(element, target, placement) {
var elementParent, insertIndex, listItem, targetParent;
elementParent = element.parent();
targetParent = target.parent();
elementParent.remove();
elementParent.detach(element);
listItem = new ContentEdit.ListItem(elementParent._attributes);
listItem.attach(element);
if (targetParent.list() && placement[0] === 'below') {
targetParent.list().attach(listItem, 0);
return;
}
insertIndex = targetParent.parent().children.indexOf(targetParent);
if (placement[0] === 'below') {
insertIndex += 1;
}
return targetParent.parent().attach(listItem, insertIndex);
},
'Text': function(element, target, placement) {
var cssClass, insertIndex, listItem, targetParent, text;
if (element.type() === 'Text') {
targetParent = target.parent();
element.parent().detach(element);
cssClass = element.attr('class');
listItem = new ContentEdit.ListItem(cssClass ? {
'class': cssClass
} : {});
listItem.attach(new ContentEdit.ListItemText(element.content));
if (targetParent.list() && placement[0] === 'below') {
targetParent.list().attach(listItem, 0);
return;
}
insertIndex = targetParent.parent().children.indexOf(targetParent);
if (placement[0] === 'below') {
insertIndex += 1;
}
targetParent.parent().attach(listItem, insertIndex);
listItem.listItemText().focus();
if (element._savedSelection) {
return element._savedSelection.select(listItem.listItemText().domElement());
}
} else {
cssClass = element.attr('class');
text = new ContentEdit.Text('p', cssClass ? {
'class': cssClass
} : {}, element.content);
element.parent().remove();
insertIndex = target.parent().children.indexOf(target);
if (placement[0] === 'below') {
insertIndex += 1;
}
target.parent().attach(text, insertIndex);
text.focus();
if (element._savedSelection) {
return element._savedSelection.select(text.domElement());
}
}
}
};
ListItemText.mergers = {
'ListItemText': function(element, target) {
var offset;
offset = target.content.length();
if (element.content.length()) {
target.content = target.content.concat(element.content);
}
if (target.isMounted()) {
target._domElement.innerHTML = target.content.html();
}
target.focus();
new ContentSelect.Range(offset, offset).select(target._domElement);
if (element.type() === 'Text') {
if (element.parent()) {
element.parent().detach(element);
}
} else {
element.parent().remove();
}
return target.taint();
}
};
return ListItemText;
})(ContentEdit.Text);
_mergers = ContentEdit.ListItemText.mergers;
_mergers['Text'] = _mergers['ListItemText'];
ContentEdit.Table = (function(_super) {
__extends(Table, _super);
function Table(attributes) {
Table.__super__.constructor.call(this, 'table', attributes);
}
Table.prototype.cssTypeName = function() {
return 'table';
};
Table.prototype.typeName = function() {
return 'Table';
};
Table.prototype.type = function() {
return 'Table';
};
Table.prototype.firstSection = function() {
var section;
if (section = this.thead()) {
return section;
} else if (section = this.tbody()) {
return section;
} else if (section = this.tfoot()) {
return section;
}
return null;
};
Table.prototype.lastSection = function() {
var section;
if (section = this.tfoot()) {
return section;
} else if (section = this.tbody()) {
return section;
} else if (section = this.thead()) {
return section;
}
return null;
};
Table.prototype.tbody = function() {
return this._getChild('tbody');
};
Table.prototype.tfoot = function() {
return this._getChild('tfoot');
};
Table.prototype.thead = function() {
return this._getChild('thead');
};
Table.prototype._onMouseOver = function(ev) {
Table.__super__._onMouseOver.call(this, ev);
return this._removeCSSClass('ce-element--over');
};
Table.prototype._getChild = function(tagName) {
var child, _i, _len, _ref;
_ref = this.children;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
child = _ref[_i];
if (child.tagName() === tagName) {
return child;
}
}
return null;
};
Table.droppers = {
'Image': ContentEdit.Element._dropBoth,
'List': ContentEdit.Element._dropVert,
'PreText': ContentEdit.Element._dropVert,
'Static': ContentEdit.Element._dropVert,
'Table': ContentEdit.Element._dropVert,
'Text': ContentEdit.Element._dropVert,
'Video': ContentEdit.Element._dropBoth
};
Table.fromDOMElement = function(domElement) {
var c, childNode, childNodes, orphanRows, row, section, table, tagName, _i, _j, _len, _len1;
table = new this(this.getDOMElementAttributes(domElement));
childNodes = (function() {
var _i, _len, _ref, _results;
_ref = domElement.childNodes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c);
}
return _results;
})();
orphanRows = [];
for (_i = 0, _len = childNodes.length; _i < _len; _i++) {
childNode = childNodes[_i];
if (childNode.nodeType !== 1) {
continue;
}
tagName = childNode.tagName.toLowerCase();
if (table._getChild(tagName)) {
continue;
}
switch (tagName) {
case 'tbody':
case 'tfoot':
case 'thead':
section = ContentEdit.TableSection.fromDOMElement(childNode);
table.attach(section);
break;
case 'tr':
orphanRows.push(ContentEdit.TableRow.fromDOMElement(childNode));
}
}
if (orphanRows.length > 0) {
if (!table._getChild('tbody')) {
table.attach(new ContentEdit.TableSection('tbody'));
}
for (_j = 0, _len1 = orphanRows.length; _j < _len1; _j++) {
row = orphanRows[_j];
table.tbody().attach(row);
}
}
if (table.children.length === 0) {
return null;
}
return table;
};
return Table;
})(ContentEdit.ElementCollection);
ContentEdit.TagNames.get().register(ContentEdit.Table, 'table');
ContentEdit.TableSection = (function(_super) {
__extends(TableSection, _super);
function TableSection(tagName, attributes) {
TableSection.__super__.constructor.call(this, tagName, attributes);
}
TableSection.prototype.cssTypeName = function() {
return 'table-section';
};
TableSection.prototype.type = function() {
return 'TableSection';
};
TableSection.prototype._onMouseOver = function(ev) {
TableSection.__super__._onMouseOver.call(this, ev);
return this._removeCSSClass('ce-element--over');
};
TableSection.fromDOMElement = function(domElement) {
var c, childNode, childNodes, section, _i, _len;
section = new this(domElement.tagName, this.getDOMElementAttributes(domElement));
childNodes = (function() {
var _i, _len, _ref, _results;
_ref = domElement.childNodes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c);
}
return _results;
})();
for (_i = 0, _len = childNodes.length; _i < _len; _i++) {
childNode = childNodes[_i];
if (childNode.nodeType !== 1) {
continue;
}
if (childNode.tagName.toLowerCase() !== 'tr') {
continue;
}
section.attach(ContentEdit.TableRow.fromDOMElement(childNode));
}
return section;
};
return TableSection;
})(ContentEdit.ElementCollection);
ContentEdit.TableRow = (function(_super) {
__extends(TableRow, _super);
function TableRow(attributes) {
TableRow.__super__.constructor.call(this, 'tr', attributes);
}
TableRow.prototype.cssTypeName = function() {
return 'table-row';
};
TableRow.prototype.isEmpty = function() {
var cell, text, _i, _len, _ref;
_ref = this.children;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
cell = _ref[_i];
text = cell.tableCellText();
if (text && text.content.length() > 0) {
return false;
}
}
return true;
};
TableRow.prototype.type = function() {
return 'TableRow';
};
TableRow.prototype.typeName = function() {
return 'Table row';
};
TableRow.prototype._onMouseOver = function(ev) {
TableRow.__super__._onMouseOver.call(this, ev);
return this._removeCSSClass('ce-element--over');
};
TableRow.droppers = {
'TableRow': ContentEdit.Element._dropVert
};
TableRow.fromDOMElement = function(domElement) {
var c, childNode, childNodes, row, tagName, _i, _len;
row = new this(this.getDOMElementAttributes(domElement));
childNodes = (function() {
var _i, _len, _ref, _results;
_ref = domElement.childNodes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
_results.push(c);
}
return _results;
})();
for (_i = 0, _len = childNodes.length; _i < _len; _i++) {
childNode = childNodes[_i];
if (childNode.nodeType !== 1) {
continue;
}
tagName = childNode.tagName.toLowerCase();
if (!(tagName === 'td' || tagName === 'th')) {
continue;
}
row.attach(ContentEdit.TableCell.fromDOMElement(childNode));
}
return row;
};
return TableRow;
})(ContentEdit.ElementCollection);
ContentEdit.TableCell = (function(_super) {
__extends(TableCell, _super);
function TableCell(tagName, attributes) {
TableCell.__super__.constructor.call(this, tagName, attributes);
}
TableCell.prototype.cssTypeName = function() {
return 'table-cell';
};
TableCell.prototype.tableCellText = function() {
if (this.children.length > 0) {
return this.children[0];
}
return null;
};
TableCell.prototype.type = function() {
return 'TableCell';
};
TableCell.prototype.html = function(indent) {
var lines;
if (indent == null) {
indent = '';
}
lines = ["" + indent + "<" + (this.tagName()) + (this._attributesToString()) + ">"];
if (this.tableCellText()) {
lines.push(this.tableCellText().html(indent + ContentEdit.INDENT));
}
lines.push("" + indent + "</" + (this.tagName()) + ">");
return lines.join(ContentEdit.LINE_ENDINGS);
};
TableCell.prototype._onMouseOver = function(ev) {
TableCell.__super__._onMouseOver.call(this, ev);
return this._removeCSSClass('ce-element--over');
};
TableCell.prototype._addDOMEventListeners = function() {};
TableCell.prototype._removeDOMEventListners = function() {};
TableCell.fromDOMElement = function(domElement) {
var tableCell, tableCellText;
tableCell = new this(domElement.tagName, this.getDOMElementAttributes(domElement));
tableCellText = new ContentEdit.TableCellText(domElement.innerHTML.replace(/^\s+|\s+$/g, ''));
tableCell.attach(tableCellText);
return tableCell;
};
return TableCell;
})(ContentEdit.ElementCollection);
ContentEdit.TableCellText = (function(_super) {
__extends(TableCellText, _super);
function TableCellText(content) {
TableCellText.__super__.constructor.call(this, 'div', {}, content);
}
TableCellText.prototype.cssTypeName = function() {
return 'table-cell-text';
};
TableCellText.prototype.type = function() {
return 'TableCellText';
};
TableCellText.prototype._isInFirstRow = function() {
var cell, row, section, table;
cell = this.parent();
row = cell.parent();
section = row.parent();
table = section.parent();
if (section !== table.firstSection()) {
return false;
}
return row === section.children[0];
};
TableCellText.prototype._isInLastRow = function() {
var cell, row, section, table;
cell = this.parent();
row = cell.parent();
section = row.parent();
table = section.parent();
if (section !== table.lastSection()) {
return false;
}
return row === section.children[section.children.length - 1];
};
TableCellText.prototype._isLastInSection = function() {
var cell, row, section;
cell = this.parent();
row = cell.parent();
section = row.parent();
if (row !== section.children[section.children.length - 1]) {
return false;
}
return cell === row.children[row.children.length - 1];
};
TableCellText.prototype.blur = function() {
if (this.isMounted()) {
this._domElement.blur();
this._domElement.removeAttribute('contenteditable');
}
return ContentEdit.Element.prototype.blur.call(this);
};
TableCellText.prototype.can = function(behaviour, allowed) {
if (allowed) {
throw new Error('Cannot set behaviour for ListItemText');
}
return this.parent().can(behaviour);
};
TableCellText.prototype.html = function(indent) {
var content;
if (indent == null) {
indent = '';
}
if (!this._lastCached || this._lastCached < this._modified) {
if (ContentEdit.TRIM_WHITESPACE) {
content = this.content.copy().trim();
} else {
content = this.content.copy();
}
content.optimize();
this._lastCached = Date.now();
this._cached = content.html();
}
return "" + indent + this._cached;
};
TableCellText.prototype._onMouseDown = function(ev) {
var initDrag;
ContentEdit.Element.prototype._onMouseDown.call(this, ev);
initDrag = (function(_this) {
return function() {
var cell, table;
cell = _this.parent();
if (ContentEdit.Root.get().dragging() === cell.parent()) {
ContentEdit.Root.get().cancelDragging();
table = cell.parent().parent().parent();
return table.drag(ev.pageX, ev.pageY);
} else {
cell.parent().drag(ev.pageX, ev.pageY);
return _this._dragTimeout = setTimeout(initDrag, ContentEdit.DRAG_HOLD_DURATION * 2);
}
};
})(this);
clearTimeout(this._dragTimeout);
return this._dragTimeout = setTimeout(initDrag, ContentEdit.DRAG_HOLD_DURATION);
};
TableCellText.prototype._keyBack = function(ev) {
var cell, previous, row, selection;
selection = ContentSelect.Range.query(this._domElement);
if (!(selection.get()[0] === 0 && selection.isCollapsed())) {
return;
}
ev.preventDefault();
cell = this.parent();
row = cell.parent();
if (!(row.isEmpty() && row.can('remove'))) {
return;
}
if (this.content.length() === 0 && row.children.indexOf(cell) === 0) {
previous = this.previousContent();
if (previous) {
previous.focus();
selection = new ContentSelect.Range(previous.content.length(), previous.content.length());
selection.select(previous.domElement());
}
return row.parent().detach(row);
}
};
TableCellText.prototype._keyDelete = function(ev) {
var lastChild, nextElement, row, selection;
row = this.parent().parent();
if (!(row.isEmpty() && row.can('remove'))) {
return;
}
ev.preventDefault();
lastChild = row.children[row.children.length - 1];
nextElement = lastChild.tableCellText().nextContent();
if (nextElement) {
nextElement.focus();
selection = new ContentSelect.Range(0, 0);
selection.select(nextElement.domElement());
}
return row.parent().detach(row);
};
TableCellText.prototype._keyDown = function(ev) {
var cell, cellIndex, lastCell, next, nextRow, row, selection;
selection = ContentSelect.Range.query(this._domElement);
if (!(this._atEnd(selection) && selection.isCollapsed())) {
return;
}
ev.preventDefault();
cell = this.parent();
if (this._isInLastRow()) {
row = cell.parent();
lastCell = row.children[row.children.length - 1].tableCellText();
next = lastCell.nextContent();
if (next) {
return next.focus();
} else {
return ContentEdit.Root.get().trigger('next-region', this.closest(function(node) {
return node.type() === 'Fixture' || node.type() === 'Region';
}));
}
} else {
nextRow = cell.parent().nextWithTest(function(node) {
return node.type() === 'TableRow';
});
cellIndex = cell.parent().children.indexOf(cell);
cellIndex = Math.min(cellIndex, nextRow.children.length);
return nextRow.children[cellIndex].tableCellText().focus();
}
};
TableCellText.prototype._keyReturn = function(ev) {
ev.preventDefault();
return this._keyTab({
'shiftKey': false,
'preventDefault': function() {}
});
};
TableCellText.prototype._keyTab = function(ev) {
var cell, child, grandParent, newCell, newCellText, row, section, _i, _len, _ref;
ev.preventDefault();
cell = this.parent();
if (ev.shiftKey) {
if (this._isInFirstRow() && cell.parent().children[0] === cell) {
return;
}
return this.previousContent().focus();
} else {
if (!this.can('spawn')) {
return;
}
grandParent = cell.parent().parent();
if (grandParent.tagName() === 'tbody' && this._isLastInSection()) {
row = new ContentEdit.TableRow();
_ref = cell.parent().children;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
child = _ref[_i];
newCell = new ContentEdit.TableCell(child.tagName(), child._attributes);
newCellText = new ContentEdit.TableCellText('');
newCell.attach(newCellText);
row.attach(newCell);
}
section = this.closest(function(node) {
return node.type() === 'TableSection';
});
section.attach(row);
return row.children[0].tableCellText().focus();
} else {
return this.nextContent().focus();
}
}
};
TableCellText.prototype._keyUp = function(ev) {
var cell, cellIndex, previous, previousRow, row, selection;
selection = ContentSelect.Range.query(this._domElement);
if (!(selection.get()[0] === 0 && selection.isCollapsed())) {
return;
}
ev.preventDefault();
cell = this.parent();
if (this._isInFirstRow()) {
row = cell.parent();
previous = row.children[0].previousContent();
if (previous) {
return previous.focus();
} else {
return ContentEdit.Root.get().trigger('previous-region', this.closest(function(node) {
return node.type() === 'Fixture' || node.type() === 'Region';
}));
}
} else {
previousRow = cell.parent().previousWithTest(function(node) {
return node.type() === 'TableRow';
});
cellIndex = cell.parent().children.indexOf(cell);
cellIndex = Math.min(cellIndex, previousRow.children.length);
return previousRow.children[cellIndex].tableCellText().focus();
}
};
TableCellText.droppers = {};
TableCellText.mergers = {};
return TableCellText;
})(ContentEdit.Text);
}).call(this);
(function() {
var AttributeUI, ContentTools, CropMarksUI, StyleUI, exports, _EditorApp,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__slice = [].slice;
ContentTools = {
Tools: {},
CANCEL_MESSAGE: 'Your changes have not been saved, do you really want to lose them?'.trim(),
DEFAULT_TOOLS: [['bold', 'italic', 'link', 'align-left', 'align-center', 'align-right'], ['heading', 'subheading', 'paragraph', 'unordered-list', 'ordered-list', 'table', 'indent', 'unindent', 'line-break'], ['image', 'video', 'preformatted'], ['undo', 'redo', 'remove']],
DEFAULT_VIDEO_HEIGHT: 300,
DEFAULT_VIDEO_WIDTH: 400,
HIGHLIGHT_HOLD_DURATION: 2000,
INSPECTOR_IGNORED_ELEMENTS: ['Fixture', 'ListItemText', 'Region', 'TableCellText'],
IMAGE_UPLOADER: null,
MIN_CROP: 10,
RESTRICTED_ATTRIBUTES: {
'*': ['style'],
'img': ['height', 'src', 'width', 'data-ce-max-width', 'data-ce-min-width'],
'iframe': ['height', 'width']
},
getEmbedVideoURL: function(url) {
var domains, id, k, kv, m, netloc, paramStr, params, paramsStr, parser, path, v, _i, _len, _ref;
domains = {
'www.youtube.com': 'youtube',
'youtu.be': 'youtube',
'vimeo.com': 'vimeo',
'player.vimeo.com': 'vimeo'
};
parser = document.createElement('a');
parser.href = url;
netloc = parser.hostname.toLowerCase();
path = parser.pathname;
if (path !== null && path.substr(0, 1) !== "/") {
path = "/" + path;
}
params = {};
paramsStr = parser.search.slice(1);
_ref = paramsStr.split('&');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
kv = _ref[_i];
kv = kv.split("=");
if (kv[0]) {
params[kv[0]] = kv[1];
}
}
switch (domains[netloc]) {
case 'youtube':
if (path.toLowerCase() === '/watch') {
if (!params['v']) {
return null;
}
id = params['v'];
delete params['v'];
} else {
m = path.match(/\/([A-Za-z0-9_-]+)$/i);
if (!m) {
return null;
}
id = m[1];
}
url = "https://www.youtube.com/embed/" + id;
paramStr = ((function() {
var _results;
_results = [];
for (k in params) {
v = params[k];
_results.push("" + k + "=" + v);
}
return _results;
})()).join('&');
if (paramStr) {
url += "?" + paramStr;
}
return url;
case 'vimeo':
m = path.match(/\/(\w+\/\w+\/){0,1}(\d+)/i);
if (!m) {
return null;
}
url = "https://player.vimeo.com/video/" + m[2];
paramStr = ((function() {
var _results;
_results = [];
for (k in params) {
v = params[k];
_results.push("" + k + "=" + v);
}
return _results;
})()).join('&');
if (paramStr) {
url += "?" + paramStr;
}
return url;
}
return null;
},
getRestrictedAtributes: function(tagName) {
var restricted;
restricted = [];
if (ContentTools.RESTRICTED_ATTRIBUTES[tagName]) {
restricted = restricted.concat(ContentTools.RESTRICTED_ATTRIBUTES[tagName]);
}
if (ContentTools.RESTRICTED_ATTRIBUTES['*']) {
restricted = restricted.concat(ContentTools.RESTRICTED_ATTRIBUTES['*']);
}
return restricted;
},
getScrollPosition: function() {
var isCSS1Compat, supportsPageOffset;
supportsPageOffset = window.pageXOffset !== void 0;
isCSS1Compat = (document.compatMode || 4) === 4;
if (supportsPageOffset) {
return [window.pageXOffset, window.pageYOffset];
} else if (isCSS1Compat) {
return [document.documentElement.scrollLeft, document.documentElement.scrollTop];
} else {
return [document.body.scrollLeft, document.body.scrollTop];
}
}
};
if (typeof window !== 'undefined') {
window.ContentTools = ContentTools;
}
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = ContentTools;
}
ContentTools.ComponentUI = (function() {
function ComponentUI() {
this._bindings = {};
this._parent = null;
this._children = [];
this._domElement = null;
}
ComponentUI.prototype.children = function() {
return this._children.slice();
};
ComponentUI.prototype.domElement = function() {
return this._domElement;
};
ComponentUI.prototype.isMounted = function() {
return this._domElement !== null;
};
ComponentUI.prototype.parent = function() {
return this._parent;
};
ComponentUI.prototype.attach = function(component, index) {
if (component.parent()) {
component.parent().detach(component);
}
component._parent = this;
if (index !== void 0) {
return this._children.splice(index, 0, component);
} else {
return this._children.push(component);
}
};
ComponentUI.prototype.addCSSClass = function(className) {
if (!this.isMounted()) {
return;
}
return ContentEdit.addCSSClass(this._domElement, className);
};
ComponentUI.prototype.detach = function(component) {
var componentIndex;
componentIndex = this._children.indexOf(component);
if (componentIndex === -1) {
return;
}
return this._children.splice(componentIndex, 1);
};
ComponentUI.prototype.detatch = function(component) {
console.log('Please call detach, detatch will be removed in release 1.4.x');
return this.detach(component);
};
ComponentUI.prototype.mount = function() {};
ComponentUI.prototype.removeCSSClass = function(className) {
if (!this.isMounted()) {
return;
}
return ContentEdit.removeCSSClass(this._domElement, className);
};
ComponentUI.prototype.unmount = function() {
if (!this.isMounted()) {
return;
}
this._removeDOMEventListeners();
if (this._domElement.parentNode) {
this._domElement.parentNode.removeChild(this._domElement);
}
return this._domElement = null;
};
ComponentUI.prototype.addEventListener = function(eventName, callback) {
if (this._bindings[eventName] === void 0) {
this._bindings[eventName] = [];
}
this._bindings[eventName].push(callback);
};
ComponentUI.prototype.createEvent = function(eventName, detail) {
return new ContentTools.Event(eventName, detail);
};
ComponentUI.prototype.dispatchEvent = function(ev) {
var callback, _i, _len, _ref;
if (!this._bindings[ev.name()]) {
return !ev.defaultPrevented();
}
_ref = this._bindings[ev.name()];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
callback = _ref[_i];
if (ev.propagationStopped()) {
break;
}
if (!callback) {
continue;
}
callback.call(this, ev);
}
return !ev.defaultPrevented();
};
ComponentUI.prototype.removeEventListener = function(eventName, callback) {
var i, suspect, _i, _len, _ref, _results;
if (!eventName) {
this._bindings = {};
return;
}
if (!callback) {
this._bindings[eventName] = void 0;
return;
}
if (!this._bindings[eventName]) {
return;
}
_ref = this._bindings[eventName];
_results = [];
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
suspect = _ref[i];
if (suspect === callback) {
_results.push(this._bindings[eventName].splice(i, 1));
} else {
_results.push(void 0);
}
}
return _results;
};
ComponentUI.prototype._addDOMEventListeners = function() {};
ComponentUI.prototype._removeDOMEventListeners = function() {};
ComponentUI.createDiv = function(classNames, attributes, content) {
var domElement, name, value;
domElement = document.createElement('div');
if (classNames && classNames.length > 0) {
domElement.setAttribute('class', classNames.join(' '));
}
if (attributes) {
for (name in attributes) {
value = attributes[name];
domElement.setAttribute(name, value);
}
}
if (content) {
domElement.innerHTML = content;
}
return domElement;
};
return ComponentUI;
})();
ContentTools.WidgetUI = (function(_super) {
__extends(WidgetUI, _super);
function WidgetUI() {
return WidgetUI.__super__.constructor.apply(this, arguments);
}
WidgetUI.prototype.attach = function(component, index) {
WidgetUI.__super__.attach.call(this, component, index);
if (!this.isMounted()) {
return component.mount();
}
};
WidgetUI.prototype.detach = function(component) {
WidgetUI.__super__.detach.call(this, component);
if (this.isMounted()) {
return component.unmount();
}
};
WidgetUI.prototype.detatch = function(component) {
console.log('Please call detach, detatch will be removed in release 1.4.x');
return this.detach(component);
};
WidgetUI.prototype.show = function() {
var fadeIn;
if (this._hideTimeout) {
clearTimeout(this._hideTimeout);
this._hideTimeout = null;
this.unmount();
}
if (!this.isMounted()) {
this.mount();
}
fadeIn = (function(_this) {
return function() {
_this.addCSSClass('ct-widget--active');
return _this._showTimeout = null;
};
})(this);
return this._showTimeout = setTimeout(fadeIn, 100);
};
WidgetUI.prototype.hide = function() {
var monitorForHidden;
if (this._showTimeout) {
clearTimeout(this._showTimeout);
this._showTimeout = null;
}
this.removeCSSClass('ct-widget--active');
monitorForHidden = (function(_this) {
return function() {
_this._hideTimeout = null;
if (!window.getComputedStyle) {
_this.unmount();
return;
}
if (parseFloat(window.getComputedStyle(_this._domElement).opacity) < 0.01) {
return _this.unmount();
} else {
return _this._hideTimeout = setTimeout(monitorForHidden, 250);
}
};
})(this);
if (this.isMounted()) {
return this._hideTimeout = setTimeout(monitorForHidden, 250);
}
};
return WidgetUI;
})(ContentTools.ComponentUI);
ContentTools.AnchoredComponentUI = (function(_super) {
__extends(AnchoredComponentUI, _super);
function AnchoredComponentUI() {
return AnchoredComponentUI.__super__.constructor.apply(this, arguments);
}
AnchoredComponentUI.prototype.mount = function(domParent, before) {
if (before == null) {
before = null;
}
domParent.insertBefore(this._domElement, before);
return this._addDOMEventListeners();
};
return AnchoredComponentUI;
})(ContentTools.ComponentUI);
ContentTools.Event = (function() {
function Event(name, detail) {
this._name = name;
this._detail = detail;
this._timeStamp = Date.now();
this._defaultPrevented = false;
this._propagationStopped = false;
}
Event.prototype.defaultPrevented = function() {
return this._defaultPrevented;
};
Event.prototype.detail = function() {
return this._detail;
};
Event.prototype.name = function() {
return this._name;
};
Event.prototype.propagationStopped = function() {
return this._propagationStopped;
};
Event.prototype.timeStamp = function() {
return this._timeStamp;
};
Event.prototype.preventDefault = function() {
return this._defaultPrevented = true;
};
Event.prototype.stopImmediatePropagation = function() {
return this._propagationStopped = true;
};
return Event;
})();
ContentTools.FlashUI = (function(_super) {
__extends(FlashUI, _super);
function FlashUI(modifier) {
FlashUI.__super__.constructor.call(this);
this.mount(modifier);
}
FlashUI.prototype.mount = function(modifier) {
var monitorForHidden;
this._domElement = this.constructor.createDiv(['ct-flash', 'ct-flash--active', "ct-flash--" + modifier, 'ct-widget', 'ct-widget--active']);
FlashUI.__super__.mount.call(this, ContentTools.EditorApp.get().domElement());
monitorForHidden = (function(_this) {
return function() {
if (!window.getComputedStyle) {
_this.unmount();
return;
}
if (parseFloat(window.getComputedStyle(_this._domElement).opacity) < 0.01) {
return _this.unmount();
} else {
return setTimeout(monitorForHidden, 250);
}
};
})(this);
return setTimeout(monitorForHidden, 250);
};
return FlashUI;
})(ContentTools.AnchoredComponentUI);
ContentTools.IgnitionUI = (function(_super) {
__extends(IgnitionUI, _super);
function IgnitionUI() {
IgnitionUI.__super__.constructor.call(this);
this._revertToState = 'ready';
this._state = 'ready';
}
IgnitionUI.prototype.busy = function(busy) {
if (this.dispatchEvent(this.createEvent('busy', {
busy: busy
}))) {
if (busy === (this._state === 'busy')) {
return;
}
if (busy) {
this._revertToState = this._state;
return this.state('busy');
} else {
return this.state(this._revertToState);
}
}
};
IgnitionUI.prototype.cancel = function() {
if (this.dispatchEvent(this.createEvent('cancel'))) {
return this.state('ready');
}
};
IgnitionUI.prototype.confirm = function() {
if (this.dispatchEvent(this.createEvent('confirm'))) {
return this.state('ready');
}
};
IgnitionUI.prototype.edit = function() {
if (this.dispatchEvent(this.createEvent('edit'))) {
return this.state('editing');
}
};
IgnitionUI.prototype.mount = function() {
IgnitionUI.__super__.mount.call(this);
this._domElement = this.constructor.createDiv(['ct-widget', 'ct-ignition', 'ct-ignition--ready']);
this.parent().domElement().appendChild(this._domElement);
this._domEdit = this.constructor.createDiv(['ct-ignition__button', 'ct-ignition__button--edit']);
this._domElement.appendChild(this._domEdit);
this._domConfirm = this.constructor.createDiv(['ct-ignition__button', 'ct-ignition__button--confirm']);
this._domElement.appendChild(this._domConfirm);
this._domCancel = this.constructor.createDiv(['ct-ignition__button', 'ct-ignition__button--cancel']);
this._domElement.appendChild(this._domCancel);
this._domBusy = this.constructor.createDiv(['ct-ignition__button', 'ct-ignition__button--busy']);
this._domElement.appendChild(this._domBusy);
return this._addDOMEventListeners();
};
IgnitionUI.prototype.state = function(state) {
if (state === void 0) {
return this._state;
}
if (this._state === state) {
return;
}
if (!this.dispatchEvent(this.createEvent('statechange', {
state: state
}))) {
return;
}
this._state = state;
this.removeCSSClass('ct-ignition--busy');
this.removeCSSClass('ct-ignition--editing');
this.removeCSSClass('ct-ignition--ready');
if (this._state === 'busy') {
return this.addCSSClass('ct-ignition--busy');
} else if (this._state === 'editing') {
return this.addCSSClass('ct-ignition--editing');
} else if (this._state === 'ready') {
return this.addCSSClass('ct-ignition--ready');
}
};
IgnitionUI.prototype.unmount = function() {
IgnitionUI.__super__.unmount.call(this);
this._domEdit = null;
this._domConfirm = null;
return this._domCancel = null;
};
IgnitionUI.prototype._addDOMEventListeners = function() {
this._domEdit.addEventListener('click', (function(_this) {
return function(ev) {
ev.preventDefault();
return _this.edit();
};
})(this));
this._domConfirm.addEventListener('click', (function(_this) {
return function(ev) {
ev.preventDefault();
return _this.confirm();
};
})(this));
return this._domCancel.addEventListener('click', (function(_this) {
return function(ev) {
ev.preventDefault();
return _this.cancel();
};
})(this));
};
return IgnitionUI;
})(ContentTools.WidgetUI);
ContentTools.InspectorUI = (function(_super) {
__extends(InspectorUI, _super);
function InspectorUI() {
InspectorUI.__super__.constructor.call(this);
this._tagUIs = [];
}
InspectorUI.prototype.mount = function() {
this._domElement = this.constructor.createDiv(['ct-widget', 'ct-inspector']);
this.parent().domElement().appendChild(this._domElement);
this._domTags = this.constructor.createDiv(['ct-inspector__tags', 'ct-tags']);
this._domElement.appendChild(this._domTags);
this._domCounter = this.constructor.createDiv(['ct-inspector__counter']);
this._domElement.appendChild(this._domCounter);
this.updateCounter();
this._addDOMEventListeners();
this._handleFocusChange = (function(_this) {
return function() {
return _this.updateTags();
};
})(this);
ContentEdit.Root.get().bind('blur', this._handleFocusChange);
ContentEdit.Root.get().bind('focus', this._handleFocusChange);
return ContentEdit.Root.get().bind('mount', this._handleFocusChange);
};
InspectorUI.prototype.unmount = function() {
InspectorUI.__super__.unmount.call(this);
this._domTags = null;
ContentEdit.Root.get().unbind('blur', this._handleFocusChange);
ContentEdit.Root.get().unbind('focus', this._handleFocusChange);
return ContentEdit.Root.get().unbind('mount', this._handleFocusChange);
};
InspectorUI.prototype.updateCounter = function() {
var column, completeText, element, line, lines, region, sub, word_count, _i, _len, _ref;
if (!this.isMounted()) {
return;
}
completeText = '';
_ref = ContentTools.EditorApp.get().orderedRegions();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
region = _ref[_i];
if (!region) {
continue;
}
completeText += region.domElement().textContent;
}
completeText = completeText.trim();
completeText = completeText.replace(/<\/?[a-z][^>]*>/gi, '');
completeText = completeText.replace(/[\u200B]+/, '');
completeText = completeText.replace(/['";:,.?¿\-!¡]+/g, '');
word_count = (completeText.match(/\S+/g) || []).length;
word_count = word_count.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
element = ContentEdit.Root.get().focused();
if (!(element && element.type() === 'PreText' && element.selection().isCollapsed())) {
this._domCounter.textContent = word_count;
return;
}
line = 0;
column = 1;
sub = element.content.substring(0, element.selection().get()[0]);
lines = sub.text().split('\n');
line = lines.length;
column = lines[lines.length - 1].length + 1;
line = line.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
column = column.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return this._domCounter.textContent = "" + word_count + " / " + line + ":" + column;
};
InspectorUI.prototype.updateTags = function() {
var element, elements, tag, _i, _j, _len, _len1, _ref, _results;
element = ContentEdit.Root.get().focused();
_ref = this._tagUIs;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
tag = _ref[_i];
tag.unmount();
}
this._tagUIs = [];
if (!element) {
return;
}
elements = element.parents();
elements.reverse();
elements.push(element);
_results = [];
for (_j = 0, _len1 = elements.length; _j < _len1; _j++) {
element = elements[_j];
if (ContentTools.INSPECTOR_IGNORED_ELEMENTS.indexOf(element.type()) !== -1) {
continue;
}
if (element.isFixed()) {
continue;
}
tag = new ContentTools.TagUI(element);
this._tagUIs.push(tag);
_results.push(tag.mount(this._domTags));
}
return _results;
};
InspectorUI.prototype._addDOMEventListeners = function() {
return this._updateCounterInterval = setInterval((function(_this) {
return function() {
return _this.updateCounter();
};
})(this), 250);
};
InspectorUI.prototype._removeDOMEventListeners = function() {
return clearInterval(this._updateCounterInterval);
};
return InspectorUI;
})(ContentTools.WidgetUI);
ContentTools.TagUI = (function(_super) {
__extends(TagUI, _super);
function TagUI(element) {
this.element = element;
this._onMouseDown = __bind(this._onMouseDown, this);
TagUI.__super__.constructor.call(this);
}
TagUI.prototype.mount = function(domParent, before) {
if (before == null) {
before = null;
}
this._domElement = this.constructor.createDiv(['ct-tag']);
this._domElement.textContent = this.element.tagName();
return TagUI.__super__.mount.call(this, domParent, before);
};
TagUI.prototype._addDOMEventListeners = function() {
return this._domElement.addEventListener('mousedown', this._onMouseDown);
};
TagUI.prototype._onMouseDown = function(ev) {
var app, dialog, modal;
ev.preventDefault();
if (this.element.storeState) {
this.element.storeState();
}
app = ContentTools.EditorApp.get();
modal = new ContentTools.ModalUI();
dialog = new ContentTools.PropertiesDialog(this.element);
dialog.addEventListener('cancel', (function(_this) {
return function() {
modal.hide();
dialog.hide();
if (_this.element.restoreState) {
return _this.element.restoreState();
}
};
})(this));
dialog.addEventListener('save', (function(_this) {
return function(ev) {
var applied, attributes, className, classNames, cssClass, detail, element, innerHTML, name, styles, value, _i, _j, _len, _len1, _ref, _ref1;
detail = ev.detail();
attributes = detail.changedAttributes;
styles = detail.changedStyles;
innerHTML = detail.innerHTML;
for (name in attributes) {
value = attributes[name];
if (name === 'class') {
if (value === null) {
value = '';
}
classNames = {};
_ref = value.split(' ');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
className = _ref[_i];
className = className.trim();
if (!className) {
continue;
}
classNames[className] = true;
if (!_this.element.hasCSSClass(className)) {
_this.element.addCSSClass(className);
}
}
_ref1 = _this.element.attr('class').split(' ');
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
className = _ref1[_j];
className = className.trim();
if (classNames[className] === void 0) {
_this.element.removeCSSClass(className);
}
}
} else {
if (value === null) {
_this.element.removeAttr(name);
} else {
_this.element.attr(name, value);
}
}
}
for (cssClass in styles) {
applied = styles[cssClass];
if (applied) {
_this.element.addCSSClass(cssClass);
} else {
_this.element.removeCSSClass(cssClass);
}
}
if (innerHTML !== null) {
if (innerHTML !== dialog.getElementInnerHTML()) {
element = _this.element;
if (!element.content) {
element = element.children[0];
}
element.content = new HTMLString.String(innerHTML, element.content.preserveWhitespace());
element.updateInnerHTML();
element.taint();
element.selection(new ContentSelect.Range(0, 0));
element.storeState();
}
}
modal.hide();
dialog.hide();
if (_this.element.restoreState) {
return _this.element.restoreState();
}
};
})(this));
app.attach(modal);
app.attach(dialog);
modal.show();
return dialog.show();
};
return TagUI;
})(ContentTools.AnchoredComponentUI);
ContentTools.ModalUI = (function(_super) {
__extends(ModalUI, _super);
function ModalUI(transparent, allowScrolling) {
ModalUI.__super__.constructor.call(this);
this._transparent = transparent;
this._allowScrolling = allowScrolling;
}
ModalUI.prototype.mount = function() {
this._domElement = this.constructor.createDiv(['ct-widget', 'ct-modal']);
this.parent().domElement().appendChild(this._domElement);
if (this._transparent) {
this.addCSSClass('ct-modal--transparent');
}
if (!this._allowScrolling) {
ContentEdit.addCSSClass(document.body, 'ct--no-scroll');
}
return this._addDOMEventListeners();
};
ModalUI.prototype.unmount = function() {
if (!this._allowScrolling) {
ContentEdit.removeCSSClass(document.body, 'ct--no-scroll');
}
return ModalUI.__super__.unmount.call(this);
};
ModalUI.prototype._addDOMEventListeners = function() {
return this._domElement.addEventListener('click', (function(_this) {
return function(ev) {
return _this.dispatchEvent(_this.createEvent('click'));
};
})(this));
};
return ModalUI;
})(ContentTools.WidgetUI);
ContentTools.ToolboxUI = (function(_super) {
__extends(ToolboxUI, _super);
function ToolboxUI(tools) {
this._onStopDragging = __bind(this._onStopDragging, this);
this._onStartDragging = __bind(this._onStartDragging, this);
this._onDrag = __bind(this._onDrag, this);
ToolboxUI.__super__.constructor.call(this);
this._tools = tools;
this._dragging = false;
this._draggingOffset = null;
this._domGrip = null;
this._toolUIs = {};
}
ToolboxUI.prototype.isDragging = function() {
return this._dragging;
};
ToolboxUI.prototype.hide = function() {
this._removeDOMEventListeners();
return ToolboxUI.__super__.hide.call(this);
};
ToolboxUI.prototype.mount = function() {
var coord, position, restore;
this._domElement = this.constructor.createDiv(['ct-widget', 'ct-toolbox']);
this.parent().domElement().appendChild(this._domElement);
this._domGrip = this.constructor.createDiv(['ct-toolbox__grip', 'ct-grip']);
this._domElement.appendChild(this._domGrip);
this._domGrip.appendChild(this.constructor.createDiv(['ct-grip__bump']));
this._domGrip.appendChild(this.constructor.createDiv(['ct-grip__bump']));
this._domGrip.appendChild(this.constructor.createDiv(['ct-grip__bump']));
this._domToolGroups = this.constructor.createDiv(['ct-tool-groups']);
this._domElement.appendChild(this._domToolGroups);
this.tools(this._tools);
restore = window.localStorage.getItem('ct-toolbox-position');
if (restore && /^\d+,\d+$/.test(restore)) {
position = (function() {
var _i, _len, _ref, _results;
_ref = restore.split(',');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
coord = _ref[_i];
_results.push(parseInt(coord));
}
return _results;
})();
this._domElement.style.left = "" + position[0] + "px";
this._domElement.style.top = "" + position[1] + "px";
this._contain();
}
return this._addDOMEventListeners();
};
ToolboxUI.prototype.tools = function(tools) {
var domToolGroup, i, tool, toolGroup, toolName, toolUI, _i, _len, _ref, _ref1, _results;
if (tools === void 0) {
return this._tools;
}
this._tools = tools;
if (!this.isMounted()) {
return;
}
_ref = this._toolUIs;
for (toolName in _ref) {
toolUI = _ref[toolName];
toolUI.unmount();
}
this._toolUIs = {};
while (this._domToolGroups.lastChild) {
this._domToolGroups.removeChild(this._domToolGroups.lastChild);
}
_ref1 = this._tools;
_results = [];
for (i = _i = 0, _len = _ref1.length; _i < _len; i = ++_i) {
toolGroup = _ref1[i];
domToolGroup = this.constructor.createDiv(['ct-tool-group']);
this._domToolGroups.appendChild(domToolGroup);
_results.push((function() {
var _j, _len1, _results1;
_results1 = [];
for (_j = 0, _len1 = toolGroup.length; _j < _len1; _j++) {
toolName = toolGroup[_j];
tool = ContentTools.ToolShelf.fetch(toolName);
this._toolUIs[toolName] = new ContentTools.ToolUI(tool);
this._toolUIs[toolName].mount(domToolGroup);
this._toolUIs[toolName].disabled(true);
_results1.push(this._toolUIs[toolName].addEventListener('applied', (function(_this) {
return function() {
return _this.updateTools();
};
})(this)));
}
return _results1;
}).call(this));
}
return _results;
};
ToolboxUI.prototype.updateTools = function() {
var element, name, selection, toolUI, _ref, _results;
element = ContentEdit.Root.get().focused();
selection = null;
if (element && element.selection) {
selection = element.selection();
}
_ref = this._toolUIs;
_results = [];
for (name in _ref) {
toolUI = _ref[name];
_results.push(toolUI.update(element, selection));
}
return _results;
};
ToolboxUI.prototype.unmount = function() {
ToolboxUI.__super__.unmount.call(this);
return this._domGrip = null;
};
ToolboxUI.prototype._addDOMEventListeners = function() {
this._domGrip.addEventListener('mousedown', this._onStartDragging);
this._handleResize = (function(_this) {
return function(ev) {
var containResize;
if (_this._resizeTimeout) {
clearTimeout(_this._resizeTimeout);
}
containResize = function() {
return _this._contain();
};
return _this._resizeTimeout = setTimeout(containResize, 250);
};
})(this);
window.addEventListener('resize', this._handleResize);
this._updateTools = (function(_this) {
return function() {
var app, element, name, selection, toolUI, update, _ref, _results;
app = ContentTools.EditorApp.get();
update = false;
element = ContentEdit.Root.get().focused();
selection = null;
if (element === _this._lastUpdateElement) {
if (element && element.selection) {
selection = element.selection();
if (_this._lastUpdateSelection) {
if (!selection.eq(_this._lastUpdateSelection)) {
update = true;
}
} else {
update = true;
}
}
} else {
update = true;
}
if (app.history) {
if (_this._lastUpdateHistoryLength !== app.history.length()) {
update = true;
}
_this._lastUpdateHistoryLength = app.history.length();
if (_this._lastUpdateHistoryIndex !== app.history.index()) {
update = true;
}
_this._lastUpdateHistoryIndex = app.history.index();
}
_this._lastUpdateElement = element;
_this._lastUpdateSelection = selection;
if (update) {
_ref = _this._toolUIs;
_results = [];
for (name in _ref) {
toolUI = _ref[name];
_results.push(toolUI.update(element, selection));
}
return _results;
}
};
})(this);
this._updateToolsInterval = setInterval(this._updateTools, 100);
this._handleKeyDown = (function(_this) {
return function(ev) {
var Paragraph, element, os, redo, undo, version;
element = ContentEdit.Root.get().focused();
if (element && !element.content) {
if (ev.keyCode === 46) {
ev.preventDefault();
return ContentTools.Tools.Remove.apply(element, null, function() {});
}
if (ev.keyCode === 13) {
ev.preventDefault();
Paragraph = ContentTools.Tools.Paragraph;
return Paragraph.apply(element, null, function() {});
}
}
version = navigator.appVersion;
os = 'linux';
if (version.indexOf('Mac') !== -1) {
os = 'mac';
} else if (version.indexOf('Win') !== -1) {
os = 'windows';
}
redo = false;
undo = false;
switch (os) {
case 'linux':
if (ev.keyCode === 90 && ev.ctrlKey) {
redo = ev.shiftKey;
undo = !redo;
}
break;
case 'mac':
if (ev.keyCode === 90 && ev.metaKey) {
redo = ev.shiftKey;
undo = !redo;
}
break;
case 'windows':
if (ev.keyCode === 89 && ev.ctrlKey) {
redo = true;
}
if (ev.keyCode === 90 && ev.ctrlKey) {
undo = true;
}
}
if (undo && ContentTools.Tools.Undo.canApply(null, null)) {
ContentTools.Tools.Undo.apply(null, null, function() {});
}
if (redo && ContentTools.Tools.Redo.canApply(null, null)) {
return ContentTools.Tools.Redo.apply(null, null, function() {});
}
};
})(this);
return window.addEventListener('keydown', this._handleKeyDown);
};
ToolboxUI.prototype._contain = function() {
var rect;
if (!this.isMounted()) {
return;
}
rect = this._domElement.getBoundingClientRect();
if (rect.left + rect.width > window.innerWidth) {
this._domElement.style.left = "" + (window.innerWidth - rect.width) + "px";
}
if (rect.top + rect.height > window.innerHeight) {
this._domElement.style.top = "" + (window.innerHeight - rect.height) + "px";
}
if (rect.left < 0) {
this._domElement.style.left = '0px';
}
if (rect.top < 0) {
this._domElement.style.top = '0px';
}
rect = this._domElement.getBoundingClientRect();
return window.localStorage.setItem('ct-toolbox-position', "" + rect.left + "," + rect.top);
};
ToolboxUI.prototype._removeDOMEventListeners = function() {
if (this.isMounted()) {
this._domGrip.removeEventListener('mousedown', this._onStartDragging);
}
window.removeEventListener('keydown', this._handleKeyDown);
window.removeEventListener('resize', this._handleResize);
return clearInterval(this._updateToolsInterval);
};
ToolboxUI.prototype._onDrag = function(ev) {
ContentSelect.Range.unselectAll();
this._domElement.style.left = "" + (ev.clientX - this._draggingOffset.x) + "px";
return this._domElement.style.top = "" + (ev.clientY - this._draggingOffset.y) + "px";
};
ToolboxUI.prototype._onStartDragging = function(ev) {
var rect;
ev.preventDefault();
if (this.isDragging()) {
return;
}
this._dragging = true;
this.addCSSClass('ct-toolbox--dragging');
rect = this._domElement.getBoundingClientRect();
this._draggingOffset = {
x: ev.clientX - rect.left,
y: ev.clientY - rect.top
};
document.addEventListener('mousemove', this._onDrag);
document.addEventListener('mouseup', this._onStopDragging);
return ContentEdit.addCSSClass(document.body, 'ce--dragging');
};
ToolboxUI.prototype._onStopDragging = function(ev) {
if (!this.isDragging()) {
return;
}
this._contain();
document.removeEventListener('mousemove', this._onDrag);
document.removeEventListener('mouseup', this._onStopDragging);
this._draggingOffset = null;
this._dragging = false;
this.removeCSSClass('ct-toolbox--dragging');
return ContentEdit.removeCSSClass(document.body, 'ce--dragging');
};
return ToolboxUI;
})(ContentTools.WidgetUI);
ContentTools.ToolUI = (function(_super) {
__extends(ToolUI, _super);
function ToolUI(tool) {
this._onMouseUp = __bind(this._onMouseUp, this);
this._onMouseLeave = __bind(this._onMouseLeave, this);
this._onMouseDown = __bind(this._onMouseDown, this);
this._addDOMEventListeners = __bind(this._addDOMEventListeners, this);
ToolUI.__super__.constructor.call(this);
this.tool = tool;
this._mouseDown = false;
this._disabled = false;
}
ToolUI.prototype.apply = function(element, selection) {
var callback, detail;
if (!this.tool.canApply(element, selection)) {
return;
}
detail = {
'element': element,
'selection': selection
};
callback = (function(_this) {
return function(applied) {
if (applied) {
return _this.dispatchEvent(_this.createEvent('applied', detail));
}
};
})(this);
if (this.dispatchEvent(this.createEvent('apply', detail))) {
return this.tool.apply(element, selection, callback);
}
};
ToolUI.prototype.disabled = function(disabledState) {
if (disabledState === void 0) {
return this._disabled;
}
if (this._disabled === disabledState) {
return;
}
this._disabled = disabledState;
if (disabledState) {
this._mouseDown = false;
this.addCSSClass('ct-tool--disabled');
return this.removeCSSClass('ct-tool--applied');
} else {
return this.removeCSSClass('ct-tool--disabled');
}
};
ToolUI.prototype.mount = function(domParent, before) {
if (before == null) {
before = null;
}
this._domElement = this.constructor.createDiv(['ct-tool', "ct-tool--" + this.tool.icon]);
this._domElement.setAttribute('data-ct-tooltip', ContentEdit._(this.tool.label));
return ToolUI.__super__.mount.call(this, domParent, before);
};
ToolUI.prototype.update = function(element, selection) {
if (this.tool.requiresElement) {
if (!(element && element.isMounted())) {
this.disabled(true);
return;
}
}
if (this.tool.canApply(element, selection)) {
this.disabled(false);
} else {
this.disabled(true);
return;
}
if (this.tool.isApplied(element, selection)) {
return this.addCSSClass('ct-tool--applied');
} else {
return this.removeCSSClass('ct-tool--applied');
}
};
ToolUI.prototype._addDOMEventListeners = function() {
this._domElement.addEventListener('mousedown', this._onMouseDown);
this._domElement.addEventListener('mouseleave', this._onMouseLeave);
return this._domElement.addEventListener('mouseup', this._onMouseUp);
};
ToolUI.prototype._onMouseDown = function(ev) {
ev.preventDefault();
if (this.disabled()) {
return;
}
this._mouseDown = true;
return this.addCSSClass('ct-tool--down');
};
ToolUI.prototype._onMouseLeave = function(ev) {
this._mouseDown = false;
return this.removeCSSClass('ct-tool--down');
};
ToolUI.prototype._onMouseUp = function(ev) {
var element, selection;
if (this._mouseDown) {
element = ContentEdit.Root.get().focused();
if (this.tool.requiresElement) {
if (!(element && element.isMounted())) {
return;
}
}
selection = null;
if (element && element.selection) {
selection = element.selection();
}
this.apply(element, selection);
}
this._mouseDown = false;
return this.removeCSSClass('ct-tool--down');
};
return ToolUI;
})(ContentTools.AnchoredComponentUI);
ContentTools.AnchoredDialogUI = (function(_super) {
__extends(AnchoredDialogUI, _super);
function AnchoredDialogUI() {
AnchoredDialogUI.__super__.constructor.call(this);
this._position = [0, 0];
}
AnchoredDialogUI.prototype.mount = function() {
this._domElement = this.constructor.createDiv(['ct-widget', 'ct-anchored-dialog']);
this.parent().domElement().appendChild(this._domElement);
this._contain();
this._domElement.style.top = "" + this._position[1] + "px";
return this._domElement.style.left = "" + this._position[0] + "px";
};
AnchoredDialogUI.prototype.position = function(newPosition) {
if (newPosition === void 0) {
return this._position.slice();
}
this._position = newPosition.slice();
if (this.isMounted()) {
this._contain();
this._domElement.style.top = "" + this._position[1] + "px";
return this._domElement.style.left = "" + this._position[0] + "px";
}
};
AnchoredDialogUI.prototype._contain = function() {
var halfWidth, pageWidth;
if (!this.isMounted()) {
return;
}
halfWidth = this._domElement.getBoundingClientRect().width / 2 + 5;
pageWidth = document.documentElement.clientWidth || document.body.clientWidth;
if ((this._position[0] + halfWidth) > (pageWidth - halfWidth)) {
this._position[0] = pageWidth - halfWidth;
}
if (this._position[0] < halfWidth) {
return this._position[0] = halfWidth;
}
};
return AnchoredDialogUI;
})(ContentTools.WidgetUI);
ContentTools.DialogUI = (function(_super) {
__extends(DialogUI, _super);
function DialogUI(caption) {
if (caption == null) {
caption = '';
}
DialogUI.__super__.constructor.call(this);
this._busy = false;
this._caption = caption;
}
DialogUI.prototype.busy = function(busy) {
if (busy === void 0) {
return this._busy;
}
if (this._busy === busy) {
return;
}
this._busy = busy;
if (!this.isMounted()) {
return;
}
if (this._busy) {
return ContentEdit.addCSSClass(this._domElement, 'ct-dialog--busy');
} else {
return ContentEdit.removeCSSClass(this._domElement, 'ct-dialog--busy');
}
};
DialogUI.prototype.caption = function(caption) {
if (caption === void 0) {
return this._caption;
}
this._caption = caption;
return this._domCaption.textContent = ContentEdit._(caption);
};
DialogUI.prototype.mount = function() {
var dialogCSSClasses, domBody, domHeader;
if (document.activeElement) {
document.activeElement.blur();
window.getSelection().removeAllRanges();
}
dialogCSSClasses = ['ct-widget', 'ct-dialog'];
if (this._busy) {
dialogCSSClasses.push('ct-dialog--busy');
}
this._domElement = this.constructor.createDiv(dialogCSSClasses);
this.parent().domElement().appendChild(this._domElement);
domHeader = this.constructor.createDiv(['ct-dialog__header']);
this._domElement.appendChild(domHeader);
this._domCaption = this.constructor.createDiv(['ct-dialog__caption']);
domHeader.appendChild(this._domCaption);
this.caption(this._caption);
this._domClose = this.constructor.createDiv(['ct-dialog__close']);
domHeader.appendChild(this._domClose);
domBody = this.constructor.createDiv(['ct-dialog__body']);
this._domElement.appendChild(domBody);
this._domView = this.constructor.createDiv(['ct-dialog__view']);
domBody.appendChild(this._domView);
this._domControls = this.constructor.createDiv(['ct-dialog__controls']);
domBody.appendChild(this._domControls);
this._domBusy = this.constructor.createDiv(['ct-dialog__busy']);
return this._domElement.appendChild(this._domBusy);
};
DialogUI.prototype.unmount = function() {
DialogUI.__super__.unmount.call(this);
this._domBusy = null;
this._domCaption = null;
this._domClose = null;
this._domControls = null;
return this._domView = null;
};
DialogUI.prototype._addDOMEventListeners = function() {
this._handleEscape = (function(_this) {
return function(ev) {
if (_this._busy) {
return;
}
if (ev.keyCode === 27) {
return _this.dispatchEvent(_this.createEvent('cancel'));
}
};
})(this);
document.addEventListener('keyup', this._handleEscape);
return this._domClose.addEventListener('click', (function(_this) {
return function(ev) {
ev.preventDefault();
if (_this._busy) {
return;
}
return _this.dispatchEvent(_this.createEvent('cancel'));
};
})(this));
};
DialogUI.prototype._removeDOMEventListeners = function() {
return document.removeEventListener('keyup', this._handleEscape);
};
return DialogUI;
})(ContentTools.WidgetUI);
ContentTools.ImageDialog = (function(_super) {
__extends(ImageDialog, _super);
function ImageDialog() {
ImageDialog.__super__.constructor.call(this, 'Insert image');
this._cropMarks = null;
this._imageURL = null;
this._imageSize = null;
this._progress = 0;
this._state = 'empty';
if (ContentTools.IMAGE_UPLOADER) {
ContentTools.IMAGE_UPLOADER(this);
}
}
ImageDialog.prototype.cropRegion = function() {
if (this._cropMarks) {
return this._cropMarks.region();
}
return [0, 0, 1, 1];
};
ImageDialog.prototype.addCropMarks = function() {
if (this._cropMarks) {
return;
}
this._cropMarks = new CropMarksUI(this._imageSize);
this._cropMarks.mount(this._domView);
return ContentEdit.addCSSClass(this._domCrop, 'ct-control--active');
};
ImageDialog.prototype.clear = function() {
if (this._domImage) {
this._domImage.parentNode.removeChild(this._domImage);
this._domImage = null;
}
this._imageURL = null;
this._imageSize = null;
return this.state('empty');
};
ImageDialog.prototype.mount = function() {
var domActions, domProgressBar, domTools;
ImageDialog.__super__.mount.call(this);
ContentEdit.addCSSClass(this._domElement, 'ct-image-dialog');
ContentEdit.addCSSClass(this._domElement, 'ct-image-dialog--empty');
ContentEdit.addCSSClass(this._domView, 'ct-image-dialog__view');
domTools = this.constructor.createDiv(['ct-control-group', 'ct-control-group--left']);
this._domControls.appendChild(domTools);
this._domRotateCCW = this.constructor.createDiv(['ct-control', 'ct-control--icon', 'ct-control--rotate-ccw']);
this._domRotateCCW.setAttribute('data-ct-tooltip', ContentEdit._('Rotate') + ' -90°');
domTools.appendChild(this._domRotateCCW);
this._domRotateCW = this.constructor.createDiv(['ct-control', 'ct-control--icon', 'ct-control--rotate-cw']);
this._domRotateCW.setAttribute('data-ct-tooltip', ContentEdit._('Rotate') + ' 90°');
domTools.appendChild(this._domRotateCW);
this._domCrop = this.constructor.createDiv(['ct-control', 'ct-control--icon', 'ct-control--crop']);
this._domCrop.setAttribute('data-ct-tooltip', ContentEdit._('Crop marks'));
domTools.appendChild(this._domCrop);
domProgressBar = this.constructor.createDiv(['ct-progress-bar']);
domTools.appendChild(domProgressBar);
this._domProgress = this.constructor.createDiv(['ct-progress-bar__progress']);
domProgressBar.appendChild(this._domProgress);
domActions = this.constructor.createDiv(['ct-control-group', 'ct-control-group--right']);
this._domControls.appendChild(domActions);
this._domUpload = this.constructor.createDiv(['ct-control', 'ct-control--text', 'ct-control--upload']);
this._domUpload.textContent = ContentEdit._('Upload');
domActions.appendChild(this._domUpload);
this._domInput = document.createElement('input');
this._domInput.setAttribute('class', 'ct-image-dialog__file-upload');
this._domInput.setAttribute('name', 'file');
this._domInput.setAttribute('type', 'file');
this._domInput.setAttribute('accept', 'image/*');
this._domUpload.appendChild(this._domInput);
this._domInsert = this.constructor.createDiv(['ct-control', 'ct-control--text', 'ct-control--insert']);
this._domInsert.textContent = ContentEdit._('Insert');
domActions.appendChild(this._domInsert);
this._domCancelUpload = this.constructor.createDiv(['ct-control', 'ct-control--text', 'ct-control--cancel']);
this._domCancelUpload.textContent = ContentEdit._('Cancel');
domActions.appendChild(this._domCancelUpload);
this._domClear = this.constructor.createDiv(['ct-control', 'ct-control--text', 'ct-control--clear']);
this._domClear.textContent = ContentEdit._('Clear');
domActions.appendChild(this._domClear);
this._addDOMEventListeners();
return this.dispatchEvent(this.createEvent('imageuploader.mount'));
};
ImageDialog.prototype.populate = function(imageURL, imageSize) {
this._imageURL = imageURL;
this._imageSize = imageSize;
if (!this._domImage) {
this._domImage = this.constructor.createDiv(['ct-image-dialog__image']);
this._domView.appendChild(this._domImage);
}
this._domImage.style['background-image'] = "url(" + imageURL + ")";
return this.state('populated');
};
ImageDialog.prototype.progress = function(progress) {
if (progress === void 0) {
return this._progress;
}
this._progress = progress;
if (!this.isMounted()) {
return;
}
return this._domProgress.style.width = "" + this._progress + "%";
};
ImageDialog.prototype.removeCropMarks = function() {
if (!this._cropMarks) {
return;
}
this._cropMarks.unmount();
this._cropMarks = null;
return ContentEdit.removeCSSClass(this._domCrop, 'ct-control--active');
};
ImageDialog.prototype.save = function(imageURL, imageSize, imageAttrs) {
return this.dispatchEvent(this.createEvent('save', {
'imageURL': imageURL,
'imageSize': imageSize,
'imageAttrs': imageAttrs
}));
};
ImageDialog.prototype.state = function(state) {
var prevState;
if (state === void 0) {
return this._state;
}
if (this._state === state) {
return;
}
prevState = this._state;
this._state = state;
if (!this.isMounted()) {
return;
}
ContentEdit.addCSSClass(this._domElement, "ct-image-dialog--" + this._state);
return ContentEdit.removeCSSClass(this._domElement, "ct-image-dialog--" + prevState);
};
ImageDialog.prototype.unmount = function() {
ImageDialog.__super__.unmount.call(this);
this._domCancelUpload = null;
this._domClear = null;
this._domCrop = null;
this._domInput = null;
this._domInsert = null;
this._domProgress = null;
this._domRotateCCW = null;
this._domRotateCW = null;
this._domUpload = null;
return this.dispatchEvent(this.createEvent('imageuploader.unmount'));
};
ImageDialog.prototype._addDOMEventListeners = function() {
ImageDialog.__super__._addDOMEventListeners.call(this);
this._domInput.addEventListener('change', (function(_this) {
return function(ev) {
var file;
file = ev.target.files[0];
ev.target.value = '';
if (ev.target.value) {
ev.target.type = 'text';
ev.target.type = 'file';
}
return _this.dispatchEvent(_this.createEvent('imageuploader.fileready', {
file: file
}));
};
})(this));
this._domCancelUpload.addEventListener('click', (function(_this) {
return function(ev) {
return _this.dispatchEvent(_this.createEvent('imageuploader.cancelupload'));
};
})(this));
this._domClear.addEventListener('click', (function(_this) {
return function(ev) {
_this.removeCropMarks();
return _this.dispatchEvent(_this.createEvent('imageuploader.clear'));
};
})(this));
this._domRotateCCW.addEventListener('click', (function(_this) {
return function(ev) {
_this.removeCropMarks();
return _this.dispatchEvent(_this.createEvent('imageuploader.rotateccw'));
};
})(this));
this._domRotateCW.addEventListener('click', (function(_this) {
return function(ev) {
_this.removeCropMarks();
return _this.dispatchEvent(_this.createEvent('imageuploader.rotatecw'));
};
})(this));
this._domCrop.addEventListener('click', (function(_this) {
return function(ev) {
if (_this._cropMarks) {
return _this.removeCropMarks();
} else {
return _this.addCropMarks();
}
};
})(this));
return this._domInsert.addEventListener('click', (function(_this) {
return function(ev) {
return _this.dispatchEvent(_this.createEvent('imageuploader.save'));
};
})(this));
};
return ImageDialog;
})(ContentTools.DialogUI);
CropMarksUI = (function(_super) {
__extends(CropMarksUI, _super);
function CropMarksUI(imageSize) {
CropMarksUI.__super__.constructor.call(this);
this._bounds = null;
this._dragging = null;
this._draggingOrigin = null;
this._imageSize = imageSize;
}
CropMarksUI.prototype.mount = function(domParent, before) {
if (before == null) {
before = null;
}
this._domElement = this.constructor.createDiv(['ct-crop-marks']);
this._domClipper = this.constructor.createDiv(['ct-crop-marks__clipper']);
this._domElement.appendChild(this._domClipper);
this._domRulers = [this.constructor.createDiv(['ct-crop-marks__ruler', 'ct-crop-marks__ruler--top-left']), this.constructor.createDiv(['ct-crop-marks__ruler', 'ct-crop-marks__ruler--bottom-right'])];
this._domClipper.appendChild(this._domRulers[0]);
this._domClipper.appendChild(this._domRulers[1]);
this._domHandles = [this.constructor.createDiv(['ct-crop-marks__handle', 'ct-crop-marks__handle--top-left']), this.constructor.createDiv(['ct-crop-marks__handle', 'ct-crop-marks__handle--bottom-right'])];
this._domElement.appendChild(this._domHandles[0]);
this._domElement.appendChild(this._domHandles[1]);
CropMarksUI.__super__.mount.call(this, domParent, before);
return this._fit(domParent);
};
CropMarksUI.prototype.region = function() {
return [parseFloat(this._domHandles[0].style.top) / this._bounds[1], parseFloat(this._domHandles[0].style.left) / this._bounds[0], parseFloat(this._domHandles[1].style.top) / this._bounds[1], parseFloat(this._domHandles[1].style.left) / this._bounds[0]];
};
CropMarksUI.prototype.unmount = function() {
CropMarksUI.__super__.unmount.call(this);
this._domClipper = null;
this._domHandles = null;
return this._domRulers = null;
};
CropMarksUI.prototype._addDOMEventListeners = function() {
CropMarksUI.__super__._addDOMEventListeners.call(this);
this._domHandles[0].addEventListener('mousedown', (function(_this) {
return function(ev) {
if (ev.button === 0) {
return _this._startDrag(0, ev.clientY, ev.clientX);
}
};
})(this));
return this._domHandles[1].addEventListener('mousedown', (function(_this) {
return function(ev) {
if (ev.button === 0) {
return _this._startDrag(1, ev.clientY, ev.clientX);
}
};
})(this));
};
CropMarksUI.prototype._drag = function(top, left) {
var height, minCrop, offsetLeft, offsetTop, width;
if (this._dragging === null) {
return;
}
ContentSelect.Range.unselectAll();
offsetTop = top - this._draggingOrigin[1];
offsetLeft = left - this._draggingOrigin[0];
height = this._bounds[1];
left = 0;
top = 0;
width = this._bounds[0];
minCrop = Math.min(Math.min(ContentTools.MIN_CROP, height), width);
if (this._dragging === 0) {
height = parseInt(this._domHandles[1].style.top) - minCrop;
width = parseInt(this._domHandles[1].style.left) - minCrop;
} else {
left = parseInt(this._domHandles[0].style.left) + minCrop;
top = parseInt(this._domHandles[0].style.top) + minCrop;
}
offsetTop = Math.min(Math.max(top, offsetTop), height);
offsetLeft = Math.min(Math.max(left, offsetLeft), width);
this._domHandles[this._dragging].style.top = "" + offsetTop + "px";
this._domHandles[this._dragging].style.left = "" + offsetLeft + "px";
this._domRulers[this._dragging].style.top = "" + offsetTop + "px";
return this._domRulers[this._dragging].style.left = "" + offsetLeft + "px";
};
CropMarksUI.prototype._fit = function(domParent) {
var height, heightScale, left, ratio, rect, top, width, widthScale;
rect = domParent.getBoundingClientRect();
widthScale = rect.width / this._imageSize[0];
heightScale = rect.height / this._imageSize[1];
ratio = Math.min(widthScale, heightScale);
width = ratio * this._imageSize[0];
height = ratio * this._imageSize[1];
left = (rect.width - width) / 2;
top = (rect.height - height) / 2;
this._domElement.style.width = "" + width + "px";
this._domElement.style.height = "" + height + "px";
this._domElement.style.top = "" + top + "px";
this._domElement.style.left = "" + left + "px";
this._domHandles[0].style.top = '0px';
this._domHandles[0].style.left = '0px';
this._domHandles[1].style.top = "" + height + "px";
this._domHandles[1].style.left = "" + width + "px";
this._domRulers[0].style.top = '0px';
this._domRulers[0].style.left = '0px';
this._domRulers[1].style.top = "" + height + "px";
this._domRulers[1].style.left = "" + width + "px";
return this._bounds = [width, height];
};
CropMarksUI.prototype._startDrag = function(handleIndex, top, left) {
var domHandle;
domHandle = this._domHandles[handleIndex];
this._dragging = handleIndex;
this._draggingOrigin = [left - parseInt(domHandle.style.left), top - parseInt(domHandle.style.top)];
this._onMouseMove = (function(_this) {
return function(ev) {
return _this._drag(ev.clientY, ev.clientX);
};
})(this);
document.addEventListener('mousemove', this._onMouseMove);
this._onMouseUp = (function(_this) {
return function(ev) {
return _this._stopDrag();
};
})(this);
return document.addEventListener('mouseup', this._onMouseUp);
};
CropMarksUI.prototype._stopDrag = function() {
document.removeEventListener('mousemove', this._onMouseMove);
document.removeEventListener('mouseup', this._onMouseUp);
this._dragging = null;
return this._draggingOrigin = null;
};
return CropMarksUI;
})(ContentTools.AnchoredComponentUI);
ContentTools.LinkDialog = (function(_super) {
var NEW_WINDOW_TARGET;
__extends(LinkDialog, _super);
NEW_WINDOW_TARGET = '_blank';
function LinkDialog(href, target) {
if (href == null) {
href = '';
}
if (target == null) {
target = '';
}
LinkDialog.__super__.constructor.call(this);
this._href = href;
this._target = target;
}
LinkDialog.prototype.mount = function() {
LinkDialog.__super__.mount.call(this);
this._domInput = document.createElement('input');
this._domInput.setAttribute('class', 'ct-anchored-dialog__input');
this._domInput.setAttribute('name', 'href');
this._domInput.setAttribute('placeholder', ContentEdit._('Enter a link') + '...');
this._domInput.setAttribute('type', 'text');
this._domInput.setAttribute('value', this._href);
this._domElement.appendChild(this._domInput);
this._domTargetButton = this.constructor.createDiv(['ct-anchored-dialog__target-button']);
this._domElement.appendChild(this._domTargetButton);
if (this._target === NEW_WINDOW_TARGET) {
ContentEdit.addCSSClass(this._domTargetButton, 'ct-anchored-dialog__target-button--active');
}
this._domButton = this.constructor.createDiv(['ct-anchored-dialog__button']);
this._domElement.appendChild(this._domButton);
return this._addDOMEventListeners();
};
LinkDialog.prototype.save = function() {
var detail;
if (!this.isMounted()) {
this.dispatchEvent(this.createEvent('save'));
return;
}
detail = {
href: this._domInput.value.trim()
};
if (this._target) {
detail.target = this._target;
}
return this.dispatchEvent(this.createEvent('save', detail));
};
LinkDialog.prototype.show = function() {
LinkDialog.__super__.show.call(this);
this._domInput.focus();
if (this._href) {
return this._domInput.select();
}
};
LinkDialog.prototype.unmount = function() {
if (this.isMounted()) {
this._domInput.blur();
}
LinkDialog.__super__.unmount.call(this);
this._domButton = null;
return this._domInput = null;
};
LinkDialog.prototype._addDOMEventListeners = function() {
this._domInput.addEventListener('keypress', (function(_this) {
return function(ev) {
if (ev.keyCode === 13) {
return _this.save();
}
};
})(this));
this._domTargetButton.addEventListener('click', (function(_this) {
return function(ev) {
ev.preventDefault();
if (_this._target === NEW_WINDOW_TARGET) {
_this._target = '';
return ContentEdit.removeCSSClass(_this._domTargetButton, 'ct-anchored-dialog__target-button--active');
} else {
_this._target = NEW_WINDOW_TARGET;
return ContentEdit.addCSSClass(_this._domTargetButton, 'ct-anchored-dialog__target-button--active');
}
};
})(this));
return this._domButton.addEventListener('click', (function(_this) {
return function(ev) {
ev.preventDefault();
return _this.save();
};
})(this));
};
return LinkDialog;
})(ContentTools.AnchoredDialogUI);
ContentTools.PropertiesDialog = (function(_super) {
__extends(PropertiesDialog, _super);
function PropertiesDialog(element) {
var _ref;
this.element = element;
PropertiesDialog.__super__.constructor.call(this, 'Properties');
this._attributeUIs = [];
this._focusedAttributeUI = null;
this._styleUIs = [];
this._supportsCoding = this.element.content;
if ((_ref = this.element.type()) === 'ListItem' || _ref === 'TableCell') {
this._supportsCoding = true;
}
}
PropertiesDialog.prototype.caption = function(caption) {
if (caption === void 0) {
return this._caption;
}
this._caption = caption;
return this._domCaption.textContent = ContentEdit._(caption) + (": " + (this.element.tagName()));
};
PropertiesDialog.prototype.changedAttributes = function() {
var attributeUI, attributes, changedAttributes, name, restricted, value, _i, _len, _ref, _ref1;
attributes = {};
changedAttributes = {};
_ref = this._attributeUIs;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
attributeUI = _ref[_i];
name = attributeUI.name();
value = attributeUI.value();
if (name === '') {
continue;
}
attributes[name.toLowerCase()] = true;
if (this.element.attr(name) !== value) {
changedAttributes[name] = value;
}
}
restricted = ContentTools.getRestrictedAtributes(this.element.tagName());
_ref1 = this.element.attributes();
for (name in _ref1) {
value = _ref1[name];
if (restricted && restricted.indexOf(name.toLowerCase()) !== -1) {
continue;
}
if (attributes[name] === void 0) {
changedAttributes[name] = null;
}
}
return changedAttributes;
};
PropertiesDialog.prototype.changedStyles = function() {
var cssClass, styleUI, styles, _i, _len, _ref;
styles = {};
_ref = this._styleUIs;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
styleUI = _ref[_i];
cssClass = styleUI.style.cssClass();
if (this.element.hasCSSClass(cssClass) !== styleUI.applied()) {
styles[cssClass] = styleUI.applied();
}
}
return styles;
};
PropertiesDialog.prototype.getElementInnerHTML = function() {
if (!this._supportsCoding) {
return null;
}
if (this.element.content) {
return this.element.content.html();
}
return this.element.children[0].content.html();
};
PropertiesDialog.prototype.mount = function() {
var attributeNames, attributes, domActions, domTabs, lastTab, name, restricted, style, styleUI, value, _i, _j, _len, _len1, _ref;
PropertiesDialog.__super__.mount.call(this);
ContentEdit.addCSSClass(this._domElement, 'ct-properties-dialog');
ContentEdit.addCSSClass(this._domView, 'ct-properties-dialog__view');
this._domStyles = this.constructor.createDiv(['ct-properties-dialog__styles']);
this._domStyles.setAttribute('data-ct-empty', ContentEdit._('No styles available for this tag'));
this._domView.appendChild(this._domStyles);
_ref = ContentTools.StylePalette.styles(this.element);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
style = _ref[_i];
styleUI = new StyleUI(style, this.element.hasCSSClass(style.cssClass()));
this._styleUIs.push(styleUI);
styleUI.mount(this._domStyles);
}
this._domAttributes = this.constructor.createDiv(['ct-properties-dialog__attributes']);
this._domView.appendChild(this._domAttributes);
restricted = ContentTools.getRestrictedAtributes(this.element.tagName());
attributes = this.element.attributes();
attributeNames = [];
for (name in attributes) {
value = attributes[name];
if (restricted && restricted.indexOf(name.toLowerCase()) !== -1) {
continue;
}
attributeNames.push(name);
}
attributeNames.sort();
for (_j = 0, _len1 = attributeNames.length; _j < _len1; _j++) {
name = attributeNames[_j];
value = attributes[name];
this._addAttributeUI(name, value);
}
this._addAttributeUI('', '');
this._domCode = this.constructor.createDiv(['ct-properties-dialog__code']);
this._domView.appendChild(this._domCode);
this._domInnerHTML = document.createElement('textarea');
this._domInnerHTML.setAttribute('class', 'ct-properties-dialog__inner-html');
this._domInnerHTML.setAttribute('name', 'code');
this._domInnerHTML.value = this.getElementInnerHTML();
this._domCode.appendChild(this._domInnerHTML);
domTabs = this.constructor.createDiv(['ct-control-group', 'ct-control-group--left']);
this._domControls.appendChild(domTabs);
this._domStylesTab = this.constructor.createDiv(['ct-control', 'ct-control--icon', 'ct-control--styles']);
this._domStylesTab.setAttribute('data-ct-tooltip', ContentEdit._('Styles'));
domTabs.appendChild(this._domStylesTab);
this._domAttributesTab = this.constructor.createDiv(['ct-control', 'ct-control--icon', 'ct-control--attributes']);
this._domAttributesTab.setAttribute('data-ct-tooltip', ContentEdit._('Attributes'));
domTabs.appendChild(this._domAttributesTab);
this._domCodeTab = this.constructor.createDiv(['ct-control', 'ct-control--icon', 'ct-control--code']);
this._domCodeTab.setAttribute('data-ct-tooltip', ContentEdit._('Code'));
domTabs.appendChild(this._domCodeTab);
if (!this._supportsCoding) {
ContentEdit.addCSSClass(this._domCodeTab, 'ct-control--muted');
}
this._domRemoveAttribute = this.constructor.createDiv(['ct-control', 'ct-control--icon', 'ct-control--remove', 'ct-control--muted']);
this._domRemoveAttribute.setAttribute('data-ct-tooltip', ContentEdit._('Remove'));
domTabs.appendChild(this._domRemoveAttribute);
domActions = this.constructor.createDiv(['ct-control-group', 'ct-control-group--right']);
this._domControls.appendChild(domActions);
this._domApply = this.constructor.createDiv(['ct-control', 'ct-control--text', 'ct-control--apply']);
this._domApply.textContent = ContentEdit._('Apply');
domActions.appendChild(this._domApply);
lastTab = window.localStorage.getItem('ct-properties-dialog-tab');
if (lastTab === 'attributes') {
ContentEdit.addCSSClass(this._domElement, 'ct-properties-dialog--attributes');
ContentEdit.addCSSClass(this._domAttributesTab, 'ct-control--active');
} else if (lastTab === 'code' && this._supportsCoding) {
ContentEdit.addCSSClass(this._domElement, 'ct-properties-dialog--code');
ContentEdit.addCSSClass(this._domCodeTab, 'ct-control--active');
} else {
ContentEdit.addCSSClass(this._domElement, 'ct-properties-dialog--styles');
ContentEdit.addCSSClass(this._domStylesTab, 'ct-control--active');
}
return this._addDOMEventListeners();
};
PropertiesDialog.prototype.save = function() {
var detail, innerHTML;
innerHTML = null;
if (this._supportsCoding) {
innerHTML = this._domInnerHTML.value;
}
detail = {
changedAttributes: this.changedAttributes(),
changedStyles: this.changedStyles(),
innerHTML: innerHTML
};
return this.dispatchEvent(this.createEvent('save', detail));
};
PropertiesDialog.prototype._addAttributeUI = function(name, value) {
var attributeUI, dialog;
dialog = this;
attributeUI = new AttributeUI(name, value);
this._attributeUIs.push(attributeUI);
attributeUI.addEventListener('blur', function(ev) {
var index, lastAttributeUI, length;
dialog._focusedAttributeUI = null;
ContentEdit.addCSSClass(dialog._domRemoveAttribute, 'ct-control--muted');
index = dialog._attributeUIs.indexOf(this);
length = dialog._attributeUIs.length;
if (this.name() === '' && index < (length - 1)) {
this.unmount();
dialog._attributeUIs.splice(index, 1);
}
lastAttributeUI = dialog._attributeUIs[length - 1];
if (lastAttributeUI) {
if (lastAttributeUI.name() && lastAttributeUI.value()) {
return dialog._addAttributeUI('', '');
}
}
});
attributeUI.addEventListener('focus', function(ev) {
dialog._focusedAttributeUI = this;
return ContentEdit.removeCSSClass(dialog._domRemoveAttribute, 'ct-control--muted');
});
attributeUI.addEventListener('namechange', function(ev) {
var element, otherAttributeUI, restricted, valid, _i, _len, _ref;
element = dialog.element;
name = this.name().toLowerCase();
restricted = ContentTools.getRestrictedAtributes(element.tagName());
valid = true;
if (restricted && restricted.indexOf(name) !== -1) {
valid = false;
}
_ref = dialog._attributeUIs;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
otherAttributeUI = _ref[_i];
if (name === '') {
continue;
}
if (otherAttributeUI === this) {
continue;
}
if (otherAttributeUI.name().toLowerCase() !== name) {
continue;
}
valid = false;
}
this.valid(valid);
if (valid) {
return ContentEdit.removeCSSClass(dialog._domApply, 'ct-control--muted');
} else {
return ContentEdit.addCSSClass(dialog._domApply, 'ct-control--muted');
}
});
attributeUI.mount(this._domAttributes);
return attributeUI;
};
PropertiesDialog.prototype._addDOMEventListeners = function() {
var selectTab, validateCode;
PropertiesDialog.__super__._addDOMEventListeners.call(this);
selectTab = (function(_this) {
return function(selected) {
var selectedCap, tab, tabCap, tabs, _i, _len;
tabs = ['attributes', 'code', 'styles'];
for (_i = 0, _len = tabs.length; _i < _len; _i++) {
tab = tabs[_i];
if (tab === selected) {
continue;
}
tabCap = tab.charAt(0).toUpperCase() + tab.slice(1);
ContentEdit.removeCSSClass(_this._domElement, "ct-properties-dialog--" + tab);
ContentEdit.removeCSSClass(_this["_dom" + tabCap + "Tab"], 'ct-control--active');
}
selectedCap = selected.charAt(0).toUpperCase() + selected.slice(1);
ContentEdit.addCSSClass(_this._domElement, "ct-properties-dialog--" + selected);
ContentEdit.addCSSClass(_this["_dom" + selectedCap + "Tab"], 'ct-control--active');
return window.localStorage.setItem('ct-properties-dialog-tab', selected);
};
})(this);
this._domStylesTab.addEventListener('mousedown', (function(_this) {
return function() {
return selectTab('styles');
};
})(this));
this._domAttributesTab.addEventListener('mousedown', (function(_this) {
return function() {
return selectTab('attributes');
};
})(this));
if (this._supportsCoding) {
this._domCodeTab.addEventListener('mousedown', (function(_this) {
return function() {
return selectTab('code');
};
})(this));
}
this._domRemoveAttribute.addEventListener('mousedown', (function(_this) {
return function(ev) {
var index, last;
ev.preventDefault();
if (_this._focusedAttributeUI) {
index = _this._attributeUIs.indexOf(_this._focusedAttributeUI);
last = index === (_this._attributeUIs.length - 1);
_this._focusedAttributeUI.unmount();
_this._attributeUIs.splice(index, 1);
if (last) {
return _this._addAttributeUI('', '');
}
}
};
})(this));
validateCode = (function(_this) {
return function(ev) {
var content;
try {
content = new HTMLString.String(_this._domInnerHTML.value);
ContentEdit.removeCSSClass(_this._domInnerHTML, 'ct-properties-dialog__inner-html--invalid');
return ContentEdit.removeCSSClass(_this._domApply, 'ct-control--muted');
} catch (_error) {
ContentEdit.addCSSClass(_this._domInnerHTML, 'ct-properties-dialog__inner-html--invalid');
return ContentEdit.addCSSClass(_this._domApply, 'ct-control--muted');
}
};
})(this);
this._domInnerHTML.addEventListener('input', validateCode);
this._domInnerHTML.addEventListener('propertychange', validateCode);
return this._domApply.addEventListener('click', (function(_this) {
return function(ev) {
var cssClass;
ev.preventDefault();
cssClass = _this._domApply.getAttribute('class');
if (cssClass.indexOf('ct-control--muted') === -1) {
return _this.save();
}
};
})(this));
};
return PropertiesDialog;
})(ContentTools.DialogUI);
StyleUI = (function(_super) {
__extends(StyleUI, _super);
function StyleUI(style, applied) {
this.style = style;
StyleUI.__super__.constructor.call(this);
this._applied = applied;
}
StyleUI.prototype.applied = function(applied) {
if (applied === void 0) {
return this._applied;
}
if (this._applied === applied) {
return;
}
this._applied = applied;
if (this._applied) {
return ContentEdit.addCSSClass(this._domElement, 'ct-section--applied');
} else {
return ContentEdit.removeCSSClass(this._domElement, 'ct-section--applied');
}
};
StyleUI.prototype.mount = function(domParent, before) {
var label;
if (before == null) {
before = null;
}
this._domElement = this.constructor.createDiv(['ct-section']);
if (this._applied) {
ContentEdit.addCSSClass(this._domElement, 'ct-section--applied');
}
label = this.constructor.createDiv(['ct-section__label']);
label.textContent = this.style.name();
this._domElement.appendChild(label);
this._domElement.appendChild(this.constructor.createDiv(['ct-section__switch']));
return StyleUI.__super__.mount.call(this, domParent, before);
};
StyleUI.prototype._addDOMEventListeners = function() {
var toggleSection;
toggleSection = (function(_this) {
return function(ev) {
ev.preventDefault();
if (_this.applied()) {
return _this.applied(false);
} else {
return _this.applied(true);
}
};
})(this);
return this._domElement.addEventListener('click', toggleSection);
};
return StyleUI;
})(ContentTools.AnchoredComponentUI);
AttributeUI = (function(_super) {
__extends(AttributeUI, _super);
function AttributeUI(name, value) {
AttributeUI.__super__.constructor.call(this);
this._initialName = name;
this._initialValue = value;
}
AttributeUI.prototype.name = function() {
return this._domName.value.trim();
};
AttributeUI.prototype.value = function() {
return this._domValue.value.trim();
};
AttributeUI.prototype.mount = function(domParent, before) {
if (before == null) {
before = null;
}
this._domElement = this.constructor.createDiv(['ct-attribute']);
this._domName = document.createElement('input');
this._domName.setAttribute('class', 'ct-attribute__name');
this._domName.setAttribute('name', 'name');
this._domName.setAttribute('placeholder', ContentEdit._('Name'));
this._domName.setAttribute('type', 'text');
this._domName.setAttribute('value', this._initialName);
this._domElement.appendChild(this._domName);
this._domValue = document.createElement('input');
this._domValue.setAttribute('class', 'ct-attribute__value');
this._domValue.setAttribute('name', 'value');
this._domValue.setAttribute('placeholder', ContentEdit._('Value'));
this._domValue.setAttribute('type', 'text');
this._domValue.setAttribute('value', this._initialValue);
this._domElement.appendChild(this._domValue);
return AttributeUI.__super__.mount.call(this, domParent, before);
};
AttributeUI.prototype.valid = function(valid) {
if (valid) {
return ContentEdit.removeCSSClass(this._domName, 'ct-attribute__name--invalid');
} else {
return ContentEdit.addCSSClass(this._domName, 'ct-attribute__name--invalid');
}
};
AttributeUI.prototype._addDOMEventListeners = function() {
this._domName.addEventListener('blur', (function(_this) {
return function() {
var name, nextDomAttribute, nextNameDom;
name = _this.name();
nextDomAttribute = _this._domElement.nextSibling;
_this.dispatchEvent(_this.createEvent('blur'));
if (name === '' && nextDomAttribute) {
nextNameDom = nextDomAttribute.querySelector('.ct-attribute__name');
return nextNameDom.focus();
}
};
})(this));
this._domName.addEventListener('focus', (function(_this) {
return function() {
return _this.dispatchEvent(_this.createEvent('focus'));
};
})(this));
this._domName.addEventListener('input', (function(_this) {
return function() {
return _this.dispatchEvent(_this.createEvent('namechange'));
};
})(this));
this._domName.addEventListener('keydown', (function(_this) {
return function(ev) {
if (ev.keyCode === 13) {
return _this._domValue.focus();
}
};
})(this));
this._domValue.addEventListener('blur', (function(_this) {
return function() {
return _this.dispatchEvent(_this.createEvent('blur'));
};
})(this));
this._domValue.addEventListener('focus', (function(_this) {
return function() {
return _this.dispatchEvent(_this.createEvent('focus'));
};
})(this));
return this._domValue.addEventListener('keydown', (function(_this) {
return function(ev) {
var nextDomAttribute, nextNameDom;
if (ev.keyCode !== 13 && (ev.keyCode !== 9 || ev.shiftKey)) {
return;
}
ev.preventDefault();
nextDomAttribute = _this._domElement.nextSibling;
if (!nextDomAttribute) {
_this._domValue.blur();
nextDomAttribute = _this._domElement.nextSibling;
}
if (nextDomAttribute) {
nextNameDom = nextDomAttribute.querySelector('.ct-attribute__name');
return nextNameDom.focus();
}
};
})(this));
};
return AttributeUI;
})(ContentTools.AnchoredComponentUI);
ContentTools.TableDialog = (function(_super) {
__extends(TableDialog, _super);
function TableDialog(table) {
this.table = table;
if (this.table) {
TableDialog.__super__.constructor.call(this, 'Update table');
} else {
TableDialog.__super__.constructor.call(this, 'Insert table');
}
}
TableDialog.prototype.mount = function() {
var cfg, domBodyLabel, domControlGroup, domFootLabel, domHeadLabel, footCSSClasses, headCSSClasses;
TableDialog.__super__.mount.call(this);
cfg = {
columns: 3,
foot: false,
head: true
};
if (this.table) {
cfg = {
columns: this.table.firstSection().children[0].children.length,
foot: this.table.tfoot(),
head: this.table.thead()
};
}
ContentEdit.addCSSClass(this._domElement, 'ct-table-dialog');
ContentEdit.addCSSClass(this._domView, 'ct-table-dialog__view');
headCSSClasses = ['ct-section'];
if (cfg.head) {
headCSSClasses.push('ct-section--applied');
}
this._domHeadSection = this.constructor.createDiv(headCSSClasses);
this._domView.appendChild(this._domHeadSection);
domHeadLabel = this.constructor.createDiv(['ct-section__label']);
domHeadLabel.textContent = ContentEdit._('Table head');
this._domHeadSection.appendChild(domHeadLabel);
this._domHeadSwitch = this.constructor.createDiv(['ct-section__switch']);
this._domHeadSection.appendChild(this._domHeadSwitch);
this._domBodySection = this.constructor.createDiv(['ct-section', 'ct-section--applied', 'ct-section--contains-input']);
this._domView.appendChild(this._domBodySection);
domBodyLabel = this.constructor.createDiv(['ct-section__label']);
domBodyLabel.textContent = ContentEdit._('Table body (columns)');
this._domBodySection.appendChild(domBodyLabel);
this._domBodyInput = document.createElement('input');
this._domBodyInput.setAttribute('class', 'ct-section__input');
this._domBodyInput.setAttribute('maxlength', '2');
this._domBodyInput.setAttribute('name', 'columns');
this._domBodyInput.setAttribute('type', 'text');
this._domBodyInput.setAttribute('value', cfg.columns);
this._domBodySection.appendChild(this._domBodyInput);
footCSSClasses = ['ct-section'];
if (cfg.foot) {
footCSSClasses.push('ct-section--applied');
}
this._domFootSection = this.constructor.createDiv(footCSSClasses);
this._domView.appendChild(this._domFootSection);
domFootLabel = this.constructor.createDiv(['ct-section__label']);
domFootLabel.textContent = ContentEdit._('Table foot');
this._domFootSection.appendChild(domFootLabel);
this._domFootSwitch = this.constructor.createDiv(['ct-section__switch']);
this._domFootSection.appendChild(this._domFootSwitch);
domControlGroup = this.constructor.createDiv(['ct-control-group', 'ct-control-group--right']);
this._domControls.appendChild(domControlGroup);
this._domApply = this.constructor.createDiv(['ct-control', 'ct-control--text', 'ct-control--apply']);
this._domApply.textContent = 'Apply';
domControlGroup.appendChild(this._domApply);
return this._addDOMEventListeners();
};
TableDialog.prototype.save = function() {
var detail, footCSSClass, headCSSClass;
footCSSClass = this._domFootSection.getAttribute('class');
headCSSClass = this._domHeadSection.getAttribute('class');
detail = {
columns: parseInt(this._domBodyInput.value),
foot: footCSSClass.indexOf('ct-section--applied') > -1,
head: headCSSClass.indexOf('ct-section--applied') > -1
};
return this.dispatchEvent(this.createEvent('save', detail));
};
TableDialog.prototype.unmount = function() {
TableDialog.__super__.unmount.call(this);
this._domBodyInput = null;
this._domBodySection = null;
this._domApply = null;
this._domHeadSection = null;
this._domHeadSwitch = null;
this._domFootSection = null;
return this._domFootSwitch = null;
};
TableDialog.prototype._addDOMEventListeners = function() {
var toggleSection;
TableDialog.__super__._addDOMEventListeners.call(this);
toggleSection = function(ev) {
ev.preventDefault();
if (this.getAttribute('class').indexOf('ct-section--applied') > -1) {
return ContentEdit.removeCSSClass(this, 'ct-section--applied');
} else {
return ContentEdit.addCSSClass(this, 'ct-section--applied');
}
};
this._domHeadSection.addEventListener('click', toggleSection);
this._domFootSection.addEventListener('click', toggleSection);
this._domBodySection.addEventListener('click', (function(_this) {
return function(ev) {
return _this._domBodyInput.focus();
};
})(this));
this._domBodyInput.addEventListener('input', (function(_this) {
return function(ev) {
var valid;
valid = /^[1-9]\d{0,1}$/.test(ev.target.value);
if (valid) {
ContentEdit.removeCSSClass(_this._domBodyInput, 'ct-section__input--invalid');
return ContentEdit.removeCSSClass(_this._domApply, 'ct-control--muted');
} else {
ContentEdit.addCSSClass(_this._domBodyInput, 'ct-section__input--invalid');
return ContentEdit.addCSSClass(_this._domApply, 'ct-control--muted');
}
};
})(this));
return this._domApply.addEventListener('click', (function(_this) {
return function(ev) {
var cssClass;
ev.preventDefault();
cssClass = _this._domApply.getAttribute('class');
if (cssClass.indexOf('ct-control--muted') === -1) {
return _this.save();
}
};
})(this));
};
return TableDialog;
})(ContentTools.DialogUI);
ContentTools.VideoDialog = (function(_super) {
__extends(VideoDialog, _super);
function VideoDialog() {
VideoDialog.__super__.constructor.call(this, 'Insert video');
}
VideoDialog.prototype.clearPreview = function() {
if (this._domPreview) {
this._domPreview.parentNode.removeChild(this._domPreview);
return this._domPreview = void 0;
}
};
VideoDialog.prototype.mount = function() {
var domControlGroup;
VideoDialog.__super__.mount.call(this);
ContentEdit.addCSSClass(this._domElement, 'ct-video-dialog');
ContentEdit.addCSSClass(this._domView, 'ct-video-dialog__preview');
domControlGroup = this.constructor.createDiv(['ct-control-group']);
this._domControls.appendChild(domControlGroup);
this._domInput = document.createElement('input');
this._domInput.setAttribute('class', 'ct-video-dialog__input');
this._domInput.setAttribute('name', 'url');
this._domInput.setAttribute('placeholder', ContentEdit._('Paste YouTube or Vimeo URL') + '...');
this._domInput.setAttribute('type', 'text');
domControlGroup.appendChild(this._domInput);
this._domButton = this.constructor.createDiv(['ct-control', 'ct-control--text', 'ct-control--insert', 'ct-control--muted']);
this._domButton.textContent = ContentEdit._('Insert');
domControlGroup.appendChild(this._domButton);
return this._addDOMEventListeners();
};
VideoDialog.prototype.preview = function(url) {
this.clearPreview();
this._domPreview = document.createElement('iframe');
this._domPreview.setAttribute('frameborder', '0');
this._domPreview.setAttribute('height', '100%');
this._domPreview.setAttribute('src', url);
this._domPreview.setAttribute('width', '100%');
return this._domView.appendChild(this._domPreview);
};
VideoDialog.prototype.save = function() {
var embedURL, videoURL;
videoURL = this._domInput.value.trim();
embedURL = ContentTools.getEmbedVideoURL(videoURL);
if (embedURL) {
return this.dispatchEvent(this.createEvent('save', {
'url': embedURL
}));
} else {
return this.dispatchEvent(this.createEvent('save', {
'url': videoURL
}));
}
};
VideoDialog.prototype.show = function() {
VideoDialog.__super__.show.call(this);
return this._domInput.focus();
};
VideoDialog.prototype.unmount = function() {
if (this.isMounted()) {
this._domInput.blur();
}
VideoDialog.__super__.unmount.call(this);
this._domButton = null;
this._domInput = null;
return this._domPreview = null;
};
VideoDialog.prototype._addDOMEventListeners = function() {
VideoDialog.__super__._addDOMEventListeners.call(this);
this._domInput.addEventListener('input', (function(_this) {
return function(ev) {
var updatePreview;
if (ev.target.value) {
ContentEdit.removeCSSClass(_this._domButton, 'ct-control--muted');
} else {
ContentEdit.addCSSClass(_this._domButton, 'ct-control--muted');
}
if (_this._updatePreviewTimeout) {
clearTimeout(_this._updatePreviewTimeout);
}
updatePreview = function() {
var embedURL, videoURL;
videoURL = _this._domInput.value.trim();
embedURL = ContentTools.getEmbedVideoURL(videoURL);
if (embedURL) {
return _this.preview(embedURL);
} else {
return _this.clearPreview();
}
};
return _this._updatePreviewTimeout = setTimeout(updatePreview, 500);
};
})(this));
this._domInput.addEventListener('keypress', (function(_this) {
return function(ev) {
if (ev.keyCode === 13) {
return _this.save();
}
};
})(this));
return this._domButton.addEventListener('click', (function(_this) {
return function(ev) {
var cssClass;
ev.preventDefault();
cssClass = _this._domButton.getAttribute('class');
if (cssClass.indexOf('ct-control--muted') === -1) {
return _this.save();
}
};
})(this));
};
return VideoDialog;
})(ContentTools.DialogUI);
_EditorApp = (function(_super) {
__extends(_EditorApp, _super);
function _EditorApp() {
_EditorApp.__super__.constructor.call(this);
this.history = null;
this._state = 'dormant';
this._busy = false;
this._namingProp = null;
this._fixtureTest = function(domElement) {
return domElement.hasAttribute('data-fixture');
};
this._regionQuery = null;
this._domRegions = null;
this._regions = {};
this._orderedRegions = [];
this._rootLastModified = null;
this._regionsLastModified = {};
this._ignition = null;
this._inspector = null;
this._toolbox = null;
this._emptyRegionsAllowed = false;
}
_EditorApp.prototype.ctrlDown = function() {
return this._ctrlDown;
};
_EditorApp.prototype.domRegions = function() {
return this._domRegions;
};
_EditorApp.prototype.getState = function() {
return this._state;
};
_EditorApp.prototype.ignition = function() {
return this._ignition;
};
_EditorApp.prototype.inspector = function() {
return this._inspector;
};
_EditorApp.prototype.isDormant = function() {
return this._state === 'dormant';
};
_EditorApp.prototype.isReady = function() {
return this._state === 'ready';
};
_EditorApp.prototype.isEditing = function() {
return this._state === 'editing';
};
_EditorApp.prototype.orderedRegions = function() {
var name;
return (function() {
var _i, _len, _ref, _results;
_ref = this._orderedRegions;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
name = _ref[_i];
_results.push(this._regions[name]);
}
return _results;
}).call(this);
};
_EditorApp.prototype.regions = function() {
return this._regions;
};
_EditorApp.prototype.shiftDown = function() {
return this._shiftDown;
};
_EditorApp.prototype.toolbox = function() {
return this._toolbox;
};
_EditorApp.prototype.busy = function(busy) {
if (busy === void 0) {
this._busy = busy;
}
this._busy = busy;
if (this._ignition) {
return this._ignition.busy(busy);
}
};
_EditorApp.prototype.createPlaceholderElement = function(region) {
return new ContentEdit.Text('p', {}, '');
};
_EditorApp.prototype.init = function(queryOrDOMElements, namingProp, fixtureTest, withIgnition) {
if (namingProp == null) {
namingProp = 'id';
}
if (fixtureTest == null) {
fixtureTest = null;
}
if (withIgnition == null) {
withIgnition = true;
}
this._namingProp = namingProp;
if (fixtureTest) {
this._fixtureTest = fixtureTest;
}
this.mount();
if (withIgnition) {
this._ignition = new ContentTools.IgnitionUI();
this.attach(this._ignition);
this._ignition.addEventListener('edit', (function(_this) {
return function(ev) {
ev.preventDefault();
_this.start();
return _this._ignition.state('editing');
};
})(this));
this._ignition.addEventListener('confirm', (function(_this) {
return function(ev) {
ev.preventDefault();
if (_this._ignition.state() !== 'editing') {
return;
}
_this._ignition.state('ready');
return _this.stop(true);
};
})(this));
this._ignition.addEventListener('cancel', (function(_this) {
return function(ev) {
ev.preventDefault();
if (_this._ignition.state() !== 'editing') {
return;
}
_this.stop(false);
if (_this.isEditing()) {
return _this._ignition.state('editing');
} else {
return _this._ignition.state('ready');
}
};
})(this));
}
this._toolbox = new ContentTools.ToolboxUI(ContentTools.DEFAULT_TOOLS);
this.attach(this._toolbox);
this._inspector = new ContentTools.InspectorUI();
this.attach(this._inspector);
this._state = 'ready';
this._handleDetach = (function(_this) {
return function(element) {
return _this._preventEmptyRegions();
};
})(this);
this._handleClipboardPaste = (function(_this) {
return function(element, ev) {
var clipboardData;
clipboardData = null;
if (ev.clipboardData) {
clipboardData = ev.clipboardData.getData('text/plain');
}
if (window.clipboardData) {
clipboardData = window.clipboardData.getData('TEXT');
}
return _this.paste(element, clipboardData);
};
})(this);
this._handleNextRegionTransition = (function(_this) {
return function(region) {
var child, element, index, regions, _i, _len, _ref;
regions = _this.orderedRegions();
index = regions.indexOf(region);
if (index >= (regions.length - 1)) {
return;
}
region = regions[index + 1];
element = null;
_ref = region.descendants();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
child = _ref[_i];
if (child.content !== void 0) {
element = child;
break;
}
}
if (element) {
element.focus();
element.selection(new ContentSelect.Range(0, 0));
return;
}
return ContentEdit.Root.get().trigger('next-region', region);
};
})(this);
this._handlePreviousRegionTransition = (function(_this) {
return function(region) {
var child, descendants, element, index, length, regions, _i, _len;
regions = _this.orderedRegions();
index = regions.indexOf(region);
if (index <= 0) {
return;
}
region = regions[index - 1];
element = null;
descendants = region.descendants();
descendants.reverse();
for (_i = 0, _len = descendants.length; _i < _len; _i++) {
child = descendants[_i];
if (child.content !== void 0) {
element = child;
break;
}
}
if (element) {
length = element.content.length();
element.focus();
element.selection(new ContentSelect.Range(length, length));
return;
}
return ContentEdit.Root.get().trigger('previous-region', region);
};
})(this);
ContentEdit.Root.get().bind('detach', this._handleDetach);
ContentEdit.Root.get().bind('paste', this._handleClipboardPaste);
ContentEdit.Root.get().bind('next-region', this._handleNextRegionTransition);
ContentEdit.Root.get().bind('previous-region', this._handlePreviousRegionTransition);
return this.syncRegions(queryOrDOMElements);
};
_EditorApp.prototype.destroy = function() {
ContentEdit.Root.get().unbind('detach', this._handleDetach);
ContentEdit.Root.get().unbind('paste', this._handleClipboardPaste);
ContentEdit.Root.get().unbind('next-region', this._handleNextRegionTransition);
ContentEdit.Root.get().unbind('previous-region', this._handlePreviousRegionTransition);
this.removeEventListener();
this.unmount();
return this._children = [];
};
_EditorApp.prototype.highlightRegions = function(highlight) {
var domRegion, _i, _len, _ref, _results;
_ref = this._domRegions;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
domRegion = _ref[_i];
if (highlight) {
_results.push(ContentEdit.addCSSClass(domRegion, 'ct--highlight'));
} else {
_results.push(ContentEdit.removeCSSClass(domRegion, 'ct--highlight'));
}
}
return _results;
};
_EditorApp.prototype.mount = function() {
this._domElement = this.constructor.createDiv(['ct-app']);
document.body.insertBefore(this._domElement, null);
return this._addDOMEventListeners();
};
_EditorApp.prototype.paste = function(element, clipboardData) {
var character, content, cursor, encodeHTML, i, insertAt, insertIn, insertNode, item, itemText, lastItem, line, lineLength, lines, replaced, selection, spawn, tags, tail, tip, type, _i, _len;
content = clipboardData;
lines = content.split('\n');
lines = lines.filter(function(line) {
return line.trim() !== '';
});
if (!lines) {
return;
}
encodeHTML = HTMLString.String.encode;
spawn = true;
type = element.type();
if (lines.length === 1) {
spawn = false;
}
if (type === 'PreText') {
spawn = false;
}
if (!element.can('spawn')) {
spawn = false;
}
if (spawn) {
if (type === 'ListItemText') {
insertNode = element.parent();
insertIn = element.parent().parent();
insertAt = insertIn.children.indexOf(insertNode) + 1;
} else {
insertNode = element;
if (insertNode.parent().type() !== 'Region') {
insertNode = element.closest(function(node) {
return node.parent().type() === 'Region';
});
}
insertIn = insertNode.parent();
insertAt = insertIn.children.indexOf(insertNode) + 1;
}
for (i = _i = 0, _len = lines.length; _i < _len; i = ++_i) {
line = lines[i];
line = encodeHTML(line);
if (type === 'ListItemText') {
item = new ContentEdit.ListItem();
itemText = new ContentEdit.ListItemText(line);
item.attach(itemText);
lastItem = itemText;
} else {
item = new ContentEdit.Text('p', {}, line);
lastItem = item;
}
insertIn.attach(item, insertAt + i);
}
lineLength = lastItem.content.length();
lastItem.focus();
return lastItem.selection(new ContentSelect.Range(lineLength, lineLength));
} else {
content = encodeHTML(content);
content = new HTMLString.String(content, type === 'PreText');
selection = element.selection();
cursor = selection.get()[0] + content.length();
tip = element.content.substring(0, selection.get()[0]);
tail = element.content.substring(selection.get()[1]);
replaced = element.content.substring(selection.get()[0], selection.get()[1]);
if (replaced.length()) {
character = replaced.characters[0];
tags = character.tags();
if (character.isTag()) {
tags.shift();
}
if (tags.length >= 1) {
content = content.format.apply(content, [0, content.length()].concat(__slice.call(tags)));
}
}
element.content = tip.concat(content);
element.content = element.content.concat(tail, false);
element.updateInnerHTML();
element.taint();
selection.set(cursor, cursor);
return element.selection(selection);
}
};
_EditorApp.prototype.unmount = function() {
var child, _i, _len, _ref;
if (!this.isMounted()) {
return;
}
_ref = this._children;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
child = _ref[_i];
child.unmount();
}
this._domElement.parentNode.removeChild(this._domElement);
this._domElement = null;
this._removeDOMEventListeners();
this._ignition = null;
this._inspector = null;
return this._toolbox = null;
};
_EditorApp.prototype.revert = function() {
var confirmMessage;
if (!this.dispatchEvent(this.createEvent('revert'))) {
return;
}
confirmMessage = ContentEdit._('Your changes have not been saved, do you really want to lose them?');
if (ContentEdit.Root.get().lastModified() > this._rootLastModified && !window.confirm(confirmMessage)) {
return false;
}
this.revertToSnapshot(this.history.goTo(0), false);
return true;
};
_EditorApp.prototype.revertToSnapshot = function(snapshot, restoreEditable) {
var child, name, region, _i, _len, _ref, _ref1, _ref2;
if (restoreEditable == null) {
restoreEditable = true;
}
_ref = this._regions;
for (name in _ref) {
region = _ref[name];
_ref1 = region.children;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
child = _ref1[_i];
child.unmount();
}
region.domElement().innerHTML = snapshot.regions[name];
}
if (restoreEditable) {
if (ContentEdit.Root.get().focused()) {
ContentEdit.Root.get().focused().blur();
}
this._regions = {};
this.syncRegions(null, true);
ContentEdit.Root.get()._modified = snapshot.rootModified;
_ref2 = this._regions;
for (name in _ref2) {
region = _ref2[name];
if (snapshot.regionModifieds[name]) {
region._modified = snapshot.regionModifieds[name];
}
}
this.history.replaceRegions(this._regions);
this.history.restoreSelection(snapshot);
return this._inspector.updateTags();
}
};
_EditorApp.prototype.save = function(passive) {
var child, html, modifiedRegions, name, region, root, _i, _len, _ref, _ref1;
if (!this.dispatchEvent(this.createEvent('save', {
passive: passive
}))) {
return;
}
root = ContentEdit.Root.get();
if (root.lastModified() === this._rootLastModified && passive) {
this.dispatchEvent(this.createEvent('saved', {
regions: {},
passive: passive
}));
return;
}
modifiedRegions = {};
_ref = this._regions;
for (name in _ref) {
region = _ref[name];
html = region.html();
if (region.children.length === 1) {
child = region.children[0];
if (child.content && !child.content.html()) {
html = '';
}
}
if (!passive) {
_ref1 = region.children;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
child = _ref1[_i];
child.unmount();
}
region.domElement().innerHTML = html;
}
if (region.lastModified() === this._regionsLastModified[name]) {
continue;
}
modifiedRegions[name] = html;
this._regionsLastModified[name] = region.lastModified();
}
return this.dispatchEvent(this.createEvent('saved', {
regions: modifiedRegions,
passive: passive
}));
};
_EditorApp.prototype.setRegionOrder = function(regionNames) {
return this._orderedRegions = regionNames.slice();
};
_EditorApp.prototype.start = function() {
if (!this.dispatchEvent(this.createEvent('start'))) {
return;
}
this.busy(true);
this.syncRegions();
this._initRegions();
this._preventEmptyRegions();
this._rootLastModified = ContentEdit.Root.get().lastModified();
this.history = new ContentTools.History(this._regions);
this.history.watch();
this._state = 'editing';
this._toolbox.show();
this._inspector.show();
return this.busy(false);
};
_EditorApp.prototype.stop = function(save) {
var focused;
if (!this.dispatchEvent(this.createEvent('stop', {
save: save
}))) {
return;
}
focused = ContentEdit.Root.get().focused();
if (focused && focused.isMounted() && focused._syncContent !== void 0) {
focused._syncContent();
}
if (save) {
this.save();
} else {
if (!this.revert()) {
return;
}
}
this.history.stopWatching();
this.history = null;
this._toolbox.hide();
this._inspector.hide();
this._regions = {};
this._state = 'ready';
if (ContentEdit.Root.get().focused()) {
this._allowEmptyRegions((function(_this) {
return function() {
return ContentEdit.Root.get().focused().blur();
};
})(this));
}
};
_EditorApp.prototype.syncRegions = function(regionQuery, restoring) {
if (regionQuery) {
this._regionQuery = regionQuery;
}
this._domRegions = [];
if (this._regionQuery) {
if (typeof this._regionQuery === 'string' || this._regionQuery instanceof String) {
this._domRegions = document.querySelectorAll(this._regionQuery);
} else {
this._domRegions = this._regionQuery;
}
}
if (this._state === 'editing') {
this._initRegions(restoring);
this._preventEmptyRegions();
}
if (this._ignition) {
if (this._domRegions.length) {
return this._ignition.show();
} else {
return this._ignition.hide();
}
}
};
_EditorApp.prototype._addDOMEventListeners = function() {
this._handleHighlightOn = (function(_this) {
return function(ev) {
var _ref;
if ((_ref = ev.keyCode) === 17 || _ref === 224 || _ref === 91 || _ref === 93) {
_this._ctrlDown = true;
}
if (ev.keyCode === 16 && !_this._ctrlDown) {
if (_this._highlightTimeout) {
return;
}
_this._shiftDown = true;
_this._highlightTimeout = setTimeout(function() {
return _this.highlightRegions(true);
}, ContentTools.HIGHLIGHT_HOLD_DURATION);
return;
}
clearTimeout(_this._highlightTimeout);
return _this.highlightRegions(false);
};
})(this);
this._handleHighlightOff = (function(_this) {
return function(ev) {
var _ref;
if ((_ref = ev.keyCode) === 17 || _ref === 224) {
_this._ctrlDown = false;
return;
}
if (ev.keyCode === 16) {
_this._shiftDown = false;
if (_this._highlightTimeout) {
clearTimeout(_this._highlightTimeout);
_this._highlightTimeout = null;
}
return _this.highlightRegions(false);
}
};
})(this);
this._handleVisibility = (function(_this) {
return function(ev) {
if (!document.hasFocus()) {
clearTimeout(_this._highlightTimeout);
return _this.highlightRegions(false);
}
};
})(this);
document.addEventListener('keydown', this._handleHighlightOn);
document.addEventListener('keyup', this._handleHighlightOff);
document.addEventListener('visibilitychange', this._handleVisibility);
this._handleBeforeUnload = (function(_this) {
return function(ev) {
var cancelMessage;
if (_this._state === 'editing') {
cancelMessage = ContentEdit._(ContentTools.CANCEL_MESSAGE);
(ev || window.event).returnValue = cancelMessage;
return cancelMessage;
}
};
})(this);
window.addEventListener('beforeunload', this._handleBeforeUnload);
this._handleUnload = (function(_this) {
return function(ev) {
return _this.destroy();
};
})(this);
return window.addEventListener('unload', this._handleUnload);
};
_EditorApp.prototype._allowEmptyRegions = function(callback) {
this._emptyRegionsAllowed = true;
callback();
return this._emptyRegionsAllowed = false;
};
_EditorApp.prototype._preventEmptyRegions = function() {
var child, hasEditableChildren, lastModified, name, placeholder, region, _i, _len, _ref, _ref1, _results;
if (this._emptyRegionsAllowed) {
return;
}
_ref = this._regions;
_results = [];
for (name in _ref) {
region = _ref[name];
lastModified = region.lastModified();
hasEditableChildren = false;
_ref1 = region.children;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
child = _ref1[_i];
if (child.type() !== 'Static') {
hasEditableChildren = true;
break;
}
}
if (hasEditableChildren) {
continue;
}
placeholder = this.createPlaceholderElement(region);
region.attach(placeholder);
_results.push(region._modified = lastModified);
}
return _results;
};
_EditorApp.prototype._removeDOMEventListeners = function() {
document.removeEventListener('keydown', this._handleHighlightOn);
document.removeEventListener('keyup', this._handleHighlightOff);
window.removeEventListener('beforeunload', this._handleBeforeUnload);
return window.removeEventListener('unload', this._handleUnload);
};
_EditorApp.prototype._initRegions = function(restoring) {
var domRegion, found, i, index, name, region, _i, _len, _ref, _ref1, _results;
if (restoring == null) {
restoring = false;
}
found = {};
this._orderedRegions = [];
_ref = this._domRegions;
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
domRegion = _ref[i];
name = domRegion.getAttribute(this._namingProp);
if (!name) {
name = i;
}
found[name] = true;
this._orderedRegions.push(name);
if (this._regions[name] && this._regions[name].domElement() === domRegion) {
continue;
}
if (this._fixtureTest(domRegion)) {
this._regions[name] = new ContentEdit.Fixture(domRegion);
} else {
this._regions[name] = new ContentEdit.Region(domRegion);
}
if (!restoring) {
this._regionsLastModified[name] = this._regions[name].lastModified();
}
}
_ref1 = this._regions;
_results = [];
for (name in _ref1) {
region = _ref1[name];
if (found[name]) {
continue;
}
delete this._regions[name];
delete this._regionsLastModified[name];
index = this._orderedRegions.indexOf(name);
if (index > -1) {
_results.push(this._orderedRegions.splice(index, 1));
} else {
_results.push(void 0);
}
}
return _results;
};
return _EditorApp;
})(ContentTools.ComponentUI);
ContentTools.EditorApp = (function() {
var instance;
function EditorApp() {}
instance = null;
EditorApp.get = function() {
var cls;
cls = ContentTools.EditorApp.getCls();
return instance != null ? instance : instance = new cls();
};
EditorApp.getCls = function() {
return _EditorApp;
};
return EditorApp;
})();
ContentTools.History = (function() {
function History(regions) {
this._lastSnapshotTaken = null;
this._regions = {};
this.replaceRegions(regions);
this._snapshotIndex = -1;
this._snapshots = [];
this._store();
}
History.prototype.canRedo = function() {
return this._snapshotIndex < this._snapshots.length - 1;
};
History.prototype.canUndo = function() {
return this._snapshotIndex > 0;
};
History.prototype.index = function() {
return this._snapshotIndex;
};
History.prototype.length = function() {
return this._snapshots.length;
};
History.prototype.snapshot = function() {
return this._snapshots[this._snapshotIndex];
};
History.prototype.goTo = function(index) {
this._snapshotIndex = Math.min(this._snapshots.length - 1, Math.max(0, index));
return this.snapshot();
};
History.prototype.redo = function() {
return this.goTo(this._snapshotIndex + 1);
};
History.prototype.replaceRegions = function(regions) {
var k, v, _results;
this._regions = {};
_results = [];
for (k in regions) {
v = regions[k];
_results.push(this._regions[k] = v);
}
return _results;
};
History.prototype.restoreSelection = function(snapshot) {
var element, region;
if (!snapshot.selected) {
return;
}
region = this._regions[snapshot.selected.region];
element = region.descendants()[snapshot.selected.element];
element.focus();
if (element.selection && snapshot.selected.selection) {
return element.selection(snapshot.selected.selection);
}
};
History.prototype.stopWatching = function() {
if (this._watchInterval) {
clearInterval(this._watchInterval);
}
if (this._delayedStoreTimeout) {
return clearTimeout(this._delayedStoreTimeout);
}
};
History.prototype.undo = function() {
return this.goTo(this._snapshotIndex - 1);
};
History.prototype.watch = function() {
var watch;
this._lastSnapshotTaken = Date.now();
watch = (function(_this) {
return function() {
var delayedStore, lastModified;
lastModified = ContentEdit.Root.get().lastModified();
if (lastModified === null) {
return;
}
if (lastModified > _this._lastSnapshotTaken) {
if (_this._delayedStoreRequested === lastModified) {
return;
}
if (_this._delayedStoreTimeout) {
clearTimeout(_this._delayedStoreTimeout);
}
delayedStore = function() {
_this._lastSnapshotTaken = lastModified;
return _this._store();
};
_this._delayedStoreRequested = lastModified;
return _this._delayedStoreTimeout = setTimeout(delayedStore, 500);
}
};
})(this);
return this._watchInterval = setInterval(watch, 50);
};
History.prototype._store = function() {
var element, name, other_region, region, snapshot, _ref, _ref1;
snapshot = {
regions: {},
regionModifieds: {},
rootModified: ContentEdit.Root.get().lastModified(),
selected: null
};
_ref = this._regions;
for (name in _ref) {
region = _ref[name];
snapshot.regions[name] = region.html();
snapshot.regionModifieds[name] = region.lastModified();
}
element = ContentEdit.Root.get().focused();
if (element) {
snapshot.selected = {};
region = element.closest(function(node) {
return node.type() === 'Region' || node.type() === 'Fixture';
});
if (!region) {
return;
}
_ref1 = this._regions;
for (name in _ref1) {
other_region = _ref1[name];
if (region === other_region) {
snapshot.selected.region = name;
break;
}
}
snapshot.selected.element = region.descendants().indexOf(element);
if (element.selection) {
snapshot.selected.selection = element.selection();
}
}
if (this._snapshotIndex < (this._snapshots.length - 1)) {
this._snapshots = this._snapshots.slice(0, this._snapshotIndex + 1);
}
this._snapshotIndex++;
return this._snapshots.splice(this._snapshotIndex, 0, snapshot);
};
return History;
})();
ContentTools.StylePalette = (function() {
function StylePalette() {}
StylePalette._styles = [];
StylePalette.add = function(styles) {
return this._styles = this._styles.concat(styles);
};
StylePalette.styles = function(element) {
var tagName;
if (element === void 0) {
return this._styles.slice();
}
tagName = element.tagName();
return this._styles.filter(function(style) {
if (!style._applicableTo) {
return true;
}
return style._applicableTo.indexOf(tagName) !== -1;
});
};
return StylePalette;
})();
ContentTools.Style = (function() {
function Style(name, cssClass, applicableTo) {
this._name = name;
this._cssClass = cssClass;
if (applicableTo) {
this._applicableTo = applicableTo;
} else {
this._applicableTo = null;
}
}
Style.prototype.applicableTo = function() {
return this._applicableTo;
};
Style.prototype.cssClass = function() {
return this._cssClass;
};
Style.prototype.name = function() {
return this._name;
};
return Style;
})();
ContentTools.ToolShelf = (function() {
function ToolShelf() {}
ToolShelf._tools = {};
ToolShelf.stow = function(cls, name) {
return this._tools[name] = cls;
};
ToolShelf.fetch = function(name) {
if (!this._tools[name]) {
throw new Error("`" + name + "` has not been stowed on the tool shelf");
}
return this._tools[name];
};
return ToolShelf;
})();
ContentTools.Tool = (function() {
function Tool() {}
Tool.label = 'Tool';
Tool.icon = 'tool';
Tool.requiresElement = true;
Tool.canApply = function(element, selection) {
return false;
};
Tool.isApplied = function(element, selection) {
return false;
};
Tool.apply = function(element, selection, callback) {
throw new Error('Not implemented');
};
Tool.editor = function() {
return ContentTools.EditorApp.get();
};
Tool.dispatchEditorEvent = function(name, detail) {
return this.editor().dispatchEvent(this.editor().createEvent(name, detail));
};
Tool._insertAt = function(element) {
var insertIndex, insertNode;
insertNode = element;
if (insertNode.parent().type() !== 'Region') {
insertNode = element.closest(function(node) {
return node.parent().type() === 'Region';
});
}
insertIndex = insertNode.parent().children.indexOf(insertNode) + 1;
return [insertNode, insertIndex];
};
return Tool;
})();
ContentTools.Tools.Bold = (function(_super) {
__extends(Bold, _super);
function Bold() {
return Bold.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Bold, 'bold');
Bold.label = 'Bold';
Bold.icon = 'bold';
Bold.tagName = 'b';
Bold.canApply = function(element, selection) {
if (!element.content) {
return false;
}
return selection && !selection.isCollapsed();
};
Bold.isApplied = function(element, selection) {
var from, to, _ref;
if (element.content === void 0 || !element.content.length()) {
return false;
}
_ref = selection.get(), from = _ref[0], to = _ref[1];
if (from === to) {
to += 1;
}
return element.content.slice(from, to).hasTags(this.tagName, true);
};
Bold.apply = function(element, selection, callback) {
var from, to, toolDetail, _ref;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
element.storeState();
_ref = selection.get(), from = _ref[0], to = _ref[1];
if (this.isApplied(element, selection)) {
element.content = element.content.unformat(from, to, new HTMLString.Tag(this.tagName));
} else {
element.content = element.content.format(from, to, new HTMLString.Tag(this.tagName));
}
element.content.optimize();
element.updateInnerHTML();
element.taint();
element.restoreState();
callback(true);
return this.dispatchEditorEvent('tool-applied', toolDetail);
};
return Bold;
})(ContentTools.Tool);
ContentTools.Tools.Italic = (function(_super) {
__extends(Italic, _super);
function Italic() {
return Italic.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Italic, 'italic');
Italic.label = 'Italic';
Italic.icon = 'italic';
Italic.tagName = 'i';
return Italic;
})(ContentTools.Tools.Bold);
ContentTools.Tools.Link = (function(_super) {
__extends(Link, _super);
function Link() {
return Link.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Link, 'link');
Link.label = 'Link';
Link.icon = 'link';
Link.tagName = 'a';
Link.getAttr = function(attrName, element, selection) {
var c, from, selectedContent, tag, to, _i, _j, _len, _len1, _ref, _ref1, _ref2;
if (element.type() === 'Image') {
if (element.a) {
return element.a[attrName];
}
} else {
_ref = selection.get(), from = _ref[0], to = _ref[1];
selectedContent = element.content.slice(from, to);
_ref1 = selectedContent.characters;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
c = _ref1[_i];
if (!c.hasTags('a')) {
continue;
}
_ref2 = c.tags();
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
tag = _ref2[_j];
if (tag.name() === 'a') {
return tag.attr(attrName);
}
}
}
}
return '';
};
Link.canApply = function(element, selection) {
var character;
if (element.type() === 'Image') {
return true;
} else {
if (!element.content) {
return false;
}
if (!selection) {
return false;
}
if (selection.isCollapsed()) {
character = element.content.characters[selection.get()[0]];
if (!character || !character.hasTags('a')) {
return false;
}
}
return true;
}
};
Link.isApplied = function(element, selection) {
if (element.type() === 'Image') {
return element.a;
} else {
return Link.__super__.constructor.isApplied.call(this, element, selection);
}
};
Link.apply = function(element, selection, callback) {
var allowScrolling, app, applied, characters, dialog, domElement, ends, from, measureSpan, modal, rect, scrollX, scrollY, selectTag, starts, to, toolDetail, transparent, _ref, _ref1;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
applied = false;
if (element.type() === 'Image') {
rect = element.domElement().getBoundingClientRect();
} else {
if (selection.isCollapsed()) {
characters = element.content.characters;
starts = selection.get(0)[0];
ends = starts;
while (starts > 0 && characters[starts - 1].hasTags('a')) {
starts -= 1;
}
while (ends < characters.length && characters[ends].hasTags('a')) {
ends += 1;
}
selection = new ContentSelect.Range(starts, ends);
selection.select(element.domElement());
}
element.storeState();
selectTag = new HTMLString.Tag('span', {
'class': 'ct--puesdo-select'
});
_ref = selection.get(), from = _ref[0], to = _ref[1];
element.content = element.content.format(from, to, selectTag);
element.updateInnerHTML();
domElement = element.domElement();
measureSpan = domElement.getElementsByClassName('ct--puesdo-select');
rect = measureSpan[0].getBoundingClientRect();
}
app = ContentTools.EditorApp.get();
modal = new ContentTools.ModalUI(transparent = true, allowScrolling = true);
modal.addEventListener('click', function() {
this.unmount();
dialog.hide();
if (element.content) {
element.content = element.content.unformat(from, to, selectTag);
element.updateInnerHTML();
element.restoreState();
}
callback(applied);
if (applied) {
return ContentTools.Tools.Link.dispatchEditorEvent('tool-applied', toolDetail);
}
});
dialog = new ContentTools.LinkDialog(this.getAttr('href', element, selection), this.getAttr('target', element, selection));
_ref1 = ContentTools.getScrollPosition(), scrollX = _ref1[0], scrollY = _ref1[1];
dialog.position([rect.left + (rect.width / 2) + scrollX, rect.top + (rect.height / 2) + scrollY]);
dialog.addEventListener('save', function(ev) {
var a, alignmentClassNames, className, detail, linkClasses, _i, _j, _len, _len1;
detail = ev.detail();
applied = true;
if (element.type() === 'Image') {
alignmentClassNames = ['align-center', 'align-left', 'align-right'];
if (detail.href) {
element.a = {
href: detail.href
};
if (element.a) {
element.a["class"] = element.a['class'];
}
if (detail.target) {
element.a.target = detail.target;
}
for (_i = 0, _len = alignmentClassNames.length; _i < _len; _i++) {
className = alignmentClassNames[_i];
if (element.hasCSSClass(className)) {
element.removeCSSClass(className);
element.a['class'] = className;
break;
}
}
} else {
linkClasses = [];
if (element.a['class']) {
linkClasses = element.a['class'].split(' ');
}
for (_j = 0, _len1 = alignmentClassNames.length; _j < _len1; _j++) {
className = alignmentClassNames[_j];
if (linkClasses.indexOf(className) > -1) {
element.addCSSClass(className);
break;
}
}
element.a = null;
}
element.unmount();
element.mount();
} else {
element.content = element.content.unformat(from, to, 'a');
if (detail.href) {
a = new HTMLString.Tag('a', detail);
element.content = element.content.format(from, to, a);
element.content.optimize();
}
element.updateInnerHTML();
}
element.taint();
return modal.dispatchEvent(modal.createEvent('click'));
});
app.attach(modal);
app.attach(dialog);
modal.show();
return dialog.show();
};
return Link;
})(ContentTools.Tools.Bold);
ContentTools.Tools.Heading = (function(_super) {
__extends(Heading, _super);
function Heading() {
return Heading.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Heading, 'heading');
Heading.label = 'Heading';
Heading.icon = 'heading';
Heading.tagName = 'h1';
Heading.canApply = function(element, selection) {
if (element.isFixed()) {
return false;
}
return element.content !== void 0 && ['Text', 'PreText'].indexOf(element.type()) !== -1;
};
Heading.isApplied = function(element, selection) {
if (!element.content) {
return false;
}
if (['Text', 'PreText'].indexOf(element.type()) === -1) {
return false;
}
return element.tagName() === this.tagName;
};
Heading.apply = function(element, selection, callback) {
var content, insertAt, parent, textElement, toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
element.storeState();
if (element.type() === 'PreText') {
content = element.content.html().replace(/ /g, ' ');
textElement = new ContentEdit.Text(this.tagName, {}, content);
parent = element.parent();
insertAt = parent.children.indexOf(element);
parent.detach(element);
parent.attach(textElement, insertAt);
element.blur();
textElement.focus();
textElement.selection(selection);
} else {
element.removeAttr('class');
if (element.tagName() === this.tagName) {
element.tagName('p');
} else {
element.tagName(this.tagName);
}
element.restoreState();
}
this.dispatchEditorEvent('tool-applied', toolDetail);
return callback(true);
};
return Heading;
})(ContentTools.Tool);
ContentTools.Tools.Subheading = (function(_super) {
__extends(Subheading, _super);
function Subheading() {
return Subheading.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Subheading, 'subheading');
Subheading.label = 'Subheading';
Subheading.icon = 'subheading';
Subheading.tagName = 'h2';
return Subheading;
})(ContentTools.Tools.Heading);
ContentTools.Tools.Paragraph = (function(_super) {
__extends(Paragraph, _super);
function Paragraph() {
return Paragraph.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Paragraph, 'paragraph');
Paragraph.label = 'Paragraph';
Paragraph.icon = 'paragraph';
Paragraph.tagName = 'p';
Paragraph.canApply = function(element, selection) {
if (element.isFixed()) {
return false;
}
return element !== void 0;
};
Paragraph.apply = function(element, selection, callback) {
var forceAdd, paragraph, region, toolDetail;
forceAdd = this.editor().ctrlDown();
if (ContentTools.Tools.Heading.canApply(element) && !forceAdd) {
return Paragraph.__super__.constructor.apply.call(this, element, selection, callback);
} else {
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
if (element.parent().type() !== 'Region') {
element = element.closest(function(node) {
return node.parent().type() === 'Region';
});
}
region = element.parent();
paragraph = new ContentEdit.Text('p');
region.attach(paragraph, region.children.indexOf(element) + 1);
paragraph.focus();
callback(true);
return this.dispatchEditorEvent('tool-applied', toolDetail);
}
};
return Paragraph;
})(ContentTools.Tools.Heading);
ContentTools.Tools.Preformatted = (function(_super) {
__extends(Preformatted, _super);
function Preformatted() {
return Preformatted.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Preformatted, 'preformatted');
Preformatted.label = 'Preformatted';
Preformatted.icon = 'preformatted';
Preformatted.tagName = 'pre';
Preformatted.apply = function(element, selection, callback) {
var insertAt, parent, preText, text, toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
if (element.type() === 'PreText') {
ContentTools.Tools.Paragraph.apply(element, selection, callback);
return;
}
text = element.content.text();
preText = new ContentEdit.PreText('pre', {}, HTMLString.String.encode(text));
parent = element.parent();
insertAt = parent.children.indexOf(element);
parent.detach(element);
parent.attach(preText, insertAt);
element.blur();
preText.focus();
preText.selection(selection);
callback(true);
return this.dispatchEditorEvent('tool-applied', toolDetail);
};
return Preformatted;
})(ContentTools.Tools.Heading);
ContentTools.Tools.AlignLeft = (function(_super) {
__extends(AlignLeft, _super);
function AlignLeft() {
return AlignLeft.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(AlignLeft, 'align-left');
AlignLeft.label = 'Align left';
AlignLeft.icon = 'align-left';
AlignLeft.className = 'text-left';
AlignLeft.canApply = function(element, selection) {
return element.content !== void 0;
};
AlignLeft.isApplied = function(element, selection) {
var _ref;
if (!this.canApply(element)) {
return false;
}
if ((_ref = element.type()) === 'ListItemText' || _ref === 'TableCellText') {
element = element.parent();
}
return element.hasCSSClass(this.className);
};
AlignLeft.apply = function(element, selection, callback) {
var alignmentClassNames, className, toolDetail, _i, _len, _ref;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
if ((_ref = element.type()) === 'ListItemText' || _ref === 'TableCellText') {
element = element.parent();
}
alignmentClassNames = [ContentTools.Tools.AlignLeft.className, ContentTools.Tools.AlignCenter.className, ContentTools.Tools.AlignRight.className];
for (_i = 0, _len = alignmentClassNames.length; _i < _len; _i++) {
className = alignmentClassNames[_i];
if (element.hasCSSClass(className)) {
element.removeCSSClass(className);
if (className === this.className) {
return callback(true);
}
}
}
element.addCSSClass(this.className);
callback(true);
return this.dispatchEditorEvent('tool-applied', toolDetail);
};
return AlignLeft;
})(ContentTools.Tool);
ContentTools.Tools.AlignCenter = (function(_super) {
__extends(AlignCenter, _super);
function AlignCenter() {
return AlignCenter.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(AlignCenter, 'align-center');
AlignCenter.label = 'Align center';
AlignCenter.icon = 'align-center';
AlignCenter.className = 'text-center';
return AlignCenter;
})(ContentTools.Tools.AlignLeft);
ContentTools.Tools.AlignRight = (function(_super) {
__extends(AlignRight, _super);
function AlignRight() {
return AlignRight.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(AlignRight, 'align-right');
AlignRight.label = 'Align right';
AlignRight.icon = 'align-right';
AlignRight.className = 'text-right';
return AlignRight;
})(ContentTools.Tools.AlignLeft);
ContentTools.Tools.UnorderedList = (function(_super) {
__extends(UnorderedList, _super);
function UnorderedList() {
return UnorderedList.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(UnorderedList, 'unordered-list');
UnorderedList.label = 'Bullet list';
UnorderedList.icon = 'unordered-list';
UnorderedList.listTag = 'ul';
UnorderedList.canApply = function(element, selection) {
var _ref;
if (element.isFixed()) {
return false;
}
return element.content !== void 0 && ((_ref = element.parent().type()) === 'Region' || _ref === 'ListItem');
};
UnorderedList.apply = function(element, selection, callback) {
var insertAt, list, listItem, listItemText, parent, toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
if (element.parent().type() === 'ListItem') {
element.storeState();
list = element.closest(function(node) {
return node.type() === 'List';
});
list.tagName(this.listTag);
element.restoreState();
} else {
listItemText = new ContentEdit.ListItemText(element.content.copy());
listItem = new ContentEdit.ListItem();
listItem.attach(listItemText);
list = new ContentEdit.List(this.listTag, {});
list.attach(listItem);
parent = element.parent();
insertAt = parent.children.indexOf(element);
parent.detach(element);
parent.attach(list, insertAt);
listItemText.focus();
listItemText.selection(selection);
}
callback(true);
return this.dispatchEditorEvent('tool-applied', toolDetail);
};
return UnorderedList;
})(ContentTools.Tool);
ContentTools.Tools.OrderedList = (function(_super) {
__extends(OrderedList, _super);
function OrderedList() {
return OrderedList.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(OrderedList, 'ordered-list');
OrderedList.label = 'Numbers list';
OrderedList.icon = 'ordered-list';
OrderedList.listTag = 'ol';
return OrderedList;
})(ContentTools.Tools.UnorderedList);
ContentTools.Tools.Table = (function(_super) {
__extends(Table, _super);
function Table() {
return Table.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Table, 'table');
Table.label = 'Table';
Table.icon = 'table';
Table.canApply = function(element, selection) {
if (element.isFixed()) {
return false;
}
return element !== void 0;
};
Table.apply = function(element, selection, callback) {
var app, dialog, modal, table, toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
if (element.storeState) {
element.storeState();
}
app = ContentTools.EditorApp.get();
modal = new ContentTools.ModalUI();
table = element.closest(function(node) {
return node && node.type() === 'Table';
});
dialog = new ContentTools.TableDialog(table);
dialog.addEventListener('cancel', (function(_this) {
return function() {
modal.hide();
dialog.hide();
if (element.restoreState) {
element.restoreState();
}
return callback(false);
};
})(this));
dialog.addEventListener('save', (function(_this) {
return function(ev) {
var index, keepFocus, node, tableCfg, _ref;
tableCfg = ev.detail();
keepFocus = true;
if (table) {
_this._updateTable(tableCfg, table);
keepFocus = element.closest(function(node) {
return node && node.type() === 'Table';
});
} else {
table = _this._createTable(tableCfg);
_ref = _this._insertAt(element), node = _ref[0], index = _ref[1];
node.parent().attach(table, index);
keepFocus = false;
}
if (keepFocus) {
element.restoreState();
} else {
table.firstSection().children[0].children[0].children[0].focus();
}
modal.hide();
dialog.hide();
callback(true);
return _this.dispatchEditorEvent('tool-applied', toolDetail);
};
})(this));
app.attach(modal);
app.attach(dialog);
modal.show();
return dialog.show();
};
Table._adjustColumns = function(section, columns) {
var cell, cellTag, cellText, currentColumns, diff, i, row, _i, _len, _ref, _results;
_ref = section.children;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
row = _ref[_i];
cellTag = row.children[0].tagName();
currentColumns = row.children.length;
diff = columns - currentColumns;
if (diff < 0) {
_results.push((function() {
var _j, _results1;
_results1 = [];
for (i = _j = diff; diff <= 0 ? _j < 0 : _j > 0; i = diff <= 0 ? ++_j : --_j) {
cell = row.children[row.children.length - 1];
_results1.push(row.detach(cell));
}
return _results1;
})());
} else if (diff > 0) {
_results.push((function() {
var _j, _results1;
_results1 = [];
for (i = _j = 0; 0 <= diff ? _j < diff : _j > diff; i = 0 <= diff ? ++_j : --_j) {
cell = new ContentEdit.TableCell(cellTag);
row.attach(cell);
cellText = new ContentEdit.TableCellText('');
_results1.push(cell.attach(cellText));
}
return _results1;
})());
} else {
_results.push(void 0);
}
}
return _results;
};
Table._createTable = function(tableCfg) {
var body, foot, head, table;
table = new ContentEdit.Table();
if (tableCfg.head) {
head = this._createTableSection('thead', 'th', tableCfg.columns);
table.attach(head);
}
body = this._createTableSection('tbody', 'td', tableCfg.columns);
table.attach(body);
if (tableCfg.foot) {
foot = this._createTableSection('tfoot', 'td', tableCfg.columns);
table.attach(foot);
}
return table;
};
Table._createTableSection = function(sectionTag, cellTag, columns) {
var cell, cellText, i, row, section, _i;
section = new ContentEdit.TableSection(sectionTag);
row = new ContentEdit.TableRow();
section.attach(row);
for (i = _i = 0; 0 <= columns ? _i < columns : _i > columns; i = 0 <= columns ? ++_i : --_i) {
cell = new ContentEdit.TableCell(cellTag);
row.attach(cell);
cellText = new ContentEdit.TableCellText('');
cell.attach(cellText);
}
return section;
};
Table._updateTable = function(tableCfg, table) {
var columns, foot, head, section, _i, _len, _ref;
if (!tableCfg.head && table.thead()) {
table.detach(table.thead());
}
if (!tableCfg.foot && table.tfoot()) {
table.detach(table.tfoot());
}
columns = table.firstSection().children[0].children.length;
if (tableCfg.columns !== columns) {
_ref = table.children;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
section = _ref[_i];
this._adjustColumns(section, tableCfg.columns);
}
}
if (tableCfg.head && !table.thead()) {
head = this._createTableSection('thead', 'th', tableCfg.columns);
table.attach(head);
}
if (tableCfg.foot && !table.tfoot()) {
foot = this._createTableSection('tfoot', 'td', tableCfg.columns);
return table.attach(foot);
}
};
return Table;
})(ContentTools.Tool);
ContentTools.Tools.Indent = (function(_super) {
__extends(Indent, _super);
function Indent() {
return Indent.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Indent, 'indent');
Indent.label = 'Indent';
Indent.icon = 'indent';
Indent.canApply = function(element, selection) {
return element.parent().type() === 'ListItem' && element.parent().parent().children.indexOf(element.parent()) > 0;
};
Indent.apply = function(element, selection, callback) {
var toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
element.parent().indent();
callback(true);
return this.dispatchEditorEvent('tool-applied', toolDetail);
};
return Indent;
})(ContentTools.Tool);
ContentTools.Tools.Unindent = (function(_super) {
__extends(Unindent, _super);
function Unindent() {
return Unindent.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Unindent, 'unindent');
Unindent.label = 'Unindent';
Unindent.icon = 'unindent';
Unindent.canApply = function(element, selection) {
return element.parent().type() === 'ListItem';
};
Unindent.apply = function(element, selection, callback) {
var toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
element.parent().unindent();
callback(true);
return this.dispatchEditorEvent('tool-applied', toolDetail);
};
return Unindent;
})(ContentTools.Tool);
ContentTools.Tools.LineBreak = (function(_super) {
__extends(LineBreak, _super);
function LineBreak() {
return LineBreak.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(LineBreak, 'line-break');
LineBreak.label = 'Line break';
LineBreak.icon = 'line-break';
LineBreak.canApply = function(element, selection) {
return element.content;
};
LineBreak.apply = function(element, selection, callback) {
var br, cursor, tail, tip, toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
cursor = selection.get()[0] + 1;
tip = element.content.substring(0, selection.get()[0]);
tail = element.content.substring(selection.get()[1]);
br = new HTMLString.String('<br>', element.content.preserveWhitespace());
element.content = tip.concat(br, tail);
element.updateInnerHTML();
element.taint();
selection.set(cursor, cursor);
element.selection(selection);
callback(true);
return this.dispatchEditorEvent('tool-applied', toolDetail);
};
return LineBreak;
})(ContentTools.Tool);
ContentTools.Tools.Image = (function(_super) {
__extends(Image, _super);
function Image() {
return Image.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Image, 'image');
Image.label = 'Image';
Image.icon = 'image';
Image.canApply = function(element, selection) {
return !element.isFixed();
};
Image.apply = function(element, selection, callback) {
var app, dialog, modal, toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
if (element.storeState) {
element.storeState();
}
app = ContentTools.EditorApp.get();
modal = new ContentTools.ModalUI();
dialog = new ContentTools.ImageDialog();
dialog.addEventListener('cancel', (function(_this) {
return function() {
modal.hide();
dialog.hide();
if (element.restoreState) {
element.restoreState();
}
return callback(false);
};
})(this));
dialog.addEventListener('save', (function(_this) {
return function(ev) {
var detail, image, imageAttrs, imageSize, imageURL, index, node, _ref;
detail = ev.detail();
imageURL = detail.imageURL;
imageSize = detail.imageSize;
imageAttrs = detail.imageAttrs;
if (!imageAttrs) {
imageAttrs = {};
}
imageAttrs.height = imageSize[1];
imageAttrs.src = imageURL;
imageAttrs.width = imageSize[0];
image = new ContentEdit.Image(imageAttrs);
_ref = _this._insertAt(element), node = _ref[0], index = _ref[1];
node.parent().attach(image, index);
image.focus();
modal.hide();
dialog.hide();
callback(true);
return _this.dispatchEditorEvent('tool-applied', toolDetail);
};
})(this));
app.attach(modal);
app.attach(dialog);
modal.show();
return dialog.show();
};
return Image;
})(ContentTools.Tool);
ContentTools.Tools.Video = (function(_super) {
__extends(Video, _super);
function Video() {
return Video.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Video, 'video');
Video.label = 'Video';
Video.icon = 'video';
Video.canApply = function(element, selection) {
return !element.isFixed();
};
Video.apply = function(element, selection, callback) {
var app, dialog, modal, toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
if (element.storeState) {
element.storeState();
}
app = ContentTools.EditorApp.get();
modal = new ContentTools.ModalUI();
dialog = new ContentTools.VideoDialog();
dialog.addEventListener('cancel', (function(_this) {
return function() {
modal.hide();
dialog.hide();
if (element.restoreState) {
element.restoreState();
}
return callback(false);
};
})(this));
dialog.addEventListener('save', (function(_this) {
return function(ev) {
var applied, index, node, url, video, _ref;
url = ev.detail().url;
if (url) {
video = new ContentEdit.Video('iframe', {
'frameborder': 0,
'height': ContentTools.DEFAULT_VIDEO_HEIGHT,
'src': url,
'width': ContentTools.DEFAULT_VIDEO_WIDTH
});
_ref = _this._insertAt(element), node = _ref[0], index = _ref[1];
node.parent().attach(video, index);
video.focus();
} else {
if (element.restoreState) {
element.restoreState();
}
}
modal.hide();
dialog.hide();
applied = url !== '';
callback(applied);
if (applied) {
return _this.dispatchEditorEvent('tool-applied', toolDetail);
}
};
})(this));
app.attach(modal);
app.attach(dialog);
modal.show();
return dialog.show();
};
return Video;
})(ContentTools.Tool);
ContentTools.Tools.Undo = (function(_super) {
__extends(Undo, _super);
function Undo() {
return Undo.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Undo, 'undo');
Undo.label = 'Undo';
Undo.icon = 'undo';
Undo.requiresElement = false;
Undo.canApply = function(element, selection) {
var app;
app = ContentTools.EditorApp.get();
return app.history && app.history.canUndo();
};
Undo.apply = function(element, selection, callback) {
var app, snapshot, toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
app = this.editor();
app.history.stopWatching();
snapshot = app.history.undo();
app.revertToSnapshot(snapshot);
app.history.watch();
return this.dispatchEditorEvent('tool-applied', toolDetail);
};
return Undo;
})(ContentTools.Tool);
ContentTools.Tools.Redo = (function(_super) {
__extends(Redo, _super);
function Redo() {
return Redo.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Redo, 'redo');
Redo.label = 'Redo';
Redo.icon = 'redo';
Redo.requiresElement = false;
Redo.canApply = function(element, selection) {
var app;
app = ContentTools.EditorApp.get();
return app.history && app.history.canRedo();
};
Redo.apply = function(element, selection, callback) {
var app, snapshot, toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
app = ContentTools.EditorApp.get();
app.history.stopWatching();
snapshot = app.history.redo();
app.revertToSnapshot(snapshot);
app.history.watch();
return this.dispatchEditorEvent('tool-applied', toolDetail);
};
return Redo;
})(ContentTools.Tool);
ContentTools.Tools.Remove = (function(_super) {
__extends(Remove, _super);
function Remove() {
return Remove.__super__.constructor.apply(this, arguments);
}
ContentTools.ToolShelf.stow(Remove, 'remove');
Remove.label = 'Remove';
Remove.icon = 'remove';
Remove.canApply = function(element, selection) {
return !element.isFixed();
};
Remove.apply = function(element, selection, callback) {
var app, list, row, table, toolDetail;
toolDetail = {
'tool': this,
'element': element,
'selection': selection
};
if (!this.dispatchEditorEvent('tool-apply', toolDetail)) {
return;
}
app = this.editor();
element.blur();
if (element.nextContent()) {
element.nextContent().focus();
} else if (element.previousContent()) {
element.previousContent().focus();
}
if (!element.isMounted()) {
callback(true);
this.dispatchEditorEvent('tool-applied', toolDetail);
return;
}
switch (element.type()) {
case 'ListItemText':
if (app.ctrlDown()) {
list = element.closest(function(node) {
return node.parent().type() === 'Region';
});
list.parent().detach(list);
} else {
element.parent().parent().detach(element.parent());
}
break;
case 'TableCellText':
if (app.ctrlDown()) {
table = element.closest(function(node) {
return node.type() === 'Table';
});
table.parent().detach(table);
} else {
row = element.parent().parent();
row.parent().detach(row);
}
break;
default:
element.parent().detach(element);
break;
}
callback(true);
return this.dispatchEditorEvent('tool-applied', toolDetail);
};
return Remove;
})(ContentTools.Tool);
}).call(this);
|
'use strict';
describe("service pages", function() {
it("should show the related provider if there is one", function() {
browser.get('build/docs/index.html#!/api/ng/service/$compile');
var providerLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
expect(providerLink.getText()).toEqual('- $compileProvider');
expect(providerLink.getAttribute('href')).toMatch(/api\/ng\/provider\/\$compileProvider/);
browser.get('build/docs/index.html#!/api/ng/service/$q');
providerLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
expect(providerLink.getText()).not.toEqual('- $compileProvider');
expect(providerLink.getAttribute('href')).not.toMatch(/api\/ng\/provider\/\$compileProvider/);
});
it("should show parameter defaults", function() {
browser.get('build/docs/index.html#!/api/ng/service/$timeout');
expect(element.all(by.css('.input-arguments p em')).first().getText()).toContain('(default: 0)');
});
});
|
module.exports = require('./src/index');
|
/**
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function () {
'use strict';
var PROMISE_REJECTION_LOGGING_DELAY = 10 * 1000; // 10s
var logRejectionTimeoutId;
var unhandledRejections = [];
function logRejectedPromises() {
unhandledRejections.forEach(function (reason) {
HOVERBOARD.Analytics.trackError('UnhandledPromiseRejection', reason);
});
unhandledRejections = [];
logRejectionTimeoutId = null;
}
window.addEventListener('unhandledrejection', function (event) {
debugLog('unhandledrejection fired: ' + event.reason);
// Keep track of rejected promises by adding them to the list.
unhandledRejections.push({promise: event.promise, reason: event.reason});
// We need to wait before we log this rejected promise, since there's a
// chance it will be caught later on, in which case it's not an error.
if (!logRejectionTimeoutId) {
logRejectionTimeoutId = setTimeout(logRejectedPromises,
PROMISE_REJECTION_LOGGING_DELAY);
}
});
window.addEventListener('rejectionhandled', function (event) {
debugLog('rejectionhandled fired: ' + event.reason);
// If a previously rejected promise is handled, remove it from the list.
unhandledRejections = unhandledRejections.filter(function (rejection) {
rejection.promise !== event.promise;
});
});
function lazyLoadWCPolyfillsIfNecessary(callback) {
callback = callback || null;
var onload = function () {
// For native Imports, manually fire WCR so user code
// can use the same code path for native and polyfill'd imports.
if (!window.HTMLImports) {
document.dispatchEvent(
new CustomEvent('WebComponentsReady', {bubbles: true}));
}
if (callback) {
callback();
}
};
var webComponentsSupported = (
'registerElement' in document &&
'import' in document.createElement('link') &&
'content' in document.createElement('template'));
if (webComponentsSupported) {
onload();
} else {
var script = document.createElement('script');
script.async = true;
script.src = 'bower_components/webcomponentsjs/webcomponents-lite.min.js';
script.onload = onload;
document.head.appendChild(script);
}
if (!(HOVERBOARD.Util.getChromeVersion() &&
HOVERBOARD.Util.getChromeVersion() >= 46 || HOVERBOARD.Util.getFirefoxVersion() && HOVERBOARD.Util.getFirefoxVersion() >= 40)) {
var parent = document.querySelector('body');
var swScript = document.querySelector('#sw-registration');
var polyfillScript = document.createElement('script');
polyfillScript.src = 'https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,intl';
parent.insertBefore(polyfillScript, swScript);
ga('send', 'event', 'browser', 'unsupported-es6-intl', navigator.userAgent);
console.log('Your browser is out-of-date. Please download one of these up-to-date, free and excellent browsers: Chrome, Chromium, Opera, Vivaldi');
}
}
window.addEventListener('offline', function () {
if (HOVERBOARD.Elements && HOVERBOARD.Elements.Template.$.toast) {
HOVERBOARD.Elements.Template.$.toast.showMessage(
'You can still work offline.');
}
});
// See https://developers.google.com/web/fundamentals/engage-and-retain/app-install-banners/advanced
window.addEventListener('beforeinstallprompt', function (event) {
HOVERBOARD.Analytics.trackEvent('installprompt', 'fired');
event.userChoice.then(function (choiceResult) {
// choiceResult.outcome will be 'accepted' or 'dismissed'.
// choiceResult.platform will be 'web' or 'android' if the prompt was
// accepted, or '' if the prompt was dismissed.
HOVERBOARD.Analytics.trackEvent('installprompt', choiceResult.outcome,
choiceResult.platform);
});
});
function initApp() {
// wc.js brings in a URL() polyfill that we need to wait for in unsupported
// browsers. In Chrome, lazyLoadWCPolyfillsIfNecessary is effectively not
// async. It's a noop and its callback gets invoked right away. Therefore,
// this shouldn't slow anything down.
lazyLoadWCPolyfillsIfNecessary(function () {
HOVERBOARD.Elements.init();
});
}
initApp();
})();
|
// Copyright 2012 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Plural rules.
*
* This file is autogenerated by script:
* http://go/generate_pluralrules.py
* File generated from CLDR ver. 28
*
* Before check in, this file could have been manually edited. This is to
* incorporate changes before we could fix CLDR. All manual modification must be
* documented in this section, and should be removed after those changes land to
* CLDR.
*/
// clang-format off
goog.provide('goog.i18n.pluralRules');
/**
* Plural pattern keyword
* @enum {string}
*/
goog.i18n.pluralRules.Keyword = {
ZERO: 'zero',
ONE: 'one',
TWO: 'two',
FEW: 'few',
MANY: 'many',
OTHER: 'other'
};
/**
* Default Plural select rule.
* @param {number} n The count of items.
* @param {number=} opt_precision optional, precision.
* @return {goog.i18n.pluralRules.Keyword} Default value.
* @private
*/
goog.i18n.pluralRules.defaultSelect_ = function(n, opt_precision) {
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Returns the fractional part of a number (3.1416 => 1416)
* @param {number} n The count of items.
* @return {number} The fractional part.
* @private
*/
goog.i18n.pluralRules.decimals_ = function(n) {
var str = n + '';
var result = str.indexOf('.');
return (result == -1) ? 0 : str.length - result - 1;
};
/**
* Calculates v and f as per CLDR plural rules.
* The short names for parameters / return match the CLDR syntax and UTS #35
* (http://unicode.org/reports/tr35/tr35-numbers.html#Plural_rules_syntax)
* @param {number} n The count of items.
* @param {number=} opt_precision optional, precision.
* @return {!{v:number, f:number}} The v and f.
* @private
*/
goog.i18n.pluralRules.get_vf_ = function(n, opt_precision) {
var DEFAULT_DIGITS = 3;
if (undefined === opt_precision) {
var v = Math.min(goog.i18n.pluralRules.decimals_(n), DEFAULT_DIGITS);
} else {
var v = opt_precision;
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
};
/**
* Calculates w and t as per CLDR plural rules.
* The short names for parameters / return match the CLDR syntax and UTS #35
* (http://unicode.org/reports/tr35/tr35-numbers.html#Plural_rules_syntax)
* @param {number} v Calculated previously.
* @param {number} f Calculated previously.
* @return {!{w:number, t:number}} The w and t.
* @private
*/
goog.i18n.pluralRules.get_wt_ = function(v, f) {
if (f === 0) {
return {w: 0, t: 0};
}
while ((f % 10) === 0) {
f /= 10;
v--;
}
return {w: v, t: f};
};
/**
* Plural select rules for fil locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.filSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (vf.v == 0 && (i == 1 || i == 2 || i == 3) || vf.v == 0 && i % 10 != 4 && i % 10 != 6 && i % 10 != 9 || vf.v != 0 && vf.f % 10 != 4 && vf.f % 10 != 6 && vf.f % 10 != 9) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for pt_PT locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.pt_PTSelect_ = function(n, opt_precision) {
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (n == 1 && vf.v == 0) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for br locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.brSelect_ = function(n, opt_precision) {
if (n % 10 == 1 && n % 100 != 11 && n % 100 != 71 && n % 100 != 91) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (n % 10 == 2 && n % 100 != 12 && n % 100 != 72 && n % 100 != 92) {
return goog.i18n.pluralRules.Keyword.TWO;
}
if ((n % 10 >= 3 && n % 10 <= 4 || n % 10 == 9) && (n % 100 < 10 || n % 100 > 19) && (n % 100 < 70 || n % 100 > 79) && (n % 100 < 90 || n % 100 > 99)) {
return goog.i18n.pluralRules.Keyword.FEW;
}
if (n != 0 && n % 1000000 == 0) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for sr locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.srSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (vf.v == 0 && i % 10 == 1 && i % 100 != 11 || vf.f % 10 == 1 && vf.f % 100 != 11) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14) || vf.f % 10 >= 2 && vf.f % 10 <= 4 && (vf.f % 100 < 12 || vf.f % 100 > 14)) {
return goog.i18n.pluralRules.Keyword.FEW;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for ro locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.roSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (i == 1 && vf.v == 0) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (vf.v != 0 || n == 0 || n != 1 && n % 100 >= 1 && n % 100 <= 19) {
return goog.i18n.pluralRules.Keyword.FEW;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for hi locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.hiSelect_ = function(n, opt_precision) {
var i = n | 0;
if (i == 0 || n == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for fr locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.frSelect_ = function(n, opt_precision) {
var i = n | 0;
if (i == 0 || i == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for cs locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.csSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (i == 1 && vf.v == 0) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (i >= 2 && i <= 4 && vf.v == 0) {
return goog.i18n.pluralRules.Keyword.FEW;
}
if (vf.v != 0) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for pl locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.plSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (i == 1 && vf.v == 0) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) {
return goog.i18n.pluralRules.Keyword.FEW;
}
if (vf.v == 0 && i != 1 && i % 10 >= 0 && i % 10 <= 1 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 12 && i % 100 <= 14) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for shi locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.shiSelect_ = function(n, opt_precision) {
var i = n | 0;
if (i == 0 || n == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (n >= 2 && n <= 10) {
return goog.i18n.pluralRules.Keyword.FEW;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for lv locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.lvSelect_ = function(n, opt_precision) {
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (n % 10 == 0 || n % 100 >= 11 && n % 100 <= 19 || vf.v == 2 && vf.f % 100 >= 11 && vf.f % 100 <= 19) {
return goog.i18n.pluralRules.Keyword.ZERO;
}
if (n % 10 == 1 && n % 100 != 11 || vf.v == 2 && vf.f % 10 == 1 && vf.f % 100 != 11 || vf.v != 2 && vf.f % 10 == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for iu locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.iuSelect_ = function(n, opt_precision) {
if (n == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (n == 2) {
return goog.i18n.pluralRules.Keyword.TWO;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for he locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.heSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (i == 1 && vf.v == 0) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (i == 2 && vf.v == 0) {
return goog.i18n.pluralRules.Keyword.TWO;
}
if (vf.v == 0 && (n < 0 || n > 10) && n % 10 == 0) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for mt locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.mtSelect_ = function(n, opt_precision) {
if (n == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (n == 0 || n % 100 >= 2 && n % 100 <= 10) {
return goog.i18n.pluralRules.Keyword.FEW;
}
if (n % 100 >= 11 && n % 100 <= 19) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for si locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.siSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if ((n == 0 || n == 1) || i == 0 && vf.f == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for cy locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.cySelect_ = function(n, opt_precision) {
if (n == 0) {
return goog.i18n.pluralRules.Keyword.ZERO;
}
if (n == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (n == 2) {
return goog.i18n.pluralRules.Keyword.TWO;
}
if (n == 3) {
return goog.i18n.pluralRules.Keyword.FEW;
}
if (n == 6) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for da locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.daSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
var wt = goog.i18n.pluralRules.get_wt_(vf.v, vf.f);
if (n == 1 || wt.t != 0 && (i == 0 || i == 1)) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for ru locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.ruSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (vf.v == 0 && i % 10 == 1 && i % 100 != 11) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) {
return goog.i18n.pluralRules.Keyword.FEW;
}
if (vf.v == 0 && i % 10 == 0 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 11 && i % 100 <= 14) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for gv locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.gvSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (vf.v == 0 && i % 10 == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (vf.v == 0 && i % 10 == 2) {
return goog.i18n.pluralRules.Keyword.TWO;
}
if (vf.v == 0 && (i % 100 == 0 || i % 100 == 20 || i % 100 == 40 || i % 100 == 60 || i % 100 == 80)) {
return goog.i18n.pluralRules.Keyword.FEW;
}
if (vf.v != 0) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for be locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.beSelect_ = function(n, opt_precision) {
if (n % 10 == 1 && n % 100 != 11) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14)) {
return goog.i18n.pluralRules.Keyword.FEW;
}
if (n % 10 == 0 || n % 10 >= 5 && n % 10 <= 9 || n % 100 >= 11 && n % 100 <= 14) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for mk locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.mkSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (vf.v == 0 && i % 10 == 1 || vf.f % 10 == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for ga locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.gaSelect_ = function(n, opt_precision) {
if (n == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (n == 2) {
return goog.i18n.pluralRules.Keyword.TWO;
}
if (n >= 3 && n <= 6) {
return goog.i18n.pluralRules.Keyword.FEW;
}
if (n >= 7 && n <= 10) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for pt locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.ptSelect_ = function(n, opt_precision) {
if (n >= 0 && n <= 2 && n != 2) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for es locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.esSelect_ = function(n, opt_precision) {
if (n == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for dsb locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.dsbSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (vf.v == 0 && i % 100 == 1 || vf.f % 100 == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (vf.v == 0 && i % 100 == 2 || vf.f % 100 == 2) {
return goog.i18n.pluralRules.Keyword.TWO;
}
if (vf.v == 0 && i % 100 >= 3 && i % 100 <= 4 || vf.f % 100 >= 3 && vf.f % 100 <= 4) {
return goog.i18n.pluralRules.Keyword.FEW;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for lag locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.lagSelect_ = function(n, opt_precision) {
var i = n | 0;
if (n == 0) {
return goog.i18n.pluralRules.Keyword.ZERO;
}
if ((i == 0 || i == 1) && n != 0) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for is locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.isSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
var wt = goog.i18n.pluralRules.get_wt_(vf.v, vf.f);
if (wt.t == 0 && i % 10 == 1 && i % 100 != 11 || wt.t != 0) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for ksh locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.kshSelect_ = function(n, opt_precision) {
if (n == 0) {
return goog.i18n.pluralRules.Keyword.ZERO;
}
if (n == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for ar locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.arSelect_ = function(n, opt_precision) {
if (n == 0) {
return goog.i18n.pluralRules.Keyword.ZERO;
}
if (n == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (n == 2) {
return goog.i18n.pluralRules.Keyword.TWO;
}
if (n % 100 >= 3 && n % 100 <= 10) {
return goog.i18n.pluralRules.Keyword.FEW;
}
if (n % 100 >= 11 && n % 100 <= 99) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for gd locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.gdSelect_ = function(n, opt_precision) {
if (n == 1 || n == 11) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (n == 2 || n == 12) {
return goog.i18n.pluralRules.Keyword.TWO;
}
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
return goog.i18n.pluralRules.Keyword.FEW;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for sl locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.slSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (vf.v == 0 && i % 100 == 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (vf.v == 0 && i % 100 == 2) {
return goog.i18n.pluralRules.Keyword.TWO;
}
if (vf.v == 0 && i % 100 >= 3 && i % 100 <= 4 || vf.v != 0) {
return goog.i18n.pluralRules.Keyword.FEW;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for lt locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.ltSelect_ = function(n, opt_precision) {
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (n % 10 == 1 && (n % 100 < 11 || n % 100 > 19)) {
return goog.i18n.pluralRules.Keyword.ONE;
}
if (n % 10 >= 2 && n % 10 <= 9 && (n % 100 < 11 || n % 100 > 19)) {
return goog.i18n.pluralRules.Keyword.FEW;
}
if (vf.f != 0) {
return goog.i18n.pluralRules.Keyword.MANY;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for tzm locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.tzmSelect_ = function(n, opt_precision) {
if (n >= 0 && n <= 1 || n >= 11 && n <= 99) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for en locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.enSelect_ = function(n, opt_precision) {
var i = n | 0;
var vf = goog.i18n.pluralRules.get_vf_(n, opt_precision);
if (i == 1 && vf.v == 0) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Plural select rules for ak locale
*
* @param {number} n The count of items.
* @param {number=} opt_precision Precision for number formatting, if not default.
* @return {goog.i18n.pluralRules.Keyword} Locale-specific plural value.
* @private
*/
goog.i18n.pluralRules.akSelect_ = function(n, opt_precision) {
if (n >= 0 && n <= 1) {
return goog.i18n.pluralRules.Keyword.ONE;
}
return goog.i18n.pluralRules.Keyword.OTHER;
};
/**
* Selected Plural rules by locale.
*/
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
if (goog.LOCALE == 'af') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'am') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_;
}
if (goog.LOCALE == 'ar') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.arSelect_;
}
if (goog.LOCALE == 'az') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'be') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.beSelect_;
}
if (goog.LOCALE == 'bg') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'bn') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_;
}
if (goog.LOCALE == 'br') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.brSelect_;
}
if (goog.LOCALE == 'bs') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.srSelect_;
}
if (goog.LOCALE == 'ca') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'chr') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'cs') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.csSelect_;
}
if (goog.LOCALE == 'cy') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.cySelect_;
}
if (goog.LOCALE == 'da') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.daSelect_;
}
if (goog.LOCALE == 'de') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'de_AT' || goog.LOCALE == 'de-AT') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'de_CH' || goog.LOCALE == 'de-CH') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'el') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'en') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'en_AU' || goog.LOCALE == 'en-AU') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'en_CA' || goog.LOCALE == 'en-CA') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'en_GB' || goog.LOCALE == 'en-GB') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'en_IE' || goog.LOCALE == 'en-IE') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'en_IN' || goog.LOCALE == 'en-IN') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'en_SG' || goog.LOCALE == 'en-SG') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'en_US' || goog.LOCALE == 'en-US') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'en_ZA' || goog.LOCALE == 'en-ZA') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'es') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'es_419' || goog.LOCALE == 'es-419') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'es_ES' || goog.LOCALE == 'es-ES') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'es_MX' || goog.LOCALE == 'es-MX') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'es_US' || goog.LOCALE == 'es-US') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'et') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'eu') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'fa') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_;
}
if (goog.LOCALE == 'fi') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'fil') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.filSelect_;
}
if (goog.LOCALE == 'fr') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.frSelect_;
}
if (goog.LOCALE == 'fr_CA' || goog.LOCALE == 'fr-CA') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.frSelect_;
}
if (goog.LOCALE == 'ga') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.gaSelect_;
}
if (goog.LOCALE == 'gl') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'gsw') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'gu') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_;
}
if (goog.LOCALE == 'haw') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'he') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.heSelect_;
}
if (goog.LOCALE == 'hi') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_;
}
if (goog.LOCALE == 'hr') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.srSelect_;
}
if (goog.LOCALE == 'hu') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'hy') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.frSelect_;
}
if (goog.LOCALE == 'id') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'in') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'is') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.isSelect_;
}
if (goog.LOCALE == 'it') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'iw') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.heSelect_;
}
if (goog.LOCALE == 'ja') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'ka') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'kk') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'km') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'kn') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_;
}
if (goog.LOCALE == 'ko') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'ky') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'ln') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.akSelect_;
}
if (goog.LOCALE == 'lo') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'lt') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.ltSelect_;
}
if (goog.LOCALE == 'lv') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.lvSelect_;
}
if (goog.LOCALE == 'mk') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.mkSelect_;
}
if (goog.LOCALE == 'ml') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'mn') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'mo') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.roSelect_;
}
if (goog.LOCALE == 'mr') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_;
}
if (goog.LOCALE == 'ms') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'mt') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.mtSelect_;
}
if (goog.LOCALE == 'my') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'nb') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'ne') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'nl') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'no') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'no_NO' || goog.LOCALE == 'no-NO') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'or') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'pa') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.akSelect_;
}
if (goog.LOCALE == 'pl') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.plSelect_;
}
if (goog.LOCALE == 'pt') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.ptSelect_;
}
if (goog.LOCALE == 'pt_BR' || goog.LOCALE == 'pt-BR') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.ptSelect_;
}
if (goog.LOCALE == 'pt_PT' || goog.LOCALE == 'pt-PT') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.pt_PTSelect_;
}
if (goog.LOCALE == 'ro') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.roSelect_;
}
if (goog.LOCALE == 'ru') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.ruSelect_;
}
if (goog.LOCALE == 'sh') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.srSelect_;
}
if (goog.LOCALE == 'si') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.siSelect_;
}
if (goog.LOCALE == 'sk') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.csSelect_;
}
if (goog.LOCALE == 'sl') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.slSelect_;
}
if (goog.LOCALE == 'sq') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'sr') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.srSelect_;
}
if (goog.LOCALE == 'sr_Latn' || goog.LOCALE == 'sr-Latn') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.srSelect_;
}
if (goog.LOCALE == 'sv') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'sw') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'ta') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'te') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'th') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'tl') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.filSelect_;
}
if (goog.LOCALE == 'tr') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'uk') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.ruSelect_;
}
if (goog.LOCALE == 'ur') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.enSelect_;
}
if (goog.LOCALE == 'uz') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.esSelect_;
}
if (goog.LOCALE == 'vi') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'zh') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'zh_CN' || goog.LOCALE == 'zh-CN') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'zh_HK' || goog.LOCALE == 'zh-HK') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'zh_TW' || goog.LOCALE == 'zh-TW') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.defaultSelect_;
}
if (goog.LOCALE == 'zu') {
goog.i18n.pluralRules.select = goog.i18n.pluralRules.hiSelect_;
}
|
import { generateUtilityClass, generateUtilityClasses } from '@material-ui/unstyled';
export function getSwitchBaseUtilityClass(slot) {
return generateUtilityClass('PrivateSwitchBase', slot);
}
const switchBaseClasses = generateUtilityClasses('PrivateSwitchBase', ['root', 'checked', 'disabled', 'input']);
export default switchBaseClasses; |
/*! angular-highlightjs
version: 0.7.0
build date: 2017-02-19
author: Chih-Hsuan Fan
https://github.com/pc035860/angular-highlightjs.git */
(function (root, factory) {
if (typeof exports === "object" || (typeof module === "object" && module.exports)) {
module.exports = factory(require("angular"), require("highlight.js"));
} else if (typeof define === "function" && define.amd) {
define(["angular", "hljs"], factory);
} else {
root.returnExports = factory(root.angular, root.hljs);
}
}(this, function (angular, hljs) {
/*global angular, hljs*/
/**
* returns a function to transform attrs to supported ones
*
* escape:
* hljs-escape or escape
* no-escape:
* hljs-no-escape or no-escape
* onhighlight:
* hljs-onhighlight or onhighlight
*/
function attrGetter(attrs) {
return function (name) {
switch (name) {
case 'escape':
return angular.isDefined(attrs.hljsEscape) ?
attrs.hljsEscape :
attrs.escape;
case 'no-escape':
return angular.isDefined(attrs.hljsNoEscape) ?
attrs.hljsNoEscape :
attrs.noEscape;
case 'onhighlight':
return angular.isDefined(attrs.hljsOnhighlight) ?
attrs.hljsOnhighlight :
attrs.onhighlight;
}
};
}
function shouldHighlightStatics(attrs) {
var should = true;
angular.forEach([
'source', 'include'
], function (name) {
if (attrs[name]) {
should = false;
}
});
return should;
}
var ngModule = angular.module('hljs', []);
/**
* hljsService service
*/
ngModule.provider('hljsService', function () {
var _hljsOptions = {};
return {
setOptions: function (options) {
angular.extend(_hljsOptions, options);
},
getOptions: function () {
return angular.copy(_hljsOptions);
},
$get: function () {
(hljs.configure || angular.noop)(_hljsOptions);
return hljs;
}
};
});
/**
* hljsCache service
*/
ngModule.factory('hljsCache', ["$cacheFactory", function ($cacheFactory) {
return $cacheFactory('hljsCache');
}]);
/**
* HljsCtrl controller
*/
ngModule.controller('HljsCtrl',
["hljsCache", "hljsService", "$interpolate", "$window", function HljsCtrl (hljsCache, hljsService, $interpolate, $window) {
var ctrl = this;
var _elm = null,
_lang = null,
_code = null,
_interpolateScope = false,
_stopInterpolateWatch = null,
_hlCb = null;
var RE_INTERPOLATION_STR = escapeRe($interpolate.startSymbol()) +
'((.|\\s)+?)' + escapeRe($interpolate.endSymbol());
var INTERPOLATION_SYMBOL = '∫';
ctrl.init = function (codeElm) {
_elm = codeElm;
};
ctrl.setInterpolateScope = function (scope) {
_interpolateScope = scope;
if (_code) {
ctrl.highlight(_code);
}
};
ctrl.setLanguage = function (lang) {
_lang = lang;
if (_code) {
ctrl.highlight(_code);
}
};
ctrl.highlightCallback = function (cb) {
_hlCb = cb;
};
ctrl._highlight = function (code) {
if (!_elm) {
return;
}
var res, cacheKey, interpolateData;
_code = code; // preserve raw code
if (_interpolateScope) {
interpolateData = extractInterpolations(code);
code = interpolateData.code;
}
if (_lang) {
// cache key: language, scope, code
cacheKey = ctrl._cacheKey(_lang, !!_interpolateScope, code);
res = hljsCache.get(cacheKey);
if (!res) {
res = hljsService.highlight(_lang, hljsService.fixMarkup(code), true);
hljsCache.put(cacheKey, res);
}
}
else {
// cache key: scope, code
cacheKey = ctrl._cacheKey(!!_interpolateScope, code);
res = hljsCache.get(cacheKey);
if (!res) {
res = hljsService.highlightAuto(hljsService.fixMarkup(code));
hljsCache.put(cacheKey, res);
}
}
code = res.value;
if (_interpolateScope) {
(_stopInterpolateWatch||angular.noop)();
if (interpolateData) {
code = recoverInterpolations(code, interpolateData.tokens);
}
var interpolateFn = $interpolate(code);
_stopInterpolateWatch = _interpolateScope.$watch(interpolateFn, function (newVal, oldVal) {
if (newVal !== oldVal) {
_elm.html(newVal);
}
});
_interpolateScope.$apply();
_elm.html(interpolateFn(_interpolateScope));
}
else {
_elm.html(code);
}
// language as class on the <code> tag
_elm.addClass(res.language);
if (_hlCb !== null && angular.isFunction(_hlCb)) {
_hlCb();
}
};
ctrl.highlight = debounce(ctrl._highlight, 17);
ctrl.clear = function () {
if (!_elm) {
return;
}
_code = null;
_elm.text('');
};
ctrl.release = function () {
_elm = null;
_interpolateScope = null;
(_stopInterpolateWatch||angular.noop)();
_stopInterpolateWatch = null;
};
ctrl._cacheKey = function () {
var args = Array.prototype.slice.call(arguments),
glue = "!angular-highlightjs!";
return args.join(glue);
};
// http://davidwalsh.name/function-debounce
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) {
func.apply(context, args);
}
};
var callNow = immediate && !timeout;
$window.clearTimeout(timeout);
timeout = $window.setTimeout(later, wait);
if (callNow) {
func.apply(context, args);
}
};
}
// Ref: http://stackoverflow.com/questions/3115150/how-to-escape-regular-expression-special-characters-using-javascript
function escapeRe(text, asString) {
var replacement = asString ? "\\\\$&" : "\\$&";
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, replacement);
}
function extractInterpolations(code) {
var interpolateTokens = [],
re = new RegExp(RE_INTERPOLATION_STR, 'g'),
newCode = '',
lastIndex = 0,
arr;
while ((arr = re.exec(code)) !== null) {
newCode += code.substring(lastIndex, arr.index) + INTERPOLATION_SYMBOL;
lastIndex = arr.index + arr[0].length;
interpolateTokens.push(arr[0]);
}
newCode += code.substr(lastIndex);
return {
code: newCode,
tokens: interpolateTokens
};
}
function recoverInterpolations(code, tokens) {
var re = new RegExp(INTERPOLATION_SYMBOL, 'g'),
newCode = '',
lastIndex = 0,
arr;
while ((arr = re.exec(code)) !== null) {
newCode += code.substring(lastIndex, arr.index ) + tokens.shift();
lastIndex = arr.index + arr[0].length;
}
newCode += code.substr(lastIndex);
return newCode;
}
}]);
var hljsDir, interpolateDirFactory, languageDirFactory, sourceDirFactory, includeDirFactory;
/**
* hljs directive
*/
hljsDir = /*@ngInject*/ ["$parse", function ($parse) {
return {
restrict: 'EA',
controller: 'HljsCtrl',
compile: function(tElm, tAttrs, transclude) {
// get static code
// strip the starting "new line" character
var staticHTML = tElm[0].innerHTML.replace(/^(\r\n|\r|\n)/, ''),
staticText = tElm[0].textContent.replace(/^(\r\n|\r|\n)/, '');
// put template
tElm.html('<pre><code class="hljs"></code></pre>');
return function postLink(scope, iElm, iAttrs, ctrl) {
var escapeCheck;
var attrs = attrGetter(iAttrs);
if (angular.isDefined(attrs('escape'))) {
escapeCheck = $parse(attrs('escape'));
} else if (angular.isDefined(attrs('no-escape'))) {
escapeCheck = $parse('false');
}
ctrl.init(iElm.find('code'));
if (attrs('onhighlight')) {
ctrl.highlightCallback(function () {
scope.$eval(attrs('onhighlight'));
});
}
if ((staticHTML || staticText) && shouldHighlightStatics(iAttrs)) {
var code;
// Auto-escape check
// default to "true"
if (escapeCheck && !escapeCheck(scope)) {
code = staticText;
}
else {
code = staticHTML;
}
ctrl.highlight(code);
}
scope.$on('$destroy', function () {
ctrl.release();
});
};
}
};
}];
/**
* language directive
*/
languageDirFactory = function (dirName) {
return /*@ngInject*/ function () {
return {
require: '?hljs',
restrict: 'A',
link: function (scope, iElm, iAttrs, ctrl) {
if (!ctrl) {
return;
}
iAttrs.$observe(dirName, function (lang) {
if (angular.isDefined(lang)) {
ctrl.setLanguage(lang);
}
});
}
};
};
};
/**
* interpolate directive
*/
interpolateDirFactory = function (dirName) {
/*@ngInject*/
return function () {
return {
require: '?hljs',
restrict: 'A',
link: function (scope, iElm, iAttrs, ctrl) {
if (!ctrl) {
return;
}
scope.$watch(iAttrs[dirName], function (newVal, oldVal) {
if (newVal || newVal !== oldVal) {
ctrl.setInterpolateScope(newVal ? scope : null);
}
});
}
};
};
};
/**
* source directive
*/
sourceDirFactory = function (dirName) {
return /*@ngInject*/ function () {
return {
require: '?hljs',
restrict: 'A',
link: function(scope, iElm, iAttrs, ctrl) {
if (!ctrl) {
return;
}
scope.$watch(iAttrs[dirName], function (newCode, oldCode) {
if (newCode) {
ctrl.highlight(newCode);
}
else {
ctrl.clear();
}
});
}
};
};
};
/**
* include directive
*/
includeDirFactory = function (dirName) {
return /*@ngInject*/ ["$http", "$templateCache", "$q", function ($http, $templateCache, $q) {
return {
require: '?hljs',
restrict: 'A',
compile: function(tElm, tAttrs, transclude) {
var srcExpr = tAttrs[dirName];
return function postLink(scope, iElm, iAttrs, ctrl) {
var changeCounter = 0;
if (!ctrl) {
return;
}
scope.$watch(srcExpr, function (src) {
var thisChangeId = ++changeCounter;
if (src && angular.isString(src)) {
var templateCachePromise, dfd;
templateCachePromise = $templateCache.get(src);
if (!templateCachePromise) {
dfd = $q.defer();
$http.get(src, {
cache: $templateCache,
transformResponse: function(data, headersGetter) {
// Return the raw string, so $http doesn't parse it
// if it's json.
return data;
}
}).then(function (code) {
if (thisChangeId !== changeCounter) {
return;
}
dfd.resolve(code);
}).catch(function() {
if (thisChangeId === changeCounter) {
ctrl.clear();
}
dfd.resolve();
});
templateCachePromise = dfd.promise;
}
$q.when(templateCachePromise)
.then(function (code) {
if (!code) {
return;
}
// $templateCache from $http
if (angular.isArray(code)) {
// 1.1.5
code = code[1];
}
else if (angular.isObject(code)) {
// 1.0.7
code = code.data;
}
code = code.replace(/^(\r\n|\r|\n)/m, '');
ctrl.highlight(code);
});
}
else {
ctrl.clear();
}
});
};
}
};
}];
};
/**
* Add directives
*/
(function (module) {
module.directive('hljs', hljsDir);
angular.forEach(['interpolate', 'hljsInterpolate', 'compile', 'hljsCompile'], function (name) {
module.directive(name, interpolateDirFactory(name));
});
angular.forEach(['language', 'hljsLanguage'], function (name) {
module.directive(name, languageDirFactory(name));
});
angular.forEach(['source', 'hljsSource'], function (name) {
module.directive(name, sourceDirFactory(name));
});
angular.forEach(['include', 'hljsInclude'], function (name) {
module.directive(name, includeDirFactory(name));
});
})(ngModule);
return "hljs";
})); |
var partial = require("ap").partial
module.exports = map
function map(list, iterator, context, callback) {
var keys = Object.keys(list)
, returnValue = Array.isArray(list) ? [] : {}
, count = keys.length
if (typeof context === "function") {
callback = context
context = this
}
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i]
, value = list[key]
invokeIterator(iterator,
partial(next, key), context, value, key, list)
}
function next(key, err, newValue) {
if (err) {
return callback && callback(err)
}
returnValue[key] = newValue
if (--count === 0) {
callback && callback(null, returnValue)
}
}
}
function invokeIterator(iterator, done, context, value, key, list) {
var length = iterator.length
if (length === 1) {
iterator.call(context, done)
} else if (length === 2) {
iterator.call(context, value, done)
} else if (length === 3) {
iterator.call(context, value, key, done)
} else {
iterator.call(context, value, key, list, done)
}
} |
GMaps.prototype.on = function(event_name, handler) {
return GMaps.on(event_name, this, handler);
};
GMaps.prototype.off = function(event_name) {
GMaps.off(event_name, this);
};
GMaps.prototype.once = function(event_name, handler) {
return GMaps.once(event_name, this, handler);
};
GMaps.custom_events = ['marker_added', 'marker_removed', 'polyline_added', 'polyline_removed', 'polygon_added', 'polygon_removed', 'geolocated', 'geolocation_failed'];
GMaps.on = function(event_name, object, handler) {
if (GMaps.custom_events.indexOf(event_name) == -1) {
if(object instanceof GMaps) object = object.map;
return google.maps.event.addListener(object, event_name, handler);
}
else {
var registered_event = {
handler : handler,
eventName : event_name
};
object.registered_events[event_name] = object.registered_events[event_name] || [];
object.registered_events[event_name].push(registered_event);
return registered_event;
}
};
GMaps.off = function(event_name, object) {
if (GMaps.custom_events.indexOf(event_name) == -1) {
if(object instanceof GMaps) object = object.map;
google.maps.event.clearListeners(object, event_name);
}
else {
object.registered_events[event_name] = [];
}
};
GMaps.once = function(event_name, object, handler) {
if (GMaps.custom_events.indexOf(event_name) == -1) {
if(object instanceof GMaps) object = object.map;
return google.maps.event.addListenerOnce(object, event_name, handler);
}
};
GMaps.fire = function(event_name, object, scope) {
if (GMaps.custom_events.indexOf(event_name) == -1) {
google.maps.event.trigger(object, event_name, Array.prototype.slice.apply(arguments).slice(2));
}
else {
if(event_name in scope.registered_events) {
var firing_events = scope.registered_events[event_name];
for(var i = 0; i < firing_events.length; i++) {
(function(handler, scope, object) {
handler.apply(scope, [object]);
})(firing_events[i]['handler'], scope, object);
}
}
}
};
|
export default ngModule => {
ngModule.run(addDescriptionManipulator);
function addDescriptionManipulator(formlyConfig) {
formlyConfig.templateManipulators.preWrapper.push(function ariaDescribedBy(template, options, scope) {
if (angular.isDefined(options.templateOptions.description)) {
var el = document.createElement('div');
el.appendChild(angular.element(template)[0]);
el.appendChild(angular.element(
'<p id="' + scope.id + '_description"' +
'class="help-block"' +
'ng-if="to.description">' +
'{{to.description}}' +
'</p>'
)[0]);
var modelEls = angular.element(el.querySelectorAll('[ng-model]'));
if (modelEls) {
modelEls.attr('aria-describedby', scope.id + '_description');
}
return el.innerHTML;
} else {
return template;
}
});
}
};
|
"use strict";
/* jshint node:true */
var MyCustomLogger = (function() {
// @include ../lib/loglevel.js
return this.log;
}).apply({});
|
function histogramChart() {
var margin = {top: 0, right: 0, bottom: 20, left: 0},
width = 960,
height = 500;
var histogram = d3.layout.histogram(),
x = d3.scale.ordinal(),
y = d3.scale.linear(),
xAxis = d3.svg.axis().scale(x).orient("bottom").tickSize(6, 0);
function chart(selection) {
selection.each(function(data) {
// Compute the histogram.
data = histogram(data);
// Update the x-scale.
x .domain(data.map(function(d) { return d.x; }))
.rangeRoundBands([0, width - margin.left - margin.right], .1);
// Update the y-scale.
y .domain([0, d3.max(data, function(d) { return d.y; })])
.range([height - margin.top - margin.bottom, 0]);
// Select the svg element, if it exists.
var svg = d3.select(this).selectAll("svg").data([data]);
// Otherwise, create the skeletal chart.
var gEnter = svg.enter().append("svg").append("g");
gEnter.append("g").attr("class", "bars");
gEnter.append("g").attr("class", "x axis");
// Update the outer dimensions.
svg .attr("width", width)
.attr("height", height);
// Update the inner dimensions.
var g = svg.select("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
// Update the bars.
var bar = svg.select(".bars").selectAll(".bar").data(data);
bar.enter().append("rect");
bar.exit().remove();
bar .attr("width", x.rangeBand())
.attr("x", function(d) { return x(d.x); })
.attr("y", function(d) { return y(d.y); })
.attr("height", function(d) { return y.range()[0] - y(d.y); })
.order();
// Update the x-axis.
g.select(".x.axis")
.attr("transform", "translate(0," + y.range()[0] + ")")
.call(xAxis);
});
}
chart.margin = function(_) {
if (!arguments.length) return margin;
margin = _;
return chart;
};
chart.width = function(_) {
if (!arguments.length) return width;
width = _;
return chart;
};
chart.height = function(_) {
if (!arguments.length) return height;
height = _;
return chart;
};
// Expose the histogram's value, range and bins method.
d3.rebind(chart, histogram, "value", "range", "bins");
// Expose the x-axis' tickFormat method.
d3.rebind(chart, xAxis, "tickFormat");
return chart;
}
|
(function (angular) {
"use strict";
var app = angular.module('myApp.chat', ['ngRoute', 'firebase.utils', 'firebase']);
app.controller('ChatCtrl', ['$scope', 'messageList', function($scope, messageList) {
$scope.messages = messageList;
$scope.addMessage = function(newMessage) {
if( newMessage ) {
$scope.messages.$add({text: newMessage});
}
};
}]);
app.factory('messageList', ['fbutil', '$firebaseArray', function(fbutil, $firebaseArray) {
var ref = fbutil.ref('messages').limitToLast(10);
return $firebaseArray(ref);
}]);
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/chat', {
templateUrl: 'chat/chat.html',
controller: 'ChatCtrl'
});
}]);
})(angular); |
var keystone = require('../../../../index');
var Types = keystone.Field.Types;
var SourceRelationship = new keystone.List('SourceRelationship');
SourceRelationship.add({
name: {
type: String,
initial: true,
},
fieldA: {
type: Types.Relationship,
ref: 'TargetRelationship'
},
});
SourceRelationship.register();
SourceRelationship.defaultColumns = 'name, fieldA';
module.exports = SourceRelationship;
|
/*
* override-validation.js: Example of using prompt with complex properties and command-line input.
*
* (C) 2010, Nodejitsu Inc.
*
*/
var prompt = require('../lib/prompt'),
optimist = require('optimist');
var schema = {
properties: {
name: {
pattern: /^[a-zA-Z\s-]+$/,
message: 'Name must be only letters, spaces, or dashes',
required: true
},
email: {
name: 'email',
format: 'email',
message: 'Must be a valid email address'
}
}
};
//
// Set the overrides
//
prompt.override = optimist.argv
//
// Start the prompt
//
prompt.start();
//
// Get two properties from the user: email, password
//
prompt.get(schema, function (err, result) {
//
// Log the results.
//
console.log('Command-line input received:');
console.log(' name: ' + result.name);
console.log(' email: ' + result.email);
});
// try running
// $ node ./override-validation.js --name USER --email EMAIL
// You will only be asked for email because it's invalid
// $ node ./override-validation.js --name h$acker --email [email protected]
// You will only be asked for name becasue it's invalid
|
var Popup = {
// Borders
BorderThickness: 8,
BorderImage: '/images/popup_border_background.png',
BorderTopLeftImage: '/images/popup_border_top_left.png',
BorderTopRightImage: '/images/popup_border_top_right.png',
BorderBottomLeftImage: '/images/popup_border_bottom_left.png',
BorderBottomRightImage: '/images/popup_border_bottom_right.png',
// CSS Classes
PopupClass: 'popup',
WindowClass: 'popup_window',
TitlebarClass: 'popup_title',
CloseClass: 'close_popup',
PopupContentClass: 'popup_content',
ButtonsClass: 'popup_buttons',
DefaultButtonClass: 'default',
// Dialog Buttons
Okay: 'Okay',
Cancel: 'Cancel',
// Other Configuration
Draggable: false, // Window is draggable by titlebar
AutoFocus: true, // Focus on first control in popup
Singular: false // Other popups close when this is opened
};
Popup.windows = [];
Popup.zindex = 10000;
Popup.borderImages = function() {
return $A([
Popup.BorderImage,
Popup.BorderTopLeftImage,
Popup.BorderTopRightImage,
Popup.BorderBottomLeftImage,
Popup.BorderBottomRightImage
]);
}
Popup.preloadImages = function() {
if (!Popup.imagesPreloaded) {
Popup.borderImages().each(function(src) {
var image = new Image();
image.src = src;
});
Popup.preloadedImages = true;
}
}
Popup.TriggerBehavior = Behavior.create({
initialize: function(options) {
if (!Popup.windows[this.element.href]) {
var matches = this.element.href.match(/\#(.+)$/);
Popup.windows[this.element.href] = (matches ? new Popup.Window($(matches[1]), options) : new Popup.AjaxWindow(this.element.href, options));
}
this.window = Popup.windows[this.element.href];
},
onclick: function(event) {
this.popup();
event.stop();
},
popup: function() {
this.window.show();
}
});
Popup.AbstractWindow = Class.create({
initialize: function(options) {
options = Object.extend({
draggable: Popup.Draggable,
autofocus: Popup.AutoFocus,
singular: Popup.Singular
}, options);
this.draggable = options.draggable;
this.autofocus = options.autofocus;
this.singular = options.singular;
Popup.preloadImages();
this.buildWindow();
this.element.observe('click', this.click.bind(this));
this.element.observe('popup:hide', this.hide.bind(this));
},
buildWindow: function() {
this.element = $div({'class': Popup.WindowClass, style: 'display: none; padding: 0 ' + Popup.BorderThickness + 'px; position: absolute'});
this.top = $div({style: 'background: url(' + Popup.BorderImage + '); height: ' + Popup.BorderThickness + 'px'});
this.element.insert(this.top);
var outer = $div({style: 'background: url(' + Popup.BorderImage + '); margin: 0px -' + Popup.BorderThickness + 'px; padding: 0px ' + Popup.BorderThickness + 'px; position: relative'});
this.element.insert(outer);
this.bottom = $div({style: 'background: url(' + Popup.BorderImage + '); height: ' + Popup.BorderThickness + 'px'});
this.element.insert(this.bottom);
var topLeft = $div({style: 'background: url(' + Popup.BorderTopLeftImage + '); height: ' + Popup.BorderThickness + 'px; width: ' + Popup.BorderThickness + 'px; position: absolute; left: 0; top: -' + Popup.BorderThickness + 'px'});
outer.insert(topLeft);
var topRight = $div({style: 'background: url(' + Popup.BorderTopRightImage + '); height: ' + Popup.BorderThickness + 'px; width: ' + Popup.BorderThickness + 'px; position: absolute; right: 0; top: -' + Popup.BorderThickness + 'px'});
outer.insert(topRight);
var bottomLeft = $div({style: 'background: url(' + Popup.BorderBottomLeftImage + '); height: ' + Popup.BorderThickness + 'px; width: ' + Popup.BorderThickness + 'px; position: absolute; left: 0; bottom: -' + Popup.BorderThickness + 'px'});
outer.insert(bottomLeft);
var bottomRight = $div({style: 'background: url(' + Popup.BorderBottomRightImage + '); height: ' + Popup.BorderThickness + 'px; width: ' + Popup.BorderThickness + 'px; position: absolute; right: 0; bottom: -' + Popup.BorderThickness + 'px'});
outer.insert(bottomRight);
this.content = $div({style: 'background-color: white'});
outer.insert(this.content);
var body = $$('body').first();
body.insert(this.element);
},
createDraggable: function() {
if (!this._draggable) {
this._draggable = new Draggable(this.element.identify(), {
handle: Popup.TitlebarClass,
scroll: window,
zindex: Popup.zindex,
onStart: function() { this.startDrag(); return true; }.bind(this),
onEnd: function() { this.endDrag(); return true; }.bind(this)
});
}
},
destroyDraggable: function() {
if (this._draggable) {
this._draggable.destroy();
this._draggable = null;
}
},
show: function() {
this.beforeShow();
this.element.show();
this.afterShow();
},
hide: function() {
this.beforeHide();
this.element.hide();
this.afterHide();
},
toggle: function() {
if (this.element.visible()) {
this.hide();
} else {
this.show();
}
},
focus: function() {
var form = this.element.down('form');
if (form) {
var elements = form.getElements().reject(function(e) { return e.type == 'hidden'; });
var element = elements[0] || form.down('button');
if (element) element.focus();
}
},
beforeShow: function() {
if (Prototype.Browser.IE) {
// IE fixes
var width = this.element.getWidth() - (Popup.BorderThickness * 2);
this.top.setStyle("width:" + width + "px");
this.bottom.setStyle("width:" + width + "px");
}
if (this.singular) Popup.closeAll();
this.bringToTop();
this.centerWindowInView();
},
afterShow: function() {
if (this.draggable) this.createDraggable();
if (this.autofocus) this.focus();
},
beforeHide: function() {
if (this.draggable) this.destroyDraggable();
},
afterHide: function() {
// noopp
},
titlebarClick: function(event) {
this.bringToTop();
},
startDrag: function() {
this.bringToTop();
},
endDrag: function() {
this.bringToTop();
},
click: function(event) {
if (event.target.hasClassName(Popup.TitlebarClass)) this.titlebarClick();
if (event.target.hasClassName(Popup.CloseClass)) this.hide();
},
centerWindowInView: function() {
var offsets = document.viewport.getScrollOffsets();
this.element.setStyle({
left: parseInt(offsets.left + (document.viewport.getWidth() - this.element.getWidth()) / 2) + 'px',
top: parseInt(offsets.top + (document.viewport.getHeight() - this.element.getHeight()) / 2.2) + 'px'
});
},
bringToTop: function() {
Popup.zindex += 1;
this.element.style.zIndex = Popup.zindex;
if (this._draggable) this._draggable.originalZ = Popup.zindex;
}
});
Popup.Window = Class.create(Popup.AbstractWindow, {
initialize: function($super, element, options) {
$super(options);
element = $(element);
element.remove();
this.content.update(element);
element.show();
}
});
Popup.AjaxWindow = Class.create(Popup.AbstractWindow, {
initialize: function($super, url, options) {
$super(options);
options = Object.extend({reload: true}, options);
this.url = url;
this.reload = options.reload;
},
show: function($super) {
if (!this.loaded || this.reload) {
this.hide();
new Ajax.Updater(this.content, this.url, {
asynchronous: false,
method: "get",
evalScripts: true,
onComplete: $super
});
this.loaded = true;
} else {
$super();
}
}
});
Popup.closeAll = function () {
$$('div.popup_window').each(function (el) { el.fire('popup:hide'); });
}
Popup.dialog = function(options) {
options = Object.extend({
title: 'Dialog',
message: '[message]',
width: '20em',
buttons: [Popup.Okay],
buttonClick: function() { }
}, options);
var wrapper = $div({'class': Popup.PopupClass, style: 'width:' + options.width});
wrapper.insert($div({'class': Popup.TitlebarClass}, options.title));
var content = $div({'class': Popup.PopupContentClass});
var paragraph = $p();
paragraph.innerHTML = options.message.gsub('\n', '<br />');
content.insert(paragraph);
var buttons = $div({'class': Popup.ButtonsClass});
for (var index = 0; index < options.buttons.length; index++) {
var classes = Popup.CloseClass;
if (index == 0) classes += ' ' + Popup.DefaultButtonClass;
buttons.insert($button({'class': classes}, options.buttons[index]));
}
content.insert(buttons);
wrapper.insert(content);
var popup = new Popup.AbstractWindow(options);
popup.content.insert(wrapper);
popup.element.observe('click', function(event) {
var button = event.target;
if (button.nodeName == "BUTTON") options.buttonClick(button.innerHTML);
}.bind(this));
popup.show();
}
Popup.confirm = function(message, options) {
options = Object.extend({
title: 'Confirm',
message: message,
width: '20em',
buttons: [Popup.Okay, Popup.Cancel],
okay: function() { },
cancel: function() { }
}, options);
options.buttonClick = options.buttonClick || function(button) {
if (button == Popup.Okay) options.okay();
if (button == Popup.Cancel) options.cancel();
};
Popup.dialog(options);
}
Popup.alert = function(message, options) {
options = Object.extend({
title: 'Alert',
buttons: [Popup.Okay]
}, options);
Popup.confirm(message, options);
}
// Element extensions
Element.addMethods({
closePopup: function(element) {
$(element).up('div.popup_window').fire('popup:hide');
}
}); |
var Browser = require('../../lib/browser')
var BrowserCollection = require('../../lib/browser_collection')
var EventEmitter = require('../../lib/events').EventEmitter
var Executor = require('../../lib/executor')
describe('executor', () => {
var emitter
var capturedBrowsers
var config
var spy
var executor
beforeEach(() => {
config = {client: {}}
emitter = new EventEmitter()
capturedBrowsers = new BrowserCollection(emitter)
capturedBrowsers.add(new Browser())
executor = new Executor(capturedBrowsers, config, emitter)
executor.socketIoSockets = new EventEmitter()
spy = {
onRunStart: () => null,
onSocketsExecute: () => null
}
sinon.spy(spy, 'onRunStart')
sinon.spy(spy, 'onSocketsExecute')
emitter.on('run_start', spy.onRunStart)
executor.socketIoSockets.on('execute', spy.onSocketsExecute)
})
it('should start the run and pass client config', () => {
capturedBrowsers.areAllReady = () => true
executor.schedule()
expect(spy.onRunStart).to.have.been.called
expect(spy.onSocketsExecute).to.have.been.calledWith(config.client)
})
it('should wait for all browsers to finish', () => {
capturedBrowsers.areAllReady = () => false
// they are not ready yet
executor.schedule()
expect(spy.onRunStart).not.to.have.been.called
expect(spy.onSocketsExecute).not.to.have.been.called
capturedBrowsers.areAllReady = () => true
emitter.emit('run_complete')
expect(spy.onRunStart).to.have.been.called
expect(spy.onSocketsExecute).to.have.been.called
})
})
|
/**
* @fileoverview Rule to flag declared but unused variables
* @author Ilya Volodin
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = function(context) {
var MESSAGE = "{{name}} is defined but never used";
var config = {
vars: "all",
args: "after-used"
};
if (context.options[0]) {
if (typeof context.options[0] === "string") {
config.vars = context.options[0];
} else {
config.vars = context.options[0].vars || config.vars;
config.args = context.options[0].args || config.args;
}
}
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------
/**
* Determines if a given variable is being exported from a module.
* @param {Variable} variable - EScope variable object.
* @returns {boolean} True if the variable is exported, false if not.
* @private
*/
function isExported(variable) {
var definition = variable.defs[0];
if (definition) {
var node = definition.node;
if (node.type === "VariableDeclarator") {
node = node.parent;
} else if (definition.type === "Parameter" && node.type === "FunctionDeclaration") {
return false;
}
return node.parent.type.indexOf("Export") === 0;
} else {
return false;
}
}
/**
* Determines if a reference is a read operation.
* @param {Reference} ref - An escope Reference
* @returns {Boolean} whether the given reference represents a read operation
* @private
*/
function isReadRef(ref) {
return ref.isRead();
}
/**
* Determine if an identifier is referencing an enclosing function name.
* @param {Reference} ref - The reference to check.
* @param {ASTNode[]} nodes - The candidate function nodes.
* @returns {boolean} True if it's a self-reference, false if not.
* @private
*/
function isSelfReference(ref, nodes) {
var scope = ref.from;
while (scope != null) {
if (nodes.indexOf(scope.block) >= 0) {
return true;
}
scope = scope.upper;
}
return false;
}
/**
* Determines if the variable is used.
* @param {Variable} variable - The variable to check.
* @param {Reference[]} references - The variable references to check.
* @returns {boolean} True if the variable is used
*/
function isUsedVariable(variable, references) {
var functionNodes = variable.defs.filter(function(def) {
return def.type === "FunctionName";
}).map(function(def) {
return def.node;
}),
isFunctionDefinition = functionNodes.length > 0;
return references.some(function(ref) {
return isReadRef(ref) && !(isFunctionDefinition && isSelfReference(ref, functionNodes));
});
}
/**
* Gets unresolved references.
* They contains var's, function's, and explicit global variable's.
* If `config.vars` is not "all", returns empty map.
* @param {Scope} scope - the global scope.
* @returns {object} Unresolved references. Keys of the object is its variable name. Values of the object is an array of its references.
* @private
*/
function collectUnresolvedReferences(scope) {
var unresolvedRefs = Object.create(null);
if (config.vars === "all") {
for (var i = 0, l = scope.through.length; i < l; ++i) {
var ref = scope.through[i];
var name = ref.identifier.name;
if (isReadRef(ref)) {
if (!unresolvedRefs[name]) {
unresolvedRefs[name] = [];
}
unresolvedRefs[name].push(ref);
}
}
}
return unresolvedRefs;
}
/**
* Gets an array of variables without read references.
* @param {Scope} scope - an escope Scope object.
* @param {object} unresolvedRefs - a map of each variable name and its references.
* @param {Variable[]} unusedVars - an array that saving result.
* @returns {Variable[]} unused variables of the scope and descendant scopes.
* @private
*/
function collectUnusedVariables(scope, unresolvedRefs, unusedVars) {
var variables = scope.variables;
var childScopes = scope.childScopes;
var i, l;
if (scope.type !== "TDZ" && (scope.type !== "global" || config.vars === "all")) {
for (i = 0, l = variables.length; i < l; ++i) {
var variable = variables[i];
// skip a variable of class itself name in the class scope
if (scope.type === "class" && scope.block.id === variable.identifiers[0]) {
continue;
}
// skip function expression names and variables marked with markVariableAsUsed()
if (scope.functionExpressionScope || variable.eslintUsed) {
continue;
}
// skip implicit "arguments" variable
if (scope.type === "function" && variable.name === "arguments" && variable.identifiers.length === 0) {
continue;
}
// explicit global variables don't have definitions.
var def = variable.defs[0];
if (def != null) {
var type = def.type;
// skip catch variables
if (type === "CatchClause") {
continue;
}
// skip any setter argument
if (type === "Parameter" && def.node.parent.type === "Property" && def.node.parent.kind === "set") {
continue;
}
// if "args" option is "none", skip any parameter
if (config.args === "none" && type === "Parameter") {
continue;
}
// if "args" option is "after-used", skip all but the last parameter
if (config.args === "after-used" && type === "Parameter" && def.index < def.node.params.length - 1) {
continue;
}
}
// On global, variables without let/const/class are unresolved.
var references = (scope.type === "global" ? unresolvedRefs[variable.name] : null) || variable.references;
if (!isUsedVariable(variable, references) && !isExported(variable)) {
unusedVars.push(variable);
}
}
}
for (i = 0, l = childScopes.length; i < l; ++i) {
collectUnusedVariables(childScopes[i], unresolvedRefs, unusedVars);
}
return unusedVars;
}
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
"Program:exit": function(programNode) {
var globalScope = context.getScope();
var unresolvedRefs = collectUnresolvedReferences(globalScope);
var unusedVars = collectUnusedVariables(globalScope, unresolvedRefs, []);
for (var i = 0, l = unusedVars.length; i < l; ++i) {
var unusedVar = unusedVars[i];
if (unusedVar.eslintUsed) {
continue; // explicitly exported variables
} else if (unusedVar.eslintExplicitGlobal) {
context.report(programNode, MESSAGE, unusedVar);
} else if (unusedVar.defs.length > 0) {
context.report(unusedVar.identifiers[0], MESSAGE, unusedVar);
}
}
}
};
};
module.exports.schema = [
{
"oneOf": [
{
"enum": ["all", "local"]
},
{
"type": "object",
"properties": {
"vars": {
"enum": ["all", "local"]
},
"args": {
"enum": ["all", "after-used", "none"]
}
}
}
]
}
];
|
IntlMessageFormat.__addLocaleData({locale:"sq", messageformat:{pluralFunction:function (n) { n=Math.floor(n);if(n===1)return"one";return"other"; }}}); |
define("ace/snippets/rust",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="rust"});
(function() {
window.require(["ace/snippets/rust"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
|
/*! JointJS v1.0.3 (2016-11-22) - JavaScript diagramming library
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
if (typeof exports === 'object') {
var graphlib = require('graphlib');
var dagre = require('dagre');
}
// In the browser, these variables are set to undefined because of JavaScript hoisting.
// In that case, should grab them from the window object.
graphlib = graphlib || (typeof window !== 'undefined' && window.graphlib);
dagre = dagre || (typeof window !== 'undefined' && window.dagre);
joint.layout.DirectedGraph = {
layout: function(graphOrCells, opt) {
var graph;
if (graphOrCells instanceof joint.dia.Graph) {
graph = graphOrCells;
} else {
// Reset cells in dry mode so the graph reference is not stored on the cells.
graph = (new joint.dia.Graph()).resetCells(graphOrCells, { dry: true });
}
// This is not needed anymore.
graphOrCells = null;
opt = _.defaults(opt || {}, {
resizeClusters: true,
clusterPadding: 10
});
// create a graphlib.Graph that represents the joint.dia.Graph
var glGraph = graph.toGraphLib({
directed: true,
// We are about to use edge naming feature.
multigraph: true,
// We are able to layout graphs with embeds.
compound: true,
setNodeLabel: function(element) {
return {
width: element.get('size').width,
height: element.get('size').height,
rank: element.get('rank')
};
},
setEdgeLabel: function(link) {
return {
minLen: link.get('minLen') || 1
};
},
setEdgeName: function(link) {
// Graphlib edges have no ids. We use edge name property
// to store and retrieve ids instead.
return link.id;
}
});
var glLabel = {};
var marginX = opt.marginX || 0;
var marginY = opt.marginY || 0;
// Dagre layout accepts options as lower case.
// Direction for rank nodes. Can be TB, BT, LR, or RL
if (opt.rankDir) glLabel.rankdir = opt.rankDir;
// Alignment for rank nodes. Can be UL, UR, DL, or DR
if (opt.align) glLabel.align = opt.align;
// Number of pixels that separate nodes horizontally in the layout.
if (opt.nodeSep) glLabel.nodesep = opt.nodeSep;
// Number of pixels that separate edges horizontally in the layout.
if (opt.edgeSep) glLabel.edgesep = opt.edgeSep;
// Number of pixels between each rank in the layout.
if (opt.rankSep) glLabel.ranksep = opt.rankSep;
// Number of pixels to use as a margin around the left and right of the graph.
if (marginX) glLabel.marginx = marginX;
// Number of pixels to use as a margin around the top and bottom of the graph.
if (marginY) glLabel.marginy = marginY;
// Set the option object for the graph label.
glGraph.setGraph(glLabel);
// Executes the layout.
dagre.layout(glGraph, { debugTiming: !!opt.debugTiming });
// Wrap all graph changes into a batch.
graph.startBatch('layout');
// Update the graph.
graph.fromGraphLib(glGraph, {
importNode: function(v, gl) {
var element = this.getCell(v);
var glNode = gl.node(v);
if (opt.setPosition) {
opt.setPosition(element, glNode);
} else {
element.set('position', {
x: glNode.x - glNode.width / 2,
y: glNode.y - glNode.height / 2
});
}
},
importEdge: function(edgeObj, gl) {
var link = this.getCell(edgeObj.name);
var glEdge = gl.edge(edgeObj);
var points = glEdge.points || [];
if (opt.setLinkVertices) {
if (opt.setVertices) {
opt.setVertices(link, points);
} else {
// Remove the first and last point from points array.
// Those are source/target element connection points
// ie. they lies on the edge of connected elements.
link.set('vertices', points.slice(1, points.length - 1));
}
}
}
});
if (opt.resizeClusters) {
// Resize and reposition cluster elements (parents of other elements)
// to fit their children.
// 1. filter clusters only
// 2. map id on cells
// 3. sort cells by their depth (the deepest first)
// 4. resize cell to fit their direct children only.
_.chain(glGraph.nodes())
.filter(function(v) { return glGraph.children(v).length > 0; })
.map(graph.getCell, graph)
.sortBy(function(cluster) { return -cluster.getAncestors().length; })
.invoke('fitEmbeds', { padding: opt.clusterPadding })
.value();
}
graph.stopBatch('layout');
// Width and height of the graph extended by margins.
var glSize = glGraph.graph();
// Return the bounding box of the graph after the layout.
return g.Rect(
marginX,
marginY,
Math.abs(glSize.width - 2 * marginX),
Math.abs(glSize.height - 2 * marginY)
);
},
fromGraphLib: function(glGraph, opt) {
opt = opt || {};
var importNode = opt.importNode || _.noop;
var importEdge = opt.importEdge || _.noop;
var graph = (this instanceof joint.dia.Graph) ? this : new joint.dia.Graph;
// Import all nodes.
glGraph.nodes().forEach(function(node) {
importNode.call(graph, node, glGraph, graph, opt);
});
// Import all edges.
glGraph.edges().forEach(function(edge) {
importEdge.call(graph, edge, glGraph, graph, opt);
});
return graph;
},
// Create new graphlib graph from existing JointJS graph.
toGraphLib: function(graph, opt) {
opt = opt || {};
var glGraphType = _.pick(opt, 'directed', 'compound', 'multigraph');
var glGraph = new graphlib.Graph(glGraphType);
var setNodeLabel = opt.setNodeLabel || _.noop;
var setEdgeLabel = opt.setEdgeLabel || _.noop;
var setEdgeName = opt.setEdgeName || _.noop;
graph.get('cells').each(function(cell) {
if (cell.isLink()) {
var source = cell.get('source');
var target = cell.get('target');
// Links that end at a point are ignored.
if (!source.id || !target.id) return;
// Note that if we are creating a multigraph we can name the edges. If
// we try to name edges on a non-multigraph an exception is thrown.
glGraph.setEdge(source.id, target.id, setEdgeLabel(cell), setEdgeName(cell));
} else {
glGraph.setNode(cell.id, setNodeLabel(cell));
// For the compound graphs we have to take embeds into account.
if (glGraph.isCompound() && cell.has('parent')) {
glGraph.setParent(cell.id, cell.get('parent'));
}
}
});
return glGraph;
}
};
joint.dia.Graph.prototype.toGraphLib = function(opt) {
return joint.layout.DirectedGraph.toGraphLib(this, opt);
};
joint.dia.Graph.prototype.fromGraphLib = function(glGraph, opt) {
return joint.layout.DirectedGraph.fromGraphLib.call(this, glGraph, opt);
};
|
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["restful"] = factory();
else
root["restful"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _src = __webpack_require__(1);
var _src2 = _interopRequireDefault(_src);
var _srcHttpFetch = __webpack_require__(9);
var _srcHttpFetch2 = _interopRequireDefault(_srcHttpFetch);
__webpack_require__(19);
exports['default'] = function (baseUrl) {
var httpBackend = arguments.length <= 1 || arguments[1] === undefined ? (0, _srcHttpFetch2['default'])(fetch) : arguments[1];
return (0, _src2['default'])(baseUrl, httpBackend);
};
module.exports = exports['default'];
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _modelEndpoint = __webpack_require__(2);
var _modelEndpoint2 = _interopRequireDefault(_modelEndpoint);
var _httpFetch = __webpack_require__(9);
var _httpFetch2 = _interopRequireDefault(_httpFetch);
var _serviceHttp = __webpack_require__(14);
var _serviceHttp2 = _interopRequireDefault(_serviceHttp);
var _modelDecorator = __webpack_require__(15);
var _httpRequest = __webpack_require__(16);
var _httpRequest2 = _interopRequireDefault(_httpRequest);
var _modelScope = __webpack_require__(17);
var _modelScope2 = _interopRequireDefault(_modelScope);
var instances = [];
function restful(baseUrl, httpBackend) {
var rootScope = (0, _modelScope2['default'])();
rootScope.assign('config', 'entityIdentifier', 'id');
if (!baseUrl && typeof window !== 'undefined' && window.location) {
rootScope.set('url', window.location.protocol + '//' + window.location.host);
} else {
rootScope.set('url', baseUrl);
}
var rootEndpoint = (0, _modelDecorator.member)((0, _modelEndpoint2['default'])((0, _serviceHttp2['default'])(httpBackend))(rootScope));
instances.push(rootEndpoint);
return rootEndpoint;
}
restful._instances = function () {
return instances;
};
restful._flush = function () {
return instances.length = 0;
};
exports.fetchBackend = _httpFetch2['default'];
exports.requestBackend = _httpRequest2['default'];
exports['default'] = restful;
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _objectAssign = __webpack_require__(3);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _response = __webpack_require__(4);
var _response2 = _interopRequireDefault(_response);
var _immutable = __webpack_require__(6);
var _utilSerialize = __webpack_require__(7);
var _utilSerialize2 = _interopRequireDefault(_utilSerialize);
/* eslint-disable new-cap */
exports['default'] = function (request) {
return function endpointFactory(scope) {
scope.on('error', function () {
return true;
}); // Add a default error listener to prevent unwanted exception
var endpoint = {}; // Persists reference
function _generateRequestConfig(method, data, params, headers) {
var config = (0, _immutable.Map)({
errorInterceptors: (0, _immutable.List)(scope.get('errorInterceptors')),
headers: (0, _immutable.Map)(scope.get('headers')).mergeDeep((0, _immutable.Map)(headers)),
method: method,
params: params,
requestInterceptors: (0, _immutable.List)(scope.get('requestInterceptors')),
responseInterceptors: (0, _immutable.List)(scope.get('responseInterceptors')),
url: scope.get('url')
});
if (data) {
if (!config.hasIn(['headers', 'Content-Type'])) {
config = config.setIn(['headers', 'Content-Type'], 'application/json;charset=UTF-8');
}
config = config.set('data', (0, _immutable.fromJS)(data));
}
return config;
}
function _onResponse(config, rawResponse) {
var response = (0, _response2['default'])(rawResponse, endpoint);
scope.emit('response', response, (0, _utilSerialize2['default'])(config));
return response;
}
function _onError(config, error) {
scope.emit('error', error, (0, _utilSerialize2['default'])(config));
throw error;
}
function _httpMethodFactory(method) {
var expectData = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
var emitter = function emitter() {
scope.emit.apply(scope, arguments);
};
if (expectData) {
return function (data) {
var params = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
var headers = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var config = _generateRequestConfig(method, data, params, headers);
return request(config, emitter).then(function (rawResponse) {
return _onResponse(config, rawResponse);
}, function (rawResponse) {
return _onError(config, rawResponse);
});
};
}
return function () {
var params = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];
var headers = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
var config = _generateRequestConfig(method, null, params, headers);
return request(config, emitter).then(function (rawResponse) {
return _onResponse(config, rawResponse);
}, function (error) {
return _onError(config, error);
});
};
}
function addInterceptor(type) {
return function (interceptor) {
scope.push(type + 'Interceptors', interceptor);
return endpoint;
};
}
(0, _objectAssign2['default'])(endpoint, {
addErrorInterceptor: addInterceptor('error'),
addRequestInterceptor: addInterceptor('request'),
addResponseInterceptor: addInterceptor('response'),
'delete': _httpMethodFactory('delete'),
identifier: function identifier(newIdentifier) {
if (newIdentifier === undefined) {
return scope.get('config').get('entityIdentifier');
}
scope.assign('config', 'entityIdentifier', newIdentifier);
return endpoint;
},
get: _httpMethodFactory('get', false),
head: _httpMethodFactory('head', false),
header: function header(key, value) {
return scope.assign('headers', key, value);
},
headers: function headers() {
return scope.get('headers');
},
'new': function _new(url) {
var childScope = scope['new']();
childScope.set('url', url);
return endpointFactory(childScope);
},
on: scope.on,
once: scope.once,
patch: _httpMethodFactory('patch'),
post: _httpMethodFactory('post'),
put: _httpMethodFactory('put'),
url: function url() {
return scope.get('url');
}
});
return endpoint;
};
};
module.exports = exports['default'];
/***/ },
/* 3 */
/***/ function(module, exports) {
'use strict';
function ToObject(val) {
if (val == null) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
module.exports = Object.assign || function (target, source) {
var from;
var keys;
var to = ToObject(target);
for (var s = 1; s < arguments.length; s++) {
from = arguments[s];
keys = Object.keys(Object(from));
for (var i = 0; i < keys.length; i++) {
to[keys[i]] = from[keys[i]];
}
}
return to;
};
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _entity = __webpack_require__(5);
var _entity2 = _interopRequireDefault(_entity);
var _immutable = __webpack_require__(6);
var _utilSerialize = __webpack_require__(7);
var _utilSerialize2 = _interopRequireDefault(_utilSerialize);
var _warning = __webpack_require__(8);
var _warning2 = _interopRequireDefault(_warning);
/* eslint-disable new-cap */
exports['default'] = function (response, decoratedEndpoint) {
var identifier = decoratedEndpoint.identifier();
return {
statusCode: function statusCode() {
return (0, _utilSerialize2['default'])(response.get('statusCode'));
},
body: function body() {
var hydrate = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
var data = response.get('data');
if (!hydrate) {
return (0, _utilSerialize2['default'])(data);
}
if (_immutable.List.isList(data)) {
(0, _warning2['default'])(response.get('method') !== 'get' || !decoratedEndpoint.all, 'Unexpected array as response, you should use all method for that');
return (0, _utilSerialize2['default'])(data.map(function (datum) {
var id = datum.get(identifier);
return (0, _entity2['default'])((0, _utilSerialize2['default'])(datum), decoratedEndpoint.custom('' + id));
}));
}
(0, _warning2['default'])(response.get('method') !== 'get' || decoratedEndpoint.all, 'Expected array as response, you should use one method for that');
return (0, _entity2['default'])((0, _utilSerialize2['default'])(data), decoratedEndpoint);
},
headers: function headers() {
return (0, _utilSerialize2['default'])(response.get('headers'));
}
};
};
module.exports = exports['default'];
/***/ },
/* 5 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = function (_data, endpoint) {
return {
all: endpoint.all,
custom: endpoint.custom,
data: function data() {
return _data;
},
"delete": endpoint["delete"],
id: function id() {
return _data[endpoint.identifier()];
},
one: endpoint.one,
save: function save() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return endpoint.put.apply(endpoint, [_data].concat(args));
},
url: endpoint.url
};
};
module.exports = exports["default"];
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
(function (global, factory) {
true ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
global.Immutable = factory();
}(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice;
function createClass(ctor, superClass) {
if (superClass) {
ctor.prototype = Object.create(superClass.prototype);
}
ctor.prototype.constructor = ctor;
}
function Iterable(value) {
return isIterable(value) ? value : Seq(value);
}
createClass(KeyedIterable, Iterable);
function KeyedIterable(value) {
return isKeyed(value) ? value : KeyedSeq(value);
}
createClass(IndexedIterable, Iterable);
function IndexedIterable(value) {
return isIndexed(value) ? value : IndexedSeq(value);
}
createClass(SetIterable, Iterable);
function SetIterable(value) {
return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);
}
function isIterable(maybeIterable) {
return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);
}
function isKeyed(maybeKeyed) {
return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);
}
function isIndexed(maybeIndexed) {
return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);
}
function isAssociative(maybeAssociative) {
return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);
}
function isOrdered(maybeOrdered) {
return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);
}
Iterable.isIterable = isIterable;
Iterable.isKeyed = isKeyed;
Iterable.isIndexed = isIndexed;
Iterable.isAssociative = isAssociative;
Iterable.isOrdered = isOrdered;
Iterable.Keyed = KeyedIterable;
Iterable.Indexed = IndexedIterable;
Iterable.Set = SetIterable;
var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';
var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
// Used for setting prototype methods that IE8 chokes on.
var DELETE = 'delete';
// Constants describing the size of trie nodes.
var SHIFT = 5; // Resulted in best performance after ______?
var SIZE = 1 << SHIFT;
var MASK = SIZE - 1;
// A consistent shared value representing "not set" which equals nothing other
// than itself, and nothing that could be provided externally.
var NOT_SET = {};
// Boolean references, Rough equivalent of `bool &`.
var CHANGE_LENGTH = { value: false };
var DID_ALTER = { value: false };
function MakeRef(ref) {
ref.value = false;
return ref;
}
function SetRef(ref) {
ref && (ref.value = true);
}
// A function which returns a value representing an "owner" for transient writes
// to tries. The return value will only ever equal itself, and will not equal
// the return of any subsequent call of this function.
function OwnerID() {}
// http://jsperf.com/copy-array-inline
function arrCopy(arr, offset) {
offset = offset || 0;
var len = Math.max(0, arr.length - offset);
var newArr = new Array(len);
for (var ii = 0; ii < len; ii++) {
newArr[ii] = arr[ii + offset];
}
return newArr;
}
function ensureSize(iter) {
if (iter.size === undefined) {
iter.size = iter.__iterate(returnTrue);
}
return iter.size;
}
function wrapIndex(iter, index) {
// This implements "is array index" which the ECMAString spec defines as:
//
// A String property name P is an array index if and only if
// ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal
// to 2^32−1.
//
// http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects
if (typeof index !== 'number') {
var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32
if ('' + uint32Index !== index || uint32Index === 4294967295) {
return NaN;
}
index = uint32Index;
}
return index < 0 ? ensureSize(iter) + index : index;
}
function returnTrue() {
return true;
}
function wholeSlice(begin, end, size) {
return (begin === 0 || (size !== undefined && begin <= -size)) &&
(end === undefined || (size !== undefined && end >= size));
}
function resolveBegin(begin, size) {
return resolveIndex(begin, size, 0);
}
function resolveEnd(end, size) {
return resolveIndex(end, size, size);
}
function resolveIndex(index, size, defaultIndex) {
return index === undefined ?
defaultIndex :
index < 0 ?
Math.max(0, size + index) :
size === undefined ?
index :
Math.min(size, index);
}
/* global Symbol */
var ITERATE_KEYS = 0;
var ITERATE_VALUES = 1;
var ITERATE_ENTRIES = 2;
var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator';
var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;
function Iterator(next) {
this.next = next;
}
Iterator.prototype.toString = function() {
return '[Iterator]';
};
Iterator.KEYS = ITERATE_KEYS;
Iterator.VALUES = ITERATE_VALUES;
Iterator.ENTRIES = ITERATE_ENTRIES;
Iterator.prototype.inspect =
Iterator.prototype.toSource = function () { return this.toString(); }
Iterator.prototype[ITERATOR_SYMBOL] = function () {
return this;
};
function iteratorValue(type, k, v, iteratorResult) {
var value = type === 0 ? k : type === 1 ? v : [k, v];
iteratorResult ? (iteratorResult.value = value) : (iteratorResult = {
value: value, done: false
});
return iteratorResult;
}
function iteratorDone() {
return { value: undefined, done: true };
}
function hasIterator(maybeIterable) {
return !!getIteratorFn(maybeIterable);
}
function isIterator(maybeIterator) {
return maybeIterator && typeof maybeIterator.next === 'function';
}
function getIterator(iterable) {
var iteratorFn = getIteratorFn(iterable);
return iteratorFn && iteratorFn.call(iterable);
}
function getIteratorFn(iterable) {
var iteratorFn = iterable && (
(REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||
iterable[FAUX_ITERATOR_SYMBOL]
);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
function isArrayLike(value) {
return value && typeof value.length === 'number';
}
createClass(Seq, Iterable);
function Seq(value) {
return value === null || value === undefined ? emptySequence() :
isIterable(value) ? value.toSeq() : seqFromValue(value);
}
Seq.of = function(/*...values*/) {
return Seq(arguments);
};
Seq.prototype.toSeq = function() {
return this;
};
Seq.prototype.toString = function() {
return this.__toString('Seq {', '}');
};
Seq.prototype.cacheResult = function() {
if (!this._cache && this.__iterateUncached) {
this._cache = this.entrySeq().toArray();
this.size = this._cache.length;
}
return this;
};
// abstract __iterateUncached(fn, reverse)
Seq.prototype.__iterate = function(fn, reverse) {
return seqIterate(this, fn, reverse, true);
};
// abstract __iteratorUncached(type, reverse)
Seq.prototype.__iterator = function(type, reverse) {
return seqIterator(this, type, reverse, true);
};
createClass(KeyedSeq, Seq);
function KeyedSeq(value) {
return value === null || value === undefined ?
emptySequence().toKeyedSeq() :
isIterable(value) ?
(isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) :
keyedSeqFromValue(value);
}
KeyedSeq.prototype.toKeyedSeq = function() {
return this;
};
createClass(IndexedSeq, Seq);
function IndexedSeq(value) {
return value === null || value === undefined ? emptySequence() :
!isIterable(value) ? indexedSeqFromValue(value) :
isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();
}
IndexedSeq.of = function(/*...values*/) {
return IndexedSeq(arguments);
};
IndexedSeq.prototype.toIndexedSeq = function() {
return this;
};
IndexedSeq.prototype.toString = function() {
return this.__toString('Seq [', ']');
};
IndexedSeq.prototype.__iterate = function(fn, reverse) {
return seqIterate(this, fn, reverse, false);
};
IndexedSeq.prototype.__iterator = function(type, reverse) {
return seqIterator(this, type, reverse, false);
};
createClass(SetSeq, Seq);
function SetSeq(value) {
return (
value === null || value === undefined ? emptySequence() :
!isIterable(value) ? indexedSeqFromValue(value) :
isKeyed(value) ? value.entrySeq() : value
).toSetSeq();
}
SetSeq.of = function(/*...values*/) {
return SetSeq(arguments);
};
SetSeq.prototype.toSetSeq = function() {
return this;
};
Seq.isSeq = isSeq;
Seq.Keyed = KeyedSeq;
Seq.Set = SetSeq;
Seq.Indexed = IndexedSeq;
var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
Seq.prototype[IS_SEQ_SENTINEL] = true;
createClass(ArraySeq, IndexedSeq);
function ArraySeq(array) {
this._array = array;
this.size = array.length;
}
ArraySeq.prototype.get = function(index, notSetValue) {
return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;
};
ArraySeq.prototype.__iterate = function(fn, reverse) {
var array = this._array;
var maxIndex = array.length - 1;
for (var ii = 0; ii <= maxIndex; ii++) {
if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {
return ii + 1;
}
}
return ii;
};
ArraySeq.prototype.__iterator = function(type, reverse) {
var array = this._array;
var maxIndex = array.length - 1;
var ii = 0;
return new Iterator(function()
{return ii > maxIndex ?
iteratorDone() :
iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])}
);
};
createClass(ObjectSeq, KeyedSeq);
function ObjectSeq(object) {
var keys = Object.keys(object);
this._object = object;
this._keys = keys;
this.size = keys.length;
}
ObjectSeq.prototype.get = function(key, notSetValue) {
if (notSetValue !== undefined && !this.has(key)) {
return notSetValue;
}
return this._object[key];
};
ObjectSeq.prototype.has = function(key) {
return this._object.hasOwnProperty(key);
};
ObjectSeq.prototype.__iterate = function(fn, reverse) {
var object = this._object;
var keys = this._keys;
var maxIndex = keys.length - 1;
for (var ii = 0; ii <= maxIndex; ii++) {
var key = keys[reverse ? maxIndex - ii : ii];
if (fn(object[key], key, this) === false) {
return ii + 1;
}
}
return ii;
};
ObjectSeq.prototype.__iterator = function(type, reverse) {
var object = this._object;
var keys = this._keys;
var maxIndex = keys.length - 1;
var ii = 0;
return new Iterator(function() {
var key = keys[reverse ? maxIndex - ii : ii];
return ii++ > maxIndex ?
iteratorDone() :
iteratorValue(type, key, object[key]);
});
};
ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;
createClass(IterableSeq, IndexedSeq);
function IterableSeq(iterable) {
this._iterable = iterable;
this.size = iterable.length || iterable.size;
}
IterableSeq.prototype.__iterateUncached = function(fn, reverse) {
if (reverse) {
return this.cacheResult().__iterate(fn, reverse);
}
var iterable = this._iterable;
var iterator = getIterator(iterable);
var iterations = 0;
if (isIterator(iterator)) {
var step;
while (!(step = iterator.next()).done) {
if (fn(step.value, iterations++, this) === false) {
break;
}
}
}
return iterations;
};
IterableSeq.prototype.__iteratorUncached = function(type, reverse) {
if (reverse) {
return this.cacheResult().__iterator(type, reverse);
}
var iterable = this._iterable;
var iterator = getIterator(iterable);
if (!isIterator(iterator)) {
return new Iterator(iteratorDone);
}
var iterations = 0;
return new Iterator(function() {
var step = iterator.next();
return step.done ? step : iteratorValue(type, iterations++, step.value);
});
};
createClass(IteratorSeq, IndexedSeq);
function IteratorSeq(iterator) {
this._iterator = iterator;
this._iteratorCache = [];
}
IteratorSeq.prototype.__iterateUncached = function(fn, reverse) {
if (reverse) {
return this.cacheResult().__iterate(fn, reverse);
}
var iterator = this._iterator;
var cache = this._iteratorCache;
var iterations = 0;
while (iterations < cache.length) {
if (fn(cache[iterations], iterations++, this) === false) {
return iterations;
}
}
var step;
while (!(step = iterator.next()).done) {
var val = step.value;
cache[iterations] = val;
if (fn(val, iterations++, this) === false) {
break;
}
}
return iterations;
};
IteratorSeq.prototype.__iteratorUncached = function(type, reverse) {
if (reverse) {
return this.cacheResult().__iterator(type, reverse);
}
var iterator = this._iterator;
var cache = this._iteratorCache;
var iterations = 0;
return new Iterator(function() {
if (iterations >= cache.length) {
var step = iterator.next();
if (step.done) {
return step;
}
cache[iterations] = step.value;
}
return iteratorValue(type, iterations, cache[iterations++]);
});
};
// # pragma Helper functions
function isSeq(maybeSeq) {
return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);
}
var EMPTY_SEQ;
function emptySequence() {
return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));
}
function keyedSeqFromValue(value) {
var seq =
Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() :
isIterator(value) ? new IteratorSeq(value).fromEntrySeq() :
hasIterator(value) ? new IterableSeq(value).fromEntrySeq() :
typeof value === 'object' ? new ObjectSeq(value) :
undefined;
if (!seq) {
throw new TypeError(
'Expected Array or iterable object of [k, v] entries, '+
'or keyed object: ' + value
);
}
return seq;
}
function indexedSeqFromValue(value) {
var seq = maybeIndexedSeqFromValue(value);
if (!seq) {
throw new TypeError(
'Expected Array or iterable object of values: ' + value
);
}
return seq;
}
function seqFromValue(value) {
var seq = maybeIndexedSeqFromValue(value) ||
(typeof value === 'object' && new ObjectSeq(value));
if (!seq) {
throw new TypeError(
'Expected Array or iterable object of values, or keyed object: ' + value
);
}
return seq;
}
function maybeIndexedSeqFromValue(value) {
return (
isArrayLike(value) ? new ArraySeq(value) :
isIterator(value) ? new IteratorSeq(value) :
hasIterator(value) ? new IterableSeq(value) :
undefined
);
}
function seqIterate(seq, fn, reverse, useKeys) {
var cache = seq._cache;
if (cache) {
var maxIndex = cache.length - 1;
for (var ii = 0; ii <= maxIndex; ii++) {
var entry = cache[reverse ? maxIndex - ii : ii];
if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {
return ii + 1;
}
}
return ii;
}
return seq.__iterateUncached(fn, reverse);
}
function seqIterator(seq, type, reverse, useKeys) {
var cache = seq._cache;
if (cache) {
var maxIndex = cache.length - 1;
var ii = 0;
return new Iterator(function() {
var entry = cache[reverse ? maxIndex - ii : ii];
return ii++ > maxIndex ?
iteratorDone() :
iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);
});
}
return seq.__iteratorUncached(type, reverse);
}
function fromJS(json, converter) {
return converter ?
fromJSWith(converter, json, '', {'': json}) :
fromJSDefault(json);
}
function fromJSWith(converter, json, key, parentJSON) {
if (Array.isArray(json)) {
return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));
}
if (isPlainObj(json)) {
return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));
}
return json;
}
function fromJSDefault(json) {
if (Array.isArray(json)) {
return IndexedSeq(json).map(fromJSDefault).toList();
}
if (isPlainObj(json)) {
return KeyedSeq(json).map(fromJSDefault).toMap();
}
return json;
}
function isPlainObj(value) {
return value && (value.constructor === Object || value.constructor === undefined);
}
/**
* An extension of the "same-value" algorithm as [described for use by ES6 Map
* and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)
*
* NaN is considered the same as NaN, however -0 and 0 are considered the same
* value, which is different from the algorithm described by
* [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
*
* This is extended further to allow Objects to describe the values they
* represent, by way of `valueOf` or `equals` (and `hashCode`).
*
* Note: because of this extension, the key equality of Immutable.Map and the
* value equality of Immutable.Set will differ from ES6 Map and Set.
*
* ### Defining custom values
*
* The easiest way to describe the value an object represents is by implementing
* `valueOf`. For example, `Date` represents a value by returning a unix
* timestamp for `valueOf`:
*
* var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...
* var date2 = new Date(1234567890000);
* date1.valueOf(); // 1234567890000
* assert( date1 !== date2 );
* assert( Immutable.is( date1, date2 ) );
*
* Note: overriding `valueOf` may have other implications if you use this object
* where JavaScript expects a primitive, such as implicit string coercion.
*
* For more complex types, especially collections, implementing `valueOf` may
* not be performant. An alternative is to implement `equals` and `hashCode`.
*
* `equals` takes another object, presumably of similar type, and returns true
* if the it is equal. Equality is symmetrical, so the same result should be
* returned if this and the argument are flipped.
*
* assert( a.equals(b) === b.equals(a) );
*
* `hashCode` returns a 32bit integer number representing the object which will
* be used to determine how to store the value object in a Map or Set. You must
* provide both or neither methods, one must not exist without the other.
*
* Also, an important relationship between these methods must be upheld: if two
* values are equal, they *must* return the same hashCode. If the values are not
* equal, they might have the same hashCode; this is called a hash collision,
* and while undesirable for performance reasons, it is acceptable.
*
* if (a.equals(b)) {
* assert( a.hashCode() === b.hashCode() );
* }
*
* All Immutable collections implement `equals` and `hashCode`.
*
*/
function is(valueA, valueB) {
if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {
return true;
}
if (!valueA || !valueB) {
return false;
}
if (typeof valueA.valueOf === 'function' &&
typeof valueB.valueOf === 'function') {
valueA = valueA.valueOf();
valueB = valueB.valueOf();
if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {
return true;
}
if (!valueA || !valueB) {
return false;
}
}
if (typeof valueA.equals === 'function' &&
typeof valueB.equals === 'function' &&
valueA.equals(valueB)) {
return true;
}
return false;
}
function deepEqual(a, b) {
if (a === b) {
return true;
}
if (
!isIterable(b) ||
a.size !== undefined && b.size !== undefined && a.size !== b.size ||
a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash ||
isKeyed(a) !== isKeyed(b) ||
isIndexed(a) !== isIndexed(b) ||
isOrdered(a) !== isOrdered(b)
) {
return false;
}
if (a.size === 0 && b.size === 0) {
return true;
}
var notAssociative = !isAssociative(a);
if (isOrdered(a)) {
var entries = a.entries();
return b.every(function(v, k) {
var entry = entries.next().value;
return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));
}) && entries.next().done;
}
var flipped = false;
if (a.size === undefined) {
if (b.size === undefined) {
if (typeof a.cacheResult === 'function') {
a.cacheResult();
}
} else {
flipped = true;
var _ = a;
a = b;
b = _;
}
}
var allEqual = true;
var bSize = b.__iterate(function(v, k) {
if (notAssociative ? !a.has(v) :
flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {
allEqual = false;
return false;
}
});
return allEqual && a.size === bSize;
}
createClass(Repeat, IndexedSeq);
function Repeat(value, times) {
if (!(this instanceof Repeat)) {
return new Repeat(value, times);
}
this._value = value;
this.size = times === undefined ? Infinity : Math.max(0, times);
if (this.size === 0) {
if (EMPTY_REPEAT) {
return EMPTY_REPEAT;
}
EMPTY_REPEAT = this;
}
}
Repeat.prototype.toString = function() {
if (this.size === 0) {
return 'Repeat []';
}
return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';
};
Repeat.prototype.get = function(index, notSetValue) {
return this.has(index) ? this._value : notSetValue;
};
Repeat.prototype.includes = function(searchValue) {
return is(this._value, searchValue);
};
Repeat.prototype.slice = function(begin, end) {
var size = this.size;
return wholeSlice(begin, end, size) ? this :
new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));
};
Repeat.prototype.reverse = function() {
return this;
};
Repeat.prototype.indexOf = function(searchValue) {
if (is(this._value, searchValue)) {
return 0;
}
return -1;
};
Repeat.prototype.lastIndexOf = function(searchValue) {
if (is(this._value, searchValue)) {
return this.size;
}
return -1;
};
Repeat.prototype.__iterate = function(fn, reverse) {
for (var ii = 0; ii < this.size; ii++) {
if (fn(this._value, ii, this) === false) {
return ii + 1;
}
}
return ii;
};
Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this;
var ii = 0;
return new Iterator(function()
{return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()}
);
};
Repeat.prototype.equals = function(other) {
return other instanceof Repeat ?
is(this._value, other._value) :
deepEqual(other);
};
var EMPTY_REPEAT;
function invariant(condition, error) {
if (!condition) throw new Error(error);
}
createClass(Range, IndexedSeq);
function Range(start, end, step) {
if (!(this instanceof Range)) {
return new Range(start, end, step);
}
invariant(step !== 0, 'Cannot step a Range by 0');
start = start || 0;
if (end === undefined) {
end = Infinity;
}
step = step === undefined ? 1 : Math.abs(step);
if (end < start) {
step = -step;
}
this._start = start;
this._end = end;
this._step = step;
this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);
if (this.size === 0) {
if (EMPTY_RANGE) {
return EMPTY_RANGE;
}
EMPTY_RANGE = this;
}
}
Range.prototype.toString = function() {
if (this.size === 0) {
return 'Range []';
}
return 'Range [ ' +
this._start + '...' + this._end +
(this._step > 1 ? ' by ' + this._step : '') +
' ]';
};
Range.prototype.get = function(index, notSetValue) {
return this.has(index) ?
this._start + wrapIndex(this, index) * this._step :
notSetValue;
};
Range.prototype.includes = function(searchValue) {
var possibleIndex = (searchValue - this._start) / this._step;
return possibleIndex >= 0 &&
possibleIndex < this.size &&
possibleIndex === Math.floor(possibleIndex);
};
Range.prototype.slice = function(begin, end) {
if (wholeSlice(begin, end, this.size)) {
return this;
}
begin = resolveBegin(begin, this.size);
end = resolveEnd(end, this.size);
if (end <= begin) {
return new Range(0, 0);
}
return new Range(this.get(begin, this._end), this.get(end, this._end), this._step);
};
Range.prototype.indexOf = function(searchValue) {
var offsetValue = searchValue - this._start;
if (offsetValue % this._step === 0) {
var index = offsetValue / this._step;
if (index >= 0 && index < this.size) {
return index
}
}
return -1;
};
Range.prototype.lastIndexOf = function(searchValue) {
return this.indexOf(searchValue);
};
Range.prototype.__iterate = function(fn, reverse) {
var maxIndex = this.size - 1;
var step = this._step;
var value = reverse ? this._start + maxIndex * step : this._start;
for (var ii = 0; ii <= maxIndex; ii++) {
if (fn(value, ii, this) === false) {
return ii + 1;
}
value += reverse ? -step : step;
}
return ii;
};
Range.prototype.__iterator = function(type, reverse) {
var maxIndex = this.size - 1;
var step = this._step;
var value = reverse ? this._start + maxIndex * step : this._start;
var ii = 0;
return new Iterator(function() {
var v = value;
value += reverse ? -step : step;
return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);
});
};
Range.prototype.equals = function(other) {
return other instanceof Range ?
this._start === other._start &&
this._end === other._end &&
this._step === other._step :
deepEqual(this, other);
};
var EMPTY_RANGE;
createClass(Collection, Iterable);
function Collection() {
throw TypeError('Abstract');
}
createClass(KeyedCollection, Collection);function KeyedCollection() {}
createClass(IndexedCollection, Collection);function IndexedCollection() {}
createClass(SetCollection, Collection);function SetCollection() {}
Collection.Keyed = KeyedCollection;
Collection.Indexed = IndexedCollection;
Collection.Set = SetCollection;
var imul =
typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ?
Math.imul :
function imul(a, b) {
a = a | 0; // int
b = b | 0; // int
var c = a & 0xffff;
var d = b & 0xffff;
// Shift by 0 fixes the sign on the high part.
return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int
};
// v8 has an optimization for storing 31-bit signed numbers.
// Values which have either 00 or 11 as the high order bits qualify.
// This function drops the highest order bit in a signed number, maintaining
// the sign bit.
function smi(i32) {
return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF);
}
function hash(o) {
if (o === false || o === null || o === undefined) {
return 0;
}
if (typeof o.valueOf === 'function') {
o = o.valueOf();
if (o === false || o === null || o === undefined) {
return 0;
}
}
if (o === true) {
return 1;
}
var type = typeof o;
if (type === 'number') {
var h = o | 0;
if (h !== o) {
h ^= o * 0xFFFFFFFF;
}
while (o > 0xFFFFFFFF) {
o /= 0xFFFFFFFF;
h ^= o;
}
return smi(h);
}
if (type === 'string') {
return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);
}
if (typeof o.hashCode === 'function') {
return o.hashCode();
}
if (type === 'object') {
return hashJSObj(o);
}
if (typeof o.toString === 'function') {
return hashString(o.toString());
}
throw new Error('Value type ' + type + ' cannot be hashed.');
}
function cachedHashString(string) {
var hash = stringHashCache[string];
if (hash === undefined) {
hash = hashString(string);
if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {
STRING_HASH_CACHE_SIZE = 0;
stringHashCache = {};
}
STRING_HASH_CACHE_SIZE++;
stringHashCache[string] = hash;
}
return hash;
}
// http://jsperf.com/hashing-strings
function hashString(string) {
// This is the hash from JVM
// The hash code for a string is computed as
// s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],
// where s[i] is the ith character of the string and n is the length of
// the string. We "mod" the result to make it between 0 (inclusive) and 2^31
// (exclusive) by dropping high bits.
var hash = 0;
for (var ii = 0; ii < string.length; ii++) {
hash = 31 * hash + string.charCodeAt(ii) | 0;
}
return smi(hash);
}
function hashJSObj(obj) {
var hash;
if (usingWeakMap) {
hash = weakMap.get(obj);
if (hash !== undefined) {
return hash;
}
}
hash = obj[UID_HASH_KEY];
if (hash !== undefined) {
return hash;
}
if (!canDefineProperty) {
hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];
if (hash !== undefined) {
return hash;
}
hash = getIENodeHash(obj);
if (hash !== undefined) {
return hash;
}
}
hash = ++objHashUID;
if (objHashUID & 0x40000000) {
objHashUID = 0;
}
if (usingWeakMap) {
weakMap.set(obj, hash);
} else if (isExtensible !== undefined && isExtensible(obj) === false) {
throw new Error('Non-extensible objects are not allowed as keys.');
} else if (canDefineProperty) {
Object.defineProperty(obj, UID_HASH_KEY, {
'enumerable': false,
'configurable': false,
'writable': false,
'value': hash
});
} else if (obj.propertyIsEnumerable !== undefined &&
obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {
// Since we can't define a non-enumerable property on the object
// we'll hijack one of the less-used non-enumerable properties to
// save our hash on it. Since this is a function it will not show up in
// `JSON.stringify` which is what we want.
obj.propertyIsEnumerable = function() {
return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);
};
obj.propertyIsEnumerable[UID_HASH_KEY] = hash;
} else if (obj.nodeType !== undefined) {
// At this point we couldn't get the IE `uniqueID` to use as a hash
// and we couldn't use a non-enumerable property to exploit the
// dontEnum bug so we simply add the `UID_HASH_KEY` on the node
// itself.
obj[UID_HASH_KEY] = hash;
} else {
throw new Error('Unable to set a non-enumerable property on object.');
}
return hash;
}
// Get references to ES5 object methods.
var isExtensible = Object.isExtensible;
// True if Object.defineProperty works as expected. IE8 fails this test.
var canDefineProperty = (function() {
try {
Object.defineProperty({}, '@', {});
return true;
} catch (e) {
return false;
}
}());
// IE has a `uniqueID` property on DOM nodes. We can construct the hash from it
// and avoid memory leaks from the IE cloneNode bug.
function getIENodeHash(node) {
if (node && node.nodeType > 0) {
switch (node.nodeType) {
case 1: // Element
return node.uniqueID;
case 9: // Document
return node.documentElement && node.documentElement.uniqueID;
}
}
}
// If possible, use a WeakMap.
var usingWeakMap = typeof WeakMap === 'function';
var weakMap;
if (usingWeakMap) {
weakMap = new WeakMap();
}
var objHashUID = 0;
var UID_HASH_KEY = '__immutablehash__';
if (typeof Symbol === 'function') {
UID_HASH_KEY = Symbol(UID_HASH_KEY);
}
var STRING_HASH_CACHE_MIN_STRLEN = 16;
var STRING_HASH_CACHE_MAX_SIZE = 255;
var STRING_HASH_CACHE_SIZE = 0;
var stringHashCache = {};
function assertNotInfinite(size) {
invariant(
size !== Infinity,
'Cannot perform this action with an infinite size.'
);
}
createClass(Map, KeyedCollection);
// @pragma Construction
function Map(value) {
return value === null || value === undefined ? emptyMap() :
isMap(value) && !isOrdered(value) ? value :
emptyMap().withMutations(function(map ) {
var iter = KeyedIterable(value);
assertNotInfinite(iter.size);
iter.forEach(function(v, k) {return map.set(k, v)});
});
}
Map.prototype.toString = function() {
return this.__toString('Map {', '}');
};
// @pragma Access
Map.prototype.get = function(k, notSetValue) {
return this._root ?
this._root.get(0, undefined, k, notSetValue) :
notSetValue;
};
// @pragma Modification
Map.prototype.set = function(k, v) {
return updateMap(this, k, v);
};
Map.prototype.setIn = function(keyPath, v) {
return this.updateIn(keyPath, NOT_SET, function() {return v});
};
Map.prototype.remove = function(k) {
return updateMap(this, k, NOT_SET);
};
Map.prototype.deleteIn = function(keyPath) {
return this.updateIn(keyPath, function() {return NOT_SET});
};
Map.prototype.update = function(k, notSetValue, updater) {
return arguments.length === 1 ?
k(this) :
this.updateIn([k], notSetValue, updater);
};
Map.prototype.updateIn = function(keyPath, notSetValue, updater) {
if (!updater) {
updater = notSetValue;
notSetValue = undefined;
}
var updatedValue = updateInDeepMap(
this,
forceIterator(keyPath),
notSetValue,
updater
);
return updatedValue === NOT_SET ? undefined : updatedValue;
};
Map.prototype.clear = function() {
if (this.size === 0) {
return this;
}
if (this.__ownerID) {
this.size = 0;
this._root = null;
this.__hash = undefined;
this.__altered = true;
return this;
}
return emptyMap();
};
// @pragma Composition
Map.prototype.merge = function(/*...iters*/) {
return mergeIntoMapWith(this, undefined, arguments);
};
Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);
return mergeIntoMapWith(this, merger, iters);
};
Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);
return this.updateIn(
keyPath,
emptyMap(),
function(m ) {return typeof m.merge === 'function' ?
m.merge.apply(m, iters) :
iters[iters.length - 1]}
);
};
Map.prototype.mergeDeep = function(/*...iters*/) {
return mergeIntoMapWith(this, deepMerger, arguments);
};
Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);
return mergeIntoMapWith(this, deepMergerWith(merger), iters);
};
Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);
return this.updateIn(
keyPath,
emptyMap(),
function(m ) {return typeof m.mergeDeep === 'function' ?
m.mergeDeep.apply(m, iters) :
iters[iters.length - 1]}
);
};
Map.prototype.sort = function(comparator) {
// Late binding
return OrderedMap(sortFactory(this, comparator));
};
Map.prototype.sortBy = function(mapper, comparator) {
// Late binding
return OrderedMap(sortFactory(this, comparator, mapper));
};
// @pragma Mutability
Map.prototype.withMutations = function(fn) {
var mutable = this.asMutable();
fn(mutable);
return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;
};
Map.prototype.asMutable = function() {
return this.__ownerID ? this : this.__ensureOwner(new OwnerID());
};
Map.prototype.asImmutable = function() {
return this.__ensureOwner();
};
Map.prototype.wasAltered = function() {
return this.__altered;
};
Map.prototype.__iterator = function(type, reverse) {
return new MapIterator(this, type, reverse);
};
Map.prototype.__iterate = function(fn, reverse) {var this$0 = this;
var iterations = 0;
this._root && this._root.iterate(function(entry ) {
iterations++;
return fn(entry[1], entry[0], this$0);
}, reverse);
return iterations;
};
Map.prototype.__ensureOwner = function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
if (!ownerID) {
this.__ownerID = ownerID;
this.__altered = false;
return this;
}
return makeMap(this.size, this._root, ownerID, this.__hash);
};
function isMap(maybeMap) {
return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);
}
Map.isMap = isMap;
var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
var MapPrototype = Map.prototype;
MapPrototype[IS_MAP_SENTINEL] = true;
MapPrototype[DELETE] = MapPrototype.remove;
MapPrototype.removeIn = MapPrototype.deleteIn;
// #pragma Trie Nodes
function ArrayMapNode(ownerID, entries) {
this.ownerID = ownerID;
this.entries = entries;
}
ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {
var entries = this.entries;
for (var ii = 0, len = entries.length; ii < len; ii++) {
if (is(key, entries[ii][0])) {
return entries[ii][1];
}
}
return notSetValue;
};
ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
var removed = value === NOT_SET;
var entries = this.entries;
var idx = 0;
for (var len = entries.length; idx < len; idx++) {
if (is(key, entries[idx][0])) {
break;
}
}
var exists = idx < len;
if (exists ? entries[idx][1] === value : removed) {
return this;
}
SetRef(didAlter);
(removed || !exists) && SetRef(didChangeSize);
if (removed && entries.length === 1) {
return; // undefined
}
if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {
return createNodes(ownerID, entries, key, value);
}
var isEditable = ownerID && ownerID === this.ownerID;
var newEntries = isEditable ? entries : arrCopy(entries);
if (exists) {
if (removed) {
idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());
} else {
newEntries[idx] = [key, value];
}
} else {
newEntries.push([key, value]);
}
if (isEditable) {
this.entries = newEntries;
return this;
}
return new ArrayMapNode(ownerID, newEntries);
};
function BitmapIndexedNode(ownerID, bitmap, nodes) {
this.ownerID = ownerID;
this.bitmap = bitmap;
this.nodes = nodes;
}
BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) {
if (keyHash === undefined) {
keyHash = hash(key);
}
var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK));
var bitmap = this.bitmap;
return (bitmap & bit) === 0 ? notSetValue :
this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue);
};
BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
if (keyHash === undefined) {
keyHash = hash(key);
}
var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
var bit = 1 << keyHashFrag;
var bitmap = this.bitmap;
var exists = (bitmap & bit) !== 0;
if (!exists && value === NOT_SET) {
return this;
}
var idx = popCount(bitmap & (bit - 1));
var nodes = this.nodes;
var node = exists ? nodes[idx] : undefined;
var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);
if (newNode === node) {
return this;
}
if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {
return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);
}
if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {
return nodes[idx ^ 1];
}
if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {
return newNode;
}
var isEditable = ownerID && ownerID === this.ownerID;
var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;
var newNodes = exists ? newNode ?
setIn(nodes, idx, newNode, isEditable) :
spliceOut(nodes, idx, isEditable) :
spliceIn(nodes, idx, newNode, isEditable);
if (isEditable) {
this.bitmap = newBitmap;
this.nodes = newNodes;
return this;
}
return new BitmapIndexedNode(ownerID, newBitmap, newNodes);
};
function HashArrayMapNode(ownerID, count, nodes) {
this.ownerID = ownerID;
this.count = count;
this.nodes = nodes;
}
HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {
if (keyHash === undefined) {
keyHash = hash(key);
}
var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
var node = this.nodes[idx];
return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;
};
HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
if (keyHash === undefined) {
keyHash = hash(key);
}
var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
var removed = value === NOT_SET;
var nodes = this.nodes;
var node = nodes[idx];
if (removed && !node) {
return this;
}
var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);
if (newNode === node) {
return this;
}
var newCount = this.count;
if (!node) {
newCount++;
} else if (!newNode) {
newCount--;
if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {
return packNodes(ownerID, nodes, newCount, idx);
}
}
var isEditable = ownerID && ownerID === this.ownerID;
var newNodes = setIn(nodes, idx, newNode, isEditable);
if (isEditable) {
this.count = newCount;
this.nodes = newNodes;
return this;
}
return new HashArrayMapNode(ownerID, newCount, newNodes);
};
function HashCollisionNode(ownerID, keyHash, entries) {
this.ownerID = ownerID;
this.keyHash = keyHash;
this.entries = entries;
}
HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) {
var entries = this.entries;
for (var ii = 0, len = entries.length; ii < len; ii++) {
if (is(key, entries[ii][0])) {
return entries[ii][1];
}
}
return notSetValue;
};
HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
if (keyHash === undefined) {
keyHash = hash(key);
}
var removed = value === NOT_SET;
if (keyHash !== this.keyHash) {
if (removed) {
return this;
}
SetRef(didAlter);
SetRef(didChangeSize);
return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);
}
var entries = this.entries;
var idx = 0;
for (var len = entries.length; idx < len; idx++) {
if (is(key, entries[idx][0])) {
break;
}
}
var exists = idx < len;
if (exists ? entries[idx][1] === value : removed) {
return this;
}
SetRef(didAlter);
(removed || !exists) && SetRef(didChangeSize);
if (removed && len === 2) {
return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);
}
var isEditable = ownerID && ownerID === this.ownerID;
var newEntries = isEditable ? entries : arrCopy(entries);
if (exists) {
if (removed) {
idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());
} else {
newEntries[idx] = [key, value];
}
} else {
newEntries.push([key, value]);
}
if (isEditable) {
this.entries = newEntries;
return this;
}
return new HashCollisionNode(ownerID, this.keyHash, newEntries);
};
function ValueNode(ownerID, keyHash, entry) {
this.ownerID = ownerID;
this.keyHash = keyHash;
this.entry = entry;
}
ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) {
return is(key, this.entry[0]) ? this.entry[1] : notSetValue;
};
ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
var removed = value === NOT_SET;
var keyMatch = is(key, this.entry[0]);
if (keyMatch ? value === this.entry[1] : removed) {
return this;
}
SetRef(didAlter);
if (removed) {
SetRef(didChangeSize);
return; // undefined
}
if (keyMatch) {
if (ownerID && ownerID === this.ownerID) {
this.entry[1] = value;
return this;
}
return new ValueNode(ownerID, this.keyHash, [key, value]);
}
SetRef(didChangeSize);
return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);
};
// #pragma Iterators
ArrayMapNode.prototype.iterate =
HashCollisionNode.prototype.iterate = function (fn, reverse) {
var entries = this.entries;
for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
return false;
}
}
}
BitmapIndexedNode.prototype.iterate =
HashArrayMapNode.prototype.iterate = function (fn, reverse) {
var nodes = this.nodes;
for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
var node = nodes[reverse ? maxIndex - ii : ii];
if (node && node.iterate(fn, reverse) === false) {
return false;
}
}
}
ValueNode.prototype.iterate = function (fn, reverse) {
return fn(this.entry);
}
createClass(MapIterator, Iterator);
function MapIterator(map, type, reverse) {
this._type = type;
this._reverse = reverse;
this._stack = map._root && mapIteratorFrame(map._root);
}
MapIterator.prototype.next = function() {
var type = this._type;
var stack = this._stack;
while (stack) {
var node = stack.node;
var index = stack.index++;
var maxIndex;
if (node.entry) {
if (index === 0) {
return mapIteratorValue(type, node.entry);
}
} else if (node.entries) {
maxIndex = node.entries.length - 1;
if (index <= maxIndex) {
return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);
}
} else {
maxIndex = node.nodes.length - 1;
if (index <= maxIndex) {
var subNode = node.nodes[this._reverse ? maxIndex - index : index];
if (subNode) {
if (subNode.entry) {
return mapIteratorValue(type, subNode.entry);
}
stack = this._stack = mapIteratorFrame(subNode, stack);
}
continue;
}
}
stack = this._stack = this._stack.__prev;
}
return iteratorDone();
};
function mapIteratorValue(type, entry) {
return iteratorValue(type, entry[0], entry[1]);
}
function mapIteratorFrame(node, prev) {
return {
node: node,
index: 0,
__prev: prev
};
}
function makeMap(size, root, ownerID, hash) {
var map = Object.create(MapPrototype);
map.size = size;
map._root = root;
map.__ownerID = ownerID;
map.__hash = hash;
map.__altered = false;
return map;
}
var EMPTY_MAP;
function emptyMap() {
return EMPTY_MAP || (EMPTY_MAP = makeMap(0));
}
function updateMap(map, k, v) {
var newRoot;
var newSize;
if (!map._root) {
if (v === NOT_SET) {
return map;
}
newSize = 1;
newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);
} else {
var didChangeSize = MakeRef(CHANGE_LENGTH);
var didAlter = MakeRef(DID_ALTER);
newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);
if (!didAlter.value) {
return map;
}
newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);
}
if (map.__ownerID) {
map.size = newSize;
map._root = newRoot;
map.__hash = undefined;
map.__altered = true;
return map;
}
return newRoot ? makeMap(newSize, newRoot) : emptyMap();
}
function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
if (!node) {
if (value === NOT_SET) {
return node;
}
SetRef(didAlter);
SetRef(didChangeSize);
return new ValueNode(ownerID, keyHash, [key, value]);
}
return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);
}
function isLeafNode(node) {
return node.constructor === ValueNode || node.constructor === HashCollisionNode;
}
function mergeIntoNode(node, ownerID, shift, keyHash, entry) {
if (node.keyHash === keyHash) {
return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);
}
var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;
var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
var newNode;
var nodes = idx1 === idx2 ?
[mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] :
((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]);
return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);
}
function createNodes(ownerID, entries, key, value) {
if (!ownerID) {
ownerID = new OwnerID();
}
var node = new ValueNode(ownerID, hash(key), [key, value]);
for (var ii = 0; ii < entries.length; ii++) {
var entry = entries[ii];
node = node.update(ownerID, 0, undefined, entry[0], entry[1]);
}
return node;
}
function packNodes(ownerID, nodes, count, excluding) {
var bitmap = 0;
var packedII = 0;
var packedNodes = new Array(count);
for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {
var node = nodes[ii];
if (node !== undefined && ii !== excluding) {
bitmap |= bit;
packedNodes[packedII++] = node;
}
}
return new BitmapIndexedNode(ownerID, bitmap, packedNodes);
}
function expandNodes(ownerID, nodes, bitmap, including, node) {
var count = 0;
var expandedNodes = new Array(SIZE);
for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {
expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;
}
expandedNodes[including] = node;
return new HashArrayMapNode(ownerID, count + 1, expandedNodes);
}
function mergeIntoMapWith(map, merger, iterables) {
var iters = [];
for (var ii = 0; ii < iterables.length; ii++) {
var value = iterables[ii];
var iter = KeyedIterable(value);
if (!isIterable(value)) {
iter = iter.map(function(v ) {return fromJS(v)});
}
iters.push(iter);
}
return mergeIntoCollectionWith(map, merger, iters);
}
function deepMerger(existing, value, key) {
return existing && existing.mergeDeep && isIterable(value) ?
existing.mergeDeep(value) :
is(existing, value) ? existing : value;
}
function deepMergerWith(merger) {
return function(existing, value, key) {
if (existing && existing.mergeDeepWith && isIterable(value)) {
return existing.mergeDeepWith(merger, value);
}
var nextValue = merger(existing, value, key);
return is(existing, nextValue) ? existing : nextValue;
};
}
function mergeIntoCollectionWith(collection, merger, iters) {
iters = iters.filter(function(x ) {return x.size !== 0});
if (iters.length === 0) {
return collection;
}
if (collection.size === 0 && !collection.__ownerID && iters.length === 1) {
return collection.constructor(iters[0]);
}
return collection.withMutations(function(collection ) {
var mergeIntoMap = merger ?
function(value, key) {
collection.update(key, NOT_SET, function(existing )
{return existing === NOT_SET ? value : merger(existing, value, key)}
);
} :
function(value, key) {
collection.set(key, value);
}
for (var ii = 0; ii < iters.length; ii++) {
iters[ii].forEach(mergeIntoMap);
}
});
}
function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {
var isNotSet = existing === NOT_SET;
var step = keyPathIter.next();
if (step.done) {
var existingValue = isNotSet ? notSetValue : existing;
var newValue = updater(existingValue);
return newValue === existingValue ? existing : newValue;
}
invariant(
isNotSet || (existing && existing.set),
'invalid keyPath'
);
var key = step.value;
var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);
var nextUpdated = updateInDeepMap(
nextExisting,
keyPathIter,
notSetValue,
updater
);
return nextUpdated === nextExisting ? existing :
nextUpdated === NOT_SET ? existing.remove(key) :
(isNotSet ? emptyMap() : existing).set(key, nextUpdated);
}
function popCount(x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0f0f0f0f;
x = x + (x >> 8);
x = x + (x >> 16);
return x & 0x7f;
}
function setIn(array, idx, val, canEdit) {
var newArray = canEdit ? array : arrCopy(array);
newArray[idx] = val;
return newArray;
}
function spliceIn(array, idx, val, canEdit) {
var newLen = array.length + 1;
if (canEdit && idx + 1 === newLen) {
array[idx] = val;
return array;
}
var newArray = new Array(newLen);
var after = 0;
for (var ii = 0; ii < newLen; ii++) {
if (ii === idx) {
newArray[ii] = val;
after = -1;
} else {
newArray[ii] = array[ii + after];
}
}
return newArray;
}
function spliceOut(array, idx, canEdit) {
var newLen = array.length - 1;
if (canEdit && idx === newLen) {
array.pop();
return array;
}
var newArray = new Array(newLen);
var after = 0;
for (var ii = 0; ii < newLen; ii++) {
if (ii === idx) {
after = 1;
}
newArray[ii] = array[ii + after];
}
return newArray;
}
var MAX_ARRAY_MAP_SIZE = SIZE / 4;
var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;
var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;
createClass(List, IndexedCollection);
// @pragma Construction
function List(value) {
var empty = emptyList();
if (value === null || value === undefined) {
return empty;
}
if (isList(value)) {
return value;
}
var iter = IndexedIterable(value);
var size = iter.size;
if (size === 0) {
return empty;
}
assertNotInfinite(size);
if (size > 0 && size < SIZE) {
return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));
}
return empty.withMutations(function(list ) {
list.setSize(size);
iter.forEach(function(v, i) {return list.set(i, v)});
});
}
List.of = function(/*...values*/) {
return this(arguments);
};
List.prototype.toString = function() {
return this.__toString('List [', ']');
};
// @pragma Access
List.prototype.get = function(index, notSetValue) {
index = wrapIndex(this, index);
if (index >= 0 && index < this.size) {
index += this._origin;
var node = listNodeFor(this, index);
return node && node.array[index & MASK];
}
return notSetValue;
};
// @pragma Modification
List.prototype.set = function(index, value) {
return updateList(this, index, value);
};
List.prototype.remove = function(index) {
return !this.has(index) ? this :
index === 0 ? this.shift() :
index === this.size - 1 ? this.pop() :
this.splice(index, 1);
};
List.prototype.insert = function(index, value) {
return this.splice(index, 0, value);
};
List.prototype.clear = function() {
if (this.size === 0) {
return this;
}
if (this.__ownerID) {
this.size = this._origin = this._capacity = 0;
this._level = SHIFT;
this._root = this._tail = null;
this.__hash = undefined;
this.__altered = true;
return this;
}
return emptyList();
};
List.prototype.push = function(/*...values*/) {
var values = arguments;
var oldSize = this.size;
return this.withMutations(function(list ) {
setListBounds(list, 0, oldSize + values.length);
for (var ii = 0; ii < values.length; ii++) {
list.set(oldSize + ii, values[ii]);
}
});
};
List.prototype.pop = function() {
return setListBounds(this, 0, -1);
};
List.prototype.unshift = function(/*...values*/) {
var values = arguments;
return this.withMutations(function(list ) {
setListBounds(list, -values.length);
for (var ii = 0; ii < values.length; ii++) {
list.set(ii, values[ii]);
}
});
};
List.prototype.shift = function() {
return setListBounds(this, 1);
};
// @pragma Composition
List.prototype.merge = function(/*...iters*/) {
return mergeIntoListWith(this, undefined, arguments);
};
List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);
return mergeIntoListWith(this, merger, iters);
};
List.prototype.mergeDeep = function(/*...iters*/) {
return mergeIntoListWith(this, deepMerger, arguments);
};
List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);
return mergeIntoListWith(this, deepMergerWith(merger), iters);
};
List.prototype.setSize = function(size) {
return setListBounds(this, 0, size);
};
// @pragma Iteration
List.prototype.slice = function(begin, end) {
var size = this.size;
if (wholeSlice(begin, end, size)) {
return this;
}
return setListBounds(
this,
resolveBegin(begin, size),
resolveEnd(end, size)
);
};
List.prototype.__iterator = function(type, reverse) {
var index = 0;
var values = iterateList(this, reverse);
return new Iterator(function() {
var value = values();
return value === DONE ?
iteratorDone() :
iteratorValue(type, index++, value);
});
};
List.prototype.__iterate = function(fn, reverse) {
var index = 0;
var values = iterateList(this, reverse);
var value;
while ((value = values()) !== DONE) {
if (fn(value, index++, this) === false) {
break;
}
}
return index;
};
List.prototype.__ensureOwner = function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
if (!ownerID) {
this.__ownerID = ownerID;
return this;
}
return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);
};
function isList(maybeList) {
return !!(maybeList && maybeList[IS_LIST_SENTINEL]);
}
List.isList = isList;
var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
var ListPrototype = List.prototype;
ListPrototype[IS_LIST_SENTINEL] = true;
ListPrototype[DELETE] = ListPrototype.remove;
ListPrototype.setIn = MapPrototype.setIn;
ListPrototype.deleteIn =
ListPrototype.removeIn = MapPrototype.removeIn;
ListPrototype.update = MapPrototype.update;
ListPrototype.updateIn = MapPrototype.updateIn;
ListPrototype.mergeIn = MapPrototype.mergeIn;
ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;
ListPrototype.withMutations = MapPrototype.withMutations;
ListPrototype.asMutable = MapPrototype.asMutable;
ListPrototype.asImmutable = MapPrototype.asImmutable;
ListPrototype.wasAltered = MapPrototype.wasAltered;
function VNode(array, ownerID) {
this.array = array;
this.ownerID = ownerID;
}
// TODO: seems like these methods are very similar
VNode.prototype.removeBefore = function(ownerID, level, index) {
if (index === level ? 1 << level : 0 || this.array.length === 0) {
return this;
}
var originIndex = (index >>> level) & MASK;
if (originIndex >= this.array.length) {
return new VNode([], ownerID);
}
var removingFirst = originIndex === 0;
var newChild;
if (level > 0) {
var oldChild = this.array[originIndex];
newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);
if (newChild === oldChild && removingFirst) {
return this;
}
}
if (removingFirst && !newChild) {
return this;
}
var editable = editableVNode(this, ownerID);
if (!removingFirst) {
for (var ii = 0; ii < originIndex; ii++) {
editable.array[ii] = undefined;
}
}
if (newChild) {
editable.array[originIndex] = newChild;
}
return editable;
};
VNode.prototype.removeAfter = function(ownerID, level, index) {
if (index === (level ? 1 << level : 0) || this.array.length === 0) {
return this;
}
var sizeIndex = ((index - 1) >>> level) & MASK;
if (sizeIndex >= this.array.length) {
return this;
}
var newChild;
if (level > 0) {
var oldChild = this.array[sizeIndex];
newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);
if (newChild === oldChild && sizeIndex === this.array.length - 1) {
return this;
}
}
var editable = editableVNode(this, ownerID);
editable.array.splice(sizeIndex + 1);
if (newChild) {
editable.array[sizeIndex] = newChild;
}
return editable;
};
var DONE = {};
function iterateList(list, reverse) {
var left = list._origin;
var right = list._capacity;
var tailPos = getTailOffset(right);
var tail = list._tail;
return iterateNodeOrLeaf(list._root, list._level, 0);
function iterateNodeOrLeaf(node, level, offset) {
return level === 0 ?
iterateLeaf(node, offset) :
iterateNode(node, level, offset);
}
function iterateLeaf(node, offset) {
var array = offset === tailPos ? tail && tail.array : node && node.array;
var from = offset > left ? 0 : left - offset;
var to = right - offset;
if (to > SIZE) {
to = SIZE;
}
return function() {
if (from === to) {
return DONE;
}
var idx = reverse ? --to : from++;
return array && array[idx];
};
}
function iterateNode(node, level, offset) {
var values;
var array = node && node.array;
var from = offset > left ? 0 : (left - offset) >> level;
var to = ((right - offset) >> level) + 1;
if (to > SIZE) {
to = SIZE;
}
return function() {
do {
if (values) {
var value = values();
if (value !== DONE) {
return value;
}
values = null;
}
if (from === to) {
return DONE;
}
var idx = reverse ? --to : from++;
values = iterateNodeOrLeaf(
array && array[idx], level - SHIFT, offset + (idx << level)
);
} while (true);
};
}
}
function makeList(origin, capacity, level, root, tail, ownerID, hash) {
var list = Object.create(ListPrototype);
list.size = capacity - origin;
list._origin = origin;
list._capacity = capacity;
list._level = level;
list._root = root;
list._tail = tail;
list.__ownerID = ownerID;
list.__hash = hash;
list.__altered = false;
return list;
}
var EMPTY_LIST;
function emptyList() {
return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));
}
function updateList(list, index, value) {
index = wrapIndex(list, index);
if (index !== index) {
return list;
}
if (index >= list.size || index < 0) {
return list.withMutations(function(list ) {
index < 0 ?
setListBounds(list, index).set(0, value) :
setListBounds(list, 0, index + 1).set(index, value)
});
}
index += list._origin;
var newTail = list._tail;
var newRoot = list._root;
var didAlter = MakeRef(DID_ALTER);
if (index >= getTailOffset(list._capacity)) {
newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);
} else {
newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);
}
if (!didAlter.value) {
return list;
}
if (list.__ownerID) {
list._root = newRoot;
list._tail = newTail;
list.__hash = undefined;
list.__altered = true;
return list;
}
return makeList(list._origin, list._capacity, list._level, newRoot, newTail);
}
function updateVNode(node, ownerID, level, index, value, didAlter) {
var idx = (index >>> level) & MASK;
var nodeHas = node && idx < node.array.length;
if (!nodeHas && value === undefined) {
return node;
}
var newNode;
if (level > 0) {
var lowerNode = node && node.array[idx];
var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);
if (newLowerNode === lowerNode) {
return node;
}
newNode = editableVNode(node, ownerID);
newNode.array[idx] = newLowerNode;
return newNode;
}
if (nodeHas && node.array[idx] === value) {
return node;
}
SetRef(didAlter);
newNode = editableVNode(node, ownerID);
if (value === undefined && idx === newNode.array.length - 1) {
newNode.array.pop();
} else {
newNode.array[idx] = value;
}
return newNode;
}
function editableVNode(node, ownerID) {
if (ownerID && node && ownerID === node.ownerID) {
return node;
}
return new VNode(node ? node.array.slice() : [], ownerID);
}
function listNodeFor(list, rawIndex) {
if (rawIndex >= getTailOffset(list._capacity)) {
return list._tail;
}
if (rawIndex < 1 << (list._level + SHIFT)) {
var node = list._root;
var level = list._level;
while (node && level > 0) {
node = node.array[(rawIndex >>> level) & MASK];
level -= SHIFT;
}
return node;
}
}
function setListBounds(list, begin, end) {
// Sanitize begin & end using this shorthand for ToInt32(argument)
// http://www.ecma-international.org/ecma-262/6.0/#sec-toint32
if (begin !== undefined) {
begin = begin | 0;
}
if (end !== undefined) {
end = end | 0;
}
var owner = list.__ownerID || new OwnerID();
var oldOrigin = list._origin;
var oldCapacity = list._capacity;
var newOrigin = oldOrigin + begin;
var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;
if (newOrigin === oldOrigin && newCapacity === oldCapacity) {
return list;
}
// If it's going to end after it starts, it's empty.
if (newOrigin >= newCapacity) {
return list.clear();
}
var newLevel = list._level;
var newRoot = list._root;
// New origin might need creating a higher root.
var offsetShift = 0;
while (newOrigin + offsetShift < 0) {
newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);
newLevel += SHIFT;
offsetShift += 1 << newLevel;
}
if (offsetShift) {
newOrigin += offsetShift;
oldOrigin += offsetShift;
newCapacity += offsetShift;
oldCapacity += offsetShift;
}
var oldTailOffset = getTailOffset(oldCapacity);
var newTailOffset = getTailOffset(newCapacity);
// New size might need creating a higher root.
while (newTailOffset >= 1 << (newLevel + SHIFT)) {
newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);
newLevel += SHIFT;
}
// Locate or create the new tail.
var oldTail = list._tail;
var newTail = newTailOffset < oldTailOffset ?
listNodeFor(list, newCapacity - 1) :
newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail;
// Merge Tail into tree.
if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {
newRoot = editableVNode(newRoot, owner);
var node = newRoot;
for (var level = newLevel; level > SHIFT; level -= SHIFT) {
var idx = (oldTailOffset >>> level) & MASK;
node = node.array[idx] = editableVNode(node.array[idx], owner);
}
node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;
}
// If the size has been reduced, there's a chance the tail needs to be trimmed.
if (newCapacity < oldCapacity) {
newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);
}
// If the new origin is within the tail, then we do not need a root.
if (newOrigin >= newTailOffset) {
newOrigin -= newTailOffset;
newCapacity -= newTailOffset;
newLevel = SHIFT;
newRoot = null;
newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);
// Otherwise, if the root has been trimmed, garbage collect.
} else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {
offsetShift = 0;
// Identify the new top root node of the subtree of the old root.
while (newRoot) {
var beginIndex = (newOrigin >>> newLevel) & MASK;
if (beginIndex !== (newTailOffset >>> newLevel) & MASK) {
break;
}
if (beginIndex) {
offsetShift += (1 << newLevel) * beginIndex;
}
newLevel -= SHIFT;
newRoot = newRoot.array[beginIndex];
}
// Trim the new sides of the new root.
if (newRoot && newOrigin > oldOrigin) {
newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);
}
if (newRoot && newTailOffset < oldTailOffset) {
newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);
}
if (offsetShift) {
newOrigin -= offsetShift;
newCapacity -= offsetShift;
}
}
if (list.__ownerID) {
list.size = newCapacity - newOrigin;
list._origin = newOrigin;
list._capacity = newCapacity;
list._level = newLevel;
list._root = newRoot;
list._tail = newTail;
list.__hash = undefined;
list.__altered = true;
return list;
}
return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);
}
function mergeIntoListWith(list, merger, iterables) {
var iters = [];
var maxSize = 0;
for (var ii = 0; ii < iterables.length; ii++) {
var value = iterables[ii];
var iter = IndexedIterable(value);
if (iter.size > maxSize) {
maxSize = iter.size;
}
if (!isIterable(value)) {
iter = iter.map(function(v ) {return fromJS(v)});
}
iters.push(iter);
}
if (maxSize > list.size) {
list = list.setSize(maxSize);
}
return mergeIntoCollectionWith(list, merger, iters);
}
function getTailOffset(size) {
return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT);
}
createClass(OrderedMap, Map);
// @pragma Construction
function OrderedMap(value) {
return value === null || value === undefined ? emptyOrderedMap() :
isOrderedMap(value) ? value :
emptyOrderedMap().withMutations(function(map ) {
var iter = KeyedIterable(value);
assertNotInfinite(iter.size);
iter.forEach(function(v, k) {return map.set(k, v)});
});
}
OrderedMap.of = function(/*...values*/) {
return this(arguments);
};
OrderedMap.prototype.toString = function() {
return this.__toString('OrderedMap {', '}');
};
// @pragma Access
OrderedMap.prototype.get = function(k, notSetValue) {
var index = this._map.get(k);
return index !== undefined ? this._list.get(index)[1] : notSetValue;
};
// @pragma Modification
OrderedMap.prototype.clear = function() {
if (this.size === 0) {
return this;
}
if (this.__ownerID) {
this.size = 0;
this._map.clear();
this._list.clear();
return this;
}
return emptyOrderedMap();
};
OrderedMap.prototype.set = function(k, v) {
return updateOrderedMap(this, k, v);
};
OrderedMap.prototype.remove = function(k) {
return updateOrderedMap(this, k, NOT_SET);
};
OrderedMap.prototype.wasAltered = function() {
return this._map.wasAltered() || this._list.wasAltered();
};
OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this;
return this._list.__iterate(
function(entry ) {return entry && fn(entry[1], entry[0], this$0)},
reverse
);
};
OrderedMap.prototype.__iterator = function(type, reverse) {
return this._list.fromEntrySeq().__iterator(type, reverse);
};
OrderedMap.prototype.__ensureOwner = function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
var newMap = this._map.__ensureOwner(ownerID);
var newList = this._list.__ensureOwner(ownerID);
if (!ownerID) {
this.__ownerID = ownerID;
this._map = newMap;
this._list = newList;
return this;
}
return makeOrderedMap(newMap, newList, ownerID, this.__hash);
};
function isOrderedMap(maybeOrderedMap) {
return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
}
OrderedMap.isOrderedMap = isOrderedMap;
OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;
OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;
function makeOrderedMap(map, list, ownerID, hash) {
var omap = Object.create(OrderedMap.prototype);
omap.size = map ? map.size : 0;
omap._map = map;
omap._list = list;
omap.__ownerID = ownerID;
omap.__hash = hash;
return omap;
}
var EMPTY_ORDERED_MAP;
function emptyOrderedMap() {
return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));
}
function updateOrderedMap(omap, k, v) {
var map = omap._map;
var list = omap._list;
var i = map.get(k);
var has = i !== undefined;
var newMap;
var newList;
if (v === NOT_SET) { // removed
if (!has) {
return omap;
}
if (list.size >= SIZE && list.size >= map.size * 2) {
newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx});
newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap();
if (omap.__ownerID) {
newMap.__ownerID = newList.__ownerID = omap.__ownerID;
}
} else {
newMap = map.remove(k);
newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);
}
} else {
if (has) {
if (v === list.get(i)[1]) {
return omap;
}
newMap = map;
newList = list.set(i, [k, v]);
} else {
newMap = map.set(k, list.size);
newList = list.set(list.size, [k, v]);
}
}
if (omap.__ownerID) {
omap.size = newMap.size;
omap._map = newMap;
omap._list = newList;
omap.__hash = undefined;
return omap;
}
return makeOrderedMap(newMap, newList);
}
createClass(ToKeyedSequence, KeyedSeq);
function ToKeyedSequence(indexed, useKeys) {
this._iter = indexed;
this._useKeys = useKeys;
this.size = indexed.size;
}
ToKeyedSequence.prototype.get = function(key, notSetValue) {
return this._iter.get(key, notSetValue);
};
ToKeyedSequence.prototype.has = function(key) {
return this._iter.has(key);
};
ToKeyedSequence.prototype.valueSeq = function() {
return this._iter.valueSeq();
};
ToKeyedSequence.prototype.reverse = function() {var this$0 = this;
var reversedSequence = reverseFactory(this, true);
if (!this._useKeys) {
reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()};
}
return reversedSequence;
};
ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this;
var mappedSequence = mapFactory(this, mapper, context);
if (!this._useKeys) {
mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)};
}
return mappedSequence;
};
ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;
var ii;
return this._iter.__iterate(
this._useKeys ?
function(v, k) {return fn(v, k, this$0)} :
((ii = reverse ? resolveSize(this) : 0),
function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),
reverse
);
};
ToKeyedSequence.prototype.__iterator = function(type, reverse) {
if (this._useKeys) {
return this._iter.__iterator(type, reverse);
}
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
var ii = reverse ? resolveSize(this) : 0;
return new Iterator(function() {
var step = iterator.next();
return step.done ? step :
iteratorValue(type, reverse ? --ii : ii++, step.value, step);
});
};
ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;
createClass(ToIndexedSequence, IndexedSeq);
function ToIndexedSequence(iter) {
this._iter = iter;
this.size = iter.size;
}
ToIndexedSequence.prototype.includes = function(value) {
return this._iter.includes(value);
};
ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;
var iterations = 0;
return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse);
};
ToIndexedSequence.prototype.__iterator = function(type, reverse) {
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
var iterations = 0;
return new Iterator(function() {
var step = iterator.next();
return step.done ? step :
iteratorValue(type, iterations++, step.value, step)
});
};
createClass(ToSetSequence, SetSeq);
function ToSetSequence(iter) {
this._iter = iter;
this.size = iter.size;
}
ToSetSequence.prototype.has = function(key) {
return this._iter.includes(key);
};
ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;
return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse);
};
ToSetSequence.prototype.__iterator = function(type, reverse) {
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
return new Iterator(function() {
var step = iterator.next();
return step.done ? step :
iteratorValue(type, step.value, step.value, step);
});
};
createClass(FromEntriesSequence, KeyedSeq);
function FromEntriesSequence(entries) {
this._iter = entries;
this.size = entries.size;
}
FromEntriesSequence.prototype.entrySeq = function() {
return this._iter.toSeq();
};
FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;
return this._iter.__iterate(function(entry ) {
// Check if entry exists first so array access doesn't throw for holes
// in the parent iteration.
if (entry) {
validateEntry(entry);
var indexedIterable = isIterable(entry);
return fn(
indexedIterable ? entry.get(1) : entry[1],
indexedIterable ? entry.get(0) : entry[0],
this$0
);
}
}, reverse);
};
FromEntriesSequence.prototype.__iterator = function(type, reverse) {
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
return new Iterator(function() {
while (true) {
var step = iterator.next();
if (step.done) {
return step;
}
var entry = step.value;
// Check if entry exists first so array access doesn't throw for holes
// in the parent iteration.
if (entry) {
validateEntry(entry);
var indexedIterable = isIterable(entry);
return iteratorValue(
type,
indexedIterable ? entry.get(0) : entry[0],
indexedIterable ? entry.get(1) : entry[1],
step
);
}
}
});
};
ToIndexedSequence.prototype.cacheResult =
ToKeyedSequence.prototype.cacheResult =
ToSetSequence.prototype.cacheResult =
FromEntriesSequence.prototype.cacheResult =
cacheResultThrough;
function flipFactory(iterable) {
var flipSequence = makeSequence(iterable);
flipSequence._iter = iterable;
flipSequence.size = iterable.size;
flipSequence.flip = function() {return iterable};
flipSequence.reverse = function () {
var reversedSequence = iterable.reverse.apply(this); // super.reverse()
reversedSequence.flip = function() {return iterable.reverse()};
return reversedSequence;
};
flipSequence.has = function(key ) {return iterable.includes(key)};
flipSequence.includes = function(key ) {return iterable.has(key)};
flipSequence.cacheResult = cacheResultThrough;
flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;
return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse);
}
flipSequence.__iteratorUncached = function(type, reverse) {
if (type === ITERATE_ENTRIES) {
var iterator = iterable.__iterator(type, reverse);
return new Iterator(function() {
var step = iterator.next();
if (!step.done) {
var k = step.value[0];
step.value[0] = step.value[1];
step.value[1] = k;
}
return step;
});
}
return iterable.__iterator(
type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,
reverse
);
}
return flipSequence;
}
function mapFactory(iterable, mapper, context) {
var mappedSequence = makeSequence(iterable);
mappedSequence.size = iterable.size;
mappedSequence.has = function(key ) {return iterable.has(key)};
mappedSequence.get = function(key, notSetValue) {
var v = iterable.get(key, NOT_SET);
return v === NOT_SET ?
notSetValue :
mapper.call(context, v, key, iterable);
};
mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;
return iterable.__iterate(
function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false},
reverse
);
}
mappedSequence.__iteratorUncached = function (type, reverse) {
var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);
return new Iterator(function() {
var step = iterator.next();
if (step.done) {
return step;
}
var entry = step.value;
var key = entry[0];
return iteratorValue(
type,
key,
mapper.call(context, entry[1], key, iterable),
step
);
});
}
return mappedSequence;
}
function reverseFactory(iterable, useKeys) {
var reversedSequence = makeSequence(iterable);
reversedSequence._iter = iterable;
reversedSequence.size = iterable.size;
reversedSequence.reverse = function() {return iterable};
if (iterable.flip) {
reversedSequence.flip = function () {
var flipSequence = flipFactory(iterable);
flipSequence.reverse = function() {return iterable.flip()};
return flipSequence;
};
}
reversedSequence.get = function(key, notSetValue)
{return iterable.get(useKeys ? key : -1 - key, notSetValue)};
reversedSequence.has = function(key )
{return iterable.has(useKeys ? key : -1 - key)};
reversedSequence.includes = function(value ) {return iterable.includes(value)};
reversedSequence.cacheResult = cacheResultThrough;
reversedSequence.__iterate = function (fn, reverse) {var this$0 = this;
return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse);
};
reversedSequence.__iterator =
function(type, reverse) {return iterable.__iterator(type, !reverse)};
return reversedSequence;
}
function filterFactory(iterable, predicate, context, useKeys) {
var filterSequence = makeSequence(iterable);
if (useKeys) {
filterSequence.has = function(key ) {
var v = iterable.get(key, NOT_SET);
return v !== NOT_SET && !!predicate.call(context, v, key, iterable);
};
filterSequence.get = function(key, notSetValue) {
var v = iterable.get(key, NOT_SET);
return v !== NOT_SET && predicate.call(context, v, key, iterable) ?
v : notSetValue;
};
}
filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;
var iterations = 0;
iterable.__iterate(function(v, k, c) {
if (predicate.call(context, v, k, c)) {
iterations++;
return fn(v, useKeys ? k : iterations - 1, this$0);
}
}, reverse);
return iterations;
};
filterSequence.__iteratorUncached = function (type, reverse) {
var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);
var iterations = 0;
return new Iterator(function() {
while (true) {
var step = iterator.next();
if (step.done) {
return step;
}
var entry = step.value;
var key = entry[0];
var value = entry[1];
if (predicate.call(context, value, key, iterable)) {
return iteratorValue(type, useKeys ? key : iterations++, value, step);
}
}
});
}
return filterSequence;
}
function countByFactory(iterable, grouper, context) {
var groups = Map().asMutable();
iterable.__iterate(function(v, k) {
groups.update(
grouper.call(context, v, k, iterable),
0,
function(a ) {return a + 1}
);
});
return groups.asImmutable();
}
function groupByFactory(iterable, grouper, context) {
var isKeyedIter = isKeyed(iterable);
var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable();
iterable.__iterate(function(v, k) {
groups.update(
grouper.call(context, v, k, iterable),
function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)}
);
});
var coerce = iterableClass(iterable);
return groups.map(function(arr ) {return reify(iterable, coerce(arr))});
}
function sliceFactory(iterable, begin, end, useKeys) {
var originalSize = iterable.size;
// Sanitize begin & end using this shorthand for ToInt32(argument)
// http://www.ecma-international.org/ecma-262/6.0/#sec-toint32
if (begin !== undefined) {
begin = begin | 0;
}
if (end !== undefined) {
end = end | 0;
}
if (wholeSlice(begin, end, originalSize)) {
return iterable;
}
var resolvedBegin = resolveBegin(begin, originalSize);
var resolvedEnd = resolveEnd(end, originalSize);
// begin or end will be NaN if they were provided as negative numbers and
// this iterable's size is unknown. In that case, cache first so there is
// a known size and these do not resolve to NaN.
if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {
return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys);
}
// Note: resolvedEnd is undefined when the original sequence's length is
// unknown and this slice did not supply an end and should contain all
// elements after resolvedBegin.
// In that case, resolvedSize will be NaN and sliceSize will remain undefined.
var resolvedSize = resolvedEnd - resolvedBegin;
var sliceSize;
if (resolvedSize === resolvedSize) {
sliceSize = resolvedSize < 0 ? 0 : resolvedSize;
}
var sliceSeq = makeSequence(iterable);
// If iterable.size is undefined, the size of the realized sliceSeq is
// unknown at this point unless the number of items to slice is 0
sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined;
if (!useKeys && isSeq(iterable) && sliceSize >= 0) {
sliceSeq.get = function (index, notSetValue) {
index = wrapIndex(this, index);
return index >= 0 && index < sliceSize ?
iterable.get(index + resolvedBegin, notSetValue) :
notSetValue;
}
}
sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this;
if (sliceSize === 0) {
return 0;
}
if (reverse) {
return this.cacheResult().__iterate(fn, reverse);
}
var skipped = 0;
var isSkipping = true;
var iterations = 0;
iterable.__iterate(function(v, k) {
if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {
iterations++;
return fn(v, useKeys ? k : iterations - 1, this$0) !== false &&
iterations !== sliceSize;
}
});
return iterations;
};
sliceSeq.__iteratorUncached = function(type, reverse) {
if (sliceSize !== 0 && reverse) {
return this.cacheResult().__iterator(type, reverse);
}
// Don't bother instantiating parent iterator if taking 0.
var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse);
var skipped = 0;
var iterations = 0;
return new Iterator(function() {
while (skipped++ < resolvedBegin) {
iterator.next();
}
if (++iterations > sliceSize) {
return iteratorDone();
}
var step = iterator.next();
if (useKeys || type === ITERATE_VALUES) {
return step;
} else if (type === ITERATE_KEYS) {
return iteratorValue(type, iterations - 1, undefined, step);
} else {
return iteratorValue(type, iterations - 1, step.value[1], step);
}
});
}
return sliceSeq;
}
function takeWhileFactory(iterable, predicate, context) {
var takeSequence = makeSequence(iterable);
takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;
if (reverse) {
return this.cacheResult().__iterate(fn, reverse);
}
var iterations = 0;
iterable.__iterate(function(v, k, c)
{return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)}
);
return iterations;
};
takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;
if (reverse) {
return this.cacheResult().__iterator(type, reverse);
}
var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);
var iterating = true;
return new Iterator(function() {
if (!iterating) {
return iteratorDone();
}
var step = iterator.next();
if (step.done) {
return step;
}
var entry = step.value;
var k = entry[0];
var v = entry[1];
if (!predicate.call(context, v, k, this$0)) {
iterating = false;
return iteratorDone();
}
return type === ITERATE_ENTRIES ? step :
iteratorValue(type, k, v, step);
});
};
return takeSequence;
}
function skipWhileFactory(iterable, predicate, context, useKeys) {
var skipSequence = makeSequence(iterable);
skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;
if (reverse) {
return this.cacheResult().__iterate(fn, reverse);
}
var isSkipping = true;
var iterations = 0;
iterable.__iterate(function(v, k, c) {
if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {
iterations++;
return fn(v, useKeys ? k : iterations - 1, this$0);
}
});
return iterations;
};
skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;
if (reverse) {
return this.cacheResult().__iterator(type, reverse);
}
var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);
var skipping = true;
var iterations = 0;
return new Iterator(function() {
var step, k, v;
do {
step = iterator.next();
if (step.done) {
if (useKeys || type === ITERATE_VALUES) {
return step;
} else if (type === ITERATE_KEYS) {
return iteratorValue(type, iterations++, undefined, step);
} else {
return iteratorValue(type, iterations++, step.value[1], step);
}
}
var entry = step.value;
k = entry[0];
v = entry[1];
skipping && (skipping = predicate.call(context, v, k, this$0));
} while (skipping);
return type === ITERATE_ENTRIES ? step :
iteratorValue(type, k, v, step);
});
};
return skipSequence;
}
function concatFactory(iterable, values) {
var isKeyedIterable = isKeyed(iterable);
var iters = [iterable].concat(values).map(function(v ) {
if (!isIterable(v)) {
v = isKeyedIterable ?
keyedSeqFromValue(v) :
indexedSeqFromValue(Array.isArray(v) ? v : [v]);
} else if (isKeyedIterable) {
v = KeyedIterable(v);
}
return v;
}).filter(function(v ) {return v.size !== 0});
if (iters.length === 0) {
return iterable;
}
if (iters.length === 1) {
var singleton = iters[0];
if (singleton === iterable ||
isKeyedIterable && isKeyed(singleton) ||
isIndexed(iterable) && isIndexed(singleton)) {
return singleton;
}
}
var concatSeq = new ArraySeq(iters);
if (isKeyedIterable) {
concatSeq = concatSeq.toKeyedSeq();
} else if (!isIndexed(iterable)) {
concatSeq = concatSeq.toSetSeq();
}
concatSeq = concatSeq.flatten(true);
concatSeq.size = iters.reduce(
function(sum, seq) {
if (sum !== undefined) {
var size = seq.size;
if (size !== undefined) {
return sum + size;
}
}
},
0
);
return concatSeq;
}
function flattenFactory(iterable, depth, useKeys) {
var flatSequence = makeSequence(iterable);
flatSequence.__iterateUncached = function(fn, reverse) {
var iterations = 0;
var stopped = false;
function flatDeep(iter, currentDepth) {var this$0 = this;
iter.__iterate(function(v, k) {
if ((!depth || currentDepth < depth) && isIterable(v)) {
flatDeep(v, currentDepth + 1);
} else if (fn(v, useKeys ? k : iterations++, this$0) === false) {
stopped = true;
}
return !stopped;
}, reverse);
}
flatDeep(iterable, 0);
return iterations;
}
flatSequence.__iteratorUncached = function(type, reverse) {
var iterator = iterable.__iterator(type, reverse);
var stack = [];
var iterations = 0;
return new Iterator(function() {
while (iterator) {
var step = iterator.next();
if (step.done !== false) {
iterator = stack.pop();
continue;
}
var v = step.value;
if (type === ITERATE_ENTRIES) {
v = v[1];
}
if ((!depth || stack.length < depth) && isIterable(v)) {
stack.push(iterator);
iterator = v.__iterator(type, reverse);
} else {
return useKeys ? step : iteratorValue(type, iterations++, v, step);
}
}
return iteratorDone();
});
}
return flatSequence;
}
function flatMapFactory(iterable, mapper, context) {
var coerce = iterableClass(iterable);
return iterable.toSeq().map(
function(v, k) {return coerce(mapper.call(context, v, k, iterable))}
).flatten(true);
}
function interposeFactory(iterable, separator) {
var interposedSequence = makeSequence(iterable);
interposedSequence.size = iterable.size && iterable.size * 2 -1;
interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;
var iterations = 0;
iterable.__iterate(function(v, k)
{return (!iterations || fn(separator, iterations++, this$0) !== false) &&
fn(v, iterations++, this$0) !== false},
reverse
);
return iterations;
};
interposedSequence.__iteratorUncached = function(type, reverse) {
var iterator = iterable.__iterator(ITERATE_VALUES, reverse);
var iterations = 0;
var step;
return new Iterator(function() {
if (!step || iterations % 2) {
step = iterator.next();
if (step.done) {
return step;
}
}
return iterations % 2 ?
iteratorValue(type, iterations++, separator) :
iteratorValue(type, iterations++, step.value, step);
});
};
return interposedSequence;
}
function sortFactory(iterable, comparator, mapper) {
if (!comparator) {
comparator = defaultComparator;
}
var isKeyedIterable = isKeyed(iterable);
var index = 0;
var entries = iterable.toSeq().map(
function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]}
).toArray();
entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach(
isKeyedIterable ?
function(v, i) { entries[i].length = 2; } :
function(v, i) { entries[i] = v[1]; }
);
return isKeyedIterable ? KeyedSeq(entries) :
isIndexed(iterable) ? IndexedSeq(entries) :
SetSeq(entries);
}
function maxFactory(iterable, comparator, mapper) {
if (!comparator) {
comparator = defaultComparator;
}
if (mapper) {
var entry = iterable.toSeq()
.map(function(v, k) {return [v, mapper(v, k, iterable)]})
.reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a});
return entry && entry[0];
} else {
return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a});
}
}
function maxCompare(comparator, a, b) {
var comp = comparator(b, a);
// b is considered the new max if the comparator declares them equal, but
// they are not equal and b is in fact a nullish value.
return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0;
}
function zipWithFactory(keyIter, zipper, iters) {
var zipSequence = makeSequence(keyIter);
zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min();
// Note: this a generic base implementation of __iterate in terms of
// __iterator which may be more generically useful in the future.
zipSequence.__iterate = function(fn, reverse) {
/* generic:
var iterator = this.__iterator(ITERATE_ENTRIES, reverse);
var step;
var iterations = 0;
while (!(step = iterator.next()).done) {
iterations++;
if (fn(step.value[1], step.value[0], this) === false) {
break;
}
}
return iterations;
*/
// indexed:
var iterator = this.__iterator(ITERATE_VALUES, reverse);
var step;
var iterations = 0;
while (!(step = iterator.next()).done) {
if (fn(step.value, iterations++, this) === false) {
break;
}
}
return iterations;
};
zipSequence.__iteratorUncached = function(type, reverse) {
var iterators = iters.map(function(i )
{return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))}
);
var iterations = 0;
var isDone = false;
return new Iterator(function() {
var steps;
if (!isDone) {
steps = iterators.map(function(i ) {return i.next()});
isDone = steps.some(function(s ) {return s.done});
}
if (isDone) {
return iteratorDone();
}
return iteratorValue(
type,
iterations++,
zipper.apply(null, steps.map(function(s ) {return s.value}))
);
});
};
return zipSequence
}
// #pragma Helper Functions
function reify(iter, seq) {
return isSeq(iter) ? seq : iter.constructor(seq);
}
function validateEntry(entry) {
if (entry !== Object(entry)) {
throw new TypeError('Expected [K, V] tuple: ' + entry);
}
}
function resolveSize(iter) {
assertNotInfinite(iter.size);
return ensureSize(iter);
}
function iterableClass(iterable) {
return isKeyed(iterable) ? KeyedIterable :
isIndexed(iterable) ? IndexedIterable :
SetIterable;
}
function makeSequence(iterable) {
return Object.create(
(
isKeyed(iterable) ? KeyedSeq :
isIndexed(iterable) ? IndexedSeq :
SetSeq
).prototype
);
}
function cacheResultThrough() {
if (this._iter.cacheResult) {
this._iter.cacheResult();
this.size = this._iter.size;
return this;
} else {
return Seq.prototype.cacheResult.call(this);
}
}
function defaultComparator(a, b) {
return a > b ? 1 : a < b ? -1 : 0;
}
function forceIterator(keyPath) {
var iter = getIterator(keyPath);
if (!iter) {
// Array might not be iterable in this environment, so we need a fallback
// to our wrapped type.
if (!isArrayLike(keyPath)) {
throw new TypeError('Expected iterable or array-like: ' + keyPath);
}
iter = getIterator(Iterable(keyPath));
}
return iter;
}
createClass(Record, KeyedCollection);
function Record(defaultValues, name) {
var hasInitialized;
var RecordType = function Record(values) {
if (values instanceof RecordType) {
return values;
}
if (!(this instanceof RecordType)) {
return new RecordType(values);
}
if (!hasInitialized) {
hasInitialized = true;
var keys = Object.keys(defaultValues);
setProps(RecordTypePrototype, keys);
RecordTypePrototype.size = keys.length;
RecordTypePrototype._name = name;
RecordTypePrototype._keys = keys;
RecordTypePrototype._defaultValues = defaultValues;
}
this._map = Map(values);
};
var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);
RecordTypePrototype.constructor = RecordType;
return RecordType;
}
Record.prototype.toString = function() {
return this.__toString(recordName(this) + ' {', '}');
};
// @pragma Access
Record.prototype.has = function(k) {
return this._defaultValues.hasOwnProperty(k);
};
Record.prototype.get = function(k, notSetValue) {
if (!this.has(k)) {
return notSetValue;
}
var defaultVal = this._defaultValues[k];
return this._map ? this._map.get(k, defaultVal) : defaultVal;
};
// @pragma Modification
Record.prototype.clear = function() {
if (this.__ownerID) {
this._map && this._map.clear();
return this;
}
var RecordType = this.constructor;
return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap()));
};
Record.prototype.set = function(k, v) {
if (!this.has(k)) {
throw new Error('Cannot set unknown key "' + k + '" on ' + recordName(this));
}
var newMap = this._map && this._map.set(k, v);
if (this.__ownerID || newMap === this._map) {
return this;
}
return makeRecord(this, newMap);
};
Record.prototype.remove = function(k) {
if (!this.has(k)) {
return this;
}
var newMap = this._map && this._map.remove(k);
if (this.__ownerID || newMap === this._map) {
return this;
}
return makeRecord(this, newMap);
};
Record.prototype.wasAltered = function() {
return this._map.wasAltered();
};
Record.prototype.__iterator = function(type, reverse) {var this$0 = this;
return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse);
};
Record.prototype.__iterate = function(fn, reverse) {var this$0 = this;
return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse);
};
Record.prototype.__ensureOwner = function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
var newMap = this._map && this._map.__ensureOwner(ownerID);
if (!ownerID) {
this.__ownerID = ownerID;
this._map = newMap;
return this;
}
return makeRecord(this, newMap, ownerID);
};
var RecordPrototype = Record.prototype;
RecordPrototype[DELETE] = RecordPrototype.remove;
RecordPrototype.deleteIn =
RecordPrototype.removeIn = MapPrototype.removeIn;
RecordPrototype.merge = MapPrototype.merge;
RecordPrototype.mergeWith = MapPrototype.mergeWith;
RecordPrototype.mergeIn = MapPrototype.mergeIn;
RecordPrototype.mergeDeep = MapPrototype.mergeDeep;
RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;
RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;
RecordPrototype.setIn = MapPrototype.setIn;
RecordPrototype.update = MapPrototype.update;
RecordPrototype.updateIn = MapPrototype.updateIn;
RecordPrototype.withMutations = MapPrototype.withMutations;
RecordPrototype.asMutable = MapPrototype.asMutable;
RecordPrototype.asImmutable = MapPrototype.asImmutable;
function makeRecord(likeRecord, map, ownerID) {
var record = Object.create(Object.getPrototypeOf(likeRecord));
record._map = map;
record.__ownerID = ownerID;
return record;
}
function recordName(record) {
return record._name || record.constructor.name || 'Record';
}
function setProps(prototype, names) {
try {
names.forEach(setProp.bind(undefined, prototype));
} catch (error) {
// Object.defineProperty failed. Probably IE8.
}
}
function setProp(prototype, name) {
Object.defineProperty(prototype, name, {
get: function() {
return this.get(name);
},
set: function(value) {
invariant(this.__ownerID, 'Cannot set on an immutable record.');
this.set(name, value);
}
});
}
createClass(Set, SetCollection);
// @pragma Construction
function Set(value) {
return value === null || value === undefined ? emptySet() :
isSet(value) && !isOrdered(value) ? value :
emptySet().withMutations(function(set ) {
var iter = SetIterable(value);
assertNotInfinite(iter.size);
iter.forEach(function(v ) {return set.add(v)});
});
}
Set.of = function(/*...values*/) {
return this(arguments);
};
Set.fromKeys = function(value) {
return this(KeyedIterable(value).keySeq());
};
Set.prototype.toString = function() {
return this.__toString('Set {', '}');
};
// @pragma Access
Set.prototype.has = function(value) {
return this._map.has(value);
};
// @pragma Modification
Set.prototype.add = function(value) {
return updateSet(this, this._map.set(value, true));
};
Set.prototype.remove = function(value) {
return updateSet(this, this._map.remove(value));
};
Set.prototype.clear = function() {
return updateSet(this, this._map.clear());
};
// @pragma Composition
Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0);
iters = iters.filter(function(x ) {return x.size !== 0});
if (iters.length === 0) {
return this;
}
if (this.size === 0 && !this.__ownerID && iters.length === 1) {
return this.constructor(iters[0]);
}
return this.withMutations(function(set ) {
for (var ii = 0; ii < iters.length; ii++) {
SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)});
}
});
};
Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0);
if (iters.length === 0) {
return this;
}
iters = iters.map(function(iter ) {return SetIterable(iter)});
var originalSet = this;
return this.withMutations(function(set ) {
originalSet.forEach(function(value ) {
if (!iters.every(function(iter ) {return iter.includes(value)})) {
set.remove(value);
}
});
});
};
Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0);
if (iters.length === 0) {
return this;
}
iters = iters.map(function(iter ) {return SetIterable(iter)});
var originalSet = this;
return this.withMutations(function(set ) {
originalSet.forEach(function(value ) {
if (iters.some(function(iter ) {return iter.includes(value)})) {
set.remove(value);
}
});
});
};
Set.prototype.merge = function() {
return this.union.apply(this, arguments);
};
Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);
return this.union.apply(this, iters);
};
Set.prototype.sort = function(comparator) {
// Late binding
return OrderedSet(sortFactory(this, comparator));
};
Set.prototype.sortBy = function(mapper, comparator) {
// Late binding
return OrderedSet(sortFactory(this, comparator, mapper));
};
Set.prototype.wasAltered = function() {
return this._map.wasAltered();
};
Set.prototype.__iterate = function(fn, reverse) {var this$0 = this;
return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse);
};
Set.prototype.__iterator = function(type, reverse) {
return this._map.map(function(_, k) {return k}).__iterator(type, reverse);
};
Set.prototype.__ensureOwner = function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
var newMap = this._map.__ensureOwner(ownerID);
if (!ownerID) {
this.__ownerID = ownerID;
this._map = newMap;
return this;
}
return this.__make(newMap, ownerID);
};
function isSet(maybeSet) {
return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);
}
Set.isSet = isSet;
var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
var SetPrototype = Set.prototype;
SetPrototype[IS_SET_SENTINEL] = true;
SetPrototype[DELETE] = SetPrototype.remove;
SetPrototype.mergeDeep = SetPrototype.merge;
SetPrototype.mergeDeepWith = SetPrototype.mergeWith;
SetPrototype.withMutations = MapPrototype.withMutations;
SetPrototype.asMutable = MapPrototype.asMutable;
SetPrototype.asImmutable = MapPrototype.asImmutable;
SetPrototype.__empty = emptySet;
SetPrototype.__make = makeSet;
function updateSet(set, newMap) {
if (set.__ownerID) {
set.size = newMap.size;
set._map = newMap;
return set;
}
return newMap === set._map ? set :
newMap.size === 0 ? set.__empty() :
set.__make(newMap);
}
function makeSet(map, ownerID) {
var set = Object.create(SetPrototype);
set.size = map ? map.size : 0;
set._map = map;
set.__ownerID = ownerID;
return set;
}
var EMPTY_SET;
function emptySet() {
return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));
}
createClass(OrderedSet, Set);
// @pragma Construction
function OrderedSet(value) {
return value === null || value === undefined ? emptyOrderedSet() :
isOrderedSet(value) ? value :
emptyOrderedSet().withMutations(function(set ) {
var iter = SetIterable(value);
assertNotInfinite(iter.size);
iter.forEach(function(v ) {return set.add(v)});
});
}
OrderedSet.of = function(/*...values*/) {
return this(arguments);
};
OrderedSet.fromKeys = function(value) {
return this(KeyedIterable(value).keySeq());
};
OrderedSet.prototype.toString = function() {
return this.__toString('OrderedSet {', '}');
};
function isOrderedSet(maybeOrderedSet) {
return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
}
OrderedSet.isOrderedSet = isOrderedSet;
var OrderedSetPrototype = OrderedSet.prototype;
OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;
OrderedSetPrototype.__empty = emptyOrderedSet;
OrderedSetPrototype.__make = makeOrderedSet;
function makeOrderedSet(map, ownerID) {
var set = Object.create(OrderedSetPrototype);
set.size = map ? map.size : 0;
set._map = map;
set.__ownerID = ownerID;
return set;
}
var EMPTY_ORDERED_SET;
function emptyOrderedSet() {
return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));
}
createClass(Stack, IndexedCollection);
// @pragma Construction
function Stack(value) {
return value === null || value === undefined ? emptyStack() :
isStack(value) ? value :
emptyStack().unshiftAll(value);
}
Stack.of = function(/*...values*/) {
return this(arguments);
};
Stack.prototype.toString = function() {
return this.__toString('Stack [', ']');
};
// @pragma Access
Stack.prototype.get = function(index, notSetValue) {
var head = this._head;
index = wrapIndex(this, index);
while (head && index--) {
head = head.next;
}
return head ? head.value : notSetValue;
};
Stack.prototype.peek = function() {
return this._head && this._head.value;
};
// @pragma Modification
Stack.prototype.push = function(/*...values*/) {
if (arguments.length === 0) {
return this;
}
var newSize = this.size + arguments.length;
var head = this._head;
for (var ii = arguments.length - 1; ii >= 0; ii--) {
head = {
value: arguments[ii],
next: head
};
}
if (this.__ownerID) {
this.size = newSize;
this._head = head;
this.__hash = undefined;
this.__altered = true;
return this;
}
return makeStack(newSize, head);
};
Stack.prototype.pushAll = function(iter) {
iter = IndexedIterable(iter);
if (iter.size === 0) {
return this;
}
assertNotInfinite(iter.size);
var newSize = this.size;
var head = this._head;
iter.reverse().forEach(function(value ) {
newSize++;
head = {
value: value,
next: head
};
});
if (this.__ownerID) {
this.size = newSize;
this._head = head;
this.__hash = undefined;
this.__altered = true;
return this;
}
return makeStack(newSize, head);
};
Stack.prototype.pop = function() {
return this.slice(1);
};
Stack.prototype.unshift = function(/*...values*/) {
return this.push.apply(this, arguments);
};
Stack.prototype.unshiftAll = function(iter) {
return this.pushAll(iter);
};
Stack.prototype.shift = function() {
return this.pop.apply(this, arguments);
};
Stack.prototype.clear = function() {
if (this.size === 0) {
return this;
}
if (this.__ownerID) {
this.size = 0;
this._head = undefined;
this.__hash = undefined;
this.__altered = true;
return this;
}
return emptyStack();
};
Stack.prototype.slice = function(begin, end) {
if (wholeSlice(begin, end, this.size)) {
return this;
}
var resolvedBegin = resolveBegin(begin, this.size);
var resolvedEnd = resolveEnd(end, this.size);
if (resolvedEnd !== this.size) {
// super.slice(begin, end);
return IndexedCollection.prototype.slice.call(this, begin, end);
}
var newSize = this.size - resolvedBegin;
var head = this._head;
while (resolvedBegin--) {
head = head.next;
}
if (this.__ownerID) {
this.size = newSize;
this._head = head;
this.__hash = undefined;
this.__altered = true;
return this;
}
return makeStack(newSize, head);
};
// @pragma Mutability
Stack.prototype.__ensureOwner = function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
if (!ownerID) {
this.__ownerID = ownerID;
this.__altered = false;
return this;
}
return makeStack(this.size, this._head, ownerID, this.__hash);
};
// @pragma Iteration
Stack.prototype.__iterate = function(fn, reverse) {
if (reverse) {
return this.reverse().__iterate(fn);
}
var iterations = 0;
var node = this._head;
while (node) {
if (fn(node.value, iterations++, this) === false) {
break;
}
node = node.next;
}
return iterations;
};
Stack.prototype.__iterator = function(type, reverse) {
if (reverse) {
return this.reverse().__iterator(type);
}
var iterations = 0;
var node = this._head;
return new Iterator(function() {
if (node) {
var value = node.value;
node = node.next;
return iteratorValue(type, iterations++, value);
}
return iteratorDone();
});
};
function isStack(maybeStack) {
return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);
}
Stack.isStack = isStack;
var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
var StackPrototype = Stack.prototype;
StackPrototype[IS_STACK_SENTINEL] = true;
StackPrototype.withMutations = MapPrototype.withMutations;
StackPrototype.asMutable = MapPrototype.asMutable;
StackPrototype.asImmutable = MapPrototype.asImmutable;
StackPrototype.wasAltered = MapPrototype.wasAltered;
function makeStack(size, head, ownerID, hash) {
var map = Object.create(StackPrototype);
map.size = size;
map._head = head;
map.__ownerID = ownerID;
map.__hash = hash;
map.__altered = false;
return map;
}
var EMPTY_STACK;
function emptyStack() {
return EMPTY_STACK || (EMPTY_STACK = makeStack(0));
}
/**
* Contributes additional methods to a constructor
*/
function mixin(ctor, methods) {
var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; };
Object.keys(methods).forEach(keyCopier);
Object.getOwnPropertySymbols &&
Object.getOwnPropertySymbols(methods).forEach(keyCopier);
return ctor;
}
Iterable.Iterator = Iterator;
mixin(Iterable, {
// ### Conversion to other types
toArray: function() {
assertNotInfinite(this.size);
var array = new Array(this.size || 0);
this.valueSeq().__iterate(function(v, i) { array[i] = v; });
return array;
},
toIndexedSeq: function() {
return new ToIndexedSequence(this);
},
toJS: function() {
return this.toSeq().map(
function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value}
).__toJS();
},
toJSON: function() {
return this.toSeq().map(
function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value}
).__toJS();
},
toKeyedSeq: function() {
return new ToKeyedSequence(this, true);
},
toMap: function() {
// Use Late Binding here to solve the circular dependency.
return Map(this.toKeyedSeq());
},
toObject: function() {
assertNotInfinite(this.size);
var object = {};
this.__iterate(function(v, k) { object[k] = v; });
return object;
},
toOrderedMap: function() {
// Use Late Binding here to solve the circular dependency.
return OrderedMap(this.toKeyedSeq());
},
toOrderedSet: function() {
// Use Late Binding here to solve the circular dependency.
return OrderedSet(isKeyed(this) ? this.valueSeq() : this);
},
toSet: function() {
// Use Late Binding here to solve the circular dependency.
return Set(isKeyed(this) ? this.valueSeq() : this);
},
toSetSeq: function() {
return new ToSetSequence(this);
},
toSeq: function() {
return isIndexed(this) ? this.toIndexedSeq() :
isKeyed(this) ? this.toKeyedSeq() :
this.toSetSeq();
},
toStack: function() {
// Use Late Binding here to solve the circular dependency.
return Stack(isKeyed(this) ? this.valueSeq() : this);
},
toList: function() {
// Use Late Binding here to solve the circular dependency.
return List(isKeyed(this) ? this.valueSeq() : this);
},
// ### Common JavaScript methods and properties
toString: function() {
return '[Iterable]';
},
__toString: function(head, tail) {
if (this.size === 0) {
return head + tail;
}
return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;
},
// ### ES6 Collection methods (ES6 Array and Map)
concat: function() {var values = SLICE$0.call(arguments, 0);
return reify(this, concatFactory(this, values));
},
includes: function(searchValue) {
return this.some(function(value ) {return is(value, searchValue)});
},
entries: function() {
return this.__iterator(ITERATE_ENTRIES);
},
every: function(predicate, context) {
assertNotInfinite(this.size);
var returnValue = true;
this.__iterate(function(v, k, c) {
if (!predicate.call(context, v, k, c)) {
returnValue = false;
return false;
}
});
return returnValue;
},
filter: function(predicate, context) {
return reify(this, filterFactory(this, predicate, context, true));
},
find: function(predicate, context, notSetValue) {
var entry = this.findEntry(predicate, context);
return entry ? entry[1] : notSetValue;
},
findEntry: function(predicate, context) {
var found;
this.__iterate(function(v, k, c) {
if (predicate.call(context, v, k, c)) {
found = [k, v];
return false;
}
});
return found;
},
findLastEntry: function(predicate, context) {
return this.toSeq().reverse().findEntry(predicate, context);
},
forEach: function(sideEffect, context) {
assertNotInfinite(this.size);
return this.__iterate(context ? sideEffect.bind(context) : sideEffect);
},
join: function(separator) {
assertNotInfinite(this.size);
separator = separator !== undefined ? '' + separator : ',';
var joined = '';
var isFirst = true;
this.__iterate(function(v ) {
isFirst ? (isFirst = false) : (joined += separator);
joined += v !== null && v !== undefined ? v.toString() : '';
});
return joined;
},
keys: function() {
return this.__iterator(ITERATE_KEYS);
},
map: function(mapper, context) {
return reify(this, mapFactory(this, mapper, context));
},
reduce: function(reducer, initialReduction, context) {
assertNotInfinite(this.size);
var reduction;
var useFirst;
if (arguments.length < 2) {
useFirst = true;
} else {
reduction = initialReduction;
}
this.__iterate(function(v, k, c) {
if (useFirst) {
useFirst = false;
reduction = v;
} else {
reduction = reducer.call(context, reduction, v, k, c);
}
});
return reduction;
},
reduceRight: function(reducer, initialReduction, context) {
var reversed = this.toKeyedSeq().reverse();
return reversed.reduce.apply(reversed, arguments);
},
reverse: function() {
return reify(this, reverseFactory(this, true));
},
slice: function(begin, end) {
return reify(this, sliceFactory(this, begin, end, true));
},
some: function(predicate, context) {
return !this.every(not(predicate), context);
},
sort: function(comparator) {
return reify(this, sortFactory(this, comparator));
},
values: function() {
return this.__iterator(ITERATE_VALUES);
},
// ### More sequential methods
butLast: function() {
return this.slice(0, -1);
},
isEmpty: function() {
return this.size !== undefined ? this.size === 0 : !this.some(function() {return true});
},
count: function(predicate, context) {
return ensureSize(
predicate ? this.toSeq().filter(predicate, context) : this
);
},
countBy: function(grouper, context) {
return countByFactory(this, grouper, context);
},
equals: function(other) {
return deepEqual(this, other);
},
entrySeq: function() {
var iterable = this;
if (iterable._cache) {
// We cache as an entries array, so we can just return the cache!
return new ArraySeq(iterable._cache);
}
var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();
entriesSequence.fromEntrySeq = function() {return iterable.toSeq()};
return entriesSequence;
},
filterNot: function(predicate, context) {
return this.filter(not(predicate), context);
},
findLast: function(predicate, context, notSetValue) {
return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);
},
first: function() {
return this.find(returnTrue);
},
flatMap: function(mapper, context) {
return reify(this, flatMapFactory(this, mapper, context));
},
flatten: function(depth) {
return reify(this, flattenFactory(this, depth, true));
},
fromEntrySeq: function() {
return new FromEntriesSequence(this);
},
get: function(searchKey, notSetValue) {
return this.find(function(_, key) {return is(key, searchKey)}, undefined, notSetValue);
},
getIn: function(searchKeyPath, notSetValue) {
var nested = this;
// Note: in an ES6 environment, we would prefer:
// for (var key of searchKeyPath) {
var iter = forceIterator(searchKeyPath);
var step;
while (!(step = iter.next()).done) {
var key = step.value;
nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;
if (nested === NOT_SET) {
return notSetValue;
}
}
return nested;
},
groupBy: function(grouper, context) {
return groupByFactory(this, grouper, context);
},
has: function(searchKey) {
return this.get(searchKey, NOT_SET) !== NOT_SET;
},
hasIn: function(searchKeyPath) {
return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;
},
isSubset: function(iter) {
iter = typeof iter.includes === 'function' ? iter : Iterable(iter);
return this.every(function(value ) {return iter.includes(value)});
},
isSuperset: function(iter) {
iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter);
return iter.isSubset(this);
},
keySeq: function() {
return this.toSeq().map(keyMapper).toIndexedSeq();
},
last: function() {
return this.toSeq().reverse().first();
},
max: function(comparator) {
return maxFactory(this, comparator);
},
maxBy: function(mapper, comparator) {
return maxFactory(this, comparator, mapper);
},
min: function(comparator) {
return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);
},
minBy: function(mapper, comparator) {
return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);
},
rest: function() {
return this.slice(1);
},
skip: function(amount) {
return this.slice(Math.max(0, amount));
},
skipLast: function(amount) {
return reify(this, this.toSeq().reverse().skip(amount).reverse());
},
skipWhile: function(predicate, context) {
return reify(this, skipWhileFactory(this, predicate, context, true));
},
skipUntil: function(predicate, context) {
return this.skipWhile(not(predicate), context);
},
sortBy: function(mapper, comparator) {
return reify(this, sortFactory(this, comparator, mapper));
},
take: function(amount) {
return this.slice(0, Math.max(0, amount));
},
takeLast: function(amount) {
return reify(this, this.toSeq().reverse().take(amount).reverse());
},
takeWhile: function(predicate, context) {
return reify(this, takeWhileFactory(this, predicate, context));
},
takeUntil: function(predicate, context) {
return this.takeWhile(not(predicate), context);
},
valueSeq: function() {
return this.toIndexedSeq();
},
// ### Hashable Object
hashCode: function() {
return this.__hash || (this.__hash = hashIterable(this));
}
// ### Internal
// abstract __iterate(fn, reverse)
// abstract __iterator(type, reverse)
});
// var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
// var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
// var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';
// var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
var IterablePrototype = Iterable.prototype;
IterablePrototype[IS_ITERABLE_SENTINEL] = true;
IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;
IterablePrototype.__toJS = IterablePrototype.toArray;
IterablePrototype.__toStringMapper = quoteString;
IterablePrototype.inspect =
IterablePrototype.toSource = function() { return this.toString(); };
IterablePrototype.chain = IterablePrototype.flatMap;
IterablePrototype.contains = IterablePrototype.includes;
// Temporary warning about using length
(function () {
try {
Object.defineProperty(IterablePrototype, 'length', {
get: function () {
if (!Iterable.noLengthWarning) {
var stack;
try {
throw new Error();
} catch (error) {
stack = error.stack;
}
if (stack.indexOf('_wrapObject') === -1) {
console && console.warn && console.warn(
'iterable.length has been deprecated, '+
'use iterable.size or iterable.count(). '+
'This warning will become a silent error in a future version. ' +
stack
);
return this.size;
}
}
}
});
} catch (e) {}
})();
mixin(KeyedIterable, {
// ### More sequential methods
flip: function() {
return reify(this, flipFactory(this));
},
findKey: function(predicate, context) {
var entry = this.findEntry(predicate, context);
return entry && entry[0];
},
findLastKey: function(predicate, context) {
return this.toSeq().reverse().findKey(predicate, context);
},
keyOf: function(searchValue) {
return this.findKey(function(value ) {return is(value, searchValue)});
},
lastKeyOf: function(searchValue) {
return this.findLastKey(function(value ) {return is(value, searchValue)});
},
mapEntries: function(mapper, context) {var this$0 = this;
var iterations = 0;
return reify(this,
this.toSeq().map(
function(v, k) {return mapper.call(context, [k, v], iterations++, this$0)}
).fromEntrySeq()
);
},
mapKeys: function(mapper, context) {var this$0 = this;
return reify(this,
this.toSeq().flip().map(
function(k, v) {return mapper.call(context, k, v, this$0)}
).flip()
);
}
});
var KeyedIterablePrototype = KeyedIterable.prototype;
KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;
KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;
KeyedIterablePrototype.__toJS = IterablePrototype.toObject;
KeyedIterablePrototype.__toStringMapper = function(v, k) {return JSON.stringify(k) + ': ' + quoteString(v)};
mixin(IndexedIterable, {
// ### Conversion to other types
toKeyedSeq: function() {
return new ToKeyedSequence(this, false);
},
// ### ES6 Collection methods (ES6 Array and Map)
filter: function(predicate, context) {
return reify(this, filterFactory(this, predicate, context, false));
},
findIndex: function(predicate, context) {
var entry = this.findEntry(predicate, context);
return entry ? entry[0] : -1;
},
indexOf: function(searchValue) {
var key = this.toKeyedSeq().keyOf(searchValue);
return key === undefined ? -1 : key;
},
lastIndexOf: function(searchValue) {
var key = this.toKeyedSeq().reverse().keyOf(searchValue);
return key === undefined ? -1 : key;
// var index =
// return this.toSeq().reverse().indexOf(searchValue);
},
reverse: function() {
return reify(this, reverseFactory(this, false));
},
slice: function(begin, end) {
return reify(this, sliceFactory(this, begin, end, false));
},
splice: function(index, removeNum /*, ...values*/) {
var numArgs = arguments.length;
removeNum = Math.max(removeNum | 0, 0);
if (numArgs === 0 || (numArgs === 2 && !removeNum)) {
return this;
}
// If index is negative, it should resolve relative to the size of the
// collection. However size may be expensive to compute if not cached, so
// only call count() if the number is in fact negative.
index = resolveBegin(index, index < 0 ? this.count() : this.size);
var spliced = this.slice(0, index);
return reify(
this,
numArgs === 1 ?
spliced :
spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))
);
},
// ### More collection methods
findLastIndex: function(predicate, context) {
var key = this.toKeyedSeq().findLastKey(predicate, context);
return key === undefined ? -1 : key;
},
first: function() {
return this.get(0);
},
flatten: function(depth) {
return reify(this, flattenFactory(this, depth, false));
},
get: function(index, notSetValue) {
index = wrapIndex(this, index);
return (index < 0 || (this.size === Infinity ||
(this.size !== undefined && index > this.size))) ?
notSetValue :
this.find(function(_, key) {return key === index}, undefined, notSetValue);
},
has: function(index) {
index = wrapIndex(this, index);
return index >= 0 && (this.size !== undefined ?
this.size === Infinity || index < this.size :
this.indexOf(index) !== -1
);
},
interpose: function(separator) {
return reify(this, interposeFactory(this, separator));
},
interleave: function(/*...iterables*/) {
var iterables = [this].concat(arrCopy(arguments));
var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables);
var interleaved = zipped.flatten(true);
if (zipped.size) {
interleaved.size = zipped.size * iterables.length;
}
return reify(this, interleaved);
},
last: function() {
return this.get(-1);
},
skipWhile: function(predicate, context) {
return reify(this, skipWhileFactory(this, predicate, context, false));
},
zip: function(/*, ...iterables */) {
var iterables = [this].concat(arrCopy(arguments));
return reify(this, zipWithFactory(this, defaultZipper, iterables));
},
zipWith: function(zipper/*, ...iterables */) {
var iterables = arrCopy(arguments);
iterables[0] = this;
return reify(this, zipWithFactory(this, zipper, iterables));
}
});
IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;
IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;
mixin(SetIterable, {
// ### ES6 Collection methods (ES6 Array and Map)
get: function(value, notSetValue) {
return this.has(value) ? value : notSetValue;
},
includes: function(value) {
return this.has(value);
},
// ### More sequential methods
keySeq: function() {
return this.valueSeq();
}
});
SetIterable.prototype.has = IterablePrototype.includes;
// Mixin subclasses
mixin(KeyedSeq, KeyedIterable.prototype);
mixin(IndexedSeq, IndexedIterable.prototype);
mixin(SetSeq, SetIterable.prototype);
mixin(KeyedCollection, KeyedIterable.prototype);
mixin(IndexedCollection, IndexedIterable.prototype);
mixin(SetCollection, SetIterable.prototype);
// #pragma Helper functions
function keyMapper(v, k) {
return k;
}
function entryMapper(v, k) {
return [k, v];
}
function not(predicate) {
return function() {
return !predicate.apply(this, arguments);
}
}
function neg(predicate) {
return function() {
return -predicate.apply(this, arguments);
}
}
function quoteString(value) {
return typeof value === 'string' ? JSON.stringify(value) : value;
}
function defaultZipper() {
return arrCopy(arguments);
}
function defaultNegComparator(a, b) {
return a < b ? 1 : a > b ? -1 : 0;
}
function hashIterable(iterable) {
if (iterable.size === Infinity) {
return 0;
}
var ordered = isOrdered(iterable);
var keyed = isKeyed(iterable);
var h = ordered ? 1 : 0;
var size = iterable.__iterate(
keyed ?
ordered ?
function(v, k) { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } :
function(v, k) { h = h + hashMerge(hash(v), hash(k)) | 0; } :
ordered ?
function(v ) { h = 31 * h + hash(v) | 0; } :
function(v ) { h = h + hash(v) | 0; }
);
return murmurHashOfSize(size, h);
}
function murmurHashOfSize(size, h) {
h = imul(h, 0xCC9E2D51);
h = imul(h << 15 | h >>> -15, 0x1B873593);
h = imul(h << 13 | h >>> -13, 5);
h = (h + 0xE6546B64 | 0) ^ size;
h = imul(h ^ h >>> 16, 0x85EBCA6B);
h = imul(h ^ h >>> 13, 0xC2B2AE35);
h = smi(h ^ h >>> 16);
return h;
}
function hashMerge(a, b) {
return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int
}
var Immutable = {
Iterable: Iterable,
Seq: Seq,
Collection: Collection,
Map: Map,
OrderedMap: OrderedMap,
List: List,
Stack: Stack,
Set: Set,
OrderedSet: OrderedSet,
Record: Record,
Range: Range,
Repeat: Repeat,
is: is,
fromJS: fromJS
};
return Immutable;
}));
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var _immutable = __webpack_require__(6);
exports['default'] = function (value) {
if (_immutable.Iterable.isIterable(value)) {
return value.toJS();
}
return value;
};
module.exports = exports['default'];
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = function() {};
if ((undefined) !== 'production') {
warning = function(condition, format, args) {
var len = arguments.length;
args = new Array(len > 2 ? len - 2 : 0);
for (var key = 2; key < len; key++) {
args[key - 2] = arguments[key];
}
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
'message argument'
);
}
if (format.length < 10 || (/^[s\W]*$/).test(format)) {
throw new Error(
'The warning format should be able to uniquely identify this ' +
'warning. Please, use a more descriptive format than: ' + format
);
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' +
format.replace(/%s/g, function() {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch(x) {}
}
};
}
module.exports = warning;
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _qs = __webpack_require__(10);
var _qs2 = _interopRequireDefault(_qs);
var _warning = __webpack_require__(8);
var _warning2 = _interopRequireDefault(_warning);
function parseBody(response) {
return response.text().then(function (text) {
if (!text || !text.length) {
(0, _warning2['default'])(response.status === 204, 'You should return a 204 status code with an empty body.');
return null;
}
(0, _warning2['default'])(response.status !== 204, 'You should return an empty body with a 204 status code.');
try {
return JSON.parse(text);
} catch (error) {
return text;
}
});
}
exports['default'] = function (fetch) {
return function (config) {
var url = config.url;
delete config.url;
if (config.data) {
config.body = /application\/json/.test(config.headers['Content-Type']) ? JSON.stringify(config.data) : config.data;
delete config.data;
}
var queryString = _qs2['default'].stringify(config.params || {}, { arrayFormat: 'brackets' });
delete config.params;
return fetch(!queryString.length ? url : url + '?' + queryString, config).then(function (response) {
return parseBody(response).then(function (json) {
var headers = {};
if (typeof Headers.prototype.forEach === 'function') {
response.headers.forEach(function (value, name) {
headers[name] = value;
});
} else if (typeof Headers.prototype.keys === 'function') {
var keys = response.headers.keys();
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var key = _step.value;
headers[key] = response.headers.get(key);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator['return']) {
_iterator['return']();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
} else {
headers = response.headers;
}
var responsePayload = {
data: json,
headers: headers,
method: config.method ? config.method.toLowerCase() : 'get',
statusCode: response.status
};
if (response.status >= 200 && response.status < 300) {
return responsePayload;
}
var error = new Error(response.statusText);
error.response = responsePayload;
throw error;
});
});
};
};
module.exports = exports['default'];
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
// Load modules
var Stringify = __webpack_require__(11);
var Parse = __webpack_require__(13);
// Declare internals
var internals = {};
module.exports = {
stringify: Stringify,
parse: Parse
};
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
// Load modules
var Utils = __webpack_require__(12);
// Declare internals
var internals = {
delimiter: '&',
arrayPrefixGenerators: {
brackets: function (prefix, key) {
return prefix + '[]';
},
indices: function (prefix, key) {
return prefix + '[' + key + ']';
},
repeat: function (prefix, key) {
return prefix;
}
},
strictNullHandling: false,
skipNulls: false,
encode: true
};
internals.stringify = function (obj, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort) {
if (typeof filter === 'function') {
obj = filter(prefix, obj);
}
else if (Utils.isBuffer(obj)) {
obj = obj.toString();
}
else if (obj instanceof Date) {
obj = obj.toISOString();
}
else if (obj === null) {
if (strictNullHandling) {
return encode ? Utils.encode(prefix) : prefix;
}
obj = '';
}
if (typeof obj === 'string' ||
typeof obj === 'number' ||
typeof obj === 'boolean') {
if (encode) {
return [Utils.encode(prefix) + '=' + Utils.encode(obj)];
}
return [prefix + '=' + obj];
}
var values = [];
if (typeof obj === 'undefined') {
return values;
}
var objKeys;
if (Array.isArray(filter)) {
objKeys = filter;
} else {
var keys = Object.keys(obj);
objKeys = sort ? keys.sort(sort) : keys;
}
for (var i = 0, il = objKeys.length; i < il; ++i) {
var key = objKeys[i];
if (skipNulls &&
obj[key] === null) {
continue;
}
if (Array.isArray(obj)) {
values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter));
}
else {
values = values.concat(internals.stringify(obj[key], prefix + '[' + key + ']', generateArrayPrefix, strictNullHandling, skipNulls, encode, filter));
}
}
return values;
};
module.exports = function (obj, options) {
options = options || {};
var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter;
var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;
var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : internals.skipNulls;
var encode = typeof options.encode === 'boolean' ? options.encode : internals.encode;
var sort = typeof options.sort === 'function' ? options.sort : null;
var objKeys;
var filter;
if (typeof options.filter === 'function') {
filter = options.filter;
obj = filter('', obj);
}
else if (Array.isArray(options.filter)) {
objKeys = filter = options.filter;
}
var keys = [];
if (typeof obj !== 'object' ||
obj === null) {
return '';
}
var arrayFormat;
if (options.arrayFormat in internals.arrayPrefixGenerators) {
arrayFormat = options.arrayFormat;
}
else if ('indices' in options) {
arrayFormat = options.indices ? 'indices' : 'repeat';
}
else {
arrayFormat = 'indices';
}
var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat];
if (!objKeys) {
objKeys = Object.keys(obj);
}
if (sort) {
objKeys.sort(sort);
}
for (var i = 0, il = objKeys.length; i < il; ++i) {
var key = objKeys[i];
if (skipNulls &&
obj[key] === null) {
continue;
}
keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort));
}
return keys.join(delimiter);
};
/***/ },
/* 12 */
/***/ function(module, exports) {
// Load modules
// Declare internals
var internals = {};
internals.hexTable = new Array(256);
for (var h = 0; h < 256; ++h) {
internals.hexTable[h] = '%' + ((h < 16 ? '0' : '') + h.toString(16)).toUpperCase();
}
exports.arrayToObject = function (source, options) {
var obj = options.plainObjects ? Object.create(null) : {};
for (var i = 0, il = source.length; i < il; ++i) {
if (typeof source[i] !== 'undefined') {
obj[i] = source[i];
}
}
return obj;
};
exports.merge = function (target, source, options) {
if (!source) {
return target;
}
if (typeof source !== 'object') {
if (Array.isArray(target)) {
target.push(source);
}
else if (typeof target === 'object') {
target[source] = true;
}
else {
target = [target, source];
}
return target;
}
if (typeof target !== 'object') {
target = [target].concat(source);
return target;
}
if (Array.isArray(target) &&
!Array.isArray(source)) {
target = exports.arrayToObject(target, options);
}
var keys = Object.keys(source);
for (var k = 0, kl = keys.length; k < kl; ++k) {
var key = keys[k];
var value = source[key];
if (!Object.prototype.hasOwnProperty.call(target, key)) {
target[key] = value;
}
else {
target[key] = exports.merge(target[key], value, options);
}
}
return target;
};
exports.decode = function (str) {
try {
return decodeURIComponent(str.replace(/\+/g, ' '));
} catch (e) {
return str;
}
};
exports.encode = function (str) {
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
// It has been adapted here for stricter adherence to RFC 3986
if (str.length === 0) {
return str;
}
if (typeof str !== 'string') {
str = '' + str;
}
var out = '';
for (var i = 0, il = str.length; i < il; ++i) {
var c = str.charCodeAt(i);
if (c === 0x2D || // -
c === 0x2E || // .
c === 0x5F || // _
c === 0x7E || // ~
(c >= 0x30 && c <= 0x39) || // 0-9
(c >= 0x41 && c <= 0x5A) || // a-z
(c >= 0x61 && c <= 0x7A)) { // A-Z
out += str[i];
continue;
}
if (c < 0x80) {
out += internals.hexTable[c];
continue;
}
if (c < 0x800) {
out += internals.hexTable[0xC0 | (c >> 6)] + internals.hexTable[0x80 | (c & 0x3F)];
continue;
}
if (c < 0xD800 || c >= 0xE000) {
out += internals.hexTable[0xE0 | (c >> 12)] + internals.hexTable[0x80 | ((c >> 6) & 0x3F)] + internals.hexTable[0x80 | (c & 0x3F)];
continue;
}
++i;
c = 0x10000 + (((c & 0x3FF) << 10) | (str.charCodeAt(i) & 0x3FF));
out += internals.hexTable[0xF0 | (c >> 18)] + internals.hexTable[0x80 | ((c >> 12) & 0x3F)] + internals.hexTable[0x80 | ((c >> 6) & 0x3F)] + internals.hexTable[0x80 | (c & 0x3F)];
}
return out;
};
exports.compact = function (obj, refs) {
if (typeof obj !== 'object' ||
obj === null) {
return obj;
}
refs = refs || [];
var lookup = refs.indexOf(obj);
if (lookup !== -1) {
return refs[lookup];
}
refs.push(obj);
if (Array.isArray(obj)) {
var compacted = [];
for (var i = 0, il = obj.length; i < il; ++i) {
if (typeof obj[i] !== 'undefined') {
compacted.push(obj[i]);
}
}
return compacted;
}
var keys = Object.keys(obj);
for (i = 0, il = keys.length; i < il; ++i) {
var key = keys[i];
obj[key] = exports.compact(obj[key], refs);
}
return obj;
};
exports.isRegExp = function (obj) {
return Object.prototype.toString.call(obj) === '[object RegExp]';
};
exports.isBuffer = function (obj) {
if (obj === null ||
typeof obj === 'undefined') {
return false;
}
return !!(obj.constructor &&
obj.constructor.isBuffer &&
obj.constructor.isBuffer(obj));
};
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
// Load modules
var Utils = __webpack_require__(12);
// Declare internals
var internals = {
delimiter: '&',
depth: 5,
arrayLimit: 20,
parameterLimit: 1000,
strictNullHandling: false,
plainObjects: false,
allowPrototypes: false,
allowDots: false
};
internals.parseValues = function (str, options) {
var obj = {};
var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);
for (var i = 0, il = parts.length; i < il; ++i) {
var part = parts[i];
var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;
if (pos === -1) {
obj[Utils.decode(part)] = '';
if (options.strictNullHandling) {
obj[Utils.decode(part)] = null;
}
}
else {
var key = Utils.decode(part.slice(0, pos));
var val = Utils.decode(part.slice(pos + 1));
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
obj[key] = val;
}
else {
obj[key] = [].concat(obj[key]).concat(val);
}
}
}
return obj;
};
internals.parseObject = function (chain, val, options) {
if (!chain.length) {
return val;
}
var root = chain.shift();
var obj;
if (root === '[]') {
obj = [];
obj = obj.concat(internals.parseObject(chain, val, options));
}
else {
obj = options.plainObjects ? Object.create(null) : {};
var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root;
var index = parseInt(cleanRoot, 10);
var indexString = '' + index;
if (!isNaN(index) &&
root !== cleanRoot &&
indexString === cleanRoot &&
index >= 0 &&
(options.parseArrays &&
index <= options.arrayLimit)) {
obj = [];
obj[index] = internals.parseObject(chain, val, options);
}
else {
obj[cleanRoot] = internals.parseObject(chain, val, options);
}
}
return obj;
};
internals.parseKeys = function (key, val, options) {
if (!key) {
return;
}
// Transform dot notation to bracket notation
if (options.allowDots) {
key = key.replace(/\.([^\.\[]+)/g, '[$1]');
}
// The regex chunks
var parent = /^([^\[\]]*)/;
var child = /(\[[^\[\]]*\])/g;
// Get the parent
var segment = parent.exec(key);
// Stash the parent if it exists
var keys = [];
if (segment[1]) {
// If we aren't using plain objects, optionally prefix keys
// that would overwrite object prototype properties
if (!options.plainObjects &&
Object.prototype.hasOwnProperty(segment[1])) {
if (!options.allowPrototypes) {
return;
}
}
keys.push(segment[1]);
}
// Loop through children appending to the array until we hit depth
var i = 0;
while ((segment = child.exec(key)) !== null && i < options.depth) {
++i;
if (!options.plainObjects &&
Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) {
if (!options.allowPrototypes) {
continue;
}
}
keys.push(segment[1]);
}
// If there's a remainder, just add whatever is left
if (segment) {
keys.push('[' + key.slice(segment.index) + ']');
}
return internals.parseObject(keys, val, options);
};
module.exports = function (str, options) {
options = options || {};
options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter;
options.depth = typeof options.depth === 'number' ? options.depth : internals.depth;
options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit;
options.parseArrays = options.parseArrays !== false;
options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : internals.allowDots;
options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : internals.plainObjects;
options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : internals.allowPrototypes;
options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit;
options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;
if (str === '' ||
str === null ||
typeof str === 'undefined') {
return options.plainObjects ? Object.create(null) : {};
}
var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str;
var obj = options.plainObjects ? Object.create(null) : {};
// Iterate over the keys and setup the new object
var keys = Object.keys(tempObj);
for (var i = 0, il = keys.length; i < il; ++i) {
var key = keys[i];
var newObj = internals.parseKeys(key, tempObj[key], options);
obj = Utils.merge(obj, newObj, options);
}
return Utils.compact(obj);
};
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
var _objectAssign = __webpack_require__(3);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _immutable = __webpack_require__(6);
var _utilSerialize = __webpack_require__(7);
var _utilSerialize2 = _interopRequireDefault(_utilSerialize);
/* eslint-disable new-cap */
function reducePromiseList(emitter, list, initialValue) {
var params = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3];
return list.reduce(function (promise, nextItem) {
return promise.then(function (currentValue) {
emitter.apply(undefined, ['pre', (0, _utilSerialize2['default'])(currentValue)].concat(_toConsumableArray(params), [nextItem.name]));
return Promise.resolve(nextItem.apply(undefined, [(0, _utilSerialize2['default'])(currentValue)].concat(_toConsumableArray(params)))).then(function (nextValue) {
if (!_immutable.Iterable.isIterable(currentValue)) {
return (0, _objectAssign2['default'])({}, currentValue, nextValue);
}
return currentValue.mergeDeep(nextValue);
}).then(function (nextValue) {
emitter.apply(undefined, ['post', (0, _utilSerialize2['default'])(nextValue)].concat(_toConsumableArray(params), [nextItem.name]));
return nextValue;
});
});
}, Promise.resolve(initialValue));
}
exports['default'] = function (httpBackend) {
return function (config, emitter) {
var errorInterceptors = (0, _immutable.List)(config.get('errorInterceptors'));
var requestInterceptors = (0, _immutable.List)(config.get('requestInterceptors'));
var responseInterceptors = (0, _immutable.List)(config.get('responseInterceptors'));
var currentConfig = config['delete']('errorInterceptors')['delete']('requestInterceptors')['delete']('responseInterceptors');
function emitterFactory(type) {
return function (event) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
emitter.apply(undefined, [type + ':' + event].concat(args));
};
}
return reducePromiseList(emitterFactory('request:interceptor'), requestInterceptors, currentConfig).then(function (transformedConfig) {
emitter('request', (0, _utilSerialize2['default'])(transformedConfig));
return httpBackend((0, _utilSerialize2['default'])(transformedConfig)).then(function (response) {
return reducePromiseList(emitterFactory('response:interceptor'), responseInterceptors, (0, _immutable.fromJS)(response), [(0, _utilSerialize2['default'])(transformedConfig)]);
});
}).then(null, function (error) {
return reducePromiseList(emitterFactory('error:interceptor'), errorInterceptors, error, [(0, _utilSerialize2['default'])(currentConfig)]).then(function (transformedError) {
return Promise.reject(transformedError);
});
});
};
};
module.exports = exports['default'];
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.custom = custom;
exports.collection = collection;
exports.member = member;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _objectAssign = __webpack_require__(3);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
function custom(endpoint) {
return function (name) {
var relative = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
if (relative) {
return member(endpoint['new'](endpoint.url() + '/' + name)); // eslint-disable-line no-use-before-define
}
return member(endpoint['new'](name)); // eslint-disable-line no-use-before-define
};
}
function collection(endpoint) {
function _bindHttpMethod(method) {
return function () {
var _member;
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var id = args.shift();
return (_member = member(endpoint['new'](endpoint.url() + '/' + id)))[method].apply(_member, args); // eslint-disable-line no-use-before-define
};
}
return (0, _objectAssign2['default'])(endpoint, {
custom: custom(endpoint),
'delete': _bindHttpMethod('delete'),
getAll: endpoint.get,
get: _bindHttpMethod('get'),
head: _bindHttpMethod('head'),
patch: _bindHttpMethod('patch'),
put: _bindHttpMethod('put')
});
}
function member(endpoint) {
return (0, _objectAssign2['default'])(endpoint, {
all: function all(name) {
return collection(endpoint['new'](endpoint.url() + '/' + name));
},
custom: custom(endpoint),
one: function one(name, id) {
return member(endpoint['new'](endpoint.url() + '/' + name + '/' + id));
}
});
}
/***/ },
/* 16 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = function (request) {
return function (config) {
if (config.data) {
config.form = /application\/json/.test(config.headers['Content-Type']) ? JSON.stringify(config.data) : config.data;
delete config.data;
}
if (config.params) {
config.qs = config.params;
delete config.params;
}
return new Promise(function (resolve, reject) {
request(config, function (err, response, body) {
if (err) {
throw err;
}
var data = undefined;
try {
data = JSON.parse(body);
} catch (e) {
data = body;
}
var responsePayload = {
data: data,
headers: response.headers,
statusCode: response.statusCode
};
if (response.statusCode >= 200 && response.statusCode < 300) {
return resolve(responsePayload);
}
var error = new Error(response.statusMessage);
error.response = responsePayload;
reject(error);
});
});
};
};
module.exports = exports['default'];
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = scopeFactory;
var _events = __webpack_require__(18);
var _immutable = __webpack_require__(6);
/* eslint-disable new-cap */
function scopeFactory(parentScope) {
var _data = (0, _immutable.Map)();
var _emitter = new _events.EventEmitter();
var scope = {
assign: function assign(key, subKey, value) {
if (!scope.has(key)) {
scope.set(key, (0, _immutable.Map)());
}
_data = _data.setIn([key, subKey], value);
return scope;
},
emit: function emit() {
_emitter.emit.apply(_emitter, arguments);
if (parentScope) {
parentScope.emit.apply(parentScope, arguments);
}
},
get: function get(key) {
var datum = _data.get(key);
if (scope.has(key) && !_immutable.Iterable.isIterable(datum) || !parentScope) {
return datum;
} else if (!scope.has(key) && parentScope) {
return parentScope.get(key);
}
var parentDatum = parentScope.get(key);
if (!parentDatum) {
return datum;
}
if (_immutable.List.isList(parentDatum)) {
return parentDatum.concat(datum);
}
return parentDatum.mergeDeep(datum);
},
has: function has(key) {
return _data.has(key);
},
'new': function _new() {
return scopeFactory(scope);
},
on: _emitter.on.bind(_emitter),
once: _emitter.once.bind(_emitter),
push: function push(key, value) {
if (!scope.has(key)) {
scope.set(key, (0, _immutable.List)());
}
_data = _data.update(key, function (list) {
return list.push(value);
});
return scope;
},
set: function set(key, value) {
_data = _data.set(key, value);
return scope;
}
};
return scope;
}
module.exports = exports['default'];
/***/ },
/* 18 */
/***/ function(module, exports) {
// Copyright Joyent, Inc. and other Node contributors.
//
// 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.
function EventEmitter() {
this._events = this._events || {};
this._maxListeners = this._maxListeners || undefined;
}
module.exports = EventEmitter;
// Backwards-compat with node 0.10.x
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._maxListeners = undefined;
// By default EventEmitters will print a warning if more than 10 listeners are
// added to it. This is a useful default which helps finding memory leaks.
EventEmitter.defaultMaxListeners = 10;
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
EventEmitter.prototype.setMaxListeners = function(n) {
if (!isNumber(n) || n < 0 || isNaN(n))
throw TypeError('n must be a positive number');
this._maxListeners = n;
return this;
};
EventEmitter.prototype.emit = function(type) {
var er, handler, len, args, i, listeners;
if (!this._events)
this._events = {};
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._events.error ||
(isObject(this._events.error) && !this._events.error.length)) {
er = arguments[1];
if (er instanceof Error) {
throw er; // Unhandled 'error' event
}
throw TypeError('Uncaught, unspecified "error" event.');
}
}
handler = this._events[type];
if (isUndefined(handler))
return false;
if (isFunction(handler)) {
switch (arguments.length) {
// fast cases
case 1:
handler.call(this);
break;
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
// slower
default:
len = arguments.length;
args = new Array(len - 1);
for (i = 1; i < len; i++)
args[i - 1] = arguments[i];
handler.apply(this, args);
}
} else if (isObject(handler)) {
len = arguments.length;
args = new Array(len - 1);
for (i = 1; i < len; i++)
args[i - 1] = arguments[i];
listeners = handler.slice();
len = listeners.length;
for (i = 0; i < len; i++)
listeners[i].apply(this, args);
}
return true;
};
EventEmitter.prototype.addListener = function(type, listener) {
var m;
if (!isFunction(listener))
throw TypeError('listener must be a function');
if (!this._events)
this._events = {};
// To avoid recursion in the case that type === "newListener"! Before
// adding it to the listeners, first emit "newListener".
if (this._events.newListener)
this.emit('newListener', type,
isFunction(listener.listener) ?
listener.listener : listener);
if (!this._events[type])
// Optimize the case of one listener. Don't need the extra array object.
this._events[type] = listener;
else if (isObject(this._events[type]))
// If we've already got an array, just append.
this._events[type].push(listener);
else
// Adding the second element, need to change to array.
this._events[type] = [this._events[type], listener];
// Check for listener leak
if (isObject(this._events[type]) && !this._events[type].warned) {
var m;
if (!isUndefined(this._maxListeners)) {
m = this._maxListeners;
} else {
m = EventEmitter.defaultMaxListeners;
}
if (m && m > 0 && this._events[type].length > m) {
this._events[type].warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
this._events[type].length);
if (typeof console.trace === 'function') {
// not supported in IE 10
console.trace();
}
}
}
return this;
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.once = function(type, listener) {
if (!isFunction(listener))
throw TypeError('listener must be a function');
var fired = false;
function g() {
this.removeListener(type, g);
if (!fired) {
fired = true;
listener.apply(this, arguments);
}
}
g.listener = listener;
this.on(type, g);
return this;
};
// emits a 'removeListener' event iff the listener was removed
EventEmitter.prototype.removeListener = function(type, listener) {
var list, position, length, i;
if (!isFunction(listener))
throw TypeError('listener must be a function');
if (!this._events || !this._events[type])
return this;
list = this._events[type];
length = list.length;
position = -1;
if (list === listener ||
(isFunction(list.listener) && list.listener === listener)) {
delete this._events[type];
if (this._events.removeListener)
this.emit('removeListener', type, listener);
} else if (isObject(list)) {
for (i = length; i-- > 0;) {
if (list[i] === listener ||
(list[i].listener && list[i].listener === listener)) {
position = i;
break;
}
}
if (position < 0)
return this;
if (list.length === 1) {
list.length = 0;
delete this._events[type];
} else {
list.splice(position, 1);
}
if (this._events.removeListener)
this.emit('removeListener', type, listener);
}
return this;
};
EventEmitter.prototype.removeAllListeners = function(type) {
var key, listeners;
if (!this._events)
return this;
// not listening for removeListener, no need to emit
if (!this._events.removeListener) {
if (arguments.length === 0)
this._events = {};
else if (this._events[type])
delete this._events[type];
return this;
}
// emit removeListener for all listeners on all events
if (arguments.length === 0) {
for (key in this._events) {
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = {};
return this;
}
listeners = this._events[type];
if (isFunction(listeners)) {
this.removeListener(type, listeners);
} else {
// LIFO order
while (listeners.length)
this.removeListener(type, listeners[listeners.length - 1]);
}
delete this._events[type];
return this;
};
EventEmitter.prototype.listeners = function(type) {
var ret;
if (!this._events || !this._events[type])
ret = [];
else if (isFunction(this._events[type]))
ret = [this._events[type]];
else
ret = this._events[type].slice();
return ret;
};
EventEmitter.listenerCount = function(emitter, type) {
var ret;
if (!emitter._events || !emitter._events[type])
ret = 0;
else if (isFunction(emitter._events[type]))
ret = 1;
else
ret = emitter._events[type].length;
return ret;
};
function isFunction(arg) {
return typeof arg === 'function';
}
function isNumber(arg) {
return typeof arg === 'number';
}
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
function isUndefined(arg) {
return arg === void 0;
}
/***/ },
/* 19 */
/***/ function(module, exports) {
(function(self) {
'use strict';
if (self.fetch) {
return
}
function normalizeName(name) {
if (typeof name !== 'string') {
name = String(name)
}
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
throw new TypeError('Invalid character in header field name')
}
return name.toLowerCase()
}
function normalizeValue(value) {
if (typeof value !== 'string') {
value = String(value)
}
return value
}
function Headers(headers) {
this.map = {}
if (headers instanceof Headers) {
headers.forEach(function(value, name) {
this.append(name, value)
}, this)
} else if (headers) {
Object.getOwnPropertyNames(headers).forEach(function(name) {
this.append(name, headers[name])
}, this)
}
}
Headers.prototype.append = function(name, value) {
name = normalizeName(name)
value = normalizeValue(value)
var list = this.map[name]
if (!list) {
list = []
this.map[name] = list
}
list.push(value)
}
Headers.prototype['delete'] = function(name) {
delete this.map[normalizeName(name)]
}
Headers.prototype.get = function(name) {
var values = this.map[normalizeName(name)]
return values ? values[0] : null
}
Headers.prototype.getAll = function(name) {
return this.map[normalizeName(name)] || []
}
Headers.prototype.has = function(name) {
return this.map.hasOwnProperty(normalizeName(name))
}
Headers.prototype.set = function(name, value) {
this.map[normalizeName(name)] = [normalizeValue(value)]
}
Headers.prototype.forEach = function(callback, thisArg) {
Object.getOwnPropertyNames(this.map).forEach(function(name) {
this.map[name].forEach(function(value) {
callback.call(thisArg, value, name, this)
}, this)
}, this)
}
function consumed(body) {
if (body.bodyUsed) {
return Promise.reject(new TypeError('Already read'))
}
body.bodyUsed = true
}
function fileReaderReady(reader) {
return new Promise(function(resolve, reject) {
reader.onload = function() {
resolve(reader.result)
}
reader.onerror = function() {
reject(reader.error)
}
})
}
function readBlobAsArrayBuffer(blob) {
var reader = new FileReader()
reader.readAsArrayBuffer(blob)
return fileReaderReady(reader)
}
function readBlobAsText(blob) {
var reader = new FileReader()
reader.readAsText(blob)
return fileReaderReady(reader)
}
var support = {
blob: 'FileReader' in self && 'Blob' in self && (function() {
try {
new Blob();
return true
} catch(e) {
return false
}
})(),
formData: 'FormData' in self,
arrayBuffer: 'ArrayBuffer' in self
}
function Body() {
this.bodyUsed = false
this._initBody = function(body) {
this._bodyInit = body
if (typeof body === 'string') {
this._bodyText = body
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
this._bodyBlob = body
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
this._bodyFormData = body
} else if (!body) {
this._bodyText = ''
} else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
// Only support ArrayBuffers for POST method.
// Receiving ArrayBuffers happens via Blobs, instead.
} else {
throw new Error('unsupported BodyInit type')
}
if (!this.headers.get('content-type')) {
if (typeof body === 'string') {
this.headers.set('content-type', 'text/plain;charset=UTF-8')
} else if (this._bodyBlob && this._bodyBlob.type) {
this.headers.set('content-type', this._bodyBlob.type)
}
}
}
if (support.blob) {
this.blob = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return Promise.resolve(this._bodyBlob)
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as blob')
} else {
return Promise.resolve(new Blob([this._bodyText]))
}
}
this.arrayBuffer = function() {
return this.blob().then(readBlobAsArrayBuffer)
}
this.text = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return readBlobAsText(this._bodyBlob)
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as text')
} else {
return Promise.resolve(this._bodyText)
}
}
} else {
this.text = function() {
var rejected = consumed(this)
return rejected ? rejected : Promise.resolve(this._bodyText)
}
}
if (support.formData) {
this.formData = function() {
return this.text().then(decode)
}
}
this.json = function() {
return this.text().then(JSON.parse)
}
return this
}
// HTTP methods whose capitalization should be normalized
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
function normalizeMethod(method) {
var upcased = method.toUpperCase()
return (methods.indexOf(upcased) > -1) ? upcased : method
}
function Request(input, options) {
options = options || {}
var body = options.body
if (Request.prototype.isPrototypeOf(input)) {
if (input.bodyUsed) {
throw new TypeError('Already read')
}
this.url = input.url
this.credentials = input.credentials
if (!options.headers) {
this.headers = new Headers(input.headers)
}
this.method = input.method
this.mode = input.mode
if (!body) {
body = input._bodyInit
input.bodyUsed = true
}
} else {
this.url = input
}
this.credentials = options.credentials || this.credentials || 'omit'
if (options.headers || !this.headers) {
this.headers = new Headers(options.headers)
}
this.method = normalizeMethod(options.method || this.method || 'GET')
this.mode = options.mode || this.mode || null
this.referrer = null
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
throw new TypeError('Body not allowed for GET or HEAD requests')
}
this._initBody(body)
}
Request.prototype.clone = function() {
return new Request(this)
}
function decode(body) {
var form = new FormData()
body.trim().split('&').forEach(function(bytes) {
if (bytes) {
var split = bytes.split('=')
var name = split.shift().replace(/\+/g, ' ')
var value = split.join('=').replace(/\+/g, ' ')
form.append(decodeURIComponent(name), decodeURIComponent(value))
}
})
return form
}
function headers(xhr) {
var head = new Headers()
var pairs = xhr.getAllResponseHeaders().trim().split('\n')
pairs.forEach(function(header) {
var split = header.trim().split(':')
var key = split.shift().trim()
var value = split.join(':').trim()
head.append(key, value)
})
return head
}
Body.call(Request.prototype)
function Response(bodyInit, options) {
if (!options) {
options = {}
}
this.type = 'default'
this.status = options.status
this.ok = this.status >= 200 && this.status < 300
this.statusText = options.statusText
this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
this.url = options.url || ''
this._initBody(bodyInit)
}
Body.call(Response.prototype)
Response.prototype.clone = function() {
return new Response(this._bodyInit, {
status: this.status,
statusText: this.statusText,
headers: new Headers(this.headers),
url: this.url
})
}
Response.error = function() {
var response = new Response(null, {status: 0, statusText: ''})
response.type = 'error'
return response
}
var redirectStatuses = [301, 302, 303, 307, 308]
Response.redirect = function(url, status) {
if (redirectStatuses.indexOf(status) === -1) {
throw new RangeError('Invalid status code')
}
return new Response(null, {status: status, headers: {location: url}})
}
self.Headers = Headers;
self.Request = Request;
self.Response = Response;
self.fetch = function(input, init) {
return new Promise(function(resolve, reject) {
var request
if (Request.prototype.isPrototypeOf(input) && !init) {
request = input
} else {
request = new Request(input, init)
}
var xhr = new XMLHttpRequest()
function responseURL() {
if ('responseURL' in xhr) {
return xhr.responseURL
}
// Avoid security warnings on getResponseHeader when not allowed by CORS
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
return xhr.getResponseHeader('X-Request-URL')
}
return;
}
xhr.onload = function() {
var status = (xhr.status === 1223) ? 204 : xhr.status
if (status < 100 || status > 599) {
reject(new TypeError('Network request failed'))
return
}
var options = {
status: status,
statusText: xhr.statusText,
headers: headers(xhr),
url: responseURL()
}
var body = 'response' in xhr ? xhr.response : xhr.responseText;
resolve(new Response(body, options))
}
xhr.onerror = function() {
reject(new TypeError('Network request failed'))
}
xhr.open(request.method, request.url, true)
if (request.credentials === 'include') {
xhr.withCredentials = true
}
if ('responseType' in xhr && support.blob) {
xhr.responseType = 'blob'
}
request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value)
})
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
})
}
self.fetch.polyfill = true
})(typeof self !== 'undefined' ? self : this);
/***/ }
/******/ ])
});
; |
/**!
* AngularJS file upload/drop directive and service with progress and abort
* FileAPI Flash shim for old browsers not supporting FormData
* @author Danial <[email protected]>
* @version 3.0.4
*/
(function() {
var hasFlash = function() {
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if (fo) return true;
} catch(e) {
if (navigator.mimeTypes['application/x-shockwave-flash'] != undefined) return true;
}
return false;
}
function patchXHR(fnName, newFn) {
window.XMLHttpRequest.prototype[fnName] = newFn(window.XMLHttpRequest.prototype[fnName]);
};
if ((window.XMLHttpRequest && !window.FormData) || (window.FileAPI && FileAPI.forceLoad)) {
var initializeUploadListener = function(xhr) {
if (!xhr.__listeners) {
if (!xhr.upload) xhr.upload = {};
xhr.__listeners = [];
var origAddEventListener = xhr.upload.addEventListener;
xhr.upload.addEventListener = function(t, fn, b) {
xhr.__listeners[t] = fn;
origAddEventListener && origAddEventListener.apply(this, arguments);
};
}
}
patchXHR('open', function(orig) {
return function(m, url, b) {
initializeUploadListener(this);
this.__url = url;
try {
orig.apply(this, [m, url, b]);
} catch (e) {
if (e.message.indexOf('Access is denied') > -1) {
this.__origError = e;
this.__url = '_fix_for_ie_crossdomain__';
orig.apply(this, [m, this.__url, b]);
}
}
}
});
patchXHR('getResponseHeader', function(orig) {
return function(h) {
return this.__fileApiXHR && this.__fileApiXHR.getResponseHeader ? this.__fileApiXHR.getResponseHeader(h) : (orig == null ? null : orig.apply(this, [h]));
};
});
patchXHR('getAllResponseHeaders', function(orig) {
return function() {
return this.__fileApiXHR && this.__fileApiXHR.getAllResponseHeaders ? this.__fileApiXHR.getAllResponseHeaders() : (orig == null ? null : orig.apply(this));
}
});
patchXHR('abort', function(orig) {
return function() {
return this.__fileApiXHR && this.__fileApiXHR.abort ? this.__fileApiXHR.abort() : (orig == null ? null : orig.apply(this));
}
});
patchXHR('setRequestHeader', function(orig) {
return function(header, value) {
if (header === '__setXHR_') {
initializeUploadListener(this);
var val = value(this);
// fix for angular < 1.2.0
if (val instanceof Function) {
val(this);
}
} else {
this.__requestHeaders = this.__requestHeaders || {};
this.__requestHeaders[header] = value;
orig.apply(this, arguments);
}
}
});
function redefineProp(xhr, prop, fn) {
try {
Object.defineProperty(xhr, prop, {get: fn});
} catch (e) {/*ignore*/}
}
patchXHR('send', function(orig) {
return function() {
var xhr = this;
if (arguments[0] && arguments[0].__isFileAPIShim) {
var formData = arguments[0];
var config = {
url: xhr.__url,
jsonp: false, //removes the callback form param
cache: true, //removes the ?fileapiXXX in the url
complete: function(err, fileApiXHR) {
xhr.__completed = true;
if (!err && xhr.__listeners['load'])
xhr.__listeners['load']({type: 'load', loaded: xhr.__loaded, total: xhr.__total, target: xhr, lengthComputable: true});
if (!err && xhr.__listeners['loadend'])
xhr.__listeners['loadend']({type: 'loadend', loaded: xhr.__loaded, total: xhr.__total, target: xhr, lengthComputable: true});
if (err === 'abort' && xhr.__listeners['abort'])
xhr.__listeners['abort']({type: 'abort', loaded: xhr.__loaded, total: xhr.__total, target: xhr, lengthComputable: true});
if (fileApiXHR.status !== undefined) redefineProp(xhr, 'status', function() {return (fileApiXHR.status == 0 && err && err !== 'abort') ? 500 : fileApiXHR.status});
if (fileApiXHR.statusText !== undefined) redefineProp(xhr, 'statusText', function() {return fileApiXHR.statusText});
redefineProp(xhr, 'readyState', function() {return 4});
if (fileApiXHR.response !== undefined) redefineProp(xhr, 'response', function() {return fileApiXHR.response});
var resp = fileApiXHR.responseText || (err && fileApiXHR.status == 0 && err !== 'abort' ? err : undefined);
redefineProp(xhr, 'responseText', function() {return resp});
redefineProp(xhr, 'response', function() {return resp});
if (err) redefineProp(xhr, 'err', function() {return err});
xhr.__fileApiXHR = fileApiXHR;
if (xhr.onreadystatechange) xhr.onreadystatechange();
if (xhr.onload) xhr.onload();
},
fileprogress: function(e) {
e.target = xhr;
xhr.__listeners['progress'] && xhr.__listeners['progress'](e);
xhr.__total = e.total;
xhr.__loaded = e.loaded;
if (e.total === e.loaded) {
// fix flash issue that doesn't call complete if there is no response text from the server
var _this = this
setTimeout(function() {
if (!xhr.__completed) {
xhr.getAllResponseHeaders = function(){};
_this.complete(null, {status: 204, statusText: 'No Content'});
}
}, FileAPI.noContentTimeout || 10000);
}
},
headers: xhr.__requestHeaders
}
config.data = {};
config.files = {}
for (var i = 0; i < formData.data.length; i++) {
var item = formData.data[i];
if (item.val != null && item.val.name != null && item.val.size != null && item.val.type != null) {
config.files[item.key] = item.val;
} else {
config.data[item.key] = item.val;
}
}
setTimeout(function() {
if (!hasFlash()) {
throw 'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';
}
xhr.__fileApiXHR = FileAPI.upload(config);
}, 1);
} else {
if (this.__url === '_fix_for_ie_crossdomain__') {
throw this.__origError;
}
orig.apply(xhr, arguments);
}
}
});
window.XMLHttpRequest.__isFileAPIShim = true;
var addFlash = function(elem) {
if (!hasFlash()) {
throw 'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';
}
var el = angular.element(elem);
if (!el.attr('disabled')) {
var hasFileSelect = false;
for (var i = 0; i < el[0].attributes.length; i++) {
var attrib = el[0].attributes[i];
if (attrib.name.indexOf('file-select') !== -1) {
hasFileSelect = true;
break;
}
}
if (!el.hasClass('js-fileapi-wrapper') && (hasFileSelect || el.attr('__afu_gen__') != null)) {
el.addClass('js-fileapi-wrapper');
if (el.attr('__afu_gen__') != null) {
var ref = (el[0].__refElem__ && angular.element(el[0].__refElem__)) || el;
while (ref && !ref.attr('__refElem__')) {
ref = angular.element(ref[0].nextSibling);
}
ref.bind('mouseover', function() {
if (el.parent().css('position') === '' || el.parent().css('position') === 'static') {
el.parent().css('position', 'relative');
}
el.css('position', 'absolute').css('top', ref[0].offsetTop + 'px').css('left', ref[0].offsetLeft + 'px')
.css('width', ref[0].offsetWidth + 'px').css('height', ref[0].offsetHeight + 'px')
.css('padding', ref.css('padding')).css('margin', ref.css('margin')).css('filter', 'alpha(opacity=0)');
ref.attr('onclick', '');
el.css('z-index', '1000');
});
}
}
}
};
var changeFnWrapper = function(fn) {
return function(evt) {
var files = FileAPI.getFiles(evt);
//just a double check for #233
for (var i = 0; i < files.length; i++) {
if (files[i].size === undefined) files[i].size = 0;
if (files[i].name === undefined) files[i].name = 'file';
if (files[i].type === undefined) files[i].type = 'undefined';
}
if (!evt.target) {
evt.target = {};
}
evt.target.files = files;
// if evt.target.files is not writable use helper field
if (evt.target.files != files) {
evt.__files_ = files;
}
(evt.__files_ || evt.target.files).item = function(i) {
return (evt.__files_ || evt.target.files)[i] || null;
}
if (fn) fn.apply(this, [evt]);
};
};
var isFileChange = function(elem, e) {
return (e.toLowerCase() === 'change' || e.toLowerCase() === 'onchange') && elem.getAttribute('type') == 'file';
}
if (HTMLInputElement.prototype.addEventListener) {
HTMLInputElement.prototype.addEventListener = (function(origAddEventListener) {
return function(e, fn, b, d) {
if (isFileChange(this, e)) {
addFlash(this);
origAddEventListener.apply(this, [e, changeFnWrapper(fn), b, d]);
} else {
origAddEventListener.apply(this, [e, fn, b, d]);
}
}
})(HTMLInputElement.prototype.addEventListener);
}
if (HTMLInputElement.prototype.attachEvent) {
HTMLInputElement.prototype.attachEvent = (function(origAttachEvent) {
return function(e, fn) {
if (isFileChange(this, e)) {
addFlash(this);
if (window.jQuery) {
// fix for #281 jQuery on IE8
angular.element(this).bind('change', changeFnWrapper(null));
} else {
origAttachEvent.apply(this, [e, changeFnWrapper(fn)]);
}
} else {
origAttachEvent.apply(this, [e, fn]);
}
}
})(HTMLInputElement.prototype.attachEvent);
}
window.FormData = FormData = function() {
return {
append: function(key, val, name) {
if (val.__isFileAPIBlobShim) {
val = val.data[0];
}
this.data.push({
key: key,
val: val,
name: name
});
},
data: [],
__isFileAPIShim: true
};
};
window.Blob = Blob = function(b) {
return {
data: b,
__isFileAPIBlobShim: true
};
};
(function () {
//load FileAPI
if (!window.FileAPI) {
window.FileAPI = {};
}
if (FileAPI.forceLoad) {
FileAPI.html5 = false;
}
if (!FileAPI.upload) {
var jsUrl, basePath, script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
if (window.FileAPI.jsUrl) {
jsUrl = window.FileAPI.jsUrl;
} else if (window.FileAPI.jsPath) {
basePath = window.FileAPI.jsPath;
} else {
for (i = 0; i < allScripts.length; i++) {
src = allScripts[i].src;
index = src.search(/\/angular\-file\-upload[\-a-zA-z0-9\.]*\.js/)
if (index > -1) {
basePath = src.substring(0, index + 1);
break;
}
}
}
if (FileAPI.staticPath == null) FileAPI.staticPath = basePath;
script.setAttribute('src', jsUrl || basePath + 'FileAPI.min.js');
document.getElementsByTagName('head')[0].appendChild(script);
FileAPI.hasFlash = hasFlash();
}
})();
FileAPI.disableFileInput = function(elem, disable) {
if (disable) {
elem.removeClass('js-fileapi-wrapper')
} else {
elem.addClass('js-fileapi-wrapper');
}
}
}
if (!window.FileReader) {
window.FileReader = function() {
var _this = this, loadStarted = false;
this.listeners = {};
this.addEventListener = function(type, fn) {
_this.listeners[type] = _this.listeners[type] || [];
_this.listeners[type].push(fn);
};
this.removeEventListener = function(type, fn) {
_this.listeners[type] && _this.listeners[type].splice(_this.listeners[type].indexOf(fn), 1);
};
this.dispatchEvent = function(evt) {
var list = _this.listeners[evt.type];
if (list) {
for (var i = 0; i < list.length; i++) {
list[i].call(_this, evt);
}
}
};
this.onabort = this.onerror = this.onload = this.onloadstart = this.onloadend = this.onprogress = null;
var constructEvent = function(type, evt) {
var e = {type: type, target: _this, loaded: evt.loaded, total: evt.total, error: evt.error};
if (evt.result != null) e.target.result = evt.result;
return e;
};
var listener = function(evt) {
if (!loadStarted) {
loadStarted = true;
_this.onloadstart && _this.onloadstart(constructEvent('loadstart', evt));
}
if (evt.type === 'load') {
_this.onloadend && _this.onloadend(constructEvent('loadend', evt));
var e = constructEvent('load', evt);
_this.onload && _this.onload(e);
_this.dispatchEvent(e);
} else if (evt.type === 'progress') {
var e = constructEvent('progress', evt);
_this.onprogress && _this.onprogress(e);
_this.dispatchEvent(e);
} else {
var e = constructEvent('error', evt);
_this.onerror && _this.onerror(e);
_this.dispatchEvent(e);
}
};
this.readAsArrayBuffer = function(file) {
FileAPI.readAsBinaryString(file, listener);
}
this.readAsBinaryString = function(file) {
FileAPI.readAsBinaryString(file, listener);
}
this.readAsDataURL = function(file) {
FileAPI.readAsDataURL(file, listener);
}
this.readAsText = function(file) {
FileAPI.readAsText(file, listener);
}
}
}
})();
|
module.exports = {
mysql: {
database: 'bookshelf_test',
user: 'root',
encoding: 'utf8'
},
postgres: {
database: 'bookshelf_test',
user: 'postgres'
},
sqlite3: {
filename: ':memory:'
}
}; |
/**
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticFocusEvent
* @typechecks static-only
*/
"use strict";
var SyntheticUIEvent = require("./SyntheticUIEvent");
/**
* @interface FocusEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var FocusEventInterface = {
relatedTarget: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
|
'use strict';
function createXhr(method) {
//if IE and the method is not RFC2616 compliant, or if XMLHttpRequest
//is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest
//if it is available
if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||
!window.XMLHttpRequest)) {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
return new window.XMLHttpRequest();
}
throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest.");
}
/**
* @ngdoc service
* @name $httpBackend
* @requires $window
* @requires $document
*
* @description
* HTTP backend used by the {@link ng.$http service} that delegates to
* XMLHttpRequest object or JSONP and deals with browser incompatibilities.
*
* You should never need to use this service directly, instead use the higher-level abstractions:
* {@link ng.$http $http} or {@link ngResource.$resource $resource}.
*
* During testing this implementation is swapped with {@link ngMock.$httpBackend mock
* $httpBackend} which can be trained with responses.
*/
function $HttpBackendProvider() {
this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) {
return createHttpBackend($browser, createXhr, $browser.defer, $window.angular.callbacks, $document[0]);
}];
}
function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {
var ABORTED = -1;
// TODO(vojta): fix the signature
return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {
var status;
$browser.$$incOutstandingRequestCount();
url = url || $browser.url();
if (lowercase(method) == 'jsonp') {
var callbackId = '_' + (callbacks.counter++).toString(36);
callbacks[callbackId] = function(data) {
callbacks[callbackId].data = data;
callbacks[callbackId].called = true;
};
var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),
callbackId, function(status, text) {
completeRequest(callback, status, callbacks[callbackId].data, "", text);
callbacks[callbackId] = noop;
});
} else {
var xhr = createXhr(method);
xhr.open(method, url, true);
forEach(headers, function(value, key) {
if (isDefined(value)) {
xhr.setRequestHeader(key, value);
}
});
// In IE6 and 7, this might be called synchronously when xhr.send below is called and the
// response is in the cache. the promise api will ensure that to the app code the api is
// always async
xhr.onreadystatechange = function() {
// onreadystatechange might get called multiple times with readyState === 4 on mobile webkit caused by
// xhrs that are resolved while the app is in the background (see #5426).
// since calling completeRequest sets the `xhr` variable to null, we just check if it's not null before
// continuing
//
// we can't set xhr.onreadystatechange to undefined or delete it because that breaks IE8 (method=PATCH) and
// Safari respectively.
if (xhr && xhr.readyState == 4) {
var responseHeaders = null,
response = null;
if(status !== ABORTED) {
responseHeaders = xhr.getAllResponseHeaders();
// responseText is the old-school way of retrieving response (supported by IE8 & 9)
// response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
response = ('response' in xhr) ? xhr.response : xhr.responseText;
}
completeRequest(callback,
status || xhr.status,
response,
responseHeaders,
xhr.statusText || '');
}
};
if (withCredentials) {
xhr.withCredentials = true;
}
if (responseType) {
try {
xhr.responseType = responseType;
} catch (e) {
// WebKit added support for the json responseType value on 09/03/2013
// https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
// known to throw when setting the value "json" as the response type. Other older
// browsers implementing the responseType
//
// The json response type can be ignored if not supported, because JSON payloads are
// parsed on the client-side regardless.
if (responseType !== 'json') {
throw e;
}
}
}
xhr.send(post || null);
}
if (timeout > 0) {
var timeoutId = $browserDefer(timeoutRequest, timeout);
} else if (timeout && timeout.then) {
timeout.then(timeoutRequest);
}
function timeoutRequest() {
status = ABORTED;
jsonpDone && jsonpDone();
xhr && xhr.abort();
}
function completeRequest(callback, status, response, headersString, statusText) {
// cancel timeout and subsequent timeout promise resolution
timeoutId && $browserDefer.cancel(timeoutId);
jsonpDone = xhr = null;
// fix status code when it is 0 (0 status is undocumented).
// Occurs when accessing file resources or on Android 4.1 stock browser
// while retrieving files from application cache.
if (status === 0) {
status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;
}
// normalize IE bug (http://bugs.jquery.com/ticket/1450)
status = status === 1223 ? 204 : status;
statusText = statusText || '';
callback(status, response, headersString, statusText);
$browser.$$completeOutstandingRequest(noop);
}
};
function jsonpReq(url, callbackId, done) {
// we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.:
// - fetches local scripts via XHR and evals them
// - adds and immediately removes script elements from the document
var script = rawDocument.createElement('script'), callback = null;
script.type = "text/javascript";
script.src = url;
script.async = true;
callback = function(event) {
removeEventListenerFn(script, "load", callback);
removeEventListenerFn(script, "error", callback);
rawDocument.body.removeChild(script);
script = null;
var status = -1;
var text = "unknown";
if (event) {
if (event.type === "load" && !callbacks[callbackId].called) {
event = { type: "error" };
}
text = event.type;
status = event.type === "error" ? 404 : 200;
}
if (done) {
done(status, text);
}
};
addEventListenerFn(script, "load", callback);
addEventListenerFn(script, "error", callback);
rawDocument.body.appendChild(script);
return callback;
}
}
|
/*!
* # Semantic UI 2.2.0 - Popup
* http://github.com/semantic-org/semantic-ui/
*
*
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
;(function ($, window, document, undefined) {
"use strict";
window = (typeof window != 'undefined' && window.Math == Math)
? window
: (typeof self != 'undefined' && self.Math == Math)
? self
: Function('return this')()
;
$.fn.popup = function(parameters) {
var
$allModules = $(this),
$document = $(document),
$window = $(window),
$body = $('body'),
moduleSelector = $allModules.selector || '',
hasTouch = (true),
time = new Date().getTime(),
performance = [],
query = arguments[0],
methodInvoked = (typeof query == 'string'),
queryArguments = [].slice.call(arguments, 1),
returnedValue
;
$allModules
.each(function() {
var
settings = ( $.isPlainObject(parameters) )
? $.extend(true, {}, $.fn.popup.settings, parameters)
: $.extend({}, $.fn.popup.settings),
selector = settings.selector,
className = settings.className,
error = settings.error,
metadata = settings.metadata,
namespace = settings.namespace,
eventNamespace = '.' + settings.namespace,
moduleNamespace = 'module-' + namespace,
$module = $(this),
$context = $(settings.context),
$scrollContext = $(settings.scrollContext),
$boundary = $(settings.boundary),
$target = (settings.target)
? $(settings.target)
: $module,
$popup,
$offsetParent,
searchDepth = 0,
triedPositions = false,
openedWithTouch = false,
element = this,
instance = $module.data(moduleNamespace),
documentObserver,
elementNamespace,
id,
module
;
module = {
// binds events
initialize: function() {
module.debug('Initializing', $module);
module.createID();
module.bind.events();
if(!module.exists() && settings.preserve) {
module.create();
}
module.observeChanges();
module.instantiate();
},
instantiate: function() {
module.verbose('Storing instance', module);
instance = module;
$module
.data(moduleNamespace, instance)
;
},
observeChanges: function() {
if('MutationObserver' in window) {
documentObserver = new MutationObserver(module.event.documentChanged);
documentObserver.observe(document, {
childList : true,
subtree : true
});
module.debug('Setting up mutation observer', documentObserver);
}
},
refresh: function() {
if(settings.popup) {
$popup = $(settings.popup).eq(0);
}
else {
if(settings.inline) {
$popup = $target.nextAll(selector.popup).eq(0);
settings.popup = $popup;
}
}
if(settings.popup) {
$popup.addClass(className.loading);
$offsetParent = module.get.offsetParent();
$popup.removeClass(className.loading);
if(settings.movePopup && module.has.popup() && module.get.offsetParent($popup)[0] !== $offsetParent[0]) {
module.debug('Moving popup to the same offset parent as activating element');
$popup
.detach()
.appendTo($offsetParent)
;
}
}
else {
$offsetParent = (settings.inline)
? module.get.offsetParent($target)
: module.has.popup()
? module.get.offsetParent($popup)
: $body
;
}
if( $offsetParent.is('html') && $offsetParent[0] !== $body[0] ) {
module.debug('Setting page as offset parent');
$offsetParent = $body;
}
if( module.get.variation() ) {
module.set.variation();
}
},
reposition: function() {
module.refresh();
module.set.position();
},
destroy: function() {
module.debug('Destroying previous module');
if(documentObserver) {
documentObserver.disconnect();
}
// remove element only if was created dynamically
if($popup && !settings.preserve) {
module.removePopup();
}
// clear all timeouts
clearTimeout(module.hideTimer);
clearTimeout(module.showTimer);
// remove events
module.unbind.close();
module.unbind.events();
$module
.removeData(moduleNamespace)
;
},
event: {
start: function(event) {
var
delay = ($.isPlainObject(settings.delay))
? settings.delay.show
: settings.delay
;
clearTimeout(module.hideTimer);
if(!openedWithTouch) {
module.showTimer = setTimeout(module.show, delay);
}
},
end: function() {
var
delay = ($.isPlainObject(settings.delay))
? settings.delay.hide
: settings.delay
;
clearTimeout(module.showTimer);
module.hideTimer = setTimeout(module.hide, delay);
},
touchstart: function(event) {
openedWithTouch = true;
module.show();
},
resize: function() {
if( module.is.visible() ) {
module.set.position();
}
},
documentChanged: function(mutations) {
[].forEach.call(mutations, function(mutation) {
if(mutation.removedNodes) {
[].forEach.call(mutation.removedNodes, function(node) {
if(node == element || $(node).find(element).length > 0) {
module.debug('Element removed from DOM, tearing down events');
module.destroy();
}
});
}
});
},
hideGracefully: function(event) {
var
$target = $(event.target),
isInDOM = $.contains(document.documentElement, event.target),
inPopup = ($target.closest(selector.popup).length > 0)
;
// don't close on clicks inside popup
if(event && !inPopup && isInDOM) {
module.debug('Click occurred outside popup hiding popup');
module.hide();
}
else {
module.debug('Click was inside popup, keeping popup open');
}
}
},
// generates popup html from metadata
create: function() {
var
html = module.get.html(),
title = module.get.title(),
content = module.get.content()
;
if(html || content || title) {
module.debug('Creating pop-up html');
if(!html) {
html = settings.templates.popup({
title : title,
content : content
});
}
$popup = $('<div/>')
.addClass(className.popup)
.data(metadata.activator, $module)
.html(html)
;
if(settings.inline) {
module.verbose('Inserting popup element inline', $popup);
$popup
.insertAfter($module)
;
}
else {
module.verbose('Appending popup element to body', $popup);
$popup
.appendTo( $context )
;
}
module.refresh();
module.set.variation();
if(settings.hoverable) {
module.bind.popup();
}
settings.onCreate.call($popup, element);
}
else if($target.next(selector.popup).length !== 0) {
module.verbose('Pre-existing popup found');
settings.inline = true;
settings.popup = $target.next(selector.popup).data(metadata.activator, $module);
module.refresh();
if(settings.hoverable) {
module.bind.popup();
}
}
else if(settings.popup) {
$(settings.popup).data(metadata.activator, $module);
module.verbose('Used popup specified in settings');
module.refresh();
if(settings.hoverable) {
module.bind.popup();
}
}
else {
module.debug('No content specified skipping display', element);
}
},
createID: function() {
id = (Math.random().toString(16) + '000000000').substr(2, 8);
elementNamespace = '.' + id;
module.verbose('Creating unique id for element', id);
},
// determines popup state
toggle: function() {
module.debug('Toggling pop-up');
if( module.is.hidden() ) {
module.debug('Popup is hidden, showing pop-up');
module.unbind.close();
module.show();
}
else {
module.debug('Popup is visible, hiding pop-up');
module.hide();
}
},
show: function(callback) {
callback = callback || function(){};
module.debug('Showing pop-up', settings.transition);
if(module.is.hidden() && !( module.is.active() && module.is.dropdown()) ) {
if( !module.exists() ) {
module.create();
}
if(settings.onShow.call($popup, element) === false) {
module.debug('onShow callback returned false, cancelling popup animation');
return;
}
else if(!settings.preserve && !settings.popup) {
module.refresh();
}
if( $popup && module.set.position() ) {
module.save.conditions();
if(settings.exclusive) {
module.hideAll();
}
module.animate.show(callback);
}
}
},
hide: function(callback) {
callback = callback || function(){};
if( module.is.visible() || module.is.animating() ) {
if(settings.onHide.call($popup, element) === false) {
module.debug('onHide callback returned false, cancelling popup animation');
return;
}
module.remove.visible();
module.unbind.close();
module.restore.conditions();
module.animate.hide(callback);
}
},
hideAll: function() {
$(selector.popup)
.filter('.' + className.visible)
.each(function() {
$(this)
.data(metadata.activator)
.popup('hide')
;
})
;
},
exists: function() {
if(!$popup) {
return false;
}
if(settings.inline || settings.popup) {
return ( module.has.popup() );
}
else {
return ( $popup.closest($context).length >= 1 )
? true
: false
;
}
},
removePopup: function() {
if( module.has.popup() && !settings.popup) {
module.debug('Removing popup', $popup);
$popup.remove();
$popup = undefined;
settings.onRemove.call($popup, element);
}
},
save: {
conditions: function() {
module.cache = {
title: $module.attr('title')
};
if (module.cache.title) {
$module.removeAttr('title');
}
module.verbose('Saving original attributes', module.cache.title);
}
},
restore: {
conditions: function() {
if(module.cache && module.cache.title) {
$module.attr('title', module.cache.title);
module.verbose('Restoring original attributes', module.cache.title);
}
return true;
}
},
supports: {
svg: function() {
return (typeof SVGGraphicsElement === undefined);
}
},
animate: {
show: function(callback) {
callback = $.isFunction(callback) ? callback : function(){};
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
module.set.visible();
$popup
.transition({
animation : settings.transition + ' in',
queue : false,
debug : settings.debug,
verbose : settings.verbose,
duration : settings.duration,
onComplete : function() {
module.bind.close();
callback.call($popup, element);
settings.onVisible.call($popup, element);
}
})
;
}
else {
module.error(error.noTransition);
}
},
hide: function(callback) {
callback = $.isFunction(callback) ? callback : function(){};
module.debug('Hiding pop-up');
if(settings.onHide.call($popup, element) === false) {
module.debug('onHide callback returned false, cancelling popup animation');
return;
}
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
$popup
.transition({
animation : settings.transition + ' out',
queue : false,
duration : settings.duration,
debug : settings.debug,
verbose : settings.verbose,
onComplete : function() {
module.reset();
callback.call($popup, element);
settings.onHidden.call($popup, element);
}
})
;
}
else {
module.error(error.noTransition);
}
}
},
change: {
content: function(html) {
$popup.html(html);
}
},
get: {
html: function() {
$module.removeData(metadata.html);
return $module.data(metadata.html) || settings.html;
},
title: function() {
$module.removeData(metadata.title);
return $module.data(metadata.title) || settings.title;
},
content: function() {
$module.removeData(metadata.content);
return $module.data(metadata.content) || $module.attr('title') || settings.content;
},
variation: function() {
$module.removeData(metadata.variation);
return $module.data(metadata.variation) || settings.variation;
},
popup: function() {
return $popup;
},
popupOffset: function() {
return $popup.offset();
},
calculations: function() {
var
targetElement = $target[0],
isWindow = ($boundary[0] == window),
targetPosition = (settings.inline || (settings.popup && settings.movePopup))
? $target.position()
: $target.offset(),
screenPosition = (isWindow)
? { top: 0, left: 0 }
: $boundary.offset(),
calculations = {},
scroll = (isWindow)
? { top: $window.scrollTop(), left: $window.scrollLeft() }
: { top: 0, left: 0},
screen
;
calculations = {
// element which is launching popup
target : {
element : $target[0],
width : $target.outerWidth(),
height : $target.outerHeight(),
top : targetPosition.top,
left : targetPosition.left,
margin : {}
},
// popup itself
popup : {
width : $popup.outerWidth(),
height : $popup.outerHeight()
},
// offset container (or 3d context)
parent : {
width : $offsetParent.outerWidth(),
height : $offsetParent.outerHeight()
},
// screen boundaries
screen : {
top : screenPosition.top,
left : screenPosition.left,
scroll: {
top : scroll.top,
left : scroll.left
},
width : $boundary.width(),
height : $boundary.height()
}
};
// add in container calcs if fluid
if( settings.setFluidWidth && module.is.fluid() ) {
calculations.container = {
width: $popup.parent().outerWidth()
};
calculations.popup.width = calculations.container.width;
}
// add in margins if inline
calculations.target.margin.top = (settings.inline)
? parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-top'), 10)
: 0
;
calculations.target.margin.left = (settings.inline)
? module.is.rtl()
? parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-right'), 10)
: parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-left'), 10)
: 0
;
// calculate screen boundaries
screen = calculations.screen;
calculations.boundary = {
top : screen.top + screen.scroll.top,
bottom : screen.top + screen.scroll.top + screen.height,
left : screen.left + screen.scroll.left,
right : screen.left + screen.scroll.left + screen.width
};
return calculations;
},
id: function() {
return id;
},
startEvent: function() {
if(settings.on == 'hover') {
return 'mouseenter';
}
else if(settings.on == 'focus') {
return 'focus';
}
return false;
},
scrollEvent: function() {
return 'scroll';
},
endEvent: function() {
if(settings.on == 'hover') {
return 'mouseleave';
}
else if(settings.on == 'focus') {
return 'blur';
}
return false;
},
distanceFromBoundary: function(offset, calculations) {
var
distanceFromBoundary = {},
popup,
boundary
;
calculations = calculations || module.get.calculations();
// shorthand
popup = calculations.popup;
boundary = calculations.boundary;
if(offset) {
distanceFromBoundary = {
top : (offset.top - boundary.top),
left : (offset.left - boundary.left),
right : (boundary.right - (offset.left + popup.width) ),
bottom : (boundary.bottom - (offset.top + popup.height) )
};
module.verbose('Distance from boundaries determined', offset, distanceFromBoundary);
}
return distanceFromBoundary;
},
offsetParent: function($target) {
var
element = ($target !== undefined)
? $target[0]
: $module[0],
parentNode = element.parentNode,
$node = $(parentNode)
;
if(parentNode) {
var
is2D = ($node.css('transform') === 'none'),
isStatic = ($node.css('position') === 'static'),
isHTML = $node.is('html')
;
while(parentNode && !isHTML && isStatic && is2D) {
parentNode = parentNode.parentNode;
$node = $(parentNode);
is2D = ($node.css('transform') === 'none');
isStatic = ($node.css('position') === 'static');
isHTML = $node.is('html');
}
}
return ($node && $node.length > 0)
? $node
: $()
;
},
positions: function() {
return {
'top left' : false,
'top center' : false,
'top right' : false,
'bottom left' : false,
'bottom center' : false,
'bottom right' : false,
'left center' : false,
'right center' : false
};
},
nextPosition: function(position) {
var
positions = position.split(' '),
verticalPosition = positions[0],
horizontalPosition = positions[1],
opposite = {
top : 'bottom',
bottom : 'top',
left : 'right',
right : 'left'
},
adjacent = {
left : 'center',
center : 'right',
right : 'left'
},
backup = {
'top left' : 'top center',
'top center' : 'top right',
'top right' : 'right center',
'right center' : 'bottom right',
'bottom right' : 'bottom center',
'bottom center' : 'bottom left',
'bottom left' : 'left center',
'left center' : 'top left'
},
adjacentsAvailable = (verticalPosition == 'top' || verticalPosition == 'bottom'),
oppositeTried = false,
adjacentTried = false,
nextPosition = false
;
if(!triedPositions) {
module.verbose('All available positions available');
triedPositions = module.get.positions();
}
module.debug('Recording last position tried', position);
triedPositions[position] = true;
if(settings.prefer === 'opposite') {
nextPosition = [opposite[verticalPosition], horizontalPosition];
nextPosition = nextPosition.join(' ');
oppositeTried = (triedPositions[nextPosition] === true);
module.debug('Trying opposite strategy', nextPosition);
}
if((settings.prefer === 'adjacent') && adjacentsAvailable ) {
nextPosition = [verticalPosition, adjacent[horizontalPosition]];
nextPosition = nextPosition.join(' ');
adjacentTried = (triedPositions[nextPosition] === true);
module.debug('Trying adjacent strategy', nextPosition);
}
if(adjacentTried || oppositeTried) {
module.debug('Using backup position', nextPosition);
nextPosition = backup[position];
}
return nextPosition;
}
},
set: {
position: function(position, calculations) {
// exit conditions
if($target.length === 0 || $popup.length === 0) {
module.error(error.notFound);
return;
}
var
offset,
distanceAway,
target,
popup,
parent,
positioning,
popupOffset,
distanceFromBoundary
;
calculations = calculations || module.get.calculations();
position = position || $module.data(metadata.position) || settings.position;
offset = $module.data(metadata.offset) || settings.offset;
distanceAway = settings.distanceAway;
// shorthand
target = calculations.target;
popup = calculations.popup;
parent = calculations.parent;
if(target.width === 0 && target.height === 0 && !module.is.svg(target.element)) {
module.debug('Popup target is hidden, no action taken');
return false;
}
if(settings.inline) {
module.debug('Adding margin to calculation', target.margin);
if(position == 'left center' || position == 'right center') {
offset += target.margin.top;
distanceAway += -target.margin.left;
}
else if (position == 'top left' || position == 'top center' || position == 'top right') {
offset += target.margin.left;
distanceAway -= target.margin.top;
}
else {
offset += target.margin.left;
distanceAway += target.margin.top;
}
}
module.debug('Determining popup position from calculations', position, calculations);
if (module.is.rtl()) {
position = position.replace(/left|right/g, function (match) {
return (match == 'left')
? 'right'
: 'left'
;
});
module.debug('RTL: Popup position updated', position);
}
// if last attempt use specified last resort position
if(searchDepth == settings.maxSearchDepth && typeof settings.lastResort === 'string') {
position = settings.lastResort;
}
switch (position) {
case 'top left':
positioning = {
top : 'auto',
bottom : parent.height - target.top + distanceAway,
left : target.left + offset,
right : 'auto'
};
break;
case 'top center':
positioning = {
bottom : parent.height - target.top + distanceAway,
left : target.left + (target.width / 2) - (popup.width / 2) + offset,
top : 'auto',
right : 'auto'
};
break;
case 'top right':
positioning = {
bottom : parent.height - target.top + distanceAway,
right : parent.width - target.left - target.width - offset,
top : 'auto',
left : 'auto'
};
break;
case 'left center':
positioning = {
top : target.top + (target.height / 2) - (popup.height / 2) + offset,
right : parent.width - target.left + distanceAway,
left : 'auto',
bottom : 'auto'
};
break;
case 'right center':
positioning = {
top : target.top + (target.height / 2) - (popup.height / 2) + offset,
left : target.left + target.width + distanceAway,
bottom : 'auto',
right : 'auto'
};
break;
case 'bottom left':
positioning = {
top : target.top + target.height + distanceAway,
left : target.left + offset,
bottom : 'auto',
right : 'auto'
};
break;
case 'bottom center':
positioning = {
top : target.top + target.height + distanceAway,
left : target.left + (target.width / 2) - (popup.width / 2) + offset,
bottom : 'auto',
right : 'auto'
};
break;
case 'bottom right':
positioning = {
top : target.top + target.height + distanceAway,
right : parent.width - target.left - target.width - offset,
left : 'auto',
bottom : 'auto'
};
break;
}
if(positioning === undefined) {
module.error(error.invalidPosition, position);
}
module.debug('Calculated popup positioning values', positioning);
// tentatively place on stage
$popup
.css(positioning)
.removeClass(className.position)
.addClass(position)
.addClass(className.loading)
;
popupOffset = module.get.popupOffset();
// see if any boundaries are surpassed with this tentative position
distanceFromBoundary = module.get.distanceFromBoundary(popupOffset, calculations);
if( module.is.offstage(distanceFromBoundary, position) ) {
module.debug('Position is outside viewport', position);
if(searchDepth < settings.maxSearchDepth) {
searchDepth++;
position = module.get.nextPosition(position);
module.debug('Trying new position', position);
return ($popup)
? module.set.position(position, calculations)
: false
;
}
else {
if(settings.lastResort) {
module.debug('No position found, showing with last position');
}
else {
module.debug('Popup could not find a position to display', $popup);
module.error(error.cannotPlace, element);
module.remove.attempts();
module.remove.loading();
module.reset();
settings.onUnplaceable.call($popup, element);
return false;
}
}
}
module.debug('Position is on stage', position);
module.remove.attempts();
module.remove.loading();
if( settings.setFluidWidth && module.is.fluid() ) {
module.set.fluidWidth(calculations);
}
return true;
},
fluidWidth: function(calculations) {
calculations = calculations || module.get.calculations();
module.debug('Automatically setting element width to parent width', calculations.parent.width);
$popup.css('width', calculations.container.width);
},
variation: function(variation) {
variation = variation || module.get.variation();
if(variation && module.has.popup() ) {
module.verbose('Adding variation to popup', variation);
$popup.addClass(variation);
}
},
visible: function() {
$module.addClass(className.visible);
}
},
remove: {
loading: function() {
$popup.removeClass(className.loading);
},
variation: function(variation) {
variation = variation || module.get.variation();
if(variation) {
module.verbose('Removing variation', variation);
$popup.removeClass(variation);
}
},
visible: function() {
$module.removeClass(className.visible);
},
attempts: function() {
module.verbose('Resetting all searched positions');
searchDepth = 0;
triedPositions = false;
}
},
bind: {
events: function() {
module.debug('Binding popup events to module');
if(settings.on == 'click') {
$module
.on('click' + eventNamespace, module.toggle)
;
}
if(settings.on == 'hover' && hasTouch) {
$module
.on('touchstart' + eventNamespace, module.event.touchstart)
;
}
if( module.get.startEvent() ) {
$module
.on(module.get.startEvent() + eventNamespace, module.event.start)
.on(module.get.endEvent() + eventNamespace, module.event.end)
;
}
if(settings.target) {
module.debug('Target set to element', $target);
}
$window.on('resize' + elementNamespace, module.event.resize);
},
popup: function() {
module.verbose('Allowing hover events on popup to prevent closing');
if( $popup && module.has.popup() ) {
$popup
.on('mouseenter' + eventNamespace, module.event.start)
.on('mouseleave' + eventNamespace, module.event.end)
;
}
},
close: function() {
if(settings.hideOnScroll === true || (settings.hideOnScroll == 'auto' && settings.on != 'click')) {
$scrollContext
.one(module.get.scrollEvent() + elementNamespace, module.event.hideGracefully)
;
}
if(settings.on == 'hover' && openedWithTouch) {
module.verbose('Binding popup close event to document');
$document
.on('touchstart' + elementNamespace, function(event) {
module.verbose('Touched away from popup');
module.event.hideGracefully.call(element, event);
})
;
}
if(settings.on == 'click' && settings.closable) {
module.verbose('Binding popup close event to document');
$document
.on('click' + elementNamespace, function(event) {
module.verbose('Clicked away from popup');
module.event.hideGracefully.call(element, event);
})
;
}
}
},
unbind: {
events: function() {
$window
.off(elementNamespace)
;
$module
.off(eventNamespace)
;
},
close: function() {
$document
.off(elementNamespace)
;
$scrollContext
.off(elementNamespace)
;
},
},
has: {
popup: function() {
return ($popup && $popup.length > 0);
}
},
is: {
offstage: function(distanceFromBoundary, position) {
var
offstage = []
;
// return boundaries that have been surpassed
$.each(distanceFromBoundary, function(direction, distance) {
if(distance < -settings.jitter) {
module.debug('Position exceeds allowable distance from edge', direction, distance, position);
offstage.push(direction);
}
});
if(offstage.length > 0) {
return true;
}
else {
return false;
}
},
svg: function(element) {
return module.supports.svg() && (element instanceof SVGGraphicsElement);
},
active: function() {
return $module.hasClass(className.active);
},
animating: function() {
return ($popup !== undefined && $popup.hasClass(className.animating) );
},
fluid: function() {
return ($popup !== undefined && $popup.hasClass(className.fluid));
},
visible: function() {
return ($popup !== undefined && $popup.hasClass(className.visible));
},
dropdown: function() {
return $module.hasClass(className.dropdown);
},
hidden: function() {
return !module.is.visible();
},
rtl: function () {
return $module.css('direction') == 'rtl';
}
},
reset: function() {
module.remove.visible();
if(settings.preserve) {
if($.fn.transition !== undefined) {
$popup
.transition('remove transition')
;
}
}
else {
module.removePopup();
}
},
setting: function(name, value) {
if( $.isPlainObject(name) ) {
$.extend(true, settings, name);
}
else if(value !== undefined) {
settings[name] = value;
}
else {
return settings[name];
}
},
internal: function(name, value) {
if( $.isPlainObject(name) ) {
$.extend(true, module, name);
}
else if(value !== undefined) {
module[name] = value;
}
else {
return module[name];
}
},
debug: function() {
if(!settings.silent && settings.debug) {
if(settings.performance) {
module.performance.log(arguments);
}
else {
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
module.debug.apply(console, arguments);
}
}
},
verbose: function() {
if(!settings.silent && settings.verbose && settings.debug) {
if(settings.performance) {
module.performance.log(arguments);
}
else {
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
module.verbose.apply(console, arguments);
}
}
},
error: function() {
if(!settings.silent) {
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
module.error.apply(console, arguments);
}
},
performance: {
log: function(message) {
var
currentTime,
executionTime,
previousTime
;
if(settings.performance) {
currentTime = new Date().getTime();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
performance.push({
'Name' : message[0],
'Arguments' : [].slice.call(message, 1) || '',
'Element' : element,
'Execution Time' : executionTime
});
}
clearTimeout(module.performance.timer);
module.performance.timer = setTimeout(module.performance.display, 500);
},
display: function() {
var
title = settings.name + ':',
totalTime = 0
;
time = false;
clearTimeout(module.performance.timer);
$.each(performance, function(index, data) {
totalTime += data['Execution Time'];
});
title += ' ' + totalTime + 'ms';
if(moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
console.groupCollapsed(title);
if(console.table) {
console.table(performance);
}
else {
$.each(performance, function(index, data) {
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
});
}
console.groupEnd();
}
performance = [];
}
},
invoke: function(query, passedArguments, context) {
var
object = instance,
maxDepth,
found,
response
;
passedArguments = passedArguments || queryArguments;
context = element || context;
if(typeof query == 'string' && object !== undefined) {
query = query.split(/[\. ]/);
maxDepth = query.length - 1;
$.each(query, function(depth, value) {
var camelCaseValue = (depth != maxDepth)
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
object = object[camelCaseValue];
}
else if( object[camelCaseValue] !== undefined ) {
found = object[camelCaseValue];
return false;
}
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
object = object[value];
}
else if( object[value] !== undefined ) {
found = object[value];
return false;
}
else {
return false;
}
});
}
if ( $.isFunction( found ) ) {
response = found.apply(context, passedArguments);
}
else if(found !== undefined) {
response = found;
}
if($.isArray(returnedValue)) {
returnedValue.push(response);
}
else if(returnedValue !== undefined) {
returnedValue = [returnedValue, response];
}
else if(response !== undefined) {
returnedValue = response;
}
return found;
}
};
if(methodInvoked) {
if(instance === undefined) {
module.initialize();
}
module.invoke(query);
}
else {
if(instance !== undefined) {
instance.invoke('destroy');
}
module.initialize();
}
})
;
return (returnedValue !== undefined)
? returnedValue
: this
;
};
$.fn.popup.settings = {
name : 'Popup',
// module settings
silent : false,
debug : false,
verbose : false,
performance : true,
namespace : 'popup',
// whether it should use dom mutation observers
observeChanges : true,
// callback only when element added to dom
onCreate : function(){},
// callback before element removed from dom
onRemove : function(){},
// callback before show animation
onShow : function(){},
// callback after show animation
onVisible : function(){},
// callback before hide animation
onHide : function(){},
// callback when popup cannot be positioned in visible screen
onUnplaceable : function(){},
// callback after hide animation
onHidden : function(){},
// when to show popup
on : 'hover',
// element to use to determine if popup is out of boundary
boundary : window,
// whether to add touchstart events when using hover
addTouchEvents : true,
// default position relative to element
position : 'top left',
// name of variation to use
variation : '',
// whether popup should be moved to context
movePopup : true,
// element which popup should be relative to
target : false,
// jq selector or element that should be used as popup
popup : false,
// popup should remain inline next to activator
inline : false,
// popup should be removed from page on hide
preserve : false,
// popup should not close when being hovered on
hoverable : false,
// explicitly set content
content : false,
// explicitly set html
html : false,
// explicitly set title
title : false,
// whether automatically close on clickaway when on click
closable : true,
// automatically hide on scroll
hideOnScroll : 'auto',
// hide other popups on show
exclusive : false,
// context to attach popups
context : 'body',
// context for binding scroll events
scrollContext : window,
// position to prefer when calculating new position
prefer : 'opposite',
// specify position to appear even if it doesn't fit
lastResort : false,
// delay used to prevent accidental refiring of animations due to user error
delay : {
show : 50,
hide : 70
},
// whether fluid variation should assign width explicitly
setFluidWidth : true,
// transition settings
duration : 200,
transition : 'scale',
// distance away from activating element in px
distanceAway : 0,
// number of pixels an element is allowed to be "offstage" for a position to be chosen (allows for rounding)
jitter : 2,
// offset on aligning axis from calculated position
offset : 0,
// maximum times to look for a position before failing (9 positions total)
maxSearchDepth : 15,
error: {
invalidPosition : 'The position you specified is not a valid position',
cannotPlace : 'Popup does not fit within the boundaries of the viewport',
method : 'The method you called is not defined.',
noTransition : 'This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>',
notFound : 'The target or popup you specified does not exist on the page'
},
metadata: {
activator : 'activator',
content : 'content',
html : 'html',
offset : 'offset',
position : 'position',
title : 'title',
variation : 'variation'
},
className : {
active : 'active',
animating : 'animating',
dropdown : 'dropdown',
fluid : 'fluid',
loading : 'loading',
popup : 'ui popup',
position : 'top left center bottom right',
visible : 'visible'
},
selector : {
popup : '.ui.popup'
},
templates: {
escape: function(string) {
var
badChars = /[&<>"'`]/g,
shouldEscape = /[&<>"'`]/,
escape = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'",
"`": "`"
},
escapedChar = function(chr) {
return escape[chr];
}
;
if(shouldEscape.test(string)) {
return string.replace(badChars, escapedChar);
}
return string;
},
popup: function(text) {
var
html = '',
escape = $.fn.popup.settings.templates.escape
;
if(typeof text !== undefined) {
if(typeof text.title !== undefined && text.title) {
text.title = escape(text.title);
html += '<div class="header">' + text.title + '</div>';
}
if(typeof text.content !== undefined && text.content) {
text.content = escape(text.content);
html += '<div class="content">' + text.content + '</div>';
}
}
return html;
}
}
};
})( jQuery, window, document );
|
/*!
* json-schema-faker library v0.3.0
* http://json-schema-faker.js.org
* @preserve
*
* Copyright (c) 2014-2016 Alvaro Cabrera & Tomasz Ducin
* Released under the MIT license
*
* Date: 2016-04-07 15:47:55.094Z
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsf = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var FormatRegistry = require('../class/FormatRegistry');
// instantiate
var registry = new FormatRegistry();
/**
* Custom formats API
*
* @see https://github.com/json-schema-faker/json-schema-faker#custom-formats
* @param name
* @param callback
* @returns {any}
*/
function formatAPI(name, callback) {
if (callback) {
registry.register(name, callback);
}
else if (typeof name === 'object') {
registry.registerMany(name);
}
else if (name) {
return registry.get(name);
}
else {
return registry.list();
}
}
module.exports = formatAPI;
},{"../class/FormatRegistry":3}],2:[function(require,module,exports){
var randexp = require('randexp');
/**
* Container is used to wrap external libraries (faker, chance, randexp) that are used among the whole codebase. These
* libraries might be configured, customized, etc. and each internal JSF module needs to access those instances instead
* of pure npm module instances. This class supports consistent access to these instances.
*/
var Container = (function () {
function Container() {
// static requires - handle both initial dependency load (deps will be available
// among other modules) as well as they will be included by browserify AST
this.registry = {
faker: null,
chance: null,
// randexp is required for "pattern" values
randexp: randexp
};
}
/**
* Override dependency given by name
* @param name
* @param callback
*/
Container.prototype.extend = function (name, callback) {
if (typeof this.registry[name] === 'undefined') {
throw new ReferenceError('"' + name + '" dependency is not allowed.');
}
this.registry[name] = callback(this.registry[name]);
};
/**
* Returns dependency given by name
* @param name
* @returns {Dependency}
*/
Container.prototype.get = function (name) {
if (typeof this.registry[name] === 'undefined') {
throw new ReferenceError('"' + name + '" dependency doesn\'t exist.');
}
else if (name === 'randexp') {
return this.registry['randexp'].randexp;
}
return this.registry[name];
};
/**
* Returns all dependencies
*
* @returns {Registry}
*/
Container.prototype.getAll = function () {
return {
faker: this.get('faker'),
chance: this.get('chance'),
randexp: this.get('randexp')
};
};
return Container;
})();
// TODO move instantiation somewhere else (out from class file)
// instantiate
var container = new Container();
module.exports = container;
},{"randexp":173}],3:[function(require,module,exports){
/**
* This class defines a registry for custom formats used within JSF.
*/
var FormatRegistry = (function () {
function FormatRegistry() {
// empty by default
this.registry = {};
}
/**
* Registers custom format
*/
FormatRegistry.prototype.register = function (name, callback) {
this.registry[name] = callback;
};
/**
* Register many formats at one shot
*/
FormatRegistry.prototype.registerMany = function (formats) {
for (var name in formats) {
this.registry[name] = formats[name];
}
};
/**
* Returns element by registry key
*/
FormatRegistry.prototype.get = function (name) {
var format = this.registry[name];
if (typeof format !== 'function') {
throw new Error('unknown format generator ' + JSON.stringify(name));
}
return format;
};
/**
* Returns the whole registry content
*/
FormatRegistry.prototype.list = function () {
return this.registry;
};
return FormatRegistry;
})();
module.exports = FormatRegistry;
},{}],4:[function(require,module,exports){
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var ParseError = (function (_super) {
__extends(ParseError, _super);
function ParseError(message, path) {
_super.call(this);
this.path = path;
Error.captureStackTrace(this, this.constructor);
this.name = 'ParseError';
this.message = message;
this.path = path;
}
return ParseError;
})(Error);
module.exports = ParseError;
},{}],5:[function(require,module,exports){
var inferredProperties = {
array: [
'additionalItems',
'items',
'maxItems',
'minItems',
'uniqueItems'
],
integer: [
'exclusiveMaximum',
'exclusiveMinimum',
'maximum',
'minimum',
'multipleOf'
],
object: [
'additionalProperties',
'dependencies',
'maxProperties',
'minProperties',
'patternProperties',
'properties',
'required'
],
string: [
'maxLength',
'minLength',
'pattern'
]
};
inferredProperties.number = inferredProperties.integer;
var subschemaProperties = [
'additionalItems',
'items',
'additionalProperties',
'dependencies',
'patternProperties',
'properties'
];
/**
* Iterates through all keys of `obj` and:
* - checks whether those keys match properties of a given inferred type
* - makes sure that `obj` is not a subschema; _Do not attempt to infer properties named as subschema containers. The
* reason for this is that any property name within those containers that matches one of the properties used for
* inferring missing type values causes the container itself to get processed which leads to invalid output. (Issue 62)_
*
* @returns {boolean}
*/
function matchesType(obj, lastElementInPath, inferredTypeProperties) {
return Object.keys(obj).filter(function (prop) {
var isSubschema = subschemaProperties.indexOf(lastElementInPath) > -1, inferredPropertyFound = inferredTypeProperties.indexOf(prop) > -1;
if (inferredPropertyFound && !isSubschema) {
return true;
}
}).length > 0;
}
/**
* Checks whether given `obj` type might be inferred. The mechanism iterates through all inferred types definitions,
* tries to match allowed properties with properties of given `obj`. Returns type name, if inferred, or null.
*
* @returns {string|null}
*/
function inferType(obj, schemaPath) {
for (var typeName in inferredProperties) {
var lastElementInPath = schemaPath[schemaPath.length - 1];
if (matchesType(obj, lastElementInPath, inferredProperties[typeName])) {
return typeName;
}
}
}
module.exports = inferType;
},{}],6:[function(require,module,exports){
/// <reference path="../index.d.ts" />
/**
* Returns random element of a collection
*
* @param collection
* @returns {T}
*/
function pick(collection) {
return collection[Math.floor(Math.random() * collection.length)];
}
/**
* Returns shuffled collection of elements
*
* @param collection
* @returns {T[]}
*/
function shuffle(collection) {
var copy = collection.slice(), length = collection.length;
for (; length > 0;) {
var key = Math.floor(Math.random() * length), tmp = copy[--length];
copy[length] = copy[key];
copy[key] = tmp;
}
return copy;
}
/**
* These values determine default range for random.number function
*
* @type {number}
*/
var MIN_NUMBER = -100, MAX_NUMBER = 100;
/**
* Generates random number according to parameters passed
*
* @param min
* @param max
* @param defMin
* @param defMax
* @param hasPrecision
* @returns {number}
*/
function number(min, max, defMin, defMax, hasPrecision) {
if (hasPrecision === void 0) { hasPrecision = false; }
defMin = typeof defMin === 'undefined' ? MIN_NUMBER : defMin;
defMax = typeof defMax === 'undefined' ? MAX_NUMBER : defMax;
min = typeof min === 'undefined' ? defMin : min;
max = typeof max === 'undefined' ? defMax : max;
if (max < min) {
max += min;
}
var result = Math.random() * (max - min) + min;
if (!hasPrecision) {
return parseInt(result + '', 10);
}
return result;
}
module.exports = {
pick: pick,
shuffle: shuffle,
number: number
};
},{}],7:[function(require,module,exports){
var deref = require('deref');
var traverse = require('./traverse');
var random = require('./random');
var utils = require('./utils');
function isKey(prop) {
return prop === 'enum' || prop === 'required' || prop === 'definitions';
}
// TODO provide types
function run(schema, refs, ex) {
var $ = deref();
try {
var seen = {};
return traverse($(schema, refs, ex), [], function reduce(sub) {
if (seen[sub.$ref] <= 0) {
delete sub.$ref;
delete sub.oneOf;
delete sub.anyOf;
delete sub.allOf;
return sub;
}
if (typeof sub.$ref === 'string') {
var id = sub.$ref;
delete sub.$ref;
if (!seen[id]) {
// TODO: this should be configurable
seen[id] = random.number(1, 5);
}
seen[id] -= 1;
utils.merge(sub, $.util.findByRef(id, $.refs));
}
if (Array.isArray(sub.allOf)) {
var schemas = sub.allOf;
delete sub.allOf;
// this is the only case where all sub-schemas
// must be resolved before any merge
schemas.forEach(function (schema) {
utils.merge(sub, reduce(schema));
});
}
if (Array.isArray(sub.oneOf || sub.anyOf)) {
var mix = sub.oneOf || sub.anyOf;
delete sub.anyOf;
delete sub.oneOf;
utils.merge(sub, random.pick(mix));
}
for (var prop in sub) {
if ((Array.isArray(sub[prop]) || typeof sub[prop] === 'object') && !isKey(prop)) {
sub[prop] = reduce(sub[prop]);
}
}
return sub;
});
}
catch (e) {
if (e.path) {
throw new Error(e.message + ' in ' + '/' + e.path.join('/'));
}
else {
throw e;
}
}
}
module.exports = run;
},{"./random":6,"./traverse":8,"./utils":9,"deref":27}],8:[function(require,module,exports){
var random = require('./random');
var ParseError = require('./error');
var inferType = require('./infer');
var types = require('../types/index');
// TODO provide types
function traverse(schema, path, resolve) {
resolve(schema);
if (Array.isArray(schema.enum)) {
return random.pick(schema.enum);
}
// TODO remove the ugly overcome
var type = schema.type;
if (Array.isArray(type)) {
type = random.pick(type);
}
else if (typeof type === 'undefined') {
// Attempt to infer the type
type = inferType(schema, path) || type;
}
if (schema.faker || schema.chance) {
type = 'external';
}
if (typeof type === 'string') {
if (!types[type]) {
throw new ParseError('unknown primitive ' + JSON.stringify(type), path.concat(['type']));
}
try {
return types[type](schema, path, resolve, traverse);
}
catch (e) {
if (typeof e.path === 'undefined') {
throw new ParseError(e.message, path);
}
throw e;
}
}
var copy = {};
if (Array.isArray(schema)) {
copy = [];
}
for (var prop in schema) {
if (typeof schema[prop] === 'object' && prop !== 'definitions') {
copy[prop] = traverse(schema[prop], path.concat([prop]), resolve);
}
else {
copy[prop] = schema[prop];
}
}
return copy;
}
module.exports = traverse;
},{"../types/index":21,"./error":4,"./infer":5,"./random":6}],9:[function(require,module,exports){
function getSubAttribute(obj, dotSeparatedKey) {
var keyElements = dotSeparatedKey.split('.');
while (keyElements.length) {
var prop = keyElements.shift();
if (!obj[prop]) {
break;
}
obj = obj[prop];
}
return obj;
}
/**
* Returns true/false whether the object parameter has its own properties defined
*
* @param obj
* @returns {boolean}
*/
function hasProperties(obj) {
var properties = [];
for (var _i = 1; _i < arguments.length; _i++) {
properties[_i - 1] = arguments[_i];
}
return properties.filter(function (key) {
return typeof obj[key] !== 'undefined';
}).length > 0;
}
function clone(arr) {
var out = [];
arr.forEach(function (item, index) {
if (typeof item === 'object' && item !== null) {
out[index] = Array.isArray(item) ? clone(item) : merge({}, item);
}
else {
out[index] = item;
}
});
return out;
}
// TODO refactor merge function
function merge(a, b) {
for (var key in b) {
if (typeof b[key] !== 'object' || b[key] === null) {
a[key] = b[key];
}
else if (Array.isArray(b[key])) {
a[key] = (a[key] || []).concat(clone(b[key]));
}
else if (typeof a[key] !== 'object' || a[key] === null || Array.isArray(a[key])) {
a[key] = merge({}, b[key]);
}
else {
a[key] = merge(a[key], b[key]);
}
}
return a;
}
module.exports = {
getSubAttribute: getSubAttribute,
hasProperties: hasProperties,
clone: clone,
merge: merge
};
},{}],10:[function(require,module,exports){
/**
* Generates randomized boolean value.
*
* @returns {boolean}
*/
function booleanGenerator() {
return Math.random() > 0.5;
}
module.exports = booleanGenerator;
},{}],11:[function(require,module,exports){
var container = require('../class/Container');
var randexp = container.get('randexp');
var regexps = {
email: '[a-zA-Z\\d][a-zA-Z\\d-]{1,13}[a-zA-Z\\d]@{hostname}',
hostname: '[a-zA-Z]{1,33}\\.[a-z]{2,4}',
ipv6: '[a-f\\d]{4}(:[a-f\\d]{4}){7}',
uri: '[a-zA-Z][a-zA-Z0-9+-.]*'
};
/**
* Generates randomized string basing on a built-in regex format
*
* @param coreFormat
* @returns {string}
*/
function coreFormatGenerator(coreFormat) {
return randexp(regexps[coreFormat]).replace(/\{(\w+)\}/, function (match, key) {
return randexp(regexps[key]);
});
}
module.exports = coreFormatGenerator;
},{"../class/Container":2}],12:[function(require,module,exports){
var random = require('../core/random');
/**
* Generates randomized date time ISO format string.
*
* @returns {string}
*/
function dateTimeGenerator() {
return new Date(random.number(0, 100000000000000)).toISOString();
}
module.exports = dateTimeGenerator;
},{"../core/random":6}],13:[function(require,module,exports){
var random = require('../core/random');
/**
* Generates randomized ipv4 address.
*
* @returns {string}
*/
function ipv4Generator() {
return [0, 0, 0, 0].map(function () {
return random.number(0, 255);
}).join('.');
}
module.exports = ipv4Generator;
},{"../core/random":6}],14:[function(require,module,exports){
/**
* Generates null value.
*
* @returns {null}
*/
function nullGenerator() {
return null;
}
module.exports = nullGenerator;
},{}],15:[function(require,module,exports){
var words = require('../generators/words');
var random = require('../core/random');
function produce() {
return words().join(' ');
}
/**
* Generates randomized concatenated string based on words generator.
*
* @returns {string}
*/
function thunkGenerator(min, max) {
if (min === void 0) { min = 0; }
if (max === void 0) { max = 140; }
var min = Math.max(0, min), max = random.number(min, max), sample = produce();
while (sample.length < min) {
sample += produce();
}
if (sample.length > max) {
sample = sample.substr(0, max);
}
return sample;
}
module.exports = thunkGenerator;
},{"../core/random":6,"../generators/words":16}],16:[function(require,module,exports){
var random = require('../core/random');
var LIPSUM_WORDS = ('Lorem ipsum dolor sit amet consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore'
+ ' et dolore magna aliqua Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea'
+ ' commodo consequat Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla'
+ ' pariatur Excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt mollit anim id est'
+ ' laborum').split(' ');
/**
* Generates randomized array of single lorem ipsum words.
*
* @param min
* @param max
* @returns {Array.<string>}
*/
function wordsGenerator(min, max) {
if (min === void 0) { min = 1; }
if (max === void 0) { max = 5; }
var words = random.shuffle(LIPSUM_WORDS), length = random.number(min, Math.min(LIPSUM_WORDS.length, max));
return words.slice(0, length);
}
module.exports = wordsGenerator;
},{"../core/random":6}],17:[function(require,module,exports){
var container = require('./class/Container');
var format = require('./api/format');
var run = require('./core/run');
var jsf = function (schema, refs) {
return run(schema, refs);
};
jsf.format = format;
// returns itself for chaining
jsf.extend = function (name, cb) {
container.extend(name, cb);
return jsf;
};
module.exports = jsf;
},{"./api/format":1,"./class/Container":2,"./core/run":7}],18:[function(require,module,exports){
var random = require('../core/random');
var utils = require('../core/utils');
var ParseError = require('../core/error');
// TODO provide types
function unique(path, items, value, sample, resolve, traverseCallback) {
var tmp = [], seen = [];
function walk(obj) {
var json = JSON.stringify(obj);
if (seen.indexOf(json) === -1) {
seen.push(json);
tmp.push(obj);
}
}
items.forEach(walk);
// TODO: find a better solution?
var limit = 100;
while (tmp.length !== items.length) {
walk(traverseCallback(value.items || sample, path, resolve));
if (!limit--) {
break;
}
}
return tmp;
}
// TODO provide types
function arrayType(value, path, resolve, traverseCallback) {
var items = [];
if (!(value.items || value.additionalItems)) {
if (utils.hasProperties(value, 'minItems', 'maxItems', 'uniqueItems')) {
throw new ParseError('missing items for ' + JSON.stringify(value), path);
}
return items;
}
if (Array.isArray(value.items)) {
return Array.prototype.concat.apply(items, value.items.map(function (item, key) {
return traverseCallback(item, path.concat(['items', key]), resolve);
}));
}
var length = random.number(value.minItems, value.maxItems, 1, 5), sample = typeof value.additionalItems === 'object' ? value.additionalItems : {};
for (var current = items.length; current < length; current += 1) {
items.push(traverseCallback(value.items || sample, path.concat(['items', current]), resolve));
}
if (value.uniqueItems) {
return unique(path.concat(['items']), items, value, sample, resolve, traverseCallback);
}
return items;
}
module.exports = arrayType;
},{"../core/error":4,"../core/random":6,"../core/utils":9}],19:[function(require,module,exports){
var booleanGenerator = require('../generators/boolean');
var booleanType = booleanGenerator;
module.exports = booleanType;
},{"../generators/boolean":10}],20:[function(require,module,exports){
var utils = require('../core/utils');
var container = require('../class/Container');
function externalType(value) {
var libraryName = value.faker ? 'faker' : 'chance', libraryModule = value.faker ? container.get('faker') : container.get('chance'), key = value.faker || value.chance, path = key, args = [];
if (typeof path === 'object') {
path = Object.keys(path)[0];
if (Array.isArray(key[path])) {
args = key[path];
}
else {
args.push(key[path]);
}
}
var genFunction = utils.getSubAttribute(libraryModule, path);
if (typeof genFunction !== 'function') {
throw new Error('unknown ' + libraryName + '-generator for ' + JSON.stringify(key));
}
// see #116, #117 - faker.js 3.1.0 introduced local dependencies between generators
// making jsf break after upgrading from 3.0.1
var contextObject = libraryModule;
if (libraryName === 'faker') {
var fakerModuleName = path.split('.')[0];
contextObject = libraryModule[fakerModuleName];
}
return genFunction.apply(contextObject, args);
}
module.exports = externalType;
},{"../class/Container":2,"../core/utils":9}],21:[function(require,module,exports){
var _boolean = require('./boolean');
var _null = require('./null');
var _array = require('./array');
var _integer = require('./integer');
var _number = require('./number');
var _object = require('./object');
var _string = require('./string');
var _external = require('./external');
var typeMap = {
boolean: _boolean,
null: _null,
array: _array,
integer: _integer,
number: _number,
object: _object,
string: _string,
external: _external
};
module.exports = typeMap;
},{"./array":18,"./boolean":19,"./external":20,"./integer":22,"./null":23,"./number":24,"./object":25,"./string":26}],22:[function(require,module,exports){
var number = require('./number');
// The `integer` type is just a wrapper for the `number` type. The `number` type
// returns floating point numbers, and `integer` type truncates the fraction
// part, leaving the result as an integer.
function integerType(value) {
var generated = number(value);
// whether the generated number is positive or negative, need to use either
// floor (positive) or ceil (negative) function to get rid of the fraction
return generated > 0 ? Math.floor(generated) : Math.ceil(generated);
}
module.exports = integerType;
},{"./number":24}],23:[function(require,module,exports){
var nullGenerator = require('../generators/null');
var nullType = nullGenerator;
module.exports = nullType;
},{"../generators/null":14}],24:[function(require,module,exports){
var random = require('../core/random');
var MIN_INTEGER = -100000000, MAX_INTEGER = 100000000;
function numberType(value) {
var multipleOf = value.multipleOf;
var min = typeof value.minimum === 'undefined' ? MIN_INTEGER : value.minimum, max = typeof value.maximum === 'undefined' ? MAX_INTEGER : value.maximum;
if (multipleOf) {
max = Math.floor(max / multipleOf) * multipleOf;
min = Math.ceil(min / multipleOf) * multipleOf;
}
if (value.exclusiveMinimum && value.minimum && min === value.minimum) {
min += multipleOf || 1;
}
if (value.exclusiveMaximum && value.maximum && max === value.maximum) {
max -= multipleOf || 1;
}
if (multipleOf) {
return Math.floor(random.number(min, max) / multipleOf) * multipleOf;
}
if (min > max) {
return NaN;
}
return random.number(min, max, undefined, undefined, true);
}
module.exports = numberType;
},{"../core/random":6}],25:[function(require,module,exports){
var container = require('../class/Container');
var random = require('../core/random');
var words = require('../generators/words');
var utils = require('../core/utils');
var ParseError = require('../core/error');
var randexp = container.get('randexp');
// TODO provide types
function objectType(value, path, resolve, traverseCallback) {
var props = {};
if (!(value.properties || value.patternProperties || value.additionalProperties)) {
if (utils.hasProperties(value, 'minProperties', 'maxProperties', 'dependencies', 'required')) {
throw new ParseError('missing properties for ' + JSON.stringify(value), path);
}
return props;
}
var reqProps = value.required || [], allProps = value.properties ? Object.keys(value.properties) : [];
reqProps.forEach(function (key) {
if (value.properties && value.properties[key]) {
props[key] = value.properties[key];
}
});
var optProps = allProps.filter(function (prop) {
return reqProps.indexOf(prop) === -1;
});
if (value.patternProperties) {
optProps = Array.prototype.concat.apply(optProps, Object.keys(value.patternProperties));
}
var length = random.number(value.minProperties, value.maxProperties, 0, optProps.length);
random.shuffle(optProps).slice(0, length).forEach(function (key) {
if (value.properties && value.properties[key]) {
props[key] = value.properties[key];
}
else {
props[randexp(key)] = value.patternProperties[key];
}
});
var current = Object.keys(props).length, sample = typeof value.additionalProperties === 'object' ? value.additionalProperties : {};
if (current < length) {
words(length - current).forEach(function (key) {
props[key + randexp('[a-f\\d]{4,7}')] = sample;
});
}
return traverseCallback(props, path.concat(['properties']), resolve);
}
module.exports = objectType;
},{"../class/Container":2,"../core/error":4,"../core/random":6,"../core/utils":9,"../generators/words":16}],26:[function(require,module,exports){
var thunk = require('../generators/thunk');
var ipv4 = require('../generators/ipv4');
var dateTime = require('../generators/dateTime');
var coreFormat = require('../generators/coreFormat');
var format = require('../api/format');
var container = require('../class/Container');
var randexp = container.get('randexp');
function generateFormat(value) {
switch (value.format) {
case 'date-time':
return dateTime();
case 'ipv4':
return ipv4();
case 'regex':
// TODO: discuss
return '.+?';
case 'email':
case 'hostname':
case 'ipv6':
case 'uri':
return coreFormat(value.format);
default:
var callback = format(value.format);
return callback(container.getAll(), value);
}
}
function stringType(value) {
if (value.format) {
return generateFormat(value);
}
else if (value.pattern) {
return randexp(value.pattern);
}
else {
return thunk(value.minLength, value.maxLength);
}
}
module.exports = stringType;
},{"../api/format":1,"../class/Container":2,"../generators/coreFormat":11,"../generators/dateTime":12,"../generators/ipv4":13,"../generators/thunk":15}],27:[function(require,module,exports){
'use strict';
var $ = require('./util/uri-helpers');
$.findByRef = require('./util/find-reference');
$.resolveSchema = require('./util/resolve-schema');
$.normalizeSchema = require('./util/normalize-schema');
var instance = module.exports = function() {
function $ref(fakeroot, schema, refs, ex) {
if (typeof fakeroot === 'object') {
ex = refs;
refs = schema;
schema = fakeroot;
fakeroot = undefined;
}
if (typeof schema !== 'object') {
throw new Error('schema must be an object');
}
if (typeof refs === 'object' && refs !== null) {
var aux = refs;
refs = [];
for (var k in aux) {
aux[k].id = aux[k].id || k;
refs.push(aux[k]);
}
}
if (typeof refs !== 'undefined' && !Array.isArray(refs)) {
ex = !!refs;
refs = [];
}
function push(ref) {
if (typeof ref.id === 'string') {
var id = $.resolveURL(fakeroot, ref.id).replace(/\/#?$/, '');
if (id.indexOf('#') > -1) {
var parts = id.split('#');
if (parts[1].charAt() === '/') {
id = parts[0];
} else {
id = parts[1] || parts[0];
}
}
if (!$ref.refs[id]) {
$ref.refs[id] = ref;
}
}
}
(refs || []).concat([schema]).forEach(function(ref) {
schema = $.normalizeSchema(fakeroot, ref, push);
push(schema);
});
return $.resolveSchema(schema, $ref.refs, ex);
}
$ref.refs = {};
$ref.util = $;
return $ref;
};
instance.util = $;
},{"./util/find-reference":29,"./util/normalize-schema":30,"./util/resolve-schema":31,"./util/uri-helpers":32}],28:[function(require,module,exports){
'use strict';
var clone = module.exports = function(obj, seen) {
seen = seen || [];
if (seen.indexOf(obj) > -1) {
throw new Error('unable dereference circular structures');
}
if (!obj || typeof obj !== 'object') {
return obj;
}
seen = seen.concat([obj]);
var target = Array.isArray(obj) ? [] : {};
function copy(key, value) {
target[key] = clone(value, seen);
}
if (Array.isArray(target)) {
obj.forEach(function(value, key) {
copy(key, value);
});
} else if (Object.prototype.toString.call(obj) === '[object Object]') {
Object.keys(obj).forEach(function(key) {
copy(key, obj[key]);
});
}
return target;
};
},{}],29:[function(require,module,exports){
'use strict';
var $ = require('./uri-helpers');
function get(obj, path) {
var hash = path.split('#')[1];
var parts = hash.split('/').slice(1);
while (parts.length) {
var key = decodeURIComponent(parts.shift()).replace(/~1/g, '/').replace(/~0/g, '~');
if (typeof obj[key] === 'undefined') {
throw new Error('JSON pointer not found: ' + path);
}
obj = obj[key];
}
return obj;
}
var find = module.exports = function(id, refs) {
var target = refs[id] || refs[id.split('#')[1]] || refs[$.getDocumentURI(id)];
if (target) {
target = id.indexOf('#/') > -1 ? get(target, id) : target;
} else {
for (var key in refs) {
if ($.resolveURL(refs[key].id, id) === refs[key].id) {
target = refs[key];
break;
}
}
}
if (!target) {
throw new Error('Reference not found: ' + id);
}
while (target.$ref) {
target = find(target.$ref, refs);
}
return target;
};
},{"./uri-helpers":32}],30:[function(require,module,exports){
'use strict';
var $ = require('./uri-helpers');
var cloneObj = require('./clone-obj');
var SCHEMA_URI = [
'http://json-schema.org/schema#',
'http://json-schema.org/draft-04/schema#'
];
function expand(obj, parent, callback) {
if (obj) {
var id = typeof obj.id === 'string' ? obj.id : '#';
if (!$.isURL(id)) {
id = $.resolveURL(parent === id ? null : parent, id);
}
if (typeof obj.$ref === 'string' && !$.isURL(obj.$ref)) {
obj.$ref = $.resolveURL(id, obj.$ref);
}
if (typeof obj.id === 'string') {
obj.id = parent = id;
}
}
for (var key in obj) {
var value = obj[key];
if (typeof value === 'object' && !(key === 'enum' || key === 'required')) {
expand(value, parent, callback);
}
}
if (typeof callback === 'function') {
callback(obj);
}
}
module.exports = function(fakeroot, schema, push) {
if (typeof fakeroot === 'object') {
push = schema;
schema = fakeroot;
fakeroot = null;
}
var base = fakeroot || '',
copy = cloneObj(schema);
if (copy.$schema && SCHEMA_URI.indexOf(copy.$schema) === -1) {
throw new Error('Unsupported schema version (v4 only)');
}
base = $.resolveURL(copy.$schema || SCHEMA_URI[0], base);
expand(copy, $.resolveURL(copy.id || '#', base), push);
copy.id = copy.id || base;
return copy;
};
},{"./clone-obj":28,"./uri-helpers":32}],31:[function(require,module,exports){
'use strict';
var $ = require('./uri-helpers');
var find = require('./find-reference');
var deepExtend = require('deep-extend');
function isKey(prop) {
return prop === 'enum' || prop === 'required' || prop === 'definitions';
}
function copy(obj, refs, parent, resolve) {
var target = Array.isArray(obj) ? [] : {};
if (typeof obj.$ref === 'string') {
var base = $.getDocumentURI(obj.$ref);
if (parent !== base || (resolve && obj.$ref.indexOf('#/') > -1)) {
var fixed = find(obj.$ref, refs);
deepExtend(obj, fixed);
delete obj.$ref;
delete obj.id;
}
}
for (var prop in obj) {
if (typeof obj[prop] === 'object' && !isKey(prop)) {
target[prop] = copy(obj[prop], refs, parent, resolve);
} else {
target[prop] = obj[prop];
}
}
return target;
}
module.exports = function(obj, refs, resolve) {
var fixedId = $.resolveURL(obj.$schema, obj.id),
parent = $.getDocumentURI(fixedId);
return copy(obj, refs, parent, resolve);
};
},{"./find-reference":29,"./uri-helpers":32,"deep-extend":33}],32:[function(require,module,exports){
'use strict';
// https://gist.github.com/pjt33/efb2f1134bab986113fd
function URLUtils(url, baseURL) {
// remove leading ./
url = url.replace(/^\.\//, '');
var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@]*)(?::([^:@]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
if (!m) {
throw new RangeError();
}
var href = m[0] || '';
var protocol = m[1] || '';
var username = m[2] || '';
var password = m[3] || '';
var host = m[4] || '';
var hostname = m[5] || '';
var port = m[6] || '';
var pathname = m[7] || '';
var search = m[8] || '';
var hash = m[9] || '';
if (baseURL !== undefined) {
var base = new URLUtils(baseURL);
var flag = protocol === '' && host === '' && username === '';
if (flag && pathname === '' && search === '') {
search = base.search;
}
if (flag && pathname.charAt(0) !== '/') {
pathname = (pathname !== '' ? (base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + pathname) : base.pathname);
}
// dot segments removal
var output = [];
pathname.replace(/\/?[^\/]+/g, function(p) {
if (p === '/..') {
output.pop();
} else {
output.push(p);
}
});
pathname = output.join('') || '/';
if (flag) {
port = base.port;
hostname = base.hostname;
host = base.host;
password = base.password;
username = base.username;
}
if (protocol === '') {
protocol = base.protocol;
}
href = protocol + (host !== '' ? '//' : '') + (username !== '' ? username + (password !== '' ? ':' + password : '') + '@' : '') + host + pathname + search + hash;
}
this.href = href;
this.origin = protocol + (host !== '' ? '//' + host : '');
this.protocol = protocol;
this.username = username;
this.password = password;
this.host = host;
this.hostname = hostname;
this.port = port;
this.pathname = pathname;
this.search = search;
this.hash = hash;
}
function isURL(path) {
if (typeof path === 'string' && /^\w+:\/\//.test(path)) {
return true;
}
}
function parseURI(href, base) {
return new URLUtils(href, base);
}
function resolveURL(base, href) {
base = base || 'http://json-schema.org/schema#';
href = parseURI(href, base);
base = parseURI(base);
if (base.hash && !href.hash) {
return href.href + base.hash;
}
return href.href;
}
function getDocumentURI(uri) {
return typeof uri === 'string' && uri.split('#')[0];
}
module.exports = {
isURL: isURL,
parseURI: parseURI,
resolveURL: resolveURL,
getDocumentURI: getDocumentURI
};
},{}],33:[function(require,module,exports){
/*!
* @description Recursive object extending
* @author Viacheslav Lotsmanov <[email protected]>
* @license MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2015 Viacheslav Lotsmanov
*
* 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.
*/
'use strict';
function isSpecificValue(val) {
return (
val instanceof Buffer
|| val instanceof Date
|| val instanceof RegExp
) ? true : false;
}
function cloneSpecificValue(val) {
if (val instanceof Buffer) {
var x = new Buffer(val.length);
val.copy(x);
return x;
} else if (val instanceof Date) {
return new Date(val.getTime());
} else if (val instanceof RegExp) {
return new RegExp(val);
} else {
throw new Error('Unexpected situation');
}
}
/**
* Recursive cloning array.
*/
function deepCloneArray(arr) {
var clone = [];
arr.forEach(function (item, index) {
if (typeof item === 'object' && item !== null) {
if (Array.isArray(item)) {
clone[index] = deepCloneArray(item);
} else if (isSpecificValue(item)) {
clone[index] = cloneSpecificValue(item);
} else {
clone[index] = deepExtend({}, item);
}
} else {
clone[index] = item;
}
});
return clone;
}
/**
* Extening object that entered in first argument.
*
* Returns extended object or false if have no target object or incorrect type.
*
* If you wish to clone source object (without modify it), just use empty new
* object as first argument, like this:
* deepExtend({}, yourObj_1, [yourObj_N]);
*/
var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) {
if (arguments.length < 1 || typeof arguments[0] !== 'object') {
return false;
}
if (arguments.length < 2) {
return arguments[0];
}
var target = arguments[0];
// convert arguments to array and cut off target object
var args = Array.prototype.slice.call(arguments, 1);
var val, src, clone;
args.forEach(function (obj) {
// skip argument if it is array or isn't object
if (typeof obj !== 'object' || Array.isArray(obj)) {
return;
}
Object.keys(obj).forEach(function (key) {
src = target[key]; // source value
val = obj[key]; // new value
// recursion prevention
if (val === target) {
return;
/**
* if new value isn't object then just overwrite by new value
* instead of extending.
*/
} else if (typeof val !== 'object' || val === null) {
target[key] = val;
return;
// just clone arrays (and recursive clone objects inside)
} else if (Array.isArray(val)) {
target[key] = deepCloneArray(val);
return;
// custom cloning and overwrite for specific objects
} else if (isSpecificValue(val)) {
target[key] = cloneSpecificValue(val);
return;
// overwrite by new value if source isn't object or array
} else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
target[key] = deepExtend({}, val);
return;
// source value and new value is objects both, extending...
} else {
target[key] = deepExtend(src, val);
return;
}
});
});
return target;
}
},{}],34:[function(require,module,exports){
/**
*
* @namespace faker.address
*/
function Address (faker) {
var f = faker.fake,
Helpers = faker.helpers;
/**
* Generates random zipcode from format. If format is not specified, the
* locale's zip format is used.
*
* @method faker.address.zipCode
* @param {String} format
*/
this.zipCode = function(format) {
// if zip format is not specified, use the zip format defined for the locale
if (typeof format === 'undefined') {
var localeFormat = faker.definitions.address.postcode;
if (typeof localeFormat === 'string') {
format = localeFormat;
} else {
format = faker.random.arrayElement(localeFormat);
}
}
return Helpers.replaceSymbols(format);
}
/**
* Generates a random localized city name. The format string can contain any
* method provided by faker wrapped in `{{}}`, e.g. `{{name.firstName}}` in
* order to build the city name.
*
* If no format string is provided one of the following is randomly used:
*
* * `{{address.cityPrefix}} {{name.firstName}}{{address.citySuffix}}`
* * `{{address.cityPrefix}} {{name.firstName}}`
* * `{{name.firstName}}{{address.citySuffix}}`
* * `{{name.lastName}}{{address.citySuffix}}`
*
* @method faker.address.city
* @param {String} format
*/
this.city = function (format) {
var formats = [
'{{address.cityPrefix}} {{name.firstName}}{{address.citySuffix}}',
'{{address.cityPrefix}} {{name.firstName}}',
'{{name.firstName}}{{address.citySuffix}}',
'{{name.lastName}}{{address.citySuffix}}'
];
if (typeof format !== "number") {
format = faker.random.number(formats.length - 1);
}
return f(formats[format]);
}
/**
* Return a random localized city prefix
* @method faker.address.cityPrefix
*/
this.cityPrefix = function () {
return faker.random.arrayElement(faker.definitions.address.city_prefix);
}
/**
* Return a random localized city suffix
*
* @method faker.address.citySuffix
*/
this.citySuffix = function () {
return faker.random.arrayElement(faker.definitions.address.city_suffix);
}
/**
* Returns a random localized street name
*
* @method faker.address.streetName
*/
this.streetName = function () {
var result;
var suffix = faker.address.streetSuffix();
if (suffix !== "") {
suffix = " " + suffix
}
switch (faker.random.number(1)) {
case 0:
result = faker.name.lastName() + suffix;
break;
case 1:
result = faker.name.firstName() + suffix;
break;
}
return result;
}
//
// TODO: change all these methods that accept a boolean to instead accept an options hash.
//
/**
* Returns a random localized street address
*
* @method faker.address.streetAddress
* @param {Boolean} useFullAddress
*/
this.streetAddress = function (useFullAddress) {
if (useFullAddress === undefined) { useFullAddress = false; }
var address = "";
switch (faker.random.number(2)) {
case 0:
address = Helpers.replaceSymbolWithNumber("#####") + " " + faker.address.streetName();
break;
case 1:
address = Helpers.replaceSymbolWithNumber("####") + " " + faker.address.streetName();
break;
case 2:
address = Helpers.replaceSymbolWithNumber("###") + " " + faker.address.streetName();
break;
}
return useFullAddress ? (address + " " + faker.address.secondaryAddress()) : address;
}
/**
* streetSuffix
*
* @method faker.address.streetSuffix
*/
this.streetSuffix = function () {
return faker.random.arrayElement(faker.definitions.address.street_suffix);
}
/**
* streetPrefix
*
* @method faker.address.streetPrefix
*/
this.streetPrefix = function () {
return faker.random.arrayElement(faker.definitions.address.street_prefix);
}
/**
* secondaryAddress
*
* @method faker.address.secondaryAddress
*/
this.secondaryAddress = function () {
return Helpers.replaceSymbolWithNumber(faker.random.arrayElement(
[
'Apt. ###',
'Suite ###'
]
));
}
/**
* county
*
* @method faker.address.county
*/
this.county = function () {
return faker.random.arrayElement(faker.definitions.address.county);
}
/**
* country
*
* @method faker.address.country
*/
this.country = function () {
return faker.random.arrayElement(faker.definitions.address.country);
}
/**
* countryCode
*
* @method faker.address.countryCode
*/
this.countryCode = function () {
return faker.random.arrayElement(faker.definitions.address.country_code);
}
/**
* state
*
* @method faker.address.state
* @param {Boolean} useAbbr
*/
this.state = function (useAbbr) {
return faker.random.arrayElement(faker.definitions.address.state);
}
/**
* stateAbbr
*
* @method faker.address.stateAbbr
*/
this.stateAbbr = function () {
return faker.random.arrayElement(faker.definitions.address.state_abbr);
}
/**
* latitude
*
* @method faker.address.latitude
*/
this.latitude = function () {
return (faker.random.number(180 * 10000) / 10000.0 - 90.0).toFixed(4);
}
/**
* longitude
*
* @method faker.address.longitude
*/
this.longitude = function () {
return (faker.random.number(360 * 10000) / 10000.0 - 180.0).toFixed(4);
}
return this;
}
module.exports = Address;
},{}],35:[function(require,module,exports){
/**
*
* @namespace faker.commerce
*/
var Commerce = function (faker) {
var self = this;
/**
* color
*
* @method faker.commerce.color
*/
self.color = function() {
return faker.random.arrayElement(faker.definitions.commerce.color);
};
/**
* department
*
* @method faker.commerce.department
* @param {number} max
* @param {number} fixedAmount
*/
self.department = function(max, fixedAmount) {
return faker.random.arrayElement(faker.definitions.commerce.department);
};
/**
* productName
*
* @method faker.commerce.productName
*/
self.productName = function() {
return faker.commerce.productAdjective() + " " +
faker.commerce.productMaterial() + " " +
faker.commerce.product();
};
/**
* price
*
* @method faker.commerce.price
* @param {number} min
* @param {number} max
* @param {number} dec
* @param {string} symbol
*/
self.price = function(min, max, dec, symbol) {
min = min || 0;
max = max || 1000;
dec = dec || 2;
symbol = symbol || '';
if(min < 0 || max < 0) {
return symbol + 0.00;
}
var randValue = faker.random.number({ max: max, min: min });
return symbol + (Math.round(randValue * Math.pow(10, dec)) / Math.pow(10, dec)).toFixed(dec);
};
/*
self.categories = function(num) {
var categories = [];
do {
var category = faker.random.arrayElement(faker.definitions.commerce.department);
if(categories.indexOf(category) === -1) {
categories.push(category);
}
} while(categories.length < num);
return categories;
};
*/
/*
self.mergeCategories = function(categories) {
var separator = faker.definitions.separator || " &";
// TODO: find undefined here
categories = categories || faker.definitions.commerce.categories;
var commaSeparated = categories.slice(0, -1).join(', ');
return [commaSeparated, categories[categories.length - 1]].join(separator + " ");
};
*/
/**
* productAdjective
*
* @method faker.commerce.productAdjective
*/
self.productAdjective = function() {
return faker.random.arrayElement(faker.definitions.commerce.product_name.adjective);
};
/**
* productMaterial
*
* @method faker.commerce.productMaterial
*/
self.productMaterial = function() {
return faker.random.arrayElement(faker.definitions.commerce.product_name.material);
};
/**
* product
*
* @method faker.commerce.product
*/
self.product = function() {
return faker.random.arrayElement(faker.definitions.commerce.product_name.product);
}
return self;
};
module['exports'] = Commerce;
},{}],36:[function(require,module,exports){
/**
*
* @namespace faker.company
*/
var Company = function (faker) {
var self = this;
var f = faker.fake;
/**
* suffixes
*
* @method faker.company.suffixes
*/
this.suffixes = function () {
// Don't want the source array exposed to modification, so return a copy
return faker.definitions.company.suffix.slice(0);
}
/**
* companyName
*
* @method faker.company.companyName
* @param {string} format
*/
this.companyName = function (format) {
var formats = [
'{{name.lastName}} {{company.companySuffix}}',
'{{name.lastName}} - {{name.lastName}}',
'{{name.lastName}}, {{name.lastName}} and {{name.lastName}}'
];
if (typeof format !== "number") {
format = faker.random.number(formats.length - 1);
}
return f(formats[format]);
}
/**
* companySuffix
*
* @method faker.company.companySuffix
*/
this.companySuffix = function () {
return faker.random.arrayElement(faker.company.suffixes());
}
/**
* catchPhrase
*
* @method faker.company.catchPhrase
*/
this.catchPhrase = function () {
return f('{{company.catchPhraseAdjective}} {{company.catchPhraseDescriptor}} {{company.catchPhraseNoun}}')
}
/**
* bs
*
* @method faker.company.bs
*/
this.bs = function () {
return f('{{company.bsAdjective}} {{company.bsBuzz}} {{company.bsNoun}}');
}
/**
* catchPhraseAdjective
*
* @method faker.company.catchPhraseAdjective
*/
this.catchPhraseAdjective = function () {
return faker.random.arrayElement(faker.definitions.company.adjective);
}
/**
* catchPhraseDescriptor
*
* @method faker.company.catchPhraseDescriptor
*/
this.catchPhraseDescriptor = function () {
return faker.random.arrayElement(faker.definitions.company.descriptor);
}
/**
* catchPhraseNoun
*
* @method faker.company.catchPhraseNoun
*/
this.catchPhraseNoun = function () {
return faker.random.arrayElement(faker.definitions.company.noun);
}
/**
* bsAdjective
*
* @method faker.company.bsAdjective
*/
this.bsAdjective = function () {
return faker.random.arrayElement(faker.definitions.company.bs_adjective);
}
/**
* bsBuzz
*
* @method faker.company.bsBuzz
*/
this.bsBuzz = function () {
return faker.random.arrayElement(faker.definitions.company.bs_verb);
}
/**
* bsNoun
*
* @method faker.company.bsNoun
*/
this.bsNoun = function () {
return faker.random.arrayElement(faker.definitions.company.bs_noun);
}
}
module['exports'] = Company;
},{}],37:[function(require,module,exports){
/**
*
* @namespace faker.date
*/
var _Date = function (faker) {
var self = this;
/**
* past
*
* @method faker.date.past
* @param {number} years
* @param {date} refDate
*/
self.past = function (years, refDate) {
var date = (refDate) ? new Date(Date.parse(refDate)) : new Date();
var range = {
min: 1000,
max: (years || 1) * 365 * 24 * 3600 * 1000
};
var past = date.getTime();
past -= faker.random.number(range); // some time from now to N years ago, in milliseconds
date.setTime(past);
return date;
};
/**
* future
*
* @method faker.date.future
* @param {number} years
* @param {date} refDate
*/
self.future = function (years, refDate) {
var date = (refDate) ? new Date(Date.parse(refDate)) : new Date();
var range = {
min: 1000,
max: (years || 1) * 365 * 24 * 3600 * 1000
};
var future = date.getTime();
future += faker.random.number(range); // some time from now to N years later, in milliseconds
date.setTime(future);
return date;
};
/**
* between
*
* @method faker.date.between
* @param {date} from
* @param {date} to
*/
self.between = function (from, to) {
var fromMilli = Date.parse(from);
var dateOffset = faker.random.number(Date.parse(to) - fromMilli);
var newDate = new Date(fromMilli + dateOffset);
return newDate;
};
/**
* recent
*
* @method faker.date.recent
* @param {number} days
*/
self.recent = function (days) {
var date = new Date();
var range = {
min: 1000,
max: (days || 1) * 24 * 3600 * 1000
};
var future = date.getTime();
future -= faker.random.number(range); // some time from now to N days ago, in milliseconds
date.setTime(future);
return date;
};
/**
* month
*
* @method faker.date.month
* @param {object} options
*/
self.month = function (options) {
options = options || {};
var type = 'wide';
if (options.abbr) {
type = 'abbr';
}
if (options.context && typeof faker.definitions.date.month[type + '_context'] !== 'undefined') {
type += '_context';
}
var source = faker.definitions.date.month[type];
return faker.random.arrayElement(source);
};
/**
* weekday
*
* @param {object} options
* @method faker.date.weekday
*/
self.weekday = function (options) {
options = options || {};
var type = 'wide';
if (options.abbr) {
type = 'abbr';
}
if (options.context && typeof faker.definitions.date.weekday[type + '_context'] !== 'undefined') {
type += '_context';
}
var source = faker.definitions.date.weekday[type];
return faker.random.arrayElement(source);
};
return self;
};
module['exports'] = _Date;
},{}],38:[function(require,module,exports){
/*
fake.js - generator method for combining faker methods based on string input
*/
function Fake (faker) {
/**
* Generator method for combining faker methods based on string input
*
* __Example:__
*
* ```
* console.log(faker.fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'));
* //outputs: "Marks, Dean Sr."
* ```
*
* This will interpolate the format string with the value of methods
* [name.lastName]{@link faker.name.lastName}, [name.firstName]{@link faker.name.firstName},
* and [name.suffix]{@link faker.name.suffix}
*
* @method faker.fake
* @param {string} str
*/
this.fake = function fake (str) {
// setup default response as empty string
var res = '';
// if incoming str parameter is not provided, return error message
if (typeof str !== 'string' || str.length === 0) {
res = 'string parameter is required!';
return res;
}
// find first matching {{ and }}
var start = str.search('{{');
var end = str.search('}}');
// if no {{ and }} is found, we are done
if (start === -1 && end === -1) {
return str;
}
// console.log('attempting to parse', str);
// extract method name from between the {{ }} that we found
// for example: {{name.firstName}}
var token = str.substr(start + 2, end - start - 2);
var method = token.replace('}}', '').replace('{{', '');
// console.log('method', method)
// extract method parameters
var regExp = /\(([^)]+)\)/;
var matches = regExp.exec(method);
var parameters = '';
if (matches) {
method = method.replace(regExp, '');
parameters = matches[1];
}
// split the method into module and function
var parts = method.split('.');
if (typeof faker[parts[0]] === "undefined") {
throw new Error('Invalid module: ' + parts[0]);
}
if (typeof faker[parts[0]][parts[1]] === "undefined") {
throw new Error('Invalid method: ' + parts[0] + "." + parts[1]);
}
// assign the function from the module.function namespace
var fn = faker[parts[0]][parts[1]];
// If parameters are populated here, they are always going to be of string type
// since we might actually be dealing with an object or array,
// we always attempt to the parse the incoming parameters into JSON
var params;
// Note: we experience a small performance hit here due to JSON.parse try / catch
// If anyone actually needs to optimize this specific code path, please open a support issue on github
try {
params = JSON.parse(parameters)
} catch (err) {
// since JSON.parse threw an error, assume parameters was actually a string
params = parameters;
}
var result;
if (typeof params === "string" && params.length === 0) {
result = fn.call(this);
} else {
result = fn.call(this, params);
}
// replace the found tag with the returned fake value
res = str.replace('{{' + token + '}}', result);
// return the response recursively until we are done finding all tags
return fake(res);
}
return this;
}
module['exports'] = Fake;
},{}],39:[function(require,module,exports){
/**
*
* @namespace faker.finance
*/
var Finance = function (faker) {
var Helpers = faker.helpers,
self = this;
/**
* account
*
* @method faker.finance.account
* @param {number} length
*/
self.account = function (length) {
length = length || 8;
var template = '';
for (var i = 0; i < length; i++) {
template = template + '#';
}
length = null;
return Helpers.replaceSymbolWithNumber(template);
}
/**
* accountName
*
* @method faker.finance.accountName
*/
self.accountName = function () {
return [Helpers.randomize(faker.definitions.finance.account_type), 'Account'].join(' ');
}
/**
* mask
*
* @method faker.finance.mask
* @param {number} length
* @param {boolean} parens
* @param {boolean} elipsis
*/
self.mask = function (length, parens, elipsis) {
//set defaults
length = (length == 0 || !length || typeof length == 'undefined') ? 4 : length;
parens = (parens === null) ? true : parens;
elipsis = (elipsis === null) ? true : elipsis;
//create a template for length
var template = '';
for (var i = 0; i < length; i++) {
template = template + '#';
}
//prefix with elipsis
template = (elipsis) ? ['...', template].join('') : template;
template = (parens) ? ['(', template, ')'].join('') : template;
//generate random numbers
template = Helpers.replaceSymbolWithNumber(template);
return template;
}
//min and max take in minimum and maximum amounts, dec is the decimal place you want rounded to, symbol is $, €, £, etc
//NOTE: this returns a string representation of the value, if you want a number use parseFloat and no symbol
/**
* amount
*
* @method faker.finance.amount
* @param {number} min
* @param {number} max
* @param {number} dec
* @param {string} symbol
*/
self.amount = function (min, max, dec, symbol) {
min = min || 0;
max = max || 1000;
dec = dec || 2;
symbol = symbol || '';
var randValue = faker.random.number({ max: max, min: min });
return symbol + (Math.round(randValue * Math.pow(10, dec)) / Math.pow(10, dec)).toFixed(dec);
}
/**
* transactionType
*
* @method faker.finance.transactionType
*/
self.transactionType = function () {
return Helpers.randomize(faker.definitions.finance.transaction_type);
}
/**
* currencyCode
*
* @method faker.finance.currencyCode
*/
self.currencyCode = function () {
return faker.random.objectElement(faker.definitions.finance.currency)['code'];
}
/**
* currencyName
*
* @method faker.finance.currencyName
*/
self.currencyName = function () {
return faker.random.objectElement(faker.definitions.finance.currency, 'key');
}
/**
* currencySymbol
*
* @method faker.finance.currencySymbol
*/
self.currencySymbol = function () {
var symbol;
while (!symbol) {
symbol = faker.random.objectElement(faker.definitions.finance.currency)['symbol'];
}
return symbol;
}
/**
* bitcoinAddress
*
* @method faker.finance.bitcoinAddress
*/
self.bitcoinAddress = function () {
var addressLength = faker.random.number({ min: 27, max: 34 });
var address = faker.random.arrayElement(['1', '3']);
for (var i = 0; i < addressLength - 1; i++)
address += faker.random.alphaNumeric().toUpperCase();
return address;
}
}
module['exports'] = Finance;
},{}],40:[function(require,module,exports){
/**
*
* @namespace faker.hacker
*/
var Hacker = function (faker) {
var self = this;
/**
* abbreviation
*
* @method faker.hacker.abbreviation
*/
self.abbreviation = function () {
return faker.random.arrayElement(faker.definitions.hacker.abbreviation);
};
/**
* adjective
*
* @method faker.hacker.adjective
*/
self.adjective = function () {
return faker.random.arrayElement(faker.definitions.hacker.adjective);
};
/**
* noun
*
* @method faker.hacker.noun
*/
self.noun = function () {
return faker.random.arrayElement(faker.definitions.hacker.noun);
};
/**
* verb
*
* @method faker.hacker.verb
*/
self.verb = function () {
return faker.random.arrayElement(faker.definitions.hacker.verb);
};
/**
* ingverb
*
* @method faker.hacker.ingverb
*/
self.ingverb = function () {
return faker.random.arrayElement(faker.definitions.hacker.ingverb);
};
/**
* phrase
*
* @method faker.hacker.phrase
*/
self.phrase = function () {
var data = {
abbreviation: self.abbreviation,
adjective: self.adjective,
ingverb: self.ingverb,
noun: self.noun,
verb: self.verb
};
var phrase = faker.random.arrayElement([ "If we {{verb}} the {{noun}}, we can get to the {{abbreviation}} {{noun}} through the {{adjective}} {{abbreviation}} {{noun}}!",
"We need to {{verb}} the {{adjective}} {{abbreviation}} {{noun}}!",
"Try to {{verb}} the {{abbreviation}} {{noun}}, maybe it will {{verb}} the {{adjective}} {{noun}}!",
"You can't {{verb}} the {{noun}} without {{ingverb}} the {{adjective}} {{abbreviation}} {{noun}}!",
"Use the {{adjective}} {{abbreviation}} {{noun}}, then you can {{verb}} the {{adjective}} {{noun}}!",
"The {{abbreviation}} {{noun}} is down, {{verb}} the {{adjective}} {{noun}} so we can {{verb}} the {{abbreviation}} {{noun}}!",
"{{ingverb}} the {{noun}} won't do anything, we need to {{verb}} the {{adjective}} {{abbreviation}} {{noun}}!",
"I'll {{verb}} the {{adjective}} {{abbreviation}} {{noun}}, that should {{noun}} the {{abbreviation}} {{noun}}!"
]);
return faker.helpers.mustache(phrase, data);
};
return self;
};
module['exports'] = Hacker;
},{}],41:[function(require,module,exports){
/**
*
* @namespace faker.helpers
*/
var Helpers = function (faker) {
var self = this;
/**
* backword-compatibility
*
* @method faker.helpers.randomize
* @param {array} array
*/
self.randomize = function (array) {
array = array || ["a", "b", "c"];
return faker.random.arrayElement(array);
};
/**
* slugifies string
*
* @method faker.helpers.slugify
* @param {string} string
*/
self.slugify = function (string) {
string = string || "";
return string.replace(/ /g, '-').replace(/[^\w\.\-]+/g, '');
};
/**
* parses string for a symbol and replace it with a random number from 1-10
*
* @method faker.helpers.replaceSymbolWithNumber
* @param {string} string
* @param {string} symbol defaults to `"#"`
*/
self.replaceSymbolWithNumber = function (string, symbol) {
string = string || "";
// default symbol is '#'
if (symbol === undefined) {
symbol = '#';
}
var str = '';
for (var i = 0; i < string.length; i++) {
if (string.charAt(i) == symbol) {
str += faker.random.number(9);
} else {
str += string.charAt(i);
}
}
return str;
};
/**
* parses string for symbols (numbers or letters) and replaces them appropriately
*
* @method faker.helpers.replaceSymbols
* @param {string} string
*/
self.replaceSymbols = function (string) {
string = string || "";
var alpha = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
var str = '';
for (var i = 0; i < string.length; i++) {
if (string.charAt(i) == "#") {
str += faker.random.number(9);
} else if (string.charAt(i) == "?") {
str += faker.random.arrayElement(alpha);
} else {
str += string.charAt(i);
}
}
return str;
};
/**
* takes an array and returns it randomized
*
* @method faker.helpers.shuffle
* @param {array} o
*/
self.shuffle = function (o) {
o = o || ["a", "b", "c"];
for (var j, x, i = o.length-1; i; j = faker.random.number(i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
};
/**
* mustache
*
* @method faker.helpers.mustache
* @param {string} str
* @param {object} data
*/
self.mustache = function (str, data) {
if (typeof str === 'undefined') {
return '';
}
for(var p in data) {
var re = new RegExp('{{' + p + '}}', 'g')
str = str.replace(re, data[p]);
}
return str;
};
/**
* createCard
*
* @method faker.helpers.createCard
*/
self.createCard = function () {
return {
"name": faker.name.findName(),
"username": faker.internet.userName(),
"email": faker.internet.email(),
"address": {
"streetA": faker.address.streetName(),
"streetB": faker.address.streetAddress(),
"streetC": faker.address.streetAddress(true),
"streetD": faker.address.secondaryAddress(),
"city": faker.address.city(),
"state": faker.address.state(),
"country": faker.address.country(),
"zipcode": faker.address.zipCode(),
"geo": {
"lat": faker.address.latitude(),
"lng": faker.address.longitude()
}
},
"phone": faker.phone.phoneNumber(),
"website": faker.internet.domainName(),
"company": {
"name": faker.company.companyName(),
"catchPhrase": faker.company.catchPhrase(),
"bs": faker.company.bs()
},
"posts": [
{
"words": faker.lorem.words(),
"sentence": faker.lorem.sentence(),
"sentences": faker.lorem.sentences(),
"paragraph": faker.lorem.paragraph()
},
{
"words": faker.lorem.words(),
"sentence": faker.lorem.sentence(),
"sentences": faker.lorem.sentences(),
"paragraph": faker.lorem.paragraph()
},
{
"words": faker.lorem.words(),
"sentence": faker.lorem.sentence(),
"sentences": faker.lorem.sentences(),
"paragraph": faker.lorem.paragraph()
}
],
"accountHistory": [faker.helpers.createTransaction(), faker.helpers.createTransaction(), faker.helpers.createTransaction()]
};
};
/**
* contextualCard
*
* @method faker.helpers.contextualCard
*/
self.contextualCard = function () {
var name = faker.name.firstName(),
userName = faker.internet.userName(name);
return {
"name": name,
"username": userName,
"avatar": faker.internet.avatar(),
"email": faker.internet.email(userName),
"dob": faker.date.past(50, new Date("Sat Sep 20 1992 21:35:02 GMT+0200 (CEST)")),
"phone": faker.phone.phoneNumber(),
"address": {
"street": faker.address.streetName(true),
"suite": faker.address.secondaryAddress(),
"city": faker.address.city(),
"zipcode": faker.address.zipCode(),
"geo": {
"lat": faker.address.latitude(),
"lng": faker.address.longitude()
}
},
"website": faker.internet.domainName(),
"company": {
"name": faker.company.companyName(),
"catchPhrase": faker.company.catchPhrase(),
"bs": faker.company.bs()
}
};
};
/**
* userCard
*
* @method faker.helpers.userCard
*/
self.userCard = function () {
return {
"name": faker.name.findName(),
"username": faker.internet.userName(),
"email": faker.internet.email(),
"address": {
"street": faker.address.streetName(true),
"suite": faker.address.secondaryAddress(),
"city": faker.address.city(),
"zipcode": faker.address.zipCode(),
"geo": {
"lat": faker.address.latitude(),
"lng": faker.address.longitude()
}
},
"phone": faker.phone.phoneNumber(),
"website": faker.internet.domainName(),
"company": {
"name": faker.company.companyName(),
"catchPhrase": faker.company.catchPhrase(),
"bs": faker.company.bs()
}
};
};
/**
* createTransaction
*
* @method faker.helpers.createTransaction
*/
self.createTransaction = function(){
return {
"amount" : faker.finance.amount(),
"date" : new Date(2012, 1, 2), //TODO: add a ranged date method
"business": faker.company.companyName(),
"name": [faker.finance.accountName(), faker.finance.mask()].join(' '),
"type" : self.randomize(faker.definitions.finance.transaction_type),
"account" : faker.finance.account()
};
};
return self;
};
/*
String.prototype.capitalize = function () { //v1.0
return this.replace(/\w+/g, function (a) {
return a.charAt(0).toUpperCase() + a.substr(1).toLowerCase();
});
};
*/
module['exports'] = Helpers;
},{}],42:[function(require,module,exports){
/**
*
* @namespace faker.image
*/
var Image = function (faker) {
var self = this;
/**
* image
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.image
*/
self.image = function (width, height, randomize) {
var categories = ["abstract", "animals", "business", "cats", "city", "food", "nightlife", "fashion", "people", "nature", "sports", "technics", "transport"];
return self[faker.random.arrayElement(categories)](width, height, randomize);
};
/**
* avatar
*
* @method faker.image.avatar
*/
self.avatar = function () {
return faker.internet.avatar();
};
/**
* imageUrl
*
* @param {number} width
* @param {number} height
* @param {string} category
* @param {boolean} randomize
* @method faker.image.imageUrl
*/
self.imageUrl = function (width, height, category, randomize) {
var width = width || 640;
var height = height || 480;
var url ='http://lorempixel.com/' + width + '/' + height;
if (typeof category !== 'undefined') {
url += '/' + category;
}
if (randomize) {
url += '?' + faker.random.number()
}
return url;
};
/**
* abstract
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.abstract
*/
self.abstract = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'abstract', randomize);
};
/**
* animals
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.animals
*/
self.animals = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'animals', randomize);
};
/**
* business
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.business
*/
self.business = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'business', randomize);
};
/**
* cats
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.cats
*/
self.cats = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'cats', randomize);
};
/**
* city
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.city
*/
self.city = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'city', randomize);
};
/**
* food
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.food
*/
self.food = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'food', randomize);
};
/**
* nightlife
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.nightlife
*/
self.nightlife = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'nightlife', randomize);
};
/**
* fashion
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.fashion
*/
self.fashion = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'fashion', randomize);
};
/**
* people
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.people
*/
self.people = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'people', randomize);
};
/**
* nature
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.nature
*/
self.nature = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'nature', randomize);
};
/**
* sports
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.sports
*/
self.sports = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'sports', randomize);
};
/**
* technics
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.technics
*/
self.technics = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'technics', randomize);
};
/**
* transport
*
* @param {number} width
* @param {number} height
* @param {boolean} randomize
* @method faker.image.transport
*/
self.transport = function (width, height, randomize) {
return faker.image.imageUrl(width, height, 'transport', randomize);
}
}
module["exports"] = Image;
},{}],43:[function(require,module,exports){
/*
this index.js file is used for including the faker library as a CommonJS module, instead of a bundle
you can include the faker library into your existing node.js application by requiring the entire /faker directory
var faker = require(./faker);
var randomName = faker.name.findName();
you can also simply include the "faker.js" file which is the auto-generated bundled version of the faker library
var faker = require(./customAppPath/faker);
var randomName = faker.name.findName();
if you plan on modifying the faker library you should be performing your changes in the /lib/ directory
*/
/**
*
* @namespace faker
*/
function Faker (opts) {
var self = this;
opts = opts || {};
// assign options
var locales = self.locales || opts.locales || {};
var locale = self.locale || opts.locale || "en";
var localeFallback = self.localeFallback || opts.localeFallback || "en";
self.locales = locales;
self.locale = locale;
self.localeFallback = localeFallback;
self.definitions = {};
var Fake = require('./fake');
self.fake = new Fake(self).fake;
var Random = require('./random');
self.random = new Random(self);
// self.random = require('./random');
var Helpers = require('./helpers');
self.helpers = new Helpers(self);
var Name = require('./name');
self.name = new Name(self);
// self.name = require('./name');
var Address = require('./address');
self.address = new Address(self);
var Company = require('./company');
self.company = new Company(self);
var Finance = require('./finance');
self.finance = new Finance(self);
var Image = require('./image');
self.image = new Image(self);
var Lorem = require('./lorem');
self.lorem = new Lorem(self);
var Hacker = require('./hacker');
self.hacker = new Hacker(self);
var Internet = require('./internet');
self.internet = new Internet(self);
var Phone = require('./phone_number');
self.phone = new Phone(self);
var _Date = require('./date');
self.date = new _Date(self);
var Commerce = require('./commerce');
self.commerce = new Commerce(self);
var System = require('./system');
self.system = new System(self);
var _definitions = {
"name": ["first_name", "last_name", "prefix", "suffix", "title", "male_first_name", "female_first_name", "male_middle_name", "female_middle_name", "male_last_name", "female_last_name"],
"address": ["city_prefix", "city_suffix", "street_suffix", "county", "country", "country_code", "state", "state_abbr", "street_prefix", "postcode"],
"company": ["adjective", "noun", "descriptor", "bs_adjective", "bs_noun", "bs_verb", "suffix"],
"lorem": ["words"],
"hacker": ["abbreviation", "adjective", "noun", "verb", "ingverb"],
"phone_number": ["formats"],
"finance": ["account_type", "transaction_type", "currency"],
"internet": ["avatar_uri", "domain_suffix", "free_email", "example_email", "password"],
"commerce": ["color", "department", "product_name", "price", "categories"],
"system": ["mimeTypes"],
"date": ["month", "weekday"],
"title": "",
"separator": ""
};
// Create a Getter for all definitions.foo.bar propetries
Object.keys(_definitions).forEach(function(d){
if (typeof self.definitions[d] === "undefined") {
self.definitions[d] = {};
}
if (typeof _definitions[d] === "string") {
self.definitions[d] = _definitions[d];
return;
}
_definitions[d].forEach(function(p){
Object.defineProperty(self.definitions[d], p, {
get: function () {
if (typeof self.locales[self.locale][d] === "undefined" || typeof self.locales[self.locale][d][p] === "undefined") {
// certain localization sets contain less data then others.
// in the case of a missing defintion, use the default localeFallback to substitute the missing set data
// throw new Error('unknown property ' + d + p)
return self.locales[localeFallback][d][p];
} else {
// return localized data
return self.locales[self.locale][d][p];
}
}
});
});
});
};
Faker.prototype.seed = function(value) {
var Random = require('./random');
this.seedValue = value;
this.random = new Random(this, this.seedValue);
}
module['exports'] = Faker;
},{"./address":34,"./commerce":35,"./company":36,"./date":37,"./fake":38,"./finance":39,"./hacker":40,"./helpers":41,"./image":42,"./internet":44,"./lorem":164,"./name":165,"./phone_number":166,"./random":167,"./system":168}],44:[function(require,module,exports){
var password_generator = require('../vendor/password-generator.js'),
random_ua = require('../vendor/user-agent');
/**
*
* @namespace faker.internet
*/
var Internet = function (faker) {
var self = this;
/**
* avatar
*
* @method faker.internet.avatar
*/
self.avatar = function () {
return faker.random.arrayElement(faker.definitions.internet.avatar_uri);
};
self.avatar.schema = {
"description": "Generates a URL for an avatar.",
"sampleResults": ["https://s3.amazonaws.com/uifaces/faces/twitter/igorgarybaldi/128.jpg"]
};
/**
* email
*
* @method faker.internet.email
* @param {string} firstName
* @param {string} lastName
* @param {string} provider
*/
self.email = function (firstName, lastName, provider) {
provider = provider || faker.random.arrayElement(faker.definitions.internet.free_email);
return faker.helpers.slugify(faker.internet.userName(firstName, lastName)) + "@" + provider;
};
self.email.schema = {
"description": "Generates a valid email address based on optional input criteria",
"sampleResults": ["[email protected]"],
"properties": {
"firstName": {
"type": "string",
"required": false,
"description": "The first name of the user"
},
"lastName": {
"type": "string",
"required": false,
"description": "The last name of the user"
},
"provider": {
"type": "string",
"required": false,
"description": "The domain of the user"
}
}
};
/**
* exampleEmail
*
* @method faker.internet.exampleEmail
* @param {string} firstName
* @param {string} lastName
*/
self.exampleEmail = function (firstName, lastName) {
var provider = faker.random.arrayElement(faker.definitions.internet.example_email);
return self.email(firstName, lastName, provider);
};
/**
* userName
*
* @method faker.internet.userName
* @param {string} firstName
* @param {string} lastName
*/
self.userName = function (firstName, lastName) {
var result;
firstName = firstName || faker.name.firstName();
lastName = lastName || faker.name.lastName();
switch (faker.random.number(2)) {
case 0:
result = firstName + faker.random.number(99);
break;
case 1:
result = firstName + faker.random.arrayElement([".", "_"]) + lastName;
break;
case 2:
result = firstName + faker.random.arrayElement([".", "_"]) + lastName + faker.random.number(99);
break;
}
result = result.toString().replace(/'/g, "");
result = result.replace(/ /g, "");
return result;
};
self.userName.schema = {
"description": "Generates a username based on one of several patterns. The pattern is chosen randomly.",
"sampleResults": [
"Kirstin39",
"Kirstin.Smith",
"Kirstin.Smith39",
"KirstinSmith",
"KirstinSmith39",
],
"properties": {
"firstName": {
"type": "string",
"required": false,
"description": "The first name of the user"
},
"lastName": {
"type": "string",
"required": false,
"description": "The last name of the user"
}
}
};
/**
* protocol
*
* @method faker.internet.protocol
*/
self.protocol = function () {
var protocols = ['http','https'];
return faker.random.arrayElement(protocols);
};
self.protocol.schema = {
"description": "Randomly generates http or https",
"sampleResults": ["https", "http"]
};
/**
* url
*
* @method faker.internet.url
*/
self.url = function () {
return faker.internet.protocol() + '://' + faker.internet.domainName();
};
self.url.schema = {
"description": "Generates a random URL. The URL could be secure or insecure.",
"sampleResults": [
"http://rashawn.name",
"https://rashawn.name"
]
};
/**
* domainName
*
* @method faker.internet.domainName
*/
self.domainName = function () {
return faker.internet.domainWord() + "." + faker.internet.domainSuffix();
};
self.domainName.schema = {
"description": "Generates a random domain name.",
"sampleResults": ["marvin.org"]
};
/**
* domainSuffix
*
* @method faker.internet.domainSuffix
*/
self.domainSuffix = function () {
return faker.random.arrayElement(faker.definitions.internet.domain_suffix);
};
self.domainSuffix.schema = {
"description": "Generates a random domain suffix.",
"sampleResults": ["net"]
};
/**
* domainWord
*
* @method faker.internet.domainWord
*/
self.domainWord = function () {
return faker.name.firstName().replace(/([\\~#&*{}/:<>?|\"'])/ig, '').toLowerCase();
};
self.domainWord.schema = {
"description": "Generates a random domain word.",
"sampleResults": ["alyce"]
};
/**
* ip
*
* @method faker.internet.ip
*/
self.ip = function () {
var randNum = function () {
return (faker.random.number(255)).toFixed(0);
};
var result = [];
for (var i = 0; i < 4; i++) {
result[i] = randNum();
}
return result.join(".");
};
self.ip.schema = {
"description": "Generates a random IP.",
"sampleResults": ["97.238.241.11"]
};
/**
* userAgent
*
* @method faker.internet.userAgent
*/
self.userAgent = function () {
return random_ua.generate();
};
self.userAgent.schema = {
"description": "Generates a random user agent.",
"sampleResults": ["Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_7_5 rv:6.0; SL) AppleWebKit/532.0.1 (KHTML, like Gecko) Version/7.1.6 Safari/532.0.1"]
};
/**
* color
*
* @method faker.internet.color
* @param {number} baseRed255
* @param {number} baseGreen255
* @param {number} baseBlue255
*/
self.color = function (baseRed255, baseGreen255, baseBlue255) {
baseRed255 = baseRed255 || 0;
baseGreen255 = baseGreen255 || 0;
baseBlue255 = baseBlue255 || 0;
// based on awesome response : http://stackoverflow.com/questions/43044/algorithm-to-randomly-generate-an-aesthetically-pleasing-color-palette
var red = Math.floor((faker.random.number(256) + baseRed255) / 2);
var green = Math.floor((faker.random.number(256) + baseGreen255) / 2);
var blue = Math.floor((faker.random.number(256) + baseBlue255) / 2);
var redStr = red.toString(16);
var greenStr = green.toString(16);
var blueStr = blue.toString(16);
return '#' +
(redStr.length === 1 ? '0' : '') + redStr +
(greenStr.length === 1 ? '0' : '') + greenStr +
(blueStr.length === 1 ? '0': '') + blueStr;
};
self.color.schema = {
"description": "Generates a random hexadecimal color.",
"sampleResults": ["#06267f"],
"properties": {
"baseRed255": {
"type": "number",
"required": false,
"description": "The red value. Valid values are 0 - 255."
},
"baseGreen255": {
"type": "number",
"required": false,
"description": "The green value. Valid values are 0 - 255."
},
"baseBlue255": {
"type": "number",
"required": false,
"description": "The blue value. Valid values are 0 - 255."
}
}
};
/**
* mac
*
* @method faker.internet.mac
*/
self.mac = function(){
var i, mac = "";
for (i=0; i < 12; i++) {
mac+= faker.random.number(15).toString(16);
if (i%2==1 && i != 11) {
mac+=":";
}
}
return mac;
};
self.mac.schema = {
"description": "Generates a random mac address.",
"sampleResults": ["78:06:cc:ae:b3:81"]
};
/**
* password
*
* @method faker.internet.password
* @param {number} len
* @param {boolean} memorable
* @param {string} pattern
* @param {string} prefix
*/
self.password = function (len, memorable, pattern, prefix) {
len = len || 15;
if (typeof memorable === "undefined") {
memorable = false;
}
return password_generator(len, memorable, pattern, prefix);
}
self.password.schema = {
"description": "Generates a random password.",
"sampleResults": [
"AM7zl6Mg",
"susejofe"
],
"properties": {
"length": {
"type": "number",
"required": false,
"description": "The number of characters in the password."
},
"memorable": {
"type": "boolean",
"required": false,
"description": "Whether a password should be easy to remember."
},
"pattern": {
"type": "regex",
"required": false,
"description": "A regex to match each character of the password against. This parameter will be negated if the memorable setting is turned on."
},
"prefix": {
"type": "string",
"required": false,
"description": "A value to prepend to the generated password. The prefix counts towards the length of the password."
}
}
};
};
module["exports"] = Internet;
},{"../vendor/password-generator.js":171,"../vendor/user-agent":172}],45:[function(require,module,exports){
module["exports"] = [
"#####",
"####",
"###"
];
},{}],46:[function(require,module,exports){
module["exports"] = [
"#{city_prefix} #{Name.first_name}#{city_suffix}",
"#{city_prefix} #{Name.first_name}",
"#{Name.first_name}#{city_suffix}",
"#{Name.last_name}#{city_suffix}"
];
},{}],47:[function(require,module,exports){
module["exports"] = [
"North",
"East",
"West",
"South",
"New",
"Lake",
"Port"
];
},{}],48:[function(require,module,exports){
module["exports"] = [
"town",
"ton",
"land",
"ville",
"berg",
"burgh",
"borough",
"bury",
"view",
"port",
"mouth",
"stad",
"furt",
"chester",
"mouth",
"fort",
"haven",
"side",
"shire"
];
},{}],49:[function(require,module,exports){
module["exports"] = [
"Afghanistan",
"Albania",
"Algeria",
"American Samoa",
"Andorra",
"Angola",
"Anguilla",
"Antarctica (the territory South of 60 deg S)",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Aruba",
"Australia",
"Austria",
"Azerbaijan",
"Bahamas",
"Bahrain",
"Bangladesh",
"Barbados",
"Belarus",
"Belgium",
"Belize",
"Benin",
"Bermuda",
"Bhutan",
"Bolivia",
"Bosnia and Herzegovina",
"Botswana",
"Bouvet Island (Bouvetoya)",
"Brazil",
"British Indian Ocean Territory (Chagos Archipelago)",
"Brunei Darussalam",
"Bulgaria",
"Burkina Faso",
"Burundi",
"Cambodia",
"Cameroon",
"Canada",
"Cape Verde",
"Cayman Islands",
"Central African Republic",
"Chad",
"Chile",
"China",
"Christmas Island",
"Cocos (Keeling) Islands",
"Colombia",
"Comoros",
"Congo",
"Congo",
"Cook Islands",
"Costa Rica",
"Cote d'Ivoire",
"Croatia",
"Cuba",
"Cyprus",
"Czech Republic",
"Denmark",
"Djibouti",
"Dominica",
"Dominican Republic",
"Ecuador",
"Egypt",
"El Salvador",
"Equatorial Guinea",
"Eritrea",
"Estonia",
"Ethiopia",
"Faroe Islands",
"Falkland Islands (Malvinas)",
"Fiji",
"Finland",
"France",
"French Guiana",
"French Polynesia",
"French Southern Territories",
"Gabon",
"Gambia",
"Georgia",
"Germany",
"Ghana",
"Gibraltar",
"Greece",
"Greenland",
"Grenada",
"Guadeloupe",
"Guam",
"Guatemala",
"Guernsey",
"Guinea",
"Guinea-Bissau",
"Guyana",
"Haiti",
"Heard Island and McDonald Islands",
"Holy See (Vatican City State)",
"Honduras",
"Hong Kong",
"Hungary",
"Iceland",
"India",
"Indonesia",
"Iran",
"Iraq",
"Ireland",
"Isle of Man",
"Israel",
"Italy",
"Jamaica",
"Japan",
"Jersey",
"Jordan",
"Kazakhstan",
"Kenya",
"Kiribati",
"Democratic People's Republic of Korea",
"Republic of Korea",
"Kuwait",
"Kyrgyz Republic",
"Lao People's Democratic Republic",
"Latvia",
"Lebanon",
"Lesotho",
"Liberia",
"Libyan Arab Jamahiriya",
"Liechtenstein",
"Lithuania",
"Luxembourg",
"Macao",
"Macedonia",
"Madagascar",
"Malawi",
"Malaysia",
"Maldives",
"Mali",
"Malta",
"Marshall Islands",
"Martinique",
"Mauritania",
"Mauritius",
"Mayotte",
"Mexico",
"Micronesia",
"Moldova",
"Monaco",
"Mongolia",
"Montenegro",
"Montserrat",
"Morocco",
"Mozambique",
"Myanmar",
"Namibia",
"Nauru",
"Nepal",
"Netherlands Antilles",
"Netherlands",
"New Caledonia",
"New Zealand",
"Nicaragua",
"Niger",
"Nigeria",
"Niue",
"Norfolk Island",
"Northern Mariana Islands",
"Norway",
"Oman",
"Pakistan",
"Palau",
"Palestinian Territory",
"Panama",
"Papua New Guinea",
"Paraguay",
"Peru",
"Philippines",
"Pitcairn Islands",
"Poland",
"Portugal",
"Puerto Rico",
"Qatar",
"Reunion",
"Romania",
"Russian Federation",
"Rwanda",
"Saint Barthelemy",
"Saint Helena",
"Saint Kitts and Nevis",
"Saint Lucia",
"Saint Martin",
"Saint Pierre and Miquelon",
"Saint Vincent and the Grenadines",
"Samoa",
"San Marino",
"Sao Tome and Principe",
"Saudi Arabia",
"Senegal",
"Serbia",
"Seychelles",
"Sierra Leone",
"Singapore",
"Slovakia (Slovak Republic)",
"Slovenia",
"Solomon Islands",
"Somalia",
"South Africa",
"South Georgia and the South Sandwich Islands",
"Spain",
"Sri Lanka",
"Sudan",
"Suriname",
"Svalbard & Jan Mayen Islands",
"Swaziland",
"Sweden",
"Switzerland",
"Syrian Arab Republic",
"Taiwan",
"Tajikistan",
"Tanzania",
"Thailand",
"Timor-Leste",
"Togo",
"Tokelau",
"Tonga",
"Trinidad and Tobago",
"Tunisia",
"Turkey",
"Turkmenistan",
"Turks and Caicos Islands",
"Tuvalu",
"Uganda",
"Ukraine",
"United Arab Emirates",
"United Kingdom",
"United States of America",
"United States Minor Outlying Islands",
"Uruguay",
"Uzbekistan",
"Vanuatu",
"Venezuela",
"Vietnam",
"Virgin Islands, British",
"Virgin Islands, U.S.",
"Wallis and Futuna",
"Western Sahara",
"Yemen",
"Zambia",
"Zimbabwe"
];
},{}],50:[function(require,module,exports){
module["exports"] = [
"AD",
"AE",
"AF",
"AG",
"AI",
"AL",
"AM",
"AO",
"AQ",
"AR",
"AS",
"AT",
"AU",
"AW",
"AX",
"AZ",
"BA",
"BB",
"BD",
"BE",
"BF",
"BG",
"BH",
"BI",
"BJ",
"BL",
"BM",
"BN",
"BO",
"BQ",
"BQ",
"BR",
"BS",
"BT",
"BV",
"BW",
"BY",
"BZ",
"CA",
"CC",
"CD",
"CF",
"CG",
"CH",
"CI",
"CK",
"CL",
"CM",
"CN",
"CO",
"CR",
"CU",
"CV",
"CW",
"CX",
"CY",
"CZ",
"DE",
"DJ",
"DK",
"DM",
"DO",
"DZ",
"EC",
"EE",
"EG",
"EH",
"ER",
"ES",
"ET",
"FI",
"FJ",
"FK",
"FM",
"FO",
"FR",
"GA",
"GB",
"GD",
"GE",
"GF",
"GG",
"GH",
"GI",
"GL",
"GM",
"GN",
"GP",
"GQ",
"GR",
"GS",
"GT",
"GU",
"GW",
"GY",
"HK",
"HM",
"HN",
"HR",
"HT",
"HU",
"ID",
"IE",
"IL",
"IM",
"IN",
"IO",
"IQ",
"IR",
"IS",
"IT",
"JE",
"JM",
"JO",
"JP",
"KE",
"KG",
"KH",
"KI",
"KM",
"KN",
"KP",
"KR",
"KW",
"KY",
"KZ",
"LA",
"LB",
"LC",
"LI",
"LK",
"LR",
"LS",
"LT",
"LU",
"LV",
"LY",
"MA",
"MC",
"MD",
"ME",
"MF",
"MG",
"MH",
"MK",
"ML",
"MM",
"MN",
"MO",
"MP",
"MQ",
"MR",
"MS",
"MT",
"MU",
"MV",
"MW",
"MX",
"MY",
"MZ",
"NA",
"NC",
"NE",
"NF",
"NG",
"NI",
"NL",
"NO",
"NP",
"NR",
"NU",
"NZ",
"OM",
"PA",
"PE",
"PF",
"PG",
"PH",
"PK",
"PL",
"PM",
"PN",
"PR",
"PS",
"PT",
"PW",
"PY",
"QA",
"RE",
"RO",
"RS",
"RU",
"RW",
"SA",
"SB",
"SC",
"SD",
"SE",
"SG",
"SH",
"SI",
"SJ",
"SK",
"SL",
"SM",
"SN",
"SO",
"SR",
"SS",
"ST",
"SV",
"SX",
"SY",
"SZ",
"TC",
"TD",
"TF",
"TG",
"TH",
"TJ",
"TK",
"TL",
"TM",
"TN",
"TO",
"TR",
"TT",
"TV",
"TW",
"TZ",
"UA",
"UG",
"UM",
"US",
"UY",
"UZ",
"VA",
"VC",
"VE",
"VG",
"VI",
"VN",
"VU",
"WF",
"WS",
"YE",
"YT",
"ZA",
"ZM",
"ZW"
];
},{}],51:[function(require,module,exports){
module["exports"] = [
"Avon",
"Bedfordshire",
"Berkshire",
"Borders",
"Buckinghamshire",
"Cambridgeshire"
];
},{}],52:[function(require,module,exports){
module["exports"] = [
"United States of America"
];
},{}],53:[function(require,module,exports){
var address = {};
module['exports'] = address;
address.city_prefix = require("./city_prefix");
address.city_suffix = require("./city_suffix");
address.county = require("./county");
address.country = require("./country");
address.country_code = require("./country_code");
address.building_number = require("./building_number");
address.street_suffix = require("./street_suffix");
address.secondary_address = require("./secondary_address");
address.postcode = require("./postcode");
address.postcode_by_state = require("./postcode_by_state");
address.state = require("./state");
address.state_abbr = require("./state_abbr");
address.time_zone = require("./time_zone");
address.city = require("./city");
address.street_name = require("./street_name");
address.street_address = require("./street_address");
address.default_country = require("./default_country");
},{"./building_number":45,"./city":46,"./city_prefix":47,"./city_suffix":48,"./country":49,"./country_code":50,"./county":51,"./default_country":52,"./postcode":54,"./postcode_by_state":55,"./secondary_address":56,"./state":57,"./state_abbr":58,"./street_address":59,"./street_name":60,"./street_suffix":61,"./time_zone":62}],54:[function(require,module,exports){
module["exports"] = [
"#####",
"#####-####"
];
},{}],55:[function(require,module,exports){
arguments[4][54][0].apply(exports,arguments)
},{"dup":54}],56:[function(require,module,exports){
module["exports"] = [
"Apt. ###",
"Suite ###"
];
},{}],57:[function(require,module,exports){
module["exports"] = [
"Alabama",
"Alaska",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
"Florida",
"Georgia",
"Hawaii",
"Idaho",
"Illinois",
"Indiana",
"Iowa",
"Kansas",
"Kentucky",
"Louisiana",
"Maine",
"Maryland",
"Massachusetts",
"Michigan",
"Minnesota",
"Mississippi",
"Missouri",
"Montana",
"Nebraska",
"Nevada",
"New Hampshire",
"New Jersey",
"New Mexico",
"New York",
"North Carolina",
"North Dakota",
"Ohio",
"Oklahoma",
"Oregon",
"Pennsylvania",
"Rhode Island",
"South Carolina",
"South Dakota",
"Tennessee",
"Texas",
"Utah",
"Vermont",
"Virginia",
"Washington",
"West Virginia",
"Wisconsin",
"Wyoming"
];
},{}],58:[function(require,module,exports){
module["exports"] = [
"AL",
"AK",
"AZ",
"AR",
"CA",
"CO",
"CT",
"DE",
"FL",
"GA",
"HI",
"ID",
"IL",
"IN",
"IA",
"KS",
"KY",
"LA",
"ME",
"MD",
"MA",
"MI",
"MN",
"MS",
"MO",
"MT",
"NE",
"NV",
"NH",
"NJ",
"NM",
"NY",
"NC",
"ND",
"OH",
"OK",
"OR",
"PA",
"RI",
"SC",
"SD",
"TN",
"TX",
"UT",
"VT",
"VA",
"WA",
"WV",
"WI",
"WY"
];
},{}],59:[function(require,module,exports){
module["exports"] = [
"#{building_number} #{street_name}"
];
},{}],60:[function(require,module,exports){
module["exports"] = [
"#{Name.first_name} #{street_suffix}",
"#{Name.last_name} #{street_suffix}"
];
},{}],61:[function(require,module,exports){
module["exports"] = [
"Alley",
"Avenue",
"Branch",
"Bridge",
"Brook",
"Brooks",
"Burg",
"Burgs",
"Bypass",
"Camp",
"Canyon",
"Cape",
"Causeway",
"Center",
"Centers",
"Circle",
"Circles",
"Cliff",
"Cliffs",
"Club",
"Common",
"Corner",
"Corners",
"Course",
"Court",
"Courts",
"Cove",
"Coves",
"Creek",
"Crescent",
"Crest",
"Crossing",
"Crossroad",
"Curve",
"Dale",
"Dam",
"Divide",
"Drive",
"Drive",
"Drives",
"Estate",
"Estates",
"Expressway",
"Extension",
"Extensions",
"Fall",
"Falls",
"Ferry",
"Field",
"Fields",
"Flat",
"Flats",
"Ford",
"Fords",
"Forest",
"Forge",
"Forges",
"Fork",
"Forks",
"Fort",
"Freeway",
"Garden",
"Gardens",
"Gateway",
"Glen",
"Glens",
"Green",
"Greens",
"Grove",
"Groves",
"Harbor",
"Harbors",
"Haven",
"Heights",
"Highway",
"Hill",
"Hills",
"Hollow",
"Inlet",
"Inlet",
"Island",
"Island",
"Islands",
"Islands",
"Isle",
"Isle",
"Junction",
"Junctions",
"Key",
"Keys",
"Knoll",
"Knolls",
"Lake",
"Lakes",
"Land",
"Landing",
"Lane",
"Light",
"Lights",
"Loaf",
"Lock",
"Locks",
"Locks",
"Lodge",
"Lodge",
"Loop",
"Mall",
"Manor",
"Manors",
"Meadow",
"Meadows",
"Mews",
"Mill",
"Mills",
"Mission",
"Mission",
"Motorway",
"Mount",
"Mountain",
"Mountain",
"Mountains",
"Mountains",
"Neck",
"Orchard",
"Oval",
"Overpass",
"Park",
"Parks",
"Parkway",
"Parkways",
"Pass",
"Passage",
"Path",
"Pike",
"Pine",
"Pines",
"Place",
"Plain",
"Plains",
"Plains",
"Plaza",
"Plaza",
"Point",
"Points",
"Port",
"Port",
"Ports",
"Ports",
"Prairie",
"Prairie",
"Radial",
"Ramp",
"Ranch",
"Rapid",
"Rapids",
"Rest",
"Ridge",
"Ridges",
"River",
"Road",
"Road",
"Roads",
"Roads",
"Route",
"Row",
"Rue",
"Run",
"Shoal",
"Shoals",
"Shore",
"Shores",
"Skyway",
"Spring",
"Springs",
"Springs",
"Spur",
"Spurs",
"Square",
"Square",
"Squares",
"Squares",
"Station",
"Station",
"Stravenue",
"Stravenue",
"Stream",
"Stream",
"Street",
"Street",
"Streets",
"Summit",
"Summit",
"Terrace",
"Throughway",
"Trace",
"Track",
"Trafficway",
"Trail",
"Trail",
"Tunnel",
"Tunnel",
"Turnpike",
"Turnpike",
"Underpass",
"Union",
"Unions",
"Valley",
"Valleys",
"Via",
"Viaduct",
"View",
"Views",
"Village",
"Village",
"Villages",
"Ville",
"Vista",
"Vista",
"Walk",
"Walks",
"Wall",
"Way",
"Ways",
"Well",
"Wells"
];
},{}],62:[function(require,module,exports){
module["exports"] = [
"Pacific/Midway",
"Pacific/Pago_Pago",
"Pacific/Honolulu",
"America/Juneau",
"America/Los_Angeles",
"America/Tijuana",
"America/Denver",
"America/Phoenix",
"America/Chihuahua",
"America/Mazatlan",
"America/Chicago",
"America/Regina",
"America/Mexico_City",
"America/Mexico_City",
"America/Monterrey",
"America/Guatemala",
"America/New_York",
"America/Indiana/Indianapolis",
"America/Bogota",
"America/Lima",
"America/Lima",
"America/Halifax",
"America/Caracas",
"America/La_Paz",
"America/Santiago",
"America/St_Johns",
"America/Sao_Paulo",
"America/Argentina/Buenos_Aires",
"America/Guyana",
"America/Godthab",
"Atlantic/South_Georgia",
"Atlantic/Azores",
"Atlantic/Cape_Verde",
"Europe/Dublin",
"Europe/London",
"Europe/Lisbon",
"Europe/London",
"Africa/Casablanca",
"Africa/Monrovia",
"Etc/UTC",
"Europe/Belgrade",
"Europe/Bratislava",
"Europe/Budapest",
"Europe/Ljubljana",
"Europe/Prague",
"Europe/Sarajevo",
"Europe/Skopje",
"Europe/Warsaw",
"Europe/Zagreb",
"Europe/Brussels",
"Europe/Copenhagen",
"Europe/Madrid",
"Europe/Paris",
"Europe/Amsterdam",
"Europe/Berlin",
"Europe/Berlin",
"Europe/Rome",
"Europe/Stockholm",
"Europe/Vienna",
"Africa/Algiers",
"Europe/Bucharest",
"Africa/Cairo",
"Europe/Helsinki",
"Europe/Kiev",
"Europe/Riga",
"Europe/Sofia",
"Europe/Tallinn",
"Europe/Vilnius",
"Europe/Athens",
"Europe/Istanbul",
"Europe/Minsk",
"Asia/Jerusalem",
"Africa/Harare",
"Africa/Johannesburg",
"Europe/Moscow",
"Europe/Moscow",
"Europe/Moscow",
"Asia/Kuwait",
"Asia/Riyadh",
"Africa/Nairobi",
"Asia/Baghdad",
"Asia/Tehran",
"Asia/Muscat",
"Asia/Muscat",
"Asia/Baku",
"Asia/Tbilisi",
"Asia/Yerevan",
"Asia/Kabul",
"Asia/Yekaterinburg",
"Asia/Karachi",
"Asia/Karachi",
"Asia/Tashkent",
"Asia/Kolkata",
"Asia/Kolkata",
"Asia/Kolkata",
"Asia/Kolkata",
"Asia/Kathmandu",
"Asia/Dhaka",
"Asia/Dhaka",
"Asia/Colombo",
"Asia/Almaty",
"Asia/Novosibirsk",
"Asia/Rangoon",
"Asia/Bangkok",
"Asia/Bangkok",
"Asia/Jakarta",
"Asia/Krasnoyarsk",
"Asia/Shanghai",
"Asia/Chongqing",
"Asia/Hong_Kong",
"Asia/Urumqi",
"Asia/Kuala_Lumpur",
"Asia/Singapore",
"Asia/Taipei",
"Australia/Perth",
"Asia/Irkutsk",
"Asia/Ulaanbaatar",
"Asia/Seoul",
"Asia/Tokyo",
"Asia/Tokyo",
"Asia/Tokyo",
"Asia/Yakutsk",
"Australia/Darwin",
"Australia/Adelaide",
"Australia/Melbourne",
"Australia/Melbourne",
"Australia/Sydney",
"Australia/Brisbane",
"Australia/Hobart",
"Asia/Vladivostok",
"Pacific/Guam",
"Pacific/Port_Moresby",
"Asia/Magadan",
"Asia/Magadan",
"Pacific/Noumea",
"Pacific/Fiji",
"Asia/Kamchatka",
"Pacific/Majuro",
"Pacific/Auckland",
"Pacific/Auckland",
"Pacific/Tongatapu",
"Pacific/Fakaofo",
"Pacific/Apia"
];
},{}],63:[function(require,module,exports){
module["exports"] = [
"#{Name.name}",
"#{Company.name}"
];
},{}],64:[function(require,module,exports){
var app = {};
module['exports'] = app;
app.name = require("./name");
app.version = require("./version");
app.author = require("./author");
},{"./author":63,"./name":65,"./version":66}],65:[function(require,module,exports){
module["exports"] = [
"Redhold",
"Treeflex",
"Trippledex",
"Kanlam",
"Bigtax",
"Daltfresh",
"Toughjoyfax",
"Mat Lam Tam",
"Otcom",
"Tres-Zap",
"Y-Solowarm",
"Tresom",
"Voltsillam",
"Biodex",
"Greenlam",
"Viva",
"Matsoft",
"Temp",
"Zoolab",
"Subin",
"Rank",
"Job",
"Stringtough",
"Tin",
"It",
"Home Ing",
"Zamit",
"Sonsing",
"Konklab",
"Alpha",
"Latlux",
"Voyatouch",
"Alphazap",
"Holdlamis",
"Zaam-Dox",
"Sub-Ex",
"Quo Lux",
"Bamity",
"Ventosanzap",
"Lotstring",
"Hatity",
"Tempsoft",
"Overhold",
"Fixflex",
"Konklux",
"Zontrax",
"Tampflex",
"Span",
"Namfix",
"Transcof",
"Stim",
"Fix San",
"Sonair",
"Stronghold",
"Fintone",
"Y-find",
"Opela",
"Lotlux",
"Ronstring",
"Zathin",
"Duobam",
"Keylex"
];
},{}],66:[function(require,module,exports){
module["exports"] = [
"0.#.#",
"0.##",
"#.##",
"#.#",
"#.#.#"
];
},{}],67:[function(require,module,exports){
module["exports"] = [
"2011-10-12",
"2012-11-12",
"2015-11-11",
"2013-9-12"
];
},{}],68:[function(require,module,exports){
module["exports"] = [
"1234-2121-1221-1211",
"1212-1221-1121-1234",
"1211-1221-1234-2201",
"1228-1221-1221-1431"
];
},{}],69:[function(require,module,exports){
module["exports"] = [
"visa",
"mastercard",
"americanexpress",
"discover"
];
},{}],70:[function(require,module,exports){
var business = {};
module['exports'] = business;
business.credit_card_numbers = require("./credit_card_numbers");
business.credit_card_expiry_dates = require("./credit_card_expiry_dates");
business.credit_card_types = require("./credit_card_types");
},{"./credit_card_expiry_dates":67,"./credit_card_numbers":68,"./credit_card_types":69}],71:[function(require,module,exports){
module["exports"] = [
"###-###-####",
"(###) ###-####",
"1-###-###-####",
"###.###.####"
];
},{}],72:[function(require,module,exports){
var cell_phone = {};
module['exports'] = cell_phone;
cell_phone.formats = require("./formats");
},{"./formats":71}],73:[function(require,module,exports){
module["exports"] = [
"red",
"green",
"blue",
"yellow",
"purple",
"mint green",
"teal",
"white",
"black",
"orange",
"pink",
"grey",
"maroon",
"violet",
"turquoise",
"tan",
"sky blue",
"salmon",
"plum",
"orchid",
"olive",
"magenta",
"lime",
"ivory",
"indigo",
"gold",
"fuchsia",
"cyan",
"azure",
"lavender",
"silver"
];
},{}],74:[function(require,module,exports){
module["exports"] = [
"Books",
"Movies",
"Music",
"Games",
"Electronics",
"Computers",
"Home",
"Garden",
"Tools",
"Grocery",
"Health",
"Beauty",
"Toys",
"Kids",
"Baby",
"Clothing",
"Shoes",
"Jewelery",
"Sports",
"Outdoors",
"Automotive",
"Industrial"
];
},{}],75:[function(require,module,exports){
var commerce = {};
module['exports'] = commerce;
commerce.color = require("./color");
commerce.department = require("./department");
commerce.product_name = require("./product_name");
},{"./color":73,"./department":74,"./product_name":76}],76:[function(require,module,exports){
module["exports"] = {
"adjective": [
"Small",
"Ergonomic",
"Rustic",
"Intelligent",
"Gorgeous",
"Incredible",
"Fantastic",
"Practical",
"Sleek",
"Awesome",
"Generic",
"Handcrafted",
"Handmade",
"Licensed",
"Refined",
"Unbranded",
"Tasty"
],
"material": [
"Steel",
"Wooden",
"Concrete",
"Plastic",
"Cotton",
"Granite",
"Rubber",
"Metal",
"Soft",
"Fresh",
"Frozen"
],
"product": [
"Chair",
"Car",
"Computer",
"Keyboard",
"Mouse",
"Bike",
"Ball",
"Gloves",
"Pants",
"Shirt",
"Table",
"Shoes",
"Hat",
"Towels",
"Soap",
"Tuna",
"Chicken",
"Fish",
"Cheese",
"Bacon",
"Pizza",
"Salad",
"Sausages",
"Chips"
]
};
},{}],77:[function(require,module,exports){
module["exports"] = [
"Adaptive",
"Advanced",
"Ameliorated",
"Assimilated",
"Automated",
"Balanced",
"Business-focused",
"Centralized",
"Cloned",
"Compatible",
"Configurable",
"Cross-group",
"Cross-platform",
"Customer-focused",
"Customizable",
"Decentralized",
"De-engineered",
"Devolved",
"Digitized",
"Distributed",
"Diverse",
"Down-sized",
"Enhanced",
"Enterprise-wide",
"Ergonomic",
"Exclusive",
"Expanded",
"Extended",
"Face to face",
"Focused",
"Front-line",
"Fully-configurable",
"Function-based",
"Fundamental",
"Future-proofed",
"Grass-roots",
"Horizontal",
"Implemented",
"Innovative",
"Integrated",
"Intuitive",
"Inverse",
"Managed",
"Mandatory",
"Monitored",
"Multi-channelled",
"Multi-lateral",
"Multi-layered",
"Multi-tiered",
"Networked",
"Object-based",
"Open-architected",
"Open-source",
"Operative",
"Optimized",
"Optional",
"Organic",
"Organized",
"Persevering",
"Persistent",
"Phased",
"Polarised",
"Pre-emptive",
"Proactive",
"Profit-focused",
"Profound",
"Programmable",
"Progressive",
"Public-key",
"Quality-focused",
"Reactive",
"Realigned",
"Re-contextualized",
"Re-engineered",
"Reduced",
"Reverse-engineered",
"Right-sized",
"Robust",
"Seamless",
"Secured",
"Self-enabling",
"Sharable",
"Stand-alone",
"Streamlined",
"Switchable",
"Synchronised",
"Synergistic",
"Synergized",
"Team-oriented",
"Total",
"Triple-buffered",
"Universal",
"Up-sized",
"Upgradable",
"User-centric",
"User-friendly",
"Versatile",
"Virtual",
"Visionary",
"Vision-oriented"
];
},{}],78:[function(require,module,exports){
module["exports"] = [
"clicks-and-mortar",
"value-added",
"vertical",
"proactive",
"robust",
"revolutionary",
"scalable",
"leading-edge",
"innovative",
"intuitive",
"strategic",
"e-business",
"mission-critical",
"sticky",
"one-to-one",
"24/7",
"end-to-end",
"global",
"B2B",
"B2C",
"granular",
"frictionless",
"virtual",
"viral",
"dynamic",
"24/365",
"best-of-breed",
"killer",
"magnetic",
"bleeding-edge",
"web-enabled",
"interactive",
"dot-com",
"sexy",
"back-end",
"real-time",
"efficient",
"front-end",
"distributed",
"seamless",
"extensible",
"turn-key",
"world-class",
"open-source",
"cross-platform",
"cross-media",
"synergistic",
"bricks-and-clicks",
"out-of-the-box",
"enterprise",
"integrated",
"impactful",
"wireless",
"transparent",
"next-generation",
"cutting-edge",
"user-centric",
"visionary",
"customized",
"ubiquitous",
"plug-and-play",
"collaborative",
"compelling",
"holistic",
"rich"
];
},{}],79:[function(require,module,exports){
module["exports"] = [
"synergies",
"web-readiness",
"paradigms",
"markets",
"partnerships",
"infrastructures",
"platforms",
"initiatives",
"channels",
"eyeballs",
"communities",
"ROI",
"solutions",
"e-tailers",
"e-services",
"action-items",
"portals",
"niches",
"technologies",
"content",
"vortals",
"supply-chains",
"convergence",
"relationships",
"architectures",
"interfaces",
"e-markets",
"e-commerce",
"systems",
"bandwidth",
"infomediaries",
"models",
"mindshare",
"deliverables",
"users",
"schemas",
"networks",
"applications",
"metrics",
"e-business",
"functionalities",
"experiences",
"web services",
"methodologies"
];
},{}],80:[function(require,module,exports){
module["exports"] = [
"implement",
"utilize",
"integrate",
"streamline",
"optimize",
"evolve",
"transform",
"embrace",
"enable",
"orchestrate",
"leverage",
"reinvent",
"aggregate",
"architect",
"enhance",
"incentivize",
"morph",
"empower",
"envisioneer",
"monetize",
"harness",
"facilitate",
"seize",
"disintermediate",
"synergize",
"strategize",
"deploy",
"brand",
"grow",
"target",
"syndicate",
"synthesize",
"deliver",
"mesh",
"incubate",
"engage",
"maximize",
"benchmark",
"expedite",
"reintermediate",
"whiteboard",
"visualize",
"repurpose",
"innovate",
"scale",
"unleash",
"drive",
"extend",
"engineer",
"revolutionize",
"generate",
"exploit",
"transition",
"e-enable",
"iterate",
"cultivate",
"matrix",
"productize",
"redefine",
"recontextualize"
];
},{}],81:[function(require,module,exports){
module["exports"] = [
"24 hour",
"24/7",
"3rd generation",
"4th generation",
"5th generation",
"6th generation",
"actuating",
"analyzing",
"asymmetric",
"asynchronous",
"attitude-oriented",
"background",
"bandwidth-monitored",
"bi-directional",
"bifurcated",
"bottom-line",
"clear-thinking",
"client-driven",
"client-server",
"coherent",
"cohesive",
"composite",
"context-sensitive",
"contextually-based",
"content-based",
"dedicated",
"demand-driven",
"didactic",
"directional",
"discrete",
"disintermediate",
"dynamic",
"eco-centric",
"empowering",
"encompassing",
"even-keeled",
"executive",
"explicit",
"exuding",
"fault-tolerant",
"foreground",
"fresh-thinking",
"full-range",
"global",
"grid-enabled",
"heuristic",
"high-level",
"holistic",
"homogeneous",
"human-resource",
"hybrid",
"impactful",
"incremental",
"intangible",
"interactive",
"intermediate",
"leading edge",
"local",
"logistical",
"maximized",
"methodical",
"mission-critical",
"mobile",
"modular",
"motivating",
"multimedia",
"multi-state",
"multi-tasking",
"national",
"needs-based",
"neutral",
"next generation",
"non-volatile",
"object-oriented",
"optimal",
"optimizing",
"radical",
"real-time",
"reciprocal",
"regional",
"responsive",
"scalable",
"secondary",
"solution-oriented",
"stable",
"static",
"systematic",
"systemic",
"system-worthy",
"tangible",
"tertiary",
"transitional",
"uniform",
"upward-trending",
"user-facing",
"value-added",
"web-enabled",
"well-modulated",
"zero administration",
"zero defect",
"zero tolerance"
];
},{}],82:[function(require,module,exports){
var company = {};
module['exports'] = company;
company.suffix = require("./suffix");
company.adjective = require("./adjective");
company.descriptor = require("./descriptor");
company.noun = require("./noun");
company.bs_verb = require("./bs_verb");
company.bs_adjective = require("./bs_adjective");
company.bs_noun = require("./bs_noun");
company.name = require("./name");
},{"./adjective":77,"./bs_adjective":78,"./bs_noun":79,"./bs_verb":80,"./descriptor":81,"./name":83,"./noun":84,"./suffix":85}],83:[function(require,module,exports){
module["exports"] = [
"#{Name.last_name} #{suffix}",
"#{Name.last_name}-#{Name.last_name}",
"#{Name.last_name}, #{Name.last_name} and #{Name.last_name}"
];
},{}],84:[function(require,module,exports){
module["exports"] = [
"ability",
"access",
"adapter",
"algorithm",
"alliance",
"analyzer",
"application",
"approach",
"architecture",
"archive",
"artificial intelligence",
"array",
"attitude",
"benchmark",
"budgetary management",
"capability",
"capacity",
"challenge",
"circuit",
"collaboration",
"complexity",
"concept",
"conglomeration",
"contingency",
"core",
"customer loyalty",
"database",
"data-warehouse",
"definition",
"emulation",
"encoding",
"encryption",
"extranet",
"firmware",
"flexibility",
"focus group",
"forecast",
"frame",
"framework",
"function",
"functionalities",
"Graphic Interface",
"groupware",
"Graphical User Interface",
"hardware",
"help-desk",
"hierarchy",
"hub",
"implementation",
"info-mediaries",
"infrastructure",
"initiative",
"installation",
"instruction set",
"interface",
"internet solution",
"intranet",
"knowledge user",
"knowledge base",
"local area network",
"leverage",
"matrices",
"matrix",
"methodology",
"middleware",
"migration",
"model",
"moderator",
"monitoring",
"moratorium",
"neural-net",
"open architecture",
"open system",
"orchestration",
"paradigm",
"parallelism",
"policy",
"portal",
"pricing structure",
"process improvement",
"product",
"productivity",
"project",
"projection",
"protocol",
"secured line",
"service-desk",
"software",
"solution",
"standardization",
"strategy",
"structure",
"success",
"superstructure",
"support",
"synergy",
"system engine",
"task-force",
"throughput",
"time-frame",
"toolset",
"utilisation",
"website",
"workforce"
];
},{}],85:[function(require,module,exports){
module["exports"] = [
"Inc",
"and Sons",
"LLC",
"Group"
];
},{}],86:[function(require,module,exports){
module["exports"] = [
"/34##-######-####L/",
"/37##-######-####L/"
];
},{}],87:[function(require,module,exports){
module["exports"] = [
"/30[0-5]#-######-###L/",
"/368#-######-###L/"
];
},{}],88:[function(require,module,exports){
module["exports"] = [
"/6011-####-####-###L/",
"/65##-####-####-###L/",
"/64[4-9]#-####-####-###L/",
"/6011-62##-####-####-###L/",
"/65##-62##-####-####-###L/",
"/64[4-9]#-62##-####-####-###L/"
];
},{}],89:[function(require,module,exports){
var credit_card = {};
module['exports'] = credit_card;
credit_card.visa = require("./visa");
credit_card.mastercard = require("./mastercard");
credit_card.discover = require("./discover");
credit_card.american_express = require("./american_express");
credit_card.diners_club = require("./diners_club");
credit_card.jcb = require("./jcb");
credit_card.switch = require("./switch");
credit_card.solo = require("./solo");
credit_card.maestro = require("./maestro");
credit_card.laser = require("./laser");
},{"./american_express":86,"./diners_club":87,"./discover":88,"./jcb":90,"./laser":91,"./maestro":92,"./mastercard":93,"./solo":94,"./switch":95,"./visa":96}],90:[function(require,module,exports){
module["exports"] = [
"/3528-####-####-###L/",
"/3529-####-####-###L/",
"/35[3-8]#-####-####-###L/"
];
},{}],91:[function(require,module,exports){
module["exports"] = [
"/6304###########L/",
"/6706###########L/",
"/6771###########L/",
"/6709###########L/",
"/6304#########{5,6}L/",
"/6706#########{5,6}L/",
"/6771#########{5,6}L/",
"/6709#########{5,6}L/"
];
},{}],92:[function(require,module,exports){
module["exports"] = [
"/50#{9,16}L/",
"/5[6-8]#{9,16}L/",
"/56##{9,16}L/"
];
},{}],93:[function(require,module,exports){
module["exports"] = [
"/5[1-5]##-####-####-###L/",
"/6771-89##-####-###L/"
];
},{}],94:[function(require,module,exports){
module["exports"] = [
"/6767-####-####-###L/",
"/6767-####-####-####-#L/",
"/6767-####-####-####-##L/"
];
},{}],95:[function(require,module,exports){
module["exports"] = [
"/6759-####-####-###L/",
"/6759-####-####-####-#L/",
"/6759-####-####-####-##L/"
];
},{}],96:[function(require,module,exports){
module["exports"] = [
"/4###########L/",
"/4###-####-####-###L/"
];
},{}],97:[function(require,module,exports){
var date = {};
module["exports"] = date;
date.month = require("./month");
date.weekday = require("./weekday");
},{"./month":98,"./weekday":99}],98:[function(require,module,exports){
// Source: http://unicode.org/cldr/trac/browser/tags/release-27/common/main/en.xml#L1799
module["exports"] = {
wide: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
// Property "wide_context" is optional, if not set then "wide" will be used instead
// It is used to specify a word in context, which may differ from a stand-alone word
wide_context: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
abbr: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
// Property "abbr_context" is optional, if not set then "abbr" will be used instead
// It is used to specify a word in context, which may differ from a stand-alone word
abbr_context: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
]
};
},{}],99:[function(require,module,exports){
// Source: http://unicode.org/cldr/trac/browser/tags/release-27/common/main/en.xml#L1847
module["exports"] = {
wide: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
// Property "wide_context" is optional, if not set then "wide" will be used instead
// It is used to specify a word in context, which may differ from a stand-alone word
wide_context: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
abbr: [
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
],
// Property "abbr_context" is optional, if not set then "abbr" will be used instead
// It is used to specify a word in context, which may differ from a stand-alone word
abbr_context: [
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
]
};
},{}],100:[function(require,module,exports){
module["exports"] = [
"Checking",
"Savings",
"Money Market",
"Investment",
"Home Loan",
"Credit Card",
"Auto Loan",
"Personal Loan"
];
},{}],101:[function(require,module,exports){
module["exports"] = {
"UAE Dirham": {
"code": "AED",
"symbol": ""
},
"Afghani": {
"code": "AFN",
"symbol": "؋"
},
"Lek": {
"code": "ALL",
"symbol": "Lek"
},
"Armenian Dram": {
"code": "AMD",
"symbol": ""
},
"Netherlands Antillian Guilder": {
"code": "ANG",
"symbol": "ƒ"
},
"Kwanza": {
"code": "AOA",
"symbol": ""
},
"Argentine Peso": {
"code": "ARS",
"symbol": "$"
},
"Australian Dollar": {
"code": "AUD",
"symbol": "$"
},
"Aruban Guilder": {
"code": "AWG",
"symbol": "ƒ"
},
"Azerbaijanian Manat": {
"code": "AZN",
"symbol": "ман"
},
"Convertible Marks": {
"code": "BAM",
"symbol": "KM"
},
"Barbados Dollar": {
"code": "BBD",
"symbol": "$"
},
"Taka": {
"code": "BDT",
"symbol": ""
},
"Bulgarian Lev": {
"code": "BGN",
"symbol": "лв"
},
"Bahraini Dinar": {
"code": "BHD",
"symbol": ""
},
"Burundi Franc": {
"code": "BIF",
"symbol": ""
},
"Bermudian Dollar (customarily known as Bermuda Dollar)": {
"code": "BMD",
"symbol": "$"
},
"Brunei Dollar": {
"code": "BND",
"symbol": "$"
},
"Boliviano Mvdol": {
"code": "BOB BOV",
"symbol": "$b"
},
"Brazilian Real": {
"code": "BRL",
"symbol": "R$"
},
"Bahamian Dollar": {
"code": "BSD",
"symbol": "$"
},
"Pula": {
"code": "BWP",
"symbol": "P"
},
"Belarussian Ruble": {
"code": "BYR",
"symbol": "p."
},
"Belize Dollar": {
"code": "BZD",
"symbol": "BZ$"
},
"Canadian Dollar": {
"code": "CAD",
"symbol": "$"
},
"Congolese Franc": {
"code": "CDF",
"symbol": ""
},
"Swiss Franc": {
"code": "CHF",
"symbol": "CHF"
},
"Chilean Peso Unidades de fomento": {
"code": "CLP CLF",
"symbol": "$"
},
"Yuan Renminbi": {
"code": "CNY",
"symbol": "¥"
},
"Colombian Peso Unidad de Valor Real": {
"code": "COP COU",
"symbol": "$"
},
"Costa Rican Colon": {
"code": "CRC",
"symbol": "₡"
},
"Cuban Peso Peso Convertible": {
"code": "CUP CUC",
"symbol": "₱"
},
"Cape Verde Escudo": {
"code": "CVE",
"symbol": ""
},
"Czech Koruna": {
"code": "CZK",
"symbol": "Kč"
},
"Djibouti Franc": {
"code": "DJF",
"symbol": ""
},
"Danish Krone": {
"code": "DKK",
"symbol": "kr"
},
"Dominican Peso": {
"code": "DOP",
"symbol": "RD$"
},
"Algerian Dinar": {
"code": "DZD",
"symbol": ""
},
"Kroon": {
"code": "EEK",
"symbol": ""
},
"Egyptian Pound": {
"code": "EGP",
"symbol": "£"
},
"Nakfa": {
"code": "ERN",
"symbol": ""
},
"Ethiopian Birr": {
"code": "ETB",
"symbol": ""
},
"Euro": {
"code": "EUR",
"symbol": "€"
},
"Fiji Dollar": {
"code": "FJD",
"symbol": "$"
},
"Falkland Islands Pound": {
"code": "FKP",
"symbol": "£"
},
"Pound Sterling": {
"code": "GBP",
"symbol": "£"
},
"Lari": {
"code": "GEL",
"symbol": ""
},
"Cedi": {
"code": "GHS",
"symbol": ""
},
"Gibraltar Pound": {
"code": "GIP",
"symbol": "£"
},
"Dalasi": {
"code": "GMD",
"symbol": ""
},
"Guinea Franc": {
"code": "GNF",
"symbol": ""
},
"Quetzal": {
"code": "GTQ",
"symbol": "Q"
},
"Guyana Dollar": {
"code": "GYD",
"symbol": "$"
},
"Hong Kong Dollar": {
"code": "HKD",
"symbol": "$"
},
"Lempira": {
"code": "HNL",
"symbol": "L"
},
"Croatian Kuna": {
"code": "HRK",
"symbol": "kn"
},
"Gourde US Dollar": {
"code": "HTG USD",
"symbol": ""
},
"Forint": {
"code": "HUF",
"symbol": "Ft"
},
"Rupiah": {
"code": "IDR",
"symbol": "Rp"
},
"New Israeli Sheqel": {
"code": "ILS",
"symbol": "₪"
},
"Indian Rupee": {
"code": "INR",
"symbol": ""
},
"Indian Rupee Ngultrum": {
"code": "INR BTN",
"symbol": ""
},
"Iraqi Dinar": {
"code": "IQD",
"symbol": ""
},
"Iranian Rial": {
"code": "IRR",
"symbol": "﷼"
},
"Iceland Krona": {
"code": "ISK",
"symbol": "kr"
},
"Jamaican Dollar": {
"code": "JMD",
"symbol": "J$"
},
"Jordanian Dinar": {
"code": "JOD",
"symbol": ""
},
"Yen": {
"code": "JPY",
"symbol": "¥"
},
"Kenyan Shilling": {
"code": "KES",
"symbol": ""
},
"Som": {
"code": "KGS",
"symbol": "лв"
},
"Riel": {
"code": "KHR",
"symbol": "៛"
},
"Comoro Franc": {
"code": "KMF",
"symbol": ""
},
"North Korean Won": {
"code": "KPW",
"symbol": "₩"
},
"Won": {
"code": "KRW",
"symbol": "₩"
},
"Kuwaiti Dinar": {
"code": "KWD",
"symbol": ""
},
"Cayman Islands Dollar": {
"code": "KYD",
"symbol": "$"
},
"Tenge": {
"code": "KZT",
"symbol": "лв"
},
"Kip": {
"code": "LAK",
"symbol": "₭"
},
"Lebanese Pound": {
"code": "LBP",
"symbol": "£"
},
"Sri Lanka Rupee": {
"code": "LKR",
"symbol": "₨"
},
"Liberian Dollar": {
"code": "LRD",
"symbol": "$"
},
"Lithuanian Litas": {
"code": "LTL",
"symbol": "Lt"
},
"Latvian Lats": {
"code": "LVL",
"symbol": "Ls"
},
"Libyan Dinar": {
"code": "LYD",
"symbol": ""
},
"Moroccan Dirham": {
"code": "MAD",
"symbol": ""
},
"Moldovan Leu": {
"code": "MDL",
"symbol": ""
},
"Malagasy Ariary": {
"code": "MGA",
"symbol": ""
},
"Denar": {
"code": "MKD",
"symbol": "ден"
},
"Kyat": {
"code": "MMK",
"symbol": ""
},
"Tugrik": {
"code": "MNT",
"symbol": "₮"
},
"Pataca": {
"code": "MOP",
"symbol": ""
},
"Ouguiya": {
"code": "MRO",
"symbol": ""
},
"Mauritius Rupee": {
"code": "MUR",
"symbol": "₨"
},
"Rufiyaa": {
"code": "MVR",
"symbol": ""
},
"Kwacha": {
"code": "MWK",
"symbol": ""
},
"Mexican Peso Mexican Unidad de Inversion (UDI)": {
"code": "MXN MXV",
"symbol": "$"
},
"Malaysian Ringgit": {
"code": "MYR",
"symbol": "RM"
},
"Metical": {
"code": "MZN",
"symbol": "MT"
},
"Naira": {
"code": "NGN",
"symbol": "₦"
},
"Cordoba Oro": {
"code": "NIO",
"symbol": "C$"
},
"Norwegian Krone": {
"code": "NOK",
"symbol": "kr"
},
"Nepalese Rupee": {
"code": "NPR",
"symbol": "₨"
},
"New Zealand Dollar": {
"code": "NZD",
"symbol": "$"
},
"Rial Omani": {
"code": "OMR",
"symbol": "﷼"
},
"Balboa US Dollar": {
"code": "PAB USD",
"symbol": "B/."
},
"Nuevo Sol": {
"code": "PEN",
"symbol": "S/."
},
"Kina": {
"code": "PGK",
"symbol": ""
},
"Philippine Peso": {
"code": "PHP",
"symbol": "Php"
},
"Pakistan Rupee": {
"code": "PKR",
"symbol": "₨"
},
"Zloty": {
"code": "PLN",
"symbol": "zł"
},
"Guarani": {
"code": "PYG",
"symbol": "Gs"
},
"Qatari Rial": {
"code": "QAR",
"symbol": "﷼"
},
"New Leu": {
"code": "RON",
"symbol": "lei"
},
"Serbian Dinar": {
"code": "RSD",
"symbol": "Дин."
},
"Russian Ruble": {
"code": "RUB",
"symbol": "руб"
},
"Rwanda Franc": {
"code": "RWF",
"symbol": ""
},
"Saudi Riyal": {
"code": "SAR",
"symbol": "﷼"
},
"Solomon Islands Dollar": {
"code": "SBD",
"symbol": "$"
},
"Seychelles Rupee": {
"code": "SCR",
"symbol": "₨"
},
"Sudanese Pound": {
"code": "SDG",
"symbol": ""
},
"Swedish Krona": {
"code": "SEK",
"symbol": "kr"
},
"Singapore Dollar": {
"code": "SGD",
"symbol": "$"
},
"Saint Helena Pound": {
"code": "SHP",
"symbol": "£"
},
"Leone": {
"code": "SLL",
"symbol": ""
},
"Somali Shilling": {
"code": "SOS",
"symbol": "S"
},
"Surinam Dollar": {
"code": "SRD",
"symbol": "$"
},
"Dobra": {
"code": "STD",
"symbol": ""
},
"El Salvador Colon US Dollar": {
"code": "SVC USD",
"symbol": "$"
},
"Syrian Pound": {
"code": "SYP",
"symbol": "£"
},
"Lilangeni": {
"code": "SZL",
"symbol": ""
},
"Baht": {
"code": "THB",
"symbol": "฿"
},
"Somoni": {
"code": "TJS",
"symbol": ""
},
"Manat": {
"code": "TMT",
"symbol": ""
},
"Tunisian Dinar": {
"code": "TND",
"symbol": ""
},
"Pa'anga": {
"code": "TOP",
"symbol": ""
},
"Turkish Lira": {
"code": "TRY",
"symbol": "TL"
},
"Trinidad and Tobago Dollar": {
"code": "TTD",
"symbol": "TT$"
},
"New Taiwan Dollar": {
"code": "TWD",
"symbol": "NT$"
},
"Tanzanian Shilling": {
"code": "TZS",
"symbol": ""
},
"Hryvnia": {
"code": "UAH",
"symbol": "₴"
},
"Uganda Shilling": {
"code": "UGX",
"symbol": ""
},
"US Dollar": {
"code": "USD",
"symbol": "$"
},
"Peso Uruguayo Uruguay Peso en Unidades Indexadas": {
"code": "UYU UYI",
"symbol": "$U"
},
"Uzbekistan Sum": {
"code": "UZS",
"symbol": "лв"
},
"Bolivar Fuerte": {
"code": "VEF",
"symbol": "Bs"
},
"Dong": {
"code": "VND",
"symbol": "₫"
},
"Vatu": {
"code": "VUV",
"symbol": ""
},
"Tala": {
"code": "WST",
"symbol": ""
},
"CFA Franc BEAC": {
"code": "XAF",
"symbol": ""
},
"Silver": {
"code": "XAG",
"symbol": ""
},
"Gold": {
"code": "XAU",
"symbol": ""
},
"Bond Markets Units European Composite Unit (EURCO)": {
"code": "XBA",
"symbol": ""
},
"European Monetary Unit (E.M.U.-6)": {
"code": "XBB",
"symbol": ""
},
"European Unit of Account 9(E.U.A.-9)": {
"code": "XBC",
"symbol": ""
},
"European Unit of Account 17(E.U.A.-17)": {
"code": "XBD",
"symbol": ""
},
"East Caribbean Dollar": {
"code": "XCD",
"symbol": "$"
},
"SDR": {
"code": "XDR",
"symbol": ""
},
"UIC-Franc": {
"code": "XFU",
"symbol": ""
},
"CFA Franc BCEAO": {
"code": "XOF",
"symbol": ""
},
"Palladium": {
"code": "XPD",
"symbol": ""
},
"CFP Franc": {
"code": "XPF",
"symbol": ""
},
"Platinum": {
"code": "XPT",
"symbol": ""
},
"Codes specifically reserved for testing purposes": {
"code": "XTS",
"symbol": ""
},
"Yemeni Rial": {
"code": "YER",
"symbol": "﷼"
},
"Rand": {
"code": "ZAR",
"symbol": "R"
},
"Rand Loti": {
"code": "ZAR LSL",
"symbol": ""
},
"Rand Namibia Dollar": {
"code": "ZAR NAD",
"symbol": ""
},
"Zambian Kwacha": {
"code": "ZMK",
"symbol": ""
},
"Zimbabwe Dollar": {
"code": "ZWL",
"symbol": ""
}
};
},{}],102:[function(require,module,exports){
var finance = {};
module['exports'] = finance;
finance.account_type = require("./account_type");
finance.transaction_type = require("./transaction_type");
finance.currency = require("./currency");
},{"./account_type":100,"./currency":101,"./transaction_type":103}],103:[function(require,module,exports){
module["exports"] = [
"deposit",
"withdrawal",
"payment",
"invoice"
];
},{}],104:[function(require,module,exports){
module["exports"] = [
"TCP",
"HTTP",
"SDD",
"RAM",
"GB",
"CSS",
"SSL",
"AGP",
"SQL",
"FTP",
"PCI",
"AI",
"ADP",
"RSS",
"XML",
"EXE",
"COM",
"HDD",
"THX",
"SMTP",
"SMS",
"USB",
"PNG",
"SAS",
"IB",
"SCSI",
"JSON",
"XSS",
"JBOD"
];
},{}],105:[function(require,module,exports){
module["exports"] = [
"auxiliary",
"primary",
"back-end",
"digital",
"open-source",
"virtual",
"cross-platform",
"redundant",
"online",
"haptic",
"multi-byte",
"bluetooth",
"wireless",
"1080p",
"neural",
"optical",
"solid state",
"mobile"
];
},{}],106:[function(require,module,exports){
var hacker = {};
module['exports'] = hacker;
hacker.abbreviation = require("./abbreviation");
hacker.adjective = require("./adjective");
hacker.noun = require("./noun");
hacker.verb = require("./verb");
hacker.ingverb = require("./ingverb");
},{"./abbreviation":104,"./adjective":105,"./ingverb":107,"./noun":108,"./verb":109}],107:[function(require,module,exports){
module["exports"] = [
"backing up",
"bypassing",
"hacking",
"overriding",
"compressing",
"copying",
"navigating",
"indexing",
"connecting",
"generating",
"quantifying",
"calculating",
"synthesizing",
"transmitting",
"programming",
"parsing"
];
},{}],108:[function(require,module,exports){
module["exports"] = [
"driver",
"protocol",
"bandwidth",
"panel",
"microchip",
"program",
"port",
"card",
"array",
"interface",
"system",
"sensor",
"firewall",
"hard drive",
"pixel",
"alarm",
"feed",
"monitor",
"application",
"transmitter",
"bus",
"circuit",
"capacitor",
"matrix"
];
},{}],109:[function(require,module,exports){
module["exports"] = [
"back up",
"bypass",
"hack",
"override",
"compress",
"copy",
"navigate",
"index",
"connect",
"generate",
"quantify",
"calculate",
"synthesize",
"input",
"transmit",
"program",
"reboot",
"parse"
];
},{}],110:[function(require,module,exports){
var en = {};
module['exports'] = en;
en.title = "English";
en.separator = " & ";
en.address = require("./address");
en.credit_card = require("./credit_card");
en.company = require("./company");
en.internet = require("./internet");
en.lorem = require("./lorem");
en.name = require("./name");
en.phone_number = require("./phone_number");
en.cell_phone = require("./cell_phone");
en.business = require("./business");
en.commerce = require("./commerce");
en.team = require("./team");
en.hacker = require("./hacker");
en.app = require("./app");
en.finance = require("./finance");
en.date = require("./date");
en.system = require("./system");
},{"./address":53,"./app":64,"./business":70,"./cell_phone":72,"./commerce":75,"./company":82,"./credit_card":89,"./date":97,"./finance":102,"./hacker":106,"./internet":115,"./lorem":116,"./name":120,"./phone_number":127,"./system":128,"./team":131}],111:[function(require,module,exports){
module["exports"] = [
"https://s3.amazonaws.com/uifaces/faces/twitter/jarjan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mahdif/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sprayaga/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ruzinav/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/Skyhartman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/moscoz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kurafire/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/91bilal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/igorgarybaldi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/calebogden/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/malykhinv/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joelhelin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kushsolitary/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/coreyweb/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/snowshade/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/areus/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/holdenweb/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/heyimjuani/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/envex/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/unterdreht/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/collegeman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/peejfancher/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andyisonline/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ultragex/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/fuck_you_two/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/adellecharles/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ateneupopular/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ahmetalpbalkan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/Stievius/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kerem/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/osvaldas/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/angelceballos/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thierrykoblentz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/peterlandt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/catarino/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/wr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/weglov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/brandclay/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/flame_kaizar/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ahmetsulek/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nicolasfolliot/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jayrobinson/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/victorerixon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kolage/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/michzen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/markjenkins/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nicolai_larsen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/noxdzine/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alagoon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/idiot/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mizko/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chadengle/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mutlu82/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/simobenso/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vocino/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/guiiipontes/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/soyjavi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joshaustin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tomaslau/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/VinThomas/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ManikRathee/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/langate/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cemshid/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/leemunroe/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/_shahedk/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/enda/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/BillSKenney/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/divya/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joshhemsley/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sindresorhus/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/soffes/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/9lessons/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/linux29/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/Chakintosh/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/anaami/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joreira/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/shadeed9/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/scottkclark/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jedbridges/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/salleedesign/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marakasina/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ariil/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/BrianPurkiss/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/michaelmartinho/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bublienko/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/devankoshal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ZacharyZorbas/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/timmillwood/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joshuasortino/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/damenleeturks/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tomas_janousek/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/herrhaase/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/RussellBishop/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/brajeshwar/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nachtmeister/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cbracco/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bermonpainter/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/abdullindenis/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/isacosta/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/suprb/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/yalozhkin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chandlervdw/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/iamgarth/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/_victa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/commadelimited/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/roybarberuk/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/axel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vladarbatov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ffbel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/syropian/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ankitind/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/traneblow/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/flashmurphy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ChrisFarina78/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/baliomega/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/saschamt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jm_denis/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/anoff/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kennyadr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chatyrko/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dingyi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mds/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/terryxlife/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aaroni/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kinday/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/prrstn/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/eduardostuart/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dhilipsiva/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/GavicoInd/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/baires/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rohixx/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bigmancho/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/blakesimkins/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/leeiio/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tjrus/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/uberschizo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kylefoundry/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/claudioguglieri/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ripplemdk/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/exentrich/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jakemoore/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joaoedumedeiros/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/poormini/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tereshenkov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/keryilmaz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/haydn_woods/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rude/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/llun/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sgaurav_baghel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jamiebrittain/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/badlittleduck/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/pifagor/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/agromov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/benefritz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/erwanhesry/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/diesellaws/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jeremiaha/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/koridhandy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chaensel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andrewcohen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/smaczny/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gonzalorobaina/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nandini_m/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sydlawrence/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cdharrison/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tgerken/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lewisainslie/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/charliecwaite/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/robbschiller/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/flexrs/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mattdetails/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/raquelwilson/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/karsh/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mrmartineau/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/opnsrce/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hgharrygo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/maximseshuk/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/uxalex/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/samihah/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chanpory/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sharvin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/josemarques/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jefffis/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/krystalfister/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lokesh_coder/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thedamianhdez/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dpmachado/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/funwatercat/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/timothycd/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ivanfilipovbg/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/picard102/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marcobarbosa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/krasnoukhov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/g3d/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ademilter/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rickdt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/operatino/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bungiwan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hugomano/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/logorado/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dc_user/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/horaciobella/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/SlaapMe/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/teeragit/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/iqonicd/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ilya_pestov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andrewarrow/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ssiskind/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/stan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/HenryHoffman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rdsaunders/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/adamsxu/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/curiousoffice/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/themadray/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/michigangraham/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kohette/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nickfratter/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/runningskull/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/madysondesigns/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/brenton_clarke/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jennyshen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bradenhamm/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kurtinc/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/amanruzaini/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/coreyhaggard/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/Karimmove/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aaronalfred/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/wtrsld/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jitachi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/therealmarvin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/pmeissner/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ooomz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chacky14/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jesseddy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thinmatt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/shanehudson/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/akmur/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/IsaryAmairani/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/arthurholcombe1/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andychipster/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/boxmodel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ehsandiary/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/LucasPerdidao/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/shalt0ni/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/swaplord/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kaelifa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/plbabin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/guillemboti/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/arindam_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/renbyrd/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thiagovernetti/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jmillspaysbills/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mikemai2awesome/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jervo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mekal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sta1ex/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/robergd/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/felipecsl/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andrea211087/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/garand/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dhooyenga/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/abovefunction/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/pcridesagain/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/randomlies/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/BryanHorsey/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/heykenneth/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dahparra/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/allthingssmitty/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/danvernon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/beweinreich/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/increase/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/falvarad/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alxndrustinov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/souuf/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/orkuncaylar/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/AM_Kn2/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gearpixels/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bassamology/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vimarethomas/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kosmar/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/SULiik/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mrjamesnoble/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/silvanmuhlemann/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/shaneIxD/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nacho/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/yigitpinarbasi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/buzzusborne/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aaronkwhite/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rmlewisuk/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/giancarlon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nbirckel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/d_nny_m_cher/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sdidonato/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/atariboy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/abotap/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/karalek/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/psdesignuk/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ludwiczakpawel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nemanjaivanovic/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/baluli/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ahmadajmi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vovkasolovev/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/samgrover/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/derienzo777/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jonathansimmons/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nelsonjoyce/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/S0ufi4n3/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/xtopherpaul/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/oaktreemedia/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nateschulte/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/findingjenny/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/namankreative/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/antonyzotov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/we_social/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/leehambley/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/solid_color/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/abelcabans/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mbilderbach/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kkusaa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jordyvdboom/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/carlosgavina/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/pechkinator/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vc27/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rdbannon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/croakx/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/suribbles/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kerihenare/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/catadeleon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gcmorley/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/duivvv/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/saschadroste/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/victorDubugras/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/wintopia/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mattbilotti/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/taylorling/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/megdraws/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/meln1ks/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mahmoudmetwally/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/Silveredge9/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/derekebradley/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/happypeter1983/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/travis_arnold/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/artem_kostenko/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/adobi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/daykiine/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alek_djuric/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/scips/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/miguelmendes/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/justinrhee/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alsobrooks/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/fronx/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mcflydesign/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/santi_urso/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/allfordesign/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/stayuber/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bertboerland/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marosholly/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/adamnac/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cynthiasavard/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/muringa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/danro/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hiemil/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jackiesaik/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/zacsnider/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/iduuck/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/antjanus/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aroon_sharma/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dshster/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thehacker/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/michaelbrooksjr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ryanmclaughlin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/clubb3rry/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/taybenlor/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/xripunov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/myastro/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/adityasutomo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/digitalmaverick/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hjartstrorn/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/itolmach/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vaughanmoffitt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/abdots/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/isnifer/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sergeysafonov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/maz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/scrapdnb/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chrismj83/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vitorleal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sokaniwaal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/zaki3d/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/illyzoren/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mocabyte/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/osmanince/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/djsherman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/davidhemphill/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/waghner/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/necodymiconer/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/praveen_vijaya/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/fabbrucci/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cliffseal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/travishines/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kuldarkalvik/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/Elt_n/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/phillapier/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/okseanjay/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/id835559/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kudretkeskin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/anjhero/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/duck4fuck/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/scott_riley/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/noufalibrahim/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/h1brd/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/borges_marcos/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/devinhalladay/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ciaranr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/stefooo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mikebeecham/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tonymillion/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joshuaraichur/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/irae/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/petrangr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dmitriychuta/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/charliegann/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/arashmanteghi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ainsleywagon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/svenlen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/faisalabid/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/beshur/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/carlyson/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dutchnadia/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/teddyzetterlund/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/samuelkraft/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aoimedia/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/toddrew/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/codepoet_ru/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/artvavs/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/benoitboucart/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jomarmen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kolmarlopez/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/creartinc/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/homka/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gaborenton/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/robinclediere/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/maximsorokin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/plasticine/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/j2deme/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/peachananr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kapaluccio/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/de_ascanio/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rikas/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dawidwu/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marcoramires/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/angelcreative/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rpatey/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/popey/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rehatkathuria/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/the_purplebunny/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/1markiz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ajaxy_ru/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/brenmurrell/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dudestein/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/oskarlevinson/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/victorstuber/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nehfy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vicivadeline/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/leandrovaranda/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/scottgallant/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/victor_haydin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sawrb/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ryhanhassan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/amayvs/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/a_brixen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/karolkrakowiak_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/herkulano/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/geran7/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cggaurav/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chris_witko/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lososina/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/polarity/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mattlat/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/brandonburke/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/constantx/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/teylorfeliz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/craigelimeliah/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rachelreveley/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/reabo101/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rahmeen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ky/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rickyyean/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/j04ntoh/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/spbroma/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sebashton/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jpenico/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/francis_vega/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/oktayelipek/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kikillo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/fabbianz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/larrygerard/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/BroumiYoussef/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/0therplanet/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mbilalsiddique1/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ionuss/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/grrr_nl/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/liminha/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rawdiggie/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ryandownie/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sethlouey/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/pixage/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/arpitnj/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/switmer777/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/josevnclch/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kanickairaj/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/puzik/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tbakdesigns/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/besbujupi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/supjoey/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lowie/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/linkibol/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/balintorosz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/imcoding/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/agustincruiz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gusoto/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thomasschrijer/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/superoutman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kalmerrautam/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gabrielizalo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gojeanyn/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/davidbaldie/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/_vojto/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/laurengray/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jydesign/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mymyboy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nellleo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marciotoledo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ninjad3m0/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/to_soham/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hasslunsford/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/muridrahhal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/levisan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/grahamkennery/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lepetitogre/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/antongenkin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nessoila/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/amandabuzard/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/safrankov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cocolero/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dss49/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/matt3224/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bluesix/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/quailandquasar/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/AlbertoCococi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lepinski/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sementiy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mhudobivnik/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thibaut_re/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/olgary/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/shojberg/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mtolokonnikov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bereto/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/naupintos/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/wegotvices/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/xadhix/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/macxim/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rodnylobos/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/madcampos/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/madebyvadim/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bartoszdawydzik/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/supervova/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/markretzloff/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vonachoo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/darylws/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/stevedesigner/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mylesb/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/herbigt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/depaulawagner/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/geshan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gizmeedevil1991/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/_scottburgess/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lisovsky/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/davidsasda/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/artd_sign/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/YoungCutlass/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mgonto/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/itstotallyamy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/victorquinn/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/osmond/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/oksanafrewer/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/zauerkraut/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/iamkeithmason/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nitinhayaran/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lmjabreu/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mandalareopens/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thinkleft/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ponchomendivil/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/juamperro/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/brunodesign1206/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/caseycavanagh/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/luxe/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dotgridline/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/spedwig/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/madewulf/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mattsapii/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/helderleal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chrisstumph/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jayphen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nsamoylov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chrisvanderkooi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/justme_timothyg/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/otozk/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/prinzadi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gu5taf/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cyril_gaillard/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/d_kobelyatsky/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/daniloc/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nwdsha/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/romanbulah/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/skkirilov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dvdwinden/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dannol/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thekevinjones/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jwalter14/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/timgthomas/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/buddhasource/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/uxpiper/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thatonetommy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/diansigitp/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/adrienths/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/klimmka/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gkaam/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/derekcramer/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jennyyo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/xalionmalik/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/edhenderson/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/keyuri85/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/roxanejammet/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kimcool/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/edkf/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/matkins/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alessandroribe/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jacksonlatka/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lebronjennan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kostaspt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/karlkanall/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/moynihan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/danpliego/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/saulihirvi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/wesleytrankin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/fjaguero/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bowbrick/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mashaaaaal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/yassiryahya/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dparrelli/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/fotomagin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aka_james/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/denisepires/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/iqbalperkasa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/martinansty/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jarsen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/r_oy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/justinrob/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gabrielrosser/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/malgordon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/carlfairclough/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/michaelabehsera/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/pierrestoffe/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/enjoythetau/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/loganjlambert/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rpeezy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/coreyginnivan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/michalhron/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/msveet/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lingeswaran/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kolsvein/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/peter576/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/reideiredale/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joeymurdah/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/raphaelnikson/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mvdheuvel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/maxlinderman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jimmuirhead/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/begreative/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/frankiefreesbie/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/robturlinckx/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/Talbi_ConSept/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/longlivemyword/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vanchesz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/maiklam/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hermanobrother/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rez___a/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gregsqueeb/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/greenbes/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/_ragzor/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/anthonysukow/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/fluidbrush/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dactrtr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jehnglynn/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bergmartin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hugocornejo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/_kkga/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dzantievm/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sawalazar/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sovesove/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jonsgotwood/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/byryan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vytautas_a/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mizhgan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cicerobr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nilshelmersson/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/d33pthought/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/davecraige/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nckjrvs/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alexandermayes/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jcubic/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/craigrcoles/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bagawarman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rob_thomas10/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cofla/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/maikelk/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rtgibbons/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/russell_baylis/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mhesslow/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/codysanfilippo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/webtanya/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/madebybrenton/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dcalonaci/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/perfectflow/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jjsiii/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/saarabpreet/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kumarrajan12123/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/iamsteffen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/themikenagle/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ceekaytweet/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/larrybolt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/conspirator/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dallasbpeters/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/n3dmax/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/terpimost/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kirillz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/byrnecore/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/j_drake_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/calebjoyce/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/russoedu/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hoangloi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tobysaxon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gofrasdesign/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dimaposnyy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tjisousa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/okandungel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/billyroshan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/oskamaya/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/motionthinks/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/knilob/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ashocka18/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marrimo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bartjo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/omnizya/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ernestsemerda/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andreas_pr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/edgarchris99/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thomasgeisen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gseguin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joannefournier/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/demersdesigns/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/adammarsbar/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nasirwd/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/n_tassone/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/javorszky/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/themrdave/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/yecidsm/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nicollerich/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/canapud/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nicoleglynn/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/judzhin_miles/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/designervzm/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kianoshp/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/evandrix/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alterchuca/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dhrubo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ma_tiax/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ssbb_me/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dorphern/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mauriolg/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bruno_mart/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mactopus/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/the_winslet/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joemdesign/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/Shriiiiimp/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jacobbennett/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nfedoroff/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/iamglimy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/allagringaus/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aiiaiiaii/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/olaolusoga/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/buryaknick/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/wim1k/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nicklacke/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/a1chapone/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/steynviljoen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/strikewan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ryankirkman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andrewabogado/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/doooon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jagan123/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ariffsetiawan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/elenadissi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mwarkentin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thierrymeier_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/r_garcia/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dmackerman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/borantula/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/konus/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/spacewood_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ryuchi311/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/evanshajed/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tristanlegros/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/shoaib253/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aislinnkelly/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/okcoker/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/timpetricola/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sunshinedgirl/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chadami/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aleclarsoniv/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nomidesigns/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/petebernardo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/scottiedude/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/millinet/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/imsoper/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/imammuht/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/benjamin_knight/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nepdud/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joki4/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lanceguyatt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bboy1895/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/amywebbb/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rweve/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/haruintesettden/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ricburton/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nelshd/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/batsirai/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/primozcigler/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jffgrdnr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/8d3k/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/geneseleznev/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/al_li/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/souperphly/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mslarkina/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/2fockus/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cdavis565/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/xiel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/turkutuuli/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/uxward/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lebinoclard/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gauravjassal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/davidmerrique/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mdsisto/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andrewofficer/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kojourin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dnirmal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kevka/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mr_shiznit/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aluisio_azevedo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cloudstudio/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/danvierich/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alexivanichkin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/fran_mchamy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/perretmagali/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/betraydan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cadikkara/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/matbeedotcom/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jeremyworboys/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bpartridge/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/michaelkoper/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/silv3rgvn/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alevizio/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/johnsmithagency/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lawlbwoy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vitor376/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/desastrozo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thimo_cz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jasonmarkjones/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lhausermann/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/xravil/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/guischmitt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vigobronx/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/panghal0/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/miguelkooreman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/surgeonist/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/christianoliff/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/caspergrl/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/iamkarna/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ipavelek/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/pierre_nel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/y2graphic/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sterlingrules/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/elbuscainfo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bennyjien/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/stushona/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/estebanuribe/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/embrcecreations/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/danillos/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/elliotlewis/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/charlesrpratt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vladyn/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/emmeffess/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/carlosblanco_eu/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/leonfedotov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rangafangs/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chris_frees/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tgormtx/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bryan_topham/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jpscribbles/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mighty55/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/carbontwelve/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/isaacfifth/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/iamjdeleon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/snowwrite/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/barputro/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/drewbyreese/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sachacorazzi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bistrianiosip/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/magoo04/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/pehamondello/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/yayteejay/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/a_harris88/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/algunsanabria/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/zforrester/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ovall/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/carlosjgsousa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/geobikas/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ah_lice/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/looneydoodle/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nerdgr8/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ddggccaa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/zackeeler/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/normanbox/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/el_fuertisimo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ismail_biltagi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/juangomezw/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jnmnrd/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/patrickcoombe/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ryanjohnson_me/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/markolschesky/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jeffgolenski/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kvasnic/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lindseyzilla/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gauchomatt/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/afusinatto/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kevinoh/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/okansurreel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/adamawesomeface/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/emileboudeling/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/arishi_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/juanmamartinez/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/wikiziner/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/danthms/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mkginfo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/terrorpixel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/curiousonaut/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/prheemo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/michaelcolenso/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/foczzi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/martip07/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thaodang17/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/johncafazza/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/robinlayfield/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/franciscoamk/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/abdulhyeuk/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marklamb/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/edobene/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andresenfredrik/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mikaeljorhult/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chrisslowik/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vinciarts/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/meelford/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/elliotnolten/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/yehudab/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vijaykarthik/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bfrohs/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/josep_martins/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/attacks/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sur4dye/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tumski/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/instalox/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mangosango/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/paulfarino/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kazaky999/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kiwiupover/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nvkznemo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tom_even/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ratbus/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/woodsman001/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joshmedeski/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thewillbeard/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/psaikali/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joe_black/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aleinadsays/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marcusgorillius/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hota_v/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jghyllebert/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/shinze/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/janpalounek/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jeremiespoken/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/her_ruu/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dansowter/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/felipeapiress/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/magugzbrand2d/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/posterjob/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nathalie_fs/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bobbytwoshoes/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dreizle/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jeremymouton/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/elisabethkjaer/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/notbadart/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mohanrohith/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jlsolerdeltoro/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/itskawsar/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/slowspock/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/zvchkelly/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/wiljanslofstra/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/craighenneberry/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/trubeatto/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/juaumlol/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/samscouto/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/BenouarradeM/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gipsy_raf/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/netonet_il/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/arkokoley/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/itsajimithing/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/smalonso/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/victordeanda/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/_dwite_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/richardgarretts/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gregrwilkinson/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/anatolinicolae/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lu4sh1i/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/stefanotirloni/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ostirbu/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/darcystonge/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/naitanamoreno/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/michaelcomiskey/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/adhiardana/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marcomano_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/davidcazalis/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/falconerie/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gregkilian/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bcrad/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bolzanmarco/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/low_res/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vlajki/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/petar_prog/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jonkspr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/akmalfikri/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mfacchinello/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/atanism/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/harry_sistalam/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/murrayswift/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bobwassermann/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gavr1l0/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/madshensel/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mr_subtle/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/deviljho_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/salimianoff/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joetruesdell/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/twittypork/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/airskylar/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dnezkumar/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dgajjar/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cherif_b/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/salvafc/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/louis_currie/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/deeenright/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cybind/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/eyronn/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vickyshits/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sweetdelisa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/cboller1/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andresdjasso/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/melvindidit/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andysolomon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thaisselenator_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lvovenok/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/giuliusa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/belyaev_rs/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/overcloacked/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kamal_chaneman/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/incubo82/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hellofeverrrr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mhaligowski/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sunlandictwin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bu7921/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/andytlaw/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jeremery/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/finchjke/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/manigm/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/umurgdk/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/scottfeltham/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ganserene/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mutu_krish/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jodytaggart/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ntfblog/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tanveerrao/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hfalucas/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alxleroydeval/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kucingbelang4/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bargaorobalo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/colgruv/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/stalewine/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kylefrost/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/baumannzone/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/angelcolberg/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sachingawas/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jjshaw14/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ramanathan_pdy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/johndezember/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nilshoenson/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/brandonmorreale/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nutzumi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/brandonflatsoda/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sergeyalmone/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/klefue/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kirangopal/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/baumann_alex/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/matthewkay_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jay_wilburn/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/shesgared/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/apriendeau/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/johnriordan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/wake_gs/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aleksitappura/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/emsgulam/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/xilantra/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/imomenui/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sircalebgrove/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/newbrushes/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hsinyo23/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/m4rio/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/katiemdaly/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/s4f1/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ecommerceil/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marlinjayakody/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/swooshycueb/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sangdth/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/coderdiaz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bluefx_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vivekprvr/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sasha_shestakov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/eugeneeweb/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dgclegg/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/n1ght_coder/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dixchen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/blakehawksworth/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/trueblood_33/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hai_ninh_nguyen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marclgonzales/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/yesmeck/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/stephcoue/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/doronmalki/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ruehldesign/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/anasnakawa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kijanmaharjan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/wearesavas/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/stefvdham/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tweetubhai/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alecarpentier/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/fiterik/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/antonyryndya/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/d00maz/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/theonlyzeke/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/missaaamy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/carlosm/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/manekenthe/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/reetajayendra/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jeremyshimko/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/justinrgraham/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/stefanozoffoli/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/overra/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mrebay007/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/shvelo96/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/pyronite/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/thedjpetersen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/rtyukmaev/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/_williamguerra/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/albertaugustin/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vikashpathak18/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kevinjohndayy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vj_demien/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/colirpixoil/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/goddardlewis/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/laasli/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jqiuss/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/heycamtaylor/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nastya_mane/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mastermindesign/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ccinojasso1/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/nyancecom/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sandywoodruff/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/bighanddesign/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sbtransparent/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aviddayentonbay/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/richwild/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kaysix_dizzy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/tur8le/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/seyedhossein1/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/privetwagner/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/emmandenn/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dev_essentials/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jmfsocial/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/_yardenoon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mateaodviteza/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/weavermedia/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mufaddal_mw/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hafeeskhan/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ashernatali/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sulaqo/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/eddiechen/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/josecarlospsh/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vm_f/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/enricocicconi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/danmartin70/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/gmourier/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/donjain/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mrxloka/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/_pedropinho/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/eitarafa/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/oscarowusu/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ralph_lam/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/panchajanyag/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/woodydotmx/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/jerrybai1907/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/marshallchen_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/xamorep/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aio___/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/chaabane_wail/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/txcx/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/akashsharma39/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/falling_soul/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sainraja/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mugukamil/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/johannesneu/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/markwienands/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/karthipanraj/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/balakayuriy/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/alan_zhang_/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/layerssss/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/kaspernordkvist/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/mirfanqureshi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/hanna_smi/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/VMilescu/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/aeon56/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/m_kalibry/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/sreejithexp/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dicesales/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/dhoot_amit/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/smenov/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/lonesomelemon/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vladimirdevic/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/joelcipriano/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/haligaliharun/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/buleswapnil/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/serefka/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/ifarafonow/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/vikasvinfotech/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/urrutimeoli/128.jpg",
"https://s3.amazonaws.com/uifaces/faces/twitter/areandacom/128.jpg"
];
},{}],112:[function(require,module,exports){
module["exports"] = [
"com",
"biz",
"info",
"name",
"net",
"org"
];
},{}],113:[function(require,module,exports){
module["exports"] = [
"example.org",
"example.com",
"example.net"
];
},{}],114:[function(require,module,exports){
module["exports"] = [
"gmail.com",
"yahoo.com",
"hotmail.com"
];
},{}],115:[function(require,module,exports){
var internet = {};
module['exports'] = internet;
internet.free_email = require("./free_email");
internet.example_email = require("./example_email");
internet.domain_suffix = require("./domain_suffix");
internet.avatar_uri = require("./avatar_uri");
},{"./avatar_uri":111,"./domain_suffix":112,"./example_email":113,"./free_email":114}],116:[function(require,module,exports){
var lorem = {};
module['exports'] = lorem;
lorem.words = require("./words");
lorem.supplemental = require("./supplemental");
},{"./supplemental":117,"./words":118}],117:[function(require,module,exports){
module["exports"] = [
"abbas",
"abduco",
"abeo",
"abscido",
"absconditus",
"absens",
"absorbeo",
"absque",
"abstergo",
"absum",
"abundans",
"abutor",
"accedo",
"accendo",
"acceptus",
"accipio",
"accommodo",
"accusator",
"acer",
"acerbitas",
"acervus",
"acidus",
"acies",
"acquiro",
"acsi",
"adamo",
"adaugeo",
"addo",
"adduco",
"ademptio",
"adeo",
"adeptio",
"adfectus",
"adfero",
"adficio",
"adflicto",
"adhaero",
"adhuc",
"adicio",
"adimpleo",
"adinventitias",
"adipiscor",
"adiuvo",
"administratio",
"admiratio",
"admitto",
"admoneo",
"admoveo",
"adnuo",
"adopto",
"adsidue",
"adstringo",
"adsuesco",
"adsum",
"adulatio",
"adulescens",
"adultus",
"aduro",
"advenio",
"adversus",
"advoco",
"aedificium",
"aeger",
"aegre",
"aegrotatio",
"aegrus",
"aeneus",
"aequitas",
"aequus",
"aer",
"aestas",
"aestivus",
"aestus",
"aetas",
"aeternus",
"ager",
"aggero",
"aggredior",
"agnitio",
"agnosco",
"ago",
"ait",
"aiunt",
"alienus",
"alii",
"alioqui",
"aliqua",
"alius",
"allatus",
"alo",
"alter",
"altus",
"alveus",
"amaritudo",
"ambitus",
"ambulo",
"amicitia",
"amiculum",
"amissio",
"amita",
"amitto",
"amo",
"amor",
"amoveo",
"amplexus",
"amplitudo",
"amplus",
"ancilla",
"angelus",
"angulus",
"angustus",
"animadverto",
"animi",
"animus",
"annus",
"anser",
"ante",
"antea",
"antepono",
"antiquus",
"aperio",
"aperte",
"apostolus",
"apparatus",
"appello",
"appono",
"appositus",
"approbo",
"apto",
"aptus",
"apud",
"aqua",
"ara",
"aranea",
"arbitro",
"arbor",
"arbustum",
"arca",
"arceo",
"arcesso",
"arcus",
"argentum",
"argumentum",
"arguo",
"arma",
"armarium",
"armo",
"aro",
"ars",
"articulus",
"artificiose",
"arto",
"arx",
"ascisco",
"ascit",
"asper",
"aspicio",
"asporto",
"assentator",
"astrum",
"atavus",
"ater",
"atqui",
"atrocitas",
"atrox",
"attero",
"attollo",
"attonbitus",
"auctor",
"auctus",
"audacia",
"audax",
"audentia",
"audeo",
"audio",
"auditor",
"aufero",
"aureus",
"auris",
"aurum",
"aut",
"autem",
"autus",
"auxilium",
"avaritia",
"avarus",
"aveho",
"averto",
"avoco",
"baiulus",
"balbus",
"barba",
"bardus",
"basium",
"beatus",
"bellicus",
"bellum",
"bene",
"beneficium",
"benevolentia",
"benigne",
"bestia",
"bibo",
"bis",
"blandior",
"bonus",
"bos",
"brevis",
"cado",
"caecus",
"caelestis",
"caelum",
"calamitas",
"calcar",
"calco",
"calculus",
"callide",
"campana",
"candidus",
"canis",
"canonicus",
"canto",
"capillus",
"capio",
"capitulus",
"capto",
"caput",
"carbo",
"carcer",
"careo",
"caries",
"cariosus",
"caritas",
"carmen",
"carpo",
"carus",
"casso",
"caste",
"casus",
"catena",
"caterva",
"cattus",
"cauda",
"causa",
"caute",
"caveo",
"cavus",
"cedo",
"celebrer",
"celer",
"celo",
"cena",
"cenaculum",
"ceno",
"censura",
"centum",
"cerno",
"cernuus",
"certe",
"certo",
"certus",
"cervus",
"cetera",
"charisma",
"chirographum",
"cibo",
"cibus",
"cicuta",
"cilicium",
"cimentarius",
"ciminatio",
"cinis",
"circumvenio",
"cito",
"civis",
"civitas",
"clam",
"clamo",
"claro",
"clarus",
"claudeo",
"claustrum",
"clementia",
"clibanus",
"coadunatio",
"coaegresco",
"coepi",
"coerceo",
"cogito",
"cognatus",
"cognomen",
"cogo",
"cohaero",
"cohibeo",
"cohors",
"colligo",
"colloco",
"collum",
"colo",
"color",
"coma",
"combibo",
"comburo",
"comedo",
"comes",
"cometes",
"comis",
"comitatus",
"commemoro",
"comminor",
"commodo",
"communis",
"comparo",
"compello",
"complectus",
"compono",
"comprehendo",
"comptus",
"conatus",
"concedo",
"concido",
"conculco",
"condico",
"conduco",
"confero",
"confido",
"conforto",
"confugo",
"congregatio",
"conicio",
"coniecto",
"conitor",
"coniuratio",
"conor",
"conqueror",
"conscendo",
"conservo",
"considero",
"conspergo",
"constans",
"consuasor",
"contabesco",
"contego",
"contigo",
"contra",
"conturbo",
"conventus",
"convoco",
"copia",
"copiose",
"cornu",
"corona",
"corpus",
"correptius",
"corrigo",
"corroboro",
"corrumpo",
"coruscus",
"cotidie",
"crapula",
"cras",
"crastinus",
"creator",
"creber",
"crebro",
"credo",
"creo",
"creptio",
"crepusculum",
"cresco",
"creta",
"cribro",
"crinis",
"cruciamentum",
"crudelis",
"cruentus",
"crur",
"crustulum",
"crux",
"cubicularis",
"cubitum",
"cubo",
"cui",
"cuius",
"culpa",
"culpo",
"cultellus",
"cultura",
"cum",
"cunabula",
"cunae",
"cunctatio",
"cupiditas",
"cupio",
"cuppedia",
"cupressus",
"cur",
"cura",
"curatio",
"curia",
"curiositas",
"curis",
"curo",
"curriculum",
"currus",
"cursim",
"curso",
"cursus",
"curto",
"curtus",
"curvo",
"curvus",
"custodia",
"damnatio",
"damno",
"dapifer",
"debeo",
"debilito",
"decens",
"decerno",
"decet",
"decimus",
"decipio",
"decor",
"decretum",
"decumbo",
"dedecor",
"dedico",
"deduco",
"defaeco",
"defendo",
"defero",
"defessus",
"defetiscor",
"deficio",
"defigo",
"defleo",
"defluo",
"defungo",
"degenero",
"degero",
"degusto",
"deinde",
"delectatio",
"delego",
"deleo",
"delibero",
"delicate",
"delinquo",
"deludo",
"demens",
"demergo",
"demitto",
"demo",
"demonstro",
"demoror",
"demulceo",
"demum",
"denego",
"denique",
"dens",
"denuncio",
"denuo",
"deorsum",
"depereo",
"depono",
"depopulo",
"deporto",
"depraedor",
"deprecator",
"deprimo",
"depromo",
"depulso",
"deputo",
"derelinquo",
"derideo",
"deripio",
"desidero",
"desino",
"desipio",
"desolo",
"desparatus",
"despecto",
"despirmatio",
"infit",
"inflammatio",
"paens",
"patior",
"patria",
"patrocinor",
"patruus",
"pauci",
"paulatim",
"pauper",
"pax",
"peccatus",
"pecco",
"pecto",
"pectus",
"pecunia",
"pecus",
"peior",
"pel",
"ocer",
"socius",
"sodalitas",
"sol",
"soleo",
"solio",
"solitudo",
"solium",
"sollers",
"sollicito",
"solum",
"solus",
"solutio",
"solvo",
"somniculosus",
"somnus",
"sonitus",
"sono",
"sophismata",
"sopor",
"sordeo",
"sortitus",
"spargo",
"speciosus",
"spectaculum",
"speculum",
"sperno",
"spero",
"spes",
"spiculum",
"spiritus",
"spoliatio",
"sponte",
"stabilis",
"statim",
"statua",
"stella",
"stillicidium",
"stipes",
"stips",
"sto",
"strenuus",
"strues",
"studio",
"stultus",
"suadeo",
"suasoria",
"sub",
"subito",
"subiungo",
"sublime",
"subnecto",
"subseco",
"substantia",
"subvenio",
"succedo",
"succurro",
"sufficio",
"suffoco",
"suffragium",
"suggero",
"sui",
"sulum",
"sum",
"summa",
"summisse",
"summopere",
"sumo",
"sumptus",
"supellex",
"super",
"suppellex",
"supplanto",
"suppono",
"supra",
"surculus",
"surgo",
"sursum",
"suscipio",
"suspendo",
"sustineo",
"suus",
"synagoga",
"tabella",
"tabernus",
"tabesco",
"tabgo",
"tabula",
"taceo",
"tactus",
"taedium",
"talio",
"talis",
"talus",
"tam",
"tamdiu",
"tamen",
"tametsi",
"tamisium",
"tamquam",
"tandem",
"tantillus",
"tantum",
"tardus",
"tego",
"temeritas",
"temperantia",
"templum",
"temptatio",
"tempus",
"tenax",
"tendo",
"teneo",
"tener",
"tenuis",
"tenus",
"tepesco",
"tepidus",
"ter",
"terebro",
"teres",
"terga",
"tergeo",
"tergiversatio",
"tergo",
"tergum",
"termes",
"terminatio",
"tero",
"terra",
"terreo",
"territo",
"terror",
"tersus",
"tertius",
"testimonium",
"texo",
"textilis",
"textor",
"textus",
"thalassinus",
"theatrum",
"theca",
"thema",
"theologus",
"thermae",
"thesaurus",
"thesis",
"thorax",
"thymbra",
"thymum",
"tibi",
"timidus",
"timor",
"titulus",
"tolero",
"tollo",
"tondeo",
"tonsor",
"torqueo",
"torrens",
"tot",
"totidem",
"toties",
"totus",
"tracto",
"trado",
"traho",
"trans",
"tredecim",
"tremo",
"trepide",
"tres",
"tribuo",
"tricesimus",
"triduana",
"triginta",
"tripudio",
"tristis",
"triumphus",
"trucido",
"truculenter",
"tubineus",
"tui",
"tum",
"tumultus",
"tunc",
"turba",
"turbo",
"turpe",
"turpis",
"tutamen",
"tutis",
"tyrannus",
"uberrime",
"ubi",
"ulciscor",
"ullus",
"ulterius",
"ultio",
"ultra",
"umbra",
"umerus",
"umquam",
"una",
"unde",
"undique",
"universe",
"unus",
"urbanus",
"urbs",
"uredo",
"usitas",
"usque",
"ustilo",
"ustulo",
"usus",
"uter",
"uterque",
"utilis",
"utique",
"utor",
"utpote",
"utrimque",
"utroque",
"utrum",
"uxor",
"vaco",
"vacuus",
"vado",
"vae",
"valde",
"valens",
"valeo",
"valetudo",
"validus",
"vallum",
"vapulus",
"varietas",
"varius",
"vehemens",
"vel",
"velociter",
"velum",
"velut",
"venia",
"venio",
"ventito",
"ventosus",
"ventus",
"venustas",
"ver",
"verbera",
"verbum",
"vere",
"verecundia",
"vereor",
"vergo",
"veritas",
"vero",
"versus",
"verto",
"verumtamen",
"verus",
"vesco",
"vesica",
"vesper",
"vespillo",
"vester",
"vestigium",
"vestrum",
"vetus",
"via",
"vicinus",
"vicissitudo",
"victoria",
"victus",
"videlicet",
"video",
"viduata",
"viduo",
"vigilo",
"vigor",
"vilicus",
"vilis",
"vilitas",
"villa",
"vinco",
"vinculum",
"vindico",
"vinitor",
"vinum",
"vir",
"virga",
"virgo",
"viridis",
"viriliter",
"virtus",
"vis",
"viscus",
"vita",
"vitiosus",
"vitium",
"vito",
"vivo",
"vix",
"vobis",
"vociferor",
"voco",
"volaticus",
"volo",
"volubilis",
"voluntarius",
"volup",
"volutabrum",
"volva",
"vomer",
"vomica",
"vomito",
"vorago",
"vorax",
"voro",
"vos",
"votum",
"voveo",
"vox",
"vulariter",
"vulgaris",
"vulgivagus",
"vulgo",
"vulgus",
"vulnero",
"vulnus",
"vulpes",
"vulticulus",
"vultuosus",
"xiphias"
];
},{}],118:[function(require,module,exports){
module["exports"] = [
"alias",
"consequatur",
"aut",
"perferendis",
"sit",
"voluptatem",
"accusantium",
"doloremque",
"aperiam",
"eaque",
"ipsa",
"quae",
"ab",
"illo",
"inventore",
"veritatis",
"et",
"quasi",
"architecto",
"beatae",
"vitae",
"dicta",
"sunt",
"explicabo",
"aspernatur",
"aut",
"odit",
"aut",
"fugit",
"sed",
"quia",
"consequuntur",
"magni",
"dolores",
"eos",
"qui",
"ratione",
"voluptatem",
"sequi",
"nesciunt",
"neque",
"dolorem",
"ipsum",
"quia",
"dolor",
"sit",
"amet",
"consectetur",
"adipisci",
"velit",
"sed",
"quia",
"non",
"numquam",
"eius",
"modi",
"tempora",
"incidunt",
"ut",
"labore",
"et",
"dolore",
"magnam",
"aliquam",
"quaerat",
"voluptatem",
"ut",
"enim",
"ad",
"minima",
"veniam",
"quis",
"nostrum",
"exercitationem",
"ullam",
"corporis",
"nemo",
"enim",
"ipsam",
"voluptatem",
"quia",
"voluptas",
"sit",
"suscipit",
"laboriosam",
"nisi",
"ut",
"aliquid",
"ex",
"ea",
"commodi",
"consequatur",
"quis",
"autem",
"vel",
"eum",
"iure",
"reprehenderit",
"qui",
"in",
"ea",
"voluptate",
"velit",
"esse",
"quam",
"nihil",
"molestiae",
"et",
"iusto",
"odio",
"dignissimos",
"ducimus",
"qui",
"blanditiis",
"praesentium",
"laudantium",
"totam",
"rem",
"voluptatum",
"deleniti",
"atque",
"corrupti",
"quos",
"dolores",
"et",
"quas",
"molestias",
"excepturi",
"sint",
"occaecati",
"cupiditate",
"non",
"provident",
"sed",
"ut",
"perspiciatis",
"unde",
"omnis",
"iste",
"natus",
"error",
"similique",
"sunt",
"in",
"culpa",
"qui",
"officia",
"deserunt",
"mollitia",
"animi",
"id",
"est",
"laborum",
"et",
"dolorum",
"fuga",
"et",
"harum",
"quidem",
"rerum",
"facilis",
"est",
"et",
"expedita",
"distinctio",
"nam",
"libero",
"tempore",
"cum",
"soluta",
"nobis",
"est",
"eligendi",
"optio",
"cumque",
"nihil",
"impedit",
"quo",
"porro",
"quisquam",
"est",
"qui",
"minus",
"id",
"quod",
"maxime",
"placeat",
"facere",
"possimus",
"omnis",
"voluptas",
"assumenda",
"est",
"omnis",
"dolor",
"repellendus",
"temporibus",
"autem",
"quibusdam",
"et",
"aut",
"consequatur",
"vel",
"illum",
"qui",
"dolorem",
"eum",
"fugiat",
"quo",
"voluptas",
"nulla",
"pariatur",
"at",
"vero",
"eos",
"et",
"accusamus",
"officiis",
"debitis",
"aut",
"rerum",
"necessitatibus",
"saepe",
"eveniet",
"ut",
"et",
"voluptates",
"repudiandae",
"sint",
"et",
"molestiae",
"non",
"recusandae",
"itaque",
"earum",
"rerum",
"hic",
"tenetur",
"a",
"sapiente",
"delectus",
"ut",
"aut",
"reiciendis",
"voluptatibus",
"maiores",
"doloribus",
"asperiores",
"repellat"
];
},{}],119:[function(require,module,exports){
module["exports"] = [
"Aaliyah",
"Aaron",
"Abagail",
"Abbey",
"Abbie",
"Abbigail",
"Abby",
"Abdiel",
"Abdul",
"Abdullah",
"Abe",
"Abel",
"Abelardo",
"Abigail",
"Abigale",
"Abigayle",
"Abner",
"Abraham",
"Ada",
"Adah",
"Adalberto",
"Adaline",
"Adam",
"Adan",
"Addie",
"Addison",
"Adela",
"Adelbert",
"Adele",
"Adelia",
"Adeline",
"Adell",
"Adella",
"Adelle",
"Aditya",
"Adolf",
"Adolfo",
"Adolph",
"Adolphus",
"Adonis",
"Adrain",
"Adrian",
"Adriana",
"Adrianna",
"Adriel",
"Adrien",
"Adrienne",
"Afton",
"Aglae",
"Agnes",
"Agustin",
"Agustina",
"Ahmad",
"Ahmed",
"Aida",
"Aidan",
"Aiden",
"Aileen",
"Aimee",
"Aisha",
"Aiyana",
"Akeem",
"Al",
"Alaina",
"Alan",
"Alana",
"Alanis",
"Alanna",
"Alayna",
"Alba",
"Albert",
"Alberta",
"Albertha",
"Alberto",
"Albin",
"Albina",
"Alda",
"Alden",
"Alec",
"Aleen",
"Alejandra",
"Alejandrin",
"Alek",
"Alena",
"Alene",
"Alessandra",
"Alessandro",
"Alessia",
"Aletha",
"Alex",
"Alexa",
"Alexander",
"Alexandra",
"Alexandre",
"Alexandrea",
"Alexandria",
"Alexandrine",
"Alexandro",
"Alexane",
"Alexanne",
"Alexie",
"Alexis",
"Alexys",
"Alexzander",
"Alf",
"Alfonso",
"Alfonzo",
"Alford",
"Alfred",
"Alfreda",
"Alfredo",
"Ali",
"Alia",
"Alice",
"Alicia",
"Alisa",
"Alisha",
"Alison",
"Alivia",
"Aliya",
"Aliyah",
"Aliza",
"Alize",
"Allan",
"Allen",
"Allene",
"Allie",
"Allison",
"Ally",
"Alphonso",
"Alta",
"Althea",
"Alva",
"Alvah",
"Alvena",
"Alvera",
"Alverta",
"Alvina",
"Alvis",
"Alyce",
"Alycia",
"Alysa",
"Alysha",
"Alyson",
"Alysson",
"Amalia",
"Amanda",
"Amani",
"Amara",
"Amari",
"Amaya",
"Amber",
"Ambrose",
"Amelia",
"Amelie",
"Amely",
"America",
"Americo",
"Amie",
"Amina",
"Amir",
"Amira",
"Amiya",
"Amos",
"Amparo",
"Amy",
"Amya",
"Ana",
"Anabel",
"Anabelle",
"Anahi",
"Anais",
"Anastacio",
"Anastasia",
"Anderson",
"Andre",
"Andreane",
"Andreanne",
"Andres",
"Andrew",
"Andy",
"Angel",
"Angela",
"Angelica",
"Angelina",
"Angeline",
"Angelita",
"Angelo",
"Angie",
"Angus",
"Anibal",
"Anika",
"Anissa",
"Anita",
"Aniya",
"Aniyah",
"Anjali",
"Anna",
"Annabel",
"Annabell",
"Annabelle",
"Annalise",
"Annamae",
"Annamarie",
"Anne",
"Annetta",
"Annette",
"Annie",
"Ansel",
"Ansley",
"Anthony",
"Antoinette",
"Antone",
"Antonetta",
"Antonette",
"Antonia",
"Antonietta",
"Antonina",
"Antonio",
"Antwan",
"Antwon",
"Anya",
"April",
"Ara",
"Araceli",
"Aracely",
"Arch",
"Archibald",
"Ardella",
"Arden",
"Ardith",
"Arely",
"Ari",
"Ariane",
"Arianna",
"Aric",
"Ariel",
"Arielle",
"Arjun",
"Arlene",
"Arlie",
"Arlo",
"Armand",
"Armando",
"Armani",
"Arnaldo",
"Arne",
"Arno",
"Arnold",
"Arnoldo",
"Arnulfo",
"Aron",
"Art",
"Arthur",
"Arturo",
"Arvel",
"Arvid",
"Arvilla",
"Aryanna",
"Asa",
"Asha",
"Ashlee",
"Ashleigh",
"Ashley",
"Ashly",
"Ashlynn",
"Ashton",
"Ashtyn",
"Asia",
"Assunta",
"Astrid",
"Athena",
"Aubree",
"Aubrey",
"Audie",
"Audra",
"Audreanne",
"Audrey",
"August",
"Augusta",
"Augustine",
"Augustus",
"Aurelia",
"Aurelie",
"Aurelio",
"Aurore",
"Austen",
"Austin",
"Austyn",
"Autumn",
"Ava",
"Avery",
"Avis",
"Axel",
"Ayana",
"Ayden",
"Ayla",
"Aylin",
"Baby",
"Bailee",
"Bailey",
"Barbara",
"Barney",
"Baron",
"Barrett",
"Barry",
"Bart",
"Bartholome",
"Barton",
"Baylee",
"Beatrice",
"Beau",
"Beaulah",
"Bell",
"Bella",
"Belle",
"Ben",
"Benedict",
"Benjamin",
"Bennett",
"Bennie",
"Benny",
"Benton",
"Berenice",
"Bernadette",
"Bernadine",
"Bernard",
"Bernardo",
"Berneice",
"Bernhard",
"Bernice",
"Bernie",
"Berniece",
"Bernita",
"Berry",
"Bert",
"Berta",
"Bertha",
"Bertram",
"Bertrand",
"Beryl",
"Bessie",
"Beth",
"Bethany",
"Bethel",
"Betsy",
"Bette",
"Bettie",
"Betty",
"Bettye",
"Beulah",
"Beverly",
"Bianka",
"Bill",
"Billie",
"Billy",
"Birdie",
"Blair",
"Blaise",
"Blake",
"Blanca",
"Blanche",
"Blaze",
"Bo",
"Bobbie",
"Bobby",
"Bonita",
"Bonnie",
"Boris",
"Boyd",
"Brad",
"Braden",
"Bradford",
"Bradley",
"Bradly",
"Brady",
"Braeden",
"Brain",
"Brandi",
"Brando",
"Brandon",
"Brandt",
"Brandy",
"Brandyn",
"Brannon",
"Branson",
"Brant",
"Braulio",
"Braxton",
"Brayan",
"Breana",
"Breanna",
"Breanne",
"Brenda",
"Brendan",
"Brenden",
"Brendon",
"Brenna",
"Brennan",
"Brennon",
"Brent",
"Bret",
"Brett",
"Bria",
"Brian",
"Briana",
"Brianne",
"Brice",
"Bridget",
"Bridgette",
"Bridie",
"Brielle",
"Brigitte",
"Brionna",
"Brisa",
"Britney",
"Brittany",
"Brock",
"Broderick",
"Brody",
"Brook",
"Brooke",
"Brooklyn",
"Brooks",
"Brown",
"Bruce",
"Bryana",
"Bryce",
"Brycen",
"Bryon",
"Buck",
"Bud",
"Buddy",
"Buford",
"Bulah",
"Burdette",
"Burley",
"Burnice",
"Buster",
"Cade",
"Caden",
"Caesar",
"Caitlyn",
"Cale",
"Caleb",
"Caleigh",
"Cali",
"Calista",
"Callie",
"Camden",
"Cameron",
"Camila",
"Camilla",
"Camille",
"Camren",
"Camron",
"Camryn",
"Camylle",
"Candace",
"Candelario",
"Candice",
"Candida",
"Candido",
"Cara",
"Carey",
"Carissa",
"Carlee",
"Carleton",
"Carley",
"Carli",
"Carlie",
"Carlo",
"Carlos",
"Carlotta",
"Carmel",
"Carmela",
"Carmella",
"Carmelo",
"Carmen",
"Carmine",
"Carol",
"Carolanne",
"Carole",
"Carolina",
"Caroline",
"Carolyn",
"Carolyne",
"Carrie",
"Carroll",
"Carson",
"Carter",
"Cary",
"Casandra",
"Casey",
"Casimer",
"Casimir",
"Casper",
"Cassandra",
"Cassandre",
"Cassidy",
"Cassie",
"Catalina",
"Caterina",
"Catharine",
"Catherine",
"Cathrine",
"Cathryn",
"Cathy",
"Cayla",
"Ceasar",
"Cecelia",
"Cecil",
"Cecile",
"Cecilia",
"Cedrick",
"Celestine",
"Celestino",
"Celia",
"Celine",
"Cesar",
"Chad",
"Chadd",
"Chadrick",
"Chaim",
"Chance",
"Chandler",
"Chanel",
"Chanelle",
"Charity",
"Charlene",
"Charles",
"Charley",
"Charlie",
"Charlotte",
"Chase",
"Chasity",
"Chauncey",
"Chaya",
"Chaz",
"Chelsea",
"Chelsey",
"Chelsie",
"Chesley",
"Chester",
"Chet",
"Cheyanne",
"Cheyenne",
"Chloe",
"Chris",
"Christ",
"Christa",
"Christelle",
"Christian",
"Christiana",
"Christina",
"Christine",
"Christop",
"Christophe",
"Christopher",
"Christy",
"Chyna",
"Ciara",
"Cicero",
"Cielo",
"Cierra",
"Cindy",
"Citlalli",
"Clair",
"Claire",
"Clara",
"Clarabelle",
"Clare",
"Clarissa",
"Clark",
"Claud",
"Claude",
"Claudia",
"Claudie",
"Claudine",
"Clay",
"Clemens",
"Clement",
"Clementina",
"Clementine",
"Clemmie",
"Cleo",
"Cleora",
"Cleta",
"Cletus",
"Cleve",
"Cleveland",
"Clifford",
"Clifton",
"Clint",
"Clinton",
"Clotilde",
"Clovis",
"Cloyd",
"Clyde",
"Coby",
"Cody",
"Colby",
"Cole",
"Coleman",
"Colin",
"Colleen",
"Collin",
"Colt",
"Colten",
"Colton",
"Columbus",
"Concepcion",
"Conner",
"Connie",
"Connor",
"Conor",
"Conrad",
"Constance",
"Constantin",
"Consuelo",
"Cooper",
"Cora",
"Coralie",
"Corbin",
"Cordelia",
"Cordell",
"Cordia",
"Cordie",
"Corene",
"Corine",
"Cornelius",
"Cornell",
"Corrine",
"Cortez",
"Cortney",
"Cory",
"Coty",
"Courtney",
"Coy",
"Craig",
"Crawford",
"Creola",
"Cristal",
"Cristian",
"Cristina",
"Cristobal",
"Cristopher",
"Cruz",
"Crystal",
"Crystel",
"Cullen",
"Curt",
"Curtis",
"Cydney",
"Cynthia",
"Cyril",
"Cyrus",
"Dagmar",
"Dahlia",
"Daija",
"Daisha",
"Daisy",
"Dakota",
"Dale",
"Dallas",
"Dallin",
"Dalton",
"Damaris",
"Dameon",
"Damian",
"Damien",
"Damion",
"Damon",
"Dan",
"Dana",
"Dandre",
"Dane",
"D'angelo",
"Dangelo",
"Danial",
"Daniela",
"Daniella",
"Danielle",
"Danika",
"Dannie",
"Danny",
"Dante",
"Danyka",
"Daphne",
"Daphnee",
"Daphney",
"Darby",
"Daren",
"Darian",
"Dariana",
"Darien",
"Dario",
"Darion",
"Darius",
"Darlene",
"Daron",
"Darrel",
"Darrell",
"Darren",
"Darrick",
"Darrin",
"Darrion",
"Darron",
"Darryl",
"Darwin",
"Daryl",
"Dashawn",
"Dasia",
"Dave",
"David",
"Davin",
"Davion",
"Davon",
"Davonte",
"Dawn",
"Dawson",
"Dax",
"Dayana",
"Dayna",
"Dayne",
"Dayton",
"Dean",
"Deangelo",
"Deanna",
"Deborah",
"Declan",
"Dedric",
"Dedrick",
"Dee",
"Deion",
"Deja",
"Dejah",
"Dejon",
"Dejuan",
"Delaney",
"Delbert",
"Delfina",
"Delia",
"Delilah",
"Dell",
"Della",
"Delmer",
"Delores",
"Delpha",
"Delphia",
"Delphine",
"Delta",
"Demarco",
"Demarcus",
"Demario",
"Demetris",
"Demetrius",
"Demond",
"Dena",
"Denis",
"Dennis",
"Deon",
"Deondre",
"Deontae",
"Deonte",
"Dereck",
"Derek",
"Derick",
"Deron",
"Derrick",
"Deshaun",
"Deshawn",
"Desiree",
"Desmond",
"Dessie",
"Destany",
"Destin",
"Destinee",
"Destiney",
"Destini",
"Destiny",
"Devan",
"Devante",
"Deven",
"Devin",
"Devon",
"Devonte",
"Devyn",
"Dewayne",
"Dewitt",
"Dexter",
"Diamond",
"Diana",
"Dianna",
"Diego",
"Dillan",
"Dillon",
"Dimitri",
"Dina",
"Dino",
"Dion",
"Dixie",
"Dock",
"Dolly",
"Dolores",
"Domenic",
"Domenica",
"Domenick",
"Domenico",
"Domingo",
"Dominic",
"Dominique",
"Don",
"Donald",
"Donato",
"Donavon",
"Donna",
"Donnell",
"Donnie",
"Donny",
"Dora",
"Dorcas",
"Dorian",
"Doris",
"Dorothea",
"Dorothy",
"Dorris",
"Dortha",
"Dorthy",
"Doug",
"Douglas",
"Dovie",
"Doyle",
"Drake",
"Drew",
"Duane",
"Dudley",
"Dulce",
"Duncan",
"Durward",
"Dustin",
"Dusty",
"Dwight",
"Dylan",
"Earl",
"Earlene",
"Earline",
"Earnest",
"Earnestine",
"Easter",
"Easton",
"Ebba",
"Ebony",
"Ed",
"Eda",
"Edd",
"Eddie",
"Eden",
"Edgar",
"Edgardo",
"Edison",
"Edmond",
"Edmund",
"Edna",
"Eduardo",
"Edward",
"Edwardo",
"Edwin",
"Edwina",
"Edyth",
"Edythe",
"Effie",
"Efrain",
"Efren",
"Eileen",
"Einar",
"Eino",
"Eladio",
"Elaina",
"Elbert",
"Elda",
"Eldon",
"Eldora",
"Eldred",
"Eldridge",
"Eleanora",
"Eleanore",
"Eleazar",
"Electa",
"Elena",
"Elenor",
"Elenora",
"Eleonore",
"Elfrieda",
"Eli",
"Elian",
"Eliane",
"Elias",
"Eliezer",
"Elijah",
"Elinor",
"Elinore",
"Elisa",
"Elisabeth",
"Elise",
"Eliseo",
"Elisha",
"Elissa",
"Eliza",
"Elizabeth",
"Ella",
"Ellen",
"Ellie",
"Elliot",
"Elliott",
"Ellis",
"Ellsworth",
"Elmer",
"Elmira",
"Elmo",
"Elmore",
"Elna",
"Elnora",
"Elody",
"Eloisa",
"Eloise",
"Elouise",
"Eloy",
"Elroy",
"Elsa",
"Else",
"Elsie",
"Elta",
"Elton",
"Elva",
"Elvera",
"Elvie",
"Elvis",
"Elwin",
"Elwyn",
"Elyse",
"Elyssa",
"Elza",
"Emanuel",
"Emelia",
"Emelie",
"Emely",
"Emerald",
"Emerson",
"Emery",
"Emie",
"Emil",
"Emile",
"Emilia",
"Emiliano",
"Emilie",
"Emilio",
"Emily",
"Emma",
"Emmalee",
"Emmanuel",
"Emmanuelle",
"Emmet",
"Emmett",
"Emmie",
"Emmitt",
"Emmy",
"Emory",
"Ena",
"Enid",
"Enoch",
"Enola",
"Enos",
"Enrico",
"Enrique",
"Ephraim",
"Era",
"Eriberto",
"Eric",
"Erica",
"Erich",
"Erick",
"Ericka",
"Erik",
"Erika",
"Erin",
"Erling",
"Erna",
"Ernest",
"Ernestina",
"Ernestine",
"Ernesto",
"Ernie",
"Ervin",
"Erwin",
"Eryn",
"Esmeralda",
"Esperanza",
"Esta",
"Esteban",
"Estefania",
"Estel",
"Estell",
"Estella",
"Estelle",
"Estevan",
"Esther",
"Estrella",
"Etha",
"Ethan",
"Ethel",
"Ethelyn",
"Ethyl",
"Ettie",
"Eudora",
"Eugene",
"Eugenia",
"Eula",
"Eulah",
"Eulalia",
"Euna",
"Eunice",
"Eusebio",
"Eva",
"Evalyn",
"Evan",
"Evangeline",
"Evans",
"Eve",
"Eveline",
"Evelyn",
"Everardo",
"Everett",
"Everette",
"Evert",
"Evie",
"Ewald",
"Ewell",
"Ezekiel",
"Ezequiel",
"Ezra",
"Fabian",
"Fabiola",
"Fae",
"Fannie",
"Fanny",
"Fatima",
"Faustino",
"Fausto",
"Favian",
"Fay",
"Faye",
"Federico",
"Felicia",
"Felicita",
"Felicity",
"Felipa",
"Felipe",
"Felix",
"Felton",
"Fermin",
"Fern",
"Fernando",
"Ferne",
"Fidel",
"Filiberto",
"Filomena",
"Finn",
"Fiona",
"Flavie",
"Flavio",
"Fleta",
"Fletcher",
"Flo",
"Florence",
"Florencio",
"Florian",
"Florida",
"Florine",
"Flossie",
"Floy",
"Floyd",
"Ford",
"Forest",
"Forrest",
"Foster",
"Frances",
"Francesca",
"Francesco",
"Francis",
"Francisca",
"Francisco",
"Franco",
"Frank",
"Frankie",
"Franz",
"Fred",
"Freda",
"Freddie",
"Freddy",
"Frederic",
"Frederick",
"Frederik",
"Frederique",
"Fredrick",
"Fredy",
"Freeda",
"Freeman",
"Freida",
"Frida",
"Frieda",
"Friedrich",
"Fritz",
"Furman",
"Gabe",
"Gabriel",
"Gabriella",
"Gabrielle",
"Gaetano",
"Gage",
"Gail",
"Gardner",
"Garett",
"Garfield",
"Garland",
"Garnet",
"Garnett",
"Garret",
"Garrett",
"Garrick",
"Garrison",
"Garry",
"Garth",
"Gaston",
"Gavin",
"Gay",
"Gayle",
"Gaylord",
"Gene",
"General",
"Genesis",
"Genevieve",
"Gennaro",
"Genoveva",
"Geo",
"Geoffrey",
"George",
"Georgette",
"Georgiana",
"Georgianna",
"Geovanni",
"Geovanny",
"Geovany",
"Gerald",
"Geraldine",
"Gerard",
"Gerardo",
"Gerda",
"Gerhard",
"Germaine",
"German",
"Gerry",
"Gerson",
"Gertrude",
"Gia",
"Gianni",
"Gideon",
"Gilbert",
"Gilberto",
"Gilda",
"Giles",
"Gillian",
"Gina",
"Gino",
"Giovani",
"Giovanna",
"Giovanni",
"Giovanny",
"Gisselle",
"Giuseppe",
"Gladyce",
"Gladys",
"Glen",
"Glenda",
"Glenna",
"Glennie",
"Gloria",
"Godfrey",
"Golda",
"Golden",
"Gonzalo",
"Gordon",
"Grace",
"Gracie",
"Graciela",
"Grady",
"Graham",
"Grant",
"Granville",
"Grayce",
"Grayson",
"Green",
"Greg",
"Gregg",
"Gregoria",
"Gregorio",
"Gregory",
"Greta",
"Gretchen",
"Greyson",
"Griffin",
"Grover",
"Guadalupe",
"Gudrun",
"Guido",
"Guillermo",
"Guiseppe",
"Gunnar",
"Gunner",
"Gus",
"Gussie",
"Gust",
"Gustave",
"Guy",
"Gwen",
"Gwendolyn",
"Hadley",
"Hailee",
"Hailey",
"Hailie",
"Hal",
"Haleigh",
"Haley",
"Halie",
"Halle",
"Hallie",
"Hank",
"Hanna",
"Hannah",
"Hans",
"Hardy",
"Harley",
"Harmon",
"Harmony",
"Harold",
"Harrison",
"Harry",
"Harvey",
"Haskell",
"Hassan",
"Hassie",
"Hattie",
"Haven",
"Hayden",
"Haylee",
"Hayley",
"Haylie",
"Hazel",
"Hazle",
"Heath",
"Heather",
"Heaven",
"Heber",
"Hector",
"Heidi",
"Helen",
"Helena",
"Helene",
"Helga",
"Hellen",
"Helmer",
"Heloise",
"Henderson",
"Henri",
"Henriette",
"Henry",
"Herbert",
"Herman",
"Hermann",
"Hermina",
"Herminia",
"Herminio",
"Hershel",
"Herta",
"Hertha",
"Hester",
"Hettie",
"Hilario",
"Hilbert",
"Hilda",
"Hildegard",
"Hillard",
"Hillary",
"Hilma",
"Hilton",
"Hipolito",
"Hiram",
"Hobart",
"Holden",
"Hollie",
"Hollis",
"Holly",
"Hope",
"Horace",
"Horacio",
"Hortense",
"Hosea",
"Houston",
"Howard",
"Howell",
"Hoyt",
"Hubert",
"Hudson",
"Hugh",
"Hulda",
"Humberto",
"Hunter",
"Hyman",
"Ian",
"Ibrahim",
"Icie",
"Ida",
"Idell",
"Idella",
"Ignacio",
"Ignatius",
"Ike",
"Ila",
"Ilene",
"Iliana",
"Ima",
"Imani",
"Imelda",
"Immanuel",
"Imogene",
"Ines",
"Irma",
"Irving",
"Irwin",
"Isaac",
"Isabel",
"Isabell",
"Isabella",
"Isabelle",
"Isac",
"Isadore",
"Isai",
"Isaiah",
"Isaias",
"Isidro",
"Ismael",
"Isobel",
"Isom",
"Israel",
"Issac",
"Itzel",
"Iva",
"Ivah",
"Ivory",
"Ivy",
"Izabella",
"Izaiah",
"Jabari",
"Jace",
"Jacey",
"Jacinthe",
"Jacinto",
"Jack",
"Jackeline",
"Jackie",
"Jacklyn",
"Jackson",
"Jacky",
"Jaclyn",
"Jacquelyn",
"Jacques",
"Jacynthe",
"Jada",
"Jade",
"Jaden",
"Jadon",
"Jadyn",
"Jaeden",
"Jaida",
"Jaiden",
"Jailyn",
"Jaime",
"Jairo",
"Jakayla",
"Jake",
"Jakob",
"Jaleel",
"Jalen",
"Jalon",
"Jalyn",
"Jamaal",
"Jamal",
"Jamar",
"Jamarcus",
"Jamel",
"Jameson",
"Jamey",
"Jamie",
"Jamil",
"Jamir",
"Jamison",
"Jammie",
"Jan",
"Jana",
"Janae",
"Jane",
"Janelle",
"Janessa",
"Janet",
"Janice",
"Janick",
"Janie",
"Janis",
"Janiya",
"Jannie",
"Jany",
"Jaquan",
"Jaquelin",
"Jaqueline",
"Jared",
"Jaren",
"Jarod",
"Jaron",
"Jarred",
"Jarrell",
"Jarret",
"Jarrett",
"Jarrod",
"Jarvis",
"Jasen",
"Jasmin",
"Jason",
"Jasper",
"Jaunita",
"Javier",
"Javon",
"Javonte",
"Jay",
"Jayce",
"Jaycee",
"Jayda",
"Jayde",
"Jayden",
"Jaydon",
"Jaylan",
"Jaylen",
"Jaylin",
"Jaylon",
"Jayme",
"Jayne",
"Jayson",
"Jazlyn",
"Jazmin",
"Jazmyn",
"Jazmyne",
"Jean",
"Jeanette",
"Jeanie",
"Jeanne",
"Jed",
"Jedediah",
"Jedidiah",
"Jeff",
"Jefferey",
"Jeffery",
"Jeffrey",
"Jeffry",
"Jena",
"Jenifer",
"Jennie",
"Jennifer",
"Jennings",
"Jennyfer",
"Jensen",
"Jerad",
"Jerald",
"Jeramie",
"Jeramy",
"Jerel",
"Jeremie",
"Jeremy",
"Jermain",
"Jermaine",
"Jermey",
"Jerod",
"Jerome",
"Jeromy",
"Jerrell",
"Jerrod",
"Jerrold",
"Jerry",
"Jess",
"Jesse",
"Jessica",
"Jessie",
"Jessika",
"Jessy",
"Jessyca",
"Jesus",
"Jett",
"Jettie",
"Jevon",
"Jewel",
"Jewell",
"Jillian",
"Jimmie",
"Jimmy",
"Jo",
"Joan",
"Joana",
"Joanie",
"Joanne",
"Joannie",
"Joanny",
"Joany",
"Joaquin",
"Jocelyn",
"Jodie",
"Jody",
"Joe",
"Joel",
"Joelle",
"Joesph",
"Joey",
"Johan",
"Johann",
"Johanna",
"Johathan",
"John",
"Johnathan",
"Johnathon",
"Johnnie",
"Johnny",
"Johnpaul",
"Johnson",
"Jolie",
"Jon",
"Jonas",
"Jonatan",
"Jonathan",
"Jonathon",
"Jordan",
"Jordane",
"Jordi",
"Jordon",
"Jordy",
"Jordyn",
"Jorge",
"Jose",
"Josefa",
"Josefina",
"Joseph",
"Josephine",
"Josh",
"Joshua",
"Joshuah",
"Josiah",
"Josiane",
"Josianne",
"Josie",
"Josue",
"Jovan",
"Jovani",
"Jovanny",
"Jovany",
"Joy",
"Joyce",
"Juana",
"Juanita",
"Judah",
"Judd",
"Jude",
"Judge",
"Judson",
"Judy",
"Jules",
"Julia",
"Julian",
"Juliana",
"Julianne",
"Julie",
"Julien",
"Juliet",
"Julio",
"Julius",
"June",
"Junior",
"Junius",
"Justen",
"Justice",
"Justina",
"Justine",
"Juston",
"Justus",
"Justyn",
"Juvenal",
"Juwan",
"Kacey",
"Kaci",
"Kacie",
"Kade",
"Kaden",
"Kadin",
"Kaela",
"Kaelyn",
"Kaia",
"Kailee",
"Kailey",
"Kailyn",
"Kaitlin",
"Kaitlyn",
"Kale",
"Kaleb",
"Kaleigh",
"Kaley",
"Kali",
"Kallie",
"Kameron",
"Kamille",
"Kamren",
"Kamron",
"Kamryn",
"Kane",
"Kara",
"Kareem",
"Karelle",
"Karen",
"Kari",
"Kariane",
"Karianne",
"Karina",
"Karine",
"Karl",
"Karlee",
"Karley",
"Karli",
"Karlie",
"Karolann",
"Karson",
"Kasandra",
"Kasey",
"Kassandra",
"Katarina",
"Katelin",
"Katelyn",
"Katelynn",
"Katharina",
"Katherine",
"Katheryn",
"Kathleen",
"Kathlyn",
"Kathryn",
"Kathryne",
"Katlyn",
"Katlynn",
"Katrina",
"Katrine",
"Kattie",
"Kavon",
"Kay",
"Kaya",
"Kaycee",
"Kayden",
"Kayla",
"Kaylah",
"Kaylee",
"Kayleigh",
"Kayley",
"Kayli",
"Kaylie",
"Kaylin",
"Keagan",
"Keanu",
"Keara",
"Keaton",
"Keegan",
"Keeley",
"Keely",
"Keenan",
"Keira",
"Keith",
"Kellen",
"Kelley",
"Kelli",
"Kellie",
"Kelly",
"Kelsi",
"Kelsie",
"Kelton",
"Kelvin",
"Ken",
"Kendall",
"Kendra",
"Kendrick",
"Kenna",
"Kennedi",
"Kennedy",
"Kenneth",
"Kennith",
"Kenny",
"Kenton",
"Kenya",
"Kenyatta",
"Kenyon",
"Keon",
"Keshaun",
"Keshawn",
"Keven",
"Kevin",
"Kevon",
"Keyon",
"Keyshawn",
"Khalid",
"Khalil",
"Kian",
"Kiana",
"Kianna",
"Kiara",
"Kiarra",
"Kiel",
"Kiera",
"Kieran",
"Kiley",
"Kim",
"Kimberly",
"King",
"Kip",
"Kira",
"Kirk",
"Kirsten",
"Kirstin",
"Kitty",
"Kobe",
"Koby",
"Kody",
"Kolby",
"Kole",
"Korbin",
"Korey",
"Kory",
"Kraig",
"Kris",
"Krista",
"Kristian",
"Kristin",
"Kristina",
"Kristofer",
"Kristoffer",
"Kristopher",
"Kristy",
"Krystal",
"Krystel",
"Krystina",
"Kurt",
"Kurtis",
"Kyla",
"Kyle",
"Kylee",
"Kyleigh",
"Kyler",
"Kylie",
"Kyra",
"Lacey",
"Lacy",
"Ladarius",
"Lafayette",
"Laila",
"Laisha",
"Lamar",
"Lambert",
"Lamont",
"Lance",
"Landen",
"Lane",
"Laney",
"Larissa",
"Laron",
"Larry",
"Larue",
"Laura",
"Laurel",
"Lauren",
"Laurence",
"Lauretta",
"Lauriane",
"Laurianne",
"Laurie",
"Laurine",
"Laury",
"Lauryn",
"Lavada",
"Lavern",
"Laverna",
"Laverne",
"Lavina",
"Lavinia",
"Lavon",
"Lavonne",
"Lawrence",
"Lawson",
"Layla",
"Layne",
"Lazaro",
"Lea",
"Leann",
"Leanna",
"Leanne",
"Leatha",
"Leda",
"Lee",
"Leif",
"Leila",
"Leilani",
"Lela",
"Lelah",
"Leland",
"Lelia",
"Lempi",
"Lemuel",
"Lenna",
"Lennie",
"Lenny",
"Lenora",
"Lenore",
"Leo",
"Leola",
"Leon",
"Leonard",
"Leonardo",
"Leone",
"Leonel",
"Leonie",
"Leonor",
"Leonora",
"Leopold",
"Leopoldo",
"Leora",
"Lera",
"Lesley",
"Leslie",
"Lesly",
"Lessie",
"Lester",
"Leta",
"Letha",
"Letitia",
"Levi",
"Lew",
"Lewis",
"Lexi",
"Lexie",
"Lexus",
"Lia",
"Liam",
"Liana",
"Libbie",
"Libby",
"Lila",
"Lilian",
"Liliana",
"Liliane",
"Lilla",
"Lillian",
"Lilliana",
"Lillie",
"Lilly",
"Lily",
"Lilyan",
"Lina",
"Lincoln",
"Linda",
"Lindsay",
"Lindsey",
"Linnea",
"Linnie",
"Linwood",
"Lionel",
"Lisa",
"Lisandro",
"Lisette",
"Litzy",
"Liza",
"Lizeth",
"Lizzie",
"Llewellyn",
"Lloyd",
"Logan",
"Lois",
"Lola",
"Lolita",
"Loma",
"Lon",
"London",
"Lonie",
"Lonnie",
"Lonny",
"Lonzo",
"Lora",
"Loraine",
"Loren",
"Lorena",
"Lorenz",
"Lorenza",
"Lorenzo",
"Lori",
"Lorine",
"Lorna",
"Lottie",
"Lou",
"Louie",
"Louisa",
"Lourdes",
"Louvenia",
"Lowell",
"Loy",
"Loyal",
"Loyce",
"Lucas",
"Luciano",
"Lucie",
"Lucienne",
"Lucile",
"Lucinda",
"Lucio",
"Lucious",
"Lucius",
"Lucy",
"Ludie",
"Ludwig",
"Lue",
"Luella",
"Luigi",
"Luis",
"Luisa",
"Lukas",
"Lula",
"Lulu",
"Luna",
"Lupe",
"Lura",
"Lurline",
"Luther",
"Luz",
"Lyda",
"Lydia",
"Lyla",
"Lynn",
"Lyric",
"Lysanne",
"Mabel",
"Mabelle",
"Mable",
"Mac",
"Macey",
"Maci",
"Macie",
"Mack",
"Mackenzie",
"Macy",
"Madaline",
"Madalyn",
"Maddison",
"Madeline",
"Madelyn",
"Madelynn",
"Madge",
"Madie",
"Madilyn",
"Madisen",
"Madison",
"Madisyn",
"Madonna",
"Madyson",
"Mae",
"Maegan",
"Maeve",
"Mafalda",
"Magali",
"Magdalen",
"Magdalena",
"Maggie",
"Magnolia",
"Magnus",
"Maia",
"Maida",
"Maiya",
"Major",
"Makayla",
"Makenna",
"Makenzie",
"Malachi",
"Malcolm",
"Malika",
"Malinda",
"Mallie",
"Mallory",
"Malvina",
"Mandy",
"Manley",
"Manuel",
"Manuela",
"Mara",
"Marc",
"Marcel",
"Marcelina",
"Marcelino",
"Marcella",
"Marcelle",
"Marcellus",
"Marcelo",
"Marcia",
"Marco",
"Marcos",
"Marcus",
"Margaret",
"Margarete",
"Margarett",
"Margaretta",
"Margarette",
"Margarita",
"Marge",
"Margie",
"Margot",
"Margret",
"Marguerite",
"Maria",
"Mariah",
"Mariam",
"Marian",
"Mariana",
"Mariane",
"Marianna",
"Marianne",
"Mariano",
"Maribel",
"Marie",
"Mariela",
"Marielle",
"Marietta",
"Marilie",
"Marilou",
"Marilyne",
"Marina",
"Mario",
"Marion",
"Marisa",
"Marisol",
"Maritza",
"Marjolaine",
"Marjorie",
"Marjory",
"Mark",
"Markus",
"Marlee",
"Marlen",
"Marlene",
"Marley",
"Marlin",
"Marlon",
"Marques",
"Marquis",
"Marquise",
"Marshall",
"Marta",
"Martin",
"Martina",
"Martine",
"Marty",
"Marvin",
"Mary",
"Maryam",
"Maryjane",
"Maryse",
"Mason",
"Mateo",
"Mathew",
"Mathias",
"Mathilde",
"Matilda",
"Matilde",
"Matt",
"Matteo",
"Mattie",
"Maud",
"Maude",
"Maudie",
"Maureen",
"Maurice",
"Mauricio",
"Maurine",
"Maverick",
"Mavis",
"Max",
"Maxie",
"Maxime",
"Maximilian",
"Maximillia",
"Maximillian",
"Maximo",
"Maximus",
"Maxine",
"Maxwell",
"May",
"Maya",
"Maybell",
"Maybelle",
"Maye",
"Maymie",
"Maynard",
"Mayra",
"Mazie",
"Mckayla",
"Mckenna",
"Mckenzie",
"Meagan",
"Meaghan",
"Meda",
"Megane",
"Meggie",
"Meghan",
"Mekhi",
"Melany",
"Melba",
"Melisa",
"Melissa",
"Mellie",
"Melody",
"Melvin",
"Melvina",
"Melyna",
"Melyssa",
"Mercedes",
"Meredith",
"Merl",
"Merle",
"Merlin",
"Merritt",
"Mertie",
"Mervin",
"Meta",
"Mia",
"Micaela",
"Micah",
"Michael",
"Michaela",
"Michale",
"Micheal",
"Michel",
"Michele",
"Michelle",
"Miguel",
"Mikayla",
"Mike",
"Mikel",
"Milan",
"Miles",
"Milford",
"Miller",
"Millie",
"Milo",
"Milton",
"Mina",
"Minerva",
"Minnie",
"Miracle",
"Mireille",
"Mireya",
"Misael",
"Missouri",
"Misty",
"Mitchel",
"Mitchell",
"Mittie",
"Modesta",
"Modesto",
"Mohamed",
"Mohammad",
"Mohammed",
"Moises",
"Mollie",
"Molly",
"Mona",
"Monica",
"Monique",
"Monroe",
"Monserrat",
"Monserrate",
"Montana",
"Monte",
"Monty",
"Morgan",
"Moriah",
"Morris",
"Mortimer",
"Morton",
"Mose",
"Moses",
"Moshe",
"Mossie",
"Mozell",
"Mozelle",
"Muhammad",
"Muriel",
"Murl",
"Murphy",
"Murray",
"Mustafa",
"Mya",
"Myah",
"Mylene",
"Myles",
"Myra",
"Myriam",
"Myrl",
"Myrna",
"Myron",
"Myrtice",
"Myrtie",
"Myrtis",
"Myrtle",
"Nadia",
"Nakia",
"Name",
"Nannie",
"Naomi",
"Naomie",
"Napoleon",
"Narciso",
"Nash",
"Nasir",
"Nat",
"Natalia",
"Natalie",
"Natasha",
"Nathan",
"Nathanael",
"Nathanial",
"Nathaniel",
"Nathen",
"Nayeli",
"Neal",
"Ned",
"Nedra",
"Neha",
"Neil",
"Nelda",
"Nella",
"Nelle",
"Nellie",
"Nels",
"Nelson",
"Neoma",
"Nestor",
"Nettie",
"Neva",
"Newell",
"Newton",
"Nia",
"Nicholas",
"Nicholaus",
"Nichole",
"Nick",
"Nicklaus",
"Nickolas",
"Nico",
"Nicola",
"Nicolas",
"Nicole",
"Nicolette",
"Nigel",
"Nikita",
"Nikki",
"Nikko",
"Niko",
"Nikolas",
"Nils",
"Nina",
"Noah",
"Noble",
"Noe",
"Noel",
"Noelia",
"Noemi",
"Noemie",
"Noemy",
"Nola",
"Nolan",
"Nona",
"Nora",
"Norbert",
"Norberto",
"Norene",
"Norma",
"Norris",
"Norval",
"Norwood",
"Nova",
"Novella",
"Nya",
"Nyah",
"Nyasia",
"Obie",
"Oceane",
"Ocie",
"Octavia",
"Oda",
"Odell",
"Odessa",
"Odie",
"Ofelia",
"Okey",
"Ola",
"Olaf",
"Ole",
"Olen",
"Oleta",
"Olga",
"Olin",
"Oliver",
"Ollie",
"Oma",
"Omari",
"Omer",
"Ona",
"Onie",
"Opal",
"Ophelia",
"Ora",
"Oral",
"Oran",
"Oren",
"Orie",
"Orin",
"Orion",
"Orland",
"Orlando",
"Orlo",
"Orpha",
"Orrin",
"Orval",
"Orville",
"Osbaldo",
"Osborne",
"Oscar",
"Osvaldo",
"Oswald",
"Oswaldo",
"Otha",
"Otho",
"Otilia",
"Otis",
"Ottilie",
"Ottis",
"Otto",
"Ova",
"Owen",
"Ozella",
"Pablo",
"Paige",
"Palma",
"Pamela",
"Pansy",
"Paolo",
"Paris",
"Parker",
"Pascale",
"Pasquale",
"Pat",
"Patience",
"Patricia",
"Patrick",
"Patsy",
"Pattie",
"Paul",
"Paula",
"Pauline",
"Paxton",
"Payton",
"Pearl",
"Pearlie",
"Pearline",
"Pedro",
"Peggie",
"Penelope",
"Percival",
"Percy",
"Perry",
"Pete",
"Peter",
"Petra",
"Peyton",
"Philip",
"Phoebe",
"Phyllis",
"Pierce",
"Pierre",
"Pietro",
"Pink",
"Pinkie",
"Piper",
"Polly",
"Porter",
"Precious",
"Presley",
"Preston",
"Price",
"Prince",
"Princess",
"Priscilla",
"Providenci",
"Prudence",
"Queen",
"Queenie",
"Quentin",
"Quincy",
"Quinn",
"Quinten",
"Quinton",
"Rachael",
"Rachel",
"Rachelle",
"Rae",
"Raegan",
"Rafael",
"Rafaela",
"Raheem",
"Rahsaan",
"Rahul",
"Raina",
"Raleigh",
"Ralph",
"Ramiro",
"Ramon",
"Ramona",
"Randal",
"Randall",
"Randi",
"Randy",
"Ransom",
"Raoul",
"Raphael",
"Raphaelle",
"Raquel",
"Rashad",
"Rashawn",
"Rasheed",
"Raul",
"Raven",
"Ray",
"Raymond",
"Raymundo",
"Reagan",
"Reanna",
"Reba",
"Rebeca",
"Rebecca",
"Rebeka",
"Rebekah",
"Reece",
"Reed",
"Reese",
"Regan",
"Reggie",
"Reginald",
"Reid",
"Reilly",
"Reina",
"Reinhold",
"Remington",
"Rene",
"Renee",
"Ressie",
"Reta",
"Retha",
"Retta",
"Reuben",
"Reva",
"Rex",
"Rey",
"Reyes",
"Reymundo",
"Reyna",
"Reynold",
"Rhea",
"Rhett",
"Rhianna",
"Rhiannon",
"Rhoda",
"Ricardo",
"Richard",
"Richie",
"Richmond",
"Rick",
"Rickey",
"Rickie",
"Ricky",
"Rico",
"Rigoberto",
"Riley",
"Rita",
"River",
"Robb",
"Robbie",
"Robert",
"Roberta",
"Roberto",
"Robin",
"Robyn",
"Rocio",
"Rocky",
"Rod",
"Roderick",
"Rodger",
"Rodolfo",
"Rodrick",
"Rodrigo",
"Roel",
"Rogelio",
"Roger",
"Rogers",
"Rolando",
"Rollin",
"Roma",
"Romaine",
"Roman",
"Ron",
"Ronaldo",
"Ronny",
"Roosevelt",
"Rory",
"Rosa",
"Rosalee",
"Rosalia",
"Rosalind",
"Rosalinda",
"Rosalyn",
"Rosamond",
"Rosanna",
"Rosario",
"Roscoe",
"Rose",
"Rosella",
"Roselyn",
"Rosemarie",
"Rosemary",
"Rosendo",
"Rosetta",
"Rosie",
"Rosina",
"Roslyn",
"Ross",
"Rossie",
"Rowan",
"Rowena",
"Rowland",
"Roxane",
"Roxanne",
"Roy",
"Royal",
"Royce",
"Rozella",
"Ruben",
"Rubie",
"Ruby",
"Rubye",
"Rudolph",
"Rudy",
"Rupert",
"Russ",
"Russel",
"Russell",
"Rusty",
"Ruth",
"Ruthe",
"Ruthie",
"Ryan",
"Ryann",
"Ryder",
"Rylan",
"Rylee",
"Ryleigh",
"Ryley",
"Sabina",
"Sabrina",
"Sabryna",
"Sadie",
"Sadye",
"Sage",
"Saige",
"Sallie",
"Sally",
"Salma",
"Salvador",
"Salvatore",
"Sam",
"Samanta",
"Samantha",
"Samara",
"Samir",
"Sammie",
"Sammy",
"Samson",
"Sandra",
"Sandrine",
"Sandy",
"Sanford",
"Santa",
"Santiago",
"Santina",
"Santino",
"Santos",
"Sarah",
"Sarai",
"Sarina",
"Sasha",
"Saul",
"Savanah",
"Savanna",
"Savannah",
"Savion",
"Scarlett",
"Schuyler",
"Scot",
"Scottie",
"Scotty",
"Seamus",
"Sean",
"Sebastian",
"Sedrick",
"Selena",
"Selina",
"Selmer",
"Serena",
"Serenity",
"Seth",
"Shad",
"Shaina",
"Shakira",
"Shana",
"Shane",
"Shanel",
"Shanelle",
"Shania",
"Shanie",
"Shaniya",
"Shanna",
"Shannon",
"Shanny",
"Shanon",
"Shany",
"Sharon",
"Shaun",
"Shawn",
"Shawna",
"Shaylee",
"Shayna",
"Shayne",
"Shea",
"Sheila",
"Sheldon",
"Shemar",
"Sheridan",
"Sherman",
"Sherwood",
"Shirley",
"Shyann",
"Shyanne",
"Sibyl",
"Sid",
"Sidney",
"Sienna",
"Sierra",
"Sigmund",
"Sigrid",
"Sigurd",
"Silas",
"Sim",
"Simeon",
"Simone",
"Sincere",
"Sister",
"Skye",
"Skyla",
"Skylar",
"Sofia",
"Soledad",
"Solon",
"Sonia",
"Sonny",
"Sonya",
"Sophia",
"Sophie",
"Spencer",
"Stacey",
"Stacy",
"Stan",
"Stanford",
"Stanley",
"Stanton",
"Stefan",
"Stefanie",
"Stella",
"Stephan",
"Stephania",
"Stephanie",
"Stephany",
"Stephen",
"Stephon",
"Sterling",
"Steve",
"Stevie",
"Stewart",
"Stone",
"Stuart",
"Summer",
"Sunny",
"Susan",
"Susana",
"Susanna",
"Susie",
"Suzanne",
"Sven",
"Syble",
"Sydnee",
"Sydney",
"Sydni",
"Sydnie",
"Sylvan",
"Sylvester",
"Sylvia",
"Tabitha",
"Tad",
"Talia",
"Talon",
"Tamara",
"Tamia",
"Tania",
"Tanner",
"Tanya",
"Tara",
"Taryn",
"Tate",
"Tatum",
"Tatyana",
"Taurean",
"Tavares",
"Taya",
"Taylor",
"Teagan",
"Ted",
"Telly",
"Terence",
"Teresa",
"Terrance",
"Terrell",
"Terrence",
"Terrill",
"Terry",
"Tess",
"Tessie",
"Tevin",
"Thad",
"Thaddeus",
"Thalia",
"Thea",
"Thelma",
"Theo",
"Theodora",
"Theodore",
"Theresa",
"Therese",
"Theresia",
"Theron",
"Thomas",
"Thora",
"Thurman",
"Tia",
"Tiana",
"Tianna",
"Tiara",
"Tierra",
"Tiffany",
"Tillman",
"Timmothy",
"Timmy",
"Timothy",
"Tina",
"Tito",
"Titus",
"Tobin",
"Toby",
"Tod",
"Tom",
"Tomas",
"Tomasa",
"Tommie",
"Toney",
"Toni",
"Tony",
"Torey",
"Torrance",
"Torrey",
"Toy",
"Trace",
"Tracey",
"Tracy",
"Travis",
"Travon",
"Tre",
"Tremaine",
"Tremayne",
"Trent",
"Trenton",
"Tressa",
"Tressie",
"Treva",
"Trever",
"Trevion",
"Trevor",
"Trey",
"Trinity",
"Trisha",
"Tristian",
"Tristin",
"Triston",
"Troy",
"Trudie",
"Trycia",
"Trystan",
"Turner",
"Twila",
"Tyler",
"Tyra",
"Tyree",
"Tyreek",
"Tyrel",
"Tyrell",
"Tyrese",
"Tyrique",
"Tyshawn",
"Tyson",
"Ubaldo",
"Ulices",
"Ulises",
"Una",
"Unique",
"Urban",
"Uriah",
"Uriel",
"Ursula",
"Vada",
"Valentin",
"Valentina",
"Valentine",
"Valerie",
"Vallie",
"Van",
"Vance",
"Vanessa",
"Vaughn",
"Veda",
"Velda",
"Vella",
"Velma",
"Velva",
"Vena",
"Verda",
"Verdie",
"Vergie",
"Verla",
"Verlie",
"Vern",
"Verna",
"Verner",
"Vernice",
"Vernie",
"Vernon",
"Verona",
"Veronica",
"Vesta",
"Vicenta",
"Vicente",
"Vickie",
"Vicky",
"Victor",
"Victoria",
"Vida",
"Vidal",
"Vilma",
"Vince",
"Vincent",
"Vincenza",
"Vincenzo",
"Vinnie",
"Viola",
"Violet",
"Violette",
"Virgie",
"Virgil",
"Virginia",
"Virginie",
"Vita",
"Vito",
"Viva",
"Vivian",
"Viviane",
"Vivianne",
"Vivien",
"Vivienne",
"Vladimir",
"Wade",
"Waino",
"Waldo",
"Walker",
"Wallace",
"Walter",
"Walton",
"Wanda",
"Ward",
"Warren",
"Watson",
"Wava",
"Waylon",
"Wayne",
"Webster",
"Weldon",
"Wellington",
"Wendell",
"Wendy",
"Werner",
"Westley",
"Weston",
"Whitney",
"Wilber",
"Wilbert",
"Wilburn",
"Wiley",
"Wilford",
"Wilfred",
"Wilfredo",
"Wilfrid",
"Wilhelm",
"Wilhelmine",
"Will",
"Willa",
"Willard",
"William",
"Willie",
"Willis",
"Willow",
"Willy",
"Wilma",
"Wilmer",
"Wilson",
"Wilton",
"Winfield",
"Winifred",
"Winnifred",
"Winona",
"Winston",
"Woodrow",
"Wyatt",
"Wyman",
"Xander",
"Xavier",
"Xzavier",
"Yadira",
"Yasmeen",
"Yasmin",
"Yasmine",
"Yazmin",
"Yesenia",
"Yessenia",
"Yolanda",
"Yoshiko",
"Yvette",
"Yvonne",
"Zachariah",
"Zachary",
"Zachery",
"Zack",
"Zackary",
"Zackery",
"Zakary",
"Zander",
"Zane",
"Zaria",
"Zechariah",
"Zelda",
"Zella",
"Zelma",
"Zena",
"Zetta",
"Zion",
"Zita",
"Zoe",
"Zoey",
"Zoie",
"Zoila",
"Zola",
"Zora",
"Zula"
];
},{}],120:[function(require,module,exports){
var name = {};
module['exports'] = name;
name.first_name = require("./first_name");
name.last_name = require("./last_name");
name.prefix = require("./prefix");
name.suffix = require("./suffix");
name.title = require("./title");
name.name = require("./name");
},{"./first_name":119,"./last_name":121,"./name":122,"./prefix":123,"./suffix":124,"./title":125}],121:[function(require,module,exports){
module["exports"] = [
"Abbott",
"Abernathy",
"Abshire",
"Adams",
"Altenwerth",
"Anderson",
"Ankunding",
"Armstrong",
"Auer",
"Aufderhar",
"Bahringer",
"Bailey",
"Balistreri",
"Barrows",
"Bartell",
"Bartoletti",
"Barton",
"Bashirian",
"Batz",
"Bauch",
"Baumbach",
"Bayer",
"Beahan",
"Beatty",
"Bechtelar",
"Becker",
"Bednar",
"Beer",
"Beier",
"Berge",
"Bergnaum",
"Bergstrom",
"Bernhard",
"Bernier",
"Bins",
"Blanda",
"Blick",
"Block",
"Bode",
"Boehm",
"Bogan",
"Bogisich",
"Borer",
"Bosco",
"Botsford",
"Boyer",
"Boyle",
"Bradtke",
"Brakus",
"Braun",
"Breitenberg",
"Brekke",
"Brown",
"Bruen",
"Buckridge",
"Carroll",
"Carter",
"Cartwright",
"Casper",
"Cassin",
"Champlin",
"Christiansen",
"Cole",
"Collier",
"Collins",
"Conn",
"Connelly",
"Conroy",
"Considine",
"Corkery",
"Cormier",
"Corwin",
"Cremin",
"Crist",
"Crona",
"Cronin",
"Crooks",
"Cruickshank",
"Cummerata",
"Cummings",
"Dach",
"D'Amore",
"Daniel",
"Dare",
"Daugherty",
"Davis",
"Deckow",
"Denesik",
"Dibbert",
"Dickens",
"Dicki",
"Dickinson",
"Dietrich",
"Donnelly",
"Dooley",
"Douglas",
"Doyle",
"DuBuque",
"Durgan",
"Ebert",
"Effertz",
"Eichmann",
"Emard",
"Emmerich",
"Erdman",
"Ernser",
"Fadel",
"Fahey",
"Farrell",
"Fay",
"Feeney",
"Feest",
"Feil",
"Ferry",
"Fisher",
"Flatley",
"Frami",
"Franecki",
"Friesen",
"Fritsch",
"Funk",
"Gaylord",
"Gerhold",
"Gerlach",
"Gibson",
"Gislason",
"Gleason",
"Gleichner",
"Glover",
"Goldner",
"Goodwin",
"Gorczany",
"Gottlieb",
"Goyette",
"Grady",
"Graham",
"Grant",
"Green",
"Greenfelder",
"Greenholt",
"Grimes",
"Gulgowski",
"Gusikowski",
"Gutkowski",
"Gutmann",
"Haag",
"Hackett",
"Hagenes",
"Hahn",
"Haley",
"Halvorson",
"Hamill",
"Hammes",
"Hand",
"Hane",
"Hansen",
"Harber",
"Harris",
"Hartmann",
"Harvey",
"Hauck",
"Hayes",
"Heaney",
"Heathcote",
"Hegmann",
"Heidenreich",
"Heller",
"Herman",
"Hermann",
"Hermiston",
"Herzog",
"Hessel",
"Hettinger",
"Hickle",
"Hilll",
"Hills",
"Hilpert",
"Hintz",
"Hirthe",
"Hodkiewicz",
"Hoeger",
"Homenick",
"Hoppe",
"Howe",
"Howell",
"Hudson",
"Huel",
"Huels",
"Hyatt",
"Jacobi",
"Jacobs",
"Jacobson",
"Jakubowski",
"Jaskolski",
"Jast",
"Jenkins",
"Jerde",
"Johns",
"Johnson",
"Johnston",
"Jones",
"Kassulke",
"Kautzer",
"Keebler",
"Keeling",
"Kemmer",
"Kerluke",
"Kertzmann",
"Kessler",
"Kiehn",
"Kihn",
"Kilback",
"King",
"Kirlin",
"Klein",
"Kling",
"Klocko",
"Koch",
"Koelpin",
"Koepp",
"Kohler",
"Konopelski",
"Koss",
"Kovacek",
"Kozey",
"Krajcik",
"Kreiger",
"Kris",
"Kshlerin",
"Kub",
"Kuhic",
"Kuhlman",
"Kuhn",
"Kulas",
"Kunde",
"Kunze",
"Kuphal",
"Kutch",
"Kuvalis",
"Labadie",
"Lakin",
"Lang",
"Langosh",
"Langworth",
"Larkin",
"Larson",
"Leannon",
"Lebsack",
"Ledner",
"Leffler",
"Legros",
"Lehner",
"Lemke",
"Lesch",
"Leuschke",
"Lind",
"Lindgren",
"Littel",
"Little",
"Lockman",
"Lowe",
"Lubowitz",
"Lueilwitz",
"Luettgen",
"Lynch",
"Macejkovic",
"MacGyver",
"Maggio",
"Mann",
"Mante",
"Marks",
"Marquardt",
"Marvin",
"Mayer",
"Mayert",
"McClure",
"McCullough",
"McDermott",
"McGlynn",
"McKenzie",
"McLaughlin",
"Medhurst",
"Mertz",
"Metz",
"Miller",
"Mills",
"Mitchell",
"Moen",
"Mohr",
"Monahan",
"Moore",
"Morar",
"Morissette",
"Mosciski",
"Mraz",
"Mueller",
"Muller",
"Murazik",
"Murphy",
"Murray",
"Nader",
"Nicolas",
"Nienow",
"Nikolaus",
"Nitzsche",
"Nolan",
"Oberbrunner",
"O'Connell",
"O'Conner",
"O'Hara",
"O'Keefe",
"O'Kon",
"Okuneva",
"Olson",
"Ondricka",
"O'Reilly",
"Orn",
"Ortiz",
"Osinski",
"Pacocha",
"Padberg",
"Pagac",
"Parisian",
"Parker",
"Paucek",
"Pfannerstill",
"Pfeffer",
"Pollich",
"Pouros",
"Powlowski",
"Predovic",
"Price",
"Prohaska",
"Prosacco",
"Purdy",
"Quigley",
"Quitzon",
"Rath",
"Ratke",
"Rau",
"Raynor",
"Reichel",
"Reichert",
"Reilly",
"Reinger",
"Rempel",
"Renner",
"Reynolds",
"Rice",
"Rippin",
"Ritchie",
"Robel",
"Roberts",
"Rodriguez",
"Rogahn",
"Rohan",
"Rolfson",
"Romaguera",
"Roob",
"Rosenbaum",
"Rowe",
"Ruecker",
"Runolfsdottir",
"Runolfsson",
"Runte",
"Russel",
"Rutherford",
"Ryan",
"Sanford",
"Satterfield",
"Sauer",
"Sawayn",
"Schaden",
"Schaefer",
"Schamberger",
"Schiller",
"Schimmel",
"Schinner",
"Schmeler",
"Schmidt",
"Schmitt",
"Schneider",
"Schoen",
"Schowalter",
"Schroeder",
"Schulist",
"Schultz",
"Schumm",
"Schuppe",
"Schuster",
"Senger",
"Shanahan",
"Shields",
"Simonis",
"Sipes",
"Skiles",
"Smith",
"Smitham",
"Spencer",
"Spinka",
"Sporer",
"Stamm",
"Stanton",
"Stark",
"Stehr",
"Steuber",
"Stiedemann",
"Stokes",
"Stoltenberg",
"Stracke",
"Streich",
"Stroman",
"Strosin",
"Swaniawski",
"Swift",
"Terry",
"Thiel",
"Thompson",
"Tillman",
"Torp",
"Torphy",
"Towne",
"Toy",
"Trantow",
"Tremblay",
"Treutel",
"Tromp",
"Turcotte",
"Turner",
"Ullrich",
"Upton",
"Vandervort",
"Veum",
"Volkman",
"Von",
"VonRueden",
"Waelchi",
"Walker",
"Walsh",
"Walter",
"Ward",
"Waters",
"Watsica",
"Weber",
"Wehner",
"Weimann",
"Weissnat",
"Welch",
"West",
"White",
"Wiegand",
"Wilderman",
"Wilkinson",
"Will",
"Williamson",
"Willms",
"Windler",
"Wintheiser",
"Wisoky",
"Wisozk",
"Witting",
"Wiza",
"Wolf",
"Wolff",
"Wuckert",
"Wunsch",
"Wyman",
"Yost",
"Yundt",
"Zboncak",
"Zemlak",
"Ziemann",
"Zieme",
"Zulauf"
];
},{}],122:[function(require,module,exports){
module["exports"] = [
"#{prefix} #{first_name} #{last_name}",
"#{first_name} #{last_name} #{suffix}",
"#{first_name} #{last_name}",
"#{first_name} #{last_name}",
"#{first_name} #{last_name}",
"#{first_name} #{last_name}"
];
},{}],123:[function(require,module,exports){
module["exports"] = [
"Mr.",
"Mrs.",
"Ms.",
"Miss",
"Dr."
];
},{}],124:[function(require,module,exports){
module["exports"] = [
"Jr.",
"Sr.",
"I",
"II",
"III",
"IV",
"V",
"MD",
"DDS",
"PhD",
"DVM"
];
},{}],125:[function(require,module,exports){
module["exports"] = {
"descriptor": [
"Lead",
"Senior",
"Direct",
"Corporate",
"Dynamic",
"Future",
"Product",
"National",
"Regional",
"District",
"Central",
"Global",
"Customer",
"Investor",
"Dynamic",
"International",
"Legacy",
"Forward",
"Internal",
"Human",
"Chief",
"Principal"
],
"level": [
"Solutions",
"Program",
"Brand",
"Security",
"Research",
"Marketing",
"Directives",
"Implementation",
"Integration",
"Functionality",
"Response",
"Paradigm",
"Tactics",
"Identity",
"Markets",
"Group",
"Division",
"Applications",
"Optimization",
"Operations",
"Infrastructure",
"Intranet",
"Communications",
"Web",
"Branding",
"Quality",
"Assurance",
"Mobility",
"Accounts",
"Data",
"Creative",
"Configuration",
"Accountability",
"Interactions",
"Factors",
"Usability",
"Metrics"
],
"job": [
"Supervisor",
"Associate",
"Executive",
"Liason",
"Officer",
"Manager",
"Engineer",
"Specialist",
"Director",
"Coordinator",
"Administrator",
"Architect",
"Analyst",
"Designer",
"Planner",
"Orchestrator",
"Technician",
"Developer",
"Producer",
"Consultant",
"Assistant",
"Facilitator",
"Agent",
"Representative",
"Strategist"
]
};
},{}],126:[function(require,module,exports){
module["exports"] = [
"###-###-####",
"(###) ###-####",
"1-###-###-####",
"###.###.####",
"###-###-####",
"(###) ###-####",
"1-###-###-####",
"###.###.####",
"###-###-#### x###",
"(###) ###-#### x###",
"1-###-###-#### x###",
"###.###.#### x###",
"###-###-#### x####",
"(###) ###-#### x####",
"1-###-###-#### x####",
"###.###.#### x####",
"###-###-#### x#####",
"(###) ###-#### x#####",
"1-###-###-#### x#####",
"###.###.#### x#####"
];
},{}],127:[function(require,module,exports){
var phone_number = {};
module['exports'] = phone_number;
phone_number.formats = require("./formats");
},{"./formats":126}],128:[function(require,module,exports){
var system = {};
module['exports'] = system;
system.mimeTypes = require("./mimeTypes");
},{"./mimeTypes":129}],129:[function(require,module,exports){
/*
The MIT License (MIT)
Copyright (c) 2014 Jonathan Ong [email protected]
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.
Definitions from mime-db v1.21.0
For updates check: https://github.com/jshttp/mime-db/blob/master/db.json
*/
module['exports'] = {
"application/1d-interleaved-parityfec": {
"source": "iana"
},
"application/3gpdash-qoe-report+xml": {
"source": "iana"
},
"application/3gpp-ims+xml": {
"source": "iana"
},
"application/a2l": {
"source": "iana"
},
"application/activemessage": {
"source": "iana"
},
"application/alto-costmap+json": {
"source": "iana",
"compressible": true
},
"application/alto-costmapfilter+json": {
"source": "iana",
"compressible": true
},
"application/alto-directory+json": {
"source": "iana",
"compressible": true
},
"application/alto-endpointcost+json": {
"source": "iana",
"compressible": true
},
"application/alto-endpointcostparams+json": {
"source": "iana",
"compressible": true
},
"application/alto-endpointprop+json": {
"source": "iana",
"compressible": true
},
"application/alto-endpointpropparams+json": {
"source": "iana",
"compressible": true
},
"application/alto-error+json": {
"source": "iana",
"compressible": true
},
"application/alto-networkmap+json": {
"source": "iana",
"compressible": true
},
"application/alto-networkmapfilter+json": {
"source": "iana",
"compressible": true
},
"application/aml": {
"source": "iana"
},
"application/andrew-inset": {
"source": "iana",
"extensions": ["ez"]
},
"application/applefile": {
"source": "iana"
},
"application/applixware": {
"source": "apache",
"extensions": ["aw"]
},
"application/atf": {
"source": "iana"
},
"application/atfx": {
"source": "iana"
},
"application/atom+xml": {
"source": "iana",
"compressible": true,
"extensions": ["atom"]
},
"application/atomcat+xml": {
"source": "iana",
"extensions": ["atomcat"]
},
"application/atomdeleted+xml": {
"source": "iana"
},
"application/atomicmail": {
"source": "iana"
},
"application/atomsvc+xml": {
"source": "iana",
"extensions": ["atomsvc"]
},
"application/atxml": {
"source": "iana"
},
"application/auth-policy+xml": {
"source": "iana"
},
"application/bacnet-xdd+zip": {
"source": "iana"
},
"application/batch-smtp": {
"source": "iana"
},
"application/bdoc": {
"compressible": false,
"extensions": ["bdoc"]
},
"application/beep+xml": {
"source": "iana"
},
"application/calendar+json": {
"source": "iana",
"compressible": true
},
"application/calendar+xml": {
"source": "iana"
},
"application/call-completion": {
"source": "iana"
},
"application/cals-1840": {
"source": "iana"
},
"application/cbor": {
"source": "iana"
},
"application/ccmp+xml": {
"source": "iana"
},
"application/ccxml+xml": {
"source": "iana",
"extensions": ["ccxml"]
},
"application/cdfx+xml": {
"source": "iana"
},
"application/cdmi-capability": {
"source": "iana",
"extensions": ["cdmia"]
},
"application/cdmi-container": {
"source": "iana",
"extensions": ["cdmic"]
},
"application/cdmi-domain": {
"source": "iana",
"extensions": ["cdmid"]
},
"application/cdmi-object": {
"source": "iana",
"extensions": ["cdmio"]
},
"application/cdmi-queue": {
"source": "iana",
"extensions": ["cdmiq"]
},
"application/cdni": {
"source": "iana"
},
"application/cea": {
"source": "iana"
},
"application/cea-2018+xml": {
"source": "iana"
},
"application/cellml+xml": {
"source": "iana"
},
"application/cfw": {
"source": "iana"
},
"application/cms": {
"source": "iana"
},
"application/cnrp+xml": {
"source": "iana"
},
"application/coap-group+json": {
"source": "iana",
"compressible": true
},
"application/commonground": {
"source": "iana"
},
"application/conference-info+xml": {
"source": "iana"
},
"application/cpl+xml": {
"source": "iana"
},
"application/csrattrs": {
"source": "iana"
},
"application/csta+xml": {
"source": "iana"
},
"application/cstadata+xml": {
"source": "iana"
},
"application/csvm+json": {
"source": "iana",
"compressible": true
},
"application/cu-seeme": {
"source": "apache",
"extensions": ["cu"]
},
"application/cybercash": {
"source": "iana"
},
"application/dart": {
"compressible": true
},
"application/dash+xml": {
"source": "iana",
"extensions": ["mdp"]
},
"application/dashdelta": {
"source": "iana"
},
"application/davmount+xml": {
"source": "iana",
"extensions": ["davmount"]
},
"application/dca-rft": {
"source": "iana"
},
"application/dcd": {
"source": "iana"
},
"application/dec-dx": {
"source": "iana"
},
"application/dialog-info+xml": {
"source": "iana"
},
"application/dicom": {
"source": "iana"
},
"application/dii": {
"source": "iana"
},
"application/dit": {
"source": "iana"
},
"application/dns": {
"source": "iana"
},
"application/docbook+xml": {
"source": "apache",
"extensions": ["dbk"]
},
"application/dskpp+xml": {
"source": "iana"
},
"application/dssc+der": {
"source": "iana",
"extensions": ["dssc"]
},
"application/dssc+xml": {
"source": "iana",
"extensions": ["xdssc"]
},
"application/dvcs": {
"source": "iana"
},
"application/ecmascript": {
"source": "iana",
"compressible": true,
"extensions": ["ecma"]
},
"application/edi-consent": {
"source": "iana"
},
"application/edi-x12": {
"source": "iana",
"compressible": false
},
"application/edifact": {
"source": "iana",
"compressible": false
},
"application/emergencycalldata.comment+xml": {
"source": "iana"
},
"application/emergencycalldata.deviceinfo+xml": {
"source": "iana"
},
"application/emergencycalldata.providerinfo+xml": {
"source": "iana"
},
"application/emergencycalldata.serviceinfo+xml": {
"source": "iana"
},
"application/emergencycalldata.subscriberinfo+xml": {
"source": "iana"
},
"application/emma+xml": {
"source": "iana",
"extensions": ["emma"]
},
"application/emotionml+xml": {
"source": "iana"
},
"application/encaprtp": {
"source": "iana"
},
"application/epp+xml": {
"source": "iana"
},
"application/epub+zip": {
"source": "iana",
"extensions": ["epub"]
},
"application/eshop": {
"source": "iana"
},
"application/exi": {
"source": "iana",
"extensions": ["exi"]
},
"application/fastinfoset": {
"source": "iana"
},
"application/fastsoap": {
"source": "iana"
},
"application/fdt+xml": {
"source": "iana"
},
"application/fits": {
"source": "iana"
},
"application/font-sfnt": {
"source": "iana"
},
"application/font-tdpfr": {
"source": "iana",
"extensions": ["pfr"]
},
"application/font-woff": {
"source": "iana",
"compressible": false,
"extensions": ["woff"]
},
"application/font-woff2": {
"compressible": false,
"extensions": ["woff2"]
},
"application/framework-attributes+xml": {
"source": "iana"
},
"application/gml+xml": {
"source": "apache",
"extensions": ["gml"]
},
"application/gpx+xml": {
"source": "apache",
"extensions": ["gpx"]
},
"application/gxf": {
"source": "apache",
"extensions": ["gxf"]
},
"application/gzip": {
"source": "iana",
"compressible": false
},
"application/h224": {
"source": "iana"
},
"application/held+xml": {
"source": "iana"
},
"application/http": {
"source": "iana"
},
"application/hyperstudio": {
"source": "iana",
"extensions": ["stk"]
},
"application/ibe-key-request+xml": {
"source": "iana"
},
"application/ibe-pkg-reply+xml": {
"source": "iana"
},
"application/ibe-pp-data": {
"source": "iana"
},
"application/iges": {
"source": "iana"
},
"application/im-iscomposing+xml": {
"source": "iana"
},
"application/index": {
"source": "iana"
},
"application/index.cmd": {
"source": "iana"
},
"application/index.obj": {
"source": "iana"
},
"application/index.response": {
"source": "iana"
},
"application/index.vnd": {
"source": "iana"
},
"application/inkml+xml": {
"source": "iana",
"extensions": ["ink","inkml"]
},
"application/iotp": {
"source": "iana"
},
"application/ipfix": {
"source": "iana",
"extensions": ["ipfix"]
},
"application/ipp": {
"source": "iana"
},
"application/isup": {
"source": "iana"
},
"application/its+xml": {
"source": "iana"
},
"application/java-archive": {
"source": "apache",
"compressible": false,
"extensions": ["jar","war","ear"]
},
"application/java-serialized-object": {
"source": "apache",
"compressible": false,
"extensions": ["ser"]
},
"application/java-vm": {
"source": "apache",
"compressible": false,
"extensions": ["class"]
},
"application/javascript": {
"source": "iana",
"charset": "UTF-8",
"compressible": true,
"extensions": ["js"]
},
"application/jose": {
"source": "iana"
},
"application/jose+json": {
"source": "iana",
"compressible": true
},
"application/jrd+json": {
"source": "iana",
"compressible": true
},
"application/json": {
"source": "iana",
"charset": "UTF-8",
"compressible": true,
"extensions": ["json","map"]
},
"application/json-patch+json": {
"source": "iana",
"compressible": true
},
"application/json-seq": {
"source": "iana"
},
"application/json5": {
"extensions": ["json5"]
},
"application/jsonml+json": {
"source": "apache",
"compressible": true,
"extensions": ["jsonml"]
},
"application/jwk+json": {
"source": "iana",
"compressible": true
},
"application/jwk-set+json": {
"source": "iana",
"compressible": true
},
"application/jwt": {
"source": "iana"
},
"application/kpml-request+xml": {
"source": "iana"
},
"application/kpml-response+xml": {
"source": "iana"
},
"application/ld+json": {
"source": "iana",
"compressible": true,
"extensions": ["jsonld"]
},
"application/link-format": {
"source": "iana"
},
"application/load-control+xml": {
"source": "iana"
},
"application/lost+xml": {
"source": "iana",
"extensions": ["lostxml"]
},
"application/lostsync+xml": {
"source": "iana"
},
"application/lxf": {
"source": "iana"
},
"application/mac-binhex40": {
"source": "iana",
"extensions": ["hqx"]
},
"application/mac-compactpro": {
"source": "apache",
"extensions": ["cpt"]
},
"application/macwriteii": {
"source": "iana"
},
"application/mads+xml": {
"source": "iana",
"extensions": ["mads"]
},
"application/manifest+json": {
"charset": "UTF-8",
"compressible": true,
"extensions": ["webmanifest"]
},
"application/marc": {
"source": "iana",
"extensions": ["mrc"]
},
"application/marcxml+xml": {
"source": "iana",
"extensions": ["mrcx"]
},
"application/mathematica": {
"source": "iana",
"extensions": ["ma","nb","mb"]
},
"application/mathml+xml": {
"source": "iana",
"extensions": ["mathml"]
},
"application/mathml-content+xml": {
"source": "iana"
},
"application/mathml-presentation+xml": {
"source": "iana"
},
"application/mbms-associated-procedure-description+xml": {
"source": "iana"
},
"application/mbms-deregister+xml": {
"source": "iana"
},
"application/mbms-envelope+xml": {
"source": "iana"
},
"application/mbms-msk+xml": {
"source": "iana"
},
"application/mbms-msk-response+xml": {
"source": "iana"
},
"application/mbms-protection-description+xml": {
"source": "iana"
},
"application/mbms-reception-report+xml": {
"source": "iana"
},
"application/mbms-register+xml": {
"source": "iana"
},
"application/mbms-register-response+xml": {
"source": "iana"
},
"application/mbms-schedule+xml": {
"source": "iana"
},
"application/mbms-user-service-description+xml": {
"source": "iana"
},
"application/mbox": {
"source": "iana",
"extensions": ["mbox"]
},
"application/media-policy-dataset+xml": {
"source": "iana"
},
"application/media_control+xml": {
"source": "iana"
},
"application/mediaservercontrol+xml": {
"source": "iana",
"extensions": ["mscml"]
},
"application/merge-patch+json": {
"source": "iana",
"compressible": true
},
"application/metalink+xml": {
"source": "apache",
"extensions": ["metalink"]
},
"application/metalink4+xml": {
"source": "iana",
"extensions": ["meta4"]
},
"application/mets+xml": {
"source": "iana",
"extensions": ["mets"]
},
"application/mf4": {
"source": "iana"
},
"application/mikey": {
"source": "iana"
},
"application/mods+xml": {
"source": "iana",
"extensions": ["mods"]
},
"application/moss-keys": {
"source": "iana"
},
"application/moss-signature": {
"source": "iana"
},
"application/mosskey-data": {
"source": "iana"
},
"application/mosskey-request": {
"source": "iana"
},
"application/mp21": {
"source": "iana",
"extensions": ["m21","mp21"]
},
"application/mp4": {
"source": "iana",
"extensions": ["mp4s","m4p"]
},
"application/mpeg4-generic": {
"source": "iana"
},
"application/mpeg4-iod": {
"source": "iana"
},
"application/mpeg4-iod-xmt": {
"source": "iana"
},
"application/mrb-consumer+xml": {
"source": "iana"
},
"application/mrb-publish+xml": {
"source": "iana"
},
"application/msc-ivr+xml": {
"source": "iana"
},
"application/msc-mixer+xml": {
"source": "iana"
},
"application/msword": {
"source": "iana",
"compressible": false,
"extensions": ["doc","dot"]
},
"application/mxf": {
"source": "iana",
"extensions": ["mxf"]
},
"application/nasdata": {
"source": "iana"
},
"application/news-checkgroups": {
"source": "iana"
},
"application/news-groupinfo": {
"source": "iana"
},
"application/news-transmission": {
"source": "iana"
},
"application/nlsml+xml": {
"source": "iana"
},
"application/nss": {
"source": "iana"
},
"application/ocsp-request": {
"source": "iana"
},
"application/ocsp-response": {
"source": "iana"
},
"application/octet-stream": {
"source": "iana",
"compressible": false,
"extensions": ["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]
},
"application/oda": {
"source": "iana",
"extensions": ["oda"]
},
"application/odx": {
"source": "iana"
},
"application/oebps-package+xml": {
"source": "iana",
"extensions": ["opf"]
},
"application/ogg": {
"source": "iana",
"compressible": false,
"extensions": ["ogx"]
},
"application/omdoc+xml": {
"source": "apache",
"extensions": ["omdoc"]
},
"application/onenote": {
"source": "apache",
"extensions": ["onetoc","onetoc2","onetmp","onepkg"]
},
"application/oxps": {
"source": "iana",
"extensions": ["oxps"]
},
"application/p2p-overlay+xml": {
"source": "iana"
},
"application/parityfec": {
"source": "iana"
},
"application/patch-ops-error+xml": {
"source": "iana",
"extensions": ["xer"]
},
"application/pdf": {
"source": "iana",
"compressible": false,
"extensions": ["pdf"]
},
"application/pdx": {
"source": "iana"
},
"application/pgp-encrypted": {
"source": "iana",
"compressible": false,
"extensions": ["pgp"]
},
"application/pgp-keys": {
"source": "iana"
},
"application/pgp-signature": {
"source": "iana",
"extensions": ["asc","sig"]
},
"application/pics-rules": {
"source": "apache",
"extensions": ["prf"]
},
"application/pidf+xml": {
"source": "iana"
},
"application/pidf-diff+xml": {
"source": "iana"
},
"application/pkcs10": {
"source": "iana",
"extensions": ["p10"]
},
"application/pkcs12": {
"source": "iana"
},
"application/pkcs7-mime": {
"source": "iana",
"extensions": ["p7m","p7c"]
},
"application/pkcs7-signature": {
"source": "iana",
"extensions": ["p7s"]
},
"application/pkcs8": {
"source": "iana",
"extensions": ["p8"]
},
"application/pkix-attr-cert": {
"source": "iana",
"extensions": ["ac"]
},
"application/pkix-cert": {
"source": "iana",
"extensions": ["cer"]
},
"application/pkix-crl": {
"source": "iana",
"extensions": ["crl"]
},
"application/pkix-pkipath": {
"source": "iana",
"extensions": ["pkipath"]
},
"application/pkixcmp": {
"source": "iana",
"extensions": ["pki"]
},
"application/pls+xml": {
"source": "iana",
"extensions": ["pls"]
},
"application/poc-settings+xml": {
"source": "iana"
},
"application/postscript": {
"source": "iana",
"compressible": true,
"extensions": ["ai","eps","ps"]
},
"application/provenance+xml": {
"source": "iana"
},
"application/prs.alvestrand.titrax-sheet": {
"source": "iana"
},
"application/prs.cww": {
"source": "iana",
"extensions": ["cww"]
},
"application/prs.hpub+zip": {
"source": "iana"
},
"application/prs.nprend": {
"source": "iana"
},
"application/prs.plucker": {
"source": "iana"
},
"application/prs.rdf-xml-crypt": {
"source": "iana"
},
"application/prs.xsf+xml": {
"source": "iana"
},
"application/pskc+xml": {
"source": "iana",
"extensions": ["pskcxml"]
},
"application/qsig": {
"source": "iana"
},
"application/raptorfec": {
"source": "iana"
},
"application/rdap+json": {
"source": "iana",
"compressible": true
},
"application/rdf+xml": {
"source": "iana",
"compressible": true,
"extensions": ["rdf"]
},
"application/reginfo+xml": {
"source": "iana",
"extensions": ["rif"]
},
"application/relax-ng-compact-syntax": {
"source": "iana",
"extensions": ["rnc"]
},
"application/remote-printing": {
"source": "iana"
},
"application/reputon+json": {
"source": "iana",
"compressible": true
},
"application/resource-lists+xml": {
"source": "iana",
"extensions": ["rl"]
},
"application/resource-lists-diff+xml": {
"source": "iana",
"extensions": ["rld"]
},
"application/rfc+xml": {
"source": "iana"
},
"application/riscos": {
"source": "iana"
},
"application/rlmi+xml": {
"source": "iana"
},
"application/rls-services+xml": {
"source": "iana",
"extensions": ["rs"]
},
"application/rpki-ghostbusters": {
"source": "iana",
"extensions": ["gbr"]
},
"application/rpki-manifest": {
"source": "iana",
"extensions": ["mft"]
},
"application/rpki-roa": {
"source": "iana",
"extensions": ["roa"]
},
"application/rpki-updown": {
"source": "iana"
},
"application/rsd+xml": {
"source": "apache",
"extensions": ["rsd"]
},
"application/rss+xml": {
"source": "apache",
"compressible": true,
"extensions": ["rss"]
},
"application/rtf": {
"source": "iana",
"compressible": true,
"extensions": ["rtf"]
},
"application/rtploopback": {
"source": "iana"
},
"application/rtx": {
"source": "iana"
},
"application/samlassertion+xml": {
"source": "iana"
},
"application/samlmetadata+xml": {
"source": "iana"
},
"application/sbml+xml": {
"source": "iana",
"extensions": ["sbml"]
},
"application/scaip+xml": {
"source": "iana"
},
"application/scim+json": {
"source": "iana",
"compressible": true
},
"application/scvp-cv-request": {
"source": "iana",
"extensions": ["scq"]
},
"application/scvp-cv-response": {
"source": "iana",
"extensions": ["scs"]
},
"application/scvp-vp-request": {
"source": "iana",
"extensions": ["spq"]
},
"application/scvp-vp-response": {
"source": "iana",
"extensions": ["spp"]
},
"application/sdp": {
"source": "iana",
"extensions": ["sdp"]
},
"application/sep+xml": {
"source": "iana"
},
"application/sep-exi": {
"source": "iana"
},
"application/session-info": {
"source": "iana"
},
"application/set-payment": {
"source": "iana"
},
"application/set-payment-initiation": {
"source": "iana",
"extensions": ["setpay"]
},
"application/set-registration": {
"source": "iana"
},
"application/set-registration-initiation": {
"source": "iana",
"extensions": ["setreg"]
},
"application/sgml": {
"source": "iana"
},
"application/sgml-open-catalog": {
"source": "iana"
},
"application/shf+xml": {
"source": "iana",
"extensions": ["shf"]
},
"application/sieve": {
"source": "iana"
},
"application/simple-filter+xml": {
"source": "iana"
},
"application/simple-message-summary": {
"source": "iana"
},
"application/simplesymbolcontainer": {
"source": "iana"
},
"application/slate": {
"source": "iana"
},
"application/smil": {
"source": "iana"
},
"application/smil+xml": {
"source": "iana",
"extensions": ["smi","smil"]
},
"application/smpte336m": {
"source": "iana"
},
"application/soap+fastinfoset": {
"source": "iana"
},
"application/soap+xml": {
"source": "iana",
"compressible": true
},
"application/sparql-query": {
"source": "iana",
"extensions": ["rq"]
},
"application/sparql-results+xml": {
"source": "iana",
"extensions": ["srx"]
},
"application/spirits-event+xml": {
"source": "iana"
},
"application/sql": {
"source": "iana"
},
"application/srgs": {
"source": "iana",
"extensions": ["gram"]
},
"application/srgs+xml": {
"source": "iana",
"extensions": ["grxml"]
},
"application/sru+xml": {
"source": "iana",
"extensions": ["sru"]
},
"application/ssdl+xml": {
"source": "apache",
"extensions": ["ssdl"]
},
"application/ssml+xml": {
"source": "iana",
"extensions": ["ssml"]
},
"application/tamp-apex-update": {
"source": "iana"
},
"application/tamp-apex-update-confirm": {
"source": "iana"
},
"application/tamp-community-update": {
"source": "iana"
},
"application/tamp-community-update-confirm": {
"source": "iana"
},
"application/tamp-error": {
"source": "iana"
},
"application/tamp-sequence-adjust": {
"source": "iana"
},
"application/tamp-sequence-adjust-confirm": {
"source": "iana"
},
"application/tamp-status-query": {
"source": "iana"
},
"application/tamp-status-response": {
"source": "iana"
},
"application/tamp-update": {
"source": "iana"
},
"application/tamp-update-confirm": {
"source": "iana"
},
"application/tar": {
"compressible": true
},
"application/tei+xml": {
"source": "iana",
"extensions": ["tei","teicorpus"]
},
"application/thraud+xml": {
"source": "iana",
"extensions": ["tfi"]
},
"application/timestamp-query": {
"source": "iana"
},
"application/timestamp-reply": {
"source": "iana"
},
"application/timestamped-data": {
"source": "iana",
"extensions": ["tsd"]
},
"application/ttml+xml": {
"source": "iana"
},
"application/tve-trigger": {
"source": "iana"
},
"application/ulpfec": {
"source": "iana"
},
"application/urc-grpsheet+xml": {
"source": "iana"
},
"application/urc-ressheet+xml": {
"source": "iana"
},
"application/urc-targetdesc+xml": {
"source": "iana"
},
"application/urc-uisocketdesc+xml": {
"source": "iana"
},
"application/vcard+json": {
"source": "iana",
"compressible": true
},
"application/vcard+xml": {
"source": "iana"
},
"application/vemmi": {
"source": "iana"
},
"application/vividence.scriptfile": {
"source": "apache"
},
"application/vnd.3gpp-prose+xml": {
"source": "iana"
},
"application/vnd.3gpp-prose-pc3ch+xml": {
"source": "iana"
},
"application/vnd.3gpp.access-transfer-events+xml": {
"source": "iana"
},
"application/vnd.3gpp.bsf+xml": {
"source": "iana"
},
"application/vnd.3gpp.mid-call+xml": {
"source": "iana"
},
"application/vnd.3gpp.pic-bw-large": {
"source": "iana",
"extensions": ["plb"]
},
"application/vnd.3gpp.pic-bw-small": {
"source": "iana",
"extensions": ["psb"]
},
"application/vnd.3gpp.pic-bw-var": {
"source": "iana",
"extensions": ["pvb"]
},
"application/vnd.3gpp.sms": {
"source": "iana"
},
"application/vnd.3gpp.srvcc-ext+xml": {
"source": "iana"
},
"application/vnd.3gpp.srvcc-info+xml": {
"source": "iana"
},
"application/vnd.3gpp.state-and-event-info+xml": {
"source": "iana"
},
"application/vnd.3gpp.ussd+xml": {
"source": "iana"
},
"application/vnd.3gpp2.bcmcsinfo+xml": {
"source": "iana"
},
"application/vnd.3gpp2.sms": {
"source": "iana"
},
"application/vnd.3gpp2.tcap": {
"source": "iana",
"extensions": ["tcap"]
},
"application/vnd.3m.post-it-notes": {
"source": "iana",
"extensions": ["pwn"]
},
"application/vnd.accpac.simply.aso": {
"source": "iana",
"extensions": ["aso"]
},
"application/vnd.accpac.simply.imp": {
"source": "iana",
"extensions": ["imp"]
},
"application/vnd.acucobol": {
"source": "iana",
"extensions": ["acu"]
},
"application/vnd.acucorp": {
"source": "iana",
"extensions": ["atc","acutc"]
},
"application/vnd.adobe.air-application-installer-package+zip": {
"source": "apache",
"extensions": ["air"]
},
"application/vnd.adobe.flash.movie": {
"source": "iana"
},
"application/vnd.adobe.formscentral.fcdt": {
"source": "iana",
"extensions": ["fcdt"]
},
"application/vnd.adobe.fxp": {
"source": "iana",
"extensions": ["fxp","fxpl"]
},
"application/vnd.adobe.partial-upload": {
"source": "iana"
},
"application/vnd.adobe.xdp+xml": {
"source": "iana",
"extensions": ["xdp"]
},
"application/vnd.adobe.xfdf": {
"source": "iana",
"extensions": ["xfdf"]
},
"application/vnd.aether.imp": {
"source": "iana"
},
"application/vnd.ah-barcode": {
"source": "iana"
},
"application/vnd.ahead.space": {
"source": "iana",
"extensions": ["ahead"]
},
"application/vnd.airzip.filesecure.azf": {
"source": "iana",
"extensions": ["azf"]
},
"application/vnd.airzip.filesecure.azs": {
"source": "iana",
"extensions": ["azs"]
},
"application/vnd.amazon.ebook": {
"source": "apache",
"extensions": ["azw"]
},
"application/vnd.americandynamics.acc": {
"source": "iana",
"extensions": ["acc"]
},
"application/vnd.amiga.ami": {
"source": "iana",
"extensions": ["ami"]
},
"application/vnd.amundsen.maze+xml": {
"source": "iana"
},
"application/vnd.android.package-archive": {
"source": "apache",
"compressible": false,
"extensions": ["apk"]
},
"application/vnd.anki": {
"source": "iana"
},
"application/vnd.anser-web-certificate-issue-initiation": {
"source": "iana",
"extensions": ["cii"]
},
"application/vnd.anser-web-funds-transfer-initiation": {
"source": "apache",
"extensions": ["fti"]
},
"application/vnd.antix.game-component": {
"source": "iana",
"extensions": ["atx"]
},
"application/vnd.apache.thrift.binary": {
"source": "iana"
},
"application/vnd.apache.thrift.compact": {
"source": "iana"
},
"application/vnd.apache.thrift.json": {
"source": "iana"
},
"application/vnd.api+json": {
"source": "iana",
"compressible": true
},
"application/vnd.apple.installer+xml": {
"source": "iana",
"extensions": ["mpkg"]
},
"application/vnd.apple.mpegurl": {
"source": "iana",
"extensions": ["m3u8"]
},
"application/vnd.apple.pkpass": {
"compressible": false,
"extensions": ["pkpass"]
},
"application/vnd.arastra.swi": {
"source": "iana"
},
"application/vnd.aristanetworks.swi": {
"source": "iana",
"extensions": ["swi"]
},
"application/vnd.artsquare": {
"source": "iana"
},
"application/vnd.astraea-software.iota": {
"source": "iana",
"extensions": ["iota"]
},
"application/vnd.audiograph": {
"source": "iana",
"extensions": ["aep"]
},
"application/vnd.autopackage": {
"source": "iana"
},
"application/vnd.avistar+xml": {
"source": "iana"
},
"application/vnd.balsamiq.bmml+xml": {
"source": "iana"
},
"application/vnd.balsamiq.bmpr": {
"source": "iana"
},
"application/vnd.bekitzur-stech+json": {
"source": "iana",
"compressible": true
},
"application/vnd.biopax.rdf+xml": {
"source": "iana"
},
"application/vnd.blueice.multipass": {
"source": "iana",
"extensions": ["mpm"]
},
"application/vnd.bluetooth.ep.oob": {
"source": "iana"
},
"application/vnd.bluetooth.le.oob": {
"source": "iana"
},
"application/vnd.bmi": {
"source": "iana",
"extensions": ["bmi"]
},
"application/vnd.businessobjects": {
"source": "iana",
"extensions": ["rep"]
},
"application/vnd.cab-jscript": {
"source": "iana"
},
"application/vnd.canon-cpdl": {
"source": "iana"
},
"application/vnd.canon-lips": {
"source": "iana"
},
"application/vnd.cendio.thinlinc.clientconf": {
"source": "iana"
},
"application/vnd.century-systems.tcp_stream": {
"source": "iana"
},
"application/vnd.chemdraw+xml": {
"source": "iana",
"extensions": ["cdxml"]
},
"application/vnd.chipnuts.karaoke-mmd": {
"source": "iana",
"extensions": ["mmd"]
},
"application/vnd.cinderella": {
"source": "iana",
"extensions": ["cdy"]
},
"application/vnd.cirpack.isdn-ext": {
"source": "iana"
},
"application/vnd.citationstyles.style+xml": {
"source": "iana"
},
"application/vnd.claymore": {
"source": "iana",
"extensions": ["cla"]
},
"application/vnd.cloanto.rp9": {
"source": "iana",
"extensions": ["rp9"]
},
"application/vnd.clonk.c4group": {
"source": "iana",
"extensions": ["c4g","c4d","c4f","c4p","c4u"]
},
"application/vnd.cluetrust.cartomobile-config": {
"source": "iana",
"extensions": ["c11amc"]
},
"application/vnd.cluetrust.cartomobile-config-pkg": {
"source": "iana",
"extensions": ["c11amz"]
},
"application/vnd.coffeescript": {
"source": "iana"
},
"application/vnd.collection+json": {
"source": "iana",
"compressible": true
},
"application/vnd.collection.doc+json": {
"source": "iana",
"compressible": true
},
"application/vnd.collection.next+json": {
"source": "iana",
"compressible": true
},
"application/vnd.commerce-battelle": {
"source": "iana"
},
"application/vnd.commonspace": {
"source": "iana",
"extensions": ["csp"]
},
"application/vnd.contact.cmsg": {
"source": "iana",
"extensions": ["cdbcmsg"]
},
"application/vnd.cosmocaller": {
"source": "iana",
"extensions": ["cmc"]
},
"application/vnd.crick.clicker": {
"source": "iana",
"extensions": ["clkx"]
},
"application/vnd.crick.clicker.keyboard": {
"source": "iana",
"extensions": ["clkk"]
},
"application/vnd.crick.clicker.palette": {
"source": "iana",
"extensions": ["clkp"]
},
"application/vnd.crick.clicker.template": {
"source": "iana",
"extensions": ["clkt"]
},
"application/vnd.crick.clicker.wordbank": {
"source": "iana",
"extensions": ["clkw"]
},
"application/vnd.criticaltools.wbs+xml": {
"source": "iana",
"extensions": ["wbs"]
},
"application/vnd.ctc-posml": {
"source": "iana",
"extensions": ["pml"]
},
"application/vnd.ctct.ws+xml": {
"source": "iana"
},
"application/vnd.cups-pdf": {
"source": "iana"
},
"application/vnd.cups-postscript": {
"source": "iana"
},
"application/vnd.cups-ppd": {
"source": "iana",
"extensions": ["ppd"]
},
"application/vnd.cups-raster": {
"source": "iana"
},
"application/vnd.cups-raw": {
"source": "iana"
},
"application/vnd.curl": {
"source": "iana"
},
"application/vnd.curl.car": {
"source": "apache",
"extensions": ["car"]
},
"application/vnd.curl.pcurl": {
"source": "apache",
"extensions": ["pcurl"]
},
"application/vnd.cyan.dean.root+xml": {
"source": "iana"
},
"application/vnd.cybank": {
"source": "iana"
},
"application/vnd.dart": {
"source": "iana",
"compressible": true,
"extensions": ["dart"]
},
"application/vnd.data-vision.rdz": {
"source": "iana",
"extensions": ["rdz"]
},
"application/vnd.debian.binary-package": {
"source": "iana"
},
"application/vnd.dece.data": {
"source": "iana",
"extensions": ["uvf","uvvf","uvd","uvvd"]
},
"application/vnd.dece.ttml+xml": {
"source": "iana",
"extensions": ["uvt","uvvt"]
},
"application/vnd.dece.unspecified": {
"source": "iana",
"extensions": ["uvx","uvvx"]
},
"application/vnd.dece.zip": {
"source": "iana",
"extensions": ["uvz","uvvz"]
},
"application/vnd.denovo.fcselayout-link": {
"source": "iana",
"extensions": ["fe_launch"]
},
"application/vnd.desmume-movie": {
"source": "iana"
},
"application/vnd.dir-bi.plate-dl-nosuffix": {
"source": "iana"
},
"application/vnd.dm.delegation+xml": {
"source": "iana"
},
"application/vnd.dna": {
"source": "iana",
"extensions": ["dna"]
},
"application/vnd.document+json": {
"source": "iana",
"compressible": true
},
"application/vnd.dolby.mlp": {
"source": "apache",
"extensions": ["mlp"]
},
"application/vnd.dolby.mobile.1": {
"source": "iana"
},
"application/vnd.dolby.mobile.2": {
"source": "iana"
},
"application/vnd.doremir.scorecloud-binary-document": {
"source": "iana"
},
"application/vnd.dpgraph": {
"source": "iana",
"extensions": ["dpg"]
},
"application/vnd.dreamfactory": {
"source": "iana",
"extensions": ["dfac"]
},
"application/vnd.drive+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ds-keypoint": {
"source": "apache",
"extensions": ["kpxx"]
},
"application/vnd.dtg.local": {
"source": "iana"
},
"application/vnd.dtg.local.flash": {
"source": "iana"
},
"application/vnd.dtg.local.html": {
"source": "iana"
},
"application/vnd.dvb.ait": {
"source": "iana",
"extensions": ["ait"]
},
"application/vnd.dvb.dvbj": {
"source": "iana"
},
"application/vnd.dvb.esgcontainer": {
"source": "iana"
},
"application/vnd.dvb.ipdcdftnotifaccess": {
"source": "iana"
},
"application/vnd.dvb.ipdcesgaccess": {
"source": "iana"
},
"application/vnd.dvb.ipdcesgaccess2": {
"source": "iana"
},
"application/vnd.dvb.ipdcesgpdd": {
"source": "iana"
},
"application/vnd.dvb.ipdcroaming": {
"source": "iana"
},
"application/vnd.dvb.iptv.alfec-base": {
"source": "iana"
},
"application/vnd.dvb.iptv.alfec-enhancement": {
"source": "iana"
},
"application/vnd.dvb.notif-aggregate-root+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-container+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-generic+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-ia-msglist+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-ia-registration-request+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-ia-registration-response+xml": {
"source": "iana"
},
"application/vnd.dvb.notif-init+xml": {
"source": "iana"
},
"application/vnd.dvb.pfr": {
"source": "iana"
},
"application/vnd.dvb.service": {
"source": "iana",
"extensions": ["svc"]
},
"application/vnd.dxr": {
"source": "iana"
},
"application/vnd.dynageo": {
"source": "iana",
"extensions": ["geo"]
},
"application/vnd.dzr": {
"source": "iana"
},
"application/vnd.easykaraoke.cdgdownload": {
"source": "iana"
},
"application/vnd.ecdis-update": {
"source": "iana"
},
"application/vnd.ecowin.chart": {
"source": "iana",
"extensions": ["mag"]
},
"application/vnd.ecowin.filerequest": {
"source": "iana"
},
"application/vnd.ecowin.fileupdate": {
"source": "iana"
},
"application/vnd.ecowin.series": {
"source": "iana"
},
"application/vnd.ecowin.seriesrequest": {
"source": "iana"
},
"application/vnd.ecowin.seriesupdate": {
"source": "iana"
},
"application/vnd.emclient.accessrequest+xml": {
"source": "iana"
},
"application/vnd.enliven": {
"source": "iana",
"extensions": ["nml"]
},
"application/vnd.enphase.envoy": {
"source": "iana"
},
"application/vnd.eprints.data+xml": {
"source": "iana"
},
"application/vnd.epson.esf": {
"source": "iana",
"extensions": ["esf"]
},
"application/vnd.epson.msf": {
"source": "iana",
"extensions": ["msf"]
},
"application/vnd.epson.quickanime": {
"source": "iana",
"extensions": ["qam"]
},
"application/vnd.epson.salt": {
"source": "iana",
"extensions": ["slt"]
},
"application/vnd.epson.ssf": {
"source": "iana",
"extensions": ["ssf"]
},
"application/vnd.ericsson.quickcall": {
"source": "iana"
},
"application/vnd.eszigno3+xml": {
"source": "iana",
"extensions": ["es3","et3"]
},
"application/vnd.etsi.aoc+xml": {
"source": "iana"
},
"application/vnd.etsi.asic-e+zip": {
"source": "iana"
},
"application/vnd.etsi.asic-s+zip": {
"source": "iana"
},
"application/vnd.etsi.cug+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvcommand+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvdiscovery+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvprofile+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvsad-bc+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvsad-cod+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvsad-npvr+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvservice+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvsync+xml": {
"source": "iana"
},
"application/vnd.etsi.iptvueprofile+xml": {
"source": "iana"
},
"application/vnd.etsi.mcid+xml": {
"source": "iana"
},
"application/vnd.etsi.mheg5": {
"source": "iana"
},
"application/vnd.etsi.overload-control-policy-dataset+xml": {
"source": "iana"
},
"application/vnd.etsi.pstn+xml": {
"source": "iana"
},
"application/vnd.etsi.sci+xml": {
"source": "iana"
},
"application/vnd.etsi.simservs+xml": {
"source": "iana"
},
"application/vnd.etsi.timestamp-token": {
"source": "iana"
},
"application/vnd.etsi.tsl+xml": {
"source": "iana"
},
"application/vnd.etsi.tsl.der": {
"source": "iana"
},
"application/vnd.eudora.data": {
"source": "iana"
},
"application/vnd.ezpix-album": {
"source": "iana",
"extensions": ["ez2"]
},
"application/vnd.ezpix-package": {
"source": "iana",
"extensions": ["ez3"]
},
"application/vnd.f-secure.mobile": {
"source": "iana"
},
"application/vnd.fastcopy-disk-image": {
"source": "iana"
},
"application/vnd.fdf": {
"source": "iana",
"extensions": ["fdf"]
},
"application/vnd.fdsn.mseed": {
"source": "iana",
"extensions": ["mseed"]
},
"application/vnd.fdsn.seed": {
"source": "iana",
"extensions": ["seed","dataless"]
},
"application/vnd.ffsns": {
"source": "iana"
},
"application/vnd.filmit.zfc": {
"source": "iana"
},
"application/vnd.fints": {
"source": "iana"
},
"application/vnd.firemonkeys.cloudcell": {
"source": "iana"
},
"application/vnd.flographit": {
"source": "iana",
"extensions": ["gph"]
},
"application/vnd.fluxtime.clip": {
"source": "iana",
"extensions": ["ftc"]
},
"application/vnd.font-fontforge-sfd": {
"source": "iana"
},
"application/vnd.framemaker": {
"source": "iana",
"extensions": ["fm","frame","maker","book"]
},
"application/vnd.frogans.fnc": {
"source": "iana",
"extensions": ["fnc"]
},
"application/vnd.frogans.ltf": {
"source": "iana",
"extensions": ["ltf"]
},
"application/vnd.fsc.weblaunch": {
"source": "iana",
"extensions": ["fsc"]
},
"application/vnd.fujitsu.oasys": {
"source": "iana",
"extensions": ["oas"]
},
"application/vnd.fujitsu.oasys2": {
"source": "iana",
"extensions": ["oa2"]
},
"application/vnd.fujitsu.oasys3": {
"source": "iana",
"extensions": ["oa3"]
},
"application/vnd.fujitsu.oasysgp": {
"source": "iana",
"extensions": ["fg5"]
},
"application/vnd.fujitsu.oasysprs": {
"source": "iana",
"extensions": ["bh2"]
},
"application/vnd.fujixerox.art-ex": {
"source": "iana"
},
"application/vnd.fujixerox.art4": {
"source": "iana"
},
"application/vnd.fujixerox.ddd": {
"source": "iana",
"extensions": ["ddd"]
},
"application/vnd.fujixerox.docuworks": {
"source": "iana",
"extensions": ["xdw"]
},
"application/vnd.fujixerox.docuworks.binder": {
"source": "iana",
"extensions": ["xbd"]
},
"application/vnd.fujixerox.docuworks.container": {
"source": "iana"
},
"application/vnd.fujixerox.hbpl": {
"source": "iana"
},
"application/vnd.fut-misnet": {
"source": "iana"
},
"application/vnd.fuzzysheet": {
"source": "iana",
"extensions": ["fzs"]
},
"application/vnd.genomatix.tuxedo": {
"source": "iana",
"extensions": ["txd"]
},
"application/vnd.geo+json": {
"source": "iana",
"compressible": true
},
"application/vnd.geocube+xml": {
"source": "iana"
},
"application/vnd.geogebra.file": {
"source": "iana",
"extensions": ["ggb"]
},
"application/vnd.geogebra.tool": {
"source": "iana",
"extensions": ["ggt"]
},
"application/vnd.geometry-explorer": {
"source": "iana",
"extensions": ["gex","gre"]
},
"application/vnd.geonext": {
"source": "iana",
"extensions": ["gxt"]
},
"application/vnd.geoplan": {
"source": "iana",
"extensions": ["g2w"]
},
"application/vnd.geospace": {
"source": "iana",
"extensions": ["g3w"]
},
"application/vnd.gerber": {
"source": "iana"
},
"application/vnd.globalplatform.card-content-mgt": {
"source": "iana"
},
"application/vnd.globalplatform.card-content-mgt-response": {
"source": "iana"
},
"application/vnd.gmx": {
"source": "iana",
"extensions": ["gmx"]
},
"application/vnd.google-apps.document": {
"compressible": false,
"extensions": ["gdoc"]
},
"application/vnd.google-apps.presentation": {
"compressible": false,
"extensions": ["gslides"]
},
"application/vnd.google-apps.spreadsheet": {
"compressible": false,
"extensions": ["gsheet"]
},
"application/vnd.google-earth.kml+xml": {
"source": "iana",
"compressible": true,
"extensions": ["kml"]
},
"application/vnd.google-earth.kmz": {
"source": "iana",
"compressible": false,
"extensions": ["kmz"]
},
"application/vnd.gov.sk.e-form+xml": {
"source": "iana"
},
"application/vnd.gov.sk.e-form+zip": {
"source": "iana"
},
"application/vnd.gov.sk.xmldatacontainer+xml": {
"source": "iana"
},
"application/vnd.grafeq": {
"source": "iana",
"extensions": ["gqf","gqs"]
},
"application/vnd.gridmp": {
"source": "iana"
},
"application/vnd.groove-account": {
"source": "iana",
"extensions": ["gac"]
},
"application/vnd.groove-help": {
"source": "iana",
"extensions": ["ghf"]
},
"application/vnd.groove-identity-message": {
"source": "iana",
"extensions": ["gim"]
},
"application/vnd.groove-injector": {
"source": "iana",
"extensions": ["grv"]
},
"application/vnd.groove-tool-message": {
"source": "iana",
"extensions": ["gtm"]
},
"application/vnd.groove-tool-template": {
"source": "iana",
"extensions": ["tpl"]
},
"application/vnd.groove-vcard": {
"source": "iana",
"extensions": ["vcg"]
},
"application/vnd.hal+json": {
"source": "iana",
"compressible": true
},
"application/vnd.hal+xml": {
"source": "iana",
"extensions": ["hal"]
},
"application/vnd.handheld-entertainment+xml": {
"source": "iana",
"extensions": ["zmm"]
},
"application/vnd.hbci": {
"source": "iana",
"extensions": ["hbci"]
},
"application/vnd.hcl-bireports": {
"source": "iana"
},
"application/vnd.heroku+json": {
"source": "iana",
"compressible": true
},
"application/vnd.hhe.lesson-player": {
"source": "iana",
"extensions": ["les"]
},
"application/vnd.hp-hpgl": {
"source": "iana",
"extensions": ["hpgl"]
},
"application/vnd.hp-hpid": {
"source": "iana",
"extensions": ["hpid"]
},
"application/vnd.hp-hps": {
"source": "iana",
"extensions": ["hps"]
},
"application/vnd.hp-jlyt": {
"source": "iana",
"extensions": ["jlt"]
},
"application/vnd.hp-pcl": {
"source": "iana",
"extensions": ["pcl"]
},
"application/vnd.hp-pclxl": {
"source": "iana",
"extensions": ["pclxl"]
},
"application/vnd.httphone": {
"source": "iana"
},
"application/vnd.hydrostatix.sof-data": {
"source": "iana",
"extensions": ["sfd-hdstx"]
},
"application/vnd.hyperdrive+json": {
"source": "iana",
"compressible": true
},
"application/vnd.hzn-3d-crossword": {
"source": "iana"
},
"application/vnd.ibm.afplinedata": {
"source": "iana"
},
"application/vnd.ibm.electronic-media": {
"source": "iana"
},
"application/vnd.ibm.minipay": {
"source": "iana",
"extensions": ["mpy"]
},
"application/vnd.ibm.modcap": {
"source": "iana",
"extensions": ["afp","listafp","list3820"]
},
"application/vnd.ibm.rights-management": {
"source": "iana",
"extensions": ["irm"]
},
"application/vnd.ibm.secure-container": {
"source": "iana",
"extensions": ["sc"]
},
"application/vnd.iccprofile": {
"source": "iana",
"extensions": ["icc","icm"]
},
"application/vnd.ieee.1905": {
"source": "iana"
},
"application/vnd.igloader": {
"source": "iana",
"extensions": ["igl"]
},
"application/vnd.immervision-ivp": {
"source": "iana",
"extensions": ["ivp"]
},
"application/vnd.immervision-ivu": {
"source": "iana",
"extensions": ["ivu"]
},
"application/vnd.ims.imsccv1p1": {
"source": "iana"
},
"application/vnd.ims.imsccv1p2": {
"source": "iana"
},
"application/vnd.ims.imsccv1p3": {
"source": "iana"
},
"application/vnd.ims.lis.v2.result+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ims.lti.v2.toolconsumerprofile+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ims.lti.v2.toolproxy+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ims.lti.v2.toolproxy.id+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ims.lti.v2.toolsettings+json": {
"source": "iana",
"compressible": true
},
"application/vnd.ims.lti.v2.toolsettings.simple+json": {
"source": "iana",
"compressible": true
},
"application/vnd.informedcontrol.rms+xml": {
"source": "iana"
},
"application/vnd.informix-visionary": {
"source": "iana"
},
"application/vnd.infotech.project": {
"source": "iana"
},
"application/vnd.infotech.project+xml": {
"source": "iana"
},
"application/vnd.innopath.wamp.notification": {
"source": "iana"
},
"application/vnd.insors.igm": {
"source": "iana",
"extensions": ["igm"]
},
"application/vnd.intercon.formnet": {
"source": "iana",
"extensions": ["xpw","xpx"]
},
"application/vnd.intergeo": {
"source": "iana",
"extensions": ["i2g"]
},
"application/vnd.intertrust.digibox": {
"source": "iana"
},
"application/vnd.intertrust.nncp": {
"source": "iana"
},
"application/vnd.intu.qbo": {
"source": "iana",
"extensions": ["qbo"]
},
"application/vnd.intu.qfx": {
"source": "iana",
"extensions": ["qfx"]
},
"application/vnd.iptc.g2.catalogitem+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.conceptitem+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.knowledgeitem+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.newsitem+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.newsmessage+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.packageitem+xml": {
"source": "iana"
},
"application/vnd.iptc.g2.planningitem+xml": {
"source": "iana"
},
"application/vnd.ipunplugged.rcprofile": {
"source": "iana",
"extensions": ["rcprofile"]
},
"application/vnd.irepository.package+xml": {
"source": "iana",
"extensions": ["irp"]
},
"application/vnd.is-xpr": {
"source": "iana",
"extensions": ["xpr"]
},
"application/vnd.isac.fcs": {
"source": "iana",
"extensions": ["fcs"]
},
"application/vnd.jam": {
"source": "iana",
"extensions": ["jam"]
},
"application/vnd.japannet-directory-service": {
"source": "iana"
},
"application/vnd.japannet-jpnstore-wakeup": {
"source": "iana"
},
"application/vnd.japannet-payment-wakeup": {
"source": "iana"
},
"application/vnd.japannet-registration": {
"source": "iana"
},
"application/vnd.japannet-registration-wakeup": {
"source": "iana"
},
"application/vnd.japannet-setstore-wakeup": {
"source": "iana"
},
"application/vnd.japannet-verification": {
"source": "iana"
},
"application/vnd.japannet-verification-wakeup": {
"source": "iana"
},
"application/vnd.jcp.javame.midlet-rms": {
"source": "iana",
"extensions": ["rms"]
},
"application/vnd.jisp": {
"source": "iana",
"extensions": ["jisp"]
},
"application/vnd.joost.joda-archive": {
"source": "iana",
"extensions": ["joda"]
},
"application/vnd.jsk.isdn-ngn": {
"source": "iana"
},
"application/vnd.kahootz": {
"source": "iana",
"extensions": ["ktz","ktr"]
},
"application/vnd.kde.karbon": {
"source": "iana",
"extensions": ["karbon"]
},
"application/vnd.kde.kchart": {
"source": "iana",
"extensions": ["chrt"]
},
"application/vnd.kde.kformula": {
"source": "iana",
"extensions": ["kfo"]
},
"application/vnd.kde.kivio": {
"source": "iana",
"extensions": ["flw"]
},
"application/vnd.kde.kontour": {
"source": "iana",
"extensions": ["kon"]
},
"application/vnd.kde.kpresenter": {
"source": "iana",
"extensions": ["kpr","kpt"]
},
"application/vnd.kde.kspread": {
"source": "iana",
"extensions": ["ksp"]
},
"application/vnd.kde.kword": {
"source": "iana",
"extensions": ["kwd","kwt"]
},
"application/vnd.kenameaapp": {
"source": "iana",
"extensions": ["htke"]
},
"application/vnd.kidspiration": {
"source": "iana",
"extensions": ["kia"]
},
"application/vnd.kinar": {
"source": "iana",
"extensions": ["kne","knp"]
},
"application/vnd.koan": {
"source": "iana",
"extensions": ["skp","skd","skt","skm"]
},
"application/vnd.kodak-descriptor": {
"source": "iana",
"extensions": ["sse"]
},
"application/vnd.las.las+xml": {
"source": "iana",
"extensions": ["lasxml"]
},
"application/vnd.liberty-request+xml": {
"source": "iana"
},
"application/vnd.llamagraphics.life-balance.desktop": {
"source": "iana",
"extensions": ["lbd"]
},
"application/vnd.llamagraphics.life-balance.exchange+xml": {
"source": "iana",
"extensions": ["lbe"]
},
"application/vnd.lotus-1-2-3": {
"source": "iana",
"extensions": ["123"]
},
"application/vnd.lotus-approach": {
"source": "iana",
"extensions": ["apr"]
},
"application/vnd.lotus-freelance": {
"source": "iana",
"extensions": ["pre"]
},
"application/vnd.lotus-notes": {
"source": "iana",
"extensions": ["nsf"]
},
"application/vnd.lotus-organizer": {
"source": "iana",
"extensions": ["org"]
},
"application/vnd.lotus-screencam": {
"source": "iana",
"extensions": ["scm"]
},
"application/vnd.lotus-wordpro": {
"source": "iana",
"extensions": ["lwp"]
},
"application/vnd.macports.portpkg": {
"source": "iana",
"extensions": ["portpkg"]
},
"application/vnd.mapbox-vector-tile": {
"source": "iana"
},
"application/vnd.marlin.drm.actiontoken+xml": {
"source": "iana"
},
"application/vnd.marlin.drm.conftoken+xml": {
"source": "iana"
},
"application/vnd.marlin.drm.license+xml": {
"source": "iana"
},
"application/vnd.marlin.drm.mdcf": {
"source": "iana"
},
"application/vnd.mason+json": {
"source": "iana",
"compressible": true
},
"application/vnd.maxmind.maxmind-db": {
"source": "iana"
},
"application/vnd.mcd": {
"source": "iana",
"extensions": ["mcd"]
},
"application/vnd.medcalcdata": {
"source": "iana",
"extensions": ["mc1"]
},
"application/vnd.mediastation.cdkey": {
"source": "iana",
"extensions": ["cdkey"]
},
"application/vnd.meridian-slingshot": {
"source": "iana"
},
"application/vnd.mfer": {
"source": "iana",
"extensions": ["mwf"]
},
"application/vnd.mfmp": {
"source": "iana",
"extensions": ["mfm"]
},
"application/vnd.micro+json": {
"source": "iana",
"compressible": true
},
"application/vnd.micrografx.flo": {
"source": "iana",
"extensions": ["flo"]
},
"application/vnd.micrografx.igx": {
"source": "iana",
"extensions": ["igx"]
},
"application/vnd.microsoft.portable-executable": {
"source": "iana"
},
"application/vnd.miele+json": {
"source": "iana",
"compressible": true
},
"application/vnd.mif": {
"source": "iana",
"extensions": ["mif"]
},
"application/vnd.minisoft-hp3000-save": {
"source": "iana"
},
"application/vnd.mitsubishi.misty-guard.trustweb": {
"source": "iana"
},
"application/vnd.mobius.daf": {
"source": "iana",
"extensions": ["daf"]
},
"application/vnd.mobius.dis": {
"source": "iana",
"extensions": ["dis"]
},
"application/vnd.mobius.mbk": {
"source": "iana",
"extensions": ["mbk"]
},
"application/vnd.mobius.mqy": {
"source": "iana",
"extensions": ["mqy"]
},
"application/vnd.mobius.msl": {
"source": "iana",
"extensions": ["msl"]
},
"application/vnd.mobius.plc": {
"source": "iana",
"extensions": ["plc"]
},
"application/vnd.mobius.txf": {
"source": "iana",
"extensions": ["txf"]
},
"application/vnd.mophun.application": {
"source": "iana",
"extensions": ["mpn"]
},
"application/vnd.mophun.certificate": {
"source": "iana",
"extensions": ["mpc"]
},
"application/vnd.motorola.flexsuite": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.adsi": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.fis": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.gotap": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.kmr": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.ttc": {
"source": "iana"
},
"application/vnd.motorola.flexsuite.wem": {
"source": "iana"
},
"application/vnd.motorola.iprm": {
"source": "iana"
},
"application/vnd.mozilla.xul+xml": {
"source": "iana",
"compressible": true,
"extensions": ["xul"]
},
"application/vnd.ms-3mfdocument": {
"source": "iana"
},
"application/vnd.ms-artgalry": {
"source": "iana",
"extensions": ["cil"]
},
"application/vnd.ms-asf": {
"source": "iana"
},
"application/vnd.ms-cab-compressed": {
"source": "iana",
"extensions": ["cab"]
},
"application/vnd.ms-color.iccprofile": {
"source": "apache"
},
"application/vnd.ms-excel": {
"source": "iana",
"compressible": false,
"extensions": ["xls","xlm","xla","xlc","xlt","xlw"]
},
"application/vnd.ms-excel.addin.macroenabled.12": {
"source": "iana",
"extensions": ["xlam"]
},
"application/vnd.ms-excel.sheet.binary.macroenabled.12": {
"source": "iana",
"extensions": ["xlsb"]
},
"application/vnd.ms-excel.sheet.macroenabled.12": {
"source": "iana",
"extensions": ["xlsm"]
},
"application/vnd.ms-excel.template.macroenabled.12": {
"source": "iana",
"extensions": ["xltm"]
},
"application/vnd.ms-fontobject": {
"source": "iana",
"compressible": true,
"extensions": ["eot"]
},
"application/vnd.ms-htmlhelp": {
"source": "iana",
"extensions": ["chm"]
},
"application/vnd.ms-ims": {
"source": "iana",
"extensions": ["ims"]
},
"application/vnd.ms-lrm": {
"source": "iana",
"extensions": ["lrm"]
},
"application/vnd.ms-office.activex+xml": {
"source": "iana"
},
"application/vnd.ms-officetheme": {
"source": "iana",
"extensions": ["thmx"]
},
"application/vnd.ms-opentype": {
"source": "apache",
"compressible": true
},
"application/vnd.ms-package.obfuscated-opentype": {
"source": "apache"
},
"application/vnd.ms-pki.seccat": {
"source": "apache",
"extensions": ["cat"]
},
"application/vnd.ms-pki.stl": {
"source": "apache",
"extensions": ["stl"]
},
"application/vnd.ms-playready.initiator+xml": {
"source": "iana"
},
"application/vnd.ms-powerpoint": {
"source": "iana",
"compressible": false,
"extensions": ["ppt","pps","pot"]
},
"application/vnd.ms-powerpoint.addin.macroenabled.12": {
"source": "iana",
"extensions": ["ppam"]
},
"application/vnd.ms-powerpoint.presentation.macroenabled.12": {
"source": "iana",
"extensions": ["pptm"]
},
"application/vnd.ms-powerpoint.slide.macroenabled.12": {
"source": "iana",
"extensions": ["sldm"]
},
"application/vnd.ms-powerpoint.slideshow.macroenabled.12": {
"source": "iana",
"extensions": ["ppsm"]
},
"application/vnd.ms-powerpoint.template.macroenabled.12": {
"source": "iana",
"extensions": ["potm"]
},
"application/vnd.ms-printdevicecapabilities+xml": {
"source": "iana"
},
"application/vnd.ms-printing.printticket+xml": {
"source": "apache"
},
"application/vnd.ms-project": {
"source": "iana",
"extensions": ["mpp","mpt"]
},
"application/vnd.ms-tnef": {
"source": "iana"
},
"application/vnd.ms-windows.devicepairing": {
"source": "iana"
},
"application/vnd.ms-windows.nwprinting.oob": {
"source": "iana"
},
"application/vnd.ms-windows.printerpairing": {
"source": "iana"
},
"application/vnd.ms-windows.wsd.oob": {
"source": "iana"
},
"application/vnd.ms-wmdrm.lic-chlg-req": {
"source": "iana"
},
"application/vnd.ms-wmdrm.lic-resp": {
"source": "iana"
},
"application/vnd.ms-wmdrm.meter-chlg-req": {
"source": "iana"
},
"application/vnd.ms-wmdrm.meter-resp": {
"source": "iana"
},
"application/vnd.ms-word.document.macroenabled.12": {
"source": "iana",
"extensions": ["docm"]
},
"application/vnd.ms-word.template.macroenabled.12": {
"source": "iana",
"extensions": ["dotm"]
},
"application/vnd.ms-works": {
"source": "iana",
"extensions": ["wps","wks","wcm","wdb"]
},
"application/vnd.ms-wpl": {
"source": "iana",
"extensions": ["wpl"]
},
"application/vnd.ms-xpsdocument": {
"source": "iana",
"compressible": false,
"extensions": ["xps"]
},
"application/vnd.msa-disk-image": {
"source": "iana"
},
"application/vnd.mseq": {
"source": "iana",
"extensions": ["mseq"]
},
"application/vnd.msign": {
"source": "iana"
},
"application/vnd.multiad.creator": {
"source": "iana"
},
"application/vnd.multiad.creator.cif": {
"source": "iana"
},
"application/vnd.music-niff": {
"source": "iana"
},
"application/vnd.musician": {
"source": "iana",
"extensions": ["mus"]
},
"application/vnd.muvee.style": {
"source": "iana",
"extensions": ["msty"]
},
"application/vnd.mynfc": {
"source": "iana",
"extensions": ["taglet"]
},
"application/vnd.ncd.control": {
"source": "iana"
},
"application/vnd.ncd.reference": {
"source": "iana"
},
"application/vnd.nervana": {
"source": "iana"
},
"application/vnd.netfpx": {
"source": "iana"
},
"application/vnd.neurolanguage.nlu": {
"source": "iana",
"extensions": ["nlu"]
},
"application/vnd.nintendo.nitro.rom": {
"source": "iana"
},
"application/vnd.nintendo.snes.rom": {
"source": "iana"
},
"application/vnd.nitf": {
"source": "iana",
"extensions": ["ntf","nitf"]
},
"application/vnd.noblenet-directory": {
"source": "iana",
"extensions": ["nnd"]
},
"application/vnd.noblenet-sealer": {
"source": "iana",
"extensions": ["nns"]
},
"application/vnd.noblenet-web": {
"source": "iana",
"extensions": ["nnw"]
},
"application/vnd.nokia.catalogs": {
"source": "iana"
},
"application/vnd.nokia.conml+wbxml": {
"source": "iana"
},
"application/vnd.nokia.conml+xml": {
"source": "iana"
},
"application/vnd.nokia.iptv.config+xml": {
"source": "iana"
},
"application/vnd.nokia.isds-radio-presets": {
"source": "iana"
},
"application/vnd.nokia.landmark+wbxml": {
"source": "iana"
},
"application/vnd.nokia.landmark+xml": {
"source": "iana"
},
"application/vnd.nokia.landmarkcollection+xml": {
"source": "iana"
},
"application/vnd.nokia.n-gage.ac+xml": {
"source": "iana"
},
"application/vnd.nokia.n-gage.data": {
"source": "iana",
"extensions": ["ngdat"]
},
"application/vnd.nokia.n-gage.symbian.install": {
"source": "iana",
"extensions": ["n-gage"]
},
"application/vnd.nokia.ncd": {
"source": "iana"
},
"application/vnd.nokia.pcd+wbxml": {
"source": "iana"
},
"application/vnd.nokia.pcd+xml": {
"source": "iana"
},
"application/vnd.nokia.radio-preset": {
"source": "iana",
"extensions": ["rpst"]
},
"application/vnd.nokia.radio-presets": {
"source": "iana",
"extensions": ["rpss"]
},
"application/vnd.novadigm.edm": {
"source": "iana",
"extensions": ["edm"]
},
"application/vnd.novadigm.edx": {
"source": "iana",
"extensions": ["edx"]
},
"application/vnd.novadigm.ext": {
"source": "iana",
"extensions": ["ext"]
},
"application/vnd.ntt-local.content-share": {
"source": "iana"
},
"application/vnd.ntt-local.file-transfer": {
"source": "iana"
},
"application/vnd.ntt-local.ogw_remote-access": {
"source": "iana"
},
"application/vnd.ntt-local.sip-ta_remote": {
"source": "iana"
},
"application/vnd.ntt-local.sip-ta_tcp_stream": {
"source": "iana"
},
"application/vnd.oasis.opendocument.chart": {
"source": "iana",
"extensions": ["odc"]
},
"application/vnd.oasis.opendocument.chart-template": {
"source": "iana",
"extensions": ["otc"]
},
"application/vnd.oasis.opendocument.database": {
"source": "iana",
"extensions": ["odb"]
},
"application/vnd.oasis.opendocument.formula": {
"source": "iana",
"extensions": ["odf"]
},
"application/vnd.oasis.opendocument.formula-template": {
"source": "iana",
"extensions": ["odft"]
},
"application/vnd.oasis.opendocument.graphics": {
"source": "iana",
"compressible": false,
"extensions": ["odg"]
},
"application/vnd.oasis.opendocument.graphics-template": {
"source": "iana",
"extensions": ["otg"]
},
"application/vnd.oasis.opendocument.image": {
"source": "iana",
"extensions": ["odi"]
},
"application/vnd.oasis.opendocument.image-template": {
"source": "iana",
"extensions": ["oti"]
},
"application/vnd.oasis.opendocument.presentation": {
"source": "iana",
"compressible": false,
"extensions": ["odp"]
},
"application/vnd.oasis.opendocument.presentation-template": {
"source": "iana",
"extensions": ["otp"]
},
"application/vnd.oasis.opendocument.spreadsheet": {
"source": "iana",
"compressible": false,
"extensions": ["ods"]
},
"application/vnd.oasis.opendocument.spreadsheet-template": {
"source": "iana",
"extensions": ["ots"]
},
"application/vnd.oasis.opendocument.text": {
"source": "iana",
"compressible": false,
"extensions": ["odt"]
},
"application/vnd.oasis.opendocument.text-master": {
"source": "iana",
"extensions": ["odm"]
},
"application/vnd.oasis.opendocument.text-template": {
"source": "iana",
"extensions": ["ott"]
},
"application/vnd.oasis.opendocument.text-web": {
"source": "iana",
"extensions": ["oth"]
},
"application/vnd.obn": {
"source": "iana"
},
"application/vnd.oftn.l10n+json": {
"source": "iana",
"compressible": true
},
"application/vnd.oipf.contentaccessdownload+xml": {
"source": "iana"
},
"application/vnd.oipf.contentaccessstreaming+xml": {
"source": "iana"
},
"application/vnd.oipf.cspg-hexbinary": {
"source": "iana"
},
"application/vnd.oipf.dae.svg+xml": {
"source": "iana"
},
"application/vnd.oipf.dae.xhtml+xml": {
"source": "iana"
},
"application/vnd.oipf.mippvcontrolmessage+xml": {
"source": "iana"
},
"application/vnd.oipf.pae.gem": {
"source": "iana"
},
"application/vnd.oipf.spdiscovery+xml": {
"source": "iana"
},
"application/vnd.oipf.spdlist+xml": {
"source": "iana"
},
"application/vnd.oipf.ueprofile+xml": {
"source": "iana"
},
"application/vnd.oipf.userprofile+xml": {
"source": "iana"
},
"application/vnd.olpc-sugar": {
"source": "iana",
"extensions": ["xo"]
},
"application/vnd.oma-scws-config": {
"source": "iana"
},
"application/vnd.oma-scws-http-request": {
"source": "iana"
},
"application/vnd.oma-scws-http-response": {
"source": "iana"
},
"application/vnd.oma.bcast.associated-procedure-parameter+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.drm-trigger+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.imd+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.ltkm": {
"source": "iana"
},
"application/vnd.oma.bcast.notification+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.provisioningtrigger": {
"source": "iana"
},
"application/vnd.oma.bcast.sgboot": {
"source": "iana"
},
"application/vnd.oma.bcast.sgdd+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.sgdu": {
"source": "iana"
},
"application/vnd.oma.bcast.simple-symbol-container": {
"source": "iana"
},
"application/vnd.oma.bcast.smartcard-trigger+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.sprov+xml": {
"source": "iana"
},
"application/vnd.oma.bcast.stkm": {
"source": "iana"
},
"application/vnd.oma.cab-address-book+xml": {
"source": "iana"
},
"application/vnd.oma.cab-feature-handler+xml": {
"source": "iana"
},
"application/vnd.oma.cab-pcc+xml": {
"source": "iana"
},
"application/vnd.oma.cab-subs-invite+xml": {
"source": "iana"
},
"application/vnd.oma.cab-user-prefs+xml": {
"source": "iana"
},
"application/vnd.oma.dcd": {
"source": "iana"
},
"application/vnd.oma.dcdc": {
"source": "iana"
},
"application/vnd.oma.dd2+xml": {
"source": "iana",
"extensions": ["dd2"]
},
"application/vnd.oma.drm.risd+xml": {
"source": "iana"
},
"application/vnd.oma.group-usage-list+xml": {
"source": "iana"
},
"application/vnd.oma.pal+xml": {
"source": "iana"
},
"application/vnd.oma.poc.detailed-progress-report+xml": {
"source": "iana"
},
"application/vnd.oma.poc.final-report+xml": {
"source": "iana"
},
"application/vnd.oma.poc.groups+xml": {
"source": "iana"
},
"application/vnd.oma.poc.invocation-descriptor+xml": {
"source": "iana"
},
"application/vnd.oma.poc.optimized-progress-report+xml": {
"source": "iana"
},
"application/vnd.oma.push": {
"source": "iana"
},
"application/vnd.oma.scidm.messages+xml": {
"source": "iana"
},
"application/vnd.oma.xcap-directory+xml": {
"source": "iana"
},
"application/vnd.omads-email+xml": {
"source": "iana"
},
"application/vnd.omads-file+xml": {
"source": "iana"
},
"application/vnd.omads-folder+xml": {
"source": "iana"
},
"application/vnd.omaloc-supl-init": {
"source": "iana"
},
"application/vnd.openblox.game+xml": {
"source": "iana"
},
"application/vnd.openblox.game-binary": {
"source": "iana"
},
"application/vnd.openeye.oeb": {
"source": "iana"
},
"application/vnd.openofficeorg.extension": {
"source": "apache",
"extensions": ["oxt"]
},
"application/vnd.openxmlformats-officedocument.custom-properties+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.customxmlproperties+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawing+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.chart+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.extended-properties+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml-template": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.comments+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.presentation": {
"source": "iana",
"compressible": false,
"extensions": ["pptx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.slide": {
"source": "iana",
"extensions": ["sldx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.slide+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.slideshow": {
"source": "iana",
"extensions": ["ppsx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.tags+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.template": {
"source": "apache",
"extensions": ["potx"]
},
"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml-template": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
"source": "iana",
"compressible": false,
"extensions": ["xlsx"]
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.template": {
"source": "apache",
"extensions": ["xltx"]
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.theme+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.themeoverride+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.vmldrawing": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml-template": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
"source": "iana",
"compressible": false,
"extensions": ["docx"]
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.template": {
"source": "apache",
"extensions": ["dotx"]
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-package.core-properties+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml": {
"source": "iana"
},
"application/vnd.openxmlformats-package.relationships+xml": {
"source": "iana"
},
"application/vnd.oracle.resource+json": {
"source": "iana",
"compressible": true
},
"application/vnd.orange.indata": {
"source": "iana"
},
"application/vnd.osa.netdeploy": {
"source": "iana"
},
"application/vnd.osgeo.mapguide.package": {
"source": "iana",
"extensions": ["mgp"]
},
"application/vnd.osgi.bundle": {
"source": "iana"
},
"application/vnd.osgi.dp": {
"source": "iana",
"extensions": ["dp"]
},
"application/vnd.osgi.subsystem": {
"source": "iana",
"extensions": ["esa"]
},
"application/vnd.otps.ct-kip+xml": {
"source": "iana"
},
"application/vnd.oxli.countgraph": {
"source": "iana"
},
"application/vnd.pagerduty+json": {
"source": "iana",
"compressible": true
},
"application/vnd.palm": {
"source": "iana",
"extensions": ["pdb","pqa","oprc"]
},
"application/vnd.panoply": {
"source": "iana"
},
"application/vnd.paos+xml": {
"source": "iana"
},
"application/vnd.paos.xml": {
"source": "apache"
},
"application/vnd.pawaafile": {
"source": "iana",
"extensions": ["paw"]
},
"application/vnd.pcos": {
"source": "iana"
},
"application/vnd.pg.format": {
"source": "iana",
"extensions": ["str"]
},
"application/vnd.pg.osasli": {
"source": "iana",
"extensions": ["ei6"]
},
"application/vnd.piaccess.application-licence": {
"source": "iana"
},
"application/vnd.picsel": {
"source": "iana",
"extensions": ["efif"]
},
"application/vnd.pmi.widget": {
"source": "iana",
"extensions": ["wg"]
},
"application/vnd.poc.group-advertisement+xml": {
"source": "iana"
},
"application/vnd.pocketlearn": {
"source": "iana",
"extensions": ["plf"]
},
"application/vnd.powerbuilder6": {
"source": "iana",
"extensions": ["pbd"]
},
"application/vnd.powerbuilder6-s": {
"source": "iana"
},
"application/vnd.powerbuilder7": {
"source": "iana"
},
"application/vnd.powerbuilder7-s": {
"source": "iana"
},
"application/vnd.powerbuilder75": {
"source": "iana"
},
"application/vnd.powerbuilder75-s": {
"source": "iana"
},
"application/vnd.preminet": {
"source": "iana"
},
"application/vnd.previewsystems.box": {
"source": "iana",
"extensions": ["box"]
},
"application/vnd.proteus.magazine": {
"source": "iana",
"extensions": ["mgz"]
},
"application/vnd.publishare-delta-tree": {
"source": "iana",
"extensions": ["qps"]
},
"application/vnd.pvi.ptid1": {
"source": "iana",
"extensions": ["ptid"]
},
"application/vnd.pwg-multiplexed": {
"source": "iana"
},
"application/vnd.pwg-xhtml-print+xml": {
"source": "iana"
},
"application/vnd.qualcomm.brew-app-res": {
"source": "iana"
},
"application/vnd.quark.quarkxpress": {
"source": "iana",
"extensions": ["qxd","qxt","qwd","qwt","qxl","qxb"]
},
"application/vnd.quobject-quoxdocument": {
"source": "iana"
},
"application/vnd.radisys.moml+xml": {
"source": "iana"
},
"application/vnd.radisys.msml+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-audit+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-audit-conf+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-audit-conn+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-audit-dialog+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-audit-stream+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-conf+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-base+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-fax-detect+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-fax-sendrecv+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-group+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-speech+xml": {
"source": "iana"
},
"application/vnd.radisys.msml-dialog-transform+xml": {
"source": "iana"
},
"application/vnd.rainstor.data": {
"source": "iana"
},
"application/vnd.rapid": {
"source": "iana"
},
"application/vnd.realvnc.bed": {
"source": "iana",
"extensions": ["bed"]
},
"application/vnd.recordare.musicxml": {
"source": "iana",
"extensions": ["mxl"]
},
"application/vnd.recordare.musicxml+xml": {
"source": "iana",
"extensions": ["musicxml"]
},
"application/vnd.renlearn.rlprint": {
"source": "iana"
},
"application/vnd.rig.cryptonote": {
"source": "iana",
"extensions": ["cryptonote"]
},
"application/vnd.rim.cod": {
"source": "apache",
"extensions": ["cod"]
},
"application/vnd.rn-realmedia": {
"source": "apache",
"extensions": ["rm"]
},
"application/vnd.rn-realmedia-vbr": {
"source": "apache",
"extensions": ["rmvb"]
},
"application/vnd.route66.link66+xml": {
"source": "iana",
"extensions": ["link66"]
},
"application/vnd.rs-274x": {
"source": "iana"
},
"application/vnd.ruckus.download": {
"source": "iana"
},
"application/vnd.s3sms": {
"source": "iana"
},
"application/vnd.sailingtracker.track": {
"source": "iana",
"extensions": ["st"]
},
"application/vnd.sbm.cid": {
"source": "iana"
},
"application/vnd.sbm.mid2": {
"source": "iana"
},
"application/vnd.scribus": {
"source": "iana"
},
"application/vnd.sealed.3df": {
"source": "iana"
},
"application/vnd.sealed.csf": {
"source": "iana"
},
"application/vnd.sealed.doc": {
"source": "iana"
},
"application/vnd.sealed.eml": {
"source": "iana"
},
"application/vnd.sealed.mht": {
"source": "iana"
},
"application/vnd.sealed.net": {
"source": "iana"
},
"application/vnd.sealed.ppt": {
"source": "iana"
},
"application/vnd.sealed.tiff": {
"source": "iana"
},
"application/vnd.sealed.xls": {
"source": "iana"
},
"application/vnd.sealedmedia.softseal.html": {
"source": "iana"
},
"application/vnd.sealedmedia.softseal.pdf": {
"source": "iana"
},
"application/vnd.seemail": {
"source": "iana",
"extensions": ["see"]
},
"application/vnd.sema": {
"source": "iana",
"extensions": ["sema"]
},
"application/vnd.semd": {
"source": "iana",
"extensions": ["semd"]
},
"application/vnd.semf": {
"source": "iana",
"extensions": ["semf"]
},
"application/vnd.shana.informed.formdata": {
"source": "iana",
"extensions": ["ifm"]
},
"application/vnd.shana.informed.formtemplate": {
"source": "iana",
"extensions": ["itp"]
},
"application/vnd.shana.informed.interchange": {
"source": "iana",
"extensions": ["iif"]
},
"application/vnd.shana.informed.package": {
"source": "iana",
"extensions": ["ipk"]
},
"application/vnd.simtech-mindmapper": {
"source": "iana",
"extensions": ["twd","twds"]
},
"application/vnd.siren+json": {
"source": "iana",
"compressible": true
},
"application/vnd.smaf": {
"source": "iana",
"extensions": ["mmf"]
},
"application/vnd.smart.notebook": {
"source": "iana"
},
"application/vnd.smart.teacher": {
"source": "iana",
"extensions": ["teacher"]
},
"application/vnd.software602.filler.form+xml": {
"source": "iana"
},
"application/vnd.software602.filler.form-xml-zip": {
"source": "iana"
},
"application/vnd.solent.sdkm+xml": {
"source": "iana",
"extensions": ["sdkm","sdkd"]
},
"application/vnd.spotfire.dxp": {
"source": "iana",
"extensions": ["dxp"]
},
"application/vnd.spotfire.sfs": {
"source": "iana",
"extensions": ["sfs"]
},
"application/vnd.sss-cod": {
"source": "iana"
},
"application/vnd.sss-dtf": {
"source": "iana"
},
"application/vnd.sss-ntf": {
"source": "iana"
},
"application/vnd.stardivision.calc": {
"source": "apache",
"extensions": ["sdc"]
},
"application/vnd.stardivision.draw": {
"source": "apache",
"extensions": ["sda"]
},
"application/vnd.stardivision.impress": {
"source": "apache",
"extensions": ["sdd"]
},
"application/vnd.stardivision.math": {
"source": "apache",
"extensions": ["smf"]
},
"application/vnd.stardivision.writer": {
"source": "apache",
"extensions": ["sdw","vor"]
},
"application/vnd.stardivision.writer-global": {
"source": "apache",
"extensions": ["sgl"]
},
"application/vnd.stepmania.package": {
"source": "iana",
"extensions": ["smzip"]
},
"application/vnd.stepmania.stepchart": {
"source": "iana",
"extensions": ["sm"]
},
"application/vnd.street-stream": {
"source": "iana"
},
"application/vnd.sun.wadl+xml": {
"source": "iana"
},
"application/vnd.sun.xml.calc": {
"source": "apache",
"extensions": ["sxc"]
},
"application/vnd.sun.xml.calc.template": {
"source": "apache",
"extensions": ["stc"]
},
"application/vnd.sun.xml.draw": {
"source": "apache",
"extensions": ["sxd"]
},
"application/vnd.sun.xml.draw.template": {
"source": "apache",
"extensions": ["std"]
},
"application/vnd.sun.xml.impress": {
"source": "apache",
"extensions": ["sxi"]
},
"application/vnd.sun.xml.impress.template": {
"source": "apache",
"extensions": ["sti"]
},
"application/vnd.sun.xml.math": {
"source": "apache",
"extensions": ["sxm"]
},
"application/vnd.sun.xml.writer": {
"source": "apache",
"extensions": ["sxw"]
},
"application/vnd.sun.xml.writer.global": {
"source": "apache",
"extensions": ["sxg"]
},
"application/vnd.sun.xml.writer.template": {
"source": "apache",
"extensions": ["stw"]
},
"application/vnd.sus-calendar": {
"source": "iana",
"extensions": ["sus","susp"]
},
"application/vnd.svd": {
"source": "iana",
"extensions": ["svd"]
},
"application/vnd.swiftview-ics": {
"source": "iana"
},
"application/vnd.symbian.install": {
"source": "apache",
"extensions": ["sis","sisx"]
},
"application/vnd.syncml+xml": {
"source": "iana",
"extensions": ["xsm"]
},
"application/vnd.syncml.dm+wbxml": {
"source": "iana",
"extensions": ["bdm"]
},
"application/vnd.syncml.dm+xml": {
"source": "iana",
"extensions": ["xdm"]
},
"application/vnd.syncml.dm.notification": {
"source": "iana"
},
"application/vnd.syncml.dmddf+wbxml": {
"source": "iana"
},
"application/vnd.syncml.dmddf+xml": {
"source": "iana"
},
"application/vnd.syncml.dmtnds+wbxml": {
"source": "iana"
},
"application/vnd.syncml.dmtnds+xml": {
"source": "iana"
},
"application/vnd.syncml.ds.notification": {
"source": "iana"
},
"application/vnd.tao.intent-module-archive": {
"source": "iana",
"extensions": ["tao"]
},
"application/vnd.tcpdump.pcap": {
"source": "iana",
"extensions": ["pcap","cap","dmp"]
},
"application/vnd.tmd.mediaflex.api+xml": {
"source": "iana"
},
"application/vnd.tml": {
"source": "iana"
},
"application/vnd.tmobile-livetv": {
"source": "iana",
"extensions": ["tmo"]
},
"application/vnd.trid.tpt": {
"source": "iana",
"extensions": ["tpt"]
},
"application/vnd.triscape.mxs": {
"source": "iana",
"extensions": ["mxs"]
},
"application/vnd.trueapp": {
"source": "iana",
"extensions": ["tra"]
},
"application/vnd.truedoc": {
"source": "iana"
},
"application/vnd.ubisoft.webplayer": {
"source": "iana"
},
"application/vnd.ufdl": {
"source": "iana",
"extensions": ["ufd","ufdl"]
},
"application/vnd.uiq.theme": {
"source": "iana",
"extensions": ["utz"]
},
"application/vnd.umajin": {
"source": "iana",
"extensions": ["umj"]
},
"application/vnd.unity": {
"source": "iana",
"extensions": ["unityweb"]
},
"application/vnd.uoml+xml": {
"source": "iana",
"extensions": ["uoml"]
},
"application/vnd.uplanet.alert": {
"source": "iana"
},
"application/vnd.uplanet.alert-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.bearer-choice": {
"source": "iana"
},
"application/vnd.uplanet.bearer-choice-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.cacheop": {
"source": "iana"
},
"application/vnd.uplanet.cacheop-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.channel": {
"source": "iana"
},
"application/vnd.uplanet.channel-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.list": {
"source": "iana"
},
"application/vnd.uplanet.list-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.listcmd": {
"source": "iana"
},
"application/vnd.uplanet.listcmd-wbxml": {
"source": "iana"
},
"application/vnd.uplanet.signal": {
"source": "iana"
},
"application/vnd.uri-map": {
"source": "iana"
},
"application/vnd.valve.source.material": {
"source": "iana"
},
"application/vnd.vcx": {
"source": "iana",
"extensions": ["vcx"]
},
"application/vnd.vd-study": {
"source": "iana"
},
"application/vnd.vectorworks": {
"source": "iana"
},
"application/vnd.verimatrix.vcas": {
"source": "iana"
},
"application/vnd.vidsoft.vidconference": {
"source": "iana"
},
"application/vnd.visio": {
"source": "iana",
"extensions": ["vsd","vst","vss","vsw"]
},
"application/vnd.visionary": {
"source": "iana",
"extensions": ["vis"]
},
"application/vnd.vividence.scriptfile": {
"source": "iana"
},
"application/vnd.vsf": {
"source": "iana",
"extensions": ["vsf"]
},
"application/vnd.wap.sic": {
"source": "iana"
},
"application/vnd.wap.slc": {
"source": "iana"
},
"application/vnd.wap.wbxml": {
"source": "iana",
"extensions": ["wbxml"]
},
"application/vnd.wap.wmlc": {
"source": "iana",
"extensions": ["wmlc"]
},
"application/vnd.wap.wmlscriptc": {
"source": "iana",
"extensions": ["wmlsc"]
},
"application/vnd.webturbo": {
"source": "iana",
"extensions": ["wtb"]
},
"application/vnd.wfa.p2p": {
"source": "iana"
},
"application/vnd.wfa.wsc": {
"source": "iana"
},
"application/vnd.windows.devicepairing": {
"source": "iana"
},
"application/vnd.wmc": {
"source": "iana"
},
"application/vnd.wmf.bootstrap": {
"source": "iana"
},
"application/vnd.wolfram.mathematica": {
"source": "iana"
},
"application/vnd.wolfram.mathematica.package": {
"source": "iana"
},
"application/vnd.wolfram.player": {
"source": "iana",
"extensions": ["nbp"]
},
"application/vnd.wordperfect": {
"source": "iana",
"extensions": ["wpd"]
},
"application/vnd.wqd": {
"source": "iana",
"extensions": ["wqd"]
},
"application/vnd.wrq-hp3000-labelled": {
"source": "iana"
},
"application/vnd.wt.stf": {
"source": "iana",
"extensions": ["stf"]
},
"application/vnd.wv.csp+wbxml": {
"source": "iana"
},
"application/vnd.wv.csp+xml": {
"source": "iana"
},
"application/vnd.wv.ssp+xml": {
"source": "iana"
},
"application/vnd.xacml+json": {
"source": "iana",
"compressible": true
},
"application/vnd.xara": {
"source": "iana",
"extensions": ["xar"]
},
"application/vnd.xfdl": {
"source": "iana",
"extensions": ["xfdl"]
},
"application/vnd.xfdl.webform": {
"source": "iana"
},
"application/vnd.xmi+xml": {
"source": "iana"
},
"application/vnd.xmpie.cpkg": {
"source": "iana"
},
"application/vnd.xmpie.dpkg": {
"source": "iana"
},
"application/vnd.xmpie.plan": {
"source": "iana"
},
"application/vnd.xmpie.ppkg": {
"source": "iana"
},
"application/vnd.xmpie.xlim": {
"source": "iana"
},
"application/vnd.yamaha.hv-dic": {
"source": "iana",
"extensions": ["hvd"]
},
"application/vnd.yamaha.hv-script": {
"source": "iana",
"extensions": ["hvs"]
},
"application/vnd.yamaha.hv-voice": {
"source": "iana",
"extensions": ["hvp"]
},
"application/vnd.yamaha.openscoreformat": {
"source": "iana",
"extensions": ["osf"]
},
"application/vnd.yamaha.openscoreformat.osfpvg+xml": {
"source": "iana",
"extensions": ["osfpvg"]
},
"application/vnd.yamaha.remote-setup": {
"source": "iana"
},
"application/vnd.yamaha.smaf-audio": {
"source": "iana",
"extensions": ["saf"]
},
"application/vnd.yamaha.smaf-phrase": {
"source": "iana",
"extensions": ["spf"]
},
"application/vnd.yamaha.through-ngn": {
"source": "iana"
},
"application/vnd.yamaha.tunnel-udpencap": {
"source": "iana"
},
"application/vnd.yaoweme": {
"source": "iana"
},
"application/vnd.yellowriver-custom-menu": {
"source": "iana",
"extensions": ["cmp"]
},
"application/vnd.zul": {
"source": "iana",
"extensions": ["zir","zirz"]
},
"application/vnd.zzazz.deck+xml": {
"source": "iana",
"extensions": ["zaz"]
},
"application/voicexml+xml": {
"source": "iana",
"extensions": ["vxml"]
},
"application/vq-rtcpxr": {
"source": "iana"
},
"application/watcherinfo+xml": {
"source": "iana"
},
"application/whoispp-query": {
"source": "iana"
},
"application/whoispp-response": {
"source": "iana"
},
"application/widget": {
"source": "iana",
"extensions": ["wgt"]
},
"application/winhlp": {
"source": "apache",
"extensions": ["hlp"]
},
"application/wita": {
"source": "iana"
},
"application/wordperfect5.1": {
"source": "iana"
},
"application/wsdl+xml": {
"source": "iana",
"extensions": ["wsdl"]
},
"application/wspolicy+xml": {
"source": "iana",
"extensions": ["wspolicy"]
},
"application/x-7z-compressed": {
"source": "apache",
"compressible": false,
"extensions": ["7z"]
},
"application/x-abiword": {
"source": "apache",
"extensions": ["abw"]
},
"application/x-ace-compressed": {
"source": "apache",
"extensions": ["ace"]
},
"application/x-amf": {
"source": "apache"
},
"application/x-apple-diskimage": {
"source": "apache",
"extensions": ["dmg"]
},
"application/x-authorware-bin": {
"source": "apache",
"extensions": ["aab","x32","u32","vox"]
},
"application/x-authorware-map": {
"source": "apache",
"extensions": ["aam"]
},
"application/x-authorware-seg": {
"source": "apache",
"extensions": ["aas"]
},
"application/x-bcpio": {
"source": "apache",
"extensions": ["bcpio"]
},
"application/x-bdoc": {
"compressible": false,
"extensions": ["bdoc"]
},
"application/x-bittorrent": {
"source": "apache",
"extensions": ["torrent"]
},
"application/x-blorb": {
"source": "apache",
"extensions": ["blb","blorb"]
},
"application/x-bzip": {
"source": "apache",
"compressible": false,
"extensions": ["bz"]
},
"application/x-bzip2": {
"source": "apache",
"compressible": false,
"extensions": ["bz2","boz"]
},
"application/x-cbr": {
"source": "apache",
"extensions": ["cbr","cba","cbt","cbz","cb7"]
},
"application/x-cdlink": {
"source": "apache",
"extensions": ["vcd"]
},
"application/x-cfs-compressed": {
"source": "apache",
"extensions": ["cfs"]
},
"application/x-chat": {
"source": "apache",
"extensions": ["chat"]
},
"application/x-chess-pgn": {
"source": "apache",
"extensions": ["pgn"]
},
"application/x-chrome-extension": {
"extensions": ["crx"]
},
"application/x-cocoa": {
"source": "nginx",
"extensions": ["cco"]
},
"application/x-compress": {
"source": "apache"
},
"application/x-conference": {
"source": "apache",
"extensions": ["nsc"]
},
"application/x-cpio": {
"source": "apache",
"extensions": ["cpio"]
},
"application/x-csh": {
"source": "apache",
"extensions": ["csh"]
},
"application/x-deb": {
"compressible": false
},
"application/x-debian-package": {
"source": "apache",
"extensions": ["deb","udeb"]
},
"application/x-dgc-compressed": {
"source": "apache",
"extensions": ["dgc"]
},
"application/x-director": {
"source": "apache",
"extensions": ["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]
},
"application/x-doom": {
"source": "apache",
"extensions": ["wad"]
},
"application/x-dtbncx+xml": {
"source": "apache",
"extensions": ["ncx"]
},
"application/x-dtbook+xml": {
"source": "apache",
"extensions": ["dtb"]
},
"application/x-dtbresource+xml": {
"source": "apache",
"extensions": ["res"]
},
"application/x-dvi": {
"source": "apache",
"compressible": false,
"extensions": ["dvi"]
},
"application/x-envoy": {
"source": "apache",
"extensions": ["evy"]
},
"application/x-eva": {
"source": "apache",
"extensions": ["eva"]
},
"application/x-font-bdf": {
"source": "apache",
"extensions": ["bdf"]
},
"application/x-font-dos": {
"source": "apache"
},
"application/x-font-framemaker": {
"source": "apache"
},
"application/x-font-ghostscript": {
"source": "apache",
"extensions": ["gsf"]
},
"application/x-font-libgrx": {
"source": "apache"
},
"application/x-font-linux-psf": {
"source": "apache",
"extensions": ["psf"]
},
"application/x-font-otf": {
"source": "apache",
"compressible": true,
"extensions": ["otf"]
},
"application/x-font-pcf": {
"source": "apache",
"extensions": ["pcf"]
},
"application/x-font-snf": {
"source": "apache",
"extensions": ["snf"]
},
"application/x-font-speedo": {
"source": "apache"
},
"application/x-font-sunos-news": {
"source": "apache"
},
"application/x-font-ttf": {
"source": "apache",
"compressible": true,
"extensions": ["ttf","ttc"]
},
"application/x-font-type1": {
"source": "apache",
"extensions": ["pfa","pfb","pfm","afm"]
},
"application/x-font-vfont": {
"source": "apache"
},
"application/x-freearc": {
"source": "apache",
"extensions": ["arc"]
},
"application/x-futuresplash": {
"source": "apache",
"extensions": ["spl"]
},
"application/x-gca-compressed": {
"source": "apache",
"extensions": ["gca"]
},
"application/x-glulx": {
"source": "apache",
"extensions": ["ulx"]
},
"application/x-gnumeric": {
"source": "apache",
"extensions": ["gnumeric"]
},
"application/x-gramps-xml": {
"source": "apache",
"extensions": ["gramps"]
},
"application/x-gtar": {
"source": "apache",
"extensions": ["gtar"]
},
"application/x-gzip": {
"source": "apache"
},
"application/x-hdf": {
"source": "apache",
"extensions": ["hdf"]
},
"application/x-httpd-php": {
"compressible": true,
"extensions": ["php"]
},
"application/x-install-instructions": {
"source": "apache",
"extensions": ["install"]
},
"application/x-iso9660-image": {
"source": "apache",
"extensions": ["iso"]
},
"application/x-java-archive-diff": {
"source": "nginx",
"extensions": ["jardiff"]
},
"application/x-java-jnlp-file": {
"source": "apache",
"compressible": false,
"extensions": ["jnlp"]
},
"application/x-javascript": {
"compressible": true
},
"application/x-latex": {
"source": "apache",
"compressible": false,
"extensions": ["latex"]
},
"application/x-lua-bytecode": {
"extensions": ["luac"]
},
"application/x-lzh-compressed": {
"source": "apache",
"extensions": ["lzh","lha"]
},
"application/x-makeself": {
"source": "nginx",
"extensions": ["run"]
},
"application/x-mie": {
"source": "apache",
"extensions": ["mie"]
},
"application/x-mobipocket-ebook": {
"source": "apache",
"extensions": ["prc","mobi"]
},
"application/x-mpegurl": {
"compressible": false
},
"application/x-ms-application": {
"source": "apache",
"extensions": ["application"]
},
"application/x-ms-shortcut": {
"source": "apache",
"extensions": ["lnk"]
},
"application/x-ms-wmd": {
"source": "apache",
"extensions": ["wmd"]
},
"application/x-ms-wmz": {
"source": "apache",
"extensions": ["wmz"]
},
"application/x-ms-xbap": {
"source": "apache",
"extensions": ["xbap"]
},
"application/x-msaccess": {
"source": "apache",
"extensions": ["mdb"]
},
"application/x-msbinder": {
"source": "apache",
"extensions": ["obd"]
},
"application/x-mscardfile": {
"source": "apache",
"extensions": ["crd"]
},
"application/x-msclip": {
"source": "apache",
"extensions": ["clp"]
},
"application/x-msdos-program": {
"extensions": ["exe"]
},
"application/x-msdownload": {
"source": "apache",
"extensions": ["exe","dll","com","bat","msi"]
},
"application/x-msmediaview": {
"source": "apache",
"extensions": ["mvb","m13","m14"]
},
"application/x-msmetafile": {
"source": "apache",
"extensions": ["wmf","wmz","emf","emz"]
},
"application/x-msmoney": {
"source": "apache",
"extensions": ["mny"]
},
"application/x-mspublisher": {
"source": "apache",
"extensions": ["pub"]
},
"application/x-msschedule": {
"source": "apache",
"extensions": ["scd"]
},
"application/x-msterminal": {
"source": "apache",
"extensions": ["trm"]
},
"application/x-mswrite": {
"source": "apache",
"extensions": ["wri"]
},
"application/x-netcdf": {
"source": "apache",
"extensions": ["nc","cdf"]
},
"application/x-ns-proxy-autoconfig": {
"compressible": true,
"extensions": ["pac"]
},
"application/x-nzb": {
"source": "apache",
"extensions": ["nzb"]
},
"application/x-perl": {
"source": "nginx",
"extensions": ["pl","pm"]
},
"application/x-pilot": {
"source": "nginx",
"extensions": ["prc","pdb"]
},
"application/x-pkcs12": {
"source": "apache",
"compressible": false,
"extensions": ["p12","pfx"]
},
"application/x-pkcs7-certificates": {
"source": "apache",
"extensions": ["p7b","spc"]
},
"application/x-pkcs7-certreqresp": {
"source": "apache",
"extensions": ["p7r"]
},
"application/x-rar-compressed": {
"source": "apache",
"compressible": false,
"extensions": ["rar"]
},
"application/x-redhat-package-manager": {
"source": "nginx",
"extensions": ["rpm"]
},
"application/x-research-info-systems": {
"source": "apache",
"extensions": ["ris"]
},
"application/x-sea": {
"source": "nginx",
"extensions": ["sea"]
},
"application/x-sh": {
"source": "apache",
"compressible": true,
"extensions": ["sh"]
},
"application/x-shar": {
"source": "apache",
"extensions": ["shar"]
},
"application/x-shockwave-flash": {
"source": "apache",
"compressible": false,
"extensions": ["swf"]
},
"application/x-silverlight-app": {
"source": "apache",
"extensions": ["xap"]
},
"application/x-sql": {
"source": "apache",
"extensions": ["sql"]
},
"application/x-stuffit": {
"source": "apache",
"compressible": false,
"extensions": ["sit"]
},
"application/x-stuffitx": {
"source": "apache",
"extensions": ["sitx"]
},
"application/x-subrip": {
"source": "apache",
"extensions": ["srt"]
},
"application/x-sv4cpio": {
"source": "apache",
"extensions": ["sv4cpio"]
},
"application/x-sv4crc": {
"source": "apache",
"extensions": ["sv4crc"]
},
"application/x-t3vm-image": {
"source": "apache",
"extensions": ["t3"]
},
"application/x-tads": {
"source": "apache",
"extensions": ["gam"]
},
"application/x-tar": {
"source": "apache",
"compressible": true,
"extensions": ["tar"]
},
"application/x-tcl": {
"source": "apache",
"extensions": ["tcl","tk"]
},
"application/x-tex": {
"source": "apache",
"extensions": ["tex"]
},
"application/x-tex-tfm": {
"source": "apache",
"extensions": ["tfm"]
},
"application/x-texinfo": {
"source": "apache",
"extensions": ["texinfo","texi"]
},
"application/x-tgif": {
"source": "apache",
"extensions": ["obj"]
},
"application/x-ustar": {
"source": "apache",
"extensions": ["ustar"]
},
"application/x-wais-source": {
"source": "apache",
"extensions": ["src"]
},
"application/x-web-app-manifest+json": {
"compressible": true,
"extensions": ["webapp"]
},
"application/x-www-form-urlencoded": {
"source": "iana",
"compressible": true
},
"application/x-x509-ca-cert": {
"source": "apache",
"extensions": ["der","crt","pem"]
},
"application/x-xfig": {
"source": "apache",
"extensions": ["fig"]
},
"application/x-xliff+xml": {
"source": "apache",
"extensions": ["xlf"]
},
"application/x-xpinstall": {
"source": "apache",
"compressible": false,
"extensions": ["xpi"]
},
"application/x-xz": {
"source": "apache",
"extensions": ["xz"]
},
"application/x-zmachine": {
"source": "apache",
"extensions": ["z1","z2","z3","z4","z5","z6","z7","z8"]
},
"application/x400-bp": {
"source": "iana"
},
"application/xacml+xml": {
"source": "iana"
},
"application/xaml+xml": {
"source": "apache",
"extensions": ["xaml"]
},
"application/xcap-att+xml": {
"source": "iana"
},
"application/xcap-caps+xml": {
"source": "iana"
},
"application/xcap-diff+xml": {
"source": "iana",
"extensions": ["xdf"]
},
"application/xcap-el+xml": {
"source": "iana"
},
"application/xcap-error+xml": {
"source": "iana"
},
"application/xcap-ns+xml": {
"source": "iana"
},
"application/xcon-conference-info+xml": {
"source": "iana"
},
"application/xcon-conference-info-diff+xml": {
"source": "iana"
},
"application/xenc+xml": {
"source": "iana",
"extensions": ["xenc"]
},
"application/xhtml+xml": {
"source": "iana",
"compressible": true,
"extensions": ["xhtml","xht"]
},
"application/xhtml-voice+xml": {
"source": "apache"
},
"application/xml": {
"source": "iana",
"compressible": true,
"extensions": ["xml","xsl","xsd"]
},
"application/xml-dtd": {
"source": "iana",
"compressible": true,
"extensions": ["dtd"]
},
"application/xml-external-parsed-entity": {
"source": "iana"
},
"application/xml-patch+xml": {
"source": "iana"
},
"application/xmpp+xml": {
"source": "iana"
},
"application/xop+xml": {
"source": "iana",
"compressible": true,
"extensions": ["xop"]
},
"application/xproc+xml": {
"source": "apache",
"extensions": ["xpl"]
},
"application/xslt+xml": {
"source": "iana",
"extensions": ["xslt"]
},
"application/xspf+xml": {
"source": "apache",
"extensions": ["xspf"]
},
"application/xv+xml": {
"source": "iana",
"extensions": ["mxml","xhvml","xvml","xvm"]
},
"application/yang": {
"source": "iana",
"extensions": ["yang"]
},
"application/yin+xml": {
"source": "iana",
"extensions": ["yin"]
},
"application/zip": {
"source": "iana",
"compressible": false,
"extensions": ["zip"]
},
"application/zlib": {
"source": "iana"
},
"audio/1d-interleaved-parityfec": {
"source": "iana"
},
"audio/32kadpcm": {
"source": "iana"
},
"audio/3gpp": {
"source": "iana"
},
"audio/3gpp2": {
"source": "iana"
},
"audio/ac3": {
"source": "iana"
},
"audio/adpcm": {
"source": "apache",
"extensions": ["adp"]
},
"audio/amr": {
"source": "iana"
},
"audio/amr-wb": {
"source": "iana"
},
"audio/amr-wb+": {
"source": "iana"
},
"audio/aptx": {
"source": "iana"
},
"audio/asc": {
"source": "iana"
},
"audio/atrac-advanced-lossless": {
"source": "iana"
},
"audio/atrac-x": {
"source": "iana"
},
"audio/atrac3": {
"source": "iana"
},
"audio/basic": {
"source": "iana",
"compressible": false,
"extensions": ["au","snd"]
},
"audio/bv16": {
"source": "iana"
},
"audio/bv32": {
"source": "iana"
},
"audio/clearmode": {
"source": "iana"
},
"audio/cn": {
"source": "iana"
},
"audio/dat12": {
"source": "iana"
},
"audio/dls": {
"source": "iana"
},
"audio/dsr-es201108": {
"source": "iana"
},
"audio/dsr-es202050": {
"source": "iana"
},
"audio/dsr-es202211": {
"source": "iana"
},
"audio/dsr-es202212": {
"source": "iana"
},
"audio/dv": {
"source": "iana"
},
"audio/dvi4": {
"source": "iana"
},
"audio/eac3": {
"source": "iana"
},
"audio/encaprtp": {
"source": "iana"
},
"audio/evrc": {
"source": "iana"
},
"audio/evrc-qcp": {
"source": "iana"
},
"audio/evrc0": {
"source": "iana"
},
"audio/evrc1": {
"source": "iana"
},
"audio/evrcb": {
"source": "iana"
},
"audio/evrcb0": {
"source": "iana"
},
"audio/evrcb1": {
"source": "iana"
},
"audio/evrcnw": {
"source": "iana"
},
"audio/evrcnw0": {
"source": "iana"
},
"audio/evrcnw1": {
"source": "iana"
},
"audio/evrcwb": {
"source": "iana"
},
"audio/evrcwb0": {
"source": "iana"
},
"audio/evrcwb1": {
"source": "iana"
},
"audio/evs": {
"source": "iana"
},
"audio/fwdred": {
"source": "iana"
},
"audio/g711-0": {
"source": "iana"
},
"audio/g719": {
"source": "iana"
},
"audio/g722": {
"source": "iana"
},
"audio/g7221": {
"source": "iana"
},
"audio/g723": {
"source": "iana"
},
"audio/g726-16": {
"source": "iana"
},
"audio/g726-24": {
"source": "iana"
},
"audio/g726-32": {
"source": "iana"
},
"audio/g726-40": {
"source": "iana"
},
"audio/g728": {
"source": "iana"
},
"audio/g729": {
"source": "iana"
},
"audio/g7291": {
"source": "iana"
},
"audio/g729d": {
"source": "iana"
},
"audio/g729e": {
"source": "iana"
},
"audio/gsm": {
"source": "iana"
},
"audio/gsm-efr": {
"source": "iana"
},
"audio/gsm-hr-08": {
"source": "iana"
},
"audio/ilbc": {
"source": "iana"
},
"audio/ip-mr_v2.5": {
"source": "iana"
},
"audio/isac": {
"source": "apache"
},
"audio/l16": {
"source": "iana"
},
"audio/l20": {
"source": "iana"
},
"audio/l24": {
"source": "iana",
"compressible": false
},
"audio/l8": {
"source": "iana"
},
"audio/lpc": {
"source": "iana"
},
"audio/midi": {
"source": "apache",
"extensions": ["mid","midi","kar","rmi"]
},
"audio/mobile-xmf": {
"source": "iana"
},
"audio/mp4": {
"source": "iana",
"compressible": false,
"extensions": ["mp4a","m4a"]
},
"audio/mp4a-latm": {
"source": "iana"
},
"audio/mpa": {
"source": "iana"
},
"audio/mpa-robust": {
"source": "iana"
},
"audio/mpeg": {
"source": "iana",
"compressible": false,
"extensions": ["mpga","mp2","mp2a","mp3","m2a","m3a"]
},
"audio/mpeg4-generic": {
"source": "iana"
},
"audio/musepack": {
"source": "apache"
},
"audio/ogg": {
"source": "iana",
"compressible": false,
"extensions": ["oga","ogg","spx"]
},
"audio/opus": {
"source": "iana"
},
"audio/parityfec": {
"source": "iana"
},
"audio/pcma": {
"source": "iana"
},
"audio/pcma-wb": {
"source": "iana"
},
"audio/pcmu": {
"source": "iana"
},
"audio/pcmu-wb": {
"source": "iana"
},
"audio/prs.sid": {
"source": "iana"
},
"audio/qcelp": {
"source": "iana"
},
"audio/raptorfec": {
"source": "iana"
},
"audio/red": {
"source": "iana"
},
"audio/rtp-enc-aescm128": {
"source": "iana"
},
"audio/rtp-midi": {
"source": "iana"
},
"audio/rtploopback": {
"source": "iana"
},
"audio/rtx": {
"source": "iana"
},
"audio/s3m": {
"source": "apache",
"extensions": ["s3m"]
},
"audio/silk": {
"source": "apache",
"extensions": ["sil"]
},
"audio/smv": {
"source": "iana"
},
"audio/smv-qcp": {
"source": "iana"
},
"audio/smv0": {
"source": "iana"
},
"audio/sp-midi": {
"source": "iana"
},
"audio/speex": {
"source": "iana"
},
"audio/t140c": {
"source": "iana"
},
"audio/t38": {
"source": "iana"
},
"audio/telephone-event": {
"source": "iana"
},
"audio/tone": {
"source": "iana"
},
"audio/uemclip": {
"source": "iana"
},
"audio/ulpfec": {
"source": "iana"
},
"audio/vdvi": {
"source": "iana"
},
"audio/vmr-wb": {
"source": "iana"
},
"audio/vnd.3gpp.iufp": {
"source": "iana"
},
"audio/vnd.4sb": {
"source": "iana"
},
"audio/vnd.audiokoz": {
"source": "iana"
},
"audio/vnd.celp": {
"source": "iana"
},
"audio/vnd.cisco.nse": {
"source": "iana"
},
"audio/vnd.cmles.radio-events": {
"source": "iana"
},
"audio/vnd.cns.anp1": {
"source": "iana"
},
"audio/vnd.cns.inf1": {
"source": "iana"
},
"audio/vnd.dece.audio": {
"source": "iana",
"extensions": ["uva","uvva"]
},
"audio/vnd.digital-winds": {
"source": "iana",
"extensions": ["eol"]
},
"audio/vnd.dlna.adts": {
"source": "iana"
},
"audio/vnd.dolby.heaac.1": {
"source": "iana"
},
"audio/vnd.dolby.heaac.2": {
"source": "iana"
},
"audio/vnd.dolby.mlp": {
"source": "iana"
},
"audio/vnd.dolby.mps": {
"source": "iana"
},
"audio/vnd.dolby.pl2": {
"source": "iana"
},
"audio/vnd.dolby.pl2x": {
"source": "iana"
},
"audio/vnd.dolby.pl2z": {
"source": "iana"
},
"audio/vnd.dolby.pulse.1": {
"source": "iana"
},
"audio/vnd.dra": {
"source": "iana",
"extensions": ["dra"]
},
"audio/vnd.dts": {
"source": "iana",
"extensions": ["dts"]
},
"audio/vnd.dts.hd": {
"source": "iana",
"extensions": ["dtshd"]
},
"audio/vnd.dvb.file": {
"source": "iana"
},
"audio/vnd.everad.plj": {
"source": "iana"
},
"audio/vnd.hns.audio": {
"source": "iana"
},
"audio/vnd.lucent.voice": {
"source": "iana",
"extensions": ["lvp"]
},
"audio/vnd.ms-playready.media.pya": {
"source": "iana",
"extensions": ["pya"]
},
"audio/vnd.nokia.mobile-xmf": {
"source": "iana"
},
"audio/vnd.nortel.vbk": {
"source": "iana"
},
"audio/vnd.nuera.ecelp4800": {
"source": "iana",
"extensions": ["ecelp4800"]
},
"audio/vnd.nuera.ecelp7470": {
"source": "iana",
"extensions": ["ecelp7470"]
},
"audio/vnd.nuera.ecelp9600": {
"source": "iana",
"extensions": ["ecelp9600"]
},
"audio/vnd.octel.sbc": {
"source": "iana"
},
"audio/vnd.qcelp": {
"source": "iana"
},
"audio/vnd.rhetorex.32kadpcm": {
"source": "iana"
},
"audio/vnd.rip": {
"source": "iana",
"extensions": ["rip"]
},
"audio/vnd.rn-realaudio": {
"compressible": false
},
"audio/vnd.sealedmedia.softseal.mpeg": {
"source": "iana"
},
"audio/vnd.vmx.cvsd": {
"source": "iana"
},
"audio/vnd.wave": {
"compressible": false
},
"audio/vorbis": {
"source": "iana",
"compressible": false
},
"audio/vorbis-config": {
"source": "iana"
},
"audio/wav": {
"compressible": false,
"extensions": ["wav"]
},
"audio/wave": {
"compressible": false,
"extensions": ["wav"]
},
"audio/webm": {
"source": "apache",
"compressible": false,
"extensions": ["weba"]
},
"audio/x-aac": {
"source": "apache",
"compressible": false,
"extensions": ["aac"]
},
"audio/x-aiff": {
"source": "apache",
"extensions": ["aif","aiff","aifc"]
},
"audio/x-caf": {
"source": "apache",
"compressible": false,
"extensions": ["caf"]
},
"audio/x-flac": {
"source": "apache",
"extensions": ["flac"]
},
"audio/x-m4a": {
"source": "nginx",
"extensions": ["m4a"]
},
"audio/x-matroska": {
"source": "apache",
"extensions": ["mka"]
},
"audio/x-mpegurl": {
"source": "apache",
"extensions": ["m3u"]
},
"audio/x-ms-wax": {
"source": "apache",
"extensions": ["wax"]
},
"audio/x-ms-wma": {
"source": "apache",
"extensions": ["wma"]
},
"audio/x-pn-realaudio": {
"source": "apache",
"extensions": ["ram","ra"]
},
"audio/x-pn-realaudio-plugin": {
"source": "apache",
"extensions": ["rmp"]
},
"audio/x-realaudio": {
"source": "nginx",
"extensions": ["ra"]
},
"audio/x-tta": {
"source": "apache"
},
"audio/x-wav": {
"source": "apache",
"extensions": ["wav"]
},
"audio/xm": {
"source": "apache",
"extensions": ["xm"]
},
"chemical/x-cdx": {
"source": "apache",
"extensions": ["cdx"]
},
"chemical/x-cif": {
"source": "apache",
"extensions": ["cif"]
},
"chemical/x-cmdf": {
"source": "apache",
"extensions": ["cmdf"]
},
"chemical/x-cml": {
"source": "apache",
"extensions": ["cml"]
},
"chemical/x-csml": {
"source": "apache",
"extensions": ["csml"]
},
"chemical/x-pdb": {
"source": "apache"
},
"chemical/x-xyz": {
"source": "apache",
"extensions": ["xyz"]
},
"font/opentype": {
"compressible": true,
"extensions": ["otf"]
},
"image/bmp": {
"source": "apache",
"compressible": true,
"extensions": ["bmp"]
},
"image/cgm": {
"source": "iana",
"extensions": ["cgm"]
},
"image/fits": {
"source": "iana"
},
"image/g3fax": {
"source": "iana",
"extensions": ["g3"]
},
"image/gif": {
"source": "iana",
"compressible": false,
"extensions": ["gif"]
},
"image/ief": {
"source": "iana",
"extensions": ["ief"]
},
"image/jp2": {
"source": "iana"
},
"image/jpeg": {
"source": "iana",
"compressible": false,
"extensions": ["jpeg","jpg","jpe"]
},
"image/jpm": {
"source": "iana"
},
"image/jpx": {
"source": "iana"
},
"image/ktx": {
"source": "iana",
"extensions": ["ktx"]
},
"image/naplps": {
"source": "iana"
},
"image/pjpeg": {
"compressible": false
},
"image/png": {
"source": "iana",
"compressible": false,
"extensions": ["png"]
},
"image/prs.btif": {
"source": "iana",
"extensions": ["btif"]
},
"image/prs.pti": {
"source": "iana"
},
"image/pwg-raster": {
"source": "iana"
},
"image/sgi": {
"source": "apache",
"extensions": ["sgi"]
},
"image/svg+xml": {
"source": "iana",
"compressible": true,
"extensions": ["svg","svgz"]
},
"image/t38": {
"source": "iana"
},
"image/tiff": {
"source": "iana",
"compressible": false,
"extensions": ["tiff","tif"]
},
"image/tiff-fx": {
"source": "iana"
},
"image/vnd.adobe.photoshop": {
"source": "iana",
"compressible": true,
"extensions": ["psd"]
},
"image/vnd.airzip.accelerator.azv": {
"source": "iana"
},
"image/vnd.cns.inf2": {
"source": "iana"
},
"image/vnd.dece.graphic": {
"source": "iana",
"extensions": ["uvi","uvvi","uvg","uvvg"]
},
"image/vnd.djvu": {
"source": "iana",
"extensions": ["djvu","djv"]
},
"image/vnd.dvb.subtitle": {
"source": "iana",
"extensions": ["sub"]
},
"image/vnd.dwg": {
"source": "iana",
"extensions": ["dwg"]
},
"image/vnd.dxf": {
"source": "iana",
"extensions": ["dxf"]
},
"image/vnd.fastbidsheet": {
"source": "iana",
"extensions": ["fbs"]
},
"image/vnd.fpx": {
"source": "iana",
"extensions": ["fpx"]
},
"image/vnd.fst": {
"source": "iana",
"extensions": ["fst"]
},
"image/vnd.fujixerox.edmics-mmr": {
"source": "iana",
"extensions": ["mmr"]
},
"image/vnd.fujixerox.edmics-rlc": {
"source": "iana",
"extensions": ["rlc"]
},
"image/vnd.globalgraphics.pgb": {
"source": "iana"
},
"image/vnd.microsoft.icon": {
"source": "iana"
},
"image/vnd.mix": {
"source": "iana"
},
"image/vnd.mozilla.apng": {
"source": "iana"
},
"image/vnd.ms-modi": {
"source": "iana",
"extensions": ["mdi"]
},
"image/vnd.ms-photo": {
"source": "apache",
"extensions": ["wdp"]
},
"image/vnd.net-fpx": {
"source": "iana",
"extensions": ["npx"]
},
"image/vnd.radiance": {
"source": "iana"
},
"image/vnd.sealed.png": {
"source": "iana"
},
"image/vnd.sealedmedia.softseal.gif": {
"source": "iana"
},
"image/vnd.sealedmedia.softseal.jpg": {
"source": "iana"
},
"image/vnd.svf": {
"source": "iana"
},
"image/vnd.tencent.tap": {
"source": "iana"
},
"image/vnd.valve.source.texture": {
"source": "iana"
},
"image/vnd.wap.wbmp": {
"source": "iana",
"extensions": ["wbmp"]
},
"image/vnd.xiff": {
"source": "iana",
"extensions": ["xif"]
},
"image/vnd.zbrush.pcx": {
"source": "iana"
},
"image/webp": {
"source": "apache",
"extensions": ["webp"]
},
"image/x-3ds": {
"source": "apache",
"extensions": ["3ds"]
},
"image/x-cmu-raster": {
"source": "apache",
"extensions": ["ras"]
},
"image/x-cmx": {
"source": "apache",
"extensions": ["cmx"]
},
"image/x-freehand": {
"source": "apache",
"extensions": ["fh","fhc","fh4","fh5","fh7"]
},
"image/x-icon": {
"source": "apache",
"compressible": true,
"extensions": ["ico"]
},
"image/x-jng": {
"source": "nginx",
"extensions": ["jng"]
},
"image/x-mrsid-image": {
"source": "apache",
"extensions": ["sid"]
},
"image/x-ms-bmp": {
"source": "nginx",
"compressible": true,
"extensions": ["bmp"]
},
"image/x-pcx": {
"source": "apache",
"extensions": ["pcx"]
},
"image/x-pict": {
"source": "apache",
"extensions": ["pic","pct"]
},
"image/x-portable-anymap": {
"source": "apache",
"extensions": ["pnm"]
},
"image/x-portable-bitmap": {
"source": "apache",
"extensions": ["pbm"]
},
"image/x-portable-graymap": {
"source": "apache",
"extensions": ["pgm"]
},
"image/x-portable-pixmap": {
"source": "apache",
"extensions": ["ppm"]
},
"image/x-rgb": {
"source": "apache",
"extensions": ["rgb"]
},
"image/x-tga": {
"source": "apache",
"extensions": ["tga"]
},
"image/x-xbitmap": {
"source": "apache",
"extensions": ["xbm"]
},
"image/x-xcf": {
"compressible": false
},
"image/x-xpixmap": {
"source": "apache",
"extensions": ["xpm"]
},
"image/x-xwindowdump": {
"source": "apache",
"extensions": ["xwd"]
},
"message/cpim": {
"source": "iana"
},
"message/delivery-status": {
"source": "iana"
},
"message/disposition-notification": {
"source": "iana"
},
"message/external-body": {
"source": "iana"
},
"message/feedback-report": {
"source": "iana"
},
"message/global": {
"source": "iana"
},
"message/global-delivery-status": {
"source": "iana"
},
"message/global-disposition-notification": {
"source": "iana"
},
"message/global-headers": {
"source": "iana"
},
"message/http": {
"source": "iana",
"compressible": false
},
"message/imdn+xml": {
"source": "iana",
"compressible": true
},
"message/news": {
"source": "iana"
},
"message/partial": {
"source": "iana",
"compressible": false
},
"message/rfc822": {
"source": "iana",
"compressible": true,
"extensions": ["eml","mime"]
},
"message/s-http": {
"source": "iana"
},
"message/sip": {
"source": "iana"
},
"message/sipfrag": {
"source": "iana"
},
"message/tracking-status": {
"source": "iana"
},
"message/vnd.si.simp": {
"source": "iana"
},
"message/vnd.wfa.wsc": {
"source": "iana"
},
"model/iges": {
"source": "iana",
"compressible": false,
"extensions": ["igs","iges"]
},
"model/mesh": {
"source": "iana",
"compressible": false,
"extensions": ["msh","mesh","silo"]
},
"model/vnd.collada+xml": {
"source": "iana",
"extensions": ["dae"]
},
"model/vnd.dwf": {
"source": "iana",
"extensions": ["dwf"]
},
"model/vnd.flatland.3dml": {
"source": "iana"
},
"model/vnd.gdl": {
"source": "iana",
"extensions": ["gdl"]
},
"model/vnd.gs-gdl": {
"source": "apache"
},
"model/vnd.gs.gdl": {
"source": "iana"
},
"model/vnd.gtw": {
"source": "iana",
"extensions": ["gtw"]
},
"model/vnd.moml+xml": {
"source": "iana"
},
"model/vnd.mts": {
"source": "iana",
"extensions": ["mts"]
},
"model/vnd.opengex": {
"source": "iana"
},
"model/vnd.parasolid.transmit.binary": {
"source": "iana"
},
"model/vnd.parasolid.transmit.text": {
"source": "iana"
},
"model/vnd.valve.source.compiled-map": {
"source": "iana"
},
"model/vnd.vtu": {
"source": "iana",
"extensions": ["vtu"]
},
"model/vrml": {
"source": "iana",
"compressible": false,
"extensions": ["wrl","vrml"]
},
"model/x3d+binary": {
"source": "apache",
"compressible": false,
"extensions": ["x3db","x3dbz"]
},
"model/x3d+fastinfoset": {
"source": "iana"
},
"model/x3d+vrml": {
"source": "apache",
"compressible": false,
"extensions": ["x3dv","x3dvz"]
},
"model/x3d+xml": {
"source": "iana",
"compressible": true,
"extensions": ["x3d","x3dz"]
},
"model/x3d-vrml": {
"source": "iana"
},
"multipart/alternative": {
"source": "iana",
"compressible": false
},
"multipart/appledouble": {
"source": "iana"
},
"multipart/byteranges": {
"source": "iana"
},
"multipart/digest": {
"source": "iana"
},
"multipart/encrypted": {
"source": "iana",
"compressible": false
},
"multipart/form-data": {
"source": "iana",
"compressible": false
},
"multipart/header-set": {
"source": "iana"
},
"multipart/mixed": {
"source": "iana",
"compressible": false
},
"multipart/parallel": {
"source": "iana"
},
"multipart/related": {
"source": "iana",
"compressible": false
},
"multipart/report": {
"source": "iana"
},
"multipart/signed": {
"source": "iana",
"compressible": false
},
"multipart/voice-message": {
"source": "iana"
},
"multipart/x-mixed-replace": {
"source": "iana"
},
"text/1d-interleaved-parityfec": {
"source": "iana"
},
"text/cache-manifest": {
"source": "iana",
"compressible": true,
"extensions": ["appcache","manifest"]
},
"text/calendar": {
"source": "iana",
"extensions": ["ics","ifb"]
},
"text/calender": {
"compressible": true
},
"text/cmd": {
"compressible": true
},
"text/coffeescript": {
"extensions": ["coffee","litcoffee"]
},
"text/css": {
"source": "iana",
"compressible": true,
"extensions": ["css"]
},
"text/csv": {
"source": "iana",
"compressible": true,
"extensions": ["csv"]
},
"text/csv-schema": {
"source": "iana"
},
"text/directory": {
"source": "iana"
},
"text/dns": {
"source": "iana"
},
"text/ecmascript": {
"source": "iana"
},
"text/encaprtp": {
"source": "iana"
},
"text/enriched": {
"source": "iana"
},
"text/fwdred": {
"source": "iana"
},
"text/grammar-ref-list": {
"source": "iana"
},
"text/hjson": {
"extensions": ["hjson"]
},
"text/html": {
"source": "iana",
"compressible": true,
"extensions": ["html","htm","shtml"]
},
"text/jade": {
"extensions": ["jade"]
},
"text/javascript": {
"source": "iana",
"compressible": true
},
"text/jcr-cnd": {
"source": "iana"
},
"text/jsx": {
"compressible": true,
"extensions": ["jsx"]
},
"text/less": {
"extensions": ["less"]
},
"text/markdown": {
"source": "iana"
},
"text/mathml": {
"source": "nginx",
"extensions": ["mml"]
},
"text/mizar": {
"source": "iana"
},
"text/n3": {
"source": "iana",
"compressible": true,
"extensions": ["n3"]
},
"text/parameters": {
"source": "iana"
},
"text/parityfec": {
"source": "iana"
},
"text/plain": {
"source": "iana",
"compressible": true,
"extensions": ["txt","text","conf","def","list","log","in","ini"]
},
"text/provenance-notation": {
"source": "iana"
},
"text/prs.fallenstein.rst": {
"source": "iana"
},
"text/prs.lines.tag": {
"source": "iana",
"extensions": ["dsc"]
},
"text/raptorfec": {
"source": "iana"
},
"text/red": {
"source": "iana"
},
"text/rfc822-headers": {
"source": "iana"
},
"text/richtext": {
"source": "iana",
"compressible": true,
"extensions": ["rtx"]
},
"text/rtf": {
"source": "iana",
"compressible": true,
"extensions": ["rtf"]
},
"text/rtp-enc-aescm128": {
"source": "iana"
},
"text/rtploopback": {
"source": "iana"
},
"text/rtx": {
"source": "iana"
},
"text/sgml": {
"source": "iana",
"extensions": ["sgml","sgm"]
},
"text/stylus": {
"extensions": ["stylus","styl"]
},
"text/t140": {
"source": "iana"
},
"text/tab-separated-values": {
"source": "iana",
"compressible": true,
"extensions": ["tsv"]
},
"text/troff": {
"source": "iana",
"extensions": ["t","tr","roff","man","me","ms"]
},
"text/turtle": {
"source": "iana",
"extensions": ["ttl"]
},
"text/ulpfec": {
"source": "iana"
},
"text/uri-list": {
"source": "iana",
"compressible": true,
"extensions": ["uri","uris","urls"]
},
"text/vcard": {
"source": "iana",
"compressible": true,
"extensions": ["vcard"]
},
"text/vnd.a": {
"source": "iana"
},
"text/vnd.abc": {
"source": "iana"
},
"text/vnd.curl": {
"source": "iana",
"extensions": ["curl"]
},
"text/vnd.curl.dcurl": {
"source": "apache",
"extensions": ["dcurl"]
},
"text/vnd.curl.mcurl": {
"source": "apache",
"extensions": ["mcurl"]
},
"text/vnd.curl.scurl": {
"source": "apache",
"extensions": ["scurl"]
},
"text/vnd.debian.copyright": {
"source": "iana"
},
"text/vnd.dmclientscript": {
"source": "iana"
},
"text/vnd.dvb.subtitle": {
"source": "iana",
"extensions": ["sub"]
},
"text/vnd.esmertec.theme-descriptor": {
"source": "iana"
},
"text/vnd.fly": {
"source": "iana",
"extensions": ["fly"]
},
"text/vnd.fmi.flexstor": {
"source": "iana",
"extensions": ["flx"]
},
"text/vnd.graphviz": {
"source": "iana",
"extensions": ["gv"]
},
"text/vnd.in3d.3dml": {
"source": "iana",
"extensions": ["3dml"]
},
"text/vnd.in3d.spot": {
"source": "iana",
"extensions": ["spot"]
},
"text/vnd.iptc.newsml": {
"source": "iana"
},
"text/vnd.iptc.nitf": {
"source": "iana"
},
"text/vnd.latex-z": {
"source": "iana"
},
"text/vnd.motorola.reflex": {
"source": "iana"
},
"text/vnd.ms-mediapackage": {
"source": "iana"
},
"text/vnd.net2phone.commcenter.command": {
"source": "iana"
},
"text/vnd.radisys.msml-basic-layout": {
"source": "iana"
},
"text/vnd.si.uricatalogue": {
"source": "iana"
},
"text/vnd.sun.j2me.app-descriptor": {
"source": "iana",
"extensions": ["jad"]
},
"text/vnd.trolltech.linguist": {
"source": "iana"
},
"text/vnd.wap.si": {
"source": "iana"
},
"text/vnd.wap.sl": {
"source": "iana"
},
"text/vnd.wap.wml": {
"source": "iana",
"extensions": ["wml"]
},
"text/vnd.wap.wmlscript": {
"source": "iana",
"extensions": ["wmls"]
},
"text/vtt": {
"charset": "UTF-8",
"compressible": true,
"extensions": ["vtt"]
},
"text/x-asm": {
"source": "apache",
"extensions": ["s","asm"]
},
"text/x-c": {
"source": "apache",
"extensions": ["c","cc","cxx","cpp","h","hh","dic"]
},
"text/x-component": {
"source": "nginx",
"extensions": ["htc"]
},
"text/x-fortran": {
"source": "apache",
"extensions": ["f","for","f77","f90"]
},
"text/x-gwt-rpc": {
"compressible": true
},
"text/x-handlebars-template": {
"extensions": ["hbs"]
},
"text/x-java-source": {
"source": "apache",
"extensions": ["java"]
},
"text/x-jquery-tmpl": {
"compressible": true
},
"text/x-lua": {
"extensions": ["lua"]
},
"text/x-markdown": {
"compressible": true,
"extensions": ["markdown","md","mkd"]
},
"text/x-nfo": {
"source": "apache",
"extensions": ["nfo"]
},
"text/x-opml": {
"source": "apache",
"extensions": ["opml"]
},
"text/x-pascal": {
"source": "apache",
"extensions": ["p","pas"]
},
"text/x-processing": {
"compressible": true,
"extensions": ["pde"]
},
"text/x-sass": {
"extensions": ["sass"]
},
"text/x-scss": {
"extensions": ["scss"]
},
"text/x-setext": {
"source": "apache",
"extensions": ["etx"]
},
"text/x-sfv": {
"source": "apache",
"extensions": ["sfv"]
},
"text/x-suse-ymp": {
"compressible": true,
"extensions": ["ymp"]
},
"text/x-uuencode": {
"source": "apache",
"extensions": ["uu"]
},
"text/x-vcalendar": {
"source": "apache",
"extensions": ["vcs"]
},
"text/x-vcard": {
"source": "apache",
"extensions": ["vcf"]
},
"text/xml": {
"source": "iana",
"compressible": true,
"extensions": ["xml"]
},
"text/xml-external-parsed-entity": {
"source": "iana"
},
"text/yaml": {
"extensions": ["yaml","yml"]
},
"video/1d-interleaved-parityfec": {
"source": "apache"
},
"video/3gpp": {
"source": "apache",
"extensions": ["3gp","3gpp"]
},
"video/3gpp-tt": {
"source": "apache"
},
"video/3gpp2": {
"source": "apache",
"extensions": ["3g2"]
},
"video/bmpeg": {
"source": "apache"
},
"video/bt656": {
"source": "apache"
},
"video/celb": {
"source": "apache"
},
"video/dv": {
"source": "apache"
},
"video/h261": {
"source": "apache",
"extensions": ["h261"]
},
"video/h263": {
"source": "apache",
"extensions": ["h263"]
},
"video/h263-1998": {
"source": "apache"
},
"video/h263-2000": {
"source": "apache"
},
"video/h264": {
"source": "apache",
"extensions": ["h264"]
},
"video/h264-rcdo": {
"source": "apache"
},
"video/h264-svc": {
"source": "apache"
},
"video/jpeg": {
"source": "apache",
"extensions": ["jpgv"]
},
"video/jpeg2000": {
"source": "apache"
},
"video/jpm": {
"source": "apache",
"extensions": ["jpm","jpgm"]
},
"video/mj2": {
"source": "apache",
"extensions": ["mj2","mjp2"]
},
"video/mp1s": {
"source": "apache"
},
"video/mp2p": {
"source": "apache"
},
"video/mp2t": {
"source": "apache",
"extensions": ["ts"]
},
"video/mp4": {
"source": "apache",
"compressible": false,
"extensions": ["mp4","mp4v","mpg4"]
},
"video/mp4v-es": {
"source": "apache"
},
"video/mpeg": {
"source": "apache",
"compressible": false,
"extensions": ["mpeg","mpg","mpe","m1v","m2v"]
},
"video/mpeg4-generic": {
"source": "apache"
},
"video/mpv": {
"source": "apache"
},
"video/nv": {
"source": "apache"
},
"video/ogg": {
"source": "apache",
"compressible": false,
"extensions": ["ogv"]
},
"video/parityfec": {
"source": "apache"
},
"video/pointer": {
"source": "apache"
},
"video/quicktime": {
"source": "apache",
"compressible": false,
"extensions": ["qt","mov"]
},
"video/raw": {
"source": "apache"
},
"video/rtp-enc-aescm128": {
"source": "apache"
},
"video/rtx": {
"source": "apache"
},
"video/smpte292m": {
"source": "apache"
},
"video/ulpfec": {
"source": "apache"
},
"video/vc1": {
"source": "apache"
},
"video/vnd.cctv": {
"source": "apache"
},
"video/vnd.dece.hd": {
"source": "apache",
"extensions": ["uvh","uvvh"]
},
"video/vnd.dece.mobile": {
"source": "apache",
"extensions": ["uvm","uvvm"]
},
"video/vnd.dece.mp4": {
"source": "apache"
},
"video/vnd.dece.pd": {
"source": "apache",
"extensions": ["uvp","uvvp"]
},
"video/vnd.dece.sd": {
"source": "apache",
"extensions": ["uvs","uvvs"]
},
"video/vnd.dece.video": {
"source": "apache",
"extensions": ["uvv","uvvv"]
},
"video/vnd.directv.mpeg": {
"source": "apache"
},
"video/vnd.directv.mpeg-tts": {
"source": "apache"
},
"video/vnd.dlna.mpeg-tts": {
"source": "apache"
},
"video/vnd.dvb.file": {
"source": "apache",
"extensions": ["dvb"]
},
"video/vnd.fvt": {
"source": "apache",
"extensions": ["fvt"]
},
"video/vnd.hns.video": {
"source": "apache"
},
"video/vnd.iptvforum.1dparityfec-1010": {
"source": "apache"
},
"video/vnd.iptvforum.1dparityfec-2005": {
"source": "apache"
},
"video/vnd.iptvforum.2dparityfec-1010": {
"source": "apache"
},
"video/vnd.iptvforum.2dparityfec-2005": {
"source": "apache"
},
"video/vnd.iptvforum.ttsavc": {
"source": "apache"
},
"video/vnd.iptvforum.ttsmpeg2": {
"source": "apache"
},
"video/vnd.motorola.video": {
"source": "apache"
},
"video/vnd.motorola.videop": {
"source": "apache"
},
"video/vnd.mpegurl": {
"source": "apache",
"extensions": ["mxu","m4u"]
},
"video/vnd.ms-playready.media.pyv": {
"source": "apache",
"extensions": ["pyv"]
},
"video/vnd.nokia.interleaved-multimedia": {
"source": "apache"
},
"video/vnd.nokia.videovoip": {
"source": "apache"
},
"video/vnd.objectvideo": {
"source": "apache"
},
"video/vnd.sealed.mpeg1": {
"source": "apache"
},
"video/vnd.sealed.mpeg4": {
"source": "apache"
},
"video/vnd.sealed.swf": {
"source": "apache"
},
"video/vnd.sealedmedia.softseal.mov": {
"source": "apache"
},
"video/vnd.uvvu.mp4": {
"source": "apache",
"extensions": ["uvu","uvvu"]
},
"video/vnd.vivo": {
"source": "apache",
"extensions": ["viv"]
},
"video/webm": {
"source": "apache",
"compressible": false,
"extensions": ["webm"]
},
"video/x-f4v": {
"source": "apache",
"extensions": ["f4v"]
},
"video/x-fli": {
"source": "apache",
"extensions": ["fli"]
},
"video/x-flv": {
"source": "apache",
"compressible": false,
"extensions": ["flv"]
},
"video/x-m4v": {
"source": "apache",
"extensions": ["m4v"]
},
"video/x-matroska": {
"source": "apache",
"compressible": false,
"extensions": ["mkv","mk3d","mks"]
},
"video/x-mng": {
"source": "apache",
"extensions": ["mng"]
},
"video/x-ms-asf": {
"source": "apache",
"extensions": ["asf","asx"]
},
"video/x-ms-vob": {
"source": "apache",
"extensions": ["vob"]
},
"video/x-ms-wm": {
"source": "apache",
"extensions": ["wm"]
},
"video/x-ms-wmv": {
"source": "apache",
"compressible": false,
"extensions": ["wmv"]
},
"video/x-ms-wmx": {
"source": "apache",
"extensions": ["wmx"]
},
"video/x-ms-wvx": {
"source": "apache",
"extensions": ["wvx"]
},
"video/x-msvideo": {
"source": "apache",
"extensions": ["avi"]
},
"video/x-sgi-movie": {
"source": "apache",
"extensions": ["movie"]
},
"video/x-smv": {
"source": "apache",
"extensions": ["smv"]
},
"x-conference/x-cooltalk": {
"source": "apache",
"extensions": ["ice"]
},
"x-shader/x-fragment": {
"compressible": true
},
"x-shader/x-vertex": {
"compressible": true
}
}
},{}],130:[function(require,module,exports){
module["exports"] = [
"ants",
"bats",
"bears",
"bees",
"birds",
"buffalo",
"cats",
"chickens",
"cattle",
"dogs",
"dolphins",
"ducks",
"elephants",
"fishes",
"foxes",
"frogs",
"geese",
"goats",
"horses",
"kangaroos",
"lions",
"monkeys",
"owls",
"oxen",
"penguins",
"people",
"pigs",
"rabbits",
"sheep",
"tigers",
"whales",
"wolves",
"zebras",
"banshees",
"crows",
"black cats",
"chimeras",
"ghosts",
"conspirators",
"dragons",
"dwarves",
"elves",
"enchanters",
"exorcists",
"sons",
"foes",
"giants",
"gnomes",
"goblins",
"gooses",
"griffins",
"lycanthropes",
"nemesis",
"ogres",
"oracles",
"prophets",
"sorcerors",
"spiders",
"spirits",
"vampires",
"warlocks",
"vixens",
"werewolves",
"witches",
"worshipers",
"zombies",
"druids"
];
},{}],131:[function(require,module,exports){
var team = {};
module['exports'] = team;
team.creature = require("./creature");
team.name = require("./name");
},{"./creature":130,"./name":132}],132:[function(require,module,exports){
module["exports"] = [
"#{Address.state} #{creature}"
];
},{}],133:[function(require,module,exports){
module["exports"] = [
"##",
"#"
];
},{}],134:[function(require,module,exports){
module["exports"] = [
"#{city_name}"
];
},{}],135:[function(require,module,exports){
module["exports"] = [
"Airmadidi",
"Ampana",
"Amurang",
"Andolo",
"Banggai",
"Bantaeng",
"Barru",
"Bau-Bau",
"Benteng",
"Bitung",
"Bolaang Uki",
"Boroko",
"Bulukumba",
"Bungku",
"Buol",
"Buranga",
"Donggala",
"Enrekang",
"Gorontalo",
"Jeneponto",
"Kawangkoan",
"Kendari",
"Kolaka",
"Kotamobagu",
"Kota Raha",
"Kwandang",
"Lasusua",
"Luwuk",
"Majene",
"Makale",
"Makassar",
"Malili",
"Mamasa",
"Mamuju",
"Manado",
"Marisa",
"Maros",
"Masamba",
"Melonguane",
"Ondong Siau",
"Palopo",
"Palu",
"Pangkajene",
"Pare-Pare",
"Parigi",
"Pasangkayu",
"Pinrang",
"Polewali",
"Poso",
"Rantepao",
"Ratahan",
"Rumbia",
"Sengkang",
"Sidenreng",
"Sigi Biromaru",
"Sinjai",
"Sunggu Minasa",
"Suwawa",
"Tahuna",
"Takalar",
"Tilamuta",
"Toli Toli",
"Tomohon",
"Tondano",
"Tutuyan",
"Unaaha",
"Wangi Wangi",
"Wanggudu",
"Watampone",
"Watan Soppeng",
"Ambarawa",
"Anyer",
"Bandung",
"Bangil",
"Banjar (Jawa Barat)",
"Banjarnegara",
"Bangkalan",
"Bantul",
"Banyumas",
"Banyuwangi",
"Batang",
"Batu",
"Bekasi",
"Blitar",
"Blora",
"Bogor",
"Bojonegoro",
"Bondowoso",
"Boyolali",
"Bumiayu",
"Brebes",
"Caruban",
"Cianjur",
"Ciamis",
"Cibinong",
"Cikampek",
"Cikarang",
"Cilacap",
"Cilegon",
"Cirebon",
"Demak",
"Depok",
"Garut",
"Gresik",
"Indramayu",
"Jakarta",
"Jember",
"Jepara",
"Jombang",
"Kajen",
"Karanganyar",
"Kebumen",
"Kediri",
"Kendal",
"Kepanjen",
"Klaten",
"Pelabuhan Ratu",
"Kraksaan",
"Kudus",
"Kuningan",
"Lamongan",
"Lumajang",
"Madiun",
"Magelang",
"Magetan",
"Majalengka",
"Malang",
"Mojokerto",
"Mojosari",
"Mungkid",
"Ngamprah",
"Nganjuk",
"Ngawi",
"Pacitan",
"Pamekasan",
"Pandeglang",
"Pare",
"Pati",
"Pasuruan",
"Pekalongan",
"Pemalang",
"Ponorogo",
"Probolinggo",
"Purbalingga",
"Purwakarta",
"Purwodadi",
"Purwokerto",
"Purworejo",
"Rangkasbitung",
"Rembang",
"Salatiga",
"Sampang",
"Semarang",
"Serang",
"Sidayu",
"Sidoarjo",
"Singaparna",
"Situbondo",
"Slawi",
"Sleman",
"Soreang",
"Sragen",
"Subang",
"Sukabumi",
"Sukoharjo",
"Sumber",
"Sumedang",
"Sumenep",
"Surabaya",
"Surakarta",
"Tasikmalaya",
"Tangerang",
"Tangerang Selatan",
"Tegal",
"Temanggung",
"Tigaraksa",
"Trenggalek",
"Tuban",
"Tulungagung",
"Ungaran",
"Wates",
"Wlingi",
"Wonogiri",
"Wonosari",
"Wonosobo",
"Yogyakarta",
"Atambua",
"Baa",
"Badung",
"Bajawa",
"Bangli",
"Bima",
"Denpasar",
"Dompu",
"Ende",
"Gianyar",
"Kalabahi",
"Karangasem",
"Kefamenanu",
"Klungkung",
"Kupang",
"Labuhan Bajo",
"Larantuka",
"Lewoleba",
"Maumere",
"Mataram",
"Mbay",
"Negara",
"Praya",
"Raba",
"Ruteng",
"Selong",
"Singaraja",
"Soe",
"Sumbawa Besar",
"Tabanan",
"Taliwang",
"Tambolaka",
"Tanjung",
"Waibakul",
"Waikabubak",
"Waingapu",
"Denpasar",
"Negara,Bali",
"Singaraja",
"Tabanan",
"Bangli"
];
},{}],136:[function(require,module,exports){
module["exports"] = [
"Indonesia"
];
},{}],137:[function(require,module,exports){
var address = {};
module['exports'] = address;
address.building_number = require("./building_number");
address.postcode = require("./postcode");
address.state = require("./state");
address.city_name = require("./city_name");
address.city = require("./city");
address.street_prefix = require("./street_prefix");
address.street_name = require("./street_name");
address.street_address = require("./street_address");
address.default_country = require("./default_country");
},{"./building_number":133,"./city":134,"./city_name":135,"./default_country":136,"./postcode":138,"./state":139,"./street_address":140,"./street_name":141,"./street_prefix":142}],138:[function(require,module,exports){
module["exports"] = [
"#####"
];
},{}],139:[function(require,module,exports){
module["exports"] = [
"Aceh",
"Sumatera Utara",
"Sumatera Barat",
"Jambi",
"Bangka Belitung",
"Riau",
"Kepulauan Riau",
"Bengkulu",
"Sumatera Selatan",
"Lampung",
"Banten",
"DKI Jakarta",
"Jawa Barat",
"Jawa Tengah",
"Jawa Timur",
"Nusa Tenggara Timur",
"DI Yogyakarta",
"Bali",
"Nusa Tenggara Barat",
"Kalimantan Barat",
"Kalimantan Tengah",
"Kalimantan Selatan",
"Kalimantan Timur",
"Kalimantan Utara",
"Sulawesi Selatan",
"Sulawesi Utara",
"Gorontalo",
"Sulawesi Tengah",
"Sulawesi Barat",
"Sulawesi Tenggara",
"Maluku",
"Maluku Utara",
"Papua Barat",
"Papua"
];
},{}],140:[function(require,module,exports){
module["exports"] = [
"#{street_name} no #{building_number}"
];
},{}],141:[function(require,module,exports){
module["exports"] = [
"#{street_prefix} #{Name.first_name}",
"#{street_prefix} #{Name.last_name}"
];
},{}],142:[function(require,module,exports){
module["exports"] = [
"Ds.",
"Dk.",
"Gg.",
"Jln.",
"Jr.",
"Kpg.",
"Ki.",
"Psr."
];
},{}],143:[function(require,module,exports){
var company = {};
module['exports'] = company;
company.prefix = require("./prefix");
company.suffix = require("./suffix");
company.name = require("./name");
},{"./name":144,"./prefix":145,"./suffix":146}],144:[function(require,module,exports){
module["exports"] = [
"#{prefix} #{Name.last_name}",
"#{Name.last_name} #{suffix}",
"#{prefix} #{Name.last_name} #{suffix}"
];
},{}],145:[function(require,module,exports){
module["exports"] = [
"PT",
"CV",
"UD",
"PD",
"Perum"
];
},{}],146:[function(require,module,exports){
module["exports"] = [
"(Persero) Tbk",
"Tbk"
];
},{}],147:[function(require,module,exports){
arguments[4][97][0].apply(exports,arguments)
},{"./month":148,"./weekday":149,"dup":97}],148:[function(require,module,exports){
module["exports"] = {
wide: [
"Januari",
"Februari",
"Maret",
"April",
"Mei",
"Juni",
"Juli",
"Agustus",
"September",
"Oktober",
"November",
"Desember"
],
wide_context: [
"Januari",
"Februari",
"Maret",
"April",
"Mei",
"Juni",
"Juli",
"Agustus",
"September",
"Oktober",
"November",
"Desember"
],
abbr: [
"Jan",
"Feb",
"Mar",
"Apr",
"Mei",
"Jun",
"Jul",
"Ags",
"Sep",
"Okt",
"Nov",
"Des"
],
abbr_context: [
"Jan",
"Feb",
"Mar",
"Apr",
"Mei",
"Jun",
"Jul",
"Ags",
"Sep",
"Okt",
"Nov",
"Des"
]
};
},{}],149:[function(require,module,exports){
module["exports"] = {
wide: [
"Minggu",
"Senin",
"Selasa",
"Rabu",
"Kamis",
"Jumat",
"Sabtu"
],
wide_context: [
"Minggu",
"Senin",
"Selasa",
"Rabu",
"Kamis",
"Jumat",
"Sabtu"
],
abbr: [
"Min",
"Sen",
"Sel",
"Rab",
"Kam",
"Jum",
"Sab"
],
abbr_context: [
"Min",
"Sen",
"Sel",
"Rab",
"Kam",
"Jum",
"Sab"
]
};
},{}],150:[function(require,module,exports){
var id = {};
module['exports'] = id;
id.title = "Indonesia";
id.address = require("./address");
id.company = require("./company");
id.internet = require("./internet");
id.date = require("./date");
id.name = require("./name");
id.phone_number = require("./phone_number");
},{"./address":137,"./company":143,"./date":147,"./internet":153,"./name":156,"./phone_number":163}],151:[function(require,module,exports){
module["exports"] = [
"com",
"net",
"org",
"asia",
"tv",
"biz",
"info",
"in",
"name",
"co",
"ac.id",
"sch.id",
"go.id",
"mil.id",
"co.id",
"or.id",
"web.id",
"my.id",
"biz.id",
"desa.id"
];
},{}],152:[function(require,module,exports){
module["exports"] = [
'gmail.com',
'yahoo.com',
'gmail.co.id',
'yahoo.co.id'
];
},{}],153:[function(require,module,exports){
var internet = {};
module['exports'] = internet;
internet.free_email = require("./free_email");
internet.domain_suffix = require("./domain_suffix");
},{"./domain_suffix":151,"./free_email":152}],154:[function(require,module,exports){
module["exports"] = [
"Ade",
"Agnes",
"Ajeng",
"Amalia",
"Anita",
"Ayu",
"Aisyah",
"Ana",
"Ami",
"Ani",
"Azalea",
"Aurora",
"Alika",
"Anastasia",
"Amelia",
"Almira",
"Bella",
"Betania",
"Belinda",
"Citra",
"Cindy",
"Chelsea",
"Clara",
"Cornelia",
"Cinta",
"Cinthia",
"Ciaobella",
"Cici",
"Carla",
"Calista",
"Devi",
"Dewi","Dian",
"Diah",
"Diana",
"Dina",
"Dinda",
"Dalima",
"Eka",
"Eva",
"Endah",
"Elisa",
"Eli",
"Ella",
"Ellis",
"Elma",
"Elvina",
"Fitria",
"Fitriani",
"Febi",
"Faizah",
"Farah",
"Farhunnisa",
"Fathonah",
"Gabriella",
"Gasti",
"Gawati",
"Genta",
"Ghaliyati",
"Gina",
"Gilda",
"Halima",
"Hesti",
"Hilda",
"Hafshah",
"Hamima",
"Hana",
"Hani",
"Hasna",
"Humaira",
"Ika",
"Indah",
"Intan",
"Irma",
"Icha",
"Ida",
"Ifa",
"Ilsa",
"Ina",
"Ira",
"Iriana",
"Jamalia",
"Janet",
"Jane",
"Julia",
"Juli",
"Jessica",
"Jasmin",
"Jelita",
"Kamaria",
"Kamila",
"Kani",
"Karen",
"Karimah",
"Kartika",
"Kasiyah",
"Keisha",
"Kezia",
"Kiandra",
"Kayla",
"Kania",
"Lala",
"Lalita",
"Latika",
"Laila",
"Laras",
"Lidya",
"Lili",
"Lintang",
"Maria",
"Mala",
"Maya",
"Maida",
"Maimunah",
"Melinda",
"Mila",
"Mutia",
"Michelle",
"Malika",
"Nadia",
"Nadine",
"Nabila",
"Natalia",
"Novi",
"Nova",
"Nurul",
"Nilam",
"Najwa",
"Olivia",
"Ophelia",
"Oni",
"Oliva",
"Padma",
"Putri",
"Paramita",
"Paris",
"Patricia",
"Paulin",
"Puput",
"Puji",
"Pia",
"Puspa",
"Puti",
"Putri",
"Padmi",
"Qori",
"Queen",
"Ratih",
"Ratna",
"Restu",
"Rini",
"Rika",
"Rina",
"Rahayu",
"Rahmi",
"Rachel",
"Rahmi",
"Raisa",
"Raina",
"Sarah",
"Sari",
"Siti",
"Siska",
"Suci",
"Syahrini",
"Septi",
"Sadina",
"Safina",
"Sakura",
"Salimah",
"Salwa",
"Salsabila",
"Samiah",
"Shania",
"Sabrina",
"Silvia",
"Shakila",
"Talia",
"Tami",
"Tira",
"Tiara",
"Titin",
"Tania",
"Tina",
"Tantri",
"Tari",
"Titi",
"Uchita",
"Unjani",
"Ulya",
"Uli",
"Ulva",
"Umi",
"Usyi",
"Vanya",
"Vanesa",
"Vivi",
"Vera",
"Vicky",
"Victoria",
"Violet",
"Winda",
"Widya",
"Wulan",
"Wirda",
"Wani",
"Yani",
"Yessi",
"Yulia",
"Yuliana",
"Yuni",
"Yunita",
"Yance",
"Zahra",
"Zalindra",
"Zaenab",
"Zulfa",
"Zizi",
"Zulaikha",
"Zamira",
"Zelda",
"Zelaya"
];
},{}],155:[function(require,module,exports){
module["exports"] = [
"Agustina",
"Andriani",
"Anggraini",
"Aryani",
"Astuti",
"Fujiati",
"Farida",
"Handayani",
"Hassanah",
"Hartati",
"Hasanah",
"Haryanti",
"Hariyah",
"Hastuti",
"Halimah",
"Kusmawati",
"Kuswandari",
"Laksmiwati",
"Laksita",
"Lestari",
"Lailasari",
"Mandasari",
"Mardhiyah",
"Mayasari",
"Melani",
"Mulyani",
"Maryati",
"Nurdiyanti",
"Novitasari",
"Nuraini",
"Nasyidah",
"Nasyiah",
"Namaga",
"Palastri",
"Pudjiastuti",
"Puspasari",
"Puspita",
"Purwanti",
"Pratiwi",
"Purnawati",
"Pertiwi",
"Permata",
"Prastuti",
"Padmasari",
"Rahmawati",
"Rahayu",
"Riyanti",
"Rahimah",
"Suartini",
"Sudiati",
"Suryatmi",
"Susanti",
"Safitri",
"Oktaviani",
"Utami",
"Usamah",
"Usada",
"Uyainah",
"Yuniar",
"Yuliarti",
"Yulianti",
"Yolanda",
"Wahyuni",
"Wijayanti",
"Widiastuti",
"Winarsih",
"Wulandari",
"Wastuti",
"Zulaika"
];
},{}],156:[function(require,module,exports){
var name = {};
module['exports'] = name;
name.male_first_name = require("./male_first_name");
name.male_last_name = require("./male_last_name");
name.female_first_name = require("./female_first_name");
name.female_last_name = require("./female_last_name");
name.prefix = require("./prefix");
name.suffix = require("./suffix");
name.name = require("./name");
},{"./female_first_name":154,"./female_last_name":155,"./male_first_name":157,"./male_last_name":158,"./name":159,"./prefix":160,"./suffix":161}],157:[function(require,module,exports){
module["exports"] = [
"Abyasa",
"Ade",
"Adhiarja",
"Adiarja",
"Adika",
"Adikara",
"Adinata",
"Aditya",
"Agus",
"Ajiman",
"Ajimat",
"Ajimin",
"Ajiono",
"Akarsana",
"Alambana",
"Among",
"Anggabaya",
"Anom",
"Argono",
"Aris",
"Arta",
"Artanto",
"Artawan",
"Arsipatra",
"Asirwada",
"Asirwanda",
"Aslijan",
"Asmadi",
"Asman",
"Asmianto",
"Asmuni",
"Aswani",
"Atma",
"Atmaja",
"Bagas",
"Bagiya",
"Bagus",
"Bagya",
"Bahuraksa",
"Bahuwarna",
"Bahuwirya",
"Bajragin",
"Bakda",
"Bakiadi",
"Bakianto",
"Bakidin",
"Bakijan",
"Bakiman",
"Bakiono",
"Bakti",
"Baktiadi",
"Baktianto",
"Baktiono",
"Bala",
"Balamantri",
"Balangga",
"Balapati",
"Balidin",
"Balijan",
"Bambang",
"Banara",
"Banawa",
"Banawi",
"Bancar",
"Budi",
"Cagak",
"Cager",
"Cahyadi",
"Cahyanto",
"Cahya",
"Cahyo",
"Cahyono",
"Caket",
"Cakrabirawa",
"Cakrabuana",
"Cakrajiya",
"Cakrawala",
"Cakrawangsa",
"Candra",
"Chandra",
"Candrakanta",
"Capa",
"Caraka",
"Carub",
"Catur",
"Caturangga",
"Cawisadi",
"Cawisono",
"Cawuk",
"Cayadi",
"Cecep",
"Cemani",
"Cemeti",
"Cemplunk",
"Cengkal",
"Cengkir",
"Dacin",
"Dadap",
"Dadi",
"Dagel",
"Daliman",
"Dalimin",
"Daliono",
"Damar",
"Damu",
"Danang",
"Daniswara",
"Danu",
"Danuja",
"Dariati",
"Darijan",
"Darimin",
"Darmaji",
"Darman",
"Darmana",
"Darmanto",
"Darsirah",
"Dartono",
"Daru",
"Daruna",
"Daryani",
"Dasa",
"Digdaya",
"Dimas",
"Dimaz",
"Dipa",
"Dirja",
"Drajat",
"Dwi",
"Dono",
"Dodo",
"Edi",
"Eka",
"Elon",
"Eluh",
"Eman",
"Emas",
"Embuh",
"Emong",
"Empluk",
"Endra",
"Enteng",
"Estiawan",
"Estiono",
"Eko",
"Edi",
"Edison",
"Edward",
"Elvin",
"Erik",
"Emil",
"Ega",
"Emin",
"Eja",
"Gada",
"Gadang",
"Gaduh",
"Gaiman",
"Galak",
"Galang",
"Galar",
"Galih",
"Galiono",
"Galuh",
"Galur",
"Gaman",
"Gamani",
"Gamanto",
"Gambira",
"Gamblang",
"Ganda",
"Gandewa",
"Gandi",
"Gandi",
"Ganep",
"Gangsa",
"Gangsar",
"Ganjaran",
"Gantar",
"Gara",
"Garan",
"Garang",
"Garda",
"Gatot",
"Gatra",
"Gilang",
"Galih",
"Ghani",
"Gading",
"Hairyanto",
"Hardana",
"Hardi",
"Harimurti",
"Harja",
"Harjasa",
"Harjaya",
"Harjo",
"Harsana",
"Harsanto",
"Harsaya",
"Hartaka",
"Hartana",
"Harto",
"Hasta",
"Heru",
"Himawan",
"Hadi",
"Halim",
"Hasim",
"Hasan",
"Hendra",
"Hendri",
"Heryanto",
"Hamzah",
"Hari",
"Imam",
"Indra",
"Irwan",
"Irsad",
"Ikhsan",
"Irfan",
"Ian",
"Ibrahim",
"Ibrani",
"Ismail",
"Irnanto",
"Ilyas",
"Ibun",
"Ivan",
"Ikin",
"Ihsan",
"Jabal",
"Jaeman",
"Jaga",
"Jagapati",
"Jagaraga",
"Jail",
"Jaiman",
"Jaka",
"Jarwa",
"Jarwadi",
"Jarwi",
"Jasmani",
"Jaswadi",
"Jati",
"Jatmiko",
"Jaya",
"Jayadi",
"Jayeng",
"Jinawi",
"Jindra",
"Joko",
"Jumadi",
"Jumari",
"Jamal",
"Jamil",
"Jais",
"Jefri",
"Johan",
"Jono",
"Kacung",
"Kajen",
"Kambali",
"Kamidin",
"Kariman",
"Karja",
"Karma",
"Karman",
"Karna",
"Karsa",
"Karsana",
"Karta",
"Kasiran",
"Kasusra",
"Kawaca",
"Kawaya",
"Kayun",
"Kemba",
"Kenari",
"Kenes",
"Kuncara",
"Kunthara",
"Kusuma",
"Kadir",
"Kala",
"Kalim",
"Kurnia",
"Kanda",
"Kardi",
"Karya",
"Kasim",
"Kairav",
"Kenzie",
"Kemal",
"Kamal",
"Koko",
"Labuh",
"Laksana",
"Lamar",
"Lanang",
"Langgeng",
"Lanjar",
"Lantar",
"Lega",
"Legawa",
"Lembah",
"Liman",
"Limar",
"Luhung",
"Lukita",
"Luluh",
"Lulut",
"Lurhur",
"Luwar",
"Luwes",
"Latif",
"Lasmanto",
"Lukman",
"Luthfi",
"Leo",
"Luis",
"Lutfan",
"Lasmono",
"Laswi",
"Mahesa",
"Makara",
"Makuta",
"Manah",
"Maras",
"Margana",
"Mariadi",
"Marsudi",
"Martaka",
"Martana",
"Martani",
"Marwata",
"Maryadi",
"Maryanto",
"Mitra",
"Mujur",
"Mulya",
"Mulyanto",
"Mulyono",
"Mumpuni",
"Muni",
"Mursita",
"Murti",
"Mustika",
"Maman",
"Mahmud",
"Mahdi",
"Mahfud",
"Malik",
"Muhammad",
"Mustofa",
"Marsito",
"Mursinin",
"Nalar",
"Naradi",
"Nardi",
"Niyaga",
"Nrima",
"Nugraha",
"Nyana",
"Narji",
"Nasab",
"Nasrullah",
"Nasim",
"Najib",
"Najam",
"Nyoman",
"Olga",
"Ozy",
"Omar",
"Opan",
"Oskar",
"Oman",
"Okto",
"Okta",
"Opung",
"Paiman",
"Panca",
"Pangeran",
"Pangestu",
"Pardi",
"Parman",
"Perkasa",
"Praba",
"Prabu",
"Prabawa",
"Prabowo",
"Prakosa",
"Pranata",
"Pranawa",
"Prasetya",
"Prasetyo",
"Prayitna",
"Prayoga",
"Prayogo",
"Purwadi",
"Purwa",
"Purwanto",
"Panji",
"Pandu",
"Paiman",
"Prima",
"Putu",
"Raden",
"Raditya",
"Raharja",
"Rama",
"Rangga",
"Reksa",
"Respati",
"Rusman",
"Rosman",
"Rahmat",
"Rahman",
"Rendy",
"Reza",
"Rizki",
"Ridwan",
"Rudi",
"Raden",
"Radit",
"Radika",
"Rafi",
"Rafid",
"Raihan",
"Salman",
"Saadat",
"Saiful",
"Surya",
"Slamet",
"Samsul",
"Soleh",
"Simon",
"Sabar",
"Sabri",
"Sidiq",
"Satya",
"Setya",
"Saka",
"Sakti",
"Taswir",
"Tedi",
"Teddy",
"Taufan",
"Taufik",
"Tomi",
"Tasnim",
"Teguh",
"Tasdik",
"Timbul",
"Tirta",
"Tirtayasa",
"Tri",
"Tugiman",
"Umar",
"Usman",
"Uda",
"Umay",
"Unggul",
"Utama",
"Umaya",
"Upik",
"Viktor",
"Vino",
"Vinsen",
"Vero",
"Vega",
"Viman",
"Virman",
"Wahyu",
"Wira",
"Wisnu",
"Wadi",
"Wardi",
"Warji",
"Waluyo",
"Wakiman",
"Wage",
"Wardaya",
"Warsa",
"Warsita",
"Warta",
"Wasis",
"Wawan",
"Xanana",
"Yahya",
"Yusuf",
"Yosef",
"Yono",
"Yoga"
];
},{}],158:[function(require,module,exports){
module["exports"] = [
"Adriansyah",
"Ardianto",
"Anggriawan",
"Budiman",
"Budiyanto",
"Damanik",
"Dongoran",
"Dabukke",
"Firmansyah",
"Firgantoro",
"Gunarto",
"Gunawan",
"Hardiansyah",
"Habibi",
"Hakim",
"Halim",
"Haryanto",
"Hidayat",
"Hidayanto",
"Hutagalung",
"Hutapea",
"Hutasoit",
"Irawan",
"Iswahyudi",
"Kuswoyo",
"Januar",
"Jailani",
"Kurniawan",
"Kusumo",
"Latupono",
"Lazuardi",
"Maheswara",
"Mahendra",
"Mustofa",
"Mansur",
"Mandala",
"Megantara",
"Maulana",
"Maryadi",
"Mangunsong",
"Manullang",
"Marpaung",
"Marbun",
"Narpati",
"Natsir",
"Nugroho",
"Najmudin",
"Nashiruddin",
"Nainggolan",
"Nababan",
"Napitupulu",
"Pangestu",
"Putra",
"Pranowo",
"Prabowo",
"Pratama",
"Prasetya",
"Prasetyo",
"Pradana",
"Pradipta",
"Prakasa",
"Permadi",
"Prasasta",
"Prayoga",
"Ramadan",
"Rajasa",
"Rajata",
"Saptono",
"Santoso",
"Saputra",
"Saefullah",
"Setiawan",
"Suryono",
"Suwarno",
"Siregar",
"Sihombing",
"Salahudin",
"Sihombing",
"Samosir",
"Saragih",
"Sihotang",
"Simanjuntak",
"Sinaga",
"Simbolon",
"Sitompul",
"Sitorus",
"Sirait",
"Siregar",
"Situmorang",
"Tampubolon",
"Thamrin",
"Tamba",
"Tarihoran",
"Utama",
"Uwais",
"Wahyudin",
"Waluyo",
"Wibowo",
"Winarno",
"Wibisono",
"Wijaya",
"Widodo",
"Wacana",
"Waskita",
"Wasita",
"Zulkarnain"
];
},{}],159:[function(require,module,exports){
module["exports"] = [
"#{male_first_name} #{male_last_name}",
"#{male_last_name} #{male_first_name}",
"#{male_first_name} #{male_first_name} #{male_last_name}",
"#{female_first_name} #{female_last_name}",
"#{female_first_name} #{male_last_name}",
"#{female_last_name} #{female_first_name}",
"#{female_first_name} #{female_first_name} #{female_last_name}"
];
},{}],160:[function(require,module,exports){
module["exports"] = [];
},{}],161:[function(require,module,exports){
module["exports"] = [
"S.Ked",
"S.Gz",
"S.Pt",
"S.IP",
"S.E.I",
"S.E.",
"S.Kom",
"S.H.",
"S.T.",
"S.Pd",
"S.Psi",
"S.I.Kom",
"S.Sos",
"S.Farm",
"M.M.",
"M.Kom.",
"M.TI.",
"M.Pd",
"M.Farm",
"M.Ak"
];
},{}],162:[function(require,module,exports){
module["exports"] = [
"02# #### ###",
"02## #### ###",
"03## #### ###",
"04## #### ###",
"05## #### ###",
"06## #### ###",
"07## #### ###",
"09## #### ###",
"02# #### ####",
"02## #### ####",
"03## #### ####",
"04## #### ####",
"05## #### ####",
"06## #### ####",
"07## #### ####",
"09## #### ####",
"08## ### ###",
"08## #### ###",
"08## #### ####",
"(+62) 8## ### ###",
"(+62) 2# #### ###",
"(+62) 2## #### ###",
"(+62) 3## #### ###",
"(+62) 4## #### ###",
"(+62) 5## #### ###",
"(+62) 6## #### ###",
"(+62) 7## #### ###",
"(+62) 8## #### ###",
"(+62) 9## #### ###",
"(+62) 2# #### ####",
"(+62) 2## #### ####",
"(+62) 3## #### ####",
"(+62) 4## #### ####",
"(+62) 5## #### ####",
"(+62) 6## #### ####",
"(+62) 7## #### ####",
"(+62) 8## #### ####",
"(+62) 9## #### ####"
];
},{}],163:[function(require,module,exports){
arguments[4][127][0].apply(exports,arguments)
},{"./formats":162,"dup":127}],164:[function(require,module,exports){
/**
*
* @namespace faker.lorem
*/
var Lorem = function (faker) {
var self = this;
var Helpers = faker.helpers;
/**
* word
*
* @method faker.lorem.word
* @param {number} num
*/
self.word = function (num) {
return faker.random.arrayElement(faker.definitions.lorem.words);
};
/**
* generates a space separated list of words
*
* @method faker.lorem.words
* @param {number} num number of words, defaults to 3
*/
self.words = function (num) {
if (typeof num == 'undefined') { num = 3; }
var words = [];
for (var i = 0; i < num; i++) {
words.push(faker.lorem.word());
}
return words.join(' ');
};
/**
* sentence
*
* @method faker.lorem.sentence
* @param {number} wordCount defaults to a random number between 3 and 10
* @param {number} range
*/
self.sentence = function (wordCount, range) {
if (typeof wordCount == 'undefined') { wordCount = faker.random.number({ min: 3, max: 10 }); }
// if (typeof range == 'undefined') { range = 7; }
// strange issue with the node_min_test failing for captialize, please fix and add faker.lorem.back
//return faker.lorem.words(wordCount + Helpers.randomNumber(range)).join(' ').capitalize();
var sentence = faker.lorem.words(wordCount);
return sentence.charAt(0).toUpperCase() + sentence.slice(1) + '.';
};
/**
* sentences
*
* @method faker.lorem.sentences
* @param {number} sentenceCount defautls to a random number between 2 and 6
* @param {string} separator defaults to `' '`
*/
self.sentences = function (sentenceCount, separator) {
if (typeof sentenceCount === 'undefined') { sentenceCount = faker.random.number({ min: 2, max: 6 });}
if (typeof separator == 'undefined') { separator = " "; }
var sentences = [];
for (sentenceCount; sentenceCount > 0; sentenceCount--) {
sentences.push(faker.lorem.sentence());
}
return sentences.join(separator);
};
/**
* paragraph
*
* @method faker.lorem.paragraph
* @param {number} sentenceCount defaults to 3
*/
self.paragraph = function (sentenceCount) {
if (typeof sentenceCount == 'undefined') { sentenceCount = 3; }
return faker.lorem.sentences(sentenceCount + faker.random.number(3));
};
/**
* paragraphs
*
* @method faker.lorem.paragraphs
* @param {number} paragraphCount defaults to 3
* @param {string} separatora defaults to `'\n \r'`
*/
self.paragraphs = function (paragraphCount, separator) {
if (typeof separator === "undefined") {
separator = "\n \r";
}
if (typeof paragraphCount == 'undefined') { paragraphCount = 3; }
var paragraphs = [];
for (paragraphCount; paragraphCount > 0; paragraphCount--) {
paragraphs.push(faker.lorem.paragraph());
}
return paragraphs.join(separator);
}
/**
* returns random text based on a random lorem method
*
* @method faker.lorem.text
* @param {number} times
*/
self.text = function loremText (times) {
var loremMethods = ['lorem.word', 'lorem.words', 'lorem.sentence', 'lorem.sentences', 'lorem.paragraph', 'lorem.paragraphs', 'lorem.lines'];
var randomLoremMethod = faker.random.arrayElement(loremMethods);
return faker.fake('{{' + randomLoremMethod + '}}');
};
/**
* returns lines of lorem separated by `'\n'`
*
* @method faker.lorem.lines
* @param {number} lineCount defaults to a random number between 1 and 5
*/
self.lines = function lines (lineCount) {
if (typeof lineCount === 'undefined') { lineCount = faker.random.number({ min: 1, max: 5 });}
return faker.lorem.sentences(lineCount, '\n')
};
return self;
};
module["exports"] = Lorem;
},{}],165:[function(require,module,exports){
/**
*
* @namespace faker.name
*/
function Name (faker) {
/**
* firstName
*
* @method firstName
* @param {mixed} gender
* @memberof faker.name
*/
this.firstName = function (gender) {
if (typeof faker.definitions.name.male_first_name !== "undefined" && typeof faker.definitions.name.female_first_name !== "undefined") {
// some locale datasets ( like ru ) have first_name split by gender. since the name.first_name field does not exist in these datasets,
// we must randomly pick a name from either gender array so faker.name.firstName will return the correct locale data ( and not fallback )
if (typeof gender !== 'number') {
gender = faker.random.number(1);
}
if (gender === 0) {
return faker.random.arrayElement(faker.locales[faker.locale].name.male_first_name)
} else {
return faker.random.arrayElement(faker.locales[faker.locale].name.female_first_name);
}
}
return faker.random.arrayElement(faker.definitions.name.first_name);
};
/**
* lastName
*
* @method lastName
* @param {mixed} gender
* @memberof faker.name
*/
this.lastName = function (gender) {
if (typeof faker.definitions.name.male_last_name !== "undefined" && typeof faker.definitions.name.female_last_name !== "undefined") {
// some locale datasets ( like ru ) have last_name split by gender. i have no idea how last names can have genders, but also i do not speak russian
// see above comment of firstName method
if (typeof gender !== 'number') {
gender = faker.random.number(1);
}
if (gender === 0) {
return faker.random.arrayElement(faker.locales[faker.locale].name.male_last_name);
} else {
return faker.random.arrayElement(faker.locales[faker.locale].name.female_last_name);
}
}
return faker.random.arrayElement(faker.definitions.name.last_name);
};
/**
* findName
*
* @method findName
* @param {string} firstName
* @param {string} lastName
* @param {mixed} gender
* @memberof faker.name
*/
this.findName = function (firstName, lastName, gender) {
var r = faker.random.number(8);
var prefix, suffix;
// in particular locales first and last names split by gender,
// thus we keep consistency by passing 0 as male and 1 as female
if (typeof gender !== 'number') {
gender = faker.random.number(1);
}
firstName = firstName || faker.name.firstName(gender);
lastName = lastName || faker.name.lastName(gender);
switch (r) {
case 0:
prefix = faker.name.prefix(gender);
if (prefix) {
return prefix + " " + firstName + " " + lastName;
}
case 1:
suffix = faker.name.suffix(gender);
if (suffix) {
return firstName + " " + lastName + " " + suffix;
}
}
return firstName + " " + lastName;
};
/**
* jobTitle
*
* @method jobTitle
* @memberof faker.name
*/
this.jobTitle = function () {
return faker.name.jobDescriptor() + " " +
faker.name.jobArea() + " " +
faker.name.jobType();
};
/**
* prefix
*
* @method prefix
* @param {mixed} gender
* @memberof faker.name
*/
this.prefix = function (gender) {
if (typeof faker.definitions.name.male_prefix !== "undefined" && typeof faker.definitions.name.female_prefix !== "undefined") {
if (typeof gender !== 'number') {
gender = faker.random.number(1);
}
if (gender === 0) {
return faker.random.arrayElement(faker.locales[faker.locale].name.male_prefix);
} else {
return faker.random.arrayElement(faker.locales[faker.locale].name.female_prefix);
}
}
return faker.random.arrayElement(faker.definitions.name.prefix);
};
/**
* suffix
*
* @method suffix
* @memberof faker.name
*/
this.suffix = function () {
return faker.random.arrayElement(faker.definitions.name.suffix);
};
/**
* title
*
* @method title
* @memberof faker.name
*/
this.title = function() {
var descriptor = faker.random.arrayElement(faker.definitions.name.title.descriptor),
level = faker.random.arrayElement(faker.definitions.name.title.level),
job = faker.random.arrayElement(faker.definitions.name.title.job);
return descriptor + " " + level + " " + job;
};
/**
* jobDescriptor
*
* @method jobDescriptor
* @memberof faker.name
*/
this.jobDescriptor = function () {
return faker.random.arrayElement(faker.definitions.name.title.descriptor);
};
/**
* jobArea
*
* @method jobArea
* @memberof faker.name
*/
this.jobArea = function () {
return faker.random.arrayElement(faker.definitions.name.title.level);
};
/**
* jobType
*
* @method jobType
* @memberof faker.name
*/
this.jobType = function () {
return faker.random.arrayElement(faker.definitions.name.title.job);
};
}
module['exports'] = Name;
},{}],166:[function(require,module,exports){
/**
*
* @namespace faker.phone
*/
var Phone = function (faker) {
var self = this;
/**
* phoneNumber
*
* @method faker.phone.phoneNumber
* @param {string} format
*/
self.phoneNumber = function (format) {
format = format || faker.phone.phoneFormats();
return faker.helpers.replaceSymbolWithNumber(format);
};
// FIXME: this is strange passing in an array index.
/**
* phoneNumberFormat
*
* @method faker.phone.phoneFormatsArrayIndex
* @param phoneFormatsArrayIndex
*/
self.phoneNumberFormat = function (phoneFormatsArrayIndex) {
phoneFormatsArrayIndex = phoneFormatsArrayIndex || 0;
return faker.helpers.replaceSymbolWithNumber(faker.definitions.phone_number.formats[phoneFormatsArrayIndex]);
};
/**
* phoneFormats
*
* @method faker.phone.phoneFormats
*/
self.phoneFormats = function () {
return faker.random.arrayElement(faker.definitions.phone_number.formats);
};
return self;
};
module['exports'] = Phone;
},{}],167:[function(require,module,exports){
var mersenne = require('../vendor/mersenne');
/**
*
* @namespace faker.random
*/
function Random (faker, seed) {
// Use a user provided seed if it exists
if (seed) {
if (Array.isArray(seed) && seed.length) {
mersenne.seed_array(seed);
}
else {
mersenne.seed(seed);
}
}
/**
* returns a single random number based on a max number or range
*
* @method faker.random.number
* @param {mixed} options
*/
this.number = function (options) {
if (typeof options === "number") {
options = {
max: options
};
}
options = options || {};
if (typeof options.min === "undefined") {
options.min = 0;
}
if (typeof options.max === "undefined") {
options.max = 99999;
}
if (typeof options.precision === "undefined") {
options.precision = 1;
}
// Make the range inclusive of the max value
var max = options.max;
if (max >= 0) {
max += options.precision;
}
var randomNumber = options.precision * Math.floor(
mersenne.rand(max / options.precision, options.min / options.precision));
return randomNumber;
}
/**
* takes an array and returns a random element of the array
*
* @method faker.random.arrayElement
* @param {array} array
*/
this.arrayElement = function (array) {
array = array || ["a", "b", "c"];
var r = faker.random.number({ max: array.length - 1 });
return array[r];
}
/**
* takes an object and returns the randomly key or value
*
* @method faker.random.objectElement
* @param {object} object
* @param {mixed} field
*/
this.objectElement = function (object, field) {
object = object || { "foo": "bar", "too": "car" };
var array = Object.keys(object);
var key = faker.random.arrayElement(array);
return field === "key" ? key : object[key];
}
/**
* uuid
*
* @method faker.random.uuid
*/
this.uuid = function () {
var self = this;
var RFC4122_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
var replacePlaceholders = function (placeholder) {
var random = self.number({ min: 0, max: 15 });
var value = placeholder == 'x' ? random : (random &0x3 | 0x8);
return value.toString(16);
};
return RFC4122_TEMPLATE.replace(/[xy]/g, replacePlaceholders);
}
/**
* boolean
*
* @method faker.random.boolean
*/
this.boolean = function () {
return !!faker.random.number(1)
}
// TODO: have ability to return specific type of word? As in: noun, adjective, verb, etc
/**
* word
*
* @method faker.random.word
* @param {string} type
*/
this.word = function randomWord (type) {
var wordMethods = [
'commerce.department',
'commerce.productName',
'commerce.productAdjective',
'commerce.productMaterial',
'commerce.product',
'commerce.color',
'company.catchPhraseAdjective',
'company.catchPhraseDescriptor',
'company.catchPhraseNoun',
'company.bsAdjective',
'company.bsBuzz',
'company.bsNoun',
'address.streetSuffix',
'address.county',
'address.country',
'address.state',
'finance.accountName',
'finance.transactionType',
'finance.currencyName',
'hacker.noun',
'hacker.verb',
'hacker.adjective',
'hacker.ingverb',
'hacker.abbreviation',
'name.jobDescriptor',
'name.jobArea',
'name.jobType'];
// randomly pick from the many faker methods that can generate words
var randomWordMethod = faker.random.arrayElement(wordMethods);
return faker.fake('{{' + randomWordMethod + '}}');
}
/**
* randomWords
*
* @method faker.random.words
* @param {number} count defaults to a random value between 1 and 3
*/
this.words = function randomWords (count) {
var words = [];
if (typeof count === "undefined") {
count = faker.random.number({min:1, max: 3});
}
for (var i = 0; i<count; i++) {
words.push(faker.random.word());
}
return words.join(' ');
}
/**
* locale
*
* @method faker.random.image
*/
this.image = function randomImage () {
return faker.image.image();
}
/**
* locale
*
* @method faker.random.locale
*/
this.locale = function randomLocale () {
return faker.random.arrayElement(Object.keys(faker.locales));
};
/**
* alphaNumeric
*
* @method faker.random.alphaNumeric
*/
this.alphaNumeric = function alphaNumeric() {
return faker.random.arrayElement(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]);
}
return this;
}
module['exports'] = Random;
},{"../vendor/mersenne":170}],168:[function(require,module,exports){
// generates fake data for many computer systems properties
/**
*
* @namespace faker.system
*/
function System (faker) {
/**
* generates a file name with extension or optional type
*
* @method faker.system.fileName
* @param {string} ext
* @param {string} type
*/
this.fileName = function (ext, type) {
var str = faker.fake("{{random.words}}.{{system.fileExt}}");
str = str.replace(/ /g, '_');
str = str.replace(/\,/g, '_');
str = str.replace(/\-/g, '_');
str = str.replace(/\\/g, '_');
str = str.toLowerCase();
return str;
};
/**
* commonFileName
*
* @method faker.system.commonFileName
* @param {string} ext
* @param {string} type
*/
this.commonFileName = function (ext, type) {
var str = faker.random.words() + "." + (ext || faker.system.commonFileExt());
str = str.replace(/ /g, '_');
str = str.replace(/\,/g, '_');
str = str.replace(/\-/g, '_');
str = str.replace(/\\/g, '_');
str = str.toLowerCase();
return str;
};
/**
* mimeType
*
* @method faker.system.mimeType
*/
this.mimeType = function () {
return faker.random.arrayElement(Object.keys(faker.definitions.system.mimeTypes));
};
/**
* returns a commonly used file type
*
* @method faker.system.commonFileType
*/
this.commonFileType = function () {
var types = ['video', 'audio', 'image', 'text', 'application'];
return faker.random.arrayElement(types)
};
/**
* returns a commonly used file extension based on optional type
*
* @method faker.system.commonFileExt
* @param {string} type
*/
this.commonFileExt = function (type) {
var types = [
'application/pdf',
'audio/mpeg',
'audio/wav',
'image/png',
'image/jpeg',
'image/gif',
'video/mp4',
'video/mpeg',
'text/html'
];
return faker.system.fileExt(faker.random.arrayElement(types));
};
/**
* returns any file type available as mime-type
*
* @method faker.system.fileType
*/
this.fileType = function () {
var types = [];
var mimes = faker.definitions.system.mimeTypes;
Object.keys(mimes).forEach(function(m){
var parts = m.split('/');
if (types.indexOf(parts[0]) === -1) {
types.push(parts[0]);
}
});
return faker.random.arrayElement(types);
};
/**
* fileExt
*
* @method faker.system.fileExt
* @param {string} mimeType
*/
this.fileExt = function (mimeType) {
var exts = [];
var mimes = faker.definitions.system.mimeTypes;
// get specific ext by mime-type
if (typeof mimes[mimeType] === "object") {
return faker.random.arrayElement(mimes[mimeType].extensions);
}
// reduce mime-types to those with file-extensions
Object.keys(mimes).forEach(function(m){
if (mimes[m].extensions instanceof Array) {
mimes[m].extensions.forEach(function(ext){
exts.push(ext)
});
}
});
return faker.random.arrayElement(exts);
};
/**
* not yet implemented
*
* @method faker.system.directoryPath
*/
this.directoryPath = function () {
// TODO
};
/**
* not yet implemented
*
* @method faker.system.filePath
*/
this.filePath = function () {
// TODO
};
/**
* semver
*
* @method faker.system.semver
*/
this.semver = function () {
return [faker.random.number(9),
faker.random.number(9),
faker.random.number(9)].join('.');
}
}
module['exports'] = System;
},{}],169:[function(require,module,exports){
var Faker = require('../lib');
var faker = new Faker({ locale: 'id_ID', localeFallback: 'en' });
faker.locales['id_ID'] = require('../lib/locales/id_ID');
faker.locales['en'] = require('../lib/locales/en');
module['exports'] = faker;
},{"../lib":43,"../lib/locales/en":110,"../lib/locales/id_ID":150}],170:[function(require,module,exports){
// this program is a JavaScript version of Mersenne Twister, with concealment and encapsulation in class,
// an almost straight conversion from the original program, mt19937ar.c,
// translated by y. okada on July 17, 2006.
// and modified a little at july 20, 2006, but there are not any substantial differences.
// in this program, procedure descriptions and comments of original source code were not removed.
// lines commented with //c// were originally descriptions of c procedure. and a few following lines are appropriate JavaScript descriptions.
// lines commented with /* and */ are original comments.
// lines commented with // are additional comments in this JavaScript version.
// before using this version, create at least one instance of MersenneTwister19937 class, and initialize the each state, given below in c comments, of all the instances.
/*
A C-program for MT19937, with initialization improved 2002/1/26.
Coded by Takuji Nishimura and Makoto Matsumoto.
Before using, initialize the state by using init_genrand(seed)
or init_by_array(init_key, key_length).
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Any feedback is very welcome.
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
*/
function MersenneTwister19937()
{
/* constants should be scoped inside the class */
var N, M, MATRIX_A, UPPER_MASK, LOWER_MASK;
/* Period parameters */
//c//#define N 624
//c//#define M 397
//c//#define MATRIX_A 0x9908b0dfUL /* constant vector a */
//c//#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
//c//#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
N = 624;
M = 397;
MATRIX_A = 0x9908b0df; /* constant vector a */
UPPER_MASK = 0x80000000; /* most significant w-r bits */
LOWER_MASK = 0x7fffffff; /* least significant r bits */
//c//static unsigned long mt[N]; /* the array for the state vector */
//c//static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */
var mt = new Array(N); /* the array for the state vector */
var mti = N+1; /* mti==N+1 means mt[N] is not initialized */
function unsigned32 (n1) // returns a 32-bits unsiged integer from an operand to which applied a bit operator.
{
return n1 < 0 ? (n1 ^ UPPER_MASK) + UPPER_MASK : n1;
}
function subtraction32 (n1, n2) // emulates lowerflow of a c 32-bits unsiged integer variable, instead of the operator -. these both arguments must be non-negative integers expressible using unsigned 32 bits.
{
return n1 < n2 ? unsigned32((0x100000000 - (n2 - n1)) & 0xffffffff) : n1 - n2;
}
function addition32 (n1, n2) // emulates overflow of a c 32-bits unsiged integer variable, instead of the operator +. these both arguments must be non-negative integers expressible using unsigned 32 bits.
{
return unsigned32((n1 + n2) & 0xffffffff)
}
function multiplication32 (n1, n2) // emulates overflow of a c 32-bits unsiged integer variable, instead of the operator *. these both arguments must be non-negative integers expressible using unsigned 32 bits.
{
var sum = 0;
for (var i = 0; i < 32; ++i){
if ((n1 >>> i) & 0x1){
sum = addition32(sum, unsigned32(n2 << i));
}
}
return sum;
}
/* initializes mt[N] with a seed */
//c//void init_genrand(unsigned long s)
this.init_genrand = function (s)
{
//c//mt[0]= s & 0xffffffff;
mt[0]= unsigned32(s & 0xffffffff);
for (mti=1; mti<N; mti++) {
mt[mti] =
//c//(1812433253 * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
addition32(multiplication32(1812433253, unsigned32(mt[mti-1] ^ (mt[mti-1] >>> 30))), mti);
/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
/* In the previous versions, MSBs of the seed affect */
/* only MSBs of the array mt[]. */
/* 2002/01/09 modified by Makoto Matsumoto */
//c//mt[mti] &= 0xffffffff;
mt[mti] = unsigned32(mt[mti] & 0xffffffff);
/* for >32 bit machines */
}
}
/* initialize by an array with array-length */
/* init_key is the array for initializing keys */
/* key_length is its length */
/* slight change for C++, 2004/2/26 */
//c//void init_by_array(unsigned long init_key[], int key_length)
this.init_by_array = function (init_key, key_length)
{
//c//int i, j, k;
var i, j, k;
//c//init_genrand(19650218);
this.init_genrand(19650218);
i=1; j=0;
k = (N>key_length ? N : key_length);
for (; k; k--) {
//c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525))
//c// + init_key[j] + j; /* non linear */
mt[i] = addition32(addition32(unsigned32(mt[i] ^ multiplication32(unsigned32(mt[i-1] ^ (mt[i-1] >>> 30)), 1664525)), init_key[j]), j);
mt[i] =
//c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */
unsigned32(mt[i] & 0xffffffff);
i++; j++;
if (i>=N) { mt[0] = mt[N-1]; i=1; }
if (j>=key_length) j=0;
}
for (k=N-1; k; k--) {
//c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941))
//c//- i; /* non linear */
mt[i] = subtraction32(unsigned32((dbg=mt[i]) ^ multiplication32(unsigned32(mt[i-1] ^ (mt[i-1] >>> 30)), 1566083941)), i);
//c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */
mt[i] = unsigned32(mt[i] & 0xffffffff);
i++;
if (i>=N) { mt[0] = mt[N-1]; i=1; }
}
mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */
}
/* moved outside of genrand_int32() by jwatte 2010-11-17; generate less garbage */
var mag01 = [0x0, MATRIX_A];
/* generates a random number on [0,0xffffffff]-interval */
//c//unsigned long genrand_int32(void)
this.genrand_int32 = function ()
{
//c//unsigned long y;
//c//static unsigned long mag01[2]={0x0UL, MATRIX_A};
var y;
/* mag01[x] = x * MATRIX_A for x=0,1 */
if (mti >= N) { /* generate N words at one time */
//c//int kk;
var kk;
if (mti == N+1) /* if init_genrand() has not been called, */
//c//init_genrand(5489); /* a default initial seed is used */
this.init_genrand(5489); /* a default initial seed is used */
for (kk=0;kk<N-M;kk++) {
//c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
//c//mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];
y = unsigned32((mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK));
mt[kk] = unsigned32(mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1]);
}
for (;kk<N-1;kk++) {
//c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
//c//mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1];
y = unsigned32((mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK));
mt[kk] = unsigned32(mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1]);
}
//c//y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
//c//mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1];
y = unsigned32((mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK));
mt[N-1] = unsigned32(mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1]);
mti = 0;
}
y = mt[mti++];
/* Tempering */
//c//y ^= (y >> 11);
//c//y ^= (y << 7) & 0x9d2c5680;
//c//y ^= (y << 15) & 0xefc60000;
//c//y ^= (y >> 18);
y = unsigned32(y ^ (y >>> 11));
y = unsigned32(y ^ ((y << 7) & 0x9d2c5680));
y = unsigned32(y ^ ((y << 15) & 0xefc60000));
y = unsigned32(y ^ (y >>> 18));
return y;
}
/* generates a random number on [0,0x7fffffff]-interval */
//c//long genrand_int31(void)
this.genrand_int31 = function ()
{
//c//return (genrand_int32()>>1);
return (this.genrand_int32()>>>1);
}
/* generates a random number on [0,1]-real-interval */
//c//double genrand_real1(void)
this.genrand_real1 = function ()
{
//c//return genrand_int32()*(1.0/4294967295.0);
return this.genrand_int32()*(1.0/4294967295.0);
/* divided by 2^32-1 */
}
/* generates a random number on [0,1)-real-interval */
//c//double genrand_real2(void)
this.genrand_real2 = function ()
{
//c//return genrand_int32()*(1.0/4294967296.0);
return this.genrand_int32()*(1.0/4294967296.0);
/* divided by 2^32 */
}
/* generates a random number on (0,1)-real-interval */
//c//double genrand_real3(void)
this.genrand_real3 = function ()
{
//c//return ((genrand_int32()) + 0.5)*(1.0/4294967296.0);
return ((this.genrand_int32()) + 0.5)*(1.0/4294967296.0);
/* divided by 2^32 */
}
/* generates a random number on [0,1) with 53-bit resolution*/
//c//double genrand_res53(void)
this.genrand_res53 = function ()
{
//c//unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
var a=this.genrand_int32()>>>5, b=this.genrand_int32()>>>6;
return(a*67108864.0+b)*(1.0/9007199254740992.0);
}
/* These real versions are due to Isaku Wada, 2002/01/09 added */
}
// Exports: Public API
// Export the twister class
exports.MersenneTwister19937 = MersenneTwister19937;
// Export a simplified function to generate random numbers
var gen = new MersenneTwister19937;
gen.init_genrand((new Date).getTime() % 1000000000);
// Added max, min range functionality, Marak Squires Sept 11 2014
exports.rand = function(max, min) {
if (max === undefined)
{
min = 0;
max = 32768;
}
return Math.floor(gen.genrand_real2() * (max - min) + min);
}
exports.seed = function(S) {
if (typeof(S) != 'number')
{
throw new Error("seed(S) must take numeric argument; is " + typeof(S));
}
gen.init_genrand(S);
}
exports.seed_array = function(A) {
if (typeof(A) != 'object')
{
throw new Error("seed_array(A) must take array of numbers; is " + typeof(A));
}
gen.init_by_array(A);
}
},{}],171:[function(require,module,exports){
/*
* password-generator
* Copyright(c) 2011-2013 Bermi Ferrer <[email protected]>
* MIT Licensed
*/
(function (root) {
var localName, consonant, letter, password, vowel;
letter = /[a-zA-Z]$/;
vowel = /[aeiouAEIOU]$/;
consonant = /[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]$/;
// Defines the name of the local variable the passwordGenerator library will use
// this is specially useful if window.passwordGenerator is already being used
// by your application and you want a different name. For example:
// // Declare before including the passwordGenerator library
// var localPasswordGeneratorLibraryName = 'pass';
localName = root.localPasswordGeneratorLibraryName || "generatePassword",
password = function (length, memorable, pattern, prefix) {
var char, n;
if (length == null) {
length = 10;
}
if (memorable == null) {
memorable = true;
}
if (pattern == null) {
pattern = /\w/;
}
if (prefix == null) {
prefix = '';
}
if (prefix.length >= length) {
return prefix;
}
if (memorable) {
if (prefix.match(consonant)) {
pattern = vowel;
} else {
pattern = consonant;
}
}
n = Math.floor(Math.random() * 94) + 33;
char = String.fromCharCode(n);
if (memorable) {
char = char.toLowerCase();
}
if (!char.match(pattern)) {
return password(length, memorable, pattern, prefix);
}
return password(length, memorable, pattern, "" + prefix + char);
};
((typeof exports !== 'undefined') ? exports : root)[localName] = password;
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
module.exports = password;
}
}
// Establish the root object, `window` in the browser, or `global` on the server.
}(this));
},{}],172:[function(require,module,exports){
/*
Copyright (c) 2012-2014 Jeffrey Mealo
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.
------------------------------------------------------------------------------------------------------------------------
Based loosely on Luka Pusic's PHP Script: http://360percents.com/posts/php-random-user-agent-generator/
The license for that script is as follows:
"THE BEER-WARE LICENSE" (Revision 42):
<[email protected]> wrote this file. As long as you retain this notice you can do whatever you want with this stuff.
If we meet some day, and you think this stuff is worth it, you can buy me a beer in return. Luka Pusic
*/
function rnd(a, b) {
//calling rnd() with no arguments is identical to rnd(0, 100)
a = a || 0;
b = b || 100;
if (typeof b === 'number' && typeof a === 'number') {
//rnd(int min, int max) returns integer between min, max
return (function (min, max) {
if (min > max) {
throw new RangeError('expected min <= max; got min = ' + min + ', max = ' + max);
}
return Math.floor(Math.random() * (max - min + 1)) + min;
}(a, b));
}
if (Object.prototype.toString.call(a) === "[object Array]") {
//returns a random element from array (a), even weighting
return a[Math.floor(Math.random() * a.length)];
}
if (a && typeof a === 'object') {
//returns a random key from the passed object; keys are weighted by the decimal probability in their value
return (function (obj) {
var rand = rnd(0, 100) / 100, min = 0, max = 0, key, return_val;
for (key in obj) {
if (obj.hasOwnProperty(key)) {
max = obj[key] + min;
return_val = key;
if (rand >= min && rand <= max) {
break;
}
min = min + obj[key];
}
}
return return_val;
}(a));
}
throw new TypeError('Invalid arguments passed to rnd. (' + (b ? a + ', ' + b : a) + ')');
}
function randomLang() {
return rnd(['AB', 'AF', 'AN', 'AR', 'AS', 'AZ', 'BE', 'BG', 'BN', 'BO', 'BR', 'BS', 'CA', 'CE', 'CO', 'CS',
'CU', 'CY', 'DA', 'DE', 'EL', 'EN', 'EO', 'ES', 'ET', 'EU', 'FA', 'FI', 'FJ', 'FO', 'FR', 'FY',
'GA', 'GD', 'GL', 'GV', 'HE', 'HI', 'HR', 'HT', 'HU', 'HY', 'ID', 'IS', 'IT', 'JA', 'JV', 'KA',
'KG', 'KO', 'KU', 'KW', 'KY', 'LA', 'LB', 'LI', 'LN', 'LT', 'LV', 'MG', 'MK', 'MN', 'MO', 'MS',
'MT', 'MY', 'NB', 'NE', 'NL', 'NN', 'NO', 'OC', 'PL', 'PT', 'RM', 'RO', 'RU', 'SC', 'SE', 'SK',
'SL', 'SO', 'SQ', 'SR', 'SV', 'SW', 'TK', 'TR', 'TY', 'UK', 'UR', 'UZ', 'VI', 'VO', 'YI', 'ZH']);
}
function randomBrowserAndOS() {
var browser = rnd({
chrome: .45132810566,
iexplorer: .27477061836,
firefox: .19384170608,
safari: .06186781118,
opera: .01574236955
}),
os = {
chrome: {win: .89, mac: .09 , lin: .02},
firefox: {win: .83, mac: .16, lin: .01},
opera: {win: .91, mac: .03 , lin: .06},
safari: {win: .04 , mac: .96 },
iexplorer: ['win']
};
return [browser, rnd(os[browser])];
}
function randomProc(arch) {
var procs = {
lin:['i686', 'x86_64'],
mac: {'Intel' : .48, 'PPC': .01, 'U; Intel':.48, 'U; PPC' :.01},
win:['', 'WOW64', 'Win64; x64']
};
return rnd(procs[arch]);
}
function randomRevision(dots) {
var return_val = '';
//generate a random revision
//dots = 2 returns .x.y where x & y are between 0 and 9
for (var x = 0; x < dots; x++) {
return_val += '.' + rnd(0, 9);
}
return return_val;
}
var version_string = {
net: function () {
return [rnd(1, 4), rnd(0, 9), rnd(10000, 99999), rnd(0, 9)].join('.');
},
nt: function () {
return rnd(5, 6) + '.' + rnd(0, 3);
},
ie: function () {
return rnd(7, 11);
},
trident: function () {
return rnd(3, 7) + '.' + rnd(0, 1);
},
osx: function (delim) {
return [10, rnd(5, 10), rnd(0, 9)].join(delim || '.');
},
chrome: function () {
return [rnd(13, 39), 0, rnd(800, 899), 0].join('.');
},
presto: function () {
return '2.9.' + rnd(160, 190);
},
presto2: function () {
return rnd(10, 12) + '.00';
},
safari: function () {
return rnd(531, 538) + '.' + rnd(0, 2) + '.' + rnd(0,2);
}
};
var browser = {
firefox: function firefox(arch) {
//https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference
var firefox_ver = rnd(5, 15) + randomRevision(2),
gecko_ver = 'Gecko/20100101 Firefox/' + firefox_ver,
proc = randomProc(arch),
os_ver = (arch === 'win') ? '(Windows NT ' + version_string.nt() + ((proc) ? '; ' + proc : '')
: (arch === 'mac') ? '(Macintosh; ' + proc + ' Mac OS X ' + version_string.osx()
: '(X11; Linux ' + proc;
return 'Mozilla/5.0 ' + os_ver + '; rv:' + firefox_ver.slice(0, -2) + ') ' + gecko_ver;
},
iexplorer: function iexplorer() {
var ver = version_string.ie();
if (ver >= 11) {
//http://msdn.microsoft.com/en-us/library/ie/hh869301(v=vs.85).aspx
return 'Mozilla/5.0 (Windows NT 6.' + rnd(1,3) + '; Trident/7.0; ' + rnd(['Touch; ', '']) + 'rv:11.0) like Gecko';
}
//http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx
return 'Mozilla/5.0 (compatible; MSIE ' + ver + '.0; Windows NT ' + version_string.nt() + '; Trident/' +
version_string.trident() + ((rnd(0, 1) === 1) ? '; .NET CLR ' + version_string.net() : '') + ')';
},
opera: function opera(arch) {
//http://www.opera.com/docs/history/
var presto_ver = ' Presto/' + version_string.presto() + ' Version/' + version_string.presto2() + ')',
os_ver = (arch === 'win') ? '(Windows NT ' + version_string.nt() + '; U; ' + randomLang() + presto_ver
: (arch === 'lin') ? '(X11; Linux ' + randomProc(arch) + '; U; ' + randomLang() + presto_ver
: '(Macintosh; Intel Mac OS X ' + version_string.osx() + ' U; ' + randomLang() + ' Presto/' +
version_string.presto() + ' Version/' + version_string.presto2() + ')';
return 'Opera/' + rnd(9, 14) + '.' + rnd(0, 99) + ' ' + os_ver;
},
safari: function safari(arch) {
var safari = version_string.safari(),
ver = rnd(4, 7) + '.' + rnd(0,1) + '.' + rnd(0,10),
os_ver = (arch === 'mac') ? '(Macintosh; ' + randomProc('mac') + ' Mac OS X '+ version_string.osx('_') + ' rv:' + rnd(2, 6) + '.0; '+ randomLang() + ') '
: '(Windows; U; Windows NT ' + version_string.nt() + ')';
return 'Mozilla/5.0 ' + os_ver + 'AppleWebKit/' + safari + ' (KHTML, like Gecko) Version/' + ver + ' Safari/' + safari;
},
chrome: function chrome(arch) {
var safari = version_string.safari(),
os_ver = (arch === 'mac') ? '(Macintosh; ' + randomProc('mac') + ' Mac OS X ' + version_string.osx('_') + ') '
: (arch === 'win') ? '(Windows; U; Windows NT ' + version_string.nt() + ')'
: '(X11; Linux ' + randomProc(arch);
return 'Mozilla/5.0 ' + os_ver + ' AppleWebKit/' + safari + ' (KHTML, like Gecko) Chrome/' + version_string.chrome() + ' Safari/' + safari;
}
};
exports.generate = function generate() {
var random = randomBrowserAndOS();
return browser[random[0]](random[1]);
};
},{}],173:[function(require,module,exports){
var ret = require('ret');
var DRange = require('discontinuous-range');
var types = ret.types;
/**
* If code is alphabetic, converts to other case.
* If not alphabetic, returns back code.
*
* @param {Number} code
* @return {Number}
*/
function toOtherCase(code) {
return code + (97 <= code && code <= 122 ? -32 :
65 <= code && code <= 90 ? 32 : 0);
}
/**
* Randomly returns a true or false value.
*
* @return {Boolean}
*/
function randBool() {
return !this.randInt(0, 1);
}
/**
* Randomly selects and returns a value from the array.
*
* @param {Array.<Object>} arr
* @return {Object}
*/
function randSelect(arr) {
if (arr instanceof DRange) {
return arr.index(this.randInt(0, arr.length - 1));
}
return arr[this.randInt(0, arr.length - 1)];
}
/**
* expands a token to a DiscontinuousRange of characters which has a
* length and an index function (for random selecting)
*
* @param {Object} token
* @return {DiscontinuousRange}
*/
function expand(token) {
if (token.type === ret.types.CHAR) return new DRange(token.value);
if (token.type === ret.types.RANGE) return new DRange(token.from, token.to);
if (token.type === ret.types.SET) {
var drange = new DRange();
for (var i = 0; i < token.set.length; i++) {
var subrange = expand.call(this, token.set[i]);
drange.add(subrange);
if (this.ignoreCase) {
for (var j = 0; j < subrange.length; j++) {
var code = subrange.index(j);
var otherCaseCode = toOtherCase(code);
if (code !== otherCaseCode) {
drange.add(otherCaseCode);
}
}
}
}
if (token.not) {
return this.defaultRange.clone().subtract(drange);
} else {
return drange;
}
}
throw new Error('unexpandable token type: ' + token.type);
}
/**
* @constructor
* @param {RegExp|String} regexp
* @param {String} m
*/
var RandExp = module.exports = function(regexp, m) {
this.defaultRange = this.defaultRange.clone();
if (regexp instanceof RegExp) {
this.ignoreCase = regexp.ignoreCase;
this.multiline = regexp.multiline;
if (typeof regexp.max === 'number') {
this.max = regexp.max;
}
regexp = regexp.source;
} else if (typeof regexp === 'string') {
this.ignoreCase = m && m.indexOf('i') !== -1;
this.multiline = m && m.indexOf('m') !== -1;
} else {
throw new Error('Expected a regexp or string');
}
this.tokens = ret(regexp);
};
// When a repetitional token has its max set to Infinite,
// randexp won't actually generate a random amount between min and Infinite
// instead it will see Infinite as min + 100.
RandExp.prototype.max = 100;
// Generates the random string.
RandExp.prototype.gen = function() {
return gen.call(this, this.tokens, []);
};
// Enables use of randexp with a shorter call.
RandExp.randexp = function(regexp, m) {
var randexp;
if (regexp._randexp === undefined) {
randexp = new RandExp(regexp, m);
regexp._randexp = randexp;
} else {
randexp = regexp._randexp;
if (typeof regexp.max === 'number') {
randexp.max = regexp.max;
}
if (regexp.defaultRange instanceof DRange) {
randexp.defaultRange = regexp.defaultRange;
}
if (typeof regexp.randInt === 'function') {
randexp.randInt = regexp.randInt;
}
}
return randexp.gen();
};
// This enables sugary /regexp/.gen syntax.
RandExp.sugar = function() {
/* jshint freeze:false */
RegExp.prototype.gen = function() {
return RandExp.randexp(this);
};
};
// This allows expanding to include additional characters
// for instance: RandExp.defaultRange.add(0, 65535);
RandExp.prototype.defaultRange = new DRange(32, 126);
/**
* Randomly generates and returns a number between a and b (inclusive).
*
* @param {Number} a
* @param {Number} b
* @return {Number}
*/
RandExp.prototype.randInt = function(a, b) {
return a + Math.floor(Math.random() * (1 + b - a));
};
/**
* Generate random string modeled after given tokens.
*
* @param {Object} token
* @param {Array.<String>} groups
* @return {String}
*/
function gen(token, groups) {
var stack, str, n, i, l;
switch (token.type) {
case types.ROOT:
case types.GROUP:
if (token.notFollowedBy) { return ''; }
// Insert placeholder until group string is generated.
if (token.remember && token.groupNumber === undefined) {
token.groupNumber = groups.push(null) - 1;
}
stack = token.options ?
randSelect.call(this, token.options) : token.stack;
str = '';
for (i = 0, l = stack.length; i < l; i++) {
str += gen.call(this, stack[i], groups);
}
if (token.remember) {
groups[token.groupNumber] = str;
}
return str;
case types.POSITION:
// Do nothing for now.
return '';
case types.SET:
var expanded_set = expand.call(this, token);
if (!expanded_set.length) return '';
return String.fromCharCode(randSelect.call(this, expanded_set));
case types.REPETITION:
// Randomly generate number between min and max.
n = this.randInt(token.min,
token.max === Infinity ? token.min + this.max : token.max);
str = '';
for (i = 0; i < n; i++) {
str += gen.call(this, token.value, groups);
}
return str;
case types.REFERENCE:
return groups[token.value - 1] || '';
case types.CHAR:
var code = this.ignoreCase && randBool.call(this) ?
toOtherCase(token.value) : token.value;
return String.fromCharCode(code);
}
}
},{"discontinuous-range":174,"ret":175}],174:[function(require,module,exports){
//protected helper class
function _SubRange(low, high) {
this.low = low;
this.high = high;
this.length = 1 + high - low;
}
_SubRange.prototype.overlaps = function (range) {
return !(this.high < range.low || this.low > range.high);
};
_SubRange.prototype.touches = function (range) {
return !(this.high + 1 < range.low || this.low - 1 > range.high);
};
//returns inclusive combination of _SubRanges as a _SubRange
_SubRange.prototype.add = function (range) {
return this.touches(range) && new _SubRange(Math.min(this.low, range.low), Math.max(this.high, range.high));
};
//returns subtraction of _SubRanges as an array of _SubRanges (there's a case where subtraction divides it in 2)
_SubRange.prototype.subtract = function (range) {
if (!this.overlaps(range)) return false;
if (range.low <= this.low && range.high >= this.high) return [];
if (range.low > this.low && range.high < this.high) return [new _SubRange(this.low, range.low - 1), new _SubRange(range.high + 1, this.high)];
if (range.low <= this.low) return [new _SubRange(range.high + 1, this.high)];
return [new _SubRange(this.low, range.low - 1)];
};
_SubRange.prototype.toString = function () {
if (this.low == this.high) return this.low.toString();
return this.low + '-' + this.high;
};
_SubRange.prototype.clone = function () {
return new _SubRange(this.low, this.high);
};
function DiscontinuousRange(a, b) {
if (this instanceof DiscontinuousRange) {
this.ranges = [];
this.length = 0;
if (a !== undefined) this.add(a, b);
} else {
return new DiscontinuousRange(a, b);
}
}
function _update_length(self) {
self.length = self.ranges.reduce(function (previous, range) {return previous + range.length}, 0);
}
DiscontinuousRange.prototype.add = function (a, b) {
var self = this;
function _add(subrange) {
var new_ranges = [];
var i = 0;
while (i < self.ranges.length && !subrange.touches(self.ranges[i])) {
new_ranges.push(self.ranges[i].clone());
i++;
}
while (i < self.ranges.length && subrange.touches(self.ranges[i])) {
subrange = subrange.add(self.ranges[i]);
i++;
}
new_ranges.push(subrange);
while (i < self.ranges.length) {
new_ranges.push(self.ranges[i].clone());
i++;
}
self.ranges = new_ranges;
_update_length(self);
}
if (a instanceof DiscontinuousRange) {
a.ranges.forEach(_add);
} else {
if (a instanceof _SubRange) {
_add(a);
} else {
if (b === undefined) b = a;
_add(new _SubRange(a, b));
}
}
return this;
};
DiscontinuousRange.prototype.subtract = function (a, b) {
var self = this;
function _subtract(subrange) {
var new_ranges = [];
var i = 0;
while (i < self.ranges.length && !subrange.overlaps(self.ranges[i])) {
new_ranges.push(self.ranges[i].clone());
i++;
}
while (i < self.ranges.length && subrange.overlaps(self.ranges[i])) {
new_ranges = new_ranges.concat(self.ranges[i].subtract(subrange));
i++;
}
while (i < self.ranges.length) {
new_ranges.push(self.ranges[i].clone());
i++;
}
self.ranges = new_ranges;
_update_length(self);
}
if (a instanceof DiscontinuousRange) {
a.ranges.forEach(_subtract);
} else {
if (a instanceof _SubRange) {
_subtract(a);
} else {
if (b === undefined) b = a;
_subtract(new _SubRange(a, b));
}
}
return this;
};
DiscontinuousRange.prototype.index = function (index) {
var i = 0;
while (i < this.ranges.length && this.ranges[i].length <= index) {
index -= this.ranges[i].length;
i++;
}
if (i >= this.ranges.length) return null;
return this.ranges[i].low + index;
};
DiscontinuousRange.prototype.toString = function () {
return '[ ' + this.ranges.join(', ') + ' ]'
};
DiscontinuousRange.prototype.clone = function () {
return new DiscontinuousRange(this);
};
module.exports = DiscontinuousRange;
},{}],175:[function(require,module,exports){
var util = require('./util');
var types = require('./types');
var sets = require('./sets');
var positions = require('./positions');
module.exports = function(regexpStr) {
var i = 0, l, c,
start = { type: types.ROOT, stack: []},
// Keep track of last clause/group and stack.
lastGroup = start,
last = start.stack,
groupStack = [];
var repeatErr = function(i) {
util.error(regexpStr, 'Nothing to repeat at column ' + (i - 1));
};
// Decode a few escaped characters.
var str = util.strToChars(regexpStr);
l = str.length;
// Iterate through each character in string.
while (i < l) {
c = str[i++];
switch (c) {
// Handle escaped characters, inclues a few sets.
case '\\':
c = str[i++];
switch (c) {
case 'b':
last.push(positions.wordBoundary());
break;
case 'B':
last.push(positions.nonWordBoundary());
break;
case 'w':
last.push(sets.words());
break;
case 'W':
last.push(sets.notWords());
break;
case 'd':
last.push(sets.ints());
break;
case 'D':
last.push(sets.notInts());
break;
case 's':
last.push(sets.whitespace());
break;
case 'S':
last.push(sets.notWhitespace());
break;
default:
// Check if c is integer.
// In which case it's a reference.
if (/\d/.test(c)) {
last.push({ type: types.REFERENCE, value: parseInt(c, 10) });
// Escaped character.
} else {
last.push({ type: types.CHAR, value: c.charCodeAt(0) });
}
}
break;
// Positionals.
case '^':
last.push(positions.begin());
break;
case '$':
last.push(positions.end());
break;
// Handle custom sets.
case '[':
// Check if this class is 'anti' i.e. [^abc].
var not;
if (str[i] === '^') {
not = true;
i++;
} else {
not = false;
}
// Get all the characters in class.
var classTokens = util.tokenizeClass(str.slice(i), regexpStr);
// Increase index by length of class.
i += classTokens[1];
last.push({
type: types.SET
, set: classTokens[0]
, not: not
});
break;
// Class of any character except \n.
case '.':
last.push(sets.anyChar());
break;
// Push group onto stack.
case '(':
// Create group.
var group = {
type: types.GROUP
, stack: []
, remember: true
};
c = str[i];
// if if this is a special kind of group.
if (c === '?') {
c = str[i + 1];
i += 2;
// Match if followed by.
if (c === '=') {
group.followedBy = true;
// Match if not followed by.
} else if (c === '!') {
group.notFollowedBy = true;
} else if (c !== ':') {
util.error(regexpStr,
'Invalid group, character \'' + c + '\' after \'?\' at column ' +
(i - 1));
}
group.remember = false;
}
// Insert subgroup into current group stack.
last.push(group);
// Remember the current group for when the group closes.
groupStack.push(lastGroup);
// Make this new group the current group.
lastGroup = group;
last = group.stack;
break;
// Pop group out of stack.
case ')':
if (groupStack.length === 0) {
util.error(regexpStr, 'Unmatched ) at column ' + (i - 1));
}
lastGroup = groupStack.pop();
// Check if this group has a PIPE.
// To get back the correct last stack.
last = lastGroup.options ? lastGroup.options[lastGroup.options.length - 1] : lastGroup.stack;
break;
// Use pipe character to give more choices.
case '|':
// Create array where options are if this is the first PIPE
// in this clause.
if (!lastGroup.options) {
lastGroup.options = [lastGroup.stack];
delete lastGroup.stack;
}
// Create a new stack and add to options for rest of clause.
var stack = [];
lastGroup.options.push(stack);
last = stack;
break;
// Repetition.
// For every repetition, remove last element from last stack
// then insert back a RANGE object.
// This design is chosen because there could be more than
// one repetition symbols in a regex i.e. `a?+{2,3}`.
case '{':
var rs = /^(\d+)(,(\d+)?)?\}/.exec(str.slice(i)), min, max;
if (rs !== null) {
min = parseInt(rs[1], 10);
max = rs[2] ? rs[3] ? parseInt(rs[3], 10) : Infinity : min;
i += rs[0].length;
last.push({
type: types.REPETITION
, min: min
, max: max
, value: last.pop()
});
} else {
last.push({
type: types.CHAR
, value: 123
});
}
break;
case '?':
if (last.length === 0) {
repeatErr(i);
}
last.push({
type: types.REPETITION
, min: 0
, max: 1
, value: last.pop()
});
break;
case '+':
if (last.length === 0) {
repeatErr(i);
}
last.push({
type: types.REPETITION
, min: 1
, max: Infinity
, value: last.pop()
});
break;
case '*':
if (last.length === 0) {
repeatErr(i);
}
last.push({
type: types.REPETITION
, min: 0
, max: Infinity
, value: last.pop()
});
break;
// Default is a character that is not `\[](){}?+*^$`.
default:
last.push({
type: types.CHAR
, value: c.charCodeAt(0)
});
}
}
// Check if any groups have not been closed.
if (groupStack.length !== 0) {
util.error(regexpStr, 'Unterminated group');
}
return start;
};
module.exports.types = types;
},{"./positions":176,"./sets":177,"./types":178,"./util":179}],176:[function(require,module,exports){
var types = require('./types');
exports.wordBoundary = function() {
return { type: types.POSITION, value: 'b' };
};
exports.nonWordBoundary = function() {
return { type: types.POSITION, value: 'B' };
};
exports.begin = function() {
return { type: types.POSITION, value: '^' };
};
exports.end = function() {
return { type: types.POSITION, value: '$' };
};
},{"./types":178}],177:[function(require,module,exports){
var types = require('./types');
var INTS = function() {
return [{ type: types.RANGE , from: 48, to: 57 }];
};
var WORDS = function() {
return [
{ type: types.CHAR, value: 95 }
, { type: types.RANGE, from: 97, to: 122 }
, { type: types.RANGE, from: 65, to: 90 }
].concat(INTS());
};
var WHITESPACE = function() {
return [
{ type: types.CHAR, value: 9 }
, { type: types.CHAR, value: 10 }
, { type: types.CHAR, value: 11 }
, { type: types.CHAR, value: 12 }
, { type: types.CHAR, value: 13 }
, { type: types.CHAR, value: 32 }
, { type: types.CHAR, value: 160 }
, { type: types.CHAR, value: 5760 }
, { type: types.CHAR, value: 6158 }
, { type: types.CHAR, value: 8192 }
, { type: types.CHAR, value: 8193 }
, { type: types.CHAR, value: 8194 }
, { type: types.CHAR, value: 8195 }
, { type: types.CHAR, value: 8196 }
, { type: types.CHAR, value: 8197 }
, { type: types.CHAR, value: 8198 }
, { type: types.CHAR, value: 8199 }
, { type: types.CHAR, value: 8200 }
, { type: types.CHAR, value: 8201 }
, { type: types.CHAR, value: 8202 }
, { type: types.CHAR, value: 8232 }
, { type: types.CHAR, value: 8233 }
, { type: types.CHAR, value: 8239 }
, { type: types.CHAR, value: 8287 }
, { type: types.CHAR, value: 12288 }
, { type: types.CHAR, value: 65279 }
];
};
var NOTANYCHAR = function() {
return [
{ type: types.CHAR, value: 10 }
, { type: types.CHAR, value: 13 }
, { type: types.CHAR, value: 8232 }
, { type: types.CHAR, value: 8233 }
];
};
// predefined class objects
exports.words = function() {
return { type: types.SET, set: WORDS(), not: false };
};
exports.notWords = function() {
return { type: types.SET, set: WORDS(), not: true };
};
exports.ints = function() {
return { type: types.SET, set: INTS(), not: false };
};
exports.notInts = function() {
return { type: types.SET, set: INTS(), not: true };
};
exports.whitespace = function() {
return { type: types.SET, set: WHITESPACE(), not: false };
};
exports.notWhitespace = function() {
return { type: types.SET, set: WHITESPACE(), not: true };
};
exports.anyChar = function() {
return { type: types.SET, set: NOTANYCHAR(), not: true };
};
},{"./types":178}],178:[function(require,module,exports){
module.exports = {
ROOT : 0
, GROUP : 1
, POSITION : 2
, SET : 3
, RANGE : 4
, REPETITION : 5
, REFERENCE : 6
, CHAR : 7
};
},{}],179:[function(require,module,exports){
var types = require('./types');
var sets = require('./sets');
// All of these are private and only used by randexp.
// It's assumed that they will always be called with the correct input.
var CTRL = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?';
var SLSH = { '0': 0, 't': 9, 'n': 10, 'v': 11, 'f': 12, 'r': 13 };
/**
* Finds character representations in str and convert all to
* their respective characters
*
* @param {String} str
* @return {String}
*/
exports.strToChars = function(str) {
var chars_regex = /(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z\[\\\]\^?])|([0tnvfr]))/g;
str = str.replace(chars_regex, function(s, b, lbs, a16, b16, c8, dctrl, eslsh) {
if (lbs) {
return s;
}
var code = b ? 8 :
a16 ? parseInt(a16, 16) :
b16 ? parseInt(b16, 16) :
c8 ? parseInt(c8, 8) :
dctrl ? CTRL.indexOf(dctrl) :
eslsh ? SLSH[eslsh] : undefined;
var c = String.fromCharCode(code);
// Escape special regex characters.
if (/[\[\]{}\^$.|?*+()]/.test(c)) {
c = '\\' + c;
}
return c;
});
return str;
};
/**
* turns class into tokens
* reads str until it encounters a ] not preceeded by a \
*
* @param {String} str
* @param {String} regexpStr
* @return {Array.<Array.<Object>, Number>}
*/
exports.tokenizeClass = function(str, regexpStr) {
var tokens = []
, regexp = /\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g
, rs, c
;
while ((rs = regexp.exec(str)) != null) {
if (rs[1]) {
tokens.push(sets.words());
} else if (rs[2]) {
tokens.push(sets.ints());
} else if (rs[3]) {
tokens.push(sets.whitespace());
} else if (rs[4]) {
tokens.push(sets.notWords());
} else if (rs[5]) {
tokens.push(sets.notInts());
} else if (rs[6]) {
tokens.push(sets.notWhitespace());
} else if (rs[7]) {
tokens.push({
type: types.RANGE
, from: (rs[8] || rs[9]).charCodeAt(0)
, to: rs[10].charCodeAt(0)
});
} else if (c = rs[12]) {
tokens.push({
type: types.CHAR
, value: c.charCodeAt(0)
});
} else {
return [tokens, regexp.lastIndex];
}
}
exports.error(regexpStr, 'Unterminated character class');
};
/**
* Shortcut to throw errors.
*
* @param {String} regexp
* @param {String} msg
*/
exports.error = function(regexp, msg) {
throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg);
};
},{"./sets":177,"./types":178}],"json-schema-faker":[function(require,module,exports){
module.exports = require('../lib/')
.extend('faker', function() {
try {
return require('faker/locale/id_ID');
} catch (e) {
return null;
}
});
},{"../lib/":17,"faker/locale/id_ID":169}]},{},["json-schema-faker"])("json-schema-faker")
}); |
module.exports={title:"WebdriverIO",slug:"webdriverio",svg:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>WebdriverIO</title><path d="M1.875 0C0.836 0 0 0.836 0 1.875v20.25C0 23.164 0.836 24 1.875 24h20.25C23.164 24 24 23.164 24 22.125V1.875C24 0.836 23.164 0 22.125 0ZM2.25 6H3V18H2.25ZM9.335 6H10.125L5.29 18H4.499ZM16.125 6c3.314 0 6 2.686 6 6 0 3.314-2.686 6-6 6-3.314 0-6-2.686-6-6 0-3.314 2.686-6 6-6zm0 0.75c-2.899 0-5.25 2.351-5.25 5.25 0 2.899 2.351 5.25 5.25 5.25 2.899 0 5.25-2.351 5.25-5.25 0-2.899-2.351-5.25-5.25-5.25z"/></svg>',get path(){return this.svg.match(/<path\s+d="([^"]*)/)[1]},source:"https://webdriver.io/docs/api/",hex:"EA5906",guidelines:void 0,license:void 0}; |
'use strict';
var partial = require('../../../function/#/partial');
module.exports = {
Left: function (t, a) {
t = partial.call(t, 'x', 5);
a(t.call('yy'), 'xxxyy');
a(t.call(''), 'xxxxx', "Empty string");
a(t.call('yyyyy'), 'yyyyy', 'Equal length');
a(t.call('yyyyyyy'), 'yyyyyyy', 'Longer');
},
Right: function (t, a) {
t = partial.call(t, 'x', -5);
a(t.call('yy'), 'yyxxx');
a(t.call(''), 'xxxxx', "Empty string");
a(t.call('yyyyy'), 'yyyyy', 'Equal length');
a(t.call('yyyyyyy'), 'yyyyyyy', 'Longer');
}
};
|
/**
* ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v4.0.6
* @link http://www.ag-grid.com/
* @license MIT
*/
var events_1 = require("./events");
var ColumnChangeEvent = (function () {
function ColumnChangeEvent(type) {
this.type = type;
}
ColumnChangeEvent.prototype.toString = function () {
var result = 'ColumnChangeEvent {type: ' + this.type;
if (this.column) {
result += ', column: ' + this.column.getColId();
}
if (this.columnGroup) {
result += ', columnGroup: ' + this.columnGroup.getColGroupDef() ? this.columnGroup.getColGroupDef().headerName : '(not defined]';
}
if (this.toIndex) {
result += ', toIndex: ' + this.toIndex;
}
if (this.visible) {
result += ', visible: ' + this.visible;
}
if (this.pinned) {
result += ', pinned: ' + this.pinned;
}
if (typeof this.finished == 'boolean') {
result += ', finished: ' + this.finished;
}
result += '}';
return result;
};
ColumnChangeEvent.prototype.withPinned = function (pinned) {
this.pinned = pinned;
return this;
};
ColumnChangeEvent.prototype.withVisible = function (visible) {
this.visible = visible;
return this;
};
ColumnChangeEvent.prototype.isVisible = function () {
return this.visible;
};
ColumnChangeEvent.prototype.getPinned = function () {
return this.pinned;
};
ColumnChangeEvent.prototype.withColumn = function (column) {
this.column = column;
return this;
};
ColumnChangeEvent.prototype.withColumns = function (columns) {
this.columns = columns;
return this;
};
ColumnChangeEvent.prototype.withFinished = function (finished) {
this.finished = finished;
return this;
};
ColumnChangeEvent.prototype.withColumnGroup = function (columnGroup) {
this.columnGroup = columnGroup;
return this;
};
ColumnChangeEvent.prototype.withToIndex = function (toIndex) {
this.toIndex = toIndex;
return this;
};
ColumnChangeEvent.prototype.getToIndex = function () {
return this.toIndex;
};
ColumnChangeEvent.prototype.getType = function () {
return this.type;
};
ColumnChangeEvent.prototype.getColumn = function () {
return this.column;
};
ColumnChangeEvent.prototype.getColumns = function () {
return this.columns;
};
ColumnChangeEvent.prototype.getColumnGroup = function () {
return this.columnGroup;
};
ColumnChangeEvent.prototype.isPinnedPanelVisibilityImpacted = function () {
return this.type === events_1.Events.EVENT_COLUMN_EVERYTHING_CHANGED ||
this.type === events_1.Events.EVENT_COLUMN_GROUP_OPENED ||
this.type === events_1.Events.EVENT_COLUMN_VISIBLE ||
this.type === events_1.Events.EVENT_COLUMN_PINNED;
};
ColumnChangeEvent.prototype.isContainerWidthImpacted = function () {
return this.type === events_1.Events.EVENT_COLUMN_EVERYTHING_CHANGED ||
this.type === events_1.Events.EVENT_COLUMN_GROUP_OPENED ||
this.type === events_1.Events.EVENT_COLUMN_VISIBLE ||
this.type === events_1.Events.EVENT_COLUMN_RESIZED ||
this.type === events_1.Events.EVENT_COLUMN_PINNED ||
this.type === events_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGE;
};
ColumnChangeEvent.prototype.isIndividualColumnResized = function () {
return this.type === events_1.Events.EVENT_COLUMN_RESIZED && this.column !== undefined && this.column !== null;
};
ColumnChangeEvent.prototype.isFinished = function () {
return this.finished;
};
return ColumnChangeEvent;
})();
exports.ColumnChangeEvent = ColumnChangeEvent;
|
/*!
* Angular Material Design
* https://github.com/angular/material
* @license MIT
* v1.1.0-rc4-master-c26842a
*/
(function( window, angular, undefined ){
"use strict";
/**
* @ngdoc module
* @name material.components.tabs
* @description
*
* Tabs, created with the `<md-tabs>` directive provide *tabbed* navigation with different styles.
* The Tabs component consists of clickable tabs that are aligned horizontally side-by-side.
*
* Features include support for:
*
* - static or dynamic tabs,
* - responsive designs,
* - accessibility support (ARIA),
* - tab pagination,
* - external or internal tab content,
* - focus indicators and arrow-key navigations,
* - programmatic lookup and access to tab controllers, and
* - dynamic transitions through different tab contents.
*
*/
/*
* @see js folder for tabs implementation
*/
angular.module('material.components.tabs', [
'material.core',
'material.components.icon'
]);
/**
* @ngdoc directive
* @name mdTab
* @module material.components.tabs
*
* @restrict E
*
* @description
* Use the `<md-tab>` a nested directive used within `<md-tabs>` to specify a tab with a **label** and optional *view content*.
*
* If the `label` attribute is not specified, then an optional `<md-tab-label>` tag can be used to specify more
* complex tab header markup. If neither the **label** nor the **md-tab-label** are specified, then the nested
* markup of the `<md-tab>` is used as the tab header markup.
*
* Please note that if you use `<md-tab-label>`, your content **MUST** be wrapped in the `<md-tab-body>` tag. This
* is to define a clear separation between the tab content and the tab label.
*
* This container is used by the TabsController to show/hide the active tab's content view. This synchronization is
* automatically managed by the internal TabsController whenever the tab selection changes. Selection changes can
* be initiated via data binding changes, programmatic invocation, or user gestures.
*
* @param {string=} label Optional attribute to specify a simple string as the tab label
* @param {boolean=} ng-disabled If present and expression evaluates to truthy, disabled tab selection.
* @param {expression=} md-on-deselect Expression to be evaluated after the tab has been de-selected.
* @param {expression=} md-on-select Expression to be evaluated after the tab has been selected.
* @param {boolean=} md-active When true, sets the active tab. Note: There can only be one active tab at a time.
*
*
* @usage
*
* <hljs lang="html">
* <md-tab label="" ng-disabled md-on-select="" md-on-deselect="" >
* <h3>My Tab content</h3>
* </md-tab>
*
* <md-tab >
* <md-tab-label>
* <h3>My Tab content</h3>
* </md-tab-label>
* <md-tab-body>
* <p>
* Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,
* totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae
* dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
* sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
* </p>
* </md-tab-body>
* </md-tab>
* </hljs>
*
*/
angular
.module('material.components.tabs')
.directive('mdTab', MdTab);
function MdTab () {
return {
require: '^?mdTabs',
terminal: true,
compile: function (element, attr) {
var label = firstChild(element, 'md-tab-label'),
body = firstChild(element, 'md-tab-body');
if (label.length == 0) {
label = angular.element('<md-tab-label></md-tab-label>');
if (attr.label) label.text(attr.label);
else label.append(element.contents());
if (body.length == 0) {
var contents = element.contents().detach();
body = angular.element('<md-tab-body></md-tab-body>');
body.append(contents);
}
}
element.append(label);
if (body.html()) element.append(body);
return postLink;
},
scope: {
active: '=?mdActive',
disabled: '=?ngDisabled',
select: '&?mdOnSelect',
deselect: '&?mdOnDeselect'
}
};
function postLink (scope, element, attr, ctrl) {
if (!ctrl) return;
var index = ctrl.getTabElementIndex(element),
body = firstChild(element, 'md-tab-body').remove(),
label = firstChild(element, 'md-tab-label').remove(),
data = ctrl.insertTab({
scope: scope,
parent: scope.$parent,
index: index,
element: element,
template: body.html(),
label: label.html()
}, index);
scope.select = scope.select || angular.noop;
scope.deselect = scope.deselect || angular.noop;
scope.$watch('active', function (active) { if (active) ctrl.select(data.getIndex(), true); });
scope.$watch('disabled', function () { ctrl.refreshIndex(); });
scope.$watch(
function () {
return ctrl.getTabElementIndex(element);
},
function (newIndex) {
data.index = newIndex;
ctrl.updateTabOrder();
}
);
scope.$on('$destroy', function () { ctrl.removeTab(data); });
}
function firstChild (element, tagName) {
var children = element[0].children;
for (var i = 0, len = children.length; i < len; i++) {
var child = children[i];
if (child.tagName === tagName.toUpperCase()) return angular.element(child);
}
return angular.element();
}
}
angular
.module('material.components.tabs')
.directive('mdTabItem', MdTabItem);
function MdTabItem () {
return {
require: '^?mdTabs',
link: function link (scope, element, attr, ctrl) {
if (!ctrl) return;
ctrl.attachRipple(scope, element);
}
};
}
angular
.module('material.components.tabs')
.directive('mdTabLabel', MdTabLabel);
function MdTabLabel () {
return { terminal: true };
}
angular.module('material.components.tabs')
.directive('mdTabScroll', MdTabScroll);
function MdTabScroll ($parse) {
return {
restrict: 'A',
compile: function ($element, attr) {
var fn = $parse(attr.mdTabScroll, null, true);
return function ngEventHandler (scope, element) {
element.on('mousewheel', function (event) {
scope.$apply(function () { fn(scope, { $event: event }); });
});
};
}
}
}
MdTabScroll.$inject = ["$parse"];
angular
.module('material.components.tabs')
.controller('MdTabsController', MdTabsController);
/**
* ngInject
*/
function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipple,
$mdUtil, $animateCss, $attrs, $compile, $mdTheming) {
// define private properties
var ctrl = this,
locked = false,
elements = getElements(),
queue = [],
destroyed = false,
loaded = false;
// define one-way bindings
defineOneWayBinding('stretchTabs', handleStretchTabs);
// define public properties with change handlers
defineProperty('focusIndex', handleFocusIndexChange, ctrl.selectedIndex || 0);
defineProperty('offsetLeft', handleOffsetChange, 0);
defineProperty('hasContent', handleHasContent, false);
defineProperty('maxTabWidth', handleMaxTabWidth, getMaxTabWidth());
defineProperty('shouldPaginate', handleShouldPaginate, false);
// define boolean attributes
defineBooleanAttribute('noInkBar', handleInkBar);
defineBooleanAttribute('dynamicHeight', handleDynamicHeight);
defineBooleanAttribute('noPagination');
defineBooleanAttribute('swipeContent');
defineBooleanAttribute('noDisconnect');
defineBooleanAttribute('autoselect');
defineBooleanAttribute('noSelectClick');
defineBooleanAttribute('centerTabs', handleCenterTabs, false);
defineBooleanAttribute('enableDisconnect');
// define public properties
ctrl.scope = $scope;
ctrl.parent = $scope.$parent;
ctrl.tabs = [];
ctrl.lastSelectedIndex = null;
ctrl.hasFocus = false;
ctrl.lastClick = true;
ctrl.shouldCenterTabs = shouldCenterTabs();
// define public methods
ctrl.updatePagination = $mdUtil.debounce(updatePagination, 100);
ctrl.redirectFocus = redirectFocus;
ctrl.attachRipple = attachRipple;
ctrl.insertTab = insertTab;
ctrl.removeTab = removeTab;
ctrl.select = select;
ctrl.scroll = scroll;
ctrl.nextPage = nextPage;
ctrl.previousPage = previousPage;
ctrl.keydown = keydown;
ctrl.canPageForward = canPageForward;
ctrl.canPageBack = canPageBack;
ctrl.refreshIndex = refreshIndex;
ctrl.incrementIndex = incrementIndex;
ctrl.getTabElementIndex = getTabElementIndex;
ctrl.updateInkBarStyles = $mdUtil.debounce(updateInkBarStyles, 100);
ctrl.updateTabOrder = $mdUtil.debounce(updateTabOrder, 100);
init();
/**
* Perform initialization for the controller, setup events and watcher(s)
*/
function init () {
ctrl.selectedIndex = ctrl.selectedIndex || 0;
compileTemplate();
configureWatchers();
bindEvents();
$mdTheming($element);
$mdUtil.nextTick(function () {
// Note that the element references need to be updated, because certain "browsers"
// (IE/Edge) lose them and start throwing "Invalid calling object" errors, when we
// compile the element contents down in `compileElement`.
elements = getElements();
updateHeightFromContent();
adjustOffset();
updateInkBarStyles();
ctrl.tabs[ ctrl.selectedIndex ] && ctrl.tabs[ ctrl.selectedIndex ].scope.select();
loaded = true;
updatePagination();
});
}
/**
* Compiles the template provided by the user. This is passed as an attribute from the tabs
* directive's template function.
*/
function compileTemplate () {
var template = $attrs.$mdTabsTemplate,
element = angular.element($element[0].querySelector('md-tab-data'));
element.html(template);
$compile(element.contents())(ctrl.parent);
delete $attrs.$mdTabsTemplate;
}
/**
* Binds events used by the tabs component.
*/
function bindEvents () {
angular.element($window).on('resize', handleWindowResize);
$scope.$on('$destroy', cleanup);
}
/**
* Configure watcher(s) used by Tabs
*/
function configureWatchers () {
$scope.$watch('$mdTabsCtrl.selectedIndex', handleSelectedIndexChange);
}
/**
* Creates a one-way binding manually rather than relying on Angular's isolated scope
* @param key
* @param handler
*/
function defineOneWayBinding (key, handler) {
var attr = $attrs.$normalize('md-' + key);
if (handler) defineProperty(key, handler);
$attrs.$observe(attr, function (newValue) { ctrl[ key ] = newValue; });
}
/**
* Defines boolean attributes with default value set to true. (ie. md-stretch-tabs with no value
* will be treated as being truthy)
* @param key
* @param handler
*/
function defineBooleanAttribute (key, handler) {
var attr = $attrs.$normalize('md-' + key);
if (handler) defineProperty(key, handler);
if ($attrs.hasOwnProperty(attr)) updateValue($attrs[attr]);
$attrs.$observe(attr, updateValue);
function updateValue (newValue) {
ctrl[ key ] = newValue !== 'false';
}
}
/**
* Remove any events defined by this controller
*/
function cleanup () {
destroyed = true;
angular.element($window).off('resize', handleWindowResize);
}
// Change handlers
/**
* Toggles stretch tabs class and updates inkbar when tab stretching changes
* @param stretchTabs
*/
function handleStretchTabs (stretchTabs) {
angular.element(elements.wrapper).toggleClass('md-stretch-tabs', shouldStretchTabs());
updateInkBarStyles();
}
function handleCenterTabs (newValue) {
ctrl.shouldCenterTabs = shouldCenterTabs();
}
function handleMaxTabWidth (newWidth, oldWidth) {
if (newWidth !== oldWidth) {
angular.forEach(elements.tabs, function(tab) {
tab.style.maxWidth = newWidth + 'px';
});
$mdUtil.nextTick(ctrl.updateInkBarStyles);
}
}
function handleShouldPaginate (newValue, oldValue) {
if (newValue !== oldValue) {
ctrl.maxTabWidth = getMaxTabWidth();
ctrl.shouldCenterTabs = shouldCenterTabs();
$mdUtil.nextTick(function () {
ctrl.maxTabWidth = getMaxTabWidth();
adjustOffset(ctrl.selectedIndex);
});
}
}
/**
* Add/remove the `md-no-tab-content` class depending on `ctrl.hasContent`
* @param hasContent
*/
function handleHasContent (hasContent) {
$element[ hasContent ? 'removeClass' : 'addClass' ]('md-no-tab-content');
}
/**
* Apply ctrl.offsetLeft to the paging element when it changes
* @param left
*/
function handleOffsetChange (left) {
var newValue = ctrl.shouldCenterTabs ? '' : '-' + left + 'px';
angular.element(elements.paging).css($mdConstant.CSS.TRANSFORM, 'translate3d(' + newValue + ', 0, 0)');
$scope.$broadcast('$mdTabsPaginationChanged');
}
/**
* Update the UI whenever `ctrl.focusIndex` is updated
* @param newIndex
* @param oldIndex
*/
function handleFocusIndexChange (newIndex, oldIndex) {
if (newIndex === oldIndex) return;
if (!elements.tabs[ newIndex ]) return;
adjustOffset();
redirectFocus();
}
/**
* Update the UI whenever the selected index changes. Calls user-defined select/deselect methods.
* @param newValue
* @param oldValue
*/
function handleSelectedIndexChange (newValue, oldValue) {
if (newValue === oldValue) return;
ctrl.selectedIndex = getNearestSafeIndex(newValue);
ctrl.lastSelectedIndex = oldValue;
ctrl.updateInkBarStyles();
updateHeightFromContent();
adjustOffset(newValue);
$scope.$broadcast('$mdTabsChanged');
ctrl.tabs[ oldValue ] && ctrl.tabs[ oldValue ].scope.deselect();
ctrl.tabs[ newValue ] && ctrl.tabs[ newValue ].scope.select();
}
function getTabElementIndex(tabEl){
var tabs = $element[0].getElementsByTagName('md-tab');
return Array.prototype.indexOf.call(tabs, tabEl[0]);
}
/**
* Queues up a call to `handleWindowResize` when a resize occurs while the tabs component is
* hidden.
*/
function handleResizeWhenVisible () {
// if there is already a watcher waiting for resize, do nothing
if (handleResizeWhenVisible.watcher) return;
// otherwise, we will abuse the $watch function to check for visible
handleResizeWhenVisible.watcher = $scope.$watch(function () {
// since we are checking for DOM size, we use $mdUtil.nextTick() to wait for after the DOM updates
$mdUtil.nextTick(function () {
// if the watcher has already run (ie. multiple digests in one cycle), do nothing
if (!handleResizeWhenVisible.watcher) return;
if ($element.prop('offsetParent')) {
handleResizeWhenVisible.watcher();
handleResizeWhenVisible.watcher = null;
handleWindowResize();
}
}, false);
});
}
// Event handlers / actions
/**
* Handle user keyboard interactions
* @param event
*/
function keydown (event) {
switch (event.keyCode) {
case $mdConstant.KEY_CODE.LEFT_ARROW:
event.preventDefault();
incrementIndex(-1, true);
break;
case $mdConstant.KEY_CODE.RIGHT_ARROW:
event.preventDefault();
incrementIndex(1, true);
break;
case $mdConstant.KEY_CODE.SPACE:
case $mdConstant.KEY_CODE.ENTER:
event.preventDefault();
if (!locked) select(ctrl.focusIndex);
break;
}
ctrl.lastClick = false;
}
/**
* Update the selected index. Triggers a click event on the original `md-tab` element in order
* to fire user-added click events if canSkipClick or `md-no-select-click` are false.
* @param index
* @param canSkipClick Optionally allow not firing the click event if `md-no-select-click` is also true.
*/
function select (index, canSkipClick) {
if (!locked) ctrl.focusIndex = ctrl.selectedIndex = index;
ctrl.lastClick = true;
// skip the click event if noSelectClick is enabled
if (canSkipClick && ctrl.noSelectClick) return;
// nextTick is required to prevent errors in user-defined click events
$mdUtil.nextTick(function () {
ctrl.tabs[ index ].element.triggerHandler('click');
}, false);
}
/**
* When pagination is on, this makes sure the selected index is in view.
* @param event
*/
function scroll (event) {
if (!ctrl.shouldPaginate) return;
event.preventDefault();
ctrl.offsetLeft = fixOffset(ctrl.offsetLeft - event.wheelDelta);
}
/**
* Slides the tabs over approximately one page forward.
*/
function nextPage () {
var viewportWidth = elements.canvas.clientWidth,
totalWidth = viewportWidth + ctrl.offsetLeft,
i, tab;
for (i = 0; i < elements.tabs.length; i++) {
tab = elements.tabs[ i ];
if (tab.offsetLeft + tab.offsetWidth > totalWidth) break;
}
ctrl.offsetLeft = fixOffset(tab.offsetLeft);
}
/**
* Slides the tabs over approximately one page backward.
*/
function previousPage () {
var i, tab;
for (i = 0; i < elements.tabs.length; i++) {
tab = elements.tabs[ i ];
if (tab.offsetLeft + tab.offsetWidth >= ctrl.offsetLeft) break;
}
ctrl.offsetLeft = fixOffset(tab.offsetLeft + tab.offsetWidth - elements.canvas.clientWidth);
}
/**
* Update size calculations when the window is resized.
*/
function handleWindowResize () {
ctrl.lastSelectedIndex = ctrl.selectedIndex;
ctrl.offsetLeft = fixOffset(ctrl.offsetLeft);
$mdUtil.nextTick(function () {
ctrl.updateInkBarStyles();
updatePagination();
});
}
function handleInkBar (hide) {
angular.element(elements.inkBar).toggleClass('ng-hide', hide);
}
/**
* Toggle dynamic height class when value changes
* @param value
*/
function handleDynamicHeight (value) {
$element.toggleClass('md-dynamic-height', value);
}
/**
* Remove a tab from the data and select the nearest valid tab.
* @param tabData
*/
function removeTab (tabData) {
if (destroyed) return;
var selectedIndex = ctrl.selectedIndex,
tab = ctrl.tabs.splice(tabData.getIndex(), 1)[ 0 ];
refreshIndex();
// when removing a tab, if the selected index did not change, we have to manually trigger the
// tab select/deselect events
if (ctrl.selectedIndex === selectedIndex) {
tab.scope.deselect();
ctrl.tabs[ ctrl.selectedIndex ] && ctrl.tabs[ ctrl.selectedIndex ].scope.select();
}
$mdUtil.nextTick(function () {
updatePagination();
ctrl.offsetLeft = fixOffset(ctrl.offsetLeft);
});
}
/**
* Create an entry in the tabs array for a new tab at the specified index.
* @param tabData
* @param index
* @returns {*}
*/
function insertTab (tabData, index) {
var hasLoaded = loaded;
var proto = {
getIndex: function () { return ctrl.tabs.indexOf(tab); },
isActive: function () { return this.getIndex() === ctrl.selectedIndex; },
isLeft: function () { return this.getIndex() < ctrl.selectedIndex; },
isRight: function () { return this.getIndex() > ctrl.selectedIndex; },
shouldRender: function () { return !ctrl.noDisconnect || this.isActive(); },
hasFocus: function () {
return !ctrl.lastClick
&& ctrl.hasFocus && this.getIndex() === ctrl.focusIndex;
},
id: $mdUtil.nextUid()
},
tab = angular.extend(proto, tabData);
if (angular.isDefined(index)) {
ctrl.tabs.splice(index, 0, tab);
} else {
ctrl.tabs.push(tab);
}
processQueue();
updateHasContent();
$mdUtil.nextTick(function () {
updatePagination();
// if autoselect is enabled, select the newly added tab
if (hasLoaded && ctrl.autoselect) $mdUtil.nextTick(function () {
$mdUtil.nextTick(function () { select(ctrl.tabs.indexOf(tab)); });
});
});
return tab;
}
// Getter methods
/**
* Gathers references to all of the DOM elements used by this controller.
* @returns {{}}
*/
function getElements () {
var elements = {};
var node = $element[0];
// gather tab bar elements
elements.wrapper = node.querySelector('md-tabs-wrapper');
elements.canvas = elements.wrapper.querySelector('md-tabs-canvas');
elements.paging = elements.canvas.querySelector('md-pagination-wrapper');
elements.inkBar = elements.paging.querySelector('md-ink-bar');
elements.contents = node.querySelectorAll('md-tabs-content-wrapper > md-tab-content');
elements.tabs = elements.paging.querySelectorAll('md-tab-item');
elements.dummies = elements.canvas.querySelectorAll('md-dummy-tab');
return elements;
}
/**
* Determines whether or not the left pagination arrow should be enabled.
* @returns {boolean}
*/
function canPageBack () {
return ctrl.offsetLeft > 0;
}
/**
* Determines whether or not the right pagination arrow should be enabled.
* @returns {*|boolean}
*/
function canPageForward () {
var lastTab = elements.tabs[ elements.tabs.length - 1 ];
return lastTab && lastTab.offsetLeft + lastTab.offsetWidth > elements.canvas.clientWidth +
ctrl.offsetLeft;
}
/**
* Determines if the UI should stretch the tabs to fill the available space.
* @returns {*}
*/
function shouldStretchTabs () {
switch (ctrl.stretchTabs) {
case 'always':
return true;
case 'never':
return false;
default:
return !ctrl.shouldPaginate
&& $window.matchMedia('(max-width: 600px)').matches;
}
}
/**
* Determines if the tabs should appear centered.
* @returns {string|boolean}
*/
function shouldCenterTabs () {
return ctrl.centerTabs && !ctrl.shouldPaginate;
}
/**
* Determines if pagination is necessary to display the tabs within the available space.
* @returns {boolean}
*/
function shouldPaginate () {
if (ctrl.noPagination || !loaded) return false;
var canvasWidth = $element.prop('clientWidth');
angular.forEach(elements.dummies, function (tab) { canvasWidth -= tab.offsetWidth; });
return canvasWidth < 0;
}
/**
* Finds the nearest tab index that is available. This is primarily used for when the active
* tab is removed.
* @param newIndex
* @returns {*}
*/
function getNearestSafeIndex (newIndex) {
if (newIndex === -1) return -1;
var maxOffset = Math.max(ctrl.tabs.length - newIndex, newIndex),
i, tab;
for (i = 0; i <= maxOffset; i++) {
tab = ctrl.tabs[ newIndex + i ];
if (tab && (tab.scope.disabled !== true)) return tab.getIndex();
tab = ctrl.tabs[ newIndex - i ];
if (tab && (tab.scope.disabled !== true)) return tab.getIndex();
}
return newIndex;
}
// Utility methods
/**
* Defines a property using a getter and setter in order to trigger a change handler without
* using `$watch` to observe changes.
* @param key
* @param handler
* @param value
*/
function defineProperty (key, handler, value) {
Object.defineProperty(ctrl, key, {
get: function () { return value; },
set: function (newValue) {
var oldValue = value;
value = newValue;
handler && handler(newValue, oldValue);
}
});
}
/**
* Updates whether or not pagination should be displayed.
*/
function updatePagination () {
updatePagingWidth();
ctrl.maxTabWidth = getMaxTabWidth();
ctrl.shouldPaginate = shouldPaginate();
}
/**
* Sets or clears fixed width for md-pagination-wrapper depending on if tabs should stretch.
*/
function updatePagingWidth() {
if (shouldStretchTabs()) {
angular.element(elements.paging).css('width', '');
} else {
angular.element(elements.paging).css('width', calcPagingWidth() + 'px');
}
}
/**
* @returns {number}
*/
function calcPagingWidth () {
var width = 1;
angular.forEach(elements.dummies, function (element) {
//-- Uses the larger value between `getBoundingClientRect().width` and `offsetWidth`. This
// prevents `offsetWidth` value from being rounded down and causing wrapping issues, but
// also handles scenarios where `getBoundingClientRect()` is inaccurate (ie. tabs inside
// of a dialog)
width += Math.max(element.offsetWidth, element.getBoundingClientRect().width);
});
return Math.ceil(width);
}
function getMaxTabWidth () {
return $element.prop('clientWidth');
}
/**
* Re-orders the tabs and updates the selected and focus indexes to their new positions.
* This is triggered by `tabDirective.js` when the user's tabs have been re-ordered.
*/
function updateTabOrder () {
var selectedItem = ctrl.tabs[ ctrl.selectedIndex ],
focusItem = ctrl.tabs[ ctrl.focusIndex ];
ctrl.tabs = ctrl.tabs.sort(function (a, b) {
return a.index - b.index;
});
ctrl.selectedIndex = ctrl.tabs.indexOf(selectedItem);
ctrl.focusIndex = ctrl.tabs.indexOf(focusItem);
}
/**
* This moves the selected or focus index left or right. This is used by the keydown handler.
* @param inc
*/
function incrementIndex (inc, focus) {
var newIndex,
key = focus ? 'focusIndex' : 'selectedIndex',
index = ctrl[ key ];
for (newIndex = index + inc;
ctrl.tabs[ newIndex ] && ctrl.tabs[ newIndex ].scope.disabled;
newIndex += inc) {}
if (ctrl.tabs[ newIndex ]) {
ctrl[ key ] = newIndex;
}
}
/**
* This is used to forward focus to dummy elements. This method is necessary to avoid animation
* issues when attempting to focus an item that is out of view.
*/
function redirectFocus () {
elements.dummies[ ctrl.focusIndex ].focus();
}
/**
* Forces the pagination to move the focused tab into view.
*/
function adjustOffset (index) {
if (index == null) index = ctrl.focusIndex;
if (!elements.tabs[ index ]) return;
if (ctrl.shouldCenterTabs) return;
var tab = elements.tabs[ index ],
left = tab.offsetLeft,
right = tab.offsetWidth + left;
ctrl.offsetLeft = Math.max(ctrl.offsetLeft, fixOffset(right - elements.canvas.clientWidth + 32 * 2));
ctrl.offsetLeft = Math.min(ctrl.offsetLeft, fixOffset(left));
}
/**
* Iterates through all queued functions and clears the queue. This is used for functions that
* are called before the UI is ready, such as size calculations.
*/
function processQueue () {
queue.forEach(function (func) { $mdUtil.nextTick(func); });
queue = [];
}
/**
* Determines if the tab content area is needed.
*/
function updateHasContent () {
var hasContent = false;
angular.forEach(ctrl.tabs, function (tab) {
if (tab.template) hasContent = true;
});
ctrl.hasContent = hasContent;
}
/**
* Moves the indexes to their nearest valid values.
*/
function refreshIndex () {
ctrl.selectedIndex = getNearestSafeIndex(ctrl.selectedIndex);
ctrl.focusIndex = getNearestSafeIndex(ctrl.focusIndex);
}
/**
* Calculates the content height of the current tab.
* @returns {*}
*/
function updateHeightFromContent () {
if (!ctrl.dynamicHeight) return $element.css('height', '');
if (!ctrl.tabs.length) return queue.push(updateHeightFromContent);
var tabContent = elements.contents[ ctrl.selectedIndex ],
contentHeight = tabContent ? tabContent.offsetHeight : 0,
tabsHeight = elements.wrapper.offsetHeight,
newHeight = contentHeight + tabsHeight,
currentHeight = $element.prop('clientHeight');
if (currentHeight === newHeight) return;
// Adjusts calculations for when the buttons are bottom-aligned since this relies on absolute
// positioning. This should probably be cleaned up if a cleaner solution is possible.
if ($element.attr('md-align-tabs') === 'bottom') {
currentHeight -= tabsHeight;
newHeight -= tabsHeight;
// Need to include bottom border in these calculations
if ($element.attr('md-border-bottom') !== undefined) ++currentHeight;
}
// Lock during animation so the user can't change tabs
locked = true;
var fromHeight = { height: currentHeight + 'px' },
toHeight = { height: newHeight + 'px' };
// Set the height to the current, specific pixel height to fix a bug on iOS where the height
// first animates to 0, then back to the proper height causing a visual glitch
$element.css(fromHeight);
// Animate the height from the old to the new
$animateCss($element, {
from: fromHeight,
to: toHeight,
easing: 'cubic-bezier(0.35, 0, 0.25, 1)',
duration: 0.5
}).start().done(function () {
// Then (to fix the same iOS issue as above), disable transitions and remove the specific
// pixel height so the height can size with browser width/content changes, etc.
$element.css({
transition: 'none',
height: ''
});
// In the next tick, re-allow transitions (if we do it all at once, $element.css is "smart"
// enough to batch it for us instead of doing it immediately, which undoes the original
// transition: none)
$mdUtil.nextTick(function() {
$element.css('transition', '');
});
// And unlock so tab changes can occur
locked = false;
});
}
/**
* Repositions the ink bar to the selected tab.
* @returns {*}
*/
function updateInkBarStyles () {
if (!elements.tabs[ ctrl.selectedIndex ]) {
angular.element(elements.inkBar).css({ left: 'auto', right: 'auto' });
return;
}
if (!ctrl.tabs.length) return queue.push(ctrl.updateInkBarStyles);
// if the element is not visible, we will not be able to calculate sizes until it is
// we should treat that as a resize event rather than just updating the ink bar
if (!$element.prop('offsetParent')) return handleResizeWhenVisible();
var index = ctrl.selectedIndex,
totalWidth = elements.paging.offsetWidth,
tab = elements.tabs[ index ],
left = tab.offsetLeft,
right = totalWidth - left - tab.offsetWidth,
tabWidth;
if (ctrl.shouldCenterTabs) {
tabWidth = Array.prototype.slice.call(elements.tabs).reduce(function (value, element) {
return value + element.offsetWidth;
}, 0);
if (totalWidth > tabWidth) $mdUtil.nextTick(updateInkBarStyles, false);
}
updateInkBarClassName();
angular.element(elements.inkBar).css({ left: left + 'px', right: right + 'px' });
}
/**
* Adds left/right classes so that the ink bar will animate properly.
*/
function updateInkBarClassName () {
var newIndex = ctrl.selectedIndex,
oldIndex = ctrl.lastSelectedIndex,
ink = angular.element(elements.inkBar);
if (!angular.isNumber(oldIndex)) return;
ink
.toggleClass('md-left', newIndex < oldIndex)
.toggleClass('md-right', newIndex > oldIndex);
}
/**
* Takes an offset value and makes sure that it is within the min/max allowed values.
* @param value
* @returns {*}
*/
function fixOffset (value) {
if (!elements.tabs.length || !ctrl.shouldPaginate) return 0;
var lastTab = elements.tabs[ elements.tabs.length - 1 ],
totalWidth = lastTab.offsetLeft + lastTab.offsetWidth;
value = Math.max(0, value);
value = Math.min(totalWidth - elements.canvas.clientWidth, value);
return value;
}
/**
* Attaches a ripple to the tab item element.
* @param scope
* @param element
*/
function attachRipple (scope, element) {
var options = { colorElement: angular.element(elements.inkBar) };
$mdTabInkRipple.attach(scope, element, options);
}
}
MdTabsController.$inject = ["$scope", "$element", "$window", "$mdConstant", "$mdTabInkRipple", "$mdUtil", "$animateCss", "$attrs", "$compile", "$mdTheming"];
/**
* @ngdoc directive
* @name mdTabs
* @module material.components.tabs
*
* @restrict E
*
* @description
* The `<md-tabs>` directive serves as the container for 1..n `<md-tab>` child directives to produces a Tabs components.
* In turn, the nested `<md-tab>` directive is used to specify a tab label for the **header button** and a [optional] tab view
* content that will be associated with each tab button.
*
* Below is the markup for its simplest usage:
*
* <hljs lang="html">
* <md-tabs>
* <md-tab label="Tab #1"></md-tab>
* <md-tab label="Tab #2"></md-tab>
* <md-tab label="Tab #3"></md-tab>
* </md-tabs>
* </hljs>
*
* Tabs supports three (3) usage scenarios:
*
* 1. Tabs (buttons only)
* 2. Tabs with internal view content
* 3. Tabs with external view content
*
* **Tab-only** support is useful when tab buttons are used for custom navigation regardless of any other components, content, or views.
* **Tabs with internal views** are the traditional usages where each tab has associated view content and the view switching is managed internally by the Tabs component.
* **Tabs with external view content** is often useful when content associated with each tab is independently managed and data-binding notifications announce tab selection changes.
*
* Additional features also include:
*
* * Content can include any markup.
* * If a tab is disabled while active/selected, then the next tab will be auto-selected.
*
* ### Explanation of tab stretching
*
* Initially, tabs will have an inherent size. This size will either be defined by how much space is needed to accommodate their text or set by the user through CSS. Calculations will be based on this size.
*
* On mobile devices, tabs will be expanded to fill the available horizontal space. When this happens, all tabs will become the same size.
*
* On desktops, by default, stretching will never occur.
*
* This default behavior can be overridden through the `md-stretch-tabs` attribute. Here is a table showing when stretching will occur:
*
* `md-stretch-tabs` | mobile | desktop
* ------------------|-----------|--------
* `auto` | stretched | ---
* `always` | stretched | stretched
* `never` | --- | ---
*
* @param {integer=} md-selected Index of the active/selected tab
* @param {boolean=} md-no-ink If present, disables ink ripple effects.
* @param {boolean=} md-no-ink-bar If present, disables the selection ink bar.
* @param {string=} md-align-tabs Attribute to indicate position of tab buttons: `bottom` or `top`; default is `top`
* @param {string=} md-stretch-tabs Attribute to indicate whether or not to stretch tabs: `auto`, `always`, or `never`; default is `auto`
* @param {boolean=} md-dynamic-height When enabled, the tab wrapper will resize based on the contents of the selected tab
* @param {boolean=} md-border-bottom If present, shows a solid `1px` border between the tabs and their content
* @param {boolean=} md-center-tabs When enabled, tabs will be centered provided there is no need for pagination
* @param {boolean=} md-no-pagination When enabled, pagination will remain off
* @param {boolean=} md-swipe-content When enabled, swipe gestures will be enabled for the content area to jump between tabs
* @param {boolean=} md-enable-disconnect When enabled, scopes will be disconnected for tabs that are not being displayed. This provides a performance boost, but may also cause unexpected issues and is not recommended for most users.
* @param {boolean=} md-autoselect When present, any tabs added after the initial load will be automatically selected
* @param {boolean=} md-no-select-click When enabled, click events will not be fired when selecting tabs
*
* @usage
* <hljs lang="html">
* <md-tabs md-selected="selectedIndex" >
* <img ng-src="img/angular.png" class="centered">
* <md-tab
* ng-repeat="tab in tabs | orderBy:predicate:reversed"
* md-on-select="onTabSelected(tab)"
* md-on-deselect="announceDeselected(tab)"
* ng-disabled="tab.disabled">
* <md-tab-label>
* {{tab.title}}
* <img src="img/removeTab.png" ng-click="removeTab(tab)" class="delete">
* </md-tab-label>
* <md-tab-body>
* {{tab.content}}
* </md-tab-body>
* </md-tab>
* </md-tabs>
* </hljs>
*
*/
angular
.module('material.components.tabs')
.directive('mdTabs', MdTabs);
function MdTabs () {
return {
scope: {
selectedIndex: '=?mdSelected'
},
template: function (element, attr) {
attr[ "$mdTabsTemplate" ] = element.html();
return '' +
'<md-tabs-wrapper> ' +
'<md-tab-data></md-tab-data> ' +
'<md-prev-button ' +
'tabindex="-1" ' +
'role="button" ' +
'aria-label="Previous Page" ' +
'aria-disabled="{{!$mdTabsCtrl.canPageBack()}}" ' +
'ng-class="{ \'md-disabled\': !$mdTabsCtrl.canPageBack() }" ' +
'ng-if="$mdTabsCtrl.shouldPaginate" ' +
'ng-click="$mdTabsCtrl.previousPage()"> ' +
'<md-icon md-svg-icon="md-tabs-arrow"></md-icon> ' +
'</md-prev-button> ' +
'<md-next-button ' +
'tabindex="-1" ' +
'role="button" ' +
'aria-label="Next Page" ' +
'aria-disabled="{{!$mdTabsCtrl.canPageForward()}}" ' +
'ng-class="{ \'md-disabled\': !$mdTabsCtrl.canPageForward() }" ' +
'ng-if="$mdTabsCtrl.shouldPaginate" ' +
'ng-click="$mdTabsCtrl.nextPage()"> ' +
'<md-icon md-svg-icon="md-tabs-arrow"></md-icon> ' +
'</md-next-button> ' +
'<md-tabs-canvas ' +
'tabindex="{{ $mdTabsCtrl.hasFocus ? -1 : 0 }}" ' +
'aria-activedescendant="tab-item-{{$mdTabsCtrl.tabs[$mdTabsCtrl.focusIndex].id}}" ' +
'ng-focus="$mdTabsCtrl.redirectFocus()" ' +
'ng-class="{ ' +
'\'md-paginated\': $mdTabsCtrl.shouldPaginate, ' +
'\'md-center-tabs\': $mdTabsCtrl.shouldCenterTabs ' +
'}" ' +
'ng-keydown="$mdTabsCtrl.keydown($event)" ' +
'role="tablist"> ' +
'<md-pagination-wrapper ' +
'ng-class="{ \'md-center-tabs\': $mdTabsCtrl.shouldCenterTabs }" ' +
'md-tab-scroll="$mdTabsCtrl.scroll($event)"> ' +
'<md-tab-item ' +
'tabindex="-1" ' +
'class="md-tab" ' +
'ng-repeat="tab in $mdTabsCtrl.tabs" ' +
'role="tab" ' +
'aria-controls="tab-content-{{::tab.id}}" ' +
'aria-selected="{{tab.isActive()}}" ' +
'aria-disabled="{{tab.scope.disabled || \'false\'}}" ' +
'ng-click="$mdTabsCtrl.select(tab.getIndex())" ' +
'ng-class="{ ' +
'\'md-active\': tab.isActive(), ' +
'\'md-focused\': tab.hasFocus(), ' +
'\'md-disabled\': tab.scope.disabled ' +
'}" ' +
'ng-disabled="tab.scope.disabled" ' +
'md-swipe-left="$mdTabsCtrl.nextPage()" ' +
'md-swipe-right="$mdTabsCtrl.previousPage()" ' +
'md-tabs-template="::tab.label" ' +
'md-scope="::tab.parent"></md-tab-item> ' +
'<md-ink-bar></md-ink-bar> ' +
'</md-pagination-wrapper> ' +
'<div class="_md-visually-hidden md-dummy-wrapper"> ' +
'<md-dummy-tab ' +
'class="md-tab" ' +
'tabindex="-1" ' +
'id="tab-item-{{::tab.id}}" ' +
'role="tab" ' +
'aria-controls="tab-content-{{::tab.id}}" ' +
'aria-selected="{{tab.isActive()}}" ' +
'aria-disabled="{{tab.scope.disabled || \'false\'}}" ' +
'ng-focus="$mdTabsCtrl.hasFocus = true" ' +
'ng-blur="$mdTabsCtrl.hasFocus = false" ' +
'ng-repeat="tab in $mdTabsCtrl.tabs" ' +
'md-tabs-template="::tab.label" ' +
'md-scope="::tab.parent"></md-dummy-tab> ' +
'</div> ' +
'</md-tabs-canvas> ' +
'</md-tabs-wrapper> ' +
'<md-tabs-content-wrapper ng-show="$mdTabsCtrl.hasContent && $mdTabsCtrl.selectedIndex >= 0" class="_md"> ' +
'<md-tab-content ' +
'id="tab-content-{{::tab.id}}" ' +
'class="_md" ' +
'role="tabpanel" ' +
'aria-labelledby="tab-item-{{::tab.id}}" ' +
'md-swipe-left="$mdTabsCtrl.swipeContent && $mdTabsCtrl.incrementIndex(1)" ' +
'md-swipe-right="$mdTabsCtrl.swipeContent && $mdTabsCtrl.incrementIndex(-1)" ' +
'ng-if="$mdTabsCtrl.hasContent" ' +
'ng-repeat="(index, tab) in $mdTabsCtrl.tabs" ' +
'ng-class="{ ' +
'\'md-no-transition\': $mdTabsCtrl.lastSelectedIndex == null, ' +
'\'md-active\': tab.isActive(), ' +
'\'md-left\': tab.isLeft(), ' +
'\'md-right\': tab.isRight(), ' +
'\'md-no-scroll\': $mdTabsCtrl.dynamicHeight ' +
'}"> ' +
'<div ' +
'md-tabs-template="::tab.template" ' +
'md-connected-if="tab.isActive()" ' +
'md-scope="::tab.parent" ' +
'ng-if="$mdTabsCtrl.enableDisconnect || tab.shouldRender()"></div> ' +
'</md-tab-content> ' +
'</md-tabs-content-wrapper>';
},
controller: 'MdTabsController',
controllerAs: '$mdTabsCtrl',
bindToController: true
};
}
angular
.module('material.components.tabs')
.directive('mdTabsTemplate', MdTabsTemplate);
function MdTabsTemplate ($compile, $mdUtil) {
return {
restrict: 'A',
link: link,
scope: {
template: '=mdTabsTemplate',
connected: '=?mdConnectedIf',
compileScope: '=mdScope'
},
require: '^?mdTabs'
};
function link (scope, element, attr, ctrl) {
if (!ctrl) return;
var compileScope = ctrl.enableDisconnect ? scope.compileScope.$new() : scope.compileScope;
element.html(scope.template);
$compile(element.contents())(compileScope);
element.on('DOMSubtreeModified', function () {
ctrl.updatePagination();
ctrl.updateInkBarStyles();
});
return $mdUtil.nextTick(handleScope);
function handleScope () {
scope.$watch('connected', function (value) { value === false ? disconnect() : reconnect(); });
scope.$on('$destroy', reconnect);
}
function disconnect () {
if (ctrl.enableDisconnect) $mdUtil.disconnectScope(compileScope);
}
function reconnect () {
if (ctrl.enableDisconnect) $mdUtil.reconnectScope(compileScope);
}
}
}
MdTabsTemplate.$inject = ["$compile", "$mdUtil"];
})(window, window.angular); |
var assert = require('assert');
var battle;
describe('Intimidate', function () {
afterEach(function () {
battle.destroy();
});
it('should decrease Atk by 1 level', function () {
battle = BattleEngine.Battle.construct();
battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", ability: 'owntempo', moves: ['sketch']}]);
battle.join('p2', 'Guest 2', 1, [{species: "Gyarados", ability: 'intimidate', moves: ['splash']}]);
assert.strictEqual(battle.p1.active[0].boosts['atk'], -1);
});
it('should be blocked by Substitute', function () {
battle = BattleEngine.Battle.construct();
battle.join('p1', 'Guest 1', 1, [
{species: "Escavalier", item: 'leftovers', ability: 'shellarmor', moves: ['substitute']}
]);
battle.join('p2', 'Guest 2', 1, [
{species: "Greninja", item: 'laggingtail', ability: 'protean', moves: ['uturn']},
{species: "Gyarados", item: 'leftovers', ability: 'intimidate', moves: ['splash']}
]);
battle.commitDecisions();
battle.choose('p2', 'switch 2');
assert.strictEqual(battle.p1.active[0].boosts['atk'], 0);
});
it('should affect adjacent foes only', function () {
battle = BattleEngine.Battle.construct('battle-intimidate-adjacency', 'triplescustomgame');
battle.join('p1', 'Guest 1', 1, [
{species: "Bulbasaur", item: 'leftovers', ability: 'overgrow', moves: ['vinewhip']},
{species: "Charmander", item: 'leftovers', ability: 'blaze', moves: ['ember']},
{species: "Squirtle", item: 'leftovers', ability: 'torrent', moves: ['bubble']}
]);
battle.join('p2', 'Guest 2', 1, [
{species: "Greninja", ability: 'protean', moves: ['uturn']},
{species: "Mew", ability: 'synchronize', moves: ['softboiled']},
{species: "Gyarados", ability: 'intimidate', moves: ['splash']}
]);
battle.commitDecisions();
assert.strictEqual(battle.p1.active[0].boosts['atk'], -1);
assert.strictEqual(battle.p1.active[1].boosts['atk'], -1);
assert.strictEqual(battle.p1.active[2].boosts['atk'], 0);
});
});
|
/* */
"format cjs";
;(function () {
var object = typeof exports != 'undefined' ? exports : this; // #8: web workers
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
function InvalidCharacterError(message) {
this.message = message;
}
InvalidCharacterError.prototype = new Error;
InvalidCharacterError.prototype.name = 'InvalidCharacterError';
// encoder
// [https://gist.github.com/999166] by [https://github.com/nignag]
object.btoa || (
object.btoa = function (input) {
for (
// initialize result and counter
var block, charCode, idx = 0, map = chars, output = '';
// if the next input index does not exist:
// change the mapping table to "="
// check if d has no fractional digits
input.charAt(idx | 0) || (map = '=', idx % 1);
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
output += map.charAt(63 & block >> 8 - idx % 1 * 8)
) {
charCode = input.charCodeAt(idx += 3/4);
if (charCode > 0xFF) {
throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
}
block = block << 8 | charCode;
}
return output;
});
// decoder
// [https://gist.github.com/1020396] by [https://github.com/atk]
object.atob || (
object.atob = function (input) {
input = input.replace(/=+$/, '');
if (input.length % 4 == 1) {
throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
}
for (
// initialize result and counters
var bc = 0, bs, buffer, idx = 0, output = '';
// get next character
buffer = input.charAt(idx++);
// character found in table? initialize bit storage and add its ascii value;
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
// and if not first of each 4 characters,
// convert the first 8 bits to one ascii character
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
) {
// try to find character in table (0-63, not found => -1)
buffer = chars.indexOf(buffer);
}
return output;
});
}());
|
var utils = require('../../lib/util/utils');
var should = require('should');
describe('utils test', function() {
describe('#invokeCallback', function() {
it('should invoke the function with the parameters', function() {
var p1 = 1, p2 = 'str';
var func = function(arg1, arg2) {
p1.should.equal(arg1);
p2.should.equal(arg2);
};
utils.invokeCallback(func, p1, p2);
});
it('should ok if cb is null', function() {
var p1 = 1, p2 = 'str';
(function() {
utils.invokeCallback(null, p1, p2);
}).should.not.throw();
});
});
describe('#size', function() {
it('should return the own property count of the object', function() {
var obj = {
p1: 'str',
p2: 1,
m1: function() {}
};
utils.size(obj).should.equal(2);
});
});
describe('#startsWith', function() {
it('should return true if the string do start with the prefix', function() {
var src = 'prefix with a string';
var prefix = 'prefix';
utils.startsWith(src, prefix).should.be.true;
});
it('should return false if the string not start with the prefix', function() {
var src = 'prefix with a string';
var prefix = 'prefix222';
utils.startsWith(src, prefix).should.be.false;
prefix = 'with';
utils.startsWith(src, prefix).should.be.false;
});
it('should return false if the src not a string', function() {
utils.startsWith(1, 'str').should.be.false;
});
});
describe('#endsWith', function() {
it('should return true if the string do end with the prefix', function() {
var src = 'string with a suffix';
var suffix = 'suffix';
utils.endsWith(src, suffix).should.be.true;
});
it('should return false if the string not end with the prefix', function() {
var src = 'string with a suffix';
var suffix = 'suffix222';
utils.endsWith(src, suffix).should.be.false;
suffix = 'with';
utils.endsWith(src, suffix).should.be.false;
});
it('should return false if the src not a string', function() {
utils.endsWith(1, 'str').should.be.false;
});
});
describe('#hasChineseChar', function() {
it('should return false if the string does not have any Chinese characters', function() {
var src = 'string without Chinese characters';
utils.hasChineseChar(src).should.be.false;
});
it('should return true if the string has Chinese characters', function() {
var src = 'string with Chinese characters 你好';
utils.hasChineseChar(src).should.be.true;
});
});
describe('#unicodeToUtf8', function() {
it('should return the origin string if the string does not have any Chinese characters', function() {
var src = 'string without Chinese characters';
utils.unicodeToUtf8(src).should.equal(src);
});
it('should not return the origin string if the string has Chinese characters', function() {
var src = 'string with Chinese characters 你好';
utils.unicodeToUtf8(src).should.not.equal(src);
});
});
describe('#isLocal', function() {
it('should return true if the ip is local', function() {
var ip = '127.0.0.1';
var host = 'localhost';
var other = '192.168.1.1';
utils.isLocal(ip).should.be.true;
utils.isLocal(host).should.be.true;
utils.isLocal(other).should.be.false;
});
});
describe('#loadCluster', function() {
it('should produce cluster servers', function() {
var clusterServer = {host: '127.0.0.1', port: '3010++', serverType: 'chat', cluster: true, clusterCount: 2};
var serverMap = {};
var app = {clusterSeq:{}};
utils.loadCluster(app, clusterServer, serverMap);
utils.size(serverMap).should.equal(2);
});
});
describe('#arrayDiff', function() {
it('should return the difference of two arrays', function() {
var array1 = [1, 2, 3, 4, 5];
var array2 = [1, 2, 3];
var array = utils.arrayDiff(array1, array2);
array.should.eql([4, 5]);
});
});
describe('#extends', function() {
it('should extends opts', function() {
var opts = {
test: 123
};
var add = {
aaa: 555
};
var result = utils.extends(opts, add);
result.should.eql({
test: 123,
aaa: 555
});
});
});
describe('#ping', function() {
it('should ping server', function() {
utils.ping('127.0.0.1', function(flag) {
flag.should.be.true;
});
utils.ping('111.111.111.111', function(flag) {
flag.should.be.false;
});
});
});
}); |
'use strict';
var findShip = require('../')
, path = require('path');
findShip(
path.join(__dirname, 'uno', 'dos', 'tres')
, function ismothership (pack) {
return !!(pack.dependencies && pack.dependencies.unodep);
}
, function (err, res) {
if (err) return console.error(err);
console.log('first mothership', res.path); // => [..]/example/uno/package.json
}
)
findShip(
path.join(__dirname, 'uno', 'dos', 'tres')
, function ismothership (pack) {
return pack.name === 'dos';
}
, function (err, res) {
if (err) return console.error(err);
console.log('second mothership', res.path); // => [..]/example/uno/dos/package.json
}
)
|
var toString = require('../lang/toString');
var WHITE_SPACES = require('./WHITE_SPACES');
/**
* Remove chars from beginning of string.
*/
function ltrim(str, chars) {
str = toString(str);
chars = chars || WHITE_SPACES;
var start = 0,
len = str.length,
charLen = chars.length,
found = true,
i, c;
while (found && start < len) {
found = false;
i = -1;
c = str.charAt(start);
while (++i < charLen) {
if (c === chars[i]) {
found = true;
start++;
break;
}
}
}
return (start >= len) ? '' : str.substr(start, len);
}
module.exports = ltrim;
|
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["expect"] = factory();
else
root["expect"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _Expectation = __webpack_require__(1);
var _Expectation2 = _interopRequireDefault(_Expectation);
var _SpyUtils = __webpack_require__(12);
var _invariant = __webpack_require__(6);
var _invariant2 = _interopRequireDefault(_invariant);
var _extend = __webpack_require__(14);
var _extend2 = _interopRequireDefault(_extend);
function expect(actual) {
return new _Expectation2['default'](actual);
}
expect.createSpy = _SpyUtils.createSpy;
expect.spyOn = _SpyUtils.spyOn;
expect.isSpy = _SpyUtils.isSpy;
expect.restoreSpies = _SpyUtils.restoreSpies;
expect.assert = _invariant2['default'];
expect.extend = _extend2['default'];
exports['default'] = expect;
module.exports = exports['default'];
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var _deepEqual = __webpack_require__(2);
var _deepEqual2 = _interopRequireDefault(_deepEqual);
var _isRegexp = __webpack_require__(5);
var _isRegexp2 = _interopRequireDefault(_isRegexp);
var _invariant = __webpack_require__(6);
var _invariant2 = _interopRequireDefault(_invariant);
var _isFunction = __webpack_require__(8);
var _isFunction2 = _interopRequireDefault(_isFunction);
var _functionThrows = __webpack_require__(9);
var _functionThrows2 = _interopRequireDefault(_functionThrows);
var _stringContains = __webpack_require__(10);
var _stringContains2 = _interopRequireDefault(_stringContains);
var _arrayContains = __webpack_require__(11);
var _arrayContains2 = _interopRequireDefault(_arrayContains);
var _SpyUtils = __webpack_require__(12);
var _isA = __webpack_require__(13);
var _isA2 = _interopRequireDefault(_isA);
var isArray = Array.isArray;
/**
* An Expectation is a wrapper around an assertion that allows it to be written
* in a more natural style, without the need to remember the order of arguments.
* This helps prevent you from making mistakes when writing tests.
*/
var Expectation = (function () {
function Expectation(actual) {
_classCallCheck(this, Expectation);
this.actual = actual;
if (_isFunction2['default'](actual)) {
this.context = null;
this.args = [];
}
}
Expectation.prototype.toExist = function toExist(message) {
_invariant2['default'](this.actual, message || 'Expected %s to exist', this.actual);
return this;
};
Expectation.prototype.toNotExist = function toNotExist(message) {
_invariant2['default'](!this.actual, message || 'Expected %s to not exist', this.actual);
return this;
};
Expectation.prototype.toBe = function toBe(value, message) {
_invariant2['default'](this.actual === value, message || 'Expected %s to be %s', this.actual, value);
return this;
};
Expectation.prototype.toNotBe = function toNotBe(value, message) {
_invariant2['default'](this.actual !== value, message || 'Expected %s to not be %s', this.actual, value);
return this;
};
Expectation.prototype.toEqual = function toEqual(value, message) {
try {
_invariant2['default'](_deepEqual2['default'](this.actual, value), message || 'Expected %s to equal %s', this.actual, value);
} catch (e) {
// These attributes are consumed by Mocha to produce a diff output.
e.showDiff = true;
e.actual = this.actual;
e.expected = value;
throw e;
}
return this;
};
Expectation.prototype.toNotEqual = function toNotEqual(value, message) {
_invariant2['default'](!_deepEqual2['default'](this.actual, value), message || 'Expected %s to not equal %s', this.actual, value);
return this;
};
Expectation.prototype.toThrow = function toThrow(value, message) {
_invariant2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).toThrow() must be a function, %s was given', this.actual);
_invariant2['default'](_functionThrows2['default'](this.actual, this.context, this.args, value), message || 'Expected %s to throw %s', this.actual, value);
return this;
};
Expectation.prototype.toNotThrow = function toNotThrow(value, message) {
_invariant2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).toNotThrow() must be a function, %s was given', this.actual);
_invariant2['default'](!_functionThrows2['default'](this.actual, this.context, this.args, value), message || 'Expected %s to not throw %s', this.actual, value);
return this;
};
Expectation.prototype.toBeA = function toBeA(value, message) {
_invariant2['default'](_isFunction2['default'](value) || typeof value === 'string', 'The "value" argument in toBeA(value) must be a function or a string');
_invariant2['default'](_isA2['default'](this.actual, value), message || 'Expected %s to be a %s', this.actual, value);
return this;
};
Expectation.prototype.toNotBeA = function toNotBeA(value, message) {
_invariant2['default'](_isFunction2['default'](value) || typeof value === 'string', 'The "value" argument in toNotBeA(value) must be a function or a string');
_invariant2['default'](!_isA2['default'](this.actual, value), message || 'Expected %s to be a %s', this.actual, value);
return this;
};
Expectation.prototype.toMatch = function toMatch(pattern, message) {
_invariant2['default'](typeof this.actual === 'string', 'The "actual" argument in expect(actual).toMatch() must be a string');
_invariant2['default'](_isRegexp2['default'](pattern), 'The "value" argument in toMatch(value) must be a RegExp');
_invariant2['default'](pattern.test(this.actual), message || 'Expected %s to match %s', this.actual, pattern);
return this;
};
Expectation.prototype.toNotMatch = function toNotMatch(pattern, message) {
_invariant2['default'](typeof this.actual === 'string', 'The "actual" argument in expect(actual).toNotMatch() must be a string');
_invariant2['default'](_isRegexp2['default'](pattern), 'The "value" argument in toNotMatch(value) must be a RegExp');
_invariant2['default'](!pattern.test(this.actual), message || 'Expected %s to not match %s', this.actual, pattern);
return this;
};
Expectation.prototype.toBeLessThan = function toBeLessThan(value, message) {
_invariant2['default'](typeof this.actual === 'number', 'The "actual" argument in expect(actual).toBeLessThan() must be a number');
_invariant2['default'](typeof value === 'number', 'The "value" argument in toBeLessThan(value) must be a number');
_invariant2['default'](this.actual < value, message || 'Expected %s to be less than %s', this.actual, value);
return this;
};
Expectation.prototype.toBeGreaterThan = function toBeGreaterThan(value, message) {
_invariant2['default'](typeof this.actual === 'number', 'The "actual" argument in expect(actual).toBeGreaterThan() must be a number');
_invariant2['default'](typeof value === 'number', 'The "value" argument in toBeGreaterThan(value) must be a number');
_invariant2['default'](this.actual > value, message || 'Expected %s to be greater than %s', this.actual, value);
return this;
};
Expectation.prototype.toInclude = function toInclude(value, comparator, message) {
_invariant2['default'](isArray(this.actual) || typeof this.actual === 'string', 'The "actual" argument in expect(actual).toInclude() must be an array or a string');
if (typeof comparator === 'string') {
message = comparator;
comparator = null;
}
message = message || 'Expected %s to include %s';
if (isArray(this.actual)) {
_invariant2['default'](_arrayContains2['default'](this.actual, value, comparator), message, this.actual, value);
} else {
_invariant2['default'](_stringContains2['default'](this.actual, value), message, this.actual, value);
}
return this;
};
Expectation.prototype.toExclude = function toExclude(value, comparator, message) {
_invariant2['default'](isArray(this.actual) || typeof this.actual === 'string', 'The "actual" argument in expect(actual).toExclude() must be an array or a string');
if (typeof comparator === 'string') {
message = comparator;
comparator = null;
}
message = message || 'Expected %s to exclude %s';
if (isArray(this.actual)) {
_invariant2['default'](!_arrayContains2['default'](this.actual, value, comparator), message, this.actual, value);
} else {
_invariant2['default'](!_stringContains2['default'](this.actual, value), message, this.actual, value);
}
return this;
};
Expectation.prototype.toHaveBeenCalled = function toHaveBeenCalled(message) {
var spy = this.actual;
_invariant2['default'](_SpyUtils.isSpy(spy), 'The "actual" argument in expect(actual).toHaveBeenCalled() must be a spy');
_invariant2['default'](spy.calls.length > 0, message || 'spy was not called');
return this;
};
Expectation.prototype.toHaveBeenCalledWith = function toHaveBeenCalledWith() {
var spy = this.actual;
_invariant2['default'](_SpyUtils.isSpy(spy), 'The "actual" argument in expect(actual).toHaveBeenCalledWith() must be a spy');
var expectedArgs = Array.prototype.slice.call(arguments, 0);
_invariant2['default'](spy.calls.some(function (call) {
return _deepEqual2['default'](call.arguments, expectedArgs);
}), 'spy was never called with %s', expectedArgs);
return this;
};
Expectation.prototype.toNotHaveBeenCalled = function toNotHaveBeenCalled(message) {
var spy = this.actual;
_invariant2['default'](_SpyUtils.isSpy(spy), 'The "actual" argument in expect(actual).toNotHaveBeenCalled() must be a spy');
_invariant2['default'](spy.calls.length === 0, message || 'spy was not supposed to be called');
return this;
};
Expectation.prototype.withContext = function withContext(context) {
_invariant2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).withContext() must be a function');
this.context = context;
return this;
};
Expectation.prototype.withArgs = function withArgs() {
_invariant2['default'](_isFunction2['default'](this.actual), 'The "actual" argument in expect(actual).withArgs() must be a function');
if (arguments.length) this.args = this.args.concat(Array.prototype.slice.call(arguments, 0));
return this;
};
return Expectation;
})();
var aliases = {
toBeAn: 'toBeA',
toNotBeAn: 'toNotBeA',
toBeTruthy: 'toExist',
toBeFalsy: 'toNotExist',
toBeFewerThan: 'toBeLessThan',
toBeMoreThan: 'toBeGreaterThan',
toContain: 'toInclude',
toNotContain: 'toExclude'
};
for (var alias in aliases) {
Expectation.prototype[alias] = Expectation.prototype[aliases[alias]];
}exports['default'] = Expectation;
module.exports = exports['default'];
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
var pSlice = Array.prototype.slice;
var objectKeys = __webpack_require__(3);
var isArguments = __webpack_require__(4);
var deepEqual = module.exports = function (actual, expected, opts) {
if (!opts) opts = {};
// 7.1. All identical values are equivalent, as determined by ===.
if (actual === expected) {
return true;
} else if (actual instanceof Date && expected instanceof Date) {
return actual.getTime() === expected.getTime();
// 7.3. Other pairs that do not both pass typeof value == 'object',
// equivalence is determined by ==.
} else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
return opts.strict ? actual === expected : actual == expected;
// 7.4. For all other Object pairs, including Array objects, equivalence is
// determined by having the same number of owned properties (as verified
// with Object.prototype.hasOwnProperty.call), the same set of keys
// (although not necessarily the same order), equivalent values for every
// corresponding key, and an identical 'prototype' property. Note: this
// accounts for both named and indexed properties on Arrays.
} else {
return objEquiv(actual, expected, opts);
}
}
function isUndefinedOrNull(value) {
return value === null || value === undefined;
}
function isBuffer (x) {
if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
return false;
}
if (x.length > 0 && typeof x[0] !== 'number') return false;
return true;
}
function objEquiv(a, b, opts) {
var i, key;
if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
return false;
// an identical 'prototype' property.
if (a.prototype !== b.prototype) return false;
//~~~I've managed to break Object.keys through screwy arguments passing.
// Converting to array solves the problem.
if (isArguments(a)) {
if (!isArguments(b)) {
return false;
}
a = pSlice.call(a);
b = pSlice.call(b);
return deepEqual(a, b, opts);
}
if (isBuffer(a)) {
if (!isBuffer(b)) {
return false;
}
if (a.length !== b.length) return false;
for (i = 0; i < a.length; i++) {
if (a[i] !== b[i]) return false;
}
return true;
}
try {
var ka = objectKeys(a),
kb = objectKeys(b);
} catch (e) {//happens when one is a string literal and the other isn't
return false;
}
// having the same number of owned properties (keys incorporates
// hasOwnProperty)
if (ka.length != kb.length)
return false;
//the same set of keys (although not necessarily the same order),
ka.sort();
kb.sort();
//~~~cheap key test
for (i = ka.length - 1; i >= 0; i--) {
if (ka[i] != kb[i])
return false;
}
//equivalent values for every corresponding key, and
//~~~possibly expensive deep test
for (i = ka.length - 1; i >= 0; i--) {
key = ka[i];
if (!deepEqual(a[key], b[key], opts)) return false;
}
return typeof a === typeof b;
}
/***/ },
/* 3 */
/***/ function(module, exports) {
exports = module.exports = typeof Object.keys === 'function'
? Object.keys : shim;
exports.shim = shim;
function shim (obj) {
var keys = [];
for (var key in obj) keys.push(key);
return keys;
}
/***/ },
/* 4 */
/***/ function(module, exports) {
var supportsArgumentsClass = (function(){
return Object.prototype.toString.call(arguments)
})() == '[object Arguments]';
exports = module.exports = supportsArgumentsClass ? supported : unsupported;
exports.supported = supported;
function supported(object) {
return Object.prototype.toString.call(object) == '[object Arguments]';
};
exports.unsupported = unsupported;
function unsupported(object){
return object &&
typeof object == 'object' &&
typeof object.length == 'number' &&
Object.prototype.hasOwnProperty.call(object, 'callee') &&
!Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
false;
};
/***/ },
/* 5 */
/***/ function(module, exports) {
'use strict';
module.exports = function (re) {
return Object.prototype.toString.call(re) === '[object RegExp]';
};
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _objectInspect = __webpack_require__(7);
var _objectInspect2 = _interopRequireDefault(_objectInspect);
function invariant(condition, messageFormat) {
if (condition) return;
var extraArgs = Array.prototype.slice.call(arguments, 2);
var index = 0;
throw new Error(messageFormat.replace(/%s/g, function () {
return _objectInspect2['default'](extraArgs[index++]);
}));
}
exports['default'] = invariant;
module.exports = exports['default'];
/***/ },
/* 7 */
/***/ function(module, exports) {
module.exports = function inspect_ (obj, opts, depth, seen) {
if (!opts) opts = {};
var maxDepth = opts.depth === undefined ? 5 : opts.depth;
if (depth === undefined) depth = 0;
if (depth >= maxDepth && maxDepth > 0
&& obj && typeof obj === 'object') {
return '[Object]';
}
if (seen === undefined) seen = [];
else if (indexOf(seen, obj) >= 0) {
return '[Circular]';
}
function inspect (value, from) {
if (from) {
seen = seen.slice();
seen.push(from);
}
return inspect_(value, opts, depth + 1, seen);
}
if (typeof obj === 'string') {
return inspectString(obj);
}
else if (typeof obj === 'function') {
var name = nameOf(obj);
return '[Function' + (name ? ': ' + name : '') + ']';
}
else if (obj === null) {
return 'null';
}
else if (isSymbol(obj)) {
var symString = Symbol.prototype.toString.call(obj);
return typeof obj === 'object' ? 'Object(' + symString + ')' : symString;
}
else if (isElement(obj)) {
var s = '<' + String(obj.nodeName).toLowerCase();
var attrs = obj.attributes || [];
for (var i = 0; i < attrs.length; i++) {
s += ' ' + attrs[i].name + '="' + quote(attrs[i].value) + '"';
}
s += '>';
if (obj.childNodes && obj.childNodes.length) s += '...';
s += '</' + String(obj.nodeName).toLowerCase() + '>';
return s;
}
else if (isArray(obj)) {
if (obj.length === 0) return '[]';
var xs = Array(obj.length);
for (var i = 0; i < obj.length; i++) {
xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
}
return '[ ' + xs.join(', ') + ' ]';
}
else if (isError(obj)) {
var parts = [];
for (var key in obj) {
if (!has(obj, key)) continue;
if (/[^\w$]/.test(key)) {
parts.push(inspect(key) + ': ' + inspect(obj[key]));
}
else {
parts.push(key + ': ' + inspect(obj[key]));
}
}
if (parts.length === 0) return '[' + obj + ']';
return '{ [' + obj + '] ' + parts.join(', ') + ' }';
}
else if (typeof obj === 'object' && typeof obj.inspect === 'function') {
return obj.inspect();
}
else if (typeof obj === 'object' && !isDate(obj) && !isRegExp(obj)) {
var xs = [], keys = [];
for (var key in obj) {
if (has(obj, key)) keys.push(key);
}
keys.sort();
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (/[^\w$]/.test(key)) {
xs.push(inspect(key) + ': ' + inspect(obj[key], obj));
}
else xs.push(key + ': ' + inspect(obj[key], obj));
}
if (xs.length === 0) return '{}';
return '{ ' + xs.join(', ') + ' }';
}
else return String(obj);
};
function quote (s) {
return String(s).replace(/"/g, '"');
}
function isArray (obj) { return toStr(obj) === '[object Array]' }
function isDate (obj) { return toStr(obj) === '[object Date]' }
function isRegExp (obj) { return toStr(obj) === '[object RegExp]' }
function isError (obj) { return toStr(obj) === '[object Error]' }
function isSymbol (obj) { return toStr(obj) === '[object Symbol]' }
var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
function has (obj, key) {
return hasOwn.call(obj, key);
}
function toStr (obj) {
return Object.prototype.toString.call(obj);
}
function nameOf (f) {
if (f.name) return f.name;
var m = f.toString().match(/^function\s*([\w$]+)/);
if (m) return m[1];
}
function indexOf (xs, x) {
if (xs.indexOf) return xs.indexOf(x);
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) return i;
}
return -1;
}
function isElement (x) {
if (!x || typeof x !== 'object') return false;
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
return true;
}
return typeof x.nodeName === 'string'
&& typeof x.getAttribute === 'function'
;
}
function inspectString (str) {
var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);
return "'" + s + "'";
function lowbyte (c) {
var n = c.charCodeAt(0);
var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n];
if (x) return '\\' + x;
return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16);
}
}
/***/ },
/* 8 */
/***/ function(module, exports) {
/**
* Returns true if the given object is a function.
*/
'use strict';
exports.__esModule = true;
function isFunction(object) {
return typeof object === 'function';
}
exports['default'] = isFunction;
module.exports = exports['default'];
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _isRegexp = __webpack_require__(5);
var _isRegexp2 = _interopRequireDefault(_isRegexp);
var _isFunction = __webpack_require__(8);
var _isFunction2 = _interopRequireDefault(_isFunction);
/**
* Returns true if the given function throws the given value
* when invoked. The value may be:
*
* - undefined, to merely assert there was a throw
* - a constructor function, for comparing using instanceof
* - a regular expression, to compare with the error message
* - a string, to find in the error message
*/
function functionThrows(fn, context, args, value) {
try {
fn.apply(context, args);
} catch (error) {
if (value == null) return true;
if (_isFunction2['default'](value) && error instanceof value) return true;
var message = error.message || error;
if (typeof message === 'string') {
if (_isRegexp2['default'](value) && value.test(error.message)) return true;
if (typeof value === 'string' && message.indexOf(value) !== -1) return true;
}
}
return false;
}
exports['default'] = functionThrows;
module.exports = exports['default'];
/***/ },
/* 10 */
/***/ function(module, exports) {
/**
* Returns true if the given string contains the value, false otherwise.
*/
"use strict";
exports.__esModule = true;
function stringContains(string, value) {
return string.indexOf(value) !== -1;
}
exports["default"] = stringContains;
module.exports = exports["default"];
/***/ },
/* 11 */
/***/ function(module, exports) {
/**
* Returns true if the given array contains the value, false
* otherwise. The comparator function must return false to
* indicate a non-match.
*/
"use strict";
exports.__esModule = true;
function arrayContains(array, value, comparator) {
if (comparator == null) return array.indexOf(value) !== -1;
return array.some(function (item) {
return comparator(item, value) !== false;
});
}
exports["default"] = arrayContains;
module.exports = exports["default"];
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.createSpy = createSpy;
exports.spyOn = spyOn;
exports.isSpy = isSpy;
exports.restoreSpies = restoreSpies;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _invariant = __webpack_require__(6);
var _invariant2 = _interopRequireDefault(_invariant);
var _isFunction = __webpack_require__(8);
var _isFunction2 = _interopRequireDefault(_isFunction);
function noop() {}
var spies = [];
function createSpy(fn) {
var restore = arguments.length <= 1 || arguments[1] === undefined ? noop : arguments[1];
if (fn == null) fn = noop;
_invariant2['default'](_isFunction2['default'](fn), 'createSpy needs a function');
var targetFn = undefined,
thrownValue = undefined,
returnValue = undefined;
var spy = function spy() {
spy.calls.push({
context: this,
arguments: Array.prototype.slice.call(arguments, 0)
});
if (targetFn) return targetFn.apply(this, arguments);
if (thrownValue) throw thrownValue;
return returnValue;
};
spy.calls = [];
spy.andCall = function (fn) {
targetFn = fn;
return spy;
};
spy.andCallThrough = function () {
return spy.andCall(fn);
};
spy.andThrow = function (object) {
thrownValue = object;
return spy;
};
spy.andReturn = function (value) {
returnValue = value;
return spy;
};
spy.getLastCall = function () {
return spy.calls[spy.calls.length - 1];
};
spy.restore = spy.destroy = restore;
spy.__isSpy = true;
spies.push(spy);
return spy;
}
function spyOn(object, methodName) {
var original = object[methodName];
if (!isSpy(original)) {
_invariant2['default'](_isFunction2['default'](original), 'Cannot spyOn the %s property; it is not a function', methodName);
object[methodName] = createSpy(original, function () {
object[methodName] = original;
});
}
return object[methodName];
}
function isSpy(object) {
return object && object.__isSpy === true;
}
function restoreSpies() {
for (var i = spies.length - 1; i >= 0; i--) {
spies[i].restore();
}spies = [];
}
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _isFunction = __webpack_require__(8);
var _isFunction2 = _interopRequireDefault(_isFunction);
/**
* Returns true if the given object is an instanceof value
* or its typeof is the given value.
*/
function isA(object, value) {
if (_isFunction2['default'](value)) return object instanceof value;
if (value === 'array') return Array.isArray(object);
return typeof object === value;
}
exports['default'] = isA;
module.exports = exports['default'];
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _Expectation = __webpack_require__(1);
var _Expectation2 = _interopRequireDefault(_Expectation);
var Extensions = [];
function extend(extension) {
if (Extensions.indexOf(extension) === -1) {
Extensions.push(extension);
for (var p in extension) {
if (extension.hasOwnProperty(p)) _Expectation2['default'].prototype[p] = extension[p];
}
}
}
exports['default'] = extend;
module.exports = exports['default'];
/***/ }
/******/ ])
});
; |
var Class = require('../../core/class');
// Utility command factories
var point = function(c){
return function(x, y){
return this.push(c, x, y);
};
};
var arc = function(c, cc){
return function(x, y, rx, ry, outer){
return this.push(c, Math.abs(rx || x), Math.abs(ry || rx || y), 0, outer ? 1 : 0, cc, x, y);
};
};
var curve = function(t, s, q, c){
return function(c1x, c1y, c2x, c2y, ex, ey){
var l = arguments.length, k = l < 4 ? t : l < 6 ? q : c;
return this.push(k, c1x, c1y, c2x, c2y, ex, ey);
};
};
// SVG Path Class
var SVGPath = Class({
initialize: function(path){
if (path instanceof SVGPath){
this.path = [Array.prototype.join.call(path.path, ' ')];
} else {
if (path && path.applyToPath)
path.applyToPath(this);
else
this.path = [path || 'm0 0'];
}
},
push: function(){
this.path.push(Array.prototype.join.call(arguments, ' '));
return this;
},
reset: function(){
this.path = [];
return this;
},
move: point('m'),
moveTo: point('M'),
line: point('l'),
lineTo: point('L'),
curve: curve('t', 's', 'q', 'c'),
curveTo: curve('T', 'S', 'Q', 'C'),
arc: arc('a', 1),
arcTo: arc('A', 1),
counterArc: arc('a', 0),
counterArcTo: arc('A', 0),
close: function(){
return this.push('z');
},
toSVG: function(){
return this.path.join(' ');
}
});
SVGPath.prototype.toString = SVGPath.prototype.toSVG;
module.exports = SVGPath; |
/*
* index.js: Top-level include for the `utile` module.
*
* (C) 2011, Charlie Robbins & the Contributors
* MIT LICENSE
*
*/
var fs = require('fs'),
path = require('path'),
util = require('util');
var utile = module.exports;
//
// Extend the `utile` object with all methods from the
// core node `util` methods.
//
Object.keys(util).forEach(function (key) {
utile[key] = util[key];
});
Object.defineProperties(utile, {
//
// ### function async
// Simple wrapper to `require('async')`.
//
'async': {
get: function() {
return utile.async = require('async');
}
},
//
// ### function inflect
// Simple wrapper to `require('i')`.
//
'inflect': {
get: function() {
return utile.inflect = require('i')();
}
},
//
// ### function mkdirp
// Simple wrapper to `require('mkdirp')`
//
'mkdirp': {
get: function() {
return utile.mkdirp = require('mkdirp');
}
},
//
// ### function deepEqual
// Simple wrapper to `require('deep-equal')`
// Remark: deepEqual is 4x faster then using assert.deepEqual
// see: https://gist.github.com/2790507
//
'deepEqual': {
get: function() {
return utile.deepEqual = require('deep-equal');
}
},
//
// ### function rimraf
// Simple wrapper to `require('rimraf')`
//
'rimraf': {
get: function() {
return utile.rimraf = require('rimraf');
}
},
//
// ### function cpr
// Simple wrapper to `require('ncp').ncp`
//
'cpr': {
get: function() {
return utile.cpr = require('ncp').ncp;
}
},
//
// ### @file {Object}
// Lazy-loaded `file` module
//
'file': {
get: function() {
return utile.file = require('./file');
}
},
//
// ### @args {Object}
// Lazy-loaded `args` module
//
'args': {
get: function() {
return utile.args = require('./args');
}
},
//
// ### @base64 {Object}
// Lazy-loaded `base64` object
//
'base64': {
get: function() {
return utile.base64 = require('./base64');
}
},
//
// ### @format {Object}
// Lazy-loaded `format` object
//
'format': {
get: function() {
return utile.format = require('./format');
}
}
});
//
// ### function rargs(_args)
// #### _args {Arguments} Original function arguments
//
// Top-level method will accept a javascript "arguments" object
// (the actual keyword "arguments" inside any scope) and return
// back an Array.
//
utile.rargs = function (_args, slice) {
if (!slice) {
slice = 0;
}
var len = (_args || []).length,
args = new Array(len - slice),
i;
//
// Convert the raw `_args` to a proper Array.
//
for (i = slice; i < len; i++) {
args[i - slice] = _args[i];
}
return args;
};
//
// ### function each (obj, iterator)
// #### @obj {Object} Object to iterate over
// #### @iterator {function} Continuation to use on each key. `function (value, key, object)`
// Iterate over the keys of an object.
//
utile.each = function (obj, iterator) {
Object.keys(obj).forEach(function (key) {
iterator(obj[key], key, obj);
});
};
//
// ### function find (o)
//
//
utile.find = function (obj, pred) {
var value, key;
for (key in obj) {
value = obj[key];
if (pred(value, key)) {
return value;
}
}
};
//
// ### function pad (str, len, chr)
// ### @str {String} String to pad
// ### @len {Number} Number of chars to pad str with
// ### @chr {String} Optional replacement character, defaults to empty space
// Appends chr to str until it reaches a length of len
//
utile.pad = function pad(str, len, chr) {
var s;
if (!chr) {
chr = ' ';
}
str = str || '';
s = str;
if (str.length < len) {
for (var i = 0; i < (len - str.length); i++) {
s += chr;
}
}
return s;
}
//
// ### function path (obj, path, value)
// ### @obj {Object} Object to insert value into
// ### @path {Array} List of nested keys to insert value at
// Retreives a value from given Object, `obj`, located at the
// nested keys, `path`.
//
utile.path = function (obj, path) {
var key, i;
for (i in path) {
if (typeof obj === 'undefined') {
return undefined;
}
key = path[i];
obj = obj[key];
}
return obj;
};
//
// ### function createPath (obj, path, value)
// ### @obj {Object} Object to insert value into
// ### @path {Array} List of nested keys to insert value at
// ### @value {*} Value to insert into the object.
// Inserts the `value` into the given Object, `obj`, creating
// any keys in `path` along the way if necessary.
//
utile.createPath = function (obj, path, value) {
var key, i;
for (i in path) {
key = path[i];
if (!obj[key]) {
obj[key] = ((+i + 1 === path.length) ? value : {});
}
obj = obj[key];
}
};
//
// ### function mixin (target [source0, source1, ...])
// Copies enumerable properties from `source0 ... sourceN`
// onto `target` and returns the resulting object.
//
utile.mixin = function (target) {
utile.rargs(arguments, 1).forEach(function (o) {
Object.getOwnPropertyNames(o).forEach(function(attr) {
var getter = Object.getOwnPropertyDescriptor(o, attr).get,
setter = Object.getOwnPropertyDescriptor(o, attr).set;
if (!getter && !setter) {
target[attr] = o[attr];
}
else {
Object.defineProperty(target, attr, {
get: getter,
set: setter
});
}
});
});
return target;
};
//
// ### function capitalize (str)
// #### @str {string} String to capitalize
// Capitalizes the specified `str`.
//
utile.capitalize = utile.inflect.camelize;
//
// ### function escapeRegExp (str)
// #### @str {string} String to be escaped
// Escape string for use in Javascript regex
//
utile.escapeRegExp = function (str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
};
//
// ### function randomString (length)
// #### @length {integer} The number of bits for the random base64 string returned to contain
// randomString returns a pseude-random ASCII string (subset)
// the return value is a string of length ⌈bits/6⌉ of characters
// from the base64 alphabet.
//
utile.randomString = function (length) {
var chars, rand, i, ret, mod, bits;
chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-';
ret = '';
// standard 4
mod = 4;
// default is 16
bits = length * mod || 64;
// in v8, Math.random() yields 32 pseudo-random bits (in spidermonkey it gives 53)
while (bits > 0) {
// 32-bit integer
rand = Math.floor(Math.random() * 0x100000000);
//we use the top bits
for (i = 26; i > 0 && bits > 0; i -= mod, bits -= mod) {
ret += chars[0x3F & rand >>> i];
}
}
return ret;
};
//
// ### function filter (object, test)
// #### @obj {Object} Object to iterate over
// #### @pred {function} Predicate applied to each property. `function (value, key, object)`
// Returns an object with properties from `obj` which satisfy
// the predicate `pred`
//
utile.filter = function (obj, pred) {
var copy;
if (Array.isArray(obj)) {
copy = [];
utile.each(obj, function (val, key) {
if (pred(val, key, obj)) {
copy.push(val);
}
});
}
else {
copy = {};
utile.each(obj, function (val, key) {
if (pred(val, key, obj)) {
copy[key] = val;
}
});
}
return copy;
};
//
// ### function requireDir (directory)
// #### @directory {string} Directory to require
// Requires all files and directories from `directory`, returning an object
// with keys being filenames (without trailing `.js`) and respective values
// being return values of `require(filename)`.
//
utile.requireDir = function (directory) {
var result = {},
files = fs.readdirSync(directory);
files.forEach(function (file) {
if (file.substr(-3) === '.js') {
file = file.substr(0, file.length - 3);
}
result[file] = require(path.resolve(directory, file));
});
return result;
};
//
// ### function requireDirLazy (directory)
// #### @directory {string} Directory to require
// Lazily requires all files and directories from `directory`, returning an
// object with keys being filenames (without trailing `.js`) and respective
// values (getters) being return values of `require(filename)`.
//
utile.requireDirLazy = function (directory) {
var result = {},
files = fs.readdirSync(directory);
files.forEach(function (file) {
if (file.substr(-3) === '.js') {
file = file.substr(0, file.length - 3);
}
Object.defineProperty(result, file, {
get: function() {
return result[file] = require(path.resolve(directory, file));
}
});
});
return result;
};
//
// ### function clone (object, filter)
// #### @object {Object} Object to clone
// #### @filter {Function} Filter to be used
// Shallow clones the specified object.
//
utile.clone = function (object, filter) {
return Object.keys(object).reduce(filter ? function (obj, k) {
if (filter(k)) obj[k] = object[k];
return obj;
} : function (obj, k) {
obj[k] = object[k];
return obj;
}, {});
};
//
// ### function camelToUnderscore (obj)
// #### @obj {Object} Object to convert keys on.
// Converts all keys of the type `keyName` to `key_name` on the
// specified `obj`.
//
utile.camelToUnderscore = function (obj) {
if (typeof obj !== 'object' || obj === null) {
return obj;
}
if (Array.isArray(obj)) {
obj.forEach(utile.camelToUnderscore);
return obj;
}
Object.keys(obj).forEach(function (key) {
var k = utile.inflect.underscore(key);
if (k !== key) {
obj[k] = obj[key];
delete obj[key];
key = k;
}
utile.camelToUnderscore(obj[key]);
});
return obj;
};
//
// ### function underscoreToCamel (obj)
// #### @obj {Object} Object to convert keys on.
// Converts all keys of the type `key_name` to `keyName` on the
// specified `obj`.
//
utile.underscoreToCamel = function (obj) {
if (typeof obj !== 'object' || obj === null) {
return obj;
}
if (Array.isArray(obj)) {
obj.forEach(utile.underscoreToCamel);
return obj;
}
Object.keys(obj).forEach(function (key) {
var k = utile.inflect.camelize(key, false);
if (k !== key) {
obj[k] = obj[key];
delete obj[key];
key = k;
}
utile.underscoreToCamel(obj[key]);
});
return obj;
};
|
if (typeof ot === 'undefined') {
// Export for browsers
var ot = {};
}
ot.Operation = (function () {
// Constructor for new operations. Expects an revision number (non-negative
// integer) and an optional ID (string). If no ID is given, a random ID will
// be generated.
function Operation (revision, id, meta) {
assert(
typeof revision === 'number' && revision >= 0,
"the first parameter to the the parent revision number of the document"
);
this.revision = revision;
this.id = id || randomID();
assert(this.id && typeof this.id === 'string', "not a valid id: " + this.id);
// Place to store arbitrary data. This could be a timestamp of the edit, the
// name of the author, etc...
this.meta = meta || {};
// When an operation is applied to an input string, you can think of this as
// if an imaginary cursor runs over the entire string and skips over some
// parts, deletes some parts and inserts characters at some positions. These
// actions (skip/delete/insert) are stored as an array in the "ops" property.
this.ops = [];
// An operation's baseLength is the length of every string the operation
// can be applied to.
this.baseLength = 0;
// The targetLength is the length of every string that results from applying
// the operation on a valid input string.
this.targetLength = 0;
}
// After an operation is constructed, the user of the library can specify the
// actions of an operation (skip/insert/delete) with these three builder
// methods. They all return the operation for convenient chaining.
// Skip over a given number of characters.
Operation.prototype.retain = function (n) {
assert(typeof n === 'number' && n >= 0);
if (n === 0) { return this; }
this.baseLength += n;
this.targetLength += n;
var lastOp = this.ops[this.ops.length-1];
if (lastOp && lastOp.retain) {
// The last op is a retain op => we can merge them into one op.
lastOp.retain += n;
} else {
// Create a new op.
this.ops.push({ retain: n });
}
return this;
};
// Insert a string at the current position.
Operation.prototype.insert = function (str) {
assert(typeof str === 'string');
if (str === '') { return this; }
this.targetLength += str.length;
var lastOp = this.ops[this.ops.length-1];
if (lastOp && lastOp.insert) {
// Merge insert op.
lastOp.insert += str;
} else {
this.ops.push({ insert: str });
}
return this;
};
// Delete a string at the current position.
Operation.prototype.delete = function (str) {
assert(typeof str === 'string');
if (str === '') { return this; }
this.baseLength += str.length;
var lastOp = this.ops[this.ops.length-1];
if (lastOp && lastOp.delete) {
lastOp.delete += str;
} else {
this.ops.push({ delete: str });
}
return this;
};
// Pretty printing.
Operation.prototype.toString = function () {
// map: build a new array by applying a function to every element in an old
// array.
var map = Array.prototype.map || function (fn) {
var arr = this;
var newArr = [];
for (var i = 0, l = arr.length; i < l; i++) {
newArr[i] = fn(arr[i]);
}
return newArr;
};
return map.call(this.ops, function (op) {
return op.retain
? "retain " + op.retain
: (op.insert
? "insert '" + op.insert + "'"
: "delete '" + op.delete + "'")
}).join(', ');
};
// Converts a plain JS object into an operation and validates it.
Operation.fromJSON = function (obj) {
assert(obj.id);
var o = new Operation(obj.revision, obj.id, obj.meta);
assert(typeof o.meta === 'object');
var ops = obj.ops;
for (var i = 0, l = ops.length; i < l; i++) {
var op = ops[i];
if (op.retain) {
o.retain(op.retain);
} else if (op.insert) {
o.insert(op.insert);
} else if (op.delete) {
o.delete(op.delete);
} else {
throw new Error("unknown operation: " + JSON.stringify(op));
}
}
assert(o.baseLength === obj.baseLength, "baseLengths don't match");
assert(o.targetLength === obj.targetLength, "targetLengths don't match");
return o;
};
// Apply an operation to a string, returning a new string. Throws an error if
// there's a mismatch between the input string and the operation.
Operation.prototype.apply = function (str) {
var operation = this;
if (str.length !== operation.baseLength) {
throw new Error("The operation's base length must be equal to the string's length.");
}
var newStr = [], j = 0;
var strIndex = 0;
var ops = this.ops;
for (var i = 0, l = ops.length; i < l; i++) {
var op = ops[i];
if (op.retain) {
if (strIndex + op.retain > str.length) {
throw new Error("Operation can't retain more characters than are left in the string.");
}
// Copy skipped part of the old string.
newStr[j++] = str.slice(strIndex, strIndex + op.retain);
strIndex += op.retain;
} else if (op.insert) {
// Insert string.
newStr[j++] = op.insert;
} else { // delete op
// Make sure that the deleted string matches the next characters in the
// input string.
if (op.delete !== str.slice(strIndex, strIndex + op.delete.length)) {
throw new Error("The deleted string and the next characters in the string don't match.");
}
strIndex += op.delete.length;
}
}
if (strIndex !== str.length) {
throw new Error("The operation didn't operate on the whole string.");
}
return newStr.join('');
};
// Computes the inverse of an operation. The inverse of an operation is the
// operation that reverts the effects of the operation, e.g. when you have an
// operation 'insert("hello "); skip(6);' then the inverse is 'delete("hello ");
// skip(6);'. The inverse should be used for implementing undo.
Operation.prototype.invert = function () {
var inverse = new Operation(this.revision + 1);
var ops = this.ops;
for (var i = 0, l = ops.length; i < l; i++) {
var op = ops[i];
if (op.retain) {
inverse.retain(op.retain);
} else if (op.insert) {
inverse.delete(op.insert);
} else { // delete op
inverse.insert(op.delete);
}
}
return inverse;
};
// Compose merges to consecutive operations (they must have consecutive
// revision numbers) into one operation, that preserves the changes of both.
// Or, in other words, for each input string S and a pair of consecutive
// operations A and B, apply(apply(S, A), B) = apply(S, compose(A, B)) must
// hold.
Operation.prototype.compose = function (operation2) {
var operation1 = this;
if (operation1.targetLength !== operation2.baseLength) {
throw new Error("The base length of the second operation has to be the target length of the first operation");
}
if (operation1.revision + 1 !== operation2.revision) {
throw new Error("The second operations revision must be one more than the first operations revision");
}
var operation = new Operation(operation1.revision, undefined, operation1.meta); // the combined operation
var ops1 = operation1.ops, ops2 = operation2.ops; // for fast access
var i1 = 0, i2 = 0; // current index into ops1 respectively ops2
var op1 = ops1[i1++], op2 = ops2[i2++]; // current ops
while (true) {
// save length of current ops
var op1l = op1 && (op1.retain || (op1.insert || op1.delete).length);
var op2l = op2 && (op2.retain || (op2.insert || op2.delete).length);
var minl = Math.min(op1l, op2l);
// Dispatch on the type of op1 and op2
if (typeof op1 === 'undefined' && typeof op2 === 'undefined') {
// end condition: both ops1 and ops2 have been processed
break;
} else if (typeof op1 === 'undefined') {
if (!op2.insert) {
throw new Error("Successive operations can only insert new characters at the end of the string.");
}
operation.insert(op2.insert);
op2 = ops2[i2++];
} else if (typeof op2 === 'undefined') {
if (!op1.delete) {
throw new Error("The first operation can only delete at the end of operation 2.");
}
operation.delete(op1.delete);
op1 = ops1[i1++];
} else if (op1.retain && op2.retain) {
operation.retain(minl);
if (op1l > op2l) {
op1 = { retain: op1l - op2l };
op2 = ops2[i2++];
} else if (op1l === op2l) {
op1 = ops1[i1++];
op2 = ops2[i2++];
} else {
op1 = ops1[i1++];
op2 = { retain: op2l - op1l };
}
} else if (op1.insert && op2.delete) {
if (op1.insert.slice(0, minl) !== op2.delete.slice(0, minl)) {
throw new Error("Successive operations must delete what has been inserted before.");
}
if (op1l > op2l) {
op1 = { insert: op1.insert.slice(op2l) };
op2 = ops2[i2++];
} else if (op1l === op2l) {
op1 = ops1[i1++];
op2 = ops2[i2++];
} else {
op1 = ops1[i1++];
op2 = { delete: op2.delete.slice(op1l) };
}
} else if (op1.insert && op2.retain) {
if (op1l > op2l) {
operation.insert(op1.insert.slice(0, op2l));
op1 = { insert: op1.insert.slice(op2l) };
op2 = ops2[i2++];
} else if (op1l === op2l) {
operation.insert(op1.insert);
op1 = ops1[i1++];
op2 = ops2[i2++];
} else {
operation.insert(op1.insert);
op1 =ops1[i1++];
op2 = { retain: op2l - op1l };
}
} else if (op1.retain && op2.delete) {
if (op1l > op2l) {
operation.delete(op2.delete);
op1 = { retain: op1l - op2l };
op2 = ops2[i2++];
} else if (op1l === op2l) {
operation.delete(op2.delete);
op1 = ops1[i1++];
op2 = ops2[i2++];
} else {
operation.delete(op2.delete.slice(0, op1l));
op1 = ops1[i1++];
op2 = { delete: op2.delete.slice(op1l) };
}
} else if (op1.delete) {
operation.delete(op1.delete);
op1 = ops1[i1++];
} else if (op2.insert) {
operation.insert(op2.insert);
op2 = ops2[i2++];
} else {
throw new Error(
"This shouldn't happen: op1: " +
JSON.stringify(op1) + ", op2: " +
JSON.stringify(op2)
);
}
}
return operation;
};
// Transform takes two operations A and B that happened concurrently and
// produces two operations A' and B' (in an arry) such that
// apply(apply(S, A), B') = apply(apply(S, B), A'). This function is the heart
// of OT.
Operation.transform = function (operation1, operation2) {
if (operation1.baseLength !== operation2.baseLength) {
throw new Error("Both operations have to have the same base length");
}
if (operation1.revision !== operation2.revision) {
throw new Error("Both operations have to have the same revision");
}
// Use the IDs of the two input operations. This enables clients to
// recognize their own operations when they receive operations from the
// server.
var operation1prime = new Operation(operation2.revision + 1, operation1.id, operation1.meta);
var operation2prime = new Operation(operation1.revision + 1, operation2.id, operation2.meta);
var ops1 = operation1.ops, ops2 = operation2.ops;
var i1 = 0, i2 = 0;
var op1 = ops1[i1++], op2 = ops2[i2++];
while (true) {
// At every iteration of the loop, the imaginary cursor that both
// operation1 and operation2 have that operates on the input string must
// have the same position in the input string.
var op1l = op1 && (op1.retain || (op1.insert || op1.delete).length);
var op2l = op2 && (op2.retain || (op2.insert || op2.delete).length);
var minl = Math.min(op1l, op2l);
if (typeof op1 === 'undefined' && typeof op2 === 'undefined') {
// end condition: both ops1 and ops2 have been processed
break;
// next two cases: one or both ops are insert ops
// => insert the string in the corresponding prime operation, skip it in
// the other one
// If both op1 and op2 are insert ops, prefer op1.
} else if (op1 && op1.insert) {
operation1prime.insert(op1.insert);
operation2prime.retain(op1.insert.length);
op1 = ops1[i1++];
} else if (op2 && op2.insert) {
operation1prime.retain(op2.insert.length);
operation2prime.insert(op2.insert);
op2 = ops2[i2++];
} else if (op1.retain && op2.retain) {
// Simple case: retain/retain
operation1prime.retain(minl);
operation2prime.retain(minl);
if (op1l > op2l) {
op1 = { retain: op1l - op2l };
op2 = ops2[i2++];
} else if (op1l === op2l) {
op1 = ops1[i1++];
op2 = ops2[i2++];
} else {
op1 = ops1[i1++];
op2 = { retain: op2l - op1l };
}
} else if (op1.delete && op2.delete) {
if (op1.delete.slice(0, minl) !== op2.delete.slice(0, minl)) {
throw new Error("When two concurrent operations delete text at the same position, they must delete the same text");
}
// Both operations delete the same string at the same position. We don't
// need to produce any operations, we just skip over the delete ops and
// handle the case that one operation deletes more than the other.
if (op1l > op2l) {
op1 = { delete: op1.delete.slice(op2l) };
op2 = ops2[i2++];
} else if (op1l === op2l) {
op1 = ops1[i1++];
op2 = ops2[i2++];
} else {
op1 = ops1[i1++];
op2 = { delete: op2.delete.slice(op1l) };
}
// next two cases: delete/retain and retain/delete
} else if (op1.delete && op2.retain) {
operation1prime.delete(op1.delete.slice(0, minl));
if (op1l > op2l) {
op1 = { delete: op1.delete.slice(op2l) };
op2 = ops2[i2++];
} else if (op1l === op2l) {
op1 = ops1[i1++];
op2 = ops2[i2++];
} else {
op1 = ops1[i1++];
op2 = { retain: op2.retain - op1l };
}
} else if (op1.retain && op2.delete) {
operation2prime.delete(op2.delete.slice(0, minl));
if (op1l > op2l) {
op1 = { retain: op1.retain - op2l };
op2 = ops2[i2++];
} else if (op1l === op2l) {
op1 = ops1[i1++];
op2 = ops2[i2++];
} else {
op1 = ops1[i1++];
op2 = { delete: op2.delete.slice(op1l) };
}
} else {
throw new Error("The two operations aren't compatible");
}
}
return [operation1prime, operation2prime];
};
// Expects the first argument to be truthy. Raises an error otherwise.
function assert (b, msg) {
if (!b) {
throw new Error(msg || "assertion error");
}
}
// Pick a random integer uniformally from the interval [0;n[
function randomInt (n) {
return Math.floor(Math.random() * n);
}
// Generate a random ID consisting of 16 hex digits.
function randomID () {
var id = '';
var n = 16;
while (n--) {
id += randomInt(16).toString(16);
}
return id;
}
return Operation;
})();
// Export for CommonJS
if (typeof module === 'object') {
module.exports = ot.Operation;
}// translation of https://github.com/djspiewak/cccp/blob/master/agent/src/main/scala/com/codecommit/cccp/agent/state.scala
if (typeof ot === 'undefined') {
var ot = {};
}
ot.Client = (function (global) {
var Operation = global.ot ? global.ot.Operation : require('./operation');
// Object that can be mixed into a constructor's prototype object. Requires a
// 'states' property that is an object containing the possible states of the
// object with the associated method definitions and a 'state' property
// containing the name of the current state as a string.
var StateMachine = {
callMethodForState: function (method) {
var args = Array.prototype.slice.call(arguments, 1);
return this.states[this.state][method].apply(this, args);
},
// Transitions to a new state given by the first argument. Calls the exit
// method of the old state first and calls the enter method of the new state
// with the rest of the arguments.
transitionTo: function (name) {
var args = Array.prototype.slice.call(arguments, 1);
this.states[this.state].exit.apply(this, []);
this.states[this.state = name].enter.apply(this, args);
}
};
// Client constructor
function Client (revision) {
assert(typeof revision === 'number' && revision >= 0);
this.serverRevision = revision; // the next expected revision number
this.state = 'synchronized'; // start in 'synchronized' state
}
extend(Client.prototype, StateMachine);
// Creates a new Operation that has the right revision number
Client.prototype.createOperation = function () {
return new Operation(this.callMethodForState('newRevision'));
};
// Call this method when the user changes the document.
Client.prototype.applyClient = function (operation) {
return this.callMethodForState('applyClient', operation);
};
// Call this method with a new operation from the server
Client.prototype.applyServer = function (operation) {
assert(operation.revision === this.serverRevision);
this.callMethodForState('applyServer', operation);
this.serverRevision++;
};
// Override this method.
Client.prototype.sendOperation = function (operation) {
throw new Error("sendOperation must be defined in child class");
};
// Override this method.
Client.prototype.applyOperation = function (operation) {
throw new Error("applyOperation must be defined in child class");
};
Client.prototype.states = {
// In the 'synchronized' state, there is no pending operation that the client
// has sent to the server.
synchronized: {
enter: function () {},
exit: function () {},
// When the user makes an edit, send the operation to the server and
// switch to the 'awaitingConfirm' state
applyClient: function (operation) {
this.sendOperation(operation);
this.transitionTo('awaitingConfirm', operation);
},
// When we receive a new operation from the server, the operation can be
// simply applied to the current document
applyServer: function (operation) {
this.applyOperation(operation);
},
newRevision: function () {
return this.serverRevision;
}
},
// In the 'awaitingConfirm' state, there's one operation the client has sent
// to the server and is still waiting for an acknoledgement.
awaitingConfirm: {
enter: function (outstanding) {
// Save the pending operation
this.outstanding = outstanding;
},
exit: function () {
delete this.outstanding;
},
// When the user makes an edit, don't send the operation immediately,
// instead switch to 'awaitingWithBuffer' state
applyClient: function (operation) {
assert(operation.revision === this.serverRevision + 1);
this.transitionTo('awaitingWithBuffer', this.outstanding, operation);
},
applyServer: function (operation) {
if (operation.id === this.outstanding.id) {
// The client's operation has been acknowledged
// => switch to synchronized state
this.transitionTo('synchronized');
} else {
// This is another client's operation. Visualization:
//
// /\
// this.outstanding / \ operation
// / \
// \ /
// pair[1] \ / pair[0] (new this.outstanding)
// (can be applied \/
// to the client's
// current document)
var pair = Operation.transform(this.outstanding, operation);
this.outstanding = pair[0];
this.applyOperation(pair[1]);
}
},
newRevision: function () {
return this.serverRevision + 1;
}
},
// In the 'awaitingWithBuffer' state, the client is waiting for an operation
// to be acknoledged by the server while buffering the edits the user makes
awaitingWithBuffer: {
enter: function (outstanding, buffer) {
// Save the pending operation and the user's edits since then
this.outstanding = outstanding;
this.buffer = buffer;
},
exit: function () {
delete this.outstanding;
delete this.buffer;
},
applyClient: function (operation) {
// Compose the user's changes into the buffer
assert(operation.revision === this.serverRevision + 2);
this.buffer = this.buffer.compose(operation);
},
applyServer: function (operation) {
if (operation.id === this.outstanding.id) {
// The pending operation has been acknowledged
// => send buffer
this.sendOperation(this.buffer);
this.transitionTo('awaitingConfirm', this.buffer);
} else {
// Operation comes from another client
//
// /\
// this.outstanding / \ operation
// / \
// /\ /
// this.buffer / \* / pair1[0] (new this.outstanding)
// / \/
// \ /
// pair2[1] \ / pair2[0] (new this.buffer)
// the transformed \/
// operation -- can
// be applied to the
// client's current
// document
//
// * pair1[1]
var pair1 = Operation.transform(this.outstanding, operation);
this.outstanding = pair1[0];
var operationPrime = pair1[1];
var pair2 = Operation.transform(this.buffer, operationPrime);
this.buffer = pair2[0];
this.applyOperation(pair2[1]);
}
},
newRevision: function () {
return this.serverRevision + 2;
}
}
};
// Copies all non-inherited key-value pairs of source to target.
function extend (target, source) {
for (var name in source) {
if (source.hasOwnProperty(name)) {
target[name] = source[name];
}
}
}
// Throws an error if the first argument is falsy. Useful for debugging.
function assert (b, msg) {
if (!b) {
throw new Error(msg || "assertion error");
}
}
return Client;
})(this);
if (typeof module === 'object') {
module.exports = ot.Client;
}(function () {
// Monkey patching, yay!
// The oldValue is needed to find
ot.Operation.prototype.fromCodeMirrorChange = function (change, oldValue) {
var operation = this;
// Holds the current value
var lines = oldValue.split('\n');
// Given a { line, ch } object, return the index into the string represented
// by the current lines object.
function indexFromPos (pos) {
var line = pos.line, ch = pos.ch;
var index = 0;
for (var i = 0; i < pos.line; i++) {
index += lines[i].length + 1;
}
index += ch;
return index;
}
// The number of characters in the current lines array + number of newlines.
function getLength () {
var length = 0;
for (var i = 0, l = lines.length; i < l; i++) {
length += lines[i].length;
}
return length + lines.length - 1; // include '\n's
}
// Returns the substring of the current lines array in the range given by
// 'from' and 'to' which must be { line, ch } objects
function getRange (from, to) {
// Precondition: to ">" from
if (from.line === to.line) {
return lines[from.line].slice(from.ch, to.ch);
}
var str = lines[from.line].slice(from.ch) + '\n';
for (var i = from.line + 1; i < to.line; i++) {
str += lines[i] + '\n';
}
str += lines[to.line].slice(0, to.ch);
return str;
}
// Replace the range defined by 'from' and 'to' by 'text' (array of lines).
// Alters the lines array.
function replaceRange (text, from, to) {
// Precondition: to ">" from
var strLines = text.slice(0); // copy
var pre = lines[from.line].slice(0, from.ch);
var post = lines[to.line].slice(to.ch);
strLines[0] = pre + strLines[0];
strLines[strLines.length-1] += post;
strLines.unshift(to.line - from.line + 1); // 2nd positional parameter
strLines.unshift(from.line); // 1st positional parameter
lines.splice.apply(lines, strLines);
}
// Convert a single CodeMirror change to an operation. Assumes that lines
// represents the state of the document before the CodeMirror change took
// place. Alters the lines array so that it represents the document's
// content after the change.
function generateOperation (operation, change) {
var from = indexFromPos(change.from);
var to = indexFromPos(change.to);
var length = getLength();
operation.retain(from);
operation.delete(getRange(change.from, change.to));
operation.insert(change.text.join('\n'));
operation.retain(length - to);
replaceRange(change.text, change.from, change.to);
}
// Convert the first element of the linked list of changes to an operation.
generateOperation(operation, change);
//oldValue = operation.apply(oldValue);
//assert(oldValue === lines.join('\n'));
// handle lists of operations by doing a left-fold over the linked list,
// convert each change to an operation and composing it.
while (true) {
//assert(operation.targetLength === getLength());
change = change.next;
if (!change) { break; }
var nextOperation = new ot.Operation(operation.revision + 1);
generateOperation(nextOperation, change);
//oldValue = nextOperation.apply(oldValue);
//assert(oldValue === lines.join('\n'));
operation = operation.compose(nextOperation);
}
return operation;
};
// Apply an operation to a CodeMirror instance.
ot.Operation.prototype.applyToCodeMirror = function (cm) {
var operation = this;
cm.operation(function () {
var ops = operation.ops;
var index = 0; // holds the current index into CodeMirror's content
for (var i = 0, l = ops.length; i < l; i++) {
var op = ops[i];
if (op.retain) {
index += op.retain;
} else if (op.insert) {
cm.replaceRange(op.insert, cm.posFromIndex(index));
index += op.insert.length;
} else if (op.delete) {
var from = cm.posFromIndex(index);
var to = cm.posFromIndex(index + op.delete.length);
// Check if the deleted characters match CodeMirror's content
assert(cm.getRange(from, to) === op.delete);
cm.replaceRange('', from, to);
}
}
// Check that the operation spans the whole content
assert(index === cm.getValue().length);
});
};
// Throws an error if the first argument is falsy. Useful for debugging.
function assert (b, msg) {
if (!b) {
throw new Error(msg || "assertion error");
}
}
})();ot.CodeMirrorClient = (function () {
var Client = ot.Client;
var Operation = ot.Operation;
function CodeMirrorClient (socket, cm) {
this.socket = socket;
this.cm = cm;
this.fromServer = false;
this.unredo = false;
this.undoStack = [];
this.redoStack = [];
this.clients = {};
this.initializeClientList();
var self = this;
socket.on('doc', function (obj) {
Client.call(self, obj.revision);
self.initializeCodeMirror(obj.str);
self.initializeSocket();
self.initializeClients(obj.clients);
});
}
inherit(CodeMirrorClient, Client);
CodeMirrorClient.prototype.applyClient = function (operation) {
operation.meta.cursor = this.cursor;
operation.meta.selectionEnd = this.selectionEnd;
clearTimeout(this.sendCursorTimeout);
Client.prototype.applyClient.call(this, operation);
};
CodeMirrorClient.prototype.applyServer = function (operation) {
var isOutstandingOperation = this.outstanding && this.outstanding.id === operation.id;
Client.prototype.applyServer.call(this, operation);
if (!isOutstandingOperation) {
var meta = operation.meta;
this.updateClientCursor(meta.clientId, meta.cursor, meta.selectionEnd);
this.transformUnredoStack(this.undoStack, operation);
this.transformUnredoStack(this.redoStack, operation);
}
};
CodeMirrorClient.prototype.initializeSocket = function () {
var self = this;
this.socket
.on('client_left', function (obj) {
self.onClientLeft(obj.clientId);
})
.on('set_name', function (obj) {
self.onSetName(obj.clientId, obj.name);
})
.on('operation', function (operationObj) {
var operation = Operation.fromJSON(operationObj);
console.log("Operation from server by client " + operation.meta.clientId + ":", operation);
self.applyServer(operation);
})
.on('cursor', function (update) {
self.updateClientCursor(update.clientId, update.cursor, update.selectionEnd);
});
};
CodeMirrorClient.prototype.getClientObject = function (clientId) {
var client = this.clients[clientId];
if (client) { return client; }
client = this.clients[clientId] = { clientId: clientId };
this.initializeClient(client);
return client;
};
CodeMirrorClient.prototype.onClientLeft = function (clientId) {
console.log("User disconnected: " + clientId);
var client = this.clients[clientId];
if (!client) { return; }
if (client.li) { removeElement(client.li); }
if (client.cursorEl) { removeElement(client.cursorEl); }
if (client.mark) { client.mark.clear(); }
delete this.clients[clientId];
};
CodeMirrorClient.prototype.onSetName = function (clientId, name) {
var client = this.getClientObject(clientId);
client.name = name;
var oldLi = client.li;
var newLi = client.li = this.createClientListItem(client);
if (oldLi) {
this.clientListEl.replaceChild(newLi, oldLi);
} else {
this.clientListEl.appendChild(newLi);
}
};
CodeMirrorClient.prototype.initializeCodeMirror = function (str) {
var cm = this.cm;
var self = this;
cm.setValue(str);
this.oldValue = str;
var oldOnChange = cm.getOption('onChange');
cm.setOption('onChange', function (_, change) {
self.onCodeMirrorChange(change);
if (oldOnChange) { oldOnChange.call(this, cm, change); }
});
var oldOnCursorActivity = cm.getOption('onCursorActivity');
cm.setOption('onCursorActivity', function (_) {
self.onCodeMirrorCursorActivity();
if (oldOnCursorActivity) { oldOnCursorActivity.call(this, cm); }
});
cm.undo = function () { self.undo(); };
cm.redo = function () { self.redo(); };
};
CodeMirrorClient.prototype.initializeClients = function (clients) {
for (var clientId in clients) {
if (clients.hasOwnProperty(clientId)) {
var client = clients[clientId];
console.log(clientId, client);
client.clientId = clientId;
this.clients[clientId] = client;
this.initializeClient(client);
}
}
};
CodeMirrorClient.prototype.initializeClientList = function () {
this.clientListEl = document.createElement('ul');
};
function rgb2hex (r, g, b) {
function digits (n) {
var m = Math.round(255*n).toString(16);
return m.length === 1 ? '0'+m : m;
}
return '#' + digits(r) + digits(g) + digits(b);
}
function hsl2hex (h, s, l) {
if (s === 0) { return rgb2hex(l, l, l); }
var var2 = l < 0.5 ? l * (1+s) : (l+s) - (s*l);
var var1 = 2 * l - var2;
var hue2rgb = function (hue) {
if (hue < 0) { hue += 1; }
if (hue > 1) { hue -= 1; }
if (6*hue < 1) { return var1 + (var2-var1)*6*hue; }
if (2*hue < 1) { return var2; }
if (3*hue < 2) { return var1 + (var2-var1)*6*(2/3 - hue); }
return var1;
};
return rgb2hex(hue2rgb(h+1/3), hue2rgb(h), hue2rgb(h-1/3));
}
CodeMirrorClient.prototype.initializeClient = function (client) {
console.log("initializeClient");
client.hue = Math.random();
client.color = hsl2hex(client.hue, 0.75, 0.5);
client.lightColor = hsl2hex(client.hue, 0.5, 0.9);
if (client.name) {
client.li = this.createClientListItem(client);
this.clientListEl.appendChild(client.li);
}
this.createClientCursorEl(client);
this.updateClientCursorElPosition(client);
this.createClientSelectionStyleRule(client);
this.updateClientMark(client);
};
CodeMirrorClient.prototype.createClientListItem = function (client) {
var el = document.createElement('li');
el.style.color = client.color;
el.appendChild(document.createTextNode(client.name));
return el;
};
function randomInt (n) {
return Math.floor(Math.random() * n);
}
CodeMirrorClient.prototype.createClientSelectionStyleRule = function (client) {
client.selectionClassName = 'client-selection-' + randomInt(1e6);
var selector = '.' + client.selectionClassName;
var styles = 'background:' + client.lightColor + ';';
var rule = selector + '{' + styles + '}';
try {
var styleSheet = document.styleSheets.item(0);
styleSheet.insertRule(rule, styleSheet.rules.length);
} catch (exc) {
console.error("Couldn't add style rule for client selections.", exc);
}
};
function cleanNoops (stack) {
function isNoop (operation) {
var ops = operation.ops;
return ops.length === 0 || (ops.length === 1 && !!ops[0].retain);
}
while (stack.length > 0) {
var operation = stack[stack.length - 1];
if (isNoop(operation)) {
stack.pop();
} else {
break;
}
}
}
var UNDO_DEPTH = 20;
function cursorIndexAfterOperation (operation) {
// TODO
var ops = operation.ops;
if (ops[0].retain) {
var index = ops[0].retain;
if (ops[1].insert) {
return index + ops[1].insert.length;
} else {
return index;
}
} else if (ops[0].insert) {
return ops[0].insert.length;
} else {
return 0;
}
}
CodeMirrorClient.prototype.unredoHelper = function (sourceStack, targetStack) {
cleanNoops(sourceStack);
if (sourceStack.length === 0) { return; }
var operation = sourceStack.pop();
operation.revision = this.createOperation().revision;
targetStack.push(operation.invert());
this.unredo = true;
operation.applyToCodeMirror(this.cm);
this.cursor = this.selectionEnd = cursorIndexAfterOperation(operation);
this.cm.setCursor(this.cm.posFromIndex(this.cursor));
this.applyClient(operation);
};
CodeMirrorClient.prototype.transformUnredoStack = function (stack, operation) {
cleanNoops(stack);
for (var i = stack.length - 1; i >= 0; i--) {
stack[i].revision = operation.revision;
var transformedPair = Operation.transform(stack[i], operation);
stack[i] = transformedPair[0];
operation = transformedPair[1];
}
};
CodeMirrorClient.prototype.addOperationToUndo = function (operation) {
function isSimpleOperation (operation, fn) {
var ops = operation.ops;
switch (ops.length) {
case 0: return true;
case 1: return !!fn(ops[0]);
case 2: return !!((ops[0].retain && fn(ops[1])) || (fn(ops[0]) && ops[1].retain));
case 3: return !!(ops[0].retain && fn(ops[1]) && ops[2].retain);
default: return false;
}
}
function isSimpleInsert (operation) {
return isSimpleOperation(operation, function (op) { return op.insert; });
}
function isSimpleDelete (operation) {
return isSimpleOperation(operation, function (op) { return op.delete; });
}
function shouldBeComposed (a, b) {
if (isSimpleInsert(a) && isSimpleInsert(b)) {
return isSimpleInsert(a.compose(b));
} else if (isSimpleDelete(a) && isSimpleDelete(b)) {
var opA = a.ops[0], opsB = b.ops;
if (!opA.retain) { return false; }
if (opsB[0].delete) {
return opA.retain === opsB[0].delete.length;
} else {
return opA.retain === opsB[0].retain + opsB[1].delete.length;
}
}
return false;
}
if (this.undoStack.length === 0) {
this.undoStack.push(operation);
} else {
var lastOperation = this.undoStack[this.undoStack.length - 1];
lastOperation.revision = operation.revision + 1;
if (shouldBeComposed(operation, lastOperation)) {
var composed = operation.compose(lastOperation);
this.undoStack[this.undoStack.length - 1] = composed;
} else {
this.undoStack.push(operation);
if (this.undoStack.length > UNDO_DEPTH) {
this.undoStack.shift();
}
}
}
if (this.redoStack.length > 0) { this.redoStack = []; }
};
CodeMirrorClient.prototype.undo = function () {
this.unredoHelper(this.undoStack, this.redoStack);
};
CodeMirrorClient.prototype.redo = function () {
this.unredoHelper(this.redoStack, this.undoStack);
};
CodeMirrorClient.prototype.createClientCursorEl = function (client) {
var el = client.cursorEl = document.createElement('div');
el.className = 'other-client';
var pre = document.createElement('pre');
pre.style.borderLeftColor = client.color;
pre.innerHTML = ' ';
el.appendChild(pre);
//el.appendChild(document.createTextNode(client.name));
};
CodeMirrorClient.prototype.updateClientCursor = function (clientId, cursor, selectionEnd) {
console.log(name + " moved his/her cursor: " + cursor);
var client = this.getClientObject(clientId);
client.cursor = cursor;
client.selectionEnd = selectionEnd;
this.updateClientCursorElPosition(client);
this.updateClientMark(client);
};
CodeMirrorClient.prototype.updateClientCursorElPosition = function (client) {
var pos = cm.posFromIndex(client.cursor);
removeElement(client.cursorEl);
this.cm.addWidget(pos, client.cursorEl, false);
};
CodeMirrorClient.prototype.updateClientMark = function (client) {
if (client.mark) {
client.mark.clear();
delete client.mark;
}
if (client.selectionEnd !== client.cursor) {
var from = Math.min(client.cursor, client.selectionEnd);
var to = Math.max(client.cursor, client.selectionEnd);
var fromPos = cm.posFromIndex(from);
var toPos = cm.posFromIndex(to);
client.mark = this.cm.markText(fromPos, toPos, client.selectionClassName);
}
};
CodeMirrorClient.prototype.onCodeMirrorChange = function (change) {
var cm = this.cm;
try {
if (!this.fromServer && !this.unredo) {
var operation = this.createOperation()
.fromCodeMirrorChange(change, this.oldValue);
this.addOperationToUndo(operation.invert());
this.applyClient(operation);
}
} finally {
this.fromServer = false;
this.unredo = false;
this.oldValue = cm.getValue();
}
};
CodeMirrorClient.prototype.onCodeMirrorCursorActivity = function () {
var cm = this.cm;
function eqPos (a, b) {
return a.line === b.line && a.ch === b.ch;
}
var cursorPos = cm.getCursor();
var cursor = cm.indexFromPos(cursorPos);
var selectionEnd;
if (cm.somethingSelected()) {
var startPos = cm.getCursor(true);
var selectionEndPos = eqPos(cursorPos, startPos) ? cm.getCursor(false) : startPos;
selectionEnd = cm.indexFromPos(selectionEndPos);
} else {
selectionEnd = cursor;
}
this.cursor = cursor;
this.selectionEnd = selectionEnd;
if (this.state === 'awaitingWithBuffer') {
this.buffer.meta.cursor = cursor;
this.buffer.meta.selectionEnd = selectionEnd;
} else {
var self = this;
clearTimeout(this.sendCursorTimeout);
this.sendCursorTimeout = setTimeout(function () {
self.socket.emit('cursor', {
cursor: cursor,
selectionEnd: selectionEnd
});
}, 50);
}
};
CodeMirrorClient.prototype.sendOperation = function (operation) {
this.socket.emit('operation', operation);
};
CodeMirrorClient.prototype.applyOperation = function (operation) {
this.fromServer = true;
operation.applyToCodeMirror(this.cm);
};
// Set Const.prototype.__proto__ to Super.prototype
function inherit (Const, Super) {
function F () {}
F.prototype = Super.prototype;
Const.prototype = new F();
Const.prototype.constructor = Const;
}
// Remove an element from the DOM.
function removeElement (el) {
if (el.parentNode) {
el.parentNode.removeChild(el);
}
}
return CodeMirrorClient;
})(); |
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
function CommonsChunkPlugin(options, filenameTemplate, selectedChunks, minChunks) {
if(options && typeof options === "object" && !Array.isArray(options)) {
this.chunkNames = options.name || options.names;
this.filenameTemplate = options.filename;
this.minChunks = options.minChunks;
this.selectedChunks = options.chunks;
if(options.children) this.selectedChunks = false;
this.async = options.async;
this.minSize = options.minSize;
} else {
var chunkNames = options;
if(typeof filenameTemplate !== "string" && filenameTemplate !== null) {
minChunks = selectedChunks;
selectedChunks = filenameTemplate;
filenameTemplate = chunkNames;
}
if(!Array.isArray(selectedChunks) && typeof selectedChunks !== "boolean" && selectedChunks !== null) {
minChunks = selectedChunks;
selectedChunks = undefined;
}
this.chunkNames = chunkNames;
this.filenameTemplate = filenameTemplate;
this.minChunks = minChunks;
this.selectedChunks = selectedChunks;
}
}
module.exports = CommonsChunkPlugin;
CommonsChunkPlugin.prototype.apply = function(compiler) {
var chunkNames = this.chunkNames;
var filenameTemplate = this.filenameTemplate;
var minChunks = this.minChunks;
var selectedChunks = this.selectedChunks;
var async = this.async;
var minSize = this.minSize;
compiler.plugin("this-compilation", function(compilation) {
compilation.plugin(["optimize-chunks", "optimize-extracted-chunks"], function(chunks) {
var commonChunks;
if(!chunkNames && (selectedChunks === false || async)) {
commonChunks = chunks;
} else if(Array.isArray(chunkNames)) {
commonChunks = chunkNames.map(function(chunkName) {
return chunks.filter(function(chunk) {
return chunk.name === chunkName;
})[0];
});
} else {
commonChunks = chunks.filter(function(chunk) {
return chunk.name === chunkNames;
});
}
if(commonChunks.length === 0) {
var chunk = this.addChunk(chunkNames);
chunk.initial = chunk.entry = true;
commonChunks = [chunk];
}
commonChunks.forEach(function processCommonChunk(commonChunk, idx) {
var commonModulesCount = [];
var commonModules = [];
var usedChunks;
if(Array.isArray(selectedChunks)) {
usedChunks = chunks.filter(function(chunk) {
if(chunk === commonChunk) return false;
return selectedChunks.indexOf(chunk.name) >= 0;
});
} else if(selectedChunks === false || async) {
usedChunks = (commonChunk.chunks || []).filter(function(chunk) {
// we can only move modules from this chunk if the "commonChunk" is the only parent
return async || chunk.parents.length === 1;
});
} else {
if(!commonChunk.entry) {
compilation.errors.push(new Error("CommonsChunkPlugin: While running in normal mode it's not allowed to use a non-entry chunk (" + commonChunk.name + ")"));
return;
}
usedChunks = chunks.filter(function(chunk) {
var found = commonChunks.indexOf(chunk);
if(found >= idx) return false;
return chunk.entry;
});
}
if(async) {
var asyncChunk = this.addChunk(typeof async === "string" ? async : undefined);
asyncChunk.chunkReason = "async commons chunk";
asyncChunk.extraAsync = true;
asyncChunk.addParent(commonChunk);
commonChunk.addChunk(asyncChunk);
commonChunk = asyncChunk;
}
usedChunks.forEach(function(chunk) {
chunk.modules.forEach(function(module) {
var idx = commonModules.indexOf(module);
if(idx < 0) {
commonModules.push(module);
commonModulesCount.push(1);
} else {
commonModulesCount[idx]++;
}
});
});
var reallyUsedChunks = [];
var reallyUsedModules = [];
commonModulesCount.forEach(function(count, idx) {
var module = commonModules[idx];
if(typeof minChunks === "function") {
if(!minChunks(module, count))
return;
} else if(count < (minChunks || Math.max(2, usedChunks.length))) {
return;
}
reallyUsedModules.push(module);
});
if(minSize) {
var size = reallyUsedModules.reduce(function(a, b) {
return a + b.size();
}, 0);
if(size < minSize)
return;
}
reallyUsedModules.forEach(function(module) {
usedChunks.forEach(function(chunk) {
if(module.removeChunk(chunk)) {
if(reallyUsedChunks.indexOf(chunk) < 0)
reallyUsedChunks.push(chunk);
}
});
commonChunk.addModule(module);
module.addChunk(commonChunk);
});
if(async) {
reallyUsedChunks.forEach(function(chunk) {
if(chunk.initial || chunk.entry)
return;
chunk.blocks.forEach(function(block) {
block.chunks.unshift(commonChunk);
commonChunk.addBlock(block);
});
});
asyncChunk.origins = reallyUsedChunks.map(function(chunk) {
return chunk.origins.map(function(origin) {
var newOrigin = Object.create(origin);
newOrigin.reasons = (origin.reasons || []).slice();
newOrigin.reasons.push("async commons");
return newOrigin;
});
}).reduce(function(arr, a) {
arr.push.apply(arr, a);
return arr;
}, []);
} else {
usedChunks.forEach(function(chunk) {
chunk.parents = [commonChunk];
commonChunk.chunks.push(chunk);
if(chunk.initial)
commonChunk.initial = true;
if(chunk.entry) {
commonChunk.entry = true;
chunk.entry = false;
}
});
}
if(filenameTemplate)
commonChunk.filenameTemplate = filenameTemplate;
}, this);
});
});
};
|
loadIonicon('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M441.8 120.1l-49.9-49.9c-8.3-8.3-21.8-8.3-30.1 0l-66.6 66.6L254.1 96 224 126.1l30.3 30.3L64 346.7V448h101.3l190.3-190.3 30.3 30.3 30.1-30.1-41-41 66.6-66.6c8.5-8.4 8.5-21.8.2-30.2zM147.6 405.4l-41-41 171.9-171.9 41 41-171.9 171.9z"/></svg>','md-color-filter'); |
Prism.languages.bro = {
'comment': {
pattern: /(^|[^\\$])#.*/,
lookbehind: true,
inside: {
'italic': /\b(TODO|FIXME|XXX)\b/
}
},
'string': {
pattern: /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
'boolean': /\b(T|F)\b/,
'function': {
pattern: /(?:function|hook|event) [a-zA-Z0-9_]+(::[a-zA-Z0-9_]+)?/,
inside: {
keyword: /^(?:function|hook|event)/
}
},
'variable': {
pattern: /(?:global|local) [a-zA-Z0-9_]+/i,
inside: {
keyword: /(?:global|local)/
}
},
'builtin':
/(@(load(-(sigs|plugin))?|unload|prefixes|ifn?def|else|(end)?if|DIR|FILENAME))|(&?(redef|priority|log|optional|default|add_func|delete_func|expire_func|read_expire|write_expire|create_expire|synchronized|persistent|rotate_interval|rotate_size|encrypt|raw_output|mergeable|group|error_handler|type_column))/,
'constant': {
pattern: /const [a-zA-Z0-9_]+/i,
inside: {
keyword: /const/
}
},
'keyword':
/\b(break|next|continue|alarm|using|of|add|delete|export|print|return|schedule|when|timeout|addr|any|bool|count|double|enum|file|int|interval|pattern|opaque|port|record|set|string|subnet|table|time|vector|for|if|else|in|module|function)\b/,
'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&|\|\|?|\?|\*|\/|~|\^|%/,
'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,
'punctuation': /[{}[\];(),.:]/
};
|
/*! iGrowl v3.0.1
Copyright (c) 2014 Catalin Covic
https://github.com/catc
*/
;( function($) {
'use strict';
var animStart = 'webkitAnimationStart oanimationstart MSAnimationStart animationstart',
animEnd = 'webkitAnimationEnd oanimationend MSAnimationEnd animationend',
growlTemplate = '<div class="igrowl animated" role="alert"><div class="igrowl-text"></div><button class="igrowl-dismiss i-times"></button></div>';
var iGrowl = function(options){
options = $.extend(true, {}, $.iGrowl.prototype.defaults, options);
this.options = options;
this.template = setContent(options);
render.call(this);
return this;
},
// builds notification (title, message, icon)
setContent = function(options){
// if no title or message, throw error
if ( !options.title && !options.message ) throw new Error('You must enter at least a title or message.');
var template = $(growlTemplate);
// small
if ( options.small ) { template.addClass('igrowl-small'); }
// type
template.addClass('igrowl-'+options.type);
// image / icon
if ( options.image.src ) {
template.prepend('<div class="igrowl-img '+ options.image.class +'"><img src="'+ options.image.src +'"</div>');
} else if (options.icon) {
template.prepend('<div class="igrowl-icon i-'+ options.icon + '"></div>');
}
// title + message
if ( options.title ) template.find('.igrowl-text').prepend('<div class="igrowl-title">' + options.title + '</div>');
if ( options.message ) template.find('.igrowl-text').append('<div class="igrowl-message">' + options.message + '</div>');
// link
if ( options.link ){ template.addClass('igrowl-link').children('.igrowl-icon, .igrowl-text').wrapAll('<a href="' + options.link +'" target="_' + options.target + '" />'); }
template.attr('alert-placement', options.placement.x + ' ' + options.placement.y );
return template;
},
// sets css position and appends to body
render = function(){
var options = this.options,
template = this.template;
var last = $('.igrowl[alert-placement="' + options.placement.x + ' ' + options.placement.y +'"]').last(),
y = options.offset.y,
growl = this;
// vertical alignment - place after last element of type (if it exists)
if ( last.length ) {
y = parseInt( last.css( options.placement.y ), 10) + last.outerHeight() + options.spacing;
}
template.css( options.placement.y, y );
// horizontal alignment
if ( options.placement.x === "center" ) {
template.addClass('igrowl-center');
} else {
template.css( options.placement.x, options.offset.x );
}
$('body').append(template);
// add animation class - if enabled
if ( options.animation ) {
// if animation isn't supported, ensure dismiss controls are activated
var noAnimFallback = setTimeout(function(){
controls.call(growl);
}, 1001);
template
.addClass( options.animShow )
.one(animStart, function(e){
if ( typeof options.onShow === 'function' ) options.onShow();
})
.one(animEnd, function(e) {
controls.call(growl);
// cancel no-animation fallback
clearTimeout(noAnimFallback);
});
} else {
controls.call(growl);
}
},
// sets up auto-dismiss after delay, and dismiss button
controls = function(){
var options = this.options,
template = this.template;
// callback once alert is visible/animation complete
if ( typeof options.onShown === 'function' ) options.onShown();
var growl = this;
// after delay, dismiss alert
if ( options.delay > 0 ){
setTimeout( function(){
growl.dismiss();
}, options.delay);
}
// set up dismiss button
template.find('.igrowl-dismiss').on('click', function(){
growl.dismiss();
});
},
updatePosition = function(){
var options = this.options,
template = $(this.template);
template.nextAll('.igrowl[alert-placement="' + options.placement.x + ' ' + options.placement.y +'"]').each(function(i, alert){
// sets y as: current - ( alert to be dismissed height + alert to be dismissed spacing)
var y = parseInt( $(this).css( options.placement.y ), 10) - template.outerHeight() - options.spacing;
$(alert).css(options.placement.y, y);
});
template.remove();
};
iGrowl.prototype = {
// hides alert
dismiss: function(){
var options = this.options,
template = this.template,
growl = this;
if ( options.animation ) {
this.template
.removeClass( options.animShow )
.addClass( options.animHide )
.one(animStart, function(e){
if ( typeof options.onHide === 'function' ) options.onHide();
})
.one(animEnd, function(e){
if ( typeof options.onHidden === 'function' ) options.onHidden();
updatePosition.call(growl);
});
// fallback in case animation event listener fails
setTimeout( function(){
template.hide();
updatePosition.call(growl);
}, 1500 );
} else {
template.hide();
if ( typeof options.onHidden === 'function' ) options.onHidden();
updatePosition.call(growl);
}
}
};
// initiate growl
$.iGrowl = function(settings){
// generate alert
var growl = new iGrowl (settings);
return growl;
};
// dismiss all alerts
$.iGrowl.prototype.dismissAll = function(placement){
if ( placement === 'all' ) { $('.igrowl button').trigger('click'); }
else { $('.igrowl[alert-placement="'+placement+'"] button').trigger('click'); }
};
// default settings
$.iGrowl.prototype.defaults = {
type : 'info',
title : null,
message : null,
link : null,
target : 'self',
icon : null,
image : {
src : null,
class : null
},
small : false,
delay : 2500,
spacing : 30,
placement : {
x : 'right',
y : 'top'
},
offset : {
x : 20,
y : 20
},
animation : true,
animShow : 'bounceIn',
animHide : 'bounceOut',
onShow : null,
onShown : null,
onHide : null,
onHidden : null,
};
})( jQuery );
|
(function() {
var __slice = [].slice,
__hasProp = {}.hasOwnProperty;
(function(root, factory) {
if (typeof define !== "undefined" && define !== null ? define.amd : void 0) {
return define(factory);
} else if (typeof module !== "undefined" && module !== null ? module.exports : void 0) {
return module.exports = factory();
} else {
return root.Transparency = factory();
}
})(this, function() {
var $, ELEMENT_NODE, Instance, TEXT_NODE, VOID_ELEMENTS, attr, clone, cloneNode, consoleLogger, data, empty, expando, exports, getElementsAndChildNodes, getText, html5Clone, indexOf, isArray, isBoolean, isDate, isDomElement, isPlainValue, isVoidElement, log, matcher, matchingElements, nullLogger, prepareContext, register, render, renderDirectives, setHtml, setSelected, setText, toString;
register = function($) {
return $ != null ? $.fn.render = function(models, directives, config) {
var context, _i, _len;
for (_i = 0, _len = this.length; _i < _len; _i++) {
context = this[_i];
render(context, models, directives, config);
}
return this;
} : void 0;
};
$ = this.jQuery || this.Zepto;
register($);
expando = 'transparency';
data = function(element) {
return element[expando] || (element[expando] = {});
};
nullLogger = function() {};
consoleLogger = function() {
var messages;
messages = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return console.log.apply(console, messages);
};
log = nullLogger;
render = function(context, models, directives, config) {
var children, contextData, e, element, index, instance, key, model, nodeName, parent, sibling, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2;
log = (config != null ? config.debug : void 0) && (typeof console !== "undefined" && console !== null) ? consoleLogger : nullLogger;
log("Context:", context, "Models:", models, "Directives:", directives, "Config:", config);
if (!context) {
return;
}
models || (models = []);
directives || (directives = {});
if (!isArray(models)) {
models = [models];
}
parent = context.parentNode;
if (parent) {
sibling = context.nextSibling;
parent.removeChild(context);
}
prepareContext(context, models);
contextData = data(context);
for (index = _i = 0, _len = models.length; _i < _len; index = ++_i) {
model = models[index];
children = [];
instance = contextData.instances[index];
log("Model:", model, "Template instance for the model:", instance);
_ref = instance.elements;
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
e = _ref[_j];
data(e).model = model;
}
if (isDomElement(model) && (element = instance.elements[0])) {
empty(element).appendChild(model);
} else if (typeof model === 'object') {
for (key in model) {
if (!__hasProp.call(model, key)) continue;
value = model[key];
if (value != null) {
if (isPlainValue(value)) {
_ref1 = matchingElements(instance, key);
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
element = _ref1[_k];
nodeName = element.nodeName.toLowerCase();
if (nodeName === 'input') {
attr(element, 'value', value);
} else if (nodeName === 'select') {
attr(element, 'selected', value);
} else {
attr(element, 'text', value);
}
}
} else if (typeof value === 'object') {
children.push(key);
}
}
}
}
renderDirectives(instance, model, index, directives);
for (_l = 0, _len3 = children.length; _l < _len3; _l++) {
key = children[_l];
_ref2 = matchingElements(instance, key);
for (_m = 0, _len4 = _ref2.length; _m < _len4; _m++) {
element = _ref2[_m];
render(element, model[key], directives[key], config);
}
}
}
if (parent) {
if (sibling) {
parent.insertBefore(context, sibling);
} else {
parent.appendChild(context);
}
}
return context;
};
prepareContext = function(context, models) {
var contextData, instance, n, _i, _len, _ref, _results;
contextData = data(context);
if (!contextData.template) {
contextData.template = cloneNode(context);
contextData.instanceCache = [];
contextData.instances = [new Instance(context)];
}
log("Template", contextData.template);
while (models.length > contextData.instances.length) {
instance = contextData.instanceCache.pop() || new Instance(cloneNode(contextData.template));
_ref = instance.childNodes;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
n = _ref[_i];
context.appendChild(n);
}
contextData.instances.push(instance);
}
_results = [];
while (models.length < contextData.instances.length) {
contextData.instanceCache.push(instance = contextData.instances.pop());
_results.push((function() {
var _j, _len1, _ref1, _results1;
_ref1 = instance.childNodes;
_results1 = [];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
n = _ref1[_j];
_results1.push(n.parentNode.removeChild(n));
}
return _results1;
})());
}
return _results;
};
Instance = (function() {
function Instance(template) {
this.template = template;
this.queryCache = {};
this.elements = [];
this.childNodes = [];
getElementsAndChildNodes(this.template, this.elements, this.childNodes);
}
return Instance;
})();
getElementsAndChildNodes = function(template, elements, childNodes) {
var child, _results;
child = template.firstChild;
_results = [];
while (child) {
if (childNodes != null) {
childNodes.push(child);
}
if (child.nodeType === ELEMENT_NODE) {
elements.push(child);
getElementsAndChildNodes(child, elements);
}
_results.push(child = child.nextSibling);
}
return _results;
};
renderDirectives = function(instance, model, index, directives) {
var attribute, attributes, directive, element, key, value, _results;
if (!directives) {
return;
}
model = typeof model === 'object' ? model : {
value: model
};
_results = [];
for (key in directives) {
if (!__hasProp.call(directives, key)) continue;
attributes = directives[key];
if (typeof attributes === 'object') {
_results.push((function() {
var _i, _len, _ref, _results1;
_ref = matchingElements(instance, key);
_results1 = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
element = _ref[_i];
_results1.push((function() {
var _results2;
_results2 = [];
for (attribute in attributes) {
directive = attributes[attribute];
if (!(typeof directive === 'function')) {
continue;
}
value = directive.call(model, {
element: element,
index: index,
value: attr(element, attribute)
});
_results2.push(attr(element, attribute, value));
}
return _results2;
})());
}
return _results1;
})());
}
}
return _results;
};
setHtml = function(element, html) {
var child, elementData, n, _i, _len, _ref, _results;
elementData = data(element);
if (elementData.html === html) {
return;
}
elementData.html = html;
elementData.children || (elementData.children = (function() {
var _i, _len, _ref, _results;
_ref = element.childNodes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
n = _ref[_i];
if (n.nodeType === ELEMENT_NODE) {
_results.push(n);
}
}
return _results;
})());
empty(element);
element.innerHTML = html;
_ref = elementData.children;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
child = _ref[_i];
_results.push(element.appendChild(child));
}
return _results;
};
setText = function(element, text) {
var elementData, textNode;
elementData = data(element);
if (!(text != null) || elementData.text === text) {
return;
}
elementData.text = text;
textNode = element.firstChild;
if (!textNode) {
return element.appendChild(element.ownerDocument.createTextNode(text));
} else if (textNode.nodeType !== TEXT_NODE) {
return element.insertBefore(element.ownerDocument.createTextNode(text), textNode);
} else {
return textNode.nodeValue = text;
}
};
getText = function(element) {
var child;
return ((function() {
var _i, _len, _ref, _results;
_ref = element.childNodes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
child = _ref[_i];
if (child.nodeType === TEXT_NODE) {
_results.push(child.nodeValue);
}
}
return _results;
})()).join('');
};
setSelected = function(element, value) {
var child, childElements, _i, _len, _results;
childElements = [];
getElementsAndChildNodes(element, childElements);
_results = [];
for (_i = 0, _len = childElements.length; _i < _len; _i++) {
child = childElements[_i];
if (child.nodeName.toLowerCase() === 'option') {
if (child.value === value) {
_results.push(child.selected = true);
} else {
_results.push(child.selected = false);
}
} else {
_results.push(void 0);
}
}
return _results;
};
attr = function(element, attribute, value) {
var elementData, _base, _base1, _base2, _base3;
elementData = data(element);
elementData.originalAttributes || (elementData.originalAttributes = {});
if (element.nodeName.toLowerCase() === 'select' && attribute === 'selected') {
if ((value != null) && typeof value !== 'string') {
value = value.toString();
}
if (value != null) {
setSelected(element, value);
}
} else {
switch (attribute) {
case 'text':
if (!isVoidElement(element)) {
if ((value != null) && typeof value !== 'string') {
value = value.toString();
}
(_base = elementData.originalAttributes)['text'] || (_base['text'] = getText(element));
if (value != null) {
setText(element, value);
}
}
break;
case 'html':
if ((value != null) && typeof value !== 'string') {
value = value.toString();
}
(_base1 = elementData.originalAttributes)['html'] || (_base1['html'] = element.innerHTML);
if (value != null) {
setHtml(element, value);
}
break;
case 'class':
(_base2 = elementData.originalAttributes)['class'] || (_base2['class'] = element.className);
if (value != null) {
element.className = value;
}
break;
default:
(_base3 = elementData.originalAttributes)[attribute] || (_base3[attribute] = element.getAttribute(attribute));
if (value != null) {
element[attribute] = value;
if (isBoolean(value)) {
if (value) {
element.setAttribute(attribute, attribute);
} else {
element.removeAttribute(attribute);
}
} else {
element.setAttribute(attribute, value.toString());
}
}
}
}
if (value != null) {
return value;
} else {
return elementData.originalAttributes[attribute];
}
};
matchingElements = function(instance, key) {
var e, elements, _base;
elements = (_base = instance.queryCache)[key] || (_base[key] = (function() {
var _i, _len, _ref, _results;
_ref = instance.elements;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
e = _ref[_i];
if (exports.matcher(e, key)) {
_results.push(e);
}
}
return _results;
})());
log("Matching elements for '" + key + "':", elements);
return elements;
};
matcher = function(element, key) {
return element.id === key || indexOf(element.className.split(' '), key) > -1 || element.name === key || element.getAttribute('data-bind') === key;
};
clone = function(node) {
return $(node).clone()[0];
};
empty = function(element) {
var child;
while (child = element.firstChild) {
element.removeChild(child);
}
return element;
};
ELEMENT_NODE = 1;
TEXT_NODE = 3;
VOID_ELEMENTS = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
html5Clone = function() {
return document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>";
};
cloneNode = !(typeof document !== "undefined" && document !== null) || html5Clone() ? function(node) {
return node.cloneNode(true);
} : function(node) {
var cloned, element, _i, _len, _ref;
cloned = clone(node);
if (cloned.nodeType === ELEMENT_NODE) {
cloned.removeAttribute(expando);
_ref = cloned.getElementsByTagName('*');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
element = _ref[_i];
element.removeAttribute(expando);
}
}
return cloned;
};
toString = Object.prototype.toString;
isDate = function(obj) {
return toString.call(obj) === '[object Date]';
};
isDomElement = function(obj) {
return obj.nodeType === ELEMENT_NODE;
};
isVoidElement = function(el) {
return indexOf(VOID_ELEMENTS, el.nodeName.toLowerCase()) > -1;
};
isPlainValue = function(obj) {
return isDate(obj) || typeof obj !== 'object' && typeof obj !== 'function';
};
isBoolean = function(obj) {
return obj === true || obj === false;
};
isArray = Array.isArray || function(obj) {
return toString.call(obj) === '[object Array]';
};
indexOf = function(array, item) {
var i, x, _i, _len;
if (array.indexOf) {
return array.indexOf(item);
}
for (i = _i = 0, _len = array.length; _i < _len; i = ++_i) {
x = array[i];
if (x === item) {
return i;
}
}
return -1;
};
return exports = {
render: render,
register: register,
matcher: matcher,
clone: clone
};
});
}).call(this);
|
/*
* DateJS Culture String File
* Country Code: fr-CA
* Name: French (Canada)
* Format: "key" : "value"
* Key is the en-US term, Value is the Key in the current language.
*/
Date.CultureStrings = Date.CultureStrings || {};
Date.CultureStrings["fr-CA"] = {
"name": "fr-CA",
"englishName": "French (Canada)",
"nativeName": "français (Canada)",
"Sunday": "dimanche",
"Monday": "lundi",
"Tuesday": "mardi",
"Wednesday": "mercredi",
"Thursday": "jeudi",
"Friday": "vendredi",
"Saturday": "samedi",
"Sun": "dim.",
"Mon": "lun.",
"Tue": "mar.",
"Wed": "mer.",
"Thu": "jeu.",
"Fri": "ven.",
"Sat": "sam.",
"Su": "di",
"Mo": "lu",
"Tu": "ma",
"We": "me",
"Th": "je",
"Fr": "ve",
"Sa": "sa",
"S_Sun_Initial": "d",
"M_Mon_Initial": "l",
"T_Tue_Initial": "m",
"W_Wed_Initial": "m",
"T_Thu_Initial": "j",
"F_Fri_Initial": "v",
"S_Sat_Initial": "s",
"January": "janvier",
"February": "février",
"March": "mars",
"April": "avril",
"May": "mai",
"June": "juin",
"July": "juillet",
"August": "août",
"September": "septembre",
"October": "octobre",
"November": "novembre",
"December": "décembre",
"Jan_Abbr": "janv.",
"Feb_Abbr": "févr.",
"Mar_Abbr": "mars",
"Apr_Abbr": "avr.",
"May_Abbr": "mai",
"Jun_Abbr": "juin",
"Jul_Abbr": "juil.",
"Aug_Abbr": "août",
"Sep_Abbr": "sept.",
"Oct_Abbr": "oct.",
"Nov_Abbr": "nov.",
"Dec_Abbr": "déc.",
"AM": "",
"PM": "",
"firstDayOfWeek": 0,
"twoDigitYearMax": 2029,
"mdy": "ymd",
"M/d/yyyy": "yyyy-MM-dd",
"dddd, MMMM dd, yyyy": "d MMMM yyyy",
"h:mm tt": "HH:mm",
"h:mm:ss tt": "HH:mm:ss",
"dddd, MMMM dd, yyyy h:mm:ss tt": "d MMMM yyyy HH:mm:ss",
"yyyy-MM-ddTHH:mm:ss": "yyyy-MM-ddTHH:mm:ss",
"yyyy-MM-dd HH:mm:ssZ": "yyyy-MM-dd HH:mm:ssZ",
"ddd, dd MMM yyyy HH:mm:ss": "ddd, dd MMM yyyy HH:mm:ss",
"MMMM dd": "d MMMM",
"MMMM, yyyy": "MMMM, yyyy",
"/jan(uary)?/": "janv((ier)?)?",
"/feb(ruary)?/": "févr((ier)?)?",
"/mar(ch)?/": "mars",
"/apr(il)?/": "avr((il)?)?",
"/may/": "mai",
"/jun(e)?/": "juin",
"/jul(y)?/": "juil((let)?)?",
"/aug(ust)?/": "août",
"/sep(t(ember)?)?/": "sept((embre)?)?",
"/oct(ober)?/": "oct((obre)?)?",
"/nov(ember)?/": "nov((embre)?)?",
"/dec(ember)?/": "déc((embre)?)?",
"/^su(n(day)?)?/": "^di(m((anche)?)?)?",
"/^mo(n(day)?)?/": "^lu(n((di)?)?)?",
"/^tu(e(s(day)?)?)?/": "^ma(r((di)?)?)?",
"/^we(d(nesday)?)?/": "^me(r((credi)?)?)?",
"/^th(u(r(s(day)?)?)?)?/": "^je(u((di)?)?)?",
"/^fr(i(day)?)?/": "^ve(n((dredi)?)?)?",
"/^sa(t(urday)?)?/": "^sa(m((edi)?)?)?",
"/^next/": "^prochain",
"/^last|past|prev(ious)?/": "^dernier",
"/^(\\+|aft(er)?|from|hence)/": "^précédant",
"/^(\\-|bef(ore)?|ago)/": "^succédant",
"/^yes(terday)?/": "^hier",
"/^t(od(ay)?)?/": "^aujourd\'hui",
"/^tom(orrow)?/": "^demain",
"/^n(ow)?/": "^maintenant",
"/^ms|milli(second)?s?/": "^ms|milli(seconde)?s?",
"/^sec(ond)?s?/": "^sec(onde)?s?",
"/^mn|min(ute)?s?/": "^mn|min(ute)?s?",
"/^h(our)?s?/": "^h(eure)?s?",
"/^w(eek)?s?/": "^sem(aine)?s?",
"/^m(onth)?s?/": "^m(ois)?",
"/^d(ay)?s?/": "^j(our)?s?",
"/^y(ear)?s?/": "^a(nnée)?",
"/^(a|p)/": "^(a|p)",
"/^(a\\.?m?\\.?|p\\.?m?\\.?)/": "^(a\\.?m?\\.?|p\\.?m?\\.?)",
"/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)/": "^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)",
"/^\\s*(st|nd|rd|th)/": "^\\s*(st|nd|rd|th)",
"/^\\s*(\\:|a(?!u|p)|p)/": "^\\s*(\\:|a(?!u|p)|p)",
"LINT": "LINT",
"TOT": "TOT",
"CHAST": "CHAST",
"NZST": "NZST",
"NFT": "NFT",
"SBT": "SBT",
"AEST": "AEST",
"ACST": "ACST",
"JST": "JST",
"CWST": "CWST",
"CT": "CT",
"ICT": "ICT",
"MMT": "MMT",
"BIOT": "BST",
"NPT": "NPT",
"IST": "IST",
"PKT": "PKT",
"AFT": "AFT",
"MSK": "MSK",
"IRST": "IRST",
"FET": "FET",
"EET": "EET",
"CET": "CET",
"UTC": "UTC",
"GMT": "GMT",
"CVT": "CVT",
"GST": "GST",
"BRT": "BRT",
"NST": "NST",
"AST": "AST",
"EST": "EST",
"CST": "CST",
"MST": "MST",
"PST": "PST",
"AKST": "AKST",
"MIT": "MIT",
"HST": "HST",
"SST": "SST",
"BIT": "BIT",
"CHADT": "CHADT",
"NZDT": "NZDT",
"AEDT": "AEDT",
"ACDT": "ACDT",
"AZST": "AZST",
"IRDT": "IRDT",
"EEST": "EEST",
"CEST": "CEST",
"BST": "BST",
"PMDT": "PMDT",
"ADT": "ADT",
"NDT": "NDT",
"EDT": "EDT",
"CDT": "CDT",
"MDT": "MDT",
"PDT": "PDT",
"AKDT": "AKDT",
"HADT": "HADT"
};
Date.CultureStrings.lang = "fr-CA";
|
angular.module("ngLocale",[],["$provide",function(a){var b={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};a.value("$locale",{NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,macFrac:0,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3,maxFrac:3},{minInt:1,minFrac:2,macFrac:0,posPre:"\u00A4",posSuf:"",negPre:"\u00A4-",negSuf:"",gSize:3,lgSize:3,maxFrac:2}],CURRENCY_SYM:"¥"},pluralCat:function(c){return b.OTHER},DATETIME_FORMATS:{MONTH:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],SHORTMONTH:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],DAY:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],SHORTDAY:["周日","周一","周二","周三","周四","周五","周六"],AMPMS:["上午","下午"],medium:"yyyy-M-d ah:mm:ss","short":"yy-M-d ah:mm",fullDate:"y年M月d日EEEE",longDate:"y年M月d日",mediumDate:"yyyy-M-d",shortDate:"yy-M-d",mediumTime:"ah:mm:ss",shortTime:"ah:mm"},id:"zh-hans-cn"})}]); |
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'contextmenu', 'fa', {
options: 'گزینههای منوی زمینه'
});
|
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const ImportContextDependency = require("./ImportContextDependency");
const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
class ImportLazyOnceContextDependency extends ImportContextDependency {
constructor(request, recursive, regExp, range, valueRange, chunkName) {
super(request, recursive, regExp, range, valueRange, chunkName);
this.async = "lazy-once";
}
get type() {
return "import() context lazy-once";
}
}
ImportLazyOnceContextDependency.Template = ContextDependencyTemplateAsRequireCall;
module.exports = ImportLazyOnceContextDependency;
|
/*!
* ws: a node.js websocket client
* Copyright(c) 2011 Einar Otto Stangvik <[email protected]>
* MIT Licensed
*/
var util = require('util')
, events = require('events')
, http = require('http')
, crypto = require('crypto')
, url = require('url')
, Options = require('options')
, WebSocket = require('./WebSocket')
, tls = require('tls')
, url = require('url');
/**
* WebSocket Server implementation
*/
function WebSocketServer(options, callback) {
options = new Options({
host: '0.0.0.0',
port: null,
server: null,
verifyClient: null,
handleProtocols: null,
path: null,
noServer: false,
disableHixie: false,
clientTracking: true
}).merge(options);
if (!options.isDefinedAndNonNull('port') && !options.isDefinedAndNonNull('server') && !options.value.noServer) {
throw new TypeError('`port` or a `server` must be provided');
}
var self = this;
if (options.isDefinedAndNonNull('port')) {
this._server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Not implemented');
});
this._server.listen(options.value.port, options.value.host, callback);
this._closeServer = function() { self._server.close(); };
}
else if (options.value.server) {
this._server = options.value.server;
if (options.value.path) {
// take note of the path, to avoid collisions when multiple websocket servers are
// listening on the same http server
if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) {
throw new Error('two instances of WebSocketServer cannot listen on the same http server path');
}
if (typeof this._server._webSocketPaths !== 'object') {
this._server._webSocketPaths = {};
}
this._server._webSocketPaths[options.value.path] = 1;
}
}
if (this._server) this._server.once('listening', function() { self.emit('listening'); });
if (typeof this._server != 'undefined') {
this._server.on('error', function(error) {
self.emit('error', error)
});
this._server.on('upgrade', function(req, socket, upgradeHead) {
//copy upgradeHead to avoid retention of large slab buffers used in node core
var head = new Buffer(upgradeHead.length);
upgradeHead.copy(head);
self.handleUpgrade(req, socket, head, function(client) {
self.emit('connection'+req.url, client);
self.emit('connection', client);
});
});
}
this.options = options.value;
this.path = options.value.path;
this.clients = [];
}
/**
* Inherits from EventEmitter.
*/
util.inherits(WebSocketServer, events.EventEmitter);
/**
* Immediately shuts down the connection.
*
* @api public
*/
WebSocketServer.prototype.close = function() {
// terminate all associated clients
var error = null;
try {
for (var i = 0, l = this.clients.length; i < l; ++i) {
this.clients[i].terminate();
}
}
catch (e) {
error = e;
}
// remove path descriptor, if any
if (this.path && this._server._webSocketPaths) {
delete this._server._webSocketPaths[this.path];
if (Object.keys(this._server._webSocketPaths).length == 0) {
delete this._server._webSocketPaths;
}
}
// close the http server if it was internally created
try {
if (typeof this._closeServer !== 'undefined') {
this._closeServer();
}
}
finally {
delete this._server;
}
if (error) throw error;
}
/**
* Handle a HTTP Upgrade request.
*
* @api public
*/
WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) {
// check for wrong path
if (this.options.path) {
var u = url.parse(req.url);
if (u && u.pathname !== this.options.path) return;
}
if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') {
abortConnection(socket, 400, 'Bad Request');
return;
}
if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments);
else handleHybiUpgrade.apply(this, arguments);
}
module.exports = WebSocketServer;
/**
* Entirely private apis,
* which may or may not be bound to a sepcific WebSocket instance.
*/
function handleHybiUpgrade(req, socket, upgradeHead, cb) {
// handle premature socket errors
var errorHandler = function() {
try { socket.destroy(); } catch (e) {}
}
socket.on('error', errorHandler);
// verify key presence
if (!req.headers['sec-websocket-key']) {
abortConnection(socket, 400, 'Bad Request');
return;
}
// verify version
var version = parseInt(req.headers['sec-websocket-version']);
if ([8, 13].indexOf(version) === -1) {
abortConnection(socket, 400, 'Bad Request');
return;
}
// verify protocol
var protocols = req.headers['sec-websocket-protocol'];
// verify client
var origin = version < 13 ?
req.headers['sec-websocket-origin'] :
req.headers['origin'];
// handler to call when the connection sequence completes
var self = this;
var completeHybiUpgrade2 = function(protocol) {
// calc key
var key = req.headers['sec-websocket-key'];
var shasum = crypto.createHash('sha1');
shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
key = shasum.digest('base64');
var headers = [
'HTTP/1.1 101 Switching Protocols'
, 'Upgrade: websocket'
, 'Connection: Upgrade'
, 'Sec-WebSocket-Accept: ' + key
];
if (typeof protocol != 'undefined') {
headers.push('Sec-WebSocket-Protocol: ' + protocol);
}
// allows external modification/inspection of handshake headers
self.emit('headers', headers);
socket.setTimeout(0);
socket.setNoDelay(true);
try {
socket.write(headers.concat('', '').join('\r\n'));
}
catch (e) {
// if the upgrade write fails, shut the connection down hard
try { socket.destroy(); } catch (e) {}
return;
}
var client = new WebSocket([req, socket, upgradeHead], {
protocolVersion: version,
protocol: protocol
});
if (self.options.clientTracking) {
self.clients.push(client);
client.on('close', function() {
var index = self.clients.indexOf(client);
if (index != -1) {
self.clients.splice(index, 1);
}
});
}
// signal upgrade complete
socket.removeListener('error', errorHandler);
cb(client);
}
// optionally call external protocol selection handler before
// calling completeHybiUpgrade2
var completeHybiUpgrade1 = function() {
// choose from the sub-protocols
if (typeof self.options.handleProtocols == 'function') {
var protList = (protocols || "").split(/, */);
var callbackCalled = false;
var res = self.options.handleProtocols(protList, function(result, protocol) {
callbackCalled = true;
if (!result) abortConnection(socket, 404, 'Unauthorized')
else completeHybiUpgrade2(protocol);
});
if (!callbackCalled) {
// the handleProtocols handler never called our callback
abortConnection(socket, 501, 'Could not process protocols');
}
return;
} else {
if (typeof protocols !== 'undefined') {
completeHybiUpgrade2(protocols.split(/, */)[0]);
}
else {
completeHybiUpgrade2();
}
}
}
// optionally call external client verification handler
if (typeof this.options.verifyClient == 'function') {
var info = {
origin: origin,
secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined',
req: req
};
if (this.options.verifyClient.length == 2) {
this.options.verifyClient(info, function(result) {
if (!result) abortConnection(socket, 401, 'Unauthorized')
else completeHybiUpgrade1();
});
return;
}
else if (!this.options.verifyClient(info)) {
abortConnection(socket, 401, 'Unauthorized');
return;
}
}
completeHybiUpgrade1();
}
function handleHixieUpgrade(req, socket, upgradeHead, cb) {
// handle premature socket errors
var errorHandler = function() {
try { socket.destroy(); } catch (e) {}
}
socket.on('error', errorHandler);
// bail if options prevent hixie
if (this.options.disableHixie) {
abortConnection(socket, 401, 'Hixie support disabled');
return;
}
// verify key presence
if (!req.headers['sec-websocket-key2']) {
abortConnection(socket, 400, 'Bad Request');
return;
}
var origin = req.headers['origin']
, self = this;
// setup handshake completion to run after client has been verified
var onClientVerified = function() {
var wshost;
if (!req.headers['x-forwarded-host'])
wshost = req.headers.host;
else
wshost = req.headers['x-forwarded-host'];
var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url
, protocol = req.headers['sec-websocket-protocol'];
// handshake completion code to run once nonce has been successfully retrieved
var completeHandshake = function(nonce, rest) {
// calculate key
var k1 = req.headers['sec-websocket-key1']
, k2 = req.headers['sec-websocket-key2']
, md5 = crypto.createHash('md5');
[k1, k2].forEach(function (k) {
var n = parseInt(k.replace(/[^\d]/g, ''))
, spaces = k.replace(/[^ ]/g, '').length;
if (spaces === 0 || n % spaces !== 0){
abortConnection(socket, 400, 'Bad Request');
return;
}
n /= spaces;
md5.update(String.fromCharCode(
n >> 24 & 0xFF,
n >> 16 & 0xFF,
n >> 8 & 0xFF,
n & 0xFF));
});
md5.update(nonce.toString('binary'));
var headers = [
'HTTP/1.1 101 Switching Protocols'
, 'Upgrade: WebSocket'
, 'Connection: Upgrade'
, 'Sec-WebSocket-Location: ' + location
];
if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol);
if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin);
socket.setTimeout(0);
socket.setNoDelay(true);
try {
// merge header and hash buffer
var headerBuffer = new Buffer(headers.concat('', '').join('\r\n'));
var hashBuffer = new Buffer(md5.digest('binary'), 'binary');
var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length);
headerBuffer.copy(handshakeBuffer, 0);
hashBuffer.copy(handshakeBuffer, headerBuffer.length);
// do a single write, which - upon success - causes a new client websocket to be setup
socket.write(handshakeBuffer, 'binary', function(err) {
if (err) return; // do not create client if an error happens
var client = new WebSocket([req, socket, rest], {
protocolVersion: 'hixie-76',
protocol: protocol
});
if (self.options.clientTracking) {
self.clients.push(client);
client.on('close', function() {
var index = self.clients.indexOf(client);
if (index != -1) {
self.clients.splice(index, 1);
}
});
}
// signal upgrade complete
socket.removeListener('error', errorHandler);
cb(client);
});
}
catch (e) {
try { socket.destroy(); } catch (e) {}
return;
}
}
// retrieve nonce
var nonceLength = 8;
if (upgradeHead && upgradeHead.length >= nonceLength) {
var nonce = upgradeHead.slice(0, nonceLength);
var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null;
completeHandshake.call(self, nonce, rest);
}
else {
// nonce not present in upgradeHead, so we must wait for enough data
// data to arrive before continuing
var nonce = new Buffer(nonceLength);
upgradeHead.copy(nonce, 0);
var received = upgradeHead.length;
var rest = null;
var handler = function (data) {
var toRead = Math.min(data.length, nonceLength - received);
if (toRead === 0) return;
data.copy(nonce, received, 0, toRead);
received += toRead;
if (received == nonceLength) {
socket.removeListener('data', handler);
if (toRead < data.length) rest = data.slice(toRead);
completeHandshake.call(self, nonce, rest);
}
}
socket.on('data', handler);
}
}
// verify client
if (typeof this.options.verifyClient == 'function') {
var info = {
origin: origin,
secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined',
req: req
};
if (this.options.verifyClient.length == 2) {
var self = this;
this.options.verifyClient(info, function(result) {
if (!result) abortConnection(socket, 401, 'Unauthorized')
else onClientVerified.apply(self);
});
return;
}
else if (!this.options.verifyClient(info)) {
abortConnection(socket, 401, 'Unauthorized');
return;
}
}
// no client verification required
onClientVerified();
}
function abortConnection(socket, code, name) {
try {
var response = [
'HTTP/1.1 ' + code + ' ' + name,
'Content-type: text/html'
];
socket.write(response.concat('', '').join('\r\n'));
}
catch (e) { /* ignore errors - we've aborted this connection */ }
finally {
// ensure that an early aborted connection is shut down completely
try { socket.destroy(); } catch (e) {}
}
}
|
( function( $ ){
wp.customize( 'blogname', function( value ) {
value.bind( function( to ) {
$( '#site-title a' ).text( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
$( '#site-description' ).text( to );
} );
} );
// Header text color
wp.customize( 'header_textcolor', function( value ) {
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '#site-title, #site-title a, #site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'position': 'absolute'
} );
} else {
$( '#site-title, #site-title a, #site-description' ).css( {
'clip': 'auto',
'color': to,
'position': 'relative'
} );
}
} );
} );
} )( jQuery ); |
/*!
* jQuery Placeholder Plugin v2.3.1
* https://github.com/mathiasbynens/jquery-placeholder
*
* Copyright 2011, 2015 Mathias Bynens
* Released under the MIT license
*/
(function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function($) {
/****
* Allows plugin behavior simulation in modern browsers for easier debugging.
* When setting to true, use attribute "placeholder-x" rather than the usual "placeholder" in your inputs/textareas
* i.e. <input type="text" placeholder-x="my placeholder text" />
*/
var debugMode = false;
// Opera Mini v7 doesn't support placeholder although its DOM seems to indicate so
var isOperaMini = Object.prototype.toString.call(window.operamini) === '[object OperaMini]';
var isInputSupported = 'placeholder' in document.createElement('input') && !isOperaMini && !debugMode;
var isTextareaSupported = 'placeholder' in document.createElement('textarea') && !isOperaMini && !debugMode;
var valHooks = $.valHooks;
var propHooks = $.propHooks;
var hooks;
var placeholder;
var settings = {};
if (isInputSupported && isTextareaSupported) {
placeholder = $.fn.placeholder = function() {
return this;
};
placeholder.input = true;
placeholder.textarea = true;
} else {
placeholder = $.fn.placeholder = function(options) {
var defaults = {customClass: 'placeholder'};
settings = $.extend({}, defaults, options);
return this.filter((isInputSupported ? 'textarea' : ':input') + '[' + (debugMode ? 'placeholder-x' : 'placeholder') + ']')
.not('.'+settings.customClass)
.not(':radio, :checkbox, [type=hidden]')
.bind({
'focus.placeholder': clearPlaceholder,
'blur.placeholder': setPlaceholder
})
.data('placeholder-enabled', true)
.trigger('blur.placeholder');
};
placeholder.input = isInputSupported;
placeholder.textarea = isTextareaSupported;
hooks = {
'get': function(element) {
var $element = $(element);
var $passwordInput = $element.data('placeholder-password');
if ($passwordInput) {
return $passwordInput[0].value;
}
return $element.data('placeholder-enabled') && $element.hasClass(settings.customClass) ? '' : element.value;
},
'set': function(element, value) {
var $element = $(element);
var $replacement;
var $passwordInput;
if (value !== '') {
$replacement = $element.data('placeholder-textinput');
$passwordInput = $element.data('placeholder-password');
if ($replacement) {
clearPlaceholder.call($replacement[0], true, value) || (element.value = value);
$replacement[0].value = value;
} else if ($passwordInput) {
clearPlaceholder.call(element, true, value) || ($passwordInput[0].value = value);
element.value = value;
}
}
if (!$element.data('placeholder-enabled')) {
element.value = value;
return $element;
}
if (value === '') {
element.value = value;
// Setting the placeholder causes problems if the element continues to have focus.
if (element != safeActiveElement()) {
// We can't use `triggerHandler` here because of dummy text/password inputs :(
setPlaceholder.call(element);
}
} else {
if ($element.hasClass(settings.customClass)) {
clearPlaceholder.call(element);
}
element.value = value;
}
// `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363
return $element;
}
};
if (!isInputSupported) {
valHooks.input = hooks;
propHooks.value = hooks;
}
if (!isTextareaSupported) {
valHooks.textarea = hooks;
propHooks.value = hooks;
}
$(function() {
// Look for forms
$(document).delegate('form', 'submit.placeholder', function() {
// Clear the placeholder values so they don't get submitted
var $inputs = $('.'+settings.customClass, this).each(function() {
clearPlaceholder.call(this, true, '');
});
setTimeout(function() {
$inputs.each(setPlaceholder);
}, 10);
});
});
// Clear placeholder values upon page reload
$(window).bind('beforeunload.placeholder', function() {
var clearPlaceholders = true;
try {
// Prevent IE javascript:void(0) anchors from causing cleared values
if (document.activeElement.toString() === 'javascript:void(0)') {
clearPlaceholders = false;
}
} catch (exception) { }
if (clearPlaceholders) {
$('.'+settings.customClass).each(function() {
this.value = '';
});
}
});
}
function args(elem) {
// Return an object of element attributes
var newAttrs = {};
var rinlinejQuery = /^jQuery\d+$/;
$.each(elem.attributes, function(i, attr) {
if (attr.specified && !rinlinejQuery.test(attr.name)) {
newAttrs[attr.name] = attr.value;
}
});
return newAttrs;
}
function clearPlaceholder(event, value) {
var input = this;
var $input = $(this);
if (input.value === $input.attr((debugMode ? 'placeholder-x' : 'placeholder')) && $input.hasClass(settings.customClass)) {
input.value = '';
$input.removeClass(settings.customClass);
if ($input.data('placeholder-password')) {
$input = $input.hide().nextAll('input[type="password"]:first').show().attr('id', $input.removeAttr('id').data('placeholder-id'));
// If `clearPlaceholder` was called from `$.valHooks.input.set`
if (event === true) {
$input[0].value = value;
return value;
}
$input.focus();
} else {
input == safeActiveElement() && input.select();
}
}
}
function setPlaceholder(event) {
var $replacement;
var input = this;
var $input = $(this);
var id = input.id;
// If the placeholder is activated, triggering blur event (`$input.trigger('blur')`) should do nothing.
if (event && event.type === 'blur' && $input.hasClass(settings.customClass)) {
return;
}
if (input.value === '') {
if (input.type === 'password') {
if (!$input.data('placeholder-textinput')) {
try {
$replacement = $input.clone().prop({ 'type': 'text' });
} catch(e) {
$replacement = $('<input>').attr($.extend(args(this), { 'type': 'text' }));
}
$replacement
.removeAttr('name')
.data({
'placeholder-enabled': true,
'placeholder-password': $input,
'placeholder-id': id
})
.bind('focus.placeholder', clearPlaceholder);
$input
.data({
'placeholder-textinput': $replacement,
'placeholder-id': id
})
.before($replacement);
}
input.value = '';
$input = $input.removeAttr('id').hide().prevAll('input[type="text"]:first').attr('id', $input.data('placeholder-id')).show();
} else {
var $passwordInput = $input.data('placeholder-password');
if ($passwordInput) {
$passwordInput[0].value = '';
$input.attr('id', $input.data('placeholder-id')).show().nextAll('input[type="password"]:last').hide().removeAttr('id');
}
}
$input.addClass(settings.customClass);
$input[0].value = $input.attr((debugMode ? 'placeholder-x' : 'placeholder'));
} else {
$input.removeClass(settings.customClass);
}
}
function safeActiveElement() {
// Avoid IE9 `document.activeElement` of death
try {
return document.activeElement;
} catch (exception) {}
}
}));
|
/*
* Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
*
* 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.
*
*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, $ */
define(function (require, exports, module) {
"use strict";
var FileSystemStats = require("filesystem/FileSystemStats"),
EventDispatcher = require("utils/EventDispatcher");
// Initial file system data.
var _initialData = {
"/": {
isFile: false,
mtime: new Date()
},
"/file1.txt": {
isFile: true,
mtime: new Date(),
contents: "File 1 Contents"
},
"/file2.txt": {
isFile: true,
mtime: new Date(),
contents: "File 2 Contents"
},
"/subdir/": {
isFile: false,
mtime: new Date()
},
"/subdir/file3.txt": {
isFile: true,
mtime: new Date(),
contents: "File 3 Contents"
},
"/subdir/file4.txt": {
isFile: true,
mtime: new Date(),
contents: "File 4 Contents"
},
"/subdir/child/": {
isFile: false,
mtime: new Date()
},
"/subdir/child/file5.txt": {
isFile: true,
mtime: new Date(),
contents: "File 5 Contents"
}
};
function _parentPath(path) {
// trim off the trailing slash if necessary
if (path[path.length - 1] === "/") {
path = path.substring(0, path.length - 1);
}
if (path[path.length - 1] !== "/") {
path = path.substr(0, path.lastIndexOf("/") + 1);
}
return path;
}
function MockFileSystemModel() {
this._data = {};
$.extend(this._data, _initialData);
this._watchedPaths = {};
}
EventDispatcher.makeEventDispatcher(MockFileSystemModel.prototype);
MockFileSystemModel.prototype.stat = function (path) {
var entry = this._data[path];
if (entry) {
return new FileSystemStats({
isFile: entry.isFile,
mtime: entry.mtime,
size: entry.contents ? entry.contents.length : 0,
hash: entry.mtime.getTime()
});
} else {
return null;
}
};
MockFileSystemModel.prototype.exists = function (path) {
return !!this._data[path];
};
MockFileSystemModel.prototype._isPathWatched = function (path) {
return Object.keys(this._watchedPaths).some(function (watchedPath) {
return path.indexOf(watchedPath) === 0;
});
};
MockFileSystemModel.prototype._sendWatcherNotification = function (path) {
if (this._isPathWatched(path)) {
this.trigger("change", path);
}
};
MockFileSystemModel.prototype._sendDirectoryWatcherNotification = function (path) {
this._sendWatcherNotification(_parentPath(path));
};
MockFileSystemModel.prototype.mkdir = function (path) {
this._data[path] = {
isFile: false,
mtime: new Date()
};
this._sendDirectoryWatcherNotification(path);
};
MockFileSystemModel.prototype.readFile = function (path) {
return this.exists(path) ? this._data[path].contents : null;
};
MockFileSystemModel.prototype.writeFile = function (path, contents) {
var exists = this.exists(path);
this._data[path] = {
isFile: true,
contents: contents,
mtime: new Date()
};
if (exists) {
this._sendWatcherNotification(path);
} else {
this._sendDirectoryWatcherNotification(path);
}
};
MockFileSystemModel.prototype.unlink = function (path) {
var entry;
for (entry in this._data) {
if (this._data.hasOwnProperty(entry)) {
if (entry.indexOf(path) === 0) {
delete this._data[entry];
}
}
}
this._sendDirectoryWatcherNotification(path);
};
MockFileSystemModel.prototype.rename = function (oldPath, newPath) {
this._data[newPath] = this._data[oldPath];
delete this._data[oldPath];
if (!this._data[newPath].isFile) {
var entry, i,
toDelete = [];
for (entry in this._data) {
if (this._data.hasOwnProperty(entry)) {
if (entry.indexOf(oldPath) === 0) {
this._data[newPath + entry.substr(oldPath.length)] = this._data[entry];
toDelete.push(entry);
}
}
}
for (i = toDelete.length; i; i--) {
delete this._data[toDelete.pop()];
}
}
this._sendDirectoryWatcherNotification(oldPath);
};
MockFileSystemModel.prototype.readdir = function (path) {
var entry,
contents = [];
for (entry in this._data) {
if (this._data.hasOwnProperty(entry)) {
var isDir = false;
if (entry[entry.length - 1] === "/") {
entry = entry.substr(0, entry.length - 1);
isDir = true;
}
if (entry !== path &&
entry.indexOf(path) === 0 &&
entry.lastIndexOf("/") === path.lastIndexOf("/")) {
contents.push(entry.substr(entry.lastIndexOf("/")) + (isDir ? "/" : ""));
}
}
}
return contents;
};
MockFileSystemModel.prototype.watchPath = function (path) {
this._watchedPaths[path] = true;
};
MockFileSystemModel.prototype.unwatchPath = function (path) {
delete this._watchedPaths[path];
};
MockFileSystemModel.prototype.unwatchAll = function () {
this._watchedPaths = {};
};
module.exports = MockFileSystemModel;
});
|
/*
* MultiSelect v0.9.12
* Copyright (c) 2012 Louis Cuny
*
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
!function ($) {
"use strict";
/* MULTISELECT CLASS DEFINITION
* ====================== */
var MultiSelect = function (element, options) {
this.options = options;
this.$element = $(element);
this.$container = $('<div/>', { 'class': "ms-container" });
this.$selectableContainer = $('<div/>', { 'class': 'ms-selectable' });
this.$selectionContainer = $('<div/>', { 'class': 'ms-selection' });
this.$selectableUl = $('<ul/>', { 'class': "ms-list", 'tabindex' : '-1' });
this.$selectionUl = $('<ul/>', { 'class': "ms-list", 'tabindex' : '-1' });
this.scrollTo = 0;
this.elemsSelector = 'li:visible:not(.ms-optgroup-label,.ms-optgroup-container,.'+options.disabledClass+')';
};
MultiSelect.prototype = {
constructor: MultiSelect,
init: function(){
var that = this,
ms = this.$element;
if (ms.next('.ms-container').length === 0){
ms.css({ position: 'absolute', left: '-9999px' });
ms.attr('id', ms.attr('id') ? ms.attr('id') : Math.ceil(Math.random()*1000)+'multiselect');
this.$container.attr('id', 'ms-'+ms.attr('id'));
this.$container.addClass(that.options.cssClass);
ms.find('option').each(function(){
that.generateLisFromOption(this);
});
this.$selectionUl.find('.ms-optgroup-label').hide();
if (that.options.selectableHeader){
that.$selectableContainer.append(that.options.selectableHeader);
}
that.$selectableContainer.append(that.$selectableUl);
if (that.options.selectableFooter){
that.$selectableContainer.append(that.options.selectableFooter);
}
if (that.options.selectionHeader){
that.$selectionContainer.append(that.options.selectionHeader);
}
that.$selectionContainer.append(that.$selectionUl);
if (that.options.selectionFooter){
that.$selectionContainer.append(that.options.selectionFooter);
}
that.$container.append(that.$selectableContainer);
that.$container.append(that.$selectionContainer);
ms.after(that.$container);
that.activeMouse(that.$selectableUl);
that.activeKeyboard(that.$selectableUl);
var action = that.options.dblClick ? 'dblclick' : 'click';
that.$selectableUl.on(action, '.ms-elem-selectable', function(){
that.select($(this).data('ms-value'));
});
that.$selectionUl.on(action, '.ms-elem-selection', function(){
that.deselect($(this).data('ms-value'));
});
that.activeMouse(that.$selectionUl);
that.activeKeyboard(that.$selectionUl);
ms.on('focus', function(){
that.$selectableUl.focus();
});
}
var selectedValues = ms.find('option:selected').map(function(){ return $(this).val(); }).get();
that.select(selectedValues, 'init');
if (typeof that.options.afterInit === 'function') {
that.options.afterInit.call(this, this.$container);
}
},
'generateLisFromOption' : function(option, index, $container){
var that = this,
ms = that.$element,
attributes = "",
$option = $(option);
for (var cpt = 0; cpt < option.attributes.length; cpt++){
var attr = option.attributes[cpt];
if(attr.name !== 'value' && attr.name !== 'disabled'){
attributes += attr.name+'="'+attr.value+'" ';
}
}
var selectableLi = $('<li '+attributes+'><span>'+that.escapeHTML($option.text())+'</span></li>'),
selectedLi = selectableLi.clone(),
value = $option.val(),
elementId = that.sanitize(value);
selectableLi
.data('ms-value', value)
.addClass('ms-elem-selectable')
.attr('id', elementId+'-selectable');
selectedLi
.data('ms-value', value)
.addClass('ms-elem-selection')
.attr('id', elementId+'-selection')
.hide();
if ($option.prop('disabled') || ms.prop('disabled')){
selectedLi.addClass(that.options.disabledClass);
selectableLi.addClass(that.options.disabledClass);
}
var $optgroup = $option.parent('optgroup');
if ($optgroup.length > 0){
var optgroupLabel = $optgroup.attr('label'),
optgroupId = that.sanitize(optgroupLabel),
$selectableOptgroup = that.$selectableUl.find('#optgroup-selectable-'+optgroupId),
$selectionOptgroup = that.$selectionUl.find('#optgroup-selection-'+optgroupId);
if ($selectableOptgroup.length === 0){
var optgroupContainerTpl = '<li class="ms-optgroup-container"></li>',
optgroupTpl = '<ul class="ms-optgroup"><li class="ms-optgroup-label"><span>'+optgroupLabel+'</span></li></ul>';
$selectableOptgroup = $(optgroupContainerTpl);
$selectionOptgroup = $(optgroupContainerTpl);
$selectableOptgroup.attr('id', 'optgroup-selectable-'+optgroupId);
$selectionOptgroup.attr('id', 'optgroup-selection-'+optgroupId);
$selectableOptgroup.append($(optgroupTpl));
$selectionOptgroup.append($(optgroupTpl));
if (that.options.selectableOptgroup){
$selectableOptgroup.find('.ms-optgroup-label').on('click', function(){
var values = $optgroup.children(':not(:selected, :disabled)').map(function(){ return $(this).val();}).get();
that.select(values);
});
$selectionOptgroup.find('.ms-optgroup-label').on('click', function(){
var values = $optgroup.children(':selected:not(:disabled)').map(function(){ return $(this).val();}).get();
that.deselect(values);
});
}
that.$selectableUl.append($selectableOptgroup);
that.$selectionUl.append($selectionOptgroup);
}
index = index === undefined ? $selectableOptgroup.find('ul').children().length : index + 1;
selectableLi.insertAt(index, $selectableOptgroup.children());
selectedLi.insertAt(index, $selectionOptgroup.children());
} else {
index = index === undefined ? that.$selectableUl.children().length : index;
selectableLi.insertAt(index, that.$selectableUl);
selectedLi.insertAt(index, that.$selectionUl);
}
},
'addOption' : function(options){
var that = this;
if (options.value !== undefined && options.value !== null){
options = [options];
}
$.each(options, function(index, option){
if (option.value !== undefined && option.value !== null &&
that.$element.find("option[value='"+option.value+"']").length === 0){
var $option = $('<option value="'+option.value+'">'+option.text+'</option>'),
index = parseInt((typeof option.index === 'undefined' ? that.$element.children().length : option.index)),
$container = option.nested === undefined ? that.$element : $("optgroup[label='"+option.nested+"']");
$option.insertAt(index, $container);
that.generateLisFromOption($option.get(0), index, option.nested);
}
});
},
'escapeHTML' : function(text){
return $("<div>").text(text).html();
},
'activeKeyboard' : function($list){
var that = this;
$list.on('focus', function(){
$(this).addClass('ms-focus');
})
.on('blur', function(){
$(this).removeClass('ms-focus');
})
.on('keydown', function(e){
switch (e.which) {
case 40:
case 38:
e.preventDefault();
e.stopPropagation();
that.moveHighlight($(this), (e.which === 38) ? -1 : 1);
return;
case 37:
case 39:
e.preventDefault();
e.stopPropagation();
that.switchList($list);
return;
case 9:
if(that.$element.is('[tabindex]')){
e.preventDefault();
var tabindex = parseInt(that.$element.attr('tabindex'), 10);
tabindex = (e.shiftKey) ? tabindex-1 : tabindex+1;
$('[tabindex="'+(tabindex)+'"]').focus();
return;
}else{
if(e.shiftKey){
that.$element.trigger('focus');
}
}
}
if($.inArray(e.which, that.options.keySelect) > -1){
e.preventDefault();
e.stopPropagation();
that.selectHighlighted($list);
return;
}
});
},
'moveHighlight': function($list, direction){
var $elems = $list.find(this.elemsSelector),
$currElem = $elems.filter('.ms-hover'),
$nextElem = null,
elemHeight = $elems.first().outerHeight(),
containerHeight = $list.height(),
containerSelector = '#'+this.$container.prop('id');
$elems.removeClass('ms-hover');
if (direction === 1){ // DOWN
$nextElem = $currElem.nextAll(this.elemsSelector).first();
if ($nextElem.length === 0){
var $optgroupUl = $currElem.parent();
if ($optgroupUl.hasClass('ms-optgroup')){
var $optgroupLi = $optgroupUl.parent(),
$nextOptgroupLi = $optgroupLi.next(':visible');
if ($nextOptgroupLi.length > 0){
$nextElem = $nextOptgroupLi.find(this.elemsSelector).first();
} else {
$nextElem = $elems.first();
}
} else {
$nextElem = $elems.first();
}
}
} else if (direction === -1){ // UP
$nextElem = $currElem.prevAll(this.elemsSelector).first();
if ($nextElem.length === 0){
var $optgroupUl = $currElem.parent();
if ($optgroupUl.hasClass('ms-optgroup')){
var $optgroupLi = $optgroupUl.parent(),
$prevOptgroupLi = $optgroupLi.prev(':visible');
if ($prevOptgroupLi.length > 0){
$nextElem = $prevOptgroupLi.find(this.elemsSelector).last();
} else {
$nextElem = $elems.last();
}
} else {
$nextElem = $elems.last();
}
}
}
if ($nextElem.length > 0){
$nextElem.addClass('ms-hover');
var scrollTo = $list.scrollTop() + $nextElem.position().top -
containerHeight / 2 + elemHeight / 2;
$list.scrollTop(scrollTo);
}
},
'selectHighlighted' : function($list){
var $elems = $list.find(this.elemsSelector),
$highlightedElem = $elems.filter('.ms-hover').first();
if ($highlightedElem.length > 0){
if ($list.parent().hasClass('ms-selectable')){
this.select($highlightedElem.data('ms-value'));
} else {
this.deselect($highlightedElem.data('ms-value'));
}
$elems.removeClass('ms-hover');
}
},
'switchList' : function($list){
$list.blur();
this.$container.find(this.elemsSelector).removeClass('ms-hover');
if ($list.parent().hasClass('ms-selectable')){
this.$selectionUl.focus();
} else {
this.$selectableUl.focus();
}
},
'activeMouse' : function($list){
var that = this;
this.$container.on('mouseenter', that.elemsSelector, function(){
$(this).parents('.ms-container').find(that.elemsSelector).removeClass('ms-hover');
$(this).addClass('ms-hover');
});
this.$container.on('mouseleave', that.elemsSelector, function () {
$(this).parents('.ms-container').find(that.elemsSelector).removeClass('ms-hover');
});
},
'refresh' : function() {
this.destroy();
this.$element.multiSelect(this.options);
},
'destroy' : function(){
$("#ms-"+this.$element.attr("id")).remove();
this.$element.off('focus');
this.$element.css('position', '').css('left', '');
this.$element.removeData('multiselect');
},
'select' : function(value, method){
if (typeof value === 'string'){ value = [value]; }
var that = this,
ms = this.$element,
msIds = $.map(value, function(val){ return(that.sanitize(val)); }),
selectables = this.$selectableUl.find('#' + msIds.join('-selectable, #')+'-selectable').filter(':not(.'+that.options.disabledClass+')'),
selections = this.$selectionUl.find('#' + msIds.join('-selection, #') + '-selection').filter(':not(.'+that.options.disabledClass+')'),
options = ms.find('option:not(:disabled)').filter(function(){ return($.inArray(this.value, value) > -1); });
if (method === 'init'){
selectables = this.$selectableUl.find('#' + msIds.join('-selectable, #')+'-selectable'),
selections = this.$selectionUl.find('#' + msIds.join('-selection, #') + '-selection');
}
if (selectables.length > 0){
selectables.addClass('ms-selected').hide();
selections.addClass('ms-selected').show();
options.prop('selected', true);
that.$container.find(that.elemsSelector).removeClass('ms-hover');
var selectableOptgroups = that.$selectableUl.children('.ms-optgroup-container');
if (selectableOptgroups.length > 0){
selectableOptgroups.each(function(){
var selectablesLi = $(this).find('.ms-elem-selectable');
if (selectablesLi.length === selectablesLi.filter('.ms-selected').length){
$(this).find('.ms-optgroup-label').hide();
}
});
var selectionOptgroups = that.$selectionUl.children('.ms-optgroup-container');
selectionOptgroups.each(function(){
var selectionsLi = $(this).find('.ms-elem-selection');
if (selectionsLi.filter('.ms-selected').length > 0){
$(this).find('.ms-optgroup-label').show();
}
});
} else {
if (that.options.keepOrder && method !== 'init'){
var selectionLiLast = that.$selectionUl.find('.ms-selected');
if((selectionLiLast.length > 1) && (selectionLiLast.last().get(0) != selections.get(0))) {
selections.insertAfter(selectionLiLast.last());
}
}
}
if (method !== 'init'){
ms.trigger('change');
if (typeof that.options.afterSelect === 'function') {
that.options.afterSelect.call(this, value);
}
}
}
},
'deselect' : function(value){
if (typeof value === 'string'){ value = [value]; }
var that = this,
ms = this.$element,
msIds = $.map(value, function(val){ return(that.sanitize(val)); }),
selectables = this.$selectableUl.find('#' + msIds.join('-selectable, #')+'-selectable'),
selections = this.$selectionUl.find('#' + msIds.join('-selection, #')+'-selection').filter('.ms-selected').filter(':not(.'+that.options.disabledClass+')'),
options = ms.find('option').filter(function(){ return($.inArray(this.value, value) > -1); });
if (selections.length > 0){
selectables.removeClass('ms-selected').show();
selections.removeClass('ms-selected').hide();
options.prop('selected', false);
that.$container.find(that.elemsSelector).removeClass('ms-hover');
var selectableOptgroups = that.$selectableUl.children('.ms-optgroup-container');
if (selectableOptgroups.length > 0){
selectableOptgroups.each(function(){
var selectablesLi = $(this).find('.ms-elem-selectable');
if (selectablesLi.filter(':not(.ms-selected)').length > 0){
$(this).find('.ms-optgroup-label').show();
}
});
var selectionOptgroups = that.$selectionUl.children('.ms-optgroup-container');
selectionOptgroups.each(function(){
var selectionsLi = $(this).find('.ms-elem-selection');
if (selectionsLi.filter('.ms-selected').length === 0){
$(this).find('.ms-optgroup-label').hide();
}
});
}
ms.trigger('change');
if (typeof that.options.afterDeselect === 'function') {
that.options.afterDeselect.call(this, value);
}
}
},
'select_all' : function(){
var ms = this.$element,
values = ms.val();
ms.find('option:not(":disabled")').prop('selected', true);
this.$selectableUl.find('.ms-elem-selectable').filter(':not(.'+this.options.disabledClass+')').addClass('ms-selected').hide();
this.$selectionUl.find('.ms-optgroup-label').show();
this.$selectableUl.find('.ms-optgroup-label').hide();
this.$selectionUl.find('.ms-elem-selection').filter(':not(.'+this.options.disabledClass+')').addClass('ms-selected').show();
this.$selectionUl.focus();
ms.trigger('change');
if (typeof this.options.afterSelect === 'function') {
var selectedValues = $.grep(ms.val(), function(item){
return $.inArray(item, values) < 0;
});
this.options.afterSelect.call(this, selectedValues);
}
},
'deselect_all' : function(){
var ms = this.$element,
values = ms.val();
ms.find('option').prop('selected', false);
this.$selectableUl.find('.ms-elem-selectable').removeClass('ms-selected').show();
this.$selectionUl.find('.ms-optgroup-label').hide();
this.$selectableUl.find('.ms-optgroup-label').show();
this.$selectionUl.find('.ms-elem-selection').removeClass('ms-selected').hide();
this.$selectableUl.focus();
ms.trigger('change');
if (typeof this.options.afterDeselect === 'function') {
this.options.afterDeselect.call(this, values);
}
},
sanitize: function(value){
var hash = 0, i, character;
if (value.length == 0) return hash;
var ls = 0;
for (i = 0, ls = value.length; i < ls; i++) {
character = value.charCodeAt(i);
hash = ((hash<<5)-hash)+character;
hash |= 0; // Convert to 32bit integer
}
return hash;
}
};
/* MULTISELECT PLUGIN DEFINITION
* ======================= */
$.fn.multiSelect = function () {
var option = arguments[0],
args = arguments;
return this.each(function () {
var $this = $(this),
data = $this.data('multiselect'),
options = $.extend({}, $.fn.multiSelect.defaults, $this.data(), typeof option === 'object' && option);
if (!data){ $this.data('multiselect', (data = new MultiSelect(this, options))); }
if (typeof option === 'string'){
data[option](args[1]);
} else {
data.init();
}
});
};
$.fn.multiSelect.defaults = {
keySelect: [32],
selectableOptgroup: false,
disabledClass : 'disabled',
dblClick : false,
keepOrder: false,
cssClass: ''
};
$.fn.multiSelect.Constructor = MultiSelect;
$.fn.insertAt = function(index, $parent) {
return this.each(function() {
if (index === 0) {
$parent.prepend(this);
} else {
$parent.children().eq(index - 1).after(this);
}
});
};
}(window.jQuery);
|
!function() {
var d3 = {
version: "3.5.13"
};
var d3_arraySlice = [].slice, d3_array = function(list) {
return d3_arraySlice.call(list);
};
var d3_document = this.document;
function d3_documentElement(node) {
return node && (node.ownerDocument || node.document || node).documentElement;
}
function d3_window(node) {
return node && (node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView);
}
if (d3_document) {
try {
d3_array(d3_document.documentElement.childNodes)[0].nodeType;
} catch (e) {
d3_array = function(list) {
var i = list.length, array = new Array(i);
while (i--) array[i] = list[i];
return array;
};
}
}
if (!Date.now) Date.now = function() {
return +new Date();
};
if (d3_document) {
try {
d3_document.createElement("DIV").style.setProperty("opacity", 0, "");
} catch (error) {
var d3_element_prototype = this.Element.prototype, d3_element_setAttribute = d3_element_prototype.setAttribute, d3_element_setAttributeNS = d3_element_prototype.setAttributeNS, d3_style_prototype = this.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
d3_element_prototype.setAttribute = function(name, value) {
d3_element_setAttribute.call(this, name, value + "");
};
d3_element_prototype.setAttributeNS = function(space, local, value) {
d3_element_setAttributeNS.call(this, space, local, value + "");
};
d3_style_prototype.setProperty = function(name, value, priority) {
d3_style_setProperty.call(this, name, value + "", priority);
};
}
}
d3.ascending = d3_ascending;
function d3_ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
d3.descending = function(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
};
d3.min = function(array, f) {
var i = -1, n = array.length, a, b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) {
a = b;
break;
}
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
} else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {
a = b;
break;
}
while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
}
return a;
};
d3.max = function(array, f) {
var i = -1, n = array.length, a, b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) {
a = b;
break;
}
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
} else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {
a = b;
break;
}
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
}
return a;
};
d3.extent = function(array, f) {
var i = -1, n = array.length, a, b, c;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) {
a = c = b;
break;
}
while (++i < n) if ((b = array[i]) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
} else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {
a = c = b;
break;
}
while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
}
return [ a, c ];
};
function d3_number(x) {
return x === null ? NaN : +x;
}
function d3_numeric(x) {
return !isNaN(x);
}
d3.sum = function(array, f) {
var s = 0, n = array.length, a, i = -1;
if (arguments.length === 1) {
while (++i < n) if (d3_numeric(a = +array[i])) s += a;
} else {
while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a;
}
return s;
};
d3.mean = function(array, f) {
var s = 0, n = array.length, a, i = -1, j = n;
if (arguments.length === 1) {
while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a; else --j;
} else {
while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a; else --j;
}
if (j) return s / j;
};
d3.quantile = function(values, p) {
var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h;
return e ? v + e * (values[h] - v) : v;
};
d3.median = function(array, f) {
var numbers = [], n = array.length, a, i = -1;
if (arguments.length === 1) {
while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a);
} else {
while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a);
}
if (numbers.length) return d3.quantile(numbers.sort(d3_ascending), .5);
};
d3.variance = function(array, f) {
var n = array.length, m = 0, a, d, s = 0, i = -1, j = 0;
if (arguments.length === 1) {
while (++i < n) {
if (d3_numeric(a = d3_number(array[i]))) {
d = a - m;
m += d / ++j;
s += d * (a - m);
}
}
} else {
while (++i < n) {
if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) {
d = a - m;
m += d / ++j;
s += d * (a - m);
}
}
}
if (j > 1) return s / (j - 1);
};
d3.deviation = function() {
var v = d3.variance.apply(this, arguments);
return v ? Math.sqrt(v) : v;
};
function d3_bisector(compare) {
return {
left: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid;
}
return lo;
},
right: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1;
}
return lo;
}
};
}
var d3_bisect = d3_bisector(d3_ascending);
d3.bisectLeft = d3_bisect.left;
d3.bisect = d3.bisectRight = d3_bisect.right;
d3.bisector = function(f) {
return d3_bisector(f.length === 1 ? function(d, x) {
return d3_ascending(f(d), x);
} : f);
};
d3.shuffle = function(array, i0, i1) {
if ((m = arguments.length) < 3) {
i1 = array.length;
if (m < 2) i0 = 0;
}
var m = i1 - i0, t, i;
while (m) {
i = Math.random() * m-- | 0;
t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = t;
}
return array;
};
d3.permute = function(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
};
d3.pairs = function(array) {
var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);
while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ];
return pairs;
};
d3.zip = function() {
if (!(n = arguments.length)) return [];
for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
zip[j] = arguments[j][i];
}
}
return zips;
};
function d3_zipLength(d) {
return d.length;
}
d3.transpose = function(matrix) {
return d3.zip.apply(d3, matrix);
};
d3.keys = function(map) {
var keys = [];
for (var key in map) keys.push(key);
return keys;
};
d3.values = function(map) {
var values = [];
for (var key in map) values.push(map[key]);
return values;
};
d3.entries = function(map) {
var entries = [];
for (var key in map) entries.push({
key: key,
value: map[key]
});
return entries;
};
d3.merge = function(arrays) {
var n = arrays.length, m, i = -1, j = 0, merged, array;
while (++i < n) j += arrays[i].length;
merged = new Array(j);
while (--n >= 0) {
array = arrays[n];
m = array.length;
while (--m >= 0) {
merged[--j] = array[m];
}
}
return merged;
};
var abs = Math.abs;
d3.range = function(start, stop, step) {
if (arguments.length < 3) {
step = 1;
if (arguments.length < 2) {
stop = start;
start = 0;
}
}
if ((stop - start) / step === Infinity) throw new Error("infinite range");
var range = [], k = d3_range_integerScale(abs(step)), i = -1, j;
start *= k, stop *= k, step *= k;
if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
return range;
};
function d3_range_integerScale(x) {
var k = 1;
while (x * k % 1) k *= 10;
return k;
}
function d3_class(ctor, properties) {
for (var key in properties) {
Object.defineProperty(ctor.prototype, key, {
value: properties[key],
enumerable: false
});
}
}
d3.map = function(object, f) {
var map = new d3_Map();
if (object instanceof d3_Map) {
object.forEach(function(key, value) {
map.set(key, value);
});
} else if (Array.isArray(object)) {
var i = -1, n = object.length, o;
if (arguments.length === 1) while (++i < n) map.set(i, object[i]); else while (++i < n) map.set(f.call(object, o = object[i], i), o);
} else {
for (var key in object) map.set(key, object[key]);
}
return map;
};
function d3_Map() {
this._ = Object.create(null);
}
var d3_map_proto = "__proto__", d3_map_zero = "\x00";
d3_class(d3_Map, {
has: d3_map_has,
get: function(key) {
return this._[d3_map_escape(key)];
},
set: function(key, value) {
return this._[d3_map_escape(key)] = value;
},
remove: d3_map_remove,
keys: d3_map_keys,
values: function() {
var values = [];
for (var key in this._) values.push(this._[key]);
return values;
},
entries: function() {
var entries = [];
for (var key in this._) entries.push({
key: d3_map_unescape(key),
value: this._[key]
});
return entries;
},
size: d3_map_size,
empty: d3_map_empty,
forEach: function(f) {
for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]);
}
});
function d3_map_escape(key) {
return (key += "") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key;
}
function d3_map_unescape(key) {
return (key += "")[0] === d3_map_zero ? key.slice(1) : key;
}
function d3_map_has(key) {
return d3_map_escape(key) in this._;
}
function d3_map_remove(key) {
return (key = d3_map_escape(key)) in this._ && delete this._[key];
}
function d3_map_keys() {
var keys = [];
for (var key in this._) keys.push(d3_map_unescape(key));
return keys;
}
function d3_map_size() {
var size = 0;
for (var key in this._) ++size;
return size;
}
function d3_map_empty() {
for (var key in this._) return false;
return true;
}
d3.nest = function() {
var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
function map(mapType, array, depth) {
if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values;
while (++i < n) {
if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
values.push(object);
} else {
valuesByKey.set(keyValue, [ object ]);
}
}
if (mapType) {
object = mapType();
setter = function(keyValue, values) {
object.set(keyValue, map(mapType, values, depth));
};
} else {
object = {};
setter = function(keyValue, values) {
object[keyValue] = map(mapType, values, depth);
};
}
valuesByKey.forEach(setter);
return object;
}
function entries(map, depth) {
if (depth >= keys.length) return map;
var array = [], sortKey = sortKeys[depth++];
map.forEach(function(key, keyMap) {
array.push({
key: key,
values: entries(keyMap, depth)
});
});
return sortKey ? array.sort(function(a, b) {
return sortKey(a.key, b.key);
}) : array;
}
nest.map = function(array, mapType) {
return map(mapType, array, 0);
};
nest.entries = function(array) {
return entries(map(d3.map, array, 0), 0);
};
nest.key = function(d) {
keys.push(d);
return nest;
};
nest.sortKeys = function(order) {
sortKeys[keys.length - 1] = order;
return nest;
};
nest.sortValues = function(order) {
sortValues = order;
return nest;
};
nest.rollup = function(f) {
rollup = f;
return nest;
};
return nest;
};
d3.set = function(array) {
var set = new d3_Set();
if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);
return set;
};
function d3_Set() {
this._ = Object.create(null);
}
d3_class(d3_Set, {
has: d3_map_has,
add: function(key) {
this._[d3_map_escape(key += "")] = true;
return key;
},
remove: d3_map_remove,
values: d3_map_keys,
size: d3_map_size,
empty: d3_map_empty,
forEach: function(f) {
for (var key in this._) f.call(this, d3_map_unescape(key));
}
});
d3.behavior = {};
function d3_identity(d) {
return d;
}
d3.rebind = function(target, source) {
var i = 1, n = arguments.length, method;
while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
return target;
};
function d3_rebind(target, source, method) {
return function() {
var value = method.apply(source, arguments);
return value === source ? target : value;
};
}
function d3_vendorSymbol(object, name) {
if (name in object) return name;
name = name.charAt(0).toUpperCase() + name.slice(1);
for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {
var prefixName = d3_vendorPrefixes[i] + name;
if (prefixName in object) return prefixName;
}
}
var d3_vendorPrefixes = [ "webkit", "ms", "moz", "Moz", "o", "O" ];
function d3_noop() {}
d3.dispatch = function() {
var dispatch = new d3_dispatch(), i = -1, n = arguments.length;
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
return dispatch;
};
function d3_dispatch() {}
d3_dispatch.prototype.on = function(type, listener) {
var i = type.indexOf("."), name = "";
if (i >= 0) {
name = type.slice(i + 1);
type = type.slice(0, i);
}
if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
if (arguments.length === 2) {
if (listener == null) for (type in this) {
if (this.hasOwnProperty(type)) this[type].on(name, null);
}
return this;
}
};
function d3_dispatch_event(dispatch) {
var listeners = [], listenerByName = new d3_Map();
function event() {
var z = listeners, i = -1, n = z.length, l;
while (++i < n) if (l = z[i].on) l.apply(this, arguments);
return dispatch;
}
event.on = function(name, listener) {
var l = listenerByName.get(name), i;
if (arguments.length < 2) return l && l.on;
if (l) {
l.on = null;
listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
listenerByName.remove(name);
}
if (listener) listeners.push(listenerByName.set(name, {
on: listener
}));
return dispatch;
};
return event;
}
d3.event = null;
function d3_eventPreventDefault() {
d3.event.preventDefault();
}
function d3_eventSource() {
var e = d3.event, s;
while (s = e.sourceEvent) e = s;
return e;
}
function d3_eventDispatch(target) {
var dispatch = new d3_dispatch(), i = 0, n = arguments.length;
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
dispatch.of = function(thiz, argumentz) {
return function(e1) {
try {
var e0 = e1.sourceEvent = d3.event;
e1.target = target;
d3.event = e1;
dispatch[e1.type].apply(thiz, argumentz);
} finally {
d3.event = e0;
}
};
};
return dispatch;
}
d3.requote = function(s) {
return s.replace(d3_requote_re, "\\$&");
};
var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
var d3_subclass = {}.__proto__ ? function(object, prototype) {
object.__proto__ = prototype;
} : function(object, prototype) {
for (var property in prototype) object[property] = prototype[property];
};
function d3_selection(groups) {
d3_subclass(groups, d3_selectionPrototype);
return groups;
}
var d3_select = function(s, n) {
return n.querySelector(s);
}, d3_selectAll = function(s, n) {
return n.querySelectorAll(s);
}, d3_selectMatches = function(n, s) {
var d3_selectMatcher = n.matches || n[d3_vendorSymbol(n, "matchesSelector")];
d3_selectMatches = function(n, s) {
return d3_selectMatcher.call(n, s);
};
return d3_selectMatches(n, s);
};
if (typeof Sizzle === "function") {
d3_select = function(s, n) {
return Sizzle(s, n)[0] || null;
};
d3_selectAll = Sizzle;
d3_selectMatches = Sizzle.matchesSelector;
}
d3.selection = function() {
return d3.select(d3_document.documentElement);
};
var d3_selectionPrototype = d3.selection.prototype = [];
d3_selectionPrototype.select = function(selector) {
var subgroups = [], subgroup, subnode, group, node;
selector = d3_selection_selector(selector);
for (var j = -1, m = this.length; ++j < m; ) {
subgroups.push(subgroup = []);
subgroup.parentNode = (group = this[j]).parentNode;
for (var i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) {
subgroup.push(subnode = selector.call(node, node.__data__, i, j));
if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
} else {
subgroup.push(null);
}
}
}
return d3_selection(subgroups);
};
function d3_selection_selector(selector) {
return typeof selector === "function" ? selector : function() {
return d3_select(selector, this);
};
}
d3_selectionPrototype.selectAll = function(selector) {
var subgroups = [], subgroup, node;
selector = d3_selection_selectorAll(selector);
for (var j = -1, m = this.length; ++j < m; ) {
for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) {
subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i, j)));
subgroup.parentNode = node;
}
}
}
return d3_selection(subgroups);
};
function d3_selection_selectorAll(selector) {
return typeof selector === "function" ? selector : function() {
return d3_selectAll(selector, this);
};
}
var d3_nsPrefix = {
svg: "http://www.w3.org/2000/svg",
xhtml: "http://www.w3.org/1999/xhtml",
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
xmlns: "http://www.w3.org/2000/xmlns/"
};
d3.ns = {
prefix: d3_nsPrefix,
qualify: function(name) {
var i = name.indexOf(":"), prefix = name;
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
return d3_nsPrefix.hasOwnProperty(prefix) ? {
space: d3_nsPrefix[prefix],
local: name
} : name;
}
};
d3_selectionPrototype.attr = function(name, value) {
if (arguments.length < 2) {
if (typeof name === "string") {
var node = this.node();
name = d3.ns.qualify(name);
return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
}
for (value in name) this.each(d3_selection_attr(value, name[value]));
return this;
}
return this.each(d3_selection_attr(name, value));
};
function d3_selection_attr(name, value) {
name = d3.ns.qualify(name);
function attrNull() {
this.removeAttribute(name);
}
function attrNullNS() {
this.removeAttributeNS(name.space, name.local);
}
function attrConstant() {
this.setAttribute(name, value);
}
function attrConstantNS() {
this.setAttributeNS(name.space, name.local, value);
}
function attrFunction() {
var x = value.apply(this, arguments);
if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
}
function attrFunctionNS() {
var x = value.apply(this, arguments);
if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
}
return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
}
function d3_collapse(s) {
return s.trim().replace(/\s+/g, " ");
}
d3_selectionPrototype.classed = function(name, value) {
if (arguments.length < 2) {
if (typeof name === "string") {
var node = this.node(), n = (name = d3_selection_classes(name)).length, i = -1;
if (value = node.classList) {
while (++i < n) if (!value.contains(name[i])) return false;
} else {
value = node.getAttribute("class");
while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
}
return true;
}
for (value in name) this.each(d3_selection_classed(value, name[value]));
return this;
}
return this.each(d3_selection_classed(name, value));
};
function d3_selection_classedRe(name) {
return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
}
function d3_selection_classes(name) {
return (name + "").trim().split(/^|\s+/);
}
function d3_selection_classed(name, value) {
name = d3_selection_classes(name).map(d3_selection_classedName);
var n = name.length;
function classedConstant() {
var i = -1;
while (++i < n) name[i](this, value);
}
function classedFunction() {
var i = -1, x = value.apply(this, arguments);
while (++i < n) name[i](this, x);
}
return typeof value === "function" ? classedFunction : classedConstant;
}
function d3_selection_classedName(name) {
var re = d3_selection_classedRe(name);
return function(node, value) {
if (c = node.classList) return value ? c.add(name) : c.remove(name);
var c = node.getAttribute("class") || "";
if (value) {
re.lastIndex = 0;
if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name));
} else {
node.setAttribute("class", d3_collapse(c.replace(re, " ")));
}
};
}
d3_selectionPrototype.style = function(name, value, priority) {
var n = arguments.length;
if (n < 3) {
if (typeof name !== "string") {
if (n < 2) value = "";
for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
return this;
}
if (n < 2) {
var node = this.node();
return d3_window(node).getComputedStyle(node, null).getPropertyValue(name);
}
priority = "";
}
return this.each(d3_selection_style(name, value, priority));
};
function d3_selection_style(name, value, priority) {
function styleNull() {
this.style.removeProperty(name);
}
function styleConstant() {
this.style.setProperty(name, value, priority);
}
function styleFunction() {
var x = value.apply(this, arguments);
if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
}
return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
}
d3_selectionPrototype.property = function(name, value) {
if (arguments.length < 2) {
if (typeof name === "string") return this.node()[name];
for (value in name) this.each(d3_selection_property(value, name[value]));
return this;
}
return this.each(d3_selection_property(name, value));
};
function d3_selection_property(name, value) {
function propertyNull() {
delete this[name];
}
function propertyConstant() {
this[name] = value;
}
function propertyFunction() {
var x = value.apply(this, arguments);
if (x == null) delete this[name]; else this[name] = x;
}
return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
}
d3_selectionPrototype.text = function(value) {
return arguments.length ? this.each(typeof value === "function" ? function() {
var v = value.apply(this, arguments);
this.textContent = v == null ? "" : v;
} : value == null ? function() {
this.textContent = "";
} : function() {
this.textContent = value;
}) : this.node().textContent;
};
d3_selectionPrototype.html = function(value) {
return arguments.length ? this.each(typeof value === "function" ? function() {
var v = value.apply(this, arguments);
this.innerHTML = v == null ? "" : v;
} : value == null ? function() {
this.innerHTML = "";
} : function() {
this.innerHTML = value;
}) : this.node().innerHTML;
};
d3_selectionPrototype.append = function(name) {
name = d3_selection_creator(name);
return this.select(function() {
return this.appendChild(name.apply(this, arguments));
});
};
function d3_selection_creator(name) {
function create() {
var document = this.ownerDocument, namespace = this.namespaceURI;
return namespace ? document.createElementNS(namespace, name) : document.createElement(name);
}
function createNS() {
return this.ownerDocument.createElementNS(name.space, name.local);
}
return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? createNS : create;
}
d3_selectionPrototype.insert = function(name, before) {
name = d3_selection_creator(name);
before = d3_selection_selector(before);
return this.select(function() {
return this.insertBefore(name.apply(this, arguments), before.apply(this, arguments) || null);
});
};
d3_selectionPrototype.remove = function() {
return this.each(d3_selectionRemove);
};
function d3_selectionRemove() {
var parent = this.parentNode;
if (parent) parent.removeChild(this);
}
d3_selectionPrototype.data = function(value, key) {
var i = -1, n = this.length, group, node;
if (!arguments.length) {
value = new Array(n = (group = this[0]).length);
while (++i < n) {
if (node = group[i]) {
value[i] = node.__data__;
}
}
return value;
}
function bind(group, groupData) {
var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;
if (key) {
var nodeByKeyValue = new d3_Map(), keyValues = new Array(n), keyValue;
for (i = -1; ++i < n; ) {
if (node = group[i]) {
if (nodeByKeyValue.has(keyValue = key.call(node, node.__data__, i))) {
exitNodes[i] = node;
} else {
nodeByKeyValue.set(keyValue, node);
}
keyValues[i] = keyValue;
}
}
for (i = -1; ++i < m; ) {
if (!(node = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i], i)))) {
enterNodes[i] = d3_selection_dataNode(nodeData);
} else if (node !== true) {
updateNodes[i] = node;
node.__data__ = nodeData;
}
nodeByKeyValue.set(keyValue, true);
}
for (i = -1; ++i < n; ) {
if (i in keyValues && nodeByKeyValue.get(keyValues[i]) !== true) {
exitNodes[i] = group[i];
}
}
} else {
for (i = -1; ++i < n0; ) {
node = group[i];
nodeData = groupData[i];
if (node) {
node.__data__ = nodeData;
updateNodes[i] = node;
} else {
enterNodes[i] = d3_selection_dataNode(nodeData);
}
}
for (;i < m; ++i) {
enterNodes[i] = d3_selection_dataNode(groupData[i]);
}
for (;i < n; ++i) {
exitNodes[i] = group[i];
}
}
enterNodes.update = updateNodes;
enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
enter.push(enterNodes);
update.push(updateNodes);
exit.push(exitNodes);
}
var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
if (typeof value === "function") {
while (++i < n) {
bind(group = this[i], value.call(group, group.parentNode.__data__, i));
}
} else {
while (++i < n) {
bind(group = this[i], value);
}
}
update.enter = function() {
return enter;
};
update.exit = function() {
return exit;
};
return update;
};
function d3_selection_dataNode(data) {
return {
__data__: data
};
}
d3_selectionPrototype.datum = function(value) {
return arguments.length ? this.property("__data__", value) : this.property("__data__");
};
d3_selectionPrototype.filter = function(filter) {
var subgroups = [], subgroup, group, node;
if (typeof filter !== "function") filter = d3_selection_filter(filter);
for (var j = 0, m = this.length; j < m; j++) {
subgroups.push(subgroup = []);
subgroup.parentNode = (group = this[j]).parentNode;
for (var i = 0, n = group.length; i < n; i++) {
if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {
subgroup.push(node);
}
}
}
return d3_selection(subgroups);
};
function d3_selection_filter(selector) {
return function() {
return d3_selectMatches(this, selector);
};
}
d3_selectionPrototype.order = function() {
for (var j = -1, m = this.length; ++j < m; ) {
for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
if (node = group[i]) {
if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
next = node;
}
}
}
return this;
};
d3_selectionPrototype.sort = function(comparator) {
comparator = d3_selection_sortComparator.apply(this, arguments);
for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
return this.order();
};
function d3_selection_sortComparator(comparator) {
if (!arguments.length) comparator = d3_ascending;
return function(a, b) {
return a && b ? comparator(a.__data__, b.__data__) : !a - !b;
};
}
d3_selectionPrototype.each = function(callback) {
return d3_selection_each(this, function(node, i, j) {
callback.call(node, node.__data__, i, j);
});
};
function d3_selection_each(groups, callback) {
for (var j = 0, m = groups.length; j < m; j++) {
for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
if (node = group[i]) callback(node, i, j);
}
}
return groups;
}
d3_selectionPrototype.call = function(callback) {
var args = d3_array(arguments);
callback.apply(args[0] = this, args);
return this;
};
d3_selectionPrototype.empty = function() {
return !this.node();
};
d3_selectionPrototype.node = function() {
for (var j = 0, m = this.length; j < m; j++) {
for (var group = this[j], i = 0, n = group.length; i < n; i++) {
var node = group[i];
if (node) return node;
}
}
return null;
};
d3_selectionPrototype.size = function() {
var n = 0;
d3_selection_each(this, function() {
++n;
});
return n;
};
function d3_selection_enter(selection) {
d3_subclass(selection, d3_selection_enterPrototype);
return selection;
}
var d3_selection_enterPrototype = [];
d3.selection.enter = d3_selection_enter;
d3.selection.enter.prototype = d3_selection_enterPrototype;
d3_selection_enterPrototype.append = d3_selectionPrototype.append;
d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
d3_selection_enterPrototype.node = d3_selectionPrototype.node;
d3_selection_enterPrototype.call = d3_selectionPrototype.call;
d3_selection_enterPrototype.size = d3_selectionPrototype.size;
d3_selection_enterPrototype.select = function(selector) {
var subgroups = [], subgroup, subnode, upgroup, group, node;
for (var j = -1, m = this.length; ++j < m; ) {
upgroup = (group = this[j]).update;
subgroups.push(subgroup = []);
subgroup.parentNode = group.parentNode;
for (var i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) {
subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i, j));
subnode.__data__ = node.__data__;
} else {
subgroup.push(null);
}
}
}
return d3_selection(subgroups);
};
d3_selection_enterPrototype.insert = function(name, before) {
if (arguments.length < 2) before = d3_selection_enterInsertBefore(this);
return d3_selectionPrototype.insert.call(this, name, before);
};
function d3_selection_enterInsertBefore(enter) {
var i0, j0;
return function(d, i, j) {
var group = enter[j].update, n = group.length, node;
if (j != j0) j0 = j, i0 = 0;
if (i >= i0) i0 = i + 1;
while (!(node = group[i0]) && ++i0 < n) ;
return node;
};
}
d3.select = function(node) {
var group;
if (typeof node === "string") {
group = [ d3_select(node, d3_document) ];
group.parentNode = d3_document.documentElement;
} else {
group = [ node ];
group.parentNode = d3_documentElement(node);
}
return d3_selection([ group ]);
};
d3.selectAll = function(nodes) {
var group;
if (typeof nodes === "string") {
group = d3_array(d3_selectAll(nodes, d3_document));
group.parentNode = d3_document.documentElement;
} else {
group = d3_array(nodes);
group.parentNode = null;
}
return d3_selection([ group ]);
};
d3_selectionPrototype.on = function(type, listener, capture) {
var n = arguments.length;
if (n < 3) {
if (typeof type !== "string") {
if (n < 2) listener = false;
for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
return this;
}
if (n < 2) return (n = this.node()["__on" + type]) && n._;
capture = false;
}
return this.each(d3_selection_on(type, listener, capture));
};
function d3_selection_on(type, listener, capture) {
var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener;
if (i > 0) type = type.slice(0, i);
var filter = d3_selection_onFilters.get(type);
if (filter) type = filter, wrap = d3_selection_onFilter;
function onRemove() {
var l = this[name];
if (l) {
this.removeEventListener(type, l, l.$);
delete this[name];
}
}
function onAdd() {
var l = wrap(listener, d3_array(arguments));
onRemove.call(this);
this.addEventListener(type, this[name] = l, l.$ = capture);
l._ = listener;
}
function removeAll() {
var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match;
for (var name in this) {
if (match = name.match(re)) {
var l = this[name];
this.removeEventListener(match[1], l, l.$);
delete this[name];
}
}
}
return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll;
}
var d3_selection_onFilters = d3.map({
mouseenter: "mouseover",
mouseleave: "mouseout"
});
if (d3_document) {
d3_selection_onFilters.forEach(function(k) {
if ("on" + k in d3_document) d3_selection_onFilters.remove(k);
});
}
function d3_selection_onListener(listener, argumentz) {
return function(e) {
var o = d3.event;
d3.event = e;
argumentz[0] = this.__data__;
try {
listener.apply(this, argumentz);
} finally {
d3.event = o;
}
};
}
function d3_selection_onFilter(listener, argumentz) {
var l = d3_selection_onListener(listener, argumentz);
return function(e) {
var target = this, related = e.relatedTarget;
if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) {
l.call(target, e);
}
};
}
var d3_event_dragSelect, d3_event_dragId = 0;
function d3_event_dragSuppress(node) {
var name = ".dragsuppress-" + ++d3_event_dragId, click = "click" + name, w = d3.select(d3_window(node)).on("touchmove" + name, d3_eventPreventDefault).on("dragstart" + name, d3_eventPreventDefault).on("selectstart" + name, d3_eventPreventDefault);
if (d3_event_dragSelect == null) {
d3_event_dragSelect = "onselectstart" in node ? false : d3_vendorSymbol(node.style, "userSelect");
}
if (d3_event_dragSelect) {
var style = d3_documentElement(node).style, select = style[d3_event_dragSelect];
style[d3_event_dragSelect] = "none";
}
return function(suppressClick) {
w.on(name, null);
if (d3_event_dragSelect) style[d3_event_dragSelect] = select;
if (suppressClick) {
var off = function() {
w.on(click, null);
};
w.on(click, function() {
d3_eventPreventDefault();
off();
}, true);
setTimeout(off, 0);
}
};
}
d3.mouse = function(container) {
return d3_mousePoint(container, d3_eventSource());
};
var d3_mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0;
function d3_mousePoint(container, e) {
if (e.changedTouches) e = e.changedTouches[0];
var svg = container.ownerSVGElement || container;
if (svg.createSVGPoint) {
var point = svg.createSVGPoint();
if (d3_mouse_bug44083 < 0) {
var window = d3_window(container);
if (window.scrollX || window.scrollY) {
svg = d3.select("body").append("svg").style({
position: "absolute",
top: 0,
left: 0,
margin: 0,
padding: 0,
border: "none"
}, "important");
var ctm = svg[0][0].getScreenCTM();
d3_mouse_bug44083 = !(ctm.f || ctm.e);
svg.remove();
}
}
if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY; else point.x = e.clientX,
point.y = e.clientY;
point = point.matrixTransform(container.getScreenCTM().inverse());
return [ point.x, point.y ];
}
var rect = container.getBoundingClientRect();
return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
}
d3.touch = function(container, touches, identifier) {
if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches;
if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) {
if ((touch = touches[i]).identifier === identifier) {
return d3_mousePoint(container, touch);
}
}
};
d3.behavior.drag = function() {
var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, d3_window, "mousemove", "mouseup"), touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_identity, "touchmove", "touchend");
function drag() {
this.on("mousedown.drag", mousedown).on("touchstart.drag", touchstart);
}
function dragstart(id, position, subject, move, end) {
return function() {
var that = this, target = d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id(), dragName = ".drag" + (dragId == null ? "" : "-" + dragId), dragOffset, dragSubject = d3.select(subject(target)).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(target), position0 = position(parent, dragId);
if (origin) {
dragOffset = origin.apply(that, arguments);
dragOffset = [ dragOffset.x - position0[0], dragOffset.y - position0[1] ];
} else {
dragOffset = [ 0, 0 ];
}
dispatch({
type: "dragstart"
});
function moved() {
var position1 = position(parent, dragId), dx, dy;
if (!position1) return;
dx = position1[0] - position0[0];
dy = position1[1] - position0[1];
dragged |= dx | dy;
position0 = position1;
dispatch({
type: "drag",
x: position1[0] + dragOffset[0],
y: position1[1] + dragOffset[1],
dx: dx,
dy: dy
});
}
function ended() {
if (!position(parent, dragId)) return;
dragSubject.on(move + dragName, null).on(end + dragName, null);
dragRestore(dragged);
dispatch({
type: "dragend"
});
}
};
}
drag.origin = function(x) {
if (!arguments.length) return origin;
origin = x;
return drag;
};
return d3.rebind(drag, event, "on");
};
function d3_behavior_dragTouchId() {
return d3.event.changedTouches[0].identifier;
}
d3.touches = function(container, touches) {
if (arguments.length < 2) touches = d3_eventSource().touches;
return touches ? d3_array(touches).map(function(touch) {
var point = d3_mousePoint(container, touch);
point.identifier = touch.identifier;
return point;
}) : [];
};
var ε = 1e-6, ε2 = ε * ε, π = Math.PI, τ = 2 * π, τε = τ - ε, halfπ = π / 2, d3_radians = π / 180, d3_degrees = 180 / π;
function d3_sgn(x) {
return x > 0 ? 1 : x < 0 ? -1 : 0;
}
function d3_cross2d(a, b, c) {
return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
}
function d3_acos(x) {
return x > 1 ? 0 : x < -1 ? π : Math.acos(x);
}
function d3_asin(x) {
return x > 1 ? halfπ : x < -1 ? -halfπ : Math.asin(x);
}
function d3_sinh(x) {
return ((x = Math.exp(x)) - 1 / x) / 2;
}
function d3_cosh(x) {
return ((x = Math.exp(x)) + 1 / x) / 2;
}
function d3_tanh(x) {
return ((x = Math.exp(2 * x)) - 1) / (x + 1);
}
function d3_haversin(x) {
return (x = Math.sin(x / 2)) * x;
}
var ρ = Math.SQRT2, ρ2 = 2, ρ4 = 4;
d3.interpolateZoom = function(p0, p1) {
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S;
if (d2 < ε2) {
S = Math.log(w1 / w0) / ρ;
i = function(t) {
return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * t * S) ];
};
} else {
var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + ρ4 * d2) / (2 * w0 * ρ2 * d1), b1 = (w1 * w1 - w0 * w0 - ρ4 * d2) / (2 * w1 * ρ2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
S = (r1 - r0) / ρ;
i = function(t) {
var s = t * S, coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0));
return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ρ * s + r0) ];
};
}
i.duration = S * 1e3;
return i;
};
d3.behavior.zoom = function() {
var view = {
x: 0,
y: 0,
k: 1
}, translate0, center0, center, size = [ 960, 500 ], scaleExtent = d3_behavior_zoomInfinity, duration = 250, zooming = 0, mousedown = "mousedown.zoom", mousemove = "mousemove.zoom", mouseup = "mouseup.zoom", mousewheelTimer, touchstart = "touchstart.zoom", touchtime, event = d3_eventDispatch(zoom, "zoomstart", "zoom", "zoomend"), x0, x1, y0, y1;
if (!d3_behavior_zoomWheel) {
d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() {
return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1);
}, "wheel") : "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() {
return d3.event.wheelDelta;
}, "mousewheel") : (d3_behavior_zoomDelta = function() {
return -d3.event.detail;
}, "MozMousePixelScroll");
}
function zoom(g) {
g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).on("dblclick.zoom", dblclicked).on(touchstart, touchstarted);
}
zoom.event = function(g) {
g.each(function() {
var dispatch = event.of(this, arguments), view1 = view;
if (d3_transitionInheritId) {
d3.select(this).transition().each("start.zoom", function() {
view = this.__chart__ || {
x: 0,
y: 0,
k: 1
};
zoomstarted(dispatch);
}).tween("zoom:zoom", function() {
var dx = size[0], dy = size[1], cx = center0 ? center0[0] : dx / 2, cy = center0 ? center0[1] : dy / 2, i = d3.interpolateZoom([ (cx - view.x) / view.k, (cy - view.y) / view.k, dx / view.k ], [ (cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k ]);
return function(t) {
var l = i(t), k = dx / l[2];
this.__chart__ = view = {
x: cx - l[0] * k,
y: cy - l[1] * k,
k: k
};
zoomed(dispatch);
};
}).each("interrupt.zoom", function() {
zoomended(dispatch);
}).each("end.zoom", function() {
zoomended(dispatch);
});
} else {
this.__chart__ = view;
zoomstarted(dispatch);
zoomed(dispatch);
zoomended(dispatch);
}
});
};
zoom.translate = function(_) {
if (!arguments.length) return [ view.x, view.y ];
view = {
x: +_[0],
y: +_[1],
k: view.k
};
rescale();
return zoom;
};
zoom.scale = function(_) {
if (!arguments.length) return view.k;
view = {
x: view.x,
y: view.y,
k: null
};
scaleTo(+_);
rescale();
return zoom;
};
zoom.scaleExtent = function(_) {
if (!arguments.length) return scaleExtent;
scaleExtent = _ == null ? d3_behavior_zoomInfinity : [ +_[0], +_[1] ];
return zoom;
};
zoom.center = function(_) {
if (!arguments.length) return center;
center = _ && [ +_[0], +_[1] ];
return zoom;
};
zoom.size = function(_) {
if (!arguments.length) return size;
size = _ && [ +_[0], +_[1] ];
return zoom;
};
zoom.duration = function(_) {
if (!arguments.length) return duration;
duration = +_;
return zoom;
};
zoom.x = function(z) {
if (!arguments.length) return x1;
x1 = z;
x0 = z.copy();
view = {
x: 0,
y: 0,
k: 1
};
return zoom;
};
zoom.y = function(z) {
if (!arguments.length) return y1;
y1 = z;
y0 = z.copy();
view = {
x: 0,
y: 0,
k: 1
};
return zoom;
};
function location(p) {
return [ (p[0] - view.x) / view.k, (p[1] - view.y) / view.k ];
}
function point(l) {
return [ l[0] * view.k + view.x, l[1] * view.k + view.y ];
}
function scaleTo(s) {
view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
}
function translateTo(p, l) {
l = point(l);
view.x += p[0] - l[0];
view.y += p[1] - l[1];
}
function zoomTo(that, p, l, k) {
that.__chart__ = {
x: view.x,
y: view.y,
k: view.k
};
scaleTo(Math.pow(2, k));
translateTo(center0 = p, l);
that = d3.select(that);
if (duration > 0) that = that.transition().duration(duration);
that.call(zoom.event);
}
function rescale() {
if (x1) x1.domain(x0.range().map(function(x) {
return (x - view.x) / view.k;
}).map(x0.invert));
if (y1) y1.domain(y0.range().map(function(y) {
return (y - view.y) / view.k;
}).map(y0.invert));
}
function zoomstarted(dispatch) {
if (!zooming++) dispatch({
type: "zoomstart"
});
}
function zoomed(dispatch) {
rescale();
dispatch({
type: "zoom",
scale: view.k,
translate: [ view.x, view.y ]
});
}
function zoomended(dispatch) {
if (!--zooming) dispatch({
type: "zoomend"
}), center0 = null;
}
function mousedowned() {
var that = this, dispatch = event.of(that, arguments), dragged = 0, subject = d3.select(d3_window(that)).on(mousemove, moved).on(mouseup, ended), location0 = location(d3.mouse(that)), dragRestore = d3_event_dragSuppress(that);
d3_selection_interrupt.call(that);
zoomstarted(dispatch);
function moved() {
dragged = 1;
translateTo(d3.mouse(that), location0);
zoomed(dispatch);
}
function ended() {
subject.on(mousemove, null).on(mouseup, null);
dragRestore(dragged);
zoomended(dispatch);
}
}
function touchstarted() {
var that = this, dispatch = event.of(that, arguments), locations0 = {}, distance0 = 0, scale0, zoomName = ".zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove" + zoomName, touchend = "touchend" + zoomName, targets = [], subject = d3.select(that), dragRestore = d3_event_dragSuppress(that);
started();
zoomstarted(dispatch);
subject.on(mousedown, null).on(touchstart, started);
function relocate() {
var touches = d3.touches(that);
scale0 = view.k;
touches.forEach(function(t) {
if (t.identifier in locations0) locations0[t.identifier] = location(t);
});
return touches;
}
function started() {
var target = d3.event.target;
d3.select(target).on(touchmove, moved).on(touchend, ended);
targets.push(target);
var changed = d3.event.changedTouches;
for (var i = 0, n = changed.length; i < n; ++i) {
locations0[changed[i].identifier] = null;
}
var touches = relocate(), now = Date.now();
if (touches.length === 1) {
if (now - touchtime < 500) {
var p = touches[0];
zoomTo(that, p, locations0[p.identifier], Math.floor(Math.log(view.k) / Math.LN2) + 1);
d3_eventPreventDefault();
}
touchtime = now;
} else if (touches.length > 1) {
var p = touches[0], q = touches[1], dx = p[0] - q[0], dy = p[1] - q[1];
distance0 = dx * dx + dy * dy;
}
}
function moved() {
var touches = d3.touches(that), p0, l0, p1, l1;
d3_selection_interrupt.call(that);
for (var i = 0, n = touches.length; i < n; ++i, l1 = null) {
p1 = touches[i];
if (l1 = locations0[p1.identifier]) {
if (l0) break;
p0 = p1, l0 = l1;
}
}
if (l1) {
var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0);
p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
scaleTo(scale1 * scale0);
}
touchtime = null;
translateTo(p0, l0);
zoomed(dispatch);
}
function ended() {
if (d3.event.touches.length) {
var changed = d3.event.changedTouches;
for (var i = 0, n = changed.length; i < n; ++i) {
delete locations0[changed[i].identifier];
}
for (var identifier in locations0) {
return void relocate();
}
}
d3.selectAll(targets).on(zoomName, null);
subject.on(mousedown, mousedowned).on(touchstart, touchstarted);
dragRestore();
zoomended(dispatch);
}
}
function mousewheeled() {
var dispatch = event.of(this, arguments);
if (mousewheelTimer) clearTimeout(mousewheelTimer); else d3_selection_interrupt.call(this),
translate0 = location(center0 = center || d3.mouse(this)), zoomstarted(dispatch);
mousewheelTimer = setTimeout(function() {
mousewheelTimer = null;
zoomended(dispatch);
}, 50);
d3_eventPreventDefault();
scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * view.k);
translateTo(center0, translate0);
zoomed(dispatch);
}
function dblclicked() {
var p = d3.mouse(this), k = Math.log(view.k) / Math.LN2;
zoomTo(this, p, location(p), d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1);
}
return d3.rebind(zoom, event, "on");
};
var d3_behavior_zoomInfinity = [ 0, Infinity ], d3_behavior_zoomDelta, d3_behavior_zoomWheel;
d3.color = d3_color;
function d3_color() {}
d3_color.prototype.toString = function() {
return this.rgb() + "";
};
d3.hsl = d3_hsl;
function d3_hsl(h, s, l) {
return this instanceof d3_hsl ? void (this.h = +h, this.s = +s, this.l = +l) : arguments.length < 2 ? h instanceof d3_hsl ? new d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : new d3_hsl(h, s, l);
}
var d3_hslPrototype = d3_hsl.prototype = new d3_color();
d3_hslPrototype.brighter = function(k) {
k = Math.pow(.7, arguments.length ? k : 1);
return new d3_hsl(this.h, this.s, this.l / k);
};
d3_hslPrototype.darker = function(k) {
k = Math.pow(.7, arguments.length ? k : 1);
return new d3_hsl(this.h, this.s, k * this.l);
};
d3_hslPrototype.rgb = function() {
return d3_hsl_rgb(this.h, this.s, this.l);
};
function d3_hsl_rgb(h, s, l) {
var m1, m2;
h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h;
s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s;
l = l < 0 ? 0 : l > 1 ? 1 : l;
m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
m1 = 2 * l - m2;
function v(h) {
if (h > 360) h -= 360; else if (h < 0) h += 360;
if (h < 60) return m1 + (m2 - m1) * h / 60;
if (h < 180) return m2;
if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
return m1;
}
function vv(h) {
return Math.round(v(h) * 255);
}
return new d3_rgb(vv(h + 120), vv(h), vv(h - 120));
}
d3.hcl = d3_hcl;
function d3_hcl(h, c, l) {
return this instanceof d3_hcl ? void (this.h = +h, this.c = +c, this.l = +l) : arguments.length < 2 ? h instanceof d3_hcl ? new d3_hcl(h.h, h.c, h.l) : h instanceof d3_lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : new d3_hcl(h, c, l);
}
var d3_hclPrototype = d3_hcl.prototype = new d3_color();
d3_hclPrototype.brighter = function(k) {
return new d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
};
d3_hclPrototype.darker = function(k) {
return new d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
};
d3_hclPrototype.rgb = function() {
return d3_hcl_lab(this.h, this.c, this.l).rgb();
};
function d3_hcl_lab(h, c, l) {
if (isNaN(h)) h = 0;
if (isNaN(c)) c = 0;
return new d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c);
}
d3.lab = d3_lab;
function d3_lab(l, a, b) {
return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b) : arguments.length < 2 ? l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b) : l instanceof d3_hcl ? d3_hcl_lab(l.h, l.c, l.l) : d3_rgb_lab((l = d3_rgb(l)).r, l.g, l.b) : new d3_lab(l, a, b);
}
var d3_lab_K = 18;
var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
var d3_labPrototype = d3_lab.prototype = new d3_color();
d3_labPrototype.brighter = function(k) {
return new d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
};
d3_labPrototype.darker = function(k) {
return new d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
};
d3_labPrototype.rgb = function() {
return d3_lab_rgb(this.l, this.a, this.b);
};
function d3_lab_rgb(l, a, b) {
var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
x = d3_lab_xyz(x) * d3_lab_X;
y = d3_lab_xyz(y) * d3_lab_Y;
z = d3_lab_xyz(z) * d3_lab_Z;
return new d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));
}
function d3_lab_hcl(l, a, b) {
return l > 0 ? new d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l) : new d3_hcl(NaN, NaN, l);
}
function d3_lab_xyz(x) {
return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
}
function d3_xyz_lab(x) {
return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
}
function d3_xyz_rgb(r) {
return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
}
d3.rgb = d3_rgb;
function d3_rgb(r, g, b) {
return this instanceof d3_rgb ? void (this.r = ~~r, this.g = ~~g, this.b = ~~b) : arguments.length < 2 ? r instanceof d3_rgb ? new d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : new d3_rgb(r, g, b);
}
function d3_rgbNumber(value) {
return new d3_rgb(value >> 16, value >> 8 & 255, value & 255);
}
function d3_rgbString(value) {
return d3_rgbNumber(value) + "";
}
var d3_rgbPrototype = d3_rgb.prototype = new d3_color();
d3_rgbPrototype.brighter = function(k) {
k = Math.pow(.7, arguments.length ? k : 1);
var r = this.r, g = this.g, b = this.b, i = 30;
if (!r && !g && !b) return new d3_rgb(i, i, i);
if (r && r < i) r = i;
if (g && g < i) g = i;
if (b && b < i) b = i;
return new d3_rgb(Math.min(255, r / k), Math.min(255, g / k), Math.min(255, b / k));
};
d3_rgbPrototype.darker = function(k) {
k = Math.pow(.7, arguments.length ? k : 1);
return new d3_rgb(k * this.r, k * this.g, k * this.b);
};
d3_rgbPrototype.hsl = function() {
return d3_rgb_hsl(this.r, this.g, this.b);
};
d3_rgbPrototype.toString = function() {
return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
};
function d3_rgb_hex(v) {
return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
}
function d3_rgb_parse(format, rgb, hsl) {
var r = 0, g = 0, b = 0, m1, m2, color;
m1 = /([a-z]+)\((.*)\)/.exec(format = format.toLowerCase());
if (m1) {
m2 = m1[2].split(",");
switch (m1[1]) {
case "hsl":
{
return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
}
case "rgb":
{
return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
}
}
}
if (color = d3_rgb_names.get(format)) {
return rgb(color.r, color.g, color.b);
}
if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.slice(1), 16))) {
if (format.length === 4) {
r = (color & 3840) >> 4;
r = r >> 4 | r;
g = color & 240;
g = g >> 4 | g;
b = color & 15;
b = b << 4 | b;
} else if (format.length === 7) {
r = (color & 16711680) >> 16;
g = (color & 65280) >> 8;
b = color & 255;
}
}
return rgb(r, g, b);
}
function d3_rgb_hsl(r, g, b) {
var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;
if (d) {
s = l < .5 ? d / (max + min) : d / (2 - max - min);
if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4;
h *= 60;
} else {
h = NaN;
s = l > 0 && l < 1 ? 0 : h;
}
return new d3_hsl(h, s, l);
}
function d3_rgb_lab(r, g, b) {
r = d3_rgb_xyz(r);
g = d3_rgb_xyz(g);
b = d3_rgb_xyz(b);
var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);
return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
}
function d3_rgb_xyz(r) {
return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
}
function d3_rgb_parseNumber(c) {
var f = parseFloat(c);
return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
}
var d3_rgb_names = d3.map({
aliceblue: 15792383,
antiquewhite: 16444375,
aqua: 65535,
aquamarine: 8388564,
azure: 15794175,
beige: 16119260,
bisque: 16770244,
black: 0,
blanchedalmond: 16772045,
blue: 255,
blueviolet: 9055202,
brown: 10824234,
burlywood: 14596231,
cadetblue: 6266528,
chartreuse: 8388352,
chocolate: 13789470,
coral: 16744272,
cornflowerblue: 6591981,
cornsilk: 16775388,
crimson: 14423100,
cyan: 65535,
darkblue: 139,
darkcyan: 35723,
darkgoldenrod: 12092939,
darkgray: 11119017,
darkgreen: 25600,
darkgrey: 11119017,
darkkhaki: 12433259,
darkmagenta: 9109643,
darkolivegreen: 5597999,
darkorange: 16747520,
darkorchid: 10040012,
darkred: 9109504,
darksalmon: 15308410,
darkseagreen: 9419919,
darkslateblue: 4734347,
darkslategray: 3100495,
darkslategrey: 3100495,
darkturquoise: 52945,
darkviolet: 9699539,
deeppink: 16716947,
deepskyblue: 49151,
dimgray: 6908265,
dimgrey: 6908265,
dodgerblue: 2003199,
firebrick: 11674146,
floralwhite: 16775920,
forestgreen: 2263842,
fuchsia: 16711935,
gainsboro: 14474460,
ghostwhite: 16316671,
gold: 16766720,
goldenrod: 14329120,
gray: 8421504,
green: 32768,
greenyellow: 11403055,
grey: 8421504,
honeydew: 15794160,
hotpink: 16738740,
indianred: 13458524,
indigo: 4915330,
ivory: 16777200,
khaki: 15787660,
lavender: 15132410,
lavenderblush: 16773365,
lawngreen: 8190976,
lemonchiffon: 16775885,
lightblue: 11393254,
lightcoral: 15761536,
lightcyan: 14745599,
lightgoldenrodyellow: 16448210,
lightgray: 13882323,
lightgreen: 9498256,
lightgrey: 13882323,
lightpink: 16758465,
lightsalmon: 16752762,
lightseagreen: 2142890,
lightskyblue: 8900346,
lightslategray: 7833753,
lightslategrey: 7833753,
lightsteelblue: 11584734,
lightyellow: 16777184,
lime: 65280,
limegreen: 3329330,
linen: 16445670,
magenta: 16711935,
maroon: 8388608,
mediumaquamarine: 6737322,
mediumblue: 205,
mediumorchid: 12211667,
mediumpurple: 9662683,
mediumseagreen: 3978097,
mediumslateblue: 8087790,
mediumspringgreen: 64154,
mediumturquoise: 4772300,
mediumvioletred: 13047173,
midnightblue: 1644912,
mintcream: 16121850,
mistyrose: 16770273,
moccasin: 16770229,
navajowhite: 16768685,
navy: 128,
oldlace: 16643558,
olive: 8421376,
olivedrab: 7048739,
orange: 16753920,
orangered: 16729344,
orchid: 14315734,
palegoldenrod: 15657130,
palegreen: 10025880,
paleturquoise: 11529966,
palevioletred: 14381203,
papayawhip: 16773077,
peachpuff: 16767673,
peru: 13468991,
pink: 16761035,
plum: 14524637,
powderblue: 11591910,
purple: 8388736,
rebeccapurple: 6697881,
red: 16711680,
rosybrown: 12357519,
royalblue: 4286945,
saddlebrown: 9127187,
salmon: 16416882,
sandybrown: 16032864,
seagreen: 3050327,
seashell: 16774638,
sienna: 10506797,
silver: 12632256,
skyblue: 8900331,
slateblue: 6970061,
slategray: 7372944,
slategrey: 7372944,
snow: 16775930,
springgreen: 65407,
steelblue: 4620980,
tan: 13808780,
teal: 32896,
thistle: 14204888,
tomato: 16737095,
turquoise: 4251856,
violet: 15631086,
wheat: 16113331,
white: 16777215,
whitesmoke: 16119285,
yellow: 16776960,
yellowgreen: 10145074
});
d3_rgb_names.forEach(function(key, value) {
d3_rgb_names.set(key, d3_rgbNumber(value));
});
function d3_functor(v) {
return typeof v === "function" ? v : function() {
return v;
};
}
d3.functor = d3_functor;
d3.xhr = d3_xhrType(d3_identity);
function d3_xhrType(response) {
return function(url, mimeType, callback) {
if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType,
mimeType = null;
return d3_xhr(url, mimeType, response, callback);
};
}
function d3_xhr(url, mimeType, response, callback) {
var xhr = {}, dispatch = d3.dispatch("beforesend", "progress", "load", "error"), headers = {}, request = new XMLHttpRequest(), responseType = null;
if (this.XDomainRequest && !("withCredentials" in request) && /^(http(s)?:)?\/\//.test(url)) request = new XDomainRequest();
"onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() {
request.readyState > 3 && respond();
};
function respond() {
var status = request.status, result;
if (!status && d3_xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) {
try {
result = response.call(xhr, request);
} catch (e) {
dispatch.error.call(xhr, e);
return;
}
dispatch.load.call(xhr, result);
} else {
dispatch.error.call(xhr, request);
}
}
request.onprogress = function(event) {
var o = d3.event;
d3.event = event;
try {
dispatch.progress.call(xhr, request);
} finally {
d3.event = o;
}
};
xhr.header = function(name, value) {
name = (name + "").toLowerCase();
if (arguments.length < 2) return headers[name];
if (value == null) delete headers[name]; else headers[name] = value + "";
return xhr;
};
xhr.mimeType = function(value) {
if (!arguments.length) return mimeType;
mimeType = value == null ? null : value + "";
return xhr;
};
xhr.responseType = function(value) {
if (!arguments.length) return responseType;
responseType = value;
return xhr;
};
xhr.response = function(value) {
response = value;
return xhr;
};
[ "get", "post" ].forEach(function(method) {
xhr[method] = function() {
return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments)));
};
});
xhr.send = function(method, data, callback) {
if (arguments.length === 2 && typeof data === "function") callback = data, data = null;
request.open(method, url, true);
if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*";
if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]);
if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType);
if (responseType != null) request.responseType = responseType;
if (callback != null) xhr.on("error", callback).on("load", function(request) {
callback(null, request);
});
dispatch.beforesend.call(xhr, request);
request.send(data == null ? null : data);
return xhr;
};
xhr.abort = function() {
request.abort();
return xhr;
};
d3.rebind(xhr, dispatch, "on");
return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback));
}
function d3_xhr_fixCallback(callback) {
return callback.length === 1 ? function(error, request) {
callback(error == null ? request : null);
} : callback;
}
function d3_xhrHasResponse(request) {
var type = request.responseType;
return type && type !== "text" ? request.response : request.responseText;
}
d3.dsv = function(delimiter, mimeType) {
var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
function dsv(url, row, callback) {
if (arguments.length < 3) callback = row, row = null;
var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback);
xhr.row = function(_) {
return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row;
};
return xhr;
}
function response(request) {
return dsv.parse(request.responseText);
}
function typedResponse(f) {
return function(request) {
return dsv.parse(request.responseText, f);
};
}
dsv.parse = function(text, f) {
var o;
return dsv.parseRows(text, function(row, i) {
if (o) return o(row, i - 1);
var a = new Function("d", "return {" + row.map(function(name, i) {
return JSON.stringify(name) + ": d[" + i + "]";
}).join(",") + "}");
o = f ? function(row, i) {
return f(a(row), i);
} : a;
});
};
dsv.parseRows = function(text, f) {
var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol;
function token() {
if (I >= N) return EOF;
if (eol) return eol = false, EOL;
var j = I;
if (text.charCodeAt(j) === 34) {
var i = j;
while (i++ < N) {
if (text.charCodeAt(i) === 34) {
if (text.charCodeAt(i + 1) !== 34) break;
++i;
}
}
I = i + 2;
var c = text.charCodeAt(i + 1);
if (c === 13) {
eol = true;
if (text.charCodeAt(i + 2) === 10) ++I;
} else if (c === 10) {
eol = true;
}
return text.slice(j + 1, i).replace(/""/g, '"');
}
while (I < N) {
var c = text.charCodeAt(I++), k = 1;
if (c === 10) eol = true; else if (c === 13) {
eol = true;
if (text.charCodeAt(I) === 10) ++I, ++k;
} else if (c !== delimiterCode) continue;
return text.slice(j, I - k);
}
return text.slice(j);
}
while ((t = token()) !== EOF) {
var a = [];
while (t !== EOL && t !== EOF) {
a.push(t);
t = token();
}
if (f && (a = f(a, n++)) == null) continue;
rows.push(a);
}
return rows;
};
dsv.format = function(rows) {
if (Array.isArray(rows[0])) return dsv.formatRows(rows);
var fieldSet = new d3_Set(), fields = [];
rows.forEach(function(row) {
for (var field in row) {
if (!fieldSet.has(field)) {
fields.push(fieldSet.add(field));
}
}
});
return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) {
return fields.map(function(field) {
return formatValue(row[field]);
}).join(delimiter);
})).join("\n");
};
dsv.formatRows = function(rows) {
return rows.map(formatRow).join("\n");
};
function formatRow(row) {
return row.map(formatValue).join(delimiter);
}
function formatValue(text) {
return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
}
return dsv;
};
d3.csv = d3.dsv(",", "text/csv");
d3.tsv = d3.dsv(" ", "text/tab-separated-values");
var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) {
setTimeout(callback, 17);
};
d3.timer = function() {
d3_timer.apply(this, arguments);
};
function d3_timer(callback, delay, then) {
var n = arguments.length;
if (n < 2) delay = 0;
if (n < 3) then = Date.now();
var time = then + delay, timer = {
c: callback,
t: time,
n: null
};
if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer;
d3_timer_queueTail = timer;
if (!d3_timer_interval) {
d3_timer_timeout = clearTimeout(d3_timer_timeout);
d3_timer_interval = 1;
d3_timer_frame(d3_timer_step);
}
return timer;
}
function d3_timer_step() {
var now = d3_timer_mark(), delay = d3_timer_sweep() - now;
if (delay > 24) {
if (isFinite(delay)) {
clearTimeout(d3_timer_timeout);
d3_timer_timeout = setTimeout(d3_timer_step, delay);
}
d3_timer_interval = 0;
} else {
d3_timer_interval = 1;
d3_timer_frame(d3_timer_step);
}
}
d3.timer.flush = function() {
d3_timer_mark();
d3_timer_sweep();
};
function d3_timer_mark() {
var now = Date.now(), timer = d3_timer_queueHead;
while (timer) {
if (now >= timer.t && timer.c(now - timer.t)) timer.c = null;
timer = timer.n;
}
return now;
}
function d3_timer_sweep() {
var t0, t1 = d3_timer_queueHead, time = Infinity;
while (t1) {
if (t1.c) {
if (t1.t < time) time = t1.t;
t1 = (t0 = t1).n;
} else {
t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
}
}
d3_timer_queueTail = t0;
return time;
}
function d3_format_precision(x, p) {
return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1);
}
d3.round = function(x, n) {
return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
};
var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
d3.formatPrefix = function(value, precision) {
var i = 0;
if (value = +value) {
if (value < 0) value *= -1;
if (precision) value = d3.round(value, d3_format_precision(value, precision));
i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3));
}
return d3_formatPrefixes[8 + i / 3];
};
function d3_formatPrefix(d, i) {
var k = Math.pow(10, abs(8 - i) * 3);
return {
scale: i > 8 ? function(d) {
return d / k;
} : function(d) {
return d * k;
},
symbol: d
};
}
function d3_locale_numberFormat(locale) {
var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping && locale_thousands ? function(value, width) {
var i = value.length, t = [], j = 0, g = locale_grouping[0], length = 0;
while (i > 0 && g > 0) {
if (length + g + 1 > width) g = Math.max(1, width - length);
t.push(value.substring(i -= g, i + g));
if ((length += g + 1) > width) break;
g = locale_grouping[j = (j + 1) % locale_grouping.length];
}
return t.reverse().join(locale_thousands);
} : d3_identity;
return function(specifier) {
var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "-", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = "", suffix = "", integer = false, exponent = true;
if (precision) precision = +precision.substring(1);
if (zfill || fill === "0" && align === "=") {
zfill = fill = "0";
align = "=";
}
switch (type) {
case "n":
comma = true;
type = "g";
break;
case "%":
scale = 100;
suffix = "%";
type = "f";
break;
case "p":
scale = 100;
suffix = "%";
type = "r";
break;
case "b":
case "o":
case "x":
case "X":
if (symbol === "#") prefix = "0" + type.toLowerCase();
case "c":
exponent = false;
case "d":
integer = true;
precision = 0;
break;
case "s":
scale = -1;
type = "r";
break;
}
if (symbol === "$") prefix = locale_currency[0], suffix = locale_currency[1];
if (type == "r" && !precision) type = "g";
if (precision != null) {
if (type == "g") precision = Math.max(1, Math.min(21, precision)); else if (type == "e" || type == "f") precision = Math.max(0, Math.min(20, precision));
}
type = d3_format_types.get(type) || d3_format_typeDefault;
var zcomma = zfill && comma;
return function(value) {
var fullSuffix = suffix;
if (integer && value % 1) return "";
var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign === "-" ? "" : sign;
if (scale < 0) {
var unit = d3.formatPrefix(value, precision);
value = unit.scale(value);
fullSuffix = unit.symbol + suffix;
} else {
value *= scale;
}
value = type(value, precision);
var i = value.lastIndexOf("."), before, after;
if (i < 0) {
var j = exponent ? value.lastIndexOf("e") : -1;
if (j < 0) before = value, after = ""; else before = value.substring(0, j), after = value.substring(j);
} else {
before = value.substring(0, i);
after = locale_decimal + value.substring(i + 1);
}
if (!zfill && comma) before = formatGroup(before, Infinity);
var length = prefix.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : "";
if (zcomma) before = formatGroup(padding + before, padding.length ? width - after.length : Infinity);
negative += prefix;
value = before + after;
return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + fullSuffix;
};
};
}
var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;
var d3_format_types = d3.map({
b: function(x) {
return x.toString(2);
},
c: function(x) {
return String.fromCharCode(x);
},
o: function(x) {
return x.toString(8);
},
x: function(x) {
return x.toString(16);
},
X: function(x) {
return x.toString(16).toUpperCase();
},
g: function(x, p) {
return x.toPrecision(p);
},
e: function(x, p) {
return x.toExponential(p);
},
f: function(x, p) {
return x.toFixed(p);
},
r: function(x, p) {
return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p))));
}
});
function d3_format_typeDefault(x) {
return x + "";
}
var d3_time = d3.time = {}, d3_date = Date;
function d3_date_utc() {
this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
}
d3_date_utc.prototype = {
getDate: function() {
return this._.getUTCDate();
},
getDay: function() {
return this._.getUTCDay();
},
getFullYear: function() {
return this._.getUTCFullYear();
},
getHours: function() {
return this._.getUTCHours();
},
getMilliseconds: function() {
return this._.getUTCMilliseconds();
},
getMinutes: function() {
return this._.getUTCMinutes();
},
getMonth: function() {
return this._.getUTCMonth();
},
getSeconds: function() {
return this._.getUTCSeconds();
},
getTime: function() {
return this._.getTime();
},
getTimezoneOffset: function() {
return 0;
},
valueOf: function() {
return this._.valueOf();
},
setDate: function() {
d3_time_prototype.setUTCDate.apply(this._, arguments);
},
setDay: function() {
d3_time_prototype.setUTCDay.apply(this._, arguments);
},
setFullYear: function() {
d3_time_prototype.setUTCFullYear.apply(this._, arguments);
},
setHours: function() {
d3_time_prototype.setUTCHours.apply(this._, arguments);
},
setMilliseconds: function() {
d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
},
setMinutes: function() {
d3_time_prototype.setUTCMinutes.apply(this._, arguments);
},
setMonth: function() {
d3_time_prototype.setUTCMonth.apply(this._, arguments);
},
setSeconds: function() {
d3_time_prototype.setUTCSeconds.apply(this._, arguments);
},
setTime: function() {
d3_time_prototype.setTime.apply(this._, arguments);
}
};
var d3_time_prototype = Date.prototype;
function d3_time_interval(local, step, number) {
function round(date) {
var d0 = local(date), d1 = offset(d0, 1);
return date - d0 < d1 - date ? d0 : d1;
}
function ceil(date) {
step(date = local(new d3_date(date - 1)), 1);
return date;
}
function offset(date, k) {
step(date = new d3_date(+date), k);
return date;
}
function range(t0, t1, dt) {
var time = ceil(t0), times = [];
if (dt > 1) {
while (time < t1) {
if (!(number(time) % dt)) times.push(new Date(+time));
step(time, 1);
}
} else {
while (time < t1) times.push(new Date(+time)), step(time, 1);
}
return times;
}
function range_utc(t0, t1, dt) {
try {
d3_date = d3_date_utc;
var utc = new d3_date_utc();
utc._ = t0;
return range(utc, t1, dt);
} finally {
d3_date = Date;
}
}
local.floor = local;
local.round = round;
local.ceil = ceil;
local.offset = offset;
local.range = range;
var utc = local.utc = d3_time_interval_utc(local);
utc.floor = utc;
utc.round = d3_time_interval_utc(round);
utc.ceil = d3_time_interval_utc(ceil);
utc.offset = d3_time_interval_utc(offset);
utc.range = range_utc;
return local;
}
function d3_time_interval_utc(method) {
return function(date, k) {
try {
d3_date = d3_date_utc;
var utc = new d3_date_utc();
utc._ = date;
return method(utc, k)._;
} finally {
d3_date = Date;
}
};
}
d3_time.year = d3_time_interval(function(date) {
date = d3_time.day(date);
date.setMonth(0, 1);
return date;
}, function(date, offset) {
date.setFullYear(date.getFullYear() + offset);
}, function(date) {
return date.getFullYear();
});
d3_time.years = d3_time.year.range;
d3_time.years.utc = d3_time.year.utc.range;
d3_time.day = d3_time_interval(function(date) {
var day = new d3_date(2e3, 0);
day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
return day;
}, function(date, offset) {
date.setDate(date.getDate() + offset);
}, function(date) {
return date.getDate() - 1;
});
d3_time.days = d3_time.day.range;
d3_time.days.utc = d3_time.day.utc.range;
d3_time.dayOfYear = function(date) {
var year = d3_time.year(date);
return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
};
[ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" ].forEach(function(day, i) {
i = 7 - i;
var interval = d3_time[day] = d3_time_interval(function(date) {
(date = d3_time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
return date;
}, function(date, offset) {
date.setDate(date.getDate() + Math.floor(offset) * 7);
}, function(date) {
var day = d3_time.year(date).getDay();
return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
});
d3_time[day + "s"] = interval.range;
d3_time[day + "s"].utc = interval.utc.range;
d3_time[day + "OfYear"] = function(date) {
var day = d3_time.year(date).getDay();
return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7);
};
});
d3_time.week = d3_time.sunday;
d3_time.weeks = d3_time.sunday.range;
d3_time.weeks.utc = d3_time.sunday.utc.range;
d3_time.weekOfYear = d3_time.sundayOfYear;
function d3_locale_timeFormat(locale) {
var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_days = locale.days, locale_shortDays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths;
function d3_time_format(template) {
var n = template.length;
function format(date) {
var string = [], i = -1, j = 0, c, p, f;
while (++i < n) {
if (template.charCodeAt(i) === 37) {
string.push(template.slice(j, i));
if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i);
if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p);
string.push(c);
j = i + 1;
}
}
string.push(template.slice(j, i));
return string.join("");
}
format.parse = function(string) {
var d = {
y: 1900,
m: 0,
d: 1,
H: 0,
M: 0,
S: 0,
L: 0,
Z: null
}, i = d3_time_parse(d, template, string, 0);
if (i != string.length) return null;
if ("p" in d) d.H = d.H % 12 + d.p * 12;
var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)();
if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("W" in d || "U" in d) {
if (!("w" in d)) d.w = "W" in d ? 1 : 0;
date.setFullYear(d.y, 0, 1);
date.setFullYear(d.y, 0, "W" in d ? (d.w + 6) % 7 + d.W * 7 - (date.getDay() + 5) % 7 : d.w + d.U * 7 - (date.getDay() + 6) % 7);
} else date.setFullYear(d.y, d.m, d.d);
date.setHours(d.H + (d.Z / 100 | 0), d.M + d.Z % 100, d.S, d.L);
return localZ ? date._ : date;
};
format.toString = function() {
return template;
};
return format;
}
function d3_time_parse(date, template, string, j) {
var c, p, t, i = 0, n = template.length, m = string.length;
while (i < n) {
if (j >= m) return -1;
c = template.charCodeAt(i++);
if (c === 37) {
t = template.charAt(i++);
p = d3_time_parsers[t in d3_time_formatPads ? template.charAt(i++) : t];
if (!p || (j = p(date, string, j)) < 0) return -1;
} else if (c != string.charCodeAt(j++)) {
return -1;
}
}
return j;
}
d3_time_format.utc = function(template) {
var local = d3_time_format(template);
function format(date) {
try {
d3_date = d3_date_utc;
var utc = new d3_date();
utc._ = date;
return local(utc);
} finally {
d3_date = Date;
}
}
format.parse = function(string) {
try {
d3_date = d3_date_utc;
var date = local.parse(string);
return date && date._;
} finally {
d3_date = Date;
}
};
format.toString = local.toString;
return format;
};
d3_time_format.multi = d3_time_format.utc.multi = d3_time_formatMulti;
var d3_time_periodLookup = d3.map(), d3_time_dayRe = d3_time_formatRe(locale_days), d3_time_dayLookup = d3_time_formatLookup(locale_days), d3_time_dayAbbrevRe = d3_time_formatRe(locale_shortDays), d3_time_dayAbbrevLookup = d3_time_formatLookup(locale_shortDays), d3_time_monthRe = d3_time_formatRe(locale_months), d3_time_monthLookup = d3_time_formatLookup(locale_months), d3_time_monthAbbrevRe = d3_time_formatRe(locale_shortMonths), d3_time_monthAbbrevLookup = d3_time_formatLookup(locale_shortMonths);
locale_periods.forEach(function(p, i) {
d3_time_periodLookup.set(p.toLowerCase(), i);
});
var d3_time_formats = {
a: function(d) {
return locale_shortDays[d.getDay()];
},
A: function(d) {
return locale_days[d.getDay()];
},
b: function(d) {
return locale_shortMonths[d.getMonth()];
},
B: function(d) {
return locale_months[d.getMonth()];
},
c: d3_time_format(locale_dateTime),
d: function(d, p) {
return d3_time_formatPad(d.getDate(), p, 2);
},
e: function(d, p) {
return d3_time_formatPad(d.getDate(), p, 2);
},
H: function(d, p) {
return d3_time_formatPad(d.getHours(), p, 2);
},
I: function(d, p) {
return d3_time_formatPad(d.getHours() % 12 || 12, p, 2);
},
j: function(d, p) {
return d3_time_formatPad(1 + d3_time.dayOfYear(d), p, 3);
},
L: function(d, p) {
return d3_time_formatPad(d.getMilliseconds(), p, 3);
},
m: function(d, p) {
return d3_time_formatPad(d.getMonth() + 1, p, 2);
},
M: function(d, p) {
return d3_time_formatPad(d.getMinutes(), p, 2);
},
p: function(d) {
return locale_periods[+(d.getHours() >= 12)];
},
S: function(d, p) {
return d3_time_formatPad(d.getSeconds(), p, 2);
},
U: function(d, p) {
return d3_time_formatPad(d3_time.sundayOfYear(d), p, 2);
},
w: function(d) {
return d.getDay();
},
W: function(d, p) {
return d3_time_formatPad(d3_time.mondayOfYear(d), p, 2);
},
x: d3_time_format(locale_date),
X: d3_time_format(locale_time),
y: function(d, p) {
return d3_time_formatPad(d.getFullYear() % 100, p, 2);
},
Y: function(d, p) {
return d3_time_formatPad(d.getFullYear() % 1e4, p, 4);
},
Z: d3_time_zone,
"%": function() {
return "%";
}
};
var d3_time_parsers = {
a: d3_time_parseWeekdayAbbrev,
A: d3_time_parseWeekday,
b: d3_time_parseMonthAbbrev,
B: d3_time_parseMonth,
c: d3_time_parseLocaleFull,
d: d3_time_parseDay,
e: d3_time_parseDay,
H: d3_time_parseHour24,
I: d3_time_parseHour24,
j: d3_time_parseDayOfYear,
L: d3_time_parseMilliseconds,
m: d3_time_parseMonthNumber,
M: d3_time_parseMinutes,
p: d3_time_parseAmPm,
S: d3_time_parseSeconds,
U: d3_time_parseWeekNumberSunday,
w: d3_time_parseWeekdayNumber,
W: d3_time_parseWeekNumberMonday,
x: d3_time_parseLocaleDate,
X: d3_time_parseLocaleTime,
y: d3_time_parseYear,
Y: d3_time_parseFullYear,
Z: d3_time_parseZone,
"%": d3_time_parseLiteralPercent
};
function d3_time_parseWeekdayAbbrev(date, string, i) {
d3_time_dayAbbrevRe.lastIndex = 0;
var n = d3_time_dayAbbrevRe.exec(string.slice(i));
return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}
function d3_time_parseWeekday(date, string, i) {
d3_time_dayRe.lastIndex = 0;
var n = d3_time_dayRe.exec(string.slice(i));
return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}
function d3_time_parseMonthAbbrev(date, string, i) {
d3_time_monthAbbrevRe.lastIndex = 0;
var n = d3_time_monthAbbrevRe.exec(string.slice(i));
return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}
function d3_time_parseMonth(date, string, i) {
d3_time_monthRe.lastIndex = 0;
var n = d3_time_monthRe.exec(string.slice(i));
return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}
function d3_time_parseLocaleFull(date, string, i) {
return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
}
function d3_time_parseLocaleDate(date, string, i) {
return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
}
function d3_time_parseLocaleTime(date, string, i) {
return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
}
function d3_time_parseAmPm(date, string, i) {
var n = d3_time_periodLookup.get(string.slice(i, i += 2).toLowerCase());
return n == null ? -1 : (date.p = n, i);
}
return d3_time_format;
}
var d3_time_formatPads = {
"-": "",
_: " ",
"0": "0"
}, d3_time_numberRe = /^\s*\d+/, d3_time_percentRe = /^%/;
function d3_time_formatPad(value, fill, width) {
var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length;
return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
}
function d3_time_formatRe(names) {
return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
}
function d3_time_formatLookup(names) {
var map = new d3_Map(), i = -1, n = names.length;
while (++i < n) map.set(names[i].toLowerCase(), i);
return map;
}
function d3_time_parseWeekdayNumber(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i, i + 1));
return n ? (date.w = +n[0], i + n[0].length) : -1;
}
function d3_time_parseWeekNumberSunday(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i));
return n ? (date.U = +n[0], i + n[0].length) : -1;
}
function d3_time_parseWeekNumberMonday(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i));
return n ? (date.W = +n[0], i + n[0].length) : -1;
}
function d3_time_parseFullYear(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i, i + 4));
return n ? (date.y = +n[0], i + n[0].length) : -1;
}
function d3_time_parseYear(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1;
}
function d3_time_parseZone(date, string, i) {
return /^[+-]\d{4}$/.test(string = string.slice(i, i + 5)) ? (date.Z = -string,
i + 5) : -1;
}
function d3_time_expandYear(d) {
return d + (d > 68 ? 1900 : 2e3);
}
function d3_time_parseMonthNumber(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
return n ? (date.m = n[0] - 1, i + n[0].length) : -1;
}
function d3_time_parseDay(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
return n ? (date.d = +n[0], i + n[0].length) : -1;
}
function d3_time_parseDayOfYear(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i, i + 3));
return n ? (date.j = +n[0], i + n[0].length) : -1;
}
function d3_time_parseHour24(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
return n ? (date.H = +n[0], i + n[0].length) : -1;
}
function d3_time_parseMinutes(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
return n ? (date.M = +n[0], i + n[0].length) : -1;
}
function d3_time_parseSeconds(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
return n ? (date.S = +n[0], i + n[0].length) : -1;
}
function d3_time_parseMilliseconds(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.slice(i, i + 3));
return n ? (date.L = +n[0], i + n[0].length) : -1;
}
function d3_time_zone(d) {
var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = abs(z) / 60 | 0, zm = abs(z) % 60;
return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2);
}
function d3_time_parseLiteralPercent(date, string, i) {
d3_time_percentRe.lastIndex = 0;
var n = d3_time_percentRe.exec(string.slice(i, i + 1));
return n ? i + n[0].length : -1;
}
function d3_time_formatMulti(formats) {
var n = formats.length, i = -1;
while (++i < n) formats[i][0] = this(formats[i][0]);
return function(date) {
var i = 0, f = formats[i];
while (!f[1](date)) f = formats[++i];
return f[0](date);
};
}
d3.locale = function(locale) {
return {
numberFormat: d3_locale_numberFormat(locale),
timeFormat: d3_locale_timeFormat(locale)
};
};
var d3_locale_enUS = d3.locale({
decimal: ".",
thousands: ",",
grouping: [ 3 ],
currency: [ "$", "" ],
dateTime: "%a %b %e %X %Y",
date: "%m/%d/%Y",
time: "%H:%M:%S",
periods: [ "AM", "PM" ],
days: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ],
shortDays: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ],
months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
shortMonths: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ]
});
d3.format = d3_locale_enUS.numberFormat;
d3.geo = {};
function d3_adder() {}
d3_adder.prototype = {
s: 0,
t: 0,
add: function(y) {
d3_adderSum(y, this.t, d3_adderTemp);
d3_adderSum(d3_adderTemp.s, this.s, this);
if (this.s) this.t += d3_adderTemp.t; else this.s = d3_adderTemp.t;
},
reset: function() {
this.s = this.t = 0;
},
valueOf: function() {
return this.s;
}
};
var d3_adderTemp = new d3_adder();
function d3_adderSum(a, b, o) {
var x = o.s = a + b, bv = x - a, av = x - bv;
o.t = a - av + (b - bv);
}
d3.geo.stream = function(object, listener) {
if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) {
d3_geo_streamObjectType[object.type](object, listener);
} else {
d3_geo_streamGeometry(object, listener);
}
};
function d3_geo_streamGeometry(geometry, listener) {
if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) {
d3_geo_streamGeometryType[geometry.type](geometry, listener);
}
}
var d3_geo_streamObjectType = {
Feature: function(feature, listener) {
d3_geo_streamGeometry(feature.geometry, listener);
},
FeatureCollection: function(object, listener) {
var features = object.features, i = -1, n = features.length;
while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);
}
};
var d3_geo_streamGeometryType = {
Sphere: function(object, listener) {
listener.sphere();
},
Point: function(object, listener) {
object = object.coordinates;
listener.point(object[0], object[1], object[2]);
},
MultiPoint: function(object, listener) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) object = coordinates[i], listener.point(object[0], object[1], object[2]);
},
LineString: function(object, listener) {
d3_geo_streamLine(object.coordinates, listener, 0);
},
MultiLineString: function(object, listener) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0);
},
Polygon: function(object, listener) {
d3_geo_streamPolygon(object.coordinates, listener);
},
MultiPolygon: function(object, listener) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
},
GeometryCollection: function(object, listener) {
var geometries = object.geometries, i = -1, n = geometries.length;
while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
}
};
function d3_geo_streamLine(coordinates, listener, closed) {
var i = -1, n = coordinates.length - closed, coordinate;
listener.lineStart();
while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1], coordinate[2]);
listener.lineEnd();
}
function d3_geo_streamPolygon(coordinates, listener) {
var i = -1, n = coordinates.length;
listener.polygonStart();
while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1);
listener.polygonEnd();
}
d3.geo.area = function(object) {
d3_geo_areaSum = 0;
d3.geo.stream(object, d3_geo_area);
return d3_geo_areaSum;
};
var d3_geo_areaSum, d3_geo_areaRingSum = new d3_adder();
var d3_geo_area = {
sphere: function() {
d3_geo_areaSum += 4 * π;
},
point: d3_noop,
lineStart: d3_noop,
lineEnd: d3_noop,
polygonStart: function() {
d3_geo_areaRingSum.reset();
d3_geo_area.lineStart = d3_geo_areaRingStart;
},
polygonEnd: function() {
var area = 2 * d3_geo_areaRingSum;
d3_geo_areaSum += area < 0 ? 4 * π + area : area;
d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop;
}
};
function d3_geo_areaRingStart() {
var λ00, φ00, λ0, cosφ0, sinφ0;
d3_geo_area.point = function(λ, φ) {
d3_geo_area.point = nextPoint;
λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4),
sinφ0 = Math.sin(φ);
};
function nextPoint(λ, φ) {
λ *= d3_radians;
φ = φ * d3_radians / 2 + π / 4;
var dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(adλ), v = k * sdλ * Math.sin(adλ);
d3_geo_areaRingSum.add(Math.atan2(v, u));
λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;
}
d3_geo_area.lineEnd = function() {
nextPoint(λ00, φ00);
};
}
function d3_geo_cartesian(spherical) {
var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ);
return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ];
}
function d3_geo_cartesianDot(a, b) {
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}
function d3_geo_cartesianCross(a, b) {
return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ];
}
function d3_geo_cartesianAdd(a, b) {
a[0] += b[0];
a[1] += b[1];
a[2] += b[2];
}
function d3_geo_cartesianScale(vector, k) {
return [ vector[0] * k, vector[1] * k, vector[2] * k ];
}
function d3_geo_cartesianNormalize(d) {
var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
d[0] /= l;
d[1] /= l;
d[2] /= l;
}
function d3_geo_spherical(cartesian) {
return [ Math.atan2(cartesian[1], cartesian[0]), d3_asin(cartesian[2]) ];
}
function d3_geo_sphericalEqual(a, b) {
return abs(a[0] - b[0]) < ε && abs(a[1] - b[1]) < ε;
}
d3.geo.bounds = function() {
var λ0, φ0, λ1, φ1, λ_, λ__, φ__, p0, dλSum, ranges, range;
var bound = {
point: point,
lineStart: lineStart,
lineEnd: lineEnd,
polygonStart: function() {
bound.point = ringPoint;
bound.lineStart = ringStart;
bound.lineEnd = ringEnd;
dλSum = 0;
d3_geo_area.polygonStart();
},
polygonEnd: function() {
d3_geo_area.polygonEnd();
bound.point = point;
bound.lineStart = lineStart;
bound.lineEnd = lineEnd;
if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90); else if (dλSum > ε) φ1 = 90; else if (dλSum < -ε) φ0 = -90;
range[0] = λ0, range[1] = λ1;
}
};
function point(λ, φ) {
ranges.push(range = [ λ0 = λ, λ1 = λ ]);
if (φ < φ0) φ0 = φ;
if (φ > φ1) φ1 = φ;
}
function linePoint(λ, φ) {
var p = d3_geo_cartesian([ λ * d3_radians, φ * d3_radians ]);
if (p0) {
var normal = d3_geo_cartesianCross(p0, p), equatorial = [ normal[1], -normal[0], 0 ], inflection = d3_geo_cartesianCross(equatorial, normal);
d3_geo_cartesianNormalize(inflection);
inflection = d3_geo_spherical(inflection);
var dλ = λ - λ_, s = dλ > 0 ? 1 : -1, λi = inflection[0] * d3_degrees * s, antimeridian = abs(dλ) > 180;
if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) {
var φi = inflection[1] * d3_degrees;
if (φi > φ1) φ1 = φi;
} else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) {
var φi = -inflection[1] * d3_degrees;
if (φi < φ0) φ0 = φi;
} else {
if (φ < φ0) φ0 = φ;
if (φ > φ1) φ1 = φ;
}
if (antimeridian) {
if (λ < λ_) {
if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;
} else {
if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;
}
} else {
if (λ1 >= λ0) {
if (λ < λ0) λ0 = λ;
if (λ > λ1) λ1 = λ;
} else {
if (λ > λ_) {
if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;
} else {
if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;
}
}
}
} else {
point(λ, φ);
}
p0 = p, λ_ = λ;
}
function lineStart() {
bound.point = linePoint;
}
function lineEnd() {
range[0] = λ0, range[1] = λ1;
bound.point = point;
p0 = null;
}
function ringPoint(λ, φ) {
if (p0) {
var dλ = λ - λ_;
dλSum += abs(dλ) > 180 ? dλ + (dλ > 0 ? 360 : -360) : dλ;
} else λ__ = λ, φ__ = φ;
d3_geo_area.point(λ, φ);
linePoint(λ, φ);
}
function ringStart() {
d3_geo_area.lineStart();
}
function ringEnd() {
ringPoint(λ__, φ__);
d3_geo_area.lineEnd();
if (abs(dλSum) > ε) λ0 = -(λ1 = 180);
range[0] = λ0, range[1] = λ1;
p0 = null;
}
function angle(λ0, λ1) {
return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1;
}
function compareRanges(a, b) {
return a[0] - b[0];
}
function withinRange(x, range) {
return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
}
return function(feature) {
φ1 = λ1 = -(λ0 = φ0 = Infinity);
ranges = [];
d3.geo.stream(feature, bound);
var n = ranges.length;
if (n) {
ranges.sort(compareRanges);
for (var i = 1, a = ranges[0], b, merged = [ a ]; i < n; ++i) {
b = ranges[i];
if (withinRange(b[0], a) || withinRange(b[1], a)) {
if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];
if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];
} else {
merged.push(a = b);
}
}
var best = -Infinity, dλ;
for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) {
b = merged[i];
if ((dλ = angle(a[1], b[0])) > best) best = dλ, λ0 = b[0], λ1 = a[1];
}
}
ranges = range = null;
return λ0 === Infinity || φ0 === Infinity ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ λ0, φ0 ], [ λ1, φ1 ] ];
};
}();
d3.geo.centroid = function(object) {
d3_geo_centroidW0 = d3_geo_centroidW1 = d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0;
d3.geo.stream(object, d3_geo_centroid);
var x = d3_geo_centroidX2, y = d3_geo_centroidY2, z = d3_geo_centroidZ2, m = x * x + y * y + z * z;
if (m < ε2) {
x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1;
if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0;
m = x * x + y * y + z * z;
if (m < ε2) return [ NaN, NaN ];
}
return [ Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees ];
};
var d3_geo_centroidW0, d3_geo_centroidW1, d3_geo_centroidX0, d3_geo_centroidY0, d3_geo_centroidZ0, d3_geo_centroidX1, d3_geo_centroidY1, d3_geo_centroidZ1, d3_geo_centroidX2, d3_geo_centroidY2, d3_geo_centroidZ2;
var d3_geo_centroid = {
sphere: d3_noop,
point: d3_geo_centroidPoint,
lineStart: d3_geo_centroidLineStart,
lineEnd: d3_geo_centroidLineEnd,
polygonStart: function() {
d3_geo_centroid.lineStart = d3_geo_centroidRingStart;
},
polygonEnd: function() {
d3_geo_centroid.lineStart = d3_geo_centroidLineStart;
}
};
function d3_geo_centroidPoint(λ, φ) {
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians);
d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ));
}
function d3_geo_centroidPointXYZ(x, y, z) {
++d3_geo_centroidW0;
d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0;
d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0;
d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0;
}
function d3_geo_centroidLineStart() {
var x0, y0, z0;
d3_geo_centroid.point = function(λ, φ) {
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians);
x0 = cosφ * Math.cos(λ);
y0 = cosφ * Math.sin(λ);
z0 = Math.sin(φ);
d3_geo_centroid.point = nextPoint;
d3_geo_centroidPointXYZ(x0, y0, z0);
};
function nextPoint(λ, φ) {
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);
d3_geo_centroidW1 += w;
d3_geo_centroidX1 += w * (x0 + (x0 = x));
d3_geo_centroidY1 += w * (y0 + (y0 = y));
d3_geo_centroidZ1 += w * (z0 + (z0 = z));
d3_geo_centroidPointXYZ(x0, y0, z0);
}
}
function d3_geo_centroidLineEnd() {
d3_geo_centroid.point = d3_geo_centroidPoint;
}
function d3_geo_centroidRingStart() {
var λ00, φ00, x0, y0, z0;
d3_geo_centroid.point = function(λ, φ) {
λ00 = λ, φ00 = φ;
d3_geo_centroid.point = nextPoint;
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians);
x0 = cosφ * Math.cos(λ);
y0 = cosφ * Math.sin(λ);
z0 = Math.sin(φ);
d3_geo_centroidPointXYZ(x0, y0, z0);
};
d3_geo_centroid.lineEnd = function() {
nextPoint(λ00, φ00);
d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd;
d3_geo_centroid.point = d3_geo_centroidPoint;
};
function nextPoint(λ, φ) {
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = Math.sqrt(cx * cx + cy * cy + cz * cz), u = x0 * x + y0 * y + z0 * z, v = m && -d3_acos(u) / m, w = Math.atan2(m, u);
d3_geo_centroidX2 += v * cx;
d3_geo_centroidY2 += v * cy;
d3_geo_centroidZ2 += v * cz;
d3_geo_centroidW1 += w;
d3_geo_centroidX1 += w * (x0 + (x0 = x));
d3_geo_centroidY1 += w * (y0 + (y0 = y));
d3_geo_centroidZ1 += w * (z0 + (z0 = z));
d3_geo_centroidPointXYZ(x0, y0, z0);
}
}
function d3_geo_compose(a, b) {
function compose(x, y) {
return x = a(x, y), b(x[0], x[1]);
}
if (a.invert && b.invert) compose.invert = function(x, y) {
return x = b.invert(x, y), x && a.invert(x[0], x[1]);
};
return compose;
}
function d3_true() {
return true;
}
function d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener) {
var subject = [], clip = [];
segments.forEach(function(segment) {
if ((n = segment.length - 1) <= 0) return;
var n, p0 = segment[0], p1 = segment[n];
if (d3_geo_sphericalEqual(p0, p1)) {
listener.lineStart();
for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]);
listener.lineEnd();
return;
}
var a = new d3_geo_clipPolygonIntersection(p0, segment, null, true), b = new d3_geo_clipPolygonIntersection(p0, null, a, false);
a.o = b;
subject.push(a);
clip.push(b);
a = new d3_geo_clipPolygonIntersection(p1, segment, null, false);
b = new d3_geo_clipPolygonIntersection(p1, null, a, true);
a.o = b;
subject.push(a);
clip.push(b);
});
clip.sort(compare);
d3_geo_clipPolygonLinkCircular(subject);
d3_geo_clipPolygonLinkCircular(clip);
if (!subject.length) return;
for (var i = 0, entry = clipStartInside, n = clip.length; i < n; ++i) {
clip[i].e = entry = !entry;
}
var start = subject[0], points, point;
while (1) {
var current = start, isSubject = true;
while (current.v) if ((current = current.n) === start) return;
points = current.z;
listener.lineStart();
do {
current.v = current.o.v = true;
if (current.e) {
if (isSubject) {
for (var i = 0, n = points.length; i < n; ++i) listener.point((point = points[i])[0], point[1]);
} else {
interpolate(current.x, current.n.x, 1, listener);
}
current = current.n;
} else {
if (isSubject) {
points = current.p.z;
for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]);
} else {
interpolate(current.x, current.p.x, -1, listener);
}
current = current.p;
}
current = current.o;
points = current.z;
isSubject = !isSubject;
} while (!current.v);
listener.lineEnd();
}
}
function d3_geo_clipPolygonLinkCircular(array) {
if (!(n = array.length)) return;
var n, i = 0, a = array[0], b;
while (++i < n) {
a.n = b = array[i];
b.p = a;
a = b;
}
a.n = b = array[0];
b.p = a;
}
function d3_geo_clipPolygonIntersection(point, points, other, entry) {
this.x = point;
this.z = points;
this.o = other;
this.e = entry;
this.v = false;
this.n = this.p = null;
}
function d3_geo_clip(pointVisible, clipLine, interpolate, clipStart) {
return function(rotate, listener) {
var line = clipLine(listener), rotatedClipStart = rotate.invert(clipStart[0], clipStart[1]);
var clip = {
point: point,
lineStart: lineStart,
lineEnd: lineEnd,
polygonStart: function() {
clip.point = pointRing;
clip.lineStart = ringStart;
clip.lineEnd = ringEnd;
segments = [];
polygon = [];
},
polygonEnd: function() {
clip.point = point;
clip.lineStart = lineStart;
clip.lineEnd = lineEnd;
segments = d3.merge(segments);
var clipStartInside = d3_geo_pointInPolygon(rotatedClipStart, polygon);
if (segments.length) {
if (!polygonStarted) listener.polygonStart(), polygonStarted = true;
d3_geo_clipPolygon(segments, d3_geo_clipSort, clipStartInside, interpolate, listener);
} else if (clipStartInside) {
if (!polygonStarted) listener.polygonStart(), polygonStarted = true;
listener.lineStart();
interpolate(null, null, 1, listener);
listener.lineEnd();
}
if (polygonStarted) listener.polygonEnd(), polygonStarted = false;
segments = polygon = null;
},
sphere: function() {
listener.polygonStart();
listener.lineStart();
interpolate(null, null, 1, listener);
listener.lineEnd();
listener.polygonEnd();
}
};
function point(λ, φ) {
var point = rotate(λ, φ);
if (pointVisible(λ = point[0], φ = point[1])) listener.point(λ, φ);
}
function pointLine(λ, φ) {
var point = rotate(λ, φ);
line.point(point[0], point[1]);
}
function lineStart() {
clip.point = pointLine;
line.lineStart();
}
function lineEnd() {
clip.point = point;
line.lineEnd();
}
var segments;
var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), polygonStarted = false, polygon, ring;
function pointRing(λ, φ) {
ring.push([ λ, φ ]);
var point = rotate(λ, φ);
ringListener.point(point[0], point[1]);
}
function ringStart() {
ringListener.lineStart();
ring = [];
}
function ringEnd() {
pointRing(ring[0][0], ring[0][1]);
ringListener.lineEnd();
var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length;
ring.pop();
polygon.push(ring);
ring = null;
if (!n) return;
if (clean & 1) {
segment = ringSegments[0];
var n = segment.length - 1, i = -1, point;
if (n > 0) {
if (!polygonStarted) listener.polygonStart(), polygonStarted = true;
listener.lineStart();
while (++i < n) listener.point((point = segment[i])[0], point[1]);
listener.lineEnd();
}
return;
}
if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
segments.push(ringSegments.filter(d3_geo_clipSegmentLength1));
}
return clip;
};
}
function d3_geo_clipSegmentLength1(segment) {
return segment.length > 1;
}
function d3_geo_clipBufferListener() {
var lines = [], line;
return {
lineStart: function() {
lines.push(line = []);
},
point: function(λ, φ) {
line.push([ λ, φ ]);
},
lineEnd: d3_noop,
buffer: function() {
var buffer = lines;
lines = [];
line = null;
return buffer;
},
rejoin: function() {
if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
}
};
}
function d3_geo_clipSort(a, b) {
return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]);
}
var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -π, -π / 2 ]);
function d3_geo_clipAntimeridianLine(listener) {
var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean;
return {
lineStart: function() {
listener.lineStart();
clean = 1;
},
point: function(λ1, φ1) {
var sλ1 = λ1 > 0 ? π : -π, dλ = abs(λ1 - λ0);
if (abs(dλ - π) < ε) {
listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? halfπ : -halfπ);
listener.point(sλ0, φ0);
listener.lineEnd();
listener.lineStart();
listener.point(sλ1, φ0);
listener.point(λ1, φ0);
clean = 0;
} else if (sλ0 !== sλ1 && dλ >= π) {
if (abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε;
if (abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε;
φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1);
listener.point(sλ0, φ0);
listener.lineEnd();
listener.lineStart();
listener.point(sλ1, φ0);
clean = 0;
}
listener.point(λ0 = λ1, φ0 = φ1);
sλ0 = sλ1;
},
lineEnd: function() {
listener.lineEnd();
λ0 = φ0 = NaN;
},
clean: function() {
return 2 - clean;
}
};
}
function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) {
var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1);
return abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2;
}
function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) {
var φ;
if (from == null) {
φ = direction * halfπ;
listener.point(-π, φ);
listener.point(0, φ);
listener.point(π, φ);
listener.point(π, 0);
listener.point(π, -φ);
listener.point(0, -φ);
listener.point(-π, -φ);
listener.point(-π, 0);
listener.point(-π, φ);
} else if (abs(from[0] - to[0]) > ε) {
var s = from[0] < to[0] ? π : -π;
φ = direction * s / 2;
listener.point(-s, φ);
listener.point(0, φ);
listener.point(s, φ);
} else {
listener.point(to[0], to[1]);
}
}
function d3_geo_pointInPolygon(point, polygon) {
var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0;
d3_geo_areaRingSum.reset();
for (var i = 0, n = polygon.length; i < n; ++i) {
var ring = polygon[i], m = ring.length;
if (!m) continue;
var point0 = ring[0], λ0 = point0[0], φ0 = point0[1] / 2 + π / 4, sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), j = 1;
while (true) {
if (j === m) j = 0;
point = ring[j];
var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, antimeridian = adλ > π, k = sinφ0 * sinφ;
d3_geo_areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ)));
polarAngle += antimeridian ? dλ + sdλ * τ : dλ;
if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) {
var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point));
d3_geo_cartesianNormalize(arc);
var intersection = d3_geo_cartesianCross(meridianNormal, arc);
d3_geo_cartesianNormalize(intersection);
var φarc = (antimeridian ^ dλ >= 0 ? -1 : 1) * d3_asin(intersection[2]);
if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) {
winding += antimeridian ^ dλ >= 0 ? 1 : -1;
}
}
if (!j++) break;
λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point;
}
}
return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < 0) ^ winding & 1;
}
function d3_geo_clipCircle(radius) {
var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians);
return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -π, radius - π ]);
function visible(λ, φ) {
return Math.cos(λ) * Math.cos(φ) > cr;
}
function clipLine(listener) {
var point0, c0, v0, v00, clean;
return {
lineStart: function() {
v00 = v0 = false;
clean = 1;
},
point: function(λ, φ) {
var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? π : -π), φ) : 0;
if (!point0 && (v00 = v0 = v)) listener.lineStart();
if (v !== v0) {
point2 = intersect(point0, point1);
if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) {
point1[0] += ε;
point1[1] += ε;
v = visible(point1[0], point1[1]);
}
}
if (v !== v0) {
clean = 0;
if (v) {
listener.lineStart();
point2 = intersect(point1, point0);
listener.point(point2[0], point2[1]);
} else {
point2 = intersect(point0, point1);
listener.point(point2[0], point2[1]);
listener.lineEnd();
}
point0 = point2;
} else if (notHemisphere && point0 && smallRadius ^ v) {
var t;
if (!(c & c0) && (t = intersect(point1, point0, true))) {
clean = 0;
if (smallRadius) {
listener.lineStart();
listener.point(t[0][0], t[0][1]);
listener.point(t[1][0], t[1][1]);
listener.lineEnd();
} else {
listener.point(t[1][0], t[1][1]);
listener.lineEnd();
listener.lineStart();
listener.point(t[0][0], t[0][1]);
}
}
}
if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) {
listener.point(point1[0], point1[1]);
}
point0 = point1, v0 = v, c0 = c;
},
lineEnd: function() {
if (v0) listener.lineEnd();
point0 = null;
},
clean: function() {
return clean | (v00 && v0) << 1;
}
};
}
function intersect(a, b, two) {
var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b);
var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
if (!determinant) return !two && a;
var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2);
d3_geo_cartesianAdd(A, B);
var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1);
if (t2 < 0) return;
var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu);
d3_geo_cartesianAdd(q, A);
q = d3_geo_spherical(q);
if (!two) return q;
var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z;
if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z;
var δλ = λ1 - λ0, polar = abs(δλ - π) < ε, meridian = polar || δλ < ε;
if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z;
if (meridian ? polar ? φ0 + φ1 > 0 ^ q[1] < (abs(q[0] - λ0) < ε ? φ0 : φ1) : φ0 <= q[1] && q[1] <= φ1 : δλ > π ^ (λ0 <= q[0] && q[0] <= λ1)) {
var q1 = d3_geo_cartesianScale(u, (-w + t) / uu);
d3_geo_cartesianAdd(q1, A);
return [ q, d3_geo_spherical(q1) ];
}
}
function code(λ, φ) {
var r = smallRadius ? radius : π - radius, code = 0;
if (λ < -r) code |= 1; else if (λ > r) code |= 2;
if (φ < -r) code |= 4; else if (φ > r) code |= 8;
return code;
}
}
function d3_geom_clipLine(x0, y0, x1, y1) {
return function(line) {
var a = line.a, b = line.b, ax = a.x, ay = a.y, bx = b.x, by = b.y, t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;
r = x0 - ax;
if (!dx && r > 0) return;
r /= dx;
if (dx < 0) {
if (r < t0) return;
if (r < t1) t1 = r;
} else if (dx > 0) {
if (r > t1) return;
if (r > t0) t0 = r;
}
r = x1 - ax;
if (!dx && r < 0) return;
r /= dx;
if (dx < 0) {
if (r > t1) return;
if (r > t0) t0 = r;
} else if (dx > 0) {
if (r < t0) return;
if (r < t1) t1 = r;
}
r = y0 - ay;
if (!dy && r > 0) return;
r /= dy;
if (dy < 0) {
if (r < t0) return;
if (r < t1) t1 = r;
} else if (dy > 0) {
if (r > t1) return;
if (r > t0) t0 = r;
}
r = y1 - ay;
if (!dy && r < 0) return;
r /= dy;
if (dy < 0) {
if (r > t1) return;
if (r > t0) t0 = r;
} else if (dy > 0) {
if (r < t0) return;
if (r < t1) t1 = r;
}
if (t0 > 0) line.a = {
x: ax + t0 * dx,
y: ay + t0 * dy
};
if (t1 < 1) line.b = {
x: ax + t1 * dx,
y: ay + t1 * dy
};
return line;
};
}
var d3_geo_clipExtentMAX = 1e9;
d3.geo.clipExtent = function() {
var x0, y0, x1, y1, stream, clip, clipExtent = {
stream: function(output) {
if (stream) stream.valid = false;
stream = clip(output);
stream.valid = true;
return stream;
},
extent: function(_) {
if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];
clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]);
if (stream) stream.valid = false, stream = null;
return clipExtent;
}
};
return clipExtent.extent([ [ 0, 0 ], [ 960, 500 ] ]);
};
function d3_geo_clipExtent(x0, y0, x1, y1) {
return function(listener) {
var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), clipLine = d3_geom_clipLine(x0, y0, x1, y1), segments, polygon, ring;
var clip = {
point: point,
lineStart: lineStart,
lineEnd: lineEnd,
polygonStart: function() {
listener = bufferListener;
segments = [];
polygon = [];
clean = true;
},
polygonEnd: function() {
listener = listener_;
segments = d3.merge(segments);
var clipStartInside = insidePolygon([ x0, y1 ]), inside = clean && clipStartInside, visible = segments.length;
if (inside || visible) {
listener.polygonStart();
if (inside) {
listener.lineStart();
interpolate(null, null, 1, listener);
listener.lineEnd();
}
if (visible) {
d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener);
}
listener.polygonEnd();
}
segments = polygon = ring = null;
}
};
function insidePolygon(p) {
var wn = 0, n = polygon.length, y = p[1];
for (var i = 0; i < n; ++i) {
for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) {
b = v[j];
if (a[1] <= y) {
if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn;
} else {
if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn;
}
a = b;
}
}
return wn !== 0;
}
function interpolate(from, to, direction, listener) {
var a = 0, a1 = 0;
if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) {
do {
listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);
} while ((a = (a + direction + 4) % 4) !== a1);
} else {
listener.point(to[0], to[1]);
}
}
function pointVisible(x, y) {
return x0 <= x && x <= x1 && y0 <= y && y <= y1;
}
function point(x, y) {
if (pointVisible(x, y)) listener.point(x, y);
}
var x__, y__, v__, x_, y_, v_, first, clean;
function lineStart() {
clip.point = linePoint;
if (polygon) polygon.push(ring = []);
first = true;
v_ = false;
x_ = y_ = NaN;
}
function lineEnd() {
if (segments) {
linePoint(x__, y__);
if (v__ && v_) bufferListener.rejoin();
segments.push(bufferListener.buffer());
}
clip.point = point;
if (v_) listener.lineEnd();
}
function linePoint(x, y) {
x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x));
y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y));
var v = pointVisible(x, y);
if (polygon) ring.push([ x, y ]);
if (first) {
x__ = x, y__ = y, v__ = v;
first = false;
if (v) {
listener.lineStart();
listener.point(x, y);
}
} else {
if (v && v_) listener.point(x, y); else {
var l = {
a: {
x: x_,
y: y_
},
b: {
x: x,
y: y
}
};
if (clipLine(l)) {
if (!v_) {
listener.lineStart();
listener.point(l.a.x, l.a.y);
}
listener.point(l.b.x, l.b.y);
if (!v) listener.lineEnd();
clean = false;
} else if (v) {
listener.lineStart();
listener.point(x, y);
clean = false;
}
}
}
x_ = x, y_ = y, v_ = v;
}
return clip;
};
function corner(p, direction) {
return abs(p[0] - x0) < ε ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < ε ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < ε ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
}
function compare(a, b) {
return comparePoints(a.x, b.x);
}
function comparePoints(a, b) {
var ca = corner(a, 1), cb = corner(b, 1);
return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];
}
}
function d3_geo_conic(projectAt) {
var φ0 = 0, φ1 = π / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1);
p.parallels = function(_) {
if (!arguments.length) return [ φ0 / π * 180, φ1 / π * 180 ];
return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180);
};
return p;
}
function d3_geo_conicEqualArea(φ0, φ1) {
var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n;
function forward(λ, φ) {
var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n;
return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ];
}
forward.invert = function(x, y) {
var ρ0_y = ρ0 - y;
return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ];
};
return forward;
}
(d3.geo.conicEqualArea = function() {
return d3_geo_conic(d3_geo_conicEqualArea);
}).raw = d3_geo_conicEqualArea;
d3.geo.albers = function() {
return d3.geo.conicEqualArea().rotate([ 96, 0 ]).center([ -.6, 38.7 ]).parallels([ 29.5, 45.5 ]).scale(1070);
};
d3.geo.albersUsa = function() {
var lower48 = d3.geo.albers();
var alaska = d3.geo.conicEqualArea().rotate([ 154, 0 ]).center([ -2, 58.5 ]).parallels([ 55, 65 ]);
var hawaii = d3.geo.conicEqualArea().rotate([ 157, 0 ]).center([ -3, 19.9 ]).parallels([ 8, 18 ]);
var point, pointStream = {
point: function(x, y) {
point = [ x, y ];
}
}, lower48Point, alaskaPoint, hawaiiPoint;
function albersUsa(coordinates) {
var x = coordinates[0], y = coordinates[1];
point = null;
(lower48Point(x, y), point) || (alaskaPoint(x, y), point) || hawaiiPoint(x, y);
return point;
}
albersUsa.invert = function(coordinates) {
var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k;
return (y >= .12 && y < .234 && x >= -.425 && x < -.214 ? alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? hawaii : lower48).invert(coordinates);
};
albersUsa.stream = function(stream) {
var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream);
return {
point: function(x, y) {
lower48Stream.point(x, y);
alaskaStream.point(x, y);
hawaiiStream.point(x, y);
},
sphere: function() {
lower48Stream.sphere();
alaskaStream.sphere();
hawaiiStream.sphere();
},
lineStart: function() {
lower48Stream.lineStart();
alaskaStream.lineStart();
hawaiiStream.lineStart();
},
lineEnd: function() {
lower48Stream.lineEnd();
alaskaStream.lineEnd();
hawaiiStream.lineEnd();
},
polygonStart: function() {
lower48Stream.polygonStart();
alaskaStream.polygonStart();
hawaiiStream.polygonStart();
},
polygonEnd: function() {
lower48Stream.polygonEnd();
alaskaStream.polygonEnd();
hawaiiStream.polygonEnd();
}
};
};
albersUsa.precision = function(_) {
if (!arguments.length) return lower48.precision();
lower48.precision(_);
alaska.precision(_);
hawaii.precision(_);
return albersUsa;
};
albersUsa.scale = function(_) {
if (!arguments.length) return lower48.scale();
lower48.scale(_);
alaska.scale(_ * .35);
hawaii.scale(_);
return albersUsa.translate(lower48.translate());
};
albersUsa.translate = function(_) {
if (!arguments.length) return lower48.translate();
var k = lower48.scale(), x = +_[0], y = +_[1];
lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream).point;
alaskaPoint = alaska.translate([ x - .307 * k, y + .201 * k ]).clipExtent([ [ x - .425 * k + ε, y + .12 * k + ε ], [ x - .214 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point;
hawaiiPoint = hawaii.translate([ x - .205 * k, y + .212 * k ]).clipExtent([ [ x - .214 * k + ε, y + .166 * k + ε ], [ x - .115 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point;
return albersUsa;
};
return albersUsa.scale(1070);
};
var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = {
point: d3_noop,
lineStart: d3_noop,
lineEnd: d3_noop,
polygonStart: function() {
d3_geo_pathAreaPolygon = 0;
d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart;
},
polygonEnd: function() {
d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop;
d3_geo_pathAreaSum += abs(d3_geo_pathAreaPolygon / 2);
}
};
function d3_geo_pathAreaRingStart() {
var x00, y00, x0, y0;
d3_geo_pathArea.point = function(x, y) {
d3_geo_pathArea.point = nextPoint;
x00 = x0 = x, y00 = y0 = y;
};
function nextPoint(x, y) {
d3_geo_pathAreaPolygon += y0 * x - x0 * y;
x0 = x, y0 = y;
}
d3_geo_pathArea.lineEnd = function() {
nextPoint(x00, y00);
};
}
var d3_geo_pathBoundsX0, d3_geo_pathBoundsY0, d3_geo_pathBoundsX1, d3_geo_pathBoundsY1;
var d3_geo_pathBounds = {
point: d3_geo_pathBoundsPoint,
lineStart: d3_noop,
lineEnd: d3_noop,
polygonStart: d3_noop,
polygonEnd: d3_noop
};
function d3_geo_pathBoundsPoint(x, y) {
if (x < d3_geo_pathBoundsX0) d3_geo_pathBoundsX0 = x;
if (x > d3_geo_pathBoundsX1) d3_geo_pathBoundsX1 = x;
if (y < d3_geo_pathBoundsY0) d3_geo_pathBoundsY0 = y;
if (y > d3_geo_pathBoundsY1) d3_geo_pathBoundsY1 = y;
}
function d3_geo_pathBuffer() {
var pointCircle = d3_geo_pathBufferCircle(4.5), buffer = [];
var stream = {
point: point,
lineStart: function() {
stream.point = pointLineStart;
},
lineEnd: lineEnd,
polygonStart: function() {
stream.lineEnd = lineEndPolygon;
},
polygonEnd: function() {
stream.lineEnd = lineEnd;
stream.point = point;
},
pointRadius: function(_) {
pointCircle = d3_geo_pathBufferCircle(_);
return stream;
},
result: function() {
if (buffer.length) {
var result = buffer.join("");
buffer = [];
return result;
}
}
};
function point(x, y) {
buffer.push("M", x, ",", y, pointCircle);
}
function pointLineStart(x, y) {
buffer.push("M", x, ",", y);
stream.point = pointLine;
}
function pointLine(x, y) {
buffer.push("L", x, ",", y);
}
function lineEnd() {
stream.point = point;
}
function lineEndPolygon() {
buffer.push("Z");
}
return stream;
}
function d3_geo_pathBufferCircle(radius) {
return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
}
var d3_geo_pathCentroid = {
point: d3_geo_pathCentroidPoint,
lineStart: d3_geo_pathCentroidLineStart,
lineEnd: d3_geo_pathCentroidLineEnd,
polygonStart: function() {
d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart;
},
polygonEnd: function() {
d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart;
d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd;
}
};
function d3_geo_pathCentroidPoint(x, y) {
d3_geo_centroidX0 += x;
d3_geo_centroidY0 += y;
++d3_geo_centroidZ0;
}
function d3_geo_pathCentroidLineStart() {
var x0, y0;
d3_geo_pathCentroid.point = function(x, y) {
d3_geo_pathCentroid.point = nextPoint;
d3_geo_pathCentroidPoint(x0 = x, y0 = y);
};
function nextPoint(x, y) {
var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);
d3_geo_centroidX1 += z * (x0 + x) / 2;
d3_geo_centroidY1 += z * (y0 + y) / 2;
d3_geo_centroidZ1 += z;
d3_geo_pathCentroidPoint(x0 = x, y0 = y);
}
}
function d3_geo_pathCentroidLineEnd() {
d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
}
function d3_geo_pathCentroidRingStart() {
var x00, y00, x0, y0;
d3_geo_pathCentroid.point = function(x, y) {
d3_geo_pathCentroid.point = nextPoint;
d3_geo_pathCentroidPoint(x00 = x0 = x, y00 = y0 = y);
};
function nextPoint(x, y) {
var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);
d3_geo_centroidX1 += z * (x0 + x) / 2;
d3_geo_centroidY1 += z * (y0 + y) / 2;
d3_geo_centroidZ1 += z;
z = y0 * x - x0 * y;
d3_geo_centroidX2 += z * (x0 + x);
d3_geo_centroidY2 += z * (y0 + y);
d3_geo_centroidZ2 += z * 3;
d3_geo_pathCentroidPoint(x0 = x, y0 = y);
}
d3_geo_pathCentroid.lineEnd = function() {
nextPoint(x00, y00);
};
}
function d3_geo_pathContext(context) {
var pointRadius = 4.5;
var stream = {
point: point,
lineStart: function() {
stream.point = pointLineStart;
},
lineEnd: lineEnd,
polygonStart: function() {
stream.lineEnd = lineEndPolygon;
},
polygonEnd: function() {
stream.lineEnd = lineEnd;
stream.point = point;
},
pointRadius: function(_) {
pointRadius = _;
return stream;
},
result: d3_noop
};
function point(x, y) {
context.moveTo(x + pointRadius, y);
context.arc(x, y, pointRadius, 0, τ);
}
function pointLineStart(x, y) {
context.moveTo(x, y);
stream.point = pointLine;
}
function pointLine(x, y) {
context.lineTo(x, y);
}
function lineEnd() {
stream.point = point;
}
function lineEndPolygon() {
context.closePath();
}
return stream;
}
function d3_geo_resample(project) {
var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16;
function resample(stream) {
return (maxDepth ? resampleRecursive : resampleNone)(stream);
}
function resampleNone(stream) {
return d3_geo_transformPoint(stream, function(x, y) {
x = project(x, y);
stream.point(x[0], x[1]);
});
}
function resampleRecursive(stream) {
var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0;
var resample = {
point: point,
lineStart: lineStart,
lineEnd: lineEnd,
polygonStart: function() {
stream.polygonStart();
resample.lineStart = ringStart;
},
polygonEnd: function() {
stream.polygonEnd();
resample.lineStart = lineStart;
}
};
function point(x, y) {
x = project(x, y);
stream.point(x[0], x[1]);
}
function lineStart() {
x0 = NaN;
resample.point = linePoint;
stream.lineStart();
}
function linePoint(λ, φ) {
var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ);
resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
stream.point(x0, y0);
}
function lineEnd() {
resample.point = point;
stream.lineEnd();
}
function ringStart() {
lineStart();
resample.point = ringPoint;
resample.lineEnd = ringEnd;
}
function ringPoint(λ, φ) {
linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;
resample.point = linePoint;
}
function ringEnd() {
resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream);
resample.lineEnd = lineEnd;
lineEnd();
}
return resample;
}
function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) {
var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
if (d2 > 4 * δ2 && depth--) {
var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = abs(abs(c) - 1) < ε || abs(λ0 - λ1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
if (dz * dz / d2 > δ2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream);
stream.point(x2, y2);
resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream);
}
}
}
resample.precision = function(_) {
if (!arguments.length) return Math.sqrt(δ2);
maxDepth = (δ2 = _ * _) > 0 && 16;
return resample;
};
return resample;
}
d3.geo.path = function() {
var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream;
function path(object) {
if (object) {
if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
if (!cacheStream || !cacheStream.valid) cacheStream = projectStream(contextStream);
d3.geo.stream(object, cacheStream);
}
return contextStream.result();
}
path.area = function(object) {
d3_geo_pathAreaSum = 0;
d3.geo.stream(object, projectStream(d3_geo_pathArea));
return d3_geo_pathAreaSum;
};
path.centroid = function(object) {
d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0;
d3.geo.stream(object, projectStream(d3_geo_pathCentroid));
return d3_geo_centroidZ2 ? [ d3_geo_centroidX2 / d3_geo_centroidZ2, d3_geo_centroidY2 / d3_geo_centroidZ2 ] : d3_geo_centroidZ1 ? [ d3_geo_centroidX1 / d3_geo_centroidZ1, d3_geo_centroidY1 / d3_geo_centroidZ1 ] : d3_geo_centroidZ0 ? [ d3_geo_centroidX0 / d3_geo_centroidZ0, d3_geo_centroidY0 / d3_geo_centroidZ0 ] : [ NaN, NaN ];
};
path.bounds = function(object) {
d3_geo_pathBoundsX1 = d3_geo_pathBoundsY1 = -(d3_geo_pathBoundsX0 = d3_geo_pathBoundsY0 = Infinity);
d3.geo.stream(object, projectStream(d3_geo_pathBounds));
return [ [ d3_geo_pathBoundsX0, d3_geo_pathBoundsY0 ], [ d3_geo_pathBoundsX1, d3_geo_pathBoundsY1 ] ];
};
path.projection = function(_) {
if (!arguments.length) return projection;
projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity;
return reset();
};
path.context = function(_) {
if (!arguments.length) return context;
contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_);
if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
return reset();
};
path.pointRadius = function(_) {
if (!arguments.length) return pointRadius;
pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
return path;
};
function reset() {
cacheStream = null;
return path;
}
return path.projection(d3.geo.albersUsa()).context(null);
};
function d3_geo_pathProjectStream(project) {
var resample = d3_geo_resample(function(x, y) {
return project([ x * d3_degrees, y * d3_degrees ]);
});
return function(stream) {
return d3_geo_projectionRadians(resample(stream));
};
}
d3.geo.transform = function(methods) {
return {
stream: function(stream) {
var transform = new d3_geo_transform(stream);
for (var k in methods) transform[k] = methods[k];
return transform;
}
};
};
function d3_geo_transform(stream) {
this.stream = stream;
}
d3_geo_transform.prototype = {
point: function(x, y) {
this.stream.point(x, y);
},
sphere: function() {
this.stream.sphere();
},
lineStart: function() {
this.stream.lineStart();
},
lineEnd: function() {
this.stream.lineEnd();
},
polygonStart: function() {
this.stream.polygonStart();
},
polygonEnd: function() {
this.stream.polygonEnd();
}
};
function d3_geo_transformPoint(stream, point) {
return {
point: point,
sphere: function() {
stream.sphere();
},
lineStart: function() {
stream.lineStart();
},
lineEnd: function() {
stream.lineEnd();
},
polygonStart: function() {
stream.polygonStart();
},
polygonEnd: function() {
stream.polygonEnd();
}
};
}
d3.geo.projection = d3_geo_projection;
d3.geo.projectionMutator = d3_geo_projectionMutator;
function d3_geo_projection(project) {
return d3_geo_projectionMutator(function() {
return project;
})();
}
function d3_geo_projectionMutator(projectAt) {
var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) {
x = project(x, y);
return [ x[0] * k + δx, δy - x[1] * k ];
}), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, preclip = d3_geo_clipAntimeridian, postclip = d3_identity, clipAngle = null, clipExtent = null, stream;
function projection(point) {
point = projectRotate(point[0] * d3_radians, point[1] * d3_radians);
return [ point[0] * k + δx, δy - point[1] * k ];
}
function invert(point) {
point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k);
return point && [ point[0] * d3_degrees, point[1] * d3_degrees ];
}
projection.stream = function(output) {
if (stream) stream.valid = false;
stream = d3_geo_projectionRadians(preclip(rotate, projectResample(postclip(output))));
stream.valid = true;
return stream;
};
projection.clipAngle = function(_) {
if (!arguments.length) return clipAngle;
preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians);
return invalidate();
};
projection.clipExtent = function(_) {
if (!arguments.length) return clipExtent;
clipExtent = _;
postclip = _ ? d3_geo_clipExtent(_[0][0], _[0][1], _[1][0], _[1][1]) : d3_identity;
return invalidate();
};
projection.scale = function(_) {
if (!arguments.length) return k;
k = +_;
return reset();
};
projection.translate = function(_) {
if (!arguments.length) return [ x, y ];
x = +_[0];
y = +_[1];
return reset();
};
projection.center = function(_) {
if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ];
λ = _[0] % 360 * d3_radians;
φ = _[1] % 360 * d3_radians;
return reset();
};
projection.rotate = function(_) {
if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ];
δλ = _[0] % 360 * d3_radians;
δφ = _[1] % 360 * d3_radians;
δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0;
return reset();
};
d3.rebind(projection, projectResample, "precision");
function reset() {
projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project);
var center = project(λ, φ);
δx = x - center[0] * k;
δy = y + center[1] * k;
return invalidate();
}
function invalidate() {
if (stream) stream.valid = false, stream = null;
return projection;
}
return function() {
project = projectAt.apply(this, arguments);
projection.invert = project.invert && invert;
return reset();
};
}
function d3_geo_projectionRadians(stream) {
return d3_geo_transformPoint(stream, function(x, y) {
stream.point(x * d3_radians, y * d3_radians);
});
}
function d3_geo_equirectangular(λ, φ) {
return [ λ, φ ];
}
(d3.geo.equirectangular = function() {
return d3_geo_projection(d3_geo_equirectangular);
}).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular;
d3.geo.rotation = function(rotate) {
rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0);
function forward(coordinates) {
coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
}
forward.invert = function(coordinates) {
coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
};
return forward;
};
function d3_geo_identityRotation(λ, φ) {
return [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ];
}
d3_geo_identityRotation.invert = d3_geo_equirectangular;
function d3_geo_rotation(δλ, δφ, δγ) {
return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_identityRotation;
}
function d3_geo_forwardRotationλ(δλ) {
return function(λ, φ) {
return λ += δλ, [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ];
};
}
function d3_geo_rotationλ(δλ) {
var rotation = d3_geo_forwardRotationλ(δλ);
rotation.invert = d3_geo_forwardRotationλ(-δλ);
return rotation;
}
function d3_geo_rotationφγ(δφ, δγ) {
var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ);
function rotation(λ, φ) {
var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ;
return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), d3_asin(k * cosδγ + y * sinδγ) ];
}
rotation.invert = function(λ, φ) {
var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ;
return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), d3_asin(k * cosδφ - x * sinδφ) ];
};
return rotation;
}
d3.geo.circle = function() {
var origin = [ 0, 0 ], angle, precision = 6, interpolate;
function circle() {
var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = [];
interpolate(null, null, 1, {
point: function(x, y) {
ring.push(x = rotate(x, y));
x[0] *= d3_degrees, x[1] *= d3_degrees;
}
});
return {
type: "Polygon",
coordinates: [ ring ]
};
}
circle.origin = function(x) {
if (!arguments.length) return origin;
origin = x;
return circle;
};
circle.angle = function(x) {
if (!arguments.length) return angle;
interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians);
return circle;
};
circle.precision = function(_) {
if (!arguments.length) return precision;
interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians);
return circle;
};
return circle.angle(90);
};
function d3_geo_circleInterpolate(radius, precision) {
var cr = Math.cos(radius), sr = Math.sin(radius);
return function(from, to, direction, listener) {
var step = direction * precision;
if (from != null) {
from = d3_geo_circleAngle(cr, from);
to = d3_geo_circleAngle(cr, to);
if (direction > 0 ? from < to : from > to) from += direction * τ;
} else {
from = radius + direction * τ;
to = radius - .5 * step;
}
for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) {
listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]);
}
};
}
function d3_geo_circleAngle(cr, point) {
var a = d3_geo_cartesian(point);
a[0] -= cr;
d3_geo_cartesianNormalize(a);
var angle = d3_acos(-a[1]);
return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI);
}
d3.geo.distance = function(a, b) {
var Δλ = (b[0] - a[0]) * d3_radians, φ0 = a[1] * d3_radians, φ1 = b[1] * d3_radians, sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ), sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1), t;
return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ);
};
d3.geo.graticule = function() {
var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5;
function graticule() {
return {
type: "MultiLineString",
coordinates: lines()
};
}
function lines() {
return d3.range(Math.ceil(X0 / DX) * DX, X1, DX).map(X).concat(d3.range(Math.ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(d3.range(Math.ceil(x0 / dx) * dx, x1, dx).filter(function(x) {
return abs(x % DX) > ε;
}).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) {
return abs(y % DY) > ε;
}).map(y));
}
graticule.lines = function() {
return lines().map(function(coordinates) {
return {
type: "LineString",
coordinates: coordinates
};
});
};
graticule.outline = function() {
return {
type: "Polygon",
coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ]
};
};
graticule.extent = function(_) {
if (!arguments.length) return graticule.minorExtent();
return graticule.majorExtent(_).minorExtent(_);
};
graticule.majorExtent = function(_) {
if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ];
X0 = +_[0][0], X1 = +_[1][0];
Y0 = +_[0][1], Y1 = +_[1][1];
if (X0 > X1) _ = X0, X0 = X1, X1 = _;
if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;
return graticule.precision(precision);
};
graticule.minorExtent = function(_) {
if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];
x0 = +_[0][0], x1 = +_[1][0];
y0 = +_[0][1], y1 = +_[1][1];
if (x0 > x1) _ = x0, x0 = x1, x1 = _;
if (y0 > y1) _ = y0, y0 = y1, y1 = _;
return graticule.precision(precision);
};
graticule.step = function(_) {
if (!arguments.length) return graticule.minorStep();
return graticule.majorStep(_).minorStep(_);
};
graticule.majorStep = function(_) {
if (!arguments.length) return [ DX, DY ];
DX = +_[0], DY = +_[1];
return graticule;
};
graticule.minorStep = function(_) {
if (!arguments.length) return [ dx, dy ];
dx = +_[0], dy = +_[1];
return graticule;
};
graticule.precision = function(_) {
if (!arguments.length) return precision;
precision = +_;
x = d3_geo_graticuleX(y0, y1, 90);
y = d3_geo_graticuleY(x0, x1, precision);
X = d3_geo_graticuleX(Y0, Y1, 90);
Y = d3_geo_graticuleY(X0, X1, precision);
return graticule;
};
return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]);
};
function d3_geo_graticuleX(y0, y1, dy) {
var y = d3.range(y0, y1 - ε, dy).concat(y1);
return function(x) {
return y.map(function(y) {
return [ x, y ];
});
};
}
function d3_geo_graticuleY(x0, x1, dx) {
var x = d3.range(x0, x1 - ε, dx).concat(x1);
return function(y) {
return x.map(function(x) {
return [ x, y ];
});
};
}
function d3_source(d) {
return d.source;
}
function d3_target(d) {
return d.target;
}
d3.geo.greatArc = function() {
var source = d3_source, source_, target = d3_target, target_;
function greatArc() {
return {
type: "LineString",
coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ]
};
}
greatArc.distance = function() {
return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments));
};
greatArc.source = function(_) {
if (!arguments.length) return source;
source = _, source_ = typeof _ === "function" ? null : _;
return greatArc;
};
greatArc.target = function(_) {
if (!arguments.length) return target;
target = _, target_ = typeof _ === "function" ? null : _;
return greatArc;
};
greatArc.precision = function() {
return arguments.length ? greatArc : 0;
};
return greatArc;
};
d3.geo.interpolate = function(source, target) {
return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians);
};
function d3_geo_interpolate(x0, y0, x1, y1) {
var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_haversin(y1 - y0) + cy0 * cy1 * d3_haversin(x1 - x0))), k = 1 / Math.sin(d);
var interpolate = d ? function(t) {
var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ];
} : function() {
return [ x0 * d3_degrees, y0 * d3_degrees ];
};
interpolate.distance = d;
return interpolate;
}
d3.geo.length = function(object) {
d3_geo_lengthSum = 0;
d3.geo.stream(object, d3_geo_length);
return d3_geo_lengthSum;
};
var d3_geo_lengthSum;
var d3_geo_length = {
sphere: d3_noop,
point: d3_noop,
lineStart: d3_geo_lengthLineStart,
lineEnd: d3_noop,
polygonStart: d3_noop,
polygonEnd: d3_noop
};
function d3_geo_lengthLineStart() {
var λ0, sinφ0, cosφ0;
d3_geo_length.point = function(λ, φ) {
λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ);
d3_geo_length.point = nextPoint;
};
d3_geo_length.lineEnd = function() {
d3_geo_length.point = d3_geo_length.lineEnd = d3_noop;
};
function nextPoint(λ, φ) {
var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t);
d3_geo_lengthSum += Math.atan2(Math.sqrt((t = cosφ * Math.sin(t)) * t + (t = cosφ0 * sinφ - sinφ0 * cosφ * cosΔλ) * t), sinφ0 * sinφ + cosφ0 * cosφ * cosΔλ);
λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ;
}
}
function d3_geo_azimuthal(scale, angle) {
function azimuthal(λ, φ) {
var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ);
return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ];
}
azimuthal.invert = function(x, y) {
var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c);
return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ];
};
return azimuthal;
}
var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) {
return Math.sqrt(2 / (1 + cosλcosφ));
}, function(ρ) {
return 2 * Math.asin(ρ / 2);
});
(d3.geo.azimuthalEqualArea = function() {
return d3_geo_projection(d3_geo_azimuthalEqualArea);
}).raw = d3_geo_azimuthalEqualArea;
var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) {
var c = Math.acos(cosλcosφ);
return c && c / Math.sin(c);
}, d3_identity);
(d3.geo.azimuthalEquidistant = function() {
return d3_geo_projection(d3_geo_azimuthalEquidistant);
}).raw = d3_geo_azimuthalEquidistant;
function d3_geo_conicConformal(φ0, φ1) {
var cosφ0 = Math.cos(φ0), t = function(φ) {
return Math.tan(π / 4 + φ / 2);
}, n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)), F = cosφ0 * Math.pow(t(φ0), n) / n;
if (!n) return d3_geo_mercator;
function forward(λ, φ) {
if (F > 0) {
if (φ < -halfπ + ε) φ = -halfπ + ε;
} else {
if (φ > halfπ - ε) φ = halfπ - ε;
}
var ρ = F / Math.pow(t(φ), n);
return [ ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ) ];
}
forward.invert = function(x, y) {
var ρ0_y = F - y, ρ = d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y);
return [ Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - halfπ ];
};
return forward;
}
(d3.geo.conicConformal = function() {
return d3_geo_conic(d3_geo_conicConformal);
}).raw = d3_geo_conicConformal;
function d3_geo_conicEquidistant(φ0, φ1) {
var cosφ0 = Math.cos(φ0), n = φ0 === φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0;
if (abs(n) < ε) return d3_geo_equirectangular;
function forward(λ, φ) {
var ρ = G - φ;
return [ ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ) ];
}
forward.invert = function(x, y) {
var ρ0_y = G - y;
return [ Math.atan2(x, ρ0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y) ];
};
return forward;
}
(d3.geo.conicEquidistant = function() {
return d3_geo_conic(d3_geo_conicEquidistant);
}).raw = d3_geo_conicEquidistant;
var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) {
return 1 / cosλcosφ;
}, Math.atan);
(d3.geo.gnomonic = function() {
return d3_geo_projection(d3_geo_gnomonic);
}).raw = d3_geo_gnomonic;
function d3_geo_mercator(λ, φ) {
return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ];
}
d3_geo_mercator.invert = function(x, y) {
return [ x, 2 * Math.atan(Math.exp(y)) - halfπ ];
};
function d3_geo_mercatorProjection(project) {
var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto;
m.scale = function() {
var v = scale.apply(m, arguments);
return v === m ? clipAuto ? m.clipExtent(null) : m : v;
};
m.translate = function() {
var v = translate.apply(m, arguments);
return v === m ? clipAuto ? m.clipExtent(null) : m : v;
};
m.clipExtent = function(_) {
var v = clipExtent.apply(m, arguments);
if (v === m) {
if (clipAuto = _ == null) {
var k = π * scale(), t = translate();
clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]);
}
} else if (clipAuto) {
v = null;
}
return v;
};
return m.clipExtent(null);
}
(d3.geo.mercator = function() {
return d3_geo_mercatorProjection(d3_geo_mercator);
}).raw = d3_geo_mercator;
var d3_geo_orthographic = d3_geo_azimuthal(function() {
return 1;
}, Math.asin);
(d3.geo.orthographic = function() {
return d3_geo_projection(d3_geo_orthographic);
}).raw = d3_geo_orthographic;
var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) {
return 1 / (1 + cosλcosφ);
}, function(ρ) {
return 2 * Math.atan(ρ);
});
(d3.geo.stereographic = function() {
return d3_geo_projection(d3_geo_stereographic);
}).raw = d3_geo_stereographic;
function d3_geo_transverseMercator(λ, φ) {
return [ Math.log(Math.tan(π / 4 + φ / 2)), -λ ];
}
d3_geo_transverseMercator.invert = function(x, y) {
return [ -y, 2 * Math.atan(Math.exp(x)) - halfπ ];
};
(d3.geo.transverseMercator = function() {
var projection = d3_geo_mercatorProjection(d3_geo_transverseMercator), center = projection.center, rotate = projection.rotate;
projection.center = function(_) {
return _ ? center([ -_[1], _[0] ]) : (_ = center(), [ _[1], -_[0] ]);
};
projection.rotate = function(_) {
return _ ? rotate([ _[0], _[1], _.length > 2 ? _[2] + 90 : 90 ]) : (_ = rotate(),
[ _[0], _[1], _[2] - 90 ]);
};
return rotate([ 0, 0, 90 ]);
}).raw = d3_geo_transverseMercator;
d3.geom = {};
function d3_geom_pointX(d) {
return d[0];
}
function d3_geom_pointY(d) {
return d[1];
}
d3.geom.hull = function(vertices) {
var x = d3_geom_pointX, y = d3_geom_pointY;
if (arguments.length) return hull(vertices);
function hull(data) {
if (data.length < 3) return [];
var fx = d3_functor(x), fy = d3_functor(y), i, n = data.length, points = [], flippedPoints = [];
for (i = 0; i < n; i++) {
points.push([ +fx.call(this, data[i], i), +fy.call(this, data[i], i), i ]);
}
points.sort(d3_geom_hullOrder);
for (i = 0; i < n; i++) flippedPoints.push([ points[i][0], -points[i][1] ]);
var upper = d3_geom_hullUpper(points), lower = d3_geom_hullUpper(flippedPoints);
var skipLeft = lower[0] === upper[0], skipRight = lower[lower.length - 1] === upper[upper.length - 1], polygon = [];
for (i = upper.length - 1; i >= 0; --i) polygon.push(data[points[upper[i]][2]]);
for (i = +skipLeft; i < lower.length - skipRight; ++i) polygon.push(data[points[lower[i]][2]]);
return polygon;
}
hull.x = function(_) {
return arguments.length ? (x = _, hull) : x;
};
hull.y = function(_) {
return arguments.length ? (y = _, hull) : y;
};
return hull;
};
function d3_geom_hullUpper(points) {
var n = points.length, hull = [ 0, 1 ], hs = 2;
for (var i = 2; i < n; i++) {
while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs;
hull[hs++] = i;
}
return hull.slice(0, hs);
}
function d3_geom_hullOrder(a, b) {
return a[0] - b[0] || a[1] - b[1];
}
d3.geom.polygon = function(coordinates) {
d3_subclass(coordinates, d3_geom_polygonPrototype);
return coordinates;
};
var d3_geom_polygonPrototype = d3.geom.polygon.prototype = [];
d3_geom_polygonPrototype.area = function() {
var i = -1, n = this.length, a, b = this[n - 1], area = 0;
while (++i < n) {
a = b;
b = this[i];
area += a[1] * b[0] - a[0] * b[1];
}
return area * .5;
};
d3_geom_polygonPrototype.centroid = function(k) {
var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c;
if (!arguments.length) k = -1 / (6 * this.area());
while (++i < n) {
a = b;
b = this[i];
c = a[0] * b[1] - b[0] * a[1];
x += (a[0] + b[0]) * c;
y += (a[1] + b[1]) * c;
}
return [ x * k, y * k ];
};
d3_geom_polygonPrototype.clip = function(subject) {
var input, closed = d3_geom_polygonClosed(subject), i = -1, n = this.length - d3_geom_polygonClosed(this), j, m, a = this[n - 1], b, c, d;
while (++i < n) {
input = subject.slice();
subject.length = 0;
b = this[i];
c = input[(m = input.length - closed) - 1];
j = -1;
while (++j < m) {
d = input[j];
if (d3_geom_polygonInside(d, a, b)) {
if (!d3_geom_polygonInside(c, a, b)) {
subject.push(d3_geom_polygonIntersect(c, d, a, b));
}
subject.push(d);
} else if (d3_geom_polygonInside(c, a, b)) {
subject.push(d3_geom_polygonIntersect(c, d, a, b));
}
c = d;
}
if (closed) subject.push(subject[0]);
a = b;
}
return subject;
};
function d3_geom_polygonInside(p, a, b) {
return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
}
function d3_geom_polygonIntersect(c, d, a, b) {
var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21);
return [ x1 + ua * x21, y1 + ua * y21 ];
}
function d3_geom_polygonClosed(coordinates) {
var a = coordinates[0], b = coordinates[coordinates.length - 1];
return !(a[0] - b[0] || a[1] - b[1]);
}
var d3_geom_voronoiEdges, d3_geom_voronoiCells, d3_geom_voronoiBeaches, d3_geom_voronoiBeachPool = [], d3_geom_voronoiFirstCircle, d3_geom_voronoiCircles, d3_geom_voronoiCirclePool = [];
function d3_geom_voronoiBeach() {
d3_geom_voronoiRedBlackNode(this);
this.edge = this.site = this.circle = null;
}
function d3_geom_voronoiCreateBeach(site) {
var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach();
beach.site = site;
return beach;
}
function d3_geom_voronoiDetachBeach(beach) {
d3_geom_voronoiDetachCircle(beach);
d3_geom_voronoiBeaches.remove(beach);
d3_geom_voronoiBeachPool.push(beach);
d3_geom_voronoiRedBlackNode(beach);
}
function d3_geom_voronoiRemoveBeach(beach) {
var circle = beach.circle, x = circle.x, y = circle.cy, vertex = {
x: x,
y: y
}, previous = beach.P, next = beach.N, disappearing = [ beach ];
d3_geom_voronoiDetachBeach(beach);
var lArc = previous;
while (lArc.circle && abs(x - lArc.circle.x) < ε && abs(y - lArc.circle.cy) < ε) {
previous = lArc.P;
disappearing.unshift(lArc);
d3_geom_voronoiDetachBeach(lArc);
lArc = previous;
}
disappearing.unshift(lArc);
d3_geom_voronoiDetachCircle(lArc);
var rArc = next;
while (rArc.circle && abs(x - rArc.circle.x) < ε && abs(y - rArc.circle.cy) < ε) {
next = rArc.N;
disappearing.push(rArc);
d3_geom_voronoiDetachBeach(rArc);
rArc = next;
}
disappearing.push(rArc);
d3_geom_voronoiDetachCircle(rArc);
var nArcs = disappearing.length, iArc;
for (iArc = 1; iArc < nArcs; ++iArc) {
rArc = disappearing[iArc];
lArc = disappearing[iArc - 1];
d3_geom_voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex);
}
lArc = disappearing[0];
rArc = disappearing[nArcs - 1];
rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, rArc.site, null, vertex);
d3_geom_voronoiAttachCircle(lArc);
d3_geom_voronoiAttachCircle(rArc);
}
function d3_geom_voronoiAddBeach(site) {
var x = site.x, directrix = site.y, lArc, rArc, dxl, dxr, node = d3_geom_voronoiBeaches._;
while (node) {
dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x;
if (dxl > ε) node = node.L; else {
dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix);
if (dxr > ε) {
if (!node.R) {
lArc = node;
break;
}
node = node.R;
} else {
if (dxl > -ε) {
lArc = node.P;
rArc = node;
} else if (dxr > -ε) {
lArc = node;
rArc = node.N;
} else {
lArc = rArc = node;
}
break;
}
}
}
var newArc = d3_geom_voronoiCreateBeach(site);
d3_geom_voronoiBeaches.insert(lArc, newArc);
if (!lArc && !rArc) return;
if (lArc === rArc) {
d3_geom_voronoiDetachCircle(lArc);
rArc = d3_geom_voronoiCreateBeach(lArc.site);
d3_geom_voronoiBeaches.insert(newArc, rArc);
newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site);
d3_geom_voronoiAttachCircle(lArc);
d3_geom_voronoiAttachCircle(rArc);
return;
}
if (!rArc) {
newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site);
return;
}
d3_geom_voronoiDetachCircle(lArc);
d3_geom_voronoiDetachCircle(rArc);
var lSite = lArc.site, ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay, rSite = rArc.site, cx = rSite.x - ax, cy = rSite.y - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = {
x: (cy * hb - by * hc) / d + ax,
y: (bx * hc - cx * hb) / d + ay
};
d3_geom_voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex);
newArc.edge = d3_geom_voronoiCreateEdge(lSite, site, null, vertex);
rArc.edge = d3_geom_voronoiCreateEdge(site, rSite, null, vertex);
d3_geom_voronoiAttachCircle(lArc);
d3_geom_voronoiAttachCircle(rArc);
}
function d3_geom_voronoiLeftBreakPoint(arc, directrix) {
var site = arc.site, rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix;
if (!pby2) return rfocx;
var lArc = arc.P;
if (!lArc) return -Infinity;
site = lArc.site;
var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix;
if (!plby2) return lfocx;
var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2;
if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx;
return (rfocx + lfocx) / 2;
}
function d3_geom_voronoiRightBreakPoint(arc, directrix) {
var rArc = arc.N;
if (rArc) return d3_geom_voronoiLeftBreakPoint(rArc, directrix);
var site = arc.site;
return site.y === directrix ? site.x : Infinity;
}
function d3_geom_voronoiCell(site) {
this.site = site;
this.edges = [];
}
d3_geom_voronoiCell.prototype.prepare = function() {
var halfEdges = this.edges, iHalfEdge = halfEdges.length, edge;
while (iHalfEdge--) {
edge = halfEdges[iHalfEdge].edge;
if (!edge.b || !edge.a) halfEdges.splice(iHalfEdge, 1);
}
halfEdges.sort(d3_geom_voronoiHalfEdgeOrder);
return halfEdges.length;
};
function d3_geom_voronoiCloseCells(extent) {
var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3, cells = d3_geom_voronoiCells, iCell = cells.length, cell, iHalfEdge, halfEdges, nHalfEdges, start, end;
while (iCell--) {
cell = cells[iCell];
if (!cell || !cell.prepare()) continue;
halfEdges = cell.edges;
nHalfEdges = halfEdges.length;
iHalfEdge = 0;
while (iHalfEdge < nHalfEdges) {
end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y;
start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y;
if (abs(x3 - x2) > ε || abs(y3 - y2) > ε) {
halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < ε && y1 - y3 > ε ? {
x: x0,
y: abs(x2 - x0) < ε ? y2 : y1
} : abs(y3 - y1) < ε && x1 - x3 > ε ? {
x: abs(y2 - y1) < ε ? x2 : x1,
y: y1
} : abs(x3 - x1) < ε && y3 - y0 > ε ? {
x: x1,
y: abs(x2 - x1) < ε ? y2 : y0
} : abs(y3 - y0) < ε && x3 - x0 > ε ? {
x: abs(y2 - y0) < ε ? x2 : x0,
y: y0
} : null), cell.site, null));
++nHalfEdges;
}
}
}
}
function d3_geom_voronoiHalfEdgeOrder(a, b) {
return b.angle - a.angle;
}
function d3_geom_voronoiCircle() {
d3_geom_voronoiRedBlackNode(this);
this.x = this.y = this.arc = this.site = this.cy = null;
}
function d3_geom_voronoiAttachCircle(arc) {
var lArc = arc.P, rArc = arc.N;
if (!lArc || !rArc) return;
var lSite = lArc.site, cSite = arc.site, rSite = rArc.site;
if (lSite === rSite) return;
var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by;
var d = 2 * (ax * cy - ay * cx);
if (d >= -ε2) return;
var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d, cy = y + by;
var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle();
circle.arc = arc;
circle.site = cSite;
circle.x = x + bx;
circle.y = cy + Math.sqrt(x * x + y * y);
circle.cy = cy;
arc.circle = circle;
var before = null, node = d3_geom_voronoiCircles._;
while (node) {
if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) {
if (node.L) node = node.L; else {
before = node.P;
break;
}
} else {
if (node.R) node = node.R; else {
before = node;
break;
}
}
}
d3_geom_voronoiCircles.insert(before, circle);
if (!before) d3_geom_voronoiFirstCircle = circle;
}
function d3_geom_voronoiDetachCircle(arc) {
var circle = arc.circle;
if (circle) {
if (!circle.P) d3_geom_voronoiFirstCircle = circle.N;
d3_geom_voronoiCircles.remove(circle);
d3_geom_voronoiCirclePool.push(circle);
d3_geom_voronoiRedBlackNode(circle);
arc.circle = null;
}
}
function d3_geom_voronoiClipEdges(extent) {
var edges = d3_geom_voronoiEdges, clip = d3_geom_clipLine(extent[0][0], extent[0][1], extent[1][0], extent[1][1]), i = edges.length, e;
while (i--) {
e = edges[i];
if (!d3_geom_voronoiConnectEdge(e, extent) || !clip(e) || abs(e.a.x - e.b.x) < ε && abs(e.a.y - e.b.y) < ε) {
e.a = e.b = null;
edges.splice(i, 1);
}
}
}
function d3_geom_voronoiConnectEdge(edge, extent) {
var vb = edge.b;
if (vb) return true;
var va = edge.a, x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], lSite = edge.l, rSite = edge.r, lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb;
if (ry === ly) {
if (fx < x0 || fx >= x1) return;
if (lx > rx) {
if (!va) va = {
x: fx,
y: y0
}; else if (va.y >= y1) return;
vb = {
x: fx,
y: y1
};
} else {
if (!va) va = {
x: fx,
y: y1
}; else if (va.y < y0) return;
vb = {
x: fx,
y: y0
};
}
} else {
fm = (lx - rx) / (ry - ly);
fb = fy - fm * fx;
if (fm < -1 || fm > 1) {
if (lx > rx) {
if (!va) va = {
x: (y0 - fb) / fm,
y: y0
}; else if (va.y >= y1) return;
vb = {
x: (y1 - fb) / fm,
y: y1
};
} else {
if (!va) va = {
x: (y1 - fb) / fm,
y: y1
}; else if (va.y < y0) return;
vb = {
x: (y0 - fb) / fm,
y: y0
};
}
} else {
if (ly < ry) {
if (!va) va = {
x: x0,
y: fm * x0 + fb
}; else if (va.x >= x1) return;
vb = {
x: x1,
y: fm * x1 + fb
};
} else {
if (!va) va = {
x: x1,
y: fm * x1 + fb
}; else if (va.x < x0) return;
vb = {
x: x0,
y: fm * x0 + fb
};
}
}
}
edge.a = va;
edge.b = vb;
return true;
}
function d3_geom_voronoiEdge(lSite, rSite) {
this.l = lSite;
this.r = rSite;
this.a = this.b = null;
}
function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) {
var edge = new d3_geom_voronoiEdge(lSite, rSite);
d3_geom_voronoiEdges.push(edge);
if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va);
if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb);
d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite));
d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite));
return edge;
}
function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) {
var edge = new d3_geom_voronoiEdge(lSite, null);
edge.a = va;
edge.b = vb;
d3_geom_voronoiEdges.push(edge);
return edge;
}
function d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, vertex) {
if (!edge.a && !edge.b) {
edge.a = vertex;
edge.l = lSite;
edge.r = rSite;
} else if (edge.l === rSite) {
edge.b = vertex;
} else {
edge.a = vertex;
}
}
function d3_geom_voronoiHalfEdge(edge, lSite, rSite) {
var va = edge.a, vb = edge.b;
this.edge = edge;
this.site = lSite;
this.angle = rSite ? Math.atan2(rSite.y - lSite.y, rSite.x - lSite.x) : edge.l === lSite ? Math.atan2(vb.x - va.x, va.y - vb.y) : Math.atan2(va.x - vb.x, vb.y - va.y);
}
d3_geom_voronoiHalfEdge.prototype = {
start: function() {
return this.edge.l === this.site ? this.edge.a : this.edge.b;
},
end: function() {
return this.edge.l === this.site ? this.edge.b : this.edge.a;
}
};
function d3_geom_voronoiRedBlackTree() {
this._ = null;
}
function d3_geom_voronoiRedBlackNode(node) {
node.U = node.C = node.L = node.R = node.P = node.N = null;
}
d3_geom_voronoiRedBlackTree.prototype = {
insert: function(after, node) {
var parent, grandpa, uncle;
if (after) {
node.P = after;
node.N = after.N;
if (after.N) after.N.P = node;
after.N = node;
if (after.R) {
after = after.R;
while (after.L) after = after.L;
after.L = node;
} else {
after.R = node;
}
parent = after;
} else if (this._) {
after = d3_geom_voronoiRedBlackFirst(this._);
node.P = null;
node.N = after;
after.P = after.L = node;
parent = after;
} else {
node.P = node.N = null;
this._ = node;
parent = null;
}
node.L = node.R = null;
node.U = parent;
node.C = true;
after = node;
while (parent && parent.C) {
grandpa = parent.U;
if (parent === grandpa.L) {
uncle = grandpa.R;
if (uncle && uncle.C) {
parent.C = uncle.C = false;
grandpa.C = true;
after = grandpa;
} else {
if (after === parent.R) {
d3_geom_voronoiRedBlackRotateLeft(this, parent);
after = parent;
parent = after.U;
}
parent.C = false;
grandpa.C = true;
d3_geom_voronoiRedBlackRotateRight(this, grandpa);
}
} else {
uncle = grandpa.L;
if (uncle && uncle.C) {
parent.C = uncle.C = false;
grandpa.C = true;
after = grandpa;
} else {
if (after === parent.L) {
d3_geom_voronoiRedBlackRotateRight(this, parent);
after = parent;
parent = after.U;
}
parent.C = false;
grandpa.C = true;
d3_geom_voronoiRedBlackRotateLeft(this, grandpa);
}
}
parent = after.U;
}
this._.C = false;
},
remove: function(node) {
if (node.N) node.N.P = node.P;
if (node.P) node.P.N = node.N;
node.N = node.P = null;
var parent = node.U, sibling, left = node.L, right = node.R, next, red;
if (!left) next = right; else if (!right) next = left; else next = d3_geom_voronoiRedBlackFirst(right);
if (parent) {
if (parent.L === node) parent.L = next; else parent.R = next;
} else {
this._ = next;
}
if (left && right) {
red = next.C;
next.C = node.C;
next.L = left;
left.U = next;
if (next !== right) {
parent = next.U;
next.U = node.U;
node = next.R;
parent.L = node;
next.R = right;
right.U = next;
} else {
next.U = parent;
parent = next;
node = next.R;
}
} else {
red = node.C;
node = next;
}
if (node) node.U = parent;
if (red) return;
if (node && node.C) {
node.C = false;
return;
}
do {
if (node === this._) break;
if (node === parent.L) {
sibling = parent.R;
if (sibling.C) {
sibling.C = false;
parent.C = true;
d3_geom_voronoiRedBlackRotateLeft(this, parent);
sibling = parent.R;
}
if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) {
if (!sibling.R || !sibling.R.C) {
sibling.L.C = false;
sibling.C = true;
d3_geom_voronoiRedBlackRotateRight(this, sibling);
sibling = parent.R;
}
sibling.C = parent.C;
parent.C = sibling.R.C = false;
d3_geom_voronoiRedBlackRotateLeft(this, parent);
node = this._;
break;
}
} else {
sibling = parent.L;
if (sibling.C) {
sibling.C = false;
parent.C = true;
d3_geom_voronoiRedBlackRotateRight(this, parent);
sibling = parent.L;
}
if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) {
if (!sibling.L || !sibling.L.C) {
sibling.R.C = false;
sibling.C = true;
d3_geom_voronoiRedBlackRotateLeft(this, sibling);
sibling = parent.L;
}
sibling.C = parent.C;
parent.C = sibling.L.C = false;
d3_geom_voronoiRedBlackRotateRight(this, parent);
node = this._;
break;
}
}
sibling.C = true;
node = parent;
parent = parent.U;
} while (!node.C);
if (node) node.C = false;
}
};
function d3_geom_voronoiRedBlackRotateLeft(tree, node) {
var p = node, q = node.R, parent = p.U;
if (parent) {
if (parent.L === p) parent.L = q; else parent.R = q;
} else {
tree._ = q;
}
q.U = parent;
p.U = q;
p.R = q.L;
if (p.R) p.R.U = p;
q.L = p;
}
function d3_geom_voronoiRedBlackRotateRight(tree, node) {
var p = node, q = node.L, parent = p.U;
if (parent) {
if (parent.L === p) parent.L = q; else parent.R = q;
} else {
tree._ = q;
}
q.U = parent;
p.U = q;
p.L = q.R;
if (p.L) p.L.U = p;
q.R = p;
}
function d3_geom_voronoiRedBlackFirst(node) {
while (node.L) node = node.L;
return node;
}
function d3_geom_voronoi(sites, bbox) {
var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle;
d3_geom_voronoiEdges = [];
d3_geom_voronoiCells = new Array(sites.length);
d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree();
d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree();
while (true) {
circle = d3_geom_voronoiFirstCircle;
if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) {
if (site.x !== x0 || site.y !== y0) {
d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site);
d3_geom_voronoiAddBeach(site);
x0 = site.x, y0 = site.y;
}
site = sites.pop();
} else if (circle) {
d3_geom_voronoiRemoveBeach(circle.arc);
} else {
break;
}
}
if (bbox) d3_geom_voronoiClipEdges(bbox), d3_geom_voronoiCloseCells(bbox);
var diagram = {
cells: d3_geom_voronoiCells,
edges: d3_geom_voronoiEdges
};
d3_geom_voronoiBeaches = d3_geom_voronoiCircles = d3_geom_voronoiEdges = d3_geom_voronoiCells = null;
return diagram;
}
function d3_geom_voronoiVertexOrder(a, b) {
return b.y - a.y || b.x - a.x;
}
d3.geom.voronoi = function(points) {
var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent;
if (points) return voronoi(points);
function voronoi(data) {
var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1];
d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) {
var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) {
var s = e.start();
return [ s.x, s.y ];
}) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : [];
polygon.point = data[i];
});
return polygons;
}
function sites(data) {
return data.map(function(d, i) {
return {
x: Math.round(fx(d, i) / ε) * ε,
y: Math.round(fy(d, i) / ε) * ε,
i: i
};
});
}
voronoi.links = function(data) {
return d3_geom_voronoi(sites(data)).edges.filter(function(edge) {
return edge.l && edge.r;
}).map(function(edge) {
return {
source: data[edge.l.i],
target: data[edge.r.i]
};
});
};
voronoi.triangles = function(data) {
var triangles = [];
d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) {
var site = cell.site, edges = cell.edges.sort(d3_geom_voronoiHalfEdgeOrder), j = -1, m = edges.length, e0, s0, e1 = edges[m - 1].edge, s1 = e1.l === site ? e1.r : e1.l;
while (++j < m) {
e0 = e1;
s0 = s1;
e1 = edges[j].edge;
s1 = e1.l === site ? e1.r : e1.l;
if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) {
triangles.push([ data[i], data[s0.i], data[s1.i] ]);
}
}
});
return triangles;
};
voronoi.x = function(_) {
return arguments.length ? (fx = d3_functor(x = _), voronoi) : x;
};
voronoi.y = function(_) {
return arguments.length ? (fy = d3_functor(y = _), voronoi) : y;
};
voronoi.clipExtent = function(_) {
if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent;
clipExtent = _ == null ? d3_geom_voronoiClipExtent : _;
return voronoi;
};
voronoi.size = function(_) {
if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1];
return voronoi.clipExtent(_ && [ [ 0, 0 ], _ ]);
};
return voronoi;
};
var d3_geom_voronoiClipExtent = [ [ -1e6, -1e6 ], [ 1e6, 1e6 ] ];
function d3_geom_voronoiTriangleArea(a, b, c) {
return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y);
}
d3.geom.delaunay = function(vertices) {
return d3.geom.voronoi().triangles(vertices);
};
d3.geom.quadtree = function(points, x1, y1, x2, y2) {
var x = d3_geom_pointX, y = d3_geom_pointY, compat;
if (compat = arguments.length) {
x = d3_geom_quadtreeCompatX;
y = d3_geom_quadtreeCompatY;
if (compat === 3) {
y2 = y1;
x2 = x1;
y1 = x1 = 0;
}
return quadtree(points);
}
function quadtree(data) {
var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_;
if (x1 != null) {
x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2;
} else {
x2_ = y2_ = -(x1_ = y1_ = Infinity);
xs = [], ys = [];
n = data.length;
if (compat) for (i = 0; i < n; ++i) {
d = data[i];
if (d.x < x1_) x1_ = d.x;
if (d.y < y1_) y1_ = d.y;
if (d.x > x2_) x2_ = d.x;
if (d.y > y2_) y2_ = d.y;
xs.push(d.x);
ys.push(d.y);
} else for (i = 0; i < n; ++i) {
var x_ = +fx(d = data[i], i), y_ = +fy(d, i);
if (x_ < x1_) x1_ = x_;
if (y_ < y1_) y1_ = y_;
if (x_ > x2_) x2_ = x_;
if (y_ > y2_) y2_ = y_;
xs.push(x_);
ys.push(y_);
}
}
var dx = x2_ - x1_, dy = y2_ - y1_;
if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy;
function insert(n, d, x, y, x1, y1, x2, y2) {
if (isNaN(x) || isNaN(y)) return;
if (n.leaf) {
var nx = n.x, ny = n.y;
if (nx != null) {
if (abs(nx - x) + abs(ny - y) < .01) {
insertChild(n, d, x, y, x1, y1, x2, y2);
} else {
var nPoint = n.point;
n.x = n.y = n.point = null;
insertChild(n, nPoint, nx, ny, x1, y1, x2, y2);
insertChild(n, d, x, y, x1, y1, x2, y2);
}
} else {
n.x = x, n.y = y, n.point = d;
}
} else {
insertChild(n, d, x, y, x1, y1, x2, y2);
}
}
function insertChild(n, d, x, y, x1, y1, x2, y2) {
var xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym, i = below << 1 | right;
n.leaf = false;
n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
if (right) x1 = xm; else x2 = xm;
if (below) y1 = ym; else y2 = ym;
insert(n, d, x, y, x1, y1, x2, y2);
}
var root = d3_geom_quadtreeNode();
root.add = function(d) {
insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_);
};
root.visit = function(f) {
d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_);
};
root.find = function(point) {
return d3_geom_quadtreeFind(root, point[0], point[1], x1_, y1_, x2_, y2_);
};
i = -1;
if (x1 == null) {
while (++i < n) {
insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_);
}
--i;
} else data.forEach(root.add);
xs = ys = data = d = null;
return root;
}
quadtree.x = function(_) {
return arguments.length ? (x = _, quadtree) : x;
};
quadtree.y = function(_) {
return arguments.length ? (y = _, quadtree) : y;
};
quadtree.extent = function(_) {
if (!arguments.length) return x1 == null ? null : [ [ x1, y1 ], [ x2, y2 ] ];
if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0],
y2 = +_[1][1];
return quadtree;
};
quadtree.size = function(_) {
if (!arguments.length) return x1 == null ? null : [ x2 - x1, y2 - y1 ];
if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = y1 = 0, x2 = +_[0], y2 = +_[1];
return quadtree;
};
return quadtree;
};
function d3_geom_quadtreeCompatX(d) {
return d.x;
}
function d3_geom_quadtreeCompatY(d) {
return d.y;
}
function d3_geom_quadtreeNode() {
return {
leaf: true,
nodes: [],
point: null,
x: null,
y: null
};
}
function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
if (!f(node, x1, y1, x2, y2)) {
var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
}
}
function d3_geom_quadtreeFind(root, x, y, x0, y0, x3, y3) {
var minDistance2 = Infinity, closestPoint;
(function find(node, x1, y1, x2, y2) {
if (x1 > x3 || y1 > y3 || x2 < x0 || y2 < y0) return;
if (point = node.point) {
var point, dx = x - node.x, dy = y - node.y, distance2 = dx * dx + dy * dy;
if (distance2 < minDistance2) {
var distance = Math.sqrt(minDistance2 = distance2);
x0 = x - distance, y0 = y - distance;
x3 = x + distance, y3 = y + distance;
closestPoint = point;
}
}
var children = node.nodes, xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym;
for (var i = below << 1 | right, j = i + 4; i < j; ++i) {
if (node = children[i & 3]) switch (i & 3) {
case 0:
find(node, x1, y1, xm, ym);
break;
case 1:
find(node, xm, y1, x2, ym);
break;
case 2:
find(node, x1, ym, xm, y2);
break;
case 3:
find(node, xm, ym, x2, y2);
break;
}
}
})(root, x0, y0, x3, y3);
return closestPoint;
}
d3.interpolateRgb = d3_interpolateRgb;
function d3_interpolateRgb(a, b) {
a = d3.rgb(a);
b = d3.rgb(b);
var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
return function(t) {
return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
};
}
d3.interpolateObject = d3_interpolateObject;
function d3_interpolateObject(a, b) {
var i = {}, c = {}, k;
for (k in a) {
if (k in b) {
i[k] = d3_interpolate(a[k], b[k]);
} else {
c[k] = a[k];
}
}
for (k in b) {
if (!(k in a)) {
c[k] = b[k];
}
}
return function(t) {
for (k in i) c[k] = i[k](t);
return c;
};
}
d3.interpolateNumber = d3_interpolateNumber;
function d3_interpolateNumber(a, b) {
a = +a, b = +b;
return function(t) {
return a * (1 - t) + b * t;
};
}
d3.interpolateString = d3_interpolateString;
function d3_interpolateString(a, b) {
var bi = d3_interpolate_numberA.lastIndex = d3_interpolate_numberB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = [];
a = a + "", b = b + "";
while ((am = d3_interpolate_numberA.exec(a)) && (bm = d3_interpolate_numberB.exec(b))) {
if ((bs = bm.index) > bi) {
bs = b.slice(bi, bs);
if (s[i]) s[i] += bs; else s[++i] = bs;
}
if ((am = am[0]) === (bm = bm[0])) {
if (s[i]) s[i] += bm; else s[++i] = bm;
} else {
s[++i] = null;
q.push({
i: i,
x: d3_interpolateNumber(am, bm)
});
}
bi = d3_interpolate_numberB.lastIndex;
}
if (bi < b.length) {
bs = b.slice(bi);
if (s[i]) s[i] += bs; else s[++i] = bs;
}
return s.length < 2 ? q[0] ? (b = q[0].x, function(t) {
return b(t) + "";
}) : function() {
return b;
} : (b = q.length, function(t) {
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
return s.join("");
});
}
var d3_interpolate_numberA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, d3_interpolate_numberB = new RegExp(d3_interpolate_numberA.source, "g");
d3.interpolate = d3_interpolate;
function d3_interpolate(a, b) {
var i = d3.interpolators.length, f;
while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
return f;
}
d3.interpolators = [ function(a, b) {
var t = typeof b;
return (t === "string" ? d3_rgb_names.has(b.toLowerCase()) || /^(#|rgb\(|hsl\()/i.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_color ? d3_interpolateRgb : Array.isArray(b) ? d3_interpolateArray : t === "object" && isNaN(b) ? d3_interpolateObject : d3_interpolateNumber)(a, b);
} ];
d3.interpolateArray = d3_interpolateArray;
function d3_interpolateArray(a, b) {
var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i]));
for (;i < na; ++i) c[i] = a[i];
for (;i < nb; ++i) c[i] = b[i];
return function(t) {
for (i = 0; i < n0; ++i) c[i] = x[i](t);
return c;
};
}
var d3_ease_default = function() {
return d3_identity;
};
var d3_ease = d3.map({
linear: d3_ease_default,
poly: d3_ease_poly,
quad: function() {
return d3_ease_quad;
},
cubic: function() {
return d3_ease_cubic;
},
sin: function() {
return d3_ease_sin;
},
exp: function() {
return d3_ease_exp;
},
circle: function() {
return d3_ease_circle;
},
elastic: d3_ease_elastic,
back: d3_ease_back,
bounce: function() {
return d3_ease_bounce;
}
});
var d3_ease_mode = d3.map({
"in": d3_identity,
out: d3_ease_reverse,
"in-out": d3_ease_reflect,
"out-in": function(f) {
return d3_ease_reflect(d3_ease_reverse(f));
}
});
d3.ease = function(name) {
var i = name.indexOf("-"), t = i >= 0 ? name.slice(0, i) : name, m = i >= 0 ? name.slice(i + 1) : "in";
t = d3_ease.get(t) || d3_ease_default;
m = d3_ease_mode.get(m) || d3_identity;
return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1))));
};
function d3_ease_clamp(f) {
return function(t) {
return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
};
}
function d3_ease_reverse(f) {
return function(t) {
return 1 - f(1 - t);
};
}
function d3_ease_reflect(f) {
return function(t) {
return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
};
}
function d3_ease_quad(t) {
return t * t;
}
function d3_ease_cubic(t) {
return t * t * t;
}
function d3_ease_cubicInOut(t) {
if (t <= 0) return 0;
if (t >= 1) return 1;
var t2 = t * t, t3 = t2 * t;
return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75);
}
function d3_ease_poly(e) {
return function(t) {
return Math.pow(t, e);
};
}
function d3_ease_sin(t) {
return 1 - Math.cos(t * halfπ);
}
function d3_ease_exp(t) {
return Math.pow(2, 10 * (t - 1));
}
function d3_ease_circle(t) {
return 1 - Math.sqrt(1 - t * t);
}
function d3_ease_elastic(a, p) {
var s;
if (arguments.length < 2) p = .45;
if (arguments.length) s = p / τ * Math.asin(1 / a); else a = 1, s = p / 4;
return function(t) {
return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * τ / p);
};
}
function d3_ease_back(s) {
if (!s) s = 1.70158;
return function(t) {
return t * t * ((s + 1) * t - s);
};
}
function d3_ease_bounce(t) {
return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
}
d3.interpolateHcl = d3_interpolateHcl;
function d3_interpolateHcl(a, b) {
a = d3.hcl(a);
b = d3.hcl(b);
var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac;
if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
return function(t) {
return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
};
}
d3.interpolateHsl = d3_interpolateHsl;
function d3_interpolateHsl(a, b) {
a = d3.hsl(a);
b = d3.hsl(b);
var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al;
if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as;
if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
return function(t) {
return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + "";
};
}
d3.interpolateLab = d3_interpolateLab;
function d3_interpolateLab(a, b) {
a = d3.lab(a);
b = d3.lab(b);
var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
return function(t) {
return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
};
}
d3.interpolateRound = d3_interpolateRound;
function d3_interpolateRound(a, b) {
b -= a;
return function(t) {
return Math.round(a + b * t);
};
}
d3.transform = function(string) {
var g = d3_document.createElementNS(d3.ns.prefix.svg, "g");
return (d3.transform = function(string) {
if (string != null) {
g.setAttribute("transform", string);
var t = g.transform.baseVal.consolidate();
}
return new d3_transform(t ? t.matrix : d3_transformIdentity);
})(string);
};
function d3_transform(m) {
var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
if (r0[0] * r1[1] < r1[0] * r0[1]) {
r0[0] *= -1;
r0[1] *= -1;
kx *= -1;
kz *= -1;
}
this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees;
this.translate = [ m.e, m.f ];
this.scale = [ kx, ky ];
this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0;
}
d3_transform.prototype.toString = function() {
return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
};
function d3_transformDot(a, b) {
return a[0] * b[0] + a[1] * b[1];
}
function d3_transformNormalize(a) {
var k = Math.sqrt(d3_transformDot(a, a));
if (k) {
a[0] /= k;
a[1] /= k;
}
return k;
}
function d3_transformCombine(a, b, k) {
a[0] += k * b[0];
a[1] += k * b[1];
return a;
}
var d3_transformIdentity = {
a: 1,
b: 0,
c: 0,
d: 1,
e: 0,
f: 0
};
d3.interpolateTransform = d3_interpolateTransform;
function d3_interpolateTransformPop(s) {
return s.length ? s.pop() + "," : "";
}
function d3_interpolateTranslate(ta, tb, s, q) {
if (ta[0] !== tb[0] || ta[1] !== tb[1]) {
var i = s.push("translate(", null, ",", null, ")");
q.push({
i: i - 4,
x: d3_interpolateNumber(ta[0], tb[0])
}, {
i: i - 2,
x: d3_interpolateNumber(ta[1], tb[1])
});
} else if (tb[0] || tb[1]) {
s.push("translate(" + tb + ")");
}
}
function d3_interpolateRotate(ra, rb, s, q) {
if (ra !== rb) {
if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
q.push({
i: s.push(d3_interpolateTransformPop(s) + "rotate(", null, ")") - 2,
x: d3_interpolateNumber(ra, rb)
});
} else if (rb) {
s.push(d3_interpolateTransformPop(s) + "rotate(" + rb + ")");
}
}
function d3_interpolateSkew(wa, wb, s, q) {
if (wa !== wb) {
q.push({
i: s.push(d3_interpolateTransformPop(s) + "skewX(", null, ")") - 2,
x: d3_interpolateNumber(wa, wb)
});
} else if (wb) {
s.push(d3_interpolateTransformPop(s) + "skewX(" + wb + ")");
}
}
function d3_interpolateScale(ka, kb, s, q) {
if (ka[0] !== kb[0] || ka[1] !== kb[1]) {
var i = s.push(d3_interpolateTransformPop(s) + "scale(", null, ",", null, ")");
q.push({
i: i - 4,
x: d3_interpolateNumber(ka[0], kb[0])
}, {
i: i - 2,
x: d3_interpolateNumber(ka[1], kb[1])
});
} else if (kb[0] !== 1 || kb[1] !== 1) {
s.push(d3_interpolateTransformPop(s) + "scale(" + kb + ")");
}
}
function d3_interpolateTransform(a, b) {
var s = [], q = [];
a = d3.transform(a), b = d3.transform(b);
d3_interpolateTranslate(a.translate, b.translate, s, q);
d3_interpolateRotate(a.rotate, b.rotate, s, q);
d3_interpolateSkew(a.skew, b.skew, s, q);
d3_interpolateScale(a.scale, b.scale, s, q);
a = b = null;
return function(t) {
var i = -1, n = q.length, o;
while (++i < n) s[(o = q[i]).i] = o.x(t);
return s.join("");
};
}
function d3_uninterpolateNumber(a, b) {
b = (b -= a = +a) || 1 / b;
return function(x) {
return (x - a) / b;
};
}
function d3_uninterpolateClamp(a, b) {
b = (b -= a = +a) || 1 / b;
return function(x) {
return Math.max(0, Math.min(1, (x - a) / b));
};
}
d3.layout = {};
d3.layout.bundle = function() {
return function(links) {
var paths = [], i = -1, n = links.length;
while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
return paths;
};
};
function d3_layout_bundlePath(link) {
var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
while (start !== lca) {
start = start.parent;
points.push(start);
}
var k = points.length;
while (end !== lca) {
points.splice(k, 0, end);
end = end.parent;
}
return points;
}
function d3_layout_bundleAncestors(node) {
var ancestors = [], parent = node.parent;
while (parent != null) {
ancestors.push(node);
node = parent;
parent = parent.parent;
}
ancestors.push(node);
return ancestors;
}
function d3_layout_bundleLeastCommonAncestor(a, b) {
if (a === b) return a;
var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
while (aNode === bNode) {
sharedNode = aNode;
aNode = aNodes.pop();
bNode = bNodes.pop();
}
return sharedNode;
}
d3.layout.chord = function() {
var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
function relayout() {
var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
chords = [];
groups = [];
k = 0, i = -1;
while (++i < n) {
x = 0, j = -1;
while (++j < n) {
x += matrix[i][j];
}
groupSums.push(x);
subgroupIndex.push(d3.range(n));
k += x;
}
if (sortGroups) {
groupIndex.sort(function(a, b) {
return sortGroups(groupSums[a], groupSums[b]);
});
}
if (sortSubgroups) {
subgroupIndex.forEach(function(d, i) {
d.sort(function(a, b) {
return sortSubgroups(matrix[i][a], matrix[i][b]);
});
});
}
k = (τ - padding * n) / k;
x = 0, i = -1;
while (++i < n) {
x0 = x, j = -1;
while (++j < n) {
var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
subgroups[di + "-" + dj] = {
index: di,
subindex: dj,
startAngle: a0,
endAngle: a1,
value: v
};
}
groups[di] = {
index: di,
startAngle: x0,
endAngle: x,
value: groupSums[di]
};
x += padding;
}
i = -1;
while (++i < n) {
j = i - 1;
while (++j < n) {
var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
if (source.value || target.value) {
chords.push(source.value < target.value ? {
source: target,
target: source
} : {
source: source,
target: target
});
}
}
}
if (sortChords) resort();
}
function resort() {
chords.sort(function(a, b) {
return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
});
}
chord.matrix = function(x) {
if (!arguments.length) return matrix;
n = (matrix = x) && matrix.length;
chords = groups = null;
return chord;
};
chord.padding = function(x) {
if (!arguments.length) return padding;
padding = x;
chords = groups = null;
return chord;
};
chord.sortGroups = function(x) {
if (!arguments.length) return sortGroups;
sortGroups = x;
chords = groups = null;
return chord;
};
chord.sortSubgroups = function(x) {
if (!arguments.length) return sortSubgroups;
sortSubgroups = x;
chords = null;
return chord;
};
chord.sortChords = function(x) {
if (!arguments.length) return sortChords;
sortChords = x;
if (chords) resort();
return chord;
};
chord.chords = function() {
if (!chords) relayout();
return chords;
};
chord.groups = function() {
if (!groups) relayout();
return groups;
};
return chord;
};
d3.layout.force = function() {
var force = {}, event = d3.dispatch("start", "tick", "end"), timer, size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = .1, theta2 = .64, nodes = [], links = [], distances, strengths, charges;
function repulse(node) {
return function(quad, x1, _, x2) {
if (quad.point !== node) {
var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x1, dn = dx * dx + dy * dy;
if (dw * dw / theta2 < dn) {
if (dn < chargeDistance2) {
var k = quad.charge / dn;
node.px -= dx * k;
node.py -= dy * k;
}
return true;
}
if (quad.point && dn && dn < chargeDistance2) {
var k = quad.pointCharge / dn;
node.px -= dx * k;
node.py -= dy * k;
}
}
return !quad.charge;
};
}
force.tick = function() {
if ((alpha *= .99) < .005) {
timer = null;
event.end({
type: "end",
alpha: alpha = 0
});
return true;
}
var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
for (i = 0; i < m; ++i) {
o = links[i];
s = o.source;
t = o.target;
x = t.x - s.x;
y = t.y - s.y;
if (l = x * x + y * y) {
l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
x *= l;
y *= l;
t.x -= x * (k = s.weight + t.weight ? s.weight / (s.weight + t.weight) : .5);
t.y -= y * k;
s.x += x * (k = 1 - k);
s.y += y * k;
}
}
if (k = alpha * gravity) {
x = size[0] / 2;
y = size[1] / 2;
i = -1;
if (k) while (++i < n) {
o = nodes[i];
o.x += (x - o.x) * k;
o.y += (y - o.y) * k;
}
}
if (charge) {
d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
i = -1;
while (++i < n) {
if (!(o = nodes[i]).fixed) {
q.visit(repulse(o));
}
}
}
i = -1;
while (++i < n) {
o = nodes[i];
if (o.fixed) {
o.x = o.px;
o.y = o.py;
} else {
o.x -= (o.px - (o.px = o.x)) * friction;
o.y -= (o.py - (o.py = o.y)) * friction;
}
}
event.tick({
type: "tick",
alpha: alpha
});
};
force.nodes = function(x) {
if (!arguments.length) return nodes;
nodes = x;
return force;
};
force.links = function(x) {
if (!arguments.length) return links;
links = x;
return force;
};
force.size = function(x) {
if (!arguments.length) return size;
size = x;
return force;
};
force.linkDistance = function(x) {
if (!arguments.length) return linkDistance;
linkDistance = typeof x === "function" ? x : +x;
return force;
};
force.distance = force.linkDistance;
force.linkStrength = function(x) {
if (!arguments.length) return linkStrength;
linkStrength = typeof x === "function" ? x : +x;
return force;
};
force.friction = function(x) {
if (!arguments.length) return friction;
friction = +x;
return force;
};
force.charge = function(x) {
if (!arguments.length) return charge;
charge = typeof x === "function" ? x : +x;
return force;
};
force.chargeDistance = function(x) {
if (!arguments.length) return Math.sqrt(chargeDistance2);
chargeDistance2 = x * x;
return force;
};
force.gravity = function(x) {
if (!arguments.length) return gravity;
gravity = +x;
return force;
};
force.theta = function(x) {
if (!arguments.length) return Math.sqrt(theta2);
theta2 = x * x;
return force;
};
force.alpha = function(x) {
if (!arguments.length) return alpha;
x = +x;
if (alpha) {
if (x > 0) {
alpha = x;
} else {
timer.c = null, timer.t = NaN, timer = null;
event.end({
type: "end",
alpha: alpha = 0
});
}
} else if (x > 0) {
event.start({
type: "start",
alpha: alpha = x
});
timer = d3_timer(force.tick);
}
return force;
};
force.start = function() {
var i, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
for (i = 0; i < n; ++i) {
(o = nodes[i]).index = i;
o.weight = 0;
}
for (i = 0; i < m; ++i) {
o = links[i];
if (typeof o.source == "number") o.source = nodes[o.source];
if (typeof o.target == "number") o.target = nodes[o.target];
++o.source.weight;
++o.target.weight;
}
for (i = 0; i < n; ++i) {
o = nodes[i];
if (isNaN(o.x)) o.x = position("x", w);
if (isNaN(o.y)) o.y = position("y", h);
if (isNaN(o.px)) o.px = o.x;
if (isNaN(o.py)) o.py = o.y;
}
distances = [];
if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance;
strengths = [];
if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength;
charges = [];
if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge;
function position(dimension, size) {
if (!neighbors) {
neighbors = new Array(n);
for (j = 0; j < n; ++j) {
neighbors[j] = [];
}
for (j = 0; j < m; ++j) {
var o = links[j];
neighbors[o.source.index].push(o.target);
neighbors[o.target.index].push(o.source);
}
}
var candidates = neighbors[i], j = -1, l = candidates.length, x;
while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x;
return Math.random() * size;
}
return force.resume();
};
force.resume = function() {
return force.alpha(.1);
};
force.stop = function() {
return force.alpha(0);
};
force.drag = function() {
if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend);
if (!arguments.length) return drag;
this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
};
function dragmove(d) {
d.px = d3.event.x, d.py = d3.event.y;
force.resume();
}
return d3.rebind(force, event, "on");
};
function d3_layout_forceDragstart(d) {
d.fixed |= 2;
}
function d3_layout_forceDragend(d) {
d.fixed &= ~6;
}
function d3_layout_forceMouseover(d) {
d.fixed |= 4;
d.px = d.x, d.py = d.y;
}
function d3_layout_forceMouseout(d) {
d.fixed &= ~4;
}
function d3_layout_forceAccumulate(quad, alpha, charges) {
var cx = 0, cy = 0;
quad.charge = 0;
if (!quad.leaf) {
var nodes = quad.nodes, n = nodes.length, i = -1, c;
while (++i < n) {
c = nodes[i];
if (c == null) continue;
d3_layout_forceAccumulate(c, alpha, charges);
quad.charge += c.charge;
cx += c.charge * c.cx;
cy += c.charge * c.cy;
}
}
if (quad.point) {
if (!quad.leaf) {
quad.point.x += Math.random() - .5;
quad.point.y += Math.random() - .5;
}
var k = alpha * charges[quad.point.index];
quad.charge += quad.pointCharge = k;
cx += k * quad.point.x;
cy += k * quad.point.y;
}
quad.cx = cx / quad.charge;
quad.cy = cy / quad.charge;
}
var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1, d3_layout_forceChargeDistance2 = Infinity;
d3.layout.hierarchy = function() {
var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
function hierarchy(root) {
var stack = [ root ], nodes = [], node;
root.depth = 0;
while ((node = stack.pop()) != null) {
nodes.push(node);
if ((childs = children.call(hierarchy, node, node.depth)) && (n = childs.length)) {
var n, childs, child;
while (--n >= 0) {
stack.push(child = childs[n]);
child.parent = node;
child.depth = node.depth + 1;
}
if (value) node.value = 0;
node.children = childs;
} else {
if (value) node.value = +value.call(hierarchy, node, node.depth) || 0;
delete node.children;
}
}
d3_layout_hierarchyVisitAfter(root, function(node) {
var childs, parent;
if (sort && (childs = node.children)) childs.sort(sort);
if (value && (parent = node.parent)) parent.value += node.value;
});
return nodes;
}
hierarchy.sort = function(x) {
if (!arguments.length) return sort;
sort = x;
return hierarchy;
};
hierarchy.children = function(x) {
if (!arguments.length) return children;
children = x;
return hierarchy;
};
hierarchy.value = function(x) {
if (!arguments.length) return value;
value = x;
return hierarchy;
};
hierarchy.revalue = function(root) {
if (value) {
d3_layout_hierarchyVisitBefore(root, function(node) {
if (node.children) node.value = 0;
});
d3_layout_hierarchyVisitAfter(root, function(node) {
var parent;
if (!node.children) node.value = +value.call(hierarchy, node, node.depth) || 0;
if (parent = node.parent) parent.value += node.value;
});
}
return root;
};
return hierarchy;
};
function d3_layout_hierarchyRebind(object, hierarchy) {
d3.rebind(object, hierarchy, "sort", "children", "value");
object.nodes = object;
object.links = d3_layout_hierarchyLinks;
return object;
}
function d3_layout_hierarchyVisitBefore(node, callback) {
var nodes = [ node ];
while ((node = nodes.pop()) != null) {
callback(node);
if ((children = node.children) && (n = children.length)) {
var n, children;
while (--n >= 0) nodes.push(children[n]);
}
}
}
function d3_layout_hierarchyVisitAfter(node, callback) {
var nodes = [ node ], nodes2 = [];
while ((node = nodes.pop()) != null) {
nodes2.push(node);
if ((children = node.children) && (n = children.length)) {
var i = -1, n, children;
while (++i < n) nodes.push(children[i]);
}
}
while ((node = nodes2.pop()) != null) {
callback(node);
}
}
function d3_layout_hierarchyChildren(d) {
return d.children;
}
function d3_layout_hierarchyValue(d) {
return d.value;
}
function d3_layout_hierarchySort(a, b) {
return b.value - a.value;
}
function d3_layout_hierarchyLinks(nodes) {
return d3.merge(nodes.map(function(parent) {
return (parent.children || []).map(function(child) {
return {
source: parent,
target: child
};
});
}));
}
d3.layout.partition = function() {
var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
function position(node, x, dx, dy) {
var children = node.children;
node.x = x;
node.y = node.depth * dy;
node.dx = dx;
node.dy = dy;
if (children && (n = children.length)) {
var i = -1, n, c, d;
dx = node.value ? dx / node.value : 0;
while (++i < n) {
position(c = children[i], x, d = c.value * dx, dy);
x += d;
}
}
}
function depth(node) {
var children = node.children, d = 0;
if (children && (n = children.length)) {
var i = -1, n;
while (++i < n) d = Math.max(d, depth(children[i]));
}
return 1 + d;
}
function partition(d, i) {
var nodes = hierarchy.call(this, d, i);
position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
return nodes;
}
partition.size = function(x) {
if (!arguments.length) return size;
size = x;
return partition;
};
return d3_layout_hierarchyRebind(partition, hierarchy);
};
d3.layout.pie = function() {
var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = τ, padAngle = 0;
function pie(data) {
var n = data.length, values = data.map(function(d, i) {
return +value.call(pie, d, i);
}), a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle), da = (typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a, p = Math.min(Math.abs(da) / n, +(typeof padAngle === "function" ? padAngle.apply(this, arguments) : padAngle)), pa = p * (da < 0 ? -1 : 1), sum = d3.sum(values), k = sum ? (da - n * pa) / sum : 0, index = d3.range(n), arcs = [], v;
if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
return values[j] - values[i];
} : function(i, j) {
return sort(data[i], data[j]);
});
index.forEach(function(i) {
arcs[i] = {
data: data[i],
value: v = values[i],
startAngle: a,
endAngle: a += v * k + pa,
padAngle: p
};
});
return arcs;
}
pie.value = function(_) {
if (!arguments.length) return value;
value = _;
return pie;
};
pie.sort = function(_) {
if (!arguments.length) return sort;
sort = _;
return pie;
};
pie.startAngle = function(_) {
if (!arguments.length) return startAngle;
startAngle = _;
return pie;
};
pie.endAngle = function(_) {
if (!arguments.length) return endAngle;
endAngle = _;
return pie;
};
pie.padAngle = function(_) {
if (!arguments.length) return padAngle;
padAngle = _;
return pie;
};
return pie;
};
var d3_layout_pieSortByValue = {};
d3.layout.stack = function() {
var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
function stack(data, index) {
if (!(n = data.length)) return data;
var series = data.map(function(d, i) {
return values.call(stack, d, i);
});
var points = series.map(function(d) {
return d.map(function(v, i) {
return [ x.call(stack, v, i), y.call(stack, v, i) ];
});
});
var orders = order.call(stack, points, index);
series = d3.permute(series, orders);
points = d3.permute(points, orders);
var offsets = offset.call(stack, points, index);
var m = series[0].length, n, i, j, o;
for (j = 0; j < m; ++j) {
out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
for (i = 1; i < n; ++i) {
out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
}
}
return data;
}
stack.values = function(x) {
if (!arguments.length) return values;
values = x;
return stack;
};
stack.order = function(x) {
if (!arguments.length) return order;
order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
return stack;
};
stack.offset = function(x) {
if (!arguments.length) return offset;
offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
return stack;
};
stack.x = function(z) {
if (!arguments.length) return x;
x = z;
return stack;
};
stack.y = function(z) {
if (!arguments.length) return y;
y = z;
return stack;
};
stack.out = function(z) {
if (!arguments.length) return out;
out = z;
return stack;
};
return stack;
};
function d3_layout_stackX(d) {
return d.x;
}
function d3_layout_stackY(d) {
return d.y;
}
function d3_layout_stackOut(d, y0, y) {
d.y0 = y0;
d.y = y;
}
var d3_layout_stackOrders = d3.map({
"inside-out": function(data) {
var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {
return max[a] - max[b];
}), top = 0, bottom = 0, tops = [], bottoms = [];
for (i = 0; i < n; ++i) {
j = index[i];
if (top < bottom) {
top += sums[j];
tops.push(j);
} else {
bottom += sums[j];
bottoms.push(j);
}
}
return bottoms.reverse().concat(tops);
},
reverse: function(data) {
return d3.range(data.length).reverse();
},
"default": d3_layout_stackOrderDefault
});
var d3_layout_stackOffsets = d3.map({
silhouette: function(data) {
var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
for (j = 0; j < m; ++j) {
for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
if (o > max) max = o;
sums.push(o);
}
for (j = 0; j < m; ++j) {
y0[j] = (max - sums[j]) / 2;
}
return y0;
},
wiggle: function(data) {
var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
y0[0] = o = o0 = 0;
for (j = 1; j < m; ++j) {
for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
}
s2 += s3 * data[i][j][1];
}
y0[j] = o -= s1 ? s2 / s1 * dx : 0;
if (o < o0) o0 = o;
}
for (j = 0; j < m; ++j) y0[j] -= o0;
return y0;
},
expand: function(data) {
var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
for (j = 0; j < m; ++j) {
for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k;
}
for (j = 0; j < m; ++j) y0[j] = 0;
return y0;
},
zero: d3_layout_stackOffsetZero
});
function d3_layout_stackOrderDefault(data) {
return d3.range(data.length);
}
function d3_layout_stackOffsetZero(data) {
var j = -1, m = data[0].length, y0 = [];
while (++j < m) y0[j] = 0;
return y0;
}
function d3_layout_stackMaxIndex(array) {
var i = 1, j = 0, v = array[0][1], k, n = array.length;
for (;i < n; ++i) {
if ((k = array[i][1]) > v) {
j = i;
v = k;
}
}
return j;
}
function d3_layout_stackReduceSum(d) {
return d.reduce(d3_layout_stackSum, 0);
}
function d3_layout_stackSum(p, d) {
return p + d[1];
}
d3.layout.histogram = function() {
var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
function histogram(data, i) {
var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;
while (++i < m) {
bin = bins[i] = [];
bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
bin.y = 0;
}
if (m > 0) {
i = -1;
while (++i < n) {
x = values[i];
if (x >= range[0] && x <= range[1]) {
bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
bin.y += k;
bin.push(data[i]);
}
}
}
return bins;
}
histogram.value = function(x) {
if (!arguments.length) return valuer;
valuer = x;
return histogram;
};
histogram.range = function(x) {
if (!arguments.length) return ranger;
ranger = d3_functor(x);
return histogram;
};
histogram.bins = function(x) {
if (!arguments.length) return binner;
binner = typeof x === "number" ? function(range) {
return d3_layout_histogramBinFixed(range, x);
} : d3_functor(x);
return histogram;
};
histogram.frequency = function(x) {
if (!arguments.length) return frequency;
frequency = !!x;
return histogram;
};
return histogram;
};
function d3_layout_histogramBinSturges(range, values) {
return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
}
function d3_layout_histogramBinFixed(range, n) {
var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
while (++x <= n) f[x] = m * x + b;
return f;
}
function d3_layout_histogramRange(values) {
return [ d3.min(values), d3.max(values) ];
}
d3.layout.pack = function() {
var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ], radius;
function pack(d, i) {
var nodes = hierarchy.call(this, d, i), root = nodes[0], w = size[0], h = size[1], r = radius == null ? Math.sqrt : typeof radius === "function" ? radius : function() {
return radius;
};
root.x = root.y = 0;
d3_layout_hierarchyVisitAfter(root, function(d) {
d.r = +r(d.value);
});
d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings);
if (padding) {
var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2;
d3_layout_hierarchyVisitAfter(root, function(d) {
d.r += dr;
});
d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings);
d3_layout_hierarchyVisitAfter(root, function(d) {
d.r -= dr;
});
}
d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h));
return nodes;
}
pack.size = function(_) {
if (!arguments.length) return size;
size = _;
return pack;
};
pack.radius = function(_) {
if (!arguments.length) return radius;
radius = _ == null || typeof _ === "function" ? _ : +_;
return pack;
};
pack.padding = function(_) {
if (!arguments.length) return padding;
padding = +_;
return pack;
};
return d3_layout_hierarchyRebind(pack, hierarchy);
};
function d3_layout_packSort(a, b) {
return a.value - b.value;
}
function d3_layout_packInsert(a, b) {
var c = a._pack_next;
a._pack_next = b;
b._pack_prev = a;
b._pack_next = c;
c._pack_prev = b;
}
function d3_layout_packSplice(a, b) {
a._pack_next = b;
b._pack_prev = a;
}
function d3_layout_packIntersects(a, b) {
var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
return .999 * dr * dr > dx * dx + dy * dy;
}
function d3_layout_packSiblings(node) {
if (!(nodes = node.children) || !(n = nodes.length)) return;
var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
function bound(node) {
xMin = Math.min(node.x - node.r, xMin);
xMax = Math.max(node.x + node.r, xMax);
yMin = Math.min(node.y - node.r, yMin);
yMax = Math.max(node.y + node.r, yMax);
}
nodes.forEach(d3_layout_packLink);
a = nodes[0];
a.x = -a.r;
a.y = 0;
bound(a);
if (n > 1) {
b = nodes[1];
b.x = b.r;
b.y = 0;
bound(b);
if (n > 2) {
c = nodes[2];
d3_layout_packPlace(a, b, c);
bound(c);
d3_layout_packInsert(a, c);
a._pack_prev = c;
d3_layout_packInsert(c, b);
b = a._pack_next;
for (i = 3; i < n; i++) {
d3_layout_packPlace(a, b, c = nodes[i]);
var isect = 0, s1 = 1, s2 = 1;
for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
if (d3_layout_packIntersects(j, c)) {
isect = 1;
break;
}
}
if (isect == 1) {
for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
if (d3_layout_packIntersects(k, c)) {
break;
}
}
}
if (isect) {
if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
i--;
} else {
d3_layout_packInsert(a, c);
b = c;
bound(c);
}
}
}
}
var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
for (i = 0; i < n; i++) {
c = nodes[i];
c.x -= cx;
c.y -= cy;
cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
}
node.r = cr;
nodes.forEach(d3_layout_packUnlink);
}
function d3_layout_packLink(node) {
node._pack_next = node._pack_prev = node;
}
function d3_layout_packUnlink(node) {
delete node._pack_next;
delete node._pack_prev;
}
function d3_layout_packTransform(node, x, y, k) {
var children = node.children;
node.x = x += k * node.x;
node.y = y += k * node.y;
node.r *= k;
if (children) {
var i = -1, n = children.length;
while (++i < n) d3_layout_packTransform(children[i], x, y, k);
}
}
function d3_layout_packPlace(a, b, c) {
var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
if (db && (dx || dy)) {
var da = b.r + c.r, dc = dx * dx + dy * dy;
da *= da;
db *= db;
var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
c.x = a.x + x * dx + y * dy;
c.y = a.y + x * dy - y * dx;
} else {
c.x = a.x + db;
c.y = a.y;
}
}
d3.layout.tree = function() {
var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = null;
function tree(d, i) {
var nodes = hierarchy.call(this, d, i), root0 = nodes[0], root1 = wrapTree(root0);
d3_layout_hierarchyVisitAfter(root1, firstWalk), root1.parent.m = -root1.z;
d3_layout_hierarchyVisitBefore(root1, secondWalk);
if (nodeSize) d3_layout_hierarchyVisitBefore(root0, sizeNode); else {
var left = root0, right = root0, bottom = root0;
d3_layout_hierarchyVisitBefore(root0, function(node) {
if (node.x < left.x) left = node;
if (node.x > right.x) right = node;
if (node.depth > bottom.depth) bottom = node;
});
var tx = separation(left, right) / 2 - left.x, kx = size[0] / (right.x + separation(right, left) / 2 + tx), ky = size[1] / (bottom.depth || 1);
d3_layout_hierarchyVisitBefore(root0, function(node) {
node.x = (node.x + tx) * kx;
node.y = node.depth * ky;
});
}
return nodes;
}
function wrapTree(root0) {
var root1 = {
A: null,
children: [ root0 ]
}, queue = [ root1 ], node1;
while ((node1 = queue.pop()) != null) {
for (var children = node1.children, child, i = 0, n = children.length; i < n; ++i) {
queue.push((children[i] = child = {
_: children[i],
parent: node1,
children: (child = children[i].children) && child.slice() || [],
A: null,
a: null,
z: 0,
m: 0,
c: 0,
s: 0,
t: null,
i: i
}).a = child);
}
}
return root1.children[0];
}
function firstWalk(v) {
var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null;
if (children.length) {
d3_layout_treeShift(v);
var midpoint = (children[0].z + children[children.length - 1].z) / 2;
if (w) {
v.z = w.z + separation(v._, w._);
v.m = v.z - midpoint;
} else {
v.z = midpoint;
}
} else if (w) {
v.z = w.z + separation(v._, w._);
}
v.parent.A = apportion(v, w, v.parent.A || siblings[0]);
}
function secondWalk(v) {
v._.x = v.z + v.parent.m;
v.m += v.parent.m;
}
function apportion(v, w, ancestor) {
if (w) {
var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift;
while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
vom = d3_layout_treeLeft(vom);
vop = d3_layout_treeRight(vop);
vop.a = v;
shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);
if (shift > 0) {
d3_layout_treeMove(d3_layout_treeAncestor(vim, v, ancestor), v, shift);
sip += shift;
sop += shift;
}
sim += vim.m;
sip += vip.m;
som += vom.m;
sop += vop.m;
}
if (vim && !d3_layout_treeRight(vop)) {
vop.t = vim;
vop.m += sim - sop;
}
if (vip && !d3_layout_treeLeft(vom)) {
vom.t = vip;
vom.m += sip - som;
ancestor = v;
}
}
return ancestor;
}
function sizeNode(node) {
node.x *= size[0];
node.y = node.depth * size[1];
}
tree.separation = function(x) {
if (!arguments.length) return separation;
separation = x;
return tree;
};
tree.size = function(x) {
if (!arguments.length) return nodeSize ? null : size;
nodeSize = (size = x) == null ? sizeNode : null;
return tree;
};
tree.nodeSize = function(x) {
if (!arguments.length) return nodeSize ? size : null;
nodeSize = (size = x) == null ? null : sizeNode;
return tree;
};
return d3_layout_hierarchyRebind(tree, hierarchy);
};
function d3_layout_treeSeparation(a, b) {
return a.parent == b.parent ? 1 : 2;
}
function d3_layout_treeLeft(v) {
var children = v.children;
return children.length ? children[0] : v.t;
}
function d3_layout_treeRight(v) {
var children = v.children, n;
return (n = children.length) ? children[n - 1] : v.t;
}
function d3_layout_treeMove(wm, wp, shift) {
var change = shift / (wp.i - wm.i);
wp.c -= change;
wp.s += shift;
wm.c += change;
wp.z += shift;
wp.m += shift;
}
function d3_layout_treeShift(v) {
var shift = 0, change = 0, children = v.children, i = children.length, w;
while (--i >= 0) {
w = children[i];
w.z += shift;
w.m += shift;
shift += w.s + (change += w.c);
}
}
function d3_layout_treeAncestor(vim, v, ancestor) {
return vim.a.parent === v.parent ? vim.a : ancestor;
}
d3.layout.cluster = function() {
var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false;
function cluster(d, i) {
var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0;
d3_layout_hierarchyVisitAfter(root, function(node) {
var children = node.children;
if (children && children.length) {
node.x = d3_layout_clusterX(children);
node.y = d3_layout_clusterY(children);
} else {
node.x = previousNode ? x += separation(node, previousNode) : 0;
node.y = 0;
previousNode = node;
}
});
var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
d3_layout_hierarchyVisitAfter(root, nodeSize ? function(node) {
node.x = (node.x - root.x) * size[0];
node.y = (root.y - node.y) * size[1];
} : function(node) {
node.x = (node.x - x0) / (x1 - x0) * size[0];
node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
});
return nodes;
}
cluster.separation = function(x) {
if (!arguments.length) return separation;
separation = x;
return cluster;
};
cluster.size = function(x) {
if (!arguments.length) return nodeSize ? null : size;
nodeSize = (size = x) == null;
return cluster;
};
cluster.nodeSize = function(x) {
if (!arguments.length) return nodeSize ? size : null;
nodeSize = (size = x) != null;
return cluster;
};
return d3_layout_hierarchyRebind(cluster, hierarchy);
};
function d3_layout_clusterY(children) {
return 1 + d3.max(children, function(child) {
return child.y;
});
}
function d3_layout_clusterX(children) {
return children.reduce(function(x, child) {
return x + child.x;
}, 0) / children.length;
}
function d3_layout_clusterLeft(node) {
var children = node.children;
return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
}
function d3_layout_clusterRight(node) {
var children = node.children, n;
return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
}
d3.layout.treemap = function() {
var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5));
function scale(children, k) {
var i = -1, n = children.length, child, area;
while (++i < n) {
area = (child = children[i]).value * (k < 0 ? 0 : k);
child.area = isNaN(area) || area <= 0 ? 0 : area;
}
}
function squarify(node) {
var children = node.children;
if (children && children.length) {
var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n;
scale(remaining, rect.dx * rect.dy / node.value);
row.area = 0;
while ((n = remaining.length) > 0) {
row.push(child = remaining[n - 1]);
row.area += child.area;
if (mode !== "squarify" || (score = worst(row, u)) <= best) {
remaining.pop();
best = score;
} else {
row.area -= row.pop().area;
position(row, u, rect, false);
u = Math.min(rect.dx, rect.dy);
row.length = row.area = 0;
best = Infinity;
}
}
if (row.length) {
position(row, u, rect, true);
row.length = row.area = 0;
}
children.forEach(squarify);
}
}
function stickify(node) {
var children = node.children;
if (children && children.length) {
var rect = pad(node), remaining = children.slice(), child, row = [];
scale(remaining, rect.dx * rect.dy / node.value);
row.area = 0;
while (child = remaining.pop()) {
row.push(child);
row.area += child.area;
if (child.z != null) {
position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
row.length = row.area = 0;
}
}
children.forEach(stickify);
}
}
function worst(row, u) {
var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
while (++i < n) {
if (!(r = row[i].area)) continue;
if (r < rmin) rmin = r;
if (r > rmax) rmax = r;
}
s *= s;
u *= u;
return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
}
function position(row, u, rect, flush) {
var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
if (u == rect.dx) {
if (flush || v > rect.dy) v = rect.dy;
while (++i < n) {
o = row[i];
o.x = x;
o.y = y;
o.dy = v;
x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
}
o.z = true;
o.dx += rect.x + rect.dx - x;
rect.y += v;
rect.dy -= v;
} else {
if (flush || v > rect.dx) v = rect.dx;
while (++i < n) {
o = row[i];
o.x = x;
o.y = y;
o.dx = v;
y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
}
o.z = false;
o.dy += rect.y + rect.dy - y;
rect.x += v;
rect.dx -= v;
}
}
function treemap(d) {
var nodes = stickies || hierarchy(d), root = nodes[0];
root.x = root.y = 0;
if (root.value) root.dx = size[0], root.dy = size[1]; else root.dx = root.dy = 0;
if (stickies) hierarchy.revalue(root);
scale([ root ], root.dx * root.dy / root.value);
(stickies ? stickify : squarify)(root);
if (sticky) stickies = nodes;
return nodes;
}
treemap.size = function(x) {
if (!arguments.length) return size;
size = x;
return treemap;
};
treemap.padding = function(x) {
if (!arguments.length) return padding;
function padFunction(node) {
var p = x.call(treemap, node, node.depth);
return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
}
function padConstant(node) {
return d3_layout_treemapPad(node, x);
}
var type;
pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ],
padConstant) : padConstant;
return treemap;
};
treemap.round = function(x) {
if (!arguments.length) return round != Number;
round = x ? Math.round : Number;
return treemap;
};
treemap.sticky = function(x) {
if (!arguments.length) return sticky;
sticky = x;
stickies = null;
return treemap;
};
treemap.ratio = function(x) {
if (!arguments.length) return ratio;
ratio = x;
return treemap;
};
treemap.mode = function(x) {
if (!arguments.length) return mode;
mode = x + "";
return treemap;
};
return d3_layout_hierarchyRebind(treemap, hierarchy);
};
function d3_layout_treemapPadNull(node) {
return {
x: node.x,
y: node.y,
dx: node.dx,
dy: node.dy
};
}
function d3_layout_treemapPad(node, padding) {
var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];
if (dx < 0) {
x += dx / 2;
dx = 0;
}
if (dy < 0) {
y += dy / 2;
dy = 0;
}
return {
x: x,
y: y,
dx: dx,
dy: dy
};
}
d3.random = {
normal: function(µ, σ) {
var n = arguments.length;
if (n < 2) σ = 1;
if (n < 1) µ = 0;
return function() {
var x, y, r;
do {
x = Math.random() * 2 - 1;
y = Math.random() * 2 - 1;
r = x * x + y * y;
} while (!r || r > 1);
return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
};
},
logNormal: function() {
var random = d3.random.normal.apply(d3, arguments);
return function() {
return Math.exp(random());
};
},
bates: function(m) {
var random = d3.random.irwinHall(m);
return function() {
return random() / m;
};
},
irwinHall: function(m) {
return function() {
for (var s = 0, j = 0; j < m; j++) s += Math.random();
return s;
};
}
};
d3.scale = {};
function d3_scaleExtent(domain) {
var start = domain[0], stop = domain[domain.length - 1];
return start < stop ? [ start, stop ] : [ stop, start ];
}
function d3_scaleRange(scale) {
return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
}
function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
return function(x) {
return i(u(x));
};
}
function d3_scale_nice(domain, nice) {
var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
if (x1 < x0) {
dx = i0, i0 = i1, i1 = dx;
dx = x0, x0 = x1, x1 = dx;
}
domain[i0] = nice.floor(x0);
domain[i1] = nice.ceil(x1);
return domain;
}
function d3_scale_niceStep(step) {
return step ? {
floor: function(x) {
return Math.floor(x / step) * step;
},
ceil: function(x) {
return Math.ceil(x / step) * step;
}
} : d3_scale_niceIdentity;
}
var d3_scale_niceIdentity = {
floor: d3_identity,
ceil: d3_identity
};
function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
if (domain[k] < domain[0]) {
domain = domain.slice().reverse();
range = range.slice().reverse();
}
while (++j <= k) {
u.push(uninterpolate(domain[j - 1], domain[j]));
i.push(interpolate(range[j - 1], range[j]));
}
return function(x) {
var j = d3.bisect(domain, x, 1, k) - 1;
return i[j](u[j](x));
};
}
d3.scale.linear = function() {
return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false);
};
function d3_scale_linear(domain, range, interpolate, clamp) {
var output, input;
function rescale() {
var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
output = linear(domain, range, uninterpolate, interpolate);
input = linear(range, domain, uninterpolate, d3_interpolate);
return scale;
}
function scale(x) {
return output(x);
}
scale.invert = function(y) {
return input(y);
};
scale.domain = function(x) {
if (!arguments.length) return domain;
domain = x.map(Number);
return rescale();
};
scale.range = function(x) {
if (!arguments.length) return range;
range = x;
return rescale();
};
scale.rangeRound = function(x) {
return scale.range(x).interpolate(d3_interpolateRound);
};
scale.clamp = function(x) {
if (!arguments.length) return clamp;
clamp = x;
return rescale();
};
scale.interpolate = function(x) {
if (!arguments.length) return interpolate;
interpolate = x;
return rescale();
};
scale.ticks = function(m) {
return d3_scale_linearTicks(domain, m);
};
scale.tickFormat = function(m, format) {
return d3_scale_linearTickFormat(domain, m, format);
};
scale.nice = function(m) {
d3_scale_linearNice(domain, m);
return rescale();
};
scale.copy = function() {
return d3_scale_linear(domain, range, interpolate, clamp);
};
return rescale();
}
function d3_scale_linearRebind(scale, linear) {
return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
}
function d3_scale_linearNice(domain, m) {
d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
return domain;
}
function d3_scale_linearTickRange(domain, m) {
if (m == null) m = 10;
var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;
if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
extent[0] = Math.ceil(extent[0] / step) * step;
extent[1] = Math.floor(extent[1] / step) * step + step * .5;
extent[2] = step;
return extent;
}
function d3_scale_linearTicks(domain, m) {
return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
}
function d3_scale_linearTickFormat(domain, m, format) {
var range = d3_scale_linearTickRange(domain, m);
if (format) {
var match = d3_format_re.exec(format);
match.shift();
if (match[8] === "s") {
var prefix = d3.formatPrefix(Math.max(abs(range[0]), abs(range[1])));
if (!match[7]) match[7] = "." + d3_scale_linearPrecision(prefix.scale(range[2]));
match[8] = "f";
format = d3.format(match.join(""));
return function(d) {
return format(prefix.scale(d)) + prefix.symbol;
};
}
if (!match[7]) match[7] = "." + d3_scale_linearFormatPrecision(match[8], range);
format = match.join("");
} else {
format = ",." + d3_scale_linearPrecision(range[2]) + "f";
}
return d3.format(format);
}
var d3_scale_linearFormatSignificant = {
s: 1,
g: 1,
p: 1,
r: 1,
e: 1
};
function d3_scale_linearPrecision(value) {
return -Math.floor(Math.log(value) / Math.LN10 + .01);
}
function d3_scale_linearFormatPrecision(type, range) {
var p = d3_scale_linearPrecision(range[2]);
return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(abs(range[0]), abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2;
}
d3.scale.log = function() {
return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]);
};
function d3_scale_log(linear, base, positive, domain) {
function log(x) {
return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base);
}
function pow(x) {
return positive ? Math.pow(base, x) : -Math.pow(base, -x);
}
function scale(x) {
return linear(log(x));
}
scale.invert = function(x) {
return pow(linear.invert(x));
};
scale.domain = function(x) {
if (!arguments.length) return domain;
positive = x[0] >= 0;
linear.domain((domain = x.map(Number)).map(log));
return scale;
};
scale.base = function(_) {
if (!arguments.length) return base;
base = +_;
linear.domain(domain.map(log));
return scale;
};
scale.nice = function() {
var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative);
linear.domain(niced);
domain = niced.map(pow);
return scale;
};
scale.ticks = function() {
var extent = d3_scaleExtent(domain), ticks = [], u = extent[0], v = extent[1], i = Math.floor(log(u)), j = Math.ceil(log(v)), n = base % 1 ? 2 : base;
if (isFinite(j - i)) {
if (positive) {
for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k);
ticks.push(pow(i));
} else {
ticks.push(pow(i));
for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k);
}
for (i = 0; ticks[i] < u; i++) {}
for (j = ticks.length; ticks[j - 1] > v; j--) {}
ticks = ticks.slice(i, j);
}
return ticks;
};
scale.tickFormat = function(n, format) {
if (!arguments.length) return d3_scale_logFormat;
if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== "function") format = d3.format(format);
var k = Math.max(1, base * n / scale.ticks().length);
return function(d) {
var i = d / pow(Math.round(log(d)));
if (i * base < base - .5) i *= base;
return i <= k ? format(d) : "";
};
};
scale.copy = function() {
return d3_scale_log(linear.copy(), base, positive, domain);
};
return d3_scale_linearRebind(scale, linear);
}
var d3_scale_logFormat = d3.format(".0e"), d3_scale_logNiceNegative = {
floor: function(x) {
return -Math.ceil(-x);
},
ceil: function(x) {
return -Math.floor(-x);
}
};
d3.scale.pow = function() {
return d3_scale_pow(d3.scale.linear(), 1, [ 0, 1 ]);
};
function d3_scale_pow(linear, exponent, domain) {
var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
function scale(x) {
return linear(powp(x));
}
scale.invert = function(x) {
return powb(linear.invert(x));
};
scale.domain = function(x) {
if (!arguments.length) return domain;
linear.domain((domain = x.map(Number)).map(powp));
return scale;
};
scale.ticks = function(m) {
return d3_scale_linearTicks(domain, m);
};
scale.tickFormat = function(m, format) {
return d3_scale_linearTickFormat(domain, m, format);
};
scale.nice = function(m) {
return scale.domain(d3_scale_linearNice(domain, m));
};
scale.exponent = function(x) {
if (!arguments.length) return exponent;
powp = d3_scale_powPow(exponent = x);
powb = d3_scale_powPow(1 / exponent);
linear.domain(domain.map(powp));
return scale;
};
scale.copy = function() {
return d3_scale_pow(linear.copy(), exponent, domain);
};
return d3_scale_linearRebind(scale, linear);
}
function d3_scale_powPow(e) {
return function(x) {
return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
};
}
d3.scale.sqrt = function() {
return d3.scale.pow().exponent(.5);
};
d3.scale.ordinal = function() {
return d3_scale_ordinal([], {
t: "range",
a: [ [] ]
});
};
function d3_scale_ordinal(domain, ranger) {
var index, range, rangeBand;
function scale(x) {
return range[((index.get(x) || (ranger.t === "range" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length];
}
function steps(start, step) {
return d3.range(domain.length).map(function(i) {
return start + step * i;
});
}
scale.domain = function(x) {
if (!arguments.length) return domain;
domain = [];
index = new d3_Map();
var i = -1, n = x.length, xi;
while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
return scale[ranger.t].apply(scale, ranger.a);
};
scale.range = function(x) {
if (!arguments.length) return range;
range = x;
rangeBand = 0;
ranger = {
t: "range",
a: arguments
};
return scale;
};
scale.rangePoints = function(x, padding) {
if (arguments.length < 2) padding = 0;
var start = x[0], stop = x[1], step = domain.length < 2 ? (start = (start + stop) / 2,
0) : (stop - start) / (domain.length - 1 + padding);
range = steps(start + step * padding / 2, step);
rangeBand = 0;
ranger = {
t: "rangePoints",
a: arguments
};
return scale;
};
scale.rangeRoundPoints = function(x, padding) {
if (arguments.length < 2) padding = 0;
var start = x[0], stop = x[1], step = domain.length < 2 ? (start = stop = Math.round((start + stop) / 2),
0) : (stop - start) / (domain.length - 1 + padding) | 0;
range = steps(start + Math.round(step * padding / 2 + (stop - start - (domain.length - 1 + padding) * step) / 2), step);
rangeBand = 0;
ranger = {
t: "rangeRoundPoints",
a: arguments
};
return scale;
};
scale.rangeBands = function(x, padding, outerPadding) {
if (arguments.length < 2) padding = 0;
if (arguments.length < 3) outerPadding = padding;
var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
range = steps(start + step * outerPadding, step);
if (reverse) range.reverse();
rangeBand = step * (1 - padding);
ranger = {
t: "rangeBands",
a: arguments
};
return scale;
};
scale.rangeRoundBands = function(x, padding, outerPadding) {
if (arguments.length < 2) padding = 0;
if (arguments.length < 3) outerPadding = padding;
var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding));
range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step);
if (reverse) range.reverse();
rangeBand = Math.round(step * (1 - padding));
ranger = {
t: "rangeRoundBands",
a: arguments
};
return scale;
};
scale.rangeBand = function() {
return rangeBand;
};
scale.rangeExtent = function() {
return d3_scaleExtent(ranger.a[0]);
};
scale.copy = function() {
return d3_scale_ordinal(domain, ranger);
};
return scale.domain(domain);
}
d3.scale.category10 = function() {
return d3.scale.ordinal().range(d3_category10);
};
d3.scale.category20 = function() {
return d3.scale.ordinal().range(d3_category20);
};
d3.scale.category20b = function() {
return d3.scale.ordinal().range(d3_category20b);
};
d3.scale.category20c = function() {
return d3.scale.ordinal().range(d3_category20c);
};
var d3_category10 = [ 2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175 ].map(d3_rgbString);
var d3_category20 = [ 2062260, 11454440, 16744206, 16759672, 2924588, 10018698, 14034728, 16750742, 9725885, 12955861, 9197131, 12885140, 14907330, 16234194, 8355711, 13092807, 12369186, 14408589, 1556175, 10410725 ].map(d3_rgbString);
var d3_category20b = [ 3750777, 5395619, 7040719, 10264286, 6519097, 9216594, 11915115, 13556636, 9202993, 12426809, 15186514, 15190932, 8666169, 11356490, 14049643, 15177372, 8077683, 10834324, 13528509, 14589654 ].map(d3_rgbString);
var d3_category20c = [ 3244733, 7057110, 10406625, 13032431, 15095053, 16616764, 16625259, 16634018, 3253076, 7652470, 10607003, 13101504, 7695281, 10394312, 12369372, 14342891, 6513507, 9868950, 12434877, 14277081 ].map(d3_rgbString);
d3.scale.quantile = function() {
return d3_scale_quantile([], []);
};
function d3_scale_quantile(domain, range) {
var thresholds;
function rescale() {
var k = 0, q = range.length;
thresholds = [];
while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
return scale;
}
function scale(x) {
if (!isNaN(x = +x)) return range[d3.bisect(thresholds, x)];
}
scale.domain = function(x) {
if (!arguments.length) return domain;
domain = x.map(d3_number).filter(d3_numeric).sort(d3_ascending);
return rescale();
};
scale.range = function(x) {
if (!arguments.length) return range;
range = x;
return rescale();
};
scale.quantiles = function() {
return thresholds;
};
scale.invertExtent = function(y) {
y = range.indexOf(y);
return y < 0 ? [ NaN, NaN ] : [ y > 0 ? thresholds[y - 1] : domain[0], y < thresholds.length ? thresholds[y] : domain[domain.length - 1] ];
};
scale.copy = function() {
return d3_scale_quantile(domain, range);
};
return rescale();
}
d3.scale.quantize = function() {
return d3_scale_quantize(0, 1, [ 0, 1 ]);
};
function d3_scale_quantize(x0, x1, range) {
var kx, i;
function scale(x) {
return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
}
function rescale() {
kx = range.length / (x1 - x0);
i = range.length - 1;
return scale;
}
scale.domain = function(x) {
if (!arguments.length) return [ x0, x1 ];
x0 = +x[0];
x1 = +x[x.length - 1];
return rescale();
};
scale.range = function(x) {
if (!arguments.length) return range;
range = x;
return rescale();
};
scale.invertExtent = function(y) {
y = range.indexOf(y);
y = y < 0 ? NaN : y / kx + x0;
return [ y, y + 1 / kx ];
};
scale.copy = function() {
return d3_scale_quantize(x0, x1, range);
};
return rescale();
}
d3.scale.threshold = function() {
return d3_scale_threshold([ .5 ], [ 0, 1 ]);
};
function d3_scale_threshold(domain, range) {
function scale(x) {
if (x <= x) return range[d3.bisect(domain, x)];
}
scale.domain = function(_) {
if (!arguments.length) return domain;
domain = _;
return scale;
};
scale.range = function(_) {
if (!arguments.length) return range;
range = _;
return scale;
};
scale.invertExtent = function(y) {
y = range.indexOf(y);
return [ domain[y - 1], domain[y] ];
};
scale.copy = function() {
return d3_scale_threshold(domain, range);
};
return scale;
}
d3.scale.identity = function() {
return d3_scale_identity([ 0, 1 ]);
};
function d3_scale_identity(domain) {
function identity(x) {
return +x;
}
identity.invert = identity;
identity.domain = identity.range = function(x) {
if (!arguments.length) return domain;
domain = x.map(identity);
return identity;
};
identity.ticks = function(m) {
return d3_scale_linearTicks(domain, m);
};
identity.tickFormat = function(m, format) {
return d3_scale_linearTickFormat(domain, m, format);
};
identity.copy = function() {
return d3_scale_identity(domain);
};
return identity;
}
d3.svg = {};
function d3_zero() {
return 0;
}
d3.svg.arc = function() {
var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, cornerRadius = d3_zero, padRadius = d3_svg_arcAuto, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle, padAngle = d3_svg_arcPadAngle;
function arc() {
var r0 = Math.max(0, +innerRadius.apply(this, arguments)), r1 = Math.max(0, +outerRadius.apply(this, arguments)), a0 = startAngle.apply(this, arguments) - halfπ, a1 = endAngle.apply(this, arguments) - halfπ, da = Math.abs(a1 - a0), cw = a0 > a1 ? 0 : 1;
if (r1 < r0) rc = r1, r1 = r0, r0 = rc;
if (da >= τε) return circleSegment(r1, cw) + (r0 ? circleSegment(r0, 1 - cw) : "") + "Z";
var rc, cr, rp, ap, p0 = 0, p1 = 0, x0, y0, x1, y1, x2, y2, x3, y3, path = [];
if (ap = (+padAngle.apply(this, arguments) || 0) / 2) {
rp = padRadius === d3_svg_arcAuto ? Math.sqrt(r0 * r0 + r1 * r1) : +padRadius.apply(this, arguments);
if (!cw) p1 *= -1;
if (r1) p1 = d3_asin(rp / r1 * Math.sin(ap));
if (r0) p0 = d3_asin(rp / r0 * Math.sin(ap));
}
if (r1) {
x0 = r1 * Math.cos(a0 + p1);
y0 = r1 * Math.sin(a0 + p1);
x1 = r1 * Math.cos(a1 - p1);
y1 = r1 * Math.sin(a1 - p1);
var l1 = Math.abs(a1 - a0 - 2 * p1) <= π ? 0 : 1;
if (p1 && d3_svg_arcSweep(x0, y0, x1, y1) === cw ^ l1) {
var h1 = (a0 + a1) / 2;
x0 = r1 * Math.cos(h1);
y0 = r1 * Math.sin(h1);
x1 = y1 = null;
}
} else {
x0 = y0 = 0;
}
if (r0) {
x2 = r0 * Math.cos(a1 - p0);
y2 = r0 * Math.sin(a1 - p0);
x3 = r0 * Math.cos(a0 + p0);
y3 = r0 * Math.sin(a0 + p0);
var l0 = Math.abs(a0 - a1 + 2 * p0) <= π ? 0 : 1;
if (p0 && d3_svg_arcSweep(x2, y2, x3, y3) === 1 - cw ^ l0) {
var h0 = (a0 + a1) / 2;
x2 = r0 * Math.cos(h0);
y2 = r0 * Math.sin(h0);
x3 = y3 = null;
}
} else {
x2 = y2 = 0;
}
if (da > ε && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) {
cr = r0 < r1 ^ cw ? 0 : 1;
var rc1 = rc, rc0 = rc;
if (da < π) {
var oc = x3 == null ? [ x2, y2 ] : x1 == null ? [ x0, y0 ] : d3_geom_polygonIntersect([ x0, y0 ], [ x3, y3 ], [ x1, y1 ], [ x2, y2 ]), ax = x0 - oc[0], ay = y0 - oc[1], bx = x1 - oc[0], by = y1 - oc[1], kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
rc0 = Math.min(rc, (r0 - lc) / (kc - 1));
rc1 = Math.min(rc, (r1 - lc) / (kc + 1));
}
if (x1 != null) {
var t30 = d3_svg_arcCornerTangents(x3 == null ? [ x2, y2 ] : [ x3, y3 ], [ x0, y0 ], r1, rc1, cw), t12 = d3_svg_arcCornerTangents([ x1, y1 ], [ x2, y2 ], r1, rc1, cw);
if (rc === rc1) {
path.push("M", t30[0], "A", rc1, ",", rc1, " 0 0,", cr, " ", t30[1], "A", r1, ",", r1, " 0 ", 1 - cw ^ d3_svg_arcSweep(t30[1][0], t30[1][1], t12[1][0], t12[1][1]), ",", cw, " ", t12[1], "A", rc1, ",", rc1, " 0 0,", cr, " ", t12[0]);
} else {
path.push("M", t30[0], "A", rc1, ",", rc1, " 0 1,", cr, " ", t12[0]);
}
} else {
path.push("M", x0, ",", y0);
}
if (x3 != null) {
var t03 = d3_svg_arcCornerTangents([ x0, y0 ], [ x3, y3 ], r0, -rc0, cw), t21 = d3_svg_arcCornerTangents([ x2, y2 ], x1 == null ? [ x0, y0 ] : [ x1, y1 ], r0, -rc0, cw);
if (rc === rc0) {
path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t21[1], "A", r0, ",", r0, " 0 ", cw ^ d3_svg_arcSweep(t21[1][0], t21[1][1], t03[1][0], t03[1][1]), ",", 1 - cw, " ", t03[1], "A", rc0, ",", rc0, " 0 0,", cr, " ", t03[0]);
} else {
path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t03[0]);
}
} else {
path.push("L", x2, ",", y2);
}
} else {
path.push("M", x0, ",", y0);
if (x1 != null) path.push("A", r1, ",", r1, " 0 ", l1, ",", cw, " ", x1, ",", y1);
path.push("L", x2, ",", y2);
if (x3 != null) path.push("A", r0, ",", r0, " 0 ", l0, ",", 1 - cw, " ", x3, ",", y3);
}
path.push("Z");
return path.join("");
}
function circleSegment(r1, cw) {
return "M0," + r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + -r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + r1;
}
arc.innerRadius = function(v) {
if (!arguments.length) return innerRadius;
innerRadius = d3_functor(v);
return arc;
};
arc.outerRadius = function(v) {
if (!arguments.length) return outerRadius;
outerRadius = d3_functor(v);
return arc;
};
arc.cornerRadius = function(v) {
if (!arguments.length) return cornerRadius;
cornerRadius = d3_functor(v);
return arc;
};
arc.padRadius = function(v) {
if (!arguments.length) return padRadius;
padRadius = v == d3_svg_arcAuto ? d3_svg_arcAuto : d3_functor(v);
return arc;
};
arc.startAngle = function(v) {
if (!arguments.length) return startAngle;
startAngle = d3_functor(v);
return arc;
};
arc.endAngle = function(v) {
if (!arguments.length) return endAngle;
endAngle = d3_functor(v);
return arc;
};
arc.padAngle = function(v) {
if (!arguments.length) return padAngle;
padAngle = d3_functor(v);
return arc;
};
arc.centroid = function() {
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - halfπ;
return [ Math.cos(a) * r, Math.sin(a) * r ];
};
return arc;
};
var d3_svg_arcAuto = "auto";
function d3_svg_arcInnerRadius(d) {
return d.innerRadius;
}
function d3_svg_arcOuterRadius(d) {
return d.outerRadius;
}
function d3_svg_arcStartAngle(d) {
return d.startAngle;
}
function d3_svg_arcEndAngle(d) {
return d.endAngle;
}
function d3_svg_arcPadAngle(d) {
return d && d.padAngle;
}
function d3_svg_arcSweep(x0, y0, x1, y1) {
return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1;
}
function d3_svg_arcCornerTangents(p0, p1, r1, rc, cw) {
var x01 = p0[0] - p1[0], y01 = p0[1] - p1[1], lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x1 = p0[0] + ox, y1 = p0[1] + oy, x2 = p1[0] + ox, y2 = p1[1] + oy, x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2, dx = x2 - x1, dy = y2 - y1, d2 = dx * dx + dy * dy, r = r1 - rc, D = x1 * y2 - x2 * y1, d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x3, dy0 = cy0 - y3, dx1 = cx1 - x3, dy1 = cy1 - y3;
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
return [ [ cx0 - ox, cy0 - oy ], [ cx0 * r1 / r, cy0 * r1 / r ] ];
}
function d3_svg_line(projection) {
var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
function line(data) {
var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
function segment() {
segments.push("M", interpolate(projection(points), tension));
}
while (++i < n) {
if (defined.call(this, d = data[i], i)) {
points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
} else if (points.length) {
segment();
points = [];
}
}
if (points.length) segment();
return segments.length ? segments.join("") : null;
}
line.x = function(_) {
if (!arguments.length) return x;
x = _;
return line;
};
line.y = function(_) {
if (!arguments.length) return y;
y = _;
return line;
};
line.defined = function(_) {
if (!arguments.length) return defined;
defined = _;
return line;
};
line.interpolate = function(_) {
if (!arguments.length) return interpolateKey;
if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
return line;
};
line.tension = function(_) {
if (!arguments.length) return tension;
tension = _;
return line;
};
return line;
}
d3.svg.line = function() {
return d3_svg_line(d3_identity);
};
var d3_svg_lineInterpolators = d3.map({
linear: d3_svg_lineLinear,
"linear-closed": d3_svg_lineLinearClosed,
step: d3_svg_lineStep,
"step-before": d3_svg_lineStepBefore,
"step-after": d3_svg_lineStepAfter,
basis: d3_svg_lineBasis,
"basis-open": d3_svg_lineBasisOpen,
"basis-closed": d3_svg_lineBasisClosed,
bundle: d3_svg_lineBundle,
cardinal: d3_svg_lineCardinal,
"cardinal-open": d3_svg_lineCardinalOpen,
"cardinal-closed": d3_svg_lineCardinalClosed,
monotone: d3_svg_lineMonotone
});
d3_svg_lineInterpolators.forEach(function(key, value) {
value.key = key;
value.closed = /-closed$/.test(key);
});
function d3_svg_lineLinear(points) {
return points.length > 1 ? points.join("L") : points + "Z";
}
function d3_svg_lineLinearClosed(points) {
return points.join("L") + "Z";
}
function d3_svg_lineStep(points) {
var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
while (++i < n) path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]);
if (n > 1) path.push("H", p[0]);
return path.join("");
}
function d3_svg_lineStepBefore(points) {
var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
return path.join("");
}
function d3_svg_lineStepAfter(points) {
var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
return path.join("");
}
function d3_svg_lineCardinalOpen(points, tension) {
return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, -1), d3_svg_lineCardinalTangents(points, tension));
}
function d3_svg_lineCardinalClosed(points, tension) {
return points.length < 3 ? d3_svg_lineLinearClosed(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
}
function d3_svg_lineCardinal(points, tension) {
return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
}
function d3_svg_lineHermite(points, tangents) {
if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
return d3_svg_lineLinear(points);
}
var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
if (quad) {
path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
p0 = points[1];
pi = 2;
}
if (tangents.length > 1) {
t = tangents[1];
p = points[pi];
pi++;
path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
for (var i = 2; i < tangents.length; i++, pi++) {
p = points[pi];
t = tangents[i];
path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
}
}
if (quad) {
var lp = points[pi];
path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
}
return path;
}
function d3_svg_lineCardinalTangents(points, tension) {
var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
while (++i < n) {
p0 = p1;
p1 = p2;
p2 = points[i];
tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
}
return tangents;
}
function d3_svg_lineBasis(points) {
if (points.length < 3) return d3_svg_lineLinear(points);
var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0, "L", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
points.push(points[n - 1]);
while (++i <= n) {
pi = points[i];
px.shift();
px.push(pi[0]);
py.shift();
py.push(pi[1]);
d3_svg_lineBasisBezier(path, px, py);
}
points.pop();
path.push("L", pi);
return path.join("");
}
function d3_svg_lineBasisOpen(points) {
if (points.length < 4) return d3_svg_lineLinear(points);
var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
while (++i < 3) {
pi = points[i];
px.push(pi[0]);
py.push(pi[1]);
}
path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
--i;
while (++i < n) {
pi = points[i];
px.shift();
px.push(pi[0]);
py.shift();
py.push(pi[1]);
d3_svg_lineBasisBezier(path, px, py);
}
return path.join("");
}
function d3_svg_lineBasisClosed(points) {
var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
while (++i < 4) {
pi = points[i % n];
px.push(pi[0]);
py.push(pi[1]);
}
path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
--i;
while (++i < m) {
pi = points[i % n];
px.shift();
px.push(pi[0]);
py.shift();
py.push(pi[1]);
d3_svg_lineBasisBezier(path, px, py);
}
return path.join("");
}
function d3_svg_lineBundle(points, tension) {
var n = points.length - 1;
if (n) {
var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
while (++i <= n) {
p = points[i];
t = i / n;
p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
}
}
return d3_svg_lineBasis(points);
}
function d3_svg_lineDot4(a, b) {
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
}
var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
function d3_svg_lineBasisBezier(path, x, y) {
path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
}
function d3_svg_lineSlope(p0, p1) {
return (p1[1] - p0[1]) / (p1[0] - p0[0]);
}
function d3_svg_lineFiniteDifferences(points) {
var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
while (++i < j) {
m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
}
m[i] = d;
return m;
}
function d3_svg_lineMonotoneTangents(points) {
var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
while (++i < j) {
d = d3_svg_lineSlope(points[i], points[i + 1]);
if (abs(d) < ε) {
m[i] = m[i + 1] = 0;
} else {
a = m[i] / d;
b = m[i + 1] / d;
s = a * a + b * b;
if (s > 9) {
s = d * 3 / Math.sqrt(s);
m[i] = s * a;
m[i + 1] = s * b;
}
}
}
i = -1;
while (++i <= j) {
s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
tangents.push([ s || 0, m[i] * s || 0 ]);
}
return tangents;
}
function d3_svg_lineMonotone(points) {
return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
}
d3.svg.line.radial = function() {
var line = d3_svg_line(d3_svg_lineRadial);
line.radius = line.x, delete line.x;
line.angle = line.y, delete line.y;
return line;
};
function d3_svg_lineRadial(points) {
var point, i = -1, n = points.length, r, a;
while (++i < n) {
point = points[i];
r = point[0];
a = point[1] - halfπ;
point[0] = r * Math.cos(a);
point[1] = r * Math.sin(a);
}
return points;
}
function d3_svg_area(projection) {
var x0 = d3_geom_pointX, x1 = d3_geom_pointX, y0 = 0, y1 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
function area(data) {
var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
return x;
} : d3_functor(x1), fy1 = y0 === y1 ? function() {
return y;
} : d3_functor(y1), x, y;
function segment() {
segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
}
while (++i < n) {
if (defined.call(this, d = data[i], i)) {
points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
} else if (points0.length) {
segment();
points0 = [];
points1 = [];
}
}
if (points0.length) segment();
return segments.length ? segments.join("") : null;
}
area.x = function(_) {
if (!arguments.length) return x1;
x0 = x1 = _;
return area;
};
area.x0 = function(_) {
if (!arguments.length) return x0;
x0 = _;
return area;
};
area.x1 = function(_) {
if (!arguments.length) return x1;
x1 = _;
return area;
};
area.y = function(_) {
if (!arguments.length) return y1;
y0 = y1 = _;
return area;
};
area.y0 = function(_) {
if (!arguments.length) return y0;
y0 = _;
return area;
};
area.y1 = function(_) {
if (!arguments.length) return y1;
y1 = _;
return area;
};
area.defined = function(_) {
if (!arguments.length) return defined;
defined = _;
return area;
};
area.interpolate = function(_) {
if (!arguments.length) return interpolateKey;
if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
interpolateReverse = interpolate.reverse || interpolate;
L = interpolate.closed ? "M" : "L";
return area;
};
area.tension = function(_) {
if (!arguments.length) return tension;
tension = _;
return area;
};
return area;
}
d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
d3.svg.area = function() {
return d3_svg_area(d3_identity);
};
d3.svg.area.radial = function() {
var area = d3_svg_area(d3_svg_lineRadial);
area.radius = area.x, delete area.x;
area.innerRadius = area.x0, delete area.x0;
area.outerRadius = area.x1, delete area.x1;
area.angle = area.y, delete area.y;
area.startAngle = area.y0, delete area.y0;
area.endAngle = area.y1, delete area.y1;
return area;
};
d3.svg.chord = function() {
var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
function chord(d, i) {
var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";
}
function subgroup(self, f, d, i) {
var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) - halfπ, a1 = endAngle.call(self, subgroup, i) - halfπ;
return {
r: r,
a0: a0,
a1: a1,
p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
};
}
function equals(a, b) {
return a.a0 == b.a0 && a.a1 == b.a1;
}
function arc(r, p, a) {
return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p;
}
function curve(r0, p0, r1, p1) {
return "Q 0,0 " + p1;
}
chord.radius = function(v) {
if (!arguments.length) return radius;
radius = d3_functor(v);
return chord;
};
chord.source = function(v) {
if (!arguments.length) return source;
source = d3_functor(v);
return chord;
};
chord.target = function(v) {
if (!arguments.length) return target;
target = d3_functor(v);
return chord;
};
chord.startAngle = function(v) {
if (!arguments.length) return startAngle;
startAngle = d3_functor(v);
return chord;
};
chord.endAngle = function(v) {
if (!arguments.length) return endAngle;
endAngle = d3_functor(v);
return chord;
};
return chord;
};
function d3_svg_chordRadius(d) {
return d.radius;
}
d3.svg.diagonal = function() {
var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection;
function diagonal(d, i) {
var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
x: p0.x,
y: m
}, {
x: p3.x,
y: m
}, p3 ];
p = p.map(projection);
return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
}
diagonal.source = function(x) {
if (!arguments.length) return source;
source = d3_functor(x);
return diagonal;
};
diagonal.target = function(x) {
if (!arguments.length) return target;
target = d3_functor(x);
return diagonal;
};
diagonal.projection = function(x) {
if (!arguments.length) return projection;
projection = x;
return diagonal;
};
return diagonal;
};
function d3_svg_diagonalProjection(d) {
return [ d.x, d.y ];
}
d3.svg.diagonal.radial = function() {
var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
diagonal.projection = function(x) {
return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
};
return diagonal;
};
function d3_svg_diagonalRadialProjection(projection) {
return function() {
var d = projection.apply(this, arguments), r = d[0], a = d[1] - halfπ;
return [ r * Math.cos(a), r * Math.sin(a) ];
};
}
d3.svg.symbol = function() {
var type = d3_svg_symbolType, size = d3_svg_symbolSize;
function symbol(d, i) {
return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
}
symbol.type = function(x) {
if (!arguments.length) return type;
type = d3_functor(x);
return symbol;
};
symbol.size = function(x) {
if (!arguments.length) return size;
size = d3_functor(x);
return symbol;
};
return symbol;
};
function d3_svg_symbolSize() {
return 64;
}
function d3_svg_symbolType() {
return "circle";
}
function d3_svg_symbolCircle(size) {
var r = Math.sqrt(size / π);
return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
}
var d3_svg_symbols = d3.map({
circle: d3_svg_symbolCircle,
cross: function(size) {
var r = Math.sqrt(size / 5) / 2;
return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";
},
diamond: function(size) {
var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
},
square: function(size) {
var r = Math.sqrt(size) / 2;
return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
},
"triangle-down": function(size) {
var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
},
"triangle-up": function(size) {
var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
}
});
d3.svg.symbolTypes = d3_svg_symbols.keys();
var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians);
d3_selectionPrototype.transition = function(name) {
var id = d3_transitionInheritId || ++d3_transitionId, ns = d3_transitionNamespace(name), subgroups = [], subgroup, node, transition = d3_transitionInherit || {
time: Date.now(),
ease: d3_ease_cubicInOut,
delay: 0,
duration: 250
};
for (var j = -1, m = this.length; ++j < m; ) {
subgroups.push(subgroup = []);
for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) d3_transitionNode(node, i, ns, id, transition);
subgroup.push(node);
}
}
return d3_transition(subgroups, ns, id);
};
d3_selectionPrototype.interrupt = function(name) {
return this.each(name == null ? d3_selection_interrupt : d3_selection_interruptNS(d3_transitionNamespace(name)));
};
var d3_selection_interrupt = d3_selection_interruptNS(d3_transitionNamespace());
function d3_selection_interruptNS(ns) {
return function() {
var lock, activeId, active;
if ((lock = this[ns]) && (active = lock[activeId = lock.active])) {
active.timer.c = null;
active.timer.t = NaN;
if (--lock.count) delete lock[activeId]; else delete this[ns];
lock.active += .5;
active.event && active.event.interrupt.call(this, this.__data__, active.index);
}
};
}
function d3_transition(groups, ns, id) {
d3_subclass(groups, d3_transitionPrototype);
groups.namespace = ns;
groups.id = id;
return groups;
}
var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit;
d3_transitionPrototype.call = d3_selectionPrototype.call;
d3_transitionPrototype.empty = d3_selectionPrototype.empty;
d3_transitionPrototype.node = d3_selectionPrototype.node;
d3_transitionPrototype.size = d3_selectionPrototype.size;
d3.transition = function(selection, name) {
return selection && selection.transition ? d3_transitionInheritId ? selection.transition(name) : selection : d3.selection().transition(selection);
};
d3.transition.prototype = d3_transitionPrototype;
d3_transitionPrototype.select = function(selector) {
var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnode, node;
selector = d3_selection_selector(selector);
for (var j = -1, m = this.length; ++j < m; ) {
subgroups.push(subgroup = []);
for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i, j))) {
if ("__data__" in node) subnode.__data__ = node.__data__;
d3_transitionNode(subnode, i, ns, id, node[ns][id]);
subgroup.push(subnode);
} else {
subgroup.push(null);
}
}
}
return d3_transition(subgroups, ns, id);
};
d3_transitionPrototype.selectAll = function(selector) {
var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnodes, node, subnode, transition;
selector = d3_selection_selectorAll(selector);
for (var j = -1, m = this.length; ++j < m; ) {
for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) {
transition = node[ns][id];
subnodes = selector.call(node, node.__data__, i, j);
subgroups.push(subgroup = []);
for (var k = -1, o = subnodes.length; ++k < o; ) {
if (subnode = subnodes[k]) d3_transitionNode(subnode, k, ns, id, transition);
subgroup.push(subnode);
}
}
}
}
return d3_transition(subgroups, ns, id);
};
d3_transitionPrototype.filter = function(filter) {
var subgroups = [], subgroup, group, node;
if (typeof filter !== "function") filter = d3_selection_filter(filter);
for (var j = 0, m = this.length; j < m; j++) {
subgroups.push(subgroup = []);
for (var group = this[j], i = 0, n = group.length; i < n; i++) {
if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {
subgroup.push(node);
}
}
}
return d3_transition(subgroups, this.namespace, this.id);
};
d3_transitionPrototype.tween = function(name, tween) {
var id = this.id, ns = this.namespace;
if (arguments.length < 2) return this.node()[ns][id].tween.get(name);
return d3_selection_each(this, tween == null ? function(node) {
node[ns][id].tween.remove(name);
} : function(node) {
node[ns][id].tween.set(name, tween);
});
};
function d3_transition_tween(groups, name, value, tween) {
var id = groups.id, ns = groups.namespace;
return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) {
node[ns][id].tween.set(name, tween(value.call(node, node.__data__, i, j)));
} : (value = tween(value), function(node) {
node[ns][id].tween.set(name, value);
}));
}
d3_transitionPrototype.attr = function(nameNS, value) {
if (arguments.length < 2) {
for (value in nameNS) this.attr(value, nameNS[value]);
return this;
}
var interpolate = nameNS == "transform" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS);
function attrNull() {
this.removeAttribute(name);
}
function attrNullNS() {
this.removeAttributeNS(name.space, name.local);
}
function attrTween(b) {
return b == null ? attrNull : (b += "", function() {
var a = this.getAttribute(name), i;
return a !== b && (i = interpolate(a, b), function(t) {
this.setAttribute(name, i(t));
});
});
}
function attrTweenNS(b) {
return b == null ? attrNullNS : (b += "", function() {
var a = this.getAttributeNS(name.space, name.local), i;
return a !== b && (i = interpolate(a, b), function(t) {
this.setAttributeNS(name.space, name.local, i(t));
});
});
}
return d3_transition_tween(this, "attr." + nameNS, value, name.local ? attrTweenNS : attrTween);
};
d3_transitionPrototype.attrTween = function(nameNS, tween) {
var name = d3.ns.qualify(nameNS);
function attrTween(d, i) {
var f = tween.call(this, d, i, this.getAttribute(name));
return f && function(t) {
this.setAttribute(name, f(t));
};
}
function attrTweenNS(d, i) {
var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
return f && function(t) {
this.setAttributeNS(name.space, name.local, f(t));
};
}
return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
};
d3_transitionPrototype.style = function(name, value, priority) {
var n = arguments.length;
if (n < 3) {
if (typeof name !== "string") {
if (n < 2) value = "";
for (priority in name) this.style(priority, name[priority], value);
return this;
}
priority = "";
}
function styleNull() {
this.style.removeProperty(name);
}
function styleString(b) {
return b == null ? styleNull : (b += "", function() {
var a = d3_window(this).getComputedStyle(this, null).getPropertyValue(name), i;
return a !== b && (i = d3_interpolate(a, b), function(t) {
this.style.setProperty(name, i(t), priority);
});
});
}
return d3_transition_tween(this, "style." + name, value, styleString);
};
d3_transitionPrototype.styleTween = function(name, tween, priority) {
if (arguments.length < 3) priority = "";
function styleTween(d, i) {
var f = tween.call(this, d, i, d3_window(this).getComputedStyle(this, null).getPropertyValue(name));
return f && function(t) {
this.style.setProperty(name, f(t), priority);
};
}
return this.tween("style." + name, styleTween);
};
d3_transitionPrototype.text = function(value) {
return d3_transition_tween(this, "text", value, d3_transition_text);
};
function d3_transition_text(b) {
if (b == null) b = "";
return function() {
this.textContent = b;
};
}
d3_transitionPrototype.remove = function() {
var ns = this.namespace;
return this.each("end.transition", function() {
var p;
if (this[ns].count < 2 && (p = this.parentNode)) p.removeChild(this);
});
};
d3_transitionPrototype.ease = function(value) {
var id = this.id, ns = this.namespace;
if (arguments.length < 1) return this.node()[ns][id].ease;
if (typeof value !== "function") value = d3.ease.apply(d3, arguments);
return d3_selection_each(this, function(node) {
node[ns][id].ease = value;
});
};
d3_transitionPrototype.delay = function(value) {
var id = this.id, ns = this.namespace;
if (arguments.length < 1) return this.node()[ns][id].delay;
return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
node[ns][id].delay = +value.call(node, node.__data__, i, j);
} : (value = +value, function(node) {
node[ns][id].delay = value;
}));
};
d3_transitionPrototype.duration = function(value) {
var id = this.id, ns = this.namespace;
if (arguments.length < 1) return this.node()[ns][id].duration;
return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
node[ns][id].duration = Math.max(1, value.call(node, node.__data__, i, j));
} : (value = Math.max(1, value), function(node) {
node[ns][id].duration = value;
}));
};
d3_transitionPrototype.each = function(type, listener) {
var id = this.id, ns = this.namespace;
if (arguments.length < 2) {
var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId;
try {
d3_transitionInheritId = id;
d3_selection_each(this, function(node, i, j) {
d3_transitionInherit = node[ns][id];
type.call(node, node.__data__, i, j);
});
} finally {
d3_transitionInherit = inherit;
d3_transitionInheritId = inheritId;
}
} else {
d3_selection_each(this, function(node) {
var transition = node[ns][id];
(transition.event || (transition.event = d3.dispatch("start", "end", "interrupt"))).on(type, listener);
});
}
return this;
};
d3_transitionPrototype.transition = function() {
var id0 = this.id, id1 = ++d3_transitionId, ns = this.namespace, subgroups = [], subgroup, group, node, transition;
for (var j = 0, m = this.length; j < m; j++) {
subgroups.push(subgroup = []);
for (var group = this[j], i = 0, n = group.length; i < n; i++) {
if (node = group[i]) {
transition = node[ns][id0];
d3_transitionNode(node, i, ns, id1, {
time: transition.time,
ease: transition.ease,
delay: transition.delay + transition.duration,
duration: transition.duration
});
}
subgroup.push(node);
}
}
return d3_transition(subgroups, ns, id1);
};
function d3_transitionNamespace(name) {
return name == null ? "__transition__" : "__transition_" + name + "__";
}
function d3_transitionNode(node, i, ns, id, inherit) {
var lock = node[ns] || (node[ns] = {
active: 0,
count: 0
}), transition = lock[id], time, timer, duration, ease, tweens;
function schedule(elapsed) {
var delay = transition.delay;
timer.t = delay + time;
if (delay <= elapsed) return start(elapsed - delay);
timer.c = start;
}
function start(elapsed) {
var activeId = lock.active, active = lock[activeId];
if (active) {
active.timer.c = null;
active.timer.t = NaN;
--lock.count;
delete lock[activeId];
active.event && active.event.interrupt.call(node, node.__data__, active.index);
}
for (var cancelId in lock) {
if (+cancelId < id) {
var cancel = lock[cancelId];
cancel.timer.c = null;
cancel.timer.t = NaN;
--lock.count;
delete lock[cancelId];
}
}
timer.c = tick;
d3_timer(function() {
if (timer.c && tick(elapsed || 1)) {
timer.c = null;
timer.t = NaN;
}
return 1;
}, 0, time);
lock.active = id;
transition.event && transition.event.start.call(node, node.__data__, i);
tweens = [];
transition.tween.forEach(function(key, value) {
if (value = value.call(node, node.__data__, i)) {
tweens.push(value);
}
});
ease = transition.ease;
duration = transition.duration;
}
function tick(elapsed) {
var t = elapsed / duration, e = ease(t), n = tweens.length;
while (n > 0) {
tweens[--n].call(node, e);
}
if (t >= 1) {
transition.event && transition.event.end.call(node, node.__data__, i);
if (--lock.count) delete lock[id]; else delete node[ns];
return 1;
}
}
if (!transition) {
time = inherit.time;
timer = d3_timer(schedule, 0, time);
transition = lock[id] = {
tween: new d3_Map(),
time: time,
timer: timer,
delay: inherit.delay,
duration: inherit.duration,
ease: inherit.ease,
index: i
};
inherit = null;
++lock.count;
}
}
d3.svg.axis = function() {
var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_;
function axis(g) {
g.each(function() {
var g = d3.select(this);
var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy();
var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickSpacing = Math.max(innerTickSize, 0) + tickPadding, tickTransform;
var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"),
d3.transition(path));
tickEnter.append("line");
tickEnter.append("text");
var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"), sign = orient === "top" || orient === "left" ? -1 : 1, x1, x2, y1, y2;
if (orient === "bottom" || orient === "top") {
tickTransform = d3_svg_axisX, x1 = "x", y1 = "y", x2 = "x2", y2 = "y2";
text.attr("dy", sign < 0 ? "0em" : ".71em").style("text-anchor", "middle");
pathUpdate.attr("d", "M" + range[0] + "," + sign * outerTickSize + "V0H" + range[1] + "V" + sign * outerTickSize);
} else {
tickTransform = d3_svg_axisY, x1 = "y", y1 = "x", x2 = "y2", y2 = "x2";
text.attr("dy", ".32em").style("text-anchor", sign < 0 ? "end" : "start");
pathUpdate.attr("d", "M" + sign * outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + sign * outerTickSize);
}
lineEnter.attr(y2, sign * innerTickSize);
textEnter.attr(y1, sign * tickSpacing);
lineUpdate.attr(x2, 0).attr(y2, sign * innerTickSize);
textUpdate.attr(x1, 0).attr(y1, sign * tickSpacing);
if (scale1.rangeBand) {
var x = scale1, dx = x.rangeBand() / 2;
scale0 = scale1 = function(d) {
return x(d) + dx;
};
} else if (scale0.rangeBand) {
scale0 = scale1;
} else {
tickExit.call(tickTransform, scale1, scale0);
}
tickEnter.call(tickTransform, scale0, scale1);
tickUpdate.call(tickTransform, scale1, scale1);
});
}
axis.scale = function(x) {
if (!arguments.length) return scale;
scale = x;
return axis;
};
axis.orient = function(x) {
if (!arguments.length) return orient;
orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient;
return axis;
};
axis.ticks = function() {
if (!arguments.length) return tickArguments_;
tickArguments_ = d3_array(arguments);
return axis;
};
axis.tickValues = function(x) {
if (!arguments.length) return tickValues;
tickValues = x;
return axis;
};
axis.tickFormat = function(x) {
if (!arguments.length) return tickFormat_;
tickFormat_ = x;
return axis;
};
axis.tickSize = function(x) {
var n = arguments.length;
if (!n) return innerTickSize;
innerTickSize = +x;
outerTickSize = +arguments[n - 1];
return axis;
};
axis.innerTickSize = function(x) {
if (!arguments.length) return innerTickSize;
innerTickSize = +x;
return axis;
};
axis.outerTickSize = function(x) {
if (!arguments.length) return outerTickSize;
outerTickSize = +x;
return axis;
};
axis.tickPadding = function(x) {
if (!arguments.length) return tickPadding;
tickPadding = +x;
return axis;
};
axis.tickSubdivide = function() {
return arguments.length && axis;
};
return axis;
};
var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = {
top: 1,
right: 1,
bottom: 1,
left: 1
};
function d3_svg_axisX(selection, x0, x1) {
selection.attr("transform", function(d) {
var v0 = x0(d);
return "translate(" + (isFinite(v0) ? v0 : x1(d)) + ",0)";
});
}
function d3_svg_axisY(selection, y0, y1) {
selection.attr("transform", function(d) {
var v0 = y0(d);
return "translate(0," + (isFinite(v0) ? v0 : y1(d)) + ")";
});
}
d3.svg.brush = function() {
var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, xExtent = [ 0, 0 ], yExtent = [ 0, 0 ], xExtentDomain, yExtentDomain, xClamp = true, yClamp = true, resizes = d3_svg_brushResizes[0];
function brush(g) {
g.each(function() {
var g = d3.select(this).style("pointer-events", "all").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
var background = g.selectAll(".background").data([ 0 ]);
background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
g.selectAll(".extent").data([ 0 ]).enter().append("rect").attr("class", "extent").style("cursor", "move");
var resize = g.selectAll(".resize").data(resizes, d3_identity);
resize.exit().remove();
resize.enter().append("g").attr("class", function(d) {
return "resize " + d;
}).style("cursor", function(d) {
return d3_svg_brushCursor[d];
}).append("rect").attr("x", function(d) {
return /[ew]$/.test(d) ? -3 : null;
}).attr("y", function(d) {
return /^[ns]/.test(d) ? -3 : null;
}).attr("width", 6).attr("height", 6).style("visibility", "hidden");
resize.style("display", brush.empty() ? "none" : null);
var gUpdate = d3.transition(g), backgroundUpdate = d3.transition(background), range;
if (x) {
range = d3_scaleRange(x);
backgroundUpdate.attr("x", range[0]).attr("width", range[1] - range[0]);
redrawX(gUpdate);
}
if (y) {
range = d3_scaleRange(y);
backgroundUpdate.attr("y", range[0]).attr("height", range[1] - range[0]);
redrawY(gUpdate);
}
redraw(gUpdate);
});
}
brush.event = function(g) {
g.each(function() {
var event_ = event.of(this, arguments), extent1 = {
x: xExtent,
y: yExtent,
i: xExtentDomain,
j: yExtentDomain
}, extent0 = this.__chart__ || extent1;
this.__chart__ = extent1;
if (d3_transitionInheritId) {
d3.select(this).transition().each("start.brush", function() {
xExtentDomain = extent0.i;
yExtentDomain = extent0.j;
xExtent = extent0.x;
yExtent = extent0.y;
event_({
type: "brushstart"
});
}).tween("brush:brush", function() {
var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y);
xExtentDomain = yExtentDomain = null;
return function(t) {
xExtent = extent1.x = xi(t);
yExtent = extent1.y = yi(t);
event_({
type: "brush",
mode: "resize"
});
};
}).each("end.brush", function() {
xExtentDomain = extent1.i;
yExtentDomain = extent1.j;
event_({
type: "brush",
mode: "resize"
});
event_({
type: "brushend"
});
});
} else {
event_({
type: "brushstart"
});
event_({
type: "brush",
mode: "resize"
});
event_({
type: "brushend"
});
}
});
};
function redraw(g) {
g.selectAll(".resize").attr("transform", function(d) {
return "translate(" + xExtent[+/e$/.test(d)] + "," + yExtent[+/^s/.test(d)] + ")";
});
}
function redrawX(g) {
g.select(".extent").attr("x", xExtent[0]);
g.selectAll(".extent,.n>rect,.s>rect").attr("width", xExtent[1] - xExtent[0]);
}
function redrawY(g) {
g.select(".extent").attr("y", yExtent[0]);
g.selectAll(".extent,.e>rect,.w>rect").attr("height", yExtent[1] - yExtent[0]);
}
function brushstart() {
var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), dragRestore = d3_event_dragSuppress(target), center, origin = d3.mouse(target), offset;
var w = d3.select(d3_window(target)).on("keydown.brush", keydown).on("keyup.brush", keyup);
if (d3.event.changedTouches) {
w.on("touchmove.brush", brushmove).on("touchend.brush", brushend);
} else {
w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend);
}
g.interrupt().selectAll("*").interrupt();
if (dragging) {
origin[0] = xExtent[0] - origin[0];
origin[1] = yExtent[0] - origin[1];
} else if (resizing) {
var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
offset = [ xExtent[1 - ex] - origin[0], yExtent[1 - ey] - origin[1] ];
origin[0] = xExtent[ex];
origin[1] = yExtent[ey];
} else if (d3.event.altKey) center = origin.slice();
g.style("pointer-events", "none").selectAll(".resize").style("display", null);
d3.select("body").style("cursor", eventTarget.style("cursor"));
event_({
type: "brushstart"
});
brushmove();
function keydown() {
if (d3.event.keyCode == 32) {
if (!dragging) {
center = null;
origin[0] -= xExtent[1];
origin[1] -= yExtent[1];
dragging = 2;
}
d3_eventPreventDefault();
}
}
function keyup() {
if (d3.event.keyCode == 32 && dragging == 2) {
origin[0] += xExtent[1];
origin[1] += yExtent[1];
dragging = 0;
d3_eventPreventDefault();
}
}
function brushmove() {
var point = d3.mouse(target), moved = false;
if (offset) {
point[0] += offset[0];
point[1] += offset[1];
}
if (!dragging) {
if (d3.event.altKey) {
if (!center) center = [ (xExtent[0] + xExtent[1]) / 2, (yExtent[0] + yExtent[1]) / 2 ];
origin[0] = xExtent[+(point[0] < center[0])];
origin[1] = yExtent[+(point[1] < center[1])];
} else center = null;
}
if (resizingX && move1(point, x, 0)) {
redrawX(g);
moved = true;
}
if (resizingY && move1(point, y, 1)) {
redrawY(g);
moved = true;
}
if (moved) {
redraw(g);
event_({
type: "brush",
mode: dragging ? "move" : "resize"
});
}
}
function move1(point, scale, i) {
var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], extent = i ? yExtent : xExtent, size = extent[1] - extent[0], min, max;
if (dragging) {
r0 -= position;
r1 -= size + position;
}
min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i];
if (dragging) {
max = (min += position) + size;
} else {
if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
if (position < min) {
max = min;
min = position;
} else {
max = position;
}
}
if (extent[0] != min || extent[1] != max) {
if (i) yExtentDomain = null; else xExtentDomain = null;
extent[0] = min;
extent[1] = max;
return true;
}
}
function brushend() {
brushmove();
g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
d3.select("body").style("cursor", null);
w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
dragRestore();
event_({
type: "brushend"
});
}
}
brush.x = function(z) {
if (!arguments.length) return x;
x = z;
resizes = d3_svg_brushResizes[!x << 1 | !y];
return brush;
};
brush.y = function(z) {
if (!arguments.length) return y;
y = z;
resizes = d3_svg_brushResizes[!x << 1 | !y];
return brush;
};
brush.clamp = function(z) {
if (!arguments.length) return x && y ? [ xClamp, yClamp ] : x ? xClamp : y ? yClamp : null;
if (x && y) xClamp = !!z[0], yClamp = !!z[1]; else if (x) xClamp = !!z; else if (y) yClamp = !!z;
return brush;
};
brush.extent = function(z) {
var x0, x1, y0, y1, t;
if (!arguments.length) {
if (x) {
if (xExtentDomain) {
x0 = xExtentDomain[0], x1 = xExtentDomain[1];
} else {
x0 = xExtent[0], x1 = xExtent[1];
if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
if (x1 < x0) t = x0, x0 = x1, x1 = t;
}
}
if (y) {
if (yExtentDomain) {
y0 = yExtentDomain[0], y1 = yExtentDomain[1];
} else {
y0 = yExtent[0], y1 = yExtent[1];
if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
if (y1 < y0) t = y0, y0 = y1, y1 = t;
}
}
return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
}
if (x) {
x0 = z[0], x1 = z[1];
if (y) x0 = x0[0], x1 = x1[0];
xExtentDomain = [ x0, x1 ];
if (x.invert) x0 = x(x0), x1 = x(x1);
if (x1 < x0) t = x0, x0 = x1, x1 = t;
if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [ x0, x1 ];
}
if (y) {
y0 = z[0], y1 = z[1];
if (x) y0 = y0[1], y1 = y1[1];
yExtentDomain = [ y0, y1 ];
if (y.invert) y0 = y(y0), y1 = y(y1);
if (y1 < y0) t = y0, y0 = y1, y1 = t;
if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [ y0, y1 ];
}
return brush;
};
brush.clear = function() {
if (!brush.empty()) {
xExtent = [ 0, 0 ], yExtent = [ 0, 0 ];
xExtentDomain = yExtentDomain = null;
}
return brush;
};
brush.empty = function() {
return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1];
};
return d3.rebind(brush, event, "on");
};
var d3_svg_brushCursor = {
n: "ns-resize",
e: "ew-resize",
s: "ns-resize",
w: "ew-resize",
nw: "nwse-resize",
ne: "nesw-resize",
se: "nwse-resize",
sw: "nesw-resize"
};
var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
var d3_time_format = d3_time.format = d3_locale_enUS.timeFormat;
var d3_time_formatUtc = d3_time_format.utc;
var d3_time_formatIso = d3_time_formatUtc("%Y-%m-%dT%H:%M:%S.%LZ");
d3_time_format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso;
function d3_time_formatIsoNative(date) {
return date.toISOString();
}
d3_time_formatIsoNative.parse = function(string) {
var date = new Date(string);
return isNaN(date) ? null : date;
};
d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
d3_time.second = d3_time_interval(function(date) {
return new d3_date(Math.floor(date / 1e3) * 1e3);
}, function(date, offset) {
date.setTime(date.getTime() + Math.floor(offset) * 1e3);
}, function(date) {
return date.getSeconds();
});
d3_time.seconds = d3_time.second.range;
d3_time.seconds.utc = d3_time.second.utc.range;
d3_time.minute = d3_time_interval(function(date) {
return new d3_date(Math.floor(date / 6e4) * 6e4);
}, function(date, offset) {
date.setTime(date.getTime() + Math.floor(offset) * 6e4);
}, function(date) {
return date.getMinutes();
});
d3_time.minutes = d3_time.minute.range;
d3_time.minutes.utc = d3_time.minute.utc.range;
d3_time.hour = d3_time_interval(function(date) {
var timezone = date.getTimezoneOffset() / 60;
return new d3_date((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
}, function(date, offset) {
date.setTime(date.getTime() + Math.floor(offset) * 36e5);
}, function(date) {
return date.getHours();
});
d3_time.hours = d3_time.hour.range;
d3_time.hours.utc = d3_time.hour.utc.range;
d3_time.month = d3_time_interval(function(date) {
date = d3_time.day(date);
date.setDate(1);
return date;
}, function(date, offset) {
date.setMonth(date.getMonth() + offset);
}, function(date) {
return date.getMonth();
});
d3_time.months = d3_time.month.range;
d3_time.months.utc = d3_time.month.utc.range;
function d3_time_scale(linear, methods, format) {
function scale(x) {
return linear(x);
}
scale.invert = function(x) {
return d3_time_scaleDate(linear.invert(x));
};
scale.domain = function(x) {
if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
linear.domain(x);
return scale;
};
function tickMethod(extent, count) {
var span = extent[1] - extent[0], target = span / count, i = d3.bisect(d3_time_scaleSteps, target);
return i == d3_time_scaleSteps.length ? [ methods.year, d3_scale_linearTickRange(extent.map(function(d) {
return d / 31536e6;
}), count)[2] ] : !i ? [ d3_time_scaleMilliseconds, d3_scale_linearTickRange(extent, count)[2] ] : methods[target / d3_time_scaleSteps[i - 1] < d3_time_scaleSteps[i] / target ? i - 1 : i];
}
scale.nice = function(interval, skip) {
var domain = scale.domain(), extent = d3_scaleExtent(domain), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" && tickMethod(extent, interval);
if (method) interval = method[0], skip = method[1];
function skipped(date) {
return !isNaN(date) && !interval.range(date, d3_time_scaleDate(+date + 1), skip).length;
}
return scale.domain(d3_scale_nice(domain, skip > 1 ? {
floor: function(date) {
while (skipped(date = interval.floor(date))) date = d3_time_scaleDate(date - 1);
return date;
},
ceil: function(date) {
while (skipped(date = interval.ceil(date))) date = d3_time_scaleDate(+date + 1);
return date;
}
} : interval));
};
scale.ticks = function(interval, skip) {
var extent = d3_scaleExtent(scale.domain()), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" ? tickMethod(extent, interval) : !interval.range && [ {
range: interval
}, skip ];
if (method) interval = method[0], skip = method[1];
return interval.range(extent[0], d3_time_scaleDate(+extent[1] + 1), skip < 1 ? 1 : skip);
};
scale.tickFormat = function() {
return format;
};
scale.copy = function() {
return d3_time_scale(linear.copy(), methods, format);
};
return d3_scale_linearRebind(scale, linear);
}
function d3_time_scaleDate(t) {
return new Date(t);
}
var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
var d3_time_scaleLocalMethods = [ [ d3_time.second, 1 ], [ d3_time.second, 5 ], [ d3_time.second, 15 ], [ d3_time.second, 30 ], [ d3_time.minute, 1 ], [ d3_time.minute, 5 ], [ d3_time.minute, 15 ], [ d3_time.minute, 30 ], [ d3_time.hour, 1 ], [ d3_time.hour, 3 ], [ d3_time.hour, 6 ], [ d3_time.hour, 12 ], [ d3_time.day, 1 ], [ d3_time.day, 2 ], [ d3_time.week, 1 ], [ d3_time.month, 1 ], [ d3_time.month, 3 ], [ d3_time.year, 1 ] ];
var d3_time_scaleLocalFormat = d3_time_format.multi([ [ ".%L", function(d) {
return d.getMilliseconds();
} ], [ ":%S", function(d) {
return d.getSeconds();
} ], [ "%I:%M", function(d) {
return d.getMinutes();
} ], [ "%I %p", function(d) {
return d.getHours();
} ], [ "%a %d", function(d) {
return d.getDay() && d.getDate() != 1;
} ], [ "%b %d", function(d) {
return d.getDate() != 1;
} ], [ "%B", function(d) {
return d.getMonth();
} ], [ "%Y", d3_true ] ]);
var d3_time_scaleMilliseconds = {
range: function(start, stop, step) {
return d3.range(Math.ceil(start / step) * step, +stop, step).map(d3_time_scaleDate);
},
floor: d3_identity,
ceil: d3_identity
};
d3_time_scaleLocalMethods.year = d3_time.year;
d3_time.scale = function() {
return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
};
var d3_time_scaleUtcMethods = d3_time_scaleLocalMethods.map(function(m) {
return [ m[0].utc, m[1] ];
});
var d3_time_scaleUtcFormat = d3_time_formatUtc.multi([ [ ".%L", function(d) {
return d.getUTCMilliseconds();
} ], [ ":%S", function(d) {
return d.getUTCSeconds();
} ], [ "%I:%M", function(d) {
return d.getUTCMinutes();
} ], [ "%I %p", function(d) {
return d.getUTCHours();
} ], [ "%a %d", function(d) {
return d.getUTCDay() && d.getUTCDate() != 1;
} ], [ "%b %d", function(d) {
return d.getUTCDate() != 1;
} ], [ "%B", function(d) {
return d.getUTCMonth();
} ], [ "%Y", d3_true ] ]);
d3_time_scaleUtcMethods.year = d3_time.year.utc;
d3_time.scale.utc = function() {
return d3_time_scale(d3.scale.linear(), d3_time_scaleUtcMethods, d3_time_scaleUtcFormat);
};
d3.text = d3_xhrType(function(request) {
return request.responseText;
});
d3.json = function(url, callback) {
return d3_xhr(url, "application/json", d3_json, callback);
};
function d3_json(request) {
return JSON.parse(request.responseText);
}
d3.html = function(url, callback) {
return d3_xhr(url, "text/html", d3_html, callback);
};
function d3_html(request) {
var range = d3_document.createRange();
range.selectNode(d3_document.body);
return range.createContextualFragment(request.responseText);
}
d3.xml = d3_xhrType(function(request) {
return request.responseXML;
});
if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3;
}(); |
/**
* Correlates the elements of two sequences based on overlapping durations.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
var left = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable();
var leftDone = false, rightDone = false;
var leftId = 0, rightId = 0;
var leftMap = new Dictionary(), rightMap = new Dictionary();
group.add(left.subscribe(
function (value) {
var id = leftId++;
var md = new SingleAssignmentDisposable();
leftMap.add(id, value);
group.add(md);
var expire = function () {
leftMap.remove(id) && leftMap.count() === 0 && leftDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = leftDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
rightMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(value, v);
} catch (exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
leftDone = true;
(rightDone || leftMap.count() === 0) && observer.onCompleted();
})
);
group.add(right.subscribe(
function (value) {
var id = rightId++;
var md = new SingleAssignmentDisposable();
rightMap.add(id, value);
group.add(md);
var expire = function () {
rightMap.remove(id) && rightMap.count() === 0 && rightDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = rightDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
leftMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(v, value);
} catch(exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
rightDone = true;
(leftDone || rightMap.count() === 0) && observer.onCompleted();
})
);
return group;
});
};
|
/*
* Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
*
* 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.
*
*/
/*jslint vars: true, plusplus: true, nomen: true, regexp: true, maxerr: 50 */
/*global define, brackets */
define(function (require, exports, module) {
"use strict";
var LanguageManager = brackets.getModule("language/LanguageManager");
LanguageManager.defineLanguage("less", {
name: "LESS",
mode: ["css", "text/x-less"],
fileExtensions: ["less"],
blockComment: ["/*", "*/"],
lineComment: ["//"]
}).done(function (lessLanguage) {
// Hack to make it so that when we see a "css" mode inside a LESS file,
// we know that it's really LESS. Ideally we would have a way to get the
// actual mime type from CodeMirror, so we know what mode configuration is
// in use (see #7345).
lessLanguage._setLanguageForMode("css", lessLanguage);
});
});
|
//! moment.js locale configuration
//! locale : Urdu [ur]
//! author : Sawood Alam : https://github.com/ibnesayeed
//! author : Zack : https://github.com/ZackVision
import moment from '../moment';
var months = [
'جنوری',
'فروری',
'مارچ',
'اپریل',
'مئی',
'جون',
'جولائی',
'اگست',
'ستمبر',
'اکتوبر',
'نومبر',
'دسمبر'
];
var days = [
'اتوار',
'پیر',
'منگل',
'بدھ',
'جمعرات',
'جمعہ',
'ہفتہ'
];
export default moment.defineLocale('ur', {
months : months,
monthsShort : months,
weekdays : days,
weekdaysShort : days,
weekdaysMin : days,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd، D MMMM YYYY HH:mm'
},
meridiemParse: /صبح|شام/,
isPM : function (input) {
return 'شام' === input;
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'صبح';
}
return 'شام';
},
calendar : {
sameDay : '[آج بوقت] LT',
nextDay : '[کل بوقت] LT',
nextWeek : 'dddd [بوقت] LT',
lastDay : '[گذشتہ روز بوقت] LT',
lastWeek : '[گذشتہ] dddd [بوقت] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s بعد',
past : '%s قبل',
s : 'چند سیکنڈ',
ss : '%d سیکنڈ',
m : 'ایک منٹ',
mm : '%d منٹ',
h : 'ایک گھنٹہ',
hh : '%d گھنٹے',
d : 'ایک دن',
dd : '%d دن',
M : 'ایک ماہ',
MM : '%d ماہ',
y : 'ایک سال',
yy : '%d سال'
},
preparse: function (string) {
return string.replace(/،/g, ',');
},
postformat: function (string) {
return string.replace(/,/g, '،');
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
|
YUI.add("event-resize",function(e,t){e.Event.define("windowresize",{on:e.UA.gecko&&e.UA.gecko<1.91?function(t,n,r){n._handle=e.Event.attach("resize",function(e){r.fire(e)})}:function(t,n,r){var i=e.config.windowResizeDelay||100;n._handle=e.Event.attach("resize",function(t){n._timer&&n._timer.cancel(),n._timer=e.later(i,e,function(){r.fire(t)})})},detach:function(e,t){t._timer&&t._timer.cancel(),t._handle.detach()}})},"3.18.0",{requires:["node-base","event-synthetic"]});
|
/*!
* Qoopido.js library v3.4.4, 2014-6-15
* https://github.com/dlueth/qoopido.js
* (c) 2014 Dirk Lueth
* Dual licensed under MIT and GPL
*//*!
* Qoopido.js library
*
* version: 3.4.4
* date: 2014-6-15
* author: Dirk Lueth <[email protected]>
* website: https://github.com/dlueth/qoopido.js
*
* Copyright (c) 2014 Dirk Lueth
*
* Dual licensed under the MIT and GPL licenses.
* - http://www.opensource.org/licenses/mit-license.php
* - http://www.gnu.org/copyleft/gpl.html
*/
!function(r,e){e.register?e.register("polyfill/object/getownpropertydescriptor",r):(e.modules=e.modules||{})["polyfill/object/getownpropertydescriptor"]=r()}(function(){"use strict";if(!Object.getOwnPropertyDescriptor||!function(){try{return Object.getOwnPropertyDescriptor({x:0},"x"),!0}catch(r){return!1}}()){var r=Object.getOwnPropertyDescriptor;Object.getOwnPropertyDescriptor=function(e,t){if(e!==Object(e))throw new TypeError;try{return r.call(Object,e,t)}catch(o){}return Object.prototype.hasOwnProperty.call(e,t)?{value:e[t],enumerable:!0,writable:!0,configurable:!0}:void 0}}return Object.getOwnPropertyDescriptor},window.qoopido=window.qoopido||{}); |
var traverse = require('./');
var test = require('testling');
test('leaves', function (t) {
var obj = {
a : [1,2,3],
b : 4,
c : [5,6],
d : { e : [7,8], f : 9 }
};
var acc = [];
traverse(obj).forEach(function (x) {
if (this.isLeaf) acc.push(x);
});
t.deepEqual(
acc, [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
'traversal in the proper order'
);
t.end();
});
|
(function(global) {
Ember.libraries.register('Ember Simple Auth Cookie Store', '0.8.0-beta.3');
var define, requireModule;
(function() {
var registry = {}, seen = {};
define = function(name, deps, callback) {
registry[name] = { deps: deps, callback: callback };
};
requireModule = function(name) {
if (seen.hasOwnProperty(name)) { return seen[name]; }
seen[name] = {};
if (!registry[name]) {
throw new Error("Could not find module " + name);
}
var mod = registry[name],
deps = mod.deps,
callback = mod.callback,
reified = [],
exports;
for (var i=0, l=deps.length; i<l; i++) {
if (deps[i] === 'exports') {
reified.push(exports = {});
} else {
reified.push(requireModule(resolve(deps[i])));
}
}
var value = callback.apply(this, reified);
return seen[name] = exports || value;
function resolve(child) {
if (child.charAt(0) !== '.') { return child; }
var parts = child.split("/");
var parentBase = name.split("/").slice(0, -1);
for (var i=0, l=parts.length; i<l; i++) {
var part = parts[i];
if (part === '..') { parentBase.pop(); }
else if (part === '.') { continue; }
else { parentBase.push(part); }
}
return parentBase.join("/");
}
};
requireModule.registry = registry;
})();
define("simple-auth-cookie-store/configuration",
["simple-auth/utils/load-config","exports"],
function(__dependency1__, __exports__) {
"use strict";
var loadConfig = __dependency1__["default"];
var defaults = {
cookieName: 'ember_simple_auth:session',
cookieDomain: null,
cookieExpirationTime: null
};
/**
Ember Simple Auth Cookie Store's configuration object.
To change any of these values, set them on the application's environment
object:
```js
ENV['simple-auth-cookie-store'] = {
cookieName: 'my_app_auth_session'
}
```
@class CookieStore
@namespace SimpleAuth.Configuration
@module simple-auth/configuration
*/
__exports__["default"] = {
/**
The domain to use for the cookie, e.g., "example.com", ".example.com"
(includes all subdomains) or "subdomain.example.com". If not configured the
cookie domain defaults to the domain the session was authneticated on.
This value can be configured via
[`SimpleAuth.Configuration.CookieStore#cookieDomain`](#SimpleAuth-Configuration-CookieStore-cookieDomain).
@property cookieDomain
@type String
@default null
*/
cookieDomain: defaults.cookieDomain,
/**
The name of the cookie the store stores its data in.
@property cookieName
@readOnly
@static
@type String
@default 'ember_simple_auth:'
*/
cookieName: defaults.cookieName,
/**
The expiration time in seconds to use for the cookie. A value of `null`
will make the cookie a session cookie that expires when the browser is
closed.
@property cookieExpirationTime
@readOnly
@static
@type Integer
@default null
*/
cookieExpirationTime: defaults.cookieExpirationTime,
/**
@method load
@private
*/
load: loadConfig(defaults)
};
});
define("simple-auth-cookie-store/ember",
["./initializer"],
function(__dependency1__) {
"use strict";
var initializer = __dependency1__["default"];
Ember.onLoad('Ember.Application', function(Application) {
Application.initializer(initializer);
});
});
define("simple-auth-cookie-store/initializer",
["./configuration","simple-auth/utils/get-global-config","simple-auth-cookie-store/stores/cookie","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
"use strict";
var Configuration = __dependency1__["default"];
var getGlobalConfig = __dependency2__["default"];
var Store = __dependency3__["default"];
__exports__["default"] = {
name: 'simple-auth-cookie-store',
before: 'simple-auth',
initialize: function(container, application) {
var config = getGlobalConfig('simple-auth-cookie-store');
Configuration.load(container, config);
application.register('simple-auth-session-store:cookie', Store);
}
};
});
define("simple-auth-cookie-store/stores/cookie",
["simple-auth/stores/base","simple-auth/utils/objects-are-equal","./../configuration","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
"use strict";
var Base = __dependency1__["default"];
var objectsAreEqual = __dependency2__["default"];
var Configuration = __dependency3__["default"];
/**
Store that saves its data in a cookie.
__In order to keep multiple tabs/windows of an application in sync, this
store has to periodically (every 500ms) check the cookie__ for changes as
there are no events that notify of changes in cookies. The recommended
alternative is `Stores.LocalStorage` that also persistently stores data but
instead of cookies relies on the `localStorage` API and does not need to poll
for external changes.
By default the cookie store will use a session cookie that expires and is
deleted when the browser is closed. The cookie expiration period can be
configured via setting
[`Stores.Cooke#cookieExpirationTime`](#SimpleAuth-Stores-Cookie-cookieExpirationTime)
though. This can also be used to implement "remember me" functionality that
will either store the session persistently or in a session cookie depending
whether the user opted in or not:
```js
// app/controllers/login.js
export default Ember.Controller.extend({
rememberMe: false,
rememberMeChanged: function() {
this.get('session.store').cookieExpirationTime = this.get('rememberMe') ? (14 * 24 * 60 * 60) : null;
}.observes('rememberMe')
});
```
_The factory for this store is registered as
`'simple-auth-session-store:cookie'` in Ember's container._
@class Cookie
@namespace SimpleAuth.Stores
@module simple-auth-cookie-store/stores/cookie
@extends Stores.Base
*/
__exports__["default"] = Base.extend({
/**
The domain to use for the cookie, e.g., "example.com", ".example.com"
(includes all subdomains) or "subdomain.example.com". If not configured the
cookie domain defaults to the domain the session was authneticated on.
This value can be configured via
[`SimpleAuth.Configuration.CookieStore#cookieDomain`](#SimpleAuth-Configuration-CookieStore-cookieDomain).
@property cookieDomain
@type String
@default null
*/
cookieDomain: null,
/**
The name of the cookie the store stores its data in.
This value can be configured via
[`SimpleAuth.Configuration.CookieStore#cookieName`](#SimpleAuth-Configuration-CookieStore-cookieName).
@property cookieName
@readOnly
@type String
*/
cookieName: 'ember_simple_auth:session',
/**
The expiration time in seconds to use for the cookie. A value of `null`
will make the cookie a session cookie that expires when the browser is
closed.
This value can be configured via
[`SimpleAuth.Configuration.CookieStore#cookieExpirationTime`](#SimpleAuth-Configuration-CookieStore-cookieExpirationTime).
@property cookieExpirationTime
@readOnly
@type Integer
*/
cookieExpirationTime: null,
/**
@property _secureCookies
@private
*/
_secureCookies: window.location.protocol === 'https:',
/**
@property _syncDataTimeout
@private
*/
_syncDataTimeout: null,
/**
@property renewExpirationTimeout
@private
*/
renewExpirationTimeout: null,
/**
@property isPageVisible
@private
*/
isPageVisible: null,
/**
@method init
@private
*/
init: function() {
this.cookieName = Configuration.cookieName;
this.cookieExpirationTime = Configuration.cookieExpirationTime;
this.cookieDomain = Configuration.cookieDomain;
this.isPageVisible = this.initPageVisibility();
this.syncData();
this.renewExpiration();
},
/**
Persists the `data` in session cookies.
@method persist
@param {Object} data The data to persist
*/
persist: function(data) {
data = JSON.stringify(data || {});
var expiration = this.calculateExpirationTime();
this.write(data, expiration);
this._lastData = this.restore();
},
/**
Restores all data currently saved in the cookie as a plain object.
@method restore
@return {Object} All data currently persisted in the cookie
*/
restore: function() {
var data = this.read(this.cookieName);
if (Ember.isEmpty(data)) {
return {};
} else {
return JSON.parse(data);
}
},
/**
Clears the store by deleting all session cookies prefixed with the
`cookieName` (see
[`SimpleAuth.Stores.Cookie#cookieName`](#SimpleAuth-Stores-Cookie-cookieName)).
@method clear
*/
clear: function() {
this.write(null, 0);
this._lastData = {};
},
/**
@method read
@private
*/
read: function(name) {
var value = document.cookie.match(new RegExp(name + '=([^;]+)')) || [];
return decodeURIComponent(value[1] || '');
},
/**
@method calculateExpirationTime
@private
*/
calculateExpirationTime: function() {
var cachedExpirationTime = this.read(this.cookieName + ':expiration_time');
cachedExpirationTime = !!cachedExpirationTime ? new Date().getTime() + cachedExpirationTime * 1000 : null;
return !!this.cookieExpirationTime ? new Date().getTime() + this.cookieExpirationTime * 1000 : cachedExpirationTime;
},
/**
@method write
@private
*/
write: function(value, expiration) {
var path = '; path=/';
var domain = Ember.isEmpty(this.cookieDomain) ? '' : '; domain=' + this.cookieDomain;
var expires = Ember.isEmpty(expiration) ? '' : '; expires=' + new Date(expiration).toUTCString();
var secure = !!this._secureCookies ? ';secure' : '';
document.cookie = this.cookieName + '=' + encodeURIComponent(value) + domain + path + expires + secure;
if(expiration !== null) {
var cachedExpirationTime = this.read(this.cookieName + ':expiration_time');
document.cookie = this.cookieName + ':expiration_time=' + encodeURIComponent(this.cookieExpirationTime || cachedExpirationTime) + domain + path + expires + secure;
}
},
/**
@method syncData
@private
*/
syncData: function() {
var data = this.restore();
if (!objectsAreEqual(data, this._lastData)) {
this._lastData = data;
this.trigger('sessionDataUpdated', data);
}
if (!Ember.testing) {
Ember.run.cancel(this._syncDataTimeout);
this._syncDataTimeout = Ember.run.later(this, this.syncData, 500);
}
},
/**
@method initPageVisibility
@private
*/
initPageVisibility: function(){
var keys = {
hidden: 'visibilitychange',
webkitHidden: 'webkitvisibilitychange',
mozHidden: 'mozvisibilitychange',
msHidden: 'msvisibilitychange'
};
for (var stateKey in keys) {
if (stateKey in document) {
var eventKey = keys[stateKey];
break;
}
}
return function() {
return !document[stateKey];
};
},
/**
@method renew
@private
*/
renew: function() {
var data = this.restore();
if (!Ember.isEmpty(data) && data !== {}) {
data = Ember.typeOf(data) === 'string' ? data : JSON.stringify(data || {});
var expiration = this.calculateExpirationTime();
this.write(data, expiration);
}
},
/**
@method renewExpiration
@private
*/
renewExpiration: function() {
if (this.isPageVisible()) {
this.renew();
}
if (!Ember.testing) {
Ember.run.cancel(this.renewExpirationTimeout);
this.renewExpirationTimeout = Ember.run.later(this, this.renewExpiration, 60000);
}
}
});
});
define('simple-auth/stores/base', ['exports'], function(__exports__) {
__exports__['default'] = global.SimpleAuth.Stores.Base;
});
define('simple-auth/utils/objects-are-equal', ['exports'], function(__exports__) {
__exports__['default'] = global.SimpleAuth.Utils.objectsAreEqual;
});
define('simple-auth/utils/get-global-config', ['exports'], function(__exports__) {
__exports__['default'] = global.SimpleAuth.Utils.getGlobalConfig;
});
define('simple-auth/utils/load-config', ['exports'], function(__exports__) {
__exports__['default'] = global.SimpleAuth.Utils.loadConfig;
});
var initializer = requireModule('simple-auth-cookie-store/initializer')['default'];
var Configuration = requireModule('simple-auth-cookie-store/configuration')['default'];
var Cookie = requireModule('simple-auth-cookie-store/stores/cookie')['default'];
global.SimpleAuth.Configuration.CookieStore = Configuration;
global.SimpleAuth.Stores.Cookie = Cookie;
requireModule('simple-auth-cookie-store/ember');
})((typeof global !== 'undefined') ? global : window);
|
/**
* @license AngularJS v1.3.15
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function() {'use strict';
/**
* @description
*
* This object provides a utility for producing rich Error messages within
* Angular. It can be called as follows:
*
* var exampleMinErr = minErr('example');
* throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
*
* The above creates an instance of minErr in the example namespace. The
* resulting error will have a namespaced error code of example.one. The
* resulting error will replace {0} with the value of foo, and {1} with the
* value of bar. The object is not restricted in the number of arguments it can
* take.
*
* If fewer arguments are specified than necessary for interpolation, the extra
* interpolation markers will be preserved in the final string.
*
* Since data will be parsed statically during a build step, some restrictions
* are applied with respect to how minErr instances are created and called.
* Instances should have names of the form namespaceMinErr for a minErr created
* using minErr('namespace') . Error codes, namespaces and template strings
* should all be static strings, not variables or general expressions.
*
* @param {string} module The namespace to use for the new minErr instance.
* @param {function} ErrorConstructor Custom error constructor to be instantiated when returning
* error from returned function, for cases when a particular type of error is useful.
* @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
*/
function minErr(module, ErrorConstructor) {
ErrorConstructor = ErrorConstructor || Error;
return function() {
var code = arguments[0],
prefix = '[' + (module ? module + ':' : '') + code + '] ',
template = arguments[1],
templateArgs = arguments,
message, i;
message = prefix + template.replace(/\{\d+\}/g, function(match) {
var index = +match.slice(1, -1), arg;
if (index + 2 < templateArgs.length) {
return toDebugString(templateArgs[index + 2]);
}
return match;
});
message = message + '\nhttp://errors.angularjs.org/1.3.15/' +
(module ? module + '/' : '') + code;
for (i = 2; i < arguments.length; i++) {
message = message + (i == 2 ? '?' : '&') + 'p' + (i - 2) + '=' +
encodeURIComponent(toDebugString(arguments[i]));
}
return new ErrorConstructor(message);
};
}
/**
* @ngdoc type
* @name angular.Module
* @module ng
* @description
*
* Interface for configuring angular {@link angular.module modules}.
*/
function setupModuleLoader(window) {
var $injectorMinErr = minErr('$injector');
var ngMinErr = minErr('ng');
function ensure(obj, name, factory) {
return obj[name] || (obj[name] = factory());
}
var angular = ensure(window, 'angular', Object);
// We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
angular.$$minErr = angular.$$minErr || minErr;
return ensure(angular, 'module', function() {
/** @type {Object.<string, angular.Module>} */
var modules = {};
/**
* @ngdoc function
* @name angular.module
* @module ng
* @description
*
* The `angular.module` is a global place for creating, registering and retrieving Angular
* modules.
* All modules (angular core or 3rd party) that should be available to an application must be
* registered using this mechanism.
*
* When passed two or more arguments, a new module is created. If passed only one argument, an
* existing module (the name passed as the first argument to `module`) is retrieved.
*
*
* # Module
*
* A module is a collection of services, directives, controllers, filters, and configuration information.
* `angular.module` is used to configure the {@link auto.$injector $injector}.
*
* ```js
* // Create a new module
* var myModule = angular.module('myModule', []);
*
* // register a new service
* myModule.value('appName', 'MyCoolApp');
*
* // configure existing services inside initialization blocks.
* myModule.config(['$locationProvider', function($locationProvider) {
* // Configure existing providers
* $locationProvider.hashPrefix('!');
* }]);
* ```
*
* Then you can create an injector and load your modules like this:
*
* ```js
* var injector = angular.injector(['ng', 'myModule'])
* ```
*
* However it's more likely that you'll just use
* {@link ng.directive:ngApp ngApp} or
* {@link angular.bootstrap} to simplify this process for you.
*
* @param {!string} name The name of the module to create or retrieve.
* @param {!Array.<string>=} requires If specified then new module is being created. If
* unspecified then the module is being retrieved for further configuration.
* @param {Function=} configFn Optional configuration function for the module. Same as
* {@link angular.Module#config Module#config()}.
* @returns {module} new module with the {@link angular.Module} api.
*/
return function module(name, requires, configFn) {
var assertNotHasOwnProperty = function(name, context) {
if (name === 'hasOwnProperty') {
throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
}
};
assertNotHasOwnProperty(name, 'module');
if (requires && modules.hasOwnProperty(name)) {
modules[name] = null;
}
return ensure(modules, name, function() {
if (!requires) {
throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
"the module name or forgot to load it. If registering a module ensure that you " +
"specify the dependencies as the second argument.", name);
}
/** @type {!Array.<Array.<*>>} */
var invokeQueue = [];
/** @type {!Array.<Function>} */
var configBlocks = [];
/** @type {!Array.<Function>} */
var runBlocks = [];
var config = invokeLater('$injector', 'invoke', 'push', configBlocks);
/** @type {angular.Module} */
var moduleInstance = {
// Private state
_invokeQueue: invokeQueue,
_configBlocks: configBlocks,
_runBlocks: runBlocks,
/**
* @ngdoc property
* @name angular.Module#requires
* @module ng
*
* @description
* Holds the list of modules which the injector will load before the current module is
* loaded.
*/
requires: requires,
/**
* @ngdoc property
* @name angular.Module#name
* @module ng
*
* @description
* Name of the module.
*/
name: name,
/**
* @ngdoc method
* @name angular.Module#provider
* @module ng
* @param {string} name service name
* @param {Function} providerType Construction function for creating new instance of the
* service.
* @description
* See {@link auto.$provide#provider $provide.provider()}.
*/
provider: invokeLater('$provide', 'provider'),
/**
* @ngdoc method
* @name angular.Module#factory
* @module ng
* @param {string} name service name
* @param {Function} providerFunction Function for creating new instance of the service.
* @description
* See {@link auto.$provide#factory $provide.factory()}.
*/
factory: invokeLater('$provide', 'factory'),
/**
* @ngdoc method
* @name angular.Module#service
* @module ng
* @param {string} name service name
* @param {Function} constructor A constructor function that will be instantiated.
* @description
* See {@link auto.$provide#service $provide.service()}.
*/
service: invokeLater('$provide', 'service'),
/**
* @ngdoc method
* @name angular.Module#value
* @module ng
* @param {string} name service name
* @param {*} object Service instance object.
* @description
* See {@link auto.$provide#value $provide.value()}.
*/
value: invokeLater('$provide', 'value'),
/**
* @ngdoc method
* @name angular.Module#constant
* @module ng
* @param {string} name constant name
* @param {*} object Constant value.
* @description
* Because the constant are fixed, they get applied before other provide methods.
* See {@link auto.$provide#constant $provide.constant()}.
*/
constant: invokeLater('$provide', 'constant', 'unshift'),
/**
* @ngdoc method
* @name angular.Module#animation
* @module ng
* @param {string} name animation name
* @param {Function} animationFactory Factory function for creating new instance of an
* animation.
* @description
*
* **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
*
*
* Defines an animation hook that can be later used with
* {@link ngAnimate.$animate $animate} service and directives that use this service.
*
* ```js
* module.animation('.animation-name', function($inject1, $inject2) {
* return {
* eventName : function(element, done) {
* //code to run the animation
* //once complete, then run done()
* return function cancellationFunction(element) {
* //code to cancel the animation
* }
* }
* }
* })
* ```
*
* See {@link ng.$animateProvider#register $animateProvider.register()} and
* {@link ngAnimate ngAnimate module} for more information.
*/
animation: invokeLater('$animateProvider', 'register'),
/**
* @ngdoc method
* @name angular.Module#filter
* @module ng
* @param {string} name Filter name.
* @param {Function} filterFactory Factory function for creating new instance of filter.
* @description
* See {@link ng.$filterProvider#register $filterProvider.register()}.
*/
filter: invokeLater('$filterProvider', 'register'),
/**
* @ngdoc method
* @name angular.Module#controller
* @module ng
* @param {string|Object} name Controller name, or an object map of controllers where the
* keys are the names and the values are the constructors.
* @param {Function} constructor Controller constructor function.
* @description
* See {@link ng.$controllerProvider#register $controllerProvider.register()}.
*/
controller: invokeLater('$controllerProvider', 'register'),
/**
* @ngdoc method
* @name angular.Module#directive
* @module ng
* @param {string|Object} name Directive name, or an object map of directives where the
* keys are the names and the values are the factories.
* @param {Function} directiveFactory Factory function for creating new instance of
* directives.
* @description
* See {@link ng.$compileProvider#directive $compileProvider.directive()}.
*/
directive: invokeLater('$compileProvider', 'directive'),
/**
* @ngdoc method
* @name angular.Module#config
* @module ng
* @param {Function} configFn Execute this function on module load. Useful for service
* configuration.
* @description
* Use this method to register work which needs to be performed on module loading.
* For more about how to configure services, see
* {@link providers#provider-recipe Provider Recipe}.
*/
config: config,
/**
* @ngdoc method
* @name angular.Module#run
* @module ng
* @param {Function} initializationFn Execute this function after injector creation.
* Useful for application initialization.
* @description
* Use this method to register work which should be performed when the injector is done
* loading all modules.
*/
run: function(block) {
runBlocks.push(block);
return this;
}
};
if (configFn) {
config(configFn);
}
return moduleInstance;
/**
* @param {string} provider
* @param {string} method
* @param {String=} insertMethod
* @returns {angular.Module}
*/
function invokeLater(provider, method, insertMethod, queue) {
if (!queue) queue = invokeQueue;
return function() {
queue[insertMethod || 'push']([provider, method, arguments]);
return moduleInstance;
};
}
});
};
});
}
setupModuleLoader(window);
})(window);
/**
* Closure compiler type information
*
* @typedef { {
* requires: !Array.<string>,
* invokeQueue: !Array.<Array.<*>>,
*
* service: function(string, Function):angular.Module,
* factory: function(string, Function):angular.Module,
* value: function(string, *):angular.Module,
*
* filter: function(string, Function):angular.Module,
*
* init: function(Function):angular.Module
* } }
*/
angular.Module;
|
/* Health Indicators Warehouse (HIW) JavaScript API
* v5.0.2 (beta)
*
* Docs: http://developers.healthindicators.gov
* Source: https://github.com/HealthIndicators/js-api
* License: MIT - https://github.com/HealthIndicators/js-api/raw/master/LICENSE
*/
/********************************************************************
* *
* This is pre-release software and comes with no warranties. *
* *
* Please report any issues or suggestions my emailing: [email protected] *
* *
********************************************************************/
var hiw;
(function (hiw) {
function extend(target, source) {
var exclude = [];
for (var _i = 2; _i < arguments.length; _i++) {
exclude[_i - 2] = arguments[_i];
}
if (source == null)
return;
for (name in source) {
var targetName = pascalCaseToCamelCase(name);
if (!exclude || exclude.indexOf(targetName) < 0) {
var currentValue = target[targetName];
var newValue = source[name];
// Prevent never-ending loop.
if (target !== newValue && currentValue !== newValue) {
var newValueIsArray = Array.isArray(newValue);
var newValueIsPlainObject = isPlainObject(newValue);
// Recurse if we're merging plain objects or arrays.
if (newValue && (newValueIsPlainObject || newValueIsArray)) {
var clone = null;
if (newValueIsArray) {
var currentValueIsArray = Array.isArray(currentValue);
clone = (currentValue && currentValueIsArray ? currentValue : []);
}
else {
var currentValueIsPlainObject = isPlainObject(currentValue);
clone = (currentValue && currentValueIsPlainObject ? currentValue : {});
}
// Never move original objects, clone them.
target[targetName] = extend(clone, newValue);
}
else if (newValue !== undefined)
target[targetName] = newValue;
}
}
}
// Return the modified object
return target;
}
hiw.extend = extend;
function pascalCaseToCamelCase(name) {
if (name == null)
return null;
var matches = /^([A-Z]+?)(?:[A-Z][a-z].*|[^A-Z][a-z].*)?$/.exec(name);
if (matches)
return matches[1].toLowerCase() + name.substr(matches[1].length, name.length - matches[1].length);
}
hiw.pascalCaseToCamelCase = pascalCaseToCamelCase;
function isPlainObject(obj) {
if (obj == null || typeof obj !== "object" || obj.nodeType || obj === window)
return false;
if (obj.constructor && obj.constructor.prototype && typeof obj.constructor.prototype.isPrototypeOf !== "function")
return false;
return true;
}
hiw.isPlainObject = isPlainObject;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
/** The valid set of boolean operators we can use to filter an API call. */
(function (FilterType) {
FilterType[FilterType["And"] = 0] = "And";
FilterType[FilterType["Or"] = 1] = "Or";
})(hiw.FilterType || (hiw.FilterType = {}));
var FilterType = hiw.FilterType;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
/** The valid set of operators we can use to filter an API call. */
(function (Operator) {
Operator[Operator["LessThan"] = 0] = "LessThan";
Operator[Operator["LessThanOrEqual"] = 1] = "LessThanOrEqual";
Operator[Operator["Equal"] = 2] = "Equal";
Operator[Operator["NotEqual"] = 3] = "NotEqual";
Operator[Operator["GreaterThanOrEqual"] = 4] = "GreaterThanOrEqual";
Operator[Operator["GreaterThan"] = 5] = "GreaterThan";
Operator[Operator["Null"] = 6] = "Null";
Operator[Operator["NotNull"] = 7] = "NotNull";
Operator[Operator["In"] = 8] = "In";
Operator[Operator["NotIn"] = 9] = "NotIn";
})(hiw.Operator || (hiw.Operator = {}));
var Operator = hiw.Operator;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
/** Represents a single criterion. */
var Criterion = (function () {
/** Creates a new Criterion instance with the specified name, operator and value. */
function Criterion(field, operator, value) {
if (operator === void 0) { operator = 2 /* Equal */; }
if (value === void 0) { value = null; }
this.name = (field instanceof hiw.PropertyMap ? field.apiName : field.toString());
this.operator = operator;
this.value = value;
}
/** Converts this instance to JSON in the format the HIW API expects. */
Criterion.prototype.toJSON = function () {
var json = {
"__type": "SearchParameter:#S3.Common.Search",
Name: this.name,
Operator: this.operator
};
if (this.operator != 6 /* Null */ && this.operator != 7 /* NotNull */)
json.Value = this.value;
return json;
};
return Criterion;
})();
hiw.Criterion = Criterion;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
/** Represents a group of filter criterion. */
var Group = (function () {
/** Creates a new Group instance of the specified type. */
function Group(type) {
if (type === void 0) { type = 0 /* And */; }
this.type = type;
this.criteria = new Array();
}
/** Adds the specified filter part to the criteria. */
Group.prototype.addPart = function (part) {
this.criteria.push(part);
return this;
};
/** Creates a new criterion and adds it to the criteria. */
Group.prototype.add = function (field, operator, value) {
if (operator === void 0) { operator = 2 /* Equal */; }
if (value === void 0) { value = null; }
this.criteria.push(new hiw.Criterion(field, operator, value));
return this;
};
/** Converts this instance to JSON in the format the HIW API expects. */
Group.prototype.toJSON = function () {
var json = {
"__type": "SearchGroup:#S3.Common.Search",
Mode: hiw.FilterType[this.type],
Elements: new Array()
};
if (this.criteria)
for (var i = 0; i < this.criteria.length; i++)
json.Elements.push(this.criteria[i].toJSON());
return json;
};
return Group;
})();
hiw.Group = Group;
})(hiw || (hiw = {}));
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var hiw;
(function (hiw) {
/** Represents the outermost portion of a filter. */
var Filter = (function (_super) {
__extends(Filter, _super);
/** Creates a new Filter instance for the specified page, type, and criteria. */
function Filter(page, type) {
if (page === void 0) { page = 1; }
if (type === void 0) { type = 0 /* And */; }
_super.call(this, type);
this.page = page;
}
/** Adds the specified filter part to the criteria. */
Filter.prototype.addPart = function (part) {
_super.prototype.addPart.call(this, part);
return this;
};
/** Creates a new criterion (using the default operator "Equal") and adds it to the criteria. */
//public add(name: string, value: Object): Filter<T>;
Filter.prototype.addEqual = function (field, value) {
return this.add(field, 2 /* Equal */, value);
};
/** Creates a new criterion and adds it to the criteria. */
Filter.prototype.add = function (field, operator, value) {
if (operator === void 0) { operator = 2 /* Equal */; }
if (value === void 0) { value = null; }
_super.prototype.add.call(this, field, operator, value);
return this;
};
/** Converts this instance to JSON in the format the HIW API expects. */
Filter.prototype.toJSON = function (page) {
if (page === void 0) { page = 1; }
var json = _super.prototype.toJSON.call(this);
delete json["__type"];
json["Page"] = page;
return json;
};
return Filter;
})(hiw.Group);
hiw.Filter = Filter;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
/** Exposes functionality through one or more service end points. */
(function (LinkType) {
LinkType[LinkType["Age"] = 0] = "Age";
LinkType[LinkType["Ages"] = 1] = "Ages";
LinkType[LinkType["AgeRelation"] = 2] = "AgeRelation";
LinkType[LinkType["AgeRelations"] = 3] = "AgeRelations";
LinkType[LinkType["CharacteristicOfSchoolOrStudent"] = 4] = "CharacteristicOfSchoolOrStudent";
LinkType[LinkType["CharacteristicOfSchoolOrStudents"] = 5] = "CharacteristicOfSchoolOrStudents";
LinkType[LinkType["CharacteristicOfSchoolOrStudentRelation"] = 6] = "CharacteristicOfSchoolOrStudentRelation";
LinkType[LinkType["CharacteristicOfSchoolOrStudentRelations"] = 7] = "CharacteristicOfSchoolOrStudentRelations";
LinkType[LinkType["CountryOfBirth"] = 8] = "CountryOfBirth";
LinkType[LinkType["CountryOfBirths"] = 9] = "CountryOfBirths";
LinkType[LinkType["CountryOfBirthRelation"] = 10] = "CountryOfBirthRelation";
LinkType[LinkType["CountryOfBirthRelations"] = 11] = "CountryOfBirthRelations";
LinkType[LinkType["DataCategory"] = 12] = "DataCategory";
LinkType[LinkType["DataCategories"] = 13] = "DataCategories";
LinkType[LinkType["DataCategoryRelation"] = 14] = "DataCategoryRelation";
LinkType[LinkType["DataCategoryRelations"] = 15] = "DataCategoryRelations";
LinkType[LinkType["DataSourceDataSupplier"] = 16] = "DataSourceDataSupplier";
LinkType[LinkType["DataSourceDataSuppliers"] = 17] = "DataSourceDataSuppliers";
LinkType[LinkType["DataSource"] = 18] = "DataSource";
LinkType[LinkType["DataSources"] = 19] = "DataSources";
LinkType[LinkType["DataSourceURL"] = 20] = "DataSourceURL";
LinkType[LinkType["DataSourceURLs"] = 21] = "DataSourceURLs";
LinkType[LinkType["DataSupplier"] = 22] = "DataSupplier";
LinkType[LinkType["DataSuppliers"] = 23] = "DataSuppliers";
LinkType[LinkType["DimensionBook"] = 24] = "DimensionBook";
LinkType[LinkType["DimensionBooks"] = 25] = "DimensionBooks";
LinkType[LinkType["DimensionBookRelation"] = 26] = "DimensionBookRelation";
LinkType[LinkType["DimensionBookRelations"] = 27] = "DimensionBookRelations";
LinkType[LinkType["DimensionGraph"] = 28] = "DimensionGraph";
LinkType[LinkType["DimensionGraphs"] = 29] = "DimensionGraphs";
LinkType[LinkType["DimensionList"] = 30] = "DimensionList";
LinkType[LinkType["DimensionLists"] = 31] = "DimensionLists";
LinkType[LinkType["DisabilityStatus"] = 32] = "DisabilityStatus";
LinkType[LinkType["DisabilityStatuses"] = 33] = "DisabilityStatuses";
LinkType[LinkType["DisabilityStatusRelation"] = 34] = "DisabilityStatusRelation";
LinkType[LinkType["DisabilityStatusRelations"] = 35] = "DisabilityStatusRelations";
LinkType[LinkType["EducationalAttainment"] = 36] = "EducationalAttainment";
LinkType[LinkType["EducationalAttainments"] = 37] = "EducationalAttainments";
LinkType[LinkType["EducationalAttainmentRelation"] = 38] = "EducationalAttainmentRelation";
LinkType[LinkType["EducationalAttainmentRelations"] = 39] = "EducationalAttainmentRelations";
LinkType[LinkType["FamilyType"] = 40] = "FamilyType";
LinkType[LinkType["FamilyTypes"] = 41] = "FamilyTypes";
LinkType[LinkType["FamilyTypeRelation"] = 42] = "FamilyTypeRelation";
LinkType[LinkType["FamilyTypeRelations"] = 43] = "FamilyTypeRelations";
LinkType[LinkType["Geography"] = 44] = "Geography";
LinkType[LinkType["Geographies"] = 45] = "Geographies";
LinkType[LinkType["GeographyRelation"] = 46] = "GeographyRelation";
LinkType[LinkType["GeographyRelations"] = 47] = "GeographyRelations";
LinkType[LinkType["GlossaryTerm"] = 48] = "GlossaryTerm";
LinkType[LinkType["GlossaryTerms"] = 49] = "GlossaryTerms";
LinkType[LinkType["HealthInsuranceStatus"] = 50] = "HealthInsuranceStatus";
LinkType[LinkType["HealthInsuranceStatuses"] = 51] = "HealthInsuranceStatuses";
LinkType[LinkType["HealthInsuranceStatusRelation"] = 52] = "HealthInsuranceStatusRelation";
LinkType[LinkType["HealthInsuranceStatusRelations"] = 53] = "HealthInsuranceStatusRelations";
LinkType[LinkType["HP2020TSM"] = 54] = "HP2020TSM";
LinkType[LinkType["HP2020TSMs"] = 55] = "HP2020TSMs";
LinkType[LinkType["IncomeAndPovertyStatus"] = 56] = "IncomeAndPovertyStatus";
LinkType[LinkType["IncomeAndPovertyStatuses"] = 57] = "IncomeAndPovertyStatuses";
LinkType[LinkType["IncomeAndPovertyStatusRelation"] = 58] = "IncomeAndPovertyStatusRelation";
LinkType[LinkType["IncomeAndPovertyStatusRelations"] = 59] = "IncomeAndPovertyStatusRelations";
LinkType[LinkType["IndicatorDescriptionDataCategory"] = 60] = "IndicatorDescriptionDataCategory";
LinkType[LinkType["IndicatorDescriptionDataCategories"] = 61] = "IndicatorDescriptionDataCategories";
LinkType[LinkType["IndicatorDescriptionDataSource"] = 62] = "IndicatorDescriptionDataSource";
LinkType[LinkType["IndicatorDescriptionDataSources"] = 63] = "IndicatorDescriptionDataSources";
LinkType[LinkType["IndicatorDescriptionDefaultDimensionGraph"] = 64] = "IndicatorDescriptionDefaultDimensionGraph";
LinkType[LinkType["IndicatorDescriptionDefaultDimensionGraphs"] = 65] = "IndicatorDescriptionDefaultDimensionGraphs";
LinkType[LinkType["IndicatorDescriptionDimension"] = 66] = "IndicatorDescriptionDimension";
LinkType[LinkType["IndicatorDescriptionDimensions"] = 67] = "IndicatorDescriptionDimensions";
LinkType[LinkType["IndicatorDescriptionDimensionGraph"] = 68] = "IndicatorDescriptionDimensionGraph";
LinkType[LinkType["IndicatorDescriptionDimensionGraphs"] = 69] = "IndicatorDescriptionDimensionGraphs";
LinkType[LinkType["IndicatorDescriptionDimensionValue"] = 70] = "IndicatorDescriptionDimensionValue";
LinkType[LinkType["IndicatorDescriptionDimensionValues"] = 71] = "IndicatorDescriptionDimensionValues";
LinkType[LinkType["IndicatorDescriptionInitiative"] = 72] = "IndicatorDescriptionInitiative";
LinkType[LinkType["IndicatorDescriptionInitiatives"] = 73] = "IndicatorDescriptionInitiatives";
LinkType[LinkType["IndicatorDescriptionIntervention"] = 74] = "IndicatorDescriptionIntervention";
LinkType[LinkType["IndicatorDescriptionInterventions"] = 75] = "IndicatorDescriptionInterventions";
LinkType[LinkType["IndicatorDescriptionKeyword"] = 76] = "IndicatorDescriptionKeyword";
LinkType[LinkType["IndicatorDescriptionKeywords"] = 77] = "IndicatorDescriptionKeywords";
LinkType[LinkType["IndicatorDescriptionLocaleCounty"] = 78] = "IndicatorDescriptionLocaleCounty";
LinkType[LinkType["IndicatorDescriptionLocaleCounties"] = 79] = "IndicatorDescriptionLocaleCounties";
LinkType[LinkType["IndicatorDescriptionLocaleHospitalReferralRegion"] = 80] = "IndicatorDescriptionLocaleHospitalReferralRegion";
LinkType[LinkType["IndicatorDescriptionLocaleHospitalReferralRegions"] = 81] = "IndicatorDescriptionLocaleHospitalReferralRegions";
LinkType[LinkType["IndicatorDescriptionLocaleLevel"] = 82] = "IndicatorDescriptionLocaleLevel";
LinkType[LinkType["IndicatorDescriptionLocaleLevels"] = 83] = "IndicatorDescriptionLocaleLevels";
LinkType[LinkType["IndicatorDescriptionLocale"] = 84] = "IndicatorDescriptionLocale";
LinkType[LinkType["IndicatorDescriptionLocales"] = 85] = "IndicatorDescriptionLocales";
LinkType[LinkType["IndicatorDescriptionLocaleState"] = 86] = "IndicatorDescriptionLocaleState";
LinkType[LinkType["IndicatorDescriptionLocaleStates"] = 87] = "IndicatorDescriptionLocaleStates";
LinkType[LinkType["IndicatorDescriptionMethodologyNote"] = 88] = "IndicatorDescriptionMethodologyNote";
LinkType[LinkType["IndicatorDescriptionMethodologyNotes"] = 89] = "IndicatorDescriptionMethodologyNotes";
LinkType[LinkType["IndicatorDescriptionMoreInfo"] = 90] = "IndicatorDescriptionMoreInfo";
LinkType[LinkType["IndicatorDescriptionMoreInfos"] = 91] = "IndicatorDescriptionMoreInfos";
LinkType[LinkType["IndicatorDescriptionReference"] = 92] = "IndicatorDescriptionReference";
LinkType[LinkType["IndicatorDescriptionReferences"] = 93] = "IndicatorDescriptionReferences";
LinkType[LinkType["IndicatorDescriptionResource"] = 94] = "IndicatorDescriptionResource";
LinkType[LinkType["IndicatorDescriptionResources"] = 95] = "IndicatorDescriptionResources";
LinkType[LinkType["IndicatorDescription"] = 96] = "IndicatorDescription";
LinkType[LinkType["IndicatorDescriptions"] = 97] = "IndicatorDescriptions";
LinkType[LinkType["IndicatorDescriptionHP2020"] = 98] = "IndicatorDescriptionHP2020";
LinkType[LinkType["IndicatorDescriptionHP2020s"] = 99] = "IndicatorDescriptionHP2020s";
LinkType[LinkType["IndicatorDescriptionTimeFrame"] = 100] = "IndicatorDescriptionTimeFrame";
LinkType[LinkType["IndicatorDescriptionTimeFrames"] = 101] = "IndicatorDescriptionTimeFrames";
LinkType[LinkType["IndicatorDescriptionYear"] = 102] = "IndicatorDescriptionYear";
LinkType[LinkType["IndicatorDescriptionYears"] = 103] = "IndicatorDescriptionYears";
LinkType[LinkType["IndicatorDimensionGraph"] = 104] = "IndicatorDimensionGraph";
LinkType[LinkType["IndicatorDimensionGraphs"] = 105] = "IndicatorDimensionGraphs";
LinkType[LinkType["IndicatorDimension"] = 106] = "IndicatorDimension";
LinkType[LinkType["IndicatorDimensions"] = 107] = "IndicatorDimensions";
LinkType[LinkType["Indicator"] = 108] = "Indicator";
LinkType[LinkType["Indicators"] = 109] = "Indicators";
LinkType[LinkType["Initiative"] = 110] = "Initiative";
LinkType[LinkType["Initiatives"] = 111] = "Initiatives";
LinkType[LinkType["Intervention"] = 112] = "Intervention";
LinkType[LinkType["Interventions"] = 113] = "Interventions";
LinkType[LinkType["Keyword"] = 114] = "Keyword";
LinkType[LinkType["Keywords"] = 115] = "Keywords";
LinkType[LinkType["LocaleLevel"] = 116] = "LocaleLevel";
LinkType[LinkType["LocaleLevels"] = 117] = "LocaleLevels";
LinkType[LinkType["LocaleRelation"] = 118] = "LocaleRelation";
LinkType[LinkType["LocaleRelations"] = 119] = "LocaleRelations";
LinkType[LinkType["Locale"] = 120] = "Locale";
LinkType[LinkType["Locales"] = 121] = "Locales";
LinkType[LinkType["MaritalStatus"] = 122] = "MaritalStatus";
LinkType[LinkType["MaritalStatuses"] = 123] = "MaritalStatuses";
LinkType[LinkType["MaritalStatusRelation"] = 124] = "MaritalStatusRelation";
LinkType[LinkType["MaritalStatusRelations"] = 125] = "MaritalStatusRelations";
LinkType[LinkType["Modifier"] = 126] = "Modifier";
LinkType[LinkType["Modifiers"] = 127] = "Modifiers";
LinkType[LinkType["ModifierGraph"] = 128] = "ModifierGraph";
LinkType[LinkType["ModifierGraphs"] = 129] = "ModifierGraphs";
LinkType[LinkType["ObesityStatus"] = 130] = "ObesityStatus";
LinkType[LinkType["ObesityStatuses"] = 131] = "ObesityStatuses";
LinkType[LinkType["ObesityStatusRelation"] = 132] = "ObesityStatusRelation";
LinkType[LinkType["ObesityStatusRelations"] = 133] = "ObesityStatusRelations";
LinkType[LinkType["Other"] = 134] = "Other";
LinkType[LinkType["Others"] = 135] = "Others";
LinkType[LinkType["OtherRelation"] = 136] = "OtherRelation";
LinkType[LinkType["OtherRelations"] = 137] = "OtherRelations";
LinkType[LinkType["RaceEthnicity"] = 138] = "RaceEthnicity";
LinkType[LinkType["RaceEthnicities"] = 139] = "RaceEthnicities";
LinkType[LinkType["RaceEthnicityRelation"] = 140] = "RaceEthnicityRelation";
LinkType[LinkType["RaceEthnicityRelations"] = 141] = "RaceEthnicityRelations";
LinkType[LinkType["Sex"] = 142] = "Sex";
LinkType[LinkType["Sexes"] = 143] = "Sexes";
LinkType[LinkType["SexRelation"] = 144] = "SexRelation";
LinkType[LinkType["SexRelations"] = 145] = "SexRelations";
LinkType[LinkType["SexualOrientation"] = 146] = "SexualOrientation";
LinkType[LinkType["SexualOrientations"] = 147] = "SexualOrientations";
LinkType[LinkType["SexualOrientationRelation"] = 148] = "SexualOrientationRelation";
LinkType[LinkType["SexualOrientationRelations"] = 149] = "SexualOrientationRelations";
LinkType[LinkType["Timeframe"] = 150] = "Timeframe";
LinkType[LinkType["Timeframes"] = 151] = "Timeframes";
LinkType[LinkType["Total"] = 152] = "Total";
LinkType[LinkType["Totals"] = 153] = "Totals";
LinkType[LinkType["TotalRelation"] = 154] = "TotalRelation";
LinkType[LinkType["TotalRelations"] = 155] = "TotalRelations";
LinkType[LinkType["Url"] = 156] = "Url";
LinkType[LinkType["Urls"] = 157] = "Urls";
LinkType[LinkType["ValueLabel"] = 158] = "ValueLabel";
LinkType[LinkType["ValueLabels"] = 159] = "ValueLabels";
LinkType[LinkType["VeteranStatus"] = 160] = "VeteranStatus";
LinkType[LinkType["VeteranStatuses"] = 161] = "VeteranStatuses";
LinkType[LinkType["VeteranStatusRelation"] = 162] = "VeteranStatusRelation";
LinkType[LinkType["VeteranStatusRelations"] = 163] = "VeteranStatusRelations";
LinkType[LinkType["Year"] = 164] = "Year";
LinkType[LinkType["Years"] = 165] = "Years";
})(hiw.LinkType || (hiw.LinkType = {}));
var LinkType = hiw.LinkType;
(function (ExportFileTypeEnum) {
ExportFileTypeEnum[ExportFileTypeEnum["Excel"] = 0] = "Excel";
ExportFileTypeEnum[ExportFileTypeEnum["Excel2003"] = 1] = "Excel2003";
ExportFileTypeEnum[ExportFileTypeEnum["CSV"] = 2] = "CSV";
})(hiw.ExportFileTypeEnum || (hiw.ExportFileTypeEnum = {}));
var ExportFileTypeEnum = hiw.ExportFileTypeEnum;
(function (IndicatorDescriptionDataSourceDataDescription) {
IndicatorDescriptionDataSourceDataDescription[IndicatorDescriptionDataSourceDataDescription["Numerator"] = 0] = "Numerator";
IndicatorDescriptionDataSourceDataDescription[IndicatorDescriptionDataSourceDataDescription["Denominator"] = 1] = "Denominator";
IndicatorDescriptionDataSourceDataDescription[IndicatorDescriptionDataSourceDataDescription["Both"] = 2] = "Both";
IndicatorDescriptionDataSourceDataDescription[IndicatorDescriptionDataSourceDataDescription["Other"] = 3] = "Other";
})(hiw.IndicatorDescriptionDataSourceDataDescription || (hiw.IndicatorDescriptionDataSourceDataDescription = {}));
var IndicatorDescriptionDataSourceDataDescription = hiw.IndicatorDescriptionDataSourceDataDescription;
(function (LocaleLevelName) {
LocaleLevelName[LocaleLevelName["None"] = 0] = "None";
LocaleLevelName[LocaleLevelName["National"] = 1] = "National";
LocaleLevelName[LocaleLevelName["State"] = 2] = "State";
LocaleLevelName[LocaleLevelName["County"] = 3] = "County";
LocaleLevelName[LocaleLevelName["HospitalReferralRegion"] = 4] = "HospitalReferralRegion";
})(hiw.LocaleLevelName || (hiw.LocaleLevelName = {}));
var LocaleLevelName = hiw.LocaleLevelName;
(function (SystemSettingKeyName) {
SystemSettingKeyName[SystemSettingKeyName["AuditTableName"] = 0] = "AuditTableName";
SystemSettingKeyName[SystemSettingKeyName["DataModelVersion"] = 1] = "DataModelVersion";
SystemSettingKeyName[SystemSettingKeyName["DefaultGuestAccess"] = 2] = "DefaultGuestAccess";
SystemSettingKeyName[SystemSettingKeyName["RequireStrongPasswords"] = 3] = "RequireStrongPasswords";
SystemSettingKeyName[SystemSettingKeyName["RootDirectory"] = 4] = "RootDirectory";
SystemSettingKeyName[SystemSettingKeyName["RootExportPath"] = 5] = "RootExportPath";
SystemSettingKeyName[SystemSettingKeyName["SessionIDType"] = 6] = "SessionIDType";
SystemSettingKeyName[SystemSettingKeyName["SessionTimeoutInMinutes"] = 7] = "SessionTimeoutInMinutes";
SystemSettingKeyName[SystemSettingKeyName["ShadowType"] = 8] = "ShadowType";
SystemSettingKeyName[SystemSettingKeyName["SystemAbbreviation"] = 9] = "SystemAbbreviation";
SystemSettingKeyName[SystemSettingKeyName["SystemName"] = 10] = "SystemName";
SystemSettingKeyName[SystemSettingKeyName["TableListTableName"] = 11] = "TableListTableName";
})(hiw.SystemSettingKeyName || (hiw.SystemSettingKeyName = {}));
var SystemSettingKeyName = hiw.SystemSettingKeyName;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
var PropertyMap = (function () {
function PropertyMap(name, apiName) {
this.name = name;
this.apiName = apiName;
}
PropertyMap.prototype.toString = function () {
return this.apiName;
};
return PropertyMap;
})();
hiw.PropertyMap = PropertyMap;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
(function (HttpMethod) {
HttpMethod[HttpMethod["GET"] = 0] = "GET";
HttpMethod[HttpMethod["POST"] = 1] = "POST";
})(hiw.HttpMethod || (hiw.HttpMethod = {}));
var HttpMethod = hiw.HttpMethod;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
var Endpoint = (function () {
function Endpoint(initializer, method, uriTemplate, call) {
this.initializer = initializer;
this.method = method;
this.uriTemplate = uriTemplate;
this.call = call;
this.call["endpoint"] = this;
}
Endpoint.addSimple = function (owningType, method, uriTemplate, call) {
return Endpoint.add(function (o) { return null; }, method, uriTemplate, call);
};
Endpoint.addSingle = function (owningType, method, uriTemplate, call) {
return Endpoint.add(function (o) { return new owningType(); }, method, uriTemplate, call);
};
Endpoint.addArray = function (owningType, method, uriTemplate, call) {
return Endpoint.add(function (o) {
var array = new Array();
for (var i = 0; i < o.dataLength; i++)
array.push(new owningType());
return array;
}, method, uriTemplate, call);
};
Endpoint.add = function (initializer, method, uriTemplate, call) {
var endpoint = new Endpoint(initializer, method, uriTemplate, call);
hiw.API.Endpoints.push(endpoint);
return endpoint;
};
Endpoint.fromSelf = function () {
return arguments.callee.caller["endpoint"];
};
return Endpoint;
})();
hiw.Endpoint = Endpoint;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
var Link = (function () {
function Link() {
this.relationship = null;
this.type = null;
this.typeName = null;
this.href = null;
}
return Link;
})();
hiw.Link = Link;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
var ServiceObject = (function () {
function ServiceObject() {
}
return ServiceObject;
})();
hiw.ServiceObject = ServiceObject;
})(hiw || (hiw = {}));
/// <reference path="Common.ts"/>
var hiw;
(function (hiw) {
var ServiceDataObject = (function (_super) {
__extends(ServiceDataObject, _super);
function ServiceDataObject() {
_super.apply(this, arguments);
this.links = new Array();
}
ServiceDataObject.prototype.getFields = function () {
throw "Function not implemented in derived class.";
};
ServiceDataObject.prototype.getPropertyMaps = function () {
var fields = this.getFields();
var propertyMaps = new Array();
for (var field in fields)
propertyMaps.push(fields[field]);
return propertyMaps;
};
ServiceDataObject.prototype.findLinks = function (typeName, relationship, first) {
if (relationship === void 0) { relationship = null; }
if (first === void 0) { first = false; }
var matchingLinks = new Array();
for (var i = 0; i < this.links.length; i++) {
var link = this.links[i];
if (link.typeName === hiw.LinkType[typeName] && (!relationship || link.relationship === relationship)) {
if (first)
return link;
matchingLinks.push(link);
}
}
return matchingLinks;
};
/** Recusively fills this instance with the provided data.
* @param json A JSON object containing the properties and values to copy to this instance. */
ServiceDataObject.prototype.fill = function (json, exclude) {
if (json == null)
return;
var propertyMaps = this.getPropertyMaps();
for (var name in propertyMaps) {
var map = propertyMaps[name];
if (json.hasOwnProperty(map.apiName)) {
var value = json[map.apiName];
if (this[map.name] instanceof ServiceDataObject)
this[map.name].fill(value);
else
this[map.name] = value;
}
}
if (json.Links) {
this.links = new Array();
for (var i = 0; i < json.Links.length; i++)
this.links.push(hiw.extend(new hiw.Link(), json.Links[i]));
}
};
return ServiceDataObject;
})(hiw.ServiceObject);
hiw.ServiceDataObject = ServiceDataObject;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
/** Represents a response received from the API. */
var APIResponse = (function (_super) {
__extends(APIResponse, _super);
function APIResponse(endpoint, url, postData) {
_super.call(this);
this.endpoint = endpoint;
this.url = url;
this.postData = postData;
}
APIResponse.prototype.fill = function (json) {
if (json == null)
return;
this.status = json.Status;
this.message = json.Message;
this.dataLength = json.DataLength;
this.data = APIResponse.fillInstance(this.endpoint.initializer(this), json.Data);
};
APIResponse.fillInstance = function (target, source) {
if (source == null)
target = null;
else if (target instanceof hiw.ServiceDataObject)
target.fill(source);
else if (Array.isArray(target)) {
if (Array.isArray(source)) {
var dataArray = target;
if (dataArray.length == source.length) {
for (var i = 0; i < dataArray.length; i++)
APIResponse.fillInstance(dataArray[i], source[i]);
}
else
throw "Attempted to fill data array [" + dataArray.length + "] with array [" + source.length + "].";
}
else
throw "Attempted to fill data array with non-array.";
}
else
target = source;
return target;
};
return APIResponse;
})(hiw.ServiceObject);
hiw.APIResponse = APIResponse;
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
/** Provides core functionality to interact with the HIW API. */
var API = (function () {
/** Creates a new API instance with the provided base URL. */
function API(apiKey, baseURL) {
if (apiKey === void 0) { apiKey = null; }
if (baseURL === void 0) { baseURL = API.DefaultBaseURL; }
this.apiKey = apiKey;
this.baseURL = baseURL;
}
API.parameterizePath = function (path, params) {
var parameterizedPath = path;
if (params)
for (var key in params)
parameterizedPath = parameterizedPath.replace("{" + key + "}", params[key]);
return parameterizedPath;
};
API.prototype.executeEndpoint = function (endpoint, callback, params, postData, page) {
if (page === void 0) { page = 1; }
var parameterizedPath = null;
var url = null;
if (page != null) {
params = (params || {});
params.page = page;
}
parameterizedPath = API.parameterizePath(endpoint.uriTemplate, params);
url = this.baseURL + parameterizedPath;
this.executeUrl(endpoint.method, url, postData, function (json, error) {
var response = new hiw.APIResponse(endpoint, url, postData);
if (error == null) {
try {
response.fill(json);
}
catch (e) {
error = "Error loading JSON into APIResponse instance: " + e.message;
}
}
//Prefer specific HTTP error message.
if ("Error" === response.status)
error = "Error returned from HIW API call: " + response.message;
if (callback)
callback((response ? response.data : null), response, error);
});
};
API.prototype.executeUrl = function (method, url, postData, callback) {
var request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (request.readyState === 4) {
var json = null;
var error = null;
if (request.status === 200) {
try {
json = JSON.parse(request.responseText);
}
catch (e) {
error = "Error parsing HIW API response as JSON: " + e.message;
}
if (json == null)
error = "Call to HIW API endpoint returned no parsable data.";
}
else
error = "Call to HIW API endpoint \"" + url + "\" returned HTTP status code: " + request.status + " " + request.statusText;
if (callback)
callback(json, error);
}
};
request.open(hiw.HttpMethod[method], url);
request.setRequestHeader("X-HIW-API-Key", this.apiKey);
request.setRequestHeader("Accept", "application/json");
if (method == 1 /* POST */) {
request.setRequestHeader("Content-Type", "application/json");
request.send(JSON.stringify(postData));
}
else
request.send();
};
API.VerifyApiKey = function (api, callback) {
api.executeEndpoint(hiw.Endpoint.fromSelf(), callback);
};
API.DefaultBaseURL = "http://services.healthindicators.gov/v5/REST.svc/";
API.Endpoints = new Array();
return API;
})();
hiw.API = API;
hiw.Endpoint.addSimple(API, 0 /* GET */, "/VerifyApiKey", API.VerifyApiKey);
})(hiw || (hiw = {}));
var hiw;
(function (hiw) {
var Version = (function (_super) {
__extends(Version, _super);
function Version(major, minor, revision, build) {
_super.call(this);
this.major = major;
this.minor = minor;
this.revision = revision;
this.build = build;
}
Version.prototype.getFields = function () {
return Version.Fields;
};
Version.Fields = {
major: new hiw.PropertyMap("major", "Major"),
minor: new hiw.PropertyMap("minor", "Minor"),
revision: new hiw.PropertyMap("revision", "Revision"),
build: new hiw.PropertyMap("build", "Build")
};
return Version;
})(hiw.ServiceDataObject);
hiw.Version = Version;
;
hiw.APIVersion = new Version(5, 0, 1, 0);
})(hiw || (hiw = {}));
//# sourceMappingURL=hiw-api-lite.js.map |
/*!
* URI.js - Mutating URLs
* jQuery Plugin
*
* Version: 1.10.1
*
* Author: Rodney Rehm
* Web: http://medialize.github.com/URI.js/jquery-uri-plugin.html
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
* GPL v3 http://opensource.org/licenses/GPL-3.0
*
*/
(function (root, factory) {
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
// Node
module.exports = factory(require('jquery', './URI'));
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery', './URI'], factory);
} else {
// Browser globals (root is window)
factory(root.jQuery, root.URI);
}
}(this, function ($, URI) {
"use strict";
var comparable = {};
var compare = {
// equals
'=': function(value, target) {
return value === target;
},
// ~= translates to value.match((?:^|\s)target(?:\s|$)) which is useless for URIs
// |= translates to value.match((?:\b)target(?:-|\s|$)) which is useless for URIs
// begins with
'^=': function(value, target, property) {
return !!(value + "").match(new RegExp('^' + escapeRegEx(target), 'i'));
},
// ends with
'$=': function(value, target, property) {
return !!(value + "").match(new RegExp(escapeRegEx(target) + '$', 'i'));
},
// contains
'*=': function(value, target, property) {
if (property == 'directory') {
// add trailing slash so /dir/ will match the deep-end as well
value += '/';
}
return !!(value + "").match(new RegExp(escapeRegEx(target), 'i'));
},
'equals:': function(uri, target) {
return uri.equals(target);
},
'is:': function(uri, target) {
return uri.is(target);
}
};
function escapeRegEx(string) {
// https://github.com/medialize/URI.js/commit/85ac21783c11f8ccab06106dba9735a31a86924d#commitcomment-821963
return string.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
}
function getUriProperty(elem) {
var property;
// Note: IE9 will report img.href, so check img.src first (Issue #48)
$.each(['src', 'href', 'action'], function(k, v) {
if (v in elem ) {
property = v;
return false;
}
return true;
});
// compensate ambiguous <input>
if (elem.nodeName.toLowerCase() === 'input' && elem.type !== 'image') {
return undefined;
}
if (!property) {
// you can set any property you wish. So for elements that don't have
// either of [src, href, action] we simply return src.
// https://github.com/medialize/URI.js/issues/69
return 'src';
}
return property;
}
function generateAccessor(property) {
return {
get: function(elem) {
return $(elem).uri()[property]();
},
set: function(elem, value) {
$(elem).uri()[property](value);
return value;
}
};
};
// populate lookup table and register $.attr('uri:accessor') handlers
$.each('authority directory domain filename fragment hash host hostname href password path pathname port protocol query resource scheme search subdomain suffix tld username'.split(" "), function(k, v) {
comparable[v] = true;
$.attrHooks['uri:' + v] = generateAccessor(v);
});
// pipe $.attr('src') and $.attr('href') through URI.js
var _attrHooks = {
get: function(elem) {
return $(elem).uri();
},
set: function(elem, value) {
return $(elem).uri().href(value).toString();
}
};
$.each(['src', 'href', 'action', 'uri'], function(k, v) {
$.attrHooks[v] = {
set: _attrHooks.set
};
});
$.attrHooks.uri.get = _attrHooks.get;
// general URI accessor
$.fn.uri = function(uri) {
var $this = this.first();
var elem = $this.get(0);
var property = getUriProperty(elem);
if (!property) {
throw new Error('Element "' + elem.nodeName + '" does not have either property: href, src, action');
}
if (uri !== undefined) {
var old = $this.data('uri');
if (old) {
return old.href(uri);
}
if (!(uri instanceof URI)) {
uri = URI(uri);
}
} else {
uri = $this.data('uri');
if (uri) {
return uri;
} else {
uri = URI($this.attr(property));
}
}
uri._dom_element = elem;
uri._dom_attribute = property;
uri.normalize();
$this.data('uri', uri);
return uri;
};
// overwrite URI.build() to update associated DOM element if necessary
URI.prototype.build = function(deferBuild) {
if (this._dom_element) {
// cannot defer building when hooked into a DOM element
this._string = URI.build(this._parts);
this._deferred_build = false;
this._dom_element.setAttribute(this._dom_attribute, this._string);
this._dom_element[this._dom_attribute] = this._string;
} else if (deferBuild === true) {
this._deferred_build = true;
} else if (deferBuild === undefined || this._deferred_build) {
this._string = URI.build(this._parts);
this._deferred_build = false;
}
return this;
};
// add :uri() pseudo class selector to sizzle
var uriSizzle;
var pseudoArgs = /^([a-zA-Z]+)\s*([\^\$*]?=|:)\s*(['"]?)(.+)\3|^\s*([a-zA-Z0-9]+)\s*$/;
function uriPseudo (elem, text) {
var match, property, uri;
// skip anything without src|href|action and bad :uri() syntax
if (!getUriProperty(elem) || !text) {
return false;
}
match = text.match(pseudoArgs);
if (!match || (!match[5] && match[2] !== ':' && !compare[match[2]])) {
// abort because the given selector cannot be executed
// filers seem to fail silently
return false;
}
uri = $(elem).uri();
if (match[5]) {
return uri.is(match[5]);
} else if (match[2] === ':') {
property = match[1].toLowerCase() + ':';
if (!compare[property]) {
// filers seem to fail silently
return false;
}
return compare[property](uri, match[4]);
} else {
property = match[1].toLowerCase();
if (!comparable[property]) {
// filers seem to fail silently
return false;
}
return compare[match[2]](uri[property](), match[4], property);
}
return false;
}
if ($.expr.createPseudo) {
// jQuery >= 1.8
uriSizzle = $.expr.createPseudo(function (text) {
return function (elem) {
return uriPseudo(elem, text);
};
});
} else {
// jQuery < 1.8
uriSizzle = function (elem, i, match) {
return uriPseudo(elem, match[3]);
};
}
$.expr[":"].uri = uriSizzle;
// extending existing object rather than defining something new
return {};
})); |
var baseAssignValue = require('./_baseAssignValue'),
createAggregator = require('./_createAggregator');
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` thru `iteratee`. The corresponding value of
* each key is the number of times the key was returned by `iteratee`. The
* iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 0.5.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity]
* The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* _.countBy([6.1, 4.2, 6.3], Math.floor);
* // => { '4': 1, '6': 2 }
*
* // The `_.property` iteratee shorthand.
* _.countBy(['one', 'two', 'three'], 'length');
* // => { '3': 2, '5': 1 }
*/
var countBy = createAggregator(function(result, value, key) {
if (hasOwnProperty.call(result, key)) {
++result[key];
} else {
baseAssignValue(result, key, 1);
}
});
module.exports = countBy;
|
(function(window,document,undefined,Pizzle){
var Selector = (function(Pizzle){
function Selector(selector){
return (typeof selector === "function" ) ? Selector.ready(selector) : Selector.init.call(this,selector);
}
Selector.ready = function(callback){
document.onreadystatechange = function(){
if(document.readyState == "complete"){
callback();
}
}
};
Selector.fn = Selector.prototype = {
};
Selector.extend = Selector.fn.extend = function(){
//target被扩展的对象,length参数的数量,deep是否深度操作
var options,name,src,copy,copyIsArray,clone,target = arguments[0] || {},
i = 1,length = arguments.length,deep = false;
//target为第一个参数,如果第一个参数是Boolean类型的值,则把target赋值给deep
//deep表示是否进行深层面的复制,当为true时,进行深度复制,否则只进行第一层扩展,然后把第二个参数赋值给target
if(typeof target === "boolean"){
deep = target;
target = arguments[1] || {};
i = 2;// 将i赋值为2,跳过前两个参数
}
// target既不是对象也不是函数则把target设置为空对象。
if(typeof target !== "object" && typeof target !=="function"){
target = {};
}
// 如果只有一个参数,则把对象赋值给target
if(length === i){
target = this;
// i减1,指向被扩展对象
--i;
}
// 开始遍历需要被扩展到target上的参数
for(;i<length;i++){
// 处理第i个被扩展的对象,即除去deep和target之外的对象
if((options = arguments[i])!=null ){
// 遍历第i个对象的所有可遍历的属性
for(name in options){
src = target[name];// 根据被扩展对象的键获得目标对象相应值,并赋值给src
copy = options[name];// 得到被扩展对象的值
if ( target === copy ) continue;
// 当用户想要深度操作时,递归合并,copy是纯对象或者是数组
if ( deep && copy && ( Selector.isPlainObject(copy) || (copyIsArray = Selector.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;// 将copyIsArray重新设置为false,为下次遍历做准备。
clone = src && Selector.isArray(src) ? src : [];// 判断被扩展的对象中src是不是数组
}else{
clone = src && Selector.isPlainObject(src) ? src : {};//// 判断被扩展的对象中src是不是纯对象
}
}else if ( copy !== undefined ){// 如果不需要深度复制,则直接把copy(第i个被扩展对象中被遍历的那个键的值)
target[ name ] = copy;
}
}
}
}
return target;// 原对象被改变,因此如果不想改变原对象,target可传入{}
};
Selector.extend({
cache:{},
Expr :{
whitespace : "[\\x20\\t\\r\\n\\f]",//空白字符正则字符串
rnative : /^[^{]+\{\s*\[native code/,//原生函数正则
rsibling : /[\x20\t\r\n\f]*[+~]/, //弟兄正则
needsContext:function(){//开始为>+~或位置伪类,如果选择器中有位置伪类解析从左往右
return new RegExp( "^" + Selector.Expr.whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
Selector.Expr.whitespace + "*((?:-\\d)?\\d*)" + Selector.Expr.whitespace + "*\\)|)(?=[^-]|$)", "i" );
},
relative:{
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
rbrace:/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
rvalidtokens:/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g,
rtrim:function(){
return new RegExp( "^" + Selector.Expr.whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + Selector.Expr.whitespace + "+$", "g" );
},
childEpr : function(){
return new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + Selector.Expr.whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + Selector.Expr.whitespace + "*(?:([+-]|)" + Selector.Expr.whitespace +
"*(\\d+)|))" + Selector.Expr.whitespace + "*\\)|)","i");
}
},
type:['only-child','first','first-child','last','last-child','nth-child','odd','even'],
filter:{
"ID":function(id){
return function(match,elem){
var f = false;
if(elem) f = true;
elem = elem ? elem :((typeof document.getElementById(id) !== "undefined")?document.getElementById(id) : document.getAttributeNode(id));
var results = [];
if(!elem)
return results;
var isAttr = (elem.getAttribute("id") === id) ? true : false;
if(!isAttr){
var node = document.getElementById(id);//child node
if(!node) return results;
var flag = false;
var getParentNode = function(_node){
if(elem === _node && f){
flag = true;
return;
}
var _pNode = _node.parentNode;
if(!_pNode) return;
getParentNode(_pNode);
};
var pNode = node.parentNode;
if(!pNode) return results;
getParentNode(pNode);
if(!flag) return results;
elem = node;
}
if(match){
elem = Selector.getContextsByType(match,elem);
}
if(Selector.isArray(elem)){
for(var i =0;i<elem.length;i++){
results.push({
context:elem[i]?elem[i]:"",
type:"ID",
value:id,
sep:"#"
});
}
}else{
results.push({
context:elem?elem:"",
type:"ID",
value:id,
sep:"#"
});
}
return results;
}
},
"CLASS":function(className){
return function(match,elem){
elem = elem ? elem : document;
var contexts = elem.getElementsByClassName(className);
var len = contexts.length,i = 0;
var results = [];
if(!contexts.length || contexts.length === 0)
return results;
if(match){
if(contexts.length === 0) return [];
contexts = Selector.getContextsByType(match,contexts,elem);
}
for(; i < len; i++){
results.push({
context:contexts[i]?contexts[i]:"",
type:"CLASS",
sep:".",
value:className
});
}
return results;
}
},
"TAG":function(tagName){
return function(match,elem){
elem = elem ? elem : document;
var _elem,tmp = [],i = 0;
var results = elem.getElementsByTagName(tagName);
if(results.length == 0)
return tmp;
if(match){
if(results.length === 0) return [];
results = Selector.getContextsByType(match,results,elem);
}
if(tagName === "*"){
while ((_elem = results[i++])){
if(_elem.nodeType === 1){
tmp.push({
context:_elem?_elem:"",
type:"TAG",
sep:"",
value:tagName
});
}
}
return tmp;
}
for(;i<results.length;i++){
tmp.push({
context:results[i]?results[i]:"",
type:"TAG",
sep:"",
value:tagName
});
}
return tmp;
}
},
"ATTR":function(name, operator, check){
},
/*
"CHILD":function(type, what, argument, first, last){
},*/
"PSEUDO":function(type){
return function(contexts,pToken,token){
if(!contexts || !token || !pToken) return [];
var result = [];
var getResultNode = function(elems){
for(var k =0;k<elems.length;k++){
var _node = elems[k];
if(!_node) continue;
var f = false;
for(var i = 0;i<result.length;i++){
var tNode = result[i];
if(!tNode || !tNode.context) continue;
if(tNode === _node.context){
f=true;
break;
}
}
if(!f){
result.push({
context:_node.context?_node.context:"",
type:_node.type,
sep:_node.sep,
value:_node.value
});
}
}
};
if(contexts.length === 0){
var elems = Selector.filter[pToken.type](pToken.value)(token.value);
if(elems.length === 0) return [];
getResultNode(elems);
}else{
if(!contexts[0] || contexts[0].length === 0) return result;
Selector.isArray(contexts[0]) ? function(){
var i = 0,len = contexts[0].length,nodes = [];
for(;i<len;i++){
var node = contexts[0][i];
if(!node || !node.context) continue;
var elems = Selector.filter[pToken.type](pToken.value)(token.value,node.context);
if(elems.length === 0) continue;
getResultNode(elems);
}
}():function(){
var elems = Selector.filter[pToken.type](pToken.value)(token.value);
if(elems.length === 0) return [];
getResultNode(elems);
}();
}
return result;
};
}
}
});
Selector.extend({
error:function(message){
throw new Error(message);
},
getNodeByPC:function(contexts){
var s = [];
//判断节点中有没有子父节点关系
var getNewNode = function(elem1,elem2){
if((elem1.hasChildNodes() && elem2.hasChildNodes()) && (!elem1.hasChildNodes() && !elem2.hasChildNodes())) return;
var elemNode = (elem1.hasChildNodes())?elem2:elem1;
var elems = (elem1.hasChildNodes())?elem1.childNodes : (elem2.hasChildNodes() ? elem2.childNodes:null);
if(!elems) return;
if((Selector.indexOf(elems,elemNode)) != -1){
if(Selector.indexOf(s,elemNode) == -1){
s.push(elemNode);
}
return;
}
var getNode = function(node1,node2){
if(node1.hasChildNodes()){
var pNode = node2.parentNode;
if(!pNode) return;
if((Selector.indexOf(node1,pNode)) != -1){
if(Selector.indexOf(s,node2) == -1){
s.push(node2);
}
return;
}
}
};
getNode(elems,elemNode);
};
for(var i = 0;i<contexts.length;i++){
var elem1 = contexts[i];
if((i+1)>(contexts.length - 1)) break;
var elem2 = contexts[i+1];
if(!elem1 || !elem2 || !elem1.context || !elem2.context) continue;
getNewNode(elem1.context,elem2.context);
}
var t = [];
if(s.length !== 0){
for(var i = 0;i<contexts.length;i++){
var node = contexts[i];
if(!node) continue;
if(Selector.indexOf(s,node) == -1){
t.push(node);
}
}
contexts.length = 0;
contexts = t;
}
return contexts;
},
getContextsByType:function(type,contexts,elem){
if(!type || Selector.indexOf(Selector.type,type) == -1 || !contexts) return [];
var nodes = [];
switch(type){
case Selector.type[0]://only-child
var i = 0,len = contexts.length;
for(;i<len;i++){
var _node = contexts[i];
if(!_node) continue;
var count = 0;
if(_node.nodeType === 1 && _node.nodeName != "#text" && _node.nodeName != "BR"){
if(!_node.hasChildNodes()) continue;
var childNodes = _node.childNodes;
for(var j = 0;j<childNodes.length;j++){
var _cNode = childNodes[j];
if(_cNode.nodeType === 1 && _cNode.nodeName != "#text" && _cNode.nodeName != "BR"){
if(count >= 2) break;
count++;
}
}
if(count === 1){
nodes.push(_node);
}
}
}
break;
case Selector.type[1]://first
Selector.isArray(contexts)? nodes.push(contexts[0]) : nodes.push(contexts);
break;
case Selector.type[2]://first-child
var getNode = function(elem){
var childNodes = elem.childNodes;
if(childNodes.length === 0) return;
var i = 0,len = childNodes.length;
for(;i<len;i++){
var _node = childNodes[i];
if(!_node) continue;
if(_node.nodeType === 1 && _node.nodeName != "#text" && _node.nodeName != "BR"){
nodes.push(_node);
return;
}
}
};
Selector.isArray(contexts)? function(){
var node = contexts[0];
if(!node || !node.hasChildNodes()) return;
getNode(node);
}() : getNode(contexts);
break;
case Selector.type[3]://last
Selector.isArray(contexts)? nodes.push(contexts[contexts.length - 1]) : nodes.push(contexts);
break;
case Selector.type[4]://last-child
var getNode = function(elem){
var childNodes = elem.childNodes;
if(childNodes.length === 0) return;
var len = childNodes.length, i = len - 1;
for(;i>0;i--){
var _node = childNodes[i];
if(!_node) continue;
if(_node.nodeType === 1 && _node.nodeName != "#text" && _node.nodeName != "BR"){
nodes.push(_node);
return;
}
}
};
Selector.isArray(contexts)? function(){
var node = contexts[0];
if(!node || !node.hasChildNodes()) return;
getNode(node);
}() : getNode(contexts);;
break;
case Selector.type[5]://nth-child
case Selector.type[6]://odd
if(elem){
Selector.isArray(contexts)? function(){
if(contexts.length === 1) return;
if(!elem.hasChildNodes()) return;
var elemContexts = elem.childNodes;
var i = 0,len = contexts.length;
for(;i<len;i++){
if(Selector.indexOf(elemContexts,contexts[i]) != -1){
if(Selector.indexOf(nodes,contexts[i]) == -1){
nodes.push(contexts[i]);
}
}
}
if(nodes.length === 0) return;
var results = [];
for(var j = 1;j<=nodes.length;j++){
if(j % 2 != 0 ){
if(Selector.indexOf(results,nodes[j]) == -1)
results.push(nodes[j]);
}
}
nodes.length = 0;
nodes = results;
}() : [];
}else{
if(!contexts.hasChildNodes()) return;
var elemContexts = contexts.childNodes;
var i = 0,len = elemContexts.length;
var results = [],s = [];
for(;i<len;i++){
if(elemContexts[i].nodeType === 1 && elemContexts[i].nodeName != "#text" && elemContexts[i].nodeName != "BR"){
if(Selector.indexOf(s,elemContexts[i]) == -1){
s.push(elemContexts[i]);
}
}
}
if(s.length === 0) return;
for(var j = 0;j< s.length;j++){
if((j+1) % 2 != 0 ){
if(Selector.indexOf(results,s[j]) == -1)
results.push(s[j]);
}
}
nodes.length = 0;
nodes = results;
}
break;
case Selector.type[7]://even
if(elem){
Selector.isArray(contexts)? function(){
if(contexts.length === 1) return;
if(!elem.hasChildNodes()) return;
var elemContexts = elem.childNodes;
var i = 0,len = contexts.length;
for(;i<len;i++){
if(Selector.indexOf(elemContexts,contexts[i]) != -1){
if(Selector.indexOf(nodes,contexts[i]) == -1){
nodes.push(contexts[i]);
}
}
}
if(nodes.length === 0) return;
var results = [];
for(var j = 1;j<=nodes.length;j++){
if(j % 2 == 0 ){
if(Selector.indexOf(results,nodes[j]) == -1)
results.push(nodes[j]);
}
}
nodes.length = 0;
nodes = results;
}() : [];
}else{
if(!contexts.hasChildNodes()) return;
var elemContexts = contexts.childNodes;
var i = 0,len = elemContexts.length;
var results = [],s = [];
for(;i<len;i++){
if(elemContexts[i].nodeType === 1 && elemContexts[i].nodeName != "#text" && elemContexts[i].nodeName != "BR"){
if(Selector.indexOf(s,elemContexts[i]) == -1){
s.push(elemContexts[i]);
}
}
}
if(s.length === 0) return;
for(var j = 0;j< s.length;j++){
if((j+1) % 2 == 0 ){
if(Selector.indexOf(results,s[j]) == -1)
results.push(s[j]);
}
}
nodes.length = 0;
nodes = results;
}
break;
}
return nodes;
},
isArray : function(obj){
if(!obj.length)
return false;
var length = "length" in obj && obj.length;
if(typeof obj === "function"){
return false;
}
if(obj.nodeType === 1 && length)
return true;
return typeof obj === "array" || length === 0 ||
typeof length === "number" && length > 0 && (length - 1) in obj;
},
isNative:function(fn){
return Selector.Expr.rnative.test(fn + "");
},
indexOf : function(arr,elem){
if(!Selector.isArray(arr))
return -1;
var i = 0,len = arr.length;
for(;i<len;i++){
if(arr[i] === elem){
return i;
}
}
return -1;
},
isObjExsist : function(arr,elem){
if(arr.length === 0){
return false;
}
for(var i = 0;i<arr.length;i++){
var obj = arr[i][0].context;
if(obj === elem.context){
return true;
}
}
return false;
},
isWindow: function( obj ) {
return obj != null && obj == obj.window;
},
isPlainObject:function(obj){
var key;
if ( !obj || typeof obj !== "object" || obj.nodeType || Selector.isWindow( obj ) ) {
return false;
}
try {
if ( obj.constructor && !obj.hasOwnProperty("constructor") && obj.constructor.prototype.hasOwnProperty("isPrototypeOf")) {
return false;
}
} catch ( e ) {
return false;
}
for ( key in obj ) {
return obj.hasOwnProperty(key);
}
//for ( key in obj ) {}
return key === undefined || obj.hasOwnProperty(key);
},
isSupportGetClsName:function(){
return Selector.isNative(document.getElementsByClassName);
},
isQSA:function(){
return Selector.isNative(document.querySelectorAll);
},
each:function(obj,callback,args){
var value,i = 0,length = obj.length;
var isArray = Selector.isArray(obj);
if(args){
if(isArray){
for(;i < length ; i++){
value = callback.apply(obj[i][0],args);
if(value === false) break;
}
}else{
for(i in obj){
value = callback.apply(obj[i][0],args);
if(value === false) break;
}
}
}else{
if(isArray){
for(;i<length;i++){
value = callback.call(obj[i][0], i, obj[i][0].context);
if (value === false) break;
}
}else{
for(i in obj){
value = callback.call(obj[i][0], i, obj[i][0].context);
if (value === false) break;
}
}
}
return obj;
},
data:function(elem,name,data){
var ret,thisCache,isNode = elem.nodeType,cache = isNode?Selector.cache:elem,key = "data",elemKey = "node";
cache[name] = Selector.cache[name] || {};
thisCache = cache[name];
if(data!=undefined){
thisCache[key] = data;
thisCache[elemKey] = thisCache[elemKey] || [];
if(Selector.indexOf(thisCache[elemKey],elem) == -1)
thisCache[elemKey].push(elem);
}
if(!thisCache[elemKey]) return ret;
if(typeof name === "string" && Selector.indexOf(thisCache[elemKey],elem)!=-1) {
ret = thisCache[key];
if (ret == null) {
ret = thisCache[key];
} else {
ret = thisCache;
}
}
return ret;
},
removeData:function(elem,name){
var cache = Selector.cache || {},key = "data",elemKey = "node",thisCache;
cache[name] = Selector.cache[name] || {};
thisCache = cache[name];
thisCache[elemKey] = thisCache[elemKey] || [];
if(thisCache[elemKey].length === 0) return;
var ret = [];
if(Selector.indexOf(thisCache[elemKey],elem) == -1) return;
for(var i =0;i<thisCache[elemKey].length;i++){
var node = thisCache[elemKey][i];
if(node !== elem){
ret.push(node);
}
}
if(ret.length === 0){
delete cache[name];
return;
}
thisCache[elemKey].length = 0;
thisCache[elemKey] = ret;
},
trim : function(text){
var LTrim = function(str){
var i;
for(i=0;i<str.length;i++)
{
if(str.charAt(i)!=" "&&str.charAt(i)!=" ")break;
}
str=str.substring(i,str.length);
return str;
}
var RTrim = function(str){
var i;
for(i=str.length-1;i>=0;i--)
{
if(str.charAt(i)!=" "&&str.charAt(i)!=" ")break;
}
str=str.substring(0,i+1);
return str;
}
return LTrim(RTrim(text));
},
parseJSON:function(data){
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data + "" );
}
var requireNonComma,
depth = null,
str = Selector.trim( data + "" );
return str && !Selector.trim( str.replace( Selector.Expr.rvalidtokens, function( token, comma, open, close ) {
if ( requireNonComma && comma ) {
depth = 0;
}
if ( depth === 0 ) {
return token;
}
// Commas must not follow "[", "{", or ","
requireNonComma = open || comma;
// Determine new depth
// array/object open ("[" or "{"): depth += true - false (increment)
// array/object close ("]" or "}"): depth += false - true (decrement)
// other cases ("," or primitive): depth += true - true (numeric cast)
depth += !close - !open;
// Remove this token
return "";
}) ) ?
( Function( "return " + str ) )() :
Selector.error( "Invalid JSON: " + data );
},
dataAttr:function(elem,key,data){
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-"+key;
data = elem.getAttribute(name);
if(typeof data === "string"){
try{
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
Selector.Expr.rbrace.test( data ) ? Selector.parseJSON( data ) :
data;
}catch (e){}
}else{
data = undefined;
}
}else{
data = data["data"];
}
return data;
}
});
Selector.fn.extend({
val : function(value){
if(!this.context || this.context.length == 0){
if(value != undefined ) return ;
else return "";
}
var elem = this.context;
elem = (elem.type && elem.nodeType === 1)? elem : function(){
if(Selector.isArray(elem)){
var results = [];
for(var i = 0;i<elem.length;i++){
var obj = elem[i];
if(!obj[0] || !obj[0].context) continue;
var type = obj[0].type;
if(type in Selector.Expr.relative) continue;
if(Selector.indexOf(results,obj[0].context) == -1){
results.push(obj[0].context);
}
}
return results;
}else{
return elem[0] ? ( elem[0].context ? (elem[0].context) : null ) : null;
}
}();
if(!elem || elem.length === 0){
if(value != undefined ) return ;
else return "";
}
if(value!= undefined){
(Selector.isArray(elem) === true)?function(){
for(var j =0;j<elem.length;j++){
var obj = elem[j];
(typeof value == "string" && value.constructor== String) ? obj.value = value : ( Selector.isArray(value) === true ? function(){
var str = "";
for(var x = 0;x<value.length;x++){
if(value[x]){
(x != value.length - 1) ? str = str + value[x] + ",":str = str + value[x];
}
}
obj.value = str;
}(): obj.value = value);
}
}():elem.value = value;
}else{
var ret = (Selector.isArray(elem) === true)?function(){
for(var j =0;j<elem.length;j++){
var obj = elem[j];
ret = obj.value;
if(ret != undefined) return ret;
}
}():elem.value;
return ret ? ((typeof ret === "string") ? ret : "") : "";
}
},
each:function(callback,args){
return Selector.each(this.context,callback,args);
},
next:function(value){
return Selector.getNextOrPrevNode.call(this,"next",value);
},
prev:function(value){
return Selector.getNextOrPrevNode.call(this,"prev",value);
},
find:function(value){
if(!this.context || this.context.length == 0 || !value){
this.context = [];
return this;
}
var groups = Pizzle(value);
var ret = Selector.match()(groups,value);
if(ret.length === 0){
this.context = [];
return this;
}
var s = [];
for(var x = 0;x < ret.length;x++){
if(!ret[x][0].context) continue;
if(Selector.indexOf(s,ret[x][0].context) == -1)
s.push(ret[x][0].context);
}
ret.length = 0;
ret = s;
if(ret.length === 0){
this.context = [];
return this;
}
var contexts = this.context,len = contexts.length,c = [];
for(var y = 0;y < len;y++){
var context = contexts[y];
if(!context[0]) continue;
context = context[0];
if(!context || !context.context) continue;
if(Selector.indexOf(c,context.context) == -1)
c.push(context.context);
}
if(c.length === 0){
this.context = [];
return this;
}
var results = [],i = 0;
for(;i<ret.length;i++){
var elemNode = ret[i];
var getParentNode = function(elem){
for(var x = 0;x<c.length;x++){
var node = c[x];
if(elem === node){
if(!Selector.isObjExsist(results,{"context":elemNode}))
results.push([{"context": elemNode}]);
}
}
var _pNode = elem.parentNode;
if(!_pNode) return;
getParentNode(_pNode);
};
var pNode = elemNode.parentNode;
if(!pNode) continue;
getParentNode(pNode);
}
this.context = results;
return this;
},
data:function(key,value){
if(!key || typeof key !== "string") return;
var elem = this.context[0];
if(value){
if(typeof value === "function")
return;
}
return arguments.length > 1?
this.each(function(){
Selector.data(this.context,key,value);
}) : (elem ? Selector.dataAttr(elem[0].context,key,Selector.data(elem[0].context,key)):undefined)
},
removeData:function(key){
if(!key || typeof key !== "string") return;
return this.each(function() {
Selector.removeData( this.context, key );
});
}
});
Selector.extend({
init:function(selector){
if(typeof selector === "string"){
selector = Selector.trim(selector);
if(!Selector.isQSA){
var contexts = document.querySelectorAll(selector);
var len = contexts.length,i = 0;
var results = [];
if(!len || len == 0){
this.context = results;
return this;
}
for(; i < len; i++){
results.push([{
context:contexts[i]?contexts[i]:"",
type:"NODE"
}]);
}
this.context = results;
}else{
groups = Pizzle(selector);
this.groups = groups;
if(!this.groups || this.groups.length == 0)
return this;
this.context = Selector.match()(this.groups,selector);
}
console?console.log(this):"";
return this;
}else if(selector.context && selector.context.nodeType && selector.context.nodeType === 1){//elem
var groups = [];
groups.push([{
sep:selector.sep?selector.sep:"",
type:selector.type?selector.type:"",
value:selector.value?selector.value:""
}]);
this.groups = groups;
this.context = selector.context;
return this;
}
},
getNodeFromRTOL : function(tokens){
var i,token,type,seed = [],flag="",pt="",value;
//i = Selector.Expr.needsContext().test( selector ) ? 0 : tokens.length;
i = tokens.length;
var count = 0;
while(i--){
token = tokens[i];
type = token.type;
value = token.value;
if((!seed[0] || seed[0].length == 0) && count != 0){
count++;
continue;
}
if(type in Selector.filter){
var node = Selector.filter[type](value)();
if(flag === "parentNode" || flag === "previousSibling" ){
var s = [];
for(var j = 0;j<seed[0].length;j++){
var node_context = seed[0][j].context;
var pNode;
if(flag === "parentNode"){
if(pt in Selector.Expr.relative){
pNode = seed[0][j].pNode?seed[0][j].pNode.parentNode:node_context.parentNode;
}else{
pNode = seed[0][j].pNode;
}
}else{
pNode = node_context.previousSibling;
}
if(!pNode)
continue;
flag === "parentNode" ? function(){
for(var t = 0;t < node.length;t++){
if(node[t].context === pNode){
var sNode = pNode;
seed[0][j].pNode = sNode ? sNode : null ;
s.push(seed[0][j]);
return;
}
}
var _pNode = pNode.parentNode;
if(!_pNode) return;
var getParentNode = function(elem){
for(var x = 0;x<node.length;x++){
if(node[x].context === elem){
seed[0][j].pNode = elem ? elem : null ;
s.push(seed[0][j]);
return;
}
}
var _eNode = elem.parentNode;
if(!_eNode) return;
getParentNode(_eNode);
};
getParentNode(_pNode);
}():function(){
var getNode = function(elem){
for(var t = 0;t < node.length;t++){
if(node[t].context === elem){
s.push(seed[0][j]);
return;
}
}
var nNode = elem.previousSibling;
if(!nNode)
return;
return getNode(nNode);
};
getNode(pNode);
}();
}
seed.length = 0;
seed.push(s);
pt = type;
}else{
if((count === 0 || count === 1) && node){
seed.push(node);
count++;
continue;
}
var s = []
for(var j = 0;j<seed[0].length;j++){
var node_context = seed[0][j].context;
if(node_context.nodeName === (value).toUpperCase()){
s.push(seed[0][j]);
}
}
seed.length = 0;
seed.push(s);
}
}else if(type in Selector.Expr.relative){//关系符号
flag = Selector.Expr.relative[type].dir;
pt = type;
}
count++;
}
return seed;
},
getNodeFromLTOR : function(tokens){
var i,token,type,seed = [],flag="",pt="",value,parentToken,childType = "";
i = tokens.length;
var x = 0,count = 0,f = 0;
for(;x<i;x++){
token = tokens[x];
type = token.type;
value = token.value;
if(type in Selector.filter){
if(count === 0 && type === "PSEUDO") break;
var node;
if(type === "PSEUDO"){
count++;
childType = type;
if(childType === "PSEUDO" && flag !== "parentNode" && flag !== "previousSibling" )
node = Selector.filter[childType](value)(seed,parentToken,token);
flag = flag ? (flag === "parentNode" ? (flag = "childNode"):(flag === "previousSibling" ? (flag = "nextSibling"):"")) : "";
(flag === "childNode" || flag === "nextSibling" ) ? function(){
flag === "childNode" ? function(){
node = Selector.filter[childType](value)(seed,parentToken,token);
if(node){
seed.length = 0;
seed.push(node);
}
}():function(){
if(seed.length === 0 || !seed[0]|| !parentToken) return;
node = Selector.filter[parentToken.type](parentToken.value)(token.value);
if(!node || node.length === 0){
seed.length = 0;
return;
}
Selector.getNextNodeFromLTOR(node,seed);
}();
pt = type;
}():function(){
if(count === 0 && node){
seed.push(node);
count++;
return;
}
if(node){
seed.length = 0;
seed.push(node);
}
}();
}else{
//node = Selector.filter[type](value)();
if(seed.length === 0 && f !==0) return seed;
if((!seed[0] || seed[0].length === 0) && f !==0) return seed;
var pf = false;
var p = x + 1;
if(p <= (i - 1)){
var tk = tokens[p];
if(tk){
var tk_type = tk.type;
if(tk_type === "PSEUDO"){
pf = true;
}
/*if(tk.value in Selector.Expr.relative){
isRelative = true;
}*/
}
}
if(pf){
parentToken = token;
count++;
continue;
}else{
var t_node = Selector.filter[type](value)();
if(t_node.length > 0){
if(seed.length === 0 && f === 0){
seed.push(t_node);
f++;
}else{
if(flag === "parentNode" || flag === "previousSibling"){
flag === "parentNode" ? function(){
var s = [];
var getParentNode = function(node,elem,type,value){
for(var t = 0;t<seed[0].length;t++){
if(!seed[0] || !seed[0][t]) continue;
if(elem === seed[0][t].context){
s.push({"context":node,sep:seed[0][t].sep,type:type,value:value});
return;
}
}
var _eNode = elem.parentNode;
if(!_eNode) return;
getParentNode(node,_eNode,type,value);
};
for(var n = 0;n<t_node.length;n++){
var _t_node = t_node[n];
if(!_t_node || !_t_node.context) continue;
var pNode = _t_node.context.parentNode;
if(!pNode) continue;
getParentNode(_t_node.context,pNode,_t_node.type,_t_node.value);
}
seed.length = 0;
seed.push(s);
flag = "";
}():function(){
Selector.getNextNodeFromLTOR(t_node,seed);
flag = "";
}();
}else{
var s = [];
for(var n = 0;n<t_node.length;n++){
var _t_node = t_node[n];
if(!_t_node || !_t_node.context) continue;
for(var t = 0;t<seed[0].length;t++){
if(!seed[0] || !seed[0][t]) continue;
if(_t_node.context === seed[0][t].context){
s.push(seed[0][t]);
}
}
}
seed.length = 0;
seed.push(s);
}
}
}else{
seed.length = 0;
return seed;
}
}
}
}else if(type in Selector.Expr.relative){//关系符号
flag = Selector.Expr.relative[type].dir;
pt = type;
childType = type;
}
}
return seed;
},
getNextNodeFromLTOR :function(node,seed){
var x = [];
var pNode;
var getPNode = function(newNode){
pNode = newNode?newNode.previousSibling:node[0].context.previousSibling;
if(!pNode) return;
if(pNode.nodeType === 1 && pNode.nodeName !== "#text" && pNode.nodeName !== "BR"){
return;
}else{
getPNode(pNode);
}
};
var judgeNode = function(ret,elem){
if(ret.length === 0) return false;
for(var i = 0;i<ret.length;i++){
var i_node = ret[i];
if(!i_node || !i_node.context) continue;
if(i_node.context === elem){
return true;
}
}
return false;
};
var getNode = function(elem,sep,type,value,node){
if(!node) return;
for(var t = 0;t < seed[0].length;t++){
if(seed[0][t].context === node){
if(!judgeNode(x,elem.context)){
x.push({"context":elem.context,sep:sep,type:type,value:value});
return;
}
return;
}
}
};
for(var k =0;k<node.length;k++){
var k_node = node[k];
if(!k_node || !k_node.context) continue;
pNode = undefined;
getPNode(k_node.context);
getNode(k_node,k_node.sep,k_node.type,k_node.value,pNode);
}
if(x.length === 0 ){
seed.length = 0;
return;
}
if(x.length > 0){
seed.length = 0;
seed.push(x);
}
},
select:function(){
return function(selector,tokens){
if(tokens.length == 0){
return [];
}
var hasPseduo = false;
for(var i = 0;i<tokens.length;i++){
var token = tokens[i];
var type = token.type;
if(type === "PSEUDO"){
hasPseduo = true;
break;
}
}
var seed = [];
if(hasPseduo){
seed = Selector.getNodeFromLTOR(tokens);
}else{
seed = Selector.getNodeFromRTOL(tokens);
}
if(seed.length === 0 || !seed[0]) return seed;
var ret = Selector.getNodeByPC(seed[0]);
seed.length = 0;
seed.push(ret);
return seed;
}
},
match:function(){
return function(tokens,selector){
var results = [];
for(var i =0;i<tokens.length;i++){
var seed = Selector.select()(selector,tokens[i]);
if(seed.length > 0)
results.push(seed);
}
if(results.length != 0 )
results = Selector.analysisGroup()(results);
return results;
};
},
analysisGroup:function(){
return function(groups){
var results = [];
var i = 0,len = groups.length;
for(;i<len;i++){
var obj = groups[i][0];
if(obj.length == 0) continue;
if(!obj) continue;
for(var x =0;x<obj.length;x++){
var _obj = obj[x],type = _obj.type,value = _obj.value;
if(!value) continue;
if(type in Selector.Expr.relative) continue;
if(!Selector.isObjExsist(results,_obj)){
results.push([_obj]);
}
}
}
return results;
}
},
getNextOrPrevNode:function(cur,value){
if(!this.context || this.context.length == 0){
this.context = [];
return this;
}
var flag = value ? true : false;
var x = 0,results = [],contexts = this.context,len = contexts.length;
for(;x<len;x++){
var context = contexts[x];
if(!context[0]) continue;
context = context[0];
if(!context || !context.context) continue;
var ret = [];
if(flag){
var groups = Pizzle(value);
ret = Selector.match()(groups,value);
if(ret.length === 0) continue;
var s = [];
for(var j = 0;j<ret.length;j++){
if(!ret[j][0].context) continue;
if(Selector.indexOf(ret,ret[j][0].context) == -1)
s.push(ret[j][0].context);
}
ret.length = 0;
ret = s;
}
var getNextPrevNode = function(elem){
var nextPrevNode = (cur === "next") ? elem.nextSibling : elem.previousSibling;
if(!nextPrevNode) return;
if(!nextPrevNode.nodeType || nextPrevNode.nodeType != 1) getNextPrevNode(nextPrevNode);
nextPrevNode.hasChildNodes()? function(){
var getChildNode = function (elem) {
var childNodes = elem.childNodes;
if(childNodes.length === 0) return;
var y = 0,cLen = childNodes.length;
for(;y < cLen; y++){
var cNode = childNodes[y];
if(cNode.hasChildNodes()){
getChildNode(cNode);
}
if(cNode.nodeType && cNode.nodeType === 1){
if(Selector.indexOf(ret,cNode)!= -1){
if(Selector.indexOf(results,cNode.context) == -1 && cNode.nodeName != "#text" && cNode.nodeName != "BR") {
results.push([{"context": cNode}]);
}
}
}
}
};
getChildNode(nextPrevNode);
getNextPrevNode(nextPrevNode);
}():function(){
if(nextPrevNode.nodeType && nextPrevNode.nodeType === 1){
flag === true ? function(){
Selector.indexOf(ret,nextPrevNode)!= -1 ? function(){
if(Selector.indexOf(results,nextPrevNode.context) == -1 && nextPrevNode.nodeName != "#text" && nextPrevNode.nodeName != "BR") {
results.push([{"context": nextPrevNode}]);
getNextPrevNode(nextPrevNode);
}
}(): getNextPrevNode(nextPrevNode);
}():function(){
if(Selector.indexOf(results,nextPrevNode.context) == -1 && nextPrevNode.nodeName != "#text" && nextPrevNode.nodeName != "BR") {
results.push([{"context": nextPrevNode}]);
}
}();
}
}();
};
getNextPrevNode(context.context);
}
this.context = results;
return this;
}
});
return Selector;
})(Pizzle);
function getSelector(selector){
return new Selector(selector);
}
window._ = window.$ = getSelector;
})(window,document,undefined,Pizzle);
/**
节点类型 描述 子节点
1 Element 代表元素 Element, Text, Comment, ProcessingInstruction, CDATASection, EntityReference
2 Attr 代表属性 Text, EntityReference
3 Text 代表元素或属性中的文本内容。 None
4 CDATASection 代表文档中的 CDATA 部分(不会由解析器解析的文本)。 None
5 EntityReference 代表实体引用。 Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
6 Entity 代表实体。 Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
7 ProcessingInstruction 代表处理指令。 None
8 Comment 代表注释。 None
9 Document 代表整个文档(DOM 树的根节点)。 Element, ProcessingInstruction, Comment, DocumentType
10 DocumentType 向为文档定义的实体提供接口 None
11 DocumentFragment 代表轻量级的 Document 对象,能够容纳文档的某个部分 Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
12 Notation 代表 DTD 中声明的符号。 None;
**/
|
var Immutable = require('./immutable');
module.exports = function (data, builder, options) {
builder.type = 'Date';
builder.defineMethod('mutate', function (cb) {
var newDate = new Date(data.valueOf());
cb.apply(newDate);
return Immutable.create(newDate, { clone: false });
});
['toString', 'toISOString', 'toUTCString', 'toDateString', 'toTimeString',
'toLocaleString', 'toLocaleDateString', 'toLocaleTimeString', 'valueOf',
'getTime', 'getFullYear', 'getUTCFullYear', 'toGMTString', 'getMonth',
'getUTCMonth', 'getDate', 'getUTCDate', 'getDay', 'getUTCDay', 'getHours',
'getUTCHours', 'getMinutes', 'getUTCMinutes', 'getSeconds', 'getUTCSeconds',
'getMilliseconds', 'getUTCMilliseconds', 'getTimezoneOffset', 'getYear',
'toJSON'].forEach(function (name) {
builder.defineMethod(name, function () {
var args = Array(arguments.length);
for (var i = 0, l = args.length; i < l; i++) {
args[i] = arguments[i];
}
return Date.prototype[name].apply(data, args);
});
});
['setTime', 'setMilliseconds', 'setUTCMilliseconds', 'setSeconds',
'setUTCSeconds', 'setMinutes', 'setUTCMinutes', 'setHours', 'setUTCHours',
'setDate', 'setUTCDate', 'setMonth', 'setUTCMonth', 'setFullYear',
'setUTCFullYear', 'setYear'].forEach(function (name) {
builder.defineMethod(name, function () {
var args = Array(arguments.length);
for (var i = 0, l = args.length; i < l; i++) {
args[i] = arguments[i];
}
var newDate = new Date(data.valueOf());
newDate[name].apply(newDate, args);
return Immutable.create(newDate, options);
});
});
};
|
process.env.NODE_ENV = 'test';
//Require the dev-dependencies
var chai = require('chai');
var chaiUserTwo = require('chai');
var chaiHttp = require('chai-http');
var chaiHttpTwo = require('chai-http');
var testServer = require('./server');
var should = chai.should();
var assert = require('assert');
chai.use(chaiHttp);
chaiUserTwo.use(chaiHttpTwo);
var server = testServer.app;
var appServer = testServer.server;
var longpoll = require("../index.js")(server);
describe('express-longpoll', function () {
// Set timeout
this.timeout(10000);
// before all tests
before((done) => {
// Create longpoll
longpoll.create("/poll");
done();
});
after((done) => {
// shutdown server
done();
appServer.close();
});
beforeEach((done) => {
//Before each test
done();
});
describe('longpoll.create(url, data)', () => {
it('should create a .get express endpoint', (done) => {
//console.log(JSON.stringify(server._router.stack, null, 4));
server._router.stack.forEach((val, indx) => {
if (typeof val.route !== "undefined") {
if (typeof val.route.path !== "undefined") {
assert.equal(val.route.path, "/poll");
done();
}
}
});
});
});
describe('longpoll.publish(url, data)', () => {
it('should publish data to all requests listening on a url', (done) => {
var requestPoll = function (pollCount) {
chai.request(server)
.get('/poll')
.end((err, res) => {
res.should.have.status(200);
res.body.should.equal("POLL-"+pollCount);
//console.log(res.body);
if (pollCount<10){
requestPoll(++pollCount);
} else {
done();
}
});
};
// Create request chain
requestPoll(0);
// Publish to all requests only once
var pollId = 0;
var pubInterval = setInterval(() => {
longpoll.publish("/poll", "POLL-"+pollId);
pollId++;
if (pollId > 10) {
clearInterval(pubInterval);
}
}, 200);
});
});
describe('longpoll.publish(url, data)', () => {
it('should publish data to all clients requests listening on a url', (done) => {
var usersDone = 2;
var requestPoll = function (pollCount) {
if (pollCount === 10 || usersDone !== 2) {
return;
} else {
pollCount++;
usersDone = 0;
}
// user 1
chai.request(server)
.get('/poll')
.end((err, res) => {
// console.log("USER 1: "+res.body);
res.should.have.status(200);
res.body.should.equal("POLL-"+pollCount);
usersDone++;
requestPoll(pollCount);
});
// user 2
chaiUserTwo.request(server)
.get('/poll')
.end((err, res) => {
// console.log("USER 2: "+res.body);
res.should.have.status(200);
res.body.should.equal("POLL-"+pollCount);
usersDone++;
requestPoll(pollCount);
});
};
// Create request chain
requestPoll(-1);
// Publish to all requests only once
var pollId = 0;
var pubInterval = setInterval(() => {
longpoll.publish("/poll", "POLL-"+pollId);
pollId++;
if (pollId > 10) {
clearInterval(pubInterval);
done();
}
}, 200);
});
});
});
|
const { Page } = require("./model")
const { PagePerm } = require("./perm")
const { useMsaBoxesRouter } = Msa.require("utils")
const { db } = Msa.require("db")
const { userMdw, unauthHtml } = Msa.require("user")
class MsaPageModule extends Msa.Module {
constructor() {
super()
this.initApp()
}
getId(req, reqId) {
return `page-${reqId}`
}
getUserId(req) {
const user = req.user
return user ? user.id : req.connection.remoteAddress
}
getUserName(req, reqUserName) {
const user = req.user
return user ? user.name : reqUserName
}
canRead(req, page) {
const perm = page.params.perm.get()
return perm.check(req.user, PagePerm.READ)
}
canWrite(req, page) {
const perm = page.params.perm.get()
return perm.check(req.user, PagePerm.WRITE)
}
canAdmin(req, page) {
const perm = page.params.perm.get()
return perm.check(req.user, PagePerm.ADMIN)
}
initApp() {
// get page
this.app.get("/:id", async (req, res, next) => {
const reqId = req.params.id
if (reqId.indexOf('.') >= 0)
return next()
const id = this.getId(req, reqId)
const page = await this.getPage(req, id)
res.sendPage({
head: page.head,
body: {
wel: "/msa/page/msa-page.js",
attrs: {
'page-id': reqId,
'editable': this.canWrite(req, page),
'fetch': 'false'
},
content: page.body
}
})
})
this.app.get("/:id/_page", userMdw, async (req, res, next) => {
try {
const id = this.getId(req, req.params.id)
const page = await this.getPage(req, id)
res.json(this.exportPage(req, page))
} catch(err) { next(err) }
})
this.app.post("/:id/_page", userMdw, async (req, res, next) => {
try {
const id = this.getId(req, req.params.id)
const { head, body, by } = req.body
await this.upsertPage(req, id, head, body, { by })
res.sendStatus(Msa.OK)
} catch(err) { next(err) }
})
// MSA boxes
useMsaBoxesRouter(this.app, '/:id/_box', req => ({
parentId: `page-${req.params.id}`
}))
}
async getPage(req, id) {
const dbPage = await db.collection("msa_pages").findOne({ _id:id })
const page = Page.newFromDb(id, dbPage)
if (!this.canRead(req, page)) throw Msa.FORBIDDEN
return page
}
exportPage(req, page) {
return {
id: page.id,
head: page.head,
body: page.body,
createdById: page.createdById,
createdBy: page.createdBy,
updatedBy: page.updatedBy,
createdAt: page.createdAt ? page.createdAt.toISOString() : null,
updatedAt: page.updatedAt ? page.updatedAt.toISOString() : null,
canEdit: this.canWrite(req, page)
}
}
async upsertPage(req, id, head, body, kwargs) {
const page = await this.getPage(req, id)
if (!this.canWrite(req, page)) throw Msa.FORBIDDEN
page.head = head
page.body = body
page.updatedBy = this.getUserName(req, kwargs && kwargs.by)
page.updatedAt = new Date(Date.now())
if (!page.createdById) {
page.createdById = this.getUserId(req)
page.createdBy = page.updatedBy
page.createdAt = page.updatedAt
}
await db.collection("msa_pages").updateOne({ _id:id }, { $set: page.formatForDb() }, { upsert: true })
}
}
// export
module.exports = {
startMsaModule: () => new MsaPageModule(),
MsaPageModule
}
|
IntlPolyfill.__addLocaleData({
locale: "da",
date: {
ca: ["gregory",
"buddhist",
"chinese",
"coptic",
"dangi",
"ethioaa",
"ethiopic",
"generic",
"hebrew",
"indian",
"islamic",
"islamicc",
"japanese",
"persian",
"roc"],
hourNo0: true,
hour12: false,
formats: {
short: "{1} {0}",
medium: "{1} {0}",
full: "{1} 'kl'. {0}",
long: "{1} 'kl'. {0}",
availableFormats: {
"d": "d.",
"E": "ccc",
Ed: "E 'den' d.",
Ehm: "E h.mm a",
EHm: "E HH.mm",
Ehms: "E h.mm.ss a",
EHms: "E HH.mm.ss",
Gy: "y G",
GyMMM: "MMM y G",
GyMMMd: "d. MMM y G",
GyMMMEd: "E d. MMM y G",
"h": "h a",
"H": "HH",
hm: "h.mm a",
Hm: "HH.mm",
hms: "h.mm.ss a",
Hms: "HH.mm.ss",
hmsv: "h.mm.ss a v",
Hmsv: "HH.mm.ss v",
hmv: "h.mm a v",
Hmv: "HH.mm v",
"M": "M",
Md: "d/M",
MEd: "E d/M",
MMdd: "dd/MM",
MMM: "MMM",
MMMd: "d. MMM",
MMMEd: "E d. MMM",
MMMMd: "d. MMMM",
MMMMEd: "E d. MMMM",
ms: "mm.ss",
"y": "y",
yM: "M/y",
yMd: "d/M/y",
yMEd: "E d/M/y",
yMM: "MM/y",
yMMM: "MMM y",
yMMMd: "d. MMM y",
yMMMEd: "E d. MMM y",
yMMMM: "MMMM y",
yQQQ: "QQQ y",
yQQQQ: "QQQQ y"
},
dateFormats: {
yMMMMEEEEd: "EEEE 'den' d. MMMM y",
yMMMMd: "d. MMMM y",
yMMMd: "d. MMM y",
yMd: "dd/MM/y"
},
timeFormats: {
hmmsszzzz: "HH.mm.ss zzzz",
hmsz: "HH.mm.ss z",
hms: "HH.mm.ss",
hm: "HH.mm"
}
},
calendars: {
buddhist: {
months: {
narrow: ["J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D"],
short: ["jan.",
"feb.",
"mar.",
"apr.",
"maj",
"jun.",
"jul.",
"aug.",
"sep.",
"okt.",
"nov.",
"dec."],
long: ["januar",
"februar",
"marts",
"april",
"maj",
"juni",
"juli",
"august",
"september",
"oktober",
"november",
"december"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {narrow: ["BE"], short: ["BE"], long: ["BE"]},
dayPeriods: {am: "AM", pm: "PM"}
},
chinese: {
months: {
narrow: ["1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"],
short: ["M01",
"M02",
"M03",
"M04",
"M05",
"M06",
"M07",
"M08",
"M09",
"M10",
"M11",
"M12"],
long: ["M01",
"M02",
"M03",
"M04",
"M05",
"M06",
"M07",
"M08",
"M09",
"M10",
"M11",
"M12"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
dayPeriods: {am: "AM", pm: "PM"}
},
coptic: {
months: {
narrow: ["1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13"],
short: ["Tout",
"Baba",
"Hator",
"Kiahk",
"Toba",
"Amshir",
"Baramhat",
"Baramouda",
"Bashans",
"Paona",
"Epep",
"Mesra",
"Nasie"],
long: ["Tout",
"Baba",
"Hator",
"Kiahk",
"Toba",
"Amshir",
"Baramhat",
"Baramouda",
"Bashans",
"Paona",
"Epep",
"Mesra",
"Nasie"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {
narrow: ["ERA0",
"ERA1"],
short: ["ERA0",
"ERA1"],
long: ["ERA0",
"ERA1"]
},
dayPeriods: {am: "AM", pm: "PM"}
},
dangi: {
months: {
narrow: ["1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"],
short: ["M01",
"M02",
"M03",
"M04",
"M05",
"M06",
"M07",
"M08",
"M09",
"M10",
"M11",
"M12"],
long: ["M01",
"M02",
"M03",
"M04",
"M05",
"M06",
"M07",
"M08",
"M09",
"M10",
"M11",
"M12"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
dayPeriods: {am: "AM", pm: "PM"}
},
ethiopic: {
months: {
narrow: ["1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13"],
short: ["Meskerem",
"Tekemt",
"Hedar",
"Tahsas",
"Ter",
"Yekatit",
"Megabit",
"Miazia",
"Genbot",
"Sene",
"Hamle",
"Nehasse",
"Pagumen"],
long: ["Meskerem",
"Tekemt",
"Hedar",
"Tahsas",
"Ter",
"Yekatit",
"Megabit",
"Miazia",
"Genbot",
"Sene",
"Hamle",
"Nehasse",
"Pagumen"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {
narrow: ["ERA0",
"ERA1"],
short: ["ERA0",
"ERA1"],
long: ["ERA0",
"ERA1"]
},
dayPeriods: {am: "AM", pm: "PM"}
},
ethioaa: {
months: {
narrow: ["1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13"],
short: ["Meskerem",
"Tekemt",
"Hedar",
"Tahsas",
"Ter",
"Yekatit",
"Megabit",
"Miazia",
"Genbot",
"Sene",
"Hamle",
"Nehasse",
"Pagumen"],
long: ["Meskerem",
"Tekemt",
"Hedar",
"Tahsas",
"Ter",
"Yekatit",
"Megabit",
"Miazia",
"Genbot",
"Sene",
"Hamle",
"Nehasse",
"Pagumen"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {narrow: ["ERA0"], short: ["ERA0"], long: ["ERA0"]},
dayPeriods: {am: "AM", pm: "PM"}
},
generic: {
months: {
narrow: ["1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"],
short: ["M01",
"M02",
"M03",
"M04",
"M05",
"M06",
"M07",
"M08",
"M09",
"M10",
"M11",
"M12"],
long: ["M01",
"M02",
"M03",
"M04",
"M05",
"M06",
"M07",
"M08",
"M09",
"M10",
"M11",
"M12"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {
narrow: ["ERA0",
"ERA1"],
short: ["ERA0",
"ERA1"],
long: ["ERA0",
"ERA1"]
},
dayPeriods: {am: "AM", pm: "PM"}
},
gregory: {
months: {
narrow: ["J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D"],
short: ["jan.",
"feb.",
"mar.",
"apr.",
"maj",
"jun.",
"jul.",
"aug.",
"sep.",
"okt.",
"nov.",
"dec."],
long: ["januar",
"februar",
"marts",
"april",
"maj",
"juni",
"juli",
"august",
"september",
"oktober",
"november",
"december"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {
narrow: ["fKr",
"eKr",
"fvt",
"vt"],
short: ["f.Kr.",
"e.Kr.",
"f.v.t.",
"v.t."],
long: ["f.Kr.",
"e.Kr.",
"før vesterlandsk tidsregning",
"vesterlandsk tidsregning"]
},
dayPeriods: {am: "AM", pm: "PM"}
},
hebrew: {
months: {
narrow: ["1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"7"],
short: ["Tishri",
"Heshvan",
"Kislev",
"Tevet",
"Shevat",
"Adar I",
"Adar",
"Nisan",
"Iyar",
"Sivan",
"Tamuz",
"Av",
"Elul",
"Adar II"],
long: ["Tishri",
"Heshvan",
"Kislev",
"Tevet",
"Shevat",
"Adar I",
"Adar",
"Nisan",
"Iyar",
"Sivan",
"Tamuz",
"Av",
"Elul",
"Adar II"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {narrow: ["AM"], short: ["AM"], long: ["AM"]},
dayPeriods: {am: "AM", pm: "PM"}
},
indian: {
months: {
narrow: ["1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"],
short: ["Chaitra",
"Vaisakha",
"Jyaistha",
"Asadha",
"Sravana",
"Bhadra",
"Asvina",
"Kartika",
"Agrahayana",
"Pausa",
"Magha",
"Phalguna"],
long: ["Chaitra",
"Vaisakha",
"Jyaistha",
"Asadha",
"Sravana",
"Bhadra",
"Asvina",
"Kartika",
"Agrahayana",
"Pausa",
"Magha",
"Phalguna"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {narrow: ["Saka"], short: ["Saka"], long: ["Saka"]},
dayPeriods: {am: "AM", pm: "PM"}
},
islamic: {
months: {
narrow: ["1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"],
short: ["Muh.",
"Saf.",
"Rab. I",
"Rab. II",
"Jum. I",
"Jum. II",
"Raj.",
"Sha.",
"Ram.",
"Shaw.",
"Dhuʻl-Q.",
"Dhuʻl-H."],
long: ["Muharram",
"Safar",
"Rabiʻ I",
"Rabiʻ II",
"Jumada I",
"Jumada II",
"Rajab",
"Shaʻban",
"Ramadan",
"Shawwal",
"Dhuʻl-Qiʻdah",
"Dhuʻl-Hijjah"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {narrow: ["AH"], short: ["AH"], long: ["AH"]},
dayPeriods: {am: "AM", pm: "PM"}
},
islamicc: {
months: {
narrow: ["1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"],
short: ["Muh.",
"Saf.",
"Rab. I",
"Rab. II",
"Jum. I",
"Jum. II",
"Raj.",
"Sha.",
"Ram.",
"Shaw.",
"Dhuʻl-Q.",
"Dhuʻl-H."],
long: ["Muharram",
"Safar",
"Rabiʻ I",
"Rabiʻ II",
"Jumada I",
"Jumada II",
"Rajab",
"Shaʻban",
"Ramadan",
"Shawwal",
"Dhuʻl-Qiʻdah",
"Dhuʻl-Hijjah"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {narrow: ["AH"], short: ["AH"], long: ["AH"]},
dayPeriods: {am: "AM", pm: "PM"}
},
japanese: {
months: {
narrow: ["J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D"],
short: ["jan.",
"feb.",
"mar.",
"apr.",
"maj",
"jun.",
"jul.",
"aug.",
"sep.",
"okt.",
"nov.",
"dec."],
long: ["januar",
"februar",
"marts",
"april",
"maj",
"juni",
"juli",
"august",
"september",
"oktober",
"november",
"december"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {
narrow: ["Taika (645–650)",
"Hakuchi (650–671)",
"Hakuhō (672–686)",
"Shuchō (686–701)",
"Taihō (701–704)",
"Keiun (704–708)",
"Wadō (708–715)",
"Reiki (715–717)",
"Yōrō (717–724)",
"Jinki (724–729)",
"Tenpyō (729–749)",
"Tenpyō-kampō (749-749)",
"Tenpyō-shōhō (749-757)",
"Tenpyō-hōji (757-765)",
"Tenpyō-jingo (765-767)",
"Jingo-keiun (767-770)",
"Hōki (770–780)",
"Ten-ō (781-782)",
"Enryaku (782–806)",
"Daidō (806–810)",
"Kōnin (810–824)",
"Tenchō (824–834)",
"Jōwa (834–848)",
"Kajō (848–851)",
"Ninju (851–854)",
"Saikō (854–857)",
"Ten-an (857-859)",
"Jōgan (859–877)",
"Gangyō (877–885)",
"Ninna (885–889)",
"Kanpyō (889–898)",
"Shōtai (898–901)",
"Engi (901–923)",
"Enchō (923–931)",
"Jōhei (931–938)",
"Tengyō (938–947)",
"Tenryaku (947–957)",
"Tentoku (957–961)",
"Ōwa (961–964)",
"Kōhō (964–968)",
"Anna (968–970)",
"Tenroku (970–973)",
"Ten’en (973–976)",
"Jōgen (976–978)",
"Tengen (978–983)",
"Eikan (983–985)",
"Kanna (985–987)",
"Eien (987–989)",
"Eiso (989–990)",
"Shōryaku (990–995)",
"Chōtoku (995–999)",
"Chōhō (999–1004)",
"Kankō (1004–1012)",
"Chōwa (1012–1017)",
"Kannin (1017–1021)",
"Jian (1021–1024)",
"Manju (1024–1028)",
"Chōgen (1028–1037)",
"Chōryaku (1037–1040)",
"Chōkyū (1040–1044)",
"Kantoku (1044–1046)",
"Eishō (1046–1053)",
"Tengi (1053–1058)",
"Kōhei (1058–1065)",
"Jiryaku (1065–1069)",
"Enkyū (1069–1074)",
"Shōho (1074–1077)",
"Shōryaku (1077–1081)",
"Eihō (1081–1084)",
"Ōtoku (1084–1087)",
"Kanji (1087–1094)",
"Kahō (1094–1096)",
"Eichō (1096–1097)",
"Jōtoku (1097–1099)",
"Kōwa (1099–1104)",
"Chōji (1104–1106)",
"Kashō (1106–1108)",
"Tennin (1108–1110)",
"Ten-ei (1110-1113)",
"Eikyū (1113–1118)",
"Gen’ei (1118–1120)",
"Hōan (1120–1124)",
"Tenji (1124–1126)",
"Daiji (1126–1131)",
"Tenshō (1131–1132)",
"Chōshō (1132–1135)",
"Hōen (1135–1141)",
"Eiji (1141–1142)",
"Kōji (1142–1144)",
"Ten’yō (1144–1145)",
"Kyūan (1145–1151)",
"Ninpei (1151–1154)",
"Kyūju (1154–1156)",
"Hōgen (1156–1159)",
"Heiji (1159–1160)",
"Eiryaku (1160–1161)",
"Ōho (1161–1163)",
"Chōkan (1163–1165)",
"Eiman (1165–1166)",
"Nin’an (1166–1169)",
"Kaō (1169–1171)",
"Shōan (1171–1175)",
"Angen (1175–1177)",
"Jishō (1177–1181)",
"Yōwa (1181–1182)",
"Juei (1182–1184)",
"Genryaku (1184–1185)",
"Bunji (1185–1190)",
"Kenkyū (1190–1199)",
"Shōji (1199–1201)",
"Kennin (1201–1204)",
"Genkyū (1204–1206)",
"Ken’ei (1206–1207)",
"Jōgen (1207–1211)",
"Kenryaku (1211–1213)",
"Kenpō (1213–1219)",
"Jōkyū (1219–1222)",
"Jōō (1222–1224)",
"Gennin (1224–1225)",
"Karoku (1225–1227)",
"Antei (1227–1229)",
"Kanki (1229–1232)",
"Jōei (1232–1233)",
"Tenpuku (1233–1234)",
"Bunryaku (1234–1235)",
"Katei (1235–1238)",
"Ryakunin (1238–1239)",
"En’ō (1239–1240)",
"Ninji (1240–1243)",
"Kangen (1243–1247)",
"Hōji (1247–1249)",
"Kenchō (1249–1256)",
"Kōgen (1256–1257)",
"Shōka (1257–1259)",
"Shōgen (1259–1260)",
"Bun’ō (1260–1261)",
"Kōchō (1261–1264)",
"Bun’ei (1264–1275)",
"Kenji (1275–1278)",
"Kōan (1278–1288)",
"Shōō (1288–1293)",
"Einin (1293–1299)",
"Shōan (1299–1302)",
"Kengen (1302–1303)",
"Kagen (1303–1306)",
"Tokuji (1306–1308)",
"Enkyō (1308–1311)",
"Ōchō (1311–1312)",
"Shōwa (1312–1317)",
"Bunpō (1317–1319)",
"Genō (1319–1321)",
"Genkō (1321–1324)",
"Shōchū (1324–1326)",
"Karyaku (1326–1329)",
"Gentoku (1329–1331)",
"Genkō (1331–1334)",
"Kenmu (1334–1336)",
"Engen (1336–1340)",
"Kōkoku (1340–1346)",
"Shōhei (1346–1370)",
"Kentoku (1370–1372)",
"Bunchū (1372–1375)",
"Tenju (1375–1379)",
"Kōryaku (1379–1381)",
"Kōwa (1381–1384)",
"Genchū (1384–1392)",
"Meitoku (1384–1387)",
"Kakei (1387–1389)",
"Kōō (1389–1390)",
"Meitoku (1390–1394)",
"Ōei (1394–1428)",
"Shōchō (1428–1429)",
"Eikyō (1429–1441)",
"Kakitsu (1441–1444)",
"Bun’an (1444–1449)",
"Hōtoku (1449–1452)",
"Kyōtoku (1452–1455)",
"Kōshō (1455–1457)",
"Chōroku (1457–1460)",
"Kanshō (1460–1466)",
"Bunshō (1466–1467)",
"Ōnin (1467–1469)",
"Bunmei (1469–1487)",
"Chōkyō (1487–1489)",
"Entoku (1489–1492)",
"Meiō (1492–1501)",
"Bunki (1501–1504)",
"Eishō (1504–1521)",
"Taiei (1521–1528)",
"Kyōroku (1528–1532)",
"Tenbun (1532–1555)",
"Kōji (1555–1558)",
"Eiroku (1558–1570)",
"Genki (1570–1573)",
"Tenshō (1573–1592)",
"Bunroku (1592–1596)",
"Keichō (1596–1615)",
"Genna (1615–1624)",
"Kan’ei (1624–1644)",
"Shōho (1644–1648)",
"Keian (1648–1652)",
"Jōō (1652–1655)",
"Meireki (1655–1658)",
"Manji (1658–1661)",
"Kanbun (1661–1673)",
"Enpō (1673–1681)",
"Tenna (1681–1684)",
"Jōkyō (1684–1688)",
"Genroku (1688–1704)",
"Hōei (1704–1711)",
"Shōtoku (1711–1716)",
"Kyōhō (1716–1736)",
"Genbun (1736–1741)",
"Kanpō (1741–1744)",
"Enkyō (1744–1748)",
"Kan’en (1748–1751)",
"Hōreki (1751–1764)",
"Meiwa (1764–1772)",
"An’ei (1772–1781)",
"Tenmei (1781–1789)",
"Kansei (1789–1801)",
"Kyōwa (1801–1804)",
"Bunka (1804–1818)",
"Bunsei (1818–1830)",
"Tenpō (1830–1844)",
"Kōka (1844–1848)",
"Kaei (1848–1854)",
"Ansei (1854–1860)",
"Man’en (1860–1861)",
"Bunkyū (1861–1864)",
"Genji (1864–1865)",
"Keiō (1865–1868)",
"M",
"T",
"S",
"H"],
short: ["Taika (645–650)",
"Hakuchi (650–671)",
"Hakuhō (672–686)",
"Shuchō (686–701)",
"Taihō (701–704)",
"Keiun (704–708)",
"Wadō (708–715)",
"Reiki (715–717)",
"Yōrō (717–724)",
"Jinki (724–729)",
"Tenpyō (729–749)",
"Tenpyō-kampō (749-749)",
"Tenpyō-shōhō (749-757)",
"Tenpyō-hōji (757-765)",
"Tenpyō-jingo (765-767)",
"Jingo-keiun (767-770)",
"Hōki (770–780)",
"Ten-ō (781-782)",
"Enryaku (782–806)",
"Daidō (806–810)",
"Kōnin (810–824)",
"Tenchō (824–834)",
"Jōwa (834–848)",
"Kajō (848–851)",
"Ninju (851–854)",
"Saikō (854–857)",
"Ten-an (857-859)",
"Jōgan (859–877)",
"Gangyō (877–885)",
"Ninna (885–889)",
"Kanpyō (889–898)",
"Shōtai (898–901)",
"Engi (901–923)",
"Enchō (923–931)",
"Jōhei (931–938)",
"Tengyō (938–947)",
"Tenryaku (947–957)",
"Tentoku (957–961)",
"Ōwa (961–964)",
"Kōhō (964–968)",
"Anna (968–970)",
"Tenroku (970–973)",
"Ten’en (973–976)",
"Jōgen (976–978)",
"Tengen (978–983)",
"Eikan (983–985)",
"Kanna (985–987)",
"Eien (987–989)",
"Eiso (989–990)",
"Shōryaku (990–995)",
"Chōtoku (995–999)",
"Chōhō (999–1004)",
"Kankō (1004–1012)",
"Chōwa (1012–1017)",
"Kannin (1017–1021)",
"Jian (1021–1024)",
"Manju (1024–1028)",
"Chōgen (1028–1037)",
"Chōryaku (1037–1040)",
"Chōkyū (1040–1044)",
"Kantoku (1044–1046)",
"Eishō (1046–1053)",
"Tengi (1053–1058)",
"Kōhei (1058–1065)",
"Jiryaku (1065–1069)",
"Enkyū (1069–1074)",
"Shōho (1074–1077)",
"Shōryaku (1077–1081)",
"Eihō (1081–1084)",
"Ōtoku (1084–1087)",
"Kanji (1087–1094)",
"Kahō (1094–1096)",
"Eichō (1096–1097)",
"Jōtoku (1097–1099)",
"Kōwa (1099–1104)",
"Chōji (1104–1106)",
"Kashō (1106–1108)",
"Tennin (1108–1110)",
"Ten-ei (1110-1113)",
"Eikyū (1113–1118)",
"Gen’ei (1118–1120)",
"Hōan (1120–1124)",
"Tenji (1124–1126)",
"Daiji (1126–1131)",
"Tenshō (1131–1132)",
"Chōshō (1132–1135)",
"Hōen (1135–1141)",
"Eiji (1141–1142)",
"Kōji (1142–1144)",
"Ten’yō (1144–1145)",
"Kyūan (1145–1151)",
"Ninpei (1151–1154)",
"Kyūju (1154–1156)",
"Hōgen (1156–1159)",
"Heiji (1159–1160)",
"Eiryaku (1160–1161)",
"Ōho (1161–1163)",
"Chōkan (1163–1165)",
"Eiman (1165–1166)",
"Nin’an (1166–1169)",
"Kaō (1169–1171)",
"Shōan (1171–1175)",
"Angen (1175–1177)",
"Jishō (1177–1181)",
"Yōwa (1181–1182)",
"Juei (1182–1184)",
"Genryaku (1184–1185)",
"Bunji (1185–1190)",
"Kenkyū (1190–1199)",
"Shōji (1199–1201)",
"Kennin (1201–1204)",
"Genkyū (1204–1206)",
"Ken’ei (1206–1207)",
"Jōgen (1207–1211)",
"Kenryaku (1211–1213)",
"Kenpō (1213–1219)",
"Jōkyū (1219–1222)",
"Jōō (1222–1224)",
"Gennin (1224–1225)",
"Karoku (1225–1227)",
"Antei (1227–1229)",
"Kanki (1229–1232)",
"Jōei (1232–1233)",
"Tenpuku (1233–1234)",
"Bunryaku (1234–1235)",
"Katei (1235–1238)",
"Ryakunin (1238–1239)",
"En’ō (1239–1240)",
"Ninji (1240–1243)",
"Kangen (1243–1247)",
"Hōji (1247–1249)",
"Kenchō (1249–1256)",
"Kōgen (1256–1257)",
"Shōka (1257–1259)",
"Shōgen (1259–1260)",
"Bun’ō (1260–1261)",
"Kōchō (1261–1264)",
"Bun’ei (1264–1275)",
"Kenji (1275–1278)",
"Kōan (1278–1288)",
"Shōō (1288–1293)",
"Einin (1293–1299)",
"Shōan (1299–1302)",
"Kengen (1302–1303)",
"Kagen (1303–1306)",
"Tokuji (1306–1308)",
"Enkyō (1308–1311)",
"Ōchō (1311–1312)",
"Shōwa (1312–1317)",
"Bunpō (1317–1319)",
"Genō (1319–1321)",
"Genkō (1321–1324)",
"Shōchū (1324–1326)",
"Karyaku (1326–1329)",
"Gentoku (1329–1331)",
"Genkō (1331–1334)",
"Kenmu (1334–1336)",
"Engen (1336–1340)",
"Kōkoku (1340–1346)",
"Shōhei (1346–1370)",
"Kentoku (1370–1372)",
"Bunchū (1372–1375)",
"Tenju (1375–1379)",
"Kōryaku (1379–1381)",
"Kōwa (1381–1384)",
"Genchū (1384–1392)",
"Meitoku (1384–1387)",
"Kakei (1387–1389)",
"Kōō (1389–1390)",
"Meitoku (1390–1394)",
"Ōei (1394–1428)",
"Shōchō (1428–1429)",
"Eikyō (1429–1441)",
"Kakitsu (1441–1444)",
"Bun’an (1444–1449)",
"Hōtoku (1449–1452)",
"Kyōtoku (1452–1455)",
"Kōshō (1455–1457)",
"Chōroku (1457–1460)",
"Kanshō (1460–1466)",
"Bunshō (1466–1467)",
"Ōnin (1467–1469)",
"Bunmei (1469–1487)",
"Chōkyō (1487–1489)",
"Entoku (1489–1492)",
"Meiō (1492–1501)",
"Bunki (1501–1504)",
"Eishō (1504–1521)",
"Taiei (1521–1528)",
"Kyōroku (1528–1532)",
"Tenbun (1532–1555)",
"Kōji (1555–1558)",
"Eiroku (1558–1570)",
"Genki (1570–1573)",
"Tenshō (1573–1592)",
"Bunroku (1592–1596)",
"Keichō (1596–1615)",
"Genna (1615–1624)",
"Kan’ei (1624–1644)",
"Shōho (1644–1648)",
"Keian (1648–1652)",
"Jōō (1652–1655)",
"Meireki (1655–1658)",
"Manji (1658–1661)",
"Kanbun (1661–1673)",
"Enpō (1673–1681)",
"Tenna (1681–1684)",
"Jōkyō (1684–1688)",
"Genroku (1688–1704)",
"Hōei (1704–1711)",
"Shōtoku (1711–1716)",
"Kyōhō (1716–1736)",
"Genbun (1736–1741)",
"Kanpō (1741–1744)",
"Enkyō (1744–1748)",
"Kan’en (1748–1751)",
"Hōreki (1751–1764)",
"Meiwa (1764–1772)",
"An’ei (1772–1781)",
"Tenmei (1781–1789)",
"Kansei (1789–1801)",
"Kyōwa (1801–1804)",
"Bunka (1804–1818)",
"Bunsei (1818–1830)",
"Tenpō (1830–1844)",
"Kōka (1844–1848)",
"Kaei (1848–1854)",
"Ansei (1854–1860)",
"Man’en (1860–1861)",
"Bunkyū (1861–1864)",
"Genji (1864–1865)",
"Keiō (1865–1868)",
"Meiji",
"Taishō",
"Shōwa",
"Heisei"],
long: ["Taika (645–650)",
"Hakuchi (650–671)",
"Hakuhō (672–686)",
"Shuchō (686–701)",
"Taihō (701–704)",
"Keiun (704–708)",
"Wadō (708–715)",
"Reiki (715–717)",
"Yōrō (717–724)",
"Jinki (724–729)",
"Tenpyō (729–749)",
"Tenpyō-kampō (749-749)",
"Tenpyō-shōhō (749-757)",
"Tenpyō-hōji (757-765)",
"Tenpyō-jingo (765-767)",
"Jingo-keiun (767-770)",
"Hōki (770–780)",
"Ten-ō (781-782)",
"Enryaku (782–806)",
"Daidō (806–810)",
"Kōnin (810–824)",
"Tenchō (824–834)",
"Jōwa (834–848)",
"Kajō (848–851)",
"Ninju (851–854)",
"Saikō (854–857)",
"Ten-an (857-859)",
"Jōgan (859–877)",
"Gangyō (877–885)",
"Ninna (885–889)",
"Kanpyō (889–898)",
"Shōtai (898–901)",
"Engi (901–923)",
"Enchō (923–931)",
"Jōhei (931–938)",
"Tengyō (938–947)",
"Tenryaku (947–957)",
"Tentoku (957–961)",
"Ōwa (961–964)",
"Kōhō (964–968)",
"Anna (968–970)",
"Tenroku (970–973)",
"Ten’en (973–976)",
"Jōgen (976–978)",
"Tengen (978–983)",
"Eikan (983–985)",
"Kanna (985–987)",
"Eien (987–989)",
"Eiso (989–990)",
"Shōryaku (990–995)",
"Chōtoku (995–999)",
"Chōhō (999–1004)",
"Kankō (1004–1012)",
"Chōwa (1012–1017)",
"Kannin (1017–1021)",
"Jian (1021–1024)",
"Manju (1024–1028)",
"Chōgen (1028–1037)",
"Chōryaku (1037–1040)",
"Chōkyū (1040–1044)",
"Kantoku (1044–1046)",
"Eishō (1046–1053)",
"Tengi (1053–1058)",
"Kōhei (1058–1065)",
"Jiryaku (1065–1069)",
"Enkyū (1069–1074)",
"Shōho (1074–1077)",
"Shōryaku (1077–1081)",
"Eihō (1081–1084)",
"Ōtoku (1084–1087)",
"Kanji (1087–1094)",
"Kahō (1094–1096)",
"Eichō (1096–1097)",
"Jōtoku (1097–1099)",
"Kōwa (1099–1104)",
"Chōji (1104–1106)",
"Kashō (1106–1108)",
"Tennin (1108–1110)",
"Ten-ei (1110-1113)",
"Eikyū (1113–1118)",
"Gen’ei (1118–1120)",
"Hōan (1120–1124)",
"Tenji (1124–1126)",
"Daiji (1126–1131)",
"Tenshō (1131–1132)",
"Chōshō (1132–1135)",
"Hōen (1135–1141)",
"Eiji (1141–1142)",
"Kōji (1142–1144)",
"Ten’yō (1144–1145)",
"Kyūan (1145–1151)",
"Ninpei (1151–1154)",
"Kyūju (1154–1156)",
"Hōgen (1156–1159)",
"Heiji (1159–1160)",
"Eiryaku (1160–1161)",
"Ōho (1161–1163)",
"Chōkan (1163–1165)",
"Eiman (1165–1166)",
"Nin’an (1166–1169)",
"Kaō (1169–1171)",
"Shōan (1171–1175)",
"Angen (1175–1177)",
"Jishō (1177–1181)",
"Yōwa (1181–1182)",
"Juei (1182–1184)",
"Genryaku (1184–1185)",
"Bunji (1185–1190)",
"Kenkyū (1190–1199)",
"Shōji (1199–1201)",
"Kennin (1201–1204)",
"Genkyū (1204–1206)",
"Ken’ei (1206–1207)",
"Jōgen (1207–1211)",
"Kenryaku (1211–1213)",
"Kenpō (1213–1219)",
"Jōkyū (1219–1222)",
"Jōō (1222–1224)",
"Gennin (1224–1225)",
"Karoku (1225–1227)",
"Antei (1227–1229)",
"Kanki (1229–1232)",
"Jōei (1232–1233)",
"Tenpuku (1233–1234)",
"Bunryaku (1234–1235)",
"Katei (1235–1238)",
"Ryakunin (1238–1239)",
"En’ō (1239–1240)",
"Ninji (1240–1243)",
"Kangen (1243–1247)",
"Hōji (1247–1249)",
"Kenchō (1249–1256)",
"Kōgen (1256–1257)",
"Shōka (1257–1259)",
"Shōgen (1259–1260)",
"Bun’ō (1260–1261)",
"Kōchō (1261–1264)",
"Bun’ei (1264–1275)",
"Kenji (1275–1278)",
"Kōan (1278–1288)",
"Shōō (1288–1293)",
"Einin (1293–1299)",
"Shōan (1299–1302)",
"Kengen (1302–1303)",
"Kagen (1303–1306)",
"Tokuji (1306–1308)",
"Enkyō (1308–1311)",
"Ōchō (1311–1312)",
"Shōwa (1312–1317)",
"Bunpō (1317–1319)",
"Genō (1319–1321)",
"Genkō (1321–1324)",
"Shōchū (1324–1326)",
"Karyaku (1326–1329)",
"Gentoku (1329–1331)",
"Genkō (1331–1334)",
"Kenmu (1334–1336)",
"Engen (1336–1340)",
"Kōkoku (1340–1346)",
"Shōhei (1346–1370)",
"Kentoku (1370–1372)",
"Bunchū (1372–1375)",
"Tenju (1375–1379)",
"Kōryaku (1379–1381)",
"Kōwa (1381–1384)",
"Genchū (1384–1392)",
"Meitoku (1384–1387)",
"Kakei (1387–1389)",
"Kōō (1389–1390)",
"Meitoku (1390–1394)",
"Ōei (1394–1428)",
"Shōchō (1428–1429)",
"Eikyō (1429–1441)",
"Kakitsu (1441–1444)",
"Bun’an (1444–1449)",
"Hōtoku (1449–1452)",
"Kyōtoku (1452–1455)",
"Kōshō (1455–1457)",
"Chōroku (1457–1460)",
"Kanshō (1460–1466)",
"Bunshō (1466–1467)",
"Ōnin (1467–1469)",
"Bunmei (1469–1487)",
"Chōkyō (1487–1489)",
"Entoku (1489–1492)",
"Meiō (1492–1501)",
"Bunki (1501–1504)",
"Eishō (1504–1521)",
"Taiei (1521–1528)",
"Kyōroku (1528–1532)",
"Tenbun (1532–1555)",
"Kōji (1555–1558)",
"Eiroku (1558–1570)",
"Genki (1570–1573)",
"Tenshō (1573–1592)",
"Bunroku (1592–1596)",
"Keichō (1596–1615)",
"Genna (1615–1624)",
"Kan’ei (1624–1644)",
"Shōho (1644–1648)",
"Keian (1648–1652)",
"Jōō (1652–1655)",
"Meireki (1655–1658)",
"Manji (1658–1661)",
"Kanbun (1661–1673)",
"Enpō (1673–1681)",
"Tenna (1681–1684)",
"Jōkyō (1684–1688)",
"Genroku (1688–1704)",
"Hōei (1704–1711)",
"Shōtoku (1711–1716)",
"Kyōhō (1716–1736)",
"Genbun (1736–1741)",
"Kanpō (1741–1744)",
"Enkyō (1744–1748)",
"Kan’en (1748–1751)",
"Hōreki (1751–1764)",
"Meiwa (1764–1772)",
"An’ei (1772–1781)",
"Tenmei (1781–1789)",
"Kansei (1789–1801)",
"Kyōwa (1801–1804)",
"Bunka (1804–1818)",
"Bunsei (1818–1830)",
"Tenpō (1830–1844)",
"Kōka (1844–1848)",
"Kaei (1848–1854)",
"Ansei (1854–1860)",
"Man’en (1860–1861)",
"Bunkyū (1861–1864)",
"Genji (1864–1865)",
"Keiō (1865–1868)",
"Meiji",
"Taishō",
"Shōwa",
"Heisei"]
},
dayPeriods: {am: "AM", pm: "PM"}
},
persian: {
months: {
narrow: ["1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"],
short: ["Farvardin",
"Ordibehesht",
"Khordad",
"Tir",
"Mordad",
"Shahrivar",
"Mehr",
"Aban",
"Azar",
"Dey",
"Bahman",
"Esfand"],
long: ["Farvardin",
"Ordibehesht",
"Khordad",
"Tir",
"Mordad",
"Shahrivar",
"Mehr",
"Aban",
"Azar",
"Dey",
"Bahman",
"Esfand"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {narrow: ["AP"], short: ["AP"], long: ["AP"]},
dayPeriods: {am: "AM", pm: "PM"}
},
roc: {
months: {
narrow: ["J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D"],
short: ["jan.",
"feb.",
"mar.",
"apr.",
"maj",
"jun.",
"jul.",
"aug.",
"sep.",
"okt.",
"nov.",
"dec."],
long: ["januar",
"februar",
"marts",
"april",
"maj",
"juni",
"juli",
"august",
"september",
"oktober",
"november",
"december"]
},
days: {
narrow: ["S",
"M",
"T",
"O",
"T",
"F",
"L"],
short: ["søn.",
"man.",
"tir.",
"ons.",
"tor.",
"fre.",
"lør."],
long: ["søndag",
"mandag",
"tirsdag",
"onsdag",
"torsdag",
"fredag",
"lørdag"]
},
eras: {
narrow: ["Before R.O.C.",
"Minguo"],
short: ["Before R.O.C.",
"Minguo"],
long: ["Before R.O.C.",
"Minguo"]
},
dayPeriods: {am: "AM", pm: "PM"}
}
}
},
number: {
nu: ["latn"],
patterns: {
decimal: {
positivePattern: "{number}",
negativePattern: "{minusSign}{number}"
},
currency: {
positivePattern: "{number} {currency}",
negativePattern: "{minusSign}{number} {currency}"
},
percent: {
positivePattern: "{number} {percentSign}",
negativePattern: "{minusSign}{number} {percentSign}"
}
},
symbols: {
latn: {
decimal: ",",
group: ".",
nan: "NaN",
plusSign: "+",
minusSign: "-",
percentSign: "%",
infinity: "∞"
}
},
currencies: {
AUD: "AU$",
BRL: "R$",
CAD: "CA$",
CNY: "CN¥",
DKK: "kr.",
EUR: "€",
GBP: "£",
HKD: "HK$",
ILS: "₪",
INR: "₹",
JPY: "JP¥",
KRW: "₩",
MXN: "MX$",
NZD: "NZ$",
THB: "฿",
TWD: "NT$",
USD: "$",
VND: "₫",
XAF: "FCFA",
XCD: "EC$",
XOF: "CFA",
XPF: "CFPF"
}
}
}); |
'use strict'
const path = require('path')
const fs = require('fs')
const ndjson = require('ndjson')
const filterStream = require('stream-filter')
const sink = require('stream-sink')
const pump = require('pump')
const file = path.join(__dirname, 'data.ndjson')
const filterById = (id) => (data) =>
!!(data && ('object' === typeof data) && data.id === id)
const filterByKeys = (pattern) => (data) => {
if (!data || 'object' !== typeof data) return false
for (let key in pattern) {
if (!data.hasOwnProperty(key)) return false
if (data[key] !== pattern[key]) return false
}
return true
}
const lines = (...args) => {
const pattern = args.pop()
const promised = !!args.shift()
const chain = [
fs.createReadStream(file),
ndjson.parse()
]
if ('string' === typeof pattern) {
if (pattern !== 'all') {
const filter = filterStream.obj(filterById(pattern))
chain.push(filter)
}
} else if (pattern !== undefined) {
const filter = filterStream.obj(filterByKeys(pattern))
chain.push(filter)
}
if (promised === true) {
const out = sink('object')
pump(...chain, out, () => {})
return out
}
return pump(...chain, () => {})
}
lines.filterById = filterById
lines.filterByKeys = filterByKeys
module.exports = lines
|
/*
451 ERR_NOTREGISTERED
":You have not registered"
- Returned by the server to indicate that the client
MUST be registered before the server will allow it
to be parsed in detail.
*/
|
/* @flow */
'use strict' // eslint-disable-line strict
import type {Amount, Memo} from '../common/types.js'
type Outcome = {
result: string,
ledgerVersion: number,
indexInLedger: number,
fee: string,
balanceChanges: {
[key: string]: [{
currency: string,
counterparty?: string,
value: string
}]
},
orderbookChanges: Object,
timestamp?: string
}
type Adjustment = {
address: string,
amount: {
currency: string,
counterparty?: string,
value: string
},
tag?: number
}
type Trustline = {
currency: string,
counterparty: string,
limit: string,
qualityIn?: number,
qualityOut?: number,
ripplingDisabled?: boolean,
authorized?: boolean,
frozen?: boolean
}
type Settings = {
passwordSpent?: boolean,
requireDestinationTag?: boolean,
requireAuthorization?: boolean,
disallowIncomingXRP?: boolean,
disableMasterKey?: boolean,
enableTransactionIDTracking?: boolean,
noFreeze?: boolean,
globalFreeze?: boolean,
defaultRipple?: boolean,
emailHash?: string,
messageKey?: string,
domain?: string,
transferRate?: number,
regularKey?: string
}
type OrderCancellation = {
orderSequence: number
}
type Payment = {
source: Adjustment,
destination: Adjustment,
paths?: string,
memos?: Array<Memo>,
invoiceID?: string,
allowPartialPayment?: boolean,
noDirectRipple?: boolean,
limitQuality?: boolean
}
type PaymentTransaction = {
type: string,
specification: Payment,
outcome: Outcome,
id: string,
address: string,
sequence: number
}
export type Order = {
direction: string,
quantity: Amount,
totalPrice: Amount,
immediateOrCancel?: boolean,
fillOrKill?: boolean,
passive?: boolean
}
type OrderTransaction = {
type: string,
specification: Order,
outcome: Outcome,
id: string,
address: string,
sequence: number
}
type OrderCancellationTransaction = {
type: string,
specification: OrderCancellation,
outcome: Outcome,
id: string,
address: string,
sequence: number
}
type TrustlineTransaction = {
type: string,
specification: Trustline,
outcome: Outcome,
id: string,
address: string,
sequence: number
}
type SettingsTransaction = {
type: string,
specification: Settings,
outcome: Outcome,
id: string,
address: string,
sequence: number
}
export type TransactionOptions = {
minLedgerVersion?: number,
maxLedgerVersion?: number
}
export type TransactionType = PaymentTransaction | OrderTransaction |
OrderCancellationTransaction | TrustlineTransaction | SettingsTransaction
|
import mod932 from './mod932';
var value=mod932+1;
export default value;
|
import assert from "assert";
import {stackOffsetWiggle, stackOrderNone, stackOrderReverse} from "../../src/index.js";
it("stackOffsetWiggle(series, order) minimizes weighted wiggle", () => {
const series = [
[[0, 1], [0, 2], [0, 1]],
[[0, 3], [0, 4], [0, 2]],
[[0, 5], [0, 2], [0, 4]]
];
stackOffsetWiggle(series, stackOrderNone(series));
assert.deepStrictEqual(series.map(roundSeries), [
[[0, 1], [-1, 1], [0.7857143, 1.7857143]],
[[1, 4], [ 1, 5], [1.7857143, 3.7857143]],
[[4, 9], [ 5, 7], [3.7857143, 7.7857143]]
].map(roundSeries));
});
it("stackOffsetWiggle(series, order) treats NaN as zero", () => {
const series = [
[[0, 1], [0, 2], [0, 1]],
[[0, NaN], [0, NaN], [0, NaN]],
[[0, 3], [0, 4], [0, 2]],
[[0, 5], [0, 2], [0, 4]]
];
stackOffsetWiggle(series, stackOrderNone(series));
assert(isNaN(series[1][0][1]));
assert(isNaN(series[1][0][2]));
assert(isNaN(series[1][0][3]));
series[1][0][1] = series[1][1][1] = series[1][2][1] = "NaN"; // can’t assert.strictEqual NaN
assert.deepStrictEqual(series.map(roundSeries), [
[[0, 1], [-1, 1], [0.7857143, 1.7857143]],
[[1, "NaN"], [ 1, "NaN"], [1.7857143, "NaN"]],
[[1, 4], [ 1, 5], [1.7857143, 3.7857143]],
[[4, 9], [ 5, 7], [3.7857143, 7.7857143]]
].map(roundSeries));
});
it("stackOffsetWiggle(series, order) observes the specified order", () => {
const series = [
[[0, 1], [0, 2], [0, 1]],
[[0, 3], [0, 4], [0, 2]],
[[0, 5], [0, 2], [0, 4]]
];
stackOffsetWiggle(series, stackOrderReverse(series));
assert.deepStrictEqual(series.map(roundSeries), [
[[8, 9], [8, 10], [7.21428571, 8.21428571]],
[[5, 8], [4, 8], [5.21428571, 7.21428571]],
[[0, 5], [2, 4], [1.21428571, 5.21428571]]
].map(roundSeries));
});
function roundSeries(series) {
return series.map(function(point) {
return point.map(function(value) {
return isNaN(value) ? value : Math.round(value * 1e6) / 1e6;
});
});
}
|
// To parse file.cnf
function mycmdstr(instr, fpath, fspec)
{
instr = instr.replace(/%%/i, "\x00");
instr = instr.replace(/%f/i, fpath);
instr = instr.replace(/%g/i, system.temp_dir);
instr = instr.replace(/%j/i, system.data_dir);
instr = instr.replace(/%k/i, system.ctrl_dir);
instr = instr.replace(/%n/i, system.node_dir);
instr = instr.replace(/%o/i, system.operator);
instr = instr.replace(/%q/i, system.qwk_id);
instr = instr.replace(/%s/i, fspec);
instr = instr.replace(/%!/, system.exec_dir);
instr = instr.replace(/%@/, system.platform == 'Win32' ? system.exec_dir : '');
instr = instr.replace(/%#/, '0'); // TODO: Can't get ENV variables...
instr = instr.replace(/%\*/, '000'); // TODO: Can't get ENV variables...
instr = instr.replace(/%\./, system.platform == 'Win32' ? '.exe' : '');
instr = instr.replace(/%\?/, system.platform);
instr = instr.replace(/\x00/i, "%");
return instr;
}
function Handle_TIC(tic, ctx, arg)
{
var cfg;
var unpack;
var dir;
var rc;
var fl;
// Parse the config...
try {
cfg = JSON.parse(arg);
}
catch (e) {
log(LOG_ERROR, "Unable to parse '"+arg+"' as JSON, aborting");
return false;
}
// Validate arguments
if (cfg.domain === undefined) {
log(LOG_ERROR, "'"+arg+"' doesn't define the domain property");
return false;
}
if (ctx.FIDO.FTNDomains.nodeListFN[cfg.domain] === undefined) {
log(LOG_ERROR, "Domain '"+cfg.domain+"' does not have a nodelist");
return false;
}
if (cfg.match === undefined)
cfg.match = '*.*';
if (cfg.nlmatch === undefined)
cfg.nlmatch = '*.*';
if (!wildmatch(tic.file, cfg.match)) {
log(LOG_DEBUG, "TIC file "+tic.file+" doesn't match '"+cfg.match+"'");
return false;
}
var f = new File(tic.full_path);
if (!f.open("rb", true)) {
log(LOG_DEBUG, "Unable to open file '"+tic.full_path+"'");
return false;
}
Object.keys(ctx.sbbsecho.packer).forEach(function(key) {
var i;
var sig = '';
f.position = ctx.sbbsecho.packer[key].offset;
for (i=0; i<ctx.sbbsecho.packer[key].sig.length; i+=2) {
sig += format("%02X", f.readBin(1));
if (f.eof)
break;
}
if (sig === ctx.sbbsecho.packer[key].sig)
unpack = ctx.sbbsecho.packer[key].unpack;
});
f.close();
if (unpack == undefined) {
log(LOG_DEBUG, "Unable to identify packer for '"+tic.file+"'");
return false;
}
// Create a directory to extract to...
dir = backslash(system.temp_dir)+'nodelist_handler';
if (!file_isdir(dir)) {
if (!mkdir(dir)) {
log(LOG_DEBUG, "Unable to create temp directory '"+dir+"'");
return false;
}
}
else {
// Empty the directory
directory(backslash(dir) + (system.platform == 'Win32' ? '*.*' : '*')).forEach(function(fname) {
if (!file_remove(fname))
log(LOG_ERROR, "Unable to delete file '"+fname+"'");
});
if (directory(backslash(dir) + (system.platform == 'Win32' ? '*.*' : '*')).length) {
log(LOG_ERROR, "Unable to empty directory '"+dir+"'");
return false;
}
}
unpack = mycmdstr(unpack, tic.full_path, dir);
if ((rc = system.exec(unpack)) != 0) {
log(LOG_ERROR, "Unable to extract '"+tic.file+"' return value "+rc);
return false;
}
fl = directory(backslash(dir)+cfg.nlmatch);
if (fl.length == 0) {
log(LOG_ERROR, "No file matching '"+cfg.nlmatch+"' in archive '"+tic.full_path+"'");
return false;
}
if (fl.length > 1) {
log(LOG_ERROR, "Multiple files matching '"+cfg.nlmatch+"' in archive '"+tic.full_path+"' ("+fl.join(', ')+")");
return false;
}
log(LOG_DEBUG, "Copying "+fl[0]+" to "+ctx.FIDO.FTNDomains.nodeListFN[cfg.domain]+" from "+tic.file);
if (!file_copy(fl[0], ctx.FIDO.FTNDomains.nodeListFN[cfg.domain]))
log(LOG_ERR, "Failed to copy "+fl[0]+" to "+ctx.FIDO.FTNDomains.nodeListFN[cfg.domain]+" from "+tic.file);
// Return false so it is still moved into the appropriate dir
return false;
}
0;
|
'use strict'
const test = require('ava')
const domain = 'example.com'
global.fetch = url => {
if (url !== `https://${domain}/.well-known/host-meta`) {
throw new Error('Fetch URL incorrect')
}
return Promise.resolve({
text() {
return `<?xml version='1.0' encoding='UTF-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
<Link rel='urn:xmpp:alt-connections:websocket' href='wss://example.com/ws' />
<Link rel='urn:xmpp:alt-connections:xbosh' href='http://example.com/bosh' />
<Link rel='urn:xmpp:alt-connections:httppoll' href='http://example.com/http-poll' />
</XRD>`
},
})
}
const {resolve} = require('../lib/http')
test.cb('parse', t => {
resolve(domain)
.then(result => {
t.deepEqual(result, [
{
rel: 'urn:xmpp:alt-connections:websocket',
href: 'wss://example.com/ws',
method: 'websocket',
uri: 'wss://example.com/ws',
},
{
rel: 'urn:xmpp:alt-connections:xbosh',
href: 'http://example.com/bosh',
method: 'xbosh',
uri: 'http://example.com/bosh',
},
{
rel: 'urn:xmpp:alt-connections:httppoll',
href: 'http://example.com/http-poll',
method: 'httppoll',
uri: 'http://example.com/http-poll',
},
])
t.end()
})
.catch(t.end)
})
|
angular.module('jamm', [
'ui.bootstrap',
'ui.router',
'ct.ui.router.extras',
'as.sortable',
'ngResource',
'treeControl',
'n3-pie-chart',
'ngTagsInput',
'ngclipboard',
'jamm.unitFilter',
'jamm.tableHeaderSortable',
'jamm.dateTimePicker',
'jamm.photoswipe',
'jamm.coverThumbnail',
'jamm.movieDetailForm',
'jamm.pager',
'jamm.facetedSearch'
]).config(function ($stateProvider, $urlRouterProvider) {
FastClick.attach(document.body);
$urlRouterProvider.otherwise("/movies");
$stateProvider
.state('movies', {
url: '/movies',
abstract: true,
sticky: true
})
.state('movies.list', {
url: '',
sticky: true,
views: {
'movieList@': {
templateUrl: "list/movie-list.html",
controller: 'MovieListController'
}
}
})
.state('movies.detail', {
url: "/:id",
views: {
'movieDetail@': {
templateUrl: "detail/movie-detail.html",
controller: 'MovieDetailController'
}
}
})
.state('import', {
url: "/import",
sticky: true,
deepStateRedirect: {
default: "import.volumelist"
}
})
.state('import.volumelist', {
url: null,
views: {
'import@': {
templateUrl: "import/movie-import.html",
controller: 'MovieImportController'
}
}
})
.state('import.volumelist.directorylist', {
url: "/:id",
templateUrl: "import/import-from-volume.html",
controller: "ImportFromVolumeController"
})
.state('settings', {
url: '/settings',
templateUrl: 'settings/settings.html',
controller: "SettingsController"
})
.state('about', {
url: "/about",
templateUrl: "about.html"
});
})
.controller('AppStateController', function ($scope, $state) {
$scope.routerState = $state;
});
|
function read_anki(file_number, target_id) {
// Read Anki text file
var request = new XMLHttpRequest();
request.open("GET", "res/voc/" + file_number + ".txt", false);
request.send(null);
var lines = request.responseText.split('\n');
// put into data object
var data = [];
lines.forEach(
function (entry, index) {
data.push({
'keyword': replaceDivs(decodeHtml(entry.split('\t')[0])),
'definition': replaceDivs(decodeHtml(entry.split('\t')[1]))
})
}
);
// file the mustache template
var template = document.getElementById('word_tmp').innerHTML;
document.getElementById(target_id).innerHTML = '';
Mustache.parse(template);
data.forEach(
function (entry, index) {
document.getElementById(target_id).innerHTML += Mustache.render(template, entry);
}
)
}
function fill_talks(talks) {
var talk_template = document.getElementById('talk_tmp').innerHTML;
document.getElementById('talks').innerHTML = '';
Mustache.parse(talk_template);
talks.forEach(
function (entry) {
document.getElementById('talks').innerHTML += Mustache.render(talk_template, entry);
read_anki(entry.num, 'ted' + entry.num + '_voc');
}
);
}
function decodeHtml(html) {
var txt = document.createElement("textarea");
txt.innerHTML = html;
return txt.value;
}
function replaceDivs(txt){
return txt.replace('<div>','').replace('</div>','');
}
var talks = [
{
'link': 'https://www.ted.com/talks/takaharu_tezuka_the_best_kindergarten_you_ve_ever_seen',
'title': 'The best kindergarten you’ve ever seen',
'num': '1'
},
{
'link': 'https://www.ted.com/talks/natalie_panek_let_s_clean_up_the_space_junk_orbiting_earth',
'title': 'Let\'s clean up the space junk orbiting Earth',
'num': '2'
},
{
'link': 'https://www.ted.com/talks/michael_shellenberger_how_fear_of_nuclear_power_is_hurting_the_environment',
'title': 'How fear of nuclear power is hurting the environment',
'num': '3'
},
{
'link': 'https://www.ted.com/talks/eben_bayer_are_mushrooms_the_new_plastic',
'title': 'Are mushrooms the new plastic?',
'num': '4'
},
{
'link': 'https://www.ted.com/talks/avi_reichental_what_s_next_in_3d_printing',
'title': 'What\'s next in 3D printing',
'num': '5'
},
{
'link': 'https://www.ted.com/talks/topher_white_what_can_save_the_rainforest_your_used_cell_phone',
'title': 'What can save the rainforest- Your used cell phone',
'num': '6'
},
{
'link': 'https://www.ted.com/talks/steven_johnson_how_play_leads_to_great_inventions',
'title': 'The playful wonderland behind great inventions',
'num': '7'
},
{
'link': 'https://www.ted.com/talks/marco_tempest_maybe_the_best_robot_demo_ever',
'title': 'And for my next trick, a robot',
'num': '8'
},
{
'link': 'https://www.ted.com/talks/doris_kim_sung_metal_that_breathes',
'title': 'Metal that breathes',
'num': '9'
}
]
fill_talks(talks);
|
/**
* the file to set sort
*/
$(document).ready(function(){
var SITEDOMAIN ='';
// browser check
var userAgent = window.navigator.userAgent.toLowerCase();
var appVersion = window.navigator.appVersion.toLowerCase();
var _browser = 0;
if (userAgent.indexOf('msie') != -1) {
if (appVersion.indexOf("msie 6.") != -1) {
_browser = 6; // IE6
} else if (appVersion.indexOf("msie 7.") != -1) {
_browser = 7; // IE7
} else if (appVersion.indexOf("msie 8.") != -1) {
_browser = 8; // IE8
} else if (appVersion.indexOf("msie 9.") != -1) {
_browser = 9; // IE9
} else if (appVersion.indexOf("msie 10.") != -1) {
_browser = 10; // IE10
} else {
_browser = 11; //IE11
}
} else if (userAgent.indexOf('chrome') != -1) {
_browser = 200; // CHROME
} else if (userAgent.indexOf('firefox') != -1) {
_browser = 300; // FIREFOX
} else if (userAgent.indexOf('safari') != -1) {
_browser = 400; // SAFARI
} else {
_browser = 900; // OTHER
}
if (_browser < 9) {
// IE - PNG ��
$('img').each(function() {
if($(this).attr('src').indexOf('.png') != -1) {
$(this).css({
'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + $(this).attr('src') + '", sizingMethod="scale");'
});
}
});
}
//check device
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
//sort
//var tho = new Tho();
//check hover calendar in from s
$("#dateitem").css("color","#fff");
$("#datetimepicker1, #datetimepicker2").datetimepicker({format: 'DD/MM/YYYY'});
$.btn_search = $("#btn_search");
$("#dateitem").hover(function(){
$(this).css("text-decoration","underline").css("cursor","pointer");
});
$("#dateitem").mouseout(function(){
$(this).css("text-decoration","none");
});
$('.job-sort').css("cursor","pointer");
//display calendar
$.btn_calendar = $("#dateitem");
$.calendar = $("#areacalendar");
//date time
$.btn_calendar.click(function(){
if ($.calendar.is(':visible')) {
$.calendar.hide();
$.btn_search.remove();
$.btn_search.appendTo('#areasearch1');
}else {
$.calendar.show();
$.btn_search.remove();
$.btn_search.appendTo("#areacalendar");
}
});
if(isMobile.any()) {
$(".holder").css("height","105px");
$(".title-r").hide();
$("blockquote.first").css("padding-left","20px");
$(".list5 li").css("text-align","justify");
btn = $("<button></button>");
$("#dechec").append(btn);
$.btn_quicksearch = btn;
$("#formsearch").hide();
$.btn_quicksearch.text("Tìm kiếm nhanh").addClass("btn").addClass("btn-default").attr("id","btn_quicksearch");
$(".adv").parent().hide();
$("blockquote").css("padding-right","30px");
$(".inner-10").remove();
}else{
if (document.location.pathname.match(/[^\/]+$/) != null) {
var page = document.location.pathname.match(/[^\/]+$/)[0];
if (page == 'dang-ki-tim-viec' || page == 'dang-ki-tim-tho') {
$("head").append("<link type=\"text/css\" rel=\"stylesheet\" href=\"assets/css/dangki.css\">");
$("head").append("<link type=\"text/css\" rel=\"stylesheet\" href=\"assets/css/owl.carousel.css\">");
$("head").append("<script type=\"text/javascript\" src=\"assets/js/owl.carousel.min.js\"></script>");
}
}
}
$("#btn_quicksearch").click(function(){
if($("#formsearch").is(':visible')) $("#formsearch").hide();
else{
$("#formsearch").show();
$(this).text("Ẩn tìm kiếm");
}
});
//sort
var loading = '<img src = "assets/img/load.gif" alt="Loading ..." class="load1" width="50px" height="50px" />';
$('.job-sort').click(function(){
//loading
//$('#job-result').parent().parent().html('');
$('#job-result').parent().prepend(loading);
content = '';
$type = $(this).attr('id');
$.ajax({
url: SITEDOMAIN+'get-nganh-nghe/'+$type,
type: 'POST',
data: '',
success: function(data){
if (data != null) {
var getData = $.parseJSON(data);
for (i = 0; i < getData.length; i++) {
content += '<div class="col-md-4">'
+ '<span><a href="">'+getData[i].name+'</a></span><span class="gray-bold"></span>'
+ '</div>';
}
$("#job-result").html(content);
$('#job-result').parent().find(".load1").remove();
}
}
});
});
$('.dropdown-toggle').dropdown();
});
|
import request from 'supertest-as-promised';
import httpStatus from 'http-status';
import chai, { expect } from 'chai';
import app from '../../index';
chai.config.includeStack = true;
describe('## Misc', () => {
describe('# GET /api/health-check', () => {
it('should return OK', (done) => {
request(app)
.get('/api/health-check')
.expect(httpStatus.OK)
.then((res) => {
expect(res.text).to.equal('OK');
done();
})
.catch(done);
});
});
describe('# GET /api/404', () => {
it('should return 404 status', (done) => {
request(app)
.get('/api/404')
.expect(httpStatus.NOT_FOUND)
.then((res) => {
expect(res.body.message).to.equal('Not Found');
done();
})
.catch(done);
});
});
/*
describe('# Error Handling', () => {
it('should handle mongoose CastError - Cast to ObjectId failed', (done) => {
request(app)
.get('/api/old-users/56z787zzz67fc')
.expect(httpStatus.INTERNAL_SERVER_ERROR)
.then((res) => {
expect(res.body.message).to.equal('Internal Server Error');
done();
})
.catch(done);
});
it('should handle express validation error - username is required', (done) => {
request(app)
.post('/api/old-users')
.send({
mobileNumber: '1234567890'
})
.expect(httpStatus.BAD_REQUEST)
.then((res) => {
expect(res.body.message).to.equal('"username" is required');
done();
})
.catch(done);
});
});*/
});
|
/********************** tine translations of Addressbook**********************/
Locale.Gettext.prototype._msgs['./LC_MESSAGES/Addressbook'] = new Locale.Gettext.PO(({
""
: "Project-Id-Version: Tine 2.0\nPOT-Creation-Date: 2008-05-17 22:12+0100\nPO-Revision-Date: 2012-09-19 08:56+0000\nLast-Translator: corneliusweiss <[email protected]>\nLanguage-Team: Slovak (http://www.transifex.com/projects/p/tine20/language/sk/)\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nLanguage: sk\nPlural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\nX-Poedit-Country: GB\nX-Poedit-Language: en\nX-Poedit-SourceCharset: utf-8\n"
, "manage shared addressbooks"
: ""
, "Create new shared addressbook folders"
: ""
, "manage shared addressbook favorites"
: ""
, "Create or update shared addressbook favorites"
: ""
, "Contact duplicate check fields"
: ""
, "These fields are checked when a new contact is created. If a record with the same data in the fields is found, a duplicate exception is thrown."
: ""
, "Contact salutations available"
: ""
, "Possible contact salutations. Please note that additional values might impact other Addressbook systems on export or syncronisation."
: ""
, "Parsing rules for addresses"
: ""
, "Path to a XML file with address parsing rules."
: ""
, "Uploaded new contact image."
: ""
, "%s's personal addressbook"
: ""
, "Business Contact Data"
: ""
, "Organisation / Unit"
: ""
, "Business Address"
: ""
, "Email"
: ""
, "Telephone Work"
: ""
, "Telephone Cellphone"
: ""
, "Telephone Car"
: ""
, "Telephone Fax"
: ""
, "Telephone Page"
: ""
, "URL"
: ""
, "Role"
: ""
, "Room"
: ""
, "Assistant"
: ""
, "Assistant Telephone"
: ""
, "Private Contact Data"
: ""
, "Private Address"
: ""
, "Email Home"
: ""
, "Telephone Home"
: ""
, "Telephone Cellphone Private"
: ""
, "Telephone Fax Home"
: ""
, "URL Home"
: ""
, "Other Data"
: ""
, "Birthday"
: ""
, "Job Title"
: ""
, "Contact import from Google address book"
: ""
, "Contact VCARD import"
: ""
, "Contact CSV import from mac address book"
: ""
, "CSV Outlook 2007 German"
: ""
, "Contact CSV import from Outlook address book"
: ""
, "Contact CSV import"
: ""
, "Import list (###CURRENTDATE###)"
: ""
, "Contacts imported on ###CURRENTDATE### at ###CURRENTTIME### by ###USERFULLNAME###"
: ""
, "New Contact"
: ""
, "Addressbook, Addressbooks"
: [
""
,""
,""
]
, "CardDAV URL"
: ""
, "Map"
: ""
, "Personal Information"
: ""
, "Salutation"
: ""
, "Title"
: ""
, "First Name"
: ""
, "Middle Name"
: ""
, "Last Name"
: ""
, "Company"
: ""
, "Unit"
: ""
, "Display Name"
: ""
, "Suffix"
: ""
, "Job Role"
: ""
, "Contact Information"
: ""
, "Phone"
: ""
, "Mobile"
: ""
, "Fax"
: ""
, "Phone (private)"
: ""
, "Mobile (private)"
: ""
, "Fax (private)"
: ""
, "E-Mail"
: ""
, "E-Mail (private)"
: ""
, "Web"
: ""
, "Company Address"
: ""
, "Street"
: ""
, "Street 2"
: ""
, "Region"
: ""
, "Postal Code"
: ""
, "City"
: ""
, "Country"
: ""
, "Description"
: ""
, "Enter description"
: ""
, "Export as pdf"
: ""
, "Parse address"
: ""
, "Either {0} or {1} must be given"
: ""
, "Paste address"
: ""
, "Please paste an address that should be parsed:"
: ""
, "End token mode"
: ""
, "Contact, Contacts"
: [
""
,""
,""
]
, "Type"
: ""
, "Tags"
: ""
, "Full Name"
: ""
, "Postalcode"
: ""
, "Street (private)"
: ""
, "City (private)"
: ""
, "Region (private)"
: ""
, "Postalcode (private)"
: ""
, "Country (private)"
: ""
, "Car phone"
: ""
, "Pager"
: ""
, "Email (private)"
: ""
, "URL (private)"
: ""
, "Note"
: ""
, "Timezone"
: ""
, "Geo"
: ""
, "Export {0}, Export {0}"
: [
""
,""
,""
]
, "Export as PDF"
: ""
, "Export as CSV"
: ""
, "Export as ODS"
: ""
, "Export as XLS"
: ""
, "Export as ..."
: ""
, "Import contacts"
: ""
, "Internal Contact"
: ""
, "Contacts"
: ""
, "Select contact"
: ""
, "Private"
: ""
, "Info"
: ""
, "Insecure link"
: ""
, "Please review this link in edit dialog."
: ""
, "Member of List"
: ""
, "Company address"
: ""
, "Private address"
: ""
, "Name"
: ""
, "Street (Company Address)"
: ""
, "Street 2 (Company Address)"
: ""
, "City (Company Address)"
: ""
, "Region (Company Address)"
: ""
, "Postal Code (Company Address)"
: ""
, "Country (Company Address)"
: ""
, "Street (Private Address)"
: ""
, "Street 2 (Private Address)"
: ""
, "City (Private Address)"
: ""
, "Region (Private Address)"
: ""
, "Postal Code (Private Address)"
: ""
, "Country (Private Address)"
: ""
, "Company Communication"
: ""
, "Private Communication"
: ""
, "Web (private)"
: ""
, "Addressbooks"
: ""
, "User Account"
: ""
, "Quick search"
: ""
, "Last Modified Time"
: ""
, "Last Modified By"
: ""
, "Creation Time"
: ""
, "Created By"
: ""
, "List, Lists"
: [
""
,""
,""
]
, "Lists"
: ""
, "All contacts"
: ""
, "Default Addressbook"
: ""
, "The default addressbook for new contacts"
: ""
, "Default Favorite"
: ""
, "The default favorite which is loaded on addressbook startup"
: ""
, "Mr"
: ""
, "Ms"
: ""
, "All contacts I have read grants for"
: ""
, "My company"
: ""
, "All coworkers in my company"
: ""
, "My contacts"
: ""
, "All contacts in my Addressbooks"
: ""
, "Last modified by me"
: ""
, "All contacts that I have last modified"
: ""
, "Internal Contacts"
: ""
, "Addressbook"
: ""
, "Contact"
: ""
, "Export {0}"
: ""
, "List"
: ""
}));
|
// Original solutions by Teresa B. https://github.com/terabitbaci/
const MyData = {
fruit: "apple",
drink: "water",
dessert: "cookie"
};
console.log('use a for...in to loop through the OBJECT and console the contents');
for (let key in MyData) {
console.log(`${key}: ${MyData[key]}`);
}
console.log('- - - - - - - - - -');
console.log('use a forEach to loop through the OBJECT and console the contents');
//The Object.keys() method returns an array of a given object's own enumerable properties, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well).
//(please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys)
let convertObjectKeysToAnArray = Object.keys(MyData);
//.forEach() is only for arrays (please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
convertObjectKeysToAnArray.forEach(key => console.log(`${key}: ${MyData[key]}`));
console.log('- - - - - - - - - -');
// objects inside object
let contents = {
nails: 40,
bolts: 35,
washers: 12,
rings: {
split: 5,
washer: 33
}
};
console.log('objects inside object --> return 33');
console.log(contents.rings.washer);
console.log('- - - - - - - - - -');
|
module.exports = {
off: off, removeListener: off, removeEventListener: off,
on: on, addListener: on, addEventListener: on,
once: once,
stop: stop, stopListening: stop, removeAllEventListeners: stop,
dispatch: dispatch, trigger: dispatch, emit: dispatch
};
var _maps = {};
function off(id, f) {
var map, index;
if ((map = _maps[id]) && ~(index = map.indexOf(f)))
map.splice(index, 1);
}
function on(id, f) {
off(id, f);
(_maps[id] || (_maps[id] = [])).push(f);
}
function once(id, f) {
this.on(id, function wrapped(event) {
off(id, wrapped);
f(event);
});
}
function stop(id) {
if (id)
delete _maps[id];
else
_maps = {};
}
function dispatch(id, event) {
var map;
if (map = _maps[id])
map.forEach(function (f) {
f(event);
});
} |
$(document).on('click', '.video-box__playbutton', function(){
$(this).hide();
var videoBox = $(this).closest('.video-box');
var videoID = videoBox.attr('data-video-id');
var videoType = videoBox.attr('data-video-type');
var videoFrame = videoBox.find('.video-box__frame');
var videoThumbnail = videoBox.find('.video-box__thumbnail');
var youtubeIframe = '<iframe type="text/html" width="100%" height="100%" src="http://www.youtube.com/embed/' + videoID + '?autoplay=1" frameborder="0" allowfullscreen></iframe>';
var vimeoFrame = '<iframe type="text/html" width="100%" height="100%" src="//player.vimeo.com/video/' + videoID + '?autoplay=1" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
if (videoType == 'vimeo') {
videoFrame.html(vimeoFrame);
} else {
videoFrame.html(youtubeIframe);
}
setTimeout(function(){
videoThumbnail.addClass("animated");
videoThumbnail.addClass("pulse");
videoThumbnail.css("z-index", "-1");
videoFrame.addClass("animated");
videoFrame.addClass("pulse");
videoFrame.css("z-index" , "1");
}, 500);
});
|
const DEFAULT_OPEN_COMMAND_LIST_MAP = {
// [ process.platform ]: [ command, ...prefixArgList ]
linux: [ 'xdg-open' ],
// better than the both `start` (cmd builtin need nasty quoting) and `explorer.exe` (standalone but fail on `http://localhost?a=1#some://url?with=special&chars=:->`)
// now the problem will be how to pass this to node on win32. check quoting problem: https://github.com/sindresorhus/open#double-quotes-on-windows
// check:
// - https://ss64.com/nt/rundll32.html
// - https://superuser.com/questions/1456314/open-url-with-windows-explorer/1456333#1456333
// - https://superuser.com/questions/36728/can-i-launch-urls-from-command-line-in-windows/36730#36730
win32: [ 'rundll32.exe', 'url.dll,OpenURL' ],
darwin: [ 'open' ],
android: [ 'termux-open' ] // TODO: may have other options?
}
// open URL or File with System Default, no need `{ shell: true }` os no extra escaping needed
const getDefaultOpenCommandList = () => {
const defaultOpenCommandList = DEFAULT_OPEN_COMMAND_LIST_MAP[ process.platform ]
if (!defaultOpenCommandList) throw new Error(`unsupported platform: ${process.platform}`)
return defaultOpenCommandList // [ command, ...prefixArgList ]
}
export { getDefaultOpenCommandList }
// ultimate URL test:
// require('child_process').spawnSync('rundll32.exe', [ 'url.dll,OpenURL', 'http://localhost?a=1#some://url?with=special&chars\'\":[]{}()!@#$%^&*-=_+<>,.?/\\' ])
// require('child_process').spawnSync('open', [ 'http://localhost?a=1#some://url?with=special&chars\'\":[]{}()!@#$%^&*-=_+<>,.?/\\' ])
// require('child_process').spawnSync('xdg-open', [ 'http://localhost?a=1#some://url?with=special&chars\'\":[]{}()!@#$%^&*-=_+<>,.?/\\' ])
// require('child_process').spawnSync('termux-open', [ 'http://localhost?a=1#some://url?with=special&chars\'\":[]{}()!@#$%^&*-=_+<>,.?/\\' ])
|
let express = require('express');
let router = express.Router();
let file = require('../module/file.js');
/**
* 读取目录内容
*/
router.get('/*',(req,res) => {
let promise = file.getAllDir(req.url);
promise.then((fileArr) => {
res.render('index',{
fileArr:fileArr
});
});
});
module.exports = router; |
Subsets and Splits