code stringlengths 2 1.05M |
|---|
/**
* @list dependencies
**/
var mocha = require('mocha');
var should = require('should');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var timestamps = require('../');
mongoose = mongoose.createConnection('mongodb://localhost/mongoose_timestamps')
mongoose.on('error', function (err) {
console.error('MongoDB error: ' + err.message);
console.error('Make sure a mongoDB server is running and accessible by this application')
});
var TimeCopSchema = new Schema({
email: String,
nemesis: { type: String, default: 'brian' }
});
TimeCopSchema.plugin(timestamps);
var TimeCop = mongoose.model('TimeCop', TimeCopSchema);
describe('update', function() {
it('should have updatedAt greater than or equal to createdAt upon updating', function(done) {
TimeCop.update({email: 'stewie@familyguysmatter.com'}, { $set: { nemesis: 'dave' } }, { upsert: false })
.exec(function (err, updated) {
TimeCop.findOne({email: 'stewie@familyguysmatter.com'}, function(err, update) {
update.updatedAt.should.not.be.below(updated.createdAt);
done();
});
});
})
after(function() {
mongoose.close();
});
})
|
class ScheduleRow{constructor(time,title,description,location,link){this.time=time;this.title=title;this.description=description;this.location=location;this.link=link}}
class ActivityRow{constructor(name,description,time,location,more){this.name=name;this.description=description;this.time=time;this.location=location;this.more=more}}
var activityRows=new Array();var des="各級系友紀念團拍"
var more="<a href='url_for('voting')'>最佳人氣獎</a>";more="攝影師將於舞台前主視覺--四十週年紀念看板前幫各級系友拍團體照留念。</br>可立即上傳並分享至四十週年粉絲專頁活動網頁按讚!</br>\
<b>拍照最多人數的系級</b>以及<b>按讚數最多的系級</b>將可獲頒最佳人氣獎!<a href='/voting'>...More</a><br>(以當天下午2點前之按讚數來評比)</br>\
另設有自拍機可立即將照片列印留存唷!</br>";var loc="台達館一樓中庭"
activityRows.push(new ActivityRow("各級系友紀念團拍",des,"4/23 9:30~16:00",loc,more));des="系所友回娘家交流活動及午宴";more="請師長、系友、同學報到領取精美好禮</br>\
好禮大放送:</br>\
<span fa fa-1x fa-star></span>40週年紀念對杯</br>\
<span fa fa-1x fa-star></span> 早到禮園遊券100份(面額NT:100元)</br>\
<span fa fa-1x fa-star></span> 填問卷+理監事圈選投票禮</br>\
<span fa fa-1x fa-star></span> 系友惠賜名片禮<br><a>四十週年紀念杯搶先看</a>";activityRows.push(new ActivityRow("資工40暨資應所系所友回娘家",des,"4/23 9:30~14:00",loc,more));des="各級畢業系友預約教室開同學會"
more="歡迎各級畢業系友預約教室開同學會,敬請班級聯絡人請於4/14(五)前至以下網站預約開同學會教室,謝謝您。</br> \
<a href='http://csalumni.web.nthu.edu.tw/files/87-1209-2102.php?Lang=zh-tw'> 點此預約</a>";loc="資電、台達館";activityRows.push(new ActivityRow("青春同學會",des,"4/23 14:00~16:00",loc,more));des="歡唱卡拉OK"
more="歡迎師長、系友、在校資工系學生、資應所學生、教職員報名卡拉OK一同歡唱。</br>\
為確保活動能順利進行,請欲歡唱的師長、系友、在校生上網報名。</br>\
活動當天請於舞台旁的卡拉OK處找工作人員先行點歌唷!</br>\
<a href='http://csalumni.web.nthu.edu.tw/files/87-1209-2103.php?Lang=zh-tw'>報名點此</a>";loc="台達館一樓中庭";activityRows.push(new ActivityRow("歡唱卡啦OK",des,"4/23 13:00~16:00",loc,more));des="親子專家說故事、親子勞作以及帶來魔術氣球表演";more="歡迎師長、系友攜家帶眷一同進教室聆聽親子專家說故事的單元,</br>\
並於說故事之後進行一段精彩的魔術氣球秀。</br> <a href='http://csalumni.web.nthu.edu.tw/files/87-1209-2104.php?Lang=zh-tw'> 點此報名 </a>";loc="台達館107教室";activityRows.push(new ActivityRow("兒童故事樂園/魔術氣球",des,"4/23 14:00~16:00",loc,more));var scheduleRows=new Array();des="<span class='fa fa-1x fa-check'></span>請師長、系友、同學報到領取精美好禮</br>\
<span class='fa fa-1x fa-check'></span>歡迎各級系友於四十週年紀念框前拍照留念,</br>\
分享按讚,將有機會獲得最佳人氣獎</br>\
<好禮大放送></br>\
(1)第一重:40週年紀念對杯 </br>\
(2)早到禮園遊券100份(面額NT:100元)</br>\
(3)填問卷+理監事圈選投票禮</br>\
(4)系友惠賜名片禮";scheduleRows.push(new ScheduleRow("09:30~10:00","報到",des,"台達館1樓中庭",""));des="李家同校長、陳文村校長、<br/>劉炯朗校長、唐傳義校長、黃能富院長(暫定)";scheduleRows.push(new ScheduleRow("10:00~10:30","貴賓致詞",des,"台達館1樓中庭",""));des="系友會會務報告-胡大雄會長</br>\
資工系及資應所現況分享-</br>\
系主任賴尚宏教授、王廷基所長";scheduleRows.push(new ScheduleRow("10:30~10:40","開幕致詞",des,"台達館1樓中庭"," "));des="1. 資工系成立四十週年紀念影片特輯</br>\
2. 傑出校友頒獎";scheduleRows.push(new ScheduleRow("10:40~11:05","往事回味",des,"台達館1樓中庭"," "));des="";scheduleRows.push(new ScheduleRow("11:05~12:00","系友創業分享",des,"台達館1樓中庭"," "));des="<b>美味buffet</b></br>\
頒發最佳人氣獎-以各系級大團圓照人數來評比</br>\
公布第四屆系友會理監事並頒發證書";scheduleRows.push(new ScheduleRow("12:00~14:00","午宴",des,"台達館1樓中庭",""));des="遴選第四屆系友會正副會長</br>\
頒發第四屆系友會理監事證書</br>\
討論年度系友會活動";scheduleRows.push(new ScheduleRow("14:00~15:00","第三屆及第四屆理監事交接會議",des,"台達館525會議室"," "));des="";scheduleRows.push(new ScheduleRow("13:10~16:00","歡唱卡啦OK",des,"台達1樓中庭"," "));des="由資應所的國際學生畢業後分享在台灣的工作經驗";scheduleRows.push(new ScheduleRow("13:30~15:00","國際學生在台工作經驗分享",des,"台達館108教室"," "));des="親子專家說故事、親子勞作";scheduleRows.push(new ScheduleRow("14:00~15:00","故事樂園",des,"台達館107教室"," "));des="";scheduleRows.push(new ScheduleRow("15:00~16:00","魔術氣球秀",des,"台達館107教室"," "));var activityBody=document.getElementById("activityBody");if(activityBody){for(var i in activityRows){var tr=document.createElement("tr");tr.innerHTML="\
<th scope='row'><h4><b>"+activityRows[i].name+"</b></h4></th>\n\
<td>"+activityRows[i].description+"</td>\n\
<td>"+activityRows[i].time+"</td>\n\
<td>"+activityRows[i].location+"</td>\n\
<td>"+activityRows[i].more+"</td>\n\
"
activityBody.appendChild(tr)}}
else{var scheduleBody=document.getElementById("scheduleBody_index");for(var i=0;i<activityRows.length;i++){var tr=document.createElement("tr");tr.innerHTML="\
<th scope='row' style='color:black'><h4>"+activityRows[i].name+"</h4></th>\n\
<td><h4>"+activityRows[i].time+"</h4></td>\n\
<td><h4>"+activityRows[i].location+"</h4></td>\n\
"
scheduleBody.appendChild(tr)}}
var scheduleBody=document.getElementById("scheduleBody");if(scheduleBody){for(var i in scheduleRows){var tr=document.createElement("tr");tr.innerHTML="\
<td><b>"+scheduleRows[i].time+"</b></td>\n\
<td><b>"+scheduleRows[i].title+"</b></td>\n\
<td>"+scheduleRows[i].description+"</td>\n\
<td>"+scheduleRows[i].location+"</td>\n\
"
scheduleBody.appendChild(tr)}} |
/**
* Player Entity
*/
game.PlayerEntity = me.Entity.extend({
/**
* constructor
*/
init:function (x, y, target_x, target_y) {
// call the constructor
this._super(me.Entity, 'init', [x, y, {width : 32, height : 32}]);
this.renderable = new me.AnimationSheet(0, 0, {
image : "man",
framewidth : 32,
frameheight : 32,
anchorPoint : new me.Vector2d(0.5, 0.5)
});
this.renderable.addAnimation ("idle", [0]);
this.renderable.setCurrentAnimation("idle");
this.body.setVelocity(2, 2);
this.body.vel.x = 0;
this.body.vel.y = 0;
this.path;
this.next;
},
/**
* update the entity
*/
update : function (dt) {
if(this.path === undefined) {
console.log(game.grid);
me.plugins.easystar.setGrid(game.grid || [0]);
me.plugins.easystar.setAcceptableTiles([0]);
me.plugins.easystar.findPath((this.pos.x/32)|0, (this.pos.y/32)|0, (game.end_point.x/32)|0, (game.end_point.y/32)|0, (function(path) {
this.path = path;
}).bind(this));
me.plugins.easystar.calculate();
}
//Check the path
if(this.path) {
// Got places to go
if(this.path.length > 0){
//Next destination
if(!this.next) {
console.log(this.path);
this.next = this.path.shift();
this.next.x *= 32;
this.next.y *= 32;
console.log(this.next);
console.log(this.pos);
}
var distx = this.next.x - this.pos.x;
var disty = this.next.y - this.pos.y;
if(Math.abs(distx) < 1 && Math.abs(disty) < 1) {
this.next = this.path.shift();
this.next.x *= 32;
this.next.y *= 32;
distx = this.next.x - this.pos.x;
disty = this.next.y - this.pos.x;
}
var dist = 0.2 * Math.sqrt((distx*distx) + (disty*disty));
this.body.vel.x = distx/dist;
this.body.vel.y = disty/dist;
} else {
// Stop
this.body.vel.x = 0;
this.body.vel.y = 0;
}
}
// apply physics to the body (this moves the entity)
this.body.update(dt);
// handle collisions against other shapes
//me.collision.check(this);
// return true if we moved or if the renderable was updated
return (this._super(me.Entity, 'update', [dt]) || this.body.vel.x !== 0 || this.body.vel.y !== 0);
},
/**
* colision handler
* (called when colliding with other objects)
*/
onCollision : function (response, other) {
// Make all other objects solid
return true;
}
});
|
'use strict';
module.exports = function(kbox, pantheon) {
// node modules
var format = require('util').format;
// npm modules
var _ = require('lodash');
// Kalabox modules.
var Promise = kbox.Promise;
// Load some boxmods
var log = kbox.core.log.make('PANTHEON CREATE EVENTS');
/*
* Returns the filemount based on the framework
*/
var getFilemount = function(framework) {
switch (framework) {
case 'drupal': return 'sites/default/files';
case 'drupal8': return 'sites/default/files';
case 'wordpress': return 'wp-content/uploads';
case 'backdrop': return 'files';
}
};
/*
* Add some other important Pantheon specigic things to our apps kalabox.yml before
* creating it
*/
kbox.core.events.on('pre-create-configure', function(data) {
// Grab the config from the data
var config = data.config;
var results = data.results;
var pkg = data.pkg;
// Only run on Pantheon apps
if (config.type === 'pantheon') {
// Grab relevant config
var sharingConfig = config.pluginconfig.sharing || {};
var pantheonConfig = config.pluginconfig.pantheon;
// Connect to pantheon so we can get some info about our site
return Promise.all([
pantheon.getSites(results.token),
pantheon.getEnvs(results.token, results.site)
])
// Update our config with relevant info
.then(function(info) {
// Extract some helful data
var devImages = _.includes(pkg.version, 'dev');
var site = _.find(info[0], function(site) {
return site.name === pantheonConfig.site;
});
var env = _.find(info[1], function(env) {
return env.name === pantheonConfig.env;
});
// Build the basic config out
pantheonConfig.uuid = site.uuid;
pantheonConfig.framework = site.framework || 'drupal';
pantheonConfig.upstream = site.upstream || 'none';
pantheonConfig.images = (devImages) ? 'dev' : 'v' + pkg.version;
pantheonConfig.php = env.php || site.php || 53;
// Use 56 if we get an unknown php version
// @todo: not sure if this condition can ever be met
if (!_.includes([53, 55, 56, 70], pantheonConfig.php)) {
pantheonConfig.php = 56;
}
// Determine the best drush container to use
var drushVersion = env.drush || site.drush || 7;
if (drushVersion === 5) {
drushVersion = 7;
}
// We want to support backdrop drush
if (pantheonConfig.framework === 'backdrop') {
drushVersion = 'backdrop';
}
var drushPhp = '-php5';
if (pantheonConfig.php === 70) {
drushPhp = '';
}
pantheonConfig.drush = drushVersion + drushPhp;
// Remove unneeded default settings ESPECIALLY THE TOKEN!!!
delete pantheonConfig.token;
delete pantheonConfig.nofiles;
delete pantheonConfig.nodb;
// Get the users profile
return pantheon.getUser(results.token);
})
// Set the name and email
.then(function(user) {
pantheonConfig.name = user.profile.full_name;
pantheonConfig.email = user.email;
})
// Reset all our config
.then(function() {
// Get the filemount from the framework and add it to our list of ignores
// NOTE: on Pantheon apps the filemount should be a symlink ie "Name" not "Path"
var ignores = sharingConfig.ignore || [];
ignores.push('Name ' + getFilemount(pantheonConfig.framework));
sharingConfig.ignore = ignores;
// Reset our config objects
config.pluginconfig.pantheon = pantheonConfig;
config.pluginconfig.sharing = sharingConfig;
config.version = pkg.version;
// Log the action
log.info('Pantheon kalabox.yml configured');
log.debug(format('Added Pantheon config: %j', pantheonConfig));
log.debug(format('Added sharing config: %j', sharingConfig));
});
}
});
};
|
'use strict';
/**
* Module dependencies.
*/
var path = require('path'),
mongoose = require('mongoose');
/**
* Article middleware
*/
var articleByID = function(req, res, next, id) {
if (!mongoose.Types.ObjectId.isValid(id)) {
return res.status(400).send({
message: 'Article is invalid'
});
}
req.app.locals.Article.findById(id).populate('user', 'displayName').exec(function (err, article) {
if (err) {
return next(err);
} else if (!article) {
return res.status(404).send({
message: 'No Article with that identifier has been found'
});
}
req.article = article;
next();
});
};
exports.install = function(app) {
console.log('installing article middleware');
app.param('articleId', articleByID);
};
|
/* TODO
Landscape
*/
//< Menu
app.addMenuItem({
cName: 'Tab Cropper',
cParent: submenu_name,
cExec: "tabCropper()"
});
//< Code
tabCropper = app.trustedFunction( function()
{
app.beginPriv();
if (app.activeDocs.length==0){
app.alert({ cTitle: 'Error: No Document', cMsg: "Please open a document first!", nIcon: 0 });
}
else {
count = 0; // Records the number of tabs
for (i=0;i<this.numPages;i++)
{
page_size = this.getPageBox({nPage: i}); //Current Page Size
tab_size = [0,792,648,0];
// Javascript can't compare arrays directly...
if (page_size.toString()==tab_size.toString())
{
//Crop 1/2" from left side
this.setPageBoxes({cBox:"Crop", nStart:i, rBox:[36,792,648,0]});
count++;
}
}
if (count==0)
{
app.alert("No tabs were detected.");
}
else
{
app.alert(count + " Tabs were cropped!");
}
}
app.endPriv();
}); |
const sampleData = {
events: [
{
id: '1',
title: 'Trip to Empire State building',
date: '2018-03-21T18:00:00',
category: 'culture',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sollicitudin ligula eu leo tincidunt, quis scelerisque magna dapibus. Sed eget ipsum vel arcu vehicula ullamcorper.',
city: 'NY, USA',
venue: 'Empire State Building, 5th Avenue, New York, NY, USA',
venueLatLng: {
lat: 40.7484405,
lng: -73.98566440000002
},
hostedBy: 'Bob',
hostPhotoURL: 'https://randomuser.me/api/portraits/men/20.jpg',
attendees: [
{
id: 'a',
name: 'Bob',
photoURL: 'https://randomuser.me/api/portraits/men/20.jpg'
},
{
id: 'b',
name: 'Tom',
photoURL: 'https://randomuser.me/api/portraits/men/22.jpg'
}
]
},
{
id: '2',
title: 'Trip to Punch and Judy Pub',
date: '2018-03-18T14:00:00',
category: 'drinks',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sollicitudin ligula eu leo tincidunt, quis scelerisque magna dapibus. Sed eget ipsum vel arcu vehicula ullamcorper.',
city: 'London, UK',
venue: 'Punch & Judy, Henrietta Street, London, UK',
venueLatLng: {
lat: 51.5118074,
lng: -0.12300089999996544
},
hostedBy: 'Tom',
hostPhotoURL: 'https://randomuser.me/api/portraits/men/22.jpg',
attendees: [
{
id: 'a',
name: 'Bob',
photoURL: 'https://randomuser.me/api/portraits/men/20.jpg'
},
{
id: 'b',
name: 'Tom',
photoURL: 'https://randomuser.me/api/portraits/men/22.jpg'
}
]
}
]
}
export default sampleData
|
var Promise = require('bluebird'),
_ = require('lodash'),
hbs = require('express-hbs'),
path = require('path'),
pfs = require('./promised-fs'),
ignore = ['node_modules', 'bower_components', '.DS_Store', '.git', 'Thumbs.db'],
readHbs = hbs.create(),
readThemeStructure,
readHbsFiles;
readThemeStructure = function readThemeFiles(themePath, subPath, arr) {
subPath = subPath || '';
arr = arr || [];
var makeResult = function makeResult(result, subFilePath, ext) {
result.push({
file: subFilePath,
ext: ext
});
return result;
};
return pfs.readDir(themePath).then(function (files) {
return Promise.reduce(files, function (result, file) {
var extMatch = file.match(/.*?(\..+$)/),
subFilePath = path.join(subPath, file),
newPath;
// Don't process ignored paths
if (ignore.indexOf(file) > -1) {
return result;
}
// If it has an extension, treat it as a file
if (extMatch) {
return makeResult(result, subFilePath, extMatch[1]);
} else {
newPath = path.join(themePath, file);
return pfs.statFile(newPath).then(function (statFile) {
if (statFile.isDirectory()) {
return readThemeStructure(newPath, subFilePath, result);
} else {
return makeResult(result, subFilePath);
}
});
}
}, arr);
});
};
readHbsFiles = function readHbsFiles(theme) {
// Setup a partials array
theme.partials = [];
return Promise.map(_.where(theme.files, {ext: '.hbs'}), function (themeFile) {
return pfs.readFile(path.join(theme.path, themeFile.file), 'utf8').then(function (content) {
var partialMatch = themeFile.file.match(/^partials\/(.*)+\.hbs$/);
themeFile.content = content;
try {
themeFile.compiled = readHbs.handlebars.precompile(content);
} catch (error) {
// This error is caught and handled in the template-compile check
}
// If this is a partial, put the partial name in the partials array
if (partialMatch) {
theme.partials.push(partialMatch[1]);
}
processHelpers(theme, themeFile);
});
}).then(function () {
return theme;
});
};
processHelpers = function (theme, themeFile) {
var helperRegex = /helpers(\.|\[')([a-z0-9_-]+)/gmi,
helperName,
match;
theme.helpers = theme.helpers || {};
while ((match = helperRegex.exec(themeFile.compiled)) !== null) {
helperName = match[2];
if (theme.helpers[helperName]) {
theme.helpers[helperName].push(themeFile.file);
} else {
theme.helpers[helperName] = [themeFile.file];
}
}
};
module.exports = function readTheme(themePath) {
return readThemeStructure(themePath).then(function (themeFiles) {
var theme = {
path: themePath,
files: themeFiles,
results: {
pass: [],
fail: {}
}
};
return readHbsFiles(theme);
});
};
|
/**
* @fileoverview Chrome window manager logic code.
* @author Jakzo
*/
/**
* Manages a session (set of tabs within a window).
* @constructor
* @param {Object} options
* @param {?Window} options.window The window object this session is associated
* with.
* @param {?Array.<Session.Tab>} options.tabs A list of tabs that belong to this
* session.
* @param {?string} options.name The name of the session. Defaults to the title
* of the first tab.
*/
var Session = function(options) {
/**
* The ID of the window object this session is associated with.
* @type {?Window}
*/
this.id = options.id || options.window && options.window.id || null;
/**
* Tabs belonging to this session.
* @type {Session.Tab}
*/
this.tabs = options.tabs || [];
/**
* The name of the session.
* @type {?string}
*/
this.name = options.name || null;
this.update();
Session.all.push(this);
if(options.window && options.window.focused) this.focused();
};
/**
* Moves the session to the top of the list when it's window is focused.
*/
Session.prototype.focused = function() {
this.remove();
Session.all.splice(0, 0, this);
};
/**
* Closes the window associated with the session.
*/
Session.prototype.close = function() {
if(this.id) chrome.windows.remove(this.id);
};
/**
* Removes the session from the list of all sessions.
*/
Session.prototype.remove = function() {
for(var s = 0; s < Session.all.length; s++) {
if(Session.all[s] == this) {
Session.all.splice(s, 1);
return;
}
}
};
/**
* Updates the session details based on it's window.
*/
Session.prototype.update = function() {
if(!this.id) return;
var self = this,
options = { populate: true };
chrome.windows.get(this.id, options, function(win) {
self.tabs = [];
win.tabs.forEach(function(tab) {
self.tabs.push(new Session.Tab({
id: tab.id,
url: tab.url,
title: tab.title,
icon: tab.favIconUrl
}));
});
});
};
/**
* Manages session data for a tab.
* @constructor
* @param {Object} options
* @param {?number} options.id The ID of the tab it is associated with.
* @param {?string} options.url URL of the tab.
* @param {?string} options.title Title of the tab.
* @param {?string} options.icon URL of the icon image for the tab.
*/
Session.Tab = function(options) {
/**
* The ID of the tab it is associated with.
* @type {?number}
*/
this.id = options.id || null;
/**
* URL of the tab.
* @type {?string}
*/
this.url = options.url || null;
/**
* Title of the tab.
* @type {?string}
*/
this.title = options.title || null;
/**
* URL of the icon image for the tab.
* @type {?string}
*/
this.icon = options.icon || null;
};
/**
* List of all (open and closed) sessions.
* @type {Session}
*/
Session.all = [];
/**
* Saves the current state of the sessions.
*/
Session.save = function() {
//Limit the amount of sessions
Session.all = Session.all.slice(0, 64);
//Get the session save data
var saveData = [];
Session.all.forEach(function(session) {
var tabData = [];
session.tabs.forEach(function(tab) {
tabData.push({
url: tab.url,
title: tab.title,
icon: tab.icon
});
});
saveData.push({
name: session.name,
tabs: tabData
});
});
localStorage.setItem("savedSessions", JSON.stringify(saveData));
//Update any open popups
chrome.extension.getViews().forEach(function(popup) {
if(popup.renderSessions) setTimeout(function() {
popup.renderSessions(window);
}, 100);
});
};
/**
* Returns the session that has a certain window attached to it.
* @param {number|Window} idOrWindow Session ID or chrome window object.
* @return {?Session}
*/
Session.get = function(idOrWindow) {
if(!idOrWindow) return;
var id, win;
if(typeof idOrWindow == "number") id = idOrWindow;
else {
win = idOrWindow;
id = win.id;
}
for(var s = 0; s < Session.all.length; s++) {
var session = Session.all[s];
if(session.id == id) return session;
//Check the URL of each tab to see if the window matches the session
if(win && !session.id && win.tabs.length == session.tabs.length) {
var match = true;
for(var t = 0; t < win.tabs.length; t++) {
if(!Session.isSameUrl(win.tabs[t].url, session.tabs[t].url)) {
match = false;
break;
}
}
if(match) return session;
}
}
return null;
};
/**
* Checks if two URLs are the same page.
* @param {string} url1
* @param {string} url2
* @return {boolean} True if they are the same page.
*/
Session.isSameUrl = function(url1, url2) {
function clean(url) {
var hashIndex = url.indexOf("#");
if(~hashIndex) url = url.substr(0, hashIndex);
return url;
}
return clean(url1) == clean(url2);
};
/**
* Create a new session based on a new window or returns the existing session
* associated with the window.
* @param {Window} win
* @return {Session}
*/
Session.onWindowCreated = function(win) {
if(!win) return;
var session = Session.get(win);
if(session) {
session.id = win.id;
session.tabs.forEach(function(tab, t) {
tab.id = win.tabs[t].id;
});
}
else new Session({
window: win
});
};
/**
* Creates sessions from saved sessions and currently open windows.
*/
Session.initialise = function() {
//Get saved sessions
var savedSessions = JSON.parse(localStorage.getItem("savedSessions")) || [];
savedSessions.forEach(function(saveData) {
var tabs = [];
saveData.tabs.forEach(function(tab) {
tabs.push(new Session.Tab({
url: tab.url,
title: tab.title,
icon: tab.icon
}));
});
new Session({
name: saveData.name,
tabs: tabs
});
});
//Create sessions from currently open windows
var options = { populate: true };
chrome.windows.getAll(options, function(allWindows) {
allWindows.forEach(Session.onWindowCreated);
});
Session.save();
//Move the most recently focused window to the top of the list
chrome.windows.onFocusChanged.addListener(function(id) {
var session = Session.get(id);
if(session) {
session.focused();
Session.save();
}
});
//Associate new windows with sessions
chrome.windows.onCreated.addListener(function(win) {
var options = { populate: true };
/*
* Sometimes the onCreated event will be fired when the window does not
* exist (mostly when loading a developer tools window) and the callback
* for chrome.windows.get will still be called despite the window not
* existing.
*/
chrome.windows.get(win.id, options, Session.onWindowCreated);
Session.save();
});
//Close sessions when their window is closed
chrome.windows.onRemoved.addListener(function(windowId) {
var session = Session.get(windowId);
if(session) {
if(session.tabs.length) session.id = null;
//Remove the session if it has no tabs
else for(var s = 0; s < Session.all.length; s++) {
var session = Session.all[s];
if(session.id == windowId) {
Session.all.splice(s, 1);
break;
}
}
session.id = null;
Session.save();
}
});
//Update sessions when tabs change
function sessionChanged(windowId) {
var session = Session.get(windowId);
if(session) {
session.update();
Session.save();
}
}
chrome.tabs.onCreated.addListener(function(tab) {
sessionChanged(tab.windowId);
});
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
sessionChanged(tab.windowId);
});
chrome.tabs.onMoved.addListener(function(tabId, moveInfo) {
sessionChanged(moveInfo.windowId);
});
chrome.tabs.onDetached.addListener(function(tabId, detachInfo) {
sessionChanged(detachInfo.oldWindowId);
});
chrome.tabs.onAttached.addListener(function(tabId, attachInfo) {
sessionChanged(attachInfo.newWindowId);
});
chrome.tabs.onRemoved.addListener(function(tabId, removeInfo) {
if(!removeInfo.isWindowClosing) sessionChanged(removeInfo.windowId);
});
chrome.tabs.onReplaced.addListener(function(addedTabId, removedTabId) {
/** @todo Should I be handling this event...? */
for(var s = 0; s < Session.all.length; s++) {
var session = Session.all[s];
for(var t = 0; t < session.tabs.length; t++) {
if(session.tabs[t].id == removedTabId) {
sessionChanged(session.id);
return;
}
}
}
});
};
Session.initialise();
|
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: config.locationType,
//rootURL: config.rootURL
});
Router.map(function() {
this.route('home', {
path: '/'
});
this.route('header');
this.route('item');
this.route('empty');
this.route('forms', function() {
this.route('select');
this.route('radio');
this.route('switch');
this.route('icon');
});
this.route('dropdown');
});
export default Router;
|
Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _jsxFileName='src/RectangleButton.js';exports.default=
RectangleButton;var _react=require('react');var _react2=_interopRequireDefault(_react);var _ButtonComponent=require('./ButtonComponent');var _ButtonComponent2=_interopRequireDefault(_ButtonComponent);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function RectangleButton(props){
var progressSize=props.height/2;
return(
_react2.default.createElement(_ButtonComponent2.default,_extends({},
props,{
shape:'rectangle',
width:props.width,
height:props.height,
progressSize:progressSize,__source:{fileName:_jsxFileName,lineNumber:8}})));
}
RectangleButton.propTypes=_extends({},
_ButtonComponent2.default.propTypes);
RectangleButton.defaultProps={
width:null,
height:50}; |
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = (env) => {
const isDevBuild = !(env && env.prod);
const extractCSS = new ExtractTextPlugin('vendor.css');
return [{
stats: { modules: false },
resolve: { extensions: [ '.js' ] },
entry: {
vendor: [
'bootstrap',
'bootstrap/dist/css/bootstrap.css',
'event-source-polyfill',
'isomorphic-fetch',
'jquery',
'vue',
'vue-router'
],
},
module: {
rules: [
{ test: /\.css(\?|$)/, use: extractCSS.extract({ use: 'css-loader' }) },
{ test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/, use: 'url-loader?limit=100000' }
]
},
output: {
path: path.join(__dirname, 'wwwroot', 'dist'),
publicPath: '/dist/',
filename: '[name].js',
library: '[name]_[hash]'
},
plugins: [
extractCSS,
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
new webpack.DefinePlugin({
'process.env.NODE_ENV': isDevBuild ? '"development"' : '"production"'
}),
new webpack.DllPlugin({
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
name: '[name]_[hash]'
})
].concat(isDevBuild ? [] : [
new webpack.optimize.UglifyJsPlugin()
])
}];
};
|
BlazeComponent.extendComponent({
onCreated() {
this.ownerFilter = new ReactiveVar(false);
},
isOwnerFilter() {
return this.ownerFilter.get();
},
setOwnerFilter(tf) {
return this.ownerFilter.set(tf);
},
events() {
return [{
'click .js-toggle-label-filter'(evt) {
evt.preventDefault();
Filter.labelIds.toggle(this.currentData()._id);
Filter.resetExceptions();
},
'click .js-set-owner-filter'(evt) {
evt.stopPropagation();
Filter.reset();
this.setOwnerFilter(true);
},
'click .js-unset-owner-filter'(evt) {
evt.stopPropagation();
Filter.reset();
this.setOwnerFilter(false);
},
'click .js-toggle-member-filter'(evt) {
evt.preventDefault();
if (this.isOwnerFilter()) {
Filter.userId.toggle(this.currentData()._id);
} else {
Filter.members.toggle(this.currentData()._id);
}
Filter.resetExceptions();
},
'click .js-clear-all'(evt) {
evt.preventDefault();
Filter.reset();
},
'click .js-filter-to-selection'(evt) {
evt.preventDefault();
const selectedCards = Cards.find(Filter.mongoSelector()).map((c) => {
return c._id;
});
MultiSelection.add(selectedCards);
},
}];
},
}).register('filterSidebar');
function mutateSelectedCards(mutationName, ...args) {
Cards.find(MultiSelection.getMongoSelector()).forEach((card) => {
card[mutationName](...args);
});
}
BlazeComponent.extendComponent({
mapSelection(kind, _id) {
return Cards.find(MultiSelection.getMongoSelector()).map((card) => {
const methodName = kind === 'label' ? 'hasLabel' : 'isAssigned';
return card[methodName](_id);
});
},
allSelectedElementHave(kind, _id) {
if (MultiSelection.isEmpty())
return false;
else
return _.every(this.mapSelection(kind, _id));
},
someSelectedElementHave(kind, _id) {
if (MultiSelection.isEmpty())
return false;
else
return _.some(this.mapSelection(kind, _id));
},
events() {
return [{
'click .js-toggle-label-multiselection'(evt) {
const labelId = this.currentData()._id;
const mappedSelection = this.mapSelection('label', labelId);
if (_.every(mappedSelection)) {
mutateSelectedCards('removeLabel', labelId);
} else if (_.every(mappedSelection, (bool) => !bool)) {
mutateSelectedCards('addLabel', labelId);
} else {
const popup = Popup.open('disambiguateMultiLabel');
// XXX We need to have a better integration between the popup and the
// UI components systems.
return popup.call(this.currentData(), evt);
}
},
'click .js-toggle-member-multiselection'(evt) {
const memberId = this.currentData()._id;
const mappedSelection = this.mapSelection('member', memberId);
if (_.every(mappedSelection)) {
mutateSelectedCards('unassignMember', memberId);
} else if (_.every(mappedSelection, (bool) => !bool)) {
mutateSelectedCards('assignMember', memberId);
} else {
const popup = Popup.open('disambiguateMultiMember');
// XXX We need to have a better integration between the popup and the
// UI components systems.
return popup.call(this.currentData(), evt);
}
},
'click .js-export-selection-tsv': Popup.open('exportSelectionTsv'),
'click .js-move-selection': Popup.open('moveSelection'),
'click .js-archive-selection'() {
mutateSelectedCards('archive');
EscapeActions.executeUpTo('multiselection');
},
}];
},
}).register('multiselectionSidebar');
Template.disambiguateMultiLabelPopup.events({
'click .js-remove-label'() {
mutateSelectedCards('removeLabel', this._id);
Popup.close();
},
'click .js-add-label'() {
mutateSelectedCards('addLabel', this._id);
Popup.close();
},
});
Template.disambiguateMultiMemberPopup.events({
'click .js-unassign-member'() {
mutateSelectedCards('assignMember', this._id);
Popup.close();
},
'click .js-assign-member'() {
mutateSelectedCards('unassignMember', this._id);
Popup.close();
},
});
Template.moveSelectionPopup.events({
'click .js-select-list'() {
mutateSelectedCards('move', this._id);
EscapeActions.executeUpTo('multiselection');
},
});
Template.exportSelectionTsvPopup.onRendered(function() {
Meteor.call('exportCsvData', MultiSelection.getMongoSelector(), Session.get('currentBoard'), true, (err, ret) => {
if (!err) {
$('.js-export-cards-tsv').val(ret);
}
});
});
|
/**
* Developer: Stepan Burguchev
* Date: 8/19/2015
* Copyright: 2009-2016 Comindware®
* All Rights Reserved
* Published under the MIT license
*/
"use strict";
import template from './templates/mentionEditor.hbs';
import { Handlebars } from '../../libApi';
import dropdown from '../../dropdown/dropdownApi';
import '../../utils/utilsApi';
import BaseLayoutEditorView from './base/BaseLayoutEditorView';
import membersFactory from './impl/common/members/services/factory';
import TextAreaEditorView from './TextAreaEditorView';
import LocalizationService from '../../services/LocalizationService';
const defaultOptions = {
editorOptions: null
};
/**
* @name MentionEditorView
* @memberof module:core.form.editors
* @class Текстовый редактор с возможностью упоминания пользователей (mentions). Поддерживаемый тип данных: <code>String</code>
* (простой многострочный текст). Например, <code>'Hello, @alex!'</code>. Список доступных пользователей
* берется из <code>core.services.CacheService</code>.
* @extends module:core.form.editors.base.BaseEditorView
* @param {Object} options Options object. All the properties of {@link module:core.form.editors.base.BaseEditorView BaseEditorView} class are also supported.
* @param {Number} [options.editorOptions=Object] Опции для используемого {@link module:core.form.editors.TextAreaEditorView TextAreaEditorView}.
* */
Backbone.Form.editors.Mention = BaseLayoutEditorView.extend(/** @lends module:core.form.editors.MentionEditorView.prototype */{
initialize: function (options) {
if (options.schema) {
_.extend(this.options, defaultOptions, _.pick(options.schema, _.keys(defaultOptions)));
} else {
_.extend(this.options, defaultOptions, _.pick(options || {}, _.keys(defaultOptions)));
}
this.__createViewModel();
},
focusElement: null,
__createViewModel: function () {
this.viewModel = new Backbone.Model();
var membersCollection = membersFactory.createMembersCollection();
this.viewModel.set('availableMembers', membersCollection);
this.viewModel.set('membersByUserName', membersCollection.reduce(function (memo, value) {
memo[value.get('userName')] = value;
return memo;
}, {}));
},
template: Handlebars.compile(template),
regions: {
dropdownRegion: '.js-dropdown-region'
},
onShow: function () {
if (this.dropdownView) {
this.stopListening(this.dropdownView);
}
this.dropdownView = dropdown.factory.createDropdown({
buttonView: TextAreaEditorView,
buttonViewOptions: _.extend({}, this.options.editorOptions || {}, {
model: this.model,
readonly: this.getReadonly(),
enabled: this.getEnabled(),
key: this.key,
autocommit: this.options.autocommit,
emptyPlaceholder:LocalizationService.get('CORE.FORM.EDITORS.MENTIONS.PLACEHOLDER')
}),
panelView: membersFactory.getMembersListView(),
panelViewOptions: {
collection: this.viewModel.get('availableMembers')
},
autoOpen: false,
renderAfterClose: false
});
this.dropdownRegion.show(this.dropdownView);
this.listenTo(this.dropdownView, 'button:change', this.__onTextChange);
this.listenTo(this.dropdownView, 'button:focus', this.__onFocus);
this.listenTo(this.dropdownView, 'button:blur', this.__onBlur);
this.listenTo(this.dropdownView, 'button:input', this.__onInput);
this.listenTo(this.dropdownView, 'button:caretChange', this.__onCaretChange);
this.listenTo(this.dropdownView, 'panel:member:select', this.__onMemberSelect);
_.each(this.keyboardShortcuts, function (v, k) {
this.dropdownView.button.addKeyboardListener(k, v.bind(this));
}, this);
// We discarded it during render phase, so we do it now.
this.setPermissions(this.enabled, this.readonly);
this.setValue(this.value);
},
keyboardShortcuts: {
'up': function () {
if (!this.dropdownView.isOpen) {
return true;
}
this.__sendPanelCommand('up');
this.__updateMentionInText();
},
'down': function () {
if (!this.dropdownView.isOpen) {
return true;
}
this.__sendPanelCommand('down');
this.__updateMentionInText();
},
'enter,num_enter': function () {
if (!this.dropdownView.isOpen) {
return true;
}
this.__updateMentionInText();
this.dropdownView.close();
},
'escape': function () {
this.dropdownView.close();
}
},
__value: function (value) {
this.setValue(value);
this.__triggerChange();
},
__onTextChange: function () {
this.value = this.dropdownView.button.getValue();
this.__triggerChange();
},
__onFocus: function () {
this.trigger('focus', this);
},
__onBlur: function () {
this.trigger('blur', this);
},
__onInput: function (text, caret) {
// 1. Open dropdown when: @ is immediately before caret, @ is at start or prepended by whitespace
// 2. Maintain dropdown open (and filter the list) when: text between caret and @ matches username pattern [a-zA-Z0-9_\.]
// 3. Hide dropdown when: username text doesn't match
// 4. track caret change and hide dropdown if resulting username patters doesn't match
// 5. hide dropdown on blur
var leftFragment = text.substring(0, caret.end);
var regex = /(?:\s|^)@([a-z0-9_\.]*)$/i;
var match = leftFragment.match(regex);
if (match) {
var userName = match[1];
this.dropdownView.open();
var collection = this.viewModel.get('availableMembers');
collection.applyTextFilter(userName);
if (collection.length === 0) {
this.dropdownView.close();
}
this.mentionState = {
start: caret.end - userName.length,
end: caret.end,
text: text
};
} else {
this.dropdownView.close();
}
},
__onCaretChange: function (text, caret) {
if (this.dropdownView.isOpen) {
this.__onInput(text, caret);
}
},
__onMemberSelect: function () {
this.__updateMentionInText();
this.dropdownView.close();
},
__updateMentionInText: function () {
var selectedMember = this.viewModel.get('availableMembers').selected;
if (!selectedMember) {
return;
}
var editor = this.dropdownView.button;
var text = this.mentionState.text;
var mention = selectedMember.get('userName') || '';
if (mention && !text.substring(this.mentionState.end).match(/^\s/)) {
mention += ' ';
}
var updatedText = text.substring(0, this.mentionState.start) +
mention +
text.substring(this.mentionState.end);
editor.setValue(updatedText);
editor.setCaretPos(this.mentionState.start + mention.length);
this.value = updatedText;
this.__triggerChange();
},
/**
* Получить список пользователей, упомянутых в тексте.
* @return {String[]} Список строковых идентификаторов пользователей, упомянутых в тексте.
* */
getMentions: function () {
var text = this.getValue();
var regex = /(?:\s|^)@([a-z0-9_\.]+)/gi;
var members = this.viewModel.get('membersByUserName');
var result = [];
while (true) {
var matches = regex.exec(text);
if (!matches) {
break;
}
var userName = matches[1];
var member = members[userName];
if (member) {
result.push(member.id);
}
}
return _.uniq(result);
},
setValue: function (value) {
if (this.dropdownView) {
this.dropdownView.button.setValue(value);
this.value = this.dropdownView.button.getValue();
} else {
this.value = value;
}
},
__sendPanelCommand: function (command, options) {
if (this.dropdownView.isOpen) {
this.dropdownView.panelView.handleCommand(command, options);
}
},
__setEnabled: function (enabled) {
BaseLayoutEditorView.prototype.__setEnabled.call(this, enabled);
if (this.dropdownView) {
this.dropdownView.button.setEnabled(enabled);
}
},
__setReadonly: function (readonly) {
BaseLayoutEditorView.prototype.__setReadonly.call(this, readonly);
if (this.dropdownView) {
this.dropdownView.button.setReadonly(readonly);
}
}
});
export default Backbone.Form.editors.Mention;
|
constant_switch_1: {
options = { dead_code: true, evaluate: true };
input: {
switch (1+1) {
case 1: foo(); break;
case 1+1: bar(); break;
case 1+1+1: baz(); break;
}
}
expect: {
bar();
}
}
constant_switch_2: {
options = { dead_code: true, evaluate: true };
input: {
switch (1) {
case 1: foo();
case 1+1: bar(); break;
case 1+1+1: baz();
}
}
expect: {
foo();
bar();
}
}
constant_switch_3: {
options = { dead_code: true, evaluate: true };
input: {
switch (10) {
case 1: foo();
case 1+1: bar(); break;
case 1+1+1: baz();
default:
def();
}
}
expect: {
def();
}
}
constant_switch_4: {
options = { dead_code: true, evaluate: true };
input: {
switch (2) {
case 1:
x();
if (foo) break;
y();
break;
case 1+1:
bar();
default:
def();
}
}
expect: {
bar();
def();
}
}
constant_switch_5: {
options = { dead_code: true, evaluate: true };
input: {
switch (1) {
case 1:
x();
if (foo) break;
y();
break;
case 1+1:
bar();
default:
def();
}
}
expect: {
// the break inside the if ruins our job
// we can still get rid of irrelevant cases.
switch (1) {
case 1:
x();
if (foo) break;
y();
}
// XXX: we could optimize this better by inventing an outer
// labeled block, but that's kinda tricky.
}
}
constant_switch_6: {
options = { dead_code: true, evaluate: true };
input: {
OUT: {
foo();
switch (1) {
case 1:
x();
if (foo) break OUT;
y();
case 1+1:
bar();
break;
default:
def();
}
}
}
expect: {
OUT: {
foo();
x();
if (foo) break OUT;
y();
bar();
}
}
}
constant_switch_7: {
options = { dead_code: true, evaluate: true };
input: {
OUT: {
foo();
switch (1) {
case 1:
x();
if (foo) break OUT;
for (var x = 0; x < 10; x++) {
if (x > 5) break; // this break refers to the for, not to the switch; thus it
// shouldn't ruin our optimization
console.log(x);
}
y();
case 1+1:
bar();
break;
default:
def();
}
}
}
expect: {
OUT: {
foo();
x();
if (foo) break OUT;
for (var x = 0; x < 10; x++) {
if (x > 5) break;
console.log(x);
}
y();
bar();
}
}
}
constant_switch_8: {
options = { dead_code: true, evaluate: true };
input: {
OUT: switch (1) {
case 1:
x();
for (;;) break OUT;
y();
break;
case 1+1:
bar();
default:
def();
}
}
expect: {
OUT: {
x();
for (;;) break OUT;
y();
}
}
}
constant_switch_9: {
options = { dead_code: true, evaluate: true };
input: {
OUT: switch (1) {
case 1:
x();
for (;;) if (foo) break OUT;
y();
case 1+1:
bar();
default:
def();
}
}
expect: {
OUT: {
x();
for (;;) if (foo) break OUT;
y();
bar();
def();
}
}
}
drop_default_1: {
options = { dead_code: true };
input: {
switch (foo) {
case 'bar': baz();
default:
}
}
expect: {
switch (foo) {
case 'bar': baz();
}
}
}
drop_default_2: {
options = { dead_code: true };
input: {
switch (foo) {
case 'bar': baz(); break;
default:
break;
}
}
expect: {
switch (foo) {
case 'bar': baz();
}
}
}
keep_default: {
options = { dead_code: true };
input: {
switch (foo) {
case 'bar': baz();
default:
something();
break;
}
}
expect: {
switch (foo) {
case 'bar': baz();
default:
something();
}
}
}
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Grid } from '../../lib/grid';
import { Cell } from '../../lib/data-set/cell';
import { Row } from '../../lib/data-set/row';
var CellComponent = (function () {
function CellComponent() {
this.inputClass = '';
this.mode = 'inline';
this.isInEditing = false;
this.edited = new EventEmitter();
}
CellComponent.prototype.onEdited = function (event) {
if (this.isNew) {
this.grid.create(this.grid.getNewRow(), this.createConfirm);
}
else {
this.grid.save(this.row, this.editConfirm);
}
};
return CellComponent;
}());
__decorate([
Input(),
__metadata("design:type", Grid)
], CellComponent.prototype, "grid", void 0);
__decorate([
Input(),
__metadata("design:type", Row)
], CellComponent.prototype, "row", void 0);
__decorate([
Input(),
__metadata("design:type", EventEmitter)
], CellComponent.prototype, "editConfirm", void 0);
__decorate([
Input(),
__metadata("design:type", EventEmitter)
], CellComponent.prototype, "createConfirm", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], CellComponent.prototype, "isNew", void 0);
__decorate([
Input(),
__metadata("design:type", Cell)
], CellComponent.prototype, "cell", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CellComponent.prototype, "inputClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], CellComponent.prototype, "mode", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], CellComponent.prototype, "isInEditing", void 0);
__decorate([
Output(),
__metadata("design:type", Object)
], CellComponent.prototype, "edited", void 0);
CellComponent = __decorate([
Component({
selector: 'ng2-smart-table-cell',
template: "\n <table-cell-view-mode *ngIf=\"!isInEditing\" [cell]=\"cell\"></table-cell-view-mode>\n <table-cell-edit-mode *ngIf=\"isInEditing\" [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (edited)=\"onEdited($event)\">\n </table-cell-edit-mode>\n ",
})
], CellComponent);
export { CellComponent };
//# sourceMappingURL=cell.component.js.map |
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require('@angular/core');
var platform_browser_1 = require('@angular/platform-browser');
var router_1 = require('@angular/router');
var http_1 = require('@angular/http');
var app_component_1 = require('./app.component');
var dashboard_component_1 = require('./dashboard/dashboard.component');
var dashboard_module_1 = require('./dashboard/dashboard.module');
var sidebar_module_1 = require('./sidebar/sidebar.module');
var footer_module_1 = require('./shared/footer/footer.module');
var navbar_module_1 = require('./shared/navbar/navbar.module');
var api_service_1 = require('./services/api.service');
var user_service_1 = require('./services/user.service');
var common_1 = require('@angular/common');
var AppModule = (function () {
function AppModule() {
}
AppModule = __decorate([
core_1.NgModule({
imports: [
platform_browser_1.BrowserModule,
dashboard_module_1.DashboardModule,
sidebar_module_1.SidebarModule,
navbar_module_1.NavbarModule,
footer_module_1.FooterModule,
router_1.RouterModule.forRoot([]),
http_1.HttpModule
],
declarations: [app_component_1.AppComponent, dashboard_component_1.DashboardComponent],
providers: [{ provide: common_1.LocationStrategy, useClass: common_1.HashLocationStrategy },
user_service_1.UserService,
api_service_1.ApiProvider
],
bootstrap: [app_component_1.AppComponent]
}),
__metadata('design:paramtypes', [])
], AppModule);
return AppModule;
}());
exports.AppModule = AppModule;
//# sourceMappingURL=app.module.js.map |
/*
* winston.js: Top-level include defining Winston.
*
* (C) 2010 Charlie Robbins
* MIT LICENCE
*
*/
require.paths.unshift(require('path').join(__dirname));
var winston = exports;
// Expose version
winston.version = [0, 2, 9];
//
// Include transports defined by default by winston
//
winston.transports = require('winston/transports');
//
// function findTransport (transport)
// Helper method to find existing transport
//
winston.findTransport = function (transport) {
var name, existing = Object.keys(winston.transports).filter(function (k) {
return winston.transports[k] === transport;
});
return existing.length > 0 ? existing[0].toLowerCase() : null;
};
var utils = require('winston/utils');
winston.hash = utils.hash;
winston.clone = utils.clone;
winston.longestElement = utils.longestElement;
winston.config = require('winston/config');
winston.addColors = winston.config.addColors;
winston.Logger = require('winston/logger').Logger;
//
// We create and expose a "defaultLogger" so that the programmer may do the
// following without the need to create an instance of winston.Logger directly:
// var winston = require('winston');
// winston.log('info', 'some message');
// winston.error('some error');
//
var defaultLogger = new (winston.Logger)({ transports: [new (winston.transports.Console)()] });
utils.setLevels(winston, null, defaultLogger.levels);
['log', 'add', 'remove', 'profile', 'extend', 'cli'].forEach(function (method) {
winston[method] = function () {
return defaultLogger[method].apply(defaultLogger, arguments);
};
});
winston.cli = function (foo, bar) {
winston.padLevels = true;
utils.setLevels(winston, defaultLogger.levels, winston.config.cli.levels);
defaultLogger.setLevels(winston.config.cli.levels);
winston.config.addColors(winston.config.cli.colors);
if (defaultLogger.transports.console) {
defaultLogger.transports.console.colorize = true;
defaultLogger.transports.console.timestamp = false;
}
};
winston.setLevels = function (levels) {
utils.setLevels(winston, defaultLogger.levels, levels);
defaultLogger.setLevels(levels);
};
//
// Define getters / setters for appropriate properties of the
// default logger which need to be exposed by winston.
//
['emitErrs', 'padLevels', 'levelLength'].forEach(function (prop) {
Object.defineProperty(winston, prop, {
get: function () {
return defaultLogger[prop];
},
set: function (val) {
defaultLogger[prop] = val;
}
});
});
//
// function defaultTransports ()
// returns the transports set on the default winston logger
//
winston.defaultTransports = function () {
return defaultLogger.transports;
}; |
const autoKeys = ['id', 'createdAt', 'updatedAt'];
export default (schema = {}, data, crypto, method = () => {}) => {
if (data === undefined) return undefined;
const props = {};
let value;
Object.keys(schema).forEach((key) => {
value = data[key];
// props[key] = value;
// if (value && crypto && typeof value === 'string') props[key] = method(value, crypto);
if (value) props[key] = crypto && typeof value === 'string' ? method(value, crypto) : value;
});
autoKeys.forEach((key) => {
value = data[key];
if (value) props[key] = value;
});
return props;
};
|
var path = require("path");
describe('Plugin', function() {
var startingDir = process.cwd();
var jbPresentDir = path.join(startingDir, 'test/jade-brunch/present');
var defAsset = "app/assets";
before(function(){ process.chdir(jbPresentDir); });
it('should be an object', function() {
var plugin = new Plugin({});
expect(plugin).to.be.ok;
});
it('should has #onCompile method', function() {
var plugin = new Plugin({});
expect(plugin.onCompile).to.be.an.instanceof(Function);
});
describe("The `isFileToCompile` method", function() {
it("should manage each .jade file by default", function() {
var plugin = new Plugin({});
expect(plugin.isFileToCompile("app/foo.jade")).to.be.ok;
});
it("should manage the file with the extension specified by config", function() {
var plugin = new Plugin({
plugins: {
static_jade: {
extension: ".static.jade"
}
}
});
expect(plugin.isFileToCompile("app/foo.jade")).to.not.be.ok;
expect(plugin.isFileToCompile("app/foo.static.jade")).to.be.ok;
});
it("should manage the file within the directories specified" +
" by the regexp in plugins.static_jade.path", function() {
var plugin = new Plugin({
plugins: {
static_jade: {
path: [/app(\/|\\)foo/, /app(\/|\\)bar/]
}
}
});
expect(plugin.isFileToCompile("app/index.jade" )).to.not.be.ok;
expect(plugin.isFileToCompile("app/foo.jade" )).to.not.be.ok;
expect(plugin.isFileToCompile("app/foo/foo.jade")).to.be.ok;
expect(plugin.isFileToCompile("app/bar/foo.jade")).to.be.ok;
});
});
describe("The `getHtmlFilePath` method", function() {
describe("create output in the `config.conventions.assets` directory", function(){
it("should get .html from .jade in the 'assets' dir by default", function() {
var plugin = new Plugin({});
expect(plugin.getHtmlFilePath("app/foo.jade",defAsset)).to.match_filesystem_path("app/assets/foo.html");
expect(plugin.getHtmlFilePath("app/foo.static.jade",defAsset)).to.not.match_filesystem_path("app/assets/foo.html");
});
it("should get .html from .jade in the configured assets directory", function() {
var asset = "app/fake_asset";
var plugin = new Plugin({
plugins: {
static_jade: {
asset: asset
}
}
});
expect(plugin.getHtmlFilePath("app/foo.jade", asset)).to.match_filesystem_path("app/fake_asset/foo.html");
expect(plugin.getHtmlFilePath("app/foo.static.jade", asset)).to.not.match_filesystem_path("app/assets/foo.html");
});
});
it("should get .html from .jade file by default", function() {
var plugin = new Plugin({});
expect(plugin.getHtmlFilePath("app/foo.jade",defAsset)).to.match_filesystem_path("app/assets/foo.html");
expect(plugin.getHtmlFilePath("app/foo.static.jade",defAsset)).to.not.match_filesystem_path("app/assets/foo.html");
});
it("should get .html based on the extension specified in config.coffee", function() {
var plugin = new Plugin({
plugins: {
static_jade: {
extension: ".static.jade"
}
}
});
expect(plugin.getHtmlFilePath("app/foo.jade",defAsset)).to.not.match_filesystem_path("app/assets/foo.html");
expect(plugin.getHtmlFilePath("app/foo.static.jade",defAsset)).to.match_filesystem_path("app/assets/foo.html");
});
});
describe("the configuration of the jade compiler", function(){
var jade = require('jade');
describe('must be backward compatible', function(){
it('must manage the options inside config.plugins.jade.options', function(){
var config = {
plugins: {
jade: {
options: { pretty: true }
}
}
}
, plugin = new Plugin(config);
expect(plugin.options.pretty).to.be.equal(
config.plugins.jade.options.pretty);
});
it('must manage the locals inside config.plugins.jade.locals', function(){
var config = {
plugins: {
jade: {
locals: { foo: 'bar' }
}
}
}
, plugin = new Plugin(config);
expect(plugin.locals.foo).to.be.equal(config.plugins.jade.locals.foo);
});
it('must manage the options inside config.plugins.jade too, as backward', function(){
var config = {
plugins: {
jade: {
pretty: true
}
}
}
, plugin = new Plugin(config);
expect(plugin.options.pretty).to.be.equal(config.plugins.jade.pretty);
});
});
describe("all the compilation options must work", function() {
var fs = require('fs')
, testdir = 'compilation_test'
;
function deleteFile(path,done) {
fs.exists(path, function(exists) {
if(exists)
fs.unlink(path, function(err) {
if(err) done(err);
});
});
}
function cleanTestDir(done) {
fs.readdir(testdir, function(err,files) {
if(err) done(err);
else {
files.forEach(function(file) {
deleteFile(path.join(testdir,file), done);
});
done();
}
});
}
before( function(done) {
fs.exists(testdir, function(exists) {
if(exists)
cleanTestDir(done);
else
fs.mkdir(testdir, done);
});
});
after( function(done) {
cleanTestDir(done);
});
it('should support .compile()', function(done){
var fname = 'compile.jade'
, fpath = path.join(testdir, fname)
, content = 'p foo\n.test\np bar'
, config = {}
, plugin = new Plugin(config);
fs.writeFile(fpath, content, function(err) {
if(err) done(err);
plugin.fromJade2Html(fpath,function(err, result) {
if(err) done(err);
else {
var fn = jade.compile(content);
expect(result).to.equal(fn());
done();
}
});
});
});
it('should support .compile() locals', function(done){
// var fn = jade.compile('p= foo');
// assert.equal('<p>bar</p>', fn({ foo: 'bar' }));
var fname = 'compile_locals.jade'
, fpath = path.join(testdir, fname)
, content = 'p= foo'
, config = {
plugins: {
jade: {
locals: { foo: 'bar' }
}
}
}
, plugin = new Plugin(config);
fs.writeFile(fpath, content, function(err) {
if(err) done(err);
else {
plugin.fromJade2Html(fpath,function(err, result) {
if(err) done(err);
else {
var fn = jade.compile(content);
expect(result).to.equal(fn(config.plugins.jade.locals));
done();
}
});
}
});
});
it('should support .compile() no debug', function(done){
// var fn = jade.compile('p foo\np #{bar}', {compileDebug: false});
// assert.equal('<p>foo</p><p>baz</p>', fn({bar: 'baz'}));
var fname = 'compile_no_debug.jade'
, fpath = path.join(testdir, fname)
, content = 'p foo\np #{bar}'
, config = {
plugins: {
jade: {
options: {compileDebug: false},
locals: { bar: 'baz' }
}
}
}
, plugin = new Plugin(config);
fs.writeFile(fpath, content, function(err) {
if(err) done(err);
else {
plugin.fromJade2Html(fpath,function(err, result) {
if(err) done(err);
else {
var fn = jade.compile(content, config.plugins.jade.options);
expect(result).to.equal(fn(config.plugins.jade.locals));
done();
}
});
}
});
});
it('should support .compile() no debug and global helpers', function(done){
// var fn = jade.compile('p foo\np #{bar}', {compileDebug: false, helpers: 'global'});
// assert.equal('<p>foo</p><p>baz</p>', fn({bar: 'baz'}));
var fname = 'compile_no_debug_global_helpers.jade'
, fpath = path.join(testdir, fname)
, content = 'p foo\np #{bar}'
, config = {
plugins: {
jade: {
options: {compileDebug: false, helpers: 'global'},
locals: { bar: 'baz' }
}
}
}
, plugin = new Plugin(config);
fs.writeFile(fpath, content, function(err) {
if(err) done(err);
else {
plugin.fromJade2Html(fpath,function(err, result) {
if(err) done(err);
else {
var fn = jade.compile(content, config.plugins.jade.options);
expect(result).to.equal(fn(config.plugins.jade.locals));
done();
}
});
}
});
});
});
});
it('do not outputs tokens and function body generated by default', function(){
});
}
);
|
module("serialize", { teardown: moduleTeardown });
test("chadQuery.param()", function() {
expect(22);
var params, settings;
equal( !( chadQuery.ajaxSettings && chadQuery.ajaxSettings.traditional ), true, "traditional flag, falsy by default" );
params = {"foo":"bar", "baz":42, "quux":"All your base are belong to us"};
equal( chadQuery.param(params), "foo=bar&baz=42&quux=All+your+base+are+belong+to+us", "simple" );
params = {"string":"foo","null":null,"undefined":undefined};
equal( chadQuery.param(params), "string=foo&null=&undefined=", "handle nulls and undefineds properly" );
params = {"someName": [1, 2, 3], "regularThing": "blah" };
equal( chadQuery.param(params), "someName%5B%5D=1&someName%5B%5D=2&someName%5B%5D=3®ularThing=blah", "with array" );
params = {"foo": ["a", "b", "c"]};
equal( chadQuery.param(params), "foo%5B%5D=a&foo%5B%5D=b&foo%5B%5D=c", "with array of strings" );
params = {"foo": ["baz", 42, "All your base are belong to us"] };
equal( chadQuery.param(params), "foo%5B%5D=baz&foo%5B%5D=42&foo%5B%5D=All+your+base+are+belong+to+us", "more array" );
params = {"foo": { "bar": "baz", "beep": 42, "quux": "All your base are belong to us" } };
equal( chadQuery.param(params), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" );
params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" };
equal( decodeURIComponent( chadQuery.param(params) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=&i[]=10&i[]=11&j=true&k=false&l[]=&l[]=0&m=cowboy+hat?", "huge structure" );
params = { "a": [ 0, [ 1, 2 ], [ 3, [ 4, 5 ], [ 6 ] ], { "b": [ 7, [ 8, 9 ], [ { "c": 10, "d": 11 } ], [ [ 12 ] ], [ [ [ 13 ] ] ], { "e": { "f": { "g": [ 14, [ 15 ] ] } } }, 16 ] }, 17 ] };
equal( decodeURIComponent( chadQuery.param(params) ), "a[]=0&a[1][]=1&a[1][]=2&a[2][]=3&a[2][1][]=4&a[2][1][]=5&a[2][2][]=6&a[3][b][]=7&a[3][b][1][]=8&a[3][b][1][]=9&a[3][b][2][0][c]=10&a[3][b][2][0][d]=11&a[3][b][3][0][]=12&a[3][b][4][0][0][]=13&a[3][b][5][e][f][g][]=14&a[3][b][5][e][f][g][1][]=15&a[3][b][]=16&a[]=17", "nested arrays" );
params = { "a":[1,2], "b":{ "c":3, "d":[4,5], "e":{ "x":[6], "y":7, "z":[8,9] }, "f":true, "g":false, "h":undefined }, "i":[10,11], "j":true, "k":false, "l":[undefined,0], "m":"cowboy hat?" };
equal( chadQuery.param(params,true), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=&l=0&m=cowboy+hat%3F", "huge structure, forced traditional" );
equal( decodeURIComponent( chadQuery.param({ "a": [1,2,3], "b[]": [4,5,6], "c[d]": [7,8,9], "e": { "f": [10], "g": [11,12], "h": 13 } }) ), "a[]=1&a[]=2&a[]=3&b[]=4&b[]=5&b[]=6&c[d][]=7&c[d][]=8&c[d][]=9&e[f][]=10&e[g][]=11&e[g][]=12&e[h]=13", "Make sure params are not double-encoded." );
// #7945
equal( chadQuery.param({"chadquery": "1.4.2"}), "chadquery=1.4.2", "Check that object with a chadQuery property get serialized correctly" );
settings = { traditional: true };
if ( chadQuery.ajaxSettings ) {
chadQuery.ajaxSetup( settings );
} else {
chadQuery.ajaxSettings = settings;
}
params = {"foo":"bar", "baz":42, "quux":"All your base are belong to us"};
equal( chadQuery.param(params), "foo=bar&baz=42&quux=All+your+base+are+belong+to+us", "simple" );
params = {"someName": [1, 2, 3], "regularThing": "blah" };
equal( chadQuery.param(params), "someName=1&someName=2&someName=3®ularThing=blah", "with array" );
params = {"foo": ["a", "b", "c"]};
equal( chadQuery.param(params), "foo=a&foo=b&foo=c", "with array of strings" );
params = {"foo[]":["baz", 42, "All your base are belong to us"]};
equal( chadQuery.param(params), "foo%5B%5D=baz&foo%5B%5D=42&foo%5B%5D=All+your+base+are+belong+to+us", "more array" );
params = {"foo[bar]":"baz", "foo[beep]":42, "foo[quux]":"All your base are belong to us"};
equal( chadQuery.param(params), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" );
params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" };
equal( chadQuery.param(params), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=&l=0&m=cowboy+hat%3F", "huge structure" );
params = { "a": [ 0, [ 1, 2 ], [ 3, [ 4, 5 ], [ 6 ] ], { "b": [ 7, [ 8, 9 ], [ { "c": 10, d: 11 } ], [ [ 12 ] ], [ [ [ 13 ] ] ], { "e": { "f": { "g": [ 14, [ 15 ] ] } } }, 16 ] }, 17 ] };
equal( chadQuery.param(params), "a=0&a=1%2C2&a=3%2C4%2C5%2C6&a=%5Bobject+Object%5D&a=17", "nested arrays (not possible when chadQuery.param.traditional == true)" );
params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" };
equal( decodeURIComponent( chadQuery.param(params,false) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=&i[]=10&i[]=11&j=true&k=false&l[]=&l[]=0&m=cowboy+hat?", "huge structure, forced not traditional" );
params = { "param1": null };
equal( chadQuery.param(params,false), "param1=", "Make sure that null params aren't traversed." );
params = {"test": {"length": 3, "foo": "bar"} };
equal( chadQuery.param( params, false ), "test%5Blength%5D=3&test%5Bfoo%5D=bar", "Sub-object with a length property" );
if ( chadQuery.ajaxSettings === settings ) {
delete chadQuery.ajaxSettings;
} else {
chadQuery.ajaxSetup({ traditional: false });
}
});
test("chadQuery.param() Constructed prop values", function() {
expect( 4 );
/** @constructor */
function Record() {
this["prop"] = "val";
}
var MyString = String,
MyNumber = Number,
params = { "test": new MyString("foo") };
equal( chadQuery.param( params, false ), "test=foo", "Do not mistake new String() for a plain object" );
params = { "test": new MyNumber(5) };
equal( chadQuery.param( params, false ), "test=5", "Do not mistake new Number() for a plain object" );
params = { "test": new Date() };
ok( chadQuery.param( params, false ), "(Non empty string returned) Do not mistake new Date() for a plain object" );
// should allow non-native constructed objects
params = { "test": new Record() };
equal( chadQuery.param( params, false ), chadQuery.param({ "test": { "prop": "val" } }), "Allow non-native constructed objects" );
});
test("serialize()", function() {
expect(5);
// Add html5 elements only for serialize because selector can't yet find them on non-html5 browsers
chadQuery("#search").after(
"<input type='email' id='html5email' name='email' value='dave@chadquery.com' />" +
"<input type='number' id='html5number' name='number' value='43' />" +
"<input type='file' name='fileupload' />"
);
equal( chadQuery("#form").serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40chadquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3",
"Check form serialization as query string");
equal( chadQuery("input,select,textarea,button", "#form").serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40chadquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3",
"Check input serialization as query string");
equal( chadQuery("#testForm").serialize(),
"T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Check form serialization as query string");
equal( chadQuery("input,select,textarea,button", "#testForm").serialize(),
"T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Check input serialization as query string");
equal( chadQuery("#form, #testForm").serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40chadquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Multiple form serialization as query string");
/* Temporarily disabled. Opera 10 has problems with form serialization.
equal( chadQuery("#form, #testForm :input").serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40chadquery.com&number=43&select1=&select2=3&select3=1&select3=2&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Mixed form/input serialization as query string");
*/
chadQuery("#html5email, #html5number").remove();
});
|
/**
* @license
* (c) 2015 Juan Diaz (jucardi)
* http://github.com/jucardi/slickgrid
*
* Based on
* Michael Leibman's SlickGrid v2.2
* http://github.com/mleibman/slickgrid
*
* Distributed under MIT license.
* All rights reserved.
*
* Jucardi.SlickGrid v1.0
*
* NOTES:
* Cell/row DOM manipulations are done directly bypassing jQuery's DOM manipulation methods.
* This increases the speed dramatically, but can only be done safely because there are no event handlers
* or data associated with any cell/row DOM nodes. Cell editors must make sure they implement .destroy()
* and do proper cleanup.
*/
// make sure required JavaScript modules are loaded
if (typeof jQuery === "undefined") {
throw "SlickGrid requires jquery module to be loaded";
}
if (!jQuery.fn.drag) {
throw "SlickGrid requires jquery.event.drag module to be loaded";
}
if (typeof Slick === "undefined") {
throw "slick.core.js not loaded";
}
(function ($) {
// Slick.Grid
$.extend(true, window, {
Slick: {
Grid: SlickGrid,
// **** Added by Jucardi ****
Constants: {
CUSTOM_ROW_HEIGHT_NAME: '__customHeight'
}
// **** End Added by Jucardi ****
}
});
// shared across all grids on the page
var scrollbarDimensions;
var maxSupportedCssHeight; // browser's breaking point
//////////////////////////////////////////////////////////////////////////////////////////////
// SlickGrid class implementation (available as Slick.Grid)
/**
* Creates a new instance of the grid.
* @class SlickGrid
* @constructor
* @param {Node} container Container node to create the grid in.
* @param {Array,Object} data An array of objects for databinding.
* @param {Array} columns An array of column definitions.
* @param {Object} options Grid options.
**/
function SlickGrid(container, data, columns, options) {
// settings
var defaults = {
explicitInitialization: false,
rowHeight: 25,
defaultColumnWidth: 80,
enableAddRow: false,
leaveSpaceForNewRows: false,
editable: false,
autoEdit: true,
enableCellNavigation: true,
enableColumnReorder: true,
asyncEditorLoading: false,
asyncEditorLoadDelay: 100,
forceFitColumns: false,
enableAsyncPostRender: false,
asyncPostRenderDelay: 50,
autoHeight: false,
editorLock: Slick.GlobalEditorLock,
showHeaderRow: false,
headerRowHeight: 25,
showTopPanel: false,
topPanelHeight: 25,
formatterFactory: null,
editorFactory: null,
cellFlashingCssClass: "flashing",
selectedCellCssClass: "selected",
multiSelect: true,
enableTextSelectionOnCells: false,
dataItemColumnValueExtractor: null,
fullWidthRows: false,
multiColumnSort: false,
defaultFormatter: defaultFormatter,
forceSyncScrolling: false,
addNewRowCssClass: "new-row",
useCustomRowHeight: false,
customHeightHandler: null
};
var columnDefaults = {
name: "",
resizable: true,
sortable: false,
minWidth: 30,
rerenderOnResize: false,
headerCssClass: null,
defaultSortAsc: true,
focusable: true,
selectable: true
};
// scroller
var th; // virtual height
var h; // real scrollable height
var ph; // page height
var n; // number of pages
var cj; // "jumpiness" coefficient
var page = 0; // current page
var offset = 0; // current page offset
var vScrollDir = 1;
// private
var initialized = false;
var $container;
var uid = "slickgrid_" + Math.round(1000000 * Math.random());
var self = this;
var $focusSink, $focusSink2;
var $headerScroller;
var $headers;
var $headerRow, $headerRowScroller, $headerRowSpacer;
var $topPanelScroller;
var $topPanel;
var $viewport;
var $canvas;
var $style;
var $boundAncestors;
var stylesheet, columnCssRulesL, columnCssRulesR;
var viewportH, viewportW;
var canvasWidth;
var viewportHasHScroll, viewportHasVScroll;
var headerColumnWidthDiff = 0, headerColumnHeightDiff = 0, // border+padding
cellWidthDiff = 0, cellHeightDiff = 0;
var absoluteColumnMinWidth;
var tabbingDirection = 1;
var activePosX;
var activeRow, activeCell;
var activeCellNode = null;
var currentEditor = null;
var serializedEditorValue;
var editController;
var rowsCache = {};
var renderedRows = 0;
var numVisibleRows;
var prevScrollTop = 0;
var scrollTop = 0;
var lastRenderedScrollTop = 0;
var lastRenderedScrollLeft = 0;
var prevScrollLeft = 0;
var scrollLeft = 0;
var selectionModel;
var selectedRows = [];
var plugins = [];
var cellCssClasses = {};
var columnsById = {};
var sortColumns = [];
var columnPosLeft = [];
var columnPosRight = [];
// async call handles
var h_editorLoader = null;
var h_render = null;
var h_postrender = null;
var postProcessedRows = {};
var postProcessToRow = null;
var postProcessFromRow = null;
// perf counters
var counter_rows_rendered = 0;
var counter_rows_removed = 0;
// These two variables work around a bug with inertial scrolling in Webkit/Blink on Mac.
// See http://crbug.com/312427.
var rowNodeFromLastMouseWheelEvent; // this node must not be deleted while inertial scrolling
var zombieRowNodeFromLastMouseWheelEvent; // node that was hidden instead of getting deleted
// Added by Jucardi
var rowOffsetCollection = {};
var rowCssClasses = {};
var rowIdXName;
//////////////////////////////////////////////////////////////////////////////////////////////
// Initialization
function init() {
$container = $(container);
if ($container.length < 1) {
throw new Error("SlickGrid requires a valid container, " + container + " does not exist in the DOM.");
}
// calculate these only once and share between grid instances
maxSupportedCssHeight = maxSupportedCssHeight || getMaxSupportedCssHeight();
scrollbarDimensions = scrollbarDimensions || measureScrollbar();
options = $.extend({}, defaults, options);
validateAndEnforceOptions();
columnDefaults.width = options.defaultColumnWidth;
columnsById = {};
for (var i = 0; i < columns.length; i++) {
var m = columns[i] = $.extend({}, columnDefaults, columns[i]);
columnsById[m.id] = i;
if (m.minWidth && m.width < m.minWidth) {
m.width = m.minWidth;
}
if (m.maxWidth && m.width > m.maxWidth) {
m.width = m.maxWidth;
}
}
// validate loaded JavaScript modules against requested options
if (options.enableColumnReorder && !$.fn.sortable) {
throw new Error("SlickGrid's 'enableColumnReorder = true' option requires jquery-ui.sortable module to be loaded");
}
editController = {
"commitCurrentEdit": commitCurrentEdit,
"cancelCurrentEdit": cancelCurrentEdit
};
$container
.empty()
.css("overflow", "hidden")
.css("outline", 0)
.addClass(uid)
.addClass("ui-widget");
// set up a positioning container if needed
if (!/relative|absolute|fixed/.test($container.css("position"))) {
$container.css("position", "relative");
}
$focusSink = $("<div tabIndex='0' hideFocus style='position:fixed;width:0;height:0;top:0;left:0;outline:0;'></div>").appendTo($container);
$headerScroller = $("<div class='slick-header ui-state-default' style='overflow:hidden;position:relative;' />").appendTo($container);
$headers = $("<div class='slick-header-columns' style='left:-1000px' />").appendTo($headerScroller);
$headers.width(getHeadersWidth());
$headerRowScroller = $("<div class='slick-headerrow ui-state-default' style='overflow:hidden;position:relative;' />").appendTo($container);
$headerRow = $("<div class='slick-headerrow-columns' />").appendTo($headerRowScroller);
$headerRowSpacer = $("<div style='display:block;height:1px;position:absolute;top:0;left:0;'></div>")
.css("width", getCanvasWidth() + scrollbarDimensions.width + "px")
.appendTo($headerRowScroller);
$topPanelScroller = $("<div class='slick-top-panel-scroller ui-state-default' style='overflow:hidden;position:relative;' />").appendTo($container);
$topPanel = $("<div class='slick-top-panel' style='width:10000px' />").appendTo($topPanelScroller);
if (!options.showTopPanel) {
$topPanelScroller.hide();
}
if (!options.showHeaderRow) {
$headerRowScroller.hide();
}
$viewport = $("<div class='slick-viewport' style='width:100%;overflow:auto;outline:0;position:relative;;'>").appendTo($container);
$viewport.css("overflow-y", options.autoHeight ? "hidden" : "auto");
$canvas = $("<div class='grid-canvas' />").appendTo($viewport);
$focusSink2 = $focusSink.clone().appendTo($container);
if (!options.explicitInitialization) {
finishInitialization();
}
}
function finishInitialization() {
if (!initialized) {
initialized = true;
viewportW = parseFloat($.css($container[0], "width", true));
// header columns and cells may have different padding/border skewing width calculations (box-sizing, hello?)
// calculate the diff so we can set consistent sizes
measureCellPaddingAndBorder();
// for usability reasons, all text selection in SlickGrid is disabled
// with the exception of input and textarea elements (selection must
// be enabled there so that editors work as expected); note that
// selection in grid cells (grid body) is already unavailable in
// all browsers except IE
disableSelection($headers); // disable all text selection in header (including input and textarea)
if (!options.enableTextSelectionOnCells) {
// disable text selection in grid cells except in input and textarea elements
// (this is IE-specific, because selectstart event will only fire in IE)
$viewport.bind("selectstart.ui", function (event) {
return $(event.target).is("input,textarea");
});
}
updateColumnCaches();
createColumnHeaders();
setupColumnSort();
createCssRules();
resizeCanvas();
bindAncestorScrollEvents();
$container
.bind("resize.slickgrid", resizeCanvas);
$viewport
//.bind("click", handleClick)
.bind("scroll", handleScroll);
$headerScroller
.bind("contextmenu", handleHeaderContextMenu)
.bind("click", handleHeaderClick)
.delegate(".slick-header-column", "mouseenter", handleHeaderMouseEnter)
.delegate(".slick-header-column", "mouseleave", handleHeaderMouseLeave);
$headerRowScroller
.bind("scroll", handleHeaderRowScroll);
$focusSink.add($focusSink2)
.bind("keydown", handleKeyDown);
$canvas
.bind("keydown", handleKeyDown)
.bind("click", handleClick)
.bind("dblclick", handleDblClick)
.bind("contextmenu", handleContextMenu)
.bind("draginit", handleDragInit)
.bind("dragstart", {distance: 3}, handleDragStart)
.bind("drag", handleDrag)
.bind("dragend", handleDragEnd)
.delegate(".slick-cell", "mouseenter", handleMouseEnter)
.delegate(".slick-cell", "mouseleave", handleMouseLeave);
// Work around http://crbug.com/312427.
if (navigator.userAgent.toLowerCase().match(/webkit/) &&
navigator.userAgent.toLowerCase().match(/macintosh/)) {
$canvas.bind("mousewheel", handleMouseWheel);
}
}
}
function registerPlugin(plugin) {
plugins.unshift(plugin);
plugin.init(self);
}
function unregisterPlugin(plugin) {
for (var i = plugins.length; i >= 0; i--) {
if (plugins[i] === plugin) {
if (plugins[i].destroy) {
plugins[i].destroy();
}
plugins.splice(i, 1);
break;
}
}
}
function setSelectionModel(model) {
if (selectionModel) {
selectionModel.onSelectedRangesChanged.unsubscribe(handleSelectedRangesChanged);
if (selectionModel.destroy) {
selectionModel.destroy();
}
}
selectionModel = model;
if (selectionModel) {
selectionModel.init(self);
selectionModel.onSelectedRangesChanged.subscribe(handleSelectedRangesChanged);
}
}
function getSelectionModel() {
return selectionModel;
}
function getCanvasNode() {
return $canvas[0];
}
function measureScrollbar() {
var $c = $("<div style='position:absolute; top:-10000px; left:-10000px; width:100px; height:100px; overflow:scroll;'></div>").appendTo("body");
var dim = {
width: $c.width() - $c[0].clientWidth,
height: $c.height() - $c[0].clientHeight
};
$c.remove();
return dim;
}
function getHeadersWidth() {
var headersWidth = 0;
for (var i = 0, ii = columns.length; i < ii; i++) {
var width = columns[i].width;
headersWidth += width;
}
headersWidth += scrollbarDimensions.width;
return Math.max(headersWidth, viewportW) + 1000;
}
function getCanvasWidth() {
var availableWidth = viewportHasVScroll ? viewportW - scrollbarDimensions.width : viewportW;
var rowWidth = 0;
var i = columns.length;
while (i--) {
rowWidth += columns[i].width;
}
return options.fullWidthRows ? Math.max(rowWidth, availableWidth) : rowWidth;
}
function updateCanvasWidth(forceColumnWidthsUpdate) {
var oldCanvasWidth = canvasWidth;
canvasWidth = getCanvasWidth();
if (canvasWidth != oldCanvasWidth) {
$canvas.width(canvasWidth);
$headerRow.width(canvasWidth);
$headers.width(getHeadersWidth());
viewportHasHScroll = (canvasWidth > viewportW - scrollbarDimensions.width);
}
$headerRowSpacer.width(canvasWidth + (viewportHasVScroll ? scrollbarDimensions.width : 0));
if (canvasWidth != oldCanvasWidth || forceColumnWidthsUpdate) {
applyColumnWidths();
}
}
function disableSelection($target) {
if ($target && $target.jquery) {
$target
.attr("unselectable", "on")
.css("MozUserSelect", "none")
.bind("selectstart.ui", function () {
return false;
}); // from jquery:ui.core.js 1.7.2
}
}
function getMaxSupportedCssHeight() {
var supportedHeight = 1000000;
// FF reports the height back but still renders blank after ~6M px
var testUpTo = navigator.userAgent.toLowerCase().match(/firefox/) ? 6000000 : 1000000000;
var div = $("<div style='display:none' />").appendTo(document.body);
while (true) {
var test = supportedHeight * 2;
div.css("height", test);
if (test > testUpTo || div.height() !== test) {
break;
} else {
supportedHeight = test;
}
}
div.remove();
return supportedHeight;
}
// TODO: this is static. need to handle page mutation.
function bindAncestorScrollEvents() {
var elem = $canvas[0];
while ((elem = elem.parentNode) != document.body && elem != null) {
// bind to scroll containers only
if (elem == $viewport[0] || elem.scrollWidth != elem.clientWidth || elem.scrollHeight != elem.clientHeight) {
var $elem = $(elem);
if (!$boundAncestors) {
$boundAncestors = $elem;
} else {
$boundAncestors = $boundAncestors.add($elem);
}
$elem.bind("scroll." + uid, handleActiveCellPositionChange);
}
}
}
function unbindAncestorScrollEvents() {
if (!$boundAncestors) {
return;
}
$boundAncestors.unbind("scroll." + uid);
$boundAncestors = null;
}
function updateColumnHeader(columnId, title, toolTip) {
if (!initialized) { return; }
var idx = getColumnIndex(columnId);
if (idx == null) {
return;
}
var columnDef = columns[idx];
var $header = $headers.children().eq(idx);
if ($header) {
if (title !== undefined) {
columns[idx].name = title;
}
if (toolTip !== undefined) {
columns[idx].toolTip = toolTip;
}
trigger(self.onBeforeHeaderCellDestroy, {
"node": $header[0],
"column": columnDef
});
$header
.attr("title", toolTip || "")
.children().eq(0).html(title);
trigger(self.onHeaderCellRendered, {
"node": $header[0],
"column": columnDef
});
}
}
function getHeaderRow() {
return $headerRow[0];
}
function getHeaderRowColumn(columnId) {
var idx = getColumnIndex(columnId);
var $header = $headerRow.children().eq(idx);
return $header && $header[0];
}
function createColumnHeaders() {
function onMouseEnter() {
$(this).addClass("ui-state-hover");
}
function onMouseLeave() {
$(this).removeClass("ui-state-hover");
}
$headers.find(".slick-header-column")
.each(function() {
var columnDef = $(this).data("column");
if (columnDef) {
trigger(self.onBeforeHeaderCellDestroy, {
"node": this,
"column": columnDef
});
}
});
$headers.empty();
$headers.width(getHeadersWidth());
$headerRow.find(".slick-headerrow-column")
.each(function() {
var columnDef = $(this).data("column");
if (columnDef) {
trigger(self.onBeforeHeaderRowCellDestroy, {
"node": this,
"column": columnDef
});
}
});
$headerRow.empty();
for (var i = 0; i < columns.length; i++) {
var m = columns[i];
var header = $("<div class='ui-state-default slick-header-column' />")
.html("<span class='slick-column-name'>" + m.name + "</span>")
.width(m.width - headerColumnWidthDiff)
.attr("id", "" + uid + m.id)
.attr("title", m.toolTip || "")
.data("column", m)
.addClass(m.headerCssClass || "")
.appendTo($headers);
if (options.enableColumnReorder || m.sortable) {
header
.on('mouseenter', onMouseEnter)
.on('mouseleave', onMouseLeave);
}
if (m.sortable) {
header.addClass("slick-header-sortable");
header.append("<span class='slick-sort-indicator' />");
}
trigger(self.onHeaderCellRendered, {
"node": header[0],
"column": m
});
if (options.showHeaderRow) {
var headerRowCell = $("<div class='ui-state-default slick-headerrow-column l" + i + " r" + i + "'></div>")
.data("column", m)
.appendTo($headerRow);
trigger(self.onHeaderRowCellRendered, {
"node": headerRowCell[0],
"column": m
});
}
}
setSortColumns(sortColumns);
setupColumnResize();
if (options.enableColumnReorder) {
setupColumnReorder();
}
}
function setupColumnSort() {
$headers.click(function (e) {
// temporary workaround for a bug in jQuery 1.7.1 (http://bugs.jquery.com/ticket/11328)
e.metaKey = e.metaKey || e.ctrlKey;
if ($(e.target).hasClass("slick-resizable-handle")) {
return;
}
var $col = $(e.target).closest(".slick-header-column");
if (!$col.length) {
return;
}
var column = $col.data("column");
if (column.sortable) {
if (!getEditorLock().commitCurrentEdit()) {
return;
}
var sortOpts = null;
var i = 0;
for (; i < sortColumns.length; i++) {
if (sortColumns[i].columnId == column.id) {
sortOpts = sortColumns[i];
sortOpts.sortAsc = !sortOpts.sortAsc;
break;
}
}
if (e.metaKey && options.multiColumnSort) {
if (sortOpts) {
sortColumns.splice(i, 1);
}
}
else {
if ((!e.shiftKey && !e.metaKey) || !options.multiColumnSort) {
sortColumns = [];
}
if (!sortOpts) {
sortOpts = { columnId: column.id, sortAsc: column.defaultSortAsc };
sortColumns.push(sortOpts);
} else if (sortColumns.length == 0) {
sortColumns.push(sortOpts);
}
}
setSortColumns(sortColumns);
if (!options.multiColumnSort) {
trigger(self.onSort, {
multiColumnSort: false,
sortCol: column,
sortAsc: sortOpts.sortAsc}, e);
} else {
trigger(self.onSort, {
multiColumnSort: true,
sortCols: $.map(sortColumns, function(col) {
return {sortCol: columns[getColumnIndex(col.columnId)], sortAsc: col.sortAsc };
})}, e);
}
}
});
}
function setupColumnReorder() {
$headers.filter(":ui-sortable").sortable("destroy");
$headers.sortable({
containment: "parent",
distance: 3,
axis: "x",
cursor: "default",
tolerance: "intersection",
helper: "clone",
placeholder: "slick-sortable-placeholder ui-state-default slick-header-column",
start: function (e, ui) {
ui.placeholder.width(ui.helper.outerWidth() - headerColumnWidthDiff);
$(ui.helper).addClass("slick-header-column-active");
},
beforeStop: function (e, ui) {
$(ui.helper).removeClass("slick-header-column-active");
},
stop: function (e) {
if (!getEditorLock().commitCurrentEdit()) {
$(this).sortable("cancel");
return;
}
var reorderedIds = $headers.sortable("toArray");
var reorderedColumns = [];
for (var i = 0; i < reorderedIds.length; i++) {
reorderedColumns.push(columns[getColumnIndex(reorderedIds[i].replace(uid, ""))]);
}
setColumns(reorderedColumns);
trigger(self.onColumnsReordered, {});
e.stopPropagation();
setupColumnResize();
}
});
}
function setupColumnResize() {
var $col, j, c, pageX, columnElements, minPageX, maxPageX, firstResizable, lastResizable;
columnElements = $headers.children();
columnElements.find(".slick-resizable-handle").remove();
columnElements.each(function (i, e) {
if (columns[i].resizable) {
if (firstResizable === undefined) {
firstResizable = i;
}
lastResizable = i;
}
});
if (firstResizable === undefined) {
return;
}
columnElements.each(function (i, e) {
if (i < firstResizable || (options.forceFitColumns && i >= lastResizable)) {
return;
}
$col = $(e);
$("<div class='slick-resizable-handle' />")
.appendTo(e)
.bind("dragstart", function (e, dd) {
if (!getEditorLock().commitCurrentEdit()) {
return false;
}
pageX = e.pageX;
$(this).parent().addClass("slick-header-column-active");
var shrinkLeewayOnRight = null, stretchLeewayOnRight = null;
// lock each column's width option to current width
columnElements.each(function (i, e) {
columns[i].previousWidth = $(e).outerWidth();
});
if (options.forceFitColumns) {
shrinkLeewayOnRight = 0;
stretchLeewayOnRight = 0;
// colums on right affect maxPageX/minPageX
for (j = i + 1; j < columnElements.length; j++) {
c = columns[j];
if (c.resizable) {
if (stretchLeewayOnRight !== null) {
if (c.maxWidth) {
stretchLeewayOnRight += c.maxWidth - c.previousWidth;
} else {
stretchLeewayOnRight = null;
}
}
shrinkLeewayOnRight += c.previousWidth - Math.max(c.minWidth || 0, absoluteColumnMinWidth);
}
}
}
var shrinkLeewayOnLeft = 0, stretchLeewayOnLeft = 0;
for (j = 0; j <= i; j++) {
// columns on left only affect minPageX
c = columns[j];
if (c.resizable) {
if (stretchLeewayOnLeft !== null) {
if (c.maxWidth) {
stretchLeewayOnLeft += c.maxWidth - c.previousWidth;
} else {
stretchLeewayOnLeft = null;
}
}
shrinkLeewayOnLeft += c.previousWidth - Math.max(c.minWidth || 0, absoluteColumnMinWidth);
}
}
if (shrinkLeewayOnRight === null) {
shrinkLeewayOnRight = 100000;
}
if (shrinkLeewayOnLeft === null) {
shrinkLeewayOnLeft = 100000;
}
if (stretchLeewayOnRight === null) {
stretchLeewayOnRight = 100000;
}
if (stretchLeewayOnLeft === null) {
stretchLeewayOnLeft = 100000;
}
maxPageX = pageX + Math.min(shrinkLeewayOnRight, stretchLeewayOnLeft);
minPageX = pageX - Math.min(shrinkLeewayOnLeft, stretchLeewayOnRight);
})
.bind("drag", function (e, dd) {
var actualMinWidth, d = Math.min(maxPageX, Math.max(minPageX, e.pageX)) - pageX, x;
if (d < 0) { // shrink column
x = d;
for (j = i; j >= 0; j--) {
c = columns[j];
if (c.resizable) {
actualMinWidth = Math.max(c.minWidth || 0, absoluteColumnMinWidth);
if (x && c.previousWidth + x < actualMinWidth) {
x += c.previousWidth - actualMinWidth;
c.width = actualMinWidth;
} else {
c.width = c.previousWidth + x;
x = 0;
}
}
}
if (options.forceFitColumns) {
x = -d;
for (j = i + 1; j < columnElements.length; j++) {
c = columns[j];
if (c.resizable) {
if (x && c.maxWidth && (c.maxWidth - c.previousWidth < x)) {
x -= c.maxWidth - c.previousWidth;
c.width = c.maxWidth;
} else {
c.width = c.previousWidth + x;
x = 0;
}
}
}
}
} else { // stretch column
x = d;
for (j = i; j >= 0; j--) {
c = columns[j];
if (c.resizable) {
if (x && c.maxWidth && (c.maxWidth - c.previousWidth < x)) {
x -= c.maxWidth - c.previousWidth;
c.width = c.maxWidth;
} else {
c.width = c.previousWidth + x;
x = 0;
}
}
}
if (options.forceFitColumns) {
x = -d;
for (j = i + 1; j < columnElements.length; j++) {
c = columns[j];
if (c.resizable) {
actualMinWidth = Math.max(c.minWidth || 0, absoluteColumnMinWidth);
if (x && c.previousWidth + x < actualMinWidth) {
x += c.previousWidth - actualMinWidth;
c.width = actualMinWidth;
} else {
c.width = c.previousWidth + x;
x = 0;
}
}
}
}
}
applyColumnHeaderWidths();
if (options.syncColumnCellResize) {
applyColumnWidths();
}
})
.bind("dragend", function (e, dd) {
var newWidth;
$(this).parent().removeClass("slick-header-column-active");
for (j = 0; j < columnElements.length; j++) {
c = columns[j];
newWidth = $(columnElements[j]).outerWidth();
if (c.previousWidth !== newWidth && c.rerenderOnResize) {
invalidateAllRows();
}
}
updateCanvasWidth(true);
render();
trigger(self.onColumnsResized, {});
});
});
}
function getVBoxDelta($el) {
var p = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"];
var delta = 0;
$.each(p, function (n, val) {
delta += parseFloat($el.css(val)) || 0;
});
return delta;
}
function measureCellPaddingAndBorder() {
var el;
var h = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"];
var v = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"];
el = $("<div class='ui-state-default slick-header-column' style='visibility:hidden'>-</div>").appendTo($headers);
headerColumnWidthDiff = headerColumnHeightDiff = 0;
if (el.css("box-sizing") != "border-box" && el.css("-moz-box-sizing") != "border-box" && el.css("-webkit-box-sizing") != "border-box") {
$.each(h, function (n, val) {
headerColumnWidthDiff += parseFloat(el.css(val)) || 0;
});
$.each(v, function (n, val) {
headerColumnHeightDiff += parseFloat(el.css(val)) || 0;
});
}
el.remove();
var r = $("<div class='slick-row' />").appendTo($canvas);
el = $("<div class='slick-cell' id='' style='visibility:hidden'>-</div>").appendTo(r);
cellWidthDiff = cellHeightDiff = 0;
if (el.css("box-sizing") != "border-box" && el.css("-moz-box-sizing") != "border-box" && el.css("-webkit-box-sizing") != "border-box") {
$.each(h, function (n, val) {
cellWidthDiff += parseFloat(el.css(val)) || 0;
});
$.each(v, function (n, val) {
cellHeightDiff += parseFloat(el.css(val)) || 0;
});
}
r.remove();
absoluteColumnMinWidth = Math.max(headerColumnWidthDiff, cellWidthDiff);
}
function createCssRules() {
$style = $("<style type='text/css' rel='stylesheet' />").appendTo($("head"));
var rowHeight = (options.rowHeight - cellHeightDiff);
var rules = [
"." + uid + " .slick-header-column { left: 1000px; }",
"." + uid + " .slick-top-panel { height:" + options.topPanelHeight + "px; }",
"." + uid + " .slick-headerrow-columns { height:" + options.headerRowHeight + "px; }",
"." + uid + " .slick-cell { height:" + rowHeight + "px; }",
"." + uid + " .slick-row { height:" + options.rowHeight + "px; }"
];
for (var i = 0; i < columns.length; i++) {
rules.push("." + uid + " .l" + i + " { }");
rules.push("." + uid + " .r" + i + " { }");
}
if ($style[0].styleSheet) { // IE
$style[0].styleSheet.cssText = rules.join(" ");
} else {
$style[0].appendChild(document.createTextNode(rules.join(" ")));
}
}
function getColumnCssRules(idx) {
if (!stylesheet) {
var sheets = document.styleSheets;
for (var i = 0; i < sheets.length; i++) {
if ((sheets[i].ownerNode || sheets[i].owningElement) == $style[0]) {
stylesheet = sheets[i];
break;
}
}
if (!stylesheet) {
throw new Error("Cannot find stylesheet.");
}
// find and cache column CSS rules
columnCssRulesL = [];
columnCssRulesR = [];
var cssRules = (stylesheet.cssRules || stylesheet.rules);
var matches, columnIdx;
for (var i = 0; i < cssRules.length; i++) {
var selector = cssRules[i].selectorText;
if (matches = /\.l\d+/.exec(selector)) {
columnIdx = parseInt(matches[0].substr(2, matches[0].length - 2), 10);
columnCssRulesL[columnIdx] = cssRules[i];
} else if (matches = /\.r\d+/.exec(selector)) {
columnIdx = parseInt(matches[0].substr(2, matches[0].length - 2), 10);
columnCssRulesR[columnIdx] = cssRules[i];
}
}
}
return {
"left": columnCssRulesL[idx],
"right": columnCssRulesR[idx]
};
}
function removeCssRules() {
$style.remove();
stylesheet = null;
}
function destroy() {
getEditorLock().cancelCurrentEdit();
trigger(self.onBeforeDestroy, {});
var i = plugins.length;
while(i--) {
unregisterPlugin(plugins[i]);
}
if (options.enableColumnReorder) {
$headers.filter(":ui-sortable").sortable("destroy");
}
unbindAncestorScrollEvents();
$container.unbind(".slickgrid");
removeCssRules();
$canvas.unbind("draginit dragstart dragend drag");
$container.empty().removeClass(uid);
}
//////////////////////////////////////////////////////////////////////////////////////////////
// General
function trigger(evt, args, e) {
e = e || new Slick.EventData();
args = args || {};
args.grid = self;
return evt.notify(args, e, self);
}
function getEditorLock() {
return options.editorLock;
}
function getEditController() {
return editController;
}
function getColumnIndex(id) {
return columnsById[id];
}
function autosizeColumns() {
var i, c,
widths = [],
shrinkLeeway = 0,
total = 0,
prevTotal,
availWidth = viewportHasVScroll ? viewportW - scrollbarDimensions.width : viewportW;
for (i = 0; i < columns.length; i++) {
c = columns[i];
widths.push(c.width);
total += c.width;
if (c.resizable) {
shrinkLeeway += c.width - Math.max(c.minWidth, absoluteColumnMinWidth);
}
}
// shrink
prevTotal = total;
while (total > availWidth && shrinkLeeway) {
var shrinkProportion = (total - availWidth) / shrinkLeeway;
for (i = 0; i < columns.length && total > availWidth; i++) {
c = columns[i];
var width = widths[i];
if (!c.resizable || width <= c.minWidth || width <= absoluteColumnMinWidth) {
continue;
}
var absMinWidth = Math.max(c.minWidth, absoluteColumnMinWidth);
var shrinkSize = Math.floor(shrinkProportion * (width - absMinWidth)) || 1;
shrinkSize = Math.min(shrinkSize, width - absMinWidth);
total -= shrinkSize;
shrinkLeeway -= shrinkSize;
widths[i] -= shrinkSize;
}
if (prevTotal <= total) { // avoid infinite loop
break;
}
prevTotal = total;
}
// grow
prevTotal = total;
while (total < availWidth) {
var growProportion = availWidth / total;
for (i = 0; i < columns.length && total < availWidth; i++) {
c = columns[i];
var currentWidth = widths[i];
var growSize;
if (!c.resizable || c.maxWidth <= currentWidth) {
growSize = 0;
} else {
growSize = Math.min(Math.floor(growProportion * currentWidth) - currentWidth, (c.maxWidth - currentWidth) || 1000000) || 1;
}
total += growSize;
widths[i] += growSize;
}
if (prevTotal >= total) { // avoid infinite loop
break;
}
prevTotal = total;
}
var reRender = false;
for (i = 0; i < columns.length; i++) {
if (columns[i].rerenderOnResize && columns[i].width != widths[i]) {
reRender = true;
}
columns[i].width = widths[i];
}
applyColumnHeaderWidths();
updateCanvasWidth(true);
if (reRender) {
invalidateAllRows();
render();
}
}
function applyColumnHeaderWidths() {
if (!initialized) { return; }
var h;
for (var i = 0, headers = $headers.children(), ii = headers.length; i < ii; i++) {
h = $(headers[i]);
if (h.width() !== columns[i].width - headerColumnWidthDiff) {
h.width(columns[i].width - headerColumnWidthDiff);
}
}
updateColumnCaches();
}
function applyColumnWidths() {
var x = 0, w, rule;
for (var i = 0; i < columns.length; i++) {
w = columns[i].width;
rule = getColumnCssRules(i);
rule.left.style.left = x + "px";
rule.right.style.right = (canvasWidth - x - w) + "px";
x += columns[i].width;
}
}
function setSortColumn(columnId, ascending) {
setSortColumns([{ columnId: columnId, sortAsc: ascending}]);
}
function setSortColumns(cols) {
sortColumns = cols;
var headerColumnEls = $headers.children();
headerColumnEls
.removeClass("slick-header-column-sorted")
.find(".slick-sort-indicator")
.removeClass("slick-sort-indicator-asc slick-sort-indicator-desc");
$.each(sortColumns, function(i, col) {
if (col.sortAsc == null) {
col.sortAsc = true;
}
var columnIndex = getColumnIndex(col.columnId);
if (columnIndex != null) {
headerColumnEls.eq(columnIndex)
.addClass("slick-header-column-sorted")
.find(".slick-sort-indicator")
.addClass(col.sortAsc ? "slick-sort-indicator-asc" : "slick-sort-indicator-desc");
}
});
}
function getSortColumns() {
return sortColumns;
}
function handleSelectedRangesChanged(e, ranges) {
selectedRows = [];
var hash = {};
for (var i = 0; i < ranges.length; i++) {
for (var j = ranges[i].fromRow; j <= ranges[i].toRow; j++) {
if (!hash[j]) { // prevent duplicates
selectedRows.push(j);
hash[j] = {};
}
for (var k = ranges[i].fromCell; k <= ranges[i].toCell; k++) {
if (canCellBeSelected(j, k)) {
hash[j][columns[k].id] = options.selectedCellCssClass;
}
}
}
}
setCellCssStyles(options.selectedCellCssClass, hash);
trigger(self.onSelectedRowsChanged, {rows: getSelectedRows()}, e);
}
function getColumns() {
return columns;
}
function updateColumnCaches() {
// Pre-calculate cell boundaries.
columnPosLeft = [];
columnPosRight = [];
var x = 0;
for (var i = 0, ii = columns.length; i < ii; i++) {
columnPosLeft[i] = x;
columnPosRight[i] = x + columns[i].width;
x += columns[i].width;
}
}
function setColumns(columnDefinitions) {
columns = columnDefinitions;
columnsById = {};
for (var i = 0; i < columns.length; i++) {
var m = columns[i] = $.extend({}, columnDefaults, columns[i]);
columnsById[m.id] = i;
if (m.minWidth && m.width < m.minWidth) {
m.width = m.minWidth;
}
if (m.maxWidth && m.width > m.maxWidth) {
m.width = m.maxWidth;
}
}
updateColumnCaches();
if (initialized) {
invalidateAllRows();
createColumnHeaders();
removeCssRules();
createCssRules();
resizeCanvas();
applyColumnWidths();
handleScroll();
}
}
function getOptions() {
return options;
}
function setOptions(args) {
if (!getEditorLock().commitCurrentEdit()) {
return;
}
makeActiveCellNormal();
if (options.enableAddRow !== args.enableAddRow) {
invalidateRow(getDataLength());
}
options = $.extend(options, args);
validateAndEnforceOptions();
$viewport.css("overflow-y", options.autoHeight ? "hidden" : "auto");
render();
}
function validateAndEnforceOptions() {
if (options.autoHeight) {
options.leaveSpaceForNewRows = false;
}
}
function setData(newData, scrollToTop) {
data = newData;
invalidateAllRows();
updateRowCount();
if (scrollToTop) {
scrollTo(0);
}
}
function getData() {
return data;
}
function getDataLength() {
if (data.getLength) {
return data.getLength();
} else {
return data.length;
}
}
function getDataLengthIncludingAddNew() {
return getDataLength() + (options.enableAddRow ? 1 : 0);
}
function getDataItem(i) {
if (data.getItem) {
return data.getItem(i);
} else {
return data[i];
}
}
function getTopPanel() {
return $topPanel[0];
}
function setTopPanelVisibility(visible) {
if (options.showTopPanel != visible) {
options.showTopPanel = visible;
if (visible) {
$topPanelScroller.slideDown("fast", resizeCanvas);
} else {
$topPanelScroller.slideUp("fast", resizeCanvas);
}
}
}
function setHeaderRowVisibility(visible) {
if (options.showHeaderRow != visible) {
options.showHeaderRow = visible;
if (visible) {
$headerRowScroller.slideDown("fast", resizeCanvas);
} else {
$headerRowScroller.slideUp("fast", resizeCanvas);
}
}
}
function getContainerNode() {
return $container.get(0);
}
//////////////////////////////////////////////////////////////////////////////////////////////
// Rendering / Scrolling
// **** Modified by Jucardi ****
function getRowTop(row) {
return options.rowHeight * row - offset;
}
function getRowFromPosition(y) {
return Math.floor((y + offset - getRowOffsetTop(y)) / options.rowHeight);
}
function updateThValue() {
var dataLengthIncludingAddNew = getDataLengthIncludingAddNew();
var numberOfRows = dataLengthIncludingAddNew + (options.leaveSpaceForNewRows ? numVisibleRows - 1 : 0);
th = Math.max((options.rowHeight * numberOfRows) + getRowOffsetTop(numberOfRows), viewportH - scrollbarDimensions.height);
}
// **** End Modified by Jucardi ****
function scrollTo(y) {
y = Math.max(y, 0);
y = Math.min(y, th - viewportH + (viewportHasHScroll ? scrollbarDimensions.height : 0));
var oldOffset = offset;
page = Math.min(n - 1, Math.floor(y / ph));
offset = Math.round(page * cj);
var newScrollTop = y - offset;
if (offset != oldOffset) {
var range = getVisibleRange(newScrollTop);
cleanupRows(range);
updateRowPositions();
}
if (prevScrollTop != newScrollTop) {
vScrollDir = (prevScrollTop + oldOffset < newScrollTop + offset) ? 1 : -1;
$viewport[0].scrollTop = (lastRenderedScrollTop = scrollTop = prevScrollTop = newScrollTop);
trigger(self.onViewportChanged, {});
}
}
function defaultFormatter(row, cell, value, columnDef, dataContext) {
if (value == null) {
return "";
} else {
return (value + "").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
}
}
function getFormatter(row, column) {
var rowMetadata = data.getItemMetadata && data.getItemMetadata(row);
// look up by id, then index
var columnOverrides = rowMetadata &&
rowMetadata.columns &&
(rowMetadata.columns[column.id] || rowMetadata.columns[getColumnIndex(column.id)]);
return (columnOverrides && columnOverrides.formatter) ||
(rowMetadata && rowMetadata.formatter) ||
column.formatter ||
(options.formatterFactory && options.formatterFactory.getFormatter(column)) ||
options.defaultFormatter;
}
function getEditor(row, cell) {
var column = columns[cell];
var rowMetadata = data.getItemMetadata && data.getItemMetadata(row);
var columnMetadata = rowMetadata && rowMetadata.columns;
if (columnMetadata && columnMetadata[column.id] && columnMetadata[column.id].editor !== undefined) {
return columnMetadata[column.id].editor;
}
if (columnMetadata && columnMetadata[cell] && columnMetadata[cell].editor !== undefined) {
return columnMetadata[cell].editor;
}
return column.editor || (options.editorFactory && options.editorFactory.getEditor(column));
}
function getDataItemValueForColumn(item, columnDef) {
if (options.dataItemColumnValueExtractor) {
return options.dataItemColumnValueExtractor(item, columnDef);
}
if (columnDef.dataGet)
return columnDef.dataGet(item);
return item[columnDef.field];
}
// **** Added by Jucardi ****
function getRowOffsetTop(row) {
if (!options.useCustomRowHeight) return 0;
var ret = 0;
for (var key in rowOffsetCollection){
if (key >= row) break;
ret+=rowOffsetCollection[key];
}
return ret;
}
function getCustomRowHeight(item) {
var customHeight = item[Slick.Constants.CUSTOM_ROW_HEIGHT_NAME];
if (customHeight) {
if (typeof customHeight == 'number') return customHeight;
if (typeof customHeight == 'function') return customHeight();
}
var handler = options.customHeightHandler;
if (handler && typeof handler == 'function') return handler(item);
return undefined;
}
// **** End Added by Jucardi ****
function getRowCss(id) {
if (rowCssClasses[id] == null || rowCssClasses[id].length == 0) return "";
var ret = "";
for (var i = 0; i < rowCssClasses[id].length; i++) {
ret = ret + " " + rowCssClasses[id][i];
}
return ret;
}
function appendRowHtml(stringArray, row, range, dataLength) {
if (rowIdXName == null) rowIdXName = "Id";
var d = getDataItem(row);
var dataLoading = row < dataLength && !d;
var id = rowIdXName != null && rowIdXName != "" ? d[rowIdXName] : row;
var rowCss = "slick-row" +
getRowCss(id) +
(dataLoading ? " loading" : "") +
(row === activeRow ? " active" : "") +
(row % 2 == 1 ? " odd" : " even");
if (!d) {
rowCss += " " + options.addNewRowCssClass;
}
var metadata = data.getItemMetadata && data.getItemMetadata(row);
if (metadata && metadata.cssClasses) {
rowCss += " " + metadata.cssClasses;
}
// Modified by Jucardi. Adds the offset for columns with different height than default.
if (options.useCustomRowHeight){
var customHeight = getCustomRowHeight(d);
var applyCustomHeight = (customHeight && customHeight >= 0 && customHeight != options.rowHeight);
var height = applyCustomHeight ? "height: " + customHeight + "px;'" : "'";
var newTop = getRowTop(row) + getRowOffsetTop(row);
if (applyCustomHeight) rowOffsetCollection[row] = customHeight - options.rowHeight;
stringArray.push("<div class='ui-widget-content " + rowCss + "' style='top:" + newTop + "px;" + height + ">");
}
else {
stringArray.push("<div class='ui-widget-content " + rowCss + "' style='top:" + getRowTop(row) + "px'>");
}
// End Modified by Jucardi.
var colspan, m;
for (var i = 0, ii = columns.length; i < ii; i++) {
m = columns[i];
colspan = 1;
if (metadata && metadata.columns) {
var columnData = metadata.columns[m.id] || metadata.columns[i];
colspan = (columnData && columnData.colspan) || 1;
if (colspan === "*") {
colspan = ii - i;
}
}
// Do not render cells outside of the viewport.
if (columnPosRight[Math.min(ii - 1, i + colspan - 1)] > range.leftPx) {
if (columnPosLeft[i] > range.rightPx) {
// All columns to the right are outside the range.
break;
}
appendCellHtml(stringArray, row, i, colspan, d);
}
if (colspan > 1) {
i += (colspan - 1);
}
}
stringArray.push("</div>");
}
function appendCellHtml(stringArray, row, cell, colspan, item) {
var m = columns[cell];
var cellCss = "slick-cell l" + cell + " r" + Math.min(columns.length - 1, cell + colspan - 1) +
(m.cssClass ? " " + m.cssClass : "");
if (row === activeRow && cell === activeCell) {
cellCss += (" active");
}
// TODO: merge them together in the setter
for (var key in cellCssClasses) {
if (cellCssClasses[key][row] && cellCssClasses[key][row][m.id]) {
cellCss += (" " + cellCssClasses[key][row][m.id]);
}
}
// *** Modified by Jucardi. Handle different heights ****
var style = options.useCustomRowHeight && rowOffsetCollection[row] ?
"style='height: " + getCustomRowHeight(item) + "px;'" :
"";
stringArray.push("<div class='" + cellCss + "' " + style + ">");
// *** End of Modified by Jucardi ***
// if there is a corresponding row (if not, this is the Add New row or this data hasn't been loaded yet)
if (item) {
var value = getDataItemValueForColumn(item, m);
stringArray.push(getFormatter(row, m)(row, cell, value, m, item));
}
stringArray.push("</div>");
rowsCache[row].cellRenderQueue.push(cell);
rowsCache[row].cellColSpans[cell] = colspan;
}
function cleanupRows(rangeToKeep) {
for (var i in rowsCache) {
if (((i = parseInt(i, 10)) !== activeRow) && (i < rangeToKeep.top || i > rangeToKeep.bottom)) {
removeRowFromCache(i);
}
}
}
function invalidate() {
rowOffsetCollection = {}; // Added by Jucardi. To avoid damage when reordering
updateRowCount();
invalidateAllRows();
render();
// Added by Jucardi
updateThValue();
}
function invalidateAllRows() {
if (currentEditor) {
makeActiveCellNormal();
}
for (var row in rowsCache) {
removeRowFromCache(row);
}
}
function removeRowFromCache(row) {
var cacheEntry = rowsCache[row];
if (!cacheEntry) {
return;
}
if (rowNodeFromLastMouseWheelEvent == cacheEntry.rowNode) {
cacheEntry.rowNode.style.display = 'none';
zombieRowNodeFromLastMouseWheelEvent = rowNodeFromLastMouseWheelEvent;
} else {
$canvas[0].removeChild(cacheEntry.rowNode);
}
delete rowsCache[row];
delete postProcessedRows[row];
renderedRows--;
counter_rows_removed++;
}
function invalidateRows(rows) {
var i, rl;
if (!rows || !rows.length) {
return;
}
vScrollDir = 0;
for (i = 0, rl = rows.length; i < rl; i++) {
if (currentEditor && activeRow === rows[i]) {
makeActiveCellNormal();
}
if (rowsCache[rows[i]]) {
removeRowFromCache(rows[i]);
}
}
}
function invalidateRow(row) {
invalidateRows([row]);
}
function updateCell(row, cell) {
var cellNode = getCellNode(row, cell);
if (!cellNode) {
return;
}
var m = columns[cell], d = getDataItem(row);
if (currentEditor && activeRow === row && activeCell === cell) {
currentEditor.loadValue(d);
} else {
cellNode.innerHTML = d ? getFormatter(row, m)(row, cell, getDataItemValueForColumn(d, m), m, d) : "";
invalidatePostProcessingResults(row);
}
}
function updateRow(row) {
var cacheEntry = rowsCache[row];
if (!cacheEntry) {
return;
}
ensureCellNodesInRowsCache(row);
var d = getDataItem(row);
for (var columnIdx in cacheEntry.cellNodesByColumnIdx) {
if (!cacheEntry.cellNodesByColumnIdx.hasOwnProperty(columnIdx)) {
continue;
}
columnIdx = columnIdx | 0;
var m = columns[columnIdx],
node = cacheEntry.cellNodesByColumnIdx[columnIdx];
if (row === activeRow && columnIdx === activeCell && currentEditor) {
currentEditor.loadValue(d);
} else if (d) {
node.innerHTML = getFormatter(row, m)(row, columnIdx, getDataItemValueForColumn(d, m), m, d);
} else {
node.innerHTML = "";
}
}
invalidatePostProcessingResults(row);
}
function getViewportHeight() {
return parseFloat($.css($container[0], "height", true)) -
parseFloat($.css($container[0], "paddingTop", true)) -
parseFloat($.css($container[0], "paddingBottom", true)) -
parseFloat($.css($headerScroller[0], "height")) - getVBoxDelta($headerScroller) -
(options.showTopPanel ? options.topPanelHeight + getVBoxDelta($topPanelScroller) : 0) -
(options.showHeaderRow ? options.headerRowHeight + getVBoxDelta($headerRowScroller) : 0);
}
function resizeCanvas() {
if (!initialized) { return; }
// **** Added by Jucardi ****
var rowCount = getDataLengthIncludingAddNew();
// **** End Added by Jucardi ****
if (options.autoHeight) {
// *** Modified by Jucardi ***
viewportH = (options.rowHeight * rowCount) + getRowOffsetTop(rowCount);
// *** End Modified by Jucardi ***
} else {
viewportH = getViewportHeight();
}
numVisibleRows = Math.ceil(viewportH / options.rowHeight);
viewportW = parseFloat($.css($container[0], "width", true));
if (!options.autoHeight) {
$viewport.height(viewportH);
}
if (options.forceFitColumns) {
autosizeColumns();
}
updateRowCount();
handleScroll();
// Since the width has changed, force the render() to reevaluate virtually rendered cells.
lastRenderedScrollLeft = -1;
render();
}
function updateRowCount() {
if (!initialized) { return; }
var dataLengthIncludingAddNew = getDataLengthIncludingAddNew();
var numberOfRows = dataLengthIncludingAddNew +
(options.leaveSpaceForNewRows ? numVisibleRows - 1 : 0);
var oldViewportHasVScroll = viewportHasVScroll;
// with autoHeight, we do not need to accommodate the vertical scroll bar
// *** Modified by Jucardi ***
viewportHasVScroll = !options.autoHeight && ((numberOfRows * options.rowHeight) + getRowOffsetTop(numberOfRows)> viewportH);
// *** End Modified by Jucardi ***
makeActiveCellNormal();
// remove the rows that are now outside of the data range
// this helps avoid redundant calls to .removeRow() when the size of the data decreased by thousands of rows
var l = dataLengthIncludingAddNew - 1;
for (var i in rowsCache) {
if (i >= l) {
removeRowFromCache(i);
}
}
if (activeCellNode && activeRow > l) {
resetActiveCell();
}
var oldH = h;
th = Math.max((options.rowHeight * numberOfRows) + getRowOffsetTop(numberOfRows), viewportH - scrollbarDimensions.height);
if (th < maxSupportedCssHeight) {
// just one page
h = ph = th;
n = 1;
cj = 0;
} else {
// break into pages
h = maxSupportedCssHeight;
ph = h / 100;
n = Math.floor(th / ph);
cj = (th - h) / (n - 1);
}
if (h !== oldH) {
$canvas.css("height", h);
scrollTop = $viewport[0].scrollTop;
}
var oldScrollTopInRange = (scrollTop + offset <= th - viewportH);
if (th == 0 || scrollTop == 0) {
page = offset = 0;
} else if (oldScrollTopInRange) {
// maintain virtual position
scrollTo(scrollTop + offset);
} else {
// scroll to bottom
scrollTo(th - viewportH);
}
if (h != oldH && options.autoHeight) {
resizeCanvas();
}
if (options.forceFitColumns && oldViewportHasVScroll != viewportHasVScroll) {
autosizeColumns();
}
updateCanvasWidth(false);
}
function getVisibleRange(viewportTop, viewportLeft) {
if (viewportTop == null) {
viewportTop = scrollTop;
}
if (viewportLeft == null) {
viewportLeft = scrollLeft;
}
return {
top: getRowFromPosition(viewportTop),
bottom: getRowFromPosition(viewportTop + viewportH) + 1,
leftPx: viewportLeft,
rightPx: viewportLeft + viewportW
};
}
function getRenderedRange(viewportTop, viewportLeft) {
var range = getVisibleRange(viewportTop, viewportLeft);
var buffer = Math.round(viewportH / options.rowHeight);
var minBuffer = 3;
if (vScrollDir == -1) {
range.top -= buffer;
range.bottom += minBuffer;
} else if (vScrollDir == 1) {
range.top -= minBuffer;
range.bottom += buffer;
} else {
range.top -= minBuffer;
range.bottom += minBuffer;
}
range.top = Math.max(0, range.top);
range.bottom = Math.min(getDataLengthIncludingAddNew() - 1, range.bottom);
range.leftPx -= viewportW;
range.rightPx += viewportW;
range.leftPx = Math.max(0, range.leftPx);
range.rightPx = Math.min(canvasWidth, range.rightPx);
return range;
}
function ensureCellNodesInRowsCache(row) {
var cacheEntry = rowsCache[row];
if (cacheEntry) {
if (cacheEntry.cellRenderQueue.length) {
var lastChild = cacheEntry.rowNode.lastChild;
while (cacheEntry.cellRenderQueue.length) {
var columnIdx = cacheEntry.cellRenderQueue.pop();
cacheEntry.cellNodesByColumnIdx[columnIdx] = lastChild;
lastChild = lastChild.previousSibling;
}
}
}
}
function cleanUpCells(range, row) {
var totalCellsRemoved = 0;
var cacheEntry = rowsCache[row];
// Remove cells outside the range.
var cellsToRemove = [];
for (var i in cacheEntry.cellNodesByColumnIdx) {
// I really hate it when people mess with Array.prototype.
if (!cacheEntry.cellNodesByColumnIdx.hasOwnProperty(i)) {
continue;
}
// This is a string, so it needs to be cast back to a number.
i = i | 0;
var colspan = cacheEntry.cellColSpans[i];
if (columnPosLeft[i] > range.rightPx ||
columnPosRight[Math.min(columns.length - 1, i + colspan - 1)] < range.leftPx) {
if (!(row == activeRow && i == activeCell)) {
cellsToRemove.push(i);
}
}
}
var cellToRemove;
while ((cellToRemove = cellsToRemove.pop()) != null) {
cacheEntry.rowNode.removeChild(cacheEntry.cellNodesByColumnIdx[cellToRemove]);
delete cacheEntry.cellColSpans[cellToRemove];
delete cacheEntry.cellNodesByColumnIdx[cellToRemove];
if (postProcessedRows[row]) {
delete postProcessedRows[row][cellToRemove];
}
totalCellsRemoved++;
}
}
function cleanUpAndRenderCells(range) {
var cacheEntry;
var stringArray = [];
var processedRows = [];
var cellsAdded;
var totalCellsAdded = 0;
var colspan;
for (var row = range.top, btm = range.bottom; row <= btm; row++) {
cacheEntry = rowsCache[row];
if (!cacheEntry) {
continue;
}
// cellRenderQueue populated in renderRows() needs to be cleared first
ensureCellNodesInRowsCache(row);
cleanUpCells(range, row);
// Render missing cells.
cellsAdded = 0;
var metadata = data.getItemMetadata && data.getItemMetadata(row);
metadata = metadata && metadata.columns;
var d = getDataItem(row);
// TODO: shorten this loop (index? heuristics? binary search?)
for (var i = 0, ii = columns.length; i < ii; i++) {
// Cells to the right are outside the range.
if (columnPosLeft[i] > range.rightPx) {
break;
}
// Already rendered.
if ((colspan = cacheEntry.cellColSpans[i]) != null) {
i += (colspan > 1 ? colspan - 1 : 0);
continue;
}
colspan = 1;
if (metadata) {
var columnData = metadata[columns[i].id] || metadata[i];
colspan = (columnData && columnData.colspan) || 1;
if (colspan === "*") {
colspan = ii - i;
}
}
if (columnPosRight[Math.min(ii - 1, i + colspan - 1)] > range.leftPx) {
appendCellHtml(stringArray, row, i, colspan, d);
cellsAdded++;
}
i += (colspan > 1 ? colspan - 1 : 0);
}
if (cellsAdded) {
totalCellsAdded += cellsAdded;
processedRows.push(row);
}
}
if (!stringArray.length) {
return;
}
var x = document.createElement("div");
x.innerHTML = stringArray.join("");
var processedRow;
var node;
while ((processedRow = processedRows.pop()) != null) {
cacheEntry = rowsCache[processedRow];
var columnIdx;
while ((columnIdx = cacheEntry.cellRenderQueue.pop()) != null) {
node = x.lastChild;
cacheEntry.rowNode.appendChild(node);
cacheEntry.cellNodesByColumnIdx[columnIdx] = node;
}
}
}
function renderRows(range) {
var parentNode = $canvas[0],
stringArray = [],
rows = [],
needToReselectCell = false,
dataLength = getDataLength();
for (var i = range.top, ii = range.bottom; i <= ii; i++) {
if (rowsCache[i]) {
continue;
}
renderedRows++;
rows.push(i);
// Create an entry right away so that appendRowHtml() can
// start populatating it.
rowsCache[i] = {
"rowNode": null,
// ColSpans of rendered cells (by column idx).
// Can also be used for checking whether a cell has been rendered.
"cellColSpans": [],
// Cell nodes (by column idx). Lazy-populated by ensureCellNodesInRowsCache().
"cellNodesByColumnIdx": [],
// Column indices of cell nodes that have been rendered, but not yet indexed in
// cellNodesByColumnIdx. These are in the same order as cell nodes added at the
// end of the row.
"cellRenderQueue": []
};
appendRowHtml(stringArray, i, range, dataLength);
if (activeCellNode && activeRow === i) {
needToReselectCell = true;
}
counter_rows_rendered++;
}
if (!rows.length) { return; }
var x = document.createElement("div");
x.innerHTML = stringArray.join("");
for (var i = 0, ii = rows.length; i < ii; i++) {
rowsCache[rows[i]].rowNode = parentNode.appendChild(x.firstChild);
}
if (needToReselectCell) {
activeCellNode = getCellNode(activeRow, activeCell);
}
}
function startPostProcessing() {
if (!options.enableAsyncPostRender) {
return;
}
clearTimeout(h_postrender);
h_postrender = setTimeout(asyncPostProcessRows, options.asyncPostRenderDelay);
}
function invalidatePostProcessingResults(row) {
delete postProcessedRows[row];
postProcessFromRow = Math.min(postProcessFromRow, row);
postProcessToRow = Math.max(postProcessToRow, row);
startPostProcessing();
}
function updateRowPositions() {
for (var row in rowsCache) {
rowsCache[row].rowNode.style.top = getRowTop(row) + "px";
}
}
function render() {
if (!initialized) { return; }
var visible = getVisibleRange();
var rendered = getRenderedRange();
// remove rows no longer in the viewport
cleanupRows(rendered);
// add new rows & missing cells in existing rows
if (lastRenderedScrollLeft != scrollLeft) {
cleanUpAndRenderCells(rendered);
}
// render missing rows
renderRows(rendered);
postProcessFromRow = visible.top;
postProcessToRow = Math.min(getDataLengthIncludingAddNew() - 1, visible.bottom);
startPostProcessing();
lastRenderedScrollTop = scrollTop;
lastRenderedScrollLeft = scrollLeft;
h_render = null;
}
function handleHeaderRowScroll() {
var scrollLeft = $headerRowScroller[0].scrollLeft;
if (scrollLeft != $viewport[0].scrollLeft) {
$viewport[0].scrollLeft = scrollLeft;
}
}
function handleScroll() {
scrollTop = $viewport[0].scrollTop;
scrollLeft = $viewport[0].scrollLeft;
var vScrollDist = Math.abs(scrollTop - prevScrollTop);
var hScrollDist = Math.abs(scrollLeft - prevScrollLeft);
if (hScrollDist) {
prevScrollLeft = scrollLeft;
$headerScroller[0].scrollLeft = scrollLeft;
$topPanelScroller[0].scrollLeft = scrollLeft;
$headerRowScroller[0].scrollLeft = scrollLeft;
}
if (vScrollDist) {
vScrollDir = prevScrollTop < scrollTop ? 1 : -1;
prevScrollTop = scrollTop;
// switch virtual pages if needed
if (vScrollDist < viewportH) {
scrollTo(scrollTop + offset);
} else {
var oldOffset = offset;
if (h == viewportH) {
page = 0;
} else {
page = Math.min(n - 1, Math.floor(scrollTop * ((th - viewportH) / (h - viewportH)) * (1 / ph)));
}
offset = Math.round(page * cj);
if (oldOffset != offset) {
invalidateAllRows();
}
}
}
if (hScrollDist || vScrollDist) {
if (h_render) {
clearTimeout(h_render);
}
if (Math.abs(lastRenderedScrollTop - scrollTop) > 20 ||
Math.abs(lastRenderedScrollLeft - scrollLeft) > 20) {
if (options.forceSyncScrolling || (
Math.abs(lastRenderedScrollTop - scrollTop) < viewportH &&
Math.abs(lastRenderedScrollLeft - scrollLeft) < viewportW)) {
render();
} else {
h_render = setTimeout(render, 50);
}
trigger(self.onViewportChanged, {});
}
}
trigger(self.onScroll, {scrollLeft: scrollLeft, scrollTop: scrollTop});
}
function asyncPostProcessRows() {
var dataLength = getDataLength();
while (postProcessFromRow <= postProcessToRow) {
var row = (vScrollDir >= 0) ? postProcessFromRow++ : postProcessToRow--;
var cacheEntry = rowsCache[row];
if (!cacheEntry || row >= dataLength) {
continue;
}
if (!postProcessedRows[row]) {
postProcessedRows[row] = {};
}
ensureCellNodesInRowsCache(row);
for (var columnIdx in cacheEntry.cellNodesByColumnIdx) {
if (!cacheEntry.cellNodesByColumnIdx.hasOwnProperty(columnIdx)) {
continue;
}
columnIdx = columnIdx | 0;
var m = columns[columnIdx];
if (m.asyncPostRender && !postProcessedRows[row][columnIdx]) {
var node = cacheEntry.cellNodesByColumnIdx[columnIdx];
if (node) {
m.asyncPostRender(node, row, getDataItem(row), m);
}
postProcessedRows[row][columnIdx] = true;
}
}
h_postrender = setTimeout(asyncPostProcessRows, options.asyncPostRenderDelay);
return;
}
}
function updateCellCssStylesOnRenderedRows(addedHash, removedHash) {
var node, columnId, addedRowHash, removedRowHash;
for (var row in rowsCache) {
removedRowHash = removedHash && removedHash[row];
addedRowHash = addedHash && addedHash[row];
if (removedRowHash) {
for (columnId in removedRowHash) {
if (!addedRowHash || removedRowHash[columnId] != addedRowHash[columnId]) {
node = getCellNode(row, getColumnIndex(columnId));
if (node) {
$(node).removeClass(removedRowHash[columnId]);
}
}
}
}
if (addedRowHash) {
for (columnId in addedRowHash) {
if (!removedRowHash || removedRowHash[columnId] != addedRowHash[columnId]) {
node = getCellNode(row, getColumnIndex(columnId));
if (node) {
$(node).addClass(addedRowHash[columnId]);
}
}
}
}
}
}
function addCellCssStyles(key, hash) {
if (cellCssClasses[key]) {
throw "addCellCssStyles: cell CSS hash with key '" + key + "' already exists.";
}
cellCssClasses[key] = hash;
updateCellCssStylesOnRenderedRows(hash, null);
trigger(self.onCellCssStylesChanged, { "key": key, "hash": hash });
}
function removeCellCssStyles(key) {
if (!cellCssClasses[key]) {
return;
}
updateCellCssStylesOnRenderedRows(null, cellCssClasses[key]);
delete cellCssClasses[key];
trigger(self.onCellCssStylesChanged, { "key": key, "hash": null });
}
function setCellCssStyles(key, hash) {
var prevHash = cellCssClasses[key];
cellCssClasses[key] = hash;
updateCellCssStylesOnRenderedRows(hash, prevHash);
trigger(self.onCellCssStylesChanged, { "key": key, "hash": hash });
}
function getCellCssStyles(key) {
return cellCssClasses[key];
}
function flashCell(row, cell, speed) {
speed = speed || 100;
if (rowsCache[row]) {
var $cell = $(getCellNode(row, cell));
function toggleCellClass(times) {
if (!times) {
return;
}
setTimeout(function () {
$cell.queue(function () {
$cell.toggleClass(options.cellFlashingCssClass).dequeue();
toggleCellClass(times - 1);
});
},
speed);
}
toggleCellClass(4);
}
}
// **** Added by Jucardi ****
function highlightCell(row, cell, cssClass) {
if (rowsCache[row]) {
var $cell = $(getCellNode(row, cell));
function toggleCellClass(times) {
if (!times) {
return;
}
setTimeout(function () {
$cell.queue(function () {
$cell.toggleClass(cssClass).dequeue();
toggleCellClass(times - 1);
});
},
0);
}
toggleCellClass(1);
}
}
function applyCssCell(row, cell, cssClass) {
if (rowsCache[row]) {
var $cell = $(getCellNode(row, cell));
$cell.addClass(cssClass);
}
}
function removeCssCell(row, cell, cssClass) {
if (rowsCache[row]) {
var $cell = $(getCellNode(row, cell));
$cell.removeClass(cssClass);
}
}
function setRowIdFieldName(name) {
rowIdXName = name;
}
function applyCssRow(id, cssClass) {
if (rowCssClasses[id] == null) {
rowCssClasses[id] = [];
}
rowCssClasses[id].push(cssClass);
}
function removeCssRow(id, cssClass) {
if (rowCssClasses[id] == null) return;
var index = -1;
for (var i = 0; i < rowCssClasses[id].length; i++) {
if (rowCssClasses[id][i] != cssClass) continue;
index = i;
break;
}
if (index < 0) return;
rowCssClasses[id].splice(i, 1);
if (rowCssClasses[id].length == 0)
delete rowCssClasses[id];
}
function getRowCssClasses() {
return rowCssClasses;
}
function setRowCssClasses(cssClasses) {
rowCssClasses = cssClasses;
}
// **** End Added by Jucardi ****
//////////////////////////////////////////////////////////////////////////////////////////////
// Interactivity
function handleMouseWheel(e) {
var rowNode = $(e.target).closest(".slick-row")[0];
if (rowNode != rowNodeFromLastMouseWheelEvent) {
if (zombieRowNodeFromLastMouseWheelEvent && zombieRowNodeFromLastMouseWheelEvent != rowNode) {
$canvas[0].removeChild(zombieRowNodeFromLastMouseWheelEvent);
zombieRowNodeFromLastMouseWheelEvent = null;
}
rowNodeFromLastMouseWheelEvent = rowNode;
}
}
function handleDragInit(e, dd) {
var cell = getCellFromEvent(e);
if (!cell || !cellExists(cell.row, cell.cell)) {
return false;
}
var retval = trigger(self.onDragInit, dd, e);
if (e.isImmediatePropagationStopped()) {
return retval;
}
// if nobody claims to be handling drag'n'drop by stopping immediate propagation,
// cancel out of it
return false;
}
function handleDragStart(e, dd) {
var cell = getCellFromEvent(e);
if (!cell || !cellExists(cell.row, cell.cell)) {
return false;
}
var retval = trigger(self.onDragStart, dd, e);
if (e.isImmediatePropagationStopped()) {
return retval;
}
return false;
}
function handleDrag(e, dd) {
return trigger(self.onDrag, dd, e);
}
function handleDragEnd(e, dd) {
trigger(self.onDragEnd, dd, e);
}
function handleKeyDown(e) {
trigger(self.onKeyDown, {row: activeRow, cell: activeCell}, e);
var handled = e.isImmediatePropagationStopped();
if (!handled) {
if (!e.shiftKey && !e.altKey && !e.ctrlKey) {
if (e.which == 27) {
if (!getEditorLock().isActive()) {
return; // no editing mode to cancel, allow bubbling and default processing (exit without cancelling the event)
}
cancelEditAndSetFocus();
} else if (e.which == 34) {
navigatePageDown();
handled = true;
} else if (e.which == 33) {
navigatePageUp();
handled = true;
} else if (e.which == 37) {
handled = navigateLeft();
} else if (e.which == 39) {
handled = navigateRight();
} else if (e.which == 38) {
handled = navigateUp();
} else if (e.which == 40) {
handled = navigateDown();
} else if (e.which == 9) {
handled = navigateNext();
} else if (e.which == 13) {
if (options.editable) {
if (currentEditor) {
// adding new row
if (activeRow === getDataLength()) {
navigateDown();
} else {
commitEditAndSetFocus();
}
} else {
if (getEditorLock().commitCurrentEdit()) {
makeActiveCellEditable();
}
}
}
handled = true;
}
} else if (e.which == 9 && e.shiftKey && !e.ctrlKey && !e.altKey) {
handled = navigatePrev();
}
}
if (handled) {
// the event has been handled so don't let parent element (bubbling/propagation) or browser (default) handle it
e.stopPropagation();
e.preventDefault();
try {
e.originalEvent.keyCode = 0; // prevent default behaviour for special keys in IE browsers (F3, F5, etc.)
}
// ignore exceptions - setting the original event's keycode throws access denied exception for "Ctrl"
// (hitting control key only, nothing else), "Shift" (maybe others)
catch (error) {
}
}
}
function handleClick(e) {
if (!currentEditor) {
// if this click resulted in some cell child node getting focus,
// don't steal it back - keyboard events will still bubble up
// IE9+ seems to default DIVs to tabIndex=0 instead of -1, so check for cell clicks directly.
if (e.target != document.activeElement || $(e.target).hasClass("slick-cell")) {
setFocus();
}
}
var cell = getCellFromEvent(e);
if (!cell || (currentEditor !== null && activeRow == cell.row && activeCell == cell.cell)) {
return;
}
trigger(self.onClick, {row: cell.row, cell: cell.cell}, e);
if (e.isImmediatePropagationStopped()) {
return;
}
if ((activeCell != cell.cell || activeRow != cell.row) && canCellBeActive(cell.row, cell.cell)) {
if (!getEditorLock().isActive() || getEditorLock().commitCurrentEdit()) {
scrollRowIntoView(cell.row, false);
setActiveCellInternal(getCellNode(cell.row, cell.cell));
}
}
}
function handleContextMenu(e) {
var $cell = $(e.target).closest(".slick-cell", $canvas);
if ($cell.length === 0) {
return;
}
// are we editing this cell?
if (activeCellNode === $cell[0] && currentEditor !== null) {
return;
}
trigger(self.onContextMenu, {}, e);
}
function handleDblClick(e) {
var cell = getCellFromEvent(e);
if (!cell || (currentEditor !== null && activeRow == cell.row && activeCell == cell.cell)) {
return;
}
trigger(self.onDblClick, {row: cell.row, cell: cell.cell}, e);
if (e.isImmediatePropagationStopped()) {
return;
}
if (options.editable) {
gotoCell(cell.row, cell.cell, true);
}
}
function handleHeaderMouseEnter(e) {
trigger(self.onHeaderMouseEnter, {
"column": $(this).data("column")
}, e);
}
function handleHeaderMouseLeave(e) {
trigger(self.onHeaderMouseLeave, {
"column": $(this).data("column")
}, e);
}
function handleHeaderContextMenu(e) {
var $header = $(e.target).closest(".slick-header-column", ".slick-header-columns");
var column = $header && $header.data("column");
trigger(self.onHeaderContextMenu, {column: column}, e);
}
function handleHeaderClick(e) {
var $header = $(e.target).closest(".slick-header-column", ".slick-header-columns");
var column = $header && $header.data("column");
if (column) {
trigger(self.onHeaderClick, {column: column}, e);
}
}
function handleMouseEnter(e) {
trigger(self.onMouseEnter, {}, e);
}
function handleMouseLeave(e) {
trigger(self.onMouseLeave, {}, e);
}
function cellExists(row, cell) {
return !(row < 0 || row >= getDataLength() || cell < 0 || cell >= columns.length);
}
function getCellFromPoint(x, y) {
var row = getRowFromPosition(y);
var cell = 0;
var w = 0;
for (var i = 0; i < columns.length && w < x; i++) {
w += columns[i].width;
cell++;
}
if (cell < 0) {
cell = 0;
}
return {row: row, cell: cell - 1};
}
function getCellFromNode(cellNode) {
// read column number from .l<columnNumber> CSS class
var cls = /l\d+/.exec(cellNode.className);
if (!cls) {
throw "getCellFromNode: cannot get cell - " + cellNode.className;
}
return parseInt(cls[0].substr(1, cls[0].length - 1), 10);
}
function getRowFromNode(rowNode) {
for (var row in rowsCache) {
if (rowsCache[row].rowNode === rowNode) {
return row | 0;
}
}
return null;
}
function getCellFromEvent(e) {
var $cell = $(e.target).closest(".slick-cell", $canvas);
if (!$cell.length) {
return null;
}
var row = getRowFromNode($cell[0].parentNode);
var cell = getCellFromNode($cell[0]);
if (row == null || cell == null) {
return null;
} else {
return {
"row": row,
"cell": cell
};
}
}
function getCellNodeBox(row, cell) {
if (!cellExists(row, cell)) {
return null;
}
var y1 = getRowTop(row);
var y2 = y1 + options.rowHeight - 1;
var x1 = 0;
for (var i = 0; i < cell; i++) {
x1 += columns[i].width;
}
var x2 = x1 + columns[cell].width;
return {
top: y1,
left: x1,
bottom: y2,
right: x2
};
}
//////////////////////////////////////////////////////////////////////////////////////////////
// Cell switching
function resetActiveCell() {
setActiveCellInternal(null, false);
}
function setFocus() {
if (tabbingDirection == -1) {
$focusSink[0].focus();
} else {
$focusSink2[0].focus();
}
}
function scrollCellIntoView(row, cell, doPaging) {
scrollRowIntoView(row, doPaging);
var colspan = getColspan(row, cell);
var left = columnPosLeft[cell],
right = columnPosRight[cell + (colspan > 1 ? colspan - 1 : 0)],
scrollRight = scrollLeft + viewportW;
if (left < scrollLeft) {
$viewport.scrollLeft(left);
handleScroll();
render();
} else if (right > scrollRight) {
$viewport.scrollLeft(Math.min(left, right - $viewport[0].clientWidth));
handleScroll();
render();
}
}
function setActiveCellInternal(newCell, opt_editMode) {
if (activeCellNode !== null) {
makeActiveCellNormal();
$(activeCellNode).removeClass("active");
if (rowsCache[activeRow]) {
$(rowsCache[activeRow].rowNode).removeClass("active");
}
}
var activeCellChanged = (activeCellNode !== newCell);
activeCellNode = newCell;
if (activeCellNode != null) {
activeRow = getRowFromNode(activeCellNode.parentNode);
activeCell = activePosX = getCellFromNode(activeCellNode);
if (opt_editMode == null) {
opt_editMode = (activeRow == getDataLength()) || options.autoEdit;
}
$(activeCellNode).addClass("active");
$(rowsCache[activeRow].rowNode).addClass("active");
if (options.editable && opt_editMode && isCellPotentiallyEditable(activeRow, activeCell)) {
clearTimeout(h_editorLoader);
if (options.asyncEditorLoading) {
h_editorLoader = setTimeout(function () {
makeActiveCellEditable();
}, options.asyncEditorLoadDelay);
} else {
makeActiveCellEditable();
}
}
} else {
activeRow = activeCell = null;
}
if (activeCellChanged) {
trigger(self.onActiveCellChanged, getActiveCell());
}
}
function clearTextSelection() {
if (document.selection && document.selection.empty) {
try {
//IE fails here if selected element is not in dom
document.selection.empty();
} catch (e) { }
} else if (window.getSelection) {
var sel = window.getSelection();
if (sel && sel.removeAllRanges) {
sel.removeAllRanges();
}
}
}
function isCellPotentiallyEditable(row, cell) {
var dataLength = getDataLength();
// is the data for this row loaded?
if (row < dataLength && !getDataItem(row)) {
return false;
}
// are we in the Add New row? can we create new from this cell?
if (columns[cell].cannotTriggerInsert && row >= dataLength) {
return false;
}
// does this cell have an editor?
if (!getEditor(row, cell)) {
return false;
}
return true;
}
function makeActiveCellNormal() {
if (!currentEditor) {
return;
}
trigger(self.onBeforeCellEditorDestroy, {editor: currentEditor});
currentEditor.destroy();
currentEditor = null;
if (activeCellNode) {
var d = getDataItem(activeRow);
$(activeCellNode).removeClass("editable invalid");
if (d) {
var column = columns[activeCell];
var formatter = getFormatter(activeRow, column);
activeCellNode.innerHTML = formatter(activeRow, activeCell, getDataItemValueForColumn(d, column), column, d);
invalidatePostProcessingResults(activeRow);
}
}
// if there previously was text selected on a page (such as selected text in the edit cell just removed),
// IE can't set focus to anything else correctly
if (navigator.userAgent.toLowerCase().match(/msie/)) {
clearTextSelection();
}
getEditorLock().deactivate(editController);
}
function makeActiveCellEditable(editor) {
if (!activeCellNode) {
return;
}
if (!options.editable) {
throw "Grid : makeActiveCellEditable : should never get called when options.editable is false";
}
// cancel pending async call if there is one
clearTimeout(h_editorLoader);
if (!isCellPotentiallyEditable(activeRow, activeCell)) {
return;
}
var columnDef = columns[activeCell];
var item = getDataItem(activeRow);
if (trigger(self.onBeforeEditCell, {row: activeRow, cell: activeCell, item: item, column: columnDef}) === false) {
setFocus();
return;
}
getEditorLock().activate(editController);
$(activeCellNode).addClass("editable");
// don't clear the cell if a custom editor is passed through
if (!editor) {
activeCellNode.innerHTML = "";
}
currentEditor = new (editor || getEditor(activeRow, activeCell))({
grid: self,
gridPosition: absBox($container[0]),
position: absBox(activeCellNode),
container: activeCellNode,
column: columnDef,
item: item || {},
commitChanges: commitEditAndSetFocus,
cancelChanges: cancelEditAndSetFocus
});
if (item) {
currentEditor.loadValue(item);
}
serializedEditorValue = currentEditor.serializeValue();
if (currentEditor.position) {
handleActiveCellPositionChange();
}
}
function commitEditAndSetFocus() {
// if the commit fails, it would do so due to a validation error
// if so, do not steal the focus from the editor
if (getEditorLock().commitCurrentEdit()) {
setFocus();
if (options.autoEdit) {
navigateDown();
}
}
}
function cancelEditAndSetFocus() {
if (getEditorLock().cancelCurrentEdit()) {
setFocus();
}
}
function absBox(elem) {
var box = {
top: elem.offsetTop,
left: elem.offsetLeft,
bottom: 0,
right: 0,
width: $(elem).outerWidth(),
height: $(elem).outerHeight(),
visible: true};
box.bottom = box.top + box.height;
box.right = box.left + box.width;
// walk up the tree
var offsetParent = elem.offsetParent;
while ((elem = elem.parentNode) != document.body) {
if (box.visible && elem.scrollHeight != elem.offsetHeight && $(elem).css("overflowY") != "visible") {
box.visible = box.bottom > elem.scrollTop && box.top < elem.scrollTop + elem.clientHeight;
}
if (box.visible && elem.scrollWidth != elem.offsetWidth && $(elem).css("overflowX") != "visible") {
box.visible = box.right > elem.scrollLeft && box.left < elem.scrollLeft + elem.clientWidth;
}
box.left -= elem.scrollLeft;
box.top -= elem.scrollTop;
if (elem === offsetParent) {
box.left += elem.offsetLeft;
box.top += elem.offsetTop;
offsetParent = elem.offsetParent;
}
box.bottom = box.top + box.height;
box.right = box.left + box.width;
}
return box;
}
function getActiveCellPosition() {
return absBox(activeCellNode);
}
function getGridPosition() {
return absBox($container[0])
}
function handleActiveCellPositionChange() {
if (!activeCellNode) {
return;
}
trigger(self.onActiveCellPositionChanged, {});
if (currentEditor) {
var cellBox = getActiveCellPosition();
if (currentEditor.show && currentEditor.hide) {
if (!cellBox.visible) {
currentEditor.hide();
} else {
currentEditor.show();
}
}
if (currentEditor.position) {
currentEditor.position(cellBox);
}
}
}
function getCellEditor() {
return currentEditor;
}
function getActiveCell() {
if (!activeCellNode) {
return null;
} else {
return {row: activeRow, cell: activeCell};
}
}
function getActiveCellNode() {
return activeCellNode;
}
function scrollRowIntoView(row, doPaging) {
var rowAtTop = (row * options.rowHeight) + getRowOffsetTop(row);
var rowAtBottom = ((row + 1) * options.rowHeight) + getRowOffsetTop(row + 1) - viewportH + (viewportHasHScroll ? scrollbarDimensions.height : 0);
// need to page down?
if ((row + 1) * options.rowHeight > scrollTop + viewportH + offset) {
scrollTo(doPaging ? rowAtTop : rowAtBottom);
render();
}
// or page up?
else if (row * options.rowHeight < scrollTop + offset) {
scrollTo(doPaging ? rowAtBottom : rowAtTop);
render();
}
}
function scrollRowToTop(row) {
// Modified by Jucardi
scrollTo((row * options.rowHeight) + getRowOffsetTop(row));
render();
}
function scrollPage(dir) {
var deltaRows = dir * numVisibleRows;
scrollTo((getRowFromPosition(scrollTop) + deltaRows) * options.rowHeight);
render();
if (options.enableCellNavigation && activeRow != null) {
var row = activeRow + deltaRows;
var dataLengthIncludingAddNew = getDataLengthIncludingAddNew();
if (row >= dataLengthIncludingAddNew) {
row = dataLengthIncludingAddNew - 1;
}
if (row < 0) {
row = 0;
}
var cell = 0, prevCell = null;
var prevActivePosX = activePosX;
while (cell <= activePosX) {
if (canCellBeActive(row, cell)) {
prevCell = cell;
}
cell += getColspan(row, cell);
}
if (prevCell !== null) {
setActiveCellInternal(getCellNode(row, prevCell));
activePosX = prevActivePosX;
} else {
resetActiveCell();
}
}
}
function navigatePageDown() {
scrollPage(1);
}
function navigatePageUp() {
scrollPage(-1);
}
function getColspan(row, cell) {
var metadata = data.getItemMetadata && data.getItemMetadata(row);
if (!metadata || !metadata.columns) {
return 1;
}
var columnData = metadata.columns[columns[cell].id] || metadata.columns[cell];
var colspan = (columnData && columnData.colspan);
if (colspan === "*") {
colspan = columns.length - cell;
} else {
colspan = colspan || 1;
}
return colspan;
}
function findFirstFocusableCell(row) {
var cell = 0;
while (cell < columns.length) {
if (canCellBeActive(row, cell)) {
return cell;
}
cell += getColspan(row, cell);
}
return null;
}
function findLastFocusableCell(row) {
var cell = 0;
var lastFocusableCell = null;
while (cell < columns.length) {
if (canCellBeActive(row, cell)) {
lastFocusableCell = cell;
}
cell += getColspan(row, cell);
}
return lastFocusableCell;
}
function gotoRight(row, cell, posX) {
if (cell >= columns.length) {
return null;
}
do {
cell += getColspan(row, cell);
}
while (cell < columns.length && !canCellBeActive(row, cell));
if (cell < columns.length) {
return {
"row": row,
"cell": cell,
"posX": cell
};
}
return null;
}
function gotoLeft(row, cell, posX) {
if (cell <= 0) {
return null;
}
var firstFocusableCell = findFirstFocusableCell(row);
if (firstFocusableCell === null || firstFocusableCell >= cell) {
return null;
}
var prev = {
"row": row,
"cell": firstFocusableCell,
"posX": firstFocusableCell
};
var pos;
while (true) {
pos = gotoRight(prev.row, prev.cell, prev.posX);
if (!pos) {
return null;
}
if (pos.cell >= cell) {
return prev;
}
prev = pos;
}
}
function gotoDown(row, cell, posX) {
var prevCell;
var dataLengthIncludingAddNew = getDataLengthIncludingAddNew();
while (true) {
if (++row >= dataLengthIncludingAddNew) {
return null;
}
prevCell = cell = 0;
while (cell <= posX) {
prevCell = cell;
cell += getColspan(row, cell);
}
if (canCellBeActive(row, prevCell)) {
return {
"row": row,
"cell": prevCell,
"posX": posX
};
}
}
}
function gotoUp(row, cell, posX) {
var prevCell;
while (true) {
if (--row < 0) {
return null;
}
prevCell = cell = 0;
while (cell <= posX) {
prevCell = cell;
cell += getColspan(row, cell);
}
if (canCellBeActive(row, prevCell)) {
return {
"row": row,
"cell": prevCell,
"posX": posX
};
}
}
}
function gotoNext(row, cell, posX) {
if (row == null && cell == null) {
row = cell = posX = 0;
if (canCellBeActive(row, cell)) {
return {
"row": row,
"cell": cell,
"posX": cell
};
}
}
var pos = gotoRight(row, cell, posX);
if (pos) {
return pos;
}
var firstFocusableCell = null;
var dataLengthIncludingAddNew = getDataLengthIncludingAddNew();
while (++row < dataLengthIncludingAddNew) {
firstFocusableCell = findFirstFocusableCell(row);
if (firstFocusableCell !== null) {
return {
"row": row,
"cell": firstFocusableCell,
"posX": firstFocusableCell
};
}
}
return null;
}
function gotoPrev(row, cell, posX) {
if (row == null && cell == null) {
row = getDataLengthIncludingAddNew() - 1;
cell = posX = columns.length - 1;
if (canCellBeActive(row, cell)) {
return {
"row": row,
"cell": cell,
"posX": cell
};
}
}
var pos;
var lastSelectableCell;
while (!pos) {
pos = gotoLeft(row, cell, posX);
if (pos) {
break;
}
if (--row < 0) {
return null;
}
cell = 0;
lastSelectableCell = findLastFocusableCell(row);
if (lastSelectableCell !== null) {
pos = {
"row": row,
"cell": lastSelectableCell,
"posX": lastSelectableCell
};
}
}
return pos;
}
function navigateRight() {
return navigate("right");
}
function navigateLeft() {
return navigate("left");
}
function navigateDown() {
return navigate("down");
}
function navigateUp() {
return navigate("up");
}
function navigateNext() {
return navigate("next");
}
function navigatePrev() {
return navigate("prev");
}
/**
* @param {string} dir Navigation direction.
* @return {boolean} Whether navigation resulted in a change of active cell.
*/
function navigate(dir) {
if (!options.enableCellNavigation) {
return false;
}
if (!activeCellNode && dir != "prev" && dir != "next") {
return false;
}
if (!getEditorLock().commitCurrentEdit()) {
return true;
}
setFocus();
var tabbingDirections = {
"up": -1,
"down": 1,
"left": -1,
"right": 1,
"prev": -1,
"next": 1
};
tabbingDirection = tabbingDirections[dir];
var stepFunctions = {
"up": gotoUp,
"down": gotoDown,
"left": gotoLeft,
"right": gotoRight,
"prev": gotoPrev,
"next": gotoNext
};
var stepFn = stepFunctions[dir];
var pos = stepFn(activeRow, activeCell, activePosX);
if (pos) {
var isAddNewRow = (pos.row == getDataLength());
scrollCellIntoView(pos.row, pos.cell, !isAddNewRow);
setActiveCellInternal(getCellNode(pos.row, pos.cell));
activePosX = pos.posX;
return true;
} else {
setActiveCellInternal(getCellNode(activeRow, activeCell));
return false;
}
}
function getCellNode(row, cell) {
if (rowsCache[row]) {
ensureCellNodesInRowsCache(row);
return rowsCache[row].cellNodesByColumnIdx[cell];
}
return null;
}
function setActiveCell(row, cell) {
if (!initialized) { return; }
if (row > getDataLength() || row < 0 || cell >= columns.length || cell < 0) {
return;
}
if (!options.enableCellNavigation) {
return;
}
scrollCellIntoView(row, cell, false);
setActiveCellInternal(getCellNode(row, cell), false);
}
function canCellBeActive(row, cell) {
if (!options.enableCellNavigation || row >= getDataLengthIncludingAddNew() ||
row < 0 || cell >= columns.length || cell < 0) {
return false;
}
var rowMetadata = data.getItemMetadata && data.getItemMetadata(row);
if (rowMetadata && typeof rowMetadata.focusable === "boolean") {
return rowMetadata.focusable;
}
var columnMetadata = rowMetadata && rowMetadata.columns;
if (columnMetadata && columnMetadata[columns[cell].id] && typeof columnMetadata[columns[cell].id].focusable === "boolean") {
return columnMetadata[columns[cell].id].focusable;
}
if (columnMetadata && columnMetadata[cell] && typeof columnMetadata[cell].focusable === "boolean") {
return columnMetadata[cell].focusable;
}
return columns[cell].focusable;
}
function canCellBeSelected(row, cell) {
if (row >= getDataLength() || row < 0 || cell >= columns.length || cell < 0) {
return false;
}
var rowMetadata = data.getItemMetadata && data.getItemMetadata(row);
if (rowMetadata && typeof rowMetadata.selectable === "boolean") {
return rowMetadata.selectable;
}
var columnMetadata = rowMetadata && rowMetadata.columns && (rowMetadata.columns[columns[cell].id] || rowMetadata.columns[cell]);
if (columnMetadata && typeof columnMetadata.selectable === "boolean") {
return columnMetadata.selectable;
}
return columns[cell].selectable;
}
function gotoCell(row, cell, forceEdit) {
if (!initialized) { return; }
if (!canCellBeActive(row, cell)) {
return;
}
if (!getEditorLock().commitCurrentEdit()) {
return;
}
scrollCellIntoView(row, cell, false);
var newCell = getCellNode(row, cell);
// if selecting the 'add new' row, start editing right away
setActiveCellInternal(newCell, forceEdit || (row === getDataLength()) || options.autoEdit);
// if no editor was created, set the focus back on the grid
if (!currentEditor) {
setFocus();
}
}
//////////////////////////////////////////////////////////////////////////////////////////////
// IEditor implementation for the editor lock
function commitCurrentEdit() {
var item = getDataItem(activeRow);
var column = columns[activeCell];
if (currentEditor) {
if (currentEditor.isValueChanged()) {
var validationResults = currentEditor.validate();
if (validationResults.valid) {
if (activeRow < getDataLength()) {
var editCommand = {
row: activeRow,
cell: activeCell,
editor: currentEditor,
serializedValue: currentEditor.serializeValue(),
prevSerializedValue: serializedEditorValue,
execute: function () {
this.editor.applyValue(item, this.serializedValue);
updateRow(this.row);
trigger(self.onCellChange, {
row: activeRow,
cell: activeCell,
item: item
});
},
undo: function () {
this.editor.applyValue(item, this.prevSerializedValue);
updateRow(this.row);
trigger(self.onCellChange, {
row: activeRow,
cell: activeCell,
item: item
});
}
};
if (options.editCommandHandler) {
makeActiveCellNormal();
options.editCommandHandler(item, column, editCommand);
} else {
editCommand.execute();
makeActiveCellNormal();
}
} else {
var newItem = {};
currentEditor.applyValue(newItem, currentEditor.serializeValue());
makeActiveCellNormal();
trigger(self.onAddNewRow, {item: newItem, column: column});
}
// check whether the lock has been re-acquired by event handlers
return !getEditorLock().isActive();
} else {
// Re-add the CSS class to trigger transitions, if any.
$(activeCellNode).removeClass("invalid");
$(activeCellNode).width(); // force layout
$(activeCellNode).addClass("invalid");
trigger(self.onValidationError, {
editor: currentEditor,
cellNode: activeCellNode,
validationResults: validationResults,
row: activeRow,
cell: activeCell,
column: column
});
currentEditor.focus();
return false;
}
}
makeActiveCellNormal();
}
return true;
}
function cancelCurrentEdit() {
makeActiveCellNormal();
return true;
}
function rowsToRanges(rows) {
var ranges = [];
var lastCell = columns.length - 1;
for (var i = 0; i < rows.length; i++) {
ranges.push(new Slick.Range(rows[i], 0, rows[i], lastCell));
}
return ranges;
}
function getSelectedRows() {
if (!selectionModel) {
throw "Selection model is not set";
}
return selectedRows;
}
function setSelectedRows(rows) {
if (!selectionModel) {
throw "Selection model is not set";
}
selectionModel.setSelectedRanges(rowsToRanges(rows));
}
//////////////////////////////////////////////////////////////////////////////////////////////
// Debug
this.debug = function () {
var s = "";
s += ("\n" + "counter_rows_rendered: " + counter_rows_rendered);
s += ("\n" + "counter_rows_removed: " + counter_rows_removed);
s += ("\n" + "renderedRows: " + renderedRows);
s += ("\n" + "numVisibleRows: " + numVisibleRows);
s += ("\n" + "maxSupportedCssHeight: " + maxSupportedCssHeight);
s += ("\n" + "n(umber of pages): " + n);
s += ("\n" + "(current) page: " + page);
s += ("\n" + "page height (ph): " + ph);
s += ("\n" + "vScrollDir: " + vScrollDir);
alert(s);
};
// a debug helper to be able to access private members
this.eval = function (expr) {
return eval(expr);
};
//////////////////////////////////////////////////////////////////////////////////////////////
// Public API
$.extend(this, {
"slickGridVersion": "2.1",
// Events
"onScroll": new Slick.Event(),
"onSort": new Slick.Event(),
"onHeaderMouseEnter": new Slick.Event(),
"onHeaderMouseLeave": new Slick.Event(),
"onHeaderContextMenu": new Slick.Event(),
"onHeaderClick": new Slick.Event(),
"onHeaderCellRendered": new Slick.Event(),
"onBeforeHeaderCellDestroy": new Slick.Event(),
"onHeaderRowCellRendered": new Slick.Event(),
"onBeforeHeaderRowCellDestroy": new Slick.Event(),
"onMouseEnter": new Slick.Event(),
"onMouseLeave": new Slick.Event(),
"onClick": new Slick.Event(),
"onDblClick": new Slick.Event(),
"onContextMenu": new Slick.Event(),
"onKeyDown": new Slick.Event(),
"onAddNewRow": new Slick.Event(),
"onValidationError": new Slick.Event(),
"onViewportChanged": new Slick.Event(),
"onColumnsReordered": new Slick.Event(),
"onColumnsResized": new Slick.Event(),
"onCellChange": new Slick.Event(),
"onBeforeEditCell": new Slick.Event(),
"onBeforeCellEditorDestroy": new Slick.Event(),
"onBeforeDestroy": new Slick.Event(),
"onActiveCellChanged": new Slick.Event(),
"onActiveCellPositionChanged": new Slick.Event(),
"onDragInit": new Slick.Event(),
"onDragStart": new Slick.Event(),
"onDrag": new Slick.Event(),
"onDragEnd": new Slick.Event(),
"onSelectedRowsChanged": new Slick.Event(),
"onCellCssStylesChanged": new Slick.Event(),
// Methods
"registerPlugin": registerPlugin,
"unregisterPlugin": unregisterPlugin,
"getColumns": getColumns,
"setColumns": setColumns,
"getColumnIndex": getColumnIndex,
"updateColumnHeader": updateColumnHeader,
"setSortColumn": setSortColumn,
"setSortColumns": setSortColumns,
"getSortColumns": getSortColumns,
"autosizeColumns": autosizeColumns,
"getOptions": getOptions,
"setOptions": setOptions,
"getData": getData,
"getDataLength": getDataLength,
"getDataItem": getDataItem,
"setData": setData,
"getSelectionModel": getSelectionModel,
"setSelectionModel": setSelectionModel,
"getSelectedRows": getSelectedRows,
"setSelectedRows": setSelectedRows,
"getContainerNode": getContainerNode,
"render": render,
"invalidate": invalidate,
"invalidateRow": invalidateRow,
"invalidateRows": invalidateRows,
"invalidateAllRows": invalidateAllRows,
"updateCell": updateCell,
"updateRow": updateRow,
"getViewport": getVisibleRange,
"getRenderedRange": getRenderedRange,
"resizeCanvas": resizeCanvas,
"updateRowCount": updateRowCount,
"scrollRowIntoView": scrollRowIntoView,
"scrollRowToTop": scrollRowToTop,
"scrollCellIntoView": scrollCellIntoView,
"getCanvasNode": getCanvasNode,
"focus": setFocus,
"getCellFromPoint": getCellFromPoint,
"getCellFromEvent": getCellFromEvent,
"getActiveCell": getActiveCell,
"setActiveCell": setActiveCell,
"getActiveCellNode": getActiveCellNode,
"getActiveCellPosition": getActiveCellPosition,
"resetActiveCell": resetActiveCell,
"editActiveCell": makeActiveCellEditable,
"getCellEditor": getCellEditor,
"getCellNode": getCellNode,
"getCellNodeBox": getCellNodeBox,
"canCellBeSelected": canCellBeSelected,
"canCellBeActive": canCellBeActive,
"navigatePrev": navigatePrev,
"navigateNext": navigateNext,
"navigateUp": navigateUp,
"navigateDown": navigateDown,
"navigateLeft": navigateLeft,
"navigateRight": navigateRight,
"navigatePageUp": navigatePageUp,
"navigatePageDown": navigatePageDown,
"gotoCell": gotoCell,
"getTopPanel": getTopPanel,
"setTopPanelVisibility": setTopPanelVisibility,
"setHeaderRowVisibility": setHeaderRowVisibility,
"getHeaderRow": getHeaderRow,
"getHeaderRowColumn": getHeaderRowColumn,
"getGridPosition": getGridPosition,
"flashCell": flashCell,
// **** Added by Jucardi ****
"highlightCell": highlightCell,
"applyCssCell": applyCssCell,
"removeCssCell": removeCssCell,
"setRowIdFieldName": setRowIdFieldName,
"applyCssRow": applyCssRow,
"removeCssRow": removeCssRow,
"getRowCssClasses": getRowCssClasses,
"setRowCssClasses": setRowCssClasses,
// **** End Added by Jucardi ****
"addCellCssStyles": addCellCssStyles,
"setCellCssStyles": setCellCssStyles,
"removeCellCssStyles": removeCellCssStyles,
"getCellCssStyles": getCellCssStyles,
"init": finishInitialization,
"destroy": destroy,
// IEditor implementation
"getEditorLock": getEditorLock,
"getEditController": getEditController
});
init();
}
}(jQuery));
|
function JoyStick() {
//Data
this._inputActions = new InputActions();
this.connected = false;
this._gamePad = navigator.getGamepads()[0];
this._lastJoystickState = new JoystickState();
//Functions
this.getInputActions = function ()
{
//Get Current Game Pad (Player 1)
this.gamePad = navigator.getGamepads()[0];
//If Game Pad Not Found return
if (this.gamePad === undefined) {
inProcess = false;
return this._inputActions;
}
//A
if (this.gamePad.buttons[Button.A].pressed === true && this._lastJoystickState.A == false)
{
this._inputActions.selectorSwap = true;
}
//Left Trigger Down
if (this.gamePad.buttons[Button.LeftTrigger].pressed === true && this._lastJoystickState.R == false) {
this._inputActions.blocksFastOn = true;
}
//Left Trigger Up
if (this.gamePad.buttons[Button.LeftTrigger].pressed === false && this._lastJoystickState.R == true) {
this._inputActions.blocksFastOff = true;
}
//Up
if (this.gamePad.buttons[Button.DpadUp].pressed === true && this._lastJoystickState.Up == false) {
this._inputActions.selectorUp = true;
}
//Down
if (this.gamePad.buttons[Button.DpadDown].pressed === true && this._lastJoystickState.Down == false) {
this._inputActions.selectorDown = true;
}
//Left
if (this.gamePad.buttons[Button.DpadLeft].pressed === true && this._lastJoystickState.Left == false) {
this._inputActions.selectorLeft = true;
}
//Right
if (this.gamePad.buttons[Button.DpadRight].pressed === true && this._lastJoystickState.Right == false) {
this._inputActions.selectorRight = true;
}
//Last Pressed
this._lastJoystickState.A = this.gamePad.buttons[Button.A].pressed;
this._lastJoystickState.Up = this.gamePad.buttons[Button.DpadUp].pressed;
this._lastJoystickState.Down = this.gamePad.buttons[Button.DpadDown].pressed;
this._lastJoystickState.Left = this.gamePad.buttons[Button.DpadLeft].pressed;
this._lastJoystickState.Right = this.gamePad.buttons[Button.DpadRight].pressed;
this._lastJoystickState.R = this.gamePad.buttons[Button.LeftTrigger].pressed;
return this._inputActions;
};
this.clear = function(){
this._inputActions.clear();
}
}; |
var PUSH_SPEED;
var pushers = [];
function pusher_init()
{
PUSH_SPEED = TILE_SIZE;
}
function pushers_update(dt)
{
var len = pushers.length;
for (var i = 0; i < len; ++i)
{
var entity1 = pushers[i];
for (var j = 0; j < len; ++j)
{
if (i == j) continue; // Cannot push itself
var entity2 = pushers[j];
var distance = Vector2.distance(entity1.position, entity2.position);
if (distance <= entity1.size + entity2.size)
{
var percent = 1 - (distance / (entity1.size + entity2.size));
var dir = entity2.position.sub(entity1.position);
dir = dir.normalize().mul(PUSH_SPEED * dt);
entity1.position = tiledMap.collision(entity1.position, entity1.position.sub(dir.mul(percent)));
entity2.position = tiledMap.collision(entity2.position, entity2.position.add(dir.mul(percent)));
}
}
}
}
|
var fs = require("fs"),
_ = require("underscore"),
evento = require("evento");
;
function ExportTo() {
};
ExportTo.prototype = {
request: null,
exportVersion: function()
{
fs.writeFile(this.request.exportPath, this.getVersionData(), _.bind(this.onWriteFile, this));
},
getVersionData: function()
{
return JSON.stringify({
version: this.request.version,
time: this.request.timestamp
});
},
isExportRequested: function()
{
return !_.isNull(this.request.exportPath);
},
onWriteFile: function(err)
{
err
? evento.trigger("INFORMER_WARNING", "Cannot export version to file: "+this.request.exportPath)
: evento.trigger("INFORMER_SUCCESS", "Version saved to: "+this.request.exportPath);
evento.trigger("EVENT_EXPORT");
},
save: function()
{
this.isExportRequested()
? this.exportVersion()
: evento.trigger("EVENT_EXPORT");
}
};
module.exports = new ExportTo(); |
import React from 'react';
import styles from './styles.css';
class DashboardProfile extends React.Component {
render() {
return (
<div >
<div className={ styles.dashboardLeft}>
<a className={ styles.cover }></a>
<div >
<a className={styles.DashboardProfileAvatar}>
<img className={styles.profileAvatarImage} src="https://pbs.twimg.com/profile_images/694099768834797568/IvPKkR0E_bigger.jpg"></img>
</a>
<div className={styles.DashboardProfileAvatarName}>
<a>Kielan Lemons</a>
<span className={styles.DashboardProfileAvatarID}>
<a>@<span>KielanLemons</span></a>
</span>
</div>
<div className={styles.DashboardProfileContent}>
<div className={styles.stats}>
<a className={styles.statsItem}>
<span className={styles.statsItemName}>Tweets</span>
<span className={styles.statsItemCount}>2,596</span>
</a>
<a className={styles.statsItem}>
<span className={styles.statsItemName}>Following</span>
<span className={styles.statsItemCount}>2,596</span>
</a>
<a className={styles.statsItem}>
<span className={styles.statsItemName}>Followers</span>
<span className={styles.statsItemCount}>200</span>
</a>
</div>
<div className={styles.DashboardProfileBio}>
<span>Imagination is its own form of courage</span>
</div>
<div className={styles.DashboardProfileInfo}>
<i className="fa fa-globe"></i><span className="locationText">Bangkok</span>
</div>
<div className={styles.DashboardProfileInfo}>
<i className="fa fa-calendar"></i><span className="">Joined June 2013</span>
</div>
</div>
</div>
</div>
</div>
)
}
}
export default DashboardProfile;
|
var express = require('express');
var http = require('http');
var path = require('path');
var favicon = require('serve-favicon');
var morgan = require('morgan');
var methodOverride = require('method-override');
var bodyParser = require('body-parser');
var errorHandler = require('errorhandler');
require('./logConfig');
var winston = require('winston');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var SessionMapper = require('./data_mappers/SessionMapper');
var csrf = require('csurf');
var helmet = require('helmet');
var passport = require('passport');
var UserMapper = require('./data_mappers/UserMapper');
var LocalStrategy = require('passport-local').Strategy;
var flash = require('connect-flash');
var compression = require('compression');
var expressEnforcesSsl = require('express-enforces-ssl');
var app = express();
app.use(compression());
app.enable('trust proxy');
app.use(helmet());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(require('express-domain-middleware'));
app.use(errorHandler());
var cookie = {
httpOnly: true
};
// development only
if ('development' == app.get('env')) {
console.log('not forcing SSL');
app.locals.pretty = true;
app.use(morgan('dev'));
cookie.secure = false;
} else {
console.log('forcing SSL');
app.use(morgan('combined'));
cookie.secure = true;
app.use(expressEnforcesSsl());
}
// cookies
app.use(cookieParser('UaZpIsmkENYxnv1IH9BBtCDiyYuoGRS7TOTkIlKpbj5hbcYqqoYJh0r0CXARGuaa'));
// sessions
app.use(session({
secret: 'xFQevBVehGuhYI594nKm0OJNAzZoJGzzsJo32Ey5o9rArr',
store: new SessionMapper(),
resave: true,
saveUninitialized: true,
cookie: cookie
}));
// csrf protection
app.use(csrf());
// HSTS
app.use(helmet.hsts({
maxAge: 7776000000,
includeSubdomains: true,
force: true
})); // ninety days
// logins
var userMapper = new UserMapper();
passport.use(new LocalStrategy(function (username, password, callback) {
userMapper.findByLogin(username, password, function (err, user) {
if (err) return callback(null, false, { message: err });
return callback(null, user);
});
}));
passport.serializeUser(function (user, done) { done(null, user.id); });
passport.deserializeUser(userMapper.findById);
// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(express.static(path.join(__dirname, 'public')));
app.use(methodOverride());
app.use(passport.initialize());
app.use(passport.session());
app.use(flash());
// add the config to each request
var ConfigMapper = require('./data_mappers/ConfigMapper');
var configMapper = new ConfigMapper();
app.use(function (req, res, next) {
configMapper.findAll(function (err, config) {
if (err) winston.error('Error getting config: ' + err);
req.config = config;
return next();
});
});
// set a session default kiosk
app.use(function (req, res, next) {
if (req.isAuthenticated()) {
if (!req.session.kioskId) {
var KioskMapper = require('./data_mappers/KioskMapper');
var kioskMapper = new KioskMapper();
kioskMapper.findOne(function (err, kiosk) {
req.session.kioskId = (kiosk) ? kiosk.id : null;
return next();
});
} else {
return next();
}
} else {
return next();
}
});
var setup = require('./routes/setup');
// send to setup page if not already set up
app.use(function (req, res, next) {
setup._isSetup(function (isSetup) {
if ((!isSetup && req.path == '/setup') || (isSetup && req.path != '/setup')) {
return next();
} else {
var redirectUrl = (isSetup) ? '/' : '/setup';
return res.redirect(redirectUrl);
}
});
});
app.get('/setup', setup.get);
app.post('/setup', setup.set);
var auth = require('./routes/auth');
app.get('/login', auth.loginIndex);
app.post('/login',
passport.authenticate('local', { failureRedirect: '/login', failureFlash: true }),
function (req, res) { res.redirect('/'); }
);
app.get('/logout', auth.logout);
var index = require('./routes/index');
app.get('/transactions', ensureAuthenticated, index.transactions);
app.get('/account-info', ensureAuthenticated, index.accountInfo);
app.get('/buy-and-sell', ensureAuthenticated, index.buyAndSell);
var exchange = require('./routes/exchange');
app.get('/exchange/last-prices', ensureAuthenticated, exchange.lastPrices);
app.post('/exchange/buy', ensureAuthenticated, exchange.buy);
app.post('/exchange/sell', ensureAuthenticated, exchange.sell);
app.get('/exchange/latest-transactions', ensureAuthenticated, exchange.latestTransactions);
app.get('/exchange/account-info', ensureAuthenticated, exchange.accountInfo);
app.get('/exchange/user-transactions', ensureAuthenticated, exchange.userTransactions);
var robocoin = require('./routes/robocoin');
app.post('/robocoin/transactions', ensureAuthenticated, robocoin.getTransactions);
app.get('/robocoin/unprocessed-transactions', ensureAuthenticated, robocoin.getUnprocessedTransactions);
app.get('/robocoin/processed-transactions', ensureAuthenticated, robocoin.getProcessedTransactions);
app.get('/robocoin/transaction-hash', ensureAuthenticated, robocoin.getTransactionHash);
app.post('/robocoin/import-transactions', ensureAuthenticated, robocoin.importTransactions);
var dashboard = require('./routes/dashboard');
app.get('/', ensureAuthenticated, dashboard.index);
app.get('/dashboard/summary', ensureAuthenticated, dashboard.summary);
var batchProcess = require('./routes/batch-process');
app.post('/batch-process', ensureAuthenticated, batchProcess.index);
var configuration = require('./routes/configuration');
app.get('/configuration', ensureAuthenticated, configuration.index);
app.post('/configuration/save-exchange', ensureAuthenticated, configuration.saveExchange);
app.post('/configuration/save-robocoin', ensureAuthenticated, configuration.saveRobocoin);
app.post('/configuration/save-currency-conversion', ensureAuthenticated, configuration.saveCurrencyConversion);
app.post('/configuration/toggle-autoconnector', ensureAuthenticated, configuration.toggleAutoconnector);
var logs = require('./routes/logs');
app.get('/logs', ensureAuthenticated, logs.index);
app.use(function (err, req, res, next) {
switch (err.code) {
case 'EBADCSRFTOKEN':
res.status(403);
return res.send('Session expired or form tampered with');
break;
case 'EXCHANGE_NOT_CONFIGURED':
return res.status(500).send(err.message);
break;
default:
winston.error(err);
return res.status(500).send('Woops! We had an unexpected problem.');
}
});
var dbMigrations = require('./services/dbMigrations');
dbMigrations.run(function (err) {
if (err) {
console.error('Error running DB migrations: ' + err);
return process.exit(1);
} else {
console.log('Done running DB migrations. Starting server...');
var server = http.createServer(app).listen(app.get('port'), function() {
console.log('Express server listening on port ' + app.get('port'));
console.log('App environment: ' + app.get('env'));
var jobs = require('./periodicJobs');
configMapper.findAll(function (err, config) {
if (err) winston.error('Error getting config: ' + err);
if (config && config.get(null, 'autoconnectorEnabled') == 1) {
jobs.startInterval();
}
});
require('./archiveLogs');
require('./deleteOldSessions');
});
process.on('SIGINT', function () {
winston.log('Got SIGINT, exiting...');
server.close();
process.exit();
});
process.on('SIGTERM', function () {
winston.log('Got SIGTERM, exiting...');
server.close();
process.exit();
});
}
});
function ensureAuthenticated (req, res, next) {
if (req.isAuthenticated()) return next();
res.redirect('/login');
};
|
/* Detecting Mobile Clients
*
* This is a small snippit of code that allows one to check if the browser
* viewing this page is mobile or not. Not completely working, as Firefox
* on the mac is seen as mobile which it is not.
*
* This function is global to all JS files.
*
*/
// Source
// http:// stackoverflow.com/questions/11381673/javascript-solution-to-detect-mobile-browser
function isMobile(){
// if we want a more complete list use this: http:// detectmobilebrowsers.com/
// str.test() is more efficient than str.match()
// remember str.test is case sensitive
"use strict";
var _isMobile = (/iphone|ipod|android|ie|blackberry|fennec/).test(
navigator.userAgent.toLowerCase());
return false;
// return _isMobile;
}
|
import moment from 'moment';
import React, { Component } from 'react';
import {
View,
ListView,
Text,
StyleSheet,
} from 'react-native';
class ResumoView extends Component {
render() {
let {
totalJogos,
somatorioApostas,
somatorioComissao,
} = this.props;
return (
<View>
<Text style={styles.title} >{this.props.title}</Text>
<View style={styles.row}>
<View style={styles.col}>
<Text>Apostas: R$ {somatorioApostas} ({totalJogos})</Text>
</View>
<View style={styles.col}>
<Text>Comissão: R$ {somatorioComissao}</Text>
</View>
</View>
</View>
);
}
}
class MovimentacaoView extends Component {
render() {
let {
style
} = this.props;
let {
totalJogos,
somatorioApostas,
somatorioComissao,
diario,
dataFechamento,
} = this.props.movimentacao;
let dataResumo = moment(dataFechamento).format('DD/MM')
return (
<View
style={ [styles.container, style] } >
<ResumoView
title={`Resumo total - ${dataResumo}`}
totalJogos={totalJogos}
somatorioApostas={somatorioApostas}
somatorioComissao={somatorioComissao}
/>
<ResumoView
title={'Resumo diario'}
{
...diario
}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
height: 140,
},
row: {
flex: 1,
flexDirection: 'row',
paddingTop: 8,
paddingLeft: 4,
paddingLeft:4,
},
col: {
flex: 1,
},
title: {
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center'
}
});
export default MovimentacaoView
|
// slotgame.js
//
// 競技プログラミング
//
// * @category game
// * @author Yuya Kawai
// * @copyright copyright © 2015 Yuya Kawai. All Rights Reserved.
// * @license http://www.opensource.org/licenses/mit-license.html MIT License
// * @version 1.0
//
// IE10まではconstが非対応のためあえて使わない
//const var REEL_NUM = 3;
//const var IMAGE_NUM = 5;
var REEL_NUM = 3;
var IMAGE_NUM = 5;
var elements = [];
var board = [];
var count = [];
onload = function() {
elements = [document.getElementById("slot_1"), document.getElementById("slot_2"),
document.getElementById("slot_3"), document.getElementById("slot_4"),
document.getElementById("slot_5")];
InitGame();
message.innerHTML="スタートを押してね";
ShowSlot();
}
var InitGame = function() {
for (var i = 0; i < REEL_NUM; i++) {
board[i] = Math.floor(Math.random() * IMAGE_NUM);
}
}
var StopSlot = function(stopLocation) {
count[stopLocation] = 1;
}
var RotationSlot = function() {
for (var i = 0; i < REEL_NUM; i++) {
if (count[i] == 0) {
board[i]++;
}
board[i] %= IMAGE_NUM;
}
if (count[0] == 1 && count[1] == 1 && count[2] == 1) {
CheakSlot();
return;
}
ShowSlot();
setTimeout("RotationSlot()", 100);
}
var StartSlot = function() {
message.innerHTML = "ストップを押して止めてね";
for (i = 0; i < REEL_NUM; i++) {
count[i] = 0;
}
RotationSlot();
}
var ShowSlot = function() {
var showslotElement = document.getElementById("showslot");
while (showslotElement.firstChild) {
showslotElement.removeChild(showslotElement.firstChild);
}
for (var i = 0; i < REEL_NUM; i++) {
var c = elements[board[i]].cloneNode(true); // elementsの中にテンプレートのDOMが入っているのでそれをclone
c.style.left = (i * 100) + "px";
showslotElement.appendChild(c);
}
}
var CheakSlot = function(){
if ((board[0] == board[1]) && (board[1] == board[2])) {
message.innerHTML = "当たりました。やったね!!";
InitGame();
} else {
message.innerHTML = "残念はずれ";
}
}
|
'use strict';
var should = require('should'),
request = require('supertest'),
path = require('path'),
mongoose = require('mongoose'),
User = mongoose.model('User'),
express = require(path.resolve('./config/lib/express'));
/**
* Globals
*/
var app, agent, credentials, user, _user, admin;
/**
* User routes tests
*/
describe('User CRUD tests', function () {
before(function (done) {
// Get application
app = express.init(mongoose);
agent = request.agent(app);
done();
});
beforeEach(function (done) {
// Create user credentials
credentials = {
username: 'username',
password: 'M3@n.jsI$Aw3$0m3'
};
// Create a new user
_user = {
firstName: 'Full',
lastName: 'Name',
displayName: 'Full Name',
email: 'test@test.com',
username: credentials.username,
password: credentials.password,
provider: 'local'
};
user = new User(_user);
// Save a user to the test db and create new article
user.save(function (err) {
should.not.exist(err);
done();
});
});
it('should be able to register a new user', function (done) {
_user.username = 'register_new_user';
_user.email = 'register_new_user_@test.com';
agent.post('/api/auth/signup')
.send(_user)
.expect(200)
.end(function (signupErr, signupRes) {
// Handle signpu error
if (signupErr) {
return done(signupErr);
}
signupRes.body.username.should.equal(_user.username);
signupRes.body.email.should.equal(_user.email);
// Assert a proper profile image has been set, even if by default
signupRes.body.profileImageURL.should.not.be.empty();
// Assert we have just the default 'user' role
signupRes.body.roles.should.be.instanceof(Array).and.have.lengthOf(1);
signupRes.body.roles.indexOf('user').should.equal(0);
return done();
});
});
it('should be able to login successfully and logout successfully', function (done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
// Logout
agent.get('/api/auth/signout')
.expect(302)
.end(function (signoutErr, signoutRes) {
if (signoutErr) {
return done(signoutErr);
}
signoutRes.redirect.should.equal(true);
// NodeJS v4 changed the status code representation so we must check
// before asserting, to be comptabile with all node versions.
if (process.version.indexOf('v4') === 0) {
signoutRes.text.should.equal('Found. Redirecting to /');
} else {
signoutRes.text.should.equal('Moved Temporarily. Redirecting to /');
}
return done();
});
});
});
it('should not be able to retrieve a list of users if not admin', function (done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
// Request list of users
agent.get('/api/users')
.expect(403)
.end(function (usersGetErr, usersGetRes) {
if (usersGetErr) {
return done(usersGetErr);
}
return done();
});
});
});
it('should be able to retrieve a list of users if admin', function (done) {
user.roles = ['user', 'admin'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
// Request list of users
agent.get('/api/users')
.expect(200)
.end(function (usersGetErr, usersGetRes) {
if (usersGetErr) {
return done(usersGetErr);
}
usersGetRes.body.should.be.instanceof(Array).and.have.lengthOf(1);
// Call the assertion callback
return done();
});
});
});
});
it('should be able to get a single user details if admin', function (done) {
user.roles = ['user', 'admin'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
// Get single user information from the database
agent.get('/api/users/' + user._id)
.expect(200)
.end(function (userInfoErr, userInfoRes) {
if (userInfoErr) {
return done(userInfoErr);
}
userInfoRes.body.should.be.instanceof(Object);
userInfoRes.body._id.should.be.equal(String(user._id));
// Call the assertion callback
return done();
});
});
});
});
it('should be able to update a single user details if admin', function (done) {
user.roles = ['user', 'admin'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
// Get single user information from the database
var userUpdate = {
firstName: 'admin_update_first',
lastName: 'admin_update_last',
roles: ['admin']
};
agent.put('/api/users/' + user._id)
.send(userUpdate)
.expect(200)
.end(function (userInfoErr, userInfoRes) {
if (userInfoErr) {
return done(userInfoErr);
}
userInfoRes.body.should.be.instanceof(Object);
userInfoRes.body.firstName.should.be.equal('admin_update_first');
userInfoRes.body.lastName.should.be.equal('admin_update_last');
userInfoRes.body.roles.should.be.instanceof(Array).and.have.lengthOf(1);
userInfoRes.body._id.should.be.equal(String(user._id));
// Call the assertion callback
return done();
});
});
});
});
it('should be able to delete a single user if admin', function (done) {
user.roles = ['user', 'admin'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
agent.delete('/api/users/' + user._id)
//.send(userUpdate)
.expect(200)
.end(function (userInfoErr, userInfoRes) {
if (userInfoErr) {
return done(userInfoErr);
}
userInfoRes.body.should.be.instanceof(Object);
userInfoRes.body._id.should.be.equal(String(user._id));
// Call the assertion callback
return done();
});
});
});
});
it('forgot password should return 400 for non-existent username', function (done) {
user.roles = ['user'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
username: 'some_username_that_doesnt_exist'
})
.expect(400)
.end(function (err, res) {
// Handle error
if (err) {
return done(err);
}
res.body.message.should.equal('No account with that username has been found');
return done();
});
});
});
it('forgot password should return 400 for no username provided', function (done) {
var provider = 'facebook';
user.provider = provider;
user.roles = ['user'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
username: ''
})
.expect(400)
.end(function (err, res) {
// Handle error
if (err) {
return done(err);
}
res.body.message.should.equal('Username field must not be blank');
return done();
});
});
});
it('forgot password should return 400 for non-local provider set for the user object', function (done) {
var provider = 'facebook';
user.provider = provider;
user.roles = ['user'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
username: user.username
})
.expect(400)
.end(function (err, res) {
// Handle error
if (err) {
return done(err);
}
res.body.message.should.equal('It seems like you signed up using your ' + user.provider + ' account');
return done();
});
});
});
it('forgot password should be able to reset password for user password reset request', function (done) {
user.roles = ['user'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
username: user.username
})
.expect(400)
.end(function (err, res) {
// Handle error
if (err) {
return done(err);
}
User.findOne({ username: user.username }, function(err, userRes) {
userRes.resetPasswordToken.should.not.be.empty();
should.exist(userRes.resetPasswordExpires);
res.body.message.should.be.equal('Failure sending email');
return done();
});
});
});
});
it('forgot password should be able to reset the password using reset token', function (done) {
user.roles = ['user'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
username: user.username
})
.expect(400)
.end(function (err, res) {
// Handle error
if (err) {
return done(err);
}
User.findOne({ username: user.username }, function(err, userRes) {
userRes.resetPasswordToken.should.not.be.empty();
should.exist(userRes.resetPasswordExpires);
agent.get('/api/auth/reset/' + userRes.resetPasswordToken)
.expect(302)
.end(function (err, res) {
// Handle error
if (err) {
return done(err);
}
res.headers.location.should.be.equal('/password/reset/' + userRes.resetPasswordToken);
return done();
});
});
});
});
});
it('forgot password should return error when using invalid reset token', function (done) {
user.roles = ['user'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/forgot')
.send({
username: user.username
})
.expect(400)
.end(function (err, res) {
// Handle error
if (err) {
return done(err);
}
var invalidToken = 'someTOKEN1234567890';
agent.get('/api/auth/reset/' + invalidToken)
.expect(302)
.end(function (err, res) {
// Handle error
if (err) {
return done(err);
}
res.headers.location.should.be.equal('/password/reset/invalid');
return done();
});
});
});
});
it('should be able to change user own password successfully', function (done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
// Change password
agent.post('/api/users/password')
.send({
newPassword: '1234567890Aa$',
verifyPassword: '1234567890Aa$',
currentPassword: credentials.password
})
.expect(200)
.end(function (err, res) {
if (err) {
return done(err);
}
res.body.message.should.equal('Password changed successfully');
return done();
});
});
});
it('should not be able to change user own password if wrong verifyPassword is given', function (done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
// Change password
agent.post('/api/users/password')
.send({
newPassword: '1234567890Aa$',
verifyPassword: '1234567890-ABC-123-Aa$',
currentPassword: credentials.password
})
.expect(400)
.end(function (err, res) {
if (err) {
return done(err);
}
res.body.message.should.equal('Passwords do not match');
return done();
});
});
});
it('should not be able to change user own password if wrong currentPassword is given', function (done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
// Change password
agent.post('/api/users/password')
.send({
newPassword: '1234567890Aa$',
verifyPassword: '1234567890Aa$',
currentPassword: 'some_wrong_passwordAa$'
})
.expect(400)
.end(function (err, res) {
if (err) {
return done(err);
}
res.body.message.should.equal('Current password is incorrect');
return done();
});
});
});
it('should not be able to change user own password if no new password is at all given', function (done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
// Change password
agent.post('/api/users/password')
.send({
newPassword: '',
verifyPassword: '',
currentPassword: credentials.password
})
.expect(400)
.end(function (err, res) {
if (err) {
return done(err);
}
res.body.message.should.equal('Please provide a new password');
return done();
});
});
});
it('should not be able to change user own password if no new password is at all given', function (done) {
// Change password
agent.post('/api/users/password')
.send({
newPassword: '1234567890Aa$',
verifyPassword: '1234567890Aa$',
currentPassword: credentials.password
})
.expect(400)
.end(function (err, res) {
if (err) {
return done(err);
}
res.body.message.should.equal('User is not signed in');
return done();
});
});
it('should be able to get own user details successfully', function (done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
// Get own user details
agent.get('/api/users/me')
.expect(200)
.end(function (err, res) {
if (err) {
return done(err);
}
res.body.should.be.instanceof(Object);
res.body.username.should.equal(user.username);
res.body.email.should.equal(user.email);
should.not.exist(res.body.salt);
should.not.exist(res.body.password);
return done();
});
});
});
it('should not be able to get any user details if not logged in', function (done) {
// Get own user details
agent.get('/api/users/me')
.expect(200)
.end(function (err, res) {
if (err) {
return done(err);
}
should.not.exist(res.body);
return done();
});
});
it('should be able to update own user details', function (done) {
user.roles = ['user'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
var userUpdate = {
firstName: 'user_update_first',
lastName: 'user_update_last',
};
agent.put('/api/users')
.send(userUpdate)
.expect(200)
.end(function (userInfoErr, userInfoRes) {
if (userInfoErr) {
return done(userInfoErr);
}
userInfoRes.body.should.be.instanceof(Object);
userInfoRes.body.firstName.should.be.equal('user_update_first');
userInfoRes.body.lastName.should.be.equal('user_update_last');
userInfoRes.body.roles.should.be.instanceof(Array).and.have.lengthOf(1);
userInfoRes.body.roles.indexOf('user').should.equal(0);
userInfoRes.body._id.should.be.equal(String(user._id));
// Call the assertion callback
return done();
});
});
});
});
it('should not be able to update own user details and add roles if not admin', function (done) {
user.roles = ['user'];
user.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
var userUpdate = {
firstName: 'user_update_first',
lastName: 'user_update_last',
roles: ['user', 'admin']
};
agent.put('/api/users')
.send(userUpdate)
.expect(200)
.end(function (userInfoErr, userInfoRes) {
if (userInfoErr) {
return done(userInfoErr);
}
userInfoRes.body.should.be.instanceof(Object);
userInfoRes.body.firstName.should.be.equal('user_update_first');
userInfoRes.body.lastName.should.be.equal('user_update_last');
userInfoRes.body.roles.should.be.instanceof(Array).and.have.lengthOf(1);
userInfoRes.body.roles.indexOf('user').should.equal(0);
userInfoRes.body._id.should.be.equal(String(user._id));
// Call the assertion callback
return done();
});
});
});
});
it('should not be able to update own user details with existing username', function (done) {
var _user2 = _user;
_user2.username = 'user2_username';
_user2.email = 'user2_email@test.com';
var credentials2 = {
username: 'username2',
password: 'M3@n.jsI$Aw3$0m3'
};
_user2.username = credentials2.username;
_user2.password = credentials2.password;
var user2 = new User(_user2);
user2.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/signin')
.send(credentials2)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
var userUpdate = {
firstName: 'user_update_first',
lastName: 'user_update_last',
username: user.username
};
agent.put('/api/users')
.send(userUpdate)
.expect(400)
.end(function (userInfoErr, userInfoRes) {
if (userInfoErr) {
return done(userInfoErr);
}
// Call the assertion callback
userInfoRes.body.message.should.equal('Username already exists');
return done();
});
});
});
});
it('should not be able to update own user details with existing email', function (done) {
var _user2 = _user;
_user2.username = 'user2_username';
_user2.email = 'user2_email@test.com';
var credentials2 = {
username: 'username2',
password: 'M3@n.jsI$Aw3$0m3'
};
_user2.username = credentials2.username;
_user2.password = credentials2.password;
var user2 = new User(_user2);
user2.save(function (err) {
should.not.exist(err);
agent.post('/api/auth/signin')
.send(credentials2)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
var userUpdate = {
firstName: 'user_update_first',
lastName: 'user_update_last',
email: user.email
};
agent.put('/api/users')
.send(userUpdate)
.expect(400)
.end(function (userInfoErr, userInfoRes) {
if (userInfoErr) {
return done(userInfoErr);
}
// Call the assertion callback
userInfoRes.body.message.should.equal('Email already exists');
return done();
});
});
});
});
it('should not be able to update own user details if not logged-in', function (done) {
user.roles = ['user'];
user.save(function (err) {
should.not.exist(err);
var userUpdate = {
firstName: 'user_update_first',
lastName: 'user_update_last',
};
agent.put('/api/users')
.send(userUpdate)
.expect(400)
.end(function (userInfoErr, userInfoRes) {
if (userInfoErr) {
return done(userInfoErr);
}
userInfoRes.body.message.should.equal('User is not signed in');
// Call the assertion callback
return done();
});
});
});
it('should not be able to update own user profile picture without being logged-in', function (done) {
agent.post('/api/users/picture')
.send({})
.expect(400)
.end(function (userInfoErr, userInfoRes) {
if (userInfoErr) {
return done(userInfoErr);
}
userInfoRes.body.message.should.equal('User is not signed in');
// Call the assertion callback
return done();
});
});
it('should be able to change profile picture if signed in', function (done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
agent.post('/api/users/picture')
.attach('newProfilePicture', './modules/users/client/img/profile/default.png')
.send(credentials)
.expect(200)
.end(function (userInfoErr, userInfoRes) {
// Handle change profile picture error
if (userInfoErr) {
return done(userInfoErr);
}
userInfoRes.body.should.be.instanceof(Object);
userInfoRes.body.profileImageURL.should.be.a.String();
userInfoRes.body._id.should.be.equal(String(user._id));
return done();
});
});
});
it('should not be able to change profile picture if attach a picture with a different field name', function (done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function (signinErr, signinRes) {
// Handle signin error
if (signinErr) {
return done(signinErr);
}
agent.post('/api/users/picture')
.attach('fieldThatDoesntWork', './modules/users/client/img/profile/default.png')
.send(credentials)
.expect(400)
.end(function (userInfoErr, userInfoRes) {
done(userInfoErr);
});
});
});
afterEach(function (done) {
User.remove().exec(done);
});
});
|
module.exports = {
description: "",
ns: "react-material-ui",
type: "ReactNode",
dependencies: {
npm: {
"material-ui/svg-icons/hardware/router": require('material-ui/svg-icons/hardware/router')
}
},
name: "HardwareRouter",
ports: {
input: {},
output: {
component: {
title: "HardwareRouter",
type: "Component"
}
}
}
} |
/// <reference path="../build/out/fullcalendar.min.js" />
fc.sourceNormalizers = [];
fc.sourceFetchers = [];
var ajaxDefaults = {
dataType: 'json',
cache: false
};
var eventGUID = 1;
function EventManager(options, _sources) {
var t = this;
// exports
t.isFetchNeeded = isFetchNeeded;
t.fetchEvents = fetchEvents;
t.addEventSource = addEventSource;
t.removeEventSource = removeEventSource;
t.updateEvent = updateEvent;
t.renderEvent = renderEvent;
t.removeEvents = removeEvents;
t.clientEvents = clientEvents;
t.normalizeEvent = normalizeEvent;
// imports
var trigger = t.trigger;
var getView = t.getView;
var reportEvents = t.reportEvents;
// locals
var stickySource = { events: [] };
var sources = [ stickySource ];
var rangeStart, rangeEnd;
var currentFetchID = 0;
var pendingSourceCnt = 0;
var loadingLevel = 0;
var cache = [];
for (var i=0; i<_sources.length; i++) {
_addEventSource(_sources[i]);
}
/* Fetching
-----------------------------------------------------------------------------*/
function isFetchNeeded(start, end) {
return !rangeStart || start < rangeStart || end > rangeEnd;
}
function fetchEvents(start, end) {
rangeStart = start;
rangeEnd = end;
cache = [];
var fetchID = ++currentFetchID;
var len = sources.length;
pendingSourceCnt = len;
for (var i=0; i<len; i++) {
fetchEventSource(sources[i], fetchID);
}
}
function fetchEventSource(source, fetchID) {
_fetchEventSource(source, function(events) {
if (fetchID == currentFetchID) {
if (events) {
if (options.eventDataTransform) {
events = $.map(events, options.eventDataTransform);
}
if (source.eventDataTransform) {
events = $.map(events, source.eventDataTransform);
}
// TODO: this technique is not ideal for static array event sources.
// For arrays, we'll want to process all events right in the beginning, then never again.
for (var i=0; i<events.length; i++) {
events[i].source = source;
normalizeEvent(events[i]);
}
cache = cache.concat(events);
}
pendingSourceCnt--;
if (!pendingSourceCnt) {
reportEvents(cache);
}
}
});
}
function _fetchEventSource(source, callback) {
var i;
var fetchers = fc.sourceFetchers;
var res;
for (i=0; i<fetchers.length; i++) {
res = fetchers[i](source, rangeStart, rangeEnd, callback);
if (res === true) {
// the fetcher is in charge. made its own async request
return;
}
else if (typeof res == 'object') {
// the fetcher returned a new source. process it
_fetchEventSource(res, callback);
return;
}
}
var events = source.events;
if (events) {
if ($.isFunction(events)) {
pushLoading();
events(cloneDate(rangeStart), cloneDate(rangeEnd), function(events) {
callback(events);
popLoading();
});
}
else if ($.isArray(events)) {
callback(events);
}
else {
callback();
}
}else{
var url = source.url;
if (url) {
var success = source.success;
var error = source.error;
var complete = source.complete;
// retrieve any outbound GET/POST $.ajax data from the options
var customData;
if ($.isFunction(source.data)) {
// supplied as a function that returns a key/value object
customData = source.data();
}
else {
// supplied as a straight key/value object
customData = source.data;
}
// use a copy of the custom data so we can modify the parameters
// and not affect the passed-in object.
var data = $.extend({}, customData || {});
var startParam = firstDefined(source.startParam, options.startParam);
var endParam = firstDefined(source.endParam, options.endParam);
if (startParam) {
data[startParam] = Math.round(+rangeStart / 1000);
}
if (endParam) {
data[endParam] = Math.round(+rangeEnd / 1000);
}
pushLoading();
$.ajax($.extend({}, ajaxDefaults, source, {
data: data,
success: function(events) {
events = events || [];
var res = applyAll(success, this, arguments);
if ($.isArray(res)) {
events = res;
}
callback(events);
},
error: function() {
applyAll(error, this, arguments);
callback();
},
complete: function() {
applyAll(complete, this, arguments);
popLoading();
}
}));
}else{
callback();
}
}
}
/* Sources
-----------------------------------------------------------------------------*/
function addEventSource(source) {
source = _addEventSource(source);
if (source) {
pendingSourceCnt++;
fetchEventSource(source, currentFetchID); // will eventually call reportEvents
}
}
function _addEventSource(source) {
if ($.isFunction(source) || $.isArray(source)) {
source = { events: source };
}
else if (typeof source == 'string') {
source = { url: source };
}
if (typeof source == 'object') {
normalizeSource(source);
sources.push(source);
return source;
}
}
function removeEventSource(source) {
sources = $.grep(sources, function(src) {
return !isSourcesEqual(src, source);
});
// remove all client events from that source
cache = $.grep(cache, function(e) {
return !isSourcesEqual(e.source, source);
});
reportEvents(cache);
}
/* Manipulation
-----------------------------------------------------------------------------*/
function updateEvent(event) { // update an existing event
var i, len = cache.length, e,
defaultEventEnd = getView().defaultEventEnd, // getView???
startDelta = event.start - event._start,
endDelta = event.end ?
(event.end - (event._end || defaultEventEnd(event))) // event._end would be null if event.end
: 0; // was null and event was just resized
for (i=0; i<len; i++) {
e = cache[i];
if (e._id == event._id && e != event) {
e.start = new Date(+e.start + startDelta);
if (event.end) {
if (e.end) {
e.end = new Date(+e.end + endDelta);
}else{
e.end = new Date(+defaultEventEnd(e) + endDelta);
}
}else{
e.end = null;
}
e.title = event.title;
e.url = event.url;
e.allDay = event.allDay;
e.className = event.className;
e.editable = event.editable;
e.color = event.color;
e.backgroundColor = event.backgroundColor;
e.borderColor = event.borderColor;
e.textColor = event.textColor;
normalizeEvent(e);
}
}
normalizeEvent(event);
reportEvents(cache);
}
function renderEvent(event, stick) {
normalizeEvent(event);
if (!event.source) {
if (stick) {
stickySource.events.push(event);
event.source = stickySource;
}
cache.push(event);
}
reportEvents(cache);
}
function removeEvents(filter) {
if (!filter) { // remove all
cache = [];
// clear all array sources
for (var i=0; i<sources.length; i++) {
if ($.isArray(sources[i].events)) {
sources[i].events = [];
}
}
}else{
if (!$.isFunction(filter)) { // an event ID
var id = filter + '';
filter = function(e) {
return e._id == id;
};
}
cache = $.grep(cache, filter, true);
// remove events from array sources
for (var i=0; i<sources.length; i++) {
if ($.isArray(sources[i].events)) {
sources[i].events = $.grep(sources[i].events, filter, true);
}
}
}
reportEvents(cache);
}
function clientEvents(filter) {
if ($.isFunction(filter)) {
return $.grep(cache, filter);
}
else if (filter) { // an event ID
filter += '';
return $.grep(cache, function(e) {
return e._id == filter;
});
}
return cache; // else, return all
}
/* Loading State
-----------------------------------------------------------------------------*/
function pushLoading() {
if (!loadingLevel++) {
trigger('loading', null, true);
}
}
function popLoading() {
if (!--loadingLevel) {
trigger('loading', null, false);
}
}
/* Event Normalization
-----------------------------------------------------------------------------*/
function normalizeEvent(event) {
var source = event.source || {};
var ignoreTimezone = firstDefined(source.ignoreTimezone, options.ignoreTimezone);
event._id = event._id || (event.id === undefined ? '_fc' + eventGUID++ : event.id + '');
if (event.date) {
if (!event.start) {
event.start = event.date;
}
delete event.date;
}
event._start = cloneDate(event.start = parseDate(event.start, ignoreTimezone));
event.end = parseDate(event.end, ignoreTimezone);
if (event.end && event.end <= event.start) {
event.end = null;
}
event._end = event.end ? cloneDate(event.end) : null;
if (event.allDay === undefined) {
event.allDay = firstDefined(source.allDayDefault, options.allDayDefault);
}
if (event.className) {
if (typeof event.className == 'string') {
event.className = event.className.split(/\s+/);
}
}else{
event.className = [];
}
if (event.resources) {
if (typeof event.resources == 'string') {
event.resources = event.resources.split(/\s+/);
}
}else{
event.resources = [];
}
// TODO: if there is no start date, return false to indicate an invalid event
}
/* Utils
------------------------------------------------------------------------------*/
function normalizeSource(source) {
if (source.className) {
// TODO: repeat code, same code for event classNames
if (typeof source.className == 'string') {
source.className = source.className.split(/\s+/);
}
}else{
source.className = [];
}
var normalizers = fc.sourceNormalizers;
for (var i=0; i<normalizers.length; i++) {
normalizers[i](source);
}
}
function isSourcesEqual(source1, source2) {
return source1 && source2 && getSourcePrimitive(source1) == getSourcePrimitive(source2);
}
function getSourcePrimitive(source) {
return ((typeof source == 'object') ? (source.events || source.url) : '') || source;
}
}
|
var Container = typeof Buffer !== "undefined" ? Buffer //in node, use buffers
: typeof Int8Array !== "undefined" ? Int8Array //in newer browsers, use webgl int8arrays
: function(l){ var a = new Array(l); for(var i = 0; i < l; i++) a[i]=0; }; //else, do something similar
function BitField(data, opts){
if(!(this instanceof BitField)) {
return new BitField(data, opts);
}
if(arguments.length === 0){
data = 0;
}
this.grow = opts && (isFinite(opts.grow) && getByteSize(opts.grow) || opts.grow) || 0;
if(typeof data === "number" || data === undefined){
data = new Container(getByteSize(data));
if(data.fill) data.fill(0); // clear node buffers of garbage
}
this.buffer = data;
}
function getByteSize(num){
var out = num >> 3;
if(num % 8 !== 0) out++;
return out;
}
BitField.prototype.get = function(i){
var j = i >> 3;
return (j < this.buffer.length) &&
!!(this.buffer[j] & (128 >> (i % 8)));
};
BitField.prototype.set = function(i, b){
var j = i >> 3;
if (b || arguments.length === 1){
if (this.buffer.length < j + 1) this._grow(Math.max(j + 1, Math.min(2 * this.buffer.length, this.grow)));
// Set
this.buffer[j] |= 128 >> (i % 8);
} else if (j < this.buffer.length) {
/// Clear
this.buffer[j] &= ~(128 >> (i % 8));
}
};
BitField.prototype._grow = function(length) {
if (this.buffer.length < length && length <= this.grow) {
var newBuffer = new Container(length);
if (newBuffer.fill) newBuffer.fill(0);
if (this.buffer.copy) this.buffer.copy(newBuffer, 0);
else {
for(var i = 0; i < this.buffer.length; i++) {
newBuffer[i] = this.buffer[i];
}
}
this.buffer = newBuffer;
}
};
if(typeof module !== "undefined") module.exports = BitField;
|
'use strict';
module.exports = function(text) {
return ('\n' + text).replace(/(\r\n|\r|\n)\[[0-9:]{8}\] /g, '\n').slice(1);
};
|
'use strict'
const iftype = require('iftype')
function CustomType(){
}
//----------------------------
// Check if type is 'string'
//----------------------------
iftype(123).is('string') // => false
iftype(function foo(){}).is('string') // => false
iftype(new CustomType()).is('string') // => false
iftype(["foo", "bar"]).is('string') // => false
iftype("bar").is('string') // => true
iftype(null).is('string') // => false
iftype(undefined).is('string') // => false
//----------------------------
// Check if type is 'number'
//----------------------------
iftype(123).is('number') // => true
iftype(function foo(){}).is('number') // => false
iftype(new CustomType()).is('number') // => false
iftype(["foo", "bar"]).is('number') // => false
iftype("bar").is('number') // => false
iftype(null).is('number') // => false
iftype(undefined).is('number') // => false
//----------------------------
// Check if type is 'object'
//----------------------------
iftype(123).is('object') // => false
iftype(function foo(){}).is('object') // => false
iftype(new CustomType()).is('object') // => true
iftype(["foo", "bar"]).is('object') // => true
iftype("bar").is('object') // => false
iftype(null).is('object') // => false
iftype(undefined).is('object') // => false
//----------------------------
// Check if type is 'array'
//----------------------------
iftype(123).is('array') // => false
iftype(function foo(){}).is('array') // => false
iftype(new CustomType()).is('array') // => false
iftype(["foo", "bar"]).is('array') // => true
iftype("bar").is('array') // => false
iftype(null).is('array') // => false
iftype(undefined).is('array') // => false
//----------------------------
// Check if type is 'function'
//----------------------------
iftype(123).is('function') // => false
iftype(function foo(){}).is('function') // => true
iftype(new CustomType()).is('function') // => false
iftype(["foo", "bar"]).is('function') // => false
iftype("bar").is('function') // => false
iftype(null).is('function') // => false
iftype(undefined).is('function') // => false
//----------------------------
// Check if type is CustomType
//----------------------------
iftype(123).is(CustomType) // => false
iftype(function foo(){}).is(CustomType) // => false
iftype(new CustomType()).is(CustomType) // => true
iftype(["foo", "bar"]).is(CustomType) // => false
iftype("bar").is(CustomType) // => false
iftype(null).is(CustomType) // => false
iftype(undefined).is(CustomType) // => false
|
"use strict"
Object.defineProperty(exports, "__esModule", {
value: true,
})
exports.Polygon = undefined
var _defineProperty2 = require("babel-runtime/helpers/defineProperty")
var _defineProperty3 = _interopRequireDefault(_defineProperty2)
var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of")
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf)
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck")
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2)
var _createClass2 = require("babel-runtime/helpers/createClass")
var _createClass3 = _interopRequireDefault(_createClass2)
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn")
var _possibleConstructorReturn3 = _interopRequireDefault(
_possibleConstructorReturn2
)
var _inherits2 = require("babel-runtime/helpers/inherits")
var _inherits3 = _interopRequireDefault(_inherits2)
var _react = require("react")
var _react2 = _interopRequireDefault(_react)
var _propTypes = require("prop-types")
var _propTypes2 = _interopRequireDefault(_propTypes)
var _MapChildHelper = require("../utils/MapChildHelper")
var _constants = require("../constants")
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj }
}
/**
* A wrapper around `google.maps.Polygon`
*
* @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#Polygon
*/
/*
* -----------------------------------------------------------------------------
* This file is auto-generated from the corresponding file at `src/macros/`.
* Please **DO NOT** edit this file directly when creating PRs.
* -----------------------------------------------------------------------------
*/
/* global google */
var Polygon = (exports.Polygon = (function(_React$PureComponent) {
;(0, _inherits3.default)(Polygon, _React$PureComponent)
/*
* @see https://developers.google.com/maps/documentation/javascript/3.exp/reference#Polygon
*/
function Polygon(props, context) {
;(0, _classCallCheck3.default)(this, Polygon)
var _this = (0, _possibleConstructorReturn3.default)(
this,
(Polygon.__proto__ || (0, _getPrototypeOf2.default)(Polygon)).call(
this,
props,
context
)
)
var polygon = new google.maps.Polygon()
;(0, _MapChildHelper.construct)(
Polygon.propTypes,
updaterMap,
_this.props,
polygon
)
polygon.setMap(_this.context[_constants.MAP])
_this.state = (0, _defineProperty3.default)({}, _constants.POLYGON, polygon)
return _this
}
;(0, _createClass3.default)(Polygon, [
{
key: "componentDidMount",
value: function componentDidMount() {
;(0, _MapChildHelper.componentDidMount)(
this,
this.state[_constants.POLYGON],
eventMap
)
},
},
{
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
;(0, _MapChildHelper.componentDidUpdate)(
this,
this.state[_constants.POLYGON],
eventMap,
updaterMap,
prevProps
)
},
},
{
key: "componentWillUnmount",
value: function componentWillUnmount() {
;(0, _MapChildHelper.componentWillUnmount)(this)
var polygon = this.state[_constants.POLYGON]
if (polygon) {
polygon.setMap(null)
}
},
},
{
key: "render",
value: function render() {
return false
},
/**
* Returns whether this shape can be dragged by the user.
* @type boolean
* @public
*/
},
{
key: "getDraggable",
value: function getDraggable() {
return this.state[_constants.POLYGON].getDraggable()
},
/**
* Returns whether this shape can be edited by the user.
* @type boolean
* @public
*/
},
{
key: "getEditable",
value: function getEditable() {
return this.state[_constants.POLYGON].getEditable()
},
/**
* Retrieves the first path.
* @type MVCArray<LatLng>
* @public
*/
},
{
key: "getPath",
value: function getPath() {
return this.state[_constants.POLYGON].getPath()
},
/**
* Retrieves the paths for this polygon.
* @type MVCArray<MVCArray<LatLng>>
* @public
*/
},
{
key: "getPaths",
value: function getPaths() {
return this.state[_constants.POLYGON].getPaths()
},
/**
* Returns whether this poly is visible on the map.
* @type boolean
* @public
*/
},
{
key: "getVisible",
value: function getVisible() {
return this.state[_constants.POLYGON].getVisible()
},
},
])
return Polygon
})(_react2.default.PureComponent))
Polygon.propTypes = {
/**
* @type boolean
*/
defaultDraggable: _propTypes2.default.bool,
/**
* @type boolean
*/
defaultEditable: _propTypes2.default.bool,
/**
* @type PolygonOptions
*/
defaultOptions: _propTypes2.default.any,
/**
* @type MVCArray<LatLng>|Array<LatLng|LatLngLiteral>
*/
defaultPath: _propTypes2.default.any,
/**
* @type MVCArray<MVCArray<LatLng>>|MVCArray<LatLng>|Array<Array<LatLng|LatLngLiteral>>|Array<LatLng|LatLngLiteral>
*/
defaultPaths: _propTypes2.default.any,
/**
* @type boolean
*/
defaultVisible: _propTypes2.default.bool,
/**
* @type boolean
*/
draggable: _propTypes2.default.bool,
/**
* @type boolean
*/
editable: _propTypes2.default.bool,
/**
* @type PolygonOptions
*/
options: _propTypes2.default.any,
/**
* @type MVCArray<LatLng>|Array<LatLng|LatLngLiteral>
*/
path: _propTypes2.default.any,
/**
* @type MVCArray<MVCArray<LatLng>>|MVCArray<LatLng>|Array<Array<LatLng|LatLngLiteral>>|Array<LatLng|LatLngLiteral>
*/
paths: _propTypes2.default.any,
/**
* @type boolean
*/
visible: _propTypes2.default.bool,
/**
* function
*/
onDblClick: _propTypes2.default.func,
/**
* function
*/
onDragEnd: _propTypes2.default.func,
/**
* function
*/
onDragStart: _propTypes2.default.func,
/**
* function
*/
onMouseDown: _propTypes2.default.func,
/**
* function
*/
onMouseMove: _propTypes2.default.func,
/**
* function
*/
onMouseOut: _propTypes2.default.func,
/**
* function
*/
onMouseOver: _propTypes2.default.func,
/**
* function
*/
onMouseUp: _propTypes2.default.func,
/**
* function
*/
onRightClick: _propTypes2.default.func,
/**
* function
*/
onClick: _propTypes2.default.func,
/**
* function
*/
onDrag: _propTypes2.default.func,
}
Polygon.contextTypes = (0, _defineProperty3.default)(
{},
_constants.MAP,
_propTypes2.default.object
)
exports.default = Polygon
var eventMap = {
onDblClick: "dblclick",
onDragEnd: "dragend",
onDragStart: "dragstart",
onMouseDown: "mousedown",
onMouseMove: "mousemove",
onMouseOut: "mouseout",
onMouseOver: "mouseover",
onMouseUp: "mouseup",
onRightClick: "rightclick",
onClick: "click",
onDrag: "drag",
}
var updaterMap = {
draggable: function draggable(instance, _draggable) {
instance.setDraggable(_draggable)
},
editable: function editable(instance, _editable) {
instance.setEditable(_editable)
},
options: function options(instance, _options) {
instance.setOptions(_options)
},
path: function path(instance, _path) {
instance.setPath(_path)
},
paths: function paths(instance, _paths) {
instance.setPaths(_paths)
},
visible: function visible(instance, _visible) {
instance.setVisible(_visible)
},
}
|
ph.module(
'playhouse.input'
)
.defines(function()
{
ph.KEY =
{
MOUSE1 : -1,
MOUSE2 : -3,
MWHEEL_UP : -4,
MWHEEL_DOWN : -5,
BACKSPACE : 8,
TAB : 9,
ENTER : 13,
PAUSE : 19,
CAPS : 20,
ESC : 27,
SPACE : 32,
PAGE_UP : 33,
PAGE_DOWN : 34,
END : 35,
HOME : 36,
LEFT_ARROW : 37,
UP_ARROW : 38,
RIGHT_ARROW : 39,
DOWN_ARROW : 40,
INSERT : 45,
DELETE : 46,
_0 : 48,
_1 : 49,
_2 : 50,
_3 : 51,
_4 : 52,
_5 : 53,
_6 : 54,
_7 : 55,
_8 : 56,
_9 : 57,
A : 65,
B : 66,
C : 67,
D : 68,
E : 69,
F : 70,
G : 71,
H : 72,
I : 73,
J : 74,
K : 75,
L : 76,
M : 77,
N : 78,
O : 79,
P : 80,
Q : 81,
R : 82,
S : 83,
T : 84,
U : 85,
V : 86,
W : 87,
X : 88,
Y : 89,
Z : 90,
NUMPAD_0 : 96,
NUMPAD_1 : 97,
NUMPAD_2 : 98,
NUMPAD_3 : 99,
NUMPAD_4 : 100,
NUMPAD_5 : 101,
NUMPAD_6 : 102,
NUMPAD_7 : 103,
NUMPAD_8 : 104,
NUMPAD_9 : 105,
MULTIPLY : 106,
ADD : 107,
SUBSTRACT : 109,
DECIMAL : 110,
DIVIDE : 111,
F1 : 112,
F2 : 113,
F3 : 114,
F4 : 115,
F5 : 116,
F6 : 117,
F7 : 118,
F8 : 119,
F9 : 120,
F10 : 121,
F11 : 122,
F12 : 123,
SHIFT : 16,
CTRL : 17,
ALT : 18,
PLUS : 187,
COMMA : 188,
MINUS : 189,
PERIOD : 190
};
ph.Input = ph.Class.extend(
{
bindings : {},
actions : {},
presses : {},
locks : {},
delayedKeyup : {},
isUsingMouse : false,
isUsingKeyboard : false,
isUsingAccelerometer : false,
mouse : { x : 0, y : 0 },
accel : { x : 0, y : 0, z : 0 },
touch : {},
touchCount : 0,
staticInit : function()
{
return ph.input || null;
},
init : function(stage)
{
ph.input = this;
this.initMouse(stage);
this.initKeyboard();
this.initAccelerometer();
},
initMouse : function(stage)
{
if ( this.isUsingMouse )
return;
this.isUsingMouse = true;
var mouseWheelBound = this.mousemove.bind(this);
document.addEventListener('mousewheel', mouseWheelBound, false);
document.addEventListener('DOMMouseScroll', mouseWheelBound, false);
if ( stage )
{
stage.on('stagemousedown', this.keydown.bind(this));
stage.on('stagemouseup', this.keyup.bind(this));
stage.on('stagemousemove', this.mousemove.bind(this));
}
},
initKeyboard : function()
{
if ( this.isUsingKeyboard )
return;
this.isUsingKeyboard = true;
window.addEventListener('keydown', this.keydown.bind(this), false);
window.addEventListener('keyup', this.keyup.bind(this), false);
window.addEventListener('blur', this.keysreset.bind(this), false);
},
initAccelerometer : function()
{
if ( this.isUsingAccelerometer )
return;
window.addEventListener('devicemotion', this.devicemotion.bind(this), false);
},
mousewheel : function(event)
{
var delta = event.wheelDelta ? event.wheelDelta : (event.detail * -1),
code = delta > 0 ? ph.KEY.MWHEEL_UP : ph.KEY.MWHEEL_DOWN,
action = this.bindings[code];
if ( action )
{
this.actions[action] = true;
this.presses[action] = true;
this.delayedKeyup[action] = true;
event.stopPropagation();
event.preventDefault();
}
},
mousemove : function(event)
{
var scale = ph.system.scale,
x = event.stageX * scale,
y = event.stageY * scale,
pId = event.pointerID;
this.mouse.x = x;
this.mouse.y = y;
if ( pId > 0 )
{
if ( !this.touch[pId] )
this.touch[pId] = { x : x, y : y };
if ( event.type == 'stagemousedown' )
this.touchCount++;
else if ( event.type == 'stagemouseup' )
{
delete this.touch[pId];
this.touchCount--;
}
else
{
this.touch[pId].x = x;
this.touch[pId].y = y;
}
}
},
keydown : function(event)
{
var tag = event.target.tagName;
if ( tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' )
return;
var code = event.type == 'keydown' ? event.keyCode : (event.button == 2 ? ph.KEY.MOUSE2 : ph.KEY.MOUSE1);
if ( event instanceof createjs.MouseEvent )
this.mousemove(event);
var action = this.bindings[code];
if ( action )
{
this.actions[action] = true;
if ( !this.locks[action] )
{
this.presses[action] = true;
this.locks[action] = true;
}
if ( code > 0 )
{
event.stopPropagation();
event.preventDefault();
}
}
},
keyup : function(event)
{
var tag = event.target.tagName;
if ( tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' )
return;
var code = event.type == 'keyup' ? event.keyCode : (event.button == 2 ? ph.KEY.MOUSE2 : ph.KEY.MOUSE1);
if ( event instanceof createjs.MouseEvent )
this.mousemove(event);
var action = this.bindings[code];
if ( action )
{
this.delayedKeyup[action] = true;
event.stopPropagation();
event.preventDefault();
}
},
keysreset : function()
{
for ( var action in this.delayedKeyup )
{
this.actions[action] = false;
delete this.delayedKeyup[action];
}
},
devicemotion : function(event)
{
this.accel = event.accelerationIncludingGravity
},
bind : function(key, action)
{
if ( key > 0 )
this.initKeyboard();
this.bindings[key] = action || key + '';
},
unbind : function(key)
{
var action = this.bindings[key];
this.delayedKeyup[action] = true;
this.bindings[key] = null;
},
unbindAll : function()
{
this.bindings = {};
this.actions = {};
this.presses = {};
this.delayedKeyup = {};
},
state : function(action)
{
return this.actions[action]
},
pressed : function(action)
{
return this.presses[action]
},
released : function(action)
{
return !!this.delayedKeyup[action]
},
clearPressed : function()
{
var action;
for ( action in this.delayedKeyup )
{
this.actions[action] = false;
this.locks[action] = false;
delete this.delayedKeyup[action];
}
for ( action in this.presses )
delete this.presses[action];
}
})
}); |
import React, { Component } from 'react'
import ReferralForm from './ReferralForm'
import getStatusIcon from './StatusIcon'
import { Card,
CardHeader,
CardText,
Paper } from 'material-ui'
const style = {
referralOptions :{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
},
uploadButton :{
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
},
card :{
marginBottom : 15
},
cardActions :{
textAlign: 'right'
},
paperStyle: {
// width: 300,
margin: 'auto',
padding: 20,
},
switchStyle: {
marginBottom: 16,
},
submitStyle: {
marginTop: 32,
},
chip: {
margin: 4,
},
wrapper: {
display: 'flex',
flexWrap: 'wrap',
},
}
class ReferralCard extends Component {
constructor(props) {
super(props)
this.enableButton = this.enableButton.bind(this)
this.disableButton = this.disableButton.bind(this)
this.submitForm = this.submitForm.bind(this)
this.notifyFormError = this.notifyFormError.bind(this)
this.handleExpandChange = this.handleExpandChange.bind(this)
this.handleToggle = this.handleToggle.bind(this)
this.handleExpand = this.handleExpand.bind(this)
this.handleReduce = this.handleReduce.bind(this)
this.state = {
expanded: false,
canSubmit: true
}
}
disableButton = () => {
this.setState({canSubmit: false})
}
enableButton = () => {
this.setState({canSubmit: true})
}
submitForm = (data) => {
alert(JSON.stringify(data,null,4))
}
notifyFormError = (data) => {
console.error('Form error:', data)
}
handleExpandChange = (expanded) => {
this.setState({expanded: expanded})
}
handleToggle = (event, toggle) => {
this.setState({expanded: toggle})
}
handleExpand = () => {
this.setState({expanded: true})
}
handleReduce = () => {
this.setState({expanded: false})
}
render(){
const patientName = ( this.props.action === "new" ) ? "Expand to add new referral" :
this.props.referral.patientSurname + ' ,' +
this.props.referral.patientgivenName +
' (' + this.props.referral.patientGender + ')'
const dateOfBirth = ( this.props.action === "new" ) ? "" :
this.props.referral.dateOfBirth
const avatar = ( this.props.action === "new" ) ?
getStatusIcon('pending') : getStatusIcon(this.props.referral.referralStatus)
return(
<Card
expanded={this.props.action === "new" ? true : this.state.expanded}
onExpandChange={this.handleExpandChange}
style={style.card}>
<CardHeader
title={patientName}
subtitle={dateOfBirth}
avatar={avatar}
actAsExpander={true}
showExpandableButton={true}
>
</CardHeader>
<CardText expandable={true}>
<Paper style={style.paperStyle}>
<ReferralForm
index={this.props.index}
referral={this.props.referral}
_updateReferral={this.props._updateReferral}
_addReferral={this.props._addReferral}
_toggleShowNewReferralForm={this.props._toggleShowNewReferralForm}
action={this.props.action}
role={this.props.role}
/>
</Paper>
</CardText>
</Card>
)
}
}
export default ReferralCard
|
/*
* The MIT License
*
* Copyright 2014 Timo Behrmann, Guillaume Chauvet.
*
* 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.
*/
var should = require('should');
var _ = require('lodash');
var index = require('../../lib/index');
var test = function (validatorName, validatorValue, correctValue, incorrectValue) {
var validationReq = { query: {} };
var validationModel = { queries: { myParameter: { isRequired: true } } };
var options = { errorsAsArray: true };
validationModel.queries.myParameter[validatorName] = validatorValue;
//check MISSING validation
var checkMissing = index.validation.process(validationModel, validationReq, options);
checkMissing.length.should.equal(1);
checkMissing[0].type.should.equal('MISSING');
// check VALID validation
if (!_.isArray(correctValue)) {
correctValue = [correctValue];
}
_.each(correctValue, function(value) {
validationReq.query.myParameter = value;
var checkValid = index.validation.process(validationModel, validationReq, options);
checkValid.length.should.equal(0);
});
// check INVALID validation
if (!_.isArray(incorrectValue)) {
incorrectValue = [incorrectValue];
}
_.each(incorrectValue, function(value) {
validationReq.query.myParameter = value;
var checkInvalid = index.validation.process(validationModel, validationReq, options);
checkInvalid.length.should.equal(1);
checkInvalid[0].type.should.equal('INVALID');
});
};
describe('Validators', function () {
it('node-validator isEmail', function () {
test('isEmail', true, 'test@email.de', 'asdfasdf.de');
});
it('node-validator isUrl', function () {
test('isUrl', true, 'http://www.google.de', 'asdfasdf');
});
it('node-validator isIP', function () {
test('isIP', true, '127.0.0.1', 'asdf');
});
it('node-validator isIPv4', function () {
test('isIPv4', true, '127.0.0.1', 'asdf');
});
it('node-validator isIPv6', function () {
test('isIPv6', true, '2001:0db8:85a3:08d3:1319:8a2e:0370:7344', 'asdf');
});
it('node-validator isAlpha', function () {
test('isAlpha', true, 'abc', 'a1');
});
it('node-validator isAlphanumeric', function () {
test('isAlphanumeric', true, 'a1', 'a1!');
});
it('node-validator isNumeric', function () {
test('isNumeric', true, '1', 'asd');
});
it('node-validator isHexadecimal', function () {
test('isHexadecimal', true, 'df', 'w');
});
it('node-validator isHexColor', function () {
test('isHexColor', true, ['#000000', 'ffffff'], '#aaaaaaaasdf');
});
it('node-validator isBoolean', function () {
test('isBoolean', true, 'false', '0');
test('isBoolean', true, 'true', '1');
});
it('node-validator isInt', function () {
test('isInt', true, '123', 'a1');
});
it('node-validator isNatural', function () {
test('isNatural', true, '123', 'a1');
test('isNatural', true, '123', '-123');
});
it('node-validator isLowercase', function () {
test('isLowercase', true, 'abc', 'aBc');
});
it('node-validator isUppercase', function () {
test('isUppercase', true, 'ABC', 'ABc');
});
it('node-validator isDecimal', function () {
test('isDecimal', true, '0.5', '0,5');
});
it('node-validator isFloat', function () {
test('isFloat', true, '0.5', '0,5');
});
it('node-validator equals', function () {
test('equals', 'foobar', 'foobar', 'foobar2');
});
it('node-validator contains', function () {
test('contains', 'foo', 'foobar', 'bar');
});
it('node-validator notContains', function () {
test('notContains', 'bar', 'foo', 'barbar');
});
it('node-validator is', function () {
test('is', /^abc$/, 'abc', 'aac');
});
it('node-validator regexp', function () {
test('regex', /^abc$/, 'abc', 'aac');
});
it('node-validator notRegex', function () {
test('notRegex', /^abc$/, 'acc', 'abc');
});
it('node-validator not', function () {
test('not', /^abc$/, 'acc', 'abc');
});
it('node-validator isIn', function () {
test('isIn', ['a','bc'], ['a','bc'], 'c');
});
it('node-validator notIn', function () {
test('notIn', ['a','bc'], 'c', ['a','bc']);
});
it('node-validator max', function () {
test('max', 5, [1,'2',5], [6,'7']);
});
it('node-validator min', function () {
test('min', 5, [5, 6,'7'], [1,'2']);
});
it('node-validator isCreditCard', function () {
test('isCreditCard', true, [], 'adua8suzd8azs7dadsdad');
});
it('node-validator isUUID', function () {
test('isUUID', true, 'A987FBC9-4BED-3078-CF07-9141BA07C9F3', 'abc');
});
it('node-validator isUUIDv3', function () {
test('isUUIDv3', true, '987FBC97-4BED-3078-AF07-9141BA07C9F3', 'abc');
});
it('node-validator isUUIDv4', function () {
test('isUUIDv4', true, '713ae7e3-cb32-45f9-adcb-7c4fa86b90c1', 'abc');
});
it('node-validator isUUIDv5', function () {
test('isUUIDv5', true, '987FBC97-4BED-5078-AF07-9141BA07C9F3', 'abc');
});
it('node-validator isDate', function () {
test('isDate', true, '2011-08-04', '20110804');
});
it('node-validator isBefore', function () {
test('isBefore', '2011-08-04', '2011-08-03', '2011-08-04');
});
it('node-validator isAfter', function () {
test('isAfter', '2011-08-04', '2011-08-05', '2011-08-04');
});
it('node-validator arrays', function() {
test('isInt', true, '123', [['456', '0.123']]);
});
});
|
var app=angular.module('dashBoardApp')
app.factory('SessionService', ['$http', function($http) {
var loadSessionData = function() {
return $http.get("/session/");
};
return {
loadSessionData: function() {
return loadSessionData();
}
};
}]); |
import React from 'react';
import { Link } from 'react-router';
import Filter from './Filter';
import Helmet from 'react-helmet';
const Filters = React.createClass({
render() {
return (
<div className="monster-filters row col-sm-12">
<Helmet
title={ 'Monster Manager: Encounter Management Tools for GMs' }
meta={[
{name: "description", content: 'An interactive Dungeons and Dragons 5e Monster Manual featuring over 300 monsters from the D&D System Resource Documents (SRD).' },
{property: 'og:title', content: 'Monster Manager: Encounter Management Tools for GMs'},
]} />
<Filter {...this.props} value={this.props.filters.challenge_rating_min} key="challenge_rating_min" id="challenge_rating_min" filter="challenge_rating" label="Challenge Rating - Min"/>
<Filter {...this.props} value={this.props.filters.challenge_rating_max} key="challenge_rating_max" id="challenge_rating_max" filter="challenge_rating" label="Challenge Rating - Max"/>
<Filter {...this.props} value={this.props.filters.type} key="type" id="type" filter="type" label="Type"/>
<Filter {...this.props} value={this.props.filters.size} key="size" id="size" filter="size" label="Size"/>
<Filter {...this.props} value={this.props.filters.alignment} key="alignment" id="alignment" filter="alignment" label="Alignment"/>
<Filter {...this.props} value={this.props.filters.search} key="search" id="search" filter="search" label="Search"/>
</div>
)
}
});
export default Filters;
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path d="M5 5v14h14V5H5zm11 9h-4v3l-5-5 5-5v3h4v4z" opacity=".3" /><path d="M12 7l-5 5 5 5v-3h4v-4h-4zm7-4h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-.14 0-.27.01-.4.04-.39.08-.74.28-1.01.55-.18.18-.33.4-.43.64S3 4.72 3 5v14c0 .27.06.54.16.78s.25.45.43.64c.27.27.62.47 1.01.55.13.02.26.03.4.03h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7-.25c.41 0 .75.34.75.75s-.34.75-.75.75-.75-.34-.75-.75.34-.75.75-.75zM19 19H5V5h14v14z" /></React.Fragment>
, 'AssignmentReturnTwoTone');
|
// Generated by IcedCoffeeScript 1.8.0-a
(function() {
module.exports = function(arg) {
return ('' + arg).replace(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/gm, '\\').replace(/\n/g, "'\n'").replace(/^$/, "''");
};
}).call(this);
|
/*!
* Vue.js v2.4.2
* (c) 2014-2018 Evan You
* Released under the MIT License.
*/
/* */
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
function isUndef (v) {
return v === undefined || v === null
}
function isDef (v) {
return v !== undefined && v !== null
}
function isTrue (v) {
return v === true
}
function isFalse (v) {
return v === false
}
/**
* Check if value is primitive
*/
function isPrimitive (value) {
return (
typeof value === 'string' ||
typeof value === 'number' ||
typeof value === 'boolean'
)
}
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*/
function isObject (obj) {
return obj !== null && typeof obj === 'object'
}
var _toString = Object.prototype.toString;
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*/
function isPlainObject (obj) {
return _toString.call(obj) === '[object Object]'
}
function isRegExp (v) {
return _toString.call(v) === '[object RegExp]'
}
/**
* Check if val is a valid array index.
*/
function isValidArrayIndex (val) {
var n = parseFloat(val);
return n >= 0 && Math.floor(n) === n && isFinite(val)
}
/**
* Convert a value to a string that is actually rendered.
*/
function toString (val) {
return val == null
? ''
: typeof val === 'object'
? JSON.stringify(val, null, 2)
: String(val)
}
/**
* Convert a input value to a number for persistence.
* If the conversion fails, return original string.
*/
function toNumber (val) {
var n = parseFloat(val);
return isNaN(n) ? val : n
}
/**
* Make a map and return a function for checking if a key
* is in that map.
*/
function makeMap (
str,
expectsLowerCase
) {
var map = Object.create(null);
var list = str.split(',');
for (var i = 0; i < list.length; i++) {
map[list[i]] = true;
}
return expectsLowerCase
? function (val) { return map[val.toLowerCase()]; }
: function (val) { return map[val]; }
}
/**
* Check if a tag is a built-in tag.
*/
var isBuiltInTag = makeMap('slot,component', true);
/**
* Check if a attribute is a reserved attribute.
*/
var isReservedAttribute = makeMap('key,ref,slot,is');
/**
* Remove an item from an array
*/
function remove (arr, item) {
if (arr.length) {
var index = arr.indexOf(item);
if (index > -1) {
return arr.splice(index, 1)
}
}
}
/**
* Check whether the object has the property.
*/
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn (obj, key) {
return hasOwnProperty.call(obj, key)
}
/**
* Create a cached version of a pure function.
*/
function cached (fn) {
var cache = Object.create(null);
return (function cachedFn (str) {
var hit = cache[str];
return hit || (cache[str] = fn(str))
})
}
/**
* Camelize a hyphen-delimited string.
*/
var camelizeRE = /-(\w)/g;
var camelize = cached(function (str) {
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
});
/**
* Capitalize a string.
*/
var capitalize = cached(function (str) {
return str.charAt(0).toUpperCase() + str.slice(1)
});
/**
* Hyphenate a camelCase string.
*/
var hyphenateRE = /([^-])([A-Z])/g;
var hyphenate = cached(function (str) {
return str
.replace(hyphenateRE, '$1-$2')
.replace(hyphenateRE, '$1-$2')
.toLowerCase()
});
/**
* Simple bind, faster than native
*/
function bind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
// record original fn length
boundFn._length = fn.length;
return boundFn
}
/**
* Convert an Array-like object to a real Array.
*/
function toArray (list, start) {
start = start || 0;
var i = list.length - start;
var ret = new Array(i);
while (i--) {
ret[i] = list[i + start];
}
return ret
}
/**
* Mix properties into target object.
*/
function extend (to, _from) {
for (var key in _from) {
to[key] = _from[key];
}
return to
}
/**
* Merge an Array of Objects into a single Object.
*/
function toObject (arr) {
var res = {};
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res
}
/**
* Perform no operation.
* Stubbing args to make Flow happy without leaving useless transpiled code
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
*/
function noop (a, b, c) {}
/**
* Always return false.
*/
var no = function (a, b, c) { return false; };
/**
* Return same value
*/
var identity = function (_) { return _; };
/**
* Generate a static keys string from compiler modules.
*/
/**
* Check if two values are loosely equal - that is,
* if they are plain objects, do they have the same shape?
*/
function looseEqual (a, b) {
if (a === b) { return true }
var isObjectA = isObject(a);
var isObjectB = isObject(b);
if (isObjectA && isObjectB) {
try {
var isArrayA = Array.isArray(a);
var isArrayB = Array.isArray(b);
if (isArrayA && isArrayB) {
return a.length === b.length && a.every(function (e, i) {
return looseEqual(e, b[i])
})
} else if (!isArrayA && !isArrayB) {
var keysA = Object.keys(a);
var keysB = Object.keys(b);
return keysA.length === keysB.length && keysA.every(function (key) {
return looseEqual(a[key], b[key])
})
} else {
/* istanbul ignore next */
return false
}
} catch (e) {
/* istanbul ignore next */
return false
}
} else if (!isObjectA && !isObjectB) {
return String(a) === String(b)
} else {
return false
}
}
function looseIndexOf (arr, val) {
for (var i = 0; i < arr.length; i++) {
if (looseEqual(arr[i], val)) { return i }
}
return -1
}
/**
* Ensure a function is called only once.
*/
function once (fn) {
var called = false;
return function () {
if (!called) {
called = true;
fn.apply(this, arguments);
}
}
}
var SSR_ATTR = 'data-server-rendered';
var ASSET_TYPES = [
'component',
'directive',
'filter'
];
var LIFECYCLE_HOOKS = [
'beforeCreate',
'created',
'beforeMount',
'mounted',
'beforeUpdate',
'updated',
'beforeDestroy',
'destroyed',
'activated',
'deactivated'
];
/* */
var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
optionMergeStrategies: Object.create(null),
/**
* Whether to suppress warnings.
*/
silent: false,
/**
* Show production mode tip message on boot?
*/
productionTip: process.env.NODE_ENV !== 'production',
/**
* Whether to enable devtools
*/
devtools: process.env.NODE_ENV !== 'production',
/**
* Whether to record perf
*/
performance: false,
/**
* Error handler for watcher errors
*/
errorHandler: null,
/**
* Warn handler for watcher warns
*/
warnHandler: null,
/**
* Ignore certain custom elements
*/
ignoredElements: [],
/**
* Custom user key aliases for v-on
*/
keyCodes: Object.create(null),
/**
* Check if a tag is reserved so that it cannot be registered as a
* component. This is platform-dependent and may be overwritten.
*/
isReservedTag: no,
/**
* Check if an attribute is reserved so that it cannot be used as a component
* prop. This is platform-dependent and may be overwritten.
*/
isReservedAttr: no,
/**
* Check if a tag is an unknown element.
* Platform-dependent.
*/
isUnknownElement: no,
/**
* Get the namespace of an element
*/
getTagNamespace: noop,
/**
* Parse the real tag name for the specific platform.
*/
parsePlatformTagName: identity,
/**
* Check if an attribute must be bound using property, e.g. value
* Platform-dependent.
*/
mustUseProp: no,
/**
* Exposed for legacy reasons
*/
_lifecycleHooks: LIFECYCLE_HOOKS
});
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
function isReserved (str) {
var c = (str + '').charCodeAt(0);
return c === 0x24 || c === 0x5F
}
/**
* Define a property.
*/
function def (obj, key, val, enumerable) {
Object.defineProperty(obj, key, {
value: val,
enumerable: !!enumerable,
writable: true,
configurable: true
});
}
/**
* Parse simple path.
*/
var bailRE = /[^\w.$]/;
function parsePath (path) {
if (bailRE.test(path)) {
return
}
var segments = path.split('.');
return function (obj) {
for (var i = 0; i < segments.length; i++) {
if (!obj) { return }
obj = obj[segments[i]];
}
return obj
}
}
/* */
var warn = noop;
var tip = noop;
var formatComponentName = (null); // work around flow check
if (process.env.NODE_ENV !== 'production') {
var hasConsole = typeof console !== 'undefined';
var classifyRE = /(?:^|[-_])(\w)/g;
var classify = function (str) { return str
.replace(classifyRE, function (c) { return c.toUpperCase(); })
.replace(/[-_]/g, ''); };
warn = function (msg, vm) {
var trace = vm ? generateComponentTrace(vm) : '';
if (config.warnHandler) {
config.warnHandler.call(null, msg, vm, trace);
} else if (hasConsole && (!config.silent)) {
console.error(("[Vue warn]: " + msg + trace));
}
};
tip = function (msg, vm) {
if (hasConsole && (!config.silent)) {
console.warn("[Vue tip]: " + msg + (
vm ? generateComponentTrace(vm) : ''
));
}
};
formatComponentName = function (vm, includeFile) {
if (vm.$root === vm) {
return '<Root>'
}
var name = typeof vm === 'string'
? vm
: typeof vm === 'function' && vm.options
? vm.options.name
: vm._isVue
? vm.$options.name || vm.$options._componentTag
: vm.name;
var file = vm._isVue && vm.$options.__file;
if (!name && file) {
var match = file.match(/([^/\\]+)\.vue$/);
name = match && match[1];
}
return (
(name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
(file && includeFile !== false ? (" at " + file) : '')
)
};
var repeat = function (str, n) {
var res = '';
while (n) {
if (n % 2 === 1) { res += str; }
if (n > 1) { str += str; }
n >>= 1;
}
return res
};
var generateComponentTrace = function (vm) {
if (vm._isVue && vm.$parent) {
var tree = [];
var currentRecursiveSequence = 0;
while (vm) {
if (tree.length > 0) {
var last = tree[tree.length - 1];
if (last.constructor === vm.constructor) {
currentRecursiveSequence++;
vm = vm.$parent;
continue
} else if (currentRecursiveSequence > 0) {
tree[tree.length - 1] = [last, currentRecursiveSequence];
currentRecursiveSequence = 0;
}
}
tree.push(vm);
vm = vm.$parent;
}
return '\n\nfound in\n\n' + tree
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
: formatComponentName(vm))); })
.join('\n')
} else {
return ("\n\n(found in " + (formatComponentName(vm)) + ")")
}
};
}
/* */
function handleError (err, vm, info) {
if (config.errorHandler) {
config.errorHandler.call(null, err, vm, info);
} else {
if (process.env.NODE_ENV !== 'production') {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
}
}
}
/* */
/* globals MutationObserver */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefix has a "watch" function on Object.prototype...
var nativeWatch = ({}).watch;
var supportsPassive = false;
if (inBrowser) {
try {
var opts = {};
Object.defineProperty(opts, 'passive', ({
get: function get () {
/* istanbul ignore next */
supportsPassive = true;
}
})); // https://github.com/facebook/flow/issues/285
window.addEventListener('test-passive', null, opts);
} catch (e) {}
}
// this needs to be lazy-evaled because vue may be required before
// vue-server-renderer can set VUE_ENV
var _isServer;
var isServerRendering = function () {
if (_isServer === undefined) {
/* istanbul ignore if */
if (!inBrowser && typeof global !== 'undefined') {
// detect presence of vue-server-renderer and avoid
// Webpack shimming the process
_isServer = global['process'].env.VUE_ENV === 'server';
} else {
_isServer = false;
}
}
return _isServer
};
// detect devtools
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
/* istanbul ignore next */
function isNative (Ctor) {
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
}
var hasSymbol =
typeof Symbol !== 'undefined' && isNative(Symbol) &&
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
/**
* Defer a task to execute it asynchronously.
*/
var nextTick = (function () {
var callbacks = [];
var pending = false;
var timerFunc;
function nextTickHandler () {
pending = false;
var copies = callbacks.slice(0);
callbacks.length = 0;
for (var i = 0; i < copies.length; i++) {
copies[i]();
}
}
// Lynx Modify
// the nextTick behavior leverages the microtask queue, which can be accessed
// via either native Promise.then or MutationObserver.
// MutationObserver has wider support, however it is seriously bugged in
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
// completely stops working after triggering a few times... so, if native
// Promise is available, we will use it:
/* istanbul ignore if */
// if (typeof Promise !== 'undefined' && isNative(Promise)) {
// var p = Promise.resolve()
// var logError = err => { console.error(err) }
// timerFunc = () => {
// p.then(nextTickHandler).catch(logError)
// // in problematic UIWebViews, Promise.then doesn't completely break, but
// // it can get stuck in a weird state where callbacks are pushed into the
// // microtask queue but the queue isn't being flushed, until the browser
// // needs to do some other work, e.g. handle a timer. Therefore we can
// // "force" the microtask queue to be flushed by adding an empty timer.
// if (isIOS) setTimeout(noop)
// }
// } else if (typeof MutationObserver !== 'undefined' && (
// isNative(MutationObserver) ||
// // PhantomJS and iOS 7.x
// MutationObserver.toString() === '[object MutationObserverConstructor]'
// )) {
// // use MutationObserver where native Promise is not available,
// // e.g. PhantomJS IE11, iOS7, Android 4.4
// var counter = 1
// var observer = new MutationObserver(nextTickHandler)
// var textNode = document.createTextNode(String(counter))
// observer.observe(textNode, {
// characterData: true
// })
// timerFunc = () => {
// counter = (counter + 1) % 2
// textNode.data = String(counter)
// }
// } else {
// // fallback to setTimeout
// /* istanbul ignore next */
// timerFunc = () => {
// setTimeout(nextTickHandler, 0)
// }
// }
timerFunc = function () {
setTimeout(nextTickHandler, 0);
};
return function queueNextTick (cb, ctx) {
var _resolve;
callbacks.push(function () {
if (cb) {
try {
cb.call(ctx);
} catch (e) {
handleError(e, ctx, 'nextTick');
}
} else if (_resolve) {
_resolve(ctx);
}
});
if (!pending) {
pending = true;
timerFunc();
}
if (!cb && typeof Promise !== 'undefined') {
return new Promise(function (resolve, reject) {
_resolve = resolve;
})
}
}
})();
var _Set;
/* istanbul ignore if */
if (typeof Set !== 'undefined' && isNative(Set)) {
// use native Set when available.
_Set = Set;
} else {
// a non-standard Set polyfill that only works with primitive keys.
_Set = (function () {
function Set () {
this.set = Object.create(null);
}
Set.prototype.has = function has (key) {
return this.set[key] === true
};
Set.prototype.add = function add (key) {
this.set[key] = true;
};
Set.prototype.clear = function clear () {
this.set = Object.create(null);
};
return Set;
}());
}
/* */
var uid$1 = 0;
/**
* A dep is an observable that can have multiple
* directives subscribing to it.
*/
var Dep = function Dep () {
this.id = uid$1++;
this.subs = [];
};
Dep.prototype.addSub = function addSub (sub) {
this.subs.push(sub);
};
Dep.prototype.removeSub = function removeSub (sub) {
remove(this.subs, sub);
};
Dep.prototype.depend = function depend () {
if (Dep.target) {
Dep.target.addDep(this);
}
};
Dep.prototype.notify = function notify () {
// stabilize the subscriber list first
var subs = this.subs.slice();
for (var i = 0, l = subs.length; i < l; i++) {
subs[i].update();
}
};
// the current target watcher being evaluated.
// this is globally unique because there could be only one
// watcher being evaluated at any time.
Dep.target = null;
var targetStack = [];
function pushTarget (_target) {
if (Dep.target) { targetStack.push(Dep.target); }
Dep.target = _target;
}
function popTarget () {
Dep.target = targetStack.pop();
}
/*
* not type checking this file because flow doesn't play well with
* dynamically accessing methods on Array prototype
*/
var arrayProto = Array.prototype;
var arrayMethods = Object.create(arrayProto);[
'push',
'pop',
'shift',
'unshift',
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var result = original.apply(this, args);
var ob = this.__ob__;
var inserted;
switch (method) {
case 'push':
case 'unshift':
inserted = args;
break
case 'splice':
inserted = args.slice(2);
break
}
if (inserted) { ob.observeArray(inserted); }
// notify change
ob.dep.notify();
return result
});
});
/* */
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
/**
* By default, when a reactive property is set, the new value is
* also converted to become reactive. However when passing down props,
* we don't want to force conversion because the value may be a nested value
* under a frozen data structure. Converting it would defeat the optimization.
*/
var observerState = {
shouldConvert: true
};
/**
* Observer class that are attached to each observed
* object. Once attached, the observer converts target
* object's property keys into getter/setters that
* collect dependencies and dispatches updates.
*/
var Observer = function Observer (value) {
this.value = value;
this.dep = new Dep();
this.vmCount = 0;
def(value, '__ob__', this);
if (Array.isArray(value)) {
var augment = hasProto
? protoAugment
: copyAugment;
augment(value, arrayMethods, arrayKeys);
this.observeArray(value);
} else {
this.walk(value);
}
};
/**
* Walk through each property and convert them into
* getter/setters. This method should only be called when
* value type is Object.
*/
Observer.prototype.walk = function walk (obj) {
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
defineReactive$$1(obj, keys[i], obj[keys[i]]);
}
};
/**
* Observe a list of Array items.
*/
Observer.prototype.observeArray = function observeArray (items) {
for (var i = 0, l = items.length; i < l; i++) {
observe(items[i]);
}
};
// helpers
/**
* Augment an target Object or Array by intercepting
* the prototype chain using __proto__
*/
function protoAugment (target, src, keys) {
/* eslint-disable no-proto */
target.__proto__ = src;
/* eslint-enable no-proto */
}
/**
* Augment an target Object or Array by defining
* hidden properties.
*/
/* istanbul ignore next */
function copyAugment (target, src, keys) {
for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i];
def(target, key, src[key]);
}
}
/**
* Attempt to create an observer instance for a value,
* returns the new observer if successfully observed,
* or the existing observer if the value already has one.
*/
function observe (value, asRootData) {
if (!isObject(value)) {
return
}
var ob;
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
ob = value.__ob__;
} else if (
observerState.shouldConvert &&
!isServerRendering() &&
(Array.isArray(value) || isPlainObject(value)) &&
Object.isExtensible(value) &&
!value._isVue
) {
ob = new Observer(value);
}
if (asRootData && ob) {
ob.vmCount++;
}
return ob
}
/**
* Define a reactive property on an Object.
*/
function defineReactive$$1 (
obj,
key,
val,
customSetter,
shallow
) {
var dep = new Dep();
var property = Object.getOwnPropertyDescriptor(obj, key);
if (property && property.configurable === false) {
return
}
// cater for pre-defined getter/setters
var getter = property && property.get;
var setter = property && property.set;
var childOb = !shallow && observe(val);
Object.defineProperty(obj, key, {
enumerable: true,
configurable: true,
get: function reactiveGetter () {
var value = getter ? getter.call(obj) : val;
if (Dep.target) {
dep.depend();
if (childOb) {
childOb.dep.depend();
}
if (Array.isArray(value)) {
dependArray(value);
}
}
return value
},
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
if (process.env.NODE_ENV !== 'production' && customSetter) {
customSetter();
}
if (setter) {
setter.call(obj, newVal);
} else {
val = newVal;
}
childOb = !shallow && observe(newVal);
dep.notify();
}
});
}
/**
* Set a property on an object. Adds the new property and
* triggers change notification if the property doesn't
* already exist.
*/
function set (target, key, val) {
if (Array.isArray(target) && isValidArrayIndex(key)) {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
return val
}
if (hasOwn(target, key)) {
target[key] = val;
return val
}
var ob = (target).__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid adding reactive properties to a Vue instance or its root $data ' +
'at runtime - declare it upfront in the data option.'
);
return val
}
if (!ob) {
target[key] = val;
return val
}
defineReactive$$1(ob.value, key, val);
ob.dep.notify();
return val
}
/**
* Delete a property and trigger change if necessary.
*/
function del (target, key) {
if (Array.isArray(target) && isValidArrayIndex(key)) {
target.splice(key, 1);
return
}
var ob = (target).__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid deleting properties on a Vue instance or its root $data ' +
'- just set it to null.'
);
return
}
if (!hasOwn(target, key)) {
return
}
delete target[key];
if (!ob) {
return
}
ob.dep.notify();
}
/**
* Collect dependencies on array elements when the array is touched, since
* we cannot intercept array element access like property getters.
*/
function dependArray (value) {
for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
e = value[i];
e && e.__ob__ && e.__ob__.dep.depend();
if (Array.isArray(e)) {
dependArray(e);
}
}
}
/* */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
* value into the final value.
*/
var strats = config.optionMergeStrategies;
/**
* Options with restrictions
*/
if (process.env.NODE_ENV !== 'production') {
strats.el = strats.propsData = function (parent, child, vm, key) {
if (!vm) {
warn(
"option \"" + key + "\" can only be used during instance " +
'creation with the `new` keyword.'
);
}
return defaultStrat(parent, child)
};
}
/**
* Helper that recursively merges two data objects together.
*/
function mergeData (to, from) {
if (!from) { return to }
var key, toVal, fromVal;
var keys = Object.keys(from);
for (var i = 0; i < keys.length; i++) {
key = keys[i];
toVal = to[key];
fromVal = from[key];
if (!hasOwn(to, key)) {
set(to, key, fromVal);
} else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
mergeData(toVal, fromVal);
}
}
return to
}
/**
* Data
*/
function mergeDataOrFn (
parentVal,
childVal,
vm
) {
if (!vm) {
// in a Vue.extend merge, both should be functions
if (!childVal) {
return parentVal
}
if (!parentVal) {
return childVal
}
// when parentVal & childVal are both present,
// we need to return a function that returns the
// merged result of both functions... no need to
// check if parentVal is a function here because
// it has to be a function to pass previous merges.
return function mergedDataFn () {
return mergeData(
typeof childVal === 'function' ? childVal.call(this) : childVal,
typeof parentVal === 'function' ? parentVal.call(this) : parentVal
)
}
} else if (parentVal || childVal) {
return function mergedInstanceDataFn () {
// instance merge
var instanceData = typeof childVal === 'function'
? childVal.call(vm)
: childVal;
var defaultData = typeof parentVal === 'function'
? parentVal.call(vm)
: undefined;
if (instanceData) {
return mergeData(instanceData, defaultData)
} else {
return defaultData
}
}
}
}
strats.data = function (
parentVal,
childVal,
vm
) {
if (!vm) {
if (childVal && typeof childVal !== 'function') {
process.env.NODE_ENV !== 'production' && warn(
'The "data" option should be a function ' +
'that returns a per-instance value in component ' +
'definitions.',
vm
);
return parentVal
}
return mergeDataOrFn.call(this, parentVal, childVal)
}
return mergeDataOrFn(parentVal, childVal, vm)
};
/**
* Hooks and props are merged as arrays.
*/
function mergeHook (
parentVal,
childVal
) {
return childVal
? parentVal
? parentVal.concat(childVal)
: Array.isArray(childVal)
? childVal
: [childVal]
: parentVal
}
LIFECYCLE_HOOKS.forEach(function (hook) {
strats[hook] = mergeHook;
});
/**
* Assets
*
* When a vm is present (instance creation), we need to do
* a three-way merge between constructor options, instance
* options and parent options.
*/
function mergeAssets (parentVal, childVal) {
var res = Object.create(parentVal || null);
return childVal
? extend(res, childVal)
: res
}
ASSET_TYPES.forEach(function (type) {
strats[type + 's'] = mergeAssets;
});
/**
* Watchers.
*
* Watchers hashes should not overwrite one
* another, so we merge them as arrays.
*/
strats.watch = function (parentVal, childVal) {
// work around Firefox's Object.prototype.watch...
if (parentVal === nativeWatch) { parentVal = undefined; }
if (childVal === nativeWatch) { childVal = undefined; }
/* istanbul ignore if */
if (!childVal) { return Object.create(parentVal || null) }
if (!parentVal) { return childVal }
var ret = {};
extend(ret, parentVal);
for (var key in childVal) {
var parent = ret[key];
var child = childVal[key];
if (parent && !Array.isArray(parent)) {
parent = [parent];
}
ret[key] = parent
? parent.concat(child)
: Array.isArray(child) ? child : [child];
}
return ret
};
/**
* Other object hashes.
*/
strats.props =
strats.methods =
strats.inject =
strats.computed = function (parentVal, childVal) {
if (!parentVal) { return childVal }
var ret = Object.create(null);
extend(ret, parentVal);
if (childVal) { extend(ret, childVal); }
return ret
};
strats.provide = mergeDataOrFn;
/**
* Default strategy.
*/
var defaultStrat = function (parentVal, childVal) {
return childVal === undefined
? parentVal
: childVal
};
/**
* Validate component names
*/
function checkComponents (options) {
for (var key in options.components) {
var lower = key.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + key
);
}
}
}
/**
* Ensure all props option syntax are normalized into the
* Object-based format.
*/
function normalizeProps (options) {
var props = options.props;
if (!props) { return }
var res = {};
var i, val, name;
if (Array.isArray(props)) {
i = props.length;
while (i--) {
val = props[i];
if (typeof val === 'string') {
name = camelize(val);
res[name] = { type: null };
} else if (process.env.NODE_ENV !== 'production') {
warn('props must be strings when using array syntax.');
}
}
} else if (isPlainObject(props)) {
for (var key in props) {
val = props[key];
name = camelize(key);
res[name] = isPlainObject(val)
? val
: { type: val };
}
}
options.props = res;
}
/**
* Normalize all injections into Object-based format
*/
function normalizeInject (options) {
var inject = options.inject;
if (Array.isArray(inject)) {
var normalized = options.inject = {};
for (var i = 0; i < inject.length; i++) {
normalized[inject[i]] = inject[i];
}
}
}
/**
* Normalize raw function directives into object format.
*/
function normalizeDirectives (options) {
var dirs = options.directives;
if (dirs) {
for (var key in dirs) {
var def = dirs[key];
if (typeof def === 'function') {
dirs[key] = { bind: def, update: def };
}
}
}
}
/**
* Merge two option objects into a new one.
* Core utility used in both instantiation and inheritance.
*/
function mergeOptions (
parent,
child,
vm
) {
if (process.env.NODE_ENV !== 'production') {
checkComponents(child);
}
if (typeof child === 'function') {
child = child.options;
}
normalizeProps(child);
normalizeInject(child);
normalizeDirectives(child);
var extendsFrom = child.extends;
if (extendsFrom) {
parent = mergeOptions(parent, extendsFrom, vm);
}
if (child.mixins) {
for (var i = 0, l = child.mixins.length; i < l; i++) {
parent = mergeOptions(parent, child.mixins[i], vm);
}
}
var options = {};
var key;
for (key in parent) {
mergeField(key);
}
for (key in child) {
if (!hasOwn(parent, key)) {
mergeField(key);
}
}
function mergeField (key) {
var strat = strats[key] || defaultStrat;
options[key] = strat(parent[key], child[key], vm, key);
}
return options
}
/**
* Resolve an asset.
* This function is used because child instances need access
* to assets defined in its ancestor chain.
*/
function resolveAsset (
options,
type,
id,
warnMissing
) {
/* istanbul ignore if */
if (typeof id !== 'string') {
return
}
var assets = options[type];
// check local registration variations first
if (hasOwn(assets, id)) { return assets[id] }
var camelizedId = camelize(id);
if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
var PascalCaseId = capitalize(camelizedId);
if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
// fallback to prototype chain
var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
warn(
'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
options
);
}
return res
}
/* */
function validateProp (
key,
propOptions,
propsData,
vm
) {
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
var value = propsData[key];
// handle boolean props
if (isType(Boolean, prop.type)) {
if (absent && !hasOwn(prop, 'default')) {
value = false;
} else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
value = true;
}
}
// check default value
if (value === undefined) {
value = getPropDefaultValue(vm, prop, key);
// since the default value is a fresh copy,
// make sure to observe it.
var prevShouldConvert = observerState.shouldConvert;
observerState.shouldConvert = true;
observe(value);
observerState.shouldConvert = prevShouldConvert;
}
if (process.env.NODE_ENV !== 'production') {
assertProp(prop, key, value, vm, absent);
}
return value
}
/**
* Get the default value of a prop.
*/
function getPropDefaultValue (vm, prop, key) {
// no default, return undefined
if (!hasOwn(prop, 'default')) {
return undefined
}
var def = prop.default;
// warn against non-factory defaults for Object & Array
if (process.env.NODE_ENV !== 'production' && isObject(def)) {
warn(
'Invalid default value for prop "' + key + '": ' +
'Props with type Object/Array must use a factory function ' +
'to return the default value.',
vm
);
}
// the raw prop value was also undefined from previous render,
// return previous default value to avoid unnecessary watcher trigger
if (vm && vm.$options.propsData &&
vm.$options.propsData[key] === undefined &&
vm._props[key] !== undefined
) {
return vm._props[key]
}
// call factory function for non-Function types
// a value is Function if its prototype is function even across different execution context
return typeof def === 'function' && getType(prop.type) !== 'Function'
? def.call(vm)
: def
}
/**
* Assert whether a prop is valid.
*/
function assertProp (
prop,
name,
value,
vm,
absent
) {
if (prop.required && absent) {
warn(
'Missing required prop: "' + name + '"',
vm
);
return
}
if (value == null && !prop.required) {
return
}
var type = prop.type;
var valid = !type || type === true;
var expectedTypes = [];
if (type) {
if (!Array.isArray(type)) {
type = [type];
}
for (var i = 0; i < type.length && !valid; i++) {
var assertedType = assertType(value, type[i]);
expectedTypes.push(assertedType.expectedType || '');
valid = assertedType.valid;
}
}
if (!valid) {
warn(
'Invalid prop: type check failed for prop "' + name + '".' +
' Expected ' + expectedTypes.map(capitalize).join(', ') +
', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
vm
);
return
}
var validator = prop.validator;
if (validator) {
if (!validator(value)) {
warn(
'Invalid prop: custom validator check failed for prop "' + name + '".',
vm
);
}
}
}
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
function assertType (value, type) {
var valid;
var expectedType = getType(type);
if (simpleCheckRE.test(expectedType)) {
valid = typeof value === expectedType.toLowerCase();
} else if (expectedType === 'Object') {
valid = isPlainObject(value);
} else if (expectedType === 'Array') {
valid = Array.isArray(value);
} else {
valid = value instanceof type;
}
return {
valid: valid,
expectedType: expectedType
}
}
/**
* Use function string name to check built-in types,
* because a simple equality check will fail when running
* across different vms / iframes.
*/
function getType (fn) {
var match = fn && fn.toString().match(/^\s*function (\w+)/);
return match ? match[1] : ''
}
function isType (type, fn) {
if (!Array.isArray(fn)) {
return getType(fn) === getType(type)
}
for (var i = 0, len = fn.length; i < len; i++) {
if (getType(fn[i]) === getType(type)) {
return true
}
}
/* istanbul ignore next */
return false
}
/* */
/* not type checking this file because flow doesn't play well with Proxy */
var initProxy;
if (process.env.NODE_ENV !== 'production') {
var allowedGlobals = makeMap(
'Infinity,undefined,NaN,isFinite,isNaN,' +
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
'require' // for Webpack/Browserify
);
var warnNonPresent = function (target, key) {
warn(
"Property or method \"" + key + "\" is not defined on the instance but " +
"referenced during render. Make sure to declare reactive data " +
"properties in the data option.",
target
);
};
var hasProxy =
typeof Proxy !== 'undefined' &&
Proxy.toString().match(/native code/);
if (hasProxy) {
var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
config.keyCodes = new Proxy(config.keyCodes, {
set: function set (target, key, value) {
if (isBuiltInModifier(key)) {
warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
return false
} else {
target[key] = value;
return true
}
}
});
}
var hasHandler = {
has: function has (target, key) {
var has = key in target;
var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
if (!has && !isAllowed) {
warnNonPresent(target, key);
}
return has || !isAllowed
}
};
var getHandler = {
get: function get (target, key) {
if (typeof key === 'string' && !(key in target)) {
warnNonPresent(target, key);
}
return target[key]
}
};
initProxy = function initProxy (vm) {
if (hasProxy) {
// determine which proxy handler to use
var options = vm.$options;
var handlers = options.render && options.render._withStripped
? getHandler
: hasHandler;
vm._renderProxy = new Proxy(vm, handlers);
} else {
vm._renderProxy = vm;
}
};
}
var mark;
var measure;
if (process.env.NODE_ENV !== 'production') {
var perf = inBrowser && window.performance;
/* istanbul ignore if */
if (
perf &&
perf.mark &&
perf.measure &&
perf.clearMarks &&
perf.clearMeasures
) {
mark = function (tag) { return perf.mark(tag); };
measure = function (name, startTag, endTag) {
perf.measure(name, startTag, endTag);
perf.clearMarks(startTag);
perf.clearMarks(endTag);
perf.clearMeasures(name);
};
}
}
/* */
var VNode = function VNode (
tag,
data,
children,
text,
elm,
context,
componentOptions,
asyncFactory
) {
this.tag = tag;
this.data = data;
this.children = children;
this.text = text;
this.elm = elm;
this.ns = undefined;
this.context = context;
this.functionalContext = undefined;
this.key = data && data.key;
this.componentOptions = componentOptions;
this.componentInstance = undefined;
this.parent = undefined;
this.raw = false;
this.isStatic = false;
this.isRootInsert = true;
this.isComment = false;
this.isCloned = false;
this.isOnce = false;
this.asyncFactory = asyncFactory;
this.asyncMeta = undefined;
this.isAsyncPlaceholder = false;
};
var prototypeAccessors = { child: {} };
// DEPRECATED: alias for componentInstance for backwards compat.
/* istanbul ignore next */
prototypeAccessors.child.get = function () {
return this.componentInstance
};
Object.defineProperties( VNode.prototype, prototypeAccessors );
var createEmptyVNode = function (text) {
if ( text === void 0 ) text = '';
var node = new VNode();
node.text = text;
node.isComment = true;
return node
};
function createTextVNode (val) {
return new VNode(undefined, undefined, undefined, String(val))
}
// optimized shallow clone
// used for static nodes and slot nodes because they may be reused across
// multiple renders, cloning them avoids errors when DOM manipulations rely
// on their elm reference.
function cloneVNode (vnode) {
var cloned = new VNode(
vnode.tag,
vnode.data,
vnode.children,
vnode.text,
vnode.elm,
vnode.context,
vnode.componentOptions,
vnode.asyncFactory
);
cloned.ns = vnode.ns;
cloned.isStatic = vnode.isStatic;
cloned.key = vnode.key;
cloned.isComment = vnode.isComment;
cloned.isCloned = true;
return cloned
}
function cloneVNodes (vnodes) {
var len = vnodes.length;
var res = new Array(len);
for (var i = 0; i < len; i++) {
res[i] = cloneVNode(vnodes[i]);
}
return res
}
/* */
var normalizeEvent = cached(function (name) {
var passive = name.charAt(0) === '&';
name = passive ? name.slice(1) : name;
var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
name = once$$1 ? name.slice(1) : name;
var capture = name.charAt(0) === '!';
name = capture ? name.slice(1) : name;
return {
name: name,
once: once$$1,
capture: capture,
passive: passive
}
});
function createFnInvoker (fns) {
function invoker () {
var arguments$1 = arguments;
var fns = invoker.fns;
if (Array.isArray(fns)) {
var cloned = fns.slice();
for (var i = 0; i < cloned.length; i++) {
cloned[i].apply(null, arguments$1);
}
} else {
// return handler return value for single handlers
return fns.apply(null, arguments)
}
}
invoker.fns = fns;
return invoker
}
function updateListeners (
on,
oldOn,
add,
remove$$1,
vm
) {
var name, cur, old, event;
for (name in on) {
cur = on[name];
old = oldOn[name];
event = normalizeEvent(name);
if (isUndef(cur)) {
process.env.NODE_ENV !== 'production' && warn(
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
vm
);
} else if (isUndef(old)) {
if (isUndef(cur.fns)) {
cur = on[name] = createFnInvoker(cur);
}
add(event.name, cur, event.once, event.capture, event.passive);
} else if (cur !== old) {
old.fns = cur;
on[name] = old;
}
}
for (name in oldOn) {
if (isUndef(on[name])) {
event = normalizeEvent(name);
remove$$1(event.name, oldOn[name], event.capture);
}
}
}
/* */
function mergeVNodeHook (def, hookKey, hook) {
var invoker;
var oldHook = def[hookKey];
function wrappedHook () {
hook.apply(this, arguments);
// important: remove merged hook to ensure it's called only once
// and prevent memory leak
remove(invoker.fns, wrappedHook);
}
if (isUndef(oldHook)) {
// no existing hook
invoker = createFnInvoker([wrappedHook]);
} else {
/* istanbul ignore if */
if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
// already a merged invoker
invoker = oldHook;
invoker.fns.push(wrappedHook);
} else {
// existing plain hook
invoker = createFnInvoker([oldHook, wrappedHook]);
}
}
invoker.merged = true;
def[hookKey] = invoker;
}
/* */
function extractPropsFromVNodeData (
data,
Ctor,
tag
) {
// we are only extracting raw values here.
// validation and default values are handled in the child
// component itself.
var propOptions = Ctor.options.props;
if (isUndef(propOptions)) {
return
}
var res = {};
var attrs = data.attrs;
var props = data.props;
if (isDef(attrs) || isDef(props)) {
for (var key in propOptions) {
var altKey = hyphenate(key);
if (process.env.NODE_ENV !== 'production') {
var keyInLowerCase = key.toLowerCase();
if (
key !== keyInLowerCase &&
attrs && hasOwn(attrs, keyInLowerCase)
) {
tip(
"Prop \"" + keyInLowerCase + "\" is passed to component " +
(formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
" \"" + key + "\". " +
"Note that HTML attributes are case-insensitive and camelCased " +
"props need to use their kebab-case equivalents when using in-DOM " +
"templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
);
}
}
checkProp(res, props, key, altKey, true) ||
checkProp(res, attrs, key, altKey, false);
}
}
return res
}
function checkProp (
res,
hash,
key,
altKey,
preserve
) {
if (isDef(hash)) {
if (hasOwn(hash, key)) {
res[key] = hash[key];
if (!preserve) {
delete hash[key];
}
return true
} else if (hasOwn(hash, altKey)) {
res[key] = hash[altKey];
if (!preserve) {
delete hash[altKey];
}
return true
}
}
return false
}
/* */
// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
// For plain HTML markup, normalization can be completely skipped because the
// generated render function is guaranteed to return Array<VNode>. There are
// two cases where extra normalization is needed:
// 1. When the children contains components - because a functional component
// may return an Array instead of a single root. In this case, just a simple
// normalization is needed - if any child is an Array, we flatten the whole
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
// because functional components already normalize their own children.
function simpleNormalizeChildren (children) {
for (var i = 0; i < children.length; i++) {
if (Array.isArray(children[i])) {
return Array.prototype.concat.apply([], children)
}
}
return children
}
// 2. When the children contains constructs that always generated nested Arrays,
// e.g. <template>, <slot>, v-for, or when the children is provided by user
// with hand-written render functions / JSX. In such cases a full normalization
// is needed to cater to all possible types of children values.
function normalizeChildren (children) {
return isPrimitive(children)
? [createTextVNode(children)]
: Array.isArray(children)
? normalizeArrayChildren(children)
: undefined
}
function isTextNode (node) {
return isDef(node) && isDef(node.text) && isFalse(node.isComment)
}
function normalizeArrayChildren (children, nestedIndex) {
var res = [];
var i, c, last;
for (i = 0; i < children.length; i++) {
c = children[i];
if (isUndef(c) || typeof c === 'boolean') { continue }
last = res[res.length - 1];
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
} else if (isPrimitive(c)) {
if (isTextNode(last)) {
// merge adjacent text nodes
// this is necessary for SSR hydration because text nodes are
// essentially merged when rendered to HTML strings
(last).text += String(c);
} else if (c !== '') {
// convert primitive to vnode
res.push(createTextVNode(c));
}
} else {
if (isTextNode(c) && isTextNode(last)) {
// merge adjacent text nodes
res[res.length - 1] = createTextVNode(last.text + c.text);
} else {
// default key for nested array children (likely generated by v-for)
if (isTrue(children._isVList) &&
isDef(c.tag) &&
isUndef(c.key) &&
isDef(nestedIndex)) {
c.key = "__vlist" + nestedIndex + "_" + i + "__";
}
res.push(c);
}
}
}
return res
}
/* */
function ensureCtor (comp, base) {
if (comp.__esModule && comp.default) {
comp = comp.default;
}
return isObject(comp)
? base.extend(comp)
: comp
}
function createAsyncPlaceholder (
factory,
data,
context,
children,
tag
) {
var node = createEmptyVNode();
node.asyncFactory = factory;
node.asyncMeta = { data: data, context: context, children: children, tag: tag };
return node
}
function resolveAsyncComponent (
factory,
baseCtor,
context
) {
if (isTrue(factory.error) && isDef(factory.errorComp)) {
return factory.errorComp
}
if (isDef(factory.resolved)) {
return factory.resolved
}
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
return factory.loadingComp
}
if (isDef(factory.contexts)) {
// already pending
factory.contexts.push(context);
} else {
var contexts = factory.contexts = [context];
var sync = true;
var forceRender = function () {
for (var i = 0, l = contexts.length; i < l; i++) {
contexts[i].$forceUpdate();
}
};
var resolve = once(function (res) {
// cache resolved
factory.resolved = ensureCtor(res, baseCtor);
// invoke callbacks only if this is not a synchronous resolve
// (async resolves are shimmed as synchronous during SSR)
if (!sync) {
forceRender();
}
});
var reject = once(function (reason) {
process.env.NODE_ENV !== 'production' && warn(
"Failed to resolve async component: " + (String(factory)) +
(reason ? ("\nReason: " + reason) : '')
);
if (isDef(factory.errorComp)) {
factory.error = true;
forceRender();
}
});
var res = factory(resolve, reject);
if (isObject(res)) {
if (typeof res.then === 'function') {
// () => Promise
if (isUndef(factory.resolved)) {
res.then(resolve, reject);
}
} else if (isDef(res.component) && typeof res.component.then === 'function') {
res.component.then(resolve, reject);
if (isDef(res.error)) {
factory.errorComp = ensureCtor(res.error, baseCtor);
}
if (isDef(res.loading)) {
factory.loadingComp = ensureCtor(res.loading, baseCtor);
if (res.delay === 0) {
factory.loading = true;
} else {
setTimeout(function () {
if (isUndef(factory.resolved) && isUndef(factory.error)) {
factory.loading = true;
forceRender();
}
}, res.delay || 200);
}
}
if (isDef(res.timeout)) {
setTimeout(function () {
if (isUndef(factory.resolved)) {
reject(
process.env.NODE_ENV !== 'production'
? ("timeout (" + (res.timeout) + "ms)")
: null
);
}
}, res.timeout);
}
}
}
sync = false;
// return in case resolved synchronously
return factory.loading
? factory.loadingComp
: factory.resolved
}
}
/* */
function getFirstComponentChild (children) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
var c = children[i];
if (isDef(c) && isDef(c.componentOptions)) {
return c
}
}
}
}
/* */
/* */
function initEvents (vm) {
vm._events = Object.create(null);
vm._hasHookEvent = false;
// init parent attached events
var listeners = vm.$options._parentListeners;
if (listeners) {
updateComponentListeners(vm, listeners);
}
}
var target;
function add (event, fn, once$$1) {
if (once$$1) {
target.$once(event, fn);
} else {
target.$on(event, fn);
}
}
function remove$1 (event, fn) {
target.$off(event, fn);
}
function updateComponentListeners (
vm,
listeners,
oldListeners
) {
target = vm;
updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
}
function eventsMixin (Vue) {
var hookRE = /^hook:/;
Vue.prototype.$on = function (event, fn) {
var this$1 = this;
var vm = this;
if (Array.isArray(event)) {
for (var i = 0, l = event.length; i < l; i++) {
this$1.$on(event[i], fn);
}
} else {
(vm._events[event] || (vm._events[event] = [])).push(fn);
// optimize hook:event cost by using a boolean flag marked at registration
// instead of a hash lookup
if (hookRE.test(event)) {
vm._hasHookEvent = true;
}
}
return vm
};
Vue.prototype.$once = function (event, fn) {
var vm = this;
function on () {
vm.$off(event, on);
fn.apply(vm, arguments);
}
on.fn = fn;
vm.$on(event, on);
return vm
};
Vue.prototype.$off = function (event, fn) {
var this$1 = this;
var vm = this;
// all
if (!arguments.length) {
vm._events = Object.create(null);
return vm
}
// array of events
if (Array.isArray(event)) {
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
this$1.$off(event[i$1], fn);
}
return vm
}
// specific event
var cbs = vm._events[event];
if (!cbs) {
return vm
}
if (arguments.length === 1) {
vm._events[event] = null;
return vm
}
// specific handler
var cb;
var i = cbs.length;
while (i--) {
cb = cbs[i];
if (cb === fn || cb.fn === fn) {
cbs.splice(i, 1);
break
}
}
return vm
};
Vue.prototype.$emit = function (event) {
var vm = this;
if (process.env.NODE_ENV !== 'production') {
var lowerCaseEvent = event.toLowerCase();
if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
tip(
"Event \"" + lowerCaseEvent + "\" is emitted in component " +
(formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
"Note that HTML attributes are case-insensitive and you cannot use " +
"v-on to listen to camelCase events when using in-DOM templates. " +
"You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
);
}
}
var cbs = vm._events[event];
if (cbs) {
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
var args = toArray(arguments, 1);
for (var i = 0, l = cbs.length; i < l; i++) {
try {
cbs[i].apply(vm, args);
} catch (e) {
handleError(e, vm, ("event handler for \"" + event + "\""));
}
}
}
return vm
};
}
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
function resolveSlots (
children,
context
) {
var slots = {};
if (!children) {
return slots
}
var defaultSlot = [];
for (var i = 0, l = children.length; i < l; i++) {
var child = children[i];
// named slots should only be respected if the vnode was rendered in the
// same context.
if ((child.context === context || child.functionalContext === context) &&
child.data && child.data.slot != null
) {
var name = child.data.slot;
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
} else {
slot.push(child);
}
} else {
defaultSlot.push(child);
}
}
// ignore whitespace
if (!defaultSlot.every(isWhitespace)) {
slots.default = defaultSlot;
}
return slots
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
}
function resolveScopedSlots (
fns, // see flow/vnode
res
) {
res = res || {};
for (var i = 0; i < fns.length; i++) {
if (Array.isArray(fns[i])) {
resolveScopedSlots(fns[i], res);
} else {
res[fns[i].key] = fns[i].fn;
}
}
return res
}
/* */
var activeInstance = null;
var isUpdatingChildComponent = false;
function initLifecycle (vm) {
var options = vm.$options;
// locate first non-abstract parent
var parent = options.parent;
if (parent && !options.abstract) {
while (parent.$options.abstract && parent.$parent) {
parent = parent.$parent;
}
parent.$children.push(vm);
}
vm.$parent = parent;
vm.$root = parent ? parent.$root : vm;
vm.$children = [];
vm.$refs = {};
vm._watcher = null;
vm._inactive = null;
vm._directInactive = false;
vm._isMounted = false;
vm._isDestroyed = false;
vm._isBeingDestroyed = false;
}
function lifecycleMixin (Vue) {
Vue.prototype._update = function (vnode, hydrating) {
var vm = this;
if (vm._isMounted) {
callHook(vm, 'beforeUpdate');
}
var prevEl = vm.$el;
var prevVnode = vm._vnode;
var prevActiveInstance = activeInstance;
activeInstance = vm;
vm._vnode = vnode;
// Vue.prototype.__patch__ is injected in entry points
// based on the rendering backend used.
if (!prevVnode) {
// initial render
vm.$el = vm.__patch__(
vm.$el, vnode, hydrating, false /* removeOnly */,
vm.$options._parentElm,
vm.$options._refElm
);
// no need for the ref nodes after initial patch
// this prevents keeping a detached DOM tree in memory (#5851)
vm.$options._parentElm = vm.$options._refElm = null;
} else {
// updates
vm.$el = vm.__patch__(prevVnode, vnode);
}
activeInstance = prevActiveInstance;
// update __vue__ reference
if (prevEl) {
prevEl.__vue__ = null;
}
if (vm.$el) {
vm.$el.__vue__ = vm;
}
// if parent is an HOC, update its $el as well
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
vm.$parent.$el = vm.$el;
}
// updated hook is called by the scheduler to ensure that children are
// updated in a parent's updated hook.
};
Vue.prototype.$forceUpdate = function () {
var vm = this;
if (vm._watcher) {
vm._watcher.update();
}
};
Vue.prototype.$destroy = function () {
var vm = this;
if (vm._isBeingDestroyed) {
return
}
callHook(vm, 'beforeDestroy');
vm._isBeingDestroyed = true;
// remove self from parent
var parent = vm.$parent;
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
remove(parent.$children, vm);
}
// teardown watchers
if (vm._watcher) {
vm._watcher.teardown();
}
var i = vm._watchers.length;
while (i--) {
vm._watchers[i].teardown();
}
// remove reference from data ob
// frozen object may not have observer.
if (vm._data.__ob__) {
vm._data.__ob__.vmCount--;
}
// call the last hook...
vm._isDestroyed = true;
// invoke destroy hooks on current rendered tree
vm.__patch__(vm._vnode, null);
// fire destroyed hook
callHook(vm, 'destroyed');
// turn off all instance listeners.
vm.$off();
// remove __vue__ reference
if (vm.$el) {
vm.$el.__vue__ = null;
}
};
}
function mountComponent (
vm,
el,
hydrating
) {
vm.$el = el;
if (!vm.$options.render) {
vm.$options.render = createEmptyVNode;
if (process.env.NODE_ENV !== 'production') {
/* istanbul ignore if */
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
vm.$options.el || el) {
warn(
'You are using the runtime-only build of Vue where the template ' +
'compiler is not available. Either pre-compile the templates into ' +
'render functions, or use the compiler-included build.',
vm
);
} else {
warn(
'Failed to mount component: template or render function not defined.',
vm
);
}
}
}
callHook(vm, 'beforeMount');
var updateComponent;
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
updateComponent = function () {
var name = vm._name;
var id = vm._uid;
var startTag = "vue-perf-start:" + id;
var endTag = "vue-perf-end:" + id;
mark(startTag);
var vnode = vm._render();
mark(endTag);
measure((name + " render"), startTag, endTag);
mark(startTag);
vm._update(vnode, hydrating);
mark(endTag);
measure((name + " patch"), startTag, endTag);
};
} else {
updateComponent = function () {
vm._update(vm._render(), hydrating);
};
}
vm._watcher = new Watcher(vm, updateComponent, noop);
hydrating = false;
// manually mounted instance, call mounted on self
// mounted is called for render-created child components in its inserted hook
if (vm.$vnode == null) {
vm._isMounted = true;
callHook(vm, 'mounted');
}
return vm
}
function updateChildComponent (
vm,
propsData,
listeners,
parentVnode,
renderChildren
) {
if (process.env.NODE_ENV !== 'production') {
isUpdatingChildComponent = true;
}
// determine whether component has slot children
// we need to do this before overwriting $options._renderChildren
var hasChildren = !!(
renderChildren || // has new static slots
vm.$options._renderChildren || // has old static slots
parentVnode.data.scopedSlots || // has new scoped slots
vm.$scopedSlots !== emptyObject // has old scoped slots
);
vm.$options._parentVnode = parentVnode;
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
if (vm._vnode) { // update child tree's parent
vm._vnode.parent = parentVnode;
}
vm.$options._renderChildren = renderChildren;
// update $attrs and $listensers hash
// these are also reactive so they may trigger child update if the child
// used them during render
vm.$attrs = parentVnode.data && parentVnode.data.attrs;
vm.$listeners = listeners;
// update props
if (propsData && vm.$options.props) {
observerState.shouldConvert = false;
var props = vm._props;
var propKeys = vm.$options._propKeys || [];
for (var i = 0; i < propKeys.length; i++) {
var key = propKeys[i];
props[key] = validateProp(key, vm.$options.props, propsData, vm);
}
observerState.shouldConvert = true;
// keep a copy of raw propsData
vm.$options.propsData = propsData;
}
// update listeners
if (listeners) {
var oldListeners = vm.$options._parentListeners;
vm.$options._parentListeners = listeners;
updateComponentListeners(vm, listeners, oldListeners);
}
// resolve slots + force update if has children
if (hasChildren) {
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
vm.$forceUpdate();
}
if (process.env.NODE_ENV !== 'production') {
isUpdatingChildComponent = false;
}
}
function isInInactiveTree (vm) {
while (vm && (vm = vm.$parent)) {
if (vm._inactive) { return true }
}
return false
}
function activateChildComponent (vm, direct) {
if (direct) {
vm._directInactive = false;
if (isInInactiveTree(vm)) {
return
}
} else if (vm._directInactive) {
return
}
if (vm._inactive || vm._inactive === null) {
vm._inactive = false;
for (var i = 0; i < vm.$children.length; i++) {
activateChildComponent(vm.$children[i]);
}
callHook(vm, 'activated');
}
}
function deactivateChildComponent (vm, direct) {
if (direct) {
vm._directInactive = true;
if (isInInactiveTree(vm)) {
return
}
}
if (!vm._inactive) {
vm._inactive = true;
for (var i = 0; i < vm.$children.length; i++) {
deactivateChildComponent(vm.$children[i]);
}
callHook(vm, 'deactivated');
}
}
function callHook (vm, hook) {
var handlers = vm.$options[hook];
if (handlers) {
for (var i = 0, j = handlers.length; i < j; i++) {
try {
handlers[i].call(vm);
} catch (e) {
handleError(e, vm, (hook + " hook"));
}
}
}
if (vm._hasHookEvent) {
vm.$emit('hook:' + hook);
}
}
/* */
var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
var has = {};
var circular = {};
var waiting = false;
var flushing = false;
var index = 0;
/**
* Reset the scheduler's state.
*/
function resetSchedulerState () {
index = queue.length = activatedChildren.length = 0;
has = {};
if (process.env.NODE_ENV !== 'production') {
circular = {};
}
waiting = flushing = false;
}
/**
* Flush both queues and run the watchers.
*/
function flushSchedulerQueue () {
flushing = true;
var watcher, id;
// Sort queue before flush.
// This ensures that:
// 1. Components are updated from parent to child. (because parent is always
// created before the child)
// 2. A component's user watchers are run before its render watcher (because
// user watchers are created before the render watcher)
// 3. If a component is destroyed during a parent component's watcher run,
// its watchers can be skipped.
queue.sort(function (a, b) { return a.id - b.id; });
// do not cache length because more watchers might be pushed
// as we run existing watchers
for (index = 0; index < queue.length; index++) {
watcher = queue[index];
id = watcher.id;
has[id] = null;
watcher.run();
// in dev build, check and stop circular updates.
if (process.env.NODE_ENV !== 'production' && has[id] != null) {
circular[id] = (circular[id] || 0) + 1;
if (circular[id] > MAX_UPDATE_COUNT) {
warn(
'You may have an infinite update loop ' + (
watcher.user
? ("in watcher with expression \"" + (watcher.expression) + "\"")
: "in a component render function."
),
watcher.vm
);
break
}
}
}
// keep copies of post queues before resetting state
var activatedQueue = activatedChildren.slice();
var updatedQueue = queue.slice();
resetSchedulerState();
// call component updated and activated hooks
callActivatedHooks(activatedQueue);
callUpdatedHooks(updatedQueue);
// devtool hook
/* istanbul ignore if */
if (devtools && config.devtools) {
devtools.emit('flush');
}
}
function callUpdatedHooks (queue) {
var i = queue.length;
while (i--) {
var watcher = queue[i];
var vm = watcher.vm;
if (vm._watcher === watcher && vm._isMounted) {
callHook(vm, 'updated');
}
}
}
/**
* Queue a kept-alive component that was activated during patch.
* The queue will be processed after the entire tree has been patched.
*/
function queueActivatedComponent (vm) {
// setting _inactive to false here so that a render function can
// rely on checking whether it's in an inactive tree (e.g. router-view)
vm._inactive = false;
activatedChildren.push(vm);
}
function callActivatedHooks (queue) {
for (var i = 0; i < queue.length; i++) {
queue[i]._inactive = true;
activateChildComponent(queue[i], true /* true */);
}
}
/**
* Push a watcher into the watcher queue.
* Jobs with duplicate IDs will be skipped unless it's
* pushed when the queue is being flushed.
*/
function queueWatcher (watcher) {
var id = watcher.id;
if (has[id] == null) {
has[id] = true;
if (!flushing) {
queue.push(watcher);
} else {
// if already flushing, splice the watcher based on its id
// if already past its id, it will be run next immediately.
var i = queue.length - 1;
while (i > index && queue[i].id > watcher.id) {
i--;
}
queue.splice(i + 1, 0, watcher);
}
// queue the flush
if (!waiting) {
waiting = true;
nextTick(flushSchedulerQueue);
}
}
}
/* */
var uid$2 = 0;
/**
* A watcher parses an expression, collects dependencies,
* and fires callback when the expression value changes.
* This is used for both the $watch() api and directives.
*/
var Watcher = function Watcher (
vm,
expOrFn,
cb,
options
) {
this.vm = vm;
vm._watchers.push(this);
// options
if (options) {
this.deep = !!options.deep;
this.user = !!options.user;
this.lazy = !!options.lazy;
this.sync = !!options.sync;
} else {
this.deep = this.user = this.lazy = this.sync = false;
}
this.cb = cb;
this.id = ++uid$2; // uid for batching
this.active = true;
this.dirty = this.lazy; // for lazy watchers
this.deps = [];
this.newDeps = [];
this.depIds = new _Set();
this.newDepIds = new _Set();
this.expression = process.env.NODE_ENV !== 'production'
? expOrFn.toString()
: '';
// parse expression for getter
if (typeof expOrFn === 'function') {
this.getter = expOrFn;
} else {
this.getter = parsePath(expOrFn);
if (!this.getter) {
this.getter = function () {};
process.env.NODE_ENV !== 'production' && warn(
"Failed watching path: \"" + expOrFn + "\" " +
'Watcher only accepts simple dot-delimited paths. ' +
'For full control, use a function instead.',
vm
);
}
}
this.value = this.lazy
? undefined
: this.get();
};
/**
* Evaluate the getter, and re-collect dependencies.
*/
Watcher.prototype.get = function get () {
pushTarget(this);
var value;
var vm = this.vm;
try {
value = this.getter.call(vm, vm);
} catch (e) {
if (this.user) {
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
} else {
throw e
}
} finally {
// "touch" every property so they are all tracked as
// dependencies for deep watching
if (this.deep) {
traverse(value);
}
popTarget();
this.cleanupDeps();
}
return value
};
/**
* Add a dependency to this directive.
*/
Watcher.prototype.addDep = function addDep (dep) {
var id = dep.id;
if (!this.newDepIds.has(id)) {
this.newDepIds.add(id);
this.newDeps.push(dep);
if (!this.depIds.has(id)) {
dep.addSub(this);
}
}
};
/**
* Clean up for dependency collection.
*/
Watcher.prototype.cleanupDeps = function cleanupDeps () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
var dep = this$1.deps[i];
if (!this$1.newDepIds.has(dep.id)) {
dep.removeSub(this$1);
}
}
var tmp = this.depIds;
this.depIds = this.newDepIds;
this.newDepIds = tmp;
this.newDepIds.clear();
tmp = this.deps;
this.deps = this.newDeps;
this.newDeps = tmp;
this.newDeps.length = 0;
};
/**
* Subscriber interface.
* Will be called when a dependency changes.
*/
Watcher.prototype.update = function update () {
/* istanbul ignore else */
if (this.lazy) {
this.dirty = true;
} else if (this.sync) {
this.run();
} else {
queueWatcher(this);
}
};
/**
* Scheduler job interface.
* Will be called by the scheduler.
*/
Watcher.prototype.run = function run () {
if (this.active) {
var value = this.get();
if (
value !== this.value ||
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
isObject(value) ||
this.deep
) {
// set new value
var oldValue = this.value;
this.value = value;
if (this.user) {
try {
this.cb.call(this.vm, value, oldValue);
} catch (e) {
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
}
} else {
this.cb.call(this.vm, value, oldValue);
}
}
}
};
/**
* Evaluate the value of the watcher.
* This only gets called for lazy watchers.
*/
Watcher.prototype.evaluate = function evaluate () {
this.value = this.get();
this.dirty = false;
};
/**
* Depend on all deps collected by this watcher.
*/
Watcher.prototype.depend = function depend () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
this$1.deps[i].depend();
}
};
/**
* Remove self from all dependencies' subscriber list.
*/
Watcher.prototype.teardown = function teardown () {
var this$1 = this;
if (this.active) {
// remove self from vm's watcher list
// this is a somewhat expensive operation so we skip it
// if the vm is being destroyed.
if (!this.vm._isBeingDestroyed) {
remove(this.vm._watchers, this);
}
var i = this.deps.length;
while (i--) {
this$1.deps[i].removeSub(this$1);
}
this.active = false;
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var sharedPropertyDefinition = {
enumerable: true,
configurable: true,
get: noop,
set: noop
};
function proxy (target, sourceKey, key) {
sharedPropertyDefinition.get = function proxyGetter () {
return this[sourceKey][key]
};
sharedPropertyDefinition.set = function proxySetter (val) {
this[sourceKey][key] = val;
};
Object.defineProperty(target, key, sharedPropertyDefinition);
}
function initState (vm) {
vm._watchers = [];
var opts = vm.$options;
if (opts.props) { initProps(vm, opts.props); }
if (opts.methods) { initMethods(vm, opts.methods); }
if (opts.data) {
initData(vm);
} else {
observe(vm._data = {}, true /* asRootData */);
}
if (opts.computed) { initComputed(vm, opts.computed); }
if (opts.watch && opts.watch !== nativeWatch) {
initWatch(vm, opts.watch);
}
}
function checkOptionType (vm, name) {
var option = vm.$options[name];
if (!isPlainObject(option)) {
warn(
("component option \"" + name + "\" should be an object."),
vm
);
}
}
function initProps (vm, propsOptions) {
var propsData = vm.$options.propsData || {};
var props = vm._props = {};
// cache prop keys so that future props updates can iterate using Array
// instead of dynamic object key enumeration.
var keys = vm.$options._propKeys = [];
var isRoot = !vm.$parent;
// root instance props should be converted
observerState.shouldConvert = isRoot;
var loop = function ( key ) {
keys.push(key);
var value = validateProp(key, propsOptions, propsData, vm);
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
if (isReservedAttribute(key) || config.isReservedAttr(key)) {
warn(
("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
vm
);
}
defineReactive$$1(props, key, value, function () {
if (vm.$parent && !isUpdatingChildComponent) {
warn(
"Avoid mutating a prop directly since the value will be " +
"overwritten whenever the parent component re-renders. " +
"Instead, use a data or computed property based on the prop's " +
"value. Prop being mutated: \"" + key + "\"",
vm
);
}
});
} else {
defineReactive$$1(props, key, value);
}
// static props are already proxied on the component's prototype
// during Vue.extend(). We only need to proxy props defined at
// instantiation here.
if (!(key in vm)) {
proxy(vm, "_props", key);
}
};
for (var key in propsOptions) loop( key );
observerState.shouldConvert = true;
}
function initData (vm) {
var data = vm.$options.data;
data = vm._data = typeof data === 'function'
? getData(data, vm)
: data || {};
if (!isPlainObject(data)) {
data = {};
process.env.NODE_ENV !== 'production' && warn(
'data functions should return an object:\n' +
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
vm
);
}
// proxy data on instance
var keys = Object.keys(data);
var props = vm.$options.props;
var methods = vm.$options.methods;
var i = keys.length;
while (i--) {
var key = keys[i];
if (process.env.NODE_ENV !== 'production') {
if (methods && hasOwn(methods, key)) {
warn(
("method \"" + key + "\" has already been defined as a data property."),
vm
);
}
}
if (props && hasOwn(props, key)) {
process.env.NODE_ENV !== 'production' && warn(
"The data property \"" + key + "\" is already declared as a prop. " +
"Use prop default value instead.",
vm
);
} else if (!isReserved(key)) {
proxy(vm, "_data", key);
}
}
// observe data
observe(data, true /* asRootData */);
}
function getData (data, vm) {
try {
return data.call(vm)
} catch (e) {
handleError(e, vm, "data()");
return {}
}
}
var computedWatcherOptions = { lazy: true };
function initComputed (vm, computed) {
process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'computed');
var watchers = vm._computedWatchers = Object.create(null);
for (var key in computed) {
var userDef = computed[key];
var getter = typeof userDef === 'function' ? userDef : userDef.get;
if (process.env.NODE_ENV !== 'production' && getter == null) {
warn(
("Getter is missing for computed property \"" + key + "\"."),
vm
);
}
// create internal watcher for the computed property.
watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
// component-defined computed properties are already defined on the
// component prototype. We only need to define computed properties defined
// at instantiation here.
if (!(key in vm)) {
defineComputed(vm, key, userDef);
} else if (process.env.NODE_ENV !== 'production') {
if (key in vm.$data) {
warn(("The computed property \"" + key + "\" is already defined in data."), vm);
} else if (vm.$options.props && key in vm.$options.props) {
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
}
}
}
}
function defineComputed (target, key, userDef) {
if (typeof userDef === 'function') {
sharedPropertyDefinition.get = createComputedGetter(key);
sharedPropertyDefinition.set = noop;
} else {
sharedPropertyDefinition.get = userDef.get
? userDef.cache !== false
? createComputedGetter(key)
: userDef.get
: noop;
sharedPropertyDefinition.set = userDef.set
? userDef.set
: noop;
}
if (process.env.NODE_ENV !== 'production' &&
sharedPropertyDefinition.set === noop) {
sharedPropertyDefinition.set = function () {
warn(
("Computed property \"" + key + "\" was assigned to but it has no setter."),
this
);
};
}
Object.defineProperty(target, key, sharedPropertyDefinition);
}
function createComputedGetter (key) {
return function computedGetter () {
var watcher = this._computedWatchers && this._computedWatchers[key];
if (watcher) {
if (watcher.dirty) {
watcher.evaluate();
}
if (Dep.target) {
watcher.depend();
}
return watcher.value
}
}
}
function initMethods (vm, methods) {
process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'methods');
var props = vm.$options.props;
for (var key in methods) {
vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
if (process.env.NODE_ENV !== 'production') {
if (methods[key] == null) {
warn(
"method \"" + key + "\" has an undefined value in the component definition. " +
"Did you reference the function correctly?",
vm
);
}
if (props && hasOwn(props, key)) {
warn(
("method \"" + key + "\" has already been defined as a prop."),
vm
);
}
}
}
}
function initWatch (vm, watch) {
process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'watch');
for (var key in watch) {
var handler = watch[key];
if (Array.isArray(handler)) {
for (var i = 0; i < handler.length; i++) {
createWatcher(vm, key, handler[i]);
}
} else {
createWatcher(vm, key, handler);
}
}
}
function createWatcher (
vm,
keyOrFn,
handler,
options
) {
if (isPlainObject(handler)) {
options = handler;
handler = handler.handler;
}
if (typeof handler === 'string') {
handler = vm[handler];
}
return vm.$watch(keyOrFn, handler, options)
}
function stateMixin (Vue) {
// flow somehow has problems with directly declared definition object
// when using Object.defineProperty, so we have to procedurally build up
// the object here.
var dataDef = {};
dataDef.get = function () { return this._data };
var propsDef = {};
propsDef.get = function () { return this._props };
if (process.env.NODE_ENV !== 'production') {
dataDef.set = function (newData) {
warn(
'Avoid replacing instance root $data. ' +
'Use nested data properties instead.',
this
);
};
propsDef.set = function () {
warn("$props is readonly.", this);
};
}
Object.defineProperty(Vue.prototype, '$data', dataDef);
Object.defineProperty(Vue.prototype, '$props', propsDef);
Vue.prototype.$set = set;
Vue.prototype.$delete = del;
Vue.prototype.$watch = function (
expOrFn,
cb,
options
) {
var vm = this;
if (isPlainObject(cb)) {
return createWatcher(vm, expOrFn, cb, options)
}
options = options || {};
options.user = true;
var watcher = new Watcher(vm, expOrFn, cb, options);
if (options.immediate) {
cb.call(vm, watcher.value);
}
return function unwatchFn () {
watcher.teardown();
}
};
}
/* */
function initProvide (vm) {
var provide = vm.$options.provide;
if (provide) {
vm._provided = typeof provide === 'function'
? provide.call(vm)
: provide;
}
}
function initInjections (vm) {
var result = resolveInject(vm.$options.inject, vm);
if (result) {
observerState.shouldConvert = false;
Object.keys(result).forEach(function (key) {
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
defineReactive$$1(vm, key, result[key], function () {
warn(
"Avoid mutating an injected value directly since the changes will be " +
"overwritten whenever the provided component re-renders. " +
"injection being mutated: \"" + key + "\"",
vm
);
});
} else {
defineReactive$$1(vm, key, result[key]);
}
});
observerState.shouldConvert = true;
}
}
function resolveInject (inject, vm) {
if (inject) {
// inject is :any because flow is not smart enough to figure out cached
var result = Object.create(null);
var keys = hasSymbol
? Reflect.ownKeys(inject)
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var provideKey = inject[key];
var source = vm;
while (source) {
if (source._provided && provideKey in source._provided) {
result[key] = source._provided[provideKey];
break
}
source = source.$parent;
}
if (process.env.NODE_ENV !== 'production' && !source) {
warn(("Injection \"" + key + "\" not found"), vm);
}
}
return result
}
}
/* */
function createFunctionalComponent (
Ctor,
propsData,
data,
context,
children
) {
var props = {};
var propOptions = Ctor.options.props;
if (isDef(propOptions)) {
for (var key in propOptions) {
props[key] = validateProp(key, propOptions, propsData || {});
}
} else {
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
if (isDef(data.props)) { mergeProps(props, data.props); }
}
// ensure the createElement function in functional components
// gets a unique context - this is necessary for correct named slot check
var _context = Object.create(context);
var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
var vnode = Ctor.options.render.call(null, h, {
data: data,
props: props,
children: children,
parent: context,
listeners: data.on || {},
injections: resolveInject(Ctor.options.inject, context),
slots: function () { return resolveSlots(children, context); }
});
if (vnode instanceof VNode) {
vnode.functionalContext = context;
vnode.functionalOptions = Ctor.options;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
}
}
return vnode
}
function mergeProps (to, from) {
for (var key in from) {
to[camelize(key)] = from[key];
}
}
/* */
// hooks to be invoked on component VNodes during patch
var componentVNodeHooks = {
init: function init (
vnode,
hydrating,
parentElm,
refElm
) {
if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
var child = vnode.componentInstance = createComponentInstanceForVnode(
vnode,
activeInstance,
parentElm,
refElm
);
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
} else if (vnode.data.keepAlive) {
// kept-alive components, treat as a patch
var mountedNode = vnode; // work around flow
componentVNodeHooks.prepatch(mountedNode, mountedNode);
}
},
prepatch: function prepatch (oldVnode, vnode) {
var options = vnode.componentOptions;
var child = vnode.componentInstance = oldVnode.componentInstance;
updateChildComponent(
child,
options.propsData, // updated props
options.listeners, // updated listeners
vnode, // new parent vnode
options.children // new children
);
},
insert: function insert (vnode) {
var context = vnode.context;
var componentInstance = vnode.componentInstance;
if (!componentInstance._isMounted) {
componentInstance._isMounted = true;
callHook(componentInstance, 'mounted');
}
if (vnode.data.keepAlive) {
if (context._isMounted) {
// vue-router#1212
// During updates, a kept-alive component's child components may
// change, so directly walking the tree here may call activated hooks
// on incorrect children. Instead we push them into a queue which will
// be processed after the whole patch process ended.
queueActivatedComponent(componentInstance);
} else {
activateChildComponent(componentInstance, true /* direct */);
}
}
},
destroy: function destroy (vnode) {
var componentInstance = vnode.componentInstance;
if (!componentInstance._isDestroyed) {
if (!vnode.data.keepAlive) {
componentInstance.$destroy();
} else {
deactivateChildComponent(componentInstance, true /* direct */);
}
}
}
};
var hooksToMerge = Object.keys(componentVNodeHooks);
function createComponent (
Ctor,
data,
context,
children,
tag
) {
if (isUndef(Ctor)) {
return
}
var baseCtor = context.$options._base;
// plain options object: turn it into a constructor
if (isObject(Ctor)) {
Ctor = baseCtor.extend(Ctor);
}
// if at this stage it's not a constructor or an async component factory,
// reject.
if (typeof Ctor !== 'function') {
if (process.env.NODE_ENV !== 'production') {
warn(("Invalid Component definition: " + (String(Ctor))), context);
}
return
}
// async component
var asyncFactory;
if (isUndef(Ctor.cid)) {
asyncFactory = Ctor;
Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
if (Ctor === undefined) {
// return a placeholder node for async component, which is rendered
// as a comment node but preserves all the raw information for the node.
// the information will be used for async server-rendering and hydration.
return createAsyncPlaceholder(
asyncFactory,
data,
context,
children,
tag
)
}
}
data = data || {};
// resolve constructor options in case global mixins are applied after
// component constructor creation
resolveConstructorOptions(Ctor);
// transform component v-model data into props & events
if (isDef(data.model)) {
transformModel(Ctor.options, data);
}
// extract props
var propsData = extractPropsFromVNodeData(data, Ctor, tag);
// functional component
if (isTrue(Ctor.options.functional)) {
return createFunctionalComponent(Ctor, propsData, data, context, children)
}
// extract listeners, since these needs to be treated as
// child component listeners instead of DOM listeners
var listeners = data.on;
// replace with listeners with .native modifier
// so it gets processed during parent component patch.
data.on = data.nativeOn;
if (isTrue(Ctor.options.abstract)) {
// abstract components do not keep anything
// other than props & listeners & slot
// work around flow
var slot = data.slot;
data = {};
if (slot) {
data.slot = slot;
}
}
// merge component management hooks onto the placeholder node
mergeHooks(data);
// return a placeholder vnode
var name = Ctor.options.name || tag;
var vnode = new VNode(
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
data, undefined, undefined, undefined, context,
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
asyncFactory
);
return vnode
}
function createComponentInstanceForVnode (
vnode, // we know it's MountedComponentVNode but flow doesn't
parent, // activeInstance in lifecycle state
parentElm,
refElm
) {
var vnodeComponentOptions = vnode.componentOptions;
var options = {
_isComponent: true,
parent: parent,
propsData: vnodeComponentOptions.propsData,
_componentTag: vnodeComponentOptions.tag,
_parentVnode: vnode,
_parentListeners: vnodeComponentOptions.listeners,
_renderChildren: vnodeComponentOptions.children,
_parentElm: parentElm || null,
_refElm: refElm || null
};
// check inline-template render functions
var inlineTemplate = vnode.data.inlineTemplate;
if (isDef(inlineTemplate)) {
options.render = inlineTemplate.render;
options.staticRenderFns = inlineTemplate.staticRenderFns;
}
return new vnodeComponentOptions.Ctor(options)
}
function mergeHooks (data) {
if (!data.hook) {
data.hook = {};
}
for (var i = 0; i < hooksToMerge.length; i++) {
var key = hooksToMerge[i];
var fromParent = data.hook[key];
var ours = componentVNodeHooks[key];
data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
}
}
function mergeHook$1 (one, two) {
return function (a, b, c, d) {
one(a, b, c, d);
two(a, b, c, d);
}
}
// transform component v-model info (value and callback) into
// prop and event handler respectively.
function transformModel (options, data) {
var prop = (options.model && options.model.prop) || 'value';
var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
var on = data.on || (data.on = {});
if (isDef(on[event])) {
on[event] = [data.model.callback].concat(on[event]);
} else {
on[event] = data.model.callback;
}
}
/* */
var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
// without getting yelled at by flow
function createElement (
context,
tag,
data,
children,
normalizationType,
alwaysNormalize
) {
if (Array.isArray(data) || isPrimitive(data)) {
normalizationType = children;
children = data;
data = undefined;
}
if (isTrue(alwaysNormalize)) {
normalizationType = ALWAYS_NORMALIZE;
}
return _createElement(context, tag, data, children, normalizationType)
}
function _createElement (
context,
tag,
data,
children,
normalizationType
) {
if (isDef(data) && isDef((data).__ob__)) {
process.env.NODE_ENV !== 'production' && warn(
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
'Always create fresh vnode data objects in each render!',
context
);
return createEmptyVNode()
}
// object syntax in v-bind
if (isDef(data) && isDef(data.is)) {
tag = data.is;
}
if (!tag) {
// in case of component :is set to falsy value
return createEmptyVNode()
}
// warn against non-primitive key
if (process.env.NODE_ENV !== 'production' &&
isDef(data) && isDef(data.key) && !isPrimitive(data.key)
) {
warn(
'Avoid using non-primitive value as key, ' +
'use string/number value instead.',
context
);
}
// support single function children as default scoped slot
if (Array.isArray(children) &&
typeof children[0] === 'function'
) {
data = data || {};
data.scopedSlots = { default: children[0] };
children.length = 0;
}
if (normalizationType === ALWAYS_NORMALIZE) {
children = normalizeChildren(children);
} else if (normalizationType === SIMPLE_NORMALIZE) {
children = simpleNormalizeChildren(children);
}
var vnode, ns;
if (typeof tag === 'string') {
var Ctor;
ns = config.getTagNamespace(tag);
if (config.isReservedTag(tag)) {
// platform built-in elements
vnode = new VNode(
config.parsePlatformTagName(tag), data, children,
undefined, undefined, context
);
} else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
// component
vnode = createComponent(Ctor, data, context, children, tag);
} else {
// unknown or unlisted namespaced elements
// check at runtime because it may get assigned a namespace when its
// parent normalizes children
vnode = new VNode(
tag, data, children,
undefined, undefined, context
);
}
} else {
// direct component options / constructor
vnode = createComponent(tag, data, context, children);
}
if (isDef(vnode)) {
if (ns) { applyNS(vnode, ns); }
return vnode
} else {
return createEmptyVNode()
}
}
function applyNS (vnode, ns) {
vnode.ns = ns;
if (vnode.tag === 'foreignObject') {
// use default namespace inside foreignObject
return
}
if (isDef(vnode.children)) {
for (var i = 0, l = vnode.children.length; i < l; i++) {
var child = vnode.children[i];
if (isDef(child.tag) && isUndef(child.ns)) {
applyNS(child, ns);
}
}
}
}
/* */
/**
* Runtime helper for rendering v-for lists.
*/
function renderList (
val,
render
) {
var ret, i, l, keys, key;
if (Array.isArray(val) || typeof val === 'string') {
ret = new Array(val.length);
for (i = 0, l = val.length; i < l; i++) {
ret[i] = render(val[i], i);
}
} else if (typeof val === 'number') {
ret = new Array(val);
for (i = 0; i < val; i++) {
ret[i] = render(i + 1, i);
}
} else if (isObject(val)) {
keys = Object.keys(val);
ret = new Array(keys.length);
for (i = 0, l = keys.length; i < l; i++) {
key = keys[i];
ret[i] = render(val[key], key, i);
}
}
if (isDef(ret)) {
(ret)._isVList = true;
}
return ret
}
/* */
/**
* Runtime helper for rendering <slot>
*/
function renderSlot (
name,
fallback,
props,
bindObject
) {
var scopedSlotFn = this.$scopedSlots[name];
if (scopedSlotFn) { // scoped slot
props = props || {};
if (bindObject) {
props = extend(extend({}, bindObject), props);
}
return scopedSlotFn(props) || fallback
} else {
var slotNodes = this.$slots[name];
// warn duplicate slot usage
if (slotNodes && process.env.NODE_ENV !== 'production') {
slotNodes._rendered && warn(
"Duplicate presence of slot \"" + name + "\" found in the same render tree " +
"- this will likely cause render errors.",
this
);
slotNodes._rendered = true;
}
return slotNodes || fallback
}
}
/* */
/**
* Runtime helper for resolving filters
*/
function resolveFilter (id) {
return resolveAsset(this.$options, 'filters', id, true) || identity
}
/* */
/**
* Runtime helper for checking keyCodes from config.
*/
function checkKeyCodes (
eventKeyCode,
key,
builtInAlias
) {
var keyCodes = config.keyCodes[key] || builtInAlias;
if (Array.isArray(keyCodes)) {
return keyCodes.indexOf(eventKeyCode) === -1
} else {
return keyCodes !== eventKeyCode
}
}
/* */
/**
* Runtime helper for merging v-bind="object" into a VNode's data.
*/
function bindObjectProps (
data,
tag,
value,
asProp,
isSync
) {
if (value) {
if (!isObject(value)) {
process.env.NODE_ENV !== 'production' && warn(
'v-bind without argument expects an Object or Array value',
this
);
} else {
if (Array.isArray(value)) {
value = toObject(value);
}
var hash;
var loop = function ( key ) {
if (
key === 'class' ||
key === 'style' ||
isReservedAttribute(key)
) {
hash = data;
} else {
var type = data.attrs && data.attrs.type;
hash = asProp || config.mustUseProp(tag, type, key)
? data.domProps || (data.domProps = {})
: data.attrs || (data.attrs = {});
}
if (!(key in hash)) {
hash[key] = value[key];
if (isSync) {
var on = data.on || (data.on = {});
on[("update:" + key)] = function ($event) {
value[key] = $event;
};
}
}
};
for (var key in value) loop( key );
}
}
return data
}
/* */
/**
* Runtime helper for rendering static trees.
*/
function renderStatic (
index,
isInFor
) {
var tree = this._staticTrees[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
if (tree && !isInFor) {
return Array.isArray(tree)
? cloneVNodes(tree)
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = this._staticTrees[index] =
this.$options.staticRenderFns[index].call(this._renderProxy);
markStatic(tree, ("__static__" + index), false);
return tree
}
/**
* Runtime helper for v-once.
* Effectively it means marking the node as static with a unique key.
*/
function markOnce (
tree,
index,
key
) {
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
return tree
}
function markStatic (
tree,
key,
isOnce
) {
if (Array.isArray(tree)) {
for (var i = 0; i < tree.length; i++) {
if (tree[i] && typeof tree[i] !== 'string') {
markStaticNode(tree[i], (key + "_" + i), isOnce);
}
}
} else {
markStaticNode(tree, key, isOnce);
}
}
function markStaticNode (node, key, isOnce) {
node.isStatic = true;
node.key = key;
node.isOnce = isOnce;
}
/* */
function bindObjectListeners (data, value) {
if (value) {
if (!isPlainObject(value)) {
process.env.NODE_ENV !== 'production' && warn(
'v-on without argument expects an Object value',
this
);
} else {
var on = data.on = data.on ? extend({}, data.on) : {};
for (var key in value) {
var existing = on[key];
var ours = value[key];
on[key] = existing ? [].concat(ours, existing) : ours;
}
}
}
return data
}
/* */
function initRender (vm) {
vm._vnode = null; // the root of the child tree
vm._staticTrees = null;
var parentVnode = vm.$vnode = vm.$options._parentVnode; // the placeholder node in parent tree
var renderContext = parentVnode && parentVnode.context;
vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
vm.$scopedSlots = emptyObject;
// bind the createElement fn to this instance
// so that we get proper render context inside it.
// args order: tag, data, children, normalizationType, alwaysNormalize
// internal version is used by render functions compiled from templates
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
// normalization is always applied for the public version, used in
// user-written render functions.
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
// $attrs & $listeners are exposed for easier HOC creation.
// they need to be reactive so that HOCs using them are always updated
var parentData = parentVnode && parentVnode.data;
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, function () {
!isUpdatingChildComponent && warn("$attrs is readonly.", vm);
}, true);
defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, function () {
!isUpdatingChildComponent && warn("$listeners is readonly.", vm);
}, true);
} else {
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, null, true);
defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, null, true);
}
}
function renderMixin (Vue) {
Vue.prototype.$nextTick = function (fn) {
return nextTick(fn, this)
};
Vue.prototype._render = function () {
var vm = this;
var ref = vm.$options;
var render = ref.render;
var staticRenderFns = ref.staticRenderFns;
var _parentVnode = ref._parentVnode;
if (vm._isMounted) {
// clone slot nodes on re-renders
for (var key in vm.$slots) {
vm.$slots[key] = cloneVNodes(vm.$slots[key]);
}
}
vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
if (staticRenderFns && !vm._staticTrees) {
vm._staticTrees = [];
}
// set parent vnode. this allows render functions to have access
// to the data on the placeholder node.
vm.$vnode = _parentVnode;
// render self
var vnode;
try {
vnode = render.call(vm._renderProxy, vm.$createElement);
} catch (e) {
handleError(e, vm, "render function");
// return error render result,
// or previous vnode to prevent render error causing blank component
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
vnode = vm.$options.renderError
? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
: vm._vnode;
} else {
vnode = vm._vnode;
}
}
// return empty vnode in case the render function errored out
if (!(vnode instanceof VNode)) {
if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
warn(
'Multiple root nodes returned from render function. Render function ' +
'should return a single root node.',
vm
);
}
vnode = createEmptyVNode();
}
// set parent
vnode.parent = _parentVnode;
return vnode
};
// internal render helpers.
// these are exposed on the instance prototype to reduce generated render
// code size.
Vue.prototype._o = markOnce;
Vue.prototype._n = toNumber;
Vue.prototype._s = toString;
Vue.prototype._l = renderList;
Vue.prototype._t = renderSlot;
Vue.prototype._q = looseEqual;
Vue.prototype._i = looseIndexOf;
Vue.prototype._m = renderStatic;
Vue.prototype._f = resolveFilter;
Vue.prototype._k = checkKeyCodes;
Vue.prototype._b = bindObjectProps;
Vue.prototype._v = createTextVNode;
Vue.prototype._e = createEmptyVNode;
Vue.prototype._u = resolveScopedSlots;
Vue.prototype._g = bindObjectListeners;
}
/* */
var uid = 0;
function initMixin (Vue) {
Vue.prototype._init = function (options) {
var vm = this;
// a uid
vm._uid = uid++;
var startTag, endTag;
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
startTag = "vue-perf-init:" + (vm._uid);
endTag = "vue-perf-end:" + (vm._uid);
mark(startTag);
}
// a flag to avoid this being observed
vm._isVue = true;
// merge options
if (options && options._isComponent) {
// optimize internal component instantiation
// since dynamic options merging is pretty slow, and none of the
// internal component options needs special treatment.
initInternalComponent(vm, options);
} else {
vm.$options = mergeOptions(
resolveConstructorOptions(vm.constructor),
options || {},
vm
);
}
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
initProxy(vm);
} else {
vm._renderProxy = vm;
}
// expose real self
vm._self = vm;
initLifecycle(vm);
initEvents(vm);
initRender(vm);
callHook(vm, 'beforeCreate');
initInjections(vm); // resolve injections before data/props
initState(vm);
initProvide(vm); // resolve provide after data/props
callHook(vm, 'created');
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
vm._name = formatComponentName(vm, false);
mark(endTag);
measure(((vm._name) + " init"), startTag, endTag);
}
if (vm.$options.el) {
vm.$mount(vm.$options.el);
}
};
}
function initInternalComponent (vm, options) {
var opts = vm.$options = Object.create(vm.constructor.options);
// doing this because it's faster than dynamic enumeration.
opts.parent = options.parent;
opts.propsData = options.propsData;
opts._parentVnode = options._parentVnode;
opts._parentListeners = options._parentListeners;
opts._renderChildren = options._renderChildren;
opts._componentTag = options._componentTag;
opts._parentElm = options._parentElm;
opts._refElm = options._refElm;
if (options.render) {
opts.render = options.render;
opts.staticRenderFns = options.staticRenderFns;
}
}
function resolveConstructorOptions (Ctor) {
var options = Ctor.options;
if (Ctor.super) {
var superOptions = resolveConstructorOptions(Ctor.super);
var cachedSuperOptions = Ctor.superOptions;
if (superOptions !== cachedSuperOptions) {
// super option changed,
// need to resolve new options.
Ctor.superOptions = superOptions;
// check if there are any late-modified/attached options (#4976)
var modifiedOptions = resolveModifiedOptions(Ctor);
// update base extend options
if (modifiedOptions) {
extend(Ctor.extendOptions, modifiedOptions);
}
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
if (options.name) {
options.components[options.name] = Ctor;
}
}
}
return options
}
function resolveModifiedOptions (Ctor) {
var modified;
var latest = Ctor.options;
var extended = Ctor.extendOptions;
var sealed = Ctor.sealedOptions;
for (var key in latest) {
if (latest[key] !== sealed[key]) {
if (!modified) { modified = {}; }
modified[key] = dedupe(latest[key], extended[key], sealed[key]);
}
}
return modified
}
function dedupe (latest, extended, sealed) {
// compare latest and sealed to ensure lifecycle hooks won't be duplicated
// between merges
if (Array.isArray(latest)) {
var res = [];
sealed = Array.isArray(sealed) ? sealed : [sealed];
extended = Array.isArray(extended) ? extended : [extended];
for (var i = 0; i < latest.length; i++) {
// push original options and not sealed options to exclude duplicated options
if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
res.push(latest[i]);
}
}
return res
} else {
return latest
}
}
function Vue$3 (options) {
if (process.env.NODE_ENV !== 'production' &&
!(this instanceof Vue$3)
) {
warn('Vue is a constructor and should be called with the `new` keyword');
}
this._init(options);
}
initMixin(Vue$3);
stateMixin(Vue$3);
eventsMixin(Vue$3);
lifecycleMixin(Vue$3);
renderMixin(Vue$3);
/* */
function initUse (Vue) {
Vue.use = function (plugin) {
var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
if (installedPlugins.indexOf(plugin) > -1) {
return this
}
// additional parameters
var args = toArray(arguments, 1);
args.unshift(this);
if (typeof plugin.install === 'function') {
plugin.install.apply(plugin, args);
} else if (typeof plugin === 'function') {
plugin.apply(null, args);
}
installedPlugins.push(plugin);
return this
};
}
/* */
function initMixin$1 (Vue) {
Vue.mixin = function (mixin) {
this.options = mergeOptions(this.options, mixin);
return this
};
}
/* */
function initExtend (Vue) {
/**
* Each instance constructor, including Vue, has a unique
* cid. This enables us to create wrapped "child
* constructors" for prototypal inheritance and cache them.
*/
Vue.cid = 0;
var cid = 1;
/**
* Class inheritance
*/
Vue.extend = function (extendOptions) {
extendOptions = extendOptions || {};
var Super = this;
var SuperId = Super.cid;
var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
if (cachedCtors[SuperId]) {
return cachedCtors[SuperId]
}
var name = extendOptions.name || Super.options.name;
if (process.env.NODE_ENV !== 'production') {
if (!/^[a-zA-Z][\w-]*$/.test(name)) {
warn(
'Invalid component name: "' + name + '". Component names ' +
'can only contain alphanumeric characters and the hyphen, ' +
'and must start with a letter.'
);
}
}
var Sub = function VueComponent (options) {
this._init(options);
};
Sub.prototype = Object.create(Super.prototype);
Sub.prototype.constructor = Sub;
Sub.cid = cid++;
Sub.options = mergeOptions(
Super.options,
extendOptions
);
Sub['super'] = Super;
// For props and computed properties, we define the proxy getters on
// the Vue instances at extension time, on the extended prototype. This
// avoids Object.defineProperty calls for each instance created.
if (Sub.options.props) {
initProps$1(Sub);
}
if (Sub.options.computed) {
initComputed$1(Sub);
}
// allow further extension/mixin/plugin usage
Sub.extend = Super.extend;
Sub.mixin = Super.mixin;
Sub.use = Super.use;
// create asset registers, so extended classes
// can have their private assets too.
ASSET_TYPES.forEach(function (type) {
Sub[type] = Super[type];
});
// enable recursive self-lookup
if (name) {
Sub.options.components[name] = Sub;
}
// keep a reference to the super options at extension time.
// later at instantiation we can check if Super's options have
// been updated.
Sub.superOptions = Super.options;
Sub.extendOptions = extendOptions;
Sub.sealedOptions = extend({}, Sub.options);
// cache constructor
cachedCtors[SuperId] = Sub;
return Sub
};
}
function initProps$1 (Comp) {
var props = Comp.options.props;
for (var key in props) {
proxy(Comp.prototype, "_props", key);
}
}
function initComputed$1 (Comp) {
var computed = Comp.options.computed;
for (var key in computed) {
defineComputed(Comp.prototype, key, computed[key]);
}
}
/* */
function initAssetRegisters (Vue) {
/**
* Create asset registration methods.
*/
ASSET_TYPES.forEach(function (type) {
Vue[type] = function (
id,
definition
) {
if (!definition) {
return this.options[type + 's'][id]
} else {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production') {
if (type === 'component' && config.isReservedTag(id)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + id
);
}
}
if (type === 'component' && isPlainObject(definition)) {
definition.name = definition.name || id;
definition = this.options._base.extend(definition);
}
if (type === 'directive' && typeof definition === 'function') {
definition = { bind: definition, update: definition };
}
this.options[type + 's'][id] = definition;
return definition
}
};
});
}
/* */
var patternTypes = [String, RegExp, Array];
function getComponentName (opts) {
return opts && (opts.Ctor.options.name || opts.tag)
}
function matches (pattern, name) {
if (Array.isArray(pattern)) {
return pattern.indexOf(name) > -1
} else if (typeof pattern === 'string') {
return pattern.split(',').indexOf(name) > -1
} else if (isRegExp(pattern)) {
return pattern.test(name)
}
/* istanbul ignore next */
return false
}
function pruneCache (cache, current, filter) {
for (var key in cache) {
var cachedNode = cache[key];
if (cachedNode) {
var name = getComponentName(cachedNode.componentOptions);
if (name && !filter(name)) {
if (cachedNode !== current) {
pruneCacheEntry(cachedNode);
}
cache[key] = null;
}
}
}
}
function pruneCacheEntry (vnode) {
if (vnode) {
vnode.componentInstance.$destroy();
}
}
var KeepAlive = {
name: 'keep-alive',
abstract: true,
props: {
include: patternTypes,
exclude: patternTypes
},
created: function created () {
this.cache = Object.create(null);
},
destroyed: function destroyed () {
var this$1 = this;
for (var key in this$1.cache) {
pruneCacheEntry(this$1.cache[key]);
}
},
watch: {
include: function include (val) {
pruneCache(this.cache, this._vnode, function (name) { return matches(val, name); });
},
exclude: function exclude (val) {
pruneCache(this.cache, this._vnode, function (name) { return !matches(val, name); });
}
},
render: function render () {
var vnode = getFirstComponentChild(this.$slots.default);
var componentOptions = vnode && vnode.componentOptions;
if (componentOptions) {
// check pattern
var name = getComponentName(componentOptions);
if (name && (
(this.include && !matches(this.include, name)) ||
(this.exclude && matches(this.exclude, name))
)) {
return vnode
}
var key = vnode.key == null
// same constructor may get registered as different local components
// so cid alone is not enough (#3269)
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
: vnode.key;
if (this.cache[key]) {
vnode.componentInstance = this.cache[key].componentInstance;
} else {
this.cache[key] = vnode;
}
vnode.data.keepAlive = true;
}
return vnode
}
};
var builtInComponents = {
KeepAlive: KeepAlive
};
/* */
function initGlobalAPI (Vue) {
// config
var configDef = {};
configDef.get = function () { return config; };
if (process.env.NODE_ENV !== 'production') {
configDef.set = function () {
warn(
'Do not replace the Vue.config object, set individual fields instead.'
);
};
}
Object.defineProperty(Vue, 'config', configDef);
// exposed util methods.
// NOTE: these are not considered part of the public API - avoid relying on
// them unless you are aware of the risk.
Vue.util = {
warn: warn,
extend: extend,
mergeOptions: mergeOptions,
defineReactive: defineReactive$$1
};
Vue.set = set;
Vue.delete = del;
Vue.nextTick = nextTick;
Vue.options = Object.create(null);
ASSET_TYPES.forEach(function (type) {
Vue.options[type + 's'] = Object.create(null);
});
// this is used to identify the "base" constructor to extend all plain-object
// components with in Weex's multi-instance scenarios.
Vue.options._base = Vue;
extend(Vue.options.components, builtInComponents);
initUse(Vue);
initMixin$1(Vue);
initExtend(Vue);
initAssetRegisters(Vue);
}
initGlobalAPI(Vue$3);
Object.defineProperty(Vue$3.prototype, '$isServer', {
get: isServerRendering
});
Object.defineProperty(Vue$3.prototype, '$ssrContext', {
get: function get () {
/* istanbul ignore next */
return this.$vnode && this.$vnode.ssrContext
}
});
Vue$3.version = '2.4.2';
/* */
// these are reserved for web because they are directly compiled away
// during template compilation
var isReservedAttr = makeMap('style,class');
// attributes that should be using props for binding
var acceptValue = makeMap('input,textarea,option,select');
var mustUseProp = function (tag, type, attr) {
return (
(attr === 'value' && acceptValue(tag)) && type !== 'button' ||
(attr === 'selected' && tag === 'option') ||
(attr === 'checked' && tag === 'input') ||
(attr === 'muted' && tag === 'video')
)
};
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
'required,reversed,scoped,seamless,selected,sortable,translate,' +
'truespeed,typemustmatch,visible'
);
var xlinkNS = 'http://www.w3.org/1999/xlink';
var isXlink = function (name) {
return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
};
var getXlinkProp = function (name) {
return isXlink(name) ? name.slice(6, name.length) : ''
};
var isFalsyAttrValue = function (val) {
return val == null || val === false
};
/* */
function genClassForVnode (vnode) {
var data = vnode.data;
var parentNode = vnode;
var childNode = vnode;
while (isDef(childNode.componentInstance)) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while (isDef(parentNode = parentNode.parent)) {
if (parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
return renderClass(data.staticClass, data.class)
}
function mergeClassData (child, parent) {
return {
staticClass: concat(child.staticClass, parent.staticClass),
class: isDef(child.class)
? [child.class, parent.class]
: parent.class
}
}
function renderClass (
staticClass,
dynamicClass
) {
if (isDef(staticClass) || isDef(dynamicClass)) {
return concat(staticClass, stringifyClass(dynamicClass))
}
/* istanbul ignore next */
return ''
}
function concat (a, b) {
return a ? b ? (a + ' ' + b) : a : (b || '')
}
function stringifyClass (value) {
if (Array.isArray(value)) {
return stringifyArray(value)
}
if (isObject(value)) {
return stringifyObject(value)
}
if (typeof value === 'string') {
return value
}
/* istanbul ignore next */
return ''
}
function stringifyArray (value) {
var res = '';
var stringified;
for (var i = 0, l = value.length; i < l; i++) {
if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
if (res) { res += ' '; }
res += stringified;
}
}
return res
}
function stringifyObject (value) {
var res = '';
for (var key in value) {
if (value[key]) {
if (res) { res += ' '; }
res += key;
}
}
return res
}
/* */
var namespaceMap = {
svg: 'http://www.w3.org/2000/svg',
math: 'http://www.w3.org/1998/Math/MathML'
};
var isHTMLTag = makeMap(
'html,body,base,head,link,meta,style,title,' +
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
'embed,object,param,source,canvas,script,noscript,del,ins,' +
'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
'output,progress,select,textarea,' +
'details,dialog,menu,menuitem,summary,' +
'content,element,shadow,template,blockquote,iframe,tfoot'
);
// this map is intentionally selective, only covering SVG elements that may
// contain child elements.
var isSVG = makeMap(
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
true
);
// Lynx Modify
var isLynxTag = makeMap(
'view,label,img,listview,scrollview,viewstub, canvas'
);
var isReservedTag = function (tag) {
//return isHTMLTag(tag) || isSVG(tag)
return isLynxTag(tag)
};
function getTagNamespace (tag) {
// Lynx Modify
// if (isSVG(tag)) {
// return 'svg'
// }
// // basic support for MathML
// // note it doesn't support other MathML elements being component roots
// if (tag === 'math') {
// return 'math'
// }
}
function isUnknownElement (tag) {
// Lynx Modify
if(isLynxTag(tag)) {
return false
}
return true
// /* istanbul ignore if */
// if (!inBrowser) {
// return true
// }
// if (isReservedTag(tag)) {
// return false
// }
// tag = tag.toLowerCase()
// /* istanbul ignore if */
// if (unknownElementCache[tag] != null) {
// return unknownElementCache[tag]
// }
// const el = document.createElement(tag)
// if (tag.indexOf('-') > -1) {
// // http://stackoverflow.com/a/28210364/1070244
// return (unknownElementCache[tag] = (
// el.constructor === window.HTMLUnknownElement ||
// el.constructor === window.HTMLElement
// ))
// } else {
// return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
// }
}
/* */
/**
* Query an element selector if it's not an element already.
*/
function query (el) {
if (typeof el === 'string') {
var selected = document.querySelector(el);
if (!selected) {
process.env.NODE_ENV !== 'production' && warn(
'Cannot find element: ' + el
);
return document.createElement('div')
}
return selected
} else {
return el
}
}
/* */
function createElement$1 (tagName, vnode) {
var elm = document.createElement(tagName);
if (tagName !== 'select') {
return elm
}
// false or null will remove the attribute but undefined will not
if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
elm.setAttribute('multiple', 'multiple');
}
return elm
}
function createElementNS (namespace, tagName) {
return document.createElementNS(namespaceMap[namespace], tagName)
}
function createTextNode (text) {
return document.createTextNode(text)
}
function createComment (text) {
// Lynx Modify
return document.createElement('view')
}
function insertBefore (parentNode, newNode, referenceNode) {
parentNode.insertBefore(newNode, referenceNode);
}
function removeChild (node, child) {
node.removeChild(child);
}
function appendChild (node, child) {
node.appendChild(child);
}
function parentNode (node) {
return node.parentNode
}
function nextSibling (node) {
return node.nextSibling
}
function tagName (node) {
return node.tagName
}
function setTextContent (node, text) {
node.textContent = text;
}
function setAttribute (node, key, val) {
node.setAttribute(key, val);
}
var nodeOps = Object.freeze({
createElement: createElement$1,
createElementNS: createElementNS,
createTextNode: createTextNode,
createComment: createComment,
insertBefore: insertBefore,
removeChild: removeChild,
appendChild: appendChild,
parentNode: parentNode,
nextSibling: nextSibling,
tagName: tagName,
setTextContent: setTextContent,
setAttribute: setAttribute
});
/* */
var ref = {
create: function create (_, vnode) {
registerRef(vnode);
},
update: function update (oldVnode, vnode) {
if (oldVnode.data.ref !== vnode.data.ref) {
registerRef(oldVnode, true);
registerRef(vnode);
}
},
destroy: function destroy (vnode) {
registerRef(vnode, true);
}
};
function registerRef (vnode, isRemoval) {
var key = vnode.data.ref;
if (!key) { return }
var vm = vnode.context;
var ref = vnode.componentInstance || vnode.elm;
var refs = vm.$refs;
if (isRemoval) {
if (Array.isArray(refs[key])) {
remove(refs[key], ref);
} else if (refs[key] === ref) {
refs[key] = undefined;
}
} else {
if (vnode.data.refInFor) {
if (!Array.isArray(refs[key])) {
refs[key] = [ref];
} else if (refs[key].indexOf(ref) < 0) {
// $flow-disable-line
refs[key].push(ref);
}
} else {
refs[key] = ref;
}
}
}
/**
* Virtual DOM patching algorithm based on Snabbdom by
* Simon Friis Vindum (@paldepind)
* Licensed under the MIT License
* https://github.com/paldepind/snabbdom/blob/master/LICENSE
*
* modified by Evan You (@yyx990803)
*
/*
* Not type-checking this because this file is perf-critical and the cost
* of making flow understand it is not worth it.
*/
var emptyNode = new VNode('', {}, []);
var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
function sameVnode (a, b) {
return (
a.key === b.key && (
(
a.tag === b.tag &&
a.isComment === b.isComment &&
isDef(a.data) === isDef(b.data) &&
sameInputType(a, b)
) || (
isTrue(a.isAsyncPlaceholder) &&
a.asyncFactory === b.asyncFactory &&
isUndef(b.asyncFactory.error)
)
)
)
}
// Some browsers do not support dynamically changing type for <input>
// so they need to be treated as different nodes
function sameInputType (a, b) {
if (a.tag !== 'input') { return true }
var i;
var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
return typeA === typeB
}
function createKeyToOldIdx (children, beginIdx, endIdx) {
var i, key;
var map = {};
for (i = beginIdx; i <= endIdx; ++i) {
key = children[i].key;
if (isDef(key)) { map[key] = i; }
}
return map
}
function createPatchFunction (backend) {
var i, j;
var cbs = {};
var modules = backend.modules;
var nodeOps = backend.nodeOps;
for (i = 0; i < hooks.length; ++i) {
cbs[hooks[i]] = [];
for (j = 0; j < modules.length; ++j) {
if (isDef(modules[j][hooks[i]])) {
cbs[hooks[i]].push(modules[j][hooks[i]]);
}
}
}
function emptyNodeAt (elm) {
return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
}
function createRmCb (childElm, listeners) {
function remove$$1 () {
if (--remove$$1.listeners === 0) {
removeNode(childElm);
}
}
remove$$1.listeners = listeners;
return remove$$1
}
function removeNode (el) {
var parent = nodeOps.parentNode(el);
// element may have already been removed due to v-html / v-text
if (isDef(parent)) {
nodeOps.removeChild(parent, el);
}
}
var inPre = 0;
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
vnode.isRootInsert = !nested; // for transition enter check
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
return
}
var data = vnode.data;
var children = vnode.children;
var tag = vnode.tag;
if (isDef(tag)) {
if (process.env.NODE_ENV !== 'production') {
if (data && data.pre) {
inPre++;
}
if (
!inPre &&
!vnode.ns &&
!(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
config.isUnknownElement(tag)
) {
warn(
'Unknown custom element: <' + tag + '> - did you ' +
'register the component correctly? For recursive components, ' +
'make sure to provide the "name" option.',
vnode.context
);
}
}
vnode.elm = vnode.ns
? nodeOps.createElementNS(vnode.ns, tag)
: nodeOps.createElement(tag, vnode);
setScope(vnode);
/* istanbul ignore if */
{
createChildren(vnode, children, insertedVnodeQueue);
if (isDef(data)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
}
insert(parentElm, vnode.elm, refElm);
}
if (process.env.NODE_ENV !== 'production' && data && data.pre) {
inPre--;
}
} else if (isTrue(vnode.isComment)) {
vnode.elm = nodeOps.createComment(vnode.text);
insert(parentElm, vnode.elm, refElm);
} else {
vnode.elm = nodeOps.createTextNode(vnode.text);
insert(parentElm, vnode.elm, refElm);
}
}
function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
var i = vnode.data;
if (isDef(i)) {
var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
if (isDef(i = i.hook) && isDef(i = i.init)) {
i(vnode, false /* hydrating */, parentElm, refElm);
}
// after calling the init hook, if the vnode is a child component
// it should've created a child instance and mounted it. the child
// component also has set the placeholder vnode's elm.
// in that case we can just return the element and be done.
if (isDef(vnode.componentInstance)) {
initComponent(vnode, insertedVnodeQueue);
if (isTrue(isReactivated)) {
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
}
return true
}
}
}
function initComponent (vnode, insertedVnodeQueue) {
if (isDef(vnode.data.pendingInsert)) {
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
vnode.data.pendingInsert = null;
}
vnode.elm = vnode.componentInstance.$el;
if (isPatchable(vnode)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
setScope(vnode);
} else {
// empty component root.
// skip all element-related modules except for ref (#3455)
registerRef(vnode);
// make sure to invoke the insert hook
insertedVnodeQueue.push(vnode);
}
}
function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
var i;
// hack for #4339: a reactivated component with inner transition
// does not trigger because the inner node's created hooks are not called
// again. It's not ideal to involve module-specific logic in here but
// there doesn't seem to be a better way to do it.
var innerNode = vnode;
while (innerNode.componentInstance) {
innerNode = innerNode.componentInstance._vnode;
if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
for (i = 0; i < cbs.activate.length; ++i) {
cbs.activate[i](emptyNode, innerNode);
}
insertedVnodeQueue.push(innerNode);
break
}
}
// unlike a newly created component,
// a reactivated keep-alive component doesn't insert itself
insert(parentElm, vnode.elm, refElm);
}
function insert (parent, elm, ref$$1) {
if (isDef(parent)) {
if (isDef(ref$$1)) {
if (ref$$1.parentNode === parent) {
nodeOps.insertBefore(parent, elm, ref$$1);
}
} else {
nodeOps.appendChild(parent, elm);
}
}
}
function createChildren (vnode, children, insertedVnodeQueue) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; ++i) {
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
}
} else if (isPrimitive(vnode.text)) {
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
}
}
function isPatchable (vnode) {
while (vnode.componentInstance) {
vnode = vnode.componentInstance._vnode;
}
return isDef(vnode.tag)
}
function invokeCreateHooks (vnode, insertedVnodeQueue) {
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
cbs.create[i$1](emptyNode, vnode);
}
i = vnode.data.hook; // Reuse variable
if (isDef(i)) {
if (isDef(i.create)) { i.create(emptyNode, vnode); }
if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
}
}
// set scope id attribute for scoped CSS.
// this is implemented as a special case to avoid the overhead
// of going through the normal attribute patching process.
function setScope (vnode) {
var i;
var ancestor = vnode;
while (ancestor) {
if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
nodeOps.setAttribute(vnode.elm, i, '');
}
ancestor = ancestor.parent;
}
// for slot content they should also get the scopeId from the host instance.
if (isDef(i = activeInstance) &&
i !== vnode.context &&
isDef(i = i.$options._scopeId)
) {
nodeOps.setAttribute(vnode.elm, i, '');
}
}
function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
for (; startIdx <= endIdx; ++startIdx) {
createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
}
}
function invokeDestroyHook (vnode) {
var i, j;
var data = vnode.data;
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
}
if (isDef(i = vnode.children)) {
for (j = 0; j < vnode.children.length; ++j) {
invokeDestroyHook(vnode.children[j]);
}
}
}
function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
for (; startIdx <= endIdx; ++startIdx) {
var ch = vnodes[startIdx];
if (isDef(ch)) {
if (isDef(ch.tag)) {
removeAndInvokeRemoveHook(ch);
invokeDestroyHook(ch);
} else { // Text node
removeNode(ch.elm);
}
}
}
}
function removeAndInvokeRemoveHook (vnode, rm) {
if (isDef(rm) || isDef(vnode.data)) {
var i;
var listeners = cbs.remove.length + 1;
if (isDef(rm)) {
// we have a recursively passed down rm callback
// increase the listeners count
rm.listeners += listeners;
} else {
// directly removing
rm = createRmCb(vnode.elm, listeners);
}
// recursively invoke hooks on child component root node
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
removeAndInvokeRemoveHook(i, rm);
}
for (i = 0; i < cbs.remove.length; ++i) {
cbs.remove[i](vnode, rm);
}
if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
i(vnode, rm);
} else {
rm();
}
} else {
removeNode(vnode.elm);
}
}
function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
var oldStartIdx = 0;
var newStartIdx = 0;
var oldEndIdx = oldCh.length - 1;
var oldStartVnode = oldCh[0];
var oldEndVnode = oldCh[oldEndIdx];
var newEndIdx = newCh.length - 1;
var newStartVnode = newCh[0];
var newEndVnode = newCh[newEndIdx];
var oldKeyToIdx, idxInOld, elmToMove, refElm;
// removeOnly is a special flag used only by <transition-group>
// to ensure removed elements stay in correct relative positions
// during leaving transitions
var canMove = !removeOnly;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (isUndef(oldStartVnode)) {
oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
} else if (isUndef(oldEndVnode)) {
oldEndVnode = oldCh[--oldEndIdx];
} else if (sameVnode(oldStartVnode, newStartVnode)) {
patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
} else if (sameVnode(oldEndVnode, newEndVnode)) {
patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
} else {
if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
if (isUndef(idxInOld)) { // New element
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
} else {
elmToMove = oldCh[idxInOld];
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && !elmToMove) {
warn(
'It seems there are duplicate keys that is causing an update error. ' +
'Make sure each v-for item has a unique key.'
);
}
if (sameVnode(elmToMove, newStartVnode)) {
patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
oldCh[idxInOld] = undefined;
canMove && nodeOps.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
} else {
// same key but different element. treat as new element
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
}
}
}
}
if (oldStartIdx > oldEndIdx) {
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
} else if (newStartIdx > newEndIdx) {
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
}
}
function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
if (oldVnode === vnode) {
return
}
var elm = vnode.elm = oldVnode.elm;
if (isTrue(oldVnode.isAsyncPlaceholder)) {
if (isDef(vnode.asyncFactory.resolved)) {
hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
} else {
vnode.isAsyncPlaceholder = true;
}
return
}
// reuse element for static trees.
// note we only do this if the vnode is cloned -
// if the new node is not cloned it means the render functions have been
// reset by the hot-reload-api and we need to do a proper re-render.
if (isTrue(vnode.isStatic) &&
isTrue(oldVnode.isStatic) &&
vnode.key === oldVnode.key &&
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
) {
vnode.componentInstance = oldVnode.componentInstance;
return
}
var i;
var data = vnode.data;
if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
i(oldVnode, vnode);
}
var oldCh = oldVnode.children;
var ch = vnode.children;
if (isDef(data) && isPatchable(vnode)) {
for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
}
if (isUndef(vnode.text)) {
if (isDef(oldCh) && isDef(ch)) {
if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
} else if (isDef(ch)) {
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
} else if (isDef(oldCh)) {
removeVnodes(elm, oldCh, 0, oldCh.length - 1);
} else if (isDef(oldVnode.text)) {
nodeOps.setTextContent(elm, '');
}
} else if (oldVnode.text !== vnode.text) {
nodeOps.setTextContent(elm, vnode.text);
}
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
}
}
function invokeInsertHook (vnode, queue, initial) {
// delay insert hooks for component root nodes, invoke them after the
// element is really inserted
if (isTrue(initial) && isDef(vnode.parent)) {
vnode.parent.data.pendingInsert = queue;
} else {
for (var i = 0; i < queue.length; ++i) {
queue[i].data.hook.insert(queue[i]);
}
}
}
var bailed = false;
// list of modules that can skip create hook during hydration because they
// are already rendered on the client or has no need for initialization
var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
// Note: this is a browser-only function so we can assume elms are DOM nodes.
function hydrate (elm, vnode, insertedVnodeQueue) {
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.elm = elm;
vnode.isAsyncPlaceholder = true;
return true
}
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode)) {
return false
}
}
vnode.elm = elm;
var tag = vnode.tag;
var data = vnode.data;
var children = vnode.children;
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
if (isDef(i = vnode.componentInstance)) {
// child component. it should have hydrated its own tree.
initComponent(vnode, insertedVnodeQueue);
return true
}
}
if (isDef(tag)) {
if (isDef(children)) {
// empty element, allow client to pick up and populate children
if (!elm.hasChildNodes()) {
createChildren(vnode, children, insertedVnodeQueue);
} else {
var childrenMatch = true;
var childNode = elm.firstChild;
for (var i$1 = 0; i$1 < children.length; i$1++) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
childrenMatch = false;
break
}
childNode = childNode.nextSibling;
}
// if childNode is not null, it means the actual childNodes list is
// longer than the virtual children list.
if (!childrenMatch || childNode) {
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed
) {
bailed = true;
console.warn('Parent: ', elm);
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
}
return false
}
}
}
if (isDef(data)) {
for (var key in data) {
if (!isRenderedModule(key)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
break
}
}
}
} else if (elm.data !== vnode.text) {
elm.data = vnode.text;
}
return true
}
function assertNodeMatch (node, vnode) {
if (isDef(vnode.tag)) {
return (
vnode.tag.indexOf('vue-component') === 0 ||
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
)
} else {
return node.nodeType === (vnode.isComment ? 8 : 3)
}
}
return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
if (isUndef(vnode)) {
if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
return
}
var isInitialPatch = false;
var insertedVnodeQueue = [];
if (isUndef(oldVnode)) {
// empty mount (likely as component), create new root element
isInitialPatch = true;
createElm(vnode, insertedVnodeQueue, parentElm, refElm);
} else {
var isRealElement = isDef(oldVnode.nodeType);
if (!isRealElement && sameVnode(oldVnode, vnode)) {
// patch existing root node
patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
} else {
if (isRealElement) {
// mounting to a real element
// check if this is server-rendered content and if we can perform
// a successful hydration.
if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
oldVnode.removeAttribute(SSR_ATTR);
hydrating = true;
}
if (isTrue(hydrating)) {
if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
invokeInsertHook(vnode, insertedVnodeQueue, true);
return oldVnode
} else if (process.env.NODE_ENV !== 'production') {
warn(
'The client-side rendered virtual DOM tree is not matching ' +
'server-rendered content. This is likely caused by incorrect ' +
'HTML markup, for example nesting block-level elements inside ' +
'<p>, or missing <tbody>. Bailing hydration and performing ' +
'full client-side render.'
);
}
}
// either not server-rendered, or hydration failed.
// create an empty node and replace it
oldVnode = emptyNodeAt(oldVnode);
}
// replacing existing element
var oldElm = oldVnode.elm;
var parentElm$1 = nodeOps.parentNode(oldElm);
createElm(
vnode,
insertedVnodeQueue,
// extremely rare edge case: do not insert if old element is in a
// leaving transition. Only happens when combining transition +
// keep-alive + HOCs. (#4590)
oldElm._leaveCb ? null : parentElm$1,
nodeOps.nextSibling(oldElm)
);
if (isDef(vnode.parent)) {
// component root element replaced.
// update parent placeholder node element, recursively
var ancestor = vnode.parent;
while (ancestor) {
ancestor.elm = vnode.elm;
ancestor = ancestor.parent;
}
if (isPatchable(vnode)) {
for (var i = 0; i < cbs.create.length; ++i) {
cbs.create[i](emptyNode, vnode.parent);
}
}
}
if (isDef(parentElm$1)) {
removeVnodes(parentElm$1, [oldVnode], 0, 0);
} else if (isDef(oldVnode.tag)) {
invokeDestroyHook(oldVnode);
}
}
}
invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
return vnode.elm
}
}
/* */
var directives = {
create: updateDirectives,
update: updateDirectives,
destroy: function unbindDirectives (vnode) {
updateDirectives(vnode, emptyNode);
}
};
function updateDirectives (oldVnode, vnode) {
if (oldVnode.data.directives || vnode.data.directives) {
_update(oldVnode, vnode);
}
}
function _update (oldVnode, vnode) {
var isCreate = oldVnode === emptyNode;
var isDestroy = vnode === emptyNode;
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
var dirsWithInsert = [];
var dirsWithPostpatch = [];
var key, oldDir, dir;
for (key in newDirs) {
oldDir = oldDirs[key];
dir = newDirs[key];
if (!oldDir) {
// new directive, bind
callHook$1(dir, 'bind', vnode, oldVnode);
if (dir.def && dir.def.inserted) {
dirsWithInsert.push(dir);
}
} else {
// existing directive, update
dir.oldValue = oldDir.value;
callHook$1(dir, 'update', vnode, oldVnode);
if (dir.def && dir.def.componentUpdated) {
dirsWithPostpatch.push(dir);
}
}
}
if (dirsWithInsert.length) {
var callInsert = function () {
for (var i = 0; i < dirsWithInsert.length; i++) {
callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
}
};
if (isCreate) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
} else {
callInsert();
}
}
if (dirsWithPostpatch.length) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
for (var i = 0; i < dirsWithPostpatch.length; i++) {
callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
}
});
}
if (!isCreate) {
for (key in oldDirs) {
if (!newDirs[key]) {
// no longer present, unbind
callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
}
}
}
}
var emptyModifiers = Object.create(null);
function normalizeDirectives$1 (
dirs,
vm
) {
var res = Object.create(null);
if (!dirs) {
return res
}
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
if (!dir.modifiers) {
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
return res
}
function getRawDirName (dir) {
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
}
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
var fn = dir.def && dir.def[hook];
if (fn) {
try {
fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
} catch (e) {
handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
}
}
}
var baseModules = [
ref,
directives
];
/* */
function updateAttrs (oldVnode, vnode) {
var opts = vnode.componentOptions;
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
return
}
if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
return
}
var key, cur, old;
var elm = vnode.elm;
var oldAttrs = oldVnode.data.attrs || {};
var attrs = vnode.data.attrs || {};
// clone observed objects, as the user probably wants to mutate it
if (isDef(attrs.__ob__)) {
attrs = vnode.data.attrs = extend({}, attrs);
}
for (key in attrs) {
cur = attrs[key];
old = oldAttrs[key];
if (old !== cur) {
setAttr(elm, key, cur);
}
}
// #4391: in IE9, setting type can reset value for input[type=radio]
/* istanbul ignore if */
if (isIE9 && attrs.value !== oldAttrs.value) {
setAttr(elm, 'value', attrs.value);
}
for (key in oldAttrs) {
if (isUndef(attrs[key])) {
if (isXlink(key)) {
elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
} else if (!isEnumeratedAttr(key)) {
elm.removeAttribute(key);
}
}
}
}
function setAttr (el, key, value) {
if (isBooleanAttr(key)) {
// set attribute for blank value
// e.g. <option disabled>Select one</option>
if (isFalsyAttrValue(value)) {
el.removeAttribute(key);
} else {
el.setAttribute(key, key);
}
} else if (isEnumeratedAttr(key)) {
el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
} else if (isXlink(key)) {
if (isFalsyAttrValue(value)) {
el.removeAttributeNS(xlinkNS, getXlinkProp(key));
} else {
el.setAttributeNS(xlinkNS, key, value);
}
} else {
if (isFalsyAttrValue(value)) {
el.removeAttribute(key);
} else {
el.setAttribute(key, value);
}
}
}
var attrs = {
create: updateAttrs,
update: updateAttrs
};
/* */
function updateClass (oldVnode, vnode) {
var el = vnode.elm;
var data = vnode.data;
var oldData = oldVnode.data;
if (
isUndef(data.staticClass) &&
isUndef(data.class) && (
isUndef(oldData) || (
isUndef(oldData.staticClass) &&
isUndef(oldData.class)
)
)
) {
return
}
var cls = genClassForVnode(vnode);
// handle transition classes
var transitionClass = el._transitionClasses;
if (isDef(transitionClass)) {
cls = concat(cls, stringifyClass(transitionClass));
}
// set the class
if (cls !== el._prevClass) {
el.setAttribute('class', cls);
el._prevClass = cls;
}
}
var klass = {
create: updateClass,
update: updateClass
};
/* */
var validDivisionCharRE = /[\w).+\-_$\]]/;
function wrapFilter (exp, filter) {
var i = filter.indexOf('(');
if (i < 0) {
// _f: resolveFilter
return ("_f(\"" + filter + "\")(" + exp + ")")
} else {
var name = filter.slice(0, i);
var args = filter.slice(i + 1);
return ("_f(\"" + name + "\")(" + exp + "," + args)
}
}
/* */
/* */
/**
* Cross-platform code generation for component v-model
*/
/**
* Cross-platform codegen helper for generating v-model value assignment code.
*/
/**
* parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
*
* for loop possible cases:
*
* - test
* - test[idx]
* - test[test1[idx]]
* - test["a"][idx]
* - xxx.test[a[a].test1[idx]]
* - test.xxx.a["asa"][test1[idx]]
*
*/
var str;
var index$1;
/* */
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
var RANGE_TOKEN = '__r';
var CHECKBOX_RADIO_TOKEN = '__c';
/* */
// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
// user-attached handlers.
function normalizeEvents (on) {
var event;
/* istanbul ignore if */
if (isDef(on[RANGE_TOKEN])) {
// IE input[type=range] only supports `change` event
event = isIE ? 'change' : 'input';
on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
delete on[RANGE_TOKEN];
}
if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
// Chrome fires microtasks in between click/change, leads to #4521
event = isChrome ? 'click' : 'change';
on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
delete on[CHECKBOX_RADIO_TOKEN];
}
}
var target$1;
function add$1 (
event,
handler,
once$$1,
capture,
passive
) {
if (once$$1) {
var oldHandler = handler;
var _target = target$1; // save current target element in closure
handler = function (ev) {
var res = arguments.length === 1
? oldHandler(ev)
: oldHandler.apply(null, arguments);
if (res !== null) {
remove$2(event, handler, capture, _target);
}
};
}
target$1.addEventListener(
event,
handler,
supportsPassive
? { capture: capture, passive: passive }
: capture
);
}
function remove$2 (
event,
handler,
capture,
_target
) {
(_target || target$1).removeEventListener(event, handler, capture);
}
function updateDOMListeners (oldVnode, vnode) {
if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
return
}
var on = vnode.data.on || {};
var oldOn = oldVnode.data.on || {};
target$1 = vnode.elm;
normalizeEvents(on);
updateListeners(on, oldOn, add$1, remove$2, vnode.context);
}
var events = {
create: updateDOMListeners,
update: updateDOMListeners
};
/* */
function updateDOMProps (oldVnode, vnode) {
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
return
}
var key, cur;
var elm = vnode.elm;
var oldProps = oldVnode.data.domProps || {};
var props = vnode.data.domProps || {};
// clone observed objects, as the user probably wants to mutate it
if (isDef(props.__ob__)) {
props = vnode.data.domProps = extend({}, props);
}
for (key in oldProps) {
if (isUndef(props[key])) {
elm[key] = '';
}
}
for (key in props) {
cur = props[key];
// ignore children if the node has textContent or innerHTML,
// as these will throw away existing DOM nodes and cause removal errors
// on subsequent patches (#3360)
if (key === 'textContent' || key === 'innerHTML') {
if (vnode.children) { vnode.children.length = 0; }
if (cur === oldProps[key]) { continue }
}
if (key === 'value') {
// store value as _value as well since
// non-string values will be stringified
elm._value = cur;
// avoid resetting cursor position when value is the same
var strCur = isUndef(cur) ? '' : String(cur);
if (shouldUpdateValue(elm, vnode, strCur)) {
elm.value = strCur;
}
} else {
elm[key] = cur;
}
}
}
// check platforms/web/util/attrs.js acceptValue
function shouldUpdateValue (
elm,
vnode,
checkVal
) {
return (!elm.composing && (
vnode.tag === 'option' ||
isDirty(elm, checkVal) ||
isInputChanged(elm, checkVal)
))
}
function isDirty (elm, checkVal) {
// return true when textbox (.number and .trim) loses focus and its value is
// not equal to the updated value
var notInFocus = true;
// #6157
// work around IE bug when accessing document.activeElement in an iframe
try { notInFocus = document.activeElement !== elm; } catch (e) {}
return notInFocus && elm.value !== checkVal
}
function isInputChanged (elm, newVal) {
var value = elm.value;
var modifiers = elm._vModifiers; // injected by v-model runtime
if (isDef(modifiers) && modifiers.number) {
return toNumber(value) !== toNumber(newVal)
}
if (isDef(modifiers) && modifiers.trim) {
return value.trim() !== newVal.trim()
}
return value !== newVal
}
var domProps = {
create: updateDOMProps,
update: updateDOMProps
};
/* */
// Lynx Modify
function setStyles(elm, styles) {
for(var key in styles) {
elm.setStyle(key, styles[key]);
}
}
function isEmptyObject (obj) {
if (!obj || typeof obj !== 'object') { return true }
for (var k in obj) {
if (({}).hasOwnProperty.call(obj, k)) { return false }
}
return true
}
var normalize = cached(function (prop) {
prop = camelize(prop);
return prop
});
function setStaticStyles (oldVnode, vnode) {
var elm = vnode.elm;
var style, name;
var vm$$data = vnode.context.$data;
var styleSheet = vm$$data.style;
// extend static class styles
if (vnode.data.staticClass) {
var classNames = vnode.data.staticClass.split(' ');
classNames.forEach(function (cls) {
if (cls === '') { return }
if (styleSheet[cls]) {
style = extend(style || {}, styleSheet[cls]);
}
});
}
// extend static style styles
if (!isEmptyObject(vnode.data.staticStyle)) {
style = extend(style || {}, vnode.data.staticStyle);
}
var preStyles = {};
for (name in style) {
var norName = normalize(name);
if (norName) {
preStyles[norName] = style[name];
}
}
setStyles(elm, preStyles);
// clone the style for future updates,
// in case the user mutates the style object in-place.
if (style) {
vnode.data.baseStyle = extend({}, style);
}
}
function createStyle (oldVnode, vnode) {
setStaticStyles(oldVnode, vnode);
// to data binding style
updateStyle(oldVnode, vnode);
}
function updateStyle (oldVnode, vnode) {
if (vnode.data.staticClass !== oldVnode.data.staticClass ||
vnode.data.staticStyle !== oldVnode.data.staticStyle) {
setStaticStyles(oldVnode, vnode);
}
/**
* @baseStyle: static staticStyle & staticClass cache
* @preStyles: current style & class collection
* @bindClassStyle: -> :class
* @bindStyle: -> :style
*/
var elm = vnode.elm;
var oldStyle = oldVnode.data.style;
var baseStyle = oldVnode.data.baseStyle || vnode.data.baseStyle;
// get default tag styles
var preStyles = {};
if (oldStyle) {
for (var name in oldStyle) {
// new style wait to del
var norName = normalize(name);
if (norName) {
preStyles[norName] = baseStyle && baseStyle[name] || '';
}
}
}
// process v-bind:style v-bind:class
var bindStyle = {};
var attrs = vnode.data;
var styleMap = vnode.context._data.style;
var bindClassStyle = {};
if (attrs) {
// [style1,style2] style1:{color:'#ff3355'},style2:{fontSize:80}
if (Array.isArray(attrs.style)) {
for (var i = 0; i < attrs.style.length; i++) {
bindStyle = extend(bindStyle, attrs.style[i]);
}
} else if (typeof attrs.style === 'object') {
// {color:'#ff3355',fontSize:80}
bindStyle = attrs.style;
}
// [class1,class2] .class1{height:200} .active{width:400}
if (Array.isArray(attrs.class)) {
for (var i$1 = 0; i$1 < attrs.class.length; i$1++) {
var klass = attrs.class[i$1];
bindClassStyle = extend(bindClassStyle, styleMap[klass]);
}
} else if (typeof attrs.class === 'object') {
// {class1:true|false,class2:true|false}
var truebindStyle = {};
var falsebindStyle = {};
for (var klass$1 in attrs.class) {
if (attrs.class[klass$1]) {
truebindStyle = extend(truebindStyle, styleMap[klass$1]);
} else {
// class[klass] is false
var tmpFalsebindStyle = {};
for (var styleKey in styleMap[klass$1]) {
if (baseStyle && baseStyle[styleKey]) {
tmpFalsebindStyle[styleKey] = baseStyle[styleKey];
} else {
tmpFalsebindStyle[styleKey] = '';
}
}
falsebindStyle = extend(falsebindStyle, tmpFalsebindStyle);
}
}
bindClassStyle = extend(bindClassStyle, falsebindStyle);
bindClassStyle = extend(bindClassStyle, truebindStyle);
}
}
// clone the style for future updates,
// in case the user mutates the style object in-place.
var curStyles = extend(bindClassStyle, bindStyle);
var normalizedCurStyles = {};
if (!isEmptyObject(curStyles)) {
for (var key in curStyles) {
normalizedCurStyles[normalize(key)] = curStyles[key];
}
vnode.data.style = normalizedCurStyles;
}
if (baseStyle) {
vnode.data.baseStyle = extend({}, baseStyle);
}
preStyles = extend(preStyles, normalizedCurStyles);
setStyles(elm, preStyles);
if(elm && !elm.style && !isEmptyObject(preStyles)) {
elm.setStyle('', '');
}
}
var style = {
create: createStyle,
update: updateStyle
};
// import { getStyle, normalizeStyleBinding } from 'web/util/style'
// import { cached, camelize, extend, isDef, isUndef } from 'shared/util'
// const cssVarRE = /^--/
// const importantRE = /\s*!important$/
// const setProp = (el, name, val) => {
// /* istanbul ignore if */
// if (cssVarRE.test(name)) {
// el.style.setProperty(name, val)
// } else if (importantRE.test(val)) {
// el.style.setProperty(name, val.replace(importantRE, ''), 'important')
// } else {
// const normalizedName = normalize(name)
// if (Array.isArray(val)) {
// // Support values array created by autoprefixer, e.g.
// // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
// // Set them one by one, and the browser will only set those it can recognize
// for (let i = 0, len = val.length; i < len; i++) {
// el.style[normalizedName] = val[i]
// }
// } else {
// el.style[normalizedName] = val
// }
// }
// }
// const vendorNames = ['Webkit', 'Moz', 'ms']
// let emptyStyle
// const normalize = cached(function (prop) {
// emptyStyle = emptyStyle || document.createElement('div').style
// prop = camelize(prop)
// if (prop !== 'filter' && (prop in emptyStyle)) {
// return prop
// }
// const capName = prop.charAt(0).toUpperCase() + prop.slice(1)
// for (let i = 0; i < vendorNames.length; i++) {
// const name = vendorNames[i] + capName
// if (name in emptyStyle) {
// return name
// }
// }
// })
// function updateStyle (oldVnode: VNodeWithData, vnode: VNodeWithData) {
// const data = vnode.data
// const oldData = oldVnode.data
// if (isUndef(data.staticStyle) && isUndef(data.style) &&
// isUndef(oldData.staticStyle) && isUndef(oldData.style)
// ) {
// return
// }
// let cur, name
// const el: any = vnode.elm
// const oldStaticStyle: any = oldData.staticStyle
// const oldStyleBinding: any = oldData.normalizedStyle || oldData.style || {}
// // if static style exists, stylebinding already merged into it when doing normalizeStyleData
// const oldStyle = oldStaticStyle || oldStyleBinding
// const style = normalizeStyleBinding(vnode.data.style) || {}
// // store normalized style under a different key for next diff
// // make sure to clone it if it's reactive, since the user likley wants
// // to mutate it.
// vnode.data.normalizedStyle = isDef(style.__ob__)
// ? extend({}, style)
// : style
// const newStyle = getStyle(vnode, true)
// for (name in oldStyle) {
// if (isUndef(newStyle[name])) {
// setProp(el, name, '')
// }
// }
// for (name in newStyle) {
// cur = newStyle[name]
// if (cur !== oldStyle[name]) {
// // ie9 setting to null has no effect, must use empty string
// setProp(el, name, cur == null ? '' : cur)
// }
// }
// }
// export default {
// create: updateStyle,
// update: updateStyle
// }
/* */
/**
* Add class with compatibility for SVG since classList is not supported on
* SVG elements in IE
*/
function addClass (el, cls) {
/* istanbul ignore if */
if (!cls || !(cls = cls.trim())) {
return
}
/* istanbul ignore else */
if (el.classList) {
if (cls.indexOf(' ') > -1) {
cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
} else {
el.classList.add(cls);
}
} else {
var cur = " " + (el.getAttribute('class') || '') + " ";
if (cur.indexOf(' ' + cls + ' ') < 0) {
el.setAttribute('class', (cur + cls).trim());
}
}
}
/**
* Remove class with compatibility for SVG since classList is not supported on
* SVG elements in IE
*/
function removeClass (el, cls) {
/* istanbul ignore if */
if (!cls || !(cls = cls.trim())) {
return
}
/* istanbul ignore else */
if (el.classList) {
if (cls.indexOf(' ') > -1) {
cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
} else {
el.classList.remove(cls);
}
if (!el.classList.length) {
el.removeAttribute('class');
}
} else {
var cur = " " + (el.getAttribute('class') || '') + " ";
var tar = ' ' + cls + ' ';
while (cur.indexOf(tar) >= 0) {
cur = cur.replace(tar, ' ');
}
cur = cur.trim();
if (cur) {
el.setAttribute('class', cur);
} else {
el.removeAttribute('class');
}
}
}
/* */
function resolveTransition (def$$1) {
if (!def$$1) {
return
}
/* istanbul ignore else */
if (typeof def$$1 === 'object') {
var res = {};
if (def$$1.css !== false) {
extend(res, autoCssTransition(def$$1.name || 'v'));
}
extend(res, def$$1);
return res
} else if (typeof def$$1 === 'string') {
return autoCssTransition(def$$1)
}
}
var autoCssTransition = cached(function (name) {
return {
enterClass: (name + "-enter"),
enterToClass: (name + "-enter-to"),
enterActiveClass: (name + "-enter-active"),
leaveClass: (name + "-leave"),
leaveToClass: (name + "-leave-to"),
leaveActiveClass: (name + "-leave-active")
}
});
var hasTransition = inBrowser && !isIE9;
var TRANSITION = 'transition';
var ANIMATION = 'animation';
// Transition property/event sniffing
var transitionProp = 'transition';
var transitionEndEvent = 'transitionend';
var animationProp = 'animation';
var animationEndEvent = 'animationend';
if (hasTransition) {
/* istanbul ignore if */
if (window.ontransitionend === undefined &&
window.onwebkittransitionend !== undefined
) {
transitionProp = 'WebkitTransition';
transitionEndEvent = 'webkitTransitionEnd';
}
if (window.onanimationend === undefined &&
window.onwebkitanimationend !== undefined
) {
animationProp = 'WebkitAnimation';
animationEndEvent = 'webkitAnimationEnd';
}
}
// binding to window is necessary to make hot reload work in IE in strict mode
var raf = inBrowser && window.requestAnimationFrame
? window.requestAnimationFrame.bind(window)
: setTimeout;
function nextFrame (fn) {
raf(function () {
raf(fn);
});
}
function addTransitionClass (el, cls) {
var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
if (transitionClasses.indexOf(cls) < 0) {
transitionClasses.push(cls);
addClass(el, cls);
}
}
function removeTransitionClass (el, cls) {
if (el._transitionClasses) {
remove(el._transitionClasses, cls);
}
removeClass(el, cls);
}
function whenTransitionEnds (
el,
expectedType,
cb
) {
var ref = getTransitionInfo(el, expectedType);
var type = ref.type;
var timeout = ref.timeout;
var propCount = ref.propCount;
if (!type) { return cb() }
var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
var ended = 0;
var end = function () {
el.removeEventListener(event, onEnd);
cb();
};
var onEnd = function (e) {
if (e.target === el) {
if (++ended >= propCount) {
end();
}
}
};
setTimeout(function () {
if (ended < propCount) {
end();
}
}, timeout + 1);
el.addEventListener(event, onEnd);
}
var transformRE = /\b(transform|all)(,|$)/;
function getTransitionInfo (el, expectedType) {
var styles = window.getComputedStyle(el);
var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
var animationDelays = styles[animationProp + 'Delay'].split(', ');
var animationDurations = styles[animationProp + 'Duration'].split(', ');
var animationTimeout = getTimeout(animationDelays, animationDurations);
var type;
var timeout = 0;
var propCount = 0;
/* istanbul ignore if */
if (expectedType === TRANSITION) {
if (transitionTimeout > 0) {
type = TRANSITION;
timeout = transitionTimeout;
propCount = transitionDurations.length;
}
} else if (expectedType === ANIMATION) {
if (animationTimeout > 0) {
type = ANIMATION;
timeout = animationTimeout;
propCount = animationDurations.length;
}
} else {
timeout = Math.max(transitionTimeout, animationTimeout);
type = timeout > 0
? transitionTimeout > animationTimeout
? TRANSITION
: ANIMATION
: null;
propCount = type
? type === TRANSITION
? transitionDurations.length
: animationDurations.length
: 0;
}
var hasTransform =
type === TRANSITION &&
transformRE.test(styles[transitionProp + 'Property']);
return {
type: type,
timeout: timeout,
propCount: propCount,
hasTransform: hasTransform
}
}
function getTimeout (delays, durations) {
/* istanbul ignore next */
while (delays.length < durations.length) {
delays = delays.concat(delays);
}
return Math.max.apply(null, durations.map(function (d, i) {
return toMs(d) + toMs(delays[i])
}))
}
function toMs (s) {
return Number(s.slice(0, -1)) * 1000
}
/* */
function enter (vnode, toggleDisplay) {
var el = vnode.elm;
// call leave callback now
if (isDef(el._leaveCb)) {
el._leaveCb.cancelled = true;
el._leaveCb();
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
return
}
/* istanbul ignore if */
if (isDef(el._enterCb) || el.nodeType !== 1) {
return
}
var css = data.css;
var type = data.type;
var enterClass = data.enterClass;
var enterToClass = data.enterToClass;
var enterActiveClass = data.enterActiveClass;
var appearClass = data.appearClass;
var appearToClass = data.appearToClass;
var appearActiveClass = data.appearActiveClass;
var beforeEnter = data.beforeEnter;
var enter = data.enter;
var afterEnter = data.afterEnter;
var enterCancelled = data.enterCancelled;
var beforeAppear = data.beforeAppear;
var appear = data.appear;
var afterAppear = data.afterAppear;
var appearCancelled = data.appearCancelled;
var duration = data.duration;
// activeInstance will always be the <transition> component managing this
// transition. One edge case to check is when the <transition> is placed
// as the root node of a child component. In that case we need to check
// <transition>'s parent for appear check.
var context = activeInstance;
var transitionNode = activeInstance.$vnode;
while (transitionNode && transitionNode.parent) {
transitionNode = transitionNode.parent;
context = transitionNode.context;
}
var isAppear = !context._isMounted || !vnode.isRootInsert;
if (isAppear && !appear && appear !== '') {
return
}
var startClass = isAppear && appearClass
? appearClass
: enterClass;
var activeClass = isAppear && appearActiveClass
? appearActiveClass
: enterActiveClass;
var toClass = isAppear && appearToClass
? appearToClass
: enterToClass;
var beforeEnterHook = isAppear
? (beforeAppear || beforeEnter)
: beforeEnter;
var enterHook = isAppear
? (typeof appear === 'function' ? appear : enter)
: enter;
var afterEnterHook = isAppear
? (afterAppear || afterEnter)
: afterEnter;
var enterCancelledHook = isAppear
? (appearCancelled || enterCancelled)
: enterCancelled;
var explicitEnterDuration = toNumber(
isObject(duration)
? duration.enter
: duration
);
if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
checkDuration(explicitEnterDuration, 'enter', vnode);
}
var expectsCSS = css !== false && !isIE9;
var userWantsControl = getHookArgumentsLength(enterHook);
var cb = el._enterCb = once(function () {
if (expectsCSS) {
removeTransitionClass(el, toClass);
removeTransitionClass(el, activeClass);
}
if (cb.cancelled) {
if (expectsCSS) {
removeTransitionClass(el, startClass);
}
enterCancelledHook && enterCancelledHook(el);
} else {
afterEnterHook && afterEnterHook(el);
}
el._enterCb = null;
});
if (!vnode.data.show) {
// remove pending leave element on enter by injecting an insert hook
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
var parent = el.parentNode;
var pendingNode = parent && parent._pending && parent._pending[vnode.key];
if (pendingNode &&
pendingNode.tag === vnode.tag &&
pendingNode.elm._leaveCb
) {
pendingNode.elm._leaveCb();
}
enterHook && enterHook(el, cb);
});
}
// start enter transition
beforeEnterHook && beforeEnterHook(el);
if (expectsCSS) {
addTransitionClass(el, startClass);
addTransitionClass(el, activeClass);
nextFrame(function () {
addTransitionClass(el, toClass);
removeTransitionClass(el, startClass);
if (!cb.cancelled && !userWantsControl) {
if (isValidDuration(explicitEnterDuration)) {
setTimeout(cb, explicitEnterDuration);
} else {
whenTransitionEnds(el, type, cb);
}
}
});
}
if (vnode.data.show) {
toggleDisplay && toggleDisplay();
enterHook && enterHook(el, cb);
}
if (!expectsCSS && !userWantsControl) {
cb();
}
}
function leave (vnode, rm) {
var el = vnode.elm;
// call enter callback now
if (isDef(el._enterCb)) {
el._enterCb.cancelled = true;
el._enterCb();
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
return rm()
}
/* istanbul ignore if */
if (isDef(el._leaveCb) || el.nodeType !== 1) {
return
}
var css = data.css;
var type = data.type;
var leaveClass = data.leaveClass;
var leaveToClass = data.leaveToClass;
var leaveActiveClass = data.leaveActiveClass;
var beforeLeave = data.beforeLeave;
var leave = data.leave;
var afterLeave = data.afterLeave;
var leaveCancelled = data.leaveCancelled;
var delayLeave = data.delayLeave;
var duration = data.duration;
var expectsCSS = css !== false && !isIE9;
var userWantsControl = getHookArgumentsLength(leave);
var explicitLeaveDuration = toNumber(
isObject(duration)
? duration.leave
: duration
);
if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
checkDuration(explicitLeaveDuration, 'leave', vnode);
}
var cb = el._leaveCb = once(function () {
if (el.parentNode && el.parentNode._pending) {
el.parentNode._pending[vnode.key] = null;
}
if (expectsCSS) {
removeTransitionClass(el, leaveToClass);
removeTransitionClass(el, leaveActiveClass);
}
if (cb.cancelled) {
if (expectsCSS) {
removeTransitionClass(el, leaveClass);
}
leaveCancelled && leaveCancelled(el);
} else {
rm();
afterLeave && afterLeave(el);
}
el._leaveCb = null;
});
if (delayLeave) {
delayLeave(performLeave);
} else {
performLeave();
}
function performLeave () {
// the delayed leave may have already been cancelled
if (cb.cancelled) {
return
}
// record leaving element
if (!vnode.data.show) {
(el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
}
beforeLeave && beforeLeave(el);
if (expectsCSS) {
addTransitionClass(el, leaveClass);
addTransitionClass(el, leaveActiveClass);
nextFrame(function () {
addTransitionClass(el, leaveToClass);
removeTransitionClass(el, leaveClass);
if (!cb.cancelled && !userWantsControl) {
if (isValidDuration(explicitLeaveDuration)) {
setTimeout(cb, explicitLeaveDuration);
} else {
whenTransitionEnds(el, type, cb);
}
}
});
}
leave && leave(el, cb);
if (!expectsCSS && !userWantsControl) {
cb();
}
}
}
// only used in dev mode
function checkDuration (val, name, vnode) {
if (typeof val !== 'number') {
warn(
"<transition> explicit " + name + " duration is not a valid number - " +
"got " + (JSON.stringify(val)) + ".",
vnode.context
);
} else if (isNaN(val)) {
warn(
"<transition> explicit " + name + " duration is NaN - " +
'the duration expression might be incorrect.',
vnode.context
);
}
}
function isValidDuration (val) {
return typeof val === 'number' && !isNaN(val)
}
/**
* Normalize a transition hook's argument length. The hook may be:
* - a merged hook (invoker) with the original in .fns
* - a wrapped component method (check ._length)
* - a plain function (.length)
*/
function getHookArgumentsLength (fn) {
if (isUndef(fn)) {
return false
}
var invokerFns = fn.fns;
if (isDef(invokerFns)) {
// invoker
return getHookArgumentsLength(
Array.isArray(invokerFns)
? invokerFns[0]
: invokerFns
)
} else {
return (fn._length || fn.length) > 1
}
}
function _enter (_, vnode) {
if (vnode.data.show !== true) {
enter(vnode);
}
}
var transition = inBrowser ? {
create: _enter,
activate: _enter,
remove: function remove$$1 (vnode, rm) {
/* istanbul ignore else */
if (vnode.data.show !== true) {
leave(vnode, rm);
} else {
rm();
}
}
} : {};
var platformModules = [
attrs,
klass,
events,
domProps,
style,
transition
];
/* */
// the directive module should be applied last, after all
// built-in modules have been applied.
var modules = platformModules.concat(baseModules);
var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
/**
* Not type checking this file because flow doesn't like attaching
* properties to Elements.
*/
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* istanbul ignore if */
if (isIE9) {
// http://www.matts411.com/post/internet-explorer-9-oninput/
document.addEventListener('selectionchange', function () {
var el = document.activeElement;
if (el && el.vmodel) {
trigger(el, 'input');
}
});
}
var model$1 = {
inserted: function inserted (el, binding, vnode) {
if (vnode.tag === 'select') {
var cb = function () {
setSelected(el, binding, vnode.context);
};
cb();
/* istanbul ignore if */
if (isIE || isEdge) {
setTimeout(cb, 0);
}
el._vOptions = [].map.call(el.options, getValue);
} else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
el._vModifiers = binding.modifiers;
if (!binding.modifiers.lazy) {
// Safari < 10.2 & UIWebView doesn't fire compositionend when
// switching focus before confirming composition choice
// this also fixes the issue where some browsers e.g. iOS Chrome
// fires "change" instead of "input" on autocomplete.
el.addEventListener('change', onCompositionEnd);
if (!isAndroid) {
el.addEventListener('compositionstart', onCompositionStart);
el.addEventListener('compositionend', onCompositionEnd);
}
/* istanbul ignore if */
if (isIE9) {
el.vmodel = true;
}
}
}
},
componentUpdated: function componentUpdated (el, binding, vnode) {
if (vnode.tag === 'select') {
setSelected(el, binding, vnode.context);
// in case the options rendered by v-for have changed,
// it's possible that the value is out-of-sync with the rendered options.
// detect such cases and filter out values that no longer has a matching
// option in the DOM.
var prevOptions = el._vOptions;
var curOptions = el._vOptions = [].map.call(el.options, getValue);
if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
trigger(el, 'change');
}
}
}
};
function setSelected (el, binding, vm) {
var value = binding.value;
var isMultiple = el.multiple;
if (isMultiple && !Array.isArray(value)) {
process.env.NODE_ENV !== 'production' && warn(
"<select multiple v-model=\"" + (binding.expression) + "\"> " +
"expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
vm
);
return
}
var selected, option;
for (var i = 0, l = el.options.length; i < l; i++) {
option = el.options[i];
if (isMultiple) {
selected = looseIndexOf(value, getValue(option)) > -1;
if (option.selected !== selected) {
option.selected = selected;
}
} else {
if (looseEqual(getValue(option), value)) {
if (el.selectedIndex !== i) {
el.selectedIndex = i;
}
return
}
}
}
if (!isMultiple) {
el.selectedIndex = -1;
}
}
function getValue (option) {
return '_value' in option
? option._value
: option.value
}
function onCompositionStart (e) {
e.target.composing = true;
}
function onCompositionEnd (e) {
// prevent triggering an input event for no reason
if (!e.target.composing) { return }
e.target.composing = false;
trigger(e.target, 'input');
}
function trigger (el, type) {
var e = document.createEvent('HTMLEvents');
e.initEvent(type, true, true);
el.dispatchEvent(e);
}
/* */
// recursively search for possible transition defined inside the component root
function locateNode (vnode) {
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
? locateNode(vnode.componentInstance._vnode)
: vnode
}
var show = {
bind: function bind (el, ref, vnode) {
var value = ref.value;
vnode = locateNode(vnode);
var transition$$1 = vnode.data && vnode.data.transition;
var originalDisplay = el.__vOriginalDisplay =
el.style.display === 'none' ? '' : el.style.display;
if (value && transition$$1) {
vnode.data.show = true;
enter(vnode, function () {
el.style.display = originalDisplay;
});
} else {
el.style.display = value ? originalDisplay : 'none';
}
},
update: function update (el, ref, vnode) {
var value = ref.value;
var oldValue = ref.oldValue;
/* istanbul ignore if */
if (value === oldValue) { return }
vnode = locateNode(vnode);
var transition$$1 = vnode.data && vnode.data.transition;
if (transition$$1) {
vnode.data.show = true;
if (value) {
enter(vnode, function () {
el.style.display = el.__vOriginalDisplay;
});
} else {
leave(vnode, function () {
el.style.display = 'none';
});
}
} else {
el.style.display = value ? el.__vOriginalDisplay : 'none';
}
},
unbind: function unbind (
el,
binding,
vnode,
oldVnode,
isDestroy
) {
if (!isDestroy) {
el.style.display = el.__vOriginalDisplay;
}
}
};
var platformDirectives = {
model: model$1,
show: show
};
/* */
// Provides transition support for a single element/component.
// supports transition mode (out-in / in-out)
var transitionProps = {
name: String,
appear: Boolean,
css: Boolean,
mode: String,
type: String,
enterClass: String,
leaveClass: String,
enterToClass: String,
leaveToClass: String,
enterActiveClass: String,
leaveActiveClass: String,
appearClass: String,
appearActiveClass: String,
appearToClass: String,
duration: [Number, String, Object]
};
// in case the child is also an abstract component, e.g. <keep-alive>
// we want to recursively retrieve the real component to be rendered
function getRealChild (vnode) {
var compOptions = vnode && vnode.componentOptions;
if (compOptions && compOptions.Ctor.options.abstract) {
return getRealChild(getFirstComponentChild(compOptions.children))
} else {
return vnode
}
}
function extractTransitionData (comp) {
var data = {};
var options = comp.$options;
// props
for (var key in options.propsData) {
data[key] = comp[key];
}
// events.
// extract listeners and pass them directly to the transition methods
var listeners = options._parentListeners;
for (var key$1 in listeners) {
data[camelize(key$1)] = listeners[key$1];
}
return data
}
function placeholder (h, rawChild) {
if (/\d-keep-alive$/.test(rawChild.tag)) {
return h('keep-alive', {
props: rawChild.componentOptions.propsData
})
}
}
function hasParentTransition (vnode) {
while ((vnode = vnode.parent)) {
if (vnode.data.transition) {
return true
}
}
}
function isSameChild (child, oldChild) {
return oldChild.key === child.key && oldChild.tag === child.tag
}
function isAsyncPlaceholder (node) {
return node.isComment && node.asyncFactory
}
var Transition = {
name: 'transition',
props: transitionProps,
abstract: true,
render: function render (h) {
var this$1 = this;
var children = this.$options._renderChildren;
if (!children) {
return
}
// filter out text nodes (possible whitespaces)
children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
/* istanbul ignore if */
if (!children.length) {
return
}
// warn multiple elements
if (process.env.NODE_ENV !== 'production' && children.length > 1) {
warn(
'<transition> can only be used on a single element. Use ' +
'<transition-group> for lists.',
this.$parent
);
}
var mode = this.mode;
// warn invalid mode
if (process.env.NODE_ENV !== 'production' &&
mode && mode !== 'in-out' && mode !== 'out-in'
) {
warn(
'invalid <transition> mode: ' + mode,
this.$parent
);
}
var rawChild = children[0];
// if this is a component root node and the component's
// parent container node also has transition, skip.
if (hasParentTransition(this.$vnode)) {
return rawChild
}
// apply transition data to child
// use getRealChild() to ignore abstract components e.g. keep-alive
var child = getRealChild(rawChild);
/* istanbul ignore if */
if (!child) {
return rawChild
}
if (this._leaving) {
return placeholder(h, rawChild)
}
// ensure a key that is unique to the vnode type and to this transition
// component instance. This key will be used to remove pending leaving nodes
// during entering.
var id = "__transition-" + (this._uid) + "-";
child.key = child.key == null
? child.isComment
? id + 'comment'
: id + child.tag
: isPrimitive(child.key)
? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
: child.key;
var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
var oldRawChild = this._vnode;
var oldChild = getRealChild(oldRawChild);
// mark v-show
// so that the transition module can hand over the control to the directive
if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
child.data.show = true;
}
if (
oldChild &&
oldChild.data &&
!isSameChild(child, oldChild) &&
!isAsyncPlaceholder(oldChild)
) {
// replace old child transition data with fresh one
// important for dynamic transitions!
var oldData = oldChild && (oldChild.data.transition = extend({}, data));
// handle transition mode
if (mode === 'out-in') {
// return placeholder node and queue update when leave finishes
this._leaving = true;
mergeVNodeHook(oldData, 'afterLeave', function () {
this$1._leaving = false;
this$1.$forceUpdate();
});
return placeholder(h, rawChild)
} else if (mode === 'in-out') {
if (isAsyncPlaceholder(child)) {
return oldRawChild
}
var delayedLeave;
var performLeave = function () { delayedLeave(); };
mergeVNodeHook(data, 'afterEnter', performLeave);
mergeVNodeHook(data, 'enterCancelled', performLeave);
mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
}
}
return rawChild
}
};
/* */
// Provides transition support for list items.
// supports move transitions using the FLIP technique.
// Because the vdom's children update algorithm is "unstable" - i.e.
// it doesn't guarantee the relative positioning of removed elements,
// we force transition-group to update its children into two passes:
// in the first pass, we remove all nodes that need to be removed,
// triggering their leaving transition; in the second pass, we insert/move
// into the final desired state. This way in the second pass removed
// nodes will remain where they should be.
var props = extend({
tag: String,
moveClass: String
}, transitionProps);
delete props.mode;
var TransitionGroup = {
props: props,
render: function render (h) {
var tag = this.tag || this.$vnode.data.tag || 'span';
var map = Object.create(null);
var prevChildren = this.prevChildren = this.children;
var rawChildren = this.$slots.default || [];
var children = this.children = [];
var transitionData = extractTransitionData(this);
for (var i = 0; i < rawChildren.length; i++) {
var c = rawChildren[i];
if (c.tag) {
if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
children.push(c);
map[c.key] = c
;(c.data || (c.data = {})).transition = transitionData;
} else if (process.env.NODE_ENV !== 'production') {
var opts = c.componentOptions;
var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
warn(("<transition-group> children must be keyed: <" + name + ">"));
}
}
}
if (prevChildren) {
var kept = [];
var removed = [];
for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
var c$1 = prevChildren[i$1];
c$1.data.transition = transitionData;
c$1.data.pos = c$1.elm.getBoundingClientRect();
if (map[c$1.key]) {
kept.push(c$1);
} else {
removed.push(c$1);
}
}
this.kept = h(tag, null, kept);
this.removed = removed;
}
return h(tag, null, children)
},
beforeUpdate: function beforeUpdate () {
// force removing pass
this.__patch__(
this._vnode,
this.kept,
false, // hydrating
true // removeOnly (!important, avoids unnecessary moves)
);
this._vnode = this.kept;
},
updated: function updated () {
var children = this.prevChildren;
var moveClass = this.moveClass || ((this.name || 'v') + '-move');
if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
return
}
// we divide the work into three loops to avoid mixing DOM reads and writes
// in each iteration - which helps prevent layout thrashing.
children.forEach(callPendingCbs);
children.forEach(recordPosition);
children.forEach(applyTranslation);
// force reflow to put everything in position
var body = document.body;
var f = body.offsetHeight; // eslint-disable-line
children.forEach(function (c) {
if (c.data.moved) {
var el = c.elm;
var s = el.style;
addTransitionClass(el, moveClass);
s.transform = s.WebkitTransform = s.transitionDuration = '';
el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
if (!e || /transform$/.test(e.propertyName)) {
el.removeEventListener(transitionEndEvent, cb);
el._moveCb = null;
removeTransitionClass(el, moveClass);
}
});
}
});
},
methods: {
hasMove: function hasMove (el, moveClass) {
/* istanbul ignore if */
if (!hasTransition) {
return false
}
/* istanbul ignore if */
if (this._hasMove) {
return this._hasMove
}
// Detect whether an element with the move class applied has
// CSS transitions. Since the element may be inside an entering
// transition at this very moment, we make a clone of it and remove
// all other transition classes applied to ensure only the move class
// is applied.
var clone = el.cloneNode();
if (el._transitionClasses) {
el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
}
addClass(clone, moveClass);
clone.style.display = 'none';
this.$el.appendChild(clone);
var info = getTransitionInfo(clone);
this.$el.removeChild(clone);
return (this._hasMove = info.hasTransform)
}
}
};
function callPendingCbs (c) {
/* istanbul ignore if */
if (c.elm._moveCb) {
c.elm._moveCb();
}
/* istanbul ignore if */
if (c.elm._enterCb) {
c.elm._enterCb();
}
}
function recordPosition (c) {
c.data.newPos = c.elm.getBoundingClientRect();
}
function applyTranslation (c) {
var oldPos = c.data.pos;
var newPos = c.data.newPos;
var dx = oldPos.left - newPos.left;
var dy = oldPos.top - newPos.top;
if (dx || dy) {
c.data.moved = true;
var s = c.elm.style;
s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
s.transitionDuration = '0s';
}
}
var platformComponents = {
Transition: Transition,
TransitionGroup: TransitionGroup
};
/* */
// install platform specific utils
Vue$3.config.mustUseProp = mustUseProp;
Vue$3.config.isReservedTag = isReservedTag;
Vue$3.config.isReservedAttr = isReservedAttr;
Vue$3.config.getTagNamespace = getTagNamespace;
Vue$3.config.isUnknownElement = isUnknownElement;
// install platform runtime directives & components
extend(Vue$3.options.directives, platformDirectives);
extend(Vue$3.options.components, platformComponents);
// install platform patch function
Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
// public mount method
Vue$3.prototype.$mount = function (
el,
hydrating
) {
el = el && inBrowser ? query(el) : undefined;
return mountComponent(this, el, hydrating)
};
// devtools global hook
/* istanbul ignore next */
setTimeout(function () {
if (config.devtools) {
if (devtools) {
devtools.emit('init', Vue$3);
} else if (process.env.NODE_ENV !== 'production' && isChrome) {
console[console.info ? 'info' : 'log'](
'Download the Vue Devtools extension for a better development experience:\n' +
'https://github.com/vuejs/vue-devtools'
);
}
}
if (process.env.NODE_ENV !== 'production' &&
config.productionTip !== false &&
inBrowser && typeof console !== 'undefined'
) {
console[console.info ? 'info' : 'log'](
"You are running Vue in development mode.\n" +
"Make sure to turn on production mode when deploying for production.\n" +
"See more tips at https://vuejs.org/guide/deployment.html"
);
}
}, 0);
/* */
export default Vue$3;
|
var vows = require("vows"),
assert = require("assert"),
d3 = require("d3"),
crossfilter = require("../");
var suite = vows.describe("crossfilter");
var testData = [
{date: "2011-11-14T16:17:54Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T16:20:19Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,3]},
{date: "2011-11-14T16:28:54Z", quantity: 1, total: 300, tip: 200, type: "visa", tags: [2,4,5]},
{date: "2011-11-14T16:30:43Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T16:48:46Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T16:53:41Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,3]},
{date: "2011-11-14T16:54:06Z", quantity: 1, total: 100, tip: null, type: "cash", tags: [2,4,5]},
{date: "2011-11-14T17:02:03Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T17:07:21Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T17:22:59Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: []},
{date: "2011-11-14T17:25:45Z", quantity: 2, total: 200, tip: null, type: "cash", tags: [2,4,5]},
{date: "2011-11-14T17:29:52Z", quantity: 1, total: 200, tip: 100, type: "visa", tags: [-1, 0, 'hello', 'world']},
{date: "2011-11-14T17:33:46Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T17:33:59Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,3]},
{date: "2011-11-14T17:38:40Z", quantity: 2, total: 200, tip: 100, type: "visa", tags: [2,4,5]},
{date: "2011-11-14T17:52:02Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T18:02:42Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T18:02:51Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,3]},
{date: "2011-11-14T18:12:54Z", quantity: 1, total: 200, tip: 100, type: "visa", tags: [2,4,5]},
{date: "2011-11-14T18:14:53Z", quantity: 2, total: 100, tip: null, type: "cash", tags: [2,3,4]},
{date: "2011-11-14T18:45:24Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [2,4,5]},
{date: "2011-11-14T19:00:31Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T19:04:22Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T19:30:44Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,3]},
{date: "2011-11-14T20:06:33Z", quantity: 1, total: 100, tip: null, type: "cash", tags: [2,4,5]},
{date: "2011-11-14T20:49:07Z", quantity: 2, total: 290, tip: 200, type: "tab", tags: [2,4,5]},
{date: "2011-11-14T21:05:36Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T21:18:48Z", quantity: 4, total: 270, tip: 0, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T21:22:31Z", quantity: 1, total: 200, tip: 100, type: "visa", tags: [1,3]},
{date: "2011-11-14T21:26:30Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,4,5]},
{date: "2011-11-14T21:30:55Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T21:31:05Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T22:30:22Z", quantity: 2, total: 89, tip: 0, type: "tab", tags: [1,3]},
{date: "2011-11-14T22:34:28Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,4,5]},
{date: "2011-11-14T22:48:05Z", quantity: 2, total: 91, tip: 0, type: "tab", tags: [2,4,5]},
{date: "2011-11-14T22:51:40Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T22:58:54Z", quantity: 2, total: 100, tip: 0, type: "visa", tags: [2,3,4]},
{date: "2011-11-14T23:06:25Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T23:07:58Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,3]},
{date: "2011-11-14T23:16:09Z", quantity: 1, total: 200, tip: 100, type: "visa", tags: [2,4,5]},
{date: "2011-11-14T23:21:22Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,4,5]},
{date: "2011-11-14T23:23:29Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T23:28:54Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]}
];
suite.addBatch({
"crossfilter": {
topic: function() {
var data = crossfilter(testData);
// be sure you don't clobber a built-in method if you do this!
try {
data.date = data.dimension(function(d) { return new Date(d.date); });
data.quantity = data.dimension(function(d) { return d.quantity; });
data.tip = data.dimension(function(d) { return d.tip; });
data.total = data.dimension(function(d) { return d.total; });
data.type = data.dimension(function(d) { return d.type; });
data.typeByString = data.dimension('type');
data.tags = data.dimension(function(d) { return d.tags; }, true);
data.firstTag = data.dimension('tags[0]');
data.year = data.dimension('getYear');
} catch (e) {
console.log(e.stack);
}
return data;
},
"up to 32 dimensions supported": function() {
var data = crossfilter([]);
for (var i = 0; i < 32; i++) data.dimension(function() { return 0; });
},
"can add and remove 32 dimensions repeatedly": function() {
var data = crossfilter([]),
dimensions = [];
for (var j = 0; j < 10; j++) {
for (var i = 0; i < 32; i++) dimensions.push(data.dimension(function() { return 0; }));
while (dimensions.length) dimensions.pop().dispose();
}
},
"empty data": {
topic: function() {
var data = crossfilter();
try {
data.quantity = data.dimension(function(d) { return d.quantity; });
} catch (e) {
console.log(e.stack);
}
return data;
},
"groupAll": {
topic: function(data) {
data.allGrouped = data.groupAll();
return data;
},
"value": function(data) {
assert.equal(data.allGrouped.value(), 0);
},
"value after removing all data": function(data) {
try {
data.add([{quantity: 2, total: 190}]);
assert.equal(data.allGrouped.value(), 1);
} finally {
data.remove();
assert.equal(data.allGrouped.value(), 0);
}
}
},
"dimension": {
"groupAll (count, the default)": {
topic: function(data) {
data.quantity.count = data.quantity.groupAll();
return data;
},
"value": function(data) {
assert.equal(data.quantity.count.value(), 0);
},
"value after removing all data": function(data) {
try {
data.add([{quantity: 2, total: 190}]);
assert.equal(data.quantity.count.value(), 1);
} finally {
data.remove();
assert.equal(data.quantity.count.value(), 0);
}
}
},
"groupAll (sum of total)": {
topic: function(data) {
data.quantity.total = data.quantity.groupAll().reduceSum(function(d) { return d.total; });
return data;
},
"value": function(data) {
assert.equal(data.quantity.total.value(), 0);
},
"value after removing all data": function(data) {
try {
data.add([{quantity: 2, total: 190}]);
assert.equal(data.quantity.total.value(), 190);
} finally {
data.remove();
assert.equal(data.quantity.total.value(), 0);
}
}
},
"groupAll (custom reduce)": {
topic: function(data) {
data.quantity.custom = data.quantity.groupAll().reduce(add, remove, initial);
function add(p, v) { return p + 1; }
function remove(p, v) { return p - 1; }
function initial() { return 1; }
return data;
},
"value": function(data) {
assert.equal(data.quantity.custom.value(), 1);
},
"value after removing all data": function(data) {
try {
data.add([{quantity: 2, total: 190}]);
assert.equal(data.quantity.custom.value(), 2);
} finally {
data.remove();
assert.equal(data.quantity.custom.value(), 1);
}
}
},
"groupAll (custom reduce information lifecycle)": {
"topic": function() {
var data = crossfilter();
data.add([{foo: 1, val: 2}, {foo: 2, val: 2}, {foo: 3, val: 2}, {foo: 3, val: 2}]);
data.foo = data.dimension(function(d) { return d.foo; });
data.bar = data.dimension(function(d) { return d.foo; });
data.val = data.dimension(function(d) { return d.val; });
data.groupMax = data.bar.groupAll().reduce(function(p,v,n){
if(n) {
p += v.val;
}
return p;
}, function(p,v,n) {
if(n) {
p -= v.val;
}
return p;
}, function() {
return 0;
});
data.groupSum = data.bar.groupAll().reduceSum(function(d) { return d.val; });
return data;
},
"on group creation": function(data) {
assert.deepEqual(data.groupMax.value(), data.groupSum.value());
},
"on filtering": function(data) {
data.foo.filterRange([1, 3]);
assert.deepEqual(data.groupMax.value(), 8);
assert.deepEqual(data.groupSum.value(), 4);
data.foo.filterAll();
},
"on adding data after group creation": function(data) {
data.add([{foo: 1, val: 2}]);
assert.deepEqual(data.groupMax.value(), data.groupSum.value());
},
"on adding data when a filter is in place": function(data) {
data.foo.filterRange([1,3]);
data.add([{foo: 3, val: 1}]);
assert.deepEqual(data.groupMax.value(), 11);
assert.deepEqual(data.groupSum.value(), 6);
data.foo.filterAll();
},
"on removing data after group creation": function(data) {
data.val.filter(1);
data.remove();
assert.deepEqual(data.groupMax.value(), 10);
assert.deepEqual(data.groupSum.value(), 0);
data.val.filterAll();
assert.deepEqual(data.groupMax.value(), data.groupSum.value());
}
}
}
},
"up to 64 dimensions supported": function() {
var data = crossfilter([]);
for (var i = 0; i < 64; i++) data.dimension(function() { return 0; });
},
"can add and remove 64 dimensions repeatedly": function() {
var data = crossfilter([]),
dimensions = [];
for (var j = 0; j < 10; j++) {
for (var i = 0; i < 64; i++) dimensions.push(data.dimension(function() { return 0; }));
while (dimensions.length) dimensions.pop().remove();
}
},
"filtering with more than 32 dimensions": function() {
var data = crossfilter();
var dims = {};
for (var i = 0; i < 50; i++) {
data.add([{value: i}]);
}
var dimfunc = function(i) {
return function(val) {
return val.value == i;
}
}
for (var i = 0; i < 50; i++) {
dims[i] = data.dimension(dimfunc(i));
}
for (var i = 0; i < 50; i++) {
dims[i].filter(1);
data.remove();
dims[i].filterAll();
assert.equal(data.size(), 49 - i);
}
},
"dimension": {
"accessor": function(data) {
assert.equal(data.type.accessor({ type: "a type" }), "a type");
},
"stringAccessor": function(data) {
assert.equal(data.typeByString.accessor({ type: "a type" }), "a type");
},
"stringPathAccessor": function(data) {
assert.equal(data.firstTag.accessor({ tags: [2,4,5] }), 2);
assert.equal(data.firstTag.accessor({ tags: [4,5] }), 4);
},
"stringFunctionCallAccessor": function(data) {
function getYear() {
return new Date(this.date).getFullYear();
}
assert.equal(data.year.accessor({date: "2011-11-14T16:28:54Z", getYear: getYear }), 2011);
},
"top": {
"returns the top k records by value, in descending order": function(data) {
assert.deepEqual(data.total.top(3), [
{date: "2011-11-14T16:28:54Z", quantity: 1, total: 300, tip: 200, type: "visa", tags: [2,4,5]},
{date: "2011-11-14T20:49:07Z", quantity: 2, total: 290, tip: 200, type: "tab", tags: [2,4,5]},
{date: "2011-11-14T21:18:48Z", quantity: 4, total: 270, tip: 0, type: "tab", tags: [1,2,3]}
]);
assert.deepEqual(data.date.top(3), [
{date: "2011-11-14T23:28:54Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T23:23:29Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T23:21:22Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,4,5]}
]);
},
"returns the top k records, using offset, by value, in descending order": function(data) {
assert.deepEqual(data.total.top(3, 1), [
{date: "2011-11-14T20:49:07Z", quantity: 2, total: 290, tip: 200, type: "tab", tags: [2,4,5]},
{date: "2011-11-14T21:18:48Z", quantity: 4, total: 270, tip: 0, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T17:38:40Z", quantity: 2, total: 200, tip: 100, type: 'visa', tags: [2,4,5]}
]);
assert.deepEqual(data.date.top(3,10), [
{date: "2011-11-14T22:30:22Z", quantity: 2, total: 89, tip: 0, type: "tab", tags: [1,3]},
{date: "2011-11-14T21:31:05Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T21:30:55Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]}
]);
},
"observes the associated dimension's filters": function(data) {
try {
data.quantity.filterExact(4);
assert.deepEqual(data.total.top(3), [
{date: "2011-11-14T21:18:48Z", quantity: 4, total: 270, tip: 0, type: "tab", tags: [1,2,3]}
]);
} finally {
data.quantity.filterAll();
}
try {
data.date.filterRange([new Date(Date.UTC(2011, 10, 14, 19)), new Date(Date.UTC(2011, 10, 14, 20))]);
assert.deepEqual(data.date.top(10), [
{date: "2011-11-14T19:30:44Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,3]},
{date: "2011-11-14T19:04:22Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T19:00:31Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]}
]);
assert.deepEqual(data.date.top(10, 2), [
{date: "2011-11-14T19:00:31Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]}
]);
data.date.filterRange([Date.UTC(2011, 10, 14, 19), Date.UTC(2011, 10, 14, 20)]); // also comparable
assert.deepEqual(data.date.top(10), [
{date: "2011-11-14T19:30:44Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,3]},
{date: "2011-11-14T19:04:22Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T19:00:31Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]}
]);
assert.deepEqual(data.date.top(10, 2), [
{date: "2011-11-14T19:00:31Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]}
]);
} finally {
data.date.filterAll();
}
},
"observes other dimensions' filters": function(data) {
try {
data.type.filterExact("tab");
assert.deepEqual(data.total.top(2), [
{date: "2011-11-14T20:49:07Z", quantity: 2, total: 290, tip: 200, type: "tab", tags: [2,4,5]},
{date: "2011-11-14T21:18:48Z", quantity: 4, total: 270, tip: 0, type: "tab", tags: [1,2,3]}
]);
assert.deepEqual(data.total.top(2, 8), [
{date: '2011-11-14T21:26:30Z', quantity: 2, total: 190, tip: 100, type: 'tab', tags: [2,4,5]},
{date: '2011-11-14T23:28:54Z', quantity: 2, total: 190, tip: 100, type: 'tab', tags: [1,2,3]}
]);
data.type.filterExact("visa");
assert.deepEqual(data.total.top(1), [
{date: "2011-11-14T16:28:54Z", quantity: 1, total: 300, tip: 200, type: "visa", tags: [2,4,5]}
]);
data.quantity.filterExact(2);
assert.deepEqual(data.tip.top(1), [
{date: "2011-11-14T17:38:40Z", quantity: 2, total: 200, tip: 100, type: "visa", tags: [2,4,5]}
]);
} finally {
data.type.filterAll();
data.quantity.filterAll();
}
try {
data.type.filterExact("tab");
assert.deepEqual(data.date.top(2), [
{date: "2011-11-14T23:28:54Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T23:23:29Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]}
]);
assert.deepEqual(data.date.top(2, 8), [
{date: '2011-11-14T22:30:22Z', quantity: 2, total: 89, tip: 0, type: 'tab', tags: [1,3]},
{date: '2011-11-14T21:31:05Z', quantity: 2, total: 90, tip: 0, type: 'tab', tags: [1,2,3]}
]);
data.type.filterExact("visa");
assert.deepEqual(data.date.top(1), [
{date: "2011-11-14T23:16:09Z", quantity: 1, total: 200, tip: 100, type: "visa", tags: [2,4,5]}
]);
data.quantity.filterExact(2);
assert.deepEqual(data.date.top(1), [
{date: "2011-11-14T22:58:54Z", quantity: 2, total: 100, tip: 0, type: "visa", tags: [2,3,4]}
]);
} finally {
data.type.filterAll();
data.quantity.filterAll();
}
},
"negative or zero k returns an empty array": function(data) {
assert.deepEqual(data.quantity.top(0), []);
assert.deepEqual(data.quantity.top(-1), []);
assert.deepEqual(data.quantity.top(NaN), []);
assert.deepEqual(data.quantity.top(-Infinity), []);
assert.deepEqual(data.quantity.top(0, 0), []);
assert.deepEqual(data.quantity.top(-1, -1), []);
assert.deepEqual(data.quantity.top(NaN, NaN), []);
assert.deepEqual(data.quantity.top(-Infinity, -Infinity), []);
assert.deepEqual(data.date.top(0), []);
assert.deepEqual(data.date.top(-1), []);
assert.deepEqual(data.date.top(NaN), []);
assert.deepEqual(data.date.top(-Infinity), []);
assert.deepEqual(data.date.top(0, 0), []);
assert.deepEqual(data.date.top(-1, -1), []);
assert.deepEqual(data.date.top(NaN, NaN), []);
assert.deepEqual(data.date.top(-Infinity, -Infinity), []);
}
},
"bottom": {
"returns the bottom k records by value, in descending order": function(data) {
assert.deepEqual(data.total.bottom(3), [
{date: "2011-11-14T22:30:22Z", quantity: 2, total: 89, tip: 0, type: "tab", tags: [1,3]},
{date: "2011-11-14T16:30:43Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T16:48:46Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,2,3]}
]);
assert.deepEqual(data.date.bottom(3), [
{date: "2011-11-14T16:17:54Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T16:20:19Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,3]},
{date: "2011-11-14T16:28:54Z", quantity: 1, total: 300, tip: 200, type: "visa", tags: [2,4,5]}
]);
},
"returns the bottom k records, using offset, by value, in descending order": function(data) {
assert.deepEqual(data.total.bottom(3, 1), [
{date: "2011-11-14T16:30:43Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T16:48:46Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,2,3]},
{date: '2011-11-14T16:53:41Z', quantity: 2, total: 90, tip: 0, type: 'tab', tags: [ 1,3]}
]);
assert.deepEqual(data.date.bottom(3, 10), [
{date: "2011-11-14T17:25:45Z", quantity: 2, total: 200, tip: null, type: "cash", tags: [2,4,5]},
{date: "2011-11-14T17:29:52Z", quantity: 1, total: 200, tip: 100, type: "visa", tags: [-1, 0, 'hello', 'world']},
{date: "2011-11-14T17:33:46Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]}
]);
},
"observes the associated dimension's filters": function(data) {
try {
data.quantity.filterExact(4);
assert.deepEqual(data.total.bottom(3), [
{date: "2011-11-14T21:18:48Z", quantity: 4, total: 270, tip: 0, type: "tab", tags: [1,2,3]}
]);
} finally {
data.quantity.filterAll();
}
try {
data.date.filterRange([new Date(Date.UTC(2011, 10, 14, 19)), new Date(Date.UTC(2011, 10, 14, 20))]);
assert.deepEqual(data.date.bottom(10), [
{date: "2011-11-14T19:00:31Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T19:04:22Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T19:30:44Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,3]}
]);
assert.deepEqual(data.date.bottom(10, 2), [
{date: "2011-11-14T19:30:44Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,3]}
]);
data.date.filterRange([Date.UTC(2011, 10, 14, 19), Date.UTC(2011, 10, 14, 20)]); // also comparable
assert.deepEqual(data.date.bottom(10), [
{date: "2011-11-14T19:00:31Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]},
{date: "2011-11-14T19:04:22Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T19:30:44Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [1,3]}
]);
} finally {
data.date.filterAll();
}
},
"observes other dimensions' filters": function(data) {
try {
data.type.filterExact("tab");
assert.deepEqual(data.total.bottom(2), [
{date: "2011-11-14T22:30:22Z", quantity: 2, total: 89, tip: 0, type: "tab", tags: [1,3]},
{date: "2011-11-14T16:30:43Z", quantity: 2, total: 90, tip: 0, type: "tab", tags: [2,3,4]}
]);
data.type.filterExact("tab");
assert.deepEqual(data.total.bottom(2, 8), [
{date: '2011-11-14T17:52:02Z', quantity: 2, total: 90, tip: 0, type: 'tab', tags: [2,3,4]},
{date: '2011-11-14T18:45:24Z', quantity: 2, total: 90, tip: 0, type: 'tab', tags: [2,4,5]}
]);
data.type.filterExact("visa");
assert.deepEqual(data.total.bottom(1), [
{date: "2011-11-14T22:58:54Z", quantity: 2, total: 100, tip: 0, type: "visa", tags: [2,3,4]}
]);
data.quantity.filterExact(2);
assert.deepEqual(data.tip.bottom(1), [
{date: "2011-11-14T22:58:54Z", quantity: 2, total: 100, tip: 0, type: "visa", tags: [2,3,4]}
]);
} finally {
data.type.filterAll();
data.quantity.filterAll();
}
try {
data.type.filterExact("tab");
assert.deepEqual(data.date.bottom(2), [
{date: "2011-11-14T16:17:54Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T16:20:19Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,3]}
]);
assert.deepEqual(data.date.bottom(2, 8), [
{date: '2011-11-14T17:33:46Z', quantity: 2, total: 190, tip: 100, type: 'tab', tags: [1,2,3]},
{date: '2011-11-14T17:33:59Z', quantity: 2, total: 90, tip: 0, type: 'tab', tags: [1,3]}
]);
data.type.filterExact("visa");
assert.deepEqual(data.date.bottom(1), [
{date: "2011-11-14T16:28:54Z", quantity: 1, total: 300, tip: 200, type: "visa", tags: [2,4,5]}
]);
data.quantity.filterExact(2);
assert.deepEqual(data.date.bottom(1), [
{date: "2011-11-14T17:38:40Z", quantity: 2, total: 200, tip: 100, type: "visa", tags: [2,4,5]}
]);
} finally {
data.type.filterAll();
data.quantity.filterAll();
}
},
"negative or zero k returns an empty array": function(data) {
assert.deepEqual(data.quantity.bottom(0), []);
assert.deepEqual(data.quantity.bottom(-1), []);
assert.deepEqual(data.quantity.bottom(NaN), []);
assert.deepEqual(data.quantity.bottom(-Infinity), []);
assert.deepEqual(data.quantity.bottom(0, 0), []);
assert.deepEqual(data.quantity.bottom(-1, -1), []);
assert.deepEqual(data.quantity.bottom(NaN, NaN), []);
assert.deepEqual(data.quantity.bottom(-Infinity, -Infinity), []);
assert.deepEqual(data.date.bottom(0), []);
assert.deepEqual(data.date.bottom(-1), []);
assert.deepEqual(data.date.bottom(NaN), []);
assert.deepEqual(data.date.bottom(-Infinity), []);
assert.deepEqual(data.date.bottom(0, 0), []);
assert.deepEqual(data.date.bottom(-1, -1), []);
assert.deepEqual(data.date.bottom(NaN, NaN), []);
assert.deepEqual(data.date.bottom(-Infinity, -Infinity), []);
}
},
"filterExact": {
"selects records that match the specified value exactly": function(data) {
try {
data.tip.filterExact(100);
assert.deepEqual(data.date.top(2), [
{date: "2011-11-14T23:28:54Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T23:23:29Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]}
]);
} finally {
data.tip.filterAll();
}
},
"allows the filter value to be null": function(data) {
try {
data.tip.filterExact(null); // equivalent to 0 by natural ordering
assert.deepEqual(data.date.top(2), [
{date: "2011-11-14T22:58:54Z", quantity: 2, total: 100, tip: 0, type: "visa", tags: [2,3,4]},
{date: "2011-11-14T22:48:05Z", quantity: 2, total: 91, tip: 0, type: "tab", tags: [2,4,5]}
]);
} finally {
data.tip.filterAll();
}
}
},
"filterRange": {
"selects records greater than or equal to the inclusive lower bound": function(data) {
try {
data.total.filterRange([100, 190]);
assert.isTrue(data.date.top(Infinity).every(function(d) { return d.total >= 100; }));
data.total.filterRange([110, 190]);
assert.isTrue(data.date.top(Infinity).every(function(d) { return d.total >= 110; }));
} finally {
data.total.filterAll();
}
},
"selects records less than the exclusive lower bound": function(data) {
try {
data.total.filterRange([100, 200]);
assert.isTrue(data.date.top(Infinity).every(function(d) { return d.total < 200; }));
data.total.filterRange([100, 190]);
assert.isTrue(data.date.top(Infinity).every(function(d) { return d.total < 190; }));
} finally {
data.total.filterAll();
}
}
},
"filterAll": {
"clears the filter": function(data) {
data.total.filterRange([100, 200]);
assert.lesser(data.date.top(Infinity).length, 43);
data.total.filterAll();
assert.equal(data.date.top(Infinity).length, 43);
}
},
"filterFunction": {
"selects records according to an arbitrary function": function(data) {
try {
data.total.filterFunction(function(d) { return d % 2; });
assert.isTrue(data.date.top(Infinity).every(function(d) { return d.total % 2; }));
} finally {
data.total.filterAll();
}
},
"respects truthy values": function(data) {
try {
var group = data.quantity.groupAll().reduceCount();
data.total.filterRange([200, Infinity]);
data.total.filterFunction(function(d) { return "0"; });
assert.equal(group.value(), 43);
data.total.filterFunction(function(d) { return ""; });
assert.equal(group.value(), 0);
} finally {
data.total.filterAll();
}
},
"groups on the first dimension are updated correctly": function(data) {
try {
var group = data.date.groupAll().reduceCount();
data.total.filterFunction(function(d) { return d === 90; });
assert.equal(group.value(), 13);
data.total.filterFunction(function(d) { return d === 91; });
assert.equal(group.value(), 1);
} finally {
data.total.filterAll();
}
},
"followed by filterRange": function(data) {
try {
data.total.filterFunction(function(d) { return d % 2; });
data.total.filterRange([100, 200]);
assert.deepEqual(data.date.top(Infinity).length, 19);
} finally {
data.total.filterAll();
}
}
},
"filter": {
"is equivalent to filterRange when passed an array": function(data) {
try {
data.total.filter([100, 190]);
assert.isTrue(data.date.top(Infinity).every(function(d) { return d.total >= 100; }));
} finally {
data.total.filter(null);
}
},
"is equivalent to filterExact when passed a single value": function(data) {
try {
data.total.filter(100);
assert.isTrue(data.date.top(Infinity).every(function(d) { return d.total == 100; }));
} finally {
data.total.filter(null);
}
},
"is equivalent to filterFunction when passed a function": function(data) {
try {
data.total.filter(function(d) { return d % 2; });
assert.isTrue(data.date.top(Infinity).every(function(d) { return d.total % 2; }));
} finally {
data.total.filter(null);
}
},
"is equivalent to filterAll when passed null": function(data) {
data.total.filter([100, 200]);
assert.lesser(data.date.top(Infinity).length, 43);
data.total.filter(null);
assert.equal(data.date.top(Infinity).length, 43);
}
},
"groupAll (count, the default)": {
topic: function(data) {
data.quantity.count = data.quantity.groupAll();
return data;
},
"does not have top and order methods": function(data) {
assert.isFalse("top" in data.quantity.count);
assert.isFalse("order" in data.quantity.count);
},
"reduce": {
"reduces by add, remove, and initial": function(data) {
try {
data.quantity.count.reduce(
function(p, v) { return p + v.total; },
function(p, v) { return p - v.total; },
function() { return 0; });
assert.strictEqual(data.quantity.count.value(), 6660);
} finally {
data.quantity.count.reduceCount();
}
}
},
"reduceCount": {
"reduces by count": function(data) {
data.quantity.count.reduceSum(function(d) { return d.total; });
assert.strictEqual(data.quantity.count.value(), 6660);
data.quantity.count.reduceCount();
assert.strictEqual(data.quantity.count.value(), 43);
}
},
"reduceSum": {
"reduces by sum of accessor function": function(data) {
try {
data.quantity.count.reduceSum(function(d) { return d.total; });
assert.strictEqual(data.quantity.count.value(), 6660);
data.quantity.count.reduceSum(function() { return 1; });
assert.strictEqual(data.quantity.count.value(), 43);
} finally {
data.quantity.count.reduceCount();
}
}
},
"value": {
"returns the count of matching records": function(data) {
assert.strictEqual(data.quantity.count.value(), 43);
},
"does not observe the associated dimension's filters": function(data) {
try {
data.quantity.filterRange([100, 200]);
assert.strictEqual(data.quantity.count.value(), 43);
} finally {
data.quantity.filterAll();
}
},
"observes other dimensions' filters": function(data) {
try {
data.type.filterExact("tab");
assert.strictEqual(data.quantity.count.value(), 32);
data.type.filterExact("visa");
assert.strictEqual(data.quantity.count.value(), 7);
data.tip.filterExact(100);
assert.strictEqual(data.quantity.count.value(), 5);
} finally {
data.type.filterAll();
data.tip.filterAll();
}
}
},
"dispose": {
"detaches from reduce listeners": function() {
var data = crossfilter([0, 1, 2]),
callback, // indicates a reduce has occurred in this group
dimension = data.dimension(function(d) { return d; }),
other = data.dimension(function(d) { return d; }),
all = dimension.groupAll().reduce(function() { callback = true; }, function() { callback = true; }, function() {});
all.value(); // force this group to be reduced when filters change
callback = false;
all.dispose();
other.filterRange([1, 2]);
assert.isFalse(callback);
},
"detaches from add listeners": function() {
var data = crossfilter([0, 1, 2]),
callback, // indicates data has been added and triggered a reduce
dimension = data.dimension(function(d) { return d; }),
all = dimension.groupAll().reduce(function() { callback = true; }, function() { callback = true; }, function() {});
all.value(); // force this group to be reduced when data is added
callback = false;
all.dispose();
data.add([3, 4, 5]);
assert.isFalse(callback);
}
}
},
"groupAll (sum of total)": {
topic: function(data) {
data.quantity.total = data.quantity.groupAll().reduceSum(function(d) { return d.total; });
return data;
},
"does not have top and order methods": function(data) {
assert.isFalse("top" in data.quantity.total);
assert.isFalse("order" in data.quantity.total);
},
"reduce": {
"determines the computed reduce value": function(data) {
try {
data.quantity.total.reduce(
function(p) { return p + 1; },
function(p) { return p - 1; },
function() { return 0; });
assert.strictEqual(data.quantity.total.value(), 43);
} finally {
data.quantity.total.reduceSum(function(d) { return d.total; });
}
}
},
"value": {
"returns the sum total of matching records": function(data) {
assert.strictEqual(data.quantity.total.value(), 6660);
},
"does not observe the associated dimension's filters": function(data) {
try {
data.quantity.filterRange([100, 200]);
assert.strictEqual(data.quantity.total.value(), 6660);
} finally {
data.quantity.filterAll();
}
},
"observes other dimensions' filters": function(data) {
try {
data.type.filterExact("tab");
assert.strictEqual(data.quantity.total.value(), 4760);
data.type.filterExact("visa");
assert.strictEqual(data.quantity.total.value(), 1400);
data.tip.filterExact(100);
assert.strictEqual(data.quantity.total.value(), 1000);
} finally {
data.type.filterAll();
data.tip.filterAll();
}
}
}
},
"group": {
topic: function(data) {
data.date.hours = data.date.group(function(d) { d = new Date(+d); d.setHours(d.getHours(), 0, 0, 0); return d; });
data.type.types = data.type.group();
return data;
},
"key defaults to value": function(data) {
assert.deepEqual(data.type.types.top(Infinity), [
{key: "tab", value: 32},
{key: "visa", value: 7},
{key: "cash", value: 4}
]);
},
"cardinality may be greater than 256": function() {
var data = crossfilter(d3.range(256).concat(256, 256)),
index = data.dimension(function(d) { return d; }),
indexes = index.group();
assert.deepEqual(index.top(2), [256, 256]);
assert.deepEqual(indexes.top(1), [{key: 256, value: 2}]);
assert.equal(indexes.size(), 257);
},
"cardinality may be greater than 65536": function() {
var data = crossfilter(d3.range(65536).concat(65536, 65536)),
index = data.dimension(function(d) { return d; }),
indexes = index.group();
assert.deepEqual(index.top(2), [65536, 65536]);
assert.deepEqual(indexes.top(1), [{key: 65536, value: 2}]);
assert.equal(indexes.size(), 65537);
},
"adds all records before removing filtered": function(data) {
try {
data.quantity.filter(1);
// Group only adds
var addGroup = data.type.group().reduce(
function(p, v) {
++p;
return p;
}, function(p, v) {
return p;
}, function() {
return 0;
}
);
// Normal group
var stdGroup = data.type.group();
assert.isTrue(addGroup.top(1)[0].value > stdGroup.top(1)[0].value);
} finally {
data.quantity.filterAll();
}
},
"size": {
"returns the cardinality": function(data) {
assert.equal(data.date.hours.size(), 8);
assert.equal(data.type.types.size(), 3);
},
"ignores any filters": function(data) {
try {
data.type.filterExact("tab");
data.quantity.filterRange([100, 200]);
assert.equal(data.date.hours.size(), 8);
assert.equal(data.type.types.size(), 3);
} finally {
data.quantity.filterAll();
data.type.filterAll();
}
}
},
"reduce": {
"defaults to count": function(data) {
assert.deepEqual(data.date.hours.top(1), [
{key: new Date(Date.UTC(2011, 10, 14, 17, 00, 00)), value: 9}
]);
},
"determines the computed reduce value": function(data) {
try {
data.date.hours.reduceSum(function(d) { return d.total; });
assert.deepEqual(data.date.hours.top(1), [
{key: new Date(Date.UTC(2011, 10, 14, 17, 00, 00)), value: 1240}
]);
} finally {
data.date.hours.reduceCount();
}
},
"gives reduce functions information on lifecycle of data element": {
"topic": function() {
var data = crossfilter();
data.add([{foo: 1, val: 2}, {foo: 2, val: 2}, {foo: 3, val: 2}, {foo: 3, val: 2}]);
data.foo = data.dimension(function(d) { return d.foo; });
data.bar = data.dimension(function(d) { return d.foo; });
data.val = data.dimension(function(d) { return d.val; });
data.groupMax = data.bar.group().reduce(function(p,v,n){
if(n) {
p += v.val;
}
return p;
}, function(p,v,n) {
if(n) {
p -= v.val;
}
return p;
}, function() {
return 0;
});
data.groupSum = data.bar.group().reduceSum(function(d) { return d.val; });
return data;
},
"on group creation": function(data) {
assert.deepEqual(data.groupMax.all(), data.groupSum.all());
},
"on filtering": function(data) {
data.foo.filterRange([1, 3]);
assert.deepEqual(data.groupMax.all(), [{ key: 1, value: 2 }, { key: 2, value: 2 }, { key: 3, value: 4 }]);
assert.deepEqual(data.groupSum.all(), [{ key: 1, value: 2 }, { key: 2, value: 2 }, { key: 3, value: 0 }]);
data.foo.filterAll();
},
"on adding data after group creation": function(data) {
data.add([{foo: 1, val: 2}]);
assert.deepEqual(data.groupMax.all(), data.groupSum.all());
},
"on adding data when a filter is in place": function(data) {
data.foo.filterRange([1,3]);
data.add([{foo: 3, val: 1}]);
assert.deepEqual(data.groupMax.all(), [{ key: 1, value: 4 }, { key: 2, value: 2 }, { key: 3, value: 5 }]);
assert.deepEqual(data.groupSum.all(), [{ key: 1, value: 4 }, { key: 2, value: 2 }, { key: 3, value: 0 }]);
data.foo.filterAll();
},
"on removing data after group creation": function(data) {
data.val.filter(1);
data.remove();
assert.deepEqual(data.groupMax.all(), [{ key: 1, value: 4 },{ key: 2, value: 2 },{ key: 3, value: 4 }]);
assert.deepEqual(data.groupSum.all(), [{ key: 1, value: 0 },{ key: 2, value: 0 },{ key: 3, value: 0 }]);
data.val.filterAll();
assert.deepEqual(data.groupMax.all(), data.groupSum.all());
}
}
},
"top": {
"returns the top k groups by reduce value, in descending order": function(data) {
assert.deepEqual(data.date.hours.top(3), [
{key: new Date(Date.UTC(2011, 10, 14, 17, 00, 00)), value: 9},
{key: new Date(Date.UTC(2011, 10, 14, 16, 00, 00)), value: 7},
{key: new Date(Date.UTC(2011, 10, 14, 21, 00, 00)), value: 6}
]);
},
"observes the specified order": function(data) {
try {
data.date.hours.order(function(v) { return -v; });
assert.deepEqual(data.date.hours.top(3), [
{key: new Date(Date.UTC(2011, 10, 14, 20, 00, 00)), value: 2},
{key: new Date(Date.UTC(2011, 10, 14, 19, 00, 00)), value: 3},
{key: new Date(Date.UTC(2011, 10, 14, 18, 00, 00)), value: 5}
]);
} finally {
data.date.hours.order(function(v) { return v; });
}
}
},
"order": {
"defaults to the identity function": function(data) {
assert.deepEqual(data.date.hours.top(1), [
{key: new Date(Date.UTC(2011, 10, 14, 17, 00, 00)), value: 9}
]);
},
"is useful in conjunction with a compound reduce value": function(data) {
try {
data.date.hours.reduce(
function(p, v) { ++p.count; p.total += v.total; return p; },
function(p, v) { --p.count; p.total -= v.total; return p; },
function() { return {count: 0, total: 0}; })
.order(function(v) { return v.total; });
assert.deepEqual(data.date.hours.top(1), [
{key: new Date(Date.UTC(2011, 10, 14, 17, 00, 00)), value: {count: 9, total: 1240}}
]);
} finally {
data.date.hours.reduceCount().orderNatural();
}
}
},
"dispose": {
"detaches from reduce listeners": function() {
var data = crossfilter([0, 1, 2]),
callback, // indicates a reduce has occurred in this group
dimension = data.dimension(function(d) { return d; }),
other = data.dimension(function(d) { return d; }),
group = dimension
.group(function(d) { return d; })
.reduce(function() { callback = true; }, function() { callback = true; }, function() {});
group.all(); // force this group to be reduced when filters change
callback = false;
group.dispose();
other.filterRange([1, 2]);
assert.isFalse(callback);
},
"detaches from add listeners": function() {
var data = crossfilter([0, 1, 2]),
callback, // indicates data has been added and the group has been reduced
dimension = data.dimension(function(d) { return d; }),
group = dimension
.group(function(d) { return d; })
.reduce(function() { callback = true; }, function() { callback = true; }, function() {});
group.all(); // force this group to be reduced when filters change
callback = false;
group.dispose();
data.add([3, 4, 5]);
assert.isFalse(callback);
}
}
},
"dispose": {
"detaches from add listeners": function() {
var data = crossfilter([0, 1, 2]),
callback, // indicates a reduce has occurred in this group
dimension = data.dimension(function(d) { callback = true; return d; });
callback = false;
dimension.dispose();
data.add([3, 4, 5]);
assert.isFalse(callback);
},
"detaches groups from reduce listeners": function() {
var data = crossfilter([0, 1, 2]),
callback, // indicates a reduce has occurred in this group
dimension = data.dimension(function(d) { return d; }),
other = data.dimension(function(d) { return d; }),
group = dimension
.group(function(d) { return d; })
.reduce(function() { callback = true; }, function() { callback = true; }, function() {});
group.all(); // force this group to be reduced when filters change
callback = false;
dimension.dispose();
other.filterRange([1, 2]);
assert.isFalse(callback);
},
"detaches groups from add listeners": function() {
var data = crossfilter([0, 1, 2]),
callback, // indicates data has been added and the group has been reduced
dimension = data.dimension(function(d) { return d; }),
group = dimension
.group(function(d) { return d; })
.reduce(function() { callback = true; }, function() { callback = true; }, function() {});
group.all(); // force this group to be reduced when filters change
callback = false;
dimension.dispose();
data.add([3, 4, 5]);
assert.isFalse(callback);
},
"clears dimension filters from groups": function() {
var data = crossfilter([0, 0, 2, 2]),
d1 = data.dimension(function(d) { return -d; }),
d2 = data.dimension(function(d) { return +d; }),
g2 = d2.group(function(d) { return Math.round( d / 2 ) * 2; }),
all = g2.all();
d1.filterRange([-1, 1]); // a filter is present when the dimension is disposed
d1.dispose();
assert.deepEqual(g2.all(), [{key: 0, value: 2}, {key: 2, value: 2}]);
}
}
},
"groupAll": {
topic: function(data) {
data.allGrouped = data.groupAll().reduceSum(function(d) { return d.total; });
return data;
},
"does not have top and order methods": function(data) {
assert.isFalse("top" in data.allGrouped);
assert.isFalse("order" in data.allGrouped);
},
"reduce": {
"determines the computed reduce value": function(data) {
try {
data.allGrouped.reduceCount();
assert.strictEqual(data.allGrouped.value(), 43);
} finally {
data.allGrouped.reduceSum(function(d) { return d.total; });
}
},
"gives reduce functions information on lifecycle of data element": {
"topic": function() {
var data = crossfilter();
data.add([{foo: 1, val: 2}, {foo: 2, val: 2}, {foo: 3, val: 2}, {foo: 3, val: 2}]);
data.foo = data.dimension(function(d) { return d.foo; });
data.bar = data.dimension(function(d) { return d.foo; });
data.val = data.dimension(function(d) { return d.val; });
data.groupMax = data.groupAll().reduce(function(p,v,n){
if(n) {
p += v.val;
}
return p;
}, function(p,v,n) {
if(n) {
p -= v.val;
}
return p;
}, function() {
return 0;
});
data.groupSum = data.groupAll().reduceSum(function(d) { return d.val; });
return data;
},
"on group creation": function(data) {
assert.deepEqual(data.groupMax.value(), data.groupSum.value());
},
"on filtering": function(data) {
data.foo.filterRange([1, 3]);
assert.deepEqual(data.groupMax.value(), 8);
assert.deepEqual(data.groupSum.value(), 4);
data.foo.filterAll();
},
"on adding data after group creation": function(data) {
data.add([{foo: 1, val: 2}]);
assert.deepEqual(data.groupMax.value(), data.groupSum.value());
},
"on adding data when a filter is in place": function(data) {
data.foo.filterRange([1,3]);
data.add([{foo: 3, val: 1}]);
assert.deepEqual(data.groupMax.value(), 11);
assert.deepEqual(data.groupSum.value(), 6);
data.foo.filterAll();
},
"on removing data after group creation": function(data) {
data.val.filter(1);
data.remove();
assert.deepEqual(data.groupMax.value(), 10);
assert.deepEqual(data.groupSum.value(), 0);
data.val.filterAll();
assert.deepEqual(data.groupMax.value(), data.groupSum.value());
}
}
},
"value": {
"returns the sum total of matching records": function(data) {
assert.strictEqual(data.allGrouped.value(), 6660);
},
"observes all dimension's filters": function(data) {
try {
data.type.filterExact("tab");
assert.strictEqual(data.allGrouped.value(), 4760);
data.type.filterExact("visa");
assert.strictEqual(data.allGrouped.value(), 1400);
data.tip.filterExact(100);
assert.strictEqual(data.allGrouped.value(), 1000);
} finally {
data.type.filterAll();
data.tip.filterAll();
}
}
},
"dispose": {
"detaches from reduce listeners": function() {
var data = crossfilter([0, 1, 2]),
callback, // indicates a reduce has occurred in this group
other = data.dimension(function(d) { return d; }),
all = data.groupAll().reduce(function() { callback = true; }, function() { callback = true; }, function() {});
all.value(); // force this group to be reduced when filters change
callback = false;
all.dispose();
other.filterRange([1, 2]);
assert.isFalse(callback);
},
"detaches from add listeners": function() {
var data = crossfilter([0, 1, 2]),
callback, // indicates data has been added and triggered a reduce
all = data.groupAll().reduce(function() { callback = true; }, function() { callback = true; }, function() {});
all.value(); // force this group to be reduced when data is added
callback = false;
all.dispose();
data.add([3, 4, 5]);
assert.isFalse(callback);
}
}
},
"size": {
"returns the total number of elements": function(data) {
assert.equal(data.size(), 43);
},
"is not affected by any dimension filters": function(data) {
try {
data.quantity.filterExact(4);
assert.equal(data.size(), 43);
} finally {
data.quantity.filterAll();
}
}
},
"all": {
"returns the full data array": function(data) {
var raw = data.all();
assert.equal(raw.length, 43);
},
"is not affected by any dimension filters": function(data) {
try {
data.quantity.filterExact(4);
var raw = data.all();
assert.equal(raw.length, 43);
} finally {
data.quantity.filterAll();
}
}
},
"allFiltered": {
"returns the full data array if no filters applied": function(data) {
var raw = data.allFiltered();
assert.equal(raw.length, 43);
},
"is affected by all dimension filters": function(data) {
try {
data.quantity.filterExact(4);
var raw = data.allFiltered();
assert.equal(raw.length, 1);
data.quantity.filterExact(2);
var raw = data.allFiltered();
assert.equal(raw.length, 35);
data.total.filterRange([190, 300]);
var raw = data.allFiltered();
assert.equal(raw.length, 18);
} finally {
data.quantity.filterAll();
data.total.filterAll();
}
}
},
"add": {
"increases the size of the crossfilter": function() {
var data = crossfilter([]);
assert.equal(data.size(), 0);
data.add([0, 1, 2, 3, 4, 5, 6, 6, 6, 7]);
assert.equal(data.size(), 10);
data.add([]);
assert.equal(data.size(), 10);
},
"existing filters are consistent with new records": function(data) {
var data = crossfilter([]),
foo = data.dimension(function(d) { return +d; }),
bar = data.dimension(function(d) { return -d; });
assert.deepEqual(foo.top(Infinity), []);
foo.filterExact(42);
data.add([43, 42, 41]);
assert.deepEqual(foo.top(Infinity), [42]);
assert.deepEqual(bar.top(Infinity), [42]);
data.add([43, 42]);
assert.deepEqual(foo.top(Infinity), [42, 42]);
assert.deepEqual(bar.top(Infinity), [42, 42]);
foo.filterRange([42, 44]);
data.add([43]);
assert.deepEqual(foo.top(Infinity), [43, 43, 43, 42, 42]);
assert.deepEqual(bar.top(Infinity), [42, 42, 43, 43, 43]);
foo.filterFunction(function(d) { return d % 2 === 1; });
data.add([44, 44, 45]);
assert.deepEqual(foo.top(Infinity), [45, 43, 43, 43, 41]);
assert.deepEqual(bar.top(Infinity), [41, 43, 43, 43, 45]);
bar.filterExact([-43]);
assert.deepEqual(bar.top(Infinity), [43, 43, 43]);
data.add([43]);
assert.deepEqual(bar.top(Infinity), [43, 43, 43, 43]);
bar.filterAll();
data.add([0]);
assert.deepEqual(bar.top(Infinity), [41, 43, 43, 43, 43, 45]);
foo.filterAll();
assert.deepEqual(bar.top(Infinity), [0, 41, 42, 42, 43, 43, 43, 43, 44, 44, 45]);
},
"existing groups are consistent with new records": function(data) {
var data = crossfilter([]),
foo = data.dimension(function(d) { return +d; }),
bar = data.dimension(function(d) { return -d; }),
foos = foo.group(),
all = data.groupAll();
assert.equal(all.value(), 0);
assert.deepEqual(foos.all(), []);
foo.filterExact(42);
data.add([43, 42, 41]);
assert.equal(all.value(), 1);
assert.deepEqual(foos.all(), [{key: 41, value: 1}, {key: 42, value: 1}, {key: 43, value: 1}]);
bar.filterExact(-42);
assert.equal(all.value(), 1);
assert.deepEqual(foos.all(), [{key: 41, value: 0}, {key: 42, value: 1}, {key: 43, value: 0}]);
data.add([43, 42, 41]);
assert.equal(all.value(), 2);
assert.deepEqual(foos.all(), [{key: 41, value: 0}, {key: 42, value: 2}, {key: 43, value: 0}]);
bar.filterAll();
assert.equal(all.value(), 2);
assert.deepEqual(foos.all(), [{key: 41, value: 2}, {key: 42, value: 2}, {key: 43, value: 2}]);
foo.filterAll();
assert.equal(all.value(), 6);
},
"can add new groups that are before existing groups": function(data) {
var data = crossfilter(),
foo = data.dimension(function(d) { return +d; }),
foos = foo.group().reduce(add, remove, initial).order(order);
data.add([2]).add([1, 1, 1]);
assert.deepEqual(foos.top(2), [{key: 1, value: {foo: 3}}, {key: 2, value: {foo: 1}}]);
function order(p) { return p.foo; }
function add(p, v) { ++p.foo; return p; }
function remove(p, v) { --p.foo; return p; }
function initial() { return {foo: 0}; }
},
"can add more than 256 groups": function(data) {
var data = crossfilter(),
foo = data.dimension(function(d) { return +d; }),
bar = data.dimension(function(d) { return +d; }),
foos = foo.group();
data.add(d3.range(0, 256));
assert.deepEqual(foos.all().map(function(d) { return d.key; }), d3.range(0, 256));
assert(foos.all().every(function(d) { return d.value == 1; }));
data.add([128]);
assert.deepEqual(foos.top(1), [{key: 128, value: 2}]);
bar.filterExact(0);
data.add(d3.range(-256, 0));
assert.deepEqual(foos.all().map(function(d) { return d.key; }), d3.range(-256, 256));
assert.deepEqual(foos.top(1), [{key: 0, value: 1}]);
},
"can add lots of groups in reverse order": function(data) {
var data = crossfilter(),
foo = data.dimension(function(d) { return -d.foo; }),
bar = data.dimension(function(d) { return d.bar; }),
foos = foo.group(Math.floor).reduceSum(function(d) { return d.foo; });
bar.filterExact(1);
for (var i = 0; i < 1000; i++) {
data.add(d3.range(10).map(function(d) {
return {foo: i + d / 10, bar: i % 4, baz: d + i * 10};
}));
}
assert.deepEqual(foos.top(1), [{key: -998, value: 8977.5}]);
}
},
"remove": {
topic: function() {
var data = crossfilter();
data.foo = data.dimension(function(d) { return d.foo; });
data.foo.div2 = data.foo.group(function(value) { return Math.floor(value / 2); });
data.foo.positive = data.foo.group(function(value) { return value > 0 | 0; });
return data;
},
"removing a record works for a group with cardinality one": function(data) {
data.add([{foo: 1}, {foo: 1.1}, {foo: 1.2}]);
data.foo.filter(1.1);
data.remove();
data.foo.filterAll();
data.remove();
assert.deepEqual(data.foo.top(Infinity), []);
},
"removing a record works for another group with cardinality one": function(data) {
data.add([{foo: 0}, {foo: -1}]);
assert.deepEqual(data.foo.positive.all(), [{key: 0, value: 2}]);
data.foo.filter(0);
data.remove();
assert.deepEqual(data.foo.positive.all(), [{key: 0, value: 1}]);
data.foo.filterAll();
assert.deepEqual(data.foo.top(Infinity), [{foo: -1}]);
data.remove();
assert.deepEqual(data.foo.top(Infinity), []);
},
"removing a record updates dimension": function(data) {
data.add([{foo: 1}, {foo: 2}]);
data.foo.filterExact(1);
data.remove();
data.foo.filterAll();
assert.deepEqual(data.foo.top(Infinity), [{foo: 2}]);
data.remove();
assert.deepEqual(data.foo.top(Infinity), []);
},
"removing records updates group": function(data) {
data.add([{foo: 1}, {foo: 2}, {foo: 3}]);
assert.deepEqual(data.foo.top(Infinity), [{foo: 3}, {foo: 2}, {foo: 1}]);
assert.deepEqual(data.foo.div2.all(), [{key: 0, value: 1}, {key: 1, value: 2}]);
data.foo.filterRange([1, 3]);
data.remove();
data.foo.filterAll();
assert.deepEqual(data.foo.top(Infinity), [{foo: 3}]);
assert.deepEqual(data.foo.div2.all(), [{key: 1, value: 1}]);
data.remove();
assert.deepEqual(data.foo.top(Infinity), []);
assert.deepEqual(data.foo.div2.all(), []);
},
"filtering works correctly after removing a record": function(data) {
data.add([{foo: 1}, {foo: 2}, {foo: 3}]);
data.foo.filter(2);
data.remove();
data.foo.filterAll();
assert.deepEqual(data.foo.top(Infinity), [{foo: 3}, {foo: 1}]);
data.remove();
assert.deepEqual(data.foo.top(Infinity), []);
}
},
"onChange": {
"topic": function(){
var data = crossfilter(testData);
return data;
},
"returns a callback function": function(data) {
var cb = data.onChange(function(){});
assert.equal(typeof cb, 'function');
},
"sends the eventName with the callback": function(data) {
var name
var cb = data.onChange(function(n){name = n});
data.add([1])
assert.equal(name, 'dataAdded');
},
"callback gets called when adding data": function(data) {
var pass = false;
var cb = data.onChange(function(){
pass = true;
});
data.add([1]);
assert.equal(pass, true);
},
"callback gets called when removing all data": function(data) {
var pass = false;
var cb = data.onChange(function(){
pass = true;
});
data.remove();
assert.equal(pass, true);
},
"callback gets called when removing some data": function(data) {
var num = 0;
var cb = data.onChange(function(){
num++;
});
var dateDim = data.dimension(function(d){
return d.data;
});
dateDim.filter('2011-11-14T16:54:06Z');
data.remove();
assert.equal(num, 2);
},
"callback gets called when filtering data various ways": function(data) {
var num = 0;
var cb = data.onChange(function(){
num++;
});
var totalDim = data.dimension(function(d){
return d.data;
});
totalDim.filter([30, 70]);
totalDim.filter(55);
totalDim.filter(function(d) { return d % 2; });
totalDim.filter();
assert.equal(num, 4);
},
"multiple callbacks gets called in sequence of registration": function(data) {
var pass1,pass2,pass3,pass4,num = 0;
var cb1 = data.onChange(function(){
pass1 = ++num;
});
var cb2 = data.onChange(function(){
pass2 = ++num;
});
var cb3 = data.onChange(function(){
pass3 = ++num;
});
var cb4 = data.onChange(function(){
pass4 = ++num;
});
var totalDim = data.dimension(function(d){
return d.data;
});
totalDim.filter(50);
assert.equal(pass1, 1);
assert.equal(pass2, 2);
assert.equal(pass3, 3);
assert.equal(pass4, 4);
},
"callback is removed when the returned function called": function(data) {
var num = 0;
var cb = data.onChange(function(){
num++;
});
var totalDim = data.dimension(function(d){
return d.data;
});
totalDim.filter([30, 70]);
totalDim.filter(55);
cb();
totalDim.filter(function(d) { return d % 2; });
totalDim.filter();
assert.equal(num, 2);
},
},
"iterablesEmptyRows": {
topic: function(data) {
var emptyRowsTestData = [
{name: "apha", labels: []},
{name: "bravo", labels: []},
{name: "charle", labels: []},
{name: "delta", labels: []},
{name: "echo", labels: ["courageous"]}
];
var data = crossfilter(emptyRowsTestData);
data.labels = data.dimension(function(d) { return d.labels; }, true);
return data;
},
"top": {
"returns the top k records by value, placing non-empty row on top": function(data) {
assert.deepEqual(data.labels.top(5), [
{name: "echo", labels: ["courageous"]},
{name: "apha", labels: []},
{name: "bravo", labels: []},
{name: "charle", labels: []},
{name: "delta", labels: []},
]);
},
"returns the top k records, using offset, by value": function(data) {
assert.deepEqual(data.labels.top(3, 2), [
{name: "bravo", labels: []},
{name: "charle", labels: []},
{name: "delta", labels: []}
]);
}
},
"bottom": {
"returns the bottom k records by value, placing non-empty row on bottom": function(data) {
assert.deepEqual(data.labels.bottom(5), [
{name: "apha", labels: []},
{name: "bravo", labels: []},
{name: "charle", labels: []},
{name: "delta", labels: []},
{name: "echo", labels: ["courageous"]}
]);
},
"returns the bottom k records, using offset, by value, in descending order": function(data) {
assert.deepEqual(data.labels.bottom(3, 2), [
{name: "charle", labels: []},
{name: "delta", labels: []},
{name: "echo", labels: ["courageous"]}
]);
}
}
},
"iterableDimension": {
"top":{
"returns the top k records by value, in descending order": function(data) {
var top = data.tags.top(3)
assert.equal(top.length, 3)
assert.equal(Math.max.apply(null, top[0].tags), 5)
assert.equal(Math.max.apply(null, top[1].tags), 5)
assert.equal(Math.max.apply(null, top[2].tags), 5)
},
"observes the associated dimension's filters": function(data) {
try {
data.tags.filterExact(1);
var top = data.tags.top(3)
assert.equal(top[0].tags.indexOf(1) > -1, true)
assert.equal(top[1].tags.indexOf(1) > -1, true)
assert.equal(top[2].tags.indexOf(1) > -1, true)
} finally {
data.tags.filterAll();
}
},
"observes other dimensions' filters": function(data) {
try {
data.quantity.filterExact(4);
assert.deepEqual(data.tags.top(1), [
{date: '2011-11-14T21:18:48Z', quantity: 4, total: 270, tip: 0, type: 'tab', tags: [1,2,3]}
]);
data.quantity.filterAll();
data.type.filterExact("visa");
assert.deepEqual(data.tags.top(1), [
{date: "2011-11-14T16:28:54Z", quantity: 1, total: 300, tip: 200, type: "visa", tags: [2,4,5]}
]);
data.quantity.filterExact(2);
assert.deepEqual(data.tags.top(1), [
{date: "2011-11-14T17:38:40Z", quantity: 2, total: 200, tip: 100, type: "visa", tags: [2,4,5]}
]);
} finally {
data.type.filterAll();
data.quantity.filterAll();
}
try {
data.type.filterExact("tab");
assert.deepEqual(data.date.top(2), [
{date: "2011-11-14T23:28:54Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [1,2,3]},
{date: "2011-11-14T23:23:29Z", quantity: 2, total: 190, tip: 100, type: "tab", tags: [2,3,4]}
]);
data.type.filterExact("visa");
assert.deepEqual(data.date.top(1), [
{date: "2011-11-14T23:16:09Z", quantity: 1, total: 200, tip: 100, type: "visa", tags: [2,4,5]}
]);
data.quantity.filterExact(2);
assert.deepEqual(data.date.top(1), [
{date: "2011-11-14T22:58:54Z", quantity: 2, total: 100, tip: 0, type: "visa", tags: [2,3,4]}
]);
} finally {
data.type.filterAll();
data.quantity.filterAll();
}
},
"negative or zero k returns an empty array": function(data) {
assert.deepEqual(data.tags.top(0), []);
assert.deepEqual(data.tags.top(-1), []);
assert.deepEqual(data.tags.top(NaN), []);
assert.deepEqual(data.tags.top(-Infinity), []);
}
},
"bottom": {
"returns the bottom k records by value, in descending order": function(data) {
var bottom = data.tags.bottom(3)
assert.equal(bottom[0].tags.length, 0)
assert.equal(bottom[1].tags[0], -1)
assert.equal(bottom[2].tags[1], 0)
},
"observes the associated dimension's filters": function(data) {
try {
data.quantity.filterExact(4);
assert.deepEqual(data.tags.bottom(3), [
{date: '2011-11-14T21:18:48Z',quantity: 4,total: 270,tip: 0,type: 'tab',tags: [1,2,3]},
{date: '2011-11-14T21:18:48Z',quantity: 4,total: 270,tip: 0,type: 'tab',tags: [1,2,3]},
{date: '2011-11-14T21:18:48Z',quantity: 4,total: 270,tip: 0,type: 'tab',tags: [1,2,3]}
]);
} finally {
data.quantity.filterAll();
}
try {
data.date.filterRange([new Date(Date.UTC(2011, 10, 14, 19)), new Date(Date.UTC(2011, 10, 14, 20))]);
assert.deepEqual(data.tags.bottom(10), [
{date: '2011-11-14T19:04:22Z', quantity: 2, total: 90, tip: 0, type: 'tab', tags: [ 1, 2, 3 ]},
{date: '2011-11-14T19:30:44Z', quantity: 2, total: 90, tip: 0, type: 'tab', tags: [ 1, 3 ]},
{date: '2011-11-14T19:00:31Z', quantity: 2, total: 190, tip: 100, type: 'tab', tags: [ 2, 3, 4 ]},
{date: '2011-11-14T19:04:22Z', quantity: 2, total: 90, tip: 0, type: 'tab', tags: [ 1, 2, 3 ]},
{date: '2011-11-14T19:00:31Z', quantity: 2, total: 190, tip: 100, type: 'tab', tags: [ 2, 3, 4 ]},
{date: '2011-11-14T19:04:22Z', quantity: 2, total: 90, tip: 0, type: 'tab', tags: [ 1, 2, 3 ]},
{date: '2011-11-14T19:30:44Z', quantity: 2, total: 90, tip: 0, type: 'tab', tags: [ 1, 3 ]},
{date: '2011-11-14T19:00:31Z', quantity: 2, total: 190, tip: 100, type: 'tab', tags: [ 2, 3, 4 ]}
]);
} finally {
data.date.filterAll();
}
},
"observes other dimensions' filters": function(data) {
try {
data.type.filterExact("tab");
assert.deepEqual(data.tags.bottom(2), [
{date: '2011-11-14T17:22:59Z',quantity: 2,total: 90,tip: 0,type: 'tab',tags: []},
{date: '2011-11-14T16:20:19Z',quantity: 2,total: 190,tip: 100,type: 'tab',tags: [ 1, 3 ]}
]);
data.type.filterExact("visa");
assert.deepEqual(data.tags.bottom(1), [
{date: '2011-11-14T17:29:52Z', quantity: 1, total: 200, tip: 100, type: 'visa', tags: [ -1, 0, 'hello', 'world']}
]);
data.quantity.filterExact(2);
assert.deepEqual(data.tags.bottom(1), [
{date: '2011-11-14T17:38:40Z', quantity: 2, total: 200, tip: 100, type: 'visa', tags: [ 2, 4, 5 ]}
]);
} finally {
data.type.filterAll();
data.quantity.filterAll();
}
},
"negative or zero k returns an empty array": function(data) {
assert.deepEqual(data.tags.bottom(0), []);
assert.deepEqual(data.tags.bottom(-1), []);
assert.deepEqual(data.tags.bottom(NaN), []);
assert.deepEqual(data.tags.bottom(-Infinity), []);
},
},
"filterExact": {
"selects records that match the specified value exactly": function(data) {
try {
data.tip.filterExact(100);
assert.deepEqual(data.tags.top(2), [
{date: '2011-11-14T22:34:28Z', quantity: 2, total: 190, tip: 100, type: 'tab', tags: [ 2, 4, 5 ]},
{date: '2011-11-14T23:21:22Z', quantity: 2, total: 190, tip: 100, type: 'tab', tags: [ 2, 4, 5 ]}
]);
} finally {
data.tip.filterAll();
}
},
"allows the filter value to be null": function(data) {
try {
data.tip.filterExact(null); // equivalent to 0 by natural ordering
assert.deepEqual(data.tags.top(2), [
{date: '2011-11-14T17:25:45Z', quantity: 2, total: 200, tip: null, type: 'cash', tags: [ 2, 4, 5 ]},
{date: '2011-11-14T20:06:33Z', quantity: 1, total: 100, tip: null, type: 'cash', tags: [ 2, 4, 5 ]}
]);
} finally {
data.tip.filterAll();
}
}
},
"filterRange": {
"selects records greater than or equal to the inclusive lower bound": function(data) {
try {
data.total.filterRange([100, 190]);
assert.isTrue(data.tags.top(Infinity).every(function(d) { return d.total >= 100; }));
data.total.filterRange([110, 190]);
assert.isTrue(data.tags.top(Infinity).every(function(d) { return d.total >= 110; }));
} finally {
data.total.filterAll();
}
},
"selects records less than the exclusive lower bound": function(data) {
try {
data.total.filterRange([100, 200]);
assert.isTrue(data.tags.top(Infinity).every(function(d) { return d.total < 200; }));
data.total.filterRange([100, 190]);
assert.isTrue(data.tags.top(Infinity).every(function(d) { return d.total < 190; }));
} finally {
data.total.filterAll();
}
}
},
"filterAll": {
"clears the filter": function(data) {
data.total.filterRange([100, 200]);
assert.lesser(data.tags.top(Infinity).length, 120);
data.total.filterAll();
assert.equal(data.tags.top(Infinity).length, 120);
}
},
"filterFunction": {
"selects records according to an arbitrary function": function(data) {
try {
data.total.filterFunction(function(d) { return d % 2; });
assert.isTrue(data.tags.top(Infinity).every(function(d) { return d.total % 2; }));
} finally {
data.total.filterAll();
}
},
"respects truthy values": function(data) {
try {
var group = data.tags.groupAll().reduceCount();
data.total.filterRange([200, Infinity]);
data.total.filterFunction(function(d) { return "0"; });
assert.equal(group.value(), 43);
data.total.filterFunction(function(d) { return ""; });
assert.equal(group.value(), 0);
} finally {
data.total.filterAll();
}
},
"groups on the first dimension are updated correctly": function(data) {
try {
var group = data.tags.groupAll().reduceCount();
data.total.filterFunction(function(d) { return d === 90; });
assert.equal(group.value(), 13);
data.total.filterFunction(function(d) { return d === 91; });
assert.equal(group.value(), 1);
} finally {
data.total.filterAll();
}
},
"followed by filterRange": function(data) {
try {
data.total.filterFunction(function(d) { return d % 2; });
data.total.filterRange([100, 200]);
assert.deepEqual(data.tags.top(Infinity).length, 54);
} finally {
data.total.filterAll();
}
},
"group values with multiple filters on and off on standard dimension": function(data) {
try {
var group = data.tags.group();
data.total.filterFunction(function(d) { return d === 90; });
assert.equal(group.all()[group.all().length-1].value, 1);
data.total.filterAll();
data.total.filterFunction(function(d) { return d === 91; });
assert.equal(group.all()[group.all().length-1].value, 1);
data.total.filterAll();
assert.equal(group.all()[group.all().length-1].value, 13);
} finally {
data.total.filterAll();
}
},
"group values with multiple filters on and off on iterable dimension": function(data) {
try {
var group = data.total.groupAll().reduceCount();
assert.equal(group.value(), 43);
data.tags.filterFunction(function(d) { return d === 1; });
assert.equal(group.value(), 18);
data.tags.filterAll();
assert.equal(group.value(), 43);
data.tags.filterFunction(function(d) { return d === 1; });
assert.equal(group.value(), 18);
data.tags.filterAll();
assert.equal(group.value(), 43);
} finally {
data.tags.filterAll();
}
},
"group values with multiple overlapping filters": function(data) {
try {
var group = data.total.groupAll().reduceCount();
assert.equal(group.value(), 43);
data.tags.filterFunction(function(d) { return d === 1; });
assert.equal(group.value(), 18);
data.tags.filterFunction(function(d) { return d === 2; });
assert.equal(group.value(), 33);
data.tags.filterAll();
assert.equal(group.value(), 43);
} finally {
data.tags.filterAll();
}
}
},
"filter": {
"is equivalent to filterRange when passed an array": function(data) {
try {
data.total.filter([100, 190]);
assert.isTrue(data.tags.top(Infinity).every(function(d) { return d.total >= 100; }));
} finally {
data.total.filter(null);
}
},
"is equivalent to filterExact when passed a single value": function(data) {
try {
data.total.filter(100);
assert.isTrue(data.tags.top(Infinity).every(function(d) { return d.total == 100; }));
} finally {
data.total.filter(null);
}
},
"is equivalent to filterFunction when passed a function": function(data) {
try {
data.total.filter(function(d) { return d % 2; });
assert.isTrue(data.tags.top(Infinity).every(function(d) { return d.total % 2; }));
} finally {
data.total.filter(null);
}
},
"is equivalent to filterAll when passed null": function(data) {
data.total.filter([100, 200]);
assert.lesser(data.tags.top(Infinity).length, 120);
data.total.filter(null);
assert.equal(data.tags.top(Infinity).length, 120);
}
},
"group": {
topic: function(data) {
data.date.hours = data.date.group(function(d) { d = new Date(+d); d.setHours(d.getHours(), 0, 0, 0); return d; });
data.tags.all = data.tags.group();
return data;
},
"key defaults to value": function(data) {
assert.deepEqual(data.tags.all.top(Infinity), [
{ key: 3, value: 28 },
{ key: 2, value: 23 },
{ key: 4, value: 23 },
{ key: 1, value: 18 },
{ key: 5, value: 13 },
{ key: 2, value: 10 },
{ key: 'world', value: 1 },
{ key: 'hello', value: 1 },
{ key: 0, value: 1 },
{ key: -1, value: 1 }
]);
},
"cardinality may be greater than 256": function() {
var data = crossfilter(d3.range(256).concat(256, 256).map(function(d){
return {tags: [d, d+1, d+2]}
})),
index = data.dimension(function(d) { return d.tags; }, true),
indexes = index.group();
assert.deepEqual(index.top(2), [
{tags:[256, 257, 258]},
{tags:[256, 257, 258]}
]);
assert.deepEqual(indexes.top(1), [{ key: 256, value: 4 }]);
assert.equal(indexes.size(), 259);
},
"cardinality may be greater than 65536": function() {
var data = crossfilter(d3.range(65536).concat(65536, 65536).map(function(d){
return {tags: [d, d+1, d+2]}
})),
index = data.dimension(function(d) { return d.tags; }, true),
indexes = index.group();
assert.deepEqual(index.top(2), [
{tags: [ 65536, 65537, 65538 ]},
{tags: [ 65536, 65537, 65538 ]}
]);
assert.deepEqual(indexes.top(1), [{key: 65536, value: 4}]);
assert.equal(indexes.size(), 65539);
},
"adds all records before removing filtered": function(data) {
try {
data.quantity.filter(1);
// Group only adds
var addGroup = data.tags.group().reduce(
function(p, v) {
++p;
return p;
}, function(p, v) {
return p;
}, function() {
return 0;
}
);
// Normal group
var stdGroup = data.tags.group();
assert.isTrue(addGroup.top(1)[0].value > stdGroup.top(1)[0].value);
} finally {
data.quantity.filterAll();
}
},
"size": {
"returns the cardinality": function(data) {
assert.equal(data.date.hours.size(), 8);
assert.equal(data.tags.all.size(), 10);
},
"ignores any filters": function(data) {
try {
data.tags.filterExact(1);
data.quantity.filterRange([100, 200]);
assert.equal(data.date.hours.size(), 8);
assert.equal(data.tags.all.size(), 10);
} finally {
data.quantity.filterAll();
data.tags.filterAll();
}
}
},
"reduce": {
"defaults to count": function(data) {
assert.deepEqual(data.tags.all.top(1), [
{ key: 3, value: 28 }
]);
},
"determines the computed reduce value": function(data) {
try {
data.tags.all.reduceSum(function(d) { return d.total; });
assert.deepEqual(data.tags.all.top(Infinity), [
{ key: 3, value: 4029 },
{ key: 4, value: 3661 },
{ key: 2, value: 3631 },
{ key: 1, value: 2709 },
{ key: 5, value: 2341 },
{ key: 2, value: 1610 },
{ key: 'world', value: 200 },
{ key: 'hello', value: 200 },
{ key: 0, value: 200 },
{ key: -1, value: 200 }
]);
} finally {
data.tags.all.reduceCount();
}
},
"gives reduce functions information on lifecycle of data element": {
"topic": function() {
var data = crossfilter();
data.add([{foo: 1, val: [1, 2]}, {foo: 2, val: [1,2]}, {foo: 3, val: [3, 4, 5]}, {foo: 3, val: [1,2]}]);
data.foo = data.dimension(function(d) { return d.foo; });
data.bar = data.dimension(function(d) { return d.foo; });
data.val = data.dimension(function(d) { return d.val; }, true);
data.val.groupSumLength = data.val.group().reduce(function(p,v,n){
if(n) {
p += v.val.length;
}
return p;
}, function(p,v,n) {
if(n) {
p -= v.val.length;
}
return p;
}, function() {
return 0;
});
data.val.groupSumEach = data.val.group().reduceSum(function(d) {
return d.val.length
});
return data;
},
"on group creation": function(data) {
assert.deepEqual(data.val.groupSumLength.all(), data.val.groupSumEach.all());
},
"on filtering": function(data) {
data.foo.filterRange([1,2]);
assert.deepEqual(data.val.groupSumLength.all(), [
{ key: 1, value: 6 },
{ key: 2, value: 6 },
{ key: 3, value: 3 },
{ key: 4, value: 3 },
{ key: 5, value: 3 }
]);
assert.deepEqual(data.val.groupSumEach.all(), [
{ key: 1, value: 2 },
{ key: 2, value: 2 },
{ key: 3, value: 0 },
{ key: 4, value: 0 },
{ key: 5, value: 0 }
]);
data.foo.filterAll();
},
"on adding data after group creation": function(data) {
data.add([{foo: 1, val: [5,6,7]}]);
assert.deepEqual(data.val.groupSumLength.all(), data.val.groupSumEach.all());
},
"on adding data when a filter is in place": function(data) {
data.foo.filterRange([1,3]);
data.add([{foo: 3, val: [6]}]);
assert.deepEqual(data.val.groupSumLength.all(), [
{ key: 1, value: 6 },
{ key: 2, value: 6 },
{ key: 3, value: 3 },
{ key: 4, value: 3 },
{ key: 5, value: 6 },
{ key: 6, value: 4 },
{ key: 7, value: 3 }
]);
assert.deepEqual(data.val.groupSumEach.all(), [
{ key: 1, value: 4 },
{ key: 2, value: 4 },
{ key: 3, value: 0 },
{ key: 4, value: 0 },
{ key: 5, value: 3 },
{ key: 6, value: 3 },
{ key: 7, value: 3 }
]);
data.foo.filterAll();
},
"on removing data after group creation": function(data) {
data.val.filter(2);
data.remove();
assert.deepEqual(data.val.groupSumLength.all(), [
{ key: 6, value: 4 }
]);
assert.deepEqual(data.val.groupSumEach.all(), [
{ key: 6, value: 4 }
]);
data.val.filterAll();
assert.deepEqual(data.val.groupSumLength.all(), data.val.groupSumEach.all());
}
}
},
"top": {
"returns the top k groups by reduce value, in descending order": function(data) {
assert.deepEqual(data.tags.all.top(3), [
{ key: 3, value: 28 },
{ key: 2, value: 23 },
{ key: 4, value: 23 }
]);
},
"observes the specified order": function(data) {
try {
data.tags.all.order(function(v) { return -v; });
assert.deepEqual(data.tags.all.top(3), [
{ key: 0, value: 1 },
{ key: -1, value: 1 },
{ key: 'hello', value: 1 }
]);
} finally {
data.tags.all.order(function(v) { return v; });
}
}
},
"order": {
"defaults to the identity function": function(data) {
assert.deepEqual(data.tags.all.top(1), [
{ key: 3, value: 28 }
]);
},
"is useful in conjunction with a compound reduce value": function(data) {
try {
data.tags.all.reduce(
function(p, v) { ++p.count; p.total += v.total; return p; },
function(p, v) { --p.count; p.total -= v.total; return p; },
function() { return {count: 0, total: 0}; })
.order(function(v) { return v.total; });
assert.deepEqual(data.tags.all.top(1), [
{
key: 3,
value: { count: 28, total: 4029 }
}
]);
} finally {
data.tags.all.reduceCount().orderNatural();
}
}
},
"works for empty arrays in middle or end": function() {
var data = crossfilter([
{tags: [1,2,3]},
{tags: []},
{tags: [1,2,3]},
{tags: [3]},
{tags: []}
]),
dimension = data.dimension(function(d) { return d.tags; }, true),
group = dimension
.group(function(d) { return d;} );
group.top(10);
},
"dispose": {
"detaches from reduce listeners": function() {
var data = crossfilter([
{tags: [1,2,3]},
{tags: [1,2,3]},
{tags: [3]}
]),
callback, // indicates a reduce has occurred in this group
dimension = data.dimension(function(d) { return d.tags; }, true),
other = data.dimension(function(d) { return d.tags; }, true),
group = dimension
.group(function(d) { return d;} )
.reduce(function() { callback = true; }, function() { callback = true; }, function() {});
group.all(); // force this group to be reduced when filters change
callback = false;
group.dispose();
other.filterRange([1, 2]);
assert.isFalse(callback);
},
"detaches from add listeners": function() {
var data = crossfilter([
{tags: [1,2,3]},
{tags: [1,2,3]},
{tags: [3]}
]),
callback, // indicates data has been added and the group has been reduced
dimension = data.dimension(function(d) { return d.tags; }, true),
group = dimension
.group(function(d) { return d; })
.reduce(function() { callback = true; }, function() { callback = true; }, function() {});
group.all(); // force this group to be reduced when filters change
callback = false;
group.dispose();
data.add({tags: [3]}, {tags: [4,5]}, {tags: [4,5,6]});
assert.isFalse(callback);
}
},
},
},
"isElementFiltered": {
"Test if elements are filtered": function(data) {
try {
assert.isTrue(data.isElementFiltered(0)); // quantity = 2; total = 190;
assert.isTrue(data.isElementFiltered(2)); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6)); // quantity = 1; total = 100;
assert.isTrue(data.isElementFiltered(0,[data.quantity])); // quantity = 2; total = 190;
assert.isTrue(data.isElementFiltered(2,[data.quantity])); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6,[data.quantity])); // quantity = 1; total = 100;
assert.isTrue(data.isElementFiltered(0,[data.total])); // quantity = 2; total = 190;
assert.isTrue(data.isElementFiltered(2,[data.total])); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6,[data.total])); // quantity = 1; total = 100;
assert.isTrue(data.isElementFiltered(0,[data.quantity,data.total])); // quantity = 2; total = 190;
assert.isTrue(data.isElementFiltered(2,[data.quantity,data.total])); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6,[data.quantity,data.total])); // quantity = 1; total = 100;
data.quantity.filterExact(1);
assert.isFalse(data.isElementFiltered(0)); // quantity = 2; total = 190;
assert.isTrue(data.isElementFiltered(2)); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6)); // quantity = 1; total = 100;
assert.isTrue(data.isElementFiltered(0,[data.quantity])); // quantity = 2; total = 190;
assert.isTrue(data.isElementFiltered(2,[data.quantity])); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6,[data.quantity])); // quantity = 1; total = 100;
assert.isFalse(data.isElementFiltered(0,[data.total])); // quantity = 2; total = 190;
assert.isTrue(data.isElementFiltered(2,[data.total])); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6,[data.total])); // quantity = 1; total = 100;
assert.isTrue(data.isElementFiltered(0,[data.quantity,data.total])); // quantity = 2; total = 190;
assert.isTrue(data.isElementFiltered(2,[data.quantity,data.total])); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6,[data.quantity,data.total])); // quantity = 1; total = 100;
data.total.filterExact(100);
assert.isFalse(data.isElementFiltered(0)); // quantity = 2; total = 190;
assert.isFalse(data.isElementFiltered(2)); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6)); // quantity = 1; total = 100;
assert.isFalse(data.isElementFiltered(0,[data.quantity])); // quantity = 2; total = 190;
assert.isFalse(data.isElementFiltered(2,[data.quantity])); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6,[data.quantity])); // quantity = 1; total = 100;
assert.isFalse(data.isElementFiltered(0,[data.total])); // quantity = 2; total = 190;
assert.isTrue(data.isElementFiltered(2,[data.total])); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6,[data.total])); // quantity = 1; total = 100;
assert.isTrue(data.isElementFiltered(0,[data.quantity,data.total])); // quantity = 2; total = 190;
assert.isTrue(data.isElementFiltered(2,[data.quantity,data.total])); // quantity = 1; total = 300;
assert.isTrue(data.isElementFiltered(6,[data.quantity,data.total])); // quantity = 1; total = 100;
} finally {
data.quantity.filterAll();
data.total.filterAll();
}
},
},
}
});
function key(d) {
return d.key;
}
suite.export(module);
|
import {
compile,
compileOptions,
RESOLUTION_MODE_TRANSFORMS,
STRICT_MODE_TRANSFORMS,
registerPlugin,
unregisterPlugin,
} from '../../index';
import { moduleFor, AbstractTestCase, RenderingTestCase } from 'internal-test-helpers';
moduleFor(
'ember-template-compiler: default compile options',
class extends AbstractTestCase {
['@test default options are a new copy'](assert) {
assert.notEqual(compileOptions(), compileOptions());
}
['@test has default AST plugins in resolution mode'](assert) {
assert.expect(RESOLUTION_MODE_TRANSFORMS.length);
let plugins = compileOptions().plugins.ast;
for (let i = 0; i < RESOLUTION_MODE_TRANSFORMS.length; i++) {
let plugin = RESOLUTION_MODE_TRANSFORMS[i];
assert.ok(plugins.indexOf(plugin) > -1, `includes ${plugin}`);
}
}
['@test has default AST plugins in strict mode'](assert) {
assert.expect(STRICT_MODE_TRANSFORMS.length);
let plugins = compileOptions({ strictMode: true }).plugins.ast;
for (let i = 0; i < STRICT_MODE_TRANSFORMS.length; i++) {
let plugin = STRICT_MODE_TRANSFORMS[i];
assert.ok(plugins.indexOf(plugin) > -1, `includes ${plugin}`);
}
}
}
);
let customTransformCounter = 0;
class LegacyCustomTransform {
constructor(options) {
customTransformCounter++;
this.options = options;
this.syntax = null;
}
transform(ast) {
let walker = new this.syntax.Walker();
walker.visit(ast, (node) => {
if (node.type !== 'ElementNode') {
return;
}
for (let i = 0; i < node.attributes.length; i++) {
let attribute = node.attributes[i];
if (attribute.name === 'data-test') {
node.attributes.splice(i, 1);
}
}
});
return ast;
}
}
function customTransform() {
customTransformCounter++;
return {
name: 'remove-data-test',
visitor: {
ElementNode(node) {
for (let i = 0; i < node.attributes.length; i++) {
let attribute = node.attributes[i];
if (attribute.name === 'data-test') {
node.attributes.splice(i, 1);
}
}
},
},
};
}
class CustomPluginsTests extends RenderingTestCase {
afterEach() {
customTransformCounter = 0;
return super.afterEach();
}
['@test custom plugins can be used']() {
this.render('<div data-test="foo" data-blah="derp" class="hahaha"></div>');
this.assertElement(this.firstChild, {
tagName: 'div',
attrs: { class: 'hahaha', 'data-blah': 'derp' },
content: '',
});
}
['@test wrapped plugins are only invoked once per template'](assert) {
this.render('<div>{{#if falsey}}nope{{/if}}</div>');
assert.equal(customTransformCounter, 1, 'transform should only be instantiated once');
}
}
moduleFor(
'ember-template-compiler: registerPlugin with a custom plugins in legacy format',
class extends CustomPluginsTests {
beforeEach() {
registerPlugin('ast', LegacyCustomTransform);
}
afterEach() {
unregisterPlugin('ast', LegacyCustomTransform);
return super.afterEach();
}
['@test custom registered plugins are deduplicated'](assert) {
registerPlugin('ast', LegacyCustomTransform);
this.registerTemplate(
'application',
'<div data-test="foo" data-blah="derp" class="hahaha"></div>'
);
assert.equal(customTransformCounter, 1, 'transform should only be instantiated once');
}
}
);
moduleFor(
'ember-template-compiler: registerPlugin with a custom plugins',
class extends CustomPluginsTests {
beforeEach() {
registerPlugin('ast', customTransform);
}
afterEach() {
unregisterPlugin('ast', customTransform);
return super.afterEach();
}
['@test custom registered plugins are deduplicated'](assert) {
registerPlugin('ast', customTransform);
this.registerTemplate(
'application',
'<div data-test="foo" data-blah="derp" class="hahaha"></div>'
);
assert.equal(customTransformCounter, 1, 'transform should only be instantiated once');
}
}
);
moduleFor(
'ember-template-compiler: custom plugins in legacy format passed to compile',
class extends RenderingTestCase {
// override so that we can provide custom AST plugins to compile
compile(templateString) {
return compile(templateString, {
plugins: {
ast: [LegacyCustomTransform],
},
});
}
}
);
moduleFor(
'ember-template-compiler: custom plugins passed to compile',
class extends RenderingTestCase {
// override so that we can provide custom AST plugins to compile
compile(templateString) {
return compile(templateString, {
plugins: {
ast: [customTransform],
},
});
}
}
);
|
import StaticSiteGeneratorPlugin from 'static-site-generator-webpack-plugin';
import reactRouterToArray from 'react-router-to-array';
import grommetBaseWebpack from 'grommet-toolbox/lib/webpack.dist.config';
import path from 'path';
import routes from './src/js/routes';
const staticConfig = {...grommetBaseWebpack};
grommetBaseWebpack.output = {
filename: 'index.js',
path: path.resolve('./dist')
};
staticConfig.entry = {
'main': path.resolve('./src/js/static.js')
};
staticConfig.output = {
filename: 'static.js',
path: path.resolve('./dist'),
libraryTarget: 'commonjs2'
};
staticConfig.plugins = [
new StaticSiteGeneratorPlugin(
'main', reactRouterToArray(routes)
)
];
export default [grommetBaseWebpack, staticConfig];
module.exports = exports.default;
|
version https://git-lfs.github.com/spec/v1
oid sha256:08babec85d70eb637bd22096e03a1cb9e6182bfe50e17c712a774196a2d2f1de
size 29868
|
'use strict';
// Declare app level module which depends on views, and components
angular.module('myApp', [ 'ui.router', 'ngCookies','myApp.blog','myApp.admin', 'myApp.view1', 'myApp.view2', 'myApp.event', 'myApp.emit'
]).config([ '$stateProvider', '$urlRouterProvider', '$locationProvider',
function($stateProvider, $urlRouterProvider, $locationProvider) {
$urlRouterProvider.otherwise('/view1');
} ]).run(function($rootScope) {
$rootScope.title = 'Famous Books';
$rootScope.name = "Root Scope";
}); |
goog.provide('ol.MapBrowserEvent');
goog.provide('ol.MapBrowserEvent.EventType');
goog.provide('ol.MapBrowserEventHandler');
goog.provide('ol.MapBrowserPointerEvent');
goog.require('goog.asserts');
goog.require('ol');
goog.require('ol.Coordinate');
goog.require('ol.MapEvent');
goog.require('ol.Pixel');
goog.require('ol.events');
goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType');
goog.require('ol.pointer.PointerEvent');
goog.require('ol.pointer.PointerEventHandler');
/**
* @classdesc
* Events emitted as map browser events are instances of this type.
* See {@link ol.Map} for which events trigger a map browser event.
*
* @constructor
* @extends {ol.MapEvent}
* @implements {oli.MapBrowserEvent}
* @param {string} type Event type.
* @param {ol.Map} map Map.
* @param {Event} browserEvent Browser event.
* @param {boolean=} opt_dragging Is the map currently being dragged?
* @param {?olx.FrameState=} opt_frameState Frame state.
*/
ol.MapBrowserEvent = function(type, map, browserEvent, opt_dragging,
opt_frameState) {
goog.base(this, type, map, opt_frameState);
/**
* The original browser event.
* @const
* @type {Event}
* @api stable
*/
this.originalEvent = browserEvent;
/**
* The pixel of the original browser event.
* @type {ol.Pixel}
* @api stable
*/
this.pixel = map.getEventPixel(browserEvent);
/**
* The coordinate of the original browser event.
* @type {ol.Coordinate}
* @api stable
*/
this.coordinate = map.getCoordinateFromPixel(this.pixel);
/**
* Indicates if the map is currently being dragged. Only set for
* `POINTERDRAG` and `POINTERMOVE` events. Default is `false`.
*
* @type {boolean}
* @api stable
*/
this.dragging = opt_dragging !== undefined ? opt_dragging : false;
};
goog.inherits(ol.MapBrowserEvent, ol.MapEvent);
/**
* Prevents the default browser action.
* @see https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault
* @override
* @api stable
*/
ol.MapBrowserEvent.prototype.preventDefault = function() {
goog.base(this, 'preventDefault');
this.originalEvent.preventDefault();
};
/**
* Prevents further propagation of the current event.
* @see https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation
* @override
* @api stable
*/
ol.MapBrowserEvent.prototype.stopPropagation = function() {
goog.base(this, 'stopPropagation');
this.originalEvent.stopPropagation();
};
/**
* @constructor
* @extends {ol.MapBrowserEvent}
* @param {string} type Event type.
* @param {ol.Map} map Map.
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @param {boolean=} opt_dragging Is the map currently being dragged?
* @param {?olx.FrameState=} opt_frameState Frame state.
*/
ol.MapBrowserPointerEvent = function(type, map, pointerEvent, opt_dragging,
opt_frameState) {
goog.base(this, type, map, pointerEvent.originalEvent, opt_dragging,
opt_frameState);
/**
* @const
* @type {ol.pointer.PointerEvent}
*/
this.pointerEvent = pointerEvent;
};
goog.inherits(ol.MapBrowserPointerEvent, ol.MapBrowserEvent);
/**
* @param {ol.Map} map The map with the viewport to listen to events on.
* @constructor
* @extends {ol.events.EventTarget}
*/
ol.MapBrowserEventHandler = function(map) {
goog.base(this);
/**
* This is the element that we will listen to the real events on.
* @type {ol.Map}
* @private
*/
this.map_ = map;
/**
* @type {number}
* @private
*/
this.clickTimeoutId_ = 0;
/**
* @type {boolean}
* @private
*/
this.dragging_ = false;
/**
* @type {!Array.<ol.events.Key>}
* @private
*/
this.dragListenerKeys_ = [];
/**
* The most recent "down" type event (or null if none have occurred).
* Set on pointerdown.
* @type {ol.pointer.PointerEvent}
* @private
*/
this.down_ = null;
var element = this.map_.getViewport();
/**
* @type {number}
* @private
*/
this.activePointers_ = 0;
/**
* @type {!Object.<number, boolean>}
* @private
*/
this.trackedTouches_ = {};
/**
* Event handler which generates pointer events for
* the viewport element.
*
* @type {ol.pointer.PointerEventHandler}
* @private
*/
this.pointerEventHandler_ = new ol.pointer.PointerEventHandler(element);
/**
* Event handler which generates pointer events for
* the document (used when dragging).
*
* @type {ol.pointer.PointerEventHandler}
* @private
*/
this.documentPointerEventHandler_ = null;
/**
* @type {?ol.events.Key}
* @private
*/
this.pointerdownListenerKey_ = ol.events.listen(this.pointerEventHandler_,
ol.pointer.EventType.POINTERDOWN,
this.handlePointerDown_, this);
/**
* @type {?ol.events.Key}
* @private
*/
this.relayedListenerKey_ = ol.events.listen(this.pointerEventHandler_,
ol.pointer.EventType.POINTERMOVE,
this.relayEvent_, this);
};
goog.inherits(ol.MapBrowserEventHandler, ol.events.EventTarget);
/**
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.emulateClick_ = function(pointerEvent) {
var newEvent;
newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEvent.EventType.CLICK, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
if (this.clickTimeoutId_ !== 0) {
// double-click
goog.global.clearTimeout(this.clickTimeoutId_);
this.clickTimeoutId_ = 0;
newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEvent.EventType.DBLCLICK, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
} else {
// click
this.clickTimeoutId_ = goog.global.setTimeout(function() {
this.clickTimeoutId_ = 0;
var newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEvent.EventType.SINGLECLICK, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
}.bind(this), 250);
}
};
/**
* Keeps track on how many pointers are currently active.
*
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.updateActivePointers_ = function(pointerEvent) {
var event = pointerEvent;
if (event.type == ol.MapBrowserEvent.EventType.POINTERUP ||
event.type == ol.MapBrowserEvent.EventType.POINTERCANCEL) {
delete this.trackedTouches_[event.pointerId];
} else if (event.type == ol.MapBrowserEvent.EventType.POINTERDOWN) {
this.trackedTouches_[event.pointerId] = true;
}
this.activePointers_ = Object.keys(this.trackedTouches_).length;
};
/**
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.handlePointerUp_ = function(pointerEvent) {
this.updateActivePointers_(pointerEvent);
var newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEvent.EventType.POINTERUP, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
// We emulate click events on left mouse button click, touch contact, and pen
// contact. isMouseActionButton returns true in these cases (evt.button is set
// to 0).
// See http://www.w3.org/TR/pointerevents/#button-states
if (!this.dragging_ && this.isMouseActionButton_(pointerEvent)) {
goog.asserts.assert(this.down_, 'this.down_ must be truthy');
this.emulateClick_(this.down_);
}
goog.asserts.assert(this.activePointers_ >= 0,
'this.activePointers_ should be equal to or larger than 0');
if (this.activePointers_ === 0) {
this.dragListenerKeys_.forEach(ol.events.unlistenByKey);
this.dragListenerKeys_.length = 0;
this.dragging_ = false;
this.down_ = null;
goog.dispose(this.documentPointerEventHandler_);
this.documentPointerEventHandler_ = null;
}
};
/**
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @return {boolean} If the left mouse button was pressed.
* @private
*/
ol.MapBrowserEventHandler.prototype.isMouseActionButton_ = function(pointerEvent) {
return pointerEvent.button === 0;
};
/**
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.handlePointerDown_ = function(pointerEvent) {
this.updateActivePointers_(pointerEvent);
var newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEvent.EventType.POINTERDOWN, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
this.down_ = pointerEvent;
if (this.dragListenerKeys_.length === 0) {
/* Set up a pointer event handler on the `document`,
* which is required when the pointer is moved outside
* the viewport when dragging.
*/
this.documentPointerEventHandler_ =
new ol.pointer.PointerEventHandler(document);
this.dragListenerKeys_.push(
ol.events.listen(this.documentPointerEventHandler_,
ol.MapBrowserEvent.EventType.POINTERMOVE,
this.handlePointerMove_, this),
ol.events.listen(this.documentPointerEventHandler_,
ol.MapBrowserEvent.EventType.POINTERUP,
this.handlePointerUp_, this),
/* Note that the listener for `pointercancel is set up on
* `pointerEventHandler_` and not `documentPointerEventHandler_` like
* the `pointerup` and `pointermove` listeners.
*
* The reason for this is the following: `TouchSource.vacuumTouches_()`
* issues `pointercancel` events, when there was no `touchend` for a
* `touchstart`. Now, let's say a first `touchstart` is registered on
* `pointerEventHandler_`. The `documentPointerEventHandler_` is set up.
* But `documentPointerEventHandler_` doesn't know about the first
* `touchstart`. If there is no `touchend` for the `touchstart`, we can
* only receive a `touchcancel` from `pointerEventHandler_`, because it is
* only registered there.
*/
ol.events.listen(this.pointerEventHandler_,
ol.MapBrowserEvent.EventType.POINTERCANCEL,
this.handlePointerUp_, this)
);
}
};
/**
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.handlePointerMove_ = function(pointerEvent) {
// Fix IE10 on windows Surface : When you tap the tablet, it triggers
// multiple pointermove events between pointerdown and pointerup with
// the exact same coordinates of the pointerdown event. To avoid a
// 'false' touchmove event to be dispatched , we test if the pointer
// effectively moved.
if (this.isMoving_(pointerEvent)) {
this.dragging_ = true;
var newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEvent.EventType.POINTERDRAG, this.map_, pointerEvent,
this.dragging_);
this.dispatchEvent(newEvent);
}
// Some native android browser triggers mousemove events during small period
// of time. See: https://code.google.com/p/android/issues/detail?id=5491 or
// https://code.google.com/p/android/issues/detail?id=19827
// ex: Galaxy Tab P3110 + Android 4.1.1
pointerEvent.preventDefault();
};
/**
* Wrap and relay a pointer event. Note that this requires that the type
* string for the MapBrowserPointerEvent matches the PointerEvent type.
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.relayEvent_ = function(pointerEvent) {
var dragging = !!(this.down_ && this.isMoving_(pointerEvent));
this.dispatchEvent(new ol.MapBrowserPointerEvent(
pointerEvent.type, this.map_, pointerEvent, dragging));
};
/**
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @return {boolean} Is moving.
* @private
*/
ol.MapBrowserEventHandler.prototype.isMoving_ = function(pointerEvent) {
return pointerEvent.clientX != this.down_.clientX ||
pointerEvent.clientY != this.down_.clientY;
};
/**
* @inheritDoc
*/
ol.MapBrowserEventHandler.prototype.disposeInternal = function() {
if (this.relayedListenerKey_) {
ol.events.unlistenByKey(this.relayedListenerKey_);
this.relayedListenerKey_ = null;
}
if (this.pointerdownListenerKey_) {
ol.events.unlistenByKey(this.pointerdownListenerKey_);
this.pointerdownListenerKey_ = null;
}
this.dragListenerKeys_.forEach(ol.events.unlistenByKey);
this.dragListenerKeys_.length = 0;
if (this.documentPointerEventHandler_) {
goog.dispose(this.documentPointerEventHandler_);
this.documentPointerEventHandler_ = null;
}
if (this.pointerEventHandler_) {
goog.dispose(this.pointerEventHandler_);
this.pointerEventHandler_ = null;
}
goog.base(this, 'disposeInternal');
};
/**
* Constants for event names.
* @enum {string}
*/
ol.MapBrowserEvent.EventType = {
/**
* A true single click with no dragging and no double click. Note that this
* event is delayed by 250 ms to ensure that it is not a double click.
* @event ol.MapBrowserEvent#singleclick
* @api stable
*/
SINGLECLICK: 'singleclick',
/**
* A click with no dragging. A double click will fire two of this.
* @event ol.MapBrowserEvent#click
* @api stable
*/
CLICK: ol.events.EventType.CLICK,
/**
* A true double click, with no dragging.
* @event ol.MapBrowserEvent#dblclick
* @api stable
*/
DBLCLICK: ol.events.EventType.DBLCLICK,
/**
* Triggered when a pointer is dragged.
* @event ol.MapBrowserEvent#pointerdrag
* @api
*/
POINTERDRAG: 'pointerdrag',
/**
* Triggered when a pointer is moved. Note that on touch devices this is
* triggered when the map is panned, so is not the same as mousemove.
* @event ol.MapBrowserEvent#pointermove
* @api stable
*/
POINTERMOVE: 'pointermove',
POINTERDOWN: 'pointerdown',
POINTERUP: 'pointerup',
POINTEROVER: 'pointerover',
POINTEROUT: 'pointerout',
POINTERENTER: 'pointerenter',
POINTERLEAVE: 'pointerleave',
POINTERCANCEL: 'pointercancel'
};
|
/**
* @classdesc Button custom web component
* @class button
* @property {string} color Available color is blue and red
* @property {string} icon Button icon, using font awesome. Ex. fa-calendar etc. For icon list see <a href="http://fontawesome.github.io/Font-Awesome/icons/">http://fontawesome.github.io/Font-Awesome/icons/</a>
* @example <caption>Basic button</caption>
* <j-button>My Button</j-button>
* @example <caption>Button with different color</caption>
* <j-button color="blue">My Button</j-button>
* @example <caption>Button with icon</caption>
* <j-button icon="fa-calendar">My Button</j-button>
*/
(function($){
/** @constructor */
var proto = Object.create(HTMLElement.prototype)
proto.createdCallback = function() {
jui2.ui.base.proto.createdCallback.call(this, jui2.ui.button);
var $self = $(this)
this.iconPosition = 'afterBegin';
$self.attr('tabindex', 0).addClass('j-transition1 j-border-box j-focus-highlight1 j-inline-block j-ui j-control j-control-click');
if(this.innerHTML.trim() == '')
this.innerHTML = ''
/*if(this.getAttribute('icon'))
this.innerHTML = '<i class="fa '+this.getAttribute('icon')+'"></i> '+this.innerHTML*/
/*this.enabledAttrChange = $.unique(this.enabledAttrChange.concat(['disabled', 'icon']));
for(i in this.attributes){
var attrName = this.attributes[i].nodeName,
newVal = this.attributes[i].nodeValue, attr = this.tagName.toLowerCase()+'_'+attrName;
if(jui2.attrChange[attr])
jui2.attrChange[attr](this, false, newVal);
else if(jui2.attrChange[attrName] && this.enabledAttrChange.indexOf(attrName) > -1)
jui2.attrChange[attrName](this, false, newVal);
}*/
$self.keyup(function(event){
if(event.keyCode == 13){
event.preventDefault();
$self.click();
}
});
this.attrChangedCb(['disabled', 'icon'])
for(i in jui2.method){
this[i] = jui2.method[i];
}
};
proto.attributeChangedCallback = function(attrName, oldVal, newVal){
/*var attr = this.tagName.toLowerCase()+'_'+attrName;
if(jui2.attrChange[attr])
jui2.attrChange[attr](this, oldVal, newVal);
else if(jui2.attrChange[attrName] && this.enabledAttrChange.indexOf(attrName) > -1)
jui2.attrChange[attrName](this, oldVal, newVal);*/
this.attrChangedCb(false, attrName, oldVal, newVal)
}
proto.setText = function(text){
$(this).contents().last()[0].textContent = ' '+text;
}
proto.setIcon = function(cls, style){
var el = $(this).children('i')
if(el.length==0)
$('<i class="fa '+cls+'" style="'+style+'"></i>').appendTo(this)
else
el.attr('class', 'fa '+cls);
}
/**
* Fires when button clicked
* @event click
* @memberof button
* @example
* <j-button id="myButton">My Button</j-button>
* <script>
* $('#myButton').on('click', function(value){
* console.log('Button clicked') //will print 'Button clicked' in javascript console
* })
* </script>
*/
jui2.ui.button = {
widget: document.registerElement('j-button', {
prototype: proto
}),
proto: proto
}
}(jQuery))
;
|
/*! UIkit 2.14.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
// Based on Zeptos touch.js
// https://raw.github.com/madrobby/zepto/master/src/touch.js
// Zepto.js may be freely distributed under the MIT license.
;(function($){
if ($.fn.swipeLeft) {
return;
}
var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture;
function swipeDirection(x1, x2, y1, y2) {
return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
}
function longTap() {
longTapTimeout = null;
if (touch.last) {
touch.el.trigger('longTap');
touch = {};
}
}
function cancelLongTap() {
if (longTapTimeout) clearTimeout(longTapTimeout);
longTapTimeout = null;
}
function cancelAll() {
if (touchTimeout) clearTimeout(touchTimeout);
if (tapTimeout) clearTimeout(tapTimeout);
if (swipeTimeout) clearTimeout(swipeTimeout);
if (longTapTimeout) clearTimeout(longTapTimeout);
touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
touch = {};
}
function isPrimaryTouch(event){
return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary;
}
$(function(){
var now, delta, deltaX = 0, deltaY = 0, firstTouch;
if ('MSGesture' in window) {
gesture = new MSGesture();
gesture.target = document.body;
}
$(document)
.on('MSGestureEnd gestureend', function(e){
var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null;
if (swipeDirectionFromVelocity) {
touch.el.trigger('swipe');
touch.el.trigger('swipe'+ swipeDirectionFromVelocity);
}
})
// MSPointerDown: for IE10
// pointerdown: for IE11
.on('touchstart MSPointerDown pointerdown', function(e){
if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return;
firstTouch = (e.type == 'MSPointerDown' || e.type == 'pointerdown') ? e : e.originalEvent.touches[0];
now = Date.now();
delta = now - (touch.last || now);
touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode);
if(touchTimeout) clearTimeout(touchTimeout);
touch.x1 = firstTouch.pageX;
touch.y1 = firstTouch.pageY;
if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
touch.last = now;
longTapTimeout = setTimeout(longTap, longTapDelay);
// adds the current touch contact for IE gesture recognition
if (gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
gesture.addPointer(e.originalEvent.pointerId);
}
})
// MSPointerMove: for IE10
// pointermove: for IE11
.on('touchmove MSPointerMove pointermove', function(e){
if (e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
firstTouch = (e.type == 'MSPointerMove' || e.type == 'pointermove') ? e : e.originalEvent.touches[0];
cancelLongTap();
touch.x2 = firstTouch.pageX;
touch.y2 = firstTouch.pageY;
deltaX += Math.abs(touch.x1 - touch.x2);
deltaY += Math.abs(touch.y1 - touch.y2);
})
// MSPointerUp: for IE10
// pointerup: for IE11
.on('touchend MSPointerUp pointerup', function(e){
if (e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
cancelLongTap();
// swipe
if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){
swipeTimeout = setTimeout(function() {
touch.el.trigger('swipe');
touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
touch = {};
}, 0);
// normal tap
} else if ('last' in touch) {
// don't fire tap when delta position changed by more than 30 pixels,
// for instance when moving to a point and back to origin
if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) {
// delay by one tick so we can cancel the 'tap' event if 'scroll' fires
// ('tap' fires before 'scroll')
tapTimeout = setTimeout(function() {
// trigger universal 'tap' with the option to cancelTouch()
// (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
var event = $.Event('tap');
event.cancelTouch = cancelAll;
touch.el.trigger(event);
// trigger double tap immediately
if (touch.isDoubleTap) {
touch.el.trigger('doubleTap');
touch = {};
}
// trigger single tap after 250ms of inactivity
else {
touchTimeout = setTimeout(function(){
touchTimeout = null;
touch.el.trigger('singleTap');
touch = {};
}, 250);
}
}, 0);
} else {
touch = {};
}
deltaX = deltaY = 0;
}
})
// when the browser window loses focus,
// for example when a modal dialog is shown,
// cancel all ongoing events
.on('touchcancel MSPointerCancel', cancelAll);
// scrolling the window indicates intention of the user
// to scroll, not tap or swipe, so cancel all ongoing events
$(window).on('scroll', cancelAll);
});
['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
$.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
});
})(jQuery);
|
describe('toString', function() {
it('returns a configured string', function() {
var foo = { bar: function() { return 3 } };
jack.stub(foo, 'bar');
assert(foo.bar.toString() === '[TestDouble bar]');
});
});
|
var path = require('path');
var assert = require('yeoman-assert');
var helpers = require('yeoman-test');
var fs = require('fs-extra');
beforeEach(() => {
return helpers.run(path.join(__dirname, '../generators/html'))
.inTmpDir((dir) => {
fs.copySync(path.join(__dirname, '../generators/app/templates'), dir);
})
.withPrompts({filename: 'index', uniqueName: "crm_index.html", displayName: "Index HTML"});
});
test('creates index.html file', () => {
assert.file(['src/html/index.html']);
});
test('should add the file to config.json', () => {
assert.fileContent('config.json', '"path": "./dist/html/index.html"');
assert.fileContent('config.json', '"uniqueName": "crm_index.html"');
assert.fileContent('config.json', '"displayName": "Index HTML"');
assert.fileContent('config.json', '"type": "HTML"');
});
|
#!/usr/bin/env node
'use strict';
/* eslint-disable no-shadow, no-console */
const WebpackDevServer = require('webpack-dev-server');
const fs = require('fs');
const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const hashType = '?[contenthash]';
const name = `[name].[ext]${hashType}=`; // https://github.com/webpack-contrib/mini-css-extract-plugin/issues/699#issuecomment-776290258
const child_process = require('child_process');
const CleanTerminalPlugin = require('clean-terminal-webpack-plugin');
const PreloadWebpackPlugin = require('preload-webpack-plugin')
const ELECTRON_DIST_DIRNAME = 'electron_dist';
const MAIN_DIST_DIRNAME = 'dist';
const ANDROID_DIST_DIRNAME = 'www';
const ELECTRON_DIST = path.resolve(__dirname, ELECTRON_DIST_DIRNAME);
const MAIN_DIST = path.resolve(__dirname, MAIN_DIST_DIRNAME);
const ANDROID_DIST = path.resolve(__dirname, ANDROID_DIST_DIRNAME);
const DEV_PORT = 8080;
const StyleLintPlugin = require('stylelint-webpack-plugin');
const ServiceWorkerWepbackPlugin = require('serviceworker-webpack-plugin');
const sassOptionsGlobal = {
loader: "sass-loader",
options: {
sassOptions: {
indentedSyntax: true,
includePaths: [path.resolve(__dirname, 'src/assets/sass')]
}
}
}
function getDist() {
if (options.IS_WEB) {
return MAIN_DIST;
} else if (options.IS_ELECTRON) {
return ELECTRON_DIST;
} else if (options.IS_ANDROID) {
return ANDROID_DIST;
} else {
throw Error("unknown mode");
}
}
class SaveHtmlToFile {
constructor(filename) {
this.filename = filename;
}
apply(compiler) {
compiler.hooks.compilation.tap('SaveHtmlToFile', (compilation) => {
HtmlWebpackPlugin.getHooks(compilation).beforeEmit.tapAsync(
'SaveHtmlToFile',
(data, cb) => {
// Manipulate the content
fs.writeFile(this.filename, data.html, function(err) {
if(err) {
throw err;
}
cb();
});
}
)
})
}
}
const {options, definePlugin, optimization, configFile, startCordova, linting, backendPort} = function () {
function getEnv(mode, trueValue, falseValues) {
if (process.env[mode] === trueValue) {
return true;
} else if (!falseValues || falseValues.includes(process.env[mode])) {
return false;
} else {
throw Error(`env ${mode} is not defined`);
}
}
const startCordova = process.argv[2];
const linting = process.env.LINTING === 'on';
const isProd = getEnv('BUILD_MODE', 'production', ['development']);
const proxyBackend = getEnv('PROXY_BACKEND', 'true');
// cordova is built for production atm
let options = require(isProd && !startCordova ? `./production.json` : './development.json');
options.IS_PROD = isProd;
options.PROXY_BACKEND = proxyBackend;
options.IS_ELECTRON = getEnv('PLATFORM', 'electron', ['web', 'android']);
options.IS_ANDROID = getEnv('PLATFORM', 'android', ['electron', 'web']);
options.IS_WEB = getEnv('PLATFORM', 'web', ['electron', 'android']);
options.SERVICE_WORKER_URL = options.IS_WEB ? '/sw.js' : false;
options.IS_PROFILE = getEnv('PROFILE', 'true');
const backendPort = options.BACKEND_ADDRESS.split(':')[1];
if (options.PROXY_BACKEND && !options.IS_PROD) {
options.BACKEND_ADDRESS = `{}:${DEV_PORT}`;
}
if (options.IS_ANDROID) {
if (startCordova) {
options.BACKEND_ADDRESS = `${startCordova}:${options.BACKEND_ADDRESS.split(':')[1]}`;
} else {
console.error(`To start emulation use \nnpm run android 192.168.1.17\n where AVD is in bridge mode and 17 is your IP`);
}
}
if (options.IS_ELECTRON || options.IS_ANDROID) {
// oauth doesn't work from file:// protocol
// we need to load the http page for registration where they are used
// temporary stabbing them as null
["GOOGLE_OAUTH_2_CLIENT_ID", "FACEBOOK_APP_ID"].forEach((v) => {
if (options[v]) {
console.error(`${v}=${options[v]} is not implemented yet, the value would be ignored`);
options[v] = false;
}
});
}
let gitHash;
try {
gitHash = child_process.execSync('git rev-parse --short=10 HEAD', {encoding: 'utf8'});
gitHash = gitHash.trim();
options.GIT_HASH = gitHash;
console.log(`Git hash = ${gitHash}`)
} catch (e) {
function makeid(length) {
var result = '';
var characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
options.GIT_HASH = `_${makeid(9)}`;
console.log(`Git hash is unavailable, mocking with randoms string ${options.GIT_HASH}`);
}
options.IS_SSL = true;
if (options.IS_ELECTRON || options.IS_ANDROID) {
if (isProd && !startCordova) {
// before we reassigned PUBLIC_PATH
if (options.PUBLIC_PATH) {
options.CAPTCHA_IFRAME = `${options.PUBLIC_PATH}/recaptcha.html`;
} else {
options.CAPTCHA_IFRAME = `${options.IS_SSL? 'https': 'http'}://${options.BACKEND_ADDRESS}/recaptcha.html`;
}
options.PUBLIC_PATH = './'
} else {
options.PUBLIC_PATH = `https://localhost:${DEV_PORT}/`;
options.CAPTCHA_IFRAME = `${options.PUBLIC_PATH}/recaptcha.html`;
}
}
options.ELECTRON_MAIN_FILE = options.IS_PROD ? `file://{}/index.html` : `file:///tmp/electron.html`;
const optimization = options.IS_WEB && options.UGLIFY ? {
minimize: true,
usedExports: true,
sideEffects: true
} : {
minimize: false,
usedExports: true,
sideEffects: true
};
if (!isProd) {
// otherwise in webpack-dev-server we always have the error: Uncaught ReferenceError: webpackHotUpdate is not defined
// if this error is not present on startup, we can remove this option
optimization.runtimeChunk= true; // https://github.com/webpack/webpack/issues/6693
}
const configFile = options.IS_WEB && !options.IS_DEBUG ? 'tsconfig.json' : 'tsconfig.esnext.json' ;
let definePlugin = new webpack.DefinePlugin({PYCHAT_CONSTS: JSON.stringify(options)});
return {options, definePlugin, optimization, configFile, startCordova, linting, backendPort};
}();
const getConfig = async () => {
let plugins;
let sasscPlugins;
function getOptions(path, additionalArgs = {}) {
let res = Object.assign({
outputPath: path,
name
}, additionalArgs);
if (options.PUBLIC_PATH) {
res.publicPath = `${options.PUBLIC_PATH}${path}`;
}
return res;
}
const entry = ['reflect-metadata', './src/ts/main.ts']
let webpackOptions = {
hash: false,
favicon: 'src/assets/img/favicon.ico',
template: 'src/assets/index.ejs',
inject: false
};
if (options.MANIFEST && options.IS_WEB) {
webpackOptions.manifest = options.MANIFEST
}
if (options.IS_ANDROID) {
webpackOptions.IS_ANDROID = options.IS_ANDROID;
}
if (options.UGLIFY || !options.IS_DEBUG) { // uglyging this is not that important as reducing file that's always refreshing
webpackOptions.minify = {
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true
};
}
let htmlWebpackPlugin = new HtmlWebpackPlugin(webpackOptions);
plugins = [
definePlugin,
new VueLoaderPlugin(),
new CleanTerminalPlugin(),
new ServiceWorkerWepbackPlugin({
entry: './src/ts/sw.ts',
minimize: options.IS_WEB && options.UGLIFY,
}),
new CopyWebpackPlugin([
{from: './src/assets/manifest.json', to: ''},
{from: './src/assets/recaptcha.html', to: ''},
]),
htmlWebpackPlugin,
new PreloadWebpackPlugin({
rel: 'preload',
as: 'font',
include: 'allAssets',
fileWhitelist: [/fontello\.woff2/i], // preload font wince it's required all the time https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fpychat.org%2F%23%2Fpainter
}),
];
if (linting) {
plugins.unshift(new StyleLintPlugin({
files: ['**/*.vue', '**/*.sass'],
failOnError: false,
}))
}
if (!options.IS_PROD && options.IS_ELECTRON) {
plugins.push(new SaveHtmlToFile('/tmp/electron.html'));
}
if (!options.IS_DEBUG && options.IS_WEB) {
entry.unshift('./src/ts/polyfills/inputEvent.ts')
}
if (options.IS_PROD) {
const SriPlugin = require('webpack-subresource-integrity');
plugins.push(new SriPlugin({
hashFuncNames: ['sha256', 'sha384'],
enabled: true,
}));
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
if (options.IS_WEB) {
const CompressionPlugin = require('compression-webpack-plugin');
plugins.push(new CompressionPlugin())
}
if (options.IS_WEB && options.UGLIFY) {
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
plugins.push(new OptimizeCSSAssetsPlugin({
cssProcessorOptions: {
map: {
inline: false
}
}
}));
}
plugins.push(new CleanWebpackPlugin({cleanOnceBeforeBuildPatterns: getDist()}));
plugins.push(new MiniCssExtractPlugin({
filename: `[name].css${hashType}`
}));
let minicssPlugin = {
loader: MiniCssExtractPlugin.loader,
};
if (options.PUBLIC_PATH) {
minicssPlugin.options = {
publicPath: options.PUBLIC_PATH
}
}
sasscPlugins = [
minicssPlugin,
'css-loader',
sassOptionsGlobal,
];
} else {
// TODO it lags a lot
// const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
// plugins.push(new HardSourceWebpackPlugin({
// environmentHash: {
// root: process.cwd(),
// includePaths: [path.resolve(__dirname, 'src/assets/sass')],
// directories: [],
// files: ['package.json', `jsonConfig.json`],
// }
// }))
sasscPlugins = [
"style-loader", 'css-loader?sourceMap',
sassOptionsGlobal
];
}
plugins.push(new webpack.ProgressPlugin(function (percentage, msg, current, active, modulepath) {
if (process.stdout.isTTY && percentage < 1) {
process.stdout.cursorTo(0);
modulepath = modulepath ? ' …' + modulepath.substr(modulepath.length - process.stdout.columns + 45) : '';
current = current ? ' ' + current : '';
active = active ? ' ' + active : '';
process.stdout.write((percentage * 100).toFixed(0) + '% ' + msg + current + active + modulepath + ' ');
process.stdout.clearLine(1)
} else if (process.stdout.isTTY && percentage === 1) {
process.stdout.cursorTo(0);
process.stdout.clearLine(1);
}
})
);
let tsConfig = function () {
const res = [
{
loader: 'ts-loader',
options: {
configFile,
appendTsSuffixTo: [/\.vue$/]
}
},
];
if (linting) {
res.push({
loader: 'tslint-loader'
})
}
return res;
};
let conf = {
entry,
plugins,
stats: options.IS_PROD ? {
entrypoints: false,
children: false,
logging: 'info'
}: 'minimal', // TODO DOESN WORK
profile: !!options.IS_PROFILE,
resolve: {
extensions: ['.ts', '.js', '.vue'],
alias: {
'vue': 'vue/dist/vue.js',
'@': path.resolve(__dirname, 'src')
}
},
mode: options.IS_PROD ? 'production' : 'development',
output: {
filename: options.IS_PROD ? `[name].js${hashType}` : `[name].js?[hash]`, // webpack doesn't allow to use contenthash for dev server
crossOriginLoading: 'anonymous',
path: getDist(),
publicPath: options.PUBLIC_PATH || '/' //https://github.com/webpack/webpack-dev-server/issues/851#issuecomment-399227814
},
optimization,
devtool: '#source-map',
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: tsConfig(),
},
{
exclude: /node_modules/,
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.sass$/,
use: sasscPlugins
},
{
test: /((fonts?\/.*\.svg)|(\.(woff2?|eot|ttf|otf)))(\?.*)?$/,
loader: 'file-loader',
options: getOptions('font')
},
{
test: /(favicon\.ico)|(icon\.png)$/,
loader: 'file-loader',
options: getOptions('')
},
{
test: /\.(mp3|wav)$/,
loader: 'file-loader',
options: getOptions('sounds')
},
{
test: /assets\/flags\/.*\.png$/,
loader: options.FLAGS ? 'file-loader': 'null-loader',
options: getOptions('flags')
},
{
test: /emoji-datasource-apple/,
loader: 'file-loader',
options: getOptions('smileys')
},
{
test: /assets\/img\/.*\.(png|jpg|svg|gif)$/,
loader: 'file-loader',
options: getOptions('img')
},
{
test: /cropperjs\/.*\.(png|jpg|svg|gif)$/,
loader: 'file-loader',
options: getOptions('img/cropperjs')
}
// FUCK url loader, http2 works competely fine,
// we get rid of bugs like https://data:image
// we don't need to increase file size of main.js that loads CPU
// we don't need that nor for electron/cordova
// {
// test: /assets\/img\/.*\.(png|jpg|svg|gif)$/,
// loader: 'url-loader',
// options: getOptions('img', {
// limit: options.IS_ANDROID || options.IS_ELECTRON ? 1: 32000,
// fallback: "file-loader"
// })
// }
],
},
};
if (linting) {
conf.module.rules.push({
enforce: 'pre',
test: /\.vue$/,
loader: 'eslint-loader',
exclude: /node_modules/
});
}
// if (options.IS_PROD) {
// const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
// const spm = new SpeedMeasurePlugin();
// conf = spm.wrap(conf);
// }
return conf;
};
function getSimpleConfig(mainFile, dist, entry, target) {
return {
entry,
target,
stats: options.IS_PROD ? {
entrypoints: false,
children: false,
logging: 'info'
}: 'minimal',// TODO DOESN WORK
resolve: {
extensions: ['.ts', '.vue', '.json', ".js", '.png', ".sass"],
alias: {
'@': path.resolve(__dirname, 'src')
},
},
watch: !options.IS_PROD,
mode: options.IS_PROD ? 'production' : 'development',
output: {
path: dist,
filename: mainFile
},
optimization,
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
options: {configFile}
}
]
},
plugins: [
definePlugin
],
devtool: '#source-map'
};
}
async function runElectron(mainPath) {
return new Promise((resolve, reject) => {
const electron = require('electron'); // electron path
const proc = require('child_process');
const child = proc.spawn(electron, [mainPath], {
windowsHide: false,
stdio: 'inherit',
});
child.on('close', (code, signal) => {
console.log('Electron finished', signal);
reject(code)
});
['SIGINT', 'SIGTERM'].forEach(signal => {
process.on(signal, () => {
if (!child.killed) {
child.kill(signal)
}
});
});
});
}
function runWebpack(config) {
return new Promise((resolve, reject) => {
webpack(config, (err, stats) => {
if (err && ! stats) {
reject(err)
return;
}
console.log(stats.toString({
chunks: false, // Makes the build much quieter
colors: true // Shows colors in the console
}));
if (options.IS_PROFILE) {
fs.writeFile("compilation-stats.json", JSON.stringify(stats.toJson(), null, 2), function(err) {
if(err) {
return console.log(err);
}
console.log("The file was saved!");
});
}
if (stats.compilation.errors.length) {
if (options.IS_PROD) {
reject(stats.compilation.errors)
return
}
} else {
resolve();
return
}
if (err) {
reject()
} else {
resolve()
}
})
});
}
async function setup() {
let config = await getConfig();
if (options.IS_PROD) {
await runWebpack(config);
} else {
let [key, cert, ca] = await Promise.all(
['key.pem', 'server.crt', 'csr.pem'].map(e => new Promise(
resolve => fs.readFile(path.resolve(__dirname, 'certs', e), (err, data) => resolve(data))
))
);
let devServer = {
disableHostCheck: true,
headers: {
'Access-Control-Allow-Origin': '*'
},
public: `https://localhost:${DEV_PORT}`,
historyApiFallback: true,
inline: true,
host: '0.0.0.0',
port: DEV_PORT,
http2: options.IS_SSL,
hot: true,
https: options.IS_SSL ? {key, cert, ca} : false,
before(app) {
app.use('/__open-in-editor', require('launch-editor-middleware')())
}
};
if (options.PROXY_BACKEND) {
devServer.proxy = {
"/api/**": {
target: `https://localhost:${backendPort}`,
secure: false
},
"/ws": {
target: `https://localhost:${backendPort}`,
secure: false,
ws: true
},
"/photo/**": {
target: `https://localhost:${backendPort}`,
secure: false
},
}
}
let compiler = webpack(config);
let server = new WebpackDevServer(compiler, devServer);
let devapp = await new Promise((resolve, reject) => {
server.listen(devServer.port, devServer.host, function (out, err) {
if (err) {
reject(err);
} else {
resolve(out);
}
});
});
['SIGINT', 'SIGTERM'].forEach(signal => {
process.on(signal, () => {
server.close();
process.exit(); // otherwise `yarn run dev is killed but` `node ./builder.js` is still there
});
});
}
if (options.IS_ELECTRON) {
let config = getSimpleConfig(
'electron.js',
options.IS_PROD ? getDist() : '/tmp/',
['./src/devices/electron.ts'],
'electron-main',
);
await runWebpack(config);
if (options.IS_PROD) {
} else {
await runElectron(`/tmp/electron.js`);
}
} else if(startCordova) {
require('loud-rejection/register');
const cli = require('cordova/src/cli');
await cli([null, null, 'run']);
}
}
setup().catch(e => {
try {
console.error(e);
} finally {
console.log(e)
// process.exit(1);
}
});
|
// Copyright (c) 2017 John Grube johnegrube@gmail.com
// Description: SoSOFS server
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const net = require("net");
let logger = require("bristol");
const config = require("../config.json");
let client;
function connectionHandler(connection) {
logger.trace(`Server connection on ${connection.remoteAddress}:${connection.remotePort}`);
connection.on("data", (data) => {
logger.warn(`Server (${connection.remoteAddress}:${connection.remotePort}) data: ${data}`);
})
.on("close", (error) => {
logger.trace(`Server (${connection.remoteAddress}:${connection.remotePort}) connection closed`);
})
.on("error", (error) => {
logger.warn(`Server (${connection.remoteAddress}:${connection.remotePort}) error: ${error}`);
})
.on("timeout", () => {
logger.warn(`Server (${connection.remoteAddress}:${connection.remotePort}) connection timeout`);
});
}
function start(port, startCallback) {
client = net.createConnection(port);
client.on("connection", connectionHandler);
setTimeout(() => { client.write("Test data"); }, 3000);
startCallback(null);
}
exports.start = start;
//# sourceMappingURL=client.js.map |
import fs from 'fs-extra-promise';
import Path from 'path';
import R from 'ramda';
import readdirp from 'readdirp';
import { Observable } from 'rxjs';
import { formatDevNameVersion } from './util/format';
// unix or windows paths
const ENDS_NODE_MOD_RE = /[\\/]node_modules$/;
/*
Special directory tree filter for finding node_module/X packages
- no dirs starting with '.'
- accept node_modules
- if under ancestor of node_modules
- allow if parent is node_modules (keep in node_modules/X tree)
- otherwise allow (not yet found node_modules tree)
*/
function filterDirsNodeModPacks(ei) {
const eiName = ei.name;
if (eiName.charAt(0) === '.') {
return false;
} // no dot dirs
if (eiName === 'node_modules') {
return true;
} // node_modules
const eiFullParentDir = ei.fullParentDir;
if (eiFullParentDir.indexOf('node_modules') !== -1) {
// under node_modules
// only if grand parent is node_modules will we continue down
return Path.basename(eiFullParentDir) === 'node_modules';
}
return true; // not in node_modules yet, so keep walking
}
export default function findPackages(config, rtenv, rootDirs, logUpdate) {
// ret obs of eiDN
return (
Observable.from(rootDirs)
// find all package.json files
.mergeMap((startDir) => {
const readdirpOptions = {
root: startDir,
entryType: 'files',
lstat: true, // want actual files not symlinked
fileFilter: ['package.json'],
directoryFilter: filterDirsNodeModPacks
};
if (config.treeDepth) {
readdirpOptions.depth = config.treeDepth;
}
const fstream = readdirp(readdirpOptions);
rtenv.cancelled$.subscribe(() => fstream.destroy()); // stop reading
return Observable.fromEvent(fstream, 'data')
.takeWhile(() => !rtenv.cancelled)
.takeUntil(Observable.fromEvent(fstream, 'close'))
.takeUntil(Observable.fromEvent(fstream, 'end'));
}, config.concurrentOps)
// only parents ending in node_modules
.filter((ei) => ENDS_NODE_MOD_RE.test(Path.dirname(ei.fullParentDir)))
// get name and version from package.json
.mergeMap(
(ei) =>
Observable.from(fs.readJsonAsync(ei.fullPath, { throws: false })),
(ei, pack) => ({
// returns eiDN
entryInfo: truncEI(ei),
devNameVer:
pack && pack.name && pack.version
? formatDevNameVersion(ei.stat.dev, pack.name, pack.version)
: null
}),
config.concurrentOps
)
.filter((obj) => obj.devNameVer) // has name and version, not null
.do((obj) => {
rtenv.packageCount += 1;
rtenv.currentPackageDir = obj.entryInfo.fullParentDir;
})
.do((obj) => {
logUpdate();
})
);
}
/*
Truncate entryInfo to just fullParentDir and stat to save memory
*/
function truncEI(ei) {
return R.pick(['fullParentDir', 'stat'], ei);
}
|
$(window).load(function(){
'use strict';
$(".menuDefault").sticky({ topSpacing: 80, });
});
$(document).ready(function(){
/* RESPONSIVE MENU JS */
jQuery('nav').meanmenu();
/* BACKGROUND BACKSTRETCH JS */
$.backstretch([
/*Change the images url for change the background images*/
/*Add your images to images directory and background subdirectory*/
"images/background/monkey.jpg"
/* , "images/background/california.jpg"
, "images/background/monkey.jpg"
, "images/background/smkg.jpg"
, "images/background/paris.jpg" */
], {duration: 3000, fade: 1500});
/* CIRCULE ROTATION JS */
/*You can delete this JS code and the jQueryRotateCompressed.js
inside the html file if you don't like the rotate effect :)*/
var rotation = function (){
$("#circule").rotate({
angle:-100,
animateTo:360,
duration:5000,
});
};
rotation();
$('#name').shuffleLetters();
$("a.first").pageslide({speed:700});
$("a.first").on({
click: function(){
$('#wrapper').addClass('hideoverflow')
}
});
$('#maincontainer, .mean-nav').click(function(){
if ($('#wrapper').has('hideoverflow')) {
$('#wrapper').removeClass('hideoverflow')
}
});
$('#circule').hide();
$('#circule').show(2000);
/* Pages Containers */
/*Here you can change the default images when the mouse are on one of the menu items*/
var ABimage = 'images/circule/dog.jpg';
var SKimage = 'images/circule/direction.png';
var PFimage = 'images/circule/feynman.jpg';
var BLOGimage = 'images/circule/smkdrug.jpg';
var CNimage = 'images/circule/dogsglass.jpg';
var defaultImage = 'images/circule/dog.jpg'; /*When the mouseout event is active*/
$('.GCchild').hide();
$('#about').on({
click: function(){
$('#ABcontainer').toggle('slow')
},
mouseover: function(){
$('#circule').attr('src',ABimage)
},
mouseout: function(){
$('#circule').attr('src',defaultImage)
}
});
$('#skills').on({
click: function(){
$('#SKcontainer').toggle('slow')
},
mouseover: function(){
$('#circule').attr('src',SKimage)
},
mouseout: function(){
$('#circule').attr('src',defaultImage)
}
});
$('#portfolio').on({
click: function(){
$('#PFcontainer').toggle('slow')
},
mouseover: function(){
$('#circule').attr('src',PFimage)
},
mouseout: function(){
$('#circule').attr('src',defaultImage)
}
});
$('#blog').on({
click: function(){
$('#BLOGcontainer').toggle('slow')
},
mouseover: function(){
$('#circule').attr('src',BLOGimage)
},
mouseout: function(){
$('#circule').attr('src',defaultImage)
}
});
$('#contact').on({
click: function(){
$('#CNcontainer').toggle('slow')
},
mouseover: function(){
$('#circule').attr('src',CNimage)
},
mouseout: function(){
$('#circule').attr('src',defaultImage)
}
});
/* TABS JS */
function resetTabs(){
$("#tabcontainer > div").hide(); //Hide all tabcontainer
$("#tabs a").attr("id",""); //Reset id's
}
var myUrl = window.location.href; //get URL
var myUrlTab = myUrl.substring(myUrl.indexOf("#")); // For mywebsite.com/tabs.html#tab2, myUrlTab = #tab2
var myUrlTabName = myUrlTab.substring(0,4); // For the above example, myUrlTabName = #tab
(function(){
$("#tabcontainer > div").hide(); // Initially hide all tabcontainer
$("#tabs li:first a").attr("id","current"); // Activate first tab
$("#tabcontainer > div:first").fadeIn(); // Show first tab tabcontainer
$("#tabs a").on("click",function(e) {
e.preventDefault();
if ($(this).attr("id") == "current"){ //detection for current tab
return
}
else{
resetTabs();
$(this).attr("id","current"); // Activate this
$($(this).attr('name')).fadeIn(); // Show content for current tab
}
});
for (i = 1; i <= $("#tabs li").length; i++) {
if (myUrlTab == myUrlTabName + i) {
resetTabs();
$("a[name='"+myUrlTab+"']").attr("id","current"); // Activate url tab
$(myUrlTab).fadeIn(); // Show url tab content
}
}
})()
//Quotes
$('.carousel').carousel('cycle', {
interval: 5000
});
//skills charts
$('.chart').easyPieChart({
barColor: '#00B1AB',
trackColor: '#cccccc',
scaleColor: false,
lineWidth: 10,
easing: 'easeOutBounce',
onStep: function(from, to, percent) {
$(this.el).find('.percent').text(Math.round(percent));
}
});
//image PopUp
$('.image-popup-vertical-fit').magnificPopup({
type: 'image',
closeOnContentClick: true,
image: {
verticalFit: false
}
});
/* CONTACT FORM JS */
/* write your email url in contact.php file */
$('.sendbutton').click(function() {
var name = $('.name').val();
email = $(".email").val();
email_validation = /^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/;
message = $('.message').val();
if (name == '') {
$('.name').focus();
return false;
}else if(email == "" || !email_validation.test(email)){
$('.email').focus();
return false;
}else if(message == ""){
$('.message').focus();
return false;
}else{
var datos = 'name='+ name + '&email=' + email + '&message=' + message;
$.ajax({
type: 'POST',
url: 'contact.php',
data: datos
});
return false;
};
});
//Twitter feed
jQuery('#tweets').tweetable({
username: 'JLV_55', //twitter username
time: true,
rotate: true,
speed: 7000,
limit: 5,
replies: true,
position: 'append',
failed: "Sorry, twitter is currently unavailable for this user.",
loading: "Loading tweets...",
html5: true,
onComplete:function($ul){
$('time').timeago();
}
});
}); |
module.exports = function(blockList) {
// The blockList
this.blockList = blockList;
/*
A crafting recipe looks like the following:
- result (a block returned from the blocklist)
- amount (amount of blocks returned from the crafting)
- requirements (an array of 9 texture_names)
- options (options that the craft method can use)
If the requirements have an empty slot,
the validator will count a dirt block and an empty string as matching
*/
this.recipes = blockList.getRecipes();
/*
Crafting method
Requires 2 arguments
- resources (requirements from the recipes, can be in any shape)
- player (the player who wants to craft)
A dirt block and an empty string, will be counted as an empty position
*/
this.craft = function(resources, player) {
// Create a map of all empty positions, 1 for empty
var emptyMap = resources.map(function(item) {
return (item == 'dirt' || item == '')*1;
});
console.log(emptyMap.join(''));
// Reduce the 3x3 raster to the right 2x2 raster
var _resource = ({
'001001111': [
resources[0], resources[1],
resources[3], resources[4]
],
'100100111': [
resources[1], resources[2],
resources[4], resources[5]
],
'111001001': [
resources[3], resources[4],
resources[6], resources[7]
],
'111100100': [
resources[4], resources[5],
resources[7], resources[8]
]
})[emptyMap.join('')];
if (_resource) {
resources = _resource;
_resource = null;
}
// Remove dirt blocks
resources = resources.map(function(item) {
if (item == 'dirt') {
return '';
} else {
return item;
}
});
// Check if the resources match any recipe
var matches = this.recipes.filter(function(recipe) {
// Check if the recipe length matches
if (resources.length == recipe.requirements.length) {
// Check if it matches
var match = resources.map(function(res, index) {
return (res == recipe.requirements[index]);
}).indexOf(false) < 0;
// Return the recipe if it's a a match, and false if not
return (match ? recipe : false);
} else {
return false;
}
});
// Return the block from the first matched recipe
if (matches.length > 0) {
return {
block: matches[0].result,
amount: matches[0].amount
};
} else {
return false;
}
}
}
|
// Important modules this config uses
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const OfflinePlugin = require('offline-plugin');
// PostCSS plugins
const cssnext = require('postcss-cssnext');
const postcssFocus = require('postcss-focus');
const postcssReporter = require('postcss-reporter');
module.exports = require('./webpack.base.babel')({
// In production, we skip all hot-reloading stuff
entry: [
path.join(process.cwd(), 'app/app.js'),
],
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
output: {
filename: '[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].chunk.js',
},
// We use ExtractTextPlugin so we get a seperate CSS file instead
// of the CSS being in the JS and injected as a style tag
cssLoaders: ExtractTextPlugin.extract(
'style-loader',
'css-loader?modules&importLoaders=1!postcss-loader'
),
staticCssLoaders: ExtractTextPlugin.extract(
'style-loader',
'css-loader'
),
// In production, we minify our CSS with cssnano
postcssPlugins: [
postcssFocus(),
cssnext({
browsers: ['last 2 versions', 'IE > 10'],
}),
postcssReporter({
clearMessages: true,
}),
],
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
children: true,
minChunks: 2,
async: true,
}),
// OccurrenceOrderPlugin is needed for long-term caching to work properly.
// See http://mxs.is/googmv
new webpack.optimize.OccurrenceOrderPlugin(true),
// Merge all duplicate modules
new webpack.optimize.DedupePlugin(),
// Minify and optimize the JavaScript
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false, // ...but do not show warnings in the console (there is a lot of them)
},
}),
// Minify and optimize the index.html
new HtmlWebpackPlugin({
template: 'app/index.html',
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
inject: true,
}),
// Extract the CSS into a seperate file
new ExtractTextPlugin('[name].[contenthash].css'),
// Put it in the end to capture all the HtmlWebpackPlugin's
// assets manipulations and do leak its manipulations to HtmlWebpackPlugin
new OfflinePlugin({
// No need to cache .htaccess. See http://mxs.is/googmp,
// this is applied before any match in `caches` section
excludes: ['.htaccess'],
caches: {
main: [':rest:'],
// All chunks marked as `additional`, loaded after main section
// and do not prevent SW to install. Change to `optional` if
// do not want them to be preloaded at all (cached only when first loaded)
additional: ['*.chunk.js'],
},
// Removes warning for about `additional` section usage
safeToUseOptionalCaches: true,
AppCache: {
// Starting from offline-plugin:v3, AppCache by default caches only
// `main` section. This lets it use `additional` section too
caches: ['main', 'additional'],
},
}),
],
});
|
'use strict';
/* App Module */
var phonecatApp = angular.module('phonecatApp', [
'ngRoute',
'ui.bootstrap',
'phonecatAnimations',
'phonecatControllers',
'phonecatFilters',
'phonecatServices'
]);
phonecatApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/phones', {
templateUrl: 'partials/phone-list.html',
controller: 'PhoneListCtrl'
}).
when('/phones/:phoneId', {
templateUrl: 'partials/phone-detail.html',
controller: 'PhoneDetailCtrl'
}).
when('/phones/modal/:phoneId', {
templateUrl:'partials/modal-detail.html',
controller:'PhoneModalDetailCtrl'
}).
otherwise({
redirectTo: '/phones'
});
}]);
|
var classhryky_1_1reduction_1_1_int =
[
[ "base_type", "classhryky_1_1reduction_1_1_int.html#ae608658dae381b8a1cc5b61ed71543d2", null ],
[ "heap_type", "classhryky_1_1reduction_1_1_base.html#ae7f7c04222f3bb069251fedf2afc051f", null ],
[ "this_type", "classhryky_1_1reduction_1_1_int.html#a24a89f763bdcfe8ca1468ec3b5dec544", null ],
[ "value_type", "classhryky_1_1reduction_1_1_int.html#a4c10353c438e63ebe6db2d4789ad0486", null ],
[ "Int", "classhryky_1_1reduction_1_1_int.html#ab8b8d68c4867648140a1d536d8f9fc63", null ],
[ "Int", "classhryky_1_1reduction_1_1_int.html#a9ae93f0027ce3a1bc2fa9683d5ee30c8", null ],
[ "Int", "classhryky_1_1reduction_1_1_int.html#aa632429a9fcd3ed75e5f0b019ed6a36d", null ],
[ "Int", "classhryky_1_1reduction_1_1_int.html#abcf6b2bb8a2288a0e067fbcb57dd71bd", null ],
[ "~Int", "classhryky_1_1reduction_1_1_int.html#a96f848c3879a470731ecacec7404ce93", null ],
[ "clear", "classhryky_1_1reduction_1_1_int.html#a28f34f0cc9d9e362df1f9ccfe1c86d05", null ],
[ "delete_self", "classhryky_1_1reduction_1_1_base.html#a100265b04179500cd7901c8afea64eb0", null ],
[ "dispatch", "classhryky_1_1reduction_1_1_base.html#a71b31d4d0ed915254e2cb1ef217f28c4", null ],
[ "name", "classhryky_1_1reduction_1_1_base.html#a842569265d741905eb8a353d3935f1d1", null ],
[ "swap", "classhryky_1_1reduction_1_1_int.html#abcd3fd2ae9210b4bc746898210cbf83d", null ],
[ "value", "classhryky_1_1reduction_1_1_int.html#a093933195e424d24a1fc1deba79c7c3c", null ],
[ "write_to", "classhryky_1_1reduction_1_1_base.html#a709cc7c48e1c90fe253739e46d82aa19", null ],
[ "hryky_assign_op", "classhryky_1_1reduction_1_1_int.html#a9adbc42b86231375d9e8e26c0a999d33", null ]
]; |
$package("org.mathdox.formulaeditor");
$identify("org/mathdox/formulaeditor/MathCanvasFill.js");
$require("org/mathdox/formulaeditor/MathCanvas.js");
$main(function(){
org.mathdox.formulaeditor.MathCanvas.addFont(50,
{cmbx10:[[5,5,0],[7,5,0],[6,5,0],[6,5,0],[5,5,0],[6,5,0],[6,5,0],[6,5,0],
[6,5,0],[6,5,0],[6,5,0],[6,5,0],[5,5,0],[5,5,0],[7,5,0],[7,5,0],
[2,4,0],[3,6,2,1],[3,2,-3],[3,2,-3,-1],[2,2,-3,-1],[4,2,-3],[4,2,-3],[2,2,-3,-2],
[2,2,2,-1],[4,5,0],[6,4,0],[6,4,0],[4,5,1],[7,5,0],[8,6,1],[6,6,1],
[3,1,-2],[2,5,0],[4,3,-2],[7,7,2],[4,6,1],[7,7,1],[6,5,0],[2,3,-2],
[3,8,2],[3,8,2],[4,4,-2],[6,6,1],[2,2,1],[3,1,-1],[2,1,0],[4,8,2],
[4,5,0],[4,5,0],[4,5,0],[4,5,0],[4,5,0],[4,5,0],[4,5,0],[4,5,0],
[4,5,0],[4,5,0],[2,3,0],[2,4,1],[2,6,2],[6,3,0],[4,6,2],[4,5,0],
[6,5,0],[6,5,0],[6,5,0],[6,5,0],[6,5,0],[5,5,0],[5,5,0],[6,5,0],
[6,5,0],[3,5,0],[4,6,1],[6,5,0],[5,5,0],[8,5,0],[6,5,0],[6,5,0],
[5,5,0],[6,7,2],[6,5,0],[4,5,0],[6,5,0],[6,5,0],[6,5,0],[8,5,0],
[6,5,0],[6,5,0],[5,5,0],[2,8,2],[3,3,-2,-1],[2,8,2],[2,2,-3,-1],[2,2,-3],
[2,3,-2],[4,4,0],[5,5,0],[4,4,0],[5,5,0],[4,4,0],[3,5,0],[4,6,2],
[5,5,0],[2,5,0],[3,7,2,1],[4,5,0],[2,5,0],[7,4,0],[5,4,0],[4,4,0],
[5,6,2],[5,6,2],[3,4,0],[3,4,0],[3,5,0],[5,4,0],[4,4,0],[6,4,0],
[4,4,0],[4,6,2],[4,4,0],[4,1,-1],[8,1,-1],[3,2,-3,-1],[4,1,-4],[4,2,-3],
[3,13,23,33,42,52,62,72,
82,92,102,111,121,131,141,151],[9,17,26,34,42,51,59,67],[162,73]]});
org.mathdox.formulaeditor.MathCanvas.addFont(60,
{cmbx10:[[5,6,0],[7,6,0],[7,7,1],[6,6,0],[6,6,0],[7,6,0],[6,6,0],[7,6,0],
[7,6,0],[7,6,0],[7,6,0],[6,6,0],[5,6,0],[5,6,0],[8,6,0],[8,6,0],
[3,4,0],[4,6,2,1],[2,2,-4,-1],[2,2,-4,-2],[3,2,-4,-1],[3,2,-4,-1],[4,1,-4],[3,2,-4,-2],
[3,2,2,-1],[5,6,0],[7,4,0],[7,4,0],[5,6,1],[8,6,0],[9,7,1],[7,7,1],
[3,2,-2],[2,6,0],[4,4,-2],[7,8,2],[4,7,1],[8,7,1],[7,7,1],[2,3,-3],
[3,8,2],[3,8,2],[4,4,-2],[7,6,1],[2,4,2],[3,2,-1],[2,2,0],[4,8,2],
[5,6,0],[4,6,0],[5,6,0],[5,7,1],[5,6,0],[5,6,0],[5,7,1],[5,6,0],
[5,7,1],[5,6,0],[2,4,0],[2,6,2],[2,6,2],[7,4,0],[4,6,2],[4,6,0],
[7,6,0],[7,6,0],[6,6,0],[7,7,1],[7,6,0],[6,6,0],[6,6,0],[7,7,1],
[7,6,0],[4,6,0],[5,7,1],[7,6,0],[6,6,0],[9,6,0],[7,6,0],[7,7,1],
[6,6,0],[7,8,2],[7,7,1],[5,7,1],[6,6,0],[7,7,1],[7,6,0],[10,6,0],
[7,6,0],[7,6,0],[6,6,0],[2,8,2,-1],[4,4,-2,-1],[2,8,2],[3,2,-4,-1],[2,2,-4],
[2,4,-2],[5,4,0],[5,6,0],[4,4,0],[5,6,0],[4,4,0],[4,6,0],[5,6,2],
[5,6,0],[3,6,0],[4,8,2,1],[5,6,0],[3,6,0],[8,4,0],[5,4,0],[5,4,0],
[5,6,2],[5,6,2],[4,4,0],[4,4,0],[3,5,0],[5,4,0],[5,4,0],[7,4,0],
[5,4,0],[5,6,2],[4,4,0],[5,1,-2],[9,1,-2],[3,2,-4,-1],[3,2,-4,-1],[3,2,-4,-1],
[3,15,27,39,51,63,75,86,
98,110,122,134,146,157,169,181],[11,21,31,41,51,61,71,81],[194,87]]});
org.mathdox.formulaeditor.MathCanvas.addFont(70,
{cmbx10:[[7,7,0],[9,7,0],[9,8,1],[8,7,0],[8,7,0],[9,7,0],[8,7,0],[9,7,0],
[8,7,0],[9,7,0],[8,7,0],[8,7,0],[6,7,0],[6,7,0],[10,7,0],[10,7,0],
[3,5,0],[4,7,2,1],[3,2,-5,-1],[3,2,-5,-2],[4,2,-5,-1],[4,2,-5,-1],[5,2,-5],[3,2,-5,-3],
[4,2,2,-1],[6,7,0],[8,5,0],[9,5,0],[6,7,1],[10,7,0],[11,8,1],[12,9,1,3],
[4,2,-2],[2,7,0,-1],[5,4,-3],[9,9,2],[5,9,1],[9,9,1],[9,8,1],[3,4,-3],
[3,10,2,-1],[4,10,2],[5,5,-3],[9,9,2],[3,4,2],[4,2,-1],[3,2,0],[5,10,2],
[6,8,1],[5,7,0],[6,7,0],[6,8,1],[6,7,0],[6,8,1],[6,8,1],[6,7,0],
[6,10,1],[6,10,1],[3,5,0],[3,7,2],[2,7,2,-1],[9,3,-1],[5,7,2],[5,9,0],
[9,7,0],[9,7,0],[8,7,0],[8,8,1],[9,7,0],[8,7,0],[7,7,0],[9,8,1],
[9,7,0],[4,7,0],[6,8,1],[9,7,0],[7,7,0],[11,7,0],[9,7,0],[8,8,1],
[8,7,0],[8,9,2],[9,8,1],[6,8,1],[8,7,0],[9,8,1],[9,7,0],[12,7,0],
[12,7,0,3],[9,7,0],[7,7,0],[2,10,2,-1],[5,4,-3,-1],[2,10,2],[4,2,-5,-1],[3,2,-5],
[3,4,-3],[6,5,0],[6,7,0],[5,5,0],[6,7,0],[5,5,0],[5,7,0],[6,7,2],
[7,7,0],[3,7,0],[4,9,2,1],[6,9,0],[3,7,0],[10,9,0],[7,5,0],[6,5,0],
[6,7,2],[6,7,2],[5,5,0],[5,5,0],[4,7,0],[7,5,0],[6,5,0],[8,5,0],
[6,5,0],[6,7,2],[5,5,0],[6,1,-2],[12,1,-2],[8,5,-2,3],[4,2,-5,-1],[4,2,-5,-1],
[4,18,32,46,59,73,87,101,
115,128,142,156,170,184,198,211],[13,24,36,47,59,71,82,94],[227,102]]});
org.mathdox.formulaeditor.MathCanvas.addFont(85,
{cmbx10:[[8,9,0],[11,9,0],[10,10,1],[10,9,0],[9,9,0],[11,9,0],[10,9,0],[10,9,0],
[10,9,0],[10,9,0],[10,9,0],[9,9,0],[8,9,0],[8,9,0],[11,9,0],[11,9,0],
[4,6,0],[5,9,3,1],[3,3,-6,-1],[3,3,-6,-3],[5,2,-6,-1],[5,3,-6,-1],[5,2,-6,-1],[4,3,-6,-3],
[5,3,3,-1],[7,9,0],[10,7,1],[11,7,1],[7,9,2],[12,9,0],[13,10,1,-1],[10,10,1],
[4,2,-3],[2,9,0,-1],[6,5,-4],[11,12,3],[7,10,1],[11,10,1],[10,10,1],[2,5,-4,-1],
[4,12,3,-1],[4,12,3],[5,6,-3,-1],[10,10,2],[2,5,3,-1],[4,2,-2],[2,2,0,-1],[6,12,3],
[7,9,1],[5,8,0,-1],[7,8,0],[7,9,1],[7,8,0],[7,9,1],[7,9,1],[7,9,0],
[7,9,1],[7,9,1],[2,6,0,-1],[2,9,3,-1],[2,9,3,-1],[10,4,-1],[6,9,3],[6,9,0],
[10,10,1],[10,9,0],[9,9,0],[10,10,1],[10,9,0],[9,9,0],[8,9,0],[10,10,1],
[11,9,0],[5,9,0],[7,10,1],[11,9,0],[8,9,0],[13,9,0],[11,9,0],[10,10,1],
[9,9,0],[10,12,3],[11,10,1],[7,10,1],[9,9,0],[10,10,1],[10,9,0],[14,9,0],
[10,9,0],[11,9,0],[8,9,0],[3,12,3,-1],[6,5,-4,-1],[3,12,3],[5,3,-6,-1],[2,3,-6,-1],
[3,5,-4],[7,7,1],[8,9,0],[6,6,0],[8,10,1],[6,7,1],[6,9,0],[7,9,3],
[8,9,0],[4,9,0],[5,12,3,1],[7,9,0],[4,9,0],[12,6,0],[8,6,0],[7,7,1],
[8,9,3],[8,9,3],[6,6,0],[5,7,1],[5,8,0],[8,7,1],[7,6,0],[10,6,0],
[7,6,0],[7,9,3],[6,6,0],[7,1,-3],[14,1,-3],[5,3,-6,-1],[5,2,-7,-1],[5,3,-6,-1],
[5,22,38,55,72,89,106,122,
139,156,173,190,206,223,240,257],[16,30,45,59,73,87,101,115],[275,125]]});
org.mathdox.formulaeditor.MathCanvas.addFont(100,
{cmbx10:[[9,10,0],[13,10,0],[12,11,1],[11,10,0],[10,10,0],[12,10,0],[10,10,0,-1],[11,10,0,-1],
[11,10,0],[11,10,0,-1],[11,10,0],[11,10,0],[9,10,0],[9,10,0],[13,10,0],[13,10,0],
[4,7,0],[5,10,3,1],[4,3,-7,-1],[4,3,-7,-3],[4,2,-7,-2],[6,3,-7,-1],[6,2,-7,-1],[4,3,-7,-4],
[6,3,3,-1],[8,10,0],[12,8,1],[12,8,1],[8,10,2],[14,10,0],[15,11,1,-1],[12,12,1],
[5,2,-4],[3,10,0,-1],[7,6,-4],[12,13,3,-1],[8,12,1],[13,12,1],[12,11,1],[3,5,-5,-1],
[5,15,4,-1],[4,15,4,-1],[6,7,-4,-1],[11,11,2,-1],[3,6,3,-1],[5,2,-2],[3,3,0,-1],[6,15,4,-1],
[8,11,1],[6,10,0,-1],[8,10,0],[8,11,1],[8,10,0],[8,11,1],[8,11,1],[7,11,1,-1],
[8,11,1],[8,11,1],[3,7,0,-1],[3,10,3,-1],[3,10,3,-1],[11,5,-1,-1],[6,10,3,-1],[6,10,0,-1],
[12,11,1],[12,10,0],[11,10,0],[11,11,1],[12,10,0],[10,10,0],[10,10,0],[12,11,1],
[12,10,0],[6,10,0],[8,11,1],[12,10,0],[9,10,0],[15,10,0],[12,10,0],[12,11,1],
[10,10,0],[12,13,3],[12,11,1],[8,11,1],[11,10,0],[12,11,1],[12,10,0],[17,10,0],
[12,10,0],[12,10,0],[8,10,0,-1],[3,15,4,-1],[6,6,-4,-2],[3,15,4],[4,3,-7,-2],[3,3,-7,-1],
[4,6,-4],[8,7,0],[9,10,0],[7,7,0],[9,11,1],[7,7,0],[7,10,0],[8,10,3],
[9,10,0],[4,10,0],[5,13,3,1],[9,10,0],[5,10,0],[14,7,0],[9,7,0],[8,7,0],
[9,10,3],[9,10,3],[7,7,0],[6,8,1],[6,10,1],[9,7,0],[8,7,0],[12,7,0],
[9,7,0],[8,10,3],[7,7,0],[8,2,-3],[16,2,-3],[5,3,-7,-2],[6,2,-8,-1],[6,3,-7,-1],
[6,26,45,65,85,104,124,144,
164,183,203,223,243,262,282,302],[19,36,52,69,85,102,119,135],[324,146]]});
org.mathdox.formulaeditor.MathCanvas.addFont(120,
{cmbx10:[[11,12,0],[15,12,0,-1],[14,13,1,-1],[13,12,0],[13,12,0],[15,12,0],[12,12,0,-1],[13,12,0,-1],
[12,12,0,-1],[13,12,0,-1],[13,12,0,-1],[13,12,0],[11,12,0],[11,12,0],[16,12,0],[16,12,0],
[5,8,0],[6,12,4,1],[4,4,-8,-2],[4,4,-8,-4],[6,2,-9,-2],[7,4,-8,-1],[8,2,-9,-1],[5,3,-9,-5],
[6,4,4,-2],[10,13,1],[14,9,1],[15,9,1],[10,12,2],[18,12,0],[19,13,1,-1],[14,14,1,-1],
[6,3,-4],[4,12,0,-1],[8,6,-6],[15,16,4,-1],[8,14,1,-1],[15,14,1,-1],[15,13,1],[4,6,-6,-1],
[6,17,4,-1],[5,17,4,-1],[8,8,-5,-1],[13,14,3,-1],[4,7,4,-1],[6,2,-3],[3,3,0,-1],[8,17,4,-1],
[9,13,1],[8,12,0,-1],[8,12,0,-1],[9,13,1],[10,12,0],[8,12,1,-1],[9,13,1],[9,13,1,-1],
[9,13,1],[9,13,1],[3,8,0,-1],[4,12,4,-1],[4,13,4,-1],[13,6,-1,-1],[8,13,4,-1],[8,12,0,-1],
[14,13,1,-1],[14,12,0],[13,12,0],[12,13,1,-1],[14,12,0],[13,12,0],[12,12,0],[14,13,1,-1],
[15,12,0],[7,12,0],[9,13,1],[15,12,0],[11,12,0],[18,12,0],[15,12,0],[13,13,1,-1],
[13,12,0],[13,16,4,-1],[15,13,1],[9,13,1,-1],[13,12,0],[15,13,1],[15,13,1],[20,13,1],
[15,12,0],[15,12,0],[10,12,0,-1],[3,17,4,-2],[8,7,-5,-2],[4,17,4],[6,3,-9,-2],[3,3,-9,-1],
[3,7,-5,-1],[10,9,1],[11,13,1],[8,9,1],[11,13,1],[9,9,1],[8,12,0],[10,12,4],
[11,12,0],[5,12,0],[6,16,4,1],[10,12,0],[5,12,0],[16,8,0],[11,8,0],[10,9,1],
[11,12,4],[11,12,4],[8,8,0],[7,9,1],[7,12,1],[11,9,1],[10,8,0],[14,8,0],
[10,8,0],[10,12,4],[8,8,0],[10,1,-4],[20,1,-4],[7,4,-8,-2],[7,2,-10,-1],[7,3,-9,-1],
[7,31,54,78,102,125,149,173,
196,220,244,268,291,315,339,362],[22,42,61,81,101,121,141,161],[388,175]]});
org.mathdox.formulaeditor.MathCanvas.addFont(144,
{cmbx10:[[13,14,0],[17,14,0,-1],[16,15,1,-1],[16,14,0],[14,14,0,-1],[18,14,0],[15,14,0,-1],[16,14,0,-1],
[15,14,0,-1],[16,14,0,-1],[15,14,0,-1],[15,14,0],[12,14,0],[12,14,0],[19,14,0],[19,14,0],
[5,9,0,-1],[8,13,4,2],[5,4,-10,-2],[5,4,-10,-5],[7,3,-10,-2],[8,4,-10,-2],[9,2,-11,-1],[5,4,-10,-6],
[7,4,4,-2],[12,15,1],[16,10,1],[18,10,1],[11,13,2],[21,14,0],[22,15,1,-1],[16,16,1,-1],
[7,3,-5],[3,15,0,-2],[10,7,-7],[17,18,4,-1],[10,17,2,-1],[17,17,2,-1],[16,15,1,-1],[4,7,-7,-1],
[6,20,5,-2],[6,20,5,-1],[9,9,-6,-1],[16,16,3,-1],[4,8,4,-1],[7,3,-3],[4,4,0,-1],[10,20,5,-1],
[11,15,1],[9,13,0,-1],[10,14,0,-1],[10,15,1,-1],[11,14,0],[10,14,1,-1],[10,15,1,-1],[11,15,1,-1],
[10,15,1,-1],[10,15,1,-1],[4,9,0,-1],[4,13,4,-1],[3,15,5,-2],[16,6,-2,-1],[9,14,4,-1],[9,14,0,-1],
[16,15,1,-1],[17,14,0],[15,14,0],[15,15,1,-1],[17,14,0],[15,14,0],[14,14,0],[16,15,1,-1],
[18,14,0],[8,14,0],[11,15,1],[17,14,0],[13,14,0],[21,14,0],[18,14,0],[15,15,1,-1],
[15,14,0],[16,18,4,-1],[18,15,1],[11,15,1,-1],[16,14,0],[17,15,1],[17,15,1],[24,15,1],
[17,14,0],[17,14,0],[12,14,0,-1],[4,20,5,-2],[10,8,-6,-2],[4,20,5],[7,4,-10,-2],[4,4,-10,-1],
[4,8,-6,-1],[12,10,1],[12,15,1],[10,10,1],[12,15,1],[10,10,1],[9,14,0],[12,13,4],
[13,14,0],[5,14,0,-1],[8,18,4,2],[12,14,0],[5,14,0,-1],[19,9,0],[13,9,0],[11,10,1],
[12,13,4],[12,13,4],[9,9,0],[9,10,1],[8,14,1],[13,10,1],[12,9,0],[17,9,0],
[12,9,0],[12,13,4],[10,9,0],[12,1,-5],[23,1,-5],[7,5,-10,-3],[8,3,-11,-2],[8,3,-11,-2],
[8,37,65,94,122,150,179,207,
236,264,293,321,349,378,406,435],[26,50,74,98,122,145,169,193],[466,209]]});
org.mathdox.formulaeditor.MathCanvas.addFont(173,
{cmbx10:[[16,17,0],[21,17,0,-1],[19,18,1,-1],[18,17,0,-1],[17,17,0,-1],[21,17,0],[18,17,0,-1],[19,17,0,-1],
[18,17,0,-1],[19,17,0,-1],[18,17,0,-1],[18,17,0],[15,17,0],[15,17,0],[23,17,0],[23,17,0],
[6,11,0,-1],[9,16,5,2],[6,5,-12,-2],[6,5,-12,-5],[8,4,-12,-3],[10,5,-12,-2],[10,2,-13,-2],[7,5,-12,-7],
[8,5,5,-3],[14,18,1],[20,12,1],[21,12,1],[13,17,3],[24,17,0,-1],[26,18,1,-2],[19,20,2,-1],
[8,4,-6],[4,17,0,-2],[11,9,-8,-1],[21,22,5,-1],[12,20,2,-1],[21,20,2,-1],[19,18,1,-1],[5,9,-8,-2],
[8,24,6,-2],[8,24,6,-1],[11,11,-7,-1],[19,20,4,-1],[4,9,5,-2],[8,3,-4],[4,4,0,-2],[12,24,6,-1],
[12,17,1,-1],[10,16,0,-2],[12,16,0,-1],[12,17,1,-1],[13,16,0],[12,17,1,-1],[12,17,1,-1],[13,18,1,-1],
[12,17,1,-1],[12,17,1,-1],[4,11,0,-2],[4,16,5,-2],[4,17,5,-2],[19,8,-2,-1],[11,17,5,-1],[11,17,0,-1],
[19,18,1,-1],[19,17,0,-1],[19,17,0],[18,18,1,-1],[20,17,0],[18,17,0],[17,17,0],[20,18,1,-1],
[21,17,0],[10,17,0],[13,18,1],[21,17,0],[16,17,0],[25,17,0,-1],[21,17,0],[19,18,1,-1],
[18,17,0],[19,22,5,-1],[21,18,1],[13,18,1,-1],[18,17,0,-1],[20,18,1,-1],[21,18,1],[28,18,1],
[20,17,0],[21,17,0],[15,17,0,-1],[4,24,6,-3],[11,9,-8,-3],[5,24,6],[8,5,-12,-3],[4,4,-13,-2],
[5,9,-8,-1],[14,12,1],[15,18,1],[12,12,1],[15,18,1],[12,12,1],[10,17,0,-1],[14,16,5],
[14,17,0,-1],[6,17,0,-1],[9,22,5,2],[15,17,0],[6,17,0,-1],[22,11,0,-1],[14,11,0,-1],[13,12,1],
[15,16,5],[15,16,5],[11,11,0],[10,12,1],[10,17,1],[14,12,1,-1],[14,12,1],[20,12,1],
[14,11,0],[14,16,5],[11,11,0],[14,1,-6],[28,1,-6],[9,5,-12,-3],[10,3,-14,-2],[10,4,-13,-2],
[10,44,78,112,147,181,215,249,
283,317,352,386,420,454,488,522],[32,61,90,118,147,176,204,233],[560,253]]});
org.mathdox.formulaeditor.MathCanvas.addFont(207,
{cmbx10:[[18,20,0,-1],[25,21,0,-1],[23,22,1,-1],[22,21,0,-1],[20,20,0,-1],[24,20,0,-1],[22,20,0,-1],[23,21,0,-1],
[22,20,0,-1],[23,20,0,-1],[22,21,0,-1],[22,21,0],[18,21,0],[18,21,0],[27,21,0],[27,21,0],
[8,13,0,-1],[10,19,6,2],[7,7,-14,-3],[7,7,-14,-7],[9,4,-15,-4],[11,7,-14,-3],[13,2,-16,-2],[7,6,-15,-9],
[10,6,6,-3],[16,22,1,-1],[23,15,1,-1],[24,15,1,-1],[16,19,3],[29,20,0,-1],[31,22,1,-2],[23,24,2,-1],
[10,4,-8],[6,21,0,-2],[13,11,-10,-1],[25,27,6,-1],[14,24,2,-1],[25,24,2,-1],[24,22,1,-1],[6,11,-10,-2],
[8,30,8,-3],[9,30,8,-1],[13,14,-8,-2],[23,23,4,-1],[6,11,6,-2],[10,3,-5],[5,5,0,-2],[14,30,8,-1],
[15,20,1,-1],[13,19,0,-2],[14,19,0,-1],[15,20,1,-1],[16,19,0],[14,20,1,-1],[15,20,1,-1],[16,21,1,-1],
[15,20,1,-1],[15,20,1,-1],[5,13,0,-2],[5,19,6,-2],[6,21,6,-2],[23,9,-3,-1],[13,21,6,-1],[13,21,0,-1],
[23,22,1,-1],[23,21,0,-1],[21,20,0,-1],[22,22,1,-1],[23,20,0,-1],[20,20,0,-1],[19,20,0,-1],[24,22,1,-1],
[24,20,0,-1],[11,20,0,-1],[16,21,1],[24,20,0,-1],[18,20,0,-1],[30,20,0,-1],[24,20,0,-1],[23,22,1,-1],
[20,20,0,-1],[23,27,6,-1],[24,21,1,-1],[16,22,1,-1],[21,20,0,-1],[24,21,1,-1],[25,21,1],[34,21,1],
[24,20,0,-1],[25,20,0],[18,20,0,-1],[6,30,8,-3],[13,10,-10,-4],[6,30,8],[10,5,-15,-3],[5,6,-15,-2],
[6,10,-10,-1],[16,15,1,-1],[17,22,1,-1],[13,15,1,-1],[17,22,1,-1],[15,15,1],[12,21,0,-1],[16,20,6,-1],
[17,21,0,-1],[8,21,0,-1],[10,27,6,2],[16,21,0,-1],[8,21,0,-1],[27,13,0,-1],[17,13,0,-1],[16,15,1],
[17,19,6,-1],[17,19,6,-1],[12,13,0,-1],[11,15,1,-1],[12,20,1],[17,14,1,-1],[17,14,1],[24,14,1],
[17,13,0],[17,19,6],[13,13,0,-1],[17,2,-7],[34,2,-7],[11,6,-15,-4],[11,4,-17,-3],[11,5,-16,-3],
[12,53,94,135,175,216,257,298,
339,380,421,462,502,543,584,625],[37,72,106,140,175,209,243,278],[670,301]]});
org.mathdox.formulaeditor.MathCanvas.addFont(249,
{cmbx10:[[21,24,0,-1],[29,24,0,-2],[27,25,1,-2],[25,24,0,-1],[24,23,0,-1],[29,24,0,-1],[24,24,0,-2],[27,24,0,-2],
[24,24,0,-2],[27,24,0,-2],[26,24,0,-1],[25,24,0,-1],[20,24,0,-1],[20,24,0,-1],[31,24,0,-1],[31,24,0,-1],
[9,16,0,-1],[12,23,7,2],[8,7,-17,-4],[8,7,-17,-8],[11,6,-17,-4],[13,7,-17,-3],[15,3,-18,-2],[9,6,-18,-10],
[11,7,7,-4],[19,25,1,-1],[27,17,1,-1],[29,17,1,-1],[18,23,4,-1],[34,24,0,-1],[37,25,1,-2],[27,28,2,-2],
[11,5,-9],[6,24,0,-3],[15,13,-11,-1],[29,31,7,-2],[16,28,2,-2],[29,28,2,-2],[28,25,1,-1],[7,13,-11,-2],
[10,35,9,-3],[10,35,9,-2],[15,16,-10,-2],[27,27,5,-2],[7,13,7,-2],[11,5,-5],[6,6,0,-2],[16,35,9,-2],
[17,24,1,-1],[15,23,0,-2],[17,23,0,-1],[17,24,1,-1],[18,23,0,-1],[16,24,1,-2],[17,24,1,-1],[17,24,1,-2],
[17,24,1,-1],[17,24,1,-1],[6,16,0,-2],[7,23,7,-2],[6,24,7,-3],[27,11,-3,-2],[15,24,7,-2],[15,24,0,-2],
[27,25,1,-2],[28,24,0,-1],[25,24,0,-1],[24,25,1,-2],[27,24,0,-1],[24,24,0,-1],[22,24,0,-1],[27,25,1,-2],
[29,24,0,-1],[13,24,0,-1],[18,25,1],[28,24,0,-1],[21,24,0,-1],[35,24,0,-1],[29,24,0,-1],[26,25,1,-2],
[24,24,0,-1],[26,31,7,-2],[29,25,1,-1],[18,25,1,-2],[25,23,0,-1],[28,25,1,-1],[29,25,1],[40,25,1],
[28,24,0,-1],[29,24,0],[20,24,0,-2],[6,35,9,-4],[16,13,-11,-4],[7,35,9],[11,6,-18,-4],[6,6,-18,-2],
[6,13,-11,-2],[18,17,1,-1],[20,25,1,-1],[16,17,1,-1],[20,25,1,-1],[16,17,1,-1],[14,24,0,-1],[18,23,7,-1],
[20,24,0,-1],[9,24,0,-1],[12,31,7,2],[19,24,0,-1],[9,24,0,-1],[31,16,0,-1],[20,16,0,-1],[18,17,1,-1],
[20,23,7,-1],[20,23,7,-1],[14,16,0,-1],[14,17,1,-1],[13,23,1],[20,17,1,-1],[20,17,1],[28,17,1],
[20,16,0],[20,23,7],[15,16,0,-1],[20,2,-8],[39,2,-8],[13,8,-17,-4],[14,4,-20,-3],[13,6,-18,-3],
[14,64,113,162,211,260,309,359,
408,457,506,555,604,653,703,752],[46,87,128,170,211,253,294,335],[806,363]]});
org.mathdox.formulaeditor.MathCanvas.addFont(298,
{cmbx10:[[26,28,0,-1],[35,29,0,-2],[32,30,1,-2],[31,29,0,-1],[28,28,0,-2],[35,28,0,-1],[30,29,0,-2],[32,29,0,-2],
[30,29,0,-2],[32,29,0,-2],[30,29,0,-2],[30,29,0,-1],[24,29,0,-1],[24,29,0,-1],[37,29,0,-1],[37,29,0,-1],
[11,19,0,-1],[14,28,9,3],[10,8,-21,-4],[10,8,-21,-9],[13,6,-21,-5],[15,9,-20,-4],[18,3,-22,-3],[10,7,-22,-13],
[13,9,9,-5],[23,30,1,-1],[32,20,1,-1],[35,20,1,-1],[22,28,5,-1],[41,29,0,-1],[44,30,1,-3],[32,34,3,-2],
[14,6,-11],[7,29,0,-4],[18,15,-14,-1],[35,37,8,-2],[19,34,3,-2],[35,34,3,-2],[33,30,1,-2],[8,15,-14,-3],
[12,42,11,-4],[12,42,11,-2],[18,19,-12,-3],[32,32,6,-2],[8,15,8,-3],[13,5,-7],[7,7,0,-3],[19,42,11,-2],
[21,28,1,-1],[18,27,0,-3],[20,27,0,-2],[20,28,1,-2],[22,27,0,-1],[20,28,1,-2],[20,28,1,-2],[21,29,1,-2],
[20,28,1,-2],[20,28,1,-2],[7,19,0,-3],[7,27,8,-3],[7,30,9,-4],[32,13,-4,-2],[18,30,9,-2],[18,29,0,-2],
[32,30,1,-2],[33,29,0,-1],[30,29,0,-1],[30,30,1,-2],[33,29,0,-1],[29,28,0,-1],[27,28,0,-1],[33,30,1,-2],
[35,29,0,-1],[16,29,0,-1],[21,30,1,-1],[34,29,0,-1],[26,29,0,-1],[43,29,0,-1],[35,29,0,-1],[31,30,1,-2],
[29,29,0,-1],[31,37,8,-2],[35,30,1,-1],[22,30,1,-2],[30,28,0,-1],[34,30,1,-1],[34,30,1,-1],[47,30,1,-1],
[34,29,0,-1],[35,29,0],[25,29,0,-2],[7,42,11,-5],[19,15,-14,-5],[7,42,11,-1],[13,8,-21,-5],[7,7,-22,-3],
[8,15,-14,-2],[22,20,1,-1],[24,30,1,-1],[19,20,1,-1],[24,30,1,-1],[20,20,1,-1],[17,29,0,-1],[22,28,9,-1],
[25,29,0,-1],[11,29,0,-1],[14,38,9,3],[24,29,0,-1],[11,29,0,-1],[38,19,0,-1],[25,19,0,-1],[22,20,1,-1],
[24,27,8,-1],[24,27,8,-1],[18,19,0,-1],[16,20,1,-1],[16,27,1],[25,20,1,-1],[23,20,1,-1],[32,20,1,-1],
[24,19,0],[24,28,9],[18,19,0,-1],[24,2,-10],[48,2,-10],[16,9,-21,-5],[16,5,-24,-4],[16,7,-22,-4],
[17,76,135,194,253,311,370,429,
488,547,606,664,723,782,841,900],[55,104,154,203,253,302,352,401],[964,434]]});
org.mathdox.formulaeditor.MathCanvas.addFont(358,
{cmbx10:[[31,34,0,-1],[42,35,0,-2],[38,36,1,-3],[36,35,0,-2],[34,34,0,-2],[42,34,0,-1],[35,34,0,-3],[38,35,0,-3],
[35,34,0,-3],[38,34,0,-3],[37,35,0,-2],[36,35,0,-1],[29,35,0,-1],[29,35,0,-1],[45,35,0,-1],[45,35,0,-1],
[12,22,0,-2],[17,32,10,3],[12,10,-25,-5],[12,10,-25,-11],[16,7,-25,-6],[18,10,-24,-5],[22,3,-27,-3],[13,9,-26,-15],
[16,10,10,-6],[27,36,1,-1],[39,24,1,-1],[42,24,1,-1],[26,32,5,-1],[48,34,0,-2],[52,36,1,-4],[38,40,3,-3],
[15,7,-13,-1],[9,35,0,-4],[22,18,-16,-1],[41,44,10,-3],[22,40,3,-3],[41,40,3,-3],[39,36,1,-2],[9,18,-16,-4],
[14,50,13,-5],[14,50,13,-3],[22,22,-15,-3],[38,38,7,-3],[9,18,10,-4],[16,6,-8],[8,8,0,-4],[22,50,13,-3],
[24,34,1,-2],[21,32,0,-4],[24,33,0,-2],[24,34,1,-2],[26,33,0,-1],[24,33,1,-2],[24,34,1,-2],[25,35,1,-3],
[24,34,1,-2],[24,34,1,-2],[8,22,0,-4],[8,32,10,-4],[9,35,10,-4],[38,15,-5,-3],[21,35,10,-3],[21,35,0,-3],
[38,36,1,-3],[39,35,0,-2],[36,34,0,-1],[35,36,1,-3],[39,34,0,-1],[35,34,0,-1],[32,34,0,-1],[39,36,1,-3],
[42,34,0,-1],[19,34,0,-1],[25,35,1,-1],[41,34,0,-1],[31,34,0,-1],[50,34,0,-2],[42,34,0,-1],[37,36,1,-3],
[35,34,0,-1],[37,45,10,-3],[41,35,1,-1],[26,36,1,-3],[35,34,0,-2],[41,35,1,-1],[41,35,1,-1],[56,35,1,-1],
[40,34,0,-1],[42,34,0],[29,34,0,-3],[9,50,13,-6],[22,18,-16,-6],[9,50,13,-1],[16,8,-26,-6],[8,8,-26,-4],
[9,18,-16,-3],[27,24,1,-1],[29,35,1,-1],[23,24,1,-1],[29,35,1,-1],[24,24,1,-1],[20,35,0,-2],[27,33,10,-1],
[29,34,0,-2],[12,34,0,-2],[17,44,10,3],[28,34,0,-1],[13,34,0,-2],[44,22,0,-2],[29,22,0,-2],[26,24,1,-1],
[29,32,10,-1],[29,32,10,-1],[21,22,0,-1],[20,24,1,-1],[18,33,1,-1],[29,23,1,-2],[28,23,1,-1],[39,23,1,-1],
[28,22,0,-1],[28,32,10,-1],[22,22,0,-1],[29,3,-12],[57,3,-12],[17,10,-25,-7],[20,6,-28,-4],[19,7,-27,-5],
[21,91,162,233,303,374,445,516,
586,657,728,798,869,940,1010,1081],[64,124,183,243,302,362,421,481],[1158,521]]});
org.mathdox.formulaeditor.MathCanvas.addFont(430,
{cmbx10:[[36,41,0,-2],[50,42,0,-3],[46,43,1,-3],[44,42,0,-2],[41,40,0,-2],[49,41,0,-2],[43,41,0,-3],[46,42,0,-3],
[43,41,0,-3],[46,41,0,-3],[43,42,0,-3],[43,42,0,-1],[35,42,0,-1],[35,42,0,-1],[54,42,0,-1],[54,42,0,-1],
[15,27,0,-2],[20,39,12,4],[13,12,-30,-7],[13,12,-30,-14],[18,9,-30,-8],[22,12,-29,-6],[26,4,-32,-4],[15,11,-31,-18],
[19,12,12,-7],[32,43,1,-2],[46,28,1,-2],[50,28,1,-1],[31,40,7,-1],[58,41,0,-2],[63,43,1,-4],[46,48,4,-3],
[18,8,-16,-1],[10,42,0,-5],[26,21,-20,-2],[50,53,12,-3],[28,49,4,-3],[50,49,4,-3],[48,43,1,-2],[11,21,-20,-4],
[17,60,15,-6],[17,60,15,-3],[26,27,-18,-4],[46,46,8,-3],[11,22,12,-4],[19,6,-10],[10,10,0,-4],[28,60,15,-3],
[30,40,1,-2],[25,39,0,-5],[28,39,0,-3],[29,40,1,-2],[31,39,0,-1],[28,40,1,-3],[29,40,1,-2],[30,41,1,-3],
[29,40,1,-2],[29,40,1,-2],[10,27,0,-4],[11,39,12,-4],[10,43,13,-5],[46,18,-6,-3],[26,42,12,-3],[26,42,0,-3],
[46,43,1,-3],[47,42,0,-2],[43,41,0,-2],[43,43,1,-3],[47,41,0,-2],[41,41,0,-2],[38,41,0,-2],[47,43,1,-3],
[49,41,0,-2],[22,41,0,-2],[31,42,1,-1],[49,41,0,-2],[36,41,0,-2],[60,41,0,-2],[49,41,0,-2],[45,43,1,-3],
[41,41,0,-2],[45,54,12,-3],[49,42,1,-2],[31,43,1,-3],[43,40,0,-2],[48,42,1,-2],[49,42,1,-1],[68,42,1,-1],
[48,41,0,-2],[50,41,0,-1],[35,41,0,-3],[11,60,15,-7],[26,21,-20,-8],[11,60,15,-1],[19,10,-31,-7],[10,10,-31,-4],
[11,21,-20,-3],[32,28,1,-1],[34,42,1,-2],[27,28,1,-2],[34,42,1,-2],[29,28,1,-1],[24,42,0,-2],[32,39,12,-1],
[35,41,0,-2],[15,41,0,-2],[20,53,12,4],[33,41,0,-2],[16,41,0,-2],[54,27,0,-2],[35,27,0,-2],[31,28,1,-1],
[34,39,12,-2],[34,39,12,-2],[24,27,0,-2],[23,28,1,-2],[22,39,1,-1],[35,28,1,-2],[34,28,1,-1],[47,28,1,-1],
[34,27,0,-1],[34,39,12,-1],[27,27,0,-1],[34,3,-15],[68,3,-15],[21,12,-30,-8],[23,7,-34,-5],[22,9,-32,-6],
[25,110,195,280,364,449,534,619,
704,789,874,959,1043,1128,1213,1298],[77,149,220,292,363,434,506,577],[1390,625]]});
org.mathdox.formulaeditor.MathCanvas.addFont(50,
{cmex10:[[6,9,8,3],[3,9,8],[2,10,9,-1],[2,10,9],[2,10,9,-1],[2,10,9],[2,9,8,-1],[2,9,8],
[2,9,8,-1],[2,9,8,-1],[3,9,8],[3,9,8],[1,5,5,-1],[2,5,5,-1],[4,9,8],[4,9,8],
[7,14,13,3],[3,14,13],[4,18,17,-1],[4,18,17],[3,18,17,-1],[2,18,17],[3,18,17,-1],[3,18,17],
[3,18,17,-1],[3,18,17],[4,18,17,-1],[4,18,17,-1],[4,18,17,-1],[5,18,17],[7,18,17],[7,18,17],
[9,22,21,3],[4,22,21],[3,22,21,-1],[3,22,21],[4,22,21,-1],[3,22,21],[4,22,21,-1],[3,22,21],
[4,22,21,-1],[4,22,21,-1],[4,22,21,-1],[5,22,21],[9,22,21],[9,22,21],[6,14,13],[6,14,13],
[9,14,13,3],[5,14,13],[3,14,13,-2],[3,14,13],[3,14,13,-2],[3,14,13],[1,5,5,-2],[2,5,5,-1],
[3,7,7,-2],[3,7,7,-1],[3,7,7,-2],[3,7,7,-1],[3,13,13,-1],[3,13,13,-2],[2,3,3,-2],[1,5,5,-2],
[9,14,13,3],[5,14,13],[1,5,5,-2],[2,5,5,-3],[4,14,13],[4,14,13],[6,7,7],[8,10,10],
[5,8,8],[7,16,16],[8,7,7],[11,10,10],[11,7,7,3],[11,10,10],[11,7,7,3],[11,10,10],
[10,8,7,3],[7,7,7],[5,8,8],[6,7,7],[6,7,7],[6,7,7],[6,7,7],[6,7,7],
[10,10,10],[9,10,10],[7,16,16],[8,10,10],[8,10,10],[8,10,10],[8,10,10],[8,10,10],
[10,8,7,3],[9,10,10],[4,1,-4],[7,2,-4],[10,2,-4],[4,1,-4],[7,2,-4],[10,2,-4],
[6,19,13,3],[2,14,13],[3,14,13,-1],[3,14,13],[3,14,13,-1],[3,14,13],[3,14,13,-1],[3,14,13,-1],
[10,9,8,3],[6,13,13,-1],[6,17,17,-1],[6,21,21,-1],[5,13,13,-1],[2,5,5,-4],[4,5,4,-4],[3,5,5,-1],
[3,5,5,-1],[4,4,4],[5,3,2,1],[4,3,2],[4,3,0],[4,3,0],[5,5,5],[5,4,4],
[3,16,28,41,53,66,78,91,
103,116,129,141,154,166,179,191],[11,42,72,103,134,165,196,226],[205,256]]});
org.mathdox.formulaeditor.MathCanvas.addFont(60,
{cmex10:[[3,10,9,-1],[3,11,10],[2,11,10,-1],[2,11,10],[3,11,10,-1],[3,10,10],[3,11,10,-1],[3,10,9],
[3,11,10,-1],[3,11,10,-1],[3,9,9],[3,11,10],[1,5,5,-1],[3,5,5,-1],[4,10,10],[4,10,9],
[4,15,14,-1],[4,15,14],[5,20,19,-1],[5,20,19],[2,20,19,-2],[3,20,19],[3,20,19,-2],[3,20,19],
[3,20,19,-2],[3,20,19],[4,20,19,-1],[4,20,19,-1],[5,20,19,-1],[5,20,19],[8,20,19],[8,20,19],
[5,25,24,-1],[5,25,24],[3,25,24,-2],[3,25,24],[3,25,24,-2],[3,25,24],[3,25,24,-2],[3,25,24],
[5,25,24,-1],[5,25,24,-1],[5,25,24,-1],[5,25,24,-1],[10,25,24],[10,25,24],[6,15,14],[6,15,14],
[5,16,15,-2],[5,16,15],[4,15,14,-2],[3,15,14],[4,16,15,-2],[3,16,15],[2,5,5,-2],[1,5,5,-2],
[3,8,8,-3],[3,8,8,-1],[3,9,8,-3],[3,9,8,-1],[3,16,15,-1],[3,16,15,-3],[1,4,3,-3],[1,5,5,-2],
[5,15,14,-2],[5,15,14],[2,5,5,-2],[2,5,5,-3],[4,15,14,-1],[4,15,14],[7,8,8],[9,12,12],
[5,9,9],[8,18,18],[9,8,8],[12,12,12],[9,8,8],[12,12,12],[9,8,8],[12,12,12],
[8,8,8],[7,8,8],[5,9,9],[7,8,8],[7,8,8],[7,8,8],[7,8,8],[7,8,8],
[11,12,12],[10,12,12],[8,18,18],[9,12,12],[9,12,12],[9,12,12],[9,12,12],[9,12,12],
[7,8,8],[10,12,12],[5,2,-4],[8,2,-4],[12,3,-4],[5,1,-5],[8,1,-5],[12,1,-5],
[3,16,15,-1],[2,16,15],[3,15,15,-1],[3,16,15],[3,15,14,-1],[3,15,14],[4,15,14,-1],[4,15,14,-1],
[7,10,10,-1],[7,14,14,-1],[7,19,19,-1],[7,24,24,-1],[5,15,15,-1],[1,5,5,-5],[4,6,5,-5],[3,5,5,-2],
[4,5,5,-1],[4,5,5,-1],[5,3,2,1],[5,3,2,1],[5,3,0,1],[5,3,0,1],[6,5,5],[6,5,5],
[4,19,34,49,64,79,94,109,
124,139,154,169,184,199,215,230],[13,50,87,124,161,198,235,272],[246,308]]});
org.mathdox.formulaeditor.MathCanvas.addFont(70,
{cmex10:[[3,13,12,-1],[3,13,12],[2,13,12,-2],[3,13,12],[3,13,12,-2],[3,13,12],[3,13,12,-2],[3,13,12],
[4,13,12,-1],[4,13,12,-1],[3,13,12,-1],[4,13,12],[1,8,7,-1],[4,8,7,-1],[6,13,12],[6,13,12],
[5,19,18,-1],[5,19,18],[5,25,24,-2],[6,25,24],[4,25,24,-2],[3,25,24],[4,25,24,-2],[4,25,24],
[4,25,24,-2],[4,25,24],[6,25,24,-1],[6,25,24,-1],[6,25,24,-1],[6,25,24,-1],[10,25,24],[10,25,24],
[6,31,30,-2],[6,31,30],[4,31,30,-2],[4,31,30],[5,31,30,-2],[4,31,30],[5,31,30,-2],[4,31,30],
[6,31,30,-1],[6,31,30,-1],[6,31,30,-1],[6,31,30,-1],[13,31,30],[13,31,30],[8,19,18],[8,19,18],
[7,19,18,-2],[6,19,18],[4,19,18,-3],[4,19,18],[4,19,18,-3],[4,19,18],[1,6,6,-3],[2,6,6,-2],
[5,10,10,-3],[4,10,10,-1],[5,10,9,-3],[4,10,9,-1],[4,20,19,-1],[4,20,19,-3],[2,5,4,-3],[1,6,6,-3],
[7,19,18,-2],[6,19,18],[2,8,7,-2],[2,8,7,-4],[5,19,18,-1],[4,19,18,-1],[8,10,10],[11,14,14],
[6,12,12],[10,23,23],[11,10,10],[15,14,14],[14,10,10,3],[15,14,14],[14,10,10,3],[15,14,14],
[10,10,10],[9,10,10],[6,12,12],[8,10,10],[8,10,10],[8,10,10],[8,10,10],[8,10,10],
[14,14,14],[13,14,14],[10,23,23],[11,14,14],[11,14,14],[11,14,14],[11,14,14],[11,14,14],
[9,10,10],[13,14,14],[6,3,-5],[10,3,-5],[15,3,-5],[9,3,-5,3],[10,2,-6],[15,2,-6],
[3,19,18,-2],[3,19,18],[3,19,18,-2],[3,19,18],[3,19,18,-2],[3,19,18],[5,19,18,-1],[5,19,18,-1],
[10,13,12,-1],[10,19,18,-1],[10,25,24,-1],[10,31,30,-1],[7,19,18,-1],[1,7,6,-7],[4,7,6,-7],[4,6,6,-2],
[5,6,6,-1],[5,6,6,-1],[6,4,2,1],[6,5,3,1],[6,4,0,1],[6,4,0,1],[8,6,6],[8,6,6],
[4,22,39,57,75,92,110,127,
145,162,180,198,215,233,250,268],[15,58,101,145,188,231,274,317],[287,359]]});
org.mathdox.formulaeditor.MathCanvas.addFont(85,
{cmex10:[[4,15,14,-1],[4,15,14],[3,15,14,-2],[3,15,14],[4,15,14,-2],[4,15,14],[4,15,14,-2],[4,15,14],
[5,15,14,-1],[5,15,14,-1],[4,15,14,-1],[4,15,14,-1],[2,8,8,-1],[4,9,8,-1],[7,15,14],[7,15,14],
[5,22,21,-2],[5,22,21],[7,30,29,-2],[7,30,29],[4,30,29,-3],[4,30,29],[4,30,29,-3],[4,30,29],
[4,30,29,-3],[4,30,29],[7,30,29,-1],[7,30,29,-1],[7,30,29,-1],[7,30,29,-1],[12,30,29],[12,30,29],
[7,37,36,-2],[7,37,36],[4,37,36,-3],[4,37,36],[5,37,36,-3],[5,37,36],[5,37,36,-3],[5,37,36],
[7,37,36,-1],[7,37,36,-1],[8,37,36,-1],[7,37,36,-1],[15,37,36],[15,37,36],[9,22,21],[9,22,21],
[7,23,22,-3],[7,23,22],[5,23,22,-3],[5,23,22],[5,23,22,-3],[5,23,22],[2,8,8,-3],[2,8,8,-3],
[5,11,11,-4],[4,11,11,-2],[5,12,11,-4],[4,12,11,-2],[4,23,22,-2],[5,23,22,-4],[2,5,4,-4],[2,7,7,-3],
[7,22,21,-3],[7,22,21],[2,9,8,-3],[2,9,8,-5],[6,22,21,-1],[5,22,21,-1],[10,12,12],[13,17,17],
[8,14,14],[12,27,27],[13,12,12],[18,17,17],[13,12,12],[18,17,17],[13,12,12],[18,17,17],
[12,12,12],[11,12,12],[8,14,14],[10,12,12],[10,12,12],[10,12,12],[10,12,12],[10,12,12],
[17,17,17],[15,17,17],[12,27,27],[13,17,17],[13,17,17],[13,17,17],[13,17,17],[13,17,17],
[11,12,12],[15,17,17],[7,3,-6],[12,3,-7],[18,3,-7],[7,2,-7],[12,2,-7],[18,2,-7],
[4,23,22,-2],[3,23,22],[4,23,22,-2],[4,23,22],[4,22,21,-2],[4,23,22],[6,22,21,-1],[6,22,21,-1],
[12,15,14,-1],[12,22,21,-1],[12,30,29,-1],[12,37,36,-1],[8,23,22,-1],[1,9,8,-8],[5,8,7,-8],[4,8,8,-3],
[6,7,7,-1],[6,7,7,-1],[7,5,3,1],[7,5,3,1],[7,4,0,1],[7,4,0,1],[9,8,8],[9,7,7],
[5,27,48,69,91,112,133,155,
176,197,219,240,261,283,304,325],[19,72,124,177,229,281,334,386],[349,437]]});
org.mathdox.formulaeditor.MathCanvas.addFont(100,
{cmex10:[[4,18,17,-2],[5,18,17],[4,18,17,-2],[3,18,17],[5,18,17,-2],[4,18,17],[5,18,17,-2],[4,18,17],
[6,18,17,-1],[6,18,17,-1],[5,18,17,-1],[5,18,17,-1],[1,10,9,-2],[4,10,9,-2],[8,18,17],[8,17,16],
[6,26,25,-2],[6,26,25],[8,34,33,-2],[8,34,33],[5,34,33,-3],[4,34,33],[5,34,33,-3],[5,34,33],
[5,34,33,-3],[5,34,33],[8,34,33,-1],[8,34,33,-1],[8,34,33,-1],[8,34,33,-1],[14,34,33],[14,34,33],
[8,43,42,-3],[8,43,42],[5,43,42,-3],[5,43,42],[6,43,42,-3],[6,43,42],[6,43,42,-3],[6,43,42],
[8,43,42,-2],[8,43,42,-2],[8,43,42,-2],[9,43,42,-1],[17,43,42],[17,43,42],[11,26,25],[11,26,25],
[8,26,25,-4],[9,26,25],[6,26,25,-4],[5,26,25],[6,26,25,-4],[5,26,25],[2,9,9,-4],[2,9,9,-3],
[5,13,13,-5],[6,13,13,-2],[5,14,13,-5],[6,14,13,-2],[6,27,26,-2],[5,27,26,-5],[3,6,5,-5],[1,9,9,-4],
[8,26,25,-4],[9,26,25],[2,10,9,-4],[3,10,9,-6],[7,26,25,-1],[6,26,25,-1],[11,14,14],[15,20,20],
[9,16,16],[14,31,31],[15,14,14],[21,20,20],[15,14,14],[21,20,20],[15,14,14],[21,20,20],
[14,14,14],[13,14,14],[9,16,16],[11,14,14],[11,14,14],[11,14,14],[11,14,14],[11,14,14],
[20,20,20],[18,20,20],[14,31,31],[15,20,20],[15,20,20],[15,20,20],[15,20,20],[15,20,20],
[13,14,14],[18,20,20],[8,3,-8],[14,3,-8],[21,3,-8],[8,3,-8],[14,3,-8],[20,3,-8],
[4,26,25,-3],[4,26,25],[5,26,25,-3],[5,26,25],[5,26,25,-3],[5,26,25],[7,26,25,-1],[7,26,25,-1],
[14,18,17,-1],[14,26,25,-1],[14,34,33,-1],[14,43,42,-1],[10,26,25,-1],[2,10,9,-9],[6,9,8,-9],[5,9,9,-3],
[7,9,9,-1],[7,9,9,-1],[8,5,3,1],[8,5,3,1],[8,5,0,1],[8,5,0,1],[11,9,9],[11,9,9],
[6,31,56,82,107,132,157,182,
207,232,257,282,307,332,358,383],[23,84,146,208,269,331,392,454],[410,514]]});
org.mathdox.formulaeditor.MathCanvas.addFont(120,
{cmex10:[[5,21,20,-2],[6,21,20],[4,21,20,-3],[4,21,20],[5,21,20,-3],[5,21,20],[5,21,20,-3],[5,21,20],
[6,21,20,-2],[6,21,20,-2],[6,21,20,-1],[6,21,20,-1],[2,12,11,-2],[5,12,11,-2],[8,21,20,-1],[8,21,20,-1],
[7,31,30,-3],[8,31,30],[9,42,41,-3],[9,41,40],[5,42,41,-4],[5,42,41],[6,42,41,-4],[6,42,41],
[6,42,41,-4],[6,42,41],[9,41,40,-2],[9,42,41,-2],[9,41,40,-2],[10,41,40,-1],[16,41,40,-1],[16,41,40,-1],
[9,52,51,-4],[10,52,51],[6,52,51,-4],[6,52,51],[7,52,51,-4],[7,52,51],[7,52,51,-4],[7,52,51],
[10,52,51,-2],[10,52,51,-2],[10,52,51,-2],[11,52,51,-1],[20,52,51,-1],[20,52,51,-1],[12,31,30,-1],[12,31,30,-1],
[10,32,31,-5],[10,32,31],[7,31,30,-5],[6,31,30],[7,31,30,-5],[6,31,30],[2,11,11,-5],[2,11,11,-4],
[7,16,16,-6],[7,16,16,-2],[7,17,16,-6],[6,17,16,-3],[7,32,31,-2],[7,32,31,-6],[3,7,6,-6],[1,11,11,-5],
[10,31,30,-5],[10,31,30],[2,12,11,-5],[2,12,11,-8],[7,31,30,-2],[8,31,30,-1],[13,17,17,-1],[17,24,24,-1],
[10,19,19,-1],[15,38,38,-1],[17,17,17,-1],[24,24,24,-1],[17,17,17,-1],[24,24,24,-1],[17,17,17,-1],[24,24,24,-1],
[16,17,17,-1],[14,17,17,-1],[10,19,19,-1],[13,17,17,-1],[13,17,17,-1],[13,17,17,-1],[13,17,17,-1],[13,17,17,-1],
[23,24,24,-1],[20,24,24,-1],[15,38,38,-1],[17,24,24,-1],[17,24,24,-1],[17,24,24,-1],[17,24,24,-1],[17,24,24,-1],
[14,17,17,-1],[20,24,24,-1],[10,4,-9],[17,4,-9],[25,4,-9],[10,3,-10],[17,3,-10],[25,3,-10],
[5,31,30,-3],[5,31,30],[6,31,30,-3],[6,31,30],[6,31,30,-3],[6,31,30],[8,31,30,-2],[8,31,30,-2],
[16,21,20,-2],[16,31,30,-2],[16,42,41,-2],[16,52,51,-2],[11,32,31,-2],[2,12,11,-11],[8,11,10,-11],[5,11,11,-4],
[9,11,11,-1],[8,10,10,-2],[9,6,4,1],[9,6,4,1],[9,6,0,1],[9,6,0,1],[12,11,11,-1],[12,10,10,-1],
[7,38,68,98,128,158,188,218,
248,278,309,339,369,399,429,459],[26,100,174,248,322,396,470,544],[492,616]]});
org.mathdox.formulaeditor.MathCanvas.addFont(144,
{cmex10:[[6,24,23,-3],[6,24,23,-1],[4,25,24,-4],[5,25,24],[5,25,24,-4],[6,25,24],[5,25,24,-4],[6,25,24],
[8,25,24,-2],[8,25,24,-2],[6,25,24,-2],[7,24,23,-1],[2,14,13,-2],[7,14,13,-2],[10,25,24,-1],[10,24,23,-1],
[9,37,36,-3],[9,37,36],[10,49,48,-4],[11,49,48],[6,49,48,-5],[6,49,48],[7,49,48,-5],[7,49,48],
[7,49,48,-5],[7,49,48],[11,49,48,-2],[11,49,48,-2],[11,49,48,-2],[11,49,48,-2],[19,49,48,-1],[19,49,48,-1],
[11,61,60,-4],[12,61,60],[7,61,60,-5],[7,61,60],[8,61,60,-5],[8,61,60],[8,61,60,-5],[8,61,60],
[12,61,60,-2],[12,61,60,-2],[12,61,60,-2],[12,61,60,-2],[24,61,60,-1],[24,61,60,-1],[14,37,36,-1],[14,37,36,-1],
[12,37,36,-5],[12,37,36],[8,37,36,-6],[7,37,36],[8,37,36,-6],[7,37,36],[2,12,12,-6],[2,12,12,-5],
[8,19,19,-7],[8,19,19,-3],[8,19,18,-7],[8,19,18,-3],[8,38,37,-3],[8,38,37,-7],[4,8,7,-7],[2,12,12,-6],
[12,37,36,-5],[12,37,36],[3,14,13,-5],[3,14,13,-9],[9,36,35,-2],[9,37,36,-1],[15,20,20,-1],[21,28,28,-1],
[12,23,23,-1],[18,45,45,-1],[20,20,20,-1],[28,28,28,-1],[20,20,20,-1],[28,28,28,-1],[20,20,20,-1],[28,28,28,-1],
[19,20,20,-1],[17,20,20,-1],[12,23,23,-1],[15,20,20,-1],[15,20,20,-1],[15,20,20,-1],[15,20,20,-1],[15,20,20,-1],
[27,28,28,-1],[24,28,28,-1],[18,45,45,-1],[21,28,28,-1],[21,28,28,-1],[21,28,28,-1],[20,28,28,-1],[20,28,28,-1],
[17,20,20,-1],[24,28,28,-1],[12,4,-11],[20,5,-11],[29,5,-11],[11,3,-12],[20,3,-12],[29,3,-12],
[5,37,36,-4],[5,37,36],[7,37,36,-4],[6,37,36],[7,37,36,-4],[6,37,36],[9,37,36,-2],[9,37,36,-2],
[19,25,24,-2],[19,37,36,-2],[19,49,48,-2],[19,61,60,-2],[13,37,36,-2],[1,14,13,-14],[8,13,12,-14],[6,12,12,-5],
[9,12,12,-2],[9,12,12,-2],[11,8,5,1],[11,8,5,1],[11,7,0,1],[11,7,0,1],[14,12,12,-1],[14,12,12,-1],
[9,45,81,117,154,190,226,262,
298,334,370,406,443,479,515,551],[31,120,209,297,386,475,564,652],[591,739]]});
org.mathdox.formulaeditor.MathCanvas.addFont(173,
{cmex10:[[7,29,28,-3],[7,29,28,-1],[6,29,28,-4],[6,29,28],[7,29,28,-4],[7,29,28],[7,29,28,-4],[7,29,28],
[10,29,28,-2],[10,29,28,-2],[8,29,28,-2],[8,29,28,-1],[2,16,15,-3],[7,16,15,-3],[12,29,28,-1],[12,29,28,-1],
[10,44,43,-4],[9,44,43,-1],[12,58,57,-5],[12,58,57,-1],[7,58,57,-6],[7,58,57],[8,58,57,-6],[8,58,57],
[8,58,57,-6],[8,58,57],[12,58,57,-3],[12,58,57,-3],[13,58,57,-3],[13,58,57,-2],[23,58,57,-1],[23,58,57,-1],
[14,72,71,-5],[14,72,71],[8,72,71,-6],[8,72,71],[9,72,71,-6],[9,72,71],[9,72,71,-6],[9,72,71],
[13,72,71,-3],[13,72,71,-3],[14,72,71,-3],[14,72,71,-2],[29,72,71,-1],[29,72,71,-1],[17,44,43,-1],[17,44,43,-1],
[14,44,43,-7],[14,44,43],[9,44,43,-7],[9,44,43],[9,44,43,-7],[9,44,43],[3,15,15,-7],[3,15,15,-6],
[9,22,22,-9],[9,22,22,-4],[9,23,22,-9],[9,23,22,-4],[9,45,44,-4],[9,45,44,-9],[4,9,8,-9],[2,15,15,-7],
[13,45,43,-7],[14,45,43],[3,16,15,-7],[3,16,15,-11],[11,44,43,-2],[10,44,43,-2],[18,24,24,-1],[25,34,34,-1],
[14,27,27,-1],[22,54,54,-1],[25,24,24,-1],[34,34,34,-1],[25,24,24,-1],[34,34,34,-1],[25,24,24,-1],[34,34,34,-1],
[23,24,24,-1],[21,24,24,-1],[14,27,27,-1],[18,24,24,-1],[18,24,24,-1],[18,24,24,-1],[18,24,24,-1],[18,24,24,-1],
[33,34,34,-1],[29,34,34,-1],[22,54,54,-1],[25,34,34,-1],[25,34,34,-1],[25,34,34,-1],[25,34,34,-1],[25,34,34,-1],
[21,24,24,-1],[29,34,34,-1],[14,5,-13],[24,6,-13],[35,6,-13],[14,4,-14],[24,3,-15],[35,3,-15],
[6,44,43,-5],[6,44,43],[8,44,43,-5],[8,44,43],[8,44,43,-5],[8,44,43],[12,44,43,-2],[12,44,43,-2],
[23,29,28,-2],[23,44,43,-2],[23,58,57,-2],[23,72,71,-2],[16,45,44,-2],[2,16,15,-16],[10,15,14,-16],[7,15,15,-6],
[12,15,15,-2],[12,15,15,-2],[12,9,6,1],[13,9,6,1],[12,8,0,1],[13,8,0,1],[17,15,15,-1],[17,15,15,-1],
[11,54,98,141,184,228,271,315,
358,401,445,488,532,575,619,662],[39,145,252,358,465,571,678,785],[709,888]]});
org.mathdox.formulaeditor.MathCanvas.addFont(207,
{cmex10:[[8,36,34,-4],[8,36,34,-1],[7,36,34,-5],[7,36,34],[8,36,34,-5],[8,36,34],[8,36,34,-5],[8,36,34],
[11,36,34,-3],[11,36,34,-3],[10,36,34,-2],[9,36,34,-2],[2,19,18,-4],[8,19,18,-4],[14,36,34,-1],[14,36,34,-1],
[12,53,51,-5],[11,53,51,-1],[15,71,69,-6],[15,71,69,-1],[8,71,69,-7],[8,71,69],[10,71,69,-7],[10,71,69],
[10,71,69,-7],[10,71,69],[15,71,69,-3],[15,71,69,-3],[16,71,69,-3],[16,71,69,-2],[28,71,69,-1],[28,71,69,-1],
[16,88,86,-6],[16,88,86,-1],[9,88,86,-8],[9,88,86],[11,88,86,-8],[11,88,86],[11,88,86,-8],[11,88,86],
[16,88,86,-4],[16,88,86,-4],[17,88,86,-4],[17,88,86,-3],[35,88,86,-1],[35,88,86,-1],[21,53,51,-1],[21,53,51,-1],
[17,54,52,-8],[16,54,52,-1],[11,53,51,-9],[10,53,51],[11,53,51,-9],[10,53,51],[3,18,18,-9],[3,18,18,-7],
[10,27,27,-11],[10,27,27,-5],[10,27,26,-11],[10,28,27,-5],[10,54,53,-5],[10,54,53,-11],[4,10,9,-11],[2,18,18,-9],
[17,53,51,-8],[16,53,51,-1],[4,19,18,-8],[4,19,18,-13],[13,53,51,-3],[13,53,51,-2],[22,29,29,-1],[30,41,41,-1],
[17,33,33,-1],[27,65,65,-1],[30,29,29,-1],[42,41,41,-1],[30,29,29,-1],[42,41,41,-1],[30,29,29,-1],[42,41,41,-1],
[28,29,29,-1],[25,29,29,-1],[17,33,33,-1],[22,29,29,-1],[22,29,29,-1],[22,29,29,-1],[22,29,29,-1],[22,29,29,-1],
[40,41,41,-1],[35,41,41,-1],[27,65,65,-1],[30,41,41,-1],[30,41,41,-1],[30,41,41,-1],[30,41,41,-1],[30,41,41,-1],
[25,29,29,-1],[35,41,41,-1],[17,6,-16],[29,7,-16],[42,7,-16],[16,4,-17],[29,4,-18],[42,4,-18],
[8,53,51,-6],[8,53,51],[9,53,51,-6],[9,53,51],[9,53,51,-6],[9,53,51],[13,53,51,-3],[13,53,51,-3],
[27,35,34,-3],[27,52,51,-3],[27,70,69,-3],[27,87,86,-3],[19,54,53,-3],[2,19,18,-20],[12,19,17,-20],[9,18,18,-7],
[14,18,18,-3],[14,18,18,-3],[15,11,7,1],[15,11,7,1],[15,10,0,1],[15,10,0,1],[20,18,18,-1],[20,18,18,-1],
[13,65,117,169,221,273,325,377,
428,480,532,584,636,688,740,792],[45,173,300,428,555,683,810,938],[849,1062]]});
org.mathdox.formulaeditor.MathCanvas.addFont(249,
{cmex10:[[9,42,40,-5],[10,42,40,-1],[8,42,40,-6],[8,42,40],[10,42,40,-6],[10,42,40],[10,42,40,-6],[10,42,40],
[12,42,40,-4],[12,42,40,-4],[11,42,40,-3],[11,42,40,-2],[3,22,21,-4],[10,22,21,-4],[16,42,40,-2],[16,42,40,-2],
[13,62,60,-6],[14,62,60,-1],[17,83,81,-7],[17,83,81,-1],[10,83,81,-8],[10,83,81],[12,83,81,-8],[12,83,81],
[12,83,81,-8],[12,83,81],[17,83,81,-4],[17,83,81,-4],[19,83,81,-4],[19,83,81,-3],[32,83,81,-2],[32,83,81,-2],
[18,103,101,-8],[18,103,101,-1],[11,103,101,-9],[11,103,101],[13,103,101,-9],[13,103,101],[13,103,101,-9],[13,103,101],
[19,103,101,-4],[19,103,101,-4],[20,103,101,-4],[20,103,101,-3],[40,103,101,-2],[40,103,101,-2],[24,62,60,-2],[24,62,60,-2],
[20,63,61,-9],[19,63,61,-1],[12,62,60,-11],[12,62,60],[12,62,60,-11],[12,62,60],[3,21,21,-11],[3,21,21,-9],
[12,31,31,-13],[13,31,31,-5],[12,32,31,-13],[13,32,31,-5],[13,63,62,-5],[12,63,62,-13],[5,12,11,-13],[3,21,21,-10],
[20,62,60,-9],[19,62,60,-1],[5,22,21,-9],[4,22,21,-16],[15,62,60,-3],[14,62,60,-3],[26,34,34,-1],[35,48,48,-1],
[19,38,38,-2],[31,76,76,-1],[35,34,34,-1],[49,48,48,-1],[35,34,34,-1],[49,48,48,-1],[35,34,34,-1],[49,48,48,-1],
[33,34,34,-1],[30,34,34,-1],[19,38,38,-2],[26,34,34,-1],[26,34,34,-1],[26,34,34,-1],[25,34,34,-2],[25,34,34,-2],
[46,48,48,-1],[41,48,48,-1],[31,76,76,-1],[35,48,48,-1],[35,48,48,-1],[35,48,48,-1],[34,48,48,-2],[35,48,48,-1],
[30,34,34,-1],[41,48,48,-1],[19,7,-19],[34,8,-19],[49,8,-19],[19,5,-20],[34,5,-21],[49,5,-21],
[9,62,60,-7],[9,62,60],[11,62,60,-7],[11,62,60],[11,62,60,-7],[11,62,60],[15,62,60,-4],[15,62,60,-4],
[32,42,40,-3],[32,62,60,-3],[32,83,81,-3],[32,103,101,-3],[23,63,62,-3],[3,22,21,-23],[14,22,20,-23],[10,21,21,-8],
[16,21,21,-3],[16,21,21,-3],[17,13,8,1],[18,13,8,1],[17,12,0,1],[18,12,0,1],[24,21,21,-1],[24,21,21,-1],
[16,78,141,203,265,328,390,453,
515,578,640,703,765,828,890,953],[55,209,362,515,669,822,976,1129],[1021,1278]]});
org.mathdox.formulaeditor.MathCanvas.addFont(298,
{cmex10:[[11,50,48,-6],[12,50,48,-1],[9,50,48,-8],[9,50,48],[11,50,48,-8],[11,50,48],[11,50,48,-8],[11,50,48],
[16,50,48,-4],[16,50,48,-4],[12,50,48,-4],[13,50,48,-3],[3,27,26,-5],[12,27,26,-5],[20,50,48,-2],[20,50,48,-2],
[16,75,73,-7],[17,75,73,-1],[21,99,97,-8],[21,99,97,-1],[11,99,97,-10],[12,99,97],[14,99,97,-10],[14,99,97],
[14,99,97,-10],[14,99,97],[21,99,97,-5],[21,99,97,-5],[22,99,97,-5],[22,99,97,-4],[39,99,97,-2],[39,99,97,-2],
[22,124,122,-9],[22,124,122,-1],[13,124,122,-11],[13,124,122],[15,124,122,-11],[15,124,122],[15,124,122,-11],[15,124,122],
[23,124,122,-5],[23,124,122,-5],[24,124,122,-5],[24,124,122,-4],[48,124,122,-2],[48,124,122,-2],[29,75,73,-2],[29,74,72,-2],
[24,75,73,-11],[23,75,73,-1],[14,75,73,-13],[14,75,73],[14,75,73,-13],[14,75,73],[4,25,25,-13],[3,25,25,-11],
[15,38,38,-15],[14,38,38,-7],[15,38,37,-15],[14,38,37,-7],[14,76,75,-7],[15,76,75,-15],[6,14,13,-15],[3,25,25,-12],
[24,75,73,-11],[23,75,73,-1],[6,26,25,-11],[5,26,25,-19],[18,75,73,-4],[18,75,73,-3],[30,41,41,-2],[42,58,58,-2],
[23,46,46,-2],[37,92,92,-2],[42,41,41,-2],[58,58,58,-2],[42,41,41,-2],[58,58,58,-2],[42,41,41,-2],[58,58,58,-2],
[39,41,41,-2],[35,41,41,-2],[23,46,46,-2],[30,41,41,-2],[30,41,41,-2],[30,41,41,-2],[30,41,41,-2],[30,41,41,-2],
[55,58,58,-2],[49,58,58,-2],[37,92,92,-2],[42,58,58,-2],[42,58,58,-2],[42,58,58,-2],[42,58,58,-2],[42,58,58,-2],
[35,41,41,-2],[49,58,58,-2],[23,8,-23],[41,9,-23],[60,9,-23],[23,6,-24],[41,6,-25],[59,6,-25],
[10,75,73,-9],[10,75,73],[12,75,73,-9],[13,75,73],[12,75,73,-9],[13,75,73],[19,75,73,-4],[19,75,73,-4],
[38,50,48,-4],[38,75,73,-4],[38,99,97,-4],[38,124,122,-4],[27,75,74,-4],[3,27,26,-28],[16,26,24,-28],[12,25,25,-10],
[19,25,25,-4],[19,25,25,-4],[20,14,9,1],[21,14,9,1],[20,14,0,1],[21,14,0,1],[28,25,25,-2],[28,25,25,-2],
[19,93,168,243,318,392,467,542,
617,692,766,841,916,991,1066,1140],[66,249,433,617,800,984,1167,1351],[1222,1530]]});
org.mathdox.formulaeditor.MathCanvas.addFont(358,
{cmex10:[[14,59,57,-7],[13,59,57,-2],[11,59,57,-9],[10,59,57,-1],[13,59,57,-9],[13,59,57,-1],[13,59,57,-9],[13,59,57,-1],
[18,59,57,-5],[18,59,57,-5],[16,59,57,-4],[16,59,57,-3],[3,32,31,-7],[14,32,31,-7],[24,59,57,-2],[24,59,57,-2],
[20,89,87,-8],[20,89,87,-1],[25,118,116,-10],[25,118,116,-1],[14,118,116,-12],[14,118,116],[16,118,116,-12],[17,118,116],
[16,118,116,-12],[17,118,116],[25,118,116,-6],[25,118,116,-6],[26,118,116,-6],[27,118,116,-4],[47,118,116,-2],[47,118,116,-2],
[26,147,145,-11],[27,147,145,-1],[15,147,145,-13],[15,147,145],[18,147,145,-13],[18,147,145],[18,147,145,-13],[18,147,145],
[26,147,145,-7],[26,147,145,-7],[29,147,145,-6],[28,147,145,-5],[58,147,145,-2],[58,147,145,-2],[35,89,87,-2],[35,89,87,-2],
[28,89,87,-14],[28,89,87,-1],[17,89,87,-16],[17,89,87],[17,89,87,-16],[17,89,87],[4,30,30,-16],[4,30,30,-13],
[18,45,45,-18],[17,45,45,-8],[18,45,44,-18],[17,45,44,-8],[17,90,89,-8],[18,90,89,-18],[7,17,16,-18],[3,30,30,-15],
[28,90,87,-14],[28,90,87,-1],[6,31,30,-14],[6,31,30,-23],[21,89,87,-5],[21,89,87,-4],[36,49,49,-2],[50,69,69,-2],
[28,55,55,-2],[45,109,109,-2],[50,49,49,-2],[70,69,69,-2],[50,49,49,-2],[70,69,69,-2],[50,49,49,-2],[70,69,69,-2],
[47,49,49,-2],[42,49,49,-2],[28,55,55,-2],[36,49,49,-2],[36,49,49,-2],[36,49,49,-2],[36,49,49,-2],[36,49,49,-2],
[66,69,69,-2],[58,69,69,-2],[45,109,109,-2],[50,69,69,-2],[50,69,69,-2],[50,69,69,-2],[50,69,69,-2],[50,69,69,-2],
[42,49,49,-2],[58,69,69,-2],[29,10,-27,1],[49,10,-28],[71,10,-28],[27,7,-29],[49,7,-30],[71,7,-30],
[12,89,87,-11],[12,89,87],[14,89,87,-11],[15,89,87],[14,89,87,-11],[15,89,87],[22,89,87,-5],[22,89,87,-5],
[45,59,57,-5],[45,89,87,-5],[45,118,116,-5],[45,147,145,-5],[32,90,89,-5],[3,32,31,-34],[19,31,29,-34],[14,30,30,-12],
[23,30,30,-5],[23,30,30,-5],[25,17,11,2],[25,17,11,1],[25,17,0,2],[25,17,0,1],[34,30,30,-2],[34,29,29,-2],
[22,112,202,292,382,472,561,651,
741,831,921,1011,1100,1190,1280,1370],[78,298,519,740,960,1181,1401,1622],[1468,1836]]});
org.mathdox.formulaeditor.MathCanvas.addFont(430,
{cmex10:[[16,72,69,-9],[16,72,69,-2],[13,72,69,-11],[12,72,69,-1],[16,72,69,-11],[15,72,69,-1],[16,72,69,-11],[15,72,69,-1],
[22,72,69,-6],[22,72,69,-6],[19,72,69,-5],[18,72,69,-4],[4,39,37,-8],[17,39,37,-8],[28,72,69,-3],[28,72,69,-3],
[23,107,104,-10],[23,107,104,-2],[30,143,140,-12],[30,143,140,-2],[17,143,140,-14],[17,143,140],[20,143,140,-14],[20,143,140],
[20,143,140,-14],[20,143,140],[30,143,140,-7],[30,143,140,-7],[32,143,140,-7],[32,143,140,-5],[56,143,140,-3],[56,143,140,-3],
[32,178,175,-13],[31,178,175,-2],[18,178,175,-16],[19,178,175],[21,178,175,-16],[22,178,175],[21,178,175,-16],[22,178,175],
[31,178,175,-8],[31,178,175,-8],[34,178,175,-8],[34,178,175,-6],[69,178,175,-3],[69,178,175,-3],[42,107,104,-3],[42,107,104,-3],
[33,108,105,-17],[33,108,105,-2],[20,107,104,-19],[21,107,104],[20,107,104,-19],[21,107,104],[5,37,36,-19],[5,37,36,-16],
[21,54,54,-22],[20,54,54,-10],[21,54,53,-22],[20,54,53,-10],[20,108,107,-10],[21,108,107,-22],[8,20,19,-22],[3,37,36,-18],
[33,107,104,-17],[33,107,104,-2],[7,37,36,-17],[8,37,36,-27],[25,107,104,-6],[25,107,104,-5],[43,59,59,-3],[60,83,83,-3],
[33,66,66,-3],[53,132,132,-3],[60,59,59,-3],[83,83,83,-3],[60,59,59,-3],[83,83,83,-3],[60,59,59,-3],[83,83,83,-3],
[56,59,59,-3],[50,59,59,-3],[33,66,66,-3],[43,59,59,-3],[43,59,59,-3],[43,59,59,-3],[43,59,59,-3],[43,59,59,-3],
[79,83,83,-3],[69,83,83,-3],[53,132,132,-3],[60,83,83,-3],[60,83,83,-3],[60,83,83,-3],[60,83,83,-3],[60,83,83,-3],
[50,59,59,-3],[69,83,83,-3],[34,11,-33,1],[60,12,-34,1],[86,12,-34],[33,8,-35],[59,9,-36],[85,9,-36],
[14,107,104,-13],[14,107,104,-1],[17,107,104,-13],[17,107,104,-1],[17,107,104,-13],[17,107,104,-1],[26,107,104,-7],[26,107,104,-7],
[55,72,69,-6],[55,107,104,-6],[55,143,140,-6],[55,178,175,-6],[38,109,107,-6],[3,39,37,-41],[23,38,35,-41],[16,37,36,-15],
[27,36,36,-6],[27,36,36,-6],[30,21,13,2],[29,21,13,1],[30,20,0,2],[29,20,0,1],[40,36,36,-3],[40,35,35,-3],
[27,135,243,350,458,566,674,782,
890,998,1106,1213,1321,1429,1537,1645],[93,358,623,888,1153,1418,1683,1947],[1762,2205]]});
org.mathdox.formulaeditor.MathCanvas.addFont(50,
{cmmi10:[[5,5,0],[6,5,0],[6,6,1],[5,5,0],[6,5,0],[6,5,0],[6,5,0],[5,5,0],
[5,5,0],[5,5,0],[6,5,0],[5,3,0],[4,6,1],[4,5,2],[3,5,0],[3,3,0],
[4,7,2],[4,5,2],[4,5,0],[3,3,0],[4,3,0],[4,5,0],[4,5,2],[4,3,0],
[3,7,2],[4,3,0],[4,5,2],[4,3,0],[4,3,0],[4,3,0],[4,7,2],[4,5,2],
[5,7,2],[5,3,0],[3,5,1],[4,5,0],[6,3,0],[4,5,2],[3,4,1],[5,5,2],
[7,3,-1],[9,2,0,2],[7,3,-1],[9,2,0,2],[4,3,-1,2],[2,3,-1],[4,4,0],[4,4,0],
[4,5,1],[3,3,0],[4,4,0],[4,6,2],[4,6,2],[3,5,2],[4,6,1],[4,5,2],
[4,6,1],[4,6,2],[2,1,0],[2,2,1],[5,5,1],[3,7,2],[5,5,1],[4,4,0],
[4,6,1],[5,5,0],[6,5,0],[6,6,1],[6,5,0],[6,5,0],[6,5,0],[6,6,1],
[6,5,0],[4,5,0],[5,6,1],[6,5,0],[5,5,0],[7,5,0],[8,5,0,2],[6,6,1],
[6,5,0],[6,7,2],[6,6,1],[5,6,1],[5,5,0],[6,6,1],[6,5,0],[7,5,0],
[8,5,0,2],[6,5,0],[5,5,0],[3,5,0],[3,7,2],[3,7,2],[7,2,-1],[9,2,-1,2],
[3,5,0],[4,3,0],[3,5,0],[3,3,0],[4,5,0],[3,3,0],[4,7,2],[4,5,2],
[4,5,0],[2,5,0],[3,7,2],[4,5,0],[2,5,0],[6,3,0],[4,3,0],[4,3,0],
[4,5,2],[3,5,2],[3,3,0],[3,3,0],[3,5,0],[4,3,0],[4,3,0],[5,3,0],
[4,3,0],[4,5,2],[3,3,0],[2,3,0],[3,5,2],[5,5,2],[4,2,-3,-1],[3,1,-4,-2],
[3,11,19,28,36,44,53,61,
69,77,86,94,102,111,119,127],[9,17,26,34,42,51,59,67],[137,73]]});
org.mathdox.formulaeditor.MathCanvas.addFont(60,
{cmmi10:[[6,6,0],[7,6,0],[6,7,1],[6,6,0],[7,6,0],[7,6,0],[7,6,0],[6,6,0],
[5,6,0],[6,6,0],[7,6,0],[5,5,1],[5,8,2],[5,6,2],[4,6,0],[3,4,0],
[4,8,2],[4,6,2],[4,6,0],[3,4,0],[5,4,0],[5,6,0],[5,6,2],[5,4,0],
[4,8,2],[5,4,0],[4,6,2],[5,5,1],[4,4,0],[5,4,0],[5,8,2],[5,6,2],
[5,8,2],[5,4,0],[4,5,1],[5,6,0],[7,4,0],[4,6,2],[4,5,1],[5,6,2],
[8,3,-1],[8,3,0],[8,3,-1],[8,3,0],[2,3,-1],[2,3,-1],[4,4,0],[4,4,0],
[4,5,1],[3,4,0,-1],[4,4,0],[4,6,2],[4,6,2],[4,6,2],[4,7,1],[4,6,2],
[4,7,1],[4,6,2],[2,1,0],[2,3,2],[6,6,1],[4,8,2],[6,6,1],[4,4,0],
[5,7,1],[6,6,0],[6,6,0],[6,7,1],[7,6,0],[6,6,0],[6,6,0],[6,7,1],
[7,6,0],[4,6,0],[5,7,1],[7,6,0],[5,6,0],[9,6,0],[9,6,0,2],[6,7,1],
[6,6,0],[6,8,2],[6,7,1],[6,7,1],[6,6,0],[6,7,1],[6,6,0],[9,6,0],
[9,6,0,2],[6,6,0],[6,6,0],[3,6,0],[3,8,2],[3,8,2],[8,2,-1],[8,2,-1],
[4,6,0],[4,4,0],[4,6,0],[4,5,1],[4,6,0],[4,4,0],[5,8,2],[4,6,2],
[5,6,0],[3,6,0],[3,8,2],[4,6,0],[2,6,0],[7,4,0],[5,4,0],[4,5,1],
[4,6,2],[4,6,2],[4,4,0],[4,5,1],[3,5,0],[5,4,0],[4,4,0],[6,4,0],
[5,4,0],[4,6,2],[4,4,0],[3,4,0],[3,6,2],[5,6,2],[4,2,-4,-1],[4,2,-4,-2],
[3,13,23,33,43,53,63,73,
83,93,103,113,123,133,143,153],[11,21,31,41,51,61,71,81],[164,87]]});
org.mathdox.formulaeditor.MathCanvas.addFont(70,
{cmmi10:[[8,7,0],[8,7,0],[8,8,1],[7,7,0],[8,7,0],[9,7,0],[8,7,0],[7,7,0],
[7,7,0],[7,7,0],[8,7,0],[6,6,1],[6,9,2],[6,7,2],[5,8,0],[4,6,1],
[5,9,2],[5,7,2],[5,8,1],[4,6,1],[6,6,1],[6,7,0],[6,7,2],[6,5,0],
[5,9,2],[6,5,0],[5,7,2],[6,5,0],[5,5,0],[6,6,1],[6,9,2],[6,7,2],
[7,9,2],[6,6,1],[5,6,1],[6,8,1],[8,5,0],[5,7,2],[4,6,1],[7,7,2],
[10,3,-2],[12,3,0,2],[10,3,-2],[10,3,0],[5,3,-2,2],[3,3,-2],[5,5,0],[5,5,0],
[5,6,1],[3,5,0,-1],[5,5,0],[5,7,2],[5,7,2],[5,7,2],[5,8,1],[5,7,2],
[5,8,1],[5,7,2],[2,1,0],[2,3,2],[6,7,1,-1],[5,10,2],[6,7,1,-1],[5,5,0],
[6,9,1],[7,7,0],[8,7,0],[8,8,1],[8,7,0],[8,7,0],[8,7,0],[8,8,1],
[9,7,0],[5,7,0],[7,8,1],[9,7,0],[7,7,0],[11,7,0],[11,7,0,2],[8,8,1],
[8,7,0],[8,9,2],[8,8,1],[7,8,1],[7,7,0],[8,8,1],[8,8,1],[11,8,1],
[11,7,0,2],[8,7,0],[8,7,0],[4,9,1],[4,9,2],[4,9,2],[10,3,-1],[12,3,-1,2],
[4,7,0],[5,6,1],[5,8,1],[5,5,0],[6,8,1],[5,5,0],[6,9,2],[5,7,2],
[6,7,0],[3,7,0],[4,9,2],[5,7,0],[3,7,0],[9,5,0],[6,6,1],[5,5,0],
[6,7,2,1],[5,7,2],[5,5,0],[5,5,0],[4,8,1],[6,6,1],[5,6,1],[7,6,1],
[6,6,1],[5,7,2],[5,5,0],[3,5,0],[5,7,2,1],[7,7,2],[5,2,-5,-2],[5,2,-5,-2],
[4,15,27,39,50,62,74,85,
97,108,120,132,143,155,167,178],[13,24,36,47,59,71,82,94],[191,102]]});
org.mathdox.formulaeditor.MathCanvas.addFont(85,
{cmmi10:[[9,9,0],[10,9,0],[9,10,1],[8,9,0],[10,9,0],[11,9,0],[10,9,0],[9,9,0],
[8,9,0],[9,9,0],[9,9,0,-1],[8,7,1],[7,12,3],[7,9,3],[6,10,1],[5,7,1],
[6,12,3],[6,9,3],[6,9,0],[4,7,1],[7,7,1],[7,10,1],[7,9,3],[7,6,0],
[6,12,3],[7,6,0],[6,9,3],[7,7,1],[6,7,1],[7,7,1],[7,12,3],[7,9,3],
[8,12,3],[8,7,1],[5,7,1],[7,10,1],[10,7,1],[6,9,3],[5,8,2],[8,9,3],
[12,4,-2],[15,4,0,3],[15,4,-2,3],[15,4,0,3],[6,4,-2,3],[3,4,-2],[6,6,0],[6,6,0],
[6,7,1],[4,6,0,-1],[6,6,0],[6,9,3],[6,9,3],[6,9,3],[6,9,1],[6,9,3],
[6,9,1],[6,9,3],[2,2,0,-1],[2,5,3,-1],[8,8,1,-1],[6,12,3],[8,8,1,-1],[6,6,0],
[7,10,1],[9,9,0],[9,9,0],[9,10,1],[10,9,0],[10,9,0],[9,9,0],[9,10,1],
[11,9,0],[6,9,0],[8,10,1],[11,9,0],[8,9,0],[12,9,0],[14,9,0,3],[9,10,1],
[9,9,0],[9,12,3],[9,10,1],[8,10,1],[9,9,0],[9,10,1],[8,10,1,-1],[12,10,1],
[13,9,0,3],[9,9,0],[9,9,0],[4,10,1],[3,12,3,-1],[4,12,3],[12,4,-1],[15,4,-1,3],
[5,10,1],[6,7,1],[5,10,1],[6,7,1],[6,10,1],[5,7,1],[7,12,3],[6,9,3],
[7,9,0],[4,8,0],[6,11,3,1],[6,10,1],[3,10,1],[11,7,1],[7,7,1],[6,7,1],
[7,9,3,1],[6,9,3],[6,6,0],[5,7,1],[4,9,1],[7,7,1],[6,7,1],[9,7,1],
[7,7,1],[6,9,3],[6,7,1],[4,6,0],[6,9,3,1],[8,9,3],[6,3,-6,-2],[5,2,-6,-3],
[5,19,33,47,61,75,89,104,
118,132,146,160,174,188,202,216],[16,30,45,59,73,87,101,115],[232,125]]});
org.mathdox.formulaeditor.MathCanvas.addFont(100,
{cmmi10:[[10,10,0],[11,10,0],[11,11,1],[10,10,0],[11,10,0],[13,10,0],[11,10,0,-1],[10,10,0],
[9,10,0],[10,10,0],[10,10,0,-1],[9,8,1],[9,13,3],[8,10,3],[7,11,1],[6,7,1],
[7,13,3],[7,10,3],[7,11,1],[5,8,1],[8,8,1],[8,11,1],[8,9,3],[8,7,0],
[7,13,3],[8,7,1],[7,10,3],[8,7,1],[8,7,1],[8,8,1],[8,13,3],[9,10,3],
[9,13,3],[9,8,1],[6,8,1],[8,11,1],[12,7,1],[6,10,3,-1],[6,9,2],[9,10,3],
[14,4,-3],[14,4,0],[14,4,-3],[17,4,0,3],[3,4,-3],[3,4,-3],[7,7,0],[7,7,0],
[7,8,1],[5,7,0,-1],[7,7,0],[7,10,3],[7,10,3],[7,10,3],[7,11,1],[7,10,3],
[7,11,1],[7,10,3],[2,2,0,-1],[2,5,3,-1],[9,9,1,-1],[7,15,4],[9,9,1,-1],[7,7,0],
[8,11,1],[10,10,0],[11,10,0],[11,11,1],[12,10,0],[11,10,0],[11,10,0],[11,11,1],
[13,10,0],[7,10,0],[8,11,1,-1],[13,10,0],[9,10,0],[15,10,0],[16,10,0,3],[11,11,1],
[11,10,0],[11,13,3],[11,11,1],[9,11,1],[10,10,0],[10,11,1,-1],[11,11,1],[14,11,1],
[15,10,0,3],[11,10,0],[10,10,0],[5,12,1],[4,13,3,-1],[5,13,3],[12,4,-1,-1],[12,4,-2,-1],
[6,11,1],[7,8,1],[6,11,1],[6,8,1],[8,11,1],[6,8,1],[8,13,3],[7,10,3],
[8,11,1],[4,11,1],[7,13,3,1],[7,11,1],[4,11,1],[12,8,1],[8,8,1],[7,8,1],
[8,10,3,1],[7,10,3],[6,8,1],[6,8,1],[5,10,1],[8,8,1],[7,8,1],[10,8,1],
[8,8,1],[7,10,3],[7,8,1],[4,8,1],[6,10,3,1],[8,10,3,-1],[7,3,-7,-2],[6,3,-7,-3],
[6,22,39,55,72,89,105,122,
138,155,172,188,205,221,238,255],[19,36,52,69,85,102,119,135],[273,146]]});
org.mathdox.formulaeditor.MathCanvas.addFont(120,
{cmmi10:[[13,12,0],[13,13,0,-1],[13,13,1],[12,12,0],[13,12,0,-1],[15,12,0],[13,12,0,-1],[12,12,0],
[11,12,0],[12,12,0],[13,12,0,-1],[11,9,1],[10,16,4],[10,12,4],[8,14,1],[7,9,1],
[8,16,4],[9,12,4],[8,13,1],[5,9,1,-1],[9,9,1,-1],[9,13,1,-1],[10,12,4],[8,8,0,-1],
[8,16,4],[10,9,1],[9,12,4],[10,9,1],[9,9,1],[9,9,1],[10,16,4],[10,12,4],
[11,16,4],[11,9,1],[8,9,1],[10,13,1],[14,9,1],[8,12,4,-1],[7,10,2],[11,12,4],
[15,6,-3,-1],[15,6,1,-1],[15,6,-3,-1],[15,6,1,-1],[3,4,-4,-1],[3,5,-3,-1],[8,9,0],[8,9,0],
[8,9,1],[6,8,0,-1],[8,8,0],[8,12,4],[8,12,4],[8,12,4],[8,13,1],[8,12,4,-1],
[8,13,1],[8,12,4],[3,2,0,-1],[3,6,4,-1],[11,11,1,-1],[7,17,4,-1],[11,11,1,-1],[9,9,0],
[10,14,1],[13,13,0],[13,12,0],[13,13,1],[14,12,0],[13,12,0],[13,12,0],[13,13,1],
[15,12,0],[9,12,0],[10,13,1,-1],[15,12,0],[11,12,0],[18,12,0],[18,12,0,3],[13,13,1],
[13,12,0],[13,16,4],[13,13,1],[10,13,1,-1],[12,12,0],[12,13,1,-1],[12,13,1,-1],[17,13,1,-1],
[18,12,0,3],[13,12,0],[12,12,0,-1],[6,14,1],[5,17,4,-1],[5,16,4,-1],[15,5,-2,-1],[15,5,-2,-1],
[7,13,1],[9,9,1],[7,13,1],[8,9,1],[9,13,1],[8,9,1],[9,16,4,-1],[8,12,4],
[9,13,1,-1],[5,13,1],[8,16,4,1],[8,13,1,-1],[5,13,1],[15,9,1],[10,9,1],[8,9,1],
[10,12,4,1],[8,12,4],[8,9,1],[7,9,1],[6,12,1],[10,9,1],[8,9,1],[12,9,1],
[9,9,1],[9,12,4],[8,9,1],[5,9,1],[8,12,4,1],[10,12,4,-1],[8,4,-8,-3],[7,3,-9,-4],
[7,27,46,66,86,106,126,146,
166,186,206,226,246,266,286,306],[22,42,61,81,101,121,141,161],[328,175]]});
org.mathdox.formulaeditor.MathCanvas.addFont(144,
{cmmi10:[[15,14,0],[15,15,0,-1],[14,16,1,-1],[14,15,0],[15,14,0,-1],[18,14,0],[15,14,0,-1],[14,14,0],
[13,14,0],[14,14,0],[15,15,0,-1],[12,10,1],[12,18,4],[11,14,5],[9,16,1],[7,10,1,-1],
[10,19,5],[10,14,5],[10,15,1],[6,10,1,-1],[10,10,1,-1],[10,15,1,-1],[12,14,5],[10,9,0,-1],
[9,19,5],[12,10,1],[10,14,5],[12,10,1],[11,10,1],[11,10,1],[11,18,4,-1],[12,14,5],
[13,18,4],[13,10,1],[9,10,1],[12,16,1],[17,10,1],[9,13,4,-1],[9,12,3],[12,14,5,-1],
[18,7,-4,-1],[18,7,1,-1],[18,7,-4,-1],[18,7,1,-1],[4,6,-4,-1],[4,6,-4,-1],[10,10,0],[10,10,0],
[10,10,1],[7,9,0,-2],[8,9,0,-1],[10,14,5],[10,14,4],[8,14,5,-1],[10,15,1],[9,15,5,-1],
[10,15,1],[10,14,5],[3,3,0,-1],[3,7,4,-1],[13,12,1,-1],[8,20,5,-1],[13,12,1,-1],[10,10,0],
[12,16,1],[15,15,0],[16,14,0],[15,16,1,-1],[17,14,0],[16,14,0],[15,14,0],[15,16,1,-1],
[18,14,0],[10,14,0],[12,15,1,-1],[18,14,0],[13,14,0],[21,14,0],[18,14,0],[14,16,1,-1],
[15,14,0],[14,19,4,-1],[15,15,1],[12,16,1,-1],[14,14,0],[15,15,1,-1],[15,15,1,-1],[20,15,1,-1],
[17,14,0],[16,14,0],[14,14,0,-1],[6,16,1,-1],[6,20,5,-1],[6,20,5,-1],[18,6,-2,-1],[18,6,-2,-1],
[8,15,1],[10,10,1],[8,15,1,-1],[9,10,1],[11,15,1],[9,10,1],[10,19,4,-1],[10,14,5],
[10,15,1,-1],[6,15,1],[9,19,5,1],[10,15,1,-1],[6,15,1],[17,10,1],[12,10,1],[10,10,1],
[11,13,4,1],[9,13,4],[9,10,1],[8,10,1,-1],[7,14,1],[11,10,1],[10,10,1],[14,10,1],
[11,10,1],[10,14,5],[9,10,1,-1],[6,10,1],[9,14,5,1],[12,14,5,-1],[10,5,-10,-3],[8,4,-10,-5],
[8,32,56,80,104,128,151,175,
199,223,247,271,295,319,343,367],[26,50,74,98,122,145,169,193],[393,209]]});
org.mathdox.formulaeditor.MathCanvas.addFont(173,
{cmmi10:[[17,17,0,-1],[18,18,0,-1],[17,18,1,-1],[16,18,0],[18,17,0,-1],[20,17,0,-1],[19,17,0,-1],[17,17,0],
[16,17,0],[17,17,0],[18,17,0,-1],[14,12,1,-1],[15,22,5],[13,16,5],[10,18,1,-1],[8,12,1,-1],
[11,22,5,-1],[12,17,6],[10,18,1,-1],[7,12,1,-1],[12,12,1,-1],[12,18,1,-1],[14,17,6],[12,11,0,-1],
[11,22,5],[14,12,1],[12,17,6],[14,12,1],[13,12,1],[13,12,1],[13,22,5,-1],[15,16,5],
[16,22,5],[15,12,1],[11,12,1],[14,18,1],[20,12,1],[11,16,5,-1],[10,14,3],[14,17,6,-1],
[22,8,-5,-1],[22,8,1,-1],[22,8,-5,-1],[22,8,1,-1],[5,7,-5,-1],[5,7,-5,-1],[12,12,0],[12,12,0],
[10,12,1,-1],[8,11,0,-2],[10,11,0,-1],[10,17,6,-1],[12,17,5],[10,17,6,-1],[10,17,1,-1],[11,17,6,-1],
[10,17,1,-1],[10,17,6,-1],[3,3,0,-2],[3,8,5,-2],[15,14,1,-2],[10,24,6,-1],[15,14,1,-2],[12,12,0],
[13,19,1,-1],[18,18,0],[18,17,0,-1],[18,18,1,-1],[19,17,0,-1],[18,17,0,-1],[17,17,0,-1],[18,18,1,-1],
[20,17,0,-1],[12,17,0],[14,18,1,-1],[21,17,0,-1],[15,17,0,-1],[24,17,0,-1],[20,17,0,-1],[17,18,1,-1],
[18,17,0,-1],[17,22,5,-1],[17,18,1,-1],[15,18,1,-1],[17,17,0],[18,18,1,-1],[18,18,1,-1],[24,18,1,-1],
[25,17,0,4],[18,17,0,-1],[17,17,0,-1],[7,19,1,-1],[7,24,6,-1],[7,24,6,-1],[22,6,-3,-1],[22,7,-3,-1],
[10,18,1],[11,12,1,-1],[9,18,1,-1],[10,12,1,-1],[12,18,1,-1],[10,12,1,-1],[13,22,5,-1],[12,16,5],
[12,18,1,-1],[7,17,1],[11,21,5,1],[12,18,1,-1],[6,18,1,-1],[21,12,1],[14,12,1],[11,12,1,-1],
[13,16,5,1],[10,16,5,-1],[11,12,1],[9,12,1,-1],[8,16,1],[13,12,1],[12,12,1],[17,12,1],
[13,12,1],[12,16,5],[11,12,1,-1],[7,12,1],[10,16,5,1],[14,17,6,-1],[11,5,-12,-4],[10,3,-13,-6],
[10,38,67,96,124,153,182,211,
239,268,297,326,354,383,412,440],[32,61,90,118,147,176,204,233],[472,253]]});
org.mathdox.formulaeditor.MathCanvas.addFont(207,
{cmmi10:[[20,20,0,-1],[22,21,0,-1],[21,22,1,-1],[19,21,0,-1],[22,20,0,-1],[25,20,0,-1],[23,20,0,-1],[21,21,0],
[19,20,0],[20,20,0],[21,21,0,-2],[17,14,1,-1],[18,27,6],[16,20,7],[13,22,1,-1],[10,14,1,-1],
[13,27,6,-1],[15,20,7],[13,22,1,-1],[9,14,1,-1],[15,14,1,-1],[15,22,1,-1],[17,20,7],[15,13,0,-1],
[13,27,6],[17,14,1],[15,20,7],[16,14,1,-1],[15,14,1],[16,14,1],[16,26,6,-1],[17,19,6,-1],
[19,26,6],[18,14,1],[13,15,1],[17,22,1],[24,14,1],[13,19,6,-2],[12,17,4],[17,20,7,-1],
[27,9,-6,-1],[27,9,1,-1],[27,9,-6,-1],[27,9,1,-1],[6,8,-6,-1],[6,8,-6,-1],[14,16,1],[14,16,1],
[13,15,1,-1],[11,13,0,-2],[12,14,0,-1],[13,21,7,-1],[14,20,6],[12,20,7,-1],[13,21,1,-1],[13,21,7,-1],
[13,21,1,-1],[13,21,7,-1],[4,3,0,-2],[4,9,6,-2],[18,18,2,-2],[12,30,8,-1],[18,17,1,-2],[15,14,0],
[16,22,1,-1],[20,21,0,-1],[21,20,0,-1],[21,22,1,-1],[23,20,0,-1],[22,20,0,-1],[21,20,0,-1],[21,22,1,-1],
[25,20,0,-1],[14,20,0,-1],[17,21,1,-2],[25,20,0,-1],[18,20,0,-1],[30,20,0,-1],[25,20,0,-1],[21,22,1,-1],
[21,20,0,-1],[21,27,6,-1],[21,21,1,-1],[18,22,1,-1],[21,20,0],[20,21,1,-2],[22,21,1,-1],[30,21,1,-1],
[29,20,0,4],[21,20,0,-1],[20,20,0,-1],[9,23,1,-1],[7,28,7,-2],[9,28,7,-1],[27,8,-3,-1],[27,8,-3,-1],
[12,22,1],[14,14,1,-1],[11,22,1,-1],[12,14,1,-1],[14,22,1,-1],[12,14,1,-1],[15,27,6,-1],[14,19,6],
[15,22,1,-1],[9,21,1],[13,26,6,1],[14,22,1,-1],[7,22,1,-1],[25,14,1],[17,14,1],[13,14,1,-1],
[16,19,6,1],[12,19,6,-1],[13,14,1],[12,14,1,-1],[10,20,1],[16,14,1],[14,14,1],[20,14,1],
[16,14,1],[15,19,6],[13,14,1,-1],[9,14,1],[12,19,6,1],[16,20,7,-2],[13,6,-15,-5],[12,5,-15,-7],
[11,46,80,115,149,183,218,252,
286,321,355,390,424,458,493,527],[37,72,106,140,175,209,243,278],[565,301]]});
org.mathdox.formulaeditor.MathCanvas.addFont(249,
{cmmi10:[[24,24,0,-1],[26,25,0,-1],[25,25,1,-1],[22,25,0,-1],[26,23,0,-1],[29,24,0,-1],[26,24,0,-2],[23,24,0,-1],
[22,24,0],[23,24,0,-1],[25,24,0,-2],[20,16,1,-1],[20,31,7],[19,23,8],[15,26,1,-1],[12,16,1,-1],
[15,31,7,-1],[16,23,8,-1],[15,25,1,-1],[10,16,1,-1],[18,16,1,-1],[18,25,1,-1],[19,23,8,-1],[17,15,0,-1],
[16,31,7],[19,16,1,-1],[16,23,8,-1],[19,16,1,-1],[17,16,1,-1],[17,16,1,-1],[19,31,7,-1],[20,22,7,-1],
[21,31,7,-1],[21,16,1],[15,17,1],[18,25,1,-1],[27,16,1,-1],[15,22,7,-2],[13,19,4,-1],[20,23,8,-1],
[31,11,-7,-1],[31,11,1,-1],[31,11,-7,-1],[31,11,1,-1],[7,9,-7,-1],[7,9,-7,-1],[16,19,1],[16,19,1,-1],
[15,17,1,-1],[12,16,0,-3],[15,16,0,-1],[15,24,8,-1],[15,23,7,-1],[15,24,8,-1],[15,24,1,-1],[16,24,8,-1],
[15,24,1,-1],[15,24,8,-1],[4,4,0,-3],[4,11,7,-3],[22,21,2,-2],[13,35,9,-2],[22,21,2,-2],[17,17,0],
[19,26,1,-1],[24,25,0,-1],[25,24,0,-1],[25,25,1,-1],[27,24,0,-1],[25,24,0,-1],[25,24,0,-1],[25,25,1,-1],
[29,24,0,-1],[16,24,0,-1],[20,25,1,-2],[30,24,0,-1],[21,24,0,-1],[35,24,0,-1],[29,24,0,-1],[25,25,1,-1],
[25,24,0,-1],[25,31,7,-1],[25,25,1,-1],[21,25,1,-1],[24,23,0],[24,25,1,-2],[25,25,1,-2],[35,25,1,-1],
[28,24,0,-1],[25,24,0,-1],[23,24,0,-2],[11,27,1,-1],[9,33,8,-2],[11,33,8,-1],[30,9,-4,-2],[30,9,-4,-2],
[14,25,1],[16,16,1,-1],[14,25,1,-1],[14,16,1,-1],[17,25,1,-1],[14,16,1,-1],[18,31,7,-1],[17,22,7],
[18,25,1,-1],[9,24,1,-1],[15,30,7,1],[17,25,1,-1],[8,25,1,-1],[28,16,1,-1],[19,16,1,-1],[15,16,1,-1],
[18,22,7,1],[15,22,7,-1],[14,16,1,-1],[14,16,1,-1],[12,23,1],[18,16,1,-1],[15,16,1,-1],[23,16,1,-1],
[17,16,1,-1],[16,22,7,-1],[15,16,1,-1],[9,16,1,-1],[14,22,7,1],[19,24,8,-2],[16,8,-17,-6],[13,5,-18,-9],
[14,55,96,138,179,221,262,303,
345,386,427,469,510,551,593,634],[46,87,128,170,211,253,294,335],[679,363]]});
org.mathdox.formulaeditor.MathCanvas.addFont(298,
{cmmi10:[[29,28,0,-1],[31,30,0,-2],[29,30,1,-2],[27,30,0,-1],[30,28,0,-2],[35,28,0,-1],[31,28,0,-2],[28,29,0,-1],
[26,28,0,-1],[28,28,0,-1],[30,29,0,-3],[24,20,1,-1],[24,37,8,-1],[23,28,9],[18,31,1,-1],[15,19,1,-1],
[19,38,9,-1],[20,28,9,-1],[18,30,1,-1],[12,20,1,-2],[21,20,1,-2],[21,30,1,-2],[23,27,9,-1],[20,19,0,-2],
[18,38,9,-1],[23,19,1,-1],[20,28,9,-1],[23,19,1,-1],[20,19,1,-1],[21,20,1,-1],[22,38,9,-2],[24,28,9,-1],
[25,38,9,-1],[25,19,1],[17,20,1,-1],[22,30,1,-1],[33,19,1,-1],[18,27,8,-3],[16,24,5,-1],[24,28,9,-2],
[37,12,-9,-2],[37,13,1,-2],[37,12,-9,-2],[37,13,1,-2],[7,10,-9,-2],[8,10,-9,-2],[19,22,1,-1],[19,22,1,-1],
[18,20,1,-1],[15,19,0,-3],[18,19,0,-1],[18,28,9,-1],[19,27,8,-1],[17,28,9,-2],[18,29,1,-1],[18,28,9,-2],
[18,29,1,-1],[18,28,9,-1],[5,5,0,-3],[6,13,8,-3],[26,25,2,-3],[17,42,11,-2],[26,25,2,-3],[21,20,0],
[23,31,1,-1],[29,30,0,-1],[30,28,0,-1],[30,30,1,-2],[32,28,0,-1],[31,28,0,-1],[30,28,0,-1],[30,30,1,-2],
[36,28,0,-1],[20,28,0,-1],[24,29,1,-2],[36,28,0,-1],[26,28,0,-1],[42,28,0,-1],[36,28,0,-1],[29,30,1,-2],
[30,28,0,-1],[29,37,8,-2],[30,29,1,-1],[25,30,1,-2],[28,28,0,-1],[30,29,1,-2],[30,29,1,-2],[41,29,1,-2],
[34,28,0,-1],[31,28,0,-1],[28,28,0,-2],[12,32,1,-2],[10,39,9,-3],[12,39,9,-2],[37,11,-5,-2],[37,11,-5,-2],
[17,30,1],[20,20,1,-1],[16,30,1,-1],[17,20,1,-1],[20,30,1,-1],[17,20,1,-1],[21,38,9,-2],[20,28,9],
[21,30,1,-2],[11,28,1,-1],[18,36,9,1],[19,30,1,-2],[10,30,1,-1],[34,20,1,-1],[23,20,1,-1],[19,20,1,-1],
[23,27,8,2],[18,27,8,-1],[17,20,1,-1],[16,20,1,-2],[13,27,1,-1],[22,20,1,-1],[19,20,1,-1],[28,20,1,-1],
[21,20,1,-1],[20,28,9,-1],[18,20,1,-1],[11,20,1,-1],[16,28,9,1],[23,28,9,-3],[19,9,-21,-7],[17,6,-22,-10],
[16,66,115,165,214,264,313,363,
412,462,511,561,610,660,709,759],[55,104,154,203,253,302,352,401],[813,434]]});
org.mathdox.formulaeditor.MathCanvas.addFont(358,
{cmmi10:[[34,34,0,-2],[37,35,0,-2],[35,37,2,-2],[32,35,0,-1],[36,34,0,-2],[42,34,0,-2],[38,34,0,-2],[34,35,0,-1],
[31,34,0,-1],[33,34,0,-1],[36,35,0,-3],[28,23,1,-2],[28,45,10,-1],[27,33,11],[21,36,1,-2],[17,23,1,-2],
[22,45,10,-2],[24,33,11,-1],[21,36,1,-2],[14,23,1,-2],[25,23,1,-2],[25,35,1,-2],[27,33,11,-1],[24,22,0,-2],
[21,45,10,-1],[27,23,1,-1],[24,33,11,-1],[27,23,1,-1],[24,23,1,-1],[25,23,1,-1],[26,44,10,-2],[28,32,10,-1],
[31,44,10,-1],[30,23,1],[20,25,2,-1],[27,36,1,-1],[39,23,1,-1],[22,32,10,-3],[19,28,6,-1],[29,33,11,-2],
[45,14,-11,-2],[45,15,1,-2],[45,14,-11,-2],[45,15,1,-2],[9,12,-11,-2],[9,12,-11,-2],[23,26,1,-1],[23,26,1,-1],
[21,25,2,-2],[17,23,0,-4],[20,23,0,-2],[21,34,11,-2],[22,33,10,-1],[20,34,11,-2],[21,35,2,-2],[22,34,11,-2],
[21,35,2,-2],[21,34,11,-2],[6,6,0,-4],[6,16,10,-4],[30,29,2,-4],[20,50,13,-2],[30,29,2,-4],[25,24,0],
[26,36,1,-2],[35,35,0,-1],[35,34,0,-2],[36,37,2,-2],[38,34,0,-2],[37,34,0,-1],[36,34,0,-1],[36,37,2,-2],
[42,34,0,-2],[24,34,0,-1],[28,35,1,-3],[43,34,0,-1],[30,34,0,-2],[50,34,0,-2],[42,34,0,-2],[35,37,2,-2],
[35,34,0,-2],[35,45,10,-2],[35,35,1,-2],[30,37,2,-2],[34,34,0,-1],[35,36,2,-3],[36,35,1,-2],[50,35,1,-2],
[41,34,0,-1],[37,34,0,-1],[34,34,0,-2],[15,38,1,-2],[13,47,11,-3],[15,46,11,-2],[45,13,-6,-2],[45,13,-6,-2],
[20,36,1],[23,23,1,-2],[19,35,1,-2],[19,23,1,-2],[24,35,1,-2],[19,23,1,-2],[25,45,10,-2],[24,32,10],
[25,35,1,-2],[14,34,1,-1],[21,43,10,1],[23,35,1,-2],[11,35,1,-2],[41,23,1,-1],[27,23,1,-1],[21,23,1,-2],
[26,32,10,2],[20,32,10,-2],[21,23,1,-1],[19,23,1,-2],[16,32,1,-1],[26,23,1,-1],[22,23,1,-1],[33,23,1,-1],
[25,23,1,-1],[23,32,10,-1],[21,23,1,-2],[14,23,1,-1],[19,32,10,1],[28,34,11,-3],[22,10,-25,-9],[19,7,-26,-13],
[20,79,139,198,258,317,377,436,
495,555,614,674,733,793,852,912],[64,124,183,243,302,362,421,481],[977,521]]});
org.mathdox.formulaeditor.MathCanvas.addFont(430,
{cmmi10:[[41,41,0,-2],[44,43,0,-3],[42,44,2,-2],[38,43,0,-2],[43,40,0,-3],[50,41,0,-2],[45,41,0,-3],[41,42,0,-1],
[37,41,0,-1],[40,41,0,-1],[43,42,0,-4],[34,28,1,-2],[34,54,12,-1],[31,40,13,-1],[25,43,1,-2],[21,27,1,-2],
[26,55,13,-2],[29,40,13,-1],[25,43,1,-2],[17,27,1,-3],[30,27,1,-3],[30,42,1,-3],[33,39,13,-1],[28,26,0,-3],
[26,54,13,-1],[33,27,1,-1],[29,40,13,-1],[32,27,1,-2],[30,27,1,-1],[30,27,1,-1],[32,53,12,-2],[34,39,13,-1],
[37,53,12,-1],[36,27,1],[25,29,2,-1],[32,43,1,-1],[48,27,1,-1],[26,39,12,-4],[24,34,7,-1],[34,39,13,-3],
[53,18,-13,-3],[53,17,1,-3],[53,18,-13,-3],[53,17,1,-3],[10,15,-13,-3],[11,15,-13,-3],[27,31,1,-1],[27,31,1,-1],
[26,29,2,-2],[20,27,0,-5],[25,27,0,-2],[25,40,13,-2],[27,40,12,-1],[24,40,13,-3],[25,42,2,-2],[26,41,13,-3],
[25,42,2,-2],[25,40,13,-2],[7,7,0,-5],[7,19,12,-5],[37,35,3,-4],[24,60,15,-3],[37,35,3,-4],[30,28,-1],
[32,45,2,-2],[41,43,0,-2],[43,41,0,-2],[42,44,2,-3],[46,41,0,-2],[43,41,0,-2],[43,41,0,-2],[42,44,2,-3],
[50,41,0,-2],[28,41,0,-2],[34,43,2,-4],[51,41,0,-2],[36,41,0,-2],[60,41,0,-2],[50,41,0,-2],[42,44,2,-2],
[43,41,0,-2],[42,54,12,-2],[43,43,2,-2],[35,44,2,-3],[41,40,0,-1],[41,43,2,-4],[43,43,2,-3],[59,43,2,-3],
[50,41,0,-1],[43,41,0,-2],[40,41,0,-3],[17,47,2,-3],[15,56,13,-4],[17,56,13,-3],[53,15,-7,-3],[53,16,-7,-3],
[24,43,1],[28,28,1,-2],[23,42,1,-2],[24,28,1,-2],[29,42,1,-2],[24,28,1,-2],[30,54,12,-3],[28,40,13],
[30,42,1,-3],[17,40,1,-1],[25,52,13,1],[27,42,1,-3],[14,42,1,-2],[49,28,1,-1],[33,28,1,-1],[26,28,1,-2],
[31,38,12,2],[25,39,12,-2],[25,28,1,-1],[22,28,1,-3],[19,38,1,-1],[31,27,1,-1],[27,27,1,-1],[40,27,1,-1],
[31,28,1,-1],[28,39,13,-1],[26,27,1,-2],[17,27,1,-1],[23,39,13,1],[33,40,13,-4],[27,13,-30,-10],[24,9,-31,-15],
[24,95,167,238,309,381,452,524,
595,666,738,809,880,952,1023,1095],[77,149,220,292,363,434,506,577],[1172,625]]});
org.mathdox.formulaeditor.MathCanvas.addFont(50,
{cmr10:[[4,5,0],[6,5,0],[5,6,1],[5,5,0],[5,5,0],[5,5,0],[5,5,0],[5,5,0],
[5,5,0],[5,5,0],[5,5,0],[5,5,0],[4,5,0],[4,5,0],[6,5,0],[6,5,0],
[2,3,0],[3,5,2,1],[2,2,-3],[2,2,-3,-1],[2,2,-3,-1],[3,2,-3],[3,2,-3],[2,2,-3,-2],
[2,2,2,-1],[4,5,0],[5,4,0],[6,4,0],[4,5,1],[6,5,0],[7,6,1],[5,6,1],
[2,1,-2],[2,5,0],[3,2,-3],[6,7,2],[4,6,1],[6,7,1],[5,6,1],[2,2,-3],
[3,7,2],[2,7,2],[3,4,-2],[5,5,1],[2,2,1],[2,1,-1],[2,1,0],[3,7,2],
[4,6,1],[3,5,0],[4,5,0],[4,6,1],[4,5,0],[4,6,1],[4,6,1],[4,6,1],
[4,6,1],[4,6,1],[2,3,0],[2,4,1],[2,6,2],[5,3,0],[3,6,2],[3,5,0],
[5,5,0],[5,5,0],[5,5,0],[5,6,1],[5,5,0],[5,5,0],[5,5,0],[5,6,1],
[5,5,0],[3,5,0],[3,6,1],[5,5,0],[4,5,0],[6,5,0],[5,5,0],[5,6,1],
[5,5,0],[5,7,2],[5,6,1],[4,6,1],[5,5,0],[5,6,1],[5,5,0],[7,5,0],
[7,5,0,2],[5,5,0],[4,5,0],[2,8,2],[3,3,-2,-1],[2,8,2],[2,1,-4,-1],[2,1,-4],
[2,3,-2],[4,4,0],[4,5,0],[3,4,0],[4,5,0],[3,4,0],[3,5,0],[4,5,2],
[4,5,0],[2,5,0],[3,7,2,1],[4,5,0],[2,5,0],[6,3,0],[4,3,0],[4,4,0],
[4,5,2],[4,5,2],[3,3,0],[3,4,0],[3,5,0],[4,3,0],[4,3,0],[5,3,0],
[4,3,0],[4,5,2],[3,3,0],[4,1,-1],[7,1,-1],[2,2,-3,-1],[3,1,-4],[3,1,-4],
[3,11,20,28,37,45,54,63,
71,80,88,97,105,114,122,131],[9,17,26,34,42,51,59,67],[141,73]]});
org.mathdox.formulaeditor.MathCanvas.addFont(60,
{cmr10:[[5,6,0],[7,6,0],[6,7,1],[6,6,0],[5,6,0],[6,6,0],[6,6,0],[6,6,0],
[6,6,0],[6,6,0],[6,6,0],[5,6,0],[4,6,0],[4,6,0],[7,6,0],[7,6,0],
[2,4,0],[3,6,2,1],[2,2,-4,-1],[2,2,-4,-1],[2,1,-4,-1],[4,2,-4],[4,1,-4],[2,2,-4,-2],
[2,2,2,-1],[4,6,0],[6,5,1],[6,4,0],[4,5,1],[7,6,0],[8,7,1],[6,7,1],
[2,1,-2],[2,6,0],[3,3,-3],[6,8,2],[4,7,1],[7,7,1],[6,7,1],[2,3,-3],
[3,8,2],[3,8,2],[4,4,-2],[6,6,1],[2,3,2],[3,1,-1],[2,1,0],[4,8,2],
[4,7,1],[4,6,0],[4,6,0],[4,7,1],[4,6,0],[4,7,1],[4,7,1],[4,7,1],
[4,7,1],[4,7,1],[2,4,0],[2,6,2],[2,6,2],[6,2,-1],[4,6,2],[4,6,0],
[6,7,1],[6,6,0],[6,6,0],[6,7,1],[6,6,0],[6,6,0],[5,6,0],[6,7,1],
[6,6,0],[3,6,0],[4,7,1],[6,6,0],[5,6,0],[7,6,0],[6,6,0],[6,7,1],
[5,6,0],[6,8,2],[6,7,1],[4,7,1],[6,6,0],[6,7,1],[6,6,0],[8,6,0],
[6,6,0],[6,6,0],[5,6,0],[2,8,2],[3,3,-3,-1],[2,8,2],[2,2,-4,-1],[2,2,-4],
[2,3,-3],[4,5,1],[5,7,1],[4,4,0],[4,6,0],[4,4,0],[3,6,0],[4,6,2],
[5,6,0],[2,6,0],[3,8,2,1],[4,6,0],[2,6,0],[7,4,0],[5,4,0],[4,4,0],
[5,6,2],[4,6,2],[3,4,0],[3,5,1],[3,5,0],[5,4,0],[4,4,0],[6,4,0],
[4,4,0],[4,6,2],[4,4,0],[4,1,-2],[8,1,-2],[3,2,-4,-1],[4,2,-4],[2,2,-4,-1],
[3,14,24,34,44,55,65,75,
85,95,106,116,126,136,147,157],[11,21,31,41,51,61,71,81],[169,87]]});
org.mathdox.formulaeditor.MathCanvas.addFont(70,
{cmr10:[[6,7,0],[8,7,0],[8,8,1],[7,7,0],[7,7,0],[7,7,0],[7,7,0],[8,7,0],
[7,7,0],[7,7,0],[7,7,0],[7,7,0],[6,7,0],[6,7,0],[8,7,0],[8,7,0],
[3,5,0],[4,7,2,1],[2,2,-5,-1],[2,2,-5,-2],[3,2,-5,-1],[3,2,-5,-1],[5,1,-5],[3,3,-5,-2],
[3,2,2,-1],[5,7,0],[7,6,1],[8,6,1],[5,7,1],[9,7,0],[10,8,1],[8,9,1],
[3,2,-2],[2,8,0],[4,3,-4],[8,9,2],[5,9,1],[8,9,1],[8,9,1],[2,3,-4],
[3,10,2,-1],[3,10,2],[5,5,-3],[8,7,1],[2,3,2],[3,2,-1],[2,1,0],[5,10,2],
[5,8,1],[3,7,0,-1],[5,7,0],[5,8,1],[5,7,0],[5,8,1],[5,8,1],[5,8,1],
[5,10,1],[5,10,1],[2,5,0],[2,7,2],[2,7,2],[8,3,-1],[5,7,2],[5,9,0],
[8,8,1],[7,7,0],[7,7,0],[7,8,1],[7,7,0],[7,7,0],[6,7,0],[8,8,1],
[7,7,0],[4,7,0],[5,8,1],[8,7,0],[6,7,0],[9,7,0],[7,7,0],[8,8,1],
[7,7,0],[8,9,2],[8,8,1],[5,8,1],[7,7,0],[7,8,1],[8,8,1],[10,8,1],
[10,7,0,2],[8,7,0],[6,7,0],[2,10,2,-1],[4,3,-4,-1],[2,10,2],[3,2,-5,-1],[2,2,-5],
[2,3,-4],[5,5,0],[6,7,0],[4,6,1],[6,8,1],[5,6,1],[4,7,0],[5,7,2],
[6,7,0],[3,7,0],[4,9,2,1],[5,9,0],[3,7,0],[8,9,0],[6,5,0],[5,6,1],
[6,7,2],[6,7,2],[4,5,0],[4,5,0],[4,7,1],[6,6,1],[5,5,0],[7,5,0],
[5,5,0],[5,7,2],[4,5,0],[5,1,-2],[10,1,-2],[4,2,-5,-1],[3,2,-5,-1],[3,2,-5,-1],
[4,16,28,40,52,64,76,88,
99,111,123,135,147,159,171,183],[13,24,36,47,59,71,82,94],[197,102]]});
org.mathdox.formulaeditor.MathCanvas.addFont(85,
{cmr10:[[7,9,0],[10,9,0],[9,10,1],[8,9,0],[8,9,0],[9,9,0],[8,9,0],[9,9,0],
[8,9,0],[9,9,0],[8,9,0],[8,9,0],[7,9,0],[7,9,0],[10,9,0],[10,9,0],
[3,6,0],[4,9,3,1],[3,3,-6,-1],[3,3,-6,-2],[4,2,-6,-1],[4,3,-6,-1],[4,2,-6,-1],[3,3,-6,-3],
[4,3,3,-1],[6,10,1],[9,7,1],[9,7,1],[6,8,1],[11,9,0],[12,10,1],[12,10,1,3],
[3,2,-3],[2,9,0,-1],[5,5,-4],[10,12,3],[6,10,1],[10,10,1],[9,10,1],[2,5,-4,-1],
[3,12,3,-1],[4,12,3],[6,5,-4],[9,8,1],[2,5,3,-1],[4,1,-2],[2,2,0,-1],[6,12,3],
[6,9,1],[4,8,0,-1],[6,8,0],[6,9,1],[6,8,0],[6,9,1],[6,9,1],[6,9,1],
[6,9,1],[6,9,1],[2,6,0,-1],[2,9,3,-1],[2,9,3,-1],[9,4,-1],[5,9,3],[5,9,0],
[9,10,1],[9,9,0],[8,9,0],[8,10,1],[9,9,0],[8,9,0],[8,9,0],[9,10,1],
[9,9,0],[4,9,0],[6,10,1],[9,9,0],[7,9,0],[11,9,0],[9,9,0],[9,10,1],
[8,9,0],[9,12,3],[9,10,1],[6,10,1],[9,9,0],[9,10,1],[9,10,1],[12,10,1],
[9,9,0],[9,9,0],[7,9,0],[2,12,3,-1],[5,5,-4,-1],[2,12,3],[4,2,-6,-1],[2,2,-6,-1],
[3,5,-4],[6,7,1],[7,10,1],[5,7,1],[7,10,1],[5,7,1],[5,9,0],[6,9,3],
[7,9,0],[3,8,0],[4,11,3,1],[6,9,0],[3,9,0],[10,6,0],[7,6,0],[6,7,1],
[7,9,3],[7,9,3],[5,6,0],[5,7,1],[4,9,1],[7,7,1],[6,6,0],[9,6,0],
[7,6,0],[6,9,3],[5,6,0],[6,1,-3],[12,1,-3],[8,6,-3,3],[4,1,-7,-1],[4,2,-6,-1],
[5,19,34,48,63,77,92,106,
121,135,150,164,179,193,208,222],[16,30,45,59,73,87,101,115],[239,125]]});
org.mathdox.formulaeditor.MathCanvas.addFont(100,
{cmr10:[[9,10,0],[11,10,0],[11,11,1],[10,10,0],[9,10,0],[10,10,0],[10,10,0],[10,10,0],
[10,10,0],[9,10,0,168],[10,10,0],[9,10,0],[8,10,0],[8,10,0],[12,10,0],[12,10,0],
[4,7,0],[4,10,3,1],[3,3,-7,-1],[3,3,-7,-3],[5,2,-7,-1],[5,3,-7,-1],[5,2,-7,-1],[3,3,-7,-4],
[4,3,3,-2],[7,11,1],[10,8,1],[11,8,1],[7,10,2],[13,10,0],[13,11,1,-1],[11,12,1],
[4,2,-4],[2,10,0,-1],[5,5,-5],[11,13,3],[7,12,1],[11,12,1],[11,11,1],[2,5,-5,-1],
[4,15,4,-1],[3,15,4,-1],[5,7,-4,-1],[10,9,1],[2,5,3,-1],[4,2,-2],[2,2,0,-1],[7,15,4],
[7,11,1],[5,10,0,-1],[7,10,0],[7,11,1],[7,10,0],[7,11,1],[7,11,1],[7,11,1],
[7,11,1],[7,11,1],[2,6,0,-1],[2,9,3,-1],[2,10,3,-1],[10,5,-1],[6,10,3],[6,10,0],
[11,11,1],[10,10,0],[10,10,0],[10,11,1],[10,10,0],[9,10,0],[9,10,0],[11,11,1],
[10,10,0],[5,10,0],[7,11,1],[11,10,0],[9,10,0],[13,10,0],[10,10,0],[11,11,1],
[9,10,0],[11,13,3],[11,11,1],[7,11,1],[10,10,0],[10,11,1],[11,11,1],[14,11,1],
[11,10,0],[11,10,0],[8,10,0],[3,15,4,-1],[5,5,-5,-2],[3,15,4],[5,3,-7,-1],[2,2,-8,-1],
[2,5,-5,-1],[7,8,1],[8,11,1],[6,8,1],[8,11,1],[6,8,1],[5,10,0],[7,10,3],
[8,10,0],[4,10,0],[4,13,3,1],[8,10,0],[4,10,0],[12,7,0],[8,7,0],[7,8,1],
[8,10,3],[8,10,3],[5,7,0],[5,8,1],[5,10,1],[8,8,1],[7,6,0],[10,6,0],
[8,6,0],[7,9,3],[6,6,0],[7,1,-3],[14,1,-3],[5,3,-7,-1],[5,2,-8,-1],[5,2,-8,-1],
[6,23,40,57,74,91,108,125,
142,159,176,193,210,227,244,262],[19,36,52,69,85,102,119,135],[281,146]]});
org.mathdox.formulaeditor.MathCanvas.addFont(120,
{cmr10:[[10,12,0],[14,12,0],[12,13,1,-1],[12,13,0],[11,12,0],[13,12,0],[11,12,0,-1],[12,12,0,-1],
[11,12,0,-1],[12,12,0,-1],[12,12,0],[11,12,0],[9,12,0],[9,12,0],[14,12,0],[14,12,0],
[5,8,0],[5,12,4,1],[4,4,-8,-1],[4,4,-8,-3],[5,3,-8,-2],[6,4,-8,-1],[7,1,-9,-1],[4,4,-9,-4],
[5,4,4,-2],[8,13,1],[12,9,1],[13,9,1],[8,11,2],[15,12,0],[16,13,1,-1],[12,14,1,-1],
[5,3,-4],[3,13,0,-1],[6,6,-6],[13,16,4,-1],[7,14,1,-1],[13,14,1,-1],[13,14,1],[3,6,-6,-1],
[5,17,4,-1],[4,17,4,-1],[7,8,-5,-1],[12,12,2,-1],[3,6,4,-1],[5,2,-3],[3,2,0,-1],[7,17,4,-1],
[8,13,1],[7,12,0,-1],[8,12,0],[8,13,1],[8,12,0],[8,13,1],[8,13,1],[8,13,1,-1],
[8,13,1],[8,13,1],[3,8,0,-1],[3,12,4,-1],[3,13,4,-1],[12,5,-2,-1],[6,13,4,-1],[6,12,0,-1],
[12,13,1,-1],[13,13,0],[11,12,0],[11,13,1,-1],[12,12,0],[11,12,0],[11,12,0],[12,13,1,-1],
[13,12,0],[6,12,0],[8,13,1],[13,12,0],[10,12,0],[15,12,0],[13,12,0],[12,13,1,-1],
[11,12,0],[12,16,4,-1],[13,13,1],[8,13,1,-1],[12,12,0],[13,13,1],[13,13,1],[18,13,1],
[13,12,0],[13,12,0],[9,12,0,-1],[3,17,4,-2],[6,6,-6,-2],[3,17,4],[5,3,-9,-2],[3,3,-9,-1],
[3,6,-6,-1],[9,9,1],[9,13,1],[7,9,1],[9,13,1],[7,9,1],[6,12,0],[9,12,4],
[9,12,0],[5,12,0],[5,16,4,1],[9,12,0],[5,12,0],[14,8,0],[9,8,0],[8,9,1],
[9,12,4],[9,12,4],[7,8,0],[7,9,1],[6,12,1],[9,9,1],[9,9,1],[12,9,1],
[9,8,0],[9,12,4],[7,8,0],[9,1,-4],[17,1,-4],[6,4,-8,-2],[6,3,-9,-1],[6,3,-9,-1],
[7,27,48,68,89,109,130,150,
171,191,211,232,252,273,293,314],[22,42,61,81,101,121,141,161],[337,175]]});
org.mathdox.formulaeditor.MathCanvas.addFont(144,
{cmr10:[[12,14,0],[15,15,0,-1],[14,16,1,-1],[14,15,0],[13,14,0],[15,14,0],[13,14,0,-1],[14,15,0,-1],
[13,14,0,-1],[14,14,0,-1],[13,15,0,-1],[13,15,0],[11,15,0],[11,15,0],[16,15,0],[16,15,0],
[5,9,0],[6,14,5,1],[4,4,-10,-2],[4,4,-10,-4],[6,3,-10,-2],[6,4,-10,-2],[8,1,-11,-1],[5,5,-10,-5],
[6,5,5,-2],[10,16,1],[13,10,1,-1],[15,10,1],[10,13,2],[18,14,0],[19,15,1,-1],[14,16,1,-1],
[6,3,-5],[3,15,0,-1],[7,6,-8],[15,18,4,-1],[8,16,1,-1],[15,17,2,-1],[15,16,1],[4,6,-8,-1],
[5,20,5,-2],[5,20,5,-1],[8,9,-6,-1],[14,14,2,-1],[3,7,4,-1],[6,2,-3],[3,3,0,-1],[8,20,5,-1],
[10,15,1],[8,14,0,-1],[8,14,0,-1],[10,15,1],[10,14,0],[8,15,1,-1],[10,15,1],[9,15,1,-1],
[10,15,1],[10,15,1],[3,9,0,-1],[3,13,4,-1],[3,15,5,-1],[14,6,-2,-1],[8,15,5,-1],[8,15,0,-1],
[14,16,1,-1],[15,15,0],[13,14,0],[13,16,1,-1],[15,14,0],[13,14,0],[13,14,0],[14,16,1,-1],
[15,14,0],[7,14,0],[10,15,1],[15,14,0],[12,14,0],[18,14,0],[15,14,0],[14,16,1,-1],
[13,14,0],[14,19,4,-1],[15,15,1],[9,16,1,-1],[14,14,0],[15,15,1],[15,15,1],[21,15,1],
[15,14,0],[15,14,0],[11,14,0,-1],[4,20,5,-2],[7,7,-7,-3],[4,20,5],[6,3,-11,-2],[3,3,-11,-1],
[3,7,-7,-1],[10,10,1],[11,15,1],[9,10,1],[11,15,1],[9,10,1],[8,15,0],[10,14,5],
[11,14,0],[5,14,0],[6,19,5,1],[11,14,0],[5,14,0],[17,9,0],[11,9,0],[10,10,1],
[11,13,4],[11,13,4],[8,9,0],[8,10,1],[7,14,1],[11,10,1],[11,10,1],[14,10,1],
[11,9,0],[11,13,4],[8,9,0],[10,1,-5],[20,1,-5],[7,4,-10,-2],[8,3,-11,-1],[6,3,-11,-2],
[8,33,57,82,106,131,155,180,
205,229,254,278,303,327,352,377],[26,50,74,98,122,145,169,193],[404,209]]});
org.mathdox.formulaeditor.MathCanvas.addFont(173,
{cmr10:[[14,17,0],[18,18,0,-1],[17,18,1,-1],[16,18,0],[14,17,0,-1],[18,17,0],[15,17,0,-1],[17,17,0,-1],
[15,17,0,-1],[17,17,0,-1],[16,17,0,-1],[15,17,0],[13,17,0],[13,17,0],[20,17,0],[20,17,0],
[6,11,0],[6,16,5,1],[5,5,-12,-2],[5,5,-12,-5],[6,4,-12,-3],[8,5,-12,-2],[10,2,-13,-1],[6,5,-13,-6],
[6,5,5,-3],[12,18,1],[16,12,1,-1],[18,12,1],[12,16,3],[21,17,0],[23,18,1,-1],[17,20,2,-1],
[7,4,-6],[3,18,0,-2],[9,8,-9],[18,22,5,-1],[10,20,2,-1],[18,20,2,-1],[17,19,1,-1],[3,8,-9,-2],
[6,24,6,-2],[6,24,6,-1],[10,11,-7,-1],[17,16,2,-1],[3,8,5,-2],[7,2,-4],[3,3,0,-2],[10,24,6,-1],
[11,17,1],[8,16,0,-2],[10,16,0,-1],[10,17,1,-1],[12,17,0],[10,17,1,-1],[10,17,1,-1],[11,18,1,-1],
[10,17,1,-1],[10,17,1,-1],[3,11,0,-2],[3,16,5,-2],[3,18,6,-2],[17,6,-3,-1],[9,17,5,-1],[9,17,0,-1],
[17,18,1,-1],[18,18,0],[16,17,0],[15,18,1,-1],[17,17,0],[16,17,0],[15,17,0],[17,18,1,-1],
[18,17,0],[8,17,0],[11,18,1,-1],[18,17,0],[14,17,0],[22,17,0],[18,17,0],[17,18,1,-1],
[15,17,0],[17,22,5,-1],[18,18,1],[11,18,1,-1],[17,17,0],[18,18,1],[18,18,1],[25,18,1],
[18,17,0],[18,17,0],[13,17,0,-1],[5,24,6,-2],[9,8,-9,-3],[4,24,6],[6,4,-13,-3],[3,3,-13,-2],
[4,8,-9,-1],[11,12,1,-1],[13,18,1],[10,12,1],[13,18,1],[10,12,1],[9,17,0],[12,16,5],
[13,17,0],[6,16,0],[6,21,5,1],[13,17,0],[7,17,0],[20,11,0],[13,11,0],[12,12,1],
[13,16,5],[13,16,5],[9,11,0],[9,12,1],[8,16,1],[13,12,1],[13,12,1],[17,12,1],
[13,11,0],[13,16,5],[10,11,0],[12,1,-6],[24,1,-6],[7,5,-12,-3],[8,3,-13,-2],[8,3,-13,-2],
[10,39,69,98,128,157,187,216,
246,275,305,334,364,393,423,453],[32,61,90,118,147,176,204,233],[485,253]]});
org.mathdox.formulaeditor.MathCanvas.addFont(207,
{cmr10:[[16,20,0,-1],[22,21,0,-1],[20,22,1,-1],[20,21,0],[18,20,0,-1],[20,20,0,-1],[19,20,0,-1],[20,21,0,-1],
[19,20,0,-1],[20,20,0,-1],[19,21,0,-1],[19,21,0],[16,21,0],[16,21,0],[24,21,0],[24,21,0],
[7,13,0,-1],[9,19,6,2],[6,6,-15,-3],[6,6,-15,-6],[8,4,-15,-3],[9,6,-15,-3],[11,2,-16,-2],[6,6,-15,-8],
[8,6,6,-3],[14,22,1],[20,14,1,-1],[22,14,1],[13,19,3,-1],[26,20,0],[27,22,1,-2],[20,24,2,-1],
[8,4,-8],[4,21,0,-2],[9,10,-11,-1],[22,27,6,-1],[12,24,2,-1],[22,24,2,-1],[20,22,1,-1],[4,9,-11,-2],
[8,30,8,-2],[8,30,8,-1],[11,13,-9,-2],[20,20,3,-1],[4,9,6,-2],[8,3,-5],[4,3,0,-2],[12,30,8,-1],
[13,21,1,-1],[11,20,0,-2],[12,20,0,-1],[13,21,1,-1],[14,20,0],[12,21,1,-1],[13,21,1,-1],[13,21,1,-1],
[13,21,1,-1],[13,21,1,-1],[4,13,0,-2],[4,19,6,-2],[4,22,7,-2],[20,8,-3,-1],[11,21,6,-1],[11,21,0,-1],
[20,22,1,-1],[21,21,0],[18,20,0,-1],[19,22,1,-1],[20,20,0,-1],[18,20,0,-1],[17,20,0,-1],[21,22,1,-1],
[20,20,0,-1],[10,20,0],[13,21,1,-1],[21,20,0,-1],[16,20,0,-1],[25,20,0,-1],[20,20,0,-1],[20,22,1,-1],
[18,20,0,-1],[21,27,6,-1],[21,21,1,-1],[14,22,1,-1],[19,20,0,-1],[20,21,1,-1],[22,21,1],[30,21,1],
[21,20,0],[22,20,0],[16,20,0,-1],[5,30,8,-3],[10,9,-11,-4],[5,30,8],[8,5,-15,-3],[4,4,-16,-2],
[4,9,-11,-2],[14,14,1,-1],[16,22,1],[11,14,1,-1],[15,22,1,-1],[12,14,1],[10,21,0,-1],[14,20,6],
[16,21,0],[7,20,0,-1],[9,26,6,2],[15,21,0],[7,21,0,-1],[24,13,0],[16,13,0],[14,14,1],
[16,19,6],[15,19,6,-1],[11,13,0],[10,14,1,-1],[10,19,1],[15,14,1,-1],[15,14,1],[21,14,1],
[15,13,0],[15,19,6],[12,13,0],[15,1,-7],[29,1,-7],[10,6,-15,-3],[10,4,-16,-2],[9,4,-16,-3],
[12,47,82,118,153,188,223,259,
294,329,365,400,435,471,506,541],[37,72,106,140,175,209,243,278],[580,301]]});
org.mathdox.formulaeditor.MathCanvas.addFont(249,
{cmr10:[[19,24,0,-1],[26,25,0,-1],[24,25,1,-1],[22,25,0,-1],[21,23,0,-1],[24,24,0,-1],[21,24,0,-2],[23,24,0,-2],
[22,24,0,-1],[23,24,0,-2],[22,24,0,-1],[21,24,0,-1],[17,24,0,-1],[17,24,0,-1],[27,24,0,-1],[27,24,0,-1],
[8,15,0,-1],[10,22,7,2],[7,7,-17,-3],[7,7,-17,-7],[9,5,-17,-4],[11,7,-17,-3],[13,2,-19,-2],[7,7,-18,-9],
[9,7,7,-4],[15,25,1,-1],[23,17,1,-1],[25,17,1,-1],[15,22,4,-1],[29,24,0,-1],[32,25,1,-2],[24,27,2,-1],
[8,5,-9,-1],[4,25,0,-3],[11,11,-13,-1],[25,31,7,-2],[14,28,2,-1],[26,28,2,-1],[24,26,1,-1],[4,11,-13,-3],
[9,35,9,-3],[8,35,9,-2],[13,16,-10,-2],[23,23,3,-2],[4,11,7,-3],[10,3,-6],[4,4,0,-3],[13,35,9,-2],
[15,24,1,-1],[12,23,0,-3],[15,23,0,-1],[15,24,1,-1],[15,23,0,-1],[15,24,1,-1],[15,24,1,-1],[15,24,1,-2],
[15,24,1,-1],[15,24,1,-1],[4,15,0,-3],[4,22,7,-3],[4,25,8,-3],[23,9,-4,-2],[14,24,7,-1],[14,24,0,-1],
[24,25,1,-1],[24,25,0,-1],[22,24,0,-1],[22,25,1,-1],[23,24,0,-1],[22,24,0,-1],[20,24,0,-1],[24,25,1,-1],
[24,24,0,-1],[11,24,0,-1],[15,25,1,-1],[24,24,0,-1],[19,24,0,-1],[29,24,0,-1],[24,24,0,-1],[24,25,1,-1],
[21,24,0,-1],[24,31,7,-1],[24,25,1,-1],[16,25,1,-1],[23,23,0,-1],[24,25,1,-1],[25,25,1],[35,25,1],
[25,24,0],[26,24,0],[18,24,0,-1],[5,35,9,-4],[11,11,-13,-5],[6,35,9],[9,6,-18,-4],[4,4,-19,-3],
[5,11,-13,-2],[16,17,1,-1],[17,25,1,-1],[13,17,1,-1],[17,25,1,-1],[14,17,1,-1],[12,24,0,-1],[16,23,7,-1],
[18,24,0,-1],[8,23,0,-1],[10,30,7,2],[17,24,0,-1],[8,24,0,-1],[27,15,0,-1],[18,15,0,-1],[15,17,1,-1],
[17,22,7,-1],[17,22,7,-1],[12,15,0,-1],[12,17,1,-1],[12,22,1],[18,16,1,-1],[18,16,1],[24,16,1],
[18,15,0],[18,22,7],[13,15,0,-1],[17,2,-8],[34,2,-8],[11,7,-17,-4],[11,4,-19,-3],[11,4,-19,-3],
[14,56,99,141,184,226,269,311,
354,396,439,481,524,566,609,651],[46,87,128,170,211,253,294,335],[698,363]]});
org.mathdox.formulaeditor.MathCanvas.addFont(298,
{cmr10:[[23,28,0,-1],[31,30,0,-2],[28,30,1,-2],[27,30,0,-1],[25,28,0,-1],[29,28,0,-1],[26,28,0,-2],[28,29,0,-2],
[26,28,0,-2],[28,28,0,-2],[27,29,0,-1],[25,29,0,-1],[21,29,0,-1],[21,29,0,-1],[32,29,0,-1],[32,29,0,-1],
[10,19,0,-1],[11,28,9,2],[8,8,-21,-4],[8,8,-21,-8],[11,5,-21,-5],[13,8,-21,-4],[16,3,-22,-2],[9,8,-22,-11],
[10,9,9,-5],[19,30,1,-1],[28,20,1,-1],[30,20,1,-1],[18,26,4,-1],[35,28,0,-1],[39,30,1,-2],[28,34,3,-2],
[10,5,-11,-1],[5,30,0,-3],[14,13,-16,-1],[30,37,8,-2],[17,34,3,-2],[30,34,3,-2],[29,31,1,-1],[6,13,-16,-3],
[10,42,11,-4],[10,42,11,-2],[16,18,-13,-2],[28,28,4,-2],[6,13,8,-3],[12,3,-7],[5,5,0,-3],[17,42,11,-2],
[18,29,1,-1],[15,28,0,-3],[17,28,0,-2],[18,29,1,-1],[19,28,0,-1],[17,29,1,-2],[18,29,1,-1],[18,29,1,-2],
[18,29,1,-1],[18,29,1,-1],[5,18,0,-3],[5,26,8,-3],[5,30,9,-3],[28,10,-5,-2],[15,30,9,-2],[15,29,0,-2],
[28,30,1,-2],[29,30,0,-1],[26,28,0,-1],[26,30,1,-2],[28,28,0,-1],[26,28,0,-1],[24,28,0,-1],[29,30,1,-2],
[29,28,0,-1],[13,28,0,-1],[19,29,1,-1],[30,28,0,-1],[23,28,0,-1],[35,28,0,-1],[29,28,0,-1],[28,30,1,-2],
[25,28,0,-1],[28,37,8,-2],[29,29,1,-1],[19,30,1,-2],[27,28,0,-1],[29,29,1,-1],[30,29,1],[42,29,1],
[29,28,0,-1],[31,28,0],[21,28,0,-2],[7,42,11,-4],[14,13,-16,-6],[7,42,11],[11,7,-22,-5],[5,5,-23,-3],
[5,13,-16,-3],[20,20,1,-1],[21,30,1,-1],[16,20,1,-1],[21,30,1,-1],[16,20,1,-1],[14,29,0,-1],[19,28,9,-1],
[21,29,0,-1],[10,28,0,-1],[11,37,9,2],[20,29,0,-1],[10,29,0,-1],[33,19,0,-1],[21,19,0,-1],[19,20,1,-1],
[21,27,8,-1],[21,27,8,-1],[14,19,0,-1],[14,20,1,-1],[14,27,1],[21,20,1,-1],[21,19,1],[29,19,1],
[22,18,0],[21,27,9],[16,18,0,-1],[21,2,-10],[41,2,-10],[13,8,-21,-5],[14,5,-23,-3],[13,5,-23,-4],
[17,67,118,169,220,271,322,373,
423,474,525,576,627,678,729,780],[55,104,154,203,253,302,352,401],[835,434]]});
org.mathdox.formulaeditor.MathCanvas.addFont(358,
{cmr10:[[28,34,0,-1],[37,35,0,-2],[34,36,1,-2],[32,35,0,-1],[29,34,0,-2],[35,34,0,-1],[31,34,0,-2],[34,35,0,-2],
[31,34,0,-2],[34,34,0,-2],[32,35,0,-2],[30,35,0,-1],[25,35,0,-1],[25,35,0,-1],[39,35,0,-1],[39,35,0,-1],
[12,22,0,-1],[13,32,10,2],[10,10,-25,-5],[10,10,-25,-10],[13,7,-25,-6],[16,9,-25,-4],[18,2,-27,-3],[10,10,-26,-13],
[12,9,10,-6],[23,36,1,-1],[32,23,1,-2],[36,23,1,-1],[22,31,5,-1],[42,34,0,-1],[46,37,2,-3],[34,39,3,-2],
[12,6,-13,-1],[6,35,0,-4],[16,15,-19,-1],[36,44,10,-2],[20,40,3,-2],[36,40,3,-2],[34,38,2,-2],[7,15,-19,-4],
[13,50,13,-4],[13,50,13,-2],[19,22,-15,-3],[34,33,4,-2],[6,16,10,-4],[14,3,-9],[6,6,0,-4],[20,50,13,-2],
[22,35,2,-1],[17,33,0,-4],[20,33,0,-2],[21,35,2,-2],[23,34,0,-1],[20,35,2,-2],[21,35,2,-2],[22,35,1,-2],
[21,35,2,-2],[21,34,1,-2],[6,22,0,-4],[6,32,10,-4],[6,36,11,-4],[34,12,-6,-2],[19,35,10,-2],[19,35,0,-2],
[34,36,1,-2],[35,35,0,-1],[31,34,0,-1],[31,37,2,-2],[34,34,0,-1],[31,34,0,-1],[29,34,0,-1],[34,37,2,-2],
[35,34,0,-1],[16,34,0,-1],[21,35,1,-2],[36,34,0,-1],[28,34,0,-1],[43,34,0,-1],[35,34,0,-1],[34,36,1,-2],
[30,34,0,-1],[34,45,10,-2],[35,35,1,-1],[23,37,2,-2],[33,34,0,-1],[35,35,1,-1],[36,35,1],[50,35,1],
[35,34,0,-1],[37,34,0],[26,34,0,-2],[8,50,13,-5],[16,15,-19,-7],[7,50,13,-1],[14,8,-26,-5],[6,6,-27,-4],
[7,15,-19,-3],[23,23,1,-2],[25,35,1,-1],[20,23,1,-1],[25,35,1,-1],[20,23,1,-1],[17,35,0,-1],[23,34,11,-1],
[26,34,0,-1],[12,33,0,-1],[13,43,10,2],[24,34,0,-1],[12,34,0,-1],[39,22,0,-1],[26,22,0,-1],[23,23,1,-1],
[25,32,10,-1],[25,32,10,-1],[17,22,0,-1],[17,23,1,-1],[16,32,1,-1],[26,23,1,-1],[25,23,1],[35,23,1],
[26,22,0],[25,32,10],[19,22,0,-1],[25,2,-12],[49,2,-12],[15,10,-25,-6],[17,5,-28,-4],[15,6,-27,-5],
[20,81,142,203,264,325,387,448,
509,570,631,692,753,814,875,937],[64,124,183,243,302,362,421,481],[1003,521]]});
org.mathdox.formulaeditor.MathCanvas.addFont(430,
{cmr10:[[33,41,0,-2],[45,43,0,-2],[40,44,2,-3],[38,43,0,-1],[35,40,0,-2],[41,41,0,-2],[37,41,0,-3],[40,42,0,-3],
[37,41,0,-3],[40,41,0,-3],[38,42,0,-2],[36,42,0,-1],[31,42,0,-1],[31,42,0,-1],[47,42,0,-1],[47,42,0,-1],
[13,26,0,-2],[16,39,13,3],[12,12,-30,-6],[11,12,-30,-12],[16,8,-30,-7],[19,11,-30,-5],[22,2,-33,-4],[12,11,-32,-16],
[15,11,12,-7],[27,43,1,-1],[39,28,1,-2],[44,28,1,-1],[26,38,6,-2],[51,41,0,-1],[54,44,2,-4],[40,48,4,-3],
[15,7,-16,-1],[7,43,0,-5],[19,18,-23,-2],[43,53,12,-3],[24,49,4,-3],[43,49,4,-3],[41,45,2,-2],[8,18,-23,-5],
[15,60,15,-5],[14,60,15,-3],[23,27,-18,-3],[40,40,5,-3],[7,19,12,-5],[17,4,-11],[7,7,0,-5],[24,60,15,-3],
[26,42,2,-2],[20,40,0,-5],[24,40,0,-3],[25,42,2,-2],[27,40,0,-1],[24,42,2,-3],[25,42,2,-2],[26,42,2,-3],
[25,42,2,-2],[25,42,2,-2],[7,26,0,-5],[7,38,12,-5],[7,43,13,-5],[40,15,-7,-3],[22,43,13,-3],[22,42,0,-3],
[40,43,1,-3],[42,43,0,-1],[37,41,0,-2],[37,44,2,-3],[40,41,0,-2],[37,41,0,-2],[34,41,0,-2],[41,44,2,-3],
[41,41,0,-2],[19,41,0,-1],[26,43,2,-2],[42,41,0,-2],[33,41,0,-2],[50,41,0,-2],[41,41,0,-2],[40,44,2,-3],
[35,41,0,-2],[40,54,12,-3],[42,43,2,-2],[27,44,2,-3],[39,40,0,-2],[41,43,2,-2],[43,43,2,-1],[59,43,2,-1],
[42,41,0,-1],[44,41,0],[30,41,0,-3],[8,60,15,-7],[19,18,-23,-9],[9,60,15,-1],[16,9,-32,-7],[7,7,-33,-5],
[8,18,-23,-4],[28,28,1,-2],[30,42,1,-1],[23,28,1,-2],[30,42,1,-2],[24,28,1,-1],[19,42,0,-2],[28,40,13,-1],
[31,41,0,-1],[13,40,0,-2],[16,53,13,3],[30,41,0,-1],[13,41,0,-2],[47,27,0,-1],[31,27,0,-1],[27,28,1,-1],
[30,39,12,-1],[30,39,12,-2],[21,26,0,-1],[20,28,1,-2],[19,38,1,-1],[31,27,1,-1],[29,27,1,-1],[41,27,1,-1],
[31,26,0],[29,39,13,-1],[23,26,0,-1],[30,2,-15],[59,2,-15],[18,12,-30,-7],[20,7,-33,-5],[18,7,-33,-6],
[24,97,171,244,317,391,464,538,
611,684,758,831,904,978,1051,1125],[77,149,220,292,363,434,506,577],[1205,625]]});
org.mathdox.formulaeditor.MathCanvas.addFont(50,
{cmsy10:[[5,1,-1],[2,1,-1],[4,4,0,-1],[3,4,0],[5,5,1],[4,4,0],[5,5,0],[5,5,1],
[5,5,1],[5,5,1],[5,5,1],[5,5,1],[5,5,1],[7,7,2],[3,4,0],[3,4,0],
[5,4,0],[5,4,0],[5,6,1],[5,6,1],[5,6,1],[5,6,1],[5,6,1],[5,6,1],
[5,2,-1],[5,4,0],[5,5,1],[5,5,1],[7,5,1],[7,5,1],[5,5,1],[5,5,1],
[7,3,0],[7,3,0],[3,7,2],[3,7,2],[7,3,0],[7,7,2],[7,7,2],[5,4,0],
[7,4,0],[7,4,0],[4,7,2],[4,7,2],[7,4,0],[7,7,2],[7,7,2],[5,3,0],
[2,4,0],[7,3,0],[4,5,1],[4,5,1],[6,5,0],[6,6,2],[4,7,2,-1],[1,3,0],
[4,5,0],[4,5,0],[5,3,0],[4,7,1],[5,6,1],[5,5,0],[5,5,0],[5,5,0],
[4,5,0],[6,6,1],[5,6,1],[4,6,1],[6,5,0],[4,6,1],[6,6,1],[5,6,1],
[6,6,1],[5,5,0],[6,6,1],[5,6,1],[5,6,1],[8,6,1],[9,7,1,2],[6,6,1],
[6,6,1],[6,6,1],[6,6,1],[5,6,1],[6,5,0],[6,6,1,1],[5,6,1],[8,6,1],
[6,5,0],[5,6,1],[6,5,0],[5,5,1],[5,5,0],[5,5,1],[5,4,0],[5,4,0],
[4,5,0],[4,5,0],[2,8,2,-1],[2,8,2],[2,8,2,-1],[2,8,2],[3,8,2],[3,8,2],
[3,8,2],[2,8,2],[2,7,2],[3,8,2],[3,8,2],[4,8,2],[3,8,2],[2,5,1],
[6,8,7],[5,5,0],[6,6,1],[4,7,2],[5,4,0],[5,5,0],[5,6,1],[5,6,1],
[3,7,2],[3,7,2],[3,7,2],[4,7,2],[6,6,1],[5,6,1],[5,6,1],[5,6,1],
[3,13,23,33,43,53,63,73,
83,93,103,113,123,133,142,152],[9,24,38,52,66,80,95,109],[164,121]]});
org.mathdox.formulaeditor.MathCanvas.addFont(60,
{cmsy10:[[5,2,-1,-1],[2,2,-1],[4,4,0,-1],[4,4,0],[6,6,1],[4,4,0],[6,6,0],[6,6,2],
[6,6,1],[6,6,1],[6,6,1],[6,6,1],[6,6,1],[8,8,2],[4,4,0],[4,4,0],
[6,4,0],[6,4,0],[6,8,2],[6,8,2],[6,7,2],[6,7,2],[6,7,2],[6,7,2],
[6,2,-1],[6,4,0],[6,6,1],[6,6,1],[8,6,1],[8,6,1],[5,6,1,-1],[6,6,1],
[8,4,0],[8,4,0],[4,8,2],[4,8,2],[8,4,0],[8,8,2],[8,8,2],[6,4,0],
[8,6,1],[8,6,1],[5,8,2],[5,8,2],[8,6,1],[8,8,2],[8,8,2],[6,4,0],
[2,5,0],[8,4,0],[5,6,1],[5,6,1],[7,6,0],[7,6,2],[4,8,2,-1],[1,4,0],
[5,6,0],[4,6,0],[5,3,0],[4,7,1],[6,7,1],[6,7,1],[6,6,0],[6,6,0],
[5,6,0],[7,7,1],[6,7,1],[5,7,1],[7,6,0],[5,7,1],[7,7,1],[5,7,1],
[7,7,1],[5,6,0],[7,7,1],[6,7,1],[5,7,1],[9,7,1],[9,8,1,1],[7,7,1],
[6,7,1],[6,7,1,-1],[7,7,1],[6,7,1],[7,6,0],[7,7,1,1],[6,7,1],[9,7,1],
[7,6,0],[6,7,1],[6,6,0],[5,6,1],[5,5,0],[5,6,1],[5,5,0],[5,5,0],
[5,6,0],[5,6,0],[3,8,2,-1],[3,8,2],[3,8,2,-1],[3,8,2],[3,8,2,-1],[3,8,2],
[2,8,2,-1],[3,8,2],[1,8,2,-1],[2,8,2,-1],[4,8,2],[5,8,2],[4,8,2],[2,6,1],
[7,9,8],[6,6,0],[7,7,1],[4,8,2],[5,5,0],[5,5,0],[6,8,2],[6,8,2],
[3,8,2],[3,8,2],[3,8,2],[5,8,2],[6,7,1],[6,8,2],[6,7,1],[6,7,1],
[3,15,27,39,51,63,75,87,
99,111,123,135,147,159,171,183],[11,28,45,62,80,97,114,131],[196,145]]});
org.mathdox.formulaeditor.MathCanvas.addFont(70,
{cmsy10:[[6,1,-2,-1],[2,1,-2],[6,5,0,-1],[5,5,0],[8,7,1],[5,5,0],[8,7,0],[8,7,2],
[8,7,1],[8,7,1],[8,7,1],[8,7,1],[8,7,1],[10,11,3],[5,5,0],[5,5,0],
[8,5,0],[8,5,0],[7,9,2],[6,9,2,-1],[6,9,2,-1],[6,9,2,-1],[6,9,2,-1],[7,9,2],
[8,3,-1],[8,5,0],[7,7,1],[6,7,1,-1],[10,7,1],[10,7,1],[6,7,1,-1],[6,7,1,-1],
[10,5,0],[10,5,0],[5,9,2],[5,9,2],[10,5,0],[10,9,2],[10,9,2],[8,5,0],
[10,5,0],[10,5,0],[6,9,2],[6,9,2],[10,7,1],[10,9,2],[10,9,2],[8,6,1],
[3,6,0],[10,6,1],[6,7,1],[5,7,1,-1],[9,7,0],[9,7,2],[6,9,2,-1],[2,5,0],
[6,8,1],[5,7,0],[7,3,-1],[5,9,1],[7,9,1],[7,8,1],[8,7,0],[8,7,0],
[6,7,0],[8,9,1],[7,8,1],[6,8,1],[8,7,0],[6,8,1],[9,8,1],[6,9,2],
[8,8,1],[7,7,0],[9,9,2],[8,8,1],[7,8,1],[11,8,1],[13,9,1,3],[8,8,1],
[8,8,1],[7,9,2,-1],[9,8,1],[7,8,1],[8,8,0],[8,8,1,1],[7,8,1],[11,8,1],
[8,7,0],[8,9,2],[8,7,0],[7,7,1],[7,7,1],[7,7,1],[6,7,1],[6,7,1],
[6,7,0],[6,7,0],[4,11,3,-1],[3,11,3],[4,11,3,-1],[3,11,3],[3,11,3,-1],[3,11,3,-1],
[3,11,3,-1],[3,11,3],[1,11,3,-1],[3,11,3,-1],[3,11,3,-1],[6,11,3],[5,11,3],[3,7,1],
[9,11,10],[7,7,0],[8,8,1],[5,11,3],[6,6,0],[6,6,0],[7,9,2],[7,9,2],
[4,9,2],[4,9,2],[4,9,2],[6,9,2],[8,10,2],[8,10,2],[8,9,1],[8,10,2],
[4,18,32,46,60,74,88,102,
116,130,144,158,172,186,199,213],[13,33,53,73,93,113,133,152],[229,169]]});
org.mathdox.formulaeditor.MathCanvas.addFont(85,
{cmsy10:[[8,2,-2,-1],[2,2,-2,-1],[7,6,0,-1],[6,6,0],[9,8,1],[6,6,0],[9,8,0],[9,8,2],
[9,8,1],[9,8,1],[9,8,1],[9,8,1],[9,8,1],[12,12,3],[6,6,0],[6,6,0],
[9,6,0],[9,6,0],[8,10,2,-1],[8,10,2,-1],[8,10,2,-1],[8,10,2,-1],[8,10,2,-1],[8,10,2,-1],
[9,4,-1],[9,6,0],[8,8,1,-1],[8,8,1,-1],[12,8,1],[12,8,1],[8,8,1,-1],[8,8,1,-1],
[11,4,-1,-1],[11,4,-1],[4,11,3,-1],[4,11,2,-1],[10,4,-1,-1],[12,12,3],[12,12,3],[9,6,0],
[11,8,1,-1],[11,8,1],[7,12,3],[7,12,3],[12,8,1],[12,12,3],[12,12,3],[9,7,1],
[3,7,0],[12,7,1],[6,8,1,-1],[6,8,1,-1],[10,9,0],[10,9,3],[7,12,3,-1],[2,6,0],
[7,10,1],[6,9,0],[8,4,-1],[6,11,1],[9,10,1],[9,10,1],[9,8,0],[9,8,0],
[7,9,0],[10,10,1],[8,10,1],[7,10,1],[10,9,0],[7,10,1],[10,10,1],[8,11,2],
[10,10,1],[9,9,0,1],[10,11,2],[9,10,1],[8,10,1],[14,10,1],[13,11,1,1],[10,10,1],
[9,10,1],[9,11,2,-1],[10,10,1],[8,10,1],[10,9,0],[10,10,1,1],[8,10,1],[13,10,1],
[10,9,0],[9,11,2],[9,9,0],[8,8,1],[8,9,1],[8,8,1],[8,8,1],[8,7,0],
[7,9,0],[7,9,0],[3,12,3,-2],[4,12,3],[3,12,3,-2],[4,12,3],[4,12,3,-1],[4,12,3,-1],
[3,12,3,-1],[4,12,3],[1,12,3,-1],[4,12,3,-1],[4,12,3,-1],[7,14,4],[6,12,3],[3,8,1],
[10,13,12,-1],[9,9,0],[10,10,1],[6,12,3],[8,7,0],[8,8,0],[8,10,2,-1],[9,10,2],
[5,12,3],[5,12,3],[5,12,3],[7,12,3],[9,11,2],[9,11,2],[9,10,1],[9,11,2],
[5,22,39,56,73,90,107,124,
141,157,174,191,208,225,242,259],[17,41,65,90,114,138,162,186],[278,206]]});
org.mathdox.formulaeditor.MathCanvas.addFont(100,
{cmsy10:[[9,1,-3,-1],[2,3,-2,-1],[7,7,0,-2],[5,7,0,-1],[10,9,1],[7,7,0],[10,10,0],[10,10,3],
[11,11,2],[11,11,2],[11,11,2],[11,11,2],[11,11,2],[14,13,3],[7,7,0],[7,7,0],
[10,7,0],[10,7,0],[9,11,2,-1],[9,11,2,-1],[9,11,2,-1],[9,11,2,-1],[9,11,2,-1],[9,11,2,-1],
[11,5,-1],[10,7,0],[9,9,1,-1],[9,9,1,-1],[14,9,1],[14,9,1],[9,9,1,-1],[9,9,1,-1],
[13,5,-1,-1],[13,5,-1],[5,13,3,-1],[5,13,3,-1],[12,5,-1,-1],[14,13,3],[14,13,3],[10,7,0],
[13,9,1,-1],[13,9,1],[8,13,3],[8,13,3],[14,9,1],[14,13,3],[14,13,3],[10,8,1],
[4,8,0],[14,8,1],[7,9,1,-1],[8,9,1,-1],[12,10,0],[12,10,3],[7,13,3,-2],[2,5,-1],
[8,11,1],[7,10,0],[9,4,-1],[7,12,1],[10,11,1],[10,11,1],[9,10,0,-1],[10,10,0],
[8,10,0],[11,11,1],[10,11,1],[8,11,1],[11,10,0],[8,11,1],[12,11,1],[9,12,2],
[12,11,1],[10,10,0,1],[12,12,2],[11,11,1],[9,11,1],[16,11,1],[15,12,1,1],[11,11,1],
[11,11,1],[10,12,2,-1],[12,11,1],[9,11,1],[11,10,0],[11,11,1,1],[10,11,1],[15,11,1],
[12,10,0],[10,12,2],[11,10,0],[9,10,1],[9,10,1],[9,10,1],[8,10,1,-1],[9,10,1],
[8,10,0],[8,10,0],[4,15,4,-2],[4,15,4],[4,15,4,-2],[4,15,4],[5,15,4,-1],[5,15,4,-1],
[4,15,4,-1],[4,15,4],[2,15,4,-1],[5,15,4,-1],[5,15,4,-1],[8,15,4],[7,15,4],[4,11,2],
[11,15,14,-1],[10,10,0],[11,11,1],[7,13,3],[9,9,0],[9,9,0],[9,11,2,-1],[9,11,2,-1],
[5,13,3,-1],[6,13,3],[6,13,3],[8,13,3],[11,13,2],[10,14,3],[11,11,1],[11,13,2],
[6,26,46,66,86,106,125,145,
165,185,205,225,245,265,285,305],[20,48,77,105,134,162,190,219],[327,243]]});
org.mathdox.formulaeditor.MathCanvas.addFont(120,
{cmsy10:[[11,2,-3,-1],[3,3,-3,-1],[9,9,0,-2],[7,8,0,-1],[12,10,1,-1],[9,9,0],[12,12,0,-1],[12,12,3,-1],
[12,12,2,-1],[12,12,2,-1],[12,12,2,-1],[12,12,2,-1],[12,12,2,-1],[15,17,4,-1],[7,7,-1,-1],[7,7,-1,-1],
[12,9,0,-1],[12,8,0,-1],[11,14,3,-1],[11,14,3,-1],[11,14,3,-1],[11,14,3,-1],[11,14,3,-1],[11,14,3,-1],
[12,5,-2,-1],[12,8,-1,-1],[11,11,1,-1],[11,11,1,-1],[15,11,1,-1],[15,11,1,-1],[11,11,1,-1],[11,11,1,-1],
[15,7,-1,-1],[15,7,-1,-1],[7,16,4,-1],[7,16,4,-1],[15,7,-1,-1],[15,16,4,-1],[15,16,4,-1],[12,8,0,-1],
[15,10,1,-1],[15,10,1,-1],[10,16,4],[10,16,4],[17,10,1],[15,16,4,-1],[15,16,4,-1],[12,9,1,-1],
[5,10,0],[15,9,1,-1],[9,11,1,-1],[9,11,1,-1],[13,13,0,-1],[13,13,4,-1],[9,17,4,-2],[1,7,-1,-1],
[10,13,1],[8,12,0,-1],[10,5,-1,-1],[8,15,2],[12,14,1],[11,13,1,-1],[12,12,0,-1],[12,12,0,-1],
[9,12,0,-1],[14,14,1],[12,13,1],[9,13,1],[13,12,0],[10,13,1],[14,13,1],[11,14,2],
[14,13,1],[12,12,0,1],[15,14,2],[13,13,1],[11,13,1],[19,13,1],[18,15,1,1],[13,13,1,-1],
[13,13,1],[12,15,3,-2],[14,13,1],[11,13,1],[14,13,0],[13,13,1,1],[12,13,1],[18,13,1],
[14,12,0],[13,15,3],[13,12,0],[10,12,1,-1],[10,12,1,-1],[10,12,1,-1],[10,12,1,-1],[10,12,1,-1],
[9,12,0,-1],[9,12,0,-1],[4,18,5,-3],[5,18,5],[5,18,5,-3],[5,18,5],[7,18,5,-1],[7,18,5,-1],
[5,18,5,-1],[4,18,5,-1],[1,18,5,-2],[5,18,5,-2],[7,18,5,-1],[10,18,5],[7,18,5,-1],[3,12,2,-1],
[14,18,17,-1],[12,12,0],[14,13,1],[7,17,4,-1],[10,11,0,-1],[10,11,0,-1],[11,14,3,-1],[11,14,3,-1],
[6,16,4,-1],[6,16,4,-1],[6,16,4,-1],[9,16,4,-1],[13,16,3],[12,16,3,-1],[12,14,1,-1],[12,16,3,-1],
[7,31,55,79,103,127,151,174,
198,222,246,270,294,318,342,366],[23,57,91,125,159,193,227,261],[392,290]]});
org.mathdox.formulaeditor.MathCanvas.addFont(144,
{cmsy10:[[13,2,-4,-1],[3,2,-4,-1],[10,10,0,-3],[8,10,0,-1],[14,12,1,-1],[10,10,0],[14,14,0,-1],[14,14,4,-1],
[14,14,2,-1],[14,14,2,-1],[14,14,2,-1],[14,14,2,-1],[14,14,2,-1],[18,20,5,-1],[8,8,-1,-1],[8,8,-1,-1],
[14,10,0,-1],[14,10,0,-1],[13,16,3,-1],[13,16,3,-1],[13,16,3,-1],[13,16,3,-1],[13,16,3,-1],[13,16,3,-1],
[14,6,-2,-1],[14,9,-1,-1],[13,12,1,-1],[13,12,1,-1],[18,14,2,-1],[18,14,2,-1],[13,12,1,-1],[13,12,1,-1],
[18,8,-1,-1],[18,8,-1,-1],[8,18,4,-1],[8,18,4,-1],[18,8,-1,-1],[18,18,4,-1],[18,18,4,-1],[14,10,0,-1],
[18,12,1,-1],[18,12,1,-1],[12,18,4],[12,18,4],[19,12,1],[18,18,4,-1],[18,18,4,-1],[14,10,1,-1],
[6,11,-1],[18,10,1,-1],[11,12,1,-1],[11,12,1,-1],[16,15,0,-1],[16,15,5,-1],[11,20,5,-2],[2,8,-1,-1],
[11,15,1],[9,14,0,-1],[12,7,-1,-1],[9,18,2],[14,16,1,-1],[13,16,1,-1],[14,14,0,-1],[14,14,0,-1],
[11,14,0,-1],[16,16,1],[14,16,1],[11,15,1],[16,14,0],[12,16,1],[17,15,1],[12,18,3],
[17,15,1],[14,14,0,1],[16,17,3,-1],[15,16,1],[13,16,1],[23,15,1],[21,17,1,1],[15,15,1,-1],
[15,15,1],[14,18,3,-2],[17,15,1],[13,16,1],[16,15,0],[15,15,1,1],[14,15,1],[21,15,1],
[16,14,0,-1],[15,17,3],[16,14,0],[12,13,1,-1],[12,13,1,-1],[12,13,1,-1],[11,13,1,-1],[12,13,1,-1],
[10,14,0,-1],[11,14,0,-1],[6,20,5,-3],[6,20,5],[6,20,5,-3],[6,20,5],[8,20,5,-1],[8,20,5,-1],
[5,20,5,-2],[5,20,5,-1],[2,20,5,-2],[6,20,5,-2],[8,22,6,-1],[12,22,6],[8,20,5,-1],[4,14,2,-1],
[16,21,20,-1],[15,14,0],[15,15,1,-1],[9,20,5,-1],[12,12,0,-1],[12,12,0,-1],[14,16,3,-1],[13,16,3,-1],
[7,20,5,-1],[7,19,5,-1],[7,18,4,-1],[11,18,4,-1],[15,18,3],[14,19,4,-1],[14,16,1,-1],[14,18,3,-1],
[8,37,66,95,123,152,181,209,
238,267,295,324,353,382,410,439],[27,68,109,150,191,232,273,314],[471,348]]});
org.mathdox.formulaeditor.MathCanvas.addFont(173,
{cmsy10:[[15,2,-5,-2],[3,4,-4,-2],[12,12,0,-3],[10,11,0,-1],[17,14,1,-1],[12,12,0],[17,16,0,-1],[17,16,4,-1],
[17,16,2,-1],[17,16,2,-1],[17,16,2,-1],[17,16,2,-1],[17,16,2,-1],[22,24,6,-1],[10,10,-1,-1],[10,10,-1,-1],
[17,12,0,-1],[17,12,0,-1],[15,20,4,-2],[15,20,4,-2],[15,20,4,-2],[15,20,4,-2],[15,20,4,-2],[15,20,4,-2],
[17,6,-3,-1],[17,11,-1,-1],[15,14,1,-2],[15,14,1,-2],[22,16,2,-1],[22,16,2,-1],[15,14,1,-2],[15,14,1,-2],
[22,10,-1,-1],[22,10,-1,-1],[10,22,5,-1],[10,22,5,-1],[22,10,-1,-1],[22,22,5,-1],[22,22,5,-1],[17,12,0,-1],
[22,14,1,-1],[22,14,1,-1],[14,22,5],[14,22,5],[22,14,1,-1],[22,22,5,-1],[22,22,5,-1],[17,12,1,-1],
[7,13,-1],[22,12,1,-1],[12,14,1,-2],[12,14,1,-2],[19,18,0,-1],[19,18,6,-1],[13,24,6,-3],[2,10,-1,-1],
[14,18,1],[11,17,0,-1],[14,7,-2,-1],[10,21,2,-1],[16,19,1,-1],[16,18,1,-1],[17,16,0,-1],[17,16,0,-1],
[13,17,0,-1],[19,20,2],[16,18,1],[13,18,1],[19,17,0],[14,18,1],[20,18,1],[14,20,3,-1],
[20,19,2],[17,17,0,1],[19,20,3,-1],[18,18,1],[16,18,1],[27,19,2],[25,21,2,1],[18,18,1,-1],
[18,19,2],[17,20,3,-2],[20,18,1],[16,18,1],[19,18,0],[18,18,1,1],[15,18,1,-1],[24,18,1,-1],
[19,17,0,-1],[18,21,4],[18,17,0,-1],[14,16,1,-1],[14,16,1,-1],[14,16,1,-1],[14,16,1,-1],[14,16,1,-1],
[13,17,0,-1],[13,17,0,-1],[6,24,6,-4],[7,24,6],[6,24,6,-4],[7,24,6],[9,24,6,-2],[9,24,6,-1],
[6,24,6,-2],[6,24,6,-1],[2,24,6,-2],[6,24,6,-3],[10,26,7,-1],[14,26,7],[10,24,6,-1],[5,16,2,-1],
[20,24,23,-1],[17,17,0],[18,18,1,-1],[11,24,6,-1],[14,15,0,-1],[14,15,0,-1],[16,20,4,-2],[16,20,4,-1],
[8,22,5,-1],[9,23,6,-1],[9,22,5,-1],[13,22,5,-1],[18,22,4],[17,22,4,-1],[17,19,1,-1],[17,22,4,-1],
[10,45,79,114,148,183,217,252,
286,321,355,390,424,459,493,528],[34,83,132,181,230,279,329,378],[565,419]]});
org.mathdox.formulaeditor.MathCanvas.addFont(207,
{cmsy10:[[19,2,-6,-2],[4,4,-5,-2],[15,15,0,-4],[11,13,-1,-2],[20,17,1,-1],[15,15,0],[20,20,0,-1],[20,20,5,-1],
[20,20,3,-1],[20,20,3,-1],[20,20,3,-1],[20,20,3,-1],[20,20,3,-1],[27,28,7,-1],[12,12,-1,-1],[12,12,-1,-1],
[20,14,0,-1],[20,13,-1,-1],[19,23,4,-2],[19,23,4,-2],[19,23,4,-2],[19,23,4,-2],[19,23,4,-2],[19,23,4,-2],
[20,8,-3,-1],[20,13,-1,-1],[19,18,2,-2],[19,18,2,-2],[27,19,2,-1],[27,19,2,-1],[19,18,2,-2],[18,17,1,-2],
[27,11,-2,-1],[27,11,-2,-1],[11,26,6,-2],[11,26,6,-2],[27,11,-2,-1],[27,27,6,-1],[27,26,6,-1],[20,13,-1,-1],
[27,17,1,-1],[27,17,1,-1],[17,26,6],[17,27,6],[27,17,1,-1],[27,27,6,-1],[27,26,6,-1],[20,14,1,-1],
[7,16,-1,-1],[27,14,1,-1],[15,18,2,-2],[15,18,2,-2],[23,21,0,-1],[23,22,7,-1],[15,28,7,-4],[3,12,-1,-1],
[17,22,1],[14,21,0,-1],[17,9,-2,-1],[13,26,3,-1],[20,22,1,-1],[19,22,1,-1],[20,20,0,-1],[20,20,0,-1],
[15,20,0,-1],[23,23,2],[19,22,1,-1],[16,22,1],[23,20,0],[17,22,1],[24,21,1],[17,25,4,-1],
[24,22,2],[20,20,0,1],[24,24,4,-1],[21,22,1,-1],[18,22,1,-1],[33,23,2],[30,25,2,1],[22,22,1,-1],
[22,22,2],[20,25,4,-3],[25,21,1],[19,22,1],[23,21,0],[21,21,1,1],[19,22,2,-1],[29,22,2,-1],
[23,20,0,-1],[21,24,4],[22,20,0,-1],[17,19,1,-1],[17,19,1,-1],[17,19,1,-1],[17,19,1,-1],[17,19,1,-1],
[15,20,0,-1],[16,21,0,-1],[8,30,8,-5],[8,30,8],[8,30,8,-5],[8,30,8],[11,30,8,-2],[11,30,8,-2],
[7,30,8,-3],[7,30,8,-1],[2,30,8,-3],[8,30,8,-3],[11,31,8,-2],[17,31,8],[12,30,8,-1],[6,20,3,-1],
[23,30,28,-2],[20,20,0,-1],[22,21,1,-1],[13,28,7,-1],[17,18,0,-1],[17,18,0,-1],[19,23,4,-2],[20,23,4,-1],
[9,27,6,-2],[11,28,7,-1],[11,27,6,-1],[16,27,6,-1],[22,25,4],[20,26,5,-1],[20,22,1,-1],[20,25,4,-1],
[12,53,95,136,177,218,260,301,
342,384,425,466,507,549,590,631],[39,98,157,216,274,333,392,451],[676,500]]});
org.mathdox.formulaeditor.MathCanvas.addFont(249,
{cmsy10:[[22,3,-7,-2],[4,5,-6,-3],[17,17,0,-5],[13,15,-1,-2],[23,19,1,-2],[17,17,0],[23,23,0,-2],[23,23,6,-2],
[24,23,3,-1],[24,23,3,-1],[24,23,3,-1],[24,23,3,-1],[24,23,3,-1],[31,33,8,-1],[14,15,-1,-1],[14,15,-1,-1],
[23,17,0,-2],[23,15,-1,-2],[22,27,5,-2],[22,27,5,-2],[22,27,5,-2],[22,27,5,-2],[22,27,5,-2],[22,27,5,-2],
[24,9,-4,-1],[23,16,-1,-2],[22,21,2,-2],[22,21,2,-2],[30,23,3,-2],[30,23,3,-2],[22,21,2,-2],[22,21,2,-2],
[30,13,-2,-2],[30,13,-2,-2],[13,31,7,-2],[13,31,7,-2],[30,13,-2,-2],[31,31,7,-2],[31,31,7,-2],[24,15,-1,-1],
[30,19,1,-2],[30,19,1,-2],[19,31,7,-1],[19,31,7,-1],[32,19,1,-1],[31,31,7,-1],[31,31,7,-1],[24,16,1,-1],
[8,18,-1,-1],[31,16,1,-1],[18,21,2,-2],[18,21,2,-2],[27,25,0,-2],[27,25,8,-2],[18,33,8,-4],[4,13,-2,-1],
[19,25,1],[15,24,0,-2],[19,10,-3,-2],[15,30,3,-1],[24,26,1,-1],[23,25,1,-1],[23,23,0,-2],[23,23,0,-2],
[18,24,0,-1],[26,27,2,-1],[22,25,1,-1],[19,25,1],[26,24,0],[19,25,1,-1],[29,26,2],[20,28,4,-1],
[28,26,2],[23,24,0,1],[28,28,4,-1],[24,25,1,-1],[22,25,1,-1],[37,26,2,-1],[35,29,2,1],[25,25,1,-2],
[25,26,2],[24,29,5,-3],[29,25,1],[22,25,1],[26,25,0,-1],[25,25,1,1],[22,26,2,-1],[35,26,2,-1],
[27,24,0,-1],[24,29,5,-1],[25,24,0,-1],[20,22,1,-1],[20,22,1,-1],[20,22,1,-1],[19,22,1,-2],[19,22,1,-2],
[18,24,0,-1],[17,24,0,-2],[10,35,9,-5],[10,35,9],[10,35,9,-5],[10,35,9],[13,35,9,-2],[13,35,9,-2],
[9,35,9,-3],[8,35,9,-2],[2,35,9,-4],[9,35,9,-4],[13,37,10,-2],[19,37,10,-1],[13,35,9,-2],[7,23,3,-1],
[27,35,33,-2],[24,24,0,-1],[26,26,2,-1],[15,33,8,-1],[19,21,0,-2],[19,21,0,-2],[22,27,5,-3],[22,27,5,-2],
[11,31,7,-2],[12,32,8,-2],[12,31,7,-2],[19,31,7,-1],[25,30,5,-1],[23,31,6,-2],[24,27,2,-1],[24,30,5,-1],
[14,64,114,163,213,263,312,362,
412,461,511,561,610,660,710,759],[48,119,190,260,331,402,472,543],[814,603]]});
org.mathdox.formulaeditor.MathCanvas.addFont(298,
{cmsy10:[[26,3,-9,-3],[5,5,-8,-3],[20,20,0,-6],[16,18,-1,-2],[28,24,2,-2],[20,20,0],[28,28,0,-2],[28,28,7,-2],
[28,28,4,-2],[28,28,4,-2],[28,28,4,-2],[28,28,4,-2],[28,28,4,-2],[37,39,9,-2],[17,17,-2,-2],[17,17,-2,-2],
[28,20,0,-2],[28,18,-1,-2],[26,33,6,-3],[26,33,6,-3],[26,32,6,-3],[26,32,6,-3],[26,32,6,-3],[26,32,6,-3],
[28,10,-5,-2],[28,18,-2,-2],[26,25,2,-3],[26,25,2,-3],[37,27,3,-2],[37,27,3,-2],[26,24,2,-3],[26,24,2,-3],
[37,15,-3,-2],[37,15,-3,-2],[15,37,8,-3],[15,37,8,-3],[37,15,-3,-2],[37,37,8,-2],[37,37,8,-2],[28,18,-1,-2],
[37,23,1,-2],[37,23,1,-2],[23,37,8,-1],[23,37,8,-1],[39,23,1,-1],[37,37,8,-2],[37,37,8,-2],[28,20,1,-2],
[10,22,-1,-1],[37,20,1,-2],[21,25,2,-3],[21,25,2,-3],[32,30,0,-2],[32,30,9,-2],[22,39,9,-5],[3,16,-2,-2],
[23,30,1],[19,29,0,-2],[23,12,-3,-2],[18,36,4,-1],[28,31,1,-2],[27,30,1,-2],[28,28,0,-2],[28,28,0,-2],
[21,29,0,-2],[32,32,2,-1],[27,30,1,-1],[22,30,1],[32,28,0],[23,30,1,-1],[34,30,2],[24,34,5,-1],
[34,30,2],[27,28,0,1],[34,33,5,-1],[29,30,1,-1],[26,30,1,-1],[45,31,2,-1],[42,34,2,2],[30,30,1,-2],
[30,30,2],[29,35,6,-4],[35,29,1],[27,30,1],[32,30,0,-1],[30,30,2,1],[26,30,2,-1],[42,30,2,-1],
[32,28,0,-2],[29,34,6,-1],[31,28,0,-1],[23,26,1,-2],[23,26,1,-2],[23,26,1,-2],[23,26,1,-2],[23,26,1,-2],
[21,29,0,-2],[21,29,0,-2],[11,42,11,-7],[11,42,11],[11,42,11,-7],[10,42,11,-1],[15,42,11,-3],[15,42,11,-3],
[10,42,11,-4],[10,42,11,-2],[3,42,11,-4],[10,42,11,-5],[15,44,12,-3],[23,44,12,-1],[17,42,11,-2],[7,28,4,-2],
[32,42,40,-3],[29,28,0,-1],[31,30,2,-2],[18,39,9,-2],[23,25,0,-2],[23,25,0,-2],[27,33,6,-3],[27,33,6,-2],
[14,38,9,-2],[14,38,9,-2],[14,38,9,-2],[22,37,8,-2],[30,36,6,-1],[28,37,7,-2],[28,32,2,-2],[28,36,6,-2],
[17,77,136,196,255,314,374,433,
493,552,612,671,730,790,849,909],[58,142,227,311,396,481,565,650],[974,721]]});
org.mathdox.formulaeditor.MathCanvas.addFont(358,
{cmsy10:[[30,3,-11,-4],[6,6,-9,-4],[24,24,0,-7],[19,22,-1,-3],[34,28,2,-2],[24,24,0],[34,33,0,-2],[34,34,9,-2],
[34,33,4,-2],[34,33,4,-2],[34,33,4,-2],[34,33,4,-2],[34,33,4,-2],[45,47,11,-2],[20,20,-2,-2],[20,20,-2,-2],
[34,24,0,-2],[34,22,-1,-2],[30,39,7,-4],[30,39,7,-4],[30,38,7,-4],[30,39,7,-4],[30,38,7,-4],[30,39,7,-4],
[34,12,-6,-2],[34,22,-2,-2],[30,29,2,-4],[30,29,2,-4],[45,32,4,-2],[45,32,4,-2],[30,29,2,-4],[30,29,2,-4],
[45,18,-3,-2],[45,18,-3,-2],[18,44,10,-3],[18,44,10,-3],[45,18,-3,-2],[45,45,10,-2],[45,44,10,-2],[34,22,-1,-2],
[45,28,2,-2],[45,28,2,-2],[28,44,10,-1],[28,44,10,-1],[47,28,2,-1],[45,45,10,-2],[45,44,10,-2],[34,23,1,-2],
[12,26,-2,-1],[45,23,1,-2],[25,29,2,-4],[25,29,2,-4],[38,35,0,-3],[39,36,11,-2],[26,46,11,-6],[4,19,-3,-2],
[28,35,1],[23,34,0,-2],[28,14,-4,-2],[21,42,4,-2],[33,38,2,-2],[32,36,1,-2],[34,33,0,-2],[34,33,0,-2],
[26,34,0,-2],[38,39,3,-1],[32,37,2,-1],[27,37,2],[37,34,0,-1],[27,37,2,-1],[41,36,2],[28,41,6,-2],
[39,37,3,-1],[33,34,0,2],[39,40,6,-2],[35,37,2,-1],[31,37,2,-1],[54,38,3,-1],[50,41,3,2],[37,37,2,-2],
[35,37,3,-1],[34,42,7,-5],[40,36,2,-1],[32,37,2],[38,36,0,-1],[35,36,2,1],[32,37,3,-1],[50,37,3,-1],
[38,34,0,-2],[35,41,7,-1],[37,34,0,-1],[28,32,2,-2],[28,31,1,-2],[28,32,2,-2],[28,31,1,-2],[28,31,1,-2],
[25,34,0,-2],[26,34,0,-2],[13,50,13,-8],[13,50,13,-1],[13,50,13,-8],[13,50,13,-1],[18,50,13,-3],[18,50,13,-3],
[12,50,13,-5],[12,50,13,-2],[3,50,13,-5],[12,50,13,-6],[18,52,14,-3],[28,52,14,-1],[20,50,13,-2],[9,33,4,-2],
[39,49,47,-3],[34,34,0,-1],[37,36,2,-2],[21,46,11,-2],[27,30,0,-3],[27,30,0,-3],[31,39,7,-4],[31,39,7,-3],
[16,45,10,-3],[17,46,11,-2],[17,45,10,-2],[27,44,10,-2],[36,43,7,-1],[34,44,8,-2],[34,38,2,-2],[34,43,7,-2],
[21,92,164,235,306,378,449,521,
592,663,735,806,878,949,1020,1092],[68,170,271,373,475,576,678,780],[1170,865]]});
org.mathdox.formulaeditor.MathCanvas.addFont(430,
{cmsy10:[[36,3,-13,-5],[7,7,-11,-5],[30,29,0,-8],[23,26,-2,-3],[40,34,2,-3],[29,29,0],[40,40,0,-3],[40,40,10,-3],
[40,40,5,-3],[40,40,5,-3],[40,40,5,-3],[40,40,5,-3],[40,40,5,-3],[53,56,13,-3],[24,24,-3,-3],[24,24,-3,-3],
[40,28,-1,-3],[40,26,-2,-3],[37,47,9,-4],[37,47,9,-4],[37,47,9,-4],[37,47,9,-4],[37,47,9,-4],[37,47,9,-4],
[40,15,-7,-3],[40,26,-3,-3],[37,35,3,-4],[37,35,3,-4],[53,38,4,-3],[53,38,4,-3],[37,35,3,-4],[37,35,3,-4],
[53,22,-4,-3],[53,22,-4,-3],[22,53,12,-4],[22,53,12,-4],[53,22,-4,-3],[53,53,12,-3],[53,53,12,-3],[40,26,-2,-3],
[53,33,2,-3],[53,33,2,-3],[34,53,12,-1],[34,53,12,-1],[55,33,2,-2],[53,54,12,-3],[53,53,12,-3],[40,28,1,-3],
[15,31,-2,-1],[53,28,1,-3],[31,35,3,-4],[31,35,3,-4],[46,43,0,-3],[46,43,13,-3],[30,56,13,-8],[5,23,-3,-3],
[33,43,2],[27,41,0,-3],[33,16,-5,-3],[25,51,5,-2],[40,45,2,-2],[38,43,1,-3],[40,40,0,-3],[40,40,0,-3],
[30,41,0,-3],[46,46,3,-1],[39,44,2,-1],[32,44,2],[45,41,0,-1],[33,44,2,-1],[48,43,2,-1],[34,49,7,-2],
[48,44,3,-1],[40,41,0,2],[48,48,7,-2],[43,44,2,-1],[38,44,2,-1],[65,45,3,-1],[60,49,3,2],[43,44,2,-3],
[43,44,3,-1],[41,50,8,-6],[49,43,2,-1],[37,44,2,-1],[46,43,0,-1],[42,43,2,1],[37,44,3,-2],[60,44,3,-2],
[45,41,0,-3],[42,49,8,-1],[44,41,0,-2],[33,38,2,-3],[33,38,2,-3],[33,38,2,-3],[33,38,2,-3],[33,38,2,-3],
[30,41,0,-3],[30,41,0,-3],[15,60,15,-10],[15,60,15,-1],[15,60,15,-10],[15,60,15,-1],[22,60,15,-4],[22,60,15,-4],
[14,60,15,-6],[14,60,15,-3],[3,60,15,-7],[15,60,15,-7],[22,62,16,-4],[34,62,16,-1],[24,60,15,-3],[10,40,5,-3],
[47,60,57,-4],[40,41,0,-2],[45,43,2,-2],[25,56,13,-3],[33,36,0,-3],[33,36,0,-3],[38,47,9,-5],[38,47,9,-3],
[18,55,13,-4],[20,55,13,-3],[20,54,12,-3],[32,53,12,-3],[44,51,8,-1],[40,53,10,-3],[40,45,2,-3],[40,51,8,-3],
[25,111,196,282,368,454,539,625,
711,797,882,968,1054,1140,1225,1311],[82,204,326,448,570,692,814,936],[1404,1039]]});
org.mathdox.formulaeditor.MathCanvas.addFont(50,
{cmti10:[[5,5,0],[6,5,0],[5,6,1,-1],[5,5,0],[6,5,0],[6,5,0],[6,5,0],[5,5,0,-1],
[5,5,0,-1],[5,5,0,-1],[6,5,0],[6,7,2],[5,7,2],[5,7,2],[7,7,2],[9,7,2,2],
[3,3,0],[4,5,2,1],[1,2,-3,-2],[2,2,-3,-2],[2,2,-3,-2],[2,2,-3,-2],[2,2,-3,-2],[2,2,-3,-3],
[2,2,2,-1],[4,7,2],[5,3,0],[5,3,0],[4,5,1],[7,5,0],[6,6,1,-1],[8,6,1,2],
[3,1,-2],[3,5,0],[3,2,-3,-1],[5,7,2,-1],[5,5,0],[5,7,1,-1],[6,6,1],[2,2,-3,-1],
[3,7,2,-1],[3,7,2],[3,3,-2,-1],[5,5,1,-1],[2,3,2],[3,1,-1],[2,1,0],[5,8,2],
[4,6,1],[3,5,0,-1],[4,6,1],[4,6,1],[4,7,2],[4,6,1],[4,6,1],[4,5,0,-1],
[4,6,1],[4,6,1],[2,3,0],[2,5,2],[3,6,2],[5,3,0,-1],[3,6,2],[3,5,0,-1],
[5,5,0,-1],[5,5,0],[6,5,0],[5,6,1,-1],[6,5,0],[6,5,0],[6,5,0],[5,6,1,-1],
[6,5,0],[4,5,0],[5,6,1],[6,5,0],[5,5,0],[7,5,0],[6,5,0],[5,6,1,-1],
[5,5,0],[5,7,2,-1],[5,6,1],[5,6,1],[5,5,0,-1],[5,6,1,-1],[5,5,0,-1],[7,5,0,-1],
[8,5,0,2],[5,5,0,-1],[5,5,0],[3,8,2],[2,3,-2,-2],[3,8,2],[2,1,-4,-2],[2,1,-4,-1],
[2,3,-2,-1],[4,3,0],[4,5,0],[4,3,0],[4,5,0],[4,3,0],[4,7,2],[4,5,2],
[4,5,0],[3,5,0],[4,7,2,1],[4,5,0],[2,5,0],[6,3,0],[4,3,0],[4,3,0],
[4,5,2],[4,5,2],[4,3,0],[3,3,0],[3,5,0],[4,3,0],[4,3,0],[5,3,0],
[4,3,0],[4,5,2],[3,3,0],[3,1,-1,-1],[6,1,-1,-1],[6,4,-1,2],[2,1,-4,-2],[2,1,-4,-2],
[3,11,20,28,37,45,54,62,
71,79,88,96,105,113,122,130],[9,17,26,34,42,51,59,67],[140,73]]});
org.mathdox.formulaeditor.MathCanvas.addFont(60,
{cmti10:[[6,6,0],[6,6,0],[6,7,1,-1],[5,6,0],[6,6,0],[7,6,0],[7,6,0],[6,6,0,-1],
[5,6,0,-1],[6,6,0,-1],[6,6,0],[7,8,2,1],[6,8,2,1],[6,8,2,1],[9,8,2,1],[9,8,2,1],
[3,4,0],[4,6,2,1],[2,2,-4,-2],[3,2,-4,-2],[3,1,-4,-2],[3,2,-4,-2],[3,1,-4,-2],[3,2,-4,-3],
[2,2,2,-1],[6,8,2,1],[6,4,0],[6,4,0],[4,5,1],[8,6,0],[8,7,1,-1],[9,7,1,2],
[3,1,-2],[2,6,0,-1],[3,3,-3,-1],[6,8,2,-1],[6,6,0],[6,7,1,-1],[6,7,1,-1],[1,3,-3,-2],
[3,8,2,-1],[3,8,2],[4,4,-2,-1],[5,6,1,-1],[2,3,2],[3,1,-1],[1,1,0,-1],[5,8,2],
[4,7,1,-1],[3,6,0,-1],[5,7,1],[5,7,1],[4,8,2],[5,7,1],[4,7,1,-1],[4,7,1,-1],
[5,7,1],[5,7,1],[2,4,0,-1],[3,6,2],[3,6,2],[6,2,-1,-1],[4,6,2],[4,6,0,-1],
[6,7,1,-1],[6,6,0],[6,6,0],[6,7,1,-1],[7,6,0],[6,6,0],[6,6,0],[6,7,1,-1],
[7,6,0],[4,6,0],[5,7,1],[7,6,0],[5,6,0],[8,6,0],[7,6,0],[6,7,1,-1],
[6,6,0],[6,8,2,-1],[6,7,1],[5,7,1],[6,6,0,-1],[6,7,1,-1],[6,6,0,-1],[8,6,0,-1],
[9,6,0,2],[6,6,0,-1],[6,6,0],[4,8,2],[3,3,-3,-2],[3,8,2],[2,2,-4,-2],[1,2,-4,-2],
[2,3,-3,-1],[5,4,0],[3,6,0,-1],[4,4,0],[5,6,0],[4,4,0],[5,8,2,1],[4,6,2],
[5,6,0],[3,6,0],[4,8,2,1],[4,6,0],[3,6,0],[7,4,0],[5,4,0],[4,4,0],
[4,6,2],[4,6,2],[4,4,0],[4,5,1],[3,5,0],[5,4,0],[4,4,0],[6,4,0],
[4,4,0],[4,6,2],[4,4,0],[4,1,-2,-1],[7,1,-2,-1],[3,2,-4,-2],[3,2,-4,-2],[3,2,-4,-2],
[3,14,24,34,44,54,64,75,
85,95,105,115,126,136,146,156],[11,21,31,41,51,61,71,81],[168,87]]});
org.mathdox.formulaeditor.MathCanvas.addFont(70,
{cmti10:[[7,7,0],[8,7,0],[7,8,1,-1],[7,7,0],[8,7,0],[9,7,0],[7,7,0,-1],[7,7,0,-2],
[7,7,0,-1],[6,7,0,-2],[7,7,0,-1],[9,9,2,1],[7,9,2,1],[8,9,2,1],[11,9,2,1],[11,9,2,1],
[3,5,0,-1],[5,7,2,1],[2,2,-5,-3],[3,2,-5,-3],[3,2,-5,-3],[4,2,-5,-2],[4,1,-5,-2],[3,3,-5,-4],
[3,2,2,-1],[7,9,2,1],[7,6,1,-1],[7,6,1,-1],[6,7,1],[10,7,0],[10,8,1,-1],[10,9,1,2],
[3,2,-2,-1],[3,8,0,-1],[4,3,-4,-2],[8,9,2,-1],[6,8,1,-1],[8,9,1,-1],[7,9,1,-1],[2,3,-4,-2],
[4,10,2,-1],[4,10,2],[4,5,-3,-2],[7,7,1,-1],[3,3,2],[3,2,-1,-1],[2,1,0,-1],[6,10,2],
[5,8,1,-1],[4,7,0,-1],[5,8,1,-1],[5,8,1,-1],[5,9,2],[5,8,1,-1],[5,8,1,-1],[6,8,1,-1],
[5,10,1,-1],[6,10,1],[2,5,0,-1],[3,7,2],[4,7,2],[7,3,-1,-1],[5,7,2],[6,9,0],
[7,8,1,-1],[7,7,0],[8,7,0],[7,8,1,-1],[8,7,0],[8,7,0],[8,7,0],[7,8,1,-1],
[9,7,0],[5,7,0],[6,8,1,-1],[9,7,0],[7,7,0],[10,7,0],[9,7,0],[7,8,1,-1],
[8,7,0],[7,9,2,-1],[8,8,1],[7,8,1],[7,7,0,-1],[7,8,1,-2],[7,8,1,-2],[9,8,1,-2],
[11,7,0,2],[7,7,0,-2],[7,7,0],[5,10,2],[4,3,-4,-2],[3,10,2,-1],[4,2,-5,-2],[2,2,-5,-2],
[2,3,-4,-2],[5,6,1,-1],[4,8,1,-1],[4,6,1,-1],[5,8,1,-1],[4,6,1,-1],[6,9,2,1],[5,7,2],
[6,7,0],[3,7,0,-1],[5,9,2,1],[5,9,0],[2,7,0,-1],[9,9,0],[5,5,0,-1],[4,6,1,-1],
[5,7,2],[4,7,2,-1],[4,5,0,-1],[5,5,0],[3,7,0,-1],[5,6,1,-1],[4,6,1,-1],[6,6,1,-1],
[6,6,1],[4,7,2,-1],[5,5,0],[5,1,-2,-1],[10,1,-2,-1],[8,5,-2,2],[4,2,-5,-2],[4,2,-5,-2],
[4,16,28,40,51,63,75,87,
99,111,123,135,146,158,170,182],[13,24,36,47,59,71,82,94],[195,102]]});
org.mathdox.formulaeditor.MathCanvas.addFont(85,
{cmti10:[[9,9,0],[8,9,0,-1],[9,10,1,-1],[8,9,0],[8,9,0,-1],[10,9,0],[9,9,0,-1],[8,9,0,-2],
[8,9,0,-1],[8,9,0,-2],[8,9,0,-1],[10,12,3,1],[9,12,3,1],[9,12,3,1],[12,12,3,1],[13,12,3,1],
[3,7,1,-1],[5,9,3,1],[3,3,-6,-3],[3,3,-6,-4],[4,2,-6,-3],[4,3,-6,-3],[4,2,-6,-3],[3,3,-6,-5],
[3,3,3,-1],[8,12,3,1],[8,7,1,-1],[8,7,1,-1],[6,8,1,-1],[12,9,0],[10,10,1,-2],[13,10,1,3],
[3,2,-3,-1],[4,9,0,-1],[5,5,-4,-2],[9,12,3,-1],[8,10,1,-1],[9,10,1,-1],[9,10,1,-1],[3,5,-4,-2],
[5,12,3,-1],[5,12,3],[5,5,-4,-2],[8,8,1,-1],[2,5,3,-1],[3,1,-2,-1],[2,2,0,-1],[8,12,3],
[6,9,1,-1],[5,8,0,-1],[6,9,1,-1],[6,9,1,-1],[6,11,3],[6,9,1,-1],[6,9,1,-1],[7,9,1,-1],
[6,9,1,-1],[6,9,1,-1],[3,6,0,-1],[3,9,3,-1],[4,9,3],[9,4,-1,-1],[5,9,3,-1],[5,9,0,-2],
[9,10,1,-1],[9,9,0],[9,9,0],[9,10,1,-1],[10,9,0],[9,9,0],[9,9,0],[9,10,1,-1],
[10,9,0],[6,9,0],[7,10,1,-1],[10,9,0],[8,9,0],[12,9,0],[10,9,0],[9,10,1,-1],
[9,9,0],[9,12,3,-1],[9,10,1],[7,10,1,-1],[8,9,0,-2],[8,10,1,-2],[9,10,1,-2],[10,10,1,-2],
[13,9,0,3],[9,9,0,-2],[8,9,0,-1],[5,12,3,-1],[5,5,-4,-3],[6,12,3,1],[4,3,-6,-3],[2,2,-6,-3],
[3,5,-4,-2],[6,7,1,-1],[5,10,1,-1],[5,7,1,-1],[6,10,1,-1],[5,7,1,-1],[7,12,3,1],[6,9,3],
[6,9,0,-1],[3,9,1,-1],[6,11,3,1],[5,10,1,-1],[3,9,0,-1],[9,7,1,-1],[6,7,1,-1],[6,7,1,-1],
[7,9,3],[5,9,3,-1],[5,6,0,-1],[4,7,1,-1],[4,9,1,-1],[6,7,1,-1],[5,7,1,-1],[8,7,1,-1],
[7,7,1],[6,9,3,-1],[6,7,1],[6,1,-3,-1],[11,1,-3,-1],[10,6,-3,3],[4,2,-6,-3],[4,2,-6,-3],
[5,19,34,48,62,77,91,106,
120,135,149,163,178,192,207,221],[16,30,45,59,73,87,101,115],[237,125]]});
org.mathdox.formulaeditor.MathCanvas.addFont(100,
{cmti10:[[9,10,0,-1],[10,10,0,-1],[9,11,1,-2],[9,10,0],[10,10,0,-1],[11,10,0,-1],[10,10,0,-1],[9,10,0,-3],
[9,10,0,-2],[9,10,0,-3],[10,10,0,-1],[12,13,3,1],[10,13,3,1],[10,13,3,1],[14,13,3,1],[15,13,3,1],
[4,8,1,-1],[6,10,3,1],[2,3,-7,-4],[4,3,-7,-4],[4,2,-7,-4],[4,3,-7,-4],[5,2,-7,-3],[4,3,-7,-6],
[4,3,3,-1],[9,13,3,1],[9,8,1,-1],[9,8,1,-1],[7,10,2,-1],[13,10,0,-1],[13,11,1,-2],[15,12,1,3],
[4,2,-4,-1],[5,10,0,-1],[6,5,-5,-2],[11,13,3,-1],[9,11,1,-1],[10,12,1,-2],[11,11,1,-1],[3,5,-5,-3],
[6,15,4,-2],[6,15,4],[6,7,-4,-2],[9,9,1,-2],[3,5,3,-1],[4,2,-2,-1],[2,2,0,-1],[9,15,4],
[7,11,1,-1],[6,10,0,-1],[7,11,1,-1],[7,11,1,-1],[7,13,3],[7,11,1,-1],[7,11,1,-1],[7,11,1,-2],
[7,11,1,-1],[7,11,1,-1],[4,6,0,-1],[4,9,3,-1],[5,10,3],[10,5,-1,-1],[6,10,3,-1],[6,10,0,-2],
[9,11,1,-2],[9,10,0,-1],[10,10,0,-1],[10,11,1,-2],[10,10,0,-1],[10,10,0,-1],[10,10,0,-1],[10,11,1,-2],
[11,10,0,-1],[7,10,0],[8,11,1,-1],[11,10,0,-1],[8,10,0,-1],[13,10,0,-1],[11,10,0,-1],[9,11,1,-2],
[10,10,0,-1],[9,13,3,-2],[9,11,1,-1],[8,11,1,-1],[10,10,0,-2],[10,11,1,-2],[9,11,1,-3],[12,11,1,-3],
[15,10,0,3],[10,10,0,-3],[9,10,0,-1],[6,15,4,-1],[6,5,-5,-3],[6,15,4,1],[5,3,-7,-3],[2,2,-8,-3],
[3,5,-5,-2],[7,8,1,-1],[6,11,1,-1],[6,8,1,-1],[7,11,1,-1],[6,8,1,-1],[8,13,3,1],[7,10,3],
[7,11,1,-1],[4,11,1,-1],[6,13,3,1],[6,11,1,-1],[4,11,1,-1],[11,8,1,-1],[8,8,1,-1],[7,8,1,-1],
[8,10,3],[6,10,3,-1],[6,8,1,-1],[5,8,1,-1],[5,10,1,-1],[7,8,1,-1],[6,8,1,-1],[9,8,1,-1],
[8,8,1],[7,10,3,-1],[6,8,1,-1],[7,1,-3,-1],[14,1,-3,-1],[11,7,-3,3],[5,2,-8,-3],[5,2,-8,-3],
[6,23,40,56,73,90,107,124,
141,158,175,192,209,226,243,260],[19,36,52,69,85,102,119,135],[279,146]]});
org.mathdox.formulaeditor.MathCanvas.addFont(120,
{cmti10:[[11,12,0,-1],[12,12,0,-1],[12,13,1,-2],[10,13,0,-1],[12,12,0,-1],[14,12,0,-1],[13,12,0,-1],[12,12,0,-3],
[11,12,0,-2],[11,12,0,-3],[12,12,0,-1],[14,16,4,1],[12,16,4,1],[12,16,4,1],[17,16,4,1],[17,16,4,1],
[5,9,1,-1],[7,12,4,1],[3,4,-8,-5],[5,4,-8,-5],[5,3,-8,-4],[6,4,-8,-4],[6,1,-9,-4],[4,4,-9,-8],
[5,4,4,-1],[11,16,4,1],[12,9,1,-1],[12,9,1,-1],[9,11,2,-1],[15,12,0,-1],[16,13,1,-2],[17,14,1,3],
[5,3,-4,-1],[5,13,0,-2],[6,6,-6,-3],[12,16,4,-2],[11,13,1,-1],[13,14,1,-2],[12,14,1,-2],[4,6,-6,-3],
[7,17,4,-2],[7,17,4],[7,8,-5,-3],[11,11,1,-2],[3,6,4,-1],[5,2,-3,-1],[2,2,0,-2],[11,17,4],
[8,13,1,-2],[6,12,0,-2],[9,13,1,-1],[9,13,1,-1],[8,16,4],[9,13,1,-1],[8,13,1,-2],[9,13,1,-2],
[9,13,1,-1],[9,13,1,-1],[4,8,0,-2],[5,12,4,-1],[5,13,4,-1],[12,5,-2,-2],[7,13,4,-1],[7,13,0,-3],
[12,13,1,-2],[11,13,0,-1],[12,12,0,-1],[12,13,1,-2],[13,12,0,-1],[12,12,0,-1],[12,12,0,-1],[12,13,1,-2],
[14,12,0,-1],[8,12,0,-1],[10,13,1,-1],[14,12,0,-1],[10,12,0,-1],[16,12,0,-1],[14,12,0,-1],[12,13,1,-2],
[12,12,0,-1],[12,16,4,-2],[12,13,1,-1],[10,13,1,-1],[11,12,0,-3],[12,13,1,-3],[12,13,1,-3],[16,13,1,-3],
[17,12,0,3],[12,12,0,-3],[11,12,0,-1],[7,17,4,-1],[7,6,-6,-4],[7,17,4,1],[5,3,-9,-4],[3,3,-9,-4],
[3,6,-6,-3],[8,9,1,-1],[6,13,1,-2],[7,9,1,-1],[9,13,1,-1],[6,9,1,-2],[9,16,4,1],[8,12,4,-1],
[8,13,1,-1],[5,12,1,-1],[7,16,4,1],[8,13,1,-1],[5,13,1,-1],[14,9,1,-1],[9,9,1,-1],[8,9,1,-1],
[9,12,4],[8,12,4,-1],[8,9,1,-1],[6,9,1,-1],[6,12,1,-1],[9,9,1,-1],[8,9,1,-1],[11,9,1,-1],
[8,9,1,-1],[8,12,4,-1],[7,9,1,-1],[9,1,-4,-1],[16,1,-4,-2],[13,8,-4,3],[6,3,-9,-4],[6,3,-9,-4],
[7,27,47,68,88,109,129,149,
170,190,210,231,251,271,292,312],[22,42,61,81,101,121,141,161],[335,175]]});
org.mathdox.formulaeditor.MathCanvas.addFont(144,
{cmti10:[[13,14,0,-1],[14,15,0,-1],[13,16,1,-3],[12,15,0,-1],[14,14,0,-1],[16,14,0,-1],[15,14,0,-1],[13,15,0,-4],
[12,14,0,-3],[13,14,0,-4],[14,15,0,-2],[17,19,4,1],[13,19,4,1],[14,19,4,1],[20,20,5,1],[20,20,5,1],
[6,10,1,-1],[8,13,4,1],[4,4,-10,-5],[5,4,-10,-6],[6,3,-10,-5],[7,4,-10,-5],[8,1,-11,-4],[5,5,-10,-9],
[5,4,4,-2],[13,19,4,1],[14,10,1,-1],[13,10,1,-2],[10,13,2,-1],[18,14,0,-1],[18,16,1,-3],[15,17,2,-2],
[5,3,-5,-2],[6,15,0,-2],[8,6,-8,-3],[15,18,4,-2],[13,16,1,-1],[14,17,2,-3],[14,16,1,-2],[4,6,-8,-4],
[8,20,5,-3],[8,20,5],[8,9,-6,-4],[12,13,2,-3],[4,7,4,-1],[6,2,-3,-1],[3,3,0,-2],[13,20,5],
[10,15,1,-2],[8,14,0,-2],[10,15,1,-1],[11,15,1,-1],[9,18,4,-1],[10,15,1,-2],[10,15,1,-2],[10,15,1,-3],
[9,15,1,-2],[9,15,1,-2],[4,9,0,-2],[5,13,4,-1],[6,15,5,-1],[14,6,-2,-2],[8,15,5,-1],[8,15,0,-3],
[13,16,1,-3],[13,15,0,-1],[14,14,0,-1],[14,16,1,-3],[15,14,0,-1],[14,14,0,-1],[14,14,0,-1],[14,16,1,-3],
[16,14,0,-1],[9,14,0,-1],[12,15,1,-1],[17,14,0,-1],[12,14,0,-1],[19,14,0,-1],[16,14,0,-1],[13,16,1,-3],
[14,14,0,-1],[13,19,4,-3],[14,15,1,-1],[12,16,1,-1],[13,14,0,-3],[13,15,1,-4],[14,15,1,-4],[18,15,1,-4],
[21,14,0,4],[14,14,0,-4],[13,14,0,-1],[8,20,5,-1],[8,7,-7,-5],[9,20,5,1],[6,4,-10,-5],[3,3,-11,-5],
[4,6,-8,-4],[9,10,1,-2],[8,15,1,-2],[8,10,1,-2],[10,15,1,-2],[8,10,1,-2],[10,19,4,1],[9,14,5,-1],
[10,15,1,-1],[6,14,1,-1],[9,18,4,1],[9,15,1,-1],[5,15,1,-1],[16,10,1,-1],[11,10,1,-1],[9,10,1,-2],
[11,13,4],[8,13,4,-2],[9,10,1,-1],[8,10,1,-1],[7,14,1,-1],[11,10,1,-1],[9,10,1,-1],[13,10,1,-1],
[10,10,1,-1],[10,13,4,-1],[9,10,1,-1],[9,1,-5,-2],[19,1,-5,-2],[7,4,-10,-5],[7,3,-11,-5],[6,3,-11,-5],
[8,32,57,81,106,130,155,179,
204,228,252,277,301,326,350,375],[26,50,74,98,122,145,169,193],[402,209]]});
org.mathdox.formulaeditor.MathCanvas.addFont(173,
{cmti10:[[16,17,0,-1],[17,18,0,-1],[16,18,1,-3],[15,18,0,-1],[17,17,0,-1],[20,17,0,-1],[17,17,0,-2],[15,17,0,-5],
[15,17,0,-3],[15,17,0,-5],[17,17,0,-2],[20,22,5,1],[16,22,5,1],[17,22,5,1],[23,22,5,1],[24,22,5,1],
[6,12,1,-2],[9,16,5,1],[4,5,-12,-7],[6,5,-12,-8],[7,3,-12,-6],[8,5,-12,-6],[9,2,-13,-5],[5,5,-13,-11],
[6,5,5,-2],[15,22,5,1],[16,12,1,-2],[16,12,1,-2],[13,16,3,-1],[22,17,0,-1],[23,18,1,-3],[24,20,2,4],
[7,4,-6,-2],[7,18,0,-2],[9,8,-9,-4],[18,22,5,-2],[15,18,1,-2],[18,20,2,-3],[17,19,1,-3],[4,8,-9,-5],
[10,24,6,-3],[10,24,6],[10,11,-7,-4],[15,16,2,-3],[5,8,5,-1],[7,2,-4,-2],[4,3,0,-2],[15,24,6],
[12,17,1,-2],[9,16,0,-2],[12,17,1,-2],[12,17,1,-2],[11,21,5,-1],[12,17,1,-2],[12,17,1,-2],[12,17,1,-3],
[12,17,1,-2],[12,17,1,-2],[6,11,0,-2],[7,16,5,-1],[7,18,6,-1],[17,6,-3,-2],[9,18,6,-2],[10,18,0,-4],
[16,18,1,-3],[16,18,0,-1],[17,17,0,-1],[17,18,1,-3],[18,17,0,-1],[17,17,0,-1],[17,17,0,-1],[17,18,1,-3],
[20,17,0,-1],[11,17,0,-1],[13,18,1,-2],[20,17,0,-1],[14,17,0,-1],[23,17,0,-1],[20,17,0,-1],[16,18,1,-3],
[17,17,0,-1],[16,22,5,-3],[17,18,1,-1],[15,18,1,-1],[16,17,0,-4],[17,18,1,-4],[16,18,1,-5],[22,18,1,-5],
[24,17,0,4],[16,17,0,-5],[15,17,0,-2],[10,24,6,-1],[9,8,-9,-6],[10,24,6,1],[7,4,-13,-6],[3,3,-13,-6],
[4,8,-9,-5],[11,12,1,-2],[9,18,1,-2],[10,12,1,-2],[12,18,1,-2],[10,12,1,-2],[12,22,5,1],[11,16,5,-1],
[12,18,1,-1],[6,17,1,-2],[10,21,5,1],[11,18,1,-1],[6,18,1,-2],[19,12,1,-2],[12,12,1,-2],[11,12,1,-2],
[13,16,5],[10,16,5,-2],[10,12,1,-2],[9,12,1,-1],[7,16,1,-2],[12,12,1,-2],[10,12,1,-2],[15,12,1,-2],
[12,12,1,-1],[11,16,5,-2],[10,12,1,-1],[12,1,-6,-2],[22,1,-6,-3],[8,5,-12,-6],[8,3,-13,-6],[8,3,-13,-6],
[10,39,68,98,127,156,186,215,
245,274,303,333,362,391,421,450],[32,61,90,118,147,176,204,233],[482,253]]});
org.mathdox.formulaeditor.MathCanvas.addFont(207,
{cmti10:[[20,20,0,-1],[20,21,0,-2],[19,22,1,-4],[18,21,0,-1],[20,20,0,-2],[24,20,0,-1],[21,20,0,-2],[19,21,0,-6],
[18,20,0,-4],[18,20,0,-6],[20,21,0,-2],[23,27,6,1],[19,27,6,1],[20,27,6,1],[28,27,6,1],[29,27,6,1],
[8,14,1,-2],[11,19,6,1],[5,7,-14,-8],[6,7,-14,-10],[8,5,-14,-8],[9,5,-15,-8],[11,2,-16,-6],[7,6,-15,-13],
[7,6,6,-3],[18,27,6,1],[19,14,1,-2],[18,14,1,-3],[14,19,3,-2],[27,20,0,-1],[27,22,1,-4],[21,24,2,-3],
[8,4,-8,-2],[8,21,0,-3],[10,10,-11,-5],[21,27,6,-3],[19,22,1,-2],[21,24,2,-4],[21,22,1,-3],[5,10,-11,-6],
[11,30,8,-4],[12,30,8],[12,13,-9,-5],[18,18,2,-4],[5,9,6,-2],[8,2,-5,-2],[4,3,0,-3],[18,30,8],
[14,21,1,-3],[11,20,0,-3],[14,21,1,-2],[15,21,1,-2],[13,26,6,-1],[14,21,1,-3],[14,21,1,-3],[14,21,1,-4],
[14,21,1,-2],[13,21,1,-3],[6,13,0,-3],[7,19,6,-2],[9,22,7,-1],[20,8,-3,-3],[11,22,7,-2],[11,21,0,-5],
[19,22,1,-4],[19,21,0,-1],[20,20,0,-2],[20,22,1,-4],[22,20,0,-1],[21,20,0,-1],[21,20,0,-1],[20,22,1,-4],
[24,20,0,-1],[14,20,0,-1],[16,21,1,-2],[24,20,0,-1],[17,20,0,-1],[27,20,0,-2],[24,20,0,-1],[19,22,1,-4],
[21,20,0,-1],[19,27,6,-4],[20,21,1,-1],[17,22,1,-2],[19,20,0,-5],[20,21,1,-5],[20,21,1,-6],[27,21,1,-6],
[28,20,0,4],[21,20,0,-5],[19,20,0,-2],[11,30,8,-2],[10,9,-11,-8],[12,30,8,1],[8,5,-15,-7],[4,4,-16,-7],
[5,9,-11,-6],[13,14,1,-3],[11,22,1,-3],[11,14,1,-3],[14,22,1,-3],[11,14,1,-3],[15,27,6,1],[14,19,6,-1],
[14,22,1,-2],[8,20,1,-2],[12,25,6,1],[13,22,1,-2],[7,22,1,-2],[23,14,1,-2],[15,14,1,-2],[12,14,1,-3],
[15,19,6],[12,19,6,-3],[13,14,1,-2],[11,14,1,-2],[9,20,1,-2],[15,14,1,-2],[13,14,1,-2],[19,14,1,-2],
[14,14,1,-1],[13,19,6,-2],[12,14,1,-2],[14,1,-7,-2],[27,1,-7,-3],[10,7,-14,-7],[10,4,-16,-7],[9,4,-16,-7],
[12,47,82,117,152,187,222,257,
293,328,363,398,433,468,503,539],[37,72,106,140,175,209,243,278],[577,301]]});
org.mathdox.formulaeditor.MathCanvas.addFont(249,
{cmti10:[[22,24,0,-2],[24,25,0,-2],[22,25,1,-5],[20,25,0,-2],[24,23,0,-2],[27,24,0,-2],[25,24,0,-2],[22,24,0,-7],
[20,24,0,-5],[21,24,0,-7],[23,24,0,-3],[27,31,7,1],[22,31,7,1],[23,31,7,1],[33,31,7,1],[33,31,7,1],
[10,16,1,-2],[13,22,7,2],[6,7,-17,-9],[8,7,-17,-11],[10,5,-17,-9],[11,7,-17,-9],[12,1,-19,-8],[7,7,-18,-16],
[9,7,7,-3],[21,31,7,1],[22,16,1,-3],[22,16,1,-3],[17,23,4,-2],[31,24,0,-2],[31,25,1,-5],[24,28,2,-4],
[9,5,-9,-3],[10,25,0,-3],[12,11,-13,-6],[25,31,7,-4],[21,25,1,-3],[24,28,2,-5],[24,26,1,-4],[6,11,-13,-7],
[13,35,9,-5],[13,35,9],[14,16,-10,-6],[22,21,2,-4],[6,11,7,-2],[9,3,-6,-3],[5,4,0,-3],[21,35,9],
[15,24,1,-4],[12,23,0,-4],[17,24,1,-2],[17,24,1,-3],[15,30,7,-1],[17,24,1,-3],[16,24,1,-4],[17,24,1,-5],
[16,24,1,-3],[16,24,1,-3],[8,15,0,-3],[9,22,7,-2],[9,25,8,-2],[23,9,-4,-4],[13,25,8,-2],[13,25,0,-6],
[22,25,1,-5],[22,25,0,-2],[23,24,0,-2],[23,25,1,-5],[25,24,0,-2],[24,24,0,-2],[23,24,0,-2],[23,25,1,-5],
[27,24,0,-2],[15,24,0,-2],[19,25,1,-3],[28,24,0,-2],[20,24,0,-2],[32,24,0,-2],[27,24,0,-2],[22,25,1,-5],
[23,24,0,-2],[22,31,7,-5],[23,25,1,-2],[20,25,1,-2],[22,23,0,-6],[23,25,1,-6],[23,25,1,-7],[31,25,1,-7],
[33,24,0,5],[24,24,0,-6],[22,24,0,-2],[13,35,9,-2],[12,11,-13,-9],[14,35,9,1],[9,6,-18,-9],[5,4,-19,-8],
[6,11,-13,-7],[16,16,1,-3],[13,25,1,-3],[13,16,1,-3],[16,25,1,-3],[13,16,1,-3],[17,31,7,1],[16,22,7,-1],
[17,25,1,-2],[10,24,-294,-2],[15,30,7,2],[15,25,1,-2],[8,25,1,-3],[27,16,1,-2],[18,16,1,-2],[15,16,1,-3],
[18,22,7],[14,22,7,-3],[15,16,1,-2],[13,16,1,-2],[10,23,1,-3],[17,16,1,-2],[15,16,1,-2],[22,16,1,-2],
[17,16,1,-1],[16,22,7,-2],[14,16,1,-2],[16,2,-8,-3],[32,2,-8,-4],[11,7,-17,-9],[12,4,-19,-8],[10,4,-19,-9],
[14,56,98,141,183,225,267,310,
352,394,437,479,521,563,606,648],[46,87,128,170,211,253,294,335],[694,363]]});
org.mathdox.formulaeditor.MathCanvas.addFont(298,
{cmti10:[[27,28,0,-2],[28,30,0,-3],[27,30,1,-6],[25,30,0,-2],[28,28,0,-3],[33,28,0,-2],[29,28,0,-3],[27,29,0,-8],
[24,28,0,-6],[26,28,0,-8],[28,29,0,-4],[32,38,9,1],[26,38,9,1],[27,38,9,1],[39,38,9,1],[40,38,9,1],
[11,20,1,-3],[16,28,9,2],[6,9,-20,-12],[9,9,-20,-14],[11,6,-20,-11],[13,8,-21,-11],[15,3,-22,-9],[9,8,-22,-19],
[10,8,8,-4],[25,38,9,1],[27,20,1,-3],[26,20,1,-4],[21,27,5,-2],[37,28,0,-2],[37,30,1,-6],[30,34,3,-4],
[11,5,-11,-3],[12,30,0,-4],[14,13,-16,-7],[30,37,8,-4],[26,30,1,-3],[29,34,3,-6],[28,31,1,-5],[7,13,-16,-9],
[16,42,11,-6],[16,42,11],[16,18,-13,-8],[26,26,3,-5],[7,13,8,-3],[11,3,-7,-3],[6,5,0,-4],[26,42,11],
[19,29,1,-4],[15,28,0,-4],[20,29,1,-3],[20,29,1,-3],[19,36,8,-1],[20,29,1,-4],[20,29,1,-4],[20,29,1,-6],
[19,29,1,-4],[19,29,1,-4],[9,18,0,-4],[10,26,8,-3],[12,30,9,-2],[28,10,-5,-4],[16,30,9,-3],[15,30,0,-8],
[27,30,1,-6],[27,30,0,-2],[29,28,0,-2],[28,30,1,-6],[30,28,0,-2],[29,28,0,-2],[28,28,0,-2],[28,30,1,-6],
[33,28,0,-2],[19,28,0,-2],[23,29,1,-3],[34,28,0,-2],[24,28,0,-2],[39,28,0,-2],[33,28,0,-2],[27,30,1,-6],
[28,28,0,-2],[27,37,8,-6],[28,29,1,-2],[23,30,1,-3],[26,28,0,-7],[27,29,1,-8],[28,29,1,-8],[37,29,1,-8],
[40,28,0,6],[28,28,0,-8],[26,28,0,-3],[16,42,11,-3],[14,13,-16,-11],[16,42,11,1],[11,7,-22,-11],[5,5,-23,-10],
[7,13,-16,-8],[18,20,1,-4],[15,30,1,-4],[16,20,1,-4],[19,30,1,-4],[16,20,1,-4],[20,38,9,1],[18,28,9,-2],
[19,30,1,-3],[11,28,1,-3],[17,36,9,2],[18,30,1,-3],[10,30,1,-3],[32,20,1,-3],[21,20,1,-3],[17,20,1,-4],
[21,27,8],[17,27,8,-4],[17,20,1,-3],[15,20,1,-3],[13,27,1,-3],[20,20,1,-3],[18,20,1,-3],[26,20,1,-3],
[20,20,1,-2],[19,28,9,-3],[17,20,1,-2],[20,2,-10,-3],[38,2,-10,-5],[13,9,-20,-11],[14,5,-23,-10],[12,5,-23,-11],
[17,67,118,168,219,270,320,371,
421,472,522,573,624,674,725,775],[55,104,154,203,253,302,352,401],[831,434]]});
org.mathdox.formulaeditor.MathCanvas.addFont(358,
{cmti10:[[32,34,0,-3],[34,35,0,-3],[32,37,2,-7],[30,35,0,-2],[34,34,0,-3],[39,34,0,-3],[35,34,0,-4],[31,35,0,-10],
[29,34,0,-7],[31,34,0,-10],[34,35,0,-4],[40,45,10,2],[32,45,10,2],[34,45,10,2],[47,45,10,2],[49,45,10,2],
[13,23,1,-4],[18,32,10,2],[8,10,-24,-14],[11,11,-24,-16],[14,7,-24,-13],[15,9,-25,-13],[17,2,-27,-11],[10,9,-26,-23],
[12,10,10,-5],[30,45,10,1],[32,23,1,-4],[31,23,1,-5],[24,33,6,-3],[45,34,0,-2],[44,37,2,-8],[36,40,3,-5],
[13,7,-13,-4],[14,35,0,-5],[18,15,-19,-8],[36,44,10,-5],[31,36,1,-4],[35,40,3,-7],[34,37,2,-6],[9,15,-19,-10],
[19,50,13,-7],[18,50,13,-1],[20,22,-15,-9],[31,31,3,-6],[8,16,10,-3],[13,3,-9,-4],[6,6,0,-5],[30,50,13,-1],
[23,35,2,-5],[18,33,0,-5],[23,34,1,-4],[24,35,2,-4],[22,43,10,-2],[23,34,1,-5],[23,34,1,-5],[24,34,1,-7],
[24,35,2,-4],[23,34,1,-5],[10,22,0,-5],[12,32,10,-3],[14,36,11,-2],[33,12,-6,-5],[18,36,11,-4],[18,35,0,-9],
[32,36,1,-7],[32,35,0,-2],[33,34,0,-3],[33,37,2,-7],[35,34,0,-3],[34,34,0,-3],[33,34,0,-3],[33,37,2,-7],
[39,34,0,-3],[23,34,0,-2],[27,36,2,-4],[39,34,0,-3],[28,34,0,-3],[46,34,0,-3],[39,34,0,-3],[32,37,2,-7],
[33,34,0,-3],[32,45,10,-7],[33,36,2,-3],[28,37,2,-3],[32,34,0,-8],[33,36,2,-9],[33,35,1,-10],[45,36,2,-10],
[48,34,0,7],[34,34,0,-9],[31,34,0,-4],[19,50,13,-3],[17,15,-19,-13],[19,50,13,1],[13,8,-26,-13],[6,6,-27,-12],
[8,15,-19,-10],[22,23,1,-5],[18,35,1,-5],[18,23,1,-5],[23,35,1,-5],[18,23,1,-5],[25,45,10,2],[22,32,10,-2],
[24,35,1,-3],[13,34,1,-4],[20,43,10,2],[22,35,1,-3],[11,35,1,-4],[38,23,1,-4],[25,23,1,-4],[20,23,1,-5],
[25,32,10],[20,32,10,-5],[20,23,1,-4],[18,23,1,-3],[15,32,1,-4],[24,23,1,-4],[21,23,1,-4],[31,23,1,-4],
[24,23,1,-2],[22,32,10,-4],[20,23,1,-3],[23,2,-12,-4],[45,2,-12,-6],[16,11,-24,-13],[16,6,-27,-12],[14,6,-27,-13],
[20,81,141,202,263,324,385,445,
506,567,628,688,749,810,871,932],[64,124,183,243,302,362,421,481],[998,521]]});
org.mathdox.formulaeditor.MathCanvas.addFont(430,
{cmti10:[[39,41,0,-3],[41,43,0,-4],[39,44,2,-8],[35,43,0,-3],[41,40,0,-4],[48,41,0,-3],[43,41,0,-4],[38,42,0,-12],
[34,41,0,-9],[37,41,0,-12],[40,42,0,-5],[47,55,13,2],[38,55,13,2],[40,55,13,2],[56,55,13,2],[58,55,13,2],
[15,28,1,-5],[21,39,13,2],[9,12,-29,-17],[13,12,-29,-20],[16,9,-29,-16],[18,11,-30,-16],[21,2,-33,-13],[12,12,-31,-28],
[14,12,12,-6],[37,55,13,2],[38,28,1,-5],[37,28,1,-6],[29,39,7,-4],[53,41,0,-3],[53,44,2,-9],[42,48,4,-7],
[16,8,-16,-5],[17,43,0,-6],[21,18,-23,-10],[43,53,12,-6],[37,43,1,-5],[42,49,4,-8],[41,45,2,-7],[9,18,-23,-13],
[22,60,15,-9],[22,60,15,-1],[24,27,-18,-11],[37,37,4,-8],[10,19,12,-4],[15,4,-11,-5],[7,7,0,-6],[36,60,15,-1],
[27,42,2,-6],[21,40,0,-7],[28,42,2,-5],[29,42,2,-5],[26,52,12,-2],[28,42,2,-6],[27,42,2,-7],[29,42,2,-8],
[28,42,2,-5],[27,42,2,-6],[12,26,0,-6],[14,38,12,-4],[16,43,13,-3],[40,15,-7,-6],[21,43,13,-5],[22,43,0,-11],
[39,43,1,-8],[38,43,0,-3],[41,41,0,-3],[40,44,2,-8],[43,41,0,-3],[41,41,0,-3],[41,41,0,-3],[40,44,2,-8],
[48,41,0,-3],[27,41,0,-3],[32,43,2,-5],[48,41,0,-3],[34,41,0,-3],[56,41,0,-4],[48,41,0,-3],[39,44,2,-8],
[40,41,0,-3],[39,54,12,-8],[40,43,2,-3],[34,44,2,-4],[38,40,0,-10],[40,43,2,-11],[40,43,2,-12],[54,43,2,-12],
[57,41,0,8],[40,41,0,-12],[38,41,0,-4],[23,60,15,-4],[20,18,-23,-16],[23,60,15,996],[16,10,-31,-15],[7,7,-33,-15],
[10,18,-23,-12],[26,27,1,-6],[21,42,1,-6],[22,28,1,-6],[27,42,1,-6],[22,28,1,-6],[29,54,12,2],[26,39,13,-3],
[28,42,1,-4],[15,40,1,-5],[23,52,13,2],[26,42,1,-4],[13,42,1,-5],[45,28,1,-5],[30,28,1,-5],[24,28,1,-6],
[31,38,12],[24,38,12,-6],[24,28,1,-5],[21,28,1,-4],[17,38,1,-5],[28,28,1,-5],[25,28,1,-5],[37,28,1,-5],
[28,28,1,-3],[26,40,13,-5],[25,28,1,-3],[28,2,-15,-5],[55,2,-15,-7],[18,11,-30,-16],[20,7,-33,-14],[17,7,-33,-16],
[24,97,170,243,316,389,462,535,
608,681,754,827,900,973,1046,1119],[77,149,220,292,363,434,506,577],[1198,625]]});
org.mathdox.formulaeditor.MathCanvas.addFont(50,
{bbold10:[[4,5,0],[4,5,0],[4,5,0],[4,5,0],[4,5,0],[4,5,0],[4,5,0],[4,5,0],
[4,5,0],[4,5,0],[4,5,0],[4,3,0],[4,7,2],[3,5,2],[3,5,0],[3,3,0],
[3,7,2],[4,5,2],[3,5,0],[2,3,0],[4,3,0],[3,5,0],[4,5,2],[4,3,0],
[3,7,2],[4,3,0],[4,5,2],[4,3,0],[3,3,0],[4,3,0],[3,7,2],[3,5,2],
[3,7,2],[2,5,0],[4,3,-2],[5,7,2],[4,7,1],[4,8,2],[5,5,0],[2,3,-2],
[3,8,2],[2,8,2],[4,5,1],[5,5,1],[2,4,2],[3,1,-1],[2,2,0],[4,8,2],
[4,5,0],[4,5,0],[4,5,0],[4,5,0],[4,5,0],[4,7,0],[4,5,0],[4,5,0],
[4,5,0],[4,5,0],[2,3,0],[2,5,2],[5,5,1],[2,2,-1],[5,5,1],[6,5,0,2],
[4,5,0],[4,5,0],[4,5,0],[4,5,0],[5,5,0],[4,5,0],[4,5,0],[4,5,0],
[5,5,0],[2,5,0],[4,5,0],[4,5,0],[4,5,0],[5,5,0],[5,5,0],[6,5,0,2],
[4,5,0],[4,7,2],[4,5,0],[4,5,0],[4,5,0],[5,5,0],[4,5,0],[6,5,0],
[6,5,0,2],[4,5,0],[4,5,0],[3,8,2],[4,8,2],[2,8,2],[3,8,2],[2,8,2],
[2,3,-2],[3,3,0],[4,5,0],[3,3,0],[3,5,0],[3,3,0],[3,5,0],[3,5,2],
[4,5,0],[2,5,0],[3,7,2],[4,5,0],[2,5,0],[5,3,0],[4,3,0],[3,3,0],
[4,5,2],[3,5,2],[4,3,0],[3,3,0],[3,5,0],[4,3,0],[3,3,0],[5,3,0],
[3,3,0],[3,5,2],[3,3,0],[3,1,-1],[2,8,2],[6,1,-1],[6,4,-1,2],[5,3,0],
[3,10,16,23,30,37,44,51,
58,65,72,79,86,93,100,106],[9,18,27,36,45,54,63,72],[114,79]]});
org.mathdox.formulaeditor.MathCanvas.addFont(60,
{bbold10:[[5,6,0],[5,6,0],[5,6,0],[5,6,0],[5,6,0],[5,6,0],[5,6,0],[5,6,0],
[5,6,0],[5,6,0],[5,6,0],[5,4,0],[4,8,2],[4,6,2],[4,6,0],[4,4,0],
[3,8,2],[4,6,2],[4,6,0],[2,4,0],[4,4,0],[4,6,0],[4,6,2],[4,4,0],
[3,8,2],[4,4,0],[4,6,2],[5,4,0],[4,4,0],[4,4,0],[4,8,2],[4,6,2],
[4,8,2],[2,6,0],[4,4,-2],[6,8,2],[5,8,1],[5,10,3],[6,6,0],[2,4,-2],
[3,9,2],[2,9,2],[5,6,1],[6,6,1],[2,4,2],[3,1,-1],[2,2,0],[5,9,2],
[4,6,0],[4,6,0],[4,6,0],[4,6,0],[4,6,0],[4,6,0],[4,6,0],[4,6,0],
[4,6,0],[4,6,0],[2,4,0],[2,6,2],[6,6,1],[2,2,-1],[6,6,1],[5,6,0],
[4,6,0],[5,6,0],[5,6,0],[5,6,0],[5,6,0],[5,6,0],[5,6,0],[5,6,0],
[5,6,0],[2,6,0],[5,6,0],[5,6,0],[5,6,0],[6,6,0],[5,6,0],[5,6,0],
[5,6,0],[5,8,2],[5,6,0],[5,6,0],[5,6,0],[5,6,0],[5,6,0],[7,6,0],
[5,6,0],[5,6,0],[5,6,0],[3,9,2],[5,9,2],[2,9,2],[3,9,2],[2,9,2],
[2,4,-2],[4,4,0],[5,6,0],[4,4,0],[4,6,0],[4,4,0],[3,6,0],[4,6,2],
[4,6,0],[2,6,0],[3,8,2],[4,6,0],[2,6,0],[6,4,0],[4,4,0],[4,4,0],
[5,6,2],[4,6,2],[4,4,0],[3,4,0],[3,6,0],[4,4,0],[4,4,0],[6,4,0],
[4,4,0],[4,6,2],[4,4,0],[4,1,-2],[2,9,2],[7,1,-2],[6,4,-2,2],[6,4,0],
[3,11,20,28,36,45,53,61,
70,78,86,95,103,111,119,128],[11,22,33,43,54,65,76,87],[137,94]]});
org.mathdox.formulaeditor.MathCanvas.addFont(70,
{bbold10:[[6,7,0],[6,7,0],[6,8,1],[6,7,0],[6,7,0],[6,7,0],[6,7,0],[6,7,0],
[6,7,0],[6,7,0],[6,7,0],[5,6,1],[5,9,2],[5,8,3],[5,8,1],[5,6,1],
[4,9,2],[5,7,2],[5,8,1],[3,5,0],[5,5,0],[5,7,0],[5,7,2],[5,5,0],
[4,9,2],[5,5,0],[5,7,2],[5,6,1],[5,5,0],[5,6,1],[5,9,2],[5,7,2],
[5,9,2],[3,8,1],[5,4,-3],[7,9,2],[6,9,1],[6,11,3],[7,8,1],[3,4,-3],
[4,11,3],[3,11,3],[7,7,1],[7,7,1],[3,4,2],[4,1,-2],[3,3,1],[5,11,3],
[5,8,1],[5,7,0],[5,7,0],[5,8,1],[5,7,0],[5,8,1],[5,8,1],[5,7,0],
[5,8,1],[5,8,1],[3,6,1],[3,7,2],[8,6,1],[3,3,-1],[7,6,1,-1],[6,8,1],
[5,8,1],[6,7,0],[6,7,0],[6,8,1],[7,7,0],[6,7,0],[6,7,0],[6,8,1],
[7,7,0],[3,7,0],[6,8,1],[6,7,0],[6,7,0],[7,7,0],[7,7,0],[6,8,1],
[6,7,0],[6,9,2],[6,7,0],[6,8,1],[6,7,0],[7,8,1],[6,7,0],[8,7,0],
[8,7,0,2],[6,7,0],[6,7,0],[4,11,3],[5,11,3],[3,11,3],[4,11,3],[3,11,3],
[3,4,-3],[5,6,1],[6,8,1],[5,6,1],[5,8,1],[5,6,1],[4,7,0],[5,8,3],
[5,7,0],[3,7,0],[4,10,3],[5,7,0],[3,7,0],[7,5,0],[5,5,0],[5,6,1],
[6,7,2],[5,7,2],[5,5,0],[4,6,1],[4,8,1],[5,6,1],[5,5,0],[7,5,0],
[5,5,0],[5,8,3],[5,5,0],[4,1,-2],[3,11,3],[8,1,-2],[7,5,-2,2],[7,6,1],
[4,13,23,33,42,52,62,72,
81,91,101,110,120,130,139,149],[13,25,38,51,63,76,89,101],[160,110]]});
org.mathdox.formulaeditor.MathCanvas.addFont(85,
{bbold10:[[7,8,0],[7,8,0],[7,10,1],[7,8,0],[7,8,0],[7,8,0],[7,8,0],[7,9,0],
[7,8,0],[7,8,0],[7,9,0],[7,7,1],[6,12,3],[6,8,3],[6,10,1],[6,7,1],
[5,12,3],[6,9,3],[6,10,1],[3,5,0],[6,5,0],[6,9,0],[6,8,3],[6,5,0],
[5,12,3],[6,5,0],[6,9,3],[7,6,1],[6,5,0],[6,6,1],[6,12,3],[6,8,3],
[6,12,3],[3,9,1],[6,5,-4],[9,11,3],[7,10,1],[7,13,4],[9,10,1],[3,5,-4],
[4,12,3],[4,12,3],[8,8,1],[9,8,1],[3,6,3],[5,1,-2],[3,4,1],[7,12,3],
[6,9,1],[6,8,0],[6,8,0],[6,9,1],[6,8,0],[6,9,1],[6,9,1],[6,8,0],
[6,9,1],[6,9,1],[3,7,1],[3,9,3],[9,7,1],[3,4,-1],[8,7,1,-1],[7,10,1],
[6,10,1],[7,8,0],[7,8,0],[7,10,1],[8,8,0],[7,8,0],[7,8,0],[7,10,1],
[8,8,0],[3,8,0],[7,9,1],[7,8,0],[7,8,0],[8,8,0],[8,8,0],[7,10,1],
[7,8,0],[7,12,3],[7,8,0],[7,10,1],[7,8,0],[8,9,1],[7,8,0],[10,8,0],
[7,8,0],[7,8,0],[7,8,0],[4,12,3],[7,12,3],[4,12,3],[4,12,3],[4,12,3],
[3,6,-3],[6,7,1],[7,10,1],[6,7,1],[6,10,1],[6,7,1],[5,9,0],[6,9,3],
[6,9,0],[3,8,0],[5,11,3],[6,9,0],[3,9,0],[8,6,0],[6,6,0],[6,7,1],
[7,9,3],[6,9,3],[6,6,0],[5,7,1],[5,10,1],[6,6,1],[6,5,0],[8,5,0],
[6,5,0],[6,8,3],[6,5,0],[5,2,-2],[3,12,3],[10,2,-2],[6,6,-3],[8,6,1],
[5,16,28,40,52,63,75,87,
99,110,122,134,146,157,169,181],[17,32,47,63,78,93,109,124],[194,135]]});
org.mathdox.formulaeditor.MathCanvas.addFont(100,
{bbold10:[[7,10,0,-1],[8,10,0],[9,11,1],[8,10,0],[8,10,0,-1],[7,10,0,-1],[9,10,0],[8,10,0],
[9,10,0],[8,10,0],[9,10,0],[8,8,1],[8,13,3],[6,9,3],[6,11,1],[6,8,1],
[6,13,3],[8,10,3],[6,11,1],[3,6,0],[8,6,0],[6,10,0],[8,9,3],[7,6,0],
[6,13,3],[7,6,0],[7,10,3],[8,7,1],[6,6,0],[7,7,1],[6,13,3],[6,9,3],
[7,13,3],[4,11,1],[8,6,-4],[10,13,3],[8,13,2],[8,16,5],[10,11,1],[4,6,-4],
[4,15,4,-1],[4,15,4],[8,10,2,-1],[10,10,2],[4,6,3],[5,2,-2],[4,4,1],[8,15,4],
[7,11,1],[6,9,0,-1],[7,10,0],[7,11,1],[7,9,0],[7,10,1],[7,11,1],[7,9,0],
[7,11,1],[7,11,1],[4,8,1],[4,10,3],[10,9,1,-1],[4,3,-2],[10,9,1,-1],[8,11,1],
[7,11,1],[8,10,0],[7,10,0,-1],[9,11,1],[8,10,0,-1],[7,10,0,-1],[7,10,0,-1],[9,11,1],
[8,10,0,-1],[3,10,0,-1],[8,11,1],[7,10,0,-1],[7,10,0,-1],[8,10,0,-1],[8,10,0,-1],[9,11,1],
[7,10,0,-1],[9,13,3],[7,10,0,-1],[8,11,1],[8,10,0],[8,11,1,-1],[8,10,0],[12,10,0],
[12,10,0,3],[8,10,0],[9,10,0],[4,15,4,-1],[8,15,4],[4,15,4],[4,15,4,-1],[4,15,4],
[4,6,-4],[6,8,1],[9,11,1],[6,8,1],[6,11,1],[6,8,1],[6,10,0],[6,10,3],
[8,10,0],[4,10,0],[5,13,3],[8,10,0],[3,10,0],[10,7,0],[8,7,0],[6,8,1],
[9,10,3],[6,10,3],[8,7,0],[5,8,1],[6,11,1],[7,7,1],[7,6,0],[9,6,0],
[6,6,0],[7,9,3],[6,6,0],[6,1,-3],[3,15,4,-1],[11,1,-3],[8,6,-4],[9,7,1],
[5,19,33,47,61,74,88,102,
116,130,144,158,171,185,199,213],[19,37,55,73,92,110,128,146],[228,158]]});
org.mathdox.formulaeditor.MathCanvas.addFont(120,
{bbold10:[[9,12,0,-1],[10,12,0],[10,13,1],[10,12,0],[10,12,0],[9,12,0,-1],[10,12,0],[10,12,0],
[10,12,0],[10,12,0],[10,12,0],[9,9,1],[9,16,4],[8,12,4],[8,13,1],[8,9,1],
[7,16,4],[9,12,4],[8,13,1],[4,8,0],[9,8,0],[8,12,0],[9,12,4],[8,8,0],
[7,16,4],[8,8,0],[8,12,4],[9,9,1],[7,8,0],[8,9,1],[7,16,4],[8,12,4],
[8,16,4],[4,13,1,-1],[9,7,-5],[12,16,4],[9,15,2],[10,19,6],[12,13,1],[4,7,-5],
[5,18,5,-1],[5,18,5],[11,12,2],[12,12,2],[4,7,4],[6,1,-3],[4,4,1],[9,18,5],
[9,12,1],[8,11,0],[9,11,0],[9,12,1],[9,11,0],[9,12,1],[9,12,1],[9,11,0],
[9,12,1],[9,12,1],[4,9,1],[4,12,4],[12,10,1,-1],[4,4,-2],[12,10,1,-1],[9,13,1],
[8,13,1],[10,12,0],[9,12,0,-1],[10,13,1],[10,12,0,-1],[9,12,0,-1],[9,12,0,-1],[10,13,1],
[10,12,0,-1],[3,12,0,-1],[9,13,1],[9,12,0,-1],[9,12,0,-1],[10,12,0,-1],[10,12,0,-1],[10,13,1],
[9,12,0,-1],[10,16,4],[9,12,0,-1],[9,13,1],[10,12,0],[10,13,1,-1],[10,12,0],[13,12,0],
[10,12,0],[10,12,0],[10,12,0],[5,18,5,-1],[9,18,5],[5,18,5],[5,18,5,-1],[5,18,5],
[4,7,-5],[8,9,1],[10,13,1],[8,9,1],[8,13,1],[8,9,1],[7,12,0],[8,12,4],
[9,12,0],[4,12,0],[6,16,4],[9,12,0],[4,12,0],[11,8,0],[9,8,0],[8,9,1],
[10,12,4],[8,12,4],[9,8,0],[6,9,1],[7,13,1],[8,9,1],[7,8,0],[11,8,0],
[8,8,0],[7,12,4],[8,8,0],[7,1,-4],[3,18,5,-1],[14,1,-4],[9,7,-5],[11,9,1],
[6,23,40,56,73,89,106,123,
139,156,172,189,206,222,239,255],[22,44,65,87,109,130,152,174],[274,189]]});
org.mathdox.formulaeditor.MathCanvas.addFont(144,
{bbold10:[[11,14,0,-1],[12,14,0],[11,15,1,-1],[12,14,0],[12,14,0,-1],[11,14,0,-1],[11,14,0,-1],[12,14,0],
[12,14,0,-1],[12,14,0],[11,14,0,-1],[11,10,1],[10,18,4,-1],[9,13,4],[9,15,1],[9,10,1],
[7,18,4,-1],[10,13,4,-1],[9,15,1],[4,9,0,-1],[10,9,0,-1],[9,14,0],[10,13,4,-1],[9,9,0,-1],
[7,18,4,-1],[10,9,0],[9,13,4,-1],[11,10,1],[9,9,0],[9,10,1,-1],[9,18,4],[9,13,4],
[9,18,4,-1],[4,15,1,-1],[11,8,-6],[14,18,4,-1],[10,18,2,-1],[11,23,7],[14,15,1,-1],[5,8,-6],
[6,20,5,-1],[6,20,5],[12,14,2,-1],[14,14,2,-1],[5,8,4],[8,1,-4],[5,5,1],[11,20,5],
[9,14,1,-1],[9,13,0,-1],[9,13,0,-1],[9,14,1,-1],[9,13,0,-1],[9,14,1,-1],[9,14,1,-1],[9,13,0,-1],
[9,14,1,-1],[9,14,1,-1],[5,10,1],[5,13,4],[14,12,1,-1],[5,4,-3],[14,12,1,-1],[10,15,1,-1],
[9,15,1,-1],[12,14,0],[11,14,0,-1],[11,15,1,-1],[12,14,0,-1],[11,14,0,-1],[11,14,0,-1],[11,15,1,-1],
[12,14,0,-1],[4,14,0,-1],[10,15,1,-1],[11,14,0,-1],[11,14,0,-1],[12,14,0,-1],[12,14,0,-1],[11,15,1,-1],
[11,14,0,-1],[11,18,4,-1],[11,14,0,-1],[10,15,1,-1],[12,14,0],[12,15,1,-1],[12,14,0],[16,14,0],
[11,14,0,-1],[12,14,0],[11,14,0,-1],[6,20,5,-1],[11,20,5],[6,20,5],[6,20,5,-1],[6,20,5],
[5,8,-6],[9,10,1],[11,15,1,-1],[9,10,1],[9,15,1],[9,10,1],[7,14,0,-1],[9,13,4],
[10,14,0,-1],[5,14,0],[7,18,4],[10,14,0,-1],[4,14,0,-1],[13,9,0,-1],[10,9,0,-1],[9,10,1],
[11,13,4,-1],[9,13,4],[10,9,0,-1],[8,10,1],[7,15,1,-1],[9,10,1,-1],[9,9,0],[13,9,0],
[9,9,0],[9,13,4],[9,9,0],[9,2,-4],[4,20,5,-1],[16,2,-4],[11,8,-6],[13,10,1],
[8,28,47,67,87,107,127,147,
167,187,207,227,247,267,287,307],[26,52,78,104,130,156,182,208],[329,226]]});
org.mathdox.formulaeditor.MathCanvas.addFont(173,
{bbold10:[[13,17,0,-1],[14,17,0],[14,18,1,-1],[14,17,0],[14,17,0,-1],[13,17,0,-1],[14,17,0,-1],[14,17,0],
[14,17,0,-1],[14,17,0],[14,17,0,-1],[13,12,1],[12,22,5,-1],[11,16,5],[11,18,1],[11,12,1],
[9,22,5,-1],[12,16,5,-1],[11,18,1],[5,11,0,-1],[12,11,0,-1],[11,17,0],[12,16,5,-1],[11,11,0,-1],
[9,22,5,-1],[12,11,0],[11,16,5,-1],[13,12,1],[11,11,0],[11,12,1,-1],[11,22,5],[11,16,5],
[11,22,5,-1],[5,18,1,-1],[12,9,-8,-1],[17,22,5,-1],[13,21,2,-1],[13,27,8,-1],[17,18,1,-1],[5,9,-8,-1],
[7,24,6,-1],[7,24,6],[15,16,2,-1],[17,16,2,-1],[5,10,5,-1],[9,2,-4],[5,6,1,-1],[13,24,6],
[11,17,1,-1],[11,16,0,-1],[11,16,0,-1],[11,17,1,-1],[11,16,0,-1],[11,17,1,-1],[11,17,1,-1],[11,16,0,-1],
[11,17,1,-1],[11,17,1,-1],[5,12,1,-1],[5,16,5,-1],[17,14,1,-1],[5,6,-3,-1],[17,14,1,-1],[13,18,1,-1],
[11,18,1,-1],[14,17,0],[13,17,0,-1],[14,18,1,-1],[14,17,0,-1],[13,17,0,-1],[13,17,0,-1],[14,18,1,-1],
[14,17,0,-1],[5,17,0,-1],[13,18,1,-1],[13,17,0,-1],[13,17,0,-1],[15,17,0,-1],[14,17,0,-1],[14,18,1,-1],
[13,17,0,-1],[14,22,5,-1],[13,17,0,-1],[13,18,1,-1],[14,17,0],[14,18,1,-1],[14,17,0],[19,17,0],
[14,17,0,-1],[14,17,0],[14,17,0,-1],[7,24,6,-1],[13,24,6],[7,24,6],[7,24,6,-1],[7,24,6],
[5,10,-7,-1],[11,12,1],[14,18,1,-1],[11,12,1],[11,18,1],[11,12,1],[9,17,0,-1],[11,16,5],
[12,17,0,-1],[5,17,0,-1],[9,22,5],[12,17,0,-1],[5,17,0,-1],[15,11,0,-1],[12,11,0,-1],[11,12,1],
[14,16,5,-1],[11,16,5],[12,11,0,-1],[9,12,1],[9,18,1,-1],[11,12,1,-1],[11,11,0],[15,11,0],
[11,11,0],[11,16,5],[11,11,0],[10,2,-5],[5,24,6,-1],[19,2,-5],[12,10,-7,-1],[15,12,1],
[9,33,57,81,105,129,153,177,
201,225,249,273,296,320,344,368],[33,64,95,126,158,189,220,251],[395,273]]});
org.mathdox.formulaeditor.MathCanvas.addFont(207,
{bbold10:[[15,20,0,-2],[17,20,0],[17,21,1,-1],[17,20,0],[17,20,0,-1],[15,20,0,-2],[17,20,0,-1],[17,20,0],
[17,20,0,-1],[17,20,0],[17,20,0,-1],[16,14,1],[14,27,6,-1],[13,19,6],[13,22,1],[13,14,1],
[10,26,6,-1],[14,19,6,-1],[13,22,1],[6,13,0,-1],[14,13,0,-1],[13,20,0],[14,19,6,-1],[13,13,0,-1],
[10,26,6,-1],[14,13,0],[13,19,6,-1],[16,14,1],[13,13,0],[13,14,1,-1],[13,26,6],[13,19,6],
[13,26,6,-1],[7,21,1,-1],[14,12,-9,-1],[20,26,6,-1],[15,25,3,-1],[16,32,10,-1],[20,21,1,-1],[6,12,-9,-1],
[8,30,8,-2],[8,30,8],[17,20,3,-1],[20,20,3,-1],[6,12,6,-1],[11,2,-5],[6,7,1,-1],[15,30,8],
[14,20,1,-1],[13,19,0,-1],[14,19,0,-1],[14,20,1,-1],[14,19,0,-1],[14,20,1,-1],[14,20,1,-1],[14,19,0,-1],
[14,20,1,-1],[14,20,1,-1],[6,14,1,-1],[6,19,6,-1],[20,16,1,-2],[6,7,-4,-1],[20,16,1,-2],[15,21,1,-1],
[14,21,1,-1],[17,20,0],[15,20,0,-2],[17,21,1,-1],[17,20,0,-2],[15,20,0,-2],[15,20,0,-2],[17,21,1,-1],
[17,20,0,-2],[6,20,0,-2],[15,21,1,-1],[15,20,0,-2],[15,20,0,-2],[16,20,0,-2],[17,20,0,-2],[17,21,1,-1],
[15,20,0,-2],[17,26,6,-1],[15,20,0,-2],[15,21,1,-1],[17,20,0],[17,21,1,-2],[17,20,0],[23,20,0],
[17,20,0,-1],[17,20,0],[17,20,0,-1],[8,30,8,-2],[15,30,8],[8,30,8],[8,30,8,-2],[8,30,8],
[6,11,-9,-1],[13,14,1],[16,21,1,-1],[13,14,1],[13,21,1],[13,14,1],[10,21,0,-1],[13,19,6],
[14,20,0,-1],[6,20,0,-1],[10,26,6],[14,20,0,-1],[6,20,0,-1],[19,13,0,-1],[14,13,0,-1],[13,14,1],
[16,19,6,-1],[13,19,6],[14,13,0,-1],[11,14,1],[10,21,1,-1],[13,14,1,-1],[13,13,0],[19,13,0],
[13,13,0],[13,19,6],[13,13,0],[12,2,-6],[6,30,8,-2],[23,2,-6],[14,11,-9,-1],[19,14,1],
[11,40,68,97,126,154,183,211,
240,269,297,326,355,383,412,441],[38,75,113,150,187,225,262,299],[472,325]]});
org.mathdox.formulaeditor.MathCanvas.addFont(249,
{bbold10:[[18,24,0,-2],[20,24,0],[20,25,1,-1],[20,24,0],[20,24,0,-1],[18,24,0,-2],[20,24,0,-1],[20,24,0],
[20,24,0,-1],[20,24,0],[20,24,0,-1],[18,17,1],[17,32,7,-1],[15,23,8],[15,26,1],[15,17,1],
[13,31,7,-1],[17,23,7,-1],[15,26,1],[7,15,0,-1],[17,15,0,-1],[15,24,0],[17,22,7,-1],[15,15,0,-1],
[13,31,7,-1],[17,15,0],[15,23,7,-1],[18,16,1],[16,15,0],[15,16,1,-1],[16,31,7],[15,22,7],
[16,31,7,-1],[8,25,1,-2],[17,14,-11,-1],[24,31,7,-1],[18,30,3,-1],[19,39,12,-1],[24,25,1,-1],[8,14,-11,-1],
[10,35,9,-2],[10,35,9],[21,23,3,-1],[24,23,3,-1],[8,14,7,-1],[13,3,-6],[8,8,1,-1],[18,35,9],
[16,24,1,-1],[17,23,0,-1],[16,23,0,-1],[16,24,1,-1],[16,23,0,-1],[16,24,1,-1],[16,24,1,-1],[16,23,0,-1],
[16,24,1,-1],[16,24,1,-1],[8,17,1,-1],[8,23,7,-1],[24,19,1,-2],[8,8,-5,-1],[24,19,1,-2],[18,25,1,-1],
[16,25,1,-1],[20,24,0],[18,24,0,-2],[20,25,1,-1],[20,24,0,-2],[18,24,0,-2],[18,24,0,-2],[20,25,1,-1],
[20,24,0,-2],[7,24,0,-2],[18,25,1,-1],[18,24,0,-2],[18,24,0,-2],[20,24,0,-2],[20,24,0,-2],[20,25,1,-1],
[18,24,0,-2],[20,31,7,-1],[18,24,0,-2],[18,25,1,-1],[20,24,0],[20,25,1,-2],[20,24,0],[28,24,0],
[20,24,0,-1],[20,24,0],[20,24,0,-1],[10,35,9,-2],[18,35,9],[10,35,9],[10,35,9,-2],[10,35,9],
[8,13,-11,-1],[15,17,1],[20,25,1,-1],[15,17,1],[15,25,1],[15,17,1],[13,25,0,-1],[15,24,8],
[17,24,0,-1],[8,24,0,-1],[12,32,8],[17,24,0,-1],[7,24,0,-1],[22,16,0,-1],[17,16,0,-1],[15,17,1],
[20,23,7,-1],[15,23,7],[17,16,0,-1],[13,17,1],[13,25,1,-1],[15,16,1,-1],[16,15,0],[22,15,0],
[15,15,0],[16,23,8],[15,15,0],[15,2,-8],[7,35,9,-2],[28,2,-8],[17,13,-11,-1],[22,16,1],
[13,48,82,117,151,185,220,254,
289,323,358,392,427,461,496,530],[47,92,137,182,226,271,316,361],[568,392]]});
org.mathdox.formulaeditor.MathCanvas.addFont(298,
{bbold10:[[21,29,0,-3],[23,29,0,-1],[24,30,1,-2],[23,29,0,-1],[23,29,0,-2],[21,29,0,-3],[24,29,0,-2],[23,29,0,-1],
[24,29,0,-2],[23,29,0,-1],[24,29,0,-2],[21,20,1,-1],[20,38,8,-2],[18,27,9,-1],[18,31,1,-1],[18,20,1,-1],
[14,37,8,-2],[20,27,8,-2],[18,31,1,-1],[8,18,0,-2],[20,18,0,-2],[18,29,0,-1],[20,26,8,-2],[18,18,0,-2],
[14,37,8,-2],[19,18,0,-1],[18,27,8,-2],[21,19,1,-1],[17,18,0,-1],[18,19,1,-2],[17,37,8,-1],[18,26,8,-1],
[18,37,8,-2],[9,30,1,-2],[21,17,-13,-1],[28,37,8,-2],[21,36,4,-2],[23,46,14,-1],[28,30,1,-2],[9,17,-13,-1],
[11,42,11,-3],[11,42,11,-1],[25,28,4,-2],[28,28,4,-2],[9,16,8,-1],[14,2,-8,-1],[9,9,1,-1],[21,42,11,-1],
[19,28,1,-2],[19,27,0,-2],[19,27,0,-2],[19,28,1,-2],[19,27,0,-2],[19,28,1,-2],[19,28,1,-2],[19,27,0,-2],
[19,28,1,-2],[19,28,1,-2],[9,20,1,-1],[9,27,8,-1],[28,23,1,-3],[9,9,-6,-1],[28,23,1,-3],[21,30,1,-2],
[19,30,1,-2],[23,29,0,-1],[21,29,0,-3],[24,30,1,-2],[24,29,0,-3],[21,29,0,-3],[21,29,0,-3],[24,30,1,-2],
[24,29,0,-3],[8,29,0,-3],[21,30,1,-2],[21,29,0,-3],[21,29,0,-3],[23,29,0,-3],[24,29,0,-3],[24,30,1,-2],
[21,29,0,-3],[24,37,8,-2],[21,29,0,-3],[21,30,1,-2],[23,29,0,-1],[24,30,1,-3],[23,29,0,-1],[33,29,0,-1],
[24,29,0,-2],[23,29,0,-1],[24,29,0,-2],[11,42,11,-3],[21,42,11,-1],[11,42,11,-1],[11,42,11,-3],[11,42,11,-1],
[9,16,-13,-1],[18,20,1,-1],[23,30,1,-2],[18,20,1,-1],[18,30,1,-1],[18,20,1,-1],[14,30,0,-2],[18,28,9,-1],
[20,29,0,-2],[9,28,0,-1],[15,37,9],[20,29,0,-2],[8,29,0,-2],[26,19,0,-2],[20,19,0,-2],[18,20,1,-1],
[23,27,8,-2],[18,27,8,-1],[20,19,0,-2],[14,20,1,-1],[14,30,1,-2],[18,19,1,-2],[18,18,0,-1],[26,18,0,-1],
[18,18,0,-1],[18,27,9,-1],[18,18,0,-1],[16,2,-10,-1],[8,42,11,-3],[32,2,-10,-1],[21,16,-13,-1],[26,19,1,-1],
[16,57,98,140,181,222,263,304,
346,387,428,469,511,552,593,634],[56,110,163,217,271,325,378,432],[680,469]]});
org.mathdox.formulaeditor.MathCanvas.addFont(358,
{bbold10:[[25,34,0,-4],[28,34,0,-1],[29,36,1,-2],[28,34,0,-1],[29,34,0,-2],[25,34,0,-4],[29,34,0,-2],[28,35,0,-1],
[29,34,0,-2],[28,34,0,-1],[29,35,0,-2],[26,23,1,-1],[24,46,10,-2],[21,33,11,-1],[21,37,1,-1],[21,23,1,-1],
[18,45,10,-2],[24,32,10,-2],[21,37,1,-1],[9,22,0,-2],[24,22,0,-2],[21,35,0,-1],[24,32,10,-2],[22,22,0,-2],
[18,45,10,-2],[23,22,0,-1],[22,32,10,-2],[26,23,1,-1],[21,22,0,-1],[22,23,1,-2],[21,45,10,-1],[21,32,10,-1],
[22,45,10,-2],[10,35,1,-3],[24,20,-16,-2],[34,44,10,-2],[26,43,5,-2],[27,55,17,-2],[34,36,1,-2],[10,20,-16,-2],
[13,51,13,-4],[13,51,13,-1],[30,34,5,-2],[34,34,5,-2],[10,19,10,-2],[17,3,-9,-1],[10,10,1,-2],[25,51,13,-1],
[23,34,1,-2],[23,32,0,-2],[23,33,0,-2],[23,34,1,-2],[23,32,0,-2],[23,33,1,-2],[23,34,1,-2],[23,32,0,-2],
[23,34,1,-2],[23,34,1,-2],[10,23,1,-2],[10,32,10,-2],[33,27,1,-4],[10,11,-7,-2],[33,27,1,-4],[26,36,1,-2],
[23,36,1,-2],[28,34,0,-1],[25,34,0,-4],[29,36,1,-2],[28,34,0,-4],[25,34,0,-4],[25,34,0,-4],[29,36,1,-2],
[28,34,0,-4],[9,34,0,-4],[26,35,1,-2],[25,34,0,-4],[25,34,0,-4],[28,34,0,-4],[28,34,0,-4],[29,36,1,-2],
[25,34,0,-4],[29,45,10,-2],[25,34,0,-4],[26,36,1,-2],[28,34,0,-1],[28,35,1,-4],[28,34,0,-1],[39,34,0,-1],
[29,34,0,-2],[28,34,0,-1],[29,34,0,-2],[13,51,13,-4],[25,51,13,-1],[13,51,13,-1],[13,51,13,-4],[13,51,13,-1],
[10,20,-15,-2],[21,23,1,-1],[28,36,1,-2],[21,23,1,-1],[21,36,1,-1],[21,23,1,-1],[18,36,0,-2],[21,33,11,-1],
[24,35,0,-2],[10,34,0,-2],[18,45,11],[24,35,0,-2],[9,35,0,-2],[32,22,0,-2],[24,22,0,-2],[21,23,1,-1],
[28,32,10,-2],[21,32,10,-1],[24,22,0,-2],[17,23,1,-1],[18,36,1,-2],[22,23,1,-2],[21,22,0,-1],[31,22,0,-1],
[21,22,0,-1],[21,33,11,-1],[21,22,0,-1],[20,2,-12,-1],[9,51,13,-4],[39,2,-12,-1],[24,20,-15,-2],[31,23,1,-1],
[19,69,118,168,217,267,316,366,
415,465,514,564,614,663,713,762],[66,130,195,260,324,389,453,518],[816,563]]});
org.mathdox.formulaeditor.MathCanvas.addFont(430,
{bbold10:[[31,41,0,-4],[34,41,0,-1],[34,43,1,-3],[34,41,0,-1],[34,41,0,-3],[31,41,0,-4],[34,41,0,-3],[34,42,0,-1],
[34,41,0,-3],[34,41,0,-1],[34,42,0,-3],[31,28,1,-1],[28,54,12,-3],[26,39,13,-1],[26,43,1,-1],[26,28,1,-1],
[20,54,12,-3],[28,39,12,-3],[26,43,1,-1],[11,26,0,-3],[28,26,0,-3],[26,42,0,-1],[28,38,12,-3],[25,26,0,-3],
[20,54,12,-3],[28,26,0,-1],[25,39,12,-3],[31,27,1,-1],[26,26,0,-1],[25,27,1,-3],[26,54,12,-1],[26,38,12,-1],
[26,54,12,-3],[12,42,1,-4],[29,23,-19,-2],[40,53,12,-3],[30,51,5,-3],[32,66,20,-2],[40,43,1,-3],[12,23,-19,-2],
[16,60,15,-4],[16,60,15,-1],[35,40,5,-3],[40,40,5,-3],[12,23,12,-2],[21,3,-11,-1],[12,12,1,-2],[31,60,15,-1],
[27,40,1,-3],[27,39,0,-3],[27,39,0,-3],[27,40,1,-3],[27,39,0,-3],[27,40,1,-3],[27,40,1,-3],[27,39,0,-3],
[27,40,1,-3],[27,40,1,-3],[12,28,1,-2],[12,39,12,-2],[41,33,2,-4],[12,12,-9,-2],[41,33,2,-4],[30,43,1,-3],
[27,43,1,-3],[34,41,0,-1],[31,41,0,-4],[34,43,1,-3],[34,41,0,-4],[31,41,0,-4],[31,41,0,-4],[34,43,1,-3],
[34,41,0,-4],[11,41,0,-4],[30,42,1,-3],[31,41,0,-4],[31,41,0,-4],[34,41,0,-4],[34,41,0,-4],[34,43,1,-3],
[31,41,0,-4],[34,54,12,-3],[31,41,0,-4],[30,43,1,-3],[34,41,0,-1],[34,42,1,-4],[34,41,0,-1],[47,41,0,-1],
[34,41,0,-3],[34,41,0,-1],[34,41,0,-3],[16,60,15,-4],[31,60,15,-1],[16,60,15,-1],[16,60,15,-4],[16,60,15,-1],
[12,23,-19,-2],[26,28,1,-1],[33,43,1,-3],[26,28,1,-1],[26,43,1,-1],[26,28,1,-1],[20,42,0,-3],[26,40,13,-1],
[28,42,0,-3],[12,41,0,-2],[21,54,13],[28,42,0,-3],[11,42,0,-3],[37,27,0,-3],[28,27,0,-3],[26,28,1,-1],
[33,39,12,-3],[26,39,12,-1],[28,27,0,-3],[21,28,1,-1],[20,43,1,-3],[25,27,1,-3],[26,26,0,-1],[37,26,0,-1],
[26,26,0,-1],[26,39,13,-1],[26,26,0,-1],[24,3,-14,-1],[11,60,15,-4],[47,3,-14,-1],[29,23,-19,-2],[37,27,1,-1],
[23,82,142,201,261,320,380,439,
499,558,618,677,737,796,856,915],[79,157,234,312,389,467,544,622],[980,675]]});
});
|
'use strict';
var d3 = d3;
var stackedHorizontalBarChart = {};
stackedHorizontalBarChart.draw = function(parent) {
var _data = null,
chartWidth = 300,
barHeight = 28,
_mouseClick = function() {},
_selection = d3.select(parent);
function component() {
_selection.each(function(data) {
var parentColumn = _selection.node().parentNode.parentNode.parentNode;
var parentHeight = parseInt(d3.select(_selection.node().parentNode.parentNode.parentNode).style('height'), 10);
var chartPadding = (parentHeight - barHeight) / 2;
// Zip the series data together (first values, second values, etc.)
var zippedData = [
_data.graphData.inversion
];
// Color scale
var color = d3.scale.category20();
// Specify the chart area and dimensions
var chart = _selection.append('svg')
.attr('width', '100%')
.attr('height', barHeight);
var chart_X = parseInt(chart.style('width'), 10);
var chart_Y = parseInt(chart.style('height'), 10);
var width_ = _data.graphData.inversion;
var percentage = _data.graphData.inversion * 100 / _data.graphTotalData.inversion;
var x = d3
.scale
.linear()
.domain([0, _data.graphTotalData.inversion])
.range([0, chart_X]);
// Create bars
var canvas = chart.selectAll('g')
.data(zippedData)
.enter()
.append('g')
.attr('transform', function(d, i) {
return 'translate(0,0)'; // + (i * barHeight + gapBetweenGroups * (0.5 + Math.floor(i / zippedData.length))) + ')';
}).on('mouseover', function(d) {})
.on('mouseout', function(d) {});
// Create rectangles of the correct width
canvas.append('rect')
.attr('class', 'bar_appended')
.attr('width', '0')
.attr('height', barHeight)
.attr('top', chartPadding)
.transition()
.duration(600)
.delay(200)
.attr('width', chart_X);
canvas.append('rect')
.attr('class', 'bar')
.attr('width', '0')
.attr('height', barHeight)
.attr('top', chartPadding)
.transition()
.duration(500)
.delay(200)
.attr('width', function(d) {
return x(d);
});
});
}
component.render = function() {
component();
return component;
};
component.data = function(_) {
if (!arguments.length) return _data;
_data = _;
return component;
};
component.chartWidth = function(_) {
if (!arguments.length) return chartWidth;
chartWidth = _;
return component;
};
component.barHeight = function(_) {
if (!arguments.length) return barHeight;
barHeight = _;
return component;
};
component.onClick = function(_) {
if (!arguments.length) return _mouseClick;
_mouseClick = _;
return component;
};
return component;
};
|
var Fs = require('fire-fs');
var Path = require('fire-path');
global.__app = {
initCommander: function ( commander ) {
// TODO:
},
init: function ( options, cb ) {
// initialize ./.settings
var settingsPath = Path.join(Editor.appPath, '.settings');
Fs.ensureDirSync(settingsPath);
Editor.registerProfilePath( 'local', settingsPath );
// TODO: load your profile, and disable packages here
Editor.registerPackagePath( Editor.url('app://package-examples/') );
Editor.registerPackagePath( Editor.url('app://benchmark/') );
if ( cb ) cb ();
},
run: function () {
// create main window
var mainWin = new Editor.Window('main', {
'title': 'Editor Framework',
'min-width': 800,
'min-height': 600,
'show': false,
'resizable': true,
});
Editor.mainWindow = mainWin;
// restore window size and position
mainWin.restorePositionAndSize();
// load and show main window
mainWin.show();
// page-level test case
mainWin.load( 'app://package-examples/index.html' );
// open dev tools if needed
if ( Editor.showDevtools ) {
// NOTE: open dev-tools before did-finish-load will make it insert an unused <style> in page-level
mainWin.nativeWin.webContents.once('did-finish-load', function () {
mainWin.openDevTools({
detach: true
});
});
}
mainWin.focus();
},
load: function () {
// TODO
},
unload: function () {
// TODO
},
// TODO: try to create a worker
// 'app:worker': function () {
// var BrowserWindow = require('browser-window');
// var workerWin = new BrowserWindow({
// show: false,
// });
// var Url = require('fire-url');
// var url = Url.format( {
// protocol: 'file',
// pathname: Editor.url('editor-framework://static/worker.html' ),
// slashes: true,
// } );
// workerWin.loadUrl(url);
// },
};
require('./init');
|
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-postcss');
grunt.initConfig({
sass: {
options: {
sourcemap: 'none',
noCache: true
},
prod: {
options: {
style: 'expanded'
},
files: {
'dist/css-tooltip.css': 'src/css-tooltip.scss'
}
},
dist: {
options: {
style: 'compressed'
},
files: {
'dist/css-tooltip.min.css': 'src/css-tooltip.scss'
}
}
},
postcss: {
options: {
safe: true,
processors: [
require('autoprefixer-core')({browsers: 'last 2 version'})
]
},
dist: {
src: ['dist/*.css'],
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-postcss');
grunt.registerTask('default', ['sass', 'postcss']);
}; |
'use strict';
angular.module('users').controller('AuthenticationController', ['$scope', '$http', '$location', 'Authentication', '$timeout', '$mdDialog', 'Users',
function($scope, $http, $location, Authentication, $timeout, $mdDialog, Users) {
$scope.authentication = Authentication;
// some routing actions
$scope.createSite = function() {
$location.path('/sites/create');
};
$scope.listUsers = function() {
$location.path('/users/list');
};
// -------- Created Confirmation ---------
$scope.confirmState = ['true'];
$scope.showConfirm = function() {
$scope.confirmState.splice(0, 1, 'true');
};
$scope.hideConfirm = function() {
$scope.confirmState.splice(0, 1, 'false');
};
// --------------------------
$scope.signup = function(role) {
$scope.credentials.roles = [];
var rolesCount = $scope.credentials.roles.length;
if (rolesCount >= 1) {
$scope.credentials.roles.splice(0, rolesCount);
}
if (role === 'admin') {
$scope.credentials.roles.push('admin');
signup();
} else if (role === 'guest') {
$scope.credentials.roles.push('guest');
signup();
} else if (role === 'user') {
$scope.credentials.roles.push('user');
signup();
} else if (role === 'sub_user') {
$scope.credentials.roles.push('sub_user');
signup();
}
};
var signup = function() {
$http.post('/api/auth/signup', $scope.credentials).success(function(response) {
// If successful we assign the response to the global user model
// $scope.authentication.user = response;
$scope.newUser = response.user;
$scope.successfulMessage = response.message;
$scope.showConfirm();
// And redirect to the index page
}).error(function(response) {
$scope.error = response.message;
});
};
$scope.signin = function() {
$http.post('/api/auth/signin', $scope.credentials).success(function(response) {
// If successful we assign the response to the global user model
$scope.authentication.user = response;
// And redirect to the index page
$location.path('/dashboard');
}).error(function(response) {
$scope.error = response.message;
});
};
}
]); |
import { moduleFor, test } from 'ember-qunit';
moduleFor('controller:admin/users/new', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
});
// Replace this with your real tests.
test('it exists', function(assert) {
var controller = this.subject();
assert.ok(controller);
});
|
/*global angular */
'use strict';
describe('Unit: ExampleFilter', function() {
var $filter;
beforeEach(function() {
// instantiate the app module
angular.mock.module('app');
// mock the filter
angular.mock.inject(function(_$filter_) {
$filter = _$filter_;
});
});
it('should replace the word "keyboard" with "leopard"', function() {
var testString = 'computers are operated by keyboards';
var resultString = $filter('ExampleFilter')(testString);
expect(resultString).toEqual('computers are operated by leopards');
});
}); |
import useWebChatAPIContext from './internal/useWebChatAPIContext';
export default function useUsername() {
return [useWebChatAPIContext().username];
}
|
import Vue from "vue";
const _ = require('lodash');
/**
* Produces the translation of content for a given key. The translation dictionary
* is stored in window.i18n, which is obtained from the connected js file at the
* address api/js/app.min.js (laravel route: 'frontend.lang.js').
*
* @param {String} key. Translation key.
* @param {Object} [args]. Arguments to replace in a string. There is a substitution: {argName: argValue}.
* @return {String} Translated string. Or key in case of failure.
*
* @example
* // Key 'example1' => 'Minecraft'
* $t('example1'); // Minecraft
*
* // key 'example2' => 'Hello, :name!'
* $t('example2', {name: 'World'}); // Hello, World
*/
window.$t = (key, args) => {
let value = _.get(window.i18n, key);
if (typeof value === 'undefined') {
console.warn(`Localization key '${key}' not found.`);
return key;
}
_.eachRight(args, (paramVal, paramKey) => {
value = _.replace(value, `:${paramKey}`, paramVal);
});
return value;
};
Vue.prototype.$t = window.$t;
|
var http = require('http');
var server = http.createServer(function (req, res) {
res.writeHead(200, {
'Content-Type': 'text/html'
});
res.write('<h1>Hello Node.js</h1>');
setTimeout(function () {
res.end('<pre>' + JSON.stringify(req.headers, null, 2) + '</pre>');
}, 500);
});
server.listen(8080);
|
/**
* Created by quanpower on 14-8-23.
*/
var nstatic = require('node-static');
var JSONStream = require('JSONStream');
var config = require('../config');
var getYo = require('./getYo');
var whoAmI = require('./whoAmI');
var getData = require('./getData');
var logData = require('./logData');
var logEvent = require('./logEvent');
var getPhone = require('./getPhone');
var register = require('./register');
var getEvents = require('./getEvents');
var subscribe = require('./subscribe');
var getDevices = require('./getDevices');
var authDevice = require('./authDevice');
var unregister = require('./unregister');
var claimDevice = require('./claimDevice');
var createActivity = require('./createActivity');
var getLocalDevices = require('./getLocalDevices');
var getSystemStatus = require('./getSystemStatus');
var updateFromClient = require('./updateFromClient');
function getIP(req){
return req.headers["x-forwarded-for"] || req.connection.remoteAddress;
}
function getActivity(topic, req, device, toDevice){
return createActivity(topic, getIP(req), device, toDevice);
}
//psuedo middleware
function authorizeRequest(req, res, callback){
authDevice(req.header('skynet_auth_uuid'), req.header('skynet_auth_token'), function (auth) {
if (auth.authenticate) {
callback(auth.device);
}else{
res.json(401, {error: 'unauthorized'});
}
});
}
function errorResponse(error, res){
if(error.code){
res.json(error.code, error);
}else{
res.json(400, error);
}
}
function setupHttpRoutes(server, skynet){
// curl http://localhost:3000/status
server.get('/status', function(req, res){
console.log('STATUS', req);
skynet.sendActivity(getActivity('status',req));
res.setHeader('Access-Control-Allow-Origin','*');
getSystemStatus(function(data){
console.log(data);
// io.sockets.in(req.params.uuid).emit('message', data)
if(data.error){
errorResponse(data.error, res);
} else {
res.json(data);
}
});
});
// curl http://localhost:3000/ipaddress
server.get('/ipaddress', function(req, res){
skynet.sendActivity(getActivity('ipaddress',req));
res.setHeader('Access-Control-Allow-Origin','*');
res.json({ipAddress: getIP(req)});
});
// curl http://localhost:3000/devices
// curl http://localhost:3000/devices?key=123
// curl http://localhost:3000/devices?online=true
// server.get('/devices/:uuid', function(req, res){
server.get('/devices', function(req, res){
authorizeRequest(req, res, function(fromDevice){
skynet.sendActivity(getActivity('devices',req, fromDevice));
getDevices(fromDevice, req.query, false, function(data){
if(data.error){
errorResponse(data.error, res);
}else{
res.json(data);
}
});
});
});
server.get('/devices/:uuid', function(req, res){
authorizeRequest(req, res, function(fromDevice){
skynet.sendActivity(getActivity('devices',req, fromDevice));
getDevices(fromDevice, {uuid: req.params.uuid}, false, function(data){
if(data.error){
errorResponse(data.error, res);
}else{
res.json(data);
}
});
});
});
server.get('/localdevices', function(req, res){
authorizeRequest(req, res, function(fromDevice){
skynet.sendActivity(getActivity('localdevices',req, fromDevice));
if(req.query.overrideIp && config.skynet_override_token && req.header('Skynet_override_token') == config.skynet_override_token){
fromDevice.ipAddress = req.query.overrideIp;
}else{
fromDevice.ipAddress = getIP(req);
}
getLocalDevices(fromDevice, false, function(data){
if(data.error){
errorResponse(data.error, res);
}else{
res.json(data);
}
});
});
});
server.put('/claimdevice/:uuid', function(req, res){
authorizeRequest(req, res, function(fromDevice){
skynet.sendActivity(getActivity('claimdevice',req, fromDevice));
//TODO: Any server-to-server overriding should be done with ouath
if(req.query.overrideIp && config.skynet_override_token && req.header('Skynet_override_token') == config.skynet_override_token){
fromDevice.ipAddress = req.query.overrideIp;
}else{
fromDevice.ipAddress = getIP(req);
}
claimDevice(fromDevice, req.params, function(error, data){
if(error){
errorResponse(error, res);
}else{
res.json(data);
}
});
});
});
// curl http://localhost:3000/gateway/01404680-2539-11e3-b45a-d3519872df26
server.get('/gateway/:uuid', function(req, res){
skynet.sendActivity(getActivity('gateway',req));
// res.setHeader('Access-Control-Allow-Origin','*');
whoAmI(req.params.uuid, false, function(data){
console.log(data);
if(data.error){
res.writeHead(302, {
'location': 'http://skynet.im'
});
} else {
res.writeHead(302, {
'location': 'http://' + data.localhost + ":" + data.port
});
}
res.end();
});
});
// curl -X POST -d "name=arduino&description=this+is+a+test" http://localhost:3000/devices
server.post('/devices', function(req, res){
skynet.sendActivity(getActivity('devices',req));
res.setHeader('Access-Control-Allow-Origin','*');
req.params.ipAddress = getIP(req);
register(req.params, function(data){
console.log('register', data);
if(data.error){
errorResponse(data.error, res);
} else {
res.json(data);
}
});
});
// curl -X PUT -d "token=123&online=true&temp=hello&temp2=world" http://localhost:3000/devices/01404680-2539-11e3-b45a-d3519872df26
// curl -X PUT -d "token=123&online=true&temp=hello&temp2=null" http://localhost:3000/devices/01404680-2539-11e3-b45a-d3519872df26
// curl -X PUT -d "token=123&online=true&temp=hello&temp2=" http://localhost:3000/devices/01404680-2539-11e3-b45a-d3519872df26
// curl -X PUT -d "token=123&myArray=[1,2,3]" http://localhost:3000/devices/01404680-2539-11e3-b45a-d3519872df26
// curl -X PUT -d "token=123&myArray=4&action=push" http://localhost:3000/devices/01404680-2539-11e3-b45a-d3519872df26
server.put('/devices/:uuid', function(req, res){
authorizeRequest(req, res, function(fromDevice){
skynet.sendActivity(getActivity('devices',req, fromDevice));
updateFromClient(fromDevice, req.params, function(result){
if(result.error){
errorResponse(result.error, res);
}else{
res.json(result);
}
});
});
});
// curl -X DELETE -d "token=123" http://localhost:3000/devices/01404680-2539-11e3-b45a-d3519872df26
server.del('/devices/:uuid', function(req, res){
authorizeRequest(req, res, function(fromDevice){
skynet.sendActivity(getActivity('devices',req, fromDevice));
unregister(fromDevice, req.params.uuid, function(err, data){
console.log(err, data);
// io.sockets.in(req.params.uuid).emit('message', data)
if(err){
errorResponse(err, res);
} else {
res.json(data);
}
});
});
});
// Returns all devices owned by authenticated user
// curl -X GET http://localhost:3000/mydevices/0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc?token=qirqglm6yb1vpldixflopnux4phtcsor
server.get('/mydevices', function(req, res){
authorizeRequest(req, res, function(fromDevice){
skynet.sendActivity(getActivity('mydevices',req, fromDevice));
getDevices(fromDevice, {owner: fromDevice.uuid}, true, function(data){
console.log(data);
// io.sockets.in(req.params.uuid).emit('message', data)
if(data.error){
errorResponse(data.error, res);
} else {
res.json(data);
}
});
});
});
// curl -X GET http://localhost:3000/events/0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc?token=qirqglm6yb1vpldixflopnux4phtcsor
server.get('/events/:uuid', function(req, res){
authorizeRequest(req, res, function(fromDevice){
skynet.sendActivity(getActivity('events',req, fromDevice));
logEvent(201, {fromUuid: fromDevice, uuid: req.params.uuid});
getEvents(fromDevice.uuid, function(data){
console.log(data);
// io.sockets.in(req.params.uuid).emit('message', data)
if(data.error){
errorResponse(data.error, res);
} else {
res.json(data);
}
});
});
});
// curl -X GET http://localhost:3000/events/0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc?token=qirqglm6yb1vpldixflopnux4phtcsor
server.get('/subscribe/:uuid', function(req, res){
authorizeRequest(req, res, function(fromDevice){
skynet.sendActivity(getActivity('subscribe',req, fromDevice));
logEvent(204, {fromUuid: fromDevice, uuid: req.params.uuid});
var foo = JSONStream.stringify(open='\n', sep=',\n', close='\n\n');
foo.on("data", function(data){
console.log(data);
data = data + '\r\n';
});
subscribe(req.params.uuid)
.pipe(foo)
.pipe(res);
});
});
// curl -X GET http://localhost:3000/authenticate/81246e80-29fd-11e3-9468-e5f892df566b?token=5ypy4rurayktke29ypbi30kcw5ovfgvi
server.get('/authenticate/:uuid', function(req, res){
skynet.sendActivity(getActivity('authenticate',req));
res.setHeader('Access-Control-Allow-Origin','*');
authDevice(req.params.uuid, req.query.token, function(auth){
if (auth.authenticate){
res.json({uuid:req.params.uuid, authentication: true});
} else {
var regdata = {
"error": {
"message": "Device not found or token not valid",
"code": 404
}
};
res.json(regdata.error.code, {uuid:req.params.uuid, authentication: false});
}
});
});
// curl -X POST -d '{"devices": "all", "payload": {"yellow":"off"}}' http://localhost:3000/messages
// curl -X POST -d '{"devices": ["ad698900-2546-11e3-87fb-c560cb0ca47b","2f3113d0-2796-11e3-95ef-e3081976e170"], "payload": {"yellow":"off"}}' http://localhost:3000/messages
// curl -X POST -d '{"devices": "ad698900-2546-11e3-87fb-c560cb0ca47b", "payload": {"yellow":"off"}}' http://localhost:3000/messages
server.post('/messages', function(req, res, next){
authorizeRequest(req, res, function(fromDevice){
//skynet.sendActivity(getActivity('messages',req));
var body;
try {
body = JSON.parse(req.body);
} catch(err) {
body = req.body;
}
if (!body.devices){
try {
body = JSON.parse(req.params);
} catch(err) {
body = req.params;
}
}
var devices = body.devices;
var message = {};
message.payload = body.payload;
message.devices = body.devices;
message.subdevice = body.subdevice;
message.topic = body.topic;
console.log('payload: ' + JSON.stringify(message));
skynet.sendMessage(fromDevice, message);
res.json({devices:devices, subdevice: body.subdevice, payload: body.payload});
logEvent(300, message);
});
});
// curl -X POST -d '{"uuid": "ad698900-2546-11e3-87fb-c560cb0ca47b", "token": "g6jmsla14j2fyldi7hqijbylwmrysyv5", "method": "getSubdevices"' http://localhost:3000/gatewayConfig
server.post('/gatewayconfig', function(req, res, next){
authorizeRequest(req, res, function(fromDevice){
skynet.sendActivity(getActivity('gatewayconfig',req, fromDevice));
var body;
try {
body = JSON.parse(req.body);
} catch(err) {
console.log('error parsing', err, req.body);
body = {};
}
skynet.gatewayConfig(body, function(result){
if(result && result.error){
errorResponse(result.error, res);
}else{
res.json(result);
}
});
logEvent(300, body);
});
});
// Inbound SMS
// curl -X GET -d "token=123" http://localhost:3000/inboundsms
server.get('/inboundsms', function(req, res){
skynet.sendActivity(getActivity('inboundsms',req));
res.setHeader('Access-Control-Allow-Origin','*');
console.log(req.params);
// { To: '17144625921',
// Type: 'sms',
// MessageUUID: 'f1f3cc84-8770-11e3-9f8a-842b2b455655',
// From: '14803813574',
// Text: 'Test' }
var data;
try{
data = JSON.parse(req.params);
} catch(e){
data = req.params;
}
var toPhone = data.To;
var fromPhone = data.From;
var message = data.Text;
getPhone(toPhone, function(err, phoneDevice){
var eventData = {devices: phoneDevice, payload: message};
if(err){
err.code = 404;
eventData.error = err;
}
else{
var msg = {
devices: "*",
payload: message,
api: 'message',
fromUuid: phoneDevice.uuid,
eventCode: 300,
fromPhone: fromPhone,
sms: true
};
skynet.sendMessage(phoneDevice, msg);
}
logEvent(301, eventData);
if(eventData.error){
errorResponse(eventData.error, res);
} else {
res.json(eventData);
}
});
});
// Inbound Yo
// curl -X GET "http://localhost:3000/inboundyo?username=christoffe"
server.get('/inboundyo', function(req, res){
skynet.sendActivity(getActivity('inboundyo',req));
res.setHeader('Access-Control-Allow-Origin','*');
var yoUsername = req.params.username;
getYo(yoUsername, function(err, yoDevice){
var eventData = {devices: yoDevice, payload: "yo"};
if(err){
err.code = 404;
eventData.error = err;
}
else{
var msg = {
devices: "*",
payload: "yo",
api: 'message',
fromUuid: yoDevice.uuid,
eventCode: 300,
fromPhone: yoUsername,
yo: true
};
skynet.sendMessage(yoDevice, msg);
}
logEvent(303, eventData);
if(eventData.error){
errorResponse(eventData.error, res);
} else {
res.json(eventData);
}
});
});
// curl -X POST -d "token=123&temperature=78" http://localhost:3000/data/ad698900-2546-11e3-87fb-c560cb0ca47b
server.post('/data/:uuid', function(req, res){
authorizeRequest(req, res, function(fromDevice){
skynet.sendActivity(getActivity('data',req, fromDevice));
delete req.params.token;
req.params.ipAddress = getIP(req);
logData(req.params, function(data){
console.log(data);
// io.sockets.in(data.uuid).emit('message', data)
if(data.error){
errorResponse(data.error, res);
} else {
// Send messsage regarding data update
var message = {};
message.payload = req.params;
// message.devices = req.params.uuid;
message.devices = "*";
console.log('message: ' + JSON.stringify(message));
skynet.sendMessage(fromDevice, message);
res.json(data);
}
});
});
});
// curl -X GET http://localhost:3000/data/0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc?token=qirqglm6yb1vpldixflopnux4phtcsor
server.get('/data/:uuid', function(req, res){
skynet.sendActivity(getActivity('data',req));
authorizeRequest(req, res, function(fromDevice){
if(req.query.stream){
var foo = JSONStream.stringify(open='\n', sep=',\n', close='\n\n');
foo.on("data", function(data){
// data = data.toString() + '\r\n';
console.log('DATA', data);
return data;
});
getData(req)
.pipe(foo)
.pipe(res);
} else {
getData(req, function(data){
console.log(data);
if(data.error){
errorResponse(data.error, res);
} else {
res.json(data);
}
});
}
});
});
// Serve static website
var file = new nstatic.Server('');
server.get('/demo/:uuid', function(req, res, next) {
skynet.sendActivity(getActivity('demo',req));
file.serveFile('/demo.html', 200, {}, req, res);
});
server.get('/jsconsole', function(req, res, next) {
skynet.sendActivity(getActivity('jsconsole',req));
file.serveFile('/js.html', 200, {}, req, res);
});
server.get('/', function(req, res, next) {
skynet.sendActivity(getActivity('website',req));
file.serveFile('/index.html', 200, {}, req, res);
});
server.get(/^\/.*/, function(req, res, next) {
file.serve(req, res, next);
});
return server;
}
module.exports = setupHttpRoutes;
|
/*
* ember-model-generator
* https://github.com/zooshme/ember-model-generator
*
* Copyright (c) 2014, Ovidiu Spatacian-Tarnu
* Licensed under the MIT license.
*/
'use strict';
var gulp = require('gulp'),
install = require('gulp-install'),
conflict = require('gulp-conflict'),
template = require('gulp-template'),
rename = require('gulp-rename'),
_ = require('underscore.string'),
inquirer = require('inquirer');
gulp.task('default', function (done) {
var prompts = [{
type: 'input',
name: 'modelName',
message: 'What is the name of your model?',
default: gulp.args.join(' ')
}, {
type: 'input',
name: 'modelAttributes',
message: 'What attributes does your model have?',
default: gulp.args.join(' '),
filter: function(attrs) {
var array = attrs.split(' ');
array = array.map(function(item) {
console.log(item);
var attr = item.split(':');
console.log(attr);
var key = attr[0];
var value = attr[1];
return {
key: key,
value: value
};
});
return array;
}
}];
//Ask
inquirer.prompt(prompts,
function (answers) {
// if (!answers.moveon) {
// return done();
// }
answers.modelNameSlug = _.slugify(answers.modelName);
gulp.src(__dirname + '/templates/**')
.pipe(template(answers))
.pipe(gulp.dest('./'));
});
});
|
'use strict';
const assert = require('assert');
const Browscap = require('../src/index.js');
suite('checking for issue 1636. (12 tests)', function () {
test('issue-1636-A ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:7.0.1) Gecko/20171016 Postbox/5.0.20"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:7.0.1) Gecko/20171016 Postbox/5.0.20');
assert.strictEqual(browser['Comment'], 'Postbox 5.0', 'Expected actual "Comment" to be \'Postbox 5.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '5.0', 'Expected actual "Version" to be \'5.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'macOS', 'Expected actual "Platform" to be \'macOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '10.12', 'Expected actual "Platform_Version" to be \'10.12\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'macOS', 'Expected actual "Platform_Description" to be \'macOS\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Macintosh', 'Expected actual "Device_Name" to be \'Macintosh\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Macintosh', 'Expected actual "Device_Code_Name" to be \'Macintosh\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
test('issue-1636-B ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:7.0.1) Gecko/20140602 Postbox/3.0.11"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:7.0.1) Gecko/20140602 Postbox/3.0.11');
assert.strictEqual(browser['Comment'], 'Postbox 3.0', 'Expected actual "Comment" to be \'Postbox 3.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '3.0', 'Expected actual "Version" to be \'3.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'MacOSX', 'Expected actual "Platform" to be \'MacOSX\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '10.10', 'Expected actual "Platform_Version" to be \'10.10\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'Mac OS X', 'Expected actual "Platform_Description" to be \'Mac OS X\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Macintosh', 'Expected actual "Device_Name" to be \'Macintosh\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Macintosh', 'Expected actual "Device_Code_Name" to be \'Macintosh\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
test('issue-1636-C ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:7.0.1) Gecko/20150514 Postbox/4.0.1"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:7.0.1) Gecko/20150514 Postbox/4.0.1');
assert.strictEqual(browser['Comment'], 'Postbox 4.0', 'Expected actual "Comment" to be \'Postbox 4.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '4.0', 'Expected actual "Version" to be \'4.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'MacOSX', 'Expected actual "Platform" to be \'MacOSX\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '10.10', 'Expected actual "Platform_Version" to be \'10.10\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'Mac OS X', 'Expected actual "Platform_Description" to be \'Mac OS X\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Macintosh', 'Expected actual "Device_Name" to be \'Macintosh\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Macintosh', 'Expected actual "Device_Code_Name" to be \'Macintosh\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
test('issue-1636-D ["Mozilla/5.0 (Windows NT 6.2; WOW64; rv:7.0.1) Gecko/20140602 Postbox/3.0.11"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Windows NT 6.2; WOW64; rv:7.0.1) Gecko/20140602 Postbox/3.0.11');
assert.strictEqual(browser['Comment'], 'Postbox 3.0', 'Expected actual "Comment" to be \'Postbox 3.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '3.0', 'Expected actual "Version" to be \'3.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'Win8', 'Expected actual "Platform" to be \'Win8\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '6.2', 'Expected actual "Platform_Version" to be \'6.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'Windows 8', 'Expected actual "Platform_Description" to be \'Windows 8\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '64', 'Expected actual "Platform_Bits" to be \'64\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Microsoft Corporation', 'Expected actual "Platform_Maker" to be \'Microsoft Corporation\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Windows Desktop', 'Expected actual "Device_Name" to be \'Windows Desktop\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'unknown', 'Expected actual "Device_Maker" to be \'unknown\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Windows Desktop', 'Expected actual "Device_Code_Name" to be \'Windows Desktop\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'unknown', 'Expected actual "Device_Brand_Name" to be \'unknown\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
test('issue-1636-E ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:7.0.1) Gecko/20140602 Postbox/3.0.11"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:7.0.1) Gecko/20140602 Postbox/3.0.11');
assert.strictEqual(browser['Comment'], 'Postbox 3.0', 'Expected actual "Comment" to be \'Postbox 3.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '3.0', 'Expected actual "Version" to be \'3.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'MacOSX', 'Expected actual "Platform" to be \'MacOSX\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '10.11', 'Expected actual "Platform_Version" to be \'10.11\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'Mac OS X', 'Expected actual "Platform_Description" to be \'Mac OS X\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Macintosh', 'Expected actual "Device_Name" to be \'Macintosh\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Macintosh', 'Expected actual "Device_Code_Name" to be \'Macintosh\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
test('issue-1636-F ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:7.0.1) Gecko/20170908 Postbox/5.0.19"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:7.0.1) Gecko/20170908 Postbox/5.0.19');
assert.strictEqual(browser['Comment'], 'Postbox 5.0', 'Expected actual "Comment" to be \'Postbox 5.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '5.0', 'Expected actual "Version" to be \'5.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'macOS', 'Expected actual "Platform" to be \'macOS\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '10.13', 'Expected actual "Platform_Version" to be \'10.13\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'macOS', 'Expected actual "Platform_Description" to be \'macOS\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Macintosh', 'Expected actual "Device_Name" to be \'Macintosh\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Macintosh', 'Expected actual "Device_Code_Name" to be \'Macintosh\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
test('issue-1636-G ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:7.0.1) Gecko/20170609 Postbox/5.0.15"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:7.0.1) Gecko/20170609 Postbox/5.0.15');
assert.strictEqual(browser['Comment'], 'Postbox 5.0', 'Expected actual "Comment" to be \'Postbox 5.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '5.0', 'Expected actual "Version" to be \'5.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'MacOSX', 'Expected actual "Platform" to be \'MacOSX\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '10.10', 'Expected actual "Platform_Version" to be \'10.10\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'Mac OS X', 'Expected actual "Platform_Description" to be \'Mac OS X\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Macintosh', 'Expected actual "Device_Name" to be \'Macintosh\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Macintosh', 'Expected actual "Device_Code_Name" to be \'Macintosh\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
test('issue-1636-H ["Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.8) Gecko/20100317 Postbox/1.1.3"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.8) Gecko/20100317 Postbox/1.1.3');
assert.strictEqual(browser['Comment'], 'Postbox 1.0', 'Expected actual "Comment" to be \'Postbox 1.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '1.0', 'Expected actual "Version" to be \'1.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'MacOSX', 'Expected actual "Platform" to be \'MacOSX\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '10.6', 'Expected actual "Platform_Version" to be \'10.6\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'Mac OS X', 'Expected actual "Platform_Description" to be \'Mac OS X\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Macintosh', 'Expected actual "Device_Name" to be \'Macintosh\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Macintosh', 'Expected actual "Device_Code_Name" to be \'Macintosh\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
test('issue-1636-I ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:7.0.1) Gecko/20140129 Postbox/3.0.9"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:7.0.1) Gecko/20140129 Postbox/3.0.9');
assert.strictEqual(browser['Comment'], 'Postbox 3.0', 'Expected actual "Comment" to be \'Postbox 3.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '3.0', 'Expected actual "Version" to be \'3.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'MacOSX', 'Expected actual "Platform" to be \'MacOSX\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '10.9', 'Expected actual "Platform_Version" to be \'10.9\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'Mac OS X', 'Expected actual "Platform_Description" to be \'Mac OS X\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Apple Inc', 'Expected actual "Platform_Maker" to be \'Apple Inc\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Macintosh', 'Expected actual "Device_Name" to be \'Macintosh\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'Apple Inc', 'Expected actual "Device_Maker" to be \'Apple Inc\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Macintosh', 'Expected actual "Device_Code_Name" to be \'Macintosh\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'Apple', 'Expected actual "Device_Brand_Name" to be \'Apple\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
test('issue-1636-J ["Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20140602 Postbox/3.0.11"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20140602 Postbox/3.0.11');
assert.strictEqual(browser['Comment'], 'Postbox 3.0', 'Expected actual "Comment" to be \'Postbox 3.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '3.0', 'Expected actual "Version" to be \'3.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'Win7', 'Expected actual "Platform" to be \'Win7\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '6.1', 'Expected actual "Platform_Version" to be \'6.1\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'Windows 7', 'Expected actual "Platform_Description" to be \'Windows 7\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '64', 'Expected actual "Platform_Bits" to be \'64\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Microsoft Corporation', 'Expected actual "Platform_Maker" to be \'Microsoft Corporation\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Windows Desktop', 'Expected actual "Device_Name" to be \'Windows Desktop\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'unknown', 'Expected actual "Device_Maker" to be \'unknown\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Windows Desktop', 'Expected actual "Device_Code_Name" to be \'Windows Desktop\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'unknown', 'Expected actual "Device_Brand_Name" to be \'unknown\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
test('issue-1636-K ["Mozilla/5.0 (Windows NT 6.2; WOW64; rv:7.0.1) Gecko/20171012 Postbox/5.0.20"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Windows NT 6.2; WOW64; rv:7.0.1) Gecko/20171012 Postbox/5.0.20');
assert.strictEqual(browser['Comment'], 'Postbox 5.0', 'Expected actual "Comment" to be \'Postbox 5.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '5.0', 'Expected actual "Version" to be \'5.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'Win8', 'Expected actual "Platform" to be \'Win8\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '6.2', 'Expected actual "Platform_Version" to be \'6.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'Windows 8', 'Expected actual "Platform_Description" to be \'Windows 8\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '64', 'Expected actual "Platform_Bits" to be \'64\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Microsoft Corporation', 'Expected actual "Platform_Maker" to be \'Microsoft Corporation\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Windows Desktop', 'Expected actual "Device_Name" to be \'Windows Desktop\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'unknown', 'Expected actual "Device_Maker" to be \'unknown\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Windows Desktop', 'Expected actual "Device_Code_Name" to be \'Windows Desktop\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'unknown', 'Expected actual "Device_Brand_Name" to be \'unknown\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
test('issue-1636-L ["Mozilla/5.0 (Windows; U; Windows NT 6.2; fr; rv:1.9.1.10) Gecko/20100705 Postbox/1.0.1"]', function () {
const browscap = new Browscap();
const browser = browscap.getBrowser('Mozilla/5.0 (Windows; U; Windows NT 6.2; fr; rv:1.9.1.10) Gecko/20100705 Postbox/1.0.1');
assert.strictEqual(browser['Comment'], 'Postbox 1.0', 'Expected actual "Comment" to be \'Postbox 1.0\' (was \'' + browser['Comment'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser'], 'Postbox', 'Expected actual "Browser" to be \'Postbox\' (was \'' + browser['Browser'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Type'], 'Email Client', 'Expected actual "Browser_Type" to be \'Email Client\' (was \'' + browser['Browser_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Bits'], '32', 'Expected actual "Browser_Bits" to be \'32\' (was \'' + browser['Browser_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Maker'], 'Postbox, Inc.', 'Expected actual "Browser_Maker" to be \'Postbox, Inc.\' (was \'' + browser['Browser_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Browser_Modus'], 'unknown', 'Expected actual "Browser_Modus" to be \'unknown\' (was \'' + browser['Browser_Modus'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Version'], '1.0', 'Expected actual "Version" to be \'1.0\' (was \'' + browser['Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform'], 'Win8', 'Expected actual "Platform" to be \'Win8\' (was \'' + browser['Platform'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Version'], '6.2', 'Expected actual "Platform_Version" to be \'6.2\' (was \'' + browser['Platform_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Description'], 'Windows 8', 'Expected actual "Platform_Description" to be \'Windows 8\' (was \'' + browser['Platform_Description'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Bits'], '32', 'Expected actual "Platform_Bits" to be \'32\' (was \'' + browser['Platform_Bits'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Platform_Maker'], 'Microsoft Corporation', 'Expected actual "Platform_Maker" to be \'Microsoft Corporation\' (was \'' + browser['Platform_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Alpha'], false, 'Expected actual "Alpha" to be false (was \'' + browser['Alpha'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Beta'], false, 'Expected actual "Beta" to be false (was \'' + browser['Beta'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Frames'], true, 'Expected actual "Frames" to be true (was \'' + browser['Frames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['IFrames'], true, 'Expected actual "IFrames" to be true (was \'' + browser['IFrames'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Tables'], true, 'Expected actual "Tables" to be true (was \'' + browser['Tables'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Cookies'], true, 'Expected actual "Cookies" to be true (was \'' + browser['Cookies'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaScript'], true, 'Expected actual "JavaScript" to be true (was \'' + browser['JavaScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['VBScript'], false, 'Expected actual "VBScript" to be false (was \'' + browser['VBScript'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['JavaApplets'], true, 'Expected actual "JavaApplets" to be true (was \'' + browser['JavaApplets'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isSyndicationReader'], false, 'Expected actual "isSyndicationReader" to be false (was \'' + browser['isSyndicationReader'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isFake'], false, 'Expected actual "isFake" to be false (was \'' + browser['isFake'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isAnonymized'], false, 'Expected actual "isAnonymized" to be false (was \'' + browser['isAnonymized'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['isModified'], false, 'Expected actual "isModified" to be false (was \'' + browser['isModified'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['CssVersion'], '2', 'Expected actual "CssVersion" to be \'2\' (was \'' + browser['CssVersion'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Name'], 'Windows Desktop', 'Expected actual "Device_Name" to be \'Windows Desktop\' (was \'' + browser['Device_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Maker'], 'unknown', 'Expected actual "Device_Maker" to be \'unknown\' (was \'' + browser['Device_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Type'], 'Desktop', 'Expected actual "Device_Type" to be \'Desktop\' (was \'' + browser['Device_Type'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Pointing_Method'], 'mouse', 'Expected actual "Device_Pointing_Method" to be \'mouse\' (was \'' + browser['Device_Pointing_Method'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Code_Name'], 'Windows Desktop', 'Expected actual "Device_Code_Name" to be \'Windows Desktop\' (was \'' + browser['Device_Code_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['Device_Brand_Name'], 'unknown', 'Expected actual "Device_Brand_Name" to be \'unknown\' (was \'' + browser['Device_Brand_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Name'], 'Gecko', 'Expected actual "RenderingEngine_Name" to be \'Gecko\' (was \'' + browser['RenderingEngine_Name'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Version'], 'unknown', 'Expected actual "RenderingEngine_Version" to be \'unknown\' (was \'' + browser['RenderingEngine_Version'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
assert.strictEqual(browser['RenderingEngine_Maker'], 'Mozilla Foundation', 'Expected actual "RenderingEngine_Maker" to be \'Mozilla Foundation\' (was \'' + browser['RenderingEngine_Maker'] + '\'; used pattern: ' + browser['browser_name_regex'] + ')');
});
});
|
const createRenderer = require('../')
const createContext = require('pex-context')
const vec3 = require('pex-math/vec3')
const GUI = require('pex-gui')
const random = require('pex-random')
const normals = require('geom-normals')
const createSphere = require('primitive-sphere')
const ctx = createContext()
const renderer = createRenderer(ctx)
const gui = new GUI(ctx)
gui.addFPSMeeter()
gui.addHeader('Meshes')
random.seed(0)
const cameraEntity = renderer.entity([
renderer.camera({
fov: Math.PI / 2,
aspect: ctx.gl.drawingBufferWidth / ctx.gl.drawingBufferHeight
}),
renderer.orbiter({
position: [0, 0, 3]
})
])
renderer.add(cameraEntity)
const sphere = createSphere(1, { segments: 400 })
const scale = 1
function perlin(p) {
let s = scale
let n = 0
for (let i = 0; i < 5; i++) {
n += random.noise3(p[0] * s, p[1] * s, p[2] * s) / s
s *= 2
}
return n
}
for (let i = 0; i < sphere.positions.length; i++) {
const p = sphere.positions[i]
const n = perlin(p)
vec3.addScaled(p, sphere.normals[i], n * 0.1)
}
sphere.normals = normals(sphere.positions, sphere.cells)
sphere.cells = new Uint32Array(sphere.cells.flat())
const sphereEntity = renderer.entity([
renderer.transform({ position: [0, 0, 0] }),
renderer.geometry(sphere),
renderer.material({
baseColor: [1, 0, 0, 1],
roughness: 0.096,
metallic: 0,
cullFace: false
})
])
renderer.add(sphereEntity)
gui.addLabel('Sphere verts: ' + sphere.positions.length)
const skybox = renderer.entity([
renderer.skybox({
sunPosition: [1, 1, 1]
})
])
renderer.add(skybox)
const reflectionProbe = renderer.entity([renderer.reflectionProbe()])
renderer.add(reflectionProbe)
ctx.frame(() => {
renderer.draw()
gui.draw()
window.dispatchEvent(new CustomEvent('pex-screenshot'))
})
|
// @Routes for Server --> API for movies list and history
var app = require('express')();
var mongoose = require('mongoose');
var movieList = require('./listmodel');
var history = require('./historymodel');
// @@ Movie List API section
// # Get the list and send to client
app.get('/mlist', function(req, res) {
if (movieList) {
movieList.find(function(err, list) {
if (err) {
res.send(err)
}
else {
let reslist = {};
reslist.total = list.length;
reslist.entries = list;
res.json(reslist);
}
});
} else {
console.log('No movieList collection found in DB');
}
});
// # If update invoked from client
app.post('/mlist', function(req, res) {
let err = 'You can not create or insert movie instance! Please refer API documentation.';
res.status(500).send({error: err});
});
// # If delete invoked from client
app.delete('/mlist/:id/:_id', function(req, res) {
let err = 'You can not delete list nor movie instance! Please refer API documentation.';
res.status(500).send({error: err});
});
// @@ History API section
// # Get the session history and send to client
app.get('/history/:session_id', function(req, res) {
if (history) {
history.find({
session_id : req.params.session_id
}, function(err, stamp) {
if (err) {
res.send(err)
}
else {
res.json(stamp);
}
});
} else {
console.log('No history collection found in DB');
}
});
// # If create or update invoked from client
app.post('/history', function(req, res) {
if (history) {
let session = req.body;
let id = session.session_id;
history.find({
session_id : id
}, function(err, stamp) {
if (err) {
res.send(err)
}
else if (stamp == null) {
// Create new history record
history.create(session, function(err, stamp) {
if (err)
res.send(err);
res.status(200).send('History successfully created');
});
} else {
// Update existing history record
history.update({session_id : id}, session, {upsert:true}, function(err, stamp) {
if (err)
res.status(500).send({ error: err });
res.status(200).send('History successfully updated');
});
}
});
} else {
console.log('No history collection found in DB');
}
});
// # If delete invoked from client
app.delete('/history/:session_id', function(req, res) {
if (history) {
history.remove({
session_id : req.params.session_id
}, function(err, stamp) {
if (err) {
res.send(err)
}
else {
res.sendStatus(200);
}
});
} else {
console.log('No history collection found in DB');
}
});
module.exports = app;
|
// Override the default confirm dialog by rails
$.rails.allowAction = function(link) {
if (link.data('confirm') == undefined) {
return true;
}
$.rails.showConfirmationDialog(link);
return false;
};
$.rails.confirmed = function(link) {
link.data('confirm', null);
link.trigger('click.rails');
};
$.rails.showConfirmationDialog = function(link) {
swal({
title: 'Are you sure?',
text: 'You will not be able to recover this event.',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#DD6B55',
confirmButtonText: 'Yes',
closeOnConfirm: false,
},
function() {
$.rails.confirmed(link);
});
};
|
module.exports = {
server: {
port: 8080
},
mysql: {
}
}; |
import { createComponent } from 'inferno-alef'
const center = props => ({
padding: 10,
justifyContent: 'center',
alignItems: 'center',
textAlign: 'center',
flexDirection: 'column',
flex: props.flex || 1,
fontFace: {
fontFamily: 'Lato',
src: [
'https://fonts.gstatic.com/s/lato/v11/qIIYRU-oROkIk8vfvxw6QvesZW2xOQ-xsNqO47m55DA.woff'
]
}
})
export default createComponent(center)
|
import React, { Component } from "react";
import "./App.css";
import profiles from "./examples/data";
import { Simple, Highlighted } from "./examples";
import { Portals } from "react-githubish-mentions";
console.log("Portal", Portals);
class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">react-githubish-mentions</h1>
</header>
<div className="App-body">
<div className="demos">
<div>
<h2>Simple Demo</h2>
<Simple placeholder="@-mentioning" />
</div>
<div>
<h2>Highlighted Match</h2>
<p>
Here the matching part of the string is underlined. <br />
The mention dropdown is also aligned with the beginning of the
string (as opposed to the current caret position)
</p>
<Highlighted placeholder="@-mentioning" position="start" />
</div>
</div>
<div>
<h2>Positioning Test</h2>
<div style={{ position: "relative", border: "1px solid red" }}>
<h4>My parent is relatively positioned</h4>
<Simple
placeholder="position test..."
portal={Portals.ReactMentionPortal}
/>
</div>
</div>
<p>
<b>
Unless mentioned otherwise this is the data that will be matched
against:
</b>{" "}
<em>{profiles.map(p => p.username).join(", ")}</em>
</p>
</div>
</div>
);
}
}
export default App;
|
import Ember from 'ember';
export default Ember.TextField.extend({
classNames: ['form-control'],
didInsertElement () {
this.floatLabel();
this.maxRangeValidation();
},
onChangeValue: Ember.observer('value', function() {
this.floatLabel();
this.maxRangeValidation();
}),
floatLabel() {
let input = Ember.$('#' + this.get('elementId'));
if(this.get('value')) {
input.addClass('static').addClass('dirty');
} else {
input.removeClass('static').removeClass('dirty');
}
},
maxRangeValidation() {
let max = parseInt(this.get('max'));
let min = parseInt(this.get('min'));
let value = parseInt(this.get('value'));
if (value > max) {
this.set('value', max);
}
if ((min || min === 0) && (value < min)) {
this.set('value', min);
}
}
});
|
module.exports = function( grunt ) {
grunt.initConfig( {
pkg: grunt.file.readJSON( "package.json" ),
watch: {
scripts: {
files: [
"app/js/*"
],
tasks: [
"concat:scripts"
]
},
css: {
files: [
"app/css/*"
],
tasks: [
"cssmin:combine"
]
}
},
uglify: {
options: {
mangle: true,
compress: true,
banner: "/*! <%= pkg.name %> <%= grunt.template.today( 'yyyy-mm-dd' ) %> */",
sourceMap: true,
sourceMapName: "app/build/project.js.map"
},
project: {
files: {
"app/build/project.js": [
"app/js/*"
]
}
}
},
concat: {
scripts: {
src: [
"app/js/*"
],
dest: "app/build/project.js"
},
angular: {
src: [
"app/bower_components/angular/angular.min.js",
"app/bower_components/angular-route/angular-route.min.js"
],
dest: "app/build/angular.js"
},
pouchdb: {
src: [
"app/bower_components/pouchdb/dist/pouchdb.min.js"
],
dest: "app/build/pouchdb.js"
}
},
cssmin: {
combine: {
files: {
"app/build/style.css": [
"app/css/font-awesome.min.css",
"app/css/ui-kit.css",
"app/css/custom.css"
]
}
}
}
} );
grunt.loadNpmTasks( "grunt-contrib-watch" );
grunt.loadNpmTasks( "grunt-contrib-uglify" );
grunt.loadNpmTasks( "grunt-contrib-concat" );
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask( "default", [
"concat:scripts",
"concat:angular",
"concat:pouchdb",
"cssmin:combine"
] );
grunt.registerTask( "deploy", [
"uglify",
"concat:angular"
] );
};
|
// Domain routing and port forwarding
//
// Used for mapping hosts and domains to localhost, so you can open TCP
// connections with friendly hostnames to test against the local server.
//
// Can also map any source port to any destination port, so you can use port 80
// to access localhost server running on unprivileged port.
'use strict';
var _core = require('babel-runtime/core-js')['default'];
var assert = require('assert');
var Net = require('net');
// Routing table.
//
// key - Source host name or wildcard (e.g. "example.com", "*.example.com")
// value - Object that maps source port to target port
var routing = {};
// Flip this from enableRerouting() so we only inject our code into
// Socket.connect once.
var enabled = false;
// If there's a route for host/port, returns destination port number.
//
// Called recursively to handle wildcards. Starting with the host
// www.example.com, it will attempt to match routes from most to least specific:
//
// www.example.com
// *.www.example.com
// *.example.com
// *.com
function findTargetPort(_x, _x2) {
var _again = true;
_function: while (_again) {
route = wildcard = undefined;
_again = false;
var hostname = _x,
port = _x2;
var route = routing[hostname];
if (route) {
return route[port];
} // This will first expand www.hostname.com to *.www.hostname.com,
// then contract it to *.hostname.com, *.com and finally *.
var wildcard = hostname.replace(/^(\*\.[^.]+(\.|$))?/, '*.');
if (wildcard !== '*.') {
_x = wildcard;
_x2 = port;
_again = true;
continue _function;
}
}
}
// Called once to hack Socket.connect
function enableRerouting() {
if (enabled) {
return;
}enabled = true;
var connect = Net.Socket.prototype.connect;
Net.Socket.prototype.connect = function (options, callback) {
if (typeof options === 'object') {
var port = findTargetPort(options.host, options.port);
if (port) {
options = _core.Object.assign({}, options, { host: 'localhost', port: port });
return connect.call(this, options, callback);
}
}
return connect.apply(this, arguments);
};
}
// source - Hostname or host:port (default to port 80)
// target - Target port number
module.exports = function addRoute(source, target) {
assert(source, 'Expected source address of the form "host:port" or just "host"');
var sourceHost = source.split(':')[0];
var sourcePort = source.split(':')[1] || 80;
var route = routing[sourceHost] || {};
routing[sourceHost] = route;
if (!route[sourcePort]) route[sourcePort] = target;
assert(route[sourcePort] === target, 'Already have routing from ' + source + ' to ' + route[sourcePort]);
// Enable Socket.connect routing
enableRerouting();
};
//# sourceMappingURL=reroute.js.map |
'use strict';
var csrf;
var suburl;
function initCommentPreviewTab($form) {
var $tabMenu = $form.find('.tabular.menu');
$tabMenu.find('.item').tab();
$tabMenu.find('.item[data-tab="' + $tabMenu.data('preview') + '"]').click(function () {
var $this = $(this);
$.post($this.data('url'), {
"_csrf": csrf,
"mode": "gfm",
"context": $this.data('context'),
"text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
},
function (data) {
var $previewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('preview') + '"]');
$previewPanel.html(data);
emojify.run($previewPanel[0]);
$('pre code', $previewPanel[0]).each(function (i, block) {
hljs.highlightBlock(block);
});
}
);
});
buttonsClickOnEnter();
}
var previewFileModes;
function initEditPreviewTab($form) {
var $tabMenu = $form.find('.tabular.menu');
$tabMenu.find('.item').tab();
var $previewTab = $tabMenu.find('.item[data-tab="' + $tabMenu.data('preview') + '"]');
if ($previewTab.length) {
previewFileModes = $previewTab.data('preview-file-modes').split(',');
$previewTab.click(function () {
var $this = $(this);
$.post($this.data('url'), {
"_csrf": csrf,
"mode": "gfm",
"context": $this.data('context'),
"text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
},
function (data) {
var $previewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('preview') + '"]');
$previewPanel.html(data);
emojify.run($previewPanel[0]);
$('pre code', $previewPanel[0]).each(function (i, block) {
hljs.highlightBlock(block);
});
}
);
});
}
}
function initEditDiffTab($form) {
var $tabMenu = $form.find('.tabular.menu');
$tabMenu.find('.item').tab();
$tabMenu.find('.item[data-tab="' + $tabMenu.data('diff') + '"]').click(function () {
var $this = $(this);
$.post($this.data('url'), {
"_csrf": csrf,
"context": $this.data('context'),
"content": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
},
function (data) {
var $diffPreviewPanel = $form.find('.tab.segment[data-tab="' + $tabMenu.data('diff') + '"]');
$diffPreviewPanel.html(data);
emojify.run($diffPreviewPanel[0]);
}
);
});
}
function initEditForm() {
if ($('.edit.form').length == 0) {
return;
}
initEditPreviewTab($('.edit.form'));
initEditDiffTab($('.edit.form'));
}
function initBranchSelector() {
var $selectBranch = $('.ui.select-branch')
var $branchMenu = $selectBranch.find('.reference-list-menu');
$branchMenu.find('.item:not(.no-select)').click(function () {
var selectedValue = $(this).data('id');
$($(this).data('id-selector')).val(selectedValue);
$selectBranch.find('.ui .branch-name').text(selectedValue);
});
$selectBranch.find('.reference.column').click(function () {
$selectBranch.find('.scrolling.reference-list-menu').css('display', 'none');
$selectBranch.find('.reference .text').removeClass('black');
$($(this).data('target')).css('display', 'block');
$(this).find('.text').addClass('black');
return false;
});
}
function updateIssuesMeta(url, action, issueIds, elementId, afterSuccess) {
$.ajax({
type: "POST",
url: url,
data: {
"_csrf": csrf,
"action": action,
"issue_ids": issueIds,
"id": elementId
},
success: afterSuccess
})
}
function initCommentForm() {
if ($('.comment.form').length == 0) {
return
}
initBranchSelector();
initCommentPreviewTab($('.comment.form'));
// Labels
var $list = $('.ui.labels.list');
var $noSelect = $list.find('.no-select');
var $labelMenu = $('.select-label .menu');
var hasLabelUpdateAction = $labelMenu.data('action') == 'update';
$('.select-label').dropdown('setting', 'onHide', function(){
if (hasLabelUpdateAction) {
location.reload();
}
});
$labelMenu.find('.item:not(.no-select)').click(function () {
if ($(this).hasClass('checked')) {
$(this).removeClass('checked');
$(this).find('.octicon').removeClass('octicon-check');
if (hasLabelUpdateAction) {
updateIssuesMeta(
$labelMenu.data('update-url'),
"detach",
$labelMenu.data('issue-id'),
$(this).data('id')
);
}
} else {
$(this).addClass('checked');
$(this).find('.octicon').addClass('octicon-check');
if (hasLabelUpdateAction) {
updateIssuesMeta(
$labelMenu.data('update-url'),
"attach",
$labelMenu.data('issue-id'),
$(this).data('id')
);
}
}
var labelIds = [];
$(this).parent().find('.item').each(function () {
if ($(this).hasClass('checked')) {
labelIds.push($(this).data('id'));
$($(this).data('id-selector')).removeClass('hide');
} else {
$($(this).data('id-selector')).addClass('hide');
}
});
if (labelIds.length == 0) {
$noSelect.removeClass('hide');
} else {
$noSelect.addClass('hide');
}
$($(this).parent().data('id')).val(labelIds.join(","));
return false;
});
$labelMenu.find('.no-select.item').click(function () {
if (hasLabelUpdateAction) {
updateIssuesMeta(
$labelMenu.data('update-url'),
"clear",
$labelMenu.data('issue-id'),
""
);
}
$(this).parent().find('.item').each(function () {
$(this).removeClass('checked');
$(this).find('.octicon').removeClass('octicon-check');
});
$list.find('.item').each(function () {
$(this).addClass('hide');
});
$noSelect.removeClass('hide');
$($(this).parent().data('id')).val('');
});
function selectItem(select_id, input_id) {
var $menu = $(select_id + ' .menu');
var $list = $('.ui' + select_id + '.list');
var hasUpdateAction = $menu.data('action') == 'update';
$menu.find('.item:not(.no-select)').click(function () {
$(this).parent().find('.item').each(function () {
$(this).removeClass('selected active')
});
$(this).addClass('selected active');
if (hasUpdateAction) {
updateIssuesMeta(
$menu.data('update-url'),
"",
$menu.data('issue-id'),
$(this).data('id'),
function() { location.reload(); }
);
}
switch (input_id) {
case '#milestone_id':
$list.find('.selected').html('<a class="item" href=' + $(this).data('href') + '>' +
$(this).text() + '</a>');
break;
case '#assignee_id':
$list.find('.selected').html('<a class="item" href=' + $(this).data('href') + '>' +
'<img class="ui avatar image" src=' + $(this).data('avatar') + '>' +
$(this).text() + '</a>');
}
$('.ui' + select_id + '.list .no-select').addClass('hide');
$(input_id).val($(this).data('id'));
});
$menu.find('.no-select.item').click(function () {
$(this).parent().find('.item:not(.no-select)').each(function () {
$(this).removeClass('selected active')
});
if (hasUpdateAction) {
updateIssuesMeta(
$menu.data('update-url'),
"",
$menu.data('issue-id'),
$(this).data('id'),
function() { location.reload(); }
);
}
$list.find('.selected').html('');
$list.find('.no-select').removeClass('hide');
$(input_id).val('');
});
}
// Milestone and assignee
selectItem('.select-milestone', '#milestone_id');
selectItem('.select-assignee', '#assignee_id');
}
function initInstall() {
if ($('.install').length == 0) {
return;
}
if ($('#db_host').val()=="") {
$('#db_host').val("127.0.0.1:3306");
$('#db_user').val("gitea");
$('#db_name').val("gitea");
}
// Database type change detection.
$("#db_type").change(function () {
var sqliteDefault = 'data/gitea.db';
var tidbDefault = 'data/gitea_tidb';
var dbType = $(this).val();
if (dbType === "SQLite3" || dbType === "TiDB") {
$('#sql_settings').hide();
$('#pgsql_settings').hide();
$('#sqlite_settings').show();
if (dbType === "SQLite3" && $('#db_path').val() == tidbDefault) {
$('#db_path').val(sqliteDefault);
} else if (dbType === "TiDB" && $('#db_path').val() == sqliteDefault) {
$('#db_path').val(tidbDefault);
}
return;
}
var dbDefaults = {
"MySQL": "127.0.0.1:3306",
"PostgreSQL": "127.0.0.1:5432",
"MSSQL": "127.0.0.1:1433"
};
$('#sqlite_settings').hide();
$('#sql_settings').show();
$('#pgsql_settings').toggle(dbType === "PostgreSQL");
$.each(dbDefaults, function(type, defaultHost) {
if ($('#db_host').val() == defaultHost) {
$('#db_host').val(dbDefaults[dbType]);
return false;
}
});
});
// TODO: better handling of exclusive relations.
$('#offline-mode input').change(function () {
if ($(this).is(':checked')) {
$('#disable-gravatar').checkbox('check');
$('#federated-avatar-lookup').checkbox('uncheck');
}
});
$('#disable-gravatar input').change(function () {
if ($(this).is(':checked')) {
$('#federated-avatar-lookup').checkbox('uncheck');
} else {
$('#offline-mode').checkbox('uncheck');
}
});
$('#federated-avatar-lookup input').change(function () {
if ($(this).is(':checked')) {
$('#disable-gravatar').checkbox('uncheck');
$('#offline-mode').checkbox('uncheck');
}
});
$('#enable-openid-signin input').change(function () {
if ($(this).is(':checked')) {
if ( $('#disable-registration input').is(':checked') ) {
} else {
$('#enable-openid-signup').checkbox('check');
}
} else {
$('#enable-openid-signup').checkbox('uncheck');
}
});
$('#disable-registration input').change(function () {
if ($(this).is(':checked')) {
$('#enable-captcha').checkbox('uncheck');
$('#enable-openid-signup').checkbox('uncheck');
} else {
$('#enable-openid-signup').checkbox('check');
}
});
$('#enable-captcha input').change(function () {
if ($(this).is(':checked')) {
$('#disable-registration').checkbox('uncheck');
}
});
}
function initRepository() {
if ($('.repository').length == 0) {
return;
}
function initFilterSearchDropdown(selector) {
var $dropdown = $(selector);
$dropdown.dropdown({
fullTextSearch: true,
selectOnKeydown: false,
onChange: function (text, value, $choice) {
if ($choice.data('url')) {
window.location.href = $choice.data('url');
}
},
message: {noResults: $dropdown.data('no-results')}
});
}
// File list and commits
if ($('.repository.file.list').length > 0 ||
('.repository.commits').length > 0) {
initFilterBranchTagDropdown('.choose.reference .dropdown');
}
// Wiki
if ($('.repository.wiki.view').length > 0) {
initFilterSearchDropdown('.choose.page .dropdown');
}
// Options
if ($('.repository.settings.options').length > 0) {
$('#repo_name').keyup(function () {
var $prompt = $('#repo-name-change-prompt');
if ($(this).val().toString().toLowerCase() != $(this).data('repo-name').toString().toLowerCase()) {
$prompt.show();
} else {
$prompt.hide();
}
});
// Enable or select internal/external wiki system and issue tracker.
$('.enable-system').change(function () {
if (this.checked) {
$($(this).data('target')).removeClass('disabled');
if (!$(this).data('context')) $($(this).data('context')).addClass('disabled');
} else {
$($(this).data('target')).addClass('disabled');
if (!$(this).data('context')) $($(this).data('context')).removeClass('disabled');
}
});
$('.enable-system-radio').change(function () {
if (this.value == 'false') {
$($(this).data('target')).addClass('disabled');
if (typeof $(this).data('context') !== 'undefined') $($(this).data('context')).removeClass('disabled');
} else if (this.value == 'true') {
$($(this).data('target')).removeClass('disabled');
if (typeof $(this).data('context') !== 'undefined') $($(this).data('context')).addClass('disabled');
}
});
}
// Labels
if ($('.repository.labels').length > 0) {
// Create label
var $newLabelPanel = $('.new-label.segment');
$('.new-label.button').click(function () {
$newLabelPanel.show();
});
$('.new-label.segment .cancel').click(function () {
$newLabelPanel.hide();
});
$('.color-picker').each(function () {
$(this).minicolors();
});
$('.precolors .color').click(function () {
var color_hex = $(this).data('color-hex');
$('.color-picker').val(color_hex);
$('.minicolors-swatch-color').css("background-color", color_hex);
});
$('.edit-label-button').click(function () {
$('#label-modal-id').val($(this).data('id'));
$('.edit-label .new-label-input').val($(this).data('title'));
$('.edit-label .color-picker').val($(this).data('color'));
$('.minicolors-swatch-color').css("background-color", $(this).data('color'));
$('.edit-label.modal').modal({
onApprove: function () {
$('.edit-label.form').submit();
}
}).modal('show');
return false;
});
}
// Milestones
if ($('.repository.milestones').length > 0) {
}
if ($('.repository.new.milestone').length > 0) {
var $datepicker = $('.milestone.datepicker');
$datepicker.datetimepicker({
lang: $datepicker.data('lang'),
inline: true,
timepicker: false,
startDate: $datepicker.data('start-date'),
formatDate: 'Y-m-d',
onSelectDate: function (ct) {
$('#deadline').val(ct.dateFormat('Y-m-d'));
}
});
$('#clear-date').click(function () {
$('#deadline').val('');
return false;
});
}
// Issues
if ($('.repository.view.issue').length > 0) {
// Edit issue title
var $issueTitle = $('#issue-title');
var $editInput = $('#edit-title-input input');
var editTitleToggle = function () {
$issueTitle.toggle();
$('.not-in-edit').toggle();
$('#edit-title-input').toggle();
$('.in-edit').toggle();
$editInput.focus();
return false;
};
$('#edit-title').click(editTitleToggle);
$('#cancel-edit-title').click(editTitleToggle);
$('#save-edit-title').click(editTitleToggle).click(function () {
if ($editInput.val().length == 0 ||
$editInput.val() == $issueTitle.text()) {
$editInput.val($issueTitle.text());
return false;
}
$.post($(this).data('update-url'), {
"_csrf": csrf,
"title": $editInput.val()
},
function (data) {
$editInput.val(data.title);
$issueTitle.text(data.title);
location.reload();
});
return false;
});
// Edit issue or comment content
$('.edit-content').click(function () {
var $segment = $(this).parent().parent().parent().next();
var $editContentZone = $segment.find('.edit-content-zone');
var $renderContent = $segment.find('.render-content');
var $rawContent = $segment.find('.raw-content');
var $textarea;
// Setup new form
if ($editContentZone.html().length == 0) {
$editContentZone.html($('#edit-content-form').html());
$textarea = $segment.find('textarea');
// Give new write/preview data-tab name to distinguish from others
var $editContentForm = $editContentZone.find('.ui.comment.form');
var $tabMenu = $editContentForm.find('.tabular.menu');
$tabMenu.attr('data-write', $editContentZone.data('write'));
$tabMenu.attr('data-preview', $editContentZone.data('preview'));
$tabMenu.find('.write.item').attr('data-tab', $editContentZone.data('write'));
$tabMenu.find('.preview.item').attr('data-tab', $editContentZone.data('preview'));
$editContentForm.find('.write.segment').attr('data-tab', $editContentZone.data('write'));
$editContentForm.find('.preview.segment').attr('data-tab', $editContentZone.data('preview'));
initCommentPreviewTab($editContentForm);
$editContentZone.find('.cancel.button').click(function () {
$renderContent.show();
$editContentZone.hide();
});
$editContentZone.find('.save.button').click(function () {
$renderContent.show();
$editContentZone.hide();
$.post($editContentZone.data('update-url'), {
"_csrf": csrf,
"content": $textarea.val(),
"context": $editContentZone.data('context')
},
function (data) {
if (data.length == 0) {
$renderContent.html($('#no-content').html());
} else {
$renderContent.html(data.content);
emojify.run($renderContent[0]);
$('pre code', $renderContent[0]).each(function (i, block) {
hljs.highlightBlock(block);
});
}
});
});
} else {
$textarea = $segment.find('textarea');
}
// Show write/preview tab and copy raw content as needed
$editContentZone.show();
$renderContent.hide();
if ($textarea.val().length == 0) {
$textarea.val($rawContent.text());
}
$textarea.focus();
return false;
});
// Delete comment
$('.delete-comment').click(function () {
var $this = $(this);
if (confirm($this.data('locale'))) {
$.post($this.data('url'), {
"_csrf": csrf
}).success(function () {
$('#' + $this.data('comment-id')).remove();
});
}
return false;
});
// Change status
var $statusButton = $('#status-button');
$('#comment-form .edit_area').keyup(function () {
if ($(this).val().length == 0) {
$statusButton.text($statusButton.data('status'))
} else {
$statusButton.text($statusButton.data('status-and-comment'))
}
});
$statusButton.click(function () {
$('#status').val($statusButton.data('status-val'));
$('#comment-form').submit();
});
}
// Diff
if ($('.repository.diff').length > 0) {
var $counter = $('.diff-counter');
if ($counter.length >= 1) {
$counter.each(function (i, item) {
var $item = $(item);
var addLine = $item.find('span[data-line].add').data("line");
var delLine = $item.find('span[data-line].del').data("line");
var addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100;
$item.find(".bar .add").css("width", addPercent + "%");
});
}
}
// Quick start and repository home
$('#repo-clone-ssh').click(function () {
$('.clone-url').text($(this).data('link'));
$('#repo-clone-url').val($(this).data('link'));
$(this).addClass('blue');
$('#repo-clone-https').removeClass('blue');
localStorage.setItem('repo-clone-protocol', 'ssh');
});
$('#repo-clone-https').click(function () {
$('.clone-url').text($(this).data('link'));
$('#repo-clone-url').val($(this).data('link'));
$(this).addClass('blue');
$('#repo-clone-ssh').removeClass('blue');
localStorage.setItem('repo-clone-protocol', 'https');
});
$('#repo-clone-url').click(function () {
$(this).select();
});
// Pull request
if ($('.repository.compare.pull').length > 0) {
initFilterSearchDropdown('.choose.branch .dropdown');
}
// Branches
if ($('.repository.settings.branches').length > 0) {
initFilterSearchDropdown('.protected-branches .dropdown');
$('.enable-protection, .enable-whitelist').change(function () {
if (this.checked) {
$($(this).data('target')).removeClass('disabled');
} else {
$($(this).data('target')).addClass('disabled');
}
});
}
}
function initRepositoryCollaboration() {
console.log('initRepositoryCollaboration');
// Change collaborator access mode
$('.access-mode.menu .item').click(function () {
var $menu = $(this).parent();
$.post($menu.data('url'), {
"_csrf": csrf,
"uid": $menu.data('uid'),
"mode": $(this).data('value')
})
});
}
function initTeamSettings() {
// Change team access mode
$('.organization.new.team input[name=permission]').change(function () {
var val = $('input[name=permission]:checked', '.organization.new.team').val()
if (val === 'admin') {
$('.organization.new.team .team-units').hide();
} else {
$('.organization.new.team .team-units').show();
}
});
}
function initWikiForm() {
var $editArea = $('.repository.wiki textarea#edit_area');
if ($editArea.length > 0) {
new SimpleMDE({
autoDownloadFontAwesome: false,
element: $editArea[0],
forceSync: true,
previewRender: function (plainText, preview) { // Async method
setTimeout(function () {
// FIXME: still send render request when return back to edit mode
$.post($editArea.data('url'), {
"_csrf": csrf,
"mode": "gfm",
"context": $editArea.data('context'),
"text": plainText
},
function (data) {
preview.innerHTML = '<div class="markdown">' + data + '</div>';
emojify.run($('.editor-preview')[0]);
$('.editor-preview').autolink();
}
);
}, 0);
return "Loading...";
},
renderingConfig: {
singleLineBreaks: false
},
indentWithTabs: false,
tabSize: 4,
spellChecker: false,
toolbar: ["bold", "italic", "strikethrough", "|",
"heading-1", "heading-2", "heading-3", "heading-bigger", "heading-smaller", "|",
"code", "quote", "|",
"unordered-list", "ordered-list", "|",
"link", "image", "table", "horizontal-rule", "|",
"clean-block", "preview", "fullscreen"]
})
}
}
var simpleMDEditor;
var codeMirrorEditor;
// For IE
String.prototype.endsWith = function (pattern) {
var d = this.length - pattern.length;
return d >= 0 && this.lastIndexOf(pattern) === d;
};
// Adding function to get the cursor position in a text field to jQuery object.
(function ($, undefined) {
$.fn.getCursorPosition = function () {
var el = $(this).get(0);
var pos = 0;
if ('selectionStart' in el) {
pos = el.selectionStart;
} else if ('selection' in document) {
el.focus();
var Sel = document.selection.createRange();
var SelLength = document.selection.createRange().text.length;
Sel.moveStart('character', -el.value.length);
pos = Sel.text.length - SelLength;
}
return pos;
}
})(jQuery);
function setSimpleMDE($editArea) {
if (codeMirrorEditor) {
codeMirrorEditor.toTextArea();
codeMirrorEditor = null;
}
if (simpleMDEditor) {
return true;
}
simpleMDEditor = new SimpleMDE({
autoDownloadFontAwesome: false,
element: $editArea[0],
forceSync: true,
renderingConfig: {
singleLineBreaks: false
},
indentWithTabs: false,
tabSize: 4,
spellChecker: false,
previewRender: function (plainText, preview) { // Async method
setTimeout(function () {
// FIXME: still send render request when return back to edit mode
$.post($editArea.data('url'), {
"_csrf": csrf,
"mode": "gfm",
"context": $editArea.data('context'),
"text": plainText
},
function (data) {
preview.innerHTML = '<div class="markdown">' + data + '</div>';
emojify.run($('.editor-preview')[0]);
}
);
}, 0);
return "Loading...";
},
toolbar: ["bold", "italic", "strikethrough", "|",
"heading-1", "heading-2", "heading-3", "heading-bigger", "heading-smaller", "|",
"code", "quote", "|",
"unordered-list", "ordered-list", "|",
"link", "image", "table", "horizontal-rule", "|",
"clean-block", "preview", "fullscreen", "side-by-side"]
});
return true;
}
function setCodeMirror($editArea) {
if (simpleMDEditor) {
simpleMDEditor.toTextArea();
simpleMDEditor = null;
}
if (codeMirrorEditor) {
return true;
}
codeMirrorEditor = CodeMirror.fromTextArea($editArea[0], {
lineNumbers: true
});
codeMirrorEditor.on("change", function (cm, change) {
$editArea.val(cm.getValue());
});
return true;
}
function initEditor() {
$('.js-quick-pull-choice-option').change(function () {
if ($(this).val() == 'commit-to-new-branch') {
$('.quick-pull-branch-name').show();
$('.quick-pull-branch-name input').prop('required',true);
} else {
$('.quick-pull-branch-name').hide();
$('.quick-pull-branch-name input').prop('required',false);
}
});
var $editFilename = $("#file-name");
$editFilename.keyup(function (e) {
var $section = $('.breadcrumb span.section');
var $divider = $('.breadcrumb div.divider');
if (e.keyCode == 8) {
if ($(this).getCursorPosition() == 0) {
if ($section.length > 0) {
var value = $section.last().find('a').text();
$(this).val(value + $(this).val());
$(this)[0].setSelectionRange(value.length, value.length);
$section.last().remove();
$divider.last().remove();
}
}
}
if (e.keyCode == 191) {
var parts = $(this).val().split('/');
for (var i = 0; i < parts.length; ++i) {
var value = parts[i];
if (i < parts.length - 1) {
if (value.length) {
$('<span class="section"><a href="#">' + value + '</a></span>').insertBefore($(this));
$('<div class="divider"> / </div>').insertBefore($(this));
}
}
else {
$(this).val(value);
}
$(this)[0].setSelectionRange(0, 0);
}
}
var parts = [];
$('.breadcrumb span.section').each(function (i, element) {
element = $(element);
if (element.find('a').length) {
parts.push(element.find('a').text());
} else {
parts.push(element.text());
}
});
if ($(this).val())
parts.push($(this).val());
$('#tree_path').val(parts.join('/'));
}).trigger('keyup');
var $editArea = $('.repository.editor textarea#edit_area');
if (!$editArea.length)
return;
var markdownFileExts = $editArea.data("markdown-file-exts").split(",");
var lineWrapExtensions = $editArea.data("line-wrap-extensions").split(",");
$editFilename.on("keyup", function (e) {
var val = $editFilename.val(), m, mode, spec, extension, extWithDot, previewLink, dataUrl, apiCall;
extension = extWithDot = "";
if (m = /.+\.([^.]+)$/.exec(val)) {
extension = m[1];
extWithDot = "." + extension;
}
var info = CodeMirror.findModeByExtension(extension);
previewLink = $('a[data-tab=preview]');
if (info) {
mode = info.mode;
spec = info.mime;
apiCall = mode;
}
else {
apiCall = extension
}
if (previewLink.length && apiCall && previewFileModes && previewFileModes.length && previewFileModes.indexOf(apiCall) >= 0) {
dataUrl = previewLink.data('url');
previewLink.data('url', dataUrl.replace(/(.*)\/.*/i, '$1/' + mode));
previewLink.show();
}
else {
previewLink.hide();
}
// If this file is a Markdown extensions, we will load that editor and return
if (markdownFileExts.indexOf(extWithDot) >= 0) {
if (setSimpleMDE($editArea)) {
return;
}
}
// Else we are going to use CodeMirror
if (!codeMirrorEditor && !setCodeMirror($editArea)) {
return;
}
if (mode) {
codeMirrorEditor.setOption("mode", spec);
CodeMirror.autoLoadMode(codeMirrorEditor, mode);
}
if (lineWrapExtensions.indexOf(extWithDot) >= 0) {
codeMirrorEditor.setOption("lineWrapping", true);
}
else {
codeMirrorEditor.setOption("lineWrapping", false);
}
// get the filename without any folder
var value = $editFilename.val();
if (value.length === 0) {
return;
}
value = value.split('/');
value = value[value.length - 1];
$.getJSON($editFilename.data('ec-url-prefix')+value, function(editorconfig) {
if (editorconfig.indent_style === 'tab') {
codeMirrorEditor.setOption("indentWithTabs", true);
codeMirrorEditor.setOption('extraKeys', {});
} else {
codeMirrorEditor.setOption("indentWithTabs", false);
// required because CodeMirror doesn't seems to use spaces correctly for {"indentWithTabs": false}:
// - https://github.com/codemirror/CodeMirror/issues/988
// - https://codemirror.net/doc/manual.html#keymaps
codeMirrorEditor.setOption('extraKeys', {
Tab: function(cm) {
var spaces = Array(parseInt(cm.getOption("indentUnit")) + 1).join(" ");
cm.replaceSelection(spaces);
}
});
}
codeMirrorEditor.setOption("indentUnit", editorconfig.indent_size || 4);
codeMirrorEditor.setOption("tabSize", editorconfig.tab_width || 4);
});
}).trigger('keyup');
}
function initOrganization() {
if ($('.organization').length == 0) {
return;
}
// Options
if ($('.organization.settings.options').length > 0) {
$('#org_name').keyup(function () {
var $prompt = $('#org-name-change-prompt');
if ($(this).val().toString().toLowerCase() != $(this).data('org-name').toString().toLowerCase()) {
$prompt.show();
} else {
$prompt.hide();
}
});
}
}
function initUserSettings() {
console.log('initUserSettings');
// Options
if ($('.user.settings.profile').length > 0) {
$('#username').keyup(function () {
var $prompt = $('#name-change-prompt');
if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) {
$prompt.show();
} else {
$prompt.hide();
}
});
}
}
function initWebhook() {
if ($('.new.webhook').length == 0) {
return;
}
$('.events.checkbox input').change(function () {
if ($(this).is(':checked')) {
$('.events.fields').show();
}
});
$('.non-events.checkbox input').change(function () {
if ($(this).is(':checked')) {
$('.events.fields').hide();
}
});
// Test delivery
$('#test-delivery').click(function () {
var $this = $(this);
$this.addClass('loading disabled');
$.post($this.data('link'), {
"_csrf": csrf
}).done(
setTimeout(function () {
window.location.href = $this.data('redirect');
}, 5000)
)
});
}
function initAdmin() {
if ($('.admin').length == 0) {
return;
}
// New user
if ($('.admin.new.user').length > 0 ||
$('.admin.edit.user').length > 0) {
$('#login_type').change(function () {
if ($(this).val().substring(0, 1) == '0') {
$('#login_name').removeAttr('required');
$('.non-local').hide();
$('.local').show();
$('#user_name').focus();
if ($(this).data('password') == "required") {
$('#password').attr('required', 'required');
}
} else {
$('#login_name').attr('required', 'required');
$('.non-local').show();
$('.local').hide();
$('#login_name').focus();
$('#password').removeAttr('required');
}
});
}
function onSecurityProtocolChange() {
if ($('#security_protocol').val() > 0) {
$('.has-tls').show();
} else {
$('.has-tls').hide();
}
}
function onOAuth2Change() {
$('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url').hide();
$('.open_id_connect_auto_discovery_url input[required]').removeAttr('required');
var provider = $('#oauth2_provider').val();
switch (provider) {
case 'github':
case 'gitlab':
$('.oauth2_use_custom_url').show();
break;
case 'openidConnect':
$('.open_id_connect_auto_discovery_url input').attr('required', 'required');
$('.open_id_connect_auto_discovery_url').show();
break;
}
onOAuth2UseCustomURLChange();
}
function onOAuth2UseCustomURLChange() {
var provider = $('#oauth2_provider').val();
$('.oauth2_use_custom_url_field').hide();
$('.oauth2_use_custom_url_field input[required]').removeAttr('required');
if ($('#oauth2_use_custom_url').is(':checked')) {
if (!$('#oauth2_token_url').val()) {
$('#oauth2_token_url').val($('#' + provider + '_token_url').val());
}
if (!$('#oauth2_auth_url').val()) {
$('#oauth2_auth_url').val($('#' + provider + '_auth_url').val());
}
if (!$('#oauth2_profile_url').val()) {
$('#oauth2_profile_url').val($('#' + provider + '_profile_url').val());
}
if (!$('#oauth2_email_url').val()) {
$('#oauth2_email_url').val($('#' + provider + '_email_url').val());
}
switch (provider) {
case 'github':
$('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input').attr('required', 'required');
$('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url').show();
break;
case 'gitlab':
$('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input').attr('required', 'required');
$('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url').show();
$('#oauth2_email_url').val('');
break;
}
}
}
// New authentication
if ($('.admin.new.authentication').length > 0) {
$('#auth_type').change(function () {
$('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls').hide();
$('.ldap input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required] .has-tls input[required]').removeAttr('required');
var authType = $(this).val();
switch (authType) {
case '2': // LDAP
$('.ldap').show();
$('.ldap div.required:not(.dldap) input').attr('required', 'required');
break;
case '3': // SMTP
$('.smtp').show();
$('.has-tls').show();
$('.smtp div.required input, .has-tls').attr('required', 'required');
break;
case '4': // PAM
$('.pam').show();
$('.pam input').attr('required', 'required');
break;
case '5': // LDAP
$('.dldap').show();
$('.dldap div.required:not(.ldap) input').attr('required', 'required');
break;
case '6': // OAuth2
$('.oauth2').show();
$('.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input').attr('required', 'required');
onOAuth2Change();
break;
}
if (authType == '2' || authType == '5') {
onSecurityProtocolChange()
}
});
$('#auth_type').change();
$('#security_protocol').change(onSecurityProtocolChange);
$('#oauth2_provider').change(onOAuth2Change);
$('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
}
// Edit authentication
if ($('.admin.edit.authentication').length > 0) {
var authType = $('#auth_type').val();
if (authType == '2' || authType == '5') {
$('#security_protocol').change(onSecurityProtocolChange);
} else if (authType == '6') {
$('#oauth2_provider').change(onOAuth2Change);
$('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
onOAuth2Change();
}
}
// Notice
if ($('.admin.notice')) {
var $detailModal = $('#detail-modal');
// Attach view detail modals
$('.view-detail').click(function () {
$detailModal.find('.content p').text($(this).data('content'));
$detailModal.modal('show');
return false;
});
// Select actions
var $checkboxes = $('.select.table .ui.checkbox');
$('.select.action').click(function () {
switch ($(this).data('action')) {
case 'select-all':
$checkboxes.checkbox('check');
break;
case 'deselect-all':
$checkboxes.checkbox('uncheck');
break;
case 'inverse':
$checkboxes.checkbox('toggle');
break;
}
});
$('#delete-selection').click(function () {
var $this = $(this);
$this.addClass("loading disabled");
var ids = [];
$checkboxes.each(function () {
if ($(this).checkbox('is checked')) {
ids.push($(this).data('id'));
}
});
$.post($this.data('link'), {
"_csrf": csrf,
"ids": ids
}).done(function () {
window.location.href = $this.data('redirect');
});
});
}
}
function buttonsClickOnEnter() {
$('.ui.button').keypress(function (e) {
if (e.keyCode == 13 || e.keyCode == 32) // enter key or space bar
$(this).click();
});
}
function hideWhenLostFocus(body, parent) {
$(document).click(function (e) {
var target = e.target;
if (!$(target).is(body) && !$(target).parents().is(parent)) {
$(body).hide();
}
});
}
function searchUsers() {
var $searchUserBox = $('#search-user-box');
$searchUserBox.search({
minCharacters: 2,
apiSettings: {
url: suburl + '/api/v1/users/search?q={query}',
onResponse: function(response) {
var items = [];
$.each(response.data, function (i, item) {
var title = item.login;
if (item.full_name && item.full_name.length > 0) {
title += ' (' + item.full_name + ')';
}
items.push({
title: title,
image: item.avatar_url
})
});
return { results: items }
}
},
searchFields: ['login', 'full_name'],
showNoResults: false
});
}
function searchRepositories() {
var $searchRepoBox = $('#search-repo-box');
$searchRepoBox.search({
minCharacters: 2,
apiSettings: {
url: suburl + '/api/v1/repos/search?q={query}&uid=' + $searchRepoBox.data('uid'),
onResponse: function(response) {
var items = [];
$.each(response.data, function (i, item) {
items.push({
title: item.full_name.split("/")[1],
description: item.full_name
})
});
return { results: items }
}
},
searchFields: ['full_name'],
showNoResults: false
});
}
function initCodeView() {
if ($('.code-view .linenums').length > 0) {
$(document).on('click', '.lines-num span', function (e) {
var $select = $(this);
var $list = $select.parent().siblings('.lines-code').find('ol.linenums > li');
selectRange($list, $list.filter('[rel=' + $select.attr('id') + ']'), (e.shiftKey ? $list.filter('.active').eq(0) : null));
deSelect();
});
$(window).on('hashchange', function (e) {
var m = window.location.hash.match(/^#(L\d+)\-(L\d+)$/);
var $list = $('.code-view ol.linenums > li');
var $first;
if (m) {
$first = $list.filter('.' + m[1]);
selectRange($list, $first, $list.filter('.' + m[2]));
$("html, body").scrollTop($first.offset().top - 200);
return;
}
m = window.location.hash.match(/^#(L\d+)$/);
if (m) {
$first = $list.filter('.' + m[1]);
selectRange($list, $first);
$("html, body").scrollTop($first.offset().top - 200);
}
}).trigger('hashchange');
}
}
$(document).ready(function () {
csrf = $('meta[name=_csrf]').attr("content");
suburl = $('meta[name=_suburl]').attr("content");
// Show exact time
$('.time-since').each(function () {
$(this).addClass('poping up').attr('data-content', $(this).attr('title')).attr('data-variation', 'inverted tiny').attr('title', '');
});
// Semantic UI modules.
$('.dropdown:not(.custom)').dropdown();
$('.jump.dropdown').dropdown({
action: 'hide',
onShow: function () {
$('.poping.up').popup('hide');
}
});
$('.slide.up.dropdown').dropdown({
transition: 'slide up'
});
$('.upward.dropdown').dropdown({
direction: 'upward'
});
$('.ui.accordion').accordion();
$('.ui.checkbox').checkbox();
$('.ui.progress').progress({
showActivity: false
});
$('.poping.up').popup();
$('.top.menu .poping.up').popup({
onShow: function () {
if ($('.top.menu .menu.transition').hasClass('visible')) {
return false;
}
}
});
$('.tabular.menu .item').tab();
$('.tabable.menu .item').tab();
$('.toggle.button').click(function () {
$($(this).data('target')).slideToggle(100);
});
// make table <tr> element clickable like a link
$('tr[data-href]').click(function(event) {
window.location = $(this).data('href');
});
// Highlight JS
if (typeof hljs != 'undefined') {
hljs.initHighlightingOnLoad();
}
// Dropzone
var $dropzone = $('#dropzone');
if ($dropzone.length > 0) {
// Disable auto discover for all elements:
Dropzone.autoDiscover = false;
var filenameDict = {};
$dropzone.dropzone({
url: $dropzone.data('upload-url'),
headers: {"X-Csrf-Token": csrf},
maxFiles: $dropzone.data('max-file'),
maxFilesize: $dropzone.data('max-size'),
acceptedFiles: ($dropzone.data('accepts') === '*/*') ? null : $dropzone.data('accepts'),
addRemoveLinks: true,
dictDefaultMessage: $dropzone.data('default-message'),
dictInvalidFileType: $dropzone.data('invalid-input-type'),
dictFileTooBig: $dropzone.data('file-too-big'),
dictRemoveFile: $dropzone.data('remove-file'),
init: function () {
this.on("success", function (file, data) {
filenameDict[file.name] = data.uuid;
var input = $('<input id="' + data.uuid + '" name="files" type="hidden">').val(data.uuid);
$('.files').append(input);
});
this.on("removedfile", function (file) {
if (file.name in filenameDict) {
$('#' + filenameDict[file.name]).remove();
}
if ($dropzone.data('remove-url') && $dropzone.data('csrf')) {
$.post($dropzone.data('remove-url'), {
file: filenameDict[file.name],
_csrf: $dropzone.data('csrf')
});
}
})
}
});
}
// Emojify
emojify.setConfig({
img_dir: suburl + '/vendor/plugins/emojify/images',
ignore_emoticons: true
});
var hasEmoji = document.getElementsByClassName('has-emoji');
for (var i = 0; i < hasEmoji.length; i++) {
emojify.run(hasEmoji[i]);
}
// Clipboard JS
var clipboard = new Clipboard('.clipboard');
clipboard.on('success', function (e) {
e.clearSelection();
$('#' + e.trigger.getAttribute('id')).popup('destroy');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-success'))
$('#' + e.trigger.getAttribute('id')).popup('show');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))
});
clipboard.on('error', function (e) {
$('#' + e.trigger.getAttribute('id')).popup('destroy');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-error'))
$('#' + e.trigger.getAttribute('id')).popup('show');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'))
});
// Helpers.
$('.delete-button').click(showDeletePopup);
$('.delete-branch-button').click(showDeletePopup);
$('.undo-button').click(function() {
var $this = $(this);
$.post($this.data('url'), {
"_csrf": csrf,
"id": $this.data("id")
}).done(function(data) {
window.location.href = data.redirect;
});
});
$('.show-panel.button').click(function () {
$($(this).data('panel')).show();
});
$('.show-modal.button').click(function () {
$($(this).data('modal')).modal('show');
});
$('.delete-post.button').click(function () {
var $this = $(this);
$.post($this.data('request-url'), {
"_csrf": csrf
}).done(function () {
window.location.href = $this.data('done-url');
});
});
// Set anchor.
$('.markdown').each(function () {
var headers = {};
$(this).find('h1, h2, h3, h4, h5, h6').each(function () {
var node = $(this);
var val = encodeURIComponent(node.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g, '').replace(/[ ]/g, '-'));
var name = val;
if (headers[val] > 0) {
name = val + '-' + headers[val];
}
if (headers[val] == undefined) {
headers[val] = 1;
} else {
headers[val] += 1;
}
node = node.wrap('<div id="' + name + '" class="anchor-wrap" ></div>');
node.append('<a class="anchor" href="#' + name + '"><span class="octicon octicon-link"></span></a>');
});
});
$('.markdown').autolink();
$('.issue-checkbox').click(function() {
var numChecked = $('.issue-checkbox').children('input:checked').length;
if (numChecked > 0) {
$('.issue-filters').hide();
$('.issue-actions').show();
} else {
$('.issue-filters').show();
$('.issue-actions').hide();
}
});
$('.issue-action').click(function () {
var action = this.dataset.action
var elementId = this.dataset.elementId
var issueIDs = $('.issue-checkbox').children('input:checked').map(function() {
return this.dataset.issueId;
}).get().join();
var url = this.dataset.url
updateIssuesMeta(url, action, issueIDs, elementId, function() {
location.reload();
});
});
buttonsClickOnEnter();
searchUsers();
searchRepositories();
initCommentForm();
initInstall();
initRepository();
initWikiForm();
initEditForm();
initEditor();
initOrganization();
initWebhook();
initAdmin();
initCodeView();
initVueApp();
initTeamSettings();
initCtrlEnterSubmit();
// Repo clone url.
if ($('#repo-clone-url').length > 0) {
switch (localStorage.getItem('repo-clone-protocol')) {
case 'ssh':
if ($('#repo-clone-ssh').click().length === 0) {
$('#repo-clone-https').click();
}
break;
default:
$('#repo-clone-https').click();
break;
}
}
var routes = {
'div.user.settings': initUserSettings,
'div.repository.settings.collaboration': initRepositoryCollaboration
};
var selector;
for (selector in routes) {
if ($(selector).length > 0) {
routes[selector]();
break;
}
}
});
function changeHash(hash) {
if (history.pushState) {
history.pushState(null, null, hash);
}
else {
location.hash = hash;
}
}
function deSelect() {
if (window.getSelection) {
window.getSelection().removeAllRanges();
} else {
document.selection.empty();
}
}
function selectRange($list, $select, $from) {
$list.removeClass('active');
if ($from) {
var a = parseInt($select.attr('rel').substr(1));
var b = parseInt($from.attr('rel').substr(1));
var c;
if (a != b) {
if (a > b) {
c = a;
a = b;
b = c;
}
var classes = [];
for (var i = a; i <= b; i++) {
classes.push('.L' + i);
}
$list.filter(classes.join(',')).addClass('active');
changeHash('#L' + a + '-' + 'L' + b);
return
}
}
$select.addClass('active');
changeHash('#' + $select.attr('rel'));
}
$(function () {
if ($('.user.signin').length > 0) return;
$('form').areYouSure();
// Parse SSH Key
$("#ssh-key-content").on('change paste keyup',function(){
var arrays = $(this).val().split(" ");
var $title = $("#ssh-key-title")
if ($title.val() === "" && arrays.length === 3 && arrays[2] !== "") {
$title.val(arrays[2]);
}
});
});
function showDeletePopup() {
var $this = $(this);
var filter = "";
if ($this.attr("id")) {
filter += "#" + $this.attr("id")
}
$('.delete.modal' + filter).modal({
closable: false,
onApprove: function() {
if ($this.data('type') == "form") {
$($this.data('form')).submit();
return;
}
$.post($this.data('url'), {
"_csrf": csrf,
"id": $this.data("id")
}).done(function(data) {
window.location.href = data.redirect;
});
}
}).modal('show');
return false;
}
function initVueComponents(){
var vueDelimeters = ['${', '}'];
Vue.component('repo-search', {
delimiters: vueDelimeters,
props: {
searchLimit: {
type: Number,
default: 10
},
suburl: {
type: String,
required: true
},
uid: {
type: Number,
required: true
},
organizations: {
type: Array,
default: []
},
isOrganization: {
type: Boolean,
default: true
},
canCreateOrganization: {
type: Boolean,
default: false
},
organizationsTotalCount: {
type: Number,
default: 0
},
moreReposLink: {
type: String,
default: ''
}
},
data: function() {
return {
tab: 'repos',
repos: [],
reposTotalCount: 0,
reposFilter: 'all',
searchQuery: '',
isLoading: false,
repoTypes: {
'all': {
count: 0,
searchMode: '',
},
'forks': {
count: 0,
searchMode: 'fork',
},
'mirrors': {
count: 0,
searchMode: 'mirror',
},
'sources': {
count: 0,
searchMode: 'source',
},
'collaborative': {
count: 0,
searchMode: 'collaborative',
},
}
}
},
computed: {
showMoreReposLink: function() {
return this.repos.length > 0 && this.repos.length < this.repoTypes[this.reposFilter].count;
},
searchURL: function() {
return this.suburl + '/api/v1/repos/search?uid=' + this.uid + '&q=' + this.searchQuery + '&limit=' + this.searchLimit + '&mode=' + this.repoTypes[this.reposFilter].searchMode + (this.reposFilter !== 'all' ? '&exclusive=1' : '');
},
repoTypeCount: function() {
return this.repoTypes[this.reposFilter].count;
}
},
mounted: function() {
this.searchRepos(this.reposFilter);
var self = this;
Vue.nextTick(function() {
self.$refs.search.focus();
});
},
methods: {
changeTab: function(t) {
this.tab = t;
},
changeReposFilter: function(filter) {
this.reposFilter = filter;
this.repos = [];
this.repoTypes[filter].count = 0;
this.searchRepos(filter);
},
showRepo: function(repo, filter) {
switch (filter) {
case 'sources':
return repo.owner.id == this.uid && !repo.mirror && !repo.fork;
case 'forks':
return repo.owner.id == this.uid && !repo.mirror && repo.fork;
case 'mirrors':
return repo.mirror;
case 'collaborative':
return repo.owner.id != this.uid && !repo.mirror;
default:
return true;
}
},
searchRepos: function(reposFilter) {
var self = this;
this.isLoading = true;
var searchedMode = this.repoTypes[reposFilter].searchMode;
var searchedURL = this.searchURL;
var searchedQuery = this.searchQuery;
$.getJSON(searchedURL, function(result, textStatus, request) {
if (searchedURL == self.searchURL) {
self.repos = result.data;
var count = request.getResponseHeader('X-Total-Count');
if (searchedQuery === '' && searchedMode === '') {
self.reposTotalCount = count;
}
self.repoTypes[reposFilter].count = count;
}
}).always(function() {
if (searchedURL == self.searchURL) {
self.isLoading = false;
}
});
},
repoClass: function(repo) {
if (repo.fork) {
return 'octicon octicon-repo-forked';
} else if (repo.mirror) {
return 'octicon octicon-repo-clone';
} else if (repo.private) {
return 'octicon octicon-lock';
} else {
return 'octicon octicon-repo';
}
}
}
})
}
function initCtrlEnterSubmit() {
$(".js-quick-submit").keydown(function(e) {
if (((e.ctrlKey && !e.altKey) || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) {
$(this).closest("form").submit();
}
});
}
function initVueApp() {
var el = document.getElementById('app');
if (!el) {
return;
}
initVueComponents();
new Vue({
delimiters: ['${', '}'],
el: el,
data: {
searchLimit: document.querySelector('meta[name=_search_limit]').content,
suburl: document.querySelector('meta[name=_suburl]').content,
uid: document.querySelector('meta[name=_context_uid]').content,
},
});
}
function timeAddManual() {
$('.mini.modal')
.modal({
duration: 200,
onApprove: function() {
$('#add_time_manual_form').submit();
}
}).modal('show')
;
}
function toggleStopwatch() {
$("#toggle_stopwatch_form").submit();
}
function cancelStopwatch() {
$("#cancel_stopwatch_form").submit();
}
function initFilterBranchTagDropdown(selector) {
$(selector).each(function() {
var $dropdown = $(this);
var $data = $dropdown.find('.data');
var data = {
items: [],
mode: $data.data('mode'),
searchTerm: '',
noResults: '',
canCreateBranch: false,
menuVisible: false,
active: 0
};
$data.find('.item').each(function() {
data.items.push({
name: $(this).text(),
url: $(this).data('url'),
branch: $(this).hasClass('branch'),
tag: $(this).hasClass('tag'),
selected: $(this).hasClass('selected')
});
});
$data.remove();
new Vue({
delimiters: ['${', '}'],
el: this,
data: data,
beforeMount: function () {
var vm = this;
this.noResults = vm.$el.getAttribute('data-no-results');
this.canCreateBranch = vm.$el.getAttribute('data-can-create-branch') === 'true';
document.body.addEventListener('click', function(event) {
if (vm.$el.contains(event.target)) {
return;
}
if (vm.menuVisible) {
Vue.set(vm, 'menuVisible', false);
}
});
},
watch: {
menuVisible: function(visible) {
if (visible) {
this.focusSearchField();
}
}
},
computed: {
filteredItems: function() {
var vm = this;
var items = vm.items.filter(function (item) {
return ((vm.mode === 'branches' && item.branch)
|| (vm.mode === 'tags' && item.tag))
&& (!vm.searchTerm
|| item.name.toLowerCase().indexOf(vm.searchTerm.toLowerCase()) >= 0);
});
vm.active = (items.length === 0 && vm.showCreateNewBranch ? 0 : -1);
return items;
},
showNoResults: function() {
return this.filteredItems.length === 0
&& !this.showCreateNewBranch;
},
showCreateNewBranch: function() {
var vm = this;
if (!this.canCreateBranch || !vm.searchTerm || vm.mode === 'tags') {
return false;
}
return vm.items.filter(function (item) {
return item.name.toLowerCase() === vm.searchTerm.toLowerCase()
}).length === 0;
}
},
methods: {
selectItem: function(item) {
var prev = this.getSelected();
if (prev !== null) {
prev.selected = false;
}
item.selected = true;
window.location.href = item.url;
},
createNewBranch: function() {
if (!this.showCreateNewBranch) {
return;
}
this.$refs.newBranchForm.submit();
},
focusSearchField: function() {
var vm = this;
Vue.nextTick(function() {
vm.$refs.searchField.focus();
});
},
getSelected: function() {
for (var i = 0, j = this.items.length; i < j; ++i) {
if (this.items[i].selected)
return this.items[i];
}
return null;
},
getSelectedIndexInFiltered: function() {
for (var i = 0, j = this.filteredItems.length; i < j; ++i) {
if (this.filteredItems[i].selected)
return i;
}
return -1;
},
scrollToActive: function() {
var el = this.$refs['listItem' + this.active];
if (!el || el.length === 0) {
return;
}
if (Array.isArray(el)) {
el = el[0];
}
var cont = this.$refs.scrollContainer;
if (el.offsetTop < cont.scrollTop) {
cont.scrollTop = el.offsetTop;
}
else if (el.offsetTop + el.clientHeight > cont.scrollTop + cont.clientHeight) {
cont.scrollTop = el.offsetTop + el.clientHeight - cont.clientHeight;
}
},
keydown: function(event) {
var vm = this;
if (event.keyCode === 40) {
// arrow down
event.preventDefault();
if (vm.active === -1) {
vm.active = vm.getSelectedIndexInFiltered();
}
if (vm.active + (vm.showCreateNewBranch ? 0 : 1) >= vm.filteredItems.length) {
return;
}
vm.active++;
vm.scrollToActive();
}
if (event.keyCode === 38) {
// arrow up
event.preventDefault();
if (vm.active === -1) {
vm.active = vm.getSelectedIndexInFiltered();
}
if (vm.active <= 0) {
return;
}
vm.active--;
vm.scrollToActive();
}
if (event.keyCode == 13) {
// enter
event.preventDefault();
if (vm.active >= vm.filteredItems.length) {
vm.createNewBranch();
} else if (vm.active >= 0) {
vm.selectItem(vm.filteredItems[vm.active]);
}
}
if (event.keyCode == 27) {
// escape
event.preventDefault();
vm.menuVisible = false;
}
}
}
});
});
}
|
import PropTypes from "prop-types";
import React, { Component } from "react";
import CheckBoxFilter from "./CheckBoxFilter";
import { createDefaultObjectFrom } from "../../../utils";
class CheckBoxFilterContainer extends Component {
constructor(props) {
super(props);
this.onValueChange = this.onValueChange.bind(this);
}
onValueChange(event) {
const valueKey = event.target.id;
const updatedValue = this.getUpdatedValues(valueKey);
this.props.onChange(updatedValue);
}
getUpdatedValues(key) {
const values = this.props.value;
let newValues = values;
if (this.props.exclusive) {
newValues = createDefaultObjectFrom(values, false);
}
newValues[key] = !values[key];
return newValues;
}
render() {
const { title, error, value } = this.props;
return (
<CheckBoxFilter
title={title}
onChange={this.onValueChange}
value={value}
error={error}
/>
);
}
}
CheckBoxFilterContainer.propTypes = {
title: PropTypes.string.isRequired,
value: PropTypes.objectOf(PropTypes.bool).isRequired,
onChange: PropTypes.func.isRequired,
error: PropTypes.string,
exclusive: PropTypes.bool
};
CheckBoxFilterContainer.defaultProps = {
exclusive: true,
error: ""
};
export default CheckBoxFilterContainer;
|
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/jax/output/SVG/autoload/multiline.js
*
* Implements the SVG output for <mrow>'s that contain line breaks.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2011-2013 The MathJax Consortium
*
* 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.
*/
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
var VERSION = "2.3";
var MML = MathJax.ElementJax.mml,
SVG = MathJax.OutputJax.SVG,
BBOX = SVG.BBOX;
//
// Penalties for the various line breaks
//
var PENALTY = {
newline: 0,
nobreak: 1000000,
goodbreak: [-200],
badbreak: [+200],
auto: [0],
toobig: 800,
nestfactor: 400,
spacefactor: -100,
spaceoffset: 2,
spacelimit: 1, // spaces larger than this get a penalty boost
fence: 500,
close: 500
};
var ENDVALUES = {linebreakstyle: "after"};
/**************************************************************************/
MML.mrow.Augment({
//
// Handle breaking an mrow into separate lines
//
SVGmultiline: function (svg) {
//
// Find the parent element and mark it as multiline
//
var parent = this;
while (parent.inferred || (parent.parent && parent.parent.type === "mrow" &&
parent.parent.data.length === 1)) {parent = parent.parent}
var isTop = ((parent.type === "math" && parent.Get("display") === "block") ||
parent.type === "mtd");
parent.isMultiline = true;
//
// Default values for the line-breaking parameters
//
var VALUES = this.getValues(
"linebreak","linebreakstyle","lineleading","linebreakmultchar",
"indentalign","indentshift",
"indentalignfirst","indentshiftfirst",
"indentalignlast","indentshiftlast"
);
if (VALUES.linebreakstyle === MML.LINEBREAKSTYLE.INFIXLINEBREAKSTYLE)
{VALUES.linebreakstyle = this.Get("infixlinebreakstyle")}
VALUES.lineleading = SVG.length2em(VALUES.lineleading,1,0.5);
//
// Start with a fresh SVG element
// and make it full width if we are breaking to a specific width
// in the top-level math element
//
svg = this.SVG();
if (isTop && parent.type !== "mtd") {
if (SVG.linebreakWidth < SVG.BIGDIMEN) {svg.w = SVG.linebreakWidth}
else {svg.w = SVG.cwidth/SVG.em * 1000}
}
var state = {
n: 0, Y: 0,
scale: this.scale || 1,
isTop: isTop,
values: {},
VALUES: VALUES
},
align = this.SVGgetAlign(state,{}),
shift = this.SVGgetShift(state,{},align),
start = [],
end = {
index:[], penalty:PENALTY.nobreak,
w:0, W:shift, shift:shift, scanW:shift,
nest: 0
},
broken = false;
//
// Break the expression at its best line breaks
//
while (this.SVGbetterBreak(end,state) &&
(end.scanW >= SVG.linebreakWidth || end.penalty === PENALTY.newline)) {
this.SVGaddLine(svg,start,end.index,state,end.values,broken);
start = end.index.slice(0); broken = true;
align = this.SVGgetAlign(state,end.values);
shift = this.SVGgetShift(state,end.values,align);
if (align === MML.INDENTALIGN.CENTER) {shift = 0}
end.W = end.shift = end.scanW = shift; end.penalty = PENALTY.nobreak;
}
state.isLast = true;
this.SVGaddLine(svg,start,[],state,ENDVALUES,broken);
this.SVGhandleSpace(svg);
this.SVGhandleColor(svg);
svg.isMultiline = true;
this.SVGsaveData(svg);
return svg;
}
});
/**************************************************************************/
MML.mbase.Augment({
SVGlinebreakPenalty: PENALTY,
/****************************************************************/
//
// Locate the next linebreak that is better than the current one
//
SVGbetterBreak: function (info,state) {
if (this.isToken) {return false} // FIXME: handle breaking of token elements
if (this.isEmbellished()) {
info.embellished = this;
return this.CoreMO().SVGbetterBreak(info,state);
}
if (this.linebreakContainer) {return false}
//
// Get the current breakpoint position and other data
//
var index = info.index.slice(0), i = info.index.shift(),
m = this.data.length, W, w, scanW, broken = (info.index.length > 0), better = false;
if (i == null) {i = -1}; if (!broken) {i++; info.W += info.w; info.w = 0}
scanW = info.scanW = info.W; info.nest++;
//
// Look through the line for breakpoints,
// (as long as we are not too far past the breaking width)
//
while (i < m && info.scanW < 1.33*SVG.linebreakWidth) {
if (this.data[i]) {
if (this.data[i].SVGbetterBreak(info,state)) {
better = true; index = [i].concat(info.index); W = info.W; w = info.w;
if (info.penalty === PENALTY.newline) {
info.index = index;
if (info.nest) {info.nest--}
return true;
}
}
scanW = (broken ? info.scanW : this.SVGaddWidth(i,info,scanW));
}
info.index = []; i++; broken = false;
}
if (info.nest) {info.nest--}
info.index = index;
if (better) {info.W = W}
return better;
},
SVGaddWidth: function (i,info,scanW) {
if (this.data[i]) {
var svg = this.data[i].SVGdata;
scanW += svg.w + svg.x; if (svg.X) {scanW += svg.X}
info.W = info.scanW = scanW; info.w = 0;
}
return scanW;
},
/****************************************************************/
//
// Create a new line and move the required elements into it
// Position it using proper alignment and indenting
//
SVGaddLine: function (svg,start,end,state,values,broken) {
//
// Create a box for the line, with empty BBox
// fill it with the proper elements,
// and clean up the bbox
//
var line = BBOX();
state.first = broken; state.last = true;
this.SVGmoveLine(start,end,line,state,values);
line.Clean();
//
// Get the alignment and shift values
//
var align = this.SVGgetAlign(state,values),
shift = this.SVGgetShift(state,values,align);
//
// Add in space for the shift
//
if (shift) {
if (align === MML.INDENTALIGN.LEFT) {line.x = shift} else
if (align === MML.INDENTALIGN.RIGHT) {line.w += shift; line.r = line.w}
}
//
// Set the Y offset based on previous depth, leading, and current height
//
if (state.n > 0) {
var LHD = SVG.FONTDATA.baselineskip * state.scale;
var leading = (state.values.lineleading == null ? state.VALUES : state.values).lineleading * state.scale;
state.Y -= Math.max(LHD,state.d + line.h + leading);
}
//
// Place the new line
//
svg.Align(line,align,0,state.Y);
//
// Save the values needed for the future
//
state.d = line.d; state.values = values; state.n++;
},
/****************************************************************/
//
// Get alignment and shift values from the given data
//
SVGgetAlign: function (state,values) {
var cur = values, prev = state.values, def = state.VALUES, align;
if (state.n === 0) {align = cur.indentalignfirst || prev.indentalignfirst || def.indentalignfirst}
else if (state.isLast) {align = prev.indentalignlast || def.indentalignlast}
else {align = prev.indentalign || def.indentalign}
if (align === MML.INDENTALIGN.INDENTALIGN) {align = prev.indentalign || def.indentalign}
if (align === MML.INDENTALIGN.AUTO) {align = (state.isTop ? this.displayAlign : MML.INDENTALIGN.LEFT)}
return align;
},
SVGgetShift: function (state,values,align) {
if (align === MML.INDENTALIGN.CENTER) {return 0}
var cur = values, prev = state.values, def = state.VALUES, shift;
if (state.n === 0) {shift = cur.indentshiftfirst || prev.indentshiftfirst || def.indentshiftfirst}
else if (state.isLast) {shift = prev.indentshiftlast || def.indentshiftlast}
else {shift = prev.indentshift || def.indentshift}
if (shift === MML.INDENTSHIFT.INDENTSHIFT) {shift = prev.indentshift || def.indentshift}
if (shift === "auto" || shift === "") {shift = (state.isTSop ? this.displayIndent : "0")}
return SVG.length2em(shift,0);
},
/****************************************************************/
//
// Move the selected elements into the new line,
// moving whole items when possible, and parts of ones
// that are split by a line break.
//
SVGmoveLine: function (start,end,svg,state,values) {
var i = start[0], j = end[0];
if (i == null) {i = -1}; if (j == null) {j = this.data.length-1}
if (i === j && start.length > 1) {
//
// If starting and ending in the same element move the subpiece to the new line
//
this.data[i].SVGmoveSlice(start.slice(1),end.slice(1),svg,state,values,"paddingLeft");
} else {
//
// Otherwise, move the remainder of the initial item
// and any others up to the last one
//
var last = state.last; state.last = false;
while (i < j) {
if (this.data[i]) {
if (start.length <= 1) {this.data[i].SVGmove(svg,state,values)}
else {this.data[i].SVGmoveSlice(start.slice(1),[],svg,state,values,"paddingLeft")}
}
i++; state.first = false; start = [];
}
//
// If the last item is complete, move it,
// otherwise move the first part of it up to the split
//
state.last = last;
if (this.data[i]) {
if (end.length <= 1) {this.data[i].SVGmove(svg,state,values)}
else {this.data[i].SVGmoveSlice([],end.slice(1),svg,state,values,"paddingRight")}
}
}
},
/****************************************************************/
//
// Split an element and copy the selected items into the new part
//
SVGmoveSlice: function (start,end,svg,state,values,padding) {
//
// Create a new container for the slice of the element
// Move the selected portion into the slice
//
var slice = BBOX();
this.SVGmoveLine(start,end,slice,state,values);
slice.Clean();
this.SVGhandleColor(slice);
svg.Add(slice,svg.w,0,true);
return slice;
},
/****************************************************************/
//
// Move an element from its original position to its new location in
// a split element or the new line's position
//
SVGmove: function (line,state,values) {
// FIXME: handle linebreakstyle === "duplicate"
// FIXME: handle linebreakmultchar
if (!(state.first || state.last) ||
(state.first && state.values.linebreakstyle === MML.LINEBREAKSTYLE.BEFORE) ||
(state.last && values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER)) {
//
// Recreate output
// Remove padding (if first, remove at leftt, if last remove at right)
// Add to line
//
var svg = this.toSVG(this.SVGdata.HW,this.SVGdata.D);
if (state.first || state.nextIsFirst) {svg.x = 0}
if (state.last && svg.X) {svg.X = 0}
line.Add(svg,line.w,0,true);
}
if (state.first && svg && svg.w === 0) {state.nextIsFirst = true}
else {delete state.nextIsFirst}
}
});
/**************************************************************************/
MML.mfenced.Augment({
SVGbetterBreak: function (info,state) {
//
// Get the current breakpoint position and other data
//
var index = info.index.slice(0), i = info.index.shift(),
m = this.data.length, W, w, scanW, broken = (info.index.length > 0), better = false;
if (i == null) {i = -1}; if (!broken) {i++; info.W += info.w; info.w = 0}
scanW = info.scanW = info.W; info.nest++;
//
// Create indices that include the delimiters and separators
//
if (!this.dataI) {
this.dataI = [];
if (this.data.open) {this.dataI.push("open")}
if (m) {this.dataI.push(0)}
for (var j = 1; j < m; j++) {
if (this.data["sep"+j]) {this.dataI.push("sep"+j)}
this.dataI.push(j);
}
if (this.data.close) {this.dataI.push("close")}
}
m = this.dataI.length;
//
// Look through the line for breakpoints, including the open, close, and separators
// (as long as we are not too far past the breaking width)
//
while (i < m && info.scanW < 1.33*SVG.linebreakWidth) {
var k = this.dataI[i];
if (this.data[k]) {
if (this.data[k].SVGbetterBreak(info,state)) {
better = true; index = [i].concat(info.index); W = info.W; w = info.w;
if (info.penalty === PENALTY.newline) {
info.index = index;
if (info.nest) {info.nest--}
return true;
}
}
scanW = (broken ? info.scanW : this.SVGaddWidth(i,info,scanW));
}
info.index = []; i++; broken = false;
}
if (info.nest) {info.nest--}
info.index = index;
if (better) {info.W = W; info.w = w}
return better;
},
SVGmoveLine: function (start,end,svg,state,values) {
var i = start[0], j = end[0];
if (i == null) {i = -1}; if (j == null) {j = this.dataI.length-1}
if (i === j && start.length > 1) {
//
// If starting and ending in the same element move the subpiece to the new line
//
this.data[this.dataI[i]].SVGmoveSlice(start.slice(1),end.slice(1),svg,state,values,"paddingLeft");
} else {
//
// Otherwise, move the remainder of the initial item
// and any others (including open and separators) up to the last one
//
var last = state.last; state.last = false; var k = this.dataI[i];
while (i < j) {
if (this.data[k]) {
if (start.length <= 1) {this.data[k].SVGmove(svg,state,values)}
else {this.data[k].SVGmoveSlice(start.slice(1),[],svg,state,values,"paddingLeft")}
}
i++; k = this.dataI[i]; state.first = false; start = [];
}
//
// If the last item is complete, move it
//
state.last = last;
if (this.data[k]) {
if (end.length <= 1) {this.data[k].SVGmove(svg,state,values)}
else {this.data[k].SVGmoveSlice([],end.slice(1),svg,state,values,"paddingRight")}
}
}
}
});
/**************************************************************************/
MML.msubsup.Augment({
SVGbetterBreak: function (info,state) {
if (!this.data[this.base]) {return false}
//
// Get the current breakpoint position and other data
//
var index = info.index.slice(0), i = info.index.shift(),
W, w, scanW, broken = (info.index.length > 0), better = false;
if (!broken) {info.W += info.w; info.w = 0}
scanW = info.scanW = info.W;
//
// Record the width of the base and the super- and subscripts
//
if (i == null) {this.SVGdata.dw = this.SVGdata.w - this.data[this.base].SVGdata.w}
//
// Check if the base can be broken
//
if (this.data[this.base].SVGbetterBreak(info,state)) {
better = true; index = [this.base].concat(info.index); W = info.W; w = info.w;
if (info.penalty === PENALTY.newline) {better = broken = true}
}
//
// Add in the base if it is unbroken, and add the scripts
//
if (!broken) {this.SVGaddWidth(this.base,info,scanW)}
info.scanW += this.SVGdata.dw; info.W = info.scanW;
info.index = []; if (better) {info.W = W; info.w = w; info.index = index}
return better;
},
SVGmoveLine: function (start,end,svg,state,values) {
//
// Move the proper part of the base
//
if (this.data[this.base]) {
if (start.length > 1) {
this.data[this.base].SVGmoveSlice(start.slice(1),end.slice(1),svg,state,values,"paddingLeft");
} else {
if (end.length <= 1) {this.data[this.base].SVGmove(svg,state,values)}
else {this.data[this.base].SVGmoveSlice([],end.slice(1),svg,state,values,"paddingRight")}
}
}
//
// If this is the end, check for super and subscripts, and move those
// by moving the stack that contains them, and shifting by the amount of the
// base that has been removed. Remove the empty base box from the stack.
//
if (end.length === 0) {
var sup = this.data[this.sup], sub = this.data[this.sub], w = svg.w, data;
if (sup) {data = sup.SVGdata; svg.Add(sup.toSVG(),w+(data.dx||0),data.dy)}
if (sub) {data = sub.SVGdata; svg.Add(sub.toSVG(),w+(data.dx||0),data.dy)}
}
}
});
/**************************************************************************/
MML.mmultiscripts.Augment({
SVGbetterBreak: function (info,state) {
if (!this.data[this.base]) {return false}
//
// Get the current breakpoint position and other data
//
var index = info.index.slice(0), i = info.index.shift(),
W, w, scanW, broken = (info.index.length > 0), better = false;
if (!broken) {info.W += info.w; info.w = 0}
info.scanW = info.W;
//
// The width of the postscripts
//
var dw = this.SVGdata.w - this.data[this.base].SVGdata.w - this.SVGdata.dx;
//
// Add in the prescripts
//
info.scanW += this.SVGdata.dx; scanW = info.scanW;
//
// Check if the base can be broken (but don't break between prescripts and base)
//
if (this.data[this.base].SVGbetterBreak(info,state)) {
better = true; index = [this.base].concat(info.index); W = info.W; w = info.w;
if (info.penalty === PENALTY.newline) {better = broken = true}
}
//
// Add in the base if it is unbroken, and add the postscripts
//
if (!broken) {this.SVGaddWidth(this.base,info,scanW)}
info.scanW += dw; info.W = info.scanW;
info.index = []; if (better) {info.W = W; info.w = w; info.index = index}
return better;
},
SVGmoveLine: function (start,end,svg,state,values) {
var dx, data = this.SVGdata;
//
// If this is the start, move the prescripts, if any.
//
if (start.length < 1) {
this.scriptBox = this.SVGgetScripts(this.SVGdata.s);
var presub = this.scriptBox[2], presup = this.scriptBox[3]; dx = svg.w + data.dx;
if (presup) {svg.Add(presup,dx+data.delta-presup.w,data.u)}
if (presub) {svg.Add(presub,dx-presub.w,-data.v)}
}
//
// Move the proper part of the base
//
if (this.data[this.base]) {
if (start.length > 1) {
this.data[this.base].SVGmoveSlice(start.slice(1),end.slice(1),svg,state,values,"paddingLeft");
} else {
if (end.length <= 1) {this.data[this.base].SVGmove(svg,state,values)}
else {this.data[this.base].SVGmoveSlice([],end.slice(1),svg,state,values,"paddingRight")}
}
}
//
// If this is the end, move the postscripts, if any.
//
if (end.length === 0) {
var sub = this.scriptBox[0], sup = this.scriptBox[1]; dx = svg.w + data.s;
if (sup) {svg.Add(sup,dx,data.u)}
if (sub) {svg.Add(sub,dx-data.delta,-data.v)}
delete this.scriptBox;
}
}
});
/**************************************************************************/
MML.mo.Augment({
//
// Override the method for checking line breaks to properly handle <mo>
//
SVGbetterBreak: function (info,state) {
if (info.values && info.values.last === this) {return false}
var values = this.getValues(
"linebreak","linebreakstyle","lineleading","linebreakmultchar",
"indentalign","indentshift",
"indentalignfirst","indentshiftfirst",
"indentalignlast","indentshiftlast",
"texClass", "fence"
);
if (values.linebreakstyle === MML.LINEBREAKSTYLE.INFIXLINEBREAKSTYLE)
{values.linebreakstyle = this.Get("infixlinebreakstyle")}
//
// Adjust nesting by TeX class (helps output that does not include
// mrows for nesting, but can leave these unbalanced.
//
if (values.texClass === MML.TEXCLASS.OPEN) {info.nest++}
if (values.texClass === MML.TEXCLASS.CLOSE && info.nest) {info.nest--}
//
// Get the default penalty for this location
//
var W = info.scanW, mo = info.embellished; delete info.embellished;
if (!mo || !mo.SVGdata) {mo = this}
var svg = mo.SVGdata, w = svg.w + svg.x;
if (values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER) {W += w; w = 0}
if (W - info.shift === 0 && values.linebreak !== MML.LINEBREAK.NEWLINE)
{return false} // don't break at zero width (FIXME?)
var offset = SVG.linebreakWidth - W;
// adjust offest for explicit first-line indent and align
if (state.n === 0 && (values.indentshiftfirst !== state.VALUES.indentshiftfirst ||
values.indentalignfirst !== state.VALUES.indentalignfirst)) {
var align = this.SVGgetAlign(state,values),
shift = this.SVGgetShift(state,values,align);
offset += (info.shift - shift);
}
//
var penalty = Math.floor(offset / SVG.linebreakWidth * 1000);
if (penalty < 0) {penalty = PENALTY.toobig - 3*penalty}
if (values.fence) {penalty += PENALTY.fence}
if ((values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER &&
values.texClass === MML.TEXCLASS.OPEN) ||
values.texClass === MML.TEXCLASS.CLOSE) {penalty += PENALTY.close}
penalty += info.nest * PENALTY.nestfactor;
//
// Get the penalty for this type of break and
// use it to modify the default penalty
//
var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO];
if (!(linebreak instanceof Array)) {
// for breaks past the width, don't modify penalty
if (offset >= 0) {penalty = linebreak * info.nest}
} else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)}
//
// If the penalty is no better than the current one, return false
// Otherwise save the data for this breakpoint and return true
//
if (penalty >= info.penalty) {return false}
info.penalty = penalty; info.values = values; info.W = W; info.w = w;
values.lineleading = SVG.length2em(values.lineleading,state.VALUES.lineleading);
values.last = this;
return true;
}
});
/**************************************************************************/
MML.mspace.Augment({
//
// Override the method for checking line breaks to properly handle <mspace>
//
SVGbetterBreak: function (info,state) {
if (info.values && info.values.last === this) {return false}
var values = this.getValues("linebreak");
var linebreakValue = values.linebreak;
if (!linebreakValue || this.hasDimAttr()) {
// The MathML spec says that the linebreak attribute should be ignored
// if any dimensional attribute is set.
linebreakValue = MML.LINEBREAK.AUTO;
}
//
// Get the default penalty for this location
//
var W = info.scanW, svg = this.SVGdata, w = svg.w + svg.x;
if (W - info.shift === 0) {return false} // don't break at zero width (FIXME?)
var offset = SVG.linebreakWidth - W;
//
var penalty = Math.floor(offset / SVG.linebreakWidth * 1000);
if (penalty < 0) {penalty = PENALTY.toobig - 3*penalty}
penalty += info.nest * PENALTY.nestfactor;
//
// Get the penalty for this type of break and
// use it to modify the default penalty
//
var linebreak = PENALTY[linebreakValue];
if (linebreakValue === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit*1000 &&
!this.mathbackground && !this.backrgound)
{linebreak = [(w/1000+PENALTY.spaceoffset)*PENALTY.spacefactor]}
if (!(linebreak instanceof Array)) {
// for breaks past the width, don't modify penalty
if (offset >= 0) {penalty = linebreak * info.nest}
} else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)}
//
// If the penalty is no better than the current one, return false
// Otherwise save the data for this breakpoint and return true
//
if (penalty >= info.penalty) {return false}
info.penalty = penalty; info.values = values; info.W = W; info.w = w;
values.lineleading = state.VALUES.lineleading;
values.linebreakstyle = "before"; values.last = this;
return true;
}
});
//
// Hook into the mathchoice extension
//
MathJax.Hub.Register.StartupHook("TeX mathchoice Ready",function () {
MML.TeXmathchoice.Augment({
SVGbetterBreak: function (info,state) {
return this.Core().SVGbetterBreak(info,state);
},
SVGmoveLine: function (start,end,svg,state,values) {
return this.Core().SVGmoveSlice(start,end,svg,state,values);
}
});
});
//
// Have maction process only the selected item
//
MML.maction.Augment({
SVGbetterBreak: function (info,state) {
return this.Core().SVGbetterBreak(info,state);
},
SVGmoveLine: function (start,end,svg,state,values) {
return this.Core().SVGmoveSlice(start,end,svg,state,values);
},
});
//
// Have semantics only do the first element
// (FIXME: do we need to do anything special about annotation-xml?)
//
MML.semantics.Augment({
SVGbetterBreak: function (info,state) {
return (this.data[0] ? this.data[0].SVGbetterBreak(info,state) : false);
},
SVGmoveLine: function (start,end,svg,state,values) {
return (this.data[0] ? this.data[0].SVGmoveSlice(start,end,svg,state,values) : null);
}
});
/**************************************************************************/
MathJax.Hub.Startup.signal.Post("SVG multiline Ready");
MathJax.Ajax.loadComplete(SVG.autoloadDir+"/multiline.js");
});
|
'use strict';
angular.module('thrApp').controller('QuestionnaireDialogController',
['$scope', '$stateParams', '$modalInstance', 'entity', 'Questionnaire', 'Workorder',
function($scope, $stateParams, $modalInstance, entity, Questionnaire, Workorder) {
$scope.questionnaire = entity;
$scope.workorders = Workorder.query();
$scope.load = function(id) {
Questionnaire.get({id : id}, function(result) {
$scope.questionnaire = result;
});
};
var onSaveFinished = function (result) {
$scope.$emit('thrApp:questionnaireUpdate', result);
$modalInstance.close(result);
};
$scope.save = function () {
if ($scope.questionnaire.id != null) {
Questionnaire.update($scope.questionnaire, onSaveFinished);
} else {
Questionnaire.save($scope.questionnaire, onSaveFinished);
}
};
$scope.clear = function() {
$modalInstance.dismiss('cancel');
};
}]);
|
"use strict"
var net = require('net')
var cluster = require('cluster')
var log = require('debug')(require('./package.json').name + ' ' + process.pid)
var EventEmitter = require('events').EventEmitter
var which = require('which')
var path = require('path')
module.exports = function(opts) {
var port = opts.port
var doStart = opts.start
var timeout = opts.timeout
var args = opts.args
var daemon = opts.daemon
var minConnections = opts.minConnections
cluster.on('disconnect', function(worker) {
log('disconnected worker %d.', worker.id)
if (cluster.workers.length) return
if (!daemon) {
log('Not daemonized. Shutting down server.')
shutdown()
}
})
.on('listening', function(worker) {
log('worker listening %d.', worker.id)
})
.on('online', function(worker) {
log('worker online %d.', worker.id)
})
// TODO: should probably make a 'class'
// representing connection to worker
log('starting listener on port %d', port)
var child = {
connections: 0,
status: new EventEmitter()
}
var server = undefined
configureCluster(args, function() {
if (server) throw new Error('Already have server!')
server = net.createServer(onConnection)
server.listen(port, function() {
log('listening on %d', server.address().port)
if (!doStart) {
if (process.send) process.send(server.address().port)
return
}
log('starting...')
start(function() {
log('started.')
if (process.send) process.send(server.address().port)
})
})
})
function onConnection(socket) {
child.connections++
log('connecting. connections: %d', child.connections)
socket.on('end', onClose)
socket.pause() // wait for connection to service
clearTimeout(child.shutdown) // reset shutdown timeout on new connections
start(function(address) {
log('connecting to %d.', address.port)
var service = net.connect(address.port, function() {
log('piping request to %d.', address.port)
socket.pipe(service).pipe(socket)
socket.resume()
})
})
function onClose() {
child.connections--
log('connection closed. connections:', child.connections)
// start shutdown timeout if minimal connections
if (child.connections <= minConnections) {
log('connections (%d) hit minimum (%d)', child.connections, minConnections)
// TODO: make timeout configurable
log('shutting down in %dms', timeout)
child.shutdown = setTimeout(function() {
if (!child.worker) return // already dead or dying
log('shutting down worker %d.', child.worker.id)
if (child.worker.process.connected) child.worker.disconnect()
delete child.worker
delete child.address
}, timeout)
}
}
}
// call fn with connection address
// as soon as we know it.
// calls immediately if we already have
// a connection open.
function start(fn) {
if(child.address) return fn(child.address)
var status = child.status
status.once('ready', function() {
fn(child.address)
})
if (child.worker) {
log('connection waiting for worker')
return
}
log('booting new worker', args)
// Note:
// JSON parse/stringify here
// Prevents strange error:
// child_process.js:608
// envPairs.push(key + '=' + env[key]);
// TypeError: Cannot convert object to primitive value
var env = JSON.parse(JSON.stringify({env: process.env}))
var worker = child.worker = cluster.fork(env)
.once('listening', onListening)
.once('message', onMessage)
function onListening(address) {
if (address.port === 0) return
worker.removeListener('listening', onListening)
worker.removeListener('message', onMessage)
child.address = address
status.emit('ready')
}
function onMessage(msg) {
// node 0.8 mode
if (!msg.port) return
worker.removeListener('listening', onListening)
worker.removeListener('message', onMessage)
child.address = msg
status.emit('ready')
}
}
}
process.on('disconnect', function() {
log('parent disconnected')
shutdown()
})
function shutdown() {
setTimeout(function() {
log('cluster.disconnect timed out. killing.')
for (var id in cluster.workers) {
cluster.workers[id].kill()
}
process.exit()
}, 1000)
cluster.disconnect(function() {
log('disconnected all workers!')
process.exit()
})
}
function configureCluster(args, fn) {
var cmd = args[0]
which(cmd, function(err, cmd) {
if (err) return fn(err)
process.title = 'slacker: ' + path.basename(cmd) + ' ' + args.slice(1)
return fn(null, cluster.setupMaster({
exec : cmd,
args : args.slice(1)
}))
})
}
|
/**
* A simple test case that determines if elements, specified by a selector,
* exist or not.
*
* The test fails for elements that are found and a case is created for each
* one. The test passes is the selector finds no matching elements.
*/
quail.basefontIsNotUsed = function (quail, test, Case, options) {
var selector = 'basefont';
this.get('$scope').each(function () {
var candidates = $(this).find(selector);
if (!candidates.length) {
test.add(quail.lib.Case({
element: undefined,
status: 'inapplicable'
}));
}
else {
candidates.each(function () {
test.add(quail.lib.Case({
element: this,
status: 'failed'
}));
});
}
});
};
|
'use strict'
export function makeHttpRequest (method, url, body, callback) {
// method should be "GET" or "POST"
var request = new XMLHttpRequest()
request.onreadystatechange = function () {
if (this.readyState === 4) {
if (this.status === 200) {
callback(request.responseText, null)
} else {
callback(null, request.responseText)
}
}
}
request.open(method, url, true)
request.send(body)
}
// Given an event, returns a string representing the day and time of the event
export function getTimeString (event) {
var s = ['Po', 'Út', 'St', 'Čt', 'Pá'][event.day]
s += ' ' + event.time_from + '–' + event.time_to
if (event.week_parity === 1) {
s += ' (liché týdny)'
} else if (event.week_parity === 2) {
s += ' (sudé týdny)'
}
return s
}
export function timeToInt (s) {
// Parses times in the format 09:15
return parseInt(s.substring(0, 2)) * 60 + parseInt(s.substring(3, 5))
}
export function timeToRatio (time) {
var mint = timeToInt('07:00')
var maxt = timeToInt('20:00')
var ratio = Math.min(1, Math.max(0, (time - mint) / (maxt - mint)))
return ratio
}
export function sortCourses (courses) {
// Given an object containing courses, returns an array of courses
// sorted alphabetically by their name.
var coursesWithNames = []
for (var courseId in courses) {
coursesWithNames.push([courses[courseId].name, courses[courseId]])
}
coursesWithNames.sort()
return coursesWithNames.map(function (a) {
return a[1]
})
}
|
import {
BufferGeometry, Points, Vector3, Float32BufferAttribute,
InterleavedBuffer, InterleavedBufferAttribute, Matrix4, Vector4
} from '../Three';
import { STATION_ENTRANCE } from '../core/constants';
import { PointIndicator } from './PointIndicator';
const _position = new Vector4();
const _ssOrigin = new Vector4();
const _mouse = new Vector3();
const _mvMatrix = new Matrix4();
class Stations extends Points {
constructor ( survey ) {
const ctx = survey.ctx;
super( new BufferGeometry, ctx.materials.getExtendedPointsMaterial() );
this.type = 'CV.Stations';
this.stationCount = 0;
this.ctx = ctx;
const cfg = ctx.cfg;
this.baseColor = cfg.themeColor( 'stations.default.marker' );
this.junctionColor = cfg.themeColor( 'stations.junctions.marker' );
this.entranceColor = cfg.themeColor( 'stations.entrances.marker' );
this.vertices = [];
this.pointSizes = [];
this.instanceData = [];
this.survey = survey;
this.selected = null;
this.selectedSize = 0;
this.selection = survey.selection;
this.splaysVisible = false;
this.ssThresholdSq = Math.pow( cfg.value( 'stationSelectionDistance', 12 ), 2 );
const point = new PointIndicator( ctx, 0xff0000 );
point.visible = false;
this.addStatic( point );
this.highlightPoint = point;
}
raycast( raycaster, intersects ) {
// screen space raycasing for stations
if ( ! this.visible ) return intersects;
const matrixWorld = this.matrixWorld;
const ray = raycaster.ray;
// test against survey section bounding boxes
const surveyTree = this.survey.surveyTree;
const searchNodes = surveyTree.findIntersects( matrixWorld, ray );
const camera = raycaster.camera;
const projectionMatrix = camera.projectionMatrix;
const skipSplays = ! this.splaysVisible;
const near = - camera.near;
ray.at( 1, _ssOrigin );
// ndc space [ - 1.0, 1.0 ]
const container = this.ctx.container;
const scale = new Vector3( container.clientWidth / 2, container.clientHeight / 2, 1 );
_ssOrigin.w = 1;
_ssOrigin.applyMatrix4( camera.matrixWorldInverse );
_ssOrigin.applyMatrix4( camera.projectionMatrix );
_ssOrigin.multiplyScalar( 1 / _ssOrigin.w );
// screen space
_mouse.copy( _ssOrigin );
_mouse.multiply( scale );
_mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld );
const ssThresholdSq = this.ssThresholdSq;
for ( const node of searchNodes ) {
const vertices = node.children;
for ( let i = 0, l = vertices.length; i < l; i ++ ) {
const station = vertices[ i ];
// skip splay end stations if not visible
if ( skipSplays && station.connections === 0 || station.type === 0 ) continue;
_position.copy( station );
_position.w = 1;
_position.applyMatrix4( _mvMatrix );
if ( _position.z > near ) {
continue;
}
_position.applyMatrix4( projectionMatrix );
_position.multiplyScalar( 1 / _position.w );
_position.x *= scale.x;
_position.y *= scale.y;
testPoint( _position, station, i, ssThresholdSq, intersects, this );
}
}
}
addStation ( node ) {
if ( node.stationVertexIndex != -1 ) return; // duplicated entry
const instanceData = this.instanceData;
const offset = instanceData.length;
let pointSize = 0.0;
let color;
if ( node.type & STATION_ENTRANCE ) {
color = this.entranceColor;
pointSize = 12.0;
} else {
color = node.effectiveConnections() > 2 ? this.junctionColor : this.baseColor;
pointSize = 8.0;
}
this.vertices.push( node );
node.toArray( instanceData, offset );
color.toArray( instanceData, offset + 3 );
this.pointSizes.push( pointSize );
node.stationVertexIndex = this.stationCount++;
}
isStationVisible ( node ) {
return ( this.selection.contains( node.id ) &&
( node.connections > 0 || this.splaysVisible )
);
}
getStationByIndex ( index ) {
return this.vertices[ index ];
}
clearSelected () {
if ( this.selected !== null ) {
const pSize = this.geometry.getAttribute( 'pSize' );
pSize.setX( this.selected, this.selectedSize );
pSize.needsUpdate = true;
this.selected = null;
}
}
highlightStation ( node ) {
const highlightPoint = this.highlightPoint;
highlightPoint.position.copy( node );
highlightPoint.updateMatrix();
highlightPoint.visible = true;
return node;
}
clearHighlight () {
this.highlightPoint.visible = false;
}
selectStation ( node ) {
this.selectStationByIndex( node.stationVertexIndex );
}
selectStationByIndex ( index ) {
const pSize = this.geometry.getAttribute( 'pSize' );
if ( this.selected !== null ) {
pSize.setX( this.selected, this.selectedSize );
}
this.selectedSize = pSize.getX( index );
pSize.setX( index, this.selectedSize * 2 );
pSize.needsUpdate = true;
this.selected = index;
}
selectStations ( selection ) {
const vertices = this.vertices;
const l = vertices.length;
const pSize = this.geometry.getAttribute( 'pSize' );
const splaySize = this.splaysVisible ? 6.0 : 0.0;
const idSet = selection.getIds();
const isEmpty = selection.isEmpty();
for ( let i = 0; i < l; i++ ) {
const node = vertices[ i ];
let size = 8;
if ( isEmpty || idSet.has( node.id ) ) {
if ( node.type & STATION_ENTRANCE ) {
size = 12;
} else if ( node.connections === 0 ) {
size = splaySize;
}
pSize.setX( i, size );
} else {
pSize.setX( i, 0 );
if ( node.label !== undefined ) node.label.visible = false;
}
}
pSize.needsUpdate = true;
}
finalise () {
const bufferGeometry = this.geometry;
const buffer = new Float32Array( this.instanceData );
const instanceBuffer = new InterleavedBuffer( buffer, 6 ); // position, color
bufferGeometry.setAttribute( 'position', new InterleavedBufferAttribute( instanceBuffer, 3, 0 ) );
bufferGeometry.setAttribute( 'color', new InterleavedBufferAttribute( instanceBuffer, 3, 3 ) );
// non-interleaved to avoid excess data uploads to GPU
bufferGeometry.setAttribute( 'pSize', new Float32BufferAttribute( this.pointSizes, 1 ) );
this.instanceData = null;
}
setSplaysVisibility ( visible ) {
this.splaysVisible = visible;
const splaySize = visible ? 6.0 : 0.0;
const vertices = this.vertices;
const pSize = this.geometry.getAttribute( 'pSize' );
const l = vertices.length;
const selection = this.selection;
for ( let i = 0; i < l; i++ ) {
const node = vertices[ i ];
if ( node.connections === 0 && ( splaySize === 0 || selection.contains( node.id ) ) ) {
pSize.setX( i, splaySize );
}
}
pSize.needsUpdate = true;
}
resetPaths () {
this.vertices.forEach( node => node.shortestPath = Infinity );
}
forEach ( callback ) {
this.vertices.forEach( station => {
if ( station.connections !== 0 ) callback( station );
} );
}
}
function testPoint( point, station, index, localThresholdSq, intersects, object ) {
const dX = point.x - _mouse.x;
const dY = point.y - _mouse.y;
const distanceSq = dX * dX + dY * dY;
if ( distanceSq < localThresholdSq ) {
intersects.push( {
distance: Math.sqrt( distanceSq ),
point: point,
index: index,
station: station,
face: null,
object: object
} );
}
}
export { Stations }; |
'use strict';
/**
* @ngdoc overview
* @name sproutApp.services
*
* @description
* This `sproutApp.services` module contains the services of the app.
*/
angular.module('sproutApp.services', []);
|
export const recordDataTableDefaultState = {
currentPage: 1,
recordsPerPage: 25,
keyValues: [],
summaryValues: [],
sortFields: [{ field: 'DATE_MODIFIED', descending: true }],
records: [],
totalSize: 0,
availableOwners: [],
onlyMyOwnRecords: false,
ownerIds: [],
}
export const getRecordDataTableState = (dataManagementState) => dataManagementState.recordDataTable
export const getRecordDataTableCurrentPage = (state) =>
state.currentPage || 1
export const setRecordDataTableCurrentPage = (state, page) =>
state.currentPage = page
export const getRecordDataTableRecordsPerPage = (state) =>
state.recordsPerPage || 25
export const setRecordDataTableRecordsPerPage = (state, recordsPerPage) =>
state.recordsPerPage = recordsPerPage
export const getRecordDataTableRecords = (state) =>
state.records
export const getRecordDataTableSortFields = (state) =>
state.sortFields
export const getRecordDataTableShowOnlyMyOwnRecords = (state) =>
state.onlyMyOwnRecords
export const getRecordDataTableKeyValues = (state) =>
state.keyValues
export const getRecordDataTableSummaryValues = (state) =>
state.summaryValues
export const getRecordDataTableOwnerIds = (state) =>
state.ownerIds
export const updateRecordDataTableState = (state, newProps) =>
({...state, ...newProps})
export const updateRecordLockState = (state, recordId, lockedBy) => {
const records = Array.from(getRecordDataTableRecords(state))
const recordIndex = records.findIndex(record => record.id === recordId)
if (recordIndex >= 0) {
const record = records[recordIndex]
record.lockedBy = lockedBy
}
return updateRecordDataTableState(state, {records})
} |
'use strict';
export default class SearchHeaderController {
/*@ngInject*/
constructor($state) {
this.state = $state;
this.query = $state.params.query || '';
}
makeSearch() {
let shouldRefresh = this.state.current.name != 'search';
this.state.go('search', {
query: this.query
}, {
notify: shouldRefresh
});
}
} |
class ActionController extends ModelController {
/*constructor(model, parent) {
super(model, parent);
}*/
getActions() {
return [
{'action': 'moveUp' , 'caption': 'Move Up' },
{'action': 'moveDown' , 'caption': 'Move Down' },
{'action': 'delete', 'caption': 'Delete'}
];
}
async doAction(name) {
switch (name) {
case 'delete':
await this.delete();
break;
case 'moveUp':
await this.model.moveUp();
this.parent.moveColItem('actions', this, -1);
EditorFrontHostApp.editorApp.treeWidget2.rerender();
break;
case 'moveDown':
await this.model.moveDown();
this.parent.moveColItem('actions', this, 1);
EditorFrontHostApp.editorApp.treeWidget2.rerender();
break;
}
}
async delete() {
await this.model.delete();
this.parent.removeAction(this);
EditorFrontHostApp.editorApp.treeWidget2.select(null);
EditorFrontHostApp.editorApp.treeWidget2.rerender();
}
}
|
'use strict';
const express = require('express');
const router = express.Router();
router.get('/default', (req, res) => {
res.send('index')
})
module.exports = router
|
const [{a}] = 0;
|
import React, {Component} from 'react';
import PropTypes from 'prop-types';
function getStyles(props, context) {
const {tableRowColumn} = context.muiTheme;
const styles = {
root: {
paddingLeft: tableRowColumn.spacing,
paddingRight: tableRowColumn.spacing,
height: tableRowColumn.height,
textAlign: 'left',
fontSize: 13,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
},
};
if (React.Children.count(props.children) === 1 && !isNaN(props.children)) {
styles.textAlign = 'right';
}
return styles;
}
class TableRowColumn extends Component {
static propTypes = {
children: PropTypes.node,
/**
* The css class name of the root element.
*/
className: PropTypes.string,
/**
* @ignore
* Number to identify the header row. This property
* is automatically populated when used with TableHeader.
*/
columnNumber: PropTypes.number,
/**
* @ignore
* If true, this column responds to hover events.
*/
hoverable: PropTypes.bool,
/** @ignore */
onClick: PropTypes.func,
/** @ignore */
onHover: PropTypes.func,
/**
* @ignore
* Callback function for hover exit event.
*/
onHoverExit: PropTypes.func,
/**
* Override the inline-styles of the root element.
*/
style: PropTypes.object,
};
static defaultProps = {
hoverable: false,
};
static contextTypes = {
muiTheme: PropTypes.object.isRequired,
};
state = {
hovered: false,
};
onClick = (event) => {
if (this.props.onClick) {
this.props.onClick(event, this.props.columnNumber);
}
};
onMouseEnter = (event) => {
if (this.props.hoverable) {
this.setState({hovered: true});
if (this.props.onHover) {
this.props.onHover(event, this.props.columnNumber);
}
}
};
onMouseLeave = (event) => {
if (this.props.hoverable) {
this.setState({hovered: false});
if (this.props.onHoverExit) {
this.props.onHoverExit(event, this.props.columnNumber);
}
}
};
render() {
const {
children,
className,
columnNumber, // eslint-disable-line no-unused-vars
hoverable, // eslint-disable-line no-unused-vars
onClick, // eslint-disable-line no-unused-vars
onHover, // eslint-disable-line no-unused-vars
onHoverExit, // eslint-disable-line no-unused-vars
style,
...other
} = this.props;
const {prepareStyles} = this.context.muiTheme;
const styles = getStyles(this.props, this.context);
const handlers = {
onClick: this.onClick,
onMouseEnter: this.onMouseEnter,
onMouseLeave: this.onMouseLeave,
};
return (
<td
role="gridcell"
className={className}
style={prepareStyles(Object.assign(styles.root, style))}
{...handlers}
{...other}
>
{children}
</td>
);
}
}
export default TableRowColumn;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.